trie-typed 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/dist/cjs/index.cjs +797 -0
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/cjs-legacy/index.cjs +795 -0
  4. package/dist/cjs-legacy/index.cjs.map +1 -0
  5. package/dist/esm/index.mjs +792 -0
  6. package/dist/esm/index.mjs.map +1 -0
  7. package/dist/esm-legacy/index.mjs +790 -0
  8. package/dist/esm-legacy/index.mjs.map +1 -0
  9. package/dist/types/data-structures/base/index.d.ts +2 -1
  10. package/dist/types/data-structures/binary-tree/avl-tree-counter.d.ts +236 -2
  11. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +197 -2
  12. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +345 -2
  13. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +174 -1
  14. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +754 -29
  15. package/dist/types/data-structures/binary-tree/bst.d.ts +467 -12
  16. package/dist/types/data-structures/binary-tree/index.d.ts +3 -2
  17. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +262 -3
  18. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +160 -1
  19. package/dist/types/data-structures/binary-tree/tree-counter.d.ts +244 -2
  20. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +332 -2
  21. package/dist/types/data-structures/graph/abstract-graph.d.ts +340 -14
  22. package/dist/types/data-structures/graph/directed-graph.d.ts +207 -1
  23. package/dist/types/data-structures/graph/index.d.ts +2 -1
  24. package/dist/types/data-structures/graph/map-graph.d.ts +78 -1
  25. package/dist/types/data-structures/graph/undirected-graph.d.ts +188 -1
  26. package/dist/types/data-structures/hash/hash-map.d.ts +345 -19
  27. package/dist/types/data-structures/hash/index.d.ts +0 -1
  28. package/dist/types/data-structures/heap/heap.d.ts +503 -5
  29. package/dist/types/data-structures/heap/index.d.ts +2 -0
  30. package/dist/types/data-structures/heap/max-heap.d.ts +32 -1
  31. package/dist/types/data-structures/heap/min-heap.d.ts +33 -1
  32. package/dist/types/data-structures/index.d.ts +7 -7
  33. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +769 -2
  34. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +451 -2
  35. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +27 -4
  36. package/dist/types/data-structures/matrix/index.d.ts +1 -1
  37. package/dist/types/data-structures/matrix/matrix.d.ts +168 -7
  38. package/dist/types/data-structures/matrix/navigator.d.ts +54 -13
  39. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +27 -1
  40. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +26 -1
  41. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +15 -2
  42. package/dist/types/data-structures/queue/deque.d.ts +431 -4
  43. package/dist/types/data-structures/queue/queue.d.ts +308 -4
  44. package/dist/types/data-structures/stack/stack.d.ts +306 -2
  45. package/dist/types/data-structures/tree/tree.d.ts +62 -1
  46. package/dist/types/data-structures/trie/trie.d.ts +350 -4
  47. package/dist/types/index.d.ts +11 -2
  48. package/dist/{interfaces → types/interfaces}/binary-tree.d.ts +1 -1
  49. package/dist/types/types/data-structures/base/index.d.ts +1 -0
  50. package/dist/types/types/data-structures/binary-tree/avl-tree-counter.d.ts +2 -0
  51. package/dist/types/types/data-structures/binary-tree/avl-tree-multi-map.d.ts +2 -0
  52. package/dist/types/types/data-structures/binary-tree/avl-tree.d.ts +2 -0
  53. package/dist/types/types/data-structures/binary-tree/binary-indexed-tree.d.ts +1 -0
  54. package/dist/types/types/data-structures/binary-tree/binary-tree.d.ts +29 -0
  55. package/dist/types/types/data-structures/binary-tree/bst.d.ts +12 -0
  56. package/dist/{data-structures → types/types/data-structures}/binary-tree/index.d.ts +2 -3
  57. package/dist/types/types/data-structures/binary-tree/red-black-tree.d.ts +3 -0
  58. package/dist/types/types/data-structures/binary-tree/segment-tree.d.ts +1 -0
  59. package/dist/types/types/data-structures/binary-tree/tree-counter.d.ts +2 -0
  60. package/dist/types/types/data-structures/binary-tree/tree-multi-map.d.ts +2 -0
  61. package/dist/types/types/data-structures/graph/abstract-graph.d.ts +14 -0
  62. package/dist/types/types/data-structures/graph/directed-graph.d.ts +1 -0
  63. package/dist/{data-structures → types/types/data-structures}/graph/index.d.ts +1 -2
  64. package/dist/types/types/data-structures/graph/map-graph.d.ts +1 -0
  65. package/dist/types/types/data-structures/graph/undirected-graph.d.ts +1 -0
  66. package/dist/types/types/data-structures/hash/hash-map.d.ts +19 -0
  67. package/dist/types/types/data-structures/hash/index.d.ts +2 -0
  68. package/dist/types/types/data-structures/heap/heap.d.ts +5 -0
  69. package/dist/types/types/data-structures/heap/index.d.ts +1 -0
  70. package/dist/types/types/data-structures/heap/max-heap.d.ts +1 -0
  71. package/dist/types/types/data-structures/heap/min-heap.d.ts +1 -0
  72. package/dist/types/types/data-structures/linked-list/doubly-linked-list.d.ts +2 -0
  73. package/dist/types/types/data-structures/linked-list/singly-linked-list.d.ts +2 -0
  74. package/dist/types/types/data-structures/linked-list/skip-linked-list.d.ts +4 -0
  75. package/dist/types/types/data-structures/matrix/matrix.d.ts +7 -0
  76. package/dist/types/types/data-structures/matrix/navigator.d.ts +14 -0
  77. package/dist/types/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
  78. package/dist/types/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
  79. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +2 -0
  80. package/dist/types/types/data-structures/queue/deque.d.ts +4 -0
  81. package/dist/types/types/data-structures/queue/queue.d.ts +4 -0
  82. package/dist/types/types/data-structures/stack/stack.d.ts +2 -0
  83. package/dist/types/types/data-structures/tree/tree.d.ts +1 -0
  84. package/dist/types/types/data-structures/trie/trie.d.ts +4 -0
  85. package/dist/types/types/index.d.ts +3 -0
  86. package/dist/types/types/utils/index.d.ts +2 -0
  87. package/dist/types/types/utils/utils.d.ts +22 -0
  88. package/dist/types/utils/index.d.ts +1 -1
  89. package/dist/types/utils/utils.d.ts +209 -22
  90. package/dist/umd/trie-typed.js +802 -0
  91. package/dist/umd/trie-typed.js.map +1 -0
  92. package/dist/umd/trie-typed.min.js +9 -0
  93. package/dist/umd/trie-typed.min.js.map +1 -0
  94. package/package.json +43 -5
  95. package/src/data-structures/binary-tree/avl-tree-counter.ts +106 -15
  96. package/src/data-structures/binary-tree/avl-tree-multi-map.ts +116 -12
  97. package/src/data-structures/binary-tree/avl-tree.ts +107 -16
  98. package/src/data-structures/binary-tree/binary-tree.ts +4 -4
  99. package/src/data-structures/binary-tree/bst.ts +103 -12
  100. package/src/data-structures/binary-tree/red-black-tree.ts +110 -20
  101. package/src/data-structures/binary-tree/tree-counter.ts +105 -14
  102. package/src/data-structures/binary-tree/tree-multi-map.ts +123 -12
  103. package/src/data-structures/graph/abstract-graph.ts +5 -5
  104. package/src/data-structures/graph/directed-graph.ts +5 -5
  105. package/src/data-structures/graph/undirected-graph.ts +5 -5
  106. package/src/data-structures/heap/heap.ts +5 -5
  107. package/src/data-structures/linked-list/singly-linked-list.ts +2 -2
  108. package/src/interfaces/binary-tree.ts +1 -1
  109. package/tsconfig.base.json +23 -0
  110. package/tsconfig.json +8 -34
  111. package/tsconfig.test.json +8 -0
  112. package/tsconfig.types.json +15 -0
  113. package/tsup.config.js +28 -0
  114. package/tsup.node.config.js +71 -0
  115. package/dist/common/index.js +0 -28
  116. package/dist/constants/index.js +0 -8
  117. package/dist/data-structures/base/index.d.ts +0 -2
  118. package/dist/data-structures/base/index.js +0 -18
  119. package/dist/data-structures/base/iterable-element-base.js +0 -243
  120. package/dist/data-structures/base/iterable-entry-base.js +0 -183
  121. package/dist/data-structures/base/linear-base.js +0 -415
  122. package/dist/data-structures/binary-tree/avl-tree-counter.d.ts +0 -182
  123. package/dist/data-structures/binary-tree/avl-tree-counter.js +0 -374
  124. package/dist/data-structures/binary-tree/avl-tree-multi-map.d.ts +0 -135
  125. package/dist/data-structures/binary-tree/avl-tree-multi-map.js +0 -250
  126. package/dist/data-structures/binary-tree/avl-tree.d.ts +0 -291
  127. package/dist/data-structures/binary-tree/avl-tree.js +0 -611
  128. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -174
  129. package/dist/data-structures/binary-tree/binary-indexed-tree.js +0 -294
  130. package/dist/data-structures/binary-tree/binary-tree.d.ts +0 -754
  131. package/dist/data-structures/binary-tree/binary-tree.js +0 -1925
  132. package/dist/data-structures/binary-tree/bst.d.ts +0 -413
  133. package/dist/data-structures/binary-tree/bst.js +0 -903
  134. package/dist/data-structures/binary-tree/index.js +0 -26
  135. package/dist/data-structures/binary-tree/red-black-tree.d.ts +0 -208
  136. package/dist/data-structures/binary-tree/red-black-tree.js +0 -546
  137. package/dist/data-structures/binary-tree/segment-tree.d.ts +0 -160
  138. package/dist/data-structures/binary-tree/segment-tree.js +0 -297
  139. package/dist/data-structures/binary-tree/tree-counter.d.ts +0 -190
  140. package/dist/data-structures/binary-tree/tree-counter.js +0 -413
  141. package/dist/data-structures/binary-tree/tree-multi-map.d.ts +0 -270
  142. package/dist/data-structures/binary-tree/tree-multi-map.js +0 -384
  143. package/dist/data-structures/graph/abstract-graph.d.ts +0 -340
  144. package/dist/data-structures/graph/abstract-graph.js +0 -896
  145. package/dist/data-structures/graph/directed-graph.d.ts +0 -207
  146. package/dist/data-structures/graph/directed-graph.js +0 -525
  147. package/dist/data-structures/graph/index.js +0 -20
  148. package/dist/data-structures/graph/map-graph.d.ts +0 -78
  149. package/dist/data-structures/graph/map-graph.js +0 -107
  150. package/dist/data-structures/graph/undirected-graph.d.ts +0 -188
  151. package/dist/data-structures/graph/undirected-graph.js +0 -424
  152. package/dist/data-structures/hash/hash-map.d.ts +0 -345
  153. package/dist/data-structures/hash/hash-map.js +0 -692
  154. package/dist/data-structures/hash/index.d.ts +0 -1
  155. package/dist/data-structures/hash/index.js +0 -17
  156. package/dist/data-structures/heap/heap.d.ts +0 -503
  157. package/dist/data-structures/heap/heap.js +0 -901
  158. package/dist/data-structures/heap/index.d.ts +0 -3
  159. package/dist/data-structures/heap/index.js +0 -19
  160. package/dist/data-structures/heap/max-heap.d.ts +0 -32
  161. package/dist/data-structures/heap/max-heap.js +0 -40
  162. package/dist/data-structures/heap/min-heap.d.ts +0 -33
  163. package/dist/data-structures/heap/min-heap.js +0 -31
  164. package/dist/data-structures/index.js +0 -28
  165. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +0 -769
  166. package/dist/data-structures/linked-list/doubly-linked-list.js +0 -1111
  167. package/dist/data-structures/linked-list/index.js +0 -19
  168. package/dist/data-structures/linked-list/singly-linked-list.d.ts +0 -451
  169. package/dist/data-structures/linked-list/singly-linked-list.js +0 -850
  170. package/dist/data-structures/linked-list/skip-linked-list.d.ts +0 -27
  171. package/dist/data-structures/linked-list/skip-linked-list.js +0 -144
  172. package/dist/data-structures/matrix/index.js +0 -18
  173. package/dist/data-structures/matrix/matrix.d.ts +0 -168
  174. package/dist/data-structures/matrix/matrix.js +0 -448
  175. package/dist/data-structures/matrix/navigator.d.ts +0 -55
  176. package/dist/data-structures/matrix/navigator.js +0 -111
  177. package/dist/data-structures/priority-queue/index.js +0 -19
  178. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +0 -27
  179. package/dist/data-structures/priority-queue/max-priority-queue.js +0 -34
  180. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +0 -26
  181. package/dist/data-structures/priority-queue/min-priority-queue.js +0 -24
  182. package/dist/data-structures/priority-queue/priority-queue.d.ts +0 -15
  183. package/dist/data-structures/priority-queue/priority-queue.js +0 -20
  184. package/dist/data-structures/queue/deque.d.ts +0 -431
  185. package/dist/data-structures/queue/deque.js +0 -879
  186. package/dist/data-structures/queue/index.js +0 -18
  187. package/dist/data-structures/queue/queue.d.ts +0 -308
  188. package/dist/data-structures/queue/queue.js +0 -473
  189. package/dist/data-structures/stack/index.js +0 -17
  190. package/dist/data-structures/stack/stack.d.ts +0 -306
  191. package/dist/data-structures/stack/stack.js +0 -401
  192. package/dist/data-structures/tree/index.js +0 -17
  193. package/dist/data-structures/tree/tree.d.ts +0 -62
  194. package/dist/data-structures/tree/tree.js +0 -107
  195. package/dist/data-structures/trie/index.js +0 -17
  196. package/dist/data-structures/trie/trie.d.ts +0 -350
  197. package/dist/data-structures/trie/trie.js +0 -610
  198. package/dist/index.d.ts +0 -12
  199. package/dist/index.js +0 -28
  200. package/dist/interfaces/binary-tree.js +0 -2
  201. package/dist/interfaces/doubly-linked-list.js +0 -2
  202. package/dist/interfaces/graph.js +0 -2
  203. package/dist/interfaces/heap.js +0 -2
  204. package/dist/interfaces/index.js +0 -24
  205. package/dist/interfaces/navigator.js +0 -2
  206. package/dist/interfaces/priority-queue.js +0 -2
  207. package/dist/interfaces/segment-tree.js +0 -2
  208. package/dist/interfaces/singly-linked-list.js +0 -2
  209. package/dist/types/common.js +0 -2
  210. package/dist/types/data-structures/base/base.js +0 -2
  211. package/dist/types/data-structures/base/index.js +0 -17
  212. package/dist/types/data-structures/binary-tree/avl-tree-counter.js +0 -2
  213. package/dist/types/data-structures/binary-tree/avl-tree-multi-map.js +0 -2
  214. package/dist/types/data-structures/binary-tree/avl-tree.js +0 -2
  215. package/dist/types/data-structures/binary-tree/binary-indexed-tree.js +0 -2
  216. package/dist/types/data-structures/binary-tree/binary-tree.js +0 -2
  217. package/dist/types/data-structures/binary-tree/bst.js +0 -2
  218. package/dist/types/data-structures/binary-tree/index.js +0 -25
  219. package/dist/types/data-structures/binary-tree/red-black-tree.js +0 -2
  220. package/dist/types/data-structures/binary-tree/segment-tree.js +0 -2
  221. package/dist/types/data-structures/binary-tree/tree-counter.js +0 -2
  222. package/dist/types/data-structures/binary-tree/tree-multi-map.js +0 -2
  223. package/dist/types/data-structures/graph/abstract-graph.js +0 -2
  224. package/dist/types/data-structures/graph/directed-graph.js +0 -2
  225. package/dist/types/data-structures/graph/index.js +0 -19
  226. package/dist/types/data-structures/graph/map-graph.js +0 -2
  227. package/dist/types/data-structures/graph/undirected-graph.js +0 -2
  228. package/dist/types/data-structures/hash/hash-map.js +0 -2
  229. package/dist/types/data-structures/hash/index.js +0 -17
  230. package/dist/types/data-structures/heap/heap.js +0 -2
  231. package/dist/types/data-structures/heap/index.js +0 -17
  232. package/dist/types/data-structures/heap/max-heap.js +0 -2
  233. package/dist/types/data-structures/heap/min-heap.js +0 -2
  234. package/dist/types/data-structures/index.js +0 -28
  235. package/dist/types/data-structures/linked-list/doubly-linked-list.js +0 -2
  236. package/dist/types/data-structures/linked-list/index.js +0 -19
  237. package/dist/types/data-structures/linked-list/singly-linked-list.js +0 -2
  238. package/dist/types/data-structures/linked-list/skip-linked-list.js +0 -2
  239. package/dist/types/data-structures/matrix/index.js +0 -18
  240. package/dist/types/data-structures/matrix/matrix.js +0 -2
  241. package/dist/types/data-structures/matrix/navigator.js +0 -2
  242. package/dist/types/data-structures/priority-queue/index.js +0 -19
  243. package/dist/types/data-structures/priority-queue/max-priority-queue.js +0 -2
  244. package/dist/types/data-structures/priority-queue/min-priority-queue.js +0 -2
  245. package/dist/types/data-structures/priority-queue/priority-queue.js +0 -2
  246. package/dist/types/data-structures/queue/deque.js +0 -2
  247. package/dist/types/data-structures/queue/index.js +0 -18
  248. package/dist/types/data-structures/queue/queue.js +0 -2
  249. package/dist/types/data-structures/stack/index.js +0 -17
  250. package/dist/types/data-structures/stack/stack.js +0 -2
  251. package/dist/types/data-structures/tree/index.js +0 -17
  252. package/dist/types/data-structures/tree/tree.js +0 -2
  253. package/dist/types/data-structures/trie/index.js +0 -17
  254. package/dist/types/data-structures/trie/trie.js +0 -2
  255. package/dist/types/index.js +0 -19
  256. package/dist/types/utils/index.js +0 -18
  257. package/dist/types/utils/utils.js +0 -2
  258. package/dist/types/utils/validate-type.js +0 -2
  259. package/dist/utils/index.d.ts +0 -2
  260. package/dist/utils/index.js +0 -18
  261. package/dist/utils/number.js +0 -24
  262. package/dist/utils/utils.d.ts +0 -209
  263. package/dist/utils/utils.js +0 -353
  264. package/dist/{common → types/common}/index.d.ts +0 -0
  265. package/dist/{constants → types/constants}/index.d.ts +0 -0
  266. package/dist/{data-structures → types/data-structures}/base/iterable-element-base.d.ts +0 -0
  267. package/dist/{data-structures → types/data-structures}/base/iterable-entry-base.d.ts +0 -0
  268. package/dist/{data-structures → types/data-structures}/base/linear-base.d.ts +0 -0
  269. package/dist/{interfaces → types/interfaces}/doubly-linked-list.d.ts +0 -0
  270. package/dist/{interfaces → types/interfaces}/graph.d.ts +0 -0
  271. package/dist/{interfaces → types/interfaces}/heap.d.ts +0 -0
  272. package/dist/{interfaces → types/interfaces}/index.d.ts +0 -0
  273. package/dist/{interfaces → types/interfaces}/navigator.d.ts +0 -0
  274. package/dist/{interfaces → types/interfaces}/priority-queue.d.ts +0 -0
  275. package/dist/{interfaces → types/interfaces}/segment-tree.d.ts +0 -0
  276. package/dist/{interfaces → types/interfaces}/singly-linked-list.d.ts +0 -0
  277. package/dist/types/{common.d.ts → types/common.d.ts} +0 -0
  278. package/dist/types/{data-structures → types/data-structures}/base/base.d.ts +0 -0
  279. package/dist/{data-structures → types/types/data-structures}/index.d.ts +7 -7
  280. package/dist/{data-structures → types/types/data-structures}/linked-list/index.d.ts +0 -0
  281. package/dist/{data-structures → types/types/data-structures}/matrix/index.d.ts +1 -1
  282. /package/dist/{data-structures → types/types/data-structures}/priority-queue/index.d.ts +0 -0
  283. /package/dist/{data-structures → types/types/data-structures}/queue/index.d.ts +0 -0
  284. /package/dist/{data-structures → types/types/data-structures}/stack/index.d.ts +0 -0
  285. /package/dist/{data-structures → types/types/data-structures}/tree/index.d.ts +0 -0
  286. /package/dist/{data-structures → types/types/data-structures}/trie/index.d.ts +0 -0
  287. /package/dist/types/{utils → types/utils}/validate-type.d.ts +0 -0
  288. /package/dist/{utils → types/utils}/number.d.ts +0 -0
