@blackglory/structures 0.2.5 → 0.3.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 (55) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/README.md +50 -13
  3. package/dist/es2015/index.min.mjs +16 -2
  4. package/dist/es2015/index.min.mjs.map +1 -1
  5. package/dist/es2015/index.mjs +1661 -488
  6. package/dist/es2015/index.mjs.map +1 -1
  7. package/dist/es2015/index.umd.js +1666 -489
  8. package/dist/es2015/index.umd.js.map +1 -1
  9. package/dist/es2015/index.umd.min.js +15 -2
  10. package/dist/es2015/index.umd.min.js.map +1 -1
  11. package/dist/es2018/index.min.mjs +16 -2
  12. package/dist/es2018/index.min.mjs.map +1 -1
  13. package/dist/es2018/index.mjs +1661 -488
  14. package/dist/es2018/index.mjs.map +1 -1
  15. package/dist/es2018/index.umd.js +1666 -489
  16. package/dist/es2018/index.umd.js.map +1 -1
  17. package/dist/es2018/index.umd.min.js +15 -2
  18. package/dist/es2018/index.umd.min.js.map +1 -1
  19. package/lib/es2015/box.d.ts +6 -0
  20. package/lib/es2015/box.js +30 -0
  21. package/lib/es2015/box.js.map +1 -0
  22. package/lib/es2015/expirable-map.d.ts +4 -4
  23. package/lib/es2015/expirable-map.js +38 -38
  24. package/lib/es2015/expirable-map.js.map +1 -1
  25. package/lib/es2015/finite-state-machine.d.ts +13 -0
  26. package/lib/es2015/finite-state-machine.js +46 -0
  27. package/lib/es2015/finite-state-machine.js.map +1 -0
  28. package/lib/es2015/index.d.ts +3 -0
  29. package/lib/es2015/index.js +3 -0
  30. package/lib/es2015/index.js.map +1 -1
  31. package/lib/es2015/observable-finite-state-machine.d.ts +13 -0
  32. package/lib/es2015/observable-finite-state-machine.js +28 -0
  33. package/lib/es2015/observable-finite-state-machine.js.map +1 -0
  34. package/lib/es2015/tlru-map.d.ts +4 -4
  35. package/lib/es2015/tlru-map.js +36 -36
  36. package/lib/es2015/tlru-map.js.map +1 -1
  37. package/lib/es2018/box.d.ts +6 -0
  38. package/lib/es2018/box.js +30 -0
  39. package/lib/es2018/box.js.map +1 -0
  40. package/lib/es2018/expirable-map.d.ts +4 -4
  41. package/lib/es2018/expirable-map.js +38 -38
  42. package/lib/es2018/expirable-map.js.map +1 -1
  43. package/lib/es2018/finite-state-machine.d.ts +13 -0
  44. package/lib/es2018/finite-state-machine.js +46 -0
  45. package/lib/es2018/finite-state-machine.js.map +1 -0
  46. package/lib/es2018/index.d.ts +3 -0
  47. package/lib/es2018/index.js +3 -0
  48. package/lib/es2018/index.js.map +1 -1
  49. package/lib/es2018/observable-finite-state-machine.d.ts +13 -0
  50. package/lib/es2018/observable-finite-state-machine.js +28 -0
  51. package/lib/es2018/observable-finite-state-machine.js.map +1 -0
  52. package/lib/es2018/tlru-map.d.ts +4 -4
  53. package/lib/es2018/tlru-map.js +36 -36
  54. package/lib/es2018/tlru-map.js.map +1 -1
  55. package/package.json +26 -24
