@blackglory/structures 0.2.3 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +41 -11
  3. package/dist/es2015/index.min.mjs +2 -2
  4. package/dist/es2015/index.min.mjs.map +1 -1
  5. package/dist/es2015/index.mjs +673 -273
  6. package/dist/es2015/index.mjs.map +1 -1
  7. package/dist/es2015/index.umd.js +677 -274
  8. package/dist/es2015/index.umd.js.map +1 -1
  9. package/dist/es2015/index.umd.min.js +2 -3
  10. package/dist/es2015/index.umd.min.js.map +1 -1
  11. package/dist/es2018/index.min.mjs +2 -2
  12. package/dist/es2018/index.min.mjs.map +1 -1
  13. package/dist/es2018/index.mjs +673 -273
  14. package/dist/es2018/index.mjs.map +1 -1
  15. package/dist/es2018/index.umd.js +677 -274
  16. package/dist/es2018/index.umd.js.map +1 -1
  17. package/dist/es2018/index.umd.min.js +2 -3
  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 +18 -0
  23. package/lib/es2015/expirable-map.js +109 -0
  24. package/lib/es2015/expirable-map.js.map +1 -0
  25. package/lib/es2015/index.d.ts +3 -0
  26. package/lib/es2015/index.js +3 -0
  27. package/lib/es2015/index.js.map +1 -1
  28. package/lib/es2015/lru-map.js +4 -3
  29. package/lib/es2015/lru-map.js.map +1 -1
  30. package/lib/es2015/tlru-map.d.ts +21 -0
  31. package/lib/es2015/tlru-map.js +138 -0
  32. package/lib/es2015/tlru-map.js.map +1 -0
  33. package/lib/es2015/trie-map.js +1 -1
  34. package/lib/es2015/trie-map.js.map +1 -1
  35. package/lib/es2018/box.d.ts +6 -0
  36. package/lib/es2018/box.js +30 -0
  37. package/lib/es2018/box.js.map +1 -0
  38. package/lib/es2018/expirable-map.d.ts +18 -0
  39. package/lib/es2018/expirable-map.js +109 -0
  40. package/lib/es2018/expirable-map.js.map +1 -0
  41. package/lib/es2018/index.d.ts +3 -0
  42. package/lib/es2018/index.js +3 -0
  43. package/lib/es2018/index.js.map +1 -1
  44. package/lib/es2018/lru-map.js +4 -3
  45. package/lib/es2018/lru-map.js.map +1 -1
  46. package/lib/es2018/tlru-map.d.ts +21 -0
  47. package/lib/es2018/tlru-map.js +138 -0
  48. package/lib/es2018/tlru-map.js.map +1 -0
  49. package/lib/es2018/trie-map.js +1 -1
  50. package/lib/es2018/trie-map.js.map +1 -1
  51. package/package.json +25 -23
@@ -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$3 = {};
181
+ var es2018$5 = {};
167
182
 
168
183
  var customError = {};
169
184
 
@@ -241,73 +256,15 @@ __exportStar(normalize$1, exports);
241
256
  __exportStar(refute$1, exports);
242
257
  __exportStar(assert$1, exports);
243
258
 
244
- }(es2018$3));
259
+ }(es2018$5));
245
260
 
246
- var _LRUMap_limit, _LRUMap_map;
247
- class LRUMap {
248
- constructor(limit) {
249
- _LRUMap_limit.set(this, void 0);
250
- _LRUMap_map.set(this, new Map());
251
- es2018$3.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
252
- es2018$3.assert(limit > 0, 'The parameter limit must be a positive value');
253
- __classPrivateFieldSet(this, _LRUMap_limit, limit, "f");
254
- }
255
- get [(_LRUMap_limit = new WeakMap(), _LRUMap_map = new WeakMap(), Symbol.toStringTag)]() {
256
- return this.constructor.name;
257
- }
258
- get size() {
259
- return __classPrivateFieldGet(this, _LRUMap_map, "f").size;
260
- }
261
- set(key, value) {
262
- if (__classPrivateFieldGet(this, _LRUMap_map, "f").has(key)) {
263
- this.updateItem(key, value);
264
- }
265
- else {
266
- if (__classPrivateFieldGet(this, _LRUMap_map, "f").size === __classPrivateFieldGet(this, _LRUMap_limit, "f")) {
267
- __classPrivateFieldGet(this, _LRUMap_map, "f").delete(this.getColdestKey());
268
- }
269
- __classPrivateFieldGet(this, _LRUMap_map, "f").set(key, value);
270
- }
271
- return this;
272
- }
273
- has(key) {
274
- return __classPrivateFieldGet(this, _LRUMap_map, "f").has(key);
275
- }
276
- get(key) {
277
- if (!this.has(key))
278
- return undefined;
279
- const value = __classPrivateFieldGet(this, _LRUMap_map, "f").get(key);
280
- this.updateItem(key, value);
281
- return value;
282
- }
283
- delete(key) {
284
- return __classPrivateFieldGet(this, _LRUMap_map, "f").delete(key);
285
- }
286
- clear() {
287
- __classPrivateFieldGet(this, _LRUMap_map, "f").clear();
288
- }
289
- /**
290
- * Reinsert the item.
291
- */
292
- updateItem(key, value) {
293
- __classPrivateFieldGet(this, _LRUMap_map, "f").delete(key);
294
- __classPrivateFieldGet(this, _LRUMap_map, "f").set(key, value);
295
- }
296
- /**
297
- * Return the earliest key inserted in the Map
298
- */
299
- getColdestKey() {
300
- return __classPrivateFieldGet(this, _LRUMap_map, "f").keys().next().value;
301
- }
302
- }
303
-
304
- var es2018$2 = {};
261
+ var es2018$4 = {};
305
262
 
306
263
  var middleware = {};
307
264
 
308
265
  var chunkAsync$1 = {};
309
266
 
310
- var es2018$1 = {};
267
+ var es2018$3 = {};
311
268
 
312
269
  var go$1 = {};
313
270
 
@@ -329,15 +286,15 @@ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m
329
286
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
330
287
  };__exportStar(go$1, exports);
331
288
 
332
- }(es2018$1));
289
+ }(es2018$3));
333
290
 
334
291
  chunkAsync$1.chunkAsync = void 0;
