data-structure-typed 2.5.1 → 2.5.2
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.
- package/CHANGELOG.md +3 -1
- package/README.md +75 -17
- package/dist/cjs/binary-tree.cjs +2723 -139
- package/dist/cjs/graph.cjs +192 -6
- package/dist/cjs/hash.cjs +63 -15
- package/dist/cjs/heap.cjs +93 -31
- package/dist/cjs/index.cjs +3514 -379
- package/dist/cjs/linked-list.cjs +237 -31
- package/dist/cjs/matrix.cjs +47 -9
- package/dist/cjs/priority-queue.cjs +92 -30
- package/dist/cjs/queue.cjs +176 -2
- package/dist/cjs/stack.cjs +48 -2
- package/dist/cjs/trie.cjs +78 -28
- package/dist/cjs-legacy/binary-tree.cjs +2725 -136
- package/dist/cjs-legacy/graph.cjs +192 -6
- package/dist/cjs-legacy/hash.cjs +63 -15
- package/dist/cjs-legacy/heap.cjs +93 -31
- package/dist/cjs-legacy/index.cjs +3389 -249
- package/dist/cjs-legacy/linked-list.cjs +237 -31
- package/dist/cjs-legacy/matrix.cjs +47 -9
- package/dist/cjs-legacy/priority-queue.cjs +92 -30
- package/dist/cjs-legacy/queue.cjs +176 -2
- package/dist/cjs-legacy/stack.cjs +48 -2
- package/dist/cjs-legacy/trie.cjs +78 -28
- package/dist/esm/binary-tree.mjs +2723 -139
- package/dist/esm/graph.mjs +192 -6
- package/dist/esm/hash.mjs +63 -15
- package/dist/esm/heap.mjs +93 -31
- package/dist/esm/index.mjs +3514 -380
- package/dist/esm/linked-list.mjs +237 -31
- package/dist/esm/matrix.mjs +47 -9
- package/dist/esm/priority-queue.mjs +92 -30
- package/dist/esm/queue.mjs +176 -2
- package/dist/esm/stack.mjs +48 -2
- package/dist/esm/trie.mjs +78 -28
- package/dist/esm-legacy/binary-tree.mjs +2725 -136
- package/dist/esm-legacy/graph.mjs +192 -6
- package/dist/esm-legacy/hash.mjs +63 -15
- package/dist/esm-legacy/heap.mjs +93 -31
- package/dist/esm-legacy/index.mjs +3389 -250
- package/dist/esm-legacy/linked-list.mjs +237 -31
- package/dist/esm-legacy/matrix.mjs +47 -9
- package/dist/esm-legacy/priority-queue.mjs +92 -30
- package/dist/esm-legacy/queue.mjs +176 -2
- package/dist/esm-legacy/stack.mjs +48 -2
- package/dist/esm-legacy/trie.mjs +78 -28
- package/dist/types/common/error.d.ts +9 -0
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/data-structures/binary-tree/avl-tree.d.ts +48 -0
- package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +56 -0
- package/dist/types/data-structures/binary-tree/binary-tree.d.ts +102 -2
- package/dist/types/data-structures/binary-tree/bst.d.ts +195 -0
- package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +76 -0
- package/dist/types/data-structures/binary-tree/segment-tree.d.ts +24 -0
- package/dist/types/data-structures/binary-tree/tree-map.d.ts +528 -0
- package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +531 -6
- package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +435 -6
- package/dist/types/data-structures/binary-tree/tree-set.d.ts +505 -0
- package/dist/types/data-structures/graph/directed-graph.d.ts +40 -0
- package/dist/types/data-structures/graph/undirected-graph.d.ts +36 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +44 -0
- package/dist/types/data-structures/heap/heap.d.ts +56 -0
- package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +68 -0
- package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +60 -0
- package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +72 -0
- package/dist/types/data-structures/matrix/matrix.d.ts +32 -0
- package/dist/types/data-structures/queue/deque.d.ts +60 -0
- package/dist/types/data-structures/queue/queue.d.ts +48 -0
- package/dist/types/data-structures/stack/stack.d.ts +40 -0
- package/dist/types/data-structures/trie/trie.d.ts +48 -0
- package/dist/types/types/data-structures/binary-tree/bst.d.ts +1 -0
- package/dist/types/types/data-structures/binary-tree/tree-map.d.ts +5 -0
- package/dist/types/types/data-structures/binary-tree/tree-multi-set.d.ts +4 -0
- package/dist/types/types/data-structures/binary-tree/tree-set.d.ts +4 -0
- package/dist/umd/data-structure-typed.js +3404 -265
- package/dist/umd/data-structure-typed.min.js +5 -5
- package/docs-site-docusaurus/docs/api/classes/AVLTree.md +650 -136
- package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +11 -11
- package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +71 -71
- package/docs-site-docusaurus/docs/api/classes/BST.md +591 -129
- package/docs-site-docusaurus/docs/api/classes/BSTNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +15 -15
- package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +107 -107
- package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +13 -13
- package/docs-site-docusaurus/docs/api/classes/Deque.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +74 -74
- package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +9 -9
- package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +1 -1
- package/docs-site-docusaurus/docs/api/classes/HashMap.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/Heap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +25 -25
- package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +33 -33
- package/docs-site-docusaurus/docs/api/classes/LinearBase.md +50 -50
- package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +55 -55
- package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +49 -49
- package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/MapGraph.md +82 -82
- package/docs-site-docusaurus/docs/api/classes/Matrix.md +31 -31
- package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinHeap.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +45 -45
- package/docs-site-docusaurus/docs/api/classes/Navigator.md +5 -5
- package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Queue.md +60 -60
- package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +660 -146
- package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +10 -10
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +78 -78
- package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +6 -6
- package/docs-site-docusaurus/docs/api/classes/SkipList.md +44 -44
- package/docs-site-docusaurus/docs/api/classes/Stack.md +39 -39
- package/docs-site-docusaurus/docs/api/classes/TreeMap.md +165 -33
- package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +162 -46
- package/docs-site-docusaurus/docs/api/classes/TreeSet.md +161 -32
- package/docs-site-docusaurus/docs/api/classes/Trie.md +47 -47
- package/docs-site-docusaurus/docs/api/classes/TrieNode.md +8 -8
- package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +81 -81
- package/docs-site-docusaurus/docs/guide/architecture.md +2 -0
- package/docs-site-docusaurus/docs/guide/concepts.md +32 -1
- package/docs-site-docusaurus/docs/guide/faq.md +180 -0
- package/docs-site-docusaurus/docs/guide/guides.md +40 -54
- package/docs-site-docusaurus/docs/guide/installation.md +2 -0
- package/docs-site-docusaurus/docs/guide/integrations.md +2 -0
- package/docs-site-docusaurus/docs/guide/overview.md +7 -0
- package/docs-site-docusaurus/docs/guide/performance.md +2 -0
- package/docs-site-docusaurus/docs/guide/quick-start.md +31 -0
- package/docs-site-docusaurus/docs/guide/use-cases/_category_.json +6 -0
- package/docs-site-docusaurus/docs/guide/use-cases/array-sort-alternative.md +158 -0
- package/docs-site-docusaurus/docs/guide/use-cases/heap-vs-sorting.md +92 -0
- package/docs-site-docusaurus/docs/guide/use-cases/map-vs-treemap.md +151 -0
- package/docs-site-docusaurus/docs/guide/use-cases/priority-queue-typescript.md +113 -0
- package/docs-site-docusaurus/docs/guide/use-cases/treemap-javascript.md +151 -0
- package/docs-site-docusaurus/docusaurus.config.ts +1 -1
- package/docs-site-docusaurus/src/pages/index.tsx +51 -2
- package/docs-site-docusaurus/static/llms.txt +37 -0
- package/llms.txt +37 -0
- package/package.json +64 -56
- package/src/common/error.ts +19 -1
- package/src/common/index.ts +1 -1
- package/src/data-structures/base/iterable-element-base.ts +3 -2
- package/src/data-structures/binary-tree/avl-tree.ts +47 -0
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +46 -4
- package/src/data-structures/binary-tree/binary-tree.ts +79 -4
- package/src/data-structures/binary-tree/bst.ts +441 -6
- package/src/data-structures/binary-tree/red-black-tree.ts +73 -0
- package/src/data-structures/binary-tree/segment-tree.ts +18 -0
- package/src/data-structures/binary-tree/tree-map.ts +434 -9
- package/src/data-structures/binary-tree/tree-multi-map.ts +426 -5
- package/src/data-structures/binary-tree/tree-multi-set.ts +350 -6
- package/src/data-structures/binary-tree/tree-set.ts +410 -8
- package/src/data-structures/graph/abstract-graph.ts +2 -2
- package/src/data-structures/graph/directed-graph.ts +30 -0
- package/src/data-structures/graph/undirected-graph.ts +27 -0
- package/src/data-structures/hash/hash-map.ts +35 -4
- package/src/data-structures/heap/heap.ts +46 -4
- package/src/data-structures/heap/max-heap.ts +2 -2
- package/src/data-structures/linked-list/doubly-linked-list.ts +51 -0
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -0
- package/src/data-structures/linked-list/skip-linked-list.ts +59 -5
- package/src/data-structures/matrix/matrix.ts +33 -9
- package/src/data-structures/priority-queue/max-priority-queue.ts +2 -2
- package/src/data-structures/queue/deque.ts +45 -0
- package/src/data-structures/queue/queue.ts +36 -0
- package/src/data-structures/stack/stack.ts +30 -0
- package/src/data-structures/trie/trie.ts +38 -2
- package/src/types/data-structures/binary-tree/bst.ts +1 -0
- package/src/types/data-structures/binary-tree/tree-map.ts +6 -0
- package/src/types/data-structures/binary-tree/tree-multi-set.ts +5 -0
- package/src/types/data-structures/binary-tree/tree-set.ts +5 -0
package/dist/esm/linked-list.mjs
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
+
// src/common/error.ts
|
|
5
|
+
function raise(ErrorClass, message) {
|
|
6
|
+
throw new ErrorClass(message);
|
|
7
|
+
}
|
|
8
|
+
__name(raise, "raise");
|
|
9
|
+
var ERR = {
|
|
10
|
+
// Range / index
|
|
11
|
+
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
12
|
+
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
13
|
+
// Type / argument
|
|
14
|
+
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
15
|
+
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
16
|
+
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
17
|
+
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
18
|
+
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
19
|
+
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
20
|
+
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
21
|
+
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
22
|
+
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
23
|
+
// State / operation
|
|
24
|
+
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
25
|
+
// Matrix
|
|
26
|
+
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
27
|
+
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
28
|
+
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
29
|
+
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
30
|
+
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch"),
|
|
31
|
+
// Order statistic
|
|
32
|
+
orderStatisticNotEnabled: /* @__PURE__ */ __name((method, ctx) => `${ctx ? ctx + ": " : ""}${method}() requires enableOrderStatistic: true.`, "orderStatisticNotEnabled")
|
|
33
|
+
};
|
|
34
|
+
|
|
4
35
|
// src/data-structures/base/iterable-element-base.ts
|
|
5
36
|
var IterableElementBase = class {
|
|
6
37
|
static {
|
|
@@ -19,7 +50,7 @@ var IterableElementBase = class {
|
|
|
19
50
|
if (options) {
|
|
20
51
|
const { toElementFn } = options;
|
|
21
52
|
if (typeof toElementFn === "function") this._toElementFn = toElementFn;
|
|
22
|
-
else if (toElementFn)
|
|
53
|
+
else if (toElementFn) raise(TypeError, "toElementFn must be a function type");
|
|
23
54
|
}
|
|
24
55
|
}
|
|
25
56
|
/**
|
|
@@ -182,7 +213,7 @@ var IterableElementBase = class {
|
|
|
182
213
|
acc = initialValue;
|
|
183
214
|
} else {
|
|
184
215
|
const first = iter.next();
|
|
185
|
-
if (first.done)
|
|
216
|
+
if (first.done) raise(TypeError, "Reduce of empty structure with no initial value");
|
|
186
217
|
acc = first.value;
|
|
187
218
|
index = 1;
|
|
188
219
|
}
|
|
@@ -753,6 +784,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
753
784
|
|
|
754
785
|
|
|
755
786
|
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
756
791
|
|
|
757
792
|
|
|
758
793
|
|
|
@@ -816,6 +851,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
816
851
|
|
|
817
852
|
|
|
818
853
|
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
819
858
|
|
|
820
859
|
|
|
821
860
|
|
|
@@ -884,6 +923,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
884
923
|
|
|
885
924
|
|
|
886
925
|
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
887
930
|
|
|
888
931
|
|
|
889
932
|
|
|
@@ -934,6 +977,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
934
977
|
|
|
935
978
|
|
|
936
979
|
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
937
984
|
|
|
938
985
|
|
|
939
986
|
|
|
@@ -1045,6 +1092,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1045
1092
|
|
|
1046
1093
|
|
|
1047
1094
|
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1048
1099
|
|
|
1049
1100
|
|
|
1050
1101
|
|
|
@@ -1100,6 +1151,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1100
1151
|
|
|
1101
1152
|
|
|
1102
1153
|
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
|
|
1103
1158
|
|
|
1104
1159
|
|
|
1105
1160
|
|
|
@@ -1144,6 +1199,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1144
1199
|
|
|
1145
1200
|
|
|
1146
1201
|
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1147
1206
|
|
|
1148
1207
|
|
|
1149
1208
|
|
|
@@ -1194,6 +1253,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1194
1253
|
|
|
1195
1254
|
|
|
1196
1255
|
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1197
1260
|
|
|
1198
1261
|
|
|
1199
1262
|
|
|
@@ -1249,6 +1312,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1249
1312
|
|
|
1250
1313
|
|
|
1251
1314
|
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
|
|
1252
1319
|
|
|
1253
1320
|
|
|
1254
1321
|
|
|
@@ -1312,6 +1379,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1312
1379
|
|
|
1313
1380
|
|
|
1314
1381
|
|
|
1382
|
+
|
|
1383
|
+
|
|
1384
|
+
|
|
1385
|
+
|
|
1315
1386
|
|
|
1316
1387
|
|
|
1317
1388
|
|
|
@@ -1352,6 +1423,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1352
1423
|
|
|
1353
1424
|
|
|
1354
1425
|
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
|
|
1355
1430
|
|
|
1356
1431
|
|
|
1357
1432
|
|
|
@@ -1398,6 +1473,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1398
1473
|
|
|
1399
1474
|
|
|
1400
1475
|
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
|
|
1401
1480
|
|
|
1402
1481
|
|
|
1403
1482
|
|
|
@@ -1610,6 +1689,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1610
1689
|
|
|
1611
1690
|
|
|
1612
1691
|
|
|
1692
|
+
|
|
1693
|
+
|
|
1694
|
+
|
|
1695
|
+
|
|
1613
1696
|
|
|
1614
1697
|
|
|
1615
1698
|
|
|
@@ -1660,6 +1743,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1660
1743
|
|
|
1661
1744
|
|
|
1662
1745
|
|
|
1746
|
+
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
|
|
1663
1750
|
|
|
1664
1751
|
|
|
1665
1752
|
|
|
@@ -1738,6 +1825,10 @@ var SinglyLinkedList = class extends LinearLinkedBase {
|
|
|
1738
1825
|
|
|
1739
1826
|
|
|
1740
1827
|
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
|
|
1831
|
+
|
|
1741
1832
|
|
|
1742
1833
|
|
|
1743
1834
|
|
|
@@ -2054,6 +2145,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2054
2145
|
|
|
2055
2146
|
|
|
2056
2147
|
|
|
2148
|
+
|
|
2149
|
+
|
|
2150
|
+
|
|
2151
|
+
|
|
2057
2152
|
|
|
2058
2153
|
|
|
2059
2154
|
|
|
@@ -2119,6 +2214,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2119
2214
|
|
|
2120
2215
|
|
|
2121
2216
|
|
|
2217
|
+
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
|
|
2122
2221
|
|
|
2123
2222
|
|
|
2124
2223
|
|
|
@@ -2183,6 +2282,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2183
2282
|
|
|
2184
2283
|
|
|
2185
2284
|
|
|
2285
|
+
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
|
|
2186
2289
|
|
|
2187
2290
|
|
|
2188
2291
|
|
|
@@ -2238,6 +2341,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2238
2341
|
|
|
2239
2342
|
|
|
2240
2343
|
|
|
2344
|
+
|
|
2345
|
+
|
|
2346
|
+
|
|
2347
|
+
|
|
2241
2348
|
|
|
2242
2349
|
|
|
2243
2350
|
|
|
@@ -2322,6 +2429,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2322
2429
|
|
|
2323
2430
|
|
|
2324
2431
|
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
|
|
2325
2436
|
|
|
2326
2437
|
|
|
2327
2438
|
|
|
@@ -2367,6 +2478,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2367
2478
|
|
|
2368
2479
|
|
|
2369
2480
|
|
|
2481
|
+
|
|
2482
|
+
|
|
2483
|
+
|
|
2484
|
+
|
|
2370
2485
|
|
|
2371
2486
|
|
|
2372
2487
|
|
|
@@ -2443,6 +2558,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2443
2558
|
|
|
2444
2559
|
|
|
2445
2560
|
|
|
2561
|
+
|
|
2562
|
+
|
|
2563
|
+
|
|
2564
|
+
|
|
2446
2565
|
|
|
2447
2566
|
|
|
2448
2567
|
|
|
@@ -2547,6 +2666,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2547
2666
|
|
|
2548
2667
|
|
|
2549
2668
|
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2550
2673
|
|
|
2551
2674
|
|
|
2552
2675
|
|
|
@@ -2598,6 +2721,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2598
2721
|
|
|
2599
2722
|
|
|
2600
2723
|
|
|
2724
|
+
|
|
2725
|
+
|
|
2726
|
+
|
|
2727
|
+
|
|
2601
2728
|
|
|
2602
2729
|
|
|
2603
2730
|
|
|
@@ -2651,6 +2778,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2651
2778
|
|
|
2652
2779
|
|
|
2653
2780
|
|
|
2781
|
+
|
|
2782
|
+
|
|
2783
|
+
|
|
2784
|
+
|
|
2654
2785
|
|
|
2655
2786
|
|
|
2656
2787
|
|
|
@@ -2691,6 +2822,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2691
2822
|
|
|
2692
2823
|
|
|
2693
2824
|
|
|
2825
|
+
|
|
2826
|
+
|
|
2827
|
+
|
|
2828
|
+
|
|
2694
2829
|
|
|
2695
2830
|
|
|
2696
2831
|
|
|
@@ -2735,6 +2870,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2735
2870
|
|
|
2736
2871
|
|
|
2737
2872
|
|
|
2873
|
+
|
|
2874
|
+
|
|
2875
|
+
|
|
2876
|
+
|
|
2738
2877
|
|
|
2739
2878
|
|
|
2740
2879
|
|
|
@@ -2783,6 +2922,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2783
2922
|
|
|
2784
2923
|
|
|
2785
2924
|
|
|
2925
|
+
|
|
2926
|
+
|
|
2927
|
+
|
|
2928
|
+
|
|
2786
2929
|
|
|
2787
2930
|
|
|
2788
2931
|
|
|
@@ -2834,6 +2977,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2834
2977
|
|
|
2835
2978
|
|
|
2836
2979
|
|
|
2980
|
+
|
|
2981
|
+
|
|
2982
|
+
|
|
2983
|
+
|
|
2837
2984
|
|
|
2838
2985
|
|
|
2839
2986
|
|
|
@@ -2893,6 +3040,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2893
3040
|
|
|
2894
3041
|
|
|
2895
3042
|
|
|
3043
|
+
|
|
3044
|
+
|
|
3045
|
+
|
|
3046
|
+
|
|
2896
3047
|
|
|
2897
3048
|
|
|
2898
3049
|
|
|
@@ -2942,6 +3093,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
2942
3093
|
|
|
2943
3094
|
|
|
2944
3095
|
|
|
3096
|
+
|
|
3097
|
+
|
|
3098
|
+
|
|
3099
|
+
|
|
2945
3100
|
|
|
2946
3101
|
|
|
2947
3102
|
|
|
@@ -3010,6 +3165,10 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
3010
3165
|
|
|
3011
3166
|
|
|
3012
3167
|
|
|
3168
|
+
|
|
3169
|
+
|
|
3170
|
+
|
|
3171
|
+
|
|
3013
3172
|
|
|
3014
3173
|
|
|
3015
3174
|
|
|
@@ -3118,31 +3277,6 @@ var DoublyLinkedList = class extends LinearLinkedBase {
|
|
|
3118
3277
|
}
|
|
3119
3278
|
};
|
|
3120
3279
|
|
|
3121
|
-
// src/common/error.ts
|
|
3122
|
-
var ERR = {
|
|
3123
|
-
// Range / index
|
|
3124
|
-
indexOutOfRange: /* @__PURE__ */ __name((index, min, max, ctx) => `${ctx ? ctx + ": " : ""}Index ${index} is out of range [${min}, ${max}].`, "indexOutOfRange"),
|
|
3125
|
-
invalidIndex: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Index must be an integer.`, "invalidIndex"),
|
|
3126
|
-
// Type / argument
|
|
3127
|
-
invalidArgument: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidArgument"),
|
|
3128
|
-
comparatorRequired: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Comparator is required for non-number/non-string/non-Date keys.`, "comparatorRequired"),
|
|
3129
|
-
invalidKey: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidKey"),
|
|
3130
|
-
notAFunction: /* @__PURE__ */ __name((name, ctx) => `${ctx ? ctx + ": " : ""}${name} must be a function.`, "notAFunction"),
|
|
3131
|
-
invalidEntry: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Each entry must be a [key, value] tuple.`, "invalidEntry"),
|
|
3132
|
-
invalidNaN: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}NaN is not a valid key.`, "invalidNaN"),
|
|
3133
|
-
invalidDate: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Invalid Date key.`, "invalidDate"),
|
|
3134
|
-
reduceEmpty: /* @__PURE__ */ __name((ctx) => `${ctx ? ctx + ": " : ""}Reduce of empty structure with no initial value.`, "reduceEmpty"),
|
|
3135
|
-
callbackReturnType: /* @__PURE__ */ __name((expected, got, ctx) => `${ctx ? ctx + ": " : ""}Callback must return ${expected}; got ${got}.`, "callbackReturnType"),
|
|
3136
|
-
// State / operation
|
|
3137
|
-
invalidOperation: /* @__PURE__ */ __name((reason, ctx) => `${ctx ? ctx + ": " : ""}${reason}`, "invalidOperation"),
|
|
3138
|
-
// Matrix
|
|
3139
|
-
matrixDimensionMismatch: /* @__PURE__ */ __name((op) => `Matrix: Dimensions must be compatible for ${op}.`, "matrixDimensionMismatch"),
|
|
3140
|
-
matrixSingular: /* @__PURE__ */ __name(() => "Matrix: Singular matrix, inverse does not exist.", "matrixSingular"),
|
|
3141
|
-
matrixNotSquare: /* @__PURE__ */ __name(() => "Matrix: Must be square for inversion.", "matrixNotSquare"),
|
|
3142
|
-
matrixNotRectangular: /* @__PURE__ */ __name(() => "Matrix: Must be rectangular for transposition.", "matrixNotRectangular"),
|
|
3143
|
-
matrixRowMismatch: /* @__PURE__ */ __name((expected, got) => `Matrix: Expected row length ${expected}, but got ${got}.`, "matrixRowMismatch")
|
|
3144
|
-
};
|
|
3145
|
-
|
|
3146
3280
|
// src/data-structures/base/iterable-entry-base.ts
|
|
3147
3281
|
var IterableEntryBase = class {
|
|
3148
3282
|
static {
|
|
@@ -3360,7 +3494,7 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3360
3494
|
[k, v] = toEntryFn(item);
|
|
3361
3495
|
} else {
|
|
3362
3496
|
if (!Array.isArray(item) || item.length < 2) {
|
|
3363
|
-
|
|
3497
|
+
raise(TypeError, ERR.invalidEntry("SkipList"));
|
|
3364
3498
|
}
|
|
3365
3499
|
[k, v] = item;
|
|
3366
3500
|
}
|
|
@@ -3373,7 +3507,7 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3373
3507
|
static createDefaultComparator() {
|
|
3374
3508
|
return (a, b) => {
|
|
3375
3509
|
if (typeof a === "number" && typeof b === "number") {
|
|
3376
|
-
if (Number.isNaN(a) || Number.isNaN(b))
|
|
3510
|
+
if (Number.isNaN(a) || Number.isNaN(b)) raise(TypeError, ERR.invalidNaN("SkipList"));
|
|
3377
3511
|
return a - b;
|
|
3378
3512
|
}
|
|
3379
3513
|
if (typeof a === "string" && typeof b === "string") {
|
|
@@ -3381,13 +3515,13 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3381
3515
|
}
|
|
3382
3516
|
if (a instanceof Date && b instanceof Date) {
|
|
3383
3517
|
const ta = a.getTime(), tb = b.getTime();
|
|
3384
|
-
if (Number.isNaN(ta) || Number.isNaN(tb))
|
|
3518
|
+
if (Number.isNaN(ta) || Number.isNaN(tb)) raise(TypeError, ERR.invalidDate("SkipList"));
|
|
3385
3519
|
return ta - tb;
|
|
3386
3520
|
}
|
|
3387
3521
|
if (typeof a === "bigint" && typeof b === "bigint") {
|
|
3388
3522
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
3389
3523
|
}
|
|
3390
|
-
|
|
3524
|
+
raise(TypeError, ERR.comparatorRequired("SkipList"));
|
|
3391
3525
|
};
|
|
3392
3526
|
}
|
|
3393
3527
|
// ─── Internal state ──────────────────────────────────────────
|
|
@@ -3434,6 +3568,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3434
3568
|
|
|
3435
3569
|
|
|
3436
3570
|
|
|
3571
|
+
|
|
3572
|
+
|
|
3573
|
+
|
|
3574
|
+
|
|
3437
3575
|
|
|
3438
3576
|
|
|
3439
3577
|
|
|
@@ -3472,6 +3610,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3472
3610
|
|
|
3473
3611
|
|
|
3474
3612
|
|
|
3613
|
+
|
|
3614
|
+
|
|
3615
|
+
|
|
3616
|
+
|
|
3475
3617
|
|
|
3476
3618
|
|
|
3477
3619
|
|
|
@@ -3513,6 +3655,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3513
3655
|
|
|
3514
3656
|
|
|
3515
3657
|
|
|
3658
|
+
|
|
3659
|
+
|
|
3660
|
+
|
|
3661
|
+
|
|
3516
3662
|
|
|
3517
3663
|
|
|
3518
3664
|
|
|
@@ -3562,6 +3708,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3562
3708
|
|
|
3563
3709
|
|
|
3564
3710
|
|
|
3711
|
+
|
|
3712
|
+
|
|
3713
|
+
|
|
3714
|
+
|
|
3565
3715
|
|
|
3566
3716
|
|
|
3567
3717
|
|
|
@@ -3636,6 +3786,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3636
3786
|
|
|
3637
3787
|
|
|
3638
3788
|
|
|
3789
|
+
|
|
3790
|
+
|
|
3791
|
+
|
|
3792
|
+
|
|
3639
3793
|
|
|
3640
3794
|
|
|
3641
3795
|
|
|
@@ -3695,6 +3849,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3695
3849
|
|
|
3696
3850
|
|
|
3697
3851
|
|
|
3852
|
+
|
|
3853
|
+
|
|
3854
|
+
|
|
3855
|
+
|
|
3698
3856
|
|
|
3699
3857
|
|
|
3700
3858
|
|
|
@@ -3737,6 +3895,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3737
3895
|
|
|
3738
3896
|
|
|
3739
3897
|
|
|
3898
|
+
|
|
3899
|
+
|
|
3900
|
+
|
|
3901
|
+
|
|
3740
3902
|
|
|
3741
3903
|
|
|
3742
3904
|
|
|
@@ -3799,6 +3961,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3799
3961
|
|
|
3800
3962
|
|
|
3801
3963
|
|
|
3964
|
+
|
|
3965
|
+
|
|
3966
|
+
|
|
3967
|
+
|
|
3802
3968
|
|
|
3803
3969
|
|
|
3804
3970
|
|
|
@@ -3841,6 +4007,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3841
4007
|
|
|
3842
4008
|
|
|
3843
4009
|
|
|
4010
|
+
|
|
4011
|
+
|
|
4012
|
+
|
|
4013
|
+
|
|
3844
4014
|
|
|
3845
4015
|
|
|
3846
4016
|
|
|
@@ -3885,6 +4055,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3885
4055
|
|
|
3886
4056
|
|
|
3887
4057
|
|
|
4058
|
+
|
|
4059
|
+
|
|
4060
|
+
|
|
4061
|
+
|
|
3888
4062
|
|
|
3889
4063
|
|
|
3890
4064
|
|
|
@@ -3927,6 +4101,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3927
4101
|
|
|
3928
4102
|
|
|
3929
4103
|
|
|
4104
|
+
|
|
4105
|
+
|
|
4106
|
+
|
|
4107
|
+
|
|
3930
4108
|
|
|
3931
4109
|
|
|
3932
4110
|
|
|
@@ -3972,6 +4150,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
3972
4150
|
|
|
3973
4151
|
|
|
3974
4152
|
|
|
4153
|
+
|
|
4154
|
+
|
|
4155
|
+
|
|
4156
|
+
|
|
3975
4157
|
|
|
3976
4158
|
|
|
3977
4159
|
|
|
@@ -4022,6 +4204,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
4022
4204
|
|
|
4023
4205
|
|
|
4024
4206
|
|
|
4207
|
+
|
|
4208
|
+
|
|
4209
|
+
|
|
4210
|
+
|
|
4025
4211
|
|
|
4026
4212
|
|
|
4027
4213
|
|
|
@@ -4070,6 +4256,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
4070
4256
|
|
|
4071
4257
|
|
|
4072
4258
|
|
|
4259
|
+
|
|
4260
|
+
|
|
4261
|
+
|
|
4262
|
+
|
|
4073
4263
|
|
|
4074
4264
|
|
|
4075
4265
|
|
|
@@ -4117,6 +4307,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
4117
4307
|
|
|
4118
4308
|
|
|
4119
4309
|
|
|
4310
|
+
|
|
4311
|
+
|
|
4312
|
+
|
|
4313
|
+
|
|
4120
4314
|
|
|
4121
4315
|
|
|
4122
4316
|
|
|
@@ -4170,6 +4364,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
4170
4364
|
|
|
4171
4365
|
|
|
4172
4366
|
|
|
4367
|
+
|
|
4368
|
+
|
|
4369
|
+
|
|
4370
|
+
|
|
4173
4371
|
|
|
4174
4372
|
|
|
4175
4373
|
|
|
@@ -4231,6 +4429,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
4231
4429
|
|
|
4232
4430
|
|
|
4233
4431
|
|
|
4432
|
+
|
|
4433
|
+
|
|
4434
|
+
|
|
4435
|
+
|
|
4234
4436
|
|
|
4235
4437
|
|
|
4236
4438
|
|
|
@@ -4276,6 +4478,10 @@ var SkipList = class _SkipList extends IterableEntryBase {
|
|
|
4276
4478
|
|
|
4277
4479
|
|
|
4278
4480
|
|
|
4481
|
+
|
|
4482
|
+
|
|
4483
|
+
|
|
4484
|
+
|
|
4279
4485
|
|
|
4280
4486
|
|
|
4281
4487
|
|