@@ -1,12 +1,3 @@
1
- function convertConsToArray([value, next]) {
2
- if (next === null)
3
- return [value];
4
- return [value, ...convertConsToArray(next)];
5
- }
6
- function convertArrayToCons([value, ...next]) {
7
- return [value, next.length ? convertArrayToCons(next) : null];
8
- }
9
-
10
1
  /*! *****************************************************************************
11
2
  Copyright (c) Microsoft Corporation.
12
3
 
@@ -35,6 +26,30 @@ function __classPrivateFieldSet(receiver, state, value, kind, f) {
35
26
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
36
27
  }
37
28
 
29
+ var _Box_value;
30
+ class Box {
31
+ constructor(value) {
32
+ _Box_value.set(this, void 0);
33
+ __classPrivateFieldSet(this, _Box_value, value, "f");
34
+ }
35
+ set(value) {
36
+ __classPrivateFieldSet(this, _Box_value, value, "f");
37
+ }
38
+ get() {
39
+ return __classPrivateFieldGet(this, _Box_value, "f");
40
+ }
41
+ }
42
+ _Box_value = new WeakMap();
43
+
44
+ function convertConsToArray([value, next]) {
45
+ if (next === null)
46
+ return [value];
47
+ return [value, ...convertConsToArray(next)];
48
+ }
49
+ function convertArrayToCons([value, ...next]) {
50
+ return [value, next.length ? convertArrayToCons(next) : null];
51
+ }
52
+
38
53
  var _Emitter_map;
39
54
  class Emitter {
40
55
  constructor() {
@@ -163,7 +178,7 @@ class Queue {
163
178
 
164
179
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
165
180
 
166
- var es2018$4 = {};
181
+ var es2018$6 = {};
167
182
 
168
183
  var customError = {};
169
184
 
@@ -241,15 +256,15 @@ __exportStar(normalize$1, exports);
241
256
  __exportStar(refute$1, exports);
242
257
  __exportStar(assert$1, exports);
243
258
 
244
- }(es2018$4));
259
+ }(es2018$6));
245
260
 
246
- var es2018$3 = {};
261
+ var es2018$5 = {};
247
262
 
248
263
  var middleware = {};
249
264
 
250
265
  var chunkAsync$1 = {};
251
266
 
252
- var es2018$2 = {};
267
+ var es2018$4 = {};
253
268
 
254
269
  var go$1 = {};
255
270
 
@@ -271,15 +286,15 @@ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m
271
286
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
272
287
  };__exportStar(go$1, exports);
273
288
 
274
- }(es2018$2));
289
+ }(es2018$4));
275
290
 
276
291
  chunkAsync$1.chunkAsync = void 0;
277
- const go_1$f = es2018$2;
278
- const errors_1$f = es2018$4;
292
+ const go_1$f = es2018$4;
293
+ const errors_1$f = es2018$6;
279
294
  function chunkAsync(iterable, size) {
280
- errors_1$f.assert(Number.isInteger(size), 'The parameter size must be an integer');
281
- errors_1$f.assert(size > 0, 'The parameter size must be greater than 0');
282
- return go_1$f.go(async function* () {
295
+ (0, errors_1$f.assert)(Number.isInteger(size), 'The parameter size must be an integer');
296
+ (0, errors_1$f.assert)(size > 0, 'The parameter size must be greater than 0');
297
+ return (0, go_1$f.go)(async function* () {
283
298
  let buffer = [];
284
299
  for await (const element of iterable) {
285
300
  buffer.push(element);
@@ -296,285 +311,297 @@ chunkAsync$1.chunkAsync = chunkAsync;
296
311
 
297
312
  var chunkByAsync$1 = {};
298
313
 
299
- var es2018$1 = {};
314
+ var es2018$3 = {};
300
315
 
301
- var array = {};
316
+ var array$1 = {};
302
317
 
303
- array.isntEmptyArray = array.isEmptyArray = array.isntArray = array.isArray = void 0;
304
- function isArray(val) {
318
+ array$1.isntEmptyArray = array$1.isEmptyArray = array$1.isntArray = array$1.isArray = void 0;
319
+ function isArray$1(val) {
305
320
  return Array.isArray(val);
306
321
  }
307
- array.isArray = isArray;
308
- function isntArray(val) {
309
- return !isArray(val);
322
+ array$1.isArray = isArray$1;
323
+ function isntArray$1(val) {
324
+ return !isArray$1(val);
310
325
  }
311
- array.isntArray = isntArray;
312
- function isEmptyArray(val) {
326
+ array$1.isntArray = isntArray$1;
327
+ function isEmptyArray$1(val) {
313
328
  return val.length === 0;
314
329
  }
315
- array.isEmptyArray = isEmptyArray;
316
- function isntEmptyArray(val) {
330
+ array$1.isEmptyArray = isEmptyArray$1;
331
+ function isntEmptyArray$1(val) {
317
332
  return val.length !== 0;
318
333
  }
319
- array.isntEmptyArray = isntEmptyArray;
334
+ array$1.isntEmptyArray = isntEmptyArray$1;
320
335
 
321
- var asyncIterable = {};
336
+ var asyncIterable$1 = {};
322
337
 
323
- var _null = {};
338
+ var _null$1 = {};
324
339
 
325
- _null.isntNull = _null.isNull = void 0;
326
- function isNull(val) {
340
+ _null$1.isntNull = _null$1.isNull = void 0;
341
+ function isNull$1(val) {
327
342
  return val === null;
328
343
  }
329
- _null.isNull = isNull;
330
- function isntNull(val) {
331
- return !isNull(val);
344
+ _null$1.isNull = isNull$1;
345
+ function isntNull$1(val) {
346
+ return !isNull$1(val);
332
347
  }
333
- _null.isntNull = isntNull;
348
+ _null$1.isntNull = isntNull$1;
334
349
 
335
- var _undefined = {};
350
+ var _undefined$1 = {};
336
351
 
337
- _undefined.isntUndefined = _undefined.isUndefined = void 0;
338
- function isUndefined(val) {
352
+ _undefined$1.isntUndefined = _undefined$1.isUndefined = void 0;
353
+ function isUndefined$1(val) {
339
354
  return val === undefined;
340
355
  }
341
- _undefined.isUndefined = isUndefined;
342
- function isntUndefined(val) {
343
- return !isUndefined(val);
356
+ _undefined$1.isUndefined = isUndefined$1;
357
+ function isntUndefined$1(val) {
358
+ return !isUndefined$1(val);
344
359
  }
345
- _undefined.isntUndefined = isntUndefined;
360
+ _undefined$1.isntUndefined = isntUndefined$1;
346
361
 
347
- asyncIterable.isntAsyncIterable = asyncIterable.isAsyncIterable = void 0;
348
- const null_1$1 = _null;
349
- const undefined_1$2 = _undefined;
350
- function isAsyncIterable(val) {
351
- return null_1$1.isntNull(val)
352
- && undefined_1$2.isntUndefined(val)
362
+ asyncIterable$1.isntAsyncIterable = asyncIterable$1.isAsyncIterable = void 0;
363
+ const null_1$3 = _null$1;
364
+ const undefined_1$5 = _undefined$1;
365
+ function isAsyncIterable$1(val) {
366
+ return (0, null_1$3.isntNull)(val)
367
+ && (0, undefined_1$5.isntUndefined)(val)
353
368
  && typeof val[Symbol.asyncIterator] === 'function';
354
369
  }
355
- asyncIterable.isAsyncIterable = isAsyncIterable;
356
- function isntAsyncIterable(val) {
357
- return !isAsyncIterable(val);
370
+ asyncIterable$1.isAsyncIterable = isAsyncIterable$1;
371
+ function isntAsyncIterable$1(val) {
372
+ return !isAsyncIterable$1(val);
358
373
  }
359
- asyncIterable.isntAsyncIterable = isntAsyncIterable;
374
+ asyncIterable$1.isntAsyncIterable = isntAsyncIterable$1;
360
375
 
361
- var bigint = {};
376
+ var bigint$1 = {};
362
377
 
363
- bigint.isntBigInt = bigint.isBigInt = void 0;
364
- function isBigInt(val) {
378
+ bigint$1.isntBigInt = bigint$1.isBigInt = void 0;
379
+ function isBigInt$1(val) {
365
380
  return typeof val === 'bigint';
366
381
  }
367
- bigint.isBigInt = isBigInt;
368
- function isntBigInt(val) {
369
- return !isBigInt(val);
382
+ bigint$1.isBigInt = isBigInt$1;
383
+ function isntBigInt$1(val) {
384
+ return !isBigInt$1(val);
370
385
  }
371
- bigint.isntBigInt = isntBigInt;
386
+ bigint$1.isntBigInt = isntBigInt$1;
372
387
 
373
- var boolean = {};
388
+ var boolean$1 = {};
374
389
 
375
- boolean.isntBoolean = boolean.isBoolean = void 0;
376
- function isBoolean(val) {
390
+ boolean$1.isntBoolean = boolean$1.isBoolean = void 0;
391
+ function isBoolean$1(val) {
377
392
  return typeof val === 'boolean';
378
393
  }
379
- boolean.isBoolean = isBoolean;
380
- function isntBoolean(val) {
381
- return !isBoolean(val);
394
+ boolean$1.isBoolean = isBoolean$1;
395
+ function isntBoolean$1(val) {
396
+ return !isBoolean$1(val);
382
397
  }
383
- boolean.isntBoolean = isntBoolean;
398
+ boolean$1.isntBoolean = isntBoolean$1;
384
399
 
385
- var char = {};
400
+ var char$1 = {};
386
401
 
387
- var string = {};
402
+ var string$1 = {};
388
403
 
389
- string.isntString = string.isString = void 0;
390
- function isString(val) {
404
+ string$1.isntString = string$1.isString = void 0;
405
+ function isString$1(val) {
391
406
  return typeof val === 'string';
392
407
  }
393
- string.isString = isString;
394
- function isntString(val) {
395
- return !isString(val);
408
+ string$1.isString = isString$1;
409
+ function isntString$1(val) {
410
+ return !isString$1(val);
396
411
  }
397
- string.isntString = isntString;
412
+ string$1.isntString = isntString$1;
398
413
 
399
- char.isntChar = char.isChar = void 0;
400
- const string_1$1 = string;
401
- function isChar(val) {
402
- return string_1$1.isString(val)
414
+ char$1.isntChar = char$1.isChar = void 0;
415
+ const string_1$3 = string$1;
416
+ function isChar$1(val) {
417
+ return (0, string_1$3.isString)(val)
403
418
  && val.length === 1;
404
419
  }
405
- char.isChar = isChar;
406
- function isntChar(val) {
407
- return !isChar(val);
420
+ char$1.isChar = isChar$1;
421
+ function isntChar$1(val) {
422
+ return !isChar$1(val);
408
423
  }
409
- char.isntChar = isntChar;
424
+ char$1.isntChar = isntChar$1;
410
425
 
411
- var date = {};
426
+ var date$1 = {};
412
427
 
413
- date.isntDate = date.isDate = void 0;
414
- function isDate(val) {
428
+ date$1.isntDate = date$1.isDate = void 0;
429
+ function isDate$1(val) {
415
430
  return val instanceof Date;
416
431
  }
417
- date.isDate = isDate;
418
- function isntDate(val) {
419
- return !isDate(val);
432
+ date$1.isDate = isDate$1;
433
+ function isntDate$1(val) {
434
+ return !isDate$1(val);
420
435
  }
421
- date.isntDate = isntDate;
436
+ date$1.isntDate = isntDate$1;
422
437
 
423
- var _enum = {};
438
+ var _enum$1 = {};
424
439
 
425
- _enum.inEnum = void 0;
426
- function inEnum(val, _enum) {
440
+ _enum$1.inEnum = void 0;
441
+ function inEnum$1(val, _enum) {
427
442
  return Object.values(_enum).includes(val);
428
443
  }
429
- _enum.inEnum = inEnum;
444
+ _enum$1.inEnum = inEnum$1;
430
445
 
431
- var falsy = {};
446
+ var error$1 = {};
432
447
 
433
- falsy.isntFalsy = falsy.isFalsy = void 0;
434
- function isFalsy(val) {
448
+ error$1.isntError = error$1.isError = void 0;
449
+ function isError$1(val) {
450
+ return val instanceof Error;
451
+ }
452
+ error$1.isError = isError$1;
453
+ function isntError$1(val) {
454
+ return !isError$1(val);
455
+ }
456
+ error$1.isntError = isntError$1;
457
+
458
+ var falsy$1 = {};
459
+
460
+ falsy$1.isntFalsy = falsy$1.isFalsy = void 0;
461
+ function isFalsy$1(val) {
435
462
  return !val;
436
463
  }
437
- falsy.isFalsy = isFalsy;
438
- function isntFalsy(val) {
439
- return !isFalsy(val);
464
+ falsy$1.isFalsy = isFalsy$1;
465
+ function isntFalsy$1(val) {
466
+ return !isFalsy$1(val);
440
467
  }
441
- falsy.isntFalsy = isntFalsy;
468
+ falsy$1.isntFalsy = isntFalsy$1;
442
469
 
443
- var _function = {};
470
+ var _function$1 = {};
444
471
 
445
- _function.isntFunction = _function.isFunction = void 0;
446
- function isFunction(val) {
472
+ _function$1.isntFunction = _function$1.isFunction = void 0;
473
+ function isFunction$2(val) {
447
474
  return typeof val === 'function';
448
475
  }
449
- _function.isFunction = isFunction;
450
- function isntFunction(val) {
451
- return !isFunction(val);
476
+ _function$1.isFunction = isFunction$2;
477
+ function isntFunction$1(val) {
478
+ return !isFunction$2(val);
452
479
  }
453
- _function.isntFunction = isntFunction;
480
+ _function$1.isntFunction = isntFunction$1;
454
481
 
455
- var iterable = {};
482
+ var iterable$1 = {};
456
483
 
457
- iterable.isntIterable = iterable.isIterable = void 0;
458
- const null_1 = _null;
459
- const undefined_1$1 = _undefined;
460
- function isIterable(val) {
461
- return null_1.isntNull(val)
462
- && undefined_1$1.isntUndefined(val)
484
+ iterable$1.isntIterable = iterable$1.isIterable = void 0;
485
+ const null_1$2 = _null$1;
486
+ const undefined_1$4 = _undefined$1;
487
+ function isIterable$1(val) {
488
+ return (0, null_1$2.isntNull)(val)
489
+ && (0, undefined_1$4.isntUndefined)(val)
463
490
  && typeof val[Symbol.iterator] === 'function';
464
491
  }
465
- iterable.isIterable = isIterable;
466
- function isntIterable(val) {
467
- return !isIterable(val);
492
+ iterable$1.isIterable = isIterable$1;
493
+ function isntIterable$1(val) {
494
+ return !isIterable$1(val);
468
495
  }
469
- iterable.isntIterable = isntIterable;
496
+ iterable$1.isntIterable = isntIterable$1;
470
497
 
471
- var jsonRpc = {};
498
+ var jsonRpc$1 = {};
472
499
 
473
- var object = {};
500
+ var object$1 = {};
474
501
 
475
- object.isntEmptyObject = object.isEmptyObject = object.isRecord = object.isntObject = object.isObject = void 0;
476
- function isObject(val) {
502
+ object$1.isntEmptyObject = object$1.isEmptyObject = object$1.isRecord = object$1.isntObject = object$1.isObject = void 0;
503
+ function isObject$1(val) {
477
504
  return val !== null && typeof val === 'object';
478
505
  }
479
- object.isObject = isObject;
480
- function isntObject(val) {
481
- return !isObject(val);
506
+ object$1.isObject = isObject$1;
507
+ function isntObject$1(val) {
508
+ return !isObject$1(val);
482
509
  }
483
- object.isntObject = isntObject;
484
- function isRecord(val) {
485
- return isObject(val);
510
+ object$1.isntObject = isntObject$1;
511
+ function isRecord$1(val) {
512
+ return isObject$1(val);
486
513
  }
487
- object.isRecord = isRecord;
488
- function isEmptyObject(val) {
514
+ object$1.isRecord = isRecord$1;
515
+ function isEmptyObject$1(val) {
489
516
  return Object.keys(val).length === 0;
490
517
  }
491
- object.isEmptyObject = isEmptyObject;
492
- function isntEmptyObject(val) {
518
+ object$1.isEmptyObject = isEmptyObject$1;
519
+ function isntEmptyObject$1(val) {
493
520
  return Object.keys(val).length !== 0;
494
521
  }
495
- object.isntEmptyObject = isntEmptyObject;
522
+ object$1.isntEmptyObject = isntEmptyObject$1;
496
523
 
497
- var number = {};
524
+ var number$1 = {};
498
525
 
499
- number.isntNumber = number.isNumber = void 0;
500
- function isNumber(val) {
526
+ number$1.isntNumber = number$1.isNumber = void 0;
527
+ function isNumber$1(val) {
501
528
  return typeof val === 'number';
502
529
  }
503
- number.isNumber = isNumber;
504
- function isntNumber(val) {
505
- return !isNumber(val);
506
- }
507
- number.isntNumber = isntNumber;
508
-
509
- jsonRpc.isntJsonRpcError = jsonRpc.isJsonRpcError = jsonRpc.isntJsonRpcSuccess = jsonRpc.isJsonRpcSuccess = jsonRpc.isntJsonRpcRequest = jsonRpc.isJsonRpcRequest = jsonRpc.isntJsonRpcNotification = jsonRpc.isJsonRpcNotification = void 0;
510
- const array_1 = array;
511
- const object_1 = object;
512
- const string_1 = string;
513
- const number_1 = number;
514
- const undefined_1 = _undefined;
515
- function isJsonRpcId(val) {
516
- return string_1.isString(val) || number_1.isNumber(val);
517
- }
518
- function isJsonRpcParams(val) {
519
- return array_1.isArray(val) || object_1.isObject(val);
520
- }
521
- function isJsonRpcNotification(val) {
522
- return object_1.isRecord(val)
523
- && string_1.isString(val.jsonrpc)
524
- && string_1.isString(val.method)
525
- && undefined_1.isUndefined(val.id)
526
- && isJsonRpcParams(val.params);
527
- }
528
- jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
529
- function isntJsonRpcNotification(val) {
530
- return !isJsonRpcNotification(val);
531
- }
532
- jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
533
- function isJsonRpcRequest(val) {
534
- return object_1.isRecord(val)
535
- && string_1.isString(val.jsonrpc)
536
- && string_1.isString(val.method)
537
- && isJsonRpcId(val.id)
538
- && isJsonRpcParams(val.params);
539
- }
540
- jsonRpc.isJsonRpcRequest = isJsonRpcRequest;
541
- function isntJsonRpcRequest(val) {
542
- return !isJsonRpcRequest(val);
543
- }
544
- jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
545
- function isJsonRpcSuccess(val) {
546
- return object_1.isRecord(val)
547
- && string_1.isString(val.jsonrpc)
548
- && string_1.isString(val.id)
549
- && undefined_1.isntUndefined(val.result);
550
- }
551
- jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
552
- function isntJsonRpcSuccess(val) {
553
- return !isJsonRpcSuccess(val);
554
- }
555
- jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
556
- function isJsonRpcError(val) {
557
- return object_1.isRecord(val)
558
- && string_1.isString(val.jsonrpc)
559
- && isJsonRpcId(val.id)
560
- && isJsonRpcErrorObject(val.error);
561
- }
562
- jsonRpc.isJsonRpcError = isJsonRpcError;
563
- function isntJsonRpcError(val) {
564
- return !isJsonRpcError(val);
565
- }
566
- jsonRpc.isntJsonRpcError = isntJsonRpcError;
567
- function isJsonRpcErrorObject(val) {
568
- return object_1.isRecord(val)
569
- && number_1.isNumber(val.code)
570
- && string_1.isString(val.message)
571
- && (undefined_1.isUndefined(val.data) || object_1.isObject(val.data));
572
- }
573
-
574
- var json = {};
575
-
576
- json.isntJson = json.isJson = void 0;
577
- function isJson(val) {
530
+ number$1.isNumber = isNumber$1;
531
+ function isntNumber$1(val) {
532
+ return !isNumber$1(val);
533
+ }
534
+ number$1.isntNumber = isntNumber$1;
535
+
536
+ jsonRpc$1.isntJsonRpcError = jsonRpc$1.isJsonRpcError = jsonRpc$1.isntJsonRpcSuccess = jsonRpc$1.isJsonRpcSuccess = jsonRpc$1.isntJsonRpcRequest = jsonRpc$1.isJsonRpcRequest = jsonRpc$1.isntJsonRpcNotification = jsonRpc$1.isJsonRpcNotification = void 0;
537
+ const array_1$1 = array$1;
538
+ const object_1$1 = object$1;
539
+ const string_1$2 = string$1;
540
+ const number_1$1 = number$1;
541
+ const undefined_1$3 = _undefined$1;
542
+ function isJsonRpcId$1(val) {
543
+ return (0, string_1$2.isString)(val) || (0, number_1$1.isNumber)(val);
544
+ }
545
+ function isJsonRpcParams$1(val) {
546
+ return (0, array_1$1.isArray)(val) || (0, object_1$1.isObject)(val);
547
+ }
548
+ function isJsonRpcNotification$1(val) {
549
+ return (0, object_1$1.isRecord)(val)
550
+ && (0, string_1$2.isString)(val.jsonrpc)
551
+ && (0, string_1$2.isString)(val.method)
552
+ && (0, undefined_1$3.isUndefined)(val.id)
553
+ && isJsonRpcParams$1(val.params);
554
+ }
555
+ jsonRpc$1.isJsonRpcNotification = isJsonRpcNotification$1;
556
+ function isntJsonRpcNotification$1(val) {
557
+ return !isJsonRpcNotification$1(val);
558
+ }
559
+ jsonRpc$1.isntJsonRpcNotification = isntJsonRpcNotification$1;
560
+ function isJsonRpcRequest$1(val) {
561
+ return (0, object_1$1.isRecord)(val)
562
+ && (0, string_1$2.isString)(val.jsonrpc)
563
+ && (0, string_1$2.isString)(val.method)
564
+ && isJsonRpcId$1(val.id)
565
+ && isJsonRpcParams$1(val.params);
566
+ }
567
+ jsonRpc$1.isJsonRpcRequest = isJsonRpcRequest$1;
568
+ function isntJsonRpcRequest$1(val) {
569
+ return !isJsonRpcRequest$1(val);
570
+ }
571
+ jsonRpc$1.isntJsonRpcRequest = isntJsonRpcRequest$1;
572
+ function isJsonRpcSuccess$1(val) {
573
+ return (0, object_1$1.isRecord)(val)
574
+ && (0, string_1$2.isString)(val.jsonrpc)
575
+ && (0, string_1$2.isString)(val.id)
576
+ && (0, undefined_1$3.isntUndefined)(val.result);
577
+ }
578
+ jsonRpc$1.isJsonRpcSuccess = isJsonRpcSuccess$1;
579
+ function isntJsonRpcSuccess$1(val) {
580
+ return !isJsonRpcSuccess$1(val);
581
+ }
582
+ jsonRpc$1.isntJsonRpcSuccess = isntJsonRpcSuccess$1;
583
+ function isJsonRpcError$1(val) {
584
+ return (0, object_1$1.isRecord)(val)
585
+ && (0, string_1$2.isString)(val.jsonrpc)
586
+ && isJsonRpcId$1(val.id)
587
+ && isJsonRpcErrorObject$1(val.error);
588
+ }
589
+ jsonRpc$1.isJsonRpcError = isJsonRpcError$1;
590
+ function isntJsonRpcError$1(val) {
591
+ return !isJsonRpcError$1(val);
592
+ }
593
+ jsonRpc$1.isntJsonRpcError = isntJsonRpcError$1;
594
+ function isJsonRpcErrorObject$1(val) {
595
+ return (0, object_1$1.isRecord)(val)
596
+ && (0, number_1$1.isNumber)(val.code)
597
+ && (0, string_1$2.isString)(val.message)
598
+ && ((0, undefined_1$3.isUndefined)(val.data) || (0, object_1$1.isObject)(val.data));
599
+ }
600
+
601
+ var json$1 = {};
602
+
603
+ json$1.isntJson = json$1.isJson = void 0;
604
+ function isJson$1(val) {
578
605
  try {
579
606
  JSON.stringify(val);
580
607
  return true;
@@ -583,16 +610,16 @@ function isJson(val) {
583
610
  return false;
584
611
  }
585
612
  }
586
- json.isJson = isJson;
587
- function isntJson(val) {
588
- return !isntJson();
613
+ json$1.isJson = isJson$1;
614
+ function isntJson$1(val) {
615
+ return !isntJson$1();
589
616
  }
590
- json.isntJson = isntJson;
617
+ json$1.isntJson = isntJson$1;
591
618
 
592
- var url = {};
619
+ var url$1 = {};
593
620
 
594
- url.isAbsoluteURL = void 0;
595
- function isAbsoluteURL(str) {
621
+ url$1.isAbsoluteURL = void 0;
622
+ function isAbsoluteURL$1(str) {
596
623
  try {
597
624
  new URL(str);
598
625
  return true;
@@ -601,7 +628,7 @@ function isAbsoluteURL(str) {
601
628
  return false;
602
629
  }
603
630
  }
604
- url.isAbsoluteURL = isAbsoluteURL;
631
+ url$1.isAbsoluteURL = isAbsoluteURL$1;
605
632
 
606
633
  (function (exports) {
607
634
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -613,31 +640,32 @@ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Obj
613
640
  }));
614
641
  var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
615
642
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
616
- };__exportStar(array, exports);
617
- __exportStar(asyncIterable, exports);
618
- __exportStar(bigint, exports);
619
- __exportStar(boolean, exports);
620
- __exportStar(char, exports);
621
- __exportStar(date, exports);
622
- __exportStar(_enum, exports);
623
- __exportStar(falsy, exports);
624
- __exportStar(_function, exports);
625
- __exportStar(iterable, exports);
626
- __exportStar(jsonRpc, exports);
627
- __exportStar(json, exports);
628
- __exportStar(_null, exports);
629
- __exportStar(number, exports);
630
- __exportStar(object, exports);
631
- __exportStar(string, exports);
632
- __exportStar(_undefined, exports);
633
- __exportStar(url, exports);
643
+ };__exportStar(array$1, exports);
644
+ __exportStar(asyncIterable$1, exports);
645
+ __exportStar(bigint$1, exports);
646
+ __exportStar(boolean$1, exports);
647
+ __exportStar(char$1, exports);
648
+ __exportStar(date$1, exports);
649
+ __exportStar(_enum$1, exports);
650
+ __exportStar(error$1, exports);
651
+ __exportStar(falsy$1, exports);
652
+ __exportStar(_function$1, exports);
653
+ __exportStar(iterable$1, exports);
654
+ __exportStar(jsonRpc$1, exports);
655
+ __exportStar(json$1, exports);
656
+ __exportStar(_null$1, exports);
657
+ __exportStar(number$1, exports);
658
+ __exportStar(object$1, exports);
659
+ __exportStar(string$1, exports);
660
+ __exportStar(_undefined$1, exports);
661
+ __exportStar(url$1, exports);
634
662
 
635
- }(es2018$1));
663
+ }(es2018$3));
636
664
 
637
665
  chunkByAsync$1.chunkByAsync = void 0;
638
- const types_1$h = es2018$1;
666
+ const types_1$h = es2018$3;
639
667
  function chunkByAsync(iterable, predicate) {
640
- if (types_1$h.isAsyncIterable(iterable)) {
668
+ if ((0, types_1$h.isAsyncIterable)(iterable)) {
641
669
  return chunkByAsyncIterable(iterable);
642
670
  }
643
671
  else {
@@ -696,12 +724,12 @@ chunkBy$1.chunkBy = chunkBy;
696
724
  var chunk$1 = {};
697
725
 
698
726
  chunk$1.chunk = void 0;
699
- const go_1$e = es2018$2;
700
- const errors_1$e = es2018$4;
727
+ const go_1$e = es2018$4;
728
+ const errors_1$e = es2018$6;
701
729
  function chunk(iterable, size) {
702
- errors_1$e.assert(Number.isInteger(size), 'The parameter size must be an integer');
703
- errors_1$e.assert(size > 0, 'The parameter size must be greater than 0');
704
- return go_1$e.go(function* () {
730
+ (0, errors_1$e.assert)(Number.isInteger(size), 'The parameter size must be an integer');
731
+ (0, errors_1$e.assert)(size > 0, 'The parameter size must be greater than 0');
732
+ return (0, go_1$e.go)(function* () {
705
733
  let buffer = [];
706
734
  for (const element of iterable) {
707
735
  buffer.push(element);
@@ -719,12 +747,12 @@ chunk$1.chunk = chunk;
719
747
  var concatAsync$1 = {};
720
748
 
721
749
  concatAsync$1.concatAsync = void 0;
722
- const types_1$g = es2018$1;
723
- const go_1$d = es2018$2;
750
+ const types_1$g = es2018$3;
751
+ const go_1$d = es2018$4;
724
752
  function concatAsync(iterable, ...otherIterables) {
725
- return go_1$d.go(async function* () {
753
+ return (0, go_1$d.go)(async function* () {
726
754
  for (const iter of [iterable, ...otherIterables]) {
727
- if (types_1$g.isAsyncIterable(iter)) {
755
+ if ((0, types_1$g.isAsyncIterable)(iter)) {
728
756
  for await (const element of iter) {
729
757
  yield element;
730
758
  }
@@ -742,9 +770,9 @@ concatAsync$1.concatAsync = concatAsync;
742
770
  var concat$1 = {};
743
771
 
744
772
  concat$1.concat = void 0;
745
- const go_1$c = es2018$2;
773
+ const go_1$c = es2018$4;
746
774
  function concat(iterable, ...otherIterables) {
747
- return go_1$c.go(function* () {
775
+ return (0, go_1$c.go)(function* () {
748
776
  for (const iter of [iterable, ...otherIterables]) {
749
777
  yield* iter;
750
778
  }
@@ -771,15 +799,15 @@ function* copyIterable(iterable) {
771
799
  utils.copyIterable = copyIterable;
772
800
 
773
801
  dropAsync$1.dropAsync = void 0;
774
- const go_1$b = es2018$2;
802
+ const go_1$b = es2018$4;
775
803
  const utils_1$3 = utils;
776
- const errors_1$d = es2018$4;
804
+ const errors_1$d = es2018$6;
777
805
  function dropAsync(iterable, count) {
778
- errors_1$d.assert(Number.isInteger(count), 'The parameter count must be an integer');
779
- errors_1$d.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
806
+ (0, errors_1$d.assert)(Number.isInteger(count), 'The parameter count must be an integer');
807
+ (0, errors_1$d.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
780
808
  if (count === 0)
781
- return utils_1$3.copyAsyncIterable(iterable);
782
- return go_1$b.go(async function* () {
809
+ return (0, utils_1$3.copyAsyncIterable)(iterable);
810
+ return (0, go_1$b.go)(async function* () {
783
811
  var _a;
784
812
  const iterator = iterable[Symbol.asyncIterator]();
785
813
  let done;
@@ -806,15 +834,15 @@ dropAsync$1.dropAsync = dropAsync;
806
834
  var dropRightAsync$1 = {};
807
835
 
808
836
  dropRightAsync$1.dropRightAsync = void 0;
809
- const go_1$a = es2018$2;
837
+ const go_1$a = es2018$4;
810
838
  const utils_1$2 = utils;
811
- const errors_1$c = es2018$4;
839
+ const errors_1$c = es2018$6;
812
840
  function dropRightAsync(iterable, count) {
813
- errors_1$c.assert(Number.isInteger(count), 'The parameter count must be an integer');
814
- errors_1$c.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
841
+ (0, errors_1$c.assert)(Number.isInteger(count), 'The parameter count must be an integer');
842
+ (0, errors_1$c.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
815
843
  if (count === 0)
816
- return utils_1$2.copyAsyncIterable(iterable);
817
- return go_1$a.go(async function* () {
844
+ return (0, utils_1$2.copyAsyncIterable)(iterable);
845
+ return (0, go_1$a.go)(async function* () {
818
846
  const arr = await toArrayAsync$2(iterable);
819
847
  const result = arr.slice(0, -count);
820
848
  for (const value of result) {
@@ -834,15 +862,15 @@ async function toArrayAsync$2(iterable) {
834
862
  var dropRight$1 = {};
835
863
 
836
864
  dropRight$1.dropRight = void 0;
837
- const go_1$9 = es2018$2;
865
+ const go_1$9 = es2018$4;
838
866
  const utils_1$1 = utils;
839
- const errors_1$b = es2018$4;
867
+ const errors_1$b = es2018$6;
840
868
  function dropRight(iterable, count) {
841
- errors_1$b.assert(Number.isInteger(count), 'The parameter count must be an integer');
842
- errors_1$b.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
869
+ (0, errors_1$b.assert)(Number.isInteger(count), 'The parameter count must be an integer');
870
+ (0, errors_1$b.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
843
871
  if (count === 0)
844
- return utils_1$1.copyIterable(iterable);
845
- return go_1$9.go(function* () {
872
+ return (0, utils_1$1.copyIterable)(iterable);
873
+ return (0, go_1$9.go)(function* () {
846
874
  const arr = Array.from(iterable);
847
875
  yield* arr.slice(0, -count);
848
876
  });
@@ -852,9 +880,9 @@ dropRight$1.dropRight = dropRight;
852
880
  var dropUntilAsync$1 = {};
853
881
 
854
882
  dropUntilAsync$1.dropUntilAsync = void 0;
855
- const types_1$f = es2018$1;
883
+ const types_1$f = es2018$3;
856
884
  function dropUntilAsync(iterable, predicate) {
857
- if (types_1$f.isAsyncIterable(iterable)) {
885
+ if ((0, types_1$f.isAsyncIterable)(iterable)) {
858
886
  return dropUntilAsyncIterable(iterable);
859
887
  }
860
888
  else {
@@ -934,15 +962,15 @@ dropUntil$1.dropUntil = dropUntil;
934
962
  var drop$1 = {};
935
963
 
936
964
  drop$1.drop = void 0;
937
- const go_1$8 = es2018$2;
965
+ const go_1$8 = es2018$4;
938
966
  const utils_1 = utils;
939
- const errors_1$a = es2018$4;
967
+ const errors_1$a = es2018$6;
940
968
  function drop(iterable, count) {
941
- errors_1$a.assert(Number.isInteger(count), 'The parameter count must be an integer');
942
- errors_1$a.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
969
+ (0, errors_1$a.assert)(Number.isInteger(count), 'The parameter count must be an integer');
970
+ (0, errors_1$a.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
943
971
  if (count === 0)
944
- return utils_1.copyIterable(iterable);
945
- return go_1$8.go(function* () {
972
+ return (0, utils_1.copyIterable)(iterable);
973
+ return (0, go_1$8.go)(function* () {
946
974
  var _a;
947
975
  const iterator = iterable[Symbol.iterator]();
948
976
  let done;
@@ -969,9 +997,9 @@ drop$1.drop = drop;
969
997
  var filterAsync$1 = {};
970
998
 
971
999
  filterAsync$1.filterAsync = void 0;
972
- const types_1$e = es2018$1;
1000
+ const types_1$e = es2018$3;
973
1001
  function filterAsync(iterable, predicate) {
974
- if (types_1$e.isAsyncIterable(iterable)) {
1002
+ if ((0, types_1$e.isAsyncIterable)(iterable)) {
975
1003
  return filterAsyncIterable(iterable);
976
1004
  }
977
1005
  else {
@@ -1016,9 +1044,9 @@ var flattenDeepAsync$1 = {};
1016
1044
  var flattenByAsync$1 = {};
1017
1045
 
1018
1046
  flattenByAsync$1.flattenByAsync = void 0;
1019
- const types_1$d = es2018$1;
1047
+ const types_1$d = es2018$3;
1020
1048
  function flattenByAsync(iterable, predicate) {
1021
- if (types_1$d.isAsyncIterable(iterable)) {
1049
+ if ((0, types_1$d.isAsyncIterable)(iterable)) {
1022
1050
  return flattenByAsyncIterable(iterable);
1023
1051
  }
1024
1052
  else {
@@ -1051,30 +1079,30 @@ function flattenByAsync(iterable, predicate) {
1051
1079
  }
1052
1080
  flattenByAsync$1.flattenByAsync = flattenByAsync;
1053
1081
  function isFiniteIterable$1(val) {
1054
- return types_1$d.isIterable(val) && types_1$d.isntChar(val);
1082
+ return (0, types_1$d.isIterable)(val) && (0, types_1$d.isntChar)(val);
1055
1083
  }
1056
1084
 
1057
1085
  flattenDeepAsync$1.flattenDeepAsync = void 0;
1058
1086
  const flatten_by_async_1 = flattenByAsync$1;
1059
- const errors_1$9 = es2018$4;
1087
+ const errors_1$9 = es2018$6;
1060
1088
  function flattenDeepAsync(iterable, depth = Infinity) {
1061
- errors_1$9.assert(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1062
- errors_1$9.assert(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1063
- return flatten_by_async_1.flattenByAsync(iterable, (_, level) => level <= depth);
1089
+ (0, errors_1$9.assert)(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1090
+ (0, errors_1$9.assert)(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1091
+ return (0, flatten_by_async_1.flattenByAsync)(iterable, (_, level) => level <= depth);
1064
1092
  }
1065
1093
  flattenDeepAsync$1.flattenDeepAsync = flattenDeepAsync;
1066
1094
 
1067
1095
  flattenAsync$1.flattenAsync = void 0;
1068
1096
  const flatten_deep_async_1 = flattenDeepAsync$1;
1069
1097
  function flattenAsync(iterable) {
1070
- return flatten_deep_async_1.flattenDeepAsync(iterable, 1);
1098
+ return (0, flatten_deep_async_1.flattenDeepAsync)(iterable, 1);
1071
1099
  }
1072
1100
  flattenAsync$1.flattenAsync = flattenAsync;
1073
1101
 
1074
1102
  var flattenBy$1 = {};
1075
1103
 
1076
1104
  flattenBy$1.flattenBy = void 0;
1077
- const types_1$c = es2018$1;
1105
+ const types_1$c = es2018$3;
1078
1106
  function flattenBy(iterable, predicate) {
1079
1107
  return flatten(iterable, 1);
1080
1108
  function* flatten(iterable, level) {
@@ -1090,18 +1118,18 @@ function flattenBy(iterable, predicate) {
1090
1118
  }
1091
1119
  flattenBy$1.flattenBy = flattenBy;
1092
1120
  function isFiniteIterable(val) {
1093
- return types_1$c.isIterable(val) && types_1$c.isntChar(val);
1121
+ return (0, types_1$c.isIterable)(val) && (0, types_1$c.isntChar)(val);
1094
1122
  }
1095
1123
 
1096
1124
  var flattenDeep$1 = {};
1097
1125
 
1098
1126
  flattenDeep$1.flattenDeep = void 0;
1099
1127
  const flatten_by_1 = flattenBy$1;
1100
- const errors_1$8 = es2018$4;
1128
+ const errors_1$8 = es2018$6;
1101
1129
  function flattenDeep(iterable, depth = Infinity) {
1102
- errors_1$8.assert(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1103
- errors_1$8.assert(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1104
- return flatten_by_1.flattenBy(iterable, (_, level) => level <= depth);
1130
+ (0, errors_1$8.assert)(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1131
+ (0, errors_1$8.assert)(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1132
+ return (0, flatten_by_1.flattenBy)(iterable, (_, level) => level <= depth);
1105
1133
  }
1106
1134
  flattenDeep$1.flattenDeep = flattenDeep;
1107
1135
 
@@ -1110,16 +1138,16 @@ var flatten$1 = {};
1110
1138
  flatten$1.flatten = void 0;
1111
1139
  const flatten_deep_1 = flattenDeep$1;
1112
1140
  function flatten(iterable) {
1113
- return flatten_deep_1.flattenDeep(iterable, 1);
1141
+ return (0, flatten_deep_1.flattenDeep)(iterable, 1);
1114
1142
  }
1115
1143
  flatten$1.flatten = flatten;
1116
1144
 
1117
1145
  var mapAsync$1 = {};
1118
1146
 
1119
1147
  mapAsync$1.mapAsync = void 0;
1120
- const types_1$b = es2018$1;
1148
+ const types_1$b = es2018$3;
1121
1149
  function mapAsync(iterable, fn) {
1122
- if (types_1$b.isAsyncIterable(iterable)) {
1150
+ if ((0, types_1$b.isAsyncIterable)(iterable)) {
1123
1151
  return mapAsyncIterable(iterable);
1124
1152
  }
1125
1153
  else {
@@ -1157,14 +1185,14 @@ map$1.map = map;
1157
1185
  var repeatAsync$1 = {};
1158
1186
 
1159
1187
  repeatAsync$1.repeatAsync = void 0;
1160
- const go_1$7 = es2018$2;
1161
- const errors_1$7 = es2018$4;
1188
+ const go_1$7 = es2018$4;
1189
+ const errors_1$7 = es2018$6;
1162
1190
  function repeatAsync(iterable, times) {
1163
- errors_1$7.assert(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1164
- errors_1$7.assert(times >= 0, 'The parameter times must be greater than or equal to 0');
1191
+ (0, errors_1$7.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1192
+ (0, errors_1$7.assert)(times >= 0, 'The parameter times must be greater than or equal to 0');
1165
1193
  if (times === Infinity)
1166
1194
  warnInfiniteLoop$1();
1167
- return go_1$7.go(async function* () {
1195
+ return (0, go_1$7.go)(async function* () {
1168
1196
  const cache = [];
1169
1197
  if (times > 0) {
1170
1198
  for await (const element of iterable) {
@@ -1192,14 +1220,14 @@ function isProduction$1() {
1192
1220
  var repeat$1 = {};
1193
1221
 
1194
1222
  repeat$1.repeat = void 0;
1195
- const go_1$6 = es2018$2;
1196
- const errors_1$6 = es2018$4;
1223
+ const go_1$6 = es2018$4;
1224
+ const errors_1$6 = es2018$6;
1197
1225
  function repeat(iterable, times) {
1198
- errors_1$6.assert(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1199
- errors_1$6.assert(times >= 0, 'The parameter times must be greater than or equal to 0');
1226
+ (0, errors_1$6.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1227
+ (0, errors_1$6.assert)(times >= 0, 'The parameter times must be greater than or equal to 0');
1200
1228
  if (times === Infinity)
1201
1229
  warnInfiniteLoop();
1202
- return go_1$6.go(function* () {
1230
+ return (0, go_1$6.go)(function* () {
1203
1231
  const cache = [];
1204
1232
  if (times > 0) {
1205
1233
  for (const element of iterable) {
@@ -1227,14 +1255,14 @@ function isProduction() {
1227
1255
  var sliceAsync$1 = {};
1228
1256
 
1229
1257
  sliceAsync$1.sliceAsync = void 0;
1230
- const go_1$5 = es2018$2;
1231
- const errors_1$5 = es2018$4;
1258
+ const go_1$5 = es2018$4;
1259
+ const errors_1$5 = es2018$6;
1232
1260
  function sliceAsync(iterable, start, end = Infinity) {
1233
- errors_1$5.assert(Number.isInteger(start), 'The parameter start must be an integer');
1234
- errors_1$5.assert(start >= 0, 'The parameter start must be greater than or equal to 0');
1235
- errors_1$5.assert(Number.isInteger(end), 'The parameter end must be an integer');
1236
- errors_1$5.assert(end >= start, 'The parameter end must be greater than or equal to start');
1237
- return go_1$5.go(async function* () {
1261
+ (0, errors_1$5.assert)(Number.isInteger(start), 'The parameter start must be an integer');
1262
+ (0, errors_1$5.assert)(start >= 0, 'The parameter start must be greater than or equal to 0');
1263
+ (0, errors_1$5.assert)(Number.isInteger(end), 'The parameter end must be an integer');
1264
+ (0, errors_1$5.assert)(end >= start, 'The parameter end must be greater than or equal to start');
1265
+ return (0, go_1$5.go)(async function* () {
1238
1266
  let index = 0;
1239
1267
  for await (const element of iterable) {
1240
1268
  if (index >= end)
@@ -1250,14 +1278,14 @@ sliceAsync$1.sliceAsync = sliceAsync;
1250
1278
  var slice$1 = {};
1251
1279
 
1252
1280
  slice$1.slice = void 0;
1253
- const go_1$4 = es2018$2;
1254
- const errors_1$4 = es2018$4;
1281
+ const go_1$4 = es2018$4;
1282
+ const errors_1$4 = es2018$6;
1255
1283
  function slice(iterable, start, end = Infinity) {
1256
- errors_1$4.assert(Number.isInteger(start), 'The parameter start must be an integer');
1257
- errors_1$4.assert(start >= 0, 'The parameter start must be greater than or equal to 0');
1258
- errors_1$4.assert(Number.isInteger(end), 'The parameter end must be an integer');
1259
- errors_1$4.assert(end >= start, 'The parameter end must be greater than or equal to start');
1260
- return go_1$4.go(function* () {
1284
+ (0, errors_1$4.assert)(Number.isInteger(start), 'The parameter start must be an integer');
1285
+ (0, errors_1$4.assert)(start >= 0, 'The parameter start must be greater than or equal to 0');
1286
+ (0, errors_1$4.assert)(Number.isInteger(end), 'The parameter end must be an integer');
1287
+ (0, errors_1$4.assert)(end >= start, 'The parameter end must be greater than or equal to start');
1288
+ return (0, go_1$4.go)(function* () {
1261
1289
  let index = 0;
1262
1290
  for (const element of iterable) {
1263
1291
  if (index >= end)
@@ -1291,9 +1319,9 @@ splitAsync$1.splitAsync = splitAsync;
1291
1319
  var splitByAsync$1 = {};
1292
1320
 
1293
1321
  splitByAsync$1.splitByAsync = void 0;
1294
- const types_1$a = es2018$1;
1322
+ const types_1$a = es2018$3;
1295
1323
  function splitByAsync(iterable, predicate) {
1296
- if (types_1$a.isAsyncIterable(iterable)) {
1324
+ if ((0, types_1$a.isAsyncIterable)(iterable)) {
1297
1325
  return splitByAsyncIterable(iterable);
1298
1326
  }
1299
1327
  else {
@@ -1373,12 +1401,12 @@ split$1.split = split;
1373
1401
  var takeAsync$1 = {};
1374
1402
 
1375
1403
  takeAsync$1.takeAsync = void 0;
1376
- const go_1$3 = es2018$2;
1377
- const errors_1$3 = es2018$4;
1404
+ const go_1$3 = es2018$4;
1405
+ const errors_1$3 = es2018$6;
1378
1406
  function takeAsync(iterable, count) {
1379
- errors_1$3.assert(Number.isInteger(count), 'The parameter count must be an integer');
1380
- errors_1$3.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1381
- return go_1$3.go(async function* () {
1407
+ (0, errors_1$3.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1408
+ (0, errors_1$3.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1409
+ return (0, go_1$3.go)(async function* () {
1382
1410
  if (count === 0)
1383
1411
  return;
1384
1412
  for await (const element of iterable) {
@@ -1394,12 +1422,12 @@ takeAsync$1.takeAsync = takeAsync;
1394
1422
  var takeRightAsync$1 = {};
1395
1423
 
1396
1424
  takeRightAsync$1.takeRightAsync = void 0;
1397
- const go_1$2 = es2018$2;
1398
- const errors_1$2 = es2018$4;
1425
+ const go_1$2 = es2018$4;
1426
+ const errors_1$2 = es2018$6;
1399
1427
  function takeRightAsync(iterable, count) {
1400
- errors_1$2.assert(Number.isInteger(count), 'The parameter count must be an integer');
1401
- errors_1$2.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1402
- return go_1$2.go(async function* () {
1428
+ (0, errors_1$2.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1429
+ (0, errors_1$2.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1430
+ return (0, go_1$2.go)(async function* () {
1403
1431
  var _a;
1404
1432
  const iterator = iterable[Symbol.asyncIterator]();
1405
1433
  let done;
@@ -1424,12 +1452,12 @@ takeRightAsync$1.takeRightAsync = takeRightAsync;
1424
1452
  var takeRight$1 = {};
1425
1453
 
1426
1454
  takeRight$1.takeRight = void 0;
1427
- const go_1$1 = es2018$2;
1428
- const errors_1$1 = es2018$4;
1455
+ const go_1$1 = es2018$4;
1456
+ const errors_1$1 = es2018$6;
1429
1457
  function takeRight(iterable, count) {
1430
- errors_1$1.assert(Number.isInteger(count), 'The parameter count must be an integer');
1431
- errors_1$1.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1432
- return go_1$1.go(function* () {
1458
+ (0, errors_1$1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1459
+ (0, errors_1$1.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1460
+ return (0, go_1$1.go)(function* () {
1433
1461
  var _a;
1434
1462
  const iterator = iterable[Symbol.iterator]();
1435
1463
  let done;
@@ -1454,9 +1482,9 @@ takeRight$1.takeRight = takeRight;
1454
1482
  var takeUntilAsync$1 = {};
1455
1483
 
1456
1484
  takeUntilAsync$1.takeUntilAsync = void 0;
1457
- const types_1$9 = es2018$1;
1485
+ const types_1$9 = es2018$3;
1458
1486
  function takeUntilAsync(iterable, predicate) {
1459
- if (types_1$9.isAsyncIterable(iterable)) {
1487
+ if ((0, types_1$9.isAsyncIterable)(iterable)) {
1460
1488
  return takeUntilAsyncIterable(iterable);
1461
1489
  }
1462
1490
  else {
@@ -1500,12 +1528,12 @@ takeUntil$1.takeUntil = takeUntil;
1500
1528
  var take$1 = {};
1501
1529
 
1502
1530
  take$1.take = void 0;
1503
- const go_1 = es2018$2;
1504
- const errors_1 = es2018$4;
1531
+ const go_1 = es2018$4;
1532
+ const errors_1 = es2018$6;
1505
1533
  function take(iterable, count) {
1506
- errors_1.assert(Number.isInteger(count), 'The parameter count must be an integer');
1507
- errors_1.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1508
- return go_1.go(function* () {
1534
+ (0, errors_1.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1535
+ (0, errors_1.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1536
+ return (0, go_1.go)(function* () {
1509
1537
  if (count === 0)
1510
1538
  return;
1511
1539
  for (const element of iterable) {
@@ -1521,9 +1549,9 @@ take$1.take = take;
1521
1549
  var tapAsync$1 = {};
1522
1550
 
1523
1551
  tapAsync$1.tapAsync = void 0;
1524
- const types_1$8 = es2018$1;
1552
+ const types_1$8 = es2018$3;
1525
1553
  function tapAsync(iterable, fn) {
1526
- if (types_1$8.isAsyncIterable(iterable)) {
1554
+ if ((0, types_1$8.isAsyncIterable)(iterable)) {
1527
1555
  return tapAsyncIterable(iterable);
1528
1556
  }
1529
1557
  else {
@@ -1604,9 +1632,9 @@ uniqAsync$1.uniqAsync = uniqAsync;
1604
1632
  var uniqByAsync$1 = {};
1605
1633
 
1606
1634
  uniqByAsync$1.uniqByAsync = void 0;
1607
- const types_1$7 = es2018$1;
1635
+ const types_1$7 = es2018$3;
1608
1636
  function uniqByAsync(iterable, fn) {
1609
- if (types_1$7.isAsyncIterable(iterable)) {
1637
+ if ((0, types_1$7.isAsyncIterable)(iterable)) {
1610
1638
  return uniqByAsyncIterable(iterable);
1611
1639
  }
1612
1640
  else {
@@ -1673,7 +1701,7 @@ uniq$1.uniq = uniq;
1673
1701
  var zipAsync$1 = {};
1674
1702
 
1675
1703
  zipAsync$1.zipAsync = void 0;
1676
- const types_1$6 = es2018$1;
1704
+ const types_1$6 = es2018$3;
1677
1705
  var Kind;
1678
1706
  (function (Kind) {
1679
1707
  Kind[Kind["Sync"] = 0] = "Sync";
@@ -1687,7 +1715,7 @@ async function* zipWithSize$1(...iterables) {
1687
1715
  var _a, _b, _c, _d;
1688
1716
  const length = iterables.length;
1689
1717
  const iterators = iterables.map(iterable => {
1690
- if (types_1$6.isAsyncIterable(iterable)) {
1718
+ if ((0, types_1$6.isAsyncIterable)(iterable)) {
1691
1719
  return [Kind.Async, iterable[Symbol.asyncIterator]()];
1692
1720
  }
1693
1721
  else {
@@ -1833,9 +1861,9 @@ consume$1.consume = consume;
1833
1861
  var eachAsync$1 = {};
1834
1862
 
1835
1863
  eachAsync$1.eachAsync = void 0;
1836
- const types_1$5 = es2018$1;
1864
+ const types_1$5 = es2018$3;
1837
1865
  function eachAsync(iterable, fn) {
1838
- if (types_1$5.isAsyncIterable(iterable)) {
1866
+ if ((0, types_1$5.isAsyncIterable)(iterable)) {
1839
1867
  return eachAsyncIterable(iterable);
1840
1868
  }
1841
1869
  else {
@@ -1873,9 +1901,9 @@ each$1.each = each;
1873
1901
  var everyAsync$1 = {};
1874
1902
 
1875
1903
  everyAsync$1.everyAsync = void 0;
1876
- const types_1$4 = es2018$1;
1904
+ const types_1$4 = es2018$3;
1877
1905
  function everyAsync(iterable, predicate) {
1878
- if (types_1$4.isAsyncIterable(iterable)) {
1906
+ if ((0, types_1$4.isAsyncIterable)(iterable)) {
1879
1907
  return everyAsyncIterable(iterable);
1880
1908
  }
1881
1909
  else {
@@ -1919,9 +1947,9 @@ every$1.every = every;
1919
1947
  var findAsync$1 = {};
1920
1948
 
1921
1949
  findAsync$1.findAsync = void 0;
1922
- const types_1$3 = es2018$1;
1950
+ const types_1$3 = es2018$3;
1923
1951
  function findAsync(iterable, predicate) {
1924
- if (types_1$3.isAsyncIterable(iterable)) {
1952
+ if ((0, types_1$3.isAsyncIterable)(iterable)) {
1925
1953
  return findAsyncIterable(iterable);
1926
1954
  }
1927
1955
  else {
@@ -2043,9 +2071,9 @@ match$1.match = match;
2043
2071
  var reduceAsync$1 = {};
2044
2072
 
2045
2073
  reduceAsync$1.reduceAsync = void 0;
2046
- const types_1$2 = es2018$1;
2074
+ const types_1$2 = es2018$3;
2047
2075
  function reduceAsync(iterable, fn, initialValue) {
2048
- if (types_1$2.isUndefined(initialValue)) {
2076
+ if ((0, types_1$2.isUndefined)(initialValue)) {
2049
2077
  return reduceAsyncWithoutInitialValue(iterable, fn);
2050
2078
  }
2051
2079
  else {
@@ -2054,7 +2082,7 @@ function reduceAsync(iterable, fn, initialValue) {
2054
2082
  }
2055
2083
  reduceAsync$1.reduceAsync = reduceAsync;
2056
2084
  function reduceAsyncWithInitialValue(iterable, fn, initialValue) {
2057
- if (types_1$2.isAsyncIterable(iterable)) {
2085
+ if ((0, types_1$2.isAsyncIterable)(iterable)) {
2058
2086
  return reduceAsyncIterable(iterable);
2059
2087
  }
2060
2088
  else {
@@ -2076,7 +2104,7 @@ function reduceAsyncWithInitialValue(iterable, fn, initialValue) {
2076
2104
  }
2077
2105
  }
2078
2106
  function reduceAsyncWithoutInitialValue(iterable, fn) {
2079
- if (types_1$2.isAsyncIterable(iterable)) {
2107
+ if ((0, types_1$2.isAsyncIterable)(iterable)) {
2080
2108
  return reduceAsyncIterable(iterable);
2081
2109
  }
2082
2110
  else {
@@ -2139,9 +2167,9 @@ function reduceAsyncWithoutInitialValue(iterable, fn) {
2139
2167
  var reduce$1 = {};
2140
2168
 
2141
2169
  reduce$1.reduce = void 0;
2142
- const types_1$1 = es2018$1;
2170
+ const types_1$1 = es2018$3;
2143
2171
  function reduce(iterable, fn, initialValue) {
2144
- if (types_1$1.isUndefined(initialValue)) {
2172
+ if ((0, types_1$1.isUndefined)(initialValue)) {
2145
2173
  return reduceWithoutInitialValue(iterable, fn);
2146
2174
  }
2147
2175
  else {
@@ -2186,9 +2214,9 @@ function reduceWithoutInitialValue(iterable, fn) {
2186
2214
  var someAsync$1 = {};
2187
2215
 
2188
2216
  someAsync$1.someAsync = void 0;
2189
- const types_1 = es2018$1;
2217
+ const types_1 = es2018$3;
2190
2218
  function someAsync(iterable, predicate) {
2191
- if (types_1.isAsyncIterable(iterable)) {
2219
+ if ((0, types_1.isAsyncIterable)(iterable)) {
2192
2220
  return someAsyncIterable(iterable);
2193
2221
  }
2194
2222
  else {
@@ -2278,7 +2306,7 @@ var toArrayAsync$1 = {};
2278
2306
  toArrayAsync$1.toArrayAsync = void 0;
2279
2307
  const consume_1$3 = consume$1;
2280
2308
  function toArrayAsync(iterable) {
2281
- return consume_1$3.consume(iterable, async (iterable) => {
2309
+ return (0, consume_1$3.consume)(iterable, async (iterable) => {
2282
2310
  const result = [];
2283
2311
  for await (const element of iterable) {
2284
2312
  result.push(element);
@@ -2293,7 +2321,7 @@ var toArray$1 = {};
2293
2321
  toArray$1.toArray = void 0;
2294
2322
  const consume_1$2 = consume$1;
2295
2323
  function toArray(iterable) {
2296
- return consume_1$2.consume(iterable, iterable => Array.from(iterable));
2324
+ return (0, consume_1$2.consume)(iterable, iterable => Array.from(iterable));
2297
2325
  }
2298
2326
  toArray$1.toArray = toArray;
2299
2327
 
@@ -2302,7 +2330,7 @@ var toSetAsync$1 = {};
2302
2330
  toSetAsync$1.toSetAsync = void 0;
2303
2331
  const consume_1$1 = consume$1;
2304
2332
  function toSetAsync(iterable) {
2305
- return consume_1$1.consume(iterable, async (iterable) => {
2333
+ return (0, consume_1$1.consume)(iterable, async (iterable) => {
2306
2334
  const result = new Set();
2307
2335
  for await (const element of iterable) {
2308
2336
  result.add(element);
@@ -2317,7 +2345,7 @@ var toSet$1 = {};
2317
2345
  toSet$1.toSet = void 0;
2318
2346
  const consume_1 = consume$1;
2319
2347
  function toSet(iterable) {
2320
- return consume_1.consume(iterable, iterable => new Set(iterable));
2348
+ return (0, consume_1.consume)(iterable, iterable => new Set(iterable));
2321
2349
  }
2322
2350
  toSet$1.toSet = toSet;
2323
2351
 
@@ -2370,15 +2398,15 @@ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m
2370
2398
  };__exportStar(middleware, exports);
2371
2399
  __exportStar(output, exports);
2372
2400
 
2373
- }(es2018$3));
2401
+ }(es2018$5));
2374
2402
 
2375
2403
  var _LRUMap_limit, _LRUMap_map;
2376
2404
  class LRUMap {
2377
2405
  constructor(limit) {
2378
2406
  _LRUMap_limit.set(this, void 0);
2379
2407
  _LRUMap_map.set(this, new Map());
2380
- es2018$4.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2381
- es2018$4.assert(limit > 0, 'The parameter limit must be a positive value');
2408
+ es2018$6.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2409
+ es2018$6.assert(limit > 0, 'The parameter limit must be a positive value');
2382
2410
  __classPrivateFieldSet(this, _LRUMap_limit, limit, "f");
2383
2411
  }
2384
2412
  get [(_LRUMap_limit = new WeakMap(), _LRUMap_map = new WeakMap(), Symbol.toStringTag)]() {
@@ -2426,44 +2454,105 @@ class LRUMap {
2426
2454
  * Return the earliest key inserted in the Map
2427
2455
  */
