@dereekb/rxjs 13.43.0 → 14.0.0

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.
package/index.esm.js CHANGED
@@ -2,9 +2,7 @@ import { isWebsiteUrlWithPrefix, getValueFromGetter, isMaybeSo, filterMaybeArray
2
2
  import { defer, from, isObservable, of, switchMap, combineLatest, map, delay, startWith, filter, skipWhile, EMPTY, distinctUntilChanged, mergeMap, BehaviorSubject, shareReplay, skip, defaultIfEmpty, first, finalize, merge, firstValueFrom, exhaustMap, scan, identity, throttleTime, takeWhile, timeout, tap, throwError, timer, delayWhen, asyncScheduler, catchError, Subject } from 'rxjs';
3
3
 
4
4
  function _class_call_check$9(instance, Constructor) {
5
- if (!(instance instanceof Constructor)) {
6
- throw new TypeError("Cannot call a class as a function");
7
- }
5
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
8
6
  }
9
7
  // MARK: Abstract Loader
10
8
  /**
@@ -241,11 +239,8 @@ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
241
239
  reject(error);
242
240
  return;
243
241
  }
244
- if (info.done) {
245
- resolve(value);
246
- } else {
247
- Promise.resolve(value).then(_next, _throw);
248
- }
242
+ if (info.done) resolve(value);
243
+ else Promise.resolve(value).then(_next, _throw);
249
244
  }
250
245
  function _async_to_generator$3(fn) {
251
246
  return function() {
@@ -420,11 +415,8 @@ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
420
415
  reject(error);
421
416
  return;
422
417
  }
423
- if (info.done) {
424
- resolve(value);
425
- } else {
426
- Promise.resolve(value).then(_next, _throw);
427
- }
418
+ if (info.done) resolve(value);
419
+ else Promise.resolve(value).then(_next, _throw);
428
420
  }
429
421
  function _async_to_generator$2(fn) {
430
422
  return function() {
@@ -627,7 +619,7 @@ function useAsObservable(input, observer) {
627
619
  return asObservable(input).subscribe(observer);
628
620
  }
629
621
 
630
- function _array_like_to_array$b(arr, len) {
622
+ function _array_like_to_array$a(arr, len) {
631
623
  if (len == null || len > arr.length) len = arr.length;
632
624
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
633
625
  return arr2;
@@ -660,18 +652,18 @@ function _iterable_to_array_limit$5(arr, i) {
660
652
  return _arr;
661
653
  }
662
654
  function _non_iterable_rest$5() {
663
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
655
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
664
656
  }
665
657
  function _sliced_to_array$5(arr, i) {
666
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$5();
658
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$5();
667
659
  }
668
- function _unsupported_iterable_to_array$b(o, minLen) {
660
+ function _unsupported_iterable_to_array$a(o, minLen) {
669
661
  if (!o) return;
670
- if (typeof o === "string") return _array_like_to_array$b(o, minLen);
662
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
671
663
  var n = Object.prototype.toString.call(o).slice(8, -1);
672
664
  if (n === "Object" && o.constructor) n = o.constructor.name;
673
665
  if (n === "Map" || n === "Set") return Array.from(n);
674
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
666
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
675
667
  }
676
668
  /**
677
669
  * Creates an {@link IsModifiedFunction} by inverting the result of an {@link IsEqualFunction}.
@@ -987,18 +979,16 @@ function filterIfObjectValuesUnchanged(input) {
987
979
  return result;
988
980
  }
989
981
 
990
- function _array_like_to_array$a(arr, len) {
982
+ function _array_like_to_array$9(arr, len) {
991
983
  if (len == null || len > arr.length) len = arr.length;
992
984
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
993
985
  return arr2;
994
986
  }
995
- function _array_without_holes$5(arr) {
996
- if (Array.isArray(arr)) return _array_like_to_array$a(arr);
987
+ function _array_without_holes$4(arr) {
988
+ if (Array.isArray(arr)) return _array_like_to_array$9(arr);
997
989
  }
998
990
  function _class_call_check$8(instance, Constructor) {
999
- if (!(instance instanceof Constructor)) {
1000
- throw new TypeError("Cannot call a class as a function");
1001
- }
991
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
1002
992
  }
1003
993
  function _defineProperties$7(target, props) {
1004
994
  for(var i = 0; i < props.length; i++){
@@ -1013,7 +1003,7 @@ function _create_class$7(Constructor, protoProps, staticProps) {
1013
1003
  if (protoProps) _defineProperties$7(Constructor.prototype, protoProps);
1014
1004
  return Constructor;
1015
1005
  }
1016
- function _define_property$c(obj, key, value) {
1006
+ function _define_property$d(obj, key, value) {
1017
1007
  if (key in obj) {
1018
1008
  Object.defineProperty(obj, key, {
1019
1009
  value: value,
@@ -1021,27 +1011,27 @@ function _define_property$c(obj, key, value) {
1021
1011
  configurable: true,
1022
1012
  writable: true
1023
1013
  });
1024
- } else {
1025
- obj[key] = value;
1026
- }
1014
+ } else obj[key] = value;
1027
1015
  return obj;
1028
1016
  }
1029
- function _iterable_to_array$5(iter) {
1030
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1017
+ function _iterable_to_array$4(iter) {
1018
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
1019
+ return Array.from(iter);
1020
+ }
1031
1021
  }
1032
- function _non_iterable_spread$5() {
1033
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1022
+ function _non_iterable_spread$4() {
1023
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1034
1024
  }
1035
- function _to_consumable_array$5(arr) {
1036
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$5();
1025
+ function _to_consumable_array$4(arr) {
1026
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$4();
1037
1027
  }
1038
- function _unsupported_iterable_to_array$a(o, minLen) {
1028
+ function _unsupported_iterable_to_array$9(o, minLen) {
1039
1029
  if (!o) return;
1040
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
1030
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
1041
1031
  var n = Object.prototype.toString.call(o).slice(8, -1);
1042
1032
  if (n === "Object" && o.constructor) n = o.constructor.name;
1043
1033
  if (n === "Map" || n === "Set") return Array.from(n);
1044
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
1034
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
1045
1035
  }
1046
1036
  /**
1047
1037
  * Manages a single RxJS subscription with automatic cleanup on reassignment.
@@ -1063,7 +1053,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
1063
1053
  */ var SubscriptionObject = /*#__PURE__*/ function() {
1064
1054
  function SubscriptionObject(sub) {
1065
1055
  _class_call_check$8(this, SubscriptionObject);
1066
- _define_property$c(this, "_subscription", void 0);
1056
+ _define_property$d(this, "_subscription", void 0);
1067
1057
  if (sub) {
1068
1058
  this.setSub(sub);
1069
1059
  }
@@ -1144,7 +1134,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
1144
1134
  */ var MultiSubscriptionObject = /*#__PURE__*/ function() {
1145
1135
  function MultiSubscriptionObject(subs) {
1146
1136
  _class_call_check$8(this, MultiSubscriptionObject);
1147
- _define_property$c(this, "_subscriptions", void 0);
1137
+ _define_property$d(this, "_subscriptions", void 0);
1148
1138
  if (subs) {
1149
1139
  this.setSubs(subs);
1150
1140
  }
@@ -1188,7 +1178,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
1188
1178
  */ key: "addSubs",
1189
1179
  value: function addSubs(subs) {
1190
1180
  var _this__subscriptions;
1191
- var nextSubscriptions = _to_consumable_array$5((_this__subscriptions = this._subscriptions) !== null && _this__subscriptions !== void 0 ? _this__subscriptions : []);
1181
+ var nextSubscriptions = _to_consumable_array$4((_this__subscriptions = this._subscriptions) !== null && _this__subscriptions !== void 0 ? _this__subscriptions : []);
1192
1182
  convertToArray(subs).forEach(function(sub) {
1193
1183
  if (!nextSubscriptions.includes(sub)) {
1194
1184
  nextSubscriptions.push(sub);
@@ -1223,7 +1213,7 @@ function _unsupported_iterable_to_array$a(o, minLen) {
1223
1213
  }
1224
1214
  ();
1225
1215
 
1226
- function _array_like_to_array$9(arr, len) {
1216
+ function _array_like_to_array$8(arr, len) {
1227
1217
  if (len == null || len > arr.length) len = arr.length;
1228
1218
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1229
1219
  return arr2;
@@ -1232,9 +1222,7 @@ function _array_with_holes$4(arr) {
1232
1222
  if (Array.isArray(arr)) return arr;
1233
1223
  }
1234
1224
  function _class_call_check$7(instance, Constructor) {
1235
- if (!(instance instanceof Constructor)) {
1236
- throw new TypeError("Cannot call a class as a function");
1237
- }
1225
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
1238
1226
  }
1239
1227
  function _defineProperties$6(target, props) {
1240
1228
  for(var i = 0; i < props.length; i++){
@@ -1249,7 +1237,7 @@ function _create_class$6(Constructor, protoProps, staticProps) {
1249
1237
  if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
1250
1238
  return Constructor;
1251
1239
  }
1252
- function _define_property$b(obj, key, value) {
1240
+ function _define_property$c(obj, key, value) {
1253
1241
  if (key in obj) {
1254
1242
  Object.defineProperty(obj, key, {
1255
1243
  value: value,
@@ -1257,9 +1245,7 @@ function _define_property$b(obj, key, value) {
1257
1245
  configurable: true,
1258
1246
  writable: true
1259
1247
  });
1260
- } else {
1261
- obj[key] = value;
1262
- }
1248
+ } else obj[key] = value;
1263
1249
  return obj;
1264
1250
  }
1265
1251
  function _iterable_to_array_limit$4(arr, i) {
@@ -1287,18 +1273,18 @@ function _iterable_to_array_limit$4(arr, i) {
1287
1273
  return _arr;
1288
1274
  }
1289
1275
  function _non_iterable_rest$4() {
1290
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1276
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1291
1277
  }
1292
1278
  function _sliced_to_array$4(arr, i) {
1293
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$9(arr, i) || _non_iterable_rest$4();
1279
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$4();
1294
1280
  }
1295
- function _unsupported_iterable_to_array$9(o, minLen) {
1281
+ function _unsupported_iterable_to_array$8(o, minLen) {
1296
1282
  if (!o) return;
1297
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
1283
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
1298
1284
  var n = Object.prototype.toString.call(o).slice(8, -1);
1299
1285
  if (n === "Object" && o.constructor) n = o.constructor.name;
1300
1286
  if (n === "Map" || n === "Set") return Array.from(n);
1301
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
1287
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
1302
1288
  }
1303
1289
  /**
1304
1290
  * Concrete implementation of {@link FilterSource} that manages reactive filter state with
@@ -1326,19 +1312,19 @@ function _unsupported_iterable_to_array$9(o, minLen) {
1326
1312
  function FilterSourceInstance(config) {
1327
1313
  var _this = this;
1328
1314
  _class_call_check$7(this, FilterSourceInstance);
1329
- _define_property$b(this, "_initialFilterSub", new SubscriptionObject());
1330
- _define_property$b(this, "_initialFilterTakesPriority", new BehaviorSubject(false));
1331
- _define_property$b(this, "_filter", new BehaviorSubject(undefined));
1315
+ _define_property$c(this, "_initialFilterSub", new SubscriptionObject());
1316
+ _define_property$c(this, "_initialFilterTakesPriority", new BehaviorSubject(false));
1317
+ _define_property$c(this, "_filter", new BehaviorSubject(undefined));
1332
1318
  /**
1333
1319
  * The initial filter can only pass through observables that always emit a value.
1334
- */ _define_property$b(this, "_initialFilter", new BehaviorSubject(undefined));
1335
- _define_property$b(this, "_defaultFilter", new BehaviorSubject(undefined));
1320
+ */ _define_property$c(this, "_initialFilter", new BehaviorSubject(undefined));
1321
+ _define_property$c(this, "_defaultFilter", new BehaviorSubject(undefined));
1336
1322
  /**
1337
1323
  * Observable of the default filter value, emitting when a default is set.
1338
- */ _define_property$b(this, "defaultFilter$", this._defaultFilter.pipe(switchMapFilterMaybe()));
1324
+ */ _define_property$c(this, "defaultFilter$", this._defaultFilter.pipe(switchMapFilterMaybe()));
1339
1325
  /**
1340
1326
  * Observable that emits the initial filter value, preferring the init filter over the default.
1341
- */ _define_property$b(this, "initialFilter$", combineLatest([
1327
+ */ _define_property$c(this, "initialFilter$", combineLatest([
1342
1328
  this._initialFilter,
1343
1329
  this._defaultFilter
1344
1330
  ]).pipe(map(function(param) {
@@ -1348,7 +1334,7 @@ function _unsupported_iterable_to_array$9(o, minLen) {
1348
1334
  /**
1349
1335
  * Observable of the active filter value, resolving to the explicit filter if set,
1350
1336
  * otherwise falling back to the initial/default filter. Deduplicated by deep value equality.
1351
- */ _define_property$b(this, "filter$", this._filter.pipe(switchMap(function(x) {
1337
+ */ _define_property$c(this, "filter$", this._filter.pipe(switchMap(function(x) {
1352
1338
  return x == null ? _this.initialFilter$ : of(x);
1353
1339
  }), filterMaybe(), distinctUntilObjectValuesChanged(), shareReplay(1)));
1354
1340
  var _ref = config !== null && config !== void 0 ? config : {}, initWithFilter = _ref.initWithFilter, defaultFilter = _ref.defaultFilter, filter = _ref.filter;
@@ -1459,18 +1445,16 @@ function _unsupported_iterable_to_array$9(o, minLen) {
1459
1445
  }
1460
1446
  ();
1461
1447
 
1462
- function _array_like_to_array$8(arr, len) {
1448
+ function _array_like_to_array$7(arr, len) {
1463
1449
  if (len == null || len > arr.length) len = arr.length;
1464
1450
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1465
1451
  return arr2;
1466
1452
  }
1467
- function _array_without_holes$4(arr) {
1468
- if (Array.isArray(arr)) return _array_like_to_array$8(arr);
1453
+ function _array_without_holes$3(arr) {
1454
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
1469
1455
  }
1470
1456
  function _class_call_check$6(instance, Constructor) {
1471
- if (!(instance instanceof Constructor)) {
1472
- throw new TypeError("Cannot call a class as a function");
1473
- }
1457
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
1474
1458
  }
1475
1459
  function _defineProperties$5(target, props) {
1476
1460
  for(var i = 0; i < props.length; i++){
@@ -1485,7 +1469,7 @@ function _create_class$5(Constructor, protoProps, staticProps) {
1485
1469
  if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
1486
1470
  return Constructor;
1487
1471
  }
1488
- function _define_property$a(obj, key, value) {
1472
+ function _define_property$b(obj, key, value) {
1489
1473
  if (key in obj) {
1490
1474
  Object.defineProperty(obj, key, {
1491
1475
  value: value,
@@ -1493,27 +1477,27 @@ function _define_property$a(obj, key, value) {
1493
1477
  configurable: true,
1494
1478
  writable: true
1495
1479
  });
1496
- } else {
1497
- obj[key] = value;
1498
- }
1480
+ } else obj[key] = value;
1499
1481
  return obj;
1500
1482
  }
1501
- function _iterable_to_array$4(iter) {
1502
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1483
+ function _iterable_to_array$3(iter) {
1484
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
1485
+ return Array.from(iter);
1486
+ }
1503
1487
  }
1504
- function _non_iterable_spread$4() {
1505
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1488
+ function _non_iterable_spread$3() {
1489
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1506
1490
  }
1507
- function _to_consumable_array$4(arr) {
1508
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$4();
1491
+ function _to_consumable_array$3(arr) {
1492
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$3();
1509
1493
  }
1510
- function _unsupported_iterable_to_array$8(o, minLen) {
1494
+ function _unsupported_iterable_to_array$7(o, minLen) {
1511
1495
  if (!o) return;
1512
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
1496
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
1513
1497
  var n = Object.prototype.toString.call(o).slice(8, -1);
1514
1498
  if (n === "Object" && o.constructor) n = o.constructor.name;
1515
1499
  if (n === "Map" || n === "Set") return Array.from(n);
1516
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
1500
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
1517
1501
  }
1518
1502
  /**
1519
1503
  * Manages a collection of reactive filters keyed by string identifiers.
@@ -1535,7 +1519,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
1535
1519
  */ var FilterMap = /*#__PURE__*/ function() {
1536
1520
  function FilterMap() {
1537
1521
  _class_call_check$6(this, FilterMap);
1538
- _define_property$a(this, "_map", new BehaviorSubject(new Map()));
1522
+ _define_property$b(this, "_map", new BehaviorSubject(new Map()));
1539
1523
  }
1540
1524
  _create_class$5(FilterMap, [
1541
1525
  {
@@ -1639,11 +1623,11 @@ function _unsupported_iterable_to_array$8(o, minLen) {
1639
1623
  */ var FilterMapKeyInstance = /*#__PURE__*/ function() {
1640
1624
  function FilterMapKeyInstance(dbxFilterMap, key) {
1641
1625
  _class_call_check$6(this, FilterMapKeyInstance);
1642
- _define_property$a(this, "_dbxFilterMap", void 0);
1643
- _define_property$a(this, "_key", void 0);
1626
+ _define_property$b(this, "_dbxFilterMap", void 0);
1627
+ _define_property$b(this, "_key", void 0);
1644
1628
  /**
1645
1629
  * Observable of the filter value for this instance's key.
1646
- */ _define_property$a(this, "filter$", void 0);
1630
+ */ _define_property$b(this, "filter$", void 0);
1647
1631
  this._dbxFilterMap = dbxFilterMap;
1648
1632
  this._key = key;
1649
1633
  this.filter$ = this._dbxFilterMap.filterForKey(this._key);
@@ -1687,17 +1671,17 @@ function _unsupported_iterable_to_array$8(o, minLen) {
1687
1671
  var FilterMapItem = /*#__PURE__*/ function() {
1688
1672
  function FilterMapItem(dbxFilterMap, key) {
1689
1673
  _class_call_check$6(this, FilterMapItem);
1690
- _define_property$a(this, "_dbxFilterMap", void 0);
1691
- _define_property$a(this, "_key", void 0);
1692
- _define_property$a(this, "_i", 0);
1693
- _define_property$a(this, "_source", new FilterSourceInstance());
1694
- _define_property$a(this, "_obs", new BehaviorSubject([]));
1695
- _define_property$a(this, "_obs$", this._obs.pipe(switchMap(function(x) {
1696
- return merge.apply(void 0, _to_consumable_array$4(x.map(function(y) {
1674
+ _define_property$b(this, "_dbxFilterMap", void 0);
1675
+ _define_property$b(this, "_key", void 0);
1676
+ _define_property$b(this, "_i", 0);
1677
+ _define_property$b(this, "_source", new FilterSourceInstance());
1678
+ _define_property$b(this, "_obs", new BehaviorSubject([]));
1679
+ _define_property$b(this, "_obs$", this._obs.pipe(switchMap(function(x) {
1680
+ return merge.apply(void 0, _to_consumable_array$3(x.map(function(y) {
1697
1681
  return y.obs;
1698
1682
  })));
1699
1683
  }), distinctUntilChanged()));
1700
- _define_property$a(this, "filter$", this._source.initialFilter$);
1684
+ _define_property$b(this, "filter$", this._source.initialFilter$);
1701
1685
  this._dbxFilterMap = dbxFilterMap;
1702
1686
  this._key = key;
1703
1687
  }
@@ -1734,7 +1718,7 @@ var FilterMapItem = /*#__PURE__*/ function() {
1734
1718
  var deleteOnComplete = obs.pipe(finalize(function() {
1735
1719
  _this._deleteFilterObs(i);
1736
1720
  })).subscribe();
1737
- var nextObs = _to_consumable_array$4(currentObs).concat([
1721
+ var nextObs = _to_consumable_array$3(currentObs).concat([
1738
1722
  {
1739
1723
  i: i,
1740
1724
  obs: obs,
@@ -1826,9 +1810,7 @@ var FilterMapItem = /*#__PURE__*/ function() {
1826
1810
  }
1827
1811
 
1828
1812
  function _assert_this_initialized$1(self) {
1829
- if (self === void 0) {
1830
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1831
- }
1813
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1832
1814
  return self;
1833
1815
  }
1834
1816
  function _call_super$1(_this, derived, args) {
@@ -1836,9 +1818,7 @@ function _call_super$1(_this, derived, args) {
1836
1818
  return _possible_constructor_return$1(_this, _is_native_reflect_construct$1() ? Reflect.construct(derived, args || [], _get_prototype_of$1(_this).constructor) : derived.apply(_this, args));
1837
1819
  }
1838
1820
  function _class_call_check$5(instance, Constructor) {
1839
- if (!(instance instanceof Constructor)) {
1840
- throw new TypeError("Cannot call a class as a function");
1841
- }
1821
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
1842
1822
  }
1843
1823
  function _get_prototype_of$1(o) {
1844
1824
  _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
@@ -1859,10 +1839,16 @@ function _inherits$1(subClass, superClass) {
1859
1839
  });
1860
1840
  if (superClass) _set_prototype_of$1(subClass, superClass);
1861
1841
  }
1842
+ function _is_native_reflect_construct$1() {
1843
+ try {
1844
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1845
+ } catch (_) {}
1846
+ return (_is_native_reflect_construct$1 = function() {
1847
+ return !!result;
1848
+ })();
1849
+ }
1862
1850
  function _possible_constructor_return$1(self, call) {
1863
- if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
1864
- return call;
1865
- }
1851
+ if (call && (_type_of$3(call) === "object" || typeof call === "function")) return call;
1866
1852
  return _assert_this_initialized$1(self);
1867
1853
  }
1868
1854
  function _set_prototype_of$1(o, p) {
@@ -1876,14 +1862,6 @@ function _type_of$3(obj) {
1876
1862
  "@swc/helpers - typeof";
1877
1863
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1878
1864
  }
1879
- function _is_native_reflect_construct$1() {
1880
- try {
1881
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1882
- } catch (_) {}
1883
- return (_is_native_reflect_construct$1 = function() {
1884
- return !!result;
1885
- })();
1886
- }
1887
1865
  /**
1888
1866
  * Abstract base class for providing reactive filter state.
1889
1867
  *
@@ -1921,11 +1899,8 @@ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
1921
1899
  reject(error);
1922
1900
  return;
1923
1901
  }
1924
- if (info.done) {
1925
- resolve(value);
1926
- } else {
1927
- Promise.resolve(value).then(_next, _throw);
1928
- }
1902
+ if (info.done) resolve(value);
1903
+ else Promise.resolve(value).then(_next, _throw);
1929
1904
  }
1930
1905
  function _async_to_generator$1(fn) {
1931
1906
  return function() {
@@ -2126,30 +2101,32 @@ function _ts_generator$1(thisArg, body) {
2126
2101
  });
2127
2102
  }
2128
2103
 
2129
- function _array_like_to_array$7(arr, len) {
2104
+ function _array_like_to_array$6(arr, len) {
2130
2105
  if (len == null || len > arr.length) len = arr.length;
2131
2106
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2132
2107
  return arr2;
2133
2108
  }
2134
- function _array_without_holes$3(arr) {
2135
- if (Array.isArray(arr)) return _array_like_to_array$7(arr);
2109
+ function _array_without_holes$2(arr) {
2110
+ if (Array.isArray(arr)) return _array_like_to_array$6(arr);
2136
2111
  }
2137
- function _iterable_to_array$3(iter) {
2138
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2112
+ function _iterable_to_array$2(iter) {
2113
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
2114
+ return Array.from(iter);
2115
+ }
2139
2116
  }
2140
- function _non_iterable_spread$3() {
2141
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2117
+ function _non_iterable_spread$2() {
2118
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2142
2119
  }
2143
- function _to_consumable_array$3(arr) {
2144
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$3();
2120
+ function _to_consumable_array$2(arr) {
2121
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$2();
2145
2122
  }
2146
- function _unsupported_iterable_to_array$7(o, minLen) {
2123
+ function _unsupported_iterable_to_array$6(o, minLen) {
2147
2124
  if (!o) return;
2148
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
2125
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
2149
2126
  var n = Object.prototype.toString.call(o).slice(8, -1);
2150
2127
  if (n === "Object" && o.constructor) n = o.constructor.name;
2151
2128
  if (n === "Map" || n === "Set") return Array.from(n);
2152
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
2129
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
2153
2130
  }
2154
2131
  function distinctUntilArrayLengthChanges(inputGetArray) {
2155
2132
  var getArray = inputGetArray !== null && inputGetArray !== void 0 ? inputGetArray : function(value) {
@@ -2167,7 +2144,7 @@ function scanIntoArray() {
2167
2144
  return scan(function(acc, next) {
2168
2145
  if (next != null) {
2169
2146
  if (immutable) {
2170
- acc = _to_consumable_array$3(acc).concat(_to_consumable_array$3(asArray(next)));
2147
+ acc = _to_consumable_array$2(acc).concat(_to_consumable_array$2(asArray(next)));
2171
2148
  } else {
2172
2149
  acc = pushItemOrArrayItemsIntoArray(acc, next);
2173
2150
  }
@@ -2197,7 +2174,7 @@ function scanIntoArray() {
2197
2174
  }
2198
2175
  return acc;
2199
2176
  }, seed !== null && seed !== void 0 ? seed : []), distinctUntilArrayLengthChanges(), map(function(x) {
2200
- return _to_consumable_array$3(x);
2177
+ return _to_consumable_array$2(x);
2201
2178
  }), shareReplay(1));
2202
2179
  });
2203
2180
  }
@@ -2761,7 +2738,7 @@ function tapLog(messageOrFunction) {
2761
2738
  return distinctUntilChanged(mapsHaveSameKeys);
2762
2739
  }
2763
2740
 
2764
- function _define_property$9(obj, key, value) {
2741
+ function _define_property$a(obj, key, value) {
2765
2742
  if (key in obj) {
2766
2743
  Object.defineProperty(obj, key, {
2767
2744
  value: value,
@@ -2769,12 +2746,10 @@ function _define_property$9(obj, key, value) {
2769
2746
  configurable: true,
2770
2747
  writable: true
2771
2748
  });
2772
- } else {
2773
- obj[key] = value;
2774
- }
2749
+ } else obj[key] = value;
2775
2750
  return obj;
2776
2751
  }
2777
- function _object_spread$7(target) {
2752
+ function _object_spread$8(target) {
2778
2753
  for(var i = 1; i < arguments.length; i++){
2779
2754
  var source = arguments[i] != null ? arguments[i] : {};
2780
2755
  var ownKeys = Object.keys(source);
@@ -2784,12 +2759,12 @@ function _object_spread$7(target) {
2784
2759
  }));
2785
2760
  }
2786
2761
  ownKeys.forEach(function(key) {
2787
- _define_property$9(target, key, source[key]);
2762
+ _define_property$a(target, key, source[key]);
2788
2763
  });
2789
2764
  }
2790
2765
  return target;
2791
2766
  }
2792
- function ownKeys$7(object, enumerableOnly) {
2767
+ function ownKeys$8(object, enumerableOnly) {
2793
2768
  var keys = Object.keys(object);
2794
2769
  if (Object.getOwnPropertySymbols) {
2795
2770
  var symbols = Object.getOwnPropertySymbols(object);
@@ -2797,12 +2772,11 @@ function ownKeys$7(object, enumerableOnly) {
2797
2772
  }
2798
2773
  return keys;
2799
2774
  }
2800
- function _object_spread_props$7(target, source) {
2775
+ function _object_spread_props$8(target, source) {
2801
2776
  source = source != null ? source : {};
2802
- if (Object.getOwnPropertyDescriptors) {
2803
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2804
- } else {
2805
- ownKeys$7(Object(source)).forEach(function(key) {
2777
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2778
+ else {
2779
+ ownKeys$8(Object(source)).forEach(function(key) {
2806
2780
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2807
2781
  });
2808
2782
  }
@@ -2827,12 +2801,12 @@ function _object_spread_props$7(target, source) {
2827
2801
  * @returns An observable of incrementing numbers.
2828
2802
  */ function incrementingNumberTimer() {
2829
2803
  var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2830
- return factoryTimer(_object_spread_props$7(_object_spread$7({}, config), {
2804
+ return factoryTimer(_object_spread_props$8(_object_spread$8({}, config), {
2831
2805
  factory: incrementingNumberFactory(config)
2832
2806
  }));
2833
2807
  }
2834
2808
 
2835
- function _array_like_to_array$6(arr, len) {
2809
+ function _array_like_to_array$5(arr, len) {
2836
2810
  if (len == null || len > arr.length) len = arr.length;
2837
2811
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2838
2812
  return arr2;
@@ -2865,18 +2839,18 @@ function _iterable_to_array_limit$3(arr, i) {
2865
2839
  return _arr;
2866
2840
  }
2867
2841
  function _non_iterable_rest$3() {
2868
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2842
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2869
2843
  }
2870
2844
  function _sliced_to_array$3(arr, i) {
2871
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$3();
2845
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$3();
2872
2846
  }
2873
- function _unsupported_iterable_to_array$6(o, minLen) {
2847
+ function _unsupported_iterable_to_array$5(o, minLen) {
2874
2848
  if (!o) return;
2875
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
2849
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
2876
2850
  var n = Object.prototype.toString.call(o).slice(8, -1);
2877
2851
  if (n === "Object" && o.constructor) n = o.constructor.name;
2878
2852
  if (n === "Map" || n === "Set") return Array.from(n);
2879
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
2853
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
2880
2854
  }
2881
2855
  /**
2882
2856
  * Combines `startWith` and {@link tapFirst} to initialize an observable pipe with a side-effect on the first emission.
@@ -3041,7 +3015,7 @@ function _unsupported_iterable_to_array$6(o, minLen) {
3041
3015
  });
3042
3016
  }
3043
3017
 
3044
- function _array_like_to_array$5(arr, len) {
3018
+ function _array_like_to_array$4(arr, len) {
3045
3019
  if (len == null || len > arr.length) len = arr.length;
3046
3020
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3047
3021
  return arr2;
@@ -3074,18 +3048,18 @@ function _iterable_to_array_limit$2(arr, i) {
3074
3048
  return _arr;
3075
3049
  }
3076
3050
  function _non_iterable_rest$2() {
3077
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3051
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3078
3052
  }
3079
3053
  function _sliced_to_array$2(arr, i) {
3080
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$2();
3054
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$2();
3081
3055
  }
3082
- function _unsupported_iterable_to_array$5(o, minLen) {
3056
+ function _unsupported_iterable_to_array$4(o, minLen) {
3083
3057
  if (!o) return;
3084
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
3058
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
3085
3059
  var n = Object.prototype.toString.call(o).slice(8, -1);
3086
3060
  if (n === "Object" && o.constructor) n = o.constructor.name;
3087
3061
  if (n === "Map" || n === "Set") return Array.from(n);
3088
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
3062
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
3089
3063
  }
3090
3064
  /**
3091
3065
  * Creates a function that takes a `Map` and combines the latest emissions from observables
@@ -3334,15 +3308,15 @@ function _unsupported_iterable_to_array$5(o, minLen) {
3334
3308
  });
3335
3309
  }
3336
3310
 
3337
- function _array_like_to_array$4(arr, len) {
3311
+ function _array_like_to_array$3(arr, len) {
3338
3312
  if (len == null || len > arr.length) len = arr.length;
3339
3313
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3340
3314
  return arr2;
3341
3315
  }
3342
- function _array_without_holes$2(arr) {
3343
- if (Array.isArray(arr)) return _array_like_to_array$4(arr);
3316
+ function _array_without_holes$1(arr) {
3317
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
3344
3318
  }
3345
- function _define_property$8(obj, key, value) {
3319
+ function _define_property$9(obj, key, value) {
3346
3320
  if (key in obj) {
3347
3321
  Object.defineProperty(obj, key, {
3348
3322
  value: value,
@@ -3350,18 +3324,18 @@ function _define_property$8(obj, key, value) {
3350
3324
  configurable: true,
3351
3325
  writable: true
3352
3326
  });
3353
- } else {
3354
- obj[key] = value;
3355
- }
3327
+ } else obj[key] = value;
3356
3328
  return obj;
3357
3329
  }
3358
- function _iterable_to_array$2(iter) {
3359
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3330
+ function _iterable_to_array$1(iter) {
3331
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
3332
+ return Array.from(iter);
3333
+ }
3360
3334
  }
3361
- function _non_iterable_spread$2() {
3362
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3335
+ function _non_iterable_spread$1() {
3336
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3363
3337
  }
3364
- function _object_spread$6(target) {
3338
+ function _object_spread$7(target) {
3365
3339
  for(var i = 1; i < arguments.length; i++){
3366
3340
  var source = arguments[i] != null ? arguments[i] : {};
3367
3341
  var ownKeys = Object.keys(source);
@@ -3371,12 +3345,12 @@ function _object_spread$6(target) {
3371
3345
  }));
3372
3346
  }
3373
3347
  ownKeys.forEach(function(key) {
3374
- _define_property$8(target, key, source[key]);
3348
+ _define_property$9(target, key, source[key]);
3375
3349
  });
3376
3350
  }
3377
3351
  return target;
3378
3352
  }
3379
- function ownKeys$6(object, enumerableOnly) {
3353
+ function ownKeys$7(object, enumerableOnly) {
3380
3354
  var keys = Object.keys(object);
3381
3355
  if (Object.getOwnPropertySymbols) {
3382
3356
  var symbols = Object.getOwnPropertySymbols(object);
@@ -3384,27 +3358,26 @@ function ownKeys$6(object, enumerableOnly) {
3384
3358
  }
3385
3359
  return keys;
3386
3360
  }
3387
- function _object_spread_props$6(target, source) {
3361
+ function _object_spread_props$7(target, source) {
3388
3362
  source = source != null ? source : {};
3389
- if (Object.getOwnPropertyDescriptors) {
3390
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3391
- } else {
3392
- ownKeys$6(Object(source)).forEach(function(key) {
3363
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3364
+ else {
3365
+ ownKeys$7(Object(source)).forEach(function(key) {
3393
3366
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3394
3367
  });
3395
3368
  }
3396
3369
  return target;
3397
3370
  }
3398
- function _to_consumable_array$2(arr) {
3399
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$2();
3371
+ function _to_consumable_array$1(arr) {
3372
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$1();
3400
3373
  }
3401
- function _unsupported_iterable_to_array$4(o, minLen) {
3374
+ function _unsupported_iterable_to_array$3(o, minLen) {
3402
3375
  if (!o) return;
3403
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
3376
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
3404
3377
  var n = Object.prototype.toString.call(o).slice(8, -1);
3405
3378
  if (n === "Object" && o.constructor) n = o.constructor.name;
3406
3379
  if (n === "Map" || n === "Set") return Array.from(n);
3407
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
3380
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
3408
3381
  }
3409
3382
  /**
3410
3383
  * Compares two {@link LoadingState} instances for shallow equality across all key properties.
@@ -3476,14 +3449,19 @@ function _unsupported_iterable_to_array$4(o, minLen) {
3476
3449
  var type;
3477
3450
  if (isLoading) {
3478
3451
  type = LoadingStateType.LOADING;
3452
+ } else if (loadingState.error != null) {
3453
+ /**
3454
+ * The error is checked first: a state can legitimately carry both an error and a value (for
3455
+ * instance a state mapped through mapLoadingStateResults, or one merged via
3456
+ * mergeLoadingStateWithError), and an error always wins over a stale value.
3457
+ */ type = LoadingStateType.ERROR;
3458
+ } else if (objectHasKey(loadingState, 'value')) {
3459
+ /**
3460
+ * The own-key test is deliberate for `value` (and only for `value`): `value: null` is a
3461
+ * meaningful "loaded, but empty" signal, so key presence rather than nullishness decides success.
3462
+ */ type = LoadingStateType.SUCCESS;
3479
3463
  } else {
3480
- if (objectHasKey(loadingState, 'value')) {
3481
- type = LoadingStateType.SUCCESS;
3482
- } else if (objectHasKey(loadingState, 'error')) {
3483
- type = LoadingStateType.ERROR;
3484
- } else {
3485
- type = LoadingStateType.IDLE;
3486
- }
3464
+ type = LoadingStateType.IDLE;
3487
3465
  }
3488
3466
  return type;
3489
3467
  }
@@ -3535,7 +3513,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
3535
3513
  };
3536
3514
  }
3537
3515
  function beginLoading(state) {
3538
- return state ? _object_spread_props$6(_object_spread$6({}, state), {
3516
+ return state ? _object_spread_props$7(_object_spread$7({}, state), {
3539
3517
  loading: true
3540
3518
  }) : {
3541
3519
  loading: true
@@ -3548,9 +3526,8 @@ function beginLoading(state) {
3548
3526
  * @param state - Optional partial state to merge.
3549
3527
  * @returns A page loading state with `loading: true`
3550
3528
  */ function beginLoadingPage(page, state) {
3551
- return state ? _object_spread_props$6(_object_spread$6({
3552
- page: page
3553
- }, state), {
3529
+ return state ? _object_spread_props$7(_object_spread$7({}, state), {
3530
+ page: page,
3554
3531
  loading: true
3555
3532
  }) : {
3556
3533
  page: page,
@@ -3581,24 +3558,11 @@ function beginLoading(state) {
3581
3558
  * @param value - The loaded value.
3582
3559
  * @returns A page loading state representing success.
3583
3560
  */ function successPageResult(page, value) {
3584
- return _object_spread_props$6(_object_spread$6({}, successResult(value)), {
3561
+ return _object_spread_props$7(_object_spread$7({}, successResult(value)), {
3585
3562
  page: page
3586
3563
  });
3587
3564
  }
3588
- /**
3589
- * Creates a {@link LoadingState} representing an error with `loading: false`.
3590
- *
3591
- * Converts the input error to a {@link ReadableError} via {@link toReadableError}.
3592
- *
3593
- * @param error - The error to wrap (string, Error, or ReadableError)
3594
- * @returns A loading state representing an error.
3595
- *
3596
- * @example
3597
- * ```ts
3598
- * const state = errorResult(new Error('Not found'));
3599
- * // { error: { message: 'Not found', ... }, loading: false }
3600
- * ```
3601
- */ function errorResult(error) {
3565
+ function errorResult(error) {
3602
3566
  return {
3603
3567
  error: toReadableError(error),
3604
3568
  loading: false
@@ -3611,7 +3575,7 @@ function beginLoading(state) {
3611
3575
  * @param error - The error to include.
3612
3576
  * @returns A page loading state representing an error.
3613
3577
  */ function errorPageResult(page, error) {
3614
- return _object_spread_props$6(_object_spread$6({}, errorResult(error)), {
3578
+ return _object_spread_props$7(_object_spread$7({}, errorResult(error)), {
3615
3579
  page: page
3616
3580
  });
3617
3581
  }
@@ -3752,6 +3716,84 @@ function beginLoading(state) {
3752
3716
  */ function isPageLoadingStateMetadataEqual(a, b) {
3753
3717
  return valuesAreBothNullishOrEquivalent(a.page, b.page) && a.loading == b.loading && valuesAreBothNullishOrEquivalent(a.error, b.error);
3754
3718
  }
3719
+ // MARK: Accessors
3720
+ /**
3721
+ * Type guard that checks whether the input {@link LoadingState} also carries a {@link Page}.
3722
+ *
3723
+ * `Page` is intentionally kept orthogonal to `LoadingState`, so this is the supported way to ask a
3724
+ * state whether it is paginated without hoisting page keys onto the base type.
3725
+ *
3726
+ * @param state - The loading state to check (may be null/undefined)
3727
+ * @returns True when the state is present and exposes a numeric `page`.
3728
+ *
3729
+ * @example
3730
+ * ```ts
3731
+ * isPageLoadingState(successPageResult(0, 'a')); // true
3732
+ * isPageLoadingState(successResult('a')); // false
3733
+ * ```
3734
+ */ function isPageLoadingState(state) {
3735
+ return state != null && typeof state.page === 'number';
3736
+ }
3737
+ /**
3738
+ * Reads the `hasNextPage` flag from the input state, if it carries one.
3739
+ *
3740
+ * @param state - The loading state to read from (may be null/undefined)
3741
+ * @returns The `hasNextPage` value, or null/undefined when the state is absent or not paginated.
3742
+ *
3743
+ * @example
3744
+ * ```ts
3745
+ * loadingStateHasNextPage({ page: 0, loading: false, hasNextPage: true }); // true
3746
+ * loadingStateHasNextPage(successResult('a')); // undefined
3747
+ * ```
3748
+ */ function loadingStateHasNextPage(state) {
3749
+ /**
3750
+ * Documented cast: `hasNextPage` lives on {@link PageLoadingState}, which is orthogonal to the
3751
+ * {@link LoadingState} apparent type, so it can only be reached structurally. This is the one place
3752
+ * that does so, instead of every caller writing `x as unknown as PageLoadingState`.
3753
+ */ return state === null || state === void 0 ? void 0 : state.hasNextPage;
3754
+ }
3755
+ /**
3756
+ * Reads the value of a generic {@link LoadingState}.
3757
+ *
3758
+ * Reading `state.value` where `state: L` resolves through `L`'s apparent type (its constraint), which
3759
+ * yields `Maybe<unknown>` rather than `Maybe<LoadingStateValue<L>>`. This is the single documented
3760
+ * site that casts that back, so no other function in the library needs to.
3761
+ *
3762
+ * @param state - The loading state to read the value from.
3763
+ * @returns The state's value, typed as the state's value type.
3764
+ *
3765
+ * @example
3766
+ * ```ts
3767
+ * loadingStateValue(successResult('a')); // 'a'
3768
+ * loadingStateValue(beginLoading<string>()); // undefined
3769
+ * ```
3770
+ */ function loadingStateValue(state) {
3771
+ return state.value;
3772
+ }
3773
+ /**
3774
+ * Copies the input state, replacing only its value, and retypes the result to match.
3775
+ *
3776
+ * Distinct from {@link mergeLoadingStateWithValue}, which additionally forces `loading: false` and
3777
+ * clears any error; this preserves the input state's metadata (including `loading` and `error`)
3778
+ * exactly and swaps the value alone.
3779
+ *
3780
+ * @param state - The state to copy metadata from.
3781
+ * @param value - The replacement value.
3782
+ * @returns The state with its value type replaced.
3783
+ *
3784
+ * @example
3785
+ * ```ts
3786
+ * loadingStateWithValueType(successPageResult(0, 'a'), 1); // { page: 0, loading: false, value: 1 }
3787
+ * ```
3788
+ */ function loadingStateWithValueType(state, value) {
3789
+ /**
3790
+ * Documented cast: no formulation of {@link LoadingStateWithValueType} lets a spread literal satisfy
3791
+ * it while `L` is still generic (mapped-type and `Omit`-free variants were both checked). The target
3792
+ * is one cast site rather than zero, and this is it.
3793
+ */ return _object_spread_props$7(_object_spread$7({}, state), {
3794
+ value: value
3795
+ });
3796
+ }
3755
3797
  // eslint-disable-next-line jsdoc/require-jsdoc -- JSDoc is on the overload signatures above
3756
3798
  function mergeLoadingStates() {
3757
3799
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
@@ -3796,7 +3838,7 @@ function mergeLoadingStates() {
3796
3838
  var values = loadingStates.map(function(x) {
3797
3839
  return x.value;
3798
3840
  });
3799
- var value = mergeFn.apply(void 0, _to_consumable_array$2(values));
3841
+ var value = mergeFn.apply(void 0, _to_consumable_array$1(values));
3800
3842
  result = {
3801
3843
  loading: false,
3802
3844
  value: value
@@ -3805,6 +3847,30 @@ function mergeLoadingStates() {
3805
3847
  }
3806
3848
  return result;
3807
3849
  }
3850
+ /**
3851
+ * Merges an array of {@link LoadingState} instances into a single combined state.
3852
+ *
3853
+ * The non-variadic counterpart to {@link mergeLoadingStates}: because the states arrive as one array
3854
+ * argument rather than as rest arguments, the output value type `O` is inferable from `mergeFn` and
3855
+ * the call site needs no cast.
3856
+ *
3857
+ * @param states - The loading states to merge.
3858
+ * @param mergeFn - Optional function merging the states' values; defaults to `mergeObjects`.
3859
+ * @returns The combined loading state.
3860
+ *
3861
+ * @example
3862
+ * ```ts
3863
+ * mergeLoadingStatesArray([successResult({ a: 1 }), successResult({ b: 2 })]);
3864
+ * // { loading: false, value: { a: 1, b: 2 } }
3865
+ *
3866
+ * mergeLoadingStatesArray([successResult(1), successResult(2)], (a: number, b: number) => a + b);
3867
+ * // { loading: false, value: 3 }
3868
+ * ```
3869
+ */ function mergeLoadingStatesArray(states, mergeFn) {
3870
+ return mergeLoadingStates.apply(void 0, _to_consumable_array$1(states).concat([
3871
+ mergeFn
3872
+ ]));
3873
+ }
3808
3874
  /**
3809
3875
  * Returns a copy of the state with the value and error cleared, and `loading` set to the given flag.
3810
3876
  *
@@ -3815,7 +3881,7 @@ function mergeLoadingStates() {
3815
3881
  * @returns A new state with value/error cleared.
3816
3882
  */ function mergeLoadingStateWithLoading(state) {
3817
3883
  var loading = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
3818
- return _object_spread_props$6(_object_spread$6({}, state), {
3884
+ return _object_spread_props$7(_object_spread$7({}, state), {
3819
3885
  value: undefined,
3820
3886
  loading: loading,
3821
3887
  error: undefined
@@ -3828,7 +3894,7 @@ function mergeLoadingStates() {
3828
3894
  * @param value - The new value to set.
3829
3895
  * @returns A new state representing success.
3830
3896
  */ function mergeLoadingStateWithValue(state, value) {
3831
- return _object_spread_props$6(_object_spread$6({}, state), {
3897
+ return _object_spread_props$7(_object_spread$7({}, state), {
3832
3898
  value: value !== null && value !== void 0 ? value : undefined,
3833
3899
  loading: false,
3834
3900
  error: undefined
@@ -3841,48 +3907,36 @@ function mergeLoadingStates() {
3841
3907
  * @param error - The error to set.
3842
3908
  * @returns A new state representing an error.
3843
3909
  */ function mergeLoadingStateWithError(state, error) {
3844
- return _object_spread_props$6(_object_spread$6({}, state), {
3910
+ /**
3911
+ * The spread carries `value` through untouched, which is what the runtime should do — re-assigning
3912
+ * it would add a `value` own-key to a state that had none and flip its {@link LoadingStateType}.
3913
+ * The cast only restores `value`'s type, which the spread widened to `unknown` via `S`'s apparent
3914
+ * type; see {@link loadingStateValue} for the same apparent-type problem stated once.
3915
+ */ return _object_spread_props$7(_object_spread$7({}, state), {
3845
3916
  loading: false,
3846
3917
  error: error
3847
3918
  });
3848
3919
  }
3849
3920
  /**
3850
- * Maps multiple {@link LoadingState} results into a single state using a value mapping or state mapping function.
3921
+ * Maps the value of a single {@link LoadingState} to a new type using the provided configuration.
3851
3922
  *
3852
- * Returns `undefined` if any input is still loading or has an error.
3923
+ * Preserves the loading/error metadata while transforming the value via `mapValue` or the entire
3924
+ * state via `mapState`. When `alwaysMapValue` is true, maps even when the value is null/undefined.
3853
3925
  *
3854
- * @param input - Array of loading states to combine.
3855
- * @param config - Mapping configuration with either `mapValues` or `mapState`
3856
- * @returns The combined loading state, or undefined if inputs are not ready.
3857
- * @throws {Error} When neither `mapValues` nor `mapState` is provided in the config.
3858
- */ function mapMultipleLoadingStateResults(input, config) {
3859
- var mapValues = config.mapValues, mapState = config.mapState;
3860
- var loading = isAnyLoadingStateInLoadingState(input);
3861
- var error = input.map(function(x) {
3862
- return x.error;
3863
- }).find(Boolean);
3864
- var result;
3865
- if (!error && !loading) {
3866
- if (mapValues) {
3867
- var value = mapValues(input.map(function(x) {
3868
- return x.value;
3869
- }));
3870
- result = {
3871
- loading: loading,
3872
- value: value,
3873
- error: error
3874
- };
3875
- } else if (mapState) {
3876
- result = mapState(input);
3877
- } else {
3878
- throw new Error('Incomplete mapMultipleLoadingStateResults configuration');
3879
- }
3880
- }
3881
- return result;
3882
- }
3883
- function mapLoadingStateResults(input, config) {
3926
+ * @param input - The loading state to transform.
3927
+ * @param config - Mapping configuration.
3928
+ * @returns The transformed loading state.
3929
+ *
3930
+ * @example
3931
+ * ```ts
3932
+ * const result = mapLoadingStateResults(successResult(0), {
3933
+ * mapValue: (v) => `Value: ${v}`
3934
+ * });
3935
+ * // { value: 'Value: 0', loading: false }
3936
+ * ```
3937
+ */ function mapLoadingStateResults(input, config) {
3884
3938
  var mapValue = config.mapValue, mapState = config.mapState, _config_alwaysMapValue = config.alwaysMapValue, alwaysMapValue = _config_alwaysMapValue === void 0 ? false : _config_alwaysMapValue;
3885
- var inputValue = input.value;
3939
+ var inputValue = loadingStateValue(input);
3886
3940
  var value;
3887
3941
  if ((inputValue != null || alwaysMapValue) && mapValue) {
3888
3942
  value = mapValue(inputValue, input);
@@ -3893,9 +3947,9 @@ function mapLoadingStateResults(input, config) {
3893
3947
  if (mapState) {
3894
3948
  result = mapState(input, value);
3895
3949
  } else {
3896
- result = _object_spread_props$6(_object_spread$6({}, input), {
3897
- value: value
3898
- });
3950
+ // `O` may be instantiated more narrowly than its LoadingStateWithValueType<L, B> default, so the
3951
+ // constructed state cannot be proven to be an `O` while both remain generic.
3952
+ result = loadingStateWithValueType(input, value);
3899
3953
  }
3900
3954
  return result;
3901
3955
  }
@@ -3909,23 +3963,16 @@ function mapLoadingStateResults(input, config) {
3909
3963
  * @__NO_SIDE_EFFECTS__
3910
3964
  */ function mapLoadingStateValueFunction(mapFn) {
3911
3965
  return function(state) {
3966
+ var value = loadingStateValue(state);
3912
3967
  var result;
3913
- if (state.value != null) {
3914
- result = mapFn(state.value, state);
3968
+ if (value != null) {
3969
+ result = mapFn(value, state);
3915
3970
  }
3916
3971
  return result;
3917
3972
  };
3918
3973
  }
3919
3974
 
3920
- function _array_like_to_array$3(arr, len) {
3921
- if (len == null || len > arr.length) len = arr.length;
3922
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3923
- return arr2;
3924
- }
3925
- function _array_without_holes$1(arr) {
3926
- if (Array.isArray(arr)) return _array_like_to_array$3(arr);
3927
- }
3928
- function _define_property$7(obj, key, value) {
3975
+ function _define_property$8(obj, key, value) {
3929
3976
  if (key in obj) {
3930
3977
  Object.defineProperty(obj, key, {
3931
3978
  value: value,
@@ -3933,18 +3980,10 @@ function _define_property$7(obj, key, value) {
3933
3980
  configurable: true,
3934
3981
  writable: true
3935
3982
  });
3936
- } else {
3937
- obj[key] = value;
3938
- }
3983
+ } else obj[key] = value;
3939
3984
  return obj;
3940
3985
  }
3941
- function _iterable_to_array$1(iter) {
3942
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3943
- }
3944
- function _non_iterable_spread$1() {
3945
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3946
- }
3947
- function _object_spread$5(target) {
3986
+ function _object_spread$6(target) {
3948
3987
  for(var i = 1; i < arguments.length; i++){
3949
3988
  var source = arguments[i] != null ? arguments[i] : {};
3950
3989
  var ownKeys = Object.keys(source);
@@ -3954,12 +3993,12 @@ function _object_spread$5(target) {
3954
3993
  }));
3955
3994
  }
3956
3995
  ownKeys.forEach(function(key) {
3957
- _define_property$7(target, key, source[key]);
3996
+ _define_property$8(target, key, source[key]);
3958
3997
  });
3959
3998
  }
3960
3999
  return target;
3961
4000
  }
3962
- function ownKeys$5(object, enumerableOnly) {
4001
+ function ownKeys$6(object, enumerableOnly) {
3963
4002
  var keys = Object.keys(object);
3964
4003
  if (Object.getOwnPropertySymbols) {
3965
4004
  var symbols = Object.getOwnPropertySymbols(object);
@@ -3967,29 +4006,16 @@ function ownKeys$5(object, enumerableOnly) {
3967
4006
  }
3968
4007
  return keys;
3969
4008
  }
3970
- function _object_spread_props$5(target, source) {
4009
+ function _object_spread_props$6(target, source) {
3971
4010
  source = source != null ? source : {};
3972
- if (Object.getOwnPropertyDescriptors) {
3973
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3974
- } else {
3975
- ownKeys$5(Object(source)).forEach(function(key) {
4011
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4012
+ else {
4013
+ ownKeys$6(Object(source)).forEach(function(key) {
3976
4014
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3977
4015
  });
3978
4016
  }
3979
4017
  return target;
3980
4018
  }
3981
- function _to_consumable_array$1(arr) {
3982
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$1();
3983
- }
3984
- function _unsupported_iterable_to_array$3(o, minLen) {
3985
- if (!o) return;
3986
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
3987
- var n = Object.prototype.toString.call(o).slice(8, -1);
3988
- if (n === "Object" && o.constructor) n = o.constructor.name;
3989
- if (n === "Map" || n === "Set") return Array.from(n);
3990
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
3991
- }
3992
- // TODO(BREAKING_CHANGE): Fix all LoadingState types to use the LoadingStateValue inference typings
3993
4019
  /**
3994
4020
  * Wraps an observable output and maps the value to a {@link LoadingState}.
3995
4021
  *
@@ -4034,11 +4060,7 @@ function combineLoadingStates() {
4034
4060
  return x[i] !== y[i];
4035
4061
  });
4036
4062
  }), map(function(states) {
4037
- // TODO(breaking-change): pass O explicitly (mergeLoadingStates<O>(...states, mergeFn)) or restructure the variadic signature so O is inferable without the cast.
4038
- // TODO: Fix eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- mergeLoadingStates is variadic; the generic O cannot be inferred from the call, so tsc widens the result to LoadingState<unknown> without this cast
4039
- return mergeLoadingStates.apply(void 0, _to_consumable_array$1(states).concat([
4040
- mergeFn
4041
- ]));
4063
+ return mergeLoadingStatesArray(states, mergeFn);
4042
4064
  }), shareReplay(1) // Share the result.
4043
4065
  );
4044
4066
  }
@@ -4085,8 +4107,40 @@ function combineLoadingStates() {
4085
4107
  return loadingStateType(x) === loadingStateType(y) && x.loadingProgress === y.loadingProgress;
4086
4108
  }), shareReplay(1));
4087
4109
  }
4088
- function startWithBeginLoading(state) {
4089
- return startWith(beginLoading(state));
4110
+ /**
4111
+ * Merges `startWith()` with `beginLoading()` into a single typed operator.
4112
+ *
4113
+ * Preferred over using both individually, as typing information can get lost when chaining them separately.
4114
+ * An optional partial state can be provided to include additional metadata (e.g., page info) in the initial loading state.
4115
+ *
4116
+ * @param state - Optional partial loading state to include in the initial emission.
4117
+ * @returns A `MonoTypeOperatorFunction` that prepends a loading state to the observable.
4118
+ *
4119
+ * @example
4120
+ * ```ts
4121
+ * // Emit a loading state immediately before the source observable emits
4122
+ * readonly resultsState$ = this.fetchValues().pipe(
4123
+ * map((values) => successResult(values)),
4124
+ * startWithBeginLoading(),
4125
+ * shareReplay(1)
4126
+ * );
4127
+ *
4128
+ * // Use inside a switchMap to re-emit loading on each new search
4129
+ * readonly searchResultsState$ = this.searchText$.pipe(
4130
+ * switchMap((text) =>
4131
+ * this.search(text).pipe(
4132
+ * startWithBeginLoading()
4133
+ * )
4134
+ * ),
4135
+ * shareReplay(1)
4136
+ * );
4137
+ * ```
4138
+ */ function startWithBeginLoading(state) {
4139
+ /**
4140
+ * `NoInfer` is required here: `Partial<L>` is a homomorphic mapped type and therefore an inference
4141
+ * source that outranks the contextual return type, so without it a `FilteredPage` argument would
4142
+ * reverse-infer `L := FilteredPage` instead of taking `L` from the stream being piped.
4143
+ */ return startWith(beginLoading(state));
4090
4144
  }
4091
4145
  /**
4092
4146
  * Returns the current value from the {@link LoadingState}, including `undefined` when still loading or no value is set.
@@ -4184,6 +4238,8 @@ function startWithBeginLoading(state) {
4184
4238
  };
4185
4239
  }
4186
4240
  function valueFromFinishedLoadingState(defaultValue) {
4241
+ // `NoInfer` on `defaultValue` is required: argument inference outranks the contextual return type,
4242
+ // so a `() => []` default would otherwise infer `T = never[]` and reject the real stream.
4187
4243
  return function(obs) {
4188
4244
  return obs.pipe(filter(isLoadingStateFinishedLoading), map(function(x) {
4189
4245
  var _x_value;
@@ -4191,7 +4247,28 @@ function valueFromFinishedLoadingState(defaultValue) {
4191
4247
  }));
4192
4248
  };
4193
4249
  }
4194
- function tapOnLoadingStateType(fn, type) {
4250
+ /**
4251
+ * Executes a side-effect function when the piped {@link LoadingState} matches the given {@link LoadingStateType}.
4252
+ *
4253
+ * This is a tap-style operator that does not modify the stream, but calls `fn` when the state matches the specified type.
4254
+ *
4255
+ * @param fn - The side-effect function to call when the state matches.
4256
+ * @param type - The {@link LoadingStateType} to match against.
4257
+ * @returns A `MonoTypeOperatorFunction` that taps on matching states.
4258
+ *
4259
+ * @example
4260
+ * ```ts
4261
+ * // Log whenever the state transitions to an error
4262
+ * state$.pipe(
4263
+ * tapOnLoadingStateType((state) => console.error('Error:', state.error), LoadingStateType.ERROR)
4264
+ * ).subscribe();
4265
+ *
4266
+ * // Trigger an action when loading begins
4267
+ * state$.pipe(
4268
+ * tapOnLoadingStateType(() => showSpinner(), LoadingStateType.LOADING)
4269
+ * ).subscribe();
4270
+ * ```
4271
+ */ function tapOnLoadingStateType(fn, type) {
4195
4272
  var decisionFunction;
4196
4273
  if (type === LoadingStateType.LOADING) {
4197
4274
  decisionFunction = isLoadingStateLoading;
@@ -4206,61 +4283,140 @@ function tapOnLoadingStateType(fn, type) {
4206
4283
  }
4207
4284
  });
4208
4285
  }
4209
- function tapOnLoadingStateSuccess(fn) {
4286
+ /**
4287
+ * Executes a side-effect function when the input {@link LoadingState} has a successful value.
4288
+ *
4289
+ * This is a convenience wrapper around {@link tapOnLoadingStateType} with {@link LoadingStateType.SUCCESS}.
4290
+ *
4291
+ * @param fn - The side-effect function to call on success states.
4292
+ * @returns A `MonoTypeOperatorFunction` that taps on successful states.
4293
+ *
4294
+ * @example
4295
+ * ```ts
4296
+ * // Log the successful value
4297
+ * state$.pipe(
4298
+ * tapOnLoadingStateSuccess((state) => console.log('Loaded:', state.value))
4299
+ * ).subscribe();
4300
+ * ```
4301
+ */ function tapOnLoadingStateSuccess(fn) {
4210
4302
  return tapOnLoadingStateType(fn, LoadingStateType.SUCCESS);
4211
4303
  }
4212
- function mapLoadingState(config) {
4304
+ /**
4305
+ * Convenience function for using {@link mapLoadingStateResults} with an Observable.
4306
+ *
4307
+ * Maps the value within a {@link LoadingState} using the provided configuration, preserving the loading/error state metadata.
4308
+ *
4309
+ * @param config - Configuration for mapping the loading state value.
4310
+ * @returns An `OperatorFunction` that maps the value within the loading state.
4311
+ *
4312
+ * @example
4313
+ * ```ts
4314
+ * // Map a SystemState<T> loading state to just its data property
4315
+ * readonly dataState$: Observable<LoadingState<T>> = this.systemStateLoadingState$.pipe(
4316
+ * mapLoadingState({ mapValue: (x: SystemState<T>) => x.data }),
4317
+ * shareReplay(1)
4318
+ * );
4319
+ * ```
4320
+ */ function mapLoadingState(config) {
4213
4321
  return map(function(state) {
4214
4322
  return mapLoadingStateResults(state, config);
4215
4323
  });
4216
4324
  }
4217
- function mapLoadingStateValueWithOperator(operator) {
4325
+ /**
4326
+ * Maps the value within a {@link LoadingState} using an arbitrary RxJS operator.
4327
+ *
4328
+ * When the state has a defined value, the value is extracted, passed through the provided operator,
4329
+ * and the result is wrapped back into the loading state. If the operator does not emit immediately,
4330
+ * a temporary loading state (with no value) is emitted while waiting.
4331
+ *
4332
+ * Error and loading states are passed through without invoking the operator.
4333
+ *
4334
+ * @param operator - The RxJS operator to apply to the loading state's value.
4335
+ * @param mapOnUndefined - If true, also applies the operator when the value is undefined (but loading is finished and no error).
4336
+ * @returns An `OperatorFunction` that transforms the value within the loading state.
4337
+ *
4338
+ * @example
4339
+ * ```ts
4340
+ * // Filter loading state values using a search string operator
4341
+ * readonly state$: Observable<ListLoadingState<DocValue>> = this._values.pipe(
4342
+ * switchMap((x) => of(successResult(x)).pipe(startWithBeginLoading())),
4343
+ * mapLoadingStateValueWithOperator(
4344
+ * filterWithSearchString({
4345
+ * filter: (a) => a.name,
4346
+ * search$: this.search$
4347
+ * })
4348
+ * )
4349
+ * );
4350
+ *
4351
+ * // Transform values using switchMap inside the operator
4352
+ * readonly groupsState$ = this.itemsState$.pipe(
4353
+ * mapLoadingStateValueWithOperator(
4354
+ * switchMap((items) => this.viewDelegate$.pipe(
4355
+ * switchMap((delegate) => asObservable(delegate.groupBy(items)))
4356
+ * ))
4357
+ * ),
4358
+ * shareReplay(1)
4359
+ * );
4360
+ * ```
4361
+ */ function mapLoadingStateValueWithOperator(operator) {
4218
4362
  var mapOnUndefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
4219
4363
  return function(obs) {
4220
4364
  return obs.pipe(switchMap(function(state) {
4221
4365
  var mappedObs;
4222
4366
  if (isLoadingStateWithDefinedValue(state) || mapOnUndefined && isLoadingStateFinishedLoading(state) && !isLoadingStateWithError(state)) {
4223
4367
  // map the value
4224
- mappedObs = of(state.value).pipe(operator, map(function(value) {
4225
- return _object_spread_props$5(_object_spread$5({}, state), {
4226
- value: value
4227
- });
4368
+ mappedObs = of(loadingStateValue(state)).pipe(operator, map(function(value) {
4369
+ return loadingStateWithValueType(state, value);
4228
4370
  }), // if the operator does not return nearly instantly, then return the current state, minus a value
4229
- timeoutStartWith(_object_spread_props$5(_object_spread$5({}, state), {
4230
- loading: true,
4231
- value: undefined
4232
- }), 0));
4371
+ timeoutStartWith(loadingStateWithValueType(_object_spread_props$6(_object_spread$6({}, state), {
4372
+ loading: true
4373
+ }), undefined), 0));
4233
4374
  } else {
4234
4375
  // only pass through if there is an error, otherwise show loading.
4235
4376
  if (isLoadingStateWithError(state)) {
4236
- mappedObs = of(_object_spread_props$5(_object_spread$5({}, state), {
4237
- value: undefined
4238
- }));
4377
+ mappedObs = of(loadingStateWithValueType(state, undefined));
4239
4378
  } else {
4240
4379
  // never pass through the non-mapped state's value as-is.
4241
- mappedObs = of(_object_spread_props$5(_object_spread$5({}, state), {
4242
- loading: true,
4243
- value: undefined
4244
- }));
4380
+ mappedObs = of(loadingStateWithValueType(_object_spread_props$6(_object_spread$6({}, state), {
4381
+ loading: true
4382
+ }), undefined));
4245
4383
  }
4246
4384
  }
4247
4385
  return mappedObs;
4248
4386
  }));
4249
4387
  };
4250
4388
  }
4251
- function catchLoadingStateErrorWithOperator(operator) {
4389
+ /**
4390
+ * Catches a {@link LoadingStateWithError} and transforms it into a new {@link LoadingState} using the provided operator.
4391
+ *
4392
+ * Non-error states are passed through unchanged. When an error state is encountered, it is passed through the
4393
+ * operator to produce a replacement state. If the operator does not emit immediately, a temporary loading state is emitted.
4394
+ *
4395
+ * @param operator - The RxJS operator to apply to the error loading state.
4396
+ * @returns A `MonoTypeOperatorFunction` that catches and transforms error states.
4397
+ *
4398
+ * @example
4399
+ * ```ts
4400
+ * // On error, return an empty list instead of propagating the error
4401
+ * readonly notificationItemsLoadingState$ = this.store.notificationItemsLoadingState$.pipe(
4402
+ * catchLoadingStateErrorWithOperator<LoadingState<NotificationItem<any>[]>>(
4403
+ * map(() => successResult([]))
4404
+ * )
4405
+ * );
4406
+ * ```
4407
+ */ function catchLoadingStateErrorWithOperator(operator) {
4408
+ // `NoInfer` is required: `operator` mentions `L` directly, and argument inference outranks the
4409
+ // contextual return type, so `map(() => successResult([]))` would otherwise infer
4410
+ // `L := LoadingStateWithValue<never[]>` and reject the stream it is piped into.
4252
4411
  return function(obs) {
4253
4412
  return obs.pipe(switchMap(function(state) {
4254
4413
  var mappedObs;
4255
4414
  if (isLoadingStateWithError(state)) {
4256
4415
  // map the value using the error state
4257
4416
  mappedObs = of(state).pipe(operator, // if the operator does not return nearly instantly, then return the current state, minus a value
4258
- // TODO(breaking-change): consider tightening this operator's generic constraints (or accepting Partial<L> for the placeholder) so the structural spread can satisfy L without the double cast.
4259
- // TODO: Fix eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- L is a generic Partial<PageLoadingState> subtype; the spread literal cannot structurally satisfy that intersection without this cast
4260
- timeoutStartWith(_object_spread_props$5(_object_spread$5({}, state), {
4261
- loading: true,
4262
- value: undefined
4263
- }), 0));
4417
+ timeoutStartWith(loadingStateWithValueType(_object_spread_props$6(_object_spread$6({}, state), {
4418
+ loading: true
4419
+ }), undefined), 0));
4264
4420
  } else {
4265
4421
  mappedObs = of(state);
4266
4422
  }
@@ -4268,17 +4424,45 @@ function catchLoadingStateErrorWithOperator(operator) {
4268
4424
  }));
4269
4425
  };
4270
4426
  }
4271
- function distinctLoadingState(inputConfig) {
4272
- var _ref = typeof inputConfig === 'function' ? {
4273
- valueComparator: inputConfig
4274
- } : inputConfig, compareOnUndefinedValue = _ref.compareOnUndefinedValue, valueComparator = _ref.valueComparator, inputMetadataComparator = _ref.metadataComparator, inputPassRetainedValue = _ref.passRetainedValue;
4427
+ /**
4428
+ * A special `distinctUntilChanged`-like operator for {@link LoadingState} and {@link PageLoadingState}.
4429
+ *
4430
+ * Retains the previous value and only emits when the value or loading state metadata actually changes,
4431
+ * as determined by the provided value comparator. This prevents unnecessary re-emissions when a loading
4432
+ * state re-emits with an equivalent value.
4433
+ *
4434
+ * Accepts either a simple {@link EqualityComparatorFunction} for comparing values, or a full
4435
+ * {@link DistinctLoadingStateConfig} for more fine-grained control over comparison behavior.
4436
+ *
4437
+ * @param config - Either a value comparator function or a full {@link DistinctLoadingStateConfig}.
4438
+ * @returns A `MonoTypeOperatorFunction` that filters out duplicate loading states.
4439
+ *
4440
+ * @example
4441
+ * ```ts
4442
+ * // Filter out duplicate loading states using key-based comparison
4443
+ * const distinct$ = values$.pipe(
4444
+ * distinctLoadingState(objectKeysEqualityComparatorFunction((x) => x))
4445
+ * );
4446
+ *
4447
+ * // Full config with custom comparator
4448
+ * const distinct$ = values$.pipe(
4449
+ * distinctLoadingState({
4450
+ * valueComparator: (a, b) => a?.id === b?.id,
4451
+ * })
4452
+ * );
4453
+ * ```
4454
+ */ function distinctLoadingState(config) {
4455
+ // `NoInfer` for the same reason as catchLoadingStateErrorWithOperator: the config mentions `L`.
4456
+ var _ref = typeof config === 'function' ? {
4457
+ valueComparator: config
4458
+ } : config, compareOnUndefinedValue = _ref.compareOnUndefinedValue, valueComparator = _ref.valueComparator, inputMetadataComparator = _ref.metadataComparator, inputPassRetainedValue = _ref.passRetainedValue;
4275
4459
  var passRetainedValue = inputPassRetainedValue !== null && inputPassRetainedValue !== void 0 ? inputPassRetainedValue : function(x) {
4276
4460
  return x !== null;
4277
4461
  };
4278
4462
  var metadataComparator = inputMetadataComparator !== null && inputMetadataComparator !== void 0 ? inputMetadataComparator : isPageLoadingStateMetadataEqual;
4279
4463
  return function(obs) {
4280
4464
  return obs.pipe(scan(function(acc, state) {
4281
- var nextValue = state.value;
4465
+ var nextValue = loadingStateValue(state);
4282
4466
  // determine the value change
4283
4467
  var isSameValue = false;
4284
4468
  if (isLoadingStateWithDefinedValue(state) || compareOnUndefinedValue && isLoadingStateFinishedLoading(state) && !isLoadingStateWithError(state)) {
@@ -4291,10 +4475,10 @@ function distinctLoadingState(inputConfig) {
4291
4475
  var isSameLoadingStateMetadata = safeCompareEquality(state, acc.previous, metadataComparator);
4292
4476
  // pick the value
4293
4477
  var value = isSameValue ? acc.value : nextValue;
4294
- var current = _object_spread_props$5(_object_spread$5({}, state), {
4478
+ var current = _object_spread_props$6(_object_spread$6({}, state), {
4295
4479
  value: value // set the new value
4296
4480
  });
4297
- return _object_spread_props$5(_object_spread$5({}, acc), {
4481
+ return _object_spread_props$6(_object_spread$6({}, acc), {
4298
4482
  value: value,
4299
4483
  isSameValue: isSameValue,
4300
4484
  isSameLoadingStateMetadata: isSameLoadingStateMetadata,
@@ -4458,6 +4642,50 @@ function distinctLoadingState(inputConfig) {
4458
4642
  return loadingStateContext;
4459
4643
  }
4460
4644
 
4645
+ function _define_property$7(obj, key, value) {
4646
+ if (key in obj) {
4647
+ Object.defineProperty(obj, key, {
4648
+ value: value,
4649
+ enumerable: true,
4650
+ configurable: true,
4651
+ writable: true
4652
+ });
4653
+ } else obj[key] = value;
4654
+ return obj;
4655
+ }
4656
+ function _object_spread$5(target) {
4657
+ for(var i = 1; i < arguments.length; i++){
4658
+ var source = arguments[i] != null ? arguments[i] : {};
4659
+ var ownKeys = Object.keys(source);
4660
+ if (typeof Object.getOwnPropertySymbols === "function") {
4661
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
4662
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
4663
+ }));
4664
+ }
4665
+ ownKeys.forEach(function(key) {
4666
+ _define_property$7(target, key, source[key]);
4667
+ });
4668
+ }
4669
+ return target;
4670
+ }
4671
+ function ownKeys$5(object, enumerableOnly) {
4672
+ var keys = Object.keys(object);
4673
+ if (Object.getOwnPropertySymbols) {
4674
+ var symbols = Object.getOwnPropertySymbols(object);
4675
+ keys.push.apply(keys, symbols);
4676
+ }
4677
+ return keys;
4678
+ }
4679
+ function _object_spread_props$5(target, source) {
4680
+ source = source != null ? source : {};
4681
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4682
+ else {
4683
+ ownKeys$5(Object(source)).forEach(function(key) {
4684
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4685
+ });
4686
+ }
4687
+ return target;
4688
+ }
4461
4689
  /**
4462
4690
  * Whether the {@link ListLoadingState} has no value or an empty array.
4463
4691
  *
@@ -4508,8 +4736,9 @@ function distinctLoadingState(inputConfig) {
4508
4736
  */ function pageLoadingStateFromObs(obs, firstOnly) {
4509
4737
  var page = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
4510
4738
  return loadingStateFromObs(obs, firstOnly).pipe(map(function(x) {
4511
- x.page = page;
4512
- return x;
4739
+ return _object_spread_props$5(_object_spread$5({}, x), {
4740
+ page: page
4741
+ });
4513
4742
  }));
4514
4743
  }
4515
4744
  /**
@@ -4546,9 +4775,7 @@ function _define_property$6(obj, key, value) {
4546
4775
  configurable: true,
4547
4776
  writable: true
4548
4777
  });
4549
- } else {
4550
- obj[key] = value;
4551
- }
4778
+ } else obj[key] = value;
4552
4779
  return obj;
4553
4780
  }
4554
4781
  function _object_spread$4(target) {
@@ -4576,9 +4803,8 @@ function ownKeys$4(object, enumerableOnly) {
4576
4803
  }
4577
4804
  function _object_spread_props$4(target, source) {
4578
4805
  source = source != null ? source : {};
4579
- if (Object.getOwnPropertyDescriptors) {
4580
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4581
- } else {
4806
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4807
+ else {
4582
4808
  ownKeys$4(Object(source)).forEach(function(key) {
4583
4809
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4584
4810
  });
@@ -4654,9 +4880,7 @@ function _type_of$2(obj) {
4654
4880
  }
4655
4881
 
4656
4882
  function _class_call_check$4(instance, Constructor) {
4657
- if (!(instance instanceof Constructor)) {
4658
- throw new TypeError("Cannot call a class as a function");
4659
- }
4883
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
4660
4884
  }
4661
4885
  function _defineProperties$4(target, props) {
4662
4886
  for(var i = 0; i < props.length; i++){
@@ -4679,9 +4903,7 @@ function _define_property$5(obj, key, value) {
4679
4903
  configurable: true,
4680
4904
  writable: true
4681
4905
  });
4682
- } else {
4683
- obj[key] = value;
4684
- }
4906
+ } else obj[key] = value;
4685
4907
  return obj;
4686
4908
  }
4687
4909
  function _object_spread$3(target) {
@@ -4709,9 +4931,8 @@ function ownKeys$3(object, enumerableOnly) {
4709
4931
  }
4710
4932
  function _object_spread_props$3(target, source) {
4711
4933
  source = source != null ? source : {};
4712
- if (Object.getOwnPropertyDescriptors) {
4713
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4714
- } else {
4934
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4935
+ else {
4715
4936
  ownKeys$3(Object(source)).forEach(function(key) {
4716
4937
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4717
4938
  });
@@ -4816,9 +5037,7 @@ function _object_spread_props$3(target, source) {
4816
5037
  ();
4817
5038
 
4818
5039
  function _assert_this_initialized(self) {
4819
- if (self === void 0) {
4820
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4821
- }
5040
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4822
5041
  return self;
4823
5042
  }
4824
5043
  function _call_super(_this, derived, args) {
@@ -4826,9 +5045,7 @@ function _call_super(_this, derived, args) {
4826
5045
  return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
4827
5046
  }
4828
5047
  function _class_call_check$3(instance, Constructor) {
4829
- if (!(instance instanceof Constructor)) {
4830
- throw new TypeError("Cannot call a class as a function");
4831
- }
5048
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
4832
5049
  }
4833
5050
  function _defineProperties$3(target, props) {
4834
5051
  for(var i = 0; i < props.length; i++){
@@ -4851,9 +5068,7 @@ function _define_property$4(obj, key, value) {
4851
5068
  configurable: true,
4852
5069
  writable: true
4853
5070
  });
4854
- } else {
4855
- obj[key] = value;
4856
- }
5071
+ } else obj[key] = value;
4857
5072
  return obj;
4858
5073
  }
4859
5074
  function _get_prototype_of(o) {
@@ -4875,10 +5090,16 @@ function _inherits(subClass, superClass) {
4875
5090
  });
4876
5091
  if (superClass) _set_prototype_of(subClass, superClass);
4877
5092
  }
5093
+ function _is_native_reflect_construct() {
5094
+ try {
5095
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
5096
+ } catch (_) {}
5097
+ return (_is_native_reflect_construct = function() {
5098
+ return !!result;
5099
+ })();
5100
+ }
4878
5101
  function _possible_constructor_return(self, call) {
4879
- if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
4880
- return call;
4881
- }
5102
+ if (call && (_type_of$1(call) === "object" || typeof call === "function")) return call;
4882
5103
  return _assert_this_initialized(self);
4883
5104
  }
4884
5105
  function _set_prototype_of(o, p) {
@@ -4892,14 +5113,6 @@ function _type_of$1(obj) {
4892
5113
  "@swc/helpers - typeof";
4893
5114
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4894
5115
  }
4895
- function _is_native_reflect_construct() {
4896
- try {
4897
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
4898
- } catch (_) {}
4899
- return (_is_native_reflect_construct = function() {
4900
- return !!result;
4901
- })();
4902
- }
4903
5116
  /**
4904
5117
  * A {@link SimpleLoadingContext} that determines loading completion by checking whether
4905
5118
  * all values returned by a check function are defined.
@@ -4987,11 +5200,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
4987
5200
  reject(error);
4988
5201
  return;
4989
5202
  }
4990
- if (info.done) {
4991
- resolve(value);
4992
- } else {
4993
- Promise.resolve(value).then(_next, _throw);
4994
- }
5203
+ if (info.done) resolve(value);
5204
+ else Promise.resolve(value).then(_next, _throw);
4995
5205
  }
4996
5206
  function _async_to_generator(fn) {
4997
5207
  return function() {
@@ -5009,22 +5219,16 @@ function _async_to_generator(fn) {
5009
5219
  };
5010
5220
  }
5011
5221
  function _iterable_to_array(iter) {
5012
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5222
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
5223
+ return Array.from(iter);
5224
+ }
5013
5225
  }
5014
5226
  function _non_iterable_spread() {
5015
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5227
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5016
5228
  }
5017
5229
  function _to_consumable_array(arr) {
5018
5230
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread();
5019
5231
  }
5020
- function _unsupported_iterable_to_array$2(o, minLen) {
5021
- if (!o) return;
5022
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
5023
- var n = Object.prototype.toString.call(o).slice(8, -1);
5024
- if (n === "Object" && o.constructor) n = o.constructor.name;
5025
- if (n === "Map" || n === "Set") return Array.from(n);
5026
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
5027
- }
5028
5232
  function _ts_generator(thisArg, body) {
5029
5233
  var f, y, t, _ = {
5030
5234
  label: 0,
@@ -5124,6 +5328,14 @@ function _ts_generator(thisArg, body) {
5124
5328
  };
5125
5329
  }
5126
5330
  }
5331
+ function _unsupported_iterable_to_array$2(o, minLen) {
5332
+ if (!o) return;
5333
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
5334
+ var n = Object.prototype.toString.call(o).slice(8, -1);
5335
+ if (n === "Object" && o.constructor) n = o.constructor.name;
5336
+ if (n === "Map" || n === "Set") return Array.from(n);
5337
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
5338
+ }
5127
5339
  function itemAccumulator(itemIteration, inputMapItem) {
5128
5340
  var mapItemFunction = inputMapItem !== null && inputMapItem !== void 0 ? inputMapItem : function(a) {
5129
5341
  return a;
@@ -5332,7 +5544,7 @@ function _iterable_to_array_limit$1(arr, i) {
5332
5544
  return _arr;
5333
5545
  }
5334
5546
  function _non_iterable_rest$1() {
5335
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5547
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5336
5548
  }
5337
5549
  function _sliced_to_array$1(arr, i) {
5338
5550
  return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
@@ -5478,9 +5690,7 @@ function _define_property$3(obj, key, value) {
5478
5690
  configurable: true,
5479
5691
  writable: true
5480
5692
  });
5481
- } else {
5482
- obj[key] = value;
5483
- }
5693
+ } else obj[key] = value;
5484
5694
  return obj;
5485
5695
  }
5486
5696
  function _object_spread$2(target) {
@@ -5508,9 +5718,8 @@ function ownKeys$2(object, enumerableOnly) {
5508
5718
  }
5509
5719
  function _object_spread_props$2(target, source) {
5510
5720
  source = source != null ? source : {};
5511
- if (Object.getOwnPropertyDescriptors) {
5512
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5513
- } else {
5721
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5722
+ else {
5514
5723
  ownKeys$2(Object(source)).forEach(function(key) {
5515
5724
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5516
5725
  });
@@ -5550,9 +5759,7 @@ function _array_with_holes(arr) {
5550
5759
  if (Array.isArray(arr)) return arr;
5551
5760
  }
5552
5761
  function _class_call_check$2(instance, Constructor) {
5553
- if (!(instance instanceof Constructor)) {
5554
- throw new TypeError("Cannot call a class as a function");
5555
- }
5762
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
5556
5763
  }
5557
5764
  function _defineProperties$2(target, props) {
5558
5765
  for(var i = 0; i < props.length; i++){
@@ -5575,9 +5782,7 @@ function _define_property$2(obj, key, value) {
5575
5782
  configurable: true,
5576
5783
  writable: true
5577
5784
  });
5578
- } else {
5579
- obj[key] = value;
5580
- }
5785
+ } else obj[key] = value;
5581
5786
  return obj;
5582
5787
  }
5583
5788
  function _iterable_to_array_limit(arr, i) {
@@ -5605,7 +5810,7 @@ function _iterable_to_array_limit(arr, i) {
5605
5810
  return _arr;
5606
5811
  }
5607
5812
  function _non_iterable_rest() {
5608
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5813
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5609
5814
  }
5610
5815
  function _object_spread$1(target) {
5611
5816
  for(var i = 1; i < arguments.length; i++){
@@ -5632,9 +5837,8 @@ function ownKeys$1(object, enumerableOnly) {
5632
5837
  }
5633
5838
  function _object_spread_props$1(target, source) {
5634
5839
  source = source != null ? source : {};
5635
- if (Object.getOwnPropertyDescriptors) {
5636
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5637
- } else {
5840
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5841
+ else {
5638
5842
  ownKeys$1(Object(source)).forEach(function(key) {
5639
5843
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5640
5844
  });
@@ -6049,21 +6253,23 @@ function mapItemPageLoadingStateFromResultPageLoadingState() {
6049
6253
  }
6050
6254
  function itemPageLoadingStateFromResultPageLoadingState(input) {
6051
6255
  var _input_value;
6052
- // TODO(breaking-change): refactor to build the result as an object literal so mapValue narrows V and hasNextPage can be assigned without the cast. See https://github.com/dereekb/dbx-components issue tracking for cleanup.
6053
- // TODO: Fix eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion -- cast widens mapValue's V|undefined inference to V and removes readonly so hasNextPage can be assigned; tsc reports both errors without it
6054
- var result = mapLoadingStateResults(input, {
6256
+ /**
6257
+ * `B` is stated explicitly because `ItemPageIteratorResult<V>.value` is optional, so inference alone
6258
+ * gives `B = V | undefined`. `PageLoadingState<Maybe<V>>` and `PageLoadingState<V>` are the same
6259
+ * type structurally (`value` is already `Maybe<V>` on both), which is what lets the result be built
6260
+ * as an object literal instead of mutated onto a readonly-stripped cast.
6261
+ */ var mapped = mapLoadingStateResults(input, {
6055
6262
  mapValue: function mapValue(result) {
6056
6263
  return result.value;
6057
6264
  }
6058
6265
  });
6059
- result.hasNextPage = invertMaybeBoolean((_input_value = input.value) === null || _input_value === void 0 ? void 0 : _input_value.end);
6060
- return result;
6266
+ return _object_spread_props$1(_object_spread$1({}, mapped), {
6267
+ hasNextPage: invertMaybeBoolean((_input_value = input.value) === null || _input_value === void 0 ? void 0 : _input_value.end)
6268
+ });
6061
6269
  }
6062
6270
 
6063
6271
  function _class_call_check$1(instance, Constructor) {
6064
- if (!(instance instanceof Constructor)) {
6065
- throw new TypeError("Cannot call a class as a function");
6066
- }
6272
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
6067
6273
  }
6068
6274
  function _defineProperties$1(target, props) {
6069
6275
  for(var i = 0; i < props.length; i++){
@@ -6086,9 +6292,7 @@ function _define_property$1(obj, key, value) {
6086
6292
  configurable: true,
6087
6293
  writable: true
6088
6294
  });
6089
- } else {
6090
- obj[key] = value;
6091
- }
6295
+ } else obj[key] = value;
6092
6296
  return obj;
6093
6297
  }
6094
6298
  function _object_spread(target) {
@@ -6116,9 +6320,8 @@ function ownKeys(object, enumerableOnly) {
6116
6320
  }
6117
6321
  function _object_spread_props(target, source) {
6118
6322
  source = source != null ? source : {};
6119
- if (Object.getOwnPropertyDescriptors) {
6120
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
6121
- } else {
6323
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
6324
+ else {
6122
6325
  ownKeys(Object(source)).forEach(function(key) {
6123
6326
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
6124
6327
  });
@@ -6437,9 +6640,7 @@ function _type_of(obj) {
6437
6640
  _define_property$1(LockSet, "LOCK_SET_CHILD_INDEX_STEPPER", 0);
6438
6641
 
6439
6642
  function _class_call_check(instance, Constructor) {
6440
- if (!(instance instanceof Constructor)) {
6441
- throw new TypeError("Cannot call a class as a function");
6442
- }
6643
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
6443
6644
  }
6444
6645
  function _defineProperties(target, props) {
6445
6646
  for(var i = 0; i < props.length; i++){
@@ -6462,9 +6663,7 @@ function _define_property(obj, key, value) {
6462
6663
  configurable: true,
6463
6664
  writable: true
6464
6665
  });
6465
- } else {
6466
- obj[key] = value;
6467
- }
6666
+ } else obj[key] = value;
6468
6667
  return obj;
6469
6668
  }
6470
6669
  /**
@@ -6783,4 +6982,4 @@ function _define_property(obj, key, value) {
6783
6982
  };
6784
6983
  }
6785
6984
 
6786
- export { AssetLoader, DEFAULT_ASYNC_PUSHER_THROTTLE, DEFAULT_FACTORY_TIMER_INTERVAL, DEFAULT_ITEM_PAGE_ITERATOR_MAX, DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION, DEFAULT_LOCK_SET_TIME_LOCK_KEY, FilterMap, FilterMapKeyInstance, FilterSource, FilterSourceConnector, FilterSourceInstance, ItemPageIterationInstance, ItemPageIterator, LoadingStateType, LockSet, MultiSubscriptionObject, PresetFilterSource, SimpleLoadingContext, SubscriptionObject, ValuesLoadingContext, WorkInstance, accumulatorCurrentPageListLoadingState, accumulatorFlattenPageListLoadingState, areAllLoadingStatesFinishedLoading, arrayValueFromFinishedLoadingState, asObservable, asObservableFromGetter, assetFolder, assetLoaderAssetInstance, assetLoaderFromGetFn, asyncPusher, asyncPusherCache, beginLoading, beginLoadingPage, catchLoadingStateErrorWithOperator, checkIs, cleanup, cleanupDestroyable, combineLatestFromArrayObsFn, combineLatestFromMapValuesObsFn, combineLatestFromObject, combineLatestMapFrom, combineLoadingStates, combineLoadingStatesStatus, currentValueFromLoadingState, delegatedAssetLoader, distinctLoadingState, distinctUntilArrayLengthChanges, distinctUntilHasDifferentValues, distinctUntilItemsHaveDifferentValues, distinctUntilItemsValueChanges, distinctUntilKeysChange, distinctUntilMapHasDifferentKeys, distinctUntilModelIdChange, distinctUntilModelKeyChange, distinctUntilObjectKeyChange, distinctUntilObjectValuesChanged, emitAfterDelay, emitDelayObs, errorFromLoadingState, errorOnEmissionsInPeriod, errorPageResult, errorResult, factoryTimer, fetchAssetLoader, filterIfObjectValuesUnchanged, filterItemsWithObservableDecision, filterMaybe, filterMaybeArray, filterMaybeStrict, filterUnique, filterWithSearchString, flattenAccumulatorResultItemArray, idleLoadingState, incrementingNumberTimer, initialize, invertObservableDecision, isAnyLoadingStateInLoadingState, isItemPageIteratorResultEndResult, isListLoadingStateWithEmptyValue, isLoading, isLoadingStateEqual, isLoadingStateFinishedLoading, isLoadingStateFinishedLoadingWithDefinedValue, isLoadingStateFinishedLoadingWithError, isLoadingStateInErrorState, isLoadingStateInIdleState, isLoadingStateInLoadingState, isLoadingStateInSuccessState, isLoadingStateLoading, isLoadingStateMetadataEqual, isLoadingStateWithDefinedValue, isLoadingStateWithError, isLoadingStateWithStateType, isNot, isPageLoadingStateMetadataEqual, itemAccumulator, itemAccumulatorNextPageUntilResultsCount, iterationHasNextAndCanLoadMore, iteratorNextPageUntilMaxPageLoadLimit, iteratorNextPageUntilPage, keyValueMap, lazyFrom, listLoadingStateContext, loadingStateContext, loadingStateFromObs, loadingStateType, localAsset, makeCheckIsFunction, makeIsModifiedFunction, makeIsModifiedFunctionObservable, makeMapFilterWithPresetFn, makeReturnIfIsFunction, mapEachAsync, mapFilterWithPreset, mapForEach, mapIf, mapIsListLoadingStateWithEmptyValue, mapItemIteration, mapKeysIntersectionToArray, mapLoadingState, mapLoadingStateResults, mapLoadingStateValueFunction, mapLoadingStateValueWithOperator, mapMaybe, mapMultipleLoadingStateResults, mappedPageItemIteration, maybeValueFromObservableOrValue, maybeValueFromObservableOrValueGetter, memoryAssetLoader, mergeLoadingStateWithError, mergeLoadingStateWithLoading, mergeLoadingStateWithValue, mergeLoadingStates, multiKeyValueMap, onFalseToTrue, onLockSetNextUnlock, onMatchDelta, onTrueToFalse, pageItemAccumulatorCurrentPage, pageLoadingStateFromObs, pipeIf, preventComplete, promiseFromLoadingState, randomDelay, randomDelayWithRandomFunction, remoteAsset, remoteAssetBaseUrl, returnIfIs, scanBuildArray, scanCount, scanIntoArray, setContainsAllValuesFrom, setContainsAnyValueFrom, setContainsNoValueFrom, skipAfterExpiration, skipAllInitialMaybe, skipExpired, skipInitialMaybe, skipMaybes, skipUntilExpiration, skipUntilTimeElapsedAfterLastEmission, startWithBeginLoading, successPageResult, successResult, switchMapFilterMaybe, switchMapMaybe, switchMapMaybeDefault, switchMapMaybeLoadingContextStream, switchMapObject, switchMapOnBoolean, switchMapToDefault, switchMapWhileFalse, switchMapWhileTrue, takeAfterTimeElapsedSinceLastEmission, tapAfterTimeout, tapFirst, tapLog, tapOnLoadingStateSuccess, tapOnLoadingStateType, throwErrorAfterTimeout, throwErrorFromLoadingStateError, timeoutStartWith, toExpiration, useAsObservable, useFirst, valueFromFinishedLoadingState, valueFromLoadingState, valueFromObservableOrValue, valueFromObservableOrValueGetter, workFactory, workFactoryForConfigFactory };
6985
+ export { AssetLoader, DEFAULT_ASYNC_PUSHER_THROTTLE, DEFAULT_FACTORY_TIMER_INTERVAL, DEFAULT_ITEM_PAGE_ITERATOR_MAX, DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION, DEFAULT_LOCK_SET_TIME_LOCK_KEY, FilterMap, FilterMapKeyInstance, FilterSource, FilterSourceConnector, FilterSourceInstance, ItemPageIterationInstance, ItemPageIterator, LoadingStateType, LockSet, MultiSubscriptionObject, PresetFilterSource, SimpleLoadingContext, SubscriptionObject, ValuesLoadingContext, WorkInstance, accumulatorCurrentPageListLoadingState, accumulatorFlattenPageListLoadingState, areAllLoadingStatesFinishedLoading, arrayValueFromFinishedLoadingState, asObservable, asObservableFromGetter, assetFolder, assetLoaderAssetInstance, assetLoaderFromGetFn, asyncPusher, asyncPusherCache, beginLoading, beginLoadingPage, catchLoadingStateErrorWithOperator, checkIs, cleanup, cleanupDestroyable, combineLatestFromArrayObsFn, combineLatestFromMapValuesObsFn, combineLatestFromObject, combineLatestMapFrom, combineLoadingStates, combineLoadingStatesStatus, currentValueFromLoadingState, delegatedAssetLoader, distinctLoadingState, distinctUntilArrayLengthChanges, distinctUntilHasDifferentValues, distinctUntilItemsHaveDifferentValues, distinctUntilItemsValueChanges, distinctUntilKeysChange, distinctUntilMapHasDifferentKeys, distinctUntilModelIdChange, distinctUntilModelKeyChange, distinctUntilObjectKeyChange, distinctUntilObjectValuesChanged, emitAfterDelay, emitDelayObs, errorFromLoadingState, errorOnEmissionsInPeriod, errorPageResult, errorResult, factoryTimer, fetchAssetLoader, filterIfObjectValuesUnchanged, filterItemsWithObservableDecision, filterMaybe, filterMaybeArray, filterMaybeStrict, filterUnique, filterWithSearchString, flattenAccumulatorResultItemArray, idleLoadingState, incrementingNumberTimer, initialize, invertObservableDecision, isAnyLoadingStateInLoadingState, isItemPageIteratorResultEndResult, isListLoadingStateWithEmptyValue, isLoading, isLoadingStateEqual, isLoadingStateFinishedLoading, isLoadingStateFinishedLoadingWithDefinedValue, isLoadingStateFinishedLoadingWithError, isLoadingStateInErrorState, isLoadingStateInIdleState, isLoadingStateInLoadingState, isLoadingStateInSuccessState, isLoadingStateLoading, isLoadingStateMetadataEqual, isLoadingStateWithDefinedValue, isLoadingStateWithError, isLoadingStateWithStateType, isNot, isPageLoadingState, isPageLoadingStateMetadataEqual, itemAccumulator, itemAccumulatorNextPageUntilResultsCount, iterationHasNextAndCanLoadMore, iteratorNextPageUntilMaxPageLoadLimit, iteratorNextPageUntilPage, keyValueMap, lazyFrom, listLoadingStateContext, loadingStateContext, loadingStateFromObs, loadingStateHasNextPage, loadingStateType, loadingStateValue, loadingStateWithValueType, localAsset, makeCheckIsFunction, makeIsModifiedFunction, makeIsModifiedFunctionObservable, makeMapFilterWithPresetFn, makeReturnIfIsFunction, mapEachAsync, mapFilterWithPreset, mapForEach, mapIf, mapIsListLoadingStateWithEmptyValue, mapItemIteration, mapKeysIntersectionToArray, mapLoadingState, mapLoadingStateResults, mapLoadingStateValueFunction, mapLoadingStateValueWithOperator, mapMaybe, mappedPageItemIteration, maybeValueFromObservableOrValue, maybeValueFromObservableOrValueGetter, memoryAssetLoader, mergeLoadingStateWithError, mergeLoadingStateWithLoading, mergeLoadingStateWithValue, mergeLoadingStates, mergeLoadingStatesArray, multiKeyValueMap, onFalseToTrue, onLockSetNextUnlock, onMatchDelta, onTrueToFalse, pageItemAccumulatorCurrentPage, pageLoadingStateFromObs, pipeIf, preventComplete, promiseFromLoadingState, randomDelay, randomDelayWithRandomFunction, remoteAsset, remoteAssetBaseUrl, returnIfIs, scanBuildArray, scanCount, scanIntoArray, setContainsAllValuesFrom, setContainsAnyValueFrom, setContainsNoValueFrom, skipAfterExpiration, skipAllInitialMaybe, skipExpired, skipInitialMaybe, skipMaybes, skipUntilExpiration, skipUntilTimeElapsedAfterLastEmission, startWithBeginLoading, successPageResult, successResult, switchMapFilterMaybe, switchMapMaybe, switchMapMaybeDefault, switchMapMaybeLoadingContextStream, switchMapObject, switchMapOnBoolean, switchMapToDefault, switchMapWhileFalse, switchMapWhileTrue, takeAfterTimeElapsedSinceLastEmission, tapAfterTimeout, tapFirst, tapLog, tapOnLoadingStateSuccess, tapOnLoadingStateType, throwErrorAfterTimeout, throwErrorFromLoadingStateError, timeoutStartWith, toExpiration, useAsObservable, useFirst, valueFromFinishedLoadingState, valueFromLoadingState, valueFromObservableOrValue, valueFromObservableOrValueGetter, workFactory, workFactoryForConfigFactory };