@ac-kit/data 0.1.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 (599) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +75 -0
  3. package/dist/bit/bit-set.d.ts +84 -0
  4. package/dist/bit/bit-set.d.ts.map +1 -0
  5. package/dist/bit/bit-set.js +206 -0
  6. package/dist/bit/bit-set.js.map +1 -0
  7. package/dist/bit/bit-vector.d.ts +69 -0
  8. package/dist/bit/bit-vector.d.ts.map +1 -0
  9. package/dist/bit/bit-vector.js +172 -0
  10. package/dist/bit/bit-vector.js.map +1 -0
  11. package/dist/cache/_lru-store.d.ts +37 -0
  12. package/dist/cache/_lru-store.d.ts.map +1 -0
  13. package/dist/cache/_lru-store.js +137 -0
  14. package/dist/cache/_lru-store.js.map +1 -0
  15. package/dist/cache/lru-cache.d.ts +90 -0
  16. package/dist/cache/lru-cache.d.ts.map +1 -0
  17. package/dist/cache/lru-cache.js +143 -0
  18. package/dist/cache/lru-cache.js.map +1 -0
  19. package/dist/cache/lru-map.d.ts +72 -0
  20. package/dist/cache/lru-map.d.ts.map +1 -0
  21. package/dist/cache/lru-map.js +100 -0
  22. package/dist/cache/lru-map.js.map +1 -0
  23. package/dist/collection/_bounded.d.ts +27 -0
  24. package/dist/collection/_bounded.d.ts.map +1 -0
  25. package/dist/collection/_bounded.js +48 -0
  26. package/dist/collection/_bounded.js.map +1 -0
  27. package/dist/collection/_capacity-semaphore.d.ts +31 -0
  28. package/dist/collection/_capacity-semaphore.d.ts.map +1 -0
  29. package/dist/collection/_capacity-semaphore.js +94 -0
  30. package/dist/collection/_capacity-semaphore.js.map +1 -0
  31. package/dist/collection/iasync-collection.d.ts +16 -0
  32. package/dist/collection/iasync-collection.d.ts.map +1 -0
  33. package/dist/collection/iasync-collection.js +13 -0
  34. package/dist/collection/iasync-collection.js.map +1 -0
  35. package/dist/collection/iasync-searchable.d.ts +9 -0
  36. package/dist/collection/iasync-searchable.d.ts.map +1 -0
  37. package/dist/collection/iasync-searchable.js +2 -0
  38. package/dist/collection/iasync-searchable.js.map +1 -0
  39. package/dist/collection/ibounded.d.ts +36 -0
  40. package/dist/collection/ibounded.d.ts.map +1 -0
  41. package/dist/collection/ibounded.js +8 -0
  42. package/dist/collection/ibounded.js.map +1 -0
  43. package/dist/collection/icollection.d.ts +24 -0
  44. package/dist/collection/icollection.d.ts.map +1 -0
  45. package/dist/collection/icollection.js +2 -0
  46. package/dist/collection/icollection.js.map +1 -0
  47. package/dist/collection/ilossy.d.ts +20 -0
  48. package/dist/collection/ilossy.d.ts.map +1 -0
  49. package/dist/collection/ilossy.js +2 -0
  50. package/dist/collection/ilossy.js.map +1 -0
  51. package/dist/collection/ireplacing.d.ts +25 -0
  52. package/dist/collection/ireplacing.d.ts.map +1 -0
  53. package/dist/collection/ireplacing.js +2 -0
  54. package/dist/collection/ireplacing.js.map +1 -0
  55. package/dist/collection/isearchable.d.ts +36 -0
  56. package/dist/collection/isearchable.d.ts.map +1 -0
  57. package/dist/collection/isearchable.js +2 -0
  58. package/dist/collection/isearchable.js.map +1 -0
  59. package/dist/cursor/ibidirectional-cursor-sequence.d.ts +30 -0
  60. package/dist/cursor/ibidirectional-cursor-sequence.d.ts.map +1 -0
  61. package/dist/cursor/ibidirectional-cursor-sequence.js +2 -0
  62. package/dist/cursor/ibidirectional-cursor-sequence.js.map +1 -0
  63. package/dist/cursor/ibidirectional-cursor.d.ts +13 -0
  64. package/dist/cursor/ibidirectional-cursor.d.ts.map +1 -0
  65. package/dist/cursor/ibidirectional-cursor.js +2 -0
  66. package/dist/cursor/ibidirectional-cursor.js.map +1 -0
  67. package/dist/cursor/icursor-sequence.d.ts +48 -0
  68. package/dist/cursor/icursor-sequence.d.ts.map +1 -0
  69. package/dist/cursor/icursor-sequence.js +2 -0
  70. package/dist/cursor/icursor-sequence.js.map +1 -0
  71. package/dist/cursor/icursor.d.ts +27 -0
  72. package/dist/cursor/icursor.d.ts.map +1 -0
  73. package/dist/cursor/icursor.js +2 -0
  74. package/dist/cursor/icursor.js.map +1 -0
  75. package/dist/cursor/index-cursor-sequence.d.ts +57 -0
  76. package/dist/cursor/index-cursor-sequence.d.ts.map +1 -0
  77. package/dist/cursor/index-cursor-sequence.js +181 -0
  78. package/dist/cursor/index-cursor-sequence.js.map +1 -0
  79. package/dist/cursor/irandom-access-cursor.d.ts +16 -0
  80. package/dist/cursor/irandom-access-cursor.d.ts.map +1 -0
  81. package/dist/cursor/irandom-access-cursor.js +2 -0
  82. package/dist/cursor/irandom-access-cursor.js.map +1 -0
  83. package/dist/deque/blocking-deque.d.ts +36 -0
  84. package/dist/deque/blocking-deque.d.ts.map +1 -0
  85. package/dist/deque/blocking-deque.js +101 -0
  86. package/dist/deque/blocking-deque.js.map +1 -0
  87. package/dist/deque/bounded-deque.d.ts +58 -0
  88. package/dist/deque/bounded-deque.d.ts.map +1 -0
  89. package/dist/deque/bounded-deque.js +103 -0
  90. package/dist/deque/bounded-deque.js.map +1 -0
  91. package/dist/deque/deque.d.ts +35 -0
  92. package/dist/deque/deque.d.ts.map +1 -0
  93. package/dist/deque/deque.js +62 -0
  94. package/dist/deque/deque.js.map +1 -0
  95. package/dist/deque/iasync-deque.d.ts +19 -0
  96. package/dist/deque/iasync-deque.d.ts.map +1 -0
  97. package/dist/deque/iasync-deque.js +2 -0
  98. package/dist/deque/iasync-deque.js.map +1 -0
  99. package/dist/deque/iasync-lossy-deque.d.ts +11 -0
  100. package/dist/deque/iasync-lossy-deque.d.ts.map +1 -0
  101. package/dist/deque/iasync-lossy-deque.js +2 -0
  102. package/dist/deque/iasync-lossy-deque.js.map +1 -0
  103. package/dist/deque/ideque-storage.d.ts +6 -0
  104. package/dist/deque/ideque-storage.d.ts.map +1 -0
  105. package/dist/deque/ideque-storage.js +2 -0
  106. package/dist/deque/ideque-storage.js.map +1 -0
  107. package/dist/deque/ideque.d.ts +72 -0
  108. package/dist/deque/ideque.d.ts.map +1 -0
  109. package/dist/deque/ideque.js +2 -0
  110. package/dist/deque/ideque.js.map +1 -0
  111. package/dist/deque/ilossy-deque.d.ts +42 -0
  112. package/dist/deque/ilossy-deque.d.ts.map +1 -0
  113. package/dist/deque/ilossy-deque.js +2 -0
  114. package/dist/deque/ilossy-deque.js.map +1 -0
  115. package/dist/deque/iwaitable-deque.d.ts +42 -0
  116. package/dist/deque/iwaitable-deque.d.ts.map +1 -0
  117. package/dist/deque/iwaitable-deque.js +2 -0
  118. package/dist/deque/iwaitable-deque.js.map +1 -0
  119. package/dist/disjoint-set/iasync-disjoint-set.d.ts +11 -0
  120. package/dist/disjoint-set/iasync-disjoint-set.d.ts.map +1 -0
  121. package/dist/disjoint-set/iasync-disjoint-set.js +2 -0
  122. package/dist/disjoint-set/iasync-disjoint-set.js.map +1 -0
  123. package/dist/disjoint-set/idisjoint-set.d.ts +11 -0
  124. package/dist/disjoint-set/idisjoint-set.d.ts.map +1 -0
  125. package/dist/disjoint-set/idisjoint-set.js +2 -0
  126. package/dist/disjoint-set/idisjoint-set.js.map +1 -0
  127. package/dist/disjoint-set/static-disjoint-set.d.ts +67 -0
  128. package/dist/disjoint-set/static-disjoint-set.d.ts.map +1 -0
  129. package/dist/disjoint-set/static-disjoint-set.js +146 -0
  130. package/dist/disjoint-set/static-disjoint-set.js.map +1 -0
  131. package/dist/fuzzy/fuzzy-map.d.ts +62 -0
  132. package/dist/fuzzy/fuzzy-map.d.ts.map +1 -0
  133. package/dist/fuzzy/fuzzy-map.js +91 -0
  134. package/dist/fuzzy/fuzzy-map.js.map +1 -0
  135. package/dist/fuzzy/fuzzy-multi-map.d.ts +62 -0
  136. package/dist/fuzzy/fuzzy-multi-map.d.ts.map +1 -0
  137. package/dist/fuzzy/fuzzy-multi-map.js +143 -0
  138. package/dist/fuzzy/fuzzy-multi-map.js.map +1 -0
  139. package/dist/graph/directed-graph.d.ts +78 -0
  140. package/dist/graph/directed-graph.d.ts.map +1 -0
  141. package/dist/graph/directed-graph.js +165 -0
  142. package/dist/graph/directed-graph.js.map +1 -0
  143. package/dist/graph/graph.d.ts +73 -0
  144. package/dist/graph/graph.d.ts.map +1 -0
  145. package/dist/graph/graph.js +145 -0
  146. package/dist/graph/graph.js.map +1 -0
  147. package/dist/graph/iasync-directed-graph.d.ts +10 -0
  148. package/dist/graph/iasync-directed-graph.d.ts.map +1 -0
  149. package/dist/graph/iasync-directed-graph.js +2 -0
  150. package/dist/graph/iasync-directed-graph.js.map +1 -0
  151. package/dist/graph/iasync-graph.d.ts +19 -0
  152. package/dist/graph/iasync-graph.d.ts.map +1 -0
  153. package/dist/graph/iasync-graph.js +2 -0
  154. package/dist/graph/iasync-graph.js.map +1 -0
  155. package/dist/graph/idirected-graph.d.ts +10 -0
  156. package/dist/graph/idirected-graph.d.ts.map +1 -0
  157. package/dist/graph/idirected-graph.js +2 -0
  158. package/dist/graph/idirected-graph.js.map +1 -0
  159. package/dist/graph/igraph.d.ts +25 -0
  160. package/dist/graph/igraph.d.ts.map +1 -0
  161. package/dist/graph/igraph.js +2 -0
  162. package/dist/graph/igraph.js.map +1 -0
  163. package/dist/heap/_array-heap.d.ts +12 -0
  164. package/dist/heap/_array-heap.d.ts.map +1 -0
  165. package/dist/heap/_array-heap.js +74 -0
  166. package/dist/heap/_array-heap.js.map +1 -0
  167. package/dist/heap/binary-heap.d.ts +29 -0
  168. package/dist/heap/binary-heap.d.ts.map +1 -0
  169. package/dist/heap/binary-heap.js +83 -0
  170. package/dist/heap/binary-heap.js.map +1 -0
  171. package/dist/heap/blocking-binary-heap.d.ts +34 -0
  172. package/dist/heap/blocking-binary-heap.d.ts.map +1 -0
  173. package/dist/heap/blocking-binary-heap.js +84 -0
  174. package/dist/heap/blocking-binary-heap.js.map +1 -0
  175. package/dist/heap/bounded-binary-heap.d.ts +42 -0
  176. package/dist/heap/bounded-binary-heap.d.ts.map +1 -0
  177. package/dist/heap/bounded-binary-heap.js +71 -0
  178. package/dist/heap/bounded-binary-heap.js.map +1 -0
  179. package/dist/heap/iasync-heap.d.ts +19 -0
  180. package/dist/heap/iasync-heap.d.ts.map +1 -0
  181. package/dist/heap/iasync-heap.js +2 -0
  182. package/dist/heap/iasync-heap.js.map +1 -0
  183. package/dist/heap/iasync-lossy-heap.d.ts +9 -0
  184. package/dist/heap/iasync-lossy-heap.d.ts.map +1 -0
  185. package/dist/heap/iasync-lossy-heap.js +2 -0
  186. package/dist/heap/iasync-lossy-heap.js.map +1 -0
  187. package/dist/heap/iheap-storage.d.ts +5 -0
  188. package/dist/heap/iheap-storage.d.ts.map +1 -0
  189. package/dist/heap/iheap-storage.js +2 -0
  190. package/dist/heap/iheap-storage.js.map +1 -0
  191. package/dist/heap/iheap.d.ts +51 -0
  192. package/dist/heap/iheap.d.ts.map +1 -0
  193. package/dist/heap/iheap.js +2 -0
  194. package/dist/heap/iheap.js.map +1 -0
  195. package/dist/heap/ilossy-heap.d.ts +28 -0
  196. package/dist/heap/ilossy-heap.d.ts.map +1 -0
  197. package/dist/heap/ilossy-heap.js +2 -0
  198. package/dist/heap/ilossy-heap.js.map +1 -0
  199. package/dist/heap/iwaitable-heap.d.ts +27 -0
  200. package/dist/heap/iwaitable-heap.d.ts.map +1 -0
  201. package/dist/heap/iwaitable-heap.js +2 -0
  202. package/dist/heap/iwaitable-heap.js.map +1 -0
  203. package/dist/index.d.ts +144 -0
  204. package/dist/index.d.ts.map +1 -0
  205. package/dist/index.js +144 -0
  206. package/dist/index.js.map +1 -0
  207. package/dist/interval/iasync-interval-index.d.ts +8 -0
  208. package/dist/interval/iasync-interval-index.d.ts.map +1 -0
  209. package/dist/interval/iasync-interval-index.js +2 -0
  210. package/dist/interval/iasync-interval-index.js.map +1 -0
  211. package/dist/interval/iinterval-index.d.ts +8 -0
  212. package/dist/interval/iinterval-index.d.ts.map +1 -0
  213. package/dist/interval/iinterval-index.js +2 -0
  214. package/dist/interval/iinterval-index.js.map +1 -0
  215. package/dist/interval/static-interval-tree.d.ts +65 -0
  216. package/dist/interval/static-interval-tree.d.ts.map +1 -0
  217. package/dist/interval/static-interval-tree.js +170 -0
  218. package/dist/interval/static-interval-tree.js.map +1 -0
  219. package/dist/list/_bounded-list.d.ts +14 -0
  220. package/dist/list/_bounded-list.d.ts.map +1 -0
  221. package/dist/list/_bounded-list.js +23 -0
  222. package/dist/list/_bounded-list.js.map +1 -0
  223. package/dist/list/array-list.d.ts +56 -0
  224. package/dist/list/array-list.d.ts.map +1 -0
  225. package/dist/list/array-list.js +198 -0
  226. package/dist/list/array-list.js.map +1 -0
  227. package/dist/list/blocking-array-list.d.ts +55 -0
  228. package/dist/list/blocking-array-list.d.ts.map +1 -0
  229. package/dist/list/blocking-array-list.js +190 -0
  230. package/dist/list/blocking-array-list.js.map +1 -0
  231. package/dist/list/blocking-circular-array-list.d.ts +61 -0
  232. package/dist/list/blocking-circular-array-list.d.ts.map +1 -0
  233. package/dist/list/blocking-circular-array-list.js +211 -0
  234. package/dist/list/blocking-circular-array-list.js.map +1 -0
  235. package/dist/list/blocking-doubly-linked-list.d.ts +59 -0
  236. package/dist/list/blocking-doubly-linked-list.d.ts.map +1 -0
  237. package/dist/list/blocking-doubly-linked-list.js +211 -0
  238. package/dist/list/blocking-doubly-linked-list.js.map +1 -0
  239. package/dist/list/blocking-linked-list.d.ts +50 -0
  240. package/dist/list/blocking-linked-list.d.ts.map +1 -0
  241. package/dist/list/blocking-linked-list.js +172 -0
  242. package/dist/list/blocking-linked-list.js.map +1 -0
  243. package/dist/list/bounded-array-list.d.ts +47 -0
  244. package/dist/list/bounded-array-list.d.ts.map +1 -0
  245. package/dist/list/bounded-array-list.js +108 -0
  246. package/dist/list/bounded-array-list.js.map +1 -0
  247. package/dist/list/bounded-circular-array-list.d.ts +54 -0
  248. package/dist/list/bounded-circular-array-list.d.ts.map +1 -0
  249. package/dist/list/bounded-circular-array-list.js +123 -0
  250. package/dist/list/bounded-circular-array-list.js.map +1 -0
  251. package/dist/list/bounded-doubly-linked-list.d.ts +52 -0
  252. package/dist/list/bounded-doubly-linked-list.d.ts.map +1 -0
  253. package/dist/list/bounded-doubly-linked-list.js +123 -0
  254. package/dist/list/bounded-doubly-linked-list.js.map +1 -0
  255. package/dist/list/bounded-linked-list.d.ts +42 -0
  256. package/dist/list/bounded-linked-list.d.ts.map +1 -0
  257. package/dist/list/bounded-linked-list.js +97 -0
  258. package/dist/list/bounded-linked-list.js.map +1 -0
  259. package/dist/list/circular-array-list.d.ts +77 -0
  260. package/dist/list/circular-array-list.d.ts.map +1 -0
  261. package/dist/list/circular-array-list.js +322 -0
  262. package/dist/list/circular-array-list.js.map +1 -0
  263. package/dist/list/doubly-linked-list.d.ts +113 -0
  264. package/dist/list/doubly-linked-list.d.ts.map +1 -0
  265. package/dist/list/doubly-linked-list.js +453 -0
  266. package/dist/list/doubly-linked-list.js.map +1 -0
  267. package/dist/list/iasync-list.d.ts +17 -0
  268. package/dist/list/iasync-list.d.ts.map +1 -0
  269. package/dist/list/iasync-list.js +2 -0
  270. package/dist/list/iasync-list.js.map +1 -0
  271. package/dist/list/ilist-storage.d.ts +9 -0
  272. package/dist/list/ilist-storage.d.ts.map +1 -0
  273. package/dist/list/ilist-storage.js +2 -0
  274. package/dist/list/ilist-storage.js.map +1 -0
  275. package/dist/list/ilist.d.ts +118 -0
  276. package/dist/list/ilist.d.ts.map +1 -0
  277. package/dist/list/ilist.js +8 -0
  278. package/dist/list/ilist.js.map +1 -0
  279. package/dist/list/iwaitable-list.d.ts +47 -0
  280. package/dist/list/iwaitable-list.d.ts.map +1 -0
  281. package/dist/list/iwaitable-list.js +2 -0
  282. package/dist/list/iwaitable-list.js.map +1 -0
  283. package/dist/list/linked-list.d.ts +102 -0
  284. package/dist/list/linked-list.d.ts.map +1 -0
  285. package/dist/list/linked-list.js +377 -0
  286. package/dist/list/linked-list.js.map +1 -0
  287. package/dist/map/iasync-map.d.ts +13 -0
  288. package/dist/map/iasync-map.d.ts.map +1 -0
  289. package/dist/map/iasync-map.js +2 -0
  290. package/dist/map/iasync-map.js.map +1 -0
  291. package/dist/map/iasync-replacing-map.d.ts +8 -0
  292. package/dist/map/iasync-replacing-map.d.ts.map +1 -0
  293. package/dist/map/iasync-replacing-map.js +2 -0
  294. package/dist/map/iasync-replacing-map.js.map +1 -0
  295. package/dist/map/iasync-sorted-map.d.ts +12 -0
  296. package/dist/map/iasync-sorted-map.d.ts.map +1 -0
  297. package/dist/map/iasync-sorted-map.js +2 -0
  298. package/dist/map/iasync-sorted-map.js.map +1 -0
  299. package/dist/map/imap.d.ts +20 -0
  300. package/dist/map/imap.d.ts.map +1 -0
  301. package/dist/map/imap.js +2 -0
  302. package/dist/map/imap.js.map +1 -0
  303. package/dist/map/ireplacing-map.d.ts +19 -0
  304. package/dist/map/ireplacing-map.d.ts.map +1 -0
  305. package/dist/map/ireplacing-map.js +2 -0
  306. package/dist/map/ireplacing-map.js.map +1 -0
  307. package/dist/map/isorted-map.d.ts +23 -0
  308. package/dist/map/isorted-map.d.ts.map +1 -0
  309. package/dist/map/isorted-map.js +2 -0
  310. package/dist/map/isorted-map.js.map +1 -0
  311. package/dist/multimap/iasync-multimap.d.ts +16 -0
  312. package/dist/multimap/iasync-multimap.d.ts.map +1 -0
  313. package/dist/multimap/iasync-multimap.js +2 -0
  314. package/dist/multimap/iasync-multimap.js.map +1 -0
  315. package/dist/multimap/imultimap.d.ts +28 -0
  316. package/dist/multimap/imultimap.d.ts.map +1 -0
  317. package/dist/multimap/imultimap.js +2 -0
  318. package/dist/multimap/imultimap.js.map +1 -0
  319. package/dist/multimap/inverted-index.d.ts +90 -0
  320. package/dist/multimap/inverted-index.d.ts.map +1 -0
  321. package/dist/multimap/inverted-index.js +234 -0
  322. package/dist/multimap/inverted-index.js.map +1 -0
  323. package/dist/multimap/multi-map.d.ts +63 -0
  324. package/dist/multimap/multi-map.d.ts.map +1 -0
  325. package/dist/multimap/multi-map.js +146 -0
  326. package/dist/multimap/multi-map.js.map +1 -0
  327. package/dist/multiset/iasync-multiset.d.ts +13 -0
  328. package/dist/multiset/iasync-multiset.d.ts.map +1 -0
  329. package/dist/multiset/iasync-multiset.js +2 -0
  330. package/dist/multiset/iasync-multiset.js.map +1 -0
  331. package/dist/multiset/imultiset.d.ts +22 -0
  332. package/dist/multiset/imultiset.d.ts.map +1 -0
  333. package/dist/multiset/imultiset.js +2 -0
  334. package/dist/multiset/imultiset.js.map +1 -0
  335. package/dist/multiset/multi-set.d.ts +66 -0
  336. package/dist/multiset/multi-set.d.ts.map +1 -0
  337. package/dist/multiset/multi-set.js +124 -0
  338. package/dist/multiset/multi-set.js.map +1 -0
  339. package/dist/ordered-range/iasync-ordered-range.d.ts +15 -0
  340. package/dist/ordered-range/iasync-ordered-range.d.ts.map +1 -0
  341. package/dist/ordered-range/iasync-ordered-range.js +2 -0
  342. package/dist/ordered-range/iasync-ordered-range.js.map +1 -0
  343. package/dist/ordered-range/iordered-range.d.ts +28 -0
  344. package/dist/ordered-range/iordered-range.d.ts.map +1 -0
  345. package/dist/ordered-range/iordered-range.js +2 -0
  346. package/dist/ordered-range/iordered-range.js.map +1 -0
  347. package/dist/priority-queue/blocking-priority-queue.d.ts +37 -0
  348. package/dist/priority-queue/blocking-priority-queue.d.ts.map +1 -0
  349. package/dist/priority-queue/blocking-priority-queue.js +87 -0
  350. package/dist/priority-queue/blocking-priority-queue.js.map +1 -0
  351. package/dist/priority-queue/bounded-priority-queue.d.ts +45 -0
  352. package/dist/priority-queue/bounded-priority-queue.d.ts.map +1 -0
  353. package/dist/priority-queue/bounded-priority-queue.js +71 -0
  354. package/dist/priority-queue/bounded-priority-queue.js.map +1 -0
  355. package/dist/priority-queue/iasync-lossy-priority-queue.d.ts +9 -0
  356. package/dist/priority-queue/iasync-lossy-priority-queue.d.ts.map +1 -0
  357. package/dist/priority-queue/iasync-lossy-priority-queue.js +2 -0
  358. package/dist/priority-queue/iasync-lossy-priority-queue.js.map +1 -0
  359. package/dist/priority-queue/iasync-priority-queue.d.ts +21 -0
  360. package/dist/priority-queue/iasync-priority-queue.d.ts.map +1 -0
  361. package/dist/priority-queue/iasync-priority-queue.js +2 -0
  362. package/dist/priority-queue/iasync-priority-queue.js.map +1 -0
  363. package/dist/priority-queue/ilossy-priority-queue.d.ts +29 -0
  364. package/dist/priority-queue/ilossy-priority-queue.d.ts.map +1 -0
  365. package/dist/priority-queue/ilossy-priority-queue.js +2 -0
  366. package/dist/priority-queue/ilossy-priority-queue.js.map +1 -0
  367. package/dist/priority-queue/ipriority-queue.d.ts +71 -0
  368. package/dist/priority-queue/ipriority-queue.d.ts.map +1 -0
  369. package/dist/priority-queue/ipriority-queue.js +2 -0
  370. package/dist/priority-queue/ipriority-queue.js.map +1 -0
  371. package/dist/priority-queue/iwaitable-priority-queue.d.ts +27 -0
  372. package/dist/priority-queue/iwaitable-priority-queue.d.ts.map +1 -0
  373. package/dist/priority-queue/iwaitable-priority-queue.js +2 -0
  374. package/dist/priority-queue/iwaitable-priority-queue.js.map +1 -0
  375. package/dist/priority-queue/priority-queue.d.ts +49 -0
  376. package/dist/priority-queue/priority-queue.d.ts.map +1 -0
  377. package/dist/priority-queue/priority-queue.js +134 -0
  378. package/dist/priority-queue/priority-queue.js.map +1 -0
  379. package/dist/probabilistic/bloom-filter.d.ts +92 -0
  380. package/dist/probabilistic/bloom-filter.d.ts.map +1 -0
  381. package/dist/probabilistic/bloom-filter.js +156 -0
  382. package/dist/probabilistic/bloom-filter.js.map +1 -0
  383. package/dist/probabilistic/count-min-sketch.d.ts +76 -0
  384. package/dist/probabilistic/count-min-sketch.d.ts.map +1 -0
  385. package/dist/probabilistic/count-min-sketch.js +119 -0
  386. package/dist/probabilistic/count-min-sketch.js.map +1 -0
  387. package/dist/probabilistic/cuckoo-filter.d.ts +106 -0
  388. package/dist/probabilistic/cuckoo-filter.d.ts.map +1 -0
  389. package/dist/probabilistic/cuckoo-filter.js +214 -0
  390. package/dist/probabilistic/cuckoo-filter.js.map +1 -0
  391. package/dist/probabilistic/hash32.d.ts +28 -0
  392. package/dist/probabilistic/hash32.d.ts.map +1 -0
  393. package/dist/probabilistic/hash32.js +2 -0
  394. package/dist/probabilistic/hash32.js.map +1 -0
  395. package/dist/probabilistic/hyper-log-log.d.ts +74 -0
  396. package/dist/probabilistic/hyper-log-log.d.ts.map +1 -0
  397. package/dist/probabilistic/hyper-log-log.js +134 -0
  398. package/dist/probabilistic/hyper-log-log.js.map +1 -0
  399. package/dist/probabilistic/top-k.d.ts +62 -0
  400. package/dist/probabilistic/top-k.d.ts.map +1 -0
  401. package/dist/probabilistic/top-k.js +104 -0
  402. package/dist/probabilistic/top-k.js.map +1 -0
  403. package/dist/queue/blocking-queue.d.ts +32 -0
  404. package/dist/queue/blocking-queue.d.ts.map +1 -0
  405. package/dist/queue/blocking-queue.js +70 -0
  406. package/dist/queue/blocking-queue.js.map +1 -0
  407. package/dist/queue/bounded-queue.d.ts +47 -0
  408. package/dist/queue/bounded-queue.d.ts.map +1 -0
  409. package/dist/queue/bounded-queue.js +64 -0
  410. package/dist/queue/bounded-queue.js.map +1 -0
  411. package/dist/queue/iasync-lossy-queue.d.ts +15 -0
  412. package/dist/queue/iasync-lossy-queue.d.ts.map +1 -0
  413. package/dist/queue/iasync-lossy-queue.js +2 -0
  414. package/dist/queue/iasync-lossy-queue.js.map +1 -0
  415. package/dist/queue/iasync-queue.d.ts +17 -0
  416. package/dist/queue/iasync-queue.d.ts.map +1 -0
  417. package/dist/queue/iasync-queue.js +2 -0
  418. package/dist/queue/iasync-queue.js.map +1 -0
  419. package/dist/queue/ilossy-queue.d.ts +28 -0
  420. package/dist/queue/ilossy-queue.d.ts.map +1 -0
  421. package/dist/queue/ilossy-queue.js +2 -0
  422. package/dist/queue/ilossy-queue.js.map +1 -0
  423. package/dist/queue/iqueue-storage.d.ts +5 -0
  424. package/dist/queue/iqueue-storage.d.ts.map +1 -0
  425. package/dist/queue/iqueue-storage.js +2 -0
  426. package/dist/queue/iqueue-storage.js.map +1 -0
  427. package/dist/queue/iqueue.d.ts +41 -0
  428. package/dist/queue/iqueue.d.ts.map +1 -0
  429. package/dist/queue/iqueue.js +2 -0
  430. package/dist/queue/iqueue.js.map +1 -0
  431. package/dist/queue/iwaitable-queue.d.ts +27 -0
  432. package/dist/queue/iwaitable-queue.d.ts.map +1 -0
  433. package/dist/queue/iwaitable-queue.js +2 -0
  434. package/dist/queue/iwaitable-queue.js.map +1 -0
  435. package/dist/queue/lossy-queue.d.ts +33 -0
  436. package/dist/queue/lossy-queue.d.ts.map +1 -0
  437. package/dist/queue/lossy-queue.js +75 -0
  438. package/dist/queue/lossy-queue.js.map +1 -0
  439. package/dist/queue/queue.d.ts +27 -0
  440. package/dist/queue/queue.d.ts.map +1 -0
  441. package/dist/queue/queue.js +43 -0
  442. package/dist/queue/queue.js.map +1 -0
  443. package/dist/set/enhanced-set.d.ts +68 -0
  444. package/dist/set/enhanced-set.d.ts.map +1 -0
  445. package/dist/set/enhanced-set.js +169 -0
  446. package/dist/set/enhanced-set.js.map +1 -0
  447. package/dist/set/iasync-replacing-set.d.ts +8 -0
  448. package/dist/set/iasync-replacing-set.d.ts.map +1 -0
  449. package/dist/set/iasync-replacing-set.js +2 -0
  450. package/dist/set/iasync-replacing-set.js.map +1 -0
  451. package/dist/set/iasync-set.d.ts +16 -0
  452. package/dist/set/iasync-set.d.ts.map +1 -0
  453. package/dist/set/iasync-set.js +2 -0
  454. package/dist/set/iasync-set.js.map +1 -0
  455. package/dist/set/iasync-sorted-set.d.ts +7 -0
  456. package/dist/set/iasync-sorted-set.d.ts.map +1 -0
  457. package/dist/set/iasync-sorted-set.js +2 -0
  458. package/dist/set/iasync-sorted-set.js.map +1 -0
  459. package/dist/set/ireplacing-set.d.ts +24 -0
  460. package/dist/set/ireplacing-set.d.ts.map +1 -0
  461. package/dist/set/ireplacing-set.js +2 -0
  462. package/dist/set/ireplacing-set.js.map +1 -0
  463. package/dist/set/iset.d.ts +30 -0
  464. package/dist/set/iset.d.ts.map +1 -0
  465. package/dist/set/iset.js +2 -0
  466. package/dist/set/iset.js.map +1 -0
  467. package/dist/set/isorted-set.d.ts +7 -0
  468. package/dist/set/isorted-set.d.ts.map +1 -0
  469. package/dist/set/isorted-set.js +2 -0
  470. package/dist/set/isorted-set.js.map +1 -0
  471. package/dist/similarity/iasync-similarity-index.d.ts +8 -0
  472. package/dist/similarity/iasync-similarity-index.d.ts.map +1 -0
  473. package/dist/similarity/iasync-similarity-index.js +2 -0
  474. package/dist/similarity/iasync-similarity-index.js.map +1 -0
  475. package/dist/similarity/isimilarity-index.d.ts +8 -0
  476. package/dist/similarity/isimilarity-index.d.ts.map +1 -0
  477. package/dist/similarity/isimilarity-index.js +2 -0
  478. package/dist/similarity/isimilarity-index.js.map +1 -0
  479. package/dist/similarity/vp-tree.d.ts +71 -0
  480. package/dist/similarity/vp-tree.d.ts.map +1 -0
  481. package/dist/similarity/vp-tree.js +172 -0
  482. package/dist/similarity/vp-tree.js.map +1 -0
  483. package/dist/stack/blocking-stack.d.ts +30 -0
  484. package/dist/stack/blocking-stack.d.ts.map +1 -0
  485. package/dist/stack/blocking-stack.js +68 -0
  486. package/dist/stack/blocking-stack.js.map +1 -0
  487. package/dist/stack/bounded-stack.d.ts +38 -0
  488. package/dist/stack/bounded-stack.d.ts.map +1 -0
  489. package/dist/stack/bounded-stack.js +55 -0
  490. package/dist/stack/bounded-stack.js.map +1 -0
  491. package/dist/stack/iasync-lossy-stack.d.ts +9 -0
  492. package/dist/stack/iasync-lossy-stack.d.ts.map +1 -0
  493. package/dist/stack/iasync-lossy-stack.js +2 -0
  494. package/dist/stack/iasync-lossy-stack.js.map +1 -0
  495. package/dist/stack/iasync-stack.d.ts +15 -0
  496. package/dist/stack/iasync-stack.d.ts.map +1 -0
  497. package/dist/stack/iasync-stack.js +2 -0
  498. package/dist/stack/iasync-stack.js.map +1 -0
  499. package/dist/stack/ilossy-stack.d.ts +28 -0
  500. package/dist/stack/ilossy-stack.d.ts.map +1 -0
  501. package/dist/stack/ilossy-stack.js +2 -0
  502. package/dist/stack/ilossy-stack.js.map +1 -0
  503. package/dist/stack/istack-storage.d.ts +5 -0
  504. package/dist/stack/istack-storage.d.ts.map +1 -0
  505. package/dist/stack/istack-storage.js +2 -0
  506. package/dist/stack/istack-storage.js.map +1 -0
  507. package/dist/stack/istack.d.ts +41 -0
  508. package/dist/stack/istack.d.ts.map +1 -0
  509. package/dist/stack/istack.js +2 -0
  510. package/dist/stack/istack.js.map +1 -0
  511. package/dist/stack/iwaitable-stack.d.ts +26 -0
  512. package/dist/stack/iwaitable-stack.d.ts.map +1 -0
  513. package/dist/stack/iwaitable-stack.js +2 -0
  514. package/dist/stack/iwaitable-stack.js.map +1 -0
  515. package/dist/stack/stack.d.ts +26 -0
  516. package/dist/stack/stack.d.ts.map +1 -0
  517. package/dist/stack/stack.js +42 -0
  518. package/dist/stack/stack.js.map +1 -0
  519. package/dist/storage/iindexed-storage.d.ts +8 -0
  520. package/dist/storage/iindexed-storage.d.ts.map +1 -0
  521. package/dist/storage/iindexed-storage.js +2 -0
  522. package/dist/storage/iindexed-storage.js.map +1 -0
  523. package/dist/storage/ipop-back-storage.d.ts +8 -0
  524. package/dist/storage/ipop-back-storage.d.ts.map +1 -0
  525. package/dist/storage/ipop-back-storage.js +2 -0
  526. package/dist/storage/ipop-back-storage.js.map +1 -0
  527. package/dist/storage/ipop-front-storage.d.ts +8 -0
  528. package/dist/storage/ipop-front-storage.d.ts.map +1 -0
  529. package/dist/storage/ipop-front-storage.js +2 -0
  530. package/dist/storage/ipop-front-storage.js.map +1 -0
  531. package/dist/storage/ipush-back-storage.d.ts +7 -0
  532. package/dist/storage/ipush-back-storage.d.ts.map +1 -0
  533. package/dist/storage/ipush-back-storage.js +2 -0
  534. package/dist/storage/ipush-back-storage.js.map +1 -0
  535. package/dist/storage/ipush-front-storage.d.ts +7 -0
  536. package/dist/storage/ipush-front-storage.d.ts.map +1 -0
  537. package/dist/storage/ipush-front-storage.js +2 -0
  538. package/dist/storage/ipush-front-storage.js.map +1 -0
  539. package/dist/storage/istorage.d.ts +13 -0
  540. package/dist/storage/istorage.d.ts.map +1 -0
  541. package/dist/storage/istorage.js +2 -0
  542. package/dist/storage/istorage.js.map +1 -0
  543. package/dist/storage/ring-vector.d.ts +59 -0
  544. package/dist/storage/ring-vector.d.ts.map +1 -0
  545. package/dist/storage/ring-vector.js +192 -0
  546. package/dist/storage/ring-vector.js.map +1 -0
  547. package/dist/storage/segmented-ring-vector.d.ts +42 -0
  548. package/dist/storage/segmented-ring-vector.d.ts.map +1 -0
  549. package/dist/storage/segmented-ring-vector.js +142 -0
  550. package/dist/storage/segmented-ring-vector.js.map +1 -0
  551. package/dist/storage/typed-vector.d.ts +67 -0
  552. package/dist/storage/typed-vector.d.ts.map +1 -0
  553. package/dist/storage/typed-vector.js +123 -0
  554. package/dist/storage/typed-vector.js.map +1 -0
  555. package/dist/substring/generalized-suffix-array.d.ts +43 -0
  556. package/dist/substring/generalized-suffix-array.d.ts.map +1 -0
  557. package/dist/substring/generalized-suffix-array.js +100 -0
  558. package/dist/substring/generalized-suffix-array.js.map +1 -0
  559. package/dist/substring/iasync-substring-index.d.ts +6 -0
  560. package/dist/substring/iasync-substring-index.d.ts.map +1 -0
  561. package/dist/substring/iasync-substring-index.js +2 -0
  562. package/dist/substring/iasync-substring-index.js.map +1 -0
  563. package/dist/substring/isubstring-index.d.ts +6 -0
  564. package/dist/substring/isubstring-index.d.ts.map +1 -0
  565. package/dist/substring/isubstring-index.js +2 -0
  566. package/dist/substring/isubstring-index.js.map +1 -0
  567. package/dist/substring/suffix-array.d.ts +45 -0
  568. package/dist/substring/suffix-array.d.ts.map +1 -0
  569. package/dist/substring/suffix-array.js +164 -0
  570. package/dist/substring/suffix-array.js.map +1 -0
  571. package/dist/tree/avl-tree.d.ts +43 -0
  572. package/dist/tree/avl-tree.d.ts.map +1 -0
  573. package/dist/tree/avl-tree.js +98 -0
  574. package/dist/tree/avl-tree.js.map +1 -0
  575. package/dist/tree/binary-search-tree.d.ts +94 -0
  576. package/dist/tree/binary-search-tree.d.ts.map +1 -0
  577. package/dist/tree/binary-search-tree.js +303 -0
  578. package/dist/tree/binary-search-tree.js.map +1 -0
  579. package/dist/tree/iavl-tree-node.d.ts +6 -0
  580. package/dist/tree/iavl-tree-node.d.ts.map +1 -0
  581. package/dist/tree/iavl-tree-node.js +2 -0
  582. package/dist/tree/iavl-tree-node.js.map +1 -0
  583. package/dist/tree/isearch-tree.d.ts +14 -0
  584. package/dist/tree/isearch-tree.d.ts.map +1 -0
  585. package/dist/tree/isearch-tree.js +2 -0
  586. package/dist/tree/isearch-tree.js.map +1 -0
  587. package/dist/trie/iasync-trie.d.ts +9 -0
  588. package/dist/trie/iasync-trie.d.ts.map +1 -0
  589. package/dist/trie/iasync-trie.js +2 -0
  590. package/dist/trie/iasync-trie.js.map +1 -0
  591. package/dist/trie/itrie.d.ts +9 -0
  592. package/dist/trie/itrie.d.ts.map +1 -0
  593. package/dist/trie/itrie.js +2 -0
  594. package/dist/trie/itrie.js.map +1 -0
  595. package/dist/trie/trie.d.ts +93 -0
  596. package/dist/trie/trie.d.ts.map +1 -0
  597. package/dist/trie/trie.js +190 -0
  598. package/dist/trie/trie.js.map +1 -0
  599. package/package.json +63 -0
