@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
@@ -1,7 +1,7 @@
1
1
  import { _registerComponent, registerVersion, _getProvider, getApp, _removeServiceInstance, SDK_VERSION } from '@firebase/app';
2
2
  import { Component } from '@firebase/component';
3
3
  import { Logger, LogLevel } from '@firebase/logger';
4
- import { FirebaseError, createMockUserToken, getModularInstance } from '@firebase/util';
4
+ import { FirebaseError, createMockUserToken, getModularInstance, deepEqual } from '@firebase/util';
5
5
 
6
6
  /**
7
7
  * @license
@@ -23,7 +23,7 @@ import { FirebaseError, createMockUserToken, getModularInstance } from '@firebas
23
23
  * Simple wrapper around a nullable UID. Mostly exists to make code more
24
24
  * readable.
25
25
  */
26
- class l {
26
+ class f {
27
27
  constructor(t) {
28
28
  this.uid = t;
29
29
  }
@@ -41,11 +41,11 @@ class l {
41
41
  }
42
42
  }
43
43
 
44
- /** A user with a null UID. */ l.UNAUTHENTICATED = new l(null),
44
+ /** A user with a null UID. */ f.UNAUTHENTICATED = new f(null),
45
45
  // TODO(mikelehen): Look into getting a proper uid-equivalent for
46
46
  // non-FirebaseAuth providers.
47
- l.GOOGLE_CREDENTIALS = new l("google-credentials-uid"), l.FIRST_PARTY = new l("first-party-uid"),
48
- l.MOCK_USER = new l("mock-user");
47
+ f.GOOGLE_CREDENTIALS = new f("google-credentials-uid"), f.FIRST_PARTY = new f("first-party-uid"),
48
+ f.MOCK_USER = new f("mock-user");
49
49
 
50
50
  /**
51
51
  * @license
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
63
63
  * See the License for the specific language governing permissions and
64
64
  * limitations under the License.
65
65
  */
66
- let f = "9.10.0-canary.e35db6f95";
66
+ let d = "9.10.0-canary.ee871fc0b";
67
67
 
68
68
  /**
69
69
  * @license
@@ -81,7 +81,7 @@ let f = "9.10.0-canary.e35db6f95";
81
81
  * See the License for the specific language governing permissions and
82
82
  * limitations under the License.
83
83
  */
84
- const d = new Logger("@firebase/firestore");
84
+ const w = new Logger("@firebase/firestore");
85
85
 
86
86
  /**
87
87
  * Sets the verbosity of Cloud Firestore logs (debug, error, or silent).
@@ -95,36 +95,36 @@ const d = new Logger("@firebase/firestore");
95
95
  * <li>`error` to log errors only.</li>
96
96
  * <li><code>`silent` to turn off logging.</li>
97
97
  * </ul>
98
- */ function w(t) {
99
- d.setLogLevel(t);
98
+ */ function m(t) {
99
+ w.setLogLevel(t);
100
100
  }
101
101
 
102
- function m(t, ...e) {
103
- if (d.logLevel <= LogLevel.DEBUG) {
104
- const n = e.map(_);
105
- d.debug(`Firestore (${f}): ${t}`, ...n);
102
+ function p(t, ...e) {
103
+ if (w.logLevel <= LogLevel.DEBUG) {
104
+ const n = e.map(g);
105
+ w.debug(`Firestore (${d}): ${t}`, ...n);
106
106
  }
107
107
  }
108
108
 
109
- function p(t, ...e) {
110
- if (d.logLevel <= LogLevel.ERROR) {
111
- const n = e.map(_);
112
- d.error(`Firestore (${f}): ${t}`, ...n);
109
+ function y(t, ...e) {
110
+ if (w.logLevel <= LogLevel.ERROR) {
111
+ const n = e.map(g);
112
+ w.error(`Firestore (${d}): ${t}`, ...n);
113
113
  }
114
114
  }
115
115
 
116
116
  /**
117
117
  * @internal
118
- */ function y(t, ...e) {
119
- if (d.logLevel <= LogLevel.WARN) {
120
- const n = e.map(_);
121
- d.warn(`Firestore (${f}): ${t}`, ...n);
118
+ */ function _(t, ...e) {
119
+ if (w.logLevel <= LogLevel.WARN) {
120
+ const n = e.map(g);
121
+ w.warn(`Firestore (${d}): ${t}`, ...n);
122
122
  }
123
123
  }
124
124
 
125
125
  /**
126
126
  * Converts an additional log parameter to a string representation.
127
- */ function _(t) {
127
+ */ function g(t) {
128
128
  if ("string" == typeof t) return t;
129
129
  try {
130
130
  return e = t, JSON.stringify(e);
@@ -175,14 +175,14 @@ function p(t, ...e) {
175
175
  * Returns `never` and can be used in expressions:
176
176
  * @example
177
177
  * let futureVar = fail('not implemented yet');
178
- */ function g(t = "Unexpected state") {
178
+ */ function v(t = "Unexpected state") {
179
179
  // Log the failure in addition to throw an exception, just in case the
180
180
  // exception is swallowed.
181
- const e = `FIRESTORE (${f}) INTERNAL ASSERTION FAILED: ` + t;
181
+ const e = `FIRESTORE (${d}) INTERNAL ASSERTION FAILED: ` + t;
182
182
  // NOTE: We don't use FirestoreError here because these are internal failures
183
183
  // that cannot be handled by the user. (Also it would create a circular
184
184
  // dependency between the error and assert modules which doesn't work.)
185
- throw p(e), new Error(e);
185
+ throw y(e), new Error(e);
186
186
  }
187
187
 
188
188
  /**
@@ -190,14 +190,14 @@ function p(t, ...e) {
190
190
  * given message if it did.
191
191
  *
192
192
  * Messages are stripped in production builds.
193
- */ function v(t, e) {
194
- t || g();
193
+ */ function b(t, e) {
194
+ t || v();
195
195
  }
196
196
 
197
197
  /**
198
198
  * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
199
199
  * instance of `T` before casting.
200
- */ function b(t,
200
+ */ function E(t,
201
201
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
202
202
  e) {
203
203
  return t;
@@ -218,9 +218,9 @@ e) {
218
218
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
219
219
  * See the License for the specific language governing permissions and
220
220
  * limitations under the License.
221
- */ const E = "ok", I = "cancelled", T = "unknown", A = "invalid-argument", R = "deadline-exceeded", P = "not-found", V = "already-exists", N = "permission-denied", D = "unauthenticated", $ = "resource-exhausted", x = "failed-precondition", F = "aborted", S = "out-of-range", q = "unimplemented", O = "internal", k = "unavailable", C = "data-loss";
221
+ */ const I = "ok", T = "cancelled", A = "unknown", R = "invalid-argument", P = "deadline-exceeded", V = "not-found", N = "already-exists", D = "permission-denied", $ = "unauthenticated", x = "resource-exhausted", F = "failed-precondition", S = "aborted", q = "out-of-range", O = "unimplemented", k = "internal", C = "unavailable", L = "data-loss";
222
222
 
223
- /** An error returned by a Firestore operation. */ class L extends FirebaseError {
223
+ /** An error returned by a Firestore operation. */ class M extends FirebaseError {
224
224
  /** @hideconstructor */
225
225
  constructor(
226
226
  /**
@@ -254,7 +254,7 @@ e) {
254
254
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
255
255
  * See the License for the specific language governing permissions and
256
256
  * limitations under the License.
257
- */ class M {
257
+ */ class U {
258
258
  constructor() {
259
259
  this.promise = new Promise(((t, e) => {
260
260
  this.resolve = t, this.reject = e;
@@ -277,7 +277,7 @@ e) {
277
277
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
278
278
  * See the License for the specific language governing permissions and
279
279
  * limitations under the License.
280
- */ class U {
280
+ */ class j {
281
281
  constructor(t, e) {
282
282
  this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
283
283
  }
@@ -286,14 +286,14 @@ e) {
286
286
  /**
287
287
  * A CredentialsProvider that always yields an empty token.
288
288
  * @internal
289
- */ class j {
289
+ */ class B {
290
290
  getToken() {
291
291
  return Promise.resolve(null);
292
292
  }
293
293
  invalidateToken() {}
294
294
  start(t, e) {
295
295
  // Fire with initial user.
296
- t.enqueueRetryable((() => e(l.UNAUTHENTICATED)));
296
+ t.enqueueRetryable((() => e(f.UNAUTHENTICATED)));
297
297
  }
298
298
  shutdown() {}
299
299
  }
@@ -301,7 +301,7 @@ e) {
301
301
  /**
302
302
  * A CredentialsProvider that always returns a constant token. Used for
303
303
  * emulator token mocking.
304
- */ class B {
304
+ */ class Q {
305
305
  constructor(t) {
306
306
  this.token = t,
307
307
  /**
@@ -332,8 +332,8 @@ e) {
332
332
  }));
333
333
  }
334
334
  getToken() {
335
- return this.auth ? this.auth.getToken().then((t => t ? (v("string" == typeof t.accessToken),
336
- new U(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
335
+ return this.auth ? this.auth.getToken().then((t => t ? (b("string" == typeof t.accessToken),
336
+ new j(t.accessToken, new f(this.auth.getUid()))) : null)) : Promise.resolve(null);
337
337
  }
338
338
  invalidateToken() {}
339
339
  start(t, e) {}
@@ -348,13 +348,13 @@ e) {
348
348
  * safer to keep the implementation as-is.
349
349
  */ class G {
350
350
  constructor(t, e, n, r) {
351
- this.t = t, this.i = e, this.o = n, this.u = r, this.type = "FirstParty", this.user = l.FIRST_PARTY,
351
+ this.t = t, this.i = e, this.o = n, this.u = r, this.type = "FirstParty", this.user = f.FIRST_PARTY,
352
352
  this.h = new Map;
353
353
  }
354
354
  /** Gets an authorization token, using a provided factory function, or falling back to First Party GAPI. */ l() {
355
355
  return this.u ? this.u() : (
356
356
  // Make sure this really is a Gapi client.
357
- v(!("object" != typeof this.t || null === this.t || !this.t.auth || !this.t.auth.getAuthHeaderValueForFirstParty)),
357
+ b(!("object" != typeof this.t || null === this.t || !this.t.auth || !this.t.auth.getAuthHeaderValueForFirstParty)),
358
358
  this.t.auth.getAuthHeaderValueForFirstParty([]));
359
359
  }
360
360
  get headers() {
@@ -370,7 +370,7 @@ e) {
370
370
  * Provides user credentials required for the Firestore JavaScript SDK
371
371
  * to authenticate the user, using technique that is only available
372
372
  * to applications hosted by Google.
373
- */ class Q {
373
+ */ class W {
374
374
  constructor(t, e, n, r) {
375
375
  this.t = t, this.i = e, this.o = n, this.u = r;
376
376
  }
@@ -379,27 +379,27 @@ e) {
379
379
  }
380
380
  start(t, e) {
381
381
  // Fire with initial uid.
382
- t.enqueueRetryable((() => e(l.FIRST_PARTY)));
382
+ t.enqueueRetryable((() => e(f.FIRST_PARTY)));
383
383
  }
384
384
  shutdown() {}
385
385
  invalidateToken() {}
386
386
  }
387
387
 
388
- class W {
388
+ class K {
389
389
  constructor(t) {
390
390
  this.value = t, this.type = "AppCheck", this.headers = new Map, t && t.length > 0 && this.headers.set("x-firebase-appcheck", this.value);
391
391
  }
392
392
  }
393
393
 
394
- /** AppCheck token provider for the Lite SDK. */ class K {
394
+ /** AppCheck token provider for the Lite SDK. */ class Y {
395
395
  constructor(t) {
396
396
  this.m = t, this.appCheck = null, t.onInit((t => {
397
397
  this.appCheck = t;
398
398
  }));
399
399
  }
400
400
  getToken() {
401
- return this.appCheck ? this.appCheck.getToken().then((t => t ? (v("string" == typeof t.token),
402
- new W(t.token)) : null)) : Promise.resolve(null);
401
+ return this.appCheck ? this.appCheck.getToken().then((t => t ? (b("string" == typeof t.token),
402
+ new K(t.token)) : null)) : Promise.resolve(null);
403
403
  }
404
404
  invalidateToken() {}
405
405
  start(t, e) {}
@@ -426,7 +426,7 @@ class W {
426
426
  * See the License for the specific language governing permissions and
427
427
  * limitations under the License.
428
428
  */
429
- class Y {
429
+ class H {
430
430
  /**
431
431
  * Constructs a DatabaseInfo using the provided host, databaseId and
432
432
  * persistenceKey.
@@ -455,38 +455,38 @@ class Y {
455
455
  * Represents the database ID a Firestore client is associated with.
456
456
  * @internal
457
457
  */
458
- class H {
458
+ class J {
459
459
  constructor(t, e) {
460
460
  this.projectId = t, this.database = e || "(default)";
461
461
  }
462
462
  static empty() {
463
- return new H("", "");
463
+ return new J("", "");
464
464
  }
465
465
  get isDefaultDatabase() {
466
466
  return "(default)" === this.database;
467
467
  }
468
468
  isEqual(t) {
469
- return t instanceof H && t.projectId === this.projectId && t.database === this.database;
469
+ return t instanceof J && t.projectId === this.projectId && t.database === this.database;
470
470
  }
471
471
  }
472
472
 
473
473
  /**
474
474
  * Path represents an ordered sequence of string segments.
475
475
  */
476
- class J {
476
+ class X {
477
477
  constructor(t, e, n) {
478
- void 0 === e ? e = 0 : e > t.length && g(), void 0 === n ? n = t.length - e : n > t.length - e && g(),
478
+ void 0 === e ? e = 0 : e > t.length && v(), void 0 === n ? n = t.length - e : n > t.length - e && v(),
479
479
  this.segments = t, this.offset = e, this.len = n;
480
480
  }
481
481
  get length() {
482
482
  return this.len;
483
483
  }
484
484
  isEqual(t) {
485
- return 0 === J.comparator(this, t);
485
+ return 0 === X.comparator(this, t);
486
486
  }
487
487
  child(t) {
488
488
  const e = this.segments.slice(this.offset, this.limit());
489
- return t instanceof J ? t.forEach((t => {
489
+ return t instanceof X ? t.forEach((t => {
490
490
  e.push(t);
491
491
  })) : e.push(t), this.construct(e);
492
492
  }
@@ -543,9 +543,9 @@ class J {
543
543
  * within Firestore.
544
544
  *
545
545
  * @internal
546
- */ class X extends J {
546
+ */ class Z extends X {
547
547
  construct(t, e, n) {
548
- return new X(t, e, n);
548
+ return new Z(t, e, n);
549
549
  }
550
550
  canonicalString() {
551
551
  // NOTE: The client is ignorant of any path segments containing escape
@@ -566,35 +566,35 @@ class J {
566
566
  // for legacy reasons and should not be used frequently).
567
567
  const e = [];
568
568
  for (const n of t) {
569
- if (n.indexOf("//") >= 0) throw new L(A, `Invalid segment (${n}). Paths must not contain // in them.`);
569
+ if (n.indexOf("//") >= 0) throw new M(R, `Invalid segment (${n}). Paths must not contain // in them.`);
570
570
  // Strip leading and traling slashed.
571
571
  e.push(...n.split("/").filter((t => t.length > 0)));
572
572
  }
573
- return new X(e);
573
+ return new Z(e);
574
574
  }
575
575
  static emptyPath() {
576
- return new X([]);
576
+ return new Z([]);
577
577
  }
578
578
  }
579
579
 
580
- const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
580
+ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
581
581
 
582
582
  /**
583
583
  * A dot-separated path for navigating sub-objects within a document.
584
584
  * @internal
585
- */ class tt extends J {
585
+ */ class et extends X {
586
586
  construct(t, e, n) {
587
- return new tt(t, e, n);
587
+ return new et(t, e, n);
588
588
  }
589
589
  /**
590
590
  * Returns true if the string could be used as a segment in a field path
591
591
  * without escaping.
592
592
  */ static isValidIdentifier(t) {
593
- return Z.test(t);
593
+ return tt.test(t);
594
594
  }
595
595
  canonicalString() {
596
596
  return this.toArray().map((t => (t = t.replace(/\\/g, "\\\\").replace(/`/g, "\\`"),
597
- tt.isValidIdentifier(t) || (t = "`" + t + "`"), t))).join(".");
597
+ et.isValidIdentifier(t) || (t = "`" + t + "`"), t))).join(".");
598
598
  }
599
599
  toString() {
600
600
  return this.canonicalString();
@@ -607,7 +607,7 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
607
607
  /**
608
608
  * The field designating the key of a document.
609
609
  */ static keyField() {
610
- return new tt([ "__name__" ]);
610
+ return new et([ "__name__" ]);
611
611
  }
612
612
  /**
613
613
  * Parses a field string from the given server-formatted string.
@@ -622,24 +622,24 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
622
622
  const e = [];
623
623
  let n = "", r = 0;
624
624
  const s = () => {
625
- if (0 === n.length) throw new L(A, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
625
+ if (0 === n.length) throw new M(R, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
626
626
  e.push(n), n = "";
627
627
  };
628
628
  let i = !1;
629
629
  for (;r < t.length; ) {
630
630
  const e = t[r];
631
631
  if ("\\" === e) {
632
- if (r + 1 === t.length) throw new L(A, "Path has trailing escape character: " + t);
632
+ if (r + 1 === t.length) throw new M(R, "Path has trailing escape character: " + t);
633
633
  const e = t[r + 1];
634
- if ("\\" !== e && "." !== e && "`" !== e) throw new L(A, "Path has invalid escape sequence: " + t);
634
+ if ("\\" !== e && "." !== e && "`" !== e) throw new M(R, "Path has invalid escape sequence: " + t);
635
635
  n += e, r += 2;
636
636
  } else "`" === e ? (i = !i, r++) : "." !== e || i ? (n += e, r++) : (s(), r++);
637
637
  }
638
- if (s(), i) throw new L(A, "Unterminated ` in path: " + t);
639
- return new tt(e);
638
+ if (s(), i) throw new M(R, "Unterminated ` in path: " + t);
639
+ return new et(e);
640
640
  }
641
641
  static emptyPath() {
642
- return new tt([]);
642
+ return new et([]);
643
643
  }
644
644
  }
645
645
 
@@ -661,18 +661,18 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
661
661
  */
662
662
  /**
663
663
  * @internal
664
- */ class et {
664
+ */ class nt {
665
665
  constructor(t) {
666
666
  this.path = t;
667
667
  }
668
668
  static fromPath(t) {
669
- return new et(X.fromString(t));
669
+ return new nt(Z.fromString(t));
670
670
  }
671
671
  static fromName(t) {
672
- return new et(X.fromString(t).popFirst(5));
672
+ return new nt(Z.fromString(t).popFirst(5));
673
673
  }
674
674
  static empty() {
675
- return new et(X.emptyPath());
675
+ return new nt(Z.emptyPath());
676
676
  }
677
677
  get collectionGroup() {
678
678
  return this.path.popLast().lastSegment();
@@ -687,13 +687,13 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
687
687
  return this.path.popLast();
688
688
  }
689
689
  isEqual(t) {
690
- return null !== t && 0 === X.comparator(this.path, t.path);
690
+ return null !== t && 0 === Z.comparator(this.path, t.path);
691
691
  }
692
692
  toString() {
693
693
  return this.path.toString();
694
694
  }
695
695
  static comparator(t, e) {
696
- return X.comparator(t.path, e.path);
696
+ return Z.comparator(t.path, e.path);
697
697
  }
698
698
  static isDocumentKey(t) {
699
699
  return t.length % 2 == 0;
@@ -704,7 +704,7 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
704
704
  * @param segments - The segments of the path to the document
705
705
  * @returns A new instance of DocumentKey
706
706
  */ static fromSegments(t) {
707
- return new et(new X(t.slice()));
707
+ return new nt(new Z(t.slice()));
708
708
  }
709
709
  }
710
710
 
@@ -723,8 +723,8 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
723
723
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
724
724
  * See the License for the specific language governing permissions and
725
725
  * limitations under the License.
726
- */ function nt(t, e, n) {
727
- if (!n) throw new L(A, `Function ${t}() cannot be called with an empty ${e}.`);
726
+ */ function rt(t, e, n) {
727
+ if (!n) throw new M(R, `Function ${t}() cannot be called with an empty ${e}.`);
728
728
  }
729
729
 
730
730
  /**
@@ -735,15 +735,15 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
735
735
  * Validates that `path` refers to a document (indicated by the fact it contains
736
736
  * an even numbers of segments).
737
737
  */
738
- function rt(t) {
739
- if (!et.isDocumentKey(t)) throw new L(A, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
738
+ function st(t) {
739
+ 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}.`);
740
740
  }
741
741
 
742
742
  /**
743
743
  * Validates that `path` refers to a collection (indicated by the fact it
744
744
  * contains an odd numbers of segments).
745
- */ function st(t) {
746
- if (et.isDocumentKey(t)) throw new L(A, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
745
+ */ function it(t) {
746
+ 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}.`);
747
747
  }
748
748
 
749
749
  /**
@@ -751,7 +751,7 @@ function rt(t) {
751
751
  * (i.e. excludes Array, Date, etc.).
752
752
  */
753
753
  /** Returns a string describing the type / value of the provided input. */
754
- function it(t) {
754
+ function ot(t) {
755
755
  if (void 0 === t) return "undefined";
756
756
  if (null === t) return "null";
757
757
  if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
@@ -777,27 +777,27 @@ function it(t) {
777
777
  return e ? `a custom ${e} object` : "an object";
778
778
  }
779
779
  }
780
- return "function" == typeof t ? "a function" : g();
780
+ return "function" == typeof t ? "a function" : v();
781
781
  }
782
782
 
783
- function ot(t,
783
+ function ut(t,
784
784
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
785
785
  e) {
786
786
  if ("_delegate" in t && (
787
787
  // Unwrap Compat types
788
788
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
789
789
  t = t._delegate), !(t instanceof e)) {
790
- if (e.name === t.constructor.name) throw new L(A, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
790
+ 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?");
791
791
  {
792
- const n = it(t);
793
- throw new L(A, `Expected type '${e.name}', but it was: ${n}`);
792
+ const n = ot(t);
793
+ throw new M(R, `Expected type '${e.name}', but it was: ${n}`);
794
794
  }
795
795
  }
796
796
  return t;
797
797
  }
798
798
 
799
- function ut(t, e) {
800
- if (e <= 0) throw new L(A, `Function ${t}() requires a positive number, but it was: ${e}.`);
799
+ function ct(t, e) {
800
+ if (e <= 0) throw new M(R, `Function ${t}() requires a positive number, but it was: ${e}.`);
801
801
  }
802
802
 
803
803
  /**
@@ -818,11 +818,11 @@ function ut(t, e) {
818
818
  */
819
819
  /**
820
820
  * Returns whether a variable is either undefined or null.
821
- */ function ct(t) {
821
+ */ function at(t) {
822
822
  return null == t;
823
823
  }
824
824
 
825
- /** Returns whether the value represents -0. */ function at(t) {
825
+ /** Returns whether the value represents -0. */ function ht(t) {
826
826
  // Detect if the value is -0.0. Based on polyfill from
827
827
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
828
828
  return 0 === t && 1 / t == -1 / 0;
@@ -848,7 +848,7 @@ function ut(t, e) {
848
848
  * See the License for the specific language governing permissions and
849
849
  * limitations under the License.
850
850
  */
851
- const ht = {
851
+ const lt = {
852
852
  BatchGetDocuments: "batchGet",
853
853
  Commit: "commit",
854
854
  RunQuery: "runQuery",
@@ -886,7 +886,7 @@ const ht = {
886
886
  * are used for reverse lookups from the webchannel stream. Do NOT change the
887
887
  * names of these identifiers or change this into a const enum.
888
888
  */
889
- var lt, ft;
889
+ var ft, dt;
890
890
 
891
891
  /**
892
892
  * Converts an HTTP Status Code to the equivalent error code.
@@ -895,8 +895,8 @@ var lt, ft;
895
895
  * @returns The equivalent Code. Unknown status codes are mapped to
896
896
  * Code.UNKNOWN.
897
897
  */
898
- function dt(t) {
899
- if (void 0 === t) return p("RPC_ERROR", "HTTP error has no status"), T;
898
+ function wt(t) {
899
+ if (void 0 === t) return y("RPC_ERROR", "HTTP error has no status"), A;
900
900
  // The canonical error codes for Google APIs [1] specify mapping onto HTTP
901
901
  // status codes but the mapping is not bijective. In each case of ambiguity
902
902
  // this function chooses a primary error.
@@ -906,66 +906,66 @@ function dt(t) {
906
906
  switch (t) {
907
907
  case 200:
908
908
  // OK
909
- return E;
909
+ return I;
910
910
 
911
911
  case 400:
912
912
  // Bad Request
913
- return x;
913
+ return F;
914
914
 
915
915
  // Other possibilities based on the forward mapping
916
916
  // return Code.INVALID_ARGUMENT;
917
917
  // return Code.OUT_OF_RANGE;
918
918
  case 401:
919
919
  // Unauthorized
920
- return D;
920
+ return $;
921
921
 
922
922
  case 403:
923
923
  // Forbidden
924
- return N;
924
+ return D;
925
925
 
926
926
  case 404:
927
927
  // Not Found
928
- return P;
928
+ return V;
929
929
 
930
930
  case 409:
931
931
  // Conflict
932
- return F;
932
+ return S;
933
933
 
934
934
  // Other possibilities:
935
935
  // return Code.ALREADY_EXISTS;
936
936
  case 416:
937
937
  // Range Not Satisfiable
938
- return S;
938
+ return q;
939
939
 
940
940
  case 429:
941
941
  // Too Many Requests
942
- return $;
942
+ return x;
943
943
 
944
944
  case 499:
945
945
  // Client Closed Request
946
- return I;
946
+ return T;
947
947
 
948
948
  case 500:
949
949
  // Internal Server Error
950
- return T;
950
+ return A;
951
951
 
952
952
  // Other possibilities:
953
953
  // return Code.INTERNAL;
954
954
  // return Code.DATA_LOSS;
955
955
  case 501:
956
956
  // Unimplemented
957
- return q;
957
+ return O;
958
958
 
959
959
  case 503:
960
960
  // Service Unavailable
961
- return k;
961
+ return C;
962
962
 
963
963
  case 504:
964
964
  // Gateway Timeout
965
- return R;
965
+ return P;
966
966
 
967
967
  default:
968
- return t >= 200 && t < 300 ? E : t >= 400 && t < 500 ? x : t >= 500 && t < 600 ? O : T;
968
+ return t >= 200 && t < 300 ? I : t >= 400 && t < 500 ? F : t >= 500 && t < 600 ? k : A;
969
969
  }
970
970
  }
971
971
 
@@ -988,16 +988,16 @@ function dt(t) {
988
988
  /**
989
989
  * A Rest-based connection that relies on the native HTTP stack
990
990
  * (e.g. `fetch` or a polyfill).
991
- */ (ft = lt || (lt = {}))[ft.OK = 0] = "OK", ft[ft.CANCELLED = 1] = "CANCELLED",
992
- ft[ft.UNKNOWN = 2] = "UNKNOWN", ft[ft.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
993
- ft[ft.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ft[ft.NOT_FOUND = 5] = "NOT_FOUND",
994
- ft[ft.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ft[ft.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
995
- ft[ft.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ft[ft.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
996
- ft[ft.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ft[ft.ABORTED = 10] = "ABORTED",
997
- ft[ft.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ft[ft.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
998
- ft[ft.INTERNAL = 13] = "INTERNAL", ft[ft.UNAVAILABLE = 14] = "UNAVAILABLE", ft[ft.DATA_LOSS = 15] = "DATA_LOSS";
991
+ */ (dt = ft || (ft = {}))[dt.OK = 0] = "OK", dt[dt.CANCELLED = 1] = "CANCELLED",
992
+ dt[dt.UNKNOWN = 2] = "UNKNOWN", dt[dt.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT",
993
+ dt[dt.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", dt[dt.NOT_FOUND = 5] = "NOT_FOUND",
994
+ dt[dt.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", dt[dt.PERMISSION_DENIED = 7] = "PERMISSION_DENIED",
995
+ dt[dt.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", dt[dt.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED",
996
+ dt[dt.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", dt[dt.ABORTED = 10] = "ABORTED",
997
+ dt[dt.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", dt[dt.UNIMPLEMENTED = 12] = "UNIMPLEMENTED",
998
+ dt[dt.INTERNAL = 13] = "INTERNAL", dt[dt.UNAVAILABLE = 14] = "UNAVAILABLE", dt[dt.DATA_LOSS = 15] = "DATA_LOSS";
999
999
 
1000
- class wt extends
1000
+ class mt extends
1001
1001
  /**
1002
1002
  * Base class for all Rest-based connections to the backend (WebChannel and
1003
1003
  * HTTP).
@@ -1015,11 +1015,11 @@ class {
1015
1015
  }
1016
1016
  I(t, e, n, r, s) {
1017
1017
  const i = this.T(t, e);
1018
- m("RestConnection", "Sending: ", i, n);
1018
+ p("RestConnection", "Sending: ", i, n);
1019
1019
  const o = {};
1020
- return this.A(o, r, s), this.R(t, i, o, n).then((t => (m("RestConnection", "Received: ", t),
1020
+ return this.A(o, r, s), this.R(t, i, o, n).then((t => (p("RestConnection", "Received: ", t),
1021
1021
  t)), (e => {
1022
- throw y("RestConnection", `${t} failed with error: `, e, "url: ", i, "request:", n),
1022
+ throw _("RestConnection", `${t} failed with error: `, e, "url: ", i, "request:", n),
1023
1023
  e;
1024
1024
  }));
1025
1025
  }
@@ -1032,7 +1032,7 @@ class {
1032
1032
  * Modifies the headers for a request, adding any authorization token if
1033
1033
  * present and any additional headers for the request.
1034
1034
  */ A(t, e, n) {
1035
- t["X-Goog-Api-Client"] = "gl-js/ fire/" + f,
1035
+ t["X-Goog-Api-Client"] = "gl-js/ fire/" + d,
1036
1036
  // Content-Type: text/plain will avoid preflight requests which might
1037
1037
  // mess with CORS and redirects by proxies. If we add custom headers
1038
1038
  // we will need to change this code to potentially use the $httpOverwrite
@@ -1041,7 +1041,7 @@ class {
1041
1041
  e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
1042
1042
  }
1043
1043
  T(t, e) {
1044
- const n = ht[t];
1044
+ const n = lt[t];
1045
1045
  return `${this.p}/v1/${e}:${n}`;
1046
1046
  }
1047
1047
  } {
@@ -1065,9 +1065,9 @@ class {
1065
1065
  body: s
1066
1066
  });
1067
1067
  } catch (t) {
1068
- throw new L(dt(t.status), "Request failed with error: " + t.statusText);
1068
+ throw new M(wt(t.status), "Request failed with error: " + t.statusText);
1069
1069
  }
1070
- if (!i.ok) throw new L(dt(i.status), "Request failed with error: " + i.statusText);
1070
+ if (!i.ok) throw new M(wt(i.status), "Request failed with error: " + i.statusText);
1071
1071
  return i.json();
1072
1072
  }
1073
1073
  }
@@ -1110,7 +1110,7 @@ class {
1110
1110
  *
1111
1111
  * If `nBytes < 0` , an error will be thrown.
1112
1112
  */
1113
- function mt(t) {
1113
+ function pt(t) {
1114
1114
  // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
1115
1115
  const e =
1116
1116
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1136,14 +1136,14 @@ function mt(t) {
1136
1136
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1137
1137
  * See the License for the specific language governing permissions and
1138
1138
  * limitations under the License.
1139
- */ class pt {
1139
+ */ class yt {
1140
1140
  static D() {
1141
1141
  // Alphanumeric characters
1142
1142
  const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
1143
1143
  // The largest byte value that is a multiple of `char.length`.
1144
1144
  let n = "";
1145
1145
  for (;n.length < 20; ) {
1146
- const r = mt(40);
1146
+ const r = pt(40);
1147
1147
  for (let s = 0; s < r.length; ++s)
1148
1148
  // Only accept values that are [0, maxMultiple), this ensures they can
1149
1149
  // be evenly mapped to indices of `chars` via a modulo operation.
@@ -1153,11 +1153,11 @@ function mt(t) {
1153
1153
  }
1154
1154
  }
1155
1155
 
1156
- function yt(t, e) {
1156
+ function _t(t, e) {
1157
1157
  return t < e ? -1 : t > e ? 1 : 0;
1158
1158
  }
1159
1159
 
1160
- /** Helper to compare arrays using isEqual(). */ function _t(t, e, n) {
1160
+ /** Helper to compare arrays using isEqual(). */ function gt(t, e, n) {
1161
1161
  return t.length === e.length && t.every(((t, r) => n(t, e[r])));
1162
1162
  }
1163
1163
 
@@ -1192,7 +1192,7 @@ function yt(t, e) {
1192
1192
  * For examples and further specifications, refer to the
1193
1193
  * {@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto | Timestamp definition}.
1194
1194
  */
1195
- class gt {
1195
+ class vt {
1196
1196
  /**
1197
1197
  * Creates a new timestamp.
1198
1198
  *
@@ -1213,18 +1213,18 @@ class gt {
1213
1213
  * The fractions of a second at nanosecond resolution.*
1214
1214
  */
1215
1215
  e) {
1216
- if (this.seconds = t, this.nanoseconds = e, e < 0) throw new L(A, "Timestamp nanoseconds out of range: " + e);
1217
- if (e >= 1e9) throw new L(A, "Timestamp nanoseconds out of range: " + e);
1218
- if (t < -62135596800) throw new L(A, "Timestamp seconds out of range: " + t);
1216
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new M(R, "Timestamp nanoseconds out of range: " + e);
1217
+ if (e >= 1e9) throw new M(R, "Timestamp nanoseconds out of range: " + e);
1218
+ if (t < -62135596800) throw new M(R, "Timestamp seconds out of range: " + t);
1219
1219
  // This will break in the year 10,000.
1220
- if (t >= 253402300800) throw new L(A, "Timestamp seconds out of range: " + t);
1220
+ if (t >= 253402300800) throw new M(R, "Timestamp seconds out of range: " + t);
1221
1221
  }
1222
1222
  /**
1223
1223
  * Creates a new timestamp with the current date, with millisecond precision.
1224
1224
  *
1225
1225
  * @returns a new timestamp representing the current date.
1226
1226
  */ static now() {
1227
- return gt.fromMillis(Date.now());
1227
+ return vt.fromMillis(Date.now());
1228
1228
  }
1229
1229
  /**
1230
1230
  * Creates a new timestamp from the given date.
@@ -1233,7 +1233,7 @@ class gt {
1233
1233
  * @returns A new `Timestamp` representing the same point in time as the given
1234
1234
  * date.
1235
1235
  */ static fromDate(t) {
1236
- return gt.fromMillis(t.getTime());
1236
+ return vt.fromMillis(t.getTime());
1237
1237
  }
1238
1238
  /**
1239
1239
  * Creates a new timestamp from the given number of milliseconds.
@@ -1244,7 +1244,7 @@ class gt {
1244
1244
  * number of milliseconds.
1245
1245
  */ static fromMillis(t) {
1246
1246
  const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
1247
- return new gt(e, n);
1247
+ return new vt(e, n);
1248
1248
  }
1249
1249
  /**
1250
1250
  * Converts a `Timestamp` to a JavaScript `Date` object. This conversion
@@ -1266,7 +1266,7 @@ class gt {
1266
1266
  return 1e3 * this.seconds + this.nanoseconds / 1e6;
1267
1267
  }
1268
1268
  _compareTo(t) {
1269
- return this.seconds === t.seconds ? yt(this.nanoseconds, t.nanoseconds) : yt(this.seconds, t.seconds);
1269
+ return this.seconds === t.seconds ? _t(this.nanoseconds, t.nanoseconds) : _t(this.seconds, t.seconds);
1270
1270
  }
1271
1271
  /**
1272
1272
  * Returns true if this `Timestamp` is equal to the provided one.
@@ -1322,18 +1322,18 @@ class gt {
1322
1322
  /**
1323
1323
  * A version of a document in Firestore. This corresponds to the version
1324
1324
  * timestamp, such as update_time or read_time.
1325
- */ class vt {
1325
+ */ class bt {
1326
1326
  constructor(t) {
1327
1327
  this.timestamp = t;
1328
1328
  }
1329
1329
  static fromTimestamp(t) {
1330
- return new vt(t);
1330
+ return new bt(t);
1331
1331
  }
1332
1332
  static min() {
1333
- return new vt(new gt(0, 0));
1333
+ return new bt(new vt(0, 0));
1334
1334
  }
1335
1335
  static max() {
1336
- return new vt(new gt(253402300799, 999999999));
1336
+ return new bt(new vt(253402300799, 999999999));
1337
1337
  }
1338
1338
  compareTo(t) {
1339
1339
  return this.timestamp._compareTo(t.timestamp);
@@ -1368,13 +1368,13 @@ class gt {
1368
1368
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1369
1369
  * See the License for the specific language governing permissions and
1370
1370
  * limitations under the License.
1371
- */ function bt(t) {
1371
+ */ function Et(t) {
1372
1372
  let e = 0;
1373
1373
  for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
1374
1374
  return e;
1375
1375
  }
1376
1376
 
1377
- function Et(t, e) {
1377
+ function It(t, e) {
1378
1378
  for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
1379
1379
  }
1380
1380
 
@@ -1396,17 +1396,17 @@ function Et(t, e) {
1396
1396
  */
1397
1397
  // An immutable sorted map implementation, based on a Left-leaning Red-Black
1398
1398
  // tree.
1399
- class It {
1399
+ class Tt {
1400
1400
  constructor(t, e) {
1401
- this.comparator = t, this.root = e || At.EMPTY;
1401
+ this.comparator = t, this.root = e || Rt.EMPTY;
1402
1402
  }
1403
1403
  // Returns a copy of the map, with the specified key/value added or replaced.
1404
1404
  insert(t, e) {
1405
- return new It(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, At.BLACK, null, null));
1405
+ return new Tt(this.comparator, this.root.insert(t, e, this.comparator).copy(null, null, Rt.BLACK, null, null));
1406
1406
  }
1407
1407
  // Returns a copy of the map, with the specified key removed.
1408
1408
  remove(t) {
1409
- return new It(this.comparator, this.root.remove(t, this.comparator).copy(null, null, At.BLACK, null, null));
1409
+ return new Tt(this.comparator, this.root.remove(t, this.comparator).copy(null, null, Rt.BLACK, null, null));
1410
1410
  }
1411
1411
  // Returns the value of the node with the given key, or null.
1412
1412
  get(t) {
@@ -1472,22 +1472,22 @@ class It {
1472
1472
  }
1473
1473
  // Returns an iterator over the SortedMap.
1474
1474
  getIterator() {
1475
- return new Tt(this.root, null, this.comparator, !1);
1475
+ return new At(this.root, null, this.comparator, !1);
1476
1476
  }
1477
1477
  getIteratorFrom(t) {
1478
- return new Tt(this.root, t, this.comparator, !1);
1478
+ return new At(this.root, t, this.comparator, !1);
1479
1479
  }
1480
1480
  getReverseIterator() {
1481
- return new Tt(this.root, null, this.comparator, !0);
1481
+ return new At(this.root, null, this.comparator, !0);
1482
1482
  }
1483
1483
  getReverseIteratorFrom(t) {
1484
- return new Tt(this.root, t, this.comparator, !0);
1484
+ return new At(this.root, t, this.comparator, !0);
1485
1485
  }
1486
1486
  }
1487
1487
 
1488
1488
  // end SortedMap
1489
1489
  // An iterator over an LLRBNode.
1490
- class Tt {
1490
+ class At {
1491
1491
  constructor(t, e, n, r) {
1492
1492
  this.isReverse = r, this.nodeStack = [];
1493
1493
  let s = 1;
@@ -1532,14 +1532,14 @@ class Tt {
1532
1532
 
1533
1533
  // end SortedMapIterator
1534
1534
  // Represents a node in a Left-leaning Red-Black tree.
1535
- class At {
1535
+ class Rt {
1536
1536
  constructor(t, e, n, r, s) {
1537
- this.key = t, this.value = e, this.color = null != n ? n : At.RED, this.left = null != r ? r : At.EMPTY,
1538
- this.right = null != s ? s : At.EMPTY, this.size = this.left.size + 1 + this.right.size;
1537
+ this.key = t, this.value = e, this.color = null != n ? n : Rt.RED, this.left = null != r ? r : Rt.EMPTY,
1538
+ this.right = null != s ? s : Rt.EMPTY, this.size = this.left.size + 1 + this.right.size;
1539
1539
  }
1540
1540
  // Returns a copy of the current node, optionally replacing pieces of it.
1541
1541
  copy(t, e, n, r, s) {
1542
- return new At(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);
1542
+ 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);
1543
1543
  }
1544
1544
  isEmpty() {
1545
1545
  return !1;
@@ -1578,7 +1578,7 @@ class At {
1578
1578
  r.fixUp();
1579
1579
  }
1580
1580
  removeMin() {
1581
- if (this.left.isEmpty()) return At.EMPTY;
1581
+ if (this.left.isEmpty()) return Rt.EMPTY;
1582
1582
  let t = this;
1583
1583
  return t.left.isRed() || t.left.left.isRed() || (t = t.moveRedLeft()), t = t.copy(null, null, null, t.left.removeMin(), null),
1584
1584
  t.fixUp();
@@ -1590,7 +1590,7 @@ class At {
1590
1590
  r = r.copy(null, null, null, r.left.remove(t, e), null); else {
1591
1591
  if (r.left.isRed() && (r = r.rotateRight()), r.right.isEmpty() || r.right.isRed() || r.right.left.isRed() || (r = r.moveRedRight()),
1592
1592
  0 === e(t, r.key)) {
1593
- if (r.right.isEmpty()) return At.EMPTY;
1593
+ if (r.right.isEmpty()) return Rt.EMPTY;
1594
1594
  n = r.right.min(), r = r.copy(n.key, n.value, null, null, r.right.removeMin());
1595
1595
  }
1596
1596
  r = r.copy(null, null, null, null, r.right.remove(t, e));
@@ -1616,11 +1616,11 @@ class At {
1616
1616
  return t.left.left.isRed() && (t = t.rotateRight(), t = t.colorFlip()), t;
1617
1617
  }
1618
1618
  rotateLeft() {
1619
- const t = this.copy(null, null, At.RED, null, this.right.left);
1619
+ const t = this.copy(null, null, Rt.RED, null, this.right.left);
1620
1620
  return this.right.copy(null, null, this.color, t, null);
1621
1621
  }
1622
1622
  rotateRight() {
1623
- const t = this.copy(null, null, At.RED, this.left.right, null);
1623
+ const t = this.copy(null, null, Rt.RED, this.left.right, null);
1624
1624
  return this.left.copy(null, null, this.color, null, t);
1625
1625
  }
1626
1626
  colorFlip() {
@@ -1635,10 +1635,10 @@ class At {
1635
1635
  // In a balanced RB tree, the black-depth (number of black nodes) from root to
1636
1636
  // leaves is equal on both sides. This function verifies that or asserts.
1637
1637
  check() {
1638
- if (this.isRed() && this.left.isRed()) throw g();
1639
- if (this.right.isRed()) throw g();
1638
+ if (this.isRed() && this.left.isRed()) throw v();
1639
+ if (this.right.isRed()) throw v();
1640
1640
  const t = this.left.check();
1641
- if (t !== this.right.check()) throw g();
1641
+ if (t !== this.right.check()) throw v();
1642
1642
  return t + (this.isRed() ? 0 : 1);
1643
1643
  }
1644
1644
  }
@@ -1646,29 +1646,29 @@ class At {
1646
1646
  // end LLRBNode
1647
1647
  // Empty node is shared between all LLRB trees.
1648
1648
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1649
- At.EMPTY = null, At.RED = !0, At.BLACK = !1;
1649
+ Rt.EMPTY = null, Rt.RED = !0, Rt.BLACK = !1;
1650
1650
 
1651
1651
  // end LLRBEmptyNode
1652
- At.EMPTY = new
1652
+ Rt.EMPTY = new
1653
1653
  // Represents an empty node (a leaf node in the Red-Black Tree).
1654
1654
  class {
1655
1655
  constructor() {
1656
1656
  this.size = 0;
1657
1657
  }
1658
1658
  get key() {
1659
- throw g();
1659
+ throw v();
1660
1660
  }
1661
1661
  get value() {
1662
- throw g();
1662
+ throw v();
1663
1663
  }
1664
1664
  get color() {
1665
- throw g();
1665
+ throw v();
1666
1666
  }
1667
1667
  get left() {
1668
- throw g();
1668
+ throw v();
1669
1669
  }
1670
1670
  get right() {
1671
- throw g();
1671
+ throw v();
1672
1672
  }
1673
1673
  // Returns a copy of the current node.
1674
1674
  copy(t, e, n, r, s) {
@@ -1676,7 +1676,7 @@ class {
1676
1676
  }
1677
1677
  // Returns a copy of the tree, with the specified key/value added.
1678
1678
  insert(t, e, n) {
1679
- return new At(t, e);
1679
+ return new Rt(t, e);
1680
1680
  }
1681
1681
  // Returns a copy of the tree, with the specified key removed.
1682
1682
  remove(t, e) {
@@ -1732,9 +1732,9 @@ class {
1732
1732
  * NOTE: if provided comparator returns 0 for two elements, we consider them to
1733
1733
  * be equal!
1734
1734
  */
1735
- class Rt {
1735
+ class Pt {
1736
1736
  constructor(t) {
1737
- this.comparator = t, this.data = new It(this.comparator);
1737
+ this.comparator = t, this.data = new Tt(this.comparator);
1738
1738
  }
1739
1739
  has(t) {
1740
1740
  return null !== this.data.get(t);
@@ -1775,10 +1775,10 @@ class Rt {
1775
1775
  return e.hasNext() ? e.getNext().key : null;
1776
1776
  }
1777
1777
  getIterator() {
1778
- return new Pt(this.data.getIterator());
1778
+ return new Vt(this.data.getIterator());
1779
1779
  }
1780
1780
  getIteratorFrom(t) {
1781
- return new Pt(this.data.getIteratorFrom(t));
1781
+ return new Vt(this.data.getIteratorFrom(t));
1782
1782
  }
1783
1783
  /** Inserts or updates an element */ add(t) {
1784
1784
  return this.copy(this.data.remove(t).insert(t, !0));
@@ -1797,7 +1797,7 @@ class Rt {
1797
1797
  })), e;
1798
1798
  }
1799
1799
  isEqual(t) {
1800
- if (!(t instanceof Rt)) return !1;
1800
+ if (!(t instanceof Pt)) return !1;
1801
1801
  if (this.size !== t.size) return !1;
1802
1802
  const e = this.data.getIterator(), n = t.data.getIterator();
1803
1803
  for (;e.hasNext(); ) {
@@ -1817,12 +1817,12 @@ class Rt {
1817
1817
  return this.forEach((e => t.push(e))), "SortedSet(" + t.toString() + ")";
1818
1818
  }
1819
1819
  copy(t) {
1820
- const e = new Rt(this.comparator);
1820
+ const e = new Pt(this.comparator);
1821
1821
  return e.data = t, e;
1822
1822
  }
1823
1823
  }
1824
1824
 
1825
- class Pt {
1825
+ class Vt {
1826
1826
  constructor(t) {
1827
1827
  this.iter = t;
1828
1828
  }
@@ -1859,24 +1859,24 @@ class Pt {
1859
1859
  * foo.bar - Overwrites only the field bar of the object foo.
1860
1860
  * If foo is not an object, foo is replaced with an object
1861
1861
  * containing foo
1862
- */ class Vt {
1862
+ */ class Nt {
1863
1863
  constructor(t) {
1864
1864
  this.fields = t,
1865
1865
  // TODO(dimond): validation of FieldMask
1866
1866
  // Sort the field mask to support `FieldMask.isEqual()` and assert below.
1867
- t.sort(tt.comparator);
1867
+ t.sort(et.comparator);
1868
1868
  }
1869
1869
  static empty() {
1870
- return new Vt([]);
1870
+ return new Nt([]);
1871
1871
  }
1872
1872
  /**
1873
1873
  * Returns a new FieldMask object that is the result of adding all the given
1874
1874
  * fields paths to this field mask.
1875
1875
  */ unionWith(t) {
1876
- let e = new Rt(tt.comparator);
1876
+ let e = new Pt(et.comparator);
1877
1877
  for (const t of this.fields) e = e.add(t);
1878
1878
  for (const n of t) e = e.add(n);
1879
- return new Vt(e.toArray());
1879
+ return new Nt(e.toArray());
1880
1880
  }
1881
1881
  /**
1882
1882
  * Verifies that `fieldPath` is included by at least one field in this field
@@ -1888,7 +1888,7 @@ class Pt {
1888
1888
  return !1;
1889
1889
  }
1890
1890
  isEqual(t) {
1891
- return _t(this.fields, t.fields, ((t, e) => t.isEqual(e)));
1891
+ return gt(this.fields, t.fields, ((t, e) => t.isEqual(e)));
1892
1892
  }
1893
1893
  }
1894
1894
 
@@ -1934,13 +1934,13 @@ class Pt {
1934
1934
  * before being sent as a proto.
1935
1935
  * @internal
1936
1936
  */
1937
- class Nt {
1937
+ class Dt {
1938
1938
  constructor(t) {
1939
1939
  this.binaryString = t;
1940
1940
  }
1941
1941
  static fromBase64String(t) {
1942
1942
  const e = atob(t);
1943
- return new Nt(e);
1943
+ return new Dt(e);
1944
1944
  }
1945
1945
  static fromUint8Array(t) {
1946
1946
  // TODO(indexing); Remove the copy of the byte string here as this method
@@ -1957,7 +1957,7 @@ class Nt {
1957
1957
  /**
1958
1958
  * Helper function to convert a binary string to an Uint8Array.
1959
1959
  */ (t);
1960
- return new Nt(e);
1960
+ return new Dt(e);
1961
1961
  }
1962
1962
  [Symbol.iterator]() {
1963
1963
  let t = 0;
@@ -2005,31 +2005,31 @@ class Nt {
2005
2005
  return 2 * this.binaryString.length;
2006
2006
  }
2007
2007
  compareTo(t) {
2008
- return yt(this.binaryString, t.binaryString);
2008
+ return _t(this.binaryString, t.binaryString);
2009
2009
  }
2010
2010
  isEqual(t) {
2011
2011
  return this.binaryString === t.binaryString;
2012
2012
  }
2013
2013
  }
2014
2014
 
2015
- Nt.EMPTY_BYTE_STRING = new Nt("");
2015
+ Dt.EMPTY_BYTE_STRING = new Dt("");
2016
2016
 
2017
- const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2017
+ const $t = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2018
2018
 
2019
2019
  /**
2020
2020
  * Converts the possible Proto values for a timestamp value into a "seconds and
2021
2021
  * nanos" representation.
2022
- */ function $t(t) {
2022
+ */ function xt(t) {
2023
2023
  // The json interface (for the browser) will return an iso timestamp string,
2024
2024
  // while the proto js library (for node) will return a
2025
2025
  // google.protobuf.Timestamp instance.
2026
- if (v(!!t), "string" == typeof t) {
2026
+ if (b(!!t), "string" == typeof t) {
2027
2027
  // The date string can have higher precision (nanos) than the Date class
2028
2028
  // (millis), so we do some custom parsing here.
2029
2029
  // Parse the nanos right out of the string.
2030
2030
  let e = 0;
2031
- const n = Dt.exec(t);
2032
- if (v(!!n), n[1]) {
2031
+ const n = $t.exec(t);
2032
+ if (b(!!n), n[1]) {
2033
2033
  // Pad the fraction out to 9 digits (nanos).
2034
2034
  let t = n[1];
2035
2035
  t = (t + "000000000").substr(0, 9), e = Number(t);
@@ -2042,21 +2042,21 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2042
2042
  };
2043
2043
  }
2044
2044
  return {
2045
- seconds: xt(t.seconds),
2046
- nanos: xt(t.nanos)
2045
+ seconds: Ft(t.seconds),
2046
+ nanos: Ft(t.nanos)
2047
2047
  };
2048
2048
  }
2049
2049
 
2050
2050
  /**
2051
2051
  * Converts the possible Proto types for numbers into a JavaScript number.
2052
2052
  * Returns 0 if the value is not numeric.
2053
- */ function xt(t) {
2053
+ */ function Ft(t) {
2054
2054
  // TODO(bjornick): Handle int64 greater than 53 bits.
2055
2055
  return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
2056
2056
  }
2057
2057
 
2058
- /** Converts the possible Proto types for Blobs into a ByteString. */ function Ft(t) {
2059
- return "string" == typeof t ? Nt.fromBase64String(t) : Nt.fromUint8Array(t);
2058
+ /** Converts the possible Proto types for Blobs into a ByteString. */ function St(t) {
2059
+ return "string" == typeof t ? Dt.fromBase64String(t) : Dt.fromUint8Array(t);
2060
2060
  }
2061
2061
 
2062
2062
  /**
@@ -2092,7 +2092,7 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2092
2092
  * FieldValueOptions to value().
2093
2093
  * - With respect to other ServerTimestampValues, they sort by their
2094
2094
  * localWriteTime.
2095
- */ function St(t) {
2095
+ */ function qt(t) {
2096
2096
  var e, n;
2097
2097
  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);
2098
2098
  }
@@ -2102,16 +2102,16 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2102
2102
  *
2103
2103
  * Preserving the previous values allows the user to display the last resoled
2104
2104
  * value until the backend responds with the timestamp.
2105
- */ function qt(t) {
2105
+ */ function Ot(t) {
2106
2106
  const e = t.mapValue.fields.__previous_value__;
2107
- return St(e) ? qt(e) : e;
2107
+ return qt(e) ? Ot(e) : e;
2108
2108
  }
2109
2109
 
2110
2110
  /**
2111
2111
  * Returns the local time at which this timestamp was first set.
2112
- */ function Ot(t) {
2113
- const e = $t(t.mapValue.fields.__local_write_time__.timestampValue);
2114
- return new gt(e.seconds, e.nanos);
2112
+ */ function kt(t) {
2113
+ const e = xt(t.mapValue.fields.__local_write_time__.timestampValue);
2114
+ return new vt(e.seconds, e.nanos);
2115
2115
  }
2116
2116
 
2117
2117
  /**
@@ -2129,7 +2129,7 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2129
2129
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2130
2130
  * See the License for the specific language governing permissions and
2131
2131
  * limitations under the License.
2132
- */ const kt = {
2132
+ */ const Ct = {
2133
2133
  fields: {
2134
2134
  __type__: {
2135
2135
  stringValue: "__max__"
@@ -2138,8 +2138,8 @@ const Dt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
2138
2138
  };
2139
2139
 
2140
2140
  /** Extracts the backend's type order for the provided value. */
2141
- function Ct(t) {
2142
- 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 ? St(t) ? 4 /* ServerTimestampValue */ :
2141
+ function Lt(t) {
2142
+ return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? qt(t) ? 4 /* ServerTimestampValue */ :
2143
2143
  /** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
2144
2144
  function(t) {
2145
2145
  return "__max__" === (((t.mapValue || {}).fields || {}).__type__ || {}).stringValue;
@@ -2163,13 +2163,13 @@ function Ct(t) {
2163
2163
  /**
2164
2164
  * An ObjectValue represents a MapValue in the Firestore Proto and offers the
2165
2165
  * ability to add and remove fields (via the ObjectValueBuilder).
2166
- */ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : g();
2166
+ */ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : v();
2167
2167
  }
2168
2168
 
2169
- /** Tests `left` and `right` for equality based on the backend semantics. */ function Lt(t, e) {
2169
+ /** Tests `left` and `right` for equality based on the backend semantics. */ function Mt(t, e) {
2170
2170
  if (t === e) return !0;
2171
- const n = Ct(t);
2172
- if (n !== Ct(e)) return !1;
2171
+ const n = Lt(t);
2172
+ if (n !== Lt(e)) return !1;
2173
2173
  switch (n) {
2174
2174
  case 0 /* NullValue */ :
2175
2175
  case 9007199254740991 /* MaxValue */ :
@@ -2179,14 +2179,14 @@ function Ct(t) {
2179
2179
  return t.booleanValue === e.booleanValue;
2180
2180
 
2181
2181
  case 4 /* ServerTimestampValue */ :
2182
- return Ot(t).isEqual(Ot(e));
2182
+ return kt(t).isEqual(kt(e));
2183
2183
 
2184
2184
  case 3 /* TimestampValue */ :
2185
2185
  return function(t, e) {
2186
2186
  if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
2187
2187
  // Use string equality for ISO 8601 timestamps
2188
2188
  return t.timestampValue === e.timestampValue;
2189
- const n = $t(t.timestampValue), r = $t(e.timestampValue);
2189
+ const n = xt(t.timestampValue), r = xt(e.timestampValue);
2190
2190
  return n.seconds === r.seconds && n.nanos === r.nanos;
2191
2191
  }(t, e);
2192
2192
 
@@ -2195,7 +2195,7 @@ function Ct(t) {
2195
2195
 
2196
2196
  case 6 /* BlobValue */ :
2197
2197
  return function(t, e) {
2198
- return Ft(t.bytesValue).isEqual(Ft(e.bytesValue));
2198
+ return St(t.bytesValue).isEqual(St(e.bytesValue));
2199
2199
  }(t, e);
2200
2200
 
2201
2201
  case 7 /* RefValue */ :
@@ -2203,72 +2203,72 @@ function Ct(t) {
2203
2203
 
2204
2204
  case 8 /* GeoPointValue */ :
2205
2205
  return function(t, e) {
2206
- return xt(t.geoPointValue.latitude) === xt(e.geoPointValue.latitude) && xt(t.geoPointValue.longitude) === xt(e.geoPointValue.longitude);
2206
+ return Ft(t.geoPointValue.latitude) === Ft(e.geoPointValue.latitude) && Ft(t.geoPointValue.longitude) === Ft(e.geoPointValue.longitude);
2207
2207
  }(t, e);
2208
2208
 
2209
2209
  case 2 /* NumberValue */ :
2210
2210
  return function(t, e) {
2211
- if ("integerValue" in t && "integerValue" in e) return xt(t.integerValue) === xt(e.integerValue);
2211
+ if ("integerValue" in t && "integerValue" in e) return Ft(t.integerValue) === Ft(e.integerValue);
2212
2212
  if ("doubleValue" in t && "doubleValue" in e) {
2213
- const n = xt(t.doubleValue), r = xt(e.doubleValue);
2214
- return n === r ? at(n) === at(r) : isNaN(n) && isNaN(r);
2213
+ const n = Ft(t.doubleValue), r = Ft(e.doubleValue);
2214
+ return n === r ? ht(n) === ht(r) : isNaN(n) && isNaN(r);
2215
2215
  }
2216
2216
  return !1;
2217
2217
  }(t, e);
2218
2218
 
2219
2219
  case 9 /* ArrayValue */ :
2220
- return _t(t.arrayValue.values || [], e.arrayValue.values || [], Lt);
2220
+ return gt(t.arrayValue.values || [], e.arrayValue.values || [], Mt);
2221
2221
 
2222
2222
  case 10 /* ObjectValue */ :
2223
2223
  return function(t, e) {
2224
2224
  const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
2225
- if (bt(n) !== bt(r)) return !1;
2226
- for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Lt(n[t], r[t]))) return !1;
2225
+ if (Et(n) !== Et(r)) return !1;
2226
+ for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Mt(n[t], r[t]))) return !1;
2227
2227
  return !0;
2228
2228
  }
2229
2229
  /** Returns true if the ArrayValue contains the specified element. */ (t, e);
2230
2230
 
2231
2231
  default:
2232
- return g();
2232
+ return v();
2233
2233
  }
2234
2234
  }
2235
2235
 
2236
- function Mt(t, e) {
2237
- return void 0 !== (t.values || []).find((t => Lt(t, e)));
2236
+ function Ut(t, e) {
2237
+ return void 0 !== (t.values || []).find((t => Mt(t, e)));
2238
2238
  }
2239
2239
 
2240
- function Ut(t, e) {
2240
+ function jt(t, e) {
2241
2241
  if (t === e) return 0;
2242
- const n = Ct(t), r = Ct(e);
2243
- if (n !== r) return yt(n, r);
2242
+ const n = Lt(t), r = Lt(e);
2243
+ if (n !== r) return _t(n, r);
2244
2244
  switch (n) {
2245
2245
  case 0 /* NullValue */ :
2246
2246
  case 9007199254740991 /* MaxValue */ :
2247
2247
  return 0;
2248
2248
 
2249
2249
  case 1 /* BooleanValue */ :
2250
- return yt(t.booleanValue, e.booleanValue);
2250
+ return _t(t.booleanValue, e.booleanValue);
2251
2251
 
2252
2252
  case 2 /* NumberValue */ :
2253
2253
  return function(t, e) {
2254
- const n = xt(t.integerValue || t.doubleValue), r = xt(e.integerValue || e.doubleValue);
2254
+ const n = Ft(t.integerValue || t.doubleValue), r = Ft(e.integerValue || e.doubleValue);
2255
2255
  return n < r ? -1 : n > r ? 1 : n === r ? 0 :
2256
2256
  // one or both are NaN.
2257
2257
  isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
2258
2258
  }(t, e);
2259
2259
 
2260
2260
  case 3 /* TimestampValue */ :
2261
- return jt(t.timestampValue, e.timestampValue);
2261
+ return Bt(t.timestampValue, e.timestampValue);
2262
2262
 
2263
2263
  case 4 /* ServerTimestampValue */ :
2264
- return jt(Ot(t), Ot(e));
2264
+ return Bt(kt(t), kt(e));
2265
2265
 
2266
2266
  case 5 /* StringValue */ :
2267
- return yt(t.stringValue, e.stringValue);
2267
+ return _t(t.stringValue, e.stringValue);
2268
2268
 
2269
2269
  case 6 /* BlobValue */ :
2270
2270
  return function(t, e) {
2271
- const n = Ft(t), r = Ft(e);
2271
+ const n = St(t), r = St(e);
2272
2272
  return n.compareTo(r);
2273
2273
  }(t.bytesValue, e.bytesValue);
2274
2274
 
@@ -2276,34 +2276,34 @@ function Ut(t, e) {
2276
2276
  return function(t, e) {
2277
2277
  const n = t.split("/"), r = e.split("/");
2278
2278
  for (let t = 0; t < n.length && t < r.length; t++) {
2279
- const e = yt(n[t], r[t]);
2279
+ const e = _t(n[t], r[t]);
2280
2280
  if (0 !== e) return e;
2281
2281
  }
2282
- return yt(n.length, r.length);
2282
+ return _t(n.length, r.length);
2283
2283
  }(t.referenceValue, e.referenceValue);
2284
2284
 
2285
2285
  case 8 /* GeoPointValue */ :
2286
2286
  return function(t, e) {
2287
- const n = yt(xt(t.latitude), xt(e.latitude));
2287
+ const n = _t(Ft(t.latitude), Ft(e.latitude));
2288
2288
  if (0 !== n) return n;
2289
- return yt(xt(t.longitude), xt(e.longitude));
2289
+ return _t(Ft(t.longitude), Ft(e.longitude));
2290
2290
  }(t.geoPointValue, e.geoPointValue);
2291
2291
 
2292
2292
  case 9 /* ArrayValue */ :
2293
2293
  return function(t, e) {
2294
2294
  const n = t.values || [], r = e.values || [];
2295
2295
  for (let t = 0; t < n.length && t < r.length; ++t) {
2296
- const e = Ut(n[t], r[t]);
2296
+ const e = jt(n[t], r[t]);
2297
2297
  if (e) return e;
2298
2298
  }
2299
- return yt(n.length, r.length);
2299
+ return _t(n.length, r.length);
2300
2300
  }(t.arrayValue, e.arrayValue);
2301
2301
 
2302
2302
  case 10 /* ObjectValue */ :
2303
2303
  return function(t, e) {
2304
- if (t === kt && e === kt) return 0;
2305
- if (t === kt) return 1;
2306
- if (e === kt) return -1;
2304
+ if (t === Ct && e === Ct) return 0;
2305
+ if (t === Ct) return 1;
2306
+ if (e === Ct) return -1;
2307
2307
  const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
2308
2308
  // Even though MapValues are likely sorted correctly based on their insertion
2309
2309
  // order (e.g. when received from the backend), local modifications can bring
@@ -2311,27 +2311,27 @@ function Ut(t, e) {
2311
2311
  // canonical IDs are independent of insertion order.
2312
2312
  r.sort(), i.sort();
2313
2313
  for (let t = 0; t < r.length && t < i.length; ++t) {
2314
- const e = yt(r[t], i[t]);
2314
+ const e = _t(r[t], i[t]);
2315
2315
  if (0 !== e) return e;
2316
- const o = Ut(n[r[t]], s[i[t]]);
2316
+ const o = jt(n[r[t]], s[i[t]]);
2317
2317
  if (0 !== o) return o;
2318
2318
  }
2319
- return yt(r.length, i.length);
2319
+ return _t(r.length, i.length);
2320
2320
  }
2321
2321
  /** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
2322
2322
 
2323
2323
  default:
2324
- throw g();
2324
+ throw v();
2325
2325
  }
2326
2326
  }
2327
2327
 
2328
- function jt(t, e) {
2329
- if ("string" == typeof t && "string" == typeof e && t.length === e.length) return yt(t, e);
2330
- const n = $t(t), r = $t(e), s = yt(n.seconds, r.seconds);
2331
- return 0 !== s ? s : yt(n.nanos, r.nanos);
2328
+ function Bt(t, e) {
2329
+ if ("string" == typeof t && "string" == typeof e && t.length === e.length) return _t(t, e);
2330
+ const n = xt(t), r = xt(e), s = _t(n.seconds, r.seconds);
2331
+ return 0 !== s ? s : _t(n.nanos, r.nanos);
2332
2332
  }
2333
2333
 
2334
- function Bt(t, e) {
2334
+ function Qt(t, e) {
2335
2335
  return {
2336
2336
  referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
2337
2337
  };
@@ -2345,15 +2345,15 @@ function Bt(t, e) {
2345
2345
  return !!t && "nullValue" in t;
2346
2346
  }
2347
2347
 
2348
- /** Returns true if `value` is NaN. */ function Qt(t) {
2348
+ /** Returns true if `value` is NaN. */ function Wt(t) {
2349
2349
  return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
2350
2350
  }
2351
2351
 
2352
- /** Returns true if `value` is a MapValue. */ function Wt(t) {
2352
+ /** Returns true if `value` is a MapValue. */ function Kt(t) {
2353
2353
  return !!t && "mapValue" in t;
2354
2354
  }
2355
2355
 
2356
- /** Creates a deep copy of `source`. */ function Kt(t) {
2356
+ /** Creates a deep copy of `source`. */ function Yt(t) {
2357
2357
  if (t.geoPointValue) return {
2358
2358
  geoPointValue: Object.assign({}, t.geoPointValue)
2359
2359
  };
@@ -2366,7 +2366,7 @@ function Bt(t, e) {
2366
2366
  fields: {}
2367
2367
  }
2368
2368
  };
2369
- return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Kt(n))), e;
2369
+ return It(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Yt(n))), e;
2370
2370
  }
2371
2371
  if (t.arrayValue) {
2372
2372
  const e = {
@@ -2374,18 +2374,18 @@ function Bt(t, e) {
2374
2374
  values: []
2375
2375
  }
2376
2376
  };
2377
- for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Kt(t.arrayValue.values[n]);
2377
+ for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Yt(t.arrayValue.values[n]);
2378
2378
  return e;
2379
2379
  }
2380
2380
  return Object.assign({}, t);
2381
2381
  }
2382
2382
 
2383
- class Yt {
2383
+ class Ht {
2384
2384
  constructor(t) {
2385
2385
  this.value = t;
2386
2386
  }
2387
2387
  static empty() {
2388
- return new Yt({
2388
+ return new Ht({
2389
2389
  mapValue: {}
2390
2390
  });
2391
2391
  }
@@ -2399,7 +2399,7 @@ class Yt {
2399
2399
  {
2400
2400
  let e = this.value;
2401
2401
  for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
2402
- !Wt(e)) return null;
2402
+ !Kt(e)) return null;
2403
2403
  return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
2404
2404
  }
2405
2405
  }
@@ -2409,21 +2409,21 @@ class Yt {
2409
2409
  * @param path - The field path to set.
2410
2410
  * @param value - The value to set.
2411
2411
  */ set(t, e) {
2412
- this.getFieldsMap(t.popLast())[t.lastSegment()] = Kt(e);
2412
+ this.getFieldsMap(t.popLast())[t.lastSegment()] = Yt(e);
2413
2413
  }
2414
2414
  /**
2415
2415
  * Sets the provided fields to the provided values.
2416
2416
  *
2417
2417
  * @param data - A map of fields to values (or null for deletes).
2418
2418
  */ setAll(t) {
2419
- let e = tt.emptyPath(), n = {}, r = [];
2419
+ let e = et.emptyPath(), n = {}, r = [];
2420
2420
  t.forEach(((t, s) => {
2421
2421
  if (!e.isImmediateParentOf(s)) {
2422
2422
  // Insert the accumulated changes at this parent location
2423
2423
  const t = this.getFieldsMap(e);
2424
2424
  this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
2425
2425
  }
2426
- t ? n[s.lastSegment()] = Kt(t) : r.push(s.lastSegment());
2426
+ t ? n[s.lastSegment()] = Yt(t) : r.push(s.lastSegment());
2427
2427
  }));
2428
2428
  const s = this.getFieldsMap(e);
2429
2429
  this.applyChanges(s, n, r);
@@ -2435,10 +2435,10 @@ class Yt {
2435
2435
  * @param path - The field path to remove.
2436
2436
  */ delete(t) {
2437
2437
  const e = this.field(t.popLast());
2438
- Wt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
2438
+ Kt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
2439
2439
  }
2440
2440
  isEqual(t) {
2441
- return Lt(this.value, t.value);
2441
+ return Mt(this.value, t.value);
2442
2442
  }
2443
2443
  /**
2444
2444
  * Returns the map that contains the leaf element of `path`. If the parent
@@ -2450,7 +2450,7 @@ class Yt {
2450
2450
  });
2451
2451
  for (let n = 0; n < t.length; ++n) {
2452
2452
  let r = e.mapValue.fields[t.get(n)];
2453
- Wt(r) && r.mapValue.fields || (r = {
2453
+ Kt(r) && r.mapValue.fields || (r = {
2454
2454
  mapValue: {
2455
2455
  fields: {}
2456
2456
  }
@@ -2462,11 +2462,11 @@ class Yt {
2462
2462
  * Modifies `fieldsMap` by adding, replacing or deleting the specified
2463
2463
  * entries.
2464
2464
  */ applyChanges(t, e, n) {
2465
- Et(e, ((e, n) => t[e] = n));
2465
+ It(e, ((e, n) => t[e] = n));
2466
2466
  for (const e of n) delete t[e];
2467
2467
  }
2468
2468
  clone() {
2469
- return new Yt(Kt(this.value));
2469
+ return new Ht(Yt(this.value));
2470
2470
  }
2471
2471
  }
2472
2472
 
@@ -2495,7 +2495,7 @@ class Yt {
2495
2495
  * not transition to one of these states even after all mutations have been
2496
2496
  * applied, `isValidDocument()` returns false and the document should be removed
2497
2497
  * from all views.
2498
- */ class Ht {
2498
+ */ class Jt {
2499
2499
  constructor(t, e, n, r, s, i) {
2500
2500
  this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
2501
2501
  this.documentState = i;
@@ -2504,23 +2504,23 @@ class Yt {
2504
2504
  * Creates a document with no known version or data, but which can serve as
2505
2505
  * base document for mutations.
2506
2506
  */ static newInvalidDocument(t) {
2507
- return new Ht(t, 0 /* INVALID */ , vt.min(), vt.min(), Yt.empty(), 0 /* SYNCED */);
2507
+ return new Jt(t, 0 /* INVALID */ , bt.min(), bt.min(), Ht.empty(), 0 /* SYNCED */);
2508
2508
  }
2509
2509
  /**
2510
2510
  * Creates a new document that is known to exist with the given data at the
2511
2511
  * given version.
2512
2512
  */ static newFoundDocument(t, e, n) {
2513
- return new Ht(t, 1 /* FOUND_DOCUMENT */ , e, vt.min(), n, 0 /* SYNCED */);
2513
+ return new Jt(t, 1 /* FOUND_DOCUMENT */ , e, bt.min(), n, 0 /* SYNCED */);
2514
2514
  }
2515
2515
  /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
2516
- return new Ht(t, 2 /* NO_DOCUMENT */ , e, vt.min(), Yt.empty(), 0 /* SYNCED */);
2516
+ return new Jt(t, 2 /* NO_DOCUMENT */ , e, bt.min(), Ht.empty(), 0 /* SYNCED */);
2517
2517
  }
2518
2518
  /**
2519
2519
  * Creates a new document that is known to exist at the given version but
2520
2520
  * whose data is not known (e.g. a document that was updated without a known
2521
2521
  * base document).
2522
2522
  */ static newUnknownDocument(t, e) {
2523
- return new Ht(t, 3 /* UNKNOWN_DOCUMENT */ , e, vt.min(), Yt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2523
+ return new Jt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.min(), Ht.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2524
2524
  }
2525
2525
  /**
2526
2526
  * Changes the document type to indicate that it exists and that its version
@@ -2533,7 +2533,7 @@ class Yt {
2533
2533
  * Changes the document type to indicate that it doesn't exist at the given
2534
2534
  * version.
2535
2535
  */ convertToNoDocument(t) {
2536
- return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Yt.empty(),
2536
+ return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Ht.empty(),
2537
2537
  this.documentState = 0 /* SYNCED */ , this;
2538
2538
  }
2539
2539
  /**
@@ -2541,14 +2541,14 @@ class Yt {
2541
2541
  * that its data is not known (e.g. a document that was updated without a known
2542
2542
  * base document).
2543
2543
  */ convertToUnknownDocument(t) {
2544
- return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Yt.empty(),
2544
+ return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Ht.empty(),
2545
2545
  this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2546
2546
  }
2547
2547
  setHasCommittedMutations() {
2548
2548
  return this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2549
2549
  }
2550
2550
  setHasLocalMutations() {
2551
- return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = vt.min(),
2551
+ return this.documentState = 1 /* HAS_LOCAL_MUTATIONS */ , this.version = bt.min(),
2552
2552
  this;
2553
2553
  }
2554
2554
  setReadTime(t) {
@@ -2576,10 +2576,10 @@ class Yt {
2576
2576
  return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
2577
2577
  }
2578
2578
  isEqual(t) {
2579
- return t instanceof Ht && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2579
+ return t instanceof Jt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2580
2580
  }
2581
2581
  mutableCopy() {
2582
- return new Ht(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2582
+ return new Jt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2583
2583
  }
2584
2584
  toString() {
2585
2585
  return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
@@ -2603,7 +2603,7 @@ class Yt {
2603
2603
  * limitations under the License.
2604
2604
  */
2605
2605
  // Visible for testing
2606
- class Jt {
2606
+ class Xt {
2607
2607
  constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2608
2608
  this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
2609
2609
  this.startAt = i, this.endAt = o, this.$ = null;
@@ -2617,26 +2617,26 @@ class Jt {
2617
2617
  * NOTE: you should always construct `Target` from `Query.toTarget` instead of
2618
2618
  * using this factory method, because `Query` provides an implicit `orderBy`
2619
2619
  * property.
2620
- */ function Xt(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2621
- return new Jt(t, e, n, r, s, i, o);
2620
+ */ function Zt(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2621
+ return new Xt(t, e, n, r, s, i, o);
2622
2622
  }
2623
2623
 
2624
- class Zt extends class {} {
2624
+ class te extends class {} {
2625
2625
  constructor(t, e, n) {
2626
2626
  super(), this.field = t, this.op = e, this.value = n;
2627
2627
  }
2628
2628
  /**
2629
2629
  * Creates a filter based on the provided arguments.
2630
2630
  */ static create(t, e, n) {
2631
- return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.F(t, e, n) : new te(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new se(t, n) : "in" /* IN */ === e ? new ie(t, n) : "not-in" /* NOT_IN */ === e ? new oe(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ue(t, n) : new Zt(t, e, n);
2631
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.F(t, e, n) : new ee(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new ie(t, n) : "in" /* IN */ === e ? new oe(t, n) : "not-in" /* NOT_IN */ === e ? new ue(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ce(t, n) : new te(t, e, n);
2632
2632
  }
2633
2633
  static F(t, e, n) {
2634
- return "in" /* IN */ === e ? new ee(t, n) : new ne(t, n);
2634
+ return "in" /* IN */ === e ? new ne(t, n) : new re(t, n);
2635
2635
  }
2636
2636
  matches(t) {
2637
2637
  const e = t.data.field(this.field);
2638
2638
  // Types do not have to match in NOT_EQUAL filters.
2639
- return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.S(Ut(e, this.value)) : null !== e && Ct(this.value) === Ct(e) && this.S(Ut(e, this.value));
2639
+ return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.S(jt(e, this.value)) : null !== e && Lt(this.value) === Lt(e) && this.S(jt(e, this.value));
2640
2640
  // Only compare types with matching backend order (such as double and int).
2641
2641
  }
2642
2642
  S(t) {
@@ -2660,7 +2660,7 @@ class Zt extends class {} {
2660
2660
  return t >= 0;
2661
2661
 
2662
2662
  default:
2663
- return g();
2663
+ return v();
2664
2664
  }
2665
2665
  }
2666
2666
  q() {
@@ -2669,79 +2669,79 @@ class Zt extends class {} {
2669
2669
  }
2670
2670
 
2671
2671
  /** Filter that matches on key fields (i.e. '__name__'). */
2672
- class te extends Zt {
2672
+ class ee extends te {
2673
2673
  constructor(t, e, n) {
2674
- super(t, e, n), this.key = et.fromName(n.referenceValue);
2674
+ super(t, e, n), this.key = nt.fromName(n.referenceValue);
2675
2675
  }
2676
2676
  matches(t) {
2677
- const e = et.comparator(t.key, this.key);
2677
+ const e = nt.comparator(t.key, this.key);
2678
2678
  return this.S(e);
2679
2679
  }
2680
2680
  }
2681
2681
 
2682
- /** Filter that matches on key fields within an array. */ class ee extends Zt {
2682
+ /** Filter that matches on key fields within an array. */ class ne extends te {
2683
2683
  constructor(t, e) {
2684
- super(t, "in" /* IN */ , e), this.keys = re("in" /* IN */ , e);
2684
+ super(t, "in" /* IN */ , e), this.keys = se("in" /* IN */ , e);
2685
2685
  }
2686
2686
  matches(t) {
2687
2687
  return this.keys.some((e => e.isEqual(t.key)));
2688
2688
  }
2689
2689
  }
2690
2690
 
2691
- /** Filter that matches on key fields not present within an array. */ class ne extends Zt {
2691
+ /** Filter that matches on key fields not present within an array. */ class re extends te {
2692
2692
  constructor(t, e) {
2693
- super(t, "not-in" /* NOT_IN */ , e), this.keys = re("not-in" /* NOT_IN */ , e);
2693
+ super(t, "not-in" /* NOT_IN */ , e), this.keys = se("not-in" /* NOT_IN */ , e);
2694
2694
  }
2695
2695
  matches(t) {
2696
2696
  return !this.keys.some((e => e.isEqual(t.key)));
2697
2697
  }
2698
2698
  }
2699
2699
 
2700
- function re(t, e) {
2700
+ function se(t, e) {
2701
2701
  var n;
2702
- return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => et.fromName(t.referenceValue)));
2702
+ return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => nt.fromName(t.referenceValue)));
2703
2703
  }
2704
2704
 
2705
- /** A Filter that implements the array-contains operator. */ class se extends Zt {
2705
+ /** A Filter that implements the array-contains operator. */ class ie extends te {
2706
2706
  constructor(t, e) {
2707
2707
  super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
2708
2708
  }
2709
2709
  matches(t) {
2710
2710
  const e = t.data.field(this.field);
2711
- return zt(e) && Mt(e.arrayValue, this.value);
2711
+ return zt(e) && Ut(e.arrayValue, this.value);
2712
2712
  }
2713
2713
  }
2714
2714
 
2715
- /** A Filter that implements the IN operator. */ class ie extends Zt {
2715
+ /** A Filter that implements the IN operator. */ class oe extends te {
2716
2716
  constructor(t, e) {
2717
2717
  super(t, "in" /* IN */ , e);
2718
2718
  }
2719
2719
  matches(t) {
2720
2720
  const e = t.data.field(this.field);
2721
- return null !== e && Mt(this.value.arrayValue, e);
2721
+ return null !== e && Ut(this.value.arrayValue, e);
2722
2722
  }
2723
2723
  }
2724
2724
 
2725
- /** A Filter that implements the not-in operator. */ class oe extends Zt {
2725
+ /** A Filter that implements the not-in operator. */ class ue extends te {
2726
2726
  constructor(t, e) {
2727
2727
  super(t, "not-in" /* NOT_IN */ , e);
2728
2728
  }
2729
2729
  matches(t) {
2730
- if (Mt(this.value.arrayValue, {
2730
+ if (Ut(this.value.arrayValue, {
2731
2731
  nullValue: "NULL_VALUE"
2732
2732
  })) return !1;
2733
2733
  const e = t.data.field(this.field);
2734
- return null !== e && !Mt(this.value.arrayValue, e);
2734
+ return null !== e && !Ut(this.value.arrayValue, e);
2735
2735
  }
2736
2736
  }
2737
2737
 
2738
- /** A Filter that implements the array-contains-any operator. */ class ue extends Zt {
2738
+ /** A Filter that implements the array-contains-any operator. */ class ce extends te {
2739
2739
  constructor(t, e) {
2740
2740
  super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
2741
2741
  }
2742
2742
  matches(t) {
2743
2743
  const e = t.data.field(this.field);
2744
- return !(!zt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Mt(this.value.arrayValue, t)));
2744
+ return !(!zt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Ut(this.value.arrayValue, t)));
2745
2745
  }
2746
2746
  }
2747
2747
 
@@ -2758,7 +2758,7 @@ function re(t, e) {
2758
2758
  * Bound provides a function to determine whether a document comes before or
2759
2759
  * after a bound. This is influenced by whether the position is just before or
2760
2760
  * just after the provided values.
2761
- */ class ce {
2761
+ */ class ae {
2762
2762
  constructor(t, e) {
2763
2763
  this.position = t, this.inclusive = e;
2764
2764
  }
@@ -2766,22 +2766,22 @@ function re(t, e) {
2766
2766
 
2767
2767
  /**
2768
2768
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
2769
- */ class ae {
2769
+ */ class he {
2770
2770
  constructor(t, e = "asc" /* ASCENDING */) {
2771
2771
  this.field = t, this.dir = e;
2772
2772
  }
2773
2773
  }
2774
2774
 
2775
- function he(t, e) {
2775
+ function le(t, e) {
2776
2776
  return t.dir === e.dir && t.field.isEqual(e.field);
2777
2777
  }
2778
2778
 
2779
- function le(t, e) {
2779
+ function fe(t, e) {
2780
2780
  if (null === t) return null === e;
2781
2781
  if (null === e) return !1;
2782
2782
  if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
2783
2783
  for (let n = 0; n < t.position.length; n++) {
2784
- if (!Lt(t.position[n], e.position[n])) return !1;
2784
+ if (!Mt(t.position[n], e.position[n])) return !1;
2785
2785
  }
2786
2786
  return !0;
2787
2787
  }
@@ -2808,7 +2808,7 @@ function le(t, e) {
2808
2808
  * query the RemoteStore results.
2809
2809
  *
2810
2810
  * Visible for testing.
2811
- */ class fe {
2811
+ */ class de {
2812
2812
  /**
2813
2813
  * Initializes a Query with a path and optional additional query constraints.
2814
2814
  * Path must currently be empty if this is a collection group query.
@@ -2821,11 +2821,11 @@ function le(t, e) {
2821
2821
  }
2822
2822
  }
2823
2823
 
2824
- /** Creates a new Query for a query that matches all documents at `path` */ function de(t) {
2824
+ /** Creates a new Query for a query that matches all documents at `path` */ function we(t) {
2825
2825
  return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
2826
2826
  }
2827
2827
 
2828
- function we(t) {
2828
+ function me(t) {
2829
2829
  for (const e of t.filters) if (e.q()) return e.field;
2830
2830
  return null;
2831
2831
  }
@@ -2838,7 +2838,7 @@ function we(t) {
2838
2838
  * Returns whether the query matches a collection group rather than a specific
2839
2839
  * collection.
2840
2840
  */
2841
- function me(t) {
2841
+ function pe(t) {
2842
2842
  return null !== t.collectionGroup;
2843
2843
  }
2844
2844
 
@@ -2846,23 +2846,23 @@ function me(t) {
2846
2846
  * Returns the implicit order by constraint that is used to execute the Query,
2847
2847
  * which can be different from the order by constraints the user provided (e.g.
2848
2848
  * the SDK and backend always orders by `__name__`).
2849
- */ function pe(t) {
2850
- const e = b(t);
2849
+ */ function ye(t) {
2850
+ const e = E(t);
2851
2851
  if (null === e.O) {
2852
2852
  e.O = [];
2853
- const t = we(e), n = de(e);
2853
+ const t = me(e), n = we(e);
2854
2854
  if (null !== t && null === n)
2855
2855
  // In order to implicitly add key ordering, we must also add the
2856
2856
  // inequality filter field for it to be a valid query.
2857
2857
  // Note that the default inequality field and key ordering is ascending.
2858
- t.isKeyField() || e.O.push(new ae(t)), e.O.push(new ae(tt.keyField(), "asc" /* ASCENDING */)); else {
2858
+ t.isKeyField() || e.O.push(new he(t)), e.O.push(new he(et.keyField(), "asc" /* ASCENDING */)); else {
2859
2859
  let t = !1;
2860
2860
  for (const n of e.explicitOrderBy) e.O.push(n), n.field.isKeyField() && (t = !0);
2861
2861
  if (!t) {
2862
2862
  // The order of the implicit key ordering always matches the last
2863
2863
  // explicit order by
2864
2864
  const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2865
- e.O.push(new ae(tt.keyField(), t));
2865
+ e.O.push(new he(et.keyField(), t));
2866
2866
  }
2867
2867
  }
2868
2868
  }
@@ -2871,34 +2871,34 @@ function me(t) {
2871
2871
 
2872
2872
  /**
2873
2873
  * Converts this `Query` instance to it's corresponding `Target` representation.
2874
- */ function ye(t) {
2875
- const e = b(t);
2876
- if (!e.k) if ("F" /* First */ === e.limitType) e.k = Xt(e.path, e.collectionGroup, pe(e), e.filters, e.limit, e.startAt, e.endAt); else {
2874
+ */ function _e(t) {
2875
+ const e = E(t);
2876
+ if (!e.k) if ("F" /* First */ === e.limitType) e.k = Zt(e.path, e.collectionGroup, ye(e), e.filters, e.limit, e.startAt, e.endAt); else {
2877
2877
  // Flip the orderBy directions since we want the last results
2878
2878
  const t = [];
2879
- for (const n of pe(e)) {
2879
+ for (const n of ye(e)) {
2880
2880
  const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2881
- t.push(new ae(n.field, e));
2881
+ t.push(new he(n.field, e));
2882
2882
  }
2883
2883
  // We need to swap the cursors to match the now-flipped query ordering.
2884
- const n = e.endAt ? new ce(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new ce(e.startAt.position, e.startAt.inclusive) : null;
2884
+ const n = e.endAt ? new ae(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new ae(e.startAt.position, e.startAt.inclusive) : null;
2885
2885
  // Now return as a LimitType.First query.
2886
- e.k = Xt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2886
+ e.k = Zt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2887
2887
  }
2888
2888
  return e.k;
2889
2889
  }
2890
2890
 
2891
- function _e(t, e) {
2891
+ function ge(t, e) {
2892
2892
  return function(t, e) {
2893
2893
  if (t.limit !== e.limit) return !1;
2894
2894
  if (t.orderBy.length !== e.orderBy.length) return !1;
2895
- for (let n = 0; n < t.orderBy.length; n++) if (!he(t.orderBy[n], e.orderBy[n])) return !1;
2895
+ for (let n = 0; n < t.orderBy.length; n++) if (!le(t.orderBy[n], e.orderBy[n])) return !1;
2896
2896
  if (t.filters.length !== e.filters.length) return !1;
2897
2897
  for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
2898
- n.op !== r.op || !n.field.isEqual(r.field) || !Lt(n.value, r.value)) return !1;
2898
+ n.op !== r.op || !n.field.isEqual(r.field) || !Mt(n.value, r.value)) return !1;
2899
2899
  var n, r;
2900
- return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!le(t.startAt, e.startAt) && le(t.endAt, e.endAt);
2901
- }(ye(t), ye(e)) && t.limitType === e.limitType;
2900
+ return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!fe(t.startAt, e.startAt) && fe(t.endAt, e.endAt);
2901
+ }(_e(t), _e(e)) && t.limitType === e.limitType;
2902
2902
  }
2903
2903
 
2904
2904
  /**
@@ -2926,9 +2926,9 @@ function _e(t, e) {
2926
2926
  * The return value is an IntegerValue if it can safely represent the value,
2927
2927
  * otherwise a DoubleValue is returned.
2928
2928
  */
2929
- function ge(t, e) {
2929
+ function ve(t, e) {
2930
2930
  return function(t) {
2931
- return "number" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2931
+ return "number" == typeof t && Number.isInteger(t) && !ht(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2932
2932
  }(e) ?
2933
2933
  /**
2934
2934
  * Returns an IntegerValue for `value`.
@@ -2950,7 +2950,7 @@ function ge(t, e) {
2950
2950
  };
2951
2951
  }
2952
2952
  return {
2953
- doubleValue: at(e) ? "-0" : e
2953
+ doubleValue: ht(e) ? "-0" : e
2954
2954
  };
2955
2955
  }(t, e);
2956
2956
  }
@@ -2971,7 +2971,7 @@ function ge(t, e) {
2971
2971
  * See the License for the specific language governing permissions and
2972
2972
  * limitations under the License.
2973
2973
  */
2974
- /** Used to represent a field transform on a mutation. */ class ve {
2974
+ /** Used to represent a field transform on a mutation. */ class be {
2975
2975
  constructor() {
2976
2976
  // Make sure that the structural type of `TransformOperation` is unique.
2977
2977
  // See https://github.com/microsoft/TypeScript/issues/5451
@@ -2979,15 +2979,15 @@ function ge(t, e) {
2979
2979
  }
2980
2980
  }
2981
2981
 
2982
- /** Transforms a value into a server-generated timestamp. */ class be extends ve {}
2982
+ /** Transforms a value into a server-generated timestamp. */ class Ee extends be {}
2983
2983
 
2984
- /** Transforms an array value via a union operation. */ class Ee extends ve {
2984
+ /** Transforms an array value via a union operation. */ class Ie extends be {
2985
2985
  constructor(t) {
2986
2986
  super(), this.elements = t;
2987
2987
  }
2988
2988
  }
2989
2989
 
2990
- /** Transforms an array value via a remove operation. */ class Ie extends ve {
2990
+ /** Transforms an array value via a remove operation. */ class Te extends be {
2991
2991
  constructor(t) {
2992
2992
  super(), this.elements = t;
2993
2993
  }
@@ -2998,7 +2998,7 @@ function ge(t, e) {
2998
2998
  * transforms. Converts all field values to integers or doubles, but unlike the
2999
2999
  * backend does not cap integer values at 2^63. Instead, JavaScript number
3000
3000
  * arithmetic is used and precision loss can occur for values greater than 2^53.
3001
- */ class Te extends ve {
3001
+ */ class Ae extends be {
3002
3002
  constructor(t, e) {
3003
3003
  super(), this.L = t, this.M = e;
3004
3004
  }
@@ -3020,7 +3020,7 @@ function ge(t, e) {
3020
3020
  * See the License for the specific language governing permissions and
3021
3021
  * limitations under the License.
3022
3022
  */
3023
- /** A field path and the TransformOperation to perform upon it. */ class Ae {
3023
+ /** A field path and the TransformOperation to perform upon it. */ class Re {
3024
3024
  constructor(t, e) {
3025
3025
  this.field = t, this.transform = e;
3026
3026
  }
@@ -3030,18 +3030,18 @@ function ge(t, e) {
3030
3030
  * Encodes a precondition for a mutation. This follows the model that the
3031
3031
  * backend accepts with the special case of an explicit "empty" precondition
3032
3032
  * (meaning no precondition).
3033
- */ class Re {
3033
+ */ class Pe {
3034
3034
  constructor(t, e) {
3035
3035
  this.updateTime = t, this.exists = e;
3036
3036
  }
3037
3037
  /** Creates a new empty Precondition. */ static none() {
3038
- return new Re;
3038
+ return new Pe;
3039
3039
  }
3040
3040
  /** Creates a new Precondition with an exists flag. */ static exists(t) {
3041
- return new Re(void 0, t);
3041
+ return new Pe(void 0, t);
3042
3042
  }
3043
3043
  /** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
3044
- return new Re(t);
3044
+ return new Pe(t);
3045
3045
  }
3046
3046
  /** Returns whether this Precondition is empty. */ get isNone() {
3047
3047
  return void 0 === this.updateTime && void 0 === this.exists;
@@ -3094,12 +3094,12 @@ function ge(t, e) {
3094
3094
  * applyToLocalView() to implement the actual behavior of applying the mutation
3095
3095
  * to some source document (see `setMutationApplyToRemoteDocument()` for an
3096
3096
  * example).
3097
- */ class Pe {}
3097
+ */ class Ve {}
3098
3098
 
3099
3099
  /**
3100
3100
  * A mutation that creates or replaces the document at the given key with the
3101
3101
  * object value contents.
3102
- */ class Ve extends Pe {
3102
+ */ class Ne extends Ve {
3103
3103
  constructor(t, e, n, r = []) {
3104
3104
  super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
3105
3105
  this.type = 0 /* Set */;
@@ -3121,7 +3121,7 @@ function ge(t, e) {
3121
3121
  * is deleted.
3122
3122
  * * When a field is not in the mask but is in the values, the values map is
3123
3123
  * ignored.
3124
- */ class Ne extends Pe {
3124
+ */ class De extends Ve {
3125
3125
  constructor(t, e, n, r, s = []) {
3126
3126
  super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
3127
3127
  this.fieldTransforms = s, this.type = 1 /* Patch */;
@@ -3131,7 +3131,7 @@ function ge(t, e) {
3131
3131
  }
3132
3132
  }
3133
3133
 
3134
- /** A mutation that deletes the document at the given key. */ class De extends Pe {
3134
+ /** A mutation that deletes the document at the given key. */ class $e extends Ve {
3135
3135
  constructor(t, e) {
3136
3136
  super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
3137
3137
  }
@@ -3146,7 +3146,7 @@ function ge(t, e) {
3146
3146
  *
3147
3147
  * The `verify` operation is only used in Transactions, and this class serves
3148
3148
  * primarily to facilitate serialization into protos.
3149
- */ class $e extends Pe {
3149
+ */ class xe extends Ve {
3150
3150
  constructor(t, e) {
3151
3151
  super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
3152
3152
  }
@@ -3170,13 +3170,13 @@ function ge(t, e) {
3170
3170
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3171
3171
  * See the License for the specific language governing permissions and
3172
3172
  * limitations under the License.
3173
- */ const xe = (() => {
3173
+ */ const Fe = (() => {
3174
3174
  const t = {
3175
3175
  asc: "ASCENDING",
3176
3176
  desc: "DESCENDING"
3177
3177
  };
3178
3178
  return t;
3179
- })(), Fe = (() => {
3179
+ })(), Se = (() => {
3180
3180
  const t = {
3181
3181
  "<": "LESS_THAN",
3182
3182
  "<=": "LESS_THAN_OR_EQUAL",
@@ -3206,7 +3206,7 @@ function ge(t, e) {
3206
3206
  * TODO(klimt): We can remove the databaseId argument if we keep the full
3207
3207
  * resource name in documents.
3208
3208
  */
3209
- class Se {
3209
+ class qe {
3210
3210
  constructor(t, e) {
3211
3211
  this.databaseId = t, this.C = e;
3212
3212
  }
@@ -3223,7 +3223,7 @@ class Se {
3223
3223
  /**
3224
3224
  * Returns a value for a Date that's appropriate to put into a proto.
3225
3225
  */
3226
- function qe(t, e) {
3226
+ function Oe(t, e) {
3227
3227
  if (t.C) {
3228
3228
  return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
3229
3229
  }
@@ -3238,129 +3238,129 @@ function qe(t, e) {
3238
3238
  *
3239
3239
  * Visible for testing.
3240
3240
  */
3241
- function Oe(t, e) {
3241
+ function ke(t, e) {
3242
3242
  return t.C ? e.toBase64() : e.toUint8Array();
3243
3243
  }
3244
3244
 
3245
- function ke(t, e) {
3246
- return qe(t, e.toTimestamp());
3245
+ function Ce(t, e) {
3246
+ return Oe(t, e.toTimestamp());
3247
3247
  }
3248
3248
 
3249
- function Ce(t) {
3250
- return v(!!t), vt.fromTimestamp(function(t) {
3251
- const e = $t(t);
3252
- return new gt(e.seconds, e.nanos);
3249
+ function Le(t) {
3250
+ return b(!!t), bt.fromTimestamp(function(t) {
3251
+ const e = xt(t);
3252
+ return new vt(e.seconds, e.nanos);
3253
3253
  }(t));
3254
3254
  }
3255
3255
 
3256
- function Le(t, e) {
3256
+ function Me(t, e) {
3257
3257
  return function(t) {
3258
- return new X([ "projects", t.projectId, "databases", t.database ]);
3258
+ return new Z([ "projects", t.projectId, "databases", t.database ]);
3259
3259
  }(t).child("documents").child(e).canonicalString();
3260
3260
  }
3261
3261
 
3262
- function Me(t, e) {
3263
- return Le(t.databaseId, e.path);
3262
+ function Ue(t, e) {
3263
+ return Me(t.databaseId, e.path);
3264
3264
  }
3265
3265
 
3266
- function Ue(t, e) {
3266
+ function je(t, e) {
3267
3267
  const n = function(t) {
3268
- const e = X.fromString(t);
3269
- return v(Xe(e)), e;
3268
+ const e = Z.fromString(t);
3269
+ return b(Ze(e)), e;
3270
3270
  }(e);
3271
- if (n.get(1) !== t.databaseId.projectId) throw new L(A, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
3272
- if (n.get(3) !== t.databaseId.database) throw new L(A, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
3273
- return new et((v((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
3271
+ 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);
3272
+ 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);
3273
+ return new nt((b((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
3274
3274
  var r;
3275
3275
  /** Creates a Document proto from key and fields (but no create/update time) */}
3276
3276
 
3277
- function je(t, e) {
3278
- return Le(t.databaseId, e);
3277
+ function Be(t, e) {
3278
+ return Me(t.databaseId, e);
3279
3279
  }
3280
3280
 
3281
- function Be(t) {
3282
- return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
3281
+ function Qe(t) {
3282
+ return new Z([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
3283
3283
  }
3284
3284
 
3285
3285
  function ze(t, e, n) {
3286
3286
  return {
3287
- name: Me(t, e),
3287
+ name: Ue(t, e),
3288
3288
  fields: n.value.mapValue.fields
3289
3289
  };
3290
3290
  }
3291
3291
 
3292
3292
  function Ge(t, e) {
3293
3293
  return "found" in e ? function(t, e) {
3294
- v(!!e.found), e.found.name, e.found.updateTime;
3295
- const n = Ue(t, e.found.name), r = Ce(e.found.updateTime), s = new Yt({
3294
+ b(!!e.found), e.found.name, e.found.updateTime;
3295
+ const n = je(t, e.found.name), r = Le(e.found.updateTime), s = new Ht({
3296
3296
  mapValue: {
3297
3297
  fields: e.found.fields
3298
3298
  }
3299
3299
  });
3300
- return Ht.newFoundDocument(n, r, s);
3300
+ return Jt.newFoundDocument(n, r, s);
3301
3301
  }(t, e) : "missing" in e ? function(t, e) {
3302
- v(!!e.missing), v(!!e.readTime);
3303
- const n = Ue(t, e.missing), r = Ce(e.readTime);
3304
- return Ht.newNoDocument(n, r);
3305
- }(t, e) : g();
3302
+ b(!!e.missing), b(!!e.readTime);
3303
+ const n = je(t, e.missing), r = Le(e.readTime);
3304
+ return Jt.newNoDocument(n, r);
3305
+ }(t, e) : v();
3306
3306
  }
3307
3307
 
3308
- function Qe(t, e) {
3308
+ function We(t, e) {
3309
3309
  let n;
3310
- if (e instanceof Ve) n = {
3310
+ if (e instanceof Ne) n = {
3311
3311
  update: ze(t, e.key, e.value)
3312
+ }; else if (e instanceof $e) n = {
3313
+ delete: Ue(t, e.key)
3312
3314
  }; else if (e instanceof De) n = {
3313
- delete: Me(t, e.key)
3314
- }; else if (e instanceof Ne) n = {
3315
3315
  update: ze(t, e.key, e.data),
3316
- updateMask: Je(e.fieldMask)
3316
+ updateMask: Xe(e.fieldMask)
3317
3317
  }; else {
3318
- if (!(e instanceof $e)) return g();
3318
+ if (!(e instanceof xe)) return v();
3319
3319
  n = {
3320
- verify: Me(t, e.key)
3320
+ verify: Ue(t, e.key)
3321
3321
  };
3322
3322
  }
3323
3323
  return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
3324
3324
  const n = e.transform;
3325
- if (n instanceof be) return {
3325
+ if (n instanceof Ee) return {
3326
3326
  fieldPath: e.field.canonicalString(),
3327
3327
  setToServerValue: "REQUEST_TIME"
3328
3328
  };
3329
- if (n instanceof Ee) return {
3329
+ if (n instanceof Ie) return {
3330
3330
  fieldPath: e.field.canonicalString(),
3331
3331
  appendMissingElements: {
3332
3332
  values: n.elements
3333
3333
  }
3334
3334
  };
3335
- if (n instanceof Ie) return {
3335
+ if (n instanceof Te) return {
3336
3336
  fieldPath: e.field.canonicalString(),
3337
3337
  removeAllFromArray: {
3338
3338
  values: n.elements
3339
3339
  }
3340
3340
  };
3341
- if (n instanceof Te) return {
3341
+ if (n instanceof Ae) return {
3342
3342
  fieldPath: e.field.canonicalString(),
3343
3343
  increment: n.M
3344
3344
  };
3345
- throw g();
3345
+ throw v();
3346
3346
  }(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
3347
3347
  return void 0 !== e.updateTime ? {
3348
- updateTime: ke(t, e.updateTime)
3348
+ updateTime: Ce(t, e.updateTime)
3349
3349
  } : void 0 !== e.exists ? {
3350
3350
  exists: e.exists
3351
- } : g();
3351
+ } : v();
3352
3352
  }(t, e.precondition)), n;
3353
3353
  }
3354
3354
 
3355
- function We(t, e) {
3355
+ function Ke(t, e) {
3356
3356
  // Dissect the path into parent, collectionId, and optional key filter.
3357
3357
  const n = {
3358
3358
  structuredQuery: {}
3359
3359
  }, r = e.path;
3360
- null !== e.collectionGroup ? (n.parent = je(t, r), n.structuredQuery.from = [ {
3360
+ null !== e.collectionGroup ? (n.parent = Be(t, r), n.structuredQuery.from = [ {
3361
3361
  collectionId: e.collectionGroup,
3362
3362
  allDescendants: !0
3363
- } ]) : (n.parent = je(t, r.popLast()), n.structuredQuery.from = [ {
3363
+ } ]) : (n.parent = Be(t, r.popLast()), n.structuredQuery.from = [ {
3364
3364
  collectionId: r.lastSegment()
3365
3365
  } ]);
3366
3366
  const s = function(t) {
@@ -3369,36 +3369,36 @@ function We(t, e) {
3369
3369
  // visible for testing
3370
3370
  function(t) {
3371
3371
  if ("==" /* EQUAL */ === t.op) {
3372
- if (Qt(t.value)) return {
3372
+ if (Wt(t.value)) return {
3373
3373
  unaryFilter: {
3374
- field: He(t.field),
3374
+ field: Je(t.field),
3375
3375
  op: "IS_NAN"
3376
3376
  }
3377
3377
  };
3378
3378
  if (Gt(t.value)) return {
3379
3379
  unaryFilter: {
3380
- field: He(t.field),
3380
+ field: Je(t.field),
3381
3381
  op: "IS_NULL"
3382
3382
  }
3383
3383
  };
3384
3384
  } else if ("!=" /* NOT_EQUAL */ === t.op) {
3385
- if (Qt(t.value)) return {
3385
+ if (Wt(t.value)) return {
3386
3386
  unaryFilter: {
3387
- field: He(t.field),
3387
+ field: Je(t.field),
3388
3388
  op: "IS_NOT_NAN"
3389
3389
  }
3390
3390
  };
3391
3391
  if (Gt(t.value)) return {
3392
3392
  unaryFilter: {
3393
- field: He(t.field),
3393
+ field: Je(t.field),
3394
3394
  op: "IS_NOT_NULL"
3395
3395
  }
3396
3396
  };
3397
3397
  }
3398
3398
  return {
3399
3399
  fieldFilter: {
3400
- field: He(t.field),
3401
- op: Ye(t.op),
3400
+ field: Je(t.field),
3401
+ op: He(t.op),
3402
3402
  value: t.value
3403
3403
  }
3404
3404
  };
@@ -3418,14 +3418,14 @@ function We(t, e) {
3418
3418
  // visible for testing
3419
3419
  function(t) {
3420
3420
  return {
3421
- field: He(t.field),
3422
- direction: Ke(t.dir)
3421
+ field: Je(t.field),
3422
+ direction: Ye(t.dir)
3423
3423
  };
3424
3424
  }(t)));
3425
3425
  }(e.orderBy);
3426
3426
  i && (n.structuredQuery.orderBy = i);
3427
3427
  const o = function(t, e) {
3428
- return t.C || ct(e) ? e : {
3428
+ return t.C || at(e) ? e : {
3429
3429
  value: e
3430
3430
  };
3431
3431
  }(t, e.limit);
@@ -3443,29 +3443,29 @@ function We(t, e) {
3443
3443
  (e.endAt)), n;
3444
3444
  }
3445
3445
 
3446
- function Ke(t) {
3447
- return xe[t];
3448
- }
3449
-
3450
- // visible for testing
3451
3446
  function Ye(t) {
3452
3447
  return Fe[t];
3453
3448
  }
3454
3449
 
3450
+ // visible for testing
3455
3451
  function He(t) {
3452
+ return Se[t];
3453
+ }
3454
+
3455
+ function Je(t) {
3456
3456
  return {
3457
3457
  fieldPath: t.canonicalString()
3458
3458
  };
3459
3459
  }
3460
3460
 
3461
- function Je(t) {
3461
+ function Xe(t) {
3462
3462
  const e = [];
3463
3463
  return t.fields.forEach((t => e.push(t.canonicalString()))), {
3464
3464
  fieldPaths: e
3465
3465
  };
3466
3466
  }
3467
3467
 
3468
- function Xe(t) {
3468
+ function Ze(t) {
3469
3469
  // Resource names have at least 4 components (project ID, database ID)
3470
3470
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
3471
3471
  }
@@ -3485,8 +3485,8 @@ function Xe(t) {
3485
3485
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3486
3486
  * See the License for the specific language governing permissions and
3487
3487
  * limitations under the License.
3488
- */ function Ze(t) {
3489
- return new Se(t, /* useProto3Json= */ !0);
3488
+ */ function tn(t) {
3489
+ return new qe(t, /* useProto3Json= */ !0);
3490
3490
  }
3491
3491
 
3492
3492
  /**
@@ -3514,7 +3514,7 @@ function Xe(t) {
3514
3514
  * base delay. This prevents clients from accidentally synchronizing their
3515
3515
  * delays causing spikes of load to the backend.
3516
3516
  */
3517
- class tn {
3517
+ class en {
3518
3518
  constructor(
3519
3519
  /**
3520
3520
  * The AsyncQueue to run backoff operations on.
@@ -3569,7 +3569,7 @@ class tn {
3569
3569
  // honored as such).
3570
3570
  const e = Math.floor(this.W + this.X()), n = Math.max(0, Date.now() - this.Y), r = Math.max(0, e - n);
3571
3571
  // Guard against lastAttemptTime being in the future due to a clock change.
3572
- r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.W} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
3572
+ r > 0 && p("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.W} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
3573
3573
  this.K = this.U.enqueueAfterDelay(this.timerId, r, (() => (this.Y = Date.now(),
3574
3574
  t()))),
3575
3575
  // Apply backoff factor to determine next delay and ensure it is within
@@ -3612,24 +3612,24 @@ class tn {
3612
3612
  * An implementation of Datastore that exposes additional state for internal
3613
3613
  * consumption.
3614
3614
  */
3615
- class en extends class {} {
3615
+ class nn extends class {} {
3616
3616
  constructor(t, e, n, r) {
3617
3617
  super(), this.authCredentials = t, this.appCheckCredentials = e, this.tt = n, this.L = r,
3618
3618
  this.et = !1;
3619
3619
  }
3620
3620
  nt() {
3621
- if (this.et) throw new L(x, "The client has already been terminated.");
3621
+ if (this.et) throw new M(F, "The client has already been terminated.");
3622
3622
  }
3623
3623
  /** Invokes the provided RPC with auth and AppCheck tokens. */ I(t, e, n) {
3624
3624
  return this.nt(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.tt.I(t, e, n, r, s))).catch((t => {
3625
- throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
3626
- this.appCheckCredentials.invalidateToken()), t) : new L(T, t.toString());
3625
+ throw "FirebaseError" === t.name ? (t.code === $ && (this.authCredentials.invalidateToken(),
3626
+ this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
3627
3627
  }));
3628
3628
  }
3629
3629
  /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ P(t, e, n, r) {
3630
3630
  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 => {
3631
- throw "FirebaseError" === t.name ? (t.code === D && (this.authCredentials.invalidateToken(),
3632
- this.appCheckCredentials.invalidateToken()), t) : new L(T, t.toString());
3631
+ throw "FirebaseError" === t.name ? (t.code === $ && (this.authCredentials.invalidateToken(),
3632
+ this.appCheckCredentials.invalidateToken()), t) : new M(A, t.toString());
3633
3633
  }));
3634
3634
  }
3635
3635
  terminate() {
@@ -3639,16 +3639,16 @@ class en extends class {} {
3639
3639
 
3640
3640
  // TODO(firestorexp): Make sure there is only one Datastore instance per
3641
3641
  // firestore-exp client.
3642
- async function nn(t, e) {
3643
- const n = b(t), r = Be(n.L) + "/documents", s = {
3644
- writes: e.map((t => Qe(n.L, t)))
3642
+ async function rn(t, e) {
3643
+ const n = E(t), r = Qe(n.L) + "/documents", s = {
3644
+ writes: e.map((t => We(n.L, t)))
3645
3645
  };
3646
3646
  await n.I("Commit", r, s);
3647
3647
  }
3648
3648
 
3649
- async function rn(t, e) {
3650
- const n = b(t), r = Be(n.L) + "/documents", s = {
3651
- documents: e.map((t => Me(n.L, t)))
3649
+ async function sn(t, e) {
3650
+ const n = E(t), r = Qe(n.L) + "/documents", s = {
3651
+ documents: e.map((t => Ue(n.L, t)))
3652
3652
  }, i = await n.P("BatchGetDocuments", r, s, e.length), o = new Map;
3653
3653
  i.forEach((t => {
3654
3654
  const e = Ge(n.L, t);
@@ -3657,24 +3657,42 @@ async function rn(t, e) {
3657
3657
  const u = [];
3658
3658
  return e.forEach((t => {
3659
3659
  const e = o.get(t.toString());
3660
- v(!!e), u.push(e);
3660
+ b(!!e), u.push(e);
3661
3661
  })), u;
3662
3662
  }
3663
3663
 
3664
- async function sn(t, e) {
3665
- const n = b(t), r = We(n.L, ye(e));
3664
+ async function on(t, e) {
3665
+ const n = E(t), r = Ke(n.L, _e(e));
3666
3666
  return (await n.P("RunQuery", r.parent, {
3667
3667
  structuredQuery: r.structuredQuery
3668
3668
  })).filter((t => !!t.document)).map((t => function(t, e, n) {
3669
- const r = Ue(t, e.name), s = Ce(e.updateTime), i = new Yt({
3669
+ const r = je(t, e.name), s = Le(e.updateTime), i = new Ht({
3670
3670
  mapValue: {
3671
3671
  fields: e.fields
3672
3672
  }
3673
- }), o = Ht.newFoundDocument(r, s, i);
3673
+ }), o = Jt.newFoundDocument(r, s, i);
3674
3674
  return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
3675
3675
  }(n.L, t.document, void 0)));
3676
3676
  }
3677
3677
 
3678
+ async function un(t, e) {
3679
+ const n = E(t), r = function(t, e) {
3680
+ const n = Ke(t, e);
3681
+ return {
3682
+ structuredAggregationQuery: {
3683
+ aggregations: [ {
3684
+ count: {},
3685
+ alias: "count_alias"
3686
+ } ],
3687
+ structuredQuery: n.structuredQuery
3688
+ },
3689
+ parent: n.parent
3690
+ };
3691
+ }(n.L, _e(e)), s = r.parent;
3692
+ n.tt.v || delete r.parent;
3693
+ return (await n.P("RunAggregationQuery", s, r, /*expectedResponseCount=*/ 1)).filter((t => !!t.result)).map((t => t.result.aggregateFields));
3694
+ }
3695
+
3678
3696
  /**
3679
3697
  * @license
3680
3698
  * Copyright 2020 Google LLC
@@ -3690,7 +3708,7 @@ async function sn(t, e) {
3690
3708
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3691
3709
  * See the License for the specific language governing permissions and
3692
3710
  * limitations under the License.
3693
- */ const on = new Map;
3711
+ */ const cn = new Map;
3694
3712
 
3695
3713
  /**
3696
3714
  * An instance map that ensures only one Datastore exists per Firestore
@@ -3701,17 +3719,17 @@ async function sn(t, e) {
3701
3719
  * instance. Callers must invoke removeComponents() when the Firestore
3702
3720
  * instance is terminated.
3703
3721
  */
3704
- function un(t) {
3705
- if (t._terminated) throw new L(x, "The client has already been terminated.");
3706
- if (!on.has(t)) {
3707
- m("ComponentProvider", "Initializing Datastore");
3722
+ function an(t) {
3723
+ if (t._terminated) throw new M(F, "The client has already been terminated.");
3724
+ if (!cn.has(t)) {
3725
+ p("ComponentProvider", "Initializing Datastore");
3708
3726
  const i = function(t) {
3709
- return new wt(t, fetch.bind(null));
3727
+ return new mt(t, fetch.bind(null));
3710
3728
  }((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3711
- new Y(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Ze(t._databaseId), u = function(t, e, n, r) {
3712
- return new en(t, e, n, r);
3729
+ new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = tn(t._databaseId), u = function(t, e, n, r) {
3730
+ return new nn(t, e, n, r);
3713
3731
  }(t._authCredentials, t._appCheckCredentials, i, o);
3714
- on.set(t, u);
3732
+ cn.set(t, u);
3715
3733
  }
3716
3734
  var e, n, r, s;
3717
3735
  /**
@@ -3729,7 +3747,7 @@ function un(t) {
3729
3747
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3730
3748
  * See the License for the specific language governing permissions and
3731
3749
  * limitations under the License.
3732
- */ return on.get(t);
3750
+ */ return cn.get(t);
3733
3751
  }
3734
3752
 
3735
3753
  /**
@@ -3741,21 +3759,21 @@ function un(t) {
3741
3759
  * user-supplied `FirestoreSettings` object. This is a separate type so that
3742
3760
  * defaults can be supplied and the value can be checked for equality.
3743
3761
  */
3744
- class cn {
3762
+ class hn {
3745
3763
  constructor(t) {
3746
3764
  var e;
3747
3765
  if (void 0 === t.host) {
3748
- if (void 0 !== t.ssl) throw new L(A, "Can't provide ssl option if host option is not set");
3766
+ if (void 0 !== t.ssl) throw new M(R, "Can't provide ssl option if host option is not set");
3749
3767
  this.host = "firestore.googleapis.com", this.ssl = true;
3750
3768
  } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
3751
3769
  if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
3752
3770
  void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
3753
- if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new L(A, "cacheSizeBytes must be at least 1048576");
3771
+ if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new M(R, "cacheSizeBytes must be at least 1048576");
3754
3772
  this.cacheSizeBytes = t.cacheSizeBytes;
3755
3773
  }
3756
3774
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
3757
3775
  this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
3758
- if (!0 === e && !0 === r) throw new L(A, `${t} and ${n} cannot be used together.`);
3776
+ if (!0 === e && !0 === r) throw new M(R, `${t} and ${n} cannot be used together.`);
3759
3777
  }("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
3760
3778
  }
3761
3779
  isEqual(t) {
@@ -3782,8 +3800,8 @@ class cn {
3782
3800
  /**
3783
3801
  * The Cloud Firestore service interface.
3784
3802
  *
3785
- * Do not call this constructor directly. Instead, use {@link getFirestore}.
3786
- */ class an {
3803
+ * Do not call this constructor directly. Instead, use {@link (getFirestore:1)}.
3804
+ */ class ln {
3787
3805
  /** @hideconstructor */
3788
3806
  constructor(t, e, n, r) {
3789
3807
  this._authCredentials = t, this._appCheckCredentials = e, this._databaseId = n,
@@ -3791,14 +3809,14 @@ class cn {
3791
3809
  /**
3792
3810
  * Whether it's a Firestore or Firestore Lite instance.
3793
3811
  */
3794
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new cn({}),
3812
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new hn({}),
3795
3813
  this._settingsFrozen = !1;
3796
3814
  }
3797
3815
  /**
3798
3816
  * The {@link @firebase/app#FirebaseApp} associated with this `Firestore` service
3799
3817
  * instance.
3800
3818
  */ get app() {
3801
- if (!this._app) throw new L(x, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
3819
+ if (!this._app) throw new M(F, "Firestore was not initialized using the Firebase SDK. 'app' is not available");
3802
3820
  return this._app;
3803
3821
  }
3804
3822
  get _initialized() {
@@ -3808,19 +3826,19 @@ class cn {
3808
3826
  return void 0 !== this._terminateTask;
3809
3827
  }
3810
3828
  _setSettings(t) {
3811
- if (this._settingsFrozen) throw new L(x, "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.");
3812
- this._settings = new cn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3813
- if (!t) return new j;
3829
+ if (this._settingsFrozen) throw new M(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.");
3830
+ this._settings = new hn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3831
+ if (!t) return new B;
3814
3832
  switch (t.type) {
3815
3833
  case "gapi":
3816
3834
  const e = t.client;
3817
- return new Q(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
3835
+ return new W(e, t.sessionIndex || "0", t.iamToken || null, t.authTokenFactory || null);
3818
3836
 
3819
3837
  case "provider":
3820
3838
  return t.client;
3821
3839
 
3822
3840
  default:
3823
- throw new L(A, "makeAuthCredentialsProvider failed due to invalid credential type");
3841
+ throw new M(R, "makeAuthCredentialsProvider failed due to invalid credential type");
3824
3842
  }
3825
3843
  }(t.credentials));
3826
3844
  }
@@ -3848,23 +3866,23 @@ class cn {
3848
3866
  * Only ever called once.
3849
3867
  */ _terminate() {
3850
3868
  return function(t) {
3851
- const e = on.get(t);
3852
- e && (m("ComponentProvider", "Removing Datastore"), on.delete(t), e.terminate());
3869
+ const e = cn.get(t);
3870
+ e && (p("ComponentProvider", "Removing Datastore"), cn.delete(t), e.terminate());
3853
3871
  }(this), Promise.resolve();
3854
3872
  }
3855
3873
  }
3856
3874
 
3857
- function hn(t, e, n) {
3875
+ function fn(t, e, n) {
3858
3876
  n || (n = "(default)");
3859
3877
  const r = _getProvider(t, "firestore/lite");
3860
- if (r.isInitialized(n)) throw new L(x, "Firestore can only be initialized once per app.");
3878
+ if (r.isInitialized(n)) throw new M(F, "Firestore can only be initialized once per app.");
3861
3879
  return r.initialize({
3862
3880
  options: e,
3863
3881
  instanceIdentifier: n
3864
3882
  });
3865
3883
  }
3866
3884
 
3867
- function ln(e, n) {
3885
+ function dn(e, n) {
3868
3886
  const r = "object" == typeof e ? e : getApp(), s = "string" == typeof e ? e : n || "(default)";
3869
3887
  return _getProvider(r, "firestore/lite").getImmediate({
3870
3888
  identifier: s
@@ -3883,24 +3901,24 @@ function ln(e, n) {
3883
3901
  * @param port - the emulator port (ex: 9000).
3884
3902
  * @param options.mockUserToken - the mock auth token to use for unit testing
3885
3903
  * Security Rules.
3886
- */ function fn(t, e, n, r = {}) {
3904
+ */ function wn(t, e, n, r = {}) {
3887
3905
  var s;
3888
- const i = (t = ot(t, an))._getSettings();
3889
- if ("firestore.googleapis.com" !== i.host && i.host !== e && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3906
+ const i = (t = ut(t, ln))._getSettings();
3907
+ if ("firestore.googleapis.com" !== i.host && i.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3890
3908
  t._setSettings(Object.assign(Object.assign({}, i), {
3891
3909
  host: `${e}:${n}`,
3892
3910
  ssl: !1
3893
3911
  })), r.mockUserToken) {
3894
3912
  let e, n;
3895
- if ("string" == typeof r.mockUserToken) e = r.mockUserToken, n = l.MOCK_USER; else {
3913
+ if ("string" == typeof r.mockUserToken) e = r.mockUserToken, n = f.MOCK_USER; else {
3896
3914
  // Let createMockUserToken validate first (catches common mistakes like
3897
3915
  // invalid field "uid" and missing field "sub" / "user_id".)
3898
3916
  e = createMockUserToken(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3899
3917
  const i = r.mockUserToken.sub || r.mockUserToken.user_id;
3900
- if (!i) throw new L(A, "mockUserToken must contain 'sub' or 'user_id' field!");
3901
- n = new l(i);
3918
+ if (!i) throw new M(R, "mockUserToken must contain 'sub' or 'user_id' field!");
3919
+ n = new f(i);
3902
3920
  }
3903
- t._authCredentials = new B(new U(e, n));
3921
+ t._authCredentials = new Q(new j(e, n));
3904
3922
  }
3905
3923
  }
3906
3924
 
@@ -3913,7 +3931,7 @@ function ln(e, n) {
3913
3931
  * response from the server will not be resolved.
3914
3932
  *
3915
3933
  * To restart after termination, create a new instance of `Firestore` with
3916
- * {@link getFirestore}.
3934
+ * {@link (getFirestore:1)}.
3917
3935
  *
3918
3936
  * Note: Under normal circumstances, calling `terminate()` is not required. This
3919
3937
  * function is useful only when you want to force this instance to release all of
@@ -3923,8 +3941,8 @@ function ln(e, n) {
3923
3941
  * @param firestore - The `Firestore` instance to terminate.
3924
3942
  * @returns A `Promise` that is resolved when the instance has been successfully
3925
3943
  * terminated.
3926
- */ function dn(t) {
3927
- return t = ot(t, an), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
3944
+ */ function mn(t) {
3945
+ return t = ut(t, ln), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
3928
3946
  }
3929
3947
 
3930
3948
  /**
@@ -3943,6 +3961,91 @@ function ln(e, n) {
3943
3961
  * See the License for the specific language governing permissions and
3944
3962
  * limitations under the License.
3945
3963
  */
3964
+ /**
3965
+ * @license
3966
+ * Copyright 2022 Google LLC
3967
+ *
3968
+ * Licensed under the Apache License, Version 2.0 (the "License");
3969
+ * you may not use this file except in compliance with the License.
3970
+ * You may obtain a copy of the License at
3971
+ *
3972
+ * http://www.apache.org/licenses/LICENSE-2.0
3973
+ *
3974
+ * Unless required by applicable law or agreed to in writing, software
3975
+ * distributed under the License is distributed on an "AS IS" BASIS,
3976
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3977
+ * See the License for the specific language governing permissions and
3978
+ * limitations under the License.
3979
+ */
3980
+ /**
3981
+ * Represents an aggregation that can be performed by Firestore.
3982
+ */
3983
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3984
+ class pn {
3985
+ constructor() {
3986
+ /** A type string to uniquely identify instances of this class. */
3987
+ this.type = "AggregateField";
3988
+ }
3989
+ }
3990
+
3991
+ /**
3992
+ * The results of executing an aggregation query.
3993
+ */ class yn {
3994
+ /** @hideconstructor */
3995
+ constructor(t, e) {
3996
+ this._data = e,
3997
+ /** A type string to uniquely identify instances of this class. */
3998
+ this.type = "AggregateQuerySnapshot", this.query = t;
3999
+ }
4000
+ /**
4001
+ * Returns the results of the aggregations performed over the underlying
4002
+ * query.
4003
+ *
4004
+ * The keys of the returned object will be the same as those of the
4005
+ * `AggregateSpec` object specified to the aggregation method, and the values
4006
+ * will be the corresponding aggregation result.
4007
+ *
4008
+ * @returns The results of the aggregations performed over the underlying
4009
+ * query.
4010
+ */ data() {
4011
+ return this._data;
4012
+ }
4013
+ }
4014
+
4015
+ /**
4016
+ * @license
4017
+ * Copyright 2022 Google LLC
4018
+ *
4019
+ * Licensed under the Apache License, Version 2.0 (the "License");
4020
+ * you may not use this file except in compliance with the License.
4021
+ * You may obtain a copy of the License at
4022
+ *
4023
+ * http://www.apache.org/licenses/LICENSE-2.0
4024
+ *
4025
+ * Unless required by applicable law or agreed to in writing, software
4026
+ * distributed under the License is distributed on an "AS IS" BASIS,
4027
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4028
+ * See the License for the specific language governing permissions and
4029
+ * limitations under the License.
4030
+ */
4031
+ /**
4032
+ * CountQueryRunner encapsulates the logic needed to run the count aggregation
4033
+ * queries.
4034
+ */ class _n {
4035
+ constructor(t, e, n) {
4036
+ this.query = t, this.datastore = e, this.userDataWriter = n;
4037
+ }
4038
+ run() {
4039
+ return un(this.datastore, this.query._query).then((t => {
4040
+ b(void 0 !== t[0]);
4041
+ const e = Object.entries(t[0]).filter((([t, e]) => "count_alias" === t)).map((([t, e]) => this.userDataWriter.convertValue(e)))[0];
4042
+ return b("number" == typeof e), Promise.resolve(new yn(this.query, {
4043
+ count: e
4044
+ }));
4045
+ }));
4046
+ }
4047
+ }
4048
+
3946
4049
  /**
3947
4050
  * @license
3948
4051
  * Copyright 2020 Google LLC
@@ -3963,8 +4066,7 @@ function ln(e, n) {
3963
4066
  * A `DocumentReference` refers to a document location in a Firestore database
3964
4067
  * and can be used to write, read, or listen to the location. The document at
3965
4068
  * the referenced location may or may not exist.
3966
- */
3967
- class wn {
4069
+ */ class gn {
3968
4070
  /** @hideconstructor */
3969
4071
  constructor(t,
3970
4072
  /**
@@ -3992,17 +4094,17 @@ class wn {
3992
4094
  /**
3993
4095
  * The collection this `DocumentReference` belongs to.
3994
4096
  */ get parent() {
3995
- return new pn(this.firestore, this.converter, this._key.path.popLast());
4097
+ return new bn(this.firestore, this.converter, this._key.path.popLast());
3996
4098
  }
3997
4099
  withConverter(t) {
3998
- return new wn(this.firestore, t, this._key);
4100
+ return new gn(this.firestore, t, this._key);
3999
4101
  }
4000
4102
  }
4001
4103
 
4002
4104
  /**
4003
4105
  * A `Query` refers to a query which you can read or listen to. You can also
4004
4106
  * construct refined `Query` objects by adding filters and ordering.
4005
- */ class mn {
4107
+ */ class vn {
4006
4108
  // This is the lite version of the Query class in the main SDK.
4007
4109
  /** @hideconstructor protected */
4008
4110
  constructor(t,
@@ -4015,17 +4117,17 @@ class wn {
4015
4117
  this.type = "query", this.firestore = t;
4016
4118
  }
4017
4119
  withConverter(t) {
4018
- return new mn(this.firestore, t, this._query);
4120
+ return new vn(this.firestore, t, this._query);
4019
4121
  }
4020
4122
  }
4021
4123
 
4022
4124
  /**
4023
4125
  * A `CollectionReference` object can be used for adding documents, getting
4024
4126
  * document references, and querying for documents (using {@link query}).
4025
- */ class pn extends mn {
4127
+ */ class bn extends vn {
4026
4128
  /** @hideconstructor */
4027
4129
  constructor(t, e, n) {
4028
- super(t, e, new fe(n)), this._path = n,
4130
+ super(t, e, new de(n)), this._path = n,
4029
4131
  /** The type of this Firestore reference. */
4030
4132
  this.type = "collection";
4031
4133
  }
@@ -4043,23 +4145,23 @@ class wn {
4043
4145
  * subcollection. If this isn't a subcollection, the reference is null.
4044
4146
  */ get parent() {
4045
4147
  const t = this._path.popLast();
4046
- return t.isEmpty() ? null : new wn(this.firestore,
4047
- /* converter= */ null, new et(t));
4148
+ return t.isEmpty() ? null : new gn(this.firestore,
4149
+ /* converter= */ null, new nt(t));
4048
4150
  }
4049
4151
  withConverter(t) {
4050
- return new pn(this.firestore, t, this._path);
4152
+ return new bn(this.firestore, t, this._path);
4051
4153
  }
4052
4154
  }
4053
4155
 
4054
- function yn(t, e, ...n) {
4055
- if (t = getModularInstance(t), nt("collection", "path", e), t instanceof an) {
4056
- const r = X.fromString(e, ...n);
4057
- return st(r), new pn(t, /* converter= */ null, r);
4156
+ function En(t, e, ...n) {
4157
+ if (t = getModularInstance(t), rt("collection", "path", e), t instanceof ln) {
4158
+ const r = Z.fromString(e, ...n);
4159
+ return it(r), new bn(t, /* converter= */ null, r);
4058
4160
  }
4059
4161
  {
4060
- if (!(t instanceof wn || t instanceof pn)) throw new L(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4061
- const r = t._path.child(X.fromString(e, ...n));
4062
- return st(r), new pn(t.firestore,
4162
+ if (!(t instanceof gn || t instanceof bn)) throw new M(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4163
+ const r = t._path.child(Z.fromString(e, ...n));
4164
+ return it(r), new bn(t.firestore,
4063
4165
  /* converter= */ null, r);
4064
4166
  }
4065
4167
  }
@@ -4076,32 +4178,32 @@ function yn(t, e, ...n) {
4076
4178
  * collection or subcollection with this ID as the last segment of its path
4077
4179
  * will be included. Cannot contain a slash.
4078
4180
  * @returns The created `Query`.
4079
- */ function _n(t, e) {
4080
- if (t = ot(t, an), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new L(A, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
4081
- return new mn(t,
4181
+ */ function In(t, e) {
4182
+ 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 '/'.`);
4183
+ return new vn(t,
4082
4184
  /* converter= */ null,
4083
4185
  /**
4084
4186
  * Creates a new Query for a collection group query that matches all documents
4085
4187
  * within the provided collection group.
4086
4188
  */
4087
4189
  function(t) {
4088
- return new fe(X.emptyPath(), t);
4190
+ return new de(Z.emptyPath(), t);
4089
4191
  }(e));
4090
4192
  }
4091
4193
 
4092
- function gn(t, e, ...n) {
4194
+ function Tn(t, e, ...n) {
4093
4195
  if (t = getModularInstance(t),
4094
4196
  // We allow omission of 'pathString' but explicitly prohibit passing in both
4095
4197
  // 'undefined' and 'null'.
4096
- 1 === arguments.length && (e = pt.D()), nt("doc", "path", e), t instanceof an) {
4097
- const r = X.fromString(e, ...n);
4098
- return rt(r), new wn(t,
4099
- /* converter= */ null, new et(r));
4198
+ 1 === arguments.length && (e = yt.D()), rt("doc", "path", e), t instanceof ln) {
4199
+ const r = Z.fromString(e, ...n);
4200
+ return st(r), new gn(t,
4201
+ /* converter= */ null, new nt(r));
4100
4202
  }
4101
4203
  {
4102
- if (!(t instanceof wn || t instanceof pn)) throw new L(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4103
- const r = t._path.child(X.fromString(e, ...n));
4104
- return rt(r), new wn(t.firestore, t instanceof pn ? t.converter : null, new et(r));
4204
+ if (!(t instanceof gn || t instanceof bn)) throw new M(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
4205
+ const r = t._path.child(Z.fromString(e, ...n));
4206
+ return st(r), new gn(t.firestore, t instanceof bn ? t.converter : null, new nt(r));
4105
4207
  }
4106
4208
  }
4107
4209
 
@@ -4112,8 +4214,8 @@ function gn(t, e, ...n) {
4112
4214
  * @param right - A reference to compare.
4113
4215
  * @returns true if the references point to the same location in the same
4114
4216
  * Firestore database.
4115
- */ function vn(t, e) {
4116
- return t = getModularInstance(t), e = getModularInstance(e), (t instanceof wn || t instanceof pn) && (e instanceof wn || e instanceof pn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
4217
+ */ function An(t, e) {
4218
+ return t = getModularInstance(t), e = getModularInstance(e), (t instanceof gn || t instanceof bn) && (e instanceof gn || e instanceof bn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
4117
4219
  }
4118
4220
 
4119
4221
  /**
@@ -4124,59 +4226,8 @@ function gn(t, e, ...n) {
4124
4226
  * @param right - A `Query` to compare.
4125
4227
  * @returns true if the references point to the same location in the same
4126
4228
  * Firestore database.
4127
- */ function bn(t, e) {
4128
- return t = getModularInstance(t), e = getModularInstance(e), t instanceof mn && e instanceof mn && (t.firestore === e.firestore && _e(t._query, e._query) && t.converter === e.converter);
4129
- }
4130
-
4131
- /**
4132
- * @license
4133
- * Copyright 2020 Google LLC
4134
- *
4135
- * Licensed under the Apache License, Version 2.0 (the "License");
4136
- * you may not use this file except in compliance with the License.
4137
- * You may obtain a copy of the License at
4138
- *
4139
- * http://www.apache.org/licenses/LICENSE-2.0
4140
- *
4141
- * Unless required by applicable law or agreed to in writing, software
4142
- * distributed under the License is distributed on an "AS IS" BASIS,
4143
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4144
- * See the License for the specific language governing permissions and
4145
- * limitations under the License.
4146
- */
4147
- /**
4148
- * A `FieldPath` refers to a field in a document. The path may consist of a
4149
- * single field name (referring to a top-level field in the document), or a
4150
- * list of field names (referring to a nested field in the document).
4151
- *
4152
- * Create a `FieldPath` by providing field names. If more than one field
4153
- * name is provided, the path will point to a nested field in a document.
4154
- */ class En {
4155
- /**
4156
- * Creates a `FieldPath` from the provided field names. If more than one field
4157
- * name is provided, the path will point to a nested field in a document.
4158
- *
4159
- * @param fieldNames - A list of field names.
4160
- */
4161
- constructor(...t) {
4162
- for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new L(A, "Invalid field name at argument $(i + 1). Field names must not be empty.");
4163
- this._internalPath = new tt(t);
4164
- }
4165
- /**
4166
- * Returns true if this `FieldPath` is equal to the provided one.
4167
- *
4168
- * @param other - The `FieldPath` to compare against.
4169
- * @returns true if this `FieldPath` is equal to the provided one.
4170
- */ isEqual(t) {
4171
- return this._internalPath.isEqual(t._internalPath);
4172
- }
4173
- }
4174
-
4175
- /**
4176
- * Returns a special sentinel `FieldPath` to refer to the ID of a document.
4177
- * It can be used in queries to sort or filter by the document ID.
4178
- */ function In() {
4179
- return new En("__name__");
4229
+ */ function Rn(t, e) {
4230
+ return t = getModularInstance(t), e = getModularInstance(e), t instanceof vn && e instanceof vn && (t.firestore === e.firestore && ge(t._query, e._query) && t.converter === e.converter);
4180
4231
  }
4181
4232
 
4182
4233
  /**
@@ -4197,7 +4248,7 @@ function gn(t, e, ...n) {
4197
4248
  */
4198
4249
  /**
4199
4250
  * An immutable object representing an array of bytes.
4200
- */ class Tn {
4251
+ */ class Pn {
4201
4252
  /** @hideconstructor */
4202
4253
  constructor(t) {
4203
4254
  this._byteString = t;
@@ -4209,9 +4260,9 @@ function gn(t, e, ...n) {
4209
4260
  * @param base64 - The Base64 string used to create the `Bytes` object.
4210
4261
  */ static fromBase64String(t) {
4211
4262
  try {
4212
- return new Tn(Nt.fromBase64String(t));
4263
+ return new Pn(Dt.fromBase64String(t));
4213
4264
  } catch (t) {
4214
- throw new L(A, "Failed to construct data from Base64 string: " + t);
4265
+ throw new M(R, "Failed to construct data from Base64 string: " + t);
4215
4266
  }
4216
4267
  }
4217
4268
  /**
@@ -4219,7 +4270,7 @@ function gn(t, e, ...n) {
4219
4270
  *
4220
4271
  * @param array - The Uint8Array used to create the `Bytes` object.
4221
4272
  */ static fromUint8Array(t) {
4222
- return new Tn(Nt.fromUint8Array(t));
4273
+ return new Pn(Dt.fromUint8Array(t));
4223
4274
  }
4224
4275
  /**
4225
4276
  * Returns the underlying bytes as a Base64-encoded string.
@@ -4252,6 +4303,57 @@ function gn(t, e, ...n) {
4252
4303
  }
4253
4304
  }
4254
4305
 
4306
+ /**
4307
+ * @license
4308
+ * Copyright 2020 Google LLC
4309
+ *
4310
+ * Licensed under the Apache License, Version 2.0 (the "License");
4311
+ * you may not use this file except in compliance with the License.
4312
+ * You may obtain a copy of the License at
4313
+ *
4314
+ * http://www.apache.org/licenses/LICENSE-2.0
4315
+ *
4316
+ * Unless required by applicable law or agreed to in writing, software
4317
+ * distributed under the License is distributed on an "AS IS" BASIS,
4318
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4319
+ * See the License for the specific language governing permissions and
4320
+ * limitations under the License.
4321
+ */
4322
+ /**
4323
+ * A `FieldPath` refers to a field in a document. The path may consist of a
4324
+ * single field name (referring to a top-level field in the document), or a
4325
+ * list of field names (referring to a nested field in the document).
4326
+ *
4327
+ * Create a `FieldPath` by providing field names. If more than one field
4328
+ * name is provided, the path will point to a nested field in a document.
4329
+ */ class Vn {
4330
+ /**
4331
+ * Creates a `FieldPath` from the provided field names. If more than one field
4332
+ * name is provided, the path will point to a nested field in a document.
4333
+ *
4334
+ * @param fieldNames - A list of field names.
4335
+ */
4336
+ constructor(...t) {
4337
+ 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.");
4338
+ this._internalPath = new et(t);
4339
+ }
4340
+ /**
4341
+ * Returns true if this `FieldPath` is equal to the provided one.
4342
+ *
4343
+ * @param other - The `FieldPath` to compare against.
4344
+ * @returns true if this `FieldPath` is equal to the provided one.
4345
+ */ isEqual(t) {
4346
+ return this._internalPath.isEqual(t._internalPath);
4347
+ }
4348
+ }
4349
+
4350
+ /**
4351
+ * Returns a special sentinel `FieldPath` to refer to the ID of a document.
4352
+ * It can be used in queries to sort or filter by the document ID.
4353
+ */ function Nn() {
4354
+ return new Vn("__name__");
4355
+ }
4356
+
4255
4357
  /**
4256
4358
  * @license
4257
4359
  * Copyright 2020 Google LLC
@@ -4271,7 +4373,7 @@ function gn(t, e, ...n) {
4271
4373
  /**
4272
4374
  * Sentinel values that can be used when writing document fields with `set()`
4273
4375
  * or `update()`.
4274
- */ class An {
4376
+ */ class Dn {
4275
4377
  /**
4276
4378
  * @param _methodName - The public API endpoint that returns this class.
4277
4379
  * @hideconstructor
@@ -4303,7 +4405,7 @@ function gn(t, e, ...n) {
4303
4405
  *
4304
4406
  * Latitude values are in the range of [-90, 90].
4305
4407
  * Longitude values are in the range of [-180, 180].
4306
- */ class Rn {
4408
+ */ class $n {
4307
4409
  /**
4308
4410
  * Creates a new immutable `GeoPoint` object with the provided latitude and
4309
4411
  * longitude values.
@@ -4311,8 +4413,8 @@ function gn(t, e, ...n) {
4311
4413
  * @param longitude - The longitude as number between -180 and 180.
4312
4414
  */
4313
4415
  constructor(t, e) {
4314
- if (!isFinite(t) || t < -90 || t > 90) throw new L(A, "Latitude must be a number between -90 and 90, but was: " + t);
4315
- if (!isFinite(e) || e < -180 || e > 180) throw new L(A, "Longitude must be a number between -180 and 180, but was: " + e);
4416
+ if (!isFinite(t) || t < -90 || t > 90) throw new M(R, "Latitude must be a number between -90 and 90, but was: " + t);
4417
+ if (!isFinite(e) || e < -180 || e > 180) throw new M(R, "Longitude must be a number between -180 and 180, but was: " + e);
4316
4418
  this._lat = t, this._long = e;
4317
4419
  }
4318
4420
  /**
@@ -4343,7 +4445,7 @@ function gn(t, e, ...n) {
4343
4445
  * Actually private to JS consumers of our API, so this function is prefixed
4344
4446
  * with an underscore.
4345
4447
  */ _compareTo(t) {
4346
- return yt(this._lat, t._lat) || yt(this._long, t._long);
4448
+ return _t(this._lat, t._lat) || _t(this._long, t._long);
4347
4449
  }
4348
4450
  }
4349
4451
 
@@ -4362,29 +4464,29 @@ function gn(t, e, ...n) {
4362
4464
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4363
4465
  * See the License for the specific language governing permissions and
4364
4466
  * limitations under the License.
4365
- */ const Pn = /^__.*__$/;
4467
+ */ const xn = /^__.*__$/;
4366
4468
 
4367
- /** The result of parsing document data (e.g. for a setData call). */ class Vn {
4469
+ /** The result of parsing document data (e.g. for a setData call). */ class Fn {
4368
4470
  constructor(t, e, n) {
4369
4471
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
4370
4472
  }
4371
4473
  toMutation(t, e) {
4372
- return null !== this.fieldMask ? new Ne(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ve(t, this.data, e, this.fieldTransforms);
4474
+ return null !== this.fieldMask ? new De(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ne(t, this.data, e, this.fieldTransforms);
4373
4475
  }
4374
4476
  }
4375
4477
 
4376
- /** The result of parsing "update" data (i.e. for an updateData call). */ class Nn {
4478
+ /** The result of parsing "update" data (i.e. for an updateData call). */ class Sn {
4377
4479
  constructor(t,
4378
4480
  // The fieldMask does not include document transforms.
4379
4481
  e, n) {
4380
4482
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
4381
4483
  }
4382
4484
  toMutation(t, e) {
4383
- return new Ne(t, this.data, this.fieldMask, e, this.fieldTransforms);
4485
+ return new De(t, this.data, this.fieldMask, e, this.fieldTransforms);
4384
4486
  }
4385
4487
  }
4386
4488
 
4387
- function Dn(t) {
4489
+ function qn(t) {
4388
4490
  switch (t) {
4389
4491
  case 0 /* Set */ :
4390
4492
  // fall through
@@ -4398,11 +4500,11 @@ function Dn(t) {
4398
4500
  return !1;
4399
4501
 
4400
4502
  default:
4401
- throw g();
4503
+ throw v();
4402
4504
  }
4403
4505
  }
4404
4506
 
4405
- /** A "context" object passed around while parsing user data. */ class $n {
4507
+ /** A "context" object passed around while parsing user data. */ class On {
4406
4508
  /**
4407
4509
  * Initializes a ParseContext with the given source and path.
4408
4510
  *
@@ -4434,7 +4536,7 @@ function Dn(t) {
4434
4536
  return this.settings.st;
4435
4537
  }
4436
4538
  /** Returns a new context with the specified settings overwritten. */ it(t) {
4437
- return new $n(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.L, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
4539
+ return new On(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.L, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
4438
4540
  }
4439
4541
  ot(t) {
4440
4542
  var e;
@@ -4461,7 +4563,7 @@ function Dn(t) {
4461
4563
  });
4462
4564
  }
4463
4565
  lt(t) {
4464
- return Jn(t, this.settings.methodName, this.settings.ft || !1, this.path, this.settings.dt);
4566
+ return nr(t, this.settings.methodName, this.settings.ft || !1, this.path, this.settings.dt);
4465
4567
  }
4466
4568
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
4467
4569
  return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
@@ -4473,52 +4575,52 @@ function Dn(t) {
4473
4575
  }
4474
4576
  ct(t) {
4475
4577
  if (0 === t.length) throw this.lt("Document fields must not be empty");
4476
- if (Dn(this.st) && Pn.test(t)) throw this.lt('Document fields cannot begin and end with "__"');
4578
+ if (qn(this.st) && xn.test(t)) throw this.lt('Document fields cannot begin and end with "__"');
4477
4579
  }
4478
4580
  }
4479
4581
 
4480
4582
  /**
4481
4583
  * Helper for parsing raw user input (provided via the API) into internal model
4482
4584
  * classes.
4483
- */ class xn {
4585
+ */ class kn {
4484
4586
  constructor(t, e, n) {
4485
- this.databaseId = t, this.ignoreUndefinedProperties = e, this.L = n || Ze(t);
4587
+ this.databaseId = t, this.ignoreUndefinedProperties = e, this.L = n || tn(t);
4486
4588
  }
4487
4589
  /** Creates a new top-level parse context. */ wt(t, e, n, r = !1) {
4488
- return new $n({
4590
+ return new On({
4489
4591
  st: t,
4490
4592
  methodName: e,
4491
4593
  dt: n,
4492
- path: tt.emptyPath(),
4594
+ path: et.emptyPath(),
4493
4595
  ut: !1,
4494
4596
  ft: r
4495
4597
  }, this.databaseId, this.L, this.ignoreUndefinedProperties);
4496
4598
  }
4497
4599
  }
4498
4600
 
4499
- function Fn(t) {
4500
- const e = t._freezeSettings(), n = Ze(t._databaseId);
4501
- return new xn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4601
+ function Cn(t) {
4602
+ const e = t._freezeSettings(), n = tn(t._databaseId);
4603
+ return new kn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4502
4604
  }
4503
4605
 
4504
- /** Parse document data from a set() call. */ function Sn(t, e, n, r, s, i = {}) {
4606
+ /** Parse document data from a set() call. */ function Ln(t, e, n, r, s, i = {}) {
4505
4607
  const o = t.wt(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
4506
- Wn("Data must be an object, but it was:", o, r);
4507
- const u = Gn(r, o);
4608
+ Xn("Data must be an object, but it was:", o, r);
4609
+ const u = Hn(r, o);
4508
4610
  let c, a;
4509
- if (i.merge) c = new Vt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4611
+ if (i.merge) c = new Nt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4510
4612
  const t = [];
4511
4613
  for (const r of i.mergeFields) {
4512
- const s = Kn(e, r, n);
4513
- if (!o.contains(s)) throw new L(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
4514
- Xn(t, s) || t.push(s);
4614
+ const s = Zn(e, r, n);
4615
+ if (!o.contains(s)) throw new M(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
4616
+ rr(t, s) || t.push(s);
4515
4617
  }
4516
- c = new Vt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4618
+ c = new Nt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4517
4619
  } else c = null, a = o.fieldTransforms;
4518
- return new Vn(new Yt(u), c, a);
4620
+ return new Fn(new Ht(u), c, a);
4519
4621
  }
4520
4622
 
4521
- class qn extends An {
4623
+ class Mn extends Dn {
4522
4624
  _toFieldTransform(t) {
4523
4625
  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}`);
4524
4626
  // No transform to add for a delete, but we need to add it to our
@@ -4526,7 +4628,7 @@ class qn extends An {
4526
4628
  return t.fieldMask.push(t.path), null;
4527
4629
  }
4528
4630
  isEqual(t) {
4529
- return t instanceof qn;
4631
+ return t instanceof Mn;
4530
4632
  }
4531
4633
  }
4532
4634
 
@@ -4545,8 +4647,8 @@ class qn extends An {
4545
4647
  * context.
4546
4648
  * @param context - The parent context.
4547
4649
  * @param arrayElement - Whether or not the FieldValue has an array.
4548
- */ function On(t, e, n) {
4549
- return new $n({
4650
+ */ function Un(t, e, n) {
4651
+ return new On({
4550
4652
  st: 3 /* Argument */ ,
4551
4653
  dt: e.settings.dt,
4552
4654
  methodName: t._methodName,
@@ -4554,23 +4656,23 @@ class qn extends An {
4554
4656
  }, e.databaseId, e.L, e.ignoreUndefinedProperties);
4555
4657
  }
4556
4658
 
4557
- class kn extends An {
4659
+ class jn extends Dn {
4558
4660
  _toFieldTransform(t) {
4559
- return new Ae(t.path, new be);
4661
+ return new Re(t.path, new Ee);
4560
4662
  }
4561
4663
  isEqual(t) {
4562
- return t instanceof kn;
4664
+ return t instanceof jn;
4563
4665
  }
4564
4666
  }
4565
4667
 
4566
- class Cn extends An {
4668
+ class Bn extends Dn {
4567
4669
  constructor(t, e) {
4568
4670
  super(t), this.yt = e;
4569
4671
  }
4570
4672
  _toFieldTransform(t) {
4571
- const e = On(this, t,
4572
- /*array=*/ !0), n = this.yt.map((t => zn(t, e))), r = new Ee(n);
4573
- return new Ae(t.path, r);
4673
+ const e = Un(this, t,
4674
+ /*array=*/ !0), n = this.yt.map((t => Yn(t, e))), r = new Ie(n);
4675
+ return new Re(t.path, r);
4574
4676
  }
4575
4677
  isEqual(t) {
4576
4678
  // TODO(mrschmidt): Implement isEquals
@@ -4578,14 +4680,14 @@ class Cn extends An {
4578
4680
  }
4579
4681
  }
4580
4682
 
4581
- class Ln extends An {
4683
+ class Qn extends Dn {
4582
4684
  constructor(t, e) {
4583
4685
  super(t), this.yt = e;
4584
4686
  }
4585
4687
  _toFieldTransform(t) {
4586
- const e = On(this, t,
4587
- /*array=*/ !0), n = this.yt.map((t => zn(t, e))), r = new Ie(n);
4588
- return new Ae(t.path, r);
4688
+ const e = Un(this, t,
4689
+ /*array=*/ !0), n = this.yt.map((t => Yn(t, e))), r = new Te(n);
4690
+ return new Re(t.path, r);
4589
4691
  }
4590
4692
  isEqual(t) {
4591
4693
  // TODO(mrschmidt): Implement isEquals
@@ -4593,13 +4695,13 @@ class Ln extends An {
4593
4695
  }
4594
4696
  }
4595
4697
 
4596
- class Mn extends An {
4698
+ class zn extends Dn {
4597
4699
  constructor(t, e) {
4598
4700
  super(t), this._t = e;
4599
4701
  }
4600
4702
  _toFieldTransform(t) {
4601
- const e = new Te(t.L, ge(t.L, this._t));
4602
- return new Ae(t.path, e);
4703
+ const e = new Ae(t.L, ve(t.L, this._t));
4704
+ return new Re(t.path, e);
4603
4705
  }
4604
4706
  isEqual(t) {
4605
4707
  // TODO(mrschmidt): Implement isEquals
@@ -4607,50 +4709,50 @@ class Mn extends An {
4607
4709
  }
4608
4710
  }
4609
4711
 
4610
- /** Parse update data from an update() call. */ function Un(t, e, n, r) {
4712
+ /** Parse update data from an update() call. */ function Gn(t, e, n, r) {
4611
4713
  const s = t.wt(1 /* Update */ , e, n);
4612
- Wn("Data must be an object, but it was:", s, r);
4613
- const i = [], o = Yt.empty();
4614
- Et(r, ((t, r) => {
4615
- const u = Hn(e, t, n);
4714
+ Xn("Data must be an object, but it was:", s, r);
4715
+ const i = [], o = Ht.empty();
4716
+ It(r, ((t, r) => {
4717
+ const u = er(e, t, n);
4616
4718
  // For Compat types, we have to "extract" the underlying types before
4617
4719
  // performing validation.
4618
4720
  r = getModularInstance(r);
4619
4721
  const c = s.at(u);
4620
- if (r instanceof qn)
4722
+ if (r instanceof Mn)
4621
4723
  // Add it to the field mask, but don't add anything to updateData.
4622
4724
  i.push(u); else {
4623
- const t = zn(r, c);
4725
+ const t = Yn(r, c);
4624
4726
  null != t && (i.push(u), o.set(u, t));
4625
4727
  }
4626
4728
  }));
4627
- const u = new Vt(i);
4628
- return new Nn(o, u, s.fieldTransforms);
4729
+ const u = new Nt(i);
4730
+ return new Sn(o, u, s.fieldTransforms);
4629
4731
  }
4630
4732
 
4631
- /** Parse update data from a list of field/value arguments. */ function jn(t, e, n, r, s, i) {
4632
- const o = t.wt(1 /* Update */ , e, n), u = [ Kn(e, r, n) ], c = [ s ];
4633
- if (i.length % 2 != 0) throw new L(A, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4634
- for (let t = 0; t < i.length; t += 2) u.push(Kn(e, i[t])), c.push(i[t + 1]);
4635
- const a = [], l = Yt.empty();
4733
+ /** Parse update data from a list of field/value arguments. */ function Wn(t, e, n, r, s, i) {
4734
+ const o = t.wt(1 /* Update */ , e, n), u = [ Zn(e, r, n) ], c = [ s ];
4735
+ 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.`);
4736
+ for (let t = 0; t < i.length; t += 2) u.push(Zn(e, i[t])), c.push(i[t + 1]);
4737
+ const a = [], l = Ht.empty();
4636
4738
  // We iterate in reverse order to pick the last value for a field if the
4637
4739
  // user specified the field multiple times.
4638
- for (let t = u.length - 1; t >= 0; --t) if (!Xn(a, u[t])) {
4740
+ for (let t = u.length - 1; t >= 0; --t) if (!rr(a, u[t])) {
4639
4741
  const e = u[t];
4640
4742
  let n = c[t];
4641
4743
  // For Compat types, we have to "extract" the underlying types before
4642
4744
  // performing validation.
4643
4745
  n = getModularInstance(n);
4644
4746
  const r = o.at(e);
4645
- if (n instanceof qn)
4747
+ if (n instanceof Mn)
4646
4748
  // Add it to the field mask, but don't add anything to updateData.
4647
4749
  a.push(e); else {
4648
- const t = zn(n, r);
4750
+ const t = Yn(n, r);
4649
4751
  null != t && (a.push(e), l.set(e, t));
4650
4752
  }
4651
4753
  }
4652
- const f = new Vt(a);
4653
- return new Nn(l, f, o.fieldTransforms);
4754
+ const f = new Nt(a);
4755
+ return new Sn(l, f, o.fieldTransforms);
4654
4756
  }
4655
4757
 
4656
4758
  /**
@@ -4659,8 +4761,8 @@ class Mn extends An {
4659
4761
  *
4660
4762
  * @param allowArrays - Whether the query value is an array that may directly
4661
4763
  * contain additional arrays (e.g. the operand of an `in` query).
4662
- */ function Bn(t, e, n, r = !1) {
4663
- return zn(n, t.wt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4764
+ */ function Kn(t, e, n, r = !1) {
4765
+ return Yn(n, t.wt(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4664
4766
  }
4665
4767
 
4666
4768
  /**
@@ -4671,12 +4773,12 @@ class Mn extends An {
4671
4773
  * the source of the data being parsed, etc.
4672
4774
  * @returns The parsed value, or null if the value was a FieldValue sentinel
4673
4775
  * that should not be included in the resulting parsed data.
4674
- */ function zn(t, e) {
4675
- if (Qn(
4776
+ */ function Yn(t, e) {
4777
+ if (Jn(
4676
4778
  // Unwrap the API type from the Compat SDK. This will return the API type
4677
4779
  // from firestore-exp.
4678
- t = getModularInstance(t))) return Wn("Unsupported field value:", e, t), Gn(t, e);
4679
- if (t instanceof An)
4780
+ t = getModularInstance(t))) return Xn("Unsupported field value:", e, t), Hn(t, e);
4781
+ if (t instanceof Dn)
4680
4782
  // FieldValues usually parse into transforms (except deleteField())
4681
4783
  // in which case we do not want to include this field in our parsed data
4682
4784
  // (as doing so will overwrite the field directly prior to the transform
@@ -4688,7 +4790,7 @@ class Mn extends An {
4688
4790
  */
4689
4791
  return function(t, e) {
4690
4792
  // Sentinels are only supported with writes, and not within arrays.
4691
- if (!Dn(e.st)) throw e.lt(`${t._methodName}() can only be used with update() and set()`);
4793
+ if (!qn(e.st)) throw e.lt(`${t._methodName}() can only be used with update() and set()`);
4692
4794
  if (!e.path) throw e.lt(`${t._methodName}() is not currently supported inside arrays`);
4693
4795
  const n = t._toFieldTransform(e);
4694
4796
  n && e.fieldTransforms.push(n);
@@ -4718,7 +4820,7 @@ class Mn extends An {
4718
4820
  const n = [];
4719
4821
  let r = 0;
4720
4822
  for (const s of t) {
4721
- let t = zn(s, e.ht(r));
4823
+ let t = Yn(s, e.ht(r));
4722
4824
  null == t && (
4723
4825
  // Just include nulls in the array for fields being replaced with a
4724
4826
  // sentinel.
@@ -4737,7 +4839,7 @@ class Mn extends An {
4737
4839
  if (null === (t = getModularInstance(t))) return {
4738
4840
  nullValue: "NULL_VALUE"
4739
4841
  };
4740
- if ("number" == typeof t) return ge(e.L, t);
4842
+ if ("number" == typeof t) return ve(e.L, t);
4741
4843
  if ("boolean" == typeof t) return {
4742
4844
  booleanValue: t
4743
4845
  };
@@ -4745,37 +4847,37 @@ class Mn extends An {
4745
4847
  stringValue: t
4746
4848
  };
4747
4849
  if (t instanceof Date) {
4748
- const n = gt.fromDate(t);
4850
+ const n = vt.fromDate(t);
4749
4851
  return {
4750
- timestampValue: qe(e.L, n)
4852
+ timestampValue: Oe(e.L, n)
4751
4853
  };
4752
4854
  }
4753
- if (t instanceof gt) {
4855
+ if (t instanceof vt) {
4754
4856
  // Firestore backend truncates precision down to microseconds. To ensure
4755
4857
  // offline mode works the same with regards to truncation, perform the
4756
4858
  // truncation immediately without waiting for the backend to do that.
4757
- const n = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4859
+ const n = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4758
4860
  return {
4759
- timestampValue: qe(e.L, n)
4861
+ timestampValue: Oe(e.L, n)
4760
4862
  };
4761
4863
  }
4762
- if (t instanceof Rn) return {
4864
+ if (t instanceof $n) return {
4763
4865
  geoPointValue: {
4764
4866
  latitude: t.latitude,
4765
4867
  longitude: t.longitude
4766
4868
  }
4767
4869
  };
4768
- if (t instanceof Tn) return {
4769
- bytesValue: Oe(e.L, t._byteString)
4870
+ if (t instanceof Pn) return {
4871
+ bytesValue: ke(e.L, t._byteString)
4770
4872
  };
4771
- if (t instanceof wn) {
4873
+ if (t instanceof gn) {
4772
4874
  const n = e.databaseId, r = t.firestore._databaseId;
4773
4875
  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}`);
4774
4876
  return {
4775
- referenceValue: Le(t.firestore._databaseId || e.databaseId, t._key.path)
4877
+ referenceValue: Me(t.firestore._databaseId || e.databaseId, t._key.path)
4776
4878
  };
4777
4879
  }
4778
- throw e.lt(`Unsupported field value: ${it(t)}`);
4880
+ throw e.lt(`Unsupported field value: ${ot(t)}`);
4779
4881
  }
4780
4882
  /**
4781
4883
  * Checks whether an object looks like a JSON object that should be converted
@@ -4786,13 +4888,13 @@ class Mn extends An {
4786
4888
  */ (t, e);
4787
4889
  }
4788
4890
 
4789
- function Gn(t, e) {
4891
+ function Hn(t, e) {
4790
4892
  const n = {};
4791
4893
  return !function(t) {
4792
4894
  for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
4793
4895
  return !0;
4794
- }(t) ? Et(t, ((t, r) => {
4795
- const s = zn(r, e.ot(t));
4896
+ }(t) ? It(t, ((t, r) => {
4897
+ const s = Yn(r, e.ot(t));
4796
4898
  null != s && (n[t] = s);
4797
4899
  })) :
4798
4900
  // If we encounter an empty object, we explicitly add it to the update
@@ -4804,35 +4906,35 @@ function Gn(t, e) {
4804
4906
  };
4805
4907
  }
4806
4908
 
4807
- function Qn(t) {
4808
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof Rn || t instanceof Tn || t instanceof wn || t instanceof An);
4909
+ function Jn(t) {
4910
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof $n || t instanceof Pn || t instanceof gn || t instanceof Dn);
4809
4911
  }
4810
4912
 
4811
- function Wn(t, e, n) {
4812
- if (!Qn(n) || !function(t) {
4913
+ function Xn(t, e, n) {
4914
+ if (!Jn(n) || !function(t) {
4813
4915
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
4814
4916
  }(n)) {
4815
- const r = it(n);
4917
+ const r = ot(n);
4816
4918
  throw "an object" === r ? e.lt(t + " a custom object") : e.lt(t + " " + r);
4817
4919
  }
4818
4920
  }
4819
4921
 
4820
4922
  /**
4821
4923
  * Helper that calls fromDotSeparatedString() but wraps any error thrown.
4822
- */ function Kn(t, e, n) {
4924
+ */ function Zn(t, e, n) {
4823
4925
  if ((
4824
4926
  // If required, replace the FieldPath Compat class with with the firestore-exp
4825
4927
  // FieldPath.
4826
- e = getModularInstance(e)) instanceof En) return e._internalPath;
4827
- if ("string" == typeof e) return Hn(t, e);
4828
- throw Jn("Field path arguments must be of type string or ", t,
4928
+ e = getModularInstance(e)) instanceof Vn) return e._internalPath;
4929
+ if ("string" == typeof e) return er(t, e);
4930
+ throw nr("Field path arguments must be of type string or ", t,
4829
4931
  /* hasConverter= */ !1,
4830
4932
  /* path= */ void 0, n);
4831
4933
  }
4832
4934
 
4833
4935
  /**
4834
4936
  * Matches any characters in a field path string that are reserved.
4835
- */ const Yn = new RegExp("[~\\*/\\[\\]]");
4937
+ */ const tr = new RegExp("[~\\*/\\[\\]]");
4836
4938
 
4837
4939
  /**
4838
4940
  * Wraps fromDotSeparatedString with an error message about the method that
@@ -4842,29 +4944,29 @@ function Wn(t, e, n) {
4842
4944
  * split on dots.
4843
4945
  * @param targetDoc - The document against which the field path will be
4844
4946
  * evaluated.
4845
- */ function Hn(t, e, n) {
4846
- if (e.search(Yn) >= 0) throw Jn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4947
+ */ function er(t, e, n) {
4948
+ if (e.search(tr) >= 0) throw nr(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4847
4949
  /* hasConverter= */ !1,
4848
4950
  /* path= */ void 0, n);
4849
4951
  try {
4850
- return new En(...e.split("."))._internalPath;
4952
+ return new Vn(...e.split("."))._internalPath;
4851
4953
  } catch (r) {
4852
- throw Jn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4954
+ throw nr(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4853
4955
  /* hasConverter= */ !1,
4854
4956
  /* path= */ void 0, n);
4855
4957
  }
4856
4958
  }
4857
4959
 
4858
- function Jn(t, e, n, r, s) {
4960
+ function nr(t, e, n, r, s) {
4859
4961
  const i = r && !r.isEmpty(), o = void 0 !== s;
4860
4962
  let u = `Function ${e}() called with invalid data`;
4861
4963
  n && (u += " (via `toFirestore()`)"), u += ". ";
4862
4964
  let c = "";
4863
4965
  return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
4864
- c += ")"), new L(A, u + t + c);
4966
+ c += ")"), new M(R, u + t + c);
4865
4967
  }
4866
4968
 
4867
- /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Xn(t, e) {
4969
+ /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function rr(t, e) {
4868
4970
  return t.some((t => t.isEqual(e)));
4869
4971
  }
4870
4972
 
@@ -4892,7 +4994,7 @@ function Jn(t, e, n, r, s) {
4892
4994
  * For a `DocumentSnapshot` that points to a non-existing document, any data
4893
4995
  * access will return 'undefined'. You can use the `exists()` method to
4894
4996
  * explicitly verify a document's existence.
4895
- */ class Zn {
4997
+ */ class sr {
4896
4998
  // Note: This class is stripped down version of the DocumentSnapshot in
4897
4999
  // the legacy SDK. The changes are:
4898
5000
  // - No support for SnapshotMetadata.
@@ -4908,7 +5010,7 @@ function Jn(t, e, n, r, s) {
4908
5010
  /**
4909
5011
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
4910
5012
  */ get ref() {
4911
- return new wn(this._firestore, this._converter, this._key);
5013
+ return new gn(this._firestore, this._converter, this._key);
4912
5014
  }
4913
5015
  /**
4914
5016
  * Signals whether or not the document at the snapshot's location exists.
@@ -4928,7 +5030,7 @@ function Jn(t, e, n, r, s) {
4928
5030
  if (this._converter) {
4929
5031
  // We only want to use the converter and create a new DocumentSnapshot
4930
5032
  // if a converter has been provided.
4931
- const t = new tr(this._firestore, this._userDataWriter, this._key, this._document,
5033
+ const t = new ir(this._firestore, this._userDataWriter, this._key, this._document,
4932
5034
  /* converter= */ null);
4933
5035
  return this._converter.fromFirestore(t);
4934
5036
  }
@@ -4948,7 +5050,7 @@ function Jn(t, e, n, r, s) {
4948
5050
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4949
5051
  get(t) {
4950
5052
  if (this._document) {
4951
- const e = this._document.data.field(rr("DocumentSnapshot.get", t));
5053
+ const e = this._document.data.field(cr("DocumentSnapshot.get", t));
4952
5054
  if (null !== e) return this._userDataWriter.convertValue(e);
4953
5055
  }
4954
5056
  }
@@ -4964,7 +5066,7 @@ function Jn(t, e, n, r, s) {
4964
5066
  * `DocumentSnapshot`. Since query results contain only existing documents, the
4965
5067
  * `exists` property will always be true and `data()` will never return
4966
5068
  * 'undefined'.
4967
- */ class tr extends Zn {
5069
+ */ class ir extends sr {
4968
5070
  /**
4969
5071
  * Retrieves all fields in the document as an `Object`.
4970
5072
  *
@@ -4982,7 +5084,7 @@ function Jn(t, e, n, r, s) {
4982
5084
  * array via the `docs` property or enumerated using the `forEach` method. The
4983
5085
  * number of documents can be determined via the `empty` and `size`
4984
5086
  * properties.
4985
- */ class er {
5087
+ */ class or {
4986
5088
  /** @hideconstructor */
4987
5089
  constructor(t, e) {
4988
5090
  this._docs = e, this.query = t;
@@ -5013,14 +5115,14 @@ function Jn(t, e, n, r, s) {
5013
5115
  * @param left - A snapshot to compare.
5014
5116
  * @param right - A snapshot to compare.
5015
5117
  * @returns true if the snapshots are equal.
5016
- */ function nr(t, e) {
5017
- return t = getModularInstance(t), e = getModularInstance(e), t instanceof Zn && e instanceof Zn ? 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 er && e instanceof er && (bn(t.query, e.query) && _t(t.docs, e.docs, nr));
5118
+ */ function ur(t, e) {
5119
+ return t = getModularInstance(t), e = getModularInstance(e), t instanceof sr && e instanceof sr ? 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 or && e instanceof or && (Rn(t.query, e.query) && gt(t.docs, e.docs, ur));
5018
5120
  }
5019
5121
 
5020
5122
  /**
5021
5123
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
5022
- */ function rr(t, e) {
5023
- return "string" == typeof e ? Hn(t, e) : e instanceof En ? e._internalPath : e._delegate._internalPath;
5124
+ */ function cr(t, e) {
5125
+ return "string" == typeof e ? er(t, e) : e instanceof Vn ? e._internalPath : e._delegate._internalPath;
5024
5126
  }
5025
5127
 
5026
5128
  /**
@@ -5047,7 +5149,7 @@ function Jn(t, e, n, r, s) {
5047
5149
  * can then be passed to {@link query} to create a new query instance that
5048
5150
  * also contains this `QueryConstraint`.
5049
5151
  */
5050
- class sr {}
5152
+ class ar {}
5051
5153
 
5052
5154
  /**
5053
5155
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -5057,40 +5159,40 @@ class sr {}
5057
5159
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
5058
5160
  * @throws if any of the provided query constraints cannot be combined with the
5059
5161
  * existing or new constraints.
5060
- */ function ir(t, ...e) {
5162
+ */ function hr(t, ...e) {
5061
5163
  for (const n of e) t = n._apply(t);
5062
5164
  return t;
5063
5165
  }
5064
5166
 
5065
- class or extends sr {
5167
+ class lr extends ar {
5066
5168
  constructor(t, e, n) {
5067
5169
  super(), this.gt = t, this.vt = e, this.bt = n, this.type = "where";
5068
5170
  }
5069
5171
  _apply(t) {
5070
- const e = Fn(t.firestore), n = function(t, e, n, r, s, i, o) {
5172
+ const e = Cn(t.firestore), n = function(t, e, n, r, s, i, o) {
5071
5173
  let u;
5072
5174
  if (s.isKeyField()) {
5073
- if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new L(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
5175
+ 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().`);
5074
5176
  if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
5075
- br(o, i);
5177
+ Rr(o, i);
5076
5178
  const e = [];
5077
- for (const n of o) e.push(vr(r, t, n));
5179
+ for (const n of o) e.push(Ar(r, t, n));
5078
5180
  u = {
5079
5181
  arrayValue: {
5080
5182
  values: e
5081
5183
  }
5082
5184
  };
5083
- } else u = vr(r, t, o);
5084
- } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || br(o, i),
5085
- u = Bn(n, e, o,
5185
+ } else u = Ar(r, t, o);
5186
+ } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || Rr(o, i),
5187
+ u = Kn(n, e, o,
5086
5188
  /* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
5087
- const c = Zt.create(s, i, u);
5189
+ const c = te.create(s, i, u);
5088
5190
  return function(t, e) {
5089
5191
  if (e.q()) {
5090
- const n = we(t);
5091
- if (null !== n && !n.isEqual(e.field)) throw new L(A, `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()}'`);
5092
- const r = de(t);
5093
- null !== r && Er(t, e.field, r);
5192
+ const n = me(t);
5193
+ 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()}'`);
5194
+ const r = we(t);
5195
+ null !== r && Pr(t, e.field, r);
5094
5196
  }
5095
5197
  const n = function(t, e) {
5096
5198
  for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
@@ -5131,12 +5233,12 @@ class or extends sr {
5131
5233
  }(e.op));
5132
5234
  if (null !== n)
5133
5235
  // Special case when it's a duplicate op to give a slightly clearer error message.
5134
- throw n === e.op ? new L(A, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new L(A, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
5236
+ 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.`);
5135
5237
  }(t, c), c;
5136
5238
  }(t._query, "where", e, t.firestore._databaseId, this.gt, this.vt, this.bt);
5137
- return new mn(t.firestore, t.converter, function(t, e) {
5239
+ return new vn(t.firestore, t.converter, function(t, e) {
5138
5240
  const n = t.filters.concat([ e ]);
5139
- return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
5241
+ return new de(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
5140
5242
  }(t._query, n));
5141
5243
  }
5142
5244
  }
@@ -5151,25 +5253,25 @@ class or extends sr {
5151
5253
  * "&lt;=", "!=").
5152
5254
  * @param value - The value for comparison
5153
5255
  * @returns The created {@link Query}.
5154
- */ function ur(t, e, n) {
5155
- const r = e, s = rr("where", t);
5156
- return new or(s, r, n);
5256
+ */ function fr(t, e, n) {
5257
+ const r = e, s = cr("where", t);
5258
+ return new lr(s, r, n);
5157
5259
  }
5158
5260
 
5159
- class cr extends sr {
5261
+ class dr extends ar {
5160
5262
  constructor(t, e) {
5161
5263
  super(), this.gt = t, this.Et = e, this.type = "orderBy";
5162
5264
  }
5163
5265
  _apply(t) {
5164
5266
  const e = function(t, e, n) {
5165
- if (null !== t.startAt) throw new L(A, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
5166
- if (null !== t.endAt) throw new L(A, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
5167
- const r = new ae(e, n);
5267
+ if (null !== t.startAt) throw new M(R, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
5268
+ if (null !== t.endAt) throw new M(R, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
5269
+ const r = new he(e, n);
5168
5270
  return function(t, e) {
5169
- if (null === de(t)) {
5271
+ if (null === we(t)) {
5170
5272
  // This is the first order by. It must match any inequality.
5171
- const n = we(t);
5172
- null !== n && Er(t, n, e.field);
5273
+ const n = me(t);
5274
+ null !== n && Pr(t, n, e.field);
5173
5275
  }
5174
5276
  }(t, r), r;
5175
5277
  }
@@ -5184,10 +5286,10 @@ class cr extends sr {
5184
5286
  * of the query or if any of the fields in the order by are an uncommitted
5185
5287
  * server timestamp.
5186
5288
  */ (t._query, this.gt, this.Et);
5187
- return new mn(t.firestore, t.converter, function(t, e) {
5289
+ return new vn(t.firestore, t.converter, function(t, e) {
5188
5290
  // TODO(dimond): validate that orderBy does not list the same key twice.
5189
5291
  const n = t.explicitOrderBy.concat([ e ]);
5190
- return new fe(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
5292
+ return new de(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
5191
5293
  }(t._query, e));
5192
5294
  }
5193
5295
  }
@@ -5200,18 +5302,18 @@ class cr extends sr {
5200
5302
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
5201
5303
  * not specified, order will be ascending.
5202
5304
  * @returns The created {@link Query}.
5203
- */ function ar(t, e = "asc") {
5204
- const n = e, r = rr("orderBy", t);
5205
- return new cr(r, n);
5305
+ */ function wr(t, e = "asc") {
5306
+ const n = e, r = cr("orderBy", t);
5307
+ return new dr(r, n);
5206
5308
  }
5207
5309
 
5208
- class hr extends sr {
5310
+ class mr extends ar {
5209
5311
  constructor(t, e, n) {
5210
5312
  super(), this.type = t, this.It = e, this.Tt = n;
5211
5313
  }
5212
5314
  _apply(t) {
5213
- return new mn(t.firestore, t.converter, function(t, e, n) {
5214
- return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
5315
+ return new vn(t.firestore, t.converter, function(t, e, n) {
5316
+ return new de(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
5215
5317
  }(t._query, this.It, this.Tt));
5216
5318
  }
5217
5319
  }
@@ -5221,8 +5323,8 @@ class hr extends sr {
5221
5323
  *
5222
5324
  * @param limit - The maximum number of items to return.
5223
5325
  * @returns The created {@link Query}.
5224
- */ function lr(t) {
5225
- return ut("limit", t), new hr("limit", t, "F" /* First */);
5326
+ */ function pr(t) {
5327
+ return ct("limit", t), new mr("limit", t, "F" /* First */);
5226
5328
  }
5227
5329
 
5228
5330
  /**
@@ -5233,56 +5335,56 @@ class hr extends sr {
5233
5335
  *
5234
5336
  * @param limit - The maximum number of items to return.
5235
5337
  * @returns The created {@link Query}.
5236
- */ function fr(t) {
5237
- return ut("limitToLast", t), new hr("limitToLast", t, "L" /* Last */);
5338
+ */ function yr(t) {
5339
+ return ct("limitToLast", t), new mr("limitToLast", t, "L" /* Last */);
5238
5340
  }
5239
5341
 
5240
- class dr extends sr {
5342
+ class _r extends ar {
5241
5343
  constructor(t, e, n) {
5242
5344
  super(), this.type = t, this.At = e, this.Rt = n;
5243
5345
  }
5244
5346
  _apply(t) {
5245
- const e = gr(t, this.type, this.At, this.Rt);
5246
- return new mn(t.firestore, t.converter, function(t, e) {
5247
- return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
5347
+ const e = Tr(t, this.type, this.At, this.Rt);
5348
+ return new vn(t.firestore, t.converter, function(t, e) {
5349
+ return new de(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
5248
5350
  }(t._query, e));
5249
5351
  }
5250
5352
  }
5251
5353
 
5252
- function wr(...t) {
5253
- return new dr("startAt", t,
5354
+ function gr(...t) {
5355
+ return new _r("startAt", t,
5254
5356
  /*inclusive=*/ !0);
5255
5357
  }
5256
5358
 
5257
- function mr(...t) {
5258
- return new dr("startAfter", t,
5359
+ function vr(...t) {
5360
+ return new _r("startAfter", t,
5259
5361
  /*inclusive=*/ !1);
5260
5362
  }
5261
5363
 
5262
- class pr extends sr {
5364
+ class br extends ar {
5263
5365
  constructor(t, e, n) {
5264
5366
  super(), this.type = t, this.At = e, this.Rt = n;
5265
5367
  }
5266
5368
  _apply(t) {
5267
- const e = gr(t, this.type, this.At, this.Rt);
5268
- return new mn(t.firestore, t.converter, function(t, e) {
5269
- return new fe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
5369
+ const e = Tr(t, this.type, this.At, this.Rt);
5370
+ return new vn(t.firestore, t.converter, function(t, e) {
5371
+ return new de(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
5270
5372
  }(t._query, e));
5271
5373
  }
5272
5374
  }
5273
5375
 
5274
- function yr(...t) {
5275
- return new pr("endBefore", t,
5376
+ function Er(...t) {
5377
+ return new br("endBefore", t,
5276
5378
  /*inclusive=*/ !1);
5277
5379
  }
5278
5380
 
5279
- function _r(...t) {
5280
- return new pr("endAt", t, /*inclusive=*/ !0);
5381
+ function Ir(...t) {
5382
+ return new br("endAt", t, /*inclusive=*/ !0);
5281
5383
  }
5282
5384
 
5283
- /** Helper function to create a bound from a document or fields */ function gr(t, e, n, r) {
5284
- if (n[0] = getModularInstance(n[0]), n[0] instanceof Zn) return function(t, e, n, r, s) {
5285
- if (!r) throw new L(P, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
5385
+ /** Helper function to create a bound from a document or fields */ function Tr(t, e, n, r) {
5386
+ if (n[0] = getModularInstance(n[0]), n[0] instanceof sr) return function(t, e, n, r, s) {
5387
+ if (!r) throw new M(V, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
5286
5388
  const i = [];
5287
5389
  // Because people expect to continue/end a query at the exact document
5288
5390
  // provided, we need to use the implicit sort order rather than the explicit
@@ -5291,42 +5393,42 @@ function _r(...t) {
5291
5393
  // the provided document. Without the key (by using the explicit sort
5292
5394
  // orders), multiple documents could match the position, yielding duplicate
5293
5395
  // results.
5294
- for (const n of pe(t)) if (n.field.isKeyField()) i.push(Bt(e, r.key)); else {
5396
+ for (const n of ye(t)) if (n.field.isKeyField()) i.push(Qt(e, r.key)); else {
5295
5397
  const t = r.data.field(n.field);
5296
- if (St(t)) throw new L(A, '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.)');
5398
+ if (qt(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.)');
5297
5399
  if (null === t) {
5298
5400
  const t = n.field.canonicalString();
5299
- throw new L(A, `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.`);
5401
+ 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.`);
5300
5402
  }
5301
5403
  i.push(t);
5302
5404
  }
5303
- return new ce(i, s);
5405
+ return new ae(i, s);
5304
5406
  }
5305
5407
  /**
5306
5408
  * Converts a list of field values to a `Bound` for the given query.
5307
5409
  */ (t._query, t.firestore._databaseId, e, n[0]._document, r);
5308
5410
  {
5309
- const s = Fn(t.firestore);
5411
+ const s = Cn(t.firestore);
5310
5412
  return function(t, e, n, r, s, i) {
5311
5413
  // Use explicit order by's because it has to match the query the user made
5312
5414
  const o = t.explicitOrderBy;
5313
- if (s.length > o.length) throw new L(A, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
5415
+ 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`);
5314
5416
  const u = [];
5315
5417
  for (let i = 0; i < s.length; i++) {
5316
5418
  const c = s[i];
5317
5419
  if (o[i].field.isKeyField()) {
5318
- if ("string" != typeof c) throw new L(A, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
5319
- if (!me(t) && -1 !== c.indexOf("/")) throw new L(A, `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.`);
5320
- const n = t.path.child(X.fromString(c));
5321
- if (!et.isDocumentKey(n)) throw new L(A, `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.`);
5322
- const s = new et(n);
5323
- u.push(Bt(e, s));
5420
+ if ("string" != typeof c) throw new M(R, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
5421
+ if (!pe(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.`);
5422
+ const n = t.path.child(Z.fromString(c));
5423
+ 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.`);
5424
+ const s = new nt(n);
5425
+ u.push(Qt(e, s));
5324
5426
  } else {
5325
- const t = Bn(n, r, c);
5427
+ const t = Kn(n, r, c);
5326
5428
  u.push(t);
5327
5429
  }
5328
5430
  }
5329
- return new ce(u, i);
5431
+ return new ae(u, i);
5330
5432
  }
5331
5433
  /**
5332
5434
  * Parses the given `documentIdValue` into a `ReferenceValue`, throwing
@@ -5336,28 +5438,28 @@ function _r(...t) {
5336
5438
  }
5337
5439
  }
5338
5440
 
5339
- function vr(t, e, n) {
5441
+ function Ar(t, e, n) {
5340
5442
  if ("string" == typeof (n = getModularInstance(n))) {
5341
- if ("" === n) throw new L(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
5342
- if (!me(e) && -1 !== n.indexOf("/")) throw new L(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
5343
- const r = e.path.child(X.fromString(n));
5344
- if (!et.isDocumentKey(r)) throw new L(A, `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}).`);
5345
- return Bt(t, new et(r));
5443
+ 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.");
5444
+ if (!pe(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.`);
5445
+ const r = e.path.child(Z.fromString(n));
5446
+ 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}).`);
5447
+ return Qt(t, new nt(r));
5346
5448
  }
5347
- if (n instanceof wn) return Bt(t, n._key);
5348
- throw new L(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(n)}.`);
5449
+ if (n instanceof gn) return Qt(t, n._key);
5450
+ throw new M(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(n)}.`);
5349
5451
  }
5350
5452
 
5351
5453
  /**
5352
5454
  * Validates that the value passed into a disjunctive filter satisfies all
5353
5455
  * array requirements.
5354
- */ function br(t, e) {
5355
- if (!Array.isArray(t) || 0 === t.length) throw new L(A, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
5356
- if (t.length > 10) throw new L(A, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
5456
+ */ function Rr(t, e) {
5457
+ if (!Array.isArray(t) || 0 === t.length) throw new M(R, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
5458
+ if (t.length > 10) throw new M(R, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
5357
5459
  }
5358
5460
 
5359
- function Er(t, e, n) {
5360
- if (!n.isEqual(e)) throw new L(A, `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.`);
5461
+ function Pr(t, e, n) {
5462
+ 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.`);
5361
5463
  }
5362
5464
 
5363
5465
  /**
@@ -5407,7 +5509,7 @@ function Er(t, e, n) {
5407
5509
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
5408
5510
  * call.
5409
5511
  */
5410
- function Ir(t, e, n) {
5512
+ function Vr(t, e, n) {
5411
5513
  let r;
5412
5514
  // Cast to `any` in order to satisfy the union type constraint on
5413
5515
  // toFirestore().
@@ -5416,9 +5518,9 @@ function Ir(t, e, n) {
5416
5518
  r;
5417
5519
  }
5418
5520
 
5419
- class Tr extends class {
5521
+ class Nr extends class {
5420
5522
  convertValue(t, e = "none") {
5421
- switch (Ct(t)) {
5523
+ switch (Lt(t)) {
5422
5524
  case 0 /* NullValue */ :
5423
5525
  return null;
5424
5526
 
@@ -5426,7 +5528,7 @@ class Tr extends class {
5426
5528
  return t.booleanValue;
5427
5529
 
5428
5530
  case 2 /* NumberValue */ :
5429
- return xt(t.integerValue || t.doubleValue);
5531
+ return Ft(t.integerValue || t.doubleValue);
5430
5532
 
5431
5533
  case 3 /* TimestampValue */ :
5432
5534
  return this.convertTimestamp(t.timestampValue);
@@ -5438,7 +5540,7 @@ class Tr extends class {
5438
5540
  return t.stringValue;
5439
5541
 
5440
5542
  case 6 /* BlobValue */ :
5441
- return this.convertBytes(Ft(t.bytesValue));
5543
+ return this.convertBytes(St(t.bytesValue));
5442
5544
 
5443
5545
  case 7 /* RefValue */ :
5444
5546
  return this.convertReference(t.referenceValue);
@@ -5453,17 +5555,17 @@ class Tr extends class {
5453
5555
  return this.convertObject(t.mapValue, e);
5454
5556
 
5455
5557
  default:
5456
- throw g();
5558
+ throw v();
5457
5559
  }
5458
5560
  }
5459
5561
  convertObject(t, e) {
5460
5562
  const n = {};
5461
- return Et(t.fields, ((t, r) => {
5563
+ return It(t.fields, ((t, r) => {
5462
5564
  n[t] = this.convertValue(r, e);
5463
5565
  })), n;
5464
5566
  }
5465
5567
  convertGeoPoint(t) {
5466
- return new Rn(xt(t.latitude), xt(t.longitude));
5568
+ return new $n(Ft(t.latitude), Ft(t.longitude));
5467
5569
  }
5468
5570
  convertArray(t, e) {
5469
5571
  return (t.values || []).map((t => this.convertValue(t, e)));
@@ -5471,27 +5573,27 @@ class Tr extends class {
5471
5573
  convertServerTimestamp(t, e) {
5472
5574
  switch (e) {
5473
5575
  case "previous":
5474
- const n = qt(t);
5576
+ const n = Ot(t);
5475
5577
  return null == n ? null : this.convertValue(n, e);
5476
5578
 
5477
5579
  case "estimate":
5478
- return this.convertTimestamp(Ot(t));
5580
+ return this.convertTimestamp(kt(t));
5479
5581
 
5480
5582
  default:
5481
5583
  return null;
5482
5584
  }
5483
5585
  }
5484
5586
  convertTimestamp(t) {
5485
- const e = $t(t);
5486
- return new gt(e.seconds, e.nanos);
5587
+ const e = xt(t);
5588
+ return new vt(e.seconds, e.nanos);
5487
5589
  }
5488
5590
  convertDocumentKey(t, e) {
5489
- const n = X.fromString(t);
5490
- v(Xe(n));
5491
- const r = new H(n.get(1), n.get(3)), s = new et(n.popFirst(5));
5591
+ const n = Z.fromString(t);
5592
+ b(Ze(n));
5593
+ const r = new J(n.get(1), n.get(3)), s = new nt(n.popFirst(5));
5492
5594
  return r.isEqual(e) ||
5493
5595
  // TODO(b/64130202): Somehow support foreign references.
5494
- p(`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.`),
5596
+ 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.`),
5495
5597
  s;
5496
5598
  }
5497
5599
  } {
@@ -5499,11 +5601,11 @@ class Tr extends class {
5499
5601
  super(), this.firestore = t;
5500
5602
  }
5501
5603
  convertBytes(t) {
5502
- return new Tn(t);
5604
+ return new Pn(t);
5503
5605
  }
5504
5606
  convertReference(t) {
5505
5607
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
5506
- return new wn(this.firestore, /* converter= */ null, e);
5608
+ return new gn(this.firestore, /* converter= */ null, e);
5507
5609
  }
5508
5610
  }
5509
5611
 
@@ -5519,12 +5621,12 @@ class Tr extends class {
5519
5621
  * @param reference - The reference of the document to fetch.
5520
5622
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
5521
5623
  * document contents.
5522
- */ function Ar(t) {
5523
- const e = un((t = ot(t, wn)).firestore), n = new Tr(t.firestore);
5524
- return rn(e, [ t._key ]).then((e => {
5525
- v(1 === e.length);
5624
+ */ function Dr(t) {
5625
+ const e = an((t = ut(t, gn)).firestore), n = new Nr(t.firestore);
5626
+ return sn(e, [ t._key ]).then((e => {
5627
+ b(1 === e.length);
5526
5628
  const r = e[0];
5527
- return new Zn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5629
+ return new sr(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5528
5630
  }));
5529
5631
  }
5530
5632
 
@@ -5539,33 +5641,33 @@ class Tr extends class {
5539
5641
  *
5540
5642
  * @param query - The `Query` to execute.
5541
5643
  * @returns A Promise that will be resolved with the results of the query.
5542
- */ function Rr(t) {
5644
+ */ function $r(t) {
5543
5645
  !function(t) {
5544
- if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new L(q, "limitToLast() queries require specifying at least one orderBy() clause");
5545
- }((t = ot(t, mn))._query);
5546
- const e = un(t.firestore), n = new Tr(t.firestore);
5547
- return sn(e, t._query).then((e => {
5548
- const r = e.map((e => new tr(t.firestore, n, e.key, e, t.converter)));
5646
+ if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new M(O, "limitToLast() queries require specifying at least one orderBy() clause");
5647
+ }((t = ut(t, vn))._query);
5648
+ const e = an(t.firestore), n = new Nr(t.firestore);
5649
+ return on(e, t._query).then((e => {
5650
+ const r = e.map((e => new ir(t.firestore, n, e.key, e, t.converter)));
5549
5651
  return "L" /* Last */ === t._query.limitType &&
5550
5652
  // Limit to last queries reverse the orderBy constraint that was
5551
5653
  // specified by the user. As such, we need to reverse the order of the
5552
5654
  // results to return the documents in the expected order.
5553
- r.reverse(), new er(t, r);
5655
+ r.reverse(), new or(t, r);
5554
5656
  }));
5555
5657
  }
5556
5658
 
5557
- function Pr(t, e, n) {
5558
- const r = Ir((t = ot(t, wn)).converter, e, n), s = Sn(Fn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5559
- return nn(un(t.firestore), [ s.toMutation(t._key, Re.none()) ]);
5659
+ function xr(t, e, n) {
5660
+ const r = Vr((t = ut(t, gn)).converter, e, n), s = Ln(Cn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5661
+ return rn(an(t.firestore), [ s.toMutation(t._key, Pe.none()) ]);
5560
5662
  }
5561
5663
 
5562
- function Vr(t, e, n, ...r) {
5563
- const s = Fn((t = ot(t, wn)).firestore);
5664
+ function Fr(t, e, n, ...r) {
5665
+ const s = Cn((t = ut(t, gn)).firestore);
5564
5666
  // For Compat types, we have to "extract" the underlying types before
5565
5667
  // performing validation.
5566
5668
  let i;
5567
- i = "string" == typeof (e = getModularInstance(e)) || e instanceof En ? jn(s, "updateDoc", t._key, e, n, r) : Un(s, "updateDoc", t._key, e);
5568
- return nn(un(t.firestore), [ i.toMutation(t._key, Re.exists(!0)) ]);
5669
+ i = "string" == typeof (e = getModularInstance(e)) || e instanceof Vn ? Wn(s, "updateDoc", t._key, e, n, r) : Gn(s, "updateDoc", t._key, e);
5670
+ return rn(an(t.firestore), [ i.toMutation(t._key, Pe.exists(!0)) ]);
5569
5671
  }
5570
5672
 
5571
5673
  /**
@@ -5579,8 +5681,8 @@ function Vr(t, e, n, ...r) {
5579
5681
  * @param reference - A reference to the document to delete.
5580
5682
  * @returns A `Promise` resolved once the document has been successfully
5581
5683
  * deleted from the backend.
5582
- */ function Nr(t) {
5583
- return nn(un((t = ot(t, wn)).firestore), [ new De(t._key, Re.none()) ]);
5684
+ */ function Sr(t) {
5685
+ return rn(an((t = ut(t, gn)).firestore), [ new $e(t._key, Pe.none()) ]);
5584
5686
  }
5585
5687
 
5586
5688
  /**
@@ -5597,9 +5699,58 @@ function Vr(t, e, n, ...r) {
5597
5699
  * @throws Error - If the provided input is not a valid Firestore document.
5598
5700
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
5599
5701
  * newly created document after it has been written to the backend.
5600
- */ function Dr(t, e) {
5601
- const n = gn(t = ot(t, pn)), r = Ir(t.converter, e), s = Sn(Fn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5602
- return nn(un(t.firestore), [ s.toMutation(n._key, Re.exists(!1)) ]).then((() => n));
5702
+ */ function qr(t, e) {
5703
+ const n = Tn(t = ut(t, bn)), r = Vr(t.converter, e), s = Ln(Cn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5704
+ return rn(an(t.firestore), [ s.toMutation(n._key, Pe.exists(!1)) ]).then((() => n));
5705
+ }
5706
+
5707
+ /**
5708
+ * @license
5709
+ * Copyright 2022 Google LLC
5710
+ *
5711
+ * Licensed under the Apache License, Version 2.0 (the "License");
5712
+ * you may not use this file except in compliance with the License.
5713
+ * You may obtain a copy of the License at
5714
+ *
5715
+ * http://www.apache.org/licenses/LICENSE-2.0
5716
+ *
5717
+ * Unless required by applicable law or agreed to in writing, software
5718
+ * distributed under the License is distributed on an "AS IS" BASIS,
5719
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5720
+ * See the License for the specific language governing permissions and
5721
+ * limitations under the License.
5722
+ */
5723
+ /**
5724
+ * Calculates the number of documents in the result set of the given query,
5725
+ * without actually downloading the documents.
5726
+ *
5727
+ * Using this function to count the documents is efficient because only the
5728
+ * final count, not the documents' data, is downloaded. This function can even
5729
+ * count the documents if the result set would be prohibitively large to
5730
+ * download entirely (e.g. thousands of documents).
5731
+ *
5732
+ * @param query - The query whose result set size to calculate.
5733
+ * @returns A Promise that will be resolved with the count; the count can be
5734
+ * retrieved from `snapshot.data().count`, where `snapshot` is the
5735
+ * `AggregateQuerySnapshot` to which the returned Promise resolves.
5736
+ */ function Or(t) {
5737
+ const e = ut(t.firestore, ln), n = an(e), r = new Nr(e);
5738
+ return new _n(t, n, r).run();
5739
+ }
5740
+
5741
+ /**
5742
+ * Compares two `AggregateQuerySnapshot` instances for equality.
5743
+ *
5744
+ * Two `AggregateQuerySnapshot` instances are considered "equal" if they have
5745
+ * underlying queries that compare equal, and the same data.
5746
+ *
5747
+ * @param left - The first `AggregateQuerySnapshot` to compare.
5748
+ * @param right - The second `AggregateQuerySnapshot` to compare.
5749
+ *
5750
+ * @returns `true` if the objects are "equal", as defined above, or `false`
5751
+ * otherwise.
5752
+ */ function kr(t, e) {
5753
+ return Rn(t.query, e.query) && deepEqual(t.data(), e.data());
5603
5754
  }
5604
5755
 
5605
5756
  /**
@@ -5621,15 +5772,15 @@ function Vr(t, e, n, ...r) {
5621
5772
  /**
5622
5773
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
5623
5774
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
5624
- */ function $r() {
5625
- return new qn("deleteField");
5775
+ */ function Cr() {
5776
+ return new Mn("deleteField");
5626
5777
  }
5627
5778
 
5628
5779
  /**
5629
5780
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
5630
5781
  * include a server-generated timestamp in the written data.
5631
- */ function xr() {
5632
- return new kn("serverTimestamp");
5782
+ */ function Lr() {
5783
+ return new jn("serverTimestamp");
5633
5784
  }
5634
5785
 
5635
5786
  /**
@@ -5643,10 +5794,10 @@ function Vr(t, e, n, ...r) {
5643
5794
  * @param elements - The elements to union into the array.
5644
5795
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5645
5796
  * `updateDoc()`.
5646
- */ function Fr(...t) {
5797
+ */ function Mr(...t) {
5647
5798
  // NOTE: We don't actually parse the data until it's used in set() or
5648
5799
  // update() since we'd need the Firestore instance to do this.
5649
- return new Cn("arrayUnion", t);
5800
+ return new Bn("arrayUnion", t);
5650
5801
  }
5651
5802
 
5652
5803
  /**
@@ -5659,10 +5810,10 @@ function Vr(t, e, n, ...r) {
5659
5810
  * @param elements - The elements to remove from the array.
5660
5811
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5661
5812
  * `updateDoc()`
5662
- */ function Sr(...t) {
5813
+ */ function Ur(...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 Ln("arrayRemove", t);
5816
+ return new Qn("arrayRemove", t);
5666
5817
  }
5667
5818
 
5668
5819
  /**
@@ -5683,8 +5834,8 @@ function Vr(t, e, n, ...r) {
5683
5834
  * @param n - The value to increment by.
5684
5835
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5685
5836
  * `updateDoc()`
5686
- */ function qr(t) {
5687
- return new Mn("increment", t);
5837
+ */ function jr(t) {
5838
+ return new zn("increment", t);
5688
5839
  }
5689
5840
 
5690
5841
  /**
@@ -5710,25 +5861,25 @@ function Vr(t, e, n, ...r) {
5710
5861
  * provides methods for adding writes to the write batch. None of the writes
5711
5862
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
5712
5863
  * called.
5713
- */ class Or {
5864
+ */ class Br {
5714
5865
  /** @hideconstructor */
5715
5866
  constructor(t, e) {
5716
5867
  this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
5717
- this._dataReader = Fn(t);
5868
+ this._dataReader = Cn(t);
5718
5869
  }
5719
5870
  set(t, e, n) {
5720
5871
  this._verifyNotCommitted();
5721
- const r = kr(t, this._firestore), s = Ir(r.converter, e, n), i = Sn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5722
- return this._mutations.push(i.toMutation(r._key, Re.none())), this;
5872
+ const r = Qr(t, this._firestore), s = Vr(r.converter, e, n), i = Ln(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5873
+ return this._mutations.push(i.toMutation(r._key, Pe.none())), this;
5723
5874
  }
5724
5875
  update(t, e, n, ...r) {
5725
5876
  this._verifyNotCommitted();
5726
- const s = kr(t, this._firestore);
5877
+ const s = Qr(t, this._firestore);
5727
5878
  // For Compat types, we have to "extract" the underlying types before
5728
5879
  // performing validation.
5729
5880
  let i;
5730
- return i = "string" == typeof (e = getModularInstance(e)) || e instanceof En ? jn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : Un(this._dataReader, "WriteBatch.update", s._key, e),
5731
- this._mutations.push(i.toMutation(s._key, Re.exists(!0))), this;
5881
+ return i = "string" == typeof (e = getModularInstance(e)) || e instanceof Vn ? Wn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : Gn(this._dataReader, "WriteBatch.update", s._key, e),
5882
+ this._mutations.push(i.toMutation(s._key, Pe.exists(!0))), this;
5732
5883
  }
5733
5884
  /**
5734
5885
  * Deletes the document referred to by the provided {@link DocumentReference}.
@@ -5737,8 +5888,8 @@ function Vr(t, e, n, ...r) {
5737
5888
  * @returns This `WriteBatch` instance. Used for chaining method calls.
5738
5889
  */ delete(t) {
5739
5890
  this._verifyNotCommitted();
5740
- const e = kr(t, this._firestore);
5741
- return this._mutations = this._mutations.concat(new De(e._key, Re.none())), this;
5891
+ const e = Qr(t, this._firestore);
5892
+ return this._mutations = this._mutations.concat(new $e(e._key, Pe.none())), this;
5742
5893
  }
5743
5894
  /**
5744
5895
  * Commits all of the writes in this write batch as a single atomic unit.
@@ -5755,12 +5906,12 @@ function Vr(t, e, n, ...r) {
5755
5906
  return this._verifyNotCommitted(), this._committed = !0, this._mutations.length > 0 ? this._commitHandler(this._mutations) : Promise.resolve();
5756
5907
  }
5757
5908
  _verifyNotCommitted() {
5758
- if (this._committed) throw new L(x, "A write batch can no longer be used after commit() has been called.");
5909
+ if (this._committed) throw new M(F, "A write batch can no longer be used after commit() has been called.");
5759
5910
  }
5760
5911
  }
5761
5912
 
5762
- function kr(t, e) {
5763
- if ((t = getModularInstance(t)).firestore !== e) throw new L(A, "Provided document reference is from a different Firestore instance.");
5913
+ function Qr(t, e) {
5914
+ if ((t = getModularInstance(t)).firestore !== e) throw new M(R, "Provided document reference is from a different Firestore instance.");
5764
5915
  return t;
5765
5916
  }
5766
5917
 
@@ -5776,9 +5927,9 @@ function kr(t, e) {
5776
5927
  *
5777
5928
  * @returns A `WriteBatch` that can be used to atomically execute multiple
5778
5929
  * writes.
5779
- */ function Cr(t) {
5780
- const e = un(t = ot(t, an));
5781
- return new Or(t, (t => nn(e, t)));
5930
+ */ function zr(t) {
5931
+ const e = an(t = ut(t, ln));
5932
+ return new Br(t, (t => rn(e, t)));
5782
5933
  }
5783
5934
 
5784
5935
  /**
@@ -5800,7 +5951,7 @@ function kr(t, e) {
5800
5951
  /**
5801
5952
  * Internal transaction object responsible for accumulating the mutations to
5802
5953
  * perform and the base versions for any documents read.
5803
- */ class Lr {
5954
+ */ class Gr {
5804
5955
  constructor(t) {
5805
5956
  this.datastore = t,
5806
5957
  // The version of each document that was read during this transaction.
@@ -5819,8 +5970,8 @@ function kr(t, e) {
5819
5970
  this.writtenDocs = new Set;
5820
5971
  }
5821
5972
  async lookup(t) {
5822
- if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new L(A, "Firestore transactions require all reads to be executed before all writes.");
5823
- const e = await rn(this.datastore, t);
5973
+ if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new M(R, "Firestore transactions require all reads to be executed before all writes.");
5974
+ const e = await sn(this.datastore, t);
5824
5975
  return e.forEach((t => this.recordVersion(t))), e;
5825
5976
  }
5826
5977
  set(t, e) {
@@ -5835,7 +5986,7 @@ function kr(t, e) {
5835
5986
  this.writtenDocs.add(t.toString());
5836
5987
  }
5837
5988
  delete(t) {
5838
- this.write(new De(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5989
+ this.write(new $e(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5839
5990
  }
5840
5991
  async commit() {
5841
5992
  if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
@@ -5847,22 +5998,22 @@ function kr(t, e) {
5847
5998
  // For each document that was read but not written to, we want to perform
5848
5999
  // a `verify` operation.
5849
6000
  t.forEach(((t, e) => {
5850
- const n = et.fromPath(e);
5851
- this.mutations.push(new $e(n, this.precondition(n)));
5852
- })), await nn(this.datastore, this.mutations), this.committed = !0;
6001
+ const n = nt.fromPath(e);
6002
+ this.mutations.push(new xe(n, this.precondition(n)));
6003
+ })), await rn(this.datastore, this.mutations), this.committed = !0;
5853
6004
  }
5854
6005
  recordVersion(t) {
5855
6006
  let e;
5856
6007
  if (t.isFoundDocument()) e = t.version; else {
5857
- if (!t.isNoDocument()) throw g();
6008
+ if (!t.isNoDocument()) throw v();
5858
6009
  // Represent a deleted doc using SnapshotVersion.min().
5859
- e = vt.min();
6010
+ e = bt.min();
5860
6011
  }
5861
6012
  const n = this.readVersions.get(t.key.toString());
5862
6013
  if (n) {
5863
6014
  if (!e.isEqual(n))
5864
6015
  // This transaction will fail no matter what.
5865
- throw new L(F, "Document version changed between two reads.");
6016
+ throw new M(S, "Document version changed between two reads.");
5866
6017
  } else this.readVersions.set(t.key.toString(), e);
5867
6018
  }
5868
6019
  /**
@@ -5870,7 +6021,7 @@ function kr(t, e) {
5870
6021
  * as a precondition, or no precondition if it was not read.
5871
6022
  */ precondition(t) {
5872
6023
  const e = this.readVersions.get(t.toString());
5873
- return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(vt.min()) ? Re.exists(!1) : Re.updateTime(e) : Re.none();
6024
+ return !this.writtenDocs.has(t.toString()) && e ? e.isEqual(bt.min()) ? Pe.exists(!1) : Pe.updateTime(e) : Pe.none();
5874
6025
  }
5875
6026
  /**
5876
6027
  * Returns the precondition for a document if the operation is an update.
@@ -5879,7 +6030,7 @@ function kr(t, e) {
5879
6030
  // The first time a document is written, we want to take into account the
5880
6031
  // read time and existence
5881
6032
  if (!this.writtenDocs.has(t.toString()) && e) {
5882
- if (e.isEqual(vt.min()))
6033
+ if (e.isEqual(bt.min()))
5883
6034
  // The document doesn't exist, so fail the transaction.
5884
6035
  // This has to be validated locally because you can't send a
5885
6036
  // precondition that a document does not exist without changing the
@@ -5889,13 +6040,13 @@ function kr(t, e) {
5889
6040
  // express that to the backend, we have to validate locally.
5890
6041
  // Note: this can change once we can send separate verify writes in the
5891
6042
  // transaction.
5892
- throw new L(A, "Can't update a document that doesn't exist.");
6043
+ throw new M(R, "Can't update a document that doesn't exist.");
5893
6044
  // Document exists, base precondition on document update time.
5894
- return Re.updateTime(e);
6045
+ return Pe.updateTime(e);
5895
6046
  }
5896
6047
  // Document was not read, so we just use the preconditions for a blind
5897
6048
  // update.
5898
- return Re.exists(!0);
6049
+ return Pe.exists(!0);
5899
6050
  }
5900
6051
  write(t) {
5901
6052
  this.ensureCommitNotCalled(), this.mutations.push(t);
@@ -5918,7 +6069,7 @@ function kr(t, e) {
5918
6069
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5919
6070
  * See the License for the specific language governing permissions and
5920
6071
  * limitations under the License.
5921
- */ const Mr = {
6072
+ */ const Wr = {
5922
6073
  maxAttempts: 5
5923
6074
  };
5924
6075
 
@@ -5942,17 +6093,17 @@ function kr(t, e) {
5942
6093
  * TransactionRunner encapsulates the logic needed to run and retry transactions
5943
6094
  * with backoff.
5944
6095
  */
5945
- class Ur {
6096
+ class Kr {
5946
6097
  constructor(t, e, n, r, s) {
5947
6098
  this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
5948
- this.deferred = s, this.Pt = n.maxAttempts, this.Vt = new tn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
6099
+ this.deferred = s, this.Pt = n.maxAttempts, this.Vt = new en(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5949
6100
  }
5950
6101
  /** Runs the transaction and sets the result on deferred. */ run() {
5951
6102
  this.Pt -= 1, this.Nt();
5952
6103
  }
5953
6104
  Nt() {
5954
6105
  this.Vt.J((async () => {
5955
- const t = new Lr(this.datastore), e = this.Dt(t);
6106
+ const t = new Gr(this.datastore), e = this.Dt(t);
5956
6107
  e && e.then((e => {
5957
6108
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
5958
6109
  this.deferred.resolve(e);
@@ -5967,7 +6118,7 @@ class Ur {
5967
6118
  Dt(t) {
5968
6119
  try {
5969
6120
  const e = this.updateFunction(t);
5970
- return !ct(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
6121
+ return !at(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5971
6122
  null);
5972
6123
  } catch (t) {
5973
6124
  // Do not retry errors thrown by user provided updateFunction.
@@ -5993,31 +6144,31 @@ class Ur {
5993
6144
  function(t) {
5994
6145
  switch (t) {
5995
6146
  default:
5996
- return g();
6147
+ return v();
5997
6148
 
5998
- case I:
5999
6149
  case T:
6000
- case R:
6001
- case $:
6002
- case O:
6150
+ case A:
6151
+ case P:
6152
+ case x:
6003
6153
  case k:
6154
+ case C:
6004
6155
  // Unauthenticated means something went wrong with our token and we need
6005
6156
  // to retry with new credentials which will happen automatically.
6006
- case D:
6157
+ case $:
6007
6158
  return !1;
6008
6159
 
6009
- case A:
6010
- case P:
6160
+ case R:
6011
6161
  case V:
6012
6162
  case N:
6013
- case x:
6163
+ case D:
6164
+ case F:
6014
6165
  // Aborted might be retried in some scenarios, but that is dependant on
6015
6166
  // the context and should handled individually by the calling code.
6016
6167
  // See https://cloud.google.com/apis/design/errors.
6017
- case F:
6018
- case S:
6168
+ case S:
6019
6169
  case q:
6020
- case C:
6170
+ case O:
6171
+ case L:
6021
6172
  return !0;
6022
6173
  }
6023
6174
  }(e);
@@ -6042,7 +6193,7 @@ class Ur {
6042
6193
  * See the License for the specific language governing permissions and
6043
6194
  * limitations under the License.
6044
6195
  */
6045
- /** The Platform's 'document' implementation or null if not available. */ function jr() {
6196
+ /** The Platform's 'document' implementation or null if not available. */ function Yr() {
6046
6197
  // `document` is not always available, e.g. in ReactNative and WebWorkers.
6047
6198
  // eslint-disable-next-line no-restricted-globals
6048
6199
  return "undefined" != typeof document ? document : null;
@@ -6074,10 +6225,10 @@ class Ur {
6074
6225
  * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
6075
6226
  * in newer versions of TypeScript defines `finally`, which is not available in
6076
6227
  * IE.
6077
- */ class Br {
6228
+ */ class Hr {
6078
6229
  constructor(t, e, n, r, s) {
6079
6230
  this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
6080
- this.deferred = new M, this.then = this.deferred.promise.then.bind(this.deferred.promise),
6231
+ this.deferred = new U, this.then = this.deferred.promise.then.bind(this.deferred.promise),
6081
6232
  // It's normal for the deferred promise to be canceled (due to cancellation)
6082
6233
  // and so we attach a dummy catch callback to avoid
6083
6234
  // 'UnhandledPromiseRejectionWarning' log spam.
@@ -6097,7 +6248,7 @@ class Ur {
6097
6248
  * PORTING NOTE: This exists to prevent making removeDelayedOperation() and
6098
6249
  * the DelayedOperation class public.
6099
6250
  */ static createAndSchedule(t, e, n, r, s) {
6100
- const i = Date.now() + n, o = new Br(t, e, i, r, s);
6251
+ const i = Date.now() + n, o = new Hr(t, e, i, r, s);
6101
6252
  return o.start(n), o;
6102
6253
  }
6103
6254
  /**
@@ -6119,7 +6270,7 @@ class Ur {
6119
6270
  * As long as the operation has not yet been run, calling cancel() provides a
6120
6271
  * guarantee that the operation will not be run.
6121
6272
  */ cancel(t) {
6122
- null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new L(I, "Operation cancelled" + (t ? ": " + t : ""))));
6273
+ null !== this.timerHandle && (this.clearTimeout(), this.deferred.reject(new M(T, "Operation cancelled" + (t ? ": " + t : ""))));
6123
6274
  }
6124
6275
  handleDelayElapsed() {
6125
6276
  this.asyncQueue.enqueueAndForget((() => null !== this.timerHandle ? (this.clearTimeout(),
@@ -6146,7 +6297,7 @@ class Ur {
6146
6297
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6147
6298
  * See the License for the specific language governing permissions and
6148
6299
  * limitations under the License.
6149
- */ class zr {
6300
+ */ class Jr {
6150
6301
  constructor() {
6151
6302
  // The last promise in the queue.
6152
6303
  this.Ft = Promise.resolve(),
@@ -6169,15 +6320,15 @@ class Ur {
6169
6320
  // List of TimerIds to fast-forward delays for.
6170
6321
  this.Mt = [],
6171
6322
  // Backoff timer used to schedule retries for retryable operations
6172
- this.Vt = new tn(this, "async_queue_retry" /* AsyncQueueRetry */),
6323
+ this.Vt = new en(this, "async_queue_retry" /* AsyncQueueRetry */),
6173
6324
  // Visibility handler that triggers an immediate retry of all retryable
6174
6325
  // operations. Meant to speed up recovery when we regain file system access
6175
6326
  // after page comes into foreground.
6176
6327
  this.Ut = () => {
6177
- const t = jr();
6178
- t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Vt.Z();
6328
+ const t = Yr();
6329
+ t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.Vt.Z();
6179
6330
  };
6180
- const t = jr();
6331
+ const t = Yr();
6181
6332
  t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ut);
6182
6333
  }
6183
6334
  get isShuttingDown() {
@@ -6198,7 +6349,7 @@ class Ur {
6198
6349
  enterRestrictedMode(t) {
6199
6350
  if (!this.qt) {
6200
6351
  this.qt = !0, this.Lt = t || !1;
6201
- const e = jr();
6352
+ const e = Yr();
6202
6353
  e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ut);
6203
6354
  }
6204
6355
  }
@@ -6209,17 +6360,17 @@ class Ur {
6209
6360
  // Create a deferred Promise that we can return to the callee. This
6210
6361
  // allows us to return a "hanging Promise" only to the callee and still
6211
6362
  // advance the queue even when the operation is not run.
6212
- const e = new M;
6363
+ const e = new U;
6213
6364
  return this.Bt((() => this.qt && this.Lt ? Promise.resolve() : (t().then(e.resolve, e.reject),
6214
6365
  e.promise))).then((() => e.promise));
6215
6366
  }
6216
6367
  enqueueRetryable(t) {
6217
- this.enqueueAndForget((() => (this.St.push(t), this.zt())));
6368
+ this.enqueueAndForget((() => (this.St.push(t), this.Qt())));
6218
6369
  }
6219
6370
  /**
6220
6371
  * Runs the next operation from the retryable queue. If the operation fails,
6221
6372
  * reschedules with backoff.
6222
- */ async zt() {
6373
+ */ async Qt() {
6223
6374
  if (0 !== this.St.length) {
6224
6375
  try {
6225
6376
  await this.St[0](), this.St.shift(), this.Vt.reset();
@@ -6264,7 +6415,7 @@ class Ur {
6264
6415
  * limitations under the License.
6265
6416
  */ (t)) throw t;
6266
6417
  // Failure will be handled by AsyncQueue
6267
- m("AsyncQueue", "Operation failed with retryable error: " + t);
6418
+ p("AsyncQueue", "Operation failed with retryable error: " + t);
6268
6419
  }
6269
6420
  this.St.length > 0 &&
6270
6421
  // If there are additional operations, we re-schedule `retryNextOp()`.
@@ -6277,7 +6428,7 @@ class Ur {
6277
6428
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
6278
6429
  // new backoff on every call, there is only ever a single additional
6279
6430
  // operation in the queue.
6280
- this.Vt.J((() => this.zt()));
6431
+ this.Vt.J((() => this.Qt()));
6281
6432
  }
6282
6433
  }
6283
6434
  Bt(t) {
@@ -6322,7 +6473,7 @@ class Ur {
6322
6473
  // Re-throw the error so that this.tail becomes a rejected Promise and
6323
6474
  // all further attempts to chain (via .then) will just short-circuit
6324
6475
  // and return the rejected Promise.
6325
- throw p("INTERNAL UNHANDLED ERROR: ", e), t;
6476
+ throw y("INTERNAL UNHANDLED ERROR: ", e), t;
6326
6477
  })).then((t => (this.Ct = !1, t))))));
6327
6478
  return this.Ft = e, e;
6328
6479
  }
@@ -6330,17 +6481,17 @@ class Ur {
6330
6481
  this.jt(),
6331
6482
  // Fast-forward delays for timerIds that have been overriden.
6332
6483
  this.Mt.indexOf(t) > -1 && (e = 0);
6333
- const r = Br.createAndSchedule(this, t, e, n, (t => this.Gt(t)));
6484
+ const r = Hr.createAndSchedule(this, t, e, n, (t => this.zt(t)));
6334
6485
  return this.Ot.push(r), r;
6335
6486
  }
6336
6487
  jt() {
6337
- this.kt && g();
6488
+ this.kt && v();
6338
6489
  }
6339
6490
  verifyOperationInProgress() {}
6340
6491
  /**
6341
6492
  * Waits until all currently queued tasks are finished executing. Delayed
6342
6493
  * operations are not run.
6343
- */ async Qt() {
6494
+ */ async Gt() {
6344
6495
  // Operations in the queue prior to draining may have enqueued additional
6345
6496
  // operations. Keep draining the queue until the tail is no longer advanced,
6346
6497
  // which indicates that no more new operations were enqueued and that all
@@ -6365,11 +6516,11 @@ class Ur {
6365
6516
  * @returns a Promise that resolves once all operations have been run.
6366
6517
  */ Kt(t) {
6367
6518
  // Note that draining may generate more delayed ops, so we do that first.
6368
- return this.Qt().then((() => {
6519
+ return this.Gt().then((() => {
6369
6520
  // Run ops in the same order they'd run if they ran naturally.
6370
6521
  this.Ot.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
6371
6522
  for (const e of this.Ot) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
6372
- return this.Qt();
6523
+ return this.Gt();
6373
6524
  }));
6374
6525
  }
6375
6526
  /**
@@ -6377,17 +6528,17 @@ class Ur {
6377
6528
  */ Yt(t) {
6378
6529
  this.Mt.push(t);
6379
6530
  }
6380
- /** Called once a DelayedOperation is run or canceled. */ Gt(t) {
6531
+ /** Called once a DelayedOperation is run or canceled. */ zt(t) {
6381
6532
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
6382
6533
  const e = this.Ot.indexOf(t);
6383
6534
  this.Ot.splice(e, 1);
6384
6535
  }
6385
6536
  }
6386
6537
 
6387
- class Gr {
6538
+ class Xr {
6388
6539
  /** @hideconstructor */
6389
6540
  constructor(t, e) {
6390
- this._firestore = t, this._transaction = e, this._dataReader = Fn(t);
6541
+ this._firestore = t, this._transaction = e, this._dataReader = Cn(t);
6391
6542
  }
6392
6543
  /**
6393
6544
  * Reads the document referenced by the provided {@link DocumentReference}.
@@ -6395,25 +6546,25 @@ class Gr {
6395
6546
  * @param documentRef - A reference to the document to be read.
6396
6547
  * @returns A `DocumentSnapshot` with the read data.
6397
6548
  */ get(t) {
6398
- const e = kr(t, this._firestore), n = new Tr(this._firestore);
6549
+ const e = Qr(t, this._firestore), n = new Nr(this._firestore);
6399
6550
  return this._transaction.lookup([ e._key ]).then((t => {
6400
- if (!t || 1 !== t.length) return g();
6551
+ if (!t || 1 !== t.length) return v();
6401
6552
  const r = t[0];
6402
- if (r.isFoundDocument()) return new Zn(this._firestore, n, r.key, r, e.converter);
6403
- if (r.isNoDocument()) return new Zn(this._firestore, n, e._key, null, e.converter);
6404
- throw g();
6553
+ if (r.isFoundDocument()) return new sr(this._firestore, n, r.key, r, e.converter);
6554
+ if (r.isNoDocument()) return new sr(this._firestore, n, e._key, null, e.converter);
6555
+ throw v();
6405
6556
  }));
6406
6557
  }
6407
6558
  set(t, e, n) {
6408
- const r = kr(t, this._firestore), s = Ir(r.converter, e, n), i = Sn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
6559
+ const r = Qr(t, this._firestore), s = Vr(r.converter, e, n), i = Ln(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
6409
6560
  return this._transaction.set(r._key, i), this;
6410
6561
  }
6411
6562
  update(t, e, n, ...r) {
6412
- const s = kr(t, this._firestore);
6563
+ const s = Qr(t, this._firestore);
6413
6564
  // For Compat types, we have to "extract" the underlying types before
6414
6565
  // performing validation.
6415
6566
  let i;
6416
- return i = "string" == typeof (e = getModularInstance(e)) || e instanceof En ? jn(this._dataReader, "Transaction.update", s._key, e, n, r) : Un(this._dataReader, "Transaction.update", s._key, e),
6567
+ return i = "string" == typeof (e = getModularInstance(e)) || e instanceof Vn ? Wn(this._dataReader, "Transaction.update", s._key, e, n, r) : Gn(this._dataReader, "Transaction.update", s._key, e),
6417
6568
  this._transaction.update(s._key, i), this;
6418
6569
  }
6419
6570
  /**
@@ -6422,7 +6573,7 @@ class Gr {
6422
6573
  * @param documentRef - A reference to the document to be deleted.
6423
6574
  * @returns This `Transaction` instance. Used for chaining method calls.
6424
6575
  */ delete(t) {
6425
- const e = kr(t, this._firestore);
6576
+ const e = Qr(t, this._firestore);
6426
6577
  return this._transaction.delete(e._key), this;
6427
6578
  }
6428
6579
  }
@@ -6445,13 +6596,13 @@ class Gr {
6445
6596
  * (the `updateFunction` returned a failed promise), the promise returned by the
6446
6597
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
6447
6598
  * rejected promise with the corresponding failure error is returned.
6448
- */ function Qr(t, e, n) {
6449
- const r = un(t = ot(t, an)), s = Object.assign(Object.assign({}, Mr), n);
6599
+ */ function Zr(t, e, n) {
6600
+ const r = an(t = ut(t, ln)), s = Object.assign(Object.assign({}, Wr), n);
6450
6601
  !function(t) {
6451
- if (t.maxAttempts < 1) throw new L(A, "Max attempts must be at least 1");
6602
+ if (t.maxAttempts < 1) throw new M(R, "Max attempts must be at least 1");
6452
6603
  }(s);
6453
- const i = new M;
6454
- return new Ur(new zr, r, s, (n => e(new Gr(t, n))), i).run(), i.promise;
6604
+ const i = new U;
6605
+ return new Kr(new Jr, r, s, (n => e(new Xr(t, n))), i).run(), i.promise;
6455
6606
  }
6456
6607
 
6457
6608
  /**
@@ -6462,11 +6613,11 @@ class Gr {
6462
6613
  * directly to the backend, and `onSnapshot()` APIs are not supported.
6463
6614
  * @packageDocumentation
6464
6615
  */ !function(t) {
6465
- f = t;
6616
+ d = t;
6466
6617
  }(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {instanceIdentifier: e, options: n}) => {
6467
- const r = t.getProvider("app").getImmediate(), s = new an(new z(t.getProvider("auth-internal")), new K(t.getProvider("app-check-internal")), function(t, e) {
6468
- if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new L(A, '"projectId" not provided in firebase.initializeApp.');
6469
- return new H(t.options.projectId, e);
6618
+ const r = t.getProvider("app").getImmediate(), s = new ln(new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")), function(t, e) {
6619
+ if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new M(R, '"projectId" not provided in firebase.initializeApp.');
6620
+ return new J(t.options.projectId, e);
6470
6621
  }
6471
6622
  /**
6472
6623
  * @license
@@ -6487,7 +6638,7 @@ class Gr {
6487
6638
  return n && s._setSettings(n), s;
6488
6639
  }), "PUBLIC").setMultipleInstances(!0)),
6489
6640
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
6490
- registerVersion("firestore-lite", "3.5.0-canary.e35db6f95", ""), registerVersion("firestore-lite", "3.5.0-canary.e35db6f95", "esm2017");
6641
+ registerVersion("firestore-lite", "3.5.0-canary.ee871fc0b", ""), registerVersion("firestore-lite", "3.5.0-canary.ee871fc0b", "esm2017");
6491
6642
 
6492
- export { Tn as Bytes, pn as CollectionReference, wn as DocumentReference, Zn as DocumentSnapshot, En as FieldPath, An as FieldValue, an as Firestore, L as FirestoreError, Rn as GeoPoint, mn as Query, sr as QueryConstraint, tr as QueryDocumentSnapshot, er as QuerySnapshot, gt as Timestamp, Gr as Transaction, Or as WriteBatch, Dr as addDoc, Sr as arrayRemove, Fr as arrayUnion, yn as collection, _n as collectionGroup, fn as connectFirestoreEmulator, Nr as deleteDoc, $r as deleteField, gn as doc, In as documentId, _r as endAt, yr as endBefore, Ar as getDoc, Rr as getDocs, ln as getFirestore, qr as increment, hn as initializeFirestore, lr as limit, fr as limitToLast, ar as orderBy, ir as query, bn as queryEqual, vn as refEqual, Qr as runTransaction, xr as serverTimestamp, Pr as setDoc, w as setLogLevel, nr as snapshotEqual, mr as startAfter, wr as startAt, dn as terminate, Vr as updateDoc, ur as where, Cr as writeBatch };
6643
+ export { pn as AggregateField, yn as AggregateQuerySnapshot, Pn as Bytes, bn as CollectionReference, gn as DocumentReference, sr as DocumentSnapshot, Vn as FieldPath, Dn as FieldValue, ln as Firestore, M as FirestoreError, $n as GeoPoint, vn as Query, ar as QueryConstraint, ir as QueryDocumentSnapshot, or as QuerySnapshot, vt as Timestamp, Xr as Transaction, Br as WriteBatch, qr as addDoc, kr as aggregateQuerySnapshotEqual, Ur as arrayRemove, Mr as arrayUnion, En as collection, In as collectionGroup, wn as connectFirestoreEmulator, Sr as deleteDoc, Cr as deleteField, Tn as doc, Nn as documentId, Ir as endAt, Er as endBefore, Or as getCount, Dr as getDoc, $r as getDocs, dn as getFirestore, jr as increment, fn as initializeFirestore, pr as limit, yr as limitToLast, wr as orderBy, hr as query, Rn as queryEqual, An as refEqual, Zr as runTransaction, Lr as serverTimestamp, xr as setDoc, m as setLogLevel, ur as snapshotEqual, vr as startAfter, gr as startAt, mn as terminate, Fr as updateDoc, fr as where, zr as writeBatch };
6493
6644
  //# sourceMappingURL=index.browser.esm2017.js.map