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

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 +6 -6
  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 +6 -6
  10. package/dist/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  11. package/dist/index.d.ts +189 -7
  12. package/dist/index.esm2017.js +3167 -2981
  13. package/dist/index.esm2017.js.map +1 -1
  14. package/dist/index.esm5.js +3477 -3276
  15. package/dist/index.esm5.js.map +1 -1
  16. package/dist/index.node.cjs.js +3893 -3670
  17. package/dist/index.node.cjs.js.map +1 -1
  18. package/dist/index.node.mjs +3890 -3671
  19. package/dist/index.node.mjs.map +1 -1
  20. package/dist/index.rn.js +3231 -3045
  21. package/dist/index.rn.js.map +1 -1
  22. package/dist/internal.d.ts +103 -7
  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 +6 -6
  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 +6 -6
  32. package/dist/lite/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  33. package/dist/lite/index.browser.esm2017.js +1068 -917
  34. package/dist/lite/index.browser.esm2017.js.map +1 -1
  35. package/dist/lite/index.browser.esm5.js +1183 -1037
  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 +240 -62
  39. package/dist/lite/index.node.cjs.js.map +1 -1
  40. package/dist/lite/index.node.mjs +238 -64
  41. package/dist/lite/index.node.mjs.map +1 -1
  42. package/dist/lite/index.rn.esm2017.js +1059 -908
  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 +6 -6
  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 +6 -6
  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 +295 -186
  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 +6 -6
  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 +6 -6
  67. package/dist/packages/firestore/test/integration/api/aggregation.test.d.ts +17 -0
  68. package/dist/private.d.ts +200 -11
  69. package/package.json +9 -9
@@ -4,7 +4,7 @@ import { Component as i } from "@firebase/component";
4
4
 
5
5
  import { Logger as o, LogLevel as u } from "@firebase/logger";
6
6
 
7
- import { FirebaseError as c, base64 as a, createMockUserToken as h, getModularInstance as l } from "@firebase/util";
7
+ import { FirebaseError as c, base64 as a, createMockUserToken as h, getModularInstance as l, deepEqual as f } from "@firebase/util";
8
8
 
9
9
  /**
10
10
  * @license
@@ -26,7 +26,7 @@ import { FirebaseError as c, base64 as a, createMockUserToken as h, getModularIn
26
26
  * Simple wrapper around a nullable UID. Mostly exists to make code more
27
27
  * readable.
28
28
  */
