@blackglory/structures 0.10.22 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +0 -45
  2. package/dist/es2015/index.min.mjs +1 -15
  3. package/dist/es2015/index.min.mjs.map +1 -1
  4. package/dist/es2015/index.mjs +26 -1652
  5. package/dist/es2015/index.mjs.map +1 -1
  6. package/dist/es2015/index.umd.js +25 -1654
  7. package/dist/es2015/index.umd.js.map +1 -1
  8. package/dist/es2015/index.umd.min.js +1 -15
  9. package/dist/es2015/index.umd.min.js.map +1 -1
  10. package/dist/es2018/index.min.mjs +1 -15
  11. package/dist/es2018/index.min.mjs.map +1 -1
  12. package/dist/es2018/index.mjs +26 -1652
  13. package/dist/es2018/index.mjs.map +1 -1
  14. package/dist/es2018/index.umd.js +25 -1654
  15. package/dist/es2018/index.umd.js.map +1 -1
  16. package/dist/es2018/index.umd.min.js +1 -15
  17. package/dist/es2018/index.umd.min.js.map +1 -1
  18. package/lib/es2015/index.d.ts +0 -2
  19. package/lib/es2015/index.js +0 -2
  20. package/lib/es2015/index.js.map +1 -1
  21. package/lib/es2018/index.d.ts +0 -2
  22. package/lib/es2018/index.js +0 -2
  23. package/lib/es2018/index.js.map +1 -1
  24. package/package.json +2 -3
  25. package/lib/es2015/finite-state-machine.d.ts +0 -15
  26. package/lib/es2015/finite-state-machine.js +0 -38
  27. package/lib/es2015/finite-state-machine.js.map +0 -1
  28. package/lib/es2015/observable-finite-state-machine.d.ts +0 -14
  29. package/lib/es2015/observable-finite-state-machine.js +0 -31
  30. package/lib/es2015/observable-finite-state-machine.js.map +0 -1
  31. package/lib/es2018/finite-state-machine.d.ts +0 -15
  32. package/lib/es2018/finite-state-machine.js +0 -38
  33. package/lib/es2018/finite-state-machine.js.map +0 -1
  34. package/lib/es2018/observable-finite-state-machine.d.ts +0 -14
  35. package/lib/es2018/observable-finite-state-machine.js +0 -31
  36. package/lib/es2018/observable-finite-state-machine.js.map +0 -1
@@ -72,12 +72,12 @@
72
72
  var _function$1 = {};
73
73
 
74
74
  _function$1.isntFunction = _function$1.isFunction = void 0;
75
- function isFunction$2(val) {
75
+ function isFunction$1(val) {
76
76
  return typeof val === 'function';
77
77
  }
78
- _function$1.isFunction = isFunction$2;
78
+ _function$1.isFunction = isFunction$1;
79
79
  function isntFunction$1(val) {
80
- return !isFunction$2(val);
80
+ return !isFunction$1(val);
81
81
  }
82
82
  _function$1.isntFunction = isntFunction$1;
83
83
 
@@ -907,39 +907,39 @@
907
907
  }
908
908
  exponentialBackoff.calculateExponentialBackoffTimeout = calculateExponentialBackoffTimeout;
909
909
 
910
- var setTimeout$2 = {};
910
+ var setTimeout$1 = {};
911
911
 
