@firebase/firestore 3.3.1 → 3.4.0-canary.774b2fc19

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 (99) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/firestore/compat/index.d.ts +1 -1
  3. package/dist/firestore/src/api/credentials.d.ts +64 -30
  4. package/dist/firestore/src/api/database.d.ts +2 -1
  5. package/dist/firestore/src/api.d.ts +2 -1
  6. package/dist/firestore/src/core/component_provider.d.ts +2 -1
  7. package/dist/firestore/src/core/firestore_client.d.ts +4 -3
  8. package/dist/firestore/src/lite-api/components.d.ts +3 -1
  9. package/dist/firestore/src/lite-api/database.d.ts +4 -2
  10. package/dist/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
  11. package/dist/firestore/src/platform/node/grpc_connection.d.ts +3 -3
  12. package/dist/firestore/src/remote/connection.d.ts +3 -3
  13. package/dist/firestore/src/remote/datastore.d.ts +2 -1
  14. package/dist/firestore/src/remote/persistent_stream.d.ts +9 -7
  15. package/dist/firestore/src/remote/rest_connection.d.ts +4 -4
  16. package/dist/firestore/test/integration/remote/stream.test.d.ts +2 -2
  17. package/dist/firestore/test/integration/util/internal_helpers.d.ts +5 -5
  18. package/dist/firestore/test/unit/remote/rest_connection.test.d.ts +1 -1
  19. package/dist/index.d.ts +2 -1
  20. package/dist/index.esm2017.js +3413 -3359
  21. package/dist/index.esm2017.js.map +1 -1
  22. package/dist/index.esm5.js +3688 -3639
  23. package/dist/index.esm5.js.map +1 -1
  24. package/dist/index.node.cjs.js +195 -109
  25. package/dist/index.node.cjs.js.map +1 -1
  26. package/dist/index.node.mjs +194 -105
  27. package/dist/index.node.mjs.map +1 -1
  28. package/dist/index.rn.js +3391 -3337
  29. package/dist/index.rn.js.map +1 -1
  30. package/dist/internal.d.ts +34 -20
  31. package/dist/lite/firestore/compat/index.d.ts +1 -1
  32. package/dist/lite/firestore/src/api/credentials.d.ts +64 -30
  33. package/dist/lite/firestore/src/api/database.d.ts +2 -1
  34. package/dist/lite/firestore/src/api.d.ts +2 -1
  35. package/dist/lite/firestore/src/core/component_provider.d.ts +2 -1
  36. package/dist/lite/firestore/src/core/firestore_client.d.ts +4 -3
  37. package/dist/lite/firestore/src/lite-api/components.d.ts +3 -1
  38. package/dist/lite/firestore/src/lite-api/database.d.ts +4 -2
  39. package/dist/lite/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
  40. package/dist/lite/firestore/src/platform/node/grpc_connection.d.ts +3 -3
  41. package/dist/lite/firestore/src/remote/connection.d.ts +3 -3
  42. package/dist/lite/firestore/src/remote/datastore.d.ts +2 -1
  43. package/dist/lite/firestore/src/remote/persistent_stream.d.ts +9 -7
  44. package/dist/lite/firestore/src/remote/rest_connection.d.ts +4 -4
  45. package/dist/lite/firestore/test/integration/remote/stream.test.d.ts +2 -2
  46. package/dist/lite/firestore/test/integration/util/internal_helpers.d.ts +5 -5
  47. package/dist/lite/firestore/test/unit/remote/rest_connection.test.d.ts +1 -1
  48. package/dist/lite/index.browser.esm2017.js +1379 -1365
  49. package/dist/lite/index.browser.esm2017.js.map +1 -1
  50. package/dist/lite/index.browser.esm5.js +934 -925
  51. package/dist/lite/index.browser.esm5.js.map +1 -1
  52. package/dist/lite/index.node.cjs.js +96 -61
  53. package/dist/lite/index.node.cjs.js.map +1 -1
  54. package/dist/lite/index.node.mjs +96 -61
  55. package/dist/lite/index.node.mjs.map +1 -1
  56. package/dist/lite/index.rn.esm2017.js +937 -923
  57. package/dist/lite/index.rn.esm2017.js.map +1 -1
  58. package/dist/lite/internal.d.ts +14 -13
  59. package/dist/lite/packages/firestore/babel-register.d.ts +1 -0
  60. package/dist/lite/packages/firestore/compat/index.d.ts +1 -1
  61. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +150 -149
  62. package/dist/lite/packages/firestore/src/api/credentials.d.ts +64 -30
  63. package/dist/lite/packages/firestore/src/api/database.d.ts +2 -1
  64. package/dist/lite/packages/firestore/src/api.d.ts +2 -1
  65. package/dist/lite/packages/firestore/src/core/component_provider.d.ts +2 -1
  66. package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +4 -3
  67. package/dist/lite/packages/firestore/src/lite-api/components.d.ts +3 -1
  68. package/dist/lite/packages/firestore/src/lite-api/database.d.ts +4 -2
  69. package/dist/lite/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
  70. package/dist/lite/packages/firestore/src/platform/node/grpc_connection.d.ts +3 -3
  71. package/dist/lite/packages/firestore/src/remote/connection.d.ts +3 -3
  72. package/dist/lite/packages/firestore/src/remote/datastore.d.ts +2 -1
  73. package/dist/lite/packages/firestore/src/remote/persistent_stream.d.ts +9 -7
  74. package/dist/lite/packages/firestore/src/remote/rest_connection.d.ts +4 -4
  75. package/dist/lite/packages/firestore/test/integration/remote/stream.test.d.ts +2 -2
  76. package/dist/lite/packages/firestore/test/integration/util/internal_helpers.d.ts +5 -5
  77. package/dist/lite/packages/firestore/test/unit/remote/rest_connection.test.d.ts +1 -1
  78. package/dist/lite/private.d.ts +14 -13
  79. package/dist/packages/firestore/babel-register.d.ts +1 -0
  80. package/dist/packages/firestore/compat/index.d.ts +1 -1
  81. package/dist/packages/firestore/dist/index.esm2017.d.ts +211 -195
  82. package/dist/packages/firestore/src/api/credentials.d.ts +64 -30
  83. package/dist/packages/firestore/src/api/database.d.ts +2 -1
  84. package/dist/packages/firestore/src/api.d.ts +2 -1
  85. package/dist/packages/firestore/src/core/component_provider.d.ts +2 -1
  86. package/dist/packages/firestore/src/core/firestore_client.d.ts +4 -3
  87. package/dist/packages/firestore/src/lite-api/components.d.ts +3 -1
  88. package/dist/packages/firestore/src/lite-api/database.d.ts +4 -2
  89. package/dist/packages/firestore/src/platform/browser/webchannel_connection.d.ts +1 -1
  90. package/dist/packages/firestore/src/platform/node/grpc_connection.d.ts +3 -3
  91. package/dist/packages/firestore/src/remote/connection.d.ts +3 -3
  92. package/dist/packages/firestore/src/remote/datastore.d.ts +2 -1
  93. package/dist/packages/firestore/src/remote/persistent_stream.d.ts +9 -7
  94. package/dist/packages/firestore/src/remote/rest_connection.d.ts +4 -4
  95. package/dist/packages/firestore/test/integration/remote/stream.test.d.ts +2 -2
  96. package/dist/packages/firestore/test/integration/util/internal_helpers.d.ts +5 -5
  97. package/dist/packages/firestore/test/unit/remote/rest_connection.test.d.ts +1 -1
  98. package/dist/private.d.ts +24 -19
  99. package/package.json +10 -10
