@firebase/firestore 3.4.4-canary.2dd99ae2d → 3.4.4-canary.3e9f3e253

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 (160) hide show
  1. package/dist/firestore/src/api/credentials.d.ts +1 -0
  2. package/dist/firestore/src/api/snapshot.d.ts +1 -2
  3. package/dist/firestore/src/core/target.d.ts +8 -4
  4. package/dist/firestore/src/lite-api/query.d.ts +2 -2
  5. package/dist/firestore/src/local/document_overlay_cache.d.ts +72 -0
  6. package/dist/firestore/src/local/index_manager.d.ts +52 -0
  7. package/dist/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  8. package/dist/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
  9. package/dist/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  10. package/dist/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  11. package/dist/firestore/src/local/indexeddb_schema.d.ts +193 -7
  12. package/dist/firestore/src/local/local_documents_view.d.ts +0 -1
  13. package/dist/firestore/src/local/local_serializer.d.ts +18 -2
  14. package/dist/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  15. package/dist/firestore/src/local/memory_index_manager.d.ts +11 -0
  16. package/dist/firestore/src/local/memory_persistence.d.ts +6 -2
  17. package/dist/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  18. package/dist/firestore/src/local/persistence.d.ts +8 -2
  19. package/dist/firestore/src/local/remote_document_cache.d.ts +7 -9
  20. package/dist/firestore/src/local/simple_db.d.ts +1 -0
  21. package/dist/firestore/src/model/document_key.d.ts +4 -0
  22. package/dist/firestore/src/model/field_index.d.ts +2 -2
  23. package/dist/firestore/src/model/overlay.d.ts +32 -0
  24. package/dist/firestore/src/model/target_index_matcher.d.ts +70 -0
  25. package/dist/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  26. package/dist/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  27. package/dist/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  28. package/dist/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  29. package/dist/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  30. package/dist/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  31. package/dist/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  32. package/dist/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  33. package/dist/firestore/test/util/helpers.d.ts +1 -1
  34. package/dist/index.d.ts +1 -2
  35. package/dist/index.esm2017.js +3864 -3349
  36. package/dist/index.esm2017.js.map +1 -1
  37. package/dist/index.esm5.js +3879 -3455
  38. package/dist/index.esm5.js.map +1 -1
  39. package/dist/index.node.cjs.js +878 -221
  40. package/dist/index.node.cjs.js.map +1 -1
  41. package/dist/index.node.mjs +878 -221
  42. package/dist/index.node.mjs.map +1 -1
  43. package/dist/index.rn.js +3973 -3458
  44. package/dist/index.rn.js.map +1 -1
  45. package/dist/internal.d.ts +252 -14
  46. package/dist/lite/firestore/src/api/credentials.d.ts +1 -0
  47. package/dist/lite/firestore/src/api/snapshot.d.ts +1 -2
  48. package/dist/lite/firestore/src/core/target.d.ts +8 -4
  49. package/dist/lite/firestore/src/lite-api/query.d.ts +2 -2
  50. package/dist/lite/firestore/src/local/document_overlay_cache.d.ts +72 -0
  51. package/dist/lite/firestore/src/local/index_manager.d.ts +52 -0
  52. package/dist/lite/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  53. package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
  54. package/dist/lite/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  55. package/dist/lite/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  56. package/dist/lite/firestore/src/local/indexeddb_schema.d.ts +193 -7
  57. package/dist/lite/firestore/src/local/local_documents_view.d.ts +0 -1
  58. package/dist/lite/firestore/src/local/local_serializer.d.ts +18 -2
  59. package/dist/lite/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  60. package/dist/lite/firestore/src/local/memory_index_manager.d.ts +11 -0
  61. package/dist/lite/firestore/src/local/memory_persistence.d.ts +6 -2
  62. package/dist/lite/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  63. package/dist/lite/firestore/src/local/persistence.d.ts +8 -2
  64. package/dist/lite/firestore/src/local/remote_document_cache.d.ts +7 -9
  65. package/dist/lite/firestore/src/local/simple_db.d.ts +1 -0
  66. package/dist/lite/firestore/src/model/document_key.d.ts +4 -0
  67. package/dist/lite/firestore/src/model/field_index.d.ts +2 -2
  68. package/dist/lite/firestore/src/model/overlay.d.ts +32 -0
  69. package/dist/lite/firestore/src/model/target_index_matcher.d.ts +70 -0
  70. package/dist/lite/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  71. package/dist/lite/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  72. package/dist/lite/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  73. package/dist/lite/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  74. package/dist/lite/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  75. package/dist/lite/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  76. package/dist/lite/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  77. package/dist/lite/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  78. package/dist/lite/firestore/test/util/helpers.d.ts +1 -1
  79. package/dist/lite/index.browser.esm2017.js +1152 -1143
  80. package/dist/lite/index.browser.esm2017.js.map +1 -1
  81. package/dist/lite/index.browser.esm5.js +348 -341
  82. package/dist/lite/index.browser.esm5.js.map +1 -1
  83. package/dist/lite/index.node.cjs.js +44 -29
  84. package/dist/lite/index.node.cjs.js.map +1 -1
  85. package/dist/lite/index.node.mjs +44 -29
  86. package/dist/lite/index.node.mjs.map +1 -1
  87. package/dist/lite/index.rn.esm2017.js +1180 -1171
  88. package/dist/lite/index.rn.esm2017.js.map +1 -1
  89. package/dist/lite/internal.d.ts +6 -2
  90. package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +121 -121
  91. package/dist/lite/packages/firestore/src/api/credentials.d.ts +1 -0
  92. package/dist/lite/packages/firestore/src/api/snapshot.d.ts +1 -2
  93. package/dist/lite/packages/firestore/src/core/target.d.ts +8 -4
  94. package/dist/lite/packages/firestore/src/lite-api/query.d.ts +2 -2
  95. package/dist/lite/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
  96. package/dist/lite/packages/firestore/src/local/index_manager.d.ts +52 -0
  97. package/dist/lite/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  98. package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
  99. package/dist/lite/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  100. package/dist/lite/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  101. package/dist/lite/packages/firestore/src/local/indexeddb_schema.d.ts +193 -7
  102. package/dist/lite/packages/firestore/src/local/local_documents_view.d.ts +0 -1
  103. package/dist/lite/packages/firestore/src/local/local_serializer.d.ts +18 -2
  104. package/dist/lite/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  105. package/dist/lite/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  106. package/dist/lite/packages/firestore/src/local/memory_persistence.d.ts +6 -2
  107. package/dist/lite/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  108. package/dist/lite/packages/firestore/src/local/persistence.d.ts +8 -2
  109. package/dist/lite/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
  110. package/dist/lite/packages/firestore/src/local/simple_db.d.ts +1 -0
  111. package/dist/lite/packages/firestore/src/model/document_key.d.ts +4 -0
  112. package/dist/lite/packages/firestore/src/model/field_index.d.ts +2 -2
  113. package/dist/lite/packages/firestore/src/model/overlay.d.ts +32 -0
  114. package/dist/lite/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
  115. package/dist/lite/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  116. package/dist/lite/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  117. package/dist/lite/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  118. package/dist/lite/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  119. package/dist/lite/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  120. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  121. package/dist/lite/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  122. package/dist/lite/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  123. package/dist/lite/packages/firestore/test/util/helpers.d.ts +1 -1
  124. package/dist/lite/private.d.ts +2 -2
  125. package/dist/packages/firestore/dist/index.esm2017.d.ts +181 -179
  126. package/dist/packages/firestore/src/api/credentials.d.ts +1 -0
  127. package/dist/packages/firestore/src/api/snapshot.d.ts +1 -2
  128. package/dist/packages/firestore/src/core/target.d.ts +8 -4
  129. package/dist/packages/firestore/src/lite-api/query.d.ts +2 -2
  130. package/dist/packages/firestore/src/local/document_overlay_cache.d.ts +72 -0
  131. package/dist/packages/firestore/src/local/index_manager.d.ts +52 -0
  132. package/dist/packages/firestore/src/local/indexeddb_document_overlay_cache.d.ts +45 -0
  133. package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +21 -2
  134. package/dist/packages/firestore/src/local/indexeddb_persistence.d.ts +6 -4
  135. package/dist/packages/firestore/src/local/indexeddb_remote_document_cache.d.ts +2 -8
  136. package/dist/packages/firestore/src/local/indexeddb_schema.d.ts +193 -7
  137. package/dist/packages/firestore/src/local/local_documents_view.d.ts +0 -1
  138. package/dist/packages/firestore/src/local/local_serializer.d.ts +18 -2
  139. package/dist/packages/firestore/src/local/memory_document_overlay_cache.d.ts +37 -0
  140. package/dist/packages/firestore/src/local/memory_index_manager.d.ts +11 -0
  141. package/dist/packages/firestore/src/local/memory_persistence.d.ts +6 -2
  142. package/dist/packages/firestore/src/local/memory_remote_document_cache.d.ts +1 -3
  143. package/dist/packages/firestore/src/local/persistence.d.ts +8 -2
  144. package/dist/packages/firestore/src/local/remote_document_cache.d.ts +7 -9
  145. package/dist/packages/firestore/src/local/simple_db.d.ts +1 -0
  146. package/dist/packages/firestore/src/model/document_key.d.ts +4 -0
  147. package/dist/packages/firestore/src/model/field_index.d.ts +2 -2
  148. package/dist/packages/firestore/src/model/overlay.d.ts +32 -0
  149. package/dist/packages/firestore/src/model/target_index_matcher.d.ts +70 -0
  150. package/dist/packages/firestore/test/unit/local/counting_query_engine.d.ts +3 -3
  151. package/dist/packages/firestore/test/unit/local/document_overlay_cache.test.d.ts +1 -0
  152. package/dist/packages/firestore/test/unit/local/persistence_test_helpers.d.ts +1 -0
  153. package/dist/packages/firestore/test/unit/local/test_document_overlay_cache.d.ts +38 -0
  154. package/dist/packages/firestore/test/unit/local/test_index_manager.d.ts +11 -0
  155. package/dist/packages/firestore/test/unit/local/test_remote_document_cache.d.ts +4 -2
  156. package/dist/packages/firestore/test/unit/local/test_remote_document_change_buffer.d.ts +1 -1
  157. package/dist/packages/firestore/test/unit/model/target_index_matcher.test.d.ts +17 -0
  158. package/dist/packages/firestore/test/util/helpers.d.ts +1 -1
  159. package/dist/private.d.ts +248 -14
  160. package/package.json +9 -9
@@ -1,4 +1,4 @@
1
- import { _getProvider, getApp as t, _removeServiceInstance as n, _registerComponent as e, registerVersion as r, SDK_VERSION as s } from "@firebase/app";
1
+ import { _getProvider, getApp as t, _removeServiceInstance as e, _registerComponent as n, registerVersion as r, SDK_VERSION as s } from "@firebase/app";
2
2
 
3
3
  import { Component as i } from "@firebase/component";
4
4
 
@@ -66,7 +66,7 @@ f.MOCK_USER = new f("mock-user");
66
66
  * See the License for the specific language governing permissions and
67
67
  * limitations under the License.
68
68
  */
69
- let d = "9.6.5-canary.2dd99ae2d";
69
+ let d = "9.6.6-canary.3e9f3e253";
70
70
 
