@firebase/firestore 3.6.0 → 3.7.0-20221010190246

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/firestore/src/core/view.d.ts +1 -0
  3. package/dist/firestore/src/core/view_snapshot.d.ts +3 -2
  4. package/dist/firestore/src/remote/remote_event.d.ts +2 -2
  5. package/dist/firestore/test/util/api_helpers.d.ts +1 -1
  6. package/dist/index.esm2017.js +38 -36
  7. package/dist/index.esm2017.js.map +1 -1
  8. package/dist/index.esm5.js +132 -130
  9. package/dist/index.esm5.js.map +1 -1
  10. package/dist/index.node.cjs.js +29 -21
  11. package/dist/index.node.cjs.js.map +1 -1
  12. package/dist/index.node.mjs +29 -21
  13. package/dist/index.node.mjs.map +1 -1
  14. package/dist/index.rn.js +38 -36
  15. package/dist/index.rn.js.map +1 -1
  16. package/dist/internal.d.ts +5 -4
  17. package/dist/lite/firestore/src/core/view.d.ts +1 -0
  18. package/dist/lite/firestore/src/core/view_snapshot.d.ts +3 -2
  19. package/dist/lite/firestore/src/remote/remote_event.d.ts +2 -2
  20. package/dist/lite/firestore/test/util/api_helpers.d.ts +1 -1
  21. package/dist/lite/index.browser.esm2017.js +2 -2
  22. package/dist/lite/index.browser.esm2017.js.map +1 -1
  23. package/dist/lite/index.browser.esm5.js +2 -2
  24. package/dist/lite/index.browser.esm5.js.map +1 -1
  25. package/dist/lite/index.node.cjs.js +2 -2
  26. package/dist/lite/index.node.mjs +2 -2
  27. package/dist/lite/index.node.mjs.map +1 -1
  28. package/dist/lite/index.rn.esm2017.js +2 -2
  29. package/dist/lite/index.rn.esm2017.js.map +1 -1
  30. package/dist/lite/packages/firestore/src/core/view.d.ts +1 -0
  31. package/dist/lite/packages/firestore/src/core/view_snapshot.d.ts +3 -2
  32. package/dist/lite/packages/firestore/src/remote/remote_event.d.ts +2 -2
  33. package/dist/lite/packages/firestore/test/util/api_helpers.d.ts +1 -1
  34. package/dist/packages/firestore/src/core/view.d.ts +1 -0
  35. package/dist/packages/firestore/src/core/view_snapshot.d.ts +3 -2
  36. package/dist/packages/firestore/src/remote/remote_event.d.ts +2 -2
  37. package/dist/packages/firestore/test/util/api_helpers.d.ts +1 -1
  38. package/dist/private.d.ts +5 -4
  39. package/package.json +8 -8
@@ -70,7 +70,7 @@ C.MOCK_USER = new C("mock-user");
70
70
  * See the License for the specific language governing permissions and
71
71
  * limitations under the License.
72
72
  */
73
- var k = "9.11.0", O = new l("@firebase/firestore");
73
+ var k = "9.12.0-20221010190246", O = new l("@firebase/firestore");
74
74
 
75
75
  /**
76
76
  * @license
@@ -89,7 +89,7 @@ var k = "9.11.0", O = new l("@firebase/firestore");
89
89
  * limitations under the License.
90
90
  */
91
91
  // Helper methods are needed because variables can't be exported as read/write