@@ -0,0 +1,48 @@
1
+ import { CollectionCapacityExceededError, } from "./ibounded.js";
2
+ export function isBounded(value) {
3
+ return typeof value === "object" && value !== null && "capacity" in value;
4
+ }
5
+ /**
6
+ * Resolves the capacity a bounded collection was constructed with.
7
+ *
8
+ * Deliberately not generic over the storage: `BoundedOptions<TStorage>` is
9
+ * invariant in `TStorage` (it occurs both as a property and inside an
10
+ * intersection), so every caller would have to widen at the call site.
11
+ *
12
+ * @param itemCount How many items the initial iterable held.
13
+ * @throws {RangeError} If the capacity is not a finite, non-negative number,
14
+ * exceeds what the supplied storage can hold, or is already smaller than the
15
+ * initial iterable.
16
+ */
17
+ export function resolveBoundedCapacity(itemCount, options) {
18
+ const storageCapacity = isBounded(options?.storage)
19
+ ? options.storage.capacity
20
+ : undefined;
21
+ const capacity = options?.capacity ?? storageCapacity;
22
+ if (capacity === undefined || !Number.isFinite(capacity) || capacity < 0) {
23
+ throw new RangeError(`Capacity must be a non-negative, finite number, got ${capacity}`);
24
+ }
25
+ if (storageCapacity !== undefined && capacity > storageCapacity) {
26
+ throw new RangeError(`Capacity of ${capacity} exceeds the storage capacity of ${storageCapacity}`);
27
+ }
28
+ if (itemCount > capacity) {
29
+ throw new RangeError(`Initial iterable holds ${itemCount} items, exceeding the capacity of ${capacity}`);
30
+ }
31
+ return capacity;
32
+ }
33
+ /**
34
+ * The capacity check every `Bounded*` collection repeats before adding items.
35
+ *
36
+ * No permit bookkeeping: every collection in this package counts in O(1), so
37
+ * asking it how full it is costs strictly less than mirroring its size in a
38
+ * second counter that can drift.
39
+ *
40
+ * @throws {CollectionCapacityExceededError} If the collection cannot take that
41
+ * many more items.
42
+ */
43
+ export function checkCapacity(count, added, capacity) {
44
+ if (count + added > capacity) {
45
+ throw new CollectionCapacityExceededError(capacity);
46
+ }
47
+ }
48
+ //# sourceMappingURL=_bounded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_bounded.js","sourceRoot":"","sources":["../../src/collection/_bounded.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,+BAA+B,GAE/B,MAAM,eAAe,CAAC;AAEvB,MAAM,UAAU,SAAS,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,UAAU,IAAI,KAAK,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CACrC,SAAiB,EACjB,OAAiC;IAEjC,MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;QAClD,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ;QAC1B,CAAC,CAAC,SAAS,CAAC;IAEb,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,eAAe,CAAC;IAEtD,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QAC1E,MAAM,IAAI,UAAU,CACnB,uDAAuD,QAAQ,EAAE,CACjE,CAAC;IACH,CAAC;IACD,IAAI,eAAe,KAAK,SAAS,IAAI,QAAQ,GAAG,eAAe,EAAE,CAAC;QACjE,MAAM,IAAI,UAAU,CACnB,eAAe,QAAQ,oCAAoC,eAAe,EAAE,CAC5E,CAAC;IACH,CAAC;IACD,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;QAC1B,MAAM,IAAI,UAAU,CACnB,0BAA0B,SAAS,qCAAqC,QAAQ,EAAE,CAClF,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAC5B,KAAa,EACb,KAAa,EACb,QAAgB;IAEhB,IAAI,KAAK,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,+BAA+B,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;AACF,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Internal capacity semaphore for bounded collections.
3
+ *
4
+ * A thin counting-permit wrapper over `@ac-kit/core`'s `WaiterQueue` — the same
5
+ * primitive `@ac-kit/async`'s `Semaphore` is built from. This class exists only
6
+ * because `@ac-kit/async`'s `Semaphore` itself can't be imported here:
7
+ * `async`'s `Channel`/`Broadcast` depend on this package's `Queue`/ `Deque`, so
8
+ * the reverse edge would be circular. `WaiterQueue` lives in `core` — a
9
+ * dependency this package already has — specifically so both sides can share it
10
+ * without that cycle.
11
+ *
12
+ * Do not export this class — it is an implementation detail of bounded
13
+ * collections.
14
+ */
15
+ export declare class CapacitySemaphore {
16
+ private readonly maxValue;
17
+ private value_;
18
+ private readonly waiters;
19
+ constructor(maxValue: number, initialValue?: number);
20
+ get value(): number;
21
+ tryAcquire(count?: number): boolean;
22
+ acquire(count?: number, signal?: AbortSignal | null): Promise<void>;
23
+ release(count?: number): void;
24
+ /**
25
+ * Same as `tryAcquire`, but throws instead of returning `false` — the pattern
26
+ * every bounded collection repeats at its append/insert call sites.
27
+ */
28
+ tryAcquireOrThrow(count?: number): void;
29
+ private handlePendingAcquisitions;
30
+ }
31
+ //# sourceMappingURL=_capacity-semaphore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_capacity-semaphore.d.ts","sourceRoot":"","sources":["../../src/collection/_capacity-semaphore.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAiB;IAM5B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAL1B,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmC;IAE3D,YACkB,QAAQ,EAAE,MAAM,EACjC,YAAY,CAAC,EAAE,MAAM,EAYrB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,UAAU,CAAC,KAAK,SAAI,GAAG,OAAO,CAkB7B;IAED,OAAO,CAAC,KAAK,SAAI,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAa7D;IAED,OAAO,CAAC,KAAK,SAAI,GAAG,IAAI,CAUvB;IAED;;;OAGG;IACH,iBAAiB,CAAC,KAAK,SAAI,GAAG,IAAI,CAIjC;IAED,OAAO,CAAC,yBAAyB;CAWjC"}
@@ -0,0 +1,94 @@
1
+ import { isFinitePositive, WaiterQueue } from "@ac-kit/core";
2
+ import { CollectionCapacityExceededError } from "./ibounded.js";
3
+ /**
4
+ * Internal capacity semaphore for bounded collections.
5
+ *
6
+ * A thin counting-permit wrapper over `@ac-kit/core`'s `WaiterQueue` — the same
7
+ * primitive `@ac-kit/async`'s `Semaphore` is built from. This class exists only
8
+ * because `@ac-kit/async`'s `Semaphore` itself can't be imported here:
9
+ * `async`'s `Channel`/`Broadcast` depend on this package's `Queue`/ `Deque`, so
10
+ * the reverse edge would be circular. `WaiterQueue` lives in `core` — a
11
+ * dependency this package already has — specifically so both sides can share it
12
+ * without that cycle.
13
+ *
14
+ * Do not export this class — it is an implementation detail of bounded
15
+ * collections.
16
+ */
17
+ export class CapacitySemaphore {
18
+ maxValue;
19
+ value_;
20
+ // Metadata is the permit count the waiter is blocked on.
21
+ waiters = new WaiterQueue();
22
+ constructor(maxValue, initialValue) {
23
+ this.maxValue = maxValue;
24
+ initialValue = initialValue ?? maxValue;
25
+ if (initialValue < 0) {
26
+ throw new RangeError("Initial value must be non-negative");
27
+ }
28
+ if (initialValue > maxValue) {
29
+ throw new RangeError("Initial value must not exceed maxValue");
30
+ }
31
+ this.value_ = initialValue;
32
+ }
33
+ get value() {
34
+ return this.value_;
35
+ }
36
+ tryAcquire(count = 1) {
37
+ if (!isFinitePositive(count)) {
38
+ throw new RangeError("Count must be positive");
39
+ }
40
+ if (this.value_ >= count) {
41
+ this.value_ -= count;
42
+ // mitigate concurrency issues
43
+ if (this.value_ < 0) {
44
+ this.value_ += count;
45
+ return false;
46
+ }
47
+ return true;
48
+ }
49
+ return false;
50
+ }
51
+ acquire(count = 1, signal) {
52
+ if (!isFinitePositive(count)) {
53
+ throw new RangeError("Count must be positive");
54
+ }
55
+ // Fast path: no waiters and permit available — skip the queue entirely
56
+ if (this.waiters.size === 0 && this.value_ >= count) {
57
+ if (signal?.aborted)
58
+ return Promise.reject(signal.reason);
59
+ this.value_ -= count;
60
+ return Promise.resolve();
61
+ }
62
+ return this.waiters.enqueue(count, signal);
63
+ }
64
+ release(count = 1) {
65
+ if (!isFinitePositive(count)) {
66
+ throw new RangeError("Count must be positive");
67
+ }
68
+ if (this.value_ + count > this.maxValue) {
69
+ throw new RangeError("Semaphore released too many times");
70
+ }
71
+ this.value_ += count;
72
+ this.handlePendingAcquisitions();
73
+ }
74
+ /**
75
+ * Same as `tryAcquire`, but throws instead of returning `false` — the pattern
76
+ * every bounded collection repeats at its append/insert call sites.
77
+ */
78
+ tryAcquireOrThrow(count = 1) {
79
+ if (!this.tryAcquire(count)) {
80
+ throw new CollectionCapacityExceededError(this.maxValue);
81
+ }
82
+ }
83
+ handlePendingAcquisitions() {
84
+ while (true) {
85
+ const count = this.waiters.peek();
86
+ if (count === undefined || this.value_ < count) {
87
+ break;
88
+ }
89
+ this.value_ -= count;
90
+ this.waiters.releaseNext(undefined);
91
+ }
92
+ }
93
+ }
94
+ //# sourceMappingURL=_capacity-semaphore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_capacity-semaphore.js","sourceRoot":"","sources":["../../src/collection/_capacity-semaphore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAEhE;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,iBAAiB;IAMX,QAAQ;IALlB,MAAM,CAAS;IACvB,yDAAyD;IACxC,OAAO,GAAG,IAAI,WAAW,EAAgB,CAAC;IAE3D,YACkB,QAAgB,EACjC,YAAqB;wBADJ,QAAQ;QAGzB,YAAY,GAAG,YAAY,IAAI,QAAQ,CAAC;QAExC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,UAAU,CAAC,oCAAoC,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,YAAY,GAAG,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAI,UAAU,CAAC,wCAAwC,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC;IAC5B,CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,UAAU,CAAC,KAAK,GAAG,CAAC;QACnB,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,UAAU,CAAC,wBAAwB,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;YAErB,8BAA8B;YAC9B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;gBACrB,OAAO,KAAK,CAAC;YACd,CAAC;YAED,OAAO,IAAI,CAAC;QACb,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAK,GAAG,CAAC,EAAE,MAA2B;QAC7C,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,UAAU,CAAC,wBAAwB,CAAC,CAAC;QAChD,CAAC;QAED,uEAAuE;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC;YACrD,IAAI,MAAM,EAAE,OAAO;gBAAE,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC1D,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;YACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC1B,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,CAAC,KAAK,GAAG,CAAC;QAChB,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,UAAU,CAAC,wBAAwB,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACzC,MAAM,IAAI,UAAU,CAAC,mCAAmC,CAAC,CAAC;QAC3D,CAAC;QAED,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;QACrB,IAAI,CAAC,yBAAyB,EAAE,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,iBAAiB,CAAC,KAAK,GAAG,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,+BAA+B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1D,CAAC;IACF,CAAC;IAEO,yBAAyB;QAChC,OAAO,IAAI,EAAE,CAAC;YACb,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClC,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;gBAChD,MAAM;YACP,CAAC;YAED,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;YACrB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The async-backed sibling of {@link ICollection}.
3
+ *
4
+ * Every member mirrors its sync counterpart; the only additions are `Promise`
5
+ * wrapping and an optional `AbortSignal`, since anything that waits on I/O must
6
+ * be cancellable. Declared to prove the design composes — no concrete
7
+ * implementation exists yet.
8
+ *
9
+ * @template T The type of elements in the collection. Anything except
10
+ * `undefined`.
11
+ */
12
+ export interface IAsyncCollection<T> extends AsyncIterable<T> {
13
+ count(signal?: AbortSignal): Promise<number>;
14
+ clear(signal?: AbortSignal): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=iasync-collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iasync-collection.d.ts","sourceRoot":"","sources":["../../src/collection/iasync-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IAC5D,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7C,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The async-backed sibling of {@link ICollection}.
3
+ *
4
+ * Every member mirrors its sync counterpart; the only additions are `Promise`
5
+ * wrapping and an optional `AbortSignal`, since anything that waits on I/O must
6
+ * be cancellable. Declared to prove the design composes — no concrete
7
+ * implementation exists yet.
8
+ *
9
+ * @template T The type of elements in the collection. Anything except
10
+ * `undefined`.
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=iasync-collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iasync-collection.js","sourceRoot":"","sources":["../../src/collection/iasync-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,9 @@
1
+ import { MaybeAsyncCallable, MaybeAsyncPredicate } from "@ac-kit/core";
2
+ /** The async-backed sibling of {@link ISearchable}. */
3
+ export interface IAsyncSearchable<T> {
4
+ removeFirst(condition: MaybeAsyncPredicate<[T]>, signal?: AbortSignal): Promise<boolean>;
5
+ remove(condition: MaybeAsyncPredicate<[T]>, signal?: AbortSignal): AsyncIterableIterator<T>;
6
+ replaceFirst(condition: MaybeAsyncPredicate<[T]>, newItem: T, signal?: AbortSignal): Promise<boolean>;
7
+ replace(condition: MaybeAsyncPredicate<[T]>, newItemFactory: MaybeAsyncCallable<[T], T>, signal?: AbortSignal): AsyncIterableIterator<T>;
8
+ }
9
+ //# sourceMappingURL=iasync-searchable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iasync-searchable.d.ts","sourceRoot":"","sources":["../../src/collection/iasync-searchable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEvE,uDAAuD;AACvD,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAClC,WAAW,CACV,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,EACnC,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB,MAAM,CACL,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,EACnC,MAAM,CAAC,EAAE,WAAW,GAClB,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAE5B,YAAY,CACX,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,EACnC,OAAO,EAAE,CAAC,EACV,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB,OAAO,CACN,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,EACnC,cAAc,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAC1C,MAAM,CAAC,EAAE,WAAW,GAClB,qBAAqB,CAAC,CAAC,CAAC,CAAC;CAC5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=iasync-searchable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iasync-searchable.js","sourceRoot":"","sources":["../../src/collection/iasync-searchable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ /** Error thrown when an insert would exceed a collection's capacity. */
2
+ export declare class CollectionCapacityExceededError extends Error {
3
+ constructor(capacity: number);
4
+ }
5
+ /** A collection with a fixed maximum size, imposed at construction. */
6
+ export interface IBounded {
7
+ /**
8
+ * The maximum number of elements the collection can hold.
9
+ *
10
+ * Note: `Infinity` is not a legal value here — an unbounded type omits this
11
+ * mixin.
12
+ */
13
+ readonly capacity: number;
14
+ }
15
+ /**
16
+ * Constructor options for a bounded collection.
17
+ *
18
+ * The capacity comes from exactly one of two places: the `capacity` option, or
19
+ * a storage that carries its own (`FixedVector`, or any other `ICapacityBound`
20
+ * storage). Having to state it in both places is what would otherwise force a
21
+ * separate class per fixed-size collection; letting the storage answer for
22
+ * itself makes `new BoundedQueue(undefined, { storage: new FixedVector(1024)
23
+ * })` enough.
24
+ *
25
+ * Passing both is allowed, and then `capacity` must not exceed the storage's.
26
+ *
27
+ * @template TStorage The storage capability tier the collection requires.
28
+ */
29
+ export type BoundedOptions<TStorage> = {
30
+ capacity: number;
31
+ storage?: TStorage;
32
+ } | {
33
+ capacity?: never;
34
+ storage: TStorage & IBounded;
35
+ };
36
+ //# sourceMappingURL=ibounded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ibounded.d.ts","sourceRoot":"","sources":["../../src/collection/ibounded.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,qBAAa,+BAAgC,SAAQ,KAAK;IACzD,YAAY,QAAQ,EAAE,MAAM,EAG3B;CACD;AAED,uEAAuE;AACvE,MAAM,WAAW,QAAQ;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,cAAc,CAAC,QAAQ,IAChC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,QAAQ,CAAA;CAAE,GACxC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** Error thrown when an insert would exceed a collection's capacity. */
2
+ export class CollectionCapacityExceededError extends Error {
3
+ constructor(capacity) {
4
+ super(`Collection capacity of ${capacity} exceeded`);
5
+ this.name = "CollectionCapacityExceededError";
6
+ }
7
+ }
8
+ //# sourceMappingURL=ibounded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ibounded.js","sourceRoot":"","sources":["../../src/collection/ibounded.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,OAAO,+BAAgC,SAAQ,KAAK;IACzD,YAAY,QAAgB;QAC3B,KAAK,CAAC,0BAA0B,QAAQ,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,GAAG,iCAAiC,CAAC;IAC/C,CAAC;CACD"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Interface representing a collection of elements.
3
+ *
4
+ * Throughout this hierarchy `undefined` means "there is no element" — it is
5
+ * what `get`, `front`, `back`, `peek`, `top`, `root`, `shift`, `pop`, `dequeue`
6
+ * and `extract` return when there is nothing to return. Elements therefore
7
+ * cannot be `undefined` themselves, which {@link DefinedValue} enforces. Use
8
+ * `null` for an element that means nothing.
9
+ *
10
+ * @template T The type of elements in the collection. Anything except
11
+ * `undefined`.
12
+ */
13
+ export interface ICollection<T> extends Iterable<T> {
14
+ /**
15
+ * The number of elements in the collection.
16
+ *
17
+ * A method, not a getter: its async counterpart needs a round trip to the
18
+ * backing store, and a member must have the same shape in both.
19
+ */
20
+ count(): number;
21
+ /** Removes all elements from the collection. */
22
+ clear(): void;
23
+ }
24
+ //# sourceMappingURL=icollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icollection.d.ts","sourceRoot":"","sources":["../../src/collection/icollection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,CAAE,SAAQ,QAAQ,CAAC,CAAC,CAAC;IAClD;;;;;OAKG;IACH,KAAK,IAAI,MAAM,CAAC;IAEhB,gDAAgD;IAChD,KAAK,IAAI,IAAI,CAAC;CACd"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=icollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icollection.js","sourceRoot":"","sources":["../../src/collection/icollection.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { IBounded } from "./ibounded.js";
2
+ /**
3
+ * Overflow policy for bounded collections.
4
+ *
5
+ * - `"evict"` drops an existing element to make room.
6
+ * - `"skip"` drops the incoming element, leaving the collection unchanged.
7
+ *
8
+ * Which existing element is dropped under `"evict"` is defined by the ADT
9
+ * (`Queue` drops the front, `Stack` the bottom, `Deque` the end opposite the
10
+ * insertion, `Heap`/`PriorityQueue` the root), never by the caller — a
11
+ * positional enum (front/back, oldest/newest) would be ambiguous for a `Deque`
12
+ * (inserts at both ends) and meaningless for a heap (no ends at all).
13
+ */
14
+ export type OverflowPolicy = "evict" | "skip";
15
+ /** A bounded collection that never throws on an over-capacity insert. */
16
+ export interface ILossy extends IBounded {
17
+ /** Policy applied when the collection reaches its capacity. */
18
+ readonly overflowPolicy: OverflowPolicy;
19
+ }
20
+ //# sourceMappingURL=ilossy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ilossy.d.ts","sourceRoot":"","sources":["../../src/collection/ilossy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9C,yEAAyE;AACzE,MAAM,WAAW,MAAO,SAAQ,QAAQ;IACvC,+DAA+D;IAC/D,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;CACxC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ilossy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ilossy.js","sourceRoot":"","sources":["../../src/collection/ilossy.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import type { IBounded } from "./ibounded.js";
2
+ /**
3
+ * Replacement policies for associative collections that exceed their capacity.
4
+ *
5
+ * - Least recently used (LRU),
6
+ * - Least frequently used (LFU),
7
+ * - First in first out (FIFO),
8
+ * - Skip (no replacement).
9
+ */
10
+ export type ReplacementPolicy = "lru" | "lfu" | "fifo" | "skip";
11
+ /**
12
+ * A bounded associative collection that replaces an entry instead of rejecting
13
+ * an over-capacity insert.
14
+ *
15
+ * Positional ADTs have a natural eviction victim (see {@link ILossy}) contrary
16
+ * to associative ones.
17
+ */
18
+ export interface IReplacing extends IBounded {
19
+ /**
20
+ * The policy that determines which entry to replace when the collection
21
+ * exceeds its capacity.
22
+ */
23
+ readonly overflowPolicy: ReplacementPolicy;
24
+ }
25
+ //# sourceMappingURL=ireplacing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ireplacing.d.ts","sourceRoot":"","sources":["../../src/collection/ireplacing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC3C;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,iBAAiB,CAAC;CAC3C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ireplacing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ireplacing.js","sourceRoot":"","sources":["../../src/collection/ireplacing.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ import type { Callable, Predicate } from "@ac-kit/core";
2
+ /** Predicate-driven removal and replacement. */
3
+ export interface ISearchable<T> {
4
+ /**
5
+ * Removes the first occurrence of the item matching the given predicate.
6
+ *
7
+ * @param condition A predicate function to identify the item to remove.
8
+ * @returns `true` if the item was found and removed, `false` otherwise.
9
+ */
10
+ removeFirst(condition: Predicate<[T]>): boolean;
11
+ /**
12
+ * Removes every item matching the given predicate.
13
+ *
14
+ * @param condition A predicate function to identify the items to remove.
15
+ * @returns An iterator of the removed items.
16
+ */
17
+ remove(condition: Predicate<[T]>): IterableIterator<T>;
18
+ /**
19
+ * Replaces the first occurrence of the item matching the given predicate.
20
+ *
21
+ * @param condition A predicate function to identify the item to replace.
22
+ * @param newItem The new item to insert.
23
+ * @returns `true` if the item was found and replaced, `false` otherwise.
24
+ */
25
+ replaceFirst(condition: Predicate<[T]>, newItem: T): boolean;
26
+ /**
27
+ * Replaces every item matching the given predicate.
28
+ *
29
+ * @param condition A predicate function to identify the items to replace.
30
+ * @param newItemFactory A function that takes the old item and returns the
31
+ * new item to insert.
32
+ * @returns An iterator of the replaced items.
33
+ */
34
+ replace(condition: Predicate<[T]>, newItemFactory: Callable<[T], T>): IterableIterator<T>;
35
+ }
36
+ //# sourceMappingURL=isearchable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isearchable.d.ts","sourceRoot":"","sources":["../../src/collection/isearchable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExD,gDAAgD;AAChD,MAAM,WAAW,WAAW,CAAC,CAAC;IAC7B;;;;;OAKG;IACH,WAAW,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;IAEhD;;;;;OAKG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAEvD;;;;;;OAMG;IACH,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;IAE7D;;;;;;;OAOG;IACH,OAAO,CACN,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EACzB,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAC9B,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isearchable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isearchable.js","sourceRoot":"","sources":["../../src/collection/isearchable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import { DefinedValue } from "@ac-kit/core";
2
+ import { IBidirectionalCursor } from "./ibidirectional-cursor.js";
3
+ import { ICursorSequence } from "./icursor-sequence.js";
4
+ /** Adds the operations that need a predecessor, i.e. a back link or an index. */
5
+ export interface IBidirectionalCursorSequence<T extends DefinedValue = DefinedValue, C extends IBidirectionalCursor<T> = IBidirectionalCursor<T>> extends ICursorSequence<T, C> {
6
+ /**
7
+ * Inserts an item before `cursor`. O(1).
8
+ *
9
+ * @param cursor The position before which to insert.
10
+ * @param item The item to insert.
11
+ */
12
+ insertBefore(cursor: C, item: T): void;
13
+ /**
14
+ * Inserts every item before `cursor`, keeping their relative order. O(n) in
15
+ * the number of items.
16
+ *
17
+ * @param cursor The position before which to insert.
18
+ * @param items The items to insert.
19
+ */
20
+ insertAllBefore(cursor: C, items: readonly T[]): void;
21
+ /**
22
+ * Removes the element at `cursor`. O(1). Cursors at the removed element
23
+ * become invalid.
24
+ *
25
+ * @param cursor The position to remove.
26
+ * @returns The removed element, or `undefined` if `cursor` was not valid.
27
+ */
28
+ removeAt(cursor: C): T | undefined;
29
+ }
30
+ //# sourceMappingURL=ibidirectional-cursor-sequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ibidirectional-cursor-sequence.d.ts","sourceRoot":"","sources":["../../src/cursor/ibidirectional-cursor-sequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,iFAAiF;AACjF,MAAM,WAAW,4BAA4B,CAC5C,CAAC,SAAS,YAAY,GAAG,YAAY,EACrC,CAAC,SAAS,oBAAoB,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAC1D,SAAQ,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAEvC;;;;;;OAMG;IACH,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC;IAEtD;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;CACnC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ibidirectional-cursor-sequence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ibidirectional-cursor-sequence.js","sourceRoot":"","sources":["../../src/cursor/ibidirectional-cursor-sequence.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { DefinedValue } from "@ac-kit/core";
2
+ import { ICursor } from "./icursor.js";
3
+ /** A cursor over a sequence that can also be walked backward. */
4
+ export interface IBidirectionalCursor<T extends DefinedValue = DefinedValue> extends ICursor<T> {
5
+ /**
6
+ * Moves one position back.
7
+ *
8
+ * @returns `false` if that moved before the start.
9
+ */
10
+ retreat(): boolean;
11
+ clone(): IBidirectionalCursor<T>;
12
+ }
13
+ //# sourceMappingURL=ibidirectional-cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ibidirectional-cursor.d.ts","sourceRoot":"","sources":["../../src/cursor/ibidirectional-cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,iEAAiE;AACjE,MAAM,WAAW,oBAAoB,CACpC,CAAC,SAAS,YAAY,GAAG,YAAY,CACpC,SAAQ,OAAO,CAAC,CAAC,CAAC;IACnB;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB,KAAK,IAAI,oBAAoB,CAAC,CAAC,CAAC,CAAC;CACjC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ibidirectional-cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ibidirectional-cursor.js","sourceRoot":"","sources":["../../src/cursor/ibidirectional-cursor.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ import type { DefinedValue } from "@ac-kit/core";
2
+ import { ICursor } from "./icursor.js";
3
+ /**
4
+ * Forward-only cursor editing — the shape a singly-linked list can honour.
5
+ *
6
+ * @template T The type of elements in the sequence. Anything except
7
+ * `undefined`.
8
+ * @template C The cursor type this sequence produces.
9
+ */
10
+ export interface ICursorSequence<T extends DefinedValue = DefinedValue, C extends ICursor<T> = ICursor<T>> {
11
+ /** The first element; invalid when empty. */
12
+ begin(): C;
13
+ /** The past-the-end position, used to append. */
14
+ end(): C;
15
+ /** O(1) for random-access backings, O(n) otherwise. */
16
+ cursorAt(index: number): C;
17
+ /**
18
+ * Inserts an item after `cursor`. O(1).
19
+ *
20
+ * @param cursor The position after which to insert.
21
+ * @param item The item to insert.
22
+ */
23
+ insertAfter(cursor: C, item: T): void;
24
+ /**
25
+ * Inserts every item after `cursor`, keeping their relative order. O(n) in
26
+ * the number of items.
27
+ *
28
+ * @param cursor The position after which to insert.
29
+ * @param items The items to insert.
30
+ */
31
+ insertAllAfter(cursor: C, items: readonly T[]): void;
32
+ /**
33
+ * Removes the element after `cursor`. O(1). Cursors at the removed element
34
+ * become invalid.
35
+ *
36
+ * @param cursor The position before the element to remove.
37
+ * @returns The removed element, or `undefined` if there was none.
38
+ */
39
+ removeAfter(cursor: C): T | undefined;
40
+ /**
41
+ * Replaces the element at `cursor`.
42
+ *
43
+ * @param cursor The position to replace.
44
+ * @param item The new item.
45
+ */
46
+ setAt(cursor: C, item: T): void;
47
+ }
48
+ //# sourceMappingURL=icursor-sequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icursor-sequence.d.ts","sourceRoot":"","sources":["../../src/cursor/icursor-sequence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,eAAe,CAC/B,CAAC,SAAS,YAAY,GAAG,YAAY,EACrC,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAEjC,6CAA6C;IAC7C,KAAK,IAAI,CAAC,CAAC;IAEX,iDAAiD;IACjD,GAAG,IAAI,CAAC,CAAC;IAET,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;IAE3B;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAEtC;;;;;;OAMG;IACH,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC;IAErD;;;;;;OAMG;IACH,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAEtC;;;;;OAKG;IACH,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;CAChC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=icursor-sequence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icursor-sequence.js","sourceRoot":"","sources":["../../src/cursor/icursor-sequence.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ import type { DefinedValue } from "@ac-kit/core";
2
+ /**
3
+ * A stable position in a sequence, surviving across calls — the extra a plain
4
+ * `Iterator` cannot offer, being single-pass, forward-only and positionless.
5
+ *
6
+ * The interface guarantees only that `valid` reports the truth; it does not
7
+ * promise that a cursor survives a mutation of the sequence it was obtained
8
+ * from. Invalidation rules are documented per implementing class.
9
+ *
10
+ * @template T The type of elements in the sequence. Anything except
11
+ * `undefined`.
12
+ */
13
+ export interface ICursor<T extends DefinedValue = DefinedValue> {
14
+ /** False once moved past the end, or once its element was removed. */
15
+ readonly valid: boolean;
16
+ /** The element at this position, `undefined` when not `valid`. */
17
+ readonly value: T | undefined;
18
+ /**
19
+ * Moves one position forward.
20
+ *
21
+ * @returns `false` if that moved past the end.
22
+ */
23
+ advance(): boolean;
24
+ /** An independent cursor at the same position. */
25
+ clone(): ICursor<T>;
26
+ }
27
+ //# sourceMappingURL=icursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icursor.d.ts","sourceRoot":"","sources":["../../src/cursor/icursor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IAC7D,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAExB,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IAE9B;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB,kDAAkD;IAClD,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=icursor.js.map