71
71
  /**
72
72
  * @license
@@ -102,26 +102,26 @@ const w = new o("@firebase/firestore");
102
102
  w.setLogLevel(t);
103
103
  }
104
104
 
105
- function p(t, ...n) {
105
+ function p(t, ...e) {
106
106
  if (w.logLevel <= u.DEBUG) {
107
- const e = n.map(g);
108
- w.debug(`Firestore (${d}): ${t}`, ...e);
107
+ const n = e.map(g);
108
+ w.debug(`Firestore (${d}): ${t}`, ...n);
109
109
  }
110
110
  }
111
111
 
112
- function y(t, ...n) {
112
+ function y(t, ...e) {
113
113
  if (w.logLevel <= u.ERROR) {
114
- const e = n.map(g);
115
- w.error(`Firestore (${d}): ${t}`, ...e);
114
+ const n = e.map(g);
115
+ w.error(`Firestore (${d}): ${t}`, ...n);
116
116
  }
117
117
  }
118
118
 
119
119
  /**
120
120
  * @internal
121
- */ function _(t, ...n) {
121
+ */ function _(t, ...e) {
122
122
  if (w.logLevel <= u.WARN) {
123
- const e = n.map(g);
124
- w.warn(`Firestore (${d}): ${t}`, ...e);
123
+ const n = e.map(g);
124
+ w.warn(`Firestore (${d}): ${t}`, ...n);
125
125
  }
126
126
  }
127
127
 
@@ -130,8 +130,8 @@ function y(t, ...n) {
130
130
  */ function g(t) {
131
131
  if ("string" == typeof t) return t;
132
132
  try {
133
- return n = t, JSON.stringify(n);
134
- } catch (n) {
133
+ return e = t, JSON.stringify(e);
134
+ } catch (e) {
135
135
  // Converting to JSON failed, just log the object directly
136
136
  return t;
137
137
  }
@@ -152,7 +152,7 @@ function y(t, ...n) {
152
152
  * limitations under the License.
153
153
  */
154
154
  /** Formats an object as a JSON string, suitable for logging. */
155
- var n;
155
+ var e;
156
156
  }
157
157
 
158
158
  /**
@@ -181,11 +181,11 @@ function y(t, ...n) {
181
181
  */ function v(t = "Unexpected state") {
182
182
  // Log the failure in addition to throw an exception, just in case the
183
183
  // exception is swallowed.
184
- const n = `FIRESTORE (${d}) INTERNAL ASSERTION FAILED: ` + t;
184
+ const e = `FIRESTORE (${d}) INTERNAL ASSERTION FAILED: ` + t;
185
185
  // NOTE: We don't use FirestoreError here because these are internal failures
186
186
  // that cannot be handled by the user. (Also it would create a circular
187
187
  // dependency between the error and assert modules which doesn't work.)
188
- throw y(n), new Error(n);
188
+ throw y(e), new Error(e);
189
189
  }
190
190
 
191
191
  /**
@@ -193,7 +193,7 @@ function y(t, ...n) {
193
193
  * given message if it did.
194
194
  *
195
195
  * Messages are stripped in production builds.
196
- */ function b(t, n) {
196
+ */ function b(t, e) {
197
197
  t || v();
198
198
  }
199
199
 
@@ -202,7 +202,7 @@ function y(t, ...n) {
202
202
  * instance of `T` before casting.
203
203
  */ function E(t,
204
204
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
205
- n) {
205
+ e) {
206
206
  return t;
207
207
  }
208
208
 
@@ -233,8 +233,8 @@ n) {
233
233
  /**
234
234
  * A custom error description.
235
235
  */
236
- n) {
237
- super(t, n), this.code = t, this.message = n,
236
+ e) {
237
+ super(t, e), this.code = t, this.message = e,
238
238
  // HACK: We write a toString property directly because Error is not a real
239
239
  // class and so inheritance does not work correctly. We could alternatively
240
240
  // do the same "back-door inheritance" trick that FirebaseError does.
@@ -259,8 +259,8 @@ n) {
259
259
  * limitations under the License.
260
260
  */ class j {
261
261
  constructor() {
262
- this.promise = new Promise(((t, n) => {
263
- this.resolve = t, this.reject = n;
262
+ this.promise = new Promise(((t, e) => {
263
+ this.resolve = t, this.reject = e;
264
264
  }));
265
265
  }
266
266
  }
@@ -281,8 +281,8 @@ n) {
281
281
  * See the License for the specific language governing permissions and
282
282
  * limitations under the License.
283
283
  */ class M {
284
- constructor(t, n) {
285
- this.user = n, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
284
+ constructor(t, e) {
285
+ this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
286
286
  }
287
287
  }
288
288
 
@@ -294,9 +294,9 @@ n) {
294
294
  return Promise.resolve(null);
295
295
  }
296
296
  invalidateToken() {}
297
- start(t, n) {
297
+ start(t, e) {
298
298
  // Fire with initial user.
299
- t.enqueueRetryable((() => n(f.UNAUTHENTICATED)));
299
+ t.enqueueRetryable((() => e(f.UNAUTHENTICATED)));
300
300
  }
301
301
  shutdown() {}
302
302
  }
@@ -318,17 +318,17 @@ n) {
318
318
  return Promise.resolve(this.token);
319
319
  }
320
320
  invalidateToken() {}
321
- start(t, n) {
322
- this.changeListener = n,
321
+ start(t, e) {
322
+ this.changeListener = e,
323
323
  // Fire with initial user.
324
- t.enqueueRetryable((() => n(this.token.user)));
324
+ t.enqueueRetryable((() => e(this.token.user)));
325
325
  }
326
326
  shutdown() {
327
327
  this.changeListener = null;
328
328
  }
329
329
  }
330
330
 
331
- /** Credential provider for the Lite SDK. */ class Q {
331
+ /** Credential provider for the Lite SDK. */ class G {
332
332
  constructor(t) {
333
333
  this.auth = null, t.onInit((t => {
334
334
  this.auth = t;
@@ -339,7 +339,7 @@ n) {
339
339
  new M(t.accessToken, new f(this.auth.getUid()))) : null)) : Promise.resolve(null);
340
340
  }
341
341
  invalidateToken() {}
342
- start(t, n) {}
342
+ start(t, e) {}
343
343
  shutdown() {}
344
344
  }
345
345
 
@@ -349,11 +349,11 @@ n) {
349
349
  * Technically this may no longer be necessary since the SDK should gracefully
350
350
  * recover from unauthenticated errors (see b/33147818 for context), but it's
351
351
  * safer to keep the implementation as-is.
352
- */ class G {
353
- constructor(t, n, e) {
354
- this.type = "FirstParty", this.user = f.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", n);
352
+ */ class Q {
353
+ constructor(t, e, n) {
354
+ this.type = "FirstParty", this.user = f.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", e);
355
355
  const r = t.auth.getAuthHeaderValueForFirstParty([]);
356
- r && this.headers.set("Authorization", r), e && this.headers.set("X-Goog-Iam-Authorization-Token", e);
356
+ r && this.headers.set("Authorization", r), n && this.headers.set("X-Goog-Iam-Authorization-Token", n);
357
357
  }
358
358
  }
359
359
 
@@ -362,15 +362,15 @@ n) {
362
362
  * to authenticate the user, using technique that is only available
363
363
  * to applications hosted by Google.
364
364
  */ class W {
365
- constructor(t, n, e) {
366
- this.t = t, this.i = n, this.o = e;
365
+ constructor(t, e, n) {
366
+ this.t = t, this.i = e, this.o = n;
367
367
  }
368
368
  getToken() {
369
- return Promise.resolve(new G(this.t, this.i, this.o));
369
+ return Promise.resolve(new Q(this.t, this.i, this.o));
370
370
  }
371
- start(t, n) {
371
+ start(t, e) {
372
372
  // Fire with initial uid.
373
- t.enqueueRetryable((() => n(f.FIRST_PARTY)));
373
+ t.enqueueRetryable((() => e(f.FIRST_PARTY)));
374
374
  }
375
375
  shutdown() {}
376
376
  invalidateToken() {}
@@ -393,7 +393,7 @@ class Y {
393
393
  new Y(t.token)) : null)) : Promise.resolve(null);
394
394
  }
395
395
  invalidateToken() {}
396
- start(t, n) {}
396
+ start(t, e) {}
397
397
  shutdown() {}
398
398
  }
399
399
 
@@ -435,8 +435,8 @@ class K {
435
435
  * @param useFetchStreams Whether to use the Fetch API instead of
436
436
  * XMLHTTPRequest
437
437
  */
438
- constructor(t, n, e, r, s, i, o, u) {
439
- this.databaseId = t, this.appId = n, this.persistenceKey = e, this.host = r, this.ssl = s,
438
+ constructor(t, e, n, r, s, i, o, u) {
439
+ this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = s,
440
440
  this.forceLongPolling = i, this.autoDetectLongPolling = o, this.useFetchStreams = u;
441
441
  }
442
442
  }
@@ -447,8 +447,8 @@ class K {
447
447
  * @internal
448
448
  */
449
449
  class J {
450
- constructor(t, n) {
451
- this.projectId = t, this.database = n || "(default)";
450
+ constructor(t, e) {
451
+ this.projectId = t, this.database = e || "(default)";
452
452
  }
453
453
  static empty() {
454
454
  return new J("", "");
@@ -481,9 +481,9 @@ class J {
481
481
  * Path represents an ordered sequence of string segments.
482
482
  */
483
483
  class X {
484
- constructor(t, n, e) {
485
- void 0 === n ? n = 0 : n > t.length && v(), void 0 === e ? e = t.length - n : e > t.length - n && v(),
486
- this.segments = t, this.offset = n, this.len = e;
484
+ constructor(t, e, n) {
485
+ void 0 === e ? e = 0 : e > t.length && v(), void 0 === n ? n = t.length - e : n > t.length - e && v(),
486
+ this.segments = t, this.offset = e, this.len = n;
487
487
  }
488
488
  get length() {
489
489
  return this.len;
@@ -492,10 +492,10 @@ class X {
492
492
  return 0 === X.comparator(this, t);
493
493
  }
494
494
  child(t) {
495
- const n = this.segments.slice(this.offset, this.limit());
495
+ const e = this.segments.slice(this.offset, this.limit());
496
496
  return t instanceof X ? t.forEach((t => {
497
- n.push(t);
498
- })) : n.push(t), this.construct(n);
497
+ e.push(t);
498
+ })) : e.push(t), this.construct(e);
499
499
  }
500
500
  /** The index of one past the last segment of the path. */ limit() {
501
501
  return this.offset + this.length;
@@ -520,28 +520,28 @@ class X {
520
520
  }
521
521
  isPrefixOf(t) {
522
522
  if (t.length < this.length) return !1;
523
- for (let n = 0; n < this.length; n++) if (this.get(n) !== t.get(n)) return !1;
523
+ for (let e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1;
524
524
  return !0;
525
525
  }
526
526
  isImmediateParentOf(t) {
527
527
  if (this.length + 1 !== t.length) return !1;
528
- for (let n = 0; n < this.length; n++) if (this.get(n) !== t.get(n)) return !1;
528
+ for (let e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1;
529
529
  return !0;
530
530
  }
531
531
  forEach(t) {
532
- for (let n = this.offset, e = this.limit(); n < e; n++) t(this.segments[n]);
532
+ for (let e = this.offset, n = this.limit(); e < n; e++) t(this.segments[e]);
533
533
  }
534
534
  toArray() {
535
535
  return this.segments.slice(this.offset, this.limit());
536
536
  }
537
- static comparator(t, n) {
538
- const e = Math.min(t.length, n.length);
539
- for (let r = 0; r < e; r++) {
540
- const e = t.get(r), s = n.get(r);
541
- if (e < s) return -1;
542
- if (e > s) return 1;
537
+ static comparator(t, e) {
538
+ const n = Math.min(t.length, e.length);
539
+ for (let r = 0; r < n; r++) {
540
+ const n = t.get(r), s = e.get(r);
541
+ if (n < s) return -1;
542
+ if (n > s) return 1;
543
543
  }
544
- return t.length < n.length ? -1 : t.length > n.length ? 1 : 0;
544
+ return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;
545
545
  }
546
546
  }
547
547
 
@@ -551,8 +551,8 @@ class X {
551
551
  *
552
552
  * @internal
553
553
  */ class Z extends X {
554
- construct(t, n, e) {
555
- return new Z(t, n, e);
554
+ construct(t, e, n) {
555
+ return new Z(t, e, n);
556
556
  }
557
557
  canonicalString() {
558
558
  // NOTE: The client is ignorant of any path segments containing escape
@@ -571,13 +571,13 @@ class X {
571
571
  // NOTE: The client is ignorant of any path segments containing escape
572
572
  // sequences (e.g. __id123__) and just passes them through raw (they exist
573
573
  // for legacy reasons and should not be used frequently).
574
- const n = [];
575
- for (const e of t) {
576
- if (e.indexOf("//") >= 0) throw new U(R, `Invalid segment (${e}). Paths must not contain // in them.`);
574
+ const e = [];
575
+ for (const n of t) {
576
+ if (n.indexOf("//") >= 0) throw new U(R, `Invalid segment (${n}). Paths must not contain // in them.`);
577
577
  // Strip leading and traling slashed.
578
- n.push(...e.split("/").filter((t => t.length > 0)));
578
+ e.push(...n.split("/").filter((t => t.length > 0)));
579
579
  }
580
- return new Z(n);
580
+ return new Z(e);
581
581
  }
582
582
  static emptyPath() {
583
583
  return new Z([]);
@@ -589,9 +589,9 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
589
589
  /**
590
590
  * A dot-separated path for navigating sub-objects within a document.
591
591
  * @internal
592
- */ class nt extends X {
593
- construct(t, n, e) {
594
- return new nt(t, n, e);
592
+ */ class et extends X {
593
+ construct(t, e, n) {
594
+ return new et(t, e, n);
595
595
  }
596
596
  /**
597
597
  * Returns true if the string could be used as a segment in a field path
@@ -601,7 +601,7 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
601
601
  }
602
602
  canonicalString() {
603
603
  return this.toArray().map((t => (t = t.replace(/\\/g, "\\\\").replace(/`/g, "\\`"),
604
- nt.isValidIdentifier(t) || (t = "`" + t + "`"), t))).join(".");
604
+ et.isValidIdentifier(t) || (t = "`" + t + "`"), t))).join(".");
605
605
  }
606
606
  toString() {
607
607
  return this.canonicalString();
@@ -614,7 +614,7 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
614
614
  /**
615
615
  * The field designating the key of a document.
616
616
  */ static keyField() {
617
- return new nt([ "__name__" ]);
617
+ return new et([ "__name__" ]);
618
618
  }
619
619
  /**
620
620
  * Parses a field string from the given server-formatted string.
@@ -626,27 +626,27 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
626
626
  * TODO(b/37244157): we should make this more strict. Right now, it allows
627
627
  * non-identifier path components, even if they aren't escaped.
628
628
  */ static fromServerFormat(t) {
629
- const n = [];
630
- let e = "", r = 0;
629
+ const e = [];
630
+ let n = "", r = 0;
631
631
  const s = () => {
632
- if (0 === e.length) throw new U(R, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
633
- n.push(e), e = "";
632
+ if (0 === n.length) throw new U(R, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
633
+ e.push(n), n = "";
634
634
  };
635
635
  let i = !1;
636
636
  for (;r < t.length; ) {
637
- const n = t[r];
638
- if ("\\" === n) {
637
+ const e = t[r];
638
+ if ("\\" === e) {
639
639
  if (r + 1 === t.length) throw new U(R, "Path has trailing escape character: " + t);
640
- const n = t[r + 1];
641
- if ("\\" !== n && "." !== n && "`" !== n) throw new U(R, "Path has invalid escape sequence: " + t);
642
- e += n, r += 2;
643
- } else "`" === n ? (i = !i, r++) : "." !== n || i ? (e += n, r++) : (s(), r++);
640
+ const e = t[r + 1];
641
+ if ("\\" !== e && "." !== e && "`" !== e) throw new U(R, "Path has invalid escape sequence: " + t);
642
+ n += e, r += 2;
643
+ } else "`" === e ? (i = !i, r++) : "." !== e || i ? (n += e, r++) : (s(), r++);
644
644
  }
645
645
  if (s(), i) throw new U(R, "Unterminated ` in path: " + t);
646
- return new nt(n);
646
+ return new et(e);
647
647
  }
648
648
  static emptyPath() {
649
- return new nt([]);
649
+ return new et([]);
650
650
  }
651
651
  }
652
652
 
@@ -668,30 +668,36 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
668
668
  */
669
669
  /**
670
670
  * @internal
671
- */ class et {
671
+ */ class nt {
672
672
  constructor(t) {
673
673
  this.path = t;
674
674
  }
675
675
  static fromPath(t) {
676
- return new et(Z.fromString(t));
676
+ return new nt(Z.fromString(t));
677
677
  }
678
678
  static fromName(t) {
679
- return new et(Z.fromString(t).popFirst(5));
679
+ return new nt(Z.fromString(t).popFirst(5));
680
680
  }
681
681
  static empty() {
682
- return new et(Z.emptyPath());
682
+ return new nt(Z.emptyPath());
683
683
  }
684
684
  /** Returns true if the document is in the specified collectionId. */ hasCollectionId(t) {
685
685
  return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
686
686
  }
687
+ /** Returns the collection group (i.e. the name of the parent collection) for this key. */ getCollectionGroup() {
688
+ return this.path.get(this.path.length - 2);
689
+ }
690
+ /** Returns the fully qualified path to the parent collection. */ getCollectionPath() {
691
+ return this.path.popLast();
692
+ }
687
693
  isEqual(t) {
688
694
  return null !== t && 0 === Z.comparator(this.path, t.path);
689
695
  }
690
696
  toString() {
691
697
  return this.path.toString();
692
698
  }
693
- static comparator(t, n) {
694
- return Z.comparator(t.path, n.path);
699
+ static comparator(t, e) {
700
+ return Z.comparator(t.path, e.path);
695
701
  }
696
702
  static isDocumentKey(t) {
697
703
  return t.length % 2 == 0;
@@ -702,7 +708,7 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
702
708
  * @param segments - The segments of the path to the document
703
709
  * @returns A new instance of DocumentKey
704
710
  */ static fromSegments(t) {
705
- return new et(new Z(t.slice()));
711
+ return new nt(new Z(t.slice()));
706
712
  }
707
713
  }
708
714
 
@@ -721,8 +727,8 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
721
727
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
722
728
  * See the License for the specific language governing permissions and
723
729
  * limitations under the License.
724
- */ function rt(t, n, e) {
725
- if (!e) throw new U(R, `Function ${t}() cannot be called with an empty ${n}.`);
730
+ */ function rt(t, e, n) {
731
+ if (!n) throw new U(R, `Function ${t}() cannot be called with an empty ${e}.`);
726
732
  }
727
733
 
728
734
  /**
@@ -734,14 +740,14 @@ const tt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
734
740
  * an even numbers of segments).
735
741
  */
736
742
  function st(t) {
737
- if (!et.isDocumentKey(t)) throw new U(R, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
743
+ if (!nt.isDocumentKey(t)) throw new U(R, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
738
744
  }
739
745
 
740
746
  /**
741
747
  * Validates that `path` refers to a collection (indicated by the fact it
742
748
  * contains an odd numbers of segments).
743
749
  */ function it(t) {
744
- if (et.isDocumentKey(t)) throw new U(R, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
750
+ if (nt.isDocumentKey(t)) throw new U(R, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
745
751
  }
746
752
 
747
753
  /**
@@ -758,7 +764,7 @@ function ot(t) {
758
764
  if ("object" == typeof t) {
759
765
  if (t instanceof Array) return "an array";
760
766
  {
761
- const n =
767
+ const e =
762
768
  /** try to get the constructor name for an object. */
763
769
  function(t) {
764
770
  if (t.constructor) return t.constructor.name;
@@ -772,7 +778,7 @@ function ot(t) {
772
778
  * arguments passed to the public API.
773
779
  * @internal
774
780
  */ (t);
775
- return n ? `a custom ${n} object` : "an object";
781
+ return e ? `a custom ${e} object` : "an object";
776
782
  }
777
783
  }
778
784
  return "function" == typeof t ? "a function" : v();
@@ -780,22 +786,22 @@ function ot(t) {
780
786
 
781
787
  function ut(t,
782
788
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
783
- n) {
789
+ e) {
784
790
  if ("_delegate" in t && (
785
791
  // Unwrap Compat types
786
792
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
787
- t = t._delegate), !(t instanceof n)) {
788
- if (n.name === t.constructor.name) throw new U(R, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
793
+ t = t._delegate), !(t instanceof e)) {
794
+ if (e.name === t.constructor.name) throw new U(R, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
789
795
  {
790
- const e = ot(t);
791
- throw new U(R, `Expected type '${n.name}', but it was: ${e}`);
796
+ const n = ot(t);
797
+ throw new U(R, `Expected type '${e.name}', but it was: ${n}`);
792
798
  }
793
799
  }
794
800
  return t;
795
801
  }
796
802
 
797
- function ct(t, n) {
798
- if (n <= 0) throw new U(R, `Function ${t}() requires a positive number, but it was: ${n}.`);
803
+ function ct(t, e) {
804
+ if (e <= 0) throw new U(R, `Function ${t}() requires a positive number, but it was: ${e}.`);
799
805
  }
800
806
 
801
807
  /**
@@ -1002,58 +1008,58 @@ class mt extends
1002
1008
  class {
1003
1009
  constructor(t) {
1004
1010
  this.databaseInfo = t, this.databaseId = t.databaseId;
1005
- const n = t.ssl ? "https" : "http";
1006
- this.h = n + "://" + t.host, this.l = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
1011
+ const e = t.ssl ? "https" : "http";
1012
+ this.h = e + "://" + t.host, this.l = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
1007
1013
  }
1008
- m(t, n, e, r, s) {
1009
- const i = this.p(t, n);
1010
- p("RestConnection", "Sending: ", i, e);
1014
+ m(t, e, n, r, s) {
1015
+ const i = this.p(t, e);
1016
+ p("RestConnection", "Sending: ", i, n);
1011
1017
  const o = {};
1012
- return this.g(o, r, s), this.v(t, i, o, e).then((t => (p("RestConnection", "Received: ", t),
1013
- t)), (n => {
1014
- throw _("RestConnection", `${t} failed with error: `, n, "url: ", i, "request:", e),
1015
- n;
1018
+ return this.g(o, r, s), this.v(t, i, o, n).then((t => (p("RestConnection", "Received: ", t),
1019
+ t)), (e => {
1020
+ throw _("RestConnection", `${t} failed with error: `, e, "url: ", i, "request:", n),
1021
+ e;
1016
1022
  }));
1017
1023
  }
1018
- T(t, n, e, r, s) {
1024
+ T(t, e, n, r, s) {
1019
1025
  // The REST API automatically aggregates all of the streamed results, so we
1020
1026
  // can just use the normal invoke() method.
1021
- return this.m(t, n, e, r, s);
1027
+ return this.m(t, e, n, r, s);
1022
1028
  }
1023
1029
  /**
1024
1030
  * Modifies the headers for a request, adding any authorization token if
1025
1031
  * present and any additional headers for the request.
1026
- */ g(t, n, e) {
1032
+ */ g(t, e, n) {
1027
1033
  t["X-Goog-Api-Client"] = "gl-js/ fire/" + d,
1028
1034
  // Content-Type: text/plain will avoid preflight requests which might
1029
1035
  // mess with CORS and redirects by proxies. If we add custom headers
1030
1036
  // we will need to change this code to potentially use the $httpOverwrite
1031
1037
  // parameter supported by ESF to avoid triggering preflight requests.
1032
1038
  t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId),
1033
- n && n.headers.forEach(((n, e) => t[e] = n)), e && e.headers.forEach(((n, e) => t[e] = n));
1039
+ e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
1034
1040
  }
1035
- p(t, n) {
1036
- const e = lt[t];
1037
- return `${this.h}/v1/${n}:${e}`;
1041
+ p(t, e) {
1042
+ const n = lt[t];
1043
+ return `${this.h}/v1/${e}:${n}`;
1038
1044
  }
1039
1045
  } {
1040
1046
  /**
1041
1047
  * @param databaseInfo - The connection info.
1042
1048
  * @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
1043
1049
  */
1044
- constructor(t, n) {
1045
- super(t), this.I = n;
1050
+ constructor(t, e) {
1051
+ super(t), this.I = e;
1046
1052
  }
1047
- A(t, n) {
1053
+ A(t, e) {
1048
1054
  throw new Error("Not supported by FetchConnection");
1049
1055
  }
1050
- async v(t, n, e, r) {
1056
+ async v(t, e, n, r) {
1051
1057
  const s = JSON.stringify(r);
1052
1058
  let i;
1053
1059
  try {
1054
- i = await this.I(n, {
1060
+ i = await this.I(e, {
1055
1061
  method: "POST",
1056
- headers: e,
1062
+ headers: n,
1057
1063
  body: s
1058
1064
  });
1059
1065
  } catch (t) {
@@ -1104,13 +1110,13 @@ class {
1104
1110
  */
1105
1111
  function pt(t) {
1106
1112
  // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
1107
- const n =
1113
+ const e =
1108
1114
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1109
- "undefined" != typeof self && (self.crypto || self.msCrypto), e = new Uint8Array(t);
1110
- if (n && "function" == typeof n.getRandomValues) n.getRandomValues(e); else
1115
+ "undefined" != typeof self && (self.crypto || self.msCrypto), n = new Uint8Array(t);
1116
+ if (e && "function" == typeof e.getRandomValues) e.getRandomValues(n); else
1111
1117
  // Falls back to Math.random
1112
- for (let n = 0; n < t; n++) e[n] = Math.floor(256 * Math.random());
1113
- return e;
1118
+ for (let e = 0; e < t; e++) n[e] = Math.floor(256 * Math.random());
1119
+ return n;
1114
1120
  }
1115
1121
 
1116
1122
  /**
@@ -1131,26 +1137,26 @@ function pt(t) {
1131
1137
  */ class yt {
1132
1138
  static R() {
1133
1139
  // Alphanumeric characters
1134
- const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", n = Math.floor(256 / t.length) * t.length;
1140
+ const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
1135
1141
  // The largest byte value that is a multiple of `char.length`.
1136
- let e = "";
1137
- for (;e.length < 20; ) {
1142
+ let n = "";
1143
+ for (;n.length < 20; ) {
1138
1144
  const r = pt(40);
1139
1145
  for (let s = 0; s < r.length; ++s)
1140
1146
  // Only accept values that are [0, maxMultiple), this ensures they can
1141
1147
  // be evenly mapped to indices of `chars` via a modulo operation.
1142
- e.length < 20 && r[s] < n && (e += t.charAt(r[s] % t.length));
1148
+ n.length < 20 && r[s] < e && (n += t.charAt(r[s] % t.length));
1143
1149
  }
1144
- return e;
1150
+ return n;
1145
1151
  }
1146
1152
  }
1147
1153
 
1148
- function _t(t, n) {
1149
- return t < n ? -1 : t > n ? 1 : 0;
1154
+ function _t(t, e) {
1155
+ return t < e ? -1 : t > e ? 1 : 0;
1150
1156
  }
1151
1157
 
1152
- /** Helper to compare arrays using isEqual(). */ function gt(t, n, e) {
1153
- return t.length === n.length && t.every(((t, r) => e(t, n[r])));
1158
+ /** Helper to compare arrays using isEqual(). */ function gt(t, e, n) {
1159
+ return t.length === e.length && t.every(((t, r) => n(t, e[r])));
1154
1160
  }
1155
1161
 
1156
1162
  /**
@@ -1204,9 +1210,9 @@ class vt {
1204
1210
  /**
1205
1211
  * The fractions of a second at nanosecond resolution.*
1206
1212
  */
1207
- n) {
1208
- if (this.seconds = t, this.nanoseconds = n, n < 0) throw new U(R, "Timestamp nanoseconds out of range: " + n);
1209
- if (n >= 1e9) throw new U(R, "Timestamp nanoseconds out of range: " + n);
1213
+ e) {
1214
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(R, "Timestamp nanoseconds out of range: " + e);
1215
+ if (e >= 1e9) throw new U(R, "Timestamp nanoseconds out of range: " + e);
1210
1216
  if (t < -62135596800) throw new U(R, "Timestamp seconds out of range: " + t);
1211
1217
  // This will break in the year 10,000.
1212
1218
  if (t >= 253402300800) throw new U(R, "Timestamp seconds out of range: " + t);
@@ -1235,8 +1241,8 @@ class vt {
1235
1241
  * @returns A new `Timestamp` representing the same point in time as the given
1236
1242
  * number of milliseconds.
1237
1243
  */ static fromMillis(t) {
1238
- const n = Math.floor(t / 1e3), e = Math.floor(1e6 * (t - 1e3 * n));
1239
- return new vt(n, e);
1244
+ const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
1245
+ return new vt(e, n);
1240
1246
  }
1241
1247
  /**
1242
1248
  * Converts a `Timestamp` to a JavaScript `Date` object. This conversion
@@ -1358,13 +1364,13 @@ class vt {
1358
1364
  * See the License for the specific language governing permissions and
1359
1365
  * limitations under the License.
1360
1366
  */ function Et(t) {
1361
- let n = 0;
1362
- for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n++;
1363
- return n;
1367
+ let e = 0;
1368
+ for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
1369
+ return e;
1364
1370
  }
1365
1371
 
1366
- function Tt(t, n) {
1367
- for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n(e, t[e]);
1372
+ function Tt(t, e) {
1373
+ for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
1368
1374
  }
1369
1375
 
1370
1376
  /**
@@ -1398,7 +1404,7 @@ class It {
1398
1404
  this.fields = t,
1399
1405
  // TODO(dimond): validation of FieldMask
1400
1406
  // Sort the field mask to support `FieldMask.isEqual()` and assert below.
1401
- t.sort(nt.comparator);
1407
+ t.sort(et.comparator);
1402
1408
  }
1403
1409
  /**
1404
1410
  * Verifies that `fieldPath` is included by at least one field in this field
@@ -1406,11 +1412,11 @@ class It {
1406
1412
  *
1407
1413
  * This is an O(n) operation, where `n` is the size of the field mask.
1408
1414
  */ covers(t) {
1409
- for (const n of this.fields) if (n.isPrefixOf(t)) return !0;
1415
+ for (const e of this.fields) if (e.isPrefixOf(t)) return !0;
1410
1416
  return !1;
1411
1417
  }
1412
1418
  isEqual(t) {
1413
- return gt(this.fields, t.fields, ((t, n) => t.isEqual(n)));
1419
+ return gt(this.fields, t.fields, ((t, e) => t.isEqual(e)));
1414
1420
  }
1415
1421
  }
1416
1422
 
@@ -1472,23 +1478,23 @@ class Rt {
1472
1478
  this.binaryString = t;
1473
1479
  }
1474
1480
  static fromBase64String(t) {
1475
- const n = At(t);
1476
- return new Rt(n);
1481
+ const e = At(t);
1482
+ return new Rt(e);
1477
1483
  }
1478
1484
  static fromUint8Array(t) {
1479
- const n =
1485
+ const e =
1480
1486
  /**
1481
1487
  * Helper function to convert an Uint8array to a binary string.
1482
1488
  */
1483
1489
  function(t) {
1484
- let n = "";
1485
- for (let e = 0; e < t.length; ++e) n += String.fromCharCode(t[e]);
1486
- return n;
1490
+ let e = "";
1491
+ for (let n = 0; n < t.length; ++n) e += String.fromCharCode(t[n]);
1492
+ return e;
1487
1493
  }
1488
1494
  /**
1489
1495
  * Helper function to convert a binary string to an Uint8Array.
1490
1496
  */ (t);
1491
- return new Rt(n);
1497
+ return new Rt(e);
1492
1498
  }
1493
1499
  [Symbol.iterator]() {
1494
1500
  let t = 0;
@@ -1504,16 +1510,16 @@ class Rt {
1504
1510
  }
1505
1511
  toBase64() {
1506
1512
  return function(t) {
1507
- const n = [];
1508
- for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
1509
- return a.encodeByteArray(n, !1);
1513
+ const e = [];
1514
+ for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n);
1515
+ return a.encodeByteArray(e, !1);
1510
1516
  }(this.binaryString);
1511
1517
  }
1512
1518
  toUint8Array() {
1513
1519
  return function(t) {
1514
- const n = new Uint8Array(t.length);
1515
- for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
1516
- return n;
1520
+ const e = new Uint8Array(t.length);
1521
+ for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n);
1522
+ return e;
1517
1523
  }
1518
1524
  /**
1519
1525
  * @license
@@ -1560,18 +1566,18 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1560
1566
  // The date string can have higher precision (nanos) than the Date class
1561
1567
  // (millis), so we do some custom parsing here.
1562
1568
  // Parse the nanos right out of the string.
1563
- let n = 0;
1564
- const e = Pt.exec(t);
1565
- if (b(!!e), e[1]) {
1569
+ let e = 0;
1570
+ const n = Pt.exec(t);
1571
+ if (b(!!n), n[1]) {
1566
1572
  // Pad the fraction out to 9 digits (nanos).
1567
- let t = e[1];
1568
- t = (t + "000000000").substr(0, 9), n = Number(t);
1573
+ let t = n[1];
1574
+ t = (t + "000000000").substr(0, 9), e = Number(t);
1569
1575
  }
1570
1576
  // Parse the date to get the seconds.
1571
1577
  const r = new Date(t);
1572
1578
  return {
1573
1579
  seconds: Math.floor(r.getTime() / 1e3),
1574
- nanos: n
1580
+ nanos: e
1575
1581
  };
1576
1582
  }
1577
1583
  return {
@@ -1626,8 +1632,8 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1626
1632
  * - With respect to other ServerTimestampValues, they sort by their
1627
1633
  * localWriteTime.
1628
1634
  */ function $t(t) {
1629
- var n, e;
1630
- return "server_timestamp" === (null === (e = ((null === (n = null == t ? void 0 : t.mapValue) || void 0 === n ? void 0 : n.fields) || {}).__type__) || void 0 === e ? void 0 : e.stringValue);
1635
+ var e, n;
1636
+ return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
1631
1637
  }
1632
1638
 
1633
1639
  /**
@@ -1636,15 +1642,15 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1636
1642
  * Preserving the previous values allows the user to display the last resoled
1637
1643
  * value until the backend responds with the timestamp.
1638
1644
  */ function St(t) {
1639
- const n = t.mapValue.fields.__previous_value__;
1640
- return $t(n) ? St(n) : n;
1645
+ const e = t.mapValue.fields.__previous_value__;
1646
+ return $t(e) ? St(e) : e;
1641
1647
  }
1642
1648
 
1643
1649
  /**
1644
1650
  * Returns the local time at which this timestamp was first set.
1645
1651
  */ function Ft(t) {
1646
- const n = Vt(t.mapValue.fields.__local_write_time__.timestampValue);
1647
- return new vt(n.seconds, n.nanos);
1652
+ const e = Vt(t.mapValue.fields.__local_write_time__.timestampValue);
1653
+ return new vt(e.seconds, e.nanos);
1648
1654
  }
1649
1655
 
1650
1656
  /**
@@ -1667,169 +1673,169 @@ const Pt = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1667
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 ? $t(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : v();
1668
1674
  }
1669
1675
 
1670
- /** Tests `left` and `right` for equality based on the backend semantics. */ function qt(t, n) {
1671
- if (t === n) return !0;
1672
- const e = xt(t);
1673
- if (e !== xt(n)) return !1;
1674
- switch (e) {
1676
+ /** Tests `left` and `right` for equality based on the backend semantics. */ function qt(t, e) {
1677
+ if (t === e) return !0;
1678
+ const n = xt(t);
1679
+ if (n !== xt(e)) return !1;
1680
+ switch (n) {
1675
1681
  case 0 /* NullValue */ :
1676
1682
  return !0;
1677
1683
 
1678
1684
  case 1 /* BooleanValue */ :
1679
- return t.booleanValue === n.booleanValue;
1685
+ return t.booleanValue === e.booleanValue;
1680
1686
 
1681
1687
  case 4 /* ServerTimestampValue */ :
1682
- return Ft(t).isEqual(Ft(n));
1688
+ return Ft(t).isEqual(Ft(e));
1683
1689
 
1684
1690
  case 3 /* TimestampValue */ :
1685
- return function(t, n) {
1686
- if ("string" == typeof t.timestampValue && "string" == typeof n.timestampValue && t.timestampValue.length === n.timestampValue.length)
1691
+ return function(t, e) {
1692
+ if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
1687
1693
  // Use string equality for ISO 8601 timestamps
1688
- return t.timestampValue === n.timestampValue;
1689
- const e = Vt(t.timestampValue), r = Vt(n.timestampValue);
1690
- return e.seconds === r.seconds && e.nanos === r.nanos;
1691
- }(t, n);
1694
+ return t.timestampValue === e.timestampValue;
1695
+ const n = Vt(t.timestampValue), r = Vt(e.timestampValue);
1696
+ return n.seconds === r.seconds && n.nanos === r.nanos;
1697
+ }(t, e);
1692
1698
 
1693
1699
  case 5 /* StringValue */ :
1694
- return t.stringValue === n.stringValue;
1700
+ return t.stringValue === e.stringValue;
1695
1701
 
1696
1702
  case 6 /* BlobValue */ :
1697
- return function(t, n) {
1698
- return Dt(t.bytesValue).isEqual(Dt(n.bytesValue));
1699
- }(t, n);
1703
+ return function(t, e) {
1704
+ return Dt(t.bytesValue).isEqual(Dt(e.bytesValue));
1705
+ }(t, e);
1700
1706
 
1701
1707
  case 7 /* RefValue */ :
1702
- return t.referenceValue === n.referenceValue;
1708
+ return t.referenceValue === e.referenceValue;
1703
1709
 
1704
1710
  case 8 /* GeoPointValue */ :
1705
- return function(t, n) {
1706
- return Nt(t.geoPointValue.latitude) === Nt(n.geoPointValue.latitude) && Nt(t.geoPointValue.longitude) === Nt(n.geoPointValue.longitude);
1707
- }(t, n);
1711
+ return function(t, e) {
1712
+ return Nt(t.geoPointValue.latitude) === Nt(e.geoPointValue.latitude) && Nt(t.geoPointValue.longitude) === Nt(e.geoPointValue.longitude);
1713
+ }(t, e);
1708
1714
 
1709
1715
  case 2 /* NumberValue */ :
1710
- return function(t, n) {
1711
- if ("integerValue" in t && "integerValue" in n) return Nt(t.integerValue) === Nt(n.integerValue);
1712
- if ("doubleValue" in t && "doubleValue" in n) {
1713
- const e = Nt(t.doubleValue), r = Nt(n.doubleValue);
1714
- return e === r ? ht(e) === ht(r) : isNaN(e) && isNaN(r);
1716
+ return function(t, e) {
1717
+ if ("integerValue" in t && "integerValue" in e) return Nt(t.integerValue) === Nt(e.integerValue);
1718
+ if ("doubleValue" in t && "doubleValue" in e) {
1719
+ const n = Nt(t.doubleValue), r = Nt(e.doubleValue);
1720
+ return n === r ? ht(n) === ht(r) : isNaN(n) && isNaN(r);
1715
1721
  }
1716
1722
  return !1;
1717
- }(t, n);
1723
+ }(t, e);
1718
1724
 
1719
1725
  case 9 /* ArrayValue */ :
1720
- return gt(t.arrayValue.values || [], n.arrayValue.values || [], qt);
1726
+ return gt(t.arrayValue.values || [], e.arrayValue.values || [], qt);
1721
1727
 
1722
1728
  case 10 /* ObjectValue */ :
1723
- return function(t, n) {
1724
- const e = t.mapValue.fields || {}, r = n.mapValue.fields || {};
1725
- if (Et(e) !== Et(r)) return !1;
1726
- for (const t in e) if (e.hasOwnProperty(t) && (void 0 === r[t] || !qt(e[t], r[t]))) return !1;
1729
+ return function(t, e) {
1730
+ const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
1731
+ if (Et(n) !== Et(r)) return !1;
1732
+ for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !qt(n[t], r[t]))) return !1;
1727
1733
  return !0;
1728
1734
  }
1729
- /** Returns true if the ArrayValue contains the specified element. */ (t, n);
1735
+ /** Returns true if the ArrayValue contains the specified element. */ (t, e);
1730
1736
 
1731
1737
  default:
1732
1738
  return v();
1733
1739
  }
1734
1740
  }
1735
1741
 
1736
- function Ot(t, n) {
1737
- return void 0 !== (t.values || []).find((t => qt(t, n)));
1742
+ function Ot(t, e) {
1743
+ return void 0 !== (t.values || []).find((t => qt(t, e)));
1738
1744
  }
1739
1745
 
1740
- function Ct(t, n) {
1741
- if (t === n) return 0;
1742
- const e = xt(t), r = xt(n);
1743
- if (e !== r) return _t(e, r);
1744
- switch (e) {
1746
+ function Ct(t, e) {
1747
+ if (t === e) return 0;
1748
+ const n = xt(t), r = xt(e);
1749
+ if (n !== r) return _t(n, r);
1750
+ switch (n) {
1745
1751
  case 0 /* NullValue */ :
1746
1752
  return 0;
1747
1753
 
1748
1754
  case 1 /* BooleanValue */ :
1749
- return _t(t.booleanValue, n.booleanValue);
1755
+ return _t(t.booleanValue, e.booleanValue);
1750
1756
 
1751
1757
  case 2 /* NumberValue */ :
1752
- return function(t, n) {
1753
- const e = Nt(t.integerValue || t.doubleValue), r = Nt(n.integerValue || n.doubleValue);
1754
- return e < r ? -1 : e > r ? 1 : e === r ? 0 :
1758
+ return function(t, e) {
1759
+ const n = Nt(t.integerValue || t.doubleValue), r = Nt(e.integerValue || e.doubleValue);
1760
+ return n < r ? -1 : n > r ? 1 : n === r ? 0 :
1755
1761
  // one or both are NaN.
1756
- isNaN(e) ? isNaN(r) ? 0 : -1 : 1;
1757
- }(t, n);
1762
+ isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
1763
+ }(t, e);
1758
1764
 
1759
1765
  case 3 /* TimestampValue */ :
1760
- return Lt(t.timestampValue, n.timestampValue);
1766
+ return Lt(t.timestampValue, e.timestampValue);
1761
1767
 
1762
1768
  case 4 /* ServerTimestampValue */ :
1763
- return Lt(Ft(t), Ft(n));
1769
+ return Lt(Ft(t), Ft(e));
1764
1770
 
1765
1771
  case 5 /* StringValue */ :
1766
- return _t(t.stringValue, n.stringValue);
1772
+ return _t(t.stringValue, e.stringValue);
1767
1773
 
1768
1774
  case 6 /* BlobValue */ :
1769
- return function(t, n) {
1770
- const e = Dt(t), r = Dt(n);
1771
- return e.compareTo(r);
1772
- }(t.bytesValue, n.bytesValue);
1775
+ return function(t, e) {
1776
+ const n = Dt(t), r = Dt(e);
1777
+ return n.compareTo(r);
1778
+ }(t.bytesValue, e.bytesValue);
1773
1779
 
1774
1780
  case 7 /* RefValue */ :
1775
- return function(t, n) {
1776
- const e = t.split("/"), r = n.split("/");
1777
- for (let t = 0; t < e.length && t < r.length; t++) {
1778
- const n = _t(e[t], r[t]);
1779
- if (0 !== n) return n;
1781
+ return function(t, e) {
1782
+ const n = t.split("/"), r = e.split("/");
1783
+ for (let t = 0; t < n.length && t < r.length; t++) {
1784
+ const e = _t(n[t], r[t]);
1785
+ if (0 !== e) return e;
1780
1786
  }
1781
- return _t(e.length, r.length);
1782
- }(t.referenceValue, n.referenceValue);
1787
+ return _t(n.length, r.length);
1788
+ }(t.referenceValue, e.referenceValue);
1783
1789
 
1784
1790
  case 8 /* GeoPointValue */ :
1785
- return function(t, n) {
1786
- const e = _t(Nt(t.latitude), Nt(n.latitude));
1787
- if (0 !== e) return e;
1788
- return _t(Nt(t.longitude), Nt(n.longitude));
1789
- }(t.geoPointValue, n.geoPointValue);
1791
+ return function(t, e) {
1792
+ const n = _t(Nt(t.latitude), Nt(e.latitude));
1793
+ if (0 !== n) return n;
1794
+ return _t(Nt(t.longitude), Nt(e.longitude));
1795
+ }(t.geoPointValue, e.geoPointValue);
1790
1796
 
1791
1797
  case 9 /* ArrayValue */ :
1792
- return function(t, n) {
1793
- const e = t.values || [], r = n.values || [];
1794
- for (let t = 0; t < e.length && t < r.length; ++t) {
1795
- const n = Ct(e[t], r[t]);
1796
- if (n) return n;
1798
+ return function(t, e) {
1799
+ const n = t.values || [], r = e.values || [];
1800
+ for (let t = 0; t < n.length && t < r.length; ++t) {
1801
+ const e = Ct(n[t], r[t]);
1802
+ if (e) return e;
1797
1803
  }
1798
- return _t(e.length, r.length);
1799
- }(t.arrayValue, n.arrayValue);
1804
+ return _t(n.length, r.length);
1805
+ }(t.arrayValue, e.arrayValue);
1800
1806
 
1801
1807
  case 10 /* ObjectValue */ :
1802
- return function(t, n) {
1803
- const e = t.fields || {}, r = Object.keys(e), s = n.fields || {}, i = Object.keys(s);
1808
+ return function(t, e) {
1809
+ const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
1804
1810
  // Even though MapValues are likely sorted correctly based on their insertion
1805
1811
  // order (e.g. when received from the backend), local modifications can bring
1806
1812
  // elements out of order. We need to re-sort the elements to ensure that
1807
1813
  // canonical IDs are independent of insertion order.
1808
1814
  r.sort(), i.sort();
1809
1815
  for (let t = 0; t < r.length && t < i.length; ++t) {
1810
- const n = _t(r[t], i[t]);
1811
- if (0 !== n) return n;
1812
- const o = Ct(e[r[t]], s[i[t]]);
1816
+ const e = _t(r[t], i[t]);
1817
+ if (0 !== e) return e;
1818
+ const o = Ct(n[r[t]], s[i[t]]);
1813
1819
  if (0 !== o) return o;
1814
1820
  }
1815
1821
  return _t(r.length, i.length);
1816
1822
  }
1817
- /** Returns a reference value for the provided database and key. */ (t.mapValue, n.mapValue);
1823
+ /** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
1818
1824
 
1819
1825
  default:
1820
1826
  throw v();
1821
1827
  }
1822
1828
  }
1823
1829
 
1824
- function Lt(t, n) {
1825
- if ("string" == typeof t && "string" == typeof n && t.length === n.length) return _t(t, n);
1826
- const e = Vt(t), r = Vt(n), s = _t(e.seconds, r.seconds);
1827
- return 0 !== s ? s : _t(e.nanos, r.nanos);
1830
+ function Lt(t, e) {
1831
+ if ("string" == typeof t && "string" == typeof e && t.length === e.length) return _t(t, e);
1832
+ const n = Vt(t), r = Vt(e), s = _t(n.seconds, r.seconds);
1833
+ return 0 !== s ? s : _t(n.nanos, r.nanos);
1828
1834
  }
1829
1835
 
1830
- function kt(t, n) {
1836
+ function kt(t, e) {
1831
1837
  return {
1832
- referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${n.path.canonicalString()}`
1838
+ referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
1833
1839
  };
1834
1840
  }
1835
1841
 
@@ -1857,21 +1863,21 @@ function kt(t, n) {
1857
1863
  timestampValue: Object.assign({}, t.timestampValue)
1858
1864
  };
1859
1865
  if (t.mapValue) {
1860
- const n = {
1866
+ const e = {
1861
1867
  mapValue: {
1862
1868
  fields: {}
1863
1869
  }
1864
1870
  };
1865
- return Tt(t.mapValue.fields, ((t, e) => n.mapValue.fields[t] = zt(e))), n;
1871
+ return Tt(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = zt(n))), e;
1866
1872
  }
1867
1873
  if (t.arrayValue) {
1868
- const n = {
1874
+ const e = {
1869
1875
  arrayValue: {
1870
1876
  values: []
1871
1877
  }
1872
1878
  };
1873
- for (let e = 0; e < (t.arrayValue.values || []).length; ++e) n.arrayValue.values[e] = zt(t.arrayValue.values[e]);
1874
- return n;
1879
+ for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = zt(t.arrayValue.values[n]);
1880
+ return e;
1875
1881
  }
1876
1882
  return Object.assign({}, t);
1877
1883
  }
@@ -1895,12 +1901,12 @@ function kt(t, n) {
1895
1901
  /**
1896
1902
  * An ObjectValue represents a MapValue in the Firestore Proto and offers the
1897
1903
  * ability to add and remove fields (via the ObjectValueBuilder).
1898
- */ class Qt {
1904
+ */ class Gt {
1899
1905
  constructor(t) {
1900
1906
  this.value = t;
1901
1907
  }
1902
1908
  static empty() {
1903
- return new Qt({
1909
+ return new Gt({
1904
1910
  mapValue: {}
1905
1911
  });
1906
1912
  }
@@ -1912,10 +1918,10 @@ function kt(t, n) {
1912
1918
  */ field(t) {
1913
1919
  if (t.isEmpty()) return this.value;
1914
1920
  {
1915
- let n = this.value;
1916
- for (let e = 0; e < t.length - 1; ++e) if (n = (n.mapValue.fields || {})[t.get(e)],
1917
- !Bt(n)) return null;
1918
- return n = (n.mapValue.fields || {})[t.lastSegment()], n || null;
1921
+ let e = this.value;
1922
+ for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
1923
+ !Bt(e)) return null;
1924
+ return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
1919
1925
  }
1920
1926
  }
1921
1927
  /**
@@ -1923,25 +1929,25 @@ function kt(t, n) {
1923
1929
  *
1924
1930
  * @param path - The field path to set.
1925
1931
  * @param value - The value to set.
1926
- */ set(t, n) {
1927
- this.getFieldsMap(t.popLast())[t.lastSegment()] = zt(n);
1932
+ */ set(t, e) {
1933
+ this.getFieldsMap(t.popLast())[t.lastSegment()] = zt(e);
1928
1934
  }
1929
1935
  /**
1930
1936
  * Sets the provided fields to the provided values.
1931
1937
  *
1932
1938
  * @param data - A map of fields to values (or null for deletes).
1933
1939
  */ setAll(t) {
1934
- let n = nt.emptyPath(), e = {}, r = [];
1940
+ let e = et.emptyPath(), n = {}, r = [];
1935
1941
  t.forEach(((t, s) => {
1936
- if (!n.isImmediateParentOf(s)) {
1942
+ if (!e.isImmediateParentOf(s)) {
1937
1943
  // Insert the accumulated changes at this parent location
1938
- const t = this.getFieldsMap(n);
1939
- this.applyChanges(t, e, r), e = {}, r = [], n = s.popLast();
1944
+ const t = this.getFieldsMap(e);
1945
+ this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
1940
1946
  }
1941
- t ? e[s.lastSegment()] = zt(t) : r.push(s.lastSegment());
1947
+ t ? n[s.lastSegment()] = zt(t) : r.push(s.lastSegment());
1942
1948
  }));
1943
- const s = this.getFieldsMap(n);
1944
- this.applyChanges(s, e, r);
1949
+ const s = this.getFieldsMap(e);
1950
+ this.applyChanges(s, n, r);
1945
1951
  }
1946
1952
  /**
1947
1953
  * Removes the field at the specified path. If there is no field at the
@@ -1949,8 +1955,8 @@ function kt(t, n) {
1949
1955
  *
1950
1956
  * @param path - The field path to remove.
1951
1957
  */ delete(t) {
1952
- const n = this.field(t.popLast());
1953
- Bt(n) && n.mapValue.fields && delete n.mapValue.fields[t.lastSegment()];
1958
+ const e = this.field(t.popLast());
1959
+ Bt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
1954
1960
  }
1955
1961
  isEqual(t) {
1956
1962
  return qt(this.value, t.value);
@@ -1959,29 +1965,29 @@ function kt(t, n) {
1959
1965
  * Returns the map that contains the leaf element of `path`. If the parent
1960
1966
  * entry does not yet exist, or if it is not a map, a new map will be created.
1961
1967
  */ getFieldsMap(t) {
1962
- let n = this.value;
1963
- n.mapValue.fields || (n.mapValue = {
1968
+ let e = this.value;
1969
+ e.mapValue.fields || (e.mapValue = {
1964
1970
  fields: {}
1965
1971
  });
1966
- for (let e = 0; e < t.length; ++e) {
1967
- let r = n.mapValue.fields[t.get(e)];
1972
+ for (let n = 0; n < t.length; ++n) {
1973
+ let r = e.mapValue.fields[t.get(n)];
1968
1974
  Bt(r) && r.mapValue.fields || (r = {
1969
1975
  mapValue: {
1970
1976
  fields: {}
1971
1977
  }
1972
- }, n.mapValue.fields[t.get(e)] = r), n = r;
1978
+ }, e.mapValue.fields[t.get(n)] = r), e = r;
1973
1979
  }
1974
- return n.mapValue.fields;
1980
+ return e.mapValue.fields;
1975
1981
  }
1976
1982
  /**
1977
1983
  * Modifies `fieldsMap` by adding, replacing or deleting the specified
1978
1984
  * entries.
1979
- */ applyChanges(t, n, e) {
1980
- Tt(n, ((n, e) => t[n] = e));
1981
- for (const n of e) delete t[n];
1985
+ */ applyChanges(t, e, n) {
1986
+ Tt(e, ((e, n) => t[e] = n));
1987
+ for (const e of n) delete t[e];
1982
1988
  }
1983
1989
  clone() {
1984
- return new Qt(zt(this.value));
1990
+ return new Gt(zt(this.value));
1985
1991
  }
1986
1992
  }
1987
1993
 
@@ -2010,45 +2016,45 @@ function kt(t, n) {
2010
2016
  * not transition to one of these states even after all mutations have been
2011
2017
  * applied, `isValidDocument()` returns false and the document should be removed
2012
2018
  * from all views.
2013
- */ class Gt {
2014
- constructor(t, n, e, r, s, i) {
2015
- this.key = t, this.documentType = n, this.version = e, this.readTime = r, this.data = s,
2019
+ */ class Qt {
2020
+ constructor(t, e, n, r, s, i) {
2021
+ this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
2016
2022
  this.documentState = i;
2017
2023
  }
2018
2024
  /**
2019
2025
  * Creates a document with no known version or data, but which can serve as
2020
2026
  * base document for mutations.
2021
2027
  */ static newInvalidDocument(t) {
2022
- return new Gt(t, 0 /* INVALID */ , bt.min(), bt.min(), Qt.empty(), 0 /* SYNCED */);
2028
+ return new Qt(t, 0 /* INVALID */ , bt.min(), bt.min(), Gt.empty(), 0 /* SYNCED */);
2023
2029
  }
2024
2030
  /**
2025
2031
  * Creates a new document that is known to exist with the given data at the
2026
2032
  * given version.
2027
- */ static newFoundDocument(t, n, e) {
2028
- return new Gt(t, 1 /* FOUND_DOCUMENT */ , n, bt.min(), e, 0 /* SYNCED */);
2033
+ */ static newFoundDocument(t, e, n) {
2034
+ return new Qt(t, 1 /* FOUND_DOCUMENT */ , e, bt.min(), n, 0 /* SYNCED */);
2029
2035
  }
2030
- /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
2031
- return new Gt(t, 2 /* NO_DOCUMENT */ , n, bt.min(), Qt.empty(), 0 /* SYNCED */);
2036
+ /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
2037
+ return new Qt(t, 2 /* NO_DOCUMENT */ , e, bt.min(), Gt.empty(), 0 /* SYNCED */);
2032
2038
  }
2033
2039
  /**
2034
2040
  * Creates a new document that is known to exist at the given version but
2035
2041
  * whose data is not known (e.g. a document that was updated without a known
2036
2042
  * base document).
2037
- */ static newUnknownDocument(t, n) {
2038
- return new Gt(t, 3 /* UNKNOWN_DOCUMENT */ , n, bt.min(), Qt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2043
+ */ static newUnknownDocument(t, e) {
2044
+ return new Qt(t, 3 /* UNKNOWN_DOCUMENT */ , e, bt.min(), Gt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2039
2045
  }
2040
2046
  /**
2041
2047
  * Changes the document type to indicate that it exists and that its version
2042
2048
  * and data are known.
2043
- */ convertToFoundDocument(t, n) {
2044
- return this.version = t, this.documentType = 1 /* FOUND_DOCUMENT */ , this.data = n,
2049
+ */ convertToFoundDocument(t, e) {
2050
+ return this.version = t, this.documentType = 1 /* FOUND_DOCUMENT */ , this.data = e,
2045
2051
  this.documentState = 0 /* SYNCED */ , this;
2046
2052
  }
2047
2053
  /**
2048
2054
  * Changes the document type to indicate that it doesn't exist at the given
2049
2055
  * version.
2050
2056
  */ convertToNoDocument(t) {
2051
- return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Qt.empty(),
2057
+ return this.version = t, this.documentType = 2 /* NO_DOCUMENT */ , this.data = Gt.empty(),
2052
2058
  this.documentState = 0 /* SYNCED */ , this;
2053
2059
  }
2054
2060
  /**
@@ -2056,7 +2062,7 @@ function kt(t, n) {
2056
2062
  * that its data is not known (e.g. a document that was updated without a known
2057
2063
  * base document).
2058
2064
  */ convertToUnknownDocument(t) {
2059
- return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Qt.empty(),
2065
+ return this.version = t, this.documentType = 3 /* UNKNOWN_DOCUMENT */ , this.data = Gt.empty(),
2060
2066
  this.documentState = 2 /* HAS_COMMITTED_MUTATIONS */ , this;
2061
2067
  }
2062
2068
  setHasCommittedMutations() {
@@ -2090,10 +2096,10 @@ function kt(t, n) {
2090
2096
  return 3 /* UNKNOWN_DOCUMENT */ === this.documentType;
2091
2097
  }
2092
2098
  isEqual(t) {
2093
- 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);
2099
+ return t instanceof Qt && this.key.isEqual(t.key) && this.version.isEqual(t.version) && this.documentType === t.documentType && this.documentState === t.documentState && this.data.isEqual(t.data);
2094
2100
  }
2095
2101
  mutableCopy() {
2096
- return new Gt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2102
+ return new Qt(this.key, this.documentType, this.version, this.readTime, this.data.clone(), this.documentState);
2097
2103
  }
2098
2104
  toString() {
2099
2105
  return `Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`;
@@ -2118,8 +2124,8 @@ function kt(t, n) {
2118
2124
  */
2119
2125
  // Visible for testing
2120
2126
  class Wt {
2121
- constructor(t, n = null, e = [], r = [], s = null, i = null, o = null) {
2122
- this.path = t, this.collectionGroup = n, this.orderBy = e, this.filters = r, this.limit = s,
2127
+ constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2128
+ this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
2123
2129
  this.startAt = i, this.endAt = o, this.P = null;
2124
2130
  }
2125
2131
  }
@@ -2131,26 +2137,26 @@ class Wt {
2131
2137
  * NOTE: you should always construct `Target` from `Query.toTarget` instead of
2132
2138
  * using this factory method, because `Query` provides an implicit `orderBy`
2133
2139
  * property.
2134
- */ function Yt(t, n = null, e = [], r = [], s = null, i = null, o = null) {
2135
- return new Wt(t, n, e, r, s, i, o);
2140
+ */ function Yt(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2141
+ return new Wt(t, e, n, r, s, i, o);
2136
2142
  }
2137
2143
 
2138
2144
  class Ht extends class {} {
2139
- constructor(t, n, e) {
2140
- super(), this.field = t, this.op = n, this.value = e;
2145
+ constructor(t, e, n) {
2146
+ super(), this.field = t, this.op = e, this.value = n;
2141
2147
  }
2142
2148
  /**
2143
2149
  * Creates a filter based on the provided arguments.
2144
- */ static create(t, n, e) {
2145
- return t.isKeyField() ? "in" /* IN */ === n || "not-in" /* NOT_IN */ === n ? this.V(t, n, e) : new Kt(t, n, e) : "array-contains" /* ARRAY_CONTAINS */ === n ? new tn(t, e) : "in" /* IN */ === n ? new nn(t, e) : "not-in" /* NOT_IN */ === n ? new en(t, e) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === n ? new rn(t, e) : new Ht(t, n, e);
2150
+ */ static create(t, e, n) {
2151
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Kt(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new te(t, n) : "in" /* IN */ === e ? new ee(t, n) : "not-in" /* NOT_IN */ === e ? new ne(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new re(t, n) : new Ht(t, e, n);
2146
2152
  }
2147
- static V(t, n, e) {
2148
- return "in" /* IN */ === n ? new Jt(t, e) : new Xt(t, e);
2153
+ static V(t, e, n) {
2154
+ return "in" /* IN */ === e ? new Jt(t, n) : new Xt(t, n);
2149
2155
  }
2150
2156
  matches(t) {
2151
- const n = t.data.field(this.field);
2157
+ const e = t.data.field(this.field);
2152
2158
  // Types do not have to match in NOT_EQUAL filters.
2153
- return "!=" /* NOT_EQUAL */ === this.op ? null !== n && this.N(Ct(n, this.value)) : null !== n && xt(this.value) === xt(n) && this.N(Ct(n, this.value));
2159
+ return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.N(Ct(e, this.value)) : null !== e && xt(this.value) === xt(e) && this.N(Ct(e, this.value));
2154
2160
  // Only compare types with matching backend order (such as double and int).
2155
2161
  }
2156
2162
  N(t) {
@@ -2184,82 +2190,81 @@ class Ht extends class {} {
2184
2190
 
2185
2191
  /** Filter that matches on key fields (i.e. '__name__'). */
2186
2192
  class Kt extends Ht {
2187
- constructor(t, n, e) {
2188
- super(t, n, e), this.key = et.fromName(e.referenceValue);
2193
+ constructor(t, e, n) {
2194
+ super(t, e, n), this.key = nt.fromName(n.referenceValue);
2189
2195
  }
2190
2196
  matches(t) {
2191
- const n = et.comparator(t.key, this.key);
2192
- return this.N(n);
2197
+ const e = nt.comparator(t.key, this.key);
2198
+ return this.N(e);
2193
2199
  }
2194
2200
  }
2195
2201
 
2196
2202
  /** Filter that matches on key fields within an array. */ class Jt extends Ht {
2197
- constructor(t, n) {
2198
- super(t, "in" /* IN */ , n), this.keys = Zt("in" /* IN */ , n);
2203
+ constructor(t, e) {
2204
+ super(t, "in" /* IN */ , e), this.keys = Zt("in" /* IN */ , e);
2199
2205
  }
2200
2206
  matches(t) {
2201
- return this.keys.some((n => n.isEqual(t.key)));
2207
+ return this.keys.some((e => e.isEqual(t.key)));
2202
2208
  }
2203
2209
  }
2204
2210
 
2205
2211
  /** Filter that matches on key fields not present within an array. */ class Xt extends Ht {
2206
- constructor(t, n) {
2207
- super(t, "not-in" /* NOT_IN */ , n), this.keys = Zt("not-in" /* NOT_IN */ , n);
2212
+ constructor(t, e) {
2213
+ super(t, "not-in" /* NOT_IN */ , e), this.keys = Zt("not-in" /* NOT_IN */ , e);
2208
2214
  }
2209
2215
  matches(t) {
2210
- return !this.keys.some((n => n.isEqual(t.key)));
2216
+ return !this.keys.some((e => e.isEqual(t.key)));
2211
2217
  }
2212
2218
  }
2213
2219
 
2214
- function Zt(t, n) {
2215
- var e;
2216
- return ((null === (e = n.arrayValue) || void 0 === e ? void 0 : e.values) || []).map((t => et.fromName(t.referenceValue)));
2220
+ function Zt(t, e) {
2221
+ var n;
2222
+ return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => nt.fromName(t.referenceValue)));
2217
2223
  }
2218
2224
 
2219
- /** A Filter that implements the array-contains operator. */ class tn extends Ht {
2220
- constructor(t, n) {
2221
- super(t, "array-contains" /* ARRAY_CONTAINS */ , n);
2225
+ /** A Filter that implements the array-contains operator. */ class te extends Ht {
2226
+ constructor(t, e) {
2227
+ super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
2222
2228
  }
2223
2229
  matches(t) {
2224
- const n = t.data.field(this.field);
2225
- return Ut(n) && Ot(n.arrayValue, this.value);
2230
+ const e = t.data.field(this.field);
2231
+ return Ut(e) && Ot(e.arrayValue, this.value);
2226
2232
  }
2227
2233
  }
2228
2234
 
2229
- /** A Filter that implements the IN operator. */ class nn extends Ht {
2230
- constructor(t, n) {
2231
- super(t, "in" /* IN */ , n);
2235
+ /** A Filter that implements the IN operator. */ class ee extends Ht {
2236
+ constructor(t, e) {
2237
+ super(t, "in" /* IN */ , e);
2232
2238
  }
2233
2239
  matches(t) {
2234
- const n = t.data.field(this.field);
2235
- return null !== n && Ot(this.value.arrayValue, n);
2240
+ const e = t.data.field(this.field);
2241
+ return null !== e && Ot(this.value.arrayValue, e);
2236
2242
  }
2237
2243
  }
2238
2244
 
2239
- /** A Filter that implements the not-in operator. */ class en extends Ht {
2240
- constructor(t, n) {
2241
- super(t, "not-in" /* NOT_IN */ , n);
2245
+ /** A Filter that implements the not-in operator. */ class ne extends Ht {
2246
+ constructor(t, e) {
2247
+ super(t, "not-in" /* NOT_IN */ , e);
2242
2248
  }
2243
2249
  matches(t) {
2244
2250
  if (Ot(this.value.arrayValue, {
2245
2251
  nullValue: "NULL_VALUE"
2246
2252
  })) return !1;
2247
- const n = t.data.field(this.field);
2248
- return null !== n && !Ot(this.value.arrayValue, n);
2253
+ const e = t.data.field(this.field);
2254
+ return null !== e && !Ot(this.value.arrayValue, e);
2249
2255
  }
2250
2256
  }
2251
2257
 
2252
- /** A Filter that implements the array-contains-any operator. */ class rn extends Ht {
2253
- constructor(t, n) {
2254
- super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n);
2258
+ /** A Filter that implements the array-contains-any operator. */ class re extends Ht {
2259
+ constructor(t, e) {
2260
+ super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
2255
2261
  }
2256
2262
  matches(t) {
2257
- const n = t.data.field(this.field);
2258
- return !(!Ut(n) || !n.arrayValue.values) && n.arrayValue.values.some((t => Ot(this.value.arrayValue, t)));
2263
+ const e = t.data.field(this.field);
2264
+ return !(!Ut(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => Ot(this.value.arrayValue, t)));
2259
2265
  }
2260
2266
  }
2261
2267
 
2262
- // TODO(indexing): Change Bound.before to "inclusive"
2263
2268
  /**
2264
2269
  * Represents a bound of a query.
2265
2270
  *
@@ -2273,30 +2278,30 @@ function Zt(t, n) {
2273
2278
  * Bound provides a function to determine whether a document comes before or
2274
2279
  * after a bound. This is influenced by whether the position is just before or
2275
2280
  * just after the provided values.
2276
- */ class sn {
2277
- constructor(t, n) {
2278
- this.position = t, this.before = n;
2281
+ */ class se {
2282
+ constructor(t, e) {
2283
+ this.position = t, this.inclusive = e;
2279
2284
  }
2280
2285
  }
2281
2286
 
2282
2287
  /**
2283
2288
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
2284
- */ class on {
2285
- constructor(t, n = "asc" /* ASCENDING */) {
2286
- this.field = t, this.dir = n;
2289
+ */ class ie {
2290
+ constructor(t, e = "asc" /* ASCENDING */) {
2291
+ this.field = t, this.dir = e;
2287
2292
  }
2288
2293
  }
2289
2294
 
2290
- function un(t, n) {
2291
- return t.dir === n.dir && t.field.isEqual(n.field);
2295
+ function oe(t, e) {
2296
+ return t.dir === e.dir && t.field.isEqual(e.field);
2292
2297
  }
2293
2298
 
2294
- function cn(t, n) {
2295
- if (null === t) return null === n;
2296
- if (null === n) return !1;
2297
- if (t.before !== n.before || t.position.length !== n.position.length) return !1;
2298
- for (let e = 0; e < t.position.length; e++) {
2299
- if (!qt(t.position[e], n.position[e])) return !1;
2299
+ function ue(t, e) {
2300
+ if (null === t) return null === e;
2301
+ if (null === e) return !1;
2302
+ if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
2303
+ for (let n = 0; n < t.position.length; n++) {
2304
+ if (!qt(t.position[n], e.position[n])) return !1;
2300
2305
  }
2301
2306
  return !0;
2302
2307
  }
@@ -2323,29 +2328,29 @@ function cn(t, n) {
2323
2328
  * query the RemoteStore results.
2324
2329
  *
2325
2330
  * Visible for testing.
2326
- */ class an {
2331
+ */ class ce {
2327
2332
  /**
2328
2333
  * Initializes a Query with a path and optional additional query constraints.
2329
2334
  * Path must currently be empty if this is a collection group query.
2330
2335
  */
2331
- constructor(t, n = null, e = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
2332
- this.path = t, this.collectionGroup = n, this.explicitOrderBy = e, this.filters = r,
2336
+ constructor(t, e = null, n = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
2337
+ this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = r,
2333
2338
  this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.$ = null,
2334
2339
  // The corresponding `Target` of this `Query` instance.
2335
2340
  this.S = null, this.startAt, this.endAt;
2336
2341
  }
2337
2342
  }
2338
2343
 
2339
- /** Creates a new Query for a query that matches all documents at `path` */ function hn(t) {
2344
+ /** Creates a new Query for a query that matches all documents at `path` */ function ae(t) {
2340
2345
  return !at(t.limit) && "L" /* Last */ === t.limitType;
2341
2346
  }
2342
2347
 
2343
- function ln(t) {
2348
+ function he(t) {
2344
2349
  return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
2345
2350
  }
2346
2351
 
2347
- function fn(t) {
2348
- for (const n of t.filters) if (n.D()) return n.field;
2352
+ function le(t) {
2353
+ for (const e of t.filters) if (e.D()) return e.field;
2349
2354
  return null;
2350
2355
  }
2351
2356
 
@@ -2357,7 +2362,7 @@ function fn(t) {
2357
2362
  * Returns whether the query matches a collection group rather than a specific
2358
2363
  * collection.
2359
2364
  */
2360
- function dn(t) {
2365
+ function fe(t) {
2361
2366
  return null !== t.collectionGroup;
2362
2367
  }
2363
2368
 
@@ -2365,59 +2370,59 @@ function dn(t) {
2365
2370
  * Returns the implicit order by constraint that is used to execute the Query,
2366
2371
  * which can be different from the order by constraints the user provided (e.g.
2367
2372
  * the SDK and backend always orders by `__name__`).
2368
- */ function wn(t) {
2369
- const n = E(t);
2370
- if (null === n.$) {
2371
- n.$ = [];
2372
- const t = fn(n), e = ln(n);
2373
- if (null !== t && null === e)
2373
+ */ function de(t) {
2374
+ const e = E(t);
2375
+ if (null === e.$) {
2376
+ e.$ = [];
2377
+ const t = le(e), n = he(e);
2378
+ if (null !== t && null === n)
2374
2379
  // In order to implicitly add key ordering, we must also add the
2375
2380
  // inequality filter field for it to be a valid query.
2376
2381
  // Note that the default inequality field and key ordering is ascending.
2377
- t.isKeyField() || n.$.push(new on(t)), n.$.push(new on(nt.keyField(), "asc" /* ASCENDING */)); else {
2382
+ t.isKeyField() || e.$.push(new ie(t)), e.$.push(new ie(et.keyField(), "asc" /* ASCENDING */)); else {
2378
2383
  let t = !1;
2379
- for (const e of n.explicitOrderBy) n.$.push(e), e.field.isKeyField() && (t = !0);
2384
+ for (const n of e.explicitOrderBy) e.$.push(n), n.field.isKeyField() && (t = !0);
2380
2385
  if (!t) {
2381
2386
  // The order of the implicit key ordering always matches the last
2382
2387
  // explicit order by
2383
- const t = n.explicitOrderBy.length > 0 ? n.explicitOrderBy[n.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2384
- n.$.push(new on(nt.keyField(), t));
2388
+ const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2389
+ e.$.push(new ie(et.keyField(), t));
2385
2390
  }
2386
2391
  }
2387
2392
  }
2388
- return n.$;
2393
+ return e.$;
2389
2394
  }
2390
2395
 
2391
2396
  /**
2392
2397
  * Converts this `Query` instance to it's corresponding `Target` representation.
2393
- */ function mn(t) {
2394
- const n = E(t);
2395
- if (!n.S) if ("F" /* First */ === n.limitType) n.S = Yt(n.path, n.collectionGroup, wn(n), n.filters, n.limit, n.startAt, n.endAt); else {
2398
+ */ function we(t) {
2399
+ const e = E(t);
2400
+ if (!e.S) if ("F" /* First */ === e.limitType) e.S = Yt(e.path, e.collectionGroup, de(e), e.filters, e.limit, e.startAt, e.endAt); else {
2396
2401
  // Flip the orderBy directions since we want the last results
2397
2402
  const t = [];
2398
- for (const e of wn(n)) {
2399
- const n = "desc" /* DESCENDING */ === e.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2400
- t.push(new on(e.field, n));
2403
+ for (const n of de(e)) {
2404
+ const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2405
+ t.push(new ie(n.field, e));
2401
2406
  }
2402
2407
  // We need to swap the cursors to match the now-flipped query ordering.
2403
- const e = n.endAt ? new sn(n.endAt.position, !n.endAt.before) : null, r = n.startAt ? new sn(n.startAt.position, !n.startAt.before) : null;
2408
+ const n = e.endAt ? new se(e.endAt.position, !e.endAt.inclusive) : null, r = e.startAt ? new se(e.startAt.position, !e.startAt.inclusive) : null;
2404
2409
  // Now return as a LimitType.First query.
2405
- n.S = Yt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
2410
+ e.S = Yt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2406
2411
  }
2407
- return n.S;
2412
+ return e.S;
2408
2413
  }
2409
2414
 
2410
- function pn(t, n) {
2411
- return function(t, n) {
2412
- if (t.limit !== n.limit) return !1;
2413
- if (t.orderBy.length !== n.orderBy.length) return !1;
2414
- for (let e = 0; e < t.orderBy.length; e++) if (!un(t.orderBy[e], n.orderBy[e])) return !1;
2415
- if (t.filters.length !== n.filters.length) return !1;
2416
- for (let s = 0; s < t.filters.length; s++) if (e = t.filters[s], r = n.filters[s],
2417
- e.op !== r.op || !e.field.isEqual(r.field) || !qt(e.value, r.value)) return !1;
2418
- var e, r;
2419
- return t.collectionGroup === n.collectionGroup && !!t.path.isEqual(n.path) && !!cn(t.startAt, n.startAt) && cn(t.endAt, n.endAt);
2420
- }(mn(t), mn(n)) && t.limitType === n.limitType;
2415
+ function me(t, e) {
2416
+ return function(t, e) {
2417
+ if (t.limit !== e.limit) return !1;
2418
+ if (t.orderBy.length !== e.orderBy.length) return !1;
2419
+ for (let n = 0; n < t.orderBy.length; n++) if (!oe(t.orderBy[n], e.orderBy[n])) return !1;
2420
+ if (t.filters.length !== e.filters.length) return !1;
2421
+ for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
2422
+ n.op !== r.op || !n.field.isEqual(r.field) || !qt(n.value, r.value)) return !1;
2423
+ var n, r;
2424
+ return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!ue(t.startAt, e.startAt) && ue(t.endAt, e.endAt);
2425
+ }(we(t), we(e)) && t.limitType === e.limitType;
2421
2426
  }
2422
2427
 
2423
2428
  /**
@@ -2445,10 +2450,10 @@ function pn(t, n) {
2445
2450
  * The return value is an IntegerValue if it can safely represent the value,
2446
2451
  * otherwise a DoubleValue is returned.
2447
2452
  */
2448
- function yn(t, n) {
2453
+ function pe(t, e) {
2449
2454
  return function(t) {
2450
2455
  return "number" == typeof t && Number.isInteger(t) && !ht(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2451
- }(n) ?
2456
+ }(e) ?
2452
2457
  /**
2453
2458
  * Returns an IntegerValue for `value`.
2454
2459
  */
@@ -2456,22 +2461,22 @@ function yn(t, n) {
2456
2461
  return {
2457
2462
  integerValue: "" + t
2458
2463
  };
2459
- }(n) : function(t, n) {
2464
+ }(e) : function(t, e) {
2460
2465
  if (t.F) {
2461
- if (isNaN(n)) return {
2466
+ if (isNaN(e)) return {
2462
2467
  doubleValue: "NaN"
2463
2468
  };
2464
- if (n === 1 / 0) return {
2469
+ if (e === 1 / 0) return {
2465
2470
  doubleValue: "Infinity"
2466
2471
  };
2467
- if (n === -1 / 0) return {
2472
+ if (e === -1 / 0) return {
2468
2473
  doubleValue: "-Infinity"
2469
2474
  };
2470
2475
  }
2471
2476
  return {
2472
- doubleValue: ht(n) ? "-0" : n
2477
+ doubleValue: ht(e) ? "-0" : e
2473
2478
  };
2474
- }(t, n);
2479
+ }(t, e);
2475
2480
  }
2476
2481
 
2477
2482
  /**
@@ -2490,7 +2495,7 @@ function yn(t, n) {
2490
2495
  * See the License for the specific language governing permissions and
2491
2496
  * limitations under the License.
2492
2497
  */
2493
- /** Used to represent a field transform on a mutation. */ class _n {
2498
+ /** Used to represent a field transform on a mutation. */ class ye {
2494
2499
  constructor() {
2495
2500
  // Make sure that the structural type of `TransformOperation` is unique.
2496
2501
  // See https://github.com/microsoft/TypeScript/issues/5451
@@ -2498,15 +2503,15 @@ function yn(t, n) {
2498
2503
  }
2499
2504
  }
2500
2505
 
2501
- /** Transforms a value into a server-generated timestamp. */ class gn extends _n {}
2506
+ /** Transforms a value into a server-generated timestamp. */ class _e extends ye {}
2502
2507
 
2503
- /** Transforms an array value via a union operation. */ class vn extends _n {
2508
+ /** Transforms an array value via a union operation. */ class ge extends ye {
2504
2509
  constructor(t) {
2505
2510
  super(), this.elements = t;
2506
2511
  }
2507
2512
  }
2508
2513
 
2509
- /** Transforms an array value via a remove operation. */ class bn extends _n {
2514
+ /** Transforms an array value via a remove operation. */ class ve extends ye {
2510
2515
  constructor(t) {
2511
2516
  super(), this.elements = t;
2512
2517
  }
@@ -2517,9 +2522,9 @@ function yn(t, n) {
2517
2522
  * transforms. Converts all field values to integers or doubles, but unlike the
2518
2523
  * backend does not cap integer values at 2^63. Instead, JavaScript number
2519
2524
  * arithmetic is used and precision loss can occur for values greater than 2^53.
2520
- */ class En extends _n {
2521
- constructor(t, n) {
2522
- super(), this.q = t, this.O = n;
2525
+ */ class be extends ye {
2526
+ constructor(t, e) {
2527
+ super(), this.q = t, this.O = e;
2523
2528
  }
2524
2529
  }
2525
2530
 
@@ -2539,9 +2544,9 @@ function yn(t, n) {
2539
2544
  * See the License for the specific language governing permissions and
2540
2545
  * limitations under the License.
2541
2546
  */
2542
- /** A field path and the TransformOperation to perform upon it. */ class Tn {
2543
- constructor(t, n) {
2544
- this.field = t, this.transform = n;
2547
+ /** A field path and the TransformOperation to perform upon it. */ class Ee {
2548
+ constructor(t, e) {
2549
+ this.field = t, this.transform = e;
2545
2550
  }
2546
2551
  }
2547
2552
 
@@ -2549,18 +2554,18 @@ function yn(t, n) {
2549
2554
  * Encodes a precondition for a mutation. This follows the model that the
2550
2555
  * backend accepts with the special case of an explicit "empty" precondition
2551
2556
  * (meaning no precondition).
2552
- */ class In {
2553
- constructor(t, n) {
2554
- this.updateTime = t, this.exists = n;
2557
+ */ class Te {
2558
+ constructor(t, e) {
2559
+ this.updateTime = t, this.exists = e;
2555
2560
  }
2556
2561
  /** Creates a new empty Precondition. */ static none() {
2557
- return new In;
2562
+ return new Te;
2558
2563
  }
2559
2564
  /** Creates a new Precondition with an exists flag. */ static exists(t) {
2560
- return new In(void 0, t);
2565
+ return new Te(void 0, t);
2561
2566
  }
2562
2567
  /** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
2563
- return new In(t);
2568
+ return new Te(t);
2564
2569
  }
2565
2570
  /** Returns whether this Precondition is empty. */ get isNone() {
2566
2571
  return void 0 === this.updateTime && void 0 === this.exists;
@@ -2613,14 +2618,14 @@ function yn(t, n) {
2613
2618
  * applyToLocalView() to implement the actual behavior of applying the mutation
2614
2619
  * to some source document (see `setMutationApplyToRemoteDocument()` for an
2615
2620
  * example).
2616
- */ class An {}
2621
+ */ class Ie {}
2617
2622
 
2618
2623
  /**
2619
2624
  * A mutation that creates or replaces the document at the given key with the
2620
2625
  * object value contents.
2621
- */ class Rn extends An {
2622
- constructor(t, n, e, r = []) {
2623
- super(), this.key = t, this.value = n, this.precondition = e, this.fieldTransforms = r,
2626
+ */ class Ae extends Ie {
2627
+ constructor(t, e, n, r = []) {
2628
+ super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
2624
2629
  this.type = 0 /* Set */;
2625
2630
  }
2626
2631
  }
@@ -2637,16 +2642,16 @@ function yn(t, n) {
2637
2642
  * is deleted.
2638
2643
  * * When a field is not in the mask but is in the values, the values map is
2639
2644
  * ignored.
2640
- */ class Pn extends An {
2641
- constructor(t, n, e, r, s = []) {
2642
- super(), this.key = t, this.data = n, this.fieldMask = e, this.precondition = r,
2645
+ */ class Re extends Ie {
2646
+ constructor(t, e, n, r, s = []) {
2647
+ super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
2643
2648
  this.fieldTransforms = s, this.type = 1 /* Patch */;
2644
2649
  }
2645
2650
  }
2646
2651
 
2647
- /** A mutation that deletes the document at the given key. */ class Vn extends An {
2648
- constructor(t, n) {
2649
- super(), this.key = t, this.precondition = n, this.type = 2 /* Delete */ , this.fieldTransforms = [];
2652
+ /** A mutation that deletes the document at the given key. */ class Pe extends Ie {
2653
+ constructor(t, e) {
2654
+ super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
2650
2655
  }
2651
2656
  }
2652
2657
 
@@ -2656,9 +2661,9 @@ function yn(t, n) {
2656
2661
  *
2657
2662
  * The `verify` operation is only used in Transactions, and this class serves
2658
2663
  * primarily to facilitate serialization into protos.
2659
- */ class Nn extends An {
2660
- constructor(t, n) {
2661
- super(), this.key = t, this.precondition = n, this.type = 3 /* Verify */ , this.fieldTransforms = [];
2664
+ */ class Ve extends Ie {
2665
+ constructor(t, e) {
2666
+ super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
2662
2667
  }
2663
2668
  }
2664
2669
 
@@ -2677,13 +2682,13 @@ function yn(t, n) {
2677
2682
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2678
2683
  * See the License for the specific language governing permissions and
2679
2684
  * limitations under the License.
2680
- */ const Dn = (() => {
2685
+ */ const Ne = (() => {
2681
2686
  const t = {
2682
2687
  asc: "ASCENDING",
2683
2688
  desc: "DESCENDING"
2684
2689
  };
2685
2690
  return t;
2686
- })(), $n = (() => {
2691
+ })(), De = (() => {
2687
2692
  const t = {
2688
2693
  "<": "LESS_THAN",
2689
2694
  "<=": "LESS_THAN_OR_EQUAL",
@@ -2713,9 +2718,9 @@ function yn(t, n) {
2713
2718
  * TODO(klimt): We can remove the databaseId argument if we keep the full
2714
2719
  * resource name in documents.
2715
2720
  */
2716
- class Sn {
2717
- constructor(t, n) {
2718
- this.databaseId = t, this.F = n;
2721
+ class $e {
2722
+ constructor(t, e) {
2723
+ this.databaseId = t, this.F = e;
2719
2724
  }
2720
2725
  }
2721
2726
 
@@ -2730,13 +2735,13 @@ class Sn {
2730
2735
  /**
2731
2736
  * Returns a value for a Date that's appropriate to put into a proto.
2732
2737
  */
2733
- function Fn(t, n) {
2738
+ function Se(t, e) {
2734
2739
  if (t.F) {
2735
- return `${new Date(1e3 * n.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + n.nanoseconds).slice(-9)}Z`;
2740
+ return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
2736
2741
  }
2737
2742
  return {
2738
- seconds: "" + n.seconds,
2739
- nanos: n.nanoseconds
2743
+ seconds: "" + e.seconds,
2744
+ nanos: e.nanoseconds
2740
2745
  };
2741
2746
  }
2742
2747
 
@@ -2745,232 +2750,234 @@ function Fn(t, n) {
2745
2750
  *
2746
2751
  * Visible for testing.
2747
2752
  */
2748
- function xn(t, n) {
2749
- return t.F ? n.toBase64() : n.toUint8Array();
2753
+ function Fe(t, e) {
2754
+ return t.F ? e.toBase64() : e.toUint8Array();
2750
2755
  }
2751
2756
 
2752
- function qn(t, n) {
2753
- return Fn(t, n.toTimestamp());
2757
+ function xe(t, e) {
2758
+ return Se(t, e.toTimestamp());
2754
2759
  }
2755
2760
 
2756
- function On(t) {
2761
+ function qe(t) {
2757
2762
  return b(!!t), bt.fromTimestamp(function(t) {
2758
- const n = Vt(t);
2759
- return new vt(n.seconds, n.nanos);
2763
+ const e = Vt(t);
2764
+ return new vt(e.seconds, e.nanos);
2760
2765
  }(t));
2761
2766
  }
2762
2767
 
2763
- function Cn(t, n) {
2768
+ function Oe(t, e) {
2764
2769
  return function(t) {
2765
2770
  return new Z([ "projects", t.projectId, "databases", t.database ]);
2766
- }(t).child("documents").child(n).canonicalString();
2771
+ }(t).child("documents").child(e).canonicalString();
2767
2772
  }
2768
2773
 
2769
- function Ln(t, n) {
2770
- return Cn(t.databaseId, n.path);
2774
+ function Ce(t, e) {
2775
+ return Oe(t.databaseId, e.path);
2771
2776
  }
2772
2777
 
2773
- function kn(t, n) {
2774
- const e = function(t) {
2775
- const n = Z.fromString(t);
2776
- return b(Jn(n)), n;
2777
- }(n);
2778
- if (e.get(1) !== t.databaseId.projectId) throw new U(R, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
2779
- if (e.get(3) !== t.databaseId.database) throw new U(R, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
2780
- return new et((b((r = e).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
2778
+ function Le(t, e) {
2779
+ const n = function(t) {
2780
+ const e = Z.fromString(t);
2781
+ return b(He(e)), e;
2782
+ }(e);
2783
+ if (n.get(1) !== t.databaseId.projectId) throw new U(R, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
2784
+ if (n.get(3) !== t.databaseId.database) throw new U(R, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
2785
+ return new nt((b((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
2781
2786
  var r;
2782
2787
  /** Creates a Document proto from key and fields (but no create/update time) */}
2783
2788
 
2784
- function Un(t, n) {
2785
- return Cn(t.databaseId, n);
2789
+ function ke(t, e) {
2790
+ return Oe(t.databaseId, e);
2786
2791
  }
2787
2792
 
2788
- function jn(t) {
2793
+ function Ue(t) {
2789
2794
  return new Z([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
2790
2795
  }
2791
2796
 
2792
- function Mn(t, n, e) {
2797
+ function je(t, e, n) {
2793
2798
  return {
2794
- name: Ln(t, n),
2795
- fields: e.value.mapValue.fields
2799
+ name: Ce(t, e),
2800
+ fields: n.value.mapValue.fields
2796
2801
  };
2797
2802
  }
2798
2803
 
2799
- function Bn(t, n) {
2800
- return "found" in n ? function(t, n) {
2801
- b(!!n.found), n.found.name, n.found.updateTime;
2802
- const e = kn(t, n.found.name), r = On(n.found.updateTime), s = new Qt({
2804
+ function Me(t, e) {
2805
+ return "found" in e ? function(t, e) {
2806
+ b(!!e.found), e.found.name, e.found.updateTime;
2807
+ const n = Le(t, e.found.name), r = qe(e.found.updateTime), s = new Gt({
2803
2808
  mapValue: {
2804
- fields: n.found.fields
2809
+ fields: e.found.fields
2805
2810
  }
2806
2811
  });
2807
- return Gt.newFoundDocument(e, r, s);
2808
- }(t, n) : "missing" in n ? function(t, n) {
2809
- b(!!n.missing), b(!!n.readTime);
2810
- const e = kn(t, n.missing), r = On(n.readTime);
2811
- return Gt.newNoDocument(e, r);
2812
- }(t, n) : v();
2813
- }
2814
-
2815
- function zn(t, n) {
2816
- let e;
2817
- if (n instanceof Rn) e = {
2818
- update: Mn(t, n.key, n.value)
2819
- }; else if (n instanceof Vn) e = {
2820
- delete: Ln(t, n.key)
2821
- }; else if (n instanceof Pn) e = {
2822
- update: Mn(t, n.key, n.data),
2823
- updateMask: Kn(n.fieldMask)
2812
+ return Qt.newFoundDocument(n, r, s);
2813
+ }(t, e) : "missing" in e ? function(t, e) {
2814
+ b(!!e.missing), b(!!e.readTime);
2815
+ const n = Le(t, e.missing), r = qe(e.readTime);
2816
+ return Qt.newNoDocument(n, r);
2817
+ }(t, e) : v();
2818
+ }
2819
+
2820
+ function Be(t, e) {
2821
+ let n;
2822
+ if (e instanceof Ae) n = {
2823
+ update: je(t, e.key, e.value)
2824
+ }; else if (e instanceof Pe) n = {
2825
+ delete: Ce(t, e.key)
2826
+ }; else if (e instanceof Re) n = {
2827
+ update: je(t, e.key, e.data),
2828
+ updateMask: Ye(e.fieldMask)
2824
2829
  }; else {
2825
- if (!(n instanceof Nn)) return v();
2826
- e = {
2827
- verify: Ln(t, n.key)
2830
+ if (!(e instanceof Ve)) return v();
2831
+ n = {
2832
+ verify: Ce(t, e.key)
2828
2833
  };
2829
2834
  }
2830
- return n.fieldTransforms.length > 0 && (e.updateTransforms = n.fieldTransforms.map((t => function(t, n) {
2831
- const e = n.transform;
2832
- if (e instanceof gn) return {
2833
- fieldPath: n.field.canonicalString(),
2835
+ return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
2836
+ const n = e.transform;
2837
+ if (n instanceof _e) return {
2838
+ fieldPath: e.field.canonicalString(),
2834
2839
  setToServerValue: "REQUEST_TIME"
2835
2840
  };
2836
- if (e instanceof vn) return {
2837
- fieldPath: n.field.canonicalString(),
2841
+ if (n instanceof ge) return {
2842
+ fieldPath: e.field.canonicalString(),
2838
2843
  appendMissingElements: {
2839
- values: e.elements
2844
+ values: n.elements
2840
2845
  }
2841
2846
  };
2842
- if (e instanceof bn) return {
2843
- fieldPath: n.field.canonicalString(),
2847
+ if (n instanceof ve) return {
2848
+ fieldPath: e.field.canonicalString(),
2844
2849
  removeAllFromArray: {
2845
- values: e.elements
2850
+ values: n.elements
2846
2851
  }
2847
2852
  };
2848
- if (e instanceof En) return {
2849
- fieldPath: n.field.canonicalString(),
2850
- increment: e.O
2853
+ if (n instanceof be) return {
2854
+ fieldPath: e.field.canonicalString(),
2855
+ increment: n.O
2851
2856
  };
2852
2857
  throw v();
2853
- }(0, t)))), n.precondition.isNone || (e.currentDocument = function(t, n) {
2854
- return void 0 !== n.updateTime ? {
2855
- updateTime: qn(t, n.updateTime)
2856
- } : void 0 !== n.exists ? {
2857
- exists: n.exists
2858
+ }(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
2859
+ return void 0 !== e.updateTime ? {
2860
+ updateTime: xe(t, e.updateTime)
2861
+ } : void 0 !== e.exists ? {
2862
+ exists: e.exists
2858
2863
  } : v();
2859
- }(t, n.precondition)), e;
2864
+ }(t, e.precondition)), n;
2860
2865
  }
2861
2866
 
2862
- function Qn(t, n) {
2867
+ function ze(t, e) {
2863
2868
  // Dissect the path into parent, collectionId, and optional key filter.
2864
- const e = {
2869
+ const n = {
2865
2870
  structuredQuery: {}
2866
- }, r = n.path;
2867
- null !== n.collectionGroup ? (e.parent = Un(t, r), e.structuredQuery.from = [ {
2868
- collectionId: n.collectionGroup,
2871
+ }, r = e.path;
2872
+ null !== e.collectionGroup ? (n.parent = ke(t, r), n.structuredQuery.from = [ {
2873
+ collectionId: e.collectionGroup,
2869
2874
  allDescendants: !0
2870
- } ]) : (e.parent = Un(t, r.popLast()), e.structuredQuery.from = [ {
2875
+ } ]) : (n.parent = ke(t, r.popLast()), n.structuredQuery.from = [ {
2871
2876
  collectionId: r.lastSegment()
2872
2877
  } ]);
2873
2878
  const s = function(t) {
2874
2879
  if (0 === t.length) return;
2875
- const n = t.map((t =>
2880
+ const e = t.map((t =>
2876
2881
  // visible for testing
2877
2882
  function(t) {
2878
2883
  if ("==" /* EQUAL */ === t.op) {
2879
2884
  if (Mt(t.value)) return {
2880
2885
  unaryFilter: {
2881
- field: Hn(t.field),
2886
+ field: We(t.field),
2882
2887
  op: "IS_NAN"
2883
2888
  }
2884
2889
  };
2885
2890
  if (jt(t.value)) return {
2886
2891
  unaryFilter: {
2887
- field: Hn(t.field),
2892
+ field: We(t.field),
2888
2893
  op: "IS_NULL"
2889
2894
  }
2890
2895
  };
2891
2896
  } else if ("!=" /* NOT_EQUAL */ === t.op) {
2892
2897
  if (Mt(t.value)) return {
2893
2898
  unaryFilter: {
2894
- field: Hn(t.field),
2899
+ field: We(t.field),
2895
2900
  op: "IS_NOT_NAN"
2896
2901
  }
2897
2902
  };
2898
2903
  if (jt(t.value)) return {
2899
2904
  unaryFilter: {
2900
- field: Hn(t.field),
2905
+ field: We(t.field),
2901
2906
  op: "IS_NOT_NULL"
2902
2907
  }
2903
2908
  };
2904
2909
  }
2905
2910
  return {
2906
2911
  fieldFilter: {
2907
- field: Hn(t.field),
2908
- op: Yn(t.op),
2912
+ field: We(t.field),
2913
+ op: Qe(t.op),
2909
2914
  value: t.value
2910
2915
  }
2911
2916
  };
2912
2917
  }(t)));
2913
- if (1 === n.length) return n[0];
2918
+ if (1 === e.length) return e[0];
2914
2919
  return {
2915
2920
  compositeFilter: {
2916
2921
  op: "AND",
2917
- filters: n
2922
+ filters: e
2918
2923
  }
2919
2924
  };
2920
- }(n.filters);
2921
- s && (e.structuredQuery.where = s);
2925
+ }(e.filters);
2926
+ s && (n.structuredQuery.where = s);
2922
2927
  const i = function(t) {
2923
2928
  if (0 === t.length) return;
2924
2929
  return t.map((t =>
2925
2930
  // visible for testing
2926
2931
  function(t) {
2927
2932
  return {
2928
- field: Hn(t.field),
2929
- direction: Wn(t.dir)
2933
+ field: We(t.field),
2934
+ direction: Ge(t.dir)
2930
2935
  };
2931
2936
  }(t)));
2932
- }(n.orderBy);
2933
- i && (e.structuredQuery.orderBy = i);
2934
- const o = function(t, n) {
2935
- return t.F || at(n) ? n : {
2936
- value: n
2937
+ }(e.orderBy);
2938
+ i && (n.structuredQuery.orderBy = i);
2939
+ const o = function(t, e) {
2940
+ return t.F || at(e) ? e : {
2941
+ value: e
2937
2942
  };
2938
- }(t, n.limit);
2939
- return null !== o && (e.structuredQuery.limit = o), n.startAt && (e.structuredQuery.startAt = Gn(n.startAt)),
2940
- n.endAt && (e.structuredQuery.endAt = Gn(n.endAt)), e;
2941
- }
2942
-
2943
- function Gn(t) {
2944
- return {
2945
- before: t.before,
2946
- values: t.position
2947
- };
2943
+ }(t, e.limit);
2944
+ var u;
2945
+ return null !== o && (n.structuredQuery.limit = o), e.startAt && (n.structuredQuery.startAt = {
2946
+ before: (u = e.startAt).inclusive,
2947
+ values: u.position
2948
+ }), e.endAt && (n.structuredQuery.endAt = function(t) {
2949
+ return {
2950
+ before: !t.inclusive,
2951
+ values: t.position
2952
+ };
2953
+ }
2954
+ // visible for testing
2955
+ (e.endAt)), n;
2948
2956
  }
2949
2957
 
2950
- // visible for testing
2951
- function Wn(t) {
2952
- return Dn[t];
2958
+ function Ge(t) {
2959
+ return Ne[t];
2953
2960
  }
2954
2961
 
2955
2962
  // visible for testing
2956
- function Yn(t) {
2957
- return $n[t];
2963
+ function Qe(t) {
2964
+ return De[t];
2958
2965
  }
2959
2966
 
2960
- function Hn(t) {
2967
+ function We(t) {
2961
2968
  return {
2962
2969
  fieldPath: t.canonicalString()
2963
2970
  };
2964
2971
  }
2965
2972
 
2966
- function Kn(t) {
2967
- const n = [];
2968
- return t.fields.forEach((t => n.push(t.canonicalString()))), {
2969
- fieldPaths: n
2973
+ function Ye(t) {
2974
+ const e = [];
2975
+ return t.fields.forEach((t => e.push(t.canonicalString()))), {
2976
+ fieldPaths: e
2970
2977
  };
2971
2978
  }
2972
2979
 
2973
- function Jn(t) {
2980
+ function He(t) {
2974
2981
  // Resource names have at least 4 components (project ID, database ID)
2975
2982
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
2976
2983
  }
@@ -2990,8 +2997,8 @@ function Jn(t) {
2990
2997
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2991
2998
  * See the License for the specific language governing permissions and
2992
2999
  * limitations under the License.
2993
- */ function Xn(t) {
2994
- return new Sn(t, /* useProto3Json= */ !0);
3000
+ */ function Ke(t) {
3001
+ return new $e(t, /* useProto3Json= */ !0);
2995
3002
  }
2996
3003
 
2997
3004
  /**
@@ -3019,7 +3026,7 @@ function Jn(t) {
3019
3026
  * base delay. This prevents clients from accidentally synchronizing their
3020
3027
  * delays causing spikes of load to the backend.
3021
3028
  */
3022
- class Zn {
3029
+ class Je {
3023
3030
  constructor(
3024
3031
  /**
3025
3032
  * The AsyncQueue to run backoff operations on.
@@ -3028,13 +3035,13 @@ class Zn {
3028
3035
  /**
3029
3036
  * The ID to use when scheduling backoff operations on the AsyncQueue.
3030
3037
  */
3031
- n,
3038
+ e,
3032
3039
  /**
3033
3040
  * The initial delay (used as the base delay on the first retry attempt).
3034
3041
  * Note that jitter will still be applied, so the actual delay could be as
3035
3042
  * little as 0.5*initialDelayMs.
3036
3043
  */
3037
- e = 1e3
3044
+ n = 1e3
3038
3045
  /**
3039
3046
  * The multiplier to use to determine the extended base delay after each
3040
3047
  * attempt.
@@ -3044,7 +3051,7 @@ class Zn {
3044
3051
  * Note that jitter will still be applied, so the actual delay could be as
3045
3052
  * much as 1.5*maxDelayMs.
3046
3053
  */ , s = 6e4) {
3047
- this.C = t, this.timerId = n, this.L = e, this.k = r, this.U = s, this.j = 0, this.M = null,
3054
+ this.C = t, this.timerId = e, this.L = n, this.k = r, this.U = s, this.j = 0, this.M = null,
3048
3055
  /** The last backoff attempt, as epoch milliseconds. */
3049
3056
  this.B = Date.now(), this.reset();
3050
3057
  }
@@ -3072,9 +3079,9 @@ class Zn {
3072
3079
  this.cancel();
3073
3080
  // First schedule using the current base (which may be 0 and should be
3074
3081
  // honored as such).
3075
- const n = Math.floor(this.j + this.Y()), e = Math.max(0, Date.now() - this.B), r = Math.max(0, n - e);
3082
+ const e = Math.floor(this.j + this.Y()), n = Math.max(0, Date.now() - this.B), r = Math.max(0, e - n);
3076
3083
  // Guard against lastAttemptTime being in the future due to a clock change.
3077
- r > 0 && p("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.j} ms, delay with jitter: ${n} ms, last attempt: ${e} ms ago)`),
3084
+ r > 0 && p("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.j} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
3078
3085
  this.M = this.C.enqueueAfterDelay(this.timerId, r, (() => (this.B = Date.now(),
3079
3086
  t()))),
3080
3087
  // Apply backoff factor to determine next delay and ensure it is within
@@ -3117,22 +3124,22 @@ class Zn {
3117
3124
  * An implementation of Datastore that exposes additional state for internal
3118
3125
  * consumption.
3119
3126
  */
3120
- class te extends class {} {
3121
- constructor(t, n, e, r) {
3122
- super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
3127
+ class Xe extends class {} {
3128
+ constructor(t, e, n, r) {
3129
+ super(), this.authCredentials = t, this.appCheckCredentials = e, this.K = n, this.q = r,
3123
3130
  this.J = !1;
3124
3131
  }
3125
3132
  X() {
3126
3133
  if (this.J) throw new U(F, "The client has already been terminated.");
3127
3134
  }
3128
- /** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, n, e) {
3129
- return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, n, e, r, s))).catch((t => {
3135
+ /** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, e, n) {
3136
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, e, n, r, s))).catch((t => {
3130
3137
  throw "FirebaseError" === t.name ? (t.code === $ && (this.authCredentials.invalidateToken(),
3131
3138
  this.appCheckCredentials.invalidateToken()), t) : new U(A, t.toString());
3132
3139
  }));
3133
3140
  }
3134
- /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, n, e) {
3135
- return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, n, e, r, s))).catch((t => {
3141
+ /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, e, n) {
3142
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, e, n, r, s))).catch((t => {
3136
3143
  throw "FirebaseError" === t.name ? (t.code === $ && (this.authCredentials.invalidateToken(),
3137
3144
  this.appCheckCredentials.invalidateToken()), t) : new U(A, t.toString());
3138
3145
  }));
@@ -3144,40 +3151,40 @@ class te extends class {} {
3144
3151
 
3145
3152
  // TODO(firestorexp): Make sure there is only one Datastore instance per
3146
3153
  // firestore-exp client.
3147
- async function ne(t, n) {
3148
- const e = E(t), r = jn(e.q) + "/documents", s = {
3149
- writes: n.map((t => zn(e.q, t)))
3154
+ async function Ze(t, e) {
3155
+ const n = E(t), r = Ue(n.q) + "/documents", s = {
3156
+ writes: e.map((t => Be(n.q, t)))
3150
3157
  };
3151
- await e.m("Commit", r, s);
3158
+ await n.m("Commit", r, s);
3152
3159
  }
3153
3160
 
3154
- async function ee(t, n) {
3155
- const e = E(t), r = jn(e.q) + "/documents", s = {
3156
- documents: n.map((t => Ln(e.q, t)))
3157
- }, i = await e.T("BatchGetDocuments", r, s), o = new Map;
3161
+ async function tn(t, e) {
3162
+ const n = E(t), r = Ue(n.q) + "/documents", s = {
3163
+ documents: e.map((t => Ce(n.q, t)))
3164
+ }, i = await n.T("BatchGetDocuments", r, s), o = new Map;
3158
3165
  i.forEach((t => {
3159
- const n = Bn(e.q, t);
3160
- o.set(n.key.toString(), n);
3166
+ const e = Me(n.q, t);
3167
+ o.set(e.key.toString(), e);
3161
3168
  }));
3162
3169
  const u = [];
3163
- return n.forEach((t => {
3164
- const n = o.get(t.toString());
3165
- b(!!n), u.push(n);
3170
+ return e.forEach((t => {
3171
+ const e = o.get(t.toString());
3172
+ b(!!e), u.push(e);
3166
3173
  })), u;
3167
3174
  }
3168
3175
 
3169
- async function re(t, n) {
3170
- const e = E(t), r = Qn(e.q, mn(n));
3171
- return (await e.T("RunQuery", r.parent, {
3176
+ async function en(t, e) {
3177
+ const n = E(t), r = ze(n.q, we(e));
3178
+ return (await n.T("RunQuery", r.parent, {
3172
3179
  structuredQuery: r.structuredQuery
3173
- })).filter((t => !!t.document)).map((t => function(t, n, e) {
3174
- const r = kn(t, n.name), s = On(n.updateTime), i = new Qt({
3180
+ })).filter((t => !!t.document)).map((t => function(t, e, n) {
3181
+ const r = Le(t, e.name), s = qe(e.updateTime), i = new Gt({
3175
3182
  mapValue: {
3176
- fields: n.fields
3183
+ fields: e.fields
3177
3184
  }
3178
- }), o = Gt.newFoundDocument(r, s, i);
3179
- return e && o.setHasCommittedMutations(), e ? o.setHasCommittedMutations() : o;
3180
- }(e.q, t.document, void 0)));
3185
+ }), o = Qt.newFoundDocument(r, s, i);
3186
+ return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
3187
+ }(n.q, t.document, void 0)));
3181
3188
  }
3182
3189
 
3183
3190
  /**
@@ -3195,7 +3202,7 @@ async function re(t, n) {
3195
3202
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3196
3203
  * See the License for the specific language governing permissions and
3197
3204
  * limitations under the License.
3198
- */ const se = new Map;
3205
+ */ const nn = new Map;
3199
3206
 
3200
3207
  /**
3201
3208
  * An instance map that ensures only one Datastore exists per Firestore
@@ -3206,19 +3213,19 @@ async function re(t, n) {
3206
3213
  * instance. Callers must invoke removeComponents() when the Firestore
3207
3214
  * instance is terminated.
3208
3215
  */
3209
- function ie(t) {
3216
+ function rn(t) {
3210
3217
  if (t._terminated) throw new U(F, "The client has already been terminated.");
3211
- if (!se.has(t)) {
3218
+ if (!nn.has(t)) {
3212
3219
  p("ComponentProvider", "Initializing Datastore");
3213
3220
  const i = function(t) {
3214
3221
  return new mt(t, fetch.bind(null));
3215
- }((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3216
- new K(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Xn(t._databaseId), u = function(t, n, e, r) {
3217
- return new te(t, n, e, r);
3222
+ }((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3223
+ new K(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Ke(t._databaseId), u = function(t, e, n, r) {
3224
+ return new Xe(t, e, n, r);
3218
3225
  }(t._authCredentials, t._appCheckCredentials, i, o);
3219
- se.set(t, u);
3226
+ nn.set(t, u);
3220
3227
  }
3221
- var n, e, r, s;
3228
+ var e, n, r, s;
3222
3229
  /**
3223
3230
  * @license
3224
3231
  * Copyright 2018 Google LLC
@@ -3234,7 +3241,7 @@ function ie(t) {
3234
3241
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3235
3242
  * See the License for the specific language governing permissions and
3236
3243
  * limitations under the License.
3237
- */ return se.get(t);
3244
+ */ return nn.get(t);
3238
3245
  }
3239
3246
 
3240
3247
  /**
@@ -3246,21 +3253,21 @@ function ie(t) {
3246
3253
  * user-supplied `FirestoreSettings` object. This is a separate type so that
3247
3254
  * defaults can be supplied and the value can be checked for equality.
3248
3255
  */
3249
- class oe {
3256
+ class sn {
3250
3257
  constructor(t) {
3251
- var n;
3258
+ var e;
3252
3259
  if (void 0 === t.host) {
3253
3260
  if (void 0 !== t.ssl) throw new U(R, "Can't provide ssl option if host option is not set");
3254
3261
  this.host = "firestore.googleapis.com", this.ssl = true;
3255
- } else this.host = t.host, this.ssl = null === (n = t.ssl) || void 0 === n || n;
3262
+ } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
3256
3263
  if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
3257
3264
  void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
3258
3265
  if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(R, "cacheSizeBytes must be at least 1048576");
3259
3266
  this.cacheSizeBytes = t.cacheSizeBytes;
3260
3267
  }
3261
3268
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
3262
- this.useFetchStreams = !!t.useFetchStreams, function(t, n, e, r) {
3263
- if (!0 === n && !0 === r) throw new U(R, `${t} and ${e} cannot be used together.`);
3269
+ this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
3270
+ if (!0 === e && !0 === r) throw new U(R, `${t} and ${n} cannot be used together.`);
3264
3271
  }("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
3265
3272
  }
3266
3273
  isEqual(t) {
@@ -3288,14 +3295,14 @@ class oe {
3288
3295
  * The Cloud Firestore service interface.
3289
3296
  *
3290
3297
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
3291
- */ class ue {
3298
+ */ class on {
3292
3299
  /** @hideconstructor */
3293
- constructor(t, n, e) {
3294
- this._authCredentials = n, this._appCheckCredentials = e,
3300
+ constructor(t, e, n) {
3301
+ this._authCredentials = e, this._appCheckCredentials = n,
3295
3302
  /**
3296
3303
  * Whether it's a Firestore or Firestore Lite instance.
3297
3304
  */
3298
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new oe({}),
3305
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new sn({}),
3299
3306
  this._settingsFrozen = !1, t instanceof J ? this._databaseId = t : (this._app = t,
3300
3307
  this._databaseId = function(t) {
3301
3308
  if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(R, '"projectId" not provided in firebase.initializeApp.');
@@ -3328,14 +3335,14 @@ class oe {
3328
3335
  }
3329
3336
  _setSettings(t) {
3330
3337
  if (this._settingsFrozen) throw new U(F, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
3331
- this._settings = new oe(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3338
+ this._settings = new sn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3332
3339
  if (!t) return new B;
3333
3340
  switch (t.type) {
3334
3341
  case "gapi":
3335
- const n = t.client;
3342
+ const e = t.client;
3336
3343
  // Make sure this really is a Gapi client.
3337
- return b(!("object" != typeof n || null === n || !n.auth || !n.auth.getAuthHeaderValueForFirstParty)),
3338
- new W(n, t.sessionIndex || "0", t.iamToken || null);
3344
+ return b(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
3345
+ new W(e, t.sessionIndex || "0", t.iamToken || null);
3339
3346
 
3340
3347
  case "provider":
3341
3348
  return t.client;
@@ -3369,17 +3376,17 @@ class oe {
3369
3376
  * Only ever called once.
3370
3377
  */ _terminate() {
3371
3378
  return function(t) {
3372
- const n = se.get(t);
3373
- n && (p("ComponentProvider", "Removing Datastore"), se.delete(t), n.terminate());
3379
+ const e = nn.get(t);
3380
+ e && (p("ComponentProvider", "Removing Datastore"), nn.delete(t), e.terminate());
3374
3381
  }(this), Promise.resolve();
3375
3382
  }
3376
3383
  }
3377
3384
 
3378
- function ce(t, n) {
3379
- const e = _getProvider(t, "firestore/lite");
3380
- if (e.isInitialized()) throw new U(F, "Firestore can only be initialized once per app.");
3381
- return e.initialize({
3382
- options: n
3385
+ function un(t, e) {
3386
+ const n = _getProvider(t, "firestore/lite");
3387
+ if (n.isInitialized()) throw new U(F, "Firestore can only be initialized once per app.");
3388
+ return n.initialize({
3389
+ options: e
3383
3390
  });
3384
3391
  }
3385
3392
 
@@ -3391,8 +3398,8 @@ function ce(t, n) {
3391
3398
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
3392
3399
  * instance is associated with.
3393
3400
  * @returns The `Firestore` instance of the provided app.
3394
- */ function ae(n = t()) {
3395
- return _getProvider(n, "firestore/lite").getImmediate();
3401
+ */ function cn(e = t()) {
3402
+ return _getProvider(e, "firestore/lite").getImmediate();
3396
3403
  }
3397
3404
 
3398
3405
  /**
@@ -3407,24 +3414,24 @@ function ce(t, n) {
3407
3414
  * @param port - the emulator port (ex: 9000).
3408
3415
  * @param options.mockUserToken - the mock auth token to use for unit testing
3409
3416
  * Security Rules.
3410
- */ function he(t, n, e, r = {}) {
3417
+ */ function an(t, e, n, r = {}) {
3411
3418
  var s;
3412
- const i = (t = ut(t, ue))._getSettings();
3413
- if ("firestore.googleapis.com" !== i.host && i.host !== n && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3419
+ const i = (t = ut(t, on))._getSettings();
3420
+ if ("firestore.googleapis.com" !== i.host && i.host !== e && _("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3414
3421
  t._setSettings(Object.assign(Object.assign({}, i), {
3415
- host: `${n}:${e}`,
3422
+ host: `${e}:${n}`,
3416
3423
  ssl: !1
3417
3424
  })), r.mockUserToken) {
3418
- let n, e;
3419
- if ("string" == typeof r.mockUserToken) n = r.mockUserToken, e = f.MOCK_USER; else {
3425
+ let e, n;
3426
+ if ("string" == typeof r.mockUserToken) e = r.mockUserToken, n = f.MOCK_USER; else {
3420
3427
  // Let createMockUserToken validate first (catches common mistakes like
3421
3428
  // invalid field "uid" and missing field "sub" / "user_id".)
3422
- n = h(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3429
+ e = h(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3423
3430
  const i = r.mockUserToken.sub || r.mockUserToken.user_id;
3424
3431
  if (!i) throw new U(R, "mockUserToken must contain 'sub' or 'user_id' field!");
3425
- e = new f(i);
3432
+ n = new f(i);
3426
3433
  }
3427
- t._authCredentials = new z(new M(n, e));
3434
+ t._authCredentials = new z(new M(e, n));
3428
3435
  }
3429
3436
  }
3430
3437
 
@@ -3447,8 +3454,8 @@ function ce(t, n) {
3447
3454
  * @param firestore - The `Firestore` instance to terminate.
3448
3455
  * @returns A `Promise` that is resolved when the instance has been successfully
3449
3456
  * terminated.
3450
- */ function le(t) {
3451
- return t = ut(t, ue), n(t.app, "firestore/lite"), t._delete();
3457
+ */ function hn(t) {
3458
+ return t = ut(t, on), e(t.app, "firestore/lite"), t._delete();
3452
3459
  }
3453
3460
 
3454
3461
  /**
@@ -3488,14 +3495,14 @@ function ce(t, n) {
3488
3495
  * and can be used to write, read, or listen to the location. The document at
3489
3496
  * the referenced location may or may not exist.
3490
3497
  */
3491
- class fe {
3498
+ class ln {
3492
3499
  /** @hideconstructor */
3493
3500
  constructor(t,
3494
3501
  /**
3495
3502
  * If provided, the `FirestoreDataConverter` associated with this instance.
3496
3503
  */
3497
- n, e) {
3498
- this.converter = n, this._key = e,
3504
+ e, n) {
3505
+ this.converter = e, this._key = n,
3499
3506
  /** The type of this Firestore reference. */
3500
3507
  this.type = "document", this.firestore = t;
3501
3508
  }
@@ -3516,40 +3523,40 @@ class fe {
3516
3523
  /**
3517
3524
  * The collection this `DocumentReference` belongs to.
3518
3525
  */ get parent() {
3519
- return new we(this.firestore, this.converter, this._key.path.popLast());
3526
+ return new dn(this.firestore, this.converter, this._key.path.popLast());
3520
3527
  }
3521
3528
  withConverter(t) {
3522
- return new fe(this.firestore, t, this._key);
3529
+ return new ln(this.firestore, t, this._key);
3523
3530
  }
3524
3531
  }
3525
3532
 
3526
3533
  /**
3527
3534
  * A `Query` refers to a query which you can read or listen to. You can also
3528
3535
  * construct refined `Query` objects by adding filters and ordering.
3529
- */ class de {
3536
+ */ class fn {
3530
3537
  // This is the lite version of the Query class in the main SDK.
3531
3538
  /** @hideconstructor protected */
3532
3539
  constructor(t,
3533
3540
  /**
3534
3541
  * If provided, the `FirestoreDataConverter` associated with this instance.
3535
3542
  */
3536
- n, e) {
3537
- this.converter = n, this._query = e,
3543
+ e, n) {
3544
+ this.converter = e, this._query = n,
3538
3545
  /** The type of this Firestore reference. */
3539
3546
  this.type = "query", this.firestore = t;
3540
3547
  }
3541
3548
  withConverter(t) {
3542
- return new de(this.firestore, t, this._query);
3549
+ return new fn(this.firestore, t, this._query);
3543
3550
  }
3544
3551
  }
3545
3552
 
3546
3553
  /**
3547
3554
  * A `CollectionReference` object can be used for adding documents, getting
3548
3555
  * document references, and querying for documents (using {@link query}).
3549
- */ class we extends de {
3556
+ */ class dn extends fn {
3550
3557
  /** @hideconstructor */
3551
- constructor(t, n, e) {
3552
- super(t, n, new an(e)), this._path = e,
3558
+ constructor(t, e, n) {
3559
+ super(t, e, new ce(n)), this._path = n,
3553
3560
  /** The type of this Firestore reference. */
3554
3561
  this.type = "collection";
3555
3562
  }
@@ -3567,23 +3574,23 @@ class fe {
3567
3574
  * subcollection. If this isn't a subcollection, the reference is null.
3568
3575
  */ get parent() {
3569
3576
  const t = this._path.popLast();
3570
- return t.isEmpty() ? null : new fe(this.firestore,
3571
- /* converter= */ null, new et(t));
3577
+ return t.isEmpty() ? null : new ln(this.firestore,
3578
+ /* converter= */ null, new nt(t));
3572
3579
  }
3573
3580
  withConverter(t) {
3574
- return new we(this.firestore, t, this._path);
3581
+ return new dn(this.firestore, t, this._path);
3575
3582
  }
3576
3583
  }
3577
3584
 
3578
- function me(t, n, ...e) {
3579
- if (t = l(t), rt("collection", "path", n), t instanceof ue) {
3580
- const r = Z.fromString(n, ...e);
3581
- return it(r), new we(t, /* converter= */ null, r);
3585
+ function wn(t, e, ...n) {
3586
+ if (t = l(t), rt("collection", "path", e), t instanceof on) {
3587
+ const r = Z.fromString(e, ...n);
3588
+ return it(r), new dn(t, /* converter= */ null, r);
3582
3589
  }
3583
3590
  {
3584
- if (!(t instanceof fe || t instanceof we)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3585
- const r = t._path.child(Z.fromString(n, ...e));
3586
- return it(r), new we(t.firestore,
3591
+ if (!(t instanceof ln || t instanceof dn)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3592
+ const r = t._path.child(Z.fromString(e, ...n));
3593
+ return it(r), new dn(t.firestore,
3587
3594
  /* converter= */ null, r);
3588
3595
  }
3589
3596
  }
@@ -3600,32 +3607,32 @@ function me(t, n, ...e) {
3600
3607
  * collection or subcollection with this ID as the last segment of its path
3601
3608
  * will be included. Cannot contain a slash.
3602
3609
  * @returns The created `Query`.
3603
- */ function pe(t, n) {
3604
- if (t = ut(t, ue), rt("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(R, `Invalid collection ID '${n}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
3605
- return new de(t,
3610
+ */ function mn(t, e) {
3611
+ if (t = ut(t, on), rt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(R, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
3612
+ return new fn(t,
3606
3613
  /* converter= */ null,
3607
3614
  /**
3608
3615
  * Creates a new Query for a collection group query that matches all documents
3609
3616
  * within the provided collection group.
3610
3617
  */
3611
3618
  function(t) {
3612
- return new an(Z.emptyPath(), t);
3613
- }(n));
3619
+ return new ce(Z.emptyPath(), t);
3620
+ }(e));
3614
3621
  }
3615
3622
 
3616
- function ye(t, n, ...e) {
3623
+ function pn(t, e, ...n) {
3617
3624
  if (t = l(t),
3618
3625
  // We allow omission of 'pathString' but explicitly prohibit passing in both
3619
3626
  // 'undefined' and 'null'.
3620
- 1 === arguments.length && (n = yt.R()), rt("doc", "path", n), t instanceof ue) {
3621
- const r = Z.fromString(n, ...e);
3622
- return st(r), new fe(t,
3623
- /* converter= */ null, new et(r));
3627
+ 1 === arguments.length && (e = yt.R()), rt("doc", "path", e), t instanceof on) {
3628
+ const r = Z.fromString(e, ...n);
3629
+ return st(r), new ln(t,
3630
+ /* converter= */ null, new nt(r));
3624
3631
  }
3625
3632
  {
3626
- if (!(t instanceof fe || t instanceof we)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3627
- const r = t._path.child(Z.fromString(n, ...e));
3628
- return st(r), new fe(t.firestore, t instanceof we ? t.converter : null, new et(r));
3633
+ if (!(t instanceof ln || t instanceof dn)) throw new U(R, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3634
+ const r = t._path.child(Z.fromString(e, ...n));
3635
+ return st(r), new ln(t.firestore, t instanceof dn ? t.converter : null, new nt(r));
3629
3636
  }
3630
3637
  }
3631
3638
 
@@ -3636,8 +3643,8 @@ function ye(t, n, ...e) {
3636
3643
  * @param right - A reference to compare.
3637
3644
  * @returns true if the references point to the same location in the same
3638
3645
  * Firestore database.
3639
- */ function _e(t, n) {
3640
- return t = l(t), n = l(n), (t instanceof fe || t instanceof we) && (n instanceof fe || n instanceof we) && (t.firestore === n.firestore && t.path === n.path && t.converter === n.converter);
3646
+ */ function yn(t, e) {
3647
+ return t = l(t), e = l(e), (t instanceof ln || t instanceof dn) && (e instanceof ln || e instanceof dn) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
3641
3648
  }
3642
3649
 
3643
3650
  /**
@@ -3648,8 +3655,8 @@ function ye(t, n, ...e) {
3648
3655
  * @param right - A `Query` to compare.
3649
3656
  * @returns true if the references point to the same location in the same
3650
3657
  * Firestore database.
3651
- */ function ge(t, n) {
3652
- return t = l(t), n = l(n), t instanceof de && n instanceof de && (t.firestore === n.firestore && pn(t._query, n._query) && t.converter === n.converter);
3658
+ */ function _n(t, e) {
3659
+ return t = l(t), e = l(e), t instanceof fn && e instanceof fn && (t.firestore === e.firestore && me(t._query, e._query) && t.converter === e.converter);
3653
3660
  }
3654
3661
 
3655
3662
  /**
@@ -3675,7 +3682,7 @@ function ye(t, n, ...e) {
3675
3682
  *
3676
3683
  * Create a `FieldPath` by providing field names. If more than one field
3677
3684
  * name is provided, the path will point to a nested field in a document.
3678
- */ class ve {
3685
+ */ class gn {
3679
3686
  /**
3680
3687
  * Creates a `FieldPath` from the provided field names. If more than one field
3681
3688
  * name is provided, the path will point to a nested field in a document.
@@ -3683,8 +3690,8 @@ function ye(t, n, ...e) {
3683
3690
  * @param fieldNames - A list of field names.
3684
3691
  */
3685
3692
  constructor(...t) {
3686
- for (let n = 0; n < t.length; ++n) if (0 === t[n].length) throw new U(R, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3687
- this._internalPath = new nt(t);
3693
+ for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new U(R, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3694
+ this._internalPath = new et(t);
3688
3695
  }
3689
3696
  /**
3690
3697
  * Returns true if this `FieldPath` is equal to the provided one.
@@ -3699,8 +3706,8 @@ function ye(t, n, ...e) {
3699
3706
  /**
3700
3707
  * Returns a special sentinel `FieldPath` to refer to the ID of a document.
3701
3708
  * It can be used in queries to sort or filter by the document ID.
3702
- */ function be() {
3703
- return new ve("__name__");
3709
+ */ function vn() {
3710
+ return new gn("__name__");
3704
3711
  }
3705
3712
 
3706
3713
  /**
@@ -3721,7 +3728,7 @@ function ye(t, n, ...e) {
3721
3728
  */
3722
3729
  /**
3723
3730
  * An immutable object representing an array of bytes.
3724
- */ class Ee {
3731
+ */ class bn {
3725
3732
  /** @hideconstructor */
3726
3733
  constructor(t) {
3727
3734
  this._byteString = t;
@@ -3733,7 +3740,7 @@ function ye(t, n, ...e) {
3733
3740
  * @param base64 - The Base64 string used to create the `Bytes` object.
3734
3741
  */ static fromBase64String(t) {
3735
3742
  try {
3736
- return new Ee(Rt.fromBase64String(t));
3743
+ return new bn(Rt.fromBase64String(t));
3737
3744
  } catch (t) {
3738
3745
  throw new U(R, "Failed to construct data from Base64 string: " + t);
3739
3746
  }
@@ -3743,7 +3750,7 @@ function ye(t, n, ...e) {
3743
3750
  *
3744
3751
  * @param array - The Uint8Array used to create the `Bytes` object.
3745
3752
  */ static fromUint8Array(t) {
3746
- return new Ee(Rt.fromUint8Array(t));
3753
+ return new bn(Rt.fromUint8Array(t));
3747
3754
  }
3748
3755
  /**
3749
3756
  * Returns the underlying bytes as a Base64-encoded string.
@@ -3795,7 +3802,7 @@ function ye(t, n, ...e) {
3795
3802
  /**
3796
3803
  * Sentinel values that can be used when writing document fields with `set()`
3797
3804
  * or `update()`.
3798
- */ class Te {
3805
+ */ class En {
3799
3806
  /**
3800
3807
  * @param _methodName - The public API endpoint that returns this class.
3801
3808
  * @hideconstructor
@@ -3827,17 +3834,17 @@ function ye(t, n, ...e) {
3827
3834
  *
3828
3835
  * Latitude values are in the range of [-90, 90].
3829
3836
  * Longitude values are in the range of [-180, 180].
3830
- */ class Ie {
3837
+ */ class Tn {
3831
3838
  /**
3832
3839
  * Creates a new immutable `GeoPoint` object with the provided latitude and
3833
3840
  * longitude values.
3834
3841
  * @param latitude - The latitude as number between -90 and 90.
3835
3842
  * @param longitude - The longitude as number between -180 and 180.
3836
3843
  */
3837
- constructor(t, n) {
3844
+ constructor(t, e) {
3838
3845
  if (!isFinite(t) || t < -90 || t > 90) throw new U(R, "Latitude must be a number between -90 and 90, but was: " + t);
3839
- if (!isFinite(n) || n < -180 || n > 180) throw new U(R, "Longitude must be a number between -180 and 180, but was: " + n);
3840
- this._lat = t, this._long = n;
3846
+ if (!isFinite(e) || e < -180 || e > 180) throw new U(R, "Longitude must be a number between -180 and 180, but was: " + e);
3847
+ this._lat = t, this._long = e;
3841
3848
  }
3842
3849
  /**
3843
3850
  * The latitude of this `GeoPoint` instance.
@@ -3886,29 +3893,29 @@ function ye(t, n, ...e) {
3886
3893
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3887
3894
  * See the License for the specific language governing permissions and
3888
3895
  * limitations under the License.
3889
- */ const Ae = /^__.*__$/;
3896
+ */ const In = /^__.*__$/;
3890
3897
 
3891
- /** The result of parsing document data (e.g. for a setData call). */ class Re {
3892
- constructor(t, n, e) {
3893
- this.data = t, this.fieldMask = n, this.fieldTransforms = e;
3898
+ /** The result of parsing document data (e.g. for a setData call). */ class An {
3899
+ constructor(t, e, n) {
3900
+ this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3894
3901
  }
3895
- toMutation(t, n) {
3896
- return null !== this.fieldMask ? new Pn(t, this.data, this.fieldMask, n, this.fieldTransforms) : new Rn(t, this.data, n, this.fieldTransforms);
3902
+ toMutation(t, e) {
3903
+ return null !== this.fieldMask ? new Re(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Ae(t, this.data, e, this.fieldTransforms);
3897
3904
  }
3898
3905
  }
3899
3906
 
3900
- /** The result of parsing "update" data (i.e. for an updateData call). */ class Pe {
3907
+ /** The result of parsing "update" data (i.e. for an updateData call). */ class Rn {
3901
3908
  constructor(t,
3902
3909
  // The fieldMask does not include document transforms.
3903
- n, e) {
3904
- this.data = t, this.fieldMask = n, this.fieldTransforms = e;
3910
+ e, n) {
3911
+ this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3905
3912
  }
3906
- toMutation(t, n) {
3907
- return new Pn(t, this.data, this.fieldMask, n, this.fieldTransforms);
3913
+ toMutation(t, e) {
3914
+ return new Re(t, this.data, this.fieldMask, e, this.fieldTransforms);
3908
3915
  }
3909
3916
  }
3910
3917
 
3911
- function Ve(t) {
3918
+ function Pn(t) {
3912
3919
  switch (t) {
3913
3920
  case 0 /* Set */ :
3914
3921
  // fall through
@@ -3926,7 +3933,7 @@ function Ve(t) {
3926
3933
  }
3927
3934
  }
3928
3935
 
3929
- /** A "context" object passed around while parsing user data. */ class Ne {
3936
+ /** A "context" object passed around while parsing user data. */ class Vn {
3930
3937
  /**
3931
3938
  * Initializes a ParseContext with the given source and path.
3932
3939
  *
@@ -3945,8 +3952,8 @@ function Ve(t) {
3945
3952
  * which case certain features will not work and errors will be somewhat
3946
3953
  * compromised).
3947
3954
  */
3948
- constructor(t, n, e, r, s, i) {
3949
- this.settings = t, this.databaseId = n, this.q = e, this.ignoreUndefinedProperties = r,
3955
+ constructor(t, e, n, r, s, i) {
3956
+ this.settings = t, this.databaseId = e, this.q = n, this.ignoreUndefinedProperties = r,
3950
3957
  // Minor hack: If fieldTransforms is undefined, we assume this is an
3951
3958
  // external call and we need to validate the entire path.
3952
3959
  void 0 === s && this.Z(), this.fieldTransforms = s || [], this.fieldMask = i || [];
@@ -3957,21 +3964,21 @@ function Ve(t) {
3957
3964
  get tt() {
3958
3965
  return this.settings.tt;
3959
3966
  }
3960
- /** Returns a new context with the specified settings overwritten. */ nt(t) {
3961
- return new Ne(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3967
+ /** Returns a new context with the specified settings overwritten. */ et(t) {
3968
+ return new Vn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3962
3969
  }
3963
- et(t) {
3964
- var n;
3965
- const e = null === (n = this.path) || void 0 === n ? void 0 : n.child(t), r = this.nt({
3966
- path: e,
3970
+ nt(t) {
3971
+ var e;
3972
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.et({
3973
+ path: n,
3967
3974
  rt: !1
3968
3975
  });
3969
3976
  return r.st(t), r;
3970
3977
  }
3971
3978
  it(t) {
3972
- var n;
3973
- const e = null === (n = this.path) || void 0 === n ? void 0 : n.child(t), r = this.nt({
3974
- path: e,
3979
+ var e;
3980
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.et({
3981
+ path: n,
3975
3982
  rt: !1
3976
3983
  });
3977
3984
  return r.Z(), r;
@@ -3979,16 +3986,16 @@ function Ve(t) {
3979
3986
  ot(t) {
3980
3987
  // TODO(b/34871131): We don't support array paths right now; so make path
3981
3988
  // undefined.
3982
- return this.nt({
3989
+ return this.et({
3983
3990
  path: void 0,
3984
3991
  rt: !0
3985
3992
  });
3986
3993
  }
3987
3994
  ut(t) {
3988
- return He(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
3995
+ return Yn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
3989
3996
  }
3990
3997
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
3991
- return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
3998
+ return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
3992
3999
  }
3993
4000
  Z() {
3994
4001
  // TODO(b/34871131): Remove null check once we have proper paths for fields
@@ -3997,52 +4004,52 @@ function Ve(t) {
3997
4004
  }
3998
4005
  st(t) {
3999
4006
  if (0 === t.length) throw this.ut("Document fields must not be empty");
4000
- if (Ve(this.tt) && Ae.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
4007
+ if (Pn(this.tt) && In.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
4001
4008
  }
4002
4009
  }
4003
4010
 
4004
4011
  /**
4005
4012
  * Helper for parsing raw user input (provided via the API) into internal model
4006
4013
  * classes.
4007
- */ class De {
4008
- constructor(t, n, e) {
4009
- this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Xn(t);
4014
+ */ class Nn {
4015
+ constructor(t, e, n) {
4016
+ this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Ke(t);
4010
4017
  }
4011
- /** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
4012
- return new Ne({
4018
+ /** Creates a new top-level parse context. */ ht(t, e, n, r = !1) {
4019
+ return new Vn({
4013
4020
  tt: t,
4014
- methodName: n,
4015
- at: e,
4016
- path: nt.emptyPath(),
4021
+ methodName: e,
4022
+ at: n,
4023
+ path: et.emptyPath(),
4017
4024
  rt: !1,
4018
4025
  ct: r
4019
4026
  }, this.databaseId, this.q, this.ignoreUndefinedProperties);
4020
4027
  }
4021
4028
  }
4022
4029
 
4023
- function $e(t) {
4024
- const n = t._freezeSettings(), e = Xn(t._databaseId);
4025
- return new De(t._databaseId, !!n.ignoreUndefinedProperties, e);
4030
+ function Dn(t) {
4031
+ const e = t._freezeSettings(), n = Ke(t._databaseId);
4032
+ return new Nn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4026
4033
  }
4027
4034
 
4028
- /** Parse document data from a set() call. */ function Se(t, n, e, r, s, i = {}) {
4029
- const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
4030
- Qe("Data must be an object, but it was:", o, r);
4031
- const u = Be(r, o);
4035
+ /** Parse document data from a set() call. */ function $n(t, e, n, r, s, i = {}) {
4036
+ const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
4037
+ zn("Data must be an object, but it was:", o, r);
4038
+ const u = Mn(r, o);
4032
4039
  let c, a;
4033
4040
  if (i.merge) c = new It(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4034
4041
  const t = [];
4035
4042
  for (const r of i.mergeFields) {
4036
- const s = Ge(n, r, e);
4043
+ const s = Gn(e, r, n);
4037
4044
  if (!o.contains(s)) throw new U(R, `Field '${s}' is specified in your field mask but missing from your input data.`);
4038
- Ke(t, s) || t.push(s);
4045
+ Hn(t, s) || t.push(s);
4039
4046
  }
4040
4047
  c = new It(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4041
4048
  } else c = null, a = o.fieldTransforms;
4042
- return new Re(new Qt(u), c, a);
4049
+ return new An(new Gt(u), c, a);
4043
4050
  }
4044
4051
 
4045
- class Fe extends Te {
4052
+ class Sn extends En {
4046
4053
  _toFieldTransform(t) {
4047
4054
  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}`);
4048
4055
  // No transform to add for a delete, but we need to add it to our
@@ -4050,7 +4057,7 @@ class Fe extends Te {
4050
4057
  return t.fieldMask.push(t.path), null;
4051
4058
  }
4052
4059
  isEqual(t) {
4053
- return t instanceof Fe;
4060
+ return t instanceof Sn;
4054
4061
  }
4055
4062
  }
4056
4063
 
@@ -4069,32 +4076,32 @@ class Fe extends Te {
4069
4076
  * context.
4070
4077
  * @param context - The parent context.
4071
4078
  * @param arrayElement - Whether or not the FieldValue has an array.
4072
- */ function xe(t, n, e) {
4073
- return new Ne({
4079
+ */ function Fn(t, e, n) {
4080
+ return new Vn({
4074
4081
  tt: 3 /* Argument */ ,
4075
- at: n.settings.at,
4082
+ at: e.settings.at,
4076
4083
  methodName: t._methodName,
4077
- rt: e
4078
- }, n.databaseId, n.q, n.ignoreUndefinedProperties);
4084
+ rt: n
4085
+ }, e.databaseId, e.q, e.ignoreUndefinedProperties);
4079
4086
  }
4080
4087
 
4081
- class qe extends Te {
4088
+ class xn extends En {
4082
4089
  _toFieldTransform(t) {
4083
- return new Tn(t.path, new gn);
4090
+ return new Ee(t.path, new _e);
4084
4091
  }
4085
4092
  isEqual(t) {
4086
- return t instanceof qe;
4093
+ return t instanceof xn;
4087
4094
  }
4088
4095
  }
4089
4096
 
4090
- class Oe extends Te {
4091
- constructor(t, n) {
4092
- super(t), this.lt = n;
4097
+ class qn extends En {
4098
+ constructor(t, e) {
4099
+ super(t), this.lt = e;
4093
4100
  }
4094
4101
  _toFieldTransform(t) {
4095
- const n = xe(this, t,
4096
- /*array=*/ !0), e = this.lt.map((t => Me(t, n))), r = new vn(e);
4097
- return new Tn(t.path, r);
4102
+ const e = Fn(this, t,
4103
+ /*array=*/ !0), n = this.lt.map((t => jn(t, e))), r = new ge(n);
4104
+ return new Ee(t.path, r);
4098
4105
  }
4099
4106
  isEqual(t) {
4100
4107
  // TODO(mrschmidt): Implement isEquals
@@ -4102,14 +4109,14 @@ class Oe extends Te {
4102
4109
  }
4103
4110
  }
4104
4111
 
4105
- class Ce extends Te {
4106
- constructor(t, n) {
4107
- super(t), this.lt = n;
4112
+ class On extends En {
4113
+ constructor(t, e) {
4114
+ super(t), this.lt = e;
4108
4115
  }
4109
4116
  _toFieldTransform(t) {
4110
- const n = xe(this, t,
4111
- /*array=*/ !0), e = this.lt.map((t => Me(t, n))), r = new bn(e);
4112
- return new Tn(t.path, r);
4117
+ const e = Fn(this, t,
4118
+ /*array=*/ !0), n = this.lt.map((t => jn(t, e))), r = new ve(n);
4119
+ return new Ee(t.path, r);
4113
4120
  }
4114
4121
  isEqual(t) {
4115
4122
  // TODO(mrschmidt): Implement isEquals
@@ -4117,13 +4124,13 @@ class Ce extends Te {
4117
4124
  }
4118
4125
  }
4119
4126
 
4120
- class Le extends Te {
4121
- constructor(t, n) {
4122
- super(t), this.ft = n;
4127
+ class Cn extends En {
4128
+ constructor(t, e) {
4129
+ super(t), this.ft = e;
4123
4130
  }
4124
4131
  _toFieldTransform(t) {
4125
- const n = new En(t.q, yn(t.q, this.ft));
4126
- return new Tn(t.path, n);
4132
+ const e = new be(t.q, pe(t.q, this.ft));
4133
+ return new Ee(t.path, e);
4127
4134
  }
4128
4135
  isEqual(t) {
4129
4136
  // TODO(mrschmidt): Implement isEquals
@@ -4131,50 +4138,50 @@ class Le extends Te {
4131
4138
  }
4132
4139
  }
4133
4140
 
4134
- /** Parse update data from an update() call. */ function ke(t, n, e, r) {
4135
- const s = t.ht(1 /* Update */ , n, e);
4136
- Qe("Data must be an object, but it was:", s, r);
4137
- const i = [], o = Qt.empty();
4141
+ /** Parse update data from an update() call. */ function Ln(t, e, n, r) {
4142
+ const s = t.ht(1 /* Update */ , e, n);
4143
+ zn("Data must be an object, but it was:", s, r);
4144
+ const i = [], o = Gt.empty();
4138
4145
  Tt(r, ((t, r) => {
4139
- const u = Ye(n, t, e);
4146
+ const u = Wn(e, t, n);
4140
4147
  // For Compat types, we have to "extract" the underlying types before
4141
4148
  // performing validation.
4142
4149
  r = l(r);
4143
4150
  const c = s.it(u);
4144
- if (r instanceof Fe)
4151
+ if (r instanceof Sn)
4145
4152
  // Add it to the field mask, but don't add anything to updateData.
4146
4153
  i.push(u); else {
4147
- const t = Me(r, c);
4154
+ const t = jn(r, c);
4148
4155
  null != t && (i.push(u), o.set(u, t));
4149
4156
  }
4150
4157
  }));
4151
4158
  const u = new It(i);
4152
- return new Pe(o, u, s.fieldTransforms);
4159
+ return new Rn(o, u, s.fieldTransforms);
4153
4160
  }
4154
4161
 
4155
- /** Parse update data from a list of field/value arguments. */ function Ue(t, n, e, r, s, i) {
4156
- const o = t.ht(1 /* Update */ , n, e), u = [ Ge(n, r, e) ], c = [ s ];
4157
- if (i.length % 2 != 0) throw new U(R, `Function ${n}() needs to be called with an even number of arguments that alternate between field names and values.`);
4158
- for (let t = 0; t < i.length; t += 2) u.push(Ge(n, i[t])), c.push(i[t + 1]);
4159
- const a = [], h = Qt.empty();
4162
+ /** Parse update data from a list of field/value arguments. */ function kn(t, e, n, r, s, i) {
4163
+ const o = t.ht(1 /* Update */ , e, n), u = [ Gn(e, r, n) ], c = [ s ];
4164
+ if (i.length % 2 != 0) throw new U(R, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4165
+ for (let t = 0; t < i.length; t += 2) u.push(Gn(e, i[t])), c.push(i[t + 1]);
4166
+ const a = [], h = Gt.empty();
4160
4167
  // We iterate in reverse order to pick the last value for a field if the
4161
4168
  // user specified the field multiple times.
4162
- for (let t = u.length - 1; t >= 0; --t) if (!Ke(a, u[t])) {
4163
- const n = u[t];
4164
- let e = c[t];
4169
+ for (let t = u.length - 1; t >= 0; --t) if (!Hn(a, u[t])) {
4170
+ const e = u[t];
4171
+ let n = c[t];
4165
4172
  // For Compat types, we have to "extract" the underlying types before
4166
4173
  // performing validation.
4167
- e = l(e);
4168
- const r = o.it(n);
4169
- if (e instanceof Fe)
4174
+ n = l(n);
4175
+ const r = o.it(e);
4176
+ if (n instanceof Sn)
4170
4177
  // Add it to the field mask, but don't add anything to updateData.
4171
- a.push(n); else {
4172
- const t = Me(e, r);
4173
- null != t && (a.push(n), h.set(n, t));
4178
+ a.push(e); else {
4179
+ const t = jn(n, r);
4180
+ null != t && (a.push(e), h.set(e, t));
4174
4181
  }
4175
4182
  }
4176
4183
  const f = new It(a);
4177
- return new Pe(h, f, o.fieldTransforms);
4184
+ return new Rn(h, f, o.fieldTransforms);
4178
4185
  }
4179
4186
 
4180
4187
  /**
@@ -4183,8 +4190,8 @@ class Le extends Te {
4183
4190
  *
4184
4191
  * @param allowArrays - Whether the query value is an array that may directly
4185
4192
  * contain additional arrays (e.g. the operand of an `in` query).
4186
- */ function je(t, n, e, r = !1) {
4187
- return Me(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
4193
+ */ function Un(t, e, n, r = !1) {
4194
+ return jn(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4188
4195
  }
4189
4196
 
4190
4197
  /**
@@ -4195,12 +4202,12 @@ class Le extends Te {
4195
4202
  * the source of the data being parsed, etc.
4196
4203
  * @returns The parsed value, or null if the value was a FieldValue sentinel
4197
4204
  * that should not be included in the resulting parsed data.
4198
- */ function Me(t, n) {
4199
- if (ze(
4205
+ */ function jn(t, e) {
4206
+ if (Bn(
4200
4207
  // Unwrap the API type from the Compat SDK. This will return the API type
4201
4208
  // from firestore-exp.
4202
- t = l(t))) return Qe("Unsupported field value:", n, t), Be(t, n);
4203
- if (t instanceof Te)
4209
+ t = l(t))) return zn("Unsupported field value:", e, t), Mn(t, e);
4210
+ if (t instanceof En)
4204
4211
  // FieldValues usually parse into transforms (except deleteField())
4205
4212
  // in which case we do not want to include this field in our parsed data
4206
4213
  // (as doing so will overwrite the field directly prior to the transform
@@ -4210,19 +4217,19 @@ class Le extends Te {
4210
4217
  * "Parses" the provided FieldValueImpl, adding any necessary transforms to
4211
4218
  * context.fieldTransforms.
4212
4219
  */
4213
- return function(t, n) {
4220
+ return function(t, e) {
4214
4221
  // Sentinels are only supported with writes, and not within arrays.
4215
- if (!Ve(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
4216
- if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
4217
- const e = t._toFieldTransform(n);
4218
- e && n.fieldTransforms.push(e);
4222
+ if (!Pn(e.tt)) throw e.ut(`${t._methodName}() can only be used with update() and set()`);
4223
+ if (!e.path) throw e.ut(`${t._methodName}() is not currently supported inside arrays`);
4224
+ const n = t._toFieldTransform(e);
4225
+ n && e.fieldTransforms.push(n);
4219
4226
  }
4220
4227
  /**
4221
4228
  * Helper to parse a scalar value (i.e. not an Object, Array, or FieldValue)
4222
4229
  *
4223
4230
  * @returns The parsed value
4224
- */ (t, n), null;
4225
- if (void 0 === t && n.ignoreUndefinedProperties)
4231
+ */ (t, e), null;
4232
+ if (void 0 === t && e.ignoreUndefinedProperties)
4226
4233
  // If the input is undefined it can never participate in the fieldMask, so
4227
4234
  // don't handle this below. If `ignoreUndefinedProperties` is false,
4228
4235
  // `parseScalarValue` will reject an undefined value.
@@ -4230,38 +4237,38 @@ class Le extends Te {
4230
4237
  if (
4231
4238
  // If context.path is null we are inside an array and we don't support
4232
4239
  // field mask paths more granular than the top-level array.
4233
- n.path && n.fieldMask.push(n.path), t instanceof Array) {
4240
+ e.path && e.fieldMask.push(e.path), t instanceof Array) {
4234
4241
  // TODO(b/34871131): Include the path containing the array in the error
4235
4242
  // message.
4236
4243
  // In the case of IN queries, the parsed data is an array (representing
4237
4244
  // the set of values to be included for the IN query) that may directly
4238
4245
  // contain additional arrays (each representing an individual field
4239
4246
  // value), so we disable this validation.
4240
- if (n.settings.rt && 4 /* ArrayArgument */ !== n.tt) throw n.ut("Nested arrays are not supported");
4241
- return function(t, n) {
4242
- const e = [];
4247
+ if (e.settings.rt && 4 /* ArrayArgument */ !== e.tt) throw e.ut("Nested arrays are not supported");
4248
+ return function(t, e) {
4249
+ const n = [];
4243
4250
  let r = 0;
4244
4251
  for (const s of t) {
4245
- let t = Me(s, n.ot(r));
4252
+ let t = jn(s, e.ot(r));
4246
4253
  null == t && (
4247
4254
  // Just include nulls in the array for fields being replaced with a
4248
4255
  // sentinel.
4249
4256
  t = {
4250
4257
  nullValue: "NULL_VALUE"
4251
- }), e.push(t), r++;
4258
+ }), n.push(t), r++;
4252
4259
  }
4253
4260
  return {
4254
4261
  arrayValue: {
4255
- values: e
4262
+ values: n
4256
4263
  }
4257
4264
  };
4258
- }(t, n);
4265
+ }(t, e);
4259
4266
  }
4260
- return function(t, n) {
4267
+ return function(t, e) {
4261
4268
  if (null === (t = l(t))) return {
4262
4269
  nullValue: "NULL_VALUE"
4263
4270
  };
4264
- if ("number" == typeof t) return yn(n.q, t);
4271
+ if ("number" == typeof t) return pe(e.q, t);
4265
4272
  if ("boolean" == typeof t) return {
4266
4273
  booleanValue: t
4267
4274
  };
@@ -4269,37 +4276,37 @@ class Le extends Te {
4269
4276
  stringValue: t
4270
4277
  };
4271
4278
  if (t instanceof Date) {
4272
- const e = vt.fromDate(t);
4279
+ const n = vt.fromDate(t);
4273
4280
  return {
4274
- timestampValue: Fn(n.q, e)
4281
+ timestampValue: Se(e.q, n)
4275
4282
  };
4276
4283
  }
4277
4284
  if (t instanceof vt) {
4278
4285
  // Firestore backend truncates precision down to microseconds. To ensure
4279
4286
  // offline mode works the same with regards to truncation, perform the
4280
4287
  // truncation immediately without waiting for the backend to do that.
4281
- const e = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4288
+ const n = new vt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4282
4289
  return {
4283
- timestampValue: Fn(n.q, e)
4290
+ timestampValue: Se(e.q, n)
4284
4291
  };
4285
4292
  }
4286
- if (t instanceof Ie) return {
4293
+ if (t instanceof Tn) return {
4287
4294
  geoPointValue: {
4288
4295
  latitude: t.latitude,
4289
4296
  longitude: t.longitude
4290
4297
  }
4291
4298
  };
4292
- if (t instanceof Ee) return {
4293
- bytesValue: xn(n.q, t._byteString)
4299
+ if (t instanceof bn) return {
4300
+ bytesValue: Fe(e.q, t._byteString)
4294
4301
  };
4295
- if (t instanceof fe) {
4296
- const e = n.databaseId, r = t.firestore._databaseId;
4297
- if (!r.isEqual(e)) throw n.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${e.projectId}/${e.database}`);
4302
+ if (t instanceof ln) {
4303
+ const n = e.databaseId, r = t.firestore._databaseId;
4304
+ if (!r.isEqual(n)) throw e.ut(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);
4298
4305
  return {
4299
- referenceValue: Cn(t.firestore._databaseId || n.databaseId, t._key.path)
4306
+ referenceValue: Oe(t.firestore._databaseId || e.databaseId, t._key.path)
4300
4307
  };
4301
4308
  }
4302
- throw n.ut(`Unsupported field value: ${ot(t)}`);
4309
+ throw e.ut(`Unsupported field value: ${ot(t)}`);
4303
4310
  }
4304
4311
  /**
4305
4312
  * Checks whether an object looks like a JSON object that should be converted
@@ -4307,56 +4314,56 @@ class Le extends Te {
4307
4314
  * JSON objects since they should be converted to a struct value. Arrays, Dates,
4308
4315
  * GeoPoints, etc. are not considered to look like JSON objects since they map
4309
4316
  * to specific FieldValue types other than ObjectValue.
4310
- */ (t, n);
4317
+ */ (t, e);
4311
4318
  }
4312
4319
 
4313
- function Be(t, n) {
4314
- const e = {};
4320
+ function Mn(t, e) {
4321
+ const n = {};
4315
4322
  return !function(t) {
4316
- for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
4323
+ for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
4317
4324
  return !0;
4318
4325
  }(t) ? Tt(t, ((t, r) => {
4319
- const s = Me(r, n.et(t));
4320
- null != s && (e[t] = s);
4326
+ const s = jn(r, e.nt(t));
4327
+ null != s && (n[t] = s);
4321
4328
  })) :
4322
4329
  // If we encounter an empty object, we explicitly add it to the update
4323
4330
  // mask to ensure that the server creates a map entry.
4324
- n.path && n.path.length > 0 && n.fieldMask.push(n.path), {
4331
+ e.path && e.path.length > 0 && e.fieldMask.push(e.path), {
4325
4332
  mapValue: {
4326
- fields: e
4333
+ fields: n
4327
4334
  }
4328
4335
  };
4329
4336
  }
4330
4337
 
4331
- function ze(t) {
4332
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof Ie || t instanceof Ee || t instanceof fe || t instanceof Te);
4338
+ function Bn(t) {
4339
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof vt || t instanceof Tn || t instanceof bn || t instanceof ln || t instanceof En);
4333
4340
  }
4334
4341
 
4335
- function Qe(t, n, e) {
4336
- if (!ze(e) || !function(t) {
4342
+ function zn(t, e, n) {
4343
+ if (!Bn(n) || !function(t) {
4337
4344
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
4338
- }(e)) {
4339
- const r = ot(e);
4340
- throw "an object" === r ? n.ut(t + " a custom object") : n.ut(t + " " + r);
4345
+ }(n)) {
4346
+ const r = ot(n);
4347
+ throw "an object" === r ? e.ut(t + " a custom object") : e.ut(t + " " + r);
4341
4348
  }
4342
4349
  }
4343
4350
 
4344
4351
  /**
4345
4352
  * Helper that calls fromDotSeparatedString() but wraps any error thrown.
4346
- */ function Ge(t, n, e) {
4353
+ */ function Gn(t, e, n) {
4347
4354
  if ((
4348
4355
  // If required, replace the FieldPath Compat class with with the firestore-exp
4349
4356
  // FieldPath.
4350
- n = l(n)) instanceof ve) return n._internalPath;
4351
- if ("string" == typeof n) return Ye(t, n);
4352
- throw He("Field path arguments must be of type string or ", t,
4357
+ e = l(e)) instanceof gn) return e._internalPath;
4358
+ if ("string" == typeof e) return Wn(t, e);
4359
+ throw Yn("Field path arguments must be of type string or ", t,
4353
4360
  /* hasConverter= */ !1,
4354
- /* path= */ void 0, e);
4361
+ /* path= */ void 0, n);
4355
4362
  }
4356
4363
 
4357
4364
  /**
4358
4365
  * Matches any characters in a field path string that are reserved.
4359
- */ const We = new RegExp("[~\\*/\\[\\]]");
4366
+ */ const Qn = new RegExp("[~\\*/\\[\\]]");
4360
4367
 
4361
4368
  /**
4362
4369
  * Wraps fromDotSeparatedString with an error message about the method that
@@ -4366,30 +4373,30 @@ function Qe(t, n, e) {
4366
4373
  * split on dots.
4367
4374
  * @param targetDoc - The document against which the field path will be
4368
4375
  * evaluated.
4369
- */ function Ye(t, n, e) {
4370
- if (n.search(We) >= 0) throw He(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4376
+ */ function Wn(t, e, n) {
4377
+ if (e.search(Qn) >= 0) throw Yn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4371
4378
  /* hasConverter= */ !1,
4372
- /* path= */ void 0, e);
4379
+ /* path= */ void 0, n);
4373
4380
  try {
4374
- return new ve(...n.split("."))._internalPath;
4381
+ return new gn(...e.split("."))._internalPath;
4375
4382
  } catch (r) {
4376
- throw He(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4383
+ throw Yn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4377
4384
  /* hasConverter= */ !1,
4378
- /* path= */ void 0, e);
4385
+ /* path= */ void 0, n);
4379
4386
  }
4380
4387
  }
4381
4388
 
4382
- function He(t, n, e, r, s) {
4389
+ function Yn(t, e, n, r, s) {
4383
4390
  const i = r && !r.isEmpty(), o = void 0 !== s;
4384
- let u = `Function ${n}() called with invalid data`;
4385
- e && (u += " (via `toFirestore()`)"), u += ". ";
4391
+ let u = `Function ${e}() called with invalid data`;
4392
+ n && (u += " (via `toFirestore()`)"), u += ". ";
4386
4393
  let c = "";
4387
4394
  return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
4388
4395
  c += ")"), new U(R, u + t + c);
4389
4396
  }
4390
4397
 
4391
- /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Ke(t, n) {
4392
- return t.some((t => t.isEqual(n)));
4398
+ /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Hn(t, e) {
4399
+ return t.some((t => t.isEqual(e)));
4393
4400
  }
4394
4401
 
4395
4402
  /**
@@ -4416,14 +4423,14 @@ function He(t, n, e, r, s) {
4416
4423
  * For a `DocumentSnapshot` that points to a non-existing document, any data
4417
4424
  * access will return 'undefined'. You can use the `exists()` method to
4418
4425
  * explicitly verify a document's existence.
4419
- */ class Je {
4426
+ */ class Kn {
4420
4427
  // Note: This class is stripped down version of the DocumentSnapshot in
4421
4428
  // the legacy SDK. The changes are:
4422
4429
  // - No support for SnapshotMetadata.
4423
4430
  // - No support for SnapshotOptions.
4424
4431
  /** @hideconstructor protected */
4425
- constructor(t, n, e, r, s) {
4426
- this._firestore = t, this._userDataWriter = n, this._key = e, this._document = r,
4432
+ constructor(t, e, n, r, s) {
4433
+ this._firestore = t, this._userDataWriter = e, this._key = n, this._document = r,
4427
4434
  this._converter = s;
4428
4435
  }
4429
4436
  /** Property of the `DocumentSnapshot` that provides the document's ID. */ get id() {
@@ -4432,7 +4439,7 @@ function He(t, n, e, r, s) {
4432
4439
  /**
4433
4440
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
4434
4441
  */ get ref() {
4435
- return new fe(this._firestore, this._converter, this._key);
4442
+ return new ln(this._firestore, this._converter, this._key);
4436
4443
  }
4437
4444
  /**
4438
4445
  * Signals whether or not the document at the snapshot's location exists.
@@ -4452,7 +4459,7 @@ function He(t, n, e, r, s) {
4452
4459
  if (this._converter) {
4453
4460
  // We only want to use the converter and create a new DocumentSnapshot
4454
4461
  // if a converter has been provided.
4455
- const t = new Xe(this._firestore, this._userDataWriter, this._key, this._document,
4462
+ const t = new Jn(this._firestore, this._userDataWriter, this._key, this._document,
4456
4463
  /* converter= */ null);
4457
4464
  return this._converter.fromFirestore(t);
4458
4465
  }
@@ -4472,8 +4479,8 @@ function He(t, n, e, r, s) {
4472
4479
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4473
4480
  get(t) {
4474
4481
  if (this._document) {
4475
- const n = this._document.data.field(nr("DocumentSnapshot.get", t));
4476
- if (null !== n) return this._userDataWriter.convertValue(n);
4482
+ const e = this._document.data.field(tr("DocumentSnapshot.get", t));
4483
+ if (null !== e) return this._userDataWriter.convertValue(e);
4477
4484
  }
4478
4485
  }
4479
4486
  }
@@ -4488,7 +4495,7 @@ function He(t, n, e, r, s) {
4488
4495
  * `DocumentSnapshot`. Since query results contain only existing documents, the
4489
4496
  * `exists` property will always be true and `data()` will never return
4490
4497
  * 'undefined'.
4491
- */ class Xe extends Je {
4498
+ */ class Jn extends Kn {
4492
4499
  /**
4493
4500
  * Retrieves all fields in the document as an `Object`.
4494
4501
  *
@@ -4506,10 +4513,10 @@ function He(t, n, e, r, s) {
4506
4513
  * array via the `docs` property or enumerated using the `forEach` method. The
4507
4514
  * number of documents can be determined via the `empty` and `size`
4508
4515
  * properties.
4509
- */ class Ze {
4516
+ */ class Xn {
4510
4517
  /** @hideconstructor */
4511
- constructor(t, n) {
4512
- this._docs = n, this.query = t;
4518
+ constructor(t, e) {
4519
+ this._docs = e, this.query = t;
4513
4520
  }
4514
4521
  /** An array of all the documents in the `QuerySnapshot`. */ get docs() {
4515
4522
  return [ ...this._docs ];
@@ -4526,8 +4533,8 @@ function He(t, n, e, r, s) {
4526
4533
  * @param callback - A callback to be called with a `QueryDocumentSnapshot` for
4527
4534
  * each document in the snapshot.
4528
4535
  * @param thisArg - The `this` binding for the callback.
4529
- */ forEach(t, n) {
4530
- this._docs.forEach(t, n);
4536
+ */ forEach(t, e) {
4537
+ this._docs.forEach(t, e);
4531
4538
  }
4532
4539
  }
4533
4540
 
@@ -4537,14 +4544,14 @@ function He(t, n, e, r, s) {
4537
4544
  * @param left - A snapshot to compare.
4538
4545
  * @param right - A snapshot to compare.
4539
4546
  * @returns true if the snapshots are equal.
4540
- */ function tr(t, n) {
4541
- return t = l(t), n = l(n), t instanceof Je && n instanceof Je ? t._firestore === n._firestore && t._key.isEqual(n._key) && (null === t._document ? null === n._document : t._document.isEqual(n._document)) && t._converter === n._converter : t instanceof Ze && n instanceof Ze && (ge(t.query, n.query) && gt(t.docs, n.docs, tr));
4547
+ */ function Zn(t, e) {
4548
+ return t = l(t), e = l(e), t instanceof Kn && e instanceof Kn ? 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 Xn && e instanceof Xn && (_n(t.query, e.query) && gt(t.docs, e.docs, Zn));
4542
4549
  }
4543
4550
 
4544
4551
  /**
4545
4552
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
4546
- */ function nr(t, n) {
4547
- return "string" == typeof n ? Ye(t, n) : n instanceof ve ? n._internalPath : n._delegate._internalPath;
4553
+ */ function tr(t, e) {
4554
+ return "string" == typeof e ? Wn(t, e) : e instanceof gn ? e._internalPath : e._delegate._internalPath;
4548
4555
  }
4549
4556
 
4550
4557
  /**
@@ -4581,43 +4588,43 @@ class er {}
4581
4588
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4582
4589
  * @throws if any of the provided query constraints cannot be combined with the
4583
4590
  * existing or new constraints.
4584
- */ function rr(t, ...n) {
4585
- for (const e of n) t = e._apply(t);
4591
+ */ function nr(t, ...e) {
4592
+ for (const n of e) t = n._apply(t);
4586
4593
  return t;
4587
4594
  }
4588
4595
 
4589
- class sr extends er {
4590
- constructor(t, n, e) {
4591
- super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
4596
+ class rr extends er {
4597
+ constructor(t, e, n) {
4598
+ super(), this.dt = t, this.wt = e, this.yt = n, this.type = "where";
4592
4599
  }
4593
4600
  _apply(t) {
4594
- const n = $e(t.firestore), e = function(t, n, e, r, s, i, o) {
4601
+ const e = Dn(t.firestore), n = function(t, e, n, r, s, i, o) {
4595
4602
  let u;
4596
4603
  if (s.isKeyField()) {
4597
4604
  if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(R, `Invalid Query. You can't perform '${i}' queries on documentId().`);
4598
4605
  if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
4599
- gr(o, i);
4600
- const n = [];
4601
- for (const e of o) n.push(_r(r, t, e));
4606
+ _r(o, i);
4607
+ const e = [];
4608
+ for (const n of o) e.push(yr(r, t, n));
4602
4609
  u = {
4603
4610
  arrayValue: {
4604
- values: n
4611
+ values: e
4605
4612
  }
4606
4613
  };
4607
- } else u = _r(r, t, o);
4608
- } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || gr(o, i),
4609
- u = je(e, n, o,
4614
+ } else u = yr(r, t, o);
4615
+ } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || _r(o, i),
4616
+ u = Un(n, e, o,
4610
4617
  /* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
4611
4618
  const c = Ht.create(s, i, u);
4612
- return function(t, n) {
4613
- if (n.D()) {
4614
- const e = fn(t);
4615
- if (null !== e && !e.isEqual(n.field)) throw new U(R, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${e.toString()}' and '${n.field.toString()}'`);
4616
- const r = ln(t);
4617
- null !== r && vr(t, n.field, r);
4619
+ return function(t, e) {
4620
+ if (e.D()) {
4621
+ const n = le(t);
4622
+ if (null !== n && !n.isEqual(e.field)) throw new U(R, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
4623
+ const r = he(t);
4624
+ null !== r && gr(t, e.field, r);
4618
4625
  }
4619
- const e = function(t, n) {
4620
- for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
4626
+ const n = function(t, e) {
4627
+ for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
4621
4628
  return null;
4622
4629
  }(t,
4623
4630
  /**
@@ -4652,16 +4659,16 @@ class sr extends er {
4652
4659
  default:
4653
4660
  return [];
4654
4661
  }
4655
- }(n.op));
4656
- if (null !== e)
4662
+ }(e.op));
4663
+ if (null !== n)
4657
4664
  // Special case when it's a duplicate op to give a slightly clearer error message.
4658
- throw e === n.op ? new U(R, `Invalid query. You cannot use more than one '${n.op.toString()}' filter.`) : new U(R, `Invalid query. You cannot use '${n.op.toString()}' filters with '${e.toString()}' filters.`);
4665
+ throw n === e.op ? new U(R, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(R, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
4659
4666
  }(t, c), c;
4660
- }(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
4661
- return new de(t.firestore, t.converter, function(t, n) {
4662
- const e = t.filters.concat([ n ]);
4663
- return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
4664
- }(t._query, e));
4667
+ }(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
4668
+ return new fn(t.firestore, t.converter, function(t, e) {
4669
+ const n = t.filters.concat([ e ]);
4670
+ return new ce(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4671
+ }(t._query, n));
4665
4672
  }
4666
4673
  }
4667
4674
 
@@ -4675,25 +4682,25 @@ class sr extends er {
4675
4682
  * "&lt;=", "!=").
4676
4683
  * @param value - The value for comparison
4677
4684
  * @returns The created {@link Query}.
4678
- */ function ir(t, n, e) {
4679
- const r = n, s = nr("where", t);
4680
- return new sr(s, r, e);
4685
+ */ function sr(t, e, n) {
4686
+ const r = e, s = tr("where", t);
4687
+ return new rr(s, r, n);
4681
4688
  }
4682
4689
 
4683
- class or extends er {
4684
- constructor(t, n) {
4685
- super(), this.dt = t, this._t = n, this.type = "orderBy";
4690
+ class ir extends er {
4691
+ constructor(t, e) {
4692
+ super(), this.dt = t, this._t = e, this.type = "orderBy";
4686
4693
  }
4687
4694
  _apply(t) {
4688
- const n = function(t, n, e) {
4695
+ const e = function(t, e, n) {
4689
4696
  if (null !== t.startAt) throw new U(R, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4690
4697
  if (null !== t.endAt) throw new U(R, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4691
- const r = new on(n, e);
4692
- return function(t, n) {
4693
- if (null === ln(t)) {
4698
+ const r = new ie(e, n);
4699
+ return function(t, e) {
4700
+ if (null === he(t)) {
4694
4701
  // This is the first order by. It must match any inequality.
4695
- const e = fn(t);
4696
- null !== e && vr(t, e, n.field);
4702
+ const n = le(t);
4703
+ null !== n && gr(t, n, e.field);
4697
4704
  }
4698
4705
  }(t, r), r;
4699
4706
  }
@@ -4708,11 +4715,11 @@ class or extends er {
4708
4715
  * of the query or if any of the fields in the order by are an uncommitted
4709
4716
  * server timestamp.
4710
4717
  */ (t._query, this.dt, this._t);
4711
- return new de(t.firestore, t.converter, function(t, n) {
4718
+ return new fn(t.firestore, t.converter, function(t, e) {
4712
4719
  // TODO(dimond): validate that orderBy does not list the same key twice.
4713
- const e = t.explicitOrderBy.concat([ n ]);
4714
- return new an(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4715
- }(t._query, n));
4720
+ const n = t.explicitOrderBy.concat([ e ]);
4721
+ return new ce(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4722
+ }(t._query, e));
4716
4723
  }
4717
4724
  }
4718
4725
 
@@ -4724,18 +4731,18 @@ class or extends er {
4724
4731
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
4725
4732
  * not specified, order will be ascending.
4726
4733
  * @returns The created {@link Query}.
4727
- */ function ur(t, n = "asc") {
4728
- const e = n, r = nr("orderBy", t);
4729
- return new or(r, e);
4734
+ */ function or(t, e = "asc") {
4735
+ const n = e, r = tr("orderBy", t);
4736
+ return new ir(r, n);
4730
4737
  }
4731
4738
 
4732
- class cr extends er {
4733
- constructor(t, n, e) {
4734
- super(), this.type = t, this.gt = n, this.vt = e;
4739
+ class ur extends er {
4740
+ constructor(t, e, n) {
4741
+ super(), this.type = t, this.gt = e, this.vt = n;
4735
4742
  }
4736
4743
  _apply(t) {
4737
- return new de(t.firestore, t.converter, function(t, n, e) {
4738
- return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
4744
+ return new fn(t.firestore, t.converter, function(t, e, n) {
4745
+ return new ce(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4739
4746
  }(t._query, this.gt, this.vt));
4740
4747
  }
4741
4748
  }
@@ -4745,8 +4752,8 @@ class cr extends er {
4745
4752
  *
4746
4753
  * @param limit - The maximum number of items to return.
4747
4754
  * @returns The created {@link Query}.
4748
- */ function ar(t) {
4749
- return ct("limit", t), new cr("limit", t, "F" /* First */);
4755
+ */ function cr(t) {
4756
+ return ct("limit", t), new ur("limit", t, "F" /* First */);
4750
4757
  }
4751
4758
 
4752
4759
  /**
@@ -4757,54 +4764,56 @@ class cr extends er {
4757
4764
  *
4758
4765
  * @param limit - The maximum number of items to return.
4759
4766
  * @returns The created {@link Query}.
4760
- */ function hr(t) {
4761
- return ct("limitToLast", t), new cr("limitToLast", t, "L" /* Last */);
4767
+ */ function ar(t) {
4768
+ return ct("limitToLast", t), new ur("limitToLast", t, "L" /* Last */);
4762
4769
  }
4763
4770
 
4764
- class lr extends er {
4765
- constructor(t, n, e) {
4766
- super(), this.type = t, this.bt = n, this.Et = e;
4771
+ class hr extends er {
4772
+ constructor(t, e, n) {
4773
+ super(), this.type = t, this.bt = e, this.Et = n;
4767
4774
  }
4768
4775
  _apply(t) {
4769
- const n = yr(t, this.type, this.bt, this.Et);
4770
- return new de(t.firestore, t.converter, function(t, n) {
4771
- return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
4772
- }(t._query, n));
4776
+ const e = pr(t, this.type, this.bt, this.Et);
4777
+ return new fn(t.firestore, t.converter, function(t, e) {
4778
+ return new ce(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4779
+ }(t._query, e));
4773
4780
  }
4774
4781
  }
4775
4782
 
4776
- function fr(...t) {
4777
- return new lr("startAt", t, /*before=*/ !0);
4783
+ function lr(...t) {
4784
+ return new hr("startAt", t,
4785
+ /*inclusive=*/ !0);
4778
4786
  }
4779
4787
 
4780
- function dr(...t) {
4781
- return new lr("startAfter", t,
4782
- /*before=*/ !1);
4788
+ function fr(...t) {
4789
+ return new hr("startAfter", t,
4790
+ /*inclusive=*/ !1);
4783
4791
  }
4784
4792
 
4785
- class wr extends er {
4786
- constructor(t, n, e) {
4787
- super(), this.type = t, this.bt = n, this.Et = e;
4793
+ class dr extends er {
4794
+ constructor(t, e, n) {
4795
+ super(), this.type = t, this.bt = e, this.Et = n;
4788
4796
  }
4789
4797
  _apply(t) {
4790
- const n = yr(t, this.type, this.bt, this.Et);
4791
- return new de(t.firestore, t.converter, function(t, n) {
4792
- return new an(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
4793
- }(t._query, n));
4798
+ const e = pr(t, this.type, this.bt, this.Et);
4799
+ return new fn(t.firestore, t.converter, function(t, e) {
4800
+ return new ce(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4801
+ }(t._query, e));
4794
4802
  }
4795
4803
  }
4796
4804
 
4797
- function mr(...t) {
4798
- return new wr("endBefore", t, /*before=*/ !0);
4805
+ function wr(...t) {
4806
+ return new dr("endBefore", t,
4807
+ /*inclusive=*/ !1);
4799
4808
  }
4800
4809
 
4801
- function pr(...t) {
4802
- return new wr("endAt", t, /*before=*/ !1);
4810
+ function mr(...t) {
4811
+ return new dr("endAt", t, /*inclusive=*/ !0);
4803
4812
  }
4804
4813
 
4805
- /** Helper function to create a bound from a document or fields */ function yr(t, n, e, r) {
4806
- if (e[0] = l(e[0]), e[0] instanceof Je) return function(t, n, e, r, s) {
4807
- if (!r) throw new U(V, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
4814
+ /** Helper function to create a bound from a document or fields */ function pr(t, e, n, r) {
4815
+ if (n[0] = l(n[0]), n[0] instanceof Kn) return function(t, e, n, r, s) {
4816
+ if (!r) throw new U(V, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
4808
4817
  const i = [];
4809
4818
  // Because people expect to continue/end a query at the exact document
4810
4819
  // provided, we need to use the implicit sort order rather than the explicit
@@ -4813,23 +4822,23 @@ function pr(...t) {
4813
4822
  // the provided document. Without the key (by using the explicit sort
4814
4823
  // orders), multiple documents could match the position, yielding duplicate
4815
4824
  // results.
4816
- for (const e of wn(t)) if (e.field.isKeyField()) i.push(kt(n, r.key)); else {
4817
- const t = r.data.field(e.field);
4818
- if ($t(t)) throw new U(R, 'Invalid query. You are trying to start or end a query using a document for which the field "' + e.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4825
+ for (const n of de(t)) if (n.field.isKeyField()) i.push(kt(e, r.key)); else {
4826
+ const t = r.data.field(n.field);
4827
+ if ($t(t)) throw new U(R, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4819
4828
  if (null === t) {
4820
- const t = e.field.canonicalString();
4829
+ const t = n.field.canonicalString();
4821
4830
  throw new U(R, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
4822
4831
  }
4823
4832
  i.push(t);
4824
4833
  }
4825
- return new sn(i, s);
4834
+ return new se(i, s);
4826
4835
  }
4827
4836
  /**
4828
4837
  * Converts a list of field values to a `Bound` for the given query.
4829
- */ (t._query, t.firestore._databaseId, n, e[0]._document, r);
4838
+ */ (t._query, t.firestore._databaseId, e, n[0]._document, r);
4830
4839
  {
4831
- const s = $e(t.firestore);
4832
- return function(t, n, e, r, s, i) {
4840
+ const s = Dn(t.firestore);
4841
+ return function(t, e, n, r, s, i) {
4833
4842
  // Use explicit order by's because it has to match the query the user made
4834
4843
  const o = t.explicitOrderBy;
4835
4844
  if (s.length > o.length) throw new U(R, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
@@ -4838,48 +4847,48 @@ function pr(...t) {
4838
4847
  const c = s[i];
4839
4848
  if (o[i].field.isKeyField()) {
4840
4849
  if ("string" != typeof c) throw new U(R, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
4841
- if (!dn(t) && -1 !== c.indexOf("/")) throw new U(R, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
4842
- const e = t.path.child(Z.fromString(c));
4843
- if (!et.isDocumentKey(e)) throw new U(R, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${e}' is not because it contains an odd number of segments.`);
4844
- const s = new et(e);
4845
- u.push(kt(n, s));
4850
+ if (!fe(t) && -1 !== c.indexOf("/")) throw new U(R, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
4851
+ const n = t.path.child(Z.fromString(c));
4852
+ if (!nt.isDocumentKey(n)) throw new U(R, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
4853
+ const s = new nt(n);
4854
+ u.push(kt(e, s));
4846
4855
  } else {
4847
- const t = je(e, r, c);
4856
+ const t = Un(n, r, c);
4848
4857
  u.push(t);
4849
4858
  }
4850
4859
  }
4851
- return new sn(u, i);
4860
+ return new se(u, i);
4852
4861
  }
4853
4862
  /**
4854
4863
  * Parses the given `documentIdValue` into a `ReferenceValue`, throwing
4855
4864
  * appropriate errors if the value is anything other than a `DocumentReference`
4856
4865
  * or `string`, or if the string is malformed.
4857
- */ (t._query, t.firestore._databaseId, s, n, e, r);
4866
+ */ (t._query, t.firestore._databaseId, s, e, n, r);
4858
4867
  }
4859
4868
  }
4860
4869
 
4861
- function _r(t, n, e) {
4862
- if ("string" == typeof (e = l(e))) {
4863
- if ("" === e) throw new U(R, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4864
- if (!dn(n) && -1 !== e.indexOf("/")) throw new U(R, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);
4865
- const r = n.path.child(Z.fromString(e));
4866
- if (!et.isDocumentKey(r)) throw new U(R, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
4867
- return kt(t, new et(r));
4870
+ function yr(t, e, n) {
4871
+ if ("string" == typeof (n = l(n))) {
4872
+ if ("" === n) throw new U(R, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4873
+ if (!fe(e) && -1 !== n.indexOf("/")) throw new U(R, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
4874
+ const r = e.path.child(Z.fromString(n));
4875
+ if (!nt.isDocumentKey(r)) throw new U(R, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
4876
+ return kt(t, new nt(r));
4868
4877
  }
4869
- if (e instanceof fe) return kt(t, e._key);
4870
- throw new U(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(e)}.`);
4878
+ if (n instanceof ln) return kt(t, n._key);
4879
+ throw new U(R, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ot(n)}.`);
4871
4880
  }
4872
4881
 
4873
4882
  /**
4874
4883
  * Validates that the value passed into a disjunctive filter satisfies all
4875
4884
  * array requirements.
4876
- */ function gr(t, n) {
4877
- if (!Array.isArray(t) || 0 === t.length) throw new U(R, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
4878
- if (t.length > 10) throw new U(R, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
4885
+ */ function _r(t, e) {
4886
+ if (!Array.isArray(t) || 0 === t.length) throw new U(R, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
4887
+ if (t.length > 10) throw new U(R, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
4879
4888
  }
4880
4889
 
4881
- function vr(t, n, e) {
4882
- if (!e.isEqual(n)) throw new U(R, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${n.toString()}' and so you must also use '${n.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${e.toString()}' instead.`);
4890
+ function gr(t, e, n) {
4891
+ if (!n.isEqual(e)) throw new U(R, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
4883
4892
  }
4884
4893
 
4885
4894
  /**
@@ -4929,17 +4938,17 @@ function vr(t, n, e) {
4929
4938
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
4930
4939
  * call.
4931
4940
  */
4932
- function br(t, n, e) {
4941
+ function vr(t, e, n) {
4933
4942
  let r;
4934
4943
  // Cast to `any` in order to satisfy the union type constraint on
4935
4944
  // toFirestore().
4936
4945
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4937
- return r = t ? e && (e.merge || e.mergeFields) ? t.toFirestore(n, e) : t.toFirestore(n) : n,
4946
+ return r = t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e,
4938
4947
  r;
4939
4948
  }
4940
4949
 
4941
- class Er extends class {
4942
- convertValue(t, n = "none") {
4950
+ class br extends class {
4951
+ convertValue(t, e = "none") {
4943
4952
  switch (xt(t)) {
4944
4953
  case 0 /* NullValue */ :
4945
4954
  return null;
@@ -4954,7 +4963,7 @@ class Er extends class {
4954
4963
  return this.convertTimestamp(t.timestampValue);
4955
4964
 
4956
4965
  case 4 /* ServerTimestampValue */ :
4957
- return this.convertServerTimestamp(t, n);
4966
+ return this.convertServerTimestamp(t, e);
4958
4967
 
4959
4968
  case 5 /* StringValue */ :
4960
4969
  return t.stringValue;
@@ -4969,32 +4978,32 @@ class Er extends class {
4969
4978
  return this.convertGeoPoint(t.geoPointValue);
4970
4979
 
4971
4980
  case 9 /* ArrayValue */ :
4972
- return this.convertArray(t.arrayValue, n);
4981
+ return this.convertArray(t.arrayValue, e);
4973
4982
 
4974
4983
  case 10 /* ObjectValue */ :
4975
- return this.convertObject(t.mapValue, n);
4984
+ return this.convertObject(t.mapValue, e);
4976
4985
 
4977
4986
  default:
4978
4987
  throw v();
4979
4988
  }
4980
4989
  }
4981
- convertObject(t, n) {
4982
- const e = {};
4990
+ convertObject(t, e) {
4991
+ const n = {};
4983
4992
  return Tt(t.fields, ((t, r) => {
4984
- e[t] = this.convertValue(r, n);
4985
- })), e;
4993
+ n[t] = this.convertValue(r, e);
4994
+ })), n;
4986
4995
  }
4987
4996
  convertGeoPoint(t) {
4988
- return new Ie(Nt(t.latitude), Nt(t.longitude));
4997
+ return new Tn(Nt(t.latitude), Nt(t.longitude));
4989
4998
  }
4990
- convertArray(t, n) {
4991
- return (t.values || []).map((t => this.convertValue(t, n)));
4999
+ convertArray(t, e) {
5000
+ return (t.values || []).map((t => this.convertValue(t, e)));
4992
5001
  }
4993
- convertServerTimestamp(t, n) {
4994
- switch (n) {
5002
+ convertServerTimestamp(t, e) {
5003
+ switch (e) {
4995
5004
  case "previous":
4996
- const e = St(t);
4997
- return null == e ? null : this.convertValue(e, n);
5005
+ const n = St(t);
5006
+ return null == n ? null : this.convertValue(n, e);
4998
5007
 
4999
5008
  case "estimate":
5000
5009
  return this.convertTimestamp(Ft(t));
@@ -5004,16 +5013,16 @@ class Er extends class {
5004
5013
  }
5005
5014
  }
5006
5015
  convertTimestamp(t) {
5007
- const n = Vt(t);
5008
- return new vt(n.seconds, n.nanos);
5016
+ const e = Vt(t);
5017
+ return new vt(e.seconds, e.nanos);
5009
5018
  }
5010
- convertDocumentKey(t, n) {
5011
- const e = Z.fromString(t);
5012
- b(Jn(e));
5013
- const r = new J(e.get(1), e.get(3)), s = new et(e.popFirst(5));
5014
- return r.isEqual(n) ||
5019
+ convertDocumentKey(t, e) {
5020
+ const n = Z.fromString(t);
5021
+ b(He(n));
5022
+ const r = new J(n.get(1), n.get(3)), s = new nt(n.popFirst(5));
5023
+ return r.isEqual(e) ||
5015
5024
  // TODO(b/64130202): Somehow support foreign references.
5016
- y(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),
5025
+ y(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
5017
5026
  s;
5018
5027
  }
5019
5028
  } {
@@ -5021,11 +5030,11 @@ class Er extends class {
5021
5030
  super(), this.firestore = t;
5022
5031
  }
5023
5032
  convertBytes(t) {
5024
- return new Ee(t);
5033
+ return new bn(t);
5025
5034
  }
5026
5035
  convertReference(t) {
5027
- const n = this.convertDocumentKey(t, this.firestore._databaseId);
5028
- return new fe(this.firestore, /* converter= */ null, n);
5036
+ const e = this.convertDocumentKey(t, this.firestore._databaseId);
5037
+ return new ln(this.firestore, /* converter= */ null, e);
5029
5038
  }
5030
5039
  }
5031
5040
 
@@ -5041,12 +5050,12 @@ class Er extends class {
5041
5050
  * @param reference - The reference of the document to fetch.
5042
5051
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
5043
5052
  * document contents.
5044
- */ function Tr(t) {
5045
- const n = ie((t = ut(t, fe)).firestore), e = new Er(t.firestore);
5046
- return ee(n, [ t._key ]).then((n => {
5047
- b(1 === n.length);
5048
- const r = n[0];
5049
- return new Je(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
5053
+ */ function Er(t) {
5054
+ const e = rn((t = ut(t, ln)).firestore), n = new br(t.firestore);
5055
+ return tn(e, [ t._key ]).then((e => {
5056
+ b(1 === e.length);
5057
+ const r = e[0];
5058
+ return new Kn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5050
5059
  }));
5051
5060
  }
5052
5061
 
@@ -5061,33 +5070,33 @@ class Er extends class {
5061
5070
  *
5062
5071
  * @param query - The `Query` to execute.
5063
5072
  * @returns A Promise that will be resolved with the results of the query.
5064
- */ function Ir(t) {
5073
+ */ function Tr(t) {
5065
5074
  !function(t) {
5066
- if (hn(t) && 0 === t.explicitOrderBy.length) throw new U(O, "limitToLast() queries require specifying at least one orderBy() clause");
5067
- }((t = ut(t, de))._query);
5068
- const n = ie(t.firestore), e = new Er(t.firestore);
5069
- return re(n, t._query).then((n => {
5070
- const r = n.map((n => new Xe(t.firestore, e, n.key, n, t.converter)));
5071
- return hn(t._query) &&
5075
+ if (ae(t) && 0 === t.explicitOrderBy.length) throw new U(O, "limitToLast() queries require specifying at least one orderBy() clause");
5076
+ }((t = ut(t, fn))._query);
5077
+ const e = rn(t.firestore), n = new br(t.firestore);
5078
+ return en(e, t._query).then((e => {
5079
+ const r = e.map((e => new Jn(t.firestore, n, e.key, e, t.converter)));
5080
+ return ae(t._query) &&
5072
5081
  // Limit to last queries reverse the orderBy constraint that was
5073
5082
  // specified by the user. As such, we need to reverse the order of the
5074
5083
  // results to return the documents in the expected order.
5075
- r.reverse(), new Ze(t, r);
5084
+ r.reverse(), new Xn(t, r);
5076
5085
  }));
5077
5086
  }
5078
5087
 
5079
- function Ar(t, n, e) {
5080
- const r = br((t = ut(t, fe)).converter, n, e), s = Se($e(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
5081
- return ne(ie(t.firestore), [ s.toMutation(t._key, In.none()) ]);
5088
+ function Ir(t, e, n) {
5089
+ const r = vr((t = ut(t, ln)).converter, e, n), s = $n(Dn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5090
+ return Ze(rn(t.firestore), [ s.toMutation(t._key, Te.none()) ]);
5082
5091
  }
5083
5092
 
5084
- function Rr(t, n, e, ...r) {
5085
- const s = $e((t = ut(t, fe)).firestore);
5093
+ function Ar(t, e, n, ...r) {
5094
+ const s = Dn((t = ut(t, ln)).firestore);
5086
5095
  // For Compat types, we have to "extract" the underlying types before
5087
5096
  // performing validation.
5088
5097
  let i;
5089
- i = "string" == typeof (n = l(n)) || n instanceof ve ? Ue(s, "updateDoc", t._key, n, e, r) : ke(s, "updateDoc", t._key, n);
5090
- return ne(ie(t.firestore), [ i.toMutation(t._key, In.exists(!0)) ]);
5098
+ i = "string" == typeof (e = l(e)) || e instanceof gn ? kn(s, "updateDoc", t._key, e, n, r) : Ln(s, "updateDoc", t._key, e);
5099
+ return Ze(rn(t.firestore), [ i.toMutation(t._key, Te.exists(!0)) ]);
5091
5100
  }
5092
5101
 
5093
5102
  /**
@@ -5101,8 +5110,8 @@ function Rr(t, n, e, ...r) {
5101
5110
  * @param reference - A reference to the document to delete.
5102
5111
  * @returns A `Promise` resolved once the document has been successfully
5103
5112
  * deleted from the backend.
5104
- */ function Pr(t) {
5105
- return ne(ie((t = ut(t, fe)).firestore), [ new Vn(t._key, In.none()) ]);
5113
+ */ function Rr(t) {
5114
+ return Ze(rn((t = ut(t, ln)).firestore), [ new Pe(t._key, Te.none()) ]);
5106
5115
  }
5107
5116
 
5108
5117
  /**
@@ -5119,9 +5128,9 @@ function Rr(t, n, e, ...r) {
5119
5128
  * @throws Error - If the provided input is not a valid Firestore document.
5120
5129
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
5121
5130
  * newly created document after it has been written to the backend.
5122
- */ function Vr(t, n) {
5123
- const e = ye(t = ut(t, we)), r = br(t.converter, n), s = Se($e(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
5124
- return ne(ie(t.firestore), [ s.toMutation(e._key, In.exists(!1)) ]).then((() => e));
5131
+ */ function Pr(t, e) {
5132
+ const n = pn(t = ut(t, dn)), r = vr(t.converter, e), s = $n(Dn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5133
+ return Ze(rn(t.firestore), [ s.toMutation(n._key, Te.exists(!1)) ]).then((() => n));
5125
5134
  }
5126
5135
 
5127
5136
  /**
@@ -5143,15 +5152,15 @@ function Rr(t, n, e, ...r) {
5143
5152
  /**
5144
5153
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
5145
5154
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
5146
- */ function Nr() {
5147
- return new Fe("deleteField");
5155
+ */ function Vr() {
5156
+ return new Sn("deleteField");
5148
5157
  }
5149
5158
 
5150
5159
  /**
5151
5160
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
5152
5161
  * include a server-generated timestamp in the written data.
5153
- */ function Dr() {
5154
- return new qe("serverTimestamp");
5162
+ */ function Nr() {
5163
+ return new xn("serverTimestamp");
5155
5164
  }
5156
5165
 
5157
5166
  /**
@@ -5165,10 +5174,10 @@ function Rr(t, n, e, ...r) {
5165
5174
  * @param elements - The elements to union into the array.
5166
5175
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5167
5176
  * `updateDoc()`.
5168
- */ function $r(...t) {
5177
+ */ function Dr(...t) {
5169
5178
  // NOTE: We don't actually parse the data until it's used in set() or
5170
5179
  // update() since we'd need the Firestore instance to do this.
5171
- return new Oe("arrayUnion", t);
5180
+ return new qn("arrayUnion", t);
5172
5181
  }
5173
5182
 
5174
5183
  /**
@@ -5181,10 +5190,10 @@ function Rr(t, n, e, ...r) {
5181
5190
  * @param elements - The elements to remove from the array.
5182
5191
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5183
5192
  * `updateDoc()`
5184
- */ function Sr(...t) {
5193
+ */ function $r(...t) {
5185
5194
  // NOTE: We don't actually parse the data until it's used in set() or
5186
5195
  // update() since we'd need the Firestore instance to do this.
5187
- return new Ce("arrayRemove", t);
5196
+ return new On("arrayRemove", t);
5188
5197
  }
5189
5198
 
5190
5199
  /**
@@ -5205,8 +5214,8 @@ function Rr(t, n, e, ...r) {
5205
5214
  * @param n - The value to increment by.
5206
5215
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5207
5216
  * `updateDoc()`
5208
- */ function Fr(t) {
5209
- return new Le("increment", t);
5217
+ */ function Sr(t) {
5218
+ return new Cn("increment", t);
5210
5219
  }
5211
5220
 
5212
5221
  /**
@@ -5232,25 +5241,25 @@ function Rr(t, n, e, ...r) {
5232
5241
  * provides methods for adding writes to the write batch. None of the writes
5233
5242
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
5234
5243
  * called.
5235
- */ class xr {
5244
+ */ class Fr {
5236
5245
  /** @hideconstructor */
5237
- constructor(t, n) {
5238
- this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
5239
- this._dataReader = $e(t);
5246
+ constructor(t, e) {
5247
+ this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
5248
+ this._dataReader = Dn(t);
5240
5249
  }
5241
- set(t, n, e) {
5250
+ set(t, e, n) {
5242
5251
  this._verifyNotCommitted();
5243
- const r = qr(t, this._firestore), s = br(r.converter, n, e), i = Se(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, e);
5244
- return this._mutations.push(i.toMutation(r._key, In.none())), this;
5252
+ const r = xr(t, this._firestore), s = vr(r.converter, e, n), i = $n(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5253
+ return this._mutations.push(i.toMutation(r._key, Te.none())), this;
5245
5254
  }
5246
- update(t, n, e, ...r) {
5255
+ update(t, e, n, ...r) {
5247
5256
  this._verifyNotCommitted();
5248
- const s = qr(t, this._firestore);
5257
+ const s = xr(t, this._firestore);
5249
5258
  // For Compat types, we have to "extract" the underlying types before
5250
5259
  // performing validation.
5251
5260
  let i;
5252
- return i = "string" == typeof (n = l(n)) || n instanceof ve ? Ue(this._dataReader, "WriteBatch.update", s._key, n, e, r) : ke(this._dataReader, "WriteBatch.update", s._key, n),
5253
- this._mutations.push(i.toMutation(s._key, In.exists(!0))), this;
5261
+ return i = "string" == typeof (e = l(e)) || e instanceof gn ? kn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : Ln(this._dataReader, "WriteBatch.update", s._key, e),
5262
+ this._mutations.push(i.toMutation(s._key, Te.exists(!0))), this;
5254
5263
  }
5255
5264
  /**
5256
5265
  * Deletes the document referred to by the provided {@link DocumentReference}.
@@ -5259,8 +5268,8 @@ function Rr(t, n, e, ...r) {
5259
5268
  * @returns This `WriteBatch` instance. Used for chaining method calls.
5260
5269
  */ delete(t) {
5261
5270
  this._verifyNotCommitted();
5262
- const n = qr(t, this._firestore);
5263
- return this._mutations = this._mutations.concat(new Vn(n._key, In.none())), this;
5271
+ const e = xr(t, this._firestore);
5272
+ return this._mutations = this._mutations.concat(new Pe(e._key, Te.none())), this;
5264
5273
  }
5265
5274
  /**
5266
5275
  * Commits all of the writes in this write batch as a single atomic unit.
@@ -5281,8 +5290,8 @@ function Rr(t, n, e, ...r) {
5281
5290
  }
5282
5291
  }
5283
5292
 
5284
- function qr(t, n) {
5285
- if ((t = l(t)).firestore !== n) throw new U(R, "Provided document reference is from a different Firestore instance.");
5293
+ function xr(t, e) {
5294
+ if ((t = l(t)).firestore !== e) throw new U(R, "Provided document reference is from a different Firestore instance.");
5286
5295
  return t;
5287
5296
  }
5288
5297
 
@@ -5298,9 +5307,9 @@ function qr(t, n) {
5298
5307
  *
5299
5308
  * @returns A `WriteBatch` that can be used to atomically execute multiple
5300
5309
  * writes.
5301
- */ function Or(t) {
5302
- const n = ie(t = ut(t, ue));
5303
- return new xr(t, (t => ne(n, t)));
5310
+ */ function qr(t) {
5311
+ const e = rn(t = ut(t, on));
5312
+ return new Fr(t, (t => Ze(e, t)));
5304
5313
  }
5305
5314
 
5306
5315
  /**
@@ -5322,7 +5331,7 @@ function qr(t, n) {
5322
5331
  /**
5323
5332
  * Internal transaction object responsible for accumulating the mutations to
5324
5333
  * perform and the base versions for any documents read.
5325
- */ class Cr {
5334
+ */ class Or {
5326
5335
  constructor(t) {
5327
5336
  this.datastore = t,
5328
5337
  // The version of each document that was read during this transaction.
@@ -5342,66 +5351,66 @@ function qr(t, n) {
5342
5351
  }
5343
5352
  async lookup(t) {
5344
5353
  if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(R, "Firestore transactions require all reads to be executed before all writes.");
5345
- const n = await ee(this.datastore, t);
5346
- return n.forEach((t => this.recordVersion(t))), n;
5354
+ const e = await tn(this.datastore, t);
5355
+ return e.forEach((t => this.recordVersion(t))), e;
5347
5356
  }
5348
- set(t, n) {
5349
- this.write(n.toMutation(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5357
+ set(t, e) {
5358
+ this.write(e.toMutation(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5350
5359
  }
5351
- update(t, n) {
5360
+ update(t, e) {
5352
5361
  try {
5353
- this.write(n.toMutation(t, this.preconditionForUpdate(t)));
5362
+ this.write(e.toMutation(t, this.preconditionForUpdate(t)));
5354
5363
  } catch (t) {
5355
5364
  this.lastWriteError = t;
5356
5365
  }
5357
5366
  this.writtenDocs.add(t.toString());
5358
5367
  }
5359
5368
  delete(t) {
5360
- this.write(new Vn(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5369
+ this.write(new Pe(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5361
5370
  }
5362
5371
  async commit() {
5363
5372
  if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
5364
5373
  const t = this.readVersions;
5365
5374
  // For each mutation, note that the doc was written.
5366
- this.mutations.forEach((n => {
5367
- t.delete(n.key.toString());
5375
+ this.mutations.forEach((e => {
5376
+ t.delete(e.key.toString());
5368
5377
  })),
5369
5378
  // For each document that was read but not written to, we want to perform
5370
5379
  // a `verify` operation.
5371
- t.forEach(((t, n) => {
5372
- const e = et.fromPath(n);
5373
- this.mutations.push(new Nn(e, this.precondition(e)));
5374
- })), await ne(this.datastore, this.mutations), this.committed = !0;
5380
+ t.forEach(((t, e) => {
5381
+ const n = nt.fromPath(e);
5382
+ this.mutations.push(new Ve(n, this.precondition(n)));
5383
+ })), await Ze(this.datastore, this.mutations), this.committed = !0;
5375
5384
  }
5376
5385
  recordVersion(t) {
5377
- let n;
5378
- if (t.isFoundDocument()) n = t.version; else {
5386
+ let e;
5387
+ if (t.isFoundDocument()) e = t.version; else {
5379
5388
  if (!t.isNoDocument()) throw v();
5380
5389
  // For deleted docs, we must use baseVersion 0 when we overwrite them.
5381
- n = bt.min();
5390
+ e = bt.min();
5382
5391
  }
5383
- const e = this.readVersions.get(t.key.toString());
5384
- if (e) {
5385
- if (!n.isEqual(e))
5392
+ const n = this.readVersions.get(t.key.toString());
5393
+ if (n) {
5394
+ if (!e.isEqual(n))
5386
5395
  // This transaction will fail no matter what.
5387
5396
  throw new U(x, "Document version changed between two reads.");
5388
- } else this.readVersions.set(t.key.toString(), n);
5397
+ } else this.readVersions.set(t.key.toString(), e);
5389
5398
  }
5390
5399
  /**
5391
5400
  * Returns the version of this document when it was read in this transaction,
5392
5401
  * as a precondition, or no precondition if it was not read.
5393
5402
  */ precondition(t) {
5394
- const n = this.readVersions.get(t.toString());
5395
- return !this.writtenDocs.has(t.toString()) && n ? In.updateTime(n) : In.none();
5403
+ const e = this.readVersions.get(t.toString());
5404
+ return !this.writtenDocs.has(t.toString()) && e ? Te.updateTime(e) : Te.none();
5396
5405
  }
5397
5406
  /**
5398
5407
  * Returns the precondition for a document if the operation is an update.
5399
5408
  */ preconditionForUpdate(t) {
5400
- const n = this.readVersions.get(t.toString());
5409
+ const e = this.readVersions.get(t.toString());
5401
5410
  // The first time a document is written, we want to take into account the
5402
5411
  // read time and existence
5403
- if (!this.writtenDocs.has(t.toString()) && n) {
5404
- if (n.isEqual(bt.min()))
5412
+ if (!this.writtenDocs.has(t.toString()) && e) {
5413
+ if (e.isEqual(bt.min()))
5405
5414
  // The document doesn't exist, so fail the transaction.
5406
5415
  // This has to be validated locally because you can't send a
5407
5416
  // precondition that a document does not exist without changing the
@@ -5413,11 +5422,11 @@ function qr(t, n) {
5413
5422
  // transaction.
5414
5423
  throw new U(R, "Can't update a document that doesn't exist.");
5415
5424
  // Document exists, base precondition on document update time.
5416
- return In.updateTime(n);
5425
+ return Te.updateTime(e);
5417
5426
  }
5418
5427
  // Document was not read, so we just use the preconditions for a blind
5419
5428
  // update.
5420
- return In.exists(!0);
5429
+ return Te.exists(!0);
5421
5430
  }
5422
5431
  write(t) {
5423
5432
  this.ensureCommitNotCalled(), this.mutations.push(t);
@@ -5445,20 +5454,20 @@ function qr(t, n) {
5445
5454
  * TransactionRunner encapsulates the logic needed to run and retry transactions
5446
5455
  * with backoff.
5447
5456
  */
5448
- class Lr {
5449
- constructor(t, n, e, r) {
5450
- this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
5451
- this.Tt = 5, this.It = new Zn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5457
+ class Cr {
5458
+ constructor(t, e, n, r) {
5459
+ this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
5460
+ this.Tt = 5, this.It = new Je(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5452
5461
  }
5453
5462
  /** Runs the transaction and sets the result on deferred. */ run() {
5454
5463
  this.Tt -= 1, this.At();
5455
5464
  }
5456
5465
  At() {
5457
5466
  this.It.W((async () => {
5458
- const t = new Cr(this.datastore), n = this.Rt(t);
5459
- n && n.then((n => {
5467
+ const t = new Or(this.datastore), e = this.Rt(t);
5468
+ e && e.then((e => {
5460
5469
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
5461
- this.deferred.resolve(n);
5470
+ this.deferred.resolve(e);
5462
5471
  })).catch((t => {
5463
5472
  this.Pt(t);
5464
5473
  }))));
@@ -5469,8 +5478,8 @@ class Lr {
5469
5478
  }
5470
5479
  Rt(t) {
5471
5480
  try {
5472
- const n = this.updateFunction(t);
5473
- return !at(n) && n.catch && n.then ? n : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5481
+ const e = this.updateFunction(t);
5482
+ return !at(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5474
5483
  null);
5475
5484
  } catch (t) {
5476
5485
  // Do not retry errors thrown by user provided updateFunction.
@@ -5485,8 +5494,8 @@ class Lr {
5485
5494
  if ("FirebaseError" === t.name) {
5486
5495
  // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
5487
5496
  // non-matching document versions with ABORTED. These errors should be retried.
5488
- const n = t.code;
5489
- return "aborted" === n || "failed-precondition" === n || !
5497
+ const e = t.code;
5498
+ return "aborted" === e || "failed-precondition" === e || !
5490
5499
  /**
5491
5500
  * Determines whether an error code represents a permanent error when received
5492
5501
  * in response to a non-write operation.
@@ -5523,7 +5532,7 @@ class Lr {
5523
5532
  case k:
5524
5533
  return !0;
5525
5534
  }
5526
- }(n);
5535
+ }(e);
5527
5536
  }
5528
5537
  return !1;
5529
5538
  }
@@ -5545,7 +5554,7 @@ class Lr {
5545
5554
  * See the License for the specific language governing permissions and
5546
5555
  * limitations under the License.
5547
5556
  */
5548
- /** The Platform's 'document' implementation or null if not available. */ function kr() {
5557
+ /** The Platform's 'document' implementation or null if not available. */ function Lr() {
5549
5558
  // `document` is not always available, e.g. in ReactNative and WebWorkers.
5550
5559
  // eslint-disable-next-line no-restricted-globals
5551
5560
  return "undefined" != typeof document ? document : null;
@@ -5577,9 +5586,9 @@ class Lr {
5577
5586
  * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
5578
5587
  * in newer versions of TypeScript defines `finally`, which is not available in
5579
5588
  * IE.
5580
- */ class Ur {
5581
- constructor(t, n, e, r, s) {
5582
- this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
5589
+ */ class kr {
5590
+ constructor(t, e, n, r, s) {
5591
+ this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
5583
5592
  this.deferred = new j, this.then = this.deferred.promise.then.bind(this.deferred.promise),
5584
5593
  // It's normal for the deferred promise to be canceled (due to cancellation)
5585
5594
  // and so we attach a dummy catch callback to avoid
@@ -5599,9 +5608,9 @@ class Lr {
5599
5608
  * from its delayedOperations list.
5600
5609
  * PORTING NOTE: This exists to prevent making removeDelayedOperation() and
5601
5610
  * the DelayedOperation class public.
5602
- */ static createAndSchedule(t, n, e, r, s) {
5603
- const i = Date.now() + e, o = new Ur(t, n, i, r, s);
5604
- return o.start(e), o;
5611
+ */ static createAndSchedule(t, e, n, r, s) {
5612
+ const i = Date.now() + n, o = new kr(t, e, i, r, s);
5613
+ return o.start(n), o;
5605
5614
  }
5606
5615
  /**
5607
5616
  * Starts the timer. This is called immediately after construction by
@@ -5649,7 +5658,7 @@ class Lr {
5649
5658
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5650
5659
  * See the License for the specific language governing permissions and
5651
5660
  * limitations under the License.
5652
- */ class jr {
5661
+ */ class Ur {
5653
5662
  constructor() {
5654
5663
  // The last promise in the queue.
5655
5664
  this.Nt = Promise.resolve(),
@@ -5672,15 +5681,15 @@ class Lr {
5672
5681
  // List of TimerIds to fast-forward delays for.
5673
5682
  this.Ot = [],
5674
5683
  // Backoff timer used to schedule retries for retryable operations
5675
- this.It = new Zn(this, "async_queue_retry" /* AsyncQueueRetry */),
5684
+ this.It = new Je(this, "async_queue_retry" /* AsyncQueueRetry */),
5676
5685
  // Visibility handler that triggers an immediate retry of all retryable
5677
5686
  // operations. Meant to speed up recovery when we regain file system access
5678
5687
  // after page comes into foreground.
5679
5688
  this.Ct = () => {
5680
- const t = kr();
5689
+ const t = Lr();
5681
5690
  t && p("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
5682
5691
  };
5683
- const t = kr();
5692
+ const t = Lr();
5684
5693
  t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
5685
5694
  }
5686
5695
  get isShuttingDown() {
@@ -5701,8 +5710,8 @@ class Lr {
5701
5710
  enterRestrictedMode(t) {
5702
5711
  if (!this.$t) {
5703
5712
  this.$t = !0, this.qt = t || !1;
5704
- const n = kr();
5705
- n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
5713
+ const e = Lr();
5714
+ e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
5706
5715
  }
5707
5716
  }
5708
5717
  enqueue(t) {
@@ -5712,9 +5721,9 @@ class Lr {
5712
5721
  // Create a deferred Promise that we can return to the callee. This
5713
5722
  // allows us to return a "hanging Promise" only to the callee and still
5714
5723
  // advance the queue even when the operation is not run.
5715
- const n = new j;
5716
- return this.kt((() => this.$t && this.qt ? Promise.resolve() : (t().then(n.resolve, n.reject),
5717
- n.promise))).then((() => n.promise));
5724
+ const e = new j;
5725
+ return this.kt((() => this.$t && this.qt ? Promise.resolve() : (t().then(e.resolve, e.reject),
5726
+ e.promise))).then((() => e.promise));
5718
5727
  }
5719
5728
  enqueueRetryable(t) {
5720
5729
  this.enqueueAndForget((() => (this.Dt.push(t), this.Ut())));
@@ -5784,18 +5793,18 @@ class Lr {
5784
5793
  }
5785
5794
  }
5786
5795
  kt(t) {
5787
- const n = this.Nt.then((() => (this.xt = !0, t().catch((t => {
5796
+ const e = this.Nt.then((() => (this.xt = !0, t().catch((t => {
5788
5797
  this.Ft = t, this.xt = !1;
5789
- const n =
5798
+ const e =
5790
5799
  /**
5791
5800
  * Chrome includes Error.message in Error.stack. Other browsers do not.
5792
5801
  * This returns expected output of message + stack when available.
5793
5802
  * @param error - Error or FirestoreError
5794
5803
  */
5795
5804
  function(t) {
5796
- let n = t.message || "";
5797
- t.stack && (n = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack);
5798
- return n;
5805
+ let e = t.message || "";
5806
+ t.stack && (e = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack);
5807
+ return e;
5799
5808
  }
5800
5809
  /**
5801
5810
  * @license
@@ -5825,15 +5834,15 @@ class Lr {
5825
5834
  // Re-throw the error so that this.tail becomes a rejected Promise and
5826
5835
  // all further attempts to chain (via .then) will just short-circuit
5827
5836
  // and return the rejected Promise.
5828
- throw y("INTERNAL UNHANDLED ERROR: ", n), t;
5837
+ throw y("INTERNAL UNHANDLED ERROR: ", e), t;
5829
5838
  })).then((t => (this.xt = !1, t))))));
5830
- return this.Nt = n, n;
5839
+ return this.Nt = e, e;
5831
5840
  }
5832
- enqueueAfterDelay(t, n, e) {
5841
+ enqueueAfterDelay(t, e, n) {
5833
5842
  this.Lt(),
5834
5843
  // Fast-forward delays for timerIds that have been overriden.
5835
- this.Ot.indexOf(t) > -1 && (n = 0);
5836
- const r = Ur.createAndSchedule(this, t, n, e, (t => this.jt(t)));
5844
+ this.Ot.indexOf(t) > -1 && (e = 0);
5845
+ const r = kr.createAndSchedule(this, t, e, n, (t => this.jt(t)));
5837
5846
  return this.St.push(r), r;
5838
5847
  }
5839
5848
  Lt() {
@@ -5857,7 +5866,7 @@ class Lr {
5857
5866
  * For Tests: Determine if a delayed operation with a particular TimerId
5858
5867
  * exists.
5859
5868
  */ Bt(t) {
5860
- for (const n of this.St) if (n.timerId === t) return !0;
5869
+ for (const e of this.St) if (e.timerId === t) return !0;
5861
5870
  return !1;
5862
5871
  }
5863
5872
  /**
@@ -5870,27 +5879,27 @@ class Lr {
5870
5879
  // Note that draining may generate more delayed ops, so we do that first.
5871
5880
  return this.Mt().then((() => {
5872
5881
  // Run ops in the same order they'd run if they ran naturally.
5873
- this.St.sort(((t, n) => t.targetTimeMs - n.targetTimeMs));
5874
- for (const n of this.St) if (n.skipDelay(), "all" /* All */ !== t && n.timerId === t) break;
5882
+ this.St.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
5883
+ for (const e of this.St) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
5875
5884
  return this.Mt();
5876
5885
  }));
5877
5886
  }
5878
5887
  /**
5879
5888
  * For Tests: Skip all subsequent delays for a timer id.
5880
- */ Qt(t) {
5889
+ */ Gt(t) {
5881
5890
  this.Ot.push(t);
5882
5891
  }
5883
5892
  /** Called once a DelayedOperation is run or canceled. */ jt(t) {
5884
5893
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
5885
- const n = this.St.indexOf(t);
5886
- this.St.splice(n, 1);
5894
+ const e = this.St.indexOf(t);
5895
+ this.St.splice(e, 1);
5887
5896
  }
5888
5897
  }
5889
5898
 
5890
- class Mr {
5899
+ class jr {
5891
5900
  /** @hideconstructor */
5892
- constructor(t, n) {
5893
- this._firestore = t, this._transaction = n, this._dataReader = $e(t);
5901
+ constructor(t, e) {
5902
+ this._firestore = t, this._transaction = e, this._dataReader = Dn(t);
5894
5903
  }
5895
5904
  /**
5896
5905
  * Reads the document referenced by the provided {@link DocumentReference}.
@@ -5898,25 +5907,25 @@ class Mr {
5898
5907
  * @param documentRef - A reference to the document to be read.
5899
5908
  * @returns A `DocumentSnapshot` with the read data.
5900
5909
  */ get(t) {
5901
- const n = qr(t, this._firestore), e = new Er(this._firestore);
5902
- return this._transaction.lookup([ n._key ]).then((t => {
5910
+ const e = xr(t, this._firestore), n = new br(this._firestore);
5911
+ return this._transaction.lookup([ e._key ]).then((t => {
5903
5912
  if (!t || 1 !== t.length) return v();
5904
5913
  const r = t[0];
5905
- if (r.isFoundDocument()) return new Je(this._firestore, e, r.key, r, n.converter);
5906
- if (r.isNoDocument()) return new Je(this._firestore, e, n._key, null, n.converter);
5914
+ if (r.isFoundDocument()) return new Kn(this._firestore, n, r.key, r, e.converter);
5915
+ if (r.isNoDocument()) return new Kn(this._firestore, n, e._key, null, e.converter);
5907
5916
  throw v();
5908
5917
  }));
5909
5918
  }
5910
- set(t, n, e) {
5911
- const r = qr(t, this._firestore), s = br(r.converter, n, e), i = Se(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, e);
5919
+ set(t, e, n) {
5920
+ const r = xr(t, this._firestore), s = vr(r.converter, e, n), i = $n(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
5912
5921
  return this._transaction.set(r._key, i), this;
5913
5922
  }
5914
- update(t, n, e, ...r) {
5915
- const s = qr(t, this._firestore);
5923
+ update(t, e, n, ...r) {
5924
+ const s = xr(t, this._firestore);
5916
5925
  // For Compat types, we have to "extract" the underlying types before
5917
5926
  // performing validation.
5918
5927
  let i;
5919
- return i = "string" == typeof (n = l(n)) || n instanceof ve ? Ue(this._dataReader, "Transaction.update", s._key, n, e, r) : ke(this._dataReader, "Transaction.update", s._key, n),
5928
+ return i = "string" == typeof (e = l(e)) || e instanceof gn ? kn(this._dataReader, "Transaction.update", s._key, e, n, r) : Ln(this._dataReader, "Transaction.update", s._key, e),
5920
5929
  this._transaction.update(s._key, i), this;
5921
5930
  }
5922
5931
  /**
@@ -5925,8 +5934,8 @@ class Mr {
5925
5934
  * @param documentRef - A reference to the document to be deleted.
5926
5935
  * @returns This `Transaction` instance. Used for chaining method calls.
5927
5936
  */ delete(t) {
5928
- const n = qr(t, this._firestore);
5929
- return this._transaction.delete(n._key), this;
5937
+ const e = xr(t, this._firestore);
5938
+ return this._transaction.delete(e._key), this;
5930
5939
  }
5931
5940
  }
5932
5941
 
@@ -5946,9 +5955,9 @@ class Mr {
5946
5955
  * (the `updateFunction` returned a failed promise), the promise returned by the
5947
5956
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
5948
5957
  * rejected promise with the corresponding failure error is returned.
5949
- */ function Br(t, n) {
5950
- const e = ie(t = ut(t, ue)), r = new j;
5951
- return new Lr(new jr, e, (e => n(new Mr(t, e))), r).run(), r.promise;
5958
+ */ function Mr(t, e) {
5959
+ const n = rn(t = ut(t, on)), r = new j;
5960
+ return new Cr(new Ur, n, (n => e(new jr(t, n))), r).run(), r.promise;
5952
5961
  }
5953
5962
 
5954
5963
  /**
@@ -5960,12 +5969,12 @@ class Mr {
5960
5969
  * @packageDocumentation
5961
5970
  */ !function(t) {
5962
5971
  d = t;
5963
- }(`${s}_lite`), e(new i("firestore/lite", ((t, {options: n}) => {
5964
- const e = t.getProvider("app").getImmediate(), r = new ue(e, new Q(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")));
5965
- return n && r._setSettings(n), r;
5972
+ }(`${s}_lite`), n(new i("firestore/lite", ((t, {options: e}) => {
5973
+ const n = t.getProvider("app").getImmediate(), r = new on(n, new G(t.getProvider("auth-internal")), new H(t.getProvider("app-check-internal")));
5974
+ return e && r._setSettings(e), r;
5966
5975
  }), "PUBLIC")),
5967
5976
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
5968
- r("firestore-lite", "3.4.4-canary.2dd99ae2d", "rn"), r("firestore-lite", "3.4.4-canary.2dd99ae2d", "esm2017");
5977
+ r("firestore-lite", "3.4.4-canary.3e9f3e253", "rn"), r("firestore-lite", "3.4.4-canary.3e9f3e253", "esm2017");
5969
5978
 
5970
- export { Ee as Bytes, we as CollectionReference, fe as DocumentReference, Je as DocumentSnapshot, ve as FieldPath, Te as FieldValue, ue as Firestore, U as FirestoreError, Ie as GeoPoint, de as Query, er as QueryConstraint, Xe as QueryDocumentSnapshot, Ze as QuerySnapshot, vt as Timestamp, Mr as Transaction, xr as WriteBatch, Vr as addDoc, Sr as arrayRemove, $r as arrayUnion, me as collection, pe as collectionGroup, he as connectFirestoreEmulator, Pr as deleteDoc, Nr as deleteField, ye as doc, be as documentId, pr as endAt, mr as endBefore, Tr as getDoc, Ir as getDocs, ae as getFirestore, Fr as increment, ce as initializeFirestore, ar as limit, hr as limitToLast, ur as orderBy, rr as query, ge as queryEqual, _e as refEqual, Br as runTransaction, Dr as serverTimestamp, Ar as setDoc, m as setLogLevel, tr as snapshotEqual, dr as startAfter, fr as startAt, le as terminate, Rr as updateDoc, ir as where, Or as writeBatch };
5979
+ export { bn as Bytes, dn as CollectionReference, ln as DocumentReference, Kn as DocumentSnapshot, gn as FieldPath, En as FieldValue, on as Firestore, U as FirestoreError, Tn as GeoPoint, fn as Query, er as QueryConstraint, Jn as QueryDocumentSnapshot, Xn as QuerySnapshot, vt as Timestamp, jr as Transaction, Fr as WriteBatch, Pr as addDoc, $r as arrayRemove, Dr as arrayUnion, wn as collection, mn as collectionGroup, an as connectFirestoreEmulator, Rr as deleteDoc, Vr as deleteField, pn as doc, vn as documentId, mr as endAt, wr as endBefore, Er as getDoc, Tr as getDocs, cn as getFirestore, Sr as increment, un as initializeFirestore, cr as limit, ar as limitToLast, or as orderBy, nr as query, _n as queryEqual, yn as refEqual, Mr as runTransaction, Nr as serverTimestamp, Ir as setDoc, m as setLogLevel, Zn as snapshotEqual, fr as startAfter, lr as startAt, hn as terminate, Ar as updateDoc, sr as where, qr as writeBatch };
5971
5980
  //# sourceMappingURL=index.rn.esm2017.js.map