@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
@@ -63,7 +63,7 @@ l.MOCK_USER = new l("mock-user");
63
63
  * See the License for the specific language governing permissions and
64
64
  * limitations under the License.
65
65
  */
66
- let f = "9.6.5-canary.2dd99ae2d";
66
+ let f = "9.6.6-canary.3e9f3e253";
67
67
 
68
68
  /**
69
69
  * @license
@@ -99,26 +99,26 @@ const d = new Logger("@firebase/firestore");
99
99
  d.setLogLevel(t);
100
100
  }
101
101
 
102
- function m(t, ...n) {
102
+ function m(t, ...e) {
103
103
  if (d.logLevel <= LogLevel.DEBUG) {
104
- const e = n.map(_);
105
- d.debug(`Firestore (${f}): ${t}`, ...e);
104
+ const n = e.map(_);
105
+ d.debug(`Firestore (${f}): ${t}`, ...n);
106
106
  }
107
107
  }
108
108
 
109
- function p(t, ...n) {
109
+ function p(t, ...e) {
110
110
  if (d.logLevel <= LogLevel.ERROR) {
111
- const e = n.map(_);
112
- d.error(`Firestore (${f}): ${t}`, ...e);
111
+ const n = e.map(_);
112
+ d.error(`Firestore (${f}): ${t}`, ...n);
113
113
  }
114
114
  }
115
115
 
116
116
  /**
117
117
  * @internal
118
- */ function y(t, ...n) {
118
+ */ function y(t, ...e) {
119
119
  if (d.logLevel <= LogLevel.WARN) {
120
- const e = n.map(_);
121
- d.warn(`Firestore (${f}): ${t}`, ...e);
120
+ const n = e.map(_);
121
+ d.warn(`Firestore (${f}): ${t}`, ...n);
122
122
  }
123
123
  }
124
124
 
@@ -127,8 +127,8 @@ function p(t, ...n) {
127
127
  */ function _(t) {
128
128
  if ("string" == typeof t) return t;
129
129
  try {
130
- return n = t, JSON.stringify(n);
131
- } catch (n) {
130
+ return e = t, JSON.stringify(e);
131
+ } catch (e) {
132
132
  // Converting to JSON failed, just log the object directly
133
133
  return t;
134
134
  }
@@ -149,7 +149,7 @@ function p(t, ...n) {
149
149
  * limitations under the License.
150
150
  */
151
151
  /** Formats an object as a JSON string, suitable for logging. */
152
- var n;
152
+ var e;
153
153
  }
154
154
 
155
155
  /**
@@ -178,11 +178,11 @@ function p(t, ...n) {
178
178
  */ function g(t = "Unexpected state") {
179
179
  // Log the failure in addition to throw an exception, just in case the
180
180
  // exception is swallowed.
181
- const n = `FIRESTORE (${f}) INTERNAL ASSERTION FAILED: ` + t;
181
+ const e = `FIRESTORE (${f}) INTERNAL ASSERTION FAILED: ` + t;
182
182
  // NOTE: We don't use FirestoreError here because these are internal failures
183
183
  // that cannot be handled by the user. (Also it would create a circular
184
184
  // dependency between the error and assert modules which doesn't work.)
185
- throw p(n), new Error(n);
185
+ throw p(e), new Error(e);
186
186
  }
187
187
 
188
188
  /**
@@ -190,7 +190,7 @@ function p(t, ...n) {
190
190
  * given message if it did.
191
191
  *
192
192
  * Messages are stripped in production builds.
193
- */ function v(t, n) {
193
+ */ function v(t, e) {
194
194
  t || g();
195
195
  }
196
196
 
@@ -199,7 +199,7 @@ function p(t, ...n) {
199
199
  * instance of `T` before casting.
200
200
  */ function b(t,
201
201
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
202
- n) {
202
+ e) {
203
203
  return t;
204
204
  }
205
205
 
@@ -230,8 +230,8 @@ n) {
230
230
  /**
231
231
  * A custom error description.
232
232
  */
233
- n) {
234
- super(t, n), this.code = t, this.message = n,
233
+ e) {
234
+ super(t, e), this.code = t, this.message = e,
235
235
  // HACK: We write a toString property directly because Error is not a real
236
236
  // class and so inheritance does not work correctly. We could alternatively
237
237
  // do the same "back-door inheritance" trick that FirebaseError does.
@@ -256,8 +256,8 @@ n) {
256
256
  * limitations under the License.
257
257
  */ class k {
258
258
  constructor() {
259
- this.promise = new Promise(((t, n) => {
260
- this.resolve = t, this.reject = n;
259
+ this.promise = new Promise(((t, e) => {
260
+ this.resolve = t, this.reject = e;
261
261
  }));
262
262
  }
263
263
  }
@@ -278,8 +278,8 @@ n) {
278
278
  * See the License for the specific language governing permissions and
279
279
  * limitations under the License.
280
280
  */ class j {
281
- constructor(t, n) {
282
- this.user = n, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
281
+ constructor(t, e) {
282
+ this.user = e, this.type = "OAuth", this.headers = new Map, this.headers.set("Authorization", `Bearer ${t}`);
283
283
  }
284
284
  }
285
285
 
@@ -291,9 +291,9 @@ n) {
291
291
  return Promise.resolve(null);
292
292
  }
293
293
  invalidateToken() {}
294
- start(t, n) {
294
+ start(t, e) {
295
295
  // Fire with initial user.
296
- t.enqueueRetryable((() => n(l.UNAUTHENTICATED)));
296
+ t.enqueueRetryable((() => e(l.UNAUTHENTICATED)));
297
297
  }
298
298
  shutdown() {}
299
299
  }
@@ -315,10 +315,10 @@ n) {
315
315
  return Promise.resolve(this.token);
316
316
  }
317
317
  invalidateToken() {}
318
- start(t, n) {
319
- this.changeListener = n,
318
+ start(t, e) {
319
+ this.changeListener = e,
320
320
  // Fire with initial user.
321
- t.enqueueRetryable((() => n(this.token.user)));
321
+ t.enqueueRetryable((() => e(this.token.user)));
322
322
  }
323
323
  shutdown() {
324
324
  this.changeListener = null;
@@ -336,7 +336,7 @@ n) {
336
336
  new j(t.accessToken, new l(this.auth.getUid()))) : null)) : Promise.resolve(null);
337
337
  }
338
338
  invalidateToken() {}
339
- start(t, n) {}
339
+ start(t, e) {}
340
340
  shutdown() {}
341
341
  }
342
342
 
@@ -347,10 +347,10 @@ n) {
347
347
  * recover from unauthenticated errors (see b/33147818 for context), but it's
348
348
  * safer to keep the implementation as-is.
349
349
  */ class G {
350
- constructor(t, n, e) {
351
- this.type = "FirstParty", this.user = l.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", n);
350
+ constructor(t, e, n) {
351
+ this.type = "FirstParty", this.user = l.FIRST_PARTY, this.headers = new Map, this.headers.set("X-Goog-AuthUser", e);
352
352
  const r = t.auth.getAuthHeaderValueForFirstParty([]);
353
- r && this.headers.set("Authorization", r), e && this.headers.set("X-Goog-Iam-Authorization-Token", e);
353
+ r && this.headers.set("Authorization", r), n && this.headers.set("X-Goog-Iam-Authorization-Token", n);
354
354
  }
355
355
  }
356
356
 
@@ -359,15 +359,15 @@ n) {
359
359
  * to authenticate the user, using technique that is only available
360
360
  * to applications hosted by Google.
361
361
  */ class Q {
362
- constructor(t, n, e) {
363
- this.t = t, this.i = n, this.o = e;
362
+ constructor(t, e, n) {
363
+ this.t = t, this.i = e, this.o = n;
364
364
  }
365
365
  getToken() {
366
366
  return Promise.resolve(new G(this.t, this.i, this.o));
367
367
  }
368
- start(t, n) {
368
+ start(t, e) {
369
369
  // Fire with initial uid.
370
- t.enqueueRetryable((() => n(l.FIRST_PARTY)));
370
+ t.enqueueRetryable((() => e(l.FIRST_PARTY)));
371
371
  }
372
372
  shutdown() {}
373
373
  invalidateToken() {}
@@ -390,7 +390,7 @@ class W {
390
390
  new W(t.token)) : null)) : Promise.resolve(null);
391
391
  }
392
392
  invalidateToken() {}
393
- start(t, n) {}
393
+ start(t, e) {}
394
394
  shutdown() {}
395
395
  }
396
396
 
@@ -432,8 +432,8 @@ class H {
432
432
  * @param useFetchStreams Whether to use the Fetch API instead of
433
433
  * XMLHTTPRequest
434
434
  */
435
- constructor(t, n, e, r, s, i, o, u) {
436
- this.databaseId = t, this.appId = n, this.persistenceKey = e, this.host = r, this.ssl = s,
435
+ constructor(t, e, n, r, s, i, o, u) {
436
+ this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = r, this.ssl = s,
437
437
  this.forceLongPolling = i, this.autoDetectLongPolling = o, this.useFetchStreams = u;
438
438
  }
439
439
  }
@@ -444,8 +444,8 @@ class H {
444
444
  * @internal
445
445
  */
446
446
  class K {
447
- constructor(t, n) {
448
- this.projectId = t, this.database = n || "(default)";
447
+ constructor(t, e) {
448
+ this.projectId = t, this.database = e || "(default)";
449
449
  }
450
450
  static empty() {
451
451
  return new K("", "");
@@ -478,9 +478,9 @@ class K {
478
478
  * Path represents an ordered sequence of string segments.
479
479
  */
480
480
  class J {
481
- constructor(t, n, e) {
482
- void 0 === n ? n = 0 : n > t.length && g(), void 0 === e ? e = t.length - n : e > t.length - n && g(),
483
- this.segments = t, this.offset = n, this.len = e;
481
+ constructor(t, e, n) {
482
+ void 0 === e ? e = 0 : e > t.length && g(), void 0 === n ? n = t.length - e : n > t.length - e && g(),
483
+ this.segments = t, this.offset = e, this.len = n;
484
484
  }
485
485
  get length() {
486
486
  return this.len;
@@ -489,10 +489,10 @@ class J {
489
489
  return 0 === J.comparator(this, t);
490
490
  }
491
491
  child(t) {
492
- const n = this.segments.slice(this.offset, this.limit());
492
+ const e = this.segments.slice(this.offset, this.limit());
493
493
  return t instanceof J ? t.forEach((t => {
494
- n.push(t);
495
- })) : n.push(t), this.construct(n);
494
+ e.push(t);
495
+ })) : e.push(t), this.construct(e);
496
496
  }
497
497
  /** The index of one past the last segment of the path. */ limit() {
498
498
  return this.offset + this.length;
@@ -517,28 +517,28 @@ class J {
517
517
  }
518
518
  isPrefixOf(t) {
519
519
  if (t.length < this.length) return !1;
520
- for (let n = 0; n < this.length; n++) if (this.get(n) !== t.get(n)) return !1;
520
+ for (let e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1;
521
521
  return !0;
522
522
  }
523
523
  isImmediateParentOf(t) {
524
524
  if (this.length + 1 !== t.length) return !1;
525
- for (let n = 0; n < this.length; n++) if (this.get(n) !== t.get(n)) return !1;
525
+ for (let e = 0; e < this.length; e++) if (this.get(e) !== t.get(e)) return !1;
526
526
  return !0;
527
527
  }
528
528
  forEach(t) {
529
- for (let n = this.offset, e = this.limit(); n < e; n++) t(this.segments[n]);
529
+ for (let e = this.offset, n = this.limit(); e < n; e++) t(this.segments[e]);
530
530
  }
531
531
  toArray() {
532
532
  return this.segments.slice(this.offset, this.limit());
533
533
  }
534
- static comparator(t, n) {
535
- const e = Math.min(t.length, n.length);
536
- for (let r = 0; r < e; r++) {
537
- const e = t.get(r), s = n.get(r);
538
- if (e < s) return -1;
539
- if (e > s) return 1;
534
+ static comparator(t, e) {
535
+ const n = Math.min(t.length, e.length);
536
+ for (let r = 0; r < n; r++) {
537
+ const n = t.get(r), s = e.get(r);
538
+ if (n < s) return -1;
539
+ if (n > s) return 1;
540
540
  }
541
- return t.length < n.length ? -1 : t.length > n.length ? 1 : 0;
541
+ return t.length < e.length ? -1 : t.length > e.length ? 1 : 0;
542
542
  }
543
543
  }
544
544
 
@@ -548,8 +548,8 @@ class J {
548
548
  *
549
549
  * @internal
550
550
  */ class X extends J {
551
- construct(t, n, e) {
552
- return new X(t, n, e);
551
+ construct(t, e, n) {
552
+ return new X(t, e, n);
553
553
  }
554
554
  canonicalString() {
555
555
  // NOTE: The client is ignorant of any path segments containing escape
@@ -568,13 +568,13 @@ class J {
568
568
  // NOTE: The client is ignorant of any path segments containing escape
569
569
  // sequences (e.g. __id123__) and just passes them through raw (they exist
570
570
  // for legacy reasons and should not be used frequently).
571
- const n = [];
572
- for (const e of t) {
573
- if (e.indexOf("//") >= 0) throw new U(A, `Invalid segment (${e}). Paths must not contain // in them.`);
571
+ const e = [];
572
+ for (const n of t) {
573
+ if (n.indexOf("//") >= 0) throw new U(A, `Invalid segment (${n}). Paths must not contain // in them.`);
574
574
  // Strip leading and traling slashed.
575
- n.push(...e.split("/").filter((t => t.length > 0)));
575
+ e.push(...n.split("/").filter((t => t.length > 0)));
576
576
  }
577
- return new X(n);
577
+ return new X(e);
578
578
  }
579
579
  static emptyPath() {
580
580
  return new X([]);
@@ -587,8 +587,8 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
587
587
  * A dot-separated path for navigating sub-objects within a document.
588
588
  * @internal
589
589
  */ class tt extends J {
590
- construct(t, n, e) {
591
- return new tt(t, n, e);
590
+ construct(t, e, n) {
591
+ return new tt(t, e, n);
592
592
  }
593
593
  /**
594
594
  * Returns true if the string could be used as a segment in a field path
@@ -623,24 +623,24 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
623
623
  * TODO(b/37244157): we should make this more strict. Right now, it allows
624
624
  * non-identifier path components, even if they aren't escaped.
625
625
  */ static fromServerFormat(t) {
626
- const n = [];
627
- let e = "", r = 0;
626
+ const e = [];
627
+ let n = "", r = 0;
628
628
  const s = () => {
629
- if (0 === e.length) throw new U(A, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
630
- n.push(e), e = "";
629
+ if (0 === n.length) throw new U(A, `Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);
630
+ e.push(n), n = "";
631
631
  };
632
632
  let i = !1;
633
633
  for (;r < t.length; ) {
634
- const n = t[r];
635
- if ("\\" === n) {
634
+ const e = t[r];
635
+ if ("\\" === e) {
636
636
  if (r + 1 === t.length) throw new U(A, "Path has trailing escape character: " + t);
637
- const n = t[r + 1];
638
- if ("\\" !== n && "." !== n && "`" !== n) throw new U(A, "Path has invalid escape sequence: " + t);
639
- e += n, r += 2;
640
- } else "`" === n ? (i = !i, r++) : "." !== n || i ? (e += n, r++) : (s(), r++);
637
+ const e = t[r + 1];
638
+ if ("\\" !== e && "." !== e && "`" !== e) throw new U(A, "Path has invalid escape sequence: " + t);
639
+ n += e, r += 2;
640
+ } else "`" === e ? (i = !i, r++) : "." !== e || i ? (n += e, r++) : (s(), r++);
641
641
  }
642
642
  if (s(), i) throw new U(A, "Unterminated ` in path: " + t);
643
- return new tt(n);
643
+ return new tt(e);
644
644
  }
645
645
  static emptyPath() {
646
646
  return new tt([]);
@@ -665,30 +665,36 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
665
665
  */
666
666
  /**
667
667
  * @internal
668
- */ class nt {
668
+ */ class et {
669
669
  constructor(t) {
670
670
  this.path = t;
671
671
  }
672
672
  static fromPath(t) {
673
- return new nt(X.fromString(t));
673
+ return new et(X.fromString(t));
674
674
  }
675
675
  static fromName(t) {
676
- return new nt(X.fromString(t).popFirst(5));
676
+ return new et(X.fromString(t).popFirst(5));
677
677
  }
678
678
  static empty() {
679
- return new nt(X.emptyPath());
679
+ return new et(X.emptyPath());
680
680
  }
681
681
  /** Returns true if the document is in the specified collectionId. */ hasCollectionId(t) {
682
682
  return this.path.length >= 2 && this.path.get(this.path.length - 2) === t;
683
683
  }
684
+ /** Returns the collection group (i.e. the name of the parent collection) for this key. */ getCollectionGroup() {
685
+ return this.path.get(this.path.length - 2);
686
+ }
687
+ /** Returns the fully qualified path to the parent collection. */ getCollectionPath() {
688
+ return this.path.popLast();
689
+ }
684
690
  isEqual(t) {
685
691
  return null !== t && 0 === X.comparator(this.path, t.path);
686
692
  }
687
693
  toString() {
688
694
  return this.path.toString();
689
695
  }
690
- static comparator(t, n) {
691
- return X.comparator(t.path, n.path);
696
+ static comparator(t, e) {
697
+ return X.comparator(t.path, e.path);
692
698
  }
693
699
  static isDocumentKey(t) {
694
700
  return t.length % 2 == 0;
@@ -699,7 +705,7 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
699
705
  * @param segments - The segments of the path to the document
700
706
  * @returns A new instance of DocumentKey
701
707
  */ static fromSegments(t) {
702
- return new nt(new X(t.slice()));
708
+ return new et(new X(t.slice()));
703
709
  }
704
710
  }
705
711
 
@@ -718,8 +724,8 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
718
724
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
719
725
  * See the License for the specific language governing permissions and
720
726
  * limitations under the License.
721
- */ function et(t, n, e) {
722
- if (!e) throw new U(A, `Function ${t}() cannot be called with an empty ${n}.`);
727
+ */ function nt(t, e, n) {
728
+ if (!n) throw new U(A, `Function ${t}() cannot be called with an empty ${e}.`);
723
729
  }
724
730
 
725
731
  /**
@@ -731,14 +737,14 @@ const Z = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
731
737
  * an even numbers of segments).
732
738
  */
733
739
  function rt(t) {
734
- if (!nt.isDocumentKey(t)) throw new U(A, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
740
+ if (!et.isDocumentKey(t)) throw new U(A, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
735
741
  }
736
742
 
737
743
  /**
738
744
  * Validates that `path` refers to a collection (indicated by the fact it
739
745
  * contains an odd numbers of segments).
740
746
  */ function st(t) {
741
- if (nt.isDocumentKey(t)) throw new U(A, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
747
+ if (et.isDocumentKey(t)) throw new U(A, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
742
748
  }
743
749
 
744
750
  /**
@@ -755,7 +761,7 @@ function it(t) {
755
761
  if ("object" == typeof t) {
756
762
  if (t instanceof Array) return "an array";
757
763
  {
758
- const n =
764
+ const e =
759
765
  /** try to get the constructor name for an object. */
760
766
  function(t) {
761
767
  if (t.constructor) return t.constructor.name;
@@ -769,7 +775,7 @@ function it(t) {
769
775
  * arguments passed to the public API.
770
776
  * @internal
771
777
  */ (t);
772
- return n ? `a custom ${n} object` : "an object";
778
+ return e ? `a custom ${e} object` : "an object";
773
779
  }
774
780
  }
775
781
  return "function" == typeof t ? "a function" : g();
@@ -777,22 +783,22 @@ function it(t) {
777
783
 
778
784
  function ot(t,
779
785
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
780
- n) {
786
+ e) {
781
787
  if ("_delegate" in t && (
782
788
  // Unwrap Compat types
783
789
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
784
- t = t._delegate), !(t instanceof n)) {
785
- if (n.name === t.constructor.name) throw new U(A, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
790
+ t = t._delegate), !(t instanceof e)) {
791
+ if (e.name === t.constructor.name) throw new U(A, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
786
792
  {
787
- const e = it(t);
788
- throw new U(A, `Expected type '${n.name}', but it was: ${e}`);
793
+ const n = it(t);
794
+ throw new U(A, `Expected type '${e.name}', but it was: ${n}`);
789
795
  }
790
796
  }
791
797
  return t;
792
798
  }
793
799
 
794
- function ut(t, n) {
795
- if (n <= 0) throw new U(A, `Function ${t}() requires a positive number, but it was: ${n}.`);
800
+ function ut(t, e) {
801
+ if (e <= 0) throw new U(A, `Function ${t}() requires a positive number, but it was: ${e}.`);
796
802
  }
797
803
 
798
804
  /**
@@ -999,58 +1005,58 @@ class wt extends
999
1005
  class {
1000
1006
  constructor(t) {
1001
1007
  this.databaseInfo = t, this.databaseId = t.databaseId;
1002
- const n = t.ssl ? "https" : "http";
1003
- this.h = n + "://" + t.host, this.l = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
1008
+ const e = t.ssl ? "https" : "http";
1009
+ this.h = e + "://" + t.host, this.l = "projects/" + this.databaseId.projectId + "/databases/" + this.databaseId.database + "/documents";
1004
1010
  }
1005
- m(t, n, e, r, s) {
1006
- const i = this.p(t, n);
1007
- m("RestConnection", "Sending: ", i, e);
1011
+ m(t, e, n, r, s) {
1012
+ const i = this.p(t, e);
1013
+ m("RestConnection", "Sending: ", i, n);
1008
1014
  const o = {};
1009
- return this.g(o, r, s), this.v(t, i, o, e).then((t => (m("RestConnection", "Received: ", t),
1010
- t)), (n => {
1011
- throw y("RestConnection", `${t} failed with error: `, n, "url: ", i, "request:", e),
1012
- n;
1015
+ return this.g(o, r, s), this.v(t, i, o, n).then((t => (m("RestConnection", "Received: ", t),
1016
+ t)), (e => {
1017
+ throw y("RestConnection", `${t} failed with error: `, e, "url: ", i, "request:", n),
1018
+ e;
1013
1019
  }));
1014
1020
  }
1015
- T(t, n, e, r, s) {
1021
+ T(t, e, n, r, s) {
1016
1022
  // The REST API automatically aggregates all of the streamed results, so we
1017
1023
  // can just use the normal invoke() method.
1018
- return this.m(t, n, e, r, s);
1024
+ return this.m(t, e, n, r, s);
1019
1025
  }
1020
1026
  /**
1021
1027
  * Modifies the headers for a request, adding any authorization token if
1022
1028
  * present and any additional headers for the request.
1023
- */ g(t, n, e) {
1029
+ */ g(t, e, n) {
1024
1030
  t["X-Goog-Api-Client"] = "gl-js/ fire/" + f,
1025
1031
  // Content-Type: text/plain will avoid preflight requests which might
1026
1032
  // mess with CORS and redirects by proxies. If we add custom headers
1027
1033
  // we will need to change this code to potentially use the $httpOverwrite
1028
1034
  // parameter supported by ESF to avoid triggering preflight requests.
1029
1035
  t["Content-Type"] = "text/plain", this.databaseInfo.appId && (t["X-Firebase-GMPID"] = this.databaseInfo.appId),
1030
- n && n.headers.forEach(((n, e) => t[e] = n)), e && e.headers.forEach(((n, e) => t[e] = n));
1036
+ e && e.headers.forEach(((e, n) => t[n] = e)), n && n.headers.forEach(((e, n) => t[n] = e));
1031
1037
  }
1032
- p(t, n) {
1033
- const e = ht[t];
1034
- return `${this.h}/v1/${n}:${e}`;
1038
+ p(t, e) {
1039
+ const n = ht[t];
1040
+ return `${this.h}/v1/${e}:${n}`;
1035
1041
  }
1036
1042
  } {
1037
1043
  /**
1038
1044
  * @param databaseInfo - The connection info.
1039
1045
  * @param fetchImpl - `fetch` or a Polyfill that implements the fetch API.
1040
1046
  */
1041
- constructor(t, n) {
1042
- super(t), this.I = n;
1047
+ constructor(t, e) {
1048
+ super(t), this.I = e;
1043
1049
  }
1044
- A(t, n) {
1050
+ A(t, e) {
1045
1051
  throw new Error("Not supported by FetchConnection");
1046
1052
  }
1047
- async v(t, n, e, r) {
1053
+ async v(t, e, n, r) {
1048
1054
  const s = JSON.stringify(r);
1049
1055
  let i;
1050
1056
  try {
1051
- i = await this.I(n, {
1057
+ i = await this.I(e, {
1052
1058
  method: "POST",
1053
- headers: e,
1059
+ headers: n,
1054
1060
  body: s
1055
1061
  });
1056
1062
  } catch (t) {
@@ -1101,13 +1107,13 @@ class {
1101
1107
  */
1102
1108
  function mt(t) {
1103
1109
  // Polyfills for IE and WebWorker by using `self` and `msCrypto` when `crypto` is not available.
1104
- const n =
1110
+ const e =
1105
1111
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1106
- "undefined" != typeof self && (self.crypto || self.msCrypto), e = new Uint8Array(t);
1107
- if (n && "function" == typeof n.getRandomValues) n.getRandomValues(e); else
1112
+ "undefined" != typeof self && (self.crypto || self.msCrypto), n = new Uint8Array(t);
1113
+ if (e && "function" == typeof e.getRandomValues) e.getRandomValues(n); else
1108
1114
  // Falls back to Math.random
1109
- for (let n = 0; n < t; n++) e[n] = Math.floor(256 * Math.random());
1110
- return e;
1115
+ for (let e = 0; e < t; e++) n[e] = Math.floor(256 * Math.random());
1116
+ return n;
1111
1117
  }
1112
1118
 
1113
1119
  /**
@@ -1128,26 +1134,26 @@ function mt(t) {
1128
1134
  */ class pt {
1129
1135
  static R() {
1130
1136
  // Alphanumeric characters
1131
- const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", n = Math.floor(256 / t.length) * t.length;
1137
+ const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length;
1132
1138
  // The largest byte value that is a multiple of `char.length`.
1133
- let e = "";
1134
- for (;e.length < 20; ) {
1139
+ let n = "";
1140
+ for (;n.length < 20; ) {
1135
1141
  const r = mt(40);
1136
1142
  for (let s = 0; s < r.length; ++s)
1137
1143
  // Only accept values that are [0, maxMultiple), this ensures they can
1138
1144
  // be evenly mapped to indices of `chars` via a modulo operation.
1139
- e.length < 20 && r[s] < n && (e += t.charAt(r[s] % t.length));
1145
+ n.length < 20 && r[s] < e && (n += t.charAt(r[s] % t.length));
1140
1146
  }
1141
- return e;
1147
+ return n;
1142
1148
  }
1143
1149
  }
1144
1150
 
1145
- function yt(t, n) {
1146
- return t < n ? -1 : t > n ? 1 : 0;
1151
+ function yt(t, e) {
1152
+ return t < e ? -1 : t > e ? 1 : 0;
1147
1153
  }
1148
1154
 
1149
- /** Helper to compare arrays using isEqual(). */ function _t(t, n, e) {
1150
- return t.length === n.length && t.every(((t, r) => e(t, n[r])));
1155
+ /** Helper to compare arrays using isEqual(). */ function _t(t, e, n) {
1156
+ return t.length === e.length && t.every(((t, r) => n(t, e[r])));
1151
1157
  }
1152
1158
 
1153
1159
  /**
@@ -1201,9 +1207,9 @@ class gt {
1201
1207
  /**
1202
1208
  * The fractions of a second at nanosecond resolution.*
1203
1209
  */
1204
- n) {
1205
- if (this.seconds = t, this.nanoseconds = n, n < 0) throw new U(A, "Timestamp nanoseconds out of range: " + n);
1206
- if (n >= 1e9) throw new U(A, "Timestamp nanoseconds out of range: " + n);
1210
+ e) {
1211
+ if (this.seconds = t, this.nanoseconds = e, e < 0) throw new U(A, "Timestamp nanoseconds out of range: " + e);
1212
+ if (e >= 1e9) throw new U(A, "Timestamp nanoseconds out of range: " + e);
1207
1213
  if (t < -62135596800) throw new U(A, "Timestamp seconds out of range: " + t);
1208
1214
  // This will break in the year 10,000.
1209
1215
  if (t >= 253402300800) throw new U(A, "Timestamp seconds out of range: " + t);
@@ -1232,8 +1238,8 @@ class gt {
1232
1238
  * @returns A new `Timestamp` representing the same point in time as the given
1233
1239
  * number of milliseconds.
1234
1240
  */ static fromMillis(t) {
1235
- const n = Math.floor(t / 1e3), e = Math.floor(1e6 * (t - 1e3 * n));
1236
- return new gt(n, e);
1241
+ const e = Math.floor(t / 1e3), n = Math.floor(1e6 * (t - 1e3 * e));
1242
+ return new gt(e, n);
1237
1243
  }
1238
1244
  /**
1239
1245
  * Converts a `Timestamp` to a JavaScript `Date` object. This conversion
@@ -1355,13 +1361,13 @@ class gt {
1355
1361
  * See the License for the specific language governing permissions and
1356
1362
  * limitations under the License.
1357
1363
  */ function bt(t) {
1358
- let n = 0;
1359
- for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n++;
1360
- return n;
1364
+ let e = 0;
1365
+ for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e++;
1366
+ return e;
1361
1367
  }
1362
1368
 
1363
- function Et(t, n) {
1364
- for (const e in t) Object.prototype.hasOwnProperty.call(t, e) && n(e, t[e]);
1369
+ function Et(t, e) {
1370
+ for (const n in t) Object.prototype.hasOwnProperty.call(t, n) && e(n, t[n]);
1365
1371
  }
1366
1372
 
1367
1373
  /**
@@ -1403,11 +1409,11 @@ class Tt {
1403
1409
  *
1404
1410
  * This is an O(n) operation, where `n` is the size of the field mask.
1405
1411
  */ covers(t) {
1406
- for (const n of this.fields) if (n.isPrefixOf(t)) return !0;
1412
+ for (const e of this.fields) if (e.isPrefixOf(t)) return !0;
1407
1413
  return !1;
1408
1414
  }
1409
1415
  isEqual(t) {
1410
- return _t(this.fields, t.fields, ((t, n) => t.isEqual(n)));
1416
+ return _t(this.fields, t.fields, ((t, e) => t.isEqual(e)));
1411
1417
  }
1412
1418
  }
1413
1419
 
@@ -1458,23 +1464,23 @@ class It {
1458
1464
  this.binaryString = t;
1459
1465
  }
1460
1466
  static fromBase64String(t) {
1461
- const n = atob(t);
1462
- return new It(n);
1467
+ const e = atob(t);
1468
+ return new It(e);
1463
1469
  }
1464
1470
  static fromUint8Array(t) {
1465
- const n =
1471
+ const e =
1466
1472
  /**
1467
1473
  * Helper function to convert an Uint8array to a binary string.
1468
1474
  */
1469
1475
  function(t) {
1470
- let n = "";
1471
- for (let e = 0; e < t.length; ++e) n += String.fromCharCode(t[e]);
1472
- return n;
1476
+ let e = "";
1477
+ for (let n = 0; n < t.length; ++n) e += String.fromCharCode(t[n]);
1478
+ return e;
1473
1479
  }
1474
1480
  /**
1475
1481
  * Helper function to convert a binary string to an Uint8Array.
1476
1482
  */ (t);
1477
- return new It(n);
1483
+ return new It(e);
1478
1484
  }
1479
1485
  [Symbol.iterator]() {
1480
1486
  let t = 0;
@@ -1495,9 +1501,9 @@ class It {
1495
1501
  }
1496
1502
  toUint8Array() {
1497
1503
  return function(t) {
1498
- const n = new Uint8Array(t.length);
1499
- for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
1500
- return n;
1504
+ const e = new Uint8Array(t.length);
1505
+ for (let n = 0; n < t.length; n++) e[n] = t.charCodeAt(n);
1506
+ return e;
1501
1507
  }
1502
1508
  /**
1503
1509
  * @license
@@ -1544,18 +1550,18 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1544
1550
  // The date string can have higher precision (nanos) than the Date class
1545
1551
  // (millis), so we do some custom parsing here.
1546
1552
  // Parse the nanos right out of the string.
1547
- let n = 0;
1548
- const e = At.exec(t);
1549
- if (v(!!e), e[1]) {
1553
+ let e = 0;
1554
+ const n = At.exec(t);
1555
+ if (v(!!n), n[1]) {
1550
1556
  // Pad the fraction out to 9 digits (nanos).
1551
- let t = e[1];
1552
- t = (t + "000000000").substr(0, 9), n = Number(t);
1557
+ let t = n[1];
1558
+ t = (t + "000000000").substr(0, 9), e = Number(t);
1553
1559
  }
1554
1560
  // Parse the date to get the seconds.
1555
1561
  const r = new Date(t);
1556
1562
  return {
1557
1563
  seconds: Math.floor(r.getTime() / 1e3),
1558
- nanos: n
1564
+ nanos: e
1559
1565
  };
1560
1566
  }
1561
1567
  return {
@@ -1610,8 +1616,8 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1610
1616
  * - With respect to other ServerTimestampValues, they sort by their
1611
1617
  * localWriteTime.
1612
1618
  */ function Dt(t) {
1613
- var n, e;
1614
- 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);
1619
+ var e, n;
1620
+ 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);
1615
1621
  }
1616
1622
 
1617
1623
  /**
@@ -1620,15 +1626,15 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1620
1626
  * Preserving the previous values allows the user to display the last resoled
1621
1627
  * value until the backend responds with the timestamp.
1622
1628
  */ function Nt(t) {
1623
- const n = t.mapValue.fields.__previous_value__;
1624
- return Dt(n) ? Nt(n) : n;
1629
+ const e = t.mapValue.fields.__previous_value__;
1630
+ return Dt(e) ? Nt(e) : e;
1625
1631
  }
1626
1632
 
1627
1633
  /**
1628
1634
  * Returns the local time at which this timestamp was first set.
1629
1635
  */ function $t(t) {
1630
- const n = Rt(t.mapValue.fields.__local_write_time__.timestampValue);
1631
- return new gt(n.seconds, n.nanos);
1636
+ const e = Rt(t.mapValue.fields.__local_write_time__.timestampValue);
1637
+ return new gt(e.seconds, e.nanos);
1632
1638
  }
1633
1639
 
1634
1640
  /**
@@ -1651,169 +1657,169 @@ const At = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1651
1657
  return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Dt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : g();
1652
1658
  }
1653
1659
 
1654
- /** Tests `left` and `right` for equality based on the backend semantics. */ function Ft(t, n) {
1655
- if (t === n) return !0;
1656
- const e = St(t);
1657
- if (e !== St(n)) return !1;
1658
- switch (e) {
1660
+ /** Tests `left` and `right` for equality based on the backend semantics. */ function Ft(t, e) {
1661
+ if (t === e) return !0;
1662
+ const n = St(t);
1663
+ if (n !== St(e)) return !1;
1664
+ switch (n) {
1659
1665
  case 0 /* NullValue */ :
1660
1666
  return !0;
1661
1667
 
1662
1668
  case 1 /* BooleanValue */ :
1663
- return t.booleanValue === n.booleanValue;
1669
+ return t.booleanValue === e.booleanValue;
1664
1670
 
1665
1671
  case 4 /* ServerTimestampValue */ :
1666
- return $t(t).isEqual($t(n));
1672
+ return $t(t).isEqual($t(e));
1667
1673
 
1668
1674
  case 3 /* TimestampValue */ :
1669
- return function(t, n) {
1670
- if ("string" == typeof t.timestampValue && "string" == typeof n.timestampValue && t.timestampValue.length === n.timestampValue.length)
1675
+ return function(t, e) {
1676
+ if ("string" == typeof t.timestampValue && "string" == typeof e.timestampValue && t.timestampValue.length === e.timestampValue.length)
1671
1677
  // Use string equality for ISO 8601 timestamps
1672
- return t.timestampValue === n.timestampValue;
1673
- const e = Rt(t.timestampValue), r = Rt(n.timestampValue);
1674
- return e.seconds === r.seconds && e.nanos === r.nanos;
1675
- }(t, n);
1678
+ return t.timestampValue === e.timestampValue;
1679
+ const n = Rt(t.timestampValue), r = Rt(e.timestampValue);
1680
+ return n.seconds === r.seconds && n.nanos === r.nanos;
1681
+ }(t, e);
1676
1682
 
1677
1683
  case 5 /* StringValue */ :
1678
- return t.stringValue === n.stringValue;
1684
+ return t.stringValue === e.stringValue;
1679
1685
 
1680
1686
  case 6 /* BlobValue */ :
1681
- return function(t, n) {
1682
- return Vt(t.bytesValue).isEqual(Vt(n.bytesValue));
1683
- }(t, n);
1687
+ return function(t, e) {
1688
+ return Vt(t.bytesValue).isEqual(Vt(e.bytesValue));
1689
+ }(t, e);
1684
1690
 
1685
1691
  case 7 /* RefValue */ :
1686
- return t.referenceValue === n.referenceValue;
1692
+ return t.referenceValue === e.referenceValue;
1687
1693
 
1688
1694
  case 8 /* GeoPointValue */ :
1689
- return function(t, n) {
1690
- return Pt(t.geoPointValue.latitude) === Pt(n.geoPointValue.latitude) && Pt(t.geoPointValue.longitude) === Pt(n.geoPointValue.longitude);
1691
- }(t, n);
1695
+ return function(t, e) {
1696
+ return Pt(t.geoPointValue.latitude) === Pt(e.geoPointValue.latitude) && Pt(t.geoPointValue.longitude) === Pt(e.geoPointValue.longitude);
1697
+ }(t, e);
1692
1698
 
1693
1699
  case 2 /* NumberValue */ :
1694
- return function(t, n) {
1695
- if ("integerValue" in t && "integerValue" in n) return Pt(t.integerValue) === Pt(n.integerValue);
1696
- if ("doubleValue" in t && "doubleValue" in n) {
1697
- const e = Pt(t.doubleValue), r = Pt(n.doubleValue);
1698
- return e === r ? at(e) === at(r) : isNaN(e) && isNaN(r);
1700
+ return function(t, e) {
1701
+ if ("integerValue" in t && "integerValue" in e) return Pt(t.integerValue) === Pt(e.integerValue);
1702
+ if ("doubleValue" in t && "doubleValue" in e) {
1703
+ const n = Pt(t.doubleValue), r = Pt(e.doubleValue);
1704
+ return n === r ? at(n) === at(r) : isNaN(n) && isNaN(r);
1699
1705
  }
1700
1706
  return !1;
1701
- }(t, n);
1707
+ }(t, e);
1702
1708
 
1703
1709
  case 9 /* ArrayValue */ :
1704
- return _t(t.arrayValue.values || [], n.arrayValue.values || [], Ft);
1710
+ return _t(t.arrayValue.values || [], e.arrayValue.values || [], Ft);
1705
1711
 
1706
1712
  case 10 /* ObjectValue */ :
1707
- return function(t, n) {
1708
- const e = t.mapValue.fields || {}, r = n.mapValue.fields || {};
1709
- if (bt(e) !== bt(r)) return !1;
1710
- for (const t in e) if (e.hasOwnProperty(t) && (void 0 === r[t] || !Ft(e[t], r[t]))) return !1;
1713
+ return function(t, e) {
1714
+ const n = t.mapValue.fields || {}, r = e.mapValue.fields || {};
1715
+ if (bt(n) !== bt(r)) return !1;
1716
+ for (const t in n) if (n.hasOwnProperty(t) && (void 0 === r[t] || !Ft(n[t], r[t]))) return !1;
1711
1717
  return !0;
1712
1718
  }
1713
- /** Returns true if the ArrayValue contains the specified element. */ (t, n);
1719
+ /** Returns true if the ArrayValue contains the specified element. */ (t, e);
1714
1720
 
1715
1721
  default:
1716
1722
  return g();
1717
1723
  }
1718
1724
  }
1719
1725
 
1720
- function xt(t, n) {
1721
- return void 0 !== (t.values || []).find((t => Ft(t, n)));
1726
+ function xt(t, e) {
1727
+ return void 0 !== (t.values || []).find((t => Ft(t, e)));
1722
1728
  }
1723
1729
 
1724
- function qt(t, n) {
1725
- if (t === n) return 0;
1726
- const e = St(t), r = St(n);
1727
- if (e !== r) return yt(e, r);
1728
- switch (e) {
1730
+ function qt(t, e) {
1731
+ if (t === e) return 0;
1732
+ const n = St(t), r = St(e);
1733
+ if (n !== r) return yt(n, r);
1734
+ switch (n) {
1729
1735
  case 0 /* NullValue */ :
1730
1736
  return 0;
1731
1737
 
1732
1738
  case 1 /* BooleanValue */ :
1733
- return yt(t.booleanValue, n.booleanValue);
1739
+ return yt(t.booleanValue, e.booleanValue);
1734
1740
 
1735
1741
  case 2 /* NumberValue */ :
1736
- return function(t, n) {
1737
- const e = Pt(t.integerValue || t.doubleValue), r = Pt(n.integerValue || n.doubleValue);
1738
- return e < r ? -1 : e > r ? 1 : e === r ? 0 :
1742
+ return function(t, e) {
1743
+ const n = Pt(t.integerValue || t.doubleValue), r = Pt(e.integerValue || e.doubleValue);
1744
+ return n < r ? -1 : n > r ? 1 : n === r ? 0 :
1739
1745
  // one or both are NaN.
1740
- isNaN(e) ? isNaN(r) ? 0 : -1 : 1;
1741
- }(t, n);
1746
+ isNaN(n) ? isNaN(r) ? 0 : -1 : 1;
1747
+ }(t, e);
1742
1748
 
1743
1749
  case 3 /* TimestampValue */ :
1744
- return Ot(t.timestampValue, n.timestampValue);
1750
+ return Ot(t.timestampValue, e.timestampValue);
1745
1751
 
1746
1752
  case 4 /* ServerTimestampValue */ :
1747
- return Ot($t(t), $t(n));
1753
+ return Ot($t(t), $t(e));
1748
1754
 
1749
1755
  case 5 /* StringValue */ :
1750
- return yt(t.stringValue, n.stringValue);
1756
+ return yt(t.stringValue, e.stringValue);
1751
1757
 
1752
1758
  case 6 /* BlobValue */ :
1753
- return function(t, n) {
1754
- const e = Vt(t), r = Vt(n);
1755
- return e.compareTo(r);
1756
- }(t.bytesValue, n.bytesValue);
1759
+ return function(t, e) {
1760
+ const n = Vt(t), r = Vt(e);
1761
+ return n.compareTo(r);
1762
+ }(t.bytesValue, e.bytesValue);
1757
1763
 
1758
1764
  case 7 /* RefValue */ :
1759
- return function(t, n) {
1760
- const e = t.split("/"), r = n.split("/");
1761
- for (let t = 0; t < e.length && t < r.length; t++) {
1762
- const n = yt(e[t], r[t]);
1763
- if (0 !== n) return n;
1765
+ return function(t, e) {
1766
+ const n = t.split("/"), r = e.split("/");
1767
+ for (let t = 0; t < n.length && t < r.length; t++) {
1768
+ const e = yt(n[t], r[t]);
1769
+ if (0 !== e) return e;
1764
1770
  }
1765
- return yt(e.length, r.length);
1766
- }(t.referenceValue, n.referenceValue);
1771
+ return yt(n.length, r.length);
1772
+ }(t.referenceValue, e.referenceValue);
1767
1773
 
1768
1774
  case 8 /* GeoPointValue */ :
1769
- return function(t, n) {
1770
- const e = yt(Pt(t.latitude), Pt(n.latitude));
1771
- if (0 !== e) return e;
1772
- return yt(Pt(t.longitude), Pt(n.longitude));
1773
- }(t.geoPointValue, n.geoPointValue);
1775
+ return function(t, e) {
1776
+ const n = yt(Pt(t.latitude), Pt(e.latitude));
1777
+ if (0 !== n) return n;
1778
+ return yt(Pt(t.longitude), Pt(e.longitude));
1779
+ }(t.geoPointValue, e.geoPointValue);
1774
1780
 
1775
1781
  case 9 /* ArrayValue */ :
1776
- return function(t, n) {
1777
- const e = t.values || [], r = n.values || [];
1778
- for (let t = 0; t < e.length && t < r.length; ++t) {
1779
- const n = qt(e[t], r[t]);
1780
- if (n) return n;
1782
+ return function(t, e) {
1783
+ const n = t.values || [], r = e.values || [];
1784
+ for (let t = 0; t < n.length && t < r.length; ++t) {
1785
+ const e = qt(n[t], r[t]);
1786
+ if (e) return e;
1781
1787
  }
1782
- return yt(e.length, r.length);
1783
- }(t.arrayValue, n.arrayValue);
1788
+ return yt(n.length, r.length);
1789
+ }(t.arrayValue, e.arrayValue);
1784
1790
 
1785
1791
  case 10 /* ObjectValue */ :
1786
- return function(t, n) {
1787
- const e = t.fields || {}, r = Object.keys(e), s = n.fields || {}, i = Object.keys(s);
1792
+ return function(t, e) {
1793
+ const n = t.fields || {}, r = Object.keys(n), s = e.fields || {}, i = Object.keys(s);
1788
1794
  // Even though MapValues are likely sorted correctly based on their insertion
1789
1795
  // order (e.g. when received from the backend), local modifications can bring
1790
1796
  // elements out of order. We need to re-sort the elements to ensure that
1791
1797
  // canonical IDs are independent of insertion order.
1792
1798
  r.sort(), i.sort();
1793
1799
  for (let t = 0; t < r.length && t < i.length; ++t) {
1794
- const n = yt(r[t], i[t]);
1795
- if (0 !== n) return n;
1796
- const o = qt(e[r[t]], s[i[t]]);
1800
+ const e = yt(r[t], i[t]);
1801
+ if (0 !== e) return e;
1802
+ const o = qt(n[r[t]], s[i[t]]);
1797
1803
  if (0 !== o) return o;
1798
1804
  }
1799
1805
  return yt(r.length, i.length);
1800
1806
  }
1801
- /** Returns a reference value for the provided database and key. */ (t.mapValue, n.mapValue);
1807
+ /** Returns a reference value for the provided database and key. */ (t.mapValue, e.mapValue);
1802
1808
 
1803
1809
  default:
1804
1810
  throw g();
1805
1811
  }
1806
1812
  }
1807
1813
 
1808
- function Ot(t, n) {
1809
- if ("string" == typeof t && "string" == typeof n && t.length === n.length) return yt(t, n);
1810
- const e = Rt(t), r = Rt(n), s = yt(e.seconds, r.seconds);
1811
- return 0 !== s ? s : yt(e.nanos, r.nanos);
1814
+ function Ot(t, e) {
1815
+ if ("string" == typeof t && "string" == typeof e && t.length === e.length) return yt(t, e);
1816
+ const n = Rt(t), r = Rt(e), s = yt(n.seconds, r.seconds);
1817
+ return 0 !== s ? s : yt(n.nanos, r.nanos);
1812
1818
  }
1813
1819
 
1814
- function Ct(t, n) {
1820
+ function Ct(t, e) {
1815
1821
  return {
1816
- referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${n.path.canonicalString()}`
1822
+ referenceValue: `projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`
1817
1823
  };
1818
1824
  }
1819
1825
 
@@ -1841,21 +1847,21 @@ function Ct(t, n) {
1841
1847
  timestampValue: Object.assign({}, t.timestampValue)
1842
1848
  };
1843
1849
  if (t.mapValue) {
1844
- const n = {
1850
+ const e = {
1845
1851
  mapValue: {
1846
1852
  fields: {}
1847
1853
  }
1848
1854
  };
1849
- return Et(t.mapValue.fields, ((t, e) => n.mapValue.fields[t] = Mt(e))), n;
1855
+ return Et(t.mapValue.fields, ((t, n) => e.mapValue.fields[t] = Mt(n))), e;
1850
1856
  }
1851
1857
  if (t.arrayValue) {
1852
- const n = {
1858
+ const e = {
1853
1859
  arrayValue: {
1854
1860
  values: []
1855
1861
  }
1856
1862
  };
1857
- for (let e = 0; e < (t.arrayValue.values || []).length; ++e) n.arrayValue.values[e] = Mt(t.arrayValue.values[e]);
1858
- return n;
1863
+ for (let n = 0; n < (t.arrayValue.values || []).length; ++n) e.arrayValue.values[n] = Mt(t.arrayValue.values[n]);
1864
+ return e;
1859
1865
  }
1860
1866
  return Object.assign({}, t);
1861
1867
  }
@@ -1896,10 +1902,10 @@ function Ct(t, n) {
1896
1902
  */ field(t) {
1897
1903
  if (t.isEmpty()) return this.value;
1898
1904
  {
1899
- let n = this.value;
1900
- for (let e = 0; e < t.length - 1; ++e) if (n = (n.mapValue.fields || {})[t.get(e)],
1901
- !jt(n)) return null;
1902
- return n = (n.mapValue.fields || {})[t.lastSegment()], n || null;
1905
+ let e = this.value;
1906
+ for (let n = 0; n < t.length - 1; ++n) if (e = (e.mapValue.fields || {})[t.get(n)],
1907
+ !jt(e)) return null;
1908
+ return e = (e.mapValue.fields || {})[t.lastSegment()], e || null;
1903
1909
  }
1904
1910
  }
1905
1911
  /**
@@ -1907,25 +1913,25 @@ function Ct(t, n) {
1907
1913
  *
1908
1914
  * @param path - The field path to set.
1909
1915
  * @param value - The value to set.
1910
- */ set(t, n) {
1911
- this.getFieldsMap(t.popLast())[t.lastSegment()] = Mt(n);
1916
+ */ set(t, e) {
1917
+ this.getFieldsMap(t.popLast())[t.lastSegment()] = Mt(e);
1912
1918
  }
1913
1919
  /**
1914
1920
  * Sets the provided fields to the provided values.
1915
1921
  *
1916
1922
  * @param data - A map of fields to values (or null for deletes).
1917
1923
  */ setAll(t) {
1918
- let n = tt.emptyPath(), e = {}, r = [];
1924
+ let e = tt.emptyPath(), n = {}, r = [];
1919
1925
  t.forEach(((t, s) => {
1920
- if (!n.isImmediateParentOf(s)) {
1926
+ if (!e.isImmediateParentOf(s)) {
1921
1927
  // Insert the accumulated changes at this parent location
1922
- const t = this.getFieldsMap(n);
1923
- this.applyChanges(t, e, r), e = {}, r = [], n = s.popLast();
1928
+ const t = this.getFieldsMap(e);
1929
+ this.applyChanges(t, n, r), n = {}, r = [], e = s.popLast();
1924
1930
  }
1925
- t ? e[s.lastSegment()] = Mt(t) : r.push(s.lastSegment());
1931
+ t ? n[s.lastSegment()] = Mt(t) : r.push(s.lastSegment());
1926
1932
  }));
1927
- const s = this.getFieldsMap(n);
1928
- this.applyChanges(s, e, r);
1933
+ const s = this.getFieldsMap(e);
1934
+ this.applyChanges(s, n, r);
1929
1935
  }
1930
1936
  /**
1931
1937
  * Removes the field at the specified path. If there is no field at the
@@ -1933,8 +1939,8 @@ function Ct(t, n) {
1933
1939
  *
1934
1940
  * @param path - The field path to remove.
1935
1941
  */ delete(t) {
1936
- const n = this.field(t.popLast());
1937
- jt(n) && n.mapValue.fields && delete n.mapValue.fields[t.lastSegment()];
1942
+ const e = this.field(t.popLast());
1943
+ jt(e) && e.mapValue.fields && delete e.mapValue.fields[t.lastSegment()];
1938
1944
  }
1939
1945
  isEqual(t) {
1940
1946
  return Ft(this.value, t.value);
@@ -1943,26 +1949,26 @@ function Ct(t, n) {
1943
1949
  * Returns the map that contains the leaf element of `path`. If the parent
1944
1950
  * entry does not yet exist, or if it is not a map, a new map will be created.
1945
1951
  */ getFieldsMap(t) {
1946
- let n = this.value;
1947
- n.mapValue.fields || (n.mapValue = {
1952
+ let e = this.value;
1953
+ e.mapValue.fields || (e.mapValue = {
1948
1954
  fields: {}
1949
1955
  });
1950
- for (let e = 0; e < t.length; ++e) {
1951
- let r = n.mapValue.fields[t.get(e)];
1956
+ for (let n = 0; n < t.length; ++n) {
1957
+ let r = e.mapValue.fields[t.get(n)];
1952
1958
  jt(r) && r.mapValue.fields || (r = {
1953
1959
  mapValue: {
1954
1960
  fields: {}
1955
1961
  }
1956
- }, n.mapValue.fields[t.get(e)] = r), n = r;
1962
+ }, e.mapValue.fields[t.get(n)] = r), e = r;
1957
1963
  }
1958
- return n.mapValue.fields;
1964
+ return e.mapValue.fields;
1959
1965
  }
1960
1966
  /**
1961
1967
  * Modifies `fieldsMap` by adding, replacing or deleting the specified
1962
1968
  * entries.
1963
- */ applyChanges(t, n, e) {
1964
- Et(n, ((n, e) => t[n] = e));
1965
- for (const n of e) delete t[n];
1969
+ */ applyChanges(t, e, n) {
1970
+ Et(e, ((e, n) => t[e] = n));
1971
+ for (const e of n) delete t[e];
1966
1972
  }
1967
1973
  clone() {
1968
1974
  return new Bt(Mt(this.value));
@@ -1995,8 +2001,8 @@ function Ct(t, n) {
1995
2001
  * applied, `isValidDocument()` returns false and the document should be removed
1996
2002
  * from all views.
1997
2003
  */ class zt {
1998
- constructor(t, n, e, r, s, i) {
1999
- this.key = t, this.documentType = n, this.version = e, this.readTime = r, this.data = s,
2004
+ constructor(t, e, n, r, s, i) {
2005
+ this.key = t, this.documentType = e, this.version = n, this.readTime = r, this.data = s,
2000
2006
  this.documentState = i;
2001
2007
  }
2002
2008
  /**
@@ -2008,24 +2014,24 @@ function Ct(t, n) {
2008
2014
  /**
2009
2015
  * Creates a new document that is known to exist with the given data at the
2010
2016
  * given version.
2011
- */ static newFoundDocument(t, n, e) {
2012
- return new zt(t, 1 /* FOUND_DOCUMENT */ , n, vt.min(), e, 0 /* SYNCED */);
2017
+ */ static newFoundDocument(t, e, n) {
2018
+ return new zt(t, 1 /* FOUND_DOCUMENT */ , e, vt.min(), n, 0 /* SYNCED */);
2013
2019
  }
2014
- /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, n) {
2015
- return new zt(t, 2 /* NO_DOCUMENT */ , n, vt.min(), Bt.empty(), 0 /* SYNCED */);
2020
+ /** Creates a new document that is known to not exist at the given version. */ static newNoDocument(t, e) {
2021
+ return new zt(t, 2 /* NO_DOCUMENT */ , e, vt.min(), Bt.empty(), 0 /* SYNCED */);
2016
2022
  }
2017
2023
  /**
2018
2024
  * Creates a new document that is known to exist at the given version but
2019
2025
  * whose data is not known (e.g. a document that was updated without a known
2020
2026
  * base document).
2021
- */ static newUnknownDocument(t, n) {
2022
- return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , n, vt.min(), Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2027
+ */ static newUnknownDocument(t, e) {
2028
+ return new zt(t, 3 /* UNKNOWN_DOCUMENT */ , e, vt.min(), Bt.empty(), 2 /* HAS_COMMITTED_MUTATIONS */);
2023
2029
  }
2024
2030
  /**
2025
2031
  * Changes the document type to indicate that it exists and that its version
2026
2032
  * and data are known.
2027
- */ convertToFoundDocument(t, n) {
2028
- return this.version = t, this.documentType = 1 /* FOUND_DOCUMENT */ , this.data = n,
2033
+ */ convertToFoundDocument(t, e) {
2034
+ return this.version = t, this.documentType = 1 /* FOUND_DOCUMENT */ , this.data = e,
2029
2035
  this.documentState = 0 /* SYNCED */ , this;
2030
2036
  }
2031
2037
  /**
@@ -2102,8 +2108,8 @@ function Ct(t, n) {
2102
2108
  */
2103
2109
  // Visible for testing
2104
2110
  class Gt {
2105
- constructor(t, n = null, e = [], r = [], s = null, i = null, o = null) {
2106
- this.path = t, this.collectionGroup = n, this.orderBy = e, this.filters = r, this.limit = s,
2111
+ constructor(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2112
+ this.path = t, this.collectionGroup = e, this.orderBy = n, this.filters = r, this.limit = s,
2107
2113
  this.startAt = i, this.endAt = o, this.P = null;
2108
2114
  }
2109
2115
  }
@@ -2115,26 +2121,26 @@ class Gt {
2115
2121
  * NOTE: you should always construct `Target` from `Query.toTarget` instead of
2116
2122
  * using this factory method, because `Query` provides an implicit `orderBy`
2117
2123
  * property.
2118
- */ function Qt(t, n = null, e = [], r = [], s = null, i = null, o = null) {
2119
- return new Gt(t, n, e, r, s, i, o);
2124
+ */ function Qt(t, e = null, n = [], r = [], s = null, i = null, o = null) {
2125
+ return new Gt(t, e, n, r, s, i, o);
2120
2126
  }
2121
2127
 
2122
2128
  class Wt extends class {} {
2123
- constructor(t, n, e) {
2124
- super(), this.field = t, this.op = n, this.value = e;
2129
+ constructor(t, e, n) {
2130
+ super(), this.field = t, this.op = e, this.value = n;
2125
2131
  }
2126
2132
  /**
2127
2133
  * Creates a filter based on the provided arguments.
2128
- */ static create(t, n, e) {
2129
- return t.isKeyField() ? "in" /* IN */ === n || "not-in" /* NOT_IN */ === n ? this.V(t, n, e) : new Yt(t, n, e) : "array-contains" /* ARRAY_CONTAINS */ === n ? new Xt(t, e) : "in" /* IN */ === n ? new Zt(t, e) : "not-in" /* NOT_IN */ === n ? new tn(t, e) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === n ? new nn(t, e) : new Wt(t, n, e);
2134
+ */ static create(t, e, n) {
2135
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.V(t, e, n) : new Yt(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new Xt(t, n) : "in" /* IN */ === e ? new Zt(t, n) : "not-in" /* NOT_IN */ === e ? new te(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new ee(t, n) : new Wt(t, e, n);
2130
2136
  }
2131
- static V(t, n, e) {
2132
- return "in" /* IN */ === n ? new Ht(t, e) : new Kt(t, e);
2137
+ static V(t, e, n) {
2138
+ return "in" /* IN */ === e ? new Ht(t, n) : new Kt(t, n);
2133
2139
  }
2134
2140
  matches(t) {
2135
- const n = t.data.field(this.field);
2141
+ const e = t.data.field(this.field);
2136
2142
  // Types do not have to match in NOT_EQUAL filters.
2137
- return "!=" /* NOT_EQUAL */ === this.op ? null !== n && this.D(qt(n, this.value)) : null !== n && St(this.value) === St(n) && this.D(qt(n, this.value));
2143
+ return "!=" /* NOT_EQUAL */ === this.op ? null !== e && this.D(qt(e, this.value)) : null !== e && St(this.value) === St(e) && this.D(qt(e, this.value));
2138
2144
  // Only compare types with matching backend order (such as double and int).
2139
2145
  }
2140
2146
  D(t) {
@@ -2168,82 +2174,81 @@ class Wt extends class {} {
2168
2174
 
2169
2175
  /** Filter that matches on key fields (i.e. '__name__'). */
2170
2176
  class Yt extends Wt {
2171
- constructor(t, n, e) {
2172
- super(t, n, e), this.key = nt.fromName(e.referenceValue);
2177
+ constructor(t, e, n) {
2178
+ super(t, e, n), this.key = et.fromName(n.referenceValue);
2173
2179
  }
2174
2180
  matches(t) {
2175
- const n = nt.comparator(t.key, this.key);
2176
- return this.D(n);
2181
+ const e = et.comparator(t.key, this.key);
2182
+ return this.D(e);
2177
2183
  }
2178
2184
  }
2179
2185
 
2180
2186
  /** Filter that matches on key fields within an array. */ class Ht extends Wt {
2181
- constructor(t, n) {
2182
- super(t, "in" /* IN */ , n), this.keys = Jt("in" /* IN */ , n);
2187
+ constructor(t, e) {
2188
+ super(t, "in" /* IN */ , e), this.keys = Jt("in" /* IN */ , e);
2183
2189
  }
2184
2190
  matches(t) {
2185
- return this.keys.some((n => n.isEqual(t.key)));
2191
+ return this.keys.some((e => e.isEqual(t.key)));
2186
2192
  }
2187
2193
  }
2188
2194
 
2189
2195
  /** Filter that matches on key fields not present within an array. */ class Kt extends Wt {
2190
- constructor(t, n) {
2191
- super(t, "not-in" /* NOT_IN */ , n), this.keys = Jt("not-in" /* NOT_IN */ , n);
2196
+ constructor(t, e) {
2197
+ super(t, "not-in" /* NOT_IN */ , e), this.keys = Jt("not-in" /* NOT_IN */ , e);
2192
2198
  }
2193
2199
  matches(t) {
2194
- return !this.keys.some((n => n.isEqual(t.key)));
2200
+ return !this.keys.some((e => e.isEqual(t.key)));
2195
2201
  }
2196
2202
  }
2197
2203
 
2198
- function Jt(t, n) {
2199
- var e;
2200
- return ((null === (e = n.arrayValue) || void 0 === e ? void 0 : e.values) || []).map((t => nt.fromName(t.referenceValue)));
2204
+ function Jt(t, e) {
2205
+ var n;
2206
+ return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => et.fromName(t.referenceValue)));
2201
2207
  }
2202
2208
 
2203
2209
  /** A Filter that implements the array-contains operator. */ class Xt extends Wt {
2204
- constructor(t, n) {
2205
- super(t, "array-contains" /* ARRAY_CONTAINS */ , n);
2210
+ constructor(t, e) {
2211
+ super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
2206
2212
  }
2207
2213
  matches(t) {
2208
- const n = t.data.field(this.field);
2209
- return Lt(n) && xt(n.arrayValue, this.value);
2214
+ const e = t.data.field(this.field);
2215
+ return Lt(e) && xt(e.arrayValue, this.value);
2210
2216
  }
2211
2217
  }
2212
2218
 
2213
2219
  /** A Filter that implements the IN operator. */ class Zt extends Wt {
2214
- constructor(t, n) {
2215
- super(t, "in" /* IN */ , n);
2220
+ constructor(t, e) {
2221
+ super(t, "in" /* IN */ , e);
2216
2222
  }
2217
2223
  matches(t) {
2218
- const n = t.data.field(this.field);
2219
- return null !== n && xt(this.value.arrayValue, n);
2224
+ const e = t.data.field(this.field);
2225
+ return null !== e && xt(this.value.arrayValue, e);
2220
2226
  }
2221
2227
  }
2222
2228
 
2223
- /** A Filter that implements the not-in operator. */ class tn extends Wt {
2224
- constructor(t, n) {
2225
- super(t, "not-in" /* NOT_IN */ , n);
2229
+ /** A Filter that implements the not-in operator. */ class te extends Wt {
2230
+ constructor(t, e) {
2231
+ super(t, "not-in" /* NOT_IN */ , e);
2226
2232
  }
2227
2233
  matches(t) {
2228
2234
  if (xt(this.value.arrayValue, {
2229
2235
  nullValue: "NULL_VALUE"
2230
2236
  })) return !1;
2231
- const n = t.data.field(this.field);
2232
- return null !== n && !xt(this.value.arrayValue, n);
2237
+ const e = t.data.field(this.field);
2238
+ return null !== e && !xt(this.value.arrayValue, e);
2233
2239
  }
2234
2240
  }
2235
2241
 
2236
- /** A Filter that implements the array-contains-any operator. */ class nn extends Wt {
2237
- constructor(t, n) {
2238
- super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , n);
2242
+ /** A Filter that implements the array-contains-any operator. */ class ee extends Wt {
2243
+ constructor(t, e) {
2244
+ super(t, "array-contains-any" /* ARRAY_CONTAINS_ANY */ , e);
2239
2245
  }
2240
2246
  matches(t) {
2241
- const n = t.data.field(this.field);
2242
- return !(!Lt(n) || !n.arrayValue.values) && n.arrayValue.values.some((t => xt(this.value.arrayValue, t)));
2247
+ const e = t.data.field(this.field);
2248
+ return !(!Lt(e) || !e.arrayValue.values) && e.arrayValue.values.some((t => xt(this.value.arrayValue, t)));
2243
2249
  }
2244
2250
  }
2245
2251
 
2246
- // TODO(indexing): Change Bound.before to "inclusive"
2247
2252
  /**
2248
2253
  * Represents a bound of a query.
2249
2254
  *
@@ -2257,30 +2262,30 @@ function Jt(t, n) {
2257
2262
  * Bound provides a function to determine whether a document comes before or
2258
2263
  * after a bound. This is influenced by whether the position is just before or
2259
2264
  * just after the provided values.
2260
- */ class en {
2261
- constructor(t, n) {
2262
- this.position = t, this.before = n;
2265
+ */ class ne {
2266
+ constructor(t, e) {
2267
+ this.position = t, this.inclusive = e;
2263
2268
  }
2264
2269
  }
2265
2270
 
2266
2271
  /**
2267
2272
  * An ordering on a field, in some Direction. Direction defaults to ASCENDING.
2268
- */ class rn {
2269
- constructor(t, n = "asc" /* ASCENDING */) {
2270
- this.field = t, this.dir = n;
2273
+ */ class re {
2274
+ constructor(t, e = "asc" /* ASCENDING */) {
2275
+ this.field = t, this.dir = e;
2271
2276
  }
2272
2277
  }
2273
2278
 
2274
- function sn(t, n) {
2275
- return t.dir === n.dir && t.field.isEqual(n.field);
2279
+ function se(t, e) {
2280
+ return t.dir === e.dir && t.field.isEqual(e.field);
2276
2281
  }
2277
2282
 
2278
- function on(t, n) {
2279
- if (null === t) return null === n;
2280
- if (null === n) return !1;
2281
- if (t.before !== n.before || t.position.length !== n.position.length) return !1;
2282
- for (let e = 0; e < t.position.length; e++) {
2283
- if (!Ft(t.position[e], n.position[e])) return !1;
2283
+ function ie(t, e) {
2284
+ if (null === t) return null === e;
2285
+ if (null === e) return !1;
2286
+ if (t.inclusive !== e.inclusive || t.position.length !== e.position.length) return !1;
2287
+ for (let n = 0; n < t.position.length; n++) {
2288
+ if (!Ft(t.position[n], e.position[n])) return !1;
2284
2289
  }
2285
2290
  return !0;
2286
2291
  }
@@ -2307,29 +2312,29 @@ function on(t, n) {
2307
2312
  * query the RemoteStore results.
2308
2313
  *
2309
2314
  * Visible for testing.
2310
- */ class un {
2315
+ */ class oe {
2311
2316
  /**
2312
2317
  * Initializes a Query with a path and optional additional query constraints.
2313
2318
  * Path must currently be empty if this is a collection group query.
2314
2319
  */
2315
- constructor(t, n = null, e = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
2316
- this.path = t, this.collectionGroup = n, this.explicitOrderBy = e, this.filters = r,
2320
+ constructor(t, e = null, n = [], r = [], s = null, i = "F" /* First */ , o = null, u = null) {
2321
+ this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = r,
2317
2322
  this.limit = s, this.limitType = i, this.startAt = o, this.endAt = u, this.$ = null,
2318
2323
  // The corresponding `Target` of this `Query` instance.
2319
2324
  this.S = null, this.startAt, this.endAt;
2320
2325
  }
2321
2326
  }
2322
2327
 
2323
- /** Creates a new Query for a query that matches all documents at `path` */ function cn(t) {
2328
+ /** Creates a new Query for a query that matches all documents at `path` */ function ue(t) {
2324
2329
  return !ct(t.limit) && "L" /* Last */ === t.limitType;
2325
2330
  }
2326
2331
 
2327
- function an(t) {
2332
+ function ce(t) {
2328
2333
  return t.explicitOrderBy.length > 0 ? t.explicitOrderBy[0].field : null;
2329
2334
  }
2330
2335
 
2331
- function hn(t) {
2332
- for (const n of t.filters) if (n.N()) return n.field;
2336
+ function ae(t) {
2337
+ for (const e of t.filters) if (e.N()) return e.field;
2333
2338
  return null;
2334
2339
  }
2335
2340
 
@@ -2341,7 +2346,7 @@ function hn(t) {
2341
2346
  * Returns whether the query matches a collection group rather than a specific
2342
2347
  * collection.
2343
2348
  */
2344
- function ln(t) {
2349
+ function he(t) {
2345
2350
  return null !== t.collectionGroup;
2346
2351
  }
2347
2352
 
@@ -2349,59 +2354,59 @@ function ln(t) {
2349
2354
  * Returns the implicit order by constraint that is used to execute the Query,
2350
2355
  * which can be different from the order by constraints the user provided (e.g.
2351
2356
  * the SDK and backend always orders by `__name__`).
2352
- */ function fn(t) {
2353
- const n = b(t);
2354
- if (null === n.$) {
2355
- n.$ = [];
2356
- const t = hn(n), e = an(n);
2357
- if (null !== t && null === e)
2357
+ */ function le(t) {
2358
+ const e = b(t);
2359
+ if (null === e.$) {
2360
+ e.$ = [];
2361
+ const t = ae(e), n = ce(e);
2362
+ if (null !== t && null === n)
2358
2363
  // In order to implicitly add key ordering, we must also add the
2359
2364
  // inequality filter field for it to be a valid query.
2360
2365
  // Note that the default inequality field and key ordering is ascending.
2361
- t.isKeyField() || n.$.push(new rn(t)), n.$.push(new rn(tt.keyField(), "asc" /* ASCENDING */)); else {
2366
+ t.isKeyField() || e.$.push(new re(t)), e.$.push(new re(tt.keyField(), "asc" /* ASCENDING */)); else {
2362
2367
  let t = !1;
2363
- for (const e of n.explicitOrderBy) n.$.push(e), e.field.isKeyField() && (t = !0);
2368
+ for (const n of e.explicitOrderBy) e.$.push(n), n.field.isKeyField() && (t = !0);
2364
2369
  if (!t) {
2365
2370
  // The order of the implicit key ordering always matches the last
2366
2371
  // explicit order by
2367
- const t = n.explicitOrderBy.length > 0 ? n.explicitOrderBy[n.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2368
- n.$.push(new rn(tt.keyField(), t));
2372
+ const t = e.explicitOrderBy.length > 0 ? e.explicitOrderBy[e.explicitOrderBy.length - 1].dir : "asc" /* ASCENDING */;
2373
+ e.$.push(new re(tt.keyField(), t));
2369
2374
  }
2370
2375
  }
2371
2376
  }
2372
- return n.$;
2377
+ return e.$;
2373
2378
  }
2374
2379
 
2375
2380
  /**
2376
2381
  * Converts this `Query` instance to it's corresponding `Target` representation.
2377
- */ function dn(t) {
2378
- const n = b(t);
2379
- if (!n.S) if ("F" /* First */ === n.limitType) n.S = Qt(n.path, n.collectionGroup, fn(n), n.filters, n.limit, n.startAt, n.endAt); else {
2382
+ */ function fe(t) {
2383
+ const e = b(t);
2384
+ if (!e.S) if ("F" /* First */ === e.limitType) e.S = Qt(e.path, e.collectionGroup, le(e), e.filters, e.limit, e.startAt, e.endAt); else {
2380
2385
  // Flip the orderBy directions since we want the last results
2381
2386
  const t = [];
2382
- for (const e of fn(n)) {
2383
- const n = "desc" /* DESCENDING */ === e.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2384
- t.push(new rn(e.field, n));
2387
+ for (const n of le(e)) {
2388
+ const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2389
+ t.push(new re(n.field, e));
2385
2390
  }
2386
2391
  // We need to swap the cursors to match the now-flipped query ordering.
2387
- const e = n.endAt ? new en(n.endAt.position, !n.endAt.before) : null, r = n.startAt ? new en(n.startAt.position, !n.startAt.before) : null;
2392
+ const n = e.endAt ? new ne(e.endAt.position, !e.endAt.inclusive) : null, r = e.startAt ? new ne(e.startAt.position, !e.startAt.inclusive) : null;
2388
2393
  // Now return as a LimitType.First query.
2389
- n.S = Qt(n.path, n.collectionGroup, t, n.filters, n.limit, e, r);
2394
+ e.S = Qt(e.path, e.collectionGroup, t, e.filters, e.limit, n, r);
2390
2395
  }
2391
- return n.S;
2396
+ return e.S;
2392
2397
  }
2393
2398
 
2394
- function wn(t, n) {
2395
- return function(t, n) {
2396
- if (t.limit !== n.limit) return !1;
2397
- if (t.orderBy.length !== n.orderBy.length) return !1;
2398
- for (let e = 0; e < t.orderBy.length; e++) if (!sn(t.orderBy[e], n.orderBy[e])) return !1;
2399
- if (t.filters.length !== n.filters.length) return !1;
2400
- for (let s = 0; s < t.filters.length; s++) if (e = t.filters[s], r = n.filters[s],
2401
- e.op !== r.op || !e.field.isEqual(r.field) || !Ft(e.value, r.value)) return !1;
2402
- var e, r;
2403
- return t.collectionGroup === n.collectionGroup && !!t.path.isEqual(n.path) && !!on(t.startAt, n.startAt) && on(t.endAt, n.endAt);
2404
- }(dn(t), dn(n)) && t.limitType === n.limitType;
2399
+ function de(t, e) {
2400
+ return function(t, e) {
2401
+ if (t.limit !== e.limit) return !1;
2402
+ if (t.orderBy.length !== e.orderBy.length) return !1;
2403
+ for (let n = 0; n < t.orderBy.length; n++) if (!se(t.orderBy[n], e.orderBy[n])) return !1;
2404
+ if (t.filters.length !== e.filters.length) return !1;
2405
+ for (let s = 0; s < t.filters.length; s++) if (n = t.filters[s], r = e.filters[s],
2406
+ n.op !== r.op || !n.field.isEqual(r.field) || !Ft(n.value, r.value)) return !1;
2407
+ var n, r;
2408
+ return t.collectionGroup === e.collectionGroup && !!t.path.isEqual(e.path) && !!ie(t.startAt, e.startAt) && ie(t.endAt, e.endAt);
2409
+ }(fe(t), fe(e)) && t.limitType === e.limitType;
2405
2410
  }
2406
2411
 
2407
2412
  /**
@@ -2429,10 +2434,10 @@ function wn(t, n) {
2429
2434
  * The return value is an IntegerValue if it can safely represent the value,
2430
2435
  * otherwise a DoubleValue is returned.
2431
2436
  */
2432
- function mn(t, n) {
2437
+ function we(t, e) {
2433
2438
  return function(t) {
2434
2439
  return "number" == typeof t && Number.isInteger(t) && !at(t) && t <= Number.MAX_SAFE_INTEGER && t >= Number.MIN_SAFE_INTEGER;
2435
- }(n) ?
2440
+ }(e) ?
2436
2441
  /**
2437
2442
  * Returns an IntegerValue for `value`.
2438
2443
  */
@@ -2440,22 +2445,22 @@ function mn(t, n) {
2440
2445
  return {
2441
2446
  integerValue: "" + t
2442
2447
  };
2443
- }(n) : function(t, n) {
2448
+ }(e) : function(t, e) {
2444
2449
  if (t.F) {
2445
- if (isNaN(n)) return {
2450
+ if (isNaN(e)) return {
2446
2451
  doubleValue: "NaN"
2447
2452
  };
2448
- if (n === 1 / 0) return {
2453
+ if (e === 1 / 0) return {
2449
2454
  doubleValue: "Infinity"
2450
2455
  };
2451
- if (n === -1 / 0) return {
2456
+ if (e === -1 / 0) return {
2452
2457
  doubleValue: "-Infinity"
2453
2458
  };
2454
2459
  }
2455
2460
  return {
2456
- doubleValue: at(n) ? "-0" : n
2461
+ doubleValue: at(e) ? "-0" : e
2457
2462
  };
2458
- }(t, n);
2463
+ }(t, e);
2459
2464
  }
2460
2465
 
2461
2466
  /**
@@ -2474,7 +2479,7 @@ function mn(t, n) {
2474
2479
  * See the License for the specific language governing permissions and
2475
2480
  * limitations under the License.
2476
2481
  */
2477
- /** Used to represent a field transform on a mutation. */ class pn {
2482
+ /** Used to represent a field transform on a mutation. */ class me {
2478
2483
  constructor() {
2479
2484
  // Make sure that the structural type of `TransformOperation` is unique.
2480
2485
  // See https://github.com/microsoft/TypeScript/issues/5451
@@ -2482,15 +2487,15 @@ function mn(t, n) {
2482
2487
  }
2483
2488
  }
2484
2489
 
2485
- /** Transforms a value into a server-generated timestamp. */ class yn extends pn {}
2490
+ /** Transforms a value into a server-generated timestamp. */ class pe extends me {}
2486
2491
 
2487
- /** Transforms an array value via a union operation. */ class _n extends pn {
2492
+ /** Transforms an array value via a union operation. */ class ye extends me {
2488
2493
  constructor(t) {
2489
2494
  super(), this.elements = t;
2490
2495
  }
2491
2496
  }
2492
2497
 
2493
- /** Transforms an array value via a remove operation. */ class gn extends pn {
2498
+ /** Transforms an array value via a remove operation. */ class _e extends me {
2494
2499
  constructor(t) {
2495
2500
  super(), this.elements = t;
2496
2501
  }
@@ -2501,9 +2506,9 @@ function mn(t, n) {
2501
2506
  * transforms. Converts all field values to integers or doubles, but unlike the
2502
2507
  * backend does not cap integer values at 2^63. Instead, JavaScript number
2503
2508
  * arithmetic is used and precision loss can occur for values greater than 2^53.
2504
- */ class vn extends pn {
2505
- constructor(t, n) {
2506
- super(), this.q = t, this.O = n;
2509
+ */ class ge extends me {
2510
+ constructor(t, e) {
2511
+ super(), this.q = t, this.O = e;
2507
2512
  }
2508
2513
  }
2509
2514
 
@@ -2523,9 +2528,9 @@ function mn(t, n) {
2523
2528
  * See the License for the specific language governing permissions and
2524
2529
  * limitations under the License.
2525
2530
  */
2526
- /** A field path and the TransformOperation to perform upon it. */ class bn {
2527
- constructor(t, n) {
2528
- this.field = t, this.transform = n;
2531
+ /** A field path and the TransformOperation to perform upon it. */ class ve {
2532
+ constructor(t, e) {
2533
+ this.field = t, this.transform = e;
2529
2534
  }
2530
2535
  }
2531
2536
 
@@ -2533,18 +2538,18 @@ function mn(t, n) {
2533
2538
  * Encodes a precondition for a mutation. This follows the model that the
2534
2539
  * backend accepts with the special case of an explicit "empty" precondition
2535
2540
  * (meaning no precondition).
2536
- */ class En {
2537
- constructor(t, n) {
2538
- this.updateTime = t, this.exists = n;
2541
+ */ class be {
2542
+ constructor(t, e) {
2543
+ this.updateTime = t, this.exists = e;
2539
2544
  }
2540
2545
  /** Creates a new empty Precondition. */ static none() {
2541
- return new En;
2546
+ return new be;
2542
2547
  }
2543
2548
  /** Creates a new Precondition with an exists flag. */ static exists(t) {
2544
- return new En(void 0, t);
2549
+ return new be(void 0, t);
2545
2550
  }
2546
2551
  /** Creates a new Precondition based on a version a document exists at. */ static updateTime(t) {
2547
- return new En(t);
2552
+ return new be(t);
2548
2553
  }
2549
2554
  /** Returns whether this Precondition is empty. */ get isNone() {
2550
2555
  return void 0 === this.updateTime && void 0 === this.exists;
@@ -2597,14 +2602,14 @@ function mn(t, n) {
2597
2602
  * applyToLocalView() to implement the actual behavior of applying the mutation
2598
2603
  * to some source document (see `setMutationApplyToRemoteDocument()` for an
2599
2604
  * example).
2600
- */ class Tn {}
2605
+ */ class Ee {}
2601
2606
 
2602
2607
  /**
2603
2608
  * A mutation that creates or replaces the document at the given key with the
2604
2609
  * object value contents.
2605
- */ class In extends Tn {
2606
- constructor(t, n, e, r = []) {
2607
- super(), this.key = t, this.value = n, this.precondition = e, this.fieldTransforms = r,
2610
+ */ class Te extends Ee {
2611
+ constructor(t, e, n, r = []) {
2612
+ super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = r,
2608
2613
  this.type = 0 /* Set */;
2609
2614
  }
2610
2615
  }
@@ -2621,16 +2626,16 @@ function mn(t, n) {
2621
2626
  * is deleted.
2622
2627
  * * When a field is not in the mask but is in the values, the values map is
2623
2628
  * ignored.
2624
- */ class An extends Tn {
2625
- constructor(t, n, e, r, s = []) {
2626
- super(), this.key = t, this.data = n, this.fieldMask = e, this.precondition = r,
2629
+ */ class Ie extends Ee {
2630
+ constructor(t, e, n, r, s = []) {
2631
+ super(), this.key = t, this.data = e, this.fieldMask = n, this.precondition = r,
2627
2632
  this.fieldTransforms = s, this.type = 1 /* Patch */;
2628
2633
  }
2629
2634
  }
2630
2635
 
2631
- /** A mutation that deletes the document at the given key. */ class Rn extends Tn {
2632
- constructor(t, n) {
2633
- super(), this.key = t, this.precondition = n, this.type = 2 /* Delete */ , this.fieldTransforms = [];
2636
+ /** A mutation that deletes the document at the given key. */ class Ae extends Ee {
2637
+ constructor(t, e) {
2638
+ super(), this.key = t, this.precondition = e, this.type = 2 /* Delete */ , this.fieldTransforms = [];
2634
2639
  }
2635
2640
  }
2636
2641
 
@@ -2640,9 +2645,9 @@ function mn(t, n) {
2640
2645
  *
2641
2646
  * The `verify` operation is only used in Transactions, and this class serves
2642
2647
  * primarily to facilitate serialization into protos.
2643
- */ class Pn extends Tn {
2644
- constructor(t, n) {
2645
- super(), this.key = t, this.precondition = n, this.type = 3 /* Verify */ , this.fieldTransforms = [];
2648
+ */ class Re extends Ee {
2649
+ constructor(t, e) {
2650
+ super(), this.key = t, this.precondition = e, this.type = 3 /* Verify */ , this.fieldTransforms = [];
2646
2651
  }
2647
2652
  }
2648
2653
 
@@ -2661,13 +2666,13 @@ function mn(t, n) {
2661
2666
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2662
2667
  * See the License for the specific language governing permissions and
2663
2668
  * limitations under the License.
2664
- */ const Vn = (() => {
2669
+ */ const Pe = (() => {
2665
2670
  const t = {
2666
2671
  asc: "ASCENDING",
2667
2672
  desc: "DESCENDING"
2668
2673
  };
2669
2674
  return t;
2670
- })(), Dn = (() => {
2675
+ })(), Ve = (() => {
2671
2676
  const t = {
2672
2677
  "<": "LESS_THAN",
2673
2678
  "<=": "LESS_THAN_OR_EQUAL",
@@ -2697,9 +2702,9 @@ function mn(t, n) {
2697
2702
  * TODO(klimt): We can remove the databaseId argument if we keep the full
2698
2703
  * resource name in documents.
2699
2704
  */
2700
- class Nn {
2701
- constructor(t, n) {
2702
- this.databaseId = t, this.F = n;
2705
+ class De {
2706
+ constructor(t, e) {
2707
+ this.databaseId = t, this.F = e;
2703
2708
  }
2704
2709
  }
2705
2710
 
@@ -2714,13 +2719,13 @@ class Nn {
2714
2719
  /**
2715
2720
  * Returns a value for a Date that's appropriate to put into a proto.
2716
2721
  */
2717
- function $n(t, n) {
2722
+ function Ne(t, e) {
2718
2723
  if (t.F) {
2719
- return `${new Date(1e3 * n.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + n.nanoseconds).slice(-9)}Z`;
2724
+ return `${new Date(1e3 * e.seconds).toISOString().replace(/\.\d*/, "").replace("Z", "")}.${("000000000" + e.nanoseconds).slice(-9)}Z`;
2720
2725
  }
2721
2726
  return {
2722
- seconds: "" + n.seconds,
2723
- nanos: n.nanoseconds
2727
+ seconds: "" + e.seconds,
2728
+ nanos: e.nanoseconds
2724
2729
  };
2725
2730
  }
2726
2731
 
@@ -2729,232 +2734,234 @@ function $n(t, n) {
2729
2734
  *
2730
2735
  * Visible for testing.
2731
2736
  */
2732
- function Sn(t, n) {
2733
- return t.F ? n.toBase64() : n.toUint8Array();
2737
+ function $e(t, e) {
2738
+ return t.F ? e.toBase64() : e.toUint8Array();
2734
2739
  }
2735
2740
 
2736
- function Fn(t, n) {
2737
- return $n(t, n.toTimestamp());
2741
+ function Se(t, e) {
2742
+ return Ne(t, e.toTimestamp());
2738
2743
  }
2739
2744
 
2740
- function xn(t) {
2745
+ function Fe(t) {
2741
2746
  return v(!!t), vt.fromTimestamp(function(t) {
2742
- const n = Rt(t);
2743
- return new gt(n.seconds, n.nanos);
2747
+ const e = Rt(t);
2748
+ return new gt(e.seconds, e.nanos);
2744
2749
  }(t));
2745
2750
  }
2746
2751
 
2747
- function qn(t, n) {
2752
+ function xe(t, e) {
2748
2753
  return function(t) {
2749
2754
  return new X([ "projects", t.projectId, "databases", t.database ]);
2750
- }(t).child("documents").child(n).canonicalString();
2755
+ }(t).child("documents").child(e).canonicalString();
2751
2756
  }
2752
2757
 
2753
- function On(t, n) {
2754
- return qn(t.databaseId, n.path);
2758
+ function qe(t, e) {
2759
+ return xe(t.databaseId, e.path);
2755
2760
  }
2756
2761
 
2757
- function Cn(t, n) {
2758
- const e = function(t) {
2759
- const n = X.fromString(t);
2760
- return v(Hn(n)), n;
2761
- }(n);
2762
- if (e.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + e.get(1) + " vs " + t.databaseId.projectId);
2763
- if (e.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + e.get(3) + " vs " + t.databaseId.database);
2764
- return new nt((v((r = e).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
2762
+ function Oe(t, e) {
2763
+ const n = function(t) {
2764
+ const e = X.fromString(t);
2765
+ return v(We(e)), e;
2766
+ }(e);
2767
+ if (n.get(1) !== t.databaseId.projectId) throw new U(A, "Tried to deserialize key from different project: " + n.get(1) + " vs " + t.databaseId.projectId);
2768
+ if (n.get(3) !== t.databaseId.database) throw new U(A, "Tried to deserialize key from different database: " + n.get(3) + " vs " + t.databaseId.database);
2769
+ return new et((v((r = n).length > 4 && "documents" === r.get(4)), r.popFirst(5)));
2765
2770
  var r;
2766
2771
  /** Creates a Document proto from key and fields (but no create/update time) */}
2767
2772
 
2768
- function Ln(t, n) {
2769
- return qn(t.databaseId, n);
2773
+ function Ce(t, e) {
2774
+ return xe(t.databaseId, e);
2770
2775
  }
2771
2776
 
2772
- function Un(t) {
2777
+ function Le(t) {
2773
2778
  return new X([ "projects", t.databaseId.projectId, "databases", t.databaseId.database ]).canonicalString();
2774
2779
  }
2775
2780
 
2776
- function kn(t, n, e) {
2781
+ function Ue(t, e, n) {
2777
2782
  return {
2778
- name: On(t, n),
2779
- fields: e.value.mapValue.fields
2783
+ name: qe(t, e),
2784
+ fields: n.value.mapValue.fields
2780
2785
  };
2781
2786
  }
2782
2787
 
2783
- function jn(t, n) {
2784
- return "found" in n ? function(t, n) {
2785
- v(!!n.found), n.found.name, n.found.updateTime;
2786
- const e = Cn(t, n.found.name), r = xn(n.found.updateTime), s = new Bt({
2788
+ function ke(t, e) {
2789
+ return "found" in e ? function(t, e) {
2790
+ v(!!e.found), e.found.name, e.found.updateTime;
2791
+ const n = Oe(t, e.found.name), r = Fe(e.found.updateTime), s = new Bt({
2787
2792
  mapValue: {
2788
- fields: n.found.fields
2793
+ fields: e.found.fields
2789
2794
  }
2790
2795
  });
2791
- return zt.newFoundDocument(e, r, s);
2792
- }(t, n) : "missing" in n ? function(t, n) {
2793
- v(!!n.missing), v(!!n.readTime);
2794
- const e = Cn(t, n.missing), r = xn(n.readTime);
2795
- return zt.newNoDocument(e, r);
2796
- }(t, n) : g();
2797
- }
2798
-
2799
- function Mn(t, n) {
2800
- let e;
2801
- if (n instanceof In) e = {
2802
- update: kn(t, n.key, n.value)
2803
- }; else if (n instanceof Rn) e = {
2804
- delete: On(t, n.key)
2805
- }; else if (n instanceof An) e = {
2806
- update: kn(t, n.key, n.data),
2807
- updateMask: Yn(n.fieldMask)
2796
+ return zt.newFoundDocument(n, r, s);
2797
+ }(t, e) : "missing" in e ? function(t, e) {
2798
+ v(!!e.missing), v(!!e.readTime);
2799
+ const n = Oe(t, e.missing), r = Fe(e.readTime);
2800
+ return zt.newNoDocument(n, r);
2801
+ }(t, e) : g();
2802
+ }
2803
+
2804
+ function je(t, e) {
2805
+ let n;
2806
+ if (e instanceof Te) n = {
2807
+ update: Ue(t, e.key, e.value)
2808
+ }; else if (e instanceof Ae) n = {
2809
+ delete: qe(t, e.key)
2810
+ }; else if (e instanceof Ie) n = {
2811
+ update: Ue(t, e.key, e.data),
2812
+ updateMask: Qe(e.fieldMask)
2808
2813
  }; else {
2809
- if (!(n instanceof Pn)) return g();
2810
- e = {
2811
- verify: On(t, n.key)
2814
+ if (!(e instanceof Re)) return g();
2815
+ n = {
2816
+ verify: qe(t, e.key)
2812
2817
  };
2813
2818
  }
2814
- return n.fieldTransforms.length > 0 && (e.updateTransforms = n.fieldTransforms.map((t => function(t, n) {
2815
- const e = n.transform;
2816
- if (e instanceof yn) return {
2817
- fieldPath: n.field.canonicalString(),
2819
+ return e.fieldTransforms.length > 0 && (n.updateTransforms = e.fieldTransforms.map((t => function(t, e) {
2820
+ const n = e.transform;
2821
+ if (n instanceof pe) return {
2822
+ fieldPath: e.field.canonicalString(),
2818
2823
  setToServerValue: "REQUEST_TIME"
2819
2824
  };
2820
- if (e instanceof _n) return {
2821
- fieldPath: n.field.canonicalString(),
2825
+ if (n instanceof ye) return {
2826
+ fieldPath: e.field.canonicalString(),
2822
2827
  appendMissingElements: {
2823
- values: e.elements
2828
+ values: n.elements
2824
2829
  }
2825
2830
  };
2826
- if (e instanceof gn) return {
2827
- fieldPath: n.field.canonicalString(),
2831
+ if (n instanceof _e) return {
2832
+ fieldPath: e.field.canonicalString(),
2828
2833
  removeAllFromArray: {
2829
- values: e.elements
2834
+ values: n.elements
2830
2835
  }
2831
2836
  };
2832
- if (e instanceof vn) return {
2833
- fieldPath: n.field.canonicalString(),
2834
- increment: e.O
2837
+ if (n instanceof ge) return {
2838
+ fieldPath: e.field.canonicalString(),
2839
+ increment: n.O
2835
2840
  };
2836
2841
  throw g();
2837
- }(0, t)))), n.precondition.isNone || (e.currentDocument = function(t, n) {
2838
- return void 0 !== n.updateTime ? {
2839
- updateTime: Fn(t, n.updateTime)
2840
- } : void 0 !== n.exists ? {
2841
- exists: n.exists
2842
+ }(0, t)))), e.precondition.isNone || (n.currentDocument = function(t, e) {
2843
+ return void 0 !== e.updateTime ? {
2844
+ updateTime: Se(t, e.updateTime)
2845
+ } : void 0 !== e.exists ? {
2846
+ exists: e.exists
2842
2847
  } : g();
2843
- }(t, n.precondition)), e;
2848
+ }(t, e.precondition)), n;
2844
2849
  }
2845
2850
 
2846
- function Bn(t, n) {
2851
+ function Me(t, e) {
2847
2852
  // Dissect the path into parent, collectionId, and optional key filter.
2848
- const e = {
2853
+ const n = {
2849
2854
  structuredQuery: {}
2850
- }, r = n.path;
2851
- null !== n.collectionGroup ? (e.parent = Ln(t, r), e.structuredQuery.from = [ {
2852
- collectionId: n.collectionGroup,
2855
+ }, r = e.path;
2856
+ null !== e.collectionGroup ? (n.parent = Ce(t, r), n.structuredQuery.from = [ {
2857
+ collectionId: e.collectionGroup,
2853
2858
  allDescendants: !0
2854
- } ]) : (e.parent = Ln(t, r.popLast()), e.structuredQuery.from = [ {
2859
+ } ]) : (n.parent = Ce(t, r.popLast()), n.structuredQuery.from = [ {
2855
2860
  collectionId: r.lastSegment()
2856
2861
  } ]);
2857
2862
  const s = function(t) {
2858
2863
  if (0 === t.length) return;
2859
- const n = t.map((t =>
2864
+ const e = t.map((t =>
2860
2865
  // visible for testing
2861
2866
  function(t) {
2862
2867
  if ("==" /* EQUAL */ === t.op) {
2863
2868
  if (kt(t.value)) return {
2864
2869
  unaryFilter: {
2865
- field: Wn(t.field),
2870
+ field: Ge(t.field),
2866
2871
  op: "IS_NAN"
2867
2872
  }
2868
2873
  };
2869
2874
  if (Ut(t.value)) return {
2870
2875
  unaryFilter: {
2871
- field: Wn(t.field),
2876
+ field: Ge(t.field),
2872
2877
  op: "IS_NULL"
2873
2878
  }
2874
2879
  };
2875
2880
  } else if ("!=" /* NOT_EQUAL */ === t.op) {
2876
2881
  if (kt(t.value)) return {
2877
2882
  unaryFilter: {
2878
- field: Wn(t.field),
2883
+ field: Ge(t.field),
2879
2884
  op: "IS_NOT_NAN"
2880
2885
  }
2881
2886
  };
2882
2887
  if (Ut(t.value)) return {
2883
2888
  unaryFilter: {
2884
- field: Wn(t.field),
2889
+ field: Ge(t.field),
2885
2890
  op: "IS_NOT_NULL"
2886
2891
  }
2887
2892
  };
2888
2893
  }
2889
2894
  return {
2890
2895
  fieldFilter: {
2891
- field: Wn(t.field),
2892
- op: Qn(t.op),
2896
+ field: Ge(t.field),
2897
+ op: ze(t.op),
2893
2898
  value: t.value
2894
2899
  }
2895
2900
  };
2896
2901
  }(t)));
2897
- if (1 === n.length) return n[0];
2902
+ if (1 === e.length) return e[0];
2898
2903
  return {
2899
2904
  compositeFilter: {
2900
2905
  op: "AND",
2901
- filters: n
2906
+ filters: e
2902
2907
  }
2903
2908
  };
2904
- }(n.filters);
2905
- s && (e.structuredQuery.where = s);
2909
+ }(e.filters);
2910
+ s && (n.structuredQuery.where = s);
2906
2911
  const i = function(t) {
2907
2912
  if (0 === t.length) return;
2908
2913
  return t.map((t =>
2909
2914
  // visible for testing
2910
2915
  function(t) {
2911
2916
  return {
2912
- field: Wn(t.field),
2913
- direction: Gn(t.dir)
2917
+ field: Ge(t.field),
2918
+ direction: Be(t.dir)
2914
2919
  };
2915
2920
  }(t)));
2916
- }(n.orderBy);
2917
- i && (e.structuredQuery.orderBy = i);
2918
- const o = function(t, n) {
2919
- return t.F || ct(n) ? n : {
2920
- value: n
2921
+ }(e.orderBy);
2922
+ i && (n.structuredQuery.orderBy = i);
2923
+ const o = function(t, e) {
2924
+ return t.F || ct(e) ? e : {
2925
+ value: e
2921
2926
  };
2922
- }(t, n.limit);
2923
- return null !== o && (e.structuredQuery.limit = o), n.startAt && (e.structuredQuery.startAt = zn(n.startAt)),
2924
- n.endAt && (e.structuredQuery.endAt = zn(n.endAt)), e;
2925
- }
2926
-
2927
- function zn(t) {
2928
- return {
2929
- before: t.before,
2930
- values: t.position
2931
- };
2927
+ }(t, e.limit);
2928
+ var u;
2929
+ return null !== o && (n.structuredQuery.limit = o), e.startAt && (n.structuredQuery.startAt = {
2930
+ before: (u = e.startAt).inclusive,
2931
+ values: u.position
2932
+ }), e.endAt && (n.structuredQuery.endAt = function(t) {
2933
+ return {
2934
+ before: !t.inclusive,
2935
+ values: t.position
2936
+ };
2937
+ }
2938
+ // visible for testing
2939
+ (e.endAt)), n;
2932
2940
  }
2933
2941
 
2934
- // visible for testing
2935
- function Gn(t) {
2936
- return Vn[t];
2942
+ function Be(t) {
2943
+ return Pe[t];
2937
2944
  }
2938
2945
 
2939
2946
  // visible for testing
2940
- function Qn(t) {
2941
- return Dn[t];
2947
+ function ze(t) {
2948
+ return Ve[t];
2942
2949
  }
2943
2950
 
2944
- function Wn(t) {
2951
+ function Ge(t) {
2945
2952
  return {
2946
2953
  fieldPath: t.canonicalString()
2947
2954
  };
2948
2955
  }
2949
2956
 
2950
- function Yn(t) {
2951
- const n = [];
2952
- return t.fields.forEach((t => n.push(t.canonicalString()))), {
2953
- fieldPaths: n
2957
+ function Qe(t) {
2958
+ const e = [];
2959
+ return t.fields.forEach((t => e.push(t.canonicalString()))), {
2960
+ fieldPaths: e
2954
2961
  };
2955
2962
  }
2956
2963
 
2957
- function Hn(t) {
2964
+ function We(t) {
2958
2965
  // Resource names have at least 4 components (project ID, database ID)
2959
2966
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
2960
2967
  }
@@ -2974,8 +2981,8 @@ function Hn(t) {
2974
2981
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2975
2982
  * See the License for the specific language governing permissions and
2976
2983
  * limitations under the License.
2977
- */ function Kn(t) {
2978
- return new Nn(t, /* useProto3Json= */ !0);
2984
+ */ function Ye(t) {
2985
+ return new De(t, /* useProto3Json= */ !0);
2979
2986
  }
2980
2987
 
2981
2988
  /**
@@ -3003,7 +3010,7 @@ function Hn(t) {
3003
3010
  * base delay. This prevents clients from accidentally synchronizing their
3004
3011
  * delays causing spikes of load to the backend.
3005
3012
  */
3006
- class Jn {
3013
+ class He {
3007
3014
  constructor(
3008
3015
  /**
3009
3016
  * The AsyncQueue to run backoff operations on.
@@ -3012,13 +3019,13 @@ class Jn {
3012
3019
  /**
3013
3020
  * The ID to use when scheduling backoff operations on the AsyncQueue.
3014
3021
  */
3015
- n,
3022
+ e,
3016
3023
  /**
3017
3024
  * The initial delay (used as the base delay on the first retry attempt).
3018
3025
  * Note that jitter will still be applied, so the actual delay could be as
3019
3026
  * little as 0.5*initialDelayMs.
3020
3027
  */
3021
- e = 1e3
3028
+ n = 1e3
3022
3029
  /**
3023
3030
  * The multiplier to use to determine the extended base delay after each
3024
3031
  * attempt.
@@ -3028,7 +3035,7 @@ class Jn {
3028
3035
  * Note that jitter will still be applied, so the actual delay could be as
3029
3036
  * much as 1.5*maxDelayMs.
3030
3037
  */ , s = 6e4) {
3031
- this.C = t, this.timerId = n, this.L = e, this.U = r, this.k = s, this.j = 0, this.M = null,
3038
+ this.C = t, this.timerId = e, this.L = n, this.U = r, this.k = s, this.j = 0, this.M = null,
3032
3039
  /** The last backoff attempt, as epoch milliseconds. */
3033
3040
  this.B = Date.now(), this.reset();
3034
3041
  }
@@ -3056,9 +3063,9 @@ class Jn {
3056
3063
  this.cancel();
3057
3064
  // First schedule using the current base (which may be 0 and should be
3058
3065
  // honored as such).
3059
- const n = Math.floor(this.j + this.Y()), e = Math.max(0, Date.now() - this.B), r = Math.max(0, n - e);
3066
+ const e = Math.floor(this.j + this.Y()), n = Math.max(0, Date.now() - this.B), r = Math.max(0, e - n);
3060
3067
  // Guard against lastAttemptTime being in the future due to a clock change.
3061
- r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.j} ms, delay with jitter: ${n} ms, last attempt: ${e} ms ago)`),
3068
+ r > 0 && m("ExponentialBackoff", `Backing off for ${r} ms (base delay: ${this.j} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),
3062
3069
  this.M = this.C.enqueueAfterDelay(this.timerId, r, (() => (this.B = Date.now(),
3063
3070
  t()))),
3064
3071
  // Apply backoff factor to determine next delay and ensure it is within
@@ -3101,22 +3108,22 @@ class Jn {
3101
3108
  * An implementation of Datastore that exposes additional state for internal
3102
3109
  * consumption.
3103
3110
  */
3104
- class Xn extends class {} {
3105
- constructor(t, n, e, r) {
3106
- super(), this.authCredentials = t, this.appCheckCredentials = n, this.K = e, this.q = r,
3111
+ class Ke extends class {} {
3112
+ constructor(t, e, n, r) {
3113
+ super(), this.authCredentials = t, this.appCheckCredentials = e, this.K = n, this.q = r,
3107
3114
  this.J = !1;
3108
3115
  }
3109
3116
  X() {
3110
3117
  if (this.J) throw new U(S, "The client has already been terminated.");
3111
3118
  }
3112
- /** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, n, e) {
3113
- return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, n, e, r, s))).catch((t => {
3119
+ /** Invokes the provided RPC with auth and AppCheck tokens. */ m(t, e, n) {
3120
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.m(t, e, n, r, s))).catch((t => {
3114
3121
  throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
3115
3122
  this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
3116
3123
  }));
3117
3124
  }
3118
- /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, n, e) {
3119
- return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, n, e, r, s))).catch((t => {
3125
+ /** Invokes the provided RPC with streamed results with auth and AppCheck tokens. */ T(t, e, n) {
3126
+ return this.X(), Promise.all([ this.authCredentials.getToken(), this.appCheckCredentials.getToken() ]).then((([r, s]) => this.K.T(t, e, n, r, s))).catch((t => {
3120
3127
  throw "FirebaseError" === t.name ? (t.code === N && (this.authCredentials.invalidateToken(),
3121
3128
  this.appCheckCredentials.invalidateToken()), t) : new U(I, t.toString());
3122
3129
  }));
@@ -3128,40 +3135,40 @@ class Xn extends class {} {
3128
3135
 
3129
3136
  // TODO(firestorexp): Make sure there is only one Datastore instance per
3130
3137
  // firestore-exp client.
3131
- async function Zn(t, n) {
3132
- const e = b(t), r = Un(e.q) + "/documents", s = {
3133
- writes: n.map((t => Mn(e.q, t)))
3138
+ async function Je(t, e) {
3139
+ const n = b(t), r = Le(n.q) + "/documents", s = {
3140
+ writes: e.map((t => je(n.q, t)))
3134
3141
  };
3135
- await e.m("Commit", r, s);
3142
+ await n.m("Commit", r, s);
3136
3143
  }
3137
3144
 
3138
- async function te(t, n) {
3139
- const e = b(t), r = Un(e.q) + "/documents", s = {
3140
- documents: n.map((t => On(e.q, t)))
3141
- }, i = await e.T("BatchGetDocuments", r, s), o = new Map;
3145
+ async function Xe(t, e) {
3146
+ const n = b(t), r = Le(n.q) + "/documents", s = {
3147
+ documents: e.map((t => qe(n.q, t)))
3148
+ }, i = await n.T("BatchGetDocuments", r, s), o = new Map;
3142
3149
  i.forEach((t => {
3143
- const n = jn(e.q, t);
3144
- o.set(n.key.toString(), n);
3150
+ const e = ke(n.q, t);
3151
+ o.set(e.key.toString(), e);
3145
3152
  }));
3146
3153
  const u = [];
3147
- return n.forEach((t => {
3148
- const n = o.get(t.toString());
3149
- v(!!n), u.push(n);
3154
+ return e.forEach((t => {
3155
+ const e = o.get(t.toString());
3156
+ v(!!e), u.push(e);
3150
3157
  })), u;
3151
3158
  }
3152
3159
 
3153
- async function ne(t, n) {
3154
- const e = b(t), r = Bn(e.q, dn(n));
3155
- return (await e.T("RunQuery", r.parent, {
3160
+ async function Ze(t, e) {
3161
+ const n = b(t), r = Me(n.q, fe(e));
3162
+ return (await n.T("RunQuery", r.parent, {
3156
3163
  structuredQuery: r.structuredQuery
3157
- })).filter((t => !!t.document)).map((t => function(t, n, e) {
3158
- const r = Cn(t, n.name), s = xn(n.updateTime), i = new Bt({
3164
+ })).filter((t => !!t.document)).map((t => function(t, e, n) {
3165
+ const r = Oe(t, e.name), s = Fe(e.updateTime), i = new Bt({
3159
3166
  mapValue: {
3160
- fields: n.fields
3167
+ fields: e.fields
3161
3168
  }
3162
3169
  }), o = zt.newFoundDocument(r, s, i);
3163
- return e && o.setHasCommittedMutations(), e ? o.setHasCommittedMutations() : o;
3164
- }(e.q, t.document, void 0)));
3170
+ return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
3171
+ }(n.q, t.document, void 0)));
3165
3172
  }
3166
3173
 
3167
3174
  /**
@@ -3179,7 +3186,7 @@ async function ne(t, n) {
3179
3186
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3180
3187
  * See the License for the specific language governing permissions and
3181
3188
  * limitations under the License.
3182
- */ const ee = new Map;
3189
+ */ const tn = new Map;
3183
3190
 
3184
3191
  /**
3185
3192
  * An instance map that ensures only one Datastore exists per Firestore
@@ -3190,19 +3197,19 @@ async function ne(t, n) {
3190
3197
  * instance. Callers must invoke removeComponents() when the Firestore
3191
3198
  * instance is terminated.
3192
3199
  */
3193
- function re(t) {
3200
+ function en(t) {
3194
3201
  if (t._terminated) throw new U(S, "The client has already been terminated.");
3195
- if (!ee.has(t)) {
3202
+ if (!tn.has(t)) {
3196
3203
  m("ComponentProvider", "Initializing Datastore");
3197
3204
  const i = function(t) {
3198
3205
  return new wt(t, fetch.bind(null));
3199
- }((n = t._databaseId, e = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3200
- new H(n, e, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Kn(t._databaseId), u = function(t, n, e, r) {
3201
- return new Xn(t, n, e, r);
3206
+ }((e = t._databaseId, n = t.app.options.appId || "", r = t._persistenceKey, s = t._freezeSettings(),
3207
+ new H(e, n, r, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams))), o = Ye(t._databaseId), u = function(t, e, n, r) {
3208
+ return new Ke(t, e, n, r);
3202
3209
  }(t._authCredentials, t._appCheckCredentials, i, o);
3203
- ee.set(t, u);
3210
+ tn.set(t, u);
3204
3211
  }
3205
- var n, e, r, s;
3212
+ var e, n, r, s;
3206
3213
  /**
3207
3214
  * @license
3208
3215
  * Copyright 2018 Google LLC
@@ -3218,7 +3225,7 @@ function re(t) {
3218
3225
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3219
3226
  * See the License for the specific language governing permissions and
3220
3227
  * limitations under the License.
3221
- */ return ee.get(t);
3228
+ */ return tn.get(t);
3222
3229
  }
3223
3230
 
3224
3231
  /**
@@ -3230,21 +3237,21 @@ function re(t) {
3230
3237
  * user-supplied `FirestoreSettings` object. This is a separate type so that
3231
3238
  * defaults can be supplied and the value can be checked for equality.
3232
3239
  */
3233
- class se {
3240
+ class nn {
3234
3241
  constructor(t) {
3235
- var n;
3242
+ var e;
3236
3243
  if (void 0 === t.host) {
3237
3244
  if (void 0 !== t.ssl) throw new U(A, "Can't provide ssl option if host option is not set");
3238
3245
  this.host = "firestore.googleapis.com", this.ssl = true;
3239
- } else this.host = t.host, this.ssl = null === (n = t.ssl) || void 0 === n || n;
3246
+ } else this.host = t.host, this.ssl = null === (e = t.ssl) || void 0 === e || e;
3240
3247
  if (this.credentials = t.credentials, this.ignoreUndefinedProperties = !!t.ignoreUndefinedProperties,
3241
3248
  void 0 === t.cacheSizeBytes) this.cacheSizeBytes = 41943040; else {
3242
3249
  if (-1 !== t.cacheSizeBytes && t.cacheSizeBytes < 1048576) throw new U(A, "cacheSizeBytes must be at least 1048576");
3243
3250
  this.cacheSizeBytes = t.cacheSizeBytes;
3244
3251
  }
3245
3252
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
3246
- this.useFetchStreams = !!t.useFetchStreams, function(t, n, e, r) {
3247
- if (!0 === n && !0 === r) throw new U(A, `${t} and ${e} cannot be used together.`);
3253
+ this.useFetchStreams = !!t.useFetchStreams, function(t, e, n, r) {
3254
+ if (!0 === e && !0 === r) throw new U(A, `${t} and ${n} cannot be used together.`);
3248
3255
  }("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
3249
3256
  }
3250
3257
  isEqual(t) {
@@ -3272,14 +3279,14 @@ class se {
3272
3279
  * The Cloud Firestore service interface.
3273
3280
  *
3274
3281
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
3275
- */ class ie {
3282
+ */ class rn {
3276
3283
  /** @hideconstructor */
3277
- constructor(t, n, e) {
3278
- this._authCredentials = n, this._appCheckCredentials = e,
3284
+ constructor(t, e, n) {
3285
+ this._authCredentials = e, this._appCheckCredentials = n,
3279
3286
  /**
3280
3287
  * Whether it's a Firestore or Firestore Lite instance.
3281
3288
  */
3282
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new se({}),
3289
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new nn({}),
3283
3290
  this._settingsFrozen = !1, t instanceof K ? this._databaseId = t : (this._app = t,
3284
3291
  this._databaseId = function(t) {
3285
3292
  if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new U(A, '"projectId" not provided in firebase.initializeApp.');
@@ -3312,14 +3319,14 @@ class se {
3312
3319
  }
3313
3320
  _setSettings(t) {
3314
3321
  if (this._settingsFrozen) throw new U(S, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
3315
- this._settings = new se(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3322
+ this._settings = new nn(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
3316
3323
  if (!t) return new M;
3317
3324
  switch (t.type) {
3318
3325
  case "gapi":
3319
- const n = t.client;
3326
+ const e = t.client;
3320
3327
  // Make sure this really is a Gapi client.
3321
- return v(!("object" != typeof n || null === n || !n.auth || !n.auth.getAuthHeaderValueForFirstParty)),
3322
- new Q(n, t.sessionIndex || "0", t.iamToken || null);
3328
+ return v(!("object" != typeof e || null === e || !e.auth || !e.auth.getAuthHeaderValueForFirstParty)),
3329
+ new Q(e, t.sessionIndex || "0", t.iamToken || null);
3323
3330
 
3324
3331
  case "provider":
3325
3332
  return t.client;
@@ -3353,17 +3360,17 @@ class se {
3353
3360
  * Only ever called once.
3354
3361
  */ _terminate() {
3355
3362
  return function(t) {
3356
- const n = ee.get(t);
3357
- n && (m("ComponentProvider", "Removing Datastore"), ee.delete(t), n.terminate());
3363
+ const e = tn.get(t);
3364
+ e && (m("ComponentProvider", "Removing Datastore"), tn.delete(t), e.terminate());
3358
3365
  }(this), Promise.resolve();
3359
3366
  }
3360
3367
  }
3361
3368
 
3362
- function oe(t, n) {
3363
- const e = _getProvider(t, "firestore/lite");
3364
- if (e.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
3365
- return e.initialize({
3366
- options: n
3369
+ function sn(t, e) {
3370
+ const n = _getProvider(t, "firestore/lite");
3371
+ if (n.isInitialized()) throw new U(S, "Firestore can only be initialized once per app.");
3372
+ return n.initialize({
3373
+ options: e
3367
3374
  });
3368
3375
  }
3369
3376
 
@@ -3375,8 +3382,8 @@ function oe(t, n) {
3375
3382
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned `Firestore`
3376
3383
  * instance is associated with.
3377
3384
  * @returns The `Firestore` instance of the provided app.
3378
- */ function ue(n = getApp()) {
3379
- return _getProvider(n, "firestore/lite").getImmediate();
3385
+ */ function on(e = getApp()) {
3386
+ return _getProvider(e, "firestore/lite").getImmediate();
3380
3387
  }
3381
3388
 
3382
3389
  /**
@@ -3391,24 +3398,24 @@ function oe(t, n) {
3391
3398
  * @param port - the emulator port (ex: 9000).
3392
3399
  * @param options.mockUserToken - the mock auth token to use for unit testing
3393
3400
  * Security Rules.
3394
- */ function ce(t, n, e, r = {}) {
3401
+ */ function un(t, e, n, r = {}) {
3395
3402
  var s;
3396
- const i = (t = ot(t, ie))._getSettings();
3397
- if ("firestore.googleapis.com" !== i.host && i.host !== n && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3403
+ const i = (t = ot(t, rn))._getSettings();
3404
+ if ("firestore.googleapis.com" !== i.host && i.host !== e && y("Host has been set in both settings() and useEmulator(), emulator host will be used"),
3398
3405
  t._setSettings(Object.assign(Object.assign({}, i), {
3399
- host: `${n}:${e}`,
3406
+ host: `${e}:${n}`,
3400
3407
  ssl: !1
3401
3408
  })), r.mockUserToken) {
3402
- let n, e;
3403
- if ("string" == typeof r.mockUserToken) n = r.mockUserToken, e = l.MOCK_USER; else {
3409
+ let e, n;
3410
+ if ("string" == typeof r.mockUserToken) e = r.mockUserToken, n = l.MOCK_USER; else {
3404
3411
  // Let createMockUserToken validate first (catches common mistakes like
3405
3412
  // invalid field "uid" and missing field "sub" / "user_id".)
3406
- n = createMockUserToken(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3413
+ e = createMockUserToken(r.mockUserToken, null === (s = t._app) || void 0 === s ? void 0 : s.options.projectId);
3407
3414
  const i = r.mockUserToken.sub || r.mockUserToken.user_id;
3408
3415
  if (!i) throw new U(A, "mockUserToken must contain 'sub' or 'user_id' field!");
3409
- e = new l(i);
3416
+ n = new l(i);
3410
3417
  }
3411
- t._authCredentials = new B(new j(n, e));
3418
+ t._authCredentials = new B(new j(e, n));
3412
3419
  }
3413
3420
  }
3414
3421
 
@@ -3431,8 +3438,8 @@ function oe(t, n) {
3431
3438
  * @param firestore - The `Firestore` instance to terminate.
3432
3439
  * @returns A `Promise` that is resolved when the instance has been successfully
3433
3440
  * terminated.
3434
- */ function ae(t) {
3435
- return t = ot(t, ie), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
3441
+ */ function cn(t) {
3442
+ return t = ot(t, rn), _removeServiceInstance(t.app, "firestore/lite"), t._delete();
3436
3443
  }
3437
3444
 
3438
3445
  /**
@@ -3472,14 +3479,14 @@ function oe(t, n) {
3472
3479
  * and can be used to write, read, or listen to the location. The document at
3473
3480
  * the referenced location may or may not exist.
3474
3481
  */
3475
- class he {
3482
+ class an {
3476
3483
  /** @hideconstructor */
3477
3484
  constructor(t,
3478
3485
  /**
3479
3486
  * If provided, the `FirestoreDataConverter` associated with this instance.
3480
3487
  */
3481
- n, e) {
3482
- this.converter = n, this._key = e,
3488
+ e, n) {
3489
+ this.converter = e, this._key = n,
3483
3490
  /** The type of this Firestore reference. */
3484
3491
  this.type = "document", this.firestore = t;
3485
3492
  }
@@ -3500,40 +3507,40 @@ class he {
3500
3507
  /**
3501
3508
  * The collection this `DocumentReference` belongs to.
3502
3509
  */ get parent() {
3503
- return new fe(this.firestore, this.converter, this._key.path.popLast());
3510
+ return new ln(this.firestore, this.converter, this._key.path.popLast());
3504
3511
  }
3505
3512
  withConverter(t) {
3506
- return new he(this.firestore, t, this._key);
3513
+ return new an(this.firestore, t, this._key);
3507
3514
  }
3508
3515
  }
3509
3516
 
3510
3517
  /**
3511
3518
  * A `Query` refers to a query which you can read or listen to. You can also
3512
3519
  * construct refined `Query` objects by adding filters and ordering.
3513
- */ class le {
3520
+ */ class hn {
3514
3521
  // This is the lite version of the Query class in the main SDK.
3515
3522
  /** @hideconstructor protected */
3516
3523
  constructor(t,
3517
3524
  /**
3518
3525
  * If provided, the `FirestoreDataConverter` associated with this instance.
3519
3526
  */
3520
- n, e) {
3521
- this.converter = n, this._query = e,
3527
+ e, n) {
3528
+ this.converter = e, this._query = n,
3522
3529
  /** The type of this Firestore reference. */
3523
3530
  this.type = "query", this.firestore = t;
3524
3531
  }
3525
3532
  withConverter(t) {
3526
- return new le(this.firestore, t, this._query);
3533
+ return new hn(this.firestore, t, this._query);
3527
3534
  }
3528
3535
  }
3529
3536
 
3530
3537
  /**
3531
3538
  * A `CollectionReference` object can be used for adding documents, getting
3532
3539
  * document references, and querying for documents (using {@link query}).
3533
- */ class fe extends le {
3540
+ */ class ln extends hn {
3534
3541
  /** @hideconstructor */
3535
- constructor(t, n, e) {
3536
- super(t, n, new un(e)), this._path = e,
3542
+ constructor(t, e, n) {
3543
+ super(t, e, new oe(n)), this._path = n,
3537
3544
  /** The type of this Firestore reference. */
3538
3545
  this.type = "collection";
3539
3546
  }
@@ -3551,23 +3558,23 @@ class he {
3551
3558
  * subcollection. If this isn't a subcollection, the reference is null.
3552
3559
  */ get parent() {
3553
3560
  const t = this._path.popLast();
3554
- return t.isEmpty() ? null : new he(this.firestore,
3555
- /* converter= */ null, new nt(t));
3561
+ return t.isEmpty() ? null : new an(this.firestore,
3562
+ /* converter= */ null, new et(t));
3556
3563
  }
3557
3564
  withConverter(t) {
3558
- return new fe(this.firestore, t, this._path);
3565
+ return new ln(this.firestore, t, this._path);
3559
3566
  }
3560
3567
  }
3561
3568
 
3562
- function de(t, n, ...e) {
3563
- if (t = getModularInstance(t), et("collection", "path", n), t instanceof ie) {
3564
- const r = X.fromString(n, ...e);
3565
- return st(r), new fe(t, /* converter= */ null, r);
3569
+ function fn(t, e, ...n) {
3570
+ if (t = getModularInstance(t), nt("collection", "path", e), t instanceof rn) {
3571
+ const r = X.fromString(e, ...n);
3572
+ return st(r), new ln(t, /* converter= */ null, r);
3566
3573
  }
3567
3574
  {
3568
- if (!(t instanceof he || t instanceof fe)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3569
- const r = t._path.child(X.fromString(n, ...e));
3570
- return st(r), new fe(t.firestore,
3575
+ if (!(t instanceof an || t instanceof ln)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3576
+ const r = t._path.child(X.fromString(e, ...n));
3577
+ return st(r), new ln(t.firestore,
3571
3578
  /* converter= */ null, r);
3572
3579
  }
3573
3580
  }
@@ -3584,32 +3591,32 @@ function de(t, n, ...e) {
3584
3591
  * collection or subcollection with this ID as the last segment of its path
3585
3592
  * will be included. Cannot contain a slash.
3586
3593
  * @returns The created `Query`.
3587
- */ function we(t, n) {
3588
- if (t = ot(t, ie), et("collectionGroup", "collection id", n), n.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${n}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
3589
- return new le(t,
3594
+ */ function dn(t, e) {
3595
+ if (t = ot(t, rn), nt("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new U(A, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
3596
+ return new hn(t,
3590
3597
  /* converter= */ null,
3591
3598
  /**
3592
3599
  * Creates a new Query for a collection group query that matches all documents
3593
3600
  * within the provided collection group.
3594
3601
  */
3595
3602
  function(t) {
3596
- return new un(X.emptyPath(), t);
3597
- }(n));
3603
+ return new oe(X.emptyPath(), t);
3604
+ }(e));
3598
3605
  }
3599
3606
 
3600
- function me(t, n, ...e) {
3607
+ function wn(t, e, ...n) {
3601
3608
  if (t = getModularInstance(t),
3602
3609
  // We allow omission of 'pathString' but explicitly prohibit passing in both
3603
3610
  // 'undefined' and 'null'.
3604
- 1 === arguments.length && (n = pt.R()), et("doc", "path", n), t instanceof ie) {
3605
- const r = X.fromString(n, ...e);
3606
- return rt(r), new he(t,
3607
- /* converter= */ null, new nt(r));
3611
+ 1 === arguments.length && (e = pt.R()), nt("doc", "path", e), t instanceof rn) {
3612
+ const r = X.fromString(e, ...n);
3613
+ return rt(r), new an(t,
3614
+ /* converter= */ null, new et(r));
3608
3615
  }
3609
3616
  {
3610
- if (!(t instanceof he || t instanceof fe)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3611
- const r = t._path.child(X.fromString(n, ...e));
3612
- return rt(r), new he(t.firestore, t instanceof fe ? t.converter : null, new nt(r));
3617
+ if (!(t instanceof an || t instanceof ln)) throw new U(A, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
3618
+ const r = t._path.child(X.fromString(e, ...n));
3619
+ return rt(r), new an(t.firestore, t instanceof ln ? t.converter : null, new et(r));
3613
3620
  }
3614
3621
  }
3615
3622
 
@@ -3620,8 +3627,8 @@ function me(t, n, ...e) {
3620
3627
  * @param right - A reference to compare.
3621
3628
  * @returns true if the references point to the same location in the same
3622
3629
  * Firestore database.
3623
- */ function pe(t, n) {
3624
- return t = getModularInstance(t), n = getModularInstance(n), (t instanceof he || t instanceof fe) && (n instanceof he || n instanceof fe) && (t.firestore === n.firestore && t.path === n.path && t.converter === n.converter);
3630
+ */ function mn(t, e) {
3631
+ return t = getModularInstance(t), e = getModularInstance(e), (t instanceof an || t instanceof ln) && (e instanceof an || e instanceof ln) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
3625
3632
  }
3626
3633
 
3627
3634
  /**
@@ -3632,8 +3639,8 @@ function me(t, n, ...e) {
3632
3639
  * @param right - A `Query` to compare.
3633
3640
  * @returns true if the references point to the same location in the same
3634
3641
  * Firestore database.
3635
- */ function ye(t, n) {
3636
- return t = getModularInstance(t), n = getModularInstance(n), t instanceof le && n instanceof le && (t.firestore === n.firestore && wn(t._query, n._query) && t.converter === n.converter);
3642
+ */ function pn(t, e) {
3643
+ return t = getModularInstance(t), e = getModularInstance(e), t instanceof hn && e instanceof hn && (t.firestore === e.firestore && de(t._query, e._query) && t.converter === e.converter);
3637
3644
  }
3638
3645
 
3639
3646
  /**
@@ -3659,7 +3666,7 @@ function me(t, n, ...e) {
3659
3666
  *
3660
3667
  * Create a `FieldPath` by providing field names. If more than one field
3661
3668
  * name is provided, the path will point to a nested field in a document.
3662
- */ class _e {
3669
+ */ class yn {
3663
3670
  /**
3664
3671
  * Creates a `FieldPath` from the provided field names. If more than one field
3665
3672
  * name is provided, the path will point to a nested field in a document.
@@ -3667,7 +3674,7 @@ function me(t, n, ...e) {
3667
3674
  * @param fieldNames - A list of field names.
3668
3675
  */
3669
3676
  constructor(...t) {
3670
- for (let n = 0; n < t.length; ++n) if (0 === t[n].length) throw new U(A, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3677
+ for (let e = 0; e < t.length; ++e) if (0 === t[e].length) throw new U(A, "Invalid field name at argument $(i + 1). Field names must not be empty.");
3671
3678
  this._internalPath = new tt(t);
3672
3679
  }
3673
3680
  /**
@@ -3683,8 +3690,8 @@ function me(t, n, ...e) {
3683
3690
  /**
3684
3691
  * Returns a special sentinel `FieldPath` to refer to the ID of a document.
3685
3692
  * It can be used in queries to sort or filter by the document ID.
3686
- */ function ge() {
3687
- return new _e("__name__");
3693
+ */ function _n() {
3694
+ return new yn("__name__");
3688
3695
  }
3689
3696
 
3690
3697
  /**
@@ -3705,7 +3712,7 @@ function me(t, n, ...e) {
3705
3712
  */
3706
3713
  /**
3707
3714
  * An immutable object representing an array of bytes.
3708
- */ class ve {
3715
+ */ class gn {
3709
3716
  /** @hideconstructor */
3710
3717
  constructor(t) {
3711
3718
  this._byteString = t;
@@ -3717,7 +3724,7 @@ function me(t, n, ...e) {
3717
3724
  * @param base64 - The Base64 string used to create the `Bytes` object.
3718
3725
  */ static fromBase64String(t) {
3719
3726
  try {
3720
- return new ve(It.fromBase64String(t));
3727
+ return new gn(It.fromBase64String(t));
3721
3728
  } catch (t) {
3722
3729
  throw new U(A, "Failed to construct data from Base64 string: " + t);
3723
3730
  }
@@ -3727,7 +3734,7 @@ function me(t, n, ...e) {
3727
3734
  *
3728
3735
  * @param array - The Uint8Array used to create the `Bytes` object.
3729
3736
  */ static fromUint8Array(t) {
3730
- return new ve(It.fromUint8Array(t));
3737
+ return new gn(It.fromUint8Array(t));
3731
3738
  }
3732
3739
  /**
3733
3740
  * Returns the underlying bytes as a Base64-encoded string.
@@ -3779,7 +3786,7 @@ function me(t, n, ...e) {
3779
3786
  /**
3780
3787
  * Sentinel values that can be used when writing document fields with `set()`
3781
3788
  * or `update()`.
3782
- */ class be {
3789
+ */ class vn {
3783
3790
  /**
3784
3791
  * @param _methodName - The public API endpoint that returns this class.
3785
3792
  * @hideconstructor
@@ -3811,17 +3818,17 @@ function me(t, n, ...e) {
3811
3818
  *
3812
3819
  * Latitude values are in the range of [-90, 90].
3813
3820
  * Longitude values are in the range of [-180, 180].
3814
- */ class Ee {
3821
+ */ class bn {
3815
3822
  /**
3816
3823
  * Creates a new immutable `GeoPoint` object with the provided latitude and
3817
3824
  * longitude values.
3818
3825
  * @param latitude - The latitude as number between -90 and 90.
3819
3826
  * @param longitude - The longitude as number between -180 and 180.
3820
3827
  */
3821
- constructor(t, n) {
3828
+ constructor(t, e) {
3822
3829
  if (!isFinite(t) || t < -90 || t > 90) throw new U(A, "Latitude must be a number between -90 and 90, but was: " + t);
3823
- if (!isFinite(n) || n < -180 || n > 180) throw new U(A, "Longitude must be a number between -180 and 180, but was: " + n);
3824
- this._lat = t, this._long = n;
3830
+ if (!isFinite(e) || e < -180 || e > 180) throw new U(A, "Longitude must be a number between -180 and 180, but was: " + e);
3831
+ this._lat = t, this._long = e;
3825
3832
  }
3826
3833
  /**
3827
3834
  * The latitude of this `GeoPoint` instance.
@@ -3870,29 +3877,29 @@ function me(t, n, ...e) {
3870
3877
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3871
3878
  * See the License for the specific language governing permissions and
3872
3879
  * limitations under the License.
3873
- */ const Te = /^__.*__$/;
3880
+ */ const En = /^__.*__$/;
3874
3881
 
3875
- /** The result of parsing document data (e.g. for a setData call). */ class Ie {
3876
- constructor(t, n, e) {
3877
- this.data = t, this.fieldMask = n, this.fieldTransforms = e;
3882
+ /** The result of parsing document data (e.g. for a setData call). */ class Tn {
3883
+ constructor(t, e, n) {
3884
+ this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3878
3885
  }
3879
- toMutation(t, n) {
3880
- return null !== this.fieldMask ? new An(t, this.data, this.fieldMask, n, this.fieldTransforms) : new In(t, this.data, n, this.fieldTransforms);
3886
+ toMutation(t, e) {
3887
+ return null !== this.fieldMask ? new Ie(t, this.data, this.fieldMask, e, this.fieldTransforms) : new Te(t, this.data, e, this.fieldTransforms);
3881
3888
  }
3882
3889
  }
3883
3890
 
3884
- /** The result of parsing "update" data (i.e. for an updateData call). */ class Ae {
3891
+ /** The result of parsing "update" data (i.e. for an updateData call). */ class In {
3885
3892
  constructor(t,
3886
3893
  // The fieldMask does not include document transforms.
3887
- n, e) {
3888
- this.data = t, this.fieldMask = n, this.fieldTransforms = e;
3894
+ e, n) {
3895
+ this.data = t, this.fieldMask = e, this.fieldTransforms = n;
3889
3896
  }
3890
- toMutation(t, n) {
3891
- return new An(t, this.data, this.fieldMask, n, this.fieldTransforms);
3897
+ toMutation(t, e) {
3898
+ return new Ie(t, this.data, this.fieldMask, e, this.fieldTransforms);
3892
3899
  }
3893
3900
  }
3894
3901
 
3895
- function Re(t) {
3902
+ function An(t) {
3896
3903
  switch (t) {
3897
3904
  case 0 /* Set */ :
3898
3905
  // fall through
@@ -3910,7 +3917,7 @@ function Re(t) {
3910
3917
  }
3911
3918
  }
3912
3919
 
3913
- /** A "context" object passed around while parsing user data. */ class Pe {
3920
+ /** A "context" object passed around while parsing user data. */ class Rn {
3914
3921
  /**
3915
3922
  * Initializes a ParseContext with the given source and path.
3916
3923
  *
@@ -3929,8 +3936,8 @@ function Re(t) {
3929
3936
  * which case certain features will not work and errors will be somewhat
3930
3937
  * compromised).
3931
3938
  */
3932
- constructor(t, n, e, r, s, i) {
3933
- this.settings = t, this.databaseId = n, this.q = e, this.ignoreUndefinedProperties = r,
3939
+ constructor(t, e, n, r, s, i) {
3940
+ this.settings = t, this.databaseId = e, this.q = n, this.ignoreUndefinedProperties = r,
3934
3941
  // Minor hack: If fieldTransforms is undefined, we assume this is an
3935
3942
  // external call and we need to validate the entire path.
3936
3943
  void 0 === s && this.Z(), this.fieldTransforms = s || [], this.fieldMask = i || [];
@@ -3941,21 +3948,21 @@ function Re(t) {
3941
3948
  get tt() {
3942
3949
  return this.settings.tt;
3943
3950
  }
3944
- /** Returns a new context with the specified settings overwritten. */ nt(t) {
3945
- return new Pe(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3951
+ /** Returns a new context with the specified settings overwritten. */ et(t) {
3952
+ return new Rn(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.q, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
3946
3953
  }
3947
- et(t) {
3948
- var n;
3949
- const e = null === (n = this.path) || void 0 === n ? void 0 : n.child(t), r = this.nt({
3950
- path: e,
3954
+ nt(t) {
3955
+ var e;
3956
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.et({
3957
+ path: n,
3951
3958
  rt: !1
3952
3959
  });
3953
3960
  return r.st(t), r;
3954
3961
  }
3955
3962
  it(t) {
3956
- var n;
3957
- const e = null === (n = this.path) || void 0 === n ? void 0 : n.child(t), r = this.nt({
3958
- path: e,
3963
+ var e;
3964
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), r = this.et({
3965
+ path: n,
3959
3966
  rt: !1
3960
3967
  });
3961
3968
  return r.Z(), r;
@@ -3963,16 +3970,16 @@ function Re(t) {
3963
3970
  ot(t) {
3964
3971
  // TODO(b/34871131): We don't support array paths right now; so make path
3965
3972
  // undefined.
3966
- return this.nt({
3973
+ return this.et({
3967
3974
  path: void 0,
3968
3975
  rt: !0
3969
3976
  });
3970
3977
  }
3971
3978
  ut(t) {
3972
- return We(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
3979
+ return Qn(t, this.settings.methodName, this.settings.ct || !1, this.path, this.settings.at);
3973
3980
  }
3974
3981
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
3975
- return void 0 !== this.fieldMask.find((n => t.isPrefixOf(n))) || void 0 !== this.fieldTransforms.find((n => t.isPrefixOf(n.field)));
3982
+ return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
3976
3983
  }
3977
3984
  Z() {
3978
3985
  // TODO(b/34871131): Remove null check once we have proper paths for fields
@@ -3981,22 +3988,22 @@ function Re(t) {
3981
3988
  }
3982
3989
  st(t) {
3983
3990
  if (0 === t.length) throw this.ut("Document fields must not be empty");
3984
- if (Re(this.tt) && Te.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
3991
+ if (An(this.tt) && En.test(t)) throw this.ut('Document fields cannot begin and end with "__"');
3985
3992
  }
3986
3993
  }
3987
3994
 
3988
3995
  /**
3989
3996
  * Helper for parsing raw user input (provided via the API) into internal model
3990
3997
  * classes.
3991
- */ class Ve {
3992
- constructor(t, n, e) {
3993
- this.databaseId = t, this.ignoreUndefinedProperties = n, this.q = e || Kn(t);
3998
+ */ class Pn {
3999
+ constructor(t, e, n) {
4000
+ this.databaseId = t, this.ignoreUndefinedProperties = e, this.q = n || Ye(t);
3994
4001
  }
3995
- /** Creates a new top-level parse context. */ ht(t, n, e, r = !1) {
3996
- return new Pe({
4002
+ /** Creates a new top-level parse context. */ ht(t, e, n, r = !1) {
4003
+ return new Rn({
3997
4004
  tt: t,
3998
- methodName: n,
3999
- at: e,
4005
+ methodName: e,
4006
+ at: n,
4000
4007
  path: tt.emptyPath(),
4001
4008
  rt: !1,
4002
4009
  ct: r
@@ -4004,29 +4011,29 @@ function Re(t) {
4004
4011
  }
4005
4012
  }
4006
4013
 
4007
- function De(t) {
4008
- const n = t._freezeSettings(), e = Kn(t._databaseId);
4009
- return new Ve(t._databaseId, !!n.ignoreUndefinedProperties, e);
4014
+ function Vn(t) {
4015
+ const e = t._freezeSettings(), n = Ye(t._databaseId);
4016
+ return new Pn(t._databaseId, !!e.ignoreUndefinedProperties, n);
4010
4017
  }
4011
4018
 
4012
- /** Parse document data from a set() call. */ function Ne(t, n, e, r, s, i = {}) {
4013
- const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , n, e, s);
4014
- Be("Data must be an object, but it was:", o, r);
4015
- const u = je(r, o);
4019
+ /** Parse document data from a set() call. */ function Dn(t, e, n, r, s, i = {}) {
4020
+ const o = t.ht(i.merge || i.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, s);
4021
+ Mn("Data must be an object, but it was:", o, r);
4022
+ const u = kn(r, o);
4016
4023
  let c, a;
4017
4024
  if (i.merge) c = new Tt(o.fieldMask), a = o.fieldTransforms; else if (i.mergeFields) {
4018
4025
  const t = [];
4019
4026
  for (const r of i.mergeFields) {
4020
- const s = ze(n, r, e);
4027
+ const s = Bn(e, r, n);
4021
4028
  if (!o.contains(s)) throw new U(A, `Field '${s}' is specified in your field mask but missing from your input data.`);
4022
- Ye(t, s) || t.push(s);
4029
+ Wn(t, s) || t.push(s);
4023
4030
  }
4024
4031
  c = new Tt(t), a = o.fieldTransforms.filter((t => c.covers(t.field)));
4025
4032
  } else c = null, a = o.fieldTransforms;
4026
- return new Ie(new Bt(u), c, a);
4033
+ return new Tn(new Bt(u), c, a);
4027
4034
  }
4028
4035
 
4029
- class $e extends be {
4036
+ class Nn extends vn {
4030
4037
  _toFieldTransform(t) {
4031
4038
  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}`);
4032
4039
  // No transform to add for a delete, but we need to add it to our
@@ -4034,7 +4041,7 @@ class $e extends be {
4034
4041
  return t.fieldMask.push(t.path), null;
4035
4042
  }
4036
4043
  isEqual(t) {
4037
- return t instanceof $e;
4044
+ return t instanceof Nn;
4038
4045
  }
4039
4046
  }
4040
4047
 
@@ -4053,32 +4060,32 @@ class $e extends be {
4053
4060
  * context.
4054
4061
  * @param context - The parent context.
4055
4062
  * @param arrayElement - Whether or not the FieldValue has an array.
4056
- */ function Se(t, n, e) {
4057
- return new Pe({
4063
+ */ function $n(t, e, n) {
4064
+ return new Rn({
4058
4065
  tt: 3 /* Argument */ ,
4059
- at: n.settings.at,
4066
+ at: e.settings.at,
4060
4067
  methodName: t._methodName,
4061
- rt: e
4062
- }, n.databaseId, n.q, n.ignoreUndefinedProperties);
4068
+ rt: n
4069
+ }, e.databaseId, e.q, e.ignoreUndefinedProperties);
4063
4070
  }
4064
4071
 
4065
- class Fe extends be {
4072
+ class Sn extends vn {
4066
4073
  _toFieldTransform(t) {
4067
- return new bn(t.path, new yn);
4074
+ return new ve(t.path, new pe);
4068
4075
  }
4069
4076
  isEqual(t) {
4070
- return t instanceof Fe;
4077
+ return t instanceof Sn;
4071
4078
  }
4072
4079
  }
4073
4080
 
4074
- class xe extends be {
4075
- constructor(t, n) {
4076
- super(t), this.lt = n;
4081
+ class Fn extends vn {
4082
+ constructor(t, e) {
4083
+ super(t), this.lt = e;
4077
4084
  }
4078
4085
  _toFieldTransform(t) {
4079
- const n = Se(this, t,
4080
- /*array=*/ !0), e = this.lt.map((t => ke(t, n))), r = new _n(e);
4081
- return new bn(t.path, r);
4086
+ const e = $n(this, t,
4087
+ /*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new ye(n);
4088
+ return new ve(t.path, r);
4082
4089
  }
4083
4090
  isEqual(t) {
4084
4091
  // TODO(mrschmidt): Implement isEquals
@@ -4086,14 +4093,14 @@ class xe extends be {
4086
4093
  }
4087
4094
  }
4088
4095
 
4089
- class qe extends be {
4090
- constructor(t, n) {
4091
- super(t), this.lt = n;
4096
+ class xn extends vn {
4097
+ constructor(t, e) {
4098
+ super(t), this.lt = e;
4092
4099
  }
4093
4100
  _toFieldTransform(t) {
4094
- const n = Se(this, t,
4095
- /*array=*/ !0), e = this.lt.map((t => ke(t, n))), r = new gn(e);
4096
- return new bn(t.path, r);
4101
+ const e = $n(this, t,
4102
+ /*array=*/ !0), n = this.lt.map((t => Un(t, e))), r = new _e(n);
4103
+ return new ve(t.path, r);
4097
4104
  }
4098
4105
  isEqual(t) {
4099
4106
  // TODO(mrschmidt): Implement isEquals
@@ -4101,13 +4108,13 @@ class qe extends be {
4101
4108
  }
4102
4109
  }
4103
4110
 
4104
- class Oe extends be {
4105
- constructor(t, n) {
4106
- super(t), this.ft = n;
4111
+ class qn extends vn {
4112
+ constructor(t, e) {
4113
+ super(t), this.ft = e;
4107
4114
  }
4108
4115
  _toFieldTransform(t) {
4109
- const n = new vn(t.q, mn(t.q, this.ft));
4110
- return new bn(t.path, n);
4116
+ const e = new ge(t.q, we(t.q, this.ft));
4117
+ return new ve(t.path, e);
4111
4118
  }
4112
4119
  isEqual(t) {
4113
4120
  // TODO(mrschmidt): Implement isEquals
@@ -4115,50 +4122,50 @@ class Oe extends be {
4115
4122
  }
4116
4123
  }
4117
4124
 
4118
- /** Parse update data from an update() call. */ function Ce(t, n, e, r) {
4119
- const s = t.ht(1 /* Update */ , n, e);
4120
- Be("Data must be an object, but it was:", s, r);
4125
+ /** Parse update data from an update() call. */ function On(t, e, n, r) {
4126
+ const s = t.ht(1 /* Update */ , e, n);
4127
+ Mn("Data must be an object, but it was:", s, r);
4121
4128
  const i = [], o = Bt.empty();
4122
4129
  Et(r, ((t, r) => {
4123
- const u = Qe(n, t, e);
4130
+ const u = Gn(e, t, n);
4124
4131
  // For Compat types, we have to "extract" the underlying types before
4125
4132
  // performing validation.
4126
4133
  r = getModularInstance(r);
4127
4134
  const c = s.it(u);
4128
- if (r instanceof $e)
4135
+ if (r instanceof Nn)
4129
4136
  // Add it to the field mask, but don't add anything to updateData.
4130
4137
  i.push(u); else {
4131
- const t = ke(r, c);
4138
+ const t = Un(r, c);
4132
4139
  null != t && (i.push(u), o.set(u, t));
4133
4140
  }
4134
4141
  }));
4135
4142
  const u = new Tt(i);
4136
- return new Ae(o, u, s.fieldTransforms);
4143
+ return new In(o, u, s.fieldTransforms);
4137
4144
  }
4138
4145
 
4139
- /** Parse update data from a list of field/value arguments. */ function Le(t, n, e, r, s, i) {
4140
- const o = t.ht(1 /* Update */ , n, e), u = [ ze(n, r, e) ], c = [ s ];
4141
- if (i.length % 2 != 0) throw new U(A, `Function ${n}() needs to be called with an even number of arguments that alternate between field names and values.`);
4142
- for (let t = 0; t < i.length; t += 2) u.push(ze(n, i[t])), c.push(i[t + 1]);
4146
+ /** Parse update data from a list of field/value arguments. */ function Cn(t, e, n, r, s, i) {
4147
+ const o = t.ht(1 /* Update */ , e, n), u = [ Bn(e, r, n) ], c = [ s ];
4148
+ if (i.length % 2 != 0) throw new U(A, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
4149
+ for (let t = 0; t < i.length; t += 2) u.push(Bn(e, i[t])), c.push(i[t + 1]);
4143
4150
  const a = [], l = Bt.empty();
4144
4151
  // We iterate in reverse order to pick the last value for a field if the
4145
4152
  // user specified the field multiple times.
4146
- for (let t = u.length - 1; t >= 0; --t) if (!Ye(a, u[t])) {
4147
- const n = u[t];
4148
- let e = c[t];
4153
+ for (let t = u.length - 1; t >= 0; --t) if (!Wn(a, u[t])) {
4154
+ const e = u[t];
4155
+ let n = c[t];
4149
4156
  // For Compat types, we have to "extract" the underlying types before
4150
4157
  // performing validation.
4151
- e = getModularInstance(e);
4152
- const r = o.it(n);
4153
- if (e instanceof $e)
4158
+ n = getModularInstance(n);
4159
+ const r = o.it(e);
4160
+ if (n instanceof Nn)
4154
4161
  // Add it to the field mask, but don't add anything to updateData.
4155
- a.push(n); else {
4156
- const t = ke(e, r);
4157
- null != t && (a.push(n), l.set(n, t));
4162
+ a.push(e); else {
4163
+ const t = Un(n, r);
4164
+ null != t && (a.push(e), l.set(e, t));
4158
4165
  }
4159
4166
  }
4160
4167
  const f = new Tt(a);
4161
- return new Ae(l, f, o.fieldTransforms);
4168
+ return new In(l, f, o.fieldTransforms);
4162
4169
  }
4163
4170
 
4164
4171
  /**
@@ -4167,8 +4174,8 @@ class Oe extends be {
4167
4174
  *
4168
4175
  * @param allowArrays - Whether the query value is an array that may directly
4169
4176
  * contain additional arrays (e.g. the operand of an `in` query).
4170
- */ function Ue(t, n, e, r = !1) {
4171
- return ke(e, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , n));
4177
+ */ function Ln(t, e, n, r = !1) {
4178
+ return Un(n, t.ht(r ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
4172
4179
  }
4173
4180
 
4174
4181
  /**
@@ -4179,12 +4186,12 @@ class Oe extends be {
4179
4186
  * the source of the data being parsed, etc.
4180
4187
  * @returns The parsed value, or null if the value was a FieldValue sentinel
4181
4188
  * that should not be included in the resulting parsed data.
4182
- */ function ke(t, n) {
4183
- if (Me(
4189
+ */ function Un(t, e) {
4190
+ if (jn(
4184
4191
  // Unwrap the API type from the Compat SDK. This will return the API type
4185
4192
  // from firestore-exp.
4186
- t = getModularInstance(t))) return Be("Unsupported field value:", n, t), je(t, n);
4187
- if (t instanceof be)
4193
+ t = getModularInstance(t))) return Mn("Unsupported field value:", e, t), kn(t, e);
4194
+ if (t instanceof vn)
4188
4195
  // FieldValues usually parse into transforms (except deleteField())
4189
4196
  // in which case we do not want to include this field in our parsed data
4190
4197
  // (as doing so will overwrite the field directly prior to the transform
@@ -4194,19 +4201,19 @@ class Oe extends be {
4194
4201
  * "Parses" the provided FieldValueImpl, adding any necessary transforms to
4195
4202
  * context.fieldTransforms.
4196
4203
  */
4197
- return function(t, n) {
4204
+ return function(t, e) {
4198
4205
  // Sentinels are only supported with writes, and not within arrays.
4199
- if (!Re(n.tt)) throw n.ut(`${t._methodName}() can only be used with update() and set()`);
4200
- if (!n.path) throw n.ut(`${t._methodName}() is not currently supported inside arrays`);
4201
- const e = t._toFieldTransform(n);
4202
- e && n.fieldTransforms.push(e);
4206
+ if (!An(e.tt)) throw e.ut(`${t._methodName}() can only be used with update() and set()`);
4207
+ if (!e.path) throw e.ut(`${t._methodName}() is not currently supported inside arrays`);
4208
+ const n = t._toFieldTransform(e);
4209
+ n && e.fieldTransforms.push(n);
4203
4210
  }
4204
4211
  /**
4205
4212
  * Helper to parse a scalar value (i.e. not an Object, Array, or FieldValue)
4206
4213
  *
4207
4214
  * @returns The parsed value
4208
- */ (t, n), null;
4209
- if (void 0 === t && n.ignoreUndefinedProperties)
4215
+ */ (t, e), null;
4216
+ if (void 0 === t && e.ignoreUndefinedProperties)
4210
4217
  // If the input is undefined it can never participate in the fieldMask, so
4211
4218
  // don't handle this below. If `ignoreUndefinedProperties` is false,
4212
4219
  // `parseScalarValue` will reject an undefined value.
@@ -4214,38 +4221,38 @@ class Oe extends be {
4214
4221
  if (
4215
4222
  // If context.path is null we are inside an array and we don't support
4216
4223
  // field mask paths more granular than the top-level array.
4217
- n.path && n.fieldMask.push(n.path), t instanceof Array) {
4224
+ e.path && e.fieldMask.push(e.path), t instanceof Array) {
4218
4225
  // TODO(b/34871131): Include the path containing the array in the error
4219
4226
  // message.
4220
4227
  // In the case of IN queries, the parsed data is an array (representing
4221
4228
  // the set of values to be included for the IN query) that may directly
4222
4229
  // contain additional arrays (each representing an individual field
4223
4230
  // value), so we disable this validation.
4224
- if (n.settings.rt && 4 /* ArrayArgument */ !== n.tt) throw n.ut("Nested arrays are not supported");
4225
- return function(t, n) {
4226
- const e = [];
4231
+ if (e.settings.rt && 4 /* ArrayArgument */ !== e.tt) throw e.ut("Nested arrays are not supported");
4232
+ return function(t, e) {
4233
+ const n = [];
4227
4234
  let r = 0;
4228
4235
  for (const s of t) {
4229
- let t = ke(s, n.ot(r));
4236
+ let t = Un(s, e.ot(r));
4230
4237
  null == t && (
4231
4238
  // Just include nulls in the array for fields being replaced with a
4232
4239
  // sentinel.
4233
4240
  t = {
4234
4241
  nullValue: "NULL_VALUE"
4235
- }), e.push(t), r++;
4242
+ }), n.push(t), r++;
4236
4243
  }
4237
4244
  return {
4238
4245
  arrayValue: {
4239
- values: e
4246
+ values: n
4240
4247
  }
4241
4248
  };
4242
- }(t, n);
4249
+ }(t, e);
4243
4250
  }
4244
- return function(t, n) {
4251
+ return function(t, e) {
4245
4252
  if (null === (t = getModularInstance(t))) return {
4246
4253
  nullValue: "NULL_VALUE"
4247
4254
  };
4248
- if ("number" == typeof t) return mn(n.q, t);
4255
+ if ("number" == typeof t) return we(e.q, t);
4249
4256
  if ("boolean" == typeof t) return {
4250
4257
  booleanValue: t
4251
4258
  };
@@ -4253,37 +4260,37 @@ class Oe extends be {
4253
4260
  stringValue: t
4254
4261
  };
4255
4262
  if (t instanceof Date) {
4256
- const e = gt.fromDate(t);
4263
+ const n = gt.fromDate(t);
4257
4264
  return {
4258
- timestampValue: $n(n.q, e)
4265
+ timestampValue: Ne(e.q, n)
4259
4266
  };
4260
4267
  }
4261
4268
  if (t instanceof gt) {
4262
4269
  // Firestore backend truncates precision down to microseconds. To ensure
4263
4270
  // offline mode works the same with regards to truncation, perform the
4264
4271
  // truncation immediately without waiting for the backend to do that.
4265
- const e = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4272
+ const n = new gt(t.seconds, 1e3 * Math.floor(t.nanoseconds / 1e3));
4266
4273
  return {
4267
- timestampValue: $n(n.q, e)
4274
+ timestampValue: Ne(e.q, n)
4268
4275
  };
4269
4276
  }
4270
- if (t instanceof Ee) return {
4277
+ if (t instanceof bn) return {
4271
4278
  geoPointValue: {
4272
4279
  latitude: t.latitude,
4273
4280
  longitude: t.longitude
4274
4281
  }
4275
4282
  };
4276
- if (t instanceof ve) return {
4277
- bytesValue: Sn(n.q, t._byteString)
4283
+ if (t instanceof gn) return {
4284
+ bytesValue: $e(e.q, t._byteString)
4278
4285
  };
4279
- if (t instanceof he) {
4280
- const e = n.databaseId, r = t.firestore._databaseId;
4281
- 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}`);
4286
+ if (t instanceof an) {
4287
+ const n = e.databaseId, r = t.firestore._databaseId;
4288
+ 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}`);
4282
4289
  return {
4283
- referenceValue: qn(t.firestore._databaseId || n.databaseId, t._key.path)
4290
+ referenceValue: xe(t.firestore._databaseId || e.databaseId, t._key.path)
4284
4291
  };
4285
4292
  }
4286
- throw n.ut(`Unsupported field value: ${it(t)}`);
4293
+ throw e.ut(`Unsupported field value: ${it(t)}`);
4287
4294
  }
4288
4295
  /**
4289
4296
  * Checks whether an object looks like a JSON object that should be converted
@@ -4291,56 +4298,56 @@ class Oe extends be {
4291
4298
  * JSON objects since they should be converted to a struct value. Arrays, Dates,
4292
4299
  * GeoPoints, etc. are not considered to look like JSON objects since they map
4293
4300
  * to specific FieldValue types other than ObjectValue.
4294
- */ (t, n);
4301
+ */ (t, e);
4295
4302
  }
4296
4303
 
4297
- function je(t, n) {
4298
- const e = {};
4304
+ function kn(t, e) {
4305
+ const n = {};
4299
4306
  return !function(t) {
4300
- for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n)) return !1;
4307
+ for (const e in t) if (Object.prototype.hasOwnProperty.call(t, e)) return !1;
4301
4308
  return !0;
4302
4309
  }(t) ? Et(t, ((t, r) => {
4303
- const s = ke(r, n.et(t));
4304
- null != s && (e[t] = s);
4310
+ const s = Un(r, e.nt(t));
4311
+ null != s && (n[t] = s);
4305
4312
  })) :
4306
4313
  // If we encounter an empty object, we explicitly add it to the update
4307
4314
  // mask to ensure that the server creates a map entry.
4308
- n.path && n.path.length > 0 && n.fieldMask.push(n.path), {
4315
+ e.path && e.path.length > 0 && e.fieldMask.push(e.path), {
4309
4316
  mapValue: {
4310
- fields: e
4317
+ fields: n
4311
4318
  }
4312
4319
  };
4313
4320
  }
4314
4321
 
4315
- function Me(t) {
4316
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof Ee || t instanceof ve || t instanceof he || t instanceof be);
4322
+ function jn(t) {
4323
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof gt || t instanceof bn || t instanceof gn || t instanceof an || t instanceof vn);
4317
4324
  }
4318
4325
 
4319
- function Be(t, n, e) {
4320
- if (!Me(e) || !function(t) {
4326
+ function Mn(t, e, n) {
4327
+ if (!jn(n) || !function(t) {
4321
4328
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
4322
- }(e)) {
4323
- const r = it(e);
4324
- throw "an object" === r ? n.ut(t + " a custom object") : n.ut(t + " " + r);
4329
+ }(n)) {
4330
+ const r = it(n);
4331
+ throw "an object" === r ? e.ut(t + " a custom object") : e.ut(t + " " + r);
4325
4332
  }
4326
4333
  }
4327
4334
 
4328
4335
  /**
4329
4336
  * Helper that calls fromDotSeparatedString() but wraps any error thrown.
4330
- */ function ze(t, n, e) {
4337
+ */ function Bn(t, e, n) {
4331
4338
  if ((
4332
4339
  // If required, replace the FieldPath Compat class with with the firestore-exp
4333
4340
  // FieldPath.
4334
- n = getModularInstance(n)) instanceof _e) return n._internalPath;
4335
- if ("string" == typeof n) return Qe(t, n);
4336
- throw We("Field path arguments must be of type string or ", t,
4341
+ e = getModularInstance(e)) instanceof yn) return e._internalPath;
4342
+ if ("string" == typeof e) return Gn(t, e);
4343
+ throw Qn("Field path arguments must be of type string or ", t,
4337
4344
  /* hasConverter= */ !1,
4338
- /* path= */ void 0, e);
4345
+ /* path= */ void 0, n);
4339
4346
  }
4340
4347
 
4341
4348
  /**
4342
4349
  * Matches any characters in a field path string that are reserved.
4343
- */ const Ge = new RegExp("[~\\*/\\[\\]]");
4350
+ */ const zn = new RegExp("[~\\*/\\[\\]]");
4344
4351
 
4345
4352
  /**
4346
4353
  * Wraps fromDotSeparatedString with an error message about the method that
@@ -4350,30 +4357,30 @@ function Be(t, n, e) {
4350
4357
  * split on dots.
4351
4358
  * @param targetDoc - The document against which the field path will be
4352
4359
  * evaluated.
4353
- */ function Qe(t, n, e) {
4354
- if (n.search(Ge) >= 0) throw We(`Invalid field path (${n}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4360
+ */ function Gn(t, e, n) {
4361
+ if (e.search(zn) >= 0) throw Qn(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`, t,
4355
4362
  /* hasConverter= */ !1,
4356
- /* path= */ void 0, e);
4363
+ /* path= */ void 0, n);
4357
4364
  try {
4358
- return new _e(...n.split("."))._internalPath;
4365
+ return new yn(...e.split("."))._internalPath;
4359
4366
  } catch (r) {
4360
- throw We(`Invalid field path (${n}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4367
+ throw Qn(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`, t,
4361
4368
  /* hasConverter= */ !1,
4362
- /* path= */ void 0, e);
4369
+ /* path= */ void 0, n);
4363
4370
  }
4364
4371
  }
4365
4372
 
4366
- function We(t, n, e, r, s) {
4373
+ function Qn(t, e, n, r, s) {
4367
4374
  const i = r && !r.isEmpty(), o = void 0 !== s;
4368
- let u = `Function ${n}() called with invalid data`;
4369
- e && (u += " (via `toFirestore()`)"), u += ". ";
4375
+ let u = `Function ${e}() called with invalid data`;
4376
+ n && (u += " (via `toFirestore()`)"), u += ". ";
4370
4377
  let c = "";
4371
4378
  return (i || o) && (c += " (found", i && (c += ` in field ${r}`), o && (c += ` in document ${s}`),
4372
4379
  c += ")"), new U(A, u + t + c);
4373
4380
  }
4374
4381
 
4375
- /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Ye(t, n) {
4376
- return t.some((t => t.isEqual(n)));
4382
+ /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Wn(t, e) {
4383
+ return t.some((t => t.isEqual(e)));
4377
4384
  }
4378
4385
 
4379
4386
  /**
@@ -4400,14 +4407,14 @@ function We(t, n, e, r, s) {
4400
4407
  * For a `DocumentSnapshot` that points to a non-existing document, any data
4401
4408
  * access will return 'undefined'. You can use the `exists()` method to
4402
4409
  * explicitly verify a document's existence.
4403
- */ class He {
4410
+ */ class Yn {
4404
4411
  // Note: This class is stripped down version of the DocumentSnapshot in
4405
4412
  // the legacy SDK. The changes are:
4406
4413
  // - No support for SnapshotMetadata.
4407
4414
  // - No support for SnapshotOptions.
4408
4415
  /** @hideconstructor protected */
4409
- constructor(t, n, e, r, s) {
4410
- this._firestore = t, this._userDataWriter = n, this._key = e, this._document = r,
4416
+ constructor(t, e, n, r, s) {
4417
+ this._firestore = t, this._userDataWriter = e, this._key = n, this._document = r,
4411
4418
  this._converter = s;
4412
4419
  }
4413
4420
  /** Property of the `DocumentSnapshot` that provides the document's ID. */ get id() {
@@ -4416,7 +4423,7 @@ function We(t, n, e, r, s) {
4416
4423
  /**
4417
4424
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
4418
4425
  */ get ref() {
4419
- return new he(this._firestore, this._converter, this._key);
4426
+ return new an(this._firestore, this._converter, this._key);
4420
4427
  }
4421
4428
  /**
4422
4429
  * Signals whether or not the document at the snapshot's location exists.
@@ -4436,7 +4443,7 @@ function We(t, n, e, r, s) {
4436
4443
  if (this._converter) {
4437
4444
  // We only want to use the converter and create a new DocumentSnapshot
4438
4445
  // if a converter has been provided.
4439
- const t = new Ke(this._firestore, this._userDataWriter, this._key, this._document,
4446
+ const t = new Hn(this._firestore, this._userDataWriter, this._key, this._document,
4440
4447
  /* converter= */ null);
4441
4448
  return this._converter.fromFirestore(t);
4442
4449
  }
@@ -4456,8 +4463,8 @@ function We(t, n, e, r, s) {
4456
4463
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4457
4464
  get(t) {
4458
4465
  if (this._document) {
4459
- const n = this._document.data.field(Ze("DocumentSnapshot.get", t));
4460
- if (null !== n) return this._userDataWriter.convertValue(n);
4466
+ const e = this._document.data.field(Xn("DocumentSnapshot.get", t));
4467
+ if (null !== e) return this._userDataWriter.convertValue(e);
4461
4468
  }
4462
4469
  }
4463
4470
  }
@@ -4472,7 +4479,7 @@ function We(t, n, e, r, s) {
4472
4479
  * `DocumentSnapshot`. Since query results contain only existing documents, the
4473
4480
  * `exists` property will always be true and `data()` will never return
4474
4481
  * 'undefined'.
4475
- */ class Ke extends He {
4482
+ */ class Hn extends Yn {
4476
4483
  /**
4477
4484
  * Retrieves all fields in the document as an `Object`.
4478
4485
  *
@@ -4490,10 +4497,10 @@ function We(t, n, e, r, s) {
4490
4497
  * array via the `docs` property or enumerated using the `forEach` method. The
4491
4498
  * number of documents can be determined via the `empty` and `size`
4492
4499
  * properties.
4493
- */ class Je {
4500
+ */ class Kn {
4494
4501
  /** @hideconstructor */
4495
- constructor(t, n) {
4496
- this._docs = n, this.query = t;
4502
+ constructor(t, e) {
4503
+ this._docs = e, this.query = t;
4497
4504
  }
4498
4505
  /** An array of all the documents in the `QuerySnapshot`. */ get docs() {
4499
4506
  return [ ...this._docs ];
@@ -4510,8 +4517,8 @@ function We(t, n, e, r, s) {
4510
4517
  * @param callback - A callback to be called with a `QueryDocumentSnapshot` for
4511
4518
  * each document in the snapshot.
4512
4519
  * @param thisArg - The `this` binding for the callback.
4513
- */ forEach(t, n) {
4514
- this._docs.forEach(t, n);
4520
+ */ forEach(t, e) {
4521
+ this._docs.forEach(t, e);
4515
4522
  }
4516
4523
  }
4517
4524
 
@@ -4521,14 +4528,14 @@ function We(t, n, e, r, s) {
4521
4528
  * @param left - A snapshot to compare.
4522
4529
  * @param right - A snapshot to compare.
4523
4530
  * @returns true if the snapshots are equal.
4524
- */ function Xe(t, n) {
4525
- return t = getModularInstance(t), n = getModularInstance(n), t instanceof He && n instanceof He ? 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 Je && n instanceof Je && (ye(t.query, n.query) && _t(t.docs, n.docs, Xe));
4531
+ */ function Jn(t, e) {
4532
+ return t = getModularInstance(t), e = getModularInstance(e), t instanceof Yn && e instanceof Yn ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Kn && e instanceof Kn && (pn(t.query, e.query) && _t(t.docs, e.docs, Jn));
4526
4533
  }
4527
4534
 
4528
4535
  /**
4529
4536
  * Helper that calls `fromDotSeparatedString()` but wraps any error thrown.
4530
- */ function Ze(t, n) {
4531
- return "string" == typeof n ? Qe(t, n) : n instanceof _e ? n._internalPath : n._delegate._internalPath;
4537
+ */ function Xn(t, e) {
4538
+ return "string" == typeof e ? Gn(t, e) : e instanceof yn ? e._internalPath : e._delegate._internalPath;
4532
4539
  }
4533
4540
 
4534
4541
  /**
@@ -4555,7 +4562,7 @@ function We(t, n, e, r, s) {
4555
4562
  * can then be passed to {@link query} to create a new query instance that
4556
4563
  * also contains this `QueryConstraint`.
4557
4564
  */
4558
- class tr {}
4565
+ class Zn {}
4559
4566
 
4560
4567
  /**
4561
4568
  * Creates a new immutable instance of {@link Query} that is extended to also include
@@ -4565,43 +4572,43 @@ class tr {}
4565
4572
  * @param queryConstraints - The list of {@link QueryConstraint}s to apply.
4566
4573
  * @throws if any of the provided query constraints cannot be combined with the
4567
4574
  * existing or new constraints.
4568
- */ function nr(t, ...n) {
4569
- for (const e of n) t = e._apply(t);
4575
+ */ function tr(t, ...e) {
4576
+ for (const n of e) t = n._apply(t);
4570
4577
  return t;
4571
4578
  }
4572
4579
 
4573
- class er extends tr {
4574
- constructor(t, n, e) {
4575
- super(), this.dt = t, this.wt = n, this.yt = e, this.type = "where";
4580
+ class er extends Zn {
4581
+ constructor(t, e, n) {
4582
+ super(), this.dt = t, this.wt = e, this.yt = n, this.type = "where";
4576
4583
  }
4577
4584
  _apply(t) {
4578
- const n = De(t.firestore), e = function(t, n, e, r, s, i, o) {
4585
+ const e = Vn(t.firestore), n = function(t, e, n, r, s, i, o) {
4579
4586
  let u;
4580
4587
  if (s.isKeyField()) {
4581
4588
  if ("array-contains" /* ARRAY_CONTAINS */ === i || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === i) throw new U(A, `Invalid Query. You can't perform '${i}' queries on documentId().`);
4582
4589
  if ("in" /* IN */ === i || "not-in" /* NOT_IN */ === i) {
4583
- yr(o, i);
4584
- const n = [];
4585
- for (const e of o) n.push(pr(r, t, e));
4590
+ pr(o, i);
4591
+ const e = [];
4592
+ for (const n of o) e.push(mr(r, t, n));
4586
4593
  u = {
4587
4594
  arrayValue: {
4588
- values: n
4595
+ values: e
4589
4596
  }
4590
4597
  };
4591
- } else u = pr(r, t, o);
4592
- } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || yr(o, i),
4593
- u = Ue(e, n, o,
4598
+ } else u = mr(r, t, o);
4599
+ } else "in" /* IN */ !== i && "not-in" /* NOT_IN */ !== i && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== i || pr(o, i),
4600
+ u = Ln(n, e, o,
4594
4601
  /* allowArrays= */ "in" /* IN */ === i || "not-in" /* NOT_IN */ === i);
4595
4602
  const c = Wt.create(s, i, u);
4596
- return function(t, n) {
4597
- if (n.N()) {
4598
- const e = hn(t);
4599
- if (null !== e && !e.isEqual(n.field)) throw new U(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${e.toString()}' and '${n.field.toString()}'`);
4600
- const r = an(t);
4601
- null !== r && _r(t, n.field, r);
4603
+ return function(t, e) {
4604
+ if (e.N()) {
4605
+ const n = ae(t);
4606
+ if (null !== n && !n.isEqual(e.field)) throw new U(A, `Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${e.field.toString()}'`);
4607
+ const r = ce(t);
4608
+ null !== r && yr(t, e.field, r);
4602
4609
  }
4603
- const e = function(t, n) {
4604
- for (const e of t.filters) if (n.indexOf(e.op) >= 0) return e.op;
4610
+ const n = function(t, e) {
4611
+ for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
4605
4612
  return null;
4606
4613
  }(t,
4607
4614
  /**
@@ -4636,16 +4643,16 @@ class er extends tr {
4636
4643
  default:
4637
4644
  return [];
4638
4645
  }
4639
- }(n.op));
4640
- if (null !== e)
4646
+ }(e.op));
4647
+ if (null !== n)
4641
4648
  // Special case when it's a duplicate op to give a slightly clearer error message.
4642
- throw e === n.op ? new U(A, `Invalid query. You cannot use more than one '${n.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${n.op.toString()}' filters with '${e.toString()}' filters.`);
4649
+ throw n === e.op ? new U(A, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new U(A, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
4643
4650
  }(t, c), c;
4644
- }(t._query, "where", n, t.firestore._databaseId, this.dt, this.wt, this.yt);
4645
- return new le(t.firestore, t.converter, function(t, n) {
4646
- const e = t.filters.concat([ n ]);
4647
- return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), e, t.limit, t.limitType, t.startAt, t.endAt);
4648
- }(t._query, e));
4651
+ }(t._query, "where", e, t.firestore._databaseId, this.dt, this.wt, this.yt);
4652
+ return new hn(t.firestore, t.converter, function(t, e) {
4653
+ const n = t.filters.concat([ e ]);
4654
+ return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
4655
+ }(t._query, n));
4649
4656
  }
4650
4657
  }
4651
4658
 
@@ -4659,25 +4666,25 @@ class er extends tr {
4659
4666
  * "&lt;=", "!=").
4660
4667
  * @param value - The value for comparison
4661
4668
  * @returns The created {@link Query}.
4662
- */ function rr(t, n, e) {
4663
- const r = n, s = Ze("where", t);
4664
- return new er(s, r, e);
4669
+ */ function nr(t, e, n) {
4670
+ const r = e, s = Xn("where", t);
4671
+ return new er(s, r, n);
4665
4672
  }
4666
4673
 
4667
- class sr extends tr {
4668
- constructor(t, n) {
4669
- super(), this.dt = t, this._t = n, this.type = "orderBy";
4674
+ class rr extends Zn {
4675
+ constructor(t, e) {
4676
+ super(), this.dt = t, this._t = e, this.type = "orderBy";
4670
4677
  }
4671
4678
  _apply(t) {
4672
- const n = function(t, n, e) {
4679
+ const e = function(t, e, n) {
4673
4680
  if (null !== t.startAt) throw new U(A, "Invalid query. You must not call startAt() or startAfter() before calling orderBy().");
4674
4681
  if (null !== t.endAt) throw new U(A, "Invalid query. You must not call endAt() or endBefore() before calling orderBy().");
4675
- const r = new rn(n, e);
4676
- return function(t, n) {
4677
- if (null === an(t)) {
4682
+ const r = new re(e, n);
4683
+ return function(t, e) {
4684
+ if (null === ce(t)) {
4678
4685
  // This is the first order by. It must match any inequality.
4679
- const e = hn(t);
4680
- null !== e && _r(t, e, n.field);
4686
+ const n = ae(t);
4687
+ null !== n && yr(t, n, e.field);
4681
4688
  }
4682
4689
  }(t, r), r;
4683
4690
  }
@@ -4692,11 +4699,11 @@ class sr extends tr {
4692
4699
  * of the query or if any of the fields in the order by are an uncommitted
4693
4700
  * server timestamp.
4694
4701
  */ (t._query, this.dt, this._t);
4695
- return new le(t.firestore, t.converter, function(t, n) {
4702
+ return new hn(t.firestore, t.converter, function(t, e) {
4696
4703
  // TODO(dimond): validate that orderBy does not list the same key twice.
4697
- const e = t.explicitOrderBy.concat([ n ]);
4698
- return new un(t.path, t.collectionGroup, e, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4699
- }(t._query, n));
4704
+ const n = t.explicitOrderBy.concat([ e ]);
4705
+ return new oe(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
4706
+ }(t._query, e));
4700
4707
  }
4701
4708
  }
4702
4709
 
@@ -4708,18 +4715,18 @@ class sr extends tr {
4708
4715
  * @param directionStr - Optional direction to sort by ('asc' or 'desc'). If
4709
4716
  * not specified, order will be ascending.
4710
4717
  * @returns The created {@link Query}.
4711
- */ function ir(t, n = "asc") {
4712
- const e = n, r = Ze("orderBy", t);
4713
- return new sr(r, e);
4718
+ */ function sr(t, e = "asc") {
4719
+ const n = e, r = Xn("orderBy", t);
4720
+ return new rr(r, n);
4714
4721
  }
4715
4722
 
4716
- class or extends tr {
4717
- constructor(t, n, e) {
4718
- super(), this.type = t, this.gt = n, this.vt = e;
4723
+ class ir extends Zn {
4724
+ constructor(t, e, n) {
4725
+ super(), this.type = t, this.gt = e, this.vt = n;
4719
4726
  }
4720
4727
  _apply(t) {
4721
- return new le(t.firestore, t.converter, function(t, n, e) {
4722
- return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), n, e, t.startAt, t.endAt);
4728
+ return new hn(t.firestore, t.converter, function(t, e, n) {
4729
+ return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), e, n, t.startAt, t.endAt);
4723
4730
  }(t._query, this.gt, this.vt));
4724
4731
  }
4725
4732
  }
@@ -4729,8 +4736,8 @@ class or extends tr {
4729
4736
  *
4730
4737
  * @param limit - The maximum number of items to return.
4731
4738
  * @returns The created {@link Query}.
4732
- */ function ur(t) {
4733
- return ut("limit", t), new or("limit", t, "F" /* First */);
4739
+ */ function or(t) {
4740
+ return ut("limit", t), new ir("limit", t, "F" /* First */);
4734
4741
  }
4735
4742
 
4736
4743
  /**
@@ -4741,54 +4748,56 @@ class or extends tr {
4741
4748
  *
4742
4749
  * @param limit - The maximum number of items to return.
4743
4750
  * @returns The created {@link Query}.
4744
- */ function cr(t) {
4745
- return ut("limitToLast", t), new or("limitToLast", t, "L" /* Last */);
4751
+ */ function ur(t) {
4752
+ return ut("limitToLast", t), new ir("limitToLast", t, "L" /* Last */);
4746
4753
  }
4747
4754
 
4748
- class ar extends tr {
4749
- constructor(t, n, e) {
4750
- super(), this.type = t, this.bt = n, this.Et = e;
4755
+ class cr extends Zn {
4756
+ constructor(t, e, n) {
4757
+ super(), this.type = t, this.bt = e, this.Et = n;
4751
4758
  }
4752
4759
  _apply(t) {
4753
- const n = mr(t, this.type, this.bt, this.Et);
4754
- return new le(t.firestore, t.converter, function(t, n) {
4755
- return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, n, t.endAt);
4756
- }(t._query, n));
4760
+ const e = wr(t, this.type, this.bt, this.Et);
4761
+ return new hn(t.firestore, t.converter, function(t, e) {
4762
+ return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
4763
+ }(t._query, e));
4757
4764
  }
4758
4765
  }
4759
4766
 
4760
- function hr(...t) {
4761
- return new ar("startAt", t, /*before=*/ !0);
4767
+ function ar(...t) {
4768
+ return new cr("startAt", t,
4769
+ /*inclusive=*/ !0);
4762
4770
  }
4763
4771
 
4764
- function lr(...t) {
4765
- return new ar("startAfter", t,
4766
- /*before=*/ !1);
4772
+ function hr(...t) {
4773
+ return new cr("startAfter", t,
4774
+ /*inclusive=*/ !1);
4767
4775
  }
4768
4776
 
4769
- class fr extends tr {
4770
- constructor(t, n, e) {
4771
- super(), this.type = t, this.bt = n, this.Et = e;
4777
+ class lr extends Zn {
4778
+ constructor(t, e, n) {
4779
+ super(), this.type = t, this.bt = e, this.Et = n;
4772
4780
  }
4773
4781
  _apply(t) {
4774
- const n = mr(t, this.type, this.bt, this.Et);
4775
- return new le(t.firestore, t.converter, function(t, n) {
4776
- return new un(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, n);
4777
- }(t._query, n));
4782
+ const e = wr(t, this.type, this.bt, this.Et);
4783
+ return new hn(t.firestore, t.converter, function(t, e) {
4784
+ return new oe(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
4785
+ }(t._query, e));
4778
4786
  }
4779
4787
  }
4780
4788
 
4781
- function dr(...t) {
4782
- return new fr("endBefore", t, /*before=*/ !0);
4789
+ function fr(...t) {
4790
+ return new lr("endBefore", t,
4791
+ /*inclusive=*/ !1);
4783
4792
  }
4784
4793
 
4785
- function wr(...t) {
4786
- return new fr("endAt", t, /*before=*/ !1);
4794
+ function dr(...t) {
4795
+ return new lr("endAt", t, /*inclusive=*/ !0);
4787
4796
  }
4788
4797
 
4789
- /** Helper function to create a bound from a document or fields */ function mr(t, n, e, r) {
4790
- if (e[0] = getModularInstance(e[0]), e[0] instanceof He) return function(t, n, e, r, s) {
4791
- if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${e}().`);
4798
+ /** Helper function to create a bound from a document or fields */ function wr(t, e, n, r) {
4799
+ if (n[0] = getModularInstance(n[0]), n[0] instanceof Yn) return function(t, e, n, r, s) {
4800
+ if (!r) throw new U(P, `Can't use a DocumentSnapshot that doesn't exist for ${n}().`);
4792
4801
  const i = [];
4793
4802
  // Because people expect to continue/end a query at the exact document
4794
4803
  // provided, we need to use the implicit sort order rather than the explicit
@@ -4797,23 +4806,23 @@ function wr(...t) {
4797
4806
  // the provided document. Without the key (by using the explicit sort
4798
4807
  // orders), multiple documents could match the position, yielding duplicate
4799
4808
  // results.
4800
- for (const e of fn(t)) if (e.field.isKeyField()) i.push(Ct(n, r.key)); else {
4801
- const t = r.data.field(e.field);
4802
- if (Dt(t)) throw new U(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' + e.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4809
+ for (const n of le(t)) if (n.field.isKeyField()) i.push(Ct(e, r.key)); else {
4810
+ const t = r.data.field(n.field);
4811
+ if (Dt(t)) throw new U(A, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
4803
4812
  if (null === t) {
4804
- const t = e.field.canonicalString();
4813
+ const t = n.field.canonicalString();
4805
4814
  throw new U(A, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
4806
4815
  }
4807
4816
  i.push(t);
4808
4817
  }
4809
- return new en(i, s);
4818
+ return new ne(i, s);
4810
4819
  }
4811
4820
  /**
4812
4821
  * Converts a list of field values to a `Bound` for the given query.
4813
- */ (t._query, t.firestore._databaseId, n, e[0]._document, r);
4822
+ */ (t._query, t.firestore._databaseId, e, n[0]._document, r);
4814
4823
  {
4815
- const s = De(t.firestore);
4816
- return function(t, n, e, r, s, i) {
4824
+ const s = Vn(t.firestore);
4825
+ return function(t, e, n, r, s, i) {
4817
4826
  // Use explicit order by's because it has to match the query the user made
4818
4827
  const o = t.explicitOrderBy;
4819
4828
  if (s.length > o.length) throw new U(A, `Too many arguments provided to ${r}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
@@ -4822,48 +4831,48 @@ function wr(...t) {
4822
4831
  const c = s[i];
4823
4832
  if (o[i].field.isKeyField()) {
4824
4833
  if ("string" != typeof c) throw new U(A, `Invalid query. Expected a string for document ID in ${r}(), but got a ${typeof c}`);
4825
- if (!ln(t) && -1 !== c.indexOf("/")) throw new U(A, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
4826
- const e = t.path.child(X.fromString(c));
4827
- if (!nt.isDocumentKey(e)) throw new U(A, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${e}' is not because it contains an odd number of segments.`);
4828
- const s = new nt(e);
4829
- u.push(Ct(n, s));
4834
+ if (!he(t) && -1 !== c.indexOf("/")) throw new U(A, `Invalid query. When querying a collection and ordering by documentId(), the value passed to ${r}() must be a plain document ID, but '${c}' contains a slash.`);
4835
+ const n = t.path.child(X.fromString(c));
4836
+ if (!et.isDocumentKey(n)) throw new U(A, `Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${r}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
4837
+ const s = new et(n);
4838
+ u.push(Ct(e, s));
4830
4839
  } else {
4831
- const t = Ue(e, r, c);
4840
+ const t = Ln(n, r, c);
4832
4841
  u.push(t);
4833
4842
  }
4834
4843
  }
4835
- return new en(u, i);
4844
+ return new ne(u, i);
4836
4845
  }
4837
4846
  /**
4838
4847
  * Parses the given `documentIdValue` into a `ReferenceValue`, throwing
4839
4848
  * appropriate errors if the value is anything other than a `DocumentReference`
4840
4849
  * or `string`, or if the string is malformed.
4841
- */ (t._query, t.firestore._databaseId, s, n, e, r);
4850
+ */ (t._query, t.firestore._databaseId, s, e, n, r);
4842
4851
  }
4843
4852
  }
4844
4853
 
4845
- function pr(t, n, e) {
4846
- if ("string" == typeof (e = getModularInstance(e))) {
4847
- if ("" === e) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4848
- if (!ln(n) && -1 !== e.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);
4849
- const r = n.path.child(X.fromString(e));
4850
- if (!nt.isDocumentKey(r)) throw new U(A, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
4851
- return Ct(t, new nt(r));
4854
+ function mr(t, e, n) {
4855
+ if ("string" == typeof (n = getModularInstance(n))) {
4856
+ if ("" === n) throw new U(A, "Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");
4857
+ if (!he(e) && -1 !== n.indexOf("/")) throw new U(A, `Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
4858
+ const r = e.path.child(X.fromString(n));
4859
+ if (!et.isDocumentKey(r)) throw new U(A, `Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);
4860
+ return Ct(t, new et(r));
4852
4861
  }
4853
- if (e instanceof he) return Ct(t, e._key);
4854
- throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(e)}.`);
4862
+ if (n instanceof an) return Ct(t, n._key);
4863
+ throw new U(A, `Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${it(n)}.`);
4855
4864
  }
4856
4865
 
4857
4866
  /**
4858
4867
  * Validates that the value passed into a disjunctive filter satisfies all
4859
4868
  * array requirements.
4860
- */ function yr(t, n) {
4861
- if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${n.toString()}' filters.`);
4862
- if (t.length > 10) throw new U(A, `Invalid Query. '${n.toString()}' filters support a maximum of 10 elements in the value array.`);
4869
+ */ function pr(t, e) {
4870
+ if (!Array.isArray(t) || 0 === t.length) throw new U(A, `Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);
4871
+ if (t.length > 10) throw new U(A, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
4863
4872
  }
4864
4873
 
4865
- function _r(t, n, e) {
4866
- if (!e.isEqual(n)) throw new U(A, `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.`);
4874
+ function yr(t, e, n) {
4875
+ if (!n.isEqual(e)) throw new U(A, `Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`);
4867
4876
  }
4868
4877
 
4869
4878
  /**
@@ -4913,17 +4922,17 @@ function _r(t, n, e) {
4913
4922
  * their `set()` or fails due to invalid data originating from a `toFirestore()`
4914
4923
  * call.
4915
4924
  */
4916
- function gr(t, n, e) {
4925
+ function _r(t, e, n) {
4917
4926
  let r;
4918
4927
  // Cast to `any` in order to satisfy the union type constraint on
4919
4928
  // toFirestore().
4920
4929
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4921
- return r = t ? e && (e.merge || e.mergeFields) ? t.toFirestore(n, e) : t.toFirestore(n) : n,
4930
+ return r = t ? n && (n.merge || n.mergeFields) ? t.toFirestore(e, n) : t.toFirestore(e) : e,
4922
4931
  r;
4923
4932
  }
4924
4933
 
4925
- class vr extends class {
4926
- convertValue(t, n = "none") {
4934
+ class gr extends class {
4935
+ convertValue(t, e = "none") {
4927
4936
  switch (St(t)) {
4928
4937
  case 0 /* NullValue */ :
4929
4938
  return null;
@@ -4938,7 +4947,7 @@ class vr extends class {
4938
4947
  return this.convertTimestamp(t.timestampValue);
4939
4948
 
4940
4949
  case 4 /* ServerTimestampValue */ :
4941
- return this.convertServerTimestamp(t, n);
4950
+ return this.convertServerTimestamp(t, e);
4942
4951
 
4943
4952
  case 5 /* StringValue */ :
4944
4953
  return t.stringValue;
@@ -4953,32 +4962,32 @@ class vr extends class {
4953
4962
  return this.convertGeoPoint(t.geoPointValue);
4954
4963
 
4955
4964
  case 9 /* ArrayValue */ :
4956
- return this.convertArray(t.arrayValue, n);
4965
+ return this.convertArray(t.arrayValue, e);
4957
4966
 
4958
4967
  case 10 /* ObjectValue */ :
4959
- return this.convertObject(t.mapValue, n);
4968
+ return this.convertObject(t.mapValue, e);
4960
4969
 
4961
4970
  default:
4962
4971
  throw g();
4963
4972
  }
4964
4973
  }
4965
- convertObject(t, n) {
4966
- const e = {};
4974
+ convertObject(t, e) {
4975
+ const n = {};
4967
4976
  return Et(t.fields, ((t, r) => {
4968
- e[t] = this.convertValue(r, n);
4969
- })), e;
4977
+ n[t] = this.convertValue(r, e);
4978
+ })), n;
4970
4979
  }
4971
4980
  convertGeoPoint(t) {
4972
- return new Ee(Pt(t.latitude), Pt(t.longitude));
4981
+ return new bn(Pt(t.latitude), Pt(t.longitude));
4973
4982
  }
4974
- convertArray(t, n) {
4975
- return (t.values || []).map((t => this.convertValue(t, n)));
4983
+ convertArray(t, e) {
4984
+ return (t.values || []).map((t => this.convertValue(t, e)));
4976
4985
  }
4977
- convertServerTimestamp(t, n) {
4978
- switch (n) {
4986
+ convertServerTimestamp(t, e) {
4987
+ switch (e) {
4979
4988
  case "previous":
4980
- const e = Nt(t);
4981
- return null == e ? null : this.convertValue(e, n);
4989
+ const n = Nt(t);
4990
+ return null == n ? null : this.convertValue(n, e);
4982
4991
 
4983
4992
  case "estimate":
4984
4993
  return this.convertTimestamp($t(t));
@@ -4988,16 +4997,16 @@ class vr extends class {
4988
4997
  }
4989
4998
  }
4990
4999
  convertTimestamp(t) {
4991
- const n = Rt(t);
4992
- return new gt(n.seconds, n.nanos);
5000
+ const e = Rt(t);
5001
+ return new gt(e.seconds, e.nanos);
4993
5002
  }
4994
- convertDocumentKey(t, n) {
4995
- const e = X.fromString(t);
4996
- v(Hn(e));
4997
- const r = new K(e.get(1), e.get(3)), s = new nt(e.popFirst(5));
4998
- return r.isEqual(n) ||
5003
+ convertDocumentKey(t, e) {
5004
+ const n = X.fromString(t);
5005
+ v(We(n));
5006
+ const r = new K(n.get(1), n.get(3)), s = new et(n.popFirst(5));
5007
+ return r.isEqual(e) ||
4999
5008
  // TODO(b/64130202): Somehow support foreign references.
5000
- p(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),
5009
+ p(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
5001
5010
  s;
5002
5011
  }
5003
5012
  } {
@@ -5005,11 +5014,11 @@ class vr extends class {
5005
5014
  super(), this.firestore = t;
5006
5015
  }
5007
5016
  convertBytes(t) {
5008
- return new ve(t);
5017
+ return new gn(t);
5009
5018
  }
5010
5019
  convertReference(t) {
5011
- const n = this.convertDocumentKey(t, this.firestore._databaseId);
5012
- return new he(this.firestore, /* converter= */ null, n);
5020
+ const e = this.convertDocumentKey(t, this.firestore._databaseId);
5021
+ return new an(this.firestore, /* converter= */ null, e);
5013
5022
  }
5014
5023
  }
5015
5024
 
@@ -5025,12 +5034,12 @@ class vr extends class {
5025
5034
  * @param reference - The reference of the document to fetch.
5026
5035
  * @returns A Promise resolved with a `DocumentSnapshot` containing the current
5027
5036
  * document contents.
5028
- */ function br(t) {
5029
- const n = re((t = ot(t, he)).firestore), e = new vr(t.firestore);
5030
- return te(n, [ t._key ]).then((n => {
5031
- v(1 === n.length);
5032
- const r = n[0];
5033
- return new He(t.firestore, e, t._key, r.isFoundDocument() ? r : null, t.converter);
5037
+ */ function vr(t) {
5038
+ const e = en((t = ot(t, an)).firestore), n = new gr(t.firestore);
5039
+ return Xe(e, [ t._key ]).then((e => {
5040
+ v(1 === e.length);
5041
+ const r = e[0];
5042
+ return new Yn(t.firestore, n, t._key, r.isFoundDocument() ? r : null, t.converter);
5034
5043
  }));
5035
5044
  }
5036
5045
 
@@ -5045,33 +5054,33 @@ class vr extends class {
5045
5054
  *
5046
5055
  * @param query - The `Query` to execute.
5047
5056
  * @returns A Promise that will be resolved with the results of the query.
5048
- */ function Er(t) {
5057
+ */ function br(t) {
5049
5058
  !function(t) {
5050
- if (cn(t) && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
5051
- }((t = ot(t, le))._query);
5052
- const n = re(t.firestore), e = new vr(t.firestore);
5053
- return ne(n, t._query).then((n => {
5054
- const r = n.map((n => new Ke(t.firestore, e, n.key, n, t.converter)));
5055
- return cn(t._query) &&
5059
+ if (ue(t) && 0 === t.explicitOrderBy.length) throw new U(q, "limitToLast() queries require specifying at least one orderBy() clause");
5060
+ }((t = ot(t, hn))._query);
5061
+ const e = en(t.firestore), n = new gr(t.firestore);
5062
+ return Ze(e, t._query).then((e => {
5063
+ const r = e.map((e => new Hn(t.firestore, n, e.key, e, t.converter)));
5064
+ return ue(t._query) &&
5056
5065
  // Limit to last queries reverse the orderBy constraint that was
5057
5066
  // specified by the user. As such, we need to reverse the order of the
5058
5067
  // results to return the documents in the expected order.
5059
- r.reverse(), new Je(t, r);
5068
+ r.reverse(), new Kn(t, r);
5060
5069
  }));
5061
5070
  }
5062
5071
 
5063
- function Tr(t, n, e) {
5064
- const r = gr((t = ot(t, he)).converter, n, e), s = Ne(De(t.firestore), "setDoc", t._key, r, null !== t.converter, e);
5065
- return Zn(re(t.firestore), [ s.toMutation(t._key, En.none()) ]);
5072
+ function Er(t, e, n) {
5073
+ const r = _r((t = ot(t, an)).converter, e, n), s = Dn(Vn(t.firestore), "setDoc", t._key, r, null !== t.converter, n);
5074
+ return Je(en(t.firestore), [ s.toMutation(t._key, be.none()) ]);
5066
5075
  }
5067
5076
 
5068
- function Ir(t, n, e, ...r) {
5069
- const s = De((t = ot(t, he)).firestore);
5077
+ function Tr(t, e, n, ...r) {
5078
+ const s = Vn((t = ot(t, an)).firestore);
5070
5079
  // For Compat types, we have to "extract" the underlying types before
5071
5080
  // performing validation.
5072
5081
  let i;
5073
- i = "string" == typeof (n = getModularInstance(n)) || n instanceof _e ? Le(s, "updateDoc", t._key, n, e, r) : Ce(s, "updateDoc", t._key, n);
5074
- return Zn(re(t.firestore), [ i.toMutation(t._key, En.exists(!0)) ]);
5082
+ i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(s, "updateDoc", t._key, e, n, r) : On(s, "updateDoc", t._key, e);
5083
+ return Je(en(t.firestore), [ i.toMutation(t._key, be.exists(!0)) ]);
5075
5084
  }
5076
5085
 
5077
5086
  /**
@@ -5085,8 +5094,8 @@ function Ir(t, n, e, ...r) {
5085
5094
  * @param reference - A reference to the document to delete.
5086
5095
  * @returns A `Promise` resolved once the document has been successfully
5087
5096
  * deleted from the backend.
5088
- */ function Ar(t) {
5089
- return Zn(re((t = ot(t, he)).firestore), [ new Rn(t._key, En.none()) ]);
5097
+ */ function Ir(t) {
5098
+ return Je(en((t = ot(t, an)).firestore), [ new Ae(t._key, be.none()) ]);
5090
5099
  }
5091
5100
 
5092
5101
  /**
@@ -5103,9 +5112,9 @@ function Ir(t, n, e, ...r) {
5103
5112
  * @throws Error - If the provided input is not a valid Firestore document.
5104
5113
  * @returns A `Promise` resolved with a `DocumentReference` pointing to the
5105
5114
  * newly created document after it has been written to the backend.
5106
- */ function Rr(t, n) {
5107
- const e = me(t = ot(t, fe)), r = gr(t.converter, n), s = Ne(De(t.firestore), "addDoc", e._key, r, null !== e.converter, {});
5108
- return Zn(re(t.firestore), [ s.toMutation(e._key, En.exists(!1)) ]).then((() => e));
5115
+ */ function Ar(t, e) {
5116
+ const n = wn(t = ot(t, ln)), r = _r(t.converter, e), s = Dn(Vn(t.firestore), "addDoc", n._key, r, null !== n.converter, {});
5117
+ return Je(en(t.firestore), [ s.toMutation(n._key, be.exists(!1)) ]).then((() => n));
5109
5118
  }
5110
5119
 
5111
5120
  /**
@@ -5127,15 +5136,15 @@ function Ir(t, n, e, ...r) {
5127
5136
  /**
5128
5137
  * Returns a sentinel for use with {@link @firebase/firestore/lite#(updateDoc:1)} or
5129
5138
  * {@link @firebase/firestore/lite#(setDoc:1)} with `{merge: true}` to mark a field for deletion.
5130
- */ function Pr() {
5131
- return new $e("deleteField");
5139
+ */ function Rr() {
5140
+ return new Nn("deleteField");
5132
5141
  }
5133
5142
 
5134
5143
  /**
5135
5144
  * Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
5136
5145
  * include a server-generated timestamp in the written data.
5137
- */ function Vr() {
5138
- return new Fe("serverTimestamp");
5146
+ */ function Pr() {
5147
+ return new Sn("serverTimestamp");
5139
5148
  }
5140
5149
 
5141
5150
  /**
@@ -5149,10 +5158,10 @@ function Ir(t, n, e, ...r) {
5149
5158
  * @param elements - The elements to union into the array.
5150
5159
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5151
5160
  * `updateDoc()`.
5152
- */ function Dr(...t) {
5161
+ */ function Vr(...t) {
5153
5162
  // NOTE: We don't actually parse the data until it's used in set() or
5154
5163
  // update() since we'd need the Firestore instance to do this.
5155
- return new xe("arrayUnion", t);
5164
+ return new Fn("arrayUnion", t);
5156
5165
  }
5157
5166
 
5158
5167
  /**
@@ -5165,10 +5174,10 @@ function Ir(t, n, e, ...r) {
5165
5174
  * @param elements - The elements to remove from the array.
5166
5175
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5167
5176
  * `updateDoc()`
5168
- */ function Nr(...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 qe("arrayRemove", t);
5180
+ return new xn("arrayRemove", t);
5172
5181
  }
5173
5182
 
5174
5183
  /**
@@ -5189,8 +5198,8 @@ function Ir(t, n, e, ...r) {
5189
5198
  * @param n - The value to increment by.
5190
5199
  * @returns The `FieldValue` sentinel for use in a call to `setDoc()` or
5191
5200
  * `updateDoc()`
5192
- */ function $r(t) {
5193
- return new Oe("increment", t);
5201
+ */ function Nr(t) {
5202
+ return new qn("increment", t);
5194
5203
  }
5195
5204
 
5196
5205
  /**
@@ -5216,25 +5225,25 @@ function Ir(t, n, e, ...r) {
5216
5225
  * provides methods for adding writes to the write batch. None of the writes
5217
5226
  * will be committed (or visible locally) until {@link WriteBatch.commit} is
5218
5227
  * called.
5219
- */ class Sr {
5228
+ */ class $r {
5220
5229
  /** @hideconstructor */
5221
- constructor(t, n) {
5222
- this._firestore = t, this._commitHandler = n, this._mutations = [], this._committed = !1,
5223
- this._dataReader = De(t);
5230
+ constructor(t, e) {
5231
+ this._firestore = t, this._commitHandler = e, this._mutations = [], this._committed = !1,
5232
+ this._dataReader = Vn(t);
5224
5233
  }
5225
- set(t, n, e) {
5234
+ set(t, e, n) {
5226
5235
  this._verifyNotCommitted();
5227
- const r = Fr(t, this._firestore), s = gr(r.converter, n, e), i = Ne(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, e);
5228
- return this._mutations.push(i.toMutation(r._key, En.none())), this;
5236
+ const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "WriteBatch.set", r._key, s, null !== r.converter, n);
5237
+ return this._mutations.push(i.toMutation(r._key, be.none())), this;
5229
5238
  }
5230
- update(t, n, e, ...r) {
5239
+ update(t, e, n, ...r) {
5231
5240
  this._verifyNotCommitted();
5232
- const s = Fr(t, this._firestore);
5241
+ const s = Sr(t, this._firestore);
5233
5242
  // For Compat types, we have to "extract" the underlying types before
5234
5243
  // performing validation.
5235
5244
  let i;
5236
- return i = "string" == typeof (n = getModularInstance(n)) || n instanceof _e ? Le(this._dataReader, "WriteBatch.update", s._key, n, e, r) : Ce(this._dataReader, "WriteBatch.update", s._key, n),
5237
- this._mutations.push(i.toMutation(s._key, En.exists(!0))), this;
5245
+ return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "WriteBatch.update", s._key, e, n, r) : On(this._dataReader, "WriteBatch.update", s._key, e),
5246
+ this._mutations.push(i.toMutation(s._key, be.exists(!0))), this;
5238
5247
  }
5239
5248
  /**
5240
5249
  * Deletes the document referred to by the provided {@link DocumentReference}.
@@ -5243,8 +5252,8 @@ function Ir(t, n, e, ...r) {
5243
5252
  * @returns This `WriteBatch` instance. Used for chaining method calls.
5244
5253
  */ delete(t) {
5245
5254
  this._verifyNotCommitted();
5246
- const n = Fr(t, this._firestore);
5247
- return this._mutations = this._mutations.concat(new Rn(n._key, En.none())), this;
5255
+ const e = Sr(t, this._firestore);
5256
+ return this._mutations = this._mutations.concat(new Ae(e._key, be.none())), this;
5248
5257
  }
5249
5258
  /**
5250
5259
  * Commits all of the writes in this write batch as a single atomic unit.
@@ -5265,8 +5274,8 @@ function Ir(t, n, e, ...r) {
5265
5274
  }
5266
5275
  }
5267
5276
 
5268
- function Fr(t, n) {
5269
- if ((t = getModularInstance(t)).firestore !== n) throw new U(A, "Provided document reference is from a different Firestore instance.");
5277
+ function Sr(t, e) {
5278
+ if ((t = getModularInstance(t)).firestore !== e) throw new U(A, "Provided document reference is from a different Firestore instance.");
5270
5279
  return t;
5271
5280
  }
5272
5281
 
@@ -5282,9 +5291,9 @@ function Fr(t, n) {
5282
5291
  *
5283
5292
  * @returns A `WriteBatch` that can be used to atomically execute multiple
5284
5293
  * writes.
5285
- */ function xr(t) {
5286
- const n = re(t = ot(t, ie));
5287
- return new Sr(t, (t => Zn(n, t)));
5294
+ */ function Fr(t) {
5295
+ const e = en(t = ot(t, rn));
5296
+ return new $r(t, (t => Je(e, t)));
5288
5297
  }
5289
5298
 
5290
5299
  /**
@@ -5306,7 +5315,7 @@ function Fr(t, n) {
5306
5315
  /**
5307
5316
  * Internal transaction object responsible for accumulating the mutations to
5308
5317
  * perform and the base versions for any documents read.
5309
- */ class qr {
5318
+ */ class xr {
5310
5319
  constructor(t) {
5311
5320
  this.datastore = t,
5312
5321
  // The version of each document that was read during this transaction.
@@ -5326,66 +5335,66 @@ function Fr(t, n) {
5326
5335
  }
5327
5336
  async lookup(t) {
5328
5337
  if (this.ensureCommitNotCalled(), this.mutations.length > 0) throw new U(A, "Firestore transactions require all reads to be executed before all writes.");
5329
- const n = await te(this.datastore, t);
5330
- return n.forEach((t => this.recordVersion(t))), n;
5338
+ const e = await Xe(this.datastore, t);
5339
+ return e.forEach((t => this.recordVersion(t))), e;
5331
5340
  }
5332
- set(t, n) {
5333
- this.write(n.toMutation(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5341
+ set(t, e) {
5342
+ this.write(e.toMutation(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5334
5343
  }
5335
- update(t, n) {
5344
+ update(t, e) {
5336
5345
  try {
5337
- this.write(n.toMutation(t, this.preconditionForUpdate(t)));
5346
+ this.write(e.toMutation(t, this.preconditionForUpdate(t)));
5338
5347
  } catch (t) {
5339
5348
  this.lastWriteError = t;
5340
5349
  }
5341
5350
  this.writtenDocs.add(t.toString());
5342
5351
  }
5343
5352
  delete(t) {
5344
- this.write(new Rn(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5353
+ this.write(new Ae(t, this.precondition(t))), this.writtenDocs.add(t.toString());
5345
5354
  }
5346
5355
  async commit() {
5347
5356
  if (this.ensureCommitNotCalled(), this.lastWriteError) throw this.lastWriteError;
5348
5357
  const t = this.readVersions;
5349
5358
  // For each mutation, note that the doc was written.
5350
- this.mutations.forEach((n => {
5351
- t.delete(n.key.toString());
5359
+ this.mutations.forEach((e => {
5360
+ t.delete(e.key.toString());
5352
5361
  })),
5353
5362
  // For each document that was read but not written to, we want to perform
5354
5363
  // a `verify` operation.
5355
- t.forEach(((t, n) => {
5356
- const e = nt.fromPath(n);
5357
- this.mutations.push(new Pn(e, this.precondition(e)));
5358
- })), await Zn(this.datastore, this.mutations), this.committed = !0;
5364
+ t.forEach(((t, e) => {
5365
+ const n = et.fromPath(e);
5366
+ this.mutations.push(new Re(n, this.precondition(n)));
5367
+ })), await Je(this.datastore, this.mutations), this.committed = !0;
5359
5368
  }
5360
5369
  recordVersion(t) {
5361
- let n;
5362
- if (t.isFoundDocument()) n = t.version; else {
5370
+ let e;
5371
+ if (t.isFoundDocument()) e = t.version; else {
5363
5372
  if (!t.isNoDocument()) throw g();
5364
5373
  // For deleted docs, we must use baseVersion 0 when we overwrite them.
5365
- n = vt.min();
5374
+ e = vt.min();
5366
5375
  }
5367
- const e = this.readVersions.get(t.key.toString());
5368
- if (e) {
5369
- if (!n.isEqual(e))
5376
+ const n = this.readVersions.get(t.key.toString());
5377
+ if (n) {
5378
+ if (!e.isEqual(n))
5370
5379
  // This transaction will fail no matter what.
5371
5380
  throw new U(F, "Document version changed between two reads.");
5372
- } else this.readVersions.set(t.key.toString(), n);
5381
+ } else this.readVersions.set(t.key.toString(), e);
5373
5382
  }
5374
5383
  /**
5375
5384
  * Returns the version of this document when it was read in this transaction,
5376
5385
  * as a precondition, or no precondition if it was not read.
5377
5386
  */ precondition(t) {
5378
- const n = this.readVersions.get(t.toString());
5379
- return !this.writtenDocs.has(t.toString()) && n ? En.updateTime(n) : En.none();
5387
+ const e = this.readVersions.get(t.toString());
5388
+ return !this.writtenDocs.has(t.toString()) && e ? be.updateTime(e) : be.none();
5380
5389
  }
5381
5390
  /**
5382
5391
  * Returns the precondition for a document if the operation is an update.
5383
5392
  */ preconditionForUpdate(t) {
5384
- const n = this.readVersions.get(t.toString());
5393
+ const e = this.readVersions.get(t.toString());
5385
5394
  // The first time a document is written, we want to take into account the
5386
5395
  // read time and existence
5387
- if (!this.writtenDocs.has(t.toString()) && n) {
5388
- if (n.isEqual(vt.min()))
5396
+ if (!this.writtenDocs.has(t.toString()) && e) {
5397
+ if (e.isEqual(vt.min()))
5389
5398
  // The document doesn't exist, so fail the transaction.
5390
5399
  // This has to be validated locally because you can't send a
5391
5400
  // precondition that a document does not exist without changing the
@@ -5397,11 +5406,11 @@ function Fr(t, n) {
5397
5406
  // transaction.
5398
5407
  throw new U(A, "Can't update a document that doesn't exist.");
5399
5408
  // Document exists, base precondition on document update time.
5400
- return En.updateTime(n);
5409
+ return be.updateTime(e);
5401
5410
  }
5402
5411
  // Document was not read, so we just use the preconditions for a blind
5403
5412
  // update.
5404
- return En.exists(!0);
5413
+ return be.exists(!0);
5405
5414
  }
5406
5415
  write(t) {
5407
5416
  this.ensureCommitNotCalled(), this.mutations.push(t);
@@ -5429,20 +5438,20 @@ function Fr(t, n) {
5429
5438
  * TransactionRunner encapsulates the logic needed to run and retry transactions
5430
5439
  * with backoff.
5431
5440
  */
5432
- class Or {
5433
- constructor(t, n, e, r) {
5434
- this.asyncQueue = t, this.datastore = n, this.updateFunction = e, this.deferred = r,
5435
- this.Tt = 5, this.It = new Jn(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5441
+ class qr {
5442
+ constructor(t, e, n, r) {
5443
+ this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = r,
5444
+ this.Tt = 5, this.It = new He(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
5436
5445
  }
5437
5446
  /** Runs the transaction and sets the result on deferred. */ run() {
5438
5447
  this.Tt -= 1, this.At();
5439
5448
  }
5440
5449
  At() {
5441
5450
  this.It.W((async () => {
5442
- const t = new qr(this.datastore), n = this.Rt(t);
5443
- n && n.then((n => {
5451
+ const t = new xr(this.datastore), e = this.Rt(t);
5452
+ e && e.then((e => {
5444
5453
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
5445
- this.deferred.resolve(n);
5454
+ this.deferred.resolve(e);
5446
5455
  })).catch((t => {
5447
5456
  this.Pt(t);
5448
5457
  }))));
@@ -5453,8 +5462,8 @@ class Or {
5453
5462
  }
5454
5463
  Rt(t) {
5455
5464
  try {
5456
- const n = this.updateFunction(t);
5457
- return !ct(n) && n.catch && n.then ? n : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5465
+ const e = this.updateFunction(t);
5466
+ return !ct(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
5458
5467
  null);
5459
5468
  } catch (t) {
5460
5469
  // Do not retry errors thrown by user provided updateFunction.
@@ -5469,8 +5478,8 @@ class Or {
5469
5478
  if ("FirebaseError" === t.name) {
5470
5479
  // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
5471
5480
  // non-matching document versions with ABORTED. These errors should be retried.
5472
- const n = t.code;
5473
- return "aborted" === n || "failed-precondition" === n || !
5481
+ const e = t.code;
5482
+ return "aborted" === e || "failed-precondition" === e || !
5474
5483
  /**
5475
5484
  * Determines whether an error code represents a permanent error when received
5476
5485
  * in response to a non-write operation.
@@ -5507,7 +5516,7 @@ class Or {
5507
5516
  case L:
5508
5517
  return !0;
5509
5518
  }
5510
- }(n);
5519
+ }(e);
5511
5520
  }
5512
5521
  return !1;
5513
5522
  }
@@ -5529,7 +5538,7 @@ class Or {
5529
5538
  * See the License for the specific language governing permissions and
5530
5539
  * limitations under the License.
5531
5540
  */
5532
- /** The Platform's 'document' implementation or null if not available. */ function Cr() {
5541
+ /** The Platform's 'document' implementation or null if not available. */ function Or() {
5533
5542
  // `document` is not always available, e.g. in ReactNative and WebWorkers.
5534
5543
  // eslint-disable-next-line no-restricted-globals
5535
5544
  return "undefined" != typeof document ? document : null;
@@ -5561,9 +5570,9 @@ class Or {
5561
5570
  * Note: We implement `PromiseLike` instead of `Promise`, as the `Promise` type
5562
5571
  * in newer versions of TypeScript defines `finally`, which is not available in
5563
5572
  * IE.
5564
- */ class Lr {
5565
- constructor(t, n, e, r, s) {
5566
- this.asyncQueue = t, this.timerId = n, this.targetTimeMs = e, this.op = r, this.removalCallback = s,
5573
+ */ class Cr {
5574
+ constructor(t, e, n, r, s) {
5575
+ this.asyncQueue = t, this.timerId = e, this.targetTimeMs = n, this.op = r, this.removalCallback = s,
5567
5576
  this.deferred = new k, this.then = this.deferred.promise.then.bind(this.deferred.promise),
5568
5577
  // It's normal for the deferred promise to be canceled (due to cancellation)
5569
5578
  // and so we attach a dummy catch callback to avoid
@@ -5583,9 +5592,9 @@ class Or {
5583
5592
  * from its delayedOperations list.
5584
5593
  * PORTING NOTE: This exists to prevent making removeDelayedOperation() and
5585
5594
  * the DelayedOperation class public.
5586
- */ static createAndSchedule(t, n, e, r, s) {
5587
- const i = Date.now() + e, o = new Lr(t, n, i, r, s);
5588
- return o.start(e), o;
5595
+ */ static createAndSchedule(t, e, n, r, s) {
5596
+ const i = Date.now() + n, o = new Cr(t, e, i, r, s);
5597
+ return o.start(n), o;
5589
5598
  }
5590
5599
  /**
5591
5600
  * Starts the timer. This is called immediately after construction by
@@ -5633,7 +5642,7 @@ class Or {
5633
5642
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5634
5643
  * See the License for the specific language governing permissions and
5635
5644
  * limitations under the License.
5636
- */ class Ur {
5645
+ */ class Lr {
5637
5646
  constructor() {
5638
5647
  // The last promise in the queue.
5639
5648
  this.Dt = Promise.resolve(),
@@ -5656,15 +5665,15 @@ class Or {
5656
5665
  // List of TimerIds to fast-forward delays for.
5657
5666
  this.Ot = [],
5658
5667
  // Backoff timer used to schedule retries for retryable operations
5659
- this.It = new Jn(this, "async_queue_retry" /* AsyncQueueRetry */),
5668
+ this.It = new He(this, "async_queue_retry" /* AsyncQueueRetry */),
5660
5669
  // Visibility handler that triggers an immediate retry of all retryable
5661
5670
  // operations. Meant to speed up recovery when we regain file system access
5662
5671
  // after page comes into foreground.
5663
5672
  this.Ct = () => {
5664
- const t = Cr();
5673
+ const t = Or();
5665
5674
  t && m("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.It.H();
5666
5675
  };
5667
- const t = Cr();
5676
+ const t = Or();
5668
5677
  t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ct);
5669
5678
  }
5670
5679
  get isShuttingDown() {
@@ -5685,8 +5694,8 @@ class Or {
5685
5694
  enterRestrictedMode(t) {
5686
5695
  if (!this.$t) {
5687
5696
  this.$t = !0, this.qt = t || !1;
5688
- const n = Cr();
5689
- n && "function" == typeof n.removeEventListener && n.removeEventListener("visibilitychange", this.Ct);
5697
+ const e = Or();
5698
+ e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ct);
5690
5699
  }
5691
5700
  }
5692
5701
  enqueue(t) {
@@ -5696,9 +5705,9 @@ class Or {
5696
5705
  // Create a deferred Promise that we can return to the callee. This
5697
5706
  // allows us to return a "hanging Promise" only to the callee and still
5698
5707
  // advance the queue even when the operation is not run.
5699
- const n = new k;
5700
- return this.Ut((() => this.$t && this.qt ? Promise.resolve() : (t().then(n.resolve, n.reject),
5701
- n.promise))).then((() => n.promise));
5708
+ const e = new k;
5709
+ return this.Ut((() => this.$t && this.qt ? Promise.resolve() : (t().then(e.resolve, e.reject),
5710
+ e.promise))).then((() => e.promise));
5702
5711
  }
5703
5712
  enqueueRetryable(t) {
5704
5713
  this.enqueueAndForget((() => (this.Nt.push(t), this.kt())));
@@ -5768,18 +5777,18 @@ class Or {
5768
5777
  }
5769
5778
  }
5770
5779
  Ut(t) {
5771
- const n = this.Dt.then((() => (this.xt = !0, t().catch((t => {
5780
+ const e = this.Dt.then((() => (this.xt = !0, t().catch((t => {
5772
5781
  this.Ft = t, this.xt = !1;
5773
- const n =
5782
+ const e =
5774
5783
  /**
5775
5784
  * Chrome includes Error.message in Error.stack. Other browsers do not.
5776
5785
  * This returns expected output of message + stack when available.
5777
5786
  * @param error - Error or FirestoreError
5778
5787
  */
5779
5788
  function(t) {
5780
- let n = t.message || "";
5781
- t.stack && (n = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack);
5782
- return n;
5789
+ let e = t.message || "";
5790
+ t.stack && (e = t.stack.includes(t.message) ? t.stack : t.message + "\n" + t.stack);
5791
+ return e;
5783
5792
  }
5784
5793
  /**
5785
5794
  * @license
@@ -5809,15 +5818,15 @@ class Or {
5809
5818
  // Re-throw the error so that this.tail becomes a rejected Promise and
5810
5819
  // all further attempts to chain (via .then) will just short-circuit
5811
5820
  // and return the rejected Promise.
5812
- throw p("INTERNAL UNHANDLED ERROR: ", n), t;
5821
+ throw p("INTERNAL UNHANDLED ERROR: ", e), t;
5813
5822
  })).then((t => (this.xt = !1, t))))));
5814
- return this.Dt = n, n;
5823
+ return this.Dt = e, e;
5815
5824
  }
5816
- enqueueAfterDelay(t, n, e) {
5825
+ enqueueAfterDelay(t, e, n) {
5817
5826
  this.Lt(),
5818
5827
  // Fast-forward delays for timerIds that have been overriden.
5819
- this.Ot.indexOf(t) > -1 && (n = 0);
5820
- const r = Lr.createAndSchedule(this, t, n, e, (t => this.jt(t)));
5828
+ this.Ot.indexOf(t) > -1 && (e = 0);
5829
+ const r = Cr.createAndSchedule(this, t, e, n, (t => this.jt(t)));
5821
5830
  return this.St.push(r), r;
5822
5831
  }
5823
5832
  Lt() {
@@ -5841,7 +5850,7 @@ class Or {
5841
5850
  * For Tests: Determine if a delayed operation with a particular TimerId
5842
5851
  * exists.
5843
5852
  */ Bt(t) {
5844
- for (const n of this.St) if (n.timerId === t) return !0;
5853
+ for (const e of this.St) if (e.timerId === t) return !0;
5845
5854
  return !1;
5846
5855
  }
5847
5856
  /**
@@ -5854,8 +5863,8 @@ class Or {
5854
5863
  // Note that draining may generate more delayed ops, so we do that first.
5855
5864
  return this.Mt().then((() => {
5856
5865
  // Run ops in the same order they'd run if they ran naturally.
5857
- this.St.sort(((t, n) => t.targetTimeMs - n.targetTimeMs));
5858
- for (const n of this.St) if (n.skipDelay(), "all" /* All */ !== t && n.timerId === t) break;
5866
+ this.St.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
5867
+ for (const e of this.St) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
5859
5868
  return this.Mt();
5860
5869
  }));
5861
5870
  }
@@ -5866,15 +5875,15 @@ class Or {
5866
5875
  }
5867
5876
  /** Called once a DelayedOperation is run or canceled. */ jt(t) {
5868
5877
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
5869
- const n = this.St.indexOf(t);
5870
- this.St.splice(n, 1);
5878
+ const e = this.St.indexOf(t);
5879
+ this.St.splice(e, 1);
5871
5880
  }
5872
5881
  }
5873
5882
 
5874
- class kr {
5883
+ class Ur {
5875
5884
  /** @hideconstructor */
5876
- constructor(t, n) {
5877
- this._firestore = t, this._transaction = n, this._dataReader = De(t);
5885
+ constructor(t, e) {
5886
+ this._firestore = t, this._transaction = e, this._dataReader = Vn(t);
5878
5887
  }
5879
5888
  /**
5880
5889
  * Reads the document referenced by the provided {@link DocumentReference}.
@@ -5882,25 +5891,25 @@ class kr {
5882
5891
  * @param documentRef - A reference to the document to be read.
5883
5892
  * @returns A `DocumentSnapshot` with the read data.
5884
5893
  */ get(t) {
5885
- const n = Fr(t, this._firestore), e = new vr(this._firestore);
5886
- return this._transaction.lookup([ n._key ]).then((t => {
5894
+ const e = Sr(t, this._firestore), n = new gr(this._firestore);
5895
+ return this._transaction.lookup([ e._key ]).then((t => {
5887
5896
  if (!t || 1 !== t.length) return g();
5888
5897
  const r = t[0];
5889
- if (r.isFoundDocument()) return new He(this._firestore, e, r.key, r, n.converter);
5890
- if (r.isNoDocument()) return new He(this._firestore, e, n._key, null, n.converter);
5898
+ if (r.isFoundDocument()) return new Yn(this._firestore, n, r.key, r, e.converter);
5899
+ if (r.isNoDocument()) return new Yn(this._firestore, n, e._key, null, e.converter);
5891
5900
  throw g();
5892
5901
  }));
5893
5902
  }
5894
- set(t, n, e) {
5895
- const r = Fr(t, this._firestore), s = gr(r.converter, n, e), i = Ne(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, e);
5903
+ set(t, e, n) {
5904
+ const r = Sr(t, this._firestore), s = _r(r.converter, e, n), i = Dn(this._dataReader, "Transaction.set", r._key, s, null !== r.converter, n);
5896
5905
  return this._transaction.set(r._key, i), this;
5897
5906
  }
5898
- update(t, n, e, ...r) {
5899
- const s = Fr(t, this._firestore);
5907
+ update(t, e, n, ...r) {
5908
+ const s = Sr(t, this._firestore);
5900
5909
  // For Compat types, we have to "extract" the underlying types before
5901
5910
  // performing validation.
5902
5911
  let i;
5903
- return i = "string" == typeof (n = getModularInstance(n)) || n instanceof _e ? Le(this._dataReader, "Transaction.update", s._key, n, e, r) : Ce(this._dataReader, "Transaction.update", s._key, n),
5912
+ return i = "string" == typeof (e = getModularInstance(e)) || e instanceof yn ? Cn(this._dataReader, "Transaction.update", s._key, e, n, r) : On(this._dataReader, "Transaction.update", s._key, e),
5904
5913
  this._transaction.update(s._key, i), this;
5905
5914
  }
5906
5915
  /**
@@ -5909,8 +5918,8 @@ class kr {
5909
5918
  * @param documentRef - A reference to the document to be deleted.
5910
5919
  * @returns This `Transaction` instance. Used for chaining method calls.
5911
5920
  */ delete(t) {
5912
- const n = Fr(t, this._firestore);
5913
- return this._transaction.delete(n._key), this;
5921
+ const e = Sr(t, this._firestore);
5922
+ return this._transaction.delete(e._key), this;
5914
5923
  }
5915
5924
  }
5916
5925
 
@@ -5930,9 +5939,9 @@ class kr {
5930
5939
  * (the `updateFunction` returned a failed promise), the promise returned by the
5931
5940
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
5932
5941
  * rejected promise with the corresponding failure error is returned.
5933
- */ function jr(t, n) {
5934
- const e = re(t = ot(t, ie)), r = new k;
5935
- return new Or(new Ur, e, (e => n(new kr(t, e))), r).run(), r.promise;
5942
+ */ function kr(t, e) {
5943
+ const n = en(t = ot(t, rn)), r = new k;
5944
+ return new qr(new Lr, n, (n => e(new Ur(t, n))), r).run(), r.promise;
5936
5945
  }
5937
5946
 
5938
5947
  /**
@@ -5944,12 +5953,12 @@ class kr {
5944
5953
  * @packageDocumentation
5945
5954
  */ !function(t) {
5946
5955
  f = t;
5947
- }(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: n}) => {
5948
- const e = t.getProvider("app").getImmediate(), r = new ie(e, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
5949
- return n && r._setSettings(n), r;
5956
+ }(`${SDK_VERSION}_lite`), _registerComponent(new Component("firestore/lite", ((t, {options: e}) => {
5957
+ const n = t.getProvider("app").getImmediate(), r = new rn(n, new z(t.getProvider("auth-internal")), new Y(t.getProvider("app-check-internal")));
5958
+ return e && r._setSettings(e), r;
5950
5959
  }), "PUBLIC")),
5951
5960
  // RUNTIME_ENV and BUILD_TARGET are replaced by real values during the compilation
5952
- registerVersion("firestore-lite", "3.4.4-canary.2dd99ae2d", ""), registerVersion("firestore-lite", "3.4.4-canary.2dd99ae2d", "esm2017");
5961
+ registerVersion("firestore-lite", "3.4.4-canary.3e9f3e253", ""), registerVersion("firestore-lite", "3.4.4-canary.3e9f3e253", "esm2017");
5953
5962
 
5954
- export { ve as Bytes, fe as CollectionReference, he as DocumentReference, He as DocumentSnapshot, _e as FieldPath, be as FieldValue, ie as Firestore, U as FirestoreError, Ee as GeoPoint, le as Query, tr as QueryConstraint, Ke as QueryDocumentSnapshot, Je as QuerySnapshot, gt as Timestamp, kr as Transaction, Sr as WriteBatch, Rr as addDoc, Nr as arrayRemove, Dr as arrayUnion, de as collection, we as collectionGroup, ce as connectFirestoreEmulator, Ar as deleteDoc, Pr as deleteField, me as doc, ge as documentId, wr as endAt, dr as endBefore, br as getDoc, Er as getDocs, ue as getFirestore, $r as increment, oe as initializeFirestore, ur as limit, cr as limitToLast, ir as orderBy, nr as query, ye as queryEqual, pe as refEqual, jr as runTransaction, Vr as serverTimestamp, Tr as setDoc, w as setLogLevel, Xe as snapshotEqual, lr as startAfter, hr as startAt, ae as terminate, Ir as updateDoc, rr as where, xr as writeBatch };
5963
+ export { gn as Bytes, ln as CollectionReference, an as DocumentReference, Yn as DocumentSnapshot, yn as FieldPath, vn as FieldValue, rn as Firestore, U as FirestoreError, bn as GeoPoint, hn as Query, Zn as QueryConstraint, Hn as QueryDocumentSnapshot, Kn as QuerySnapshot, gt as Timestamp, Ur as Transaction, $r as WriteBatch, Ar as addDoc, Dr as arrayRemove, Vr as arrayUnion, fn as collection, dn as collectionGroup, un as connectFirestoreEmulator, Ir as deleteDoc, Rr as deleteField, wn as doc, _n as documentId, dr as endAt, fr as endBefore, vr as getDoc, br as getDocs, on as getFirestore, Nr as increment, sn as initializeFirestore, or as limit, ur as limitToLast, sr as orderBy, tr as query, pn as queryEqual, mn as refEqual, kr as runTransaction, Pr as serverTimestamp, Er as setDoc, w as setLogLevel, Jn as snapshotEqual, hr as startAfter, ar as startAt, cn as terminate, Tr as updateDoc, nr as where, Fr as writeBatch };
5955
5964
  //# sourceMappingURL=index.browser.esm2017.js.map