linked-list-typed 2.5.1 → 2.5.3

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 (75) hide show
  1. package/dist/cjs/index.cjs +431 -55
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs-legacy/index.cjs +430 -54
  4. package/dist/cjs-legacy/index.cjs.map +1 -1
  5. package/dist/esm/index.mjs +431 -56
  6. package/dist/esm/index.mjs.map +1 -1
  7. package/dist/esm-legacy/index.mjs +430 -55
  8. package/dist/esm-legacy/index.mjs.map +1 -1
  9. package/dist/types/common/error.d.ts +9 -0
  10. package/dist/types/common/index.d.ts +1 -1
  11. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +86 -2
  12. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +98 -0
  13. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +189 -13
  14. package/dist/types/data-structures/binary-tree/bst.d.ts +270 -3
  15. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +136 -8
  16. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +42 -0
  17. package/dist/types/data-structures/binary-tree/tree-map.d.ts +1089 -161
  18. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +1243 -350
  19. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +980 -255
  20. package/dist/types/data-structures/binary-tree/tree-set.d.ts +1174 -284
  21. package/dist/types/data-structures/graph/directed-graph.d.ts +70 -0
  22. package/dist/types/data-structures/graph/undirected-graph.d.ts +63 -0
  23. package/dist/types/data-structures/hash/hash-map.d.ts +84 -6
  24. package/dist/types/data-structures/heap/heap.d.ts +140 -12
  25. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +126 -0
  26. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +106 -1
  27. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +126 -0
  28. package/dist/types/data-structures/matrix/matrix.d.ts +56 -0
  29. package/dist/types/data-structures/queue/deque.d.ts +127 -0
  30. package/dist/types/data-structures/queue/queue.d.ts +97 -0
  31. package/dist/types/data-structures/stack/stack.d.ts +72 -2
  32. package/dist/types/data-structures/trie/trie.d.ts +84 -0
  33. package/dist/types/interfaces/binary-tree.d.ts +2 -3
  34. package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
  35. package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
  36. package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
  37. package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
  38. package/dist/umd/linked-list-typed.js +428 -53
  39. package/dist/umd/linked-list-typed.js.map +1 -1
  40. package/dist/umd/linked-list-typed.min.js +1 -1
  41. package/dist/umd/linked-list-typed.min.js.map +1 -1
  42. package/package.json +2 -2
  43. package/src/common/error.ts +19 -1
  44. package/src/common/index.ts +1 -1
  45. package/src/data-structures/base/iterable-element-base.ts +3 -2
  46. package/src/data-structures/binary-tree/avl-tree.ts +99 -5
  47. package/src/data-structures/binary-tree/binary-indexed-tree.ts +102 -4
  48. package/src/data-structures/binary-tree/binary-tree.ts +239 -78
  49. package/src/data-structures/binary-tree/bst.ts +542 -13
  50. package/src/data-structures/binary-tree/red-black-tree.ts +155 -15
  51. package/src/data-structures/binary-tree/segment-tree.ts +42 -0
  52. package/src/data-structures/binary-tree/tree-map.ts +1223 -261
  53. package/src/data-structures/binary-tree/tree-multi-map.ts +939 -30
  54. package/src/data-structures/binary-tree/tree-multi-set.ts +746 -10
  55. package/src/data-structures/binary-tree/tree-set.ts +1018 -99
  56. package/src/data-structures/graph/abstract-graph.ts +2 -2
  57. package/src/data-structures/graph/directed-graph.ts +71 -1
  58. package/src/data-structures/graph/undirected-graph.ts +64 -1
  59. package/src/data-structures/hash/hash-map.ts +102 -16
  60. package/src/data-structures/heap/heap.ts +153 -23
  61. package/src/data-structures/heap/max-heap.ts +2 -2
  62. package/src/data-structures/linked-list/doubly-linked-list.ts +139 -0
  63. package/src/data-structures/linked-list/singly-linked-list.ts +106 -1
  64. package/src/data-structures/linked-list/skip-linked-list.ts +131 -5
  65. package/src/data-structures/matrix/matrix.ts +65 -9
  66. package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
  67. package/src/data-structures/queue/deque.ts +130 -0
  68. package/src/data-structures/queue/queue.ts +109 -0
  69. package/src/data-structures/stack/stack.ts +75 -5
  70. package/src/data-structures/trie/trie.ts +86 -2
  71. package/src/interfaces/binary-tree.ts +1 -9
  72. package/src/types/data-structures/binary-tree/bst.ts +1 -0
  73. package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
  74. package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
  75. package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