912
- setTimeout$2.setTimeout = void 0;
913
- function setTimeout$1(timeout, cb) {
912
+ setTimeout$1.setTimeout = void 0;
913
+ function setTimeout(timeout, cb) {
914
914
  const timer = globalThis.setTimeout(cb, timeout);
915
915
  return () => clearTimeout(timer);
916
916
  }
917
- setTimeout$2.setTimeout = setTimeout$1;
917
+ setTimeout$1.setTimeout = setTimeout;
918
918
 
919
919
  var setSchedule$1 = {};
920
920
 
921
921
  setSchedule$1.setSchedule = void 0;
922
- const set_timeout_1$3 = setTimeout$2;
922
+ const set_timeout_1$3 = setTimeout$1;
923
923
  function setSchedule(timestamp, cb) {
924
924
  const timeout = timestamp - Date.now();
925
925
  return (0, set_timeout_1$3.setTimeout)(timeout, cb);
926
926
  }
927
927
  setSchedule$1.setSchedule = setSchedule;
928
928
 
929
- var setInterval$2 = {};
929
+ var setInterval$1 = {};
930
930
 
931
- setInterval$2.setInterval = void 0;
932
- function setInterval$1(timeout, cb) {
931
+ setInterval$1.setInterval = void 0;
932
+ function setInterval(timeout, cb) {
933
933
  const timer = globalThis.setInterval(cb, timeout);
934
934
  return () => clearInterval(timer);
935
935
  }
936
- setInterval$2.setInterval = setInterval$1;
936
+ setInterval$1.setInterval = setInterval;
937
937
 
938
- var setImmediate$2 = {};
938
+ var setImmediate$1 = {};
939
939
 
940
- setImmediate$2.setImmediate = void 0;
941
- const set_timeout_1$2 = setTimeout$2;
942
- function setImmediate$1(cb) {
940
+ setImmediate$1.setImmediate = void 0;
941
+ const set_timeout_1$2 = setTimeout$1;
942
+ function setImmediate(cb) {
943
943
  if (globalThis.setImmediate) {
944
944
  const timer = globalThis.setImmediate(cb);
945
945
  return () => clearImmediate(timer);
@@ -948,12 +948,12 @@
948
948
  return (0, set_timeout_1$2.setTimeout)(0, cb);
949
949
  }
950
950
  }
951
- setImmediate$2.setImmediate = setImmediate$1;
951
+ setImmediate$1.setImmediate = setImmediate;
952
952
 
953
953
  var setTimeoutLoop$1 = {};
954
954
 
955
955
  setTimeoutLoop$1.setTimeoutLoop = void 0;
956
- const set_timeout_1$1 = setTimeout$2;
956
+ const set_timeout_1$1 = setTimeout$1;
957
957
  function setTimeoutLoop(timeout, cb) {
958
958
  let isCancelled = false;
959
959
  let cancel = (0, set_timeout_1$1.setTimeout)(timeout, loop);
@@ -973,7 +973,7 @@
973
973
  var setDynamicTimeoutLoop$1 = {};
974
974
 
975
975
  setDynamicTimeoutLoop$1.setDynamicTimeoutLoop = void 0;
976
- const set_timeout_1 = setTimeout$2;
976
+ const set_timeout_1 = setTimeout$1;
977
977
  function setDynamicTimeoutLoop(timeout, cb) {
978
978
  let isCancelled = false;
979
979
  let cancel = (0, set_timeout_1.setTimeout)(timeout, loop);
@@ -1003,10 +1003,10 @@
1003
1003
  var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
1004
1004
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1005
1005
  };__exportStar(exponentialBackoff, exports);
1006
- __exportStar(setTimeout$2, exports);
1006
+ __exportStar(setTimeout$1, exports);
1007
1007
  __exportStar(setSchedule$1, exports);
1008
- __exportStar(setInterval$2, exports);
1009
- __exportStar(setImmediate$2, exports);
1008
+ __exportStar(setInterval$1, exports);
1009
+ __exportStar(setImmediate$1, exports);
1010
1010
  __exportStar(setTimeoutLoop$1, exports);
1011
1011
  __exportStar(setDynamicTimeoutLoop$1, exports);
1012
1012
 
@@ -1130,12 +1130,12 @@
1130
1130
  var _function = {};
1131
1131
 
1132
1132
  _function.isntFunction = _function.isFunction = void 0;
1133
- function isFunction$1(val) {
1133
+ function isFunction(val) {
1134
1134
  return typeof val === 'function';
1135
1135
  }
1136
- _function.isFunction = isFunction$1;
1136
+ _function.isFunction = isFunction;
1137
1137
  function isntFunction(val) {
1138
- return !isFunction$1(val);
1138
+ return !isFunction(val);
1139
1139
  }
1140
1140
  _function.isntFunction = isntFunction;
1141
1141
 
@@ -4028,1632 +4028,6 @@
4028
4028
  }
4029
4029
  }
4030
4030
 
4031
- class FiniteStateMachine {
4032
- constructor(schema, initialState) {
4033
- this.schema = schema;
4034
- this._state = initialState;
4035
- }
4036
- get [Symbol.toStringTag]() {
4037
- return this.constructor.name;
4038
- }
4039
- get state() {
4040
- return this._state;
4041
- }
4042
- matches(state) {
4043
- return this._state === state;
4044
- }
4045
- can(event) {
4046
- return event in this.schema[this.state];
4047
- }
4048
- /**
4049
- * @throws {BadEventError}
4050
- */
4051
- send(event) {
4052
- if (this.can(event)) {
4053
- this._state = this.schema[this.state][event];
4054
- }
4055
- else {
4056
- throw new BadEventError(this.state, event);
4057
- }
4058
- }
4059
- }
4060
- class BadEventError extends es2018Exports$1.CustomError {
4061
- constructor(state, event) {
4062
- super(`State ${state} cannot react to event ${event}`);
4063
- }
4064
- }
4065
-
4066
- /*! *****************************************************************************
4067
- Copyright (c) Microsoft Corporation.
4068
-
4069
- Permission to use, copy, modify, and/or distribute this software for any
4070
- purpose with or without fee is hereby granted.
4071
-
4072
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
4073
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
4074
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
4075
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4076
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
4077
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4078
- PERFORMANCE OF THIS SOFTWARE.
4079
- ***************************************************************************** */
4080
- /* global Reflect, Promise */
4081
-
4082
- var extendStatics = function(d, b) {
4083
- extendStatics = Object.setPrototypeOf ||
4084
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4085
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
4086
- return extendStatics(d, b);
4087
- };
4088
-
4089
- function __extends(d, b) {
4090
- if (typeof b !== "function" && b !== null)
4091
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
4092
- extendStatics(d, b);
4093
- function __() { this.constructor = d; }
4094
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4095
- }
4096
-
4097
- function __values(o) {
4098
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4099
- if (m) return m.call(o);
4100
- if (o && typeof o.length === "number") return {
4101
- next: function () {
4102
- if (o && i >= o.length) o = void 0;
4103
- return { value: o && o[i++], done: !o };
4104
- }
4105
- };
4106
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
4107
- }
4108
-
4109
- function __read(o, n) {
4110
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4111
- if (!m) return o;
4112
- var i = m.call(o), r, ar = [], e;
4113
- try {
4114
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
4115
- }
4116
- catch (error) { e = { error: error }; }
4117
- finally {
4118
- try {
4119
- if (r && !r.done && (m = i["return"])) m.call(i);
4120
- }
4121
- finally { if (e) throw e.error; }
4122
- }
4123
- return ar;
4124
- }
4125
-
4126
- function __spreadArray(to, from, pack) {
4127
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4128
- if (ar || !(i in from)) {
4129
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
4130
- ar[i] = from[i];
4131
- }
4132
- }
4133
- return to.concat(ar || Array.prototype.slice.call(from));
4134
- }
4135
-
4136
- function isFunction(value) {
4137
- return typeof value === 'function';
4138
- }
4139
-
4140
- function createErrorClass(createImpl) {
4141
- var _super = function (instance) {
4142
- Error.call(instance);
4143
- instance.stack = new Error().stack;
4144
- };
4145
- var ctorFunc = createImpl(_super);
4146
- ctorFunc.prototype = Object.create(Error.prototype);
4147
- ctorFunc.prototype.constructor = ctorFunc;
4148
- return ctorFunc;
4149
- }
4150
-
4151
- var UnsubscriptionError = createErrorClass(function (_super) {
4152
- return function UnsubscriptionErrorImpl(errors) {
4153
- _super(this);
4154
- this.message = errors
4155
- ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
4156
- : '';
4157
- this.name = 'UnsubscriptionError';
4158
- this.errors = errors;
4159
- };
4160
- });
4161
-
4162
- function arrRemove(arr, item) {
4163
- if (arr) {
4164
- var index = arr.indexOf(item);
4165
- 0 <= index && arr.splice(index, 1);
4166
- }
4167
- }
4168
-
4169
- var Subscription = (function () {
4170
- function Subscription(initialTeardown) {
4171
- this.initialTeardown = initialTeardown;
4172
- this.closed = false;
4173
- this._parentage = null;
4174
- this._finalizers = null;
4175
- }
4176
- Subscription.prototype.unsubscribe = function () {
4177
- var e_1, _a, e_2, _b;
4178
- var errors;
4179
- if (!this.closed) {
4180
- this.closed = true;
4181
- var _parentage = this._parentage;
4182
- if (_parentage) {
4183
- this._parentage = null;
4184
- if (Array.isArray(_parentage)) {
4185
- try {
4186
- for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
4187
- var parent_1 = _parentage_1_1.value;
4188
- parent_1.remove(this);
4189
- }
4190
- }
4191
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
4192
- finally {
4193
- try {
4194
- if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
4195
- }
4196
- finally { if (e_1) throw e_1.error; }
4197
- }
4198
- }
4199
- else {
4200
- _parentage.remove(this);
4201
- }
4202
- }
4203
- var initialFinalizer = this.initialTeardown;
4204
- if (isFunction(initialFinalizer)) {
4205
- try {
4206
- initialFinalizer();
4207
- }
4208
- catch (e) {
4209
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
4210
- }
4211
- }
4212
- var _finalizers = this._finalizers;
4213
- if (_finalizers) {
4214
- this._finalizers = null;
4215
- try {
4216
- for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
4217
- var finalizer = _finalizers_1_1.value;
4218
- try {
4219
- execFinalizer(finalizer);
4220
- }
4221
- catch (err) {
4222
- errors = errors !== null && errors !== void 0 ? errors : [];
4223
- if (err instanceof UnsubscriptionError) {
4224
- errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
4225
- }
4226
- else {
4227
- errors.push(err);
4228
- }
4229
- }
4230
- }
4231
- }
4232
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
4233
- finally {
4234
- try {
4235
- if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
4236
- }
4237
- finally { if (e_2) throw e_2.error; }
4238
- }
4239
- }
4240
- if (errors) {
4241
- throw new UnsubscriptionError(errors);
4242
- }
4243
- }
4244
- };
4245
- Subscription.prototype.add = function (teardown) {
4246
- var _a;
4247
- if (teardown && teardown !== this) {
4248
- if (this.closed) {
4249
- execFinalizer(teardown);
4250
- }
4251
- else {
4252
- if (teardown instanceof Subscription) {
4253
- if (teardown.closed || teardown._hasParent(this)) {
4254
- return;
4255
- }
4256
- teardown._addParent(this);
4257
- }
4258
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
4259
- }
4260
- }
4261
- };
4262
- Subscription.prototype._hasParent = function (parent) {
4263
- var _parentage = this._parentage;
4264
- return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
4265
- };
4266
- Subscription.prototype._addParent = function (parent) {
4267
- var _parentage = this._parentage;
4268
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
4269
- };
4270
- Subscription.prototype._removeParent = function (parent) {
4271
- var _parentage = this._parentage;
4272
- if (_parentage === parent) {
4273
- this._parentage = null;
4274
- }
4275
- else if (Array.isArray(_parentage)) {
4276
- arrRemove(_parentage, parent);
4277
- }
4278
- };
4279
- Subscription.prototype.remove = function (teardown) {
4280
- var _finalizers = this._finalizers;
4281
- _finalizers && arrRemove(_finalizers, teardown);
4282
- if (teardown instanceof Subscription) {
4283
- teardown._removeParent(this);
4284
- }
4285
- };
4286
- Subscription.EMPTY = (function () {
4287
- var empty = new Subscription();
4288
- empty.closed = true;
4289
- return empty;
4290
- })();
4291
- return Subscription;
4292
- }());
4293
- var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
4294
- function isSubscription(value) {
4295
- return (value instanceof Subscription ||
4296
- (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
4297
- }
4298
- function execFinalizer(finalizer) {
4299
- if (isFunction(finalizer)) {
4300
- finalizer();
4301
- }
4302
- else {
4303
- finalizer.unsubscribe();
4304
- }
4305
- }
4306
-
4307
- var config = {
4308
- onUnhandledError: null,
4309
- onStoppedNotification: null,
4310
- Promise: undefined,
4311
- useDeprecatedSynchronousErrorHandling: false,
4312
- useDeprecatedNextContext: false,
4313
- };
4314
-
4315
- var timeoutProvider = {
4316
- setTimeout: function (handler, timeout) {
4317
- var args = [];
4318
- for (var _i = 2; _i < arguments.length; _i++) {
4319
- args[_i - 2] = arguments[_i];
4320
- }
4321
- return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
4322
- },
4323
- clearTimeout: function (handle) {
4324
- return (clearTimeout)(handle);
4325
- },
4326
- delegate: undefined,
4327
- };
4328
-
4329
- function reportUnhandledError(err) {
4330
- timeoutProvider.setTimeout(function () {
4331
- {
4332
- throw err;
4333
- }
4334
- });
4335
- }
4336
-
4337
- function noop() { }
4338
-
4339
- function errorContext(cb) {
4340
- {
4341
- cb();
4342
- }
4343
- }
4344
-
4345
- var Subscriber = (function (_super) {
4346
- __extends(Subscriber, _super);
4347
- function Subscriber(destination) {
4348
- var _this = _super.call(this) || this;
4349
- _this.isStopped = false;
4350
- if (destination) {
4351
- _this.destination = destination;
4352
- if (isSubscription(destination)) {
4353
- destination.add(_this);
4354
- }
4355
- }
4356
- else {
4357
- _this.destination = EMPTY_OBSERVER;
4358
- }
4359
- return _this;
4360
- }
4361
- Subscriber.create = function (next, error, complete) {
4362
- return new SafeSubscriber(next, error, complete);
4363
- };
4364
- Subscriber.prototype.next = function (value) {
4365
- if (this.isStopped) ;
4366
- else {
4367
- this._next(value);
4368
- }
4369
- };
4370
- Subscriber.prototype.error = function (err) {
4371
- if (this.isStopped) ;
4372
- else {
4373
- this.isStopped = true;
4374
- this._error(err);
4375
- }
4376
- };
4377
- Subscriber.prototype.complete = function () {
4378
- if (this.isStopped) ;
4379
- else {
4380
- this.isStopped = true;
4381
- this._complete();
4382
- }
4383
- };
4384
- Subscriber.prototype.unsubscribe = function () {
4385
- if (!this.closed) {
4386
- this.isStopped = true;
4387
- _super.prototype.unsubscribe.call(this);
4388
- this.destination = null;
4389
- }
4390
- };
4391
- Subscriber.prototype._next = function (value) {
4392
- this.destination.next(value);
4393
- };
4394
- Subscriber.prototype._error = function (err) {
4395
- try {
4396
- this.destination.error(err);
4397
- }
4398
- finally {
4399
- this.unsubscribe();
4400
- }
4401
- };
4402
- Subscriber.prototype._complete = function () {
4403
- try {
4404
- this.destination.complete();
4405
- }
4406
- finally {
4407
- this.unsubscribe();
4408
- }
4409
- };
4410
- return Subscriber;
4411
- }(Subscription));
4412
- var _bind = Function.prototype.bind;
4413
- function bind(fn, thisArg) {
4414
- return _bind.call(fn, thisArg);
4415
- }
4416
- var ConsumerObserver = (function () {
4417
- function ConsumerObserver(partialObserver) {
4418
- this.partialObserver = partialObserver;
4419
- }
4420
- ConsumerObserver.prototype.next = function (value) {
4421
- var partialObserver = this.partialObserver;
4422
- if (partialObserver.next) {
4423
- try {
4424
- partialObserver.next(value);
4425
- }
4426
- catch (error) {
4427
- handleUnhandledError(error);
4428
- }
4429
- }
4430
- };
4431
- ConsumerObserver.prototype.error = function (err) {
4432
- var partialObserver = this.partialObserver;
4433
- if (partialObserver.error) {
4434
- try {
4435
- partialObserver.error(err);
4436
- }
4437
- catch (error) {
4438
- handleUnhandledError(error);
4439
- }
4440
- }
4441
- else {
4442
- handleUnhandledError(err);
4443
- }
4444
- };
4445
- ConsumerObserver.prototype.complete = function () {
4446
- var partialObserver = this.partialObserver;
4447
- if (partialObserver.complete) {
4448
- try {
4449
- partialObserver.complete();
4450
- }
4451
- catch (error) {
4452
- handleUnhandledError(error);
4453
- }
4454
- }
4455
- };
4456
- return ConsumerObserver;
4457
- }());
4458
- var SafeSubscriber = (function (_super) {
4459
- __extends(SafeSubscriber, _super);
4460
- function SafeSubscriber(observerOrNext, error, complete) {
4461
- var _this = _super.call(this) || this;
4462
- var partialObserver;
4463
- if (isFunction(observerOrNext) || !observerOrNext) {
4464
- partialObserver = {
4465
- next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
4466
- error: error !== null && error !== void 0 ? error : undefined,
4467
- complete: complete !== null && complete !== void 0 ? complete : undefined,
4468
- };
4469
- }
4470
- else {
4471
- var context_1;
4472
- if (_this && config.useDeprecatedNextContext) {
4473
- context_1 = Object.create(observerOrNext);
4474
- context_1.unsubscribe = function () { return _this.unsubscribe(); };
4475
- partialObserver = {
4476
- next: observerOrNext.next && bind(observerOrNext.next, context_1),
4477
- error: observerOrNext.error && bind(observerOrNext.error, context_1),
4478
- complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
4479
- };
4480
- }
4481
- else {
4482
- partialObserver = observerOrNext;
4483
- }
4484
- }
4485
- _this.destination = new ConsumerObserver(partialObserver);
4486
- return _this;
4487
- }
4488
- return SafeSubscriber;
4489
- }(Subscriber));
4490
- function handleUnhandledError(error) {
4491
- {
4492
- reportUnhandledError(error);
4493
- }
4494
- }
4495
- function defaultErrorHandler(err) {
4496
- throw err;
4497
- }
4498
- var EMPTY_OBSERVER = {
4499
- closed: true,
4500
- next: noop,
4501
- error: defaultErrorHandler,
4502
- complete: noop,
4503
- };
4504
-
4505
- var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
4506
-
4507
- function identity(x) {
4508
- return x;
4509
- }
4510
-
4511
- function pipeFromArray(fns) {
4512
- if (fns.length === 0) {
4513
- return identity;
4514
- }
4515
- if (fns.length === 1) {
4516
- return fns[0];
4517
- }
4518
- return function piped(input) {
4519
- return fns.reduce(function (prev, fn) { return fn(prev); }, input);
4520
- };
4521
- }
4522
-
4523
- var Observable = (function () {
4524
- function Observable(subscribe) {
4525
- if (subscribe) {
4526
- this._subscribe = subscribe;
4527
- }
4528
- }
4529
- Observable.prototype.lift = function (operator) {
4530
- var observable = new Observable();
4531
- observable.source = this;
4532
- observable.operator = operator;
4533
- return observable;
4534
- };
4535
- Observable.prototype.subscribe = function (observerOrNext, error, complete) {
4536
- var _this = this;
4537
- var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
4538
- errorContext(function () {
4539
- var _a = _this, operator = _a.operator, source = _a.source;
4540
- subscriber.add(operator
4541
- ?
4542
- operator.call(subscriber, source)
4543
- : source
4544
- ?
4545
- _this._subscribe(subscriber)
4546
- :
4547
- _this._trySubscribe(subscriber));
4548
- });
4549
- return subscriber;
4550
- };
4551
- Observable.prototype._trySubscribe = function (sink) {
4552
- try {
4553
- return this._subscribe(sink);
4554
- }
4555
- catch (err) {
4556
- sink.error(err);
4557
- }
4558
- };
4559
- Observable.prototype.forEach = function (next, promiseCtor) {
4560
- var _this = this;
4561
- promiseCtor = getPromiseCtor(promiseCtor);
4562
- return new promiseCtor(function (resolve, reject) {
4563
- var subscriber = new SafeSubscriber({
4564
- next: function (value) {
4565
- try {
4566
- next(value);
4567
- }
4568
- catch (err) {
4569
- reject(err);
4570
- subscriber.unsubscribe();
4571
- }
4572
- },
4573
- error: reject,
4574
- complete: resolve,
4575
- });
4576
- _this.subscribe(subscriber);
4577
- });
4578
- };
4579
- Observable.prototype._subscribe = function (subscriber) {
4580
- var _a;
4581
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
4582
- };
4583
- Observable.prototype[observable] = function () {
4584
- return this;
4585
- };
4586
- Observable.prototype.pipe = function () {
4587
- var operations = [];
4588
- for (var _i = 0; _i < arguments.length; _i++) {
4589
- operations[_i] = arguments[_i];
4590
- }
4591
- return pipeFromArray(operations)(this);
4592
- };
4593
- Observable.prototype.toPromise = function (promiseCtor) {
4594
- var _this = this;
4595
- promiseCtor = getPromiseCtor(promiseCtor);
4596
- return new promiseCtor(function (resolve, reject) {
4597
- var value;
4598
- _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
4599
- });
4600
- };
4601
- Observable.create = function (subscribe) {
4602
- return new Observable(subscribe);
4603
- };
4604
- return Observable;
4605
- }());
4606
- function getPromiseCtor(promiseCtor) {
4607
- var _a;
4608
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
4609
- }
4610
- function isObserver(value) {
4611
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
4612
- }
4613
- function isSubscriber(value) {
4614
- return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
4615
- }
4616
-
4617
- function hasLift(source) {
4618
- return isFunction(source === null || source === void 0 ? void 0 : source.lift);
4619
- }
4620
- function operate(init) {
4621
- return function (source) {
4622
- if (hasLift(source)) {
4623
- return source.lift(function (liftedSource) {
4624
- try {
4625
- return init(liftedSource, this);
4626
- }
4627
- catch (err) {
4628
- this.error(err);
4629
- }
4630
- });
4631
- }
4632
- throw new TypeError('Unable to lift unknown Observable type');
4633
- };
4634
- }
4635
-
4636
- function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
4637
- return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
4638
- }
4639
- var OperatorSubscriber = (function (_super) {
4640
- __extends(OperatorSubscriber, _super);
4641
- function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
4642
- var _this = _super.call(this, destination) || this;
4643
- _this.onFinalize = onFinalize;
4644
- _this.shouldUnsubscribe = shouldUnsubscribe;
4645
- _this._next = onNext
4646
- ? function (value) {
4647
- try {
4648
- onNext(value);
4649
- }
4650
- catch (err) {
4651
- destination.error(err);
4652
- }
4653
- }
4654
- : _super.prototype._next;
4655
- _this._error = onError
4656
- ? function (err) {
4657
- try {
4658
- onError(err);
4659
- }
4660
- catch (err) {
4661
- destination.error(err);
4662
- }
4663
- finally {
4664
- this.unsubscribe();
4665
- }
4666
- }
4667
- : _super.prototype._error;
4668
- _this._complete = onComplete
4669
- ? function () {
4670
- try {
4671
- onComplete();
4672
- }
4673
- catch (err) {
4674
- destination.error(err);
4675
- }
4676
- finally {
4677
- this.unsubscribe();
4678
- }
4679
- }
4680
- : _super.prototype._complete;
4681
- return _this;
4682
- }
4683
- OperatorSubscriber.prototype.unsubscribe = function () {
4684
- var _a;
4685
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
4686
- var closed_1 = this.closed;
4687
- _super.prototype.unsubscribe.call(this);
4688
- !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
4689
- }
4690
- };
4691
- return OperatorSubscriber;
4692
- }(Subscriber));
4693
-
4694
- function refCount() {
4695
- return operate(function (source, subscriber) {
4696
- var connection = null;
4697
- source._refCount++;
4698
- var refCounter = createOperatorSubscriber(subscriber, undefined, undefined, undefined, function () {
4699
- if (!source || source._refCount <= 0 || 0 < --source._refCount) {
4700
- connection = null;
4701
- return;
4702
- }
4703
- var sharedConnection = source._connection;
4704
- var conn = connection;
4705
- connection = null;
4706
- if (sharedConnection && (!conn || sharedConnection === conn)) {
4707
- sharedConnection.unsubscribe();
4708
- }
4709
- subscriber.unsubscribe();
4710
- });
4711
- source.subscribe(refCounter);
4712
- if (!refCounter.closed) {
4713
- connection = source.connect();
4714
- }
4715
- });
4716
- }
4717
-
4718
- ((function (_super) {
4719
- __extends(ConnectableObservable, _super);
4720
- function ConnectableObservable(source, subjectFactory) {
4721
- var _this = _super.call(this) || this;
4722
- _this.source = source;
4723
- _this.subjectFactory = subjectFactory;
4724
- _this._subject = null;
4725
- _this._refCount = 0;
4726
- _this._connection = null;
4727
- if (hasLift(source)) {
4728
- _this.lift = source.lift;
4729
- }
4730
- return _this;
4731
- }
4732
- ConnectableObservable.prototype._subscribe = function (subscriber) {
4733
- return this.getSubject().subscribe(subscriber);
4734
- };
4735
- ConnectableObservable.prototype.getSubject = function () {
4736
- var subject = this._subject;
4737
- if (!subject || subject.isStopped) {
4738
- this._subject = this.subjectFactory();
4739
- }
4740
- return this._subject;
4741
- };
4742
- ConnectableObservable.prototype._teardown = function () {
4743
- this._refCount = 0;
4744
- var _connection = this._connection;
4745
- this._subject = this._connection = null;
4746
- _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();
4747
- };
4748
- ConnectableObservable.prototype.connect = function () {
4749
- var _this = this;
4750
- var connection = this._connection;
4751
- if (!connection) {
4752
- connection = this._connection = new Subscription();
4753
- var subject_1 = this.getSubject();
4754
- connection.add(this.source.subscribe(createOperatorSubscriber(subject_1, undefined, function () {
4755
- _this._teardown();
4756
- subject_1.complete();
4757
- }, function (err) {
4758
- _this._teardown();
4759
- subject_1.error(err);
4760
- }, function () { return _this._teardown(); })));
4761
- if (connection.closed) {
4762
- this._connection = null;
4763
- connection = Subscription.EMPTY;
4764
- }
4765
- }
4766
- return connection;
4767
- };
4768
- ConnectableObservable.prototype.refCount = function () {
4769
- return refCount()(this);
4770
- };
4771
- return ConnectableObservable;
4772
- })(Observable));
4773
-
4774
- var performanceTimestampProvider = {
4775
- now: function () {
4776
- return (performanceTimestampProvider.delegate || performance).now();
4777
- },
4778
- delegate: undefined,
4779
- };
4780
-
4781
- var animationFrameProvider = {
4782
- schedule: function (callback) {
4783
- var request = requestAnimationFrame;
4784
- var cancel = cancelAnimationFrame;
4785
- var handle = request(function (timestamp) {
4786
- cancel = undefined;
4787
- callback(timestamp);
4788
- });
4789
- return new Subscription(function () { return cancel === null || cancel === void 0 ? void 0 : cancel(handle); });
4790
- },
4791
- requestAnimationFrame: function () {
4792
- var args = [];
4793
- for (var _i = 0; _i < arguments.length; _i++) {
4794
- args[_i] = arguments[_i];
4795
- }
4796
- var delegate = animationFrameProvider.delegate;
4797
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
4798
- },
4799
- cancelAnimationFrame: function () {
4800
- var args = [];
4801
- for (var _i = 0; _i < arguments.length; _i++) {
4802
- args[_i] = arguments[_i];
4803
- }
4804
- return (cancelAnimationFrame).apply(void 0, __spreadArray([], __read(args)));
4805
- },
4806
- delegate: undefined,
4807
- };
4808
-
4809
- function animationFramesFactory(timestampProvider) {
4810
- var schedule = animationFrameProvider.schedule;
4811
- return new Observable(function (subscriber) {
4812
- var subscription = new Subscription();
4813
- var provider = timestampProvider || performanceTimestampProvider;
4814
- var start = provider.now();
4815
- var run = function (timestamp) {
4816
- var now = provider.now();
4817
- subscriber.next({
4818
- timestamp: timestampProvider ? now : timestamp,
4819
- elapsed: now - start,
4820
- });
4821
- if (!subscriber.closed) {
4822
- subscription.add(schedule(run));
4823
- }
4824
- };
4825
- subscription.add(schedule(run));
4826
- return subscription;
4827
- });
4828
- }
4829
- animationFramesFactory();
4830
-
4831
- var ObjectUnsubscribedError = createErrorClass(function (_super) {
4832
- return function ObjectUnsubscribedErrorImpl() {
4833
- _super(this);
4834
- this.name = 'ObjectUnsubscribedError';
4835
- this.message = 'object unsubscribed';
4836
- };
4837
- });
4838
-
4839
- var Subject = (function (_super) {
4840
- __extends(Subject, _super);
4841
- function Subject() {
4842
- var _this = _super.call(this) || this;
4843
- _this.closed = false;
4844
- _this.currentObservers = null;
4845
- _this.observers = [];
4846
- _this.isStopped = false;
4847
- _this.hasError = false;
4848
- _this.thrownError = null;
4849
- return _this;
4850
- }
4851
- Subject.prototype.lift = function (operator) {
4852
- var subject = new AnonymousSubject(this, this);
4853
- subject.operator = operator;
4854
- return subject;
4855
- };
4856
- Subject.prototype._throwIfClosed = function () {
4857
- if (this.closed) {
4858
- throw new ObjectUnsubscribedError();
4859
- }
4860
- };
4861
- Subject.prototype.next = function (value) {
4862
- var _this = this;
4863
- errorContext(function () {
4864
- var e_1, _a;
4865
- _this._throwIfClosed();
4866
- if (!_this.isStopped) {
4867
- if (!_this.currentObservers) {
4868
- _this.currentObservers = Array.from(_this.observers);
4869
- }
4870
- try {
4871
- for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
4872
- var observer = _c.value;
4873
- observer.next(value);
4874
- }
4875
- }
4876
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
4877
- finally {
4878
- try {
4879
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
4880
- }
4881
- finally { if (e_1) throw e_1.error; }
4882
- }
4883
- }
4884
- });
4885
- };
4886
- Subject.prototype.error = function (err) {
4887
- var _this = this;
4888
- errorContext(function () {
4889
- _this._throwIfClosed();
4890
- if (!_this.isStopped) {
4891
- _this.hasError = _this.isStopped = true;
4892
- _this.thrownError = err;
4893
- var observers = _this.observers;
4894
- while (observers.length) {
4895
- observers.shift().error(err);
4896
- }
4897
- }
4898
- });
4899
- };
4900
- Subject.prototype.complete = function () {
4901
- var _this = this;
4902
- errorContext(function () {
4903
- _this._throwIfClosed();
4904
- if (!_this.isStopped) {
4905
- _this.isStopped = true;
4906
- var observers = _this.observers;
4907
- while (observers.length) {
4908
- observers.shift().complete();
4909
- }
4910
- }
4911
- });
4912
- };
4913
- Subject.prototype.unsubscribe = function () {
4914
- this.isStopped = this.closed = true;
4915
- this.observers = this.currentObservers = null;
4916
- };
4917
- Object.defineProperty(Subject.prototype, "observed", {
4918
- get: function () {
4919
- var _a;
4920
- return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
4921
- },
4922
- enumerable: false,
4923
- configurable: true
4924
- });
4925
- Subject.prototype._trySubscribe = function (subscriber) {
4926
- this._throwIfClosed();
4927
- return _super.prototype._trySubscribe.call(this, subscriber);
4928
- };
4929
- Subject.prototype._subscribe = function (subscriber) {
4930
- this._throwIfClosed();
4931
- this._checkFinalizedStatuses(subscriber);
4932
- return this._innerSubscribe(subscriber);
4933
- };
4934
- Subject.prototype._innerSubscribe = function (subscriber) {
4935
- var _this = this;
4936
- var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
4937
- if (hasError || isStopped) {
4938
- return EMPTY_SUBSCRIPTION;
4939
- }
4940
- this.currentObservers = null;
4941
- observers.push(subscriber);
4942
- return new Subscription(function () {
4943
- _this.currentObservers = null;
4944
- arrRemove(observers, subscriber);
4945
- });
4946
- };
4947
- Subject.prototype._checkFinalizedStatuses = function (subscriber) {
4948
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
4949
- if (hasError) {
4950
- subscriber.error(thrownError);
4951
- }
4952
- else if (isStopped) {
4953
- subscriber.complete();
4954
- }
4955
- };
4956
- Subject.prototype.asObservable = function () {
4957
- var observable = new Observable();
4958
- observable.source = this;
4959
- return observable;
4960
- };
4961
- Subject.create = function (destination, source) {
4962
- return new AnonymousSubject(destination, source);
4963
- };
4964
- return Subject;
4965
- }(Observable));
4966
- var AnonymousSubject = (function (_super) {
4967
- __extends(AnonymousSubject, _super);
4968
- function AnonymousSubject(destination, source) {
4969
- var _this = _super.call(this) || this;
4970
- _this.destination = destination;
4971
- _this.source = source;
4972
- return _this;
4973
- }
4974
- AnonymousSubject.prototype.next = function (value) {
4975
- var _a, _b;
4976
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
4977
- };
4978
- AnonymousSubject.prototype.error = function (err) {
4979
- var _a, _b;
4980
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
4981
- };
4982
- AnonymousSubject.prototype.complete = function () {
4983
- var _a, _b;
4984
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
4985
- };
4986
- AnonymousSubject.prototype._subscribe = function (subscriber) {
4987
- var _a, _b;
4988
- return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
4989
- };
4990
- return AnonymousSubject;
4991
- }(Subject));
4992
-
4993
- ((function (_super) {
4994
- __extends(BehaviorSubject, _super);
4995
- function BehaviorSubject(_value) {
4996
- var _this = _super.call(this) || this;
4997
- _this._value = _value;
4998
- return _this;
4999
- }
5000
- Object.defineProperty(BehaviorSubject.prototype, "value", {
5001
- get: function () {
5002
- return this.getValue();
5003
- },
5004
- enumerable: false,
5005
- configurable: true
5006
- });
5007
- BehaviorSubject.prototype._subscribe = function (subscriber) {
5008
- var subscription = _super.prototype._subscribe.call(this, subscriber);
5009
- !subscription.closed && subscriber.next(this._value);
5010
- return subscription;
5011
- };
5012
- BehaviorSubject.prototype.getValue = function () {
5013
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
5014
- if (hasError) {
5015
- throw thrownError;
5016
- }
5017
- this._throwIfClosed();
5018
- return _value;
5019
- };
5020
- BehaviorSubject.prototype.next = function (value) {
5021
- _super.prototype.next.call(this, (this._value = value));
5022
- };
5023
- return BehaviorSubject;
5024
- })(Subject));
5025
-
5026
- var dateTimestampProvider = {
5027
- now: function () {
5028
- return (dateTimestampProvider.delegate || Date).now();
5029
- },
5030
- delegate: undefined,
5031
- };
5032
-
5033
- ((function (_super) {
5034
- __extends(ReplaySubject, _super);
5035
- function ReplaySubject(_bufferSize, _windowTime, _timestampProvider) {
5036
- if (_bufferSize === void 0) { _bufferSize = Infinity; }
5037
- if (_windowTime === void 0) { _windowTime = Infinity; }
5038
- if (_timestampProvider === void 0) { _timestampProvider = dateTimestampProvider; }
5039
- var _this = _super.call(this) || this;
5040
- _this._bufferSize = _bufferSize;
5041
- _this._windowTime = _windowTime;
5042
- _this._timestampProvider = _timestampProvider;
5043
- _this._buffer = [];
5044
- _this._infiniteTimeWindow = true;
5045
- _this._infiniteTimeWindow = _windowTime === Infinity;
5046
- _this._bufferSize = Math.max(1, _bufferSize);
5047
- _this._windowTime = Math.max(1, _windowTime);
5048
- return _this;
5049
- }
5050
- ReplaySubject.prototype.next = function (value) {
5051
- var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
5052
- if (!isStopped) {
5053
- _buffer.push(value);
5054
- !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
5055
- }
5056
- this._trimBuffer();
5057
- _super.prototype.next.call(this, value);
5058
- };
5059
- ReplaySubject.prototype._subscribe = function (subscriber) {
5060
- this._throwIfClosed();
5061
- this._trimBuffer();
5062
- var subscription = this._innerSubscribe(subscriber);
5063
- var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer;
5064
- var copy = _buffer.slice();
5065
- for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
5066
- subscriber.next(copy[i]);
5067
- }
5068
- this._checkFinalizedStatuses(subscriber);
5069
- return subscription;
5070
- };
5071
- ReplaySubject.prototype._trimBuffer = function () {
5072
- var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
5073
- var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
5074
- _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
5075
- if (!_infiniteTimeWindow) {
5076
- var now = _timestampProvider.now();
5077
- var last = 0;
5078
- for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
5079
- last = i;
5080
- }
5081
- last && _buffer.splice(0, last + 1);
5082
- }
5083
- };
5084
- return ReplaySubject;
5085
- })(Subject));
5086
-
5087
- ((function (_super) {
5088
- __extends(AsyncSubject, _super);
5089
- function AsyncSubject() {
5090
- var _this = _super !== null && _super.apply(this, arguments) || this;
5091
- _this._value = null;
5092
- _this._hasValue = false;
5093
- _this._isComplete = false;
5094
- return _this;
5095
- }
5096
- AsyncSubject.prototype._checkFinalizedStatuses = function (subscriber) {
5097
- var _a = this, hasError = _a.hasError, _hasValue = _a._hasValue, _value = _a._value, thrownError = _a.thrownError, isStopped = _a.isStopped, _isComplete = _a._isComplete;
5098
- if (hasError) {
5099
- subscriber.error(thrownError);
5100
- }
5101
- else if (isStopped || _isComplete) {
5102
- _hasValue && subscriber.next(_value);
5103
- subscriber.complete();
5104
- }
5105
- };
5106
- AsyncSubject.prototype.next = function (value) {
5107
- if (!this.isStopped) {
5108
- this._value = value;
5109
- this._hasValue = true;
5110
- }
5111
- };
5112
- AsyncSubject.prototype.complete = function () {
5113
- var _a = this, _hasValue = _a._hasValue, _value = _a._value, _isComplete = _a._isComplete;
5114
- if (!_isComplete) {
5115
- this._isComplete = true;
5116
- _hasValue && _super.prototype.next.call(this, _value);
5117
- _super.prototype.complete.call(this);
5118
- }
5119
- };
5120
- return AsyncSubject;
5121
- })(Subject));
5122
-
5123
- var Action = (function (_super) {
5124
- __extends(Action, _super);
5125
- function Action(scheduler, work) {
5126
- return _super.call(this) || this;
5127
- }
5128
- Action.prototype.schedule = function (state, delay) {
5129
- return this;
5130
- };
5131
- return Action;
5132
- }(Subscription));
5133
-
5134
- var intervalProvider = {
5135
- setInterval: function (handler, timeout) {
5136
- var args = [];
5137
- for (var _i = 2; _i < arguments.length; _i++) {
5138
- args[_i - 2] = arguments[_i];
5139
- }
5140
- return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
5141
- },
5142
- clearInterval: function (handle) {
5143
- return (clearInterval)(handle);
5144
- },
5145
- delegate: undefined,
5146
- };
5147
-
5148
- var AsyncAction = (function (_super) {
5149
- __extends(AsyncAction, _super);
5150
- function AsyncAction(scheduler, work) {
5151
- var _this = _super.call(this, scheduler, work) || this;
5152
- _this.scheduler = scheduler;
5153
- _this.work = work;
5154
- _this.pending = false;
5155
- return _this;
5156
- }
5157
- AsyncAction.prototype.schedule = function (state, delay) {
5158
- if (delay === void 0) { delay = 0; }
5159
- if (this.closed) {
5160
- return this;
5161
- }
5162
- this.state = state;
5163
- var id = this.id;
5164
- var scheduler = this.scheduler;
5165
- if (id != null) {
5166
- this.id = this.recycleAsyncId(scheduler, id, delay);
5167
- }
5168
- this.pending = true;
5169
- this.delay = delay;
5170
- this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
5171
- return this;
5172
- };
5173
- AsyncAction.prototype.requestAsyncId = function (scheduler, _id, delay) {
5174
- if (delay === void 0) { delay = 0; }
5175
- return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
5176
- };
5177
- AsyncAction.prototype.recycleAsyncId = function (_scheduler, id, delay) {
5178
- if (delay === void 0) { delay = 0; }
5179
- if (delay != null && this.delay === delay && this.pending === false) {
5180
- return id;
5181
- }
5182
- intervalProvider.clearInterval(id);
5183
- return undefined;
5184
- };
5185
- AsyncAction.prototype.execute = function (state, delay) {
5186
- if (this.closed) {
5187
- return new Error('executing a cancelled action');
5188
- }
5189
- this.pending = false;
5190
- var error = this._execute(state, delay);
5191
- if (error) {
5192
- return error;
5193
- }
5194
- else if (this.pending === false && this.id != null) {
5195
- this.id = this.recycleAsyncId(this.scheduler, this.id, null);
5196
- }
5197
- };
5198
- AsyncAction.prototype._execute = function (state, _delay) {
5199
- var errored = false;
5200
- var errorValue;
5201
- try {
5202
- this.work(state);
5203
- }
5204
- catch (e) {
5205
- errored = true;
5206
- errorValue = e ? e : new Error('Scheduled action threw falsy error');
5207
- }
5208
- if (errored) {
5209
- this.unsubscribe();
5210
- return errorValue;
5211
- }
5212
- };
5213
- AsyncAction.prototype.unsubscribe = function () {
5214
- if (!this.closed) {
5215
- var _a = this, id = _a.id, scheduler = _a.scheduler;
5216
- var actions = scheduler.actions;
5217
- this.work = this.state = this.scheduler = null;
5218
- this.pending = false;
5219
- arrRemove(actions, this);
5220
- if (id != null) {
5221
- this.id = this.recycleAsyncId(scheduler, id, null);
5222
- }
5223
- this.delay = null;
5224
- _super.prototype.unsubscribe.call(this);
5225
- }
5226
- };
5227
- return AsyncAction;
5228
- }(Action));
5229
-
5230
- var nextHandle = 1;
5231
- var resolved;
5232
- var activeHandles = {};
5233
- function findAndClearHandle(handle) {
5234
- if (handle in activeHandles) {
5235
- delete activeHandles[handle];
5236
- return true;
5237
- }
5238
- return false;
5239
- }
5240
- var Immediate = {
5241
- setImmediate: function (cb) {
5242
- var handle = nextHandle++;
5243
- activeHandles[handle] = true;
5244
- if (!resolved) {
5245
- resolved = Promise.resolve();
5246
- }
5247
- resolved.then(function () { return findAndClearHandle(handle) && cb(); });
5248
- return handle;
5249
- },
5250
- clearImmediate: function (handle) {
5251
- findAndClearHandle(handle);
5252
- },
5253
- };
5254
-
5255
- var setImmediate = Immediate.setImmediate, clearImmediate$1 = Immediate.clearImmediate;
5256
- var immediateProvider = {
5257
- setImmediate: function () {
5258
- var args = [];
5259
- for (var _i = 0; _i < arguments.length; _i++) {
5260
- args[_i] = arguments[_i];
5261
- }
5262
- var delegate = immediateProvider.delegate;
5263
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate).apply(void 0, __spreadArray([], __read(args)));
5264
- },
5265
- clearImmediate: function (handle) {
5266
- return (clearImmediate$1)(handle);
5267
- },
5268
- delegate: undefined,
5269
- };
5270
-
5271
- var AsapAction = (function (_super) {
5272
- __extends(AsapAction, _super);
5273
- function AsapAction(scheduler, work) {
5274
- var _this = _super.call(this, scheduler, work) || this;
5275
- _this.scheduler = scheduler;
5276
- _this.work = work;
5277
- return _this;
5278
- }
5279
- AsapAction.prototype.requestAsyncId = function (scheduler, id, delay) {
5280
- if (delay === void 0) { delay = 0; }
5281
- if (delay !== null && delay > 0) {
5282
- return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
5283
- }
5284
- scheduler.actions.push(this);
5285
- return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, undefined)));
5286
- };
5287
- AsapAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
5288
- if (delay === void 0) { delay = 0; }
5289
- if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
5290
- return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
5291
- }
5292
- if (!scheduler.actions.some(function (action) { return action.id === id; })) {
5293
- immediateProvider.clearImmediate(id);
5294
- scheduler._scheduled = undefined;
5295
- }
5296
- return undefined;
5297
- };
5298
- return AsapAction;
5299
- }(AsyncAction));
5300
-
5301
- var Scheduler = (function () {
5302
- function Scheduler(schedulerActionCtor, now) {
5303
- if (now === void 0) { now = Scheduler.now; }
5304
- this.schedulerActionCtor = schedulerActionCtor;
5305
- this.now = now;
5306
- }
5307
- Scheduler.prototype.schedule = function (work, delay, state) {
5308
- if (delay === void 0) { delay = 0; }
5309
- return new this.schedulerActionCtor(this, work).schedule(state, delay);
5310
- };
5311
- Scheduler.now = dateTimestampProvider.now;
5312
- return Scheduler;
5313
- }());
5314
-
5315
- var AsyncScheduler = (function (_super) {
5316
- __extends(AsyncScheduler, _super);
5317
- function AsyncScheduler(SchedulerAction, now) {
5318
- if (now === void 0) { now = Scheduler.now; }
5319
- var _this = _super.call(this, SchedulerAction, now) || this;
5320
- _this.actions = [];
5321
- _this._active = false;
5322
- _this._scheduled = undefined;
5323
- return _this;
5324
- }
5325
- AsyncScheduler.prototype.flush = function (action) {
5326
- var actions = this.actions;
5327
- if (this._active) {
5328
- actions.push(action);
5329
- return;
5330
- }
5331
- var error;
5332
- this._active = true;
5333
- do {
5334
- if ((error = action.execute(action.state, action.delay))) {
5335
- break;
5336
- }
5337
- } while ((action = actions.shift()));
5338
- this._active = false;
5339
- if (error) {
5340
- while ((action = actions.shift())) {
5341
- action.unsubscribe();
5342
- }
5343
- throw error;
5344
- }
5345
- };
5346
- return AsyncScheduler;
5347
- }(Scheduler));
5348
-
5349
- var AsapScheduler = (function (_super) {
5350
- __extends(AsapScheduler, _super);
5351
- function AsapScheduler() {
5352
- return _super !== null && _super.apply(this, arguments) || this;
5353
- }
5354
- AsapScheduler.prototype.flush = function (action) {
5355
- this._active = true;
5356
- var flushId = this._scheduled;
5357
- this._scheduled = undefined;
5358
- var actions = this.actions;
5359
- var error;
5360
- action = action || actions.shift();
5361
- do {
5362
- if ((error = action.execute(action.state, action.delay))) {
5363
- break;
5364
- }
5365
- } while ((action = actions[0]) && action.id === flushId && actions.shift());
5366
- this._active = false;
5367
- if (error) {
5368
- while ((action = actions[0]) && action.id === flushId && actions.shift()) {
5369
- action.unsubscribe();
5370
- }
5371
- throw error;
5372
- }
5373
- };
5374
- return AsapScheduler;
5375
- }(AsyncScheduler));
5376
-
5377
- new AsapScheduler(AsapAction);
5378
-
5379
- new AsyncScheduler(AsyncAction);
5380
-
5381
- var QueueAction = (function (_super) {
5382
- __extends(QueueAction, _super);
5383
- function QueueAction(scheduler, work) {
5384
- var _this = _super.call(this, scheduler, work) || this;
5385
- _this.scheduler = scheduler;
5386
- _this.work = work;
5387
- return _this;
5388
- }
5389
- QueueAction.prototype.schedule = function (state, delay) {
5390
- if (delay === void 0) { delay = 0; }
5391
- if (delay > 0) {
5392
- return _super.prototype.schedule.call(this, state, delay);
5393
- }
5394
- this.delay = delay;
5395
- this.state = state;
5396
- this.scheduler.flush(this);
5397
- return this;
5398
- };
5399
- QueueAction.prototype.execute = function (state, delay) {
5400
- return (delay > 0 || this.closed) ?
5401
- _super.prototype.execute.call(this, state, delay) :
5402
- this._execute(state, delay);
5403
- };
5404
- QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {
5405
- if (delay === void 0) { delay = 0; }
5406
- if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
5407
- return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
5408
- }
5409
- return scheduler.flush(this);
5410
- };
5411
- return QueueAction;
5412
- }(AsyncAction));
5413
-
5414
- var QueueScheduler = (function (_super) {
5415
- __extends(QueueScheduler, _super);
5416
- function QueueScheduler() {
5417
- return _super !== null && _super.apply(this, arguments) || this;
5418
- }
5419
- return QueueScheduler;
5420
- }(AsyncScheduler));
5421
-
5422
- new QueueScheduler(QueueAction);
5423
-
5424
- var AnimationFrameAction = (function (_super) {
5425
- __extends(AnimationFrameAction, _super);
5426
- function AnimationFrameAction(scheduler, work) {
5427
- var _this = _super.call(this, scheduler, work) || this;
5428
- _this.scheduler = scheduler;
5429
- _this.work = work;
5430
- return _this;
5431
- }
5432
- AnimationFrameAction.prototype.requestAsyncId = function (scheduler, id, delay) {
5433
- if (delay === void 0) { delay = 0; }
5434
- if (delay !== null && delay > 0) {
5435
- return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
5436
- }
5437
- scheduler.actions.push(this);
5438
- return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(function () { return scheduler.flush(undefined); }));
5439
- };
5440
- AnimationFrameAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
5441
- if (delay === void 0) { delay = 0; }
5442
- if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
5443
- return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
5444
- }
5445
- if (!scheduler.actions.some(function (action) { return action.id === id; })) {
5446
- animationFrameProvider.cancelAnimationFrame(id);
5447
- scheduler._scheduled = undefined;
5448
- }
5449
- return undefined;
5450
- };
5451
- return AnimationFrameAction;
5452
- }(AsyncAction));
5453
-
5454
- var AnimationFrameScheduler = (function (_super) {
5455
- __extends(AnimationFrameScheduler, _super);
5456
- function AnimationFrameScheduler() {
5457
- return _super !== null && _super.apply(this, arguments) || this;
5458
- }
5459
- AnimationFrameScheduler.prototype.flush = function (action) {
5460
- this._active = true;
5461
- var flushId = this._scheduled;
5462
- this._scheduled = undefined;
5463
- var actions = this.actions;
5464
- var error;
5465
- action = action || actions.shift();
5466
- do {
5467
- if ((error = action.execute(action.state, action.delay))) {
5468
- break;
5469
- }
5470
- } while ((action = actions[0]) && action.id === flushId && actions.shift());
5471
- this._active = false;
5472
- if (error) {
5473
- while ((action = actions[0]) && action.id === flushId && actions.shift()) {
5474
- action.unsubscribe();
5475
- }
5476
- throw error;
5477
- }
5478
- };
5479
- return AnimationFrameScheduler;
5480
- }(AsyncScheduler));
5481
-
5482
- new AnimationFrameScheduler(AnimationFrameAction);
5483
-
5484
- ((function (_super) {
5485
- __extends(VirtualTimeScheduler, _super);
5486
- function VirtualTimeScheduler(schedulerActionCtor, maxFrames) {
5487
- if (schedulerActionCtor === void 0) { schedulerActionCtor = VirtualAction; }
5488
- if (maxFrames === void 0) { maxFrames = Infinity; }
5489
- var _this = _super.call(this, schedulerActionCtor, function () { return _this.frame; }) || this;
5490
- _this.maxFrames = maxFrames;
5491
- _this.frame = 0;
5492
- _this.index = -1;
5493
- return _this;
5494
- }
5495
- VirtualTimeScheduler.prototype.flush = function () {
5496
- var _a = this, actions = _a.actions, maxFrames = _a.maxFrames;
5497
- var error;
5498
- var action;
5499
- while ((action = actions[0]) && action.delay <= maxFrames) {
5500
- actions.shift();
5501
- this.frame = action.delay;
5502
- if ((error = action.execute(action.state, action.delay))) {
5503
- break;
5504
- }
5505
- }
5506
- if (error) {
5507
- while ((action = actions.shift())) {
5508
- action.unsubscribe();
5509
- }
5510
- throw error;
5511
- }
5512
- };
5513
- VirtualTimeScheduler.frameTimeFactor = 10;
5514
- return VirtualTimeScheduler;
5515
- })(AsyncScheduler));
5516
- var VirtualAction = (function (_super) {
5517
- __extends(VirtualAction, _super);
5518
- function VirtualAction(scheduler, work, index) {
5519
- if (index === void 0) { index = (scheduler.index += 1); }
5520
- var _this = _super.call(this, scheduler, work) || this;
5521
- _this.scheduler = scheduler;
5522
- _this.work = work;
5523
- _this.index = index;
5524
- _this.active = true;
5525
- _this.index = scheduler.index = index;
5526
- return _this;
5527
- }
5528
- VirtualAction.prototype.schedule = function (state, delay) {
5529
- if (delay === void 0) { delay = 0; }
5530
- if (Number.isFinite(delay)) {
5531
- if (!this.id) {
5532
- return _super.prototype.schedule.call(this, state, delay);
5533
- }
5534
- this.active = false;
5535
- var action = new VirtualAction(this.scheduler, this.work);
5536
- this.add(action);
5537
- return action.schedule(state, delay);
5538
- }
5539
- else {
5540
- return Subscription.EMPTY;
5541
- }
5542
- };
5543
- VirtualAction.prototype.requestAsyncId = function (scheduler, id, delay) {
5544
- if (delay === void 0) { delay = 0; }
5545
- this.delay = scheduler.frame + delay;
5546
- var actions = scheduler.actions;
5547
- actions.push(this);
5548
- actions.sort(VirtualAction.sortActions);
5549
- return true;
5550
- };
5551
- VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
5552
- return undefined;
5553
- };
5554
- VirtualAction.prototype._execute = function (state, delay) {
5555
- if (this.active === true) {
5556
- return _super.prototype._execute.call(this, state, delay);
5557
- }
5558
- };
5559
- VirtualAction.sortActions = function (a, b) {
5560
- if (a.delay === b.delay) {
5561
- if (a.index === b.index) {
5562
- return 0;
5563
- }
5564
- else if (a.index > b.index) {
5565
- return 1;
5566
- }
5567
- else {
5568
- return -1;
5569
- }
5570
- }
5571
- else if (a.delay > b.delay) {
5572
- return 1;
5573
- }
5574
- else {
5575
- return -1;
5576
- }
5577
- };
5578
- return VirtualAction;
5579
- }(AsyncAction));
5580
-
5581
- new Observable(function (subscriber) { return subscriber.complete(); });
5582
-
5583
- var NotificationKind;
5584
- (function (NotificationKind) {
5585
- NotificationKind["NEXT"] = "N";
5586
- NotificationKind["ERROR"] = "E";
5587
- NotificationKind["COMPLETE"] = "C";
5588
- })(NotificationKind || (NotificationKind = {}));
5589
-
5590
- createErrorClass(function (_super) { return function EmptyErrorImpl() {
5591
- _super(this);
5592
- this.name = 'EmptyError';
5593
- this.message = 'no elements in sequence';
5594
- }; });
5595
-
5596
- createErrorClass(function (_super) {
5597
- return function ArgumentOutOfRangeErrorImpl() {
5598
- _super(this);
5599
- this.name = 'ArgumentOutOfRangeError';
5600
- this.message = 'argument out of range';
5601
- };
5602
- });
5603
-
5604
- createErrorClass(function (_super) {
5605
- return function NotFoundErrorImpl(message) {
5606
- _super(this);
5607
- this.name = 'NotFoundError';
5608
- this.message = message;
5609
- };
5610
- });
5611
-
5612
- createErrorClass(function (_super) {
5613
- return function SequenceErrorImpl(message) {
5614
- _super(this);
5615
- this.name = 'SequenceError';
5616
- this.message = message;
5617
- };
5618
- });
5619
-
5620
- createErrorClass(function (_super) {
5621
- return function TimeoutErrorImpl(info) {
5622
- if (info === void 0) { info = null; }
5623
- _super(this);
5624
- this.message = 'Timeout has occurred';
5625
- this.name = 'TimeoutError';
5626
- this.info = info;
5627
- };
5628
- });
5629
-
5630
- new Observable(noop);
5631
-
5632
- class ObservableFiniteStateMachine extends FiniteStateMachine {
5633
- constructor() {
5634
- super(...arguments);
5635
- this.stateChanges = new Subject();
5636
- }
5637
- get [Symbol.toStringTag]() {
5638
- return this.constructor.name;
5639
- }
5640
- observeStateChanges() {
5641
- return this.stateChanges;
5642
- }
5643
- /**
5644
- * @throws {BadEventError}
5645
- */
5646
- send(event) {
5647
- const oldState = this.state;
5648
- super.send(event);
5649
- const newState = this.state;
5650
- this.stateChanges.next({ event, oldState, newState });
5651
- if (es2018$7.isEmptyObject(this.schema[newState])) {
5652
- this.stateChanges.complete();
5653
- }
5654
- }
5655
- }
5656
-
5657
4031
  class SparseSet {
5658
4032
  constructor(array = []) {
5659
4033
  this.indexToValue = [];
@@ -6434,17 +4808,14 @@
6434
4808
  }
6435
4809
  }
6436
4810
 
6437
- exports.BadEventError = BadEventError;
6438
4811
  exports.BitSet = BitSet;
6439
4812
  exports.Box = Box;
6440
4813
  exports.DynamicTypedArray = DynamicTypedArray;
6441
4814
  exports.Emitter = Emitter;
6442
4815
  exports.ExpirableMap = ExpirableMap;
6443
- exports.FiniteStateMachine = FiniteStateMachine;
6444
4816
  exports.HashMap = HashMap;
6445
4817
  exports.HashSet = HashSet;
6446
4818
  exports.LRUMap = LRUMap;
6447
- exports.ObservableFiniteStateMachine = ObservableFiniteStateMachine;
6448
4819
  exports.Queue = Queue;
6449
4820
  exports.SortedSet = SortedSet;
6450
4821
  exports.SparseMap = SparseMap;