rx-tiny-flux 1.0.5 → 1.0.7

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.
@@ -931,168 +931,6 @@ var ReplaySubject = (function (_super) {
931
931
  return ReplaySubject;
932
932
  }(Subject));
933
933
 
934
- var Action = (function (_super) {
935
- __extends(Action, _super);
936
- function Action(scheduler, work) {
937
- return _super.call(this) || this;
938
- }
939
- Action.prototype.schedule = function (state, delay) {
940
- return this;
941
- };
942
- return Action;
943
- }(Subscription));
944
-
945
- var intervalProvider = {
946
- setInterval: function (handler, timeout) {
947
- var args = [];
948
- for (var _i = 2; _i < arguments.length; _i++) {
949
- args[_i - 2] = arguments[_i];
950
- }
951
- return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
952
- },
953
- clearInterval: function (handle) {
954
- return (clearInterval)(handle);
955
- },
956
- delegate: undefined,
957
- };
958
-
959
- var AsyncAction = (function (_super) {
960
- __extends(AsyncAction, _super);
961
- function AsyncAction(scheduler, work) {
962
- var _this = _super.call(this, scheduler, work) || this;
963
- _this.scheduler = scheduler;
964
- _this.work = work;
965
- _this.pending = false;
966
- return _this;
967
- }
968
- AsyncAction.prototype.schedule = function (state, delay) {
969
- var _a;
970
- if (delay === void 0) { delay = 0; }
971
- if (this.closed) {
972
- return this;
973
- }
974
- this.state = state;
975
- var id = this.id;
976
- var scheduler = this.scheduler;
977
- if (id != null) {
978
- this.id = this.recycleAsyncId(scheduler, id, delay);
979
- }
980
- this.pending = true;
981
- this.delay = delay;
982
- this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
983
- return this;
984
- };
985
- AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
986
- if (delay === void 0) { delay = 0; }
987
- return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
988
- };
989
- AsyncAction.prototype.recycleAsyncId = function (_scheduler, id, delay) {
990
- if (delay === void 0) { delay = 0; }
991
- if (delay != null && this.delay === delay && this.pending === false) {
992
- return id;
993
- }
994
- if (id != null) {
995
- intervalProvider.clearInterval(id);
996
- }
997
- return undefined;
998
- };
999
- AsyncAction.prototype.execute = function (state, delay) {
1000
- if (this.closed) {
1001
- return new Error('executing a cancelled action');
1002
- }
1003
- this.pending = false;
1004
- var error = this._execute(state, delay);
1005
- if (error) {
1006
- return error;
1007
- }
1008
- else if (this.pending === false && this.id != null) {
1009
- this.id = this.recycleAsyncId(this.scheduler, this.id, null);
1010
- }
1011
- };
1012
- AsyncAction.prototype._execute = function (state, _delay) {
1013
- var errored = false;
1014
- var errorValue;
1015
- try {
1016
- this.work(state);
1017
- }
1018
- catch (e) {
1019
- errored = true;
1020
- errorValue = e ? e : new Error('Scheduled action threw falsy error');
1021
- }
1022
- if (errored) {
1023
- this.unsubscribe();
1024
- return errorValue;
1025
- }
1026
- };
1027
- AsyncAction.prototype.unsubscribe = function () {
1028
- if (!this.closed) {
1029
- var _a = this, id = _a.id, scheduler = _a.scheduler;
1030
- var actions = scheduler.actions;
1031
- this.work = this.state = this.scheduler = null;
1032
- this.pending = false;
1033
- arrRemove(actions, this);
1034
- if (id != null) {
1035
- this.id = this.recycleAsyncId(scheduler, id, null);
1036
- }
1037
- this.delay = null;
1038
- _super.prototype.unsubscribe.call(this);
1039
- }
1040
- };
1041
- return AsyncAction;
1042
- }(Action));
1043
-
1044
- var Scheduler = (function () {
1045
- function Scheduler(schedulerActionCtor, now) {
1046
- if (now === void 0) { now = Scheduler.now; }
1047
- this.schedulerActionCtor = schedulerActionCtor;
1048
- this.now = now;
1049
- }
1050
- Scheduler.prototype.schedule = function (work, delay, state) {
1051
- if (delay === void 0) { delay = 0; }
1052
- return new this.schedulerActionCtor(this, work).schedule(state, delay);
1053
- };
1054
- Scheduler.now = dateTimestampProvider.now;
1055
- return Scheduler;
1056
- }());
1057
-
1058
- var AsyncScheduler = (function (_super) {
1059
- __extends(AsyncScheduler, _super);
1060
- function AsyncScheduler(SchedulerAction, now) {
1061
- if (now === void 0) { now = Scheduler.now; }
1062
- var _this = _super.call(this, SchedulerAction, now) || this;
1063
- _this.actions = [];
1064
- _this._active = false;
1065
- return _this;
1066
- }
1067
- AsyncScheduler.prototype.flush = function (action) {
1068
- var actions = this.actions;
1069
- if (this._active) {
1070
- actions.push(action);
1071
- return;
1072
- }
1073
- var error;
1074
- this._active = true;
1075
- do {
1076
- if ((error = action.execute(action.state, action.delay))) {
1077
- break;
1078
- }
1079
- } while ((action = actions.shift()));
1080
- this._active = false;
1081
- if (error) {
1082
- while ((action = actions.shift())) {
1083
- action.unsubscribe();
1084
- }
1085
- throw error;
1086
- }
1087
- };
1088
- return AsyncScheduler;
1089
- }(Scheduler));
1090
-
1091
- var asyncScheduler = new AsyncScheduler(AsyncAction);
1092
- var async = asyncScheduler;
1093
-
1094
- var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
1095
-
1096
934
  function isScheduler(value) {
1097
935
  return value && isFunction(value.schedule);
1098
936
  }
@@ -1100,9 +938,6 @@ function isScheduler(value) {
1100
938
  function last(arr) {
1101
939
  return arr[arr.length - 1];
1102
940
  }
1103
- function popResultSelector(args) {
1104
- return isFunction(last(args)) ? args.pop() : undefined;
1105
- }
1106
941
  function popScheduler(args) {
1107
942
  return isScheduler(last(args)) ? args.pop() : undefined;
1108
943
  }
@@ -1442,19 +1277,6 @@ function from(input, scheduler) {
1442
1277
  return scheduler ? scheduled(input, scheduler) : innerFrom(input);
1443
1278
  }
1444
1279
 
1445
- function of() {
1446
- var args = [];
1447
- for (var _i = 0; _i < arguments.length; _i++) {
1448
- args[_i] = arguments[_i];
1449
- }
1450
- var scheduler = popScheduler(args);
1451
- return from(args, scheduler);
1452
- }
1453
-
1454
- function isValidDate(value) {
1455
- return value instanceof Date && !isNaN(value);
1456
- }
1457
-
1458
1280
  function map(project, thisArg) {
1459
1281
  return operate(function (source, subscriber) {
1460
1282
  var index = 0;
@@ -1541,44 +1363,6 @@ function concat() {
1541
1363
  return concatAll()(from(args, popScheduler(args)));
1542
1364
  }
1543
1365
 
1544
- function defer(observableFactory) {
1545
- return new Observable(function (subscriber) {
1546
- innerFrom(observableFactory()).subscribe(subscriber);
1547
- });
1548
- }
1549
-
1550
- function timer(dueTime, intervalOrScheduler, scheduler) {
1551
- if (dueTime === void 0) { dueTime = 0; }
1552
- if (scheduler === void 0) { scheduler = async; }
1553
- var intervalDuration = -1;
1554
- if (intervalOrScheduler != null) {
1555
- if (isScheduler(intervalOrScheduler)) {
1556
- scheduler = intervalOrScheduler;
1557
- }
1558
- else {
1559
- intervalDuration = intervalOrScheduler;
1560
- }
1561
- }
1562
- return new Observable(function (subscriber) {
1563
- var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
1564
- if (due < 0) {
1565
- due = 0;
1566
- }
1567
- var n = 0;
1568
- return scheduler.schedule(function () {
1569
- if (!subscriber.closed) {
1570
- subscriber.next(n++);
1571
- if (0 <= intervalDuration) {
1572
- this.schedule(undefined, intervalDuration);
1573
- }
1574
- else {
1575
- subscriber.complete();
1576
- }
1577
- }
1578
- }, due);
1579
- });
1580
- }
1581
-
1582
1366
  function filter(predicate, thisArg) {
1583
1367
  return operate(function (source, subscriber) {
1584
1368
  var index = 0;
@@ -1586,30 +1370,6 @@ function filter(predicate, thisArg) {
1586
1370
  });
1587
1371
  }
1588
1372
 
1589
- function catchError(selector) {
1590
- return operate(function (source, subscriber) {
1591
- var innerSub = null;
1592
- var syncUnsub = false;
1593
- var handledResult;
1594
- innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
1595
- handledResult = innerFrom(selector(err, catchError(selector)(source)));
1596
- if (innerSub) {
1597
- innerSub.unsubscribe();
1598
- innerSub = null;
1599
- handledResult.subscribe(subscriber);
1600
- }
1601
- else {
1602
- syncUnsub = true;
1603
- }
1604
- }));
1605
- if (syncUnsub) {
1606
- innerSub.unsubscribe();
1607
- innerSub = null;
1608
- handledResult.subscribe(subscriber);
1609
- }
1610
- });
1611
- }
1612
-
1613
1373
  function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
1614
1374
  return function (source, subscriber) {
1615
1375
  var hasState = hasSeed;
@@ -1627,41 +1387,6 @@ function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplet
1627
1387
  };
1628
1388
  }
1629
1389
 
1630
- function concatMap(project, resultSelector) {
1631
- return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
1632
- }
1633
-
1634
- function take(count) {
1635
- return count <= 0
1636
- ?
1637
- function () { return EMPTY; }
1638
- : operate(function (source, subscriber) {
1639
- var seen = 0;
1640
- source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1641
- if (++seen <= count) {
1642
- subscriber.next(value);
1643
- if (count <= seen) {
1644
- subscriber.complete();
1645
- }
1646
- }
1647
- }));
1648
- });
1649
- }
1650
-
1651
- function mapTo(value) {
1652
- return map(function () { return value; });
1653
- }
1654
-
1655
- function delayWhen(delayDurationSelector, subscriptionDelay) {
1656
- return mergeMap(function (value, index) { return innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)); });
1657
- }
1658
-
1659
- function delay(due, scheduler) {
1660
- if (scheduler === void 0) { scheduler = asyncScheduler; }
1661
- var duration = timer(due, scheduler);
1662
- return delayWhen(function () { return duration; });
1663
- }
1664
-
1665
1390
  function distinctUntilChanged(comparator, keySelector) {
1666
1391
  if (keySelector === void 0) { keySelector = identity; }
1667
1392
  comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;
@@ -1682,31 +1407,6 @@ function defaultCompare(a, b) {
1682
1407
  return a === b;
1683
1408
  }
1684
1409
 
1685
- function exhaustMap(project, resultSelector) {
1686
- if (resultSelector) {
1687
- return function (source) {
1688
- return source.pipe(exhaustMap(function (a, i) { return innerFrom(project(a, i)).pipe(map(function (b, ii) { return resultSelector(a, b, i, ii); })); }));
1689
- };
1690
- }
1691
- return operate(function (source, subscriber) {
1692
- var index = 0;
1693
- var innerSub = null;
1694
- var isComplete = false;
1695
- source.subscribe(createOperatorSubscriber(subscriber, function (outerValue) {
1696
- if (!innerSub) {
1697
- innerSub = createOperatorSubscriber(subscriber, undefined, function () {
1698
- innerSub = null;
1699
- isComplete && subscriber.complete();
1700
- });
1701
- innerFrom(project(outerValue, index++)).subscribe(innerSub);
1702
- }
1703
- }, function () {
1704
- isComplete = true;
1705
- !innerSub && subscriber.complete();
1706
- }));
1707
- });
1708
- }
1709
-
1710
1410
  function scan(accumulator, seed) {
1711
1411
  return operate(scanInternals(accumulator, seed, arguments.length >= 2, true));
1712
1412
  }
@@ -1816,95 +1516,6 @@ function startWith() {
1816
1516
  });
1817
1517
  }
1818
1518
 
1819
- function switchMap(project, resultSelector) {
1820
- return operate(function (source, subscriber) {
1821
- var innerSubscriber = null;
1822
- var index = 0;
1823
- var isComplete = false;
1824
- var checkComplete = function () { return isComplete && !innerSubscriber && subscriber.complete(); };
1825
- source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1826
- innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
1827
- var innerIndex = 0;
1828
- var outerIndex = index++;
1829
- innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = createOperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
1830
- innerSubscriber = null;
1831
- checkComplete();
1832
- })));
1833
- }, function () {
1834
- isComplete = true;
1835
- checkComplete();
1836
- }));
1837
- });
1838
- }
1839
-
1840
- function tap(observerOrNext, error, complete) {
1841
- var tapObserver = isFunction(observerOrNext) || error || complete
1842
- ?
1843
- { next: observerOrNext, error: error, complete: complete }
1844
- : observerOrNext;
1845
- return tapObserver
1846
- ? operate(function (source, subscriber) {
1847
- var _a;
1848
- (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
1849
- var isUnsub = true;
1850
- source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1851
- var _a;
1852
- (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
1853
- subscriber.next(value);
1854
- }, function () {
1855
- var _a;
1856
- isUnsub = false;
1857
- (_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
1858
- subscriber.complete();
1859
- }, function (err) {
1860
- var _a;
1861
- isUnsub = false;
1862
- (_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
1863
- subscriber.error(err);
1864
- }, function () {
1865
- var _a, _b;
1866
- if (isUnsub) {
1867
- (_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
1868
- }
1869
- (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
1870
- }));
1871
- })
1872
- :
1873
- identity;
1874
- }
1875
-
1876
- function withLatestFrom() {
1877
- var inputs = [];
1878
- for (var _i = 0; _i < arguments.length; _i++) {
1879
- inputs[_i] = arguments[_i];
1880
- }
1881
- var project = popResultSelector(inputs);
1882
- return operate(function (source, subscriber) {
1883
- var len = inputs.length;
1884
- var otherValues = new Array(len);
1885
- var hasValue = inputs.map(function () { return false; });
1886
- var ready = false;
1887
- var _loop_1 = function (i) {
1888
- innerFrom(inputs[i]).subscribe(createOperatorSubscriber(subscriber, function (value) {
1889
- otherValues[i] = value;
1890
- if (!ready && !hasValue[i]) {
1891
- hasValue[i] = true;
1892
- (ready = hasValue.every(identity)) && (hasValue = null);
1893
- }
1894
- }, noop));
1895
- };
1896
- for (var i = 0; i < len; i++) {
1897
- _loop_1(i);
1898
- }
1899
- source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1900
- if (ready) {
1901
- var values = __spreadArray([value], __read(otherValues));
1902
- subscriber.next(project ? project.apply(void 0, __spreadArray([], __read(values))) : values);
1903
- }
1904
- }));
1905
- });
1906
- }
1907
-
1908
1519
  /**
1909
1520
  * @typedef {import('./actions').Action} Action
1910
1521
  */