2428
2456
  getColdestKey() {
2429
- return es2018$3.first(__classPrivateFieldGet(this, _LRUMap_map, "f").keys());
2457
+ return es2018$5.first(__classPrivateFieldGet(this, _LRUMap_map, "f").keys());
2430
2458
  }
2431
2459
  }
2432
2460
 
2433
- var es2018 = {};
2461
+ var es2018$2 = {};
2434
2462
 
2435
- var setTimeout$1 = {};
2463
+ var exponentialBackoff = {};
2436
2464
 
2437
- setTimeout$1.setTimeout = void 0;
2438
- function setTimeout(timeout, cb) {
2439
- const timer = globalThis.setTimeout(cb, timeout);
2440
- return () => clearTimeout(timer);
2441
- }
2442
- setTimeout$1.setTimeout = setTimeout;
2465
+ var es2018$1 = {};
2443
2466
 
2444
- var setSchedule$1 = {};
2467
+ var random$1 = {};
2445
2468
 
2446
- setSchedule$1.setSchedule = void 0;
2447
- const set_timeout_1$3 = setTimeout$1;
2448
- function setSchedule(timestamp, cb) {
2449
- const timeout = timestamp - Date.now();
2450
- return (0, set_timeout_1$3.setTimeout)(timeout, cb);
2469
+ random$1.random = void 0;
2470
+ function random(min, max) {
2471
+ return Math.random() * (max - min) + min;
2451
2472
  }
2452
- setSchedule$1.setSchedule = setSchedule;
2473
+ random$1.random = random;
2453
2474
 
2454
- var setInterval$1 = {};
2475
+ var randomInt$1 = {};
2455
2476
 
2456
- setInterval$1.setInterval = void 0;
2457
- function setInterval(timeout, cb) {
2458
- const timer = globalThis.setInterval(cb, timeout);
2459
- return () => clearInterval(timer);
2477
+ randomInt$1.randomInt = void 0;
2478
+ function randomInt(min, max) {
2479
+ min = Math.ceil(min);
2480
+ max = Math.floor(max);
2481
+ return Math.floor(Math.random() * (max - min)) + min;
2460
2482
  }
2461
- setInterval$1.setInterval = setInterval;
2483
+ randomInt$1.randomInt = randomInt;
2462
2484
 
2463
- var setImmediate$1 = {};
2485
+ var randomIntInclusive$1 = {};
2486
+
2487
+ randomIntInclusive$1.randomIntInclusive = void 0;
2488
+ function randomIntInclusive(min, max) {
2489
+ min = Math.ceil(min);
2490
+ max = Math.floor(max);
2491
+ return Math.floor(Math.random() * (max - min + 1)) + min;
2492
+ }
2493
+ randomIntInclusive$1.randomIntInclusive = randomIntInclusive;
2494
+
2495
+ (function (exports) {
2496
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2497
+ if (k2 === undefined) k2 = k;
2498
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2499
+ }) : (function(o, m, k, k2) {
2500
+ if (k2 === undefined) k2 = k;
2501
+ o[k2] = m[k];
2502
+ }));
2503
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
2504
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2505
+ };__exportStar(random$1, exports);
2506
+ __exportStar(randomInt$1, exports);
2507
+ __exportStar(randomIntInclusive$1, exports);
2508
+
2509
+ }(es2018$1));
2510
+
2511
+ exponentialBackoff.calculateExponentialBackoffTimeout = void 0;
2512
+ const extra_rand_1 = es2018$1;
2513
+ function calculateExponentialBackoffTimeout({ baseTimeout, retries, maxTimeout = Infinity, factor = 2, jitter = true }) {
2514
+ const timeout = Math.min(factor ** retries * baseTimeout, maxTimeout);
2515
+ if (jitter) {
2516
+ return (0, extra_rand_1.randomIntInclusive)(0, timeout);
2517
+ }
2518
+ else {
2519
+ return timeout;
2520
+ }
2521
+ }
2522
+ exponentialBackoff.calculateExponentialBackoffTimeout = calculateExponentialBackoffTimeout;
2523
+
2524
+ var setTimeout$2 = {};
2525
+
2526
+ setTimeout$2.setTimeout = void 0;
2527
+ function setTimeout$1(timeout, cb) {
2528
+ const timer = globalThis.setTimeout(cb, timeout);
2529
+ return () => clearTimeout(timer);
2530
+ }
2531
+ setTimeout$2.setTimeout = setTimeout$1;
2532
+
2533
+ var setSchedule$1 = {};
2534
+
2535
+ setSchedule$1.setSchedule = void 0;
2536
+ const set_timeout_1$3 = setTimeout$2;
2537
+ function setSchedule(timestamp, cb) {
2538
+ const timeout = timestamp - Date.now();
2539
+ return (0, set_timeout_1$3.setTimeout)(timeout, cb);
2540
+ }
2541
+ setSchedule$1.setSchedule = setSchedule;
2542
+
2543
+ var setInterval$1 = {};
2544
+
2545
+ setInterval$1.setInterval = void 0;
2546
+ function setInterval(timeout, cb) {
2547
+ const timer = globalThis.setInterval(cb, timeout);
2548
+ return () => clearInterval(timer);
2549
+ }
2550
+ setInterval$1.setInterval = setInterval;
2551
+
2552
+ var setImmediate$1 = {};
2464
2553
 