335
- const go_1$f = es2018$1;
336
- const errors_1$f = es2018$3;
292
+ const go_1$f = es2018$3;
293
+ const errors_1$f = es2018$5;
337
294
  function chunkAsync(iterable, size) {
338
- errors_1$f.assert(Number.isInteger(size), 'The parameter size must be an integer');
339
- errors_1$f.assert(size > 0, 'The parameter size must be greater than 0');
340
- 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* () {
341
298
  let buffer = [];
342
299
  for await (const element of iterable) {
343
300
  buffer.push(element);
@@ -354,7 +311,7 @@ chunkAsync$1.chunkAsync = chunkAsync;
354
311
 
355
312
  var chunkByAsync$1 = {};
356
313
 
357
- var es2018 = {};
314
+ var es2018$2 = {};
358
315
 
359
316
  var array = {};
360
317
 
@@ -406,8 +363,8 @@ asyncIterable.isntAsyncIterable = asyncIterable.isAsyncIterable = void 0;
406
363
  const null_1$1 = _null;
407
364
  const undefined_1$2 = _undefined;
408
365
  function isAsyncIterable(val) {
409
- return null_1$1.isntNull(val)
410
- && undefined_1$2.isntUndefined(val)
366
+ return (0, null_1$1.isntNull)(val)
367
+ && (0, undefined_1$2.isntUndefined)(val)
411
368
  && typeof val[Symbol.asyncIterator] === 'function';
412
369
  }
413
370
  asyncIterable.isAsyncIterable = isAsyncIterable;
@@ -444,36 +401,20 @@ var char = {};
444
401
 
445
402
  var string = {};
446
403
 
447
- string.isntStringObject = string.isStringObject = string.isntStringPrimitive = string.isStringPrimitive = string.isntString = string.isString = void 0;
404
+ string.isntString = string.isString = void 0;
448
405
  function isString(val) {
449
- return isStringPrimitive(val) || isStringObject(val);
406
+ return typeof val === 'string';
450
407
  }
451
408
  string.isString = isString;
452
409
  function isntString(val) {
453
410
  return !isString(val);
454
411
  }
455
412
  string.isntString = isntString;
456
- function isStringPrimitive(val) {
457
- return typeof val === 'string';
458
- }
459
- string.isStringPrimitive = isStringPrimitive;
460
- function isntStringPrimitive(val) {
461
- return !isStringPrimitive(val);
462
- }
463
- string.isntStringPrimitive = isntStringPrimitive;
464
- function isStringObject(val) {
465
- return typeof val === 'object' && val instanceof String;
466
- }
467
- string.isStringObject = isStringObject;
468
- function isntStringObject(val) {
469
- return !isStringObject(val);
470
- }
471
- string.isntStringObject = isntStringObject;
472
413
 
473
- char.isntCharObject = char.isCharObject = char.isntCharPrimitive = char.isCharPrimitive = char.isntChar = char.isChar = void 0;
414
+ char.isntChar = char.isChar = void 0;
474
415
  const string_1$1 = string;
475
416
  function isChar(val) {
476
- return (string_1$1.isString(val) || string_1$1.isStringObject(val))
417
+ return (0, string_1$1.isString)(val)
477
418
  && val.length === 1;
478
419
  }
479
420
  char.isChar = isChar;
@@ -481,24 +422,6 @@ function isntChar(val) {
481
422
  return !isChar(val);
482
423
  }
483
424
  char.isntChar = isntChar;
484
- function isCharPrimitive(val) {
485
- return string_1$1.isString(val)
486
- && val.length === 1;
487
- }
488
- char.isCharPrimitive = isCharPrimitive;
489
- function isntCharPrimitive(val) {
490
- return !isCharPrimitive(val);
491
- }
492
- char.isntCharPrimitive = isntCharPrimitive;
493
- function isCharObject(val) {
494
- return string_1$1.isStringObject(val)
495
- && val.length === 1;
496
- }
497
- char.isCharObject = isCharObject;
498
- function isntCharObject(val) {
499
- return !isCharObject(val);
500
- }
501
- char.isntCharObject = isntCharObject;
502
425
 
503
426
  var date = {};
504
427
 
@@ -520,6 +443,18 @@ function inEnum(val, _enum) {
520
443
  }
521
444
  _enum.inEnum = inEnum;
522
445
 
446
+ var error = {};
447
+
448
+ error.isntError = error.isError = void 0;
449
+ function isError(val) {
450
+ return val instanceof Error;
451
+ }
452
+ error.isError = isError;
453
+ function isntError(val) {
454
+ return !isError(val);
455
+ }
456
+ error.isntError = isntError;
457
+
523
458
  var falsy = {};
524
459
 
525
460
  falsy.isntFalsy = falsy.isFalsy = void 0;
@@ -550,8 +485,8 @@ iterable.isntIterable = iterable.isIterable = void 0;
550
485
  const null_1 = _null;
551
486
  const undefined_1$1 = _undefined;
552
487
  function isIterable(val) {
553
- return null_1.isntNull(val)
554
- && undefined_1$1.isntUndefined(val)
488
+ return (0, null_1.isntNull)(val)
489
+ && (0, undefined_1$1.isntUndefined)(val)
555
490
  && typeof val[Symbol.iterator] === 'function';
556
491
  }
557
492
  iterable.isIterable = isIterable;
@@ -605,16 +540,16 @@ const string_1 = string;
605
540
  const number_1 = number;
606
541
  const undefined_1 = _undefined;
607
542
  function isJsonRpcId(val) {
608
- return string_1.isString(val) || number_1.isNumber(val);
543
+ return (0, string_1.isString)(val) || (0, number_1.isNumber)(val);
609
544
  }
610
545
  function isJsonRpcParams(val) {
611
- return array_1.isArray(val) || object_1.isObject(val);
546
+ return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
612
547
  }
613
548
  function isJsonRpcNotification(val) {
614
- return object_1.isRecord(val)
615
- && string_1.isString(val.jsonrpc)
616
- && string_1.isString(val.method)
617
- && undefined_1.isUndefined(val.id)
549
+ return (0, object_1.isRecord)(val)
550
+ && (0, string_1.isString)(val.jsonrpc)
551
+ && (0, string_1.isString)(val.method)
552
+ && (0, undefined_1.isUndefined)(val.id)
618
553
  && isJsonRpcParams(val.params);
619
554
  }
620
555
  jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
@@ -623,9 +558,9 @@ function isntJsonRpcNotification(val) {
623
558
  }
624
559
  jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
625
560
  function isJsonRpcRequest(val) {
626
- return object_1.isRecord(val)
627
- && string_1.isString(val.jsonrpc)
628
- && string_1.isString(val.method)
561
+ return (0, object_1.isRecord)(val)
562
+ && (0, string_1.isString)(val.jsonrpc)
563
+ && (0, string_1.isString)(val.method)
629
564
  && isJsonRpcId(val.id)
630
565
  && isJsonRpcParams(val.params);
631
566
  }
@@ -635,10 +570,10 @@ function isntJsonRpcRequest(val) {
635
570
  }
636
571
  jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
637
572
  function isJsonRpcSuccess(val) {
638
- return object_1.isRecord(val)
639
- && string_1.isString(val.jsonrpc)
640
- && string_1.isString(val.id)
641
- && undefined_1.isntUndefined(val.result);
573
+ return (0, object_1.isRecord)(val)
574
+ && (0, string_1.isString)(val.jsonrpc)
575
+ && (0, string_1.isString)(val.id)
576
+ && (0, undefined_1.isntUndefined)(val.result);
642
577
  }
643
578
  jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
644
579
  function isntJsonRpcSuccess(val) {
@@ -646,8 +581,8 @@ function isntJsonRpcSuccess(val) {
646
581
  }
647
582
  jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
648
583
  function isJsonRpcError(val) {
649
- return object_1.isRecord(val)
650
- && string_1.isString(val.jsonrpc)
584
+ return (0, object_1.isRecord)(val)
585
+ && (0, string_1.isString)(val.jsonrpc)
651
586
  && isJsonRpcId(val.id)
652
587
  && isJsonRpcErrorObject(val.error);
653
588
  }
@@ -657,10 +592,10 @@ function isntJsonRpcError(val) {
657
592
  }
658
593
  jsonRpc.isntJsonRpcError = isntJsonRpcError;
659
594
  function isJsonRpcErrorObject(val) {
660
- return object_1.isRecord(val)
661
- && number_1.isNumber(val.code)
662
- && string_1.isString(val.message)
663
- && (undefined_1.isUndefined(val.data) || object_1.isObject(val.data));
595
+ return (0, object_1.isRecord)(val)
596
+ && (0, number_1.isNumber)(val.code)
597
+ && (0, string_1.isString)(val.message)
598
+ && ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));
664
599
  }
665
600
 
666
601
  var json = {};
@@ -712,6 +647,7 @@ __exportStar(boolean, exports);
712
647
  __exportStar(char, exports);
713
648
  __exportStar(date, exports);
714
649
  __exportStar(_enum, exports);
650
+ __exportStar(error, exports);
715
651
  __exportStar(falsy, exports);
716
652
  __exportStar(_function, exports);
717
653
  __exportStar(iterable, exports);
@@ -724,12 +660,12 @@ __exportStar(string, exports);
724
660
  __exportStar(_undefined, exports);
725
661
  __exportStar(url, exports);
726
662
 
727
- }(es2018));
663
+ }(es2018$2));
728
664
 
729
665
  chunkByAsync$1.chunkByAsync = void 0;
