@firebase/firestore 3.4.8-canary.aa41fd662 → 3.4.8-canary.adb9aaa34

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 (77) hide show
  1. package/dist/firestore/lite/index.d.ts +1 -0
  2. package/dist/firestore/src/api/transaction.d.ts +2 -1
  3. package/dist/firestore/src/api/transaction_options.d.ts +17 -0
  4. package/dist/firestore/src/api.d.ts +1 -0
  5. package/dist/firestore/src/core/firestore_client.d.ts +2 -1
  6. package/dist/firestore/src/core/target.d.ts +4 -4
  7. package/dist/firestore/src/core/transaction_options.d.ts +25 -0
  8. package/dist/firestore/src/core/transaction_runner.d.ts +3 -2
  9. package/dist/firestore/src/lite-api/transaction.d.ts +2 -1
  10. package/dist/firestore/src/lite-api/transaction_options.d.ts +23 -0
  11. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
  12. package/dist/firestore/src/model/values.d.ts +14 -2
  13. package/dist/index.d.ts +24 -1
  14. package/dist/index.esm2017.js +1368 -1327
  15. package/dist/index.esm2017.js.map +1 -1
  16. package/dist/index.esm5.js +2335 -2296
  17. package/dist/index.esm5.js.map +1 -1
  18. package/dist/index.node.cjs.js +80 -62
  19. package/dist/index.node.cjs.js.map +1 -1
  20. package/dist/index.node.mjs +80 -62
  21. package/dist/index.node.mjs.map +1 -1
  22. package/dist/index.rn.js +1396 -1355
  23. package/dist/index.rn.js.map +1 -1
  24. package/dist/internal.d.ts +25 -1
  25. package/dist/lite/firestore/lite/index.d.ts +1 -0
  26. package/dist/lite/firestore/src/api/transaction.d.ts +2 -1
  27. package/dist/lite/firestore/src/api/transaction_options.d.ts +17 -0
  28. package/dist/lite/firestore/src/api.d.ts +1 -0
  29. package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -1
  30. package/dist/lite/firestore/src/core/target.d.ts +4 -4
  31. package/dist/lite/firestore/src/core/transaction_options.d.ts +25 -0
  32. package/dist/lite/firestore/src/core/transaction_runner.d.ts +3 -2
  33. package/dist/lite/firestore/src/lite-api/transaction.d.ts +2 -1
  34. package/dist/lite/firestore/src/lite-api/transaction_options.d.ts +23 -0
  35. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
  36. package/dist/lite/firestore/src/model/values.d.ts +14 -2
  37. package/dist/lite/index.browser.esm2017.js +613 -580
  38. package/dist/lite/index.browser.esm2017.js.map +1 -1
  39. package/dist/lite/index.browser.esm5.js +580 -568
  40. package/dist/lite/index.browser.esm5.js.map +1 -1
  41. package/dist/lite/index.d.ts +24 -1
  42. package/dist/lite/index.node.cjs.js +53 -10
  43. package/dist/lite/index.node.cjs.js.map +1 -1
  44. package/dist/lite/index.node.mjs +53 -10
  45. package/dist/lite/index.node.mjs.map +1 -1
  46. package/dist/lite/index.rn.esm2017.js +1275 -1242
  47. package/dist/lite/index.rn.esm2017.js.map +1 -1
  48. package/dist/lite/internal.d.ts +25 -1
  49. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +94 -94
  50. package/dist/lite/packages/firestore/lite/index.d.ts +1 -0
  51. package/dist/lite/packages/firestore/src/api/transaction.d.ts +2 -1
  52. package/dist/lite/packages/firestore/src/api/transaction_options.d.ts +17 -0
  53. package/dist/lite/packages/firestore/src/api.d.ts +1 -0
  54. package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -1
  55. package/dist/lite/packages/firestore/src/core/target.d.ts +4 -4
  56. package/dist/lite/packages/firestore/src/core/transaction_options.d.ts +25 -0
  57. package/dist/lite/packages/firestore/src/core/transaction_runner.d.ts +3 -2
  58. package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +2 -1
  59. package/dist/lite/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
  60. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
  61. package/dist/lite/packages/firestore/src/model/values.d.ts +14 -2
  62. package/dist/lite/private.d.ts +25 -1
  63. package/dist/packages/firestore/dist/index.esm2017.d.ts +76 -75
  64. package/dist/packages/firestore/lite/index.d.ts +1 -0
  65. package/dist/packages/firestore/src/api/transaction.d.ts +2 -1
  66. package/dist/packages/firestore/src/api/transaction_options.d.ts +17 -0
  67. package/dist/packages/firestore/src/api.d.ts +1 -0
  68. package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -1
  69. package/dist/packages/firestore/src/core/target.d.ts +4 -4
  70. package/dist/packages/firestore/src/core/transaction_options.d.ts +25 -0
  71. package/dist/packages/firestore/src/core/transaction_runner.d.ts +3 -2
  72. package/dist/packages/firestore/src/lite-api/transaction.d.ts +2 -1
  73. package/dist/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
  74. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
  75. package/dist/packages/firestore/src/model/values.d.ts +14 -2
  76. package/dist/private.d.ts +25 -1
  77. package/package.json +10 -10
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
63
63
  * See the License for the specific language governing permissions and
64
64
  * limitations under the License.
65
65
  */
66
- let f = "9.6.11-canary.aa41fd662";
66
+ let f = "9.7.0-canary.adb9aaa34";
67
67
 
68
68
  /**
69
69
  * @license
@@ -190,14 +190,14 @@ function p(t, ...e) {
190
190
  * given message if it did.
191
191
  *
192
192
  * Messages are stripped in production builds.
193
- */ function v(t, e) {
193
+ */ function b(t, e) {
194
194
  t || g();
195
195
  }
196
196
 
197
197
  /**
198
198
  * Casts `obj` to `T`. In non-production builds, verifies that `obj` is an
199
199
  * instance of `T` before casting.
200
- */ function b(t,
200
+ */ function v(t,
201
201
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
202
202
  e) {
203
203
  return t;
@@ -218,7 +218,7 @@ e) {
218
218
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
219
219
  * See the License for the specific language governing permissions and
220
220
  * limitations under the License.
221
- */ const E = "ok", T = "cancelled", I = "unknown", A = "invalid-argument", R = "deadline-exceeded", P = "not-found", V = "already-exists", D = "permission-denied", N = "unauthenticated", $ = "resource-exhausted", S = "failed-precondition", F = "aborted", x = "out-of-range", q = "unimplemented", O = "internal", C = "unavailable", L = "data-loss";
221
+ */ const E = "ok", T = "cancelled", A = "unknown", I = "invalid-argument", R = "deadline-exceeded", P = "not-found", V = "already-exists", D = "permission-denied", N = "unauthenticated", $ = "resource-exhausted", S = "failed-precondition", x = "aborted", F = "out-of-range", q = "unimplemented", O = "internal", C = "unavailable", L = "data-loss";
222
222
 
223
223
  /** An error returned by a Firestore operation. */ class U extends FirebaseError {
224
224
  /** @hideconstructor */
@@ -332,7 +332,7 @@ e) {
332
332
  }));
333
333
  }