2465
2554
  setImmediate$1.setImmediate = void 0;
2466
- const set_timeout_1$2 = setTimeout$1;
2555
+ const set_timeout_1$2 = setTimeout$2;
2467
2556
  function setImmediate(cb) {
2468
2557
  if (globalThis.setImmediate) {
2469
2558
  const timer = globalThis.setImmediate(cb);
@@ -2478,7 +2567,7 @@ setImmediate$1.setImmediate = setImmediate;
2478
2567
  var setTimeoutLoop$1 = {};
2479
2568
 
2480
2569
  setTimeoutLoop$1.setTimeoutLoop = void 0;
2481
- const set_timeout_1$1 = setTimeout$1;
2570
+ const set_timeout_1$1 = setTimeout$2;
2482
2571
  function setTimeoutLoop(timeout, cb) {
2483
2572
  let isCancelled = false;
2484
2573
  let cancel = (0, set_timeout_1$1.setTimeout)(timeout, loop);
@@ -2488,8 +2577,9 @@ function setTimeoutLoop(timeout, cb) {
2488
2577
  };
2489
2578
  async function loop() {
2490
2579
  await cb();
2491
- if (!isCancelled)
2580
+ if (!isCancelled) {
2492
2581
  cancel = (0, set_timeout_1$1.setTimeout)(timeout, loop);
2582
+ }
2493
2583
  }
2494
2584
  }
2495
2585
  setTimeoutLoop$1.setTimeoutLoop = setTimeoutLoop;
@@ -2497,7 +2587,7 @@ setTimeoutLoop$1.setTimeoutLoop = setTimeoutLoop;
2497
2587
  var setDynamicTimeoutLoop$1 = {};
2498
2588
 
2499
2589
  setDynamicTimeoutLoop$1.setDynamicTimeoutLoop = void 0;
2500
- const set_timeout_1 = setTimeout$1;
2590
+ const set_timeout_1 = setTimeout$2;
2501
2591
  function setDynamicTimeoutLoop(timeout, cb) {
2502
2592
  let isCancelled = false;
2503
2593
  let cancel = (0, set_timeout_1.setTimeout)(timeout, loop);
@@ -2509,8 +2599,9 @@ function setDynamicTimeoutLoop(timeout, cb) {
2509
2599
  const start = Date.now();
2510
2600
  await cb();
2511
2601
  const elapsed = Date.now() - start;
2512
- if (!isCancelled)
2602
+ if (!isCancelled) {
2513
2603
  cancel = (0, set_timeout_1.setTimeout)(Math.max(timeout - elapsed, 0), loop);
2604
+ }
2514
2605
  }
2515
2606
  }
2516
2607
  setDynamicTimeoutLoop$1.setDynamicTimeoutLoop = setDynamicTimeoutLoop;
@@ -2525,26 +2616,27 @@ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Obj
2525
2616
  }));
