@firebase/firestore 3.5.0-canary.e35db6f95 → 3.5.0-canary.fdd4ab464

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 (69) hide show
  1. package/dist/firestore/lite/index.d.ts +2 -0
  2. package/dist/firestore/src/api/aggregate.d.ts +19 -5
  3. package/dist/firestore/src/api/database.d.ts +15 -15
  4. package/dist/firestore/src/api.d.ts +2 -0
  5. package/dist/firestore/src/core/count_query_runner.d.ts +32 -0
  6. package/dist/firestore/src/core/firestore_client.d.ts +2 -2
  7. package/dist/firestore/src/lite-api/aggregate.d.ts +17 -61
  8. package/dist/firestore/src/lite-api/aggregate_types.d.ts +69 -0
  9. package/dist/firestore/src/lite-api/database.d.ts +7 -7
  10. package/dist/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  11. package/dist/index.d.ts +196 -14
  12. package/dist/index.esm2017.js +4977 -4784
  13. package/dist/index.esm2017.js.map +1 -1
  14. package/dist/index.esm5.js +5180 -4972
  15. package/dist/index.esm5.js.map +1 -1
  16. package/dist/index.node.cjs.js +3889 -3658
  17. package/dist/index.node.cjs.js.map +1 -1
  18. package/dist/index.node.mjs +3887 -3660
  19. package/dist/index.node.mjs.map +1 -1
  20. package/dist/index.rn.js +4968 -4775
  21. package/dist/index.rn.js.map +1 -1
  22. package/dist/internal.d.ts +113 -17
  23. package/dist/lite/firestore/lite/index.d.ts +2 -0
  24. package/dist/lite/firestore/src/api/aggregate.d.ts +19 -5
  25. package/dist/lite/firestore/src/api/database.d.ts +15 -15
  26. package/dist/lite/firestore/src/api.d.ts +2 -0
  27. package/dist/lite/firestore/src/core/count_query_runner.d.ts +32 -0
  28. package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -2
  29. package/dist/lite/firestore/src/lite-api/aggregate.d.ts +17 -61
  30. package/dist/lite/firestore/src/lite-api/aggregate_types.d.ts +69 -0
  31. package/dist/lite/firestore/src/lite-api/database.d.ts +7 -7
  32. package/dist/lite/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  33. package/dist/lite/index.browser.esm2017.js +1093 -935
  34. package/dist/lite/index.browser.esm2017.js.map +1 -1
  35. package/dist/lite/index.browser.esm5.js +1211 -1058
  36. package/dist/lite/index.browser.esm5.js.map +1 -1
  37. package/dist/lite/index.d.ts +84 -4
  38. package/dist/lite/index.node.cjs.js +249 -63
  39. package/dist/lite/index.node.cjs.js.map +1 -1
  40. package/dist/lite/index.node.mjs +247 -65
  41. package/dist/lite/index.node.mjs.map +1 -1
  42. package/dist/lite/index.rn.esm2017.js +1102 -944
  43. package/dist/lite/index.rn.esm2017.js.map +1 -1
  44. package/dist/lite/internal.d.ts +95 -6
  45. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +213 -128
  46. package/dist/lite/packages/firestore/lite/index.d.ts +2 -0
  47. package/dist/lite/packages/firestore/src/api/aggregate.d.ts +19 -5
  48. package/dist/lite/packages/firestore/src/api/database.d.ts +15 -15
  49. package/dist/lite/packages/firestore/src/api.d.ts +2 -0
  50. package/dist/lite/packages/firestore/src/core/count_query_runner.d.ts +32 -0
  51. package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -2
  52. package/dist/lite/packages/firestore/src/lite-api/aggregate.d.ts +17 -61
  53. package/dist/lite/packages/firestore/src/lite-api/aggregate_types.d.ts +69 -0
  54. package/dist/lite/packages/firestore/src/lite-api/database.d.ts +7 -7
  55. package/dist/lite/packages/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  56. package/dist/lite/private.d.ts +93 -4
  57. package/dist/packages/firestore/dist/index.esm2017.d.ts +333 -224
  58. package/dist/packages/firestore/lite/index.d.ts +2 -0
  59. package/dist/packages/firestore/src/api/aggregate.d.ts +19 -5
  60. package/dist/packages/firestore/src/api/database.d.ts +15 -15
  61. package/dist/packages/firestore/src/api.d.ts +2 -0
  62. package/dist/packages/firestore/src/core/count_query_runner.d.ts +32 -0
  63. package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -2
  64. package/dist/packages/firestore/src/lite-api/aggregate.d.ts +17 -61
  65. package/dist/packages/firestore/src/lite-api/aggregate_types.d.ts +69 -0
  66. package/dist/packages/firestore/src/lite-api/database.d.ts +7 -7
  67. package/dist/packages/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  68. package/dist/private.d.ts +208 -19
  69. package/package.json +9 -9
@@ -1,12 +1,12 @@
1
1
  import { __extends as t, __awaiter as e, __generator as n, __spreadArray as r } from "tslib";
2
2
 
3
- import { SDK_VERSION as i, _registerComponent as o, registerVersion as a, _getProvider, getApp as s, _removeServiceInstance as u } from "@firebase/app";
3
+ import { SDK_VERSION as i, _registerComponent as o, registerVersion as a, _getProvider, getApp as u, _removeServiceInstance as s } from "@firebase/app";
4
4
 
5
5
  import { Component as c } from "@firebase/component";
6
6
 
7
7
  import { Logger as l, LogLevel as f } from "@firebase/logger";
8
8
 
9
- import { FirebaseError as h, getModularInstance as p, createMockUserToken as d } from "@firebase/util";
9
+ import { FirebaseError as h, getModularInstance as p, getDefaultEmulatorHost as d, createMockUserToken as y, deepEqual as m } from "@firebase/util";
10
10
 
11
11
  /**
12
12
  * @license
@@ -27,7 +27,7 @@ import { FirebaseError as h, getModularInstance as p, createMockUserToken as d }
27
27
  /**
28
28
  * Simple wrapper around a nullable UID. Mostly exists to make code more
29
29
  * readable.
30
- */ var y = /** @class */ function() {
30
+ */ var v = /** @class */ function() {
31
31
  function t(t) {
32
32
  this.uid = t;
33
33
  }
@@ -45,11 +45,11 @@ import { FirebaseError as h, getModularInstance as p, createMockUserToken as d }
45
45
  }, t;
46
46
  }();
47
47
 
48
- /** A user with a null UID. */ y.UNAUTHENTICATED = new y(null),
48
+ /** A user with a null UID. */ v.UNAUTHENTICATED = new v(null),
49
49
  // TODO(mikelehen): Look into getting a proper uid-equivalent for
50
50
  // non-FirebaseAuth providers.
51
- y.GOOGLE_CREDENTIALS = new y("google-credentials-uid"), y.FIRST_PARTY = new y("first-party-uid"),
52
- y.MOCK_USER = new y("mock-user");
51
+ v.GOOGLE_CREDENTIALS = new v("google-credentials-uid"), v.FIRST_PARTY = new v("first-party-uid"),
52
+ v.MOCK_USER = new v("mock-user");
53
53
 
54
54
  /**
55
55
  * @license
@@ -67,7 +67,7 @@ y.MOCK_USER = new y("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.10.0-canary.e35db6f95", v = new l("@firebase/firestore");
70
+ var g = "9.10.0-canary.fdd4ab464", w = new l("@firebase/firestore");
71
71
 
72
72
  /**
73
73
  * @license
@@ -98,39 +98,39 @@ var m = "9.10.0-canary.e35db6f95", v = new l("@firebase/firestore");
98
98
  * <li><code>`silent` to turn off logging.</li>
99
99
  * </ul>
100
100
  */
101
- function g(t) {
102
- v.setLogLevel(t);
101
+ function b(t) {
102
+ w.setLogLevel(t);
103
103
  }
104
104
 
105
- function w(t) {
105
+ function _(t) {
106
106
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
107
- if (v.logLevel <= f.DEBUG) {
108
- var i = e.map(T);
109
- v.debug.apply(v, r([ "Firestore (" + m + "): " + t ], i));
107
+ if (w.logLevel <= f.DEBUG) {
108
+ var i = e.map(S);
109
+ w.debug.apply(w, r([ "Firestore (" + g + "): " + t ], i));
110
110
  }
111
111
  }
112
112
 
113
- function b(t) {
113
+ function T(t) {
114
114
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
115
- if (v.logLevel <= f.ERROR) {
116
- var i = e.map(T);
117
- v.error.apply(v, r([ "Firestore (" + m + "): " + t ], i));
115
+ if (w.logLevel <= f.ERROR) {
116
+ var i = e.map(S);
117
+ w.error.apply(w, r([ "Firestore (" + g + "): " + t ], i));
118
118
  }
119
119
  }
120
120
 
121
121
  /**
122
122
  * @internal
123
- */ function _(t) {
123
+ */ function E(t) {
124
124
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
125
- if (v.logLevel <= f.WARN) {
126
- var i = e.map(T);
127
- v.warn.apply(v, r([ "Firestore (" + m + "): " + t ], i));
125
+ if (w.logLevel <= f.WARN) {
126
+ var i = e.map(S);
127
+ w.warn.apply(w, r([ "Firestore (" + g + "): " + t ], i));
128
128
  }
129
129
  }
130
130
 
131
131
  /**
132
132
  * Converts an additional log parameter to a string representation.
133
- */ function T(t) {
133
+ */ function S(t) {
134
134
  if ("string" == typeof t) return t;
135
135
  try {
136
136
  return e = t, JSON.stringify(e);
@@ -180,15 +180,15 @@ function b(t) {
180
180
  * Returns `never` and can be used in expressions:
181
181
  * @example
182
182
  * let futureVar = fail('not implemented yet');
183
- */ function E(t) {
183
+ */ function k(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.
187
- var e = "FIRESTORE (" + m + ") INTERNAL ASSERTION FAILED: " + t;
187
+ var e = "FIRESTORE (" + g + ") INTERNAL ASSERTION FAILED: " + t;
188
188
  // NOTE: We don't use FirestoreError here because these are internal failures
189
189
  // that cannot be handled by the user. (Also it would create a circular
190
190
  // dependency between the error and assert modules which doesn't work.)
191
- throw b(e), new Error(e)
191
+ throw T(e), new Error(e)
192
192
  /**
193
193
  * Fails if the given assertion condition is false, throwing an Error with the
194
194
  * given message if it did.
@@ -197,14 +197,14 @@ function b(t) {
197
197
  */;
198
198
  }
199
199
 
200
- function k(t, e) {
201
- t || E();
200
+ function I(t, e) {
201
+ t || k();
202
202
  }
203
203
 
204
204
  /**
205
205
  * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
206
206
  * instance of `T` before casting.
207
- */ function S(t,
207
+ */ function A(t,
208
208
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
209
209
  e) {
210
210
  return t;
@@ -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", P = "deadline-exceeded", D = "not-found", N = "permission-denied", O = "unauthenticated", F = "resource-exhausted", R = "failed-precondition", q = "aborted", L = "out-of-range", x = "unimplemented", C = "internal", j = "unavailable", M = /** @class */ function(e) {
228
+ */ var V = "cancelled", P = "unknown", D = "invalid-argument", O = "deadline-exceeded", N = "not-found", F = "permission-denied", R = "unauthenticated", q = "resource-exhausted", L = "failed-precondition", x = "aborted", C = "out-of-range", j = "unimplemented", M = "internal", U = "unavailable", B = /** @class */ function(e) {
229
229
  /** @hideconstructor */
230
230
  function n(
231
231
  /**
@@ -246,24 +246,24 @@ e) {
246
246
  }, r;
247
247
  }
248
248
  return t(n, e), n;
249
- }(h), U = function() {
249
+ }(h), z = function() {
250
250
  var t = this;
251
251
  this.promise = new Promise((function(e, n) {
252
252
  t.resolve = e, t.reject = n;
253
253
  }));
254
- }, B = function(t, e) {
254
+ }, G = function(t, e) {
255
255
  this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", "Bearer " + t);
256
- }, z = /** @class */ function() {
256
+ }, K = /** @class */ function() {
257
257
  function t() {}
258
258
  return t.prototype.getToken = function() {
259
259
  return Promise.resolve(null);
260
260
  }, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {
261
261
  // Fire with initial user.
262
262
  t.enqueueRetryable((function() {
263
- return e(y.UNAUTHENTICATED);
263
+ return e(v.UNAUTHENTICATED);
264
264
  }));
265
265
  }, t.prototype.shutdown = function() {}, t;
266
- }(), G = /** @class */ function() {
266
+ }(), Q = /** @class */ function() {
267
267
  function t(t) {
268
268
  this.token = t,
269
269
  /**
@@ -285,7 +285,7 @@ e) {
285
285
  }, t.prototype.shutdown = function() {
286
286
  this.changeListener = null;
287
287
  }, t;
288
- }(), K = /** @class */ function() {
288
+ }(), W = /** @class */ function() {
289
289
  function t(t) {
290
290
  var e = this;
291
291
  this.auth = null, t.onInit((function(t) {
@@ -295,20 +295,20 @@ e) {
295
295
  return t.prototype.getToken = function() {
296
296
  var t = this;
297
297
  return this.auth ? this.auth.getToken().then((function(e) {
298
- return e ? (k("string" == typeof e.accessToken), new B(e.accessToken, new y(t.auth.getUid()))) : null;
298
+ return e ? (I("string" == typeof e.accessToken), new G(e.accessToken, new v(t.auth.getUid()))) : null;
299
299
  })) : Promise.resolve(null);
300
300
  }, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {},
301
301
  t.prototype.shutdown = function() {}, t;
302
- }(), Q = /** @class */ function() {
302
+ }(), Y = /** @class */ function() {
303
303
  function t(t, e, n, r) {
304
- this.t = t, this.i = e, this.o = n, this.u = r, this.type = "FirstParty", this.user = y.FIRST_PARTY,
304
+ this.t = t, this.i = e, this.o = n, this.u = r, this.type = "FirstParty", this.user = v.FIRST_PARTY,
305
305
  this.h = new Map
306
306
  /** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */;
307
307
  }
308
308
  return t.prototype.l = function() {
309
309
  return this.u ? this.u() : (
310
310
  // Make sure this really is a Gapi client.
311
- k(!("object" != typeof this.t || null === this.t || !this.t.auth || !this.t.auth.getAuthHeaderValueForFirstParty)),
311
+ I(!("object" != typeof this.t || null === this.t || !this.t.auth || !this.t.auth.getAuthHeaderValueForFirstParty)),
312
312
  this.t.auth.getAuthHeaderValueForFirstParty([]));
313
313
  }, Object.defineProperty(t.prototype, "headers", {
314
314
  get: function() {
@@ -321,22 +321,22 @@ e) {
321
321
  enumerable: !1,
322
322
  configurable: !0
323
323
  }), t;
324
- }(), W = /** @class */ function() {
324
+ }(), H = /** @class */ function() {
325
325
  function t(t, e, n, r) {
326
326
  this.t = t, this.i = e, this.o = n, this.u = r;
327
327
  }
328
328
  return t.prototype.getToken = function() {
329
- return Promise.resolve(new Q(this.t, this.i, this.o, this.u));
329
+ return Promise.resolve(new Y(this.t, this.i, this.o, this.u));
330
330
  }, t.prototype.start = function(t, e) {
331
331
  // Fire with initial uid.
332
332
  t.enqueueRetryable((function() {
333
- return e(y.FIRST_PARTY);
333
+ return e(v.FIRST_PARTY);
334
334
  }));
335
335
  }, t.prototype.shutdown = function() {}, t.prototype.invalidateToken = function() {},
336
336
  t;
337
- }(), Y = function(t) {
337
+ }(), X = function(t) {
338
338
  this.value = t, this.type = "AppCheck", this.headers = new Map, t && t.length > 0 && this.headers.set("x-firebase-appcheck", this.value);
339
- }, H = /** @class */ function() {
339
+ }, J = /** @class */ function() {
340
340
  function t(t) {
341
341
  var e = this;
342
342
  this.m = t, this.appCheck = null, t.onInit((function(t) {
@@ -345,11 +345,11 @@ e) {
345
345
  }
346
346
  return t.prototype.getToken = function() {
347
347
  return this.appCheck ? this.appCheck.getToken().then((function(t) {
348
- return t ? (k("string" == typeof t.token), new Y(t.token)) : null;
348
+ return t ? (I("string" == typeof t.token), new X(t.token)) : null;
349
349
  })) : Promise.resolve(null);
350
350
  }, t.prototype.invalidateToken = function() {}, t.prototype.start = function(t, e) {},
351
351
  t.prototype.shutdown = function() {}, t;
352
- }(), X =
352
+ }(), Z =
353
353
  /**
354
354
  * Constructs a DatabaseInfo using the provided host, databaseId and
355
355
  * persistenceKey.
@@ -367,10 +367,10 @@ e) {
367
367
  * @param useFetchStreams Whether to use the Fetch API instead of
368
368
  * XMLHTTPRequest
369
369
  */
370
- function(t, e, n, r, i, o, a, s) {
370
+ function(t, e, n, r, i, o, a, u) {
371
371
  this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = i,
372
- this.forceLongPolling = o, this.autoDetectLongPolling = a, this.useFetchStreams = s;
373
- }, J = /** @class */ function() {
372
+ this.forceLongPolling = o, this.autoDetectLongPolling = a, this.useFetchStreams = u;
373
+ }, $ = /** @class */ function() {
374
374
  function t(t, e) {
375
375
  this.projectId = t, this.database = e || "(default)";
376
376
  }
@@ -385,9 +385,9 @@ function(t, e, n, r, i, o, a, s) {
385
385
  }), t.prototype.isEqual = function(e) {
386
386
  return e instanceof t && e.projectId === this.projectId && e.database === this.database;
387
387
  }, t;
388
- }(), Z = /** @class */ function() {
388
+ }(), tt = /** @class */ function() {
389
389
  function t(t, e, n) {
390
- void 0 === e ? e = 0 : e > t.length && E(), void 0 === n ? n = t.length - e : n > t.length - e && E(),
390
+ void 0 === e ? e = 0 : e > t.length && k(), void 0 === n ? n = t.length - e : n > t.length - e && k(),
391
391
  this.segments = t, this.offset = e, this.len = n;
392
392
  }
393
393
  return Object.defineProperty(t.prototype, "length", {
@@ -438,7 +438,7 @@ function(t, e, n, r, i, o, a, s) {
438
438
  }
439
439
  return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;
440
440
  }, t;
441
- }(), $ = /** @class */ function(e) {
441
+ }(), et = /** @class */ function(e) {
442
442
  function n() {
443
443
  return null !== e && e.apply(this, arguments) || this;
444
444
  }
@@ -464,7 +464,7 @@ function(t, e, n, r, i, o, a, s) {
464
464
  // for legacy reasons and should not be used frequently).
465
465
  for (var r = [], i = 0, o = t; i < o.length; i++) {
466
466
  var a = o[i];
467
- if (a.indexOf("//") >= 0) throw new M(V, "Invalid segment (" + a + "). Paths must not contain // in them.");
467
+ if (a.indexOf("//") >= 0) throw new B(D, "Invalid segment (" + a + "). Paths must not contain // in them.");
468
468
  // Strip leading and traling slashed.
469
469
  r.push.apply(r, a.split("/").filter((function(t) {
470
470
  return t.length > 0;
@@ -474,7 +474,7 @@ function(t, e, n, r, i, o, a, s) {
474
474
  }, n.emptyPath = function() {
475
475
  return new n([]);
476
476
  }, n;
477
- }(Z), tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/, et = /** @class */ function(e) {
477
+ }(tt), nt = /^[_a-zA-Z][_a-zA-Z0-9]*$/, rt = /** @class */ function(e) {
478
478
  function n() {
479
479
  return null !== e && e.apply(this, arguments) || this;
480
480
  }
@@ -486,7 +486,7 @@ function(t, e, n, r, i, o, a, s) {
486
486
  * without escaping.
487
487
  */
488
488
  n.isValidIdentifier = function(t) {
489
- return tt.test(t);
489
+ return nt.test(t);
490
490
  }, n.prototype.canonicalString = function() {
491
491
  return this.toArray().map((function(t) {
492
492
  return t = t.replace(/\\/g, "\\\\").replace(/`/g, "\\`"), n.isValidIdentifier(t) || (t = "`" + t + "`"),
@@ -519,32 +519,32 @@ function(t, e, n, r, i, o, a, s) {
519
519
  */
520
520
  n.fromServerFormat = function(t) {
521
521
  for (var e = [], r = "", i = 0, o = function() {
522
- if (0 === r.length) throw new M(V, "Invalid field path (" + t + "). Paths must not be empty, begin with '.', end with '.', or contain '..'");
522
+ if (0 === r.length) throw new B(D, "Invalid field path (" + t + "). Paths must not be empty, begin with '.', end with '.', or contain '..'");
523
523
  e.push(r), r = "";
524
524
  }, a = !1; i < t.length; ) {
525
- var s = t[i];
526
- if ("\\" === s) {
527
- if (i + 1 === t.length) throw new M(V, "Path has trailing escape character: " + t);
528
- var u = t[i + 1];
529
- if ("\\" !== u && "." !== u && "`" !== u) throw new M(V, "Path has invalid escape sequence: " + t);
530
- r += u, i += 2;
531
- } else "`" === s ? (a = !a, i++) : "." !== s || a ? (r += s, i++) : (o(), i++);
525
+ var u = t[i];
526
+ if ("\\" === u) {
527
+ if (i + 1 === t.length) throw new B(D, "Path has trailing escape character: " + t);
528
+ var s = t[i + 1];
529
+ if ("\\" !== s && "." !== s && "`" !== s) throw new B(D, "Path has invalid escape sequence: " + t);
530
+ r += s, i += 2;
531
+ } else "`" === u ? (a = !a, i++) : "." !== u || a ? (r += u, i++) : (o(), i++);
532
532
  }
533
- if (o(), a) throw new M(V, "Unterminated ` in path: " + t);
533
+ if (o(), a) throw new B(D, "Unterminated ` in path: " + t);
534
534
  return new n(e);
535
535
  }, n.emptyPath = function() {
536
536
  return new n([]);
537
537
  }, n;
538
- }(Z), nt = /** @class */ function() {
538
+ }(tt), it = /** @class */ function() {
539
539
  function t(t) {
540
540
  this.path = t;
541
541
  }
542
542
  return t.fromPath = function(e) {
543
- return new t($.fromString(e));
543
+ return new t(et.fromString(e));
544
544
  }, t.fromName = function(e) {
545
- return new t($.fromString(e).popFirst(5));
545
+ return new t(et.fromString(e).popFirst(5));
546
546
  }, t.empty = function() {
547
- return new t($.emptyPath());
547
+ return new t(et.emptyPath());
548
548
  }, Object.defineProperty(t.prototype, "collectionGroup", {
549
549
  get: function() {
550
550
  return this.path.popLast().lastSegment();
@@ -561,11 +561,11 @@ function(t, e, n, r, i, o, a, s) {
561
561
  /** Returns the fully qualified path to the parent collection. */ t.prototype.getCollectionPath = function() {
562
562
  return this.path.popLast();
563
563
  }, t.prototype.isEqual = function(t) {
564
- return null !== t && 0 === $.comparator(this.path, t.path);
564
+ return null !== t && 0 === et.comparator(this.path, t.path);
565
565
  }, t.prototype.toString = function() {
566
566
  return this.path.toString();
567
567
  }, t.comparator = function(t, e) {
568
- return $.comparator(t.path, e.path);
568
+ return et.comparator(t.path, e.path);
569
569
  }, t.isDocumentKey = function(t) {
570
570
  return t.length % 2 == 0;
571
571
  },
@@ -576,7 +576,7 @@ function(t, e, n, r, i, o, a, s) {
576
576
  * @returns A new instance of DocumentKey
577
577
  */
578
578
  t.fromSegments = function(e) {
579
- return new t(new $(e.slice()));
579
+ return new t(new et(e.slice()));
580
580
  }, t;
581
581
  }();
582
582
 
@@ -597,8 +597,8 @@ function(t, e, n, r, i, o, a, s) {
597
597
  * See the License for the specific language governing permissions and
598
598
  * limitations under the License.
599
599
  */
600
- function rt(t, e, n) {
601
- if (!n) throw new M(V, "Function " + t + "() cannot be called with an empty " + e + ".");
600
+ function ot(t, e, n) {
601
+ if (!n) throw new B(D, "Function " + t + "() cannot be called with an empty " + e + ".");
602
602
  }
603
603
 
604
604
  /**
@@ -608,22 +608,22 @@ function rt(t, e, n) {
608
608
  /**
609
609
  * Validates that `path` refers to a document (indicated by the fact it contains
610
610
  * an even numbers of segments).
611
- */ function it(t) {
612
- if (!nt.isDocumentKey(t)) throw new M(V, "Invalid document reference. Document references must have an even number of segments, but " + t + " has " + t.length + ".");
611
+ */ function at(t) {
612
+ if (!it.isDocumentKey(t)) throw new B(D, "Invalid document reference. Document references must have an even number of segments, but " + t + " has " + t.length + ".");
613
613
  }
614
614
 
615
615
  /**
616
616
  * Validates that `path` refers to a collection (indicated by the fact it
617
617
  * contains an odd numbers of segments).
618
- */ function ot(t) {
619
- if (nt.isDocumentKey(t)) throw new M(V, "Invalid collection reference. Collection references must have an odd number of segments, but " + t + " has " + t.length + ".");
618
+ */ function ut(t) {
619
+ if (it.isDocumentKey(t)) throw new B(D, "Invalid collection reference. Collection references must have an odd number of segments, but " + t + " has " + t.length + ".");
620
620
  }
621
621
 
622
622
  /**
623
623
  * Returns true if it's a non-null object without a custom prototype
624
624
  * (i.e. excludes Array, Date, etc.).
625
625
  */
626
- /** Returns a string describing the type / value of the provided input. */ function at(t) {
626
+ /** Returns a string describing the type / value of the provided input. */ function st(t) {
627
627
  if (void 0 === t) return "undefined";
628
628
  if (null === t) return "null";
629
629
  if ("string" == typeof t) return t.length > 20 && (t = t.substring(0, 20) + "..."),
@@ -638,25 +638,25 @@ function rt(t, e, n) {
638
638
  }(t);
639
639
  return e ? "a custom " + e + " object" : "an object";
640
640
  }
641
- return "function" == typeof t ? "a function" : E();
641
+ return "function" == typeof t ? "a function" : k();
642
642
  }
643
643
 
644
- function st(t,
644
+ function ct(t,
645
645
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
646
646
  e) {
647
647
  if ("_delegate" in t && (
648
648
  // Unwrap Compat types
649
649
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
650
650
  t = t._delegate), !(t instanceof e)) {
651
- if (e.name === t.constructor.name) throw new M(V, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
652
- var n = at(t);
653
- throw new M(V, "Expected type '" + e.name + "', but it was: " + n);
651
+ if (e.name === t.constructor.name) throw new B(D, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
652
+ var n = st(t);
653
+ throw new B(D, "Expected type '" + e.name + "', but it was: " + n);
654
654
  }
655
655
  return t;
656
656
  }
657
657
 
658
- function ut(t, e) {
659
- if (e <= 0) throw new M(V, "Function " + t + "() requires a positive number, but it was: " + e + ".");
658
+ function lt(t, e) {
659
+ if (e <= 0) throw new B(D, "Function " + t + "() requires a positive number, but it was: " + e + ".");
660
660
  }
661
661
 
662
662
  /**
@@ -677,11 +677,11 @@ function ut(t, e) {
677
677
  */
678
678
  /**
679
679
  * Returns whether a variable is either undefined or null.
680
- */ function ct(t) {
680
+ */ function ft(t) {
681
681
  return null == t;
682
682
  }
683
683
 
684
- /** Returns whether the value represents -0. */ function lt(t) {
684
+ /** Returns whether the value represents -0. */ function ht(t) {
685
685
  // Detect if the value is -0.0. Based on polyfill from
686
686
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
687
687
  return 0 === t && 1 / t == -1 / 0;
@@ -706,7 +706,7 @@ function ut(t, e) {
706
706
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
707
707
  * See the License for the specific language governing permissions and
708
708
  * limitations under the License.
709
- */ var ft, ht, pt = {
709
+ */ var pt, dt, yt = {
710
710
  BatchGetDocuments: "batchGet",
711
711
  Commit: "commit",
712
712
  RunQuery: "runQuery",
@@ -751,8 +751,8 @@ function ut(t, e) {
751
751
  * @returns The equivalent Code. Unknown status codes are mapped to
752
752
  * Code.UNKNOWN.
753
753
  */
754
- function dt(t) {
755
- if (void 0 === t) return b("RPC_ERROR", "HTTP error has no status"), A;
754
+ function mt(t) {
755
+ if (void 0 === t) return T("RPC_ERROR", "HTTP error has no status"), P;
756
756
  // The canonical error codes for Google APIs [1] specify mapping onto HTTP
757
757
  // status codes but the mapping is not bijective. In each case of ambiguity
758
758
  // this function chooses a primary error.
@@ -765,62 +765,62 @@ function dt(t) {
765
765
 
766
766
  case 400:
767
767
  // Bad Request
768
- return R;
768
+ return L;
769
769
 
770
770
  // Other possibilities based on the forward mapping
771
771
  // return Code.INVALID_ARGUMENT;
772
772
  // return Code.OUT_OF_RANGE;
773
773
  case 401:
774
774
  // Unauthorized
775
- return O;
775
+ return R;
776
776
 
777
777
  case 403:
778
778
  // Forbidden
779
- return N;
779
+ return F;
780
780
 
781
781
  case 404:
782
782
  // Not Found
783
- return D;
783
+ return N;
784
784
 
785
785
  case 409:
786
786
  // Conflict
787
- return q;
787
+ return x;
788
788
 
789
789
  // Other possibilities:
790
790
  // return Code.ALREADY_EXISTS;
791
791
  case 416:
792
792
  // Range Not Satisfiable
793
- return L;
793
+ return C;
794
794
 
795
795
  case 429:
796
796
  // Too Many Requests
797
- return F;
797
+ return q;
798
798
 
799
799
  case 499:
800
800
  // Client Closed Request
801
- return I;
801
+ return V;
802
802
 
803
803
  case 500:
804
804
  // Internal Server Error
805
- return A;
805
+ return P;
806
806
 
807
807
  // Other possibilities:
808
808
  // return Code.INTERNAL;
809
809
  // return Code.DATA_LOSS;
810
810
  case 501:
811
811
  // Unimplemented
812
- return x;
812
+ return j;
813
813
 
814
814
  case 503:
815
815
  // Service Unavailable
816
- return j;
816
+ return U;
817
817
 
818
818
  case 504:
819
819
  // Gateway Timeout
820
- return P;
820
+ return O;
821
821
 
822
822
  default:
823
- return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ? R : t >= 500 && t < 600 ? C : A;
823
+ return t >= 200 && t < 300 ? "ok" : t >= 400 && t < 500 ? L : t >= 500 && t < 600 ? M : P;
824
824
  }
825
825
  }
826
826
 
@@ -843,16 +843,16 @@ function dt(t) {
843
843
  /**
844
844
  * A Rest-based connection that relies on the native HTTP stack
845
845
  * (e.g. `fetch` or a polyfill).
846
- */ (ht = ft || (ft = {}))[ht.OK = 0] = "OK", ht[ht.CANCELLED = 1] = "CANCELLED",
847
- ht[ht.UNKNOWN = 2] = "UNKNOWN", ht[ht.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
848
- ht[ht.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ht[ht.NOT_FOUND = 5] = "NOT_FOUND",
849
- ht[ht.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ht[ht.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
850
- ht[ht.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ht[ht.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
851
- ht[ht.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ht[ht.ABORTED = 10] = "ABORTED",
852
- ht[ht.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ht[ht.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
853
- ht[ht.INTERNAL = 13] = "INTERNAL", ht[ht.UNAVAILABLE = 14] = "UNAVAILABLE", ht[ht.DATA_LOSS = 15] = "DATA_LOSS";
854
-
855
- var yt = /** @class */ function(r) {
846
+ */ (dt = pt || (pt = {}))[dt.OK = 0] = "OK", dt[dt.CANCELLED = 1] = "CANCELLED",
847
+ dt[dt.UNKNOWN = 2] = "UNKNOWN", dt[dt.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
848
+ dt[dt.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", dt[dt.NOT_FOUND = 5] = "NOT_FOUND",
849
+ dt[dt.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", dt[dt.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
850
+ dt[dt.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", dt[dt.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
851
+ dt[dt.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", dt[dt.ABORTED = 10] = "ABORTED",
852
+ dt[dt.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", dt[dt.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
853
+ dt[dt.INTERNAL = 13] = "INTERNAL", dt[dt.UNAVAILABLE = 14] = "UNAVAILABLE", dt[dt.DATA_LOSS = 15] = "DATA_LOSS";
854
+
855
+ var vt = /** @class */ function(r) {
856
856
  /**
857
857
  * @param databaseInfo - The connection info.
858
858
  * @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
@@ -886,10 +886,10 @@ var yt = /** @class */ function(r) {
886
886
  return e = n.sent(), [ 3 /*break*/ , 4 ];
887
887
 
888
888
  case 3:
889
- throw a = n.sent(), new M(dt(a.status), "Request failed with error: " + a.statusText);
889
+ throw a = n.sent(), new B(mt(a.status), "Request failed with error: " + a.statusText);
890
890
 
891
891
  case 4:
892
- if (!e.ok) throw new M(dt(e.status), "Request failed with error: " + e.statusText);
892
+ if (!e.ok) throw new B(mt(e.status), "Request failed with error: " + e.statusText);
893
893
  return [ 2 /*return*/ , e.json() ];
894
894
  }
895
895
  }));
@@ -911,12 +911,12 @@ var yt = /** @class */ function(r) {
911
911
  configurable: !0
912
912
  }), t.prototype.I = function(t, e, n, r, i) {
913
913
  var o = this.T(t, e);
914
- w("RestConnection", "Sending: ", o, n);
914
+ _("RestConnection", "Sending: ", o, n);
915
915
  var a = {};
916
916
  return this.A(a, r, i), this.R(t, o, a, n).then((function(t) {
917
- return w("RestConnection", "Received: ", t), t;
917
+ return _("RestConnection", "Received: ", t), t;
918
918
  }), (function(e) {
919
- throw _("RestConnection", t + " failed with error: ", e, "url: ", o, "request:", n),
919
+ throw E("RestConnection", t + " failed with error: ", e, "url: ", o, "request:", n),
920
920
  e;
921
921
  }));
922
922
  }, t.prototype.P = function(t, e, n, r, i, o) {
@@ -929,7 +929,7 @@ var yt = /** @class */ function(r) {
929
929
  * present and any additional headers for the request.
930
930
  */
931
931
  t.prototype.A = function(t, e, n) {
932
- t["X-Goog-Api-Client"] = "gl-js/ fire/" + m,
932
+ t["X-Goog-Api-Client"] = "gl-js/ fire/" + g,
933
933
  // Content-Type: text/plain will avoid preflight requests which might
934
934
  // mess with CORS and redirects by proxies. If we add custom headers
935
935
  // we will need to change this code to potentially use the $httpOverwrite
@@ -941,7 +941,7 @@ var yt = /** @class */ function(r) {
941
941
  return t[n] = e;
942
942
  }));
943
943
  }, t.prototype.T = function(t, e) {
944
- var n = pt[t];
944
+ var n = yt[t];
945
945
  return this.p + "/v1/" + e + ":" + n;
946
946
  }, t;
947
947
  }());
@@ -983,7 +983,7 @@ var yt = /** @class */ function(r) {
983
983
  * Generates `nBytes` of random bytes.
984
984
  *
985
985
  * If `nBytes < 0` , an error will be thrown.
986
- */ function mt(t) {
986
+ */ function gt(t) {
987
987
  // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
988
988
  var e =
989
989
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1009,14 +1009,14 @@ var yt = /** @class */ function(r) {
1009
1009
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010
1010
  * See the License for the specific language governing permissions and
1011
1011
  * limitations under the License.
1012
- */ var vt = /** @class */ function() {
1012
+ */ var wt = /** @class */ function() {
1013
1013
  function t() {}
1014
1014
  return t.D = function() {
1015
1015
  for (
1016
1016
  // Alphanumeric characters
1017
1017
  var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length, n = ""
1018
1018
  // The largest byte value that is a multiple of `char.length`.
1019
- ; n.length < 20; ) for (var r = mt(40), i = 0; i < r.length; ++i)
1019
+ ; n.length < 20; ) for (var r = gt(40), i = 0; i < r.length; ++i)
1020
1020
  // Only accept values that are [0, maxMultiple), this ensures they can
1021
1021
  // be evenly mapped to indices of `chars` via a modulo operation.
1022
1022
  n.length < 20 && r[i] < e && (n += t.charAt(r[i] % t.length));
@@ -1024,11 +1024,11 @@ var yt = /** @class */ function(r) {
1024
1024
  }, t;
1025
1025
  }();
1026
1026
 
1027
- function gt(t, e) {
1027
+ function bt(t, e) {
1028
1028
  return t < e ? -1 : t > e ? 1 : 0;
1029
1029
  }
1030
1030
 
1031
- /** Helper to compare arrays using isEqual(). */ function wt(t, e, n) {
1031
+ /** Helper to compare arrays using isEqual(). */ function _t(t, e, n) {
1032
1032
  return t.length === e.length && t.every((function(t, r) {
1033
1033
  return n(t, e[r]);
1034
1034
  }));
@@ -1064,7 +1064,7 @@ function gt(t, e) {
1064
1064
  *
1065
1065
  * For examples and further specifications, refer to the
1066
1066
  * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
1067
- */ var bt = /** @class */ function() {
1067
+ */ var Tt = /** @class */ function() {
1068
1068
  /**
1069
1069
  * Creates a new timestamp.
1070
1070
  *
@@ -1085,11 +1085,11 @@ function gt(t, e) {
1085
1085
  * The fractions of a second at nanosecond resolution.*
1086
1086
  */
1087
1087
  e) {
1088
- if (this.seconds = t, this.nanoseconds = e, e < 0) throw new M(V, "Timestamp nanoseconds out of range: " + e);
1089
- if (e >= 1e9) throw new M(V, "Timestamp nanoseconds out of range: " + e);
1090
- if (t < -62135596800) throw new M(V, "Timestamp seconds out of range: " + t);
1088
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new B(D, "Timestamp nanoseconds out of range: " + e);
1089
+ if (e >= 1e9) throw new B(D, "Timestamp nanoseconds out of range: " + e);
1090
+ if (t < -62135596800) throw new B(D, "Timestamp seconds out of range: " + t);
1091
1091
  // This will break in the year 10,000.
1092
- if (t >= 253402300800) throw new M(V, "Timestamp seconds out of range: " + t);
1092
+ if (t >= 253402300800) throw new B(D, "Timestamp seconds out of range: " + t);
1093
1093
  }
1094
1094
  /**
1095
1095
  * Creates a new timestamp with the current date, with millisecond precision.
@@ -1141,7 +1141,7 @@ function gt(t, e) {
1141
1141
  t.prototype.toMillis = function() {
1142
1142
  return 1e3 * this.seconds + this.nanoseconds / 1e6;
1143
1143
  }, t.prototype._compareTo = function(t) {
1144
- return this.seconds === t.seconds ? gt(this.nanoseconds, t.nanoseconds) : gt(this.seconds, t.seconds);
1144
+ return this.seconds === t.seconds ? bt(this.nanoseconds, t.nanoseconds) : bt(this.seconds, t.seconds);
1145
1145
  },
1146
1146
  /**
1147
1147
  * Returns true if this `Timestamp` is equal to the provided one.
@@ -1178,16 +1178,16 @@ function gt(t, e) {
1178
1178
  // 'seconds' values.
1179
1179
  return String(t).padStart(12, "0") + "." + String(this.nanoseconds).padStart(9, "0");
1180
1180
  }, t;
1181
- }(), _t = /** @class */ function() {
1181
+ }(), Et = /** @class */ function() {
1182
1182
  function t(t) {
1183
1183
  this.timestamp = t;
1184
1184
  }
1185
1185
  return t.fromTimestamp = function(e) {
1186
1186
  return new t(e);
1187
1187
  }, t.min = function() {
1188
- return new t(new bt(0, 0));
1188
+ return new t(new Tt(0, 0));
1189
1189
  }, t.max = function() {
1190
- return new t(new bt(253402300799, 999999999));
1190
+ return new t(new Tt(253402300799, 999999999));
1191
1191
  }, t.prototype.compareTo = function(t) {
1192
1192
  return this.timestamp._compareTo(t.timestamp);
1193
1193
  }, t.prototype.isEqual = function(t) {
@@ -1239,13 +1239,13 @@ function gt(t, e) {
1239
1239
  * See the License for the specific language governing permissions and
1240
1240
  * limitations under the License.
1241
1241
  */
1242
- function Tt(t) {
1242
+ function St(t) {
1243
1243
  var e = 0;
1244
1244
  for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
1245
1245
  return e;
1246
1246
  }
1247
1247
 
1248
- function Et(t, e) {
1248
+ function kt(t, e) {
1249
1249
  for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
1250
1250
  }
1251
1251
 
@@ -1267,17 +1267,17 @@ function Et(t, e) {
1267
1267
  */
1268
1268
  // An immutable sorted map implementation, based on a Left-leaning Red-Black
1269
1269
  // tree.
1270
- var kt = /** @class */ function() {
1270
+ var It = /** @class */ function() {
1271
1271
  function t(t, e) {
1272
- this.comparator = t, this.root = e || It.EMPTY;
1272
+ this.comparator = t, this.root = e || Vt.EMPTY;
1273
1273
  }
1274
1274
  // Returns a copy of the map, with the specified key/value added or replaced.
1275
1275
  return t.prototype.insert = function(e, n) {
1276
- return new t(this.comparator, this.root.insert(e, n, this.comparator).copy(null, null, It.BLACK, null, null));
1276
+ return new t(this.comparator, this.root.insert(e, n, this.comparator).copy(null, null, Vt.BLACK, null, null));
1277
1277
  },
1278
1278
  // Returns a copy of the map, with the specified key removed.
1279
1279
  t.prototype.remove = function(e) {
1280
- return new t(this.comparator, this.root.remove(e, this.comparator).copy(null, null, It.BLACK, null, null));
1280
+ return new t(this.comparator, this.root.remove(e, this.comparator).copy(null, null, Vt.BLACK, null, null));
1281
1281
  },
1282
1282
  // Returns the value of the node with the given key, or null.
1283
1283
  t.prototype.get = function(t) {
@@ -1346,15 +1346,15 @@ var kt = /** @class */ function() {
1346
1346
  },
1347
1347
  // Returns an iterator over the SortedMap.
1348
1348
  t.prototype.getIterator = function() {
1349
- return new St(this.root, null, this.comparator, !1);
1349
+ return new At(this.root, null, this.comparator, !1);
1350
1350
  }, t.prototype.getIteratorFrom = function(t) {
1351
- return new St(this.root, t, this.comparator, !1);
1351
+ return new At(this.root, t, this.comparator, !1);
1352
1352
  }, t.prototype.getReverseIterator = function() {
1353
- return new St(this.root, null, this.comparator, !0);
1353
+ return new At(this.root, null, this.comparator, !0);
1354
1354
  }, t.prototype.getReverseIteratorFrom = function(t) {
1355
- return new St(this.root, t, this.comparator, !0);
1355
+ return new At(this.root, t, this.comparator, !0);
1356
1356
  }, t;
1357
- }(), St = /** @class */ function() {
1357
+ }(), At = /** @class */ function() {
1358
1358
  function t(t, e, n, r) {
1359
1359
  this.isReverse = r, this.nodeStack = [];
1360
1360
  for (var i = 1; !t.isEmpty(); ) if (i = e ? n(t.key, e) : 1,
@@ -1391,7 +1391,7 @@ var kt = /** @class */ function() {
1391
1391
  value: t.value
1392
1392
  };
1393
1393
  }, t;
1394
- }(), It = /** @class */ function() {
1394
+ }(), Vt = /** @class */ function() {
1395
1395
  function t(e, n, r, i, o) {
1396
1396
  this.key = e, this.value = n, this.color = null != r ? r : t.RED, this.left = null != i ? i : t.EMPTY,
1397
1397
  this.right = null != o ? o : t.EMPTY, this.size = this.left.size + 1 + this.right.size;
@@ -1483,10 +1483,10 @@ var kt = /** @class */ function() {
1483
1483
  // In a balanced RB tree, the black-depth (number of black nodes) from root to
1484
1484
  // leaves is equal on both sides. This function verifies that or asserts.
1485
1485
  t.prototype.check = function() {
1486
- if (this.isRed() && this.left.isRed()) throw E();
1487
- if (this.right.isRed()) throw E();
1486
+ if (this.isRed() && this.left.isRed()) throw k();
1487
+ if (this.right.isRed()) throw k();
1488
1488
  var t = this.left.check();
1489
- if (t !== this.right.check()) throw E();
1489
+ if (t !== this.right.check()) throw k();
1490
1490
  return t + (this.isRed() ? 0 : 1);
1491
1491
  }, t;
1492
1492
  }();
@@ -1496,39 +1496,39 @@ var kt = /** @class */ function() {
1496
1496
  // end LLRBNode
1497
1497
  // Empty node is shared between all LLRB trees.
1498
1498
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1499
- It.EMPTY = null, It.RED = !0, It.BLACK = !1,
1499
+ Vt.EMPTY = null, Vt.RED = !0, Vt.BLACK = !1,
1500
1500
  // end LLRBEmptyNode
1501
- It.EMPTY = new (/** @class */ function() {
1501
+ Vt.EMPTY = new (/** @class */ function() {
1502
1502
  function t() {
1503
1503
  this.size = 0;
1504
1504
  }
1505
1505
  return Object.defineProperty(t.prototype, "key", {
1506
1506
  get: function() {
1507
- throw E();
1507
+ throw k();
1508
1508
  },
1509
1509
  enumerable: !1,
1510
1510
  configurable: !0
1511
1511
  }), Object.defineProperty(t.prototype, "value", {
1512
1512
  get: function() {
1513
- throw E();
1513
+ throw k();
1514
1514
  },
1515
1515
  enumerable: !1,
1516
1516
  configurable: !0
1517
1517
  }), Object.defineProperty(t.prototype, "color", {
1518
1518
  get: function() {
1519
- throw E();
1519
+ throw k();
1520
1520
  },
1521
1521
  enumerable: !1,
1522
1522
  configurable: !0
1523
1523
  }), Object.defineProperty(t.prototype, "left", {
1524
1524
  get: function() {
1525
- throw E();
1525
+ throw k();
1526
1526
  },
1527
1527
  enumerable: !1,
1528
1528
  configurable: !0
1529
1529
  }), Object.defineProperty(t.prototype, "right", {
1530
1530
  get: function() {
1531
- throw E();
1531
+ throw k();
1532
1532
  },
1533
1533
  enumerable: !1,
1534
1534
  configurable: !0
@@ -1539,7 +1539,7 @@ It.EMPTY = new (/** @class */ function() {
1539
1539
  },
1540
1540
  // Returns a copy of the tree, with the specified key/value added.
1541
1541
  t.prototype.insert = function(t, e, n) {
1542
- return new It(t, e);
1542
+ return new Vt(t, e);
1543
1543
  },
1544
1544
  // Returns a copy of the tree, with the specified key removed.
1545
1545
  t.prototype.remove = function(t, e) {
@@ -1588,9 +1588,9 @@ It.EMPTY = new (/** @class */ function() {
1588
1588
  * NOTE: if provided comparator returns 0 for two elements, we consider them to
1589
1589
  * be equal!
1590
1590
  */
1591
- var At = /** @class */ function() {
1591
+ var Pt = /** @class */ function() {
1592
1592
  function t(t) {
1593
- this.comparator = t, this.data = new kt(this.comparator);
1593
+ this.comparator = t, this.data = new It(this.comparator);
1594
1594
  }
1595
1595
  return t.prototype.has = function(t) {
1596
1596
  return null !== this.data.get(t);
@@ -1630,9 +1630,9 @@ var At = /** @class */ function() {
1630
1630
  var e = this.data.getIteratorFrom(t);
1631
1631
  return e.hasNext() ? e.getNext().key : null;
1632
1632
  }, t.prototype.getIterator = function() {
1633
- return new Vt(this.data.getIterator());
1633
+ return new Dt(this.data.getIterator());
1634
1634
  }, t.prototype.getIteratorFrom = function(t) {
1635
- return new Vt(this.data.getIteratorFrom(t));
1635
+ return new Dt(this.data.getIteratorFrom(t));
1636
1636
  },
1637
1637
  /** Inserts or updates an element */ t.prototype.add = function(t) {
1638
1638
  return this.copy(this.data.remove(t).insert(t, !0));
@@ -1669,7 +1669,7 @@ var At = /** @class */ function() {
1669
1669
  var n = new t(this.comparator);
1670
1670
  return n.data = e, n;
1671
1671
  }, t;
1672
- }(), Vt = /** @class */ function() {
1672
+ }(), Dt = /** @class */ function() {
1673
1673
  function t(t) {
1674
1674
  this.iter = t;
1675
1675
  }
@@ -1678,12 +1678,12 @@ var At = /** @class */ function() {
1678
1678
  }, t.prototype.hasNext = function() {
1679
1679
  return this.iter.hasNext();
1680
1680
  }, t;
1681
- }(), Pt = /** @class */ function() {
1681
+ }(), Ot = /** @class */ function() {
1682
1682
  function t(t) {
1683
1683
  this.fields = t,
1684
1684
  // TODO(dimond): validation of FieldMask
1685
1685
  // Sort the field mask to support `FieldMask.isEqual()` and assert below.
1686
- t.sort(et.comparator);
1686
+ t.sort(rt.comparator);
1687
1687
  }
1688
1688
  return t.empty = function() {
1689
1689
  return new t([]);
@@ -1693,13 +1693,13 @@ var At = /** @class */ function() {
1693
1693
  * fields paths to this field mask.
1694
1694
  */
1695
1695
  t.prototype.unionWith = function(e) {
1696
- for (var n = new At(et.comparator), r = 0, i = this.fields; r < i.length; r++) {
1696
+ for (var n = new Pt(rt.comparator), r = 0, i = this.fields; r < i.length; r++) {
1697
1697
  var o = i[r];
1698
1698
  n = n.add(o);
1699
1699
  }
1700
- for (var a = 0, s = e; a < s.length; a++) {
1701
- var u = s[a];
1702
- n = n.add(u);
1700
+ for (var a = 0, u = e; a < u.length; a++) {
1701
+ var s = u[a];
1702
+ n = n.add(s);
1703
1703
  }
1704
1704
  return new t(n.toArray());
1705
1705
  },
@@ -1715,11 +1715,11 @@ var At = /** @class */ function() {
1715
1715
  }
1716
1716
  return !1;
1717
1717
  }, t.prototype.isEqual = function(t) {
1718
- return wt(this.fields, t.fields, (function(t, e) {
1718
+ return _t(this.fields, t.fields, (function(t, e) {
1719
1719
  return t.isEqual(e);
1720
1720
  }));
1721
1721
  }, t;
1722
- }(), Dt = /** @class */ function() {
1722
+ }(), Nt = /** @class */ function() {
1723
1723
  function t(t) {
1724
1724
  this.binaryString = t;
1725
1725
  }
@@ -1761,29 +1761,29 @@ var At = /** @class */ function() {
1761
1761
  }, t.prototype.approximateByteSize = function() {
1762
1762
  return 2 * this.binaryString.length;
1763
1763
  }, t.prototype.compareTo = function(t) {
1764
- return gt(this.binaryString, t.binaryString);
1764
+ return bt(this.binaryString, t.binaryString);
1765
1765
  }, t.prototype.isEqual = function(t) {
1766
1766
  return this.binaryString === t.binaryString;
1767
1767
  }, t;
1768
1768
  }();
1769
1769
 
1770
- Dt.EMPTY_BYTE_STRING = new Dt("");
1770
+ Nt.EMPTY_BYTE_STRING = new Nt("");
1771
1771
 
1772
- var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1772
+ var Ft = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1773
1773
 
1774
1774
  /**
1775
1775
  * Converts the possible Proto values for a timestamp value into a "seconds and
1776
1776
  * nanos" representation.
1777
- */ function Ot(t) {
1777
+ */ function Rt(t) {
1778
1778
  // The json interface (for the browser) will return an iso timestamp string,
1779
1779
  // while the proto js library (for node) will return a
1780
1780
  // google.protobuf.Timestamp instance.
1781
- if (k(!!t), "string" == typeof t) {
1781
+ if (I(!!t), "string" == typeof t) {
1782
1782
  // The date string can have higher precision (nanos) than the Date class
1783
1783
  // (millis), so we do some custom parsing here.
1784
1784
  // Parse the nanos right out of the string.
1785
- var e = 0, n = Nt.exec(t);
1786
- if (k(!!n), n[1]) {
1785
+ var e = 0, n = Ft.exec(t);
1786
+ if (I(!!n), n[1]) {
1787
1787
  // Pad the fraction out to 9 digits (nanos).
1788
1788
  var r = n[1];
1789
1789
  r = (r + "000000000").substr(0, 9), e = Number(r);
@@ -1796,21 +1796,21 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1796
1796
  };
1797
1797
  }
1798
1798
  return {
1799
- seconds: Ft(t.seconds),
1800
- nanos: Ft(t.nanos)
1799
+ seconds: qt(t.seconds),
1800
+ nanos: qt(t.nanos)
1801
1801
  };
1802
1802
  }
1803
1803
 
1804
1804
  /**
1805
1805
  * Converts the possible Proto types for numbers into a JavaScript number.
1806
1806
  * Returns 0 if the value is not numeric.
1807
- */ function Ft(t) {
1807
+ */ function qt(t) {
1808
1808
  // TODO(bjornick): Handle int64 greater than 53 bits.
1809
1809
  return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
1810
1810
  }
1811
1811
 
1812
- /** Converts the possible Proto types for Blobs into a ByteString. */ function Rt(t) {
1813
- return "string" == typeof t ? Dt.fromBase64String(t) : Dt.fromUint8Array(t);
1812
+ /** Converts the possible Proto types for Blobs into a ByteString. */ function Lt(t) {
1813
+ return "string" == typeof t ? Nt.fromBase64String(t) : Nt.fromUint8Array(t);
1814
1814
  }
1815
1815
 
1816
1816
  /**
@@ -1846,7 +1846,7 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1846
1846
  * FieldValueOptions to value().
1847
1847
  * - With respect to other ServerTimestampValues, they sort by their
1848
1848
  * localWriteTime.
1849
- */ function qt(t) {
1849
+ */ function xt(t) {
1850
1850
  var e, n;
1851
1851
  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);
1852
1852
  }
@@ -1856,16 +1856,16 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1856
1856
  *
1857
1857
  * Preserving the previous values allows the user to display the last resoled
1858
1858
  * value until the backend responds with the timestamp.
1859
- */ function Lt(t) {
1859
+ */ function Ct(t) {
1860
1860
  var e = t.mapValue.fields.__previous_value__;
1861
- return qt(e) ? Lt(e) : e;
1861
+ return xt(e) ? Ct(e) : e;
1862
1862
  }
1863
1863
 
1864
1864
  /**
1865
1865
  * Returns the local time at which this timestamp was first set.
1866
- */ function xt(t) {
1867
- var e = Ot(t.mapValue.fields.__local_write_time__.timestampValue);
1868
- return new bt(e.seconds, e.nanos);
1866
+ */ function jt(t) {
1867
+ var e = Rt(t.mapValue.fields.__local_write_time__.timestampValue);
1868
+ return new Tt(e.seconds, e.nanos);
1869
1869
  }
1870
1870
 
1871
1871
  /**
@@ -1883,7 +1883,7 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1883
1883
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1884
1884
  * See the License for the specific language governing permissions and
1885
1885
  * limitations under the License.
1886
- */ var Ct = {
1886
+ */ var Mt = {
1887
1887
  fields: {
1888
1888
  __type__: {
1889
1889
  stringValue: "__max__"
@@ -1891,18 +1891,18 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1891
1891
  }
1892
1892
  };
1893
1893
 
1894
- /** Extracts the backend's type order for the provided value. */ function jt(t) {
1895
- 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 ? qt(t) ? 4 /* ServerTimestampValue */ :
1894
+ /** Extracts the backend's type order for the provided value. */ function Ut(t) {
1895
+ 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 ? xt(t) ? 4 /* ServerTimestampValue */ :
1896
1896
  /** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
1897
1897
  function(t) {
1898
1898
  return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
1899
- }(t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : E();
1899
+ }(t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : k();
1900
1900
  }
1901
1901
 
1902
- /** Tests `left` and `right` for equality based on the backend semantics. */ function Mt(t, e) {
1902
+ /** Tests `left` and `right` for equality based on the backend semantics. */ function Bt(t, e) {
1903
1903
  if (t === e) return !0;
1904
- var n = jt(t);
1905
- if (n !== jt(e)) return !1;
1904
+ var n = Ut(t);
1905
+ if (n !== Ut(e)) return !1;
1906
1906
  switch (n) {
1907
1907
  case 0 /* NullValue */ :
1908
1908
  case 9007199254740991 /* MaxValue */ :
@@ -1912,14 +1912,14 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1912
1912
  return t.booleanValue === e.booleanValue;
1913
1913
 
1914
1914
  case 4 /* ServerTimestampValue */ :
1915
- return xt(t).isEqual(xt(e));
1915
+ return jt(t).isEqual(jt(e));
1916
1916
 
1917
1917
  case 3 /* TimestampValue */ :
1918
1918
  return function(t, e) {
1919
1919
  if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
1920
1920
  // Use string equality for ISO 8601 timestamps
1921
1921
  return t.timestampValue === e.timestampValue;
1922
- var n = Ot(t.timestampValue), r = Ot(e.timestampValue);
1922
+ var n = Rt(t.timestampValue), r = Rt(e.timestampValue);
1923
1923
  return n.seconds === r.seconds && n.nanos === r.nanos;
1924
1924
  }(t, e);
1925
1925
 
@@ -1928,7 +1928,7 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1928
1928
 
1929
1929
  case 6 /* BlobValue */ :
1930
1930
  return function(t, e) {
1931
- return Rt(t.bytesValue).isEqual(Rt(e.bytesValue));
1931
+ return Lt(t.bytesValue).isEqual(Lt(e.bytesValue));
1932
1932
  }(t, e);
1933
1933
 
1934
1934
  case 7 /* RefValue */ :
@@ -1936,105 +1936,105 @@ var Nt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1936
1936
 
1937
1937
  case 8 /* GeoPointValue */ :
1938
1938
  return function(t, e) {
1939
- return Ft(t.geoPointValue.latitude) === Ft(e.geoPointValue.latitude) && Ft(t.geoPointValue.longitude) === Ft(e.geoPointValue.longitude);
1939
+ return qt(t.geoPointValue.latitude) === qt(e.geoPointValue.latitude) && qt(t.geoPointValue.longitude) === qt(e.geoPointValue.longitude);
1940
1940
  }(t, e);
1941
1941
 
1942
1942
  case 2 /* NumberValue */ :
1943
1943
  return function(t, e) {
1944
- if ("integerValue" in t && "integerValue" in e) return Ft(t.integerValue) === Ft(e.integerValue);
1944
+ if ("integerValue" in t && "integerValue" in e) return qt(t.integerValue) === qt(e.integerValue);
1945
1945
  if ("doubleValue" in t && "doubleValue" in e) {
1946
- var n = Ft(t.doubleValue), r = Ft(e.doubleValue);
1947
- return n === r ? lt(n) === lt(r) : isNaN(n) && isNaN(r);
1946
+ var n = qt(t.doubleValue), r = qt(e.doubleValue);
1947
+ return n === r ? ht(n) === ht(r) : isNaN(n) && isNaN(r);
1948
1948
  }
1949
1949
  return !1;
1950
1950
  }(t, e);
1951
1951
 
1952
1952
  case 9 /* ArrayValue */ :
1953
- return wt(t.arrayValue.values || [], e.arrayValue.values || [], Mt);
1953
+ return _t(t.arrayValue.values || [], e.arrayValue.values || [], Bt);
1954
1954
 
1955
1955
  case 10 /* ObjectValue */ :
1956
1956
  return function(t, e) {
1957
1957
  var n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
1958
- if (Tt(n) !== Tt(r)) return !1;
1959
- for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !Mt(n[i], r[i]))) return !1;
1958
+ if (St(n) !== St(r)) return !1;
1959
+ for (var i in n) if (n.hasOwnProperty(i) && (void 0 === r[i] || !Bt(n[i], r[i]))) return !1;
1960
1960
  return !0;
1961
1961
  }(t, e);
1962
1962
 
1963
1963
  default:
1964
- return E();
1964
+ return k();
1965
1965
  }
1966
1966
  }
1967
1967
 
1968
- function Ut(t, e) {
1968
+ function zt(t, e) {
1969
1969
  return void 0 !== (t.values || []).find((function(t) {
1970
- return Mt(t, e);
1970
+ return Bt(t, e);
1971
1971
  }));
1972
1972
  }
1973
1973
 
1974
- function Bt(t, e) {
1974
+ function Gt(t, e) {
1975
1975
  if (t === e) return 0;
1976
- var n = jt(t), r = jt(e);
1977
- if (n !== r) return gt(n, r);
1976
+ var n = Ut(t), r = Ut(e);
1977
+ if (n !== r) return bt(n, r);
1978
1978
  switch (n) {
1979
1979
  case 0 /* NullValue */ :
1980
1980
  case 9007199254740991 /* MaxValue */ :
1981
1981
  return 0;
1982
1982
 
1983
1983
  case 1 /* BooleanValue */ :
1984
- return gt(t.booleanValue, e.booleanValue);
1984
+ return bt(t.booleanValue, e.booleanValue);
1985
1985
 
1986
1986
  case 2 /* NumberValue */ :
1987
1987
  return function(t, e) {
1988
- var n = Ft(t.integerValue || t.doubleValue), r = Ft(e.integerValue || e.doubleValue);
1988
+ var n = qt(t.integerValue || t.doubleValue), r = qt(e.integerValue || e.doubleValue);
1989
1989
  return n < r ? -1 : n > r ? 1 : n === r ? 0 :
1990
1990
  // one or both are NaN.
1991
1991
  isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
1992
1992
  }(t, e);
1993
1993
 
1994
1994
  case 3 /* TimestampValue */ :
1995
- return zt(t.timestampValue, e.timestampValue);
1995
+ return Kt(t.timestampValue, e.timestampValue);
1996
1996
 
1997
1997
  case 4 /* ServerTimestampValue */ :
1998
- return zt(xt(t), xt(e));
1998
+ return Kt(jt(t), jt(e));
1999
1999
 
2000
2000
  case 5 /* StringValue */ :
2001
- return gt(t.stringValue, e.stringValue);
2001
+ return bt(t.stringValue, e.stringValue);
2002
2002
 
2003
2003
  case 6 /* BlobValue */ :
2004
2004
  return function(t, e) {
2005
- var n = Rt(t), r = Rt(e);
2005
+ var n = Lt(t), r = Lt(e);
2006
2006
  return n.compareTo(r);
2007
2007
  }(t.bytesValue, e.bytesValue);
2008
2008
 
2009
2009
  case 7 /* RefValue */ :
2010
2010
  return function(t, e) {
2011
2011
  for (var n = t.split("/"), r = e.split("/"), i = 0; i < n.length && i < r.length; i++) {
2012
- var o = gt(n[i], r[i]);
2012
+ var o = bt(n[i], r[i]);
2013
2013
  if (0 !== o) return o;
2014
2014
  }
2015
- return gt(n.length, r.length);
2015
+ return bt(n.length, r.length);
2016
2016
  }(t.referenceValue, e.referenceValue);
2017
2017
 
2018
2018
  case 8 /* GeoPointValue */ :
2019
2019
  return function(t, e) {
2020
- var n = gt(Ft(t.latitude), Ft(e.latitude));
2021
- return 0 !== n ? n : gt(Ft(t.longitude), Ft(e.longitude));
2020
+ var n = bt(qt(t.latitude), qt(e.latitude));
2021
+ return 0 !== n ? n : bt(qt(t.longitude), qt(e.longitude));
2022
2022
  }(t.geoPointValue, e.geoPointValue);
2023
2023
 
2024
2024
  case 9 /* ArrayValue */ :
2025
2025
  return function(t, e) {
2026
2026
  for (var n = t.values || [], r = e.values || [], i = 0; i < n.length && i < r.length; ++i) {
2027
- var o = Bt(n[i], r[i]);
2027
+ var o = Gt(n[i], r[i]);
2028
2028
  if (o) return o;
2029
2029
  }
2030
- return gt(n.length, r.length);
2030
+ return bt(n.length, r.length);
2031
2031
  }(t.arrayValue, e.arrayValue);
2032
2032
 
2033
2033
  case 10 /* ObjectValue */ :
2034
2034
  return function(t, e) {
2035
- if (t === Ct && e === Ct) return 0;
2036
- if (t === Ct) return 1;
2037
- if (e === Ct) return -1;
2035
+ if (t === Mt && e === Mt) return 0;
2036
+ if (t === Mt) return 1;
2037
+ if (e === Mt) return -1;
2038
2038
  var n = t.fields || {}, r = Object.keys(n), i = e.fields || {}, o = Object.keys(i);
2039
2039
  // Even though MapValues are likely sorted correctly based on their insertion
2040
2040
  // order (e.g. when received from the backend), local modifications can bring
@@ -2042,48 +2042,48 @@ function Bt(t, e) {
2042
2042
  // canonical IDs are independent of insertion order.
2043
2043
  r.sort(), o.sort();
2044
2044
  for (var a = 0; a < r.length && a < o.length; ++a) {
2045
- var s = gt(r[a], o[a]);
2046
- if (0 !== s) return s;
2047
- var u = Bt(n[r[a]], i[o[a]]);
2045
+ var u = bt(r[a], o[a]);
2048
2046
  if (0 !== u) return u;
2047
+ var s = Gt(n[r[a]], i[o[a]]);
2048
+ if (0 !== s) return s;
2049
2049
  }
2050
- return gt(r.length, o.length);
2050
+ return bt(r.length, o.length);
2051
2051
  }(t.mapValue, e.mapValue);
2052
2052
 
2053
2053
  default:
2054
- throw E();
2054
+ throw k();
2055
2055
  }
2056
2056
  }
2057
2057
 
2058
- function zt(t, e) {
2059
- if ("string" == typeof t && "string" == typeof e && t.length === e.length) return gt(t, e);
2060
- var n = Ot(t), r = Ot(e), i = gt(n.seconds, r.seconds);
2061
- return 0 !== i ? i : gt(n.nanos, r.nanos);
2058
+ function Kt(t, e) {
2059
+ if ("string" == typeof t && "string" == typeof e && t.length === e.length) return bt(t, e);
2060
+ var n = Rt(t), r = Rt(e), i = bt(n.seconds, r.seconds);
2061
+ return 0 !== i ? i : bt(n.nanos, r.nanos);
2062
2062
  }
2063
2063
 
2064
- function Gt(t, e) {
2064
+ function Qt(t, e) {
2065
2065
  return {
2066
2066
  referenceValue: "projects/" + t.projectId + "/databases/" + t.database + "/documents/" + e.path.canonicalString()
2067
2067
  };
2068
2068
  }
2069
2069
 
2070
- /** Returns true if `value` is an ArrayValue. */ function Kt(t) {
2070
+ /** Returns true if `value` is an ArrayValue. */ function Wt(t) {
2071
2071
  return !!t && "arrayValue" in t;
2072
2072
  }
2073
2073
 
2074
- /** Returns true if `value` is a NullValue. */ function Qt(t) {
2074
+ /** Returns true if `value` is a NullValue. */ function Yt(t) {
2075
2075
  return !!t && "nullValue" in t;
2076
2076
  }
2077
2077
 
2078
- /** Returns true if `value` is NaN. */ function Wt(t) {
2078
+ /** Returns true if `value` is NaN. */ function Ht(t) {
2079
2079
  return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
2080
2080
  }
2081
2081
 
2082
- /** Returns true if `value` is a MapValue. */ function Yt(t) {
2082
+ /** Returns true if `value` is a MapValue. */ function Xt(t) {
2083
2083
  return !!t && "mapValue" in t;
2084
2084
  }
2085
2085
 
2086
- /** Creates a deep copy of `source`. */ function Ht(t) {
2086
+ /** Creates a deep copy of `source`. */ function Jt(t) {
2087
2087
  if (t.geoPointValue) return {
2088
2088
  geoPointValue: Object.assign({}, t.geoPointValue)
2089
2089
  };
@@ -2096,8 +2096,8 @@ function Gt(t, e) {
2096
2096
  fields: {}
2097
2097
  }
2098
2098
  };
2099
- return Et(t.mapValue.fields, (function(t, n) {
2100
- return e.mapValue.fields[t] = Ht(n);
2099
+ return kt(t.mapValue.fields, (function(t, n) {
2100
+ return e.mapValue.fields[t] = Jt(n);
2101
2101
  })), e;
2102
2102
  }
2103
2103
  if (t.arrayValue) {
@@ -2105,13 +2105,13 @@ function Gt(t, e) {
2105
2105
  arrayValue: {
2106
2106
  values: []
2107
2107
  }
2108
- }, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] = Ht(t.arrayValue.values[r]);
2108
+ }, r = 0; r < (t.arrayValue.values || []).length; ++r) n.arrayValue.values[r] = Jt(t.arrayValue.values[r]);
2109
2109
  return n;
2110
2110
  }
2111
2111
  return Object.assign({}, t);
2112
2112
  }
2113
2113
 
2114
- var Xt = /** @class */ function() {
2114
+ var Zt = /** @class */ function() {
2115
2115
  function t(t) {
2116
2116
  this.value = t;
2117
2117
  }
@@ -2128,7 +2128,7 @@ var Xt = /** @class */ function() {
2128
2128
  */
2129
2129
  t.prototype.field = function(t) {
2130
2130
  if (t.isEmpty()) return this.value;
2131
- for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!Yt(e = (e.mapValue.fields || {})[t.get(n)])) return null;
2131
+ for (var e = this.value, n = 0; n < t.length - 1; ++n) if (!Xt(e = (e.mapValue.fields || {})[t.get(n)])) return null;
2132
2132
  return (e = (e.mapValue.fields || {})[t.lastSegment()]) || null;
2133
2133
  },
2134
2134
  /**
@@ -2138,7 +2138,7 @@ var Xt = /** @class */ function() {
2138
2138
  * @param value - The value to set.
2139
2139
  */
2140
2140
  t.prototype.set = function(t, e) {
2141
- this.getFieldsMap(t.popLast())[t.lastSegment()] = Ht(e);
2141
+ this.getFieldsMap(t.popLast())[t.lastSegment()] = Jt(e);
2142
2142
  },
2143
2143
  /**
2144
2144
  * Sets the provided fields to the provided values.
@@ -2146,14 +2146,14 @@ var Xt = /** @class */ function() {
2146
2146
  * @param data - A map of fields to values (or null for deletes).
2147
2147
  */
2148
2148
  t.prototype.setAll = function(t) {
2149
- var e = this, n = et.emptyPath(), r = {}, i = [];
2149
+ var e = this, n = rt.emptyPath(), r = {}, i = [];
2150
2150
  t.forEach((function(t, o) {
2151
2151
  if (!n.isImmediateParentOf(o)) {
2152
2152
  // Insert the accumulated changes at this parent location
2153
2153
  var a = e.getFieldsMap(n);
2154
2154
  e.applyChanges(a, r, i), r = {}, i = [], n = o.popLast();
2155
2155
  }
2156
- t ? r[o.lastSegment()] = Ht(t) : i.push(o.lastSegment());
2156
+ t ? r[o.lastSegment()] = Jt(t) : i.push(o.lastSegment());
2157
2157
  }));
2158
2158
  var o = this.getFieldsMap(n);
2159
2159
  this.applyChanges(o, r, i);
@@ -2166,9 +2166,9 @@ var Xt = /** @class */ function() {
2166
2166
  */
2167
2167
  t.prototype.delete = function(t) {
2168
2168
  var e = this.field(t.popLast());
2169
- Yt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
2169
+ Xt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
2170
2170
  }, t.prototype.isEqual = function(t) {
2171
- return Mt(this.value, t.value);
2171
+ return Bt(this.value, t.value);
2172
2172
  },
2173
2173
  /**
2174
2174
  * Returns the map that contains the leaf element of `path`. If the parent
@@ -2181,7 +2181,7 @@ var Xt = /** @class */ function() {
2181
2181
  });
2182
2182
  for (var n = 0; n < t.length; ++n) {
2183
2183
  var r = e.mapValue.fields[t.get(n)];
2184
- Yt(r) && r.mapValue.fields || (r = {
2184
+ Xt(r) && r.mapValue.fields || (r = {
2185
2185
  mapValue: {
2186
2186
  fields: {}
2187
2187
  }
@@ -2194,7 +2194,7 @@ var Xt = /** @class */ function() {
2194
2194
  * entries.
2195
2195
  */
2196
2196
  t.prototype.applyChanges = function(t, e, n) {
2197
- Et(e, (function(e, n) {
2197
+ kt(e, (function(e, n) {
2198
2198
  return t[e] = n;
2199
2199
  }));
2200
2200
  for (var r = 0, i = n; r < i.length; r++) {
@@ -2202,9 +2202,9 @@ var Xt = /** @class */ function() {
2202
2202
  delete t[o];
2203
2203
  }
2204
2204
  }, t.prototype.clone = function() {
2205
- return new t(Ht(this.value));
2205
+ return new t(Jt(this.value));
2206
2206
  }, t;
2207
- }(), Jt = /** @class */ function() {
2207
+ }(), $t = /** @class */ function() {
2208
2208
  function t(t, e, n, r, i, o) {
2209
2209
  this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = i,
2210
2210
  this.documentState = o
@@ -2214,17 +2214,17 @@ var Xt = /** @class */ function() {
2214
2214
  */;
2215
2215
  }
2216
2216
  return t.newInvalidDocument = function(e) {
2217
- return new t(e, 0 /* INVALID */ , _t.min(), _t.min(), Xt.empty(), 0 /* SYNCED */);
2217
+ return new t(e, 0 /* INVALID */ , Et.min(), Et.min(), Zt.empty(), 0 /* SYNCED */);
2218
2218
  },
2219
2219
  /**
2220
2220
  * Creates a new document that is known to exist with the given data at the
2221
2221
  * given version.
2222
2222
  */
2223
2223
  t.newFoundDocument = function(e, n, r) {
2224
- return new t(e, 1 /* FOUND_DOCUMENT */ , n, _t.min(), r, 0 /* SYNCED */);
2224
+ return new t(e, 1 /* FOUND_DOCUMENT */ , n, Et.min(), r, 0 /* SYNCED */);
2225
2225
  },
2226
2226
  /** Creates a new document that is known to not exist at the given version. */ t.newNoDocument = function(e, n) {
2227
- return new t(e, 2 /* NO_DOCUMENT */ , n, _t.min(), Xt.empty(), 0 /* SYNCED */);
2227
+ return new t(e, 2 /* NO_DOCUMENT */ , n, Et.min(), Zt.empty(), 0 /* SYNCED */);
2228
2228
  },
2229
2229
  /**
2230
2230
  * Creates a new document that is known to exist at the given version but
@@ -2232,7 +2232,7 @@ var Xt = /** @class */ function() {
2232
2232
  * base document).
2233
2233
  */
2234
2234
  t.newUnknownDocument = function(e, n) {
2235
- return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, _t.min(), Xt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2235
+ return new t(e, 3 /* UNKNOWN_DOCUMENT */ , n, Et.min(), Zt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2236
2236
  },
2237
2237
  /**
2238
2238
  * Changes the document type to indicate that it exists and that its version
@@ -2247,7 +2247,7 @@ var Xt = /** @class */ function() {
2247
2247
  * version.
2248
2248
  */
2249
2249
  t.prototype.convertToNoDocument = function(t) {
2250
- return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Xt.empty(),
2250
+ return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Zt.empty(),
2251
2251
  this.documentState = 0 /* SYNCED */ , this;
2252
2252
  },
2253
2253
  /**
@@ -2256,12 +2256,12 @@ var Xt = /** @class */ function() {
2256
2256
  * base document).
2257
2257
  */
2258
2258
  t.prototype.convertToUnknownDocument = function(t) {
2259
- return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Xt.empty(),
2259
+ return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Zt.empty(),
2260
2260
  this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2261
2261
  }, t.prototype.setHasCommittedMutations = function() {
2262
2262
  return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2263
2263
  }, t.prototype.setHasLocalMutations = function() {
2264
- return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = _t.min(),
2264
+ return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = Et.min(),
2265
2265
  this;
2266
2266
  }, t.prototype.setReadTime = function(t) {
2267
2267
  return this.readTime = t, this;
@@ -2298,7 +2298,7 @@ var Xt = /** @class */ function() {
2298
2298
  }, t.prototype.toString = function() {
2299
2299
  return "Document(" + this.key + ", " + this.version + ", " + JSON.stringify(this.data.value) + ", {documentType: " + this.documentType + "}), {documentState: " + this.documentState + "})";
2300
2300
  }, t;
2301
- }(), Zt = function(t, e, n, r, i, o, a) {
2301
+ }(), te = function(t, e, n, r, i, o, a) {
2302
2302
  void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
2303
2303
  void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
2304
2304
  this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = i,
@@ -2339,13 +2339,13 @@ var Xt = /** @class */ function() {
2339
2339
  * using this factory method, because `Query` provides an implicit `orderBy`
2340
2340
  * property.
2341
2341
  */
2342
- function $t(t, e, n, r, i, o, a) {
2342
+ function ee(t, e, n, r, i, o, a) {
2343
2343
  return void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
2344
2344
  void 0 === i && (i = null), void 0 === o && (o = null), void 0 === a && (a = null),
2345
- new Zt(t, e, n, r, i, o, a);
2345
+ new te(t, e, n, r, i, o, a);
2346
2346
  }
2347
2347
 
2348
- var te = /** @class */ function(e) {
2348
+ var ne = /** @class */ function(e) {
2349
2349
  function n(t, n, r) {
2350
2350
  var i = this;
2351
2351
  return (i = e.call(this) || this).field = t, i.op = n, i.value = r, i;
@@ -2353,13 +2353,13 @@ var te = /** @class */ function(e) {
2353
2353
  /**
2354
2354
  * Creates a filter based on the provided arguments.
2355
2355
  */ return t(n, e), n.create = function(t, e, r) {
2356
- return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.F(t, e, r) : new ee(t, e, r) : "array-contains" /* ARRAY_CONTAINS */ === e ? new oe(t, r) : "in" /* IN */ === e ? new ae(t, r) : "not-in" /* NOT_IN */ === e ? new se(t, r) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ue(t, r) : new n(t, e, r);
2356
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.F(t, e, r) : new re(t, e, r) : "array-contains" /* ARRAY_CONTAINS */ === e ? new ue(t, r) : "in" /* IN */ === e ? new se(t, r) : "not-in" /* NOT_IN */ === e ? new ce(t, r) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new le(t, r) : new n(t, e, r);
2357
2357
  }, n.F = function(t, e, n) {
2358
- return "in" /* IN */ === e ? new ne(t, n) : new re(t, n);
2358
+ return "in" /* IN */ === e ? new ie(t, n) : new oe(t, n);
2359
2359
  }, n.prototype.matches = function(t) {
2360
2360
  var e = t.data.field(this.field);
2361
2361
  // Types do not have to match in NOT_EQUAL filters.
2362
- return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.S(Bt(e, this.value)) : null !== e && jt(this.value) === jt(e) && this.S(Bt(e, this.value));
2362
+ return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.S(Gt(e, this.value)) : null !== e && Ut(this.value) === Ut(e) && this.S(Gt(e, this.value));
2363
2363
  // Only compare types with matching backend order (such as double and int).
2364
2364
  }, n.prototype.S = function(t) {
2365
2365
  switch (this.op) {
@@ -2382,25 +2382,25 @@ var te = /** @class */ function(e) {
2382
2382
  return t >= 0;
2383
2383
 
2384
2384
  default:
2385
- return E();
2385
+ return k();
2386
2386
  }
2387
2387
  }, n.prototype.q = function() {
2388
2388
  return [ "<" /* LESS_THAN */ , "<=" /* LESS_THAN_OR_EQUAL */ , ">" /* GREATER_THAN */ , ">=" /* GREATER_THAN_OR_EQUAL */ , "!=" /* NOT_EQUAL */ , "not-in" /* NOT_IN */ ].indexOf(this.op) >= 0;
2389
2389
  }, n;
2390
- }((function() {})), ee = /** @class */ function(e) {
2390
+ }((function() {})), re = /** @class */ function(e) {
2391
2391
  function n(t, n, r) {
2392
2392
  var i = this;
2393
- return (i = e.call(this, t, n, r) || this).key = nt.fromName(r.referenceValue),
2393
+ return (i = e.call(this, t, n, r) || this).key = it.fromName(r.referenceValue),
2394
2394
  i;
2395
2395
  }
2396
2396
  return t(n, e), n.prototype.matches = function(t) {
2397
- var e = nt.comparator(t.key, this.key);
2397
+ var e = it.comparator(t.key, this.key);
2398
2398
  return this.S(e);
2399
2399
  }, n;
2400
- }(te), ne = /** @class */ function(e) {
2400
+ }(ne), ie = /** @class */ function(e) {
2401
2401
  function n(t, n) {
2402
2402
  var r = this;
2403
- return (r = e.call(this, t, "in" /* IN */ , n) || this).keys = ie("in" /* IN */ , n),
2403
+ return (r = e.call(this, t, "in" /* IN */ , n) || this).keys = ae("in" /* IN */ , n),
2404
2404
  r;
2405
2405
  }
2406
2406
  return t(n, e), n.prototype.matches = function(t) {
@@ -2408,10 +2408,10 @@ var te = /** @class */ function(e) {
2408
2408
  return e.isEqual(t.key);
2409
2409
  }));
2410
2410
  }, n;
2411
- }(te), re = /** @class */ function(e) {
2411
+ }(ne), oe = /** @class */ function(e) {
2412
2412
  function n(t, n) {
2413
2413
  var r = this;
2414
- return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys = ie("not-in" /* NOT_IN */ , n),
2414
+ return (r = e.call(this, t, "not-in" /* NOT_IN */ , n) || this).keys = ae("not-in" /* NOT_IN */ , n),
2415
2415
  r;
2416
2416
  }
2417
2417
  return t(n, e), n.prototype.matches = function(t) {
@@ -2419,67 +2419,67 @@ var te = /** @class */ function(e) {
2419
2419
  return e.isEqual(t.key);
2420
2420
  }));
2421
2421
  }, n;
2422
- }(te);
2422
+ }(ne);
2423
2423
 
2424
- /** Filter that matches on key fields (i.e. '__name__'). */ function ie(t, e) {
2424
+ /** Filter that matches on key fields (i.e. '__name__'). */ function ae(t, e) {
2425
2425
  var n;
2426
2426
  return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((function(t) {
2427
- return nt.fromName(t.referenceValue);
2427
+ return it.fromName(t.referenceValue);
2428
2428
  }));
2429
2429
  }
2430
2430
 
2431
- /** A Filter that implements the array-contains operator. */ var oe = /** @class */ function(e) {
2431
+ /** A Filter that implements the array-contains operator. */ var ue = /** @class */ function(e) {
2432
2432
  function n(t, n) {
2433
2433
  return e.call(this, t, "array-contains" /* ARRAY_CONTAINS */ , n) || this;
2434
2434
  }
2435
2435
  return t(n, e), n.prototype.matches = function(t) {
2436
2436
  var e = t.data.field(this.field);
2437
- return Kt(e) && Ut(e.arrayValue, this.value);
2437
+ return Wt(e) && zt(e.arrayValue, this.value);
2438
2438
  }, n;
2439
- }(te), ae = /** @class */ function(e) {
2439
+ }(ne), se = /** @class */ function(e) {
2440
2440
  function n(t, n) {
2441
2441
  return e.call(this, t, "in" /* IN */ , n) || this;
2442
2442
  }
2443
2443
  return t(n, e), n.prototype.matches = function(t) {
2444
2444
  var e = t.data.field(this.field);
2445
- return null !== e && Ut(this.value.arrayValue, e);
2445
+ return null !== e && zt(this.value.arrayValue, e);
2446
2446
  }, n;
2447
- }(te), se = /** @class */ function(e) {
2447
+ }(ne), ce = /** @class */ function(e) {
2448
2448
  function n(t, n) {
2449
2449
  return e.call(this, t, "not-in" /* NOT_IN */ , n) || this;
2450
2450
  }
2451
2451
  return t(n, e), n.prototype.matches = function(t) {
2452
- if (Ut(this.value.arrayValue, {
2452
+ if (zt(this.value.arrayValue, {
2453
2453
  nullValue: "NULL_VALUE"
2454
2454
  })) return !1;
2455
2455
  var e = t.data.field(this.field);
2456
- return null !== e && !Ut(this.value.arrayValue, e);
2456
+ return null !== e && !zt(this.value.arrayValue, e);
2457
2457
  }, n;
2458
- }(te), ue = /** @class */ function(e) {
2458
+ }(ne), le = /** @class */ function(e) {
2459
2459
  function n(t, n) {
2460
2460
  return e.call(this, t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n) || this;
2461
2461
  }
2462
2462
  return t(n, e), n.prototype.matches = function(t) {
2463
2463
  var e = this, n = t.data.field(this.field);
2464
- return !(!Kt(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) {
2465
- return Ut(e.value.arrayValue, t);
2464
+ return !(!Wt(n) || !n.arrayValue.values) && n.arrayValue.values.some((function(t) {
2465
+ return zt(e.value.arrayValue, t);
2466
2466
  }));
2467
2467
  }, n;
2468
- }(te), ce = function(t, e) {
2468
+ }(ne), fe = function(t, e) {
2469
2469
  this.position = t, this.inclusive = e;
2470
- }, le = function(t, e /* ASCENDING */) {
2470
+ }, he = function(t, e /* ASCENDING */) {
2471
2471
  void 0 === e && (e = "asc"), this.field = t, this.dir = e;
2472
2472
  };
2473
2473
 
2474
- /** A Filter that implements the IN operator. */ function fe(t, e) {
2474
+ /** A Filter that implements the IN operator. */ function pe(t, e) {
2475
2475
  return t.dir === e.dir && t.field.isEqual(e.field);
2476
2476
  }
2477
2477
 
2478
- function he(t, e) {
2478
+ function de(t, e) {
2479
2479
  if (null === t) return null === e;
2480
2480
  if (null === e) return !1;
2481
2481
  if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
2482
- for (var n = 0; n < t.position.length; n++) if (!Mt(t.position[n], e.position[n])) return !1;
2482
+ for (var n = 0; n < t.position.length; n++) if (!Bt(t.position[n], e.position[n])) return !1;
2483
2483
  return !0;
2484
2484
  }
2485
2485
 
@@ -2505,26 +2505,26 @@ function he(t, e) {
2505
2505
  * query the RemoteStore results.
2506
2506
  *
2507
2507
  * Visible for testing.
2508
- */ var pe =
2508
+ */ var ye =
2509
2509
  /**
2510
2510
  * Initializes a Query with a path and optional additional query constraints.
2511
2511
  * Path must currently be empty if this is a collection group query.
2512
2512
  */
2513
- function(t, e, n, r, i, o /* First */ , a, s) {
2513
+ function(t, e, n, r, i, o /* First */ , a, u) {
2514
2514
  void 0 === e && (e = null), void 0 === n && (n = []), void 0 === r && (r = []),
2515
2515
  void 0 === i && (i = null), void 0 === o && (o = "F"), void 0 === a && (a = null),
2516
- void 0 === s && (s = null), this.path = t, this.collectionGroup = e, this.explicitOrderBy = n,
2517
- this.filters = r, this.limit = i, this.limitType = o, this.startAt = a, this.endAt = s,
2516
+ void 0 === u && (u = null), this.path = t, this.collectionGroup = e, this.explicitOrderBy = n,
2517
+ this.filters = r, this.limit = i, this.limitType = o, this.startAt = a, this.endAt = u,
2518
2518
  this.O = null,
2519
2519
  // The corresponding `Target` of this `Query` instance.
2520
2520
  this.k = null, this.startAt, this.endAt;
2521
2521
  };
2522
2522
 
2523
- /** Creates a new Query for a query that matches all documents at `path` */ function de(t) {
2523
+ /** Creates a new Query for a query that matches all documents at `path` */ function me(t) {
2524
2524
  return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
2525
2525
  }
2526
2526
 
2527
- function ye(t) {
2527
+ function ve(t) {
2528
2528
  for (var e = 0, n = t.filters; e < n.length; e++) {
2529
2529
  var r = n[e];
2530
2530
  if (r.q()) return r.field;
@@ -2539,7 +2539,7 @@ function ye(t) {
2539
2539
  /**
2540
2540
  * Returns whether the query matches a collection group rather than a specific
2541
2541
  * collection.
2542
- */ function me(t) {
2542
+ */ function ge(t) {
2543
2543
  return null !== t.collectionGroup;
2544
2544
  }
2545
2545
 
@@ -2547,25 +2547,25 @@ function ye(t) {
2547
2547
  * Returns the implicit order by constraint that is used to execute the Query,
2548
2548
  * which can be different from the order by constraints the user provided (e.g.
2549
2549
  * the SDK and backend always orders by `__name__`).
2550
- */ function ve(t) {
2551
- var e = S(t);
2550
+ */ function we(t) {
2551
+ var e = A(t);
2552
2552
  if (null === e.O) {
2553
2553
  e.O = [];
2554
- var n = ye(e), r = de(e);
2554
+ var n = ve(e), r = me(e);
2555
2555
  if (null !== n && null === r)
2556
2556
  // In order to implicitly add key ordering, we must also add the
2557
2557
  // inequality filter field for it to be a valid query.
2558
2558
  // Note that the default inequality field and key ordering is ascending.
2559
- n.isKeyField() || e.O.push(new le(n)), e.O.push(new le(et.keyField(), "asc" /* ASCENDING */)); else {
2559
+ n.isKeyField() || e.O.push(new he(n)), e.O.push(new he(rt.keyField(), "asc" /* ASCENDING */)); else {
2560
2560
  for (var i = !1, o = 0, a = e.explicitOrderBy; o < a.length; o++) {
2561
- var s = a[o];
2562
- e.O.push(s), s.field.isKeyField() && (i = !0);
2561
+ var u = a[o];
2562
+ e.O.push(u), u.field.isKeyField() && (i = !0);
2563
2563
  }
2564
2564
  if (!i) {
2565
2565
  // The order of the implicit key ordering always matches the last
2566
2566
  // explicit order by
2567
- var u = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2568
- e.O.push(new le(et.keyField(), u));
2567
+ var s = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2568
+ e.O.push(new he(rt.keyField(), s));
2569
2569
  }
2570
2570
  }
2571
2571
  }
@@ -2574,19 +2574,19 @@ function ye(t) {
2574
2574
 
2575
2575
  /**
2576
2576
  * Converts this `Query` instance to it's corresponding `Target` representation.
2577
- */ function ge(t) {
2578
- var e = S(t);
2579
- if (!e.k) if ("F" /* First */ === e.limitType) e.k = $t(e.path, e.collectionGroup, ve(e), e.filters, e.limit, e.startAt, e.endAt); else {
2577
+ */ function be(t) {
2578
+ var e = A(t);
2579
+ if (!e.k) if ("F" /* First */ === e.limitType) e.k = ee(e.path, e.collectionGroup, we(e), e.filters, e.limit, e.startAt, e.endAt); else {
2580
2580
  for (
2581
2581
  // Flip the orderBy directions since we want the last results
2582
- var n = [], r = 0, i = ve(e); r < i.length; r++) {
2582
+ var n = [], r = 0, i = we(e); r < i.length; r++) {
2583
2583
  var o = i[r], a = "desc" /* DESCENDING */ === o.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2584
- n.push(new le(o.field, a));
2584
+ n.push(new he(o.field, a));
2585
2585
  }
2586
2586
  // We need to swap the cursors to match the now-flipped query ordering.
2587
- var s = e.endAt ? new ce(e.endAt.position, e.endAt.inclusive) : null, u = e.startAt ? new ce(e.startAt.position, e.startAt.inclusive) : null;
2587
+ var u = e.endAt ? new fe(e.endAt.position, e.endAt.inclusive) : null, s = e.startAt ? new fe(e.startAt.position, e.startAt.inclusive) : null;
2588
2588
  // Now return as a LimitType.First query.
2589
- e.k = $t(e.path, e.collectionGroup, n, e.filters, e.limit, s, u);
2589
+ e.k = ee(e.path, e.collectionGroup, n, e.filters, e.limit, u, s);
2590
2590
  }
2591
2591
  return e.k;
2592
2592
  }
@@ -2616,9 +2616,9 @@ function ye(t) {
2616
2616
  * The return value is an IntegerValue if it can safely represent the value,
2617
2617
  * otherwise a DoubleValue is returned.
2618
2618
  */
2619
- function we(t, e) {
2619
+ function _e(t, e) {
2620
2620
  return function(t) {
2621
- return "number" == typeof t && Number.isInteger(t) && !lt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2621
+ return "number" == typeof t && Number.isInteger(t) && !ht(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2622
2622
  }(e) ?
2623
2623
  /**
2624
2624
  * Returns an IntegerValue for `value`.
@@ -2640,7 +2640,7 @@ function we(t, e) {
2640
2640
  };
2641
2641
  }
2642
2642
  return {
2643
- doubleValue: lt(e) ? "-0" : e
2643
+ doubleValue: ht(e) ? "-0" : e
2644
2644
  };
2645
2645
  }(t, e);
2646
2646
  }
@@ -2661,36 +2661,36 @@ function we(t, e) {
2661
2661
  * See the License for the specific language governing permissions and
2662
2662
  * limitations under the License.
2663
2663
  */
2664
- /** Used to represent a field transform on a mutation. */ var be = function() {
2664
+ /** Used to represent a field transform on a mutation. */ var Te = function() {
2665
2665
  // Make sure that the structural type of `TransformOperation` is unique.
2666
2666
  // See https://github.com/microsoft/TypeScript/issues/5451
2667
2667
  this._ = void 0;
2668
- }, _e = /** @class */ function(e) {
2668
+ }, Ee = /** @class */ function(e) {
2669
2669
  function n() {
2670
2670
  return null !== e && e.apply(this, arguments) || this;
2671
2671
  }
2672
2672
  return t(n, e), n;
2673
- }(be), Te = /** @class */ function(e) {
2673
+ }(Te), Se = /** @class */ function(e) {
2674
2674
  function n(t) {
2675
2675
  var n = this;
2676
2676
  return (n = e.call(this) || this).elements = t, n;
2677
2677
  }
2678
2678
  return t(n, e), n;
2679
- }(be), Ee = /** @class */ function(e) {
2679
+ }(Te), ke = /** @class */ function(e) {
2680
2680
  function n(t) {
2681
2681
  var n = this;
2682
2682
  return (n = e.call(this) || this).elements = t, n;
2683
2683
  }
2684
2684
  return t(n, e), n;
2685
- }(be), ke = /** @class */ function(e) {
2685
+ }(Te), Ie = /** @class */ function(e) {
2686
2686
  function n(t, n) {
2687
2687
  var r = this;
2688
2688
  return (r = e.call(this) || this).L = t, r.M = n, r;
2689
2689
  }
2690
2690
  return t(n, e), n;
2691
- }(be), Se = function(t, e) {
2691
+ }(Te), Ae = function(t, e) {
2692
2692
  this.field = t, this.transform = e;
2693
- }, Ie = /** @class */ function() {
2693
+ }, Ve = /** @class */ function() {
2694
2694
  function t(t, e) {
2695
2695
  this.updateTime = t, this.exists = e
2696
2696
  /** Creates a new empty Precondition. */;
@@ -2712,7 +2712,7 @@ function we(t, e) {
2712
2712
  }), t.prototype.isEqual = function(t) {
2713
2713
  return this.exists === t.exists && (this.updateTime ? !!t.updateTime && this.updateTime.isEqual(t.updateTime) : !t.updateTime);
2714
2714
  }, t;
2715
- }(), Ae = function() {}, Ve = /** @class */ function(e) {
2715
+ }(), Pe = function() {}, De = /** @class */ function(e) {
2716
2716
  function n(t, n, r, i) {
2717
2717
  void 0 === i && (i = []);
2718
2718
  var o = this;
@@ -2722,7 +2722,7 @@ function we(t, e) {
2722
2722
  return t(n, e), n.prototype.getFieldMask = function() {
2723
2723
  return null;
2724
2724
  }, n;
2725
- }(Ae), Pe = /** @class */ function(e) {
2725
+ }(Pe), Oe = /** @class */ function(e) {
2726
2726
  function n(t, n, r, i, o) {
2727
2727
  void 0 === o && (o = []);
2728
2728
  var a = this;
@@ -2732,7 +2732,7 @@ function we(t, e) {
2732
2732
  return t(n, e), n.prototype.getFieldMask = function() {
2733
2733
  return this.fieldMask;
2734
2734
  }, n;
2735
- }(Ae), De = /** @class */ function(e) {
2735
+ }(Pe), Ne = /** @class */ function(e) {
2736
2736
  function n(t, n) {
2737
2737
  var r = this;
2738
2738
  return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 2 /* Delete */ ,
@@ -2741,7 +2741,7 @@ function we(t, e) {
2741
2741
  return t(n, e), n.prototype.getFieldMask = function() {
2742
2742
  return null;
2743
2743
  }, n;
2744
- }(Ae), Ne = /** @class */ function(e) {
2744
+ }(Pe), Fe = /** @class */ function(e) {
2745
2745
  function n(t, n) {
2746
2746
  var r = this;
2747
2747
  return (r = e.call(this) || this).key = t, r.precondition = n, r.type = 3 /* Verify */ ,
@@ -2750,10 +2750,10 @@ function we(t, e) {
2750
2750
  return t(n, e), n.prototype.getFieldMask = function() {
2751
2751
  return null;
2752
2752
  }, n;
2753
- }(Ae), Oe = {
2753
+ }(Pe), Re = {
2754
2754
  asc: "ASCENDING",
2755
2755
  desc: "DESCENDING"
2756
- }, Fe = {
2756
+ }, qe = {
2757
2757
  "<": "LESS_THAN",
2758
2758
  "<=": "LESS_THAN_OR_EQUAL",
2759
2759
  ">": "GREATER_THAN",
@@ -2764,7 +2764,7 @@ function we(t, e) {
2764
2764
  in: "IN",
2765
2765
  "not-in": "NOT_IN",
2766
2766
  "array-contains-any": "ARRAY_CONTAINS_ANY"
2767
- }, Re = function(t, e) {
2767
+ }, Le = function(t, e) {
2768
2768
  this.databaseId = t, this.C = e;
2769
2769
  };
2770
2770
 
@@ -2780,7 +2780,7 @@ function we(t, e) {
2780
2780
  /**
2781
2781
  * Returns a value for a Date that's appropriate to put into a proto.
2782
2782
  */
2783
- function qe(t, e) {
2783
+ function xe(t, e) {
2784
2784
  return t.C ? new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "") + "." + ("000000000" + e.nanoseconds).slice(-9) + "Z" : {
2785
2785
  seconds: "" + e.seconds,
2786
2786
  nanos: e.nanoseconds
@@ -2791,72 +2791,161 @@ function qe(t, e) {
2791
2791
  * Returns a value for bytes that's appropriate to put in a proto.
2792
2792
  *
2793
2793
  * Visible for testing.
2794
- */ function Le(t, e) {
2794
+ */ function Ce(t, e) {
2795
2795
  return t.C ? e.toBase64() : e.toUint8Array();
2796
2796
  }
2797
2797
 
2798
- function xe(t, e) {
2799
- return qe(t, e.toTimestamp());
2798
+ function je(t, e) {
2799
+ return xe(t, e.toTimestamp());
2800
2800
  }
2801
2801
 
2802
- function Ce(t) {
2803
- return k(!!t), _t.fromTimestamp(function(t) {
2804
- var e = Ot(t);
2805
- return new bt(e.seconds, e.nanos);
2802
+ function Me(t) {
2803
+ return I(!!t), Et.fromTimestamp(function(t) {
2804
+ var e = Rt(t);
2805
+ return new Tt(e.seconds, e.nanos);
2806
2806
  }(t));
2807
2807
  }
2808
2808
 
2809
- function je(t, e) {
2809
+ function Ue(t, e) {
2810
2810
  return function(t) {
2811
- return new $([ "projects", t.projectId, "databases", t.database ]);
2811
+ return new et([ "projects", t.projectId, "databases", t.database ]);
2812
2812
  }(t).child("documents").child(e).canonicalString();
2813
2813
  }
2814
2814
 
2815
- function Me(t, e) {
2816
- return je(t.databaseId, e.path);
2815
+ function Be(t, e) {
2816
+ return Ue(t.databaseId, e.path);
2817
2817
  }
2818
2818
 
2819
- function Ue(t, e) {
2819
+ function ze(t, e) {
2820
2820
  var n, r = function(t) {
2821
- var e = $.fromString(t);
2822
- return k(He(e)), e;
2821
+ var e = et.fromString(t);
2822
+ return I(Ze(e)), e;
2823
2823
  }(e);
2824
- if (r.get(1) !== t.databaseId.projectId) throw new M(V, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
2825
- if (r.get(3) !== t.databaseId.database) throw new M(V, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
2826
- return new nt((k((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
2824
+ if (r.get(1) !== t.databaseId.projectId) throw new B(D, "Tried to deserialize key from different project: " + r.get(1) + " vs " + t.databaseId.projectId);
2825
+ if (r.get(3) !== t.databaseId.database) throw new B(D, "Tried to deserialize key from different database: " + r.get(3) + " vs " + t.databaseId.database);
2826
+ return new it((I((n = r).length > 4 && "documents" === n.get(4)), n.popFirst(5)));
2827
2827
  }
2828
2828
 
2829
- function Be(t, e) {
2830
- return je(t.databaseId, e);
2829
+ function Ge(t, e) {
2830
+ return Ue(t.databaseId, e);
2831
2831
  }
2832
2832
 
2833
- function ze(t) {
2834
- return new $([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
2833
+ function Ke(t) {
2834
+ return new et([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
2835
2835
  }
2836
2836
 
2837
- function Ge(t, e, n) {
2837
+ function Qe(t, e, n) {
2838
2838
  return {
2839
- name: Me(t, e),
2839
+ name: Be(t, e),
2840
2840
  fields: n.value.mapValue.fields
2841
2841
  };
2842
2842
  }
2843
2843
 
2844
- function Ke(t) {
2845
- return Oe[t];
2844
+ function We(t, e) {
2845
+ // Dissect the path into parent, collectionId, and optional key filter.
2846
+ var n = {
2847
+ structuredQuery: {}
2848
+ }, r = e.path;
2849
+ null !== e.collectionGroup ? (n.parent = Ge(t, r), n.structuredQuery.from = [ {
2850
+ collectionId: e.collectionGroup,
2851
+ allDescendants: !0
2852
+ } ]) : (n.parent = Ge(t, r.popLast()), n.structuredQuery.from = [ {
2853
+ collectionId: r.lastSegment()
2854
+ } ]);
2855
+ var i = function(t) {
2856
+ if (0 !== t.length) {
2857
+ var e = t.map((function(t) {
2858
+ // visible for testing
2859
+ return function(t) {
2860
+ if ("==" /* EQUAL */ === t.op) {
2861
+ if (Ht(t.value)) return {
2862
+ unaryFilter: {
2863
+ field: Xe(t.field),
2864
+ op: "IS_NAN"
2865
+ }
2866
+ };
2867
+ if (Yt(t.value)) return {
2868
+ unaryFilter: {
2869
+ field: Xe(t.field),
2870
+ op: "IS_NULL"
2871
+ }
2872
+ };
2873
+ } else if ("!=" /* NOT_EQUAL */ === t.op) {
2874
+ if (Ht(t.value)) return {
2875
+ unaryFilter: {
2876
+ field: Xe(t.field),
2877
+ op: "IS_NOT_NAN"
2878
+ }
2879
+ };
2880
+ if (Yt(t.value)) return {
2881
+ unaryFilter: {
2882
+ field: Xe(t.field),
2883
+ op: "IS_NOT_NULL"
2884
+ }
2885
+ };
2886
+ }
2887
+ return {
2888
+ fieldFilter: {
2889
+ field: Xe(t.field),
2890
+ op: He(t.op),
2891
+ value: t.value
2892
+ }
2893
+ };
2894
+ }(t);
2895
+ }));
2896
+ return 1 === e.length ? e[0] : {
2897
+ compositeFilter: {
2898
+ op: "AND",
2899
+ filters: e
2900
+ }
2901
+ };
2902
+ }
2903
+ }(e.filters);
2904
+ i && (n.structuredQuery.where = i);
2905
+ var o = function(t) {
2906
+ if (0 !== t.length) return t.map((function(t) {
2907
+ // visible for testing
2908
+ return function(t) {
2909
+ return {
2910
+ field: Xe(t.field),
2911
+ direction: Ye(t.dir)
2912
+ };
2913
+ }(t);
2914
+ }));
2915
+ }(e.orderBy);
2916
+ o && (n.structuredQuery.orderBy = o);
2917
+ var a, u = function(t, e) {
2918
+ return t.C || ft(e) ? e : {
2919
+ value: e
2920
+ };
2921
+ }(t, e.limit);
2922
+ return null !== u && (n.structuredQuery.limit = u), e.startAt && (n.structuredQuery.startAt = {
2923
+ before: (a = e.startAt).inclusive,
2924
+ values: a.position
2925
+ }), e.endAt && (n.structuredQuery.endAt = function(t) {
2926
+ return {
2927
+ before: !t.inclusive,
2928
+ values: t.position
2929
+ };
2930
+ }(e.endAt)), n;
2931
+ }
2932
+
2933
+ function Ye(t) {
2934
+ return Re[t];
2846
2935
  }
2847
2936
 
2848
2937
  // visible for testing
2849
- function Qe(t) {
2850
- return Fe[t];
2938
+ function He(t) {
2939
+ return qe[t];
2851
2940
  }
2852
2941
 
2853
- function We(t) {
2942
+ function Xe(t) {
2854
2943
  return {
2855
2944
  fieldPath: t.canonicalString()
2856
2945
  };
2857
2946
  }
2858
2947
 
2859
- function Ye(t) {
2948
+ function Je(t) {
2860
2949
  var e = [];
2861
2950
  return t.fields.forEach((function(t) {
2862
2951
  return e.push(t.canonicalString());
@@ -2865,7 +2954,7 @@ function Ye(t) {
2865
2954
  };
2866
2955
  }
2867
2956
 
2868
- function He(t) {
2957
+ function Ze(t) {
2869
2958
  // Resource names have at least 4 components (project ID, database ID)
2870
2959
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
2871
2960
  }
@@ -2885,8 +2974,8 @@ function He(t) {
2885
2974
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2886
2975
  * See the License for the specific language governing permissions and
2887
2976
  * limitations under the License.
2888
- */ function Xe(t) {
2889
- return new Re(t, /* useProto3Json= */ !0);
2977
+ */ function $e(t) {
2978
+ return new Le(t, /* useProto3Json= */ !0);
2890
2979
  }
2891
2980
 
2892
2981
  /**
@@ -2913,7 +3002,7 @@ function He(t) {
2913
3002
  * backoff curve, and a +/- 50% "jitter" that is calculated and added to the
2914
3003
  * base delay. This prevents clients from accidentally synchronizing their
2915
3004
  * delays causing spikes of load to the backend.
2916
- */ var Je = /** @class */ function() {
3005
+ */ var tn = /** @class */ function() {
2917
3006
  function t(
2918
3007
  /**
2919
3008
  * The AsyncQueue to run backoff operations on.
@@ -2972,7 +3061,7 @@ function He(t) {
2972
3061
  // honored as such).
2973
3062
  var n = Math.floor(this.W + this.X()), r = Math.max(0, Date.now() - this.Y), i = Math.max(0, n - r);
2974
3063
  // Guard against lastAttemptTime being in the future due to a clock change.
2975
- i > 0 && w("ExponentialBackoff", "Backing off for " + i + " ms (base delay: " + this.W + " ms, delay with jitter: " + n + " ms, last attempt: " + r + " ms ago)"),
3064
+ i > 0 && _("ExponentialBackoff", "Backing off for " + i + " ms (base delay: " + this.W + " ms, delay with jitter: " + n + " ms, last attempt: " + r + " ms ago)"),
2976
3065
  this.K = this.U.enqueueAfterDelay(this.timerId, i, (function() {
2977
3066
  return e.Y = Date.now(), t();
2978
3067
  })),
@@ -2987,14 +3076,14 @@ function He(t) {
2987
3076
  /** Returns a random value in the range [-currentBaseMs/2, currentBaseMs/2] */ t.prototype.X = function() {
2988
3077
  return (Math.random() - .5) * this.W;
2989
3078
  }, t;
2990
- }(), Ze = /** @class */ function(e) {
3079
+ }(), en = /** @class */ function(e) {
2991
3080
  function n(t, n, r, i) {
2992
3081
  var o = this;
2993
3082
  return (o = e.call(this) || this).authCredentials = t, o.appCheckCredentials = n,
2994
3083
  o.tt = r, o.L = i, o.et = !1, o;
2995
3084
  }
2996
3085
  return t(n, e), n.prototype.nt = function() {
2997
- if (this.et) throw new M(R, "The client has already been terminated.");
3086
+ if (this.et) throw new B(L, "The client has already been terminated.");
2998
3087
  },
2999
3088
  /** Invokes the provided RPC with auth and AppCheck tokens. */ n.prototype.I = function(t, e, n) {
3000
3089
  var r = this;
@@ -3002,18 +3091,18 @@ function He(t) {
3002
3091
  var o = i[0], a = i[1];
3003
3092
  return r.tt.I(t, e, n, o, a);
3004
3093
  })).catch((function(t) {
3005
- throw "FirebaseError" === t.name ? (t.code === O && (r.authCredentials.invalidateToken(),
3006
- r.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
3094
+ throw "FirebaseError" === t.name ? (t.code === R && (r.authCredentials.invalidateToken(),
3095
+ r.appCheckCredentials.invalidateToken()), t) : new B(P, t.toString());
3007
3096
  }));
3008
3097
  },
3009
3098
  /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ n.prototype.P = function(t, e, n, r) {
3010
3099
  var i = this;
3011
3100
  return this.nt(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((function(o) {
3012
- var a = o[0], s = o[1];
3013
- return i.tt.P(t, e, n, a, s, r);
3101
+ var a = o[0], u = o[1];
3102
+ return i.tt.P(t, e, n, a, u, r);
3014
3103
  })).catch((function(t) {
3015
- throw "FirebaseError" === t.name ? (t.code === O && (i.authCredentials.invalidateToken(),
3016
- i.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
3104
+ throw "FirebaseError" === t.name ? (t.code === R && (i.authCredentials.invalidateToken(),
3105
+ i.appCheckCredentials.invalidateToken()), t) : new B(P, t.toString());
3017
3106
  }));
3018
3107
  }, n.prototype.terminate = function() {
3019
3108
  this.et = !0;
@@ -3047,60 +3136,60 @@ function He(t) {
3047
3136
  */
3048
3137
  // TODO(firestorexp): Make sure there is only one Datastore instance per
3049
3138
  // firestore-exp client.
3050
- function $e(t, r) {
3139
+ function nn(t, r) {
3051
3140
  return e(this, void 0, void 0, (function() {
3052
3141
  var e, i, o;
3053
3142
  return n(this, (function(n) {
3054
3143
  switch (n.label) {
3055
3144
  case 0:
3056
- return e = S(t), i = ze(e.L) + "/documents", o = {
3145
+ return e = A(t), i = Ke(e.L) + "/documents", o = {
3057
3146
  writes: r.map((function(t) {
3058
3147
  return function(t, e) {
3059
3148
  var n;
3060
- if (e instanceof Ve) n = {
3061
- update: Ge(t, e.key, e.value)
3062
- }; else if (e instanceof De) n = {
3063
- delete: Me(t, e.key)
3064
- }; else if (e instanceof Pe) n = {
3065
- update: Ge(t, e.key, e.data),
3066
- updateMask: Ye(e.fieldMask)
3149
+ if (e instanceof De) n = {
3150
+ update: Qe(t, e.key, e.value)
3151
+ }; else if (e instanceof Ne) n = {
3152
+ delete: Be(t, e.key)
3153
+ }; else if (e instanceof Oe) n = {
3154
+ update: Qe(t, e.key, e.data),
3155
+ updateMask: Je(e.fieldMask)
3067
3156
  }; else {
3068
- if (!(e instanceof Ne)) return E();
3157
+ if (!(e instanceof Fe)) return k();
3069
3158
  n = {
3070
- verify: Me(t, e.key)
3159
+ verify: Be(t, e.key)
3071
3160
  };
3072
3161
  }
3073
3162
  return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((function(t) {
3074
3163
  return function(t, e) {
3075
3164
  var n = e.transform;
3076
- if (n instanceof _e) return {
3165
+ if (n instanceof Ee) return {
3077
3166
  fieldPath: e.field.canonicalString(),
3078
3167
  setToServerValue: "REQUEST_TIME"
3079
3168
  };
3080
- if (n instanceof Te) return {
3169
+ if (n instanceof Se) return {
3081
3170
  fieldPath: e.field.canonicalString(),
3082
3171
  appendMissingElements: {
3083
3172
  values: n.elements
3084
3173
  }
3085
3174
  };
3086
- if (n instanceof Ee) return {
3175
+ if (n instanceof ke) return {
3087
3176
  fieldPath: e.field.canonicalString(),
3088
3177
  removeAllFromArray: {
3089
3178
  values: n.elements
3090
3179
  }
3091
3180
  };
3092
- if (n instanceof ke) return {
3181
+ if (n instanceof Ie) return {
3093
3182
  fieldPath: e.field.canonicalString(),
3094
3183
  increment: n.M
3095
3184
  };
3096
- throw E();
3185
+ throw k();
3097
3186
  }(0, t);
3098
3187
  }))), e.precondition.isNone || (n.currentDocument = function(t, e) {
3099
3188
  return void 0 !== e.updateTime ? {
3100
- updateTime: xe(t, e.updateTime)
3189
+ updateTime: je(t, e.updateTime)
3101
3190
  } : void 0 !== e.exists ? {
3102
3191
  exists: e.exists
3103
- } : E();
3192
+ } : k();
3104
3193
  }(t, e.precondition)), n;
3105
3194
  }(e.L, t);
3106
3195
  }))
@@ -3113,155 +3202,40 @@ function $e(t, r) {
3113
3202
  }));
3114
3203
  }
3115
3204
 
3116
- function tn(t, r) {
3205
+ function rn(t, r) {
3117
3206
  return e(this, void 0, void 0, (function() {
3118
- var e, i, o, a, s, u;
3207
+ var e, i, o, a, u, s;
3119
3208
  return n(this, (function(n) {
3120
3209
  switch (n.label) {
3121
3210
  case 0:
3122
- return e = S(t), i = ze(e.L) + "/documents", o = {
3211
+ return e = A(t), i = Ke(e.L) + "/documents", o = {
3123
3212
  documents: r.map((function(t) {
3124
- return Me(e.L, t);
3213
+ return Be(e.L, t);
3125
3214
  }))
3126
3215
  }, [ 4 /*yield*/ , e.P("BatchGetDocuments", i, o, r.length) ];
3127
3216
 
3128
3217
  case 1:
3129
- return a = n.sent(), s = new Map, a.forEach((function(t) {
3218
+ return a = n.sent(), u = new Map, a.forEach((function(t) {
3130
3219
  var n = function(t, e) {
3131
3220
  return "found" in e ? function(t, e) {
3132
- k(!!e.found), e.found.name, e.found.updateTime;
3133
- var n = Ue(t, e.found.name), r = Ce(e.found.updateTime), i = new Xt({
3221
+ I(!!e.found), e.found.name, e.found.updateTime;
3222
+ var n = ze(t, e.found.name), r = Me(e.found.updateTime), i = new Zt({
3134
3223
  mapValue: {
3135
3224
  fields: e.found.fields
3136
3225
  }
3137
3226
  });
3138
- return Jt.newFoundDocument(n, r, i);
3227
+ return $t.newFoundDocument(n, r, i);
3139
3228
  }(t, e) : "missing" in e ? function(t, e) {
3140
- k(!!e.missing), k(!!e.readTime);
3141
- var n = Ue(t, e.missing), r = Ce(e.readTime);
3142
- return Jt.newNoDocument(n, r);
3143
- }(t, e) : E();
3229
+ I(!!e.missing), I(!!e.readTime);
3230
+ var n = ze(t, e.missing), r = Me(e.readTime);
3231
+ return $t.newNoDocument(n, r);
3232
+ }(t, e) : k();
3144
3233
  }(e.L, t);
3145
- s.set(n.key.toString(), n);
3146
- })), u = [], [ 2 /*return*/ , (r.forEach((function(t) {
3147
- var e = s.get(t.toString());
3148
- k(!!e), u.push(e);
3149
- })), u) ];
3150
- }
3151
- }));
3152
- }));
3153
- }
3154
-
3155
- function en(t, r) {
3156
- return e(this, void 0, void 0, (function() {
3157
- var e, i;
3158
- return n(this, (function(n) {
3159
- switch (n.label) {
3160
- case 0:
3161
- return e = S(t), i = function(t, e) {
3162
- // Dissect the path into parent, collectionId, and optional key filter.
3163
- var n = {
3164
- structuredQuery: {}
3165
- }, r = e.path;
3166
- null !== e.collectionGroup ? (n.parent = Be(t, r), n.structuredQuery.from = [ {
3167
- collectionId: e.collectionGroup,
3168
- allDescendants: !0
3169
- } ]) : (n.parent = Be(t, r.popLast()), n.structuredQuery.from = [ {
3170
- collectionId: r.lastSegment()
3171
- } ]);
3172
- var i = function(t) {
3173
- if (0 !== t.length) {
3174
- var e = t.map((function(t) {
3175
- // visible for testing
3176
- return function(t) {
3177
- if ("==" /* EQUAL */ === t.op) {
3178
- if (Wt(t.value)) return {
3179
- unaryFilter: {
3180
- field: We(t.field),
3181
- op: "IS_NAN"
3182
- }
3183
- };
3184
- if (Qt(t.value)) return {
3185
- unaryFilter: {
3186
- field: We(t.field),
3187
- op: "IS_NULL"
3188
- }
3189
- };
3190
- } else if ("!=" /* NOT_EQUAL */ === t.op) {
3191
- if (Wt(t.value)) return {
3192
- unaryFilter: {
3193
- field: We(t.field),
3194
- op: "IS_NOT_NAN"
3195
- }
3196
- };
3197
- if (Qt(t.value)) return {
3198
- unaryFilter: {
3199
- field: We(t.field),
3200
- op: "IS_NOT_NULL"
3201
- }
3202
- };
3203
- }
3204
- return {
3205
- fieldFilter: {
3206
- field: We(t.field),
3207
- op: Qe(t.op),
3208
- value: t.value
3209
- }
3210
- };
3211
- }(t);
3212
- }));
3213
- return 1 === e.length ? e[0] : {
3214
- compositeFilter: {
3215
- op: "AND",
3216
- filters: e
3217
- }
3218
- };
3219
- }
3220
- }(e.filters);
3221
- i && (n.structuredQuery.where = i);
3222
- var o = function(t) {
3223
- if (0 !== t.length) return t.map((function(t) {
3224
- // visible for testing
3225
- return function(t) {
3226
- return {
3227
- field: We(t.field),
3228
- direction: Ke(t.dir)
3229
- };
3230
- }(t);
3231
- }));
3232
- }(e.orderBy);
3233
- o && (n.structuredQuery.orderBy = o);
3234
- var a, s = function(t, e) {
3235
- return t.C || ct(e) ? e : {
3236
- value: e
3237
- };
3238
- }(t, e.limit);
3239
- return null !== s && (n.structuredQuery.limit = s), e.startAt && (n.structuredQuery.startAt = {
3240
- before: (a = e.startAt).inclusive,
3241
- values: a.position
3242
- }), e.endAt && (n.structuredQuery.endAt = function(t) {
3243
- return {
3244
- before: !t.inclusive,
3245
- values: t.position
3246
- };
3247
- }(e.endAt)), n;
3248
- }(e.L, ge(r)), [ 4 /*yield*/ , e.P("RunQuery", i.parent, {
3249
- structuredQuery: i.structuredQuery
3250
- }) ];
3251
-
3252
- case 1:
3253
- return [ 2 /*return*/ , n.sent().filter((function(t) {
3254
- return !!t.document;
3255
- })).map((function(t) {
3256
- return function(t, e, n) {
3257
- var r = Ue(t, e.name), i = Ce(e.updateTime), o = new Xt({
3258
- mapValue: {
3259
- fields: e.fields
3260
- }
3261
- }), a = Jt.newFoundDocument(r, i, o);
3262
- return a;
3263
- }(e.L, t.document);
3264
- })) ];
3234
+ u.set(n.key.toString(), n);
3235
+ })), s = [], [ 2 /*return*/ , (r.forEach((function(t) {
3236
+ var e = u.get(t.toString());
3237
+ I(!!e), s.push(e);
3238
+ })), s) ];
3265
3239
  }
3266
3240
  }));
3267
3241
  }));
@@ -3282,7 +3256,8 @@ function en(t, r) {
3282
3256
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3283
3257
  * See the License for the specific language governing permissions and
3284
3258
  * limitations under the License.
3285
- */ var nn = new Map;
3259
+ */
3260
+ var on = new Map;
3286
3261
 
3287
3262
  /**
3288
3263
  * An instance map that ensures only one Datastore exists per Firestore
@@ -3292,19 +3267,19 @@ function en(t, r) {
3292
3267
  * Returns an initialized and started Datastore for the given Firestore
3293
3268
  * instance. Callers must invoke removeComponents() when the Firestore
3294
3269
  * instance is terminated.
3295
- */ function rn(t) {
3296
- if (t._terminated) throw new M(R, "The client has already been terminated.");
3297
- if (!nn.has(t)) {
3298
- w("ComponentProvider", "Initializing Datastore");
3270
+ */ function an(t) {
3271
+ if (t._terminated) throw new B(L, "The client has already been terminated.");
3272
+ if (!on.has(t)) {
3273
+ _("ComponentProvider", "Initializing Datastore");
3299
3274
  var e = function(t) {
3300
- return new yt(t, fetch.bind(null));
3301
- }((i = t._databaseId, o = t.app.options.appId || "", a = t._persistenceKey, s = t._freezeSettings(),
3302
- new X(i, o, a, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), n = Xe(t._databaseId), r = function(t, e, n, r) {
3303
- return new Ze(t, e, n, r);
3275
+ return new vt(t, fetch.bind(null));
3276
+ }((i = t._databaseId, o = t.app.options.appId || "", a = t._persistenceKey, u = t._freezeSettings(),
3277
+ new Z(i, o, a, u.host, u.ssl, u.experimentalForceLongPolling, u.experimentalAutoDetectLongPolling, u.useFetchStreams))), n = $e(t._databaseId), r = function(t, e, n, r) {
3278
+ return new en(t, e, n, r);
3304
3279
  }(t._authCredentials, t._appCheckCredentials, e, n);
3305
- nn.set(t, r);
3280
+ on.set(t, r);
3306
3281
  }
3307
- var i, o, a, s;
3282
+ var i, o, a, u;
3308
3283
  /**
3309
3284
  * @license
3310
3285
  * Copyright 2018 Google LLC
@@ -3320,7 +3295,7 @@ function en(t, r) {
3320
3295
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3321
3296
  * See the License for the specific language governing permissions and
3322
3297
  * limitations under the License.
3323
- */ return nn.get(t);
3298
+ */ return on.get(t);
3324
3299
  }
3325
3300
 
3326
3301
  /**
@@ -3331,27 +3306,27 @@ function en(t, r) {
3331
3306
  * A concrete type describing all the values that can be applied via a
3332
3307
  * user-supplied `FirestoreSettings` object. This is a separate type so that
3333
3308
  * defaults can be supplied and the value can be checked for equality.
3334
- */ var on = /** @class */ function() {
3309
+ */ var un = /** @class */ function() {
3335
3310
  function t(t) {
3336
3311
  var e;
3337
3312
  if (void 0 === t.host) {
3338
- if (void 0 !== t.ssl) throw new M(V, "Can't provide ssl option if host option is not set");
3313
+ if (void 0 !== t.ssl) throw new B(D, "Can't provide ssl option if host option is not set");
3339
3314
  this.host = "firestore.googleapis.com", this.ssl = !0;
3340
3315
  } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
3341
3316
  if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
3342
3317
  void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
3343
- if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new M(V, "cacheSizeBytes must be at least 1048576");
3318
+ if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new B(D, "cacheSizeBytes must be at least 1048576");
3344
3319
  this.cacheSizeBytes = t.cacheSizeBytes;
3345
3320
  }
3346
3321
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
3347
3322
  this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
3348
- if (!0 === e && !0 === r) throw new M(V, "experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.");
3323
+ if (!0 === e && !0 === r) throw new B(D, "experimentalForceLongPolling and experimentalAutoDetectLongPolling cannot be used together.");
3349
3324
  }(0, t.experimentalForceLongPolling, 0, t.experimentalAutoDetectLongPolling);
3350
3325
  }
3351
3326
  return t.prototype.isEqual = function(t) {
3352
3327
  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;
3353
3328
  }, t;
3354
- }(), an = /** @class */ function() {
3329
+ }(), sn = /** @class */ function() {
3355
3330
  /** @hideconstructor */
3356
3331
  function t(t, e, n, r) {
3357
3332
  this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
@@ -3359,7 +3334,7 @@ function en(t, r) {
3359
3334
  /**
3360
3335
  * Whether it's a Firestore or Firestore Lite instance.
3361
3336
  */
3362
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new on({}),
3337
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new un({}),
3363
3338
  this._settingsFrozen = !1;
3364
3339
  }
3365
3340
  return Object.defineProperty(t.prototype, "app", {
@@ -3368,7 +3343,7 @@ function en(t, r) {
3368
3343
  * instance.
3369
3344
  */
3370
3345
  get: function() {
3371
- if (!this._app) throw new M(R, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
3346
+ if (!this._app) throw new B(L, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
3372
3347
  return this._app;
3373
3348
  },
3374
3349
  enumerable: !1,
@@ -3386,19 +3361,19 @@ function en(t, r) {
3386
3361
  enumerable: !1,
3387
3362
  configurable: !0
3388
3363
  }), t.prototype._setSettings = function(t) {
3389
- if (this._settingsFrozen) throw new M(R, "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.");
3390
- this._settings = new on(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3391
- if (!t) return new z;
3364
+ if (this._settingsFrozen) throw new B(L, "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.");
3365
+ this._settings = new un(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3366
+ if (!t) return new K;
3392
3367
  switch (t.type) {
3393
3368
  case "gapi":
3394
3369
  var e = t.client;
3395
- return new W(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
3370
+ return new H(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
3396
3371
 
3397
3372
  case "provider":
3398
3373
  return t.client;
3399
3374
 
3400
3375
  default:
3401
- throw new M(V, "makeAuthCredentialsProvider failed due to invalid credential type");
3376
+ throw new B(D, "makeAuthCredentialsProvider failed due to invalid credential type");
3402
3377
  }
3403
3378
  }(t.credentials));
3404
3379
  }, t.prototype._getSettings = function() {
@@ -3423,8 +3398,8 @@ function en(t, r) {
3423
3398
  * Only ever called once.
3424
3399
  */
3425
3400
  t.prototype._terminate = function() {
3426
- return t = this, (e = nn.get(t)) && (w("ComponentProvider", "Removing Datastore"),
3427
- nn.delete(t), e.terminate()), Promise.resolve();
3401
+ return t = this, (e = on.get(t)) && (_("ComponentProvider", "Removing Datastore"),
3402
+ on.delete(t), e.terminate()), Promise.resolve();
3428
3403
  var t, e;
3429
3404
  }, t;
3430
3405
  }();
@@ -3448,22 +3423,29 @@ function en(t, r) {
3448
3423
  /**
3449
3424
  * The Cloud Firestore service interface.
3450
3425
  *
3451
- * Do not call this constructor directly. Instead, use {@link getFirestore}.
3452
- */ function sn(t, e, n) {
3426
+ * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
3427
+ */ function cn(t, e, n) {
3453
3428
  n || (n = "(default)");
3454
3429
  var r = _getProvider(t, "firestore/lite");
3455
- if (r.isInitialized(n)) throw new M(R, "Firestore can only be initialized once per app.");
3430
+ if (r.isInitialized(n)) throw new B(L, "Firestore can only be initialized once per app.");
3456
3431
  return r.initialize({
3457
3432
  options: e,
3458
3433
  instanceIdentifier: n
3459
3434
  });
3460
3435
  }
3461
3436
 
3462
- function un(t, e) {
3463
- var n = "object" == typeof t ? t : s(), r = "string" == typeof t ? t : e || "(default)";
3464
- return _getProvider(n, "firestore/lite").getImmediate({
3437
+ function ln(t, e) {
3438
+ var n = "object" == typeof t ? t : u(), r = "string" == typeof t ? t : e || "(default)", i = _getProvider(n, "firestore/lite").getImmediate({
3465
3439
  identifier: r
3466
3440
  });
3441
+ if (!i._initialized) {
3442
+ var o = d("firestore");
3443
+ if (o) {
3444
+ var a = o.split(":"), s = a[0], c = a[1];
3445
+ fn(i, s, parseInt(c, 10));
3446
+ }
3447
+ }
3448
+ return i;
3467
3449
  }
3468
3450
 
3469
3451
  /**
@@ -3478,25 +3460,25 @@ function un(t, e) {
3478
3460
  * @param port - the emulator port (ex: 9000).
3479
3461
  * @param options.mockUserToken - the mock auth token to use for unit testing
3480
3462
  * Security Rules.
3481
- */ function cn(t, e, n, r) {
3463
+ */ function fn(t, e, n, r) {
3482
3464
  var i;
3483
3465
  void 0 === r && (r = {});
3484
- var o = (t = st(t, an))._getSettings();
3485
- if ("firestore.googleapis.com" !== o.host && o.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3466
+ var o = (t = ct(t, sn))._getSettings();
3467
+ if ("firestore.googleapis.com" !== o.host && o.host !== e && E("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3486
3468
  t._setSettings(Object.assign(Object.assign({}, o), {
3487
3469
  host: e + ":" + n,
3488
3470
  ssl: !1
3489
3471
  })), r.mockUserToken) {
3490
- var a, s;
3491
- if ("string" == typeof r.mockUserToken) a = r.mockUserToken, s = y.MOCK_USER; else {
3472
+ var a, u;
3473
+ if ("string" == typeof r.mockUserToken) a = r.mockUserToken, u = v.MOCK_USER; else {
3492
3474
  // Let createMockUserToken validate first (catches common mistakes like
3493
3475
  // invalid field "uid" and missing field "sub" / "user_id".)
3494
- a = d(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
3495
- var u = r.mockUserToken.sub || r.mockUserToken.user_id;
3496
- if (!u) throw new M(V, "mockUserToken must contain 'sub' or 'user_id' field!");
3497
- s = new y(u);
3476
+ a = y(r.mockUserToken, null === (i = t._app) || void 0 === i ? void 0 : i.options.projectId);
3477
+ var s = r.mockUserToken.sub || r.mockUserToken.user_id;
3478
+ if (!s) throw new B(D, "mockUserToken must contain 'sub' or 'user_id' field!");
3479
+ u = new v(s);
3498
3480
  }
3499
- t._authCredentials = new G(new B(a, s));
3481
+ t._authCredentials = new Q(new G(a, u));
3500
3482
  }
3501
3483
  }
3502
3484
 
@@ -3509,7 +3491,7 @@ function un(t, e) {
3509
3491
  * response from the server will not be resolved.
3510
3492
  *
3511
3493
  * To restart after termination, create a new instance of `Firestore` with
3512
- * {@link getFirestore}.
3494
+ * {@link (getFirestore:1)}.
3513
3495
  *
3514
3496
  * Note: Under normal circumstances, calling `terminate()` is not required. This
3515
3497
  * function is useful only when you want to force this instance to release all of
@@ -3519,9 +3501,11 @@ function un(t, e) {
3519
3501
  * @param firestore - The `Firestore` instance to terminate.
3520
3502
  * @returns A `Promise` that is resolved when the instance has been successfully
3521
3503
  * terminated.
3522
- */ function ln(t) {
3523
- return t = st(t, an), u(t.app, "firestore/lite"), t._delete()
3524
- /**
3504
+ */ function hn(t) {
3505
+ return t = ct(t, sn), s(t.app, "firestore/lite"), t._delete();
3506
+ }
3507
+
3508
+ /**
3525
3509
  * @license
3526
3510
  * Copyright 2020 Google LLC
3527
3511
  *
@@ -3537,9 +3521,9 @@ function un(t, e) {
3537
3521
  * See the License for the specific language governing permissions and
3538
3522
  * limitations under the License.
3539
3523
  */
3540
- /**
3524
+ /**
3541
3525
  * @license
3542
- * Copyright 2020 Google LLC
3526
+ * Copyright 2022 Google LLC
3543
3527
  *
3544
3528
  * Licensed under the Apache License, Version 2.0 (the "License");
3545
3529
  * you may not use this file except in compliance with the License.
@@ -3553,14 +3537,85 @@ function un(t, e) {
3553
3537
  * See the License for the specific language governing permissions and
3554
3538
  * limitations under the License.
3555
3539
  */
3556
- /**
3557
- * A `DocumentReference` refers to a document location in a Firestore database
3558
- * and can be used to write, read, or listen to the location. The document at
3559
- * the referenced location may or may not exist.
3560
- */;
3561
- }
3562
-
3563
- var fn = /** @class */ function() {
3540
+ /**
3541
+ * Represents an aggregation that can be performed by Firestore.
3542
+ */
3543
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3544
+ var pn = function() {
3545
+ /** A type string to uniquely identify instances of this class. */
3546
+ this.type = "AggregateField";
3547
+ }, dn = /** @class */ function() {
3548
+ /** @hideconstructor */
3549
+ function t(t, e) {
3550
+ this._data = e,
3551
+ /** A type string to uniquely identify instances of this class. */
3552
+ this.type = "AggregateQuerySnapshot", this.query = t
3553
+ /**
3554
+ * Returns the results of the aggregations performed over the underlying
3555
+ * query.
3556
+ *
3557
+ * The keys of the returned object will be the same as those of the
3558
+ * `AggregateSpec` object specified to the aggregation method, and the values
3559
+ * will be the corresponding aggregation result.
3560
+ *
3561
+ * @returns The results of the aggregations performed over the underlying
3562
+ * query.
3563
+ */;
3564
+ }
3565
+ return t.prototype.data = function() {
3566
+ return this._data;
3567
+ }, t;
3568
+ }(), yn = /** @class */ function() {
3569
+ function t(t, e, n) {
3570
+ this.query = t, this.datastore = e, this.userDataWriter = n;
3571
+ }
3572
+ return t.prototype.run = function() {
3573
+ var t = this;
3574
+ return function(t, r) {
3575
+ return e(this, void 0, void 0, (function() {
3576
+ var e, i, o;
3577
+ return n(this, (function(n) {
3578
+ switch (n.label) {
3579
+ case 0:
3580
+ return e = A(t), i = function(t, e) {
3581
+ var n = We(t, e);
3582
+ return {
3583
+ structuredAggregationQuery: {
3584
+ aggregations: [ {
3585
+ count: {},
3586
+ alias: "count_alias"
3587
+ } ],
3588
+ structuredQuery: n.structuredQuery
3589
+ },
3590
+ parent: n.parent
3591
+ };
3592
+ }(e.L, be(r)), o = i.parent, e.tt.v || delete i.parent, [ 4 /*yield*/ , e.P("RunAggregationQuery", o, i, /*expectedResponseCount=*/ 1) ];
3593
+
3594
+ case 1:
3595
+ return [ 2 /*return*/ , n.sent().filter((function(t) {
3596
+ return !!t.result;
3597
+ })).map((function(t) {
3598
+ return t.result.aggregateFields;
3599
+ })) ];
3600
+ }
3601
+ }));
3602
+ }));
3603
+ }(this.datastore, this.query._query).then((function(e) {
3604
+ I(void 0 !== e[0]);
3605
+ var n = Object.entries(e[0]).filter((function(t) {
3606
+ var e = t[0];
3607
+ return t[1], "count_alias" === e;
3608
+ })).map((function(e) {
3609
+ e[0];
3610
+ var n = e[1];
3611
+ return t.userDataWriter.convertValue(n);
3612
+ }))[0];
3613
+ return I("number" == typeof n), Promise.resolve(new dn(t.query, {
3614
+ count: n
3615
+ }));
3616
+ }));
3617
+ }, t;
3618
+ }(), mn = /** @class */ function() {
3564
3619
  /** @hideconstructor */
3565
3620
  function t(t,
3566
3621
  /**
@@ -3601,14 +3656,14 @@ var fn = /** @class */ function() {
3601
3656
  * The collection this `DocumentReference` belongs to.
3602
3657
  */
3603
3658
  get: function() {
3604
- return new pn(this.firestore, this.converter, this._key.path.popLast());
3659
+ return new gn(this.firestore, this.converter, this._key.path.popLast());
3605
3660
  },
3606
3661
  enumerable: !1,
3607
3662
  configurable: !0
3608
3663
  }), t.prototype.withConverter = function(e) {
3609
3664
  return new t(this.firestore, e, this._key);
3610
3665
  }, t;
3611
- }(), hn = /** @class */ function() {
3666
+ }(), vn = /** @class */ function() {
3612
3667
  // This is the lite version of the Query class in the main SDK.
3613
3668
  /** @hideconstructor protected */
3614
3669
  function t(t,
@@ -3623,11 +3678,11 @@ var fn = /** @class */ function() {
3623
3678
  return t.prototype.withConverter = function(e) {
3624
3679
  return new t(this.firestore, e, this._query);
3625
3680
  }, t;
3626
- }(), pn = /** @class */ function(e) {
3681
+ }(), gn = /** @class */ function(e) {
3627
3682
  /** @hideconstructor */
3628
3683
  function n(t, n, r) {
3629
3684
  var i = this;
3630
- return (i = e.call(this, t, n, new pe(r)) || this)._path = r,
3685
+ return (i = e.call(this, t, n, new ye(r)) || this)._path = r,
3631
3686
  /** The type of this Firestore reference. */
3632
3687
  i.type = "collection", i;
3633
3688
  }
@@ -3654,28 +3709,27 @@ var fn = /** @class */ function() {
3654
3709
  */
3655
3710
  get: function() {
3656
3711
  var t = this._path.popLast();
3657
- return t.isEmpty() ? null : new fn(this.firestore,
3658
- /* converter= */ null, new nt(t));
3712
+ return t.isEmpty() ? null : new mn(this.firestore,
3713
+ /* converter= */ null, new it(t));
3659
3714
  },
3660
3715
  enumerable: !1,
3661
3716
  configurable: !0
3662
3717
  }), n.prototype.withConverter = function(t) {
3663
3718
  return new n(this.firestore, t, this._path);
3664
3719
  }, n;
3665
- }(hn);
3720
+ }(vn);
3666
3721
 
3667
3722
  /**
3668
- * A `Query` refers to a query which you can read or listen to. You can also
3669
- * construct refined `Query` objects by adding filters and ordering.
3670
- */ function dn(t, e) {
3723
+ * The results of executing an aggregation query.
3724
+ */ function wn(t, e) {
3671
3725
  for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
3672
- if (t = p(t), rt("collection", "path", e), t instanceof an) {
3673
- var o = $.fromString.apply($, r([ e ], n));
3674
- return ot(o), new pn(t, /* converter= */ null, o);
3726
+ if (t = p(t), ot("collection", "path", e), t instanceof sn) {
3727
+ var o = et.fromString.apply(et, r([ e ], n));
3728
+ return ut(o), new gn(t, /* converter= */ null, o);
3675
3729
  }
3676
- if (!(t instanceof fn || t instanceof pn)) throw new M(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3677
- var a = t._path.child($.fromString.apply($, r([ e ], n)));
3678
- return ot(a), new pn(t.firestore,
3730
+ if (!(t instanceof mn || t instanceof gn)) throw new B(D, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3731
+ var a = t._path.child(et.fromString.apply(et, r([ e ], n)));
3732
+ return ut(a), new gn(t.firestore,
3679
3733
  /* converter= */ null, a);
3680
3734
  }
3681
3735
 
@@ -3691,32 +3745,32 @@ var fn = /** @class */ function() {
3691
3745
  * collection or subcollection with this ID as the last segment of its path
3692
3746
  * will be included. Cannot contain a slash.
3693
3747
  * @returns The created `Query`.
3694
- */ function yn(t, e) {
3695
- if (t = st(t, an), rt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new M(V, "Invalid collection ID '" + e + "' passed to function collectionGroup(). Collection IDs must not contain '/'.");
3696
- return new hn(t,
3748
+ */ function bn(t, e) {
3749
+ if (t = ct(t, sn), ot("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new B(D, "Invalid collection ID '" + e + "' passed to function collectionGroup(). Collection IDs must not contain '/'.");
3750
+ return new vn(t,
3697
3751
  /* converter= */ null,
3698
3752
  /**
3699
3753
  * Creates a new Query for a collection group query that matches all documents
3700
3754
  * within the provided collection group.
3701
3755
  */
3702
3756
  function(t) {
3703
- return new pe($.emptyPath(), t);
3757
+ return new ye(et.emptyPath(), t);
3704
3758
  }(e));
3705
3759
  }
3706
3760
 
3707
- function mn(t, e) {
3761
+ function _n(t, e) {
3708
3762
  for (var n = [], i = 2; i < arguments.length; i++) n[i - 2] = arguments[i];
3709
3763
  if (t = p(t),
3710
3764
  // We allow omission of 'pathString' but explicitly prohibit passing in both
3711
3765
  // 'undefined' and 'null'.
3712
- 1 === arguments.length && (e = vt.D()), rt("doc", "path", e), t instanceof an) {
3713
- var o = $.fromString.apply($, r([ e ], n));
3714
- return it(o), new fn(t,
3715
- /* converter= */ null, new nt(o));
3766
+ 1 === arguments.length && (e = wt.D()), ot("doc", "path", e), t instanceof sn) {
3767
+ var o = et.fromString.apply(et, r([ e ], n));
3768
+ return at(o), new mn(t,
3769
+ /* converter= */ null, new it(o));
3716
3770
  }
3717
- if (!(t instanceof fn || t instanceof pn)) throw new M(V, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3718
- var a = t._path.child($.fromString.apply($, r([ e ], n)));
3719
- return it(a), new fn(t.firestore, t instanceof pn ? t.converter : null, new nt(a));
3771
+ if (!(t instanceof mn || t instanceof gn)) throw new B(D, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3772
+ var a = t._path.child(et.fromString.apply(et, r([ e ], n)));
3773
+ return at(a), new mn(t.firestore, t instanceof gn ? t.converter : null, new it(a));
3720
3774
  }
3721
3775
 
3722
3776
  /**
@@ -3726,8 +3780,8 @@ function mn(t, e) {
3726
3780
  * @param right - A reference to compare.
3727
3781
  * @returns true if the references point to the same location in the same
3728
3782
  * Firestore database.
3729
- */ function vn(t, e) {
3730
- return t = p(t), e = p(e), (t instanceof fn || t instanceof pn) && (e instanceof fn || e instanceof pn) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter
3783
+ */ function Tn(t, e) {
3784
+ return t = p(t), e = p(e), (t instanceof mn || t instanceof gn) && (e instanceof mn || e instanceof gn) && t.firestore === e.firestore && t.path === e.path && t.converter === e.converter
3731
3785
  /**
3732
3786
  * Returns true if the provided queries point to the same collection and apply
3733
3787
  * the same constraints.
@@ -3739,18 +3793,18 @@ function mn(t, e) {
3739
3793
  */;
3740
3794
  }
3741
3795
 
3742
- function gn(t, e) {
3743
- return t = p(t), e = p(e), t instanceof hn && e instanceof hn && t.firestore === e.firestore && function(t, e) {
3796
+ function En(t, e) {
3797
+ return t = p(t), e = p(e), t instanceof vn && e instanceof vn && t.firestore === e.firestore && function(t, e) {
3744
3798
  return function(t, e) {
3745
3799
  if (t.limit !== e.limit) return !1;
3746
3800
  if (t.orderBy.length !== e.orderBy.length) return !1;
3747
- for (var n = 0; n < t.orderBy.length; n++) if (!fe(t.orderBy[n], e.orderBy[n])) return !1;
3801
+ for (var n = 0; n < t.orderBy.length; n++) if (!pe(t.orderBy[n], e.orderBy[n])) return !1;
3748
3802
  if (t.filters.length !== e.filters.length) return !1;
3749
3803
  for (var r = 0; r < t.filters.length; r++) if (i = t.filters[r], o = e.filters[r],
3750
- i.op !== o.op || !i.field.isEqual(o.field) || !Mt(i.value, o.value)) return !1;
3804
+ i.op !== o.op || !i.field.isEqual(o.field) || !Bt(i.value, o.value)) return !1;
3751
3805
  var i, o;
3752
- return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!he(t.startAt, e.startAt) && he(t.endAt, e.endAt);
3753
- }(ge(t), ge(e)) && t.limitType === e.limitType;
3806
+ return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!de(t.startAt, e.startAt) && de(t.endAt, e.endAt);
3807
+ }(be(t), be(e)) && t.limitType === e.limitType;
3754
3808
  }(t._query, e._query) && t.converter === e.converter
3755
3809
  /**
3756
3810
  * @license
@@ -3769,63 +3823,11 @@ function gn(t, e) {
3769
3823
  * limitations under the License.
3770
3824
  */
3771
3825
  /**
3772
- * A `FieldPath` refers to a field in a document. The path may consist of a
3773
- * single field name (referring to a top-level field in the document), or a
3774
- * list of field names (referring to a nested field in the document).
3775
- *
3776
- * Create a `FieldPath` by providing field names. If more than one field
3777
- * name is provided, the path will point to a nested field in a document.
3826
+ * An immutable object representing an array of bytes.
3778
3827
  */;
3779
3828
  }
3780
3829
 
3781
- var wn = /** @class */ function() {
3782
- /**
3783
- * Creates a `FieldPath` from the provided field names. If more than one field
3784
- * name is provided, the path will point to a nested field in a document.
3785
- *
3786
- * @param fieldNames - A list of field names.
3787
- */
3788
- function t() {
3789
- for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
3790
- for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new M(V, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3791
- this._internalPath = new et(t);
3792
- }
3793
- /**
3794
- * Returns true if this `FieldPath` is equal to the provided one.
3795
- *
3796
- * @param other - The `FieldPath` to compare against.
3797
- * @returns true if this `FieldPath` is equal to the provided one.
3798
- */ return t.prototype.isEqual = function(t) {
3799
- return this._internalPath.isEqual(t._internalPath);
3800
- }, t;
3801
- }();
3802
-
3803
- /**
3804
- * Returns a special sentinel `FieldPath` to refer to the ID of a document.
3805
- * It can be used in queries to sort or filter by the document ID.
3806
- */ function bn() {
3807
- return new wn("__name__");
3808
- }
3809
-
3810
- /**
3811
- * @license
3812
- * Copyright 2020 Google LLC
3813
- *
3814
- * Licensed under the Apache License, Version 2.0 (the "License");
3815
- * you may not use this file except in compliance with the License.
3816
- * You may obtain a copy of the License at
3817
- *
3818
- * http://www.apache.org/licenses/LICENSE-2.0
3819
- *
3820
- * Unless required by applicable law or agreed to in writing, software
3821
- * distributed under the License is distributed on an "AS IS" BASIS,
3822
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3823
- * See the License for the specific language governing permissions and
3824
- * limitations under the License.
3825
- */
3826
- /**
3827
- * An immutable object representing an array of bytes.
3828
- */ var _n = /** @class */ function() {
3830
+ var Sn = /** @class */ function() {
3829
3831
  /** @hideconstructor */
3830
3832
  function t(t) {
3831
3833
  this._byteString = t;
@@ -3837,9 +3839,9 @@ var wn = /** @class */ function() {
3837
3839
  * @param base64 - The Base64 string used to create the `Bytes` object.
3838
3840
  */ return t.fromBase64String = function(e) {
3839
3841
  try {
3840
- return new t(Dt.fromBase64String(e));
3842
+ return new t(Nt.fromBase64String(e));
3841
3843
  } catch (e) {
3842
- throw new M(V, "Failed to construct data from Base64 string: " + e);
3844
+ throw new B(D, "Failed to construct data from Base64 string: " + e);
3843
3845
  }
3844
3846
  },
3845
3847
  /**
@@ -3848,7 +3850,7 @@ var wn = /** @class */ function() {
3848
3850
  * @param array - The Uint8Array used to create the `Bytes` object.
3849
3851
  */
3850
3852
  t.fromUint8Array = function(e) {
3851
- return new t(Dt.fromUint8Array(e));
3853
+ return new t(Nt.fromUint8Array(e));
3852
3854
  },
3853
3855
  /**
3854
3856
  * Returns the underlying bytes as a Base64-encoded string.
@@ -3883,14 +3885,87 @@ var wn = /** @class */ function() {
3883
3885
  t.prototype.isEqual = function(t) {
3884
3886
  return this._byteString.isEqual(t._byteString);
3885
3887
  }, t;
3886
- }(), Tn =
3888
+ }(), kn = /** @class */ function() {
3889
+ /**
3890
+ * Creates a `FieldPath` from the provided field names. If more than one field
3891
+ * name is provided, the path will point to a nested field in a document.
3892
+ *
3893
+ * @param fieldNames - A list of field names.
3894
+ */
3895
+ function t() {
3896
+ for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
3897
+ for (var n = 0; n < t.length; ++n) if (0 === t[n].length) throw new B(D, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3898
+ this._internalPath = new rt(t);
3899
+ }
3900
+ /**
3901
+ * Returns true if this `FieldPath` is equal to the provided one.
3902
+ *
3903
+ * @param other - The `FieldPath` to compare against.
3904
+ * @returns true if this `FieldPath` is equal to the provided one.
3905
+ */ return t.prototype.isEqual = function(t) {
3906
+ return this._internalPath.isEqual(t._internalPath);
3907
+ }, t;
3908
+ }();
3909
+
3910
+ /**
3911
+ * @license
3912
+ * Copyright 2020 Google LLC
3913
+ *
3914
+ * Licensed under the Apache License, Version 2.0 (the "License");
3915
+ * you may not use this file except in compliance with the License.
3916
+ * You may obtain a copy of the License at
3917
+ *
3918
+ * http://www.apache.org/licenses/LICENSE-2.0
3919
+ *
3920
+ * Unless required by applicable law or agreed to in writing, software
3921
+ * distributed under the License is distributed on an "AS IS" BASIS,
3922
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3923
+ * See the License for the specific language governing permissions and
3924
+ * limitations under the License.
3925
+ */
3926
+ /**
3927
+ * A `FieldPath` refers to a field in a document. The path may consist of a
3928
+ * single field name (referring to a top-level field in the document), or a
3929
+ * list of field names (referring to a nested field in the document).
3930
+ *
3931
+ * Create a `FieldPath` by providing field names. If more than one field
3932
+ * name is provided, the path will point to a nested field in a document.
3933
+ */
3934
+ /**
3935
+ * Returns a special sentinel `FieldPath` to refer to the ID of a document.
3936
+ * It can be used in queries to sort or filter by the document ID.
3937
+ */
3938
+ function In() {
3939
+ return new kn("__name__");
3940
+ }
3941
+
3942
+ /**
3943
+ * @license
3944
+ * Copyright 2020 Google LLC
3945
+ *
3946
+ * Licensed under the Apache License, Version 2.0 (the "License");
3947
+ * you may not use this file except in compliance with the License.
3948
+ * You may obtain a copy of the License at
3949
+ *
3950
+ * http://www.apache.org/licenses/LICENSE-2.0
3951
+ *
3952
+ * Unless required by applicable law or agreed to in writing, software
3953
+ * distributed under the License is distributed on an "AS IS" BASIS,
3954
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3955
+ * See the License for the specific language governing permissions and
3956
+ * limitations under the License.
3957
+ */
3958
+ /**
3959
+ * Sentinel values that can be used when writing document fields with `set()`
3960
+ * or `update()`.
3961
+ */ var An =
3887
3962
  /**
3888
3963
  * @param _methodName - The public API endpoint that returns this class.
3889
3964
  * @hideconstructor
3890
3965
  */
3891
3966
  function(t) {
3892
3967
  this._methodName = t;
3893
- }, En = /** @class */ function() {
3968
+ }, Vn = /** @class */ function() {
3894
3969
  /**
3895
3970
  * Creates a new immutable `GeoPoint` object with the provided latitude and
3896
3971
  * longitude values.
@@ -3898,8 +3973,8 @@ function(t) {
3898
3973
  * @param longitude - The longitude as number between -180 and 180.
3899
3974
  */
3900
3975
  function t(t, e) {
3901
- if (!isFinite(t) || t < -90 || t > 90) throw new M(V, "Latitude must be a number between -90 and 90, but was: " + t);
3902
- if (!isFinite(e) || e < -180 || e > 180) throw new M(V, "Longitude must be a number between -180 and 180, but was: " + e);
3976
+ if (!isFinite(t) || t < -90 || t > 90) throw new B(D, "Latitude must be a number between -90 and 90, but was: " + t);
3977
+ if (!isFinite(e) || e < -180 || e > 180) throw new B(D, "Longitude must be a number between -180 and 180, but was: " + e);
3903
3978
  this._lat = t, this._long = e;
3904
3979
  }
3905
3980
  return Object.defineProperty(t.prototype, "latitude", {
@@ -3941,29 +4016,29 @@ function(t) {
3941
4016
  * with an underscore.
3942
4017
  */
3943
4018
  t.prototype._compareTo = function(t) {
3944
- return gt(this._lat, t._lat) || gt(this._long, t._long);
4019
+ return bt(this._lat, t._lat) || bt(this._long, t._long);
3945
4020
  }, t;
3946
- }(), kn = /^__.*__$/, Sn = /** @class */ function() {
4021
+ }(), Pn = /^__.*__$/, Dn = /** @class */ function() {
3947
4022
  function t(t, e, n) {
3948
4023
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3949
4024
  }
3950
4025
  return t.prototype.toMutation = function(t, e) {
3951
- return null !== this.fieldMask ? new Pe(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ve(t, this.data, e, this.fieldTransforms);
4026
+ return null !== this.fieldMask ? new Oe(t, this.data, this.fieldMask, e, this.fieldTransforms) : new De(t, this.data, e, this.fieldTransforms);
3952
4027
  }, t;
3953
- }(), In = /** @class */ function() {
4028
+ }(), On = /** @class */ function() {
3954
4029
  function t(t,
3955
4030
  // The fieldMask does not include document transforms.
3956
4031
  e, n) {
3957
4032
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3958
4033
  }
3959
4034
  return t.prototype.toMutation = function(t, e) {
3960
- return new Pe(t, this.data, this.fieldMask, e, this.fieldTransforms);
4035
+ return new Oe(t, this.data, this.fieldMask, e, this.fieldTransforms);
3961
4036
  }, t;
3962
4037
  }();
3963
4038
 
3964
4039
  /**
3965
4040
  * @license
3966
- * Copyright 2020 Google LLC
4041
+ * Copyright 2017 Google LLC
3967
4042
  *
3968
4043
  * Licensed under the Apache License, Version 2.0 (the "License");
3969
4044
  * you may not use this file except in compliance with the License.
@@ -3978,9 +4053,12 @@ function(t) {
3978
4053
  * limitations under the License.
3979
4054
  */
3980
4055
  /**
3981
- * Sentinel values that can be used when writing document fields with `set()`
3982
- * or `update()`.
3983
- */ function An(t) {
4056
+ * An immutable object representing a geographic location in Firestore. The
4057
+ * location is represented as latitude/longitude pair.
4058
+ *
4059
+ * Latitude values are in the range of [-90, 90].
4060
+ * Longitude values are in the range of [-180, 180].
4061
+ */ function Nn(t) {
3984
4062
  switch (t) {
3985
4063
  case 0 /* Set */ :
3986
4064
  // fall through
@@ -3994,11 +4072,11 @@ function(t) {
3994
4072
  return !1;
3995
4073
 
3996
4074
  default:
3997
- throw E();
4075
+ throw k();
3998
4076
  }
3999
4077
  }
4000
4078
 
4001
- /** A "context" object passed around while parsing user data. */ var Vn = /** @class */ function() {
4079
+ /** A "context" object passed around while parsing user data. */ var Fn = /** @class */ function() {
4002
4080
  /**
4003
4081
  * Initializes a ParseContext with the given source and path.
4004
4082
  *
@@ -4058,7 +4136,7 @@ function(t) {
4058
4136
  ut: !0
4059
4137
  });
4060
4138
  }, t.prototype.lt = function(t) {
4061
- return Yn(t, this.settings.methodName, this.settings.ft || !1, this.path, this.settings.dt);
4139
+ return $n(t, this.settings.methodName, this.settings.ft || !1, this.path, this.settings.dt);
4062
4140
  },
4063
4141
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ t.prototype.contains = function(t) {
4064
4142
  return void 0 !== this.fieldMask.find((function(e) {
@@ -4072,19 +4150,19 @@ function(t) {
4072
4150
  if (this.path) for (var t = 0; t < this.path.length; t++) this.ct(this.path.get(t));
4073
4151
  }, t.prototype.ct = function(t) {
4074
4152
  if (0 === t.length) throw this.lt("Document fields must not be empty");
4075
- if (An(this.st) && kn.test(t)) throw this.lt('Document fields cannot begin and end with "__"');
4153
+ if (Nn(this.st) && Pn.test(t)) throw this.lt('Document fields cannot begin and end with "__"');
4076
4154
  }, t;
4077
- }(), Pn = /** @class */ function() {
4155
+ }(), Rn = /** @class */ function() {
4078
4156
  function t(t, e, n) {
4079
- this.databaseId = t, this.ignoreUndefinedProperties = e, this.L = n || Xe(t)
4157
+ this.databaseId = t, this.ignoreUndefinedProperties = e, this.L = n || $e(t)
4080
4158
  /** Creates a new top-level parse context. */;
4081
4159
  }
4082
4160
  return t.prototype.wt = function(t, e, n, r) {
4083
- return void 0 === r && (r = !1), new Vn({
4161
+ return void 0 === r && (r = !1), new Fn({
4084
4162
  st: t,
4085
4163
  methodName: e,
4086
4164
  dt: n,
4087
- path: et.emptyPath(),
4165
+ path: rt.emptyPath(),
4088
4166
  ut: !1,
4089
4167
  ft: r
4090
4168
  }, this.databaseId, this.L, this.ignoreUndefinedProperties);
@@ -4094,30 +4172,30 @@ function(t) {
4094
4172
  /**
4095
4173
  * Helper for parsing raw user input (provided via the API) into internal model
4096
4174
  * classes.
4097
- */ function Dn(t) {
4098
- var e = t._freezeSettings(), n = Xe(t._databaseId);
4099
- return new Pn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4175
+ */ function qn(t) {
4176
+ var e = t._freezeSettings(), n = $e(t._databaseId);
4177
+ return new Rn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4100
4178
  }
4101
4179
 
4102
- /** Parse document data from a set() call. */ function Nn(t, e, n, r, i, o) {
4180
+ /** Parse document data from a set() call. */ function Ln(t, e, n, r, i, o) {
4103
4181
  void 0 === o && (o = {});
4104
4182
  var a = t.wt(o.merge || o.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
4105
- Gn("Data must be an object, but it was:", a, r);
4106
- var s, u, c = Bn(r, a);
4107
- if (o.merge) s = new Pt(a.fieldMask), u = a.fieldTransforms; else if (o.mergeFields) {
4183
+ Hn("Data must be an object, but it was:", a, r);
4184
+ var u, s, c = Wn(r, a);
4185
+ if (o.merge) u = new Ot(a.fieldMask), s = a.fieldTransforms; else if (o.mergeFields) {
4108
4186
  for (var l = [], f = 0, h = o.mergeFields; f < h.length; f++) {
4109
- var p = Kn(e, h[f], n);
4110
- if (!a.contains(p)) throw new M(V, "Field '" + p + "' is specified in your field mask but missing from your input data.");
4111
- Hn(l, p) || l.push(p);
4187
+ var p = Xn(e, h[f], n);
4188
+ if (!a.contains(p)) throw new B(D, "Field '" + p + "' is specified in your field mask but missing from your input data.");
4189
+ tr(l, p) || l.push(p);
4112
4190
  }
4113
- s = new Pt(l), u = a.fieldTransforms.filter((function(t) {
4114
- return s.covers(t.field);
4191
+ u = new Ot(l), s = a.fieldTransforms.filter((function(t) {
4192
+ return u.covers(t.field);
4115
4193
  }));
4116
- } else s = null, u = a.fieldTransforms;
4117
- return new Sn(new Xt(c), s, u);
4194
+ } else u = null, s = a.fieldTransforms;
4195
+ return new Dn(new Zt(c), u, s);
4118
4196
  }
4119
4197
 
4120
- var On = /** @class */ function(e) {
4198
+ var xn = /** @class */ function(e) {
4121
4199
  function n() {
4122
4200
  return null !== e && e.apply(this, arguments) || this;
4123
4201
  }
@@ -4129,7 +4207,7 @@ var On = /** @class */ function(e) {
4129
4207
  }, n.prototype.isEqual = function(t) {
4130
4208
  return t instanceof n;
4131
4209
  }, n;
4132
- }(Tn);
4210
+ }(An);
4133
4211
 
4134
4212
  /**
4135
4213
  * Creates a child context for parsing SerializableFieldValues.
@@ -4146,8 +4224,8 @@ var On = /** @class */ function(e) {
4146
4224
  * context.
4147
4225
  * @param context - The parent context.
4148
4226
  * @param arrayElement - Whether or not the FieldValue has an array.
4149
- */ function Fn(t, e, n) {
4150
- return new Vn({
4227
+ */ function Cn(t, e, n) {
4228
+ return new Fn({
4151
4229
  st: 3 /* Argument */ ,
4152
4230
  dt: e.settings.dt,
4153
4231
  methodName: t._methodName,
@@ -4155,101 +4233,101 @@ var On = /** @class */ function(e) {
4155
4233
  }, e.databaseId, e.L, e.ignoreUndefinedProperties);
4156
4234
  }
4157
4235
 
4158
- var Rn = /** @class */ function(e) {
4236
+ var jn = /** @class */ function(e) {
4159
4237
  function n() {
4160
4238
  return null !== e && e.apply(this, arguments) || this;
4161
4239
  }
4162
4240
  return t(n, e), n.prototype._toFieldTransform = function(t) {
4163
- return new Se(t.path, new _e);
4241
+ return new Ae(t.path, new Ee);
4164
4242
  }, n.prototype.isEqual = function(t) {
4165
4243
  return t instanceof n;
4166
4244
  }, n;
4167
- }(Tn), qn = /** @class */ function(e) {
4245
+ }(An), Mn = /** @class */ function(e) {
4168
4246
  function n(t, n) {
4169
4247
  var r = this;
4170
4248
  return (r = e.call(this, t) || this).yt = n, r;
4171
4249
  }
4172
4250
  return t(n, e), n.prototype._toFieldTransform = function(t) {
4173
- var e = Fn(this, t,
4251
+ var e = Cn(this, t,
4174
4252
  /*array=*/ !0), n = this.yt.map((function(t) {
4175
- return Un(t, e);
4176
- })), r = new Te(n);
4177
- return new Se(t.path, r);
4253
+ return Qn(t, e);
4254
+ })), r = new Se(n);
4255
+ return new Ae(t.path, r);
4178
4256
  }, n.prototype.isEqual = function(t) {
4179
4257
  // TODO(mrschmidt): Implement isEquals
4180
4258
  return this === t;
4181
4259
  }, n;
4182
- }(Tn), Ln = /** @class */ function(e) {
4260
+ }(An), Un = /** @class */ function(e) {
4183
4261
  function n(t, n) {
4184
4262
  var r = this;
4185
4263
  return (r = e.call(this, t) || this).yt = n, r;
4186
4264
  }
4187
4265
  return t(n, e), n.prototype._toFieldTransform = function(t) {
4188
- var e = Fn(this, t,
4266
+ var e = Cn(this, t,
4189
4267
  /*array=*/ !0), n = this.yt.map((function(t) {
4190
- return Un(t, e);
4191
- })), r = new Ee(n);
4192
- return new Se(t.path, r);
4268
+ return Qn(t, e);
4269
+ })), r = new ke(n);
4270
+ return new Ae(t.path, r);
4193
4271
  }, n.prototype.isEqual = function(t) {
4194
4272
  // TODO(mrschmidt): Implement isEquals
4195
4273
  return this === t;
4196
4274
  }, n;
4197
- }(Tn), xn = /** @class */ function(e) {
4275
+ }(An), Bn = /** @class */ function(e) {
4198
4276
  function n(t, n) {
4199
4277
  var r = this;
4200
4278
  return (r = e.call(this, t) || this)._t = n, r;
4201
4279
  }
4202
4280
  return t(n, e), n.prototype._toFieldTransform = function(t) {
4203
- var e = new ke(t.L, we(t.L, this._t));
4204
- return new Se(t.path, e);
4281
+ var e = new Ie(t.L, _e(t.L, this._t));
4282
+ return new Ae(t.path, e);
4205
4283
  }, n.prototype.isEqual = function(t) {
4206
4284
  // TODO(mrschmidt): Implement isEquals
4207
4285
  return this === t;
4208
4286
  }, n;
4209
- }(Tn);
4287
+ }(An);
4210
4288
 
4211
- /** Parse update data from an update() call. */ function Cn(t, e, n, r) {
4289
+ /** Parse update data from an update() call. */ function zn(t, e, n, r) {
4212
4290
  var i = t.wt(1 /* Update */ , e, n);
4213
- Gn("Data must be an object, but it was:", i, r);
4214
- var o = [], a = Xt.empty();
4215
- Et(r, (function(t, r) {
4216
- var s = Wn(e, t, n);
4291
+ Hn("Data must be an object, but it was:", i, r);
4292
+ var o = [], a = Zt.empty();
4293
+ kt(r, (function(t, r) {
4294
+ var u = Zn(e, t, n);
4217
4295
  // For Compat types, we have to "extract" the underlying types before
4218
4296
  // performing validation.
4219
4297
  r = p(r);
4220
- var u = i.at(s);
4221
- if (r instanceof On)
4298
+ var s = i.at(u);
4299
+ if (r instanceof xn)
4222
4300
  // Add it to the field mask, but don't add anything to updateData.
4223
- o.push(s); else {
4224
- var c = Un(r, u);
4225
- null != c && (o.push(s), a.set(s, c));
4301
+ o.push(u); else {
4302
+ var c = Qn(r, s);
4303
+ null != c && (o.push(u), a.set(u, c));
4226
4304
  }
4227
4305
  }));
4228
- var s = new Pt(o);
4229
- return new In(a, s, i.fieldTransforms);
4306
+ var u = new Ot(o);
4307
+ return new On(a, u, i.fieldTransforms);
4230
4308
  }
4231
4309
 
4232
- /** Parse update data from a list of field/value arguments. */ function jn(t, e, n, r, i, o) {
4233
- var a = t.wt(1 /* Update */ , e, n), s = [ Kn(e, r, n) ], u = [ i ];
4234
- if (o.length % 2 != 0) throw new M(V, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
4235
- for (var c = 0; c < o.length; c += 2) s.push(Kn(e, o[c])), u.push(o[c + 1]);
4310
+ /** Parse update data from a list of field/value arguments. */ function Gn(t, e, n, r, i, o) {
4311
+ var a = t.wt(1 /* Update */ , e, n), u = [ Xn(e, r, n) ], s = [ i ];
4312
+ if (o.length % 2 != 0) throw new B(D, "Function " + e + "() needs to be called with an even number of arguments that alternate between field names and values.");
4313
+ for (var c = 0; c < o.length; c += 2) u.push(Xn(e, o[c])), s.push(o[c + 1]);
4236
4314
  // We iterate in reverse order to pick the last value for a field if the
4237
4315
  // user specified the field multiple times.
4238
- for (var l = [], f = Xt.empty(), h = s.length - 1; h >= 0; --h) if (!Hn(l, s[h])) {
4239
- var d = s[h], y = u[h];
4316
+ for (var l = [], f = Zt.empty(), h = u.length - 1; h >= 0; --h) if (!tr(l, u[h])) {
4317
+ var d = u[h], y = s[h];
4240
4318
  // For Compat types, we have to "extract" the underlying types before
4241
4319
  // performing validation.
4242
4320
  y = p(y);
4243
4321
  var m = a.at(d);
4244
- if (y instanceof On)
4322
+ if (y instanceof xn)
4245
4323
  // Add it to the field mask, but don't add anything to updateData.
4246
4324
  l.push(d); else {
4247
- var v = Un(y, m);
4325
+ var v = Qn(y, m);
4248
4326
  null != v && (l.push(d), f.set(d, v));
4249
4327
  }
4250
4328
  }
4251
- var g = new Pt(l);
4252
- return new In(f, g, a.fieldTransforms);
4329
+ var g = new Ot(l);
4330
+ return new On(f, g, a.fieldTransforms);
4253
4331
  }
4254
4332
 
4255
4333
  /**
@@ -4258,8 +4336,8 @@ var Rn = /** @class */ function(e) {
4258
4336
  *
4259
4337
  * @param allowArrays - Whether the query value is an array that may directly
4260
4338
  * contain additional arrays (e.g. the operand of an `in` query).
4261
- */ function Mn(t, e, n, r) {
4262
- return void 0 === r && (r = !1), Un(n, t.wt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4339
+ */ function Kn(t, e, n, r) {
4340
+ return void 0 === r && (r = !1), Qn(n, t.wt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4263
4341
  }
4264
4342
 
4265
4343
  /**
@@ -4270,12 +4348,12 @@ var Rn = /** @class */ function(e) {
4270
4348
  * the source of the data being parsed, etc.
4271
4349
  * @returns The parsed value, or null if the value was a FieldValue sentinel
4272
4350
  * that should not be included in the resulting parsed data.
4273
- */ function Un(t, e) {
4274
- if (zn(
4351
+ */ function Qn(t, e) {
4352
+ if (Yn(
4275
4353
  // Unwrap the API type from the Compat SDK. This will return the API type
4276
4354
  // from firestore-exp.
4277
- t = p(t))) return Gn("Unsupported field value:", e, t), Bn(t, e);
4278
- if (t instanceof Tn)
4355
+ t = p(t))) return Hn("Unsupported field value:", e, t), Wn(t, e);
4356
+ if (t instanceof An)
4279
4357
  // FieldValues usually parse into transforms (except deleteField())
4280
4358
  // in which case we do not want to include this field in our parsed data
4281
4359
  // (as doing so will overwrite the field directly prior to the transform
@@ -4287,7 +4365,7 @@ var Rn = /** @class */ function(e) {
4287
4365
  */
4288
4366
  return function(t, e) {
4289
4367
  // Sentinels are only supported with writes, and not within arrays.
4290
- if (!An(e.st)) throw e.lt(t._methodName + "() can only be used with update() and set()");
4368
+ if (!Nn(e.st)) throw e.lt(t._methodName + "() can only be used with update() and set()");
4291
4369
  if (!e.path) throw e.lt(t._methodName + "() is not currently supported inside arrays");
4292
4370
  var n = t._toFieldTransform(e);
4293
4371
  n && e.fieldTransforms.push(n);
@@ -4310,7 +4388,7 @@ var Rn = /** @class */ function(e) {
4310
4388
  if (e.settings.ut && 4 /* ArrayArgument */ !== e.st) throw e.lt("Nested arrays are not supported");
4311
4389
  return function(t, e) {
4312
4390
  for (var n = [], r = 0, i = 0, o = t; i < o.length; i++) {
4313
- var a = Un(o[i], e.ht(r));
4391
+ var a = Qn(o[i], e.ht(r));
4314
4392
  null == a && (
4315
4393
  // Just include nulls in the array for fields being replaced with a
4316
4394
  // sentinel.
@@ -4329,7 +4407,7 @@ var Rn = /** @class */ function(e) {
4329
4407
  if (null === (t = p(t))) return {
4330
4408
  nullValue: "NULL_VALUE"
4331
4409
  };
4332
- if ("number" == typeof t) return we(e.L, t);
4410
+ if ("number" == typeof t) return _e(e.L, t);
4333
4411
  if ("boolean" == typeof t) return {
4334
4412
  booleanValue: t
4335
4413
  };
@@ -4337,41 +4415,41 @@ var Rn = /** @class */ function(e) {
4337
4415
  stringValue: t
4338
4416
  };
4339
4417
  if (t instanceof Date) {
4340
- var n = bt.fromDate(t);
4418
+ var n = Tt.fromDate(t);
4341
4419
  return {
4342
- timestampValue: qe(e.L, n)
4420
+ timestampValue: xe(e.L, n)
4343
4421
  };
4344
4422
  }
4345
- if (t instanceof bt) {
4423
+ if (t instanceof Tt) {
4346
4424
  // Firestore backend truncates precision down to microseconds. To ensure
4347
4425
  // offline mode works the same with regards to truncation, perform the
4348
4426
  // truncation immediately without waiting for the backend to do that.
4349
- var r = new bt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4427
+ var r = new Tt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4350
4428
  return {
4351
- timestampValue: qe(e.L, r)
4429
+ timestampValue: xe(e.L, r)
4352
4430
  };
4353
4431
  }
4354
- if (t instanceof En) return {
4432
+ if (t instanceof Vn) return {
4355
4433
  geoPointValue: {
4356
4434
  latitude: t.latitude,
4357
4435
  longitude: t.longitude
4358
4436
  }
4359
4437
  };
4360
- if (t instanceof _n) return {
4361
- bytesValue: Le(e.L, t._byteString)
4438
+ if (t instanceof Sn) return {
4439
+ bytesValue: Ce(e.L, t._byteString)
4362
4440
  };
4363
- if (t instanceof fn) {
4441
+ if (t instanceof mn) {
4364
4442
  var i = e.databaseId, o = t.firestore._databaseId;
4365
4443
  if (!o.isEqual(i)) throw e.lt("Document reference is for database " + o.projectId + "/" + o.database + " but should be for database " + i.projectId + "/" + i.database);
4366
4444
  return {
4367
- referenceValue: je(t.firestore._databaseId || e.databaseId, t._key.path)
4445
+ referenceValue: Ue(t.firestore._databaseId || e.databaseId, t._key.path)
4368
4446
  };
4369
4447
  }
4370
- throw e.lt("Unsupported field value: " + at(t));
4448
+ throw e.lt("Unsupported field value: " + st(t));
4371
4449
  }(t, e);
4372
4450
  }
4373
4451
 
4374
- function Bn(t, e) {
4452
+ function Wn(t, e) {
4375
4453
  var n = {};
4376
4454
  return function(t) {
4377
4455
  for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
@@ -4379,8 +4457,8 @@ function Bn(t, e) {
4379
4457
  }(t) ?
4380
4458
  // If we encounter an empty object, we explicitly add it to the update
4381
4459
  // mask to ensure that the server creates a map entry.
4382
- e.path && e.path.length > 0 && e.fieldMask.push(e.path) : Et(t, (function(t, r) {
4383
- var i = Un(r, e.ot(t));
4460
+ e.path && e.path.length > 0 && e.fieldMask.push(e.path) : kt(t, (function(t, r) {
4461
+ var i = Qn(r, e.ot(t));
4384
4462
  null != i && (n[t] = i);
4385
4463
  })), {
4386
4464
  mapValue: {
@@ -4389,35 +4467,35 @@ function Bn(t, e) {
4389
4467
  };
4390
4468
  }
4391
4469
 
4392
- function zn(t) {
4393
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof En || t instanceof _n || t instanceof fn || t instanceof Tn);
4470
+ function Yn(t) {
4471
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof Tt || t instanceof Vn || t instanceof Sn || t instanceof mn || t instanceof An);
4394
4472
  }
4395
4473
 
4396
- function Gn(t, e, n) {
4397
- if (!zn(n) || !function(t) {
4474
+ function Hn(t, e, n) {
4475
+ if (!Yn(n) || !function(t) {
4398
4476
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
4399
4477
  }(n)) {
4400
- var r = at(n);
4478
+ var r = st(n);
4401
4479
  throw "an object" === r ? e.lt(t + " a custom object") : e.lt(t + " " + r);
4402
4480
  }
4403
4481
  }
4404
4482
 
4405
4483
  /**
4406
4484
  * Helper that calls fromDotSeparatedString() but wraps any error thrown.
4407
- */ function Kn(t, e, n) {
4485
+ */ function Xn(t, e, n) {
4408
4486
  if (
4409
4487
  // If required, replace the FieldPath Compat class with with the firestore-exp
4410
4488
  // FieldPath.
4411
- (e = p(e)) instanceof wn) return e._internalPath;
4412
- if ("string" == typeof e) return Wn(t, e);
4413
- throw Yn("Field path arguments must be of type string or ", t,
4489
+ (e = p(e)) instanceof kn) return e._internalPath;
4490
+ if ("string" == typeof e) return Zn(t, e);
4491
+ throw $n("Field path arguments must be of type string or ", t,
4414
4492
  /* hasConverter= */ !1,
4415
4493
  /* path= */ void 0, n);
4416
4494
  }
4417
4495
 
4418
4496
  /**
4419
4497
  * Matches any characters in a field path string that are reserved.
4420
- */ var Qn = new RegExp("[~\\*/\\[\\]]");
4498
+ */ var Jn = new RegExp("[~\\*/\\[\\]]");
4421
4499
 
4422
4500
  /**
4423
4501
  * Wraps fromDotSeparatedString with an error message about the method that
@@ -4427,29 +4505,29 @@ function Gn(t, e, n) {
4427
4505
  * split on dots.
4428
4506
  * @param targetDoc - The document against which the field path will be
4429
4507
  * evaluated.
4430
- */ function Wn(t, e, n) {
4431
- if (e.search(Qn) >= 0) throw Yn("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
4508
+ */ function Zn(t, e, n) {
4509
+ if (e.search(Jn) >= 0) throw $n("Invalid field path (" + e + "). Paths must not contain '~', '*', '/', '[', or ']'", t,
4432
4510
  /* hasConverter= */ !1,
4433
4511
  /* path= */ void 0, n);
4434
4512
  try {
4435
- return (new (wn.bind.apply(wn, r([ void 0 ], e.split(".")))))._internalPath;
4513
+ return (new (kn.bind.apply(kn, r([ void 0 ], e.split(".")))))._internalPath;
4436
4514
  } catch (r) {
4437
- throw Yn("Invalid field path (" + e + "). Paths must not be empty, begin with '.', end with '.', or contain '..'", t,
4515
+ throw $n("Invalid field path (" + e + "). Paths must not be empty, begin with '.', end with '.', or contain '..'", t,
4438
4516
  /* hasConverter= */ !1,
4439
4517
  /* path= */ void 0, n);
4440
4518
  }
4441
4519
  }
4442
4520
 
4443
- function Yn(t, e, n, r, i) {
4444
- var o = r && !r.isEmpty(), a = void 0 !== i, s = "Function " + e + "() called with invalid data";
4445
- n && (s += " (via `toFirestore()`)");
4446
- var u = "";
4447
- return (o || a) && (u += " (found", o && (u += " in field " + r), a && (u += " in document " + i),
4448
- u += ")"), new M(V, (s += ". ") + t + u)
4521
+ function $n(t, e, n, r, i) {
4522
+ var o = r && !r.isEmpty(), a = void 0 !== i, u = "Function " + e + "() called with invalid data";
4523
+ n && (u += " (via `toFirestore()`)");
4524
+ var s = "";
4525
+ return (o || a) && (s += " (found", o && (s += " in field " + r), a && (s += " in document " + i),
4526
+ s += ")"), new B(D, (u += ". ") + t + s)
4449
4527
  /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */;
4450
4528
  }
4451
4529
 
4452
- function Hn(t, e) {
4530
+ function tr(t, e) {
4453
4531
  return t.some((function(t) {
4454
4532
  return t.isEqual(e);
4455
4533
  }));
@@ -4479,7 +4557,7 @@ function Hn(t, e) {
4479
4557
  * For a `DocumentSnapshot` that points to a non-existing document, any data
4480
4558
  * access will return 'undefined'. You can use the `exists()` method to
4481
4559
  * explicitly verify a document's existence.
4482
- */ var Xn = /** @class */ function() {
4560
+ */ var er = /** @class */ function() {
4483
4561
  // Note: This class is stripped down version of the DocumentSnapshot in
4484
4562
  // the legacy SDK. The changes are:
4485
4563
  // - No support for SnapshotMetadata.
@@ -4500,7 +4578,7 @@ function Hn(t, e) {
4500
4578
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
4501
4579
  */
4502
4580
  get: function() {
4503
- return new fn(this._firestore, this._converter, this._key);
4581
+ return new mn(this._firestore, this._converter, this._key);
4504
4582
  },
4505
4583
  enumerable: !1,
4506
4584
  configurable: !0
@@ -4525,7 +4603,7 @@ function Hn(t, e) {
4525
4603
  if (this._converter) {
4526
4604
  // We only want to use the converter and create a new DocumentSnapshot
4527
4605
  // if a converter has been provided.
4528
- var t = new Jn(this._firestore, this._userDataWriter, this._key, this._document,
4606
+ var t = new nr(this._firestore, this._userDataWriter, this._key, this._document,
4529
4607
  /* converter= */ null);
4530
4608
  return this._converter.fromFirestore(t);
4531
4609
  }
@@ -4545,11 +4623,11 @@ function Hn(t, e) {
4545
4623
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4546
4624
  t.prototype.get = function(t) {
4547
4625
  if (this._document) {
4548
- var e = this._document.data.field(tr("DocumentSnapshot.get", t));
4626
+ var e = this._document.data.field(or("DocumentSnapshot.get", t));
4549
4627
  if (null !== e) return this._userDataWriter.convertValue(e);
4550
4628
  }
4551
4629
  }, t;
4552
- }(), Jn = /** @class */ function(e) {
4630
+ }(), nr = /** @class */ function(e) {
4553
4631
  function n() {
4554
4632
  return null !== e && e.apply(this, arguments) || this;
4555
4633
  }
@@ -4561,7 +4639,7 @@ function Hn(t, e) {
4561
4639
  */ return t(n, e), n.prototype.data = function() {
4562
4640
  return e.prototype.data.call(this);
4563
4641
  }, n;
4564
- }(Xn), Zn = /** @class */ function() {
4642
+ }(er), rr = /** @class */ function() {
4565
4643
  /** @hideconstructor */
4566
4644
  function t(t, e) {
4567
4645
  this._docs = e, this.query = t;
@@ -4615,15 +4693,15 @@ function Hn(t, e) {
4615
4693
  * @param right - A snapshot to compare.
4616
4694
  * @returns true if the snapshots are equal.
4617
4695
  */
4618
- function $n(t, e) {
4619
- return t = p(t), e = p(e), t instanceof Xn && e instanceof Xn ? 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 && gn(t.query, e.query) && wt(t.docs, e.docs, $n)
4696
+ function ir(t, e) {
4697
+ return t = p(t), e = p(e), t instanceof er && e instanceof er ? 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 rr && e instanceof rr && En(t.query, e.query) && _t(t.docs, e.docs, ir)
4620
4698
  /**
4621
4699
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
4622
4700
  */;
4623
4701
  }
4624
4702
 
4625
- function tr(t, e) {
4626
- return "string" == typeof e ? Wn(t, e) : e instanceof wn ? e._internalPath : e._delegate._internalPath;
4703
+ function or(t, e) {
4704
+ return "string" == typeof e ? Zn(t, e) : e instanceof kn ? e._internalPath : e._delegate._internalPath;
4627
4705
  }
4628
4706
 
4629
4707
  /**
@@ -4649,7 +4727,7 @@ function tr(t, e) {
4649
4727
  * endBefore:1}, {@link (endAt:1)}, {@link limit} or {@link limitToLast} and
4650
4728
  * can then be passed to {@link query} to create a new query instance that
4651
4729
  * also contains this `QueryConstraint`.
4652
- */ var er = function() {};
4730
+ */ var ar = function() {};
4653
4731
 
4654
4732
  /**
4655
4733
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -4659,7 +4737,7 @@ function tr(t, e) {
4659
4737
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4660
4738
  * @throws if any of the provided query constraints cannot be combined with the
4661
4739
  * existing or new constraints.
4662
- */ function nr(t) {
4740
+ */ function ur(t) {
4663
4741
  for (var e = [], n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
4664
4742
  for (var r = 0, i = e; r < i.length; r++) {
4665
4743
  var o = i[r];
@@ -4668,39 +4746,39 @@ function tr(t, e) {
4668
4746
  return t;
4669
4747
  }
4670
4748
 
4671
- var rr = /** @class */ function(e) {
4749
+ var sr = /** @class */ function(e) {
4672
4750
  function n(t, n, r) {
4673
4751
  var i = this;
4674
4752
  return (i = e.call(this) || this).gt = t, i.vt = n, i.bt = r, i.type = "where",
4675
4753
  i;
4676
4754
  }
4677
4755
  return t(n, e), n.prototype._apply = function(t) {
4678
- var e = Dn(t.firestore), n = function(t, e, n, r, i, o, a) {
4679
- var s;
4756
+ var e = qn(t.firestore), n = function(t, e, n, r, i, o, a) {
4757
+ var u;
4680
4758
  if (i.isKeyField()) {
4681
- if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new M(V, "Invalid Query. You can't perform '" + o + "' queries on documentId().");
4759
+ if ("array-contains" /* ARRAY_CONTAINS */ === o || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === o) throw new B(D, "Invalid Query. You can't perform '" + o + "' queries on documentId().");
4682
4760
  if ("in" /* IN */ === o || "not-in" /* NOT_IN */ === o) {
4683
- gr(a, o);
4684
- for (var u = [], c = 0, l = a; c < l.length; c++) {
4761
+ Er(a, o);
4762
+ for (var s = [], c = 0, l = a; c < l.length; c++) {
4685
4763
  var f = l[c];
4686
- u.push(vr(r, t, f));
4764
+ s.push(Tr(r, t, f));
4687
4765
  }
4688
- s = {
4766
+ u = {
4689
4767
  arrayValue: {
4690
- values: u
4768
+ values: s
4691
4769
  }
4692
4770
  };
4693
- } else s = vr(r, t, a);
4694
- } else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || gr(a, o),
4695
- s = Mn(n, "where", a,
4771
+ } else u = Tr(r, t, a);
4772
+ } else "in" /* IN */ !== o && "not-in" /* NOT_IN */ !== o && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== o || Er(a, o),
4773
+ u = Kn(n, "where", a,
4696
4774
  /* allowArrays= */ "in" /* IN */ === o || "not-in" /* NOT_IN */ === o);
4697
- var h = te.create(i, o, s);
4775
+ var h = ne.create(i, o, u);
4698
4776
  return function(t, e) {
4699
4777
  if (e.q()) {
4700
- var n = ye(t);
4701
- if (null !== n && !n.isEqual(e.field)) throw new M(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() + "'");
4702
- var r = de(t);
4703
- null !== r && wr(t, e.field, r);
4778
+ var n = ve(t);
4779
+ if (null !== n && !n.isEqual(e.field)) throw new B(D, "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() + "'");
4780
+ var r = me(t);
4781
+ null !== r && Sr(t, e.field, r);
4704
4782
  }
4705
4783
  var i = function(t, e) {
4706
4784
  for (var n = 0, r = t.filters; n < r.length; n++) {
@@ -4744,15 +4822,15 @@ var rr = /** @class */ function(e) {
4744
4822
  }(e.op));
4745
4823
  if (null !== i)
4746
4824
  // Special case when it's a duplicate op to give a slightly clearer error message.
4747
- throw i === e.op ? new M(V, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new M(V, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
4825
+ throw i === e.op ? new B(D, "Invalid query. You cannot use more than one '" + e.op.toString() + "' filter.") : new B(D, "Invalid query. You cannot use '" + e.op.toString() + "' filters with '" + i.toString() + "' filters.");
4748
4826
  }(t, h), h;
4749
4827
  }(t._query, 0, e, t.firestore._databaseId, this.gt, this.vt, this.bt);
4750
- return new hn(t.firestore, t.converter, function(t, e) {
4828
+ return new vn(t.firestore, t.converter, function(t, e) {
4751
4829
  var n = t.filters.concat([ e ]);
4752
- return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4830
+ return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4753
4831
  }(t._query, n));
4754
4832
  }, n;
4755
- }(er);
4833
+ }(ar);
4756
4834
 
4757
4835
  /**
4758
4836
  * Creates a {@link QueryConstraint} that enforces that documents must contain the
@@ -4764,36 +4842,36 @@ var rr = /** @class */ function(e) {
4764
4842
  * "&lt;=", "!=").
4765
4843
  * @param value - The value for comparison
4766
4844
  * @returns The created {@link Query}.
4767
- */ function ir(t, e, n) {
4768
- var r = e, i = tr("where", t);
4769
- return new rr(i, r, n);
4845
+ */ function cr(t, e, n) {
4846
+ var r = e, i = or("where", t);
4847
+ return new sr(i, r, n);
4770
4848
  }
4771
4849
 
4772
- var or = /** @class */ function(e) {
4850
+ var lr = /** @class */ function(e) {
4773
4851
  function n(t, n) {
4774
4852
  var r = this;
4775
4853
  return (r = e.call(this) || this).gt = t, r.Et = n, r.type = "orderBy", r;
4776
4854
  }
4777
4855
  return t(n, e), n.prototype._apply = function(t) {
4778
4856
  var e = function(t, e, n) {
4779
- if (null !== t.startAt) throw new M(V, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4780
- if (null !== t.endAt) throw new M(V, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4781
- var r = new le(e, n);
4857
+ if (null !== t.startAt) throw new B(D, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4858
+ if (null !== t.endAt) throw new B(D, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4859
+ var r = new he(e, n);
4782
4860
  return function(t, e) {
4783
- if (null === de(t)) {
4861
+ if (null === me(t)) {
4784
4862
  // This is the first order by. It must match any inequality.
4785
- var n = ye(t);
4786
- null !== n && wr(t, n, e.field);
4863
+ var n = ve(t);
4864
+ null !== n && Sr(t, n, e.field);
4787
4865
  }
4788
4866
  }(t, r), r;
4789
4867
  }(t._query, this.gt, this.Et);
4790
- return new hn(t.firestore, t.converter, function(t, e) {
4868
+ return new vn(t.firestore, t.converter, function(t, e) {
4791
4869
  // TODO(dimond): validate that orderBy does not list the same key twice.
4792
4870
  var n = t.explicitOrderBy.concat([ e ]);
4793
- return new pe(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4871
+ return new ye(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4794
4872
  }(t._query, e));
4795
4873
  }, n;
4796
- }(er);
4874
+ }(ar);
4797
4875
 
4798
4876
  /**
4799
4877
  * Creates a {@link QueryConstraint} that sorts the query result by the
@@ -4803,31 +4881,31 @@ var or = /** @class */ function(e) {
4803
4881
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
4804
4882
  * not specified, order will be ascending.
4805
4883
  * @returns The created {@link Query}.
4806
- */ function ar(t, e) {
4884
+ */ function fr(t, e) {
4807
4885
  void 0 === e && (e = "asc");
4808
- var n = e, r = tr("orderBy", t);
4809
- return new or(r, n);
4886
+ var n = e, r = or("orderBy", t);
4887
+ return new lr(r, n);
4810
4888
  }
4811
4889
 
4812
- var sr = /** @class */ function(e) {
4890
+ var hr = /** @class */ function(e) {
4813
4891
  function n(t, n, r) {
4814
4892
  var i = this;
4815
4893
  return (i = e.call(this) || this).type = t, i.It = n, i.Tt = r, i;
4816
4894
  }
4817
4895
  return t(n, e), n.prototype._apply = function(t) {
4818
- return new hn(t.firestore, t.converter, function(t, e, n) {
4819
- return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4896
+ return new vn(t.firestore, t.converter, function(t, e, n) {
4897
+ return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4820
4898
  }(t._query, this.It, this.Tt));
4821
4899
  }, n;
4822
- }(er);
4900
+ }(ar);
4823
4901
 
4824
4902
  /**
4825
4903
  * Creates a {@link QueryConstraint} that only returns the first matching documents.
4826
4904
  *
4827
4905
  * @param limit - The maximum number of items to return.
4828
4906
  * @returns The created {@link Query}.
4829
- */ function ur(t) {
4830
- return ut("limit", t), new sr("limit", t, "F" /* First */)
4907
+ */ function pr(t) {
4908
+ return lt("limit", t), new hr("limit", t, "F" /* First */)
4831
4909
  /**
4832
4910
  * Creates a {@link QueryConstraint} that only returns the last matching documents.
4833
4911
  *
@@ -4839,62 +4917,62 @@ var sr = /** @class */ function(e) {
4839
4917
  */;
4840
4918
  }
4841
4919
 
4842
- function cr(t) {
4843
- return ut("limitToLast", t), new sr("limitToLast", t, "L" /* Last */);
4920
+ function dr(t) {
4921
+ return lt("limitToLast", t), new hr("limitToLast", t, "L" /* Last */);
4844
4922
  }
4845
4923
 
4846
- var lr = /** @class */ function(e) {
4924
+ var yr = /** @class */ function(e) {
4847
4925
  function n(t, n, r) {
4848
4926
  var i = this;
4849
4927
  return (i = e.call(this) || this).type = t, i.At = n, i.Rt = r, i;
4850
4928
  }
4851
4929
  return t(n, e), n.prototype._apply = function(t) {
4852
- var e = mr(t, this.type, this.At, this.Rt);
4853
- return new hn(t.firestore, t.converter, function(t, e) {
4854
- return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4930
+ var e = _r(t, this.type, this.At, this.Rt);
4931
+ return new vn(t.firestore, t.converter, function(t, e) {
4932
+ return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4855
4933
  }(t._query, e));
4856
4934
  }, n;
4857
- }(er);
4935
+ }(ar);
4858
4936
 
4859
- function fr() {
4937
+ function mr() {
4860
4938
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4861
- return new lr("startAt", t,
4939
+ return new yr("startAt", t,
4862
4940
  /*inclusive=*/ !0);
4863
4941
  }
4864
4942
 
4865
- function hr() {
4943
+ function vr() {
4866
4944
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4867
- return new lr("startAfter", t,
4945
+ return new yr("startAfter", t,
4868
4946
  /*inclusive=*/ !1);
4869
4947
  }
4870
4948
 
4871
- var pr = /** @class */ function(e) {
4949
+ var gr = /** @class */ function(e) {
4872
4950
  function n(t, n, r) {
4873
4951
  var i = this;
4874
4952
  return (i = e.call(this) || this).type = t, i.At = n, i.Rt = r, i;
4875
4953
  }
4876
4954
  return t(n, e), n.prototype._apply = function(t) {
4877
- var e = mr(t, this.type, this.At, this.Rt);
4878
- return new hn(t.firestore, t.converter, function(t, e) {
4879
- return new pe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4955
+ var e = _r(t, this.type, this.At, this.Rt);
4956
+ return new vn(t.firestore, t.converter, function(t, e) {
4957
+ return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4880
4958
  }(t._query, e));
4881
4959
  }, n;
4882
- }(er);
4960
+ }(ar);
4883
4961
 
4884
- function dr() {
4962
+ function wr() {
4885
4963
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4886
- return new pr("endBefore", t,
4964
+ return new gr("endBefore", t,
4887
4965
  /*inclusive=*/ !1);
4888
4966
  }
4889
4967
 
4890
- function yr() {
4968
+ function br() {
4891
4969
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
4892
- return new pr("endAt", t, /*inclusive=*/ !0);
4970
+ return new gr("endAt", t, /*inclusive=*/ !0);
4893
4971
  }
4894
4972
 
4895
- /** Helper function to create a bound from a document or fields */ function mr(t, e, n, r) {
4896
- if (n[0] = p(n[0]), n[0] instanceof Xn) return function(t, e, n, r, i) {
4897
- if (!r) throw new M(D, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
4973
+ /** Helper function to create a bound from a document or fields */ function _r(t, e, n, r) {
4974
+ if (n[0] = p(n[0]), n[0] instanceof er) return function(t, e, n, r, i) {
4975
+ if (!r) throw new B(N, "Can't use a DocumentSnapshot that doesn't exist for " + n + "().");
4898
4976
  // Because people expect to continue/end a query at the exact document
4899
4977
  // provided, we need to use the implicit sort order rather than the explicit
4900
4978
  // sort order, because it's guaranteed to contain the document key. That way
@@ -4902,65 +4980,65 @@ function yr() {
4902
4980
  // the provided document. Without the key (by using the explicit sort
4903
4981
  // orders), multiple documents could match the position, yielding duplicate
4904
4982
  // results.
4905
- for (var o = [], a = 0, s = ve(t); a < s.length; a++) {
4906
- var u = s[a];
4907
- if (u.field.isKeyField()) o.push(Gt(e, r.key)); else {
4908
- var c = r.data.field(u.field);
4909
- if (qt(c)) throw new M(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.)');
4983
+ for (var o = [], a = 0, u = we(t); a < u.length; a++) {
4984
+ var s = u[a];
4985
+ if (s.field.isKeyField()) o.push(Qt(e, r.key)); else {
4986
+ var c = r.data.field(s.field);
4987
+ if (xt(c)) throw new B(D, 'Invalid query. You are trying to start or end a query using a document for which the field "' + s.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4910
4988
  if (null === c) {
4911
- var l = u.field.canonicalString();
4912
- throw new M(V, "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.");
4989
+ var l = s.field.canonicalString();
4990
+ throw new B(D, "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.");
4913
4991
  }
4914
4992
  o.push(c);
4915
4993
  }
4916
4994
  }
4917
- return new ce(o, i);
4995
+ return new fe(o, i);
4918
4996
  }(t._query, t.firestore._databaseId, e, n[0]._document, r);
4919
- var i = Dn(t.firestore);
4997
+ var i = qn(t.firestore);
4920
4998
  return function(t, e, n, r, i, o) {
4921
4999
  // Use explicit order by's because it has to match the query the user made
4922
5000
  var a = t.explicitOrderBy;
4923
- if (i.length > a.length) throw new M(V, "Too many arguments provided to " + r + "(). The number of arguments must be less than or equal to the number of orderBy() clauses");
4924
- for (var s = [], u = 0; u < i.length; u++) {
4925
- var c = i[u];
4926
- if (a[u].field.isKeyField()) {
4927
- if ("string" != typeof c) throw new M(V, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
4928
- if (!me(t) && -1 !== c.indexOf("/")) throw new M(V, "Invalid query. When querying a collection and ordering by documentId(), the value passed to " + r + "() must be a plain document ID, but '" + c + "' contains a slash.");
4929
- var l = t.path.child($.fromString(c));
4930
- if (!nt.isDocumentKey(l)) throw new M(V, "Invalid query. When querying a collection group and ordering by 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.");
4931
- var f = new nt(l);
4932
- s.push(Gt(e, f));
5001
+ if (i.length > a.length) throw new B(D, "Too many arguments provided to " + r + "(). The number of arguments must be less than or equal to the number of orderBy() clauses");
5002
+ for (var u = [], s = 0; s < i.length; s++) {
5003
+ var c = i[s];
5004
+ if (a[s].field.isKeyField()) {
5005
+ if ("string" != typeof c) throw new B(D, "Invalid query. Expected a string for document ID in " + r + "(), but got a " + typeof c);
5006
+ if (!ge(t) && -1 !== c.indexOf("/")) throw new B(D, "Invalid query. When querying a collection and ordering by documentId(), the value passed to " + r + "() must be a plain document ID, but '" + c + "' contains a slash.");
5007
+ var l = t.path.child(et.fromString(c));
5008
+ if (!it.isDocumentKey(l)) throw new B(D, "Invalid query. When querying a collection group and ordering by 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.");
5009
+ var f = new it(l);
5010
+ u.push(Qt(e, f));
4933
5011
  } else {
4934
- var h = Mn(n, r, c);
4935
- s.push(h);
5012
+ var h = Kn(n, r, c);
5013
+ u.push(h);
4936
5014
  }
4937
5015
  }
4938
- return new ce(s, o);
5016
+ return new fe(u, o);
4939
5017
  }(t._query, t.firestore._databaseId, i, e, n, r);
4940
5018
  }
4941
5019
 
4942
- function vr(t, e, n) {
5020
+ function Tr(t, e, n) {
4943
5021
  if ("string" == typeof (n = p(n))) {
4944
- if ("" === n) throw new M(V, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4945
- if (!me(e) && -1 !== n.indexOf("/")) throw new M(V, "Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character.");
4946
- var r = e.path.child($.fromString(n));
4947
- if (!nt.isDocumentKey(r)) throw new M(V, "Invalid query. When querying a collection group by 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 + ").");
4948
- return Gt(t, new nt(r));
5022
+ if ("" === n) throw new B(D, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
5023
+ if (!ge(e) && -1 !== n.indexOf("/")) throw new B(D, "Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '" + n + "' contains a '/' character.");
5024
+ var r = e.path.child(et.fromString(n));
5025
+ if (!it.isDocumentKey(r)) throw new B(D, "Invalid query. When querying a collection group by 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 + ").");
5026
+ return Qt(t, new it(r));
4949
5027
  }
4950
- if (n instanceof fn) return Gt(t, n._key);
4951
- throw new M(V, "Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: " + at(n) + ".");
5028
+ if (n instanceof mn) return Qt(t, n._key);
5029
+ throw new B(D, "Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: " + st(n) + ".");
4952
5030
  }
4953
5031
 
4954
5032
  /**
4955
5033
  * Validates that the value passed into a disjunctive filter satisfies all
4956
5034
  * array requirements.
4957
- */ function gr(t, e) {
4958
- if (!Array.isArray(t) || 0 === t.length) throw new M(V, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
4959
- if (t.length > 10) throw new M(V, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array.");
5035
+ */ function Er(t, e) {
5036
+ if (!Array.isArray(t) || 0 === t.length) throw new B(D, "Invalid Query. A non-empty array is required for '" + e.toString() + "' filters.");
5037
+ if (t.length > 10) throw new B(D, "Invalid Query. '" + e.toString() + "' filters support a maximum of 10 elements in the value array.");
4960
5038
  }
4961
5039
 
4962
- function wr(t, e, n) {
4963
- if (!n.isEqual(e)) throw new M(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.");
5040
+ function Sr(t, e, n) {
5041
+ if (!n.isEqual(e)) throw new B(D, "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.");
4964
5042
  }
4965
5043
 
4966
5044
  /**
@@ -5009,28 +5087,28 @@ function wr(t, e, n) {
5009
5087
  * because we want to provide the user with a more specific error message if
5010
5088
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
5011
5089
  * call.
5012
- */ function br(t, e, n) {
5090
+ */ function kr(t, e, n) {
5013
5091
  // Cast to `any` in order to satisfy the union type constraint on
5014
5092
  // toFirestore().
5015
5093
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5016
5094
  return t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e;
5017
5095
  }
5018
5096
 
5019
- var _r = /** @class */ function(e) {
5097
+ var Ir = /** @class */ function(e) {
5020
5098
  function n(t) {
5021
5099
  var n = this;
5022
5100
  return (n = e.call(this) || this).firestore = t, n;
5023
5101
  }
5024
5102
  return t(n, e), n.prototype.convertBytes = function(t) {
5025
- return new _n(t);
5103
+ return new Sn(t);
5026
5104
  }, n.prototype.convertReference = function(t) {
5027
5105
  var e = this.convertDocumentKey(t, this.firestore._databaseId);
5028
- return new fn(this.firestore, /* converter= */ null, e);
5106
+ return new mn(this.firestore, /* converter= */ null, e);
5029
5107
  }, n;
5030
5108
  }(/** @class */ function() {
5031
5109
  function t() {}
5032
5110
  return t.prototype.convertValue = function(t, e) {
5033
- switch (void 0 === e && (e = "none"), jt(t)) {
5111
+ switch (void 0 === e && (e = "none"), Ut(t)) {
5034
5112
  case 0 /* NullValue */ :
5035
5113
  return null;
5036
5114
 
@@ -5038,7 +5116,7 @@ var _r = /** @class */ function(e) {
5038
5116
  return t.booleanValue;
5039
5117
 
5040
5118
  case 2 /* NumberValue */ :
5041
- return Ft(t.integerValue || t.doubleValue);
5119
+ return qt(t.integerValue || t.doubleValue);
5042
5120
 
5043
5121
  case 3 /* TimestampValue */ :
5044
5122
  return this.convertTimestamp(t.timestampValue);
@@ -5050,7 +5128,7 @@ var _r = /** @class */ function(e) {
5050
5128
  return t.stringValue;
5051
5129
 
5052
5130
  case 6 /* BlobValue */ :
5053
- return this.convertBytes(Rt(t.bytesValue));
5131
+ return this.convertBytes(Lt(t.bytesValue));
5054
5132
 
5055
5133
  case 7 /* RefValue */ :
5056
5134
  return this.convertReference(t.referenceValue);
@@ -5065,15 +5143,15 @@ var _r = /** @class */ function(e) {
5065
5143
  return this.convertObject(t.mapValue, e);
5066
5144
 
5067
5145
  default:
5068
- throw E();
5146
+ throw k();
5069
5147
  }
5070
5148
  }, t.prototype.convertObject = function(t, e) {
5071
5149
  var n = this, r = {};
5072
- return Et(t.fields, (function(t, i) {
5150
+ return kt(t.fields, (function(t, i) {
5073
5151
  r[t] = n.convertValue(i, e);
5074
5152
  })), r;
5075
5153
  }, t.prototype.convertGeoPoint = function(t) {
5076
- return new En(Ft(t.latitude), Ft(t.longitude));
5154
+ return new Vn(qt(t.latitude), qt(t.longitude));
5077
5155
  }, t.prototype.convertArray = function(t, e) {
5078
5156
  var n = this;
5079
5157
  return (t.values || []).map((function(t) {
@@ -5082,25 +5160,25 @@ var _r = /** @class */ function(e) {
5082
5160
  }, t.prototype.convertServerTimestamp = function(t, e) {
5083
5161
  switch (e) {
5084
5162
  case "previous":
5085
- var n = Lt(t);
5163
+ var n = Ct(t);
5086
5164
  return null == n ? null : this.convertValue(n, e);
5087
5165
 
5088
5166
  case "estimate":
5089
- return this.convertTimestamp(xt(t));
5167
+ return this.convertTimestamp(jt(t));
5090
5168
 
5091
5169
  default:
5092
5170
  return null;
5093
5171
  }
5094
5172
  }, t.prototype.convertTimestamp = function(t) {
5095
- var e = Ot(t);
5096
- return new bt(e.seconds, e.nanos);
5173
+ var e = Rt(t);
5174
+ return new Tt(e.seconds, e.nanos);
5097
5175
  }, t.prototype.convertDocumentKey = function(t, e) {
5098
- var n = $.fromString(t);
5099
- k(He(n));
5100
- var r = new J(n.get(1), n.get(3)), i = new nt(n.popFirst(5));
5176
+ var n = et.fromString(t);
5177
+ I(Ze(n));
5178
+ var r = new $(n.get(1), n.get(3)), i = new it(n.popFirst(5));
5101
5179
  return r.isEqual(e) ||
5102
5180
  // TODO(b/64130202): Somehow support foreign references.
5103
- b("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."),
5181
+ T("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."),
5104
5182
  i;
5105
5183
  }, t;
5106
5184
  }());
@@ -5117,12 +5195,12 @@ var _r = /** @class */ function(e) {
5117
5195
  * @param reference - The reference of the document to fetch.
5118
5196
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
5119
5197
  * document contents.
5120
- */ function Tr(t) {
5121
- var e = rn((t = st(t, fn)).firestore), n = new _r(t.firestore);
5122
- return tn(e, [ t._key ]).then((function(e) {
5123
- k(1 === e.length);
5198
+ */ function Ar(t) {
5199
+ var e = an((t = ct(t, mn)).firestore), n = new Ir(t.firestore);
5200
+ return rn(e, [ t._key ]).then((function(e) {
5201
+ I(1 === e.length);
5124
5202
  var r = e[0];
5125
- return new Xn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5203
+ return new er(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5126
5204
  }));
5127
5205
  }
5128
5206
 
@@ -5137,35 +5215,61 @@ var _r = /** @class */ function(e) {
5137
5215
  *
5138
5216
  * @param query - The `Query` to execute.
5139
5217
  * @returns A Promise that will be resolved with the results of the query.
5140
- */ function Er(t) {
5218
+ */ function Vr(t) {
5141
5219
  !function(t) {
5142
- if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new M(x, "limitToLast() queries require specifying at least one orderBy() clause");
5143
- }((t = st(t, hn))._query);
5144
- var e = rn(t.firestore), n = new _r(t.firestore);
5145
- return en(e, t._query).then((function(e) {
5146
- var r = e.map((function(e) {
5147
- return new Jn(t.firestore, n, e.key, e, t.converter);
5220
+ if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new B(j, "limitToLast() queries require specifying at least one orderBy() clause");
5221
+ }((t = ct(t, vn))._query);
5222
+ var r = an(t.firestore), i = new Ir(t.firestore);
5223
+ return function(t, r) {
5224
+ return e(this, void 0, void 0, (function() {
5225
+ var e, i;
5226
+ return n(this, (function(n) {
5227
+ switch (n.label) {
5228
+ case 0:
5229
+ return e = A(t), i = We(e.L, be(r)), [ 4 /*yield*/ , e.P("RunQuery", i.parent, {
5230
+ structuredQuery: i.structuredQuery
5231
+ }) ];
5232
+
5233
+ case 1:
5234
+ return [ 2 /*return*/ , n.sent().filter((function(t) {
5235
+ return !!t.document;
5236
+ })).map((function(t) {
5237
+ return function(t, e, n) {
5238
+ var r = ze(t, e.name), i = Me(e.updateTime), o = new Zt({
5239
+ mapValue: {
5240
+ fields: e.fields
5241
+ }
5242
+ });
5243
+ return $t.newFoundDocument(r, i, o);
5244
+ }(e.L, t.document);
5245
+ })) ];
5246
+ }
5247
+ }));
5248
+ }));
5249
+ }(r, t._query).then((function(e) {
5250
+ var n = e.map((function(e) {
5251
+ return new nr(t.firestore, i, e.key, e, t.converter);
5148
5252
  }));
5149
5253
  return "L" /* Last */ === t._query.limitType &&
5150
5254
  // Limit to last queries reverse the orderBy constraint that was
5151
5255
  // specified by the user. As such, we need to reverse the order of the
5152
5256
  // results to return the documents in the expected order.
5153
- r.reverse(), new Zn(t, r);
5257
+ n.reverse(), new rr(t, n);
5154
5258
  }));
5155
5259
  }
5156
5260
 
5157
- function kr(t, e, n) {
5158
- var r = br((t = st(t, fn)).converter, e, n), i = Nn(Dn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5159
- return $e(rn(t.firestore), [ i.toMutation(t._key, Ie.none()) ]);
5261
+ function Pr(t, e, n) {
5262
+ var r = kr((t = ct(t, mn)).converter, e, n), i = Ln(qn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5263
+ return nn(an(t.firestore), [ i.toMutation(t._key, Ve.none()) ]);
5160
5264
  }
5161
5265
 
5162
- function Sr(t, e, n) {
5266
+ function Dr(t, e, n) {
5163
5267
  for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
5164
- var o, a = Dn((t = st(t, fn)).firestore);
5268
+ var o, a = qn((t = ct(t, mn)).firestore);
5165
5269
  // For Compat types, we have to "extract" the underlying types before
5166
5270
  // performing validation.
5167
- return o = "string" == typeof (e = p(e)) || e instanceof wn ? jn(a, "updateDoc", t._key, e, n, r) : Cn(a, "updateDoc", t._key, e),
5168
- $e(rn(t.firestore), [ o.toMutation(t._key, Ie.exists(!0)) ]);
5271
+ return o = "string" == typeof (e = p(e)) || e instanceof kn ? Gn(a, "updateDoc", t._key, e, n, r) : zn(a, "updateDoc", t._key, e),
5272
+ nn(an(t.firestore), [ o.toMutation(t._key, Ve.exists(!0)) ]);
5169
5273
  }
5170
5274
 
5171
5275
  /**
@@ -5179,8 +5283,8 @@ function Sr(t, e, n) {
5179
5283
  * @param reference - A reference to the document to delete.
5180
5284
  * @returns A `Promise` resolved once the document has been successfully
5181
5285
  * deleted from the backend.
5182
- */ function Ir(t) {
5183
- return $e(rn((t = st(t, fn)).firestore), [ new De(t._key, Ie.none()) ]);
5286
+ */ function Or(t) {
5287
+ return nn(an((t = ct(t, mn)).firestore), [ new Ne(t._key, Ve.none()) ]);
5184
5288
  }
5185
5289
 
5186
5290
  /**
@@ -5197,13 +5301,62 @@ function Sr(t, e, n) {
5197
5301
  * @throws Error - If the provided input is not a valid Firestore document.
5198
5302
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
5199
5303
  * newly created document after it has been written to the backend.
5200
- */ function Ar(t, e) {
5201
- var n = mn(t = st(t, pn)), r = br(t.converter, e), i = Nn(Dn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5202
- return $e(rn(t.firestore), [ i.toMutation(n._key, Ie.exists(!1)) ]).then((function() {
5304
+ */ function Nr(t, e) {
5305
+ var n = _n(t = ct(t, gn)), r = kr(t.converter, e), i = Ln(qn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5306
+ return nn(an(t.firestore), [ i.toMutation(n._key, Ve.exists(!1)) ]).then((function() {
5203
5307
  return n;
5204
5308
  }));
5205
5309
  }
5206
5310
 
5311
+ /**
5312
+ * @license
5313
+ * Copyright 2022 Google LLC
5314
+ *
5315
+ * Licensed under the Apache License, Version 2.0 (the "License");
5316
+ * you may not use this file except in compliance with the License.
5317
+ * You may obtain a copy of the License at
5318
+ *
5319
+ * http://www.apache.org/licenses/LICENSE-2.0
5320
+ *
5321
+ * Unless required by applicable law or agreed to in writing, software
5322
+ * distributed under the License is distributed on an "AS IS" BASIS,
5323
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5324
+ * See the License for the specific language governing permissions and
5325
+ * limitations under the License.
5326
+ */
5327
+ /**
5328
+ * Calculates the number of documents in the result set of the given query,
5329
+ * without actually downloading the documents.
5330
+ *
5331
+ * Using this function to count the documents is efficient because only the
5332
+ * final count, not the documents' data, is downloaded. This function can even
5333
+ * count the documents if the result set would be prohibitively large to
5334
+ * download entirely (e.g. thousands of documents).
5335
+ *
5336
+ * @param query - The query whose result set size to calculate.
5337
+ * @returns A Promise that will be resolved with the count; the count can be
5338
+ * retrieved from `snapshot.data().count`, where `snapshot` is the
5339
+ * `AggregateQuerySnapshot` to which the returned Promise resolves.
5340
+ */ function Fr(t) {
5341
+ var e = ct(t.firestore, sn), n = an(e), r = new Ir(e);
5342
+ return new yn(t, n, r).run();
5343
+ }
5344
+
5345
+ /**
5346
+ * Compares two `AggregateQuerySnapshot` instances for equality.
5347
+ *
5348
+ * Two `AggregateQuerySnapshot` instances are considered "equal" if they have
5349
+ * underlying queries that compare equal, and the same data.
5350
+ *
5351
+ * @param left - The first `AggregateQuerySnapshot` to compare.
5352
+ * @param right - The second `AggregateQuerySnapshot` to compare.
5353
+ *
5354
+ * @returns `true` if the objects are "equal", as defined above, or `false`
5355
+ * otherwise.
5356
+ */ function Rr(t, e) {
5357
+ return En(t.query, e.query) && m(t.data(), e.data());
5358
+ }
5359
+
5207
5360
  /**
5208
5361
  * @license
5209
5362
  * Copyright 2020 Google LLC
@@ -5223,15 +5376,15 @@ function Sr(t, e, n) {
5223
5376
  /**
5224
5377
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
5225
5378
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
5226
- */ function Vr() {
5227
- return new On("deleteField");
5379
+ */ function qr() {
5380
+ return new xn("deleteField");
5228
5381
  }
5229
5382
 
5230
5383
  /**
5231
5384
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
5232
5385
  * include a server-generated timestamp in the written data.
5233
- */ function Pr() {
5234
- return new Rn("serverTimestamp");
5386
+ */ function Lr() {
5387
+ return new jn("serverTimestamp");
5235
5388
  }
5236
5389
 
5237
5390
  /**
@@ -5245,11 +5398,11 @@ function Sr(t, e, n) {
5245
5398
  * @param elements - The elements to union into the array.
5246
5399
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5247
5400
  * `updateDoc()`.
5248
- */ function Dr() {
5401
+ */ function xr() {
5249
5402
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
5250
5403
  // NOTE: We don't actually parse the data until it's used in set() or
5251
5404
  // update() since we'd need the Firestore instance to do this.
5252
- return new qn("arrayUnion", t);
5405
+ return new Mn("arrayUnion", t);
5253
5406
  }
5254
5407
 
5255
5408
  /**
@@ -5262,11 +5415,11 @@ function Sr(t, e, n) {
5262
5415
  * @param elements - The elements to remove from the array.
5263
5416
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5264
5417
  * `updateDoc()`
5265
- */ function Nr() {
5418
+ */ function Cr() {
5266
5419
  for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
5267
5420
  // NOTE: We don't actually parse the data until it's used in set() or
5268
5421
  // update() since we'd need the Firestore instance to do this.
5269
- return new Ln("arrayRemove", t);
5422
+ return new Un("arrayRemove", t);
5270
5423
  }
5271
5424
 
5272
5425
  /**
@@ -5287,8 +5440,8 @@ function Sr(t, e, n) {
5287
5440
  * @param n - The value to increment by.
5288
5441
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5289
5442
  * `updateDoc()`
5290
- */ function Or(t) {
5291
- return new xn("increment", t);
5443
+ */ function jr(t) {
5444
+ return new Bn("increment", t);
5292
5445
  }
5293
5446
 
5294
5447
  /**
@@ -5314,24 +5467,24 @@ function Sr(t, e, n) {
5314
5467
  * provides methods for adding writes to the write batch. None of the writes
5315
5468
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
5316
5469
  * called.
5317
- */ var Fr = /** @class */ function() {
5470
+ */ var Mr = /** @class */ function() {
5318
5471
  /** @hideconstructor */
5319
5472
  function t(t, e) {
5320
5473
  this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
5321
- this._dataReader = Dn(t);
5474
+ this._dataReader = qn(t);
5322
5475
  }
5323
5476
  return t.prototype.set = function(t, e, n) {
5324
5477
  this._verifyNotCommitted();
5325
- var r = Rr(t, this._firestore), i = br(r.converter, e, n), o = Nn(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
5326
- return this._mutations.push(o.toMutation(r._key, Ie.none())), this;
5478
+ var r = Ur(t, this._firestore), i = kr(r.converter, e, n), o = Ln(this._dataReader, "WriteBatch.set", r._key, i, null !== r.converter, n);
5479
+ return this._mutations.push(o.toMutation(r._key, Ve.none())), this;
5327
5480
  }, t.prototype.update = function(t, e, n) {
5328
5481
  for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
5329
5482
  this._verifyNotCommitted();
5330
- var o, a = Rr(t, this._firestore);
5483
+ var o, a = Ur(t, this._firestore);
5331
5484
  // For Compat types, we have to "extract" the underlying types before
5332
5485
  // performing validation.
5333
- return o = "string" == typeof (e = p(e)) || e instanceof wn ? jn(this._dataReader, "WriteBatch.update", a._key, e, n, r) : Cn(this._dataReader, "WriteBatch.update", a._key, e),
5334
- this._mutations.push(o.toMutation(a._key, Ie.exists(!0))), this;
5486
+ return o = "string" == typeof (e = p(e)) || e instanceof kn ? Gn(this._dataReader, "WriteBatch.update", a._key, e, n, r) : zn(this._dataReader, "WriteBatch.update", a._key, e),
5487
+ this._mutations.push(o.toMutation(a._key, Ve.exists(!0))), this;
5335
5488
  },
5336
5489
  /**
5337
5490
  * Deletes the document referred to by the provided {@link DocumentReference}.
@@ -5341,8 +5494,8 @@ function Sr(t, e, n) {
5341
5494
  */
5342
5495
  t.prototype.delete = function(t) {
5343
5496
  this._verifyNotCommitted();
5344
- var e = Rr(t, this._firestore);
5345
- return this._mutations = this._mutations.concat(new De(e._key, Ie.none())), this;
5497
+ var e = Ur(t, this._firestore);
5498
+ return this._mutations = this._mutations.concat(new Ne(e._key, Ve.none())), this;
5346
5499
  },
5347
5500
  /**
5348
5501
  * Commits all of the writes in this write batch as a single atomic unit.
@@ -5359,12 +5512,12 @@ function Sr(t, e, n) {
5359
5512
  t.prototype.commit = function() {
5360
5513
  return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
5361
5514
  }, t.prototype._verifyNotCommitted = function() {
5362
- if (this._committed) throw new M(R, "A write batch can no longer be used after commit() has been called.");
5515
+ if (this._committed) throw new B(L, "A write batch can no longer be used after commit() has been called.");
5363
5516
  }, t;
5364
5517
  }();
5365
5518
 
5366
- function Rr(t, e) {
5367
- if ((t = p(t)).firestore !== e) throw new M(V, "Provided document reference is from a different Firestore instance.");
5519
+ function Ur(t, e) {
5520
+ if ((t = p(t)).firestore !== e) throw new B(D, "Provided document reference is from a different Firestore instance.");
5368
5521
  return t;
5369
5522
  }
5370
5523
 
@@ -5380,10 +5533,10 @@ function Rr(t, e) {
5380
5533
  *
5381
5534
  * @returns A `WriteBatch` that can be used to atomically execute multiple
5382
5535
  * writes.
5383
- */ function qr(t) {
5384
- var e = rn(t = st(t, an));
5385
- return new Fr(t, (function(t) {
5386
- return $e(e, t);
5536
+ */ function Br(t) {
5537
+ var e = an(t = ct(t, sn));
5538
+ return new Mr(t, (function(t) {
5539
+ return nn(e, t);
5387
5540
  }));
5388
5541
  }
5389
5542
 
@@ -5406,7 +5559,7 @@ function Rr(t, e) {
5406
5559
  /**
5407
5560
  * Internal transaction object responsible for accumulating the mutations to
5408
5561
  * perform and the base versions for any documents read.
5409
- */ var Lr = /** @class */ function() {
5562
+ */ var zr = /** @class */ function() {
5410
5563
  function t(t) {
5411
5564
  this.datastore = t,
5412
5565
  // The version of each document that was read during this transaction.
@@ -5430,8 +5583,8 @@ function Rr(t, e) {
5430
5583
  return n(this, (function(n) {
5431
5584
  switch (n.label) {
5432
5585
  case 0:
5433
- if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new M(V, "Firestore transactions require all reads to be executed before all writes.");
5434
- return [ 4 /*yield*/ , tn(this.datastore, t) ];
5586
+ if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new B(D, "Firestore transactions require all reads to be executed before all writes.");
5587
+ return [ 4 /*yield*/ , rn(this.datastore, t) ];
5435
5588
 
5436
5589
  case 1:
5437
5590
  return [ 2 /*return*/ , ((e = n.sent()).forEach((function(t) {
@@ -5450,7 +5603,7 @@ function Rr(t, e) {
5450
5603
  }
5451
5604
  this.writtenDocs.add(t.toString());
5452
5605
  }, t.prototype.delete = function(t) {
5453
- this.write(new De(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5606
+ this.write(new Ne(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5454
5607
  }, t.prototype.commit = function() {
5455
5608
  return e(this, void 0, void 0, (function() {
5456
5609
  var t, e = this;
@@ -5466,9 +5619,9 @@ function Rr(t, e) {
5466
5619
  // For each document that was read but not written to, we want to perform
5467
5620
  // a `verify` operation.
5468
5621
  t.forEach((function(t, n) {
5469
- var r = nt.fromPath(n);
5470
- e.mutations.push(new Ne(r, e.precondition(r)));
5471
- })), [ 4 /*yield*/ , $e(this.datastore, this.mutations) ];
5622
+ var r = it.fromPath(n);
5623
+ e.mutations.push(new Fe(r, e.precondition(r)));
5624
+ })), [ 4 /*yield*/ , nn(this.datastore, this.mutations) ];
5472
5625
 
5473
5626
  case 1:
5474
5627
  // For each mutation, note that the doc was written.
@@ -5479,15 +5632,15 @@ function Rr(t, e) {
5479
5632
  }, t.prototype.recordVersion = function(t) {
5480
5633
  var e;
5481
5634
  if (t.isFoundDocument()) e = t.version; else {
5482
- if (!t.isNoDocument()) throw E();
5635
+ if (!t.isNoDocument()) throw k();
5483
5636
  // Represent a deleted doc using SnapshotVersion.min().
5484
- e = _t.min();
5637
+ e = Et.min();
5485
5638
  }
5486
5639
  var n = this.readVersions.get(t.key.toString());
5487
5640
  if (n) {
5488
5641
  if (!e.isEqual(n))
5489
5642
  // This transaction will fail no matter what.
5490
- throw new M(q, "Document version changed between two reads.");
5643
+ throw new B(x, "Document version changed between two reads.");
5491
5644
  } else this.readVersions.set(t.key.toString(), e);
5492
5645
  },
5493
5646
  /**
@@ -5496,7 +5649,7 @@ function Rr(t, e) {
5496
5649
  */
5497
5650
  t.prototype.precondition = function(t) {
5498
5651
  var e = this.readVersions.get(t.toString());
5499
- return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(_t.min()) ? Ie.exists(!1) : Ie.updateTime(e) : Ie.none();
5652
+ return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(Et.min()) ? Ve.exists(!1) : Ve.updateTime(e) : Ve.none();
5500
5653
  },
5501
5654
  /**
5502
5655
  * Returns the precondition for a document if the operation is an update.
@@ -5506,7 +5659,7 @@ function Rr(t, e) {
5506
5659
  // The first time a document is written, we want to take into account the
5507
5660
  // read time and existence
5508
5661
  if (!this.writtenDocs.has(t.toString()) && e) {
5509
- if (e.isEqual(_t.min()))
5662
+ if (e.isEqual(Et.min()))
5510
5663
  // The document doesn't exist, so fail the transaction.
5511
5664
  // This has to be validated locally because you can't send a
5512
5665
  // precondition that a document does not exist without changing the
@@ -5516,22 +5669,22 @@ function Rr(t, e) {
5516
5669
  // express that to the backend, we have to validate locally.
5517
5670
  // Note: this can change once we can send separate verify writes in the
5518
5671
  // transaction.
5519
- throw new M(V, "Can't update a document that doesn't exist.");
5672
+ throw new B(D, "Can't update a document that doesn't exist.");
5520
5673
  // Document exists, base precondition on document update time.
5521
- return Ie.updateTime(e);
5674
+ return Ve.updateTime(e);
5522
5675
  }
5523
5676
  // Document was not read, so we just use the preconditions for a blind
5524
5677
  // update.
5525
- return Ie.exists(!0);
5678
+ return Ve.exists(!0);
5526
5679
  }, t.prototype.write = function(t) {
5527
5680
  this.ensureCommitNotCalled(), this.mutations.push(t);
5528
5681
  }, t.prototype.ensureCommitNotCalled = function() {}, t;
5529
- }(), xr = {
5682
+ }(), Gr = {
5530
5683
  maxAttempts: 5
5531
- }, Cr = /** @class */ function() {
5684
+ }, Kr = /** @class */ function() {
5532
5685
  function t(t, e, n, r, i) {
5533
5686
  this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
5534
- this.deferred = i, this.Pt = n.maxAttempts, this.Vt = new Je(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
5687
+ this.deferred = i, this.Pt = n.maxAttempts, this.Vt = new tn(this.asyncQueue, "transaction_retry" /* TransactionRetry */)
5535
5688
  /** Runs the transaction and sets the result on deferred. */;
5536
5689
  }
5537
5690
  return t.prototype.run = function() {
@@ -5542,7 +5695,7 @@ function Rr(t, e) {
5542
5695
  return e(t, void 0, void 0, (function() {
5543
5696
  var t, e, r = this;
5544
5697
  return n(this, (function(n) {
5545
- return t = new Lr(this.datastore), (e = this.Dt(t)) && e.then((function(e) {
5698
+ return t = new zr(this.datastore), (e = this.Dt(t)) && e.then((function(e) {
5546
5699
  r.asyncQueue.enqueueAndForget((function() {
5547
5700
  return t.commit().then((function() {
5548
5701
  r.deferred.resolve(e);
@@ -5559,7 +5712,7 @@ function Rr(t, e) {
5559
5712
  }, t.prototype.Dt = function(t) {
5560
5713
  try {
5561
5714
  var e = this.updateFunction(t);
5562
- return !ct(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5715
+ return !ft(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5563
5716
  null);
5564
5717
  } catch (t) {
5565
5718
  // Do not retry errors thrown by user provided updateFunction.
@@ -5585,30 +5738,30 @@ function Rr(t, e) {
5585
5738
  function(t) {
5586
5739
  switch (t) {
5587
5740
  default:
5588
- return E();
5741
+ return k();
5589
5742
 
5590
- case I:
5591
- case A:
5743
+ case V:
5592
5744
  case P:
5593
- case F:
5594
- case C:
5595
- case j:
5745
+ case O:
5746
+ case q:
5747
+ case M:
5748
+ case U:
5596
5749
  // Unauthenticated means something went wrong with our token and we need
5597
5750
  // to retry with new credentials which will happen automatically.
5598
- case O:
5751
+ case R:
5599
5752
  return !1;
5600
5753
 
5601
- case V:
5602
5754
  case D:
5603
- case "already-exists":
5604
5755
  case N:
5605
- case R:
5756
+ case "already-exists":
5757
+ case F:
5758
+ case L:
5606
5759
  // Aborted might be retried in some scenarios, but that is dependant on
5607
5760
  // the context and should handled individually by the calling code.
5608
5761
  // See https://cloud.google.com/apis/design/errors.
5609
- case q:
5610
- case L:
5611
- case x:
5762
+ case x:
5763
+ case C:
5764
+ case j:
5612
5765
  case "data-loss":
5613
5766
  return !0;
5614
5767
  }
@@ -5650,7 +5803,7 @@ function Rr(t, e) {
5650
5803
  * See the License for the specific language governing permissions and
5651
5804
  * limitations under the License.
5652
5805
  */
5653
- /** The Platform's 'document' implementation or null if not available. */ function jr() {
5806
+ /** The Platform's 'document' implementation or null if not available. */ function Qr() {
5654
5807
  // `document` is not always available, e.g. in ReactNative and WebWorkers.
5655
5808
  // eslint-disable-next-line no-restricted-globals
5656
5809
  return "undefined" != typeof document ? document : null;
@@ -5682,10 +5835,10 @@ function Rr(t, e) {
5682
5835
  * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
5683
5836
  * in newer versions of TypeScript defines `finally`, which is not available in
5684
5837
  * IE.
5685
- */ var Mr = /** @class */ function() {
5838
+ */ var Wr = /** @class */ function() {
5686
5839
  function t(t, e, n, r, i) {
5687
5840
  this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = i,
5688
- this.deferred = new U, this.then = this.deferred.promise.then.bind(this.deferred.promise),
5841
+ this.deferred = new z, this.then = this.deferred.promise.then.bind(this.deferred.promise),
5689
5842
  // It's normal for the deferred promise to be canceled (due to cancellation)
5690
5843
  // and so we attach a dummy catch callback to avoid
5691
5844
  // 'UnhandledPromiseRejectionWarning' log spam.
@@ -5734,7 +5887,7 @@ function Rr(t, e) {
5734
5887
  * guarantee that the operation will not be run.
5735
5888
  */
5736
5889
  t.prototype.cancel = function(t) {
5737
- null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new M(I, "Operation cancelled" + (t ? ": " + t : ""))));
5890
+ null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new B(V, "Operation cancelled" + (t ? ": " + t : ""))));
5738
5891
  }, t.prototype.handleDelayElapsed = function() {
5739
5892
  var t = this;
5740
5893
  this.asyncQueue.enqueueAndForget((function() {
@@ -5746,7 +5899,7 @@ function Rr(t, e) {
5746
5899
  null !== this.timerHandle && (this.removalCallback(this), clearTimeout(this.timerHandle),
5747
5900
  this.timerHandle = null);
5748
5901
  }, t;
5749
- }(), Ur = /** @class */ function() {
5902
+ }(), Yr = /** @class */ function() {
5750
5903
  function t() {
5751
5904
  var t = this;
5752
5905
  // The last promise in the queue.
@@ -5770,15 +5923,15 @@ function Rr(t, e) {
5770
5923
  // List of TimerIds to fast-forward delays for.
5771
5924
  this.Mt = [],
5772
5925
  // Backoff timer used to schedule retries for retryable operations
5773
- this.Vt = new Je(this, "async_queue_retry" /* AsyncQueueRetry */),
5926
+ this.Vt = new tn(this, "async_queue_retry" /* AsyncQueueRetry */),
5774
5927
  // Visibility handler that triggers an immediate retry of all retryable
5775
5928
  // operations. Meant to speed up recovery when we regain file system access
5776
5929
  // after page comes into foreground.
5777
5930
  this.Ut = function() {
5778
- var e = jr();
5779
- e && w("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.Vt.Z();
5931
+ var e = Qr();
5932
+ e && _("AsyncQueue", "Visibility state changed to " + e.visibilityState), t.Vt.Z();
5780
5933
  };
5781
- var e = jr();
5934
+ var e = Qr();
5782
5935
  e && "function" == typeof e.addEventListener && e.addEventListener("visibilitychange", this.Ut);
5783
5936
  }
5784
5937
  return Object.defineProperty(t.prototype, "isShuttingDown", {
@@ -5802,7 +5955,7 @@ function Rr(t, e) {
5802
5955
  }, t.prototype.enterRestrictedMode = function(t) {
5803
5956
  if (!this.qt) {
5804
5957
  this.qt = !0, this.Lt = t || !1;
5805
- var e = jr();
5958
+ var e = Qr();
5806
5959
  e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ut);
5807
5960
  }
5808
5961
  }, t.prototype.enqueue = function(t) {
@@ -5813,7 +5966,7 @@ function Rr(t, e) {
5813
5966
  // Create a deferred Promise that we can return to the callee. This
5814
5967
  // allows us to return a "hanging Promise" only to the callee and still
5815
5968
  // advance the queue even when the operation is not run.
5816
- var n = new U;
5969
+ var n = new z;
5817
5970
  return this.Bt((function() {
5818
5971
  return e.qt && e.Lt ? Promise.resolve() : (t().then(n.resolve, n.reject), n.promise);
5819
5972
  })).then((function() {
@@ -5822,14 +5975,14 @@ function Rr(t, e) {
5822
5975
  }, t.prototype.enqueueRetryable = function(t) {
5823
5976
  var e = this;
5824
5977
  this.enqueueAndForget((function() {
5825
- return e.St.push(t), e.zt();
5978
+ return e.St.push(t), e.Qt();
5826
5979
  }));
5827
5980
  },
5828
5981
  /**
5829
5982
  * Runs the next operation from the retryable queue. If the operation fails,
5830
5983
  * reschedules with backoff.
5831
5984
  */
5832
- t.prototype.zt = function() {
5985
+ t.prototype.Qt = function() {
5833
5986
  return e(this, void 0, void 0, (function() {
5834
5987
  var t, e = this;
5835
5988
  return n(this, (function(n) {
@@ -5847,7 +6000,7 @@ function Rr(t, e) {
5847
6000
  case 3:
5848
6001
  if (t = n.sent(), "IndexedDbTransactionError" !== t.name) throw t;
5849
6002
  // Failure will be handled by AsyncQueue
5850
- return w("AsyncQueue", "Operation failed with retryable error: " + t),
6003
+ return _("AsyncQueue", "Operation failed with retryable error: " + t),
5851
6004
  [ 3 /*break*/ , 4 ];
5852
6005
 
5853
6006
  case 4:
@@ -5863,7 +6016,7 @@ function Rr(t, e) {
5863
6016
  // new backoff on every call, there is only ever a single additional
5864
6017
  // operation in the queue.
5865
6018
  this.Vt.J((function() {
5866
- return e.zt();
6019
+ return e.Qt();
5867
6020
  })), n.label = 5;
5868
6021
 
5869
6022
  case 5:
@@ -5889,7 +6042,7 @@ function Rr(t, e) {
5889
6042
  // Re-throw the error so that this.tail becomes a rejected Promise and
5890
6043
  // all further attempts to chain (via .then) will just short-circuit
5891
6044
  // and return the rejected Promise.
5892
- throw b("INTERNAL UNHANDLED ERROR: ", n), t;
6045
+ throw T("INTERNAL UNHANDLED ERROR: ", n), t;
5893
6046
  })).then((function(t) {
5894
6047
  return e.Ct = !1, t;
5895
6048
  }));
@@ -5900,18 +6053,18 @@ function Rr(t, e) {
5900
6053
  this.jt(),
5901
6054
  // Fast-forward delays for timerIds that have been overriden.
5902
6055
  this.Mt.indexOf(t) > -1 && (e = 0);
5903
- var i = Mr.createAndSchedule(this, t, e, n, (function(t) {
5904
- return r.Gt(t);
6056
+ var i = Wr.createAndSchedule(this, t, e, n, (function(t) {
6057
+ return r.zt(t);
5905
6058
  }));
5906
6059
  return this.Ot.push(i), i;
5907
6060
  }, t.prototype.jt = function() {
5908
- this.kt && E();
6061
+ this.kt && k();
5909
6062
  }, t.prototype.verifyOperationInProgress = function() {},
5910
6063
  /**
5911
6064
  * Waits until all currently queued tasks are finished executing. Delayed
5912
6065
  * operations are not run.
5913
6066
  */
5914
- t.prototype.Qt = function() {
6067
+ t.prototype.Gt = function() {
5915
6068
  return e(this, void 0, void 0, (function() {
5916
6069
  var t;
5917
6070
  return n(this, (function(e) {
@@ -5952,7 +6105,7 @@ function Rr(t, e) {
5952
6105
  t.prototype.Kt = function(t) {
5953
6106
  var e = this;
5954
6107
  // Note that draining may generate more delayed ops, so we do that first.
5955
- return this.Qt().then((function() {
6108
+ return this.Gt().then((function() {
5956
6109
  // Run ops in the same order they'd run if they ran naturally.
5957
6110
  e.Ot.sort((function(t, e) {
5958
6111
  return t.targetTimeMs - e.targetTimeMs;
@@ -5961,7 +6114,7 @@ function Rr(t, e) {
5961
6114
  var i = r[n];
5962
6115
  if (i.skipDelay(), "all" /* All */ !== t && i.timerId === t) break;
5963
6116
  }
5964
- return e.Qt();
6117
+ return e.Gt();
5965
6118
  }));
5966
6119
  },
5967
6120
  /**
@@ -5970,15 +6123,15 @@ function Rr(t, e) {
5970
6123
  t.prototype.Yt = function(t) {
5971
6124
  this.Mt.push(t);
5972
6125
  },
5973
- /** Called once a DelayedOperation is run or canceled. */ t.prototype.Gt = function(t) {
6126
+ /** Called once a DelayedOperation is run or canceled. */ t.prototype.zt = function(t) {
5974
6127
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
5975
6128
  var e = this.Ot.indexOf(t);
5976
6129
  this.Ot.splice(e, 1);
5977
6130
  }, t;
5978
- }(), Br = /** @class */ function() {
6131
+ }(), Hr = /** @class */ function() {
5979
6132
  /** @hideconstructor */
5980
6133
  function t(t, e) {
5981
- this._firestore = t, this._transaction = e, this._dataReader = Dn(t)
6134
+ this._firestore = t, this._transaction = e, this._dataReader = qn(t)
5982
6135
  /**
5983
6136
  * Reads the document referenced by the provided {@link DocumentReference}.
5984
6137
  *
@@ -5987,23 +6140,23 @@ function Rr(t, e) {
5987
6140
  */;
5988
6141
  }
5989
6142
  return t.prototype.get = function(t) {
5990
- var e = this, n = Rr(t, this._firestore), r = new _r(this._firestore);
6143
+ var e = this, n = Ur(t, this._firestore), r = new Ir(this._firestore);
5991
6144
  return this._transaction.lookup([ n._key ]).then((function(t) {
5992
- if (!t || 1 !== t.length) return E();
6145
+ if (!t || 1 !== t.length) return k();
5993
6146
  var i = t[0];
5994
- if (i.isFoundDocument()) return new Xn(e._firestore, r, i.key, i, n.converter);
5995
- if (i.isNoDocument()) return new Xn(e._firestore, r, n._key, null, n.converter);
5996
- throw E();
6147
+ if (i.isFoundDocument()) return new er(e._firestore, r, i.key, i, n.converter);
6148
+ if (i.isNoDocument()) return new er(e._firestore, r, n._key, null, n.converter);
6149
+ throw k();
5997
6150
  }));
5998
6151
  }, t.prototype.set = function(t, e, n) {
5999
- var r = Rr(t, this._firestore), i = br(r.converter, e, n), o = Nn(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
6152
+ var r = Ur(t, this._firestore), i = kr(r.converter, e, n), o = Ln(this._dataReader, "Transaction.set", r._key, i, null !== r.converter, n);
6000
6153
  return this._transaction.set(r._key, o), this;
6001
6154
  }, t.prototype.update = function(t, e, n) {
6002
6155
  for (var r = [], i = 3; i < arguments.length; i++) r[i - 3] = arguments[i];
6003
- var o, a = Rr(t, this._firestore);
6156
+ var o, a = Ur(t, this._firestore);
6004
6157
  // For Compat types, we have to "extract" the underlying types before
6005
6158
  // performing validation.
6006
- return o = "string" == typeof (e = p(e)) || e instanceof wn ? jn(this._dataReader, "Transaction.update", a._key, e, n, r) : Cn(this._dataReader, "Transaction.update", a._key, e),
6159
+ return o = "string" == typeof (e = p(e)) || e instanceof kn ? Gn(this._dataReader, "Transaction.update", a._key, e, n, r) : zn(this._dataReader, "Transaction.update", a._key, e),
6007
6160
  this._transaction.update(a._key, o), this;
6008
6161
  },
6009
6162
  /**
@@ -6013,7 +6166,7 @@ function Rr(t, e) {
6013
6166
  * @returns This `Transaction` instance. Used for chaining method calls.
6014
6167
  */
6015
6168
  t.prototype.delete = function(t) {
6016
- var e = Rr(t, this._firestore);
6169
+ var e = Ur(t, this._firestore);
6017
6170
  return this._transaction.delete(e._key), this;
6018
6171
  }, t;
6019
6172
  }();
@@ -6053,14 +6206,14 @@ function Rr(t, e) {
6053
6206
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
6054
6207
  * rejected promise with the corresponding failure error is returned.
6055
6208
  */
6056
- function zr(t, e, n) {
6057
- var r = rn(t = st(t, an)), i = Object.assign(Object.assign({}, xr), n);
6209
+ function Xr(t, e, n) {
6210
+ var r = an(t = ct(t, sn)), i = Object.assign(Object.assign({}, Gr), n);
6058
6211
  !function(t) {
6059
- if (t.maxAttempts < 1) throw new M(V, "Max attempts must be at least 1");
6212
+ if (t.maxAttempts < 1) throw new B(D, "Max attempts must be at least 1");
6060
6213
  }(i);
6061
- var o = new U;
6062
- return new Cr(new Ur, r, i, (function(n) {
6063
- return e(new Br(t, n));
6214
+ var o = new z;
6215
+ return new Kr(new Yr, r, i, (function(n) {
6216
+ return e(new Hr(t, n));
6064
6217
  }), o).run(), o.promise
6065
6218
  /**
6066
6219
  * Firestore Lite
@@ -6072,15 +6225,15 @@ function zr(t, e, n) {
6072
6225
  */;
6073
6226
  }
6074
6227
 
6075
- m = i + "_lite", o(new c("firestore/lite", (function(t, e) {
6076
- var n = e.instanceIdentifier, r = e.options, i = t.getProvider("app").getImmediate(), o = new an(new K(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")), function(t, e) {
6077
- if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(V, '"projectId" not provided in firebase.initializeApp.');
6078
- return new J(t.options.projectId, e);
6228
+ g = i + "_lite", o(new c("firestore/lite", (function(t, e) {
6229
+ var n = e.instanceIdentifier, r = e.options, i = t.getProvider("app").getImmediate(), o = new sn(new W(t.getProvider("auth-internal")), new J(t.getProvider("app-check-internal")), function(t, e) {
6230
+ if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new B(D, '"projectId" not provided in firebase.initializeApp.');
6231
+ return new $(t.options.projectId, e);
6079
6232
  }(i, n), i);
6080
6233
  return r && o._setSettings(r), o;
6081
6234
  }), "PUBLIC").setMultipleInstances(!0)),
6082
6235
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
6083
- a("firestore-lite", "3.5.0-canary.e35db6f95", ""), a("firestore-lite", "3.5.0-canary.e35db6f95", "esm5");
6236
+ a("firestore-lite", "3.5.0-canary.fdd4ab464", ""), a("firestore-lite", "3.5.0-canary.fdd4ab464", "esm5");
6084
6237
 
6085
- export { _n as Bytes, pn as CollectionReference, fn as DocumentReference, Xn as DocumentSnapshot, wn as FieldPath, Tn as FieldValue, an as Firestore, M as FirestoreError, En as GeoPoint, hn as Query, er as QueryConstraint, Jn as QueryDocumentSnapshot, Zn as QuerySnapshot, bt as Timestamp, Br as Transaction, Fr as WriteBatch, Ar as addDoc, Nr as arrayRemove, Dr as arrayUnion, dn as collection, yn as collectionGroup, cn as connectFirestoreEmulator, Ir as deleteDoc, Vr as deleteField, mn as doc, bn as documentId, yr as endAt, dr as endBefore, Tr as getDoc, Er as getDocs, un as getFirestore, Or as increment, sn as initializeFirestore, ur as limit, cr as limitToLast, ar as orderBy, nr as query, gn as queryEqual, vn as refEqual, zr as runTransaction, Pr as serverTimestamp, kr as setDoc, g as setLogLevel, $n as snapshotEqual, hr as startAfter, fr as startAt, ln as terminate, Sr as updateDoc, ir as where, qr as writeBatch };
6238
+ export { pn as AggregateField, dn as AggregateQuerySnapshot, Sn as Bytes, gn as CollectionReference, mn as DocumentReference, er as DocumentSnapshot, kn as FieldPath, An as FieldValue, sn as Firestore, B as FirestoreError, Vn as GeoPoint, vn as Query, ar as QueryConstraint, nr as QueryDocumentSnapshot, rr as QuerySnapshot, Tt as Timestamp, Hr as Transaction, Mr as WriteBatch, Nr as addDoc, Rr as aggregateQuerySnapshotEqual, Cr as arrayRemove, xr as arrayUnion, wn as collection, bn as collectionGroup, fn as connectFirestoreEmulator, Or as deleteDoc, qr as deleteField, _n as doc, In as documentId, br as endAt, wr as endBefore, Fr as getCount, Ar as getDoc, Vr as getDocs, ln as getFirestore, jr as increment, cn as initializeFirestore, pr as limit, dr as limitToLast, fr as orderBy, ur as query, En as queryEqual, Tn as refEqual, Xr as runTransaction, Lr as serverTimestamp, Pr as setDoc, b as setLogLevel, ir as snapshotEqual, vr as startAfter, mr as startAt, hn as terminate, Dr as updateDoc, cr as where, Br as writeBatch };
6086
6239
  //# sourceMappingURL=index.browser.esm5.js.map