92
- function V() {
92
+ function R() {
93
93
  return O.logLevel;
94
94
  }
95
95
 
@@ -105,7 +105,7 @@ function V() {
105
105
  * <li>`error` to log errors only.</li>
106
106
  * <li><code>`silent` to turn off logging.</li>
107
107
  * </ul>
108
- */ function R(t) {
108
+ */ function V(t) {
109
109
  O.setLogLevel(t);
110
110
  }
111
111
 
@@ -1458,7 +1458,7 @@ function _t(t) {
1458
1458
  */
1459
1459
  t.prototype.store = function(t) {
1460
1460
  var e = this.transaction.objectStore(t);
1461
- return new Vt(e);
1461
+ return new Rt(e);
1462
1462
  }, t;
1463
1463
  }(), At = /** @class */ function() {
1464
1464
  /*
@@ -1479,7 +1479,7 @@ function _t(t) {
1479
1479
  12.2 === t.D(d()) && M("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");
1480
1480
  }
1481
1481
  /** Deletes the specified database. */ return t.delete = function(t) {
1482
- return L("SimpleDb", "Removing database:", t), Rt(window.indexedDB.deleteDatabase(t)).toPromise();
1482
+ return L("SimpleDb", "Removing database:", t), Vt(window.indexedDB.deleteDatabase(t)).toPromise();
1483
1483
  },
1484
1484
  /** Returns true if IndexedDB is available in the current environment. */ t.C = function() {
1485
1485
  if (!w()) return !1;
@@ -1684,7 +1684,7 @@ function _t(t) {
1684
1684
  * NOTE: You CANNOT do this with a keysOnly query.
1685
1685
  */
1686
1686
  t.prototype.delete = function() {
1687
- return Rt(this.U.delete());
1687
+ return Vt(this.U.delete());
1688
1688
  }, t;
1689
1689
  }(), kt = /** @class */ function(e) {
1690
1690
  function n(t, n) {
@@ -1732,14 +1732,14 @@ function _t(t) {
1732
1732
  * method return a PersistencePromise instead.
1733
1733
  * 3) Provides a higher-level API to avoid needing to do excessive wrapping of
1734
1734
  * intermediate IndexedDB types (IDBCursorWithValue, etc.)
1735
- */ var Vt = /** @class */ function() {
1735
+ */ var Rt = /** @class */ function() {
1736
1736
  function t(t) {
1737
1737
  this.store = t;
1738
1738
  }
1739
1739
  return t.prototype.put = function(t, e) {
1740
1740
  var n;
1741
1741
  return void 0 !== e ? (L("SimpleDb", "PUT", this.store.name, t, e), n = this.store.put(e, t)) : (L("SimpleDb", "PUT", this.store.name, "<auto-key>", t),
1742
- n = this.store.put(t)), Rt(n);
1742
+ n = this.store.put(t)), Vt(n);
1743
1743
  },
1744
1744
  /**
1745
1745
  * Adds a new value into an Object Store and returns the new key. Similar to
@@ -1749,7 +1749,7 @@ function _t(t) {
1749
1749
  * @returns The key of the value to add.
1750
1750
  */
1751
1751
  t.prototype.add = function(t) {
1752
- return L("SimpleDb", "ADD", this.store.name, t, t), Rt(this.store.add(t));
1752
+ return L("SimpleDb", "ADD", this.store.name, t, t), Vt(this.store.add(t));
1753
1753
  },
1754
1754
  /**
1755
1755
  * Gets the object with the specified key from the specified store, or null
@@ -1762,12 +1762,12 @@ function _t(t) {
1762
1762
  var e = this;
1763
1763
  // We're doing an unsafe cast to ValueType.
1764
1764
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1765
- return Rt(this.store.get(t)).next((function(n) {
1765
+ return Vt(this.store.get(t)).next((function(n) {
1766
1766
  // Normalize nonexistence to null.
1767
1767
  return void 0 === n && (n = null), L("SimpleDb", "GET", e.store.name, t, n), n;
1768
1768
  }));
1769
1769
  }, t.prototype.delete = function(t) {
1770
- return L("SimpleDb", "DELETE", this.store.name, t), Rt(this.store.delete(t));
1770
+ return L("SimpleDb", "DELETE", this.store.name, t), Vt(this.store.delete(t));
1771
1771
  },
1772
1772
  /**
1773
1773
  * If we ever need more of the count variants, we can add overloads. For now,
@@ -1776,7 +1776,7 @@ function _t(t) {
1776
1776
  * Returns the number of rows in the store.
1777
1777
  */
1778
1778
  t.prototype.count = function() {
1779
- return L("SimpleDb", "COUNT", this.store.name), Rt(this.store.count());
1779
+ return L("SimpleDb", "COUNT", this.store.name), Vt(this.store.count());
1780
1780
  }, t.prototype.W = function(t, e) {
1781
1781
  var n = this.options(t, e);
1782
1782
  // Use `getAll()` if the browser supports IndexedDB v3, as it is roughly
@@ -1886,7 +1886,7 @@ function _t(t) {
1886
1886
  /**
1887
1887
  * Wraps an IDBRequest in a PersistencePromise, using the onsuccess / onerror
1888
1888
  * handlers to resolve / reject the PersistencePromise as appropriate.
1889
- */ function Rt(t) {
1889
+ */ function Vt(t) {
1890
1890
  return new xt((function(e, n) {
1891
1891
  t.onsuccess = function(t) {
1892
1892
  var n = t.target.result;
@@ -3389,7 +3389,7 @@ function Ce(t, e) {
3389
3389
  */;
3390
3390
  }
3391
3391
 
3392
- var Ve = /** @class */ function() {
3392
+ var Re = /** @class */ function() {
3393
3393
  function t(t, e, n, r, i, o) {
3394
3394
  this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = i,
3395
3395
  this.documentState = o
@@ -3483,7 +3483,7 @@ var Ve = /** @class */ function() {
3483
3483
  }, t.prototype.toString = function() {
3484
3484
  return "Document(" + this.key + ", " + this.version + ", " + JSON.stringify(this.data.value) + ", {documentType: " + this.documentType + "}), {documentState: " + this.documentState + "})";
3485
3485
  }, t;
3486
- }(), Re = function(t, e, n, r, i, o, u) {
3486
+ }(), Ve = function(t, e, n, r, i, o, u) {
3487
3487
  void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
3488
3488
  void 0 === i && (i = null), void 0 === o && (o = null), void 0 === u && (u = null),
3489
3489
  this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i,
@@ -3522,7 +3522,7 @@ var Ve = /** @class */ function() {
3522
3522
  function Le(t, e, n, r, i, o, u) {
3523
3523
  return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
3524
3524
  void 0 === i && (i = null), void 0 === o && (o = null), void 0 === u && (u = null),
3525
- new Re(t, e, n, r, i, o, u);
3525
+ new Ve(t, e, n, r, i, o, u);
3526
3526
  }
3527
3527
 
3528
3528
  function Me(t) {
@@ -4164,7 +4164,7 @@ function wn(t, e, n) {
4164
4164
  // PORTING NOTE: Since JavaScript's integer arithmetic is limited to 53 bit
4165
4165
  // precision and resolves overflows by reducing precision, we do not
4166
4166
  // manually cap overflows at 2^63.
4167
- var n = _n(t, e), r = Vn(n) + Vn(t.yt);
4167
+ var n = _n(t, e), r = Rn(n) + Rn(t.yt);
4168
4168
  return be(n) && be(t.yt) ? In(r) : bn(t.It, r);
4169
4169
  }(t, e);
4170
4170
  }
@@ -4216,7 +4216,7 @@ function wn(t, e, n) {
4216
4216
  }(Tn);
4217
4217
 
4218
4218
  /** Transforms an array value via a union operation. */ function An(t, e) {
4219
- for (var n = Rn(e), r = function(t) {
4219
+ for (var n = Vn(e), r = function(t) {
4220
4220
  n.some((function(e) {
4221
4221
  return de(e, t);
4222
4222
  })) || n.push(t);
@@ -4239,7 +4239,7 @@ function wn(t, e, n) {
4239
4239
  }(Tn);
4240
4240
 
4241
4241
  function kn(t, e) {
4242
- for (var n = Rn(e), r = function(t) {
4242
+ for (var n = Vn(e), r = function(t) {
4243
4243
  n = n.filter((function(e) {
4244
4244
  return !de(e, t);
4245
4245
  }));
@@ -4266,11 +4266,11 @@ function kn(t, e) {
4266
4266
  return t(n, e), n;
4267
4267
  }(Tn);
4268
4268
 
4269
- function Vn(t) {
4269
+ function Rn(t) {
4270
4270
  return te(t.integerValue || t.doubleValue);
4271
4271
  }
4272
4272
 
4273
- function Rn(t) {
4273
+ function Vn(t) {
4274
4274
  return Ie(t) && t.arrayValue.values ? t.arrayValue.values.slice() : [];
4275
4275
  }
4276
4276
 
@@ -4956,9 +4956,9 @@ function yr() {
4956
4956
  * CURRENT status change to a View, for queries executed in a different tab.
4957
4957
  */
4958
4958
  // PORTING NOTE: Multi-tab only
4959
- return t.createSynthesizedRemoteEventForCurrentChange = function(e, n) {
4960
- var r = new Map;
4961
- return r.set(e, gr.createSynthesizedTargetChangeForCurrentChange(e, n)), new t(st.min(), r, yr(), or(), pr());
4959
+ return t.createSynthesizedRemoteEventForCurrentChange = function(e, n, r) {
4960
+ var i = new Map;
4961
+ return i.set(e, gr.createSynthesizedTargetChangeForCurrentChange(e, n, r)), new t(st.min(), i, yr(), or(), pr());
4962
4962
  }, t;
4963
4963
  }(), gr = /** @class */ function() {
4964
4964
  function t(
@@ -4998,8 +4998,8 @@ function yr() {
4998
4998
  * tab) or for new queries (to raise snapshots with correct CURRENT status).
4999
4999
  */;
5000
5000
  }
5001
- return t.createSynthesizedTargetChangeForCurrentChange = function(e, n) {
5002
- return new t(Zt.EMPTY_BYTE_STRING, n, pr(), pr(), pr());
5001
+ return t.createSynthesizedTargetChangeForCurrentChange = function(e, n, r) {
5002
+ return new t(r, n, pr(), pr(), pr());
5003
5003
  }, t;
5004
5004
  }(), wr = function(
5005
5005
  /** The new document applies to all of these targets. */
@@ -5238,7 +5238,7 @@ n
5238
5238
  // until it is resolved, essentially exposing inconsistency between
5239
5239
  // queries.
5240
5240
  var o = new ft(i.path);
5241
- this.jt(e, o, Ve.newNoDocument(o, st.min()));
5241
+ this.jt(e, o, Re.newNoDocument(o, st.min()));
5242
5242
  } else U(1 === n); else this.Zt(e) !== n && (
5243
5243
  // Existence filter mismatch: We reset the mapping and raise a new
5244
5244
  // snapshot with `isFromCache:true`.
@@ -5264,7 +5264,7 @@ n
5264
5264
  // instead resulting in an explicit delete message and we could
5265
5265
  // remove this special logic.
5266
5266
  var u = new ft(o.target.path);
5267
- null !== e.Ut.get(u) || e.ee(i, u) || e.jt(i, u, Ve.newNoDocument(u, t));
5267
+ null !== e.Ut.get(u) || e.ee(i, u) || e.jt(i, u, Re.newNoDocument(u, t));
5268
5268
  }
5269
5269
  r.Dt && (n.set(i, r.xt()), r.Nt());
5270
5270
  }
@@ -5468,34 +5468,34 @@ function Or(t) {
5468
5468
  }(t));
5469
5469
  }
5470
5470
 
5471
- function Vr(t, e) {
5471
+ function Rr(t, e) {
5472
5472
  return function(t) {
5473
5473
  return new ct([ "projects", t.projectId, "databases", t.database ]);
5474
5474
  }(t).child("documents").child(e).canonicalString();
5475
5475
  }
5476
5476
 
5477
- function Rr(t) {
5477
+ function Vr(t) {
5478
5478
  var e = ct.fromString(t);
5479
5479
  return U(ni(e)), e;
5480
5480
  }
5481
5481
 
5482
5482
  function Lr(t, e) {
5483
- return Vr(t.databaseId, e.path);
5483
+ return Rr(t.databaseId, e.path);
5484
5484
  }
5485
5485
 
5486
5486
  function Mr(t, e) {
5487
- var n = Rr(e);
5487
+ var n = Vr(e);
5488
5488
  if (n.get(1) !== t.databaseId.projectId) throw new j(K.INVALID_ARGUMENT, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
5489
5489
  if (n.get(3) !== t.databaseId.database) throw new j(K.INVALID_ARGUMENT, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
5490
5490
  return new ft(Ur(n));
5491
5491
  }
5492
5492
 
5493
5493
  function Pr(t, e) {
5494
- return Vr(t.databaseId, e);
5494
+ return Rr(t.databaseId, e);
5495
5495
  }
5496
5496
 
5497
5497
  function Fr(t) {
5498
- var e = Rr(t);
5498
+ var e = Vr(t);
5499
5499
  // In v1beta1 queries for collections at the root did not have a trailing
5500
5500
  // "/documents". In v1 all resource paths contain "/documents". Preserve the
5501
5501
  // ability to read the v1beta1 form for compatibility with queries persisted
@@ -5524,7 +5524,7 @@ function Gr(t, e, n) {
5524
5524
  mapValue: {
5525
5525
  fields: e.fields
5526
5526
  }
5527
- }), u = Ve.newFoundDocument(r, i, o);
5527
+ }), u = Re.newFoundDocument(r, i, o);
5528
5528
  return n && u.setHasCommittedMutations(), n ? u.setHasCommittedMutations() : u;
5529
5529
  }
5530
5530
 
@@ -6148,7 +6148,7 @@ function ni(t) {
6148
6148
  return jn(t, e);
6149
6149
  }));
6150
6150
  }, t;
6151
- }(), Vi = /** @class */ function() {
6151
+ }(), Ri = /** @class */ function() {
6152
6152
  function t(t, e, n,
6153
6153
  /**
6154
6154
  * A pre-computed mapping from each mutated document to the resulting
@@ -6167,7 +6167,7 @@ function ni(t) {
6167
6167
  for (var i = fr, o = e.mutations, u = 0; u < o.length; u++) i = i.insert(o[u].key, r[u].version);
6168
6168
  return new t(e, n, r, i);
6169
6169
  }, t;
6170
- }(), Ri = /** @class */ function() {
6170
+ }(), Vi = /** @class */ function() {
6171
6171
  function t(t, e) {
6172
6172
  this.largestBatchId = t, this.mutation = e;
6173
6173
  }
@@ -6345,7 +6345,7 @@ function Ki(t, e) {
6345
6345
 
6346
6346
  /** Encodes a NamedQuery proto object to a NamedQuery model object. */
6347
6347
  /** Encodes a DbDocumentOverlay object to an Overlay model object. */ function Qi(t, e) {
6348
- return new Ri(e.largestBatchId, jr(t.re, e.overlayMutation));
6348
+ return new Vi(e.largestBatchId, jr(t.re, e.overlayMutation));
6349
6349
  }
6350
6350
 
6351
6351
  /** Decodes an Overlay model object into a DbDocumentOverlay object. */
@@ -6478,7 +6478,7 @@ function Wi(t, e, n, r) {
6478
6478
  }, t.prototype.saveOverlays = function(t, e, n) {
6479
6479
  var r = this, i = [];
6480
6480
  return n.forEach((function(n, o) {
6481
- var u = new Ri(e, o);
6481
+ var u = new Vi(e, o);
6482
6482
  i.push(r.ue(t, u));
6483
6483
  })), xt.waitFor(i);
6484
6484
  }, t.prototype.removeOverlaysForBatchId = function(t, e, n) {
@@ -8119,7 +8119,7 @@ var So = /** @class */ function() {
8119
8119
  return i;
8120
8120
  }));
8121
8121
  }, t.prototype.addMatchingKeys = function(t, e, n) {
8122
- var r = this, i = [], o = Vo(t);
8122
+ var r = this, i = [], o = Ro(t);
8123
8123
  // PORTING NOTE: The reverse index (documentsTargets) is maintained by
8124
8124
  // IndexedDb.
8125
8125
  return e.forEach((function(e) {
@@ -8130,7 +8130,7 @@ var So = /** @class */ function() {
8130
8130
  })), i.push(r.referenceDelegate.addReference(t, n, e));
8131
8131
  })), xt.waitFor(i);
8132
8132
  }, t.prototype.removeMatchingKeys = function(t, e, n) {
8133
- var r = this, i = Vo(t);
8133
+ var r = this, i = Ro(t);
8134
8134
  // PORTING NOTE: The reverse index (documentsTargets) is maintained by
8135
8135
  // IndexedDb.
8136
8136
  return xt.forEach(e, (function(e) {
@@ -8138,14 +8138,14 @@ var So = /** @class */ function() {
8138
8138
  return xt.waitFor([ i.delete([ n, o ]), r.referenceDelegate.removeReference(t, n, e) ]);
8139
8139
  }));
8140
8140
  }, t.prototype.removeMatchingKeysForTargetId = function(t, e) {
8141
- var n = Vo(t), r = IDBKeyRange.bound([ e ], [ e + 1 ],
8141
+ var n = Ro(t), r = IDBKeyRange.bound([ e ], [ e + 1 ],
8142
8142
  /*lowerOpen=*/ !1,
8143
8143
  /*upperOpen=*/ !0);
8144
8144
  return n.delete(r);
8145
8145
  }, t.prototype.getMatchingKeysForTargetId = function(t, e) {
8146
8146
  var n = IDBKeyRange.bound([ e ], [ e + 1 ],
8147
8147
  /*lowerOpen=*/ !1,
8148
- /*upperOpen=*/ !0), r = Vo(t), i = pr();
8148
+ /*upperOpen=*/ !0), r = Ro(t), i = pr();
8149
8149
  return r.Z({
8150
8150
  range: n,
8151
8151
  X: !0
@@ -8159,7 +8159,7 @@ var So = /** @class */ function() {
8159
8159
  var n = ri(e.path), r = IDBKeyRange.bound([ n ], [ ot(n) ],
8160
8160
  /*lowerOpen=*/ !1,
8161
8161
  /*upperOpen=*/ !0), i = 0;
8162
- return Vo(t).Z({
8162
+ return Ro(t).Z({
8163
8163
  index: "documentTargetsIndex",
8164
8164
  X: !0,
8165
8165
  range: r
@@ -8220,7 +8220,7 @@ function ko(t) {
8220
8220
 
8221
8221
  /**
8222
8222
  * Helper to get a typed SimpleDbStore for the document target object store.
8223
- */ function Vo(t) {
8223
+ */ function Ro(t) {
8224
8224
  return ki(t, "targetDocuments");
8225
8225
  }
8226
8226
 
@@ -8239,7 +8239,7 @@ function ko(t) {
8239
8239
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8240
8240
  * See the License for the specific language governing permissions and
8241
8241
  * limitations under the License.
8242
- */ function Ro(t, e) {
8242
+ */ function Vo(t, e) {
8243
8243
  var n = t[0], r = t[1], i = e[0], o = e[1], u = rt(n, i);
8244
8244
  return 0 === u ? rt(r, o) : u;
8245
8245
  }
@@ -8250,7 +8250,7 @@ function ko(t) {
8250
8250
  * them in `maxValue`.
8251
8251
  */ var Lo = /** @class */ function() {
8252
8252
  function t(t) {
8253
- this.xn = t, this.buffer = new zt(Ro), this.Nn = 0;
8253
+ this.xn = t, this.buffer = new zt(Vo), this.Nn = 0;
8254
8254
  }
8255
8255
  return t.prototype.kn = function() {
8256
8256
  return ++this.Nn;
@@ -8258,7 +8258,7 @@ function ko(t) {
8258
8258
  var e = [ t, this.kn() ];
8259
8259
  if (this.buffer.size < this.xn) this.buffer = this.buffer.add(e); else {
8260
8260
  var n = this.buffer.last();
8261
- Ro(e, n) < 0 && (this.buffer = this.buffer.delete(n).add(e));
8261
+ Vo(e, n) < 0 && (this.buffer = this.buffer.delete(n).add(e));
8262
8262
  }
8263
8263
  }, Object.defineProperty(t.prototype, "maxValue", {
8264
8264
  get: function() {
@@ -8371,7 +8371,7 @@ function ko(t) {
8371
8371
  })).next((function(e) {
8372
8372
  return i = e, s = Date.now(), c.removeOrphanedDocuments(t, n);
8373
8373
  })).next((function(t) {
8374
- return a = Date.now(), V() <= h.DEBUG && L("LruGarbageCollector", "LRU Garbage Collection\n\tCounted targets in " + (o - l) + "ms\n\tDetermined least recently used " + r + " in " + (u - o) + "ms\n\tRemoved " + i + " targets in " + (s - u) + "ms\n\tRemoved " + t + " documents in " + (a - s) + "ms\nTotal Duration: " + (a - l) + "ms"),
8374
+ return a = Date.now(), R() <= h.DEBUG && L("LruGarbageCollector", "LRU Garbage Collection\n\tCounted targets in " + (o - l) + "ms\n\tDetermined least recently used " + r + " in " + (u - o) + "ms\n\tRemoved " + i + " targets in " + (s - u) + "ms\n\tRemoved " + t + " documents in " + (a - s) + "ms\nTotal Duration: " + (a - l) + "ms"),
8375
8375
  xt.resolve({
8376
8376
  didRun: !0,
8377
8377
  sequenceNumbersCollected: r,
@@ -8441,7 +8441,7 @@ function ko(t) {
8441
8441
  // Our size accounting requires us to read all documents before
8442
8442
  // removing them.
8443
8443
  return o++, r.getEntry(t, u).next((function() {
8444
- return r.removeEntry(u, st.min()), Vo(t).delete([ 0, ri(u.path) ]);
8444
+ return r.removeEntry(u, st.min()), Ro(t).delete([ 0, ri(u.path) ]);
8445
8445
  }));
8446
8446
  }));
8447
8447
  i.push(a);
@@ -8466,7 +8466,7 @@ function ko(t) {
8466
8466
  * number for the last time the document was accessed.
8467
8467
  */
8468
8468
  t.prototype.Kn = function(t, e) {
8469
- var n, r = Vo(t), i = qt.at;
8469
+ var n, r = Ro(t), i = qt.at;
8470
8470
  return r.Z({
8471
8471
  index: "documentTargetsIndex"
8472
8472
  }, (function(t, r) {
@@ -8500,7 +8500,7 @@ function ko(t) {
8500
8500
  * This class is responsible for the scheduling of LRU garbage collection. It handles checking
8501
8501
  * whether or not GC is enabled, as well as which delay to use before the next run.
8502
8502
  */ function qo(t, e) {
8503
- return Vo(t).put(
8503
+ return Ro(t).put(
8504
8504
  /**
8505
8505
  * @returns A value suitable for writing a sentinel row in the target-document
8506
8506
  * store.
@@ -8568,7 +8568,7 @@ function ko(t) {
8568
8568
  * `getEntry()/getEntries()` (enforced via IndexedDbs `apply()`).
8569
8569
  */
8570
8570
  t.prototype.removeEntry = function(t, e) {
8571
- this.assertNotApplied(), this.changes.set(t, Ve.newInvalidDocument(t).setReadTime(e));
8571
+ this.assertNotApplied(), this.changes.set(t, Re.newInvalidDocument(t).setReadTime(e));
8572
8572
  },
8573
8573
  /**
8574
8574
  * Looks up an entry in the cache. The buffered changes will first be checked,
@@ -8656,7 +8656,7 @@ function ko(t) {
8656
8656
  return r.byteSize += e, n.Qn(t, r);
8657
8657
  }));
8658
8658
  }, t.prototype.getEntry = function(t, e) {
8659
- var n = this, r = Ve.newInvalidDocument(e);
8659
+ var n = this, r = Re.newInvalidDocument(e);
8660
8660
  return Qo(t).Z({
8661
8661
  index: "documentKeyIndex",
8662
8662
  range: IDBKeyRange.only(zo(e))
@@ -8675,7 +8675,7 @@ function ko(t) {
8675
8675
  t.prototype.Wn = function(t, e) {
8676
8676
  var n = this, r = {
8677
8677
  size: 0,
8678
- document: Ve.newInvalidDocument(e)
8678
+ document: Re.newInvalidDocument(e)
8679
8679
  };
8680
8680
  return Qo(t).Z({
8681
8681
  index: "documentKeyIndex",
@@ -8783,11 +8783,11 @@ function ko(t) {
8783
8783
  var n;
8784
8784
  if (e.document) n = Gr(t.re, e.document, !!e.hasCommittedMutations); else if (e.noDocument) {
8785
8785
  var r = ft.fromSegments(e.noDocument.path), i = Ui(e.noDocument.readTime);
8786
- n = Ve.newNoDocument(r, i), e.hasCommittedMutations && n.setHasCommittedMutations();
8786
+ n = Re.newNoDocument(r, i), e.hasCommittedMutations && n.setHasCommittedMutations();
8787
8787
  } else {
8788
8788
  if (!e.unknownDocument) return q();
8789
8789
  var o = ft.fromSegments(e.unknownDocument.path), u = Ui(e.unknownDocument.version);
8790
- n = Ve.newUnknownDocument(o, u);
8790
+ n = Re.newUnknownDocument(o, u);
8791
8791
  }
8792
8792
  return e.readTime && n.setReadTime(function(t) {
8793
8793
  var e = new ut(t[0], t[1]);
@@ -8798,7 +8798,7 @@ function ko(t) {
8798
8798
  // `getNewDocumentChanges()`
8799
8799
  if (!n.isNoDocument() || !n.version.isEqual(st.min())) return n;
8800
8800
  }
8801
- return Ve.newInvalidDocument(t);
8801
+ return Re.newInvalidDocument(t);
8802
8802
  }, t;
8803
8803
  }();
8804
8804
 
@@ -9255,7 +9255,7 @@ e) {
9255
9255
  // include documents for all overlays in the initial document set.
9256
9256
  t.forEach((function(t, e) {
9257
9257
  var n = e.getKey();
9258
- null === r.get(n) && (r = r.insert(n, Ve.newInvalidDocument(n)));
9258
+ null === r.get(n) && (r = r.insert(n, Re.newInvalidDocument(n)));
9259
9259
  }));
9260
9260
  // Apply the overlays and match against the query.
9261
9261
  var n = sr();
@@ -9268,7 +9268,7 @@ e) {
9268
9268
  }));
9269
9269
  },
9270
9270
  /** Returns a base document that can be used to apply `overlay`. */ t.prototype.getBaseDocument = function(t, e, n) {
9271
- return null === n || 1 /* Patch */ === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) : xt.resolve(Ve.newInvalidDocument(e));
9271
+ return null === n || 1 /* Patch */ === n.mutation.type ? this.remoteDocumentCache.getEntry(t, e) : xt.resolve(Re.newInvalidDocument(e));
9272
9272
  }, t;
9273
9273
  }(), Zo = /** @class */ function() {
9274
9274
  function t(t) {
@@ -9351,7 +9351,7 @@ e) {
9351
9351
  var i = this.es.get(r.largestBatchId).delete(n.key);
9352
9352
  this.es.set(r.largestBatchId, i);
9353
9353
  }
9354
- this.overlays = this.overlays.insert(n.key, new Ri(e, n));
9354
+ this.overlays = this.overlays.insert(n.key, new Vi(e, n));
9355
9355
  // Create the association of this overlay to the given largestBatchId.
9356
9356
  var o = this.es.get(e);
9357
9357
  void 0 === o && (o = pr(), this.es.set(e, o)), this.es.set(e, o.add(n.key));
@@ -9599,12 +9599,12 @@ e) {
9599
9599
  e && (this.docs = this.docs.remove(t), this.size -= e.size);
9600
9600
  }, t.prototype.getEntry = function(t, e) {
9601
9601
  var n = this.docs.get(e);
9602
- return xt.resolve(n ? n.document.mutableCopy() : Ve.newInvalidDocument(e));
9602
+ return xt.resolve(n ? n.document.mutableCopy() : Re.newInvalidDocument(e));
9603
9603
  }, t.prototype.getEntries = function(t, e) {
9604
9604
  var n = this, r = or();
9605
9605
  return e.forEach((function(t) {
9606
9606
  var e = n.docs.get(t);
9607
- r = r.insert(t, e ? e.document.mutableCopy() : Ve.newInvalidDocument(t));
9607
+ r = r.insert(t, e ? e.document.mutableCopy() : Re.newInvalidDocument(t));
9608
9608
  })), xt.resolve(r);
9609
9609
  }, t.prototype.getAllFromCollection = function(t, e, n) {
9610
9610
  for (var r = or(), i = new ft(e.child("")), o = this.docs.getIteratorFrom(i)
@@ -10839,7 +10839,7 @@ var vu = /** @class */ function() {
10839
10839
  var i = this;
10840
10840
  return un(e) || r.isEqual(st.min()) ? this.Mi(t, e) : this.Ni.getDocuments(t, n).next((function(o) {
10841
10841
  var u = i.Fi(e, o);
10842
- return i.$i(e, u, n, r) ? i.Mi(t, e) : (V() <= h.DEBUG && L("QueryEngine", "Re-using previous result from %s to execute query: %s", r.toString(), vn(e)),
10842
+ return i.$i(e, u, n, r) ? i.Mi(t, e) : (R() <= h.DEBUG && L("QueryEngine", "Re-using previous result from %s to execute query: %s", r.toString(), vn(e)),
10843
10843
  i.Bi(t, u, e, bt(r, -1)));
10844
10844
  }));
10845
10845
  // Queries that have never seen a snapshot without limbo free documents
@@ -10884,7 +10884,7 @@ var vu = /** @class */ function() {
10884
10884
  var i = "F" /* First */ === t.limitType ? e.last() : e.first();
10885
10885
  return !!i && (i.hasPendingWrites || i.version.compareTo(r) > 0);
10886
10886
  }, t.prototype.Mi = function(t, e) {
10887
- return V() <= h.DEBUG && L("QueryEngine", "Using full collection scan to execute query:", vn(e)),
10887
+ return R() <= h.DEBUG && L("QueryEngine", "Using full collection scan to execute query:", vn(e)),
10888
10888
  this.Ni.getDocumentsMatchingQuery(t, e, Et.min());
10889
10889
  },
10890
10890
  /**
@@ -11489,7 +11489,7 @@ function Cu(t, e, n) {
11489
11489
  }));
11490
11490
  }
11491
11491
 
11492
- /** Assembles the key for a client state in WebStorage */ function Vu(t, e) {
11492
+ /** Assembles the key for a client state in WebStorage */ function Ru(t, e) {
11493
11493
  return "firestore_clients_" + t + "_" + e;
11494
11494
  }
11495
11495
 
@@ -11499,7 +11499,7 @@ function Cu(t, e, n) {
11499
11499
  // or: firestore_mutations_<persistence_prefix>_<batch_id>_<user_uid>
11500
11500
  // 'user_uid' is last to avoid needing to escape '_' characters that it might
11501
11501
  // contain.
11502
- /** Assembles the key for a mutation batch in WebStorage */ function Ru(t, e, n) {
11502
+ /** Assembles the key for a mutation batch in WebStorage */ function Vu(t, e, n) {
11503
11503
  var r = "firestore_mutations_" + t + "_" + n;
11504
11504
  return e.isAuthenticated() && (r += "_" + e.uid), r;
11505
11505
  }
@@ -11624,7 +11624,7 @@ var Mu = /** @class */ function() {
11624
11624
  // Escape the special characters mentioned here:
11625
11625
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
11626
11626
  var o = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
11627
- this.storage = this.window.localStorage, this.currentUser = i, this.ar = Vu(this.persistenceKey, this.sr),
11627
+ this.storage = this.window.localStorage, this.currentUser = i, this.ar = Ru(this.persistenceKey, this.sr),
11628
11628
  this.hr =
11629
11629
  /** Assembles the key for the current sequence number. */
11630
11630
  function(t) {
@@ -11657,7 +11657,7 @@ var Mu = /** @class */ function() {
11657
11657
  return [ 4 /*yield*/ , this.syncEngine.vi() ];
11658
11658
 
11659
11659
  case 1:
11660
- for (t = n.sent(), e = 0, r = t; e < r.length; e++) (i = r[e]) !== this.sr && (o = this.getItem(Vu(this.persistenceKey, i))) && (u = Fu.Zi(i, o)) && (this.ur = this.ur.insert(u.clientId, u));
11660
+ for (t = n.sent(), e = 0, r = t; e < r.length; e++) (i = r[e]) !== this.sr && (o = this.getItem(Ru(this.persistenceKey, i))) && (u = Fu.Zi(i, o)) && (this.ur = this.ur.insert(u.clientId, u));
11661
11661
  for (this.gr(), (s = this.storage.getItem(this.wr)) && (a = this.yr(s)) && this.pr(a),
11662
11662
  c = 0, l = this.cr; c < l.length; c++) h = l[c], this.rr(h);
11663
11663
  return this.cr = [],
@@ -11793,10 +11793,10 @@ var Mu = /** @class */ function() {
11793
11793
  }), t.prototype.gr = function() {
11794
11794
  this.setItem(this.ar, this.Ar.tr());
11795
11795
  }, t.prototype.Tr = function(t, e, n) {
11796
- var r = new Mu(this.currentUser, t, e, n), i = Ru(this.persistenceKey, this.currentUser, t);
11796
+ var r = new Mu(this.currentUser, t, e, n), i = Vu(this.persistenceKey, this.currentUser, t);
11797
11797
  this.setItem(i, r.tr());
11798
11798
  }, t.prototype.Er = function(t) {
11799
- var e = Ru(this.persistenceKey, this.currentUser, t);
11799
+ var e = Vu(this.persistenceKey, this.currentUser, t);
11800
11800
  this.removeItem(e);
11801
11801
  }, t.prototype.br = function(t) {
11802
11802
  var e = {
@@ -11992,7 +11992,7 @@ var Mu = /** @class */ function() {
11992
11992
  return t(n, e), n.prototype.fo = function(t, e, n, r) {
11993
11993
  return new Promise((function(i, o) {
11994
11994
  var u = new b;
11995
- u.listenOnce(I.COMPLETE, (function() {
11995
+ u.setWithCredentials(!0), u.listenOnce(I.COMPLETE, (function() {
11996
11996
  try {
11997
11997
  switch (u.getLastErrorCode()) {
11998
11998
  case E.NO_ERROR:
@@ -12621,13 +12621,13 @@ function Hu() {
12621
12621
  mapValue: {
12622
12622
  fields: a.document.fields
12623
12623
  }
12624
- }), f = Ve.newFoundDocument(c, l, h), d = a.targetIds || [], p = a.removedTargetIds || [];
12624
+ }), f = Re.newFoundDocument(c, l, h), d = a.targetIds || [], p = a.removedTargetIds || [];
12625
12625
  n = new wr(d, p, f.key, f);
12626
12626
  } else if ("documentDelete" in e) {
12627
12627
  e.documentDelete;
12628
12628
  var v = e.documentDelete;
12629
12629
  v.document;
12630
- var y = Mr(t, v.document), m = v.readTime ? Or(v.readTime) : st.min(), g = Ve.newNoDocument(y, m), w = v.removedTargetIds || [];
12630
+ var y = Mr(t, v.document), m = v.readTime ? Or(v.readTime) : st.min(), g = Re.newNoDocument(y, m), w = v.removedTargetIds || [];
12631
12631
  n = new wr([], w, g.key, g);
12632
12632
  } else if ("documentRemove" in e) {
12633
12633
  e.documentRemove;
@@ -13447,7 +13447,7 @@ function Ss(t, r, i) {
13447
13447
  return n(this, (function(n) {
13448
13448
  switch (n.label) {
13449
13449
  case 0:
13450
- return e = t.du.shift(), o = Vi.from(e, r, i), [ 4 /*yield*/ , gs(t, (function() {
13450
+ return e = t.du.shift(), o = Ri.from(e, r, i), [ 4 /*yield*/ , gs(t, (function() {
13451
13451
  return t.remoteSyncer.applySuccessfulWrite(o);
13452
13452
  })) ];
13453
13453
 
@@ -13859,7 +13859,7 @@ var Cs = /** @class */ function() {
13859
13859
  var r = new t;
13860
13860
  return r.comparator = this.comparator, r.keyedMap = e, r.sortedSet = n, r;
13861
13861
  }, t;
13862
- }(), Vs = /** @class */ function() {
13862
+ }(), Rs = /** @class */ function() {
13863
13863
  function t() {
13864
13864
  this.Eu = new Kt(ft.comparator);
13865
13865
  }
@@ -13897,22 +13897,23 @@ var Cs = /** @class */ function() {
13897
13897
  t.push(n);
13898
13898
  })), t;
13899
13899
  }, t;
13900
- }(), Rs = /** @class */ function() {
13901
- function t(t, e, n, r, i, o, u, s) {
13900
+ }(), Vs = /** @class */ function() {
13901
+ function t(t, e, n, r, i, o, u, s, a) {
13902
13902
  this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = r, this.mutatedKeys = i,
13903
- this.fromCache = o, this.syncStateChanged = u, this.excludesMetadataChanges = s
13903
+ this.fromCache = o, this.syncStateChanged = u, this.excludesMetadataChanges = s,
13904
+ this.hasCachedResults = a
13904
13905
  /** Returns a view snapshot as if all documents in the snapshot were added. */;
13905
13906
  }
13906
- return t.fromInitialDocuments = function(e, n, r, i) {
13907
- var o = [];
13907
+ return t.fromInitialDocuments = function(e, n, r, i, o) {
13908
+ var u = [];
13908
13909
  return n.forEach((function(t) {
13909
- o.push({
13910
+ u.push({
13910
13911
  type: 0 /* Added */ ,
13911
13912
  doc: t
13912
13913
  });
13913
- })), new t(e, n, Os.emptySet(n), o, r, i,
13914
+ })), new t(e, n, Os.emptySet(n), u, r, i,
13914
13915
  /* syncStateChanged= */ !0,
13915
- /* excludesMetadataChanges= */ !1);
13916
+ /* excludesMetadataChanges= */ !1, o);
13916
13917
  }, Object.defineProperty(t.prototype, "hasPendingWrites", {
13917
13918
  get: function() {
13918
13919
  return !this.mutatedKeys.isEmpty();
@@ -13920,7 +13921,7 @@ var Cs = /** @class */ function() {
13920
13921
  enumerable: !1,
13921
13922
  configurable: !0
13922
13923
  }), t.prototype.isEqual = function(t) {
13923
- if (!(this.fromCache === t.fromCache && this.syncStateChanged === t.syncStateChanged && this.mutatedKeys.isEqual(t.mutatedKeys) && dn(this.query, t.query) && this.docs.isEqual(t.docs) && this.oldDocs.isEqual(t.oldDocs))) return !1;
13924
+ if (!(this.fromCache === t.fromCache && this.hasCachedResults === t.hasCachedResults && this.syncStateChanged === t.syncStateChanged && this.mutatedKeys.isEqual(t.mutatedKeys) && dn(this.query, t.query) && this.docs.isEqual(t.docs) && this.oldDocs.isEqual(t.oldDocs))) return !1;
13924
13925
  var e = this.docChanges, n = t.docChanges;
13925
13926
  if (e.length !== n.length) return !1;
13926
13927
  for (var r = 0; r < e.length; r++) if (e[r].type !== n[r].type || !e[r].doc.isEqual(n[r].doc)) return !1;
@@ -14050,8 +14051,8 @@ function Bs(t) {
14050
14051
  var i = r[n];
14051
14052
  3 /* Metadata */ !== i.type && e.push(i);
14052
14053
  }
14053
- t = new Rs(t.query, t.docs, t.oldDocs, e, t.mutatedKeys, t.fromCache, t.syncStateChanged,
14054
- /* excludesMetadataChanges= */ !0);
14054
+ t = new Vs(t.query, t.docs, t.oldDocs, e, t.mutatedKeys, t.fromCache, t.syncStateChanged,
14055
+ /* excludesMetadataChanges= */ !0, t.hasCachedResults);
14055
14056
  }
14056
14057
  var o = !1;
14057
14058
  return this.Su ? this.Cu(t) && (this.Vu.next(t), o = !0) : this.xu(t, this.onlineState) && (this.Nu(t),
@@ -14072,8 +14073,9 @@ function Bs(t) {
14072
14073
  var n = "Offline" /* Offline */ !== e;
14073
14074
  // Don't raise the event if we're online, aren't synced yet (checked
14074
14075
  // above) and are waiting for a sync.
14075
- return !(this.options.ku && n || t.docs.isEmpty() && "Offline" /* Offline */ !== e);
14076
- // Raise data from cache if we have any documents or we are offline
14076
+ return (!this.options.ku || !n) && (!t.docs.isEmpty() || t.hasCachedResults || "Offline" /* Offline */ === e);
14077
+ // Raise data from cache if we have any documents, have cached results before,
14078
+ // or we are offline.
14077
14079
  }, t.prototype.Cu = function(t) {
14078
14080
  // We don't need to handle includeDocumentMetadataChanges here because
14079
14081
  // the Metadata only changes have already been stripped out if needed.
@@ -14086,8 +14088,8 @@ function Bs(t) {
14086
14088
  // to get here if there were only metadata docChanges and they got
14087
14089
  // stripped out.
14088
14090
  }, t.prototype.Nu = function(t) {
14089
- t = Rs.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.Su = !0,
14090
- this.Vu.next(t);
14091
+ t = Vs.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache, t.hasCachedResults),
14092
+ this.Su = !0, this.Vu.next(t);
14091
14093
  }, t;
14092
14094
  }(), Ks = /** @class */ function() {
14093
14095
  function t(t,
@@ -14109,7 +14111,7 @@ function Bs(t) {
14109
14111
  * Converts a BundleDocument to a MutableDocument.
14110
14112
  */
14111
14113
  t.prototype.Yi = function(t) {
14112
- return t.metadata.exists ? Gr(this.It, t.document, !1) : Ve.newNoDocument(this.Ji(t.metadata.name), this.Xi(t.metadata.readTime));
14114
+ return t.metadata.exists ? Gr(this.It, t.document, !1) : Re.newNoDocument(this.Ji(t.metadata.name), this.Xi(t.metadata.readTime));
14113
14115
  }, t.prototype.Xi = function(t) {
14114
14116
  return Or(t);
14115
14117
  }, t;
@@ -14248,7 +14250,7 @@ function zs(t) {
14248
14250
  function t(t,
14249
14251
  /** Documents included in the remote target */
14250
14252
  e) {
14251
- this.query = t, this.Uu = e, this.qu = null,
14253
+ this.query = t, this.Uu = e, this.qu = null, this.hasCachedResults = !1,
14252
14254
  /**
14253
14255
  * A flag whether the view is current with the backend. A view is considered
14254
14256
  * current after it has seen the current flag from the backend and did not
@@ -14283,7 +14285,7 @@ function zs(t) {
14283
14285
  * @returns a new set of docs, changes, and refill flag.
14284
14286
  */
14285
14287
  t.prototype.Wu = function(t, e) {
14286
- var n = this, r = e ? e.zu : new Vs, i = e ? e.Qu : this.Qu, o = e ? e.mutatedKeys : this.mutatedKeys, u = i, s = !1, a = "F" /* First */ === this.query.limitType && i.size === this.query.limit ? i.last() : null, c = "L" /* Last */ === this.query.limitType && i.size === this.query.limit ? i.first() : null;
14288
+ var n = this, r = e ? e.zu : new Rs, i = e ? e.Qu : this.Qu, o = e ? e.mutatedKeys : this.mutatedKeys, u = i, s = !1, a = "F" /* First */ === this.query.limitType && i.size === this.query.limit ? i.last() : null, c = "L" /* Last */ === this.query.limitType && i.size === this.query.limit ? i.first() : null;
14287
14289
  // Drop documents out to meet limit/limitToLast requirement.
14288
14290
  if (t.inorderTraversal((function(t, e) {
14289
14291
  var l = i.get(t), h = yn(n.query, e) ? e : null, f = !!l && n.mutatedKeys.has(l.key), d = !!h && (h.hasLocalMutations ||
@@ -14378,8 +14380,8 @@ function zs(t) {
14378
14380
  })), this.Ju(n);
14379
14381
  var u = e ? this.Yu() : [], s = 0 === this.Ku.size && this.current ? 1 /* Synced */ : 0 /* Local */ , a = s !== this.qu;
14380
14382
  return this.qu = s, 0 !== o.length || a ? {
14381
- snapshot: new Rs(this.query, t.Qu, i, o, t.mutatedKeys, 0 /* Local */ === s, a,
14382
- /* excludesMetadataChanges= */ !1),
14383
+ snapshot: new Vs(this.query, t.Qu, i, o, t.mutatedKeys, 0 /* Local */ === s, a,
14384
+ /* excludesMetadataChanges= */ !1, !!n && n.resumeToken.approximateByteSize() > 0),
14383
14385
  Xu: u
14384
14386
  } : {
14385
14387
  Xu: u
@@ -14398,7 +14400,7 @@ function zs(t) {
14398
14400
  // true once the client is back online.
14399
14401
  this.current = !1, this.applyChanges({
14400
14402
  Qu: this.Qu,
14401
- zu: new Vs,
14403
+ zu: new Rs,
14402
14404
  mutatedKeys: this.mutatedKeys,
14403
14405
  $i: !1
14404
14406
  },
@@ -14476,7 +14478,7 @@ function zs(t) {
14476
14478
  */
14477
14479
  // PORTING NOTE: Multi-tab only.
14478
14480
  t.prototype.ec = function() {
14479
- return Rs.fromInitialDocuments(this.query, this.Qu, this.mutatedKeys, 0 /* Local */ === this.qu);
14481
+ return Vs.fromInitialDocuments(this.query, this.Qu, this.mutatedKeys, 0 /* Local */ === this.qu, this.hasCachedResults);
14480
14482
  }, t;
14481
14483
  }(), Xs = function(
14482
14484
  /**
@@ -14576,7 +14578,7 @@ function $s(t, r) {
14576
14578
 
14577
14579
  case 2:
14578
14580
  return s = n.sent(), e.isPrimaryClient && us(e.remoteStore, s), a = e.sharedClientState.addLocalQueryTarget(s.targetId),
14579
- i = s.targetId, [ 4 /*yield*/ , ta(e, r, i, "current" === a) ];
14581
+ i = s.targetId, [ 4 /*yield*/ , ta(e, r, i, "current" === a, s.resumeToken) ];
14580
14582
 
14581
14583
  case 3:
14582
14584
  o = n.sent(), n.label = 4;
@@ -14591,11 +14593,11 @@ function $s(t, r) {
14591
14593
  /**
14592
14594
  * Registers a view for a previously unknown query and computes its initial
14593
14595
  * snapshot.
14594
- */ function ta(t, r, i, o) {
14596
+ */ function ta(t, r, i, o, u) {
14595
14597
  return e(this, void 0, void 0, (function() {
14596
- var u, s, a, c, l, h;
14597
- return n(this, (function(f) {
14598
- switch (f.label) {
14598
+ var s, a, c, l, h, f;
14599
+ return n(this, (function(d) {
14600
+ switch (d.label) {
14599
14601
  case 0:
14600
14602
  // PORTING NOTE: On Web only, we inject the code that registers new Limbo
14601
14603
  // targets based on view changes. This allows us to only depend on Limbo
@@ -14631,11 +14633,11 @@ function $s(t, r) {
14631
14633
  /* usePreviousResults= */ !0) ];
14632
14634
 
14633
14635
  case 1:
14634
- return u = f.sent(), s = new Ys(r, u.Hi), a = s.Wu(u.documents), c = gr.createSynthesizedTargetChangeForCurrentChange(i, o && "Offline" /* Offline */ !== t.onlineState),
14635
- l = s.applyChanges(a,
14636
- /* updateLimboDocuments= */ t.isPrimaryClient, c), da(t, i, l.Xu), h = new Xs(r, i, s),
14637
- [ 2 /*return*/ , (t.ic.set(r, h), t.rc.has(i) ? t.rc.get(i).push(r) : t.rc.set(i, [ r ]),
14638
- l.snapshot) ];
14636
+ return s = d.sent(), a = new Ys(r, s.Hi), c = a.Wu(s.documents), l = gr.createSynthesizedTargetChangeForCurrentChange(i, o && "Offline" /* Offline */ !== t.onlineState, u),
14637
+ h = a.applyChanges(c,
14638
+ /* updateLimboDocuments= */ t.isPrimaryClient, l), da(t, i, h.Xu), f = new Xs(r, i, a),
14639
+ [ 2 /*return*/ , (t.ic.set(r, f), t.rc.has(i) ? t.rc.get(i).push(r) : t.rc.set(i, [ r ]),
14640
+ h.snapshot) ];
14639
14641
  }
14640
14642
  }));
14641
14643
  }));
@@ -14861,7 +14863,7 @@ function $s(t, r) {
14861
14863
  // TODO(b/217189216): This limbo document should ideally have a read time,
14862
14864
  // so that it is picked up by any read-time based scans. The backend,
14863
14865
  // however, does not send a read time for target removals.
14864
- s = (s = new Kt(ft.comparator)).insert(u, Ve.newNoDocument(u, st.min())), a = pr().add(u),
14866
+ s = (s = new Kt(ft.comparator)).insert(u, Re.newNoDocument(u, st.min())), a = pr().add(u),
14865
14867
  c = new mr(st.min(),
14866
14868
  /* targetChanges= */ new Map,
14867
14869
  /* targetMismatches= */ new zt(rt), s, a), [ 4 /*yield*/ , ra(e, c) ]) : [ 3 /*break*/ , 2 ];
@@ -15396,7 +15398,7 @@ function Ta(t, r, i) {
15396
15398
 
15397
15399
  case 9:
15398
15400
  return c = n.sent(), [ 4 /*yield*/ , ta(e, Sa(y), a,
15399
- /*current=*/ !1) ];
15401
+ /*current=*/ !1, c.resumeToken) ];
15400
15402
 
15401
15403
  case 10:
15402
15404
  n.sent(), n.label = 11;
@@ -15463,7 +15465,7 @@ function _a(t, r, i, o) {
15463
15465
  return [ 4 /*yield*/ , Au(e.localStore, mn(u[0])) ];
15464
15466
 
15465
15467
  case 2:
15466
- return s = n.sent(), a = mr.createSynthesizedRemoteEventForCurrentChange(r, "current" === i),
15468
+ return s = n.sent(), a = mr.createSynthesizedRemoteEventForCurrentChange(r, "current" === i, Zt.EMPTY_BYTE_STRING),
15467
15469
  [ 4 /*yield*/ , ya(e, s, a) ];
15468
15470
 
15469
15471
  case 3:
@@ -15505,7 +15507,7 @@ function _a(t, r, i, o) {
15505
15507
 
15506
15508
  case 3:
15507
15509
  return c = p.sent(), [ 4 /*yield*/ , ta(e, Sa(a), c.targetId,
15508
- /*current=*/ !1) ];
15510
+ /*current=*/ !1, c.resumeToken) ];
15509
15511
 
15510
15512
  case 4:
15511
15513
  p.sent(), us(e.remoteStore, c), p.label = 5;
@@ -15778,7 +15780,7 @@ var ka = /** @class */ function() {
15778
15780
  }, i.prototype.gc = function(t) {
15779
15781
  return new Gu;
15780
15782
  }, i;
15781
- }(ka), Va = /** @class */ function(r) {
15783
+ }(ka), Ra = /** @class */ function(r) {
15782
15784
  function i(t, e) {
15783
15785
  var n = this;
15784
15786
  return (n = r.call(this, t, e, /* forceOwnership= */ !1) || this).Ac = t, n.cacheSizeBytes = e,
@@ -15836,7 +15838,7 @@ var ka = /** @class */ function() {
15836
15838
  var n = pu(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);
15837
15839
  return new Bu(e, t.asyncQueue, n, t.clientId, t.initialUser);
15838
15840
  }, i;
15839
- }(Oa), Ra = /** @class */ function() {
15841
+ }(Oa), Va = /** @class */ function() {
15840
15842
  function t() {}
15841
15843
  return t.prototype.initialize = function(t, r) {
15842
15844
  return e(this, void 0, void 0, (function() {
@@ -16752,11 +16754,11 @@ function tc(t, r) {
16752
16754
  fields: e.found.fields
16753
16755
  }
16754
16756
  });
16755
- return Ve.newFoundDocument(n, r, i);
16757
+ return Re.newFoundDocument(n, r, i);
16756
16758
  }(t, e) : "missing" in e ? function(t, e) {
16757
16759
  U(!!e.missing), U(!!e.readTime);
16758
16760
  var n = Mr(t, e.missing), r = Or(e.readTime);
16759
- return Ve.newNoDocument(n, r);
16761
+ return Re.newNoDocument(n, r);
16760
16762
  }(t, e) : q();
16761
16763
  }(e.It, t);
16762
16764
  s.set(n.key.toString(), n);
@@ -17141,7 +17143,7 @@ function fc(t) {
17141
17143
  switch (e.label) {
17142
17144
  case 0:
17143
17145
  return t.onlineComponents ? [ 3 /*break*/ , 2 ] : (L("FirestoreClient", "Using default OnlineComponentProvider"),
17144
- [ 4 /*yield*/ , lc(t, new Ra) ]);
17146
+ [ 4 /*yield*/ , lc(t, new Va) ]);
17145
17147
 
17146
17148
  case 1:
17147
17149
  e.sent(), e.label = 2;
@@ -17716,7 +17718,7 @@ function Ac(t) {
17716
17718
  * @returns A `Promise` that represents successfully enabling persistent storage.
17717
17719
  */ function Cc(t, e) {
17718
17720
  Uc(t = Ua(t, Dc));
17719
- var n = Nc(t), r = t._freezeSettings(), i = new Ra;
17721
+ var n = Nc(t), r = t._freezeSettings(), i = new Va;
17720
17722
  return Oc(n, i, new Oa(i, r.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
17721
17723
  }
17722
17724
 
@@ -17743,8 +17745,8 @@ function Ac(t) {
17743
17745
  * storage.
17744
17746
  */ function kc(t) {
17745
17747
  Uc(t = Ua(t, Dc));
17746
- var e = Nc(t), n = t._freezeSettings(), r = new Ra;
17747
- return Oc(e, r, new Va(r, n.cacheSizeBytes));
17748
+ var e = Nc(t), n = t._freezeSettings(), r = new Va;
17749
+ return Oc(e, r, new Ra(r, n.cacheSizeBytes));
17748
17750
  }
17749
17751
 
17750
17752
  /**
@@ -17793,7 +17795,7 @@ function Ac(t) {
17793
17795
  }));
17794
17796
  }
17795
17797
 
17796
- function Vc(t) {
17798
+ function Rc(t) {
17797
17799
  var r = this;
17798
17800
  if (t._initialized && !t._terminated) throw new j(K.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
17799
17801
  var i = new Q;
@@ -17848,7 +17850,7 @@ function Vc(t) {
17848
17850
  */;
17849
17851
  }
17850
17852
 
17851
- function Rc(t) {
17853
+ function Vc(t) {
17852
17854
  return function(t) {
17853
17855
  var r = this, i = new Q;
17854
17856
  return t.asyncQueue.enqueueAndForget((function() {
@@ -18723,7 +18725,7 @@ var nl = /** @class */ function(e) {
18723
18725
  var i = e.databaseId, o = t.firestore._databaseId;
18724
18726
  if (!o.isEqual(i)) throw e.ha("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database);
18725
18727
  return {
18726
- referenceValue: Vr(t.firestore._databaseId || e.databaseId, t._key.path)
18728
+ referenceValue: Rr(t.firestore._databaseId || e.databaseId, t._key.path)
18727
18729
  };
18728
18730
  }
18729
18731
  throw e.ha("Unsupported field value: " + qa(t));
@@ -19174,13 +19176,13 @@ function Ol() {
19174
19176
  /*inclusive=*/ !0);
19175
19177
  }
19176
19178
 
19177
- function Vl() {
19179
+ function Rl() {
19178
19180
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
19179
19181
  return new kl("startAfter", t,
19180
19182
  /*inclusive=*/ !1);
19181
19183
  }
19182
19184
 
19183
- var Rl = /** @class */ function(e) {
19185
+ var Vl = /** @class */ function(e) {
19184
19186
  function n(t, n, r) {
19185
19187
  var i = this;
19186
19188
  return (i = e.call(this) || this).type = t, i.Ea = n, i.Aa = r, i;
@@ -19195,13 +19197,13 @@ var Rl = /** @class */ function(e) {
19195
19197
 
19196
19198
  function Ll() {
19197
19199
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
19198
- return new Rl("endBefore", t,
19200
+ return new Vl("endBefore", t,
19199
19201
  /*inclusive=*/ !1);
19200
19202
  }
19201
19203
 
19202
19204
  function Ml() {
19203
19205
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
19204
- return new Rl("endAt", t, /*inclusive=*/ !0);
19206
+ return new Vl("endAt", t, /*inclusive=*/ !0);
19205
19207
  }
19206
19208
 
19207
19209
  /** Helper function to create a bound from a document or fields */ function Pl(t, e, n, r) {
@@ -20600,9 +20602,9 @@ function _h(t, e) {
20600
20602
  return r = Object.assign({
20601
20603
  useFetchStreams: yh
20602
20604
  }, r), o._setSettings(r), o;
20603
- }), "PUBLIC").setMultipleInstances(!0)), u(A, "3.6.0", void 0),
20605
+ }), "PUBLIC").setMultipleInstances(!0)), u(A, "3.7.0-20221010190246", void 0),
20604
20606
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
20605
- u(A, "3.6.0", "esm5");
20607
+ u(A, "3.7.0-20221010190246", "esm5");
20606
20608
 
20607
- export { Bl as AbstractUserDataWriter, rc as AggregateField, ic as AggregateQuerySnapshot, Bc as Bytes, Sc as CACHE_SIZE_UNLIMITED, Ha as CollectionReference, za as DocumentReference, Ql as DocumentSnapshot, Gc as FieldPath, jc as FieldValue, Dc as Firestore, j as FirestoreError, Qc as GeoPoint, Tc as LoadBundleTask, Wa as Query, El as QueryConstraint, zl as QueryDocumentSnapshot, Wl as QuerySnapshot, jl as SnapshotMetadata, ut as Timestamp, mh as Transaction, ph as WriteBatch, ue as _DatabaseId, ft as _DocumentKey, tt as _EmptyAppCheckTokenProvider, W as _EmptyAuthCredentialsProvider, ht as _FieldPath, Ua as _cast, B as _debugAssert, Xt as _isBase64Available, P as _logWarn, Ma as _validateIsNotUsedTogether, uh as addDoc, hh as aggregateQuerySnapshotEqual, Eh as arrayRemove, Ih as arrayUnion, Vc as clearIndexedDbPersistence, Ya as collection, Xa as collectionGroup, Qa as connectFirestoreEmulator, oh as deleteDoc, wh as deleteField, Mc as disableNetwork, Za as doc, Kc as documentId, Cc as enableIndexedDbPersistence, kc as enableMultiTabIndexedDbPersistence, Lc as enableNetwork, Ml as endAt, Ll as endBefore, Nc as ensureFirestoreConfigured, ch as executeWrite, fh as getCountFromServer, Xl as getDoc, Jl as getDocFromCache, $l as getDocFromServer, th as getDocs, eh as getDocsFromCache, nh as getDocsFromServer, xc as getFirestore, Th as increment, _c as initializeFirestore, Al as limit, Cl as limitToLast, Fc as loadBundle, qc as namedQuery, sh as onSnapshot, ah as onSnapshotsInSync, xl as orderBy, Tl as query, $a as queryEqual, Ja as refEqual, gh as runTransaction, bh as serverTimestamp, rh as setDoc, Dh as setIndexConfiguration, R as setLogLevel, Yl as snapshotEqual, Vl as startAfter, Ol as startAt, Pc as terminate, ih as updateDoc, Rc as waitForPendingWrites, Dl as where, Sh as writeBatch };
20609
+ export { Bl as AbstractUserDataWriter, rc as AggregateField, ic as AggregateQuerySnapshot, Bc as Bytes, Sc as CACHE_SIZE_UNLIMITED, Ha as CollectionReference, za as DocumentReference, Ql as DocumentSnapshot, Gc as FieldPath, jc as FieldValue, Dc as Firestore, j as FirestoreError, Qc as GeoPoint, Tc as LoadBundleTask, Wa as Query, El as QueryConstraint, zl as QueryDocumentSnapshot, Wl as QuerySnapshot, jl as SnapshotMetadata, ut as Timestamp, mh as Transaction, ph as WriteBatch, ue as _DatabaseId, ft as _DocumentKey, tt as _EmptyAppCheckTokenProvider, W as _EmptyAuthCredentialsProvider, ht as _FieldPath, Ua as _cast, B as _debugAssert, Xt as _isBase64Available, P as _logWarn, Ma as _validateIsNotUsedTogether, uh as addDoc, hh as aggregateQuerySnapshotEqual, Eh as arrayRemove, Ih as arrayUnion, Rc as clearIndexedDbPersistence, Ya as collection, Xa as collectionGroup, Qa as connectFirestoreEmulator, oh as deleteDoc, wh as deleteField, Mc as disableNetwork, Za as doc, Kc as documentId, Cc as enableIndexedDbPersistence, kc as enableMultiTabIndexedDbPersistence, Lc as enableNetwork, Ml as endAt, Ll as endBefore, Nc as ensureFirestoreConfigured, ch as executeWrite, fh as getCountFromServer, Xl as getDoc, Jl as getDocFromCache, $l as getDocFromServer, th as getDocs, eh as getDocsFromCache, nh as getDocsFromServer, xc as getFirestore, Th as increment, _c as initializeFirestore, Al as limit, Cl as limitToLast, Fc as loadBundle, qc as namedQuery, sh as onSnapshot, ah as onSnapshotsInSync, xl as orderBy, Tl as query, $a as queryEqual, Ja as refEqual, gh as runTransaction, bh as serverTimestamp, rh as setDoc, Dh as setIndexConfiguration, V as setLogLevel, Yl as snapshotEqual, Rl as startAfter, Ol as startAt, Pc as terminate, ih as updateDoc, Vc as waitForPendingWrites, Dl as where, Sh as writeBatch };
20608
20610
  //# sourceMappingURL=index.esm5.js.map