2526
2617
  var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
2527
2618
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2528
- };__exportStar(setTimeout$1, exports);
2619
+ };__exportStar(exponentialBackoff, exports);
2620
+ __exportStar(setTimeout$2, exports);
2529
2621
  __exportStar(setSchedule$1, exports);
2530
2622
  __exportStar(setInterval$1, exports);
2531
2623
  __exportStar(setImmediate$1, exports);
2532
2624
  __exportStar(setTimeoutLoop$1, exports);
2533
2625
  __exportStar(setDynamicTimeoutLoop$1, exports);
2534
2626
 
2535
- }(es2018));
2627
+ }(es2018$2));
2536
2628
 
2537
- var _ExpirableMap_map, _ExpirableMap_cancelNextTimeout;
2629
+ var _ExpirableMap_map, _ExpirableMap_cancelClearTimeout;
2538
2630
  class ExpirableMap {
2539
2631
  constructor() {
2540
2632
  _ExpirableMap_map.set(this, new Map());
2541
- _ExpirableMap_cancelNextTimeout.set(this, void 0);
2633
+ _ExpirableMap_cancelClearTimeout.set(this, void 0);
2542
2634
  /**
2543
- * 按过期时间升序排列所有Map项目的信息
2635
+ * 按过期时间升序排列所有项目的元数据
2544
2636
  */
2545
- this.itemsSortedByExpirationTime = [];
2637
+ this.itemMetadataSortedByExpirationTime = [];
2546
2638
  }
2547
- get [(_ExpirableMap_map = new WeakMap(), _ExpirableMap_cancelNextTimeout = new WeakMap(), Symbol.toStringTag)]() {
2639
+ get [(_ExpirableMap_map = new WeakMap(), _ExpirableMap_cancelClearTimeout = new WeakMap(), Symbol.toStringTag)]() {
2548
2640
  return this.constructor.name;
2549
2641
  }
2550
2642
  get size() {
@@ -2552,8 +2644,8 @@ class ExpirableMap {
2552
2644
  }
2553
2645
  set(key, value, maxAge) {
2554
2646
  __classPrivateFieldGet(this, _ExpirableMap_map, "f").set(key, value);
2555
- this.removeItem(key);
2556
- this.addItem(key, Date.now() + maxAge);
2647
+ this.removeItemMetadata(key);
2648
+ this.addItemMetadata(key, Date.now() + maxAge);
2557
2649
  return this;
2558
2650
  }
2559
2651
  has(key) {
@@ -2563,79 +2655,79 @@ class ExpirableMap {
2563
2655
  return __classPrivateFieldGet(this, _ExpirableMap_map, "f").get(key);
2564
2656
  }
2565
2657
  delete(key) {
2566
- const result = __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(key);
2567
- if (result) {
2568
- const index = this.itemsSortedByExpirationTime.findIndex(x => x.key === key);
2569
- this.itemsSortedByExpirationTime.splice(index, 1);
2658
+ const exists = __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(key);
2659
+ if (exists) {
2660
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2661
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2570
2662
  // 如果被删除的项目是第一个项目, 则需要重新规划过期回调
2571
2663
  if (index === 0) {
2572
- this.rescheduleTimeout();
2664
+ this.rescheduleClearTimeout();
2573
2665
  }
2574
2666
  }
2575
- return result;
2667
+ return exists;
2576
2668
  }
2577
2669
  clear() {
2578
2670
  var _a;
2579
2671
  __classPrivateFieldGet(this, _ExpirableMap_map, "f").clear();
2580
- (_a = __classPrivateFieldGet(this, _ExpirableMap_cancelNextTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2581
- this.itemsSortedByExpirationTime = [];
2672
+ (_a = __classPrivateFieldGet(this, _ExpirableMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2673
+ this.itemMetadataSortedByExpirationTime = [];
2582
2674
  }
2583
- addItem(key, expirationTime) {
2584
- for (let i = 0; i < this.itemsSortedByExpirationTime.length; i++) {
2585
- const item = this.itemsSortedByExpirationTime[i];
2675
+ addItemMetadata(key, expirationTime) {
2676
+ for (let i = 0; i < this.itemMetadataSortedByExpirationTime.length; i++) {
2677
+ const item = this.itemMetadataSortedByExpirationTime[i];
2586
2678
  if (expirationTime < item.expirationTime) {
2587
- this.itemsSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2679
+ this.itemMetadataSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2588
2680
  // 如果本次插入导致原先的第一个项目不再是低一个项目, 则需要重新规划过期回调
2589
2681
  if (i === 0) {
2590
- this.rescheduleTimeout();
2682
+ this.rescheduleClearTimeout();
2591
2683
  }
2592
2684
  return;
2593
2685
  }
2594
2686
  }
2595
2687
  // 如果代码运行到此处, 意味着数组要么为空, 要么新项目过期时间大于数组内的所有项目, 故直接插入到数组尾端.
2596
- this.itemsSortedByExpirationTime.push({ key, expirationTime });
2688
+ this.itemMetadataSortedByExpirationTime.push({ key, expirationTime });
2597
2689
  // 如果新插入的项目是唯一而项目, 则需要重新规划过期回调
2598
- if (this.itemsSortedByExpirationTime.length === 1) {
2599
- this.rescheduleTimeout();
2690
+ if (this.itemMetadataSortedByExpirationTime.length === 1) {
2691
+ this.rescheduleClearTimeout();
2600
2692
  }
2601
2693
  }
2602
- removeItem(key) {
2603
- const index = this.itemsSortedByExpirationTime.findIndex(x => x.key === key);
2694
+ removeItemMetadata(key) {
2695
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2604
2696
  if (index >= 0) {
2605
- this.itemsSortedByExpirationTime.splice(index, 1);
2697
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2606
2698
  // 如果被移除的是第一个项目, 则需要重新规划过期回调
2607
2699
  if (index === 0) {
2608
- this.rescheduleTimeout();
2700
+ this.rescheduleClearTimeout();
2609
2701
  }
2610
2702
  }
2611
2703
  }
2612
2704
  clearExpiredItems(timestamp) {
2613
- const indexOfFirstUnexpiredItem = this.itemsSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
2614
- const expiredItems = indexOfFirstUnexpiredItem >= 0
2615
- ? this.itemsSortedByExpirationTime.splice(0, indexOfFirstUnexpiredItem)
2616
- : this.itemsSortedByExpirationTime.splice(0, this.itemsSortedByExpirationTime.length);
2617
- expiredItems.forEach(x => __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(x.key));
2705
+ const indexOfFirstUnexpired = this.itemMetadataSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
2706
+ const expiredItemKeys = indexOfFirstUnexpired >= 0
2707
+ ? this.itemMetadataSortedByExpirationTime.splice(0, indexOfFirstUnexpired)
2708
+ : this.itemMetadataSortedByExpirationTime.splice(0, this.itemMetadataSortedByExpirationTime.length);
2709
+ expiredItemKeys.forEach(x => __classPrivateFieldGet(this, _ExpirableMap_map, "f").delete(x.key));
2618
2710
  }
2619
- rescheduleTimeout() {
2711
+ rescheduleClearTimeout() {
2620
2712
  var _a;
2621
- (_a = __classPrivateFieldGet(this, _ExpirableMap_cancelNextTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2622
- if (this.itemsSortedByExpirationTime.length > 0) {
2623
- const item = this.itemsSortedByExpirationTime[0];
2713
+ (_a = __classPrivateFieldGet(this, _ExpirableMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2714
+ if (this.itemMetadataSortedByExpirationTime.length > 0) {
2715
+ const item = this.itemMetadataSortedByExpirationTime[0];
2624
2716
  if (Number.isFinite(item.expirationTime)) {
2625
- const cancel = es2018.setSchedule(item.expirationTime, () => {
2717
+ const cancel = es2018$2.setSchedule(item.expirationTime, () => {
2626
2718
  this.clearExpiredItems(Date.now());
2627
- this.rescheduleTimeout();
2719
+ this.rescheduleClearTimeout();
2628
2720
  });
2629
- __classPrivateFieldSet(this, _ExpirableMap_cancelNextTimeout, () => {
2721
+ __classPrivateFieldSet(this, _ExpirableMap_cancelClearTimeout, () => {
2630
2722
  cancel();
2631
- __classPrivateFieldSet(this, _ExpirableMap_cancelNextTimeout, undefined, "f");
2723
+ __classPrivateFieldSet(this, _ExpirableMap_cancelClearTimeout, undefined, "f");
2632
2724
  }, "f");
2633
2725
  }
2634
2726
  }
2635
2727
  }
2636
2728
  }
2637
2729
 
2638
- var _TLRUMap_limit, _TLRUMap_map, _TLRUMap_cancelNextTimeout;
2730
+ var _TLRUMap_limit, _TLRUMap_map, _TLRUMap_cancelClearTimeout;
2639
2731
  /**
2640
2732
  * TLRUMap = LRUMap + ExpirableMap
2641
2733
  */
@@ -2643,16 +2735,16 @@ class TLRUMap {
2643
2735
  constructor(limit) {
2644
2736
  _TLRUMap_limit.set(this, void 0);
2645
2737
  _TLRUMap_map.set(this, new Map());
2646
- _TLRUMap_cancelNextTimeout.set(this, void 0);
2738
+ _TLRUMap_cancelClearTimeout.set(this, void 0);
2647
2739
  /**
2648
- * 按过期时间升序排列所有Map项目的信息
2740
+ * 按过期时间升序排列所有项目的元数据
2649
2741
  */
2650
- this.itemsSortedByExpirationTime = [];
2651
- es2018$4.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2652
- es2018$4.assert(limit > 0, 'The parameter limit must be a positive value');
2742
+ this.itemMetadataSortedByExpirationTime = [];
2743
+ es2018$6.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2744
+ es2018$6.assert(limit > 0, 'The parameter limit must be a positive value');
2653
2745
  __classPrivateFieldSet(this, _TLRUMap_limit, limit, "f");
2654
2746
  }
2655
- get [(_TLRUMap_limit = new WeakMap(), _TLRUMap_map = new WeakMap(), _TLRUMap_cancelNextTimeout = new WeakMap(), Symbol.toStringTag)]() {
2747
+ get [(_TLRUMap_limit = new WeakMap(), _TLRUMap_map = new WeakMap(), _TLRUMap_cancelClearTimeout = new WeakMap(), Symbol.toStringTag)]() {
2656
2748
  return this.constructor.name;
2657
2749
  }
2658
2750
  get size() {
@@ -2661,15 +2753,15 @@ class TLRUMap {
2661
2753
  set(key, value, maxAge) {
2662
2754
  if (__classPrivateFieldGet(this, _TLRUMap_map, "f").has(key)) {
2663
2755
  this.updateItem(key, value);
2664
- this.removeItem(key);
2665
- this.addItem(key, Date.now() + maxAge);
2756
+ this.removeItemMetadata(key);
2757
+ this.addItemMetadata(key, Date.now() + maxAge);
2666
2758
  }
2667
2759
  else {
2668
2760
  if (__classPrivateFieldGet(this, _TLRUMap_map, "f").size === __classPrivateFieldGet(this, _TLRUMap_limit, "f")) {
2669
2761
  __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(this.getColdestKey());
2670
2762
  }
2671
2763
  __classPrivateFieldGet(this, _TLRUMap_map, "f").set(key, value);
2672
- this.addItem(key, Date.now() + maxAge);
2764
+ this.addItemMetadata(key, Date.now() + maxAge);
2673
2765
  }
2674
2766
  return this;
2675
2767
  }
@@ -2689,11 +2781,11 @@ class TLRUMap {
2689
2781
  delete(key) {
2690
2782
  const result = __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(key);
2691
2783
  if (result) {
2692
- const index = this.itemsSortedByExpirationTime.findIndex(x => x.key === key);
2693
- this.itemsSortedByExpirationTime.splice(index, 1);
2784
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2785
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2694
2786
  // 如果被删除的项目是第一个项目, 则需要重新规划过期回调
2695
2787
  if (index === 0) {
2696
- this.rescheduleTimeout();
2788
+ this.rescheduleClearTimeout();
2697
2789
  }
2698
2790
  }
2699
2791
  return result;
@@ -2701,8 +2793,8 @@ class TLRUMap {
2701
2793
  clear() {
2702
2794
  var _a;
2703
2795
  __classPrivateFieldGet(this, _TLRUMap_map, "f").clear();
2704
- (_a = __classPrivateFieldGet(this, _TLRUMap_cancelNextTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2705
- this.itemsSortedByExpirationTime = [];
2796
+ (_a = __classPrivateFieldGet(this, _TLRUMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2797
+ this.itemMetadataSortedByExpirationTime = [];
2706
2798
  }
2707
2799
  /**
2708
2800
  * 重新插入项目, 这会使项目置于#map迭代器的末端.
@@ -2711,55 +2803,55 @@ class TLRUMap {
2711
2803
  __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(key);
2712
2804
  __classPrivateFieldGet(this, _TLRUMap_map, "f").set(key, value);
2713
2805
  }
2714
- addItem(key, expirationTime) {
2715
- for (let i = 0; i < this.itemsSortedByExpirationTime.length; i++) {
2716
- const item = this.itemsSortedByExpirationTime[i];
2806
+ addItemMetadata(key, expirationTime) {
2807
+ for (let i = 0; i < this.itemMetadataSortedByExpirationTime.length; i++) {
2808
+ const item = this.itemMetadataSortedByExpirationTime[i];
2717
2809
  if (expirationTime < item.expirationTime) {
2718
- this.itemsSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2810
+ this.itemMetadataSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2719
2811
  // 如果本次插入导致原先的第一个项目不再是低一个项目, 则需要重新规划过期回调
2720
2812
  if (i === 0) {
2721
- this.rescheduleTimeout();
2813
+ this.rescheduleClearTimeout();
2722
2814
  }
2723
2815
  return;
2724
2816
  }
2725
2817
  }
2726
2818
  // 如果代码运行到此处, 意味着数组要么为空, 要么新项目过期时间大于数组内的所有项目, 故直接插入到数组尾端.
2727
- this.itemsSortedByExpirationTime.push({ key, expirationTime });
2819
+ this.itemMetadataSortedByExpirationTime.push({ key, expirationTime });
2728
2820
  // 如果新插入的项目是唯一而项目, 则需要重新规划过期回调
2729
- if (this.itemsSortedByExpirationTime.length === 1) {
2730
- this.rescheduleTimeout();
2821
+ if (this.itemMetadataSortedByExpirationTime.length === 1) {
2822
+ this.rescheduleClearTimeout();
2731
2823
  }
2732
2824
  }
2733
- removeItem(key) {
2734
- const index = this.itemsSortedByExpirationTime.findIndex(x => x.key === key);
2825
+ removeItemMetadata(key) {
2826
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2735
2827
  if (index >= 0) {
2736
- this.itemsSortedByExpirationTime.splice(index, 1);
2828
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2737
2829
  // 如果被移除的是第一个项目, 则需要重新规划过期回调
2738
2830
  if (index === 0) {
2739
- this.rescheduleTimeout();
2831
+ this.rescheduleClearTimeout();
2740
2832
  }
2741
2833
  }
2742
2834
  }
2743
2835
  clearExpiredItems(timestamp) {
2744
- const indexOfFirstUnexpiredItem = this.itemsSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
2745
- const expiredItems = indexOfFirstUnexpiredItem >= 0
2746
- ? this.itemsSortedByExpirationTime.splice(0, indexOfFirstUnexpiredItem)
2747
- : this.itemsSortedByExpirationTime.splice(0, this.itemsSortedByExpirationTime.length);
2748
- expiredItems.forEach(x => __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(x.key));
2836
+ const indexOfFirstUnexpiredItem = this.itemMetadataSortedByExpirationTime.findIndex(x => x.expirationTime > timestamp);
2837
+ const expiredItemKeys = indexOfFirstUnexpiredItem >= 0
2838
+ ? this.itemMetadataSortedByExpirationTime.splice(0, indexOfFirstUnexpiredItem)
2839
+ : this.itemMetadataSortedByExpirationTime.splice(0, this.itemMetadataSortedByExpirationTime.length);
2840
+ expiredItemKeys.forEach(x => __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(x.key));
2749
2841
  }
2750
- rescheduleTimeout() {
2842
+ rescheduleClearTimeout() {
2751
2843
  var _a;
2752
- (_a = __classPrivateFieldGet(this, _TLRUMap_cancelNextTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2753
- if (this.itemsSortedByExpirationTime.length > 0) {
2754
- const item = this.itemsSortedByExpirationTime[0];
2844
+ (_a = __classPrivateFieldGet(this, _TLRUMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2845
+ if (this.itemMetadataSortedByExpirationTime.length > 0) {
2846
+ const item = this.itemMetadataSortedByExpirationTime[0];
2755
2847
  if (Number.isFinite(item.expirationTime)) {
2756
- const cancel = es2018.setSchedule(item.expirationTime, () => {
2848
+ const cancel = es2018$2.setSchedule(item.expirationTime, () => {
2757
2849
  this.clearExpiredItems(Date.now());
2758
- this.rescheduleTimeout();
2850
+ this.rescheduleClearTimeout();
2759
2851
  });
2760
- __classPrivateFieldSet(this, _TLRUMap_cancelNextTimeout, () => {
2852
+ __classPrivateFieldSet(this, _TLRUMap_cancelClearTimeout, () => {
2761
2853
  cancel();
2762
- __classPrivateFieldSet(this, _TLRUMap_cancelNextTimeout, undefined, "f");
2854
+ __classPrivateFieldSet(this, _TLRUMap_cancelClearTimeout, undefined, "f");
2763
2855
  }, "f");
2764
2856
  }
2765
2857
  }
@@ -2768,7 +2860,7 @@ class TLRUMap {
2768
2860
  * Return the earliest key inserted in the Map
2769
2861
  */
2770
2862
  getColdestKey() {
2771
- return es2018$3.first(__classPrivateFieldGet(this, _TLRUMap_map, "f").keys());
2863
+ return es2018$5.first(__classPrivateFieldGet(this, _TLRUMap_map, "f").keys());
2772
2864
  }
2773
2865
  }
2774
2866
 
@@ -2836,7 +2928,7 @@ class TrieMap {
2836
2928
  delete node.value;
2837
2929
  // 如果节点没有后缀, 则代表这是末端节点, 往前删除其前缀
2838
2930
  if (node.children.size === 0) {
2839
- for (const [part, parentNode] of es2018$3.toArray(es2018$3.zip(key, parentNodes)).reverse()) {
2931
+ for (const [part, parentNode] of es2018$5.toArray(es2018$5.zip(key, parentNodes)).reverse()) {
2840
2932
  parentNode.children.delete(part);
2841
2933
  if (parentNode.children.size !== 0)
2842
2934
  break;
@@ -2846,5 +2938,1086 @@ class TrieMap {
2846
2938
  }
2847
2939
  }
2848
2940
 
2849
- export { Emitter, ExpirableMap, HashMap, HashSet, LRUMap, Queue, TLRUMap, TrieMap, convertArrayToCons, convertConsToArray };
2941
+ var _FiniteStateMachine_state;
2942
+ class FiniteStateMachine {
2943
+ constructor(schema, initialState) {
2944
+ this.schema = schema;
2945
+ _FiniteStateMachine_state.set(this, void 0);
2946
+ __classPrivateFieldSet(this, _FiniteStateMachine_state, initialState, "f");
2947
+ }
2948
+ get state() {
2949
+ return __classPrivateFieldGet(this, _FiniteStateMachine_state, "f");
2950
+ }
2951
+ matches(state) {
2952
+ return __classPrivateFieldGet(this, _FiniteStateMachine_state, "f") === state;
2953
+ }
2954
+ /**
2955
+ * @throws {BadEventError}
2956
+ */
2957
+ send(event) {
2958
+ if (event in this.schema[this.state]) {
2959
+ __classPrivateFieldSet(this, _FiniteStateMachine_state, this.schema[this.state][event], "f");
2960
+ }
2961
+ else {
2962
+ throw new BadEventError(this.state, event);
2963
+ }
2964
+ }
2965
+ }
2966
+ _FiniteStateMachine_state = new WeakMap();
2967
+ class BadEventError extends es2018$6.CustomError {
2968
+ constructor(state, event) {
2969
+ super(`State ${state} cannot react to event ${event}`);
2970
+ }
2971
+ }
2972
+
2973
+ /*! *****************************************************************************
2974
+ Copyright (c) Microsoft Corporation.
2975
+
2976
+ Permission to use, copy, modify, and/or distribute this software for any
2977
+ purpose with or without fee is hereby granted.
2978
+
2979
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2980
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2981
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2982
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2983
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2984
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2985
+ PERFORMANCE OF THIS SOFTWARE.
2986
+ ***************************************************************************** */
2987
+ /* global Reflect, Promise */
2988
+
2989
+ var extendStatics = function(d, b) {
2990
+ extendStatics = Object.setPrototypeOf ||
2991
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
2992
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
2993
+ return extendStatics(d, b);
2994
+ };
2995
+
2996
+ function __extends(d, b) {
2997
+ if (typeof b !== "function" && b !== null)
2998
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
2999
+ extendStatics(d, b);
3000
+ function __() { this.constructor = d; }
3001
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3002
+ }
3003
+
3004
+ function __values(o) {
3005
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3006
+ if (m) return m.call(o);
3007
+ if (o && typeof o.length === "number") return {
3008
+ next: function () {
3009
+ if (o && i >= o.length) o = void 0;
3010
+ return { value: o && o[i++], done: !o };
3011
+ }
3012
+ };
3013
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3014
+ }
3015
+
3016
+ function __read(o, n) {
3017
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
3018
+ if (!m) return o;
3019
+ var i = m.call(o), r, ar = [], e;
3020
+ try {
3021
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
3022
+ }
3023
+ catch (error) { e = { error: error }; }
3024
+ finally {
3025
+ try {
3026
+ if (r && !r.done && (m = i["return"])) m.call(i);
3027
+ }
3028
+ finally { if (e) throw e.error; }
3029
+ }
3030
+ return ar;
3031
+ }
3032
+
3033
+ function __spreadArray(to, from) {
3034
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
3035
+ to[j] = from[i];
3036
+ return to;
3037
+ }
3038
+
3039
+ function isFunction$1(value) {
3040
+ return typeof value === 'function';
3041
+ }
3042
+
3043
+ function createErrorClass(createImpl) {
3044
+ var _super = function (instance) {
3045
+ Error.call(instance);
3046
+ instance.stack = new Error().stack;
3047
+ };
3048
+ var ctorFunc = createImpl(_super);
3049
+ ctorFunc.prototype = Object.create(Error.prototype);
3050
+ ctorFunc.prototype.constructor = ctorFunc;
3051
+ return ctorFunc;
3052
+ }
3053
+
3054
+ var UnsubscriptionError = createErrorClass(function (_super) {
3055
+ return function UnsubscriptionErrorImpl(errors) {
3056
+ _super(this);
3057
+ this.message = errors
3058
+ ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
3059
+ : '';
3060
+ this.name = 'UnsubscriptionError';
3061
+ this.errors = errors;
3062
+ };
3063
+ });
3064
+
3065
+ function arrRemove(arr, item) {
3066
+ if (arr) {
3067
+ var index = arr.indexOf(item);
3068
+ 0 <= index && arr.splice(index, 1);
3069
+ }
3070
+ }
3071
+
3072
+ var Subscription = (function () {
3073
+ function Subscription(initialTeardown) {
3074
+ this.initialTeardown = initialTeardown;
3075
+ this.closed = false;
3076
+ this._parentage = null;
3077
+ this._teardowns = null;
3078
+ }
3079
+ Subscription.prototype.unsubscribe = function () {
3080
+ var e_1, _a, e_2, _b;
3081
+ var errors;
3082
+ if (!this.closed) {
3083
+ this.closed = true;
3084
+ var _parentage = this._parentage;
3085
+ if (_parentage) {
3086
+ this._parentage = null;
3087
+ if (Array.isArray(_parentage)) {
3088
+ try {
3089
+ for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
3090
+ var parent_1 = _parentage_1_1.value;
3091
+ parent_1.remove(this);
3092
+ }
3093
+ }
3094
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3095
+ finally {
3096
+ try {
3097
+ if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
3098
+ }
3099
+ finally { if (e_1) throw e_1.error; }
3100
+ }
3101
+ }
3102
+ else {
3103
+ _parentage.remove(this);
3104
+ }
3105
+ }
3106
+ var initialTeardown = this.initialTeardown;
3107
+ if (isFunction$1(initialTeardown)) {
3108
+ try {
3109
+ initialTeardown();
3110
+ }
3111
+ catch (e) {
3112
+ errors = e instanceof UnsubscriptionError ? e.errors : [e];
3113
+ }
3114
+ }
3115
+ var _teardowns = this._teardowns;
3116
+ if (_teardowns) {
3117
+ this._teardowns = null;
3118
+ try {
3119
+ for (var _teardowns_1 = __values(_teardowns), _teardowns_1_1 = _teardowns_1.next(); !_teardowns_1_1.done; _teardowns_1_1 = _teardowns_1.next()) {
3120
+ var teardown_1 = _teardowns_1_1.value;
3121
+ try {
3122
+ execTeardown(teardown_1);
3123
+ }
3124
+ catch (err) {
3125
+ errors = errors !== null && errors !== void 0 ? errors : [];
3126
+ if (err instanceof UnsubscriptionError) {
3127
+ errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
3128
+ }
3129
+ else {
3130
+ errors.push(err);
3131
+ }
3132
+ }
3133
+ }
3134
+ }
3135
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3136
+ finally {
3137
+ try {
3138
+ if (_teardowns_1_1 && !_teardowns_1_1.done && (_b = _teardowns_1.return)) _b.call(_teardowns_1);
3139
+ }
3140
+ finally { if (e_2) throw e_2.error; }
3141
+ }
3142
+ }
3143
+ if (errors) {
3144
+ throw new UnsubscriptionError(errors);
3145
+ }
3146
+ }
3147
+ };
3148
+ Subscription.prototype.add = function (teardown) {
3149
+ var _a;
3150
+ if (teardown && teardown !== this) {
3151
+ if (this.closed) {
3152
+ execTeardown(teardown);
3153
+ }
3154
+ else {
3155
+ if (teardown instanceof Subscription) {
3156
+ if (teardown.closed || teardown._hasParent(this)) {
3157
+ return;
3158
+ }
3159
+ teardown._addParent(this);
3160
+ }
3161
+ (this._teardowns = (_a = this._teardowns) !== null && _a !== void 0 ? _a : []).push(teardown);
3162
+ }
3163
+ }
3164
+ };
3165
+ Subscription.prototype._hasParent = function (parent) {
3166
+ var _parentage = this._parentage;
3167
+ return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
3168
+ };
3169
+ Subscription.prototype._addParent = function (parent) {
3170
+ var _parentage = this._parentage;
3171
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
3172
+ };
3173
+ Subscription.prototype._removeParent = function (parent) {
3174
+ var _parentage = this._parentage;
3175
+ if (_parentage === parent) {
3176
+ this._parentage = null;
3177
+ }
3178
+ else if (Array.isArray(_parentage)) {
3179
+ arrRemove(_parentage, parent);
3180
+ }
3181
+ };
3182
+ Subscription.prototype.remove = function (teardown) {
3183
+ var _teardowns = this._teardowns;
3184
+ _teardowns && arrRemove(_teardowns, teardown);
3185
+ if (teardown instanceof Subscription) {
3186
+ teardown._removeParent(this);
3187
+ }
3188
+ };
3189
+ Subscription.EMPTY = (function () {
3190
+ var empty = new Subscription();
3191
+ empty.closed = true;
3192
+ return empty;
3193
+ })();
3194
+ return Subscription;
3195
+ }());
3196
+ var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
3197
+ function isSubscription(value) {
3198
+ return (value instanceof Subscription ||
3199
+ (value && 'closed' in value && isFunction$1(value.remove) && isFunction$1(value.add) && isFunction$1(value.unsubscribe)));
3200
+ }
3201
+ function execTeardown(teardown) {
3202
+ if (isFunction$1(teardown)) {
3203
+ teardown();
3204
+ }
3205
+ else {
3206
+ teardown.unsubscribe();
3207
+ }
3208
+ }
3209
+
3210
+ var config = {
3211
+ onUnhandledError: null,
3212
+ onStoppedNotification: null,
3213
+ Promise: undefined,
3214
+ useDeprecatedSynchronousErrorHandling: false,
3215
+ useDeprecatedNextContext: false,
3216
+ };
3217
+
3218
+ var timeoutProvider = {
3219
+ setTimeout: function () {
3220
+ var args = [];
3221
+ for (var _i = 0; _i < arguments.length; _i++) {
3222
+ args[_i] = arguments[_i];
3223
+ }
3224
+ var delegate = timeoutProvider.delegate;
3225
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) || setTimeout).apply(void 0, __spreadArray([], __read(args)));
3226
+ },
3227
+ clearTimeout: function (handle) {
3228
+ var delegate = timeoutProvider.delegate;
3229
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
3230
+ },
3231
+ delegate: undefined,
3232
+ };
3233
+
3234
+ function reportUnhandledError(err) {
3235
+ timeoutProvider.setTimeout(function () {
3236
+ {
3237
+ throw err;
3238
+ }
3239
+ });
3240
+ }
3241
+
3242
+ function noop() { }
3243
+
3244
+ var context = null;
3245
+ function errorContext(cb) {
3246
+ if (config.useDeprecatedSynchronousErrorHandling) {
3247
+ var isRoot = !context;
3248
+ if (isRoot) {
3249
+ context = { errorThrown: false, error: null };
3250
+ }
3251
+ cb();
3252
+ if (isRoot) {
3253
+ var _a = context, errorThrown = _a.errorThrown, error = _a.error;
3254
+ context = null;
3255
+ if (errorThrown) {
3256
+ throw error;
3257
+ }
3258
+ }
3259
+ }
3260
+ else {
3261
+ cb();
3262
+ }
3263
+ }
3264
+
3265
+ var Subscriber = (function (_super) {
3266
+ __extends(Subscriber, _super);
3267
+ function Subscriber(destination) {
3268
+ var _this = _super.call(this) || this;
3269
+ _this.isStopped = false;
3270
+ if (destination) {
3271
+ _this.destination = destination;
3272
+ if (isSubscription(destination)) {
3273
+ destination.add(_this);
3274
+ }
3275
+ }
3276
+ else {
3277
+ _this.destination = EMPTY_OBSERVER;
3278
+ }
3279
+ return _this;
3280
+ }
3281
+ Subscriber.create = function (next, error, complete) {
3282
+ return new SafeSubscriber(next, error, complete);
3283
+ };
3284
+ Subscriber.prototype.next = function (value) {
3285
+ if (this.isStopped) ;
3286
+ else {
3287
+ this._next(value);
3288
+ }
3289
+ };
3290
+ Subscriber.prototype.error = function (err) {
3291
+ if (this.isStopped) ;
3292
+ else {
3293
+ this.isStopped = true;
3294
+ this._error(err);
3295
+ }
3296
+ };
3297
+ Subscriber.prototype.complete = function () {
3298
+ if (this.isStopped) ;
3299
+ else {
3300
+ this.isStopped = true;
3301
+ this._complete();
3302
+ }
3303
+ };
3304
+ Subscriber.prototype.unsubscribe = function () {
3305
+ if (!this.closed) {
3306
+ this.isStopped = true;
3307
+ _super.prototype.unsubscribe.call(this);
3308
+ this.destination = null;
3309
+ }
3310
+ };
3311
+ Subscriber.prototype._next = function (value) {
3312
+ this.destination.next(value);
3313
+ };
3314
+ Subscriber.prototype._error = function (err) {
3315
+ try {
3316
+ this.destination.error(err);
3317
+ }
3318
+ finally {
3319
+ this.unsubscribe();
3320
+ }
3321
+ };
3322
+ Subscriber.prototype._complete = function () {
3323
+ try {
3324
+ this.destination.complete();
3325
+ }
3326
+ finally {
3327
+ this.unsubscribe();
3328
+ }
3329
+ };
3330
+ return Subscriber;
3331
+ }(Subscription));
3332
+ var SafeSubscriber = (function (_super) {
3333
+ __extends(SafeSubscriber, _super);
3334
+ function SafeSubscriber(observerOrNext, error, complete) {
3335
+ var _this = _super.call(this) || this;
3336
+ var next;
3337
+ if (isFunction$1(observerOrNext)) {
3338
+ next = observerOrNext;
3339
+ }
3340
+ else if (observerOrNext) {
3341
+ (next = observerOrNext.next, error = observerOrNext.error, complete = observerOrNext.complete);
3342
+ var context_1;
3343
+ if (_this && config.useDeprecatedNextContext) {
3344
+ context_1 = Object.create(observerOrNext);
3345
+ context_1.unsubscribe = function () { return _this.unsubscribe(); };
3346
+ }
3347
+ else {
3348
+ context_1 = observerOrNext;
3349
+ }
3350
+ next = next === null || next === void 0 ? void 0 : next.bind(context_1);
3351
+ error = error === null || error === void 0 ? void 0 : error.bind(context_1);
3352
+ complete = complete === null || complete === void 0 ? void 0 : complete.bind(context_1);
3353
+ }
3354
+ _this.destination = {
3355
+ next: next ? wrapForErrorHandling(next) : noop,
3356
+ error: wrapForErrorHandling(error !== null && error !== void 0 ? error : defaultErrorHandler),
3357
+ complete: complete ? wrapForErrorHandling(complete) : noop,
3358
+ };
3359
+ return _this;
3360
+ }
3361
+ return SafeSubscriber;
3362
+ }(Subscriber));
3363
+ function wrapForErrorHandling(handler, instance) {
3364
+ return function () {
3365
+ var args = [];
3366
+ for (var _i = 0; _i < arguments.length; _i++) {
3367
+ args[_i] = arguments[_i];
3368
+ }
3369
+ try {
3370
+ handler.apply(void 0, __spreadArray([], __read(args)));
3371
+ }
3372
+ catch (err) {
3373
+ {
3374
+ reportUnhandledError(err);
3375
+ }
3376
+ }
3377
+ };
3378
+ }
3379
+ function defaultErrorHandler(err) {
3380
+ throw err;
3381
+ }
3382
+ var EMPTY_OBSERVER = {
3383
+ closed: true,
3384
+ next: noop,
3385
+ error: defaultErrorHandler,
3386
+ complete: noop,
3387
+ };
3388
+
3389
+ var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
3390
+
3391
+ function identity(x) {
3392
+ return x;
3393
+ }
3394
+
3395
+ function pipeFromArray(fns) {
3396
+ if (fns.length === 0) {
3397
+ return identity;
3398
+ }
3399
+ if (fns.length === 1) {
3400
+ return fns[0];
3401
+ }
3402
+ return function piped(input) {
3403
+ return fns.reduce(function (prev, fn) { return fn(prev); }, input);
3404
+ };
3405
+ }
3406
+
3407
+ var Observable = (function () {
3408
+ function Observable(subscribe) {
3409
+ if (subscribe) {
3410
+ this._subscribe = subscribe;
3411
+ }
3412
+ }
3413
+ Observable.prototype.lift = function (operator) {
3414
+ var observable = new Observable();
3415
+ observable.source = this;
3416
+ observable.operator = operator;
3417
+ return observable;
3418
+ };
3419
+ Observable.prototype.subscribe = function (observerOrNext, error, complete) {
3420
+ var _this = this;
3421
+ var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
3422
+ errorContext(function () {
3423
+ var _a = _this, operator = _a.operator, source = _a.source;
3424
+ subscriber.add(operator
3425
+ ?
3426
+ operator.call(subscriber, source)
3427
+ : source
3428
+ ?
3429
+ _this._subscribe(subscriber)
3430
+ :
3431
+ _this._trySubscribe(subscriber));
3432
+ });
3433
+ return subscriber;
3434
+ };
3435
+ Observable.prototype._trySubscribe = function (sink) {
3436
+ try {
3437
+ return this._subscribe(sink);
3438
+ }
3439
+ catch (err) {
3440
+ sink.error(err);
3441
+ }
3442
+ };
3443
+ Observable.prototype.forEach = function (next, promiseCtor) {
3444
+ var _this = this;
3445
+ promiseCtor = getPromiseCtor(promiseCtor);
3446
+ return new promiseCtor(function (resolve, reject) {
3447
+ var subscription;
3448
+ subscription = _this.subscribe(function (value) {
3449
+ try {
3450
+ next(value);
3451
+ }
3452
+ catch (err) {
3453
+ reject(err);
3454
+ subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
3455
+ }
3456
+ }, reject, resolve);
3457
+ });
3458
+ };
3459
+ Observable.prototype._subscribe = function (subscriber) {
3460
+ var _a;
3461
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
3462
+ };
3463
+ Observable.prototype[observable] = function () {
3464
+ return this;
3465
+ };
3466
+ Observable.prototype.pipe = function () {
3467
+ var operations = [];
3468
+ for (var _i = 0; _i < arguments.length; _i++) {
3469
+ operations[_i] = arguments[_i];
3470
+ }
3471
+ return pipeFromArray(operations)(this);
3472
+ };
3473
+ Observable.prototype.toPromise = function (promiseCtor) {
3474
+ var _this = this;
3475
+ promiseCtor = getPromiseCtor(promiseCtor);
3476
+ return new promiseCtor(function (resolve, reject) {
3477
+ var value;
3478
+ _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
3479
+ });
3480
+ };
3481
+ Observable.create = function (subscribe) {
3482
+ return new Observable(subscribe);
3483
+ };
3484
+ return Observable;
3485
+ }());
3486
+ function getPromiseCtor(promiseCtor) {
3487
+ var _a;
3488
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
3489
+ }
3490
+ function isObserver(value) {
3491
+ return value && isFunction$1(value.next) && isFunction$1(value.error) && isFunction$1(value.complete);
3492
+ }
3493
+ function isSubscriber(value) {
3494
+ return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
3495
+ }
3496
+
3497
+ var ObjectUnsubscribedError = createErrorClass(function (_super) {
3498
+ return function ObjectUnsubscribedErrorImpl() {
3499
+ _super(this);
3500
+ this.name = 'ObjectUnsubscribedError';
3501
+ this.message = 'object unsubscribed';
3502
+ };
3503
+ });
3504
+
3505
+ var Subject = (function (_super) {
3506
+ __extends(Subject, _super);
3507
+ function Subject() {
3508
+ var _this = _super.call(this) || this;
3509
+ _this.closed = false;
3510
+ _this.observers = [];
3511
+ _this.isStopped = false;
3512
+ _this.hasError = false;
3513
+ _this.thrownError = null;
3514
+ return _this;
3515
+ }
3516
+ Subject.prototype.lift = function (operator) {
3517
+ var subject = new AnonymousSubject(this, this);
3518
+ subject.operator = operator;
3519
+ return subject;
3520
+ };
3521
+ Subject.prototype._throwIfClosed = function () {
3522
+ if (this.closed) {
3523
+ throw new ObjectUnsubscribedError();
3524
+ }
3525
+ };
3526
+ Subject.prototype.next = function (value) {
3527
+ var _this = this;
3528
+ errorContext(function () {
3529
+ var e_1, _a;
3530
+ _this._throwIfClosed();
3531
+ if (!_this.isStopped) {
3532
+ var copy = _this.observers.slice();
3533
+ try {
3534
+ for (var copy_1 = __values(copy), copy_1_1 = copy_1.next(); !copy_1_1.done; copy_1_1 = copy_1.next()) {
3535
+ var observer = copy_1_1.value;
3536
+ observer.next(value);
3537
+ }
3538
+ }
3539
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3540
+ finally {
3541
+ try {
3542
+ if (copy_1_1 && !copy_1_1.done && (_a = copy_1.return)) _a.call(copy_1);
3543
+ }
3544
+ finally { if (e_1) throw e_1.error; }
3545
+ }
3546
+ }
3547
+ });
3548
+ };
3549
+ Subject.prototype.error = function (err) {
3550
+ var _this = this;
3551
+ errorContext(function () {
3552
+ _this._throwIfClosed();
3553
+ if (!_this.isStopped) {
3554
+ _this.hasError = _this.isStopped = true;
3555
+ _this.thrownError = err;
3556
+ var observers = _this.observers;
3557
+ while (observers.length) {
3558
+ observers.shift().error(err);
3559
+ }
3560
+ }
3561
+ });
3562
+ };
3563
+ Subject.prototype.complete = function () {
3564
+ var _this = this;
3565
+ errorContext(function () {
3566
+ _this._throwIfClosed();
3567
+ if (!_this.isStopped) {
3568
+ _this.isStopped = true;
3569
+ var observers = _this.observers;
3570
+ while (observers.length) {
3571
+ observers.shift().complete();
3572
+ }
3573
+ }
3574
+ });
3575
+ };
3576
+ Subject.prototype.unsubscribe = function () {
3577
+ this.isStopped = this.closed = true;
3578
+ this.observers = null;
3579
+ };
3580
+ Object.defineProperty(Subject.prototype, "observed", {
3581
+ get: function () {
3582
+ var _a;
3583
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
3584
+ },
3585
+ enumerable: false,
3586
+ configurable: true
3587
+ });
3588
+ Subject.prototype._trySubscribe = function (subscriber) {
3589
+ this._throwIfClosed();
3590
+ return _super.prototype._trySubscribe.call(this, subscriber);
3591
+ };
3592
+ Subject.prototype._subscribe = function (subscriber) {
3593
+ this._throwIfClosed();
3594
+ this._checkFinalizedStatuses(subscriber);
3595
+ return this._innerSubscribe(subscriber);
3596
+ };
3597
+ Subject.prototype._innerSubscribe = function (subscriber) {
3598
+ var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
3599
+ return hasError || isStopped
3600
+ ? EMPTY_SUBSCRIPTION
3601
+ : (observers.push(subscriber), new Subscription(function () { return arrRemove(observers, subscriber); }));
3602
+ };
3603
+ Subject.prototype._checkFinalizedStatuses = function (subscriber) {
3604
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
3605
+ if (hasError) {
3606
+ subscriber.error(thrownError);
3607
+ }
3608
+ else if (isStopped) {
3609
+ subscriber.complete();
3610
+ }
3611
+ };
3612
+ Subject.prototype.asObservable = function () {
3613
+ var observable = new Observable();
3614
+ observable.source = this;
3615
+ return observable;
3616
+ };
3617
+ Subject.create = function (destination, source) {
3618
+ return new AnonymousSubject(destination, source);
3619
+ };
3620
+ return Subject;
3621
+ }(Observable));
3622
+ var AnonymousSubject = (function (_super) {
3623
+ __extends(AnonymousSubject, _super);
3624
+ function AnonymousSubject(destination, source) {
3625
+ var _this = _super.call(this) || this;
3626
+ _this.destination = destination;
3627
+ _this.source = source;
3628
+ return _this;
3629
+ }
3630
+ AnonymousSubject.prototype.next = function (value) {
3631
+ var _a, _b;
3632
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
3633
+ };
3634
+ AnonymousSubject.prototype.error = function (err) {
3635
+ var _a, _b;
3636
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
3637
+ };
3638
+ AnonymousSubject.prototype.complete = function () {
3639
+ var _a, _b;
3640
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
3641
+ };
3642
+ AnonymousSubject.prototype._subscribe = function (subscriber) {
3643
+ var _a, _b;
3644
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
3645
+ };
3646
+ return AnonymousSubject;
3647
+ }(Subject));
3648
+
3649
+ var es2018 = {};
3650
+
3651
+ var array = {};
3652
+
3653
+ array.isntEmptyArray = array.isEmptyArray = array.isntArray = array.isArray = void 0;
3654
+ function isArray(val) {
3655
+ return Array.isArray(val);
3656
+ }
3657
+ array.isArray = isArray;
3658
+ function isntArray(val) {
3659
+ return !isArray(val);
3660
+ }
3661
+ array.isntArray = isntArray;
3662
+ function isEmptyArray(val) {
3663
+ return val.length === 0;
3664
+ }
3665
+ array.isEmptyArray = isEmptyArray;
3666
+ function isntEmptyArray(val) {
3667
+ return val.length !== 0;
3668
+ }
3669
+ array.isntEmptyArray = isntEmptyArray;
3670
+
3671
+ var asyncIterable = {};
3672
+
3673
+ var _null = {};
3674
+
3675
+ _null.isntNull = _null.isNull = void 0;
3676
+ function isNull(val) {
3677
+ return val === null;
3678
+ }
3679
+ _null.isNull = isNull;
3680
+ function isntNull(val) {
3681
+ return !isNull(val);
3682
+ }
3683
+ _null.isntNull = isntNull;
3684
+
3685
+ var _undefined = {};
3686
+
3687
+ _undefined.isntUndefined = _undefined.isUndefined = void 0;
3688
+ function isUndefined(val) {
3689
+ return val === undefined;
3690
+ }
3691
+ _undefined.isUndefined = isUndefined;
3692
+ function isntUndefined(val) {
3693
+ return !isUndefined(val);
3694
+ }
3695
+ _undefined.isntUndefined = isntUndefined;
3696
+
3697
+ asyncIterable.isntAsyncIterable = asyncIterable.isAsyncIterable = void 0;
3698
+ const null_1$1 = _null;
3699
+ const undefined_1$2 = _undefined;
3700
+ function isAsyncIterable(val) {
3701
+ return (0, null_1$1.isntNull)(val)
3702
+ && (0, undefined_1$2.isntUndefined)(val)
3703
+ && typeof val[Symbol.asyncIterator] === 'function';
3704
+ }
3705
+ asyncIterable.isAsyncIterable = isAsyncIterable;
3706
+ function isntAsyncIterable(val) {
3707
+ return !isAsyncIterable(val);
3708
+ }
3709
+ asyncIterable.isntAsyncIterable = isntAsyncIterable;
3710
+
3711
+ var bigint = {};
3712
+
3713
+ bigint.isntBigInt = bigint.isBigInt = void 0;
3714
+ function isBigInt(val) {
3715
+ return typeof val === 'bigint';
3716
+ }
3717
+ bigint.isBigInt = isBigInt;
3718
+ function isntBigInt(val) {
3719
+ return !isBigInt(val);
3720
+ }
3721
+ bigint.isntBigInt = isntBigInt;
3722
+
3723
+ var boolean = {};
3724
+
3725
+ boolean.isntBoolean = boolean.isBoolean = void 0;
3726
+ function isBoolean(val) {
3727
+ return typeof val === 'boolean';
3728
+ }
3729
+ boolean.isBoolean = isBoolean;
3730
+ function isntBoolean(val) {
3731
+ return !isBoolean(val);
3732
+ }
3733
+ boolean.isntBoolean = isntBoolean;
3734
+
3735
+ var char = {};
3736
+
3737
+ var string = {};
3738
+
3739
+ string.isntString = string.isString = void 0;
3740
+ function isString(val) {
3741
+ return typeof val === 'string';
3742
+ }
3743
+ string.isString = isString;
3744
+ function isntString(val) {
3745
+ return !isString(val);
3746
+ }
3747
+ string.isntString = isntString;
3748
+
3749
+ char.isntChar = char.isChar = void 0;
3750
+ const string_1$1 = string;
3751
+ function isChar(val) {
3752
+ return (0, string_1$1.isString)(val)
3753
+ && val.length === 1;
3754
+ }
3755
+ char.isChar = isChar;
3756
+ function isntChar(val) {
3757
+ return !isChar(val);
3758
+ }
3759
+ char.isntChar = isntChar;
3760
+
3761
+ var date = {};
3762
+
3763
+ date.isntDate = date.isDate = void 0;
3764
+ function isDate(val) {
3765
+ return val instanceof Date;
3766
+ }
3767
+ date.isDate = isDate;
3768
+ function isntDate(val) {
3769
+ return !isDate(val);
3770
+ }
3771
+ date.isntDate = isntDate;
3772
+
3773
+ var _enum = {};
3774
+
3775
+ _enum.inEnum = void 0;
3776
+ function inEnum(val, _enum) {
3777
+ return Object.values(_enum).includes(val);
3778
+ }
3779
+ _enum.inEnum = inEnum;
3780
+
3781
+ var error = {};
3782
+
3783
+ error.isntError = error.isError = void 0;
3784
+ function isError(val) {
3785
+ return val instanceof Error;
3786
+ }
3787
+ error.isError = isError;
3788
+ function isntError(val) {
3789
+ return !isError(val);
3790
+ }
3791
+ error.isntError = isntError;
3792
+
3793
+ var falsy = {};
3794
+
3795
+ falsy.isntFalsy = falsy.isFalsy = void 0;
3796
+ function isFalsy(val) {
3797
+ return !val;
3798
+ }
3799
+ falsy.isFalsy = isFalsy;
3800
+ function isntFalsy(val) {
3801
+ return !isFalsy(val);
3802
+ }
3803
+ falsy.isntFalsy = isntFalsy;
3804
+
3805
+ var _function = {};
3806
+
3807
+ _function.isntFunction = _function.isFunction = void 0;
3808
+ function isFunction(val) {
3809
+ return typeof val === 'function';
3810
+ }
3811
+ _function.isFunction = isFunction;
3812
+ function isntFunction(val) {
3813
+ return !isFunction(val);
3814
+ }
3815
+ _function.isntFunction = isntFunction;
3816
+
3817
+ var iterable = {};
3818
+
3819
+ iterable.isntIterable = iterable.isIterable = void 0;
3820
+ const null_1 = _null;
3821
+ const undefined_1$1 = _undefined;
3822
+ function isIterable(val) {
3823
+ return (0, null_1.isntNull)(val)
3824
+ && (0, undefined_1$1.isntUndefined)(val)
3825
+ && typeof val[Symbol.iterator] === 'function';
3826
+ }
3827
+ iterable.isIterable = isIterable;
3828
+ function isntIterable(val) {
3829
+ return !isIterable(val);
3830
+ }
3831
+ iterable.isntIterable = isntIterable;
3832
+
3833
+ var jsonRpc = {};
3834
+
3835
+ var object = {};
3836
+
3837
+ object.isntEmptyObject = object.isEmptyObject = object.isRecord = object.isntObject = object.isObject = void 0;
3838
+ function isObject(val) {
3839
+ return val !== null && typeof val === 'object';
3840
+ }
3841
+ object.isObject = isObject;
3842
+ function isntObject(val) {
3843
+ return !isObject(val);
3844
+ }
3845
+ object.isntObject = isntObject;
3846
+ function isRecord(val) {
3847
+ return isObject(val);
3848
+ }
3849
+ object.isRecord = isRecord;
3850
+ function isEmptyObject(val) {
3851
+ return Object.keys(val).length === 0;
3852
+ }
3853
+ object.isEmptyObject = isEmptyObject;
3854
+ function isntEmptyObject(val) {
3855
+ return Object.keys(val).length !== 0;
3856
+ }
3857
+ object.isntEmptyObject = isntEmptyObject;
3858
+
3859
+ var number = {};
3860
+
3861
+ number.isntNumber = number.isNumber = void 0;
3862
+ function isNumber(val) {
3863
+ return typeof val === 'number';
3864
+ }
3865
+ number.isNumber = isNumber;
3866
+ function isntNumber(val) {
3867
+ return !isNumber(val);
3868
+ }
3869
+ number.isntNumber = isntNumber;
3870
+
3871
+ jsonRpc.isntJsonRpcError = jsonRpc.isJsonRpcError = jsonRpc.isntJsonRpcSuccess = jsonRpc.isJsonRpcSuccess = jsonRpc.isntJsonRpcRequest = jsonRpc.isJsonRpcRequest = jsonRpc.isntJsonRpcNotification = jsonRpc.isJsonRpcNotification = void 0;
3872
+ const array_1 = array;
3873
+ const object_1 = object;
3874
+ const string_1 = string;
3875
+ const number_1 = number;
3876
+ const undefined_1 = _undefined;
3877
+ function isJsonRpcId(val) {
3878
+ return (0, string_1.isString)(val) || (0, number_1.isNumber)(val);
3879
+ }
3880
+ function isJsonRpcParams(val) {
3881
+ return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
3882
+ }
3883
+ function isJsonRpcNotification(val) {
3884
+ return (0, object_1.isRecord)(val)
3885
+ && (0, string_1.isString)(val.jsonrpc)
3886
+ && (0, string_1.isString)(val.method)
3887
+ && (0, undefined_1.isUndefined)(val.id)
3888
+ && isJsonRpcParams(val.params);
3889
+ }
3890
+ jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
3891
+ function isntJsonRpcNotification(val) {
3892
+ return !isJsonRpcNotification(val);
3893
+ }
3894
+ jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
3895
+ function isJsonRpcRequest(val) {
3896
+ return (0, object_1.isRecord)(val)
3897
+ && (0, string_1.isString)(val.jsonrpc)
3898
+ && (0, string_1.isString)(val.method)
3899
+ && isJsonRpcId(val.id)
3900
+ && isJsonRpcParams(val.params);
3901
+ }
3902
+ jsonRpc.isJsonRpcRequest = isJsonRpcRequest;
3903
+ function isntJsonRpcRequest(val) {
3904
+ return !isJsonRpcRequest(val);
3905
+ }
3906
+ jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
3907
+ function isJsonRpcSuccess(val) {
3908
+ return (0, object_1.isRecord)(val)
3909
+ && (0, string_1.isString)(val.jsonrpc)
3910
+ && (0, string_1.isString)(val.id)
3911
+ && 'result' in val;
3912
+ }
3913
+ jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
3914
+ function isntJsonRpcSuccess(val) {
3915
+ return !isJsonRpcSuccess(val);
3916
+ }
3917
+ jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
3918
+ function isJsonRpcError(val) {
3919
+ return (0, object_1.isRecord)(val)
3920
+ && (0, string_1.isString)(val.jsonrpc)
3921
+ && isJsonRpcId(val.id)
3922
+ && isJsonRpcErrorObject(val.error);
3923
+ }
3924
+ jsonRpc.isJsonRpcError = isJsonRpcError;
3925
+ function isntJsonRpcError(val) {
3926
+ return !isJsonRpcError(val);
3927
+ }
3928
+ jsonRpc.isntJsonRpcError = isntJsonRpcError;
3929
+ function isJsonRpcErrorObject(val) {
3930
+ return (0, object_1.isRecord)(val)
3931
+ && (0, number_1.isNumber)(val.code)
3932
+ && (0, string_1.isString)(val.message)
3933
+ && ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));
3934
+ }
3935
+
3936
+ var json = {};
3937
+
3938
+ json.isntJson = json.isJson = void 0;
3939
+ function isJson(val) {
3940
+ try {
3941
+ JSON.stringify(val);
3942
+ return true;
3943
+ }
3944
+ catch (_a) {
3945
+ return false;
3946
+ }
3947
+ }
3948
+ json.isJson = isJson;
3949
+ function isntJson(val) {
3950
+ return !isntJson();
3951
+ }
3952
+ json.isntJson = isntJson;
3953
+
3954
+ var url = {};
3955
+
3956
+ url.isAbsoluteURL = void 0;
3957
+ function isAbsoluteURL(str) {
3958
+ try {
3959
+ new URL(str);
3960
+ return true;
3961
+ }
3962
+ catch (_a) {
3963
+ return false;
3964
+ }
3965
+ }
3966
+ url.isAbsoluteURL = isAbsoluteURL;
3967
+
3968
+ (function (exports) {
3969
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3970
+ if (k2 === undefined) k2 = k;
3971
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3972
+ }) : (function(o, m, k, k2) {
3973
+ if (k2 === undefined) k2 = k;
3974
+ o[k2] = m[k];
3975
+ }));
3976
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3977
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3978
+ };__exportStar(array, exports);
3979
+ __exportStar(asyncIterable, exports);
3980
+ __exportStar(bigint, exports);
3981
+ __exportStar(boolean, exports);
3982
+ __exportStar(char, exports);
3983
+ __exportStar(date, exports);
3984
+ __exportStar(_enum, exports);
3985
+ __exportStar(error, exports);
3986
+ __exportStar(falsy, exports);
3987
+ __exportStar(_function, exports);
3988
+ __exportStar(iterable, exports);
3989
+ __exportStar(jsonRpc, exports);
3990
+ __exportStar(json, exports);
3991
+ __exportStar(_null, exports);
3992
+ __exportStar(number, exports);
3993
+ __exportStar(object, exports);
3994
+ __exportStar(string, exports);
3995
+ __exportStar(_undefined, exports);
3996
+ __exportStar(url, exports);
3997
+
3998
+ }(es2018));
3999
+
4000
+ class ObservableFiniteStateMachine extends FiniteStateMachine {
4001
+ constructor() {
4002
+ super(...arguments);
4003
+ this.stateChanges = new Subject();
4004
+ }
4005
+ observeStateChanges() {
4006
+ return this.stateChanges;
4007
+ }
4008
+ /**
4009
+ * @throws {BadEventError}
4010
+ */
4011
+ send(event) {
4012
+ const oldState = this.state;
4013
+ super.send(event);
4014
+ const newState = this.state;
4015
+ this.stateChanges.next({ event, oldState, newState });
4016
+ if (es2018.isEmptyObject(this.schema[newState])) {
4017
+ this.stateChanges.complete();
4018
+ }
4019
+ }
4020
+ }
4021
+
4022
+ export { BadEventError, Box, Emitter, ExpirableMap, FiniteStateMachine, HashMap, HashSet, LRUMap, ObservableFiniteStateMachine, Queue, TLRUMap, TrieMap, convertArrayToCons, convertConsToArray };
2850
4023
  //# sourceMappingURL=index.mjs.map