@dereekb/rxjs 13.0.7 → 13.2.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.
Files changed (52) hide show
  1. package/index.cjs.js +1284 -336
  2. package/index.cjs.js.map +1 -1
  3. package/index.esm.js +1284 -336
  4. package/index.esm.js.map +1 -1
  5. package/package.json +2 -2
  6. package/src/lib/filter/filter.d.ts +28 -13
  7. package/src/lib/filter/filter.map.d.ts +69 -2
  8. package/src/lib/filter/filter.preset.d.ts +35 -0
  9. package/src/lib/filter/filter.source.d.ts +61 -2
  10. package/src/lib/iterator/iteration.accumulator.d.ts +39 -13
  11. package/src/lib/iterator/iteration.accumulator.rxjs.d.ts +25 -8
  12. package/src/lib/iterator/iteration.d.ts +16 -5
  13. package/src/lib/iterator/iteration.mapped.d.ts +19 -6
  14. package/src/lib/iterator/iteration.mapped.page.d.ts +9 -6
  15. package/src/lib/iterator/iteration.next.d.ts +17 -14
  16. package/src/lib/iterator/iterator.page.d.ts +54 -16
  17. package/src/lib/loading/loading.context.rxjs.d.ts +17 -1
  18. package/src/lib/loading/loading.context.simple.d.ts +38 -1
  19. package/src/lib/loading/loading.context.state.d.ts +32 -4
  20. package/src/lib/loading/loading.context.state.list.d.ts +25 -3
  21. package/src/lib/loading/loading.context.value.d.ts +43 -3
  22. package/src/lib/loading/loading.state.d.ts +272 -41
  23. package/src/lib/loading/loading.state.list.d.ts +50 -9
  24. package/src/lib/lock.d.ts +149 -6
  25. package/src/lib/object.d.ts +28 -4
  26. package/src/lib/rxjs/array.d.ts +39 -13
  27. package/src/lib/rxjs/boolean.d.ts +8 -4
  28. package/src/lib/rxjs/decision.d.ts +13 -7
  29. package/src/lib/rxjs/delta.d.ts +14 -2
  30. package/src/lib/rxjs/expires.d.ts +20 -8
  31. package/src/lib/rxjs/factory.d.ts +16 -3
  32. package/src/lib/rxjs/getter.d.ts +24 -10
  33. package/src/lib/rxjs/key.d.ts +7 -5
  34. package/src/lib/rxjs/lifecycle.d.ts +10 -7
  35. package/src/lib/rxjs/loading.d.ts +10 -2
  36. package/src/lib/rxjs/map.d.ts +6 -5
  37. package/src/lib/rxjs/misc.d.ts +26 -6
  38. package/src/lib/rxjs/model.d.ts +2 -2
  39. package/src/lib/rxjs/number.d.ts +8 -4
  40. package/src/lib/rxjs/rxjs.async.d.ts +20 -7
  41. package/src/lib/rxjs/rxjs.d.ts +26 -18
  42. package/src/lib/rxjs/rxjs.error.d.ts +17 -0
  43. package/src/lib/rxjs/rxjs.map.d.ts +37 -9
  44. package/src/lib/rxjs/rxjs.unique.d.ts +6 -3
  45. package/src/lib/rxjs/set.d.ts +34 -0
  46. package/src/lib/rxjs/string.d.ts +18 -1
  47. package/src/lib/rxjs/timeout.d.ts +21 -1
  48. package/src/lib/rxjs/use.d.ts +4 -2
  49. package/src/lib/rxjs/value.d.ts +73 -39
  50. package/src/lib/subscription.d.ts +80 -3
  51. package/src/lib/work/work.factory.d.ts +42 -9
  52. package/src/lib/work/work.instance.d.ts +26 -2
package/index.cjs.js CHANGED
@@ -11,18 +11,19 @@ function asObservable(valueOrObs) {
11
11
  }
12
12
  }
13
13
  /**
14
- * Switch map for an ObservableGetter that pipes through the value.
14
+ * RxJS operator that flattens an emitted {@link ObservableOrValue} into its unwrapped value via `switchMap`.
15
15
  *
16
- * @returns OperatorFunction<ObservableOrValue<T>, T>
16
+ * @returns an operator that unwraps ObservableOrValue emissions
17
17
  */ function valueFromObservableOrValue() {
18
18
  return rxjs.switchMap(function(x) {
19
19
  return asObservable(x);
20
20
  });
21
21
  }