@@ -1937,10 +1548,7 @@ class Store {
1937
1548
  const initialStoreState = typeof structuredClone === 'function' ? structuredClone(initialState) : JSON.parse(JSON.stringify(initialState));
1938
1549
  this._state$ = new BehaviorSubject(initialStoreState);
1939
1550
 
1940
- const dispatcher$ = this._actions$.pipe(
1941
- // Optional: log for debugging
1942
- tap((action) => console.log('Action Dispatched:', action))
1943
- );
1551
+ const dispatcher$ = this._actions$;
1944
1552
 
1945
1553
  const state$ = dispatcher$.pipe(
1946
1554
  scan((currentState, action) => {
@@ -2202,4 +1810,4 @@ function createSelector(...args) {
2202
1810
  }
2203
1811
  }
2204
1812
 
2205
- export { Store, anyAction, catchError, concatMap, createAction, createEffect, createFeatureSelector, createReducer, createSelector, defer, delay, exhaustMap, filter, from, map, mergeMap, of, ofType, on, switchMap, tap, withLatestFrom };
1813
+ export { Store, anyAction, createAction, createEffect, createFeatureSelector, createReducer, createSelector, ofType, on };
@@ -1 +1 @@
1
- var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},t(n,r)};function n(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function r(t,n,r,e){return new(r||(r=Promise))(function(o,i){function u(t){try{s(e.next(t))}catch(t){i(t)}}function c(t){try{s(e.throw(t))}catch(t){i(t)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof r?n:new r(function(t){t(n)})).then(u,c)}s((e=e.apply(t,n||[])).next())})}function e(t,n){var r,e,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(r=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,e=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(t,i)}catch(t){c=[6,t],e=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(t){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&t[n],e=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var e,o,i=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(t,n,r){if(r||2===arguments.length)for(var e,o=0,i=n.length;o<i;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}function c(t){return this instanceof c?(this.v=t,this):new c(t)}function s(t,n,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=r.apply(t,n||[]),i=[];return e=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",function(t){return function(n){return Promise.resolve(n).then(t,l)}}),e[Symbol.asyncIterator]=function(){return this},e;function u(t,n){o[t]&&(e[t]=function(n){return new Promise(function(r,e){i.push([t,n,r,e])>1||s(t,n)})},n&&(e[t]=n(e[t])))}function s(t,n){try{(r=o[t](n)).value instanceof c?Promise.resolve(r.value.v).then(a,l):f(i[0][2],r)}catch(t){f(i[0][3],t)}var r}function a(t){s("next",t)}function l(t){s("throw",t)}function f(t,n){t(n),i.shift(),i.length&&s(i[0][0],i[0][1])}}function a(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=t[Symbol.asyncIterator];return r?r.call(t):(t=o(t),n={},e("next"),e("throw"),e("return"),n[Symbol.asyncIterator]=function(){return this},n);function e(r){n[r]=t[r]&&function(n){return new Promise(function(e,o){(function(t,n,r,e){Promise.resolve(e).then(function(n){t({value:n,done:r})},n)})(e,o,(n=t[r](n)).done,n.value)})}}}function l(t){return"function"==typeof t}function f(t){var n=t(function(t){Error.call(t),t.stack=(new Error).stack});return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}"function"==typeof SuppressedError&&SuppressedError;var h=f(function(t){return function(n){t(this),this.message=n?n.length+" errors occurred during unsubscription:\n"+n.map(function(t,n){return n+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=n}});function p(t,n){if(t){var r=t.indexOf(n);0<=r&&t.splice(r,1)}}var d=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var n;return t.prototype.unsubscribe=function(){var t,n,r,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=o(s),f=a.next();!f.done;f=a.next()){f.value.remove(this)}}catch(n){t={error:n}}finally{try{f&&!f.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else s.remove(this);var p=this.initialTeardown;if(l(p))try{p()}catch(t){c=t instanceof h?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var v=o(d),b=v.next();!b.done;b=v.next()){var w=b.value;try{y(w)}catch(t){c=null!=c?c:[],t instanceof h?c=u(u([],i(c)),i(t.errors)):c.push(t)}}}catch(t){r={error:t}}finally{try{b&&!b.done&&(e=v.return)&&e.call(v)}finally{if(r)throw r.error}}}if(c)throw new h(c)}},t.prototype.add=function(n){var r;if(n&&n!==this)if(this.closed)y(n);else{if(n instanceof t){if(n.closed||n._hasParent(this))return;n._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(n)}},t.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},t.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},t.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&p(n,t)},t.prototype.remove=function(n){var r=this._finalizers;r&&p(r,n),n instanceof t&&n._removeParent(this)},t.EMPTY=((n=new t).closed=!0,n),t}(),v=d.EMPTY;function b(t){return t instanceof d||t&&"closed"in t&&l(t.remove)&&l(t.add)&&l(t.unsubscribe)}function y(t){l(t)?t():t.unsubscribe()}var w={Promise:void 0},m=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return setTimeout.apply(void 0,u([t,n],i(r)))};function _(t){m(function(){throw t})}function x(){}function g(t){t()}var S=function(t){function r(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,b(n)&&n.add(r)):r.destination=A,r}return n(r,t),r.create=function(t,n,r){return new O(t,n,r)},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(d),E=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(t){I(t)}},t.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(t){I(t)}else I(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){I(t)}},t}(),O=function(t){function r(n,r,e){var o,i=t.call(this)||this;return o=l(n)||!n?{next:null!=n?n:void 0,error:null!=r?r:void 0,complete:null!=e?e:void 0}:n,i.destination=new E(o),i}return n(r,t),r}(S);function I(t){_(t)}var A={closed:!0,next:x,error:function(t){throw t},complete:x},P="function"==typeof Symbol&&Symbol.observable||"@@observable";function T(t){return t}var C=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(n){var r=new t;return r.source=this,r.operator=n,r},t.prototype.subscribe=function(t,n,r){var e,o=this,i=(e=t)&&e instanceof S||function(t){return t&&l(t.next)&&l(t.error)&&l(t.complete)}(e)&&b(e)?t:new O(t,n,r);return g(function(){var t=o,n=t.operator,r=t.source;i.add(n?n.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},t.prototype.forEach=function(t,n){var r=this;return new(n=j(n))(function(n,e){var o=new O({next:function(n){try{t(n)}catch(t){e(t),o.unsubscribe()}},error:e,complete:n});r.subscribe(o)})},t.prototype._subscribe=function(t){var n;return null===(n=this.source)||void 0===n?void 0:n.subscribe(t)},t.prototype[P]=function(){return this},t.prototype.pipe=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(0===(t=n).length?T:1===t.length?t[0]:function(n){return t.reduce(function(t,n){return n(t)},n)})(this)},t.prototype.toPromise=function(t){var n=this;return new(t=j(t))(function(t,r){var e;n.subscribe(function(t){return e=t},function(t){return r(t)},function(){return t(e)})})},t.create=function(n){return new t(n)},t}();function j(t){var n;return null!==(n=null!=t?t:w.Promise)&&void 0!==n?n:Promise}function k(t){return function(n){if(function(t){return l(null==t?void 0:t.lift)}(n))return n.lift(function(n){try{return t(n,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function z(t,n,r,e,o){return new F(t,n,r,e,o)}var F=function(t){function r(n,r,e,o,i,u){var c=t.call(this,n)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=r?function(t){try{r(t)}catch(t){n.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){n.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=e?function(){try{e()}catch(t){n.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return n(r,t),r.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(n=this.onFinalize)||void 0===n||n.call(this))}},r}(S),$=f(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),N=function(t){function r(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return n(r,t),r.prototype.lift=function(t){var n=new R(this,this);return n.operator=t,n},r.prototype._throwIfClosed=function(){if(this.closed)throw new $},r.prototype.next=function(t){var n=this;g(function(){var r,e;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var i=o(n.currentObservers),u=i.next();!u.done;u=i.next()){u.value.next(t)}}catch(t){r={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}}})},r.prototype.error=function(t){var n=this;g(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var r=n.observers;r.length;)r.shift().error(t)}})},r.prototype.complete=function(){var t=this;g(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},r.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},r.prototype._innerSubscribe=function(t){var n=this,r=this,e=r.hasError,o=r.isStopped,i=r.observers;return e||o?v:(this.currentObservers=null,i.push(t),new d(function(){n.currentObservers=null,p(i,t)}))},r.prototype._checkFinalizedStatuses=function(t){var n=this,r=n.hasError,e=n.thrownError,o=n.isStopped;r?t.error(e):o&&t.complete()},r.prototype.asObservable=function(){var t=new C;return t.source=this,t},r.create=function(t,n){return new R(t,n)},r}(C),R=function(t){function r(n,r){var e=t.call(this)||this;return e.destination=n,e.source=r,e}return n(r,t),r.prototype.next=function(t){var n,r;null===(r=null===(n=this.destination)||void 0===n?void 0:n.next)||void 0===r||r.call(n,t)},r.prototype.error=function(t){var n,r;null===(r=null===(n=this.destination)||void 0===n?void 0:n.error)||void 0===r||r.call(n,t)},r.prototype.complete=function(){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===n||n.call(t)},r.prototype._subscribe=function(t){var n,r;return null!==(r=null===(n=this.source)||void 0===n?void 0:n.subscribe(t))&&void 0!==r?r:v},r}(N),J=function(t){function r(n){var r=t.call(this)||this;return r._value=n,r}return n(r,t),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var r=t.prototype._subscribe.call(this,n);return!r.closed&&n.next(this._value),r},r.prototype.getValue=function(){var t=this,n=t.hasError,r=t.thrownError,e=t._value;if(n)throw r;return this._throwIfClosed(),e},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(N),U={now:function(){return(U.delegate||Date).now()},delegate:void 0},W=function(t){function r(n,r,e){void 0===n&&(n=1/0),void 0===r&&(r=1/0),void 0===e&&(e=U);var o=t.call(this)||this;return o._bufferSize=n,o._windowTime=r,o._timestampProvider=e,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,r),o}return n(r,t),r.prototype.next=function(n){var r=this,e=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,u=r._timestampProvider,c=r._windowTime;e||(o.push(n),!i&&o.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,n)},r.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),r=this._infiniteTimeWindow,e=this._buffer.slice(),o=0;o<e.length&&!t.closed;o+=r?1:2)t.next(e[o]);return this._checkFinalizedStatuses(t),n},r.prototype._trimBuffer=function(){var t=this,n=t._bufferSize,r=t._timestampProvider,e=t._buffer,o=t._infiniteTimeWindow,i=(o?1:2)*n;if(n<1/0&&i<e.length&&e.splice(0,e.length-i),!o){for(var u=r.now(),c=0,s=1;s<e.length&&e[s]<=u;s+=2)c=s;c&&e.splice(0,c+1)}},r}(N),M=function(t){function r(n,r){return t.call(this)||this}return n(r,t),r.prototype.schedule=function(t,n){return this},r}(d),Y=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return setInterval.apply(void 0,u([t,n],i(r)))},B=function(t){return clearInterval(t)},D=function(t){function r(n,r){var e=t.call(this,n,r)||this;return e.scheduler=n,e.work=r,e.pending=!1,e}return n(r,t),r.prototype.schedule=function(t,n){var r;if(void 0===n&&(n=0),this.closed)return this;this.state=t;var e=this.id,o=this.scheduler;return null!=e&&(this.id=this.recycleAsyncId(o,e,n)),this.pending=!0,this.delay=n,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,n),this},r.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),Y(t.flush.bind(t,this),r)},r.prototype.recycleAsyncId=function(t,n,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return n;null!=n&&B(n)},r.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,n);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},r.prototype._execute=function(t,n){var r,e=!1;try{this.work(t)}catch(t){e=!0,r=t||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),r},r.prototype.unsubscribe=function(){if(!this.closed){var n=this.id,r=this.scheduler,e=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,p(e,this),null!=n&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},r}(M),V=function(){function t(n,r){void 0===r&&(r=t.now),this.schedulerActionCtor=n,this.now=r}return t.prototype.schedule=function(t,n,r){return void 0===n&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},t.now=U.now,t}(),q=new(function(t){function r(n,r){void 0===r&&(r=V.now);var e=t.call(this,n,r)||this;return e.actions=[],e._active=!1,e}return n(r,t),r.prototype.flush=function(t){var n=this.actions;if(this._active)n.push(t);else{var r;this._active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=n.shift());if(this._active=!1,r){for(;t=n.shift();)t.unsubscribe();throw r}}},r}(V))(D),Z=q,G=new C(function(t){return t.complete()});function K(t){return t&&l(t.schedule)}function L(t){return t[t.length-1]}function H(t){return K(L(t))?t.pop():void 0}var Q=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function X(t){return l(null==t?void 0:t.then)}function tt(t){return l(t[P])}function nt(t){return Symbol.asyncIterator&&l(null==t?void 0:t[Symbol.asyncIterator])}function rt(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var et="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function ot(t){return l(null==t?void 0:t[et])}function it(t){return s(this,arguments,function(){var n,r,o;return e(this,function(e){switch(e.label){case 0:n=t.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(n.read())];case 3:return r=e.sent(),o=r.value,r.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function ut(t){return l(null==t?void 0:t.getReader)}function ct(t){if(t instanceof C)return t;if(null!=t){if(tt(t))return i=t,new C(function(t){var n=i[P]();if(l(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Q(t))return e=t,new C(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()});if(X(t))return r=t,new C(function(t){r.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,_)});if(nt(t))return st(t);if(ot(t))return n=t,new C(function(t){var r,e;try{for(var i=o(n),u=i.next();!u.done;u=i.next()){var c=u.value;if(t.next(c),t.closed)return}}catch(t){r={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}t.complete()});if(ut(t))return st(it(t))}var n,r,e,i;throw rt(t)}function st(t){return new C(function(n){(function(t,n){var o,i,u,c;return r(this,void 0,void 0,function(){var r,s;return e(this,function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=a(t),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(r=i.value,n.next(r),n.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return n.complete(),[2]}})})})(t,n).catch(function(t){return n.error(t)})})}function at(t,n,r,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=n.schedule(function(){r(),o?t.add(this.schedule(null,e)):this.unsubscribe()},e);if(t.add(i),!o)return i}function lt(t,n){return void 0===n&&(n=0),k(function(r,e){r.subscribe(z(e,function(r){return at(e,t,function(){return e.next(r)},n)},function(){return at(e,t,function(){return e.complete()},n)},function(r){return at(e,t,function(){return e.error(r)},n)}))})}function ft(t,n){return void 0===n&&(n=0),k(function(r,e){e.add(t.schedule(function(){return r.subscribe(e)},n))})}function ht(t,n){if(!t)throw new Error("Iterable cannot be null");return new C(function(r){at(r,n,function(){var e=t[Symbol.asyncIterator]();at(r,n,function(){e.next().then(function(t){t.done?r.complete():r.next(t.value)})},0,!0)})})}function pt(t,n){if(null!=t){if(tt(t))return function(t,n){return ct(t).pipe(ft(n),lt(n))}(t,n);if(Q(t))return function(t,n){return new C(function(r){var e=0;return n.schedule(function(){e===t.length?r.complete():(r.next(t[e++]),r.closed||this.schedule())})})}(t,n);if(X(t))return function(t,n){return ct(t).pipe(ft(n),lt(n))}(t,n);if(nt(t))return ht(t,n);if(ot(t))return function(t,n){return new C(function(r){var e;return at(r,n,function(){e=t[et](),at(r,n,function(){var t,n,o;try{n=(t=e.next()).value,o=t.done}catch(t){return void r.error(t)}o?r.complete():r.next(n)},0,!0)}),function(){return l(null==e?void 0:e.return)&&e.return()}})}(t,n);if(ut(t))return function(t,n){return ht(it(t),n)}(t,n)}throw rt(t)}function dt(t,n){return n?pt(t,n):ct(t)}function vt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return dt(t,H(t))}function bt(t,n){return k(function(r,e){var o=0;r.subscribe(z(e,function(r){e.next(t.call(n,r,o++))}))})}function yt(t,n,r){return void 0===r&&(r=1/0),l(n)?yt(function(r,e){return bt(function(t,o){return n(r,t,e,o)})(ct(t(r,e)))},r):("number"==typeof n&&(r=n),k(function(n,e){return function(t,n,r,e,o,i,u){var c=[],s=0,a=0,l=!1,f=function(){!l||c.length||s||n.complete()},h=function(t){s++;var o=!1;ct(r(t,a++)).subscribe(z(n,function(t){n.next(t)},function(){o=!0},void 0,function(){if(o)try{s--;for(var t=function(){var t=c.shift();u||h(t)};c.length&&s<e;)t();f()}catch(t){n.error(t)}}))};return t.subscribe(z(n,function(t){return s<e?h(t):c.push(t)},function(){l=!0,f()})),function(){}}(n,e,t,r)}))}function wt(){return yt(T,1)}function mt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return wt()(dt(t,H(t)))}function _t(t){return new C(function(n){ct(t()).subscribe(n)})}function xt(t,n,r){void 0===t&&(t=0),void 0===r&&(r=Z);var e=-1;return null!=n&&(K(n)?r=n:e=n),new C(function(n){var o,i=(o=t)instanceof Date&&!isNaN(o)?+t-r.now():t;i<0&&(i=0);var u=0;return r.schedule(function(){n.closed||(n.next(u++),0<=e?this.schedule(void 0,e):n.complete())},i)})}function gt(t,n){return k(function(r,e){var o=0;r.subscribe(z(e,function(r){return t.call(n,r,o++)&&e.next(r)}))})}function St(t){return k(function(n,r){var e,o=null,i=!1;o=n.subscribe(z(r,void 0,void 0,function(u){e=ct(t(u,St(t)(n))),o?(o.unsubscribe(),o=null,e.subscribe(r)):i=!0})),i&&(o.unsubscribe(),o=null,e.subscribe(r))})}function Et(t,n){return l(n)?yt(t,n,1):yt(t,1)}function Ot(t,n){return yt(function(n,r){return ct(t(n,r)).pipe((e=1)<=0?function(){return G}:k(function(t,n){var r=0;t.subscribe(z(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))}),function(t){return bt(function(){return t})}(n));var e})}function It(t,n){void 0===n&&(n=q);var r=xt(t,n);return Ot(function(){return r})}function At(t,n){return t===n}function Pt(t,n){return n?function(r){return r.pipe(Pt(function(r,e){return ct(t(r,e)).pipe(bt(function(t,o){return n(r,t,e,o)}))}))}:k(function(n,r){var e=0,o=null,i=!1;n.subscribe(z(r,function(n){o||(o=z(r,void 0,function(){o=null,i&&r.complete()}),ct(t(n,e++)).subscribe(o))},function(){i=!0,!o&&r.complete()}))})}function Tt(t,n){return k(function(t,n,r,e,o){return function(e,i){var u=r,c=n,s=0;e.subscribe(z(i,function(n){var r=s++;c=u?t(c,n,r):(u=!0,n),i.next(c)},o))}}(t,n,arguments.length>=2))}function Ct(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];if(!0!==n){if(!1!==n){var o=new O({next:function(){o.unsubscribe(),t()}});return ct(n.apply(void 0,u([],i(r)))).subscribe(o)}}else t()}function jt(t,n,r){var e;return e=t,function(t){void 0===t&&(t={});var n=t.connector,r=void 0===n?function(){return new N}:n,e=t.resetOnError,o=void 0===e||e,i=t.resetOnComplete,u=void 0===i||i,c=t.resetOnRefCountZero,s=void 0===c||c;return function(t){var n,e,i,c=0,a=!1,l=!1,f=function(){null==e||e.unsubscribe(),e=void 0},h=function(){f(),n=i=void 0,a=l=!1},p=function(){var t=n;h(),null==t||t.unsubscribe()};return k(function(t,d){c++,l||a||f();var v=i=null!=i?i:r();d.add(function(){0!==--c||l||a||(e=Ct(p,s))}),v.subscribe(d),!n&&c>0&&(n=new O({next:function(t){return v.next(t)},error:function(t){l=!0,f(),e=Ct(h,o,t),v.error(t)},complete:function(){a=!0,f(),e=Ct(h,u),v.complete()}}),ct(t).subscribe(n))})(t)}}({connector:function(){return new W(e,n,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:!1})}function kt(t,n){return k(function(r,e){var o=null,i=0,u=!1,c=function(){return u&&!o&&e.complete()};r.subscribe(z(e,function(r){null==o||o.unsubscribe();var u=0,s=i++;ct(t(r,s)).subscribe(o=z(e,function(t){return e.next(n?n(r,t,s,u++):t)},function(){o=null,c()}))},function(){u=!0,c()}))})}function zt(t,n,r){var e=l(t)||n||r?{next:t,error:n,complete:r}:t;return e?k(function(t,n){var r;null===(r=e.subscribe)||void 0===r||r.call(e);var o=!0;t.subscribe(z(n,function(t){var r;null===(r=e.next)||void 0===r||r.call(e,t),n.next(t)},function(){var t;o=!1,null===(t=e.complete)||void 0===t||t.call(e),n.complete()},function(t){var r;o=!1,null===(r=e.error)||void 0===r||r.call(e,t),n.error(t)},function(){var t,n;o&&(null===(t=e.unsubscribe)||void 0===t||t.call(e)),null===(n=e.finalize)||void 0===n||n.call(e)}))}):T}function Ft(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r,e=l(L(r=t))?r.pop():void 0;return k(function(n,r){for(var o=t.length,c=new Array(o),s=t.map(function(){return!1}),a=!1,l=function(n){ct(t[n]).subscribe(z(r,function(t){c[n]=t,a||s[n]||(s[n]=!0,(a=s.every(T))&&(s=null))},x))},f=0;f<o;f++)l(f);n.subscribe(z(r,function(t){if(a){var n=u([t],i(c));r.next(e?e.apply(void 0,u([],i(n))):n)}}))})}class $t{_state$;_actions$=new N;_reducers=[];constructor(t={}){const n="function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t));this._state$=new J(n);const r=this._actions$.pipe(zt(t=>console.log("Action Dispatched:",t))).pipe(Tt((t,n)=>{const r=JSON.parse(JSON.stringify(t));return this._reducers.forEach(({path:t,reducerFn:e})=>{const o=r[t],i=e(o,n);void 0!==i&&o!==i&&(r[t]=i)}),r},n),function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=H(t);return k(function(n,e){(r?mt(t,n,r):mt(t,n)).subscribe(e)})}(t),jt(1));r.subscribe(this._state$)}registerReducers(...t){this._reducers.push(...t);const n=this._state$.getValue(),r=JSON.parse(JSON.stringify(n));t.forEach(({path:t,initialState:n})=>{void 0===r[t]&&(r[t]=n)}),this._state$.next(r)}registerEffects(...t){t.forEach(t=>{const n=t._rxEffect||{dispatch:!0},r=t(this._actions$);n.dispatch?r.subscribe(this.dispatch.bind(this)):r.subscribe()})}dispatch(t){this._actions$.next(t)}select(t){return this._state$.pipe(bt(n=>t(n)),(void 0===r&&(r=T),n=null!=n?n:At,k(function(t,e){var o,i=!0;t.subscribe(z(e,function(t){var u=r(t);!i&&n(o,u)||(i=!1,o=u,e.next(t))}))})));var n,r}}function Nt(t){const n=n=>({type:t,payload:n});return n.type=t,n}function Rt(){}function Jt(...t){const n=t.pop(),r=t,e=r.includes(Rt);if(e&&r.length>1)throw new Error("The `anyAction` token cannot be mixed with other action creators in a single `on` handler.");return{types:r.map(t=>t.type),reducerFn:n,isCatchAll:e}}function Ut(t,n,...r){if(!t||"string"!=typeof t)throw new Error("Reducer featureKey must be a non-empty string.");const e=r.filter(t=>!t.isCatchAll),o=r.find(t=>t.isCatchAll);return{path:t,initialState:n,reducerFn:(t=n,r)=>{for(const n of e)if(n.types.includes(r.type))return n.reducerFn(t,r);return o?o.reducerFn(t,r):t}}}function Wt(...t){const n=t.map(t=>t.type);return gt(t=>n.includes(t.type))}function Mt(t,n={dispatch:!0}){if("function"!=typeof t)throw new Error("Effect must be a function.");return Object.defineProperty(t,"_rxEffect",{value:{dispatch:!1!==n.dispatch},enumerable:!1}),t}function Yt(t,n){return r=>{const e=r[t];return n?n(e):e}}function Bt(...t){const n=t.pop(),r=t;if("function"!=typeof n)throw new Error("The last argument to createSelector must be a projection function.");return t=>{const e=r.map(n=>n(t));return n(...e)}}export{$t as Store,Rt as anyAction,St as catchError,Et as concatMap,Nt as createAction,Mt as createEffect,Yt as createFeatureSelector,Ut as createReducer,Bt as createSelector,_t as defer,It as delay,Pt as exhaustMap,gt as filter,dt as from,bt as map,yt as mergeMap,vt as of,Wt as ofType,Jt as on,kt as switchMap,zt as tap,Ft as withLatestFrom};
1
+ var t=function(r,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},t(r,n)};function r(r,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function n(t,r,n,e){return new(n||(n=Promise))(function(o,i){function u(t){try{s(e.next(t))}catch(t){i(t)}}function c(t){try{s(e.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof n?r:new n(function(t){t(r)})).then(u,c)}s((e=e.apply(t,r||[])).next())})}function e(t,r){var n,e,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,e=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(t,i)}catch(t){c=[6,t],e=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(t){var r="function"==typeof Symbol&&Symbol.iterator,n=r&&t[r],e=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,r){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var e,o,i=n.call(t),u=[];try{for(;(void 0===r||r-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function u(t,r,n){if(n||2===arguments.length)for(var e,o=0,i=r.length;o<i;o++)!e&&o in r||(e||(e=Array.prototype.slice.call(r,0,o)),e[o]=r[o]);return t.concat(e||Array.prototype.slice.call(r))}function c(t){return this instanceof c?(this.v=t,this):new c(t)}function s(t,r,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=n.apply(t,r||[]),i=[];return e=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",function(t){return function(r){return Promise.resolve(r).then(t,f)}}),e[Symbol.asyncIterator]=function(){return this},e;function u(t,r){o[t]&&(e[t]=function(r){return new Promise(function(n,e){i.push([t,r,n,e])>1||s(t,r)})},r&&(e[t]=r(e[t])))}function s(t,r){try{(n=o[t](r)).value instanceof c?Promise.resolve(n.value.v).then(a,f):l(i[0][2],n)}catch(t){l(i[0][3],t)}var n}function a(t){s("next",t)}function f(t){s("throw",t)}function l(t,r){t(r),i.shift(),i.length&&s(i[0][0],i[0][1])}}function a(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,n=t[Symbol.asyncIterator];return n?n.call(t):(t=o(t),r={},e("next"),e("throw"),e("return"),r[Symbol.asyncIterator]=function(){return this},r);function e(n){r[n]=t[n]&&function(r){return new Promise(function(e,o){(function(t,r,n,e){Promise.resolve(e).then(function(r){t({value:r,done:n})},r)})(e,o,(r=t[n](r)).done,r.value)})}}}function f(t){return"function"==typeof t}function l(t){var r=t(function(t){Error.call(t),t.stack=(new Error).stack});return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}"function"==typeof SuppressedError&&SuppressedError;var p=l(function(t){return function(r){t(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map(function(t,r){return r+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=r}});function h(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var d=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var r;return t.prototype.unsubscribe=function(){var t,r,n,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=o(s),l=a.next();!l.done;l=a.next()){l.value.remove(this)}}catch(r){t={error:r}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var h=this.initialTeardown;if(f(h))try{h()}catch(t){c=t instanceof p?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var v=o(d),b=v.next();!b.done;b=v.next()){var w=b.value;try{y(w)}catch(t){c=null!=c?c:[],t instanceof p?c=u(u([],i(c)),i(t.errors)):c.push(t)}}}catch(t){n={error:t}}finally{try{b&&!b.done&&(e=v.return)&&e.call(v)}finally{if(n)throw n.error}}}if(c)throw new p(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)y(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(r)}},t.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},t.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},t.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&h(r,t)},t.prototype.remove=function(r){var n=this._finalizers;n&&h(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=((r=new t).closed=!0,r),t}(),v=d.EMPTY;function b(t){return t instanceof d||t&&"closed"in t&&f(t.remove)&&f(t.add)&&f(t.unsubscribe)}function y(t){f(t)?t():t.unsubscribe()}var w={Promise:void 0},m=function(t,r){for(var n=[],e=2;e<arguments.length;e++)n[e-2]=arguments[e];return setTimeout.apply(void 0,u([t,r],i(n)))};function _(t){m(function(){throw t})}function x(){}function S(t){t()}var g=function(t){function n(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,b(r)&&r.add(n)):n.destination=I,n}return r(n,t),n.create=function(t,r,n){return new E(t,r,n)},n.prototype.next=function(t){this.isStopped||this._next(t)},n.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},n.prototype._next=function(t){this.destination.next(t)},n.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},n.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},n}(d),O=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(t){P(t)}},t.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(t){P(t)}else P(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){P(t)}},t}(),E=function(t){function n(r,n,e){var o,i=t.call(this)||this;return o=f(r)||!r?{next:null!=r?r:void 0,error:null!=n?n:void 0,complete:null!=e?e:void 0}:r,i.destination=new O(o),i}return r(n,t),n}(g);function P(t){_(t)}var I={closed:!0,next:x,error:function(t){throw t},complete:x},T="function"==typeof Symbol&&Symbol.observable||"@@observable";function A(t){return t}var j=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(t,r,n){var e,o=this,i=(e=t)&&e instanceof g||function(t){return t&&f(t.next)&&f(t.error)&&f(t.complete)}(e)&&b(e)?t:new E(t,r,n);return S(function(){var t=o,r=t.operator,n=t.source;i.add(r?r.call(i,n):n?o._subscribe(i):o._trySubscribe(i))}),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},t.prototype.forEach=function(t,r){var n=this;return new(r=C(r))(function(r,e){var o=new E({next:function(r){try{t(r)}catch(t){e(t),o.unsubscribe()}},error:e,complete:r});n.subscribe(o)})},t.prototype._subscribe=function(t){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(t)},t.prototype[T]=function(){return this},t.prototype.pipe=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return(0===(t=r).length?A:1===t.length?t[0]:function(r){return t.reduce(function(t,r){return r(t)},r)})(this)},t.prototype.toPromise=function(t){var r=this;return new(t=C(t))(function(t,n){var e;r.subscribe(function(t){return e=t},function(t){return n(t)},function(){return t(e)})})},t.create=function(r){return new t(r)},t}();function C(t){var r;return null!==(r=null!=t?t:w.Promise)&&void 0!==r?r:Promise}function z(t){return function(r){if(function(t){return f(null==t?void 0:t.lift)}(r))return r.lift(function(r){try{return t(r,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function k(t,r,n,e,o){return new F(t,r,n,e,o)}var F=function(t){function n(r,n,e,o,i,u){var c=t.call(this,r)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=n?function(t){try{n(t)}catch(t){r.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=e?function(){try{e()}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return r(n,t),n.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(r=this.onFinalize)||void 0===r||r.call(this))}},n}(g),$=l(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),R=function(t){function n(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return r(n,t),n.prototype.lift=function(t){var r=new J(this,this);return r.operator=t,r},n.prototype._throwIfClosed=function(){if(this.closed)throw new $},n.prototype.next=function(t){var r=this;S(function(){var n,e;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var i=o(r.currentObservers),u=i.next();!u.done;u=i.next()){u.value.next(t)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}}})},n.prototype.error=function(t){var r=this;S(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=t;for(var n=r.observers;n.length;)n.shift().error(t)}})},n.prototype.complete=function(){var t=this;S(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var r=t.observers;r.length;)r.shift().complete()}})},n.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(n.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),n.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},n.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},n.prototype._innerSubscribe=function(t){var r=this,n=this,e=n.hasError,o=n.isStopped,i=n.observers;return e||o?v:(this.currentObservers=null,i.push(t),new d(function(){r.currentObservers=null,h(i,t)}))},n.prototype._checkFinalizedStatuses=function(t){var r=this,n=r.hasError,e=r.thrownError,o=r.isStopped;n?t.error(e):o&&t.complete()},n.prototype.asObservable=function(){var t=new j;return t.source=this,t},n.create=function(t,r){return new J(t,r)},n}(j),J=function(t){function n(r,n){var e=t.call(this)||this;return e.destination=r,e.source=n,e}return r(n,t),n.prototype.next=function(t){var r,n;null===(n=null===(r=this.destination)||void 0===r?void 0:r.next)||void 0===n||n.call(r,t)},n.prototype.error=function(t){var r,n;null===(n=null===(r=this.destination)||void 0===r?void 0:r.error)||void 0===n||n.call(r,t)},n.prototype.complete=function(){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===r||r.call(t)},n.prototype._subscribe=function(t){var r,n;return null!==(n=null===(r=this.source)||void 0===r?void 0:r.subscribe(t))&&void 0!==n?n:v},n}(R),N=function(t){function n(r){var n=t.call(this)||this;return n._value=r,n}return r(n,t),Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},n.prototype.getValue=function(){var t=this,r=t.hasError,n=t.thrownError,e=t._value;if(r)throw n;return this._throwIfClosed(),e},n.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},n}(R),U={now:function(){return(U.delegate||Date).now()},delegate:void 0},W=function(t){function n(r,n,e){void 0===r&&(r=1/0),void 0===n&&(n=1/0),void 0===e&&(e=U);var o=t.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=e,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return r(n,t),n.prototype.next=function(r){var n=this,e=n.isStopped,o=n._buffer,i=n._infiniteTimeWindow,u=n._timestampProvider,c=n._windowTime;e||(o.push(r),!i&&o.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,r)},n.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(t),n=this._infiniteTimeWindow,e=this._buffer.slice(),o=0;o<e.length&&!t.closed;o+=n?1:2)t.next(e[o]);return this._checkFinalizedStatuses(t),r},n.prototype._trimBuffer=function(){var t=this,r=t._bufferSize,n=t._timestampProvider,e=t._buffer,o=t._infiniteTimeWindow,i=(o?1:2)*r;if(r<1/0&&i<e.length&&e.splice(0,e.length-i),!o){for(var u=n.now(),c=0,s=1;s<e.length&&e[s]<=u;s+=2)c=s;c&&e.splice(0,c+1)}},n}(R);function M(t){return(r=(n=t)[n.length-1])&&f(r.schedule)?t.pop():void 0;var r,n}var Y=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function B(t){return f(null==t?void 0:t.then)}function V(t){return f(t[T])}function Z(t){return Symbol.asyncIterator&&f(null==t?void 0:t[Symbol.asyncIterator])}function D(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var G="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function K(t){return f(null==t?void 0:t[G])}function L(t){return s(this,arguments,function(){var r,n,o;return e(this,function(e){switch(e.label){case 0:r=t.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(r.read())];case 3:return n=e.sent(),o=n.value,n.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function q(t){return f(null==t?void 0:t.getReader)}function H(t){if(t instanceof j)return t;if(null!=t){if(V(t))return i=t,new j(function(t){var r=i[T]();if(f(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Y(t))return e=t,new j(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()});if(B(t))return n=t,new j(function(t){n.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,_)});if(Z(t))return Q(t);if(K(t))return r=t,new j(function(t){var n,e;try{for(var i=o(r),u=i.next();!u.done;u=i.next()){var c=u.value;if(t.next(c),t.closed)return}}catch(t){n={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}t.complete()});if(q(t))return Q(L(t))}var r,n,e,i;throw D(t)}function Q(t){return new j(function(r){(function(t,r){var o,i,u,c;return n(this,void 0,void 0,function(){var n,s;return e(this,function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=a(t),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(n=i.value,r.next(n),r.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return r.complete(),[2]}})})})(t,r).catch(function(t){return r.error(t)})})}function X(t,r,n,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=r.schedule(function(){n(),o?t.add(this.schedule(null,e)):this.unsubscribe()},e);if(t.add(i),!o)return i}function tt(t,r){return void 0===r&&(r=0),z(function(n,e){n.subscribe(k(e,function(n){return X(e,t,function(){return e.next(n)},r)},function(){return X(e,t,function(){return e.complete()},r)},function(n){return X(e,t,function(){return e.error(n)},r)}))})}function rt(t,r){return void 0===r&&(r=0),z(function(n,e){e.add(t.schedule(function(){return n.subscribe(e)},r))})}function nt(t,r){if(!t)throw new Error("Iterable cannot be null");return new j(function(n){X(n,r,function(){var e=t[Symbol.asyncIterator]();X(n,r,function(){e.next().then(function(t){t.done?n.complete():n.next(t.value)})},0,!0)})})}function et(t,r){if(null!=t){if(V(t))return function(t,r){return H(t).pipe(rt(r),tt(r))}(t,r);if(Y(t))return function(t,r){return new j(function(n){var e=0;return r.schedule(function(){e===t.length?n.complete():(n.next(t[e++]),n.closed||this.schedule())})})}(t,r);if(B(t))return function(t,r){return H(t).pipe(rt(r),tt(r))}(t,r);if(Z(t))return nt(t,r);if(K(t))return function(t,r){return new j(function(n){var e;return X(n,r,function(){e=t[G](),X(n,r,function(){var t,r,o;try{r=(t=e.next()).value,o=t.done}catch(t){return void n.error(t)}o?n.complete():n.next(r)},0,!0)}),function(){return f(null==e?void 0:e.return)&&e.return()}})}(t,r);if(q(t))return function(t,r){return nt(L(t),r)}(t,r)}throw D(t)}function ot(t,r){return z(function(n,e){var o=0;n.subscribe(k(e,function(n){e.next(t.call(r,n,o++))}))})}function it(t,r,n){return void 0===n&&(n=1/0),f(r)?it(function(n,e){return ot(function(t,o){return r(n,t,e,o)})(H(t(n,e)))},n):("number"==typeof r&&(n=r),z(function(r,e){return function(t,r,n,e,o,i,u){var c=[],s=0,a=0,f=!1,l=function(){!f||c.length||s||r.complete()},p=function(t){s++;var o=!1;H(n(t,a++)).subscribe(k(r,function(t){r.next(t)},function(){o=!0},void 0,function(){if(o)try{s--;for(var t=function(){var t=c.shift();u||p(t)};c.length&&s<e;)t();l()}catch(t){r.error(t)}}))};return t.subscribe(k(r,function(t){return s<e?p(t):c.push(t)},function(){f=!0,l()})),function(){}}(r,e,t,n)}))}function ut(){return it(A,1)}function ct(){for(var t,r,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return ut()((t=n,(r=M(n))?et(t,r):H(t)))}function st(t,r){return t===r}function at(t,r){return z(function(t,r,n,e,o){return function(e,i){var u=n,c=r,s=0;e.subscribe(k(i,function(r){var n=s++;c=u?t(c,r,n):(u=!0,r),i.next(c)},o))}}(t,r,arguments.length>=2))}function ft(t,r){for(var n=[],e=2;e<arguments.length;e++)n[e-2]=arguments[e];if(!0!==r){if(!1!==r){var o=new E({next:function(){o.unsubscribe(),t()}});return H(r.apply(void 0,u([],i(n)))).subscribe(o)}}else t()}function lt(t,r,n){var e;return e=t,function(t){void 0===t&&(t={});var r=t.connector,n=void 0===r?function(){return new R}:r,e=t.resetOnError,o=void 0===e||e,i=t.resetOnComplete,u=void 0===i||i,c=t.resetOnRefCountZero,s=void 0===c||c;return function(t){var r,e,i,c=0,a=!1,f=!1,l=function(){null==e||e.unsubscribe(),e=void 0},p=function(){l(),r=i=void 0,a=f=!1},h=function(){var t=r;p(),null==t||t.unsubscribe()};return z(function(t,d){c++,f||a||l();var v=i=null!=i?i:n();d.add(function(){0!==--c||f||a||(e=ft(h,s))}),v.subscribe(d),!r&&c>0&&(r=new E({next:function(t){return v.next(t)},error:function(t){f=!0,l(),e=ft(p,o,t),v.error(t)},complete:function(){a=!0,l(),e=ft(p,u),v.complete()}}),H(t).subscribe(r))})(t)}}({connector:function(){return new W(e,r,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:!1})}class pt{_state$;_actions$=new R;_reducers=[];constructor(t={}){const r="function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t));this._state$=new N(r);const n=this._actions$.pipe(at((t,r)=>{const n=JSON.parse(JSON.stringify(t));return this._reducers.forEach(({path:t,reducerFn:e})=>{const o=n[t],i=e(o,r);void 0!==i&&o!==i&&(n[t]=i)}),n},r),function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=M(t);return z(function(r,e){(n?ct(t,r,n):ct(t,r)).subscribe(e)})}(t),lt(1));n.subscribe(this._state$)}registerReducers(...t){this._reducers.push(...t);const r=this._state$.getValue(),n=JSON.parse(JSON.stringify(r));t.forEach(({path:t,initialState:r})=>{void 0===n[t]&&(n[t]=r)}),this._state$.next(n)}registerEffects(...t){t.forEach(t=>{const r=t._rxEffect||{dispatch:!0},n=t(this._actions$);r.dispatch?n.subscribe(this.dispatch.bind(this)):n.subscribe()})}dispatch(t){this._actions$.next(t)}select(t){return this._state$.pipe(ot(r=>t(r)),(void 0===n&&(n=A),r=null!=r?r:st,z(function(t,e){var o,i=!0;t.subscribe(k(e,function(t){var u=n(t);!i&&r(o,u)||(i=!1,o=u,e.next(t))}))})));var r,n}}function ht(t){const r=r=>({type:t,payload:r});return r.type=t,r}function dt(){}function vt(...t){const r=t.pop(),n=t,e=n.includes(dt);if(e&&n.length>1)throw new Error("The `anyAction` token cannot be mixed with other action creators in a single `on` handler.");return{types:n.map(t=>t.type),reducerFn:r,isCatchAll:e}}function bt(t,r,...n){if(!t||"string"!=typeof t)throw new Error("Reducer featureKey must be a non-empty string.");const e=n.filter(t=>!t.isCatchAll),o=n.find(t=>t.isCatchAll);return{path:t,initialState:r,reducerFn:(t=r,n)=>{for(const r of e)if(r.types.includes(n.type))return r.reducerFn(t,n);return o?o.reducerFn(t,n):t}}}function yt(...t){const r=t.map(t=>t.type);return n=t=>r.includes(t.type),z(function(t,r){var o=0;t.subscribe(k(r,function(t){return n.call(e,t,o++)&&r.next(t)}))});var n,e}function wt(t,r={dispatch:!0}){if("function"!=typeof t)throw new Error("Effect must be a function.");return Object.defineProperty(t,"_rxEffect",{value:{dispatch:!1!==r.dispatch},enumerable:!1}),t}function mt(t,r){return n=>{const e=n[t];return r?r(e):e}}function _t(...t){const r=t.pop(),n=t;if("function"!=typeof r)throw new Error("The last argument to createSelector must be a projection function.");return t=>{const e=n.map(r=>r(t));return r(...e)}}export{pt as Store,dt as anyAction,ht as createAction,wt as createEffect,mt as createFeatureSelector,bt as createReducer,_t as createSelector,yt as ofType,vt as on};
@@ -492,6 +492,13 @@ function identity(x) {
492
492
  return x;
493
493
  }
494
494
 
495
+ function pipe() {
496
+ var fns = [];
497
+ for (var _i = 0; _i < arguments.length; _i++) {
498
+ fns[_i] = arguments[_i];
499
+ }
500
+ return pipeFromArray(fns);
501
+ }
495
502
  function pipeFromArray(fns) {
496
503
  if (fns.length === 0) {
497
504
  return identity;
@@ -675,6 +682,187 @@ var OperatorSubscriber = (function (_super) {
675
682
  return OperatorSubscriber;
676
683
  }(Subscriber));
677
684
 
685
+ var dateTimestampProvider = {
686
+ now: function () {
687
+ return (Date).now();
688
+ }};
689
+
690
+ var Action = (function (_super) {
691
+ __extends(Action, _super);
692
+ function Action(scheduler, work) {
693
+ return _super.call(this) || this;
694
+ }
695
+ Action.prototype.schedule = function (state, delay) {
696
+ return this;
697
+ };
698
+ return Action;
699
+ }(Subscription));
700
+
701
+ var intervalProvider = {
702
+ setInterval: function (handler, timeout) {
703
+ var args = [];
704
+ for (var _i = 2; _i < arguments.length; _i++) {
705
+ args[_i - 2] = arguments[_i];
706
+ }
707
+ return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
708
+ },
709
+ clearInterval: function (handle) {
710
+ return (clearInterval)(handle);
711
+ },
712
+ delegate: undefined,
713
+ };
714
+
715
+ var AsyncAction = (function (_super) {
716
+ __extends(AsyncAction, _super);
717
+ function AsyncAction(scheduler, work) {
718
+ var _this = _super.call(this, scheduler, work) || this;
719
+ _this.scheduler = scheduler;
720
+ _this.work = work;
721
+ _this.pending = false;
722
+ return _this;
723
+ }
724
+ AsyncAction.prototype.schedule = function (state, delay) {
725
+ var _a;
726
+ if (delay === void 0) { delay = 0; }
727
+ if (this.closed) {
728
+ return this;
729
+ }
730
+ this.state = state;
731
+ var id = this.id;
732
+ var scheduler = this.scheduler;
733
+ if (id != null) {
734
+ this.id = this.recycleAsyncId(scheduler, id, delay);
735
+ }
736
+ this.pending = true;
737
+ this.delay = delay;
738
+ this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
739
+ return this;
740
+ };
741
+ AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
742
+ if (delay === void 0) { delay = 0; }
743
+ return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
744
+ };
745
+ AsyncAction.prototype.recycleAsyncId = function (_scheduler, id, delay) {
746
+ if (delay === void 0) { delay = 0; }
747
+ if (delay != null && this.delay === delay && this.pending === false) {
748
+ return id;
749
+ }
750
+ if (id != null) {
751
+ intervalProvider.clearInterval(id);
752
+ }
753
+ return undefined;
754
+ };
755
+ AsyncAction.prototype.execute = function (state, delay) {
756
+ if (this.closed) {
757
+ return new Error('executing a cancelled action');
758
+ }
759
+ this.pending = false;
760
+ var error = this._execute(state, delay);
761
+ if (error) {
762
+ return error;
763
+ }
764
+ else if (this.pending === false && this.id != null) {
765
+ this.id = this.recycleAsyncId(this.scheduler, this.id, null);
766
+ }
767
+ };
768
+ AsyncAction.prototype._execute = function (state, _delay) {
769
+ var errored = false;
770
+ var errorValue;
771
+ try {
772
+ this.work(state);
773
+ }
774
+ catch (e) {
775
+ errored = true;
776
+ errorValue = e ? e : new Error('Scheduled action threw falsy error');
777
+ }
778
+ if (errored) {
779
+ this.unsubscribe();
780
+ return errorValue;
781
+ }
782
+ };
783
+ AsyncAction.prototype.unsubscribe = function () {
784
+ if (!this.closed) {
785
+ var _a = this, id = _a.id, scheduler = _a.scheduler;
786
+ var actions = scheduler.actions;
787
+ this.work = this.state = this.scheduler = null;
788
+ this.pending = false;
789
+ arrRemove(actions, this);
790
+ if (id != null) {
791
+ this.id = this.recycleAsyncId(scheduler, id, null);
792
+ }
793
+ this.delay = null;
794
+ _super.prototype.unsubscribe.call(this);
795
+ }
796
+ };
797
+ return AsyncAction;
798
+ }(Action));
799
+
800
+ var Scheduler = (function () {
801
+ function Scheduler(schedulerActionCtor, now) {
802
+ if (now === void 0) { now = Scheduler.now; }
803
+ this.schedulerActionCtor = schedulerActionCtor;
804
+ this.now = now;
805
+ }
806
+ Scheduler.prototype.schedule = function (work, delay, state) {
807
+ if (delay === void 0) { delay = 0; }
808
+ return new this.schedulerActionCtor(this, work).schedule(state, delay);
809
+ };
810
+ Scheduler.now = dateTimestampProvider.now;
811
+ return Scheduler;
812
+ }());
813
+
814
+ var AsyncScheduler = (function (_super) {
815
+ __extends(AsyncScheduler, _super);
816
+ function AsyncScheduler(SchedulerAction, now) {
817
+ if (now === void 0) { now = Scheduler.now; }
818
+ var _this = _super.call(this, SchedulerAction, now) || this;
819
+ _this.actions = [];
820
+ _this._active = false;
821
+ return _this;
822
+ }
823
+ AsyncScheduler.prototype.flush = function (action) {
824
+ var actions = this.actions;
825
+ if (this._active) {
826
+ actions.push(action);
827
+ return;
828
+ }
829
+ var error;
830
+ this._active = true;
831
+ do {
832
+ if ((error = action.execute(action.state, action.delay))) {
833
+ break;
834
+ }
835
+ } while ((action = actions.shift()));
836
+ this._active = false;
837
+ if (error) {
838
+ while ((action = actions.shift())) {
839
+ action.unsubscribe();
840
+ }
841
+ throw error;
842
+ }
843
+ };
844
+ return AsyncScheduler;
845
+ }(Scheduler));
846
+
847
+ var asyncScheduler = new AsyncScheduler(AsyncAction);
848
+ var async = asyncScheduler;
849
+
850
+ var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
851
+
852
+ function isScheduler(value) {
853
+ return value && isFunction(value.schedule);
854
+ }
855
+
856
+ function last(arr) {
857
+ return arr[arr.length - 1];
858
+ }
859
+ function popResultSelector(args) {
860
+ return isFunction(last(args)) ? args.pop() : undefined;
861
+ }
862
+ function popScheduler(args) {
863
+ return isScheduler(last(args)) ? args.pop() : undefined;
864
+ }
865
+
678
866
  var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
679
867
 
680
868
  function isPromise(value) {
@@ -890,6 +1078,139 @@ function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
890
1078
  }
891
1079
  }
892
1080
 
1081
+ function observeOn(scheduler, delay) {
1082
+ if (delay === void 0) { delay = 0; }
1083
+ return operate(function (source, subscriber) {
1084
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
1085
+ });
1086
+ }
1087
+
1088
+ function subscribeOn(scheduler, delay) {
1089
+ if (delay === void 0) { delay = 0; }
1090
+ return operate(function (source, subscriber) {
1091
+ subscriber.add(scheduler.schedule(function () { return source.subscribe(subscriber); }, delay));
1092
+ });
1093
+ }
1094
+
1095
+ function scheduleObservable(input, scheduler) {
1096
+ return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
1097
+ }
1098
+
1099
+ function schedulePromise(input, scheduler) {
1100
+ return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
1101
+ }
1102
+
1103
+ function scheduleArray(input, scheduler) {
1104
+ return new Observable(function (subscriber) {
1105
+ var i = 0;
1106
+ return scheduler.schedule(function () {
1107
+ if (i === input.length) {
1108
+ subscriber.complete();
1109
+ }
1110
+ else {
1111
+ subscriber.next(input[i++]);
1112
+ if (!subscriber.closed) {
1113
+ this.schedule();
1114
+ }
1115
+ }
1116
+ });
1117
+ });
1118
+ }
1119
+
1120
+ function scheduleIterable(input, scheduler) {
1121
+ return new Observable(function (subscriber) {
1122
+ var iterator$1;
1123
+ executeSchedule(subscriber, scheduler, function () {
1124
+ iterator$1 = input[iterator]();
1125
+ executeSchedule(subscriber, scheduler, function () {
1126
+ var _a;
1127
+ var value;
1128
+ var done;
1129
+ try {
1130
+ (_a = iterator$1.next(), value = _a.value, done = _a.done);
1131
+ }
1132
+ catch (err) {
1133
+ subscriber.error(err);
1134
+ return;
1135
+ }
1136
+ if (done) {
1137
+ subscriber.complete();
1138
+ }
1139
+ else {
1140
+ subscriber.next(value);
1141
+ }
1142
+ }, 0, true);
1143
+ });
1144
+ return function () { return isFunction(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return(); };
1145
+ });
1146
+ }
1147
+
1148
+ function scheduleAsyncIterable(input, scheduler) {
1149
+ if (!input) {
1150
+ throw new Error('Iterable cannot be null');
1151
+ }
1152
+ return new Observable(function (subscriber) {
1153
+ executeSchedule(subscriber, scheduler, function () {
1154
+ var iterator = input[Symbol.asyncIterator]();
1155
+ executeSchedule(subscriber, scheduler, function () {
1156
+ iterator.next().then(function (result) {
1157
+ if (result.done) {
1158
+ subscriber.complete();
1159
+ }
1160
+ else {
1161
+ subscriber.next(result.value);
1162
+ }
1163
+ });
1164
+ }, 0, true);
1165
+ });
1166
+ });
1167
+ }
1168
+
1169
+ function scheduleReadableStreamLike(input, scheduler) {
1170
+ return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
1171
+ }
1172
+
1173
+ function scheduled(input, scheduler) {
1174
+ if (input != null) {
1175
+ if (isInteropObservable(input)) {
1176
+ return scheduleObservable(input, scheduler);
1177
+ }
1178
+ if (isArrayLike(input)) {
1179
+ return scheduleArray(input, scheduler);
1180
+ }
1181
+ if (isPromise(input)) {
1182
+ return schedulePromise(input, scheduler);
1183
+ }
1184
+ if (isAsyncIterable(input)) {
1185
+ return scheduleAsyncIterable(input, scheduler);
1186
+ }
1187
+ if (isIterable(input)) {
1188
+ return scheduleIterable(input, scheduler);
1189
+ }
1190
+ if (isReadableStreamLike(input)) {
1191
+ return scheduleReadableStreamLike(input, scheduler);
1192
+ }
1193
+ }
1194
+ throw createInvalidObservableTypeError(input);
1195
+ }
1196
+
1197
+ function from(input, scheduler) {
1198
+ return scheduler ? scheduled(input, scheduler) : innerFrom(input);
1199
+ }
1200
+
1201
+ function of() {
1202
+ var args = [];
1203
+ for (var _i = 0; _i < arguments.length; _i++) {
1204
+ args[_i] = arguments[_i];
1205
+ }
1206
+ var scheduler = popScheduler(args);
1207
+ return from(args, scheduler);
1208
+ }
1209
+
1210
+ function isValidDate(value) {
1211
+ return value instanceof Date && !isNaN(value);
1212
+ }
1213
+
893
1214
  function map(project, thisArg) {
894
1215
  return operate(function (source, subscriber) {
895
1216
  var index = 0;
@@ -960,6 +1281,44 @@ function mergeMap(project, resultSelector, concurrent) {
960
1281
  return operate(function (source, subscriber) { return mergeInternals(source, subscriber, project, concurrent); });
961
1282
  }
962
1283
 
1284
+ function defer(observableFactory) {
1285
+ return new Observable(function (subscriber) {
1286
+ innerFrom(observableFactory()).subscribe(subscriber);
1287
+ });
1288
+ }
1289
+
1290
+ function timer(dueTime, intervalOrScheduler, scheduler) {
1291
+ if (dueTime === void 0) { dueTime = 0; }
1292
+ if (scheduler === void 0) { scheduler = async; }
1293
+ var intervalDuration = -1;
1294
+ if (intervalOrScheduler != null) {
1295
+ if (isScheduler(intervalOrScheduler)) {
1296
+ scheduler = intervalOrScheduler;
1297
+ }
1298
+ else {
1299
+ intervalDuration = intervalOrScheduler;
1300
+ }
1301
+ }
1302
+ return new Observable(function (subscriber) {
1303
+ var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
1304
+ if (due < 0) {
1305
+ due = 0;
1306
+ }
1307
+ var n = 0;
1308
+ return scheduler.schedule(function () {
1309
+ if (!subscriber.closed) {
1310
+ subscriber.next(n++);
1311
+ if (0 <= intervalDuration) {
1312
+ this.schedule(undefined, intervalDuration);
1313
+ }
1314
+ else {
1315
+ subscriber.complete();
1316
+ }
1317
+ }
1318
+ }, due);
1319
+ });
1320
+ }
1321
+
963
1322
  function filter(predicate, thisArg) {
964
1323
  return operate(function (source, subscriber) {
965
1324
  var index = 0;
@@ -967,6 +1326,179 @@ function filter(predicate, thisArg) {
967
1326
  });
968
1327
  }
969
1328
 
1329
+ function catchError(selector) {
1330
+ return operate(function (source, subscriber) {
1331
+ var innerSub = null;
1332
+ var syncUnsub = false;
1333
+ var handledResult;
1334
+ innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
1335
+ handledResult = innerFrom(selector(err, catchError(selector)(source)));
1336
+ if (innerSub) {
1337
+ innerSub.unsubscribe();
1338
+ innerSub = null;
1339
+ handledResult.subscribe(subscriber);
1340
+ }
1341
+ else {
1342
+ syncUnsub = true;
1343
+ }
1344
+ }));
1345
+ if (syncUnsub) {
1346
+ innerSub.unsubscribe();
1347
+ innerSub = null;
1348
+ handledResult.subscribe(subscriber);
1349
+ }
1350
+ });
1351
+ }
1352
+
1353
+ function concatMap(project, resultSelector) {
1354
+ return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
1355
+ }
1356
+
1357
+ function take(count) {
1358
+ return count <= 0
1359
+ ?
1360
+ function () { return EMPTY; }
1361
+ : operate(function (source, subscriber) {
1362
+ var seen = 0;
1363
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1364
+ if (++seen <= count) {
1365
+ subscriber.next(value);
1366
+ if (count <= seen) {
1367
+ subscriber.complete();
1368
+ }
1369
+ }
1370
+ }));
1371
+ });
1372
+ }
1373
+
1374
+ function mapTo(value) {
1375
+ return map(function () { return value; });
1376
+ }
1377
+
1378
+ function delayWhen(delayDurationSelector, subscriptionDelay) {
1379
+ return mergeMap(function (value, index) { return innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)); });
1380
+ }
1381
+
1382
+ function delay(due, scheduler) {
1383
+ if (scheduler === void 0) { scheduler = asyncScheduler; }
1384
+ var duration = timer(due, scheduler);
1385
+ return delayWhen(function () { return duration; });
1386
+ }
1387
+
1388
+ function exhaustMap(project, resultSelector) {
1389
+ if (resultSelector) {
1390
+ return function (source) {
1391
+ return source.pipe(exhaustMap(function (a, i) { return innerFrom(project(a, i)).pipe(map(function (b, ii) { return resultSelector(a, b, i, ii); })); }));
1392
+ };
1393
+ }
1394
+ return operate(function (source, subscriber) {
1395
+ var index = 0;
1396
+ var innerSub = null;
1397
+ var isComplete = false;
1398
+ source.subscribe(createOperatorSubscriber(subscriber, function (outerValue) {
1399
+ if (!innerSub) {
1400
+ innerSub = createOperatorSubscriber(subscriber, undefined, function () {
1401
+ innerSub = null;
1402
+ isComplete && subscriber.complete();
1403
+ });
1404
+ innerFrom(project(outerValue, index++)).subscribe(innerSub);
1405
+ }
1406
+ }, function () {
1407
+ isComplete = true;
1408
+ !innerSub && subscriber.complete();
1409
+ }));
1410
+ });
1411
+ }
1412
+
1413
+ function switchMap(project, resultSelector) {
1414
+ return operate(function (source, subscriber) {
1415
+ var innerSubscriber = null;
1416
+ var index = 0;
1417
+ var isComplete = false;
1418
+ var checkComplete = function () { return isComplete && !innerSubscriber && subscriber.complete(); };
1419
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1420
+ innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
1421
+ var innerIndex = 0;
1422
+ var outerIndex = index++;
1423
+ innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = createOperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
1424
+ innerSubscriber = null;
1425
+ checkComplete();
1426
+ })));
1427
+ }, function () {
1428
+ isComplete = true;
1429
+ checkComplete();
1430
+ }));
1431
+ });
1432
+ }
1433
+
1434
+ function tap(observerOrNext, error, complete) {
1435
+ var tapObserver = isFunction(observerOrNext) || error || complete
1436
+ ?
1437
+ { next: observerOrNext, error: error, complete: complete }
1438
+ : observerOrNext;
1439
+ return tapObserver
1440
+ ? operate(function (source, subscriber) {
1441
+ var _a;
1442
+ (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
1443
+ var isUnsub = true;
1444
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1445
+ var _a;
1446
+ (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
1447
+ subscriber.next(value);
1448
+ }, function () {
1449
+ var _a;
1450
+ isUnsub = false;
1451
+ (_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
1452
+ subscriber.complete();
1453
+ }, function (err) {
1454
+ var _a;
1455
+ isUnsub = false;
1456
+ (_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
1457
+ subscriber.error(err);
1458
+ }, function () {
1459
+ var _a, _b;
1460
+ if (isUnsub) {
1461
+ (_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
1462
+ }
1463
+ (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
1464
+ }));
1465
+ })
1466
+ :
1467
+ identity;
1468
+ }
1469
+
1470
+ function withLatestFrom() {
1471
+ var inputs = [];
1472
+ for (var _i = 0; _i < arguments.length; _i++) {
1473
+ inputs[_i] = arguments[_i];
1474
+ }
1475
+ var project = popResultSelector(inputs);
1476
+ return operate(function (source, subscriber) {
1477
+ var len = inputs.length;
1478
+ var otherValues = new Array(len);
1479
+ var hasValue = inputs.map(function () { return false; });
1480
+ var ready = false;
1481
+ var _loop_1 = function (i) {
1482
+ innerFrom(inputs[i]).subscribe(createOperatorSubscriber(subscriber, function (value) {
1483
+ otherValues[i] = value;
1484
+ if (!ready && !hasValue[i]) {
1485
+ hasValue[i] = true;
1486
+ (ready = hasValue.every(identity)) && (hasValue = null);
1487
+ }
1488
+ }, noop));
1489
+ };
1490
+ for (var i = 0; i < len; i++) {
1491
+ _loop_1(i);
1492
+ }
1493
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1494
+ if (ready) {
1495
+ var values = __spreadArray([value], __read(otherValues));
1496
+ subscriber.next(project ? project.apply(void 0, __spreadArray([], __read(values))) : values);
1497
+ }
1498
+ }));
1499
+ });
1500
+ }
1501
+
970
1502
  /**
971
1503
  * @typedef {import('./actions').Action} Action
972
1504
  */
@@ -1026,13 +1558,29 @@ const isSideService = () => filter(() => typeof messaging !== 'undefined');
1026
1558
  const isApp = () => filter(() => typeof messaging === 'undefined');
1027
1559
 
1028
1560
  /**
1029
- * @file zeppos.js
1030
- * @description A smart plugin factory for integrating rx-tiny-flux with ZeppOS (via ZML).
1031
- * It provides a `storePlugin` for lifecycle-aware subscriptions and context injection,
1032
- * and custom RxJS operators (`isApp`, `isSideService`) to distinguish between
1033
- * execution environments (App/Page vs. Side Service).
1561
+ * A pipeable RxJS operator for effects, designed to propagate an action from one ZeppOS
1562
+ * context to another (e.g., App to Side Service).
1563
+ *
1564
+ * It uses the `context.call` method injected by the ZML plugin system. The `context`
1565
+ * property is removed from the action before sending to avoid circular data.
1566
+ *
1567
+ * @returns {import('rxjs').OperatorFunction<Action, Action>} An operator that performs the side effect of calling the other context.
1034
1568
  */
1569
+ const propagateAction = () => tap((action) => {
1570
+ if (action.context && typeof action.context.call === 'function') {
1571
+ // Destructure to remove the context before sending.
1572
+ // The receiving side will inject its own context.
1573
+ const { context, ...actionToSend } = action;
1574
+ action.context.call(actionToSend);
1575
+ }
1576
+ });
1035
1577
 
1578
+ /**
1579
+ * @file zeppos.js
1580
+ * @description The main entry point for ZeppOS integration.
1581
+ * It exports the `storePlugin` and a curated set of custom and standard RxJS
1582
+ * operators needed for development in the ZeppOS environment.
1583
+ */
1036
1584
 
1037
1585
  /**
1038
1586
  * Factory function that creates the store plugin for ZML's BaseApp/BasePage.
@@ -1047,6 +1595,8 @@ function storePlugin(instance, store) {
1047
1595
  }
1048
1596
 
1049
1597
  return {
1598
+ onInit() { console.log ('storePlugin.init()');},
1599
+ onCreate() { console.log ('storePlugin.create()');},
1050
1600
  /**
1051
1601
  * A proxy to the store's dispatch method. It injects the component's `this`
1052
1602
  * context into the action, allowing effects to access other plugins.
@@ -1079,6 +1629,21 @@ function storePlugin(instance, store) {
1079
1629
  // Return the subscription object in case the developer needs to unsubscribe manually.
1080
1630
  return subscription;
1081
1631
  },
1632
+
1633
+ /**
1634
+ * Lifecycle hook that listens for incoming messages from another context.
1635
+ * If the message looks like an action (i.e., has a `type` property),
1636
+ * it dispatches it into the local store.
1637
+ * @param {object} message - The message object received from the other context.
1638
+ */
1639
+ onCall(message) {
1640
+ // Check if the incoming message is an action.
1641
+ if (message && typeof message.type === 'string') {
1642
+ // Dispatch received action into the local store.
1643
+ // The `dispatch` method will automatically enrich it with the current context.
1644
+ this.dispatch(message);
1645
+ }
1646
+ },
1082
1647
  /**
1083
1648
  * Lifecycle hook that will be merged and called during the instance's destruction.
1084
1649
  * This is the core of the automatic memory management feature.
@@ -1094,4 +1659,4 @@ function storePlugin(instance, store) {
1094
1659
  };
1095
1660
  }
1096
1661
 
1097
- export { isApp, isSideService, storePlugin, withLatestFromStore };
1662
+ export { EMPTY, catchError, concatMap, defer, delay, exhaustMap, filter, from, isApp, isSideService, map, mergeMap, of, pipe, propagateAction, storePlugin, switchMap, tap, withLatestFrom, withLatestFromStore };
@@ -1 +1 @@
1
- var t=function(r,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},t(r,n)};function r(r,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function n(t,r,n,e){return new(n||(n=Promise))(function(o,i){function u(t){try{s(e.next(t))}catch(t){i(t)}}function c(t){try{s(e.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?o(t.value):(r=t.value,r instanceof n?r:new n(function(t){t(r)})).then(u,c)}s((e=e.apply(t,r||[])).next())})}function e(t,r){var n,e,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(n=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,e=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(t,i)}catch(t){c=[6,t],e=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(t){var r="function"==typeof Symbol&&Symbol.iterator,n=r&&t[r],e=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,r){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var e,o,i=n.call(t),u=[];try{for(;(void 0===r||r-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function u(t,r,n){if(n||2===arguments.length)for(var e,o=0,i=r.length;o<i;o++)!e&&o in r||(e||(e=Array.prototype.slice.call(r,0,o)),e[o]=r[o]);return t.concat(e||Array.prototype.slice.call(r))}function c(t){return this instanceof c?(this.v=t,this):new c(t)}function s(t,r,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=n.apply(t,r||[]),i=[];return e=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",function(t){return function(r){return Promise.resolve(r).then(t,l)}}),e[Symbol.asyncIterator]=function(){return this},e;function u(t,r){o[t]&&(e[t]=function(r){return new Promise(function(n,e){i.push([t,r,n,e])>1||s(t,r)})},r&&(e[t]=r(e[t])))}function s(t,r){try{(n=o[t](r)).value instanceof c?Promise.resolve(n.value.v).then(a,l):f(i[0][2],n)}catch(t){f(i[0][3],t)}var n}function a(t){s("next",t)}function l(t){s("throw",t)}function f(t,r){t(r),i.shift(),i.length&&s(i[0][0],i[0][1])}}function a(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,n=t[Symbol.asyncIterator];return n?n.call(t):(t=o(t),r={},e("next"),e("throw"),e("return"),r[Symbol.asyncIterator]=function(){return this},r);function e(n){r[n]=t[n]&&function(r){return new Promise(function(e,o){(function(t,r,n,e){Promise.resolve(e).then(function(r){t({value:r,done:n})},r)})(e,o,(r=t[n](r)).done,r.value)})}}}function l(t){return"function"==typeof t}"function"==typeof SuppressedError&&SuppressedError;var f,p=((f=function(t){return function(r){t(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map(function(t,r){return r+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=r}}(function(t){Error.call(t),t.stack=(new Error).stack})).prototype=Object.create(Error.prototype),f.prototype.constructor=f,f);function h(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var y=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var r;return t.prototype.unsubscribe=function(){var t,r,n,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=o(s),f=a.next();!f.done;f=a.next()){f.value.remove(this)}}catch(r){t={error:r}}finally{try{f&&!f.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var h=this.initialTeardown;if(l(h))try{h()}catch(t){c=t instanceof p?t.errors:[t]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=o(y),d=b.next();!d.done;d=b.next()){var m=d.value;try{v(m)}catch(t){c=null!=c?c:[],t instanceof p?c=u(u([],i(c)),i(t.errors)):c.push(t)}}}catch(t){n={error:t}}finally{try{d&&!d.done&&(e=b.return)&&e.call(b)}finally{if(n)throw n.error}}}if(c)throw new p(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)v(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(r)}},t.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},t.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},t.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&h(r,t)},t.prototype.remove=function(r){var n=this._finalizers;n&&h(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=((r=new t).closed=!0,r),t}();function b(t){return t instanceof y||t&&"closed"in t&&l(t.remove)&&l(t.add)&&l(t.unsubscribe)}function v(t){l(t)?t():t.unsubscribe()}y.EMPTY;var d={Promise:void 0},m=function(t,r){for(var n=[],e=2;e<arguments.length;e++)n[e-2]=arguments[e];return setTimeout.apply(void 0,u([t,r],i(n)))};function w(t){m(function(){throw t})}function _(){}var x=function(t){function n(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,b(r)&&r.add(n)):n.destination=E,n}return r(n,t),n.create=function(t,r,n){return new g(t,r,n)},n.prototype.next=function(t){this.isStopped||this._next(t)},n.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},n.prototype._next=function(t){this.destination.next(t)},n.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},n.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},n}(y),S=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(t){P(t)}},t.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(t){P(t)}else P(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){P(t)}},t}(),g=function(t){function n(r,n,e){var o,i=t.call(this)||this;return o=l(r)||!r?{next:null!=r?r:void 0,error:null!=n?n:void 0,complete:null!=e?e:void 0}:r,i.destination=new S(o),i}return r(n,t),n}(x);function P(t){w(t)}var E={closed:!0,next:_,error:function(t){throw t},complete:_},O="function"==typeof Symbol&&Symbol.observable||"@@observable";function A(t){return t}var I=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(t,r,n){var e,o=this,i=(e=t)&&e instanceof x||function(t){return t&&l(t.next)&&l(t.error)&&l(t.complete)}(e)&&b(e)?t:new g(t,r,n);return function(){var t=o,r=t.operator,n=t.source;i.add(r?r.call(i,n):n?o._subscribe(i):o._trySubscribe(i))}(),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},t.prototype.forEach=function(t,r){var n=this;return new(r=j(r))(function(r,e){var o=new g({next:function(r){try{t(r)}catch(t){e(t),o.unsubscribe()}},error:e,complete:r});n.subscribe(o)})},t.prototype._subscribe=function(t){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(t)},t.prototype[O]=function(){return this},t.prototype.pipe=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return(0===(t=r).length?A:1===t.length?t[0]:function(r){return t.reduce(function(t,r){return r(t)},r)})(this)},t.prototype.toPromise=function(t){var r=this;return new(t=j(t))(function(t,n){var e;r.subscribe(function(t){return e=t},function(t){return n(t)},function(){return t(e)})})},t.create=function(r){return new t(r)},t}();function j(t){var r;return null!==(r=null!=t?t:d.Promise)&&void 0!==r?r:Promise}function T(t){return function(r){if(function(t){return l(null==t?void 0:t.lift)}(r))return r.lift(function(r){try{return t(r,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function k(t,r,n,e,o){return new z(t,r,n,e,o)}var z=function(t){function n(r,n,e,o,i,u){var c=t.call(this,r)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=n?function(t){try{n(t)}catch(t){r.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=e?function(){try{e()}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return r(n,t),n.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(r=this.onFinalize)||void 0===r||r.call(this))}},n}(x);var U="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Y(t){if(t instanceof I)return t;if(null!=t){if(function(t){return l(t[O])}(t))return f=t,new I(function(t){var r=f[O]();if(l(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if((a=t)&&"number"==typeof a.length&&"function"!=typeof a)return u=t,new I(function(t){for(var r=0;r<u.length&&!t.closed;r++)t.next(u[r]);t.complete()});if(l(null==(i=t)?void 0:i.then))return n=t,new I(function(t){n.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,w)});if(function(t){return Symbol.asyncIterator&&l(null==t?void 0:t[Symbol.asyncIterator])}(t))return F(t);if(function(t){return l(null==t?void 0:t[U])}(t))return r=t,new I(function(t){var n,e;try{for(var i=o(r),u=i.next();!u.done;u=i.next()){var c=u.value;if(t.next(c),t.closed)return}}catch(t){n={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(n)throw n.error}}t.complete()});if(function(t){return l(null==t?void 0:t.getReader)}(t))return F(function(t){return s(this,arguments,function(){var r,n,o;return e(this,function(e){switch(e.label){case 0:r=t.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(r.read())];case 3:return n=e.sent(),o=n.value,n.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}(t))}var r,n,i,u,a,f;throw function(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(t)}function F(t){return new I(function(r){(function(t,r){var o,i,u,c;return n(this,void 0,void 0,function(){var n,s;return e(this,function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=a(t),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(n=i.value,r.next(n),r.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return r.complete(),[2]}})})})(t,r).catch(function(t){return r.error(t)})})}function R(t,r){return T(function(n,e){var o=0;n.subscribe(k(e,function(n){e.next(t.call(r,n,o++))}))})}function L(t,r,n){return void 0===n&&(n=1/0),l(r)?L(function(n,e){return R(function(t,o){return r(n,t,e,o)})(Y(t(n,e)))},n):("number"==typeof r&&(n=r),T(function(r,e){return function(t,r,n,e,o,i,u){var c=[],s=0,a=0,l=!1,f=function(){!l||c.length||s||r.complete()},p=function(t){s++;var o=!1;Y(n(t,a++)).subscribe(k(r,function(t){r.next(t)},function(){o=!0},void 0,function(){if(o)try{s--;for(var t=function(){var t=c.shift();u||p(t)};c.length&&s<e;)t();f()}catch(t){r.error(t)}}))};return t.subscribe(k(r,function(t){return s<e?p(t):c.push(t)},function(){l=!0,f()})),function(){}}(r,e,t,n)}))}function M(t,r){return T(function(n,e){var o=0;n.subscribe(k(e,function(n){return t.call(r,n,o++)&&e.next(n)}))})}const q=t=>r=>r.pipe(L(r=>{if(!r.context||"function"!=typeof r.context.subscribe)throw new Error("[rx-tiny-flux] `withLatestFromStore` operator requires a `subscribe` method on `action.context`. Ensure you are using the `storePlugin` for ZeppOS.");return new I(n=>{const e=r.context.subscribe(t,t=>{n.next(t),n.complete()});return()=>{e.unsubscribe()}}).pipe(R(t=>[r,t]))})),C=()=>M(()=>"undefined"!=typeof messaging),D=()=>M(()=>"undefined"==typeof messaging);function G(t,r){return r?{dispatch(t){const n={...t,context:this};r.dispatch(n)},subscribe(t,n){this._subscriptions||(this._subscriptions=[]);const e=r.select(t).subscribe(n);return this._subscriptions.push(e),e},onDestroy(){this._subscriptions&&this._subscriptions.length>0&&(this._subscriptions.forEach(t=>t.unsubscribe()),this._subscriptions=[])}}:(console.error("[rx-tiny-flux] StorePlugin Error: Store instance was not provided on .use()"),{})}export{D as isApp,C as isSideService,G as storePlugin,q as withLatestFromStore};
1
+ var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},t(n,r)};function n(n,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function r(t,n,r,e){return new(r||(r=Promise))(function(o,i){function u(t){try{s(e.next(t))}catch(t){i(t)}}function c(t){try{s(e.throw(t))}catch(t){i(t)}}function s(t){var n;t.done?o(t.value):(n=t.value,n instanceof r?n:new r(function(t){t(n)})).then(u,c)}s((e=e.apply(t,n||[])).next())})}function e(t,n){var r,e,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=c(0),u.throw=c(1),u.return=c(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,c[0]&&(i=0)),i;)try{if(r=1,e&&(o=2&c[0]?e.return:c[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,c[1])).done)return o;switch(e=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,e=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=n.call(t,i)}catch(t){c=[6,t],e=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(t){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&t[n],e=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,n){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var e,o,i=r.call(t),u=[];try{for(;(void 0===n||n-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return u}function u(t,n,r){if(r||2===arguments.length)for(var e,o=0,i=n.length;o<i;o++)!e&&o in n||(e||(e=Array.prototype.slice.call(n,0,o)),e[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}function c(t){return this instanceof c?(this.v=t,this):new c(t)}function s(t,n,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,o=r.apply(t,n||[]),i=[];return e=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",function(t){return function(n){return Promise.resolve(n).then(t,a)}}),e[Symbol.asyncIterator]=function(){return this},e;function u(t,n){o[t]&&(e[t]=function(n){return new Promise(function(r,e){i.push([t,n,r,e])>1||s(t,n)})},n&&(e[t]=n(e[t])))}function s(t,n){try{(r=o[t](n)).value instanceof c?Promise.resolve(r.value.v).then(l,a):f(i[0][2],r)}catch(t){f(i[0][3],t)}var r}function l(t){s("next",t)}function a(t){s("throw",t)}function f(t,n){t(n),i.shift(),i.length&&s(i[0][0],i[0][1])}}function l(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,r=t[Symbol.asyncIterator];return r?r.call(t):(t=o(t),n={},e("next"),e("throw"),e("return"),n[Symbol.asyncIterator]=function(){return this},n);function e(r){n[r]=t[r]&&function(n){return new Promise(function(e,o){(function(t,n,r,e){Promise.resolve(e).then(function(n){t({value:n,done:r})},n)})(e,o,(n=t[r](n)).done,n.value)})}}}function a(t){return"function"==typeof t}"function"==typeof SuppressedError&&SuppressedError;var f,h=((f=function(t){return function(n){t(this),this.message=n?n.length+" errors occurred during unsubscription:\n"+n.map(function(t,n){return n+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=n}}(function(t){Error.call(t),t.stack=(new Error).stack})).prototype=Object.create(Error.prototype),f.prototype.constructor=f,f);function p(t,n){if(t){var r=t.indexOf(n);0<=r&&t.splice(r,1)}}var d=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var n;return t.prototype.unsubscribe=function(){var t,n,r,e,c;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var l=o(s),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(n){t={error:n}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}else s.remove(this);var p=this.initialTeardown;if(a(p))try{p()}catch(t){c=t instanceof h?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var b=o(d),y=b.next();!y.done;y=b.next()){var w=y.value;try{v(w)}catch(t){c=null!=c?c:[],t instanceof h?c=u(u([],i(c)),i(t.errors)):c.push(t)}}}catch(t){r={error:t}}finally{try{y&&!y.done&&(e=b.return)&&e.call(b)}finally{if(r)throw r.error}}}if(c)throw new h(c)}},t.prototype.add=function(n){var r;if(n&&n!==this)if(this.closed)v(n);else{if(n instanceof t){if(n.closed||n._hasParent(this))return;n._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(n)}},t.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},t.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},t.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&p(n,t)},t.prototype.remove=function(n){var r=this._finalizers;r&&p(r,n),n instanceof t&&n._removeParent(this)},t.EMPTY=((n=new t).closed=!0,n),t}();function b(t){return t instanceof d||t&&"closed"in t&&a(t.remove)&&a(t.add)&&a(t.unsubscribe)}function v(t){a(t)?t():t.unsubscribe()}d.EMPTY;var y={Promise:void 0},w=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return setTimeout.apply(void 0,u([t,n],i(r)))};function m(t){w(function(){throw t})}function x(){}var _=function(t){function r(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,b(n)&&n.add(r)):r.destination=P,r}return n(r,t),r.create=function(t,n,r){return new S(t,n,r)},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(d),g=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(t){I(t)}},t.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(t){I(t)}else I(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){I(t)}},t}(),S=function(t){function r(n,r,e){var o,i=t.call(this)||this;return o=a(n)||!n?{next:null!=n?n:void 0,error:null!=r?r:void 0,complete:null!=e?e:void 0}:n,i.destination=new g(o),i}return n(r,t),r}(_);function I(t){m(t)}var P={closed:!0,next:x,error:function(t){throw t},complete:x},A="function"==typeof Symbol&&Symbol.observable||"@@observable";function E(t){return t}function O(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return j(t)}function j(t){return 0===t.length?E:1===t.length?t[0]:function(n){return t.reduce(function(t,n){return n(t)},n)}}var T=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(n){var r=new t;return r.source=this,r.operator=n,r},t.prototype.subscribe=function(t,n,r){var e,o=this,i=(e=t)&&e instanceof _||function(t){return t&&a(t.next)&&a(t.error)&&a(t.complete)}(e)&&b(e)?t:new S(t,n,r);return function(){var t=o,n=t.operator,r=t.source;i.add(n?n.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},t.prototype.forEach=function(t,n){var r=this;return new(n=k(n))(function(n,e){var o=new S({next:function(n){try{t(n)}catch(t){e(t),o.unsubscribe()}},error:e,complete:n});r.subscribe(o)})},t.prototype._subscribe=function(t){var n;return null===(n=this.source)||void 0===n?void 0:n.subscribe(t)},t.prototype[A]=function(){return this},t.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return j(t)(this)},t.prototype.toPromise=function(t){var n=this;return new(t=k(t))(function(t,r){var e;n.subscribe(function(t){return e=t},function(t){return r(t)},function(){return t(e)})})},t.create=function(n){return new t(n)},t}();function k(t){var n;return null!==(n=null!=t?t:y.Promise)&&void 0!==n?n:Promise}function z(t){return function(n){if(function(t){return a(null==t?void 0:t.lift)}(n))return n.lift(function(n){try{return t(n,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}function C(t,n,r,e,o){return new U(t,n,r,e,o)}var U=function(t){function r(n,r,e,o,i,u){var c=t.call(this,n)||this;return c.onFinalize=i,c.shouldUnsubscribe=u,c._next=r?function(t){try{r(t)}catch(t){n.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){n.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=e?function(){try{e()}catch(t){n.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return n(r,t),r.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(n=this.onFinalize)||void 0===n||n.call(this))}},r}(_),Y=function(){return Date.now()},q=function(t){function r(n,r){return t.call(this)||this}return n(r,t),r.prototype.schedule=function(t,n){return this},r}(d),D=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return setInterval.apply(void 0,u([t,n],i(r)))},F=function(t){return clearInterval(t)},R=function(t){function r(n,r){var e=t.call(this,n,r)||this;return e.scheduler=n,e.work=r,e.pending=!1,e}return n(r,t),r.prototype.schedule=function(t,n){var r;if(void 0===n&&(n=0),this.closed)return this;this.state=t;var e=this.id,o=this.scheduler;return null!=e&&(this.id=this.recycleAsyncId(o,e,n)),this.pending=!0,this.delay=n,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,n),this},r.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),D(t.flush.bind(t,this),r)},r.prototype.recycleAsyncId=function(t,n,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return n;null!=n&&F(n)},r.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,n);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},r.prototype._execute=function(t,n){var r,e=!1;try{this.work(t)}catch(t){e=!0,r=t||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),r},r.prototype.unsubscribe=function(){if(!this.closed){var n=this.id,r=this.scheduler,e=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,p(e,this),null!=n&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},r}(q),L=function(){function t(n,r){void 0===r&&(r=t.now),this.schedulerActionCtor=n,this.now=r}return t.prototype.schedule=function(t,n,r){return void 0===n&&(n=0),new this.schedulerActionCtor(this,t).schedule(r,n)},t.now=Y,t}(),M=new(function(t){function r(n,r){void 0===r&&(r=L.now);var e=t.call(this,n,r)||this;return e.actions=[],e._active=!1,e}return n(r,t),r.prototype.flush=function(t){var n=this.actions;if(this._active)n.push(t);else{var r;this._active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=n.shift());if(this._active=!1,r){for(;t=n.shift();)t.unsubscribe();throw r}}},r}(L))(R),N=M,G=new T(function(t){return t.complete()});function Z(t){return t&&a(t.schedule)}function B(t){return t[t.length-1]}var H=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function J(t){return a(null==t?void 0:t.then)}function K(t){return a(t[A])}function Q(t){return Symbol.asyncIterator&&a(null==t?void 0:t[Symbol.asyncIterator])}function V(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var W="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function X(t){return a(null==t?void 0:t[W])}function $(t){return s(this,arguments,function(){var n,r,o;return e(this,function(e){switch(e.label){case 0:n=t.getReader(),e.label=1;case 1:e.trys.push([1,,9,10]),e.label=2;case 2:return[4,c(n.read())];case 3:return r=e.sent(),o=r.value,r.done?[4,c(void 0)]:[3,5];case 4:return[2,e.sent()];case 5:return[4,c(o)];case 6:return[4,e.sent()];case 7:return e.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function tt(t){return a(null==t?void 0:t.getReader)}function nt(t){if(t instanceof T)return t;if(null!=t){if(K(t))return i=t,new T(function(t){var n=i[A]();if(a(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(H(t))return e=t,new T(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()});if(J(t))return r=t,new T(function(t){r.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,m)});if(Q(t))return rt(t);if(X(t))return n=t,new T(function(t){var r,e;try{for(var i=o(n),u=i.next();!u.done;u=i.next()){var c=u.value;if(t.next(c),t.closed)return}}catch(t){r={error:t}}finally{try{u&&!u.done&&(e=i.return)&&e.call(i)}finally{if(r)throw r.error}}t.complete()});if(tt(t))return rt($(t))}var n,r,e,i;throw V(t)}function rt(t){return new T(function(n){(function(t,n){var o,i,u,c;return r(this,void 0,void 0,function(){var r,s;return e(this,function(e){switch(e.label){case 0:e.trys.push([0,5,6,11]),o=l(t),e.label=1;case 1:return[4,o.next()];case 2:if((i=e.sent()).done)return[3,4];if(r=i.value,n.next(r),n.closed)return[2];e.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=e.sent(),u={error:s},[3,11];case 6:return e.trys.push([6,,9,10]),i&&!i.done&&(c=o.return)?[4,c.call(o)]:[3,8];case 7:e.sent(),e.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return n.complete(),[2]}})})})(t,n).catch(function(t){return n.error(t)})})}function et(t,n,r,e,o){void 0===e&&(e=0),void 0===o&&(o=!1);var i=n.schedule(function(){r(),o?t.add(this.schedule(null,e)):this.unsubscribe()},e);if(t.add(i),!o)return i}function ot(t,n){return void 0===n&&(n=0),z(function(r,e){r.subscribe(C(e,function(r){return et(e,t,function(){return e.next(r)},n)},function(){return et(e,t,function(){return e.complete()},n)},function(r){return et(e,t,function(){return e.error(r)},n)}))})}function it(t,n){return void 0===n&&(n=0),z(function(r,e){e.add(t.schedule(function(){return r.subscribe(e)},n))})}function ut(t,n){if(!t)throw new Error("Iterable cannot be null");return new T(function(r){et(r,n,function(){var e=t[Symbol.asyncIterator]();et(r,n,function(){e.next().then(function(t){t.done?r.complete():r.next(t.value)})},0,!0)})})}function ct(t,n){if(null!=t){if(K(t))return function(t,n){return nt(t).pipe(it(n),ot(n))}(t,n);if(H(t))return function(t,n){return new T(function(r){var e=0;return n.schedule(function(){e===t.length?r.complete():(r.next(t[e++]),r.closed||this.schedule())})})}(t,n);if(J(t))return function(t,n){return nt(t).pipe(it(n),ot(n))}(t,n);if(Q(t))return ut(t,n);if(X(t))return function(t,n){return new T(function(r){var e;return et(r,n,function(){e=t[W](),et(r,n,function(){var t,n,o;try{n=(t=e.next()).value,o=t.done}catch(t){return void r.error(t)}o?r.complete():r.next(n)},0,!0)}),function(){return a(null==e?void 0:e.return)&&e.return()}})}(t,n);if(tt(t))return function(t,n){return ut($(t),n)}(t,n)}throw V(t)}function st(t,n){return n?ct(t,n):nt(t)}function lt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=function(t){return Z(B(t))?t.pop():void 0}(t);return st(t,r)}function at(t,n){return z(function(r,e){var o=0;r.subscribe(C(e,function(r){e.next(t.call(n,r,o++))}))})}function ft(t,n,r){return void 0===r&&(r=1/0),a(n)?ft(function(r,e){return at(function(t,o){return n(r,t,e,o)})(nt(t(r,e)))},r):("number"==typeof n&&(r=n),z(function(n,e){return function(t,n,r,e,o,i,u){var c=[],s=0,l=0,a=!1,f=function(){!a||c.length||s||n.complete()},h=function(t){s++;var o=!1;nt(r(t,l++)).subscribe(C(n,function(t){n.next(t)},function(){o=!0},void 0,function(){if(o)try{s--;for(var t=function(){var t=c.shift();u||h(t)};c.length&&s<e;)t();f()}catch(t){n.error(t)}}))};return t.subscribe(C(n,function(t){return s<e?h(t):c.push(t)},function(){a=!0,f()})),function(){}}(n,e,t,r)}))}function ht(t){return new T(function(n){nt(t()).subscribe(n)})}function pt(t,n,r){void 0===t&&(t=0),void 0===r&&(r=N);var e=-1;return null!=n&&(Z(n)?r=n:e=n),new T(function(n){var o,i=(o=t)instanceof Date&&!isNaN(o)?+t-r.now():t;i<0&&(i=0);var u=0;return r.schedule(function(){n.closed||(n.next(u++),0<=e?this.schedule(void 0,e):n.complete())},i)})}function dt(t,n){return z(function(r,e){var o=0;r.subscribe(C(e,function(r){return t.call(n,r,o++)&&e.next(r)}))})}function bt(t){return z(function(n,r){var e,o=null,i=!1;o=n.subscribe(C(r,void 0,void 0,function(u){e=nt(t(u,bt(t)(n))),o?(o.unsubscribe(),o=null,e.subscribe(r)):i=!0})),i&&(o.unsubscribe(),o=null,e.subscribe(r))})}function vt(t,n){return a(n)?ft(t,n,1):ft(t,1)}function yt(t,n){return ft(function(n,r){return nt(t(n,r)).pipe((e=1)<=0?function(){return G}:z(function(t,n){var r=0;t.subscribe(C(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))}),function(t){return at(function(){return t})}(n));var e})}function wt(t,n){void 0===n&&(n=M);var r=pt(t,n);return yt(function(){return r})}function mt(t,n){return n?function(r){return r.pipe(mt(function(r,e){return nt(t(r,e)).pipe(at(function(t,o){return n(r,t,e,o)}))}))}:z(function(n,r){var e=0,o=null,i=!1;n.subscribe(C(r,function(n){o||(o=C(r,void 0,function(){o=null,i&&r.complete()}),nt(t(n,e++)).subscribe(o))},function(){i=!0,!o&&r.complete()}))})}function xt(t,n){return z(function(r,e){var o=null,i=0,u=!1,c=function(){return u&&!o&&e.complete()};r.subscribe(C(e,function(r){null==o||o.unsubscribe();var u=0,s=i++;nt(t(r,s)).subscribe(o=C(e,function(t){return e.next(n?n(r,t,s,u++):t)},function(){o=null,c()}))},function(){u=!0,c()}))})}function _t(t,n,r){var e=a(t)||n||r?{next:t,error:n,complete:r}:t;return e?z(function(t,n){var r;null===(r=e.subscribe)||void 0===r||r.call(e);var o=!0;t.subscribe(C(n,function(t){var r;null===(r=e.next)||void 0===r||r.call(e,t),n.next(t)},function(){var t;o=!1,null===(t=e.complete)||void 0===t||t.call(e),n.complete()},function(t){var r;o=!1,null===(r=e.error)||void 0===r||r.call(e,t),n.error(t)},function(){var t,n;o&&(null===(t=e.unsubscribe)||void 0===t||t.call(e)),null===(n=e.finalize)||void 0===n||n.call(e)}))}):E}function gt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r,e=a(B(r=t))?r.pop():void 0;return z(function(n,r){for(var o=t.length,c=new Array(o),s=t.map(function(){return!1}),l=!1,a=function(n){nt(t[n]).subscribe(C(r,function(t){c[n]=t,l||s[n]||(s[n]=!0,(l=s.every(E))&&(s=null))},x))},f=0;f<o;f++)a(f);n.subscribe(C(r,function(t){if(l){var n=u([t],i(c));r.next(e?e.apply(void 0,u([],i(n))):n)}}))})}const St=t=>n=>n.pipe(ft(n=>{if(!n.context||"function"!=typeof n.context.subscribe)throw new Error("[rx-tiny-flux] `withLatestFromStore` operator requires a `subscribe` method on `action.context`. Ensure you are using the `storePlugin` for ZeppOS.");return new T(r=>{const e=n.context.subscribe(t,t=>{r.next(t),r.complete()});return()=>{e.unsubscribe()}}).pipe(at(t=>[n,t]))})),It=()=>dt(()=>"undefined"!=typeof messaging),Pt=()=>dt(()=>"undefined"==typeof messaging),At=()=>_t(t=>{if(t.context&&"function"==typeof t.context.call){const{context:n,...r}=t;t.context.call(r)}});function Et(t,n){return n?{onInit(){console.log("storePlugin.init()")},onCreate(){console.log("storePlugin.create()")},dispatch(t){const r={...t,context:this};n.dispatch(r)},subscribe(t,r){this._subscriptions||(this._subscriptions=[]);const e=n.select(t).subscribe(r);return this._subscriptions.push(e),e},onCall(t){t&&"string"==typeof t.type&&this.dispatch(t)},onDestroy(){this._subscriptions&&this._subscriptions.length>0&&(this._subscriptions.forEach(t=>t.unsubscribe()),this._subscriptions=[])}}:(console.error("[rx-tiny-flux] StorePlugin Error: Store instance was not provided on .use()"),{})}export{G as EMPTY,bt as catchError,vt as concatMap,ht as defer,wt as delay,mt as exhaustMap,dt as filter,st as from,Pt as isApp,It as isSideService,at as map,ft as mergeMap,lt as of,O as pipe,At as propagateAction,Et as storePlugin,xt as switchMap,_t as tap,gt as withLatestFrom,St as withLatestFromStore};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rx-tiny-flux",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "A lightweight, minimalist state management library for pure JavaScript projects, inspired by NgRx and Redux, and built with RxJS.",
5
5
  "author": "Bernardo Baumblatt <baumblatt@gmail.com>",
6
6
  "license": "MIT",