334
334
  getToken() {
335
- return this.auth ? this.auth.getToken().then((t => t ? (v("string" == typeof t.accessToken),
335
+ return this.auth ? this.auth.getToken().then((t => t ? (b("string" == typeof t.accessToken),
336
336
  new j(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
337
337
  }
338
338
  invalidateToken() {}
@@ -386,7 +386,7 @@ class W {
386
386
  }));
387
387
  }
388
388
  getToken() {
389
- return this.appCheck ? this.appCheck.getToken().then((t => t ? (v("string" == typeof t.token),
389
+ return this.appCheck ? this.appCheck.getToken().then((t => t ? (b("string" == typeof t.token),
390
390
  new W(t.token)) : null)) : Promise.resolve(null);
391
391
  }
392
392
  invalidateToken() {}
@@ -570,7 +570,7 @@ class J {
570
570
  // for legacy reasons and should not be used frequently).
571
571
  const e = [];
572
572
  for (const n of t) {
573
- if (n.indexOf("//") >= 0) throw new U(A, `Invalid segment (${n}). Paths must not contain // in them.`);
573
+ if (n.indexOf("//") >= 0) throw new U(I, `Invalid segment (${n}). Paths must not contain // in them.`);
574
574
  // Strip leading and traling slashed.
575
575
  e.push(...n.split("/").filter((t => t.length > 0)));
576
576
  }
@@ -626,20 +626,20 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
626
626
  const e = [];
627
627
  let n = "", r = 0;
628
628
  const s = () => {
629
- if (0 === n.length) throw new U(A, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
629
+ if (0 === n.length) throw new U(I, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
630
630
  e.push(n), n = "";
631
631
  };
632
632
  let i = !1;
633
633
  for (;r < t.length; ) {
634
634
  const e = t[r];
635
635
  if ("\\" === e) {
636
- if (r + 1 === t.length) throw new U(A, "Path has trailing escape character: " + t);
636
+ if (r + 1 === t.length) throw new U(I, "Path has trailing escape character: " + t);
637
637
  const e = t[r + 1];
638
- if ("\\" !== e && "." !== e && "`" !== e) throw new U(A, "Path has invalid escape sequence: " + t);
638
+ if ("\\" !== e && "." !== e && "`" !== e) throw new U(I, "Path has invalid escape sequence: " + t);
639
639
  n += e, r += 2;
640
640
  } else "`" === e ? (i = !i, r++) : "." !== e || i ? (n += e, r++) : (s(), r++);
641
641
  }
642
- if (s(), i) throw new U(A, "Unterminated ` in path: " + t);
642
+ if (s(), i) throw new U(I, "Unterminated ` in path: " + t);
643
643
  return new tt(e);
644
644
  }
645
645
  static emptyPath() {
@@ -728,7 +728,7 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
728
728
  * See the License for the specific language governing permissions and
729
729
  * limitations under the License.
730
730
  */ function nt(t, e, n) {
731
- if (!n) throw new U(A, `Function ${t}() cannot be called with an empty ${e}.`);
731
+ if (!n) throw new U(I, `Function ${t}() cannot be called with an empty ${e}.`);
732
732
  }
733
733
 
734
734
  /**
@@ -740,14 +740,14 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
740
740
  * an even numbers of segments).
741
741
  */
742
742
  function rt(t) {
743
- if (!et.isDocumentKey(t)) throw new U(A, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
743
+ if (!et.isDocumentKey(t)) throw new U(I, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
744
744
  }
745
745
 
746
746
  /**
747
747
  * Validates that `path` refers to a collection (indicated by the fact it
748
748
  * contains an odd numbers of segments).
749
749
  */ function st(t) {
750
- if (et.isDocumentKey(t)) throw new U(A, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
750
+ if (et.isDocumentKey(t)) throw new U(I, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
751
751
  }
752
752
 
753
753
  /**
@@ -791,17 +791,17 @@ e) {
791
791
  // Unwrap Compat types
792
792
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
793
793
  t = t._delegate), !(t instanceof e)) {
794
- if (e.name === t.constructor.name) throw new U(A, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
794
+ if (e.name === t.constructor.name) throw new U(I, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
795
795
  {
796
796
  const n = it(t);
797
- throw new U(A, `Expected type '${e.name}', but it was: ${n}`);
797
+ throw new U(I, `Expected type '${e.name}', but it was: ${n}`);
798
798
  }
799
799
  }
800
800
  return t;
801
801
  }
802
802
 
803
803
  function ut(t, e) {
804
- if (e <= 0) throw new U(A, `Function ${t}() requires a positive number, but it was: ${e}.`);
804
+ if (e <= 0) throw new U(I, `Function ${t}() requires a positive number, but it was: ${e}.`);
805
805
  }
806
806
 
807
807
  /**
@@ -822,11 +822,11 @@ function ut(t, e) {
822
822
  */
823
823
  /**
824
824
  * Returns whether a variable is either undefined or null.
825
- */ function ct(t) {
825
+ */ function at(t) {
826
826
  return null == t;
827
827
  }
828
828
 
829
- /** Returns whether the value represents -0. */ function at(t) {
829
+ /** Returns whether the value represents -0. */ function ct(t) {
830
830
  // Detect if the value is -0.0. Based on polyfill from
831
831
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
832
832
  return 0 === t && 1 / t == -1 / 0;
@@ -899,7 +899,7 @@ var lt, ft;
899
899
  * Code.UNKNOWN.
900
900
  */
901
901
  function dt(t) {
902
- if (void 0 === t) return p("RPC_ERROR", "HTTP error has no status"), I;
902
+ if (void 0 === t) return p("RPC_ERROR", "HTTP error has no status"), A;
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.
@@ -932,13 +932,13 @@ function dt(t) {
932
932
 
933
933
  case 409:
934
934
  // Conflict
935
- return F;
935
+ return x;
936
936
 
937
937
  // Other possibilities:
938
938
  // return Code.ALREADY_EXISTS;
939
939
  case 416:
940
940
  // Range Not Satisfiable
941
- return x;
941
+ return F;
942
942
 
943
943
  case 429:
944
944
  // Too Many Requests
@@ -950,7 +950,7 @@ function dt(t) {
950
950
 
951
951
  case 500:
952
952
  // Internal Server Error
953
- return I;
953
+ return A;
954
954
 
955
955
  // Other possibilities:
956
956
  // return Code.INTERNAL;
@@ -968,7 +968,7 @@ function dt(t) {
968
968
  return R;
969
969
 
970
970
  default:
971
- return t >= 200 && t < 300 ? E : t >= 400 && t < 500 ? S : t >= 500 && t < 600 ? O : I;
971
+ return t >= 200 && t < 300 ? E : t >= 400 && t < 500 ? S : t >= 500 && t < 600 ? O : A;
972
972
  }
973
973
  }
974
974
 
@@ -1048,16 +1048,16 @@ class {
1048
1048
  * @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
1049
1049
  */
1050
1050
  constructor(t, e) {
1051
- super(t), this.I = e;
1051
+ super(t), this.A = e;
1052
1052
  }
1053
- A(t, e) {
1053
+ I(t, e) {
1054
1054
  throw new Error("Not supported by FetchConnection");
1055
1055
  }
1056
1056
  async v(t, e, n, r) {
1057
1057
  const s = JSON.stringify(r);
1058
1058
  let i;
1059
1059
  try {
1060
- i = await this.I(e, {
1060
+ i = await this.A(e, {
1061
1061
  method: "POST",
1062
1062
  headers: n,
1063
1063
  body: s
@@ -1211,11 +1211,11 @@ class gt {
1211
1211
  * The fractions of a second at nanosecond resolution.*
1212
1212
  */
1213
1213
  e) {
1214
- if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(A, "Timestamp nanoseconds out of range: " + e);
1215
- if (e >= 1e9) throw new U(A, "Timestamp nanoseconds out of range: " + e);
1216
- if (t < -62135596800) throw new U(A, "Timestamp seconds out of range: " + t);
1214
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(I, "Timestamp nanoseconds out of range: " + e);
1215
+ if (e >= 1e9) throw new U(I, "Timestamp nanoseconds out of range: " + e);
1216
+ if (t < -62135596800) throw new U(I, "Timestamp seconds out of range: " + t);
1217
1217
  // This will break in the year 10,000.
1218
- if (t >= 253402300800) throw new U(A, "Timestamp seconds out of range: " + t);
1218
+ if (t >= 253402300800) throw new U(I, "Timestamp seconds out of range: " + t);
1219
1219
  }
1220
1220
  /**
1221
1221
  * Creates a new timestamp with the current date, with millisecond precision.
@@ -1320,18 +1320,18 @@ class gt {
1320
1320
  /**
1321
1321
  * A version of a document in Firestore. This corresponds to the version
1322
1322
  * timestamp, such as update_time or read_time.
1323
- */ class vt {
1323
+ */ class bt {
1324
1324
  constructor(t) {
1325
1325
  this.timestamp = t;
1326
1326
  }
1327
1327
  static fromTimestamp(t) {
1328
- return new vt(t);
1328
+ return new bt(t);
1329
1329
  }
1330
1330
  static min() {
1331
- return new vt(new gt(0, 0));
1331
+ return new bt(new gt(0, 0));
1332
1332
  }
1333
1333
  static max() {
1334
- return new vt(new gt(253402300799, 999999999));
1334
+ return new bt(new gt(253402300799, 999999999));
1335
1335
  }
1336
1336
  compareTo(t) {
1337
1337
  return this.timestamp._compareTo(t.timestamp);
@@ -1366,7 +1366,7 @@ class gt {
1366
1366
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1367
1367
  * See the License for the specific language governing permissions and
1368
1368
  * limitations under the License.
1369
- */ function bt(t) {
1369
+ */ function vt(t) {
1370
1370
  let e = 0;
1371
1371
  for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
1372
1372
  return e;
@@ -1465,13 +1465,13 @@ class Tt {
1465
1465
  * before being sent as a proto.
1466
1466
  * @internal
1467
1467
  */
1468
- class It {
1468
+ class At {
1469
1469
  constructor(t) {
1470
1470
  this.binaryString = t;
1471
1471
  }
1472
1472
  static fromBase64String(t) {
1473
1473
  const e = atob(t);
1474
- return new It(e);
1474
+ return new At(e);
1475
1475
  }
1476
1476
  static fromUint8Array(t) {
1477
1477
  // TODO(indexing); Remove the copy of the byte string here as this method
@@ -1488,7 +1488,7 @@ class It {
1488
1488
  /**
1489
1489
  * Helper function to convert a binary string to an Uint8Array.
1490
1490
  */ (t);
1491
- return new It(e);
1491
+ return new At(e);
1492
1492
  }
1493
1493
  [Symbol.iterator]() {
1494
1494
  let t = 0;
@@ -1543,9 +1543,9 @@ class It {
1543
1543
  }
1544
1544
  }
1545
1545
 
1546
- It.EMPTY_BYTE_STRING = new It("");
1546
+ At.EMPTY_BYTE_STRING = new At("");
1547
1547
 
1548
- const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1548
+ const It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1549
1549
 
1550
1550
  /**
1551
1551
  * Converts the possible Proto values for a timestamp value into a "seconds and
@@ -1554,13 +1554,13 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1554
1554
  // The json interface (for the browser) will return an iso timestamp string,
1555
1555
  // while the proto js library (for node) will return a
1556
1556
  // google.protobuf.Timestamp instance.
1557
- if (v(!!t), "string" == typeof t) {
1557
+ if (b(!!t), "string" == typeof t) {
1558
1558
  // The date string can have higher precision (nanos) than the Date class
1559
1559
  // (millis), so we do some custom parsing here.
1560
1560
  // Parse the nanos right out of the string.
1561
1561
  let e = 0;
1562
- const n = At.exec(t);
1563
- if (v(!!n), n[1]) {
1562
+ const n = It.exec(t);
1563
+ if (b(!!n), n[1]) {
1564
1564
  // Pad the fraction out to 9 digits (nanos).
1565
1565
  let t = n[1];
1566
1566
  t = (t + "000000000").substr(0, 9), e = Number(t);
@@ -1587,7 +1587,7 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1587
1587
  }
1588
1588
 
1589
1589
  /** Converts the possible Proto types for Blobs into a ByteString. */ function Vt(t) {
1590
- return "string" == typeof t ? It.fromBase64String(t) : It.fromUint8Array(t);
1590
+ return "string" == typeof t ? At.fromBase64String(t) : At.fromUint8Array(t);
1591
1591
  }
1592
1592
 
1593
1593
  /**
@@ -1660,9 +1660,16 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1660
1660
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1661
1661
  * See the License for the specific language governing permissions and
1662
1662
  * limitations under the License.
1663
- */
1663
+ */ const St = {
1664
+ fields: {
1665
+ __type__: {
1666
+ stringValue: "__max__"
1667
+ }
1668
+ }
1669
+ };
1670
+
1664
1671
  /** Extracts the backend's type order for the provided value. */
1665
- function St(t) {
1672
+ function xt(t) {
1666
1673
  return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Dt(t) ? 4 /* ServerTimestampValue */ :
1667
1674
  /** Returns true if the Value represents the canonical {@link #MAX_VALUE} . */
1668
1675
  function(t) {
@@ -1687,13 +1694,13 @@ function St(t) {
1687
1694
  /**
1688
1695
  * An ObjectValue represents a MapValue in the Firestore Proto and offers the
1689
1696
  * ability to add and remove fields (via the ObjectValueBuilder).
1690
- */ (t) ? 9 /* ArrayValue */ : 10 /* ObjectValue */ : g();
1697
+ */ (t) ? 9007199254740991 /* MaxValue */ : 10 /* ObjectValue */ : g();
1691
1698
  }
1692
1699
 
1693
1700
  /** Tests `left` and `right` for equality based on the backend semantics. */ function Ft(t, e) {
1694
1701
  if (t === e) return !0;
1695
- const n = St(t);
1696
- if (n !== St(e)) return !1;
1702
+ const n = xt(t);
1703
+ if (n !== xt(e)) return !1;
1697
1704
  switch (n) {
1698
1705
  case 0 /* NullValue */ :
1699
1706
  case 9007199254740991 /* MaxValue */ :
@@ -1735,7 +1742,7 @@ function St(t) {
1735
1742
  if ("integerValue" in t && "integerValue" in e) return Pt(t.integerValue) === Pt(e.integerValue);
1736
1743
  if ("doubleValue" in t && "doubleValue" in e) {
1737
1744
  const n = Pt(t.doubleValue), r = Pt(e.doubleValue);
1738
- return n === r ? at(n) === at(r) : isNaN(n) && isNaN(r);
1745
+ return n === r ? ct(n) === ct(r) : isNaN(n) && isNaN(r);
1739
1746
  }
1740
1747
  return !1;
1741
1748
  }(t, e);
@@ -1746,7 +1753,7 @@ function St(t) {
1746
1753
  case 10 /* ObjectValue */ :
1747
1754
  return function(t, e) {
1748
1755
  const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
1749
- if (bt(n) !== bt(r)) return !1;
1756
+ if (vt(n) !== vt(r)) return !1;
1750
1757
  for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ft(n[t], r[t]))) return !1;
1751
1758
  return !0;
1752
1759
  }
@@ -1757,13 +1764,13 @@ function St(t) {
1757
1764
  }
1758
1765
  }
1759
1766
 
1760
- function xt(t, e) {
1767
+ function qt(t, e) {
1761
1768
  return void 0 !== (t.values || []).find((t => Ft(t, e)));
1762
1769
  }
1763
1770
 
1764
- function qt(t, e) {
1771
+ function Ot(t, e) {
1765
1772
  if (t === e) return 0;
1766
- const n = St(t), r = St(e);
1773
+ const n = xt(t), r = xt(e);
1767
1774
  if (n !== r) return yt(n, r);
1768
1775
  switch (n) {
1769
1776
  case 0 /* NullValue */ :
@@ -1782,10 +1789,10 @@ function qt(t, e) {
1782
1789
  }(t, e);
1783
1790
 
1784
1791
  case 3 /* TimestampValue */ :
1785
- return Ot(t.timestampValue, e.timestampValue);
1792
+ return Ct(t.timestampValue, e.timestampValue);
1786
1793
 
1787
1794
  case 4 /* ServerTimestampValue */ :
1788
- return Ot($t(t), $t(e));
1795
+ return Ct($t(t), $t(e));
1789
1796
 
1790
1797
  case 5 /* StringValue */ :
1791
1798
  return yt(t.stringValue, e.stringValue);
@@ -1817,7 +1824,7 @@ function qt(t, e) {
1817
1824
  return function(t, e) {
1818
1825
  const n = t.values || [], r = e.values || [];
1819
1826
  for (let t = 0; t < n.length && t < r.length; ++t) {
1820
- const e = qt(n[t], r[t]);
1827
+ const e = Ot(n[t], r[t]);
1821
1828
  if (e) return e;
1822
1829
  }
1823
1830
  return yt(n.length, r.length);
@@ -1825,6 +1832,9 @@ function qt(t, e) {
1825
1832
 
1826
1833
  case 10 /* ObjectValue */ :
1827
1834
  return function(t, e) {
1835
+ if (t === St && e === St) return 0;
1836
+ if (t === St) return 1;
1837
+ if (e === St) return -1;
1828
1838
  const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
1829
1839
  // Even though MapValues are likely sorted correctly based on their insertion
1830
1840
  // order (e.g. when received from the backend), local modifications can bring
@@ -1834,7 +1844,7 @@ function qt(t, e) {
1834
1844
  for (let t = 0; t < r.length && t < i.length; ++t) {
1835
1845
  const e = yt(r[t], i[t]);
1836
1846
  if (0 !== e) return e;
1837
- const o = qt(n[r[t]], s[i[t]]);
1847
+ const o = Ot(n[r[t]], s[i[t]]);
1838
1848
  if (0 !== o) return o;
1839
1849
  }
1840
1850
  return yt(r.length, i.length);
@@ -1846,35 +1856,35 @@ function qt(t, e) {
1846
1856
  }
1847
1857
  }
1848
1858
 
1849
- function Ot(t, e) {
1859
+ function Ct(t, e) {
1850
1860
  if ("string" == typeof t && "string" == typeof e && t.length === e.length) return yt(t, e);
1851
1861
  const n = Rt(t), r = Rt(e), s = yt(n.seconds, r.seconds);
1852
1862
  return 0 !== s ? s : yt(n.nanos, r.nanos);
1853
1863
  }
1854
1864
 
1855
- function Ct(t, e) {
1865
+ function Lt(t, e) {
1856
1866
  return {
1857
1867
  referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
1858
1868
  };
1859
1869
  }
1860
1870
 
1861
- /** Returns true if `value` is an ArrayValue. */ function Lt(t) {
1871
+ /** Returns true if `value` is an ArrayValue. */ function Ut(t) {
1862
1872
  return !!t && "arrayValue" in t;
1863
1873
  }
1864
1874
 
1865
- /** Returns true if `value` is a NullValue. */ function Ut(t) {
1875
+ /** Returns true if `value` is a NullValue. */ function kt(t) {
1866
1876
  return !!t && "nullValue" in t;
1867
1877
  }
1868
1878
 
1869
- /** Returns true if `value` is NaN. */ function kt(t) {
1879
+ /** Returns true if `value` is NaN. */ function jt(t) {
1870
1880
  return !!t && "doubleValue" in t && isNaN(Number(t.doubleValue));
1871
1881
  }
1872
1882
 
1873
- /** Returns true if `value` is a MapValue. */ function jt(t) {
1883
+ /** Returns true if `value` is a MapValue. */ function Mt(t) {
1874
1884
  return !!t && "mapValue" in t;
1875
1885
  }
1876
1886
 
1877
- /** Creates a deep copy of `source`. */ function Mt(t) {
1887
+ /** Creates a deep copy of `source`. */ function Bt(t) {
1878
1888
  if (t.geoPointValue) return {
1879
1889
  geoPointValue: Object.assign({}, t.geoPointValue)
1880
1890
  };
@@ -1887,7 +1897,7 @@ function Ct(t, e) {
1887
1897
  fields: {}
1888
1898
  }
1889
1899
  };
1890
- return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Mt(n))), e;
1900
+ return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Bt(n))), e;
1891
1901
  }
1892
1902
  if (t.arrayValue) {
1893
1903
  const e = {
@@ -1895,18 +1905,18 @@ function Ct(t, e) {
1895
1905
  values: []
1896
1906
  }
1897
1907
  };
1898
- for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Mt(t.arrayValue.values[n]);
1908
+ for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Bt(t.arrayValue.values[n]);
1899
1909
  return e;
1900
1910
  }
1901
1911
  return Object.assign({}, t);
1902
1912
  }
1903
1913
 
1904
- class Bt {
1914
+ class zt {
1905
1915
  constructor(t) {
1906
1916
  this.value = t;
1907
1917
  }
1908
1918
  static empty() {
1909
- return new Bt({
1919
+ return new zt({
1910
1920
  mapValue: {}
1911
1921
  });
1912
1922
  }
@@ -1920,7 +1930,7 @@ class Bt {
1920
1930
  {
1921
1931
  let e = this.value;
1922
1932
  for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
1923
- !jt(e)) return null;
1933
+ !Mt(e)) return null;
1924
1934
  return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
1925
1935
  }
1926
1936
  }
@@ -1930,7 +1940,7 @@ class Bt {
1930
1940
  * @param path - The field path to set.
1931
1941
  * @param value - The value to set.
1932
1942
  */ set(t, e) {
1933
- this.getFieldsMap(t.popLast())[t.lastSegment()] = Mt(e);
1943
+ this.getFieldsMap(t.popLast())[t.lastSegment()] = Bt(e);
1934
1944
  }
1935
1945
  /**
1936
1946
  * Sets the provided fields to the provided values.
@@ -1944,7 +1954,7 @@ class Bt {
1944
1954
  const t = this.getFieldsMap(e);
1945
1955
  this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
1946
1956
  }
1947
- t ? n[s.lastSegment()] = Mt(t) : r.push(s.lastSegment());
1957
+ t ? n[s.lastSegment()] = Bt(t) : r.push(s.lastSegment());
1948
1958
  }));
1949
1959
  const s = this.getFieldsMap(e);
1950
1960
  this.applyChanges(s, n, r);
@@ -1956,7 +1966,7 @@ class Bt {
1956
1966
  * @param path - The field path to remove.
1957
1967
  */ delete(t) {
1958
1968
  const e = this.field(t.popLast());
1959
- jt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
1969
+ Mt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
1960
1970
  }
1961
1971
  isEqual(t) {
1962
1972
  return Ft(this.value, t.value);
@@ -1971,7 +1981,7 @@ class Bt {
1971
1981
  });
1972
1982
  for (let n = 0; n < t.length; ++n) {
1973
1983
  let r = e.mapValue.fields[t.get(n)];
1974
- jt(r) && r.mapValue.fields || (r = {
1984
+ Mt(r) && r.mapValue.fields || (r = {
1975
1985
  mapValue: {
1976
1986
  fields: {}
1977
1987
  }
@@ -1987,7 +1997,7 @@ class Bt {
1987
1997
  for (const e of n) delete t[e];
1988
1998
  }
1989
1999
  clone() {
1990
- return new Bt(Mt(this.value));
2000
+ return new zt(Bt(this.value));
1991
2001
  }
1992
2002
  }
1993
2003
 
@@ -2016,7 +2026,7 @@ class Bt {
2016
2026
  * not transition to one of these states even after all mutations have been
2017
2027
  * applied, `isValidDocument()` returns false and the document should be removed
2018
2028
  * from all views.
2019
- */ class zt {
2029
+ */ class Gt {
2020
2030
  constructor(t, e, n, r, s, i) {
2021
2031
  this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
2022
2032
  this.documentState = i;
@@ -2025,23 +2035,23 @@ class Bt {
2025
2035
  * Creates a document with no known version or data, but which can serve as
2026
2036
  * base document for mutations.
2027
2037
  */ static newInvalidDocument(t) {
2028
- return new zt(t, 0 /* INVALID */ , vt.min(), vt.min(), Bt.empty(), 0 /* SYNCED */);
2038
+ return new Gt(t, 0 /* INVALID */ , bt.min(), bt.min(), zt.empty(), 0 /* SYNCED */);
2029
2039
  }
2030
2040
  /**
2031
2041
  * Creates a new document that is known to exist with the given data at the
2032
2042
  * given version.
2033
2043
  */ static newFoundDocument(t, e, n) {
2034
- return new zt(t, 1 /* FOUND_DOCUMENT */ , e, vt.min(), n, 0 /* SYNCED */);
2044
+ return new Gt(t, 1 /* FOUND_DOCUMENT */ , e, bt.min(), n, 0 /* SYNCED */);
2035
2045
  }
2036
2046
  /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
2037
- return new zt(t, 2 /* NO_DOCUMENT */ , e, vt.min(), Bt.empty(), 0 /* SYNCED */);
2047
+ return new Gt(t, 2 /* NO_DOCUMENT */ , e, bt.min(), zt.empty(), 0 /* SYNCED */);
2038
2048
  }
2039
2049
  /**
2040
2050
  * Creates a new document that is known to exist at the given version but
2041
2051
  * whose data is not known (e.g. a document that was updated without a known
2042
2052
  * base document).
2043
2053
  */ static newUnknownDocument(t, e) {
2044
- return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , e, vt.min(), Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2054
+ return new Gt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.min(), zt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2045
2055
  }
2046
2056
  /**
2047
2057
  * Changes the document type to indicate that it exists and that its version
@@ -2054,7 +2064,7 @@ class Bt {
2054
2064
  * Changes the document type to indicate that it doesn't exist at the given
2055
2065
  * version.
2056
2066
  */ convertToNoDocument(t) {
2057
- return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Bt.empty(),
2067
+ return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = zt.empty(),
2058
2068
  this.documentState = 0 /* SYNCED */ , this;
2059
2069
  }
2060
2070
  /**
@@ -2062,7 +2072,7 @@ class Bt {
2062
2072
  * that its data is not known (e.g. a document that was updated without a known
2063
2073
  * base document).
2064
2074
  */ convertToUnknownDocument(t) {
2065
- return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Bt.empty(),
2075
+ return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = zt.empty(),
2066
2076
  this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2067
2077
  }
2068
2078
  setHasCommittedMutations() {
@@ -2096,10 +2106,10 @@ class Bt {
2096
2106
  return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
2097
2107
  }
2098
2108
  isEqual(t) {
2099
- return t instanceof zt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2109
+ return t instanceof Gt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2100
2110
  }
2101
2111
  mutableCopy() {
2102
- return new zt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2112
+ return new Gt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2103
2113
  }
2104
2114
  toString() {
2105
2115
  return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
@@ -2123,7 +2133,7 @@ class Bt {
2123
2133
  * limitations under the License.
2124
2134
  */
2125
2135
  // Visible for testing
2126
- class Gt {
2136
+ class Qt {
2127
2137
  constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2128
2138
  this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
2129
2139
  this.startAt = i, this.endAt = o, this.P = null;
@@ -2137,26 +2147,26 @@ class Gt {
2137
2147
  * NOTE: you should always construct `Target` from `Query.toTarget` instead of
2138
2148
  * using this factory method, because `Query` provides an implicit `orderBy`
2139
2149
  * property.
2140
- */ function Qt(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2141
- return new Gt(t, e, n, r, s, i, o);
2150
+ */ function Wt(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2151
+ return new Qt(t, e, n, r, s, i, o);
2142
2152
  }
2143
2153
 
2144
- class Wt extends class {} {
2154
+ class Yt extends class {} {
2145
2155
  constructor(t, e, n) {
2146
2156
  super(), this.field = t, this.op = e, this.value = n;
2147
2157
  }
2148
2158
  /**
2149
2159
  * Creates a filter based on the provided arguments.
2150
2160
  */ static create(t, e, n) {
2151
- return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Yt(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Xt(t, n) : "in" /* IN */ === e ? new Zt(t, n) : "not-in" /* NOT_IN */ === e ? new te(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ee(t, n) : new Wt(t, e, n);
2161
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Ht(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Zt(t, n) : "in" /* IN */ === e ? new te(t, n) : "not-in" /* NOT_IN */ === e ? new ee(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ne(t, n) : new Yt(t, e, n);
2152
2162
  }
2153
2163
  static V(t, e, n) {
2154
- return "in" /* IN */ === e ? new Ht(t, n) : new Kt(t, n);
2164
+ return "in" /* IN */ === e ? new Kt(t, n) : new Jt(t, n);
2155
2165
  }
2156
2166
  matches(t) {
2157
2167
  const e = t.data.field(this.field);
2158
2168
  // Types do not have to match in NOT_EQUAL filters.
2159
- return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(qt(e, this.value)) : null !== e && St(this.value) === St(e) && this.D(qt(e, this.value));
2169
+ return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(Ot(e, this.value)) : null !== e && xt(this.value) === xt(e) && this.D(Ot(e, this.value));
2160
2170
  // Only compare types with matching backend order (such as double and int).
2161
2171
  }
2162
2172
  D(t) {
@@ -2189,7 +2199,7 @@ class Wt extends class {} {
2189
2199
  }
2190
2200
 
2191
2201
  /** Filter that matches on key fields (i.e. '__name__'). */
2192
- class Yt extends Wt {
2202
+ class Ht extends Yt {
2193
2203
  constructor(t, e, n) {
2194
2204
  super(t, e, n), this.key = et.fromName(n.referenceValue);
2195
2205
  }
@@ -2199,69 +2209,69 @@ class Yt extends Wt {
2199
2209
  }
2200
2210
  }
2201
2211
 
2202
- /** Filter that matches on key fields within an array. */ class Ht extends Wt {
2212
+ /** Filter that matches on key fields within an array. */ class Kt extends Yt {
2203
2213
  constructor(t, e) {
2204
- super(t, "in" /* IN */ , e), this.keys = Jt("in" /* IN */ , e);
2214
+ super(t, "in" /* IN */ , e), this.keys = Xt("in" /* IN */ , e);
2205
2215
  }
2206
2216
  matches(t) {
2207
2217
  return this.keys.some((e => e.isEqual(t.key)));
2208
2218
  }
2209
2219
  }
2210
2220
 
2211
- /** Filter that matches on key fields not present within an array. */ class Kt extends Wt {
2221
+ /** Filter that matches on key fields not present within an array. */ class Jt extends Yt {
2212
2222
  constructor(t, e) {
2213
- super(t, "not-in" /* NOT_IN */ , e), this.keys = Jt("not-in" /* NOT_IN */ , e);
2223
+ super(t, "not-in" /* NOT_IN */ , e), this.keys = Xt("not-in" /* NOT_IN */ , e);
2214
2224
  }
2215
2225
  matches(t) {
2216
2226
  return !this.keys.some((e => e.isEqual(t.key)));
2217
2227
  }
2218
2228
  }
2219
2229
 
2220
- function Jt(t, e) {
2230
+ function Xt(t, e) {
2221
2231
  var n;
2222
2232
  return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => et.fromName(t.referenceValue)));
2223
2233
  }
2224
2234
 
2225
- /** A Filter that implements the array-contains operator. */ class Xt extends Wt {
2235
+ /** A Filter that implements the array-contains operator. */ class Zt extends Yt {
2226
2236
  constructor(t, e) {
2227
2237
  super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
2228
2238
  }
2229
2239
  matches(t) {
2230
2240
  const e = t.data.field(this.field);
2231
- return Lt(e) && xt(e.arrayValue, this.value);
2241
+ return Ut(e) && qt(e.arrayValue, this.value);
2232
2242
  }
2233
2243
  }
2234
2244
 
2235
- /** A Filter that implements the IN operator. */ class Zt extends Wt {
2245
+ /** A Filter that implements the IN operator. */ class te extends Yt {
2236
2246
  constructor(t, e) {
2237
2247
  super(t, "in" /* IN */ , e);
2238
2248
  }
2239
2249
  matches(t) {
2240
2250
  const e = t.data.field(this.field);
2241
- return null !== e && xt(this.value.arrayValue, e);
2251
+ return null !== e && qt(this.value.arrayValue, e);
2242
2252
  }
2243
2253
  }
2244
2254
 
2245
- /** A Filter that implements the not-in operator. */ class te extends Wt {
2255
+ /** A Filter that implements the not-in operator. */ class ee extends Yt {
2246
2256
  constructor(t, e) {
2247
2257
  super(t, "not-in" /* NOT_IN */ , e);
2248
2258
  }
2249
2259
  matches(t) {
2250
- if (xt(this.value.arrayValue, {
2260
+ if (qt(this.value.arrayValue, {
2251
2261
  nullValue: "NULL_VALUE"
2252
2262
  })) return !1;
2253
2263
  const e = t.data.field(this.field);
2254
- return null !== e && !xt(this.value.arrayValue, e);
2264
+ return null !== e && !qt(this.value.arrayValue, e);
2255
2265
  }
2256
2266
  }
2257
2267
 
2258
- /** A Filter that implements the array-contains-any operator. */ class ee extends Wt {
2268
+ /** A Filter that implements the array-contains-any operator. */ class ne extends Yt {
2259
2269
  constructor(t, e) {
2260
2270
  super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
2261
2271
  }
2262
2272
  matches(t) {
2263
2273
  const e = t.data.field(this.field);
2264
- return !(!Lt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => xt(this.value.arrayValue, t)));
2274
+ return !(!Ut(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => qt(this.value.arrayValue, t)));
2265
2275
  }
2266
2276
  }
2267
2277
 
@@ -2278,7 +2288,7 @@ function Jt(t, e) {
2278
2288
  * Bound provides a function to determine whether a document comes before or
2279
2289
  * after a bound. This is influenced by whether the position is just before or
2280
2290
  * just after the provided values.
2281
- */ class ne {
2291
+ */ class re {
2282
2292
  constructor(t, e) {
2283
2293
  this.position = t, this.inclusive = e;
2284
2294
  }
@@ -2286,17 +2296,17 @@ function Jt(t, e) {
2286
2296
 
2287
2297
  /**
2288
2298
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
2289
- */ class re {
2299
+ */ class se {
2290
2300
  constructor(t, e = "asc" /* ASCENDING */) {
2291
2301
  this.field = t, this.dir = e;
2292
2302
  }
2293
2303
  }
2294
2304
 
2295
- function se(t, e) {
2305
+ function ie(t, e) {
2296
2306
  return t.dir === e.dir && t.field.isEqual(e.field);
2297
2307
  }
2298
2308
 
2299
- function ie(t, e) {
2309
+ function oe(t, e) {
2300
2310
  if (null === t) return null === e;
2301
2311
  if (null === e) return !1;
2302
2312
  if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
@@ -2328,7 +2338,7 @@ function ie(t, e) {
2328
2338
  * query the RemoteStore results.
2329
2339
  *
2330
2340
  * Visible for testing.
2331
- */ class oe {
2341
+ */ class ue {
2332
2342
  /**
2333
2343
  * Initializes a Query with a path and optional additional query constraints.
2334
2344
  * Path must currently be empty if this is a collection group query.
@@ -2341,7 +2351,7 @@ function ie(t, e) {
2341
2351
  }
2342
2352
  }
2343
2353
 
2344
- /** Creates a new Query for a query that matches all documents at `path` */ function ue(t) {
2354
+ /** Creates a new Query for a query that matches all documents at `path` */ function ae(t) {
2345
2355
  return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
2346
2356
  }
2347
2357
 
@@ -2358,7 +2368,7 @@ function ce(t) {
2358
2368
  * Returns whether the query matches a collection group rather than a specific
2359
2369
  * collection.
2360
2370
  */
2361
- function ae(t) {
2371
+ function he(t) {
2362
2372
  return null !== t.collectionGroup;
2363
2373
  }
2364
2374
 
@@ -2366,23 +2376,23 @@ function ae(t) {
2366
2376
  * Returns the implicit order by constraint that is used to execute the Query,
2367
2377
  * which can be different from the order by constraints the user provided (e.g.
2368
2378
  * the SDK and backend always orders by `__name__`).
2369
- */ function he(t) {
2370
- const e = b(t);
2379
+ */ function le(t) {
2380
+ const e = v(t);
2371
2381
  if (null === e.$) {
2372
2382
  e.$ = [];
2373
- const t = ce(e), n = ue(e);
2383
+ const t = ce(e), n = ae(e);
2374
2384
  if (null !== t && null === n)
2375
2385
  // In order to implicitly add key ordering, we must also add the
2376
2386
  // inequality filter field for it to be a valid query.
2377
2387
  // Note that the default inequality field and key ordering is ascending.
2378
- t.isKeyField() || e.$.push(new re(t)), e.$.push(new re(tt.keyField(), "asc" /* ASCENDING */)); else {
2388
+ t.isKeyField() || e.$.push(new se(t)), e.$.push(new se(tt.keyField(), "asc" /* ASCENDING */)); else {
2379
2389
  let t = !1;
2380
2390
  for (const n of e.explicitOrderBy) e.$.push(n), n.field.isKeyField() && (t = !0);
2381
2391
  if (!t) {
2382
2392
  // The order of the implicit key ordering always matches the last
2383
2393
  // explicit order by
2384
2394
  const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2385
- e.$.push(new re(tt.keyField(), t));
2395
+ e.$.push(new se(tt.keyField(), t));
2386
2396
  }
2387
2397
  }
2388
2398
  }
@@ -2391,34 +2401,34 @@ function ae(t) {
2391
2401
 
2392
2402
  /**
2393
2403
  * Converts this `Query` instance to it's corresponding `Target` representation.
2394
- */ function le(t) {
2395
- const e = b(t);
2396
- if (!e.S) if ("F" /* First */ === e.limitType) e.S = Qt(e.path, e.collectionGroup, he(e), e.filters, e.limit, e.startAt, e.endAt); else {
2404
+ */ function fe(t) {
2405
+ const e = v(t);
2406
+ if (!e.S) if ("F" /* First */ === e.limitType) e.S = Wt(e.path, e.collectionGroup, le(e), e.filters, e.limit, e.startAt, e.endAt); else {
2397
2407
  // Flip the orderBy directions since we want the last results
2398
2408
  const t = [];
2399
- for (const n of he(e)) {
2409
+ for (const n of le(e)) {
2400
2410
  const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2401
- t.push(new re(n.field, e));
2411
+ t.push(new se(n.field, e));
2402
2412
  }
2403
2413
  // We need to swap the cursors to match the now-flipped query ordering.
2404
- const n = e.endAt ? new ne(e.endAt.position, !e.endAt.inclusive) : null, r = e.startAt ? new ne(e.startAt.position, !e.startAt.inclusive) : null;
2414
+ const n = e.endAt ? new re(e.endAt.position, e.endAt.inclusive) : null, r = e.startAt ? new re(e.startAt.position, e.startAt.inclusive) : null;
2405
2415
  // Now return as a LimitType.First query.
2406
- e.S = Qt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2416
+ e.S = Wt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2407
2417
  }
2408
2418
  return e.S;
2409
2419
  }
2410
2420
 
2411
- function fe(t, e) {
2421
+ function de(t, e) {
2412
2422
  return function(t, e) {
2413
2423
  if (t.limit !== e.limit) return !1;
2414
2424
  if (t.orderBy.length !== e.orderBy.length) return !1;
2415
- for (let n = 0; n < t.orderBy.length; n++) if (!se(t.orderBy[n], e.orderBy[n])) return !1;
2425
+ for (let n = 0; n < t.orderBy.length; n++) if (!ie(t.orderBy[n], e.orderBy[n])) return !1;
2416
2426
  if (t.filters.length !== e.filters.length) return !1;
2417
2427
  for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
2418
2428
  n.op !== r.op || !n.field.isEqual(r.field) || !Ft(n.value, r.value)) return !1;
2419
2429
  var n, r;
2420
- return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!ie(t.startAt, e.startAt) && ie(t.endAt, e.endAt);
2421
- }(le(t), le(e)) && t.limitType === e.limitType;
2430
+ return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!oe(t.startAt, e.startAt) && oe(t.endAt, e.endAt);
2431
+ }(fe(t), fe(e)) && t.limitType === e.limitType;
2422
2432
  }
2423
2433
 
2424
2434
  /**
@@ -2446,9 +2456,9 @@ function fe(t, e) {
2446
2456
  * The return value is an IntegerValue if it can safely represent the value,
2447
2457
  * otherwise a DoubleValue is returned.
2448
2458
  */
2449
- function de(t, e) {
2459
+ function we(t, e) {
2450
2460
  return function(t) {
2451
- return "number" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2461
+ return "number" == typeof t && Number.isInteger(t) && !ct(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2452
2462
  }(e) ?
2453
2463
  /**
2454
2464
  * Returns an IntegerValue for `value`.
@@ -2470,7 +2480,7 @@ function de(t, e) {
2470
2480
  };
2471
2481
  }
2472
2482
  return {
2473
- doubleValue: at(e) ? "-0" : e
2483
+ doubleValue: ct(e) ? "-0" : e
2474
2484
  };
2475
2485
  }(t, e);
2476
2486
  }
@@ -2491,7 +2501,7 @@ function de(t, e) {
2491
2501
  * See the License for the specific language governing permissions and
2492
2502
  * limitations under the License.
2493
2503
  */
2494
- /** Used to represent a field transform on a mutation. */ class we {
2504
+ /** Used to represent a field transform on a mutation. */ class me {
2495
2505
  constructor() {
2496
2506
  // Make sure that the structural type of `TransformOperation` is unique.
2497
2507
  // See https://github.com/microsoft/TypeScript/issues/5451
@@ -2499,15 +2509,15 @@ function de(t, e) {
2499
2509
  }
2500
2510
  }
2501
2511
 
2502
- /** Transforms a value into a server-generated timestamp. */ class me extends we {}
2512
+ /** Transforms a value into a server-generated timestamp. */ class pe extends me {}
2503
2513
 
2504
- /** Transforms an array value via a union operation. */ class pe extends we {
2514
+ /** Transforms an array value via a union operation. */ class ye extends me {
2505
2515
  constructor(t) {
2506
2516
  super(), this.elements = t;
2507
2517
  }
2508
2518
  }
2509
2519
 
2510
- /** Transforms an array value via a remove operation. */ class ye extends we {
2520
+ /** Transforms an array value via a remove operation. */ class _e extends me {
2511
2521
  constructor(t) {
2512
2522
  super(), this.elements = t;
2513
2523
  }
@@ -2518,7 +2528,7 @@ function de(t, e) {
2518
2528
  * transforms. Converts all field values to integers or doubles, but unlike the
2519
2529
  * backend does not cap integer values at 2^63. Instead, JavaScript number
2520
2530
  * arithmetic is used and precision loss can occur for values greater than 2^53.
2521
- */ class _e extends we {
2531
+ */ class ge extends me {
2522
2532
  constructor(t, e) {
2523
2533
  super(), this.q = t, this.O = e;
2524
2534
  }
@@ -2540,7 +2550,7 @@ function de(t, e) {
2540
2550
  * See the License for the specific language governing permissions and
2541
2551
  * limitations under the License.
2542
2552
  */
2543
- /** A field path and the TransformOperation to perform upon it. */ class ge {
2553
+ /** A field path and the TransformOperation to perform upon it. */ class be {
2544
2554
  constructor(t, e) {
2545
2555
  this.field = t, this.transform = e;
2546
2556
  }
@@ -2614,12 +2624,12 @@ function de(t, e) {
2614
2624
  * applyToLocalView() to implement the actual behavior of applying the mutation
2615
2625
  * to some source document (see `setMutationApplyToRemoteDocument()` for an
2616
2626
  * example).
2617
- */ class be {}
2627
+ */ class Ee {}
2618
2628
 
2619
2629
  /**
2620
2630
  * A mutation that creates or replaces the document at the given key with the
2621
2631
  * object value contents.
2622
- */ class Ee extends be {
2632
+ */ class Te extends Ee {
2623
2633
  constructor(t, e, n, r = []) {
2624
2634
  super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
2625
2635
  this.type = 0 /* Set */;
@@ -2638,14 +2648,14 @@ function de(t, e) {
2638
2648
  * is deleted.
2639
2649
  * * When a field is not in the mask but is in the values, the values map is
2640
2650
  * ignored.
2641
- */ class Te extends be {
2651
+ */ class Ae extends Ee {
2642
2652
  constructor(t, e, n, r, s = []) {
2643
2653
  super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
2644
2654
  this.fieldTransforms = s, this.type = 1 /* Patch */;
2645
2655
  }
2646
2656
  }
2647
2657
 
2648
- /** A mutation that deletes the document at the given key. */ class Ie extends be {
2658
+ /** A mutation that deletes the document at the given key. */ class Ie extends Ee {
2649
2659
  constructor(t, e) {
2650
2660
  super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
2651
2661
  }
@@ -2657,7 +2667,7 @@ function de(t, e) {
2657
2667
  *
2658
2668
  * The `verify` operation is only used in Transactions, and this class serves
2659
2669
  * primarily to facilitate serialization into protos.
2660
- */ class Ae extends be {
2670
+ */ class Re extends Ee {
2661
2671
  constructor(t, e) {
2662
2672
  super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
2663
2673
  }
@@ -2678,13 +2688,13 @@ function de(t, e) {
2678
2688
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2679
2689
  * See the License for the specific language governing permissions and
2680
2690
  * limitations under the License.
2681
- */ const Re = (() => {
2691
+ */ const Pe = (() => {
2682
2692
  const t = {
2683
2693
  asc: "ASCENDING",
2684
2694
  desc: "DESCENDING"
2685
2695
  };
2686
2696
  return t;
2687
- })(), Pe = (() => {
2697
+ })(), Ve = (() => {
2688
2698
  const t = {
2689
2699
  "<": "LESS_THAN",
2690
2700
  "<=": "LESS_THAN_OR_EQUAL",
@@ -2714,7 +2724,7 @@ function de(t, e) {
2714
2724
  * TODO(klimt): We can remove the databaseId argument if we keep the full
2715
2725
  * resource name in documents.
2716
2726
  */
2717
- class Ve {
2727
+ class De {
2718
2728
  constructor(t, e) {
2719
2729
  this.databaseId = t, this.F = e;
2720
2730
  }
@@ -2731,7 +2741,7 @@ class Ve {
2731
2741
  /**
2732
2742
  * Returns a value for a Date that's appropriate to put into a proto.
2733
2743
  */
2734
- function De(t, e) {
2744
+ function Ne(t, e) {
2735
2745
  if (t.F) {
2736
2746
  return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
2737
2747
  }
@@ -2746,16 +2756,16 @@ function De(t, e) {
2746
2756
  *
2747
2757
  * Visible for testing.
2748
2758
  */
2749
- function Ne(t, e) {
2759
+ function $e(t, e) {
2750
2760
  return t.F ? e.toBase64() : e.toUint8Array();
2751
2761
  }
2752
2762
 
2753
- function $e(t, e) {
2754
- return De(t, e.toTimestamp());
2763
+ function Se(t, e) {
2764
+ return Ne(t, e.toTimestamp());
2755
2765
  }
2756
2766
 
2757
- function Se(t) {
2758
- return v(!!t), vt.fromTimestamp(function(t) {
2767
+ function xe(t) {
2768
+ return b(!!t), bt.fromTimestamp(function(t) {
2759
2769
  const e = Rt(t);
2760
2770
  return new gt(e.seconds, e.nanos);
2761
2771
  }(t));
@@ -2767,108 +2777,108 @@ function Fe(t, e) {
2767
2777
  }(t).child("documents").child(e).canonicalString();
2768
2778
  }
2769
2779
 
2770
- function xe(t, e) {
2780
+ function qe(t, e) {
2771
2781
  return Fe(t.databaseId, e.path);
2772
2782
  }
2773
2783
 
2774
- function qe(t, e) {
2784
+ function Oe(t, e) {
2775
2785
  const n = function(t) {
2776
2786
  const e = X.fromString(t);
2777
- return v(Qe(e)), e;
2787
+ return b(We(e)), e;
2778
2788
  }(e);
2779
- if (n.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
2780
- if (n.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
2781
- return new et((v((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
2789
+ if (n.get(1) !== t.databaseId.projectId) throw new U(I, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
2790
+ if (n.get(3) !== t.databaseId.database) throw new U(I, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
2791
+ return new et((b((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
2782
2792
  var r;
2783
2793
  /** Creates a Document proto from key and fields (but no create/update time) */}
2784
2794
 
2785
- function Oe(t, e) {
2795
+ function Ce(t, e) {
2786
2796
  return Fe(t.databaseId, e);
2787
2797
  }
2788
2798
 
2789
- function Ce(t) {
2799
+ function Le(t) {
2790
2800
  return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
2791
2801
  }
2792
2802
 
2793
- function Le(t, e, n) {
2803
+ function Ue(t, e, n) {
2794
2804
  return {
2795
- name: xe(t, e),
2805
+ name: qe(t, e),
2796
2806
  fields: n.value.mapValue.fields
2797
2807
  };
2798
2808
  }
2799
2809
 
2800
- function Ue(t, e) {
2810
+ function ke(t, e) {
2801
2811
  return "found" in e ? function(t, e) {
2802
- v(!!e.found), e.found.name, e.found.updateTime;
2803
- const n = qe(t, e.found.name), r = Se(e.found.updateTime), s = new Bt({
2812
+ b(!!e.found), e.found.name, e.found.updateTime;
2813
+ const n = Oe(t, e.found.name), r = xe(e.found.updateTime), s = new zt({
2804
2814
  mapValue: {
2805
2815
  fields: e.found.fields
2806
2816
  }
2807
2817
  });
2808
- return zt.newFoundDocument(n, r, s);
2818
+ return Gt.newFoundDocument(n, r, s);
2809
2819
  }(t, e) : "missing" in e ? function(t, e) {
2810
- v(!!e.missing), v(!!e.readTime);
2811
- const n = qe(t, e.missing), r = Se(e.readTime);
2812
- return zt.newNoDocument(n, r);
2820
+ b(!!e.missing), b(!!e.readTime);
2821
+ const n = Oe(t, e.missing), r = xe(e.readTime);
2822
+ return Gt.newNoDocument(n, r);
2813
2823
  }(t, e) : g();
2814
2824
  }
2815
2825
 
2816
- function ke(t, e) {
2826
+ function je(t, e) {
2817
2827
  let n;
2818
- if (e instanceof Ee) n = {
2819
- update: Le(t, e.key, e.value)
2828
+ if (e instanceof Te) n = {
2829
+ update: Ue(t, e.key, e.value)
2820
2830
  }; else if (e instanceof Ie) n = {
2821
- delete: xe(t, e.key)
2822
- }; else if (e instanceof Te) n = {
2823
- update: Le(t, e.key, e.data),
2824
- updateMask: Ge(e.fieldMask)
2831
+ delete: qe(t, e.key)
2832
+ }; else if (e instanceof Ae) n = {
2833
+ update: Ue(t, e.key, e.data),
2834
+ updateMask: Qe(e.fieldMask)
2825
2835
  }; else {
2826
- if (!(e instanceof Ae)) return g();
2836
+ if (!(e instanceof Re)) return g();
2827
2837
  n = {
2828
- verify: xe(t, e.key)
2838
+ verify: qe(t, e.key)
2829
2839
  };
2830
2840
  }
2831
2841
  return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
2832
2842
  const n = e.transform;
2833
- if (n instanceof me) return {
2843
+ if (n instanceof pe) return {
2834
2844
  fieldPath: e.field.canonicalString(),
2835
2845
  setToServerValue: "REQUEST_TIME"
2836
2846
  };
2837
- if (n instanceof pe) return {
2847
+ if (n instanceof ye) return {
2838
2848
  fieldPath: e.field.canonicalString(),
2839
2849
  appendMissingElements: {
2840
2850
  values: n.elements
2841
2851
  }
2842
2852
  };
2843
- if (n instanceof ye) return {
2853
+ if (n instanceof _e) return {
2844
2854
  fieldPath: e.field.canonicalString(),
2845
2855
  removeAllFromArray: {
2846
2856
  values: n.elements
2847
2857
  }
2848
2858
  };
2849
- if (n instanceof _e) return {
2859
+ if (n instanceof ge) return {
2850
2860
  fieldPath: e.field.canonicalString(),
2851
2861
  increment: n.O
2852
2862
  };
2853
2863
  throw g();
2854
2864
  }(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
2855
2865
  return void 0 !== e.updateTime ? {
2856
- updateTime: $e(t, e.updateTime)
2866
+ updateTime: Se(t, e.updateTime)
2857
2867
  } : void 0 !== e.exists ? {
2858
2868
  exists: e.exists
2859
2869
  } : g();
2860
2870
  }(t, e.precondition)), n;
2861
2871
  }
2862
2872
 
2863
- function je(t, e) {
2873
+ function Me(t, e) {
2864
2874
  // Dissect the path into parent, collectionId, and optional key filter.
2865
2875
  const n = {
2866
2876
  structuredQuery: {}
2867
2877
  }, r = e.path;
2868
- null !== e.collectionGroup ? (n.parent = Oe(t, r), n.structuredQuery.from = [ {
2878
+ null !== e.collectionGroup ? (n.parent = Ce(t, r), n.structuredQuery.from = [ {
2869
2879
  collectionId: e.collectionGroup,
2870
2880
  allDescendants: !0
2871
- } ]) : (n.parent = Oe(t, r.popLast()), n.structuredQuery.from = [ {
2881
+ } ]) : (n.parent = Ce(t, r.popLast()), n.structuredQuery.from = [ {
2872
2882
  collectionId: r.lastSegment()
2873
2883
  } ]);
2874
2884
  const s = function(t) {
@@ -2877,36 +2887,36 @@ function je(t, e) {
2877
2887
  // visible for testing
2878
2888
  function(t) {
2879
2889
  if ("==" /* EQUAL */ === t.op) {
2880
- if (kt(t.value)) return {
2890
+ if (jt(t.value)) return {
2881
2891
  unaryFilter: {
2882
- field: ze(t.field),
2892
+ field: Ge(t.field),
2883
2893
  op: "IS_NAN"
2884
2894
  }
2885
2895
  };
2886
- if (Ut(t.value)) return {
2896
+ if (kt(t.value)) return {
2887
2897
  unaryFilter: {
2888
- field: ze(t.field),
2898
+ field: Ge(t.field),
2889
2899
  op: "IS_NULL"
2890
2900
  }
2891
2901
  };
2892
2902
  } else if ("!=" /* NOT_EQUAL */ === t.op) {
2893
- if (kt(t.value)) return {
2903
+ if (jt(t.value)) return {
2894
2904
  unaryFilter: {
2895
- field: ze(t.field),
2905
+ field: Ge(t.field),
2896
2906
  op: "IS_NOT_NAN"
2897
2907
  }
2898
2908
  };
2899
- if (Ut(t.value)) return {
2909
+ if (kt(t.value)) return {
2900
2910
  unaryFilter: {
2901
- field: ze(t.field),
2911
+ field: Ge(t.field),
2902
2912
  op: "IS_NOT_NULL"
2903
2913
  }
2904
2914
  };
2905
2915
  }
2906
2916
  return {
2907
2917
  fieldFilter: {
2908
- field: ze(t.field),
2909
- op: Be(t.op),
2918
+ field: Ge(t.field),
2919
+ op: ze(t.op),
2910
2920
  value: t.value
2911
2921
  }
2912
2922
  };
@@ -2926,14 +2936,14 @@ function je(t, e) {
2926
2936
  // visible for testing
2927
2937
  function(t) {
2928
2938
  return {
2929
- field: ze(t.field),
2930
- direction: Me(t.dir)
2939
+ field: Ge(t.field),
2940
+ direction: Be(t.dir)
2931
2941
  };
2932
2942
  }(t)));
2933
2943
  }(e.orderBy);
2934
2944
  i && (n.structuredQuery.orderBy = i);
2935
2945
  const o = function(t, e) {
2936
- return t.F || ct(e) ? e : {
2946
+ return t.F || at(e) ? e : {
2937
2947
  value: e
2938
2948
  };
2939
2949
  }(t, e.limit);
@@ -2951,29 +2961,29 @@ function je(t, e) {
2951
2961
  (e.endAt)), n;
2952
2962
  }
2953
2963
 
2954
- function Me(t) {
2955
- return Re[t];
2956
- }
2957
-
2958
- // visible for testing
2959
2964
  function Be(t) {
2960
2965
  return Pe[t];
2961
2966
  }
2962
2967
 
2968
+ // visible for testing
2963
2969
  function ze(t) {
2970
+ return Ve[t];
2971
+ }
2972
+
2973
+ function Ge(t) {
2964
2974
  return {
2965
2975
  fieldPath: t.canonicalString()
2966
2976
  };
2967
2977
  }
2968
2978
 
2969
- function Ge(t) {
2979
+ function Qe(t) {
2970
2980
  const e = [];
2971
2981
  return t.fields.forEach((t => e.push(t.canonicalString()))), {
2972
2982
  fieldPaths: e
2973
2983
  };
2974
2984
  }
2975
2985
 
2976
- function Qe(t) {
2986
+ function We(t) {
2977
2987
  // Resource names have at least 4 components (project ID, database ID)
2978
2988
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
2979
2989
  }
@@ -2993,8 +3003,8 @@ function Qe(t) {
2993
3003
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2994
3004
  * See the License for the specific language governing permissions and
2995
3005
  * limitations under the License.
2996
- */ function We(t) {
2997
- return new Ve(t, /* useProto3Json= */ !0);
3006
+ */ function Ye(t) {
3007
+ return new De(t, /* useProto3Json= */ !0);
2998
3008
  }
2999
3009
 
3000
3010
  /**
@@ -3022,7 +3032,7 @@ function Qe(t) {
3022
3032
  * base delay. This prevents clients from accidentally synchronizing their
3023
3033
  * delays causing spikes of load to the backend.
3024
3034
  */
3025
- class Ye {
3035
+ class He {
3026
3036
  constructor(
3027
3037
  /**
3028
3038
  * The AsyncQueue to run backoff operations on.
@@ -3120,7 +3130,7 @@ class Ye {
3120
3130
  * An implementation of Datastore that exposes additional state for internal
3121
3131
  * consumption.
3122
3132
  */
3123
- class He extends class {} {
3133
+ class Ke extends class {} {
3124
3134
  constructor(t, e, n, r) {
3125
3135
  super(), this.authCredentials = t, this.appCheckCredentials = e, this.K = n, this.q = r,
3126
3136
  this.J = !1;
@@ -3131,13 +3141,13 @@ class He extends class {} {
3131
3141
  /** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, e, n) {
3132
3142
  return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, e, n, r, s))).catch((t => {
3133
3143
  throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
3134
- this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
3144
+ this.appCheckCredentials.invalidateToken()), t) : new U(A, t.toString());
3135
3145
  }));
3136
3146
  }
3137
3147
  /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, e, n) {
3138
3148
  return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, e, n, r, s))).catch((t => {
3139
3149
  throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
3140
- this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
3150
+ this.appCheckCredentials.invalidateToken()), t) : new U(A, t.toString());
3141
3151
  }));
3142
3152
  }
3143
3153
  terminate() {
@@ -3147,38 +3157,38 @@ class He extends class {} {
3147
3157
 
3148
3158
  // TODO(firestorexp): Make sure there is only one Datastore instance per
3149
3159
  // firestore-exp client.
3150
- async function Ke(t, e) {
3151
- const n = b(t), r = Ce(n.q) + "/documents", s = {
3152
- writes: e.map((t => ke(n.q, t)))
3160
+ async function Je(t, e) {
3161
+ const n = v(t), r = Le(n.q) + "/documents", s = {
3162
+ writes: e.map((t => je(n.q, t)))
3153
3163
  };
3154
3164
  await n.m("Commit", r, s);
3155
3165
  }
3156
3166
 
3157
- async function Je(t, e) {
3158
- const n = b(t), r = Ce(n.q) + "/documents", s = {
3159
- documents: e.map((t => xe(n.q, t)))
3167
+ async function Xe(t, e) {
3168
+ const n = v(t), r = Le(n.q) + "/documents", s = {
3169
+ documents: e.map((t => qe(n.q, t)))
3160
3170
  }, i = await n.T("BatchGetDocuments", r, s), o = new Map;
3161
3171
  i.forEach((t => {
3162
- const e = Ue(n.q, t);
3172
+ const e = ke(n.q, t);
3163
3173
  o.set(e.key.toString(), e);
3164
3174
  }));
3165
3175
  const u = [];
3166
3176
  return e.forEach((t => {
3167
3177
  const e = o.get(t.toString());
3168
- v(!!e), u.push(e);
3178
+ b(!!e), u.push(e);
3169
3179
  })), u;
3170
3180
  }
3171
3181
 
3172
- async function Xe(t, e) {
3173
- const n = b(t), r = je(n.q, le(e));
3182
+ async function Ze(t, e) {
3183
+ const n = v(t), r = Me(n.q, fe(e));
3174
3184
  return (await n.T("RunQuery", r.parent, {
3175
3185
  structuredQuery: r.structuredQuery
3176
3186
  })).filter((t => !!t.document)).map((t => function(t, e, n) {
3177
- const r = qe(t, e.name), s = Se(e.updateTime), i = new Bt({
3187
+ const r = Oe(t, e.name), s = xe(e.updateTime), i = new zt({
3178
3188
  mapValue: {
3179
3189
  fields: e.fields
3180
3190
  }
3181
- }), o = zt.newFoundDocument(r, s, i);
3191
+ }), o = Gt.newFoundDocument(r, s, i);
3182
3192
  return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
3183
3193
  }(n.q, t.document, void 0)));
3184
3194
  }
@@ -3198,7 +3208,7 @@ async function Xe(t, e) {
3198
3208
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3199
3209
  * See the License for the specific language governing permissions and
3200
3210
  * limitations under the License.
3201
- */ const Ze = new Map;
3211
+ */ const tn = new Map;
3202
3212
 
3203
3213
  /**
3204
3214
  * An instance map that ensures only one Datastore exists per Firestore
@@ -3209,17 +3219,17 @@ async function Xe(t, e) {
3209
3219
  * instance. Callers must invoke removeComponents() when the Firestore
3210
3220
  * instance is terminated.
3211
3221
  */
3212
- function tn(t) {
3222
+ function en(t) {
3213
3223
  if (t._terminated) throw new U(S, "The client has already been terminated.");
3214
- if (!Ze.has(t)) {
3224
+ if (!tn.has(t)) {
3215
3225
  m("ComponentProvider", "Initializing Datastore");
3216
3226
  const i = function(t) {
3217
3227
  return new wt(t, fetch.bind(null));
3218
3228
  }((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3219
- new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = We(t._databaseId), u = function(t, e, n, r) {
3220
- return new He(t, e, n, r);
3229
+ new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Ye(t._databaseId), u = function(t, e, n, r) {
3230
+ return new Ke(t, e, n, r);
3221
3231
  }(t._authCredentials, t._appCheckCredentials, i, o);
3222
- Ze.set(t, u);
3232
+ tn.set(t, u);
3223
3233
  }
3224
3234
  var e, n, r, s;
3225
3235
  /**
@@ -3237,7 +3247,7 @@ function tn(t) {
3237
3247
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3238
3248
  * See the License for the specific language governing permissions and
3239
3249
  * limitations under the License.
3240
- */ return Ze.get(t);
3250
+ */ return tn.get(t);
3241
3251
  }
3242
3252
 
3243
3253
  /**
@@ -3249,21 +3259,21 @@ function tn(t) {
3249
3259
  * user-supplied `FirestoreSettings` object. This is a separate type so that
3250
3260
  * defaults can be supplied and the value can be checked for equality.
3251
3261
  */
3252
- class en {
3262
+ class nn {
3253
3263
  constructor(t) {
3254
3264
  var e;
3255
3265
  if (void 0 === t.host) {
3256
- if (void 0 !== t.ssl) throw new U(A, "Can't provide ssl option if host option is not set");
3266
+ if (void 0 !== t.ssl) throw new U(I, "Can't provide ssl option if host option is not set");
3257
3267
  this.host = "firestore.googleapis.com", this.ssl = true;
3258
3268
  } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
3259
3269
  if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
3260
3270
  void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
3261
- if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(A, "cacheSizeBytes must be at least 1048576");
3271
+ if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(I, "cacheSizeBytes must be at least 1048576");
3262
3272
  this.cacheSizeBytes = t.cacheSizeBytes;
3263
3273
  }
3264
3274
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
3265
3275
  this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
3266
- if (!0 === e && !0 === r) throw new U(A, `${t} and ${n} cannot be used together.`);
3276
+ if (!0 === e && !0 === r) throw new U(I, `${t} and ${n} cannot be used together.`);
3267
3277
  }("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
3268
3278
  }
3269
3279
  isEqual(t) {
@@ -3291,17 +3301,17 @@ class en {
3291
3301
  * The Cloud Firestore service interface.
3292
3302
  *
3293
3303
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
3294
- */ class nn {
3304
+ */ class rn {
3295
3305
  /** @hideconstructor */
3296
3306
  constructor(t, e, n) {
3297
3307
  this._authCredentials = e, this._appCheckCredentials = n,
3298
3308
  /**
3299
3309
  * Whether it's a Firestore or Firestore Lite instance.
3300
3310
  */
3301
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new en({}),
3311
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new nn({}),
3302
3312
  this._settingsFrozen = !1, t instanceof K ? this._databaseId = t : (this._app = t,
3303
3313
  this._databaseId = function(t) {
3304
- if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(A, '"projectId" not provided in firebase.initializeApp.');
3314
+ if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(I, '"projectId" not provided in firebase.initializeApp.');
3305
3315
  return new K(t.options.projectId);
3306
3316
  }
3307
3317
  /**
@@ -3331,20 +3341,20 @@ class en {
3331
3341
  }
3332
3342
  _setSettings(t) {
3333
3343
  if (this._settingsFrozen) throw new U(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.");
3334
- this._settings = new en(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3344
+ this._settings = new nn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3335
3345
  if (!t) return new M;
3336
3346
  switch (t.type) {
3337
3347
  case "gapi":
3338
3348
  const e = t.client;
3339
3349
  // Make sure this really is a Gapi client.
3340
- return v(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
3350
+ return b(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
3341
3351
  new Q(e, t.sessionIndex || "0", t.iamToken || null);
3342
3352
 
3343
3353
  case "provider":
3344
3354
  return t.client;
3345
3355
 
3346
3356
  default:
3347
- throw new U(A, "makeAuthCredentialsProvider failed due to invalid credential type");
3357
+ throw new U(I, "makeAuthCredentialsProvider failed due to invalid credential type");
3348
3358
  }
3349
3359
  }(t.credentials));
3350
3360
  }
@@ -3372,13 +3382,13 @@ class en {
3372
3382
  * Only ever called once.
3373
3383
  */ _terminate() {
3374
3384
  return function(t) {
3375
- const e = Ze.get(t);
3376
- e && (m("ComponentProvider", "Removing Datastore"), Ze.delete(t), e.terminate());
3385
+ const e = tn.get(t);
3386
+ e && (m("ComponentProvider", "Removing Datastore"), tn.delete(t), e.terminate());
3377
3387
  }(this), Promise.resolve();
3378
3388
  }
3379
3389
  }
3380
3390
 
3381
- function rn(t, e) {
3391
+ function sn(t, e) {
3382
3392
  const n = _getProvider(t, "firestore/lite");
3383
3393
  if (n.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
3384
3394
  return n.initialize({
@@ -3394,7 +3404,7 @@ function rn(t, e) {
3394
3404
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
3395
3405
  * instance is associated with.
3396
3406
  * @returns The `Firestore` instance of the provided app.
3397
- */ function sn(e = getApp()) {
3407
+ */ function on(e = getApp()) {
3398
3408
  return _getProvider(e, "firestore/lite").getImmediate();
3399
3409
  }
3400
3410
 
@@ -3410,9 +3420,9 @@ function rn(t, e) {
3410
3420
  * @param port - the emulator port (ex: 9000).
3411
3421
  * @param options.mockUserToken - the mock auth token to use for unit testing
3412
3422
  * Security Rules.
3413
- */ function on(t, e, n, r = {}) {
3423
+ */ function un(t, e, n, r = {}) {
3414
3424
  var s;
3415
- const i = (t = ot(t, nn))._getSettings();
3425
+ const i = (t = ot(t, rn))._getSettings();
3416
3426
  if ("firestore.googleapis.com" !== i.host && i.host !== e && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3417
3427
  t._setSettings(Object.assign(Object.assign({}, i), {
3418
3428
  host: `${e}:${n}`,
@@ -3424,7 +3434,7 @@ function rn(t, e) {
3424
3434
  // invalid field "uid" and missing field "sub" / "user_id".)
3425
3435
  e = createMockUserToken(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3426
3436
  const i = r.mockUserToken.sub || r.mockUserToken.user_id;
3427
- if (!i) throw new U(A, "mockUserToken must contain 'sub' or 'user_id' field!");
3437
+ if (!i) throw new U(I, "mockUserToken must contain 'sub' or 'user_id' field!");
3428
3438
  n = new l(i);
3429
3439
  }
3430
3440
  t._authCredentials = new B(new j(e, n));
@@ -3450,8 +3460,8 @@ function rn(t, e) {
3450
3460
  * @param firestore - The `Firestore` instance to terminate.
3451
3461
  * @returns A `Promise` that is resolved when the instance has been successfully
3452
3462
  * terminated.
3453
- */ function un(t) {
3454
- return t = ot(t, nn), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
3463
+ */ function an(t) {
3464
+ return t = ot(t, rn), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
3455
3465
  }
3456
3466
 
3457
3467
  /**
@@ -3519,7 +3529,7 @@ class cn {
3519
3529
  /**
3520
3530
  * The collection this `DocumentReference` belongs to.
3521
3531
  */ get parent() {
3522
- return new hn(this.firestore, this.converter, this._key.path.popLast());
3532
+ return new ln(this.firestore, this.converter, this._key.path.popLast());
3523
3533
  }
3524
3534
  withConverter(t) {
3525
3535
  return new cn(this.firestore, t, this._key);
@@ -3529,7 +3539,7 @@ class cn {
3529
3539
  /**
3530
3540
  * A `Query` refers to a query which you can read or listen to. You can also
3531
3541
  * construct refined `Query` objects by adding filters and ordering.
3532
- */ class an {
3542
+ */ class hn {
3533
3543
  // This is the lite version of the Query class in the main SDK.
3534
3544
  /** @hideconstructor protected */
3535
3545
  constructor(t,
@@ -3542,17 +3552,17 @@ class cn {
3542
3552
  this.type = "query", this.firestore = t;
3543
3553
  }
3544
3554
  withConverter(t) {
3545
- return new an(this.firestore, t, this._query);
3555
+ return new hn(this.firestore, t, this._query);
3546
3556
  }
3547
3557
  }
3548
3558
 
3549
3559
  /**
3550
3560
  * A `CollectionReference` object can be used for adding documents, getting
3551
3561
  * document references, and querying for documents (using {@link query}).
3552
- */ class hn extends an {
3562
+ */ class ln extends hn {
3553
3563
  /** @hideconstructor */
3554
3564
  constructor(t, e, n) {
3555
- super(t, e, new oe(n)), this._path = n,
3565
+ super(t, e, new ue(n)), this._path = n,
3556
3566
  /** The type of this Firestore reference. */
3557
3567
  this.type = "collection";
3558
3568
  }
@@ -3574,19 +3584,19 @@ class cn {
3574
3584
  /* converter= */ null, new et(t));
3575
3585
  }
3576
3586
  withConverter(t) {
3577
- return new hn(this.firestore, t, this._path);
3587
+ return new ln(this.firestore, t, this._path);
3578
3588
  }
3579
3589
  }
3580
3590
 
3581
- function ln(t, e, ...n) {
3582
- if (t = getModularInstance(t), nt("collection", "path", e), t instanceof nn) {
3591
+ function fn(t, e, ...n) {
3592
+ if (t = getModularInstance(t), nt("collection", "path", e), t instanceof rn) {
3583
3593
  const r = X.fromString(e, ...n);
3584
- return st(r), new hn(t, /* converter= */ null, r);
3594
+ return st(r), new ln(t, /* converter= */ null, r);
3585
3595
  }
3586
3596
  {
3587
- if (!(t instanceof cn || t instanceof hn)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3597
+ if (!(t instanceof cn || t instanceof ln)) throw new U(I, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3588
3598
  const r = t._path.child(X.fromString(e, ...n));
3589
- return st(r), new hn(t.firestore,
3599
+ return st(r), new ln(t.firestore,
3590
3600
  /* converter= */ null, r);
3591
3601
  }
3592
3602
  }
@@ -3603,32 +3613,32 @@ function ln(t, e, ...n) {
3603
3613
  * collection or subcollection with this ID as the last segment of its path
3604
3614
  * will be included. Cannot contain a slash.
3605
3615
  * @returns The created `Query`.
3606
- */ function fn(t, e) {
3607
- if (t = ot(t, nn), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
3608
- return new an(t,
3616
+ */ function dn(t, e) {
3617
+ if (t = ot(t, rn), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(I, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
3618
+ return new hn(t,
3609
3619
  /* converter= */ null,
3610
3620
  /**
3611
3621
  * Creates a new Query for a collection group query that matches all documents
3612
3622
  * within the provided collection group.
3613
3623
  */
3614
3624
  function(t) {
3615
- return new oe(X.emptyPath(), t);
3625
+ return new ue(X.emptyPath(), t);
3616
3626
  }(e));
3617
3627
  }
3618
3628
 
3619
- function dn(t, e, ...n) {
3629
+ function wn(t, e, ...n) {
3620
3630
  if (t = getModularInstance(t),
3621
3631
  // We allow omission of 'pathString' but explicitly prohibit passing in both
3622
3632
  // 'undefined' and 'null'.
3623
- 1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof nn) {
3633
+ 1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof rn) {
3624
3634
  const r = X.fromString(e, ...n);
3625
3635
  return rt(r), new cn(t,
3626
3636
  /* converter= */ null, new et(r));
3627
3637
  }
3628
3638
  {
3629
- if (!(t instanceof cn || t instanceof hn)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3639
+ if (!(t instanceof cn || t instanceof ln)) throw new U(I, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3630
3640
  const r = t._path.child(X.fromString(e, ...n));
3631
- return rt(r), new cn(t.firestore, t instanceof hn ? t.converter : null, new et(r));
3641
+ return rt(r), new cn(t.firestore, t instanceof ln ? t.converter : null, new et(r));
3632
3642
  }
3633
3643
  }
3634
3644
 
@@ -3639,8 +3649,8 @@ function dn(t, e, ...n) {
3639
3649
  * @param right - A reference to compare.
3640
3650
  * @returns true if the references point to the same location in the same
3641
3651
  * Firestore database.
3642
- */ function wn(t, e) {
3643
- return t = getModularInstance(t), e = getModularInstance(e), (t instanceof cn || t instanceof hn) && (e instanceof cn || e instanceof hn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
3652
+ */ function mn(t, e) {
3653
+ return t = getModularInstance(t), e = getModularInstance(e), (t instanceof cn || t instanceof ln) && (e instanceof cn || e instanceof ln) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
3644
3654
  }
3645
3655
 
3646
3656
  /**
@@ -3651,8 +3661,8 @@ function dn(t, e, ...n) {
3651
3661
  * @param right - A `Query` to compare.
3652
3662
  * @returns true if the references point to the same location in the same
3653
3663
  * Firestore database.
3654
- */ function mn(t, e) {
3655
- return t = getModularInstance(t), e = getModularInstance(e), t instanceof an && e instanceof an && (t.firestore === e.firestore && fe(t._query, e._query) && t.converter === e.converter);
3664
+ */ function pn(t, e) {
3665
+ return t = getModularInstance(t), e = getModularInstance(e), t instanceof hn && e instanceof hn && (t.firestore === e.firestore && de(t._query, e._query) && t.converter === e.converter);
3656
3666
  }
3657
3667
 
3658
3668
  /**
@@ -3678,7 +3688,7 @@ function dn(t, e, ...n) {
3678
3688
  *
3679
3689
  * Create a `FieldPath` by providing field names. If more than one field
3680
3690
  * name is provided, the path will point to a nested field in a document.
3681
- */ class pn {
3691
+ */ class yn {
3682
3692
  /**
3683
3693
  * Creates a `FieldPath` from the provided field names. If more than one field
3684
3694
  * name is provided, the path will point to a nested field in a document.
@@ -3686,7 +3696,7 @@ function dn(t, e, ...n) {
3686
3696
  * @param fieldNames - A list of field names.
3687
3697
  */
3688
3698
  constructor(...t) {
3689
- for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new U(A, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3699
+ for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new U(I, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3690
3700
  this._internalPath = new tt(t);
3691
3701
  }
3692
3702
  /**
@@ -3702,8 +3712,8 @@ function dn(t, e, ...n) {
3702
3712
  /**
3703
3713
  * Returns a special sentinel `FieldPath` to refer to the ID of a document.
3704
3714
  * It can be used in queries to sort or filter by the document ID.
3705
- */ function yn() {
3706
- return new pn("__name__");
3715
+ */ function _n() {
3716
+ return new yn("__name__");
3707
3717
  }
3708
3718
 
3709
3719
  /**
@@ -3724,7 +3734,7 @@ function dn(t, e, ...n) {
3724
3734
  */
3725
3735
  /**
3726
3736
  * An immutable object representing an array of bytes.
3727
- */ class _n {
3737
+ */ class gn {
3728
3738
  /** @hideconstructor */
3729
3739
  constructor(t) {
3730
3740
  this._byteString = t;
@@ -3736,9 +3746,9 @@ function dn(t, e, ...n) {
3736
3746
  * @param base64 - The Base64 string used to create the `Bytes` object.
3737
3747
  */ static fromBase64String(t) {
3738
3748
  try {
3739
- return new _n(It.fromBase64String(t));
3749
+ return new gn(At.fromBase64String(t));
3740
3750
  } catch (t) {
3741
- throw new U(A, "Failed to construct data from Base64 string: " + t);
3751
+ throw new U(I, "Failed to construct data from Base64 string: " + t);
3742
3752
  }
3743
3753
  }
3744
3754
  /**
@@ -3746,7 +3756,7 @@ function dn(t, e, ...n) {
3746
3756
  *
3747
3757
  * @param array - The Uint8Array used to create the `Bytes` object.
3748
3758
  */ static fromUint8Array(t) {
3749
- return new _n(It.fromUint8Array(t));
3759
+ return new gn(At.fromUint8Array(t));
3750
3760
  }
3751
3761
  /**
3752
3762
  * Returns the underlying bytes as a Base64-encoded string.
@@ -3798,7 +3808,7 @@ function dn(t, e, ...n) {
3798
3808
  /**
3799
3809
  * Sentinel values that can be used when writing document fields with `set()`
3800
3810
  * or `update()`.
3801
- */ class gn {
3811
+ */ class bn {
3802
3812
  /**
3803
3813
  * @param _methodName - The public API endpoint that returns this class.
3804
3814
  * @hideconstructor
@@ -3838,8 +3848,8 @@ function dn(t, e, ...n) {
3838
3848
  * @param longitude - The longitude as number between -180 and 180.
3839
3849
  */
3840
3850
  constructor(t, e) {
3841
- if (!isFinite(t) || t < -90 || t > 90) throw new U(A, "Latitude must be a number between -90 and 90, but was: " + t);
3842
- if (!isFinite(e) || e < -180 || e > 180) throw new U(A, "Longitude must be a number between -180 and 180, but was: " + e);
3851
+ if (!isFinite(t) || t < -90 || t > 90) throw new U(I, "Latitude must be a number between -90 and 90, but was: " + t);
3852
+ if (!isFinite(e) || e < -180 || e > 180) throw new U(I, "Longitude must be a number between -180 and 180, but was: " + e);
3843
3853
  this._lat = t, this._long = e;
3844
3854
  }
3845
3855
  /**
@@ -3889,25 +3899,25 @@ function dn(t, e, ...n) {
3889
3899
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3890
3900
  * See the License for the specific language governing permissions and
3891
3901
  * limitations under the License.
3892
- */ const bn = /^__.*__$/;
3902
+ */ const En = /^__.*__$/;
3893
3903
 
3894
- /** The result of parsing document data (e.g. for a setData call). */ class En {
3904
+ /** The result of parsing document data (e.g. for a setData call). */ class Tn {
3895
3905
  constructor(t, e, n) {
3896
3906
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3897
3907
  }
3898
3908
  toMutation(t, e) {
3899
- return null !== this.fieldMask ? new Te(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ee(t, this.data, e, this.fieldTransforms);
3909
+ return null !== this.fieldMask ? new Ae(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Te(t, this.data, e, this.fieldTransforms);
3900
3910
  }
3901
3911
  }
3902
3912
 
3903
- /** The result of parsing "update" data (i.e. for an updateData call). */ class Tn {
3913
+ /** The result of parsing "update" data (i.e. for an updateData call). */ class An {
3904
3914
  constructor(t,
3905
3915
  // The fieldMask does not include document transforms.
3906
3916
  e, n) {
3907
3917
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3908
3918
  }
3909
3919
  toMutation(t, e) {
3910
- return new Te(t, this.data, this.fieldMask, e, this.fieldTransforms);
3920
+ return new Ae(t, this.data, this.fieldMask, e, this.fieldTransforms);
3911
3921
  }
3912
3922
  }
3913
3923
 
@@ -3929,7 +3939,7 @@ function In(t) {
3929
3939
  }
3930
3940
  }
3931
3941
 
3932
- /** A "context" object passed around while parsing user data. */ class An {
3942
+ /** A "context" object passed around while parsing user data. */ class Rn {
3933
3943
  /**
3934
3944
  * Initializes a ParseContext with the given source and path.
3935
3945
  *
@@ -3961,7 +3971,7 @@ function In(t) {
3961
3971
  return this.settings.tt;
3962
3972
  }
3963
3973
  /** Returns a new context with the specified settings overwritten. */ et(t) {
3964
- return new An(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3974
+ return new Rn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3965
3975
  }
3966
3976
  nt(t) {
3967
3977
  var e;
@@ -3988,7 +3998,7 @@ function In(t) {
3988
3998
  });
3989
3999
  }
3990
4000
  ut(t) {
3991
- return Gn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
4001
+ return Qn(t, this.settings.methodName, this.settings.at || !1, this.path, this.settings.ct);
3992
4002
  }
3993
4003
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
3994
4004
  return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
@@ -4000,52 +4010,52 @@ function In(t) {
4000
4010
  }
4001
4011
  st(t) {
4002
4012
  if (0 === t.length) throw this.ut("Document fields must not be empty");
4003
- if (In(this.tt) && bn.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
4013
+ if (In(this.tt) && En.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
4004
4014
  }
4005
4015
  }
4006
4016
 
4007
4017
  /**
4008
4018
  * Helper for parsing raw user input (provided via the API) into internal model
4009
4019
  * classes.
4010
- */ class Rn {
4020
+ */ class Pn {
4011
4021
  constructor(t, e, n) {
4012
- this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || We(t);
4022
+ this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Ye(t);
4013
4023
  }
4014
4024
  /** Creates a new top-level parse context. */ ht(t, e, n, r = !1) {
4015
- return new An({
4025
+ return new Rn({
4016
4026
  tt: t,
4017
4027
  methodName: e,
4018
- at: n,
4028
+ ct: n,
4019
4029
  path: tt.emptyPath(),
4020
4030
  rt: !1,
4021
- ct: r
4031
+ at: r
4022
4032
  }, this.databaseId, this.q, this.ignoreUndefinedProperties);
4023
4033
  }
4024
4034
  }
4025
4035
 
4026
- function Pn(t) {
4027
- const e = t._freezeSettings(), n = We(t._databaseId);
4028
- return new Rn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4036
+ function Vn(t) {
4037
+ const e = t._freezeSettings(), n = Ye(t._databaseId);
4038
+ return new Pn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4029
4039
  }
4030
4040
 
4031
- /** Parse document data from a set() call. */ function Vn(t, e, n, r, s, i = {}) {
4041
+ /** Parse document data from a set() call. */ function Dn(t, e, n, r, s, i = {}) {
4032
4042
  const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
4033
- jn("Data must be an object, but it was:", o, r);
4034
- const u = Un(r, o);
4035
- let c, a;
4036
- if (i.merge) c = new Tt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4043
+ Mn("Data must be an object, but it was:", o, r);
4044
+ const u = kn(r, o);
4045
+ let a, c;
4046
+ if (i.merge) a = new Tt(o.fieldMask), c = o.fieldTransforms; else if (i.mergeFields) {
4037
4047
  const t = [];
4038
4048
  for (const r of i.mergeFields) {
4039
- const s = Mn(e, r, n);
4040
- if (!o.contains(s)) throw new U(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
4041
- Qn(t, s) || t.push(s);
4049
+ const s = Bn(e, r, n);
4050
+ if (!o.contains(s)) throw new U(I, `Field '${s}' is specified in your field mask but missing from your input data.`);
4051
+ Wn(t, s) || t.push(s);
4042
4052
  }
4043
- c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4044
- } else c = null, a = o.fieldTransforms;
4045
- return new En(new Bt(u), c, a);
4053
+ a = new Tt(t), c = o.fieldTransforms.filter((t => a.covers(t.field)));
4054
+ } else a = null, c = o.fieldTransforms;
4055
+ return new Tn(new zt(u), a, c);
4046
4056
  }
4047
4057
 
4048
- class Dn extends gn {
4058
+ class Nn extends bn {
4049
4059
  _toFieldTransform(t) {
4050
4060
  if (2 /* MergeSet */ !== t.tt) throw 1 /* Update */ === t.tt ? t.ut(`${this._methodName}() can only appear at the top level of your update data`) : t.ut(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
4051
4061
  // No transform to add for a delete, but we need to add it to our
@@ -4053,7 +4063,7 @@ class Dn extends gn {
4053
4063
  return t.fieldMask.push(t.path), null;
4054
4064
  }
4055
4065
  isEqual(t) {
4056
- return t instanceof Dn;
4066
+ return t instanceof Nn;
4057
4067
  }
4058
4068
  }
4059
4069
 
@@ -4072,32 +4082,32 @@ class Dn extends gn {
4072
4082
  * context.
4073
4083
  * @param context - The parent context.
4074
4084
  * @param arrayElement - Whether or not the FieldValue has an array.
4075
- */ function Nn(t, e, n) {
4076
- return new An({
4085
+ */ function $n(t, e, n) {
4086
+ return new Rn({
4077
4087
  tt: 3 /* Argument */ ,
4078
- at: e.settings.at,
4088
+ ct: e.settings.ct,
4079
4089
  methodName: t._methodName,
4080
4090
  rt: n
4081
4091
  }, e.databaseId, e.q, e.ignoreUndefinedProperties);
4082
4092
  }
4083
4093
 
4084
- class $n extends gn {
4094
+ class Sn extends bn {
4085
4095
  _toFieldTransform(t) {
4086
- return new ge(t.path, new me);
4096
+ return new be(t.path, new pe);
4087
4097
  }
4088
4098
  isEqual(t) {
4089
- return t instanceof $n;
4099
+ return t instanceof Sn;
4090
4100
  }
4091
4101
  }
4092
4102
 
4093
- class Sn extends gn {
4103
+ class xn extends bn {
4094
4104
  constructor(t, e) {
4095
4105
  super(t), this.lt = e;
4096
4106
  }
4097
4107
  _toFieldTransform(t) {
4098
- const e = Nn(this, t,
4099
- /*array=*/ !0), n = this.lt.map((t => Ln(t, e))), r = new pe(n);
4100
- return new ge(t.path, r);
4108
+ const e = $n(this, t,
4109
+ /*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new ye(n);
4110
+ return new be(t.path, r);
4101
4111
  }
4102
4112
  isEqual(t) {
4103
4113
  // TODO(mrschmidt): Implement isEquals
@@ -4105,14 +4115,14 @@ class Sn extends gn {
4105
4115
  }
4106
4116
  }
4107
4117
 
4108
- class Fn extends gn {
4118
+ class Fn extends bn {
4109
4119
  constructor(t, e) {
4110
4120
  super(t), this.lt = e;
4111
4121
  }
4112
4122
  _toFieldTransform(t) {
4113
- const e = Nn(this, t,
4114
- /*array=*/ !0), n = this.lt.map((t => Ln(t, e))), r = new ye(n);
4115
- return new ge(t.path, r);
4123
+ const e = $n(this, t,
4124
+ /*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new _e(n);
4125
+ return new be(t.path, r);
4116
4126
  }
4117
4127
  isEqual(t) {
4118
4128
  // TODO(mrschmidt): Implement isEquals
@@ -4120,13 +4130,13 @@ class Fn extends gn {
4120
4130
  }
4121
4131
  }
4122
4132
 
4123
- class xn extends gn {
4133
+ class qn extends bn {
4124
4134
  constructor(t, e) {
4125
4135
  super(t), this.ft = e;
4126
4136
  }
4127
4137
  _toFieldTransform(t) {
4128
- const e = new _e(t.q, de(t.q, this.ft));
4129
- return new ge(t.path, e);
4138
+ const e = new ge(t.q, we(t.q, this.ft));
4139
+ return new be(t.path, e);
4130
4140
  }
4131
4141
  isEqual(t) {
4132
4142
  // TODO(mrschmidt): Implement isEquals
@@ -4134,50 +4144,50 @@ class xn extends gn {
4134
4144
  }
4135
4145
  }
4136
4146
 
4137
- /** Parse update data from an update() call. */ function qn(t, e, n, r) {
4147
+ /** Parse update data from an update() call. */ function On(t, e, n, r) {
4138
4148
  const s = t.ht(1 /* Update */ , e, n);
4139
- jn("Data must be an object, but it was:", s, r);
4140
- const i = [], o = Bt.empty();
4149
+ Mn("Data must be an object, but it was:", s, r);
4150
+ const i = [], o = zt.empty();
4141
4151
  Et(r, ((t, r) => {
4142
- const u = zn(e, t, n);
4152
+ const u = Gn(e, t, n);
4143
4153
  // For Compat types, we have to "extract" the underlying types before
4144
4154
  // performing validation.
4145
4155
  r = getModularInstance(r);
4146
- const c = s.it(u);
4147
- if (r instanceof Dn)
4156
+ const a = s.it(u);
4157
+ if (r instanceof Nn)
4148
4158
  // Add it to the field mask, but don't add anything to updateData.
4149
4159
  i.push(u); else {
4150
- const t = Ln(r, c);
4160
+ const t = Un(r, a);
4151
4161
  null != t && (i.push(u), o.set(u, t));
4152
4162
  }
4153
4163
  }));
4154
4164
  const u = new Tt(i);
4155
- return new Tn(o, u, s.fieldTransforms);
4165
+ return new An(o, u, s.fieldTransforms);
4156
4166
  }
4157
4167
 
4158
- /** Parse update data from a list of field/value arguments. */ function On(t, e, n, r, s, i) {
4159
- const o = t.ht(1 /* Update */ , e, n), u = [ Mn(e, r, n) ], c = [ s ];
4160
- if (i.length % 2 != 0) throw new U(A, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4161
- for (let t = 0; t < i.length; t += 2) u.push(Mn(e, i[t])), c.push(i[t + 1]);
4162
- const a = [], l = Bt.empty();
4168
+ /** Parse update data from a list of field/value arguments. */ function Cn(t, e, n, r, s, i) {
4169
+ const o = t.ht(1 /* Update */ , e, n), u = [ Bn(e, r, n) ], a = [ s ];
4170
+ if (i.length % 2 != 0) throw new U(I, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4171
+ for (let t = 0; t < i.length; t += 2) u.push(Bn(e, i[t])), a.push(i[t + 1]);
4172
+ const c = [], l = zt.empty();
4163
4173
  // We iterate in reverse order to pick the last value for a field if the
4164
4174
  // user specified the field multiple times.
4165
- for (let t = u.length - 1; t >= 0; --t) if (!Qn(a, u[t])) {
4175
+ for (let t = u.length - 1; t >= 0; --t) if (!Wn(c, u[t])) {
4166
4176
  const e = u[t];
4167
- let n = c[t];
4177
+ let n = a[t];
4168
4178
  // For Compat types, we have to "extract" the underlying types before
4169
4179
  // performing validation.
4170
4180
  n = getModularInstance(n);
4171
4181
  const r = o.it(e);
4172
- if (n instanceof Dn)
4182
+ if (n instanceof Nn)
4173
4183
  // Add it to the field mask, but don't add anything to updateData.
4174
- a.push(e); else {
4175
- const t = Ln(n, r);
4176
- null != t && (a.push(e), l.set(e, t));
4184
+ c.push(e); else {
4185
+ const t = Un(n, r);
4186
+ null != t && (c.push(e), l.set(e, t));
4177
4187
  }
4178
4188
  }
4179
- const f = new Tt(a);
4180
- return new Tn(l, f, o.fieldTransforms);
4189
+ const f = new Tt(c);
4190
+ return new An(l, f, o.fieldTransforms);
4181
4191
  }
4182
4192
 
4183
4193
  /**
@@ -4186,8 +4196,8 @@ class xn extends gn {
4186
4196
  *
4187
4197
  * @param allowArrays - Whether the query value is an array that may directly
4188
4198
  * contain additional arrays (e.g. the operand of an `in` query).
4189
- */ function Cn(t, e, n, r = !1) {
4190
- return Ln(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4199
+ */ function Ln(t, e, n, r = !1) {
4200
+ return Un(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4191
4201
  }
4192
4202
 
4193
4203
  /**
@@ -4198,12 +4208,12 @@ class xn extends gn {
4198
4208
  * the source of the data being parsed, etc.
4199
4209
  * @returns The parsed value, or null if the value was a FieldValue sentinel
4200
4210
  * that should not be included in the resulting parsed data.
4201
- */ function Ln(t, e) {
4202
- if (kn(
4211
+ */ function Un(t, e) {
4212
+ if (jn(
4203
4213
  // Unwrap the API type from the Compat SDK. This will return the API type
4204
4214
  // from firestore-exp.
4205
- t = getModularInstance(t))) return jn("Unsupported field value:", e, t), Un(t, e);
4206
- if (t instanceof gn)
4215
+ t = getModularInstance(t))) return Mn("Unsupported field value:", e, t), kn(t, e);
4216
+ if (t instanceof bn)
4207
4217
  // FieldValues usually parse into transforms (except deleteField())
4208
4218
  // in which case we do not want to include this field in our parsed data
4209
4219
  // (as doing so will overwrite the field directly prior to the transform
@@ -4245,7 +4255,7 @@ class xn extends gn {
4245
4255
  const n = [];
4246
4256
  let r = 0;
4247
4257
  for (const s of t) {
4248
- let t = Ln(s, e.ot(r));
4258
+ let t = Un(s, e.ot(r));
4249
4259
  null == t && (
4250
4260
  // Just include nulls in the array for fields being replaced with a
4251
4261
  // sentinel.
@@ -4264,7 +4274,7 @@ class xn extends gn {
4264
4274
  if (null === (t = getModularInstance(t))) return {
4265
4275
  nullValue: "NULL_VALUE"
4266
4276
  };
4267
- if ("number" == typeof t) return de(e.q, t);
4277
+ if ("number" == typeof t) return we(e.q, t);
4268
4278
  if ("boolean" == typeof t) return {
4269
4279
  booleanValue: t
4270
4280
  };
@@ -4274,7 +4284,7 @@ class xn extends gn {
4274
4284
  if (t instanceof Date) {
4275
4285
  const n = gt.fromDate(t);
4276
4286
  return {
4277
- timestampValue: De(e.q, n)
4287
+ timestampValue: Ne(e.q, n)
4278
4288
  };
4279
4289
  }
4280
4290
  if (t instanceof gt) {
@@ -4283,7 +4293,7 @@ class xn extends gn {
4283
4293
  // truncation immediately without waiting for the backend to do that.
4284
4294
  const n = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4285
4295
  return {
4286
- timestampValue: De(e.q, n)
4296
+ timestampValue: Ne(e.q, n)
4287
4297
  };
4288
4298
  }
4289
4299
  if (t instanceof vn) return {
@@ -4292,8 +4302,8 @@ class xn extends gn {
4292
4302
  longitude: t.longitude
4293
4303
  }
4294
4304
  };
4295
- if (t instanceof _n) return {
4296
- bytesValue: Ne(e.q, t._byteString)
4305
+ if (t instanceof gn) return {
4306
+ bytesValue: $e(e.q, t._byteString)
4297
4307
  };
4298
4308
  if (t instanceof cn) {
4299
4309
  const n = e.databaseId, r = t.firestore._databaseId;
@@ -4313,13 +4323,13 @@ class xn extends gn {
4313
4323
  */ (t, e);
4314
4324
  }
4315
4325
 
4316
- function Un(t, e) {
4326
+ function kn(t, e) {
4317
4327
  const n = {};
4318
4328
  return !function(t) {
4319
4329
  for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
4320
4330
  return !0;
4321
4331
  }(t) ? Et(t, ((t, r) => {
4322
- const s = Ln(r, e.nt(t));
4332
+ const s = Un(r, e.nt(t));
4323
4333
  null != s && (n[t] = s);
4324
4334
  })) :
4325
4335
  // If we encounter an empty object, we explicitly add it to the update
@@ -4331,12 +4341,12 @@ function Un(t, e) {
4331
4341
  };
4332
4342
  }
4333
4343
 
4334
- function kn(t) {
4335
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof vn || t instanceof _n || t instanceof cn || t instanceof gn);
4344
+ function jn(t) {
4345
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof vn || t instanceof gn || t instanceof cn || t instanceof bn);
4336
4346
  }
4337
4347
 
4338
- function jn(t, e, n) {
4339
- if (!kn(n) || !function(t) {
4348
+ function Mn(t, e, n) {
4349
+ if (!jn(n) || !function(t) {
4340
4350
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
4341
4351
  }(n)) {
4342
4352
  const r = it(n);
@@ -4346,20 +4356,20 @@ function jn(t, e, n) {
4346
4356
 
4347
4357
  /**
4348
4358
  * Helper that calls fromDotSeparatedString() but wraps any error thrown.
4349
- */ function Mn(t, e, n) {
4359
+ */ function Bn(t, e, n) {
4350
4360
  if ((
4351
4361
  // If required, replace the FieldPath Compat class with with the firestore-exp
4352
4362
  // FieldPath.
4353
- e = getModularInstance(e)) instanceof pn) return e._internalPath;
4354
- if ("string" == typeof e) return zn(t, e);
4355
- throw Gn("Field path arguments must be of type string or ", t,
4363
+ e = getModularInstance(e)) instanceof yn) return e._internalPath;
4364
+ if ("string" == typeof e) return Gn(t, e);
4365
+ throw Qn("Field path arguments must be of type string or ", t,
4356
4366
  /* hasConverter= */ !1,
4357
4367
  /* path= */ void 0, n);
4358
4368
  }
4359
4369
 
4360
4370
  /**
4361
4371
  * Matches any characters in a field path string that are reserved.
4362
- */ const Bn = new RegExp("[~\\*/\\[\\]]");
4372
+ */ const zn = new RegExp("[~\\*/\\[\\]]");
4363
4373
 
4364
4374
  /**
4365
4375
  * Wraps fromDotSeparatedString with an error message about the method that
@@ -4369,29 +4379,29 @@ function jn(t, e, n) {
4369
4379
  * split on dots.
4370
4380
  * @param targetDoc - The document against which the field path will be
4371
4381
  * evaluated.
4372
- */ function zn(t, e, n) {
4373
- if (e.search(Bn) >= 0) throw Gn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4382
+ */ function Gn(t, e, n) {
4383
+ if (e.search(zn) >= 0) throw Qn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4374
4384
  /* hasConverter= */ !1,
4375
4385
  /* path= */ void 0, n);
4376
4386
  try {
4377
- return new pn(...e.split("."))._internalPath;
4387
+ return new yn(...e.split("."))._internalPath;
4378
4388
  } catch (r) {
4379
- throw Gn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4389
+ throw Qn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4380
4390
  /* hasConverter= */ !1,
4381
4391
  /* path= */ void 0, n);
4382
4392
  }
4383
4393
  }
4384
4394
 
4385
- function Gn(t, e, n, r, s) {
4395
+ function Qn(t, e, n, r, s) {
4386
4396
  const i = r && !r.isEmpty(), o = void 0 !== s;
4387
4397
  let u = `Function ${e}() called with invalid data`;
4388
4398
  n && (u += " (via `toFirestore()`)"), u += ". ";
4389
- let c = "";
4390
- return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
4391
- c += ")"), new U(A, u + t + c);
4399
+ let a = "";
4400
+ return (i || o) && (a += " (found", i && (a += ` in field ${r}`), o && (a += ` in document ${s}`),
4401
+ a += ")"), new U(I, u + t + a);
4392
4402
  }
4393
4403
 
4394
- /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Qn(t, e) {
4404
+ /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Wn(t, e) {
4395
4405
  return t.some((t => t.isEqual(e)));
4396
4406
  }
4397
4407
 
@@ -4419,7 +4429,7 @@ function Gn(t, e, n, r, s) {
4419
4429
  * For a `DocumentSnapshot` that points to a non-existing document, any data
4420
4430
  * access will return 'undefined'. You can use the `exists()` method to
4421
4431
  * explicitly verify a document's existence.
4422
- */ class Wn {
4432
+ */ class Yn {
4423
4433
  // Note: This class is stripped down version of the DocumentSnapshot in
4424
4434
  // the legacy SDK. The changes are:
4425
4435
  // - No support for SnapshotMetadata.
@@ -4455,7 +4465,7 @@ function Gn(t, e, n, r, s) {
4455
4465
  if (this._converter) {
4456
4466
  // We only want to use the converter and create a new DocumentSnapshot
4457
4467
  // if a converter has been provided.
4458
- const t = new Yn(this._firestore, this._userDataWriter, this._key, this._document,
4468
+ const t = new Hn(this._firestore, this._userDataWriter, this._key, this._document,
4459
4469
  /* converter= */ null);
4460
4470
  return this._converter.fromFirestore(t);
4461
4471
  }
@@ -4475,7 +4485,7 @@ function Gn(t, e, n, r, s) {
4475
4485
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4476
4486
  get(t) {
4477
4487
  if (this._document) {
4478
- const e = this._document.data.field(Jn("DocumentSnapshot.get", t));
4488
+ const e = this._document.data.field(Xn("DocumentSnapshot.get", t));
4479
4489
  if (null !== e) return this._userDataWriter.convertValue(e);
4480
4490
  }
4481
4491
  }
@@ -4491,7 +4501,7 @@ function Gn(t, e, n, r, s) {
4491
4501
  * `DocumentSnapshot`. Since query results contain only existing documents, the
4492
4502
  * `exists` property will always be true and `data()` will never return
4493
4503
  * 'undefined'.
4494
- */ class Yn extends Wn {
4504
+ */ class Hn extends Yn {
4495
4505
  /**
4496
4506
  * Retrieves all fields in the document as an `Object`.
4497
4507
  *
@@ -4509,7 +4519,7 @@ function Gn(t, e, n, r, s) {
4509
4519
  * array via the `docs` property or enumerated using the `forEach` method. The
4510
4520
  * number of documents can be determined via the `empty` and `size`
4511
4521
  * properties.
4512
- */ class Hn {
4522
+ */ class Kn {
4513
4523
  /** @hideconstructor */
4514
4524
  constructor(t, e) {
4515
4525
  this._docs = e, this.query = t;
@@ -4540,14 +4550,14 @@ function Gn(t, e, n, r, s) {
4540
4550
  * @param left - A snapshot to compare.
4541
4551
  * @param right - A snapshot to compare.
4542
4552
  * @returns true if the snapshots are equal.
4543
- */ function Kn(t, e) {
4544
- return t = getModularInstance(t), e = getModularInstance(e), t instanceof Wn && e instanceof Wn ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Hn && e instanceof Hn && (mn(t.query, e.query) && _t(t.docs, e.docs, Kn));
4553
+ */ function Jn(t, e) {
4554
+ return t = getModularInstance(t), e = getModularInstance(e), t instanceof Yn && e instanceof Yn ? 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 Kn && e instanceof Kn && (pn(t.query, e.query) && _t(t.docs, e.docs, Jn));
4545
4555
  }
4546
4556
 
4547
4557
  /**
4548
4558
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
4549
- */ function Jn(t, e) {
4550
- return "string" == typeof e ? zn(t, e) : e instanceof pn ? e._internalPath : e._delegate._internalPath;
4559
+ */ function Xn(t, e) {
4560
+ return "string" == typeof e ? Gn(t, e) : e instanceof yn ? e._internalPath : e._delegate._internalPath;
4551
4561
  }
4552
4562
 
4553
4563
  /**
@@ -4574,7 +4584,7 @@ function Gn(t, e, n, r, s) {
4574
4584
  * can then be passed to {@link query} to create a new query instance that
4575
4585
  * also contains this `QueryConstraint`.
4576
4586
  */
4577
- class Xn {}
4587
+ class Zn {}
4578
4588
 
4579
4589
  /**
4580
4590
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -4584,40 +4594,40 @@ class Xn {}
4584
4594
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4585
4595
  * @throws if any of the provided query constraints cannot be combined with the
4586
4596
  * existing or new constraints.
4587
- */ function Zn(t, ...e) {
4597
+ */ function tr(t, ...e) {
4588
4598
  for (const n of e) t = n._apply(t);
4589
4599
  return t;
4590
4600
  }
4591
4601
 
4592
- class tr extends Xn {
4602
+ class er extends Zn {
4593
4603
  constructor(t, e, n) {
4594
4604
  super(), this.dt = t, this.wt = e, this.yt = n, this.type = "where";
4595
4605
  }
4596
4606
  _apply(t) {
4597
- const e = Pn(t.firestore), n = function(t, e, n, r, s, i, o) {
4607
+ const e = Vn(t.firestore), n = function(t, e, n, r, s, i, o) {
4598
4608
  let u;
4599
4609
  if (s.isKeyField()) {
4600
- if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
4610
+ if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(I, `Invalid Query. You can't perform '${i}' queries on documentId().`);
4601
4611
  if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
4602
- mr(o, i);
4612
+ pr(o, i);
4603
4613
  const e = [];
4604
- for (const n of o) e.push(wr(r, t, n));
4614
+ for (const n of o) e.push(mr(r, t, n));
4605
4615
  u = {
4606
4616
  arrayValue: {
4607
4617
  values: e
4608
4618
  }
4609
4619
  };
4610
- } else u = wr(r, t, o);
4611
- } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || mr(o, i),
4612
- u = Cn(n, e, o,
4620
+ } else u = mr(r, t, o);
4621
+ } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || pr(o, i),
4622
+ u = Ln(n, e, o,
4613
4623
  /* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
4614
- const c = Wt.create(s, i, u);
4624
+ const a = Yt.create(s, i, u);
4615
4625
  return function(t, e) {
4616
4626
  if (e.N()) {
4617
4627
  const n = ce(t);
4618
- if (null !== n && !n.isEqual(e.field)) throw new U(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
4619
- const r = ue(t);
4620
- null !== r && pr(t, e.field, r);
4628
+ if (null !== n && !n.isEqual(e.field)) throw new U(I, `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()}'`);
4629
+ const r = ae(t);
4630
+ null !== r && yr(t, e.field, r);
4621
4631
  }
4622
4632
  const n = function(t, e) {
4623
4633
  for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
@@ -4658,12 +4668,12 @@ class tr extends Xn {
4658
4668
  }(e.op));
4659
4669
  if (null !== n)
4660
4670
  // Special case when it's a duplicate op to give a slightly clearer error message.
4661
- throw n === e.op ? new U(A, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
4662
- }(t, c), c;
4671
+ throw n === e.op ? new U(I, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(I, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
4672
+ }(t, a), a;
4663
4673
  }(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
4664
- return new an(t.firestore, t.converter, function(t, e) {
4674
+ return new hn(t.firestore, t.converter, function(t, e) {
4665
4675
  const n = t.filters.concat([ e ]);
4666
- return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4676
+ return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4667
4677
  }(t._query, n));
4668
4678
  }
4669
4679
  }
@@ -4678,25 +4688,25 @@ class tr extends Xn {
4678
4688
  * "&lt;=", "!=").
4679
4689
  * @param value - The value for comparison
4680
4690
  * @returns The created {@link Query}.
4681
- */ function er(t, e, n) {
4682
- const r = e, s = Jn("where", t);
4683
- return new tr(s, r, n);
4691
+ */ function nr(t, e, n) {
4692
+ const r = e, s = Xn("where", t);
4693
+ return new er(s, r, n);
4684
4694
  }
4685
4695
 
4686
- class nr extends Xn {
4696
+ class rr extends Zn {
4687
4697
  constructor(t, e) {
4688
4698
  super(), this.dt = t, this._t = e, this.type = "orderBy";
4689
4699
  }
4690
4700
  _apply(t) {
4691
4701
  const e = function(t, e, n) {
4692
- if (null !== t.startAt) throw new U(A, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4693
- if (null !== t.endAt) throw new U(A, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4694
- const r = new re(e, n);
4702
+ if (null !== t.startAt) throw new U(I, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4703
+ if (null !== t.endAt) throw new U(I, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4704
+ const r = new se(e, n);
4695
4705
  return function(t, e) {
4696
- if (null === ue(t)) {
4706
+ if (null === ae(t)) {
4697
4707
  // This is the first order by. It must match any inequality.
4698
4708
  const n = ce(t);
4699
- null !== n && pr(t, n, e.field);
4709
+ null !== n && yr(t, n, e.field);
4700
4710
  }
4701
4711
  }(t, r), r;
4702
4712
  }
@@ -4711,10 +4721,10 @@ class nr extends Xn {
4711
4721
  * of the query or if any of the fields in the order by are an uncommitted
4712
4722
  * server timestamp.
4713
4723
  */ (t._query, this.dt, this._t);
4714
- return new an(t.firestore, t.converter, function(t, e) {
4724
+ return new hn(t.firestore, t.converter, function(t, e) {
4715
4725
  // TODO(dimond): validate that orderBy does not list the same key twice.
4716
4726
  const n = t.explicitOrderBy.concat([ e ]);
4717
- return new oe(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4727
+ return new ue(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4718
4728
  }(t._query, e));
4719
4729
  }
4720
4730
  }
@@ -4727,19 +4737,19 @@ class nr extends Xn {
4727
4737
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
4728
4738
  * not specified, order will be ascending.
4729
4739
  * @returns The created {@link Query}.
4730
- */ function rr(t, e = "asc") {
4731
- const n = e, r = Jn("orderBy", t);
4732
- return new nr(r, n);
4740
+ */ function sr(t, e = "asc") {
4741
+ const n = e, r = Xn("orderBy", t);
4742
+ return new rr(r, n);
4733
4743
  }
4734
4744
 
4735
- class sr extends Xn {
4745
+ class ir extends Zn {
4736
4746
  constructor(t, e, n) {
4737
- super(), this.type = t, this.gt = e, this.vt = n;
4747
+ super(), this.type = t, this.gt = e, this.bt = n;
4738
4748
  }
4739
4749
  _apply(t) {
4740
- return new an(t.firestore, t.converter, function(t, e, n) {
4741
- return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4742
- }(t._query, this.gt, this.vt));
4750
+ return new hn(t.firestore, t.converter, function(t, e, n) {
4751
+ return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4752
+ }(t._query, this.gt, this.bt));
4743
4753
  }
4744
4754
  }
4745
4755
 
@@ -4748,8 +4758,8 @@ class sr extends Xn {
4748
4758
  *
4749
4759
  * @param limit - The maximum number of items to return.
4750
4760
  * @returns The created {@link Query}.
4751
- */ function ir(t) {
4752
- return ut("limit", t), new sr("limit", t, "F" /* First */);
4761
+ */ function or(t) {
4762
+ return ut("limit", t), new ir("limit", t, "F" /* First */);
4753
4763
  }
4754
4764
 
4755
4765
  /**
@@ -4760,55 +4770,55 @@ class sr extends Xn {
4760
4770
  *
4761
4771
  * @param limit - The maximum number of items to return.
4762
4772
  * @returns The created {@link Query}.
4763
- */ function or(t) {
4764
- return ut("limitToLast", t), new sr("limitToLast", t, "L" /* Last */);
4773
+ */ function ur(t) {
4774
+ return ut("limitToLast", t), new ir("limitToLast", t, "L" /* Last */);
4765
4775
  }
4766
4776
 
4767
- class ur extends Xn {
4777
+ class ar extends Zn {
4768
4778
  constructor(t, e, n) {
4769
- super(), this.type = t, this.bt = e, this.Et = n;
4779
+ super(), this.type = t, this.vt = e, this.Et = n;
4770
4780
  }
4771
4781
  _apply(t) {
4772
- const e = dr(t, this.type, this.bt, this.Et);
4773
- return new an(t.firestore, t.converter, function(t, e) {
4774
- return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4782
+ const e = wr(t, this.type, this.vt, this.Et);
4783
+ return new hn(t.firestore, t.converter, function(t, e) {
4784
+ return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4775
4785
  }(t._query, e));
4776
4786
  }
4777
4787
  }
4778
4788
 
4779
4789
  function cr(...t) {
4780
- return new ur("startAt", t,
4790
+ return new ar("startAt", t,
4781
4791
  /*inclusive=*/ !0);
4782
4792
  }
4783
4793
 
4784
- function ar(...t) {
4785
- return new ur("startAfter", t,
4794
+ function hr(...t) {
4795
+ return new ar("startAfter", t,
4786
4796
  /*inclusive=*/ !1);
4787
4797
  }
4788
4798
 
4789
- class hr extends Xn {
4799
+ class lr extends Zn {
4790
4800
  constructor(t, e, n) {
4791
- super(), this.type = t, this.bt = e, this.Et = n;
4801
+ super(), this.type = t, this.vt = e, this.Et = n;
4792
4802
  }
4793
4803
  _apply(t) {
4794
- const e = dr(t, this.type, this.bt, this.Et);
4795
- return new an(t.firestore, t.converter, function(t, e) {
4796
- return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4804
+ const e = wr(t, this.type, this.vt, this.Et);
4805
+ return new hn(t.firestore, t.converter, function(t, e) {
4806
+ return new ue(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4797
4807
  }(t._query, e));
4798
4808
  }
4799
4809
  }
4800
4810
 
4801
- function lr(...t) {
4802
- return new hr("endBefore", t,
4811
+ function fr(...t) {
4812
+ return new lr("endBefore", t,
4803
4813
  /*inclusive=*/ !1);
4804
4814
  }
4805
4815
 
4806
- function fr(...t) {
4807
- return new hr("endAt", t, /*inclusive=*/ !0);
4816
+ function dr(...t) {
4817
+ return new lr("endAt", t, /*inclusive=*/ !0);
4808
4818
  }
4809
4819
 
4810
- /** Helper function to create a bound from a document or fields */ function dr(t, e, n, r) {
4811
- if (n[0] = getModularInstance(n[0]), n[0] instanceof Wn) return function(t, e, n, r, s) {
4820
+ /** Helper function to create a bound from a document or fields */ function wr(t, e, n, r) {
4821
+ if (n[0] = getModularInstance(n[0]), n[0] instanceof Yn) return function(t, e, n, r, s) {
4812
4822
  if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
4813
4823
  const i = [];
4814
4824
  // Because people expect to continue/end a query at the exact document
@@ -4818,42 +4828,42 @@ function fr(...t) {
4818
4828
  // the provided document. Without the key (by using the explicit sort
4819
4829
  // orders), multiple documents could match the position, yielding duplicate
4820
4830
  // results.
4821
- for (const n of he(t)) if (n.field.isKeyField()) i.push(Ct(e, r.key)); else {
4831
+ for (const n of le(t)) if (n.field.isKeyField()) i.push(Lt(e, r.key)); else {
4822
4832
  const t = r.data.field(n.field);
4823
- if (Dt(t)) throw new U(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4833
+ if (Dt(t)) throw new U(I, '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.)');
4824
4834
  if (null === t) {
4825
4835
  const t = n.field.canonicalString();
4826
- throw new U(A, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
4836
+ throw new U(I, `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.`);
4827
4837
  }
4828
4838
  i.push(t);
4829
4839
  }
4830
- return new ne(i, s);
4840
+ return new re(i, s);
4831
4841
  }
4832
4842
  /**
4833
4843
  * Converts a list of field values to a `Bound` for the given query.
4834
4844
  */ (t._query, t.firestore._databaseId, e, n[0]._document, r);
4835
4845
  {
4836
- const s = Pn(t.firestore);
4846
+ const s = Vn(t.firestore);
4837
4847
  return function(t, e, n, r, s, i) {
4838
4848
  // Use explicit order by's because it has to match the query the user made
4839
4849
  const o = t.explicitOrderBy;
4840
- if (s.length > o.length) throw new U(A, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
4850
+ if (s.length > o.length) throw new U(I, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
4841
4851
  const u = [];
4842
4852
  for (let i = 0; i < s.length; i++) {
4843
- const c = s[i];
4853
+ const a = s[i];
4844
4854
  if (o[i].field.isKeyField()) {
4845
- if ("string" != typeof c) throw new U(A, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
4846
- if (!ae(t) && -1 !== c.indexOf("/")) throw new U(A, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
4847
- const n = t.path.child(X.fromString(c));
4848
- if (!et.isDocumentKey(n)) throw new U(A, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
4855
+ if ("string" != typeof a) throw new U(I, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof a}`);
4856
+ if (!he(t) && -1 !== a.indexOf("/")) throw new U(I, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${a}' contains a slash.`);
4857
+ const n = t.path.child(X.fromString(a));
4858
+ if (!et.isDocumentKey(n)) throw new U(I, `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.`);
4849
4859
  const s = new et(n);
4850
- u.push(Ct(e, s));
4860
+ u.push(Lt(e, s));
4851
4861
  } else {
4852
- const t = Cn(n, r, c);
4862
+ const t = Ln(n, r, a);
4853
4863
  u.push(t);
4854
4864
  }
4855
4865
  }
4856
- return new ne(u, i);
4866
+ return new re(u, i);
4857
4867
  }
4858
4868
  /**
4859
4869
  * Parses the given `documentIdValue` into a `ReferenceValue`, throwing
@@ -4863,28 +4873,28 @@ function fr(...t) {
4863
4873
  }
4864
4874
  }
4865
4875
 
4866
- function wr(t, e, n) {
4876
+ function mr(t, e, n) {
4867
4877
  if ("string" == typeof (n = getModularInstance(n))) {
4868
- if ("" === n) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4869
- if (!ae(e) && -1 !== n.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
4878
+ if ("" === n) throw new U(I, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4879
+ if (!he(e) && -1 !== n.indexOf("/")) throw new U(I, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
4870
4880
  const r = e.path.child(X.fromString(n));
4871
- if (!et.isDocumentKey(r)) throw new U(A, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
4872
- return Ct(t, new et(r));
4881
+ if (!et.isDocumentKey(r)) throw new U(I, `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}).`);
4882
+ return Lt(t, new et(r));
4873
4883
  }
4874
- if (n instanceof cn) return Ct(t, n._key);
4875
- throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(n)}.`);
4884
+ if (n instanceof cn) return Lt(t, n._key);
4885
+ throw new U(I, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(n)}.`);
4876
4886
  }
4877
4887
 
4878
4888
  /**
4879
4889
  * Validates that the value passed into a disjunctive filter satisfies all
4880
4890
  * array requirements.
4881
- */ function mr(t, e) {
4882
- if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
4883
- if (t.length > 10) throw new U(A, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
4891
+ */ function pr(t, e) {
4892
+ if (!Array.isArray(t) || 0 === t.length) throw new U(I, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
4893
+ if (t.length > 10) throw new U(I, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
4884
4894
  }
4885
4895
 
4886
- function pr(t, e, n) {
4887
- if (!n.isEqual(e)) throw new U(A, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
4896
+ function yr(t, e, n) {
4897
+ if (!n.isEqual(e)) throw new U(I, `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.`);
4888
4898
  }
4889
4899
 
4890
4900
  /**
@@ -4934,7 +4944,7 @@ function pr(t, e, n) {
4934
4944
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
4935
4945
  * call.
4936
4946
  */
4937
- function yr(t, e, n) {
4947
+ function _r(t, e, n) {
4938
4948
  let r;
4939
4949
  // Cast to `any` in order to satisfy the union type constraint on
4940
4950
  // toFirestore().
@@ -4943,9 +4953,9 @@ function yr(t, e, n) {
4943
4953
  r;
4944
4954
  }
4945
4955
 
4946
- class _r extends class {
4956
+ class gr extends class {
4947
4957
  convertValue(t, e = "none") {
4948
- switch (St(t)) {
4958
+ switch (xt(t)) {
4949
4959
  case 0 /* NullValue */ :
4950
4960
  return null;
4951
4961
 
@@ -5014,7 +5024,7 @@ class _r extends class {
5014
5024
  }
5015
5025
  convertDocumentKey(t, e) {
5016
5026
  const n = X.fromString(t);
5017
- v(Qe(n));
5027
+ b(We(n));
5018
5028
  const r = new K(n.get(1), n.get(3)), s = new et(n.popFirst(5));
5019
5029
  return r.isEqual(e) ||
5020
5030
  // TODO(b/64130202): Somehow support foreign references.
@@ -5026,7 +5036,7 @@ class _r extends class {
5026
5036
  super(), this.firestore = t;
5027
5037
  }
5028
5038
  convertBytes(t) {
5029
- return new _n(t);
5039
+ return new gn(t);
5030
5040
  }
5031
5041
  convertReference(t) {
5032
5042
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
@@ -5046,12 +5056,12 @@ class _r extends class {
5046
5056
  * @param reference - The reference of the document to fetch.
5047
5057
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
5048
5058
  * document contents.
5049
- */ function gr(t) {
5050
- const e = tn((t = ot(t, cn)).firestore), n = new _r(t.firestore);
5051
- return Je(e, [ t._key ]).then((e => {
5052
- v(1 === e.length);
5059
+ */ function br(t) {
5060
+ const e = en((t = ot(t, cn)).firestore), n = new gr(t.firestore);
5061
+ return Xe(e, [ t._key ]).then((e => {
5062
+ b(1 === e.length);
5053
5063
  const r = e[0];
5054
- return new Wn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5064
+ return new Yn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5055
5065
  }));
5056
5066
  }
5057
5067
 
@@ -5069,30 +5079,30 @@ class _r extends class {
5069
5079
  */ function vr(t) {
5070
5080
  !function(t) {
5071
5081
  if ("L" /* Last */ === t.limitType && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
5072
- }((t = ot(t, an))._query);
5073
- const e = tn(t.firestore), n = new _r(t.firestore);
5074
- return Xe(e, t._query).then((e => {
5075
- const r = e.map((e => new Yn(t.firestore, n, e.key, e, t.converter)));
5082
+ }((t = ot(t, hn))._query);
5083
+ const e = en(t.firestore), n = new gr(t.firestore);
5084
+ return Ze(e, t._query).then((e => {
5085
+ const r = e.map((e => new Hn(t.firestore, n, e.key, e, t.converter)));
5076
5086
  return "L" /* Last */ === t._query.limitType &&
5077
5087
  // Limit to last queries reverse the orderBy constraint that was
5078
5088
  // specified by the user. As such, we need to reverse the order of the
5079
5089
  // results to return the documents in the expected order.
5080
- r.reverse(), new Hn(t, r);
5090
+ r.reverse(), new Kn(t, r);
5081
5091
  }));
5082
5092
  }
5083
5093
 
5084
- function br(t, e, n) {
5085
- const r = yr((t = ot(t, cn)).converter, e, n), s = Vn(Pn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5086
- return Ke(tn(t.firestore), [ s.toMutation(t._key, ve.none()) ]);
5094
+ function Er(t, e, n) {
5095
+ const r = _r((t = ot(t, cn)).converter, e, n), s = Dn(Vn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5096
+ return Je(en(t.firestore), [ s.toMutation(t._key, ve.none()) ]);
5087
5097
  }
5088
5098
 
5089
- function Er(t, e, n, ...r) {
5090
- const s = Pn((t = ot(t, cn)).firestore);
5099
+ function Tr(t, e, n, ...r) {
5100
+ const s = Vn((t = ot(t, cn)).firestore);
5091
5101
  // For Compat types, we have to "extract" the underlying types before
5092
5102
  // performing validation.
5093
5103
  let i;
5094
- i = "string" == typeof (e = getModularInstance(e)) || e instanceof pn ? On(s, "updateDoc", t._key, e, n, r) : qn(s, "updateDoc", t._key, e);
5095
- return Ke(tn(t.firestore), [ i.toMutation(t._key, ve.exists(!0)) ]);
5104
+ i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(s, "updateDoc", t._key, e, n, r) : On(s, "updateDoc", t._key, e);
5105
+ return Je(en(t.firestore), [ i.toMutation(t._key, ve.exists(!0)) ]);
5096
5106
  }
5097
5107
 
5098
5108
  /**
@@ -5106,8 +5116,8 @@ function Er(t, e, n, ...r) {
5106
5116
  * @param reference - A reference to the document to delete.
5107
5117
  * @returns A `Promise` resolved once the document has been successfully
5108
5118
  * deleted from the backend.
5109
- */ function Tr(t) {
5110
- return Ke(tn((t = ot(t, cn)).firestore), [ new Ie(t._key, ve.none()) ]);
5119
+ */ function Ar(t) {
5120
+ return Je(en((t = ot(t, cn)).firestore), [ new Ie(t._key, ve.none()) ]);
5111
5121
  }
5112
5122
 
5113
5123
  /**
@@ -5125,8 +5135,8 @@ function Er(t, e, n, ...r) {
5125
5135
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
5126
5136
  * newly created document after it has been written to the backend.
5127
5137
  */ function Ir(t, e) {
5128
- const n = dn(t = ot(t, hn)), r = yr(t.converter, e), s = Vn(Pn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5129
- return Ke(tn(t.firestore), [ s.toMutation(n._key, ve.exists(!1)) ]).then((() => n));
5138
+ const n = wn(t = ot(t, ln)), r = _r(t.converter, e), s = Dn(Vn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5139
+ return Je(en(t.firestore), [ s.toMutation(n._key, ve.exists(!1)) ]).then((() => n));
5130
5140
  }
5131
5141
 
5132
5142
  /**
@@ -5148,15 +5158,15 @@ function Er(t, e, n, ...r) {
5148
5158
  /**
5149
5159
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
5150
5160
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
5151
- */ function Ar() {
5152
- return new Dn("deleteField");
5161
+ */ function Rr() {
5162
+ return new Nn("deleteField");
5153
5163
  }
5154
5164
 
5155
5165
  /**
5156
5166
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
5157
5167
  * include a server-generated timestamp in the written data.
5158
- */ function Rr() {
5159
- return new $n("serverTimestamp");
5168
+ */ function Pr() {
5169
+ return new Sn("serverTimestamp");
5160
5170
  }
5161
5171
 
5162
5172
  /**
@@ -5170,10 +5180,10 @@ function Er(t, e, n, ...r) {
5170
5180
  * @param elements - The elements to union into the array.
5171
5181
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5172
5182
  * `updateDoc()`.
5173
- */ function Pr(...t) {
5183
+ */ function Vr(...t) {
5174
5184
  // NOTE: We don't actually parse the data until it's used in set() or
5175
5185
  // update() since we'd need the Firestore instance to do this.
5176
- return new Sn("arrayUnion", t);
5186
+ return new xn("arrayUnion", t);
5177
5187
  }
5178
5188
 
5179
5189
  /**
@@ -5186,7 +5196,7 @@ function Er(t, e, n, ...r) {
5186
5196
  * @param elements - The elements to remove from the array.
5187
5197
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5188
5198
  * `updateDoc()`
5189
- */ function Vr(...t) {
5199
+ */ function Dr(...t) {
5190
5200
  // NOTE: We don't actually parse the data until it's used in set() or
5191
5201
  // update() since we'd need the Firestore instance to do this.
5192
5202
  return new Fn("arrayRemove", t);
@@ -5210,8 +5220,8 @@ function Er(t, e, n, ...r) {
5210
5220
  * @param n - The value to increment by.
5211
5221
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5212
5222
  * `updateDoc()`
5213
- */ function Dr(t) {
5214
- return new xn("increment", t);
5223
+ */ function Nr(t) {
5224
+ return new qn("increment", t);
5215
5225
  }
5216
5226
 
5217
5227
  /**
@@ -5237,24 +5247,24 @@ function Er(t, e, n, ...r) {
5237
5247
  * provides methods for adding writes to the write batch. None of the writes
5238
5248
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
5239
5249
  * called.
5240
- */ class Nr {
5250
+ */ class $r {
5241
5251
  /** @hideconstructor */
5242
5252
  constructor(t, e) {
5243
5253
  this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
5244
- this._dataReader = Pn(t);
5254
+ this._dataReader = Vn(t);
5245
5255
  }
5246
5256
  set(t, e, n) {
5247
5257
  this._verifyNotCommitted();
5248
- const r = $r(t, this._firestore), s = yr(r.converter, e, n), i = Vn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5258
+ const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5249
5259
  return this._mutations.push(i.toMutation(r._key, ve.none())), this;
5250
5260
  }
5251
5261
  update(t, e, n, ...r) {
5252
5262
  this._verifyNotCommitted();
5253
- const s = $r(t, this._firestore);
5263
+ const s = Sr(t, this._firestore);
5254
5264
  // For Compat types, we have to "extract" the underlying types before
5255
5265
  // performing validation.
5256
5266
  let i;
5257
- return i = "string" == typeof (e = getModularInstance(e)) || e instanceof pn ? On(this._dataReader, "WriteBatch.update", s._key, e, n, r) : qn(this._dataReader, "WriteBatch.update", s._key, e),
5267
+ return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : On(this._dataReader, "WriteBatch.update", s._key, e),
5258
5268
  this._mutations.push(i.toMutation(s._key, ve.exists(!0))), this;
5259
5269
  }
5260
5270
  /**
@@ -5264,7 +5274,7 @@ function Er(t, e, n, ...r) {
5264
5274
  * @returns This `WriteBatch` instance. Used for chaining method calls.
5265
5275
  */ delete(t) {
5266
5276
  this._verifyNotCommitted();
5267
- const e = $r(t, this._firestore);
5277
+ const e = Sr(t, this._firestore);
5268
5278
  return this._mutations = this._mutations.concat(new Ie(e._key, ve.none())), this;
5269
5279
  }
5270
5280
  /**
@@ -5286,8 +5296,8 @@ function Er(t, e, n, ...r) {
5286
5296
  }
5287
5297
  }
5288
5298
 
5289
- function $r(t, e) {
5290
- if ((t = getModularInstance(t)).firestore !== e) throw new U(A, "Provided document reference is from a different Firestore instance.");
5299
+ function Sr(t, e) {
5300
+ if ((t = getModularInstance(t)).firestore !== e) throw new U(I, "Provided document reference is from a different Firestore instance.");
5291
5301
  return t;
5292
5302
  }
5293
5303
 
@@ -5303,9 +5313,9 @@ function $r(t, e) {
5303
5313
  *
5304
5314
  * @returns A `WriteBatch` that can be used to atomically execute multiple
5305
5315
  * writes.
5306
- */ function Sr(t) {
5307
- const e = tn(t = ot(t, nn));
5308
- return new Nr(t, (t => Ke(e, t)));
5316
+ */ function xr(t) {
5317
+ const e = en(t = ot(t, rn));
5318
+ return new $r(t, (t => Je(e, t)));
5309
5319
  }
5310
5320
 
5311
5321
  /**
@@ -5346,8 +5356,8 @@ function $r(t, e) {
5346
5356
  this.writtenDocs = new Set;
5347
5357
  }
5348
5358
  async lookup(t) {
5349
- if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(A, "Firestore transactions require all reads to be executed before all writes.");
5350
- const e = await Je(this.datastore, t);
5359
+ if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(I, "Firestore transactions require all reads to be executed before all writes.");
5360
+ const e = await Xe(this.datastore, t);
5351
5361
  return e.forEach((t => this.recordVersion(t))), e;
5352
5362
  }
5353
5363
  set(t, e) {
@@ -5375,21 +5385,21 @@ function $r(t, e) {
5375
5385
  // a `verify` operation.
5376
5386
  t.forEach(((t, e) => {
5377
5387
  const n = et.fromPath(e);
5378
- this.mutations.push(new Ae(n, this.precondition(n)));
5379
- })), await Ke(this.datastore, this.mutations), this.committed = !0;
5388
+ this.mutations.push(new Re(n, this.precondition(n)));
5389
+ })), await Je(this.datastore, this.mutations), this.committed = !0;
5380
5390
  }
5381
5391
  recordVersion(t) {
5382
5392
  let e;
5383
5393
  if (t.isFoundDocument()) e = t.version; else {
5384
5394
  if (!t.isNoDocument()) throw g();
5385
5395
  // For deleted docs, we must use baseVersion 0 when we overwrite them.
5386
- e = vt.min();
5396
+ e = bt.min();
5387
5397
  }
5388
5398
  const n = this.readVersions.get(t.key.toString());
5389
5399
  if (n) {
5390
5400
  if (!e.isEqual(n))
5391
5401
  // This transaction will fail no matter what.
5392
- throw new U(F, "Document version changed between two reads.");
5402
+ throw new U(x, "Document version changed between two reads.");
5393
5403
  } else this.readVersions.set(t.key.toString(), e);
5394
5404
  }
5395
5405
  /**
@@ -5406,7 +5416,7 @@ function $r(t, e) {
5406
5416
  // The first time a document is written, we want to take into account the
5407
5417
  // read time and existence
5408
5418
  if (!this.writtenDocs.has(t.toString()) && e) {
5409
- if (e.isEqual(vt.min()))
5419
+ if (e.isEqual(bt.min()))
5410
5420
  // The document doesn't exist, so fail the transaction.
5411
5421
  // This has to be validated locally because you can't send a
5412
5422
  // precondition that a document does not exist without changing the
@@ -5416,7 +5426,7 @@ function $r(t, e) {
5416
5426
  // express that to the backend, we have to validate locally.
5417
5427
  // Note: this can change once we can send separate verify writes in the
5418
5428
  // transaction.
5419
- throw new U(A, "Can't update a document that doesn't exist.");
5429
+ throw new U(I, "Can't update a document that doesn't exist.");
5420
5430
  // Document exists, base precondition on document update time.
5421
5431
  return ve.updateTime(e);
5422
5432
  }
@@ -5430,6 +5440,25 @@ function $r(t, e) {
5430
5440
  ensureCommitNotCalled() {}
5431
5441
  }
5432
5442
 
5443
+ /**
5444
+ * @license
5445
+ * Copyright 2022 Google LLC
5446
+ *
5447
+ * Licensed under the Apache License, Version 2.0 (the "License");
5448
+ * you may not use this file except in compliance with the License.
5449
+ * You may obtain a copy of the License at
5450
+ *
5451
+ * http://www.apache.org/licenses/LICENSE-2.0
5452
+ *
5453
+ * Unless required by applicable law or agreed to in writing, software
5454
+ * distributed under the License is distributed on an "AS IS" BASIS,
5455
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5456
+ * See the License for the specific language governing permissions and
5457
+ * limitations under the License.
5458
+ */ const qr = {
5459
+ maxAttempts: 5
5460
+ };
5461
+
5433
5462
  /**
5434
5463
  * @license
5435
5464
  * Copyright 2019 Google LLC
@@ -5450,16 +5479,16 @@ function $r(t, e) {
5450
5479
  * TransactionRunner encapsulates the logic needed to run and retry transactions
5451
5480
  * with backoff.
5452
5481
  */
5453
- class xr {
5454
- constructor(t, e, n, r) {
5455
- this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
5456
- this.Tt = 5, this.It = new Ye(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5482
+ class Or {
5483
+ constructor(t, e, n, r, s) {
5484
+ this.asyncQueue = t, this.datastore = e, this.options = n, this.updateFunction = r,
5485
+ this.deferred = s, this.Tt = n.maxAttempts, this.At = new He(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5457
5486
  }
5458
5487
  /** Runs the transaction and sets the result on deferred. */ run() {
5459
- this.Tt -= 1, this.At();
5488
+ this.Tt -= 1, this.It();
5460
5489
  }
5461
- At() {
5462
- this.It.W((async () => {
5490
+ It() {
5491
+ this.At.W((async () => {
5463
5492
  const t = new Fr(this.datastore), e = this.Rt(t);
5464
5493
  e && e.then((e => {
5465
5494
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
@@ -5475,7 +5504,7 @@ class xr {
5475
5504
  Rt(t) {
5476
5505
  try {
5477
5506
  const e = this.updateFunction(t);
5478
- return !ct(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5507
+ return !at(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5479
5508
  null);
5480
5509
  } catch (t) {
5481
5510
  // Do not retry errors thrown by user provided updateFunction.
@@ -5483,7 +5512,7 @@ class xr {
5483
5512
  }
5484
5513
  }
5485
5514
  Pt(t) {
5486
- this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.At(),
5515
+ this.Tt > 0 && this.Vt(t) ? (this.Tt -= 1, this.asyncQueue.enqueueAndForget((() => (this.It(),
5487
5516
  Promise.resolve())))) : this.deferred.reject(t);
5488
5517
  }
5489
5518
  Vt(t) {
@@ -5504,7 +5533,7 @@ class xr {
5504
5533
  return g();
5505
5534
 
5506
5535
  case T:
5507
- case I:
5536
+ case A:
5508
5537
  case R:
5509
5538
  case $:
5510
5539
  case O:
@@ -5514,7 +5543,7 @@ class xr {
5514
5543
  case N:
5515
5544
  return !1;
5516
5545
 
5517
- case A:
5546
+ case I:
5518
5547
  case P:
5519
5548
  case V:
5520
5549
  case D:
@@ -5522,8 +5551,8 @@ class xr {
5522
5551
  // Aborted might be retried in some scenarios, but that is dependant on
5523
5552
  // the context and should handled individually by the calling code.
5524
5553
  // See https://cloud.google.com/apis/design/errors.
5525
- case F:
5526
- case x:
5554
+ case x:
5555
+ case F:
5527
5556
  case q:
5528
5557
  case L:
5529
5558
  return !0;
@@ -5550,7 +5579,7 @@ class xr {
5550
5579
  * See the License for the specific language governing permissions and
5551
5580
  * limitations under the License.
5552
5581
  */
5553
- /** The Platform's 'document' implementation or null if not available. */ function qr() {
5582
+ /** The Platform's 'document' implementation or null if not available. */ function Cr() {
5554
5583
  // `document` is not always available, e.g. in ReactNative and WebWorkers.
5555
5584
  // eslint-disable-next-line no-restricted-globals
5556
5585
  return "undefined" != typeof document ? document : null;
@@ -5582,7 +5611,7 @@ class xr {
5582
5611
  * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
5583
5612
  * in newer versions of TypeScript defines `finally`, which is not available in
5584
5613
  * IE.
5585
- */ class Or {
5614
+ */ class Lr {
5586
5615
  constructor(t, e, n, r, s) {
5587
5616
  this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
5588
5617
  this.deferred = new k, this.then = this.deferred.promise.then.bind(this.deferred.promise),
@@ -5605,7 +5634,7 @@ class xr {
5605
5634
  * PORTING NOTE: This exists to prevent making removeDelayedOperation() and
5606
5635
  * the DelayedOperation class public.
5607
5636
  */ static createAndSchedule(t, e, n, r, s) {
5608
- const i = Date.now() + n, o = new Or(t, e, i, r, s);
5637
+ const i = Date.now() + n, o = new Lr(t, e, i, r, s);
5609
5638
  return o.start(n), o;
5610
5639
  }
5611
5640
  /**
@@ -5654,7 +5683,7 @@ class xr {
5654
5683
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5655
5684
  * See the License for the specific language governing permissions and
5656
5685
  * limitations under the License.
5657
- */ class Cr {
5686
+ */ class Ur {
5658
5687
  constructor() {
5659
5688
  // The last promise in the queue.
5660
5689
  this.Dt = Promise.resolve(),
@@ -5668,24 +5697,24 @@ class xr {
5668
5697
  // automatically removed after they are run or canceled.
5669
5698
  this.St = [],
5670
5699
  // visible for testing
5671
- this.Ft = null,
5700
+ this.xt = null,
5672
5701
  // Flag set while there's an outstanding AsyncQueue operation, used for
5673
5702
  // assertion sanity-checks.
5674
- this.xt = !1,
5703
+ this.Ft = !1,
5675
5704
  // Enabled during shutdown on Safari to prevent future access to IndexedDB.
5676
5705
  this.qt = !1,
5677
5706
  // List of TimerIds to fast-forward delays for.
5678
5707
  this.Ot = [],
5679
5708
  // Backoff timer used to schedule retries for retryable operations
5680
- this.It = new Ye(this, "async_queue_retry" /* AsyncQueueRetry */),
5709
+ this.At = new He(this, "async_queue_retry" /* AsyncQueueRetry */),
5681
5710
  // Visibility handler that triggers an immediate retry of all retryable
5682
5711
  // operations. Meant to speed up recovery when we regain file system access
5683
5712
  // after page comes into foreground.
5684
5713
  this.Ct = () => {
5685
- const t = qr();
5686
- t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
5714
+ const t = Cr();
5715
+ t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.At.H();
5687
5716
  };
5688
- const t = qr();
5717
+ const t = Cr();
5689
5718
  t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
5690
5719
  }
5691
5720
  get isShuttingDown() {
@@ -5706,7 +5735,7 @@ class xr {
5706
5735
  enterRestrictedMode(t) {
5707
5736
  if (!this.$t) {
5708
5737
  this.$t = !0, this.qt = t || !1;
5709
- const e = qr();
5738
+ const e = Cr();
5710
5739
  e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
5711
5740
  }
5712
5741
  }
@@ -5730,7 +5759,7 @@ class xr {
5730
5759
  */ async kt() {
5731
5760
  if (0 !== this.Nt.length) {
5732
5761
  try {
5733
- await this.Nt[0](), this.Nt.shift(), this.It.reset();
5762
+ await this.Nt[0](), this.Nt.shift(), this.At.reset();
5734
5763
  } catch (t) {
5735
5764
  if (!
5736
5765
  /**
@@ -5785,12 +5814,12 @@ class xr {
5785
5814
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
5786
5815
  // new backoff on every call, there is only ever a single additional
5787
5816
  // operation in the queue.
5788
- this.It.W((() => this.kt()));
5817
+ this.At.W((() => this.kt()));
5789
5818
  }
5790
5819
  }
5791
5820
  Ut(t) {
5792
- const e = this.Dt.then((() => (this.xt = !0, t().catch((t => {
5793
- this.Ft = t, this.xt = !1;
5821
+ const e = this.Dt.then((() => (this.Ft = !0, t().catch((t => {
5822
+ this.xt = t, this.Ft = !1;
5794
5823
  const e =
5795
5824
  /**
5796
5825
  * Chrome includes Error.message in Error.stack. Other browsers do not.
@@ -5831,18 +5860,18 @@ class xr {
5831
5860
  // all further attempts to chain (via .then) will just short-circuit
5832
5861
  // and return the rejected Promise.
5833
5862
  throw p("INTERNAL UNHANDLED ERROR: ", e), t;
5834
- })).then((t => (this.xt = !1, t))))));
5863
+ })).then((t => (this.Ft = !1, t))))));
5835
5864
  return this.Dt = e, e;
5836
5865
  }
5837
5866
  enqueueAfterDelay(t, e, n) {
5838
5867
  this.Lt(),
5839
5868
  // Fast-forward delays for timerIds that have been overriden.
5840
5869
  this.Ot.indexOf(t) > -1 && (e = 0);
5841
- const r = Or.createAndSchedule(this, t, e, n, (t => this.jt(t)));
5870
+ const r = Lr.createAndSchedule(this, t, e, n, (t => this.jt(t)));
5842
5871
  return this.St.push(r), r;
5843
5872
  }
5844
5873
  Lt() {
5845
- this.Ft && g();
5874
+ this.xt && g();
5846
5875
  }
5847
5876
  verifyOperationInProgress() {}
5848
5877
  /**
@@ -5892,10 +5921,10 @@ class xr {
5892
5921
  }
5893
5922
  }
5894
5923
 
5895
- class Lr {
5924
+ class kr {
5896
5925
  /** @hideconstructor */
5897
5926
  constructor(t, e) {
5898
- this._firestore = t, this._transaction = e, this._dataReader = Pn(t);
5927
+ this._firestore = t, this._transaction = e, this._dataReader = Vn(t);
5899
5928
  }
5900
5929
  /**
5901
5930
  * Reads the document referenced by the provided {@link DocumentReference}.
@@ -5903,25 +5932,25 @@ class Lr {
5903
5932
  * @param documentRef - A reference to the document to be read.
5904
5933
  * @returns A `DocumentSnapshot` with the read data.
5905
5934
  */ get(t) {
5906
- const e = $r(t, this._firestore), n = new _r(this._firestore);
5935
+ const e = Sr(t, this._firestore), n = new gr(this._firestore);
5907
5936
  return this._transaction.lookup([ e._key ]).then((t => {
5908
5937
  if (!t || 1 !== t.length) return g();
5909
5938
  const r = t[0];
5910
- if (r.isFoundDocument()) return new Wn(this._firestore, n, r.key, r, e.converter);
5911
- if (r.isNoDocument()) return new Wn(this._firestore, n, e._key, null, e.converter);
5939
+ if (r.isFoundDocument()) return new Yn(this._firestore, n, r.key, r, e.converter);
5940
+ if (r.isNoDocument()) return new Yn(this._firestore, n, e._key, null, e.converter);
5912
5941
  throw g();
5913
5942
  }));
5914
5943
  }
5915
5944
  set(t, e, n) {
5916
- const r = $r(t, this._firestore), s = yr(r.converter, e, n), i = Vn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
5945
+ const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
5917
5946
  return this._transaction.set(r._key, i), this;
5918
5947
  }
5919
5948
  update(t, e, n, ...r) {
5920
- const s = $r(t, this._firestore);
5949
+ const s = Sr(t, this._firestore);
5921
5950
  // For Compat types, we have to "extract" the underlying types before
5922
5951
  // performing validation.
5923
5952
  let i;
5924
- return i = "string" == typeof (e = getModularInstance(e)) || e instanceof pn ? On(this._dataReader, "Transaction.update", s._key, e, n, r) : qn(this._dataReader, "Transaction.update", s._key, e),
5953
+ return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "Transaction.update", s._key, e, n, r) : On(this._dataReader, "Transaction.update", s._key, e),
5925
5954
  this._transaction.update(s._key, i), this;
5926
5955
  }
5927
5956
  /**
@@ -5930,7 +5959,7 @@ class Lr {
5930
5959
  * @param documentRef - A reference to the document to be deleted.
5931
5960
  * @returns This `Transaction` instance. Used for chaining method calls.
5932
5961
  */ delete(t) {
5933
- const e = $r(t, this._firestore);
5962
+ const e = Sr(t, this._firestore);
5934
5963
  return this._transaction.delete(e._key), this;
5935
5964
  }
5936
5965
  }
@@ -5951,9 +5980,13 @@ class Lr {
5951
5980
  * (the `updateFunction` returned a failed promise), the promise returned by the
5952
5981
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
5953
5982
  * rejected promise with the corresponding failure error is returned.
5954
- */ function Ur(t, e) {
5955
- const n = tn(t = ot(t, nn)), r = new k;
5956
- return new xr(new Cr, n, (n => e(new Lr(t, n))), r).run(), r.promise;
5983
+ */ function jr(t, e, n) {
5984
+ const r = en(t = ot(t, rn)), s = Object.assign(Object.assign({}, qr), n);
5985
+ !function(t) {
5986
+ if (t.maxAttempts < 1) throw new U(I, "Max attempts must be at least 1");
5987
+ }(s);
5988
+ const i = new k;
5989
+ return new Or(new Ur, r, s, (n => e(new kr(t, n))), i).run(), i.promise;
5957
5990
  }
5958
5991
 
5959
5992
  /**
@@ -5966,11 +5999,11 @@ class Lr {
5966
5999
  */ !function(t) {
5967
6000
  f = t;
5968
6001
  }(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: e}) => {
5969
- const n = t.getProvider("app").getImmediate(), r = new nn(n, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
6002
+ const n = t.getProvider("app").getImmediate(), r = new rn(n, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
5970
6003
  return e && r._setSettings(e), r;
5971
6004
  }), "PUBLIC")),
5972
6005
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
5973
- registerVersion("firestore-lite", "3.4.8-canary.aa41fd662", ""), registerVersion("firestore-lite", "3.4.8-canary.aa41fd662", "esm2017");
6006
+ registerVersion("firestore-lite", "3.4.8-canary.adb9aaa34", ""), registerVersion("firestore-lite", "3.4.8-canary.adb9aaa34", "esm2017");
5974
6007
 
5975
- export { _n as Bytes, hn as CollectionReference, cn as DocumentReference, Wn as DocumentSnapshot, pn as FieldPath, gn as FieldValue, nn as Firestore, U as FirestoreError, vn as GeoPoint, an as Query, Xn as QueryConstraint, Yn as QueryDocumentSnapshot, Hn as QuerySnapshot, gt as Timestamp, Lr as Transaction, Nr as WriteBatch, Ir as addDoc, Vr as arrayRemove, Pr as arrayUnion, ln as collection, fn as collectionGroup, on as connectFirestoreEmulator, Tr as deleteDoc, Ar as deleteField, dn as doc, yn as documentId, fr as endAt, lr as endBefore, gr as getDoc, vr as getDocs, sn as getFirestore, Dr as increment, rn as initializeFirestore, ir as limit, or as limitToLast, rr as orderBy, Zn as query, mn as queryEqual, wn as refEqual, Ur as runTransaction, Rr as serverTimestamp, br as setDoc, w as setLogLevel, Kn as snapshotEqual, ar as startAfter, cr as startAt, un as terminate, Er as updateDoc, er as where, Sr as writeBatch };
6008
+ export { gn as Bytes, ln as CollectionReference, cn as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, bn as FieldValue, rn as Firestore, U as FirestoreError, vn as GeoPoint, hn as Query, Zn as QueryConstraint, Hn as QueryDocumentSnapshot, Kn as QuerySnapshot, gt as Timestamp, kr as Transaction, $r as WriteBatch, Ir as addDoc, Dr as arrayRemove, Vr as arrayUnion, fn as collection, dn as collectionGroup, un as connectFirestoreEmulator, Ar as deleteDoc, Rr as deleteField, wn as doc, _n as documentId, dr as endAt, fr as endBefore, br as getDoc, vr as getDocs, on as getFirestore, Nr as increment, sn as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pn as queryEqual, mn as refEqual, jr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Jn as snapshotEqual, hr as startAfter, cr as startAt, an as terminate, Tr as updateDoc, nr as where, xr as writeBatch };
5976
6009
  //# sourceMappingURL=index.browser.esm2017.js.map