22
22
  /**
23
- * Switch map for an ObservableGetter that pipes through the Maybe value.
23
+ * RxJS operator that flattens an emitted Maybe<{@link ObservableOrValue}> into its unwrapped value,
24
+ * emitting `undefined` when the input is nullish.
24
25
  *
25
- * @returns OperatorFunction<Maybe<ObservableOrValue<T>>, Maybe<T>>
26
+ * @returns an operator that unwraps Maybe<ObservableOrValue> emissions
26
27
  */ function maybeValueFromObservableOrValue() {
27
28
  return rxjs.switchMap(function(x) {
28
29
  return x != null ? asObservable(x) : rxjs.of(undefined);
@@ -33,15 +34,18 @@ function asObservableFromGetter(input, args) {
33
34
  return asObservable(obs);
34
35
  }
35
36
  /**
36
- * Switch map for an ObservableOrValueGetter that pipes through the value.
37
+ * RxJS operator that flattens an emitted {@link ObservableOrValueGetter} into its resolved value via `switchMap`.
37
38
  *
38
- * @returns
39
+ * @returns an operator that unwraps getter emissions
39
40
  */ function valueFromObservableOrValueGetter() {
40
41
  return rxjs.switchMap(function(x) {
41
42
  return asObservableFromGetter(x);
42
43
  });
43
44
  }
44
- function maybeValueFromObservableOrValueGetter() {
45
+ /**
46
+ * RxJS operator that flattens an emitted Maybe<{@link ObservableOrValueGetter}> into its resolved value,
47
+ * emitting `undefined` when the input is nullish.
48
+ */ function maybeValueFromObservableOrValueGetter() {
45
49
  return rxjs.switchMap(function(x) {
46
50
  return x != null ? asObservableFromGetter(x) : rxjs.of(undefined);
47
51
  });
@@ -97,9 +101,10 @@ function _unsupported_iterable_to_array$b(o, minLen) {
97
101
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
98
102
  }
99
103
  /**
100
- * Creates an IsModifiedFunction from an IsEqualFunction, or from IsModifiedFunctionInput.
104
+ * Creates an {@link IsModifiedFunction} by inverting the result of an {@link IsEqualFunction}.
101
105
  *
102
- * @param isEqualFunction
106
+ * @param isEqualFunction - equality check function to invert
107
+ * @returns a function that returns true when the value has been modified
103
108
  */ function makeIsModifiedFunction(isEqualFunction) {
104
109
  return function(value) {
105
110
  return isEqualFunction(value).pipe(rxjs.map(function(x) {
@@ -108,10 +113,13 @@ function _unsupported_iterable_to_array$b(o, minLen) {
108
113
  };
109
114
  }
110
115
  /**
111
- * Creates an Observable<IsModifiedFunction> from the input config.
116
+ * Creates an observable that emits an {@link IsModifiedFunction} derived from the config.
112
117
  *
113
- * @param config MakeIsModifiedFunctionObservableConfig.
114
- * @returns Observable<IsModifiedFunction<T>>
118
+ * Prefers `isModified` over `isEqual` (which is inverted), falling back to `defaultFunction`
119
+ * or a function that always returns true.
120
+ *
121
+ * @param config - configuration with isModified, isEqual, and/or defaultFunction
122
+ * @returns an observable of the resolved IsModifiedFunction
115
123
  */ function makeIsModifiedFunctionObservable(config) {
116
124
  var isModified = config.isModified, isEqual = config.isEqual, defaultFunction = config.defaultFunction;
117
125
  return rxjs.combineLatest([
@@ -126,29 +134,53 @@ function _unsupported_iterable_to_array$b(o, minLen) {
126
134
  }));
127
135
  }
128
136
  // MARK: IsCheck
129
- function makeReturnIfIsFunction(isCheckFunction, defaultValueOnMaybe) {
137
+ /**
138
+ * Creates a function that returns the value if the check function returns true, otherwise undefined.
139
+ *
140
+ * @param isCheckFunction - optional check function
141
+ * @param defaultValueOnMaybe - default result for null/undefined values
142
+ */ function makeReturnIfIsFunction(isCheckFunction, defaultValueOnMaybe) {
130
143
  return function(value) {
131
144
  return returnIfIs(isCheckFunction, value, defaultValueOnMaybe);
132
145
  };
133
146
  }
134
- function returnIfIs(isCheckFunction, value, defaultValueOnMaybe) {
147
+ /**
148
+ * Returns the value wrapped in an observable if the check function passes, otherwise emits undefined.
149
+ *
150
+ * @param isCheckFunction - optional check function
151
+ * @param value - the value to check
152
+ * @param defaultValueOnMaybe - default result for null/undefined values
153
+ */ function returnIfIs(isCheckFunction, value, defaultValueOnMaybe) {
135
154
  return checkIs(isCheckFunction, value, defaultValueOnMaybe).pipe(rxjs.map(function(x) {
136
155
  return x ? value : undefined;
137
156
  }));
138
157
  }
139
- function makeCheckIsFunction(isCheckFunction, defaultValueOnMaybe) {
158
+ /**
159
+ * Creates a function that checks a value against the check function and returns an observable boolean.
160
+ *
161
+ * @param isCheckFunction - optional check function
162
+ * @param defaultValueOnMaybe - default result for null/undefined values
163
+ */ function makeCheckIsFunction(isCheckFunction, defaultValueOnMaybe) {
140
164
  return function(value) {
141
165
  return checkIs(isCheckFunction, value, defaultValueOnMaybe);
142
166
  };
143
167
  }
144
- function checkIs(isCheckFunction, value) {
168
+ /**
169
+ * Evaluates a value against an optional check function, returning an observable boolean.
170
+ *
171
+ * Returns `of(true)` when no check function is provided.
172
+ *
173
+ * @param isCheckFunction - optional check function
174
+ * @param value - the value to check
175
+ * @param defaultValueOnMaybe - default result for null/undefined values (defaults to false)
176
+ */ function checkIs(isCheckFunction, value) {
145
177
  var defaultValueOnMaybe = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
146
178
  var is = isCheckFunction ? value != null ? isCheckFunction(value) : rxjs.of(defaultValueOnMaybe) : rxjs.of(true);
147
179
  return is;
148
180
  }
149
181
  // MARK: Filter
150
182
  /**
151
- * Observable filter that filters maybe value that are defined.
183
+ * RxJS operator that filters out null and undefined values, only passing through defined values.
152
184
  */ function filterMaybe() {
153
185
  return rxjs.filter(util.isMaybeSo);
154
186
  }
@@ -156,34 +188,36 @@ function checkIs(isCheckFunction, value) {
156
188
  * Equivalent to filterMaybe, but returns a strict MaybeSoStrict<T> value instead of the template type.
157
189
  */ var filterMaybeStrict = filterMaybe;
158
190
  /**
159
- * Observable filter that filters out MaybeNot values from the input array of maybe values
191
+ * RxJS operator that filters out null/undefined elements from an emitted array, keeping only defined values.
160
192
  */ function filterMaybeArray() {
161
193
  return rxjs.map(util.filterMaybeArrayValues);
162
194
  }
163
195
  /**
164
- * Skips all initial maybe values, and then returns all values after the first non-null/undefined value is returned.
196
+ * RxJS operator that skips all leading null/undefined emissions, then passes all subsequent values through.
165
197
  */ function skipAllInitialMaybe() {
166
198
  return rxjs.skipWhile(function(x) {
167
199
  return x == null;
168
200
  });
169
201
  }
170
202
  /**
171
- * Skips only the first maybe value, then returns all values afterwards.
203
+ * RxJS operator that skips only the first emission if it is null/undefined, then passes all subsequent values.
172
204
  */ function skipInitialMaybe() {
173
205
  return skipMaybes(1);
174
206
  }
175
207
  /**
176
- * Skips up to the given number of maybe values, and then returns all values after the first non-null/undefined value is returned.
208
+ * RxJS operator that skips up to `maxToSkip` null/undefined emissions, then passes all subsequent values.
209
+ *
210
+ * @param maxToSkip - maximum number of null/undefined emissions to skip
177
211
  */ function skipMaybes(maxToSkip) {
178
212
  return rxjs.skipWhile(function(x, i) {
179
213
  return x == null && i < maxToSkip;
180
214
  });
181
215
  }
182
216
  /**
183
- * Provides a switchMap that will emit the observable if the observable is defined, otherwise will return the default value.
217
+ * RxJS operator that switches to the emitted observable if defined, or emits the default value if null/undefined.
184
218
  *
185
- * @param defaultValue
186
- * @returns
219
+ * @param defaultValue - fallback value when the observable is nullish (defaults to undefined)
220
+ * @returns an operator that handles optional observables
187
221
  */ function switchMapMaybeDefault() {
188
222
  var defaultValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : undefined;
189
223
  return rxjs.switchMap(function(x) {
@@ -209,7 +243,8 @@ function switchMapToDefault(defaultObs, useDefault) {
209
243
  });
210
244
  }
211
245
  /**
212
- * Provides a switchMap that retrieves and emits the value from the observable, unless the value is null/undefined/true in which case it emits the default value. If the value is false, null is emitted.
246
+ * RxJS operator that resolves an observable/getter config input into a value, applying defaults
247
+ * for `null`/`undefined`/`true` inputs and emitting `null` for `false`.
213
248
  */ function switchMapObject(config) {
214
249
  var defaultGetter = config.defaultGetter;
215
250
  return rxjs.switchMap(function(inputConfig) {
@@ -241,9 +276,9 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
241
276
  });
242
277
  }
243
278
  /**
244
- * Combines both filterMaybe and switchMap to build a subscriber that emits values only from a concrete Observable, filtering out null/undefined Observables.
279
+ * RxJS operator that filters out null/undefined observables and then switches to the remaining ones.
245
280
  *
246
- * @returns
281
+ * Combines {@link filterMaybe} and `switchMap` to only subscribe to non-nullish observables.
247
282
  */ function switchMapFilterMaybe() {
248
283
  return function(source) {
249
284
  var subscriber = source.pipe(filterMaybe(), rxjs.switchMap(function(x) {
@@ -253,9 +288,7 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
253
288
  };
254
289
  }
255
290
  /**
256
- * Converts a Maybe<Observable<Maybe<T>>> to an Observable<Maybe<T>> that emits null/undefined if the input observable is also null/undefined.
257
- *
258
- * @returns
291
+ * RxJS operator that switches to the emitted observable if defined, or emits `undefined` when the observable is nullish.
259
292
  */ function switchMapMaybe() {
260
293
  return function(source) {
261
294
  var subscriber = source.pipe(rxjs.switchMap(function(x) {
@@ -265,18 +298,19 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
265
298
  };
266
299
  }
267
300
  /**
268
- * Performs the input map function on the input if it is not null/undefined.
301
+ * RxJS operator that applies a map function only when the emitted value is non-null/non-undefined.
269
302
  *
270
- * @param mapFn
271
- * @returns
303
+ * @param mapFn - function to transform defined values
304
+ * @returns an operator that maps defined values and passes through undefined
272
305
  */ function mapMaybe(mapFn) {
273
306
  return mapIf(mapFn, util.isMaybeSo);
274
307
  }
275
308
  /**
276
- * Performs the input map function on the input if the decision returns true.
309
+ * RxJS operator that applies a map function only when the decision function returns true.
277
310
  *
278
- * @param mapFn
279
- * @returns
311
+ * @param mapFn - function to transform the value
312
+ * @param decision - predicate that determines whether to apply the map
313
+ * @returns an operator that conditionally maps values
280
314
  */ function mapIf(mapFn, decision) {
281
315
  return rxjs.map(function(x) {
282
316
  return decision(x) ? mapFn(x) : undefined;
@@ -321,9 +355,20 @@ function switchMapOnBoolean(switchOnValue, obs, otherwise) {
321
355
  }
322
356
 
323
357
  /**
324
- * Equivalent to distinctUntilChanged() using areEqualPOJOValues().
358
+ * RxJS operator that suppresses consecutive emissions when the emitted POJO values are deeply equal.
359
+ *
360
+ * Uses {@link areEqualPOJOValues} for comparison, so the emitted objects should be plain objects
361
+ * or compatible with deep value equality checks.
325
362
  *
326
- * The compared objects should only be POJOs or compatable with the areEqualPOJOValues() function.
363
+ * @returns operator that filters out consecutive duplicate POJO emissions
364
+ *
365
+ * @example
366
+ * ```ts
367
+ * of({ a: 1 }, { a: 1 }, { a: 2 }).pipe(
368
+ * distinctUntilObjectValuesChanged()
369
+ * ).subscribe(console.log);
370
+ * // Output: { a: 1 }, { a: 2 }
371
+ * ```
327
372
  */ function distinctUntilObjectValuesChanged() {
328
373
  return rxjs.distinctUntilChanged(function(a, b) {
329
374
  return util.areEqualPOJOValues(a, b);
@@ -398,7 +443,22 @@ function _unsupported_iterable_to_array$a(o, minLen) {
398
443
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
399
444
  }
400
445
  /**
401
- * Destroyable object that wraps an Unsubscribable.
446
+ * Manages a single RxJS subscription with automatic cleanup on reassignment.
447
+ *
448
+ * When a new subscription is assigned, the previous one is automatically unsubscribed.
449
+ * Implements {@link Destroyable} for integration with lifecycle management patterns.
450
+ *
451
+ * @example
452
+ * ```ts
453
+ * const sub = new SubscriptionObject();
454
+ *
455
+ * // Assign a subscription — previous one is automatically unsubscribed
456
+ * sub.subscription = interval(1000).subscribe(console.log);
457
+ * sub.subscription = interval(500).subscribe(console.log); // first subscription is cleaned up
458
+ *
459
+ * // Clean up when done
460
+ * sub.destroy();
461
+ * ```
402
462
  */ var SubscriptionObject = /*#__PURE__*/ function() {
403
463
  function SubscriptionObject(sub) {
404
464
  _class_call_check$8(this, SubscriptionObject);
@@ -410,25 +470,35 @@ function _unsupported_iterable_to_array$a(o, minLen) {
410
470
  _create_class$7(SubscriptionObject, [
411
471
  {
412
472
  key: "hasSubscription",
413
- get: function get() {
473
+ get: /**
474
+ * Whether a subscription is currently being managed.
475
+ */ function get() {
414
476
  return Boolean(this._subscription);
415
477
  }
416
478
  },
417
479
  {
418
480
  key: "subscription",
419
- set: function set(sub) {
481
+ set: /**
482
+ * Sets the managed subscription, unsubscribing from any previous one.
483
+ */ function set(sub) {
420
484
  this.setSub(sub);
421
485
  }
422
486
  },
423
487
  {
424
- key: "setSub",
488
+ /**
489
+ * Replaces the current subscription with the given one, unsubscribing from the previous.
490
+ *
491
+ * @param sub - new subscription to manage, or `undefined`/`void` to just unsubscribe
492
+ */ key: "setSub",
425
493
  value: function setSub(sub) {
426
494
  this.unsub();
427
495
  this._subscription = sub;
428
496
  }
429
497
  },
430
498
  {
431
- key: "unsub",
499
+ /**
500
+ * Unsubscribes from the current subscription, if any.
501
+ */ key: "unsub",
432
502
  value: function unsub() {
433
503
  if (this._subscription) {
434
504
  this._subscription.unsubscribe();
@@ -437,7 +507,9 @@ function _unsupported_iterable_to_array$a(o, minLen) {
437
507
  }
438
508
  },
439
509
  {
440
- key: "destroy",
510
+ /**
511
+ * Unsubscribes from the current subscription and releases the reference.
512
+ */ key: "destroy",
441
513
  value: function destroy() {
442
514
  this.unsub();
443
515
  }
@@ -446,9 +518,26 @@ function _unsupported_iterable_to_array$a(o, minLen) {
446
518
  return SubscriptionObject;
447
519
  }();
448
520
  /**
449
- * Destroyable object that wraps an array of subscriptions.
521
+ * Manages multiple RxJS subscriptions as a group, with bulk unsubscribe and cleanup.
522
+ *
523
+ * Useful when multiple independent subscriptions share a lifecycle. For subscriptions that
524
+ * should be merged into a single stream, consider using RxJS `merge(...)` instead.
525
+ *
526
+ * @example
527
+ * ```ts
528
+ * const subs = new MultiSubscriptionObject();
529
+ *
530
+ * subs.subscriptions = [
531
+ * source1$.subscribe(console.log),
532
+ * source2$.subscribe(console.log)
533
+ * ];
450
534
  *
451
- * NOTE: In some cases it might be better to use RXJS's merge(...[]) and subscribe to a single item.
535
+ * // Add more subscriptions later
536
+ * subs.addSubs(source3$.subscribe(console.log));
537
+ *
538
+ * // Clean up all at once
539
+ * subs.destroy();
540
+ * ```
452
541
  */ var MultiSubscriptionObject = /*#__PURE__*/ function() {
453
542
  function MultiSubscriptionObject(subs) {
454
543
  _class_call_check$8(this, MultiSubscriptionObject);
@@ -460,26 +549,38 @@ function _unsupported_iterable_to_array$a(o, minLen) {
460
549
  _create_class$7(MultiSubscriptionObject, [
461
550
  {
462
551
  key: "hasSubscription",
463
- get: function get() {
552
+ get: /**
553
+ * Whether any subscriptions are currently being managed.
554
+ */ function get() {
464
555
  var _this__subscriptions;
465
556
  return Boolean((_this__subscriptions = this._subscriptions) === null || _this__subscriptions === void 0 ? void 0 : _this__subscriptions.length);
466
557
  }
467
558
  },
468
559
  {
469
560
  key: "subscriptions",
470
- set: function set(subs) {
561
+ set: /**
562
+ * Replaces all managed subscriptions, unsubscribing from previous ones.
563
+ */ function set(subs) {
471
564
  this.setSubs(subs);
472
565
  }
473
566
  },
474
567
  {
475
- key: "setSubs",
568
+ /**
569
+ * Replaces all managed subscriptions with the given ones, unsubscribing from all previous.
570
+ *
571
+ * @param subs - new subscription(s) to manage
572
+ */ key: "setSubs",
476
573
  value: function setSubs(subs) {
477
574
  this.unsub();
478
575
  this._subscriptions = util.convertToArray(subs);
479
576
  }
480
577
  },
481
578
  {
482
- key: "addSubs",
579
+ /**
580
+ * Adds subscription(s) to the managed set without affecting existing ones. Duplicate subscriptions are ignored.
581
+ *
582
+ * @param subs - subscription(s) to add
583
+ */ key: "addSubs",
483
584
  value: function addSubs(subs) {
484
585
  var _this__subscriptions;
485
586
  var nextSubscriptions = _to_consumable_array$5((_this__subscriptions = this._subscriptions) !== null && _this__subscriptions !== void 0 ? _this__subscriptions : []);
@@ -492,7 +593,9 @@ function _unsupported_iterable_to_array$a(o, minLen) {
492
593
  }
493
594
  },
494
595
  {
495
- key: "unsub",
596
+ /**
597
+ * Unsubscribes from all managed subscriptions and clears the list.
598
+ */ key: "unsub",
496
599
  value: function unsub() {
497
600
  if (this._subscriptions) {
498
601
  this._subscriptions.forEach(function(x) {
@@ -503,7 +606,9 @@ function _unsupported_iterable_to_array$a(o, minLen) {
503
606
  }
504
607
  },
505
608
  {
506
- key: "destroy",
609
+ /**
610
+ * Unsubscribes from all managed subscriptions and releases references.
611
+ */ key: "destroy",
507
612
  value: function destroy() {
508
613
  this.unsub();
509
614
  }
@@ -591,7 +696,27 @@ function _unsupported_iterable_to_array$9(o, minLen) {
591
696
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
592
697
  }
593
698
  /**
594
- * A basic FilterSource implementation.
699
+ * Concrete implementation of {@link FilterSource} that manages reactive filter state with
700
+ * support for default values, initial values, and explicit overrides.
701
+ *
702
+ * Filter priority (highest to lowest):
703
+ * 1. Explicit filter set via {@link setFilter}
704
+ * 2. Initial filter set via {@link initWithFilter}
705
+ * 3. Default filter set via {@link setDefaultFilter}
706
+ *
707
+ * @example
708
+ * ```ts
709
+ * const source = new FilterSourceInstance<{ active: boolean }>();
710
+ *
711
+ * // Set a default filter
712
+ * source.setDefaultFilter(of({ active: false }));
713
+ *
714
+ * // Override with an explicit filter
715
+ * source.setFilter({ active: true });
716
+ *
717
+ * // Reset back to default
718
+ * source.resetFilter();
719
+ * ```
595
720
  */ var FilterSourceInstance = /*#__PURE__*/ function() {
596
721
  function FilterSourceInstance(config) {
597
722
  var _this = this;
@@ -603,8 +728,12 @@ function _unsupported_iterable_to_array$9(o, minLen) {
603
728
  * The initial filter can only pass through observables that always emit a value.
604
729
  */ _define_property$b(this, "_initialFilter", new rxjs.BehaviorSubject(undefined));
605
730
  _define_property$b(this, "_defaultFilter", new rxjs.BehaviorSubject(undefined));
606
- _define_property$b(this, "defaultFilter$", this._defaultFilter.pipe(switchMapFilterMaybe()));
607
- _define_property$b(this, "initialFilter$", rxjs.combineLatest([
731
+ /**
732
+ * Observable of the default filter value, emitting when a default is set.
733
+ */ _define_property$b(this, "defaultFilter$", this._defaultFilter.pipe(switchMapFilterMaybe()));
734
+ /**
735
+ * Observable that emits the initial filter value, preferring the init filter over the default.
736
+ */ _define_property$b(this, "initialFilter$", rxjs.combineLatest([
608
737
  this._initialFilter,
609
738
  this._defaultFilter
610
739
  ]).pipe(rxjs.map(function(param) {
@@ -612,7 +741,8 @@ function _unsupported_iterable_to_array$9(o, minLen) {
612
741
  return a !== null && a !== void 0 ? a : b;
613
742
  }), switchMapFilterMaybe(), rxjs.distinctUntilChanged(), rxjs.shareReplay(1)));
614
743
  /**
615
- * filter$ uses the latest value from any filter.
744
+ * Observable of the active filter value, resolving to the explicit filter if set,
745
+ * otherwise falling back to the initial/default filter. Deduplicated by deep value equality.
616
746
  */ _define_property$b(this, "filter$", this._filter.pipe(rxjs.switchMap(function(x) {
617
747
  return x != null ? rxjs.of(x) : _this.initialFilter$;
618
748
  }), filterMaybe(), distinctUntilObjectValuesChanged(), rxjs.shareReplay(1)));
@@ -629,20 +759,32 @@ function _unsupported_iterable_to_array$9(o, minLen) {
629
759
  }
630
760
  _create_class$6(FilterSourceInstance, [
631
761
  {
632
- key: "initWithFilter",
762
+ /**
763
+ * Sets an initial filter observable that takes priority over the default filter.
764
+ *
765
+ * @param filterObs - observable providing the initial filter value
766
+ */ key: "initWithFilter",
633
767
  value: function initWithFilter(filterObs) {
634
768
  this._initialFilter.next(filterObs);
635
769
  this.initFilterTakesPriority();
636
770
  }
637
771
  },
638
772
  {
639
- key: "setDefaultFilter",
773
+ /**
774
+ * Sets the default filter, used as a fallback when no explicit or initial filter is active.
775
+ *
776
+ * @param filter - default filter value, observable, or undefined to clear
777
+ */ key: "setDefaultFilter",
640
778
  value: function setDefaultFilter(filter) {
641
779
  this._defaultFilter.next(asObservable(filter));
642
780
  }
643
781
  },
644
782
  {
645
- key: "setFilter",
783
+ /**
784
+ * Sets an explicit filter value that takes priority over the initial and default filters.
785
+ *
786
+ * @param filter - the filter value to set
787
+ */ key: "setFilter",
646
788
  value: function setFilter(filter) {
647
789
  this._filter.next(filter);
648
790
  }
@@ -656,8 +798,14 @@ function _unsupported_iterable_to_array$9(o, minLen) {
656
798
  }
657
799
  },
658
800
  {
659
- // MARK: Accessors
660
- key: "setInitialFilterTakesPriority",
801
+ /**
802
+ * Controls whether changes to the initial filter automatically reset the explicit filter.
803
+ *
804
+ * When enabled, any new emission from the initial filter observable clears the explicit
805
+ * filter, causing `filter$` to fall back to the initial filter value.
806
+ *
807
+ * @param initialFilterTakesPriority - whether initial filter changes should reset the explicit filter
808
+ */ key: "setInitialFilterTakesPriority",
661
809
  value: function setInitialFilterTakesPriority(initialFilterTakesPriority) {
662
810
  this._initialFilterTakesPriority.next(initialFilterTakesPriority);
663
811
  this.initFilterTakesPriority();
@@ -689,8 +837,9 @@ function _unsupported_iterable_to_array$9(o, minLen) {
689
837
  }
690
838
  },
691
839
  {
692
- // MARK: Cleanup
693
- key: "destroy",
840
+ /**
841
+ * Completes all internal subjects and cleans up subscriptions.
842
+ */ key: "destroy",
694
843
  value: function destroy() {
695
844
  this._initialFilterSub.destroy();
696
845
  this._initialFilterTakesPriority.complete();
@@ -761,7 +910,22 @@ function _unsupported_iterable_to_array$8(o, minLen) {
761
910
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
762
911
  }
763
912
  /**
764
- * Class used to keep track of filters keyed by a specific string identifier.
913
+ * Manages a collection of reactive filters keyed by string identifiers.
914
+ *
915
+ * Multiple filter observables can be registered under the same key and their emissions are merged.
916
+ * Supports default filters that are used when no explicit filter is set.
917
+ *
918
+ * @example
919
+ * ```ts
920
+ * const filterMap = new FilterMap<{ active: boolean }>();
921
+ *
922
+ * // Register a filter observable under a key
923
+ * filterMap.addFilterObs('users', of({ active: true }));
924
+ *
925
+ * // Subscribe to the filter for that key
926
+ * filterMap.filterForKey('users').subscribe(f => console.log(f));
927
+ * // Output: { active: true }
928
+ * ```
765
929
  */ var FilterMap = /*#__PURE__*/ function() {
766
930
  function FilterMap() {
767
931
  _class_call_check$6(this, FilterMap);
@@ -769,7 +933,14 @@ function _unsupported_iterable_to_array$8(o, minLen) {
769
933
  }
770
934
  _create_class$5(FilterMap, [
771
935
  {
772
- key: "filterForKey",
936
+ /**
937
+ * Returns an observable of the filter value for the given key.
938
+ *
939
+ * Waits until a filter entry exists for the key, then switches to its filter stream.
940
+ *
941
+ * @param key - filter map key to observe
942
+ * @returns observable that emits the current filter value for the key
943
+ */ key: "filterForKey",
773
944
  value: function filterForKey(key) {
774
945
  return this._map.pipe(rxjs.map(function(x) {
775
946
  return x.get(key);
@@ -779,25 +950,47 @@ function _unsupported_iterable_to_array$8(o, minLen) {
779
950
  }
780
951
  },
781
952
  {
782
- key: "addDefaultFilterObs",
953
+ /**
954
+ * Sets a default filter observable for the given key, used as a fallback when no explicit filter is set.
955
+ *
956
+ * @param key - filter map key
957
+ * @param obs - default filter observable or value
958
+ */ key: "addDefaultFilterObs",
783
959
  value: function addDefaultFilterObs(key, obs) {
784
960
  this._itemForKey(key).setDefaultFilterObs(obs);
785
961
  }
786
962
  },
787
963
  {
788
- key: "addFilterObs",
964
+ /**
965
+ * Adds a filter observable for the given key. Multiple observables can be added per key
966
+ * and their emissions are merged together.
967
+ *
968
+ * @param key - filter map key
969
+ * @param obs - filter observable to add
970
+ */ key: "addFilterObs",
789
971
  value: function addFilterObs(key, obs) {
790
972
  this._itemForKey(key).addFilterObs(obs);
791
973
  }
792
974
  },
793
975
  {
794
- key: "makeInstance",
976
+ /**
977
+ * Creates a {@link FilterMapKeyInstance} bound to the given key, providing both
978
+ * {@link FilterSource} and {@link FilterSourceConnector} interfaces for that key.
979
+ *
980
+ * @param key - filter map key to bind
981
+ * @returns instance for interacting with the filter at the given key
982
+ */ key: "makeInstance",
795
983
  value: function makeInstance(key) {
796
984
  return new FilterMapKeyInstance(this, key);
797
985
  }
798
986
  },
799
987
  {
800
- key: "instanceObsForKeyObs",
988
+ /**
989
+ * Creates an observable that emits a new {@link FilterMapKeyInstance} each time the key changes.
990
+ *
991
+ * @param keyObs - observable of filter map keys
992
+ * @returns observable that emits instances for the current key
993
+ */ key: "instanceObsForKeyObs",
801
994
  value: function instanceObsForKeyObs(keyObs) {
802
995
  var _this = this;
803
996
  return keyObs.pipe(rxjs.distinctUntilChanged(), rxjs.map(function(x) {
@@ -819,8 +1012,9 @@ function _unsupported_iterable_to_array$8(o, minLen) {
819
1012
  }
820
1013
  },
821
1014
  {
822
- // MARK: Cleanup
823
- key: "destroy",
1015
+ /**
1016
+ * Destroys all filter items and completes the internal subject.
1017
+ */ key: "destroy",
824
1018
  value: function destroy() {
825
1019
  this._map.value.forEach(function(x) {
826
1020
  return x.destroy();
@@ -831,12 +1025,19 @@ function _unsupported_iterable_to_array$8(o, minLen) {
831
1025
  ]);
832
1026
  return FilterMap;
833
1027
  }();
834
- var FilterMapKeyInstance = /*#__PURE__*/ function() {
1028
+ /**
1029
+ * Bound instance of a {@link FilterMap} for a specific key.
1030
+ *
1031
+ * Implements both {@link FilterSource} (provides filter values) and {@link FilterSourceConnector}
1032
+ * (accepts filter sources) for a single filter map entry.
1033
+ */ var FilterMapKeyInstance = /*#__PURE__*/ function() {
835
1034
  function FilterMapKeyInstance(dbxFilterMap, key) {
836
1035
  _class_call_check$6(this, FilterMapKeyInstance);
837
1036
  _define_property$a(this, "_dbxFilterMap", void 0);
838
1037
  _define_property$a(this, "_key", void 0);
839
- _define_property$a(this, "filter$", void 0);
1038
+ /**
1039
+ * Observable of the filter value for this instance's key.
1040
+ */ _define_property$a(this, "filter$", void 0);
840
1041
  this._dbxFilterMap = dbxFilterMap;
841
1042
  this._key = key;
842
1043
  this.filter$ = this._dbxFilterMap.filterForKey(this._key);
@@ -855,13 +1056,17 @@ var FilterMapKeyInstance = /*#__PURE__*/ function() {
855
1056
  }
856
1057
  },
857
1058
  {
858
- key: "initWithFilter",
1059
+ /**
1060
+ * Sets the default filter observable for this key.
1061
+ */ key: "initWithFilter",
859
1062
  value: function initWithFilter(filterObs) {
860
1063
  this.dbxFilterMap.addDefaultFilterObs(this.key, filterObs);
861
1064
  }
862
1065
  },
863
1066
  {
864
- key: "connectWithSource",
1067
+ /**
1068
+ * Connects a filter source, adding its filter observable to this key's merged filters.
1069
+ */ key: "connectWithSource",
865
1070
  value: function connectWithSource(filterSource) {
866
1071
  this.dbxFilterMap.addFilterObs(this.key, filterSource.filter$);
867
1072
  }
@@ -962,7 +1167,31 @@ var FilterMapItem = /*#__PURE__*/ function() {
962
1167
  }
963
1168
  ();
964
1169
 
965
- function makeMapFilterWithPresetFn(fn) {
1170
+ /**
1171
+ * Creates a mapping function that resolves preset references in filters.
1172
+ *
1173
+ * When a filter has a `preset` value, the provided function is called to expand the preset
1174
+ * into concrete filter values, then the `preset` field is removed from the result.
1175
+ * Filters without a preset are passed through unchanged.
1176
+ *
1177
+ * @param fn - function that expands a preset into concrete filter values
1178
+ * @returns mapping function that resolves presets and strips the preset field
1179
+ *
1180
+ * @example
1181
+ * ```ts
1182
+ * interface MyFilter extends FilterWithPreset {
1183
+ * active?: boolean;
1184
+ * }
1185
+ *
1186
+ * const resolve = makeMapFilterWithPresetFn<MyFilter>((f) => {
1187
+ * if (f.preset === 'active') return { active: true };
1188
+ * return { active: false };
1189
+ * });
1190
+ *
1191
+ * const result = resolve({ preset: 'active' });
1192
+ * // result === { active: true }
1193
+ * ```
1194
+ */ function makeMapFilterWithPresetFn(fn) {
966
1195
  return function(filter) {
967
1196
  if (filter.preset) {
968
1197
  var result = fn(filter);
@@ -973,7 +1202,12 @@ function makeMapFilterWithPresetFn(fn) {
973
1202
  }
974
1203
  };
975
1204
  }
976
- function mapFilterWithPreset(fn) {
1205
+ /**
1206
+ * RxJS operator that resolves preset references in a filter stream using the provided mapping function.
1207
+ *
1208
+ * @param fn - function that expands a preset into concrete filter values
1209
+ * @returns operator that maps filter emissions, resolving any preset references
1210
+ */ function mapFilterWithPreset(fn) {
977
1211
  return rxjs.map(makeMapFilterWithPresetFn(fn));
978
1212
  }
979
1213
 
@@ -1037,12 +1271,17 @@ function _is_native_reflect_construct$1() {
1037
1271
  })();
1038
1272
  }
1039
1273
  /**
1040
- * Source that provides a filter observable.
1274
+ * Abstract base class for providing reactive filter state.
1275
+ *
1276
+ * Implementations expose a `filter$` observable that emits the current filter value,
1277
+ * and optionally support initialization from an external observable.
1041
1278
  */ var FilterSource = function FilterSource() {
1042
1279
  _class_call_check$5(this, FilterSource);
1043
1280
  };
1044
1281
  /**
1045
- * A FilterSource that has a filter with a FilterPreset potentially available.
1282
+ * A {@link FilterSource} whose filter type includes an optional preset reference.
1283
+ *
1284
+ * Useful for filter UIs that support both preset configurations and custom filter values.
1046
1285
  */ var PresetFilterSource = /*#__PURE__*/ function(FilterSource) {
1047
1286
  _inherits$1(PresetFilterSource, FilterSource);
1048
1287
  function PresetFilterSource() {
@@ -1052,7 +1291,9 @@ function _is_native_reflect_construct$1() {
1052
1291
  return PresetFilterSource;
1053
1292
  }(FilterSource);
1054
1293
  /**
1055
- * A FilterSourceConnector connects with a Source for a function.
1294
+ * Abstract connector that wires a {@link FilterSource} into a consuming component.
1295
+ *
1296
+ * Implementations define how to subscribe to a filter source and apply its values.
1056
1297
  */ var FilterSourceConnector = function FilterSourceConnector() {
1057
1298
  _class_call_check$5(this, FilterSourceConnector);
1058
1299
  }
@@ -1187,10 +1428,11 @@ function _ts_generator$1(thisArg, body) {
1187
1428
  }
1188
1429
  }
1189
1430
  /**
1190
- * Creates an observable from the input iteration that checks both the hasNext$ and canLoadMore$ states.
1431
+ * Combines an iteration's `hasNext$` and `canLoadMore$` into a single observable that emits
1432
+ * `true` only when both conditions are met (more items exist and the page limit hasn't been reached).
1191
1433
  *
1192
- * @param iteration
1193
- * @returns
1434
+ * @param iteration - the iteration to check
1435
+ * @returns observable that emits `true` when more items can be loaded
1194
1436
  */ function iterationHasNextAndCanLoadMore(iteration) {
1195
1437
  return iteration.canLoadMore$.pipe(rxjs.switchMap(function(canLoadMore) {
1196
1438
  if (canLoadMore) {
@@ -1201,15 +1443,16 @@ function _ts_generator$1(thisArg, body) {
1201
1443
  }), rxjs.shareReplay(1));
1202
1444
  }
1203
1445
  /**
1204
- * Automatically calls next up to the current maxPageLoadLimit configured on the iterator.
1446
+ * Automatically pages through a {@link PageItemIteration} until its configured max page load limit is reached.
1205
1447
  *
1206
- * If no maximum limit is defined, uses the defaultLimit. If default limit is not defined or null, this will result in an error.
1448
+ * Falls back to the provided default limit if no max is configured on the iterator.
1207
1449
  *
1208
- * The promise will reject with an error if an error is encountered.
1450
+ * @param iterator - the page iteration to advance
1451
+ * @param defaultLimit - fallback page limit if none is configured (defaults to 100)
1452
+ * @returns promise resolving to the last loaded page number
1209
1453
  *
1210
- * @param iterator
1211
- * @param defaultLimit
1212
- * @returns
1454
+ * @throws {Error} If neither a max page load limit nor a default limit is defined
1455
+ * @throws Rejects if the iteration encounters a loading error
1213
1456
  */ function iteratorNextPageUntilMaxPageLoadLimit(iterator) {
1214
1457
  var defaultLimit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 100;
1215
1458
  return iteratorNextPageUntilPage(iterator, function() {
@@ -1222,13 +1465,14 @@ function _ts_generator$1(thisArg, body) {
1222
1465
  });
1223
1466
  }
1224
1467
  /**
1225
- * Automatically calls next on the PageItemIteration up to the target page, the number of total pages that should be loaded.
1468
+ * Automatically pages through a {@link PageItemIteration} until the specified page number is reached,
1469
+ * respecting the iteration's max page load limit.
1226
1470
  *
1227
- * The promise will reject with an error if an error is encountered.
1471
+ * @param iteration - the page iteration to advance
1472
+ * @param page - target page number (or getter returning one) representing total pages to load
1473
+ * @returns promise resolving to the last loaded page number
1228
1474
  *
1229
- * @param iteration
1230
- * @param page
1231
- * @returns
1475
+ * @throws Rejects if the iteration encounters a loading error
1232
1476
  */ function iteratorNextPageUntilPage(iteration, page) {
1233
1477
  var getPageLimit = util.asGetter(page);
1234
1478
  function checkPageLimit(page) {
@@ -1332,15 +1576,14 @@ function scanIntoArray() {
1332
1576
  }, []);
1333
1577
  }
1334
1578
  /**
1335
- * Used to lazy build an array from two observables.
1336
- *
1337
- * The piped observable is for retrieving the seed value, and the accumulatorObs observable is used for
1338
- * retrieving values going forward.
1579
+ * Lazily builds an array from a seed observable and an accumulator observable.
1339
1580
  *
1340
- * This is useful in cases where values are very large.
1581
+ * The piped observable provides the seed state, while `accumulatorObs` provides values that
1582
+ * are incrementally appended. Useful when loading large datasets where the initial page and
1583
+ * subsequent pages come from different sources.
1341
1584
  *
1342
- * @param param0
1343
- * @returns
1585
+ * @param init - function that receives the seed state and returns the accumulator config
1586
+ * @returns an operator that emits the growing array
1344
1587
  */ function scanBuildArray(init) {
1345
1588
  return rxjs.exhaustMap(function(seedState) {
1346
1589
  var _init = init(seedState), _init_seed = _init.seed, seed = _init_seed === void 0 ? [] : _init_seed, accumulatorObs = _init.accumulatorObs, _init_flattenArray = _init.flattenArray, flattenArray = _init_flattenArray === void 0 ? false : _init_flattenArray;
@@ -1360,10 +1603,10 @@ function scanIntoArray() {
1360
1603
  }
1361
1604
  // MARK: MapForEach
1362
1605
  /**
1363
- * Convenience function that calls forEachWithArray() and returns the original array.
1606
+ * RxJS operator that executes a side-effect on each element of the emitted array, then passes the array through.
1364
1607
  *
1365
- * @param forEach
1366
- * @returns
1608
+ * @param forEach - callback to run for each element, or null/undefined to pass through unchanged
1609
+ * @returns an operator that taps each element in emitted arrays
1367
1610
  */ function mapForEach(forEach) {
1368
1611
  return forEach ? rxjs.map(function(x) {
1369
1612
  return util.forEachWithArray(x, forEach);
@@ -1372,7 +1615,14 @@ function scanIntoArray() {
1372
1615
  });
1373
1616
  }
1374
1617
  /**
1375
- * Operator function that maps each value in the array independently using Observables, then combines the all results.
1618
+ * RxJS operator that maps each element in an emitted array through an async observable function,
1619
+ * then combines all results using `combineLatest`.
1620
+ *
1621
+ * Emits `[]` for empty arrays. When `onlyFirst` is true, takes only the first combined emission.
1622
+ *
1623
+ * @param mapFunction - function that maps each item to an ObservableInput
1624
+ * @param config - optional config (e.g., `onlyFirst`)
1625
+ * @returns an operator that async-maps each array element
1376
1626
  */ function mapEachAsync(mapFunction, config) {
1377
1627
  var _ref = config !== null && config !== void 0 ? config : {}, _ref_onlyFirst = _ref.onlyFirst, onlyFirst = _ref_onlyFirst === void 0 ? false : _ref_onlyFirst;
1378
1628
  return rxjs.switchMap(function(values) {
@@ -1390,9 +1640,21 @@ function scanIntoArray() {
1390
1640
  }
1391
1641
 
1392
1642
  /**
1393
- * Emits a value when going from one matching value to a target value.
1643
+ * RxJS operator that emits only when the stream transitions from a `from` value to a `to` value.
1394
1644
  *
1395
- * The first value must be determined first before the second is raised.
1645
+ * The `from` value must be seen first; only then is the `to` value emitted. When `requireConsecutive`
1646
+ * is true, the two values must be adjacent emissions.
1647
+ *
1648
+ * @example
1649
+ * ```ts
1650
+ * // Emit when transitioning from true to false
1651
+ * source$.pipe(
1652
+ * onMatchDelta({ from: true, to: false, requireConsecutive: true })
1653
+ * ).subscribe((val) => console.log('Transitioned to false'));
1654
+ * ```
1655
+ *
1656
+ * @param config - from/to values, optional comparator, and consecutive requirement
1657
+ * @returns an operator that emits on value transitions
1396
1658
  */ function onMatchDelta(config) {
1397
1659
  var inputIsSame = config.isMatch, from = config.from, to = config.to, requireConsecutive = config.requireConsecutive;
1398
1660
  var isMatch = inputIsSame !== null && inputIsSame !== void 0 ? inputIsSame : function(a, b) {
@@ -1449,19 +1711,23 @@ function scanIntoArray() {
1449
1711
  }
1450
1712
 
1451
1713
  /**
1452
- * Returns the pipe if usePipe is true, otherwise returns the identity.
1714
+ * Conditionally applies an operator. Returns the given pipe when `usePipe` is true, otherwise returns identity (pass-through).
1715
+ *
1716
+ * @param usePipe - whether to apply the pipe
1717
+ * @param pipe - the operator to conditionally apply
1718
+ * @returns the pipe or identity operator
1453
1719
  */ function pipeIf(usePipe, pipe) {
1454
1720
  return usePipe ? pipe : rxjs.identity;
1455
1721
  }
1456
1722
  /**
1457
- * Maps the opposite value of the input boolean.
1723
+ * RxJS operator that negates each emitted boolean value.
1458
1724
  */ function isNot() {
1459
1725
  return rxjs.map(function(x) {
1460
1726
  return !x;
1461
1727
  });
1462
1728
  }
1463
1729
  /**
1464
- * Emits a value when moving from a true value to a false value.
1730
+ * RxJS operator that only emits when a boolean stream transitions from `true` to `false`.
1465
1731
  */ function onTrueToFalse() {
1466
1732
  return onMatchDelta({
1467
1733
  from: true,
@@ -1470,7 +1736,7 @@ function scanIntoArray() {
1470
1736
  });
1471
1737
  }
1472
1738
  /**
1473
- * Emits a value when moving from a false value to a true value.
1739
+ * RxJS operator that only emits when a boolean stream transitions from `false` to `true`.
1474
1740
  */ function onFalseToTrue() {
1475
1741
  return onMatchDelta({
1476
1742
  from: false,
@@ -1480,11 +1746,13 @@ function scanIntoArray() {
1480
1746
  }
1481
1747
 
1482
1748
  /**
1483
- * Used to invert an ObservableDecisionFunction's result.
1749
+ * Wraps an {@link ObservableDecisionFunction} to negate its boolean result.
1484
1750
  *
1485
- * @param filterFn
1486
- * @param invert whether or not to apply the inversion.
1487
- * @returns
1751
+ * When `invert` is false, returns the original function unchanged.
1752
+ *
1753
+ * @param decisionFn - the decision function to invert
1754
+ * @param invert - whether to apply the inversion (defaults to true)
1755
+ * @returns the inverted (or original) decision function
1488
1756
  */ function invertObservableDecision(decisionFn) {
1489
1757
  var invert = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
1490
1758
  if (invert) {
@@ -1499,10 +1767,14 @@ function scanIntoArray() {
1499
1767
  }
1500
1768
  }
1501
1769
  /**
1502
- * Operator function that uses SwitchMap and filters each of the input values using an ObservableDecisionFunction, and returns them as an array.
1770
+ * RxJS operator that filters an emitted array by evaluating each item through an async {@link ObservableDecisionFunction}.
1503
1771
  *
1504
- * @param observableDecisionFunction
1505
- * @returns
1772
+ * Items where the decision returns true are kept; others are removed. Results are throttled
1773
+ * to prevent excessive re-emissions.
1774
+ *
1775
+ * @param observableDecisionFunction - async predicate to evaluate each item
1776
+ * @param throttle - throttle duration in ms (defaults to 20)
1777
+ * @returns an operator that async-filters array elements
1506
1778
  */ function filterItemsWithObservableDecision(observableDecisionFunction) {
1507
1779
  var throttle = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 20;
1508
1780
  var filterAndMap = util.filterAndMapFunction(function(x) {
@@ -1533,10 +1805,11 @@ function scanIntoArray() {
1533
1805
  }
1534
1806
 
1535
1807
  /**
1536
- * Creates a new Expires object at the current time on emission that will expire in the set amount of time.
1808
+ * RxJS operator that maps each emission to a new {@link Expires} object with an expiration
1809
+ * time relative to the current moment.
1537
1810
  *
1538
- * @param expiresIn
1539
- * @returns
1811
+ * @param expiresIn - duration in milliseconds until expiration
1812
+ * @returns an operator that maps values to Expires objects
1540
1813
  */ function toExpiration(expiresIn) {
1541
1814
  return rxjs.map(function() {
1542
1815
  var now = new Date();
@@ -1550,7 +1823,7 @@ function scanIntoArray() {
1550
1823
  });
1551
1824
  }
1552
1825
  /**
1553
- * Filters further emissions once the input is expired.
1826
+ * RxJS operator that filters out emissions whose {@link Expires} value has already expired.
1554
1827
  */ function skipExpired() {
1555
1828
  return rxjs.filter(function(expires) {
1556
1829
  return !util.expirationDetails({
@@ -1559,7 +1832,9 @@ function scanIntoArray() {
1559
1832
  });
1560
1833
  }
1561
1834
  /**
1562
- * Skips the input date or timenumber until expiration occurs.
1835
+ * RxJS operator that skips emissions until the elapsed time since the emitted date/timestamp has exceeded `expiresIn`.
1836
+ *
1837
+ * @param expiresIn - duration in milliseconds
1563
1838
  */ function skipUntilExpiration(expiresIn) {
1564
1839
  return rxjs.filter(function(x) {
1565
1840
  return util.expirationDetails({
@@ -1569,7 +1844,9 @@ function scanIntoArray() {
1569
1844
  });
1570
1845
  }
1571
1846
  /**
1572
- * Skips the input date or timenumber after expiration occurs.
1847
+ * RxJS operator that skips emissions after the elapsed time since the emitted date/timestamp has exceeded `expiresIn`.
1848
+ *
1849
+ * @param expiresIn - duration in milliseconds
1573
1850
  */ function skipAfterExpiration(expiresIn) {
1574
1851
  return rxjs.filter(function(x) {
1575
1852
  return !util.expirationDetails({
@@ -1579,7 +1856,10 @@ function scanIntoArray() {
1579
1856
  });
1580
1857
  }
1581
1858
  /**
1582
- * Skips emissions until time since the last emission from the watch observable has elapsed.
1859
+ * RxJS operator that only takes emissions from the source within a time window after each emission from a watch observable.
1860
+ *
1861
+ * @param watch - observable whose emissions reset the time window
1862
+ * @param takeFor - duration in milliseconds of each time window
1583
1863
  */ function skipUntilTimeElapsedAfterLastEmission(watch, takeFor) {
1584
1864
  return function(observable) {
1585
1865
  return watch.pipe(rxjs.switchMap(function() {
@@ -1594,7 +1874,11 @@ function scanIntoArray() {
1594
1874
  };
1595
1875
  }
1596
1876
  /**
1597
- * Takes emissions until time since the last emission from the watch observable has elapsed.
1877
+ * RxJS operator that skips emissions from the source for a duration after each emission from a watch observable,
1878
+ * then passes values through once the time has elapsed.
1879
+ *
1880
+ * @param watch - observable whose emissions reset the skip window
1881
+ * @param skipFor - duration in milliseconds to skip after each watch emission
1598
1882
  */ function takeAfterTimeElapsedSinceLastEmission(watch, skipFor) {
1599
1883
  return function(observable) {
1600
1884
  return watch.pipe(rxjs.switchMap(function() {
@@ -1610,7 +1894,13 @@ function scanIntoArray() {
1610
1894
  }
1611
1895
 
1612
1896
  /**
1613
- * Used to pass a default value incase an observable has not yet started emititng values.
1897
+ * RxJS operator that emits a default value if the source does not emit within the specified timeout.
1898
+ *
1899
+ * After the timeout, the default value is prepended and the source continues normally.
1900
+ *
1901
+ * @param defaultValue - value or getter to use as the default
1902
+ * @param first - timeout in ms before emitting the default (defaults to 0)
1903
+ * @returns an operator that provides a fallback on slow emissions
1614
1904
  */ function timeoutStartWith(defaultValue) {
1615
1905
  var first = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
1616
1906
  return function(source) {
@@ -1622,7 +1912,13 @@ function scanIntoArray() {
1622
1912
  }));
1623
1913
  };
1624
1914
  }
1625
- function tapAfterTimeout(timeoutDelay, useFn) {
1915
+ /**
1916
+ * RxJS operator that executes a side-effect function if the source does not emit within the given timeout.
1917
+ *
1918
+ * @param timeoutDelay - timeout in ms before triggering the side-effect
1919
+ * @param useFn - side-effect function to call on timeout
1920
+ * @returns an operator that taps after timeout
1921
+ */ function tapAfterTimeout(timeoutDelay, useFn) {
1626
1922
  return rxjs.timeout({
1627
1923
  first: timeoutDelay,
1628
1924
  with: function _with() {
@@ -1630,7 +1926,13 @@ function tapAfterTimeout(timeoutDelay, useFn) {
1630
1926
  }
1631
1927
  });
1632
1928
  }
1633
- function throwErrorAfterTimeout(timeoutDelay, error) {
1929
+ /**
1930
+ * RxJS operator that throws an error if the source does not emit within the given timeout.
1931
+ *
1932
+ * @param timeoutDelay - timeout in ms before throwing
1933
+ * @param error - getter that produces the error to throw
1934
+ * @returns an operator that throws on timeout
1935
+ */ function throwErrorAfterTimeout(timeoutDelay, error) {
1634
1936
  return rxjs.timeout({
1635
1937
  first: timeoutDelay,
1636
1938
  with: function _with() {
@@ -1643,10 +1945,23 @@ function throwErrorAfterTimeout(timeoutDelay, error) {
1643
1945
 
1644
1946
  var DEFAULT_FACTORY_TIMER_INTERVAL = 1000;
1645
1947
  /**
1646
- * Creates an observable that uses timer internally and maps values from the factory result.
1948
+ * Creates an observable that emits values produced by a factory function on a timer interval.
1647
1949
  *
1648
- * @param config
1649
- * @returns
1950
+ * Wraps `timer()` internally and maps each tick index through the factory. Optionally limits
1951
+ * the total number of emissions.
1952
+ *
1953
+ * @example
1954
+ * ```ts
1955
+ * const countdown$ = factoryTimer({
1956
+ * factory: (i) => 10 - i,
1957
+ * interval: 1000,
1958
+ * limit: 11
1959
+ * });
1960
+ * // emits 10, 9, 8, ... 0
1961
+ * ```
1962
+ *
1963
+ * @param config - timer configuration including factory, interval, wait, and limit
1964
+ * @returns an observable of factory-produced values
1650
1965
  */ function factoryTimer(config) {
1651
1966
  var _config_wait = config.wait, wait = _config_wait === void 0 ? 0 : _config_wait, _config_interval = config.interval, interval = _config_interval === void 0 ? DEFAULT_FACTORY_TIMER_INTERVAL : _config_interval, limit = config.limit, factory = config.factory;
1652
1967
  var obs = rxjs.timer(wait, interval);
@@ -1661,29 +1976,33 @@ var DEFAULT_FACTORY_TIMER_INTERVAL = 1000;
1661
1976
  }
1662
1977
 
1663
1978
  /**
1664
- * distinctUntilChanged() that reads the unique identifiers from the input values and compares them for uniqueness.
1979
+ * `distinctUntilChanged` variant for arrays that only emits when the set of keys extracted from
1980
+ * the array elements changes.
1665
1981
  *
1666
- * @param readkey
1982
+ * @param readKey - function to extract one or more keys from each element
1983
+ * @returns an operator that filters out arrays with unchanged key sets
1667
1984
  */ function distinctUntilKeysChange(readKey) {
1668
1985
  return rxjs.distinctUntilChanged(util.objectKeysEqualityComparatorFunction(readKey));
1669
1986
  }
1670
1987
  /**
1671
- * Convenience function for distinctUntilChange() that compares the values using a readKey function.
1988
+ * `distinctUntilChanged` variant for single objects that only emits when the extracted key changes.
1672
1989
  *
1673
- * @param readKey
1674
- * @returns
1990
+ * @param readKey - function to extract a key from the emitted object
1991
+ * @returns an operator that filters out emissions with unchanged keys
1675
1992
  */ function distinctUntilObjectKeyChange(readKey) {
1676
1993
  return rxjs.distinctUntilChanged(util.objectKeyEqualityComparatorFunction(readKey));
1677
1994
  }
1678
1995
 
1679
1996
  /**
1680
- * Cleans up the instance when a new value is pushed.
1997
+ * RxJS operator that calls a destroy function on the previous value whenever a new value is emitted.
1681
1998
  *
1682
- * Can be configured to wait until the previous value's destroy promise has resolved.
1999
+ * Ensures proper cleanup of resources when switching between instances. When `wait` is true,
2000
+ * delays emitting the new value until the previous destruction completes.
2001
+ * On unsubscription, the last emitted instance is also destroyed.
1683
2002
  *
1684
- * @param destroy
1685
- * @param wait
1686
- * @returns
2003
+ * @param destroy - function to clean up each replaced instance
2004
+ * @param wait - whether to wait for the previous destroy to complete before emitting
2005
+ * @returns an operator that manages instance lifecycle
1687
2006
  */ function cleanup(destroy) {
1688
2007
  var wait = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1689
2008
  return function(obs) {
@@ -1717,9 +2036,10 @@ var DEFAULT_FACTORY_TIMER_INTERVAL = 1000;
1717
2036
  };
1718
2037
  }
1719
2038
  /**
1720
- * Convenience function for cleanup() on a Destroyable type.
2039
+ * Convenience wrapper for {@link cleanup} that calls `destroy()` on each replaced {@link Destroyable} instance.
1721
2040
  *
1722
- * @returns
2041
+ * @param wait - whether to wait for the previous destroy to complete before emitting
2042
+ * @returns an operator that manages Destroyable lifecycle
1723
2043
  */ function cleanupDestroyable(wait) {
1724
2044
  return cleanup(function(x) {
1725
2045
  return x.destroy();
@@ -1727,9 +2047,17 @@ var DEFAULT_FACTORY_TIMER_INTERVAL = 1000;
1727
2047
  }
1728
2048
 
1729
2049
  /**
1730
- * Operator that returns true until the first item is emitted. Then returns false.
2050
+ * RxJS operator that emits `true` immediately (loading), then `false` after the source emits its first value.
1731
2051
  *
1732
- * @returns
2052
+ * Only considers the first emission from the source. The result is shared via `shareReplay(1)`.
2053
+ *
2054
+ * @example
2055
+ * ```ts
2056
+ * const loading$ = dataFetch$.pipe(isLoading());
2057
+ * // emits true initially, then false once dataFetch$ emits
2058
+ * ```
2059
+ *
2060
+ * @returns an operator that tracks whether the first value has been emitted
1733
2061
  */ function isLoading() {
1734
2062
  return function(source) {
1735
2063
  return source.pipe(rxjs.first(), rxjs.map(function() {
@@ -1753,15 +2081,23 @@ function tapLog(messageOrFunction) {
1753
2081
  return operator;
1754
2082
  }
1755
2083
  /**
1756
- * Used to make a random delay for each observable value.
2084
+ * RxJS operator that adds a random delay before each emission.
1757
2085
  *
1758
- * @param maxOrArgs
1759
- * @returns
2086
+ * Useful for simulating network latency or staggering requests.
2087
+ *
2088
+ * @param maxOrArgs - maximum delay in ms, or a full random number config
2089
+ * @returns an operator that delays each emission by a random amount
1760
2090
  */ function randomDelay(maxOrArgs) {
1761
2091
  var makeRandomDelay = util.randomNumberFactory(maxOrArgs);
1762
2092
  return randomDelayWithRandomFunction(makeRandomDelay);
1763
2093
  }
1764
- function randomDelayWithRandomFunction(makeRandomDelay) {
2094
+ /**
2095
+ * RxJS operator that adds a random delay using a custom random number generator.
2096
+ *
2097
+ * @param makeRandomDelay - factory that produces random delay values
2098
+ * @param scheduler - the scheduler to use for the delay (defaults to asyncScheduler)
2099
+ * @returns an operator that delays each emission
2100
+ */ function randomDelayWithRandomFunction(makeRandomDelay) {
1765
2101
  var scheduler = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : rxjs.asyncScheduler;
1766
2102
  return rxjs.delayWhen(function() {
1767
2103
  return rxjs.timer(makeRandomDelay(), scheduler);
@@ -1769,14 +2105,14 @@ function randomDelayWithRandomFunction(makeRandomDelay) {
1769
2105
  }
1770
2106
 
1771
2107
  /**
1772
- * distinctUntilChanged() that compares id values.
2108
+ * `distinctUntilChanged` variant that only emits when the model's `id` property changes.
1773
2109
  */ function distinctUntilModelIdChange() {
1774
2110
  return distinctUntilObjectKeyChange(function(x) {
1775
2111
  return x.id;
1776
2112
  });
1777
2113
  }
1778
2114
  /**
1779
- * distinctUntilChanged() that compares key values.
2115
+ * `distinctUntilChanged` variant that only emits when the model's `key` property changes.
1780
2116
  */ function distinctUntilModelKeyChange() {
1781
2117
  return distinctUntilObjectKeyChange(function(x) {
1782
2118
  return x.key;
@@ -1784,10 +2120,11 @@ function randomDelayWithRandomFunction(makeRandomDelay) {
1784
2120
  }
1785
2121
 
1786
2122
  /**
1787
- * OperatorFunction that pipes the input from the object with a keys observable to produce the result of mapKeysIntersectionObjectToArray.
2123
+ * RxJS operator that extracts values from a keyed object using a keys observable,
2124
+ * returning only the values whose keys are present in both.
1788
2125
  *
1789
- * @param keysObs
1790
- * @returns
2126
+ * @param keysObs - observable (or static value) of keys to intersect with
2127
+ * @returns an operator that maps a keyed object to an array of matching values
1791
2128
  */ function mapKeysIntersectionToArray(keysObs) {
1792
2129
  return rxjs.switchMap(function(object) {
1793
2130
  return asObservable(keysObs).pipe(rxjs.map(function(keys) {
@@ -1796,9 +2133,9 @@ function randomDelayWithRandomFunction(makeRandomDelay) {
1796
2133
  });
1797
2134
  }
1798
2135
  /**
1799
- * Operatorfunction using distinctUntilChanged to check that two maps have the same keys.
2136
+ * `distinctUntilChanged` variant for `Map` instances that only emits when the set of map keys changes.
1800
2137
  *
1801
- * @returns
2138
+ * @returns an operator that filters out Maps with unchanged key sets
1802
2139
  */ function distinctUntilMapHasDifferentKeys() {
1803
2140
  return rxjs.distinctUntilChanged(util.mapsHaveSameKeys);
1804
2141
  }
@@ -1851,7 +2188,11 @@ function _object_spread_props$7(target, source) {
1851
2188
  return target;
1852
2189
  }
1853
2190
  /**
1854
- * Similar to count(), but counts emissions as they occur using scan.
2191
+ * RxJS operator that counts emissions as they occur using `scan`, emitting the running count
2192
+ * after each emission (unlike `count()` which only emits on completion).
2193
+ *
2194
+ * @param startAt - initial count value (defaults to 0)
2195
+ * @returns an operator that emits the running emission count
1855
2196
  */ function scanCount() {
1856
2197
  var startAt = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
1857
2198
  return rxjs.scan(function(count) {
@@ -1859,10 +2200,10 @@ function _object_spread_props$7(target, source) {
1859
2200
  }, startAt);
1860
2201
  }
1861
2202
  /**
1862
- * Creates a factoryTimer for incrementing numbers.
2203
+ * Creates a {@link factoryTimer} that emits incrementing numbers on an interval.
1863
2204
  *
1864
- * @param config
1865
- * @returns
2205
+ * @param config - timer and incrementing number configuration
2206
+ * @returns an observable of incrementing numbers
1866
2207
  */ function incrementingNumberTimer() {
1867
2208
  var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1868
2209
  return factoryTimer(_object_spread_props$7(_object_spread$7({}, config), {
@@ -1917,12 +2258,14 @@ function _unsupported_iterable_to_array$6(o, minLen) {
1917
2258
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
1918
2259
  }
1919
2260
  /**
1920
- * Merges both startWith and tapFirst to initialize a pipe.
2261
+ * Combines `startWith` and {@link tapFirst} to initialize an observable pipe with a side-effect on the first emission.
1921
2262
  *
1922
- * @param initial
1923
- * @param tap
1924
- * @param skipFirst
1925
- * @returns
2263
+ * Emits the `initial` value first, then taps on the first emitted value to run the provided callback.
2264
+ *
2265
+ * @param tap - side-effect function called with the first value
2266
+ * @param initial - optional starting value emitted before the source
2267
+ * @param skipFirst - if true, skips tapping the initial value
2268
+ * @returns an operator that initializes the pipe with a tap
1926
2269
  */ function initialize(tap, initial, skipFirst) {
1927
2270
  return function(source) {
1928
2271
  var subscriber = source.pipe(rxjs.startWith(initial), tapFirst(function(x) {
@@ -1932,11 +2275,11 @@ function _unsupported_iterable_to_array$6(o, minLen) {
1932
2275
  };
1933
2276
  }
1934
2277
  /**
1935
- * Taps once on the first element.
2278
+ * Executes a side-effect on the first emission from the observable, then passes all values through.
1936
2279
  *
1937
- * @param tap
1938
- * @param skipFirst
1939
- * @returns
2280
+ * @param tap - the side-effect function to call once
2281
+ * @param skipFirst - if true, skips the very first emission before tapping
2282
+ * @returns an operator that taps the first value
1940
2283
  */ function tapFirst(tap) {
1941
2284
  var skipFirst = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
1942
2285
  return rxjs.skipWhile(function(value) {
@@ -1946,13 +2289,13 @@ function _unsupported_iterable_to_array$6(o, minLen) {
1946
2289
  });
1947
2290
  }
1948
2291
  /**
1949
- * Prevents an observable from emitting complete until it is unsubscribed from.
2292
+ * Wraps an observable so that it never emits `complete` until it is unsubscribed.
1950
2293
  *
1951
- * The subscription will never have complete() called as complete only gets called after it unsubscribes,
1952
- * so use finalize() if additional cleanup is required.
2294
+ * The subscription will never have `complete()` called since it only triggers after unsubscription.
2295
+ * Use `finalize()` for additional cleanup.
1953
2296
  *
1954
- * @param obs
1955
- * @returns
2297
+ * @param obs - the source observable to wrap
2298
+ * @returns an observable that only completes on unsubscription
1956
2299
  */ function preventComplete(obs) {
1957
2300
  var complete = new rxjs.BehaviorSubject(0);
1958
2301
  return rxjs.combineLatest([
@@ -1966,12 +2309,18 @@ function _unsupported_iterable_to_array$6(o, minLen) {
1966
2309
  }));
1967
2310
  }
1968
2311
  /**
1969
- * Similar to from, but uses a Getter to keeps the Observable cold until it is subscribed to, then calls the promise or observable.
2312
+ * Creates a cold observable that defers execution of the getter until subscription, then shares the result.
1970
2313
  *
1971
- * The result value of the promise or the latest value of the observable is shared.
2314
+ * Unlike `from()`, the promise/observable is not created until the first subscriber connects.
1972
2315
  *
1973
- * @param getter
1974
- * @returns
2316
+ * @example
2317
+ * ```ts
2318
+ * const data$ = lazyFrom(() => fetch('/api/data').then(r => r.json()));
2319
+ * // The fetch is not called until data$ is subscribed to
2320
+ * ```
2321
+ *
2322
+ * @param getter - factory that returns a Promise or Observable
2323
+ * @returns a shared observable that defers execution until subscription
1975
2324
  */ function lazyFrom(getter) {
1976
2325
  return rxjs.of(undefined).pipe(rxjs.mergeMap(function() {
1977
2326
  return rxjs.from(getter());
@@ -1979,10 +2328,13 @@ function _unsupported_iterable_to_array$6(o, minLen) {
1979
2328
  }
1980
2329
 
1981
2330
  /**
1982
- * Convenience function for building an OperatorFunction that uses filterUniqueFunction().
2331
+ * RxJS operator that filters an array to unique items based on a key reader function.
1983
2332
  *
1984
- * @param readKey
1985
- * @param additionalKeys
2333
+ * Uses {@link filterUniqueFunction} to deduplicate emitted arrays by extracting a key from each item.
2334
+ *
2335
+ * @param readKey - function to extract the unique key from each item
2336
+ * @param additionalKeysInput - optional additional keys to include in the unique set
2337
+ * @returns an operator that emits deduplicated arrays
1986
2338
  */ function filterUnique(readKey, additionalKeysInput) {
1987
2339
  var filterFn = util.filterUniqueFunction(readKey, additionalKeysInput);
1988
2340
  return rxjs.map(function(x) {
@@ -1994,10 +2346,23 @@ function _unsupported_iterable_to_array$6(o, minLen) {
1994
2346
  * Default amount of throttle in milliseconds used by AsyncPusher.
1995
2347
  */ var DEFAULT_ASYNC_PUSHER_THROTTLE = 200;
1996
2348
  /**
1997
- * Creates an AsyncPusher.
2349
+ * Creates an {@link AsyncPusher} — a callable function backed by a throttled {@link BehaviorSubject}.
1998
2350
  *
1999
- * @param config
2000
- * @returns
2351
+ * Each call pushes a value onto the internal subject and returns the shared, throttled observable.
2352
+ * Useful for debouncing repeated calls while sharing a single observable output.
2353
+ *
2354
+ * @example
2355
+ * ```ts
2356
+ * const pusher = asyncPusher<string>({ throttle: 100 });
2357
+ * const result$ = pusher('hello');
2358
+ * // subsequent calls within 100ms are throttled
2359
+ * pusher('world');
2360
+ * // clean up
2361
+ * pusher.destroy();
2362
+ * ```
2363
+ *
2364
+ * @param config - optional throttle, distinct, and pipe settings
2365
+ * @returns an async pusher function
2001
2366
  */ function asyncPusher() {
2002
2367
  var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2003
2368
  var _config_throttle = config.throttle, throttle = _config_throttle === void 0 ? DEFAULT_ASYNC_PUSHER_THROTTLE : _config_throttle, cleanupObs = config.cleanupObs, _config_distinct = config.distinct, distinct = _config_distinct === void 0 ? true : _config_distinct, pipeObs = config.pipe;
@@ -2039,12 +2404,12 @@ function _unsupported_iterable_to_array$6(o, minLen) {
2039
2404
  return pusher;
2040
2405
  }
2041
2406
  /**
2042
- * Creates a cache that returns an AsyncPusher.
2407
+ * Creates a cached factory that lazily creates and returns an {@link AsyncPusher}.
2043
2408
  *
2044
- * The CachedFactoryWithInput resunt can optionally be pass an observable to watch for the cleanup process.
2409
+ * The factory optionally accepts a cleanup observable when it completes, the pusher is destroyed.
2045
2410
  *
2046
- * @param config
2047
- * @returns
2411
+ * @param config - optional config passed to the underlying async pusher
2412
+ * @returns a cached factory that produces an async pusher
2048
2413
  */ function asyncPusherCache(config) {
2049
2414
  return util.cachedGetter(function(cleanupObs) {
2050
2415
  var pusher = asyncPusher(config);
@@ -2102,10 +2467,11 @@ function _unsupported_iterable_to_array$5(o, minLen) {
2102
2467
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
2103
2468
  }
2104
2469
  /**
2105
- * Creates a map function that maps the input Map to an Observable that returns values mapped from the map's values.
2470
+ * Creates a function that takes a `Map` and combines the latest emissions from observables
2471
+ * created from each map value.
2106
2472
  *
2107
- * @param mapToObs
2108
- * @returns
2473
+ * @param mapToObs - function to transform each map value into an observable
2474
+ * @returns a function that converts a Map to a combined observable of results
2109
2475
  */ function combineLatestFromMapValuesObsFn(mapToObs) {
2110
2476
  var combineArrayFn = combineLatestFromArrayObsFn(mapToObs);
2111
2477
  return function(latestMap) {
@@ -2115,13 +2481,37 @@ function _unsupported_iterable_to_array$5(o, minLen) {
2115
2481
  return combineArrayFn(mapValues);
2116
2482
  };
2117
2483
  }
2118
- function combineLatestFromArrayObsFn(mapToObs) {
2484
+ /**
2485
+ * Creates a function that takes an array of values, maps each to an observable, and combines their latest emissions.
2486
+ *
2487
+ * Returns `of([])` for empty arrays.
2488
+ *
2489
+ * @param mapToObs - function to transform each value into an observable
2490
+ * @returns a function that converts an array to a combined observable
2491
+ */ function combineLatestFromArrayObsFn(mapToObs) {
2119
2492
  return function(latest) {
2120
2493
  var newObs = latest.map(mapToObs);
2121
2494
  return newObs.length ? rxjs.combineLatest(newObs) : rxjs.of([]);
2122
2495
  };
2123
2496
  }
2124
- function combineLatestFromObject(objectMap) {
2497
+ /**
2498
+ * Combines the latest values from an object of observables into a single observable of resolved values.
2499
+ *
2500
+ * Each key in the input object maps to an observable (or static value). The result observable
2501
+ * emits an object with the same keys, where each value is the latest emission from its source.
2502
+ *
2503
+ * @example
2504
+ * ```ts
2505
+ * const result$ = combineLatestFromObject({
2506
+ * name: of('Alice'),
2507
+ * age: of(30)
2508
+ * });
2509
+ * // emits { name: 'Alice', age: 30 }
2510
+ * ```
2511
+ *
2512
+ * @param objectMap - an object whose values are observables or static values
2513
+ * @returns an observable that emits the resolved object
2514
+ */ function combineLatestFromObject(objectMap) {
2125
2515
  var pairs = util.allKeyValueTuples(objectMap);
2126
2516
  var observables = pairs.map(function(x) {
2127
2517
  return asObservable(x[1]).pipe(rxjs.map(function(value) {
@@ -2142,23 +2532,40 @@ function combineLatestFromObject(objectMap) {
2142
2532
  }
2143
2533
  // MARK: Keys Map
2144
2534
  /**
2145
- * Convenience function for creating a map() operator function using keyValueMapFactory().
2535
+ * RxJS operator that maps an array of items to a `Map<K, T>` using the provided key reader.
2146
2536
  *
2147
- * @param read
2148
- * @returns
2537
+ * @param read - function to extract the key from each item
2538
+ * @returns an operator that converts an array into a keyed Map
2149
2539
  */ function keyValueMap(read) {
2150
2540
  return rxjs.map(util.keyValueMapFactory(read));
2151
2541
  }
2152
2542
  /**
2153
- * Convenience function for creating a map() operator function using multiKeyValueMapFactory().
2543
+ * RxJS operator that maps an array of items to a `Map<K, T>` using a multi-key reader,
2544
+ * allowing each item to appear under multiple keys.
2154
2545
  *
2155
- * @param read
2156
- * @returns
2546
+ * @param read - function to extract multiple keys from each item
2547
+ * @returns an operator that converts an array into a multi-keyed Map
2157
2548
  */ function multiKeyValueMap(read) {
2158
2549
  return rxjs.map(util.multiKeyValueMapFactory(read));
2159
2550
  }
2160
2551
 
2161
- function errorOnEmissionsInPeriod(config) {
2552
+ /**
2553
+ * RxJS operator that throws an error (or switches to an alternative observable) when too many
2554
+ * emissions occur within a rolling time period.
2555
+ *
2556
+ * Useful as a safety valve to detect infinite loops or runaway observables.
2557
+ *
2558
+ * @example
2559
+ * ```ts
2560
+ * source$.pipe(
2561
+ * errorOnEmissionsInPeriod({ maxEmissionsPerPeriod: 100, period: 1000 })
2562
+ * ).subscribe();
2563
+ * // throws if more than 100 emissions occur within 1 second
2564
+ * ```
2565
+ *
2566
+ * @param config - period duration, max emissions, and error/fallback handling
2567
+ * @returns an operator that monitors emission frequency
2568
+ */ function errorOnEmissionsInPeriod(config) {
2162
2569
  var _config_period = config.period, period = _config_period === void 0 ? 1000 : _config_period, maxEmissionsPerPeriod = config.maxEmissionsPerPeriod, onError = config.onError, inputErrorFactory = config.errorFactory, inputErrorMessage = config.errorMessage, switchToObs = config.switchToObs;
2163
2570
  var errorMessage = inputErrorMessage !== null && inputErrorMessage !== void 0 ? inputErrorMessage : 'errorOnEmissionsInPeriod(): Too many emissions in time period.';
2164
2571
  var errorFactory = inputErrorFactory ? inputErrorFactory : !switchToObs ? function() {
@@ -2189,22 +2596,39 @@ function errorOnEmissionsInPeriod(config) {
2189
2596
  };
2190
2597
  }
2191
2598
 
2192
- function setContainsAllValuesFrom(valuesObs) {
2599
+ /**
2600
+ * RxJS operator that checks whether the emitted `Set` contains all values from the given observable.
2601
+ *
2602
+ * @param valuesObs - observable of values to check against
2603
+ * @returns an operator that emits true if all values are contained in the set
2604
+ */ function setContainsAllValuesFrom(valuesObs) {
2193
2605
  return combineLatestMapFrom(valuesObs, function(set, values) {
2194
2606
  return util.setContainsAllValues(set, values !== null && values !== void 0 ? values : []);
2195
2607
  });
2196
2608
  }
2197
- function setContainsAnyValueFrom(valuesObs) {
2609
+ /**
2610
+ * RxJS operator that checks whether the emitted `Set` contains any value from the given observable.
2611
+ *
2612
+ * @param valuesObs - observable of values to check against
2613
+ * @returns an operator that emits true if any value is contained in the set
2614
+ */ function setContainsAnyValueFrom(valuesObs) {
2198
2615
  return combineLatestMapFrom(valuesObs, function(set, values) {
2199
2616
  return util.setContainsAnyValue(set, values !== null && values !== void 0 ? values : []);
2200
2617
  });
2201
2618
  }
2202
- function setContainsNoValueFrom(valuesObs) {
2619
+ /**
2620
+ * RxJS operator that checks whether the emitted `Set` contains none of the values from the given observable.
2621
+ *
2622
+ * @param valuesObs - observable of values to check against
2623
+ * @returns an operator that emits true if no values are contained in the set
2624
+ */ function setContainsNoValueFrom(valuesObs) {
2203
2625
  return combineLatestMapFrom(valuesObs, function(set, values) {
2204
2626
  return util.setContainsNoneOfValue(set, values !== null && values !== void 0 ? values : []);
2205
2627
  });
2206
2628
  }
2207
- function distinctUntilHasDifferentValues() {
2629
+ /**
2630
+ * `distinctUntilChanged` variant for iterables that only emits when the contained values change.
2631
+ */ function distinctUntilHasDifferentValues() {
2208
2632
  return rxjs.distinctUntilChanged(util.hasSameValues);
2209
2633
  }
2210
2634
  function distinctUntilItemsHaveDifferentValues(readValues) {
@@ -2215,7 +2639,24 @@ function distinctUntilItemsValueChanges(readValues, isEqualComparator) {
2215
2639
  }
2216
2640
 
2217
2641
  /**
2218
- * Uses a SearchStringFilterFunction to filter values.
2642
+ * RxJS operator that filters an emitted array by a reactive search string.
2643
+ *
2644
+ * Combines the source array with the `search$` observable and applies the configured
2645
+ * search string filter function. When the search is null/undefined, all items pass through.
2646
+ *
2647
+ * @example
2648
+ * ```ts
2649
+ * const items$ = of(['apple', 'banana', 'cherry']);
2650
+ * const search$ = new BehaviorSubject<string>('an');
2651
+ *
2652
+ * items$.pipe(
2653
+ * filterWithSearchString({ filter: (x) => x, search$ })
2654
+ * ).subscribe(console.log);
2655
+ * // ['banana']
2656
+ * ```
2657
+ *
2658
+ * @param config - search filter configuration with filter function and search$ observable
2659
+ * @returns an operator that filters arrays by search string
2219
2660
  */ function filterWithSearchString(config) {
2220
2661
  var filter = config.filter, search$ = config.search$;
2221
2662
  var filterFactory = util.searchStringFilterFunction(filter);
@@ -2231,15 +2672,33 @@ function distinctUntilItemsValueChanges(readValues, isEqualComparator) {
2231
2672
  }
2232
2673
 
2233
2674
  /**
2234
- * Convenience function to subscribe to the input observable and use the first value.
2675
+ * Subscribes to the observable, calls the provided function with the first emitted value,
2676
+ * then automatically unsubscribes.
2235
2677
  *
2236
- * @param useFn
2678
+ * @param obs - the source observable
2679
+ * @param useFn - function to call with the first value
2237
2680
  */ function useFirst(obs, useFn) {
2238
2681
  obs.pipe(rxjs.first()).subscribe(useFn);
2239
2682
  }
2240
2683
 
2241
2684
  /**
2242
- * Creates a switchMap operator that will emit the stream of events from the input LoadingContext as soon as a non-null LoadingContext is emitted.
2685
+ * Creates a `switchMap` operator that subscribes to the {@link LoadingContext.stream$} of each emitted {@link LoadingContext},
2686
+ * emitting `undefined` when the context is nullish.
2687
+ *
2688
+ * Useful for flattening an observable of optional loading contexts into a single stream of loading events.
2689
+ *
2690
+ * @example
2691
+ * ```ts
2692
+ * const context$ = new BehaviorSubject<Maybe<LoadingContext>>(myLoadingContext);
2693
+ *
2694
+ * const events$ = context$.pipe(
2695
+ * switchMapMaybeLoadingContextStream()
2696
+ * );
2697
+ * // emits LoadingContextEvent values from myLoadingContext.stream$
2698
+ * // emits undefined when context$ emits null/undefined
2699
+ * ```
2700
+ *
2701
+ * @returns an RxJS operator that switches to the stream$ of each non-null LoadingContext
2243
2702
  */ function switchMapMaybeLoadingContextStream() {
2244
2703
  return rxjs.switchMap(function(x) {
2245
2704
  return x != null ? x.stream$ : rxjs.of(undefined);
@@ -2319,20 +2778,33 @@ function _unsupported_iterable_to_array$4(o, minLen) {
2319
2778
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
2320
2779
  }
2321
2780
  /**
2322
- * Returns true if the two LoadingStates are considered equal, by comparing the loading, loadingProgress, error, and value properties.
2781
+ * Compares two {@link LoadingState} instances for shallow equality across all key properties.
2323
2782
  *
2324
- * @param a LoadingState a
2325
- * @param b LoadingState b
2326
- * @returns Returns true if the input LoadingStates are considered equal.
2783
+ * @example
2784
+ * ```ts
2785
+ * const a = successResult('hello');
2786
+ * const b = successResult('hello');
2787
+ * isLoadingStateEqual(a, b); // true (same value reference is not required, but same primitive is)
2788
+ *
2789
+ * const c = beginLoading();
2790
+ * isLoadingStateEqual(a, c); // false
2791
+ * ```
2792
+ *
2793
+ * @param a - first loading state
2794
+ * @param b - second loading state
2795
+ * @returns true if loading, loadingProgress, error, and value are all strictly equal
2327
2796
  */ function isLoadingStateEqual(a, b) {
2328
2797
  return a.loading === b.loading && a.loadingProgress === b.loadingProgress && a.error === b.error && a.value === b.value;
2329
2798
  }
2330
2799
  /**
2331
- * Returns true if the input LoadingErrorPair has the same loading (truthy vs falsy) and error values as the other LoadingErrorPair.
2800
+ * Compares the metadata (loading flag, loading progress, and error) of two {@link LoadingErrorPair} instances,
2801
+ * using loose equality for loading and nullish-aware comparison for progress and error.
2802
+ *
2803
+ * Does not compare the `value` property — only structural metadata.
2332
2804
  *
2333
- * @param a LoadingErrorPair a
2334
- * @param b LoadingErrorPair b
2335
- * @returns Returns true if the input's metadata is considered equivalent.
2805
+ * @param a - first loading error pair
2806
+ * @param b - second loading error pair
2807
+ * @returns true if both pairs have equivalent metadata
2336
2808
  */ function isLoadingStateMetadataEqual(a, b) {
2337
2809
  return a.loading == b.loading && util.valuesAreBothNullishOrEquivalent(a.loadingProgress, b.loadingProgress) && util.valuesAreBothNullishOrEquivalent(a.error, b.error);
2338
2810
  }
@@ -2355,10 +2827,21 @@ function _unsupported_iterable_to_array$4(o, minLen) {
2355
2827
  */ LoadingStateType["ERROR"] = "error";
2356
2828
  })(exports.LoadingStateType || (exports.LoadingStateType = {}));
2357
2829
  /**
2358
- * Returns the LoadingStateType for the input LoadingState
2830
+ * Determines the current {@link LoadingStateType} of a {@link LoadingState}.
2359
2831
  *
2360
- * @param loadingState
2361
- * @returns
2832
+ * Returns `LOADING` if still loading, `SUCCESS` if finished with a value key,
2833
+ * `ERROR` if finished with an error key, or `IDLE` if finished with neither.
2834
+ *
2835
+ * @example
2836
+ * ```ts
2837
+ * loadingStateType(beginLoading()); // LoadingStateType.LOADING
2838
+ * loadingStateType(successResult(42)); // LoadingStateType.SUCCESS
2839
+ * loadingStateType(errorResult(new Error())); // LoadingStateType.ERROR
2840
+ * loadingStateType({ loading: false }); // LoadingStateType.IDLE
2841
+ * ```
2842
+ *
2843
+ * @param loadingState - the loading state to classify
2844
+ * @returns the corresponding {@link LoadingStateType}
2362
2845
  */ function loadingStateType(loadingState) {
2363
2846
  var isLoading = !isLoadingStateFinishedLoading(loadingState);
2364
2847
  var type;
@@ -2375,7 +2858,23 @@ function _unsupported_iterable_to_array$4(o, minLen) {
2375
2858
  }
2376
2859
  return type;
2377
2860
  }
2378
- function isLoadingStateFinishedLoading(state) {
2861
+ /**
2862
+ * Whether the given {@link LoadingState} has finished loading.
2863
+ *
2864
+ * Returns `true` when `loading` is explicitly `false`, or when `loading` is not `true`
2865
+ * and either a value, error, or `null` value is present.
2866
+ *
2867
+ * @example
2868
+ * ```ts
2869
+ * isLoadingStateFinishedLoading(successResult('done')); // true
2870
+ * isLoadingStateFinishedLoading(beginLoading()); // false
2871
+ * isLoadingStateFinishedLoading({ loading: false }); // true
2872
+ * isLoadingStateFinishedLoading(null); // false
2873
+ * ```
2874
+ *
2875
+ * @param state - the loading state to check (may be null/undefined)
2876
+ * @returns true if loading is complete
2877
+ */ function isLoadingStateFinishedLoading(state) {
2379
2878
  if (state) {
2380
2879
  var loading = state.loading;
2381
2880
  if (loading === true) {
@@ -2388,7 +2887,16 @@ function isLoadingStateFinishedLoading(state) {
2388
2887
  }
2389
2888
  }
2390
2889
  /**
2391
- * Returns a LoadingState that has no result and is not loading.
2890
+ * Creates an idle {@link LoadingState} with `loading: false` and no value or error.
2891
+ *
2892
+ * Represents a state where no loading has been initiated yet.
2893
+ *
2894
+ * @example
2895
+ * ```ts
2896
+ * const state = idleLoadingState();
2897
+ * // { loading: false }
2898
+ * loadingStateType(state); // LoadingStateType.IDLE
2899
+ * ```
2392
2900
  */ function idleLoadingState() {
2393
2901
  return {
2394
2902
  loading: false
@@ -2401,7 +2909,13 @@ function beginLoading(state) {
2401
2909
  loading: true
2402
2910
  };
2403
2911
  }
2404
- function beginLoadingPage(page, state) {
2912
+ /**
2913
+ * Creates a {@link PageLoadingState} that is loading for the given page number.
2914
+ *
2915
+ * @param page - the page number being loaded
2916
+ * @param state - optional partial state to merge
2917
+ * @returns a page loading state with `loading: true`
2918
+ */ function beginLoadingPage(page, state) {
2405
2919
  return state ? _object_spread_props$6(_object_spread$6({
2406
2920
  page: page
2407
2921
  }, state), {
@@ -2411,45 +2925,100 @@ function beginLoadingPage(page, state) {
2411
2925
  loading: true
2412
2926
  };
2413
2927
  }
2414
- function successResult(value) {
2928
+ /**
2929
+ * Creates a successful {@link LoadingState} with the given value and `loading: false`.
2930
+ *
2931
+ * @example
2932
+ * ```ts
2933
+ * const state = successResult({ name: 'Alice' });
2934
+ * // { value: { name: 'Alice' }, loading: false }
2935
+ * ```
2936
+ *
2937
+ * @param value - the loaded value
2938
+ * @returns a loading state representing a successful result
2939
+ */ function successResult(value) {
2415
2940
  return {
2416
2941
  value: value,
2417
2942
  loading: false
2418
2943
  };
2419
2944
  }
2420
- function successPageResult(page, value) {
2945
+ /**
2946
+ * Creates a successful {@link PageLoadingState} for a specific page.
2947
+ *
2948
+ * @param page - the page number
2949
+ * @param value - the loaded value
2950
+ * @returns a page loading state representing success
2951
+ */ function successPageResult(page, value) {
2421
2952
  return _object_spread_props$6(_object_spread$6({}, successResult(value)), {
2422
2953
  page: page
2423
2954
  });
2424
2955
  }
2425
- function errorResult(error) {
2956
+ /**
2957
+ * Creates a {@link LoadingState} representing an error with `loading: false`.
2958
+ *
2959
+ * Converts the input error to a {@link ReadableError} via {@link toReadableError}.
2960
+ *
2961
+ * @example
2962
+ * ```ts
2963
+ * const state = errorResult(new Error('Not found'));
2964
+ * // { error: { message: 'Not found', ... }, loading: false }
2965
+ * ```
2966
+ *
2967
+ * @param error - the error to wrap (string, Error, or ReadableError)
2968
+ * @returns a loading state representing an error
2969
+ */ function errorResult(error) {
2426
2970
  return {
2427
2971
  error: util.toReadableError(error),
2428
2972
  loading: false
2429
2973
  };
2430
2974
  }
2431
- function errorPageResult(page, error) {
2975
+ /**
2976
+ * Creates a {@link PageLoadingState} representing an error for a specific page.
2977
+ *
2978
+ * @param page - the page number
2979
+ * @param error - the error to include
2980
+ * @returns a page loading state representing an error
2981
+ */ function errorPageResult(page, error) {
2432
2982
  return _object_spread_props$6(_object_spread$6({}, errorResult(error)), {
2433
2983
  page: page
2434
2984
  });
2435
2985
  }
2436
2986
  /**
2437
- * Returns true if any of the input LoadingStates return true for isLoadingStateLoading().
2987
+ * Whether any of the given {@link LoadingState} instances are currently loading.
2438
2988
  *
2439
- * @param states
2440
- * @returns
2989
+ * @example
2990
+ * ```ts
2991
+ * isAnyLoadingStateInLoadingState([successResult(1), beginLoading()]); // true
2992
+ * isAnyLoadingStateInLoadingState([successResult(1), successResult(2)]); // false
2993
+ * ```
2994
+ *
2995
+ * @param states - array of loading states to check
2996
+ * @returns true if at least one state is loading
2441
2997
  */ function isAnyLoadingStateInLoadingState(states) {
2442
2998
  return util.reduceBooleansWithOr(states.map(isLoadingStateLoading), false);
2443
2999
  }
2444
3000
  /**
2445
- * Returns true if all input LoadingStates return true for isLoadingStateLoading().
3001
+ * Whether all given {@link LoadingState} instances have finished loading.
2446
3002
  *
2447
- * @param states
2448
- * @returns
3003
+ * @example
3004
+ * ```ts
3005
+ * areAllLoadingStatesFinishedLoading([successResult(1), successResult(2)]); // true
3006
+ * areAllLoadingStatesFinishedLoading([successResult(1), beginLoading()]); // false
3007
+ * ```
3008
+ *
3009
+ * @param states - array of loading states to check
3010
+ * @returns true if every state has finished loading
2449
3011
  */ function areAllLoadingStatesFinishedLoading(states) {
2450
3012
  return util.reduceBooleansWithAnd(states.map(isLoadingStateFinishedLoading), true);
2451
3013
  }
2452
- function isLoadingStateWithStateType(type) {
3014
+ /**
3015
+ * Creates a predicate function that checks whether a {@link LoadingState} matches the given {@link LoadingStateType}.
3016
+ *
3017
+ * When the target type is `IDLE`, returns `true` for null/undefined states.
3018
+ *
3019
+ * @param type - the loading state type to match against
3020
+ * @returns a predicate function for the given type
3021
+ */ function isLoadingStateWithStateType(type) {
2453
3022
  var defaultResult = type === exports.LoadingStateType.IDLE ? true : false;
2454
3023
  return function(state) {
2455
3024
  if (state) {
@@ -2487,10 +3056,17 @@ function isLoadingStateWithStateType(type) {
2487
3056
  * @returns
2488
3057
  */ var isLoadingStateInErrorState = isLoadingStateWithStateType(exports.LoadingStateType.ERROR);
2489
3058
  /**
2490
- * Whether or not the input LoadingState has a non-undefined value.
3059
+ * Type guard that checks whether a {@link LoadingState} has a non-undefined value, regardless of loading status.
2491
3060
  *
2492
- * @param state
2493
- * @returns
3061
+ * @example
3062
+ * ```ts
3063
+ * isLoadingStateWithDefinedValue(successResult('hello')); // true
3064
+ * isLoadingStateWithDefinedValue(successResult(null)); // true (null is defined)
3065
+ * isLoadingStateWithDefinedValue(beginLoading()); // false
3066
+ * ```
3067
+ *
3068
+ * @param state - the loading state to check
3069
+ * @returns true if the state has a defined (non-undefined) value
2494
3070
  */ function isLoadingStateWithDefinedValue(state) {
2495
3071
  if (state) {
2496
3072
  return state.value !== undefined;
@@ -2499,10 +3075,16 @@ function isLoadingStateWithStateType(type) {
2499
3075
  }
2500
3076
  }
2501
3077
  /**
2502
- * Whether or not the input LoadingState has a non-null error defined. It may be loading.
3078
+ * Type guard that checks whether a {@link LoadingState} has a non-null error, regardless of loading status.
2503
3079
  *
2504
- * @param state
2505
- * @returns
3080
+ * @example
3081
+ * ```ts
3082
+ * isLoadingStateWithError(errorResult(new Error('fail'))); // true
3083
+ * isLoadingStateWithError(successResult('ok')); // false
3084
+ * ```
3085
+ *
3086
+ * @param state - the loading state to check
3087
+ * @returns true if the state has an error
2506
3088
  */ function isLoadingStateWithError(state) {
2507
3089
  if (state) {
2508
3090
  return state.error != null;
@@ -2511,10 +3093,10 @@ function isLoadingStateWithStateType(type) {
2511
3093
  }
2512
3094
  }
2513
3095
  /**
2514
- * Whether or not the input LoadingState is not loading and has a non-null value.
3096
+ * Type guard that checks whether a {@link LoadingState} has finished loading and has a defined value.
2515
3097
  *
2516
- * @param state
2517
- * @returns
3098
+ * @param state - the loading state to check
3099
+ * @returns true if finished loading with a non-undefined value
2518
3100
  */ function isLoadingStateFinishedLoadingWithDefinedValue(state) {
2519
3101
  if (state) {
2520
3102
  return isLoadingStateFinishedLoading(state) && state.value !== undefined;
@@ -2523,10 +3105,10 @@ function isLoadingStateWithStateType(type) {
2523
3105
  }
2524
3106
  }
2525
3107
  /**
2526
- * Whether or not the input LoadingState is not loading and has an error defined.
3108
+ * Type guard that checks whether a {@link LoadingState} has finished loading and has an error.
2527
3109
  *
2528
- * @param state
2529
- * @returns
3110
+ * @param state - the loading state to check
3111
+ * @returns true if finished loading with an error
2530
3112
  */ function isLoadingStateFinishedLoadingWithError(state) {
2531
3113
  if (state) {
2532
3114
  return isLoadingStateFinishedLoading(state) && state.error != null;
@@ -2535,12 +3117,26 @@ function isLoadingStateWithStateType(type) {
2535
3117
  }
2536
3118
  }
2537
3119
  /**
2538
- * Returns true if the metadata from both input states are equivalent.
3120
+ * Compares the metadata (page, loading, error) of two {@link PageLoadingState} instances for equivalence.
2539
3121
  *
2540
- * The considered metadata is the page, loading, and error values.
3122
+ * Does not compare values only structural metadata.
3123
+ *
3124
+ * @example
3125
+ * ```ts
3126
+ * isPageLoadingStateMetadataEqual(
3127
+ * { page: 1, loading: true },
3128
+ * { page: 1, loading: true }
3129
+ * ); // true
2541
3130
  *
2542
- * @param a
2543
- * @param b
3131
+ * isPageLoadingStateMetadataEqual(
3132
+ * { page: 1 },
3133
+ * { page: 2 }
3134
+ * ); // false
3135
+ * ```
3136
+ *
3137
+ * @param a - first page loading state
3138
+ * @param b - second page loading state
3139
+ * @returns true if metadata is equivalent
2544
3140
  */ function isPageLoadingStateMetadataEqual(a, b) {
2545
3141
  return util.valuesAreBothNullishOrEquivalent(a.page, b.page) && a.loading == b.loading && util.valuesAreBothNullishOrEquivalent(a.error, b.error);
2546
3142
  }
@@ -2597,7 +3193,13 @@ function mergeLoadingStates() {
2597
3193
  return result;
2598
3194
  }
2599
3195
  /**
2600
- * Returns a new merged state to be loading or idle, and clears the current/error value. It will have a LoadingStateType of LOADING if loading is true.
3196
+ * Returns a copy of the state with the value and error cleared, and `loading` set to the given flag.
3197
+ *
3198
+ * Useful for resetting a state back to loading or idle without losing other metadata (e.g., page).
3199
+ *
3200
+ * @param state - the state to copy metadata from
3201
+ * @param loading - whether to mark as loading (defaults to true)
3202
+ * @returns a new state with value/error cleared
2601
3203
  */ function mergeLoadingStateWithLoading(state) {
2602
3204
  var loading = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
2603
3205
  return _object_spread_props$6(_object_spread$6({}, state), {
@@ -2607,7 +3209,11 @@ function mergeLoadingStates() {
2607
3209
  });
2608
3210
  }
2609
3211
  /**
2610
- * Returns a new merged state with the input value. It will have a LoadingStateType of SUCCESS now.
3212
+ * Returns a copy of the state with the given value, `loading: false`, and error cleared.
3213
+ *
3214
+ * @param state - the state to copy metadata from
3215
+ * @param value - the new value to set
3216
+ * @returns a new state representing success
2611
3217
  */ function mergeLoadingStateWithValue(state, value) {
2612
3218
  return _object_spread_props$6(_object_spread$6({}, state), {
2613
3219
  value: value !== null && value !== void 0 ? value : undefined,
@@ -2616,14 +3222,28 @@ function mergeLoadingStates() {
2616
3222
  });
2617
3223
  }
2618
3224
  /**
2619
- * Returns a new merged state with the input error. It will have a LoadingStateType of ERROR now.
3225
+ * Returns a copy of the state with the given error and `loading: false`.
3226
+ *
3227
+ * @param state - the state to copy metadata from
3228
+ * @param error - the error to set
3229
+ * @returns a new state representing an error
2620
3230
  */ function mergeLoadingStateWithError(state, error) {
2621
3231
  return _object_spread_props$6(_object_spread$6({}, state), {
2622
3232
  loading: false,
2623
3233
  error: error
2624
3234
  });
2625
3235
  }
2626
- function mapMultipleLoadingStateResults(input, config) {
3236
+ /**
3237
+ * Maps multiple {@link LoadingState} results into a single state using a value mapping or state mapping function.
3238
+ *
3239
+ * Returns `undefined` if any input is still loading or has an error.
3240
+ *
3241
+ * @param input - array of loading states to combine
3242
+ * @param config - mapping configuration with either `mapValues` or `mapState`
3243
+ * @returns the combined loading state, or undefined if inputs are not ready
3244
+ *
3245
+ * @throws {Error} When neither `mapValues` nor `mapState` is provided in the config.
3246
+ */ function mapMultipleLoadingStateResults(input, config) {
2627
3247
  var mapValues = config.mapValues, mapState = config.mapState;
2628
3248
  var loading = isAnyLoadingStateInLoadingState(input);
2629
3249
  var error = input.map(function(x) {
@@ -2669,7 +3289,13 @@ function mapLoadingStateResults(input, config) {
2669
3289
  }
2670
3290
  return result;
2671
3291
  }
2672
- function mapLoadingStateValueFunction(mapFn) {
3292
+ /**
3293
+ * Creates a function that extracts and maps the value from a {@link LoadingState}, returning undefined
3294
+ * when the state has no value.
3295
+ *
3296
+ * @param mapFn - function to transform the value and state into the output type
3297
+ * @returns a function that accepts a loading state and returns the mapped value or undefined
3298
+ */ function mapLoadingStateValueFunction(mapFn) {
2673
3299
  return function(state) {
2674
3300
  var result;
2675
3301
  if (state.value != null) {
@@ -3113,7 +3739,12 @@ function distinctLoadingState(inputConfig) {
3113
3739
  });
3114
3740
  }
3115
3741
 
3116
- var DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = function DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION(state, input) {
3742
+ /**
3743
+ * Default function for converting a {@link LoadingState} into a {@link LoadingStateContextEvent}.
3744
+ *
3745
+ * Determines the `loading` flag based on whether an error is present, whether the value is defined,
3746
+ * and the `showLoadingOnUndefinedValue` setting. Loading progress is only included while loading.
3747
+ */ var DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = function DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION(state, input) {
3117
3748
  var showLoadingOnUndefinedValue = input.showLoadingOnUndefinedValue;
3118
3749
  var error = state.error, value = state.value, loadingProgress = state.loadingProgress;
3119
3750
  var loading = false;
@@ -3132,10 +3763,32 @@ var DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = function DEFAULT_LOADING_E
3132
3763
  };
3133
3764
  };
3134
3765
  /**
3135
- * Creates a new LoadingStateContext from the input.
3136
-
3137
- * @param input LoadingStateContextInput
3138
- * @returns LoadingStateContext
3766
+ * Creates a new {@link MutableLoadingStateContext} that wraps an observable of {@link LoadingState} values
3767
+ * and exposes reactive accessors for the loading flag, current value, errors, and state stream.
3768
+ *
3769
+ * Accepts either a raw observable or a {@link LoadingStateContextConfig} for fine-grained control
3770
+ * over how loading events are derived from the state.
3771
+ *
3772
+ * @example
3773
+ * ```ts
3774
+ * // Create a context from a state observable
3775
+ * const context = loadingStateContext(myLoadingState$);
3776
+ *
3777
+ * // Subscribe to the loading flag
3778
+ * context.loading$.subscribe((loading) => console.log('Loading:', loading));
3779
+ *
3780
+ * // Access the value after loading completes
3781
+ * context.value$.subscribe((value) => console.log('Value:', value));
3782
+ *
3783
+ * // Update the state observable later
3784
+ * context.setStateObs(newLoadingState$);
3785
+ *
3786
+ * // Clean up
3787
+ * context.destroy();
3788
+ * ```
3789
+ *
3790
+ * @param input - optional observable or config to initialize the context
3791
+ * @returns a mutable loading state context with reactive accessors
3139
3792
  */ function loadingStateContext(input) {
3140
3793
  var _ref, _ref1;
3141
3794
  var _config = input && rxjs.isObservable(input) ? {
@@ -3191,22 +3844,51 @@ var DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = function DEFAULT_LOADING_E
3191
3844
  }
3192
3845
 
3193
3846
  /**
3194
- * Returns true if the loading state is not loading and is empty.
3847
+ * Whether the {@link ListLoadingState} has no value or an empty array.
3195
3848
  *
3196
- * @param listLoadingState
3197
- * @returns
3849
+ * Returns true if the value is nullish or has zero length, regardless of loading status.
3850
+ *
3851
+ * @example
3852
+ * ```ts
3853
+ * isListLoadingStateWithEmptyValue(successResult([])); // true
3854
+ * isListLoadingStateWithEmptyValue(successResult([1, 2])); // false
3855
+ * isListLoadingStateWithEmptyValue(beginLoading()); // true (no value)
3856
+ * ```
3857
+ *
3858
+ * @param listLoadingState - the list loading state to check
3859
+ * @returns true if the value is empty or absent
3198
3860
  */ function isListLoadingStateWithEmptyValue(listLoadingState) {
3199
3861
  return Boolean(!listLoadingState.value || !listLoadingState.value.length);
3200
3862
  }
3201
3863
  /**
3202
- * Convenience function that merges map() with isListLoadingStateWithEmptyValue()
3864
+ * RxJS operator that maps each emitted {@link ListLoadingState} to a boolean indicating whether the list is empty.
3203
3865
  *
3204
- * @returns
3866
+ * @example
3867
+ * ```ts
3868
+ * of(successResult([])).pipe(
3869
+ * mapIsListLoadingStateWithEmptyValue()
3870
+ * ).subscribe((isEmpty) => console.log(isEmpty)); // true
3871
+ * ```
3872
+ *
3873
+ * @returns an operator that emits true when the list value is empty or absent
3205
3874
  */ function mapIsListLoadingStateWithEmptyValue() {
3206
3875
  return rxjs.map(isListLoadingStateWithEmptyValue);
3207
3876
  }
3208
3877
  /**
3209
- * Wraps an observable output and maps the value to a PageLoadingState.
3878
+ * Wraps an observable and converts its emissions into a {@link PageLoadingState} for the given page number.
3879
+ *
3880
+ * Uses {@link loadingStateFromObs} internally and attaches the page number to each emitted state.
3881
+ *
3882
+ * @example
3883
+ * ```ts
3884
+ * const pageState$ = pageLoadingStateFromObs(fetchItems$, false, 2);
3885
+ * // emits: { loading: true, page: 2 }, then { value: items, loading: false, page: 2 }
3886
+ * ```
3887
+ *
3888
+ * @param obs - the source observable to wrap
3889
+ * @param firstOnly - if true, only takes the first value
3890
+ * @param page - the page number to attach (defaults to 0)
3891
+ * @returns an observable of page loading states
3210
3892
  */ function pageLoadingStateFromObs(obs, firstOnly) {
3211
3893
  var page = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
3212
3894
  return loadingStateFromObs(obs, firstOnly).pipe(rxjs.map(function(x) {
@@ -3215,11 +3897,23 @@ var DEFAULT_LOADING_EVENT_FOR_LOADING_PAIR_FUNCTION = function DEFAULT_LOADING_E
3215
3897
  }));
3216
3898
  }
3217
3899
  /**
3218
- * Returns the value once the LoadingState has finished loading, even if an error occured.
3900
+ * RxJS operator that extracts the array value from a finished {@link ListLoadingState},
3901
+ * defaulting to an empty array when no value is present.
3219
3902
  *
3220
- * The value is defaulted to an empty array.
3903
+ * Combines {@link valueFromFinishedLoadingState} with a default of `[]`.
3221
3904
  *
3222
- * @returns Observable of the value
3905
+ * @example
3906
+ * ```ts
3907
+ * of(successResult([1, 2, 3])).pipe(
3908
+ * arrayValueFromFinishedLoadingState()
3909
+ * ).subscribe((items) => console.log(items)); // [1, 2, 3]
3910
+ *
3911
+ * of(successResult(null)).pipe(
3912
+ * arrayValueFromFinishedLoadingState()
3913
+ * ).subscribe((items) => console.log(items)); // []
3914
+ * ```
3915
+ *
3916
+ * @returns an operator that emits the array value or an empty array
3223
3917
  */ function arrayValueFromFinishedLoadingState() {
3224
3918
  return function(obs) {
3225
3919
  return obs.pipe(valueFromFinishedLoadingState(function() {
@@ -3280,10 +3974,32 @@ function _type_of$2(obj) {
3280
3974
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
3281
3975
  }
3282
3976
  /**
3283
- * Creates a ListLoadingStateContext.
3977
+ * Creates a {@link MutableListLoadingStateContext} that wraps a {@link ListLoadingState} observable
3978
+ * and provides list-specific reactive accessors like `isEmpty$` and `list$`.
3979
+ *
3980
+ * Extends {@link loadingStateContext} with list-aware behavior, including optional array length limiting
3981
+ * via {@link LimitArrayConfig} and empty-state detection streams.
3982
+ *
3983
+ * @example
3984
+ * ```ts
3985
+ * const context = listLoadingStateContext<string>();
3986
+ *
3987
+ * // Set a state observable
3988
+ * context.setStateObs(of(successResult(['a', 'b', 'c'])));
3284
3989
  *
3285
- * @param input Optional configuration for the ListLoadingStateContext.
3286
- * @returns A ListLoadingStateContext.
3990
+ * // Access the list (defaults to [] when undefined)
3991
+ * context.list$.subscribe((list) => console.log(list));
3992
+ * // => ['a', 'b', 'c']
3993
+ *
3994
+ * // Check if the list is empty
3995
+ * context.isEmpty$.subscribe((empty) => console.log('Empty:', empty));
3996
+ * // => false
3997
+ *
3998
+ * context.destroy();
3999
+ * ```
4000
+ *
4001
+ * @param input - optional observable or config to initialize the context
4002
+ * @returns a mutable list loading state context
3287
4003
  */ function listLoadingStateContext(input) {
3288
4004
  var limitArrayConfig = (typeof input === "undefined" ? "undefined" : _type_of$2(input)) === 'object' ? input : undefined;
3289
4005
  var loadingState = loadingStateContext(_object_spread_props$4(_object_spread$4({}, input), {
@@ -3387,7 +4103,21 @@ function _object_spread_props$3(target, source) {
3387
4103
  return target;
3388
4104
  }
3389
4105
  /**
3390
- * Simple LoadingContext implementation
4106
+ * Simple imperative {@link LoadingContext} implementation backed by a {@link BehaviorSubject}.
4107
+ *
4108
+ * Provides methods to manually set loading, success, and error states. Useful in components
4109
+ * or services that need to drive a loading indicator without a dedicated state observable.
4110
+ *
4111
+ * @example
4112
+ * ```ts
4113
+ * const context = new SimpleLoadingContext();
4114
+ * // context starts in loading state by default
4115
+ *
4116
+ * context.setSuccess(); // marks loading as complete
4117
+ * context.setError({ message: 'Something went wrong' }); // sets an error
4118
+ * context.clearError(); // clears the error but preserves loading state
4119
+ * context.destroy(); // completes the internal subject
4120
+ * ```
3391
4121
  */ var SimpleLoadingContext = /*#__PURE__*/ function() {
3392
4122
  function SimpleLoadingContext() {
3393
4123
  var loading = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
@@ -3400,19 +4130,25 @@ function _object_spread_props$3(target, source) {
3400
4130
  }
3401
4131
  _create_class$4(SimpleLoadingContext, [
3402
4132
  {
3403
- key: "destroy",
4133
+ /**
4134
+ * Completes the internal subject, ending the stream.
4135
+ */ key: "destroy",
3404
4136
  value: function destroy() {
3405
4137
  this._subject.complete();
3406
4138
  }
3407
4139
  },
3408
4140
  {
3409
- key: "hasError",
4141
+ /**
4142
+ * Whether the current state has a non-null error.
4143
+ */ key: "hasError",
3410
4144
  value: function hasError() {
3411
4145
  return isLoadingStateWithError(this._subject.value);
3412
4146
  }
3413
4147
  },
3414
4148
  {
3415
- key: "clearError",
4149
+ /**
4150
+ * Clears the current error while preserving other state.
4151
+ */ key: "clearError",
3416
4152
  value: function clearError() {
3417
4153
  this._subject.next(_object_spread_props$3(_object_spread$3({}, this._subject.value), {
3418
4154
  error: undefined
@@ -3420,13 +4156,19 @@ function _object_spread_props$3(target, source) {
3420
4156
  }
3421
4157
  },
3422
4158
  {
3423
- key: "setSuccess",
4159
+ /**
4160
+ * Convenience method to mark loading as complete (sets loading to false).
4161
+ */ key: "setSuccess",
3424
4162
  value: function setSuccess() {
3425
4163
  this.setLoading(false);
3426
4164
  }
3427
4165
  },
3428
4166
  {
3429
- key: "setLoading",
4167
+ /**
4168
+ * Sets the loading flag and clears any existing error.
4169
+ *
4170
+ * @param loading - whether loading is in progress (defaults to true)
4171
+ */ key: "setLoading",
3430
4172
  value: function setLoading() {
3431
4173
  var loading = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
3432
4174
  // clears the current error
@@ -3436,7 +4178,12 @@ function _object_spread_props$3(target, source) {
3436
4178
  }
3437
4179
  },
3438
4180
  {
3439
- key: "setError",
4181
+ /**
4182
+ * Sets an error state with an optional loading flag.
4183
+ *
4184
+ * @param error - the error to set
4185
+ * @param loading - whether loading is still in progress (defaults to false)
4186
+ */ key: "setError",
3440
4187
  value: function setError(error) {
3441
4188
  var loading = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
3442
4189
  this._subject.next({
@@ -3536,7 +4283,31 @@ function _is_native_reflect_construct() {
3536
4283
  })();
3537
4284
  }
3538
4285
  /**
3539
- * Utility object for maintaining a loading stream$. Is triggered into loading, then can be triggered again to see if elements have all completed loading or not.
4286
+ * A {@link SimpleLoadingContext} that determines loading completion by checking whether
4287
+ * all values returned by a check function are defined.
4288
+ *
4289
+ * Useful when loading depends on multiple values arriving asynchronously — call {@link check}
4290
+ * to re-evaluate whether all required values are present.
4291
+ *
4292
+ * @example
4293
+ * ```ts
4294
+ * let valueA: string | undefined;
4295
+ * let valueB: string | undefined;
4296
+ *
4297
+ * const context = new ValuesLoadingContext({
4298
+ * checkDone: () => [valueA, valueB]
4299
+ * });
4300
+ * // context.stream$ emits { loading: true }
4301
+ *
4302
+ * valueA = 'hello';
4303
+ * context.check(); // still loading (valueB is undefined)
4304
+ *
4305
+ * valueB = 'world';
4306
+ * context.check(); // loading complete (both defined)
4307
+ * // context.stream$ emits { loading: false }
4308
+ *
4309
+ * context.destroy();
4310
+ * ```
3540
4311
  */ var ValuesLoadingContext = /*#__PURE__*/ function(SimpleLoadingContext) {
3541
4312
  _inherits(ValuesLoadingContext, SimpleLoadingContext);
3542
4313
  function ValuesLoadingContext() {
@@ -3552,9 +4323,12 @@ function _is_native_reflect_construct() {
3552
4323
  _create_class$3(ValuesLoadingContext, [
3553
4324
  {
3554
4325
  /**
3555
- * Check the array for objects to see if loading is completed.
4326
+ * Re-evaluates the check function to determine whether all values are loaded.
3556
4327
  *
3557
- * The loading state is always modified unless there is an error or no check function.
4328
+ * Sets loading to `false` when every element in the check array is defined.
4329
+ * Does nothing if the context currently has an error.
4330
+ *
4331
+ * @throws {Error} When no check function was provided in the constructor configuration.
3558
4332
  */ key: "check",
3559
4333
  value: function check() {
3560
4334
  if (!this.hasError()) {
@@ -3805,13 +4579,13 @@ function itemAccumulator(itemIteration, inputMapItem) {
3805
4579
  return result;
3806
4580
  }
3807
4581
  /**
3808
- * Automatically calls next on the accumulator's page item iteration up to the target number of results. Returns the total number of items loaded.
4582
+ * Automatically pages through an accumulator's iteration until the desired number of results
4583
+ * is reached or no more pages are available.
3809
4584
  *
3810
- * The promise will reject with an error if an error is encountered.
4585
+ * @param config - configuration specifying the accumulator, result limit, and counting function
4586
+ * @returns promise resolving to the final page number and total results count
3811
4587
  *
3812
- * @param iteration
3813
- * @param maxResultsLimit
3814
- * @returns
4588
+ * @throws Rejects if the iteration encounters an error during loading
3815
4589
  */ function itemAccumulatorNextPageUntilResultsCount(config) {
3816
4590
  var accumulator = config.accumulator, maxResultsLimit = config.maxResultsLimit, countResults = config.countResultsFunction;
3817
4591
  var getMaxResultsLimit = util.asGetter(maxResultsLimit);
@@ -3962,10 +4736,13 @@ function _unsupported_iterable_to_array$1(o, minLen) {
3962
4736
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
3963
4737
  }
3964
4738
  /**
3965
- * Used for ItemAccumulators that have an array of results returned per page instead of a single item.
4739
+ * Flattens paginated array results from an {@link ItemAccumulator} into a single growing array.
3966
4740
  *
3967
- * @param accumulator
3968
- * @returns
4741
+ * Designed for accumulators where each page returns an array of items. Concatenates all
4742
+ * page results into one flat array that grows as new pages are loaded.
4743
+ *
4744
+ * @param accumulator - accumulator whose page results are arrays to flatten
4745
+ * @returns observable emitting the flattened array of all accumulated items
3969
4746
  */ function flattenAccumulatorResultItemArray(accumulator) {
3970
4747
  return accumulator.currentAllItemPairs$.pipe(scanBuildArray(function(allItems) {
3971
4748
  var pairs = allItems;
@@ -3986,7 +4763,14 @@ function _unsupported_iterable_to_array$1(o, minLen) {
3986
4763
  }));
3987
4764
  }
3988
4765
  /**
3989
- * A PageListLoadingState that captures all the values that have been loaded so far, flattens them as an array, and the current loading state of currentPageResult$.
4766
+ * Combines a page accumulator's flattened array results with its current loading state
4767
+ * into a single {@link PageListLoadingState} observable.
4768
+ *
4769
+ * The loading state reflects whether a page is currently being fetched, while the value
4770
+ * always contains the full flattened array of all items loaded so far.
4771
+ *
4772
+ * @param accumulator - page accumulator whose results are arrays to flatten
4773
+ * @returns observable of the combined loading state with all accumulated items
3990
4774
  */ function accumulatorFlattenPageListLoadingState(accumulator) {
3991
4775
  return rxjs.combineLatest([
3992
4776
  accumulator.itemIteration.currentState$,
@@ -4002,7 +4786,14 @@ function _unsupported_iterable_to_array$1(o, minLen) {
4002
4786
  }), rxjs.shareReplay(1));
4003
4787
  }
4004
4788
  /**
4005
- * A PageListLoadingState that captures all the values that have been loaded so far, and the current loading state of currentPageResult$.
4789
+ * Combines a page accumulator's collected items with its current loading state
4790
+ * into a single {@link PageListLoadingState} observable.
4791
+ *
4792
+ * Unlike {@link accumulatorFlattenPageListLoadingState}, this does not flatten arrays —
4793
+ * each accumulated value is included as-is.
4794
+ *
4795
+ * @param accumulator - page accumulator to observe
4796
+ * @returns observable of the combined loading state with all accumulated items
4006
4797
  */ function accumulatorCurrentPageListLoadingState(accumulator) {
4007
4798
  return rxjs.combineLatest([
4008
4799
  accumulator.itemIteration.currentState$,
@@ -4018,20 +4809,23 @@ function _unsupported_iterable_to_array$1(o, minLen) {
4018
4809
  }), rxjs.shareReplay(1));
4019
4810
  }
4020
4811
  /**
4021
- * Returns the latest loaded page number from the input PageItemAccumulator.
4812
+ * Returns the latest loaded page number from the input accumulator's underlying iteration.
4022
4813
  *
4023
- * @param pageItemAccumulator
4024
- * @returns
4814
+ * @param pageItemAccumulator - accumulator to observe the current page from
4815
+ * @returns observable emitting the most recently loaded page number
4025
4816
  */ function pageItemAccumulatorCurrentPage(pageItemAccumulator) {
4026
4817
  return pageItemAccumulator.itemIteration.latestLoadedPage$;
4027
4818
  }
4028
4819
 
4029
4820
  /**
4030
- * Creates a new MappedItemIteration instance given the input ItemIteration and config.
4821
+ * Creates a {@link MappedItemIterationInstance} that wraps an existing iteration and transforms
4822
+ * its loading state values through the provided mapping configuration.
4031
4823
  *
4032
- * @param itemIteration
4033
- * @param config
4034
- * @returns
4824
+ * Control flow (next, hasNext, canLoadMore) is delegated directly to the underlying iteration.
4825
+ *
4826
+ * @param itemIterator - the source iteration to wrap
4827
+ * @param config - mapping configuration for transforming loading state values
4828
+ * @returns mapped iteration instance with transformed state observables
4035
4829
  */ function mapItemIteration(itemIterator, config) {
4036
4830
  var hasNext$ = itemIterator.hasNext$;
4037
4831
  var canLoadMore$ = itemIterator.canLoadMore$;
@@ -4114,11 +4908,13 @@ function _object_spread_props$2(target, source) {
4114
4908
  return target;
4115
4909
  }
4116
4910
  /**
4117
- * Creates a new MappedItemIteration instance given the input ItemIteration and config.
4911
+ * Creates a {@link MappedPageItemIterationInstance} that wraps a {@link PageItemIteration}
4912
+ * and transforms its loading state values while preserving page-level operations
4913
+ * (nextPage, page load limits, latestLoadedPage).
4118
4914
  *
4119
- * @param itemIteration
4120
- * @param config
4121
- * @returns
4915
+ * @param itemIteration - the source page iteration to wrap
4916
+ * @param config - mapping configuration for transforming loading state values
4917
+ * @returns mapped page iteration instance
4122
4918
  */ function mappedPageItemIteration(itemIteration, config) {
4123
4919
  function nextPage(request) {
4124
4920
  return itemIteration.nextPage(request);
@@ -4246,12 +5042,24 @@ function _unsupported_iterable_to_array(o, minLen) {
4246
5042
  if (n === "Map" || n === "Set") return Array.from(n);
4247
5043
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
4248
5044
  }
4249
- // MARK: Iterator
4250
5045
  /**
4251
- * Default number of pages that can be loaded.
5046
+ * Default maximum number of pages that can be loaded by an {@link ItemPageIterator}.
4252
5047
  */ var DEFAULT_ITEM_PAGE_ITERATOR_MAX = 100;
4253
5048
  /**
4254
- * Used for generating new iterations.
5049
+ * Factory for creating paginated iteration instances from a delegate and configuration.
5050
+ *
5051
+ * The iterator itself holds the delegate (data-loading logic) and optional global page limits.
5052
+ * Call {@link instance} to create a new iteration session with a specific configuration.
5053
+ *
5054
+ * @example
5055
+ * ```ts
5056
+ * const iterator = new ItemPageIterator({
5057
+ * loadItemsForPage: (request) => fetchPage(request.page)
5058
+ * });
5059
+ *
5060
+ * const instance = iterator.instance({ filter: 'active', maxPageLoadLimit: 10 });
5061
+ * instance.next(); // loads first page
5062
+ * ```
4255
5063
  */ var ItemPageIterator = /*#__PURE__*/ function() {
4256
5064
  function ItemPageIterator(delegate) {
4257
5065
  _class_call_check$2(this, ItemPageIterator);
@@ -4289,10 +5097,10 @@ function _unsupported_iterable_to_array(o, minLen) {
4289
5097
  },
4290
5098
  {
4291
5099
  /**
4292
- * Creates a new instance based on the input config.
5100
+ * Creates a new iteration instance with the given configuration.
4293
5101
  *
4294
- * @param config
4295
- * @returns
5102
+ * @param config - filter and page limit configuration for this iteration session
5103
+ * @returns new iteration instance ready to begin loading pages
4296
5104
  */ key: "instance",
4297
5105
  value: function instance(config) {
4298
5106
  return new ItemPageIterationInstance(this, config);
@@ -4302,7 +5110,11 @@ function _unsupported_iterable_to_array(o, minLen) {
4302
5110
  return ItemPageIterator;
4303
5111
  }();
4304
5112
  /**
4305
- * Configured Iterator instance.
5113
+ * Active iteration session created by an {@link ItemPageIterator}.
5114
+ *
5115
+ * Manages the lifecycle of paginated loading: triggering page loads via {@link next},
5116
+ * tracking loading/success/error states, and exposing all results as reactive observables.
5117
+ * Implements {@link PageItemIteration} for use with accumulators and other iteration utilities.
4306
5118
  */ var ItemPageIterationInstance = /*#__PURE__*/ function() {
4307
5119
  function ItemPageIterationInstance(iterator, config) {
4308
5120
  var _this = this;
@@ -4586,15 +5398,16 @@ function _unsupported_iterable_to_array(o, minLen) {
4586
5398
  ]);
4587
5399
  return ItemPageIterationInstance;
4588
5400
  }();
4589
- // MARK: Utility
4590
5401
  /**
4591
- * Is considered the "end" result if:
5402
+ * Determines whether an {@link ItemPageIteratorResult} represents the end of iteration.
4592
5403
  *
4593
- * - end is true
4594
- * - end is not false and the result value is not empty/null. Uses hasValueOrNotEmpty internally to decide.
5404
+ * End is detected when:
5405
+ * - `end` is explicitly `true`
5406
+ * - `end` is not explicitly `false` and the result value is empty/null (via `hasValueOrNotEmpty`)
5407
+ * - Error results are never considered the end
4595
5408
  *
4596
- * @param result
4597
- * @returns
5409
+ * @param result - the page result to check
5410
+ * @returns `true` if this result indicates no more pages are available
4598
5411
  */ function isItemPageIteratorResultEndResult(result) {
4599
5412
  if (result.error != null) {
4600
5413
  return false;
@@ -4695,9 +5508,28 @@ function _type_of(obj) {
4695
5508
  "@swc/helpers - typeof";
4696
5509
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
4697
5510
  }
4698
- var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4699
5511
  /**
4700
- * Executes the input function when the lockSet is set unlocked, or the timeout is reached.
5512
+ * Default lock key used by {@link LockSet.lockForTime} when no custom key is provided.
5513
+ */ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
5514
+ /**
5515
+ * Subscribes to the next unlock event of a {@link LockSet}, invoking the callback when it becomes unlocked or the timeout expires.
5516
+ *
5517
+ * Useful for deferring an action until all locks are released, with a safety timeout to avoid waiting indefinitely.
5518
+ *
5519
+ * @param config - configuration specifying the lock set, callback, timeout, and optional delay
5520
+ * @returns subscription that can be unsubscribed to cancel the wait
5521
+ *
5522
+ * @example
5523
+ * ```ts
5524
+ * const lockSet = new LockSet();
5525
+ * lockSet.addLock('busy', of(true));
5526
+ *
5527
+ * const sub = onLockSetNextUnlock({
5528
+ * lockSet,
5529
+ * fn: (unlocked) => console.log('Unlocked:', unlocked),
5530
+ * timeout: 5000
5531
+ * });
5532
+ * ```
4701
5533
  */ function onLockSetNextUnlock(param) {
4702
5534
  var lockSet = param.lockSet, fn = param.fn, inputTimeout = param.timeout, delayTime = param.delayTime;
4703
5535
  var timeoutTime = inputTimeout !== null && inputTimeout !== void 0 ? inputTimeout : util.MS_IN_SECOND * 50;
@@ -4716,9 +5548,29 @@ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4716
5548
  });
4717
5549
  }
4718
5550
  /**
4719
- * Used for preventing an action until all keys are removed.
5551
+ * Observable-based locking mechanism that prevents actions until all registered locks are released.
5552
+ *
5553
+ * Each lock is identified by a {@link LockKey} and backed by an `Observable<boolean>`. The lock set
5554
+ * is considered locked when any registered observable emits `true`. Empty or completed observables
5555
+ * are treated as unlocked, so locks do not need to be explicitly removed.
5556
+ *
5557
+ * Supports hierarchical locking via parent/child relationships between lock sets.
5558
+ *
5559
+ * @example
5560
+ * ```ts
5561
+ * const lockSet = new LockSet();
4720
5562
  *
4721
- * Added Observables do not need to be strictly removed; empty observables are counted as unlocked.
5563
+ * // Add a lock that is currently active
5564
+ * const removeLock = lockSet.addLock('saving', of(true));
5565
+ *
5566
+ * // Check locked state
5567
+ * lockSet.isLocked$.subscribe(locked => console.log('Locked:', locked));
5568
+ * // Output: Locked: true
5569
+ *
5570
+ * // Remove the lock
5571
+ * removeLock();
5572
+ * // Output: Locked: false
5573
+ * ```
4722
5574
  */ var LockSet = /*#__PURE__*/ function() {
4723
5575
  function LockSet() {
4724
5576
  _class_call_check$1(this, LockSet);
@@ -4726,16 +5578,23 @@ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4726
5578
  _define_property$1(this, "_onDestroy", new rxjs.Subject());
4727
5579
  _define_property$1(this, "_locks", new rxjs.BehaviorSubject(new Map()));
4728
5580
  _define_property$1(this, "_parentSub", new SubscriptionObject());
4729
- _define_property$1(this, "locks$", this._locks.asObservable());
4730
5581
  /**
4731
- * isLocked$ is true if any observable is emitting true.
5582
+ * Observable of the current lock map, emitting whenever locks are added or removed.
5583
+ */ _define_property$1(this, "locks$", this._locks.asObservable());
5584
+ /**
5585
+ * Observable that emits `true` when any registered lock observable is emitting `true`.
5586
+ * Emits `false` when all locks are released or the map is empty.
4732
5587
  */ _define_property$1(this, "isLocked$", this.locks$.pipe(rxjs.switchMap(combineLatestFromMapValuesObsFn(function(x) {
4733
5588
  return x;
4734
5589
  })), rxjs.map(util.reduceBooleansWithOrFn(false)), rxjs.shareReplay(1)));
4735
- _define_property$1(this, "isUnlocked$", this.isLocked$.pipe(rxjs.map(function(x) {
5590
+ /**
5591
+ * Observable that emits `true` when no locks are active. Inverse of {@link isLocked$}.
5592
+ */ _define_property$1(this, "isUnlocked$", this.isLocked$.pipe(rxjs.map(function(x) {
4736
5593
  return !x;
4737
5594
  })));
4738
- _define_property$1(this, "onDestroy$", this._onDestroy.pipe(rxjs.shareReplay(1)));
5595
+ /**
5596
+ * Observable that emits when this lock set is destroyed. Useful for cleanup coordination.
5597
+ */ _define_property$1(this, "onDestroy$", this._onDestroy.pipe(rxjs.shareReplay(1)));
4739
5598
  }
4740
5599
  _create_class$1(LockSet, [
4741
5600
  {
@@ -4773,19 +5632,44 @@ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4773
5632
  }
4774
5633
  },
4775
5634
  {
4776
- key: "lockForSeconds",
5635
+ /**
5636
+ * Locks for a specified number of seconds using the default time lock key.
5637
+ *
5638
+ * @param seconds - duration in seconds
5639
+ */ key: "lockForSeconds",
4777
5640
  value: function lockForSeconds(seconds) {
4778
5641
  this.lockForTime(seconds * 1000);
4779
5642
  }
4780
5643
  },
4781
5644
  {
4782
- key: "lockForTime",
5645
+ /**
5646
+ * Locks for a specified duration in milliseconds, automatically unlocking when the time elapses.
5647
+ *
5648
+ * @param milliseconds - lock duration
5649
+ * @param key - optional lock key, defaults to {@link DEFAULT_LOCK_SET_TIME_LOCK_KEY}
5650
+ */ key: "lockForTime",
4783
5651
  value: function lockForTime(milliseconds, key) {
4784
5652
  this.addLock(key !== null && key !== void 0 ? key : DEFAULT_LOCK_SET_TIME_LOCK_KEY, rxjs.of(false).pipe(rxjs.delay(milliseconds), rxjs.startWith(true)));
4785
5653
  }
4786
5654
  },
4787
5655
  {
4788
- key: "addLock",
5656
+ /**
5657
+ * Registers a lock observable under the given key. The lock is considered active when
5658
+ * the observable emits `true`. Empty observables are treated as unlocked.
5659
+ *
5660
+ * @param key - identifier for this lock
5661
+ * @param obs - observable that emits the lock state
5662
+ * @returns function that removes this specific lock when called
5663
+ *
5664
+ * @example
5665
+ * ```ts
5666
+ * const lockSet = new LockSet();
5667
+ * const remove = lockSet.addLock('saving', of(true));
5668
+ *
5669
+ * // Later, release the lock
5670
+ * remove();
5671
+ * ```
5672
+ */ key: "addLock",
4789
5673
  value: function addLock(key, obs) {
4790
5674
  var _this = this;
4791
5675
  obs = obs.pipe(rxjs.defaultIfEmpty(false) // empty observables count as unlocked.
@@ -4808,7 +5692,11 @@ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4808
5692
  }
4809
5693
  },
4810
5694
  {
4811
- key: "removeLock",
5695
+ /**
5696
+ * Removes the lock registered under the given key, if it exists.
5697
+ *
5698
+ * @param key - identifier of the lock to remove
5699
+ */ key: "removeLock",
4812
5700
  value: function removeLock(key) {
4813
5701
  if (this._locks.value.delete(key)) {
4814
5702
  this._locks.next(this.locks);
@@ -4816,7 +5704,13 @@ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4816
5704
  }
4817
5705
  },
4818
5706
  {
4819
- key: "onNextUnlock",
5707
+ /**
5708
+ * Registers a callback for the next time this lock set becomes unlocked.
5709
+ *
5710
+ * @param config - callback function or configuration object
5711
+ * @param delayTime - optional delay in milliseconds after unlock before invoking the callback
5712
+ * @returns subscription that can be unsubscribed to cancel the wait
5713
+ */ key: "onNextUnlock",
4820
5714
  value: function onNextUnlock(config, delayTime) {
4821
5715
  return onLockSetNextUnlock(_object_spread({
4822
5716
  lockSet: this,
@@ -4827,7 +5721,12 @@ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4827
5721
  }
4828
5722
  },
4829
5723
  {
4830
- key: "setParentLockSet",
5724
+ /**
5725
+ * Establishes a parent-child relationship where this lock set's locked state is propagated
5726
+ * to the parent. When this lock set is locked, the parent will also reflect a locked state.
5727
+ *
5728
+ * @param parent - parent lock set or observable of one; pass `undefined` to detach
5729
+ */ key: "setParentLockSet",
4831
5730
  value: function setParentLockSet(parent) {
4832
5731
  var _this = this;
4833
5732
  this._parentSub.subscription = preventComplete(asObservable(parent)).pipe(rxjs.map(function(parentLockSet) {
@@ -4843,7 +5742,11 @@ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4843
5742
  },
4844
5743
  {
4845
5744
  /**
4846
- * Convenience function for watching a child lockset's locked state and propogating it upward.
5745
+ * Registers a child lock set so its locked state propagates upward to this lock set.
5746
+ *
5747
+ * @param lockSet - child lock set to monitor
5748
+ * @param key - optional lock key, auto-generated if not provided
5749
+ * @returns function that removes the child lock relationship when called
4847
5750
  */ key: "addChildLockSet",
4848
5751
  value: function addChildLockSet(lockSet) {
4849
5752
  var key = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "".concat(LockSet.LOCK_SET_CHILD_INDEX_STEPPER++);
@@ -4858,7 +5761,15 @@ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4858
5761
  }
4859
5762
  },
4860
5763
  {
4861
- key: "destroyOnNextUnlock",
5764
+ /**
5765
+ * Schedules this lock set for destruction when it next becomes unlocked.
5766
+ *
5767
+ * After the unlock event (or timeout), the optional callback is invoked and then
5768
+ * {@link destroy} is called after a short delay.
5769
+ *
5770
+ * @param config - optional callback or configuration for the unlock wait
5771
+ * @param delayTime - optional delay in milliseconds after unlock before invoking the callback
5772
+ */ key: "destroyOnNextUnlock",
4862
5773
  value: function destroyOnNextUnlock(config, delayTime) {
4863
5774
  var _this = this;
4864
5775
  var fn;
@@ -4883,7 +5794,9 @@ var DEFAULT_LOCK_SET_TIME_LOCK_KEY = 'timelock';
4883
5794
  }
4884
5795
  },
4885
5796
  {
4886
- key: "destroy",
5797
+ /**
5798
+ * Completes all internal subjects, unsubscribes from the parent lock set, and marks this lock set as destroyed.
5799
+ */ key: "destroy",
4887
5800
  value: function destroy() {
4888
5801
  this._isDestroyed = true;
4889
5802
  this._locks.complete();
@@ -4930,7 +5843,21 @@ function _define_property(obj, key, value) {
4930
5843
  return obj;
4931
5844
  }
4932
5845
  /**
4933
- * Instance that tracks doing an arbitrary piece of asynchronous work that has an input value and an output value.
5846
+ * Tracks the lifecycle of an asynchronous work unit from start through completion (success or error).
5847
+ *
5848
+ * Exposes reactive streams for monitoring progress (`hasStarted$`, `isComplete$`, `loadingState$`)
5849
+ * and provides methods for starting work via observables, promises, or direct state management.
5850
+ *
5851
+ * @example
5852
+ * ```ts
5853
+ * const instance = new WorkInstance(inputValue, {
5854
+ * startWorking: () => console.log('started'),
5855
+ * success: (result) => console.log('done:', result),
5856
+ * reject: (err) => console.error('failed:', err)
5857
+ * });
5858
+ *
5859
+ * instance.startWorkingWithObservable(of('result'));
5860
+ * ```
4934
5861
  */ var WorkInstance = /*#__PURE__*/ function() {
4935
5862
  function WorkInstance(value, delegate) {
4936
5863
  var _this = this;
@@ -5164,7 +6091,24 @@ function _define_property(obj, key, value) {
5164
6091
  ();
5165
6092
 
5166
6093
  /**
5167
- * Creates a function that handles the incoming value and creates a WorkContext.
6094
+ * Creates a {@link WorkFactory} that executes the configured work function with a {@link WorkInstance} handler.
6095
+ *
6096
+ * If the work function returns an observable, it is automatically subscribed to. If it uses
6097
+ * the handler directly, the observable return is ignored.
6098
+ *
6099
+ * @example
6100
+ * ```ts
6101
+ * const factory = workFactory({
6102
+ * work: (value: number) => of(`result: ${value}`),
6103
+ * delegate: { startWorking: () => {}, success: () => {}, reject: () => {} }
6104
+ * });
6105
+ *
6106
+ * const instance = factory(42);
6107
+ * // instance tracks the work lifecycle
6108
+ * ```
6109
+ *
6110
+ * @param config - work function and delegate configuration
6111
+ * @returns a factory function that creates WorkInstance for each input
5168
6112
  */ function workFactory(param) {
5169
6113
  var work = param.work, delegate = param.delegate;
5170
6114
  return function(value) {
@@ -5189,7 +6133,11 @@ function _define_property(obj, key, value) {
5189
6133
  };
5190
6134
  }
5191
6135
  /**
5192
- * Creates a WorkFactory using the input WorkFactoryConfigFactory that generates new work configuration given the input.
6136
+ * Creates a {@link WorkFactory} that generates a new {@link WorkFactoryConfig} for each input,
6137
+ * enabling dynamic work and delegate selection per invocation.
6138
+ *
6139
+ * @param configFactory - factory that produces work configuration from the input value
6140
+ * @returns a work factory with per-invocation configuration
5193
6141
  */ function workFactoryForConfigFactory(configFactory) {
5194
6142
  return function(value) {
5195
6143
  var config = configFactory(value);