@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.cjs.js CHANGED
@@ -9,7 +9,7 @@ var util = require('@firebase/util');
9
9
  var bloomBlob = require('@firebase/webchannel-wrapper/bloom-blob');
10
10
  var webchannelBlob = require('@firebase/webchannel-wrapper/webchannel-blob');
11
11
 
12
- const S = "@firebase/firestore", b = "4.7.7";
12
+ const S = "@firebase/firestore", b = "4.7.8";
13
13
 
14
14
  /**
15
15
  * @license
@@ -71,7 +71,7 @@ User.MOCK_USER = new User("mock-user");
71
71
  * See the License for the specific language governing permissions and
72
72
  * limitations under the License.
73
73
  */
74
- let D = "11.3.0";
74
+ let D = "11.3.1";
75
75
 
76
76
  /**
77
77
  * @license
@@ -688,31 +688,6 @@ function __PRIVATE_randomBytes(e) {
688
688
  return n;
689
689
  }
690
690
 
691
- /**
692
- * @license
693
- * Copyright 2023 Google LLC
694
- *
695
- * Licensed under the Apache License, Version 2.0 (the "License");
696
- * you may not use this file except in compliance with the License.
697
- * You may obtain a copy of the License at
698
- *
699
- * http://www.apache.org/licenses/LICENSE-2.0
700
- *
701
- * Unless required by applicable law or agreed to in writing, software
702
- * distributed under the License is distributed on an "AS IS" BASIS,
703
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
704
- * See the License for the specific language governing permissions and
705
- * limitations under the License.
706
- */
707
- /**
708
- * An instance of the Platform's 'TextEncoder' implementation.
709
- */ function __PRIVATE_newTextEncoder() {
710
- return new TextEncoder;
711
- }
712
-
713
- /**
714
- * An instance of the Platform's 'TextDecoder' implementation.
715
- */
716
691
  /**
717
692
  * @license
718
693
  * Copyright 2017 Google LLC
@@ -734,8 +709,7 @@ function __PRIVATE_randomBytes(e) {
734
709
  *
735
710
  * @internal
736
711
  * Exported internally for testing purposes.
737
- */
738
- class __PRIVATE_AutoId {
712
+ */ class __PRIVATE_AutoId {
739
713
  static newId() {
740
714
  // Alphanumeric characters
741
715
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", t = 62 * Math.floor(256 / 62);
@@ -756,16 +730,6 @@ function __PRIVATE_primitiveComparator(e, t) {
756
730
  return e < t ? -1 : e > t ? 1 : 0;
757
731
  }
758
732
 
759
- /** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(e, t) {
760
- // Convert the string to UTF-8 encoded bytes
761
- const n = __PRIVATE_newTextEncoder().encode(e), r = __PRIVATE_newTextEncoder().encode(t);
762
- for (let e = 0; e < Math.min(n.length, r.length); e++) {
763
- const t = __PRIVATE_primitiveComparator(n[e], r[e]);
764
- if (0 !== t) return t;
765
- }
766
- return __PRIVATE_primitiveComparator(n.length, r.length);
767
- }
768
-
769
733
  /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(e, t, n) {
770
734
  return e.length === t.length && e.every(((e, r) => n(e, t[r])));
771
735
  }
@@ -1056,11 +1020,13 @@ class Timestamp {
1056
1020
  const n = BasePath.compareSegments(e.get(r), t.get(r));
1057
1021
  if (0 !== n) return n;
1058
1022
  }
1059
- return __PRIVATE_primitiveComparator(e.length, t.length);
1023
+ return Math.sign(e.length - t.length);
1060
1024
  }
1061
1025
  static compareSegments(e, t) {
1062
1026
  const n = BasePath.isNumericId(e), r = BasePath.isNumericId(t);
1063
- return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) : __PRIVATE_compareUtf8Strings(e, t);
1027
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) :
1028
+ // both non-numeric
1029
+ e < t ? -1 : e > t ? 1 : 0;
1064
1030
  }
1065
1031
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1066
1032
  static isNumericId(e) {
@@ -1848,13 +1814,13 @@ class __PRIVATE_SimpleDbTransaction {
1848
1814
  * within the key range or index.
1849
1815
  */ class __PRIVATE_IterationController {
1850
1816
  constructor(e) {
1851
- this.q = e, this.$ = !1, this.U = null;
1817
+ this.q = e, this.$ = !1, this.K = null;
1852
1818
  }
1853
1819
  get isDone() {
1854
1820
  return this.$;
1855
1821
  }
1856
- get K() {
1857
- return this.U;
1822
+ get U() {
1823
+ return this.K;
1858
1824
  }
1859
1825
  set cursor(e) {
1860
1826
  this.q = e;
@@ -1868,7 +1834,7 @@ class __PRIVATE_SimpleDbTransaction {
1868
1834
  * This function can be called to skip to that next key, which could be
1869
1835
  * an index or a primary key.
1870
1836
  */ W(e) {
1871
- this.U = e;
1837
+ this.K = e;
1872
1838
  }
1873
1839
  /**
1874
1840
  * Delete the current cursor value from the object store.
@@ -2027,7 +1993,7 @@ class __PRIVATE_SimpleDbTransaction {
2027
1993
  const e = o.catch((e => (s.done(), PersistencePromise.reject(e))));
2028
1994
  n.push(e);
2029
1995
  }
2030
- s.isDone ? r() : null === s.K ? i.continue() : i.continue(s.K);
1996
+ s.isDone ? r() : null === s.U ? i.continue() : i.continue(s.U);
2031
1997
  };
2032
1998
  })).next((() => PersistencePromise.waitFor(n)));
2033
1999
  }
@@ -2348,7 +2314,7 @@ function __PRIVATE_encodeResourcePath(e) {
2348
2314
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2349
2315
  * See the License for the specific language governing permissions and
2350
2316
  * limitations under the License.
2351
- */ const U = "remoteDocuments", K = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2317
+ */ const K = "remoteDocuments", U = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2352
2318
 
2353
2319
  /**
2354
2320
  * @license
@@ -2393,7 +2359,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2393
2359
  * there is no useful information to store as the value. The raw (unencoded)
2394
2360
  * path cannot be stored because IndexedDb doesn't store prototype
2395
2361
  * information.
2396
- */ const Z = {}, X = "documentMutations", ee = "remoteDocumentsV14", te = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], ne = "documentKeyIndex", re = [ "prefixPath", "collectionGroup", "documentId" ], ie = "collectionGroupIndex", se = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], oe = "remoteDocumentGlobal", _e = "remoteDocumentGlobalKey", ae = "targets", ue = "queryTargetsIndex", ce = [ "canonicalId", "targetId" ], le = "targetDocuments", he = [ "targetId", "path" ], Pe = "documentTargetsIndex", Te = [ "path", "targetId" ], Ie = "targetGlobalKey", Ee = "targetGlobal", de = "collectionParents", Ae = [ "collectionId", "parent" ], Re = "clientMetadata", Ve = "clientId", me = "bundles", fe = "bundleId", ge = "namedQueries", pe = "name", ye = "indexConfiguration", we = "indexId", Se = "collectionGroupIndex", be = "collectionGroup", De = "indexState", ve = [ "indexId", "uid" ], Ce = "sequenceNumberIndex", Fe = [ "uid", "sequenceNumber" ], Me = "indexEntries", xe = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Oe = "documentKeyIndex", Ne = [ "indexId", "uid", "orderedDocumentKey" ], Be = "documentOverlays", Le = [ "userId", "collectionPath", "documentId" ], ke = "collectionPathOverlayIndex", qe = [ "userId", "collectionPath", "largestBatchId" ], Qe = "collectionGroupOverlayIndex", $e = [ "userId", "collectionGroup", "largestBatchId" ], Ue = "globals", Ke = "name", We = [ ...[ ...[ ...[ ...[ G, j, X, U, ae, K, Ee, le ], Re ], oe ], de ], me, ge ], Ge = [ ...We, Be ], ze = [ G, j, X, ee, ae, K, Ee, le, Re, oe, de, me, ge, Be ], je = ze, He = [ ...je, ye, De, Me ], Je = He, Ye = [ ...He, Ue ];
2362
+ */ const Z = {}, X = "documentMutations", ee = "remoteDocumentsV14", te = [ "prefixPath", "collectionGroup", "readTime", "documentId" ], ne = "documentKeyIndex", re = [ "prefixPath", "collectionGroup", "documentId" ], ie = "collectionGroupIndex", se = [ "collectionGroup", "readTime", "prefixPath", "documentId" ], oe = "remoteDocumentGlobal", _e = "remoteDocumentGlobalKey", ae = "targets", ue = "queryTargetsIndex", ce = [ "canonicalId", "targetId" ], le = "targetDocuments", he = [ "targetId", "path" ], Pe = "documentTargetsIndex", Te = [ "path", "targetId" ], Ie = "targetGlobalKey", Ee = "targetGlobal", de = "collectionParents", Ae = [ "collectionId", "parent" ], Re = "clientMetadata", Ve = "clientId", me = "bundles", fe = "bundleId", ge = "namedQueries", pe = "name", ye = "indexConfiguration", we = "indexId", Se = "collectionGroupIndex", be = "collectionGroup", De = "indexState", ve = [ "indexId", "uid" ], Ce = "sequenceNumberIndex", Fe = [ "uid", "sequenceNumber" ], Me = "indexEntries", xe = [ "indexId", "uid", "arrayValue", "directionalValue", "orderedDocumentKey", "documentKey" ], Oe = "documentKeyIndex", Ne = [ "indexId", "uid", "orderedDocumentKey" ], Be = "documentOverlays", Le = [ "userId", "collectionPath", "documentId" ], ke = "collectionPathOverlayIndex", qe = [ "userId", "collectionPath", "largestBatchId" ], Qe = "collectionGroupOverlayIndex", $e = [ "userId", "collectionGroup", "largestBatchId" ], Ke = "globals", Ue = "name", We = [ ...[ ...[ ...[ ...[ G, j, X, K, ae, U, Ee, le ], Re ], oe ], de ], me, ge ], Ge = [ ...We, Be ], ze = [ G, j, X, ee, ae, U, Ee, le, Re, oe, de, me, ge, Be ], je = ze, He = [ ...je, ye, De, Me ], Je = He, Ye = [ ...He, Ke ];
2397
2363
 
2398
2364
  /**
2399
2365
  * @license
@@ -3455,7 +3421,7 @@ function __PRIVATE_valueCompare(e, t) {
3455
3421
  return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e), __PRIVATE_getLocalWriteTime(t));
3456
3422
 
3457
3423
  case 5 /* TypeOrder.StringValue */ :
3458
- return __PRIVATE_compareUtf8Strings(e.stringValue, t.stringValue);
3424
+ return __PRIVATE_primitiveComparator(e.stringValue, t.stringValue);
3459
3425
 
3460
3426
  case 6 /* TypeOrder.BlobValue */ :
3461
3427
  return function __PRIVATE_compareBlobs(e, t) {
@@ -3503,7 +3469,7 @@ function __PRIVATE_valueCompare(e, t) {
3503
3469
  // canonical IDs are independent of insertion order.
3504
3470
  r.sort(), s.sort();
3505
3471
  for (let e = 0; e < r.length && e < s.length; ++e) {
3506
- const t = __PRIVATE_compareUtf8Strings(r[e], s[e]);
3472
+ const t = __PRIVATE_primitiveComparator(r[e], s[e]);
3507
3473
  if (0 !== t) return t;
3508
3474
  const o = __PRIVATE_valueCompare(n[r[e]], i[s[e]]);
3509
3475
  if (0 !== o) return o;
@@ -5915,6 +5881,32 @@ let At = null;
5915
5881
  * Sets the value of the `testingHooksSpi` object.
5916
5882
  * @param instance the instance to set.
5917
5883
  */
5884
+ /**
5885
+ * @license
5886
+ * Copyright 2023 Google LLC
5887
+ *
5888
+ * Licensed under the Apache License, Version 2.0 (the "License");
5889
+ * you may not use this file except in compliance with the License.
5890
+ * You may obtain a copy of the License at
5891
+ *
5892
+ * http://www.apache.org/licenses/LICENSE-2.0
5893
+ *
5894
+ * Unless required by applicable law or agreed to in writing, software
5895
+ * distributed under the License is distributed on an "AS IS" BASIS,
5896
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5897
+ * See the License for the specific language governing permissions and
5898
+ * limitations under the License.
5899
+ */
5900
+ /**
5901
+ * An instance of the Platform's 'TextEncoder' implementation.
5902
+ */
5903
+ function __PRIVATE_newTextEncoder() {
5904
+ return new TextEncoder;
5905
+ }
5906
+
5907
+ /**
5908
+ * An instance of the Platform's 'TextDecoder' implementation.
5909
+ */
5918
5910
  /**
5919
5911
  * @license
5920
5912
  * Copyright 2022 Google LLC
@@ -6287,13 +6279,13 @@ class __PRIVATE_WatchChangeAggregator {
6287
6279
  /** Keeps track of the documents to update since the last raised snapshot. */
6288
6280
  this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6289
6281
  /** A mapping of document keys to their set of target IDs. */
6290
- this.Ue = __PRIVATE_documentTargetMap(),
6282
+ this.Ke = __PRIVATE_documentTargetMap(),
6291
6283
  /**
6292
6284
  * A map of targets with existence filter mismatches. These targets are
6293
6285
  * known to be inconsistent and their listens needs to be re-established by
6294
6286
  * RemoteStore.
6295
6287
  */
6296
- this.Ke = new SortedMap(__PRIVATE_primitiveComparator);
6288
+ this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6297
6289
  }
6298
6290
  /**
6299
6291
  * Processes and adds the DocumentWatchChange to the current set of changes.
@@ -6382,7 +6374,7 @@ class __PRIVATE_WatchChangeAggregator {
6382
6374
  // trigger re-run of the query.
6383
6375
  this.Ye(t);
6384
6376
  const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6385
- this.Ke = this.Ke.insert(t, e);
6377
+ this.Ue = this.Ue.insert(t, e);
6386
6378
  }
6387
6379
  null == At || At.rt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6388
6380
  var s, o, _, a, u, c;
@@ -6494,7 +6486,7 @@ class __PRIVATE_WatchChangeAggregator {
6494
6486
 
6495
6487
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6496
6488
  // client.
6497
- this.Ue.forEach(((e, t) => {
6489
+ this.Ke.forEach(((e, t) => {
6498
6490
  let r = !0;
6499
6491
  t.forEachWhile((e => {
6500
6492
  const t = this.Xe(e);
@@ -6502,9 +6494,9 @@ class __PRIVATE_WatchChangeAggregator {
6502
6494
  !1);
6503
6495
  })), r && (n = n.add(e));
6504
6496
  })), this.Qe.forEach(((t, n) => n.setReadTime(e)));
6505
- const r = new RemoteEvent(e, t, this.Ke, this.Qe, n);
6497
+ const r = new RemoteEvent(e, t, this.Ue, this.Qe, n);
6506
6498
  return this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6507
- this.Ue = __PRIVATE_documentTargetMap(), this.Ke = new SortedMap(__PRIVATE_primitiveComparator),
6499
+ this.Ke = __PRIVATE_documentTargetMap(), this.Ue = new SortedMap(__PRIVATE_primitiveComparator),
6508
6500
  r;
6509
6501
  }
6510
6502
  /**
@@ -6516,7 +6508,7 @@ class __PRIVATE_WatchChangeAggregator {
6516
6508
  if (!this.Je(e)) return;
6517
6509
  const n = this.ut(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6518
6510
  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)),
6519
- this.Ue = this.Ue.insert(t.key, this.ct(t.key).add(e));
6511
+ this.Ke = this.Ke.insert(t.key, this.ct(t.key).add(e));
6520
6512
  }
6521
6513
  /**
6522
6514
  * Removes the provided document from the target mapping. If the
@@ -6532,7 +6524,7 @@ class __PRIVATE_WatchChangeAggregator {
6532
6524
  this.ut(e, t) ? r.xe(t, 1 /* ChangeType.Removed */) :
6533
6525
  // The document may have entered and left the target before we raised a
6534
6526
  // snapshot, so we can just ignore the change.
6535
- 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)),
6527
+ 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)),
6536
6528
  n && (this.Qe = this.Qe.insert(t, n));
6537
6529
  }
6538
6530
  removeTarget(e) {
@@ -6557,8 +6549,8 @@ class __PRIVATE_WatchChangeAggregator {
6557
6549
  return t || (t = new __PRIVATE_TargetState, this.qe.set(e, t)), t;
6558
6550
  }
6559
6551
  ct(e) {
6560
- let t = this.Ue.get(e);
6561
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6552
+ let t = this.Ke.get(e);
6553
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ke = this.Ke.insert(e, t)),
6562
6554
  t;
6563
6555
  }
6564
6556
  _t(e) {
@@ -7741,7 +7733,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7741
7733
  * limitations under the License.
7742
7734
  */ class __PRIVATE_IndexedDbGlobalsCache {
7743
7735
  dt(e) {
7744
- return __PRIVATE_getStore(e, Ue);
7736
+ return __PRIVATE_getStore(e, Ke);
7745
7737
  }
7746
7738
  getSessionToken(e) {
7747
7739
  return this.dt(e).get("sessionToken").next((e => {
@@ -7953,10 +7945,10 @@ function __PRIVATE_unsignedNumLength(e) {
7953
7945
  }
7954
7946
  this.qt();
7955
7947
  }
7956
- Ut(e) {
7948
+ Kt(e) {
7957
7949
  // Values are encoded with a single byte length prefix, followed by the
7958
7950
  // actual value in big-endian format with leading 0 bytes dropped.
7959
- const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7951
+ const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7960
7952
  this.Wt(1 + n), this.buffer[this.position++] = 255 & n;
7961
7953
  // Write the length
7962
7954
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = 255 & t[e];
@@ -7964,7 +7956,7 @@ function __PRIVATE_unsignedNumLength(e) {
7964
7956
  Gt(e) {
7965
7957
  // Values are encoded with a single byte length prefix, followed by the
7966
7958
  // inverted value in big-endian format with leading 0 bytes dropped.
7967
- const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7959
+ const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7968
7960
  this.Wt(1 + n), this.buffer[this.position++] = ~(255 & n);
7969
7961
  // Write the length
7970
7962
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = ~(255 & t[e]);
@@ -7999,7 +7991,7 @@ function __PRIVATE_unsignedNumLength(e) {
7999
7991
  * -0.0 < 0.0
8000
7992
  * all non-NaN < NaN
8001
7993
  * NaN = NaN
8002
- */ Kt(e) {
7994
+ */ Ut(e) {
8003
7995
  const t =
8004
7996
  /** Converts a JavaScript number to a byte array (using big endian encoding). */
8005
7997
  function __PRIVATE_doubleToLongBits(e) {
@@ -8058,7 +8050,7 @@ class __PRIVATE_AscendingIndexByteEncoder {
8058
8050
  this.Zt.Qt(e);
8059
8051
  }
8060
8052
  gt(e) {
8061
- this.Zt.Ut(e);
8053
+ this.Zt.Kt(e);
8062
8054
  }
8063
8055
  Vt() {
8064
8056
  this.Zt.zt();
@@ -9567,14 +9559,14 @@ class __PRIVATE_TargetIdGenerator {
9567
9559
  next() {
9568
9560
  return this.$n += 2, this.$n;
9569
9561
  }
9570
- static Un() {
9562
+ static Kn() {
9571
9563
  // The target cache generator must return '2' in its first call to `next()`
9572
9564
  // as there is no differentiation in the protocol layer between an unset
9573
9565
  // number and the number '0'. If we were to sent a target with target ID
9574
9566
  // '0', the backend would consider it unset and replace it with its own ID.
9575
9567
  return new __PRIVATE_TargetIdGenerator(0);
9576
9568
  }
9577
- static Kn() {
9569
+ static Un() {
9578
9570
  // Sync engine assigns target IDs for limbo document detection.
9579
9571
  return new __PRIVATE_TargetIdGenerator(-1);
9580
9572
  }
@@ -11342,7 +11334,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11342
11334
  * A ordered bidirectional mapping between documents and the remote target
11343
11335
  * IDs.
11344
11336
  */
11345
- this.Ur = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Kr = __PRIVATE_TargetIdGenerator.Un();
11337
+ this.Kr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Ur = __PRIVATE_TargetIdGenerator.Kn();
11346
11338
  }
11347
11339
  forEachTarget(e, t) {
11348
11340
  return this.Qr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
@@ -11354,7 +11346,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11354
11346
  return PersistencePromise.resolve(this.$r);
11355
11347
  }
11356
11348
  allocateTargetId(e) {
11357
- return this.highestTargetId = this.Kr.next(), PersistencePromise.resolve(this.highestTargetId);
11349
+ return this.highestTargetId = this.Ur.next(), PersistencePromise.resolve(this.highestTargetId);
11358
11350
  }
11359
11351
  setTargetsMetadata(e, t, n) {
11360
11352
  return n && (this.lastRemoteSnapshotVersion = n), t > this.$r && (this.$r = t),
@@ -11363,7 +11355,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11363
11355
  zn(e) {
11364
11356
  this.Qr.set(e.target, e);
11365
11357
  const t = e.targetId;
11366
- t > this.highestTargetId && (this.Kr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11358
+ t > this.highestTargetId && (this.Ur = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11367
11359
  e.sequenceNumber > this.$r && (this.$r = e.sequenceNumber);
11368
11360
  }
11369
11361
  addTargetData(e, t) {
@@ -11373,7 +11365,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11373
11365
  return this.zn(t), PersistencePromise.resolve();
11374
11366
  }
11375
11367
  removeTargetData(e, t) {
11376
- return this.Qr.delete(t.target), this.Ur.br(t.targetId), this.targetCount -= 1,
11368
+ return this.Qr.delete(t.target), this.Kr.br(t.targetId), this.targetCount -= 1,
11377
11369
  PersistencePromise.resolve();
11378
11370
  }
11379
11371
  removeTargets(e, t, n) {
@@ -11392,24 +11384,24 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11392
11384
  return PersistencePromise.resolve(n);
11393
11385
  }
11394
11386
  addMatchingKeys(e, t, n) {
11395
- return this.Ur.yr(t, n), PersistencePromise.resolve();
11387
+ return this.Kr.yr(t, n), PersistencePromise.resolve();
11396
11388
  }
11397
11389
  removeMatchingKeys(e, t, n) {
11398
- this.Ur.Sr(t, n);
11390
+ this.Kr.Sr(t, n);
11399
11391
  const r = this.persistence.referenceDelegate, i = [];
11400
11392
  return r && t.forEach((t => {
11401
11393
  i.push(r.markPotentiallyOrphaned(e, t));
11402
11394
  })), PersistencePromise.waitFor(i);
11403
11395
  }
11404
11396
  removeMatchingKeysForTargetId(e, t) {
11405
- return this.Ur.br(t), PersistencePromise.resolve();
11397
+ return this.Kr.br(t), PersistencePromise.resolve();
11406
11398
  }
11407
11399
  getMatchingKeysForTargetId(e, t) {
11408
- const n = this.Ur.vr(t);
11400
+ const n = this.Kr.vr(t);
11409
11401
  return PersistencePromise.resolve(n);
11410
11402
  }
11411
11403
  containsKey(e, t) {
11412
- return PersistencePromise.resolve(this.Ur.containsKey(t));
11404
+ return PersistencePromise.resolve(this.Kr.containsKey(t));
11413
11405
  }
11414
11406
  }
11415
11407
 
@@ -11670,7 +11662,7 @@ class __PRIVATE_MemoryLruDelegate {
11670
11662
  */ B(e, t, n, r) {
11671
11663
  const i = new __PRIVATE_SimpleDbTransaction("createOrUpgrade", t);
11672
11664
  n < 1 && r >= 1 && (!function __PRIVATE_createPrimaryClientStore(e) {
11673
- e.createObjectStore(K);
11665
+ e.createObjectStore(U);
11674
11666
  }(e), function __PRIVATE_createMutationQueue(e) {
11675
11667
  e.createObjectStore(G, {
11676
11668
  keyPath: z
@@ -11687,7 +11679,7 @@ class __PRIVATE_MemoryLruDelegate {
11687
11679
  * Upgrade function to migrate the 'mutations' store from V1 to V3. Loads
11688
11680
  * and rewrites all data.
11689
11681
  */ (e), __PRIVATE_createQueryCache(e), function __PRIVATE_createLegacyRemoteDocumentCache(e) {
11690
- e.createObjectStore(U);
11682
+ e.createObjectStore(K);
11691
11683
  }(e));
11692
11684
  // Migration 2 to populate the targetGlobal object no longer needed since
11693
11685
  // migration 3 unconditionally clears it.
@@ -11775,7 +11767,7 @@ class __PRIVATE_MemoryLruDelegate {
11775
11767
  keyPath: te
11776
11768
  });
11777
11769
  t.createIndex(ne, re), t.createIndex(ie, se);
11778
- }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(U)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11770
+ }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(K)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11779
11771
  n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
11780
11772
  const t = e.createObjectStore(ye, {
11781
11773
  keyPath: we,
@@ -11804,15 +11796,15 @@ class __PRIVATE_MemoryLruDelegate {
11804
11796
  t.objectStore(Me).clear();
11805
11797
  }))), n < 17 && r >= 17 && (s = s.next((() => {
11806
11798
  !function __PRIVATE_createGlobalsStore(e) {
11807
- e.createObjectStore(Ue, {
11808
- keyPath: Ke
11799
+ e.createObjectStore(Ke, {
11800
+ keyPath: Ue
11809
11801
  });
11810
11802
  }(e);
11811
11803
  }))), s;
11812
11804
  }
11813
11805
  ai(e) {
11814
11806
  let t = 0;
11815
- return e.store(U).Z(((e, n) => {
11807
+ return e.store(K).Z(((e, n) => {
11816
11808
  t += __PRIVATE_dbDocumentSize(n);
11817
11809
  })).next((() => {
11818
11810
  const n = {
@@ -11836,7 +11828,7 @@ class __PRIVATE_MemoryLruDelegate {
11836
11828
  * Ensures that every document in the remote document cache has a corresponding sentinel row
11837
11829
  * with a sequence number. Missing rows are given the most recently used sequence number.
11838
11830
  */ ui(e) {
11839
- const t = e.store(le), n = e.store(U);
11831
+ const t = e.store(le), n = e.store(K);
11840
11832
  return e.store(Ee).get(Ie).next((e => {
11841
11833
  const r = [];
11842
11834
  return n.Z(((n, i) => {
@@ -11867,7 +11859,7 @@ class __PRIVATE_MemoryLruDelegate {
11867
11859
  };
11868
11860
  // Helper to add an index entry iff we haven't already written it.
11869
11861
  // Index existing remote documents.
11870
- return t.store(U).Z({
11862
+ return t.store(K).Z({
11871
11863
  Y: !0
11872
11864
  }, ((e, t) => {
11873
11865
  const n = new ResourcePath(e);
@@ -11887,7 +11879,7 @@ class __PRIVATE_MemoryLruDelegate {
11887
11879
  }));
11888
11880
  }
11889
11881
  hi(e, t) {
11890
- const n = t.store(U), r = [];
11882
+ const n = t.store(K), r = [];
11891
11883
  return n.Z(((e, n) => {
11892
11884
  const i = t.store(ee), s = function __PRIVATE_extractKey(e) {
11893
11885
  return e.document ? new DocumentKey(ResourcePath.fromString(e.document.name).popFirst(5)) : e.noDocument ? DocumentKey.fromSegments(e.noDocument.path) : e.unknownDocument ? DocumentKey.fromSegments(e.unknownDocument.path) : fail();
@@ -12205,11 +12197,11 @@ class __PRIVATE_IndexedDbPersistence {
12205
12197
  async shutdown() {
12206
12198
  // The shutdown() operations are idempotent and can be called even when
12207
12199
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12208
- this.zr = !1, this.Ui(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ki(),
12200
+ this.zr = !1, this.Ki(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ui(),
12209
12201
  this.Wi(),
12210
12202
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12211
12203
  // has obtained the primary lease.
12212
- await this.pi.runTransaction("shutdown", "readwrite", [ K, Re ], (e => {
12204
+ await this.pi.runTransaction("shutdown", "readwrite", [ U, Re ], (e => {
12213
12205
  const t = new __PRIVATE_IndexedDbTransaction(e, __PRIVATE_ListenSequence.ae);
12214
12206
  return this.xi(t).next((() => this.Bi(t)));
12215
12207
  })), this.pi.close(),
@@ -12315,7 +12307,7 @@ class __PRIVATE_IndexedDbPersistence {
12315
12307
  this.wi())));
12316
12308
  }, this.document.addEventListener("visibilitychange", this.Ri), this.inForeground = "visible" === this.document.visibilityState);
12317
12309
  }
12318
- Ki() {
12310
+ Ui() {
12319
12311
  this.Ri && (this.document.removeEventListener("visibilitychange", this.Ri), this.Ri = null);
12320
12312
  }
12321
12313
  /**
@@ -12333,7 +12325,7 @@ class __PRIVATE_IndexedDbPersistence {
12333
12325
  // Note: In theory, this should be scheduled on the AsyncQueue since it
12334
12326
  // accesses internal state. We execute this code directly during shutdown
12335
12327
  // to make sure it gets a chance to run.
12336
- this.Ui();
12328
+ this.Ki();
12337
12329
  const e = /(?:Version|Mobile)\/1[456]/;
12338
12330
  util.isSafari() && (navigator.appVersion.match(e) || navigator.userAgent.match(e)) &&
12339
12331
  // On Safari 14, 15, and 16, we do not run any cleanup actions as it might
@@ -12364,7 +12356,7 @@ class __PRIVATE_IndexedDbPersistence {
12364
12356
  /**
12365
12357
  * Record client as zombied (a client that had its tab closed). Zombied
12366
12358
  * clients are ignored during primary tab selection.
12367
- */ Ui() {
12359
+ */ Ki() {
12368
12360
  if (this.yi) try {
12369
12361
  this.yi.setItem(this.Qi(this.clientId), String(Date.now()));
12370
12362
  } catch (e) {
@@ -12387,7 +12379,7 @@ class __PRIVATE_IndexedDbPersistence {
12387
12379
  /**
12388
12380
  * Helper to get a typed SimpleDbStore for the primary client object store.
12389
12381
  */ function __PRIVATE_primaryClientStore(e) {
12390
- return __PRIVATE_getStore(e, K);
12382
+ return __PRIVATE_getStore(e, U);
12391
12383
  }
12392
12384
 
12393
12385
  /**
@@ -13426,12 +13418,12 @@ class __PRIVATE_LocalClientState {
13426
13418
  n && (this.xs = this.xs.insert(n.clientId, n));
13427
13419
  }
13428
13420
  }
13429
- this.Us();
13421
+ this.Ks();
13430
13422
  // Check if there is an existing online state and call the callback handler
13431
13423
  // if applicable.
13432
13424
  const t = this.storage.getItem(this.Qs);
13433
13425
  if (t) {
13434
- const e = this.Ks(t);
13426
+ const e = this.Us(t);
13435
13427
  e && this.Ws(e);
13436
13428
  }
13437
13429
  for (const e of this.Os) this.Ms(e);
@@ -13475,10 +13467,10 @@ class __PRIVATE_LocalClientState {
13475
13467
  }
13476
13468
  // If the query is listening to cache only, the target ID should not be registered with the
13477
13469
  // local Firestore client as an active watch target.
13478
- return t && this.Hs.Ds(e), this.Us(), n;
13470
+ return t && this.Hs.Ds(e), this.Ks(), n;
13479
13471
  }
13480
13472
  removeLocalQueryTarget(e) {
13481
- this.Hs.vs(e), this.Us();
13473
+ this.Hs.vs(e), this.Ks();
13482
13474
  }
13483
13475
  isLocalQueryTarget(e) {
13484
13476
  return this.Hs.activeTargetIds.has(e);
@@ -13545,7 +13537,7 @@ class __PRIVATE_LocalClientState {
13545
13537
  }
13546
13538
  } else if (t.key === this.Qs) {
13547
13539
  if (null !== t.newValue) {
13548
- const e = this.Ks(t.newValue);
13540
+ const e = this.Us(t.newValue);
13549
13541
  if (e) return this.Ws(e);
13550
13542
  }
13551
13543
  } else if (t.key === this.Bs) {
@@ -13576,7 +13568,7 @@ class __PRIVATE_LocalClientState {
13576
13568
  get Hs() {
13577
13569
  return this.xs.get(this.Cs);
13578
13570
  }
13579
- Us() {
13571
+ Ks() {
13580
13572
  this.setItem(this.Ns, this.Hs.bs());
13581
13573
  }
13582
13574
  zs(e, t, n) {
@@ -13633,7 +13625,7 @@ class __PRIVATE_LocalClientState {
13633
13625
  /**
13634
13626
  * Parses an online state from WebStorage. Returns 'null' if the value
13635
13627
  * could not be parsed.
13636
- */ Ks(e) {
13628
+ */ Us(e) {
13637
13629
  return __PRIVATE_SharedOnlineState.Ss(e);
13638
13630
  }
13639
13631
  _o(e) {
@@ -13858,7 +13850,7 @@ function __PRIVATE_generateUniqueDebugId() {
13858
13850
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13859
13851
  * See the License for the specific language governing permissions and
13860
13852
  * limitations under the License.
13861
- */ const Ut = "RestConnection", Kt = {
13853
+ */ const Kt = "RestConnection", Ut = {
13862
13854
  BatchGetDocuments: "batchGet",
13863
13855
  Commit: "commit",
13864
13856
  RunQuery: "runQuery",
@@ -13887,14 +13879,14 @@ class __PRIVATE_RestConnection {
13887
13879
  }
13888
13880
  So(e, t, n, r, i) {
13889
13881
  const s = __PRIVATE_generateUniqueDebugId(), o = this.bo(e, t.toUriEncodedString());
13890
- __PRIVATE_logDebug(Ut, `Sending RPC '${e}' ${s}:`, o, n);
13882
+ __PRIVATE_logDebug(Kt, `Sending RPC '${e}' ${s}:`, o, n);
13891
13883
  const _ = {
13892
13884
  "google-cloud-resource-prefix": this.yo,
13893
13885
  "x-goog-request-params": this.wo
13894
13886
  };
13895
- return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Ut, `Received RPC '${e}' ${s}: `, t),
13887
+ return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Kt, `Received RPC '${e}' ${s}: `, t),
13896
13888
  t)), (t => {
13897
- throw __PRIVATE_logWarn(Ut, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13889
+ throw __PRIVATE_logWarn(Kt, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13898
13890
  t;
13899
13891
  }));
13900
13892
  }
@@ -13921,7 +13913,7 @@ class __PRIVATE_RestConnection {
13921
13913
  t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
13922
13914
  }
13923
13915
  bo(e, t) {
13924
- const n = Kt[e];
13916
+ const n = Ut[e];
13925
13917
  return `${this.po}/v1/${t}:${n}`;
13926
13918
  }
13927
13919
  /**
@@ -13981,10 +13973,10 @@ class __PRIVATE_RestConnection {
13981
13973
  $o() {
13982
13974
  this.Bo();
13983
13975
  }
13984
- Uo(e) {
13976
+ Ko(e) {
13985
13977
  this.ko(e);
13986
13978
  }
13987
- Ko(e) {
13979
+ Uo(e) {
13988
13980
  this.qo(e);
13989
13981
  }
13990
13982
  }
@@ -14136,10 +14128,10 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14136
14128
  h || (__PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport opened.`), P.Qo());
14137
14129
  })), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.CLOSE, (() => {
14138
14130
  h || (h = !0, __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport closed`),
14139
- P.Uo());
14131
+ P.Ko());
14140
14132
  })), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.ERROR, (t => {
14141
14133
  h || (h = !0, __PRIVATE_logWarn(Wt, `RPC '${e}' stream ${r} transport errored:`, t),
14142
- P.Uo(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14134
+ P.Ko(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14143
14135
  })), __PRIVATE_unguardedEventListen(c, webchannelBlob.WebChannel.EventType.MESSAGE, (t => {
14144
14136
  var n;
14145
14137
  if (!h) {
@@ -14170,8 +14162,8 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14170
14162
  }(t), i = o.message;
14171
14163
  void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
14172
14164
  // Mark closed so no further events are propagated
14173
- h = !0, P.Uo(new FirestoreError(n, i)), c.close();
14174
- } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Ko(i);
14165
+ h = !0, P.Ko(new FirestoreError(n, i)), c.close();
14166
+ } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Uo(i);
14175
14167
  }
14176
14168
  })), __PRIVATE_unguardedEventListen(o, webchannelBlob.Event.STAT_EVENT, (t => {
14177
14169
  t.stat === webchannelBlob.Stat.PROXY ? __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === webchannelBlob.Stat.NOPROXY && __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected no buffering proxy`);
@@ -14906,7 +14898,7 @@ class __PRIVATE_RemoteStoreImpl {
14906
14898
  * purely based on order, and so we can just shift() writes from the front of
14907
14899
  * the writePipeline as we receive responses.
14908
14900
  */
14909
- this.U_ = [],
14901
+ this.K_ = [],
14910
14902
  /**
14911
14903
  * A mapping of watched targets that the client cares about tracking and the
14912
14904
  * user has explicitly called a 'listen' for this target.
@@ -14916,7 +14908,7 @@ class __PRIVATE_RemoteStoreImpl {
14916
14908
  * to the server. The targets removed with unlistens are removed eagerly
14917
14909
  * without waiting for confirmation from the listen stream.
14918
14910
  */
14919
- this.K_ = new Map,
14911
+ this.U_ = new Map,
14920
14912
  /**
14921
14913
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14922
14914
  * RemoteStore may start its network connections.
@@ -14963,9 +14955,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14963
14955
  */
14964
14956
  function __PRIVATE_remoteStoreListen(e, t) {
14965
14957
  const n = __PRIVATE_debugCast(e);
14966
- n.K_.has(t.targetId) || (
14958
+ n.U_.has(t.targetId) || (
14967
14959
  // Mark this as something the client is currently listening for.
14968
- n.K_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14960
+ n.U_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14969
14961
  // The listen will be sent in onWatchStreamOpen
14970
14962
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).c_() && __PRIVATE_sendWatchRequest(n, t));
14971
14963
  }
@@ -14975,7 +14967,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14975
14967
  * not being listened to.
14976
14968
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14977
14969
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14978
- n.K_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.K_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14970
+ n.U_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.U_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14979
14971
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14980
14972
  // have no listeners, since without any listens to send we cannot
14981
14973
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -15004,7 +14996,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
15004
14996
  function __PRIVATE_startWatchStream(e) {
15005
14997
  e.H_ = new __PRIVATE_WatchChangeAggregator({
15006
14998
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
15007
- lt: t => e.K_.get(t) || null,
14999
+ lt: t => e.U_.get(t) || null,
15008
15000
  it: () => e.datastore.serializer.databaseId
15009
15001
  }), __PRIVATE_ensureWatchStream(e).start(), e.j_.B_();
15010
15002
  }
@@ -15013,7 +15005,7 @@ function __PRIVATE_startWatchStream(e) {
15013
15005
  * Returns whether the watch stream should be started because it's necessary
15014
15006
  * and has not yet been started.
15015
15007
  */ function __PRIVATE_shouldStartWatchStream(e) {
15016
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.K_.size > 0;
15008
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.U_.size > 0;
15017
15009
  }
15018
15010
 
15019
15011
  function __PRIVATE_canUseNetwork(e) {
@@ -15030,7 +15022,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
15030
15022
  }
15031
15023
 
15032
15024
  async function __PRIVATE_onWatchStreamOpen(e) {
15033
- e.K_.forEach(((t, n) => {
15025
+ e.U_.forEach(((t, n) => {
15034
15026
  __PRIVATE_sendWatchRequest(e, t);
15035
15027
  }));
15036
15028
  }
@@ -15057,7 +15049,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15057
15049
  const n = t.cause;
15058
15050
  for (const r of t.targetIds)
15059
15051
  // A watched target might have been removed already.
15060
- e.K_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.K_.delete(r), e.H_.removeTarget(r));
15052
+ e.U_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.U_.delete(r), e.H_.removeTarget(r));
15061
15053
  }
15062
15054
  /**
15063
15055
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -15087,21 +15079,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15087
15079
  // persistent view of these when applying the completed RemoteEvent.
15088
15080
  return n.targetChanges.forEach(((n, r) => {
15089
15081
  if (n.resumeToken.approximateByteSize() > 0) {
15090
- const i = e.K_.get(r);
15082
+ const i = e.U_.get(r);
15091
15083
  // A watched target might have been removed already.
15092
- i && e.K_.set(r, i.withResumeToken(n.resumeToken, t));
15084
+ i && e.U_.set(r, i.withResumeToken(n.resumeToken, t));
15093
15085
  }
15094
15086
  })),
15095
15087
  // Re-establish listens for the targets that have been invalidated by
15096
15088
  // existence filter mismatches.
15097
15089
  n.targetMismatches.forEach(((t, n) => {
15098
- const r = e.K_.get(t);
15090
+ const r = e.U_.get(t);
15099
15091
  if (!r)
15100
15092
  // A watched target might have been removed already.
15101
15093
  return;
15102
15094
  // Clear the resume token for the target, since we're in a known mismatch
15103
15095
  // state.
15104
- e.K_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15096
+ e.U_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15105
15097
  // Cause a hard reset by unwatching and rewatching immediately, but
15106
15098
  // deliberately don't send a resume token so that we get a full update.
15107
15099
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15152,11 +15144,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15152
15144
 
15153
15145
  async function __PRIVATE_fillWritePipeline(e) {
15154
15146
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15155
- let r = t.U_.length > 0 ? t.U_[t.U_.length - 1].batchId : Q;
15147
+ let r = t.K_.length > 0 ? t.K_[t.K_.length - 1].batchId : Q;
15156
15148
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15157
15149
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15158
15150
  if (null === e) {
15159
- 0 === t.U_.length && n.P_();
15151
+ 0 === t.K_.length && n.P_();
15160
15152
  break;
15161
15153
  }
15162
15154
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15170,20 +15162,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15170
15162
  * Returns true if we can add to the write pipeline (i.e. the network is
15171
15163
  * enabled and the write pipeline is not full).
15172
15164
  */ function __PRIVATE_canAddToWritePipeline(e) {
15173
- return __PRIVATE_canUseNetwork(e) && e.U_.length < 10;
15165
+ return __PRIVATE_canUseNetwork(e) && e.K_.length < 10;
15174
15166
  }
15175
15167
 
15176
15168
  /**
15177
15169
  * Queues additional writes to be sent to the write stream, sending them
15178
15170
  * immediately if the write stream is established.
15179
15171
  */ function __PRIVATE_addToWritePipeline(e, t) {
15180
- e.U_.push(t);
15172
+ e.K_.push(t);
15181
15173
  const n = __PRIVATE_ensureWriteStream(e);
15182
15174
  n.c_() && n.S_ && n.b_(t.mutations);
15183
15175
  }
15184
15176
 
15185
15177
  function __PRIVATE_shouldStartWriteStream(e) {
15186
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.U_.length > 0;
15178
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.K_.length > 0;
15187
15179
  }
15188
15180
 
15189
15181
  function __PRIVATE_startWriteStream(e) {
@@ -15197,11 +15189,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15197
15189
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15198
15190
  const t = __PRIVATE_ensureWriteStream(e);
15199
15191
  // Send the write pipeline now that the stream is established.
15200
- for (const n of e.U_) t.b_(n.mutations);
15192
+ for (const n of e.K_) t.b_(n.mutations);
15201
15193
  }
15202
15194
 
15203
15195
  async function __PRIVATE_onMutationResult(e, t, n) {
15204
- const r = e.U_.shift(), i = MutationBatchResult.from(r, t, n);
15196
+ const r = e.K_.shift(), i = MutationBatchResult.from(r, t, n);
15205
15197
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15206
15198
  // It's possible that with the completion of this mutation another
15207
15199
  // slot has freed up.
@@ -15221,7 +15213,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15221
15213
  }(t.code)) {
15222
15214
  // This was a permanent error, the request itself was the problem
15223
15215
  // so it's not going to succeed if we resend it.
15224
- const n = e.U_.shift();
15216
+ const n = e.K_.shift();
15225
15217
  // In this case it's also unlikely that the server itself is melting
15226
15218
  // down -- this was just a bad request so inhibit backoff on the next
15227
15219
  // restart.
@@ -15320,8 +15312,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15320
15312
  }), e.G_.push((async t => {
15321
15313
  t ? (e.Y_.h_(),
15322
15314
  // This will start the write stream if necessary.
15323
- await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.U_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.U_.length} pending writes`),
15324
- e.U_ = []));
15315
+ await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.K_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.K_.length} pending writes`),
15316
+ e.K_ = []));
15325
15317
  }))), e.Y_;
15326
15318
  }
15327
15319
 
@@ -16335,11 +16327,11 @@ const Jt = "SyncEngine";
16335
16327
  * Keeps track of the information about an active limbo resolution for each
16336
16328
  * active target ID that was started for the purpose of limbo resolution.
16337
16329
  */
16338
- this.Ua = new Map, this.Ka = new __PRIVATE_ReferenceSet,
16330
+ this.Ka = new Map, this.Ua = new __PRIVATE_ReferenceSet,
16339
16331
  /** Stores user completion handlers, indexed by User and BatchId. */
16340
16332
  this.Wa = {},
16341
16333
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
16342
- this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Kn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16334
+ this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Un(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16343
16335
  // The primary state is set to `true` or `false` immediately after Firestore
16344
16336
  // startup. In the interim, a client should only be considered primary if
16345
16337
  // `isPrimary` is true.
@@ -16519,7 +16511,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16519
16511
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16520
16512
  // Update `receivedDocument` as appropriate for any limbo targets.
16521
16513
  t.targetChanges.forEach(((e, t) => {
16522
- const r = n.Ua.get(t);
16514
+ const r = n.Ka.get(t);
16523
16515
  r && (
16524
16516
  // Since this is a limbo resolution lookup, it's for a single document
16525
16517
  // and it could be added, modified, or removed, but not a combination.
@@ -16573,7 +16565,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16573
16565
  const r = __PRIVATE_debugCast(e);
16574
16566
  // PORTING NOTE: Multi-tab only.
16575
16567
  r.sharedClientState.updateQueryState(t, "rejected", n);
16576
- const i = r.Ua.get(t), s = i && i.key;
16568
+ const i = r.Ka.get(t), s = i && i.key;
16577
16569
  if (s) {
16578
16570
  // TODO(klimt): We really only should do the following on permission
16579
16571
  // denied errors, but we don't have the cause code here.
@@ -16595,7 +16587,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16595
16587
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16596
16588
  // this query when the RemoteStore restarts the Watch stream, which should
16597
16589
  // re-trigger the target failure.
16598
- r.$a = r.$a.remove(s), r.Ua.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16590
+ r.$a = r.$a.remove(s), r.Ka.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16599
16591
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16600
16592
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16601
16593
  }
@@ -16689,8 +16681,8 @@ function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16689
16681
  e.sharedClientState.removeLocalQueryTarget(t);
16690
16682
  for (const r of e.qa.get(t)) e.ka.delete(r), n && e.La.Ja(r, n);
16691
16683
  if (e.qa.delete(t), e.isPrimaryClient) {
16692
- e.Ka.br(t).forEach((t => {
16693
- e.Ka.containsKey(t) ||
16684
+ e.Ua.br(t).forEach((t => {
16685
+ e.Ua.containsKey(t) ||
16694
16686
  // We removed the last reference for this key
16695
16687
  __PRIVATE_removeLimboTarget(e, t);
16696
16688
  }));
@@ -16703,14 +16695,14 @@ function __PRIVATE_removeLimboTarget(e, t) {
16703
16695
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16704
16696
  const n = e.$a.get(t);
16705
16697
  null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.$a = e.$a.remove(t),
16706
- e.Ua.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16698
+ e.Ka.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16707
16699
  }
16708
16700
 
16709
16701
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
16710
- for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ka.addReference(r.key, t),
16702
+ for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ua.addReference(r.key, t),
16711
16703
  __PRIVATE_trackLimboChange(e, r); else if (r instanceof __PRIVATE_RemovedLimboDocument) {
16712
- __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ka.removeReference(r.key, t);
16713
- e.Ka.containsKey(r.key) ||
16704
+ __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ua.removeReference(r.key, t);
16705
+ e.Ua.containsKey(r.key) ||
16714
16706
  // We removed the last reference for this key
16715
16707
  __PRIVATE_removeLimboTarget(e, r.key);
16716
16708
  } else fail();
@@ -16734,7 +16726,7 @@ function __PRIVATE_trackLimboChange(e, t) {
16734
16726
  const t = e.Qa.values().next().value;
16735
16727
  e.Qa.delete(t);
16736
16728
  const n = new DocumentKey(ResourcePath.fromString(t)), r = e.za.next();
16737
- 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));
16729
+ 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));
16738
16730
  }
16739
16731
  }
16740
16732
 
@@ -16802,7 +16794,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16802
16794
  }
16803
16795
 
16804
16796
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16805
- const n = __PRIVATE_debugCast(e), r = n.Ua.get(t);
16797
+ const n = __PRIVATE_debugCast(e), r = n.Ka.get(t);
16806
16798
  if (r && r.Ba) return __PRIVATE_documentKeySet().add(r.key);
16807
16799
  {
16808
16800
  let e = __PRIVATE_documentKeySet();
@@ -16894,9 +16886,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16894
16886
  // PORTING NOTE: Multi-Tab only.
16895
16887
  function __PRIVATE_resetLimboDocuments(e) {
16896
16888
  const t = __PRIVATE_debugCast(e);
16897
- t.Ua.forEach(((e, n) => {
16889
+ t.Ka.forEach(((e, n) => {
16898
16890
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16899
- })), t.Ka.Dr(), t.Ua = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16891
+ })), t.Ua.Dr(), t.Ka = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16900
16892
  }
16901
16893
  /**
16902
16894
  * Reconcile the query views of the provided query targets with the state from
@@ -19755,7 +19747,7 @@ function __PRIVATE_isWrite(e) {
19755
19747
  });
19756
19748
  return r.$u(e), r;
19757
19749
  }
19758
- Uu(e) {
19750
+ Ku(e) {
19759
19751
  var t;
19760
19752
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.ku({
19761
19753
  path: n,
@@ -19763,7 +19755,7 @@ function __PRIVATE_isWrite(e) {
19763
19755
  });
19764
19756
  return r.Bu(), r;
19765
19757
  }
19766
- Ku(e) {
19758
+ Uu(e) {
19767
19759
  // TODO(b/34871131): We don't support array paths right now; so make path
19768
19760
  // undefined.
19769
19761
  return this.ku({
@@ -19924,7 +19916,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19924
19916
  // For Compat types, we have to "extract" the underlying types before
19925
19917
  // performing validation.
19926
19918
  r = util.getModularInstance(r);
19927
- const a = i.Uu(_);
19919
+ const a = i.Ku(_);
19928
19920
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19929
19921
  // Add it to the field mask, but don't add anything to updateData.
19930
19922
  s.push(_); else {
@@ -19950,7 +19942,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19950
19942
  // For Compat types, we have to "extract" the underlying types before
19951
19943
  // performing validation.
19952
19944
  n = util.getModularInstance(n);
19953
- const r = o.Uu(t);
19945
+ const r = o.Ku(t);
19954
19946
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19955
19947
  // Add it to the field mask, but don't add anything to updateData.
19956
19948
  u.push(t); else {
@@ -20028,7 +20020,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
20028
20020
  const n = [];
20029
20021
  let r = 0;
20030
20022
  for (const i of e) {
20031
- let e = __PRIVATE_parseData(i, t.Ku(r));
20023
+ let e = __PRIVATE_parseData(i, t.Uu(r));
20032
20024
  null == e && (
20033
20025
  // Just include nulls in the array for fields being replaced with a
20034
20026
  // sentinel.