730
- const types_1$h = es2018;
666
+ const types_1$h = es2018$2;
731
667
  function chunkByAsync(iterable, predicate) {
732
- if (types_1$h.isAsyncIterable(iterable)) {
668
+ if ((0, types_1$h.isAsyncIterable)(iterable)) {
733
669
  return chunkByAsyncIterable(iterable);
734
670
  }
735
671
  else {
@@ -788,12 +724,12 @@ chunkBy$1.chunkBy = chunkBy;
788
724
  var chunk$1 = {};
789
725
 
790
726
  chunk$1.chunk = void 0;
791
- const go_1$e = es2018$1;
792
- const errors_1$e = es2018$3;
727
+ const go_1$e = es2018$3;
728
+ const errors_1$e = es2018$5;
793
729
  function chunk(iterable, size) {
794
- errors_1$e.assert(Number.isInteger(size), 'The parameter size must be an integer');
795
- errors_1$e.assert(size > 0, 'The parameter size must be greater than 0');
796
- 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* () {
797
733
  let buffer = [];
798
734
  for (const element of iterable) {
799
735
  buffer.push(element);
@@ -811,12 +747,12 @@ chunk$1.chunk = chunk;
811
747
  var concatAsync$1 = {};
812
748
 
813
749
  concatAsync$1.concatAsync = void 0;
814
- const types_1$g = es2018;
815
- const go_1$d = es2018$1;
750
+ const types_1$g = es2018$2;
751
+ const go_1$d = es2018$3;
816
752
  function concatAsync(iterable, ...otherIterables) {
817
- return go_1$d.go(async function* () {
753
+ return (0, go_1$d.go)(async function* () {
818
754
  for (const iter of [iterable, ...otherIterables]) {
819
- if (types_1$g.isAsyncIterable(iter)) {
755
+ if ((0, types_1$g.isAsyncIterable)(iter)) {
820
756
  for await (const element of iter) {
821
757
  yield element;
822
758
  }
@@ -834,9 +770,9 @@ concatAsync$1.concatAsync = concatAsync;
834
770
  var concat$1 = {};
835
771
 
836
772
  concat$1.concat = void 0;
837
- const go_1$c = es2018$1;
773
+ const go_1$c = es2018$3;
838
774
  function concat(iterable, ...otherIterables) {
839
- return go_1$c.go(function* () {
775
+ return (0, go_1$c.go)(function* () {
840
776
  for (const iter of [iterable, ...otherIterables]) {
841
777
  yield* iter;
842
778
  }
@@ -863,15 +799,15 @@ function* copyIterable(iterable) {
863
799
  utils.copyIterable = copyIterable;
864
800
 
865
801
  dropAsync$1.dropAsync = void 0;
866
- const go_1$b = es2018$1;
802
+ const go_1$b = es2018$3;
867
803
  const utils_1$3 = utils;
868
- const errors_1$d = es2018$3;
804
+ const errors_1$d = es2018$5;
869
805
  function dropAsync(iterable, count) {
870
- errors_1$d.assert(Number.isInteger(count), 'The parameter count must be an integer');
871
- 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');
872
808
  if (count === 0)
873
- return utils_1$3.copyAsyncIterable(iterable);
874
- return go_1$b.go(async function* () {
809
+ return (0, utils_1$3.copyAsyncIterable)(iterable);
810
+ return (0, go_1$b.go)(async function* () {
875
811
  var _a;
876
812
  const iterator = iterable[Symbol.asyncIterator]();
877
813
  let done;
@@ -898,15 +834,15 @@ dropAsync$1.dropAsync = dropAsync;
898
834
  var dropRightAsync$1 = {};
899
835
 
900
836
  dropRightAsync$1.dropRightAsync = void 0;
901
- const go_1$a = es2018$1;
837
+ const go_1$a = es2018$3;
902
838
  const utils_1$2 = utils;
903
- const errors_1$c = es2018$3;
839
+ const errors_1$c = es2018$5;
904
840
  function dropRightAsync(iterable, count) {
905
- errors_1$c.assert(Number.isInteger(count), 'The parameter count must be an integer');
906
- 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');
907
843
  if (count === 0)
908
- return utils_1$2.copyAsyncIterable(iterable);
909
- return go_1$a.go(async function* () {
844
+ return (0, utils_1$2.copyAsyncIterable)(iterable);
845
+ return (0, go_1$a.go)(async function* () {
910
846
  const arr = await toArrayAsync$2(iterable);
911
847
  const result = arr.slice(0, -count);
912
848
  for (const value of result) {
@@ -926,15 +862,15 @@ async function toArrayAsync$2(iterable) {
926
862
  var dropRight$1 = {};
927
863
 
928
864
  dropRight$1.dropRight = void 0;
929
- const go_1$9 = es2018$1;
865
+ const go_1$9 = es2018$3;
930
866
  const utils_1$1 = utils;
931
- const errors_1$b = es2018$3;
867
+ const errors_1$b = es2018$5;
932
868
  function dropRight(iterable, count) {
933
- errors_1$b.assert(Number.isInteger(count), 'The parameter count must be an integer');
934
- 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');
935
871
  if (count === 0)
936
- return utils_1$1.copyIterable(iterable);
937
- return go_1$9.go(function* () {
872
+ return (0, utils_1$1.copyIterable)(iterable);
873
+ return (0, go_1$9.go)(function* () {
938
874
  const arr = Array.from(iterable);
939
875
  yield* arr.slice(0, -count);
940
876
  });
@@ -944,9 +880,9 @@ dropRight$1.dropRight = dropRight;
944
880
  var dropUntilAsync$1 = {};
945
881
 
946
882
  dropUntilAsync$1.dropUntilAsync = void 0;
947
- const types_1$f = es2018;
883
+ const types_1$f = es2018$2;
948
884
  function dropUntilAsync(iterable, predicate) {
949
- if (types_1$f.isAsyncIterable(iterable)) {
885
+ if ((0, types_1$f.isAsyncIterable)(iterable)) {
950
886
  return dropUntilAsyncIterable(iterable);
951
887
  }
952
888
  else {
@@ -1026,15 +962,15 @@ dropUntil$1.dropUntil = dropUntil;
1026
962
  var drop$1 = {};
1027
963
 
1028
964
  drop$1.drop = void 0;
1029
- const go_1$8 = es2018$1;
965
+ const go_1$8 = es2018$3;
1030
966
  const utils_1 = utils;
1031
- const errors_1$a = es2018$3;
967
+ const errors_1$a = es2018$5;
1032
968
  function drop(iterable, count) {
1033
- errors_1$a.assert(Number.isInteger(count), 'The parameter count must be an integer');
1034
- 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');
1035
971
  if (count === 0)
1036
- return utils_1.copyIterable(iterable);
1037
- return go_1$8.go(function* () {
972
+ return (0, utils_1.copyIterable)(iterable);
973
+ return (0, go_1$8.go)(function* () {
1038
974
  var _a;
1039
975
  const iterator = iterable[Symbol.iterator]();
1040
976
  let done;
@@ -1061,9 +997,9 @@ drop$1.drop = drop;
1061
997
  var filterAsync$1 = {};
1062
998
 
1063
999
  filterAsync$1.filterAsync = void 0;
1064
- const types_1$e = es2018;
1000
+ const types_1$e = es2018$2;
1065
1001
  function filterAsync(iterable, predicate) {
1066
- if (types_1$e.isAsyncIterable(iterable)) {
1002
+ if ((0, types_1$e.isAsyncIterable)(iterable)) {
1067
1003
  return filterAsyncIterable(iterable);
1068
1004
  }
1069
1005
  else {
@@ -1108,9 +1044,9 @@ var flattenDeepAsync$1 = {};
1108
1044
  var flattenByAsync$1 = {};
1109
1045
 
1110
1046
  flattenByAsync$1.flattenByAsync = void 0;
1111
- const types_1$d = es2018;
1047
+ const types_1$d = es2018$2;
1112
1048
  function flattenByAsync(iterable, predicate) {
1113
- if (types_1$d.isAsyncIterable(iterable)) {
1049
+ if ((0, types_1$d.isAsyncIterable)(iterable)) {
1114
1050
  return flattenByAsyncIterable(iterable);
1115
1051
  }
1116
1052
  else {
@@ -1143,30 +1079,30 @@ function flattenByAsync(iterable, predicate) {
1143
1079
  }
1144
1080
  flattenByAsync$1.flattenByAsync = flattenByAsync;
1145
1081
  function isFiniteIterable$1(val) {
1146
- 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);
1147
1083
  }
1148
1084
 
1149
1085
  flattenDeepAsync$1.flattenDeepAsync = void 0;
1150
1086
  const flatten_by_async_1 = flattenByAsync$1;
1151
- const errors_1$9 = es2018$3;
1087
+ const errors_1$9 = es2018$5;
1152
1088
  function flattenDeepAsync(iterable, depth = Infinity) {
1153
- errors_1$9.assert(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1154
- errors_1$9.assert(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1155
- 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);
1156
1092
  }
1157
1093
  flattenDeepAsync$1.flattenDeepAsync = flattenDeepAsync;
1158
1094
 
1159
1095
  flattenAsync$1.flattenAsync = void 0;
1160
1096
  const flatten_deep_async_1 = flattenDeepAsync$1;
1161
1097
  function flattenAsync(iterable) {
1162
- return flatten_deep_async_1.flattenDeepAsync(iterable, 1);
1098
+ return (0, flatten_deep_async_1.flattenDeepAsync)(iterable, 1);
1163
1099
  }
1164
1100
  flattenAsync$1.flattenAsync = flattenAsync;
1165
1101
 
1166
1102
  var flattenBy$1 = {};
1167
1103
 
1168
1104
  flattenBy$1.flattenBy = void 0;
1169
- const types_1$c = es2018;
1105
+ const types_1$c = es2018$2;
1170
1106
  function flattenBy(iterable, predicate) {
1171
1107
  return flatten(iterable, 1);
1172
1108
  function* flatten(iterable, level) {
@@ -1182,18 +1118,18 @@ function flattenBy(iterable, predicate) {
1182
1118
  }
1183
1119
  flattenBy$1.flattenBy = flattenBy;
1184
1120
  function isFiniteIterable(val) {
1185
- 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);
1186
1122
  }
1187
1123
 
1188
1124
  var flattenDeep$1 = {};
1189
1125
 
1190
1126
  flattenDeep$1.flattenDeep = void 0;
1191
1127
  const flatten_by_1 = flattenBy$1;
1192
- const errors_1$8 = es2018$3;
1128
+ const errors_1$8 = es2018$5;
1193
1129
  function flattenDeep(iterable, depth = Infinity) {
1194
- errors_1$8.assert(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1195
- errors_1$8.assert(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1196
- 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);
1197
1133
  }
1198
1134
  flattenDeep$1.flattenDeep = flattenDeep;
1199
1135
 
@@ -1202,16 +1138,16 @@ var flatten$1 = {};
1202
1138
  flatten$1.flatten = void 0;
1203
1139
  const flatten_deep_1 = flattenDeep$1;
1204
1140
  function flatten(iterable) {
1205
- return flatten_deep_1.flattenDeep(iterable, 1);
1141
+ return (0, flatten_deep_1.flattenDeep)(iterable, 1);
1206
1142
  }
1207
1143
  flatten$1.flatten = flatten;
1208
1144
 
1209
1145
  var mapAsync$1 = {};
1210
1146
 
1211
1147
  mapAsync$1.mapAsync = void 0;
1212
- const types_1$b = es2018;
1148
+ const types_1$b = es2018$2;
1213
1149
  function mapAsync(iterable, fn) {
1214
- if (types_1$b.isAsyncIterable(iterable)) {
1150
+ if ((0, types_1$b.isAsyncIterable)(iterable)) {
1215
1151
  return mapAsyncIterable(iterable);
1216
1152
  }
1217
1153
  else {
@@ -1249,14 +1185,14 @@ map$1.map = map;
1249
1185
  var repeatAsync$1 = {};
1250
1186
 
1251
1187
  repeatAsync$1.repeatAsync = void 0;
1252
- const go_1$7 = es2018$1;
1253
- const errors_1$7 = es2018$3;
1188
+ const go_1$7 = es2018$3;
1189
+ const errors_1$7 = es2018$5;
1254
1190
  function repeatAsync(iterable, times) {
1255
- errors_1$7.assert(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1256
- 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');
1257
1193
  if (times === Infinity)
1258
1194
  warnInfiniteLoop$1();
1259
- return go_1$7.go(async function* () {
1195
+ return (0, go_1$7.go)(async function* () {
1260
1196
  const cache = [];
1261
1197
  if (times > 0) {
1262
1198
  for await (const element of iterable) {
@@ -1284,14 +1220,14 @@ function isProduction$1() {
1284
1220
  var repeat$1 = {};
1285
1221
 
1286
1222
  repeat$1.repeat = void 0;
1287
- const go_1$6 = es2018$1;
1288
- const errors_1$6 = es2018$3;
1223
+ const go_1$6 = es2018$3;
1224
+ const errors_1$6 = es2018$5;
1289
1225
  function repeat(iterable, times) {
1290
- errors_1$6.assert(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1291
- 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');
1292
1228
  if (times === Infinity)
1293
1229
  warnInfiniteLoop();
1294
- return go_1$6.go(function* () {
1230
+ return (0, go_1$6.go)(function* () {
1295
1231
  const cache = [];
1296
1232
  if (times > 0) {
1297
1233
  for (const element of iterable) {
@@ -1319,14 +1255,14 @@ function isProduction() {
1319
1255
  var sliceAsync$1 = {};
1320
1256
 
1321
1257
  sliceAsync$1.sliceAsync = void 0;
1322
- const go_1$5 = es2018$1;
1323
- const errors_1$5 = es2018$3;
1258
+ const go_1$5 = es2018$3;
1259
+ const errors_1$5 = es2018$5;
1324
1260
  function sliceAsync(iterable, start, end = Infinity) {
1325
- errors_1$5.assert(Number.isInteger(start), 'The parameter start must be an integer');
1326
- errors_1$5.assert(start >= 0, 'The parameter start must be greater than or equal to 0');
1327
- errors_1$5.assert(Number.isInteger(end), 'The parameter end must be an integer');
1328
- errors_1$5.assert(end >= start, 'The parameter end must be greater than or equal to start');
1329
- 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* () {
1330
1266
  let index = 0;
1331
1267
  for await (const element of iterable) {
1332
1268
  if (index >= end)
@@ -1342,14 +1278,14 @@ sliceAsync$1.sliceAsync = sliceAsync;
1342
1278
  var slice$1 = {};
1343
1279
 
1344
1280
  slice$1.slice = void 0;
1345
- const go_1$4 = es2018$1;
1346
- const errors_1$4 = es2018$3;
1281
+ const go_1$4 = es2018$3;
1282
+ const errors_1$4 = es2018$5;
1347
1283
  function slice(iterable, start, end = Infinity) {
1348
- errors_1$4.assert(Number.isInteger(start), 'The parameter start must be an integer');
1349
- errors_1$4.assert(start >= 0, 'The parameter start must be greater than or equal to 0');
1350
- errors_1$4.assert(Number.isInteger(end), 'The parameter end must be an integer');
1351
- errors_1$4.assert(end >= start, 'The parameter end must be greater than or equal to start');
1352
- 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* () {
1353
1289
  let index = 0;
1354
1290
  for (const element of iterable) {
1355
1291
  if (index >= end)
@@ -1383,9 +1319,9 @@ splitAsync$1.splitAsync = splitAsync;
1383
1319
  var splitByAsync$1 = {};
1384
1320
 
1385
1321
  splitByAsync$1.splitByAsync = void 0;
1386
- const types_1$a = es2018;
1322
+ const types_1$a = es2018$2;
1387
1323
  function splitByAsync(iterable, predicate) {
1388
- if (types_1$a.isAsyncIterable(iterable)) {
1324
+ if ((0, types_1$a.isAsyncIterable)(iterable)) {
1389
1325
  return splitByAsyncIterable(iterable);
1390
1326
  }
1391
1327
  else {
@@ -1465,12 +1401,12 @@ split$1.split = split;
1465
1401
  var takeAsync$1 = {};
1466
1402
 
1467
1403
  takeAsync$1.takeAsync = void 0;
1468
- const go_1$3 = es2018$1;
1469
- const errors_1$3 = es2018$3;
1404
+ const go_1$3 = es2018$3;
1405
+ const errors_1$3 = es2018$5;
1470
1406
  function takeAsync(iterable, count) {
1471
- errors_1$3.assert(Number.isInteger(count), 'The parameter count must be an integer');
1472
- errors_1$3.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1473
- 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* () {
1474
1410
  if (count === 0)
1475
1411
  return;
1476
1412
  for await (const element of iterable) {
@@ -1486,12 +1422,12 @@ takeAsync$1.takeAsync = takeAsync;
1486
1422
  var takeRightAsync$1 = {};
1487
1423
 
1488
1424
  takeRightAsync$1.takeRightAsync = void 0;
1489
- const go_1$2 = es2018$1;
1490
- const errors_1$2 = es2018$3;
1425
+ const go_1$2 = es2018$3;
1426
+ const errors_1$2 = es2018$5;
1491
1427
  function takeRightAsync(iterable, count) {
1492
- errors_1$2.assert(Number.isInteger(count), 'The parameter count must be an integer');
1493
- errors_1$2.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1494
- 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* () {
1495
1431
  var _a;
1496
1432
  const iterator = iterable[Symbol.asyncIterator]();
1497
1433
  let done;
@@ -1516,12 +1452,12 @@ takeRightAsync$1.takeRightAsync = takeRightAsync;
1516
1452
  var takeRight$1 = {};
1517
1453
 
1518
1454
  takeRight$1.takeRight = void 0;
1519
- const go_1$1 = es2018$1;
1520
- const errors_1$1 = es2018$3;
1455
+ const go_1$1 = es2018$3;
1456
+ const errors_1$1 = es2018$5;
1521
1457
  function takeRight(iterable, count) {
1522
- errors_1$1.assert(Number.isInteger(count), 'The parameter count must be an integer');
1523
- errors_1$1.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1524
- 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* () {
1525
1461
  var _a;
1526
1462
  const iterator = iterable[Symbol.iterator]();
1527
1463
  let done;
@@ -1546,9 +1482,9 @@ takeRight$1.takeRight = takeRight;
1546
1482
  var takeUntilAsync$1 = {};
1547
1483
 
1548
1484
  takeUntilAsync$1.takeUntilAsync = void 0;
1549
- const types_1$9 = es2018;
1485
+ const types_1$9 = es2018$2;
1550
1486
  function takeUntilAsync(iterable, predicate) {
1551
- if (types_1$9.isAsyncIterable(iterable)) {
1487
+ if ((0, types_1$9.isAsyncIterable)(iterable)) {
1552
1488
  return takeUntilAsyncIterable(iterable);
1553
1489
  }
1554
1490
  else {
@@ -1592,12 +1528,12 @@ takeUntil$1.takeUntil = takeUntil;
1592
1528
  var take$1 = {};
1593
1529
 
1594
1530
  take$1.take = void 0;
1595
- const go_1 = es2018$1;
1596
- const errors_1 = es2018$3;
1531
+ const go_1 = es2018$3;
1532
+ const errors_1 = es2018$5;
1597
1533
  function take(iterable, count) {
1598
- errors_1.assert(Number.isInteger(count), 'The parameter count must be an integer');
1599
- errors_1.assert(count >= 0, 'The parameter count must be greater than or equal to 0');
1600
- 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* () {
1601
1537
  if (count === 0)
1602
1538
  return;
1603
1539
  for (const element of iterable) {
@@ -1613,9 +1549,9 @@ take$1.take = take;
1613
1549
  var tapAsync$1 = {};
1614
1550
 
1615
1551
  tapAsync$1.tapAsync = void 0;
1616
- const types_1$8 = es2018;
1552
+ const types_1$8 = es2018$2;
1617
1553
  function tapAsync(iterable, fn) {
1618
- if (types_1$8.isAsyncIterable(iterable)) {
1554
+ if ((0, types_1$8.isAsyncIterable)(iterable)) {
1619
1555
  return tapAsyncIterable(iterable);
1620
1556
  }
1621
1557
  else {
@@ -1696,9 +1632,9 @@ uniqAsync$1.uniqAsync = uniqAsync;
1696
1632
  var uniqByAsync$1 = {};
1697
1633
 
1698
1634
  uniqByAsync$1.uniqByAsync = void 0;
1699
- const types_1$7 = es2018;
1635
+ const types_1$7 = es2018$2;
1700
1636
  function uniqByAsync(iterable, fn) {
1701
- if (types_1$7.isAsyncIterable(iterable)) {
1637
+ if ((0, types_1$7.isAsyncIterable)(iterable)) {
1702
1638
  return uniqByAsyncIterable(iterable);
1703
1639
  }
1704
1640
  else {
@@ -1765,7 +1701,7 @@ uniq$1.uniq = uniq;
1765
1701
  var zipAsync$1 = {};
1766
1702
 
1767
1703
  zipAsync$1.zipAsync = void 0;
1768
- const types_1$6 = es2018;
1704
+ const types_1$6 = es2018$2;
1769
1705
  var Kind;
1770
1706
  (function (Kind) {
1771
1707
  Kind[Kind["Sync"] = 0] = "Sync";
@@ -1779,7 +1715,7 @@ async function* zipWithSize$1(...iterables) {
1779
1715
  var _a, _b, _c, _d;
1780
1716
  const length = iterables.length;
1781
1717
  const iterators = iterables.map(iterable => {
1782
- if (types_1$6.isAsyncIterable(iterable)) {
1718
+ if ((0, types_1$6.isAsyncIterable)(iterable)) {
1783
1719
  return [Kind.Async, iterable[Symbol.asyncIterator]()];
1784
1720
  }
1785
1721
  else {
@@ -1925,9 +1861,9 @@ consume$1.consume = consume;
1925
1861
  var eachAsync$1 = {};
1926
1862
 
1927
1863
  eachAsync$1.eachAsync = void 0;
1928
- const types_1$5 = es2018;
1864
+ const types_1$5 = es2018$2;
1929
1865
  function eachAsync(iterable, fn) {
1930
- if (types_1$5.isAsyncIterable(iterable)) {
1866
+ if ((0, types_1$5.isAsyncIterable)(iterable)) {
1931
1867
  return eachAsyncIterable(iterable);
1932
1868
  }
1933
1869
  else {
@@ -1965,9 +1901,9 @@ each$1.each = each;
1965
1901
  var everyAsync$1 = {};
1966
1902
 
1967
1903
  everyAsync$1.everyAsync = void 0;
1968
- const types_1$4 = es2018;
1904
+ const types_1$4 = es2018$2;
1969
1905
  function everyAsync(iterable, predicate) {
1970
- if (types_1$4.isAsyncIterable(iterable)) {
1906
+ if ((0, types_1$4.isAsyncIterable)(iterable)) {
1971
1907
  return everyAsyncIterable(iterable);
1972
1908
  }
1973
1909
  else {
@@ -2011,9 +1947,9 @@ every$1.every = every;
2011
1947
  var findAsync$1 = {};
2012
1948
 
2013
1949
  findAsync$1.findAsync = void 0;
2014
- const types_1$3 = es2018;
1950
+ const types_1$3 = es2018$2;
2015
1951
  function findAsync(iterable, predicate) {
2016
- if (types_1$3.isAsyncIterable(iterable)) {
1952
+ if ((0, types_1$3.isAsyncIterable)(iterable)) {
2017
1953
  return findAsyncIterable(iterable);
2018
1954
  }
2019
1955
  else {
@@ -2135,9 +2071,9 @@ match$1.match = match;
2135
2071
  var reduceAsync$1 = {};
2136
2072
 
2137
2073
  reduceAsync$1.reduceAsync = void 0;
2138
- const types_1$2 = es2018;
2074
+ const types_1$2 = es2018$2;
2139
2075
  function reduceAsync(iterable, fn, initialValue) {
2140
- if (types_1$2.isUndefined(initialValue)) {
2076
+ if ((0, types_1$2.isUndefined)(initialValue)) {
2141
2077
  return reduceAsyncWithoutInitialValue(iterable, fn);
2142
2078
  }
2143
2079
  else {
@@ -2146,7 +2082,7 @@ function reduceAsync(iterable, fn, initialValue) {
2146
2082
  }
2147
2083
  reduceAsync$1.reduceAsync = reduceAsync;
2148
2084
  function reduceAsyncWithInitialValue(iterable, fn, initialValue) {
2149
- if (types_1$2.isAsyncIterable(iterable)) {
2085
+ if ((0, types_1$2.isAsyncIterable)(iterable)) {
2150
2086
  return reduceAsyncIterable(iterable);
2151
2087
  }
2152
2088
  else {
@@ -2168,7 +2104,7 @@ function reduceAsyncWithInitialValue(iterable, fn, initialValue) {
2168
2104
  }
2169
2105
  }
2170
2106
  function reduceAsyncWithoutInitialValue(iterable, fn) {
2171
- if (types_1$2.isAsyncIterable(iterable)) {
2107
+ if ((0, types_1$2.isAsyncIterable)(iterable)) {
2172
2108
  return reduceAsyncIterable(iterable);
2173
2109
  }
2174
2110
  else {
@@ -2231,9 +2167,9 @@ function reduceAsyncWithoutInitialValue(iterable, fn) {
2231
2167
  var reduce$1 = {};
2232
2168
 
2233
2169
  reduce$1.reduce = void 0;
2234
- const types_1$1 = es2018;
2170
+ const types_1$1 = es2018$2;
2235
2171
  function reduce(iterable, fn, initialValue) {
2236
- if (types_1$1.isUndefined(initialValue)) {
2172
+ if ((0, types_1$1.isUndefined)(initialValue)) {
2237
2173
  return reduceWithoutInitialValue(iterable, fn);
2238
2174
  }
2239
2175
  else {
@@ -2278,9 +2214,9 @@ function reduceWithoutInitialValue(iterable, fn) {
2278
2214
  var someAsync$1 = {};
2279
2215
 
2280
2216
  someAsync$1.someAsync = void 0;
2281
- const types_1 = es2018;
2217
+ const types_1 = es2018$2;
2282
2218
  function someAsync(iterable, predicate) {
2283
- if (types_1.isAsyncIterable(iterable)) {
2219
+ if ((0, types_1.isAsyncIterable)(iterable)) {
2284
2220
  return someAsyncIterable(iterable);
2285
2221
  }
2286
2222
  else {
@@ -2370,7 +2306,7 @@ var toArrayAsync$1 = {};
2370
2306
  toArrayAsync$1.toArrayAsync = void 0;
2371
2307
  const consume_1$3 = consume$1;
2372
2308
  function toArrayAsync(iterable) {
2373
- return consume_1$3.consume(iterable, async (iterable) => {
2309
+ return (0, consume_1$3.consume)(iterable, async (iterable) => {
2374
2310
  const result = [];
2375
2311
  for await (const element of iterable) {
2376
2312
  result.push(element);
@@ -2385,7 +2321,7 @@ var toArray$1 = {};
2385
2321
  toArray$1.toArray = void 0;
2386
2322
  const consume_1$2 = consume$1;
2387
2323
  function toArray(iterable) {
2388
- return consume_1$2.consume(iterable, iterable => Array.from(iterable));
2324
+ return (0, consume_1$2.consume)(iterable, iterable => Array.from(iterable));
2389
2325
  }
2390
2326
  toArray$1.toArray = toArray;
2391
2327
 
@@ -2394,7 +2330,7 @@ var toSetAsync$1 = {};
2394
2330
  toSetAsync$1.toSetAsync = void 0;
2395
2331
  const consume_1$1 = consume$1;
2396
2332
  function toSetAsync(iterable) {
2397
- return consume_1$1.consume(iterable, async (iterable) => {
2333
+ return (0, consume_1$1.consume)(iterable, async (iterable) => {
2398
2334
  const result = new Set();
2399
2335
  for await (const element of iterable) {
2400
2336
  result.add(element);
@@ -2409,7 +2345,7 @@ var toSet$1 = {};
2409
2345
  toSet$1.toSet = void 0;
2410
2346
  const consume_1 = consume$1;
2411
2347
  function toSet(iterable) {
2412
- return consume_1.consume(iterable, iterable => new Set(iterable));
2348
+ return (0, consume_1.consume)(iterable, iterable => new Set(iterable));
2413
2349
  }
2414
2350
  toSet$1.toSet = toSet;
2415
2351
 
@@ -2462,7 +2398,471 @@ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m
2462
2398
  };__exportStar(middleware, exports);
2463
2399
  __exportStar(output, exports);
2464
2400
 
2465
- }(es2018$2));
2401
+ }(es2018$4));
2402
+
2403
+ var _LRUMap_limit, _LRUMap_map;
2404
+ class LRUMap {
2405
+ constructor(limit) {
2406
+ _LRUMap_limit.set(this, void 0);
2407
+ _LRUMap_map.set(this, new Map());
2408
+ es2018$5.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2409
+ es2018$5.assert(limit > 0, 'The parameter limit must be a positive value');
2410
+ __classPrivateFieldSet(this, _LRUMap_limit, limit, "f");
2411
+ }
2412
+ get [(_LRUMap_limit = new WeakMap(), _LRUMap_map = new WeakMap(), Symbol.toStringTag)]() {
2413
+ return this.constructor.name;
2414
+ }
2415
+ get size() {
2416
+ return __classPrivateFieldGet(this, _LRUMap_map, "f").size;
2417
+ }
2418
+ set(key, value) {
2419
+ if (__classPrivateFieldGet(this, _LRUMap_map, "f").has(key)) {
2420
+ this.updateItem(key, value);
2421
+ }
2422
+ else {
2423
+ if (__classPrivateFieldGet(this, _LRUMap_map, "f").size === __classPrivateFieldGet(this, _LRUMap_limit, "f")) {
2424
+ __classPrivateFieldGet(this, _LRUMap_map, "f").delete(this.getColdestKey());
2425
+ }
2426
+ __classPrivateFieldGet(this, _LRUMap_map, "f").set(key, value);
2427
+ }
2428
+ return this;
2429
+ }
2430
+ has(key) {
2431
+ return __classPrivateFieldGet(this, _LRUMap_map, "f").has(key);
2432
+ }
2433
+ get(key) {
2434
+ if (!this.has(key))
2435
+ return undefined;
2436
+ const value = __classPrivateFieldGet(this, _LRUMap_map, "f").get(key);
2437
+ this.updateItem(key, value);
2438
+ return value;
2439
+ }
2440
+ delete(key) {
2441
+ return __classPrivateFieldGet(this, _LRUMap_map, "f").delete(key);
2442
+ }
2443
+ clear() {
2444
+ __classPrivateFieldGet(this, _LRUMap_map, "f").clear();
2445
+ }
2446
+ /**
2447
+ * Reinsert the item.
2448
+ */
2449
+ updateItem(key, value) {
2450
+ __classPrivateFieldGet(this, _LRUMap_map, "f").delete(key);
2451
+ __classPrivateFieldGet(this, _LRUMap_map, "f").set(key, value);
2452
+ }
2453
+ /**
2454
+ * Return the earliest key inserted in the Map
2455
+ */
2456
+ getColdestKey() {
2457
+ return es2018$4.first(__classPrivateFieldGet(this, _LRUMap_map, "f").keys());
2458
+ }
2459
+ }
2460
+
2461
+ var es2018$1 = {};
2462
+
2463
+ var exponentialBackoff = {};
2464
+
2465
+ var es2018 = {};
2466
+
2467
+ var random$1 = {};
2468
+
2469
+ random$1.random = void 0;
2470
+ function random(min, max) {
2471
+ return Math.random() * (max - min) + min;
2472
+ }
2473
+ random$1.random = random;
2474
+
2475
+ var randomInt$1 = {};
2476
+
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;
2482
+ }
2483
+ randomInt$1.randomInt = randomInt;
2484
+
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));
2510
+
2511
+ exponentialBackoff.calculateExponentialBackoffTimeout = void 0;
2512
+ const extra_rand_1 = es2018;
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$1 = {};
2525
+
2526
+ setTimeout$1.setTimeout = void 0;
2527
+ function setTimeout(timeout, cb) {
2528
+ const timer = globalThis.setTimeout(cb, timeout);
2529
+ return () => clearTimeout(timer);
2530
+ }
2531
+ setTimeout$1.setTimeout = setTimeout;
2532
+
2533
+ var setSchedule$1 = {};
2534
+
2535
+ setSchedule$1.setSchedule = void 0;
2536
+ const set_timeout_1$3 = setTimeout$1;
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 = {};
2553
+
2554
+ setImmediate$1.setImmediate = void 0;
2555
+ const set_timeout_1$2 = setTimeout$1;
2556
+ function setImmediate(cb) {
2557
+ if (globalThis.setImmediate) {
2558
+ const timer = globalThis.setImmediate(cb);
2559
+ return () => clearImmediate(timer);
2560
+ }
2561
+ else {
2562
+ return (0, set_timeout_1$2.setTimeout)(0, cb);
2563
+ }
2564
+ }
2565
+ setImmediate$1.setImmediate = setImmediate;
2566
+
2567
+ var setTimeoutLoop$1 = {};
2568
+
2569
+ setTimeoutLoop$1.setTimeoutLoop = void 0;
2570
+ const set_timeout_1$1 = setTimeout$1;
2571
+ function setTimeoutLoop(timeout, cb) {
2572
+ let isCancelled = false;
2573
+ let cancel = (0, set_timeout_1$1.setTimeout)(timeout, loop);
2574
+ return () => {
2575
+ isCancelled = true;
2576
+ cancel();
2577
+ };
2578
+ async function loop() {
2579
+ await cb();
2580
+ if (!isCancelled) {
2581
+ cancel = (0, set_timeout_1$1.setTimeout)(timeout, loop);
2582
+ }
2583
+ }
2584
+ }
2585
+ setTimeoutLoop$1.setTimeoutLoop = setTimeoutLoop;
2586
+
2587
+ var setDynamicTimeoutLoop$1 = {};
2588
+
2589
+ setDynamicTimeoutLoop$1.setDynamicTimeoutLoop = void 0;
2590
+ const set_timeout_1 = setTimeout$1;
2591
+ function setDynamicTimeoutLoop(timeout, cb) {
2592
+ let isCancelled = false;
2593
+ let cancel = (0, set_timeout_1.setTimeout)(timeout, loop);
2594
+ return () => {
2595
+ isCancelled = true;
2596
+ cancel();
2597
+ };
2598
+ async function loop() {
2599
+ const start = Date.now();
2600
+ await cb();
2601
+ const elapsed = Date.now() - start;
2602
+ if (!isCancelled) {
2603
+ cancel = (0, set_timeout_1.setTimeout)(Math.max(timeout - elapsed, 0), loop);
2604
+ }
2605
+ }
2606
+ }
2607
+ setDynamicTimeoutLoop$1.setDynamicTimeoutLoop = setDynamicTimeoutLoop;
2608
+
2609
+ (function (exports) {
2610
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2611
+ if (k2 === undefined) k2 = k;
2612
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2613
+ }) : (function(o, m, k, k2) {
2614
+ if (k2 === undefined) k2 = k;
2615
+ o[k2] = m[k];
2616
+ }));
2617
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
2618
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2619
+ };__exportStar(exponentialBackoff, exports);
2620
+ __exportStar(setTimeout$1, exports);
2621
+ __exportStar(setSchedule$1, exports);
2622
+ __exportStar(setInterval$1, exports);
2623
+ __exportStar(setImmediate$1, exports);
2624
+ __exportStar(setTimeoutLoop$1, exports);
2625
+ __exportStar(setDynamicTimeoutLoop$1, exports);
2626
+
2627
+ }(es2018$1));
2628
+
2629
+ var _ExpirableMap_map, _ExpirableMap_cancelClearTimeout;
2630
+ class ExpirableMap {
2631
+ constructor() {
2632
+ _ExpirableMap_map.set(this, new Map());
2633
+ _ExpirableMap_cancelClearTimeout.set(this, void 0);
2634
+ /**
2635
+ * 按过期时间升序排列所有项目的元数据
2636
+ */
2637
+ this.itemMetadataSortedByExpirationTime = [];
2638
+ }
2639
+ get [(_ExpirableMap_map = new WeakMap(), _ExpirableMap_cancelClearTimeout = new WeakMap(), Symbol.toStringTag)]() {
2640
+ return this.constructor.name;
2641
+ }
2642
+ get size() {
2643
+ return __classPrivateFieldGet(this, _ExpirableMap_map, "f").size;
2644
+ }
2645
+ set(key, value, maxAge) {
2646
+ __classPrivateFieldGet(this, _ExpirableMap_map, "f").set(key, value);
2647
+ this.removeItemMetadata(key);
2648
+ this.addItemMetadata(key, Date.now() + maxAge);
2649
+ return this;
2650
+ }
2651
+ has(key) {
2652
+ return __classPrivateFieldGet(this, _ExpirableMap_map, "f").has(key);
2653
+ }
2654
+ get(key) {
2655
+ return __classPrivateFieldGet(this, _ExpirableMap_map, "f").get(key);
2656
+ }
2657
+ delete(key) {
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);
2662
+ // 如果被删除的项目是第一个项目, 则需要重新规划过期回调
2663
+ if (index === 0) {
2664
+ this.rescheduleClearTimeout();
2665
+ }
2666
+ }
2667
+ return exists;
2668
+ }
2669
+ clear() {
2670
+ var _a;
2671
+ __classPrivateFieldGet(this, _ExpirableMap_map, "f").clear();
2672
+ (_a = __classPrivateFieldGet(this, _ExpirableMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2673
+ this.itemMetadataSortedByExpirationTime = [];
2674
+ }
2675
+ addItemMetadata(key, expirationTime) {
2676
+ for (let i = 0; i < this.itemMetadataSortedByExpirationTime.length; i++) {
2677
+ const item = this.itemMetadataSortedByExpirationTime[i];
2678
+ if (expirationTime < item.expirationTime) {
2679
+ this.itemMetadataSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2680
+ // 如果本次插入导致原先的第一个项目不再是低一个项目, 则需要重新规划过期回调
2681
+ if (i === 0) {
2682
+ this.rescheduleClearTimeout();
2683
+ }
2684
+ return;
2685
+ }
2686
+ }
2687
+ // 如果代码运行到此处, 意味着数组要么为空, 要么新项目过期时间大于数组内的所有项目, 故直接插入到数组尾端.
2688
+ this.itemMetadataSortedByExpirationTime.push({ key, expirationTime });
2689
+ // 如果新插入的项目是唯一而项目, 则需要重新规划过期回调
2690
+ if (this.itemMetadataSortedByExpirationTime.length === 1) {
2691
+ this.rescheduleClearTimeout();
2692
+ }
2693
+ }
2694
+ removeItemMetadata(key) {
2695
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2696
+ if (index >= 0) {
2697
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2698
+ // 如果被移除的是第一个项目, 则需要重新规划过期回调
2699
+ if (index === 0) {
2700
+ this.rescheduleClearTimeout();
2701
+ }
2702
+ }
2703
+ }
2704
+ clearExpiredItems(timestamp) {
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));
2710
+ }
2711
+ rescheduleClearTimeout() {
2712
+ var _a;
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];
2716
+ if (Number.isFinite(item.expirationTime)) {
2717
+ const cancel = es2018$1.setSchedule(item.expirationTime, () => {
2718
+ this.clearExpiredItems(Date.now());
2719
+ this.rescheduleClearTimeout();
2720
+ });
2721
+ __classPrivateFieldSet(this, _ExpirableMap_cancelClearTimeout, () => {
2722
+ cancel();
2723
+ __classPrivateFieldSet(this, _ExpirableMap_cancelClearTimeout, undefined, "f");
2724
+ }, "f");
2725
+ }
2726
+ }
2727
+ }
2728
+ }
2729
+
2730
+ var _TLRUMap_limit, _TLRUMap_map, _TLRUMap_cancelClearTimeout;
2731
+ /**
2732
+ * TLRUMap = LRUMap + ExpirableMap
2733
+ */
2734
+ class TLRUMap {
2735
+ constructor(limit) {
2736
+ _TLRUMap_limit.set(this, void 0);
2737
+ _TLRUMap_map.set(this, new Map());
2738
+ _TLRUMap_cancelClearTimeout.set(this, void 0);
2739
+ /**
2740
+ * 按过期时间升序排列所有项目的元数据
2741
+ */
2742
+ this.itemMetadataSortedByExpirationTime = [];
2743
+ es2018$5.assert(Number.isInteger(limit), 'The parameter limit must be an integer');
2744
+ es2018$5.assert(limit > 0, 'The parameter limit must be a positive value');
2745
+ __classPrivateFieldSet(this, _TLRUMap_limit, limit, "f");
2746
+ }
2747
+ get [(_TLRUMap_limit = new WeakMap(), _TLRUMap_map = new WeakMap(), _TLRUMap_cancelClearTimeout = new WeakMap(), Symbol.toStringTag)]() {
2748
+ return this.constructor.name;
2749
+ }
2750
+ get size() {
2751
+ return __classPrivateFieldGet(this, _TLRUMap_map, "f").size;
2752
+ }
2753
+ set(key, value, maxAge) {
2754
+ if (__classPrivateFieldGet(this, _TLRUMap_map, "f").has(key)) {
2755
+ this.updateItem(key, value);
2756
+ this.removeItemMetadata(key);
2757
+ this.addItemMetadata(key, Date.now() + maxAge);
2758
+ }
2759
+ else {
2760
+ if (__classPrivateFieldGet(this, _TLRUMap_map, "f").size === __classPrivateFieldGet(this, _TLRUMap_limit, "f")) {
2761
+ __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(this.getColdestKey());
2762
+ }
2763
+ __classPrivateFieldGet(this, _TLRUMap_map, "f").set(key, value);
2764
+ this.addItemMetadata(key, Date.now() + maxAge);
2765
+ }
2766
+ return this;
2767
+ }
2768
+ has(key) {
2769
+ return __classPrivateFieldGet(this, _TLRUMap_map, "f").has(key);
2770
+ }
2771
+ get(key) {
2772
+ if (this.has(key)) {
2773
+ const value = __classPrivateFieldGet(this, _TLRUMap_map, "f").get(key);
2774
+ this.updateItem(key, value);
2775
+ return value;
2776
+ }
2777
+ else {
2778
+ return undefined;
2779
+ }
2780
+ }
2781
+ delete(key) {
2782
+ const result = __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(key);
2783
+ if (result) {
2784
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2785
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2786
+ // 如果被删除的项目是第一个项目, 则需要重新规划过期回调
2787
+ if (index === 0) {
2788
+ this.rescheduleClearTimeout();
2789
+ }
2790
+ }
2791
+ return result;
2792
+ }
2793
+ clear() {
2794
+ var _a;
2795
+ __classPrivateFieldGet(this, _TLRUMap_map, "f").clear();
2796
+ (_a = __classPrivateFieldGet(this, _TLRUMap_cancelClearTimeout, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
2797
+ this.itemMetadataSortedByExpirationTime = [];
2798
+ }
2799
+ /**
2800
+ * 重新插入项目, 这会使项目置于#map迭代器的末端.
2801
+ */
2802
+ updateItem(key, value) {
2803
+ __classPrivateFieldGet(this, _TLRUMap_map, "f").delete(key);
2804
+ __classPrivateFieldGet(this, _TLRUMap_map, "f").set(key, value);
2805
+ }
2806
+ addItemMetadata(key, expirationTime) {
2807
+ for (let i = 0; i < this.itemMetadataSortedByExpirationTime.length; i++) {
2808
+ const item = this.itemMetadataSortedByExpirationTime[i];
2809
+ if (expirationTime < item.expirationTime) {
2810
+ this.itemMetadataSortedByExpirationTime.splice(i, 0, { key, expirationTime });
2811
+ // 如果本次插入导致原先的第一个项目不再是低一个项目, 则需要重新规划过期回调
2812
+ if (i === 0) {
2813
+ this.rescheduleClearTimeout();
2814
+ }
2815
+ return;
2816
+ }
2817
+ }
2818
+ // 如果代码运行到此处, 意味着数组要么为空, 要么新项目过期时间大于数组内的所有项目, 故直接插入到数组尾端.
2819
+ this.itemMetadataSortedByExpirationTime.push({ key, expirationTime });
2820
+ // 如果新插入的项目是唯一而项目, 则需要重新规划过期回调
2821
+ if (this.itemMetadataSortedByExpirationTime.length === 1) {
2822
+ this.rescheduleClearTimeout();
2823
+ }
2824
+ }
2825
+ removeItemMetadata(key) {
2826
+ const index = this.itemMetadataSortedByExpirationTime.findIndex(x => x.key === key);
2827
+ if (index >= 0) {
2828
+ this.itemMetadataSortedByExpirationTime.splice(index, 1);
2829
+ // 如果被移除的是第一个项目, 则需要重新规划过期回调
2830
+ if (index === 0) {
2831
+ this.rescheduleClearTimeout();
2832
+ }
2833
+ }
2834
+ }
2835
+ clearExpiredItems(timestamp) {
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));
2841
+ }
2842
+ rescheduleClearTimeout() {
2843
+ var _a;
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];
2847
+ if (Number.isFinite(item.expirationTime)) {
2848
+ const cancel = es2018$1.setSchedule(item.expirationTime, () => {
2849
+ this.clearExpiredItems(Date.now());
2850
+ this.rescheduleClearTimeout();
2851
+ });
2852
+ __classPrivateFieldSet(this, _TLRUMap_cancelClearTimeout, () => {
2853
+ cancel();
2854
+ __classPrivateFieldSet(this, _TLRUMap_cancelClearTimeout, undefined, "f");
2855
+ }, "f");
2856
+ }
2857
+ }
2858
+ }
2859
+ /**
2860
+ * Return the earliest key inserted in the Map
2861
+ */
2862
+ getColdestKey() {
2863
+ return es2018$4.first(__classPrivateFieldGet(this, _TLRUMap_map, "f").keys());
2864
+ }
2865
+ }
2466
2866
 
2467
2867
  var _TrieMap_root;
2468
2868
  class TrieNode {
@@ -2528,7 +2928,7 @@ class TrieMap {
2528
2928
  delete node.value;
2529
2929
  // 如果节点没有后缀, 则代表这是末端节点, 往前删除其前缀
2530
2930
  if (node.children.size === 0) {
2531
- for (const [part, parentNode] of es2018$2.toArray(es2018$2.zip(key, parentNodes)).reverse()) {
2931
+ for (const [part, parentNode] of es2018$4.toArray(es2018$4.zip(key, parentNodes)).reverse()) {
2532
2932
  parentNode.children.delete(part);
2533
2933
  if (parentNode.children.size !== 0)
2534
2934
  break;
@@ -2538,5 +2938,5 @@ class TrieMap {
2538
2938
  }
2539
2939
  }
2540
2940
 
2541
- export { Emitter, HashMap, HashSet, LRUMap, Queue, TrieMap, convertArrayToCons, convertConsToArray };
2941
+ export { Box, Emitter, ExpirableMap, HashMap, HashSet, LRUMap, Queue, TLRUMap, TrieMap, convertArrayToCons, convertConsToArray };
2542
2942
  //# sourceMappingURL=index.mjs.map