@@ -10,6 +10,60 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
10
10
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
11
11
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
12
12
 
13
+ // src/common/error.ts
14
+ function raise(ErrorClass, message) {
15
+ throw new ErrorClass(message);
16
+ }
17
+ __name(raise, "raise");
18
+ var ERR = {
19
+ // Range / index
20
+ indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
21
+ invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
22
+ // Type / argument
23
+ invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
24
+ comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
25
+ invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
26
+ notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
27
+ invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
28
+ invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
29
+ invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
30
+ reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
31
+ callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
32
+ // State / operation
33
+ invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
34
+ // Matrix
35
+ matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
36
+ matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
37
+ matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
38
+ matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
39
+ matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
40
+ // Order statistic
41
+ orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
42
+ };
43
+
44
+ // src/common/index.ts
45
+ var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
46
+ DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
47
+ DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
48
+ return DFSOperation2;
49
+ })(DFSOperation || {});
50
+ var _Range = class _Range {
51
+ constructor(low, high, includeLow = true, includeHigh = true) {
52
+ this.low = low;
53
+ this.high = high;
54
+ this.includeLow = includeLow;
55
+ this.includeHigh = includeHigh;
56
+ }
57
+ // Determine whether a key is within the range
58
+ isInRange(key, comparator) {
59
+ const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
60
+ const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
61
+ return lowCheck && highCheck;
62
+ }
63
+ };
64
+ __name(_Range, "Range");
65
+ var Range = _Range;
66
+
13
67
  // src/data-structures/base/iterable-element-base.ts
