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

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