@@ -4,7 +4,7 @@ import { SDK_VERSION as i, _registerComponent as o, registerVersion as a, _getPr
4
4
 
5
5
  import { Component as c } from "@firebase/component";
6
6
 
7
- import { Logger as f, LogLevel as l } from "@firebase/logger";
7
+ import { Logger as l, LogLevel as f } from "@firebase/logger";
8
8
 
9
9
  import { getModularInstance as h, createMockUserToken as p } from "@firebase/util";
10
10
 
@@ -67,7 +67,7 @@ d.MOCK_USER = new d("mock-user");
67
67
  * See the License for the specific language governing permissions and
68
68
  * limitations under the License.
69
69
  */
70
- var m = "9.5.0", y = new f("@firebase/firestore");
70
+ var m = "9.6.0-canary.774b2fc19", y = new l("@firebase/firestore");
71
71
 
72
72
  /**
73
73
  * @license
@@ -104,7 +104,7 @@ function v(t) {
104
104
 
105
105
  function g(t) {
106
106
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
107
- if (y.logLevel <= l.DEBUG) {
107
+ if (y.logLevel <= f.DEBUG) {
108
108
  var i = e.map(_);
109
109
  y.debug.apply(y, r([ "Firestore (" + m + "): " + t ], i));
110
110
  }
@@ -112,7 +112,7 @@ function g(t) {
112
112
 
113
113
  function w(t) {
114
114
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
115
- if (y.logLevel <= l.ERROR) {
115
+ if (y.logLevel <= f.ERROR) {
116
116
  var i = e.map(_);
117
117
  y.error.apply(y, r([ "Firestore (" + m + "): " + t ], i));
118
118
  }
@@ -122,7 +122,7 @@ function w(t) {
122
122
  * @internal
123
123
  */ function b(t) {
124
124
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
125
- if (y.logLevel <= l.WARN) {
125
+ if (y.logLevel <= f.WARN) {
126
126
  var i = e.map(_);
127
127
  y.warn.apply(y, r([ "Firestore (" + m + "): " + t ], i));
128
128
  }
@@ -180,7 +180,7 @@ function w(t) {
180
180
  * Returns `never` and can be used in expressions:
181
181
  * @example
182
182
  * let futureVar = fail('not implemented yet');
183
- */ function S(t) {
183
+ */ function T(t) {
184
184
  void 0 === t && (t = "Unexpected state");
185
185
  // Log the failure in addition to throw an exception, just in case the
186
186
  // exception is swallowed.
@@ -197,8 +197,8 @@ function w(t) {
197
197
  */;
198
198
  }
199
199
 
200
- function T(t, e) {
201
- t || S();
200
+ function S(t, e) {
201
+ t || T();
202
202
  }
203
203
 
204
204
  /**
@@ -225,7 +225,7 @@ e) {
225
225
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
226
226
  * See the License for the specific language governing permissions and
227
227
  * limitations under the License.
228
- */ var I = "cancelled", A = "unknown", V = "invalid-argument", D = "deadline-exceeded", k = "not-found", P = "permission-denied", N = "unauthenticated", F = "resource-exhausted", O = "failed-precondition", q = "aborted", j = "out-of-range", L = "unimplemented", R = "internal", U = "unavailable", x = /** @class */ function(e) {
228
+ */ var I = "cancelled", A = "unknown", k = "invalid-argument", V = "deadline-exceeded", D = "not-found", P = "permission-denied", F = "unauthenticated", N = "resource-exhausted", q = "failed-precondition", O = "aborted", C = "out-of-range", j = "unimplemented", L = "internal", R = "unavailable", M = /** @class */ function(e) {
229
229
  /** @hideconstructor */
230
230
  function n(
231
231
  /**
@@ -248,16 +248,14 @@ e) {
248
248
  }, r;
249
249
  }
250
250
  return t(n, e), n;
251
- }(Error), B = function() {
251
+ }(Error), U = function() {
252
252
  var t = this;
253
253
  this.promise = new Promise((function(e, n) {
254
254
  t.resolve = e, t.reject = n;
255
255
  }));
256
- }, C = function(t, e) {
257
- this.user = e, this.type = "OAuth", this.authHeaders = {},
258
- // Set the headers using Object Literal notation to avoid minification
259
- this.authHeaders.Authorization = "Bearer " + t;
260
- }, M = /** @class */ function() {
256
+ }, x = function(t, e) {
257
+ this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", "Bearer " + t);
258
+ }, B = /** @class */ function() {
261
259
  function t() {}
262
260
  return t.prototype.getToken = function() {
263
261
  return Promise.resolve(null);
@@ -289,7 +287,7 @@ e) {
289
287
  }, t.prototype.shutdown = function() {
290
288
  this.changeListener = null;
291
289
  }, t;
292
- }(), Q = /** @class */ function() {
290
+ }(), z = /** @class */ function() {
293
291
  function t(t) {
294
292
  var e = this;
295
293
  this.auth = null, t.onInit((function(t) {
@@ -299,32 +297,20 @@ e) {
299
297
  return t.prototype.getToken = function() {
300
298
  var t = this;
301
299
  return this.auth ? this.auth.getToken().then((function(e) {
302
- return e ? (T("string" == typeof e.accessToken), new C(e.accessToken, new d(t.auth.getUid()))) : null;
300
+ return e ? (S("string" == typeof e.accessToken), new x(e.accessToken, new d(t.auth.getUid()))) : null;
303
301
  })) : Promise.resolve(null);
304
302
  }, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {},
305
303
  t.prototype.shutdown = function() {}, t;
306
- }(), z = /** @class */ function() {
307
- function t(t, e, n) {
308
- this.t = t, this.i = e, this.o = n, this.type = "FirstParty", this.user = d.FIRST_PARTY;
309
- }
310
- return Object.defineProperty(t.prototype, "authHeaders", {
311
- get: function() {
312
- var t = {
313
- "X-Goog-AuthUser": this.i
314
- }, e = this.t.auth.getAuthHeaderValueForFirstParty([]);
315
- // Use array notation to prevent minification
316
- return e && (t.Authorization = e), this.o && (t["X-Goog-Iam-Authorization-Token"] = this.o),
317
- t;
318
- },
319
- enumerable: !1,
320
- configurable: !0
321
- }), t;
322
- }(), H = /** @class */ function() {
304
+ }(), Q = function(t, e, n) {
305
+ this.type = "FirstParty", this.user = d.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", e);
306
+ var r = t.auth.getAuthHeaderValueForFirstParty([]);
307
+ r && this.headers.set("Authorization", r), n && this.headers.set("X-Goog-Iam-Authorization-Token", n);
308
+ }, K = /** @class */ function() {
323
309
  function t(t, e, n) {
324
310
  this.t = t, this.i = e, this.o = n;
325
311
  }
326
312
  return t.prototype.getToken = function() {
327
- return Promise.resolve(new z(this.t, this.i, this.o));
313
+ return Promise.resolve(new Q(this.t, this.i, this.o));
328
314
  }, t.prototype.start = function(t, e) {
329
315
  // Fire with initial uid.
330
316
  t.enqueueRetryable((function() {
@@ -332,7 +318,22 @@ e) {
332
318
  }));
333
319
  }, t.prototype.shutdown = function() {}, t.prototype.invalidateToken = function() {},
334
320
  t;
335
- }(), K =
321
+ }(), H = function(t) {
322
+ this.value = t, this.type = "AppCheck", this.headers = new Map, t && t.length > 0 && this.headers.set("x-firebase-appcheck", this.value);
323
+ }, W = /** @class */ function() {
324
+ function t(t) {
325
+ var e = this;
326
+ this.u = t, this.appCheck = null, t.onInit((function(t) {
327
+ e.appCheck = t;
328
+ }));
329
+ }
330
+ return t.prototype.getToken = function() {
331
+ return this.appCheck ? this.appCheck.getToken().then((function(t) {
332
+ return t ? (S("string" == typeof t.token), new H(t.token)) : null;
333
+ })) : Promise.resolve(null);
334
+ }, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {},
335
+ t.prototype.shutdown = function() {}, t;
336
+ }(), Y =
336
337
  /**
337
338
  * Constructs a DatabaseInfo using the provided host, databaseId and
338
339
  * persistenceKey.
@@ -353,7 +354,7 @@ e) {
353
354
  function(t, e, n, r, i, o, a, s) {
354
355
  this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = i,
355
356
  this.forceLongPolling = o, this.autoDetectLongPolling = a, this.useFetchStreams = s;
356
- }, W = /** @class */ function() {
357
+ }, $ = /** @class */ function() {
357
358
  function t(t, e) {
358
359
  this.projectId = t, this.database = e || "(default)";
359
360
  }
@@ -366,9 +367,9 @@ function(t, e, n, r, i, o, a, s) {
366
367
  }), t.prototype.isEqual = function(e) {
367
368
  return e instanceof t && e.projectId === this.projectId && e.database === this.database;
368
369
  }, t;
369
- }(), Y = /** @class */ function() {
370
+ }(), X = /** @class */ function() {
370
371
  function t(t, e, n) {
371
- void 0 === e ? e = 0 : e > t.length && S(), void 0 === n ? n = t.length - e : n > t.length - e && S(),
372
+ void 0 === e ? e = 0 : e > t.length && T(), void 0 === n ? n = t.length - e : n > t.length - e && T(),
372
373
  this.segments = t, this.offset = e, this.len = n;
373
374
  }
374
375
  return Object.defineProperty(t.prototype, "length", {
@@ -419,7 +420,7 @@ function(t, e, n, r, i, o, a, s) {
419
420
  }
420
421
  return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;
421
422
  }, t;
422
- }(), X = /** @class */ function(e) {
423
+ }(), J = /** @class */ function(e) {
423
424
  function n() {
424
425
  return null !== e && e.apply(this, arguments) || this;
425
426
  }
@@ -445,7 +446,7 @@ function(t, e, n, r, i, o, a, s) {
445
446
  // for legacy reasons and should not be used frequently).
446
447
  for (var r = [], i = 0, o = t; i < o.length; i++) {
447
448
  var a = o[i];
448
- if (a.indexOf("//") >= 0) throw new x(V, "Invalid segment (" + a + "). Paths must not contain // in them.");
449
+ if (a.indexOf("//") >= 0) throw new M(k, "Invalid segment (" + a + "). Paths must not contain // in them.");
449
450
  // Strip leading and traling slashed.
450
451
  r.push.apply(r, a.split("/").filter((function(t) {
451
452
  return t.length > 0;
@@ -455,7 +456,7 @@ function(t, e, n, r, i, o, a, s) {
455
456
  }, n.emptyPath = function() {
456
457
  return new n([]);
457
458
  }, n;
458
- }(Y), $ = /^[_a-zA-Z][_a-zA-Z0-9]*$/, J = /** @class */ function(e) {
459
+ }(X), Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/, tt = /** @class */ function(e) {
459
460
  function n() {
460
461
  return null !== e && e.apply(this, arguments) || this;
461
462
  }
@@ -467,7 +468,7 @@ function(t, e, n, r, i, o, a, s) {
467
468
  * without escaping.
468
469
  */
469
470
  n.isValidIdentifier = function(t) {
470
- return $.test(t);
471
+ return Z.test(t);
471
472
  }, n.prototype.canonicalString = function() {
472
473
  return this.toArray().map((function(t) {
473
474
  return t = t.replace(/\\/g, "\\\\").replace(/`/g, "\\`"), n.isValidIdentifier(t) || (t = "`" + t + "`"),
@@ -500,39 +501,39 @@ function(t, e, n, r, i, o, a, s) {
500
501
  */
501
502
  n.fromServerFormat = function(t) {
502
503
  for (var e = [], r = "", i = 0, o = function() {
503
- if (0 === r.length) throw new x(V, "Invalid field path (" + t + "). Paths must not be empty, begin with '.', end with '.', or contain '..'");
504
+ if (0 === r.length) throw new M(k, "Invalid field path (" + t + "). Paths must not be empty, begin with '.', end with '.', or contain '..'");
504
505
  e.push(r), r = "";
505
506
  }, a = !1; i < t.length; ) {
506
507
  var s = t[i];
507
508
  if ("\\" === s) {
508
- if (i + 1 === t.length) throw new x(V, "Path has trailing escape character: " + t);
509
+ if (i + 1 === t.length) throw new M(k, "Path has trailing escape character: " + t);
509
510
  var u = t[i + 1];
510
- if ("\\" !== u && "." !== u && "`" !== u) throw new x(V, "Path has invalid escape sequence: " + t);
511
+ if ("\\" !== u && "." !== u && "`" !== u) throw new M(k, "Path has invalid escape sequence: " + t);
511
512
  r += u, i += 2;
512
513
  } else "`" === s ? (a = !a, i++) : "." !== s || a ? (r += s, i++) : (o(), i++);
513
514
  }
514
- if (o(), a) throw new x(V, "Unterminated ` in path: " + t);
515
+ if (o(), a) throw new M(k, "Unterminated ` in path: " + t);
515
516
  return new n(e);
516
517
  }, n.emptyPath = function() {
517
518
  return new n([]);
518
519
  }, n;
519
- }(Y), Z = /** @class */ function() {
520
+ }(X), et = /** @class */ function() {
520
521
  function t(t) {
521
522
  this.path = t;
522
523
  }
523
524
  return t.fromPath = function(e) {
524
- return new t(X.fromString(e));
525
+ return new t(J.fromString(e));
525
526
  }, t.fromName = function(e) {
526
- return new t(X.fromString(e).popFirst(5));
527
+ return new t(J.fromString(e).popFirst(5));
527
528
  },
528
529
  /** Returns true if the document is in the specified collectionId. */ t.prototype.hasCollectionId = function(t) {
529
530
  return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
530
531
  }, t.prototype.isEqual = function(t) {
531
- return null !== t && 0 === X.comparator(this.path, t.path);
532
+ return null !== t && 0 === J.comparator(this.path, t.path);
532
533
  }, t.prototype.toString = function() {
533
534
  return this.path.toString();
534
535
  }, t.comparator = function(t, e) {
535
- return X.comparator(t.path, e.path);
536
+ return J.comparator(t.path, e.path);
536
537
  }, t.isDocumentKey = function(t) {
537
538
  return t.length % 2 == 0;
538
539
  },
@@ -543,7 +544,7 @@ function(t, e, n, r, i, o, a, s) {
543
544
  * @returns A new instance of DocumentKey
544
545
  */
545
546
  t.fromSegments = function(e) {
546
- return new t(new X(e.slice()));
547
+ return new t(new J(e.slice()));
547
548
  }, t;
548
549
  }();
549
550
 
@@ -564,8 +565,8 @@ function(t, e, n, r, i, o, a, s) {
564
565
  * See the License for the specific language governing permissions and
565
566
  * limitations under the License.
566
567
  */
567
- function tt(t, e, n) {
568
- if (!n) throw new x(V, "Function " + t + "() cannot be called with an empty " + e + ".");
568
+ function nt(t, e, n) {
569
+ if (!n) throw new M(k, "Function " + t + "() cannot be called with an empty " + e + ".");
569
570
  }
570
571
 
571
572
  /**
@@ -575,22 +576,22 @@ function tt(t, e, n) {
575
576
  /**
576
577
  * Validates that `path` refers to a document (indicated by the fact it contains
577
578
  * an even numbers of segments).
578
- */ function et(t) {
579
- if (!Z.isDocumentKey(t)) throw new x(V, "Invalid document reference. Document references must have an even number of segments, but " + t + " has " + t.length + ".");
579
+ */ function rt(t) {
580
+ if (!et.isDocumentKey(t)) throw new M(k, "Invalid document reference. Document references must have an even number of segments, but " + t + " has " + t.length + ".");
580
581
  }
581
582
 
582
583
  /**
583
584
  * Validates that `path` refers to a collection (indicated by the fact it
584
585
  * contains an odd numbers of segments).
585
- */ function nt(t) {
586
- if (Z.isDocumentKey(t)) throw new x(V, "Invalid collection reference. Collection references must have an odd number of segments, but " + t + " has " + t.length + ".");
586
+ */ function it(t) {
587
+ if (et.isDocumentKey(t)) throw new M(k, "Invalid collection reference. Collection references must have an odd number of segments, but " + t + " has " + t.length + ".");
587
588
  }
588
589
 
589
590
  /**
590
591
  * Returns true if it's a non-null object without a custom prototype
591
592
  * (i.e. excludes Array, Date, etc.).
592
593
  */
593
- /** Returns a string describing the type / value of the provided input. */ function rt(t) {
594
+ /** Returns a string describing the type / value of the provided input. */ function ot(t) {
594
595
  if (void 0 === t) return "undefined";
595
596
  if (null === t) return "null";
596
597
  if ("string" == typeof t) return t.length > 20 && (t = t.substring(0, 20) + "..."),
@@ -605,25 +606,25 @@ function tt(t, e, n) {
605
606
  }(t);
606
607
  return e ? "a custom " + e + " object" : "an object";
607
608
  }
608
- return "function" == typeof t ? "a function" : S();
609
+ return "function" == typeof t ? "a function" : T();
609
610
  }
610
611
 
611
- function it(t,
612
+ function at(t,
612
613
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
613
614
  e) {
614
615
  if ("_delegate" in t && (
615
616
  // Unwrap Compat types
616
617
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
617
618
  t = t._delegate), !(t instanceof e)) {
618
- if (e.name === t.constructor.name) throw new x(V, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
619
- var n = rt(t);
620
- throw new x(V, "Expected type '" + e.name + "', but it was: " + n);
619
+ if (e.name === t.constructor.name) throw new M(k, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
620
+ var n = ot(t);
621
+ throw new M(k, "Expected type '" + e.name + "', but it was: " + n);
621
622
  }
622
623
  return t;
623
624
  }
624
625
 
625
- function ot(t, e) {
626
- if (e <= 0) throw new x(V, "Function " + t + "() requires a positive number, but it was: " + e + ".");
626
+ function st(t, e) {
627
+ if (e <= 0) throw new M(k, "Function " + t + "() requires a positive number, but it was: " + e + ".");
627
628
  }
628
629
 
629
630
  /**
@@ -644,11 +645,11 @@ function ot(t, e) {
644
645
  */
645
646
  /**
646
647
  * Returns whether a variable is either undefined or null.
647
- */ function at(t) {
648
+ */ function ut(t) {
648
649
  return null == t;
649
650
  }
650
651
 
651
- /** Returns whether the value represents -0. */ function st(t) {
652
+ /** Returns whether the value represents -0. */ function ct(t) {
652
653
  // Detect if the value is -0.0. Based on polyfill from
653
654
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
654
655
  return 0 === t && 1 / t == -1 / 0;
@@ -673,7 +674,7 @@ function ot(t, e) {
673
674
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
674
675
  * See the License for the specific language governing permissions and
675
676
  * limitations under the License.
676
- */ var ut, ct, ft = {
677
+ */ var lt, ft, ht = {
677
678
  BatchGetDocuments: "batchGet",
678
679
  Commit: "commit",
679
680
  RunQuery: "runQuery"
@@ -717,7 +718,7 @@ function ot(t, e) {
717
718
  * @returns The equivalent Code. Unknown status codes are mapped to
718
719
  * Code.UNKNOWN.
719
720
  */
720
- function lt(t) {
721
+ function pt(t) {
721
722
  if (void 0 === t) return w("RPC_ERROR", "HTTP error has no status"), A;
722
723
  // The canonical error codes for Google APIs [1] specify mapping onto HTTP
723
724
  // status codes but the mapping is not bijective. In each case of ambiguity
@@ -731,14 +732,14 @@ function lt(t) {
731
732
 
732
733
  case 400:
733
734
  // Bad Request
734
- return O;
735
+ return q;
735
736
 
736
737
  // Other possibilities based on the forward mapping
737
738
  // return Code.INVALID_ARGUMENT;
738
739
  // return Code.OUT_OF_RANGE;
739
740
  case 401:
740
741
  // Unauthorized
741
- return N;
742
+ return F;
742
743
 
743
744
  case 403:
744
745
  // Forbidden
@@ -746,21 +747,21 @@ function lt(t) {
746
747
 
747
748
  case 404:
748
749
  // Not Found
749
- return k;
750
+ return D;
750
751
 
751
752
  case 409:
752
753
  // Conflict
753
- return q;
754
+ return O;
754
755
 
755
756
  // Other possibilities:
756
757
  // return Code.ALREADY_EXISTS;
757
758
  case 416:
758
759
  // Range Not Satisfiable
759
- return j;
760
+ return C;
760
761
 
761
762
  case 429:
762
763
  // Too Many Requests
763
- return F;
764
+ return N;
764
765
 
765
766
  case 499:
766
767
  // Client Closed Request
@@ -775,18 +776,18 @@ function lt(t) {
775
776
  // return Code.DATA_LOSS;
776
777
  case 501:
777
778
  // Unimplemented
778
- return L;
779
+ return j;
779
780
 
780
781
  case 503:
781
782
  // Service Unavailable
782
- return U;
783
+ return R;
783
784
 
784
785
  case 504:
785
786
  // Gateway Timeout
786
- return D;
787
+ return V;
787
788
 
788
789
  default:
789
- return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ? O : t >= 500 && t < 600 ? R : A;
790
+ return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ? q : t >= 500 && t < 600 ? L : A;
790
791
  }
791
792
  }
792
793
 
@@ -809,31 +810,31 @@ function lt(t) {
809
810
  /**
810
811
  * A Rest-based connection that relies on the native HTTP stack
811
812
  * (e.g. `fetch` or a polyfill).
812
- */ (ct = ut || (ut = {}))[ct.OK = 0] = "OK", ct[ct.CANCELLED = 1] = "CANCELLED",
813
- ct[ct.UNKNOWN = 2] = "UNKNOWN", ct[ct.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
814
- ct[ct.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ct[ct.NOT_FOUND = 5] = "NOT_FOUND",
815
- ct[ct.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ct[ct.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
816
- ct[ct.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ct[ct.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
817
- ct[ct.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ct[ct.ABORTED = 10] = "ABORTED",
818
- ct[ct.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ct[ct.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
819
- ct[ct.INTERNAL = 13] = "INTERNAL", ct[ct.UNAVAILABLE = 14] = "UNAVAILABLE", ct[ct.DATA_LOSS = 15] = "DATA_LOSS";
820
-
821
- var ht = /** @class */ function(r) {
813
+ */ (ft = lt || (lt = {}))[ft.OK = 0] = "OK", ft[ft.CANCELLED = 1] = "CANCELLED",
814
+ ft[ft.UNKNOWN = 2] = "UNKNOWN", ft[ft.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
815
+ ft[ft.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ft[ft.NOT_FOUND = 5] = "NOT_FOUND",
816
+ ft[ft.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ft[ft.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
817
+ ft[ft.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ft[ft.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
818
+ ft[ft.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ft[ft.ABORTED = 10] = "ABORTED",
819
+ ft[ft.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ft[ft.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
820
+ ft[ft.INTERNAL = 13] = "INTERNAL", ft[ft.UNAVAILABLE = 14] = "UNAVAILABLE", ft[ft.DATA_LOSS = 15] = "DATA_LOSS";
821
+
822
+ var dt = /** @class */ function(r) {
822
823
  /**
823
824
  * @param databaseInfo - The connection info.
824
825
  * @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
825
826
  */
826
827
  function i(t, e) {
827
828
  var n = this;
828
- return (n = r.call(this, t) || this).T = e, n;
829
+ return (n = r.call(this, t) || this).I = e, n;
829
830
  }
830
831
  /**
831
832
  * Base class for all Rest-based connections to the backend (WebChannel and
832
833
  * HTTP).
833
834
  */
834
- return t(i, r), i.prototype.I = function(t, e) {
835
+ return t(i, r), i.prototype.A = function(t, e) {
835
836
  throw new Error("Not supported by FetchConnection");
836
- }, i.prototype.g = function(t, r, i, o) {
837
+ }, i.prototype.v = function(t, r, i, o) {
837
838
  return e(this, void 0, void 0, (function() {
838
839
  var t, e, a;
839
840
  return n(this, (function(n) {
@@ -842,7 +843,7 @@ var ht = /** @class */ function(r) {
842
843
  t = JSON.stringify(o), n.label = 1;
843
844
 
844
845
  case 1:
845
- return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.T(r, {
846
+ return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.I(r, {
846
847
  method: "POST",
847
848
  headers: i,
848
849
  body: t
@@ -852,10 +853,10 @@ var ht = /** @class */ function(r) {
852
853
  return e = n.sent(), [ 3 /*break*/ , 4 ];
853
854
 
854
855
  case 3:
855
- throw a = n.sent(), new x(lt(a.status), "Request failed with error: " + a.statusText);
856
+ throw a = n.sent(), new M(pt(a.status), "Request failed with error: " + a.statusText);
856
857
 
857
858
  case 4:
858
- if (!e.ok) throw new x(lt(e.status), "Request failed with error: " + e.statusText);
859
+ if (!e.ok) throw new M(pt(e.status), "Request failed with error: " + e.statusText);
859
860
  return [ 2 /*return*/ , e.json() ];
860
861
  }
861
862
  }));
@@ -865,38 +866,42 @@ var ht = /** @class */ function(r) {
865
866
  function t(t) {
866
867
  this.databaseInfo = t, this.databaseId = t.databaseId;
867
868
  var e = t.ssl ? "https" : "http";
868
- this.u = e + "://" + t.host, this.h = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
869
+ this.h = e + "://" + t.host, this.l = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
869
870
  }
870
- return t.prototype.l = function(t, e, n, r) {
871
- var i = this.m(t, e);
872
- g("RestConnection", "Sending: ", i, n);
873
- var o = {};
874
- return this.p(o, r), this.g(t, i, o, n).then((function(t) {
871
+ return t.prototype.m = function(t, e, n, r, i) {
872
+ var o = this.p(t, e);
873
+ g("RestConnection", "Sending: ", o, n);
874
+ var a = {};
875
+ return this.g(a, r, i), this.v(t, o, a, n).then((function(t) {
875
876
  return g("RestConnection", "Received: ", t), t;
876
877
  }), (function(e) {
877
- throw b("RestConnection", t + " failed with error: ", e, "url: ", i, "request:", n),
878
+ throw b("RestConnection", t + " failed with error: ", e, "url: ", o, "request:", n),
878
879
  e;
879
880
  }));
880
- }, t.prototype.v = function(t, e, n, r) {
881
+ }, t.prototype.T = function(t, e, n, r, i) {
881
882
  // The REST API automatically aggregates all of the streamed results, so we
882
883
  // can just use the normal invoke() method.
883
- return this.l(t, e, n, r);
884
+ return this.m(t, e, n, r, i);
884
885
  },
885
886
  /**
886
887
  * Modifies the headers for a request, adding any authorization token if
887
888
  * present and any additional headers for the request.
888
889
  */
889
- t.prototype.p = function(t, e) {
890
- if (t["X-Goog-Api-Client"] = "gl-js/ fire/" + m,
890
+ t.prototype.g = function(t, e, n) {
891
+ t["X-Goog-Api-Client"] = "gl-js/ fire/" + m,
891
892
  // Content-Type: text/plain will avoid preflight requests which might
892
893
  // mess with CORS and redirects by proxies. If we add custom headers
893
894
  // we will need to change this code to potentially use the $httpOverwrite
894
895
  // parameter supported by ESF to avoid triggering preflight requests.
895
896
  t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId),
896
- e) for (var n in e.authHeaders) e.authHeaders.hasOwnProperty(n) && (t[n] = e.authHeaders[n]);
897
- }, t.prototype.m = function(t, e) {
898
- var n = ft[t];
899
- return this.u + "/v1/" + e + ":" + n;
897
+ e && e.headers.forEach((function(e, n) {
898
+ return t[n] = e;
899
+ })), n && n.headers.forEach((function(e, n) {
900
+ return t[n] = e;
901
+ }));
902
+ }, t.prototype.p = function(t, e) {
903
+ var n = ht[t];
904
+ return this.h + "/v1/" + e + ":" + n;
900
905
  }, t;
901
906
  }());
902
907
 
@@ -937,7 +942,7 @@ var ht = /** @class */ function(r) {
937
942
  * Generates `nBytes` of random bytes.
938
943
  *
939
944
  * If `nBytes < 0` , an error will be thrown.
940
- */ function pt(t) {
945
+ */ function mt(t) {
941
946
  // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
942
947
  var e =
943
948
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -963,14 +968,14 @@ var ht = /** @class */ function(r) {
963
968
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
964
969
  * See the License for the specific language governing permissions and
965
970
  * limitations under the License.
966
- */ var dt = /** @class */ function() {
971
+ */ var yt = /** @class */ function() {
967
972
  function t() {}
968
- return t.A = function() {
973
+ return t.P = function() {
969
974
  for (
970
975
  // Alphanumeric characters
971
976
  var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length, n = ""
972
977
  // The largest byte value that is a multiple of `char.length`.
973
- ; n.length < 20; ) for (var r = pt(40), i = 0; i < r.length; ++i)
978
+ ; n.length < 20; ) for (var r = mt(40), i = 0; i < r.length; ++i)
974
979
  // Only accept values that are [0, maxMultiple), this ensures they can
975
980
  // be evenly mapped to indices of `chars` via a modulo operation.
976
981
  n.length < 20 && r[i] < e && (n += t.charAt(r[i] % t.length));
@@ -978,11 +983,11 @@ var ht = /** @class */ function(r) {
978
983
  }, t;
979
984
  }();
980
985
 
981
- function mt(t, e) {
986
+ function vt(t, e) {
982
987
  return t < e ? -1 : t > e ? 1 : 0;
983
988
  }
984
989
 
985
- /** Helper to compare arrays using isEqual(). */ function yt(t, e, n) {
990
+ /** Helper to compare arrays using isEqual(). */ function gt(t, e, n) {
986
991
  return t.length === e.length && t.every((function(t, r) {
987
992
  return n(t, e[r]);
988
993
  }));
@@ -1018,7 +1023,7 @@ function mt(t, e) {
1018
1023
  *
1019
1024
  * For examples and further specifications, refer to the
1020
1025
  * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
1021
- */ var vt = /** @class */ function() {
1026
+ */ var wt = /** @class */ function() {
1022
1027
  /**
1023
1028
  * Creates a new timestamp.
1024
1029
  *
@@ -1039,11 +1044,11 @@ function mt(t, e) {
1039
1044
  * The fractions of a second at nanosecond resolution.*
1040
1045
  */
1041
1046
  e) {
1042
- if (this.seconds = t, this.nanoseconds = e, e < 0) throw new x(V, "Timestamp nanoseconds out of range: " + e);
1043
- if (e >= 1e9) throw new x(V, "Timestamp nanoseconds out of range: " + e);
1044
- if (t < -62135596800) throw new x(V, "Timestamp seconds out of range: " + t);
1047
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new M(k, "Timestamp nanoseconds out of range: " + e);
1048
+ if (e >= 1e9) throw new M(k, "Timestamp nanoseconds out of range: " + e);
1049
+ if (t < -62135596800) throw new M(k, "Timestamp seconds out of range: " + t);
1045
1050
  // This will break in the year 10,000.
1046
- if (t >= 253402300800) throw new x(V, "Timestamp seconds out of range: " + t);
1051
+ if (t >= 253402300800) throw new M(k, "Timestamp seconds out of range: " + t);
1047
1052
  }
1048
1053
  /**
1049
1054
  * Creates a new timestamp with the current date, with millisecond precision.
@@ -1095,7 +1100,7 @@ function mt(t, e) {
1095
1100
  t.prototype.toMillis = function() {
1096
1101
  return 1e3 * this.seconds + this.nanoseconds / 1e6;
1097
1102
  }, t.prototype._compareTo = function(t) {
1098
- return this.seconds === t.seconds ? mt(this.nanoseconds, t.nanoseconds) : mt(this.seconds, t.seconds);
1103
+ return this.seconds === t.seconds ? vt(this.nanoseconds, t.nanoseconds) : vt(this.seconds, t.seconds);
1099
1104
  },
1100
1105
  /**
1101
1106
  * Returns true if this `Timestamp` is equal to the provided one.
@@ -1132,14 +1137,14 @@ function mt(t, e) {
1132
1137
  // 'seconds' values.
1133
1138
  return String(t).padStart(12, "0") + "." + String(this.nanoseconds).padStart(9, "0");
1134
1139
  }, t;
1135
- }(), gt = /** @class */ function() {
1140
+ }(), bt = /** @class */ function() {
1136
1141
  function t(t) {
1137
1142
  this.timestamp = t;
1138
1143
  }
1139
1144
  return t.fromTimestamp = function(e) {
1140
1145
  return new t(e);
1141
1146
  }, t.min = function() {
1142
- return new t(new vt(0, 0));
1147
+ return new t(new wt(0, 0));
1143
1148
  }, t.prototype.compareTo = function(t) {
1144
1149
  return this.timestamp._compareTo(t.timestamp);
1145
1150
  }, t.prototype.isEqual = function(t) {
@@ -1191,13 +1196,13 @@ function mt(t, e) {
1191
1196
  * See the License for the specific language governing permissions and
1192
1197
  * limitations under the License.
1193
1198
  */
1194
- function wt(t) {
1199
+ function _t(t) {
1195
1200
  var e = 0;
1196
1201
  for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
1197
1202
  return e;
1198
1203
  }
1199
1204
 
1200
- function bt(t, e) {
1205
+ function Tt(t, e) {
1201
1206
  for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
1202
1207
  }
1203
1208
 
@@ -1226,12 +1231,12 @@ function bt(t, e) {
1226
1231
  * foo.bar - Overwrites only the field bar of the object foo.
1227
1232
  * If foo is not an object, foo is replaced with an object
1228
1233
  * containing foo
1229
- */ var _t = /** @class */ function() {
1234
+ */ var St = /** @class */ function() {
1230
1235
  function t(t) {
1231
1236
  this.fields = t,
1232
1237
  // TODO(dimond): validation of FieldMask
1233
1238
  // Sort the field mask to support `FieldMask.isEqual()` and assert below.
1234
- t.sort(J.comparator)
1239
+ t.sort(tt.comparator)
1235
1240
  /**
1236
1241
  * Verifies that `fieldPath` is included by at least one field in this field
1237
1242
  * mask.
@@ -1245,11 +1250,11 @@ function bt(t, e) {
1245
1250
  }
1246
1251
  return !1;
1247
1252
  }, t.prototype.isEqual = function(t) {
1248
- return yt(this.fields, t.fields, (function(t, e) {
1253
+ return gt(this.fields, t.fields, (function(t, e) {
1249
1254
  return t.isEqual(e);
1250
1255
  }));
1251
1256
  }, t;
1252
- }(), St = /** @class */ function() {
1257
+ }(), Et = /** @class */ function() {
1253
1258
  function t(t) {
1254
1259
  this.binaryString = t;
1255
1260
  }
@@ -1276,7 +1281,7 @@ function bt(t, e) {
1276
1281
  }, t.prototype.approximateByteSize = function() {
1277
1282
  return 2 * this.binaryString.length;
1278
1283
  }, t.prototype.compareTo = function(t) {
1279
- return mt(this.binaryString, t.binaryString);
1284
+ return vt(this.binaryString, t.binaryString);
1280
1285
  }, t.prototype.isEqual = function(t) {
1281
1286
  return this.binaryString === t.binaryString;
1282
1287
  }, t;
@@ -1323,23 +1328,23 @@ function bt(t, e) {
1323
1328
  * the proto byte string in a common class that must be converted into a string
1324
1329
  * before being sent as a proto.
1325
1330
  * @internal
1326
- */ St.EMPTY_BYTE_STRING = new St("");
1331
+ */ Et.EMPTY_BYTE_STRING = new Et("");
1327
1332
 
1328
- var Tt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1333
+ var It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1329
1334
 
1330
1335
  /**
1331
1336
  * Converts the possible Proto values for a timestamp value into a "seconds and
1332
1337
  * nanos" representation.
1333
- */ function Et(t) {
1338
+ */ function At(t) {
1334
1339
  // The json interface (for the browser) will return an iso timestamp string,
1335
1340
  // while the proto js library (for node) will return a
1336
1341
  // google.protobuf.Timestamp instance.
1337
- if (T(!!t), "string" == typeof t) {
1342
+ if (S(!!t), "string" == typeof t) {
1338
1343
  // The date string can have higher precision (nanos) than the Date class
1339
1344
  // (millis), so we do some custom parsing here.
1340
1345
  // Parse the nanos right out of the string.
1341
- var e = 0, n = Tt.exec(t);
1342
- if (T(!!n), n[1]) {
1346
+ var e = 0, n = It.exec(t);
1347
+ if (S(!!n), n[1]) {
1343
1348
  // Pad the fraction out to 9 digits (nanos).
1344
1349
  var r = n[1];
1345
1350
  r = (r + "000000000").substr(0, 9), e = Number(r);
@@ -1352,21 +1357,21 @@ var Tt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1352
1357
  };
1353
1358
  }
1354
1359
  return {
1355
- seconds: It(t.seconds),
1356
- nanos: It(t.nanos)
1360
+ seconds: kt(t.seconds),
1361
+ nanos: kt(t.nanos)
1357
1362
  };
1358
1363
  }
1359
1364
 
1360
1365
  /**
1361
1366
  * Converts the possible Proto types for numbers into a JavaScript number.
1362
1367
  * Returns 0 if the value is not numeric.
1363
- */ function It(t) {
1368
+ */ function kt(t) {
1364
1369
  // TODO(bjornick): Handle int64 greater than 53 bits.
1365
1370
  return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
1366
1371
  }
1367
1372
 
1368
- /** Converts the possible Proto types for Blobs into a ByteString. */ function At(t) {
1369
- return "string" == typeof t ? St.fromBase64String(t) : St.fromUint8Array(t);
1373
+ /** Converts the possible Proto types for Blobs into a ByteString. */ function Vt(t) {
1374
+ return "string" == typeof t ? Et.fromBase64String(t) : Et.fromUint8Array(t);
1370
1375
  }
1371
1376
 
1372
1377
  /**
@@ -1402,7 +1407,7 @@ var Tt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1402
1407
  * FieldValueOptions to value().
1403
1408
  * - With respect to other ServerTimestampValues, they sort by their
1404
1409
  * localWriteTime.
1405
- */ function Vt(t) {
1410
+ */ function Dt(t) {
1406
1411
  var e, n;
1407
1412
  return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
1408
1413
  }
@@ -1412,16 +1417,16 @@ var Tt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1412
1417
  *
1413
1418
  * Preserving the previous values allows the user to display the last resoled
1414
1419
  * value until the backend responds with the timestamp.
1415
- */ function Dt(t) {
1420
+ */ function Pt(t) {
1416
1421
  var e = t.mapValue.fields.__previous_value__;
1417
- return Vt(e) ? Dt(e) : e;
1422
+ return Dt(e) ? Pt(e) : e;
1418
1423
  }
1419
1424
 
1420
1425
  /**
1421
1426
  * Returns the local time at which this timestamp was first set.
1422
- */ function kt(t) {
1423
- var e = Et(t.mapValue.fields.__local_write_time__.timestampValue);
1424
- return new vt(e.seconds, e.nanos);
1427
+ */ function Ft(t) {
1428
+ var e = At(t.mapValue.fields.__local_write_time__.timestampValue);
1429
+ return new wt(e.seconds, e.nanos);
1425
1430
  }
1426
1431
 
1427
1432
  /**
@@ -1440,13 +1445,13 @@ var Tt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1440
1445
  * See the License for the specific language governing permissions and
1441
1446
  * limitations under the License.
1442
1447
  */
1443
- /** Extracts the backend's type order for the provided value. */ function Pt(t) {
1444
- return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Vt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : S();
1448
+ /** Extracts the backend's type order for the provided value. */ function Nt(t) {
1449
+ return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Dt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : T();
1445
1450
  }
1446
1451
 
1447
- /** Tests `left` and `right` for equality based on the backend semantics. */ function Nt(t, e) {
1448
- var n = Pt(t);
1449
- if (n !== Pt(e)) return !1;
1452
+ /** Tests `left` and `right` for equality based on the backend semantics. */ function qt(t, e) {
1453
+ var n = Nt(t);
1454
+ if (n !== Nt(e)) return !1;
1450
1455
  switch (n) {
1451
1456
  case 0 /* NullValue */ :
1452
1457
  return !0;
@@ -1455,14 +1460,14 @@ var Tt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1455
1460
  return t.booleanValue === e.booleanValue;
1456
1461
 
1457
1462
  case 4 /* ServerTimestampValue */ :
1458
- return kt(t).isEqual(kt(e));
1463
+ return Ft(t).isEqual(Ft(e));
1459
1464
 
1460
1465
  case 3 /* TimestampValue */ :
1461
1466
  return function(t, e) {
1462
1467
  if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
1463
1468
  // Use string equality for ISO 8601 timestamps
1464
1469
  return t.timestampValue === e.timestampValue;
1465
- var n = Et(t.timestampValue), r = Et(e.timestampValue);
1470
+ var n = At(t.timestampValue), r = At(e.timestampValue);
1466
1471
  return n.seconds === r.seconds && n.nanos === r.nanos;
1467
1472
  }(t, e);
1468
1473
 
@@ -1471,7 +1476,7 @@ var Tt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1471
1476
 
1472
1477
  case 6 /* BlobValue */ :
1473
1478
  return function(t, e) {
1474
- return At(t.bytesValue).isEqual(At(e.bytesValue));
1479
+ return Vt(t.bytesValue).isEqual(Vt(e.bytesValue));
1475
1480
  }(t, e);
1476
1481
 
1477
1482
  case 7 /* RefValue */ :
@@ -1479,96 +1484,96 @@ var Tt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1479
1484
 
1480
1485
  case 8 /* GeoPointValue */ :
1481
1486
  return function(t, e) {
1482
- return It(t.geoPointValue.latitude) === It(e.geoPointValue.latitude) && It(t.geoPointValue.longitude) === It(e.geoPointValue.longitude);
1487
+ return kt(t.geoPointValue.latitude) === kt(e.geoPointValue.latitude) && kt(t.geoPointValue.longitude) === kt(e.geoPointValue.longitude);
1483
1488
  }(t, e);
1484
1489
 
1485
1490
  case 2 /* NumberValue */ :
1486
1491
  return function(t, e) {
1487
- if ("integerValue" in t && "integerValue" in e) return It(t.integerValue) === It(e.integerValue);
1492
+ if ("integerValue" in t && "integerValue" in e) return kt(t.integerValue) === kt(e.integerValue);
1488
1493
  if ("doubleValue" in t && "doubleValue" in e) {
1489
- var n = It(t.doubleValue), r = It(e.doubleValue);
1490
- return n === r ? st(n) === st(r) : isNaN(n) && isNaN(r);
1494
+ var n = kt(t.doubleValue), r = kt(e.doubleValue);
1495
+ return n === r ? ct(n) === ct(r) : isNaN(n) && isNaN(r);
1491
1496
  }
1492
1497
  return !1;
1493
1498
  }(t, e);
1494
1499
 
1495
1500
  case 9 /* ArrayValue */ :
1496
- return yt(t.arrayValue.values || [], e.arrayValue.values || [], Nt);
1501
+ return gt(t.arrayValue.values || [], e.arrayValue.values || [], qt);
1497
1502
 
1498
1503
  case 10 /* ObjectValue */ :
1499
1504
  return function(t, e) {
1500
1505
  var n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
1501
- if (wt(n) !== wt(r)) return !1;
1502
- for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !Nt(n[i], r[i]))) return !1;
1506
+ if (_t(n) !== _t(r)) return !1;
1507
+ for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !qt(n[i], r[i]))) return !1;
1503
1508
  return !0;
1504
1509
  }(t, e);
1505
1510
 
1506
1511
  default:
1507
- return S();
1512
+ return T();
1508
1513
  }
1509
1514
  }
1510
1515
 
1511
- function Ft(t, e) {
1516
+ function Ot(t, e) {
1512
1517
  return void 0 !== (t.values || []).find((function(t) {
1513
- return Nt(t, e);
1518
+ return qt(t, e);
1514
1519
  }));
1515
1520
  }
1516
1521
 
1517
- function Ot(t, e) {
1518
- var n = Pt(t), r = Pt(e);
1519
- if (n !== r) return mt(n, r);
1522
+ function Ct(t, e) {
1523
+ var n = Nt(t), r = Nt(e);
1524
+ if (n !== r) return vt(n, r);
1520
1525
  switch (n) {
1521
1526
  case 0 /* NullValue */ :
1522
1527
  return 0;
1523
1528
 
1524
1529
  case 1 /* BooleanValue */ :
1525
- return mt(t.booleanValue, e.booleanValue);
1530
+ return vt(t.booleanValue, e.booleanValue);
1526
1531
 
1527
1532
  case 2 /* NumberValue */ :
1528
1533
  return function(t, e) {
1529
- var n = It(t.integerValue || t.doubleValue), r = It(e.integerValue || e.doubleValue);
1534
+ var n = kt(t.integerValue || t.doubleValue), r = kt(e.integerValue || e.doubleValue);
1530
1535
  return n < r ? -1 : n > r ? 1 : n === r ? 0 :
1531
1536
  // one or both are NaN.
1532
1537
  isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
1533
1538
  }(t, e);
1534
1539
 
1535
1540
  case 3 /* TimestampValue */ :
1536
- return qt(t.timestampValue, e.timestampValue);
1541
+ return jt(t.timestampValue, e.timestampValue);
1537
1542
 
1538
1543
  case 4 /* ServerTimestampValue */ :
1539
- return qt(kt(t), kt(e));
1544
+ return jt(Ft(t), Ft(e));
1540
1545
 
1541
1546
  case 5 /* StringValue */ :
1542
- return mt(t.stringValue, e.stringValue);
1547
+ return vt(t.stringValue, e.stringValue);
1543
1548
 
1544
1549
  case 6 /* BlobValue */ :
1545
1550
  return function(t, e) {
1546
- var n = At(t), r = At(e);
1551
+ var n = Vt(t), r = Vt(e);
1547
1552
  return n.compareTo(r);
1548
1553
  }(t.bytesValue, e.bytesValue);
1549
1554
 
1550
1555
  case 7 /* RefValue */ :
1551
1556
  return function(t, e) {
1552
1557
  for (var n = t.split("/"), r = e.split("/"), i = 0; i < n.length && i < r.length; i++) {
1553
- var o = mt(n[i], r[i]);
1558
+ var o = vt(n[i], r[i]);
1554
1559
  if (0 !== o) return o;
1555
1560
  }
1556
- return mt(n.length, r.length);
1561
+ return vt(n.length, r.length);
1557
1562
  }(t.referenceValue, e.referenceValue);
1558
1563
 
1559
1564
  case 8 /* GeoPointValue */ :
1560
1565
  return function(t, e) {
1561
- var n = mt(It(t.latitude), It(e.latitude));
1562
- return 0 !== n ? n : mt(It(t.longitude), It(e.longitude));
1566
+ var n = vt(kt(t.latitude), kt(e.latitude));
1567
+ return 0 !== n ? n : vt(kt(t.longitude), kt(e.longitude));
1563
1568
  }(t.geoPointValue, e.geoPointValue);
1564
1569
 
1565
1570
  case 9 /* ArrayValue */ :
1566
1571
  return function(t, e) {
1567
1572
  for (var n = t.values || [], r = e.values || [], i = 0; i < n.length && i < r.length; ++i) {
1568
- var o = Ot(n[i], r[i]);
1573
+ var o = Ct(n[i], r[i]);
1569
1574
  if (o) return o;
1570
1575
  }
1571
- return mt(n.length, r.length);
1576
+ return vt(n.length, r.length);
1572
1577
  }(t.arrayValue, e.arrayValue);
1573
1578
 
1574
1579
  case 10 /* ObjectValue */ :
@@ -1580,36 +1585,36 @@ function Ot(t, e) {
1580
1585
  // canonical IDs are independent of insertion order.
1581
1586
  r.sort(), o.sort();
1582
1587
  for (var a = 0; a < r.length && a < o.length; ++a) {
1583
- var s = mt(r[a], o[a]);
1588
+ var s = vt(r[a], o[a]);
1584
1589
  if (0 !== s) return s;
1585
- var u = Ot(n[r[a]], i[o[a]]);
1590
+ var u = Ct(n[r[a]], i[o[a]]);
1586
1591
  if (0 !== u) return u;
1587
1592
  }
1588
- return mt(r.length, o.length);
1593
+ return vt(r.length, o.length);
1589
1594
  }(t.mapValue, e.mapValue);
1590
1595
 
1591
1596
  default:
1592
- throw S();
1597
+ throw T();
1593
1598
  }
1594
1599
  }
1595
1600
 
1596
- function qt(t, e) {
1597
- if ("string" == typeof t && "string" == typeof e && t.length === e.length) return mt(t, e);
1598
- var n = Et(t), r = Et(e), i = mt(n.seconds, r.seconds);
1599
- return 0 !== i ? i : mt(n.nanos, r.nanos);
1601
+ function jt(t, e) {
1602
+ if ("string" == typeof t && "string" == typeof e && t.length === e.length) return vt(t, e);
1603
+ var n = At(t), r = At(e), i = vt(n.seconds, r.seconds);
1604
+ return 0 !== i ? i : vt(n.nanos, r.nanos);
1600
1605
  }
1601
1606
 
1602
- function jt(t, e) {
1607
+ function Lt(t, e) {
1603
1608
  return {
1604
1609
  referenceValue: "projects/" + t.projectId + "/databases/" + t.database + "/documents/" + e.path.canonicalString()
1605
1610
  };
1606
1611
  }
1607
1612
 
1608
- /** Returns true if `value` is an ArrayValue. */ function Lt(t) {
1613
+ /** Returns true if `value` is an ArrayValue. */ function Rt(t) {
1609
1614
  return !!t && "arrayValue" in t;
1610
1615
  }
1611
1616
 
1612
- /** Returns true if `value` is a NullValue. */ function Rt(t) {
1617
+ /** Returns true if `value` is a NullValue. */ function Mt(t) {
1613
1618
  return !!t && "nullValue" in t;
1614
1619
  }
1615
1620
 
@@ -1634,7 +1639,7 @@ function jt(t, e) {
1634
1639
  fields: {}
1635
1640
  }
1636
1641
  };
1637
- return bt(t.mapValue.fields, (function(t, n) {
1642
+ return Tt(t.mapValue.fields, (function(t, n) {
1638
1643
  return e.mapValue.fields[t] = Bt(n);
1639
1644
  })), e;
1640
1645
  }
@@ -1668,7 +1673,7 @@ function jt(t, e) {
1668
1673
  /**
1669
1674
  * An ObjectValue represents a MapValue in the Firestore Proto and offers the
1670
1675
  * ability to add and remove fields (via the ObjectValueBuilder).
1671
- */ var Ct = /** @class */ function() {
1676
+ */ var Gt = /** @class */ function() {
1672
1677
  function t(t) {
1673
1678
  this.value = t;
1674
1679
  }
@@ -1703,7 +1708,7 @@ function jt(t, e) {
1703
1708
  * @param data - A map of fields to values (or null for deletes).
1704
1709
  */
1705
1710
  t.prototype.setAll = function(t) {
1706
- var e = this, n = J.emptyPath(), r = {}, i = [];
1711
+ var e = this, n = tt.emptyPath(), r = {}, i = [];
1707
1712
  t.forEach((function(t, o) {
1708
1713
  if (!n.isImmediateParentOf(o)) {
1709
1714
  // Insert the accumulated changes at this parent location
@@ -1725,7 +1730,7 @@ function jt(t, e) {
1725
1730
  var e = this.field(t.popLast());
1726
1731
  xt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
1727
1732
  }, t.prototype.isEqual = function(t) {
1728
- return Nt(this.value, t.value);
1733
+ return qt(this.value, t.value);
1729
1734
  },
1730
1735
  /**
1731
1736
  * Returns the map that contains the leaf element of `path`. If the parent
@@ -1751,7 +1756,7 @@ function jt(t, e) {
1751
1756
  * entries.
1752
1757
  */
1753
1758
  t.prototype.applyChanges = function(t, e, n) {
1754
- bt(e, (function(e, n) {
1759
+ Tt(e, (function(e, n) {
1755
1760
  return t[e] = n;
1756
1761
  }));
1757
1762
  for (var r = 0, i = n; r < i.length; r++) {
@@ -1761,7 +1766,7 @@ function jt(t, e) {
1761
1766
  }, t.prototype.clone = function() {
1762
1767
  return new t(Bt(this.value));
1763
1768
  }, t;
1764
- }(), Mt = /** @class */ function() {
1769
+ }(), zt = /** @class */ function() {
1765
1770
  function t(t, e, n, r, i) {
1766
1771
  this.key = t, this.documentType = e, this.version = n, this.data = r, this.documentState = i
1767
1772
  /**
@@ -1770,7 +1775,7 @@ function jt(t, e) {
1770
1775
  */;
1771
1776
  }
1772
1777
  return t.newInvalidDocument = function(e) {
1773
- return new t(e, 0 /* INVALID */ , gt.min(), Ct.empty(), 0 /* SYNCED */);
1778
+ return new t(e, 0 /* INVALID */ , bt.min(), Gt.empty(), 0 /* SYNCED */);
1774
1779
  },
1775
1780
  /**
1776
1781
  * Creates a new document that is known to exist with the given data at the
@@ -1780,7 +1785,7 @@ function jt(t, e) {
1780
1785
  return new t(e, 1 /* FOUND_DOCUMENT */ , n, r, 0 /* SYNCED */);
1781
1786
  },
1782
1787
  /** Creates a new document that is known to not exist at the given version. */ t.newNoDocument = function(e, n) {
1783
- return new t(e, 2 /* NO_DOCUMENT */ , n, Ct.empty(), 0 /* SYNCED */);
1788
+ return new t(e, 2 /* NO_DOCUMENT */ , n, Gt.empty(), 0 /* SYNCED */);
1784
1789
  },
1785
1790
  /**
1786
1791
  * Creates a new document that is known to exist at the given version but
@@ -1788,7 +1793,7 @@ function jt(t, e) {
1788
1793
  * base document).
1789
1794
  */
1790
1795
  t.newUnknownDocument = function(e, n) {
1791
- return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, Ct.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
1796
+ return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, Gt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
1792
1797
  },
1793
1798
  /**
1794
1799
  * Changes the document type to indicate that it exists and that its version
@@ -1803,7 +1808,7 @@ function jt(t, e) {
1803
1808
  * version.
1804
1809
  */
1805
1810
  t.prototype.convertToNoDocument = function(t) {
1806
- return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Ct.empty(),
1811
+ return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Gt.empty(),
1807
1812
  this.documentState = 0 /* SYNCED */ , this;
1808
1813
  },
1809
1814
  /**
@@ -1812,7 +1817,7 @@ function jt(t, e) {
1812
1817
  * base document).
1813
1818
  */
1814
1819
  t.prototype.convertToUnknownDocument = function(t) {
1815
- return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Ct.empty(),
1820
+ return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Gt.empty(),
1816
1821
  this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
1817
1822
  }, t.prototype.setHasCommittedMutations = function() {
1818
1823
  return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
@@ -1851,11 +1856,11 @@ function jt(t, e) {
1851
1856
  }, t.prototype.toString = function() {
1852
1857
  return "Document(" + this.key + ", " + this.version + ", " + JSON.stringify(this.data.value) + ", {documentType: " + this.documentType + "}), {documentState: " + this.documentState + "})";
1853
1858
  }, t;
1854
- }(), Gt = function(t, e, n, r, i, o, a) {
1859
+ }(), Qt = function(t, e, n, r, i, o, a) {
1855
1860
  void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
1856
1861
  void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
1857
1862
  this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i,
1858
- this.startAt = o, this.endAt = a, this.P = null;
1863
+ this.startAt = o, this.endAt = a, this.R = null;
1859
1864
  };
1860
1865
 
1861
1866
  /**
@@ -1892,13 +1897,13 @@ function jt(t, e) {
1892
1897
  * using this factory method, because `Query` provides an implicit `orderBy`
1893
1898
  * property.
1894
1899
  */
1895
- function Qt(t, e, n, r, i, o, a) {
1900
+ function Kt(t, e, n, r, i, o, a) {
1896
1901
  return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
1897
1902
  void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
1898
- new Gt(t, e, n, r, i, o, a);
1903
+ new Qt(t, e, n, r, i, o, a);
1899
1904
  }
1900
1905
 
1901
- var zt = /** @class */ function(e) {
1906
+ var Ht = /** @class */ function(e) {
1902
1907
  function n(t, n, r) {
1903
1908
  var i = this;
1904
1909
  return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i;
@@ -1906,15 +1911,15 @@ var zt = /** @class */ function(e) {
1906
1911
  /**
1907
1912
  * Creates a filter based on the provided arguments.
1908
1913
  */ return t(n, e), n.create = function(t, e, r) {
1909
- return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.R(t, e, r) : new Ht(t, e, r) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Xt(t, r) : "in" /* IN */ === e ? new $t(t, r) : "not-in" /* NOT_IN */ === e ? new Jt(t, r) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new Zt(t, r) : new n(t, e, r);
1910
- }, n.R = function(t, e, n) {
1911
- return "in" /* IN */ === e ? new Kt(t, n) : new Wt(t, n);
1914
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, r) : new Wt(t, e, r) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Jt(t, r) : "in" /* IN */ === e ? new Zt(t, r) : "not-in" /* NOT_IN */ === e ? new te(t, r) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ee(t, r) : new n(t, e, r);
1915
+ }, n.V = function(t, e, n) {
1916
+ return "in" /* IN */ === e ? new Yt(t, n) : new $t(t, n);
1912
1917
  }, n.prototype.matches = function(t) {
1913
1918
  var e = t.data.field(this.field);
1914
1919
  // Types do not have to match in NOT_EQUAL filters.
1915
- return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.V(Ot(e, this.value)) : null !== e && Pt(this.value) === Pt(e) && this.V(Ot(e, this.value));
1920
+ return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(Ct(e, this.value)) : null !== e && Nt(this.value) === Nt(e) && this.D(Ct(e, this.value));
1916
1921
  // Only compare types with matching backend order (such as double and int).
1917
- }, n.prototype.V = function(t) {
1922
+ }, n.prototype.D = function(t) {
1918
1923
  switch (this.op) {
1919
1924
  case "<" /* LESS_THAN */ :
1920
1925
  return t < 0;
@@ -1935,24 +1940,25 @@ var zt = /** @class */ function(e) {
1935
1940
  return t >= 0;
1936
1941
 
1937
1942
  default:
1938
- return S();
1943
+ return T();
1939
1944
  }
1940
- }, n.prototype.D = function() {
1945
+ }, n.prototype.N = function() {
1941
1946
  return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
1942
1947
  }, n;
1943
- }((function() {})), Ht = /** @class */ function(e) {
1948
+ }((function() {})), Wt = /** @class */ function(e) {
1944
1949
  function n(t, n, r) {
1945
1950
  var i = this;
1946
- return (i = e.call(this, t, n, r) || this).key = Z.fromName(r.referenceValue), i;
1951
+ return (i = e.call(this, t, n, r) || this).key = et.fromName(r.referenceValue),
1952
+ i;
1947
1953
  }
1948
1954
  return t(n, e), n.prototype.matches = function(t) {
1949
- var e = Z.comparator(t.key, this.key);
1950
- return this.V(e);
1955
+ var e = et.comparator(t.key, this.key);
1956
+ return this.D(e);
1951
1957
  }, n;
1952
- }(zt), Kt = /** @class */ function(e) {
1958
+ }(Ht), Yt = /** @class */ function(e) {
1953
1959
  function n(t, n) {
1954
1960
  var r = this;
1955
- return (r = e.call(this, t, "in" /* IN */ , n) || this).keys = Yt("in" /* IN */ , n),
1961
+ return (r = e.call(this, t, "in" /* IN */ , n) || this).keys = Xt("in" /* IN */ , n),
1956
1962
  r;
1957
1963
  }
1958
1964
  return t(n, e), n.prototype.matches = function(t) {
@@ -1960,10 +1966,10 @@ var zt = /** @class */ function(e) {
1960
1966
  return e.isEqual(t.key);
1961
1967
  }));
1962
1968
  }, n;
1963
- }(zt), Wt = /** @class */ function(e) {
1969
+ }(Ht), $t = /** @class */ function(e) {
1964
1970
  function n(t, n) {
1965
1971
  var r = this;
1966
- return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys = Yt("not-in" /* NOT_IN */ , n),
1972
+ return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys = Xt("not-in" /* NOT_IN */ , n),
1967
1973
  r;
1968
1974
  }
1969
1975
  return t(n, e), n.prototype.matches = function(t) {
@@ -1971,67 +1977,67 @@ var zt = /** @class */ function(e) {
1971
1977
  return e.isEqual(t.key);
1972
1978
  }));
1973
1979
  }, n;
1974
- }(zt);
1980
+ }(Ht);
1975
1981
 
1976
- /** Filter that matches on key fields (i.e. '__name__'). */ function Yt(t, e) {
1982
+ /** Filter that matches on key fields (i.e. '__name__'). */ function Xt(t, e) {
1977
1983
  var n;
1978
1984
  return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((function(t) {
1979
- return Z.fromName(t.referenceValue);
1985
+ return et.fromName(t.referenceValue);
1980
1986
  }));
1981
1987
  }
1982
1988
 
1983
- /** A Filter that implements the array-contains operator. */ var Xt = /** @class */ function(e) {
1989
+ /** A Filter that implements the array-contains operator. */ var Jt = /** @class */ function(e) {
1984
1990
  function n(t, n) {
1985
1991
  return e.call(this, t, "array-contains" /* ARRAY_CONTAINS */ , n) || this;
1986
1992
  }
1987
1993
  return t(n, e), n.prototype.matches = function(t) {
1988
1994
  var e = t.data.field(this.field);
1989
- return Lt(e) && Ft(e.arrayValue, this.value);
1995
+ return Rt(e) && Ot(e.arrayValue, this.value);
1990
1996
  }, n;
1991
- }(zt), $t = /** @class */ function(e) {
1997
+ }(Ht), Zt = /** @class */ function(e) {
1992
1998
  function n(t, n) {
1993
1999
  return e.call(this, t, "in" /* IN */ , n) || this;
1994
2000
  }
1995
2001
  return t(n, e), n.prototype.matches = function(t) {
1996
2002
  var e = t.data.field(this.field);
1997
- return null !== e && Ft(this.value.arrayValue, e);
2003
+ return null !== e && Ot(this.value.arrayValue, e);
1998
2004
  }, n;
1999
- }(zt), Jt = /** @class */ function(e) {
2005
+ }(Ht), te = /** @class */ function(e) {
2000
2006
  function n(t, n) {
2001
2007
  return e.call(this, t, "not-in" /* NOT_IN */ , n) || this;
2002
2008
  }
2003
2009
  return t(n, e), n.prototype.matches = function(t) {
2004
- if (Ft(this.value.arrayValue, {
2010
+ if (Ot(this.value.arrayValue, {
2005
2011
  nullValue: "NULL_VALUE"
2006
2012
  })) return !1;
2007
2013
  var e = t.data.field(this.field);
2008
- return null !== e && !Ft(this.value.arrayValue, e);
2014
+ return null !== e && !Ot(this.value.arrayValue, e);
2009
2015
  }, n;
2010
- }(zt), Zt = /** @class */ function(e) {
2016
+ }(Ht), ee = /** @class */ function(e) {
2011
2017
  function n(t, n) {
2012
2018
  return e.call(this, t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n) || this;
2013
2019
  }
2014
2020
  return t(n, e), n.prototype.matches = function(t) {
2015
2021
  var e = this, n = t.data.field(this.field);
2016
- return !(!Lt(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) {
2017
- return Ft(e.value.arrayValue, t);
2022
+ return !(!Rt(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) {
2023
+ return Ot(e.value.arrayValue, t);
2018
2024
  }));
2019
2025
  }, n;
2020
- }(zt), te = function(t, e) {
2026
+ }(Ht), ne = function(t, e) {
2021
2027
  this.position = t, this.before = e;
2022
- }, ee = function(t, e /* ASCENDING */) {
2028
+ }, re = function(t, e /* ASCENDING */) {
2023
2029
  void 0 === e && (e = "asc"), this.field = t, this.dir = e;
2024
2030
  };
2025
2031
 
2026
- /** A Filter that implements the IN operator. */ function ne(t, e) {
2032
+ /** A Filter that implements the IN operator. */ function ie(t, e) {
2027
2033
  return t.dir === e.dir && t.field.isEqual(e.field);
2028
2034
  }
2029
2035
 
2030
- function re(t, e) {
2036
+ function oe(t, e) {
2031
2037
  if (null === t) return null === e;
2032
2038
  if (null === e) return !1;
2033
2039
  if (t.before !== e.before || t.position.length !== e.position.length) return !1;
2034
- for (var n = 0; n < t.position.length; n++) if (!Nt(t.position[n], e.position[n])) return !1;
2040
+ for (var n = 0; n < t.position.length; n++) if (!qt(t.position[n], e.position[n])) return !1;
2035
2041
  return !0;
2036
2042
  }
2037
2043
 
@@ -2057,7 +2063,7 @@ function re(t, e) {
2057
2063
  * query the RemoteStore results.
2058
2064
  *
2059
2065
  * Visible for testing.
2060
- */ var ie =
2066
+ */ var ae =
2061
2067
  /**
2062
2068
  * Initializes a Query with a path and optional additional query constraints.
2063
2069
  * Path must currently be empty if this is a collection group query.
@@ -2067,23 +2073,23 @@ function(t, e, n, r, i, o /* First */ , a, s) {
2067
2073
  void 0 === i && (i = null), void 0 === o && (o = "F"), void 0 === a && (a = null),
2068
2074
  void 0 === s && (s = null), this.path = t, this.collectionGroup = e, this.explicitOrderBy = n,
2069
2075
  this.filters = r, this.limit = i, this.limitType = o, this.startAt = a, this.endAt = s,
2070
- this.N = null,
2076
+ this.$ = null,
2071
2077
  // The corresponding `Target` of this `Query` instance.
2072
- this.$ = null, this.startAt, this.endAt;
2078
+ this.F = null, this.startAt, this.endAt;
2073
2079
  };
2074
2080
 
2075
- /** Creates a new Query for a query that matches all documents at `path` */ function oe(t) {
2076
- return !at(t.limit) && "L" /* Last */ === t.limitType;
2081
+ /** Creates a new Query for a query that matches all documents at `path` */ function se(t) {
2082
+ return !ut(t.limit) && "L" /* Last */ === t.limitType;
2077
2083
  }
2078
2084
 
2079
- function ae(t) {
2085
+ function ue(t) {
2080
2086
  return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
2081
2087
  }
2082
2088
 
2083
- function se(t) {
2089
+ function ce(t) {
2084
2090
  for (var e = 0, n = t.filters; e < n.length; e++) {
2085
2091
  var r = n[e];
2086
- if (r.D()) return r.field;
2092
+ if (r.N()) return r.field;
2087
2093
  }
2088
2094
  return null;
2089
2095
  }
@@ -2095,7 +2101,7 @@ function se(t) {
2095
2101
  /**
2096
2102
  * Returns whether the query matches a collection group rather than a specific
2097
2103
  * collection.
2098
- */ function ue(t) {
2104
+ */ function le(t) {
2099
2105
  return null !== t.collectionGroup;
2100
2106
  }
2101
2107
 
@@ -2103,48 +2109,48 @@ function se(t) {
2103
2109
  * Returns the implicit order by constraint that is used to execute the Query,
2104
2110
  * which can be different from the order by constraints the user provided (e.g.
2105
2111
  * the SDK and backend always orders by `__name__`).
2106
- */ function ce(t) {
2112
+ */ function fe(t) {
2107
2113
  var e = E(t);
2108
- if (null === e.N) {
2109
- e.N = [];
2110
- var n = se(e), r = ae(e);
2114
+ if (null === e.$) {
2115
+ e.$ = [];
2116
+ var n = ce(e), r = ue(e);
2111
2117
  if (null !== n && null === r)
2112
2118
  // In order to implicitly add key ordering, we must also add the
2113
2119
  // inequality filter field for it to be a valid query.
2114
2120
  // Note that the default inequality field and key ordering is ascending.
2115
- n.isKeyField() || e.N.push(new ee(n)), e.N.push(new ee(J.keyField(), "asc" /* ASCENDING */)); else {
2121
+ n.isKeyField() || e.$.push(new re(n)), e.$.push(new re(tt.keyField(), "asc" /* ASCENDING */)); else {
2116
2122
  for (var i = !1, o = 0, a = e.explicitOrderBy; o < a.length; o++) {
2117
2123
  var s = a[o];
2118
- e.N.push(s), s.field.isKeyField() && (i = !0);
2124
+ e.$.push(s), s.field.isKeyField() && (i = !0);
2119
2125
  }
2120
2126
  if (!i) {
2121
2127
  // The order of the implicit key ordering always matches the last
2122
2128
  // explicit order by
2123
2129
  var u = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2124
- e.N.push(new ee(J.keyField(), u));
2130
+ e.$.push(new re(tt.keyField(), u));
2125
2131
  }
2126
2132
  }
2127
2133
  }
2128
- return e.N;
2134
+ return e.$;
2129
2135
  }
2130
2136
 
2131
2137
  /**
2132
2138
  * Converts this `Query` instance to it's corresponding `Target` representation.
2133
- */ function fe(t) {
2139
+ */ function he(t) {
2134
2140
  var e = E(t);
2135
- if (!e.$) if ("F" /* First */ === e.limitType) e.$ = Qt(e.path, e.collectionGroup, ce(e), e.filters, e.limit, e.startAt, e.endAt); else {
2141
+ if (!e.F) if ("F" /* First */ === e.limitType) e.F = Kt(e.path, e.collectionGroup, fe(e), e.filters, e.limit, e.startAt, e.endAt); else {
2136
2142
  for (
2137
2143
  // Flip the orderBy directions since we want the last results
2138
- var n = [], r = 0, i = ce(e); r < i.length; r++) {
2144
+ var n = [], r = 0, i = fe(e); r < i.length; r++) {
2139
2145
  var o = i[r], a = "desc" /* DESCENDING */ === o.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2140
- n.push(new ee(o.field, a));
2146
+ n.push(new re(o.field, a));
2141
2147
  }
2142
2148
  // We need to swap the cursors to match the now-flipped query ordering.
2143
- var s = e.endAt ? new te(e.endAt.position, !e.endAt.before) : null, u = e.startAt ? new te(e.startAt.position, !e.startAt.before) : null;
2149
+ var s = e.endAt ? new ne(e.endAt.position, !e.endAt.before) : null, u = e.startAt ? new ne(e.startAt.position, !e.startAt.before) : null;
2144
2150
  // Now return as a LimitType.First query.
2145
- e.$ = Qt(e.path, e.collectionGroup, n, e.filters, e.limit, s, u);
2151
+ e.F = Kt(e.path, e.collectionGroup, n, e.filters, e.limit, s, u);
2146
2152
  }
2147
- return e.$;
2153
+ return e.F;
2148
2154
  }
2149
2155
 
2150
2156
  /**
@@ -2172,9 +2178,9 @@ function se(t) {
2172
2178
  * The return value is an IntegerValue if it can safely represent the value,
2173
2179
  * otherwise a DoubleValue is returned.
2174
2180
  */
2175
- function le(t, e) {
2181
+ function pe(t, e) {
2176
2182
  return function(t) {
2177
- return "number" == typeof t && Number.isInteger(t) && !st(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2183
+ return "number" == typeof t && Number.isInteger(t) && !ct(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2178
2184
  }(e) ?
2179
2185
  /**
2180
2186
  * Returns an IntegerValue for `value`.
@@ -2184,7 +2190,7 @@ function le(t, e) {
2184
2190
  integerValue: "" + t
2185
2191
  };
2186
2192
  }(e) : function(t, e) {
2187
- if (t.F) {
2193
+ if (t.S) {
2188
2194
  if (isNaN(e)) return {
2189
2195
  doubleValue: "NaN"
2190
2196
  };
@@ -2196,7 +2202,7 @@ function le(t, e) {
2196
2202
  };
2197
2203
  }
2198
2204
  return {
2199
- doubleValue: st(e) ? "-0" : e
2205
+ doubleValue: ct(e) ? "-0" : e
2200
2206
  };
2201
2207
  }(t, e);
2202
2208
  }
@@ -2217,36 +2223,36 @@ function le(t, e) {
2217
2223
  * See the License for the specific language governing permissions and
2218
2224
  * limitations under the License.
2219
2225
  */
2220
- /** Used to represent a field transform on a mutation. */ var he = function() {
2226
+ /** Used to represent a field transform on a mutation. */ var de = function() {
2221
2227
  // Make sure that the structural type of `TransformOperation` is unique.
2222
2228
  // See https://github.com/microsoft/TypeScript/issues/5451
2223
2229
  this._ = void 0;
2224
- }, pe = /** @class */ function(e) {
2230
+ }, me = /** @class */ function(e) {
2225
2231
  function n() {
2226
2232
  return null !== e && e.apply(this, arguments) || this;
2227
2233
  }
2228
2234
  return t(n, e), n;
2229
- }(he), de = /** @class */ function(e) {
2235
+ }(de), ye = /** @class */ function(e) {
2230
2236
  function n(t) {
2231
2237
  var n = this;
2232
2238
  return (n = e.call(this) || this).elements = t, n;
2233
2239
  }
2234
2240
  return t(n, e), n;
2235
- }(he), me = /** @class */ function(e) {
2241
+ }(de), ve = /** @class */ function(e) {
2236
2242
  function n(t) {
2237
2243
  var n = this;
2238
2244
  return (n = e.call(this) || this).elements = t, n;
2239
2245
  }
2240
2246
  return t(n, e), n;
2241
- }(he), ye = /** @class */ function(e) {
2247
+ }(de), ge = /** @class */ function(e) {
2242
2248
  function n(t, n) {
2243
2249
  var r = this;
2244
- return (r = e.call(this) || this).S = t, r.q = n, r;
2250
+ return (r = e.call(this) || this).q = t, r.O = n, r;
2245
2251
  }
2246
2252
  return t(n, e), n;
2247
- }(he), ve = function(t, e) {
2253
+ }(de), we = function(t, e) {
2248
2254
  this.field = t, this.transform = e;
2249
- }, ge = /** @class */ function() {
2255
+ }, be = /** @class */ function() {
2250
2256
  function t(t, e) {
2251
2257
  this.updateTime = t, this.exists = e
2252
2258
  /** Creates a new empty Precondition. */;
@@ -2268,7 +2274,7 @@ function le(t, e) {
2268
2274
  }), t.prototype.isEqual = function(t) {
2269
2275
  return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime);
2270
2276
  }, t;
2271
- }(), we = function() {}, be = /** @class */ function(e) {
2277
+ }(), _e = function() {}, Te = /** @class */ function(e) {
2272
2278
  function n(t, n, r, i) {
2273
2279
  void 0 === i && (i = []);
2274
2280
  var o = this;
@@ -2276,7 +2282,7 @@ function le(t, e) {
2276
2282
  o.type = 0 /* Set */ , o;
2277
2283
  }
2278
2284
  return t(n, e), n;
2279
- }(we), _e = /** @class */ function(e) {
2285
+ }(_e), Se = /** @class */ function(e) {
2280
2286
  function n(t, n, r, i, o) {
2281
2287
  void 0 === o && (o = []);
2282
2288
  var a = this;
@@ -2284,24 +2290,24 @@ function le(t, e) {
2284
2290
  a.fieldTransforms = o, a.type = 1 /* Patch */ , a;
2285
2291
  }
2286
2292
  return t(n, e), n;
2287
- }(we), Se = /** @class */ function(e) {
2293
+ }(_e), Ee = /** @class */ function(e) {
2288
2294
  function n(t, n) {
2289
2295
  var r = this;
2290
2296
  return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 2 /* Delete */ ,
2291
2297
  r.fieldTransforms = [], r;
2292
2298
  }
2293
2299
  return t(n, e), n;
2294
- }(we), Te = /** @class */ function(e) {
2300
+ }(_e), Ie = /** @class */ function(e) {
2295
2301
  function n(t, n) {
2296
2302
  var r = this;
2297
2303
  return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 3 /* Verify */ ,
2298
2304
  r.fieldTransforms = [], r;
2299
2305
  }
2300
2306
  return t(n, e), n;
2301
- }(we), Ee = {
2307
+ }(_e), Ae = {
2302
2308
  asc: "ASCENDING",
2303
2309
  desc: "DESCENDING"
2304
- }, Ie = {
2310
+ }, ke = {
2305
2311
  "<": "LESS_THAN",
2306
2312
  "<=": "LESS_THAN_OR_EQUAL",
2307
2313
  ">": "GREATER_THAN",
@@ -2312,8 +2318,8 @@ function le(t, e) {
2312
2318
  in: "IN",
2313
2319
  "not-in": "NOT_IN",
2314
2320
  "array-contains-any": "ARRAY_CONTAINS_ANY"
2315
- }, Ae = function(t, e) {
2316
- this.databaseId = t, this.F = e;
2321
+ }, Ve = function(t, e) {
2322
+ this.databaseId = t, this.S = e;
2317
2323
  };
2318
2324
 
2319
2325
  /** Transforms a value into a server-generated timestamp. */
@@ -2328,8 +2334,8 @@ function le(t, e) {
2328
2334
  /**
2329
2335
  * Returns a value for a Date that's appropriate to put into a proto.
2330
2336
  */
2331
- function Ve(t, e) {
2332
- return t.F ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
2337
+ function De(t, e) {
2338
+ return t.S ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
2333
2339
  seconds: "" + e.seconds,
2334
2340
  nanos: e.nanoseconds
2335
2341
  };
@@ -2339,57 +2345,57 @@ function Ve(t, e) {
2339
2345
  * Returns a value for bytes that's appropriate to put in a proto.
2340
2346
  *
2341
2347
  * Visible for testing.
2342
- */ function De(t, e) {
2343
- return t.F ? e.toBase64() : e.toUint8Array();
2348
+ */ function Pe(t, e) {
2349
+ return t.S ? e.toBase64() : e.toUint8Array();
2344
2350
  }
2345
2351
 
2346
- function ke(t, e) {
2347
- return Ve(t, e.toTimestamp());
2352
+ function Fe(t, e) {
2353
+ return De(t, e.toTimestamp());
2348
2354
  }
2349
2355
 
2350
- function Pe(t) {
2351
- return T(!!t), gt.fromTimestamp(function(t) {
2352
- var e = Et(t);
2353
- return new vt(e.seconds, e.nanos);
2356
+ function Ne(t) {
2357
+ return S(!!t), bt.fromTimestamp(function(t) {
2358
+ var e = At(t);
2359
+ return new wt(e.seconds, e.nanos);
2354
2360
  }(t));
2355
2361
  }
2356
2362
 
2357
- function Ne(t, e) {
2363
+ function qe(t, e) {
2358
2364
  return function(t) {
2359
- return new X([ "projects", t.projectId, "databases", t.database ]);
2365
+ return new J([ "projects", t.projectId, "databases", t.database ]);
2360
2366
  }(t).child("documents").child(e).canonicalString();
2361
2367
  }
2362
2368
 
2363
- function Fe(t, e) {
2364
- return Ne(t.databaseId, e.path);
2369
+ function Oe(t, e) {
2370
+ return qe(t.databaseId, e.path);
2365
2371
  }
2366
2372
 
2367
- function Oe(t, e) {
2373
+ function Ce(t, e) {
2368
2374
  var n, r = function(t) {
2369
- var e = X.fromString(t);
2370
- return T(Me(e)), e;
2375
+ var e = J.fromString(t);
2376
+ return S(ze(e)), e;
2371
2377
  }(e);
2372
- if (r.get(1) !== t.databaseId.projectId) throw new x(V, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
2373
- if (r.get(3) !== t.databaseId.database) throw new x(V, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
2374
- return new Z((T((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
2378
+ if (r.get(1) !== t.databaseId.projectId) throw new M(k, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
2379
+ if (r.get(3) !== t.databaseId.database) throw new M(k, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
2380
+ return new et((S((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
2375
2381
  }
2376
2382
 
2377
- function qe(t, e) {
2378
- return Ne(t.databaseId, e);
2383
+ function je(t, e) {
2384
+ return qe(t.databaseId, e);
2379
2385
  }
2380
2386
 
2381
- function je(t) {
2382
- return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
2387
+ function Le(t) {
2388
+ return new J([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
2383
2389
  }
2384
2390
 
2385
- function Le(t, e, n) {
2391
+ function Re(t, e, n) {
2386
2392
  return {
2387
- name: Fe(t, e),
2393
+ name: Oe(t, e),
2388
2394
  fields: n.value.mapValue.fields
2389
2395
  };
2390
2396
  }
2391
2397
 
2392
- function Re(t) {
2398
+ function Me(t) {
2393
2399
  return {
2394
2400
  before: t.before,
2395
2401
  values: t.position
@@ -2398,12 +2404,12 @@ function Re(t) {
2398
2404
 
2399
2405
  // visible for testing
2400
2406
  function Ue(t) {
2401
- return Ee[t];
2407
+ return Ae[t];
2402
2408
  }
2403
2409
 
2404
2410
  // visible for testing
2405
2411
  function xe(t) {
2406
- return Ie[t];
2412
+ return ke[t];
2407
2413
  }
2408
2414
 
2409
2415
  function Be(t) {
@@ -2412,7 +2418,7 @@ function Be(t) {
2412
2418
  };
2413
2419
  }
2414
2420
 
2415
- function Ce(t) {
2421
+ function Ge(t) {
2416
2422
  var e = [];
2417
2423
  return t.fields.forEach((function(t) {
2418
2424
  return e.push(t.canonicalString());
@@ -2421,7 +2427,7 @@ function Ce(t) {
2421
2427
  };
2422
2428
  }
2423
2429
 
2424
- function Me(t) {
2430
+ function ze(t) {
2425
2431
  // Resource names have at least 4 components (project ID, database ID)
2426
2432
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
2427
2433
  }
@@ -2441,8 +2447,8 @@ function Me(t) {
2441
2447
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2442
2448
  * See the License for the specific language governing permissions and
2443
2449
  * limitations under the License.
2444
- */ function Ge(t) {
2445
- return new Ae(t, /* useProto3Json= */ !0);
2450
+ */ function Qe(t) {
2451
+ return new Ve(t, /* useProto3Json= */ !0);
2446
2452
  }
2447
2453
 
2448
2454
  /**
@@ -2469,7 +2475,7 @@ function Me(t) {
2469
2475
  * backoff curve, and a +/- 50% "jitter" that is calculated and added to the
2470
2476
  * base delay. This prevents clients from accidentally synchronizing their
2471
2477
  * delays causing spikes of load to the backend.
2472
- */ var Qe = /** @class */ function() {
2478
+ */ var Ke = /** @class */ function() {
2473
2479
  function t(
2474
2480
  /**
2475
2481
  * The AsyncQueue to run backoff operations on.
@@ -2495,7 +2501,7 @@ function Me(t) {
2495
2501
  * much as 1.5*maxDelayMs.
2496
2502
  */ , i) {
2497
2503
  void 0 === n && (n = 1e3), void 0 === r && (r = 1.5), void 0 === i && (i = 6e4),
2498
- this.O = t, this.timerId = e, this.C = n, this.L = r, this.U = i, this.j = 0, this.k = null,
2504
+ this.C = t, this.timerId = e, this.L = n, this.U = r, this.k = i, this.j = 0, this.M = null,
2499
2505
  /** The last backoff attempt, as epoch milliseconds. */
2500
2506
  this.B = Date.now(), this.reset();
2501
2507
  }
@@ -2512,64 +2518,67 @@ function Me(t) {
2512
2518
  * Resets the backoff delay to the maximum delay (e.g. for use after a
2513
2519
  * RESOURCE_EXHAUSTED error).
2514
2520
  */
2515
- t.prototype.M = function() {
2516
- this.j = this.U;
2521
+ t.prototype.G = function() {
2522
+ this.j = this.k;
2517
2523
  },
2518
2524
  /**
2519
2525
  * Returns a promise that resolves after currentDelayMs, and increases the
2520
2526
  * delay for any subsequent attempts. If there was a pending backoff operation
2521
2527
  * already, it will be canceled.
2522
2528
  */
2523
- t.prototype.G = function(t) {
2529
+ t.prototype.W = function(t) {
2524
2530
  var e = this;
2525
2531
  // Cancel any pending backoff operation.
2526
2532
  this.cancel();
2527
2533
  // First schedule using the current base (which may be 0 and should be
2528
2534
  // honored as such).
2529
- var n = Math.floor(this.j + this.W()), r = Math.max(0, Date.now() - this.B), i = Math.max(0, n - r);
2535
+ var n = Math.floor(this.j + this.Y()), r = Math.max(0, Date.now() - this.B), i = Math.max(0, n - r);
2530
2536
  // Guard against lastAttemptTime being in the future due to a clock change.
2531
2537
  i > 0 && g("ExponentialBackoff", "Backing off for " + i + " ms (base delay: " + this.j + " ms, delay with jitter: " + n + " ms, last attempt: " + r + " ms ago)"),
2532
- this.k = this.O.enqueueAfterDelay(this.timerId, i, (function() {
2538
+ this.M = this.C.enqueueAfterDelay(this.timerId, i, (function() {
2533
2539
  return e.B = Date.now(), t();
2534
2540
  })),
2535
2541
  // Apply backoff factor to determine next delay and ensure it is within
2536
2542
  // bounds.
2537
- this.j *= this.L, this.j < this.C && (this.j = this.C), this.j > this.U && (this.j = this.U);
2543
+ this.j *= this.U, this.j < this.L && (this.j = this.L), this.j > this.k && (this.j = this.k);
2538
2544
  }, t.prototype.H = function() {
2539
- null !== this.k && (this.k.skipDelay(), this.k = null);
2545
+ null !== this.M && (this.M.skipDelay(), this.M = null);
2540
2546
  }, t.prototype.cancel = function() {
2541
- null !== this.k && (this.k.cancel(), this.k = null);
2547
+ null !== this.M && (this.M.cancel(), this.M = null);
2542
2548
  },
2543
- /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.W = function() {
2549
+ /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.Y = function() {
2544
2550
  return (Math.random() - .5) * this.j;
2545
2551
  }, t;
2546
- }(), ze = /** @class */ function(e) {
2547
- function n(t, n, r) {
2548
- var i = this;
2549
- return (i = e.call(this) || this).credentials = t, i.Y = n, i.S = r, i.K = !1, i;
2552
+ }(), He = /** @class */ function(e) {
2553
+ function n(t, n, r, i) {
2554
+ var o = this;
2555
+ return (o = e.call(this) || this).authCredentials = t, o.appCheckCredentials = n,
2556
+ o.K = r, o.q = i, o.J = !1, o;
2550
2557
  }
2551
- return t(n, e), n.prototype.J = function() {
2552
- if (this.K) throw new x(O, "The client has already been terminated.");
2558
+ return t(n, e), n.prototype.X = function() {
2559
+ if (this.J) throw new M(q, "The client has already been terminated.");
2553
2560
  },
2554
- /** Gets an auth token and invokes the provided RPC. */ n.prototype.l = function(t, e, n) {
2561
+ /** Invokes the provided RPC with auth and AppCheck tokens. */ n.prototype.m = function(t, e, n) {
2555
2562
  var r = this;
2556
- return this.J(), this.credentials.getToken().then((function(i) {
2557
- return r.Y.l(t, e, n, i);
2563
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(i) {
2564
+ var o = i[0], a = i[1];
2565
+ return r.K.m(t, e, n, o, a);
2558
2566
  })).catch((function(t) {
2559
- throw "FirebaseError" === t.name ? (t.code === N && r.credentials.invalidateToken(),
2560
- t) : new x(A, t.toString());
2567
+ throw "FirebaseError" === t.name ? (t.code === F && (r.authCredentials.invalidateToken(),
2568
+ r.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
2561
2569
  }));
2562
2570
  },
2563
- /** Gets an auth token and invokes the provided RPC with streamed results. */ n.prototype.v = function(t, e, n) {
2571
+ /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ n.prototype.T = function(t, e, n) {
2564
2572
  var r = this;
2565
- return this.J(), this.credentials.getToken().then((function(i) {
2566
- return r.Y.v(t, e, n, i);
2573
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(i) {
2574
+ var o = i[0], a = i[1];
2575
+ return r.K.T(t, e, n, o, a);
2567
2576
  })).catch((function(t) {
2568
- throw "FirebaseError" === t.name ? (t.code === N && r.credentials.invalidateToken(),
2569
- t) : new x(A, t.toString());
2577
+ throw "FirebaseError" === t.name ? (t.code === F && (r.authCredentials.invalidateToken(),
2578
+ r.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
2570
2579
  }));
2571
2580
  }, n.prototype.terminate = function() {
2572
- this.K = !0;
2581
+ this.J = !0;
2573
2582
  }, n;
2574
2583
  }((function() {}));
2575
2584
 
@@ -2600,64 +2609,64 @@ function Me(t) {
2600
2609
  */
2601
2610
  // TODO(firestorexp): Make sure there is only one Datastore instance per
2602
2611
  // firestore-exp client.
2603
- function He(t, r) {
2612
+ function We(t, r) {
2604
2613
  return e(this, void 0, void 0, (function() {
2605
2614
  var e, i, o;
2606
2615
  return n(this, (function(n) {
2607
2616
  switch (n.label) {
2608
2617
  case 0:
2609
- return e = E(t), i = je(e.S) + "/documents", o = {
2618
+ return e = E(t), i = Le(e.q) + "/documents", o = {
2610
2619
  writes: r.map((function(t) {
2611
2620
  return function(t, e) {
2612
2621
  var n;
2613
- if (e instanceof be) n = {
2614
- update: Le(t, e.key, e.value)
2622
+ if (e instanceof Te) n = {
2623
+ update: Re(t, e.key, e.value)
2624
+ }; else if (e instanceof Ee) n = {
2625
+ delete: Oe(t, e.key)
2615
2626
  }; else if (e instanceof Se) n = {
2616
- delete: Fe(t, e.key)
2617
- }; else if (e instanceof _e) n = {
2618
- update: Le(t, e.key, e.data),
2619
- updateMask: Ce(e.fieldMask)
2627
+ update: Re(t, e.key, e.data),
2628
+ updateMask: Ge(e.fieldMask)
2620
2629
  }; else {
2621
- if (!(e instanceof Te)) return S();
2630
+ if (!(e instanceof Ie)) return T();
2622
2631
  n = {
2623
- verify: Fe(t, e.key)
2632
+ verify: Oe(t, e.key)
2624
2633
  };
2625
2634
  }
2626
2635
  return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((function(t) {
2627
2636
  return function(t, e) {
2628
2637
  var n = e.transform;
2629
- if (n instanceof pe) return {
2638
+ if (n instanceof me) return {
2630
2639
  fieldPath: e.field.canonicalString(),
2631
2640
  setToServerValue: "REQUEST_TIME"
2632
2641
  };
2633
- if (n instanceof de) return {
2642
+ if (n instanceof ye) return {
2634
2643
  fieldPath: e.field.canonicalString(),
2635
2644
  appendMissingElements: {
2636
2645
  values: n.elements
2637
2646
  }
2638
2647
  };
2639
- if (n instanceof me) return {
2648
+ if (n instanceof ve) return {
2640
2649
  fieldPath: e.field.canonicalString(),
2641
2650
  removeAllFromArray: {
2642
2651
  values: n.elements
2643
2652
  }
2644
2653
  };
2645
- if (n instanceof ye) return {
2654
+ if (n instanceof ge) return {
2646
2655
  fieldPath: e.field.canonicalString(),
2647
- increment: n.q
2656
+ increment: n.O
2648
2657
  };
2649
- throw S();
2658
+ throw T();
2650
2659
  }(0, t);
2651
2660
  }))), e.precondition.isNone || (n.currentDocument = function(t, e) {
2652
2661
  return void 0 !== e.updateTime ? {
2653
- updateTime: ke(t, e.updateTime)
2662
+ updateTime: Fe(t, e.updateTime)
2654
2663
  } : void 0 !== e.exists ? {
2655
2664
  exists: e.exists
2656
- } : S();
2665
+ } : T();
2657
2666
  }(t, e.precondition)), n;
2658
- }(e.S, t);
2667
+ }(e.q, t);
2659
2668
  }))
2660
- }, [ 4 /*yield*/ , e.l("Commit", i, o) ];
2669
+ }, [ 4 /*yield*/ , e.m("Commit", i, o) ];
2661
2670
 
2662
2671
  case 1:
2663
2672
  return n.sent(), [ 2 /*return*/ ];
@@ -2666,46 +2675,46 @@ function He(t, r) {
2666
2675
  }));
2667
2676
  }
2668
2677
 
2669
- function Ke(t, r) {
2678
+ function Ye(t, r) {
2670
2679
  return e(this, void 0, void 0, (function() {
2671
2680
  var e, i, o, a, s, u;
2672
2681
  return n(this, (function(n) {
2673
2682
  switch (n.label) {
2674
2683
  case 0:
2675
- return e = E(t), i = je(e.S) + "/documents", o = {
2684
+ return e = E(t), i = Le(e.q) + "/documents", o = {
2676
2685
  documents: r.map((function(t) {
2677
- return Fe(e.S, t);
2686
+ return Oe(e.q, t);
2678
2687
  }))
2679
- }, [ 4 /*yield*/ , e.v("BatchGetDocuments", i, o) ];
2688
+ }, [ 4 /*yield*/ , e.T("BatchGetDocuments", i, o) ];
2680
2689
 
2681
2690
  case 1:
2682
2691
  return a = n.sent(), s = new Map, a.forEach((function(t) {
2683
2692
  var n = function(t, e) {
2684
2693
  return "found" in e ? function(t, e) {
2685
- T(!!e.found), e.found.name, e.found.updateTime;
2686
- var n = Oe(t, e.found.name), r = Pe(e.found.updateTime), i = new Ct({
2694
+ S(!!e.found), e.found.name, e.found.updateTime;
2695
+ var n = Ce(t, e.found.name), r = Ne(e.found.updateTime), i = new Gt({
2687
2696
  mapValue: {
2688
2697
  fields: e.found.fields
2689
2698
  }
2690
2699
  });
2691
- return Mt.newFoundDocument(n, r, i);
2700
+ return zt.newFoundDocument(n, r, i);
2692
2701
  }(t, e) : "missing" in e ? function(t, e) {
2693
- T(!!e.missing), T(!!e.readTime);
2694
- var n = Oe(t, e.missing), r = Pe(e.readTime);
2695
- return Mt.newNoDocument(n, r);
2696
- }(t, e) : S();
2697
- }(e.S, t);
2702
+ S(!!e.missing), S(!!e.readTime);
2703
+ var n = Ce(t, e.missing), r = Ne(e.readTime);
2704
+ return zt.newNoDocument(n, r);
2705
+ }(t, e) : T();
2706
+ }(e.q, t);
2698
2707
  s.set(n.key.toString(), n);
2699
2708
  })), u = [], [ 2 /*return*/ , (r.forEach((function(t) {
2700
2709
  var e = s.get(t.toString());
2701
- T(!!e), u.push(e);
2710
+ S(!!e), u.push(e);
2702
2711
  })), u) ];
2703
2712
  }
2704
2713
  }));
2705
2714
  }));
2706
2715
  }
2707
2716
 
2708
- function We(t, r) {
2717
+ function $e(t, r) {
2709
2718
  return e(this, void 0, void 0, (function() {
2710
2719
  var e, i;
2711
2720
  return n(this, (function(n) {
@@ -2716,10 +2725,10 @@ function We(t, r) {
2716
2725
  var n = {
2717
2726
  structuredQuery: {}
2718
2727
  }, r = e.path;
2719
- null !== e.collectionGroup ? (n.parent = qe(t, r), n.structuredQuery.from = [ {
2728
+ null !== e.collectionGroup ? (n.parent = je(t, r), n.structuredQuery.from = [ {
2720
2729
  collectionId: e.collectionGroup,
2721
2730
  allDescendants: !0
2722
- } ]) : (n.parent = qe(t, r.popLast()), n.structuredQuery.from = [ {
2731
+ } ]) : (n.parent = je(t, r.popLast()), n.structuredQuery.from = [ {
2723
2732
  collectionId: r.lastSegment()
2724
2733
  } ]);
2725
2734
  var i = function(t) {
@@ -2734,7 +2743,7 @@ function We(t, r) {
2734
2743
  op: "IS_NAN"
2735
2744
  }
2736
2745
  };
2737
- if (Rt(t.value)) return {
2746
+ if (Mt(t.value)) return {
2738
2747
  unaryFilter: {
2739
2748
  field: Be(t.field),
2740
2749
  op: "IS_NULL"
@@ -2747,7 +2756,7 @@ function We(t, r) {
2747
2756
  op: "IS_NOT_NAN"
2748
2757
  }
2749
2758
  };
2750
- if (Rt(t.value)) return {
2759
+ if (Mt(t.value)) return {
2751
2760
  unaryFilter: {
2752
2761
  field: Be(t.field),
2753
2762
  op: "IS_NOT_NULL"
@@ -2785,13 +2794,13 @@ function We(t, r) {
2785
2794
  }(e.orderBy);
2786
2795
  o && (n.structuredQuery.orderBy = o);
2787
2796
  var a = function(t, e) {
2788
- return t.F || at(e) ? e : {
2797
+ return t.S || ut(e) ? e : {
2789
2798
  value: e
2790
2799
  };
2791
2800
  }(t, e.limit);
2792
- return null !== a && (n.structuredQuery.limit = a), e.startAt && (n.structuredQuery.startAt = Re(e.startAt)),
2793
- e.endAt && (n.structuredQuery.endAt = Re(e.endAt)), n;
2794
- }(e.S, fe(r)), [ 4 /*yield*/ , e.v("RunQuery", i.parent, {
2801
+ return null !== a && (n.structuredQuery.limit = a), e.startAt && (n.structuredQuery.startAt = Me(e.startAt)),
2802
+ e.endAt && (n.structuredQuery.endAt = Me(e.endAt)), n;
2803
+ }(e.q, he(r)), [ 4 /*yield*/ , e.T("RunQuery", i.parent, {
2795
2804
  structuredQuery: i.structuredQuery
2796
2805
  }) ];
2797
2806
 
@@ -2800,13 +2809,13 @@ function We(t, r) {
2800
2809
  return !!t.document;
2801
2810
  })).map((function(t) {
2802
2811
  return function(t, e, n) {
2803
- var r = Oe(t, e.name), i = Pe(e.updateTime), o = new Ct({
2812
+ var r = Ce(t, e.name), i = Ne(e.updateTime), o = new Gt({
2804
2813
  mapValue: {
2805
2814
  fields: e.fields
2806
2815
  }
2807
- }), a = Mt.newFoundDocument(r, i, o);
2816
+ }), a = zt.newFoundDocument(r, i, o);
2808
2817
  return a;
2809
- }(e.S, t.document);
2818
+ }(e.q, t.document);
2810
2819
  })) ];
2811
2820
  }
2812
2821
  }));
@@ -2828,7 +2837,7 @@ function We(t, r) {
2828
2837
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2829
2838
  * See the License for the specific language governing permissions and
2830
2839
  * limitations under the License.
2831
- */ var Ye = new Map;
2840
+ */ var Xe = new Map;
2832
2841
 
2833
2842
  /**
2834
2843
  * An instance map that ensures only one Datastore exists per Firestore
@@ -2838,17 +2847,17 @@ function We(t, r) {
2838
2847
  * Returns an initialized and started Datastore for the given Firestore
2839
2848
  * instance. Callers must invoke removeComponents() when the Firestore
2840
2849
  * instance is terminated.
2841
- */ function Xe(t) {
2842
- if (t._terminated) throw new x(O, "The client has already been terminated.");
2843
- if (!Ye.has(t)) {
2850
+ */ function Je(t) {
2851
+ if (t._terminated) throw new M(q, "The client has already been terminated.");
2852
+ if (!Xe.has(t)) {
2844
2853
  g("ComponentProvider", "Initializing Datastore");
2845
2854
  var e = function(t) {
2846
- return new ht(t, fetch.bind(null));
2855
+ return new dt(t, fetch.bind(null));
2847
2856
  }((i = t._databaseId, o = t.app.options.appId || "", a = t._persistenceKey, s = t._freezeSettings(),
2848
- new K(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n = Ge(t._databaseId), r = function(t, e, n) {
2849
- return new ze(t, e, n);
2850
- }(t._credentials, e, n);
2851
- Ye.set(t, r);
2857
+ new Y(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n = Qe(t._databaseId), r = function(t, e, n, r) {
2858
+ return new He(t, e, n, r);
2859
+ }(t._authCredentials, t._appCheckCredentials, e, n);
2860
+ Xe.set(t, r);
2852
2861
  }
2853
2862
  var i, o, a, s;
2854
2863
  /**
@@ -2866,7 +2875,7 @@ function We(t, r) {
2866
2875
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2867
2876
  * See the License for the specific language governing permissions and
2868
2877
  * limitations under the License.
2869
- */ return Ye.get(t);
2878
+ */ return Xe.get(t);
2870
2879
  }
2871
2880
 
2872
2881
  /**
@@ -2877,38 +2886,38 @@ function We(t, r) {
2877
2886
  * A concrete type describing all the values that can be applied via a
2878
2887
  * user-supplied `FirestoreSettings` object. This is a separate type so that
2879
2888
  * defaults can be supplied and the value can be checked for equality.
2880
- */ var $e = /** @class */ function() {
2889
+ */ var Ze = /** @class */ function() {
2881
2890
  function t(t) {
2882
2891
  var e;
2883
2892
  if (void 0 === t.host) {
2884
- if (void 0 !== t.ssl) throw new x(V, "Can't provide ssl option if host option is not set");
2893
+ if (void 0 !== t.ssl) throw new M(k, "Can't provide ssl option if host option is not set");
2885
2894
  this.host = "firestore.googleapis.com", this.ssl = !0;
2886
2895
  } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
2887
2896
  if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
2888
2897
  void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
2889
- if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new x(V, "cacheSizeBytes must be at least 1048576");
2898
+ if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new M(k, "cacheSizeBytes must be at least 1048576");
2890
2899
  this.cacheSizeBytes = t.cacheSizeBytes;
2891
2900
  }
2892
2901
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
2893
2902
  this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
2894
- if (!0 === e && !0 === r) throw new x(V, "experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.");
2903
+ if (!0 === e && !0 === r) throw new M(k, "experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.");
2895
2904
  }(0, t.experimentalForceLongPolling, 0, t.experimentalAutoDetectLongPolling);
2896
2905
  }
2897
2906
  return t.prototype.isEqual = function(t) {
2898
2907
  return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
2899
2908
  }, t;
2900
- }(), Je = /** @class */ function() {
2909
+ }(), tn = /** @class */ function() {
2901
2910
  /** @hideconstructor */
2902
- function t(t, e) {
2903
- this._credentials = e,
2911
+ function t(t, e, n) {
2912
+ this._authCredentials = e, this._appCheckCredentials = n,
2904
2913
  /**
2905
2914
  * Whether it's a Firestore or Firestore Lite instance.
2906
2915
  */
2907
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new $e({}),
2908
- this._settingsFrozen = !1, t instanceof W ? this._databaseId = t : (this._app = t,
2916
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Ze({}),
2917
+ this._settingsFrozen = !1, t instanceof $ ? this._databaseId = t : (this._app = t,
2909
2918
  this._databaseId = function(t) {
2910
- if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new x(V, '"projectId" not provided in firebase.initializeApp.');
2911
- return new W(t.options.projectId);
2919
+ if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(k, '"projectId" not provided in firebase.initializeApp.');
2920
+ return new $(t.options.projectId);
2912
2921
  }(t));
2913
2922
  }
2914
2923
  return Object.defineProperty(t.prototype, "app", {
@@ -2917,7 +2926,7 @@ function We(t, r) {
2917
2926
  * instance.
2918
2927
  */
2919
2928
  get: function() {
2920
- if (!this._app) throw new x(O, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
2929
+ if (!this._app) throw new M(q, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
2921
2930
  return this._app;
2922
2931
  },
2923
2932
  enumerable: !1,
@@ -2935,21 +2944,21 @@ function We(t, r) {
2935
2944
  enumerable: !1,
2936
2945
  configurable: !0
2937
2946
  }), t.prototype._setSettings = function(t) {
2938
- if (this._settingsFrozen) throw new x(O, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
2939
- this._settings = new $e(t), void 0 !== t.credentials && (this._credentials = function(t) {
2940
- if (!t) return new M;
2947
+ if (this._settingsFrozen) throw new M(q, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
2948
+ this._settings = new Ze(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
2949
+ if (!t) return new B;
2941
2950
  switch (t.type) {
2942
2951
  case "gapi":
2943
2952
  var e = t.client;
2944
2953
  // Make sure this really is a Gapi client.
2945
- return T(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
2946
- new H(e, t.sessionIndex || "0", t.iamToken || null);
2954
+ return S(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
2955
+ new K(e, t.sessionIndex || "0", t.iamToken || null);
2947
2956
 
2948
2957
  case "provider":
2949
2958
  return t.client;
2950
2959
 
2951
2960
  default:
2952
- throw new x(V, "makeCredentialsProvider failed due to invalid credential type");
2961
+ throw new M(k, "makeAuthCredentialsProvider failed due to invalid credential type");
2953
2962
  }
2954
2963
  }(t.credentials));
2955
2964
  }, t.prototype._getSettings = function() {
@@ -2974,8 +2983,8 @@ function We(t, r) {
2974
2983
  * Only ever called once.
2975
2984
  */
2976
2985
  t.prototype._terminate = function() {
2977
- return t = this, (e = Ye.get(t)) && (g("ComponentProvider", "Removing Datastore"),
2978
- Ye.delete(t), e.terminate()), Promise.resolve();
2986
+ return t = this, (e = Xe.get(t)) && (g("ComponentProvider", "Removing Datastore"),
2987
+ Xe.delete(t), e.terminate()), Promise.resolve();
2979
2988
  var t, e;
2980
2989
  }, t;
2981
2990
  }();
@@ -3000,9 +3009,9 @@ function We(t, r) {
3000
3009
  * The Cloud Firestore service interface.
3001
3010
  *
3002
3011
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
3003
- */ function Ze(t, e) {
3012
+ */ function en(t, e) {
3004
3013
  var n = _getProvider(t, "firestore/lite");
3005
- if (n.isInitialized()) throw new x(O, "Firestore can only be initialized once per app.");
3014
+ if (n.isInitialized()) throw new M(q, "Firestore can only be initialized once per app.");
3006
3015
  return n.initialize({
3007
3016
  options: e
3008
3017
  });
@@ -3016,7 +3025,7 @@ function We(t, r) {
3016
3025
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
3017
3026
  * instance is associated with.
3018
3027
  * @returns The `Firestore` instance of the provided app.
3019
- */ function tn(t) {
3028
+ */ function nn(t) {
3020
3029
  return void 0 === t && (t = s()), _getProvider(t, "firestore/lite").getImmediate();
3021
3030
  }
3022
3031
 
@@ -3032,10 +3041,10 @@ function We(t, r) {
3032
3041
  * @param port - the emulator port (ex: 9000).
3033
3042
  * @param options.mockUserToken - the mock auth token to use for unit testing
3034
3043
  * Security Rules.
3035
- */ function en(t, e, n, r) {
3044
+ */ function rn(t, e, n, r) {
3036
3045
  var i;
3037
3046
  void 0 === r && (r = {});
3038
- var o = (t = it(t, Je))._getSettings();
3047
+ var o = (t = at(t, tn))._getSettings();
3039
3048
  if ("firestore.googleapis.com" !== o.host && o.host !== e && b("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3040
3049
  t._setSettings(Object.assign(Object.assign({}, o), {
3041
3050
  host: e + ":" + n,
@@ -3047,10 +3056,10 @@ function We(t, r) {
3047
3056
  // invalid field "uid" and missing field "sub" / "user_id".)
3048
3057
  a = p(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
3049
3058
  var u = r.mockUserToken.sub || r.mockUserToken.user_id;
3050
- if (!u) throw new x(V, "mockUserToken must contain 'sub' or 'user_id' field!");
3059
+ if (!u) throw new M(k, "mockUserToken must contain 'sub' or 'user_id' field!");
3051
3060
  s = new d(u);
3052
3061
  }
3053
- t._credentials = new G(new C(a, s));
3062
+ t._authCredentials = new G(new x(a, s));
3054
3063
  }
3055
3064
  }
3056
3065
 
@@ -3073,8 +3082,8 @@ function We(t, r) {
3073
3082
  * @param firestore - The `Firestore` instance to terminate.
3074
3083
  * @returns A `Promise` that is resolved when the instance has been successfully
3075
3084
  * terminated.
3076
- */ function nn(t) {
3077
- return t = it(t, Je), u(t.app, "firestore/lite"), t._delete()
3085
+ */ function on(t) {
3086
+ return t = at(t, tn), u(t.app, "firestore/lite"), t._delete()
3078
3087
  /**
3079
3088
  * @license
3080
3089
  * Copyright 2020 Google LLC
@@ -3114,7 +3123,7 @@ function We(t, r) {
3114
3123
  */;
3115
3124
  }
3116
3125
 
3117
- var rn = /** @class */ function() {
3126
+ var an = /** @class */ function() {
3118
3127
  /** @hideconstructor */
3119
3128
  function t(t,
3120
3129
  /**
@@ -3155,14 +3164,14 @@ var rn = /** @class */ function() {
3155
3164
  * The collection this `DocumentReference` belongs to.
3156
3165
  */
3157
3166
  get: function() {
3158
- return new an(this.firestore, this.converter, this._key.path.popLast());
3167
+ return new un(this.firestore, this.converter, this._key.path.popLast());
3159
3168
  },
3160
3169
  enumerable: !1,
3161
3170
  configurable: !0
3162
3171
  }), t.prototype.withConverter = function(e) {
3163
3172
  return new t(this.firestore, e, this._key);
3164
3173
  }, t;
3165
- }(), on = /** @class */ function() {
3174
+ }(), sn = /** @class */ function() {
3166
3175
  // This is the lite version of the Query class in the main SDK.
3167
3176
  /** @hideconstructor protected */
3168
3177
  function t(t,
@@ -3177,11 +3186,11 @@ var rn = /** @class */ function() {
3177
3186
  return t.prototype.withConverter = function(e) {
3178
3187
  return new t(this.firestore, e, this._query);
3179
3188
  }, t;
3180
- }(), an = /** @class */ function(e) {
3189
+ }(), un = /** @class */ function(e) {
3181
3190
  /** @hideconstructor */
3182
3191
  function n(t, n, r) {
3183
3192
  var i = this;
3184
- return (i = e.call(this, t, n, new ie(r)) || this)._path = r,
3193
+ return (i = e.call(this, t, n, new ae(r)) || this)._path = r,
3185
3194
  /** The type of this Firestore reference. */
3186
3195
  i.type = "collection", i;
3187
3196
  }
@@ -3208,28 +3217,28 @@ var rn = /** @class */ function() {
3208
3217
  */
3209
3218
  get: function() {
3210
3219
  var t = this._path.popLast();
3211
- return t.isEmpty() ? null : new rn(this.firestore,
3212
- /* converter= */ null, new Z(t));
3220
+ return t.isEmpty() ? null : new an(this.firestore,
3221
+ /* converter= */ null, new et(t));
3213
3222
  },
3214
3223
  enumerable: !1,
3215
3224
  configurable: !0
3216
3225
  }), n.prototype.withConverter = function(t) {
3217
3226
  return new n(this.firestore, t, this._path);
3218
3227
  }, n;
3219
- }(on);
3228
+ }(sn);
3220
3229
 
3221
3230
  /**
3222
3231
  * A `Query` refers to a query which you can read or listen to. You can also
3223
3232
  * construct refined `Query` objects by adding filters and ordering.
3224
- */ function sn(t, e) {
3233
+ */ function cn(t, e) {
3225
3234
  for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
3226
- if (t = h(t), tt("collection", "path", e), t instanceof Je) {
3227
- var o = X.fromString.apply(X, r([ e ], n));
3228
- return nt(o), new an(t, /* converter= */ null, o);
3235
+ if (t = h(t), nt("collection", "path", e), t instanceof tn) {
3236
+ var o = J.fromString.apply(J, r([ e ], n));
3237
+ return it(o), new un(t, /* converter= */ null, o);
3229
3238
  }
3230
- if (!(t instanceof rn || t instanceof an)) throw new x(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3231
- var a = t._path.child(X.fromString.apply(X, r([ e ], n)));
3232
- return nt(a), new an(t.firestore,
3239
+ if (!(t instanceof an || t instanceof un)) throw new M(k, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3240
+ var a = t._path.child(J.fromString.apply(J, r([ e ], n)));
3241
+ return it(a), new un(t.firestore,
3233
3242
  /* converter= */ null, a);
3234
3243
  }
3235
3244
 
@@ -3245,32 +3254,32 @@ var rn = /** @class */ function() {
3245
3254
  * collection or subcollection with this ID as the last segment of its path
3246
3255
  * will be included. Cannot contain a slash.
3247
3256
  * @returns The created `Query`.
3248
- */ function un(t, e) {
3249
- if (t = it(t, Je), tt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new x(V, "Invalid collection ID '" + e + "' passed to function collectionGroup(). Collection IDs must not contain '/'.");
3250
- return new on(t,
3257
+ */ function ln(t, e) {
3258
+ if (t = at(t, tn), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new M(k, "Invalid collection ID '" + e + "' passed to function collectionGroup(). Collection IDs must not contain '/'.");
3259
+ return new sn(t,
3251
3260
  /* converter= */ null,
3252
3261
  /**
3253
3262
  * Creates a new Query for a collection group query that matches all documents
3254
3263
  * within the provided collection group.
3255
3264
  */
3256
3265
  function(t) {
3257
- return new ie(X.emptyPath(), t);
3266
+ return new ae(J.emptyPath(), t);
3258
3267
  }(e));
3259
3268
  }
3260
3269
 
3261
- function cn(t, e) {
3270
+ function fn(t, e) {
3262
3271
  for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
3263
3272
  if (t = h(t),
3264
3273
  // We allow omission of 'pathString' but explicitly prohibit passing in both
3265
3274
  // 'undefined' and 'null'.
3266
- 1 === arguments.length && (e = dt.A()), tt("doc", "path", e), t instanceof Je) {
3267
- var o = X.fromString.apply(X, r([ e ], n));
3268
- return et(o), new rn(t,
3269
- /* converter= */ null, new Z(o));
3275
+ 1 === arguments.length && (e = yt.P()), nt("doc", "path", e), t instanceof tn) {
3276
+ var o = J.fromString.apply(J, r([ e ], n));
3277
+ return rt(o), new an(t,
3278
+ /* converter= */ null, new et(o));
3270
3279
  }
3271
- if (!(t instanceof rn || t instanceof an)) throw new x(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3272
- var a = t._path.child(X.fromString.apply(X, r([ e ], n)));
3273
- return et(a), new rn(t.firestore, t instanceof an ? t.converter : null, new Z(a));
3280
+ if (!(t instanceof an || t instanceof un)) throw new M(k, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3281
+ var a = t._path.child(J.fromString.apply(J, r([ e ], n)));
3282
+ return rt(a), new an(t.firestore, t instanceof un ? t.converter : null, new et(a));
3274
3283
  }
3275
3284
 
3276
3285
  /**
@@ -3280,8 +3289,8 @@ function cn(t, e) {
3280
3289
  * @param right - A reference to compare.
3281
3290
  * @returns true if the references point to the same location in the same
3282
3291
  * Firestore database.
3283
- */ function fn(t, e) {
3284
- return t = h(t), e = h(e), (t instanceof rn || t instanceof an) && (e instanceof rn || e instanceof an) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter
3292
+ */ function hn(t, e) {
3293
+ return t = h(t), e = h(e), (t instanceof an || t instanceof un) && (e instanceof an || e instanceof un) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter
3285
3294
  /**
3286
3295
  * Returns true if the provided queries point to the same collection and apply
3287
3296
  * the same constraints.
@@ -3293,18 +3302,18 @@ function cn(t, e) {
3293
3302
  */;
3294
3303
  }
3295
3304
 
3296
- function ln(t, e) {
3297
- return t = h(t), e = h(e), t instanceof on && e instanceof on && t.firestore === e.firestore && function(t, e) {
3305
+ function pn(t, e) {
3306
+ return t = h(t), e = h(e), t instanceof sn && e instanceof sn && t.firestore === e.firestore && function(t, e) {
3298
3307
  return function(t, e) {
3299
3308
  if (t.limit !== e.limit) return !1;
3300
3309
  if (t.orderBy.length !== e.orderBy.length) return !1;
3301
- for (var n = 0; n < t.orderBy.length; n++) if (!ne(t.orderBy[n], e.orderBy[n])) return !1;
3310
+ for (var n = 0; n < t.orderBy.length; n++) if (!ie(t.orderBy[n], e.orderBy[n])) return !1;
3302
3311
  if (t.filters.length !== e.filters.length) return !1;
3303
3312
  for (var r = 0; r < t.filters.length; r++) if (i = t.filters[r], o = e.filters[r],
3304
- i.op !== o.op || !i.field.isEqual(o.field) || !Nt(i.value, o.value)) return !1;
3313
+ i.op !== o.op || !i.field.isEqual(o.field) || !qt(i.value, o.value)) return !1;
3305
3314
  var i, o;
3306
- return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!re(t.startAt, e.startAt) && re(t.endAt, e.endAt);
3307
- }(fe(t), fe(e)) && t.limitType === e.limitType;
3315
+ return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!oe(t.startAt, e.startAt) && oe(t.endAt, e.endAt);
3316
+ }(he(t), he(e)) && t.limitType === e.limitType;
3308
3317
  }(t._query, e._query) && t.converter === e.converter
3309
3318
  /**
3310
3319
  * @license
@@ -3332,7 +3341,7 @@ function ln(t, e) {
3332
3341
  */;
3333
3342
  }
3334
3343
 
3335
- var hn = /** @class */ function() {
3344
+ var dn = /** @class */ function() {
3336
3345
  /**
3337
3346
  * Creates a `FieldPath` from the provided field names. If more than one field
3338
3347
  * name is provided, the path will point to a nested field in a document.
@@ -3341,8 +3350,8 @@ var hn = /** @class */ function() {
3341
3350
  */
3342
3351
  function t() {
3343
3352
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
3344
- for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new x(V, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3345
- this._internalPath = new J(t);
3353
+ for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new M(k, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3354
+ this._internalPath = new tt(t);
3346
3355
  }
3347
3356
  /**
3348
3357
  * Returns true if this `FieldPath` is equal to the provided one.
@@ -3357,8 +3366,8 @@ var hn = /** @class */ function() {
3357
3366
  /**
3358
3367
  * Returns a special sentinel `FieldPath` to refer to the ID of a document.
3359
3368
  * It can be used in queries to sort or filter by the document ID.
3360
- */ function pn() {
3361
- return new hn("__name__");
3369
+ */ function mn() {
3370
+ return new dn("__name__");
3362
3371
  }
3363
3372
 
3364
3373
  /**
@@ -3379,7 +3388,7 @@ var hn = /** @class */ function() {
3379
3388
  */
3380
3389
  /**
3381
3390
  * An immutable object representing an array of bytes.
3382
- */ var dn = /** @class */ function() {
3391
+ */ var yn = /** @class */ function() {
3383
3392
  /** @hideconstructor */
3384
3393
  function t(t) {
3385
3394
  this._byteString = t;
@@ -3391,9 +3400,9 @@ var hn = /** @class */ function() {
3391
3400
  * @param base64 - The Base64 string used to create the `Bytes` object.
3392
3401
  */ return t.fromBase64String = function(e) {
3393
3402
  try {
3394
- return new t(St.fromBase64String(e));
3403
+ return new t(Et.fromBase64String(e));
3395
3404
  } catch (e) {
3396
- throw new x(V, "Failed to construct data from Base64 string: " + e);
3405
+ throw new M(k, "Failed to construct data from Base64 string: " + e);
3397
3406
  }
3398
3407
  },
3399
3408
  /**
@@ -3402,7 +3411,7 @@ var hn = /** @class */ function() {
3402
3411
  * @param array - The Uint8Array used to create the `Bytes` object.
3403
3412
  */
3404
3413
  t.fromUint8Array = function(e) {
3405
- return new t(St.fromUint8Array(e));
3414
+ return new t(Et.fromUint8Array(e));
3406
3415
  },
3407
3416
  /**
3408
3417
  * Returns the underlying bytes as a Base64-encoded string.
@@ -3437,14 +3446,14 @@ var hn = /** @class */ function() {
3437
3446
  t.prototype.isEqual = function(t) {
3438
3447
  return this._byteString.isEqual(t._byteString);
3439
3448
  }, t;
3440
- }(), mn =
3449
+ }(), vn =
3441
3450
  /**
3442
3451
  * @param _methodName - The public API endpoint that returns this class.
3443
3452
  * @hideconstructor
3444
3453
  */
3445
3454
  function(t) {
3446
3455
  this._methodName = t;
3447
- }, yn = /** @class */ function() {
3456
+ }, gn = /** @class */ function() {
3448
3457
  /**
3449
3458
  * Creates a new immutable `GeoPoint` object with the provided latitude and
3450
3459
  * longitude values.
@@ -3452,8 +3461,8 @@ function(t) {
3452
3461
  * @param longitude - The longitude as number between -180 and 180.
3453
3462
  */
3454
3463
  function t(t, e) {
3455
- if (!isFinite(t) || t < -90 || t > 90) throw new x(V, "Latitude must be a number between -90 and 90, but was: " + t);
3456
- if (!isFinite(e) || e < -180 || e > 180) throw new x(V, "Longitude must be a number between -180 and 180, but was: " + e);
3464
+ if (!isFinite(t) || t < -90 || t > 90) throw new M(k, "Latitude must be a number between -90 and 90, but was: " + t);
3465
+ if (!isFinite(e) || e < -180 || e > 180) throw new M(k, "Longitude must be a number between -180 and 180, but was: " + e);
3457
3466
  this._lat = t, this._long = e;
3458
3467
  }
3459
3468
  return Object.defineProperty(t.prototype, "latitude", {
@@ -3495,23 +3504,23 @@ function(t) {
3495
3504
  * with an underscore.
3496
3505
  */
3497
3506
  t.prototype._compareTo = function(t) {
3498
- return mt(this._lat, t._lat) || mt(this._long, t._long);
3507
+ return vt(this._lat, t._lat) || vt(this._long, t._long);
3499
3508
  }, t;
3500
- }(), vn = /^__.*__$/, gn = /** @class */ function() {
3509
+ }(), wn = /^__.*__$/, bn = /** @class */ function() {
3501
3510
  function t(t, e, n) {
3502
3511
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3503
3512
  }
3504
3513
  return t.prototype.toMutation = function(t, e) {
3505
- return null !== this.fieldMask ? new _e(t, this.data, this.fieldMask, e, this.fieldTransforms) : new be(t, this.data, e, this.fieldTransforms);
3514
+ return null !== this.fieldMask ? new Se(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Te(t, this.data, e, this.fieldTransforms);
3506
3515
  }, t;
3507
- }(), wn = /** @class */ function() {
3516
+ }(), _n = /** @class */ function() {
3508
3517
  function t(t,
3509
3518
  // The fieldMask does not include document transforms.
3510
3519
  e, n) {
3511
3520
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3512
3521
  }
3513
3522
  return t.prototype.toMutation = function(t, e) {
3514
- return new _e(t, this.data, this.fieldMask, e, this.fieldTransforms);
3523
+ return new Se(t, this.data, this.fieldMask, e, this.fieldTransforms);
3515
3524
  }, t;
3516
3525
  }();
3517
3526
 
@@ -3534,7 +3543,7 @@ function(t) {
3534
3543
  /**
3535
3544
  * Sentinel values that can be used when writing document fields with `set()`
3536
3545
  * or `update()`.
3537
- */ function bn(t) {
3546
+ */ function Tn(t) {
3538
3547
  switch (t) {
3539
3548
  case 0 /* Set */ :
3540
3549
  // fall through
@@ -3548,11 +3557,11 @@ function(t) {
3548
3557
  return !1;
3549
3558
 
3550
3559
  default:
3551
- throw S();
3560
+ throw T();
3552
3561
  }
3553
3562
  }
3554
3563
 
3555
- /** A "context" object passed around while parsing user data. */ var _n = /** @class */ function() {
3564
+ /** A "context" object passed around while parsing user data. */ var Sn = /** @class */ function() {
3556
3565
  /**
3557
3566
  * Initializes a ParseContext with the given source and path.
3558
3567
  *
@@ -3572,7 +3581,7 @@ function(t) {
3572
3581
  * compromised).
3573
3582
  */
3574
3583
  function t(t, e, n, r, i, o) {
3575
- this.settings = t, this.databaseId = e, this.S = n, this.ignoreUndefinedProperties = r,
3584
+ this.settings = t, this.databaseId = e, this.q = n, this.ignoreUndefinedProperties = r,
3576
3585
  // Minor hack: If fieldTransforms is undefined, we assume this is an
3577
3586
  // external call and we need to validate the entire path.
3578
3587
  void 0 === i && this.Z(), this.fieldTransforms = i || [], this.fieldMask = o || [];
@@ -3583,36 +3592,36 @@ function(t) {
3583
3592
  },
3584
3593
  enumerable: !1,
3585
3594
  configurable: !0
3586
- }), Object.defineProperty(t.prototype, "X", {
3595
+ }), Object.defineProperty(t.prototype, "tt", {
3587
3596
  get: function() {
3588
- return this.settings.X;
3597
+ return this.settings.tt;
3589
3598
  },
3590
3599
  enumerable: !1,
3591
3600
  configurable: !0
3592
3601
  }),
3593
- /** Returns a new context with the specified settings overwritten. */ t.prototype.tt = function(e) {
3594
- return new t(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.S, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3602
+ /** Returns a new context with the specified settings overwritten. */ t.prototype.nt = function(e) {
3603
+ return new t(Object.assign(Object.assign({}, this.settings), e), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3595
3604
  }, t.prototype.et = function(t) {
3596
- var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.tt({
3605
+ var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.nt({
3597
3606
  path: n,
3598
- nt: !1
3607
+ rt: !1
3599
3608
  });
3600
- return r.rt(t), r;
3601
- }, t.prototype.st = function(t) {
3602
- var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.tt({
3609
+ return r.st(t), r;
3610
+ }, t.prototype.it = function(t) {
3611
+ var e, n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.nt({
3603
3612
  path: n,
3604
- nt: !1
3613
+ rt: !1
3605
3614
  });
3606
3615
  return r.Z(), r;
3607
- }, t.prototype.it = function(t) {
3616
+ }, t.prototype.ot = function(t) {
3608
3617
  // TODO(b/34871131): We don't support array paths right now; so make path
3609
3618
  // undefined.
3610
- return this.tt({
3619
+ return this.nt({
3611
3620
  path: void 0,
3612
- nt: !0
3621
+ rt: !0
3613
3622
  });
3614
- }, t.prototype.ot = function(t) {
3615
- return Cn(t, this.settings.methodName, this.settings.ut || !1, this.path, this.settings.ct);
3623
+ }, t.prototype.ut = function(t) {
3624
+ return Gn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
3616
3625
  },
3617
3626
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
3618
3627
  return void 0 !== this.fieldMask.find((function(e) {
@@ -3623,67 +3632,67 @@ function(t) {
3623
3632
  }, t.prototype.Z = function() {
3624
3633
  // TODO(b/34871131): Remove null check once we have proper paths for fields
3625
3634
  // within arrays.
3626
- if (this.path) for (var t = 0; t < this.path.length; t++) this.rt(this.path.get(t));
3627
- }, t.prototype.rt = function(t) {
3628
- if (0 === t.length) throw this.ot("Document fields must not be empty");
3629
- if (bn(this.X) && vn.test(t)) throw this.ot('Document fields cannot begin and end with "__"');
3635
+ if (this.path) for (var t = 0; t < this.path.length; t++) this.st(this.path.get(t));
3636
+ }, t.prototype.st = function(t) {
3637
+ if (0 === t.length) throw this.ut("Document fields must not be empty");
3638
+ if (Tn(this.tt) && wn.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
3630
3639
  }, t;
3631
- }(), Sn = /** @class */ function() {
3640
+ }(), En = /** @class */ function() {
3632
3641
  function t(t, e, n) {
3633
- this.databaseId = t, this.ignoreUndefinedProperties = e, this.S = n || Ge(t)
3642
+ this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Qe(t)
3634
3643
  /** Creates a new top-level parse context. */;
3635
3644
  }
3636
- return t.prototype.at = function(t, e, n, r) {
3637
- return void 0 === r && (r = !1), new _n({
3638
- X: t,
3645
+ return t.prototype.ht = function(t, e, n, r) {
3646
+ return void 0 === r && (r = !1), new Sn({
3647
+ tt: t,
3639
3648
  methodName: e,
3640
- ct: n,
3641
- path: J.emptyPath(),
3642
- nt: !1,
3643
- ut: r
3644
- }, this.databaseId, this.S, this.ignoreUndefinedProperties);
3649
+ at: n,
3650
+ path: tt.emptyPath(),
3651
+ rt: !1,
3652
+ ct: r
3653
+ }, this.databaseId, this.q, this.ignoreUndefinedProperties);
3645
3654
  }, t;
3646
3655
  }();
3647
3656
 
3648
3657
  /**
3649
3658
  * Helper for parsing raw user input (provided via the API) into internal model
3650
3659
  * classes.
3651
- */ function Tn(t) {
3652
- var e = t._freezeSettings(), n = Ge(t._databaseId);
3653
- return new Sn(t._databaseId, !!e.ignoreUndefinedProperties, n);
3660
+ */ function In(t) {
3661
+ var e = t._freezeSettings(), n = Qe(t._databaseId);
3662
+ return new En(t._databaseId, !!e.ignoreUndefinedProperties, n);
3654
3663
  }
3655
3664
 
3656
- /** Parse document data from a set() call. */ function En(t, e, n, r, i, o) {
3665
+ /** Parse document data from a set() call. */ function An(t, e, n, r, i, o) {
3657
3666
  void 0 === o && (o = {});
3658
- var a = t.at(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
3659
- Rn("Data must be an object, but it was:", a, r);
3660
- var s, u, c = jn(r, a);
3661
- if (o.merge) s = new _t(a.fieldMask), u = a.fieldTransforms; else if (o.mergeFields) {
3662
- for (var f = [], l = 0, h = o.mergeFields; l < h.length; l++) {
3663
- var p = Un(e, h[l], n);
3664
- if (!a.contains(p)) throw new x(V, "Field '" + p + "' is specified in your field mask but missing from your input data.");
3665
- Mn(f, p) || f.push(p);
3667
+ var a = t.ht(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
3668
+ Mn("Data must be an object, but it was:", a, r);
3669
+ var s, u, c = Ln(r, a);
3670
+ if (o.merge) s = new St(a.fieldMask), u = a.fieldTransforms; else if (o.mergeFields) {
3671
+ for (var l = [], f = 0, h = o.mergeFields; f < h.length; f++) {
3672
+ var p = Un(e, h[f], n);
3673
+ if (!a.contains(p)) throw new M(k, "Field '" + p + "' is specified in your field mask but missing from your input data.");
3674
+ zn(l, p) || l.push(p);
3666
3675
  }
3667
- s = new _t(f), u = a.fieldTransforms.filter((function(t) {
3676
+ s = new St(l), u = a.fieldTransforms.filter((function(t) {
3668
3677
  return s.covers(t.field);
3669
3678
  }));
3670
3679
  } else s = null, u = a.fieldTransforms;
3671
- return new gn(new Ct(c), s, u);
3680
+ return new bn(new Gt(c), s, u);
3672
3681
  }
3673
3682
 
3674
- var In = /** @class */ function(e) {
3683
+ var kn = /** @class */ function(e) {
3675
3684
  function n() {
3676
3685
  return null !== e && e.apply(this, arguments) || this;
3677
3686
  }
3678
3687
  return t(n, e), n.prototype._toFieldTransform = function(t) {
3679
- if (2 /* MergeSet */ !== t.X) throw 1 /* Update */ === t.X ? t.ot(this._methodName + "() can only appear at the top level of your update data") : t.ot(this._methodName + "() cannot be used with set() unless you pass {merge:true}");
3688
+ if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(this._methodName + "() can only appear at the top level of your update data") : t.ut(this._methodName + "() cannot be used with set() unless you pass {merge:true}");
3680
3689
  // No transform to add for a delete, but we need to add it to our
3681
3690
  // fieldMask so it gets deleted.
3682
3691
  return t.fieldMask.push(t.path), null;
3683
3692
  }, n.prototype.isEqual = function(t) {
3684
3693
  return t instanceof n;
3685
3694
  }, n;
3686
- }(mn);
3695
+ }(vn);
3687
3696
 
3688
3697
  /**
3689
3698
  * Creates a child context for parsing SerializableFieldValues.
@@ -3700,110 +3709,110 @@ var In = /** @class */ function(e) {
3700
3709
  * context.
3701
3710
  * @param context - The parent context.
3702
3711
  * @param arrayElement - Whether or not the FieldValue has an array.
3703
- */ function An(t, e, n) {
3704
- return new _n({
3705
- X: 3 /* Argument */ ,
3706
- ct: e.settings.ct,
3712
+ */ function Vn(t, e, n) {
3713
+ return new Sn({
3714
+ tt: 3 /* Argument */ ,
3715
+ at: e.settings.at,
3707
3716
  methodName: t._methodName,
3708
- nt: n
3709
- }, e.databaseId, e.S, e.ignoreUndefinedProperties);
3717
+ rt: n
3718
+ }, e.databaseId, e.q, e.ignoreUndefinedProperties);
3710
3719
  }
3711
3720
 
3712
- var Vn = /** @class */ function(e) {
3721
+ var Dn = /** @class */ function(e) {
3713
3722
  function n() {
3714
3723
  return null !== e && e.apply(this, arguments) || this;
3715
3724
  }
3716
3725
  return t(n, e), n.prototype._toFieldTransform = function(t) {
3717
- return new ve(t.path, new pe);
3726
+ return new we(t.path, new me);
3718
3727
  }, n.prototype.isEqual = function(t) {
3719
3728
  return t instanceof n;
3720
3729
  }, n;
3721
- }(mn), Dn = /** @class */ function(e) {
3730
+ }(vn), Pn = /** @class */ function(e) {
3722
3731
  function n(t, n) {
3723
3732
  var r = this;
3724
- return (r = e.call(this, t) || this).ht = n, r;
3733
+ return (r = e.call(this, t) || this).lt = n, r;
3725
3734
  }
3726
3735
  return t(n, e), n.prototype._toFieldTransform = function(t) {
3727
- var e = An(this, t,
3728
- /*array=*/ !0), n = this.ht.map((function(t) {
3729
- return qn(t, e);
3730
- })), r = new de(n);
3731
- return new ve(t.path, r);
3736
+ var e = Vn(this, t,
3737
+ /*array=*/ !0), n = this.lt.map((function(t) {
3738
+ return jn(t, e);
3739
+ })), r = new ye(n);
3740
+ return new we(t.path, r);
3732
3741
  }, n.prototype.isEqual = function(t) {
3733
3742
  // TODO(mrschmidt): Implement isEquals
3734
3743
  return this === t;
3735
3744
  }, n;
3736
- }(mn), kn = /** @class */ function(e) {
3745
+ }(vn), Fn = /** @class */ function(e) {
3737
3746
  function n(t, n) {
3738
3747
  var r = this;
3739
- return (r = e.call(this, t) || this).ht = n, r;
3748
+ return (r = e.call(this, t) || this).lt = n, r;
3740
3749
  }
3741
3750
  return t(n, e), n.prototype._toFieldTransform = function(t) {
3742
- var e = An(this, t,
3743
- /*array=*/ !0), n = this.ht.map((function(t) {
3744
- return qn(t, e);
3745
- })), r = new me(n);
3746
- return new ve(t.path, r);
3751
+ var e = Vn(this, t,
3752
+ /*array=*/ !0), n = this.lt.map((function(t) {
3753
+ return jn(t, e);
3754
+ })), r = new ve(n);
3755
+ return new we(t.path, r);
3747
3756
  }, n.prototype.isEqual = function(t) {
3748
3757
  // TODO(mrschmidt): Implement isEquals
3749
3758
  return this === t;
3750
3759
  }, n;
3751
- }(mn), Pn = /** @class */ function(e) {
3760
+ }(vn), Nn = /** @class */ function(e) {
3752
3761
  function n(t, n) {
3753
3762
  var r = this;
3754
- return (r = e.call(this, t) || this).lt = n, r;
3763
+ return (r = e.call(this, t) || this).ft = n, r;
3755
3764
  }
3756
3765
  return t(n, e), n.prototype._toFieldTransform = function(t) {
3757
- var e = new ye(t.S, le(t.S, this.lt));
3758
- return new ve(t.path, e);
3766
+ var e = new ge(t.q, pe(t.q, this.ft));
3767
+ return new we(t.path, e);
3759
3768
  }, n.prototype.isEqual = function(t) {
3760
3769
  // TODO(mrschmidt): Implement isEquals
3761
3770
  return this === t;
3762
3771
  }, n;
3763
- }(mn);
3772
+ }(vn);
3764
3773
 
3765
- /** Parse update data from an update() call. */ function Nn(t, e, n, r) {
3766
- var i = t.at(1 /* Update */ , e, n);
3767
- Rn("Data must be an object, but it was:", i, r);
3768
- var o = [], a = Ct.empty();
3769
- bt(r, (function(t, r) {
3774
+ /** Parse update data from an update() call. */ function qn(t, e, n, r) {
3775
+ var i = t.ht(1 /* Update */ , e, n);
3776
+ Mn("Data must be an object, but it was:", i, r);
3777
+ var o = [], a = Gt.empty();
3778
+ Tt(r, (function(t, r) {
3770
3779
  var s = Bn(e, t, n);
3771
3780
  // For Compat types, we have to "extract" the underlying types before
3772
3781
  // performing validation.
3773
3782
  r = h(r);
3774
- var u = i.st(s);
3775
- if (r instanceof In)
3783
+ var u = i.it(s);
3784
+ if (r instanceof kn)
3776
3785
  // Add it to the field mask, but don't add anything to updateData.
3777
3786
  o.push(s); else {
3778
- var c = qn(r, u);
3787
+ var c = jn(r, u);
3779
3788
  null != c && (o.push(s), a.set(s, c));
3780
3789
  }
3781
3790
  }));
3782
- var s = new _t(o);
3783
- return new wn(a, s, i.fieldTransforms);
3791
+ var s = new St(o);
3792
+ return new _n(a, s, i.fieldTransforms);
3784
3793
  }
3785
3794
 
3786
- /** Parse update data from a list of field/value arguments. */ function Fn(t, e, n, r, i, o) {
3787
- var a = t.at(1 /* Update */ , e, n), s = [ Un(e, r, n) ], u = [ i ];
3788
- if (o.length % 2 != 0) throw new x(V, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
3795
+ /** Parse update data from a list of field/value arguments. */ function On(t, e, n, r, i, o) {
3796
+ var a = t.ht(1 /* Update */ , e, n), s = [ Un(e, r, n) ], u = [ i ];
3797
+ if (o.length % 2 != 0) throw new M(k, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
3789
3798
  for (var c = 0; c < o.length; c += 2) s.push(Un(e, o[c])), u.push(o[c + 1]);
3790
3799
  // We iterate in reverse order to pick the last value for a field if the
3791
3800
  // user specified the field multiple times.
3792
- for (var f = [], l = Ct.empty(), p = s.length - 1; p >= 0; --p) if (!Mn(f, s[p])) {
3801
+ for (var l = [], f = Gt.empty(), p = s.length - 1; p >= 0; --p) if (!zn(l, s[p])) {
3793
3802
  var d = s[p], m = u[p];
3794
3803
  // For Compat types, we have to "extract" the underlying types before
3795
3804
  // performing validation.
3796
3805
  m = h(m);
3797
- var y = a.st(d);
3798
- if (m instanceof In)
3806
+ var y = a.it(d);
3807
+ if (m instanceof kn)
3799
3808
  // Add it to the field mask, but don't add anything to updateData.
3800
- f.push(d); else {
3801
- var v = qn(m, y);
3802
- null != v && (f.push(d), l.set(d, v));
3809
+ l.push(d); else {
3810
+ var v = jn(m, y);
3811
+ null != v && (l.push(d), f.set(d, v));
3803
3812
  }
3804
3813
  }
3805
- var g = new _t(f);
3806
- return new wn(l, g, a.fieldTransforms);
3814
+ var g = new St(l);
3815
+ return new _n(f, g, a.fieldTransforms);
3807
3816
  }
3808
3817
 
3809
3818
  /**
@@ -3812,8 +3821,8 @@ var Vn = /** @class */ function(e) {
3812
3821
  *
3813
3822
  * @param allowArrays - Whether the query value is an array that may directly
3814
3823
  * contain additional arrays (e.g. the operand of an `in` query).
3815
- */ function On(t, e, n, r) {
3816
- return void 0 === r && (r = !1), qn(n, t.at(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
3824
+ */ function Cn(t, e, n, r) {
3825
+ return void 0 === r && (r = !1), jn(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
3817
3826
  }
3818
3827
 
3819
3828
  /**
@@ -3824,12 +3833,12 @@ var Vn = /** @class */ function(e) {
3824
3833
  * the source of the data being parsed, etc.
3825
3834
  * @returns The parsed value, or null if the value was a FieldValue sentinel
3826
3835
  * that should not be included in the resulting parsed data.
3827
- */ function qn(t, e) {
3828
- if (Ln(
3836
+ */ function jn(t, e) {
3837
+ if (Rn(
3829
3838
  // Unwrap the API type from the Compat SDK. This will return the API type
3830
3839
  // from firestore-exp.
3831
- t = h(t))) return Rn("Unsupported field value:", e, t), jn(t, e);
3832
- if (t instanceof mn)
3840
+ t = h(t))) return Mn("Unsupported field value:", e, t), Ln(t, e);
3841
+ if (t instanceof vn)
3833
3842
  // FieldValues usually parse into transforms (except FieldValue.delete())
3834
3843
  // in which case we do not want to include this field in our parsed data
3835
3844
  // (as doing so will overwrite the field directly prior to the transform
@@ -3841,8 +3850,8 @@ var Vn = /** @class */ function(e) {
3841
3850
  */
3842
3851
  return function(t, e) {
3843
3852
  // Sentinels are only supported with writes, and not within arrays.
3844
- if (!bn(e.X)) throw e.ot(t._methodName + "() can only be used with update() and set()");
3845
- if (!e.path) throw e.ot(t._methodName + "() is not currently supported inside arrays");
3853
+ if (!Tn(e.tt)) throw e.ut(t._methodName + "() can only be used with update() and set()");
3854
+ if (!e.path) throw e.ut(t._methodName + "() is not currently supported inside arrays");
3846
3855
  var n = t._toFieldTransform(e);
3847
3856
  n && e.fieldTransforms.push(n);
3848
3857
  }(t, e), null;
@@ -3861,10 +3870,10 @@ var Vn = /** @class */ function(e) {
3861
3870
  // the set of values to be included for the IN query) that may directly
3862
3871
  // contain additional arrays (each representing an individual field
3863
3872
  // value), so we disable this validation.
3864
- if (e.settings.nt && 4 /* ArrayArgument */ !== e.X) throw e.ot("Nested arrays are not supported");
3873
+ if (e.settings.rt && 4 /* ArrayArgument */ !== e.tt) throw e.ut("Nested arrays are not supported");
3865
3874
  return function(t, e) {
3866
3875
  for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
3867
- var a = qn(o[i], e.it(r));
3876
+ var a = jn(o[i], e.ot(r));
3868
3877
  null == a && (
3869
3878
  // Just include nulls in the array for fields being replaced with a
3870
3879
  // sentinel.
@@ -3883,7 +3892,7 @@ var Vn = /** @class */ function(e) {
3883
3892
  if (null === (t = h(t))) return {
3884
3893
  nullValue: "NULL_VALUE"
3885
3894
  };
3886
- if ("number" == typeof t) return le(e.S, t);
3895
+ if ("number" == typeof t) return pe(e.q, t);
3887
3896
  if ("boolean" == typeof t) return {
3888
3897
  booleanValue: t
3889
3898
  };
@@ -3891,41 +3900,41 @@ var Vn = /** @class */ function(e) {
3891
3900
  stringValue: t
3892
3901
  };
3893
3902
  if (t instanceof Date) {
3894
- var n = vt.fromDate(t);
3903
+ var n = wt.fromDate(t);
3895
3904
  return {
3896
- timestampValue: Ve(e.S, n)
3905
+ timestampValue: De(e.q, n)
3897
3906
  };
3898
3907
  }
3899
- if (t instanceof vt) {
3908
+ if (t instanceof wt) {
3900
3909
  // Firestore backend truncates precision down to microseconds. To ensure
3901
3910
  // offline mode works the same with regards to truncation, perform the
3902
3911
  // truncation immediately without waiting for the backend to do that.
3903
- var r = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
3912
+ var r = new wt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
3904
3913
  return {
3905
- timestampValue: Ve(e.S, r)
3914
+ timestampValue: De(e.q, r)
3906
3915
  };
3907
3916
  }
3908
- if (t instanceof yn) return {
3917
+ if (t instanceof gn) return {
3909
3918
  geoPointValue: {
3910
3919
  latitude: t.latitude,
3911
3920
  longitude: t.longitude
3912
3921
  }
3913
3922
  };
3914
- if (t instanceof dn) return {
3915
- bytesValue: De(e.S, t._byteString)
3923
+ if (t instanceof yn) return {
3924
+ bytesValue: Pe(e.q, t._byteString)
3916
3925
  };
3917
- if (t instanceof rn) {
3926
+ if (t instanceof an) {
3918
3927
  var i = e.databaseId, o = t.firestore._databaseId;
3919
- if (!o.isEqual(i)) throw e.ot("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database);
3928
+ if (!o.isEqual(i)) throw e.ut("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database);
3920
3929
  return {
3921
- referenceValue: Ne(t.firestore._databaseId || e.databaseId, t._key.path)
3930
+ referenceValue: qe(t.firestore._databaseId || e.databaseId, t._key.path)
3922
3931
  };
3923
3932
  }
3924
- throw e.ot("Unsupported field value: " + rt(t));
3933
+ throw e.ut("Unsupported field value: " + ot(t));
3925
3934
  }(t, e);
3926
3935
  }
3927
3936
 
3928
- function jn(t, e) {
3937
+ function Ln(t, e) {
3929
3938
  var n = {};
3930
3939
  return function(t) {
3931
3940
  for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
@@ -3933,8 +3942,8 @@ function jn(t, e) {
3933
3942
  }(t) ?
3934
3943
  // If we encounter an empty object, we explicitly add it to the update
3935
3944
  // mask to ensure that the server creates a map entry.
3936
- e.path && e.path.length > 0 && e.fieldMask.push(e.path) : bt(t, (function(t, r) {
3937
- var i = qn(r, e.et(t));
3945
+ e.path && e.path.length > 0 && e.fieldMask.push(e.path) : Tt(t, (function(t, r) {
3946
+ var i = jn(r, e.et(t));
3938
3947
  null != i && (n[t] = i);
3939
3948
  })), {
3940
3949
  mapValue: {
@@ -3943,16 +3952,16 @@ function jn(t, e) {
3943
3952
  };
3944
3953
  }
3945
3954
 
3946
- function Ln(t) {
3947
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof yn || t instanceof dn || t instanceof rn || t instanceof mn);
3955
+ function Rn(t) {
3956
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof wt || t instanceof gn || t instanceof yn || t instanceof an || t instanceof vn);
3948
3957
  }
3949
3958
 
3950
- function Rn(t, e, n) {
3951
- if (!Ln(n) || !function(t) {
3959
+ function Mn(t, e, n) {
3960
+ if (!Rn(n) || !function(t) {
3952
3961
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
3953
3962
  }(n)) {
3954
- var r = rt(n);
3955
- throw "an object" === r ? e.ot(t + " a custom object") : e.ot(t + " " + r);
3963
+ var r = ot(n);
3964
+ throw "an object" === r ? e.ut(t + " a custom object") : e.ut(t + " " + r);
3956
3965
  }
3957
3966
  }
3958
3967
 
@@ -3962,9 +3971,9 @@ function Rn(t, e, n) {
3962
3971
  if (
3963
3972
  // If required, replace the FieldPath Compat class with with the firestore-exp
3964
3973
  // FieldPath.
3965
- (e = h(e)) instanceof hn) return e._internalPath;
3974
+ (e = h(e)) instanceof dn) return e._internalPath;
3966
3975
  if ("string" == typeof e) return Bn(t, e);
3967
- throw Cn("Field path arguments must be of type string or FieldPath.", t,
3976
+ throw Gn("Field path arguments must be of type string or FieldPath.", t,
3968
3977
  /* hasConverter= */ !1,
3969
3978
  /* path= */ void 0, n);
3970
3979
  }
@@ -3982,28 +3991,28 @@ function Rn(t, e, n) {
3982
3991
  * @param targetDoc - The document against which the field path will be
3983
3992
  * evaluated.
3984
3993
  */ function Bn(t, e, n) {
3985
- if (e.search(xn) >= 0) throw Cn("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
3994
+ if (e.search(xn) >= 0) throw Gn("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
3986
3995
  /* hasConverter= */ !1,
3987
3996
  /* path= */ void 0, n);
3988
3997
  try {
3989
- return (new (hn.bind.apply(hn, r([ void 0 ], e.split(".")))))._internalPath;
3998
+ return (new (dn.bind.apply(dn, r([ void 0 ], e.split(".")))))._internalPath;
3990
3999
  } catch (r) {
3991
- throw Cn("Invalid field path (" + e + "). Paths must not be empty, begin with '.', end with '.', or contain '..'", t,
4000
+ throw Gn("Invalid field path (" + e + "). Paths must not be empty, begin with '.', end with '.', or contain '..'", t,
3992
4001
  /* hasConverter= */ !1,
3993
4002
  /* path= */ void 0, n);
3994
4003
  }
3995
4004
  }
3996
4005
 
3997
- function Cn(t, e, n, r, i) {
4006
+ function Gn(t, e, n, r, i) {
3998
4007
  var o = r && !r.isEmpty(), a = void 0 !== i, s = "Function " + e + "() called with invalid data";
3999
4008
  n && (s += " (via `toFirestore()`)");
4000
4009
  var u = "";
4001
4010
  return (o || a) && (u += " (found", o && (u += " in field " + r), a && (u += " in document " + i),
4002
- u += ")"), new x(V, (s += ". ") + t + u)
4011
+ u += ")"), new M(k, (s += ". ") + t + u)
4003
4012
  /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */;
4004
4013
  }
4005
4014
 
4006
- function Mn(t, e) {
4015
+ function zn(t, e) {
4007
4016
  return t.some((function(t) {
4008
4017
  return t.isEqual(e);
4009
4018
  }));
@@ -4033,7 +4042,7 @@ function Mn(t, e) {
4033
4042
  * For a `DocumentSnapshot` that points to a non-existing document, any data
4034
4043
  * access will return 'undefined'. You can use the `exists()` method to
4035
4044
  * explicitly verify a document's existence.
4036
- */ var Gn = /** @class */ function() {
4045
+ */ var Qn = /** @class */ function() {
4037
4046
  // Note: This class is stripped down version of the DocumentSnapshot in
4038
4047
  // the legacy SDK. The changes are:
4039
4048
  // - No support for SnapshotMetadata.
@@ -4054,7 +4063,7 @@ function Mn(t, e) {
4054
4063
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
4055
4064
  */
4056
4065
  get: function() {
4057
- return new rn(this._firestore, this._converter, this._key);
4066
+ return new an(this._firestore, this._converter, this._key);
4058
4067
  },
4059
4068
  enumerable: !1,
4060
4069
  configurable: !0
@@ -4079,7 +4088,7 @@ function Mn(t, e) {
4079
4088
  if (this._converter) {
4080
4089
  // We only want to use the converter and create a new DocumentSnapshot
4081
4090
  // if a converter has been provided.
4082
- var t = new Qn(this._firestore, this._userDataWriter, this._key, this._document,
4091
+ var t = new Kn(this._firestore, this._userDataWriter, this._key, this._document,
4083
4092
  /* converter= */ null);
4084
4093
  return this._converter.fromFirestore(t);
4085
4094
  }
@@ -4099,11 +4108,11 @@ function Mn(t, e) {
4099
4108
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4100
4109
  t.prototype.get = function(t) {
4101
4110
  if (this._document) {
4102
- var e = this._document.data.field(Kn("DocumentSnapshot.get", t));
4111
+ var e = this._document.data.field(Yn("DocumentSnapshot.get", t));
4103
4112
  if (null !== e) return this._userDataWriter.convertValue(e);
4104
4113
  }
4105
4114
  }, t;
4106
- }(), Qn = /** @class */ function(e) {
4115
+ }(), Kn = /** @class */ function(e) {
4107
4116
  function n() {
4108
4117
  return null !== e && e.apply(this, arguments) || this;
4109
4118
  }
@@ -4115,7 +4124,7 @@ function Mn(t, e) {
4115
4124
  */ return t(n, e), n.prototype.data = function() {
4116
4125
  return e.prototype.data.call(this);
4117
4126
  }, n;
4118
- }(Gn), zn = /** @class */ function() {
4127
+ }(Qn), Hn = /** @class */ function() {
4119
4128
  /** @hideconstructor */
4120
4129
  function t(t, e) {
4121
4130
  this._docs = e, this.query = t;
@@ -4169,15 +4178,15 @@ function Mn(t, e) {
4169
4178
  * @param right - A snapshot to compare.
4170
4179
  * @returns true if the snapshots are equal.
4171
4180
  */
4172
- function Hn(t, e) {
4173
- return t = h(t), e = h(e), t instanceof Gn && e instanceof Gn ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof zn && e instanceof zn && ln(t.query, e.query) && yt(t.docs, e.docs, Hn)
4181
+ function Wn(t, e) {
4182
+ return t = h(t), e = h(e), t instanceof Qn && e instanceof Qn ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Hn && e instanceof Hn && pn(t.query, e.query) && gt(t.docs, e.docs, Wn)
4174
4183
  /**
4175
4184
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
4176
4185
  */;
4177
4186
  }
4178
4187
 
4179
- function Kn(t, e) {
4180
- return "string" == typeof e ? Bn(t, e) : e instanceof hn ? e._internalPath : e._delegate._internalPath;
4188
+ function Yn(t, e) {
4189
+ return "string" == typeof e ? Bn(t, e) : e instanceof dn ? e._internalPath : e._delegate._internalPath;
4181
4190
  }
4182
4191
 
4183
4192
  /**
@@ -4203,7 +4212,7 @@ function Kn(t, e) {
4203
4212
  * endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
4204
4213
  * can then be passed to {@link query} to create a new query instance that
4205
4214
  * also contains this `QueryConstraint`.
4206
- */ var Wn = function() {};
4215
+ */ var $n = function() {};
4207
4216
 
4208
4217
  /**
4209
4218
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -4213,7 +4222,7 @@ function Kn(t, e) {
4213
4222
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4214
4223
  * @throws if any of the provided query constraints cannot be combined with the
4215
4224
  * existing or new constraints.
4216
- */ function Yn(t) {
4225
+ */ function Xn(t) {
4217
4226
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
4218
4227
  for (var r = 0, i = e; r < i.length; r++) {
4219
4228
  var o = i[r];
@@ -4222,39 +4231,39 @@ function Kn(t, e) {
4222
4231
  return t;
4223
4232
  }
4224
4233
 
4225
- var Xn = /** @class */ function(e) {
4234
+ var Jn = /** @class */ function(e) {
4226
4235
  function n(t, n, r) {
4227
4236
  var i = this;
4228
- return (i = e.call(this) || this).ft = t, i.dt = n, i.wt = r, i.type = "where",
4237
+ return (i = e.call(this) || this).dt = t, i.wt = n, i.yt = r, i.type = "where",
4229
4238
  i;
4230
4239
  }
4231
4240
  return t(n, e), n.prototype._apply = function(t) {
4232
- var e = Tn(t.firestore), n = function(t, e, n, r, i, o, a) {
4241
+ var e = In(t.firestore), n = function(t, e, n, r, i, o, a) {
4233
4242
  var s;
4234
4243
  if (i.isKeyField()) {
4235
- if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new x(V, "Invalid Query. You can't perform '" + o + "' queries on FieldPath.documentId().");
4244
+ if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new M(k, "Invalid Query. You can't perform '" + o + "' queries on FieldPath.documentId().");
4236
4245
  if ("in" /* IN */ === o || "not-in" /* NOT_IN */ === o) {
4237
- lr(a, o);
4238
- for (var u = [], c = 0, f = a; c < f.length; c++) {
4239
- var l = f[c];
4240
- u.push(fr(r, t, l));
4246
+ pr(a, o);
4247
+ for (var u = [], c = 0, l = a; c < l.length; c++) {
4248
+ var f = l[c];
4249
+ u.push(hr(r, t, f));
4241
4250
  }
4242
4251
  s = {
4243
4252
  arrayValue: {
4244
4253
  values: u
4245
4254
  }
4246
4255
  };
4247
- } else s = fr(r, t, a);
4248
- } else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || lr(a, o),
4249
- s = On(n, "where", a,
4256
+ } else s = hr(r, t, a);
4257
+ } else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || pr(a, o),
4258
+ s = Cn(n, "where", a,
4250
4259
  /* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o);
4251
- var h = zt.create(i, o, s);
4260
+ var h = Ht.create(i, o, s);
4252
4261
  return function(t, e) {
4253
- if (e.D()) {
4254
- var n = se(t);
4255
- if (null !== n && !n.isEqual(e.field)) throw new x(V, "Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '" + n.toString() + "' and '" + e.field.toString() + "'");
4256
- var r = ae(t);
4257
- null !== r && hr(t, e.field, r);
4262
+ if (e.N()) {
4263
+ var n = ce(t);
4264
+ if (null !== n && !n.isEqual(e.field)) throw new M(k, "Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '" + n.toString() + "' and '" + e.field.toString() + "'");
4265
+ var r = ue(t);
4266
+ null !== r && dr(t, e.field, r);
4258
4267
  }
4259
4268
  var i = function(t, e) {
4260
4269
  for (var n = 0, r = t.filters; n < r.length; n++) {
@@ -4298,15 +4307,15 @@ var Xn = /** @class */ function(e) {
4298
4307
  }(e.op));
4299
4308
  if (null !== i)
4300
4309
  // Special case when it's a duplicate op to give a slightly clearer error message.
4301
- throw i === e.op ? new x(V, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new x(V, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
4310
+ throw i === e.op ? new M(k, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new M(k, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
4302
4311
  }(t, h), h;
4303
- }(t._query, 0, e, t.firestore._databaseId, this.ft, this.dt, this.wt);
4304
- return new on(t.firestore, t.converter, function(t, e) {
4312
+ }(t._query, 0, e, t.firestore._databaseId, this.dt, this.wt, this.yt);
4313
+ return new sn(t.firestore, t.converter, function(t, e) {
4305
4314
  var n = t.filters.concat([ e ]);
4306
- return new ie(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4315
+ return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4307
4316
  }(t._query, n));
4308
4317
  }, n;
4309
- }(Wn);
4318
+ }($n);
4310
4319
 
4311
4320
  /**
4312
4321
  * Creates a {@link QueryConstraint} that enforces that documents must contain the
@@ -4318,36 +4327,36 @@ var Xn = /** @class */ function(e) {
4318
4327
  * "&lt;=", "!=").
4319
4328
  * @param value - The value for comparison
4320
4329
  * @returns The created {@link Query}.
4321
- */ function $n(t, e, n) {
4322
- var r = e, i = Kn("where", t);
4323
- return new Xn(i, r, n);
4330
+ */ function Zn(t, e, n) {
4331
+ var r = e, i = Yn("where", t);
4332
+ return new Jn(i, r, n);
4324
4333
  }
4325
4334
 
4326
- var Jn = /** @class */ function(e) {
4335
+ var tr = /** @class */ function(e) {
4327
4336
  function n(t, n) {
4328
4337
  var r = this;
4329
- return (r = e.call(this) || this).ft = t, r.yt = n, r.type = "orderBy", r;
4338
+ return (r = e.call(this) || this).dt = t, r._t = n, r.type = "orderBy", r;
4330
4339
  }
4331
4340
  return t(n, e), n.prototype._apply = function(t) {
4332
4341
  var e = function(t, e, n) {
4333
- if (null !== t.startAt) throw new x(V, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4334
- if (null !== t.endAt) throw new x(V, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4335
- var r = new ee(e, n);
4342
+ if (null !== t.startAt) throw new M(k, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4343
+ if (null !== t.endAt) throw new M(k, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4344
+ var r = new re(e, n);
4336
4345
  return function(t, e) {
4337
- if (null === ae(t)) {
4346
+ if (null === ue(t)) {
4338
4347
  // This is the first order by. It must match any inequality.
4339
- var n = se(t);
4340
- null !== n && hr(t, n, e.field);
4348
+ var n = ce(t);
4349
+ null !== n && dr(t, n, e.field);
4341
4350
  }
4342
4351
  }(t, r), r;
4343
- }(t._query, this.ft, this.yt);
4344
- return new on(t.firestore, t.converter, function(t, e) {
4352
+ }(t._query, this.dt, this._t);
4353
+ return new sn(t.firestore, t.converter, function(t, e) {
4345
4354
  // TODO(dimond): validate that orderBy does not list the same key twice.
4346
4355
  var n = t.explicitOrderBy.concat([ e ]);
4347
- return new ie(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4356
+ return new ae(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4348
4357
  }(t._query, e));
4349
4358
  }, n;
4350
- }(Wn);
4359
+ }($n);
4351
4360
 
4352
4361
  /**
4353
4362
  * Creates a {@link QueryConstraint} that sorts the query result by the
@@ -4357,31 +4366,31 @@ var Jn = /** @class */ function(e) {
4357
4366
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
4358
4367
  * not specified, order will be ascending.
4359
4368
  * @returns The created {@link Query}.
4360
- */ function Zn(t, e) {
4369
+ */ function er(t, e) {
4361
4370
  void 0 === e && (e = "asc");
4362
- var n = e, r = Kn("orderBy", t);
4363
- return new Jn(r, n);
4371
+ var n = e, r = Yn("orderBy", t);
4372
+ return new tr(r, n);
4364
4373
  }
4365
4374
 
4366
- var tr = /** @class */ function(e) {
4375
+ var nr = /** @class */ function(e) {
4367
4376
  function n(t, n, r) {
4368
4377
  var i = this;
4369
- return (i = e.call(this) || this).type = t, i._t = n, i.gt = r, i;
4378
+ return (i = e.call(this) || this).type = t, i.gt = n, i.bt = r, i;
4370
4379
  }
4371
4380
  return t(n, e), n.prototype._apply = function(t) {
4372
- return new on(t.firestore, t.converter, function(t, e, n) {
4373
- return new ie(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4374
- }(t._query, this._t, this.gt));
4381
+ return new sn(t.firestore, t.converter, function(t, e, n) {
4382
+ return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4383
+ }(t._query, this.gt, this.bt));
4375
4384
  }, n;
4376
- }(Wn);
4385
+ }($n);
4377
4386
 
4378
4387
  /**
4379
4388
  * Creates a {@link QueryConstraint} that only returns the first matching documents.
4380
4389
  *
4381
4390
  * @param limit - The maximum number of items to return.
4382
4391
  * @returns The created {@link Query}.
4383
- */ function er(t) {
4384
- return ot("limit", t), new tr("limit", t, "F" /* First */)
4392
+ */ function rr(t) {
4393
+ return st("limit", t), new nr("limit", t, "F" /* First */)
4385
4394
  /**
4386
4395
  * Creates a {@link QueryConstraint} that only returns the last matching documents.
4387
4396
  *
@@ -4393,60 +4402,60 @@ var tr = /** @class */ function(e) {
4393
4402
  */;
4394
4403
  }
4395
4404
 
4396
- function nr(t) {
4397
- return ot("limitToLast", t), new tr("limitToLast", t, "L" /* Last */);
4405
+ function ir(t) {
4406
+ return st("limitToLast", t), new nr("limitToLast", t, "L" /* Last */);
4398
4407
  }
4399
4408
 
4400
- var rr = /** @class */ function(e) {
4409
+ var or = /** @class */ function(e) {
4401
4410
  function n(t, n, r) {
4402
4411
  var i = this;
4403
- return (i = e.call(this) || this).type = t, i.bt = n, i.vt = r, i;
4412
+ return (i = e.call(this) || this).type = t, i.vt = n, i.Et = r, i;
4404
4413
  }
4405
4414
  return t(n, e), n.prototype._apply = function(t) {
4406
- var e = cr(t, this.type, this.bt, this.vt);
4407
- return new on(t.firestore, t.converter, function(t, e) {
4408
- return new ie(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4415
+ var e = fr(t, this.type, this.vt, this.Et);
4416
+ return new sn(t.firestore, t.converter, function(t, e) {
4417
+ return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4409
4418
  }(t._query, e));
4410
4419
  }, n;
4411
- }(Wn);
4420
+ }($n);
4412
4421
 
4413
- function ir() {
4422
+ function ar() {
4414
4423
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4415
- return new rr("startAt", t, /*before=*/ !0);
4424
+ return new or("startAt", t, /*before=*/ !0);
4416
4425
  }
4417
4426
 
4418
- function or() {
4427
+ function sr() {
4419
4428
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4420
- return new rr("startAfter", t,
4429
+ return new or("startAfter", t,
4421
4430
  /*before=*/ !1);
4422
4431
  }
4423
4432
 
4424
- var ar = /** @class */ function(e) {
4433
+ var ur = /** @class */ function(e) {
4425
4434
  function n(t, n, r) {
4426
4435
  var i = this;
4427
- return (i = e.call(this) || this).type = t, i.bt = n, i.vt = r, i;
4436
+ return (i = e.call(this) || this).type = t, i.vt = n, i.Et = r, i;
4428
4437
  }
4429
4438
  return t(n, e), n.prototype._apply = function(t) {
4430
- var e = cr(t, this.type, this.bt, this.vt);
4431
- return new on(t.firestore, t.converter, function(t, e) {
4432
- return new ie(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4439
+ var e = fr(t, this.type, this.vt, this.Et);
4440
+ return new sn(t.firestore, t.converter, function(t, e) {
4441
+ return new ae(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4433
4442
  }(t._query, e));
4434
4443
  }, n;
4435
- }(Wn);
4444
+ }($n);
4436
4445
 
4437
- function sr() {
4446
+ function cr() {
4438
4447
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4439
- return new ar("endBefore", t, /*before=*/ !0);
4448
+ return new ur("endBefore", t, /*before=*/ !0);
4440
4449
  }
4441
4450
 
4442
- function ur() {
4451
+ function lr() {
4443
4452
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4444
- return new ar("endAt", t, /*before=*/ !1);
4453
+ return new ur("endAt", t, /*before=*/ !1);
4445
4454
  }
4446
4455
 
4447
- /** Helper function to create a bound from a document or fields */ function cr(t, e, n, r) {
4448
- if (n[0] = h(n[0]), n[0] instanceof Gn) return function(t, e, n, r, i) {
4449
- if (!r) throw new x(k, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
4456
+ /** Helper function to create a bound from a document or fields */ function fr(t, e, n, r) {
4457
+ if (n[0] = h(n[0]), n[0] instanceof Qn) return function(t, e, n, r, i) {
4458
+ if (!r) throw new M(D, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
4450
4459
  // Because people expect to continue/end a query at the exact document
4451
4460
  // provided, we need to use the implicit sort order rather than the explicit
4452
4461
  // sort order, because it's guaranteed to contain the document key. That way
@@ -4454,65 +4463,65 @@ function ur() {
4454
4463
  // the provided document. Without the key (by using the explicit sort
4455
4464
  // orders), multiple documents could match the position, yielding duplicate
4456
4465
  // results.
4457
- for (var o = [], a = 0, s = ce(t); a < s.length; a++) {
4466
+ for (var o = [], a = 0, s = fe(t); a < s.length; a++) {
4458
4467
  var u = s[a];
4459
- if (u.field.isKeyField()) o.push(jt(e, r.key)); else {
4468
+ if (u.field.isKeyField()) o.push(Lt(e, r.key)); else {
4460
4469
  var c = r.data.field(u.field);
4461
- if (Vt(c)) throw new x(V, 'Invalid query. You are trying to start or end a query using a document for which the field "' + u.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4470
+ if (Dt(c)) throw new M(k, 'Invalid query. You are trying to start or end a query using a document for which the field "' + u.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4462
4471
  if (null === c) {
4463
- var f = u.field.canonicalString();
4464
- throw new x(V, "Invalid query. You are trying to start or end a query using a document for which the field '" + f + "' (used as the orderBy) does not exist.");
4472
+ var l = u.field.canonicalString();
4473
+ throw new M(k, "Invalid query. You are trying to start or end a query using a document for which the field '" + l + "' (used as the orderBy) does not exist.");
4465
4474
  }
4466
4475
  o.push(c);
4467
4476
  }
4468
4477
  }
4469
- return new te(o, i);
4478
+ return new ne(o, i);
4470
4479
  }(t._query, t.firestore._databaseId, e, n[0]._document, r);
4471
- var i = Tn(t.firestore);
4480
+ var i = In(t.firestore);
4472
4481
  return function(t, e, n, r, i, o) {
4473
4482
  // Use explicit order by's because it has to match the query the user made
4474
4483
  var a = t.explicitOrderBy;
4475
- if (i.length > a.length) throw new x(V, "Too many arguments provided to " + r + "(). The number of arguments must be less than or equal to the number of orderBy() clauses");
4484
+ if (i.length > a.length) throw new M(k, "Too many arguments provided to " + r + "(). The number of arguments must be less than or equal to the number of orderBy() clauses");
4476
4485
  for (var s = [], u = 0; u < i.length; u++) {
4477
4486
  var c = i[u];
4478
4487
  if (a[u].field.isKeyField()) {
4479
- if ("string" != typeof c) throw new x(V, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
4480
- if (!ue(t) && -1 !== c.indexOf("/")) throw new x(V, "Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to " + r + "() must be a plain document ID, but '" + c + "' contains a slash.");
4481
- var f = t.path.child(X.fromString(c));
4482
- if (!Z.isDocumentKey(f)) throw new x(V, "Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to " + r + "() must result in a valid document path, but '" + f + "' is not because it contains an odd number of segments.");
4483
- var l = new Z(f);
4484
- s.push(jt(e, l));
4488
+ if ("string" != typeof c) throw new M(k, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
4489
+ if (!le(t) && -1 !== c.indexOf("/")) throw new M(k, "Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to " + r + "() must be a plain document ID, but '" + c + "' contains a slash.");
4490
+ var l = t.path.child(J.fromString(c));
4491
+ if (!et.isDocumentKey(l)) throw new M(k, "Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to " + r + "() must result in a valid document path, but '" + l + "' is not because it contains an odd number of segments.");
4492
+ var f = new et(l);
4493
+ s.push(Lt(e, f));
4485
4494
  } else {
4486
- var h = On(n, r, c);
4495
+ var h = Cn(n, r, c);
4487
4496
  s.push(h);
4488
4497
  }
4489
4498
  }
4490
- return new te(s, o);
4499
+ return new ne(s, o);
4491
4500
  }(t._query, t.firestore._databaseId, i, e, n, r);
4492
4501
  }
4493
4502
 
4494
- function fr(t, e, n) {
4503
+ function hr(t, e, n) {
4495
4504
  if ("string" == typeof (n = h(n))) {
4496
- if ("" === n) throw new x(V, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");
4497
- if (!ue(e) && -1 !== n.indexOf("/")) throw new x(V, "Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character.");
4498
- var r = e.path.child(X.fromString(n));
4499
- if (!Z.isDocumentKey(r)) throw new x(V, "Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '" + r + "' is not because it has an odd number of segments (" + r.length + ").");
4500
- return jt(t, new Z(r));
4505
+ if ("" === n) throw new M(k, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");
4506
+ if (!le(e) && -1 !== n.indexOf("/")) throw new M(k, "Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character.");
4507
+ var r = e.path.child(J.fromString(n));
4508
+ if (!et.isDocumentKey(r)) throw new M(k, "Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '" + r + "' is not because it has an odd number of segments (" + r.length + ").");
4509
+ return Lt(t, new et(r));
4501
4510
  }
4502
- if (n instanceof rn) return jt(t, n._key);
4503
- throw new x(V, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: " + rt(n) + ".");
4511
+ if (n instanceof an) return Lt(t, n._key);
4512
+ throw new M(k, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: " + ot(n) + ".");
4504
4513
  }
4505
4514
 
4506
4515
  /**
4507
4516
  * Validates that the value passed into a disjunctive filter satisfies all
4508
4517
  * array requirements.
4509
- */ function lr(t, e) {
4510
- if (!Array.isArray(t) || 0 === t.length) throw new x(V, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
4511
- if (t.length > 10) throw new x(V, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array.");
4518
+ */ function pr(t, e) {
4519
+ if (!Array.isArray(t) || 0 === t.length) throw new M(k, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
4520
+ if (t.length > 10) throw new M(k, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array.");
4512
4521
  }
4513
4522
 
4514
- function hr(t, e, n) {
4515
- if (!n.isEqual(e)) throw new x(V, "Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '" + e.toString() + "' and so you must also use '" + e.toString() + "' as your first argument to orderBy(), but your first orderBy() is on field '" + n.toString() + "' instead.");
4523
+ function dr(t, e, n) {
4524
+ if (!n.isEqual(e)) throw new M(k, "Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '" + e.toString() + "' and so you must also use '" + e.toString() + "' as your first argument to orderBy(), but your first orderBy() is on field '" + n.toString() + "' instead.");
4516
4525
  }
4517
4526
 
4518
4527
  /**
@@ -4561,28 +4570,28 @@ function hr(t, e, n) {
4561
4570
  * because we want to provide the user with a more specific error message if
4562
4571
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
4563
4572
  * call.
4564
- */ function pr(t, e, n) {
4573
+ */ function mr(t, e, n) {
4565
4574
  // Cast to `any` in order to satisfy the union type constraint on
4566
4575
  // toFirestore().
4567
4576
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4568
4577
  return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e;
4569
4578
  }
4570
4579
 
4571
- var dr = /** @class */ function(e) {
4580
+ var yr = /** @class */ function(e) {
4572
4581
  function n(t) {
4573
4582
  var n = this;
4574
4583
  return (n = e.call(this) || this).firestore = t, n;
4575
4584
  }
4576
4585
  return t(n, e), n.prototype.convertBytes = function(t) {
4577
- return new dn(t);
4586
+ return new yn(t);
4578
4587
  }, n.prototype.convertReference = function(t) {
4579
4588
  var e = this.convertDocumentKey(t, this.firestore._databaseId);
4580
- return new rn(this.firestore, /* converter= */ null, e);
4589
+ return new an(this.firestore, /* converter= */ null, e);
4581
4590
  }, n;
4582
4591
  }(/** @class */ function() {
4583
4592
  function t() {}
4584
4593
  return t.prototype.convertValue = function(t, e) {
4585
- switch (void 0 === e && (e = "none"), Pt(t)) {
4594
+ switch (void 0 === e && (e = "none"), Nt(t)) {
4586
4595
  case 0 /* NullValue */ :
4587
4596
  return null;
4588
4597
 
@@ -4590,7 +4599,7 @@ var dr = /** @class */ function(e) {
4590
4599
  return t.booleanValue;
4591
4600
 
4592
4601
  case 2 /* NumberValue */ :
4593
- return It(t.integerValue || t.doubleValue);
4602
+ return kt(t.integerValue || t.doubleValue);
4594
4603
 
4595
4604
  case 3 /* TimestampValue */ :
4596
4605
  return this.convertTimestamp(t.timestampValue);
@@ -4602,7 +4611,7 @@ var dr = /** @class */ function(e) {
4602
4611
  return t.stringValue;
4603
4612
 
4604
4613
  case 6 /* BlobValue */ :
4605
- return this.convertBytes(At(t.bytesValue));
4614
+ return this.convertBytes(Vt(t.bytesValue));
4606
4615
 
4607
4616
  case 7 /* RefValue */ :
4608
4617
  return this.convertReference(t.referenceValue);
@@ -4617,15 +4626,15 @@ var dr = /** @class */ function(e) {
4617
4626
  return this.convertObject(t.mapValue, e);
4618
4627
 
4619
4628
  default:
4620
- throw S();
4629
+ throw T();
4621
4630
  }
4622
4631
  }, t.prototype.convertObject = function(t, e) {
4623
4632
  var n = this, r = {};
4624
- return bt(t.fields, (function(t, i) {
4633
+ return Tt(t.fields, (function(t, i) {
4625
4634
  r[t] = n.convertValue(i, e);
4626
4635
  })), r;
4627
4636
  }, t.prototype.convertGeoPoint = function(t) {
4628
- return new yn(It(t.latitude), It(t.longitude));
4637
+ return new gn(kt(t.latitude), kt(t.longitude));
4629
4638
  }, t.prototype.convertArray = function(t, e) {
4630
4639
  var n = this;
4631
4640
  return (t.values || []).map((function(t) {
@@ -4634,22 +4643,22 @@ var dr = /** @class */ function(e) {
4634
4643
  }, t.prototype.convertServerTimestamp = function(t, e) {
4635
4644
  switch (e) {
4636
4645
  case "previous":
4637
- var n = Dt(t);
4646
+ var n = Pt(t);
4638
4647
  return null == n ? null : this.convertValue(n, e);
4639
4648
 
4640
4649
  case "estimate":
4641
- return this.convertTimestamp(kt(t));
4650
+ return this.convertTimestamp(Ft(t));
4642
4651
 
4643
4652
  default:
4644
4653
  return null;
4645
4654
  }
4646
4655
  }, t.prototype.convertTimestamp = function(t) {
4647
- var e = Et(t);
4648
- return new vt(e.seconds, e.nanos);
4656
+ var e = At(t);
4657
+ return new wt(e.seconds, e.nanos);
4649
4658
  }, t.prototype.convertDocumentKey = function(t, e) {
4650
- var n = X.fromString(t);
4651
- T(Me(n));
4652
- var r = new W(n.get(1), n.get(3)), i = new Z(n.popFirst(5));
4659
+ var n = J.fromString(t);
4660
+ S(ze(n));
4661
+ var r = new $(n.get(1), n.get(3)), i = new et(n.popFirst(5));
4653
4662
  return r.isEqual(e) ||
4654
4663
  // TODO(b/64130202): Somehow support foreign references.
4655
4664
  w("Document " + i + " contains a document reference within a different database (" + r.projectId + "/" + r.database + ") which is not supported. It will be treated as a reference in the current database (" + e.projectId + "/" + e.database + ") instead."),
@@ -4669,12 +4678,12 @@ var dr = /** @class */ function(e) {
4669
4678
  * @param reference - The reference of the document to fetch.
4670
4679
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
4671
4680
  * document contents.
4672
- */ function mr(t) {
4673
- var e = Xe((t = it(t, rn)).firestore), n = new dr(t.firestore);
4674
- return Ke(e, [ t._key ]).then((function(e) {
4675
- T(1 === e.length);
4681
+ */ function vr(t) {
4682
+ var e = Je((t = at(t, an)).firestore), n = new yr(t.firestore);
4683
+ return Ye(e, [ t._key ]).then((function(e) {
4684
+ S(1 === e.length);
4676
4685
  var r = e[0];
4677
- return new Gn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
4686
+ return new Qn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
4678
4687
  }));
4679
4688
  }
4680
4689
 
@@ -4689,35 +4698,35 @@ var dr = /** @class */ function(e) {
4689
4698
  *
4690
4699
  * @param query - The `Query` to execute.
4691
4700
  * @returns A Promise that will be resolved with the results of the query.
4692
- */ function yr(t) {
4701
+ */ function gr(t) {
4693
4702
  !function(t) {
4694
- if (oe(t) && 0 === t.explicitOrderBy.length) throw new x(L, "limitToLast() queries require specifying at least one orderBy() clause");
4695
- }((t = it(t, on))._query);
4696
- var e = Xe(t.firestore), n = new dr(t.firestore);
4697
- return We(e, t._query).then((function(e) {
4703
+ if (se(t) && 0 === t.explicitOrderBy.length) throw new M(j, "limitToLast() queries require specifying at least one orderBy() clause");
4704
+ }((t = at(t, sn))._query);
4705
+ var e = Je(t.firestore), n = new yr(t.firestore);
4706
+ return $e(e, t._query).then((function(e) {
4698
4707
  var r = e.map((function(e) {
4699
- return new Qn(t.firestore, n, e.key, e, t.converter);
4708
+ return new Kn(t.firestore, n, e.key, e, t.converter);
4700
4709
  }));
4701
- return oe(t._query) &&
4710
+ return se(t._query) &&
4702
4711
  // Limit to last queries reverse the orderBy constraint that was
4703
4712
  // specified by the user. As such, we need to reverse the order of the
4704
4713
  // results to return the documents in the expected order.
4705
- r.reverse(), new zn(t, r);
4714
+ r.reverse(), new Hn(t, r);
4706
4715
  }));
4707
4716
  }
4708
4717
 
4709
- function vr(t, e, n) {
4710
- var r = pr((t = it(t, rn)).converter, e, n), i = En(Tn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
4711
- return He(Xe(t.firestore), [ i.toMutation(t._key, ge.none()) ]);
4718
+ function wr(t, e, n) {
4719
+ var r = mr((t = at(t, an)).converter, e, n), i = An(In(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
4720
+ return We(Je(t.firestore), [ i.toMutation(t._key, be.none()) ]);
4712
4721
  }
4713
4722
 
4714
- function gr(t, e, n) {
4723
+ function br(t, e, n) {
4715
4724
  for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
4716
- var o, a = Tn((t = it(t, rn)).firestore);
4725
+ var o, a = In((t = at(t, an)).firestore);
4717
4726
  // For Compat types, we have to "extract" the underlying types before
4718
4727
  // performing validation.
4719
- return o = "string" == typeof (e = h(e)) || e instanceof hn ? Fn(a, "updateDoc", t._key, e, n, r) : Nn(a, "updateDoc", t._key, e),
4720
- He(Xe(t.firestore), [ o.toMutation(t._key, ge.exists(!0)) ]);
4728
+ return o = "string" == typeof (e = h(e)) || e instanceof dn ? On(a, "updateDoc", t._key, e, n, r) : qn(a, "updateDoc", t._key, e),
4729
+ We(Je(t.firestore), [ o.toMutation(t._key, be.exists(!0)) ]);
4721
4730
  }
4722
4731
 
4723
4732
  /**
@@ -4731,8 +4740,8 @@ function gr(t, e, n) {
4731
4740
  * @param reference - A reference to the document to delete.
4732
4741
  * @returns A `Promise` resolved once the document has been successfully
4733
4742
  * deleted from the backend.
4734
- */ function wr(t) {
4735
- return He(Xe((t = it(t, rn)).firestore), [ new Se(t._key, ge.none()) ]);
4743
+ */ function _r(t) {
4744
+ return We(Je((t = at(t, an)).firestore), [ new Ee(t._key, be.none()) ]);
4736
4745
  }
4737
4746
 
4738
4747
  /**
@@ -4748,9 +4757,9 @@ function gr(t, e, n) {
4748
4757
  * @param data - An Object containing the data for the new document.
4749
4758
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
4750
4759
  * newly created document after it has been written to the backend.
4751
- */ function br(t, e) {
4752
- var n = cn(t = it(t, an)), r = pr(t.converter, e), i = En(Tn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
4753
- return He(Xe(t.firestore), [ i.toMutation(n._key, ge.exists(!1)) ]).then((function() {
4760
+ */ function Tr(t, e) {
4761
+ var n = fn(t = at(t, un)), r = mr(t.converter, e), i = An(In(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
4762
+ return We(Je(t.firestore), [ i.toMutation(n._key, be.exists(!1)) ]).then((function() {
4754
4763
  return n;
4755
4764
  }));
4756
4765
  }
@@ -4774,15 +4783,15 @@ function gr(t, e, n) {
4774
4783
  /**
4775
4784
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
4776
4785
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
4777
- */ function _r() {
4778
- return new In("deleteField");
4786
+ */ function Sr() {
4787
+ return new kn("deleteField");
4779
4788
  }
4780
4789
 
4781
4790
  /**
4782
4791
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
4783
4792
  * include a server-generated timestamp in the written data.
4784
- */ function Sr() {
4785
- return new Vn("serverTimestamp");
4793
+ */ function Er() {
4794
+ return new Dn("serverTimestamp");
4786
4795
  }
4787
4796
 
4788
4797
  /**
@@ -4796,11 +4805,11 @@ function gr(t, e, n) {
4796
4805
  * @param elements - The elements to union into the array.
4797
4806
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
4798
4807
  * `updateDoc()`.
4799
- */ function Tr() {
4808
+ */ function Ir() {
4800
4809
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4801
4810
  // NOTE: We don't actually parse the data until it's used in set() or
4802
4811
  // update() since we'd need the Firestore instance to do this.
4803
- return new Dn("arrayUnion", t);
4812
+ return new Pn("arrayUnion", t);
4804
4813
  }
4805
4814
 
4806
4815
  /**
@@ -4813,11 +4822,11 @@ function gr(t, e, n) {
4813
4822
  * @param elements - The elements to remove from the array.
4814
4823
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
4815
4824
  * `updateDoc()`
4816
- */ function Er() {
4825
+ */ function Ar() {
4817
4826
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4818
4827
  // NOTE: We don't actually parse the data until it's used in set() or
4819
4828
  // update() since we'd need the Firestore instance to do this.
4820
- return new kn("arrayRemove", t);
4829
+ return new Fn("arrayRemove", t);
4821
4830
  }
4822
4831
 
4823
4832
  /**
@@ -4838,8 +4847,8 @@ function gr(t, e, n) {
4838
4847
  * @param n - The value to increment by.
4839
4848
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
4840
4849
  * `updateDoc()`
4841
- */ function Ir(t) {
4842
- return new Pn("increment", t);
4850
+ */ function kr(t) {
4851
+ return new Nn("increment", t);
4843
4852
  }
4844
4853
 
4845
4854
  /**
@@ -4865,24 +4874,24 @@ function gr(t, e, n) {
4865
4874
  * provides methods for adding writes to the write batch. None of the writes
4866
4875
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
4867
4876
  * called.
4868
- */ var Ar = /** @class */ function() {
4877
+ */ var Vr = /** @class */ function() {
4869
4878
  /** @hideconstructor */
4870
4879
  function t(t, e) {
4871
4880
  this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
4872
- this._dataReader = Tn(t);
4881
+ this._dataReader = In(t);
4873
4882
  }
4874
4883
  return t.prototype.set = function(t, e, n) {
4875
4884
  this._verifyNotCommitted();
4876
- var r = Vr(t, this._firestore), i = pr(r.converter, e, n), o = En(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
4877
- return this._mutations.push(o.toMutation(r._key, ge.none())), this;
4885
+ var r = Dr(t, this._firestore), i = mr(r.converter, e, n), o = An(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
4886
+ return this._mutations.push(o.toMutation(r._key, be.none())), this;
4878
4887
  }, t.prototype.update = function(t, e, n) {
4879
4888
  for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
4880
4889
  this._verifyNotCommitted();
4881
- var o, a = Vr(t, this._firestore);
4890
+ var o, a = Dr(t, this._firestore);
4882
4891
  // For Compat types, we have to "extract" the underlying types before
4883
4892
  // performing validation.
4884
- return o = "string" == typeof (e = h(e)) || e instanceof hn ? Fn(this._dataReader, "WriteBatch.update", a._key, e, n, r) : Nn(this._dataReader, "WriteBatch.update", a._key, e),
4885
- this._mutations.push(o.toMutation(a._key, ge.exists(!0))), this;
4893
+ return o = "string" == typeof (e = h(e)) || e instanceof dn ? On(this._dataReader, "WriteBatch.update", a._key, e, n, r) : qn(this._dataReader, "WriteBatch.update", a._key, e),
4894
+ this._mutations.push(o.toMutation(a._key, be.exists(!0))), this;
4886
4895
  },
4887
4896
  /**
4888
4897
  * Deletes the document referred to by the provided {@link DocumentReference}.
@@ -4892,8 +4901,8 @@ function gr(t, e, n) {
4892
4901
  */
4893
4902
  t.prototype.delete = function(t) {
4894
4903
  this._verifyNotCommitted();
4895
- var e = Vr(t, this._firestore);
4896
- return this._mutations = this._mutations.concat(new Se(e._key, ge.none())), this;
4904
+ var e = Dr(t, this._firestore);
4905
+ return this._mutations = this._mutations.concat(new Ee(e._key, be.none())), this;
4897
4906
  },
4898
4907
  /**
4899
4908
  * Commits all of the writes in this write batch as a single atomic unit.
@@ -4910,12 +4919,12 @@ function gr(t, e, n) {
4910
4919
  t.prototype.commit = function() {
4911
4920
  return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
4912
4921
  }, t.prototype._verifyNotCommitted = function() {
4913
- if (this._committed) throw new x(O, "A write batch can no longer be used after commit() has been called.");
4922
+ if (this._committed) throw new M(q, "A write batch can no longer be used after commit() has been called.");
4914
4923
  }, t;
4915
4924
  }();
4916
4925
 
4917
- function Vr(t, e) {
4918
- if ((t = h(t)).firestore !== e) throw new x(V, "Provided document reference is from a different Firestore instance.");
4926
+ function Dr(t, e) {
4927
+ if ((t = h(t)).firestore !== e) throw new M(k, "Provided document reference is from a different Firestore instance.");
4919
4928
  return t;
4920
4929
  }
4921
4930
 
@@ -4931,10 +4940,10 @@ function Vr(t, e) {
4931
4940
  *
4932
4941
  * @returns A `WriteBatch` that can be used to atomically execute multiple
4933
4942
  * writes.
4934
- */ function Dr(t) {
4935
- var e = Xe(t = it(t, Je));
4936
- return new Ar(t, (function(t) {
4937
- return He(e, t);
4943
+ */ function Pr(t) {
4944
+ var e = Je(t = at(t, tn));
4945
+ return new Vr(t, (function(t) {
4946
+ return We(e, t);
4938
4947
  }));
4939
4948
  }
4940
4949
 
@@ -4957,7 +4966,7 @@ function Vr(t, e) {
4957
4966
  /**
4958
4967
  * Internal transaction object responsible for accumulating the mutations to
4959
4968
  * perform and the base versions for any documents read.
4960
- */ var kr = /** @class */ function() {
4969
+ */ var Fr = /** @class */ function() {
4961
4970
  function t(t) {
4962
4971
  this.datastore = t,
4963
4972
  // The version of each document that was read during this transaction.
@@ -4981,8 +4990,8 @@ function Vr(t, e) {
4981
4990
  return n(this, (function(n) {
4982
4991
  switch (n.label) {
4983
4992
  case 0:
4984
- if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new x(V, "Firestore transactions require all reads to be executed before all writes.");
4985
- return [ 4 /*yield*/ , Ke(this.datastore, t) ];
4993
+ if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new M(k, "Firestore transactions require all reads to be executed before all writes.");
4994
+ return [ 4 /*yield*/ , Ye(this.datastore, t) ];
4986
4995
 
4987
4996
  case 1:
4988
4997
  return [ 2 /*return*/ , ((e = n.sent()).forEach((function(t) {
@@ -5001,7 +5010,7 @@ function Vr(t, e) {
5001
5010
  }
5002
5011
  this.writtenDocs.add(t.toString());
5003
5012
  }, t.prototype.delete = function(t) {
5004
- this.write(new Se(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5013
+ this.write(new Ee(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5005
5014
  }, t.prototype.commit = function() {
5006
5015
  return e(this, void 0, void 0, (function() {
5007
5016
  var t, e = this;
@@ -5017,9 +5026,9 @@ function Vr(t, e) {
5017
5026
  // For each document that was read but not written to, we want to perform
5018
5027
  // a `verify` operation.
5019
5028
  t.forEach((function(t, n) {
5020
- var r = Z.fromPath(n);
5021
- e.mutations.push(new Te(r, e.precondition(r)));
5022
- })), [ 4 /*yield*/ , He(this.datastore, this.mutations) ];
5029
+ var r = et.fromPath(n);
5030
+ e.mutations.push(new Ie(r, e.precondition(r)));
5031
+ })), [ 4 /*yield*/ , We(this.datastore, this.mutations) ];
5023
5032
 
5024
5033
  case 1:
5025
5034
  // For each mutation, note that the doc was written.
@@ -5030,15 +5039,15 @@ function Vr(t, e) {
5030
5039
  }, t.prototype.recordVersion = function(t) {
5031
5040
  var e;
5032
5041
  if (t.isFoundDocument()) e = t.version; else {
5033
- if (!t.isNoDocument()) throw S();
5042
+ if (!t.isNoDocument()) throw T();
5034
5043
  // For deleted docs, we must use baseVersion 0 when we overwrite them.
5035
- e = gt.min();
5044
+ e = bt.min();
5036
5045
  }
5037
5046
  var n = this.readVersions.get(t.key.toString());
5038
5047
  if (n) {
5039
5048
  if (!e.isEqual(n))
5040
5049
  // This transaction will fail no matter what.
5041
- throw new x(q, "Document version changed between two reads.");
5050
+ throw new M(O, "Document version changed between two reads.");
5042
5051
  } else this.readVersions.set(t.key.toString(), e);
5043
5052
  },
5044
5053
  /**
@@ -5047,7 +5056,7 @@ function Vr(t, e) {
5047
5056
  */
5048
5057
  t.prototype.precondition = function(t) {
5049
5058
  var e = this.readVersions.get(t.toString());
5050
- return !this.writtenDocs.has(t.toString()) && e ? ge.updateTime(e) : ge.none();
5059
+ return !this.writtenDocs.has(t.toString()) && e ? be.updateTime(e) : be.none();
5051
5060
  },
5052
5061
  /**
5053
5062
  * Returns the precondition for a document if the operation is an update.
@@ -5057,7 +5066,7 @@ function Vr(t, e) {
5057
5066
  // The first time a document is written, we want to take into account the
5058
5067
  // read time and existence
5059
5068
  if (!this.writtenDocs.has(t.toString()) && e) {
5060
- if (e.isEqual(gt.min()))
5069
+ if (e.isEqual(bt.min()))
5061
5070
  // The document doesn't exist, so fail the transaction.
5062
5071
  // This has to be validated locally because you can't send a
5063
5072
  // precondition that a document does not exist without changing the
@@ -5067,59 +5076,59 @@ function Vr(t, e) {
5067
5076
  // express that to the backend, we have to validate locally.
5068
5077
  // Note: this can change once we can send separate verify writes in the
5069
5078
  // transaction.
5070
- throw new x(V, "Can't update a document that doesn't exist.");
5079
+ throw new M(k, "Can't update a document that doesn't exist.");
5071
5080
  // Document exists, base precondition on document update time.
5072
- return ge.updateTime(e);
5081
+ return be.updateTime(e);
5073
5082
  }
5074
5083
  // Document was not read, so we just use the preconditions for a blind
5075
5084
  // update.
5076
- return ge.exists(!0);
5085
+ return be.exists(!0);
5077
5086
  }, t.prototype.write = function(t) {
5078
5087
  this.ensureCommitNotCalled(), this.mutations.push(t);
5079
5088
  }, t.prototype.ensureCommitNotCalled = function() {}, t;
5080
- }(), Pr = /** @class */ function() {
5089
+ }(), Nr = /** @class */ function() {
5081
5090
  function t(t, e, n, r) {
5082
5091
  this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
5083
- this.Et = 5, this.Tt = new Qe(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
5092
+ this.Tt = 5, this.It = new Ke(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
5084
5093
  /** Runs the transaction and sets the result on deferred. */;
5085
5094
  }
5086
5095
  return t.prototype.run = function() {
5087
- this.Et -= 1, this.It();
5088
- }, t.prototype.It = function() {
5096
+ this.Tt -= 1, this.At();
5097
+ }, t.prototype.At = function() {
5089
5098
  var t = this;
5090
- this.Tt.G((function() {
5099
+ this.It.W((function() {
5091
5100
  return e(t, void 0, void 0, (function() {
5092
5101
  var t, e, r = this;
5093
5102
  return n(this, (function(n) {
5094
- return t = new kr(this.datastore), (e = this.At(t)) && e.then((function(e) {
5103
+ return t = new Fr(this.datastore), (e = this.Pt(t)) && e.then((function(e) {
5095
5104
  r.asyncQueue.enqueueAndForget((function() {
5096
5105
  return t.commit().then((function() {
5097
5106
  r.deferred.resolve(e);
5098
5107
  })).catch((function(t) {
5099
- r.Pt(t);
5108
+ r.Rt(t);
5100
5109
  }));
5101
5110
  }));
5102
5111
  })).catch((function(t) {
5103
- r.Pt(t);
5112
+ r.Rt(t);
5104
5113
  })), [ 2 /*return*/ ];
5105
5114
  }));
5106
5115
  }));
5107
5116
  }));
5108
- }, t.prototype.At = function(t) {
5117
+ }, t.prototype.Pt = function(t) {
5109
5118
  try {
5110
5119
  var e = this.updateFunction(t);
5111
- return !at(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5120
+ return !ut(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5112
5121
  null);
5113
5122
  } catch (t) {
5114
5123
  // Do not retry errors thrown by user provided updateFunction.
5115
5124
  return this.deferred.reject(t), null;
5116
5125
  }
5117
- }, t.prototype.Pt = function(t) {
5126
+ }, t.prototype.Rt = function(t) {
5118
5127
  var e = this;
5119
- this.Et > 0 && this.Rt(t) ? (this.Et -= 1, this.asyncQueue.enqueueAndForget((function() {
5120
- return e.It(), Promise.resolve();
5128
+ this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((function() {
5129
+ return e.At(), Promise.resolve();
5121
5130
  }))) : this.deferred.reject(t);
5122
- }, t.prototype.Rt = function(t) {
5131
+ }, t.prototype.Vt = function(t) {
5123
5132
  if ("FirebaseError" === t.name) {
5124
5133
  // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
5125
5134
  // non-matching document versions with ABORTED. These errors should be retried.
@@ -5134,30 +5143,30 @@ function Vr(t, e) {
5134
5143
  function(t) {
5135
5144
  switch (t) {
5136
5145
  default:
5137
- return S();
5146
+ return T();
5138
5147
 
5139
5148
  case I:
5140
5149
  case A:
5141
- case D:
5142
- case F:
5150
+ case V:
5151
+ case N:
5152
+ case L:
5143
5153
  case R:
5144
- case U:
5145
5154
  // Unauthenticated means something went wrong with our token and we need
5146
5155
  // to retry with new credentials which will happen automatically.
5147
- case N:
5156
+ case F:
5148
5157
  return !1;
5149
5158
 
5150
- case V:
5151
5159
  case k:
5160
+ case D:
5152
5161
  case "already-exists":
5153
5162
  case P:
5154
- case O:
5163
+ case q:
5155
5164
  // Aborted might be retried in some scenarios, but that is dependant on
5156
5165
  // the context and should handled individually by the calling code.
5157
5166
  // See https://cloud.google.com/apis/design/errors.
5158
- case q:
5167
+ case O:
5168
+ case C:
5159
5169
  case j:
5160
- case L:
5161
5170
  case "data-loss":
5162
5171
  return !0;
5163
5172
  }
@@ -5203,7 +5212,7 @@ function Vr(t, e) {
5203
5212
  * See the License for the specific language governing permissions and
5204
5213
  * limitations under the License.
5205
5214
  */
5206
- /** The Platform's 'document' implementation or null if not available. */ function Nr() {
5215
+ /** The Platform's 'document' implementation or null if not available. */ function qr() {
5207
5216
  // `document` is not always available, e.g. in ReactNative and WebWorkers.
5208
5217
  // eslint-disable-next-line no-restricted-globals
5209
5218
  return "undefined" != typeof document ? document : null;
@@ -5235,10 +5244,10 @@ function Vr(t, e) {
5235
5244
  * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
5236
5245
  * in newer versions of TypeScript defines `finally`, which is not available in
5237
5246
  * IE.
5238
- */ var Fr = /** @class */ function() {
5247
+ */ var Or = /** @class */ function() {
5239
5248
  function t(t, e, n, r, i) {
5240
5249
  this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = i,
5241
- this.deferred = new B, this.then = this.deferred.promise.then.bind(this.deferred.promise),
5250
+ this.deferred = new U, this.then = this.deferred.promise.then.bind(this.deferred.promise),
5242
5251
  // It's normal for the deferred promise to be canceled (due to cancellation)
5243
5252
  // and so we attach a dummy catch callback to avoid
5244
5253
  // 'UnhandledPromiseRejectionWarning' log spam.
@@ -5287,7 +5296,7 @@ function Vr(t, e) {
5287
5296
  * guarantee that the operation will not be run.
5288
5297
  */
5289
5298
  t.prototype.cancel = function(t) {
5290
- null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new x(I, "Operation cancelled" + (t ? ": " + t : ""))));
5299
+ null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new M(I, "Operation cancelled" + (t ? ": " + t : ""))));
5291
5300
  }, t.prototype.handleDelayElapsed = function() {
5292
5301
  var t = this;
5293
5302
  this.asyncQueue.enqueueAndForget((function() {
@@ -5299,44 +5308,44 @@ function Vr(t, e) {
5299
5308
  null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle),
5300
5309
  this.timerHandle = null);
5301
5310
  }, t;
5302
- }(), Or = /** @class */ function() {
5311
+ }(), Cr = /** @class */ function() {
5303
5312
  function t() {
5304
5313
  var t = this;
5305
5314
  // The last promise in the queue.
5306
- this.Vt = Promise.resolve(),
5315
+ this.Dt = Promise.resolve(),
5307
5316
  // A list of retryable operations. Retryable operations are run in order and
5308
5317
  // retried with backoff.
5309
- this.Dt = [],
5318
+ this.Nt = [],
5310
5319
  // Is this AsyncQueue being shut down? Once it is set to true, it will not
5311
5320
  // be changed again.
5312
- this.Nt = !1,
5321
+ this.$t = !1,
5313
5322
  // Operations scheduled to be queued in the future. Operations are
5314
5323
  // automatically removed after they are run or canceled.
5315
- this.$t = [],
5324
+ this.Ft = [],
5316
5325
  // visible for testing
5317
- this.Ft = null,
5326
+ this.St = null,
5318
5327
  // Flag set while there's an outstanding AsyncQueue operation, used for
5319
5328
  // assertion sanity-checks.
5320
- this.St = !1,
5321
- // Enabled during shutdown on Safari to prevent future access to IndexedDB.
5322
5329
  this.qt = !1,
5330
+ // Enabled during shutdown on Safari to prevent future access to IndexedDB.
5331
+ this.xt = !1,
5323
5332
  // List of TimerIds to fast-forward delays for.
5324
- this.xt = [],
5333
+ this.Ot = [],
5325
5334
  // Backoff timer used to schedule retries for retryable operations
5326
- this.Tt = new Qe(this, "async_queue_retry" /* AsyncQueueRetry */),
5335
+ this.It = new Ke(this, "async_queue_retry" /* AsyncQueueRetry */),
5327
5336
  // Visibility handler that triggers an immediate retry of all retryable
5328
5337
  // operations. Meant to speed up recovery when we regain file system access
5329
5338
  // after page comes into foreground.
5330
- this.Ot = function() {
5331
- var e = Nr();
5332
- e && g("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.Tt.H();
5339
+ this.Ct = function() {
5340
+ var e = qr();
5341
+ e && g("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.It.H();
5333
5342
  };
5334
- var e = Nr();
5335
- e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Ot);
5343
+ var e = qr();
5344
+ e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Ct);
5336
5345
  }
5337
5346
  return Object.defineProperty(t.prototype, "isShuttingDown", {
5338
5347
  get: function() {
5339
- return this.Nt;
5348
+ return this.$t;
5340
5349
  },
5341
5350
  enumerable: !1,
5342
5351
  configurable: !0
@@ -5349,53 +5358,53 @@ function Vr(t, e) {
5349
5358
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
5350
5359
  this.enqueue(t);
5351
5360
  }, t.prototype.enqueueAndForgetEvenWhileRestricted = function(t) {
5352
- this.Ct(),
5361
+ this.Lt(),
5353
5362
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
5354
- this.Lt(t);
5363
+ this.Ut(t);
5355
5364
  }, t.prototype.enterRestrictedMode = function(t) {
5356
- if (!this.Nt) {
5357
- this.Nt = !0, this.qt = t || !1;
5358
- var e = Nr();
5359
- e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ot);
5365
+ if (!this.$t) {
5366
+ this.$t = !0, this.xt = t || !1;
5367
+ var e = qr();
5368
+ e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
5360
5369
  }
5361
5370
  }, t.prototype.enqueue = function(t) {
5362
5371
  var e = this;
5363
- if (this.Ct(), this.Nt)
5372
+ if (this.Lt(), this.$t)
5364
5373
  // Return a Promise which never resolves.
5365
5374
  return new Promise((function() {}));
5366
5375
  // Create a deferred Promise that we can return to the callee. This
5367
5376
  // allows us to return a "hanging Promise" only to the callee and still
5368
5377
  // advance the queue even when the operation is not run.
5369
- var n = new B;
5370
- return this.Lt((function() {
5371
- return e.Nt && e.qt ? Promise.resolve() : (t().then(n.resolve, n.reject), n.promise);
5378
+ var n = new U;
5379
+ return this.Ut((function() {
5380
+ return e.$t && e.xt ? Promise.resolve() : (t().then(n.resolve, n.reject), n.promise);
5372
5381
  })).then((function() {
5373
5382
  return n.promise;
5374
5383
  }));
5375
5384
  }, t.prototype.enqueueRetryable = function(t) {
5376
5385
  var e = this;
5377
5386
  this.enqueueAndForget((function() {
5378
- return e.Dt.push(t), e.Ut();
5387
+ return e.Nt.push(t), e.kt();
5379
5388
  }));
5380
5389
  },
5381
5390
  /**
5382
5391
  * Runs the next operation from the retryable queue. If the operation fails,
5383
5392
  * reschedules with backoff.
5384
5393
  */
5385
- t.prototype.Ut = function() {
5394
+ t.prototype.kt = function() {
5386
5395
  return e(this, void 0, void 0, (function() {
5387
5396
  var t, e = this;
5388
5397
  return n(this, (function(n) {
5389
5398
  switch (n.label) {
5390
5399
  case 0:
5391
- if (0 === this.Dt.length) return [ 3 /*break*/ , 5 ];
5400
+ if (0 === this.Nt.length) return [ 3 /*break*/ , 5 ];
5392
5401
  n.label = 1;
5393
5402
 
5394
5403
  case 1:
5395
- return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Dt[0]() ];
5404
+ return n.trys.push([ 1, 3, , 4 ]), [ 4 /*yield*/ , this.Nt[0]() ];
5396
5405
 
5397
5406
  case 2:
5398
- return n.sent(), this.Dt.shift(), this.Tt.reset(), [ 3 /*break*/ , 4 ];
5407
+ return n.sent(), this.Nt.shift(), this.It.reset(), [ 3 /*break*/ , 4 ];
5399
5408
 
5400
5409
  case 3:
5401
5410
  if (t = n.sent(), "IndexedDbTransactionError" !== t.name) throw t;
@@ -5404,7 +5413,7 @@ function Vr(t, e) {
5404
5413
  [ 3 /*break*/ , 4 ];
5405
5414
 
5406
5415
  case 4:
5407
- this.Dt.length > 0 &&
5416
+ this.Nt.length > 0 &&
5408
5417
  // If there are additional operations, we re-schedule `retryNextOp()`.
5409
5418
  // This is necessary to run retryable operations that failed during
5410
5419
  // their initial attempt since we don't know whether they are already
@@ -5415,8 +5424,8 @@ function Vr(t, e) {
5415
5424
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
5416
5425
  // new backoff on every call, there is only ever a single additional
5417
5426
  // operation in the queue.
5418
- this.Tt.G((function() {
5419
- return e.Ut();
5427
+ this.It.W((function() {
5428
+ return e.kt();
5420
5429
  })), n.label = 5;
5421
5430
 
5422
5431
  case 5:
@@ -5424,10 +5433,10 @@ function Vr(t, e) {
5424
5433
  }
5425
5434
  }));
5426
5435
  }));
5427
- }, t.prototype.Lt = function(t) {
5428
- var e = this, n = this.Vt.then((function() {
5429
- return e.St = !0, t().catch((function(t) {
5430
- e.Ft = t, e.St = !1;
5436
+ }, t.prototype.Ut = function(t) {
5437
+ var e = this, n = this.Dt.then((function() {
5438
+ return e.qt = !0, t().catch((function(t) {
5439
+ e.St = t, e.qt = !1;
5431
5440
  var n =
5432
5441
  /**
5433
5442
  * Chrome includes Error.message in Error.stack. Other browsers do not.
@@ -5444,39 +5453,39 @@ function Vr(t, e) {
5444
5453
  // and return the rejected Promise.
5445
5454
  throw w("INTERNAL UNHANDLED ERROR: ", n), t;
5446
5455
  })).then((function(t) {
5447
- return e.St = !1, t;
5456
+ return e.qt = !1, t;
5448
5457
  }));
5449
5458
  }));
5450
- return this.Vt = n, n;
5459
+ return this.Dt = n, n;
5451
5460
  }, t.prototype.enqueueAfterDelay = function(t, e, n) {
5452
5461
  var r = this;
5453
- this.Ct(),
5462
+ this.Lt(),
5454
5463
  // Fast-forward delays for timerIds that have been overriden.
5455
- this.xt.indexOf(t) > -1 && (e = 0);
5456
- var i = Fr.createAndSchedule(this, t, e, n, (function(t) {
5464
+ this.Ot.indexOf(t) > -1 && (e = 0);
5465
+ var i = Or.createAndSchedule(this, t, e, n, (function(t) {
5457
5466
  return r.jt(t);
5458
5467
  }));
5459
- return this.$t.push(i), i;
5460
- }, t.prototype.Ct = function() {
5461
- this.Ft && S();
5468
+ return this.Ft.push(i), i;
5469
+ }, t.prototype.Lt = function() {
5470
+ this.St && T();
5462
5471
  }, t.prototype.verifyOperationInProgress = function() {},
5463
5472
  /**
5464
5473
  * Waits until all currently queued tasks are finished executing. Delayed
5465
5474
  * operations are not run.
5466
5475
  */
5467
- t.prototype.kt = function() {
5476
+ t.prototype.Mt = function() {
5468
5477
  return e(this, void 0, void 0, (function() {
5469
5478
  var t;
5470
5479
  return n(this, (function(e) {
5471
5480
  switch (e.label) {
5472
5481
  case 0:
5473
- return [ 4 /*yield*/ , t = this.Vt ];
5482
+ return [ 4 /*yield*/ , t = this.Dt ];
5474
5483
 
5475
5484
  case 1:
5476
5485
  e.sent(), e.label = 2;
5477
5486
 
5478
5487
  case 2:
5479
- if (t !== this.Vt) return [ 3 /*break*/ , 0 ];
5488
+ if (t !== this.Dt) return [ 3 /*break*/ , 0 ];
5480
5489
  e.label = 3;
5481
5490
 
5482
5491
  case 3:
@@ -5490,7 +5499,7 @@ function Vr(t, e) {
5490
5499
  * exists.
5491
5500
  */
5492
5501
  t.prototype.Bt = function(t) {
5493
- for (var e = 0, n = this.$t; e < n.length; e++) {
5502
+ for (var e = 0, n = this.Ft; e < n.length; e++) {
5494
5503
  if (n[e].timerId === t) return !0;
5495
5504
  }
5496
5505
  return !1;
@@ -5502,36 +5511,36 @@ function Vr(t, e) {
5502
5511
  * will be drained. Pass TimerId.All to run all delayed operations.
5503
5512
  * @returns a Promise that resolves once all operations have been run.
5504
5513
  */
5505
- t.prototype.Mt = function(t) {
5514
+ t.prototype.zt = function(t) {
5506
5515
  var e = this;
5507
5516
  // Note that draining may generate more delayed ops, so we do that first.
5508
- return this.kt().then((function() {
5517
+ return this.Mt().then((function() {
5509
5518
  // Run ops in the same order they'd run if they ran naturally.
5510
- e.$t.sort((function(t, e) {
5519
+ e.Ft.sort((function(t, e) {
5511
5520
  return t.targetTimeMs - e.targetTimeMs;
5512
5521
  }));
5513
- for (var n = 0, r = e.$t; n < r.length; n++) {
5522
+ for (var n = 0, r = e.Ft; n < r.length; n++) {
5514
5523
  var i = r[n];
5515
5524
  if (i.skipDelay(), "all" /* All */ !== t && i.timerId === t) break;
5516
5525
  }
5517
- return e.kt();
5526
+ return e.Mt();
5518
5527
  }));
5519
5528
  },
5520
5529
  /**
5521
5530
  * For Tests: Skip all subsequent delays for a timer id.
5522
5531
  */
5523
- t.prototype.Qt = function(t) {
5524
- this.xt.push(t);
5532
+ t.prototype.Gt = function(t) {
5533
+ this.Ot.push(t);
5525
5534
  },
5526
5535
  /** Called once a DelayedOperation is run or canceled. */ t.prototype.jt = function(t) {
5527
5536
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
5528
- var e = this.$t.indexOf(t);
5529
- this.$t.splice(e, 1);
5537
+ var e = this.Ft.indexOf(t);
5538
+ this.Ft.splice(e, 1);
5530
5539
  }, t;
5531
- }(), qr = /** @class */ function() {
5540
+ }(), jr = /** @class */ function() {
5532
5541
  /** @hideconstructor */
5533
5542
  function t(t, e) {
5534
- this._firestore = t, this._transaction = e, this._dataReader = Tn(t)
5543
+ this._firestore = t, this._transaction = e, this._dataReader = In(t)
5535
5544
  /**
5536
5545
  * Reads the document referenced by the provided {@link DocumentReference}.
5537
5546
  *
@@ -5540,23 +5549,23 @@ function Vr(t, e) {
5540
5549
  */;
5541
5550
  }
5542
5551
  return t.prototype.get = function(t) {
5543
- var e = this, n = Vr(t, this._firestore), r = new dr(this._firestore);
5552
+ var e = this, n = Dr(t, this._firestore), r = new yr(this._firestore);
5544
5553
  return this._transaction.lookup([ n._key ]).then((function(t) {
5545
- if (!t || 1 !== t.length) return S();
5554
+ if (!t || 1 !== t.length) return T();
5546
5555
  var i = t[0];
5547
- if (i.isFoundDocument()) return new Gn(e._firestore, r, i.key, i, n.converter);
5548
- if (i.isNoDocument()) return new Gn(e._firestore, r, n._key, null, n.converter);
5549
- throw S();
5556
+ if (i.isFoundDocument()) return new Qn(e._firestore, r, i.key, i, n.converter);
5557
+ if (i.isNoDocument()) return new Qn(e._firestore, r, n._key, null, n.converter);
5558
+ throw T();
5550
5559
  }));
5551
5560
  }, t.prototype.set = function(t, e, n) {
5552
- var r = Vr(t, this._firestore), i = pr(r.converter, e, n), o = En(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
5561
+ var r = Dr(t, this._firestore), i = mr(r.converter, e, n), o = An(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
5553
5562
  return this._transaction.set(r._key, o), this;
5554
5563
  }, t.prototype.update = function(t, e, n) {
5555
5564
  for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
5556
- var o, a = Vr(t, this._firestore);
5565
+ var o, a = Dr(t, this._firestore);
5557
5566
  // For Compat types, we have to "extract" the underlying types before
5558
5567
  // performing validation.
5559
- return o = "string" == typeof (e = h(e)) || e instanceof hn ? Fn(this._dataReader, "Transaction.update", a._key, e, n, r) : Nn(this._dataReader, "Transaction.update", a._key, e),
5568
+ return o = "string" == typeof (e = h(e)) || e instanceof dn ? On(this._dataReader, "Transaction.update", a._key, e, n, r) : qn(this._dataReader, "Transaction.update", a._key, e),
5560
5569
  this._transaction.update(a._key, o), this;
5561
5570
  },
5562
5571
  /**
@@ -5566,7 +5575,7 @@ function Vr(t, e) {
5566
5575
  * @returns This `Transaction` instance. Used for chaining method calls.
5567
5576
  */
5568
5577
  t.prototype.delete = function(t) {
5569
- var e = Vr(t, this._firestore);
5578
+ var e = Dr(t, this._firestore);
5570
5579
  return this._transaction.delete(e._key), this;
5571
5580
  }, t;
5572
5581
  }();
@@ -5604,10 +5613,10 @@ function Vr(t, e) {
5604
5613
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
5605
5614
  * rejected promise with the corresponding failure error is returned.
5606
5615
  */
5607
- function jr(t, e) {
5608
- var n = Xe(t = it(t, Je)), r = new B;
5609
- return new Pr(new Or, n, (function(n) {
5610
- return e(new qr(t, n));
5616
+ function Lr(t, e) {
5617
+ var n = Je(t = at(t, tn)), r = new U;
5618
+ return new Nr(new Cr, n, (function(n) {
5619
+ return e(new jr(t, n));
5611
5620
  }), r).run(), r.promise
5612
5621
  /**
5613
5622
  * Firestore Lite
@@ -5620,11 +5629,11 @@ function jr(t, e) {
5620
5629
  }
5621
5630
 
5622
5631
  m = i + "_lite", o(new c("firestore/lite", (function(t, e) {
5623
- var n = e.options, r = t.getProvider("app").getImmediate(), i = new Je(r, new Q(t.getProvider("auth-internal")));
5632
+ var n = e.options, r = t.getProvider("app").getImmediate(), i = new tn(r, new z(t.getProvider("auth-internal")), new W(t.getProvider("app-check-internal")));
5624
5633
  return n && i._setSettings(n), i;
5625
- }), "PUBLIC" /* PUBLIC */)),
5634
+ }), "PUBLIC")),
5626
5635
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
5627
- a("firestore-lite", "3.3.1", ""), a("firestore-lite", "3.3.1", "esm5");
5636
+ a("firestore-lite", "3.4.0-canary.774b2fc19", ""), a("firestore-lite", "3.4.0-canary.774b2fc19", "esm5");
5628
5637
 
5629
- export { dn as Bytes, an as CollectionReference, rn as DocumentReference, Gn as DocumentSnapshot, hn as FieldPath, mn as FieldValue, Je as Firestore, x as FirestoreError, yn as GeoPoint, on as Query, Wn as QueryConstraint, Qn as QueryDocumentSnapshot, zn as QuerySnapshot, vt as Timestamp, qr as Transaction, Ar as WriteBatch, br as addDoc, Er as arrayRemove, Tr as arrayUnion, sn as collection, un as collectionGroup, en as connectFirestoreEmulator, wr as deleteDoc, _r as deleteField, cn as doc, pn as documentId, ur as endAt, sr as endBefore, mr as getDoc, yr as getDocs, tn as getFirestore, Ir as increment, Ze as initializeFirestore, er as limit, nr as limitToLast, Zn as orderBy, Yn as query, ln as queryEqual, fn as refEqual, jr as runTransaction, Sr as serverTimestamp, vr as setDoc, v as setLogLevel, Hn as snapshotEqual, or as startAfter, ir as startAt, nn as terminate, gr as updateDoc, $n as where, Dr as writeBatch };
5638
+ export { yn as Bytes, un as CollectionReference, an as DocumentReference, Qn as DocumentSnapshot, dn as FieldPath, vn as FieldValue, tn as Firestore, M as FirestoreError, gn as GeoPoint, sn as Query, $n as QueryConstraint, Kn as QueryDocumentSnapshot, Hn as QuerySnapshot, wt as Timestamp, jr as Transaction, Vr as WriteBatch, Tr as addDoc, Ar as arrayRemove, Ir as arrayUnion, cn as collection, ln as collectionGroup, rn as connectFirestoreEmulator, _r as deleteDoc, Sr as deleteField, fn as doc, mn as documentId, lr as endAt, cr as endBefore, vr as getDoc, gr as getDocs, nn as getFirestore, kr as increment, en as initializeFirestore, rr as limit, ir as limitToLast, er as orderBy, Xn as query, pn as queryEqual, hn as refEqual, Lr as runTransaction, Er as serverTimestamp, wr as setDoc, v as setLogLevel, Wn as snapshotEqual, sr as startAfter, ar as startAt, on as terminate, br as updateDoc, Zn as where, Pr as writeBatch };
5630
5639
  //# sourceMappingURL=index.browser.esm5.js.map