14
68
  var _IterableElementBase = class _IterableElementBase {
15
69
  /**
@@ -32,7 +86,7 @@ var _IterableElementBase = class _IterableElementBase {
32
86
  if (options) {
33
87
  const { toElementFn } = options;
34
88
  if (typeof toElementFn === "function") this._toElementFn = toElementFn;
35
- else if (toElementFn) throw new TypeError("toElementFn must be a function type");
89
+ else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
36
90
  }
37
91
  }
38
92
  /**
@@ -188,7 +242,7 @@ var _IterableElementBase = class _IterableElementBase {
188
242
  acc = initialValue;
189
243
  } else {
190
244
  const first = iter.next();
191
- if (first.done) throw new TypeError("Reduce of empty structure with no initial value");
245
+ if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
192
246
  acc = first.value;
193
247
  index = 1;
194
248
  }
@@ -754,6 +808,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
754
808
 
755
809
 
756
810
 
811
+
812
+
813
+
814
+
815
+
816
+
817
+
757
818
 
758
819
 
759
820
 
@@ -818,6 +879,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
818
879
 
819
880
 
820
881
 
882
+
883
+
884
+
885
+
886
+
887
+
888
+
821
889
 
822
890
 
823
891
 
@@ -888,6 +956,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
888
956
 
889
957
 
890
958
 
959
+
960
+
961
+
962
+
963
+
964
+
965
+
891
966
 
892
967
 
893
968
 
@@ -939,6 +1014,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
939
1014
 
940
1015
 
941
1016
 
1017
+
1018
+
1019
+
1020
+
1021
+
1022
+
1023
+
942
1024
 
943
1025
 
944
1026
 
@@ -1051,6 +1133,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1051
1133
 
1052
1134
 
1053
1135
 
1136
+
1137
+
1138
+
1139
+
1140
+
1141
+
1142
+
1054
1143
 
1055
1144
 
1056
1145
 
@@ -1107,6 +1196,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1107
1196
 
1108
1197
 
1109
1198
 
1199
+
1200
+
1201
+
1202
+
1203
+
1204
+
1205
+
1110
1206
 
1111
1207
 
1112
1208
 
@@ -1152,6 +1248,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1152
1248
 
1153
1249
 
1154
1250
 
1251
+
1252
+
1253
+
1254
+
1255
+
1256
+
1257
+
1155
1258
 
1156
1259
 
1157
1260
 
@@ -1203,6 +1306,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1203
1306
 
1204
1307
 
1205
1308
 
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+
1315
+
1206
1316
 
1207
1317
 
1208
1318
 
@@ -1259,6 +1369,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1259
1369
 
1260
1370
 
1261
1371
 
1372
+
1373
+
1374
+
1375
+
1376
+
1377
+
1378
+
1262
1379
 
1263
1380
 
1264
1381
 
@@ -1323,6 +1440,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1323
1440
 
1324
1441
 
1325
1442
 
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1449
+
1326
1450
 
1327
1451
 
1328
1452
 
@@ -1364,6 +1488,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1364
1488
 
1365
1489
 
1366
1490
 
1491
+
1492
+
1493
+
1494
+
1495
+
1496
+
1497
+
1367
1498
 
1368
1499
 
1369
1500
 
@@ -1411,6 +1542,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1411
1542
 
1412
1543
 
1413
1544
 
1545
+
1546
+
1547
+
1548
+
1549
+
1550
+
1551
+
1414
1552
 
1415
1553
 
1416
1554
 
@@ -1624,6 +1762,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1624
1762
 
1625
1763
 
1626
1764
 
1765
+
1766
+
1767
+
1768
+
1769
+
1770
+
1771
+
1627
1772
 
1628
1773
 
1629
1774
 
@@ -1675,6 +1820,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1675
1820
 
1676
1821
 
1677
1822
 
1823
+
1824
+
1825
+
1826
+
1827
+
1828
+
1829
+
1678
1830
 
1679
1831
 
1680
1832
 
@@ -1754,6 +1906,13 @@ var _SinglyLinkedList = class _SinglyLinkedList extends LinearLinkedBase {
1754
1906
 
1755
1907
 
1756
1908
 
1909
+
1910
+
1911
+
1912
+
1913
+
1914
+
1915
+
1757
1916
 
1758
1917
 
1759
1918
 
@@ -2071,6 +2230,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2071
2230
 
2072
2231
 
2073
2232
 
2233
+
2234
+
2235
+
2236
+
2237
+
2238
+
2239
+
2074
2240
 
2075
2241
 
2076
2242
 
@@ -2137,6 +2303,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2137
2303
 
2138
2304
 
2139
2305
 
2306
+
2307
+
2308
+
2309
+
2310
+
2311
+
2312
+
2140
2313
 
2141
2314
 
2142
2315
 
@@ -2202,6 +2375,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2202
2375
 
2203
2376
 
2204
2377
 
2378
+
2379
+
2380
+
2381
+
2382
+
2383
+
2384
+
2205
2385
 
2206
2386
 
2207
2387
 
@@ -2258,6 +2438,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2258
2438
 
2259
2439
 
2260
2440
 
2441
+
2442
+
2443
+
2444
+
2445
+
2446
+
2447
+
2261
2448
 
2262
2449
 
2263
2450
 
@@ -2343,6 +2530,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2343
2530
 
2344
2531
 
2345
2532
 
2533
+
2534
+
2535
+
2536
+
2537
+
2538
+
2539
+
2346
2540
 
2347
2541
 
2348
2542
 
@@ -2389,6 +2583,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2389
2583
 
2390
2584
 
2391
2585
 
2586
+
2587
+
2588
+
2589
+
2590
+
2591
+
2592
+
2392
2593
 
2393
2594
 
2394
2595
 
@@ -2466,6 +2667,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2466
2667
 
2467
2668
 
2468
2669
 
2670
+
2671
+
2672
+
2673
+
2674
+
2675
+
2676
+
2469
2677
 
2470
2678
 
2471
2679
 
@@ -2571,6 +2779,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2571
2779
 
2572
2780
 
2573
2781
 
2782
+
2783
+
2784
+
2785
+
2786
+
2787
+
2788
+
2574
2789
 
2575
2790
 
2576
2791
 
@@ -2623,6 +2838,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2623
2838
 
2624
2839
 
2625
2840
 
2841
+
2842
+
2843
+
2844
+
2845
+
2846
+
2847
+
2626
2848
 
2627
2849
 
2628
2850
 
@@ -2677,6 +2899,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2677
2899
 
2678
2900
 
2679
2901
 
2902
+
2903
+
2904
+
2905
+
2906
+
2907
+
2908
+
2680
2909
 
2681
2910
 
2682
2911
 
@@ -2718,6 +2947,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2718
2947
 
2719
2948
 
2720
2949
 
2950
+
2951
+
2952
+
2953
+
2954
+
2955
+
2956
+
2721
2957
 
2722
2958
 
2723
2959
 
@@ -2763,6 +2999,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2763
2999
 
2764
3000
 
2765
3001
 
3002
+
3003
+
3004
+
3005
+
3006
+
3007
+
3008
+
2766
3009
 
2767
3010
 
2768
3011
 
@@ -2812,6 +3055,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2812
3055
 
2813
3056
 
2814
3057
 
3058
+
3059
+
3060
+
3061
+
3062
+
3063
+
3064
+
2815
3065
 
2816
3066
 
2817
3067
 
@@ -2864,6 +3114,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2864
3114
 
2865
3115
 
2866
3116
 
3117
+
3118
+
3119
+
3120
+
3121
+
3122
+
3123
+
2867
3124
 
2868
3125
 
2869
3126
 
@@ -2888,6 +3145,25 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2888
3145
  }
2889
3146
  return this;
2890
3147
  }
3148
+ /**
3149
+ * Delete the first element that satisfies a predicate.
3150
+ * @remarks Time O(N), Space O(1)
3151
+ * @param predicate - Function (value, index, list) → boolean to decide deletion.
3152
+ * @returns True if a match was removed.
3153
+ */
3154
+ deleteWhere(predicate) {
3155
+ let current = this.head;
3156
+ let index = 0;
3157
+ while (current) {
3158
+ if (predicate(current.value, index, this)) {
3159
+ this.delete(current);
3160
+ return true;
3161
+ }
3162
+ current = current.next;
3163
+ index++;
3164
+ }
3165
+ return false;
3166
+ }
2891
3167
  /**
2892
3168
  * Set the equality comparator used to compare values.
2893
3169
  * @remarks Time O(1), Space O(1)
@@ -2924,6 +3200,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2924
3200
 
2925
3201
 
2926
3202
 
3203
+
3204
+
3205
+
3206
+
3207
+
3208
+
3209
+
2927
3210
 
2928
3211
 
2929
3212
 
@@ -2974,6 +3257,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
2974
3257
 
2975
3258
 
2976
3259
 
3260
+
3261
+
3262
+
3263
+
3264
+
3265
+
3266
+
2977
3267
 
2978
3268
 
2979
3269
 
@@ -3043,6 +3333,13 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
3043
3333
 
3044
3334
 
3045
3335
 
3336
+
3337
+
3338
+
3339
+
3340
+
3341
+
3342
+
3046
3343
 
3047
3344
 
3048
3345
 
@@ -3156,54 +3453,6 @@ var _DoublyLinkedList = class _DoublyLinkedList extends LinearLinkedBase {
3156
3453
  __name(_DoublyLinkedList, "DoublyLinkedList");
3157
3454
  var DoublyLinkedList = _DoublyLinkedList;
3158
3455
 
3159
- // src/common/error.ts
3160
- var ERR = {
3161
- // Range / index
3162
- indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
3163
- invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
3164
- // Type / argument
3165
- invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
3166
- comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
3167
- invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
3168
- notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
3169
- invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
3170
- invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
3171
- invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
3172
- reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
3173
- callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
3174
- // State / operation
3175
- invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
3176
- // Matrix
3177
- matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
3178
- matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
3179
- matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
3180
- matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
3181
- matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
3182
- };
3183
-
3184
- // src/common/index.ts
3185
- var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
3186
- DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
3187
- DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
3188
- return DFSOperation2;
3189
- })(DFSOperation || {});
3190
- var _Range = class _Range {
3191
- constructor(low, high, includeLow = true, includeHigh = true) {
3192
- this.low = low;
3193
- this.high = high;
3194
- this.includeLow = includeLow;
3195
- this.includeHigh = includeHigh;
3196
- }
3197
- // Determine whether a key is within the range
3198
- isInRange(key, comparator) {
3199
- const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
3200
- const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
3201
- return lowCheck && highCheck;
3202
- }
3203
- };
3204
- __name(_Range, "Range");
3205
- var Range = _Range;
3206
-
3207
3456
  // src/data-structures/base/iterable-entry-base.ts
3208
3457
  var _IterableEntryBase = class _IterableEntryBase {
3209
3458
  /**
@@ -3423,7 +3672,7 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3423
3672
  [k, v] = toEntryFn(item);
3424
3673
  } else {
3425
3674
  if (!Array.isArray(item) || item.length < 2) {
3426
- throw new TypeError(ERR.invalidEntry("SkipList"));
3675
+ raise(TypeError, ERR.invalidEntry("SkipList"));
3427
3676
  }
3428
3677
  [k, v] = item;
3429
3678
  }
@@ -3436,7 +3685,7 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3436
3685
  static createDefaultComparator() {
3437
3686
  return (a, b) => {
3438
3687
  if (typeof a === "number" && typeof b === "number") {
3439
- if (Number.isNaN(a) || Number.isNaN(b)) throw new TypeError(ERR.invalidNaN("SkipList"));
3688
+ if (Number.isNaN(a) || Number.isNaN(b)) raise(TypeError, ERR.invalidNaN("SkipList"));
3440
3689
  return a - b;
3441
3690
  }
3442
3691
  if (typeof a === "string" && typeof b === "string") {
@@ -3444,13 +3693,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3444
3693
  }
3445
3694
  if (a instanceof Date && b instanceof Date) {
3446
3695
  const ta = a.getTime(), tb = b.getTime();
3447
- if (Number.isNaN(ta) || Number.isNaN(tb)) throw new TypeError(ERR.invalidDate("SkipList"));
3696
+ if (Number.isNaN(ta) || Number.isNaN(tb)) raise(TypeError, ERR.invalidDate("SkipList"));
3448
3697
  return ta - tb;
3449
3698
  }
3450
3699
  if (typeof a === "bigint" && typeof b === "bigint") {
3451
3700
  return a < b ? -1 : a > b ? 1 : 0;
3452
3701
  }
3453
- throw new TypeError(ERR.comparatorRequired("SkipList"));
3702
+ raise(TypeError, ERR.comparatorRequired("SkipList"));
3454
3703
  };
3455
3704
  }
3456
3705
  // ─── Size & lifecycle ────────────────────────────────────────
@@ -3489,6 +3738,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3489
3738
 
3490
3739
 
3491
3740
 
3741
+
3742
+
3743
+
3744
+
3745
+
3746
+
3747
+
3492
3748
 
3493
3749
 
3494
3750
 
@@ -3528,6 +3784,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3528
3784
 
3529
3785
 
3530
3786
 
3787
+
3788
+
3789
+
3790
+
3791
+
3792
+
3793
+
3531
3794
 
3532
3795
 
3533
3796
 
@@ -3570,6 +3833,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3570
3833
 
3571
3834
 
3572
3835
 
3836
+
3837
+
3838
+
3839
+
3840
+
3841
+
3842
+
3573
3843
 
3574
3844
 
3575
3845
 
@@ -3620,6 +3890,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3620
3890
 
3621
3891
 
3622
3892
 
3893
+
3894
+
3895
+
3896
+
3897
+
3898
+
3899
+
3623
3900
 
3624
3901
 
3625
3902
 
@@ -3695,6 +3972,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3695
3972
 
3696
3973
 
3697
3974
 
3975
+
3976
+
3977
+
3978
+
3979
+
3980
+
3981
+
3698
3982
 
3699
3983
 
3700
3984
 
@@ -3755,6 +4039,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3755
4039
 
3756
4040
 
3757
4041
 
4042
+
4043
+
4044
+
4045
+
4046
+
4047
+
4048
+
3758
4049
 
3759
4050
 
3760
4051
 
@@ -3798,6 +4089,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3798
4089
 
3799
4090
 
3800
4091
 
4092
+
4093
+
4094
+
4095
+
4096
+
4097
+
4098
+
3801
4099
 
3802
4100
 
3803
4101
 
@@ -3861,6 +4159,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3861
4159
 
3862
4160
 
3863
4161
 
4162
+
4163
+
4164
+
4165
+
4166
+
4167
+
4168
+
3864
4169
 
3865
4170
 
3866
4171
 
@@ -3904,6 +4209,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3904
4209
 
3905
4210
 
3906
4211
 
4212
+
4213
+
4214
+
4215
+
4216
+
4217
+
4218
+
3907
4219
 
3908
4220
 
3909
4221
 
@@ -3949,6 +4261,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3949
4261
 
3950
4262
 
3951
4263
 
4264
+
4265
+
4266
+
4267
+
4268
+
4269
+
4270
+
3952
4271
 
3953
4272
 
3954
4273
 
@@ -3992,6 +4311,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
3992
4311
 
3993
4312
 
3994
4313
 
4314
+
4315
+
4316
+
4317
+
4318
+
4319
+
4320
+
3995
4321
 
3996
4322
 
3997
4323
 
@@ -4038,6 +4364,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4038
4364
 
4039
4365
 
4040
4366
 
4367
+
4368
+
4369
+
4370
+
4371
+
4372
+
4373
+
4041
4374
 
4042
4375
 
4043
4376
 
@@ -4089,6 +4422,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4089
4422
 
4090
4423
 
4091
4424
 
4425
+
4426
+
4427
+
4428
+
4429
+
4430
+
4431
+
4092
4432
 
4093
4433
 
4094
4434
 
@@ -4138,6 +4478,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4138
4478
 
4139
4479
 
4140
4480
 
4481
+
4482
+
4483
+
4484
+
4485
+
4486
+
4487
+
4141
4488
 
4142
4489
 
4143
4490
 
@@ -4186,6 +4533,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4186
4533
 
4187
4534
 
4188
4535
 
4536
+
4537
+
4538
+
4539
+
4540
+
4541
+
4542
+
4189
4543
 
4190
4544
 
4191
4545
 
@@ -4240,6 +4594,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4240
4594
 
4241
4595
 
4242
4596
 
4597
+
4598
+
4599
+
4600
+
4601
+
4602
+
4603
+
4243
4604
 
4244
4605
 
4245
4606
 
@@ -4302,6 +4663,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4302
4663
 
4303
4664
 
4304
4665
 
4666
+
4667
+
4668
+
4669
+
4670
+
4671
+
4672
+
4305
4673
 
4306
4674
 
4307
4675
 
@@ -4348,6 +4716,13 @@ var _SkipList = class _SkipList extends IterableEntryBase {
4348
4716
 
4349
4717
 
4350
4718
 
4719
+
4720
+
4721
+
4722
+
4723
+
4724
+
4725
+
4351
4726
 
4352
4727
 
4353
4728
 
@@ -4437,6 +4812,6 @@ var SkipList = _SkipList;
4437
4812
  * @license MIT License
4438
4813
  */
4439
4814
 
4440
- export { DFSOperation, DoublyLinkedList, DoublyLinkedListNode, ERR, Range, SinglyLinkedList, SinglyLinkedListNode, SkipList, SkipListNode };
4815
+ export { DFSOperation, DoublyLinkedList, DoublyLinkedListNode, ERR, Range, SinglyLinkedList, SinglyLinkedListNode, SkipList, SkipListNode, raise };
4441
4816
  //# sourceMappingURL=index.mjs.map
4442
4817
  //# sourceMappingURL=index.mjs.map