@@ -0,0 +1,797 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
+
6
+ // src/data-structures/base/iterable-element-base.ts
7
+ var IterableElementBase = class {
8
+ static {
9
+ __name(this, "IterableElementBase");
10
+ }
11
+ /**
12
+ * Create a new iterable base.
13
+ *
14
+ * @param options Optional behavior overrides. When provided, a `toElementFn`
15
+ * is used to convert a raw element (`R`) into a public element (`E`).
16
+ *
17
+ * @remarks
18
+ * Time O(1), Space O(1).
19
+ */
20
+ constructor(options) {
21
+ if (options) {
22
+ const { toElementFn } = options;
23
+ if (typeof toElementFn === "function") this._toElementFn = toElementFn;
24
+ else if (toElementFn) throw new TypeError("toElementFn must be a function type");
25
+ }
26
+ }
27
+ /**
28
+ * The converter used to transform a raw element (`R`) into a public element (`E`).
29
+ *
30
+ * @remarks
31
+ * Time O(1), Space O(1).
32
+ */
33
+ _toElementFn;
34
+ /**
35
+ * Exposes the current `toElementFn`, if configured.
36
+ *
37
+ * @returns The converter function or `undefined` when not set.
38
+ * @remarks
39
+ * Time O(1), Space O(1).
40
+ */
41
+ get toElementFn() {
42
+ return this._toElementFn;
43
+ }
44
+ /**
45
+ * Returns an iterator over the structure's elements.
46
+ *
47
+ * @param args Optional iterator arguments forwarded to the internal iterator.
48
+ * @returns An `IterableIterator<E>` that yields the elements in traversal order.
49
+ *
50
+ * @remarks
51
+ * Producing the iterator is O(1); consuming the entire iterator is Time O(n) with O(1) extra space.
52
+ */
53
+ *[Symbol.iterator](...args) {
54
+ yield* this._getIterator(...args);
55
+ }
56
+ /**
57
+ * Returns an iterator over the values (alias of the default iterator).
58
+ *
59
+ * @returns An `IterableIterator<E>` over all elements.
60
+ * @remarks
61
+ * Creating the iterator is O(1); full iteration is Time O(n), Space O(1).
62
+ */
63
+ *values() {
64
+ for (const item of this) yield item;
65
+ }
66
+ /**
67
+ * Tests whether all elements satisfy the predicate.
68
+ *
69
+ * @template TReturn
70
+ * @param predicate Function invoked for each element with signature `(value, index, self)`.
71
+ * @param thisArg Optional `this` binding for the predicate.
72
+ * @returns `true` if every element passes; otherwise `false`.
73
+ *
74
+ * @remarks
75
+ * Time O(n) in the worst case; may exit early when the first failure is found. Space O(1).
76
+ */
77
+ every(predicate, thisArg) {
78
+ let index = 0;
79
+ for (const item of this) {
80
+ if (thisArg === void 0) {
81
+ if (!predicate(item, index++, this)) return false;
82
+ } else {
83
+ const fn = predicate;
84
+ if (!fn.call(thisArg, item, index++, this)) return false;
85
+ }
86
+ }
87
+ return true;
88
+ }
89
+ /**
90
+ * Tests whether at least one element satisfies the predicate.
91
+ *
92
+ * @param predicate Function invoked for each element with signature `(value, index, self)`.
93
+ * @param thisArg Optional `this` binding for the predicate.
94
+ * @returns `true` if any element passes; otherwise `false`.
95
+ *
96
+ * @remarks
97
+ * Time O(n) in the worst case; may exit early on first success. Space O(1).
98
+ */
99
+ some(predicate, thisArg) {
100
+ let index = 0;
101
+ for (const item of this) {
102
+ if (thisArg === void 0) {
103
+ if (predicate(item, index++, this)) return true;
104
+ } else {
105
+ const fn = predicate;
106
+ if (fn.call(thisArg, item, index++, this)) return true;
107
+ }
108
+ }
109
+ return false;
110
+ }
111
+ /**
112
+ * Invokes a callback for each element in iteration order.
113
+ *
114
+ * @param callbackfn Function invoked per element with signature `(value, index, self)`.
115
+ * @param thisArg Optional `this` binding for the callback.
116
+ * @returns `void`.
117
+ *
118
+ * @remarks
119
+ * Time O(n), Space O(1).
120
+ */
121
+ forEach(callbackfn, thisArg) {
122
+ let index = 0;
123
+ for (const item of this) {
124
+ if (thisArg === void 0) {
125
+ callbackfn(item, index++, this);
126
+ } else {
127
+ const fn = callbackfn;
128
+ fn.call(thisArg, item, index++, this);
129
+ }
130
+ }
131
+ }
132
+ // Implementation signature
133
+ find(predicate, thisArg) {
134
+ let index = 0;
135
+ for (const item of this) {
136
+ if (thisArg === void 0) {
137
+ if (predicate(item, index++, this)) return item;
138
+ } else {
139
+ const fn = predicate;
140
+ if (fn.call(thisArg, item, index++, this)) return item;
141
+ }
142
+ }
143
+ return;
144
+ }
145
+ /**
146
+ * Checks whether a strictly-equal element exists in the structure.
147
+ *
148
+ * @param element The element to test with `===` equality.
149
+ * @returns `true` if an equal element is found; otherwise `false`.
150
+ *
151
+ * @remarks
152
+ * Time O(n) in the worst case. Space O(1).
153
+ */
154
+ has(element) {
155
+ for (const ele of this) if (ele === element) return true;
156
+ return false;
157
+ }
158
+ /**
159
+ * Reduces all elements to a single accumulated value.
160
+ *
161
+ * @overload
162
+ * @param callbackfn Reducer of signature `(acc, value, index, self) => nextAcc`. The first element is used as the initial accumulator.
163
+ * @returns The final accumulated value typed as `E`.
164
+ *
165
+ * @overload
166
+ * @param callbackfn Reducer of signature `(acc, value, index, self) => nextAcc`.
167
+ * @param initialValue The initial accumulator value of type `E`.
168
+ * @returns The final accumulated value typed as `E`.
169
+ *
170
+ * @overload
171
+ * @template U The accumulator type when it differs from `E`.
172
+ * @param callbackfn Reducer of signature `(acc: U, value, index, self) => U`.
173
+ * @param initialValue The initial accumulator value of type `U`.
174
+ * @returns The final accumulated value typed as `U`.
175
+ *
176
+ * @remarks
177
+ * Time O(n), Space O(1). Throws if called on an empty structure without `initialValue`.
178
+ */
179
+ reduce(callbackfn, initialValue) {
180
+ let index = 0;
181
+ const iter = this[Symbol.iterator]();
182
+ let acc;
183
+ if (arguments.length >= 2) {
184
+ acc = initialValue;
185
+ } else {
186
+ const first = iter.next();
187
+ if (first.done) throw new TypeError("Reduce of empty structure with no initial value");
188
+ acc = first.value;
189
+ index = 1;
190
+ }
191
+ for (const value of iter) {
192
+ acc = callbackfn(acc, value, index++, this);
193
+ }
194
+ return acc;
195
+ }
196
+ /**
197
+ * Materializes the elements into a new array.
198
+ *
199
+ * @returns A shallow array copy of the iteration order.
200
+ * @remarks
201
+ * Time O(n), Space O(n).
202
+ */
203
+ toArray() {
204
+ return [...this];
205
+ }
206
+ /**
207
+ * Returns a representation of the structure suitable for quick visualization.
208
+ * Defaults to an array of elements; subclasses may override to provide richer visuals.
209
+ *
210
+ * @returns A visual representation (array by default).
211
+ * @remarks
212
+ * Time O(n), Space O(n).
213
+ */
214
+ toVisual() {
215
+ return [...this];
216
+ }
217
+ /**
218
+ * Prints `toVisual()` to the console. Intended for quick debugging.
219
+ *
220
+ * @returns `void`.
221
+ * @remarks
222
+ * Time O(n) due to materialization, Space O(n) for the intermediate representation.
223
+ */
224
+ print() {
225
+ console.log(this.toVisual());
226
+ }
227
+ };
228
+
229
+ // src/data-structures/trie/trie.ts
230
+ var TrieNode = class {
231
+ static {
232
+ __name(this, "TrieNode");
233
+ }
234
+ /**
235
+ * Create a Trie node with a character key.
236
+ * @remarks Time O(1), Space O(1)
237
+ * @returns New TrieNode instance.
238
+ */
239
+ constructor(key) {
240
+ this._key = key;
241
+ this._isEnd = false;
242
+ this._children = /* @__PURE__ */ new Map();
243
+ }
244
+ _key;
245
+ /**
246
+ * Get the character key of this node.
247
+ * @remarks Time O(1), Space O(1)
248
+ * @returns Character key string.
249
+ */
250
+ get key() {
251
+ return this._key;
252
+ }
253
+ /**
254
+ * Set the character key of this node.
255
+ * @remarks Time O(1), Space O(1)
256
+ * @param value - New character key.
257
+ * @returns void
258
+ */
259
+ set key(value) {
260
+ this._key = value;
261
+ }
262
+ _children;
263
+ /**
264
+ * Get the child map of this node.
265
+ * @remarks Time O(1), Space O(1)
266
+ * @returns Map from character to child node.
267
+ */
268
+ get children() {
269
+ return this._children;
270
+ }
271
+ /**
272
+ * Replace the child map of this node.
273
+ * @remarks Time O(1), Space O(1)
274
+ * @param value - New map of character → node.
275
+ * @returns void
276
+ */
277
+ set children(value) {
278
+ this._children = value;
279
+ }
280
+ _isEnd;
281
+ /**
282
+ * Check whether this node marks the end of a word.
283
+ * @remarks Time O(1), Space O(1)
284
+ * @returns True if this node ends a word.
285
+ */
286
+ get isEnd() {
287
+ return this._isEnd;
288
+ }
289
+ /**
290
+ * Mark this node as the end of a word or not.
291
+ * @remarks Time O(1), Space O(1)
292
+ * @param value - Whether this node ends a word.
293
+ * @returns void
294
+ */
295
+ set isEnd(value) {
296
+ this._isEnd = value;
297
+ }
298
+ };
299
+ var Trie = class extends IterableElementBase {
300
+ static {
301
+ __name(this, "Trie");
302
+ }
303
+ /**
304
+ * Create a Trie and optionally bulk-insert words.
305
+ * @remarks Time O(totalChars), Space O(totalChars)
306
+ * @param [words] - Iterable of strings (or raw records if toElementFn is provided).
307
+ * @param [options] - Options such as toElementFn and caseSensitive.
308
+ * @returns New Trie instance.
309
+ */
310
+ constructor(words = [], options) {
311
+ super(options);
312
+ if (options) {
313
+ const { caseSensitive } = options;
314
+ if (caseSensitive !== void 0) this._caseSensitive = caseSensitive;
315
+ }
316
+ if (words) {
317
+ this.addMany(words);
318
+ }
319
+ }
320
+ _size = 0;
321
+ /**
322
+ * Get the number of stored words.
323
+ * @remarks Time O(1), Space O(1)
324
+ * @returns Word count.
325
+ */
326
+ get size() {
327
+ return this._size;
328
+ }
329
+ _caseSensitive = true;
330
+ /**
331
+ * Get whether comparisons are case-sensitive.
332
+ * @remarks Time O(1), Space O(1)
333
+ * @returns True if case-sensitive.
334
+ */
335
+ get caseSensitive() {
336
+ return this._caseSensitive;
337
+ }
338
+ _root = new TrieNode("");
339
+ /**
340
+ * Get the root node.
341
+ * @remarks Time O(1), Space O(1)
342
+ * @returns Root TrieNode.
343
+ */
344
+ get root() {
345
+ return this._root;
346
+ }
347
+ /**
348
+ * (Protected) Get total count for base class iteration.
349
+ * @remarks Time O(1), Space O(1)
350
+ * @returns Total number of elements.
351
+ */
352
+ get _total() {
353
+ return this._size;
354
+ }
355
+ /**
356
+ * Insert one word into the trie.
357
+ * @remarks Time O(L), Space O(L)
358
+ * @param word - Word to insert.
359
+ * @returns True if the word was newly added.
360
+ */
361
+ add(word) {
362
+ word = this._caseProcess(word);
363
+ let cur = this.root;
364
+ let isNewWord = false;
365
+ for (const c of word) {
366
+ let nodeC = cur.children.get(c);
367
+ if (!nodeC) {
368
+ nodeC = new TrieNode(c);
369
+ cur.children.set(c, nodeC);
370
+ }
371
+ cur = nodeC;
372
+ }
373
+ if (!cur.isEnd) {
374
+ isNewWord = true;
375
+ cur.isEnd = true;
376
+ this._size++;
377
+ }
378
+ return isNewWord;
379
+ }
380
+ /**
381
+ * Insert many words from an iterable.
382
+ * @remarks Time O(ΣL), Space O(ΣL)
383
+ * @param words - Iterable of strings (or raw records if toElementFn is provided).
384
+ * @returns Array of per-word 'added' flags.
385
+ */
386
+ addMany(words) {
387
+ const ans = [];
388
+ for (const word of words) {
389
+ if (this.toElementFn) {
390
+ ans.push(this.add(this.toElementFn(word)));
391
+ } else {
392
+ ans.push(this.add(word));
393
+ }
394
+ }
395
+ return ans;
396
+ }
397
+ /**
398
+ * Check whether a word exists.
399
+ * @remarks Time O(L), Space O(1)
400
+ * @param word - Word to search for.
401
+ * @returns True if present.
402
+ */
403
+ has(word) {
404
+ word = this._caseProcess(word);
405
+ let cur = this.root;
406
+ for (const c of word) {
407
+ const nodeC = cur.children.get(c);
408
+ if (!nodeC) return false;
409
+ cur = nodeC;
410
+ }
411
+ return cur.isEnd;
412
+ }
413
+ /**
414
+ * Check whether the trie is empty.
415
+ * @remarks Time O(1), Space O(1)
416
+ * @returns True if size is 0.
417
+ */
418
+ isEmpty() {
419
+ return this._size === 0;
420
+ }
421
+ /**
422
+ * Remove all words and reset to a fresh root.
423
+ * @remarks Time O(1), Space O(1)
424
+ * @returns void
425
+ */
426
+ clear() {
427
+ this._size = 0;
428
+ this._root = new TrieNode("");
429
+ }
430
+ /**
431
+ * Delete one word if present.
432
+ * @remarks Time O(L), Space O(1)
433
+ * @param word - Word to delete.
434
+ * @returns True if a word was removed.
435
+ */
436
+ delete(word) {
437
+ word = this._caseProcess(word);
438
+ let isDeleted = false;
439
+ const dfs = /* @__PURE__ */ __name((cur, i) => {
440
+ const char = word[i];
441
+ const child = cur.children.get(char);
442
+ if (child) {
443
+ if (i === word.length - 1) {
444
+ if (child.isEnd) {
445
+ if (child.children.size > 0) {
446
+ child.isEnd = false;
447
+ } else {
448
+ cur.children.delete(char);
449
+ }
450
+ isDeleted = true;
451
+ return true;
452
+ }
453
+ return false;
454
+ }
455
+ const res = dfs(child, i + 1);
456
+ if (res && !cur.isEnd && child.children.size === 0) {
457
+ cur.children.delete(char);
458
+ return true;
459
+ }
460
+ return false;
461
+ }
462
+ return false;
463
+ }, "dfs");
464
+ dfs(this.root, 0);
465
+ if (isDeleted) {
466
+ this._size--;
467
+ }
468
+ return isDeleted;
469
+ }
470
+ /**
471
+ * Compute the height (max depth) of the trie.
472
+ * @remarks Time O(N), Space O(H)
473
+ * @returns Maximum depth from root to a leaf.
474
+ */
475
+ getHeight() {
476
+ const startNode = this.root;
477
+ let maxDepth = 0;
478
+ if (startNode) {
479
+ const bfs = /* @__PURE__ */ __name((node, level) => {
480
+ if (level > maxDepth) {
481
+ maxDepth = level;
482
+ }
483
+ const { children } = node;
484
+ if (children) {
485
+ for (const child of children.entries()) {
486
+ bfs(child[1], level + 1);
487
+ }
488
+ }
489
+ }, "bfs");
490
+ bfs(startNode, 0);
491
+ }
492
+ return maxDepth;
493
+ }
494
+ /**
495
+ * Check whether input is a proper prefix of at least one word.
496
+ * @remarks Time O(L), Space O(1)
497
+ * @param input - String to test as prefix.
498
+ * @returns True if input is a prefix but not a full word.
499
+ */
500
+ hasPurePrefix(input) {
501
+ input = this._caseProcess(input);
502
+ let cur = this.root;
503
+ for (const c of input) {
504
+ const nodeC = cur.children.get(c);
505
+ if (!nodeC) return false;
506
+ cur = nodeC;
507
+ }
508
+ return !cur.isEnd;
509
+ }
510
+ /**
511
+ * Check whether any word starts with input.
512
+ * @remarks Time O(L), Space O(1)
513
+ * @param input - String to test as prefix.
514
+ * @returns True if input matches a path from root.
515
+ */
516
+ hasPrefix(input) {
517
+ input = this._caseProcess(input);
518
+ let cur = this.root;
519
+ for (const c of input) {
520
+ const nodeC = cur.children.get(c);
521
+ if (!nodeC) return false;
522
+ cur = nodeC;
523
+ }
524
+ return true;
525
+ }
526
+ /**
527
+ * Check whether the trie’s longest common prefix equals input.
528
+ * @remarks Time O(min(H,L)), Space O(1)
529
+ * @param input - Candidate longest common prefix.
530
+ * @returns True if input equals the common prefix.
531
+ */
532
+ hasCommonPrefix(input) {
533
+ input = this._caseProcess(input);
534
+ let commonPre = "";
535
+ const dfs = /* @__PURE__ */ __name((cur) => {
536
+ commonPre += cur.key;
537
+ if (commonPre === input) return;
538
+ if (cur.isEnd) return;
539
+ if (cur && cur.children && cur.children.size === 1) dfs(Array.from(cur.children.values())[0]);
540
+ else return;
541
+ }, "dfs");
542
+ dfs(this.root);
543
+ return commonPre === input;
544
+ }
545
+ /**
546
+ * Return the longest common prefix among all words.
547
+ * @remarks Time O(H), Space O(1)
548
+ * @returns The longest common prefix string.
549
+ */
550
+ getLongestCommonPrefix() {
551
+ let commonPre = "";
552
+ const dfs = /* @__PURE__ */ __name((cur) => {
553
+ commonPre += cur.key;
554
+ if (cur.isEnd) return;
555
+ if (cur && cur.children && cur.children.size === 1) dfs(Array.from(cur.children.values())[0]);
556
+ else return;
557
+ }, "dfs");
558
+ dfs(this.root);
559
+ return commonPre;
560
+ }
561
+ /**
562
+ * Collect words under a prefix up to a maximum count.
563
+ * @remarks Time O(K·L), Space O(K·L)
564
+ * @param [prefix] - Prefix to match; default empty string for root.
565
+ * @param [max] - Maximum number of words to return; default is Number.MAX_SAFE_INTEGER.
566
+ * @param [isAllWhenEmptyPrefix] - When true, collect from root even if prefix is empty.
567
+ * @returns Array of collected words (at most max).
568
+ */
569
+ getWords(prefix = "", max = Number.MAX_SAFE_INTEGER, isAllWhenEmptyPrefix = false) {
570
+ prefix = this._caseProcess(prefix);
571
+ const words = [];
572
+ let found = 0;
573
+ function dfs(node, word) {
574
+ for (const char of node.children.keys()) {
575
+ const charNode = node.children.get(char);
576
+ if (charNode !== void 0) {
577
+ dfs(charNode, word.concat(char));
578
+ }
579
+ }
580
+ if (node.isEnd) {
581
+ if (found > max - 1) return;
582
+ words.push(word);
583
+ found++;
584
+ }
585
+ }
586
+ __name(dfs, "dfs");
587
+ let startNode = this.root;
588
+ if (prefix) {
589
+ for (const c of prefix) {
590
+ const nodeC = startNode.children.get(c);
591
+ if (nodeC) {
592
+ startNode = nodeC;
593
+ } else {
594
+ return [];
595
+ }
596
+ }
597
+ }
598
+ if (isAllWhenEmptyPrefix || startNode !== this.root) dfs(startNode, prefix);
599
+ return words;
600
+ }
601
+ /**
602
+ * Deep clone this trie by iterating and inserting all words.
603
+ * @remarks Time O(ΣL), Space O(ΣL)
604
+ * @returns A new trie with the same words and options.
605
+ */
606
+ clone() {
607
+ const next = this._createInstance();
608
+ for (const x of this) next.add(x);
609
+ return next;
610
+ }
611
+ /**
612
+ * Filter words into a new trie of the same class.
613
+ * @remarks Time O(ΣL), Space O(ΣL)
614
+ * @param predicate - Predicate (word, index, trie) → boolean to keep word.
615
+ * @param [thisArg] - Value for `this` inside the predicate.
616
+ * @returns A new trie containing words that satisfy the predicate.
617
+ */
618
+ filter(predicate, thisArg) {
619
+ const results = this._createInstance();
620
+ let index = 0;
621
+ for (const word of this) {
622
+ if (predicate.call(thisArg, word, index, this)) {
623
+ results.add(word);
624
+ }
625
+ index++;
626
+ }
627
+ return results;
628
+ }
629
+ map(callback, options, thisArg) {
630
+ const newTrie = this._createLike([], options);
631
+ let i = 0;
632
+ for (const x of this) {
633
+ const v = thisArg === void 0 ? callback(x, i++, this) : callback.call(thisArg, x, i++, this);
634
+ if (typeof v !== "string") {
635
+ throw new TypeError(`Trie.map callback must return string; got ${typeof v}`);
636
+ }
637
+ newTrie.add(v);
638
+ }
639
+ return newTrie;
640
+ }
641
+ /**
642
+ * Map words into a new trie of the same element type.
643
+ * @remarks Time O(ΣL), Space O(ΣL)
644
+ * @param callback - Mapping function (word, index, trie) → string.
645
+ * @param [thisArg] - Value for `this` inside the callback.
646
+ * @returns A new trie with mapped words.
647
+ */
648
+ mapSame(callback, thisArg) {
649
+ const next = this._createInstance();
650
+ let i = 0;
651
+ for (const key of this) {
652
+ const mapped = thisArg === void 0 ? callback(key, i++, this) : callback.call(thisArg, key, i++, this);
653
+ next.add(mapped);
654
+ }
655
+ return next;
656
+ }
657
+ /**
658
+ * (Protected) Create an empty instance of the same concrete class.
659
+ * @remarks Time O(1), Space O(1)
660
+ * @param [options] - Options forwarded to the constructor.
661
+ * @returns An empty like-kind trie instance.
662
+ */
663
+ _createInstance(options) {
664
+ const Ctor = this.constructor;
665
+ const next = new Ctor([], {
666
+ toElementFn: this.toElementFn,
667
+ caseSensitive: this.caseSensitive,
668
+ ...options ?? {}
669
+ });
670
+ return next;
671
+ }
672
+ /**
673
+ * (Protected) Create a like-kind trie and seed it from an iterable.
674
+ * @remarks Time O(ΣL), Space O(ΣL)
675
+ * @template RM
676
+ * @param [elements] - Iterable used to seed the new trie.
677
+ * @param [options] - Options forwarded to the constructor.
678
+ * @returns A like-kind Trie instance.
679
+ */
680
+ _createLike(elements = [], options) {
681
+ const Ctor = this.constructor;
682
+ return new Ctor(elements, options);
683
+ }
684
+ /**
685
+ * (Protected) Spawn an empty like-kind trie instance.
686
+ * @remarks Time O(1), Space O(1)
687
+ * @template RM
688
+ * @param [options] - Options forwarded to the constructor.
689
+ * @returns An empty like-kind Trie instance.
690
+ */
691
+ _spawnLike(options) {
692
+ return this._createLike([], options);
693
+ }
694
+ /**
695
+ * (Protected) Iterate all words in lexicographic order of edges.
696
+ * @remarks Time O(ΣL), Space O(H)
697
+ * @returns Iterator of words.
698
+ */
699
+ *_getIterator() {
700
+ function* _dfs(node, path) {
701
+ if (node.isEnd) {
702
+ yield path;
703
+ }
704
+ for (const [char, childNode] of node.children) {
705
+ yield* _dfs(childNode, path + char);
706
+ }
707
+ }
708
+ __name(_dfs, "_dfs");
709
+ yield* _dfs(this.root, "");
710
+ }
711
+ /**
712
+ * (Protected) Normalize a string according to case sensitivity.
713
+ * @remarks Time O(L), Space O(L)
714
+ * @param str - Input string to normalize.
715
+ * @returns Normalized string based on caseSensitive.
716
+ */
717
+ _caseProcess(str) {
718
+ if (!this._caseSensitive) {
719
+ str = str.toLowerCase();
720
+ }
721
+ return str;
722
+ }
723
+ };
724
+
725
+ // src/utils/utils.ts
726
+ function isPrimitiveComparable(value) {
727
+ const valueType = typeof value;
728
+ if (valueType === "number") return true;
729
+ return valueType === "bigint" || valueType === "string" || valueType === "boolean";
730
+ }
731
+ __name(isPrimitiveComparable, "isPrimitiveComparable");
732
+ function tryObjectToPrimitive(obj) {
733
+ if (typeof obj.valueOf === "function") {
734
+ const valueOfResult = obj.valueOf();
735
+ if (valueOfResult !== obj) {
736
+ if (isPrimitiveComparable(valueOfResult)) return valueOfResult;
737
+ if (typeof valueOfResult === "object" && valueOfResult !== null) return tryObjectToPrimitive(valueOfResult);
738
+ }
739
+ }
740
+ if (typeof obj.toString === "function") {
741
+ const stringResult = obj.toString();
742
+ if (stringResult !== "[object Object]") return stringResult;
743
+ }
744
+ return null;
745
+ }
746
+ __name(tryObjectToPrimitive, "tryObjectToPrimitive");
747
+ function isComparable(value, isForceObjectComparable = false) {
748
+ if (value === null || value === void 0) return false;
749
+ if (isPrimitiveComparable(value)) return true;
750
+ if (typeof value !== "object") return false;
751
+ if (value instanceof Date) return true;
752
+ if (isForceObjectComparable) return true;
753
+ const comparableValue = tryObjectToPrimitive(value);
754
+ if (comparableValue === null || comparableValue === void 0) return false;
755
+ return isPrimitiveComparable(comparableValue);
756
+ }
757
+ __name(isComparable, "isComparable");
758
+
759
+ // src/common/index.ts
760
+ var DFSOperation = /* @__PURE__ */ ((DFSOperation2) => {
761
+ DFSOperation2[DFSOperation2["VISIT"] = 0] = "VISIT";
762
+ DFSOperation2[DFSOperation2["PROCESS"] = 1] = "PROCESS";
763
+ return DFSOperation2;
764
+ })(DFSOperation || {});
765
+ var Range = class {
766
+ constructor(low, high, includeLow = true, includeHigh = true) {
767
+ this.low = low;
768
+ this.high = high;
769
+ this.includeLow = includeLow;
770
+ this.includeHigh = includeHigh;
771
+ if (!(isComparable(low) && isComparable(high))) throw new RangeError("low or high is not comparable");
772
+ if (low > high) throw new RangeError("low must be less than or equal to high");
773
+ }
774
+ static {
775
+ __name(this, "Range");
776
+ }
777
+ // Determine whether a key is within the range
778
+ isInRange(key, comparator) {
779
+ const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
780
+ const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
781
+ return lowCheck && highCheck;
782
+ }
783
+ };
784
+ /**
785
+ * data-structure-typed
786
+ *
787
+ * @author Pablo Zeng
788
+ * @copyright Copyright (c) 2022 Pablo Zeng <zrwusa@gmail.com>
789
+ * @license MIT License
790
+ */
791
+
792
+ exports.DFSOperation = DFSOperation;
793
+ exports.Range = Range;
794
+ exports.Trie = Trie;
795
+ exports.TrieNode = TrieNode;
796
+ //# sourceMappingURL=index.cjs.map
797
+ //# sourceMappingURL=index.cjs.map