29
- class f {
29
+ class d {
30
30
  constructor(t) {
31
31
  this.uid = t;
32
32
  }
@@ -44,11 +44,11 @@ class f {
44
44
  }
45
45
  }
46
46
 
47
- /** A user with a null UID. */ f.UNAUTHENTICATED = new f(null),
47
+ /** A user with a null UID. */ d.UNAUTHENTICATED = new d(null),
48
48
  // TODO(mikelehen): Look into getting a proper uid-equivalent for
49
49
  // non-FirebaseAuth providers.
50
- f.GOOGLE_CREDENTIALS = new f("google-credentials-uid"), f.FIRST_PARTY = new f("first-party-uid"),
51
- f.MOCK_USER = new f("mock-user");
50
+ d.GOOGLE_CREDENTIALS = new d("google-credentials-uid"), d.FIRST_PARTY = new d("first-party-uid"),
51
+ d.MOCK_USER = new d("mock-user");
52
52
 
53
53
  /**
54
54
  * @license
@@ -66,7 +66,7 @@ f.MOCK_USER = new f("mock-user");
66
66
  * See the License for the specific language governing permissions and
67
67
  * limitations under the License.
68
68
  */
69
- let d = "9.10.0-canary.e35db6f95";
69
+ let w = "9.10.0-canary.ee871fc0b";
70
70
 
71
71
  /**
72
72
  * @license
@@ -84,7 +84,7 @@ let d = "9.10.0-canary.e35db6f95";
84
84
  * See the License for the specific language governing permissions and
85
85
  * limitations under the License.
86
86
  */
87
- const w = new o("@firebase/firestore");
87
+ const m = new o("@firebase/firestore");
88
88
 
89
89
  /**
90
90
  * Sets the verbosity of Cloud Firestore logs (debug, error, or silent).
@@ -98,36 +98,36 @@ const w = new o("@firebase/firestore");
98
98
  * <li>`error` to log errors only.</li>
99
99
  * <li><code>`silent` to turn off logging.</li>
100
100
  * </ul>
101
- */ function m(t) {
102
- w.setLogLevel(t);
101
+ */ function p(t) {
102
+ m.setLogLevel(t);
103
103
  }
104
104
 
105
- function p(t, ...e) {
106
- if (w.logLevel <= u.DEBUG) {
107
- const n = e.map(g);
108
- w.debug(`Firestore (${d}): ${t}`, ...n);
105
+ function y(t, ...e) {
106
+ if (m.logLevel <= u.DEBUG) {
107
+ const n = e.map(v);
108
+ m.debug(`Firestore (${w}): ${t}`, ...n);
109
109
  }
110
110
  }
111
111
 
112
- function y(t, ...e) {
113
- if (w.logLevel <= u.ERROR) {
114
- const n = e.map(g);
115
- w.error(`Firestore (${d}): ${t}`, ...n);
112
+ function g(t, ...e) {
113
+ if (m.logLevel <= u.ERROR) {
114
+ const n = e.map(v);
115
+ m.error(`Firestore (${w}): ${t}`, ...n);
116
116
  }
117
117
  }
118
118
 
119
119
  /**
120
120
  * @internal
121
121
  */ function _(t, ...e) {
122
- if (w.logLevel <= u.WARN) {
123
- const n = e.map(g);
124
- w.warn(`Firestore (${d}): ${t}`, ...n);
122
+ if (m.logLevel <= u.WARN) {
123
+ const n = e.map(v);
124
+ m.warn(`Firestore (${w}): ${t}`, ...n);
125
125
  }
126
126
  }
127
127
 
128
128
  /**
129
129
  * Converts an additional log parameter to a string representation.
130
- */ function g(t) {
130
+ */ function v(t) {
131
131
  if ("string" == typeof t) return t;
132
132
  try {
133
133
  return e = t, JSON.stringify(e);
@@ -178,14 +178,14 @@ function y(t, ...e) {
178
178
  * Returns `never` and can be used in expressions:
179
179
  * @example
180
180
  * let futureVar = fail('not implemented yet');
181
- */ function v(t = "Unexpected state") {
181
+ */ function b(t = "Unexpected state") {
182
182
  // Log the failure in addition to throw an exception, just in case the
183
183
  // exception is swallowed.
184
- const e = `FIRESTORE (${d}) INTERNAL ASSERTION FAILED: ` + t;
184
+ const e = `FIRESTORE (${w}) INTERNAL ASSERTION FAILED: ` + t;
185
185
  // NOTE: We don't use FirestoreError here because these are internal failures
186
186
  // that cannot be handled by the user. (Also it would create a circular
187
187
  // dependency between the error and assert modules which doesn't work.)
188
- throw y(e), new Error(e);
188
+ throw g(e), new Error(e);
189
189
  }
190
190
 
191
191
  /**
@@ -193,14 +193,14 @@ function y(t, ...e) {
193
193
  * given message if it did.
194
194
  *
195
195
  * Messages are stripped in production builds.
196
- */ function b(t, e) {
197
- t || v();
196
+ */ function E(t, e) {
197
+ t || b();
198
198
  }
199
199
 
200
200
  /**
201
201
  * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
202
202
  * instance of `T` before casting.
203
- */ function E(t,
203
+ */ function I(t,
204
204
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
205
205
  e) {
206
206
  return t;
@@ -221,9 +221,9 @@ e) {
221
221
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
222
222
  * See the License for the specific language governing permissions and
223
223
  * limitations under the License.
224
- */ const I = "ok", T = "cancelled", A = "unknown", R = "invalid-argument", P = "deadline-exceeded", V = "not-found", N = "already-exists", $ = "permission-denied", D = "unauthenticated", x = "resource-exhausted", S = "failed-precondition", F = "aborted", q = "out-of-range", O = "unimplemented", k = "internal", C = "unavailable", L = "data-loss";
224
+ */ const T = "ok", A = "cancelled", R = "unknown", P = "invalid-argument", V = "deadline-exceeded", N = "not-found", $ = "already-exists", D = "permission-denied", x = "unauthenticated", S = "resource-exhausted", F = "failed-precondition", q = "aborted", O = "out-of-range", k = "unimplemented", C = "internal", L = "unavailable", M = "data-loss";
225
225
 
226
- /** An error returned by a Firestore operation. */ class M extends c {
226
+ /** An error returned by a Firestore operation. */ class U extends c {
227
227
  /** @hideconstructor */
228
228
  constructor(
229
229
  /**
@@ -257,7 +257,7 @@ e) {
257
257
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
258
258
  * See the License for the specific language governing permissions and
259
259
  * limitations under the License.
260
- */ class U {
260
+ */ class j {
261
261
  constructor() {
262
262
  this.promise = new Promise(((t, e) => {
263
263
  this.resolve = t, this.reject = e;
@@ -280,7 +280,7 @@ e) {
280
280
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
281
281
  * See the License for the specific language governing permissions and
282
282
  * limitations under the License.
283
- */ class j {
283
+ */ class B {
284
284
  constructor(t, e) {
285
285
  this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
286
286
  }
@@ -289,14 +289,14 @@ e) {
289
289
  /**
290
290
  * A CredentialsProvider that always yields an empty token.
291
291
  * @internal
292
- */ class B {
292
+ */ class Q {
293
293
  getToken() {
294
294
  return Promise.resolve(null);
295
295
  }
296
296
  invalidateToken() {}
297
297
  start(t, e) {
298
298
  // Fire with initial user.
299
- t.enqueueRetryable((() => e(f.UNAUTHENTICATED)));
299
+ t.enqueueRetryable((() => e(d.UNAUTHENTICATED)));
300
300
  }
301
301
  shutdown() {}
302
302
  }
@@ -328,15 +328,15 @@ e) {
328
328
  }
329
329
  }
330
330
 
331
- /** Credential provider for the Lite SDK. */ class Q {
331
+ /** Credential provider for the Lite SDK. */ class W {
332
332
  constructor(t) {
333
333
  this.auth = null, t.onInit((t => {
334
334
  this.auth = t;
335
335
  }));
336
336
  }
337
337
  getToken() {
338
- return this.auth ? this.auth.getToken().then((t => t ? (b("string" == typeof t.accessToken),
339
- new j(t.accessToken, new f(this.auth.getUid()))) : null)) : Promise.resolve(null);
338
+ return this.auth ? this.auth.getToken().then((t => t ? (E("string" == typeof t.accessToken),
339
+ new B(t.accessToken, new d(this.auth.getUid()))) : null)) : Promise.resolve(null);
340
340
  }
341
341
  invalidateToken() {}
342
342
  start(t, e) {}
@@ -349,15 +349,15 @@ e) {
349
349
  * Technically this may no longer be necessary since the SDK should gracefully
350
350
  * recover from unauthenticated errors (see b/33147818 for context), but it's
351
351
  * safer to keep the implementation as-is.
352
- */ class W {
352
+ */ class G {
353
353
  constructor(t, e, n, r) {
354
- this.t = t, this.i = e, this.o = n, this.u = r, this.type = "FirstParty", this.user = f.FIRST_PARTY,
354
+ this.t = t, this.i = e, this.o = n, this.u = r, this.type = "FirstParty", this.user = d.FIRST_PARTY,
355
355
  this.h = new Map;
356
356
  }
357
357
  /** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */ l() {
358
358
  return this.u ? this.u() : (
359
359
  // Make sure this really is a Gapi client.
360
- b(!("object" != typeof this.t || null === this.t || !this.t.auth || !this.t.auth.getAuthHeaderValueForFirstParty)),
360
+ E(!("object" != typeof this.t || null === this.t || !this.t.auth || !this.t.auth.getAuthHeaderValueForFirstParty)),
361
361
  this.t.auth.getAuthHeaderValueForFirstParty([]));
362
362
  }
363
363
  get headers() {
@@ -373,36 +373,36 @@ e) {
373
373
  * Provides user credentials required for the Firestore JavaScript SDK
374
374
  * to authenticate the user, using technique that is only available
375
375
  * to applications hosted by Google.
376
- */ class G {
376
+ */ class K {
377
377
  constructor(t, e, n, r) {
378
378
  this.t = t, this.i = e, this.o = n, this.u = r;
379
379
  }
380
380
  getToken() {
381
- return Promise.resolve(new W(this.t, this.i, this.o, this.u));
381
+ return Promise.resolve(new G(this.t, this.i, this.o, this.u));
382
382
  }
383
383
  start(t, e) {
384
384
  // Fire with initial uid.
385
- t.enqueueRetryable((() => e(f.FIRST_PARTY)));
385
+ t.enqueueRetryable((() => e(d.FIRST_PARTY)));
386
386
  }
387
387
  shutdown() {}
388
388
  invalidateToken() {}
389
389
  }
390
390
 
391
- class K {
391
+ class Y {
392
392
  constructor(t) {
393
393
  this.value = t, this.type = "AppCheck", this.headers = new Map, t && t.length > 0 && this.headers.set("x-firebase-appcheck", this.value);
394
394
  }
395
395
  }
396
396
 
397
- /** AppCheck token provider for the Lite SDK. */ class Y {
397
+ /** AppCheck token provider for the Lite SDK. */ class H {
398
398
  constructor(t) {
399
399
  this.m = t, this.appCheck = null, t.onInit((t => {
400
400
  this.appCheck = t;
401
401
  }));
402
402
  }
403
403
  getToken() {
404
- return this.appCheck ? this.appCheck.getToken().then((t => t ? (b("string" == typeof t.token),
405
- new K(t.token)) : null)) : Promise.resolve(null);
404
+ return this.appCheck ? this.appCheck.getToken().then((t => t ? (E("string" == typeof t.token),
405
+ new Y(t.token)) : null)) : Promise.resolve(null);
406
406
  }
407
407
  invalidateToken() {}
408
408
  start(t, e) {}
@@ -429,7 +429,7 @@ class K {
429
429
  * See the License for the specific language governing permissions and
430
430
  * limitations under the License.
431
431
  */
432
- class H {
432
+ class J {
433
433
  /**
434
434
  * Constructs a DatabaseInfo using the provided host, databaseId and
435
435
  * persistenceKey.
@@ -458,38 +458,38 @@ class H {
458
458
  * Represents the database ID a Firestore client is associated with.
459
459
  * @internal
460
460
  */
461
- class J {
461
+ class X {
462
462
  constructor(t, e) {
463
463
  this.projectId = t, this.database = e || "(default)";
464
464
  }
465
465
  static empty() {
466
- return new J("", "");
466
+ return new X("", "");
467
467
  }
468
468
  get isDefaultDatabase() {
469
469
  return "(default)" === this.database;
470
470
  }
471
471
  isEqual(t) {
472
- return t instanceof J && t.projectId === this.projectId && t.database === this.database;
472
+ return t instanceof X && t.projectId === this.projectId && t.database === this.database;
473
473
  }
474
474
  }
475
475
 
476
476
  /**
477
477
  * Path represents an ordered sequence of string segments.
478
478
  */
479
- class X {
479
+ class Z {
480
480
  constructor(t, e, n) {
481
- void 0 === e ? e = 0 : e > t.length && v(), void 0 === n ? n = t.length - e : n > t.length - e && v(),
481
+ void 0 === e ? e = 0 : e > t.length && b(), void 0 === n ? n = t.length - e : n > t.length - e && b(),
482
482
  this.segments = t, this.offset = e, this.len = n;
483
483
  }
484
484
  get length() {
485
485
  return this.len;
486
486
  }
487
487
  isEqual(t) {
488
- return 0 === X.comparator(this, t);
488
+ return 0 === Z.comparator(this, t);
489
489
  }
490
490
  child(t) {
491
491
  const e = this.segments.slice(this.offset, this.limit());
492
- return t instanceof X ? t.forEach((t => {
492
+ return t instanceof Z ? t.forEach((t => {
493
493
  e.push(t);
494
494
  })) : e.push(t), this.construct(e);
495
495
  }
@@ -546,9 +546,9 @@ class X {
546
546
  * within Firestore.
547
547
  *
548
548
  * @internal
549
- */ class Z extends X {
549
+ */ class tt extends Z {
550
550
  construct(t, e, n) {
551
- return new Z(t, e, n);
551
+ return new tt(t, e, n);
552
552
  }
553
553
  canonicalString() {
554
554
  // NOTE: The client is ignorant of any path segments containing escape
@@ -569,35 +569,35 @@ class X {
569
569
  // for legacy reasons and should not be used frequently).
570
570
  const e = [];
571
571
  for (const n of t) {
572
- if (n.indexOf("//") >= 0) throw new M(R, `Invalid segment (${n}). Paths must not contain // in them.`);
572
+ if (n.indexOf("//") >= 0) throw new U(P, `Invalid segment (${n}). Paths must not contain // in them.`);
573
573
  // Strip leading and traling slashed.
574
574
  e.push(...n.split("/").filter((t => t.length > 0)));
575
575
  }
576
- return new Z(e);
576
+ return new tt(e);
577
577
  }
578
578
  static emptyPath() {
579
- return new Z([]);
579
+ return new tt([]);
580
580
  }
581
581
  }
582
582
 
583
- const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
583
+ const et = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
584
584
 
585
585
  /**
586
586
  * A dot-separated path for navigating sub-objects within a document.
587
587
  * @internal
588
- */ class et extends X {
588
+ */ class nt extends Z {
589
589
  construct(t, e, n) {
590
- return new et(t, e, n);
590
+ return new nt(t, e, n);
591
591
  }
592
592
  /**
593
593
  * Returns true if the string could be used as a segment in a field path
594
594
  * without escaping.
595
595
  */ static isValidIdentifier(t) {
596
- return tt.test(t);
596
+ return et.test(t);
597
597
  }
598
598
  canonicalString() {
599
599
  return this.toArray().map((t => (t = t.replace(/\\/g, "\\\\").replace(/`/g, "\\`"),
600
- et.isValidIdentifier(t) || (t = "`" + t + "`"), t))).join(".");
600
+ nt.isValidIdentifier(t) || (t = "`" + t + "`"), t))).join(".");
601
601
  }
602
602
  toString() {
603
603
  return this.canonicalString();
@@ -610,7 +610,7 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
610
610
  /**
611
611
  * The field designating the key of a document.
612
612
  */ static keyField() {
613
- return new et([ "__name__" ]);
613
+ return new nt([ "__name__" ]);
614
614
  }
615
615
  /**
616
616
  * Parses a field string from the given server-formatted string.
@@ -625,24 +625,24 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
625
625
  const e = [];
626
626
  let n = "", r = 0;
627
627
  const s = () => {
628
- if (0 === n.length) throw new M(R, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
628
+ if (0 === n.length) throw new U(P, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
629
629
  e.push(n), n = "";
630
630
  };
631
631
  let i = !1;
632
632
  for (;r < t.length; ) {
633
633
  const e = t[r];
634
634
  if ("\\" === e) {
635
- if (r + 1 === t.length) throw new M(R, "Path has trailing escape character: " + t);
635
+ if (r + 1 === t.length) throw new U(P, "Path has trailing escape character: " + t);
636
636
  const e = t[r + 1];
637
- if ("\\" !== e && "." !== e && "`" !== e) throw new M(R, "Path has invalid escape sequence: " + t);
637
+ if ("\\" !== e && "." !== e && "`" !== e) throw new U(P, "Path has invalid escape sequence: " + t);
638
638
  n += e, r += 2;
639
639
  } else "`" === e ? (i = !i, r++) : "." !== e || i ? (n += e, r++) : (s(), r++);
640
640
  }
641
- if (s(), i) throw new M(R, "Unterminated ` in path: " + t);
642
- return new et(e);
641
+ if (s(), i) throw new U(P, "Unterminated ` in path: " + t);
642
+ return new nt(e);
643
643
  }
644
644
  static emptyPath() {
645
- return new et([]);
645
+ return new nt([]);
646
646
  }
647
647
  }
648
648
 
@@ -664,18 +664,18 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
664
664
  */
665
665
  /**
666
666
  * @internal
667
- */ class nt {
667
+ */ class rt {
668
668
  constructor(t) {
669
669
  this.path = t;
670
670
  }
671
671
  static fromPath(t) {
672
- return new nt(Z.fromString(t));
672
+ return new rt(tt.fromString(t));
673
673
  }
674
674
  static fromName(t) {
675
- return new nt(Z.fromString(t).popFirst(5));
675
+ return new rt(tt.fromString(t).popFirst(5));
676
676
  }
677
677
  static empty() {
678
- return new nt(Z.emptyPath());
678
+ return new rt(tt.emptyPath());
679
679
  }
680
680
  get collectionGroup() {
681
681
  return this.path.popLast().lastSegment();
@@ -690,13 +690,13 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
690
690
  return this.path.popLast();
691
691
  }
692
692
  isEqual(t) {
693
- return null !== t && 0 === Z.comparator(this.path, t.path);
693
+ return null !== t && 0 === tt.comparator(this.path, t.path);
694
694
  }
695
695
  toString() {
696
696
  return this.path.toString();
697
697
  }
698
698
  static comparator(t, e) {
699
- return Z.comparator(t.path, e.path);
699
+ return tt.comparator(t.path, e.path);
700
700
  }
701
701
  static isDocumentKey(t) {
702
702
  return t.length % 2 == 0;
@@ -707,7 +707,7 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
707
707
  * @param segments - The segments of the path to the document
708
708
  * @returns A new instance of DocumentKey
709
709
  */ static fromSegments(t) {
710
- return new nt(new Z(t.slice()));
710
+ return new rt(new tt(t.slice()));
711
711
  }
712
712
  }
713
713
 
@@ -726,8 +726,8 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
726
726
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
727
727
  * See the License for the specific language governing permissions and
728
728
  * limitations under the License.
729
- */ function rt(t, e, n) {
730
- if (!n) throw new M(R, `Function ${t}() cannot be called with an empty ${e}.`);
729
+ */ function st(t, e, n) {
730
+ if (!n) throw new U(P, `Function ${t}() cannot be called with an empty ${e}.`);
731
731
  }
732
732
 
733
733
  /**
@@ -738,15 +738,15 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
738
738
  * Validates that `path` refers to a document (indicated by the fact it contains
739
739
  * an even numbers of segments).
740
740
  */
741
- function st(t) {
742
- if (!nt.isDocumentKey(t)) throw new M(R, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
741
+ function it(t) {
742
+ if (!rt.isDocumentKey(t)) throw new U(P, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
743
743
  }
744
744
 
745
745
  /**
746
746
  * Validates that `path` refers to a collection (indicated by the fact it
747
747
  * contains an odd numbers of segments).
748
- */ function it(t) {
749
- if (nt.isDocumentKey(t)) throw new M(R, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
748
+ */ function ot(t) {
749
+ if (rt.isDocumentKey(t)) throw new U(P, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
750
750
  }
751
751
 
752
752
  /**
@@ -754,7 +754,7 @@ function st(t) {
754
754
  * (i.e. excludes Array, Date, etc.).
755
755
  */
756
756
  /** Returns a string describing the type / value of the provided input. */
757
- function ot(t) {
757
+ function ut(t) {
758
758
  if (void 0 === t) return "undefined";
759
759
  if (null === t) return "null";
760
760
  if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
@@ -780,27 +780,27 @@ function ot(t) {
780
780
  return e ? `a custom ${e} object` : "an object";
781
781
  }
782
782
  }
783
- return "function" == typeof t ? "a function" : v();
783
+ return "function" == typeof t ? "a function" : b();
784
784
  }
785
785
 
786
- function ut(t,
786
+ function ct(t,
787
787
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
788
788
  e) {
789
789
  if ("_delegate" in t && (
790
790
  // Unwrap Compat types
791
791
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
792
792
  t = t._delegate), !(t instanceof e)) {
793
- if (e.name === t.constructor.name) throw new M(R, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
793
+ if (e.name === t.constructor.name) throw new U(P, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
794
794
  {
795
- const n = ot(t);
796
- throw new M(R, `Expected type '${e.name}', but it was: ${n}`);
795
+ const n = ut(t);
796
+ throw new U(P, `Expected type '${e.name}', but it was: ${n}`);
797
797
  }
798
798
  }
799
799
  return t;
800
800
  }
801
801
 
802
- function ct(t, e) {
803
- if (e <= 0) throw new M(R, `Function ${t}() requires a positive number, but it was: ${e}.`);
802
+ function at(t, e) {
803
+ if (e <= 0) throw new U(P, `Function ${t}() requires a positive number, but it was: ${e}.`);
804
804
  }
805
805
 
806
806
  /**
@@ -821,11 +821,11 @@ function ct(t, e) {
821
821
  */
822
822
  /**
823
823
  * Returns whether a variable is either undefined or null.
824
- */ function at(t) {
824
+ */ function ht(t) {
825
825
  return null == t;
826
826
  }
827
827
 
828
- /** Returns whether the value represents -0. */ function ht(t) {
828
+ /** Returns whether the value represents -0. */ function lt(t) {
829
829
  // Detect if the value is -0.0. Based on polyfill from
830
830
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
831
831
  return 0 === t && 1 / t == -1 / 0;
@@ -851,7 +851,7 @@ function ct(t, e) {
851
851
  * See the License for the specific language governing permissions and
852
852
  * limitations under the License.
853
853
  */
854
- const lt = {
854
+ const ft = {
855
855
  BatchGetDocuments: "batchGet",
856
856
  Commit: "commit",
857
857
  RunQuery: "runQuery",
@@ -889,7 +889,7 @@ const lt = {
889
889
  * are used for reverse lookups from the webchannel stream. Do NOT change the
890
890
  * names of these identifiers or change this into a const enum.
891
891
  */
892
- var ft, dt;
892
+ var dt, wt;
893
893
 
894
894
  /**
895
895
  * Converts an HTTP Status Code to the equivalent error code.
@@ -898,8 +898,8 @@ var ft, dt;
898
898
  * @returns The equivalent Code. Unknown status codes are mapped to
899
899
  * Code.UNKNOWN.
900
900
  */
901
- function wt(t) {
902
- if (void 0 === t) return y("RPC_ERROR", "HTTP error has no status"), A;
901
+ function mt(t) {
902
+ if (void 0 === t) return g("RPC_ERROR", "HTTP error has no status"), R;
903
903
  // The canonical error codes for Google APIs [1] specify mapping onto HTTP
904
904
  // status codes but the mapping is not bijective. In each case of ambiguity
905
905
  // this function chooses a primary error.
@@ -909,66 +909,66 @@ function wt(t) {
909
909
  switch (t) {
910
910
  case 200:
911
911
  // OK
912
- return I;
912
+ return T;
913
913
 
914
914
  case 400:
915
915
  // Bad Request
916
- return S;
916
+ return F;
917
917
 
918
918
  // Other possibilities based on the forward mapping
919
919
  // return Code.INVALID_ARGUMENT;
920
920
  // return Code.OUT_OF_RANGE;
921
921
  case 401:
922
922
  // Unauthorized
923
- return D;
923
+ return x;
924
924
 
925
925
  case 403:
926
926
  // Forbidden
927
- return $;
927
+ return D;
928
928
 
929
929
  case 404:
930
930
  // Not Found
931
- return V;
931
+ return N;
932
932
 
933
933
  case 409:
934
934
  // Conflict
935
- return F;
935
+ return q;
936
936
 
937
937
  // Other possibilities:
938
938
  // return Code.ALREADY_EXISTS;
939
939
  case 416:
940
940
  // Range Not Satisfiable
941
- return q;
941
+ return O;
942
942
 
943
943
  case 429:
944
944
  // Too Many Requests
945
- return x;
945
+ return S;
946
946
 
947
947
  case 499:
948
948
  // Client Closed Request
949
- return T;
949
+ return A;
950
950
 
951
951
  case 500:
952
952
  // Internal Server Error
953
- return A;
953
+ return R;
954
954
 
955
955
  // Other possibilities:
956
956
  // return Code.INTERNAL;
957
957
  // return Code.DATA_LOSS;
958
958
  case 501:
959
959
  // Unimplemented
960
- return O;
960
+ return k;
961
961
 
962
962
  case 503:
963
963
  // Service Unavailable
964
- return C;
964
+ return L;
965
965
 
966
966
  case 504:
967
967
  // Gateway Timeout
968
- return P;
968
+ return V;
969
969
 
970
970
  default:
971
- return t >= 200 && t < 300 ? I : t >= 400 && t < 500 ? S : t >= 500 && t < 600 ? k : A;
971
+ return t >= 200 && t < 300 ? T : t >= 400 && t < 500 ? F : t >= 500 && t < 600 ? C : R;
972
972
  }
973
973
  }
974
974
 
@@ -991,16 +991,16 @@ function wt(t) {
991
991
  /**
992
992
  * A Rest-based connection that relies on the native HTTP stack
993
993
  * (e.g. `fetch` or a polyfill).
994
- */ (dt = ft || (ft = {}))[dt.OK = 0] = "OK", dt[dt.CANCELLED = 1] = "CANCELLED",
995
- dt[dt.UNKNOWN = 2] = "UNKNOWN", dt[dt.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
996
- dt[dt.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", dt[dt.NOT_FOUND = 5] = "NOT_FOUND",
997
- dt[dt.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", dt[dt.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
998
- dt[dt.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", dt[dt.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
999
- dt[dt.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", dt[dt.ABORTED = 10] = "ABORTED",
1000
- dt[dt.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", dt[dt.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
1001
- dt[dt.INTERNAL = 13] = "INTERNAL", dt[dt.UNAVAILABLE = 14] = "UNAVAILABLE", dt[dt.DATA_LOSS = 15] = "DATA_LOSS";
994
+ */ (wt = dt || (dt = {}))[wt.OK = 0] = "OK", wt[wt.CANCELLED = 1] = "CANCELLED",
995
+ wt[wt.UNKNOWN = 2] = "UNKNOWN", wt[wt.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
996
+ wt[wt.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", wt[wt.NOT_FOUND = 5] = "NOT_FOUND",
997
+ wt[wt.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", wt[wt.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
998
+ wt[wt.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", wt[wt.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
999
+ wt[wt.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", wt[wt.ABORTED = 10] = "ABORTED",
1000
+ wt[wt.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", wt[wt.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
1001
+ wt[wt.INTERNAL = 13] = "INTERNAL", wt[wt.UNAVAILABLE = 14] = "UNAVAILABLE", wt[wt.DATA_LOSS = 15] = "DATA_LOSS";
1002
1002
 
1003
- class mt extends
1003
+ class pt extends
1004
1004
  /**
1005
1005
  * Base class for all Rest-based connections to the backend (WebChannel and
1006
1006
  * HTTP).
@@ -1018,9 +1018,9 @@ class {
1018
1018
  }
1019
1019
  I(t, e, n, r, s) {
1020
1020
  const i = this.T(t, e);
1021
- p("RestConnection", "Sending: ", i, n);
1021
+ y("RestConnection", "Sending: ", i, n);
1022
1022
  const o = {};
1023
- return this.A(o, r, s), this.R(t, i, o, n).then((t => (p("RestConnection", "Received: ", t),
1023
+ return this.A(o, r, s), this.R(t, i, o, n).then((t => (y("RestConnection", "Received: ", t),
1024
1024
  t)), (e => {
1025
1025
  throw _("RestConnection", `${t} failed with error: `, e, "url: ", i, "request:", n),
1026
1026
  e;
@@ -1035,7 +1035,7 @@ class {
1035
1035
  * Modifies the headers for a request, adding any authorization token if
1036
1036
  * present and any additional headers for the request.
1037
1037
  */ A(t, e, n) {
1038
- t["X-Goog-Api-Client"] = "gl-js/ fire/" + d,
1038
+ t["X-Goog-Api-Client"] = "gl-js/ fire/" + w,
1039
1039
  // Content-Type: text/plain will avoid preflight requests which might
1040
1040
  // mess with CORS and redirects by proxies. If we add custom headers
1041
1041
  // we will need to change this code to potentially use the $httpOverwrite
@@ -1044,7 +1044,7 @@ class {
1044
1044
  e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
1045
1045
  }
1046
1046
  T(t, e) {
1047
- const n = lt[t];
1047
+ const n = ft[t];
1048
1048
  return `${this.p}/v1/${e}:${n}`;
1049
1049
  }
1050
1050
  } {
@@ -1068,9 +1068,9 @@ class {
1068
1068
  body: s
1069
1069
  });
1070
1070
  } catch (t) {
1071
- throw new M(wt(t.status), "Request failed with error: " + t.statusText);
1071
+ throw new U(mt(t.status), "Request failed with error: " + t.statusText);
1072
1072
  }
1073
- if (!i.ok) throw new M(wt(i.status), "Request failed with error: " + i.statusText);
1073
+ if (!i.ok) throw new U(mt(i.status), "Request failed with error: " + i.statusText);
1074
1074
  return i.json();
1075
1075
  }
1076
1076
  }
@@ -1113,7 +1113,7 @@ class {
1113
1113
  *
1114
1114
  * If `nBytes < 0` , an error will be thrown.
1115
1115
  */
1116
- function pt(t) {
1116
+ function yt(t) {
1117
1117
  // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
1118
1118
  const e =
1119
1119
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1139,14 +1139,14 @@ function pt(t) {
1139
1139
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1140
1140
  * See the License for the specific language governing permissions and
1141
1141
  * limitations under the License.
1142
- */ class yt {
1142
+ */ class gt {
1143
1143
  static $() {
1144
1144
  // Alphanumeric characters
1145
1145
  const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
1146
1146
  // The largest byte value that is a multiple of `char.length`.
1147
1147
  let n = "";
1148
1148
  for (;n.length < 20; ) {
1149
- const r = pt(40);
1149
+ const r = yt(40);
1150
1150
  for (let s = 0; s < r.length; ++s)
1151
1151
  // Only accept values that are [0, maxMultiple), this ensures they can
1152
1152
  // be evenly mapped to indices of `chars` via a modulo operation.
@@ -1160,7 +1160,7 @@ function _t(t, e) {
1160
1160
  return t < e ? -1 : t > e ? 1 : 0;
1161
1161
  }
1162
1162
 
1163
- /** Helper to compare arrays using isEqual(). */ function gt(t, e, n) {
1163
+ /** Helper to compare arrays using isEqual(). */ function vt(t, e, n) {
1164
1164
  return t.length === e.length && t.every(((t, r) => n(t, e[r])));
1165
1165
  }
1166
1166
 
@@ -1195,7 +1195,7 @@ function _t(t, e) {
1195
1195
  * For examples and further specifications, refer to the
1196
1196
  * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
1197
1197
  */
1198
- class vt {
1198
+ class bt {
1199
1199
  /**
1200
1200
  * Creates a new timestamp.
1201
1201
  *
@@ -1216,18 +1216,18 @@ class vt {
1216
1216
  * The fractions of a second at nanosecond resolution.*
1217
1217
  */
1218
1218
  e) {
1219
- if (this.seconds = t, this.nanoseconds = e, e < 0) throw new M(R, "Timestamp nanoseconds out of range: " + e);
1220
- if (e >= 1e9) throw new M(R, "Timestamp nanoseconds out of range: " + e);
1221
- if (t < -62135596800) throw new M(R, "Timestamp seconds out of range: " + t);
1219
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(P, "Timestamp nanoseconds out of range: " + e);
1220
+ if (e >= 1e9) throw new U(P, "Timestamp nanoseconds out of range: " + e);
1221
+ if (t < -62135596800) throw new U(P, "Timestamp seconds out of range: " + t);
1222
1222
  // This will break in the year 10,000.
1223
- if (t >= 253402300800) throw new M(R, "Timestamp seconds out of range: " + t);
1223
+ if (t >= 253402300800) throw new U(P, "Timestamp seconds out of range: " + t);
1224
1224
  }
1225
1225
  /**
1226
1226
  * Creates a new timestamp with the current date, with millisecond precision.
1227
1227
  *
1228
1228
  * @returns a new timestamp representing the current date.
1229
1229
  */ static now() {
1230
- return vt.fromMillis(Date.now());
1230
+ return bt.fromMillis(Date.now());
1231
1231
  }
1232
1232
  /**
1233
1233
  * Creates a new timestamp from the given date.
@@ -1236,7 +1236,7 @@ class vt {
1236
1236
  * @returns A new `Timestamp` representing the same point in time as the given
1237
1237
  * date.
1238
1238
  */ static fromDate(t) {
1239
- return vt.fromMillis(t.getTime());
1239
+ return bt.fromMillis(t.getTime());
1240
1240
  }
1241
1241
  /**
1242
1242
  * Creates a new timestamp from the given number of milliseconds.
@@ -1247,7 +1247,7 @@ class vt {
1247
1247
  * number of milliseconds.
1248
1248
  */ static fromMillis(t) {
1249
1249
  const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
1250
- return new vt(e, n);
1250
+ return new bt(e, n);
1251
1251
  }
1252
1252
  /**
1253
1253
  * Converts a `Timestamp` to a JavaScript `Date` object. This conversion
@@ -1325,18 +1325,18 @@ class vt {
1325
1325
  /**
1326
1326
  * A version of a document in Firestore. This corresponds to the version
1327
1327
  * timestamp, such as update_time or read_time.
1328
- */ class bt {
1328
+ */ class Et {
1329
1329
  constructor(t) {
1330
1330
  this.timestamp = t;
1331
1331
  }
1332
1332
  static fromTimestamp(t) {
1333
- return new bt(t);
1333
+ return new Et(t);
1334
1334
  }
1335
1335
  static min() {
1336
- return new bt(new vt(0, 0));
1336
+ return new Et(new bt(0, 0));
1337
1337
  }
1338
1338
  static max() {
1339
- return new bt(new vt(253402300799, 999999999));
1339
+ return new Et(new bt(253402300799, 999999999));
1340
1340
  }
1341
1341
  compareTo(t) {
1342
1342
  return this.timestamp._compareTo(t.timestamp);
@@ -1371,13 +1371,13 @@ class vt {
1371
1371
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1372
1372
  * See the License for the specific language governing permissions and
1373
1373
  * limitations under the License.
1374
- */ function Et(t) {
1374
+ */ function It(t) {
1375
1375
  let e = 0;
1376
1376
  for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
1377
1377
  return e;
1378
1378
  }
1379
1379
 
1380
- function It(t, e) {
1380
+ function Tt(t, e) {
1381
1381
  for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
1382
1382
  }
1383
1383
 
@@ -1399,17 +1399,17 @@ function It(t, e) {
1399
1399
  */
1400
1400
  // An immutable sorted map implementation, based on a Left-leaning Red-Black
1401
1401
  // tree.
1402
- class Tt {
1402
+ class At {
1403
1403
  constructor(t, e) {
1404
- this.comparator = t, this.root = e || Rt.EMPTY;
1404
+ this.comparator = t, this.root = e || Pt.EMPTY;
1405
1405
  }
1406
1406
  // Returns a copy of the map, with the specified key/value added or replaced.
1407
1407
  insert(t, e) {
1408
- return new Tt(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, Rt.BLACK, null, null));
1408
+ return new At(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, Pt.BLACK, null, null));
1409
1409
  }
1410
1410
  // Returns a copy of the map, with the specified key removed.
1411
1411
  remove(t) {
1412
- return new Tt(this.comparator, this.root.remove(t, this.comparator).copy(null, null, Rt.BLACK, null, null));
1412
+ return new At(this.comparator, this.root.remove(t, this.comparator).copy(null, null, Pt.BLACK, null, null));
1413
1413
  }
1414
1414
  // Returns the value of the node with the given key, or null.
1415
1415
  get(t) {
@@ -1475,22 +1475,22 @@ class Tt {
1475
1475
  }
1476
1476
  // Returns an iterator over the SortedMap.
1477
1477
  getIterator() {
1478
- return new At(this.root, null, this.comparator, !1);
1478
+ return new Rt(this.root, null, this.comparator, !1);
1479
1479
  }
1480
1480
  getIteratorFrom(t) {
1481
- return new At(this.root, t, this.comparator, !1);
1481
+ return new Rt(this.root, t, this.comparator, !1);
1482
1482
  }
1483
1483
  getReverseIterator() {
1484
- return new At(this.root, null, this.comparator, !0);
1484
+ return new Rt(this.root, null, this.comparator, !0);
1485
1485
  }
1486
1486
  getReverseIteratorFrom(t) {
1487
- return new At(this.root, t, this.comparator, !0);
1487
+ return new Rt(this.root, t, this.comparator, !0);
1488
1488
  }
1489
1489
  }
1490
1490
 
1491
1491
  // end SortedMap
1492
1492
  // An iterator over an LLRBNode.
1493
- class At {
1493
+ class Rt {
1494
1494
  constructor(t, e, n, r) {
1495
1495
  this.isReverse = r, this.nodeStack = [];
1496
1496
  let s = 1;
@@ -1535,14 +1535,14 @@ class At {
1535
1535
 
1536
1536
  // end SortedMapIterator
1537
1537
  // Represents a node in a Left-leaning Red-Black tree.
1538
- class Rt {
1538
+ class Pt {
1539
1539
  constructor(t, e, n, r, s) {
1540
- this.key = t, this.value = e, this.color = null != n ? n : Rt.RED, this.left = null != r ? r : Rt.EMPTY,
1541
- this.right = null != s ? s : Rt.EMPTY, this.size = this.left.size + 1 + this.right.size;
1540
+ this.key = t, this.value = e, this.color = null != n ? n : Pt.RED, this.left = null != r ? r : Pt.EMPTY,
1541
+ this.right = null != s ? s : Pt.EMPTY, this.size = this.left.size + 1 + this.right.size;
1542
1542
  }
1543
1543
  // Returns a copy of the current node, optionally replacing pieces of it.
1544
1544
  copy(t, e, n, r, s) {
1545
- return new Rt(null != t ? t : this.key, null != e ? e : this.value, null != n ? n : this.color, null != r ? r : this.left, null != s ? s : this.right);
1545
+ return new Pt(null != t ? t : this.key, null != e ? e : this.value, null != n ? n : this.color, null != r ? r : this.left, null != s ? s : this.right);
1546
1546
  }
1547
1547
  isEmpty() {
1548
1548
  return !1;
@@ -1581,7 +1581,7 @@ class Rt {
1581
1581
  r.fixUp();
1582
1582
  }
1583
1583
  removeMin() {
1584
- if (this.left.isEmpty()) return Rt.EMPTY;
1584
+ if (this.left.isEmpty()) return Pt.EMPTY;
1585
1585
  let t = this;
1586
1586
  return t.left.isRed() || t.left.left.isRed() || (t = t.moveRedLeft()), t = t.copy(null, null, null, t.left.removeMin(), null),
1587
1587
  t.fixUp();
@@ -1593,7 +1593,7 @@ class Rt {
1593
1593
  r = r.copy(null, null, null, r.left.remove(t, e), null); else {
1594
1594
  if (r.left.isRed() && (r = r.rotateRight()), r.right.isEmpty() || r.right.isRed() || r.right.left.isRed() || (r = r.moveRedRight()),
1595
1595
  0 === e(t, r.key)) {
1596
- if (r.right.isEmpty()) return Rt.EMPTY;
1596
+ if (r.right.isEmpty()) return Pt.EMPTY;
1597
1597
  n = r.right.min(), r = r.copy(n.key, n.value, null, null, r.right.removeMin());
1598
1598
  }
1599
1599
  r = r.copy(null, null, null, null, r.right.remove(t, e));
@@ -1619,11 +1619,11 @@ class Rt {
1619
1619
  return t.left.left.isRed() && (t = t.rotateRight(), t = t.colorFlip()), t;
1620
1620
  }
1621
1621
  rotateLeft() {
1622
- const t = this.copy(null, null, Rt.RED, null, this.right.left);
1622
+ const t = this.copy(null, null, Pt.RED, null, this.right.left);
1623
1623
  return this.right.copy(null, null, this.color, t, null);
1624
1624
  }
1625
1625
  rotateRight() {
1626
- const t = this.copy(null, null, Rt.RED, this.left.right, null);
1626
+ const t = this.copy(null, null, Pt.RED, this.left.right, null);
1627
1627
  return this.left.copy(null, null, this.color, null, t);
1628
1628
  }
1629
1629
  colorFlip() {
@@ -1638,10 +1638,10 @@ class Rt {
1638
1638
  // In a balanced RB tree, the black-depth (number of black nodes) from root to
1639
1639
  // leaves is equal on both sides. This function verifies that or asserts.
1640
1640
  check() {
1641
- if (this.isRed() && this.left.isRed()) throw v();
1642
- if (this.right.isRed()) throw v();
1641
+ if (this.isRed() && this.left.isRed()) throw b();
1642
+ if (this.right.isRed()) throw b();
1643
1643
  const t = this.left.check();
1644
- if (t !== this.right.check()) throw v();
1644
+ if (t !== this.right.check()) throw b();
1645
1645
  return t + (this.isRed() ? 0 : 1);
1646
1646
  }
1647
1647
  }
@@ -1649,29 +1649,29 @@ class Rt {
1649
1649
  // end LLRBNode
1650
1650
  // Empty node is shared between all LLRB trees.
1651
1651
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1652
- Rt.EMPTY = null, Rt.RED = !0, Rt.BLACK = !1;
1652
+ Pt.EMPTY = null, Pt.RED = !0, Pt.BLACK = !1;
1653
1653
 
1654
1654
  // end LLRBEmptyNode
1655
- Rt.EMPTY = new
1655
+ Pt.EMPTY = new
1656
1656
  // Represents an empty node (a leaf node in the Red-Black Tree).
1657
1657
  class {
1658
1658
  constructor() {
1659
1659
  this.size = 0;
1660
1660
  }
1661
1661
  get key() {
1662
- throw v();
1662
+ throw b();
1663
1663
  }
1664
1664
  get value() {
1665
- throw v();
1665
+ throw b();
1666
1666
  }
1667
1667
  get color() {
1668
- throw v();
1668
+ throw b();
1669
1669
  }
1670
1670
  get left() {
1671
- throw v();
1671
+ throw b();
1672
1672
  }
1673
1673
  get right() {
1674
- throw v();
1674
+ throw b();
1675
1675
  }
1676
1676
  // Returns a copy of the current node.
1677
1677
  copy(t, e, n, r, s) {
@@ -1679,7 +1679,7 @@ class {
1679
1679
  }
1680
1680
  // Returns a copy of the tree, with the specified key/value added.
1681
1681
  insert(t, e, n) {
1682
- return new Rt(t, e);
1682
+ return new Pt(t, e);
1683
1683
  }
1684
1684
  // Returns a copy of the tree, with the specified key removed.
1685
1685
  remove(t, e) {
@@ -1735,9 +1735,9 @@ class {
1735
1735
  * NOTE: if provided comparator returns 0 for two elements, we consider them to
1736
1736
  * be equal!
1737
1737
  */
1738
- class Pt {
1738
+ class Vt {
1739
1739
  constructor(t) {
1740
- this.comparator = t, this.data = new Tt(this.comparator);
1740
+ this.comparator = t, this.data = new At(this.comparator);
1741
1741
  }
1742
1742
  has(t) {
1743
1743
  return null !== this.data.get(t);
@@ -1778,10 +1778,10 @@ class Pt {
1778
1778
  return e.hasNext() ? e.getNext().key : null;
1779
1779
  }
1780
1780
  getIterator() {
1781
- return new Vt(this.data.getIterator());
1781
+ return new Nt(this.data.getIterator());
1782
1782
  }
1783
1783
  getIteratorFrom(t) {
1784
- return new Vt(this.data.getIteratorFrom(t));
1784
+ return new Nt(this.data.getIteratorFrom(t));
1785
1785
  }
1786
1786
  /** Inserts or updates an element */ add(t) {
1787
1787
  return this.copy(this.data.remove(t).insert(t, !0));
@@ -1800,7 +1800,7 @@ class Pt {
1800
1800
  })), e;
1801
1801
  }
1802
1802
  isEqual(t) {
1803
- if (!(t instanceof Pt)) return !1;
1803
+ if (!(t instanceof Vt)) return !1;
1804
1804
  if (this.size !== t.size) return !1;
1805
1805
  const e = this.data.getIterator(), n = t.data.getIterator();
1806
1806
  for (;e.hasNext(); ) {
@@ -1820,12 +1820,12 @@ class Pt {
1820
1820
  return this.forEach((e => t.push(e))), "SortedSet(" + t.toString() + ")";
1821
1821
  }
1822
1822
  copy(t) {
1823
- const e = new Pt(this.comparator);
1823
+ const e = new Vt(this.comparator);
1824
1824
  return e.data = t, e;
1825
1825
  }
1826
1826
  }
1827
1827
 
1828
- class Vt {
1828
+ class Nt {
1829
1829
  constructor(t) {
1830
1830
  this.iter = t;
1831
1831
  }
@@ -1862,24 +1862,24 @@ class Vt {
1862
1862
  * foo.bar - Overwrites only the field bar of the object foo.
1863
1863
  * If foo is not an object, foo is replaced with an object
1864
1864
  * containing foo
1865
- */ class Nt {
1865
+ */ class $t {
1866
1866
  constructor(t) {
1867
1867
  this.fields = t,
1868
1868
  // TODO(dimond): validation of FieldMask
1869
1869
  // Sort the field mask to support `FieldMask.isEqual()` and assert below.
1870
- t.sort(et.comparator);
1870
+ t.sort(nt.comparator);
1871
1871
  }
1872
1872
  static empty() {
1873
- return new Nt([]);
1873
+ return new $t([]);
1874
1874
  }
1875
1875
  /**
1876
1876
  * Returns a new FieldMask object that is the result of adding all the given
1877
1877
  * fields paths to this field mask.
1878
1878
  */ unionWith(t) {
1879
- let e = new Pt(et.comparator);
1879
+ let e = new Vt(nt.comparator);
1880
1880
  for (const t of this.fields) e = e.add(t);
1881
1881
  for (const n of t) e = e.add(n);
1882
- return new Nt(e.toArray());
1882
+ return new $t(e.toArray());
1883
1883
  }
1884
1884
  /**
1885
1885
  * Verifies that `fieldPath` is included by at least one field in this field
@@ -1891,7 +1891,7 @@ class Vt {
1891
1891
  return !1;
1892
1892
  }
1893
1893
  isEqual(t) {
1894
- return gt(this.fields, t.fields, ((t, e) => t.isEqual(e)));
1894
+ return vt(this.fields, t.fields, ((t, e) => t.isEqual(e)));
1895
1895
  }
1896
1896
  }
1897
1897
 
@@ -1914,7 +1914,7 @@ class Vt {
1914
1914
  // WebSafe uses a different URL-encoding safe alphabet that doesn't match
1915
1915
  // the encoding used on the backend.
1916
1916
  /** Converts a Base64 encoded string to a binary string. */
1917
- function $t(t) {
1917
+ function Dt(t) {
1918
1918
  return String.fromCharCode.apply(null,
1919
1919
  // We use `decodeStringToByteArray()` instead of `decodeString()` since
1920
1920
  // `decodeString()` returns Unicode strings, which doesn't match the values
@@ -1948,13 +1948,13 @@ function $t(t) {
1948
1948
  * before being sent as a proto.
1949
1949
  * @internal
1950
1950
  */
1951
- class Dt {
1951
+ class xt {
1952
1952
  constructor(t) {
1953
1953
  this.binaryString = t;
1954
1954
  }
1955
1955
  static fromBase64String(t) {
1956
- const e = $t(t);
1957
- return new Dt(e);
1956
+ const e = Dt(t);
1957
+ return new xt(e);
1958
1958
  }
1959
1959
  static fromUint8Array(t) {
1960
1960
  // TODO(indexing); Remove the copy of the byte string here as this method
@@ -1971,7 +1971,7 @@ class Dt {
1971
1971
  /**
1972
1972
  * Helper function to convert a binary string to an Uint8Array.
1973
1973
  */ (t);
1974
- return new Dt(e);
1974
+ return new xt(e);
1975
1975
  }
1976
1976
  [Symbol.iterator]() {
1977
1977
  let t = 0;
@@ -2028,24 +2028,24 @@ class Dt {
2028
2028
  }
2029
2029
  }
2030
2030
 
2031
- Dt.EMPTY_BYTE_STRING = new Dt("");
2031
+ xt.EMPTY_BYTE_STRING = new xt("");
2032
2032
 
2033
- const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2033
+ const St = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2034
2034
 
2035
2035
  /**
2036
2036
  * Converts the possible Proto values for a timestamp value into a "seconds and
2037
2037
  * nanos" representation.
2038
- */ function St(t) {
2038
+ */ function Ft(t) {
2039
2039
  // The json interface (for the browser) will return an iso timestamp string,
2040
2040
  // while the proto js library (for node) will return a
2041
2041
  // google.protobuf.Timestamp instance.
2042
- if (b(!!t), "string" == typeof t) {
2042
+ if (E(!!t), "string" == typeof t) {
2043
2043
  // The date string can have higher precision (nanos) than the Date class
2044
2044
  // (millis), so we do some custom parsing here.
2045
2045
  // Parse the nanos right out of the string.
2046
2046
  let e = 0;
2047
- const n = xt.exec(t);
2048
- if (b(!!n), n[1]) {
2047
+ const n = St.exec(t);
2048
+ if (E(!!n), n[1]) {
2049
2049
  // Pad the fraction out to 9 digits (nanos).
2050
2050
  let t = n[1];
2051
2051
  t = (t + "000000000").substr(0, 9), e = Number(t);
@@ -2058,21 +2058,21 @@ const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2058
2058
  };
2059
2059
  }
2060
2060
  return {
2061
- seconds: Ft(t.seconds),
2062
- nanos: Ft(t.nanos)
2061
+ seconds: qt(t.seconds),
2062
+ nanos: qt(t.nanos)
2063
2063
  };
2064
2064
  }
2065
2065
 
2066
2066
  /**
2067
2067
  * Converts the possible Proto types for numbers into a JavaScript number.
2068
2068
  * Returns 0 if the value is not numeric.
2069
- */ function Ft(t) {
2069
+ */ function qt(t) {
2070
2070
  // TODO(bjornick): Handle int64 greater than 53 bits.
2071
2071
  return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
2072
2072
  }
2073
2073
 
2074
- /** Converts the possible Proto types for Blobs into a ByteString. */ function qt(t) {
2075
- return "string" == typeof t ? Dt.fromBase64String(t) : Dt.fromUint8Array(t);
2074
+ /** Converts the possible Proto types for Blobs into a ByteString. */ function Ot(t) {
2075
+ return "string" == typeof t ? xt.fromBase64String(t) : xt.fromUint8Array(t);
2076
2076
  }
2077
2077
 
2078
2078
  /**
@@ -2108,7 +2108,7 @@ const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2108
2108
  * FieldValueOptions to value().
2109
2109
  * - With respect to other ServerTimestampValues, they sort by their
2110
2110
  * localWriteTime.
2111
- */ function Ot(t) {
2111
+ */ function kt(t) {
2112
2112
  var e, n;
2113
2113
  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);
2114
2114
  }
@@ -2118,16 +2118,16 @@ const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2118
2118
  *
2119
2119
  * Preserving the previous values allows the user to display the last resoled
2120
2120
  * value until the backend responds with the timestamp.
2121
- */ function kt(t) {
2121
+ */ function Ct(t) {
2122
2122
  const e = t.mapValue.fields.__previous_value__;
2123
- return Ot(e) ? kt(e) : e;
2123
+ return kt(e) ? Ct(e) : e;
2124
2124
  }
2125
2125
 
2126
2126
  /**
2127
2127
  * Returns the local time at which this timestamp was first set.
2128
- */ function Ct(t) {
2129
- const e = St(t.mapValue.fields.__local_write_time__.timestampValue);
2130
- return new vt(e.seconds, e.nanos);
2128
+ */ function Lt(t) {
2129
+ const e = Ft(t.mapValue.fields.__local_write_time__.timestampValue);
2130
+ return new bt(e.seconds, e.nanos);
2131
2131
  }
2132
2132
 
2133
2133
  /**
@@ -2145,7 +2145,7 @@ const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2145
2145
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2146
2146
  * See the License for the specific language governing permissions and
2147
2147
  * limitations under the License.
2148
- */ const Lt = {
2148
+ */ const Mt = {
2149
2149
  fields: {
2150
2150
  __type__: {
2151
2151
  stringValue: "__max__"
@@ -2154,8 +2154,8 @@ const xt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2154
2154
  };
2155
2155
 
2156
2156
  /** Extracts the backend's type order for the provided value. */
2157
- function Mt(t) {
2158
- 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 ? Ot(t) ? 4 /* ServerTimestampValue */ :
2157
+ function Ut(t) {
2158
+ 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 ? kt(t) ? 4 /* ServerTimestampValue */ :
2159
2159
  /** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
2160
2160
  function(t) {
2161
2161
  return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
@@ -2179,13 +2179,13 @@ function Mt(t) {
2179
2179
  /**
2180
2180
  * An ObjectValue represents a MapValue in the Firestore Proto and offers the
2181
2181
  * ability to add and remove fields (via the ObjectValueBuilder).
2182
- */ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : v();
2182
+ */ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : b();
2183
2183
  }
2184
2184
 
2185
- /** Tests `left` and `right` for equality based on the backend semantics. */ function Ut(t, e) {
2185
+ /** Tests `left` and `right` for equality based on the backend semantics. */ function jt(t, e) {
2186
2186
  if (t === e) return !0;
2187
- const n = Mt(t);
2188
- if (n !== Mt(e)) return !1;
2187
+ const n = Ut(t);
2188
+ if (n !== Ut(e)) return !1;
2189
2189
  switch (n) {
2190
2190
  case 0 /* NullValue */ :
2191
2191
  case 9007199254740991 /* MaxValue */ :
@@ -2195,14 +2195,14 @@ function Mt(t) {
2195
2195
  return t.booleanValue === e.booleanValue;
2196
2196
 
2197
2197
  case 4 /* ServerTimestampValue */ :
2198
- return Ct(t).isEqual(Ct(e));
2198
+ return Lt(t).isEqual(Lt(e));
2199
2199
 
2200
2200
  case 3 /* TimestampValue */ :
2201
2201
  return function(t, e) {
2202
2202
  if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
2203
2203
  // Use string equality for ISO 8601 timestamps
2204
2204
  return t.timestampValue === e.timestampValue;
2205
- const n = St(t.timestampValue), r = St(e.timestampValue);
2205
+ const n = Ft(t.timestampValue), r = Ft(e.timestampValue);
2206
2206
  return n.seconds === r.seconds && n.nanos === r.nanos;
2207
2207
  }(t, e);
2208
2208
 
@@ -2211,7 +2211,7 @@ function Mt(t) {
2211
2211
 
2212
2212
  case 6 /* BlobValue */ :
2213
2213
  return function(t, e) {
2214
- return qt(t.bytesValue).isEqual(qt(e.bytesValue));
2214
+ return Ot(t.bytesValue).isEqual(Ot(e.bytesValue));
2215
2215
  }(t, e);
2216
2216
 
2217
2217
  case 7 /* RefValue */ :
@@ -2219,43 +2219,43 @@ function Mt(t) {
2219
2219
 
2220
2220
  case 8 /* GeoPointValue */ :
2221
2221
  return function(t, e) {
2222
- return Ft(t.geoPointValue.latitude) === Ft(e.geoPointValue.latitude) && Ft(t.geoPointValue.longitude) === Ft(e.geoPointValue.longitude);
2222
+ return qt(t.geoPointValue.latitude) === qt(e.geoPointValue.latitude) && qt(t.geoPointValue.longitude) === qt(e.geoPointValue.longitude);
2223
2223
  }(t, e);
2224
2224
 
2225
2225
  case 2 /* NumberValue */ :
2226
2226
  return function(t, e) {
2227
- if ("integerValue" in t && "integerValue" in e) return Ft(t.integerValue) === Ft(e.integerValue);
2227
+ if ("integerValue" in t && "integerValue" in e) return qt(t.integerValue) === qt(e.integerValue);
2228
2228
  if ("doubleValue" in t && "doubleValue" in e) {
2229
- const n = Ft(t.doubleValue), r = Ft(e.doubleValue);
2230
- return n === r ? ht(n) === ht(r) : isNaN(n) && isNaN(r);
2229
+ const n = qt(t.doubleValue), r = qt(e.doubleValue);
2230
+ return n === r ? lt(n) === lt(r) : isNaN(n) && isNaN(r);
2231
2231
  }
2232
2232
  return !1;
2233
2233
  }(t, e);
2234
2234
 
2235
2235
  case 9 /* ArrayValue */ :
2236
- return gt(t.arrayValue.values || [], e.arrayValue.values || [], Ut);
2236
+ return vt(t.arrayValue.values || [], e.arrayValue.values || [], jt);
2237
2237
 
2238
2238
  case 10 /* ObjectValue */ :
2239
2239
  return function(t, e) {
2240
2240
  const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
2241
- if (Et(n) !== Et(r)) return !1;
2242
- for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ut(n[t], r[t]))) return !1;
2241
+ if (It(n) !== It(r)) return !1;
2242
+ for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !jt(n[t], r[t]))) return !1;
2243
2243
  return !0;
2244
2244
  }
2245
2245
  /** Returns true if the ArrayValue contains the specified element. */ (t, e);
2246
2246
 
2247
2247
  default:
2248
- return v();
2248
+ return b();
2249
2249
  }
2250
2250
  }
2251
2251
 
2252
- function jt(t, e) {
2253
- return void 0 !== (t.values || []).find((t => Ut(t, e)));
2252
+ function Bt(t, e) {
2253
+ return void 0 !== (t.values || []).find((t => jt(t, e)));
2254
2254
  }
2255
2255
 
2256
- function Bt(t, e) {
2256
+ function Qt(t, e) {
2257
2257
  if (t === e) return 0;
2258
- const n = Mt(t), r = Mt(e);
2258
+ const n = Ut(t), r = Ut(e);
2259
2259
  if (n !== r) return _t(n, r);
2260
2260
  switch (n) {
2261
2261
  case 0 /* NullValue */ :
@@ -2267,7 +2267,7 @@ function Bt(t, e) {
2267
2267
 
2268
2268
  case 2 /* NumberValue */ :
2269
2269
  return function(t, e) {
2270
- const n = Ft(t.integerValue || t.doubleValue), r = Ft(e.integerValue || e.doubleValue);
2270
+ const n = qt(t.integerValue || t.doubleValue), r = qt(e.integerValue || e.doubleValue);
2271
2271
  return n < r ? -1 : n > r ? 1 : n === r ? 0 :
2272
2272
  // one or both are NaN.
2273
2273
  isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
@@ -2277,14 +2277,14 @@ function Bt(t, e) {
2277
2277
  return zt(t.timestampValue, e.timestampValue);
2278
2278
 
2279
2279
  case 4 /* ServerTimestampValue */ :
2280
- return zt(Ct(t), Ct(e));
2280
+ return zt(Lt(t), Lt(e));
2281
2281
 
2282
2282
  case 5 /* StringValue */ :
2283
2283
  return _t(t.stringValue, e.stringValue);
2284
2284
 
2285
2285
  case 6 /* BlobValue */ :
2286
2286
  return function(t, e) {
2287
- const n = qt(t), r = qt(e);
2287
+ const n = Ot(t), r = Ot(e);
2288
2288
  return n.compareTo(r);
2289
2289
  }(t.bytesValue, e.bytesValue);
2290
2290
 
@@ -2300,16 +2300,16 @@ function Bt(t, e) {
2300
2300
 
2301
2301
  case 8 /* GeoPointValue */ :
2302
2302
  return function(t, e) {
2303
- const n = _t(Ft(t.latitude), Ft(e.latitude));
2303
+ const n = _t(qt(t.latitude), qt(e.latitude));
2304
2304
  if (0 !== n) return n;
2305
- return _t(Ft(t.longitude), Ft(e.longitude));
2305
+ return _t(qt(t.longitude), qt(e.longitude));
2306
2306
  }(t.geoPointValue, e.geoPointValue);
2307
2307
 
2308
2308
  case 9 /* ArrayValue */ :
2309
2309
  return function(t, e) {
2310
2310
  const n = t.values || [], r = e.values || [];
2311
2311
  for (let t = 0; t < n.length && t < r.length; ++t) {
2312
- const e = Bt(n[t], r[t]);
2312
+ const e = Qt(n[t], r[t]);
2313
2313
  if (e) return e;
2314
2314
  }
2315
2315
  return _t(n.length, r.length);
@@ -2317,9 +2317,9 @@ function Bt(t, e) {
2317
2317
 
2318
2318
  case 10 /* ObjectValue */ :
2319
2319
  return function(t, e) {
2320
- if (t === Lt && e === Lt) return 0;
2321
- if (t === Lt) return 1;
2322
- if (e === Lt) return -1;
2320
+ if (t === Mt && e === Mt) return 0;
2321
+ if (t === Mt) return 1;
2322
+ if (e === Mt) return -1;
2323
2323
  const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
2324
2324
  // Even though MapValues are likely sorted correctly based on their insertion
2325
2325
  // order (e.g. when received from the backend), local modifications can bring
@@ -2329,7 +2329,7 @@ function Bt(t, e) {
2329
2329
  for (let t = 0; t < r.length && t < i.length; ++t) {
2330
2330
  const e = _t(r[t], i[t]);
2331
2331
  if (0 !== e) return e;
2332
- const o = Bt(n[r[t]], s[i[t]]);
2332
+ const o = Qt(n[r[t]], s[i[t]]);
2333
2333
  if (0 !== o) return o;
2334
2334
  }
2335
2335
  return _t(r.length, i.length);
@@ -2337,39 +2337,39 @@ function Bt(t, e) {
2337
2337
  /** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
2338
2338
 
2339
2339
  default:
2340
- throw v();
2340
+ throw b();
2341
2341
  }
2342
2342
  }
2343
2343
 
2344
2344
  function zt(t, e) {
2345
2345
  if ("string" == typeof t && "string" == typeof e && t.length === e.length) return _t(t, e);
2346
- const n = St(t), r = St(e), s = _t(n.seconds, r.seconds);
2346
+ const n = Ft(t), r = Ft(e), s = _t(n.seconds, r.seconds);
2347
2347
  return 0 !== s ? s : _t(n.nanos, r.nanos);
2348
2348
  }
2349
2349
 
2350
- function Qt(t, e) {
2350
+ function Wt(t, e) {
2351
2351
  return {
2352
2352
  referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
2353
2353
  };
2354
2354
  }
2355
2355
 
2356
- /** Returns true if `value` is an ArrayValue. */ function Wt(t) {
2356
+ /** Returns true if `value` is an ArrayValue. */ function Gt(t) {
2357
2357
  return !!t && "arrayValue" in t;
2358
2358
  }
2359
2359
 
2360
- /** Returns true if `value` is a NullValue. */ function Gt(t) {
2360
+ /** Returns true if `value` is a NullValue. */ function Kt(t) {
2361
2361
  return !!t && "nullValue" in t;
2362
2362
  }
2363
2363
 
2364
- /** Returns true if `value` is NaN. */ function Kt(t) {
2364
+ /** Returns true if `value` is NaN. */ function Yt(t) {
2365
2365
  return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
2366
2366
  }
2367
2367
 
2368
- /** Returns true if `value` is a MapValue. */ function Yt(t) {
2368
+ /** Returns true if `value` is a MapValue. */ function Ht(t) {
2369
2369
  return !!t && "mapValue" in t;
2370
2370
  }
2371
2371
 
2372
- /** Creates a deep copy of `source`. */ function Ht(t) {
2372
+ /** Creates a deep copy of `source`. */ function Jt(t) {
2373
2373
  if (t.geoPointValue) return {
2374
2374
  geoPointValue: Object.assign({}, t.geoPointValue)
2375
2375
  };
@@ -2382,7 +2382,7 @@ function Qt(t, e) {
2382
2382
  fields: {}
2383
2383
  }
2384
2384
  };
2385
- return It(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Ht(n))), e;
2385
+ return Tt(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Jt(n))), e;
2386
2386
  }
2387
2387
  if (t.arrayValue) {
2388
2388
  const e = {
@@ -2390,18 +2390,18 @@ function Qt(t, e) {
2390
2390
  values: []
2391
2391
  }
2392
2392
  };
2393
- for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Ht(t.arrayValue.values[n]);
2393
+ for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Jt(t.arrayValue.values[n]);
2394
2394
  return e;
2395
2395
  }
2396
2396
  return Object.assign({}, t);
2397
2397
  }
2398
2398
 
2399
- class Jt {
2399
+ class Xt {
2400
2400
  constructor(t) {
2401
2401
  this.value = t;
2402
2402
  }
2403
2403
  static empty() {
2404
- return new Jt({
2404
+ return new Xt({
2405
2405
  mapValue: {}
2406
2406
  });
2407
2407
  }
@@ -2415,7 +2415,7 @@ class Jt {
2415
2415
  {
2416
2416
  let e = this.value;
2417
2417
  for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
2418
- !Yt(e)) return null;
2418
+ !Ht(e)) return null;
2419
2419
  return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
2420
2420
  }
2421
2421
  }
@@ -2425,21 +2425,21 @@ class Jt {
2425
2425
  * @param path - The field path to set.
2426
2426
  * @param value - The value to set.
2427
2427
  */ set(t, e) {
2428
- this.getFieldsMap(t.popLast())[t.lastSegment()] = Ht(e);
2428
+ this.getFieldsMap(t.popLast())[t.lastSegment()] = Jt(e);
2429
2429
  }
2430
2430
  /**
2431
2431
  * Sets the provided fields to the provided values.
2432
2432
  *
2433
2433
  * @param data - A map of fields to values (or null for deletes).
2434
2434
  */ setAll(t) {
2435
- let e = et.emptyPath(), n = {}, r = [];
2435
+ let e = nt.emptyPath(), n = {}, r = [];
2436
2436
  t.forEach(((t, s) => {
2437
2437
  if (!e.isImmediateParentOf(s)) {
2438
2438
  // Insert the accumulated changes at this parent location
2439
2439
  const t = this.getFieldsMap(e);
2440
2440
  this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
2441
2441
  }
2442
- t ? n[s.lastSegment()] = Ht(t) : r.push(s.lastSegment());
2442
+ t ? n[s.lastSegment()] = Jt(t) : r.push(s.lastSegment());
2443
2443
  }));
2444
2444
  const s = this.getFieldsMap(e);
2445
2445
  this.applyChanges(s, n, r);
@@ -2451,10 +2451,10 @@ class Jt {
2451
2451
  * @param path - The field path to remove.
2452
2452
  */ delete(t) {
2453
2453
  const e = this.field(t.popLast());
2454
- Yt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
2454
+ Ht(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
2455
2455
  }
2456
2456
  isEqual(t) {
2457
- return Ut(this.value, t.value);
2457
+ return jt(this.value, t.value);
2458
2458
  }
2459
2459
  /**
2460
2460
  * Returns the map that contains the leaf element of `path`. If the parent
@@ -2466,7 +2466,7 @@ class Jt {
2466
2466
  });
2467
2467
  for (let n = 0; n < t.length; ++n) {
2468
2468
  let r = e.mapValue.fields[t.get(n)];
2469
- Yt(r) && r.mapValue.fields || (r = {
2469
+ Ht(r) && r.mapValue.fields || (r = {
2470
2470
  mapValue: {
2471
2471
  fields: {}
2472
2472
  }
@@ -2478,11 +2478,11 @@ class Jt {
2478
2478
  * Modifies `fieldsMap` by adding, replacing or deleting the specified
2479
2479
  * entries.
2480
2480
  */ applyChanges(t, e, n) {
2481
- It(e, ((e, n) => t[e] = n));
2481
+ Tt(e, ((e, n) => t[e] = n));
2482
2482
  for (const e of n) delete t[e];
2483
2483
  }
2484
2484
  clone() {
2485
- return new Jt(Ht(this.value));
2485
+ return new Xt(Jt(this.value));
2486
2486
  }
2487
2487
  }
2488
2488
 
@@ -2511,7 +2511,7 @@ class Jt {
2511
2511
  * not transition to one of these states even after all mutations have been
2512
2512
  * applied, `isValidDocument()` returns false and the document should be removed
2513
2513
  * from all views.
2514
- */ class Xt {
2514
+ */ class Zt {
2515
2515
  constructor(t, e, n, r, s, i) {
2516
2516
  this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
2517
2517
  this.documentState = i;
@@ -2520,23 +2520,23 @@ class Jt {
2520
2520
  * Creates a document with no known version or data, but which can serve as
2521
2521
  * base document for mutations.
2522
2522
  */ static newInvalidDocument(t) {
2523
- return new Xt(t, 0 /* INVALID */ , bt.min(), bt.min(), Jt.empty(), 0 /* SYNCED */);
2523
+ return new Zt(t, 0 /* INVALID */ , Et.min(), Et.min(), Xt.empty(), 0 /* SYNCED */);
2524
2524
  }
2525
2525
  /**
2526
2526
  * Creates a new document that is known to exist with the given data at the
2527
2527
  * given version.
2528
2528
  */ static newFoundDocument(t, e, n) {
2529
- return new Xt(t, 1 /* FOUND_DOCUMENT */ , e, bt.min(), n, 0 /* SYNCED */);
2529
+ return new Zt(t, 1 /* FOUND_DOCUMENT */ , e, Et.min(), n, 0 /* SYNCED */);
2530
2530
  }
2531
2531
  /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
2532
- return new Xt(t, 2 /* NO_DOCUMENT */ , e, bt.min(), Jt.empty(), 0 /* SYNCED */);
2532
+ return new Zt(t, 2 /* NO_DOCUMENT */ , e, Et.min(), Xt.empty(), 0 /* SYNCED */);
2533
2533
  }
2534
2534
  /**
2535
2535
  * Creates a new document that is known to exist at the given version but
2536
2536
  * whose data is not known (e.g. a document that was updated without a known
2537
2537
  * base document).
2538
2538
  */ static newUnknownDocument(t, e) {
2539
- return new Xt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.min(), Jt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2539
+ return new Zt(t, 3 /* UNKNOWN_DOCUMENT */ , e, Et.min(), Xt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2540
2540
  }
2541
2541
  /**
2542
2542
  * Changes the document type to indicate that it exists and that its version
@@ -2549,7 +2549,7 @@ class Jt {
2549
2549
  * Changes the document type to indicate that it doesn't exist at the given
2550
2550
  * version.
2551
2551
  */ convertToNoDocument(t) {
2552
- return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Jt.empty(),
2552
+ return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Xt.empty(),
2553
2553
  this.documentState = 0 /* SYNCED */ , this;
2554
2554
  }
2555
2555
  /**
@@ -2557,14 +2557,14 @@ class Jt {
2557
2557
  * that its data is not known (e.g. a document that was updated without a known
2558
2558
  * base document).
2559
2559
  */ convertToUnknownDocument(t) {
2560
- return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Jt.empty(),
2560
+ return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Xt.empty(),
2561
2561
  this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2562
2562
  }
2563
2563
  setHasCommittedMutations() {
2564
2564
  return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2565
2565
  }
2566
2566
  setHasLocalMutations() {
2567
- return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = bt.min(),
2567
+ return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = Et.min(),
2568
2568
  this;
2569
2569
  }
2570
2570
  setReadTime(t) {
@@ -2592,10 +2592,10 @@ class Jt {
2592
2592
  return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
2593
2593
  }
2594
2594
  isEqual(t) {
2595
- return t instanceof Xt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2595
+ return t instanceof Zt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2596
2596
  }
2597
2597
  mutableCopy() {
2598
- return new Xt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2598
+ return new Zt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2599
2599
  }
2600
2600
  toString() {
2601
2601
  return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
@@ -2619,7 +2619,7 @@ class Jt {
2619
2619
  * limitations under the License.
2620
2620
  */
2621
2621
  // Visible for testing
2622
- class Zt {
2622
+ class te {
2623
2623
  constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2624
2624
  this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
2625
2625
  this.startAt = i, this.endAt = o, this.D = null;
@@ -2633,26 +2633,26 @@ class Zt {
2633
2633
  * NOTE: you should always construct `Target` from `Query.toTarget` instead of
2634
2634
  * using this factory method, because `Query` provides an implicit `orderBy`
2635
2635
  * property.
2636
- */ function te(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2637
- return new Zt(t, e, n, r, s, i, o);
2636
+ */ function ee(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2637
+ return new te(t, e, n, r, s, i, o);
2638
2638
  }
2639
2639
 
2640
- class ee extends class {} {
2640
+ class ne extends class {} {
2641
2641
  constructor(t, e, n) {
2642
2642
  super(), this.field = t, this.op = e, this.value = n;
2643
2643
  }
2644
2644
  /**
2645
2645
  * Creates a filter based on the provided arguments.
2646
2646
  */ static create(t, e, n) {
2647
- return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.S(t, e, n) : new ne(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new oe(t, n) : "in" /* IN */ === e ? new ue(t, n) : "not-in" /* NOT_IN */ === e ? new ce(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ae(t, n) : new ee(t, e, n);
2647
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.S(t, e, n) : new re(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new ue(t, n) : "in" /* IN */ === e ? new ce(t, n) : "not-in" /* NOT_IN */ === e ? new ae(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new he(t, n) : new ne(t, e, n);
2648
2648
  }
2649
2649
  static S(t, e, n) {
2650
- return "in" /* IN */ === e ? new re(t, n) : new se(t, n);
2650
+ return "in" /* IN */ === e ? new se(t, n) : new ie(t, n);
2651
2651
  }
2652
2652
  matches(t) {
2653
2653
  const e = t.data.field(this.field);
2654
2654
  // Types do not have to match in NOT_EQUAL filters.
2655
- return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.F(Bt(e, this.value)) : null !== e && Mt(this.value) === Mt(e) && this.F(Bt(e, this.value));
2655
+ return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.F(Qt(e, this.value)) : null !== e && Ut(this.value) === Ut(e) && this.F(Qt(e, this.value));
2656
2656
  // Only compare types with matching backend order (such as double and int).
2657
2657
  }
2658
2658
  F(t) {
@@ -2676,7 +2676,7 @@ class ee extends class {} {
2676
2676
  return t >= 0;
2677
2677
 
2678
2678
  default:
2679
- return v();
2679
+ return b();
2680
2680
  }
2681
2681
  }
2682
2682
  q() {
@@ -2685,79 +2685,79 @@ class ee extends class {} {
2685
2685
  }
2686
2686
 
2687
2687
  /** Filter that matches on key fields (i.e. '__name__'). */
2688
- class ne extends ee {
2688
+ class re extends ne {
2689
2689
  constructor(t, e, n) {
2690
- super(t, e, n), this.key = nt.fromName(n.referenceValue);
2690
+ super(t, e, n), this.key = rt.fromName(n.referenceValue);
2691
2691
  }
2692
2692
  matches(t) {
2693
- const e = nt.comparator(t.key, this.key);
2693
+ const e = rt.comparator(t.key, this.key);
2694
2694
  return this.F(e);
2695
2695
  }
2696
2696
  }
2697
2697
 
2698
- /** Filter that matches on key fields within an array. */ class re extends ee {
2698
+ /** Filter that matches on key fields within an array. */ class se extends ne {
2699
2699
  constructor(t, e) {
2700
- super(t, "in" /* IN */ , e), this.keys = ie("in" /* IN */ , e);
2700
+ super(t, "in" /* IN */ , e), this.keys = oe("in" /* IN */ , e);
2701
2701
  }
2702
2702
  matches(t) {
2703
2703
  return this.keys.some((e => e.isEqual(t.key)));
2704
2704
  }
2705
2705
  }
2706
2706
 
2707
- /** Filter that matches on key fields not present within an array. */ class se extends ee {
2707
+ /** Filter that matches on key fields not present within an array. */ class ie extends ne {
2708
2708
  constructor(t, e) {
2709
- super(t, "not-in" /* NOT_IN */ , e), this.keys = ie("not-in" /* NOT_IN */ , e);
2709
+ super(t, "not-in" /* NOT_IN */ , e), this.keys = oe("not-in" /* NOT_IN */ , e);
2710
2710
  }
2711
2711
  matches(t) {
2712
2712
  return !this.keys.some((e => e.isEqual(t.key)));
2713
2713
  }
2714
2714
  }
2715
2715
 
2716
- function ie(t, e) {
2716
+ function oe(t, e) {
2717
2717
  var n;
2718
- return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => nt.fromName(t.referenceValue)));
2718
+ return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => rt.fromName(t.referenceValue)));
2719
2719
  }
2720
2720
 
2721
- /** A Filter that implements the array-contains operator. */ class oe extends ee {
2721
+ /** A Filter that implements the array-contains operator. */ class ue extends ne {
2722
2722
  constructor(t, e) {
2723
2723
  super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
2724
2724
  }
2725
2725
  matches(t) {
2726
2726
  const e = t.data.field(this.field);
2727
- return Wt(e) && jt(e.arrayValue, this.value);
2727
+ return Gt(e) && Bt(e.arrayValue, this.value);
2728
2728
  }
2729
2729
  }
2730
2730
 
2731
- /** A Filter that implements the IN operator. */ class ue extends ee {
2731
+ /** A Filter that implements the IN operator. */ class ce extends ne {
2732
2732
  constructor(t, e) {
2733
2733
  super(t, "in" /* IN */ , e);
2734
2734
  }
2735
2735
  matches(t) {
2736
2736
  const e = t.data.field(this.field);
2737
- return null !== e && jt(this.value.arrayValue, e);
2737
+ return null !== e && Bt(this.value.arrayValue, e);
2738
2738
  }
2739
2739
  }
2740
2740
 
2741
- /** A Filter that implements the not-in operator. */ class ce extends ee {
2741
+ /** A Filter that implements the not-in operator. */ class ae extends ne {
2742
2742
  constructor(t, e) {
2743
2743
  super(t, "not-in" /* NOT_IN */ , e);
2744
2744
  }
2745
2745
  matches(t) {
2746
- if (jt(this.value.arrayValue, {
2746
+ if (Bt(this.value.arrayValue, {
2747
2747
  nullValue: "NULL_VALUE"
2748
2748
  })) return !1;
2749
2749
  const e = t.data.field(this.field);
2750
- return null !== e && !jt(this.value.arrayValue, e);
2750
+ return null !== e && !Bt(this.value.arrayValue, e);
2751
2751
  }
2752
2752
  }
2753
2753
 
2754
- /** A Filter that implements the array-contains-any operator. */ class ae extends ee {
2754
+ /** A Filter that implements the array-contains-any operator. */ class he extends ne {
2755
2755
  constructor(t, e) {
2756
2756
  super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
2757
2757
  }
2758
2758
  matches(t) {
2759
2759
  const e = t.data.field(this.field);
2760
- return !(!Wt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => jt(this.value.arrayValue, t)));
2760
+ return !(!Gt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Bt(this.value.arrayValue, t)));
2761
2761
  }
2762
2762
  }
2763
2763
 
@@ -2774,7 +2774,7 @@ function ie(t, e) {
2774
2774
  * Bound provides a function to determine whether a document comes before or
2775
2775
  * after a bound. This is influenced by whether the position is just before or
2776
2776
  * just after the provided values.
2777
- */ class he {
2777
+ */ class le {
2778
2778
  constructor(t, e) {
2779
2779
  this.position = t, this.inclusive = e;
2780
2780
  }
@@ -2782,22 +2782,22 @@ function ie(t, e) {
2782
2782
 
2783
2783
  /**
2784
2784
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
2785
- */ class le {
2785
+ */ class fe {
2786
2786
  constructor(t, e = "asc" /* ASCENDING */) {
2787
2787
  this.field = t, this.dir = e;
2788
2788
  }
2789
2789
  }
2790
2790
 
2791
- function fe(t, e) {
2791
+ function de(t, e) {
2792
2792
  return t.dir === e.dir && t.field.isEqual(e.field);
2793
2793
  }
2794
2794
 
2795
- function de(t, e) {
2795
+ function we(t, e) {
2796
2796
  if (null === t) return null === e;
2797
2797
  if (null === e) return !1;
2798
2798
  if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
2799
2799
  for (let n = 0; n < t.position.length; n++) {
2800
- if (!Ut(t.position[n], e.position[n])) return !1;
2800
+ if (!jt(t.position[n], e.position[n])) return !1;
2801
2801
  }
2802
2802
  return !0;
2803
2803
  }
@@ -2824,7 +2824,7 @@ function de(t, e) {
2824
2824
  * query the RemoteStore results.
2825
2825
  *
2826
2826
  * Visible for testing.
2827
- */ class we {
2827
+ */ class me {
2828
2828
  /**
2829
2829
  * Initializes a Query with a path and optional additional query constraints.
2830
2830
  * Path must currently be empty if this is a collection group query.
@@ -2837,11 +2837,11 @@ function de(t, e) {
2837
2837
  }
2838
2838
  }
2839
2839
 
2840
- /** Creates a new Query for a query that matches all documents at `path` */ function me(t) {
2840
+ /** Creates a new Query for a query that matches all documents at `path` */ function pe(t) {
2841
2841
  return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
2842
2842
  }
2843
2843
 
2844
- function pe(t) {
2844
+ function ye(t) {
2845
2845
  for (const e of t.filters) if (e.q()) return e.field;
2846
2846
  return null;
2847
2847
  }
@@ -2854,7 +2854,7 @@ function pe(t) {
2854
2854
  * Returns whether the query matches a collection group rather than a specific
2855
2855
  * collection.
2856
2856
  */
2857
- function ye(t) {
2857
+ function ge(t) {
2858
2858
  return null !== t.collectionGroup;
2859
2859
  }
2860
2860
 
@@ -2863,22 +2863,22 @@ function ye(t) {
2863
2863
  * which can be different from the order by constraints the user provided (e.g.
2864
2864
  * the SDK and backend always orders by `__name__`).
2865
2865
  */ function _e(t) {
2866
- const e = E(t);
2866
+ const e = I(t);
2867
2867
  if (null === e.O) {
2868
2868
  e.O = [];
2869
- const t = pe(e), n = me(e);
2869
+ const t = ye(e), n = pe(e);
2870
2870
  if (null !== t && null === n)
2871
2871
  // In order to implicitly add key ordering, we must also add the
2872
2872
  // inequality filter field for it to be a valid query.
2873
2873
  // Note that the default inequality field and key ordering is ascending.
2874
- t.isKeyField() || e.O.push(new le(t)), e.O.push(new le(et.keyField(), "asc" /* ASCENDING */)); else {
2874
+ t.isKeyField() || e.O.push(new fe(t)), e.O.push(new fe(nt.keyField(), "asc" /* ASCENDING */)); else {
2875
2875
  let t = !1;
2876
2876
  for (const n of e.explicitOrderBy) e.O.push(n), n.field.isKeyField() && (t = !0);
2877
2877
  if (!t) {
2878
2878
  // The order of the implicit key ordering always matches the last
2879
2879
  // explicit order by
2880
2880
  const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2881
- e.O.push(new le(et.keyField(), t));
2881
+ e.O.push(new fe(nt.keyField(), t));
2882
2882
  }
2883
2883
  }
2884
2884
  }
@@ -2887,34 +2887,34 @@ function ye(t) {
2887
2887
 
2888
2888
  /**
2889
2889
  * Converts this `Query` instance to it's corresponding `Target` representation.
2890
- */ function ge(t) {
2891
- const e = E(t);
2892
- if (!e.k) if ("F" /* First */ === e.limitType) e.k = te(e.path, e.collectionGroup, _e(e), e.filters, e.limit, e.startAt, e.endAt); else {
2890
+ */ function ve(t) {
2891
+ const e = I(t);
2892
+ if (!e.k) if ("F" /* First */ === e.limitType) e.k = ee(e.path, e.collectionGroup, _e(e), e.filters, e.limit, e.startAt, e.endAt); else {
2893
2893
  // Flip the orderBy directions since we want the last results
2894
2894
  const t = [];
2895
2895
  for (const n of _e(e)) {
2896
2896
  const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2897
- t.push(new le(n.field, e));
2897
+ t.push(new fe(n.field, e));
2898
2898
  }
2899
2899
  // We need to swap the cursors to match the now-flipped query ordering.
2900
- const n = e.endAt ? new he(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new he(e.startAt.position, e.startAt.inclusive) : null;
2900
+ const n = e.endAt ? new le(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new le(e.startAt.position, e.startAt.inclusive) : null;
2901
2901
  // Now return as a LimitType.First query.
2902
- e.k = te(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2902
+ e.k = ee(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2903
2903
  }
2904
2904
  return e.k;
2905
2905
  }
2906
2906
 
2907
- function ve(t, e) {
2907
+ function be(t, e) {
2908
2908
  return function(t, e) {
2909
2909
  if (t.limit !== e.limit) return !1;
2910
2910
  if (t.orderBy.length !== e.orderBy.length) return !1;
2911
- for (let n = 0; n < t.orderBy.length; n++) if (!fe(t.orderBy[n], e.orderBy[n])) return !1;
2911
+ for (let n = 0; n < t.orderBy.length; n++) if (!de(t.orderBy[n], e.orderBy[n])) return !1;
2912
2912
  if (t.filters.length !== e.filters.length) return !1;
2913
2913
  for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
2914
- n.op !== r.op || !n.field.isEqual(r.field) || !Ut(n.value, r.value)) return !1;
2914
+ n.op !== r.op || !n.field.isEqual(r.field) || !jt(n.value, r.value)) return !1;
2915
2915
  var n, r;
2916
- return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!de(t.startAt, e.startAt) && de(t.endAt, e.endAt);
2917
- }(ge(t), ge(e)) && t.limitType === e.limitType;
2916
+ return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!we(t.startAt, e.startAt) && we(t.endAt, e.endAt);
2917
+ }(ve(t), ve(e)) && t.limitType === e.limitType;
2918
2918
  }
2919
2919
 
2920
2920
  /**
@@ -2942,9 +2942,9 @@ function ve(t, e) {
2942
2942
  * The return value is an IntegerValue if it can safely represent the value,
2943
2943
  * otherwise a DoubleValue is returned.
2944
2944
  */
2945
- function be(t, e) {
2945
+ function Ee(t, e) {
2946
2946
  return function(t) {
2947
- return "number" == typeof t && Number.isInteger(t) && !ht(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2947
+ return "number" == typeof t && Number.isInteger(t) && !lt(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2948
2948
  }(e) ?
2949
2949
  /**
2950
2950
  * Returns an IntegerValue for `value`.
@@ -2966,7 +2966,7 @@ function be(t, e) {
2966
2966
  };
2967
2967
  }
2968
2968
  return {
2969
- doubleValue: ht(e) ? "-0" : e
2969
+ doubleValue: lt(e) ? "-0" : e
2970
2970
  };
2971
2971
  }(t, e);
2972
2972
  }
@@ -2987,7 +2987,7 @@ function be(t, e) {
2987
2987
  * See the License for the specific language governing permissions and
2988
2988
  * limitations under the License.
2989
2989
  */
2990
- /** Used to represent a field transform on a mutation. */ class Ee {
2990
+ /** Used to represent a field transform on a mutation. */ class Ie {
2991
2991
  constructor() {
2992
2992
  // Make sure that the structural type of `TransformOperation` is unique.
2993
2993
  // See https://github.com/microsoft/TypeScript/issues/5451
@@ -2995,15 +2995,15 @@ function be(t, e) {
2995
2995
  }
2996
2996
  }
2997
2997
 
2998
- /** Transforms a value into a server-generated timestamp. */ class Ie extends Ee {}
2998
+ /** Transforms a value into a server-generated timestamp. */ class Te extends Ie {}
2999
2999
 
3000
- /** Transforms an array value via a union operation. */ class Te extends Ee {
3000
+ /** Transforms an array value via a union operation. */ class Ae extends Ie {
3001
3001
  constructor(t) {
3002
3002
  super(), this.elements = t;
3003
3003
  }
3004
3004
  }
3005
3005
 
3006
- /** Transforms an array value via a remove operation. */ class Ae extends Ee {
3006
+ /** Transforms an array value via a remove operation. */ class Re extends Ie {
3007
3007
  constructor(t) {
3008
3008
  super(), this.elements = t;
3009
3009
  }
@@ -3014,7 +3014,7 @@ function be(t, e) {
3014
3014
  * transforms. Converts all field values to integers or doubles, but unlike the
3015
3015
  * backend does not cap integer values at 2^63. Instead, JavaScript number
3016
3016
  * arithmetic is used and precision loss can occur for values greater than 2^53.
3017
- */ class Re extends Ee {
3017
+ */ class Pe extends Ie {
3018
3018
  constructor(t, e) {
3019
3019
  super(), this.L = t, this.M = e;
3020
3020
  }
@@ -3036,7 +3036,7 @@ function be(t, e) {
3036
3036
  * See the License for the specific language governing permissions and
3037
3037
  * limitations under the License.
3038
3038
  */
3039
- /** A field path and the TransformOperation to perform upon it. */ class Pe {
3039
+ /** A field path and the TransformOperation to perform upon it. */ class Ve {
3040
3040
  constructor(t, e) {
3041
3041
  this.field = t, this.transform = e;
3042
3042
  }
@@ -3046,18 +3046,18 @@ function be(t, e) {
3046
3046
  * Encodes a precondition for a mutation. This follows the model that the
3047
3047
  * backend accepts with the special case of an explicit "empty" precondition
3048
3048
  * (meaning no precondition).
3049
- */ class Ve {
3049
+ */ class Ne {
3050
3050
  constructor(t, e) {
3051
3051
  this.updateTime = t, this.exists = e;
3052
3052
  }
3053
3053
  /** Creates a new empty Precondition. */ static none() {
3054
- return new Ve;
3054
+ return new Ne;
3055
3055
  }
3056
3056
  /** Creates a new Precondition with an exists flag. */ static exists(t) {
3057
- return new Ve(void 0, t);
3057
+ return new Ne(void 0, t);
3058
3058
  }
3059
3059
  /** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
3060
- return new Ve(t);
3060
+ return new Ne(t);
3061
3061
  }
3062
3062
  /** Returns whether this Precondition is empty. */ get isNone() {
3063
3063
  return void 0 === this.updateTime && void 0 === this.exists;
@@ -3110,12 +3110,12 @@ function be(t, e) {
3110
3110
  * applyToLocalView() to implement the actual behavior of applying the mutation
3111
3111
  * to some source document (see `setMutationApplyToRemoteDocument()` for an
3112
3112
  * example).
3113
- */ class Ne {}
3113
+ */ class $e {}
3114
3114
 
3115
3115
  /**
3116
3116
  * A mutation that creates or replaces the document at the given key with the
3117
3117
  * object value contents.
3118
- */ class $e extends Ne {
3118
+ */ class De extends $e {
3119
3119
  constructor(t, e, n, r = []) {
3120
3120
  super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
3121
3121
  this.type = 0 /* Set */;
@@ -3137,7 +3137,7 @@ function be(t, e) {
3137
3137
  * is deleted.
3138
3138
  * * When a field is not in the mask but is in the values, the values map is
3139
3139
  * ignored.
3140
- */ class De extends Ne {
3140
+ */ class xe extends $e {
3141
3141
  constructor(t, e, n, r, s = []) {
3142
3142
  super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
3143
3143
  this.fieldTransforms = s, this.type = 1 /* Patch */;
@@ -3147,7 +3147,7 @@ function be(t, e) {
3147
3147
  }
3148
3148
  }
3149
3149
 
3150
- /** A mutation that deletes the document at the given key. */ class xe extends Ne {
3150
+ /** A mutation that deletes the document at the given key. */ class Se extends $e {
3151
3151
  constructor(t, e) {
3152
3152
  super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
3153
3153
  }
@@ -3162,7 +3162,7 @@ function be(t, e) {
3162
3162
  *
3163
3163
  * The `verify` operation is only used in Transactions, and this class serves
3164
3164
  * primarily to facilitate serialization into protos.
3165
- */ class Se extends Ne {
3165
+ */ class Fe extends $e {
3166
3166
  constructor(t, e) {
3167
3167
  super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
3168
3168
  }
@@ -3186,13 +3186,13 @@ function be(t, e) {
3186
3186
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3187
3187
  * See the License for the specific language governing permissions and
3188
3188
  * limitations under the License.
3189
- */ const Fe = (() => {
3189
+ */ const qe = (() => {
3190
3190
  const t = {
3191
3191
  asc: "ASCENDING",
3192
3192
  desc: "DESCENDING"
3193
3193
  };
3194
3194
  return t;
3195
- })(), qe = (() => {
3195
+ })(), Oe = (() => {
3196
3196
  const t = {
3197
3197
  "<": "LESS_THAN",
3198
3198
  "<=": "LESS_THAN_OR_EQUAL",
@@ -3222,7 +3222,7 @@ function be(t, e) {
3222
3222
  * TODO(klimt): We can remove the databaseId argument if we keep the full
3223
3223
  * resource name in documents.
3224
3224
  */
3225
- class Oe {
3225
+ class ke {
3226
3226
  constructor(t, e) {
3227
3227
  this.databaseId = t, this.C = e;
3228
3228
  }
@@ -3239,7 +3239,7 @@ class Oe {
3239
3239
  /**
3240
3240
  * Returns a value for a Date that's appropriate to put into a proto.
3241
3241
  */
3242
- function ke(t, e) {
3242
+ function Ce(t, e) {
3243
3243
  if (t.C) {
3244
3244
  return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
3245
3245
  }
@@ -3254,121 +3254,121 @@ function ke(t, e) {
3254
3254
  *
3255
3255
  * Visible for testing.
3256
3256
  */
3257
- function Ce(t, e) {
3257
+ function Le(t, e) {
3258
3258
  return t.C ? e.toBase64() : e.toUint8Array();
3259
3259
  }
3260
3260
 
3261
- function Le(t, e) {
3262
- return ke(t, e.toTimestamp());
3261
+ function Me(t, e) {
3262
+ return Ce(t, e.toTimestamp());
3263
3263
  }
3264
3264
 
3265
- function Me(t) {
3266
- return b(!!t), bt.fromTimestamp(function(t) {
3267
- const e = St(t);
3268
- return new vt(e.seconds, e.nanos);
3265
+ function Ue(t) {
3266
+ return E(!!t), Et.fromTimestamp(function(t) {
3267
+ const e = Ft(t);
3268
+ return new bt(e.seconds, e.nanos);
3269
3269
  }(t));
3270
3270
  }
3271
3271
 
3272
- function Ue(t, e) {
3272
+ function je(t, e) {
3273
3273
  return function(t) {
3274
- return new Z([ "projects", t.projectId, "databases", t.database ]);
3274
+ return new tt([ "projects", t.projectId, "databases", t.database ]);
3275
3275
  }(t).child("documents").child(e).canonicalString();
3276
3276
  }
3277
3277
 
3278
- function je(t, e) {
3279
- return Ue(t.databaseId, e.path);
3278
+ function Be(t, e) {
3279
+ return je(t.databaseId, e.path);
3280
3280
  }
3281
3281
 
3282
- function Be(t, e) {
3282
+ function Qe(t, e) {
3283
3283
  const n = function(t) {
3284
- const e = Z.fromString(t);
3285
- return b(tn(e)), e;
3284
+ const e = tt.fromString(t);
3285
+ return E(en(e)), e;
3286
3286
  }(e);
3287
- if (n.get(1) !== t.databaseId.projectId) throw new M(R, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
3288
- if (n.get(3) !== t.databaseId.database) throw new M(R, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
3289
- return new nt((b((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
3287
+ if (n.get(1) !== t.databaseId.projectId) throw new U(P, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
3288
+ if (n.get(3) !== t.databaseId.database) throw new U(P, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
3289
+ return new rt((E((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
3290
3290
  var r;
3291
3291
  /** Creates a Document proto from key and fields (but no create/update time) */}
3292
3292
 
3293
3293
  function ze(t, e) {
3294
- return Ue(t.databaseId, e);
3294
+ return je(t.databaseId, e);
3295
3295
  }
3296
3296
 
3297
- function Qe(t) {
3298
- return new Z([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
3297
+ function We(t) {
3298
+ return new tt([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
3299
3299
  }
3300
3300
 
3301
- function We(t, e, n) {
3301
+ function Ge(t, e, n) {
3302
3302
  return {
3303
- name: je(t, e),
3303
+ name: Be(t, e),
3304
3304
  fields: n.value.mapValue.fields
3305
3305
  };
3306
3306
  }
3307
3307
 
3308
- function Ge(t, e) {
3308
+ function Ke(t, e) {
3309
3309
  return "found" in e ? function(t, e) {
3310
- b(!!e.found), e.found.name, e.found.updateTime;
3311
- const n = Be(t, e.found.name), r = Me(e.found.updateTime), s = new Jt({
3310
+ E(!!e.found), e.found.name, e.found.updateTime;
3311
+ const n = Qe(t, e.found.name), r = Ue(e.found.updateTime), s = new Xt({
3312
3312
  mapValue: {
3313
3313
  fields: e.found.fields
3314
3314
  }
3315
3315
  });
3316
- return Xt.newFoundDocument(n, r, s);
3316
+ return Zt.newFoundDocument(n, r, s);
3317
3317
  }(t, e) : "missing" in e ? function(t, e) {
3318
- b(!!e.missing), b(!!e.readTime);
3319
- const n = Be(t, e.missing), r = Me(e.readTime);
3320
- return Xt.newNoDocument(n, r);
3321
- }(t, e) : v();
3318
+ E(!!e.missing), E(!!e.readTime);
3319
+ const n = Qe(t, e.missing), r = Ue(e.readTime);
3320
+ return Zt.newNoDocument(n, r);
3321
+ }(t, e) : b();
3322
3322
  }
3323
3323
 
3324
- function Ke(t, e) {
3324
+ function Ye(t, e) {
3325
3325
  let n;
3326
- if (e instanceof $e) n = {
3327
- update: We(t, e.key, e.value)
3326
+ if (e instanceof De) n = {
3327
+ update: Ge(t, e.key, e.value)
3328
+ }; else if (e instanceof Se) n = {
3329
+ delete: Be(t, e.key)
3328
3330
  }; else if (e instanceof xe) n = {
3329
- delete: je(t, e.key)
3330
- }; else if (e instanceof De) n = {
3331
- update: We(t, e.key, e.data),
3332
- updateMask: Ze(e.fieldMask)
3331
+ update: Ge(t, e.key, e.data),
3332
+ updateMask: tn(e.fieldMask)
3333
3333
  }; else {
3334
- if (!(e instanceof Se)) return v();
3334
+ if (!(e instanceof Fe)) return b();
3335
3335
  n = {
3336
- verify: je(t, e.key)
3336
+ verify: Be(t, e.key)
3337
3337
  };
3338
3338
  }
3339
3339
  return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
3340
3340
  const n = e.transform;
3341
- if (n instanceof Ie) return {
3341
+ if (n instanceof Te) return {
3342
3342
  fieldPath: e.field.canonicalString(),
3343
3343
  setToServerValue: "REQUEST_TIME"
3344
3344
  };
3345
- if (n instanceof Te) return {
3345
+ if (n instanceof Ae) return {
3346
3346
  fieldPath: e.field.canonicalString(),
3347
3347
  appendMissingElements: {
3348
3348
  values: n.elements
3349
3349
  }
3350
3350
  };
3351
- if (n instanceof Ae) return {
3351
+ if (n instanceof Re) return {
3352
3352
  fieldPath: e.field.canonicalString(),
3353
3353
  removeAllFromArray: {
3354
3354
  values: n.elements
3355
3355
  }
3356
3356
  };
3357
- if (n instanceof Re) return {
3357
+ if (n instanceof Pe) return {
3358
3358
  fieldPath: e.field.canonicalString(),
3359
3359
  increment: n.M
3360
3360
  };
3361
- throw v();
3361
+ throw b();
3362
3362
  }(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
3363
3363
  return void 0 !== e.updateTime ? {
3364
- updateTime: Le(t, e.updateTime)
3364
+ updateTime: Me(t, e.updateTime)
3365
3365
  } : void 0 !== e.exists ? {
3366
3366
  exists: e.exists
3367
- } : v();
3367
+ } : b();
3368
3368
  }(t, e.precondition)), n;
3369
3369
  }
3370
3370
 
3371
- function Ye(t, e) {
3371
+ function He(t, e) {
3372
3372
  // Dissect the path into parent, collectionId, and optional key filter.
3373
3373
  const n = {
3374
3374
  structuredQuery: {}
@@ -3385,36 +3385,36 @@ function Ye(t, e) {
3385
3385
  // visible for testing
3386
3386
  function(t) {
3387
3387
  if ("==" /* EQUAL */ === t.op) {
3388
- if (Kt(t.value)) return {
3388
+ if (Yt(t.value)) return {
3389
3389
  unaryFilter: {
3390
- field: Xe(t.field),
3390
+ field: Ze(t.field),
3391
3391
  op: "IS_NAN"
3392
3392
  }
3393
3393
  };
3394
- if (Gt(t.value)) return {
3394
+ if (Kt(t.value)) return {
3395
3395
  unaryFilter: {
3396
- field: Xe(t.field),
3396
+ field: Ze(t.field),
3397
3397
  op: "IS_NULL"
3398
3398
  }
3399
3399
  };
3400
3400
  } else if ("!=" /* NOT_EQUAL */ === t.op) {
3401
- if (Kt(t.value)) return {
3401
+ if (Yt(t.value)) return {
3402
3402
  unaryFilter: {
3403
- field: Xe(t.field),
3403
+ field: Ze(t.field),
3404
3404
  op: "IS_NOT_NAN"
3405
3405
  }
3406
3406
  };
3407
- if (Gt(t.value)) return {
3407
+ if (Kt(t.value)) return {
3408
3408
  unaryFilter: {
3409
- field: Xe(t.field),
3409
+ field: Ze(t.field),
3410
3410
  op: "IS_NOT_NULL"
3411
3411
  }
3412
3412
  };
3413
3413
  }
3414
3414
  return {
3415
3415
  fieldFilter: {
3416
- field: Xe(t.field),
3417
- op: Je(t.op),
3416
+ field: Ze(t.field),
3417
+ op: Xe(t.op),
3418
3418
  value: t.value
3419
3419
  }
3420
3420
  };
@@ -3434,14 +3434,14 @@ function Ye(t, e) {
3434
3434
  // visible for testing
3435
3435
  function(t) {
3436
3436
  return {
3437
- field: Xe(t.field),
3438
- direction: He(t.dir)
3437
+ field: Ze(t.field),
3438
+ direction: Je(t.dir)
3439
3439
  };
3440
3440
  }(t)));
3441
3441
  }(e.orderBy);
3442
3442
  i && (n.structuredQuery.orderBy = i);
3443
3443
  const o = function(t, e) {
3444
- return t.C || at(e) ? e : {
3444
+ return t.C || ht(e) ? e : {
3445
3445
  value: e
3446
3446
  };
3447
3447
  }(t, e.limit);
@@ -3459,29 +3459,29 @@ function Ye(t, e) {
3459
3459
  (e.endAt)), n;
3460
3460
  }
3461
3461
 
3462
- function He(t) {
3463
- return Fe[t];
3464
- }
3465
-
3466
- // visible for testing
3467
3462
  function Je(t) {
3468
3463
  return qe[t];
3469
3464
  }
3470
3465
 
3466
+ // visible for testing
3471
3467
  function Xe(t) {
3468
+ return Oe[t];
3469
+ }
3470
+
3471
+ function Ze(t) {
3472
3472
  return {
3473
3473
  fieldPath: t.canonicalString()
3474
3474
  };
3475
3475
  }
3476
3476
 
3477
- function Ze(t) {
3477
+ function tn(t) {
3478
3478
  const e = [];
3479
3479
  return t.fields.forEach((t => e.push(t.canonicalString()))), {
3480
3480
  fieldPaths: e
3481
3481
  };
3482
3482
  }
3483
3483
 
3484
- function tn(t) {
3484
+ function en(t) {
3485
3485
  // Resource names have at least 4 components (project ID, database ID)
3486
3486
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
3487
3487
  }
@@ -3501,8 +3501,8 @@ function tn(t) {
3501
3501
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3502
3502
  * See the License for the specific language governing permissions and
3503
3503
  * limitations under the License.
3504
- */ function en(t) {
3505
- return new Oe(t, /* useProto3Json= */ !0);
3504
+ */ function nn(t) {
3505
+ return new ke(t, /* useProto3Json= */ !0);
3506
3506
  }
3507
3507
 
3508
3508
  /**
@@ -3530,7 +3530,7 @@ function tn(t) {
3530
3530
  * base delay. This prevents clients from accidentally synchronizing their
3531
3531
  * delays causing spikes of load to the backend.
3532
3532
  */
3533
- class nn {
3533
+ class rn {
3534
3534
  constructor(
3535
3535
  /**
3536
3536
  * The AsyncQueue to run backoff operations on.
@@ -3585,7 +3585,7 @@ class nn {
3585
3585
  // honored as such).
3586
3586
  const e = Math.floor(this.G + this.X()), n = Math.max(0, Date.now() - this.Y), r = Math.max(0, e - n);
3587
3587
  // Guard against lastAttemptTime being in the future due to a clock change.
3588
- r > 0 && p("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.G} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
3588
+ r > 0 && y("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.G} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
3589
3589
  this.K = this.U.enqueueAfterDelay(this.timerId, r, (() => (this.Y = Date.now(),
3590
3590
  t()))),
3591
3591
  // Apply backoff factor to determine next delay and ensure it is within
@@ -3628,24 +3628,24 @@ class nn {
3628
3628
  * An implementation of Datastore that exposes additional state for internal
3629
3629
  * consumption.
3630
3630
  */
3631
- class rn extends class {} {
3631
+ class sn extends class {} {
3632
3632
  constructor(t, e, n, r) {
3633
3633
  super(), this.authCredentials = t, this.appCheckCredentials = e, this.tt = n, this.L = r,
3634
3634
  this.et = !1;
3635
3635
  }
3636
3636
  nt() {
3637
- if (this.et) throw new M(S, "The client has already been terminated.");
3637
+ if (this.et) throw new U(F, "The client has already been terminated.");
3638
3638
  }
3639
3639
  /** Invokes the provided RPC with auth and AppCheck tokens. */ I(t, e, n) {
3640
3640
  return this.nt(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.tt.I(t, e, n, r, s))).catch((t => {
3641
- throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
3642
- this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
3641
+ throw "FirebaseError" === t.name ? (t.code === x && (this.authCredentials.invalidateToken(),
3642
+ this.appCheckCredentials.invalidateToken()), t) : new U(R, t.toString());
3643
3643
  }));
3644
3644
  }
3645
3645
  /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ P(t, e, n, r) {
3646
3646
  return this.nt(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([s, i]) => this.tt.P(t, e, n, s, i, r))).catch((t => {
3647
- throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
3648
- this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
3647
+ throw "FirebaseError" === t.name ? (t.code === x && (this.authCredentials.invalidateToken(),
3648
+ this.appCheckCredentials.invalidateToken()), t) : new U(R, t.toString());
3649
3649
  }));
3650
3650
  }
3651
3651
  terminate() {
@@ -3655,42 +3655,60 @@ class rn extends class {} {
3655
3655
 
3656
3656
  // TODO(firestorexp): Make sure there is only one Datastore instance per
3657
3657
  // firestore-exp client.
3658
- async function sn(t, e) {
3659
- const n = E(t), r = Qe(n.L) + "/documents", s = {
3660
- writes: e.map((t => Ke(n.L, t)))
3658
+ async function on(t, e) {
3659
+ const n = I(t), r = We(n.L) + "/documents", s = {
3660
+ writes: e.map((t => Ye(n.L, t)))
3661
3661
  };
3662
3662
  await n.I("Commit", r, s);
3663
3663
  }
3664
3664
 
3665
- async function on(t, e) {
3666
- const n = E(t), r = Qe(n.L) + "/documents", s = {
3667
- documents: e.map((t => je(n.L, t)))
3665
+ async function un(t, e) {
3666
+ const n = I(t), r = We(n.L) + "/documents", s = {
3667
+ documents: e.map((t => Be(n.L, t)))
3668
3668
  }, i = await n.P("BatchGetDocuments", r, s, e.length), o = new Map;
3669
3669
  i.forEach((t => {
3670
- const e = Ge(n.L, t);
3670
+ const e = Ke(n.L, t);
3671
3671
  o.set(e.key.toString(), e);
3672
3672
  }));
3673
3673
  const u = [];
3674
3674
  return e.forEach((t => {
3675
3675
  const e = o.get(t.toString());
3676
- b(!!e), u.push(e);
3676
+ E(!!e), u.push(e);
3677
3677
  })), u;
3678
3678
  }
3679
3679
 
3680
- async function un(t, e) {
3681
- const n = E(t), r = Ye(n.L, ge(e));
3680
+ async function cn(t, e) {
3681
+ const n = I(t), r = He(n.L, ve(e));
3682
3682
  return (await n.P("RunQuery", r.parent, {
3683
3683
  structuredQuery: r.structuredQuery
3684
3684
  })).filter((t => !!t.document)).map((t => function(t, e, n) {
3685
- const r = Be(t, e.name), s = Me(e.updateTime), i = new Jt({
3685
+ const r = Qe(t, e.name), s = Ue(e.updateTime), i = new Xt({
3686
3686
  mapValue: {
3687
3687
  fields: e.fields
3688
3688
  }
3689
- }), o = Xt.newFoundDocument(r, s, i);
3689
+ }), o = Zt.newFoundDocument(r, s, i);
3690
3690
  return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
3691
3691
  }(n.L, t.document, void 0)));
3692
3692
  }
3693
3693
 
3694
+ async function an(t, e) {
3695
+ const n = I(t), r = function(t, e) {
3696
+ const n = He(t, e);
3697
+ return {
3698
+ structuredAggregationQuery: {
3699
+ aggregations: [ {
3700
+ count: {},
3701
+ alias: "count_alias"
3702
+ } ],
3703
+ structuredQuery: n.structuredQuery
3704
+ },
3705
+ parent: n.parent
3706
+ };
3707
+ }(n.L, ve(e)), s = r.parent;
3708
+ n.tt.v || delete r.parent;
3709
+ return (await n.P("RunAggregationQuery", s, r, /*expectedResponseCount=*/ 1)).filter((t => !!t.result)).map((t => t.result.aggregateFields));
3710
+ }
3711
+
3694
3712
  /**
3695
3713
  * @license
3696
3714
  * Copyright 2020 Google LLC
@@ -3706,7 +3724,7 @@ async function un(t, e) {
3706
3724
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3707
3725
  * See the License for the specific language governing permissions and
3708
3726
  * limitations under the License.
3709
- */ const cn = new Map;
3727
+ */ const hn = new Map;
3710
3728
 
3711
3729
  /**
3712
3730
  * An instance map that ensures only one Datastore exists per Firestore
@@ -3717,17 +3735,17 @@ async function un(t, e) {
3717
3735
  * instance. Callers must invoke removeComponents() when the Firestore
3718
3736
  * instance is terminated.
3719
3737
  */
3720
- function an(t) {
3721
- if (t._terminated) throw new M(S, "The client has already been terminated.");
3722
- if (!cn.has(t)) {
3723
- p("ComponentProvider", "Initializing Datastore");
3738
+ function ln(t) {
3739
+ if (t._terminated) throw new U(F, "The client has already been terminated.");
3740
+ if (!hn.has(t)) {
3741
+ y("ComponentProvider", "Initializing Datastore");
3724
3742
  const i = function(t) {
3725
- return new mt(t, fetch.bind(null));
3743
+ return new pt(t, fetch.bind(null));
3726
3744
  }((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3727
- new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = en(t._databaseId), u = function(t, e, n, r) {
3728
- return new rn(t, e, n, r);
3745
+ new J(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = nn(t._databaseId), u = function(t, e, n, r) {
3746
+ return new sn(t, e, n, r);
3729
3747
  }(t._authCredentials, t._appCheckCredentials, i, o);
3730
- cn.set(t, u);
3748
+ hn.set(t, u);
3731
3749
  }
3732
3750
  var e, n, r, s;
3733
3751
  /**
@@ -3745,7 +3763,7 @@ function an(t) {
3745
3763
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3746
3764
  * See the License for the specific language governing permissions and
3747
3765
  * limitations under the License.
3748
- */ return cn.get(t);
3766
+ */ return hn.get(t);
3749
3767
  }
3750
3768
 
3751
3769
  /**
@@ -3757,21 +3775,21 @@ function an(t) {
3757
3775
  * user-supplied `FirestoreSettings` object. This is a separate type so that
3758
3776
  * defaults can be supplied and the value can be checked for equality.
3759
3777
  */
3760
- class hn {
3778
+ class fn {
3761
3779
  constructor(t) {
3762
3780
  var e;
3763
3781
  if (void 0 === t.host) {
3764
- if (void 0 !== t.ssl) throw new M(R, "Can't provide ssl option if host option is not set");
3782
+ if (void 0 !== t.ssl) throw new U(P, "Can't provide ssl option if host option is not set");
3765
3783
  this.host = "firestore.googleapis.com", this.ssl = true;
3766
3784
  } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
3767
3785
  if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
3768
3786
  void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
3769
- if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new M(R, "cacheSizeBytes must be at least 1048576");
3787
+ if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(P, "cacheSizeBytes must be at least 1048576");
3770
3788
  this.cacheSizeBytes = t.cacheSizeBytes;
3771
3789
  }
3772
3790
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
3773
3791
  this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
3774
- if (!0 === e && !0 === r) throw new M(R, `${t} and ${n} cannot be used together.`);
3792
+ if (!0 === e && !0 === r) throw new U(P, `${t} and ${n} cannot be used together.`);
3775
3793
  }("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
3776
3794
  }
3777
3795
  isEqual(t) {
@@ -3798,8 +3816,8 @@ class hn {
3798
3816
  /**
3799
3817
  * The Cloud Firestore service interface.
3800
3818
  *
3801
- * Do not call this constructor directly. Instead, use {@link getFirestore}.
3802
- */ class ln {
3819
+ * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
3820
+ */ class dn {
3803
3821
  /** @hideconstructor */
3804
3822
  constructor(t, e, n, r) {
3805
3823
  this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
@@ -3807,14 +3825,14 @@ class hn {
3807
3825
  /**
3808
3826
  * Whether it's a Firestore or Firestore Lite instance.
3809
3827
  */
3810
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new hn({}),
3828
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new fn({}),
3811
3829
  this._settingsFrozen = !1;
3812
3830
  }
3813
3831
  /**
3814
3832
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
3815
3833
  * instance.
3816
3834
  */ get app() {
3817
- if (!this._app) throw new M(S, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
3835
+ if (!this._app) throw new U(F, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
3818
3836
  return this._app;
3819
3837
  }
3820
3838
  get _initialized() {
@@ -3824,19 +3842,19 @@ class hn {
3824
3842
  return void 0 !== this._terminateTask;
3825
3843
  }
3826
3844
  _setSettings(t) {
3827
- if (this._settingsFrozen) throw new M(S, "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.");
3828
- this._settings = new hn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3829
- if (!t) return new B;
3845
+ if (this._settingsFrozen) throw new U(F, "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.");
3846
+ this._settings = new fn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3847
+ if (!t) return new Q;
3830
3848
  switch (t.type) {
3831
3849
  case "gapi":
3832
3850
  const e = t.client;
3833
- return new G(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
3851
+ return new K(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
3834
3852
 
3835
3853
  case "provider":
3836
3854
  return t.client;
3837
3855
 
3838
3856
  default:
3839
- throw new M(R, "makeAuthCredentialsProvider failed due to invalid credential type");
3857
+ throw new U(P, "makeAuthCredentialsProvider failed due to invalid credential type");
3840
3858
  }
3841
3859
  }(t.credentials));
3842
3860
  }
@@ -3864,23 +3882,23 @@ class hn {
3864
3882
  * Only ever called once.
3865
3883
  */ _terminate() {
3866
3884
  return function(t) {
3867
- const e = cn.get(t);
3868
- e && (p("ComponentProvider", "Removing Datastore"), cn.delete(t), e.terminate());
3885
+ const e = hn.get(t);
3886
+ e && (y("ComponentProvider", "Removing Datastore"), hn.delete(t), e.terminate());
3869
3887
  }(this), Promise.resolve();
3870
3888
  }
3871
3889
  }
3872
3890
 
3873
- function fn(t, e, n) {
3891
+ function wn(t, e, n) {
3874
3892
  n || (n = "(default)");
3875
3893
  const r = _getProvider(t, "firestore/lite");
3876
- if (r.isInitialized(n)) throw new M(S, "Firestore can only be initialized once per app.");
3894
+ if (r.isInitialized(n)) throw new U(F, "Firestore can only be initialized once per app.");
3877
3895
  return r.initialize({
3878
3896
  options: e,
3879
3897
  instanceIdentifier: n
3880
3898
  });
3881
3899
  }
3882
3900
 
3883
- function dn(e, n) {
3901
+ function mn(e, n) {
3884
3902
  const r = "object" == typeof e ? e : t(), s = "string" == typeof e ? e : n || "(default)";
3885
3903
  return _getProvider(r, "firestore/lite").getImmediate({
3886
3904
  identifier: s
@@ -3899,24 +3917,24 @@ function dn(e, n) {
3899
3917
  * @param port - the emulator port (ex: 9000).
3900
3918
  * @param options.mockUserToken - the mock auth token to use for unit testing
3901
3919
  * Security Rules.
3902
- */ function wn(t, e, n, r = {}) {
3920
+ */ function pn(t, e, n, r = {}) {
3903
3921
  var s;
3904
- const i = (t = ut(t, ln))._getSettings();
3922
+ const i = (t = ct(t, dn))._getSettings();
3905
3923
  if ("firestore.googleapis.com" !== i.host && i.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3906
3924
  t._setSettings(Object.assign(Object.assign({}, i), {
3907
3925
  host: `${e}:${n}`,
3908
3926
  ssl: !1
3909
3927
  })), r.mockUserToken) {
3910
3928
  let e, n;
3911
- if ("string" == typeof r.mockUserToken) e = r.mockUserToken, n = f.MOCK_USER; else {
3929
+ if ("string" == typeof r.mockUserToken) e = r.mockUserToken, n = d.MOCK_USER; else {
3912
3930
  // Let createMockUserToken validate first (catches common mistakes like
3913
3931
  // invalid field "uid" and missing field "sub" / "user_id".)
3914
3932
  e = h(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3915
3933
  const i = r.mockUserToken.sub || r.mockUserToken.user_id;
3916
- if (!i) throw new M(R, "mockUserToken must contain 'sub' or 'user_id' field!");
3917
- n = new f(i);
3934
+ if (!i) throw new U(P, "mockUserToken must contain 'sub' or 'user_id' field!");
3935
+ n = new d(i);
3918
3936
  }
3919
- t._authCredentials = new z(new j(e, n));
3937
+ t._authCredentials = new z(new B(e, n));
3920
3938
  }
3921
3939
  }
3922
3940
 
@@ -3929,7 +3947,7 @@ function dn(e, n) {
3929
3947
  * response from the server will not be resolved.
3930
3948
  *
3931
3949
  * To restart after termination, create a new instance of `Firestore` with
3932
- * {@link getFirestore}.
3950
+ * {@link (getFirestore:1)}.
3933
3951
  *
3934
3952
  * Note: Under normal circumstances, calling `terminate()` is not required. This
3935
3953
  * function is useful only when you want to force this instance to release all of
@@ -3939,8 +3957,8 @@ function dn(e, n) {
3939
3957
  * @param firestore - The `Firestore` instance to terminate.
3940
3958
  * @returns A `Promise` that is resolved when the instance has been successfully
3941
3959
  * terminated.
3942
- */ function mn(t) {
3943
- return t = ut(t, ln), e(t.app, "firestore/lite"), t._delete();
3960
+ */ function yn(t) {
3961
+ return t = ct(t, dn), e(t.app, "firestore/lite"), t._delete();
3944
3962
  }
3945
3963
 
3946
3964
  /**
@@ -3959,6 +3977,91 @@ function dn(e, n) {
3959
3977
  * See the License for the specific language governing permissions and
3960
3978
  * limitations under the License.
3961
3979
  */
3980
+ /**
3981
+ * @license
3982
+ * Copyright 2022 Google LLC
3983
+ *
3984
+ * Licensed under the Apache License, Version 2.0 (the "License");
3985
+ * you may not use this file except in compliance with the License.
3986
+ * You may obtain a copy of the License at
3987
+ *
3988
+ * http://www.apache.org/licenses/LICENSE-2.0
3989
+ *
3990
+ * Unless required by applicable law or agreed to in writing, software
3991
+ * distributed under the License is distributed on an "AS IS" BASIS,
3992
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3993
+ * See the License for the specific language governing permissions and
3994
+ * limitations under the License.
3995
+ */
3996
+ /**
3997
+ * Represents an aggregation that can be performed by Firestore.
3998
+ */
3999
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
4000
+ class gn {
4001
+ constructor() {
4002
+ /** A type string to uniquely identify instances of this class. */
4003
+ this.type = "AggregateField";
4004
+ }
4005
+ }
4006
+
4007
+ /**
4008
+ * The results of executing an aggregation query.
4009
+ */ class _n {
4010
+ /** @hideconstructor */
4011
+ constructor(t, e) {
4012
+ this._data = e,
4013
+ /** A type string to uniquely identify instances of this class. */
4014
+ this.type = "AggregateQuerySnapshot", this.query = t;
4015
+ }
4016
+ /**
4017
+ * Returns the results of the aggregations performed over the underlying
4018
+ * query.
4019
+ *
4020
+ * The keys of the returned object will be the same as those of the
4021
+ * `AggregateSpec` object specified to the aggregation method, and the values
4022
+ * will be the corresponding aggregation result.
4023
+ *
4024
+ * @returns The results of the aggregations performed over the underlying
4025
+ * query.
4026
+ */ data() {
4027
+ return this._data;
4028
+ }
4029
+ }
4030
+
4031
+ /**
4032
+ * @license
4033
+ * Copyright 2022 Google LLC
4034
+ *
4035
+ * Licensed under the Apache License, Version 2.0 (the "License");
4036
+ * you may not use this file except in compliance with the License.
4037
+ * You may obtain a copy of the License at
4038
+ *
4039
+ * http://www.apache.org/licenses/LICENSE-2.0
4040
+ *
4041
+ * Unless required by applicable law or agreed to in writing, software
4042
+ * distributed under the License is distributed on an "AS IS" BASIS,
4043
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4044
+ * See the License for the specific language governing permissions and
4045
+ * limitations under the License.
4046
+ */
4047
+ /**
4048
+ * CountQueryRunner encapsulates the logic needed to run the count aggregation
4049
+ * queries.
4050
+ */ class vn {
4051
+ constructor(t, e, n) {
4052
+ this.query = t, this.datastore = e, this.userDataWriter = n;
4053
+ }
4054
+ run() {
4055
+ return an(this.datastore, this.query._query).then((t => {
4056
+ E(void 0 !== t[0]);
4057
+ const e = Object.entries(t[0]).filter((([t, e]) => "count_alias" === t)).map((([t, e]) => this.userDataWriter.convertValue(e)))[0];
4058
+ return E("number" == typeof e), Promise.resolve(new _n(this.query, {
4059
+ count: e
4060
+ }));
4061
+ }));
4062
+ }
4063
+ }
4064
+
3962
4065
  /**
3963
4066
  * @license
3964
4067
  * Copyright 2020 Google LLC
@@ -3979,8 +4082,7 @@ function dn(e, n) {
3979
4082
  * A `DocumentReference` refers to a document location in a Firestore database
3980
4083
  * and can be used to write, read, or listen to the location. The document at
3981
4084
  * the referenced location may or may not exist.
3982
- */
3983
- class pn {
4085
+ */ class bn {
3984
4086
  /** @hideconstructor */
3985
4087
  constructor(t,
3986
4088
  /**
@@ -4008,17 +4110,17 @@ class pn {
4008
4110
  /**
4009
4111
  * The collection this `DocumentReference` belongs to.
4010
4112
  */ get parent() {
4011
- return new _n(this.firestore, this.converter, this._key.path.popLast());
4113
+ return new In(this.firestore, this.converter, this._key.path.popLast());
4012
4114
  }
4013
4115
  withConverter(t) {
4014
- return new pn(this.firestore, t, this._key);
4116
+ return new bn(this.firestore, t, this._key);
4015
4117
  }
4016
4118
  }
4017
4119
 
4018
4120
  /**
4019
4121
  * A `Query` refers to a query which you can read or listen to. You can also
4020
4122
  * construct refined `Query` objects by adding filters and ordering.
4021
- */ class yn {
4123
+ */ class En {
4022
4124
  // This is the lite version of the Query class in the main SDK.
4023
4125
  /** @hideconstructor protected */
4024
4126
  constructor(t,
@@ -4031,17 +4133,17 @@ class pn {
4031
4133
  this.type = "query", this.firestore = t;
4032
4134
  }
4033
4135
  withConverter(t) {
4034
- return new yn(this.firestore, t, this._query);
4136
+ return new En(this.firestore, t, this._query);
4035
4137
  }
4036
4138
  }
4037
4139
 
4038
4140
  /**
4039
4141
  * A `CollectionReference` object can be used for adding documents, getting
4040
4142
  * document references, and querying for documents (using {@link query}).
4041
- */ class _n extends yn {
4143
+ */ class In extends En {
4042
4144
  /** @hideconstructor */
4043
4145
  constructor(t, e, n) {
4044
- super(t, e, new we(n)), this._path = n,
4146
+ super(t, e, new me(n)), this._path = n,
4045
4147
  /** The type of this Firestore reference. */
4046
4148
  this.type = "collection";
4047
4149
  }
@@ -4059,23 +4161,23 @@ class pn {
4059
4161
  * subcollection. If this isn't a subcollection, the reference is null.
4060
4162
  */ get parent() {
4061
4163
  const t = this._path.popLast();
4062
- return t.isEmpty() ? null : new pn(this.firestore,
4063
- /* converter= */ null, new nt(t));
4164
+ return t.isEmpty() ? null : new bn(this.firestore,
4165
+ /* converter= */ null, new rt(t));
4064
4166
  }
4065
4167
  withConverter(t) {
4066
- return new _n(this.firestore, t, this._path);
4168
+ return new In(this.firestore, t, this._path);
4067
4169
  }
4068
4170
  }
4069
4171
 
4070
- function gn(t, e, ...n) {
4071
- if (t = l(t), rt("collection", "path", e), t instanceof ln) {
4072
- const r = Z.fromString(e, ...n);
4073
- return it(r), new _n(t, /* converter= */ null, r);
4172
+ function Tn(t, e, ...n) {
4173
+ if (t = l(t), st("collection", "path", e), t instanceof dn) {
4174
+ const r = tt.fromString(e, ...n);
4175
+ return ot(r), new In(t, /* converter= */ null, r);
4074
4176
  }
4075
4177
  {
4076
- if (!(t instanceof pn || t instanceof _n)) throw new M(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4077
- const r = t._path.child(Z.fromString(e, ...n));
4078
- return it(r), new _n(t.firestore,
4178
+ if (!(t instanceof bn || t instanceof In)) throw new U(P, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4179
+ const r = t._path.child(tt.fromString(e, ...n));
4180
+ return ot(r), new In(t.firestore,
4079
4181
  /* converter= */ null, r);
4080
4182
  }
4081
4183
  }
@@ -4092,32 +4194,32 @@ function gn(t, e, ...n) {
4092
4194
  * collection or subcollection with this ID as the last segment of its path
4093
4195
  * will be included. Cannot contain a slash.
4094
4196
  * @returns The created `Query`.
4095
- */ function vn(t, e) {
4096
- if (t = ut(t, ln), rt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new M(R, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
4097
- return new yn(t,
4197
+ */ function An(t, e) {
4198
+ if (t = ct(t, dn), st("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(P, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
4199
+ return new En(t,
4098
4200
  /* converter= */ null,
4099
4201
  /**
4100
4202
  * Creates a new Query for a collection group query that matches all documents
4101
4203
  * within the provided collection group.
4102
4204
  */
4103
4205
  function(t) {
4104
- return new we(Z.emptyPath(), t);
4206
+ return new me(tt.emptyPath(), t);
4105
4207
  }(e));
4106
4208
  }
4107
4209
 
4108
- function bn(t, e, ...n) {
4210
+ function Rn(t, e, ...n) {
4109
4211
  if (t = l(t),
4110
4212
  // We allow omission of 'pathString' but explicitly prohibit passing in both
4111
4213
  // 'undefined' and 'null'.
4112
- 1 === arguments.length && (e = yt.$()), rt("doc", "path", e), t instanceof ln) {
4113
- const r = Z.fromString(e, ...n);
4114
- return st(r), new pn(t,
4115
- /* converter= */ null, new nt(r));
4214
+ 1 === arguments.length && (e = gt.$()), st("doc", "path", e), t instanceof dn) {
4215
+ const r = tt.fromString(e, ...n);
4216
+ return it(r), new bn(t,
4217
+ /* converter= */ null, new rt(r));
4116
4218
  }
4117
4219
  {
4118
- if (!(t instanceof pn || t instanceof _n)) throw new M(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4119
- const r = t._path.child(Z.fromString(e, ...n));
4120
- return st(r), new pn(t.firestore, t instanceof _n ? t.converter : null, new nt(r));
4220
+ if (!(t instanceof bn || t instanceof In)) throw new U(P, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4221
+ const r = t._path.child(tt.fromString(e, ...n));
4222
+ return it(r), new bn(t.firestore, t instanceof In ? t.converter : null, new rt(r));
4121
4223
  }
4122
4224
  }
4123
4225
 
@@ -4128,8 +4230,8 @@ function bn(t, e, ...n) {
4128
4230
  * @param right - A reference to compare.
4129
4231
  * @returns true if the references point to the same location in the same
4130
4232
  * Firestore database.
4131
- */ function En(t, e) {
4132
- return t = l(t), e = l(e), (t instanceof pn || t instanceof _n) && (e instanceof pn || e instanceof _n) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
4233
+ */ function Pn(t, e) {
4234
+ return t = l(t), e = l(e), (t instanceof bn || t instanceof In) && (e instanceof bn || e instanceof In) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
4133
4235
  }
4134
4236
 
4135
4237
  /**
@@ -4140,59 +4242,8 @@ function bn(t, e, ...n) {
4140
4242
  * @param right - A `Query` to compare.
4141
4243
  * @returns true if the references point to the same location in the same
4142
4244
  * Firestore database.
4143
- */ function In(t, e) {
4144
- return t = l(t), e = l(e), t instanceof yn && e instanceof yn && (t.firestore === e.firestore && ve(t._query, e._query) && t.converter === e.converter);
4145
- }
4146
-
4147
- /**
4148
- * @license
4149
- * Copyright 2020 Google LLC
4150
- *
4151
- * Licensed under the Apache License, Version 2.0 (the "License");
4152
- * you may not use this file except in compliance with the License.
4153
- * You may obtain a copy of the License at
4154
- *
4155
- * http://www.apache.org/licenses/LICENSE-2.0
4156
- *
4157
- * Unless required by applicable law or agreed to in writing, software
4158
- * distributed under the License is distributed on an "AS IS" BASIS,
4159
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4160
- * See the License for the specific language governing permissions and
4161
- * limitations under the License.
4162
- */
4163
- /**
4164
- * A `FieldPath` refers to a field in a document. The path may consist of a
4165
- * single field name (referring to a top-level field in the document), or a
4166
- * list of field names (referring to a nested field in the document).
4167
- *
4168
- * Create a `FieldPath` by providing field names. If more than one field
4169
- * name is provided, the path will point to a nested field in a document.
4170
- */ class Tn {
4171
- /**
4172
- * Creates a `FieldPath` from the provided field names. If more than one field
4173
- * name is provided, the path will point to a nested field in a document.
4174
- *
4175
- * @param fieldNames - A list of field names.
4176
- */
4177
- constructor(...t) {
4178
- for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new M(R, "Invalid field name at argument $(i + 1). Field names must not be empty.");
4179
- this._internalPath = new et(t);
4180
- }
4181
- /**
4182
- * Returns true if this `FieldPath` is equal to the provided one.
4183
- *
4184
- * @param other - The `FieldPath` to compare against.
4185
- * @returns true if this `FieldPath` is equal to the provided one.
4186
- */ isEqual(t) {
4187
- return this._internalPath.isEqual(t._internalPath);
4188
- }
4189
- }
4190
-
4191
- /**
4192
- * Returns a special sentinel `FieldPath` to refer to the ID of a document.
4193
- * It can be used in queries to sort or filter by the document ID.
4194
- */ function An() {
4195
- return new Tn("__name__");
4245
+ */ function Vn(t, e) {
4246
+ return t = l(t), e = l(e), t instanceof En && e instanceof En && (t.firestore === e.firestore && be(t._query, e._query) && t.converter === e.converter);
4196
4247
  }
4197
4248
 
4198
4249
  /**
@@ -4213,7 +4264,7 @@ function bn(t, e, ...n) {
4213
4264
  */
4214
4265
  /**
4215
4266
  * An immutable object representing an array of bytes.
4216
- */ class Rn {
4267
+ */ class Nn {
4217
4268
  /** @hideconstructor */
4218
4269
  constructor(t) {
4219
4270
  this._byteString = t;
@@ -4225,9 +4276,9 @@ function bn(t, e, ...n) {
4225
4276
  * @param base64 - The Base64 string used to create the `Bytes` object.
4226
4277
  */ static fromBase64String(t) {
4227
4278
  try {
4228
- return new Rn(Dt.fromBase64String(t));
4279
+ return new Nn(xt.fromBase64String(t));
4229
4280
  } catch (t) {
4230
- throw new M(R, "Failed to construct data from Base64 string: " + t);
4281
+ throw new U(P, "Failed to construct data from Base64 string: " + t);
4231
4282
  }
4232
4283
  }
4233
4284
  /**
@@ -4235,7 +4286,7 @@ function bn(t, e, ...n) {
4235
4286
  *
4236
4287
  * @param array - The Uint8Array used to create the `Bytes` object.
4237
4288
  */ static fromUint8Array(t) {
4238
- return new Rn(Dt.fromUint8Array(t));
4289
+ return new Nn(xt.fromUint8Array(t));
4239
4290
  }
4240
4291
  /**
4241
4292
  * Returns the underlying bytes as a Base64-encoded string.
@@ -4268,6 +4319,57 @@ function bn(t, e, ...n) {
4268
4319
  }
4269
4320
  }
4270
4321
 
4322
+ /**
4323
+ * @license
4324
+ * Copyright 2020 Google LLC
4325
+ *
4326
+ * Licensed under the Apache License, Version 2.0 (the "License");
4327
+ * you may not use this file except in compliance with the License.
4328
+ * You may obtain a copy of the License at
4329
+ *
4330
+ * http://www.apache.org/licenses/LICENSE-2.0
4331
+ *
4332
+ * Unless required by applicable law or agreed to in writing, software
4333
+ * distributed under the License is distributed on an "AS IS" BASIS,
4334
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4335
+ * See the License for the specific language governing permissions and
4336
+ * limitations under the License.
4337
+ */
4338
+ /**
4339
+ * A `FieldPath` refers to a field in a document. The path may consist of a
4340
+ * single field name (referring to a top-level field in the document), or a
4341
+ * list of field names (referring to a nested field in the document).
4342
+ *
4343
+ * Create a `FieldPath` by providing field names. If more than one field
4344
+ * name is provided, the path will point to a nested field in a document.
4345
+ */ class $n {
4346
+ /**
4347
+ * Creates a `FieldPath` from the provided field names. If more than one field
4348
+ * name is provided, the path will point to a nested field in a document.
4349
+ *
4350
+ * @param fieldNames - A list of field names.
4351
+ */
4352
+ constructor(...t) {
4353
+ for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new U(P, "Invalid field name at argument $(i + 1). Field names must not be empty.");
4354
+ this._internalPath = new nt(t);
4355
+ }
4356
+ /**
4357
+ * Returns true if this `FieldPath` is equal to the provided one.
4358
+ *
4359
+ * @param other - The `FieldPath` to compare against.
4360
+ * @returns true if this `FieldPath` is equal to the provided one.
4361
+ */ isEqual(t) {
4362
+ return this._internalPath.isEqual(t._internalPath);
4363
+ }
4364
+ }
4365
+
4366
+ /**
4367
+ * Returns a special sentinel `FieldPath` to refer to the ID of a document.
4368
+ * It can be used in queries to sort or filter by the document ID.
4369
+ */ function Dn() {
4370
+ return new $n("__name__");
4371
+ }
4372
+
4271
4373
  /**
4272
4374
  * @license
4273
4375
  * Copyright 2020 Google LLC
@@ -4287,7 +4389,7 @@ function bn(t, e, ...n) {
4287
4389
  /**
4288
4390
  * Sentinel values that can be used when writing document fields with `set()`
4289
4391
  * or `update()`.
4290
- */ class Pn {
4392
+ */ class xn {
4291
4393
  /**
4292
4394
  * @param _methodName - The public API endpoint that returns this class.
4293
4395
  * @hideconstructor
@@ -4319,7 +4421,7 @@ function bn(t, e, ...n) {
4319
4421
  *
4320
4422
  * Latitude values are in the range of [-90, 90].
4321
4423
  * Longitude values are in the range of [-180, 180].
4322
- */ class Vn {
4424
+ */ class Sn {
4323
4425
  /**
4324
4426
  * Creates a new immutable `GeoPoint` object with the provided latitude and
4325
4427
  * longitude values.
@@ -4327,8 +4429,8 @@ function bn(t, e, ...n) {
4327
4429
  * @param longitude - The longitude as number between -180 and 180.
4328
4430
  */
4329
4431
  constructor(t, e) {
4330
- if (!isFinite(t) || t < -90 || t > 90) throw new M(R, "Latitude must be a number between -90 and 90, but was: " + t);
4331
- if (!isFinite(e) || e < -180 || e > 180) throw new M(R, "Longitude must be a number between -180 and 180, but was: " + e);
4432
+ if (!isFinite(t) || t < -90 || t > 90) throw new U(P, "Latitude must be a number between -90 and 90, but was: " + t);
4433
+ if (!isFinite(e) || e < -180 || e > 180) throw new U(P, "Longitude must be a number between -180 and 180, but was: " + e);
4332
4434
  this._lat = t, this._long = e;
4333
4435
  }
4334
4436
  /**
@@ -4378,29 +4480,29 @@ function bn(t, e, ...n) {
4378
4480
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4379
4481
  * See the License for the specific language governing permissions and
4380
4482
  * limitations under the License.
4381
- */ const Nn = /^__.*__$/;
4483
+ */ const Fn = /^__.*__$/;
4382
4484
 
4383
- /** The result of parsing document data (e.g. for a setData call). */ class $n {
4485
+ /** The result of parsing document data (e.g. for a setData call). */ class qn {
4384
4486
  constructor(t, e, n) {
4385
4487
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
4386
4488
  }
4387
4489
  toMutation(t, e) {
4388
- return null !== this.fieldMask ? new De(t, this.data, this.fieldMask, e, this.fieldTransforms) : new $e(t, this.data, e, this.fieldTransforms);
4490
+ return null !== this.fieldMask ? new xe(t, this.data, this.fieldMask, e, this.fieldTransforms) : new De(t, this.data, e, this.fieldTransforms);
4389
4491
  }
4390
4492
  }
4391
4493
 
4392
- /** The result of parsing "update" data (i.e. for an updateData call). */ class Dn {
4494
+ /** The result of parsing "update" data (i.e. for an updateData call). */ class On {
4393
4495
  constructor(t,
4394
4496
  // The fieldMask does not include document transforms.
4395
4497
  e, n) {
4396
4498
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
4397
4499
  }
4398
4500
  toMutation(t, e) {
4399
- return new De(t, this.data, this.fieldMask, e, this.fieldTransforms);
4501
+ return new xe(t, this.data, this.fieldMask, e, this.fieldTransforms);
4400
4502
  }
4401
4503
  }
4402
4504
 
4403
- function xn(t) {
4505
+ function kn(t) {
4404
4506
  switch (t) {
4405
4507
  case 0 /* Set */ :
4406
4508
  // fall through
@@ -4414,11 +4516,11 @@ function xn(t) {
4414
4516
  return !1;
4415
4517
 
4416
4518
  default:
4417
- throw v();
4519
+ throw b();
4418
4520
  }
4419
4521
  }
4420
4522
 
4421
- /** A "context" object passed around while parsing user data. */ class Sn {
4523
+ /** A "context" object passed around while parsing user data. */ class Cn {
4422
4524
  /**
4423
4525
  * Initializes a ParseContext with the given source and path.
4424
4526
  *
@@ -4450,7 +4552,7 @@ function xn(t) {
4450
4552
  return this.settings.st;
4451
4553
  }
4452
4554
  /** Returns a new context with the specified settings overwritten. */ it(t) {
4453
- return new Sn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.L, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
4555
+ return new Cn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.L, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
4454
4556
  }
4455
4557
  ot(t) {
4456
4558
  var e;
@@ -4477,7 +4579,7 @@ function xn(t) {
4477
4579
  });
4478
4580
  }
4479
4581
  lt(t) {
4480
- return Zn(t, this.settings.methodName, this.settings.ft || !1, this.path, this.settings.dt);
4582
+ return sr(t, this.settings.methodName, this.settings.ft || !1, this.path, this.settings.dt);
4481
4583
  }
4482
4584
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
4483
4585
  return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
@@ -4489,52 +4591,52 @@ function xn(t) {
4489
4591
  }
4490
4592
  ct(t) {
4491
4593
  if (0 === t.length) throw this.lt("Document fields must not be empty");
4492
- if (xn(this.st) && Nn.test(t)) throw this.lt('Document fields cannot begin and end with "__"');
4594
+ if (kn(this.st) && Fn.test(t)) throw this.lt('Document fields cannot begin and end with "__"');
4493
4595
  }
4494
4596
  }
4495
4597
 
4496
4598
  /**
4497
4599
  * Helper for parsing raw user input (provided via the API) into internal model
4498
4600
  * classes.
4499
- */ class Fn {
4601
+ */ class Ln {
4500
4602
  constructor(t, e, n) {
4501
- this.databaseId = t, this.ignoreUndefinedProperties = e, this.L = n || en(t);
4603
+ this.databaseId = t, this.ignoreUndefinedProperties = e, this.L = n || nn(t);
4502
4604
  }
4503
4605
  /** Creates a new top-level parse context. */ wt(t, e, n, r = !1) {
4504
- return new Sn({
4606
+ return new Cn({
4505
4607
  st: t,
4506
4608
  methodName: e,
4507
4609
  dt: n,
4508
- path: et.emptyPath(),
4610
+ path: nt.emptyPath(),
4509
4611
  ut: !1,
4510
4612
  ft: r
4511
4613
  }, this.databaseId, this.L, this.ignoreUndefinedProperties);
4512
4614
  }
4513
4615
  }
4514
4616
 
4515
- function qn(t) {
4516
- const e = t._freezeSettings(), n = en(t._databaseId);
4517
- return new Fn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4617
+ function Mn(t) {
4618
+ const e = t._freezeSettings(), n = nn(t._databaseId);
4619
+ return new Ln(t._databaseId, !!e.ignoreUndefinedProperties, n);
4518
4620
  }
4519
4621
 
4520
- /** Parse document data from a set() call. */ function On(t, e, n, r, s, i = {}) {
4622
+ /** Parse document data from a set() call. */ function Un(t, e, n, r, s, i = {}) {
4521
4623
  const o = t.wt(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
4522
- Yn("Data must be an object, but it was:", o, r);
4523
- const u = Gn(r, o);
4624
+ tr("Data must be an object, but it was:", o, r);
4625
+ const u = Xn(r, o);
4524
4626
  let c, a;
4525
- if (i.merge) c = new Nt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4627
+ if (i.merge) c = new $t(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4526
4628
  const t = [];
4527
4629
  for (const r of i.mergeFields) {
4528
- const s = Hn(e, r, n);
4529
- if (!o.contains(s)) throw new M(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
4530
- tr(t, s) || t.push(s);
4630
+ const s = er(e, r, n);
4631
+ if (!o.contains(s)) throw new U(P, `Field '${s}' is specified in your field mask but missing from your input data.`);
4632
+ ir(t, s) || t.push(s);
4531
4633
  }
4532
- c = new Nt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4634
+ c = new $t(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4533
4635
  } else c = null, a = o.fieldTransforms;
4534
- return new $n(new Jt(u), c, a);
4636
+ return new qn(new Xt(u), c, a);
4535
4637
  }
4536
4638
 
4537
- class kn extends Pn {
4639
+ class jn extends xn {
4538
4640
  _toFieldTransform(t) {
4539
4641
  if (2 /* MergeSet */ !== t.st) throw 1 /* Update */ === t.st ? t.lt(`${this._methodName}() can only appear at the top level of your update data`) : t.lt(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
4540
4642
  // No transform to add for a delete, but we need to add it to our
@@ -4542,7 +4644,7 @@ class kn extends Pn {
4542
4644
  return t.fieldMask.push(t.path), null;
4543
4645
  }
4544
4646
  isEqual(t) {
4545
- return t instanceof kn;
4647
+ return t instanceof jn;
4546
4648
  }
4547
4649
  }
4548
4650
 
@@ -4561,8 +4663,8 @@ class kn extends Pn {
4561
4663
  * context.
4562
4664
  * @param context - The parent context.
4563
4665
  * @param arrayElement - Whether or not the FieldValue has an array.
4564
- */ function Cn(t, e, n) {
4565
- return new Sn({
4666
+ */ function Bn(t, e, n) {
4667
+ return new Cn({
4566
4668
  st: 3 /* Argument */ ,
4567
4669
  dt: e.settings.dt,
4568
4670
  methodName: t._methodName,
@@ -4570,23 +4672,23 @@ class kn extends Pn {
4570
4672
  }, e.databaseId, e.L, e.ignoreUndefinedProperties);
4571
4673
  }
4572
4674
 
4573
- class Ln extends Pn {
4675
+ class Qn extends xn {
4574
4676
  _toFieldTransform(t) {
4575
- return new Pe(t.path, new Ie);
4677
+ return new Ve(t.path, new Te);
4576
4678
  }
4577
4679
  isEqual(t) {
4578
- return t instanceof Ln;
4680
+ return t instanceof Qn;
4579
4681
  }
4580
4682
  }
4581
4683
 
4582
- class Mn extends Pn {
4684
+ class zn extends xn {
4583
4685
  constructor(t, e) {
4584
4686
  super(t), this.yt = e;
4585
4687
  }
4586
4688
  _toFieldTransform(t) {
4587
- const e = Cn(this, t,
4588
- /*array=*/ !0), n = this.yt.map((t => Wn(t, e))), r = new Te(n);
4589
- return new Pe(t.path, r);
4689
+ const e = Bn(this, t,
4690
+ /*array=*/ !0), n = this.yt.map((t => Jn(t, e))), r = new Ae(n);
4691
+ return new Ve(t.path, r);
4590
4692
  }
4591
4693
  isEqual(t) {
4592
4694
  // TODO(mrschmidt): Implement isEquals
@@ -4594,14 +4696,14 @@ class Mn extends Pn {
4594
4696
  }
4595
4697
  }
4596
4698
 
4597
- class Un extends Pn {
4699
+ class Wn extends xn {
4598
4700
  constructor(t, e) {
4599
4701
  super(t), this.yt = e;
4600
4702
  }
4601
4703
  _toFieldTransform(t) {
4602
- const e = Cn(this, t,
4603
- /*array=*/ !0), n = this.yt.map((t => Wn(t, e))), r = new Ae(n);
4604
- return new Pe(t.path, r);
4704
+ const e = Bn(this, t,
4705
+ /*array=*/ !0), n = this.yt.map((t => Jn(t, e))), r = new Re(n);
4706
+ return new Ve(t.path, r);
4605
4707
  }
4606
4708
  isEqual(t) {
4607
4709
  // TODO(mrschmidt): Implement isEquals
@@ -4609,13 +4711,13 @@ class Un extends Pn {
4609
4711
  }
4610
4712
  }
4611
4713
 
4612
- class jn extends Pn {
4714
+ class Gn extends xn {
4613
4715
  constructor(t, e) {
4614
- super(t), this._t = e;
4716
+ super(t), this.gt = e;
4615
4717
  }
4616
4718
  _toFieldTransform(t) {
4617
- const e = new Re(t.L, be(t.L, this._t));
4618
- return new Pe(t.path, e);
4719
+ const e = new Pe(t.L, Ee(t.L, this.gt));
4720
+ return new Ve(t.path, e);
4619
4721
  }
4620
4722
  isEqual(t) {
4621
4723
  // TODO(mrschmidt): Implement isEquals
@@ -4623,50 +4725,50 @@ class jn extends Pn {
4623
4725
  }
4624
4726
  }
4625
4727
 
4626
- /** Parse update data from an update() call. */ function Bn(t, e, n, r) {
4728
+ /** Parse update data from an update() call. */ function Kn(t, e, n, r) {
4627
4729
  const s = t.wt(1 /* Update */ , e, n);
4628
- Yn("Data must be an object, but it was:", s, r);
4629
- const i = [], o = Jt.empty();
4630
- It(r, ((t, r) => {
4631
- const u = Xn(e, t, n);
4730
+ tr("Data must be an object, but it was:", s, r);
4731
+ const i = [], o = Xt.empty();
4732
+ Tt(r, ((t, r) => {
4733
+ const u = rr(e, t, n);
4632
4734
  // For Compat types, we have to "extract" the underlying types before
4633
4735
  // performing validation.
4634
4736
  r = l(r);
4635
4737
  const c = s.at(u);
4636
- if (r instanceof kn)
4738
+ if (r instanceof jn)
4637
4739
  // Add it to the field mask, but don't add anything to updateData.
4638
4740
  i.push(u); else {
4639
- const t = Wn(r, c);
4741
+ const t = Jn(r, c);
4640
4742
  null != t && (i.push(u), o.set(u, t));
4641
4743
  }
4642
4744
  }));
4643
- const u = new Nt(i);
4644
- return new Dn(o, u, s.fieldTransforms);
4745
+ const u = new $t(i);
4746
+ return new On(o, u, s.fieldTransforms);
4645
4747
  }
4646
4748
 
4647
- /** Parse update data from a list of field/value arguments. */ function zn(t, e, n, r, s, i) {
4648
- const o = t.wt(1 /* Update */ , e, n), u = [ Hn(e, r, n) ], c = [ s ];
4649
- if (i.length % 2 != 0) throw new M(R, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4650
- for (let t = 0; t < i.length; t += 2) u.push(Hn(e, i[t])), c.push(i[t + 1]);
4651
- const a = [], h = Jt.empty();
4749
+ /** Parse update data from a list of field/value arguments. */ function Yn(t, e, n, r, s, i) {
4750
+ const o = t.wt(1 /* Update */ , e, n), u = [ er(e, r, n) ], c = [ s ];
4751
+ if (i.length % 2 != 0) throw new U(P, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4752
+ for (let t = 0; t < i.length; t += 2) u.push(er(e, i[t])), c.push(i[t + 1]);
4753
+ const a = [], h = Xt.empty();
4652
4754
  // We iterate in reverse order to pick the last value for a field if the
4653
4755
  // user specified the field multiple times.
4654
- for (let t = u.length - 1; t >= 0; --t) if (!tr(a, u[t])) {
4756
+ for (let t = u.length - 1; t >= 0; --t) if (!ir(a, u[t])) {
4655
4757
  const e = u[t];
4656
4758
  let n = c[t];
4657
4759
  // For Compat types, we have to "extract" the underlying types before
4658
4760
  // performing validation.
4659
4761
  n = l(n);
4660
4762
  const r = o.at(e);
4661
- if (n instanceof kn)
4763
+ if (n instanceof jn)
4662
4764
  // Add it to the field mask, but don't add anything to updateData.
4663
4765
  a.push(e); else {
4664
- const t = Wn(n, r);
4766
+ const t = Jn(n, r);
4665
4767
  null != t && (a.push(e), h.set(e, t));
4666
4768
  }
4667
4769
  }
4668
- const f = new Nt(a);
4669
- return new Dn(h, f, o.fieldTransforms);
4770
+ const f = new $t(a);
4771
+ return new On(h, f, o.fieldTransforms);
4670
4772
  }
4671
4773
 
4672
4774
  /**
@@ -4675,8 +4777,8 @@ class jn extends Pn {
4675
4777
  *
4676
4778
  * @param allowArrays - Whether the query value is an array that may directly
4677
4779
  * contain additional arrays (e.g. the operand of an `in` query).
4678
- */ function Qn(t, e, n, r = !1) {
4679
- return Wn(n, t.wt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4780
+ */ function Hn(t, e, n, r = !1) {
4781
+ return Jn(n, t.wt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4680
4782
  }
4681
4783
 
4682
4784
  /**
@@ -4687,12 +4789,12 @@ class jn extends Pn {
4687
4789
  * the source of the data being parsed, etc.
4688
4790
  * @returns The parsed value, or null if the value was a FieldValue sentinel
4689
4791
  * that should not be included in the resulting parsed data.
4690
- */ function Wn(t, e) {
4691
- if (Kn(
4792
+ */ function Jn(t, e) {
4793
+ if (Zn(
4692
4794
  // Unwrap the API type from the Compat SDK. This will return the API type
4693
4795
  // from firestore-exp.
4694
- t = l(t))) return Yn("Unsupported field value:", e, t), Gn(t, e);
4695
- if (t instanceof Pn)
4796
+ t = l(t))) return tr("Unsupported field value:", e, t), Xn(t, e);
4797
+ if (t instanceof xn)
4696
4798
  // FieldValues usually parse into transforms (except deleteField())
4697
4799
  // in which case we do not want to include this field in our parsed data
4698
4800
  // (as doing so will overwrite the field directly prior to the transform
@@ -4704,7 +4806,7 @@ class jn extends Pn {
4704
4806
  */
4705
4807
  return function(t, e) {
4706
4808
  // Sentinels are only supported with writes, and not within arrays.
4707
- if (!xn(e.st)) throw e.lt(`${t._methodName}() can only be used with update() and set()`);
4809
+ if (!kn(e.st)) throw e.lt(`${t._methodName}() can only be used with update() and set()`);
4708
4810
  if (!e.path) throw e.lt(`${t._methodName}() is not currently supported inside arrays`);
4709
4811
  const n = t._toFieldTransform(e);
4710
4812
  n && e.fieldTransforms.push(n);
@@ -4734,7 +4836,7 @@ class jn extends Pn {
4734
4836
  const n = [];
4735
4837
  let r = 0;
4736
4838
  for (const s of t) {
4737
- let t = Wn(s, e.ht(r));
4839
+ let t = Jn(s, e.ht(r));
4738
4840
  null == t && (
4739
4841
  // Just include nulls in the array for fields being replaced with a
4740
4842
  // sentinel.
@@ -4753,7 +4855,7 @@ class jn extends Pn {
4753
4855
  if (null === (t = l(t))) return {
4754
4856
  nullValue: "NULL_VALUE"
4755
4857
  };
4756
- if ("number" == typeof t) return be(e.L, t);
4858
+ if ("number" == typeof t) return Ee(e.L, t);
4757
4859
  if ("boolean" == typeof t) return {
4758
4860
  booleanValue: t
4759
4861
  };
@@ -4761,37 +4863,37 @@ class jn extends Pn {
4761
4863
  stringValue: t
4762
4864
  };
4763
4865
  if (t instanceof Date) {
4764
- const n = vt.fromDate(t);
4866
+ const n = bt.fromDate(t);
4765
4867
  return {
4766
- timestampValue: ke(e.L, n)
4868
+ timestampValue: Ce(e.L, n)
4767
4869
  };
4768
4870
  }
4769
- if (t instanceof vt) {
4871
+ if (t instanceof bt) {
4770
4872
  // Firestore backend truncates precision down to microseconds. To ensure
4771
4873
  // offline mode works the same with regards to truncation, perform the
4772
4874
  // truncation immediately without waiting for the backend to do that.
4773
- const n = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4875
+ const n = new bt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4774
4876
  return {
4775
- timestampValue: ke(e.L, n)
4877
+ timestampValue: Ce(e.L, n)
4776
4878
  };
4777
4879
  }
4778
- if (t instanceof Vn) return {
4880
+ if (t instanceof Sn) return {
4779
4881
  geoPointValue: {
4780
4882
  latitude: t.latitude,
4781
4883
  longitude: t.longitude
4782
4884
  }
4783
4885
  };
4784
- if (t instanceof Rn) return {
4785
- bytesValue: Ce(e.L, t._byteString)
4886
+ if (t instanceof Nn) return {
4887
+ bytesValue: Le(e.L, t._byteString)
4786
4888
  };
4787
- if (t instanceof pn) {
4889
+ if (t instanceof bn) {
4788
4890
  const n = e.databaseId, r = t.firestore._databaseId;
4789
4891
  if (!r.isEqual(n)) throw e.lt(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
4790
4892
  return {
4791
- referenceValue: Ue(t.firestore._databaseId || e.databaseId, t._key.path)
4893
+ referenceValue: je(t.firestore._databaseId || e.databaseId, t._key.path)
4792
4894
  };
4793
4895
  }
4794
- throw e.lt(`Unsupported field value: ${ot(t)}`);
4896
+ throw e.lt(`Unsupported field value: ${ut(t)}`);
4795
4897
  }
4796
4898
  /**
4797
4899
  * Checks whether an object looks like a JSON object that should be converted
@@ -4802,13 +4904,13 @@ class jn extends Pn {
4802
4904
  */ (t, e);
4803
4905
  }
4804
4906
 
4805
- function Gn(t, e) {
4907
+ function Xn(t, e) {
4806
4908
  const n = {};
4807
4909
  return !function(t) {
4808
4910
  for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
4809
4911
  return !0;
4810
- }(t) ? It(t, ((t, r) => {
4811
- const s = Wn(r, e.ot(t));
4912
+ }(t) ? Tt(t, ((t, r) => {
4913
+ const s = Jn(r, e.ot(t));
4812
4914
  null != s && (n[t] = s);
4813
4915
  })) :
4814
4916
  // If we encounter an empty object, we explicitly add it to the update
@@ -4820,35 +4922,35 @@ function Gn(t, e) {
4820
4922
  };
4821
4923
  }
4822
4924
 
4823
- function Kn(t) {
4824
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof Vn || t instanceof Rn || t instanceof pn || t instanceof Pn);
4925
+ function Zn(t) {
4926
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof bt || t instanceof Sn || t instanceof Nn || t instanceof bn || t instanceof xn);
4825
4927
  }
4826
4928
 
4827
- function Yn(t, e, n) {
4828
- if (!Kn(n) || !function(t) {
4929
+ function tr(t, e, n) {
4930
+ if (!Zn(n) || !function(t) {
4829
4931
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
4830
4932
  }(n)) {
4831
- const r = ot(n);
4933
+ const r = ut(n);
4832
4934
  throw "an object" === r ? e.lt(t + " a custom object") : e.lt(t + " " + r);
4833
4935
  }
4834
4936
  }
4835
4937
 
4836
4938
  /**
4837
4939
  * Helper that calls fromDotSeparatedString() but wraps any error thrown.
4838
- */ function Hn(t, e, n) {
4940
+ */ function er(t, e, n) {
4839
4941
  if ((
4840
4942
  // If required, replace the FieldPath Compat class with with the firestore-exp
4841
4943
  // FieldPath.
4842
- e = l(e)) instanceof Tn) return e._internalPath;
4843
- if ("string" == typeof e) return Xn(t, e);
4844
- throw Zn("Field path arguments must be of type string or ", t,
4944
+ e = l(e)) instanceof $n) return e._internalPath;
4945
+ if ("string" == typeof e) return rr(t, e);
4946
+ throw sr("Field path arguments must be of type string or ", t,
4845
4947
  /* hasConverter= */ !1,
4846
4948
  /* path= */ void 0, n);
4847
4949
  }
4848
4950
 
4849
4951
  /**
4850
4952
  * Matches any characters in a field path string that are reserved.
4851
- */ const Jn = new RegExp("[~\\*/\\[\\]]");
4953
+ */ const nr = new RegExp("[~\\*/\\[\\]]");
4852
4954
 
4853
4955
  /**
4854
4956
  * Wraps fromDotSeparatedString with an error message about the method that
@@ -4858,29 +4960,29 @@ function Yn(t, e, n) {
4858
4960
  * split on dots.
4859
4961
  * @param targetDoc - The document against which the field path will be
4860
4962
  * evaluated.
4861
- */ function Xn(t, e, n) {
4862
- if (e.search(Jn) >= 0) throw Zn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4963
+ */ function rr(t, e, n) {
4964
+ if (e.search(nr) >= 0) throw sr(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4863
4965
  /* hasConverter= */ !1,
4864
4966
  /* path= */ void 0, n);
4865
4967
  try {
4866
- return new Tn(...e.split("."))._internalPath;
4968
+ return new $n(...e.split("."))._internalPath;
4867
4969
  } catch (r) {
4868
- throw Zn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4970
+ throw sr(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4869
4971
  /* hasConverter= */ !1,
4870
4972
  /* path= */ void 0, n);
4871
4973
  }
4872
4974
  }
4873
4975
 
4874
- function Zn(t, e, n, r, s) {
4976
+ function sr(t, e, n, r, s) {
4875
4977
  const i = r && !r.isEmpty(), o = void 0 !== s;
4876
4978
  let u = `Function ${e}() called with invalid data`;
4877
4979
  n && (u += " (via `toFirestore()`)"), u += ". ";
4878
4980
  let c = "";
4879
4981
  return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
4880
- c += ")"), new M(R, u + t + c);
4982
+ c += ")"), new U(P, u + t + c);
4881
4983
  }
4882
4984
 
4883
- /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function tr(t, e) {
4985
+ /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function ir(t, e) {
4884
4986
  return t.some((t => t.isEqual(e)));
4885
4987
  }
4886
4988
 
@@ -4908,7 +5010,7 @@ function Zn(t, e, n, r, s) {
4908
5010
  * For a `DocumentSnapshot` that points to a non-existing document, any data
4909
5011
  * access will return 'undefined'. You can use the `exists()` method to
4910
5012
  * explicitly verify a document's existence.
4911
- */ class er {
5013
+ */ class or {
4912
5014
  // Note: This class is stripped down version of the DocumentSnapshot in
4913
5015
  // the legacy SDK. The changes are:
4914
5016
  // - No support for SnapshotMetadata.
@@ -4924,7 +5026,7 @@ function Zn(t, e, n, r, s) {
4924
5026
  /**
4925
5027
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
4926
5028
  */ get ref() {
4927
- return new pn(this._firestore, this._converter, this._key);
5029
+ return new bn(this._firestore, this._converter, this._key);
4928
5030
  }
4929
5031
  /**
4930
5032
  * Signals whether or not the document at the snapshot's location exists.
@@ -4944,7 +5046,7 @@ function Zn(t, e, n, r, s) {
4944
5046
  if (this._converter) {
4945
5047
  // We only want to use the converter and create a new DocumentSnapshot
4946
5048
  // if a converter has been provided.
4947
- const t = new nr(this._firestore, this._userDataWriter, this._key, this._document,
5049
+ const t = new ur(this._firestore, this._userDataWriter, this._key, this._document,
4948
5050
  /* converter= */ null);
4949
5051
  return this._converter.fromFirestore(t);
4950
5052
  }
@@ -4964,7 +5066,7 @@ function Zn(t, e, n, r, s) {
4964
5066
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4965
5067
  get(t) {
4966
5068
  if (this._document) {
4967
- const e = this._document.data.field(ir("DocumentSnapshot.get", t));
5069
+ const e = this._document.data.field(hr("DocumentSnapshot.get", t));
4968
5070
  if (null !== e) return this._userDataWriter.convertValue(e);
4969
5071
  }
4970
5072
  }
@@ -4980,7 +5082,7 @@ function Zn(t, e, n, r, s) {
4980
5082
  * `DocumentSnapshot`. Since query results contain only existing documents, the
4981
5083
  * `exists` property will always be true and `data()` will never return
4982
5084
  * 'undefined'.
4983
- */ class nr extends er {
5085
+ */ class ur extends or {
4984
5086
  /**
4985
5087
  * Retrieves all fields in the document as an `Object`.
4986
5088
  *
@@ -4998,7 +5100,7 @@ function Zn(t, e, n, r, s) {
4998
5100
  * array via the `docs` property or enumerated using the `forEach` method. The
4999
5101
  * number of documents can be determined via the `empty` and `size`
5000
5102
  * properties.
5001
- */ class rr {
5103
+ */ class cr {
5002
5104
  /** @hideconstructor */
5003
5105
  constructor(t, e) {
5004
5106
  this._docs = e, this.query = t;
@@ -5029,14 +5131,14 @@ function Zn(t, e, n, r, s) {
5029
5131
  * @param left - A snapshot to compare.
5030
5132
  * @param right - A snapshot to compare.
5031
5133
  * @returns true if the snapshots are equal.
5032
- */ function sr(t, e) {
5033
- return t = l(t), e = l(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 && (In(t.query, e.query) && gt(t.docs, e.docs, sr));
5134
+ */ function ar(t, e) {
5135
+ return t = l(t), e = l(e), t instanceof or && e instanceof or ? 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 cr && e instanceof cr && (Vn(t.query, e.query) && vt(t.docs, e.docs, ar));
5034
5136
  }
5035
5137
 
5036
5138
  /**
5037
5139
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
5038
- */ function ir(t, e) {
5039
- return "string" == typeof e ? Xn(t, e) : e instanceof Tn ? e._internalPath : e._delegate._internalPath;
5140
+ */ function hr(t, e) {
5141
+ return "string" == typeof e ? rr(t, e) : e instanceof $n ? e._internalPath : e._delegate._internalPath;
5040
5142
  }
5041
5143
 
5042
5144
  /**
@@ -5063,7 +5165,7 @@ function Zn(t, e, n, r, s) {
5063
5165
  * can then be passed to {@link query} to create a new query instance that
5064
5166
  * also contains this `QueryConstraint`.
5065
5167
  */
5066
- class or {}
5168
+ class lr {}
5067
5169
 
5068
5170
  /**
5069
5171
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -5073,40 +5175,40 @@ class or {}
5073
5175
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
5074
5176
  * @throws if any of the provided query constraints cannot be combined with the
5075
5177
  * existing or new constraints.
5076
- */ function ur(t, ...e) {
5178
+ */ function fr(t, ...e) {
5077
5179
  for (const n of e) t = n._apply(t);
5078
5180
  return t;
5079
5181
  }
5080
5182
 
5081
- class cr extends or {
5183
+ class dr extends lr {
5082
5184
  constructor(t, e, n) {
5083
- super(), this.gt = t, this.vt = e, this.bt = n, this.type = "where";
5185
+ super(), this._t = t, this.vt = e, this.bt = n, this.type = "where";
5084
5186
  }
5085
5187
  _apply(t) {
5086
- const e = qn(t.firestore), n = function(t, e, n, r, s, i, o) {
5188
+ const e = Mn(t.firestore), n = function(t, e, n, r, s, i, o) {
5087
5189
  let u;
5088
5190
  if (s.isKeyField()) {
5089
- if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new M(R, `Invalid Query. You can't perform '${i}' queries on documentId().`);
5191
+ if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(P, `Invalid Query. You can't perform '${i}' queries on documentId().`);
5090
5192
  if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
5091
- Ir(o, i);
5193
+ Vr(o, i);
5092
5194
  const e = [];
5093
- for (const n of o) e.push(Er(r, t, n));
5195
+ for (const n of o) e.push(Pr(r, t, n));
5094
5196
  u = {
5095
5197
  arrayValue: {
5096
5198
  values: e
5097
5199
  }
5098
5200
  };
5099
- } else u = Er(r, t, o);
5100
- } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || Ir(o, i),
5101
- u = Qn(n, e, o,
5201
+ } else u = Pr(r, t, o);
5202
+ } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || Vr(o, i),
5203
+ u = Hn(n, e, o,
5102
5204
  /* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
5103
- const c = ee.create(s, i, u);
5205
+ const c = ne.create(s, i, u);
5104
5206
  return function(t, e) {
5105
5207
  if (e.q()) {
5106
- const n = pe(t);
5107
- if (null !== n && !n.isEqual(e.field)) throw new M(R, `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()}'`);
5108
- const r = me(t);
5109
- null !== r && Tr(t, e.field, r);
5208
+ const n = ye(t);
5209
+ if (null !== n && !n.isEqual(e.field)) throw new U(P, `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()}'`);
5210
+ const r = pe(t);
5211
+ null !== r && Nr(t, e.field, r);
5110
5212
  }
5111
5213
  const n = function(t, e) {
5112
5214
  for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
@@ -5147,12 +5249,12 @@ class cr extends or {
5147
5249
  }(e.op));
5148
5250
  if (null !== n)
5149
5251
  // Special case when it's a duplicate op to give a slightly clearer error message.
5150
- throw n === e.op ? new M(R, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new M(R, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
5252
+ throw n === e.op ? new U(P, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(P, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
5151
5253
  }(t, c), c;
5152
- }(t._query, "where", e, t.firestore._databaseId, this.gt, this.vt, this.bt);
5153
- return new yn(t.firestore, t.converter, function(t, e) {
5254
+ }(t._query, "where", e, t.firestore._databaseId, this._t, this.vt, this.bt);
5255
+ return new En(t.firestore, t.converter, function(t, e) {
5154
5256
  const n = t.filters.concat([ e ]);
5155
- return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
5257
+ return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
5156
5258
  }(t._query, n));
5157
5259
  }
5158
5260
  }
@@ -5167,25 +5269,25 @@ class cr extends or {
5167
5269
  * "&lt;=", "!=").
5168
5270
  * @param value - The value for comparison
5169
5271
  * @returns The created {@link Query}.
5170
- */ function ar(t, e, n) {
5171
- const r = e, s = ir("where", t);
5172
- return new cr(s, r, n);
5272
+ */ function wr(t, e, n) {
5273
+ const r = e, s = hr("where", t);
5274
+ return new dr(s, r, n);
5173
5275
  }
5174
5276
 
5175
- class hr extends or {
5277
+ class mr extends lr {
5176
5278
  constructor(t, e) {
5177
- super(), this.gt = t, this.Et = e, this.type = "orderBy";
5279
+ super(), this._t = t, this.Et = e, this.type = "orderBy";
5178
5280
  }
5179
5281
  _apply(t) {
5180
5282
  const e = function(t, e, n) {
5181
- if (null !== t.startAt) throw new M(R, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
5182
- if (null !== t.endAt) throw new M(R, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
5183
- const r = new le(e, n);
5283
+ if (null !== t.startAt) throw new U(P, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
5284
+ if (null !== t.endAt) throw new U(P, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
5285
+ const r = new fe(e, n);
5184
5286
  return function(t, e) {
5185
- if (null === me(t)) {
5287
+ if (null === pe(t)) {
5186
5288
  // This is the first order by. It must match any inequality.
5187
- const n = pe(t);
5188
- null !== n && Tr(t, n, e.field);
5289
+ const n = ye(t);
5290
+ null !== n && Nr(t, n, e.field);
5189
5291
  }
5190
5292
  }(t, r), r;
5191
5293
  }
@@ -5199,11 +5301,11 @@ class hr extends or {
5199
5301
  * Will throw if the document does not contain all fields of the order by
5200
5302
  * of the query or if any of the fields in the order by are an uncommitted
5201
5303
  * server timestamp.
5202
- */ (t._query, this.gt, this.Et);
5203
- return new yn(t.firestore, t.converter, function(t, e) {
5304
+ */ (t._query, this._t, this.Et);
5305
+ return new En(t.firestore, t.converter, function(t, e) {
5204
5306
  // TODO(dimond): validate that orderBy does not list the same key twice.
5205
5307
  const n = t.explicitOrderBy.concat([ e ]);
5206
- return new we(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
5308
+ return new me(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
5207
5309
  }(t._query, e));
5208
5310
  }
5209
5311
  }
@@ -5216,18 +5318,18 @@ class hr extends or {
5216
5318
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
5217
5319
  * not specified, order will be ascending.
5218
5320
  * @returns The created {@link Query}.
5219
- */ function lr(t, e = "asc") {
5220
- const n = e, r = ir("orderBy", t);
5221
- return new hr(r, n);
5321
+ */ function pr(t, e = "asc") {
5322
+ const n = e, r = hr("orderBy", t);
5323
+ return new mr(r, n);
5222
5324
  }
5223
5325
 
5224
- class fr extends or {
5326
+ class yr extends lr {
5225
5327
  constructor(t, e, n) {
5226
5328
  super(), this.type = t, this.It = e, this.Tt = n;
5227
5329
  }
5228
5330
  _apply(t) {
5229
- return new yn(t.firestore, t.converter, function(t, e, n) {
5230
- return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
5331
+ return new En(t.firestore, t.converter, function(t, e, n) {
5332
+ return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
5231
5333
  }(t._query, this.It, this.Tt));
5232
5334
  }
5233
5335
  }
@@ -5237,8 +5339,8 @@ class fr extends or {
5237
5339
  *
5238
5340
  * @param limit - The maximum number of items to return.
5239
5341
  * @returns The created {@link Query}.
5240
- */ function dr(t) {
5241
- return ct("limit", t), new fr("limit", t, "F" /* First */);
5342
+ */ function gr(t) {
5343
+ return at("limit", t), new yr("limit", t, "F" /* First */);
5242
5344
  }
5243
5345
 
5244
5346
  /**
@@ -5249,56 +5351,56 @@ class fr extends or {
5249
5351
  *
5250
5352
  * @param limit - The maximum number of items to return.
5251
5353
  * @returns The created {@link Query}.
5252
- */ function wr(t) {
5253
- return ct("limitToLast", t), new fr("limitToLast", t, "L" /* Last */);
5354
+ */ function _r(t) {
5355
+ return at("limitToLast", t), new yr("limitToLast", t, "L" /* Last */);
5254
5356
  }
5255
5357
 
5256
- class mr extends or {
5358
+ class vr extends lr {
5257
5359
  constructor(t, e, n) {
5258
5360
  super(), this.type = t, this.At = e, this.Rt = n;
5259
5361
  }
5260
5362
  _apply(t) {
5261
- const e = br(t, this.type, this.At, this.Rt);
5262
- return new yn(t.firestore, t.converter, function(t, e) {
5263
- return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
5363
+ const e = Rr(t, this.type, this.At, this.Rt);
5364
+ return new En(t.firestore, t.converter, function(t, e) {
5365
+ return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
5264
5366
  }(t._query, e));
5265
5367
  }
5266
5368
  }
5267
5369
 
5268
- function pr(...t) {
5269
- return new mr("startAt", t,
5370
+ function br(...t) {
5371
+ return new vr("startAt", t,
5270
5372
  /*inclusive=*/ !0);
5271
5373
  }
5272
5374
 
5273
- function yr(...t) {
5274
- return new mr("startAfter", t,
5375
+ function Er(...t) {
5376
+ return new vr("startAfter", t,
5275
5377
  /*inclusive=*/ !1);
5276
5378
  }
5277
5379
 
5278
- class _r extends or {
5380
+ class Ir extends lr {
5279
5381
  constructor(t, e, n) {
5280
5382
  super(), this.type = t, this.At = e, this.Rt = n;
5281
5383
  }
5282
5384
  _apply(t) {
5283
- const e = br(t, this.type, this.At, this.Rt);
5284
- return new yn(t.firestore, t.converter, function(t, e) {
5285
- return new we(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
5385
+ const e = Rr(t, this.type, this.At, this.Rt);
5386
+ return new En(t.firestore, t.converter, function(t, e) {
5387
+ return new me(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
5286
5388
  }(t._query, e));
5287
5389
  }
5288
5390
  }
5289
5391
 
5290
- function gr(...t) {
5291
- return new _r("endBefore", t,
5392
+ function Tr(...t) {
5393
+ return new Ir("endBefore", t,
5292
5394
  /*inclusive=*/ !1);
5293
5395
  }
5294
5396
 
5295
- function vr(...t) {
5296
- return new _r("endAt", t, /*inclusive=*/ !0);
5397
+ function Ar(...t) {
5398
+ return new Ir("endAt", t, /*inclusive=*/ !0);
5297
5399
  }
5298
5400
 
5299
- /** Helper function to create a bound from a document or fields */ function br(t, e, n, r) {
5300
- if (n[0] = l(n[0]), n[0] instanceof er) return function(t, e, n, r, s) {
5301
- if (!r) throw new M(V, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
5401
+ /** Helper function to create a bound from a document or fields */ function Rr(t, e, n, r) {
5402
+ if (n[0] = l(n[0]), n[0] instanceof or) return function(t, e, n, r, s) {
5403
+ if (!r) throw new U(N, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
5302
5404
  const i = [];
5303
5405
  // Because people expect to continue/end a query at the exact document
5304
5406
  // provided, we need to use the implicit sort order rather than the explicit
@@ -5307,42 +5409,42 @@ function vr(...t) {
5307
5409
  // the provided document. Without the key (by using the explicit sort
5308
5410
  // orders), multiple documents could match the position, yielding duplicate
5309
5411
  // results.
5310
- for (const n of _e(t)) if (n.field.isKeyField()) i.push(Qt(e, r.key)); else {
5412
+ for (const n of _e(t)) if (n.field.isKeyField()) i.push(Wt(e, r.key)); else {
5311
5413
  const t = r.data.field(n.field);
5312
- if (Ot(t)) throw new M(R, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
5414
+ if (kt(t)) throw new U(P, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
5313
5415
  if (null === t) {
5314
5416
  const t = n.field.canonicalString();
5315
- throw new M(R, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
5417
+ throw new U(P, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
5316
5418
  }
5317
5419
  i.push(t);
5318
5420
  }
5319
- return new he(i, s);
5421
+ return new le(i, s);
5320
5422
  }
5321
5423
  /**
5322
5424
  * Converts a list of field values to a `Bound` for the given query.
5323
5425
  */ (t._query, t.firestore._databaseId, e, n[0]._document, r);
5324
5426
  {
5325
- const s = qn(t.firestore);
5427
+ const s = Mn(t.firestore);
5326
5428
  return function(t, e, n, r, s, i) {
5327
5429
  // Use explicit order by's because it has to match the query the user made
5328
5430
  const o = t.explicitOrderBy;
5329
- if (s.length > o.length) throw new M(R, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
5431
+ if (s.length > o.length) throw new U(P, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
5330
5432
  const u = [];
5331
5433
  for (let i = 0; i < s.length; i++) {
5332
5434
  const c = s[i];
5333
5435
  if (o[i].field.isKeyField()) {
5334
- if ("string" != typeof c) throw new M(R, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
5335
- if (!ye(t) && -1 !== c.indexOf("/")) throw new M(R, `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.`);
5336
- const n = t.path.child(Z.fromString(c));
5337
- if (!nt.isDocumentKey(n)) throw new M(R, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
5338
- const s = new nt(n);
5339
- u.push(Qt(e, s));
5436
+ if ("string" != typeof c) throw new U(P, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
5437
+ if (!ge(t) && -1 !== c.indexOf("/")) throw new U(P, `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.`);
5438
+ const n = t.path.child(tt.fromString(c));
5439
+ if (!rt.isDocumentKey(n)) throw new U(P, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
5440
+ const s = new rt(n);
5441
+ u.push(Wt(e, s));
5340
5442
  } else {
5341
- const t = Qn(n, r, c);
5443
+ const t = Hn(n, r, c);
5342
5444
  u.push(t);
5343
5445
  }
5344
5446
  }
5345
- return new he(u, i);
5447
+ return new le(u, i);
5346
5448
  }
5347
5449
  /**
5348
5450
  * Parses the given `documentIdValue` into a `ReferenceValue`, throwing
@@ -5352,28 +5454,28 @@ function vr(...t) {
5352
5454
  }
5353
5455
  }
5354
5456
 
5355
- function Er(t, e, n) {
5457
+ function Pr(t, e, n) {
5356
5458
  if ("string" == typeof (n = l(n))) {
5357
- if ("" === n) throw new M(R, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
5358
- if (!ye(e) && -1 !== n.indexOf("/")) throw new M(R, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
5359
- const r = e.path.child(Z.fromString(n));
5360
- if (!nt.isDocumentKey(r)) throw new M(R, `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}).`);
5361
- return Qt(t, new nt(r));
5459
+ if ("" === n) throw new U(P, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
5460
+ if (!ge(e) && -1 !== n.indexOf("/")) throw new U(P, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
5461
+ const r = e.path.child(tt.fromString(n));
5462
+ if (!rt.isDocumentKey(r)) throw new U(P, `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}).`);
5463
+ return Wt(t, new rt(r));
5362
5464
  }
5363
- if (n instanceof pn) return Qt(t, n._key);
5364
- throw new M(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(n)}.`);
5465
+ if (n instanceof bn) return Wt(t, n._key);
5466
+ throw new U(P, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ut(n)}.`);
5365
5467
  }
5366
5468
 
5367
5469
  /**
5368
5470
  * Validates that the value passed into a disjunctive filter satisfies all
5369
5471
  * array requirements.
5370
- */ function Ir(t, e) {
5371
- if (!Array.isArray(t) || 0 === t.length) throw new M(R, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
5372
- if (t.length > 10) throw new M(R, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
5472
+ */ function Vr(t, e) {
5473
+ if (!Array.isArray(t) || 0 === t.length) throw new U(P, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
5474
+ if (t.length > 10) throw new U(P, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
5373
5475
  }
5374
5476
 
5375
- function Tr(t, e, n) {
5376
- if (!n.isEqual(e)) throw new M(R, `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.`);
5477
+ function Nr(t, e, n) {
5478
+ if (!n.isEqual(e)) throw new U(P, `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.`);
5377
5479
  }
5378
5480
 
5379
5481
  /**
@@ -5423,7 +5525,7 @@ function Tr(t, e, n) {
5423
5525
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
5424
5526
  * call.
5425
5527
  */
5426
- function Ar(t, e, n) {
5528
+ function $r(t, e, n) {
5427
5529
  let r;
5428
5530
  // Cast to `any` in order to satisfy the union type constraint on
5429
5531
  // toFirestore().
@@ -5432,9 +5534,9 @@ function Ar(t, e, n) {
5432
5534
  r;
5433
5535
  }
5434
5536
 
5435
- class Rr extends class {
5537
+ class Dr extends class {
5436
5538
  convertValue(t, e = "none") {
5437
- switch (Mt(t)) {
5539
+ switch (Ut(t)) {
5438
5540
  case 0 /* NullValue */ :
5439
5541
  return null;
5440
5542
 
@@ -5442,7 +5544,7 @@ class Rr extends class {
5442
5544
  return t.booleanValue;
5443
5545
 
5444
5546
  case 2 /* NumberValue */ :
5445
- return Ft(t.integerValue || t.doubleValue);
5547
+ return qt(t.integerValue || t.doubleValue);
5446
5548
 
5447
5549
  case 3 /* TimestampValue */ :
5448
5550
  return this.convertTimestamp(t.timestampValue);
@@ -5454,7 +5556,7 @@ class Rr extends class {
5454
5556
  return t.stringValue;
5455
5557
 
5456
5558
  case 6 /* BlobValue */ :
5457
- return this.convertBytes(qt(t.bytesValue));
5559
+ return this.convertBytes(Ot(t.bytesValue));
5458
5560
 
5459
5561
  case 7 /* RefValue */ :
5460
5562
  return this.convertReference(t.referenceValue);
@@ -5469,17 +5571,17 @@ class Rr extends class {
5469
5571
  return this.convertObject(t.mapValue, e);
5470
5572
 
5471
5573
  default:
5472
- throw v();
5574
+ throw b();
5473
5575
  }
5474
5576
  }
5475
5577
  convertObject(t, e) {
5476
5578
  const n = {};
5477
- return It(t.fields, ((t, r) => {
5579
+ return Tt(t.fields, ((t, r) => {
5478
5580
  n[t] = this.convertValue(r, e);
5479
5581
  })), n;
5480
5582
  }
5481
5583
  convertGeoPoint(t) {
5482
- return new Vn(Ft(t.latitude), Ft(t.longitude));
5584
+ return new Sn(qt(t.latitude), qt(t.longitude));
5483
5585
  }
5484
5586
  convertArray(t, e) {
5485
5587
  return (t.values || []).map((t => this.convertValue(t, e)));
@@ -5487,27 +5589,27 @@ class Rr extends class {
5487
5589
  convertServerTimestamp(t, e) {
5488
5590
  switch (e) {
5489
5591
  case "previous":
5490
- const n = kt(t);
5592
+ const n = Ct(t);
5491
5593
  return null == n ? null : this.convertValue(n, e);
5492
5594
 
5493
5595
  case "estimate":
5494
- return this.convertTimestamp(Ct(t));
5596
+ return this.convertTimestamp(Lt(t));
5495
5597
 
5496
5598
  default:
5497
5599
  return null;
5498
5600
  }
5499
5601
  }
5500
5602
  convertTimestamp(t) {
5501
- const e = St(t);
5502
- return new vt(e.seconds, e.nanos);
5603
+ const e = Ft(t);
5604
+ return new bt(e.seconds, e.nanos);
5503
5605
  }
5504
5606
  convertDocumentKey(t, e) {
5505
- const n = Z.fromString(t);
5506
- b(tn(n));
5507
- const r = new J(n.get(1), n.get(3)), s = new nt(n.popFirst(5));
5607
+ const n = tt.fromString(t);
5608
+ E(en(n));
5609
+ const r = new X(n.get(1), n.get(3)), s = new rt(n.popFirst(5));
5508
5610
  return r.isEqual(e) ||
5509
5611
  // TODO(b/64130202): Somehow support foreign references.
5510
- y(`Document ${s} 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.`),
5612
+ g(`Document ${s} 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.`),
5511
5613
  s;
5512
5614
  }
5513
5615
  } {
@@ -5515,11 +5617,11 @@ class Rr extends class {
5515
5617
  super(), this.firestore = t;
5516
5618
  }
5517
5619
  convertBytes(t) {
5518
- return new Rn(t);
5620
+ return new Nn(t);
5519
5621
  }
5520
5622
  convertReference(t) {
5521
5623
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
5522
- return new pn(this.firestore, /* converter= */ null, e);
5624
+ return new bn(this.firestore, /* converter= */ null, e);
5523
5625
  }
5524
5626
  }
5525
5627
 
@@ -5535,12 +5637,12 @@ class Rr extends class {
5535
5637
  * @param reference - The reference of the document to fetch.
5536
5638
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
5537
5639
  * document contents.
5538
- */ function Pr(t) {
5539
- const e = an((t = ut(t, pn)).firestore), n = new Rr(t.firestore);
5540
- return on(e, [ t._key ]).then((e => {
5541
- b(1 === e.length);
5640
+ */ function xr(t) {
5641
+ const e = ln((t = ct(t, bn)).firestore), n = new Dr(t.firestore);
5642
+ return un(e, [ t._key ]).then((e => {
5643
+ E(1 === e.length);
5542
5644
  const r = e[0];
5543
- return new er(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5645
+ return new or(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5544
5646
  }));
5545
5647
  }
5546
5648
 
@@ -5555,33 +5657,33 @@ class Rr extends class {
5555
5657
  *
5556
5658
  * @param query - The `Query` to execute.
5557
5659
  * @returns A Promise that will be resolved with the results of the query.
5558
- */ function Vr(t) {
5660
+ */ function Sr(t) {
5559
5661
  !function(t) {
5560
- if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new M(O, "limitToLast() queries require specifying at least one orderBy() clause");
5561
- }((t = ut(t, yn))._query);
5562
- const e = an(t.firestore), n = new Rr(t.firestore);
5563
- return un(e, t._query).then((e => {
5564
- const r = e.map((e => new nr(t.firestore, n, e.key, e, t.converter)));
5662
+ if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(k, "limitToLast() queries require specifying at least one orderBy() clause");
5663
+ }((t = ct(t, En))._query);
5664
+ const e = ln(t.firestore), n = new Dr(t.firestore);
5665
+ return cn(e, t._query).then((e => {
5666
+ const r = e.map((e => new ur(t.firestore, n, e.key, e, t.converter)));
5565
5667
  return "L" /* Last */ === t._query.limitType &&
5566
5668
  // Limit to last queries reverse the orderBy constraint that was
5567
5669
  // specified by the user. As such, we need to reverse the order of the
5568
5670
  // results to return the documents in the expected order.
5569
- r.reverse(), new rr(t, r);
5671
+ r.reverse(), new cr(t, r);
5570
5672
  }));
5571
5673
  }
5572
5674
 
5573
- function Nr(t, e, n) {
5574
- const r = Ar((t = ut(t, pn)).converter, e, n), s = On(qn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5575
- return sn(an(t.firestore), [ s.toMutation(t._key, Ve.none()) ]);
5675
+ function Fr(t, e, n) {
5676
+ const r = $r((t = ct(t, bn)).converter, e, n), s = Un(Mn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5677
+ return on(ln(t.firestore), [ s.toMutation(t._key, Ne.none()) ]);
5576
5678
  }
5577
5679
 
5578
- function $r(t, e, n, ...r) {
5579
- const s = qn((t = ut(t, pn)).firestore);
5680
+ function qr(t, e, n, ...r) {
5681
+ const s = Mn((t = ct(t, bn)).firestore);
5580
5682
  // For Compat types, we have to "extract" the underlying types before
5581
5683
  // performing validation.
5582
5684
  let i;
5583
- i = "string" == typeof (e = l(e)) || e instanceof Tn ? zn(s, "updateDoc", t._key, e, n, r) : Bn(s, "updateDoc", t._key, e);
5584
- return sn(an(t.firestore), [ i.toMutation(t._key, Ve.exists(!0)) ]);
5685
+ i = "string" == typeof (e = l(e)) || e instanceof $n ? Yn(s, "updateDoc", t._key, e, n, r) : Kn(s, "updateDoc", t._key, e);
5686
+ return on(ln(t.firestore), [ i.toMutation(t._key, Ne.exists(!0)) ]);
5585
5687
  }
5586
5688
 
5587
5689
  /**
@@ -5595,8 +5697,8 @@ function $r(t, e, n, ...r) {
5595
5697
  * @param reference - A reference to the document to delete.
5596
5698
  * @returns A `Promise` resolved once the document has been successfully
5597
5699
  * deleted from the backend.
5598
- */ function Dr(t) {
5599
- return sn(an((t = ut(t, pn)).firestore), [ new xe(t._key, Ve.none()) ]);
5700
+ */ function Or(t) {
5701
+ return on(ln((t = ct(t, bn)).firestore), [ new Se(t._key, Ne.none()) ]);
5600
5702
  }
5601
5703
 
5602
5704
  /**
@@ -5613,9 +5715,58 @@ function $r(t, e, n, ...r) {
5613
5715
  * @throws Error - If the provided input is not a valid Firestore document.
5614
5716
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
5615
5717
  * newly created document after it has been written to the backend.
5616
- */ function xr(t, e) {
5617
- const n = bn(t = ut(t, _n)), r = Ar(t.converter, e), s = On(qn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5618
- return sn(an(t.firestore), [ s.toMutation(n._key, Ve.exists(!1)) ]).then((() => n));
5718
+ */ function kr(t, e) {
5719
+ const n = Rn(t = ct(t, In)), r = $r(t.converter, e), s = Un(Mn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5720
+ return on(ln(t.firestore), [ s.toMutation(n._key, Ne.exists(!1)) ]).then((() => n));
5721
+ }
5722
+
5723
+ /**
5724
+ * @license
5725
+ * Copyright 2022 Google LLC
5726
+ *
5727
+ * Licensed under the Apache License, Version 2.0 (the "License");
5728
+ * you may not use this file except in compliance with the License.
5729
+ * You may obtain a copy of the License at
5730
+ *
5731
+ * http://www.apache.org/licenses/LICENSE-2.0
5732
+ *
5733
+ * Unless required by applicable law or agreed to in writing, software
5734
+ * distributed under the License is distributed on an "AS IS" BASIS,
5735
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5736
+ * See the License for the specific language governing permissions and
5737
+ * limitations under the License.
5738
+ */
5739
+ /**
5740
+ * Calculates the number of documents in the result set of the given query,
5741
+ * without actually downloading the documents.
5742
+ *
5743
+ * Using this function to count the documents is efficient because only the
5744
+ * final count, not the documents' data, is downloaded. This function can even
5745
+ * count the documents if the result set would be prohibitively large to
5746
+ * download entirely (e.g. thousands of documents).
5747
+ *
5748
+ * @param query - The query whose result set size to calculate.
5749
+ * @returns A Promise that will be resolved with the count; the count can be
5750
+ * retrieved from `snapshot.data().count`, where `snapshot` is the
5751
+ * `AggregateQuerySnapshot` to which the returned Promise resolves.
5752
+ */ function Cr(t) {
5753
+ const e = ct(t.firestore, dn), n = ln(e), r = new Dr(e);
5754
+ return new vn(t, n, r).run();
5755
+ }
5756
+
5757
+ /**
5758
+ * Compares two `AggregateQuerySnapshot` instances for equality.
5759
+ *
5760
+ * Two `AggregateQuerySnapshot` instances are considered "equal" if they have
5761
+ * underlying queries that compare equal, and the same data.
5762
+ *
5763
+ * @param left - The first `AggregateQuerySnapshot` to compare.
5764
+ * @param right - The second `AggregateQuerySnapshot` to compare.
5765
+ *
5766
+ * @returns `true` if the objects are "equal", as defined above, or `false`
5767
+ * otherwise.
5768
+ */ function Lr(t, e) {
5769
+ return Vn(t.query, e.query) && f(t.data(), e.data());
5619
5770
  }
5620
5771
 
5621
5772
  /**
@@ -5637,15 +5788,15 @@ function $r(t, e, n, ...r) {
5637
5788
  /**
5638
5789
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
5639
5790
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
5640
- */ function Sr() {
5641
- return new kn("deleteField");
5791
+ */ function Mr() {
5792
+ return new jn("deleteField");
5642
5793
  }
5643
5794
 
5644
5795
  /**
5645
5796
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
5646
5797
  * include a server-generated timestamp in the written data.
5647
- */ function Fr() {
5648
- return new Ln("serverTimestamp");
5798
+ */ function Ur() {
5799
+ return new Qn("serverTimestamp");
5649
5800
  }
5650
5801
 
5651
5802
  /**
@@ -5659,10 +5810,10 @@ function $r(t, e, n, ...r) {
5659
5810
  * @param elements - The elements to union into the array.
5660
5811
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5661
5812
  * `updateDoc()`.
5662
- */ function qr(...t) {
5813
+ */ function jr(...t) {
5663
5814
  // NOTE: We don't actually parse the data until it's used in set() or
5664
5815
  // update() since we'd need the Firestore instance to do this.
5665
- return new Mn("arrayUnion", t);
5816
+ return new zn("arrayUnion", t);
5666
5817
  }
5667
5818
 
5668
5819
  /**
@@ -5675,10 +5826,10 @@ function $r(t, e, n, ...r) {
5675
5826
  * @param elements - The elements to remove from the array.
5676
5827
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5677
5828
  * `updateDoc()`
5678
- */ function Or(...t) {
5829
+ */ function Br(...t) {
5679
5830
  // NOTE: We don't actually parse the data until it's used in set() or
5680
5831
  // update() since we'd need the Firestore instance to do this.
5681
- return new Un("arrayRemove", t);
5832
+ return new Wn("arrayRemove", t);
5682
5833
  }
5683
5834
 
5684
5835
  /**
@@ -5699,8 +5850,8 @@ function $r(t, e, n, ...r) {
5699
5850
  * @param n - The value to increment by.
5700
5851
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5701
5852
  * `updateDoc()`
5702
- */ function kr(t) {
5703
- return new jn("increment", t);
5853
+ */ function Qr(t) {
5854
+ return new Gn("increment", t);
5704
5855
  }
5705
5856
 
5706
5857
  /**
@@ -5726,25 +5877,25 @@ function $r(t, e, n, ...r) {
5726
5877
  * provides methods for adding writes to the write batch. None of the writes
5727
5878
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
5728
5879
  * called.
5729
- */ class Cr {
5880
+ */ class zr {
5730
5881
  /** @hideconstructor */
5731
5882
  constructor(t, e) {
5732
5883
  this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
5733
- this._dataReader = qn(t);
5884
+ this._dataReader = Mn(t);
5734
5885
  }
5735
5886
  set(t, e, n) {
5736
5887
  this._verifyNotCommitted();
5737
- const r = Lr(t, this._firestore), s = Ar(r.converter, e, n), i = On(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5738
- return this._mutations.push(i.toMutation(r._key, Ve.none())), this;
5888
+ const r = Wr(t, this._firestore), s = $r(r.converter, e, n), i = Un(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5889
+ return this._mutations.push(i.toMutation(r._key, Ne.none())), this;
5739
5890
  }
5740
5891
  update(t, e, n, ...r) {
5741
5892
  this._verifyNotCommitted();
5742
- const s = Lr(t, this._firestore);
5893
+ const s = Wr(t, this._firestore);
5743
5894
  // For Compat types, we have to "extract" the underlying types before
5744
5895
  // performing validation.
5745
5896
  let i;
5746
- return i = "string" == typeof (e = l(e)) || e instanceof Tn ? zn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : Bn(this._dataReader, "WriteBatch.update", s._key, e),
5747
- this._mutations.push(i.toMutation(s._key, Ve.exists(!0))), this;
5897
+ return i = "string" == typeof (e = l(e)) || e instanceof $n ? Yn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : Kn(this._dataReader, "WriteBatch.update", s._key, e),
5898
+ this._mutations.push(i.toMutation(s._key, Ne.exists(!0))), this;
5748
5899
  }
5749
5900
  /**
5750
5901
  * Deletes the document referred to by the provided {@link DocumentReference}.
@@ -5753,8 +5904,8 @@ function $r(t, e, n, ...r) {
5753
5904
  * @returns This `WriteBatch` instance. Used for chaining method calls.
5754
5905
  */ delete(t) {
5755
5906
  this._verifyNotCommitted();
5756
- const e = Lr(t, this._firestore);
5757
- return this._mutations = this._mutations.concat(new xe(e._key, Ve.none())), this;
5907
+ const e = Wr(t, this._firestore);
5908
+ return this._mutations = this._mutations.concat(new Se(e._key, Ne.none())), this;
5758
5909
  }
5759
5910
  /**
5760
5911
  * Commits all of the writes in this write batch as a single atomic unit.
@@ -5771,12 +5922,12 @@ function $r(t, e, n, ...r) {
5771
5922
  return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
5772
5923
  }
5773
5924
  _verifyNotCommitted() {
5774
- if (this._committed) throw new M(S, "A write batch can no longer be used after commit() has been called.");
5925
+ if (this._committed) throw new U(F, "A write batch can no longer be used after commit() has been called.");
5775
5926
  }
5776
5927
  }
5777
5928
 
5778
- function Lr(t, e) {
5779
- if ((t = l(t)).firestore !== e) throw new M(R, "Provided document reference is from a different Firestore instance.");
5929
+ function Wr(t, e) {
5930
+ if ((t = l(t)).firestore !== e) throw new U(P, "Provided document reference is from a different Firestore instance.");
5780
5931
  return t;
5781
5932
  }
5782
5933
 
@@ -5792,9 +5943,9 @@ function Lr(t, e) {
5792
5943
  *
5793
5944
  * @returns A `WriteBatch` that can be used to atomically execute multiple
5794
5945
  * writes.
5795
- */ function Mr(t) {
5796
- const e = an(t = ut(t, ln));
5797
- return new Cr(t, (t => sn(e, t)));
5946
+ */ function Gr(t) {
5947
+ const e = ln(t = ct(t, dn));
5948
+ return new zr(t, (t => on(e, t)));
5798
5949
  }
5799
5950
 
5800
5951
  /**
@@ -5816,7 +5967,7 @@ function Lr(t, e) {
5816
5967
  /**
5817
5968
  * Internal transaction object responsible for accumulating the mutations to
5818
5969
  * perform and the base versions for any documents read.
5819
- */ class Ur {
5970
+ */ class Kr {
5820
5971
  constructor(t) {
5821
5972
  this.datastore = t,
5822
5973
  // The version of each document that was read during this transaction.
@@ -5835,8 +5986,8 @@ function Lr(t, e) {
5835
5986
  this.writtenDocs = new Set;
5836
5987
  }
5837
5988
  async lookup(t) {
5838
- if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new M(R, "Firestore transactions require all reads to be executed before all writes.");
5839
- const e = await on(this.datastore, t);
5989
+ if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(P, "Firestore transactions require all reads to be executed before all writes.");
5990
+ const e = await un(this.datastore, t);
5840
5991
  return e.forEach((t => this.recordVersion(t))), e;
5841
5992
  }
5842
5993
  set(t, e) {
@@ -5851,7 +6002,7 @@ function Lr(t, e) {
5851
6002
  this.writtenDocs.add(t.toString());
5852
6003
  }
5853
6004
  delete(t) {
5854
- this.write(new xe(t, this.precondition(t))), this.writtenDocs.add(t.toString());
6005
+ this.write(new Se(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5855
6006
  }
5856
6007
  async commit() {
5857
6008
  if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
@@ -5863,22 +6014,22 @@ function Lr(t, e) {
5863
6014
  // For each document that was read but not written to, we want to perform
5864
6015
  // a `verify` operation.
5865
6016
  t.forEach(((t, e) => {
5866
- const n = nt.fromPath(e);
5867
- this.mutations.push(new Se(n, this.precondition(n)));
5868
- })), await sn(this.datastore, this.mutations), this.committed = !0;
6017
+ const n = rt.fromPath(e);
6018
+ this.mutations.push(new Fe(n, this.precondition(n)));
6019
+ })), await on(this.datastore, this.mutations), this.committed = !0;
5869
6020
  }
5870
6021
  recordVersion(t) {
5871
6022
  let e;
5872
6023
  if (t.isFoundDocument()) e = t.version; else {
5873
- if (!t.isNoDocument()) throw v();
6024
+ if (!t.isNoDocument()) throw b();
5874
6025
  // Represent a deleted doc using SnapshotVersion.min().
5875
- e = bt.min();
6026
+ e = Et.min();
5876
6027
  }
5877
6028
  const n = this.readVersions.get(t.key.toString());
5878
6029
  if (n) {
5879
6030
  if (!e.isEqual(n))
5880
6031
  // This transaction will fail no matter what.
5881
- throw new M(F, "Document version changed between two reads.");
6032
+ throw new U(q, "Document version changed between two reads.");
5882
6033
  } else this.readVersions.set(t.key.toString(), e);
5883
6034
  }
5884
6035
  /**
@@ -5886,7 +6037,7 @@ function Lr(t, e) {
5886
6037
  * as a precondition, or no precondition if it was not read.
5887
6038
  */ precondition(t) {
5888
6039
  const e = this.readVersions.get(t.toString());
5889
- return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(bt.min()) ? Ve.exists(!1) : Ve.updateTime(e) : Ve.none();
6040
+ return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(Et.min()) ? Ne.exists(!1) : Ne.updateTime(e) : Ne.none();
5890
6041
  }
5891
6042
  /**
5892
6043
  * Returns the precondition for a document if the operation is an update.
@@ -5895,7 +6046,7 @@ function Lr(t, e) {
5895
6046
  // The first time a document is written, we want to take into account the
5896
6047
  // read time and existence
5897
6048
  if (!this.writtenDocs.has(t.toString()) && e) {
5898
- if (e.isEqual(bt.min()))
6049
+ if (e.isEqual(Et.min()))
5899
6050
  // The document doesn't exist, so fail the transaction.
5900
6051
  // This has to be validated locally because you can't send a
5901
6052
  // precondition that a document does not exist without changing the
@@ -5905,13 +6056,13 @@ function Lr(t, e) {
5905
6056
  // express that to the backend, we have to validate locally.
5906
6057
  // Note: this can change once we can send separate verify writes in the
5907
6058
  // transaction.
5908
- throw new M(R, "Can't update a document that doesn't exist.");
6059
+ throw new U(P, "Can't update a document that doesn't exist.");
5909
6060
  // Document exists, base precondition on document update time.
5910
- return Ve.updateTime(e);
6061
+ return Ne.updateTime(e);
5911
6062
  }
5912
6063
  // Document was not read, so we just use the preconditions for a blind
5913
6064
  // update.
5914
- return Ve.exists(!0);
6065
+ return Ne.exists(!0);
5915
6066
  }
5916
6067
  write(t) {
5917
6068
  this.ensureCommitNotCalled(), this.mutations.push(t);
@@ -5934,7 +6085,7 @@ function Lr(t, e) {
5934
6085
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5935
6086
  * See the License for the specific language governing permissions and
5936
6087
  * limitations under the License.
5937
- */ const jr = {
6088
+ */ const Yr = {
5938
6089
  maxAttempts: 5
5939
6090
  };
5940
6091
 
@@ -5958,17 +6109,17 @@ function Lr(t, e) {
5958
6109
  * TransactionRunner encapsulates the logic needed to run and retry transactions
5959
6110
  * with backoff.
5960
6111
  */
5961
- class Br {
6112
+ class Hr {
5962
6113
  constructor(t, e, n, r, s) {
5963
6114
  this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
5964
- this.deferred = s, this.Pt = n.maxAttempts, this.Vt = new nn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
6115
+ this.deferred = s, this.Pt = n.maxAttempts, this.Vt = new rn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5965
6116
  }
5966
6117
  /** Runs the transaction and sets the result on deferred. */ run() {
5967
6118
  this.Pt -= 1, this.Nt();
5968
6119
  }
5969
6120
  Nt() {
5970
6121
  this.Vt.J((async () => {
5971
- const t = new Ur(this.datastore), e = this.$t(t);
6122
+ const t = new Kr(this.datastore), e = this.$t(t);
5972
6123
  e && e.then((e => {
5973
6124
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
5974
6125
  this.deferred.resolve(e);
@@ -5983,7 +6134,7 @@ class Br {
5983
6134
  $t(t) {
5984
6135
  try {
5985
6136
  const e = this.updateFunction(t);
5986
- return !at(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
6137
+ return !ht(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5987
6138
  null);
5988
6139
  } catch (t) {
5989
6140
  // Do not retry errors thrown by user provided updateFunction.
@@ -6009,31 +6160,31 @@ class Br {
6009
6160
  function(t) {
6010
6161
  switch (t) {
6011
6162
  default:
6012
- return v();
6163
+ return b();
6013
6164
 
6014
- case T:
6015
6165
  case A:
6016
- case P:
6017
- case x:
6018
- case k:
6166
+ case R:
6167
+ case V:
6168
+ case S:
6019
6169
  case C:
6170
+ case L:
6020
6171
  // Unauthenticated means something went wrong with our token and we need
6021
6172
  // to retry with new credentials which will happen automatically.
6022
- case D:
6173
+ case x:
6023
6174
  return !1;
6024
6175
 
6025
- case R:
6026
- case V:
6176
+ case P:
6027
6177
  case N:
6028
6178
  case $:
6029
- case S:
6179
+ case D:
6180
+ case F:
6030
6181
  // Aborted might be retried in some scenarios, but that is dependant on
6031
6182
  // the context and should handled individually by the calling code.
6032
6183
  // See https://cloud.google.com/apis/design/errors.
6033
- case F:
6034
- case q:
6184
+ case q:
6035
6185
  case O:
6036
- case L:
6186
+ case k:
6187
+ case M:
6037
6188
  return !0;
6038
6189
  }
6039
6190
  }(e);
@@ -6058,7 +6209,7 @@ class Br {
6058
6209
  * See the License for the specific language governing permissions and
6059
6210
  * limitations under the License.
6060
6211
  */
6061
- /** The Platform's 'document' implementation or null if not available. */ function zr() {
6212
+ /** The Platform's 'document' implementation or null if not available. */ function Jr() {
6062
6213
  // `document` is not always available, e.g. in ReactNative and WebWorkers.
6063
6214
  // eslint-disable-next-line no-restricted-globals
6064
6215
  return "undefined" != typeof document ? document : null;
@@ -6090,10 +6241,10 @@ class Br {
6090
6241
  * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
6091
6242
  * in newer versions of TypeScript defines `finally`, which is not available in
6092
6243
  * IE.
6093
- */ class Qr {
6244
+ */ class Xr {
6094
6245
  constructor(t, e, n, r, s) {
6095
6246
  this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
6096
- this.deferred = new U, this.then = this.deferred.promise.then.bind(this.deferred.promise),
6247
+ this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
6097
6248
  // It's normal for the deferred promise to be canceled (due to cancellation)
6098
6249
  // and so we attach a dummy catch callback to avoid
6099
6250
  // 'UnhandledPromiseRejectionWarning' log spam.
@@ -6113,7 +6264,7 @@ class Br {
6113
6264
  * PORTING NOTE: This exists to prevent making removeDelayedOperation() and
6114
6265
  * the DelayedOperation class public.
6115
6266
  */ static createAndSchedule(t, e, n, r, s) {
6116
- const i = Date.now() + n, o = new Qr(t, e, i, r, s);
6267
+ const i = Date.now() + n, o = new Xr(t, e, i, r, s);
6117
6268
  return o.start(n), o;
6118
6269
  }
6119
6270
  /**
@@ -6135,7 +6286,7 @@ class Br {
6135
6286
  * As long as the operation has not yet been run, calling cancel() provides a
6136
6287
  * guarantee that the operation will not be run.
6137
6288
  */ cancel(t) {
6138
- null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new M(T, "Operation cancelled" + (t ? ": " + t : ""))));
6289
+ null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new U(A, "Operation cancelled" + (t ? ": " + t : ""))));
6139
6290
  }
6140
6291
  handleDelayElapsed() {
6141
6292
  this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
@@ -6162,7 +6313,7 @@ class Br {
6162
6313
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6163
6314
  * See the License for the specific language governing permissions and
6164
6315
  * limitations under the License.
6165
- */ class Wr {
6316
+ */ class Zr {
6166
6317
  constructor() {
6167
6318
  // The last promise in the queue.
6168
6319
  this.St = Promise.resolve(),
@@ -6185,15 +6336,15 @@ class Br {
6185
6336
  // List of TimerIds to fast-forward delays for.
6186
6337
  this.Mt = [],
6187
6338
  // Backoff timer used to schedule retries for retryable operations
6188
- this.Vt = new nn(this, "async_queue_retry" /* AsyncQueueRetry */),
6339
+ this.Vt = new rn(this, "async_queue_retry" /* AsyncQueueRetry */),
6189
6340
  // Visibility handler that triggers an immediate retry of all retryable
6190
6341
  // operations. Meant to speed up recovery when we regain file system access
6191
6342
  // after page comes into foreground.
6192
6343
  this.Ut = () => {
6193
- const t = zr();
6194
- t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Vt.Z();
6344
+ const t = Jr();
6345
+ t && y("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Vt.Z();
6195
6346
  };
6196
- const t = zr();
6347
+ const t = Jr();
6197
6348
  t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ut);
6198
6349
  }
6199
6350
  get isShuttingDown() {
@@ -6214,7 +6365,7 @@ class Br {
6214
6365
  enterRestrictedMode(t) {
6215
6366
  if (!this.qt) {
6216
6367
  this.qt = !0, this.Lt = t || !1;
6217
- const e = zr();
6368
+ const e = Jr();
6218
6369
  e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ut);
6219
6370
  }
6220
6371
  }
@@ -6225,17 +6376,17 @@ class Br {
6225
6376
  // Create a deferred Promise that we can return to the callee. This
6226
6377
  // allows us to return a "hanging Promise" only to the callee and still
6227
6378
  // advance the queue even when the operation is not run.
6228
- const e = new U;
6379
+ const e = new j;
6229
6380
  return this.Bt((() => this.qt && this.Lt ? Promise.resolve() : (t().then(e.resolve, e.reject),
6230
6381
  e.promise))).then((() => e.promise));
6231
6382
  }
6232
6383
  enqueueRetryable(t) {
6233
- this.enqueueAndForget((() => (this.Ft.push(t), this.zt())));
6384
+ this.enqueueAndForget((() => (this.Ft.push(t), this.Qt())));
6234
6385
  }
6235
6386
  /**
6236
6387
  * Runs the next operation from the retryable queue. If the operation fails,
6237
6388
  * reschedules with backoff.
6238
- */ async zt() {
6389
+ */ async Qt() {
6239
6390
  if (0 !== this.Ft.length) {
6240
6391
  try {
6241
6392
  await this.Ft[0](), this.Ft.shift(), this.Vt.reset();
@@ -6280,7 +6431,7 @@ class Br {
6280
6431
  * limitations under the License.
6281
6432
  */ (t)) throw t;
6282
6433
  // Failure will be handled by AsyncQueue
6283
- p("AsyncQueue", "Operation failed with retryable error: " + t);
6434
+ y("AsyncQueue", "Operation failed with retryable error: " + t);
6284
6435
  }
6285
6436
  this.Ft.length > 0 &&
6286
6437
  // If there are additional operations, we re-schedule `retryNextOp()`.
@@ -6293,7 +6444,7 @@ class Br {
6293
6444
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
6294
6445
  // new backoff on every call, there is only ever a single additional
6295
6446
  // operation in the queue.
6296
- this.Vt.J((() => this.zt()));
6447
+ this.Vt.J((() => this.Qt()));
6297
6448
  }
6298
6449
  }
6299
6450
  Bt(t) {
@@ -6338,7 +6489,7 @@ class Br {
6338
6489
  // Re-throw the error so that this.tail becomes a rejected Promise and
6339
6490
  // all further attempts to chain (via .then) will just short-circuit
6340
6491
  // and return the rejected Promise.
6341
- throw y("INTERNAL UNHANDLED ERROR: ", e), t;
6492
+ throw g("INTERNAL UNHANDLED ERROR: ", e), t;
6342
6493
  })).then((t => (this.Ct = !1, t))))));
6343
6494
  return this.St = e, e;
6344
6495
  }
@@ -6346,11 +6497,11 @@ class Br {
6346
6497
  this.jt(),
6347
6498
  // Fast-forward delays for timerIds that have been overriden.
6348
6499
  this.Mt.indexOf(t) > -1 && (e = 0);
6349
- const r = Qr.createAndSchedule(this, t, e, n, (t => this.Qt(t)));
6500
+ const r = Xr.createAndSchedule(this, t, e, n, (t => this.zt(t)));
6350
6501
  return this.Ot.push(r), r;
6351
6502
  }
6352
6503
  jt() {
6353
- this.kt && v();
6504
+ this.kt && b();
6354
6505
  }
6355
6506
  verifyOperationInProgress() {}
6356
6507
  /**
@@ -6393,17 +6544,17 @@ class Br {
6393
6544
  */ Yt(t) {
6394
6545
  this.Mt.push(t);
6395
6546
  }
6396
- /** Called once a DelayedOperation is run or canceled. */ Qt(t) {
6547
+ /** Called once a DelayedOperation is run or canceled. */ zt(t) {
6397
6548
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
6398
6549
  const e = this.Ot.indexOf(t);
6399
6550
  this.Ot.splice(e, 1);
6400
6551
  }
6401
6552
  }
6402
6553
 
6403
- class Gr {
6554
+ class ts {
6404
6555
  /** @hideconstructor */
6405
6556
  constructor(t, e) {
6406
- this._firestore = t, this._transaction = e, this._dataReader = qn(t);
6557
+ this._firestore = t, this._transaction = e, this._dataReader = Mn(t);
6407
6558
  }
6408
6559
  /**
6409
6560
  * Reads the document referenced by the provided {@link DocumentReference}.
@@ -6411,25 +6562,25 @@ class Gr {
6411
6562
  * @param documentRef - A reference to the document to be read.
6412
6563
  * @returns A `DocumentSnapshot` with the read data.
6413
6564
  */ get(t) {
6414
- const e = Lr(t, this._firestore), n = new Rr(this._firestore);
6565
+ const e = Wr(t, this._firestore), n = new Dr(this._firestore);
6415
6566
  return this._transaction.lookup([ e._key ]).then((t => {
6416
- if (!t || 1 !== t.length) return v();
6567
+ if (!t || 1 !== t.length) return b();
6417
6568
  const r = t[0];
6418
- if (r.isFoundDocument()) return new er(this._firestore, n, r.key, r, e.converter);
6419
- if (r.isNoDocument()) return new er(this._firestore, n, e._key, null, e.converter);
6420
- throw v();
6569
+ if (r.isFoundDocument()) return new or(this._firestore, n, r.key, r, e.converter);
6570
+ if (r.isNoDocument()) return new or(this._firestore, n, e._key, null, e.converter);
6571
+ throw b();
6421
6572
  }));
6422
6573
  }
6423
6574
  set(t, e, n) {
6424
- const r = Lr(t, this._firestore), s = Ar(r.converter, e, n), i = On(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
6575
+ const r = Wr(t, this._firestore), s = $r(r.converter, e, n), i = Un(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
6425
6576
  return this._transaction.set(r._key, i), this;
6426
6577
  }
6427
6578
  update(t, e, n, ...r) {
6428
- const s = Lr(t, this._firestore);
6579
+ const s = Wr(t, this._firestore);
6429
6580
  // For Compat types, we have to "extract" the underlying types before
6430
6581
  // performing validation.
6431
6582
  let i;
6432
- return i = "string" == typeof (e = l(e)) || e instanceof Tn ? zn(this._dataReader, "Transaction.update", s._key, e, n, r) : Bn(this._dataReader, "Transaction.update", s._key, e),
6583
+ return i = "string" == typeof (e = l(e)) || e instanceof $n ? Yn(this._dataReader, "Transaction.update", s._key, e, n, r) : Kn(this._dataReader, "Transaction.update", s._key, e),
6433
6584
  this._transaction.update(s._key, i), this;
6434
6585
  }
6435
6586
  /**
@@ -6438,7 +6589,7 @@ class Gr {
6438
6589
  * @param documentRef - A reference to the document to be deleted.
6439
6590
  * @returns This `Transaction` instance. Used for chaining method calls.
6440
6591
  */ delete(t) {
6441
- const e = Lr(t, this._firestore);
6592
+ const e = Wr(t, this._firestore);
6442
6593
  return this._transaction.delete(e._key), this;
6443
6594
  }
6444
6595
  }
@@ -6461,13 +6612,13 @@ class Gr {
6461
6612
  * (the `updateFunction` returned a failed promise), the promise returned by the
6462
6613
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
6463
6614
  * rejected promise with the corresponding failure error is returned.
6464
- */ function Kr(t, e, n) {
6465
- const r = an(t = ut(t, ln)), s = Object.assign(Object.assign({}, jr), n);
6615
+ */ function es(t, e, n) {
6616
+ const r = ln(t = ct(t, dn)), s = Object.assign(Object.assign({}, Yr), n);
6466
6617
  !function(t) {
6467
- if (t.maxAttempts < 1) throw new M(R, "Max attempts must be at least 1");
6618
+ if (t.maxAttempts < 1) throw new U(P, "Max attempts must be at least 1");
6468
6619
  }(s);
6469
- const i = new U;
6470
- return new Br(new Wr, r, s, (n => e(new Gr(t, n))), i).run(), i.promise;
6620
+ const i = new j;
6621
+ return new Hr(new Zr, r, s, (n => e(new ts(t, n))), i).run(), i.promise;
6471
6622
  }
6472
6623
 
6473
6624
  /**
@@ -6478,11 +6629,11 @@ class Gr {
6478
6629
  * directly to the backend, and `onSnapshot()` APIs are not supported.
6479
6630
  * @packageDocumentation
6480
6631
  */ !function(t) {
6481
- d = t;
6632
+ w = t;
6482
6633
  }(`${s}_lite`), n(new i("firestore/lite", ((t, {instanceIdentifier: e, options: n}) => {
6483
- const r = t.getProvider("app").getImmediate(), s = new ln(new Q(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")), function(t, e) {
6484
- if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(R, '"projectId" not provided in firebase.initializeApp.');
6485
- return new J(t.options.projectId, e);
6634
+ const r = t.getProvider("app").getImmediate(), s = new dn(new W(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")), function(t, e) {
6635
+ if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(P, '"projectId" not provided in firebase.initializeApp.');
6636
+ return new X(t.options.projectId, e);
6486
6637
  }
6487
6638
  /**
6488
6639
  * @license
@@ -6503,7 +6654,7 @@ class Gr {
6503
6654
  return n && s._setSettings(n), s;
6504
6655
  }), "PUBLIC").setMultipleInstances(!0)),
6505
6656
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
6506
- r("firestore-lite", "3.5.0-canary.e35db6f95", "rn"), r("firestore-lite", "3.5.0-canary.e35db6f95", "esm2017");
6657
+ r("firestore-lite", "3.5.0-canary.ee871fc0b", "rn"), r("firestore-lite", "3.5.0-canary.ee871fc0b", "esm2017");
6507
6658
 
6508
- export { Rn as Bytes, _n as CollectionReference, pn as DocumentReference, er as DocumentSnapshot, Tn as FieldPath, Pn as FieldValue, ln as Firestore, M as FirestoreError, Vn as GeoPoint, yn as Query, or as QueryConstraint, nr as QueryDocumentSnapshot, rr as QuerySnapshot, vt as Timestamp, Gr as Transaction, Cr as WriteBatch, xr as addDoc, Or as arrayRemove, qr as arrayUnion, gn as collection, vn as collectionGroup, wn as connectFirestoreEmulator, Dr as deleteDoc, Sr as deleteField, bn as doc, An as documentId, vr as endAt, gr as endBefore, Pr as getDoc, Vr as getDocs, dn as getFirestore, kr as increment, fn as initializeFirestore, dr as limit, wr as limitToLast, lr as orderBy, ur as query, In as queryEqual, En as refEqual, Kr as runTransaction, Fr as serverTimestamp, Nr as setDoc, m as setLogLevel, sr as snapshotEqual, yr as startAfter, pr as startAt, mn as terminate, $r as updateDoc, ar as where, Mr as writeBatch };
6659
+ export { gn as AggregateField, _n as AggregateQuerySnapshot, Nn as Bytes, In as CollectionReference, bn as DocumentReference, or as DocumentSnapshot, $n as FieldPath, xn as FieldValue, dn as Firestore, U as FirestoreError, Sn as GeoPoint, En as Query, lr as QueryConstraint, ur as QueryDocumentSnapshot, cr as QuerySnapshot, bt as Timestamp, ts as Transaction, zr as WriteBatch, kr as addDoc, Lr as aggregateQuerySnapshotEqual, Br as arrayRemove, jr as arrayUnion, Tn as collection, An as collectionGroup, pn as connectFirestoreEmulator, Or as deleteDoc, Mr as deleteField, Rn as doc, Dn as documentId, Ar as endAt, Tr as endBefore, Cr as getCount, xr as getDoc, Sr as getDocs, mn as getFirestore, Qr as increment, wn as initializeFirestore, gr as limit, _r as limitToLast, pr as orderBy, fr as query, Vn as queryEqual, Pn as refEqual, es as runTransaction, Ur as serverTimestamp, Fr as setDoc, p as setLogLevel, ar as snapshotEqual, Er as startAfter, br as startAt, yn as terminate, qr as updateDoc, wr as where, Gr as writeBatch };
6509
6660
  //# sourceMappingURL=index.rn.esm2017.js.map