@firebase/firestore 4.7.7-canary.3418ef807 → 4.7.7-canary.4d2fc6e82

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.
@@ -5,7 +5,7 @@ import { FirebaseError, createMockUserToken, getModularInstance, deepEqual, getD
5
5
  import { Integer, Md5 } from '@firebase/webchannel-wrapper/bloom-blob';
6
6
  import { XhrIo, EventType, ErrorCode, createWebChannelTransport, getStatEventTarget, WebChannel, Event, Stat } from '@firebase/webchannel-wrapper/webchannel-blob';
7
7
 
8
- const S = "@firebase/firestore", b = "4.7.7-canary.3418ef807";
8
+ const S = "@firebase/firestore", b = "4.7.7-canary.4d2fc6e82";
9
9
 
10
10
  /**
11
11
  * @license
@@ -67,7 +67,7 @@ User.MOCK_USER = new User("mock-user");
67
67
  * See the License for the specific language governing permissions and
68
68
  * limitations under the License.
69
69
  */
70
- let D = "11.3.0-canary.3418ef807";
70
+ let D = "11.3.0-canary.4d2fc6e82";
71
71
 
72
72
  /**
73
73
  * @license
@@ -684,6 +684,31 @@ function __PRIVATE_randomBytes(e) {
684
684
  return n;
685
685
  }
686
686
 
687
+ /**
688
+ * @license
689
+ * Copyright 2023 Google LLC
690
+ *
691
+ * Licensed under the Apache License, Version 2.0 (the "License");
692
+ * you may not use this file except in compliance with the License.
693
+ * You may obtain a copy of the License at
694
+ *
695
+ * http://www.apache.org/licenses/LICENSE-2.0
696
+ *
697
+ * Unless required by applicable law or agreed to in writing, software
698
+ * distributed under the License is distributed on an "AS IS" BASIS,
699
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
700
+ * See the License for the specific language governing permissions and
701
+ * limitations under the License.
702
+ */
703
+ /**
704
+ * An instance of the Platform's 'TextEncoder' implementation.
705
+ */ function __PRIVATE_newTextEncoder() {
706
+ return new TextEncoder;
707
+ }
708
+
709
+ /**
710
+ * An instance of the Platform's 'TextDecoder' implementation.
711
+ */
687
712
  /**
688
713
  * @license
689
714
  * Copyright 2017 Google LLC
@@ -705,7 +730,8 @@ function __PRIVATE_randomBytes(e) {
705
730
  *
706
731
  * @internal
707
732
  * Exported internally for testing purposes.
708
- */ class __PRIVATE_AutoId {
733
+ */
734
+ class __PRIVATE_AutoId {
709
735
  static newId() {
710
736
  // Alphanumeric characters
711
737
  const e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", t = 62 * Math.floor(256 / 62);
@@ -726,6 +752,16 @@ function __PRIVATE_primitiveComparator(e, t) {
726
752
  return e < t ? -1 : e > t ? 1 : 0;
727
753
  }
728
754
 
755
+ /** Compare strings in UTF-8 encoded byte order */ function __PRIVATE_compareUtf8Strings(e, t) {
756
+ // Convert the string to UTF-8 encoded bytes
757
+ const n = __PRIVATE_newTextEncoder().encode(e), r = __PRIVATE_newTextEncoder().encode(t);
758
+ for (let e = 0; e < Math.min(n.length, r.length); e++) {
759
+ const t = __PRIVATE_primitiveComparator(n[e], r[e]);
760
+ if (0 !== t) return t;
761
+ }
762
+ return __PRIVATE_primitiveComparator(n.length, r.length);
763
+ }
764
+
729
765
  /** Helper to compare arrays using isEqual(). */ function __PRIVATE_arrayEquals(e, t, n) {
730
766
  return e.length === t.length && e.every(((e, r) => n(e, t[r])));
731
767
  }
@@ -1016,13 +1052,11 @@ class Timestamp {
1016
1052
  const n = BasePath.compareSegments(e.get(r), t.get(r));
1017
1053
  if (0 !== n) return n;
1018
1054
  }
1019
- return Math.sign(e.length - t.length);
1055
+ return __PRIVATE_primitiveComparator(e.length, t.length);
1020
1056
  }
1021
1057
  static compareSegments(e, t) {
1022
1058
  const n = BasePath.isNumericId(e), r = BasePath.isNumericId(t);
1023
- return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) :
1024
- // both non-numeric
1025
- e < t ? -1 : e > t ? 1 : 0;
1059
+ return n && !r ? -1 : !n && r ? 1 : n && r ? BasePath.extractNumericId(e).compare(BasePath.extractNumericId(t)) : __PRIVATE_compareUtf8Strings(e, t);
1026
1060
  }
1027
1061
  // Checks if a segment is a numeric ID (starts with "__id" and ends with "__").
1028
1062
  static isNumericId(e) {
@@ -1810,13 +1844,13 @@ class __PRIVATE_SimpleDbTransaction {
1810
1844
  * within the key range or index.
1811
1845
  */ class __PRIVATE_IterationController {
1812
1846
  constructor(e) {
1813
- this.q = e, this.$ = !1, this.K = null;
1847
+ this.q = e, this.$ = !1, this.U = null;
1814
1848
  }
1815
1849
  get isDone() {
1816
1850
  return this.$;
1817
1851
  }
1818
- get U() {
1819
- return this.K;
1852
+ get K() {
1853
+ return this.U;
1820
1854
  }
1821
1855
  set cursor(e) {
1822
1856
  this.q = e;
@@ -1830,7 +1864,7 @@ class __PRIVATE_SimpleDbTransaction {
1830
1864
  * This function can be called to skip to that next key, which could be
1831
1865
  * an index or a primary key.
1832
1866
  */ W(e) {
1833
- this.K = e;
1867
+ this.U = e;
1834
1868
  }
1835
1869
  /**
1836
1870
  * Delete the current cursor value from the object store.
@@ -1989,7 +2023,7 @@ class __PRIVATE_SimpleDbTransaction {
1989
2023
  const e = o.catch((e => (s.done(), PersistencePromise.reject(e))));
1990
2024
  n.push(e);
1991
2025
  }
1992
- s.isDone ? r() : null === s.U ? i.continue() : i.continue(s.U);
2026
+ s.isDone ? r() : null === s.K ? i.continue() : i.continue(s.K);
1993
2027
  };
1994
2028
  })).next((() => PersistencePromise.waitFor(n)));
1995
2029
  }
@@ -2310,7 +2344,7 @@ function __PRIVATE_encodeResourcePath(e) {
2310
2344
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2311
2345
  * See the License for the specific language governing permissions and
2312
2346
  * limitations under the License.
2313
- */ const K = "remoteDocuments", U = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2347
+ */ const U = "remoteDocuments", K = "owner", W = "owner", G = "mutationQueues", z = "userId", j = "mutations", H = "batchId", J = "userMutationsIndex", Y = [ "userId", "batchId" ];
2314
2348
 
2315
2349
  /**
2316
2350
  * @license
@@ -2355,7 +2389,7 @@ function __PRIVATE_newDbDocumentMutationPrefixForPath(e, t) {
2355
2389
  * there is no useful information to store as the value. The raw (unencoded)
2356
2390
  * path cannot be stored because IndexedDb doesn't store prototype
2357
2391
  * information.
2358
- */ 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 ];
2392
+ */ 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 ];
2359
2393
 
2360
2394
  /**
2361
2395
  * @license
@@ -3417,7 +3451,7 @@ function __PRIVATE_valueCompare(e, t) {
3417
3451
  return __PRIVATE_compareTimestamps(__PRIVATE_getLocalWriteTime(e), __PRIVATE_getLocalWriteTime(t));
3418
3452
 
3419
3453
  case 5 /* TypeOrder.StringValue */ :
3420
- return __PRIVATE_primitiveComparator(e.stringValue, t.stringValue);
3454
+ return __PRIVATE_compareUtf8Strings(e.stringValue, t.stringValue);
3421
3455
 
3422
3456
  case 6 /* TypeOrder.BlobValue */ :
3423
3457
  return function __PRIVATE_compareBlobs(e, t) {
@@ -3465,7 +3499,7 @@ function __PRIVATE_valueCompare(e, t) {
3465
3499
  // canonical IDs are independent of insertion order.
3466
3500
  r.sort(), s.sort();
3467
3501
  for (let e = 0; e < r.length && e < s.length; ++e) {
3468
- const t = __PRIVATE_primitiveComparator(r[e], s[e]);
3502
+ const t = __PRIVATE_compareUtf8Strings(r[e], s[e]);
3469
3503
  if (0 !== t) return t;
3470
3504
  const o = __PRIVATE_valueCompare(n[r[e]], i[s[e]]);
3471
3505
  if (0 !== o) return o;
@@ -5877,32 +5911,6 @@ let At = null;
5877
5911
  * Sets the value of the `testingHooksSpi` object.
5878
5912
  * @param instance the instance to set.
5879
5913
  */
5880
- /**
5881
- * @license
5882
- * Copyright 2023 Google LLC
5883
- *
5884
- * Licensed under the Apache License, Version 2.0 (the "License");
5885
- * you may not use this file except in compliance with the License.
5886
- * You may obtain a copy of the License at
5887
- *
5888
- * http://www.apache.org/licenses/LICENSE-2.0
5889
- *
5890
- * Unless required by applicable law or agreed to in writing, software
5891
- * distributed under the License is distributed on an "AS IS" BASIS,
5892
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5893
- * See the License for the specific language governing permissions and
5894
- * limitations under the License.
5895
- */
5896
- /**
5897
- * An instance of the Platform's 'TextEncoder' implementation.
5898
- */
5899
- function __PRIVATE_newTextEncoder() {
5900
- return new TextEncoder;
5901
- }
5902
-
5903
- /**
5904
- * An instance of the Platform's 'TextDecoder' implementation.
5905
- */
5906
5914
  /**
5907
5915
  * @license
5908
5916
  * Copyright 2022 Google LLC
@@ -6275,13 +6283,13 @@ class __PRIVATE_WatchChangeAggregator {
6275
6283
  /** Keeps track of the documents to update since the last raised snapshot. */
6276
6284
  this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6277
6285
  /** A mapping of document keys to their set of target IDs. */
6278
- this.Ke = __PRIVATE_documentTargetMap(),
6286
+ this.Ue = __PRIVATE_documentTargetMap(),
6279
6287
  /**
6280
6288
  * A map of targets with existence filter mismatches. These targets are
6281
6289
  * known to be inconsistent and their listens needs to be re-established by
6282
6290
  * RemoteStore.
6283
6291
  */
6284
- this.Ue = new SortedMap(__PRIVATE_primitiveComparator);
6292
+ this.Ke = new SortedMap(__PRIVATE_primitiveComparator);
6285
6293
  }
6286
6294
  /**
6287
6295
  * Processes and adds the DocumentWatchChange to the current set of changes.
@@ -6370,7 +6378,7 @@ class __PRIVATE_WatchChangeAggregator {
6370
6378
  // trigger re-run of the query.
6371
6379
  this.Ye(t);
6372
6380
  const e = 2 /* BloomFilterApplicationStatus.FalsePositive */ === i ? "TargetPurposeExistenceFilterMismatchBloom" /* TargetPurpose.ExistenceFilterMismatchBloom */ : "TargetPurposeExistenceFilterMismatch" /* TargetPurpose.ExistenceFilterMismatch */;
6373
- this.Ue = this.Ue.insert(t, e);
6381
+ this.Ke = this.Ke.insert(t, e);
6374
6382
  }
6375
6383
  null == At || At.rt(function __PRIVATE_createExistenceFilterMismatchInfoForTestingHooks(e, t, n, r, i) {
6376
6384
  var s, o, _, a, u, c;
@@ -6482,7 +6490,7 @@ class __PRIVATE_WatchChangeAggregator {
6482
6490
 
6483
6491
  // TODO(gsoltis): Expand on this comment once GC is available in the JS
6484
6492
  // client.
6485
- this.Ke.forEach(((e, t) => {
6493
+ this.Ue.forEach(((e, t) => {
6486
6494
  let r = !0;
6487
6495
  t.forEachWhile((e => {
6488
6496
  const t = this.Xe(e);
@@ -6490,9 +6498,9 @@ class __PRIVATE_WatchChangeAggregator {
6490
6498
  !1);
6491
6499
  })), r && (n = n.add(e));
6492
6500
  })), this.Qe.forEach(((t, n) => n.setReadTime(e)));
6493
- const r = new RemoteEvent(e, t, this.Ue, this.Qe, n);
6501
+ const r = new RemoteEvent(e, t, this.Ke, this.Qe, n);
6494
6502
  return this.Qe = __PRIVATE_mutableDocumentMap(), this.$e = __PRIVATE_documentTargetMap(),
6495
- this.Ke = __PRIVATE_documentTargetMap(), this.Ue = new SortedMap(__PRIVATE_primitiveComparator),
6503
+ this.Ue = __PRIVATE_documentTargetMap(), this.Ke = new SortedMap(__PRIVATE_primitiveComparator),
6496
6504
  r;
6497
6505
  }
6498
6506
  /**
@@ -6504,7 +6512,7 @@ class __PRIVATE_WatchChangeAggregator {
6504
6512
  if (!this.Je(e)) return;
6505
6513
  const n = this.ut(e, t.key) ? 2 /* ChangeType.Modified */ : 0 /* ChangeType.Added */;
6506
6514
  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)),
6507
- this.Ke = this.Ke.insert(t.key, this.ct(t.key).add(e));
6515
+ this.Ue = this.Ue.insert(t.key, this.ct(t.key).add(e));
6508
6516
  }
6509
6517
  /**
6510
6518
  * Removes the provided document from the target mapping. If the
@@ -6520,7 +6528,7 @@ class __PRIVATE_WatchChangeAggregator {
6520
6528
  this.ut(e, t) ? r.xe(t, 1 /* ChangeType.Removed */) :
6521
6529
  // The document may have entered and left the target before we raised a
6522
6530
  // snapshot, so we can just ignore the change.
6523
- 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)),
6531
+ 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)),
6524
6532
  n && (this.Qe = this.Qe.insert(t, n));
6525
6533
  }
6526
6534
  removeTarget(e) {
@@ -6545,8 +6553,8 @@ class __PRIVATE_WatchChangeAggregator {
6545
6553
  return t || (t = new __PRIVATE_TargetState, this.qe.set(e, t)), t;
6546
6554
  }
6547
6555
  ct(e) {
6548
- let t = this.Ke.get(e);
6549
- return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ke = this.Ke.insert(e, t)),
6556
+ let t = this.Ue.get(e);
6557
+ return t || (t = new SortedSet(__PRIVATE_primitiveComparator), this.Ue = this.Ue.insert(e, t)),
6550
6558
  t;
6551
6559
  }
6552
6560
  _t(e) {
@@ -7729,7 +7737,7 @@ function __PRIVATE_toDbIndexState(e, t, n, r) {
7729
7737
  * limitations under the License.
7730
7738
  */ class __PRIVATE_IndexedDbGlobalsCache {
7731
7739
  dt(e) {
7732
- return __PRIVATE_getStore(e, Ke);
7740
+ return __PRIVATE_getStore(e, Ue);
7733
7741
  }
7734
7742
  getSessionToken(e) {
7735
7743
  return this.dt(e).get("sessionToken").next((e => {
@@ -7941,10 +7949,10 @@ function __PRIVATE_unsignedNumLength(e) {
7941
7949
  }
7942
7950
  this.qt();
7943
7951
  }
7944
- Kt(e) {
7952
+ Ut(e) {
7945
7953
  // Values are encoded with a single byte length prefix, followed by the
7946
7954
  // actual value in big-endian format with leading 0 bytes dropped.
7947
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7955
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7948
7956
  this.Wt(1 + n), this.buffer[this.position++] = 255 & n;
7949
7957
  // Write the length
7950
7958
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = 255 & t[e];
@@ -7952,7 +7960,7 @@ function __PRIVATE_unsignedNumLength(e) {
7952
7960
  Gt(e) {
7953
7961
  // Values are encoded with a single byte length prefix, followed by the
7954
7962
  // inverted value in big-endian format with leading 0 bytes dropped.
7955
- const t = this.Ut(e), n = __PRIVATE_unsignedNumLength(t);
7963
+ const t = this.Kt(e), n = __PRIVATE_unsignedNumLength(t);
7956
7964
  this.Wt(1 + n), this.buffer[this.position++] = ~(255 & n);
7957
7965
  // Write the length
7958
7966
  for (let e = t.length - n; e < t.length; ++e) this.buffer[this.position++] = ~(255 & t[e]);
@@ -7987,7 +7995,7 @@ function __PRIVATE_unsignedNumLength(e) {
7987
7995
  * -0.0 < 0.0
7988
7996
  * all non-NaN < NaN
7989
7997
  * NaN = NaN
7990
- */ Ut(e) {
7998
+ */ Kt(e) {
7991
7999
  const t =
7992
8000
  /** Converts a JavaScript number to a byte array (using big endian encoding). */
7993
8001
  function __PRIVATE_doubleToLongBits(e) {
@@ -8046,7 +8054,7 @@ class __PRIVATE_AscendingIndexByteEncoder {
8046
8054
  this.Zt.Qt(e);
8047
8055
  }
8048
8056
  gt(e) {
8049
- this.Zt.Kt(e);
8057
+ this.Zt.Ut(e);
8050
8058
  }
8051
8059
  Vt() {
8052
8060
  this.Zt.zt();
@@ -9555,14 +9563,14 @@ class __PRIVATE_TargetIdGenerator {
9555
9563
  next() {
9556
9564
  return this.$n += 2, this.$n;
9557
9565
  }
9558
- static Kn() {
9566
+ static Un() {
9559
9567
  // The target cache generator must return '2' in its first call to `next()`
9560
9568
  // as there is no differentiation in the protocol layer between an unset
9561
9569
  // number and the number '0'. If we were to sent a target with target ID
9562
9570
  // '0', the backend would consider it unset and replace it with its own ID.
9563
9571
  return new __PRIVATE_TargetIdGenerator(0);
9564
9572
  }
9565
- static Un() {
9573
+ static Kn() {
9566
9574
  // Sync engine assigns target IDs for limbo document detection.
9567
9575
  return new __PRIVATE_TargetIdGenerator(-1);
9568
9576
  }
@@ -11330,7 +11338,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11330
11338
  * A ordered bidirectional mapping between documents and the remote target
11331
11339
  * IDs.
11332
11340
  */
11333
- this.Kr = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Ur = __PRIVATE_TargetIdGenerator.Kn();
11341
+ this.Ur = new __PRIVATE_ReferenceSet, this.targetCount = 0, this.Kr = __PRIVATE_TargetIdGenerator.Un();
11334
11342
  }
11335
11343
  forEachTarget(e, t) {
11336
11344
  return this.Qr.forEach(((e, n) => t(n))), PersistencePromise.resolve();
@@ -11342,7 +11350,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11342
11350
  return PersistencePromise.resolve(this.$r);
11343
11351
  }
11344
11352
  allocateTargetId(e) {
11345
- return this.highestTargetId = this.Ur.next(), PersistencePromise.resolve(this.highestTargetId);
11353
+ return this.highestTargetId = this.Kr.next(), PersistencePromise.resolve(this.highestTargetId);
11346
11354
  }
11347
11355
  setTargetsMetadata(e, t, n) {
11348
11356
  return n && (this.lastRemoteSnapshotVersion = n), t > this.$r && (this.$r = t),
@@ -11351,7 +11359,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11351
11359
  zn(e) {
11352
11360
  this.Qr.set(e.target, e);
11353
11361
  const t = e.targetId;
11354
- t > this.highestTargetId && (this.Ur = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11362
+ t > this.highestTargetId && (this.Kr = new __PRIVATE_TargetIdGenerator(t), this.highestTargetId = t),
11355
11363
  e.sequenceNumber > this.$r && (this.$r = e.sequenceNumber);
11356
11364
  }
11357
11365
  addTargetData(e, t) {
@@ -11361,7 +11369,7 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11361
11369
  return this.zn(t), PersistencePromise.resolve();
11362
11370
  }
11363
11371
  removeTargetData(e, t) {
11364
- return this.Qr.delete(t.target), this.Kr.br(t.targetId), this.targetCount -= 1,
11372
+ return this.Qr.delete(t.target), this.Ur.br(t.targetId), this.targetCount -= 1,
11365
11373
  PersistencePromise.resolve();
11366
11374
  }
11367
11375
  removeTargets(e, t, n) {
@@ -11380,24 +11388,24 @@ class __PRIVATE_MemoryRemoteDocumentChangeBuffer extends RemoteDocumentChangeBuf
11380
11388
  return PersistencePromise.resolve(n);
11381
11389
  }
11382
11390
  addMatchingKeys(e, t, n) {
11383
- return this.Kr.yr(t, n), PersistencePromise.resolve();
11391
+ return this.Ur.yr(t, n), PersistencePromise.resolve();
11384
11392
  }
11385
11393
  removeMatchingKeys(e, t, n) {
11386
- this.Kr.Sr(t, n);
11394
+ this.Ur.Sr(t, n);
11387
11395
  const r = this.persistence.referenceDelegate, i = [];
11388
11396
  return r && t.forEach((t => {
11389
11397
  i.push(r.markPotentiallyOrphaned(e, t));
11390
11398
  })), PersistencePromise.waitFor(i);
11391
11399
  }
11392
11400
  removeMatchingKeysForTargetId(e, t) {
11393
- return this.Kr.br(t), PersistencePromise.resolve();
11401
+ return this.Ur.br(t), PersistencePromise.resolve();
11394
11402
  }
11395
11403
  getMatchingKeysForTargetId(e, t) {
11396
- const n = this.Kr.vr(t);
11404
+ const n = this.Ur.vr(t);
11397
11405
  return PersistencePromise.resolve(n);
11398
11406
  }
11399
11407
  containsKey(e, t) {
11400
- return PersistencePromise.resolve(this.Kr.containsKey(t));
11408
+ return PersistencePromise.resolve(this.Ur.containsKey(t));
11401
11409
  }
11402
11410
  }
11403
11411
 
@@ -11658,7 +11666,7 @@ class __PRIVATE_MemoryLruDelegate {
11658
11666
  */ B(e, t, n, r) {
11659
11667
  const i = new __PRIVATE_SimpleDbTransaction("createOrUpgrade", t);
11660
11668
  n < 1 && r >= 1 && (!function __PRIVATE_createPrimaryClientStore(e) {
11661
- e.createObjectStore(U);
11669
+ e.createObjectStore(K);
11662
11670
  }(e), function __PRIVATE_createMutationQueue(e) {
11663
11671
  e.createObjectStore(G, {
11664
11672
  keyPath: z
@@ -11675,7 +11683,7 @@ class __PRIVATE_MemoryLruDelegate {
11675
11683
  * Upgrade function to migrate the 'mutations' store from V1 to V3. Loads
11676
11684
  * and rewrites all data.
11677
11685
  */ (e), __PRIVATE_createQueryCache(e), function __PRIVATE_createLegacyRemoteDocumentCache(e) {
11678
- e.createObjectStore(K);
11686
+ e.createObjectStore(U);
11679
11687
  }(e));
11680
11688
  // Migration 2 to populate the targetGlobal object no longer needed since
11681
11689
  // migration 3 unconditionally clears it.
@@ -11763,7 +11771,7 @@ class __PRIVATE_MemoryLruDelegate {
11763
11771
  keyPath: te
11764
11772
  });
11765
11773
  t.createIndex(ne, re), t.createIndex(ie, se);
11766
- }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(K)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11774
+ }(e))).next((() => this.hi(e, i))).next((() => e.deleteObjectStore(U)))), n < 14 && r >= 14 && (s = s.next((() => this.Pi(e, i)))),
11767
11775
  n < 15 && r >= 15 && (s = s.next((() => function __PRIVATE_createFieldIndex(e) {
11768
11776
  const t = e.createObjectStore(ye, {
11769
11777
  keyPath: we,
@@ -11792,15 +11800,15 @@ class __PRIVATE_MemoryLruDelegate {
11792
11800
  t.objectStore(Me).clear();
11793
11801
  }))), n < 17 && r >= 17 && (s = s.next((() => {
11794
11802
  !function __PRIVATE_createGlobalsStore(e) {
11795
- e.createObjectStore(Ke, {
11796
- keyPath: Ue
11803
+ e.createObjectStore(Ue, {
11804
+ keyPath: Ke
11797
11805
  });
11798
11806
  }(e);
11799
11807
  }))), s;
11800
11808
  }
11801
11809
  ai(e) {
11802
11810
  let t = 0;
11803
- return e.store(K).Z(((e, n) => {
11811
+ return e.store(U).Z(((e, n) => {
11804
11812
  t += __PRIVATE_dbDocumentSize(n);
11805
11813
  })).next((() => {
11806
11814
  const n = {
@@ -11824,7 +11832,7 @@ class __PRIVATE_MemoryLruDelegate {
11824
11832
  * Ensures that every document in the remote document cache has a corresponding sentinel row
11825
11833
  * with a sequence number. Missing rows are given the most recently used sequence number.
11826
11834
  */ ui(e) {
11827
- const t = e.store(le), n = e.store(K);
11835
+ const t = e.store(le), n = e.store(U);
11828
11836
  return e.store(Ee).get(Ie).next((e => {
11829
11837
  const r = [];
11830
11838
  return n.Z(((n, i) => {
@@ -11855,7 +11863,7 @@ class __PRIVATE_MemoryLruDelegate {
11855
11863
  };
11856
11864
  // Helper to add an index entry iff we haven't already written it.
11857
11865
  // Index existing remote documents.
11858
- return t.store(K).Z({
11866
+ return t.store(U).Z({
11859
11867
  Y: !0
11860
11868
  }, ((e, t) => {
11861
11869
  const n = new ResourcePath(e);
@@ -11875,7 +11883,7 @@ class __PRIVATE_MemoryLruDelegate {
11875
11883
  }));
11876
11884
  }
11877
11885
  hi(e, t) {
11878
- const n = t.store(K), r = [];
11886
+ const n = t.store(U), r = [];
11879
11887
  return n.Z(((e, n) => {
11880
11888
  const i = t.store(ee), s = function __PRIVATE_extractKey(e) {
11881
11889
  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();
@@ -12193,11 +12201,11 @@ class __PRIVATE_IndexedDbPersistence {
12193
12201
  async shutdown() {
12194
12202
  // The shutdown() operations are idempotent and can be called even when
12195
12203
  // start() aborted (e.g. because it couldn't acquire the persistence lease).
12196
- this.zr = !1, this.Ki(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ui(),
12204
+ this.zr = !1, this.Ui(), this.Vi && (this.Vi.cancel(), this.Vi = null), this.Ki(),
12197
12205
  this.Wi(),
12198
12206
  // Use `SimpleDb.runTransaction` directly to avoid failing if another tab
12199
12207
  // has obtained the primary lease.
12200
- await this.pi.runTransaction("shutdown", "readwrite", [ U, Re ], (e => {
12208
+ await this.pi.runTransaction("shutdown", "readwrite", [ K, Re ], (e => {
12201
12209
  const t = new __PRIVATE_IndexedDbTransaction(e, __PRIVATE_ListenSequence.ae);
12202
12210
  return this.xi(t).next((() => this.Bi(t)));
12203
12211
  })), this.pi.close(),
@@ -12303,7 +12311,7 @@ class __PRIVATE_IndexedDbPersistence {
12303
12311
  this.wi())));
12304
12312
  }, this.document.addEventListener("visibilitychange", this.Ri), this.inForeground = "visible" === this.document.visibilityState);
12305
12313
  }
12306
- Ui() {
12314
+ Ki() {
12307
12315
  this.Ri && (this.document.removeEventListener("visibilitychange", this.Ri), this.Ri = null);
12308
12316
  }
12309
12317
  /**
@@ -12321,7 +12329,7 @@ class __PRIVATE_IndexedDbPersistence {
12321
12329
  // Note: In theory, this should be scheduled on the AsyncQueue since it
12322
12330
  // accesses internal state. We execute this code directly during shutdown
12323
12331
  // to make sure it gets a chance to run.
12324
- this.Ki();
12332
+ this.Ui();
12325
12333
  const e = /(?:Version|Mobile)\/1[456]/;
12326
12334
  isSafari() && (navigator.appVersion.match(e) || navigator.userAgent.match(e)) &&
12327
12335
  // On Safari 14, 15, and 16, we do not run any cleanup actions as it might
@@ -12352,7 +12360,7 @@ class __PRIVATE_IndexedDbPersistence {
12352
12360
  /**
12353
12361
  * Record client as zombied (a client that had its tab closed). Zombied
12354
12362
  * clients are ignored during primary tab selection.
12355
- */ Ki() {
12363
+ */ Ui() {
12356
12364
  if (this.yi) try {
12357
12365
  this.yi.setItem(this.Qi(this.clientId), String(Date.now()));
12358
12366
  } catch (e) {
@@ -12375,7 +12383,7 @@ class __PRIVATE_IndexedDbPersistence {
12375
12383
  /**
12376
12384
  * Helper to get a typed SimpleDbStore for the primary client object store.
12377
12385
  */ function __PRIVATE_primaryClientStore(e) {
12378
- return __PRIVATE_getStore(e, U);
12386
+ return __PRIVATE_getStore(e, K);
12379
12387
  }
12380
12388
 
12381
12389
  /**
@@ -13414,12 +13422,12 @@ class __PRIVATE_LocalClientState {
13414
13422
  n && (this.xs = this.xs.insert(n.clientId, n));
13415
13423
  }
13416
13424
  }
13417
- this.Ks();
13425
+ this.Us();
13418
13426
  // Check if there is an existing online state and call the callback handler
13419
13427
  // if applicable.
13420
13428
  const t = this.storage.getItem(this.Qs);
13421
13429
  if (t) {
13422
- const e = this.Us(t);
13430
+ const e = this.Ks(t);
13423
13431
  e && this.Ws(e);
13424
13432
  }
13425
13433
  for (const e of this.Os) this.Ms(e);
@@ -13463,10 +13471,10 @@ class __PRIVATE_LocalClientState {
13463
13471
  }
13464
13472
  // If the query is listening to cache only, the target ID should not be registered with the
13465
13473
  // local Firestore client as an active watch target.
13466
- return t && this.Hs.Ds(e), this.Ks(), n;
13474
+ return t && this.Hs.Ds(e), this.Us(), n;
13467
13475
  }
13468
13476
  removeLocalQueryTarget(e) {
13469
- this.Hs.vs(e), this.Ks();
13477
+ this.Hs.vs(e), this.Us();
13470
13478
  }
13471
13479
  isLocalQueryTarget(e) {
13472
13480
  return this.Hs.activeTargetIds.has(e);
@@ -13533,7 +13541,7 @@ class __PRIVATE_LocalClientState {
13533
13541
  }
13534
13542
  } else if (t.key === this.Qs) {
13535
13543
  if (null !== t.newValue) {
13536
- const e = this.Us(t.newValue);
13544
+ const e = this.Ks(t.newValue);
13537
13545
  if (e) return this.Ws(e);
13538
13546
  }
13539
13547
  } else if (t.key === this.Bs) {
@@ -13564,7 +13572,7 @@ class __PRIVATE_LocalClientState {
13564
13572
  get Hs() {
13565
13573
  return this.xs.get(this.Cs);
13566
13574
  }
13567
- Ks() {
13575
+ Us() {
13568
13576
  this.setItem(this.Ns, this.Hs.bs());
13569
13577
  }
13570
13578
  zs(e, t, n) {
@@ -13621,7 +13629,7 @@ class __PRIVATE_LocalClientState {
13621
13629
  /**
13622
13630
  * Parses an online state from WebStorage. Returns 'null' if the value
13623
13631
  * could not be parsed.
13624
- */ Us(e) {
13632
+ */ Ks(e) {
13625
13633
  return __PRIVATE_SharedOnlineState.Ss(e);
13626
13634
  }
13627
13635
  _o(e) {
@@ -13846,7 +13854,7 @@ function __PRIVATE_generateUniqueDebugId() {
13846
13854
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13847
13855
  * See the License for the specific language governing permissions and
13848
13856
  * limitations under the License.
13849
- */ const Kt = "RestConnection", Ut = {
13857
+ */ const Ut = "RestConnection", Kt = {
13850
13858
  BatchGetDocuments: "batchGet",
13851
13859
  Commit: "commit",
13852
13860
  RunQuery: "runQuery",
@@ -13875,14 +13883,14 @@ class __PRIVATE_RestConnection {
13875
13883
  }
13876
13884
  So(e, t, n, r, i) {
13877
13885
  const s = __PRIVATE_generateUniqueDebugId(), o = this.bo(e, t.toUriEncodedString());
13878
- __PRIVATE_logDebug(Kt, `Sending RPC '${e}' ${s}:`, o, n);
13886
+ __PRIVATE_logDebug(Ut, `Sending RPC '${e}' ${s}:`, o, n);
13879
13887
  const _ = {
13880
13888
  "google-cloud-resource-prefix": this.yo,
13881
13889
  "x-goog-request-params": this.wo
13882
13890
  };
13883
- return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Kt, `Received RPC '${e}' ${s}: `, t),
13891
+ return this.Do(_, r, i), this.vo(e, o, _, n).then((t => (__PRIVATE_logDebug(Ut, `Received RPC '${e}' ${s}: `, t),
13884
13892
  t)), (t => {
13885
- throw __PRIVATE_logWarn(Kt, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13893
+ throw __PRIVATE_logWarn(Ut, `RPC '${e}' ${s} failed with error: `, t, "url: ", o, "request:", n),
13886
13894
  t;
13887
13895
  }));
13888
13896
  }
@@ -13909,7 +13917,7 @@ class __PRIVATE_RestConnection {
13909
13917
  t && t.headers.forEach(((t, n) => e[n] = t)), n && n.headers.forEach(((t, n) => e[n] = t));
13910
13918
  }
13911
13919
  bo(e, t) {
13912
- const n = Ut[e];
13920
+ const n = Kt[e];
13913
13921
  return `${this.po}/v1/${t}:${n}`;
13914
13922
  }
13915
13923
  /**
@@ -13969,10 +13977,10 @@ class __PRIVATE_RestConnection {
13969
13977
  $o() {
13970
13978
  this.Bo();
13971
13979
  }
13972
- Ko(e) {
13980
+ Uo(e) {
13973
13981
  this.ko(e);
13974
13982
  }
13975
- Uo(e) {
13983
+ Ko(e) {
13976
13984
  this.qo(e);
13977
13985
  }
13978
13986
  }
@@ -14124,10 +14132,10 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14124
14132
  h || (__PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport opened.`), P.Qo());
14125
14133
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.CLOSE, (() => {
14126
14134
  h || (h = !0, __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} transport closed`),
14127
- P.Ko());
14135
+ P.Uo());
14128
14136
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.ERROR, (t => {
14129
14137
  h || (h = !0, __PRIVATE_logWarn(Wt, `RPC '${e}' stream ${r} transport errored:`, t),
14130
- P.Ko(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14138
+ P.Uo(new FirestoreError(C.UNAVAILABLE, "The operation could not be completed")));
14131
14139
  })), __PRIVATE_unguardedEventListen(c, WebChannel.EventType.MESSAGE, (t => {
14132
14140
  var n;
14133
14141
  if (!h) {
@@ -14158,8 +14166,8 @@ class __PRIVATE_WebChannelConnection extends __PRIVATE_RestConnection {
14158
14166
  }(t), i = o.message;
14159
14167
  void 0 === n && (n = C.INTERNAL, i = "Unknown error status: " + t + " with message " + o.message),
14160
14168
  // Mark closed so no further events are propagated
14161
- h = !0, P.Ko(new FirestoreError(n, i)), c.close();
14162
- } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Uo(i);
14169
+ h = !0, P.Uo(new FirestoreError(n, i)), c.close();
14170
+ } else __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} received:`, i), P.Ko(i);
14163
14171
  }
14164
14172
  })), __PRIVATE_unguardedEventListen(o, Event.STAT_EVENT, (t => {
14165
14173
  t.stat === Stat.PROXY ? __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected buffering proxy`) : t.stat === Stat.NOPROXY && __PRIVATE_logDebug(Wt, `RPC '${e}' stream ${r} detected no buffering proxy`);
@@ -14894,7 +14902,7 @@ class __PRIVATE_RemoteStoreImpl {
14894
14902
  * purely based on order, and so we can just shift() writes from the front of
14895
14903
  * the writePipeline as we receive responses.
14896
14904
  */
14897
- this.K_ = [],
14905
+ this.U_ = [],
14898
14906
  /**
14899
14907
  * A mapping of watched targets that the client cares about tracking and the
14900
14908
  * user has explicitly called a 'listen' for this target.
@@ -14904,7 +14912,7 @@ class __PRIVATE_RemoteStoreImpl {
14904
14912
  * to the server. The targets removed with unlistens are removed eagerly
14905
14913
  * without waiting for confirmation from the listen stream.
14906
14914
  */
14907
- this.U_ = new Map,
14915
+ this.K_ = new Map,
14908
14916
  /**
14909
14917
  * A set of reasons for why the RemoteStore may be offline. If empty, the
14910
14918
  * RemoteStore may start its network connections.
@@ -14951,9 +14959,9 @@ async function __PRIVATE_enableNetworkInternal(e) {
14951
14959
  */
14952
14960
  function __PRIVATE_remoteStoreListen(e, t) {
14953
14961
  const n = __PRIVATE_debugCast(e);
14954
- n.U_.has(t.targetId) || (
14962
+ n.K_.has(t.targetId) || (
14955
14963
  // Mark this as something the client is currently listening for.
14956
- n.U_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14964
+ n.K_.set(t.targetId, t), __PRIVATE_shouldStartWatchStream(n) ?
14957
14965
  // The listen will be sent in onWatchStreamOpen
14958
14966
  __PRIVATE_startWatchStream(n) : __PRIVATE_ensureWatchStream(n).c_() && __PRIVATE_sendWatchRequest(n, t));
14959
14967
  }
@@ -14963,7 +14971,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14963
14971
  * not being listened to.
14964
14972
  */ function __PRIVATE_remoteStoreUnlisten(e, t) {
14965
14973
  const n = __PRIVATE_debugCast(e), r = __PRIVATE_ensureWatchStream(n);
14966
- n.U_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.U_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14974
+ n.K_.delete(t), r.c_() && __PRIVATE_sendUnwatchRequest(n, t), 0 === n.K_.size && (r.c_() ? r.P_() : __PRIVATE_canUseNetwork(n) &&
14967
14975
  // Revert to OnlineState.Unknown if the watch stream is not open and we
14968
14976
  // have no listeners, since without any listens to send we cannot
14969
14977
  // confirm if the stream is healthy and upgrade to OnlineState.Online.
@@ -14992,7 +15000,7 @@ function __PRIVATE_remoteStoreListen(e, t) {
14992
15000
  function __PRIVATE_startWatchStream(e) {
14993
15001
  e.H_ = new __PRIVATE_WatchChangeAggregator({
14994
15002
  getRemoteKeysForTarget: t => e.remoteSyncer.getRemoteKeysForTarget(t),
14995
- lt: t => e.U_.get(t) || null,
15003
+ lt: t => e.K_.get(t) || null,
14996
15004
  it: () => e.datastore.serializer.databaseId
14997
15005
  }), __PRIVATE_ensureWatchStream(e).start(), e.j_.B_();
14998
15006
  }
@@ -15001,7 +15009,7 @@ function __PRIVATE_startWatchStream(e) {
15001
15009
  * Returns whether the watch stream should be started because it's necessary
15002
15010
  * and has not yet been started.
15003
15011
  */ function __PRIVATE_shouldStartWatchStream(e) {
15004
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.U_.size > 0;
15012
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWatchStream(e).u_() && e.K_.size > 0;
15005
15013
  }
15006
15014
 
15007
15015
  function __PRIVATE_canUseNetwork(e) {
@@ -15018,7 +15026,7 @@ async function __PRIVATE_onWatchStreamConnected(e) {
15018
15026
  }
15019
15027
 
15020
15028
  async function __PRIVATE_onWatchStreamOpen(e) {
15021
- e.U_.forEach(((t, n) => {
15029
+ e.K_.forEach(((t, n) => {
15022
15030
  __PRIVATE_sendWatchRequest(e, t);
15023
15031
  }));
15024
15032
  }
@@ -15045,7 +15053,7 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15045
15053
  const n = t.cause;
15046
15054
  for (const r of t.targetIds)
15047
15055
  // A watched target might have been removed already.
15048
- e.U_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.U_.delete(r), e.H_.removeTarget(r));
15056
+ e.K_.has(r) && (await e.remoteSyncer.rejectListen(r, n), e.K_.delete(r), e.H_.removeTarget(r));
15049
15057
  }
15050
15058
  /**
15051
15059
  * Attempts to fill our write pipeline with writes from the LocalStore.
@@ -15075,21 +15083,21 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15075
15083
  // persistent view of these when applying the completed RemoteEvent.
15076
15084
  return n.targetChanges.forEach(((n, r) => {
15077
15085
  if (n.resumeToken.approximateByteSize() > 0) {
15078
- const i = e.U_.get(r);
15086
+ const i = e.K_.get(r);
15079
15087
  // A watched target might have been removed already.
15080
- i && e.U_.set(r, i.withResumeToken(n.resumeToken, t));
15088
+ i && e.K_.set(r, i.withResumeToken(n.resumeToken, t));
15081
15089
  }
15082
15090
  })),
15083
15091
  // Re-establish listens for the targets that have been invalidated by
15084
15092
  // existence filter mismatches.
15085
15093
  n.targetMismatches.forEach(((t, n) => {
15086
- const r = e.U_.get(t);
15094
+ const r = e.K_.get(t);
15087
15095
  if (!r)
15088
15096
  // A watched target might have been removed already.
15089
15097
  return;
15090
15098
  // Clear the resume token for the target, since we're in a known mismatch
15091
15099
  // state.
15092
- e.U_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15100
+ e.K_.set(t, r.withResumeToken(ByteString.EMPTY_BYTE_STRING, r.snapshotVersion)),
15093
15101
  // Cause a hard reset by unwatching and rewatching immediately, but
15094
15102
  // deliberately don't send a resume token so that we get a full update.
15095
15103
  __PRIVATE_sendUnwatchRequest(e, t);
@@ -15140,11 +15148,11 @@ async function __PRIVATE_onWatchStreamChange(e, t, n) {
15140
15148
 
15141
15149
  async function __PRIVATE_fillWritePipeline(e) {
15142
15150
  const t = __PRIVATE_debugCast(e), n = __PRIVATE_ensureWriteStream(t);
15143
- let r = t.K_.length > 0 ? t.K_[t.K_.length - 1].batchId : Q;
15151
+ let r = t.U_.length > 0 ? t.U_[t.U_.length - 1].batchId : Q;
15144
15152
  for (;__PRIVATE_canAddToWritePipeline(t); ) try {
15145
15153
  const e = await __PRIVATE_localStoreGetNextMutationBatch(t.localStore, r);
15146
15154
  if (null === e) {
15147
- 0 === t.K_.length && n.P_();
15155
+ 0 === t.U_.length && n.P_();
15148
15156
  break;
15149
15157
  }
15150
15158
  r = e.batchId, __PRIVATE_addToWritePipeline(t, e);
@@ -15158,20 +15166,20 @@ async function __PRIVATE_fillWritePipeline(e) {
15158
15166
  * Returns true if we can add to the write pipeline (i.e. the network is
15159
15167
  * enabled and the write pipeline is not full).
15160
15168
  */ function __PRIVATE_canAddToWritePipeline(e) {
15161
- return __PRIVATE_canUseNetwork(e) && e.K_.length < 10;
15169
+ return __PRIVATE_canUseNetwork(e) && e.U_.length < 10;
15162
15170
  }
15163
15171
 
15164
15172
  /**
15165
15173
  * Queues additional writes to be sent to the write stream, sending them
15166
15174
  * immediately if the write stream is established.
15167
15175
  */ function __PRIVATE_addToWritePipeline(e, t) {
15168
- e.K_.push(t);
15176
+ e.U_.push(t);
15169
15177
  const n = __PRIVATE_ensureWriteStream(e);
15170
15178
  n.c_() && n.S_ && n.b_(t.mutations);
15171
15179
  }
15172
15180
 
15173
15181
  function __PRIVATE_shouldStartWriteStream(e) {
15174
- return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.K_.length > 0;
15182
+ return __PRIVATE_canUseNetwork(e) && !__PRIVATE_ensureWriteStream(e).u_() && e.U_.length > 0;
15175
15183
  }
15176
15184
 
15177
15185
  function __PRIVATE_startWriteStream(e) {
@@ -15185,11 +15193,11 @@ async function __PRIVATE_onWriteStreamOpen(e) {
15185
15193
  async function __PRIVATE_onWriteHandshakeComplete(e) {
15186
15194
  const t = __PRIVATE_ensureWriteStream(e);
15187
15195
  // Send the write pipeline now that the stream is established.
15188
- for (const n of e.K_) t.b_(n.mutations);
15196
+ for (const n of e.U_) t.b_(n.mutations);
15189
15197
  }
15190
15198
 
15191
15199
  async function __PRIVATE_onMutationResult(e, t, n) {
15192
- const r = e.K_.shift(), i = MutationBatchResult.from(r, t, n);
15200
+ const r = e.U_.shift(), i = MutationBatchResult.from(r, t, n);
15193
15201
  await __PRIVATE_executeWithRecovery(e, (() => e.remoteSyncer.applySuccessfulWrite(i))),
15194
15202
  // It's possible that with the completion of this mutation another
15195
15203
  // slot has freed up.
@@ -15209,7 +15217,7 @@ async function __PRIVATE_onWriteStreamClose(e, t) {
15209
15217
  }(t.code)) {
15210
15218
  // This was a permanent error, the request itself was the problem
15211
15219
  // so it's not going to succeed if we resend it.
15212
- const n = e.K_.shift();
15220
+ const n = e.U_.shift();
15213
15221
  // In this case it's also unlikely that the server itself is melting
15214
15222
  // down -- this was just a bad request so inhibit backoff on the next
15215
15223
  // restart.
@@ -15308,8 +15316,8 @@ async function __PRIVATE_remoteStoreHandleCredentialChange(e, t) {
15308
15316
  }), e.G_.push((async t => {
15309
15317
  t ? (e.Y_.h_(),
15310
15318
  // This will start the write stream if necessary.
15311
- await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.K_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.K_.length} pending writes`),
15312
- e.K_ = []));
15319
+ await __PRIVATE_fillWritePipeline(e)) : (await e.Y_.stop(), e.U_.length > 0 && (__PRIVATE_logDebug(zt, `Stopping write stream with ${e.U_.length} pending writes`),
15320
+ e.U_ = []));
15313
15321
  }))), e.Y_;
15314
15322
  }
15315
15323
 
@@ -16323,11 +16331,11 @@ const Jt = "SyncEngine";
16323
16331
  * Keeps track of the information about an active limbo resolution for each
16324
16332
  * active target ID that was started for the purpose of limbo resolution.
16325
16333
  */
16326
- this.Ka = new Map, this.Ua = new __PRIVATE_ReferenceSet,
16334
+ this.Ua = new Map, this.Ka = new __PRIVATE_ReferenceSet,
16327
16335
  /** Stores user completion handlers, indexed by User and BatchId. */
16328
16336
  this.Wa = {},
16329
16337
  /** Stores user callbacks waiting for all pending writes to be acknowledged. */
16330
- this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Un(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16338
+ this.Ga = new Map, this.za = __PRIVATE_TargetIdGenerator.Kn(), this.onlineState = "Unknown" /* OnlineState.Unknown */ ,
16331
16339
  // The primary state is set to `true` or `false` immediately after Firestore
16332
16340
  // startup. In the interim, a client should only be considered primary if
16333
16341
  // `isPrimary` is true.
@@ -16507,7 +16515,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16507
16515
  const e = await __PRIVATE_localStoreApplyRemoteEventToLocalCache(n.localStore, t);
16508
16516
  // Update `receivedDocument` as appropriate for any limbo targets.
16509
16517
  t.targetChanges.forEach(((e, t) => {
16510
- const r = n.Ka.get(t);
16518
+ const r = n.Ua.get(t);
16511
16519
  r && (
16512
16520
  // Since this is a limbo resolution lookup, it's for a single document
16513
16521
  // and it could be added, modified, or removed, but not a combination.
@@ -16561,7 +16569,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16561
16569
  const r = __PRIVATE_debugCast(e);
16562
16570
  // PORTING NOTE: Multi-tab only.
16563
16571
  r.sharedClientState.updateQueryState(t, "rejected", n);
16564
- const i = r.Ka.get(t), s = i && i.key;
16572
+ const i = r.Ua.get(t), s = i && i.key;
16565
16573
  if (s) {
16566
16574
  // TODO(klimt): We really only should do the following on permission
16567
16575
  // denied errors, but we don't have the cause code here.
@@ -16583,7 +16591,7 @@ async function __PRIVATE_allocateTargetAndMaybeListen(e, t, n, r) {
16583
16591
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
16584
16592
  // this query when the RemoteStore restarts the Watch stream, which should
16585
16593
  // re-trigger the target failure.
16586
- r.$a = r.$a.remove(s), r.Ka.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16594
+ r.$a = r.$a.remove(s), r.Ua.delete(t), __PRIVATE_pumpEnqueuedLimboResolutions(r);
16587
16595
  } else await __PRIVATE_localStoreReleaseTarget(r.localStore, t,
16588
16596
  /* keepPersistedTargetData */ !1).then((() => __PRIVATE_removeAndCleanupTarget(r, t, n))).catch(__PRIVATE_ignoreIfPrimaryLeaseLoss);
16589
16597
  }
@@ -16677,8 +16685,8 @@ function __PRIVATE_removeAndCleanupTarget(e, t, n = null) {
16677
16685
  e.sharedClientState.removeLocalQueryTarget(t);
16678
16686
  for (const r of e.qa.get(t)) e.ka.delete(r), n && e.La.Ja(r, n);
16679
16687
  if (e.qa.delete(t), e.isPrimaryClient) {
16680
- e.Ua.br(t).forEach((t => {
16681
- e.Ua.containsKey(t) ||
16688
+ e.Ka.br(t).forEach((t => {
16689
+ e.Ka.containsKey(t) ||
16682
16690
  // We removed the last reference for this key
16683
16691
  __PRIVATE_removeLimboTarget(e, t);
16684
16692
  }));
@@ -16691,14 +16699,14 @@ function __PRIVATE_removeLimboTarget(e, t) {
16691
16699
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
16692
16700
  const n = e.$a.get(t);
16693
16701
  null !== n && (__PRIVATE_remoteStoreUnlisten(e.remoteStore, n), e.$a = e.$a.remove(t),
16694
- e.Ka.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16702
+ e.Ua.delete(n), __PRIVATE_pumpEnqueuedLimboResolutions(e));
16695
16703
  }
16696
16704
 
16697
16705
  function __PRIVATE_updateTrackedLimbos(e, t, n) {
16698
- for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ua.addReference(r.key, t),
16706
+ for (const r of n) if (r instanceof __PRIVATE_AddedLimboDocument) e.Ka.addReference(r.key, t),
16699
16707
  __PRIVATE_trackLimboChange(e, r); else if (r instanceof __PRIVATE_RemovedLimboDocument) {
16700
- __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ua.removeReference(r.key, t);
16701
- e.Ua.containsKey(r.key) ||
16708
+ __PRIVATE_logDebug(Jt, "Document no longer in limbo: " + r.key), e.Ka.removeReference(r.key, t);
16709
+ e.Ka.containsKey(r.key) ||
16702
16710
  // We removed the last reference for this key
16703
16711
  __PRIVATE_removeLimboTarget(e, r.key);
16704
16712
  } else fail();
@@ -16722,7 +16730,7 @@ function __PRIVATE_trackLimboChange(e, t) {
16722
16730
  const t = e.Qa.values().next().value;
16723
16731
  e.Qa.delete(t);
16724
16732
  const n = new DocumentKey(ResourcePath.fromString(t)), r = e.za.next();
16725
- 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));
16733
+ 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));
16726
16734
  }
16727
16735
  }
16728
16736
 
@@ -16790,7 +16798,7 @@ async function __PRIVATE_syncEngineHandleCredentialChange(e, t) {
16790
16798
  }
16791
16799
 
16792
16800
  function __PRIVATE_syncEngineGetRemoteKeysForTarget(e, t) {
16793
- const n = __PRIVATE_debugCast(e), r = n.Ka.get(t);
16801
+ const n = __PRIVATE_debugCast(e), r = n.Ua.get(t);
16794
16802
  if (r && r.Ba) return __PRIVATE_documentKeySet().add(r.key);
16795
16803
  {
16796
16804
  let e = __PRIVATE_documentKeySet();
@@ -16882,9 +16890,9 @@ async function __PRIVATE_syncEngineApplyPrimaryState(e, t) {
16882
16890
  // PORTING NOTE: Multi-Tab only.
16883
16891
  function __PRIVATE_resetLimboDocuments(e) {
16884
16892
  const t = __PRIVATE_debugCast(e);
16885
- t.Ka.forEach(((e, n) => {
16893
+ t.Ua.forEach(((e, n) => {
16886
16894
  __PRIVATE_remoteStoreUnlisten(t.remoteStore, n);
16887
- })), t.Ua.Dr(), t.Ka = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16895
+ })), t.Ka.Dr(), t.Ua = new Map, t.$a = new SortedMap(DocumentKey.comparator);
16888
16896
  }
16889
16897
  /**
16890
16898
  * Reconcile the query views of the provided query targets with the state from
@@ -19743,7 +19751,7 @@ function __PRIVATE_isWrite(e) {
19743
19751
  });
19744
19752
  return r.$u(e), r;
19745
19753
  }
19746
- Ku(e) {
19754
+ Uu(e) {
19747
19755
  var t;
19748
19756
  const n = null === (t = this.path) || void 0 === t ? void 0 : t.child(e), r = this.ku({
19749
19757
  path: n,
@@ -19751,7 +19759,7 @@ function __PRIVATE_isWrite(e) {
19751
19759
  });
19752
19760
  return r.Bu(), r;
19753
19761
  }
19754
- Uu(e) {
19762
+ Ku(e) {
19755
19763
  // TODO(b/34871131): We don't support array paths right now; so make path
19756
19764
  // undefined.
19757
19765
  return this.ku({
@@ -19912,7 +19920,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19912
19920
  // For Compat types, we have to "extract" the underlying types before
19913
19921
  // performing validation.
19914
19922
  r = getModularInstance(r);
19915
- const a = i.Ku(_);
19923
+ const a = i.Uu(_);
19916
19924
  if (r instanceof __PRIVATE_DeleteFieldValueImpl)
19917
19925
  // Add it to the field mask, but don't add anything to updateData.
19918
19926
  s.push(_); else {
@@ -19938,7 +19946,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
19938
19946
  // For Compat types, we have to "extract" the underlying types before
19939
19947
  // performing validation.
19940
19948
  n = getModularInstance(n);
19941
- const r = o.Ku(t);
19949
+ const r = o.Uu(t);
19942
19950
  if (n instanceof __PRIVATE_DeleteFieldValueImpl)
19943
19951
  // Add it to the field mask, but don't add anything to updateData.
19944
19952
  u.push(t); else {
@@ -20016,7 +20024,7 @@ class __PRIVATE_NumericIncrementFieldValueImpl extends FieldValue {
20016
20024
  const n = [];
20017
20025
  let r = 0;
20018
20026
  for (const i of e) {
20019
- let e = __PRIVATE_parseData(i, t.Uu(r));
20027
+ let e = __PRIVATE_parseData(i, t.Ku(r));
20020
20028
  null == e && (
20021
20029
  // Just include nulls in the array for fields being replaced with a
20022
20030
  // sentinel.