@firebase/firestore 4.7.7 → 4.7.8

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
@@ -10,7 +10,7 @@ import { Integer as R, Md5 as V } from "@firebase/webchannel-wrapper/bloom-blob"
10
10
 
11
11
  import { XhrIo as m, EventType as f, ErrorCode as g, createWebChannelTransport as p, getStatEventTarget as y, WebChannel as w, Event as S, Stat as b } from "@firebase/webchannel-wrapper/webchannel-blob";
12
12
 
13
- const D = "@firebase/firestore", v = "4.7.7";
13
+ const D = "@firebase/firestore", v = "4.7.8";
14
14
 
15
15
  /**
16
16
  * @license
@@ -72,7 +72,7 @@ User.MOCK_USER = new User("mock-user");
72
72
  * See the License for the specific language governing permissions and
73
73
  * limitations under the License.
74
74
  */
75
- let C = "11.3.0";
75
+ let C = "11.3.1";
76
76
 
77
77
  /**
78
78
  * @license
@@ -689,31 +689,6 @@ function __PRIVATE_randomBytes(e) {
689
689
  return n;
690
690
  }
691
691
 
692
- /**
693
- * @license
694
- * Copyright 2023 Google LLC
695
- *
696
- * Licensed under the Apache License, Version 2.0 (the "License");
697
- * you may not use this file except in compliance with the License.
698
- * You may obtain a copy of the License at
699
- *
700
- * http://www.apache.org/licenses/LICENSE-2.0
701
- *
702
- * Unless required by applicable law or agreed to in writing, software
703
- * distributed under the License is distributed on an "AS IS" BASIS,
704
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
705
- * See the License for the specific language governing permissions and
706
- * limitations under the License.
707
- */
708
- /**
709
- * An instance of the Platform's 'TextEncoder' implementation.
710
- */ function __PRIVATE_newTextEncoder() {
711
- return new TextEncoder;
712
- }
713
-
714
- /**
715
- * An instance of the Platform's 'TextDecoder' implementation.
716
- */
717
692
  /**
718
693
  * @license
719
694
  * Copyright 2017 Google LLC
@@ -735,8 +710,7 @@ function __PRIVATE_randomBytes(e) {
735
710
  *
736
711
  * @internal
737
712
  * Exported internally for testing purposes.
738
- */
739
- class __PRIVATE_AutoId {
713
+ */ class __PRIVATE_AutoId {
740
714
  static newId() {
741
715
  // Alphanumeric characters
742
716
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", t = 62 * Math.floor(256 / 62);
@@ -757,16 +731,6 @@ function __PRIVATE_primitiveComparator(e, t) {
757
731
  return e < t ? -1 : e > t ? 1 : 0;
758
732
  }
759
733
 
760
- /** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(e, t) {
761
- // Convert the string to UTF-8 encoded bytes
762
- const n = __PRIVATE_newTextEncoder().encode(e), r = __PRIVATE_newTextEncoder().encode(t);
763
- for (let e = 0; e < Math.min(n.length, r.length); e++) {
764
- const t = __PRIVATE_primitiveComparator(n[e], r[e]);
765
- if (0 !== t) return t;
766
- }
767
- return __PRIVATE_primitiveComparator(n.length, r.length);
768
- }
769
-
770
734
  /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(e, t, n) {
771
735
  return e.length === t.length && e.every(((e, r) => n(e, t[r])));
772
736
  }
@@ -1057,11 +1021,13 @@ class Timestamp {
1057
1021
  const n = BasePath.compareSegments(e.get(r), t.get(r));
1058
1022
  if (0 !== n) return n;
1059
1023
  }
1060
- return __PRIVATE_primitiveComparator(e.length, t.length);
1024
+ return Math.sign(e.length - t.length);
1061
1025
  }
1062
1026
  static compareSegments(e, t) {
1063
1027
  const n = BasePath.isNumericId(e), r = BasePath.isNumericId(t);
1064
- return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) : __PRIVATE_compareUtf8Strings(e, t);
1028
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) :
1029
+ // both non-numeric
1030
+ e < t ? -1 : e > t ? 1 : 0;
1065
1031
  }
1066
1032
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1067
1033
  static isNumericId(e) {
@@ -1849,13 +1815,13 @@ class __PRIVATE_SimpleDbTransaction {
1849
1815
  * within the key range or index.
1850
1816
  */ class __PRIVATE_IterationController {
1851
1817
  constructor(e) {
1852
- this.q = e, this.$ = !1, this.U = null;
1818
+ this.q = e, this.$ = !1, this.K = null;
1853
1819
  }
1854
1820
  get isDone() {
1855
1821
  return this.$;
1856
1822
  }
1857
- get K() {
1858
- return this.U;
1823
+ get U() {
1824
+ return this.K;
1859
1825
  }
1860
1826
  set cursor(e) {
1861
1827
  this.q = e;
@@ -1869,7 +1835,7 @@ class __PRIVATE_SimpleDbTransaction {
1869
1835
  * This function can be called to skip to that next key, which could be
1870
1836
  * an index or a primary key.
1871
1837
  */ W(e) {
1872
- this.U = e;
1838
+ this.K = e;
1873
1839
  }
1874
1840
  /**
1875
1841
  * Delete the current cursor value from the object store.
@@ -2028,7 +1994,7 @@ class __PRIVATE_SimpleDbTransaction {
2028
1994
  const e = o.catch((e => (s.done(), PersistencePromise.reject(e))));
2029
1995
  n.push(e);
2030
1996
  }
2031
- s.isDone ? r() : null === s.K ? i.continue() : i.continue(s.K);
1997
+ s.isDone ? r() : null === s.U ? i.continue() : i.continue(s.U);
2032
1998
  };
2033
1999
  })).next((() => PersistencePromise.waitFor(n)));
2034
2000
  }
@@ -2214,7 +2180,7 @@ __PRIVATE_ListenSequence.ae = -1;
2214
2180
  * limitations under the License.
2215
2181
  */
2216
2182
  /** Sentinel value that sorts before any Mutation Batch ID. */
2217
- const U = -1;
2183
+ const K = -1;
2218
2184
 
2219
2185
  /**
2220
2186
  * Returns whether a variable is either undefined or null.
@@ -2250,7 +2216,7 @@ const U = -1;
2250
2216
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2251
2217
  * See the License for the specific language governing permissions and
2252
2218
  * limitations under the License.
2253
- */ const K = "";
2219
+ */ const U = "";
2254
2220
 
2255
2221
  /**
2256
2222
  * Encodes a resource path into a IndexedDb-compatible string form.
@@ -2272,7 +2238,7 @@ function __PRIVATE_encodeResourcePath(e) {
2272
2238
  n += "";
2273
2239
  break;
2274
2240
 
2275
- case K:
2241
+ case U:
2276
2242
  n += "";
2277
2243
  break;
2278
2244
 
@@ -2284,7 +2250,7 @@ function __PRIVATE_encodeResourcePath(e) {
2284
2250
  }
2285
2251
 
2286
2252
  /** Encodes a path separator into the given result */ function __PRIVATE_encodeSeparator(e) {
2287
- return e + K + "";
2253
+ return e + U + "";
2288
2254
  }
2289
2255
 
2290
2256
  /**
@@ -2296,7 +2262,7 @@ function __PRIVATE_encodeResourcePath(e) {
2296
2262
  // Event the empty path must encode as a path of at least length 2. A path
2297
2263
  // with exactly 2 must be the empty path.
2298
2264
  const t = e.length;
2299
- if (__PRIVATE_hardAssert(t >= 2), 2 === t) return __PRIVATE_hardAssert(e.charAt(0) === K && "" === e.charAt(1)),
2265
+ if (__PRIVATE_hardAssert(t >= 2), 2 === t) return __PRIVATE_hardAssert(e.charAt(0) === U && "" === e.charAt(1)),
2300
2266
  ResourcePath.emptyPath();
2301
2267
  // Escape characters cannot exist past the second-to-last position in the
2302
2268
  // source value.
@@ -2305,7 +2271,7 @@ function __PRIVATE_encodeResourcePath(e) {
2305
2271
  for (let i = 0; i < t; ) {
2306
2272
  // The last two characters of a valid encoded path must be a separator, so
2307
2273
  // there must be an end to this segment.
2308
- const t = e.indexOf(K, i);
2274
+ const t = e.indexOf(U, i);
2309
2275
  (t < 0 || t > __PRIVATE_lastReasonableEscapeIndex) && fail();
2310
2276
  switch (e.charAt(t + 1)) {
2311
2277
  case "":
@@ -2394,7 +2360,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2394
2360
  * there is no useful information to store as the value. The raw (unencoded)
2395
2361
  * path cannot be stored because IndexedDb doesn't store prototype
2396
2362
  * information.
2397
- */ const ee = {}, te = "documentMutations", ne = "remoteDocumentsV14", re = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], ie = "documentKeyIndex", se = [ "prefixPath", "collectionGroup", "documentId" ], oe = "collectionGroupIndex", _e = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], ae = "remoteDocumentGlobal", ue = "remoteDocumentGlobalKey", ce = "targets", le = "queryTargetsIndex", he = [ "canonicalId", "targetId" ], Pe = "targetDocuments", Te = [ "targetId", "path" ], Ie = "documentTargetsIndex", Ee = [ "path", "targetId" ], de = "targetGlobalKey", Ae = "targetGlobal", Re = "collectionParents", Ve = [ "collectionId", "parent" ], me = "clientMetadata", fe = "clientId", ge = "bundles", pe = "bundleId", ye = "namedQueries", we = "name", Se = "indexConfiguration", be = "indexId", De = "collectionGroupIndex", ve = "collectionGroup", Ce = "indexState", Fe = [ "indexId", "uid" ], Me = "sequenceNumberIndex", xe = [ "uid", "sequenceNumber" ], Oe = "indexEntries", Ne = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Be = "documentKeyIndex", Le = [ "indexId", "uid", "orderedDocumentKey" ], ke = "documentOverlays", qe = [ "userId", "collectionPath", "documentId" ], Qe = "collectionPathOverlayIndex", $e = [ "userId", "collectionPath", "largestBatchId" ], Ue = "collectionGroupOverlayIndex", Ke = [ "userId", "collectionGroup", "largestBatchId" ], We = "globals", Ge = "name", ze = [ ...[ ...[ ...[ ...[ j, J, te, W, ce, G, Ae, Pe ], me ], ae ], Re ], ge, ye ], je = [ ...ze, ke ], He = [ j, J, te, ne, ce, G, Ae, Pe, me, ae, Re, ge, ye, ke ], Je = He, Ye = [ ...Je, Se, Ce, Oe ], Ze = Ye, Xe = [ ...Ye, We ];
2363
+ */ const ee = {}, te = "documentMutations", ne = "remoteDocumentsV14", re = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], ie = "documentKeyIndex", se = [ "prefixPath", "collectionGroup", "documentId" ], oe = "collectionGroupIndex", _e = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], ae = "remoteDocumentGlobal", ue = "remoteDocumentGlobalKey", ce = "targets", le = "queryTargetsIndex", he = [ "canonicalId", "targetId" ], Pe = "targetDocuments", Te = [ "targetId", "path" ], Ie = "documentTargetsIndex", Ee = [ "path", "targetId" ], de = "targetGlobalKey", Ae = "targetGlobal", Re = "collectionParents", Ve = [ "collectionId", "parent" ], me = "clientMetadata", fe = "clientId", ge = "bundles", pe = "bundleId", ye = "namedQueries", we = "name", Se = "indexConfiguration", be = "indexId", De = "collectionGroupIndex", ve = "collectionGroup", Ce = "indexState", Fe = [ "indexId", "uid" ], Me = "sequenceNumberIndex", xe = [ "uid", "sequenceNumber" ], Oe = "indexEntries", Ne = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Be = "documentKeyIndex", Le = [ "indexId", "uid", "orderedDocumentKey" ], ke = "documentOverlays", qe = [ "userId", "collectionPath", "documentId" ], Qe = "collectionPathOverlayIndex", $e = [ "userId", "collectionPath", "largestBatchId" ], Ke = "collectionGroupOverlayIndex", Ue = [ "userId", "collectionGroup", "largestBatchId" ], We = "globals", Ge = "name", ze = [ ...[ ...[ ...[ ...[ j, J, te, W, ce, G, Ae, Pe ], me ], ae ], Re ], ge, ye ], je = [ ...ze, ke ], He = [ j, J, te, ne, ce, G, Ae, Pe, me, ae, Re, ge, ye, ke ], Je = He, Ye = [ ...Je, Se, Ce, Oe ], Ze = Ye, Xe = [ ...Ye, We ];
2398
2364
 
2399
2365
  /**
2400
2366
  * @license
@@ -3464,7 +3430,7 @@ function __PRIVATE_valueCompare(e, t) {
3464
3430
  return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e), __PRIVATE_getLocalWriteTime(t));
3465
3431
 
3466
3432
  case 5 /* TypeOrder.StringValue */ :
3467
- return __PRIVATE_compareUtf8Strings(e.stringValue, t.stringValue);
3433
+ return __PRIVATE_primitiveComparator(e.stringValue, t.stringValue);
3468
3434
 
3469
3435
  case 6 /* TypeOrder.BlobValue */ :
3470
3436
  return function __PRIVATE_compareBlobs(e, t) {
@@ -3512,7 +3478,7 @@ function __PRIVATE_valueCompare(e, t) {
3512
3478
  // canonical IDs are independent of insertion order.
3513
3479
  r.sort(), s.sort();
3514
3480
  for (let e = 0; e < r.length && e < s.length; ++e) {
3515
- const t = __PRIVATE_compareUtf8Strings(r[e], s[e]);
3481
+ const t = __PRIVATE_primitiveComparator(r[e], s[e]);
3516
3482
  if (0 !== t) return t;
3517
3483
  const o = __PRIVATE_valueCompare(n[r[e]], i[s[e]]);
3518
3484
  if (0 !== o) return o;
@@ -5924,6 +5890,32 @@ let mt = null;
5924
5890
  * Sets the value of the `testingHooksSpi` object.
5925
5891
  * @param instance the instance to set.
5926
5892
  */
5893
+ /**
5894
+ * @license
5895
+ * Copyright 2023 Google LLC
5896
+ *
5897
+ * Licensed under the Apache License, Version 2.0 (the "License");
5898
+ * you may not use this file except in compliance with the License.
5899
+ * You may obtain a copy of the License at
5900
+ *
5901
+ * http://www.apache.org/licenses/LICENSE-2.0
5902
+ *
5903
+ * Unless required by applicable law or agreed to in writing, software
5904
+ * distributed under the License is distributed on an "AS IS" BASIS,
5905
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5906
+ * See the License for the specific language governing permissions and
5907
+ * limitations under the License.
5908
+ */
5909
+ /**
5910
+ * An instance of the Platform's 'TextEncoder' implementation.
5911
+ */
5912
+ function __PRIVATE_newTextEncoder() {
5913
+ return new TextEncoder;
5914
+ }
5915
+
5916
+ /**
5917
+ * An instance of the Platform's 'TextDecoder' implementation.
5918
+ */
5927
5919
  /**
5928
5920
  * @license
5929
5921
  * Copyright 2022 Google LLC
@@ -6296,13 +6288,13 @@ class __PRIVATE_WatchChangeAggregator {
6296
6288
  /** Keeps track of the documents to update since the last raised snapshot. */
6297
6289
  this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6298
6290
  /** A mapping of document keys to their set of target IDs. */
6299
- this.Ue = __PRIVATE_documentTargetMap(),
6291
+ this.Ke = __PRIVATE_documentTargetMap(),
6300
6292
  /**
6301
6293
  * A map of targets with existence filter mismatches. These targets are
6302
6294
  * known to be inconsistent and their listens needs to be re-established by
6303
6295
  * RemoteStore.
6304
6296
  */
6305
- this.Ke = new SortedMap(__PRIVATE_primitiveComparator);
6297
+ this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6306
6298
  }
6307
6299
  /**
6308
6300
  * Processes and adds the DocumentWatchChange to the current set of changes.
@@ -6391,7 +6383,7 @@ class __PRIVATE_WatchChangeAggregator {
6391
6383
  // trigger re-run of the query.
6392
6384
  this.Ye(t);
6393
6385
  const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6394
- this.Ke = this.Ke.insert(t, e);
6386
+ this.Ue = this.Ue.insert(t, e);
6395
6387
  }
6396
6388
  null == mt || mt.rt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6397
6389
  var s, o, _, a, u, c;
@@ -6503,7 +6495,7 @@ class __PRIVATE_WatchChangeAggregator {
6503
6495
 
6504
6496
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6505
6497
  // client.
6506
- this.Ue.forEach(((e, t) => {
6498
+ this.Ke.forEach(((e, t) => {
6507
6499
  let r = !0;
6508
6500
  t.forEachWhile((e => {
6509
6501
  const t = this.Xe(e);
@@ -6511,9 +6503,9 @@ class __PRIVATE_WatchChangeAggregator {
6511
6503
  !1);
6512
6504
  })), r && (n = n.add(e));
6513
6505
  })), this.Qe.forEach(((t, n) => n.setReadTime(e)));
6514
- const r = new RemoteEvent(e, t, this.Ke, this.Qe, n);
6506
+ const r = new RemoteEvent(e, t, this.Ue, this.Qe, n);
6515
6507
  return this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6516
- this.Ue = __PRIVATE_documentTargetMap(), this.Ke = new SortedMap(__PRIVATE_primitiveComparator),
6508
+ this.Ke = __PRIVATE_documentTargetMap(), this.Ue = new SortedMap(__PRIVATE_primitiveComparator),
6517
6509
  r;
6518
6510
  }
6519
6511
  /**
@@ -6525,7 +6517,7 @@ class __PRIVATE_WatchChangeAggregator {
6525
6517
  if (!this.Je(e)) return;
6526
6518
  const n = this.ut(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6527
6519
  this.He(e).xe(t.key, n), this.Qe = this.Qe.insert(t.key, t), this.$e = this.$e.insert(t.key, this._t(t.key).add(e)),
6528
- this.Ue = this.Ue.insert(t.key, this.ct(t.key).add(e));
6520
+ this.Ke = this.Ke.insert(t.key, this.ct(t.key).add(e));
6529
6521
  }
6530
6522
  /**
6531
6523
  * Removes the provided document from the target mapping. If the
@@ -6541,7 +6533,7 @@ class __PRIVATE_WatchChangeAggregator {
6541
6533
  this.ut(e, t) ? r.xe(t, 1 /* ChangeType.Removed */) :
6542
6534
  // The document may have entered and left the target before we raised a
6543
6535
  // snapshot, so we can just ignore the change.
6544
- r.Oe(t), this.Ue = this.Ue.insert(t, this.ct(t).delete(e)), this.Ue = this.Ue.insert(t, this.ct(t).add(e)),
6536
+ r.Oe(t), this.Ke = this.Ke.insert(t, this.ct(t).delete(e)), this.Ke = this.Ke.insert(t, this.ct(t).add(e)),
6545
6537
  n && (this.Qe = this.Qe.insert(t, n));
6546
6538
  }
6547
6539
  removeTarget(e) {
@@ -6566,8 +6558,8 @@ class __PRIVATE_WatchChangeAggregator {
6566
6558
  return t || (t = new __PRIVATE_TargetState, this.qe.set(e, t)), t;
6567
6559
  }
6568
6560
  ct(e) {
6569
- let t = this.Ue.get(e);
6570
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6561
+ let t = this.Ke.get(e);
6562
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ke = this.Ke.insert(e, t)),
6571
6563
  t;
6572
6564
  }
6573
6565
  _t(e) {
@@ -7701,7 +7693,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7701
7693
  const o = IDBKeyRange.bound([ this.userId, t, n ], [ this.userId, t, Number.POSITIVE_INFINITY ],
7702
7694
  /*lowerOpen=*/ !0);
7703
7695
  return __PRIVATE_documentOverlayStore(e).Z({
7704
- index: Ue,
7696
+ index: Ke,
7705
7697
  range: o
7706
7698
  }, ((e, t, n) => {
7707
7699
  // We do not want to return partial batch overlays, even if the size
@@ -7962,10 +7954,10 @@ function __PRIVATE_unsignedNumLength(e) {
7962
7954
  }
7963
7955
  this.qt();
7964
7956
  }
7965
- Ut(e) {
7957
+ Kt(e) {
7966
7958
  // Values are encoded with a single byte length prefix, followed by the
7967
7959
  // actual value in big-endian format with leading 0 bytes dropped.
7968
- const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7960
+ const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7969
7961
  this.Wt(1 + n), this.buffer[this.position++] = 255 & n;
7970
7962
  // Write the length
7971
7963
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = 255 & t[e];
@@ -7973,7 +7965,7 @@ function __PRIVATE_unsignedNumLength(e) {
7973
7965
  Gt(e) {
7974
7966
  // Values are encoded with a single byte length prefix, followed by the
7975
7967
  // inverted value in big-endian format with leading 0 bytes dropped.
7976
- const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7968
+ const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7977
7969
  this.Wt(1 + n), this.buffer[this.position++] = ~(255 & n);
7978
7970
  // Write the length
7979
7971
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = ~(255 & t[e]);
@@ -8008,7 +8000,7 @@ function __PRIVATE_unsignedNumLength(e) {
8008
8000
  * -0.0 < 0.0
8009
8001
  * all non-NaN < NaN
8010
8002
  * NaN = NaN
8011
- */ Kt(e) {
8003
+ */ Ut(e) {
8012
8004
  const t =
8013
8005
  /** Converts a JavaScript number to a byte array (using big endian encoding). */
8014
8006
  function __PRIVATE_doubleToLongBits(e) {
@@ -8067,7 +8059,7 @@ class __PRIVATE_AscendingIndexByteEncoder {
8067
8059
  this.Zt.Qt(e);
8068
8060
  }
8069
8061
  gt(e) {
8070
- this.Zt.Ut(e);
8062
+ this.Zt.Kt(e);
8071
8063
  }
8072
8064
  Vt() {
8073
8065
  this.Zt.zt();
@@ -9361,7 +9353,7 @@ class __PRIVATE_IndexedDbMutationQueue {
9361
9353
  }
9362
9354
  getHighestUnacknowledgedBatchId(e) {
9363
9355
  const t = IDBKeyRange.upperBound([ this.userId, Number.POSITIVE_INFINITY ]);
9364
- let n = U;
9356
+ let n = K;
9365
9357
  return __PRIVATE_mutationsStore(e).Z({
9366
9358
  index: Z,
9367
9359
  range: t,
@@ -9371,7 +9363,7 @@ class __PRIVATE_IndexedDbMutationQueue {
9371
9363
  })).next((() => n));
9372
9364
  }
9373
9365
  getAllMutationBatches(e) {
9374
- const t = IDBKeyRange.bound([ this.userId, U ], [ this.userId, Number.POSITIVE_INFINITY ]);
9366
+ const t = IDBKeyRange.bound([ this.userId, K ], [ this.userId, Number.POSITIVE_INFINITY ]);
9375
9367
  return __PRIVATE_mutationsStore(e).G(Z, t).next((e => e.map((e => __PRIVATE_fromDbMutationBatch(this.serializer, e)))));
9376
9368
  }
9377
9369
  getAllMutationBatchesAffectingDocumentKey(e, t) {
@@ -9497,7 +9489,7 @@ class __PRIVATE_IndexedDbMutationQueue {
9497
9489
  Qn(e) {
9498
9490
  return __PRIVATE_mutationQueuesStore(e).get(this.userId).next((e => e || {
9499
9491
  userId: this.userId,
9500
- lastAcknowledgedBatchId: U,
9492
+ lastAcknowledgedBatchId: K,
9501
9493
  lastStreamToken: ""
9502
9494
  }));
9503
9495
  }
@@ -9576,14 +9568,14 @@ class __PRIVATE_TargetIdGenerator {
9576
9568
  next() {
9577
9569
  return this.$n += 2, this.$n;
9578
9570
  }
9579
- static Un() {
9571
+ static Kn() {
9580
9572
  // The target cache generator must return '2' in its first call to `next()`
9581
9573
  // as there is no differentiation in the protocol layer between an unset
9582
9574
  // number and the number '0'. If we were to sent a target with target ID
9583
9575
  // '0', the backend would consider it unset and replace it with its own ID.
9584
9576
  return new __PRIVATE_TargetIdGenerator(0);
9585
9577
  }
9586
- static Kn() {
9578
+ static Un() {
9587
9579
  // Sync engine assigns target IDs for limbo document detection.
9588
9580
  return new __PRIVATE_TargetIdGenerator(-1);
9589
9581
  }
@@ -11072,7 +11064,7 @@ class __PRIVATE_DocReference {
11072
11064
  return PersistencePromise.resolve(this.mutationQueue.length > i ? this.mutationQueue[i] : null);
11073
11065
  }
11074
11066
  getHighestUnacknowledgedBatchId() {
11075
- return PersistencePromise.resolve(0 === this.mutationQueue.length ? U : this.Fr - 1);
11067
+ return PersistencePromise.resolve(0 === this.mutationQueue.length ? K : this.Fr - 1);
11076
11068
  }
11077
11069
  getAllMutationBatches(e) {
11078
11070
  return PersistencePromise.resolve(this.mutationQueue.slice());
@@ -11351,7 +11343,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11351
11343
  * A ordered bidirectional mapping between documents and the remote target
11352
11344
  * IDs.
11353
11345
  */
11354
- this.Ur = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Kr = __PRIVATE_TargetIdGenerator.Un();
11346
+ this.Kr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Ur = __PRIVATE_TargetIdGenerator.Kn();
11355
11347
  }
11356
11348
  forEachTarget(e, t) {
11357
11349
  return this.Qr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
@@ -11363,7 +11355,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11363
11355
  return PersistencePromise.resolve(this.$r);
11364
11356
  }
11365
11357
  allocateTargetId(e) {
11366
- return this.highestTargetId = this.Kr.next(), PersistencePromise.resolve(this.highestTargetId);
11358
+ return this.highestTargetId = this.Ur.next(), PersistencePromise.resolve(this.highestTargetId);
11367
11359
  }
11368
11360
  setTargetsMetadata(e, t, n) {
11369
11361
  return n && (this.lastRemoteSnapshotVersion = n), t > this.$r && (this.$r = t),
@@ -11372,7 +11364,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11372
11364
  zn(e) {
11373
11365
  this.Qr.set(e.target, e);
11374
11366
  const t = e.targetId;
11375
- t > this.highestTargetId && (this.Kr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11367
+ t > this.highestTargetId && (this.Ur = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11376
11368
  e.sequenceNumber > this.$r && (this.$r = e.sequenceNumber);
11377
11369
  }
11378
11370
  addTargetData(e, t) {
@@ -11382,7 +11374,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11382
11374
  return this.zn(t), PersistencePromise.resolve();
11383
11375
  }
11384
11376
  removeTargetData(e, t) {
11385
- return this.Qr.delete(t.target), this.Ur.br(t.targetId), this.targetCount -= 1,
11377
+ return this.Qr.delete(t.target), this.Kr.br(t.targetId), this.targetCount -= 1,
11386
11378
  PersistencePromise.resolve();
11387
11379
  }
11388
11380
  removeTargets(e, t, n) {
@@ -11401,24 +11393,24 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11401
11393
  return PersistencePromise.resolve(n);
11402
11394
  }
11403
11395
  addMatchingKeys(e, t, n) {
11404
- return this.Ur.yr(t, n), PersistencePromise.resolve();
11396
+ return this.Kr.yr(t, n), PersistencePromise.resolve();
11405
11397
  }
11406
11398
  removeMatchingKeys(e, t, n) {
11407
- this.Ur.Sr(t, n);
11399
+ this.Kr.Sr(t, n);
11408
11400
  const r = this.persistence.referenceDelegate, i = [];
11409
11401
  return r && t.forEach((t => {
11410
11402
  i.push(r.markPotentiallyOrphaned(e, t));
11411
11403
  })), PersistencePromise.waitFor(i);
11412
11404
  }
11413
11405
  removeMatchingKeysForTargetId(e, t) {
11414
- return this.Ur.br(t), PersistencePromise.resolve();
11406
+ return this.Kr.br(t), PersistencePromise.resolve();
11415
11407
  }
11416
11408
  getMatchingKeysForTargetId(e, t) {
11417
- const n = this.Ur.vr(t);
11409
+ const n = this.Kr.vr(t);
11418
11410
  return PersistencePromise.resolve(n);
11419
11411
  }
11420
11412
  containsKey(e, t) {
11421
- return PersistencePromise.resolve(this.Ur.containsKey(t));
11413
+ return PersistencePromise.resolve(this.Kr.containsKey(t));
11422
11414
  }
11423
11415
  }
11424
11416
 
@@ -11775,7 +11767,7 @@ class __PRIVATE_MemoryLruDelegate {
11775
11767
  });
11776
11768
  t.createIndex(Qe, $e, {
11777
11769
  unique: !1
11778
- }), t.createIndex(Ue, Ke, {
11770
+ }), t.createIndex(Ke, Ue, {
11779
11771
  unique: !1
11780
11772
  });
11781
11773
  }(e);
@@ -11833,7 +11825,7 @@ class __PRIVATE_MemoryLruDelegate {
11833
11825
  _i(e) {
11834
11826
  const t = e.store(j), n = e.store(J);
11835
11827
  return t.G().next((t => PersistencePromise.forEach(t, (t => {
11836
- const r = IDBKeyRange.bound([ t.userId, U ], [ t.userId, t.lastAcknowledgedBatchId ]);
11828
+ const r = IDBKeyRange.bound([ t.userId, K ], [ t.userId, t.lastAcknowledgedBatchId ]);
11837
11829
  return n.G(Z, r).next((n => PersistencePromise.forEach(n, (n => {
11838
11830
  __PRIVATE_hardAssert(n.userId === t.userId);
11839
11831
  const r = __PRIVATE_fromDbMutationBatch(this.serializer, n);
@@ -12214,7 +12206,7 @@ class __PRIVATE_IndexedDbPersistence {
12214
12206
  async shutdown() {
12215
12207
  // The shutdown() operations are idempotent and can be called even when
12216
12208
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12217
- this.zr = !1, this.Ui(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ki(),
12209
+ this.zr = !1, this.Ki(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ui(),
12218
12210
  this.Wi(),
12219
12211
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12220
12212
  // has obtained the primary lease.
@@ -12324,7 +12316,7 @@ class __PRIVATE_IndexedDbPersistence {
12324
12316
  this.wi())));
12325
12317
  }, this.document.addEventListener("visibilitychange", this.Ri), this.inForeground = "visible" === this.document.visibilityState);
12326
12318
  }
12327
- Ki() {
12319
+ Ui() {
12328
12320
  this.Ri && (this.document.removeEventListener("visibilitychange", this.Ri), this.Ri = null);
12329
12321
  }
12330
12322
  /**
@@ -12342,7 +12334,7 @@ class __PRIVATE_IndexedDbPersistence {
12342
12334
  // Note: In theory, this should be scheduled on the AsyncQueue since it
12343
12335
  // accesses internal state. We execute this code directly during shutdown
12344
12336
  // to make sure it gets a chance to run.
12345
- this.Ui();
12337
+ this.Ki();
12346
12338
  const e = /(?:Version|Mobile)\/1[456]/;
12347
12339
  T() && (navigator.appVersion.match(e) || navigator.userAgent.match(e)) &&
12348
12340
  // On Safari 14, 15, and 16, we do not run any cleanup actions as it might
@@ -12373,7 +12365,7 @@ class __PRIVATE_IndexedDbPersistence {
12373
12365
  /**
12374
12366
  * Record client as zombied (a client that had its tab closed). Zombied
12375
12367
  * clients are ignored during primary tab selection.
12376
- */ Ui() {
12368
+ */ Ki() {
12377
12369
  if (this.yi) try {
12378
12370
  this.yi.setItem(this.Qi(this.clientId), String(Date.now()));
12379
12371
  } catch (e) {
@@ -12989,7 +12981,7 @@ function __PRIVATE_localStoreGetLastRemoteSnapshotVersion(e) {
12989
12981
  */
12990
12982
  function __PRIVATE_localStoreGetNextMutationBatch(e, t) {
12991
12983
  const n = __PRIVATE_debugCast(e);
12992
- return n.persistence.runTransaction("Get next mutation batch", "readonly", (e => (void 0 === t && (t = U),
12984
+ return n.persistence.runTransaction("Get next mutation batch", "readonly", (e => (void 0 === t && (t = K),
12993
12985
  n.mutationQueue.getNextMutationBatchAfterBatchId(e, t))));
12994
12986
  }
12995
12987
 
@@ -13237,7 +13229,7 @@ const $t = "firestore_targets";
13237
13229
  * See the License for the specific language governing permissions and
13238
13230
  * limitations under the License.
13239
13231
  */
13240
- const Ut = "SharedClientState";
13232
+ const Kt = "SharedClientState";
13241
13233
 
13242
13234
  /**
13243
13235
  * Holds the state of a mutation batch, including its user ID, batch ID and
@@ -13255,7 +13247,7 @@ class __PRIVATE_MutationMetadata {
13255
13247
  const r = JSON.parse(n);
13256
13248
  let i, s = "object" == typeof r && -1 !== [ "pending", "acknowledged", "rejected" ].indexOf(r.state) && (void 0 === r.error || "object" == typeof r.error);
13257
13249
  return s && r.error && (s = "string" == typeof r.error.message && "string" == typeof r.error.code,
13258
- s && (i = new FirestoreError(r.error.code, r.error.message))), s ? new __PRIVATE_MutationMetadata(e, t, r.state, i) : (__PRIVATE_logError(Ut, `Failed to parse mutation state for ID '${t}': ${n}`),
13250
+ s && (i = new FirestoreError(r.error.code, r.error.message))), s ? new __PRIVATE_MutationMetadata(e, t, r.state, i) : (__PRIVATE_logError(Kt, `Failed to parse mutation state for ID '${t}': ${n}`),
13259
13251
  null);
13260
13252
  }
13261
13253
  bs() {
@@ -13286,7 +13278,7 @@ class __PRIVATE_QueryTargetMetadata {
13286
13278
  const n = JSON.parse(t);
13287
13279
  let r, i = "object" == typeof n && -1 !== [ "not-current", "current", "rejected" ].indexOf(n.state) && (void 0 === n.error || "object" == typeof n.error);
13288
13280
  return i && n.error && (i = "string" == typeof n.error.message && "string" == typeof n.error.code,
13289
- i && (r = new FirestoreError(n.error.code, n.error.message))), i ? new __PRIVATE_QueryTargetMetadata(e, n.state, r) : (__PRIVATE_logError(Ut, `Failed to parse target state for ID '${e}': ${t}`),
13281
+ i && (r = new FirestoreError(n.error.code, n.error.message))), i ? new __PRIVATE_QueryTargetMetadata(e, n.state, r) : (__PRIVATE_logError(Kt, `Failed to parse target state for ID '${e}': ${t}`),
13290
13282
  null);
13291
13283
  }
13292
13284
  bs() {
@@ -13316,7 +13308,7 @@ class __PRIVATE_QueryTargetMetadata {
13316
13308
  let r = "object" == typeof n && n.activeTargetIds instanceof Array, i = __PRIVATE_targetIdSet();
13317
13309
  for (let e = 0; r && e < n.activeTargetIds.length; ++e) r = isSafeInteger(n.activeTargetIds[e]),
13318
13310
  i = i.add(n.activeTargetIds[e]);
13319
- return r ? new __PRIVATE_RemoteClientState(e, i) : (__PRIVATE_logError(Ut, `Failed to parse client data for instance '${e}': ${t}`),
13311
+ return r ? new __PRIVATE_RemoteClientState(e, i) : (__PRIVATE_logError(Kt, `Failed to parse client data for instance '${e}': ${t}`),
13320
13312
  null);
13321
13313
  }
13322
13314
  }
@@ -13334,7 +13326,7 @@ class __PRIVATE_QueryTargetMetadata {
13334
13326
  * Logs a warning and returns null if the format of the data is not valid.
13335
13327
  */ static Ss(e) {
13336
13328
  const t = JSON.parse(e);
13337
- return "object" == typeof t && -1 !== [ "Unknown", "Online", "Offline" ].indexOf(t.onlineState) && "string" == typeof t.clientId ? new __PRIVATE_SharedOnlineState(t.clientId, t.onlineState) : (__PRIVATE_logError(Ut, `Failed to parse online state: ${e}`),
13329
+ return "object" == typeof t && -1 !== [ "Unknown", "Online", "Offline" ].indexOf(t.onlineState) && "string" == typeof t.clientId ? new __PRIVATE_SharedOnlineState(t.clientId, t.onlineState) : (__PRIVATE_logError(Kt, `Failed to parse online state: ${e}`),
13338
13330
  null);
13339
13331
  }
13340
13332
  }
@@ -13435,12 +13427,12 @@ class __PRIVATE_LocalClientState {
13435
13427
  n && (this.xs = this.xs.insert(n.clientId, n));
13436
13428
  }
13437
13429
  }
13438
- this.Us();
13430
+ this.Ks();
13439
13431
  // Check if there is an existing online state and call the callback handler
13440
13432
  // if applicable.
13441
13433
  const t = this.storage.getItem(this.Qs);
13442
13434
  if (t) {
13443
- const e = this.Ks(t);
13435
+ const e = this.Us(t);
13444
13436
  e && this.Ws(e);
13445
13437
  }
13446
13438
  for (const e of this.Os) this.Ms(e);
@@ -13484,10 +13476,10 @@ class __PRIVATE_LocalClientState {
13484
13476
  }
13485
13477
  // If the query is listening to cache only, the target ID should not be registered with the
13486
13478
  // local Firestore client as an active watch target.
13487
- return t && this.Hs.Ds(e), this.Us(), n;
13479
+ return t && this.Hs.Ds(e), this.Ks(), n;
13488
13480
  }
13489
13481
  removeLocalQueryTarget(e) {
13490
- this.Hs.vs(e), this.Us();
13482
+ this.Hs.vs(e), this.Ks();
13491
13483
  }
13492
13484
  isLocalQueryTarget(e) {
13493
13485
  return this.Hs.activeTargetIds.has(e);
@@ -13517,20 +13509,20 @@ class __PRIVATE_LocalClientState {
13517
13509
  }
13518
13510
  getItem(e) {
13519
13511
  const t = this.storage.getItem(e);
13520
- return __PRIVATE_logDebug(Ut, "READ", e, t), t;
13512
+ return __PRIVATE_logDebug(Kt, "READ", e, t), t;
13521
13513
  }
13522
13514
  setItem(e, t) {
13523
- __PRIVATE_logDebug(Ut, "SET", e, t), this.storage.setItem(e, t);
13515
+ __PRIVATE_logDebug(Kt, "SET", e, t), this.storage.setItem(e, t);
13524
13516
  }
13525
13517
  removeItem(e) {
13526
- __PRIVATE_logDebug(Ut, "REMOVE", e), this.storage.removeItem(e);
13518
+ __PRIVATE_logDebug(Kt, "REMOVE", e), this.storage.removeItem(e);
13527
13519
  }
13528
13520
  Ms(e) {
13529
13521
  // Note: The function is typed to take Event to be interface-compatible with
13530
13522
  // `Window.addEventListener`.
13531
13523
  const t = e;
13532
13524
  if (t.storageArea === this.storage) {
13533
- if (__PRIVATE_logDebug(Ut, "EVENT", t.key, t.newValue), t.key === this.Ns) return void __PRIVATE_logError("Received WebStorage notification for local change. Another client might have garbage-collected our state");
13525
+ if (__PRIVATE_logDebug(Kt, "EVENT", t.key, t.newValue), t.key === this.Ns) return void __PRIVATE_logError("Received WebStorage notification for local change. Another client might have garbage-collected our state");
13534
13526
  this.Ti.enqueueRetryable((async () => {
13535
13527
  if (this.started) {
13536
13528
  if (null !== t.key) if (this.Ls.test(t.key)) {
@@ -13554,7 +13546,7 @@ class __PRIVATE_LocalClientState {
13554
13546
  }
13555
13547
  } else if (t.key === this.Qs) {
13556
13548
  if (null !== t.newValue) {
13557
- const e = this.Ks(t.newValue);
13549
+ const e = this.Us(t.newValue);
13558
13550
  if (e) return this.Ws(e);
13559
13551
  }
13560
13552
  } else if (t.key === this.Bs) {
@@ -13564,7 +13556,7 @@ class __PRIVATE_LocalClientState {
13564
13556
  const n = JSON.parse(e);
13565
13557
  __PRIVATE_hardAssert("number" == typeof n), t = n;
13566
13558
  } catch (e) {
13567
- __PRIVATE_logError(Ut, "Failed to read sequence number from WebStorage", e);
13559
+ __PRIVATE_logError(Kt, "Failed to read sequence number from WebStorage", e);
13568
13560
  }
13569
13561
  return t;
13570
13562
  }
@@ -13585,7 +13577,7 @@ class __PRIVATE_LocalClientState {
13585
13577
  get Hs() {
13586
13578
  return this.xs.get(this.Cs);
13587
13579
  }
13588
- Us() {
13580
+ Ks() {
13589
13581
  this.setItem(this.Ns, this.Hs.bs());
13590
13582
  }
13591
13583
  zs(e, t, n) {
@@ -13642,7 +13634,7 @@ class __PRIVATE_LocalClientState {
13642
13634
  /**
13643
13635
  * Parses an online state from WebStorage. Returns 'null' if the value
13644
13636
  * could not be parsed.
13645
- */ Ks(e) {
13637
+ */ Us(e) {
13646
13638
  return __PRIVATE_SharedOnlineState.Ss(e);
13647
13639
  }
13648
13640
  _o(e) {
@@ -13650,7 +13642,7 @@ class __PRIVATE_LocalClientState {
13650
13642
  }
13651
13643
  async io(e) {
13652
13644
  if (e.user.uid === this.currentUser.uid) return this.syncEngine.uo(e.batchId, e.state, e.error);
13653
- __PRIVATE_logDebug(Ut, `Ignoring mutation for non-active user ${e.user.uid}`);
13645
+ __PRIVATE_logDebug(Kt, `Ignoring mutation for non-active user ${e.user.uid}`);
13654
13646
  }
13655
13647
  oo(e) {
13656
13648
  return this.syncEngine.co(e.targetId, e.state, e.error);
@@ -13770,7 +13762,7 @@ class __PRIVATE_MemorySharedClientState {
13770
13762
  * limitations under the License.
13771
13763
  */
13772
13764
  // References to `window` are guarded by BrowserConnectivityMonitor.isAvailable()
13773
- /* eslint-disable no-restricted-globals */ const Kt = "ConnectivityMonitor";
13765
+ /* eslint-disable no-restricted-globals */ const Ut = "ConnectivityMonitor";
13774
13766
 
13775
13767
  /**
13776
13768
  * Browser implementation of ConnectivityMonitor.
@@ -13788,11 +13780,11 @@ class __PRIVATE_MemorySharedClientState {
13788
13780
  window.addEventListener("online", this.Io), window.addEventListener("offline", this.Ao);
13789
13781
  }
13790
13782
  Eo() {
13791
- __PRIVATE_logDebug(Kt, "Network connectivity changed: AVAILABLE");
13783
+ __PRIVATE_logDebug(Ut, "Network connectivity changed: AVAILABLE");
13792
13784
  for (const e of this.Vo) e(0 /* NetworkStatus.AVAILABLE */);
13793
13785
  }
13794
13786
  Ro() {
13795
- __PRIVATE_logDebug(Kt, "Network connectivity changed: UNAVAILABLE");
13787
+ __PRIVATE_logDebug(Ut, "Network connectivity changed: UNAVAILABLE");
13796
13788
  for (const e of this.Vo) e(1 /* NetworkStatus.UNAVAILABLE */);
13797
13789
  }
13798
13790
  // TODO(chenbrian): Consider passing in window either into this component or
@@ -13990,10 +13982,10 @@ class __PRIVATE_RestConnection {
13990
13982
  $o() {
13991
13983
  this.Bo();
13992
13984
  }
13993
- Uo(e) {
13985
+ Ko(e) {
13994
13986
  this.ko(e);
13995
13987
  }
13996
- Ko(e) {
13988
+ Uo(e) {
13997
13989
  this.qo(e);
13998
13990
  }
13999
13991
  }
@@ -14145,10 +14137,10 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14145
14137
  h || (__PRIVATE_logDebug(jt, `RPC '${e}' stream ${r} transport opened.`), P.Qo());
14146
14138
  })), __PRIVATE_unguardedEventListen(c, w.EventType.CLOSE, (() => {
14147
14139
  h || (h = !0, __PRIVATE_logDebug(jt, `RPC '${e}' stream ${r} transport closed`),
14148
- P.Uo());
14140
+ P.Ko());
14149
14141
  })), __PRIVATE_unguardedEventListen(c, w.EventType.ERROR, (t => {
14150
14142
  h || (h = !0, __PRIVATE_logWarn(jt, `RPC '${e}' stream ${r} transport errored:`, t),
14151
- P.Uo(new FirestoreError(M.UNAVAILABLE, "The operation could not be completed")));
14143
+ P.Ko(new FirestoreError(M.UNAVAILABLE, "The operation could not be completed")));
14152
14144
  })), __PRIVATE_unguardedEventListen(c, w.EventType.MESSAGE, (t => {
14153
14145
  var n;
14154
14146
  if (!h) {
@@ -14179,8 +14171,8 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14179
14171
  }(t), i = o.message;
14180
14172
  void 0 === n && (n = M.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
14181
14173
  // Mark closed so no further events are propagated
14182
- h = !0, P.Uo(new FirestoreError(n, i)), c.close();
14183
- } else __PRIVATE_logDebug(jt, `RPC '${e}' stream ${r} received:`, i), P.Ko(i);
14174
+ h = !0, P.Ko(new FirestoreError(n, i)), c.close();
14175
+ } else __PRIVATE_logDebug(jt, `RPC '${e}' stream ${r} received:`, i), P.Uo(i);
14184
14176
  }
14185
14177
  })), __PRIVATE_unguardedEventListen(o, S.STAT_EVENT, (t => {
14186
14178
  t.stat === b.PROXY ? __PRIVATE_logDebug(jt, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === b.NOPROXY && __PRIVATE_logDebug(jt, `RPC '${e}' stream ${r} detected no buffering proxy`);
@@ -14915,7 +14907,7 @@ class __PRIVATE_RemoteStoreImpl {
14915
14907
  * purely based on order, and so we can just shift() writes from the front of
14916
14908
  * the writePipeline as we receive responses.
14917
14909
  */
14918
- this.U_ = [],
14910
+ this.K_ = [],
14919
14911
  /**
14920
14912
  * A mapping of watched targets that the client cares about tracking and the
14921
14913
  * user has explicitly called a 'listen' for this target.
@@ -14925,7 +14917,7 @@ class __PRIVATE_RemoteStoreImpl {
14925
14917
  * to the server. The targets removed with unlistens are removed eagerly
14926
14918
  * without waiting for confirmation from the listen stream.
14927
14919
  */
14928
- this.K_ = new Map,
14920
+ this.U_ = new Map,
14929
14921
  /**
14930
14922
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14931
14923
  * RemoteStore may start its network connections.
@@ -14972,9 +14964,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14972
14964
  */
14973
14965
  function __PRIVATE_remoteStoreListen(e, t) {
14974
14966
  const n = __PRIVATE_debugCast(e);
14975
- n.K_.has(t.targetId) || (
14967
+ n.U_.has(t.targetId) || (
14976
14968
  // Mark this as something the client is currently listening for.
14977
- n.K_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14969
+ n.U_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14978
14970
  // The listen will be sent in onWatchStreamOpen
14979
14971
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).c_() && __PRIVATE_sendWatchRequest(n, t));
14980
14972
  }
@@ -14984,7 +14976,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14984
14976
  * not being listened to.
14985
14977
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14986
14978
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14987
- n.K_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.K_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14979
+ n.U_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.U_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14988
14980
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14989
14981
  // have no listeners, since without any listens to send we cannot
14990
14982
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -15013,7 +15005,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
15013
15005
  function __PRIVATE_startWatchStream(e) {
15014
15006
  e.H_ = new __PRIVATE_WatchChangeAggregator({
15015
15007
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
15016
- lt: t => e.K_.get(t) || null,
15008
+ lt: t => e.U_.get(t) || null,
15017
15009
  it: () => e.datastore.serializer.databaseId
15018
15010
  }), __PRIVATE_ensureWatchStream(e).start(), e.j_.B_();
15019
15011
  }
@@ -15022,7 +15014,7 @@ function __PRIVATE_startWatchStream(e) {
15022
15014
  * Returns whether the watch stream should be started because it's necessary
15023
15015
  * and has not yet been started.
15024
15016
  */ function __PRIVATE_shouldStartWatchStream(e) {
15025
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.K_.size > 0;
15017
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.U_.size > 0;
15026
15018
  }
15027
15019
 
15028
15020
  function __PRIVATE_canUseNetwork(e) {
@@ -15039,7 +15031,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
15039
15031
  }
15040
15032
 
15041
15033
  async function __PRIVATE_onWatchStreamOpen(e) {
15042
- e.K_.forEach(((t, n) => {
15034
+ e.U_.forEach(((t, n) => {
15043
15035
  __PRIVATE_sendWatchRequest(e, t);
15044
15036
  }));
15045
15037
  }
@@ -15066,7 +15058,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15066
15058
  const n = t.cause;
15067
15059
  for (const r of t.targetIds)
15068
15060
  // A watched target might have been removed already.
15069
- e.K_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.K_.delete(r), e.H_.removeTarget(r));
15061
+ e.U_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.U_.delete(r), e.H_.removeTarget(r));
15070
15062
  }
15071
15063
  /**
15072
15064
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -15096,21 +15088,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15096
15088
  // persistent view of these when applying the completed RemoteEvent.
15097
15089
  return n.targetChanges.forEach(((n, r) => {
15098
15090
  if (n.resumeToken.approximateByteSize() > 0) {
15099
- const i = e.K_.get(r);
15091
+ const i = e.U_.get(r);
15100
15092
  // A watched target might have been removed already.
15101
- i && e.K_.set(r, i.withResumeToken(n.resumeToken, t));
15093
+ i && e.U_.set(r, i.withResumeToken(n.resumeToken, t));
15102
15094
  }
15103
15095
  })),
15104
15096
  // Re-establish listens for the targets that have been invalidated by
15105
15097
  // existence filter mismatches.
15106
15098
  n.targetMismatches.forEach(((t, n) => {
15107
- const r = e.K_.get(t);
15099
+ const r = e.U_.get(t);
15108
15100
  if (!r)
15109
15101
  // A watched target might have been removed already.
15110
15102
  return;
15111
15103
  // Clear the resume token for the target, since we're in a known mismatch
15112
15104
  // state.
15113
- e.K_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15105
+ e.U_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15114
15106
  // Cause a hard reset by unwatching and rewatching immediately, but
15115
15107
  // deliberately don't send a resume token so that we get a full update.
15116
15108
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15161,11 +15153,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15161
15153
 
15162
15154
  async function __PRIVATE_fillWritePipeline(e) {
15163
15155
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15164
- let r = t.U_.length > 0 ? t.U_[t.U_.length - 1].batchId : U;
15156
+ let r = t.K_.length > 0 ? t.K_[t.K_.length - 1].batchId : K;
15165
15157
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15166
15158
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15167
15159
  if (null === e) {
15168
- 0 === t.U_.length && n.P_();
15160
+ 0 === t.K_.length && n.P_();
15169
15161
  break;
15170
15162
  }
15171
15163
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15179,20 +15171,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15179
15171
  * Returns true if we can add to the write pipeline (i.e. the network is
15180
15172
  * enabled and the write pipeline is not full).
15181
15173
  */ function __PRIVATE_canAddToWritePipeline(e) {
15182
- return __PRIVATE_canUseNetwork(e) && e.U_.length < 10;
15174
+ return __PRIVATE_canUseNetwork(e) && e.K_.length < 10;
15183
15175
  }
15184
15176
 
15185
15177
  /**
15186
15178
  * Queues additional writes to be sent to the write stream, sending them
15187
15179
  * immediately if the write stream is established.
15188
15180
  */ function __PRIVATE_addToWritePipeline(e, t) {
15189
- e.U_.push(t);
15181
+ e.K_.push(t);
15190
15182
  const n = __PRIVATE_ensureWriteStream(e);
15191
15183
  n.c_() && n.S_ && n.b_(t.mutations);
15192
15184
  }
15193
15185
 
15194
15186
  function __PRIVATE_shouldStartWriteStream(e) {
15195
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.U_.length > 0;
15187
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.K_.length > 0;
15196
15188
  }
15197
15189
 
15198
15190
  function __PRIVATE_startWriteStream(e) {
@@ -15206,11 +15198,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15206
15198
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15207
15199
  const t = __PRIVATE_ensureWriteStream(e);
15208
15200
  // Send the write pipeline now that the stream is established.
15209
- for (const n of e.U_) t.b_(n.mutations);
15201
+ for (const n of e.K_) t.b_(n.mutations);
15210
15202
  }
15211
15203
 
15212
15204
  async function __PRIVATE_onMutationResult(e, t, n) {
15213
- const r = e.U_.shift(), i = MutationBatchResult.from(r, t, n);
15205
+ const r = e.K_.shift(), i = MutationBatchResult.from(r, t, n);
15214
15206
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15215
15207
  // It's possible that with the completion of this mutation another
15216
15208
  // slot has freed up.
@@ -15230,7 +15222,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15230
15222
  }(t.code)) {
15231
15223
  // This was a permanent error, the request itself was the problem
15232
15224
  // so it's not going to succeed if we resend it.
15233
- const n = e.U_.shift();
15225
+ const n = e.K_.shift();
15234
15226
  // In this case it's also unlikely that the server itself is melting
15235
15227
  // down -- this was just a bad request so inhibit backoff on the next
15236
15228
  // restart.
@@ -15329,8 +15321,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15329
15321
  }), e.G_.push((async t => {
15330
15322
  t ? (e.Y_.h_(),
15331
15323
  // This will start the write stream if necessary.
15332
- await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.U_.length > 0 && (__PRIVATE_logDebug(Jt, `Stopping write stream with ${e.U_.length} pending writes`),
15333
- e.U_ = []));
15324
+ await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.K_.length > 0 && (__PRIVATE_logDebug(Jt, `Stopping write stream with ${e.K_.length} pending writes`),
15325
+ e.K_ = []));
15334
15326
  }))), e.Y_;
15335
15327
  }
15336
15328
 
@@ -16344,11 +16336,11 @@ const Xt = "SyncEngine";
16344
16336
  * Keeps track of the information about an active limbo resolution for each
16345
16337
  * active target ID that was started for the purpose of limbo resolution.
16346
16338
  */
16347
- this.Ua = new Map, this.Ka = new __PRIVATE_ReferenceSet,
16339
+ this.Ka = new Map, this.Ua = new __PRIVATE_ReferenceSet,
16348
16340
  /** Stores user completion handlers, indexed by User and BatchId. */
16349
16341
  this.Wa = {},
16350
16342
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
16351
- this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Kn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16343
+ this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Un(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16352
16344
  // The primary state is set to `true` or `false` immediately after Firestore
16353
16345
  // startup. In the interim, a client should only be considered primary if
16354
16346
  // `isPrimary` is true.
@@ -16528,7 +16520,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16528
16520
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16529
16521
  // Update `receivedDocument` as appropriate for any limbo targets.
16530
16522
  t.targetChanges.forEach(((e, t) => {
16531
- const r = n.Ua.get(t);
16523
+ const r = n.Ka.get(t);
16532
16524
  r && (
16533
16525
  // Since this is a limbo resolution lookup, it's for a single document
16534
16526
  // and it could be added, modified, or removed, but not a combination.
@@ -16582,7 +16574,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16582
16574
  const r = __PRIVATE_debugCast(e);
16583
16575
  // PORTING NOTE: Multi-tab only.
16584
16576
  r.sharedClientState.updateQueryState(t, "rejected", n);
16585
- const i = r.Ua.get(t), s = i && i.key;
16577
+ const i = r.Ka.get(t), s = i && i.key;
16586
16578
  if (s) {
16587
16579
  // TODO(klimt): We really only should do the following on permission
16588
16580
  // denied errors, but we don't have the cause code here.
@@ -16604,7 +16596,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16604
16596
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16605
16597
  // this query when the RemoteStore restarts the Watch stream, which should
16606
16598
  // re-trigger the target failure.
16607
- r.$a = r.$a.remove(s), r.Ua.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16599
+ r.$a = r.$a.remove(s), r.Ka.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16608
16600
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16609
16601
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16610
16602
  }
@@ -16663,7 +16655,7 @@ async function __PRIVATE_syncEngineRejectFailedWrite(e, t, n) {
16663
16655
  const t = __PRIVATE_debugCast(e);
16664
16656
  return t.persistence.runTransaction("Get highest unacknowledged batch id", "readonly", (e => t.mutationQueue.getHighestUnacknowledgedBatchId(e)));
16665
16657
  }(n.localStore);
16666
- if (e === U)
16658
+ if (e === K)
16667
16659
  // Trigger the callback right away if there is no pending writes at the moment.
16668
16660
  return void t.resolve();
16669
16661
  const r = n.Ga.get(e) || [];
@@ -16698,8 +16690,8 @@ function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16698
16690
  e.sharedClientState.removeLocalQueryTarget(t);
16699
16691
  for (const r of e.qa.get(t)) e.ka.delete(r), n && e.La.Ja(r, n);
16700
16692
  if (e.qa.delete(t), e.isPrimaryClient) {
16701
- e.Ka.br(t).forEach((t => {
16702
- e.Ka.containsKey(t) ||
16693
+ e.Ua.br(t).forEach((t => {
16694
+ e.Ua.containsKey(t) ||
16703
16695
  // We removed the last reference for this key
16704
16696
  __PRIVATE_removeLimboTarget(e, t);
16705
16697
  }));
@@ -16712,14 +16704,14 @@ function __PRIVATE_removeLimboTarget(e, t) {
16712
16704
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16713
16705
  const n = e.$a.get(t);
16714
16706
  null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.$a = e.$a.remove(t),
16715
- e.Ua.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16707
+ e.Ka.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16716
16708
  }
16717
16709
 
16718
16710
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
16719
- for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ka.addReference(r.key, t),
16711
+ for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ua.addReference(r.key, t),
16720
16712
  __PRIVATE_trackLimboChange(e, r); else if (r instanceof __PRIVATE_RemovedLimboDocument) {
16721
- __PRIVATE_logDebug(Xt, "Document no longer in limbo: " + r.key), e.Ka.removeReference(r.key, t);
16722
- e.Ka.containsKey(r.key) ||
16713
+ __PRIVATE_logDebug(Xt, "Document no longer in limbo: " + r.key), e.Ua.removeReference(r.key, t);
16714
+ e.Ua.containsKey(r.key) ||
16723
16715
  // We removed the last reference for this key
16724
16716
  __PRIVATE_removeLimboTarget(e, r.key);
16725
16717
  } else fail();
@@ -16743,7 +16735,7 @@ function __PRIVATE_trackLimboChange(e, t) {
16743
16735
  const t = e.Qa.values().next().value;
16744
16736
  e.Qa.delete(t);
16745
16737
  const n = new DocumentKey(ResourcePath.fromString(t)), r = e.za.next();
16746
- e.Ua.set(r, new LimboResolution(n)), e.$a = e.$a.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.ae));
16738
+ e.Ka.set(r, new LimboResolution(n)), e.$a = e.$a.insert(n, r), __PRIVATE_remoteStoreListen(e.remoteStore, new TargetData(__PRIVATE_queryToTarget(__PRIVATE_newQueryForPath(n.path)), r, "TargetPurposeLimboResolution" /* TargetPurpose.LimboResolution */ , __PRIVATE_ListenSequence.ae));
16747
16739
  }
16748
16740
  }
16749
16741
 
@@ -16811,7 +16803,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16811
16803
  }
16812
16804
 
16813
16805
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16814
- const n = __PRIVATE_debugCast(e), r = n.Ua.get(t);
16806
+ const n = __PRIVATE_debugCast(e), r = n.Ka.get(t);
16815
16807
  if (r && r.Ba) return __PRIVATE_documentKeySet().add(r.key);
16816
16808
  {
16817
16809
  let e = __PRIVATE_documentKeySet();
@@ -16903,9 +16895,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16903
16895
  // PORTING NOTE: Multi-Tab only.
16904
16896
  function __PRIVATE_resetLimboDocuments(e) {
16905
16897
  const t = __PRIVATE_debugCast(e);
16906
- t.Ua.forEach(((e, n) => {
16898
+ t.Ka.forEach(((e, n) => {
16907
16899
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16908
- })), t.Ka.Dr(), t.Ua = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16900
+ })), t.Ua.Dr(), t.Ka = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16909
16901
  }
16910
16902
  /**
16911
16903
  * Reconcile the query views of the provided query targets with the state from
@@ -19764,7 +19756,7 @@ function __PRIVATE_isWrite(e) {
19764
19756
  });
19765
19757
  return r.$u(e), r;
19766
19758
  }
19767
- Uu(e) {
19759
+ Ku(e) {
19768
19760
  var t;
19769
19761
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.ku({
19770
19762
  path: n,
@@ -19772,7 +19764,7 @@ function __PRIVATE_isWrite(e) {
19772
19764
  });
19773
19765
  return r.Bu(), r;
19774
19766
  }
19775
- Ku(e) {
19767
+ Uu(e) {
19776
19768
  // TODO(b/34871131): We don't support array paths right now; so make path
19777
19769
  // undefined.
19778
19770
  return this.ku({
@@ -19933,7 +19925,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19933
19925
  // For Compat types, we have to "extract" the underlying types before
19934
19926
  // performing validation.
19935
19927
  r = E(r);
19936
- const a = i.Uu(_);
19928
+ const a = i.Ku(_);
19937
19929
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19938
19930
  // Add it to the field mask, but don't add anything to updateData.
19939
19931
  s.push(_); else {
@@ -19959,7 +19951,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19959
19951
  // For Compat types, we have to "extract" the underlying types before
19960
19952
  // performing validation.
19961
19953
  n = E(n);
19962
- const r = o.Uu(t);
19954
+ const r = o.Ku(t);
19963
19955
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19964
19956
  // Add it to the field mask, but don't add anything to updateData.
19965
19957
  u.push(t); else {
@@ -20037,7 +20029,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
20037
20029
  const n = [];
20038
20030
  let r = 0;
20039
20031
  for (const i of e) {
20040
- let e = __PRIVATE_parseData(i, t.Ku(r));
20032
+ let e = __PRIVATE_parseData(i, t.Uu(r));
20041
20033
  null == e && (
20042
20034
  // Just include nulls in the array for fields being replaced with a
20043
20035
  // sentinel.