@delali/narsil 0.3.1-next.144 → 0.3.1-next.146

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 (241) hide show
  1. package/dist/adapters/filesystem.d.ts +1 -1
  2. package/dist/adapters/filesystem.mjs +101 -13
  3. package/dist/adapters/gcs.d.ts +49 -0
  4. package/dist/adapters/gcs.mjs +213 -0
  5. package/dist/adapters/indexeddb.d.ts +1 -1
  6. package/dist/adapters/indexeddb.mjs +2 -7
  7. package/dist/adapters/memory.d.ts +1 -1
  8. package/dist/adapters/memory.mjs +5 -0
  9. package/dist/adapters/s3.d.ts +53 -0
  10. package/dist/adapters/s3.mjs +263 -0
  11. package/dist/{adapters-BQFQ4PRz.d.ts → adapters-pljAqmrC.d.ts} +33 -0
  12. package/dist/analysis-change-ZCJNYBJM.mjs +39 -0
  13. package/dist/{browser/analysis-change-entry-7HR4LWL3.mjs → analysis-change-entry-YN3ELL6C.mjs} +1 -1
  14. package/dist/browser/{analysis-change-JPV775LR.mjs → analysis-change-M65AZQQG.mjs} +8 -5
  15. package/dist/{analysis-change-entry-TZTG4AZB.mjs → browser/analysis-change-entry-H3YIOLXZ.mjs} +1 -1
  16. package/dist/browser/{chunk-VFYMPCOV.mjs → chunk-2JABMB4S.mjs} +10 -6
  17. package/dist/{chunk-46NZOPHS.mjs → browser/chunk-4DYLCICG.mjs} +2 -2
  18. package/dist/browser/{chunk-MZI3TEOW.mjs → chunk-4RD3AFSB.mjs} +1 -1
  19. package/dist/browser/{chunk-WCFCHIBB.mjs → chunk-5V74FFZE.mjs} +2 -2
  20. package/dist/{chunk-NN33CZRE.mjs → browser/chunk-6OWX3OP2.mjs} +2 -2
  21. package/dist/browser/chunk-BRWY3JCN.mjs +678 -0
  22. package/dist/browser/{chunk-5DB2VDGI.mjs → chunk-BVX2MEHA.mjs} +306 -607
  23. package/dist/browser/{chunk-KTOK275N.mjs → chunk-D6UFGBF5.mjs} +15 -45
  24. package/dist/browser/{chunk-D33A5VMU.mjs → chunk-IAXZAVYL.mjs} +25 -66
  25. package/dist/browser/chunk-JNOAKDUM.mjs +31 -0
  26. package/dist/browser/{chunk-LVY2LI35.mjs → chunk-KAEVGLYN.mjs} +2 -2
  27. package/dist/browser/{chunk-3ZBJYAS4.mjs → chunk-LURXVCHG.mjs} +1 -1
  28. package/dist/browser/chunk-MPK76GVS.mjs +63 -0
  29. package/dist/browser/{chunk-ZEV26AQ6.mjs → chunk-NVEJJP4R.mjs} +1 -1
  30. package/dist/browser/{chunk-HKX2G6WH.mjs → chunk-ODQP7P3H.mjs} +455 -66
  31. package/dist/browser/{chunk-35B42UFM.mjs → chunk-PIS7ZAP7.mjs} +12 -25
  32. package/dist/browser/{chunk-TCLEOZ4P.mjs → chunk-QMNZFFD3.mjs} +4 -3
  33. package/dist/browser/{chunk-R4WUDZQV.mjs → chunk-SRL47USS.mjs} +2 -2
  34. package/dist/browser/chunk-TY7L6OXO.mjs +69 -0
  35. package/dist/browser/{chunk-MVM33ZUL.mjs → chunk-W643QV3L.mjs} +6 -5
  36. package/dist/browser/chunk-WXLBZJMT.mjs +25 -0
  37. package/dist/browser/{chunk-MWUK3DA5.mjs → chunk-XILIT5MT.mjs} +8 -8
  38. package/dist/browser/{cold-module-MJMKNUYJ.mjs → cold-module-A5S6JFDN.mjs} +20 -20
  39. package/dist/browser/{durability-wiring-SNOWIT6Z.mjs → durability-wiring-W5AVV3RF.mjs} +120 -80
  40. package/dist/browser/gzip-5S7ROJFJ.mjs +1 -0
  41. package/dist/browser/import-PTT63AGK.mjs +12 -0
  42. package/dist/browser/{module-BUFNZMEU.mjs → module-CEKA7MQH.mjs} +13 -10
  43. package/dist/browser/module-X5PGOE47.mjs +4288 -0
  44. package/dist/browser/{phrase-module-HGVBO24W.mjs → phrase-module-CNKMUY4U.mjs} +2 -1
  45. package/dist/browser/pool-DTYSPBMQ.mjs +296 -0
  46. package/dist/{restore-queue-FEYAC4SB.mjs → browser/restore-queue-DD4LWZK7.mjs} +2 -2
  47. package/dist/browser/{runtime-VEUH674B.mjs → runtime-D2ULZGCN.mjs} +3 -2
  48. package/dist/browser/{snapshot-QXBKHJAG.mjs → snapshot-DQ6A4PQP.mjs} +20 -15
  49. package/dist/browser/{write-WHFBDWQS.mjs → write-MAGRAIEH.mjs} +14 -11
  50. package/dist/{capabilities-BCdUwK_L.d.ts → capabilities-BT-HLDC8.d.ts} +3 -3
  51. package/dist/{chunk-O4LJQI4G.mjs → chunk-2HJWQPR6.mjs} +126 -4
  52. package/dist/{chunk-Z4HFMYNX.mjs → chunk-3BVGJ4JR.mjs} +36 -13
  53. package/dist/{chunk-ZPWS2SKJ.mjs → chunk-3HV7M5OJ.mjs} +272 -112
  54. package/dist/{chunk-UIKN2OTQ.mjs → chunk-3MXV3VHR.mjs} +2 -23
  55. package/dist/{browser/chunk-CCOAOO73.mjs → chunk-3SBJVQLL.mjs} +2 -2
  56. package/dist/chunk-3TVDTACC.mjs +104 -0
  57. package/dist/{chunk-YH5OIL7B.mjs → chunk-5QMHMELB.mjs} +6 -1
  58. package/dist/{chunk-SBMAWTRG.mjs → chunk-5WB2A3XU.mjs} +84 -15
  59. package/dist/{chunk-NPNK57CA.mjs → chunk-65WCV5JO.mjs} +1 -1
  60. package/dist/chunk-6BWLDLS3.mjs +58 -0
  61. package/dist/{chunk-UUZCQQG2.mjs → chunk-6C5EX2QR.mjs} +3 -3
  62. package/dist/{chunk-VEFN6X6Q.mjs → chunk-6F6USYII.mjs} +120 -13
  63. package/dist/{chunk-AST3SHFA.mjs → chunk-7HKWO4BJ.mjs} +7 -7
  64. package/dist/{chunk-W2COJ5AH.mjs → chunk-7N223GWV.mjs} +2 -2
  65. package/dist/{chunk-GWOS5DYC.mjs → chunk-ADBS5XRI.mjs} +11 -13
  66. package/dist/{chunk-TNBIK2LQ.mjs → chunk-AWNHDBKV.mjs} +430 -75
  67. package/dist/{chunk-ZMBFWQXN.mjs → chunk-B2FTZNNF.mjs} +2 -2
  68. package/dist/chunk-B7XIOAMK.mjs +100 -0
  69. package/dist/{chunk-W55X2BYN.mjs → chunk-BEZH7VEH.mjs} +1 -1
  70. package/dist/{chunk-QSK35UC2.mjs → chunk-BTPGQC6Z.mjs} +3 -11
  71. package/dist/{chunk-LA4WNDHL.mjs → chunk-CYYSZPVV.mjs} +12 -14
  72. package/dist/{chunk-SRJBFG2T.mjs → chunk-DOY6EG76.mjs} +6 -7
  73. package/dist/{chunk-6SNBQESJ.mjs → chunk-F22IOCR2.mjs} +10 -6
  74. package/dist/{chunk-J6YVB2XM.mjs → chunk-IJPK5PGM.mjs} +1 -1
  75. package/dist/{chunk-L76W3IZJ.mjs → chunk-IRWP524D.mjs} +1 -1
  76. package/dist/{chunk-XS2VM7UE.mjs → chunk-IZT3G24Q.mjs} +2 -2
  77. package/dist/{chunk-NOT5QOHU.mjs → chunk-J7M73VY7.mjs} +1 -1
  78. package/dist/chunk-K5HSUPYS.mjs +11 -0
  79. package/dist/chunk-KAKQ74LS.mjs +53 -0
  80. package/dist/{chunk-ZSWHPKGM.mjs → chunk-KYVRZAYP.mjs} +69 -2
  81. package/dist/{chunk-NRUXBYPH.mjs → chunk-KZ5GQE4Z.mjs} +5 -5
  82. package/dist/{browser/chunk-XNWPP5NS.mjs → chunk-KZQIVGW7.mjs} +2 -2
  83. package/dist/{chunk-KZL72VTC.mjs → chunk-L7TIAYPX.mjs} +11 -10
  84. package/dist/{chunk-DD2673TX.mjs → chunk-LDGGR7YT.mjs} +4 -81
  85. package/dist/{chunk-XZ3SRNDJ.mjs → chunk-LJ4ENXOD.mjs} +77 -16
  86. package/dist/chunk-LQG5G2LY.mjs +39 -0
  87. package/dist/{chunk-HNHCNTVG.mjs → chunk-MDF6PDIA.mjs} +11 -0
  88. package/dist/{chunk-74XB2SXI.mjs → chunk-NVTFQFUL.mjs} +16 -2
  89. package/dist/{chunk-BOJZGUS6.mjs → chunk-NYSONUB7.mjs} +1 -1
  90. package/dist/{chunk-WJGO5PGV.mjs → chunk-O4KUNDVF.mjs} +31 -17
  91. package/dist/{chunk-PWIWSUCX.mjs → chunk-POUYICOU.mjs} +1 -1
  92. package/dist/{chunk-EBIHRL7B.mjs → chunk-Q2UL2TPC.mjs} +1 -1
  93. package/dist/{chunk-NJJCPFXN.mjs → chunk-QEYF2SQ6.mjs} +2 -2
  94. package/dist/{chunk-7AUASRE7.mjs → chunk-QN5WVV5K.mjs} +7 -7
  95. package/dist/{chunk-RIIUZJQ3.mjs → chunk-QYRNLLLI.mjs} +1 -1
  96. package/dist/chunk-SOUZMPME.mjs +1635 -0
  97. package/dist/{chunk-C3YDYX6C.mjs → chunk-T4CJDBBE.mjs} +1 -1
  98. package/dist/{chunk-YLNSJQLX.mjs → chunk-TTCKT2RT.mjs} +5 -5
  99. package/dist/{chunk-KEIYVZUX.mjs → chunk-U2726TL5.mjs} +5 -5
  100. package/dist/{chunk-RKAVHNRW.mjs → chunk-U46IZNCW.mjs} +10 -5
  101. package/dist/{chunk-BRUUBXCB.mjs → chunk-U6NE6RCV.mjs} +10 -38
  102. package/dist/{chunk-VJEGOELZ.mjs → chunk-VP6XRMWR.mjs} +4 -4
  103. package/dist/{chunk-IO5F7ZBE.mjs → chunk-VQDZVWN3.mjs} +874 -413
  104. package/dist/{chunk-IWVEG5CX.mjs → chunk-XIHUI4KB.mjs} +2 -2
  105. package/dist/{chunk-YHUTF6EA.mjs → chunk-XKPNKR3V.mjs} +17 -47
  106. package/dist/{chunk-HJJWY6PT.mjs → chunk-YGQOPB2Z.mjs} +1 -1
  107. package/dist/chunk-YKEHQUSZ.mjs +248 -0
  108. package/dist/{chunk-GLZHNSGB.mjs → chunk-ZAYWOHVG.mjs} +1 -1
  109. package/dist/{chunk-ICW45TTU.mjs → chunk-ZEKDO7YX.mjs} +2 -2
  110. package/dist/chunk-ZXNNR73R.mjs +31 -0
  111. package/dist/{chunk-VJS4JFBQ.mjs → chunk-ZXX5GZEX.mjs} +3 -1
  112. package/dist/{chunk-RHKRTYGO.mjs → chunk-ZYKUD5NX.mjs} +9 -7
  113. package/dist/{client-B12YFALP.d.ts → client-Cn3gNxUU.d.ts} +62 -5
  114. package/dist/client.d.ts +8 -8
  115. package/dist/client.mjs +46 -0
  116. package/dist/{cold-module-4X7WJCFM.mjs → cold-module-2WWGBFJC.mjs} +43 -49
  117. package/dist/{config-CIG5yDyg.d.ts → config-CfhH1IWQ.d.ts} +150 -3
  118. package/dist/{config-BhZxIeb1.d.ts → config-aIsy7mcL.d.ts} +63 -3
  119. package/dist/direct-executor-QLVHMELJ.mjs +24 -0
  120. package/dist/distribution/coordinator/etcd.d.ts +3 -3
  121. package/dist/distribution/coordinator/etcd.mjs +1 -1
  122. package/dist/distribution/coordinator/in-memory.d.ts +3 -3
  123. package/dist/distribution/transport/grpc.mjs +4 -4
  124. package/dist/distribution/transport/in-memory.mjs +2 -2
  125. package/dist/distribution/transport/tcp.mjs +3 -3
  126. package/dist/distribution.d.ts +8 -8
  127. package/dist/distribution.mjs +16116 -14537
  128. package/dist/{durability-wiring-324D2DDD.mjs → durability-wiring-GNWQSZI3.mjs} +142 -109
  129. package/dist/embeddings/openai.d.ts +1 -1
  130. package/dist/embeddings/openai.mjs +2 -2
  131. package/dist/{engine-CtzbHOmG.d.ts → engine-CJRUHXgf.d.ts} +3 -3
  132. package/dist/gzip-F4HMIEEQ.mjs +1 -0
  133. package/dist/import-DX55PN4G.mjs +41 -0
  134. package/dist/{index-DsEurhSl.d.ts → index-MsF7e5hL.d.ts} +2 -2
  135. package/dist/index.browser.mjs +7 -4
  136. package/dist/index.d.ts +542 -8
  137. package/dist/index.mjs +29 -32
  138. package/dist/index.react-native.mjs +19 -0
  139. package/dist/invalidation/broadcast-channel.d.ts +1 -1
  140. package/dist/invalidation/filesystem.d.ts +1 -1
  141. package/dist/invalidation/filesystem.mjs +1 -1
  142. package/dist/invalidation/noop.d.ts +1 -1
  143. package/dist/{long-query-thread-4SW7RWDE.mjs → long-query-thread-SCUE62TO.mjs} +23 -25
  144. package/dist/{module-DXSJ5LT2.mjs → module-HW6IXUM6.mjs} +603 -112
  145. package/dist/module-V5K4ZP23.mjs +45 -0
  146. package/dist/{paged-partition-archive-HFP45PLU.mjs → paged-partition-archive-FDIIWZNR.mjs} +42 -41
  147. package/dist/partial-words.mjs +7 -9
  148. package/dist/pattern.mjs +4 -6
  149. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
  150. package/dist/persistence/durability/checkpoint-worker.mjs +36 -39
  151. package/dist/{phrase-module-5QHBD2VJ.mjs → phrase-module-OUQIRUQU.mjs} +1 -1
  152. package/dist/pool-UPV5PVPY.mjs +298 -0
  153. package/dist/react-native/chunks/analysis-change-HGW3L6NY.mjs +893 -0
  154. package/dist/react-native/chunks/analysis-change-entry-BNRU6STO.mjs +1 -0
  155. package/dist/react-native/chunks/chunk-2J2727V4.mjs +495 -0
  156. package/dist/react-native/chunks/chunk-3CTWSQRW.mjs +1251 -0
  157. package/dist/react-native/chunks/chunk-5FV4ZEVA.mjs +2619 -0
  158. package/dist/react-native/chunks/chunk-7VWQLEFV.mjs +642 -0
  159. package/dist/react-native/chunks/chunk-AAAETEJK.mjs +27 -0
  160. package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +32 -0
  161. package/dist/react-native/chunks/chunk-B6OD63Z3.mjs +997 -0
  162. package/dist/react-native/chunks/chunk-BRNAVOKP.mjs +177 -0
  163. package/dist/react-native/chunks/chunk-DKJTZ625.mjs +207 -0
  164. package/dist/react-native/chunks/chunk-FKGG4UOF.mjs +177 -0
  165. package/dist/{browser/chunk-6RHTAVZX.mjs → react-native/chunks/chunk-GV5KFQ6M.mjs} +38 -15
  166. package/dist/react-native/chunks/chunk-HURV3ASY.mjs +4416 -0
  167. package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +10 -0
  168. package/dist/react-native/chunks/chunk-JV6VQY2S.mjs +17 -0
  169. package/dist/react-native/chunks/chunk-KUJOBRKS.mjs +217 -0
  170. package/dist/react-native/chunks/chunk-KWRW5U65.mjs +226 -0
  171. package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +110 -0
  172. package/dist/react-native/chunks/chunk-LQ6Q4L5B.mjs +360 -0
  173. package/dist/react-native/chunks/chunk-LQAKO5QV.mjs +523 -0
  174. package/dist/react-native/chunks/chunk-LRGWK367.mjs +11 -0
  175. package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +93 -0
  176. package/dist/react-native/chunks/chunk-NFGBOI46.mjs +14 -0
  177. package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +8 -0
  178. package/dist/react-native/chunks/chunk-PPEPTUVV.mjs +56 -0
  179. package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +9 -0
  180. package/dist/{chunk-KGOXHLLZ.mjs → react-native/chunks/chunk-PU55IOG4.mjs} +228 -11
  181. package/dist/react-native/chunks/chunk-QC4ZRBSX.mjs +270 -0
  182. package/dist/react-native/chunks/chunk-R4EEMYM6.mjs +21 -0
  183. package/dist/react-native/chunks/chunk-R4OPUZQ5.mjs +86 -0
  184. package/dist/react-native/chunks/chunk-SLGIAD6B.mjs +2634 -0
  185. package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +25 -0
  186. package/dist/react-native/chunks/chunk-TLYD7IJ2.mjs +23 -0
  187. package/dist/react-native/chunks/chunk-UFNCLEQM.mjs +73 -0
  188. package/dist/react-native/chunks/chunk-YH7W556M.mjs +179 -0
  189. package/dist/react-native/chunks/chunk-YJSMEKRE.mjs +22385 -0
  190. package/dist/react-native/chunks/chunk-ZCKNBPQ4.mjs +79 -0
  191. package/dist/react-native/chunks/cold-module-TSFWLYWC.mjs +755 -0
  192. package/dist/react-native/chunks/durability-wiring-PZR6KOQK.mjs +4509 -0
  193. package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +3 -0
  194. package/dist/react-native/chunks/import-VTODLPLO.mjs +22 -0
  195. package/dist/{browser/module-BVP4TKZU.mjs → react-native/chunks/module-JBBH6PZH.mjs} +671 -146
  196. package/dist/react-native/chunks/module-VEK2KCKU.mjs +25 -0
  197. package/dist/react-native/chunks/phrase-module-76UAPPSG.mjs +329 -0
  198. package/dist/react-native/chunks/pool-CD4ANYUI.mjs +296 -0
  199. package/dist/react-native/chunks/release-D7ZTIANM.mjs +33 -0
  200. package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
  201. package/dist/{browser/restore-queue-ONYNYUDE.mjs → react-native/chunks/restore-queue-OI5EH7R3.mjs} +2 -2
  202. package/dist/react-native/chunks/runtime-3MCDLJAF.mjs +559 -0
  203. package/dist/react-native/chunks/snapshot-AUZMEV36.mjs +1205 -0
  204. package/dist/react-native/chunks/write-DDC2QBRJ.mjs +197 -0
  205. package/dist/{chunk-DQNKVOJ2.mjs → react-native/partial-words.mjs} +13 -228
  206. package/dist/react-native/pattern.mjs +2442 -0
  207. package/dist/react-native/synonyms.mjs +460 -0
  208. package/dist/react.d.ts +11 -11
  209. package/dist/react.mjs +11 -0
  210. package/dist/{rerank-KTLC3E6N.mjs → rerank-3W54N6P2.mjs} +4 -4
  211. package/dist/rerankers/http.d.ts +1 -1
  212. package/dist/rerankers/http.mjs +2 -2
  213. package/dist/restore-queue-BQWWNNQI.mjs +41 -0
  214. package/dist/{runtime-DYV75DCB.mjs → runtime-L2DZYY6N.mjs} +5 -5
  215. package/dist/{schema-B-Runv0n.d.ts → schema-D33CyXCy.d.ts} +1 -1
  216. package/dist/server.d.ts +24 -12
  217. package/dist/server.mjs +159 -38
  218. package/dist/{snapshot-CGM65VCD.mjs → snapshot-EHXTOTW5.mjs} +47 -50
  219. package/dist/synonyms.mjs +3 -4
  220. package/dist/{tasks-CjRJRGTb.d.ts → tasks-C4ElXr4P.d.ts} +59 -7
  221. package/dist/thread-I7DVHHW7.mjs +31 -0
  222. package/dist/vector/search-worker.d.ts +2 -2
  223. package/dist/vector/search-worker.mjs +8 -7
  224. package/dist/workers/entry.mjs +9 -9
  225. package/dist/{write-2DZPEQL2.mjs → write-SDJXXQ2G.mjs} +36 -39
  226. package/openapi.json +349 -2
  227. package/package.json +108 -8
  228. package/dist/analysis-change-HQUT2Z3I.mjs +0 -43
  229. package/dist/browser/import-TLB2A5LJ.mjs +0 -9
  230. package/dist/chunk-5WYVUPGD.mjs +0 -427
  231. package/dist/chunk-AV4IJKD2.mjs +0 -35
  232. package/dist/chunk-GES7U2PM.mjs +0 -68
  233. package/dist/chunk-N37VMC62.mjs +0 -18
  234. package/dist/chunk-WNBRW4Q2.mjs +0 -128
  235. package/dist/chunk-WQBCBKY3.mjs +0 -8
  236. package/dist/chunk-ZATRDAYU.mjs +0 -160
  237. package/dist/direct-executor-7XOQ7VQP.mjs +0 -28
  238. package/dist/import-OOBUW3RR.mjs +0 -44
  239. package/dist/module-IYPLWHGC.mjs +0 -48
  240. package/dist/thread-KGNAIKPD.mjs +0 -33
  241. /package/dist/{chunk-22YPZVMG.mjs → chunk-ZXNQEW43.mjs} +0 -0
@@ -1,17 +1,19 @@
1
- import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, patternSearchModule, DEFAULT_PATTERN_WORK_CAP, TYPO_CLAIM_SLOTS_PER_WORD, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES } from './chunk-RKAVHNRW.mjs';
2
- import { GEO_UNIT_METRES, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, FILTER_OPERAND_COPY_DEPTH } from './chunk-WQBCBKY3.mjs';
1
+ import { youngGenerationBytesOfThisV8 } from './chunk-Q2UL2TPC.mjs';
2
+ import { PROCESS_LIMIT_REFRESH_INTERVAL_MS } from './chunk-ZXNQEW43.mjs';
3
+ import { turnIsSpent, yieldTurn, createDocIdMap } from './chunk-LQG5G2LY.mjs';
4
+ import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, patternSearchModule, DEFAULT_PATTERN_WORK_CAP, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, TYPO_CLAIM_SLOTS_PER_WORD, FILTER_OPERAND_COPY_DEPTH, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES } from './chunk-U46IZNCW.mjs';
3
5
  import { bitsetHas, createBitSet, bitsetSet, bitsetIsEmpty, bitsetOrInto, bitsetAndNotInto, bitsetAndInto, bitsetFromSet } from './chunk-JUKYYXSP.mjs';
4
- import { expandTermPrefix, suggestDisplayTerms, getNestedValue, textFieldsChanged, getFlatSchema, tokenizeOptions, partialWordSearchModule, getOrCreateFieldNameIndex, partitionDocumentFrequency } from './chunk-DQNKVOJ2.mjs';
5
- import { isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, partialFieldsOf, schemaFieldsOf, flattenSchema, validateDocument, validateDocumentStrict, ANTIMERIDIAN_SPAN_DEGREES, FULL_TURN_DEGREES, LOCATION_CODE_BITS_PER_AXIS, MAX_COVERING_CELLS, VINCENTY_CONVERGENCE_THRESHOLD, EARTH_RADIUS_METERS, RADIUS_BOX_MARGIN_RATIO, RADIUS_BOX_MARGIN_RADIANS, DEG_TO_RAD, VINCENTY_MAX_ITERATIONS } from './chunk-KGOXHLLZ.mjs';
6
+ import { isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, partialFieldsOf, schemaFieldsOf, expandTermPrefix, flattenSchema, suggestDisplayTerms, getNestedValue, validateDocument, validateDocumentStrict, textFieldsChanged, getFlatSchema, tokenizeOptions, partialWordSearchModule, ANTIMERIDIAN_SPAN_DEGREES, FULL_TURN_DEGREES, getOrCreateFieldNameIndex, partitionDocumentFrequency, LOCATION_CODE_BITS_PER_AXIS, MAX_COVERING_CELLS, VINCENTY_CONVERGENCE_THRESHOLD, EARTH_RADIUS_METERS, RADIUS_BOX_MARGIN_RATIO, RADIUS_BOX_MARGIN_RADIANS, DEG_TO_RAD, VINCENTY_MAX_ITERATIONS } from './chunk-SOUZMPME.mjs';
6
7
  import { MAX_SORT_FIELDS, MAX_SORT_FIELD_NAME_LENGTH, MAX_CURSOR_LENGTH, MAX_CURSOR_ANCHOR_CODE_POINTS, RESULT_WINDOW, DEFAULT_FUZZY_PREFIX_LENGTH, DEFAULT_PAGE_SIZE, PREFIX_MAX_EXPANSIONS } from './chunk-FQBFZAWG.mjs';
7
- import { fuzzyPrefixOf, boundedLevenshtein, fuzzyTermMatches } from './chunk-GES7U2PM.mjs';
8
- import { parsedTypeOf, isStringValuedBase, withSortableOption, isWordIndexedBase, isWordIndexedFieldType, isListBase } from './chunk-ZSWHPKGM.mjs';
9
- import { tokenize, visitTokens } from './chunk-NPNK57CA.mjs';
8
+ import { tokenize, visitTokens } from './chunk-65WCV5JO.mjs';
10
9
  import { TARGET_BLOCK_ENTRIES, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY, PRUNING_REJECTION_SLACK, SORT_COLUMN_MINIMUM_REBUILD_THRESHOLD, SORT_COLUMN_REBUILD_FRACTION_SHIFT } from './chunk-4UMZ7KQL.mjs';
10
+ import { parsedTypeOf, isStringValuedBase, withSortableOption, fuzzyPrefixOf, boundedLevenshtein, isWordIndexedBase, isWordIndexedFieldType, fuzzyTermMatches, isListBase } from './chunk-KYVRZAYP.mjs';
11
+ import { isGeopointOrVectorType, PROTOTYPE_POLLUTION_KEYS } from './chunk-L5ORED7V.mjs';
12
+ import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
11
13
  import { singleFoldTable, appendFoldedCodePoint, sortModeOf, defaultSortMode, SORT_VALUE_MAX_CODE_POINTS, toReducedSortValue, readSortField, compareComparableKeys, toComparableSortValue, isSortMode, SORT_MODES, compareSortValues, compareComparableValues, truncateSortString } from './chunk-R6A773WK.mjs';
12
14
  import { compareCodePoints, exceedsCodePoints, codePointCount, holdsUnpairedSurrogate } from './chunk-YTJCGKM4.mjs';
13
- import { isGeopointOrVectorType, PROTOTYPE_POLLUTION_KEYS } from './chunk-L5ORED7V.mjs';
14
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
15
+ import { totalmem, freemem } from 'os';
16
+ import { getHeapSpaceStatistics, getHeapStatistics } from 'v8';
15
17
 
16
18
  // src/core/partition/partial-words/platform.ts
17
19
  function platformPartialWordSearch() {
@@ -166,6 +168,130 @@ function requirePatternSearch(fieldPath) {
166
168
  { field: fieldPath }
167
169
  );
168
170
  }
171
+ var MEGABYTE_BYTES = 1048576;
172
+ var IN_MEGABYTES = /^--max-old-space-size=(\d+)$/;
173
+ var AS_PERCENTAGE = /^--max-old-space-size-percentage=(\d+(?:\.\d+)?)$/;
174
+ var SEMI_SPACE_IN_MEGABYTES = /^--max-semi-space-size=(\d+)$/;
175
+ var YOUNG_GENERATION_SPACES = /* @__PURE__ */ new Set(["new_space", "new_large_object_space"]);
176
+ var V8_YOUNG_GENERATION_BYTES_PER_SEMI_SPACE_BYTE = 3;
177
+ function flagEntries() {
178
+ const fromNodeOptions = (process.env.NODE_OPTIONS ?? "").split(/\s+/).filter((entry) => entry.length > 0);
179
+ return [...fromNodeOptions, ...process.execArgv];
180
+ }
181
+ function memoryTheHostAllows() {
182
+ const constrained = process.constrainedMemory?.() ?? 0;
183
+ return constrained > 0 ? constrained : totalmem();
184
+ }
185
+ function readConfiguredOldSpaceMegabytes() {
186
+ let megabytes = null;
187
+ for (const entry of flagEntries()) {
188
+ const inMegabytes = IN_MEGABYTES.exec(entry);
189
+ if (inMegabytes !== null) megabytes = Number(inMegabytes[1]);
190
+ if (AS_PERCENTAGE.test(entry)) megabytes = null;
191
+ }
192
+ return megabytes !== null && Number.isFinite(megabytes) && megabytes > 0 ? megabytes : null;
193
+ }
194
+ function readConfiguredLimit() {
195
+ let megabytes = null;
196
+ let percentage = null;
197
+ for (const entry of flagEntries()) {
198
+ const inMegabytes = IN_MEGABYTES.exec(entry);
199
+ if (inMegabytes !== null) {
200
+ megabytes = Number(inMegabytes[1]);
201
+ percentage = null;
202
+ }
203
+ const asPercentage = AS_PERCENTAGE.exec(entry);
204
+ if (asPercentage !== null) {
205
+ percentage = Number(asPercentage[1]);
206
+ megabytes = null;
207
+ }
208
+ }
209
+ const bytes = megabytes !== null && megabytes > 0 ? megabytes * MEGABYTE_BYTES : percentage !== null && percentage > 0 && percentage <= 100 ? Math.floor(memoryTheHostAllows() * percentage / 100) : null;
210
+ return bytes !== null && Number.isFinite(bytes) && bytes > 0 ? bytes : null;
211
+ }
212
+ var configuredLimit;
213
+ function configuredLimitBytes() {
214
+ if (configuredLimit === void 0) configuredLimit = readConfiguredLimit();
215
+ return configuredLimit;
216
+ }
217
+ function readConfiguredYoungGeneration() {
218
+ let megabytes = 0;
219
+ for (const entry of flagEntries()) {
220
+ const semiSpace = SEMI_SPACE_IN_MEGABYTES.exec(entry);
221
+ if (semiSpace !== null) megabytes = Number(semiSpace[1]);
222
+ }
223
+ if (!Number.isFinite(megabytes) || megabytes <= 0) return null;
224
+ const semiSpaceBytes = 2 ** Math.ceil(Math.log2(megabytes)) * MEGABYTE_BYTES;
225
+ return semiSpaceBytes * V8_YOUNG_GENERATION_BYTES_PER_SEMI_SPACE_BYTE;
226
+ }
227
+ var configuredYoungGeneration;
228
+ function configuredYoungGenerationBytes() {
229
+ if (configuredYoungGeneration === void 0) configuredYoungGeneration = readConfiguredYoungGeneration();
230
+ return configuredYoungGeneration;
231
+ }
232
+ var heapSizeLimit;
233
+ function heapSizeLimitBytes() {
234
+ if (heapSizeLimit === void 0) heapSizeLimit = getHeapStatistics().heap_size_limit;
235
+ return heapSizeLimit;
236
+ }
237
+ function readYoungGenerationCeiling() {
238
+ const fromSemiSpace = configuredYoungGenerationBytes();
239
+ if (fromSemiSpace !== null) return fromSemiSpace;
240
+ const oldSpaceMegabytes = readConfiguredOldSpaceMegabytes();
241
+ if (oldSpaceMegabytes !== null) {
242
+ const beyondOldSpace = heapSizeLimitBytes() - oldSpaceMegabytes * MEGABYTE_BYTES;
243
+ if (beyondOldSpace > 0) return beyondOldSpace;
244
+ }
245
+ return youngGenerationBytesOfThisV8();
246
+ }
247
+ var youngGenerationCeiling;
248
+ function youngGenerationCeilingBytes() {
249
+ if (youngGenerationCeiling === void 0) youngGenerationCeiling = readYoungGenerationCeiling();
250
+ return youngGenerationCeiling;
251
+ }
252
+ function readOldGenerationStatistics() {
253
+ try {
254
+ let usedBytes = 0;
255
+ let committedBytes = 0;
256
+ let youngCapacityBytes = 0;
257
+ let youngUsedBytes = 0;
258
+ for (const space of getHeapSpaceStatistics()) {
259
+ if (YOUNG_GENERATION_SPACES.has(space.space_name)) {
260
+ youngCapacityBytes += space.space_size;
261
+ youngUsedBytes += space.space_used_size;
262
+ } else {
263
+ usedBytes += space.space_used_size;
264
+ committedBytes += space.space_size;
265
+ }
266
+ }
267
+ const youngCeilingBytes = youngGenerationCeilingBytes();
268
+ const limitBytes2 = configuredLimitBytes() ?? heapSizeLimitBytes() - youngCeilingBytes;
269
+ if (!Number.isFinite(usedBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
270
+ return {
271
+ usedBytes,
272
+ limitBytes: limitBytes2,
273
+ youngUsedBytes: Number.isFinite(youngUsedBytes) ? youngUsedBytes : 0,
274
+ committedBytes: Number.isFinite(committedBytes) ? committedBytes : usedBytes,
275
+ youngReserveBytes: Number.isFinite(youngCapacityBytes) ? Math.max(0, youngCeilingBytes - youngCapacityBytes) : 0,
276
+ youngCeilingBytes
277
+ };
278
+ } catch {
279
+ return null;
280
+ }
281
+ }
282
+ function readHeapStatistics() {
283
+ try {
284
+ const stats = getHeapStatistics();
285
+ const usedBytes = stats.used_heap_size;
286
+ const limitBytes2 = stats.heap_size_limit;
287
+ if (!Number.isFinite(usedBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
288
+ const available = stats.total_available_size;
289
+ const availableBytes = Number.isFinite(available) && available >= 0 ? available : null;
290
+ return { usedBytes, limitBytes: limitBytes2, availableBytes, configuredLimitBytes: configuredLimitBytes() };
291
+ } catch {
292
+ return null;
293
+ }
294
+ }
169
295
 
170
296
  // src/core/constants.ts
171
297
  var POSTING_LIST_COMPACTION_THRESHOLD = 0.3;
@@ -456,25 +582,40 @@ function documentValueBytes(value) {
456
582
  return PRIMITIVE_SLOT_BYTES;
457
583
  }
458
584
  function createDocumentStore() {
459
- const docs = /* @__PURE__ */ new Map();
460
- const forwardMap = /* @__PURE__ */ new Map();
585
+ const internalIds = createDocIdMap();
586
+ const storedById = [];
461
587
  const reverseMap = [];
462
588
  const lengthColumns = /* @__PURE__ */ new Map();
463
589
  let nextInternalId = 0;
464
590
  let numberingResets = 0;
465
591
  let sortedIds = null;
466
592
  let storedContentBytes = 0;
467
- function replaceStored(docId, document, fieldLengths) {
468
- const existing = docs.get(docId);
469
- if (existing !== void 0) {
470
- storedContentBytes -= documentValueBytes(existing.fields);
471
- } else {
593
+ let storedCount = 0;
594
+ let newestNumberedDocId;
595
+ function storedOf(docId) {
596
+ const internalId = internalIds.get(docId);
597
+ return internalId === void 0 ? void 0 : storedById[internalId];
598
+ }
599
+ function putStored(docId, internalId, stored) {
600
+ if (storedById[internalId] === void 0) {
601
+ storedCount++;
472
602
  sortedIds = null;
603
+ if (docId !== newestNumberedDocId) {
604
+ internalIds.delete(docId);
605
+ internalIds.set(docId, internalId);
606
+ newestNumberedDocId = docId;
607
+ }
473
608
  }
474
- writeFieldLengths(assignInternalId(docId), fieldLengths);
609
+ storedById[internalId] = stored;
610
+ }
611
+ function replaceStored(docId, document, fieldLengths) {
612
+ const internalId = assignInternalId(docId);
613
+ const existing = storedById[internalId];
614
+ if (existing !== void 0) storedContentBytes -= documentValueBytes(existing.fields);
615
+ writeFieldLengths(internalId, fieldLengths);
475
616
  const fields = documentWithOwnBuffers(document);
476
617
  storedContentBytes += documentValueBytes(fields);
477
- docs.set(docId, { fields, fieldLengths });
618
+ putStored(docId, internalId, { fields, fieldLengths });
478
619
  }
479
620
  function writeFieldLengths(internalId, fieldLengths) {
480
621
  for (const fieldName of Object.keys(fieldLengths)) {
@@ -489,26 +630,36 @@ function createDocumentStore() {
489
630
  }
490
631
  }
491
632
  function assignInternalId(docId) {
492
- const existing = forwardMap.get(docId);
633
+ const existing = internalIds.get(docId);
493
634
  if (existing !== void 0) return existing;
494
635
  const internalId = nextInternalId++;
495
- forwardMap.set(docId, internalId);
636
+ internalIds.set(docId, internalId);
637
+ newestNumberedDocId = docId;
496
638
  reverseMap[internalId] = docId;
497
639
  return internalId;
498
640
  }
499
641
  function clearMappings() {
500
- forwardMap.clear();
642
+ internalIds.clear();
643
+ storedById.length = 0;
501
644
  reverseMap.length = 0;
502
645
  nextInternalId = 0;
646
+ storedCount = 0;
647
+ newestNumberedDocId = void 0;
503
648
  numberingResets++;
504
649
  sortedIds = null;
505
650
  }
651
+ function* storedEntries() {
652
+ for (const [docId, internalId] of internalIds) {
653
+ const stored = storedById[internalId];
654
+ if (stored !== void 0) yield [docId, stored];
655
+ }
656
+ }
506
657
  const idResolver = {
507
658
  toExternal(internalId) {
508
659
  return reverseMap[internalId];
509
660
  },
510
661
  toInternal(externalId) {
511
- return forwardMap.get(externalId);
662
+ return internalIds.get(externalId);
512
663
  },
513
664
  isLive(internalId) {
514
665
  return reverseMap[internalId] !== void 0;
@@ -522,39 +673,36 @@ function createDocumentStore() {
522
673
  replaceStored(docId, document, fieldLengths);
523
674
  },
524
675
  get(docId) {
525
- return docs.get(docId);
676
+ return storedOf(docId);
526
677
  },
527
678
  remove(docId) {
528
- const existing = docs.get(docId);
529
- const removed = docs.delete(docId);
530
- if (removed) {
531
- if (existing !== void 0) {
532
- storedContentBytes -= documentValueBytes(existing.fields);
533
- }
534
- sortedIds = null;
535
- const internalId = forwardMap.get(docId);
536
- if (internalId !== void 0) {
537
- forwardMap.delete(docId);
538
- reverseMap[internalId] = void 0;
539
- for (const column of lengthColumns.values()) {
540
- if (internalId < column.length) column[internalId] = 0;
541
- }
542
- }
679
+ const internalId = internalIds.get(docId);
680
+ const existing = internalId === void 0 ? void 0 : storedById[internalId];
681
+ if (internalId === void 0 || existing === void 0) return false;
682
+ storedContentBytes -= documentValueBytes(existing.fields);
683
+ sortedIds = null;
684
+ storedCount--;
685
+ internalIds.delete(docId);
686
+ storedById[internalId] = void 0;
687
+ reverseMap[internalId] = void 0;
688
+ for (const column of lengthColumns.values()) {
689
+ if (internalId < column.length) column[internalId] = 0;
543
690
  }
544
- return removed;
691
+ return true;
545
692
  },
546
693
  has(docId) {
547
- return docs.has(docId);
694
+ return storedOf(docId) !== void 0;
548
695
  },
549
696
  count() {
550
- return docs.size;
697
+ return storedCount;
551
698
  },
552
699
  all() {
553
- return docs.entries();
700
+ return storedEntries();
554
701
  },
555
702
  sortedDocIds() {
556
703
  if (sortedIds === null) {
557
- const ids = Array.from(docs.keys());
704
+ const ids = [];
705
+ for (const [docId] of storedEntries()) ids.push(docId);
558
706
  ids.sort(compareCodePoints);
559
707
  sortedIds = ids;
560
708
  }
@@ -564,29 +712,28 @@ function createDocumentStore() {
564
712
  sortedIds = null;
565
713
  },
566
714
  clear() {
567
- docs.clear();
568
715
  lengthColumns.clear();
569
716
  clearMappings();
570
717
  storedContentBytes = 0;
571
718
  },
572
719
  serialize() {
573
720
  const result = {};
574
- for (const [docId, stored] of docs) {
721
+ for (const [docId, stored] of storedEntries()) {
575
722
  result[docId] = stored;
576
723
  }
577
724
  return result;
578
725
  },
579
726
  deserialize(data) {
580
- docs.clear();
581
727
  lengthColumns.clear();
582
728
  clearMappings();
583
729
  storedContentBytes = 0;
584
730
  for (const docId of Object.keys(data)) {
585
731
  const stored = data[docId];
586
- writeFieldLengths(assignInternalId(docId), stored.fieldLengths);
732
+ const internalId = assignInternalId(docId);
733
+ writeFieldLengths(internalId, stored.fieldLengths);
587
734
  const fields = documentWithOwnBuffers(stored.fields);
588
735
  storedContentBytes += documentValueBytes(fields);
589
- docs.set(docId, fields === stored.fields ? stored : { fields, fieldLengths: stored.fieldLengths });
736
+ putStored(docId, internalId, fields === stored.fields ? stored : { fields, fieldLengths: stored.fieldLengths });
590
737
  }
591
738
  },
592
739
  fieldLengthColumn(fieldName) {
@@ -596,14 +743,14 @@ function createDocumentStore() {
596
743
  return assignInternalId(docId);
597
744
  },
598
745
  getInternalId(docId) {
599
- return forwardMap.get(docId);
746
+ return internalIds.get(docId);
600
747
  },
601
748
  getExternalId(internalId) {
602
749
  return reverseMap[internalId];
603
750
  },
604
751
  *allInternalIds() {
605
- for (const internalId of forwardMap.values()) {
606
- yield internalId;
752
+ for (let internalId = 0; internalId < reverseMap.length; internalId++) {
753
+ if (reverseMap[internalId] !== void 0) yield internalId;
607
754
  }
608
755
  },
609
756
  internalIdCapacity() {
@@ -620,13 +767,12 @@ function createDocumentStore() {
620
767
  },
621
768
  fieldReader(fieldPath) {
622
769
  return (internalId) => {
623
- const docId = reverseMap[internalId];
624
- const stored = docId === void 0 ? void 0 : docs.get(docId);
770
+ const stored = storedById[internalId];
625
771
  return stored === void 0 ? void 0 : getNestedValue(stored.fields, fieldPath);
626
772
  };
627
773
  },
628
774
  projectedDocument(docId, projection) {
629
- const stored = docs.get(docId);
775
+ const stored = storedOf(docId);
630
776
  return stored === void 0 ? void 0 : cloneProjected(stored.fields, projection);
631
777
  }
632
778
  };
@@ -1898,6 +2044,14 @@ function countFieldValues(state, fieldPath, fieldType, bitset, matched) {
1898
2044
  }
1899
2045
  return countValuesFromDocuments(state, fieldPath, matched);
1900
2046
  }
2047
+ function sortFacetedNumbers(state, config, schema) {
2048
+ const flatSchema = getFlatSchema(state, schema);
2049
+ for (const fieldPath of Object.keys(config)) {
2050
+ const fieldType = flatSchema[fieldPath];
2051
+ if (fieldType !== "number" && fieldType !== "number[]") continue;
2052
+ state.numericIndexes.get(fieldPath)?.sortPending();
2053
+ }
2054
+ }
1901
2055
  function computeFacets(state, matched, config, schema) {
1902
2056
  const result = {};
1903
2057
  const flatSchema = getFlatSchema(state, schema);
@@ -2892,6 +3046,7 @@ function createNumericIndex() {
2892
3046
  }
2893
3047
  return seen.size;
2894
3048
  },
3049
+ sortPending: ensureSorted,
2895
3050
  clear() {
2896
3051
  entries = [];
2897
3052
  discardPending();
@@ -4608,6 +4763,13 @@ function textRangeBitsetOf(state, fieldPath, fieldType, bounds, capacity) {
4608
4763
  const resolver = state.docStore.resolver();
4609
4764
  return selectTextRange(column, bounds, capacity, (internalId) => resolver.isLive(internalId));
4610
4765
  }
4766
+ function prepareSortColumnsOf(state, request) {
4767
+ const set = ensureColumns(state);
4768
+ const { fields, directions, fieldTypes, modes } = request;
4769
+ for (let index = 0; index < fields.length; index++) {
4770
+ set.column(fields[index], fieldTypes[index], modes[index] ?? defaultSortMode(directions[index] ?? "asc"));
4771
+ }
4772
+ }
4611
4773
  function sortedPageOf(state, request) {
4612
4774
  ensureColumns(state);
4613
4775
  return selectSortedPage(state, request);
@@ -4643,6 +4805,22 @@ function refreshSortColumns(state) {
4643
4805
  function sortColumnBytes(state) {
4644
4806
  return state.sortColumns === null ? 0 : state.sortColumns.estimateBytes();
4645
4807
  }
4808
+ function sortedReadsOf(state) {
4809
+ return {
4810
+ prepareSortedPage(request) {
4811
+ prepareSortColumnsOf(state, request);
4812
+ },
4813
+ prepareFacets(config, schema) {
4814
+ sortFacetedNumbers(state, config, schema);
4815
+ },
4816
+ sortedPage(request) {
4817
+ return sortedPageOf(state, request);
4818
+ },
4819
+ sortValues(docId, fields, fieldTypes, modes) {
4820
+ return sortValuesOf(state, docId, fields, fieldTypes, modes);
4821
+ }
4822
+ };
4823
+ }
4646
4824
 
4647
4825
  // src/core/partition/filters.ts
4648
4826
  function presentBitsetOf(state, fieldPath, type, capacity) {
@@ -4795,7 +4973,7 @@ function requireLoadedPhraseCode() {
4795
4973
  }
4796
4974
  function loadPhraseCode() {
4797
4975
  if (loading === null) {
4798
- loading = import('./phrase-module-5QHBD2VJ.mjs').then(
4976
+ loading = import('./phrase-module-OUQIRUQU.mjs').then(
4799
4977
  (code) => {
4800
4978
  loaded = code;
4801
4979
  return code;
@@ -7004,12 +7182,7 @@ function createPartitionIndex(partitionId, trackPositions = true) {
7004
7182
  searchFulltextMatches(params) {
7005
7183
  return searchFulltextMatches(state, params);
7006
7184
  },
7007
- sortedPage(request) {
7008
- return sortedPageOf(state, request);
7009
- },
7010
- sortValues(docId, fields, fieldTypes, modes) {
7011
- return sortValuesOf(state, docId, fields, fieldTypes, modes);
7012
- },
7185
+ ...sortedReadsOf(state),
7013
7186
  applyFilters(filters, schema, meter) {
7014
7187
  return applyPartitionFilters(state, filters, schema, meter);
7015
7188
  },
@@ -7622,6 +7795,9 @@ function compositeSortedPage(subs, layout, request) {
7622
7795
  if (merged.length > request.limit) merged.length = request.limit;
7623
7796
  return merged;
7624
7797
  }
7798
+ function prepareCompositeSortColumns(subs, request) {
7799
+ for (const sub of subs) prepareSortColumnsOf(sub, request);
7800
+ }
7625
7801
  function compositeSortValues(subs, docId, fields, fieldTypes, modes) {
7626
7802
  for (const sub of subs) {
7627
7803
  if (sub.docStore.has(docId)) {
@@ -7858,6 +8034,12 @@ function createCompositePartition(partitionId, trackPositions = true, existingLi
7858
8034
  computeFacets(matched, config, schema) {
7859
8035
  return compositeFacets(subs(), layout, matched, config, schema);
7860
8036
  },
8037
+ prepareSortedPage(request) {
8038
+ prepareCompositeSortColumns(subs(), request);
8039
+ },
8040
+ prepareFacets(config, schema) {
8041
+ live.prepareFacets(config, schema);
8042
+ },
7861
8043
  sortedPage(request) {
7862
8044
  return compositeSortedPage(subs(), layout(), request);
7863
8045
  },
@@ -7921,57 +8103,34 @@ function createCompositePartition(partitionId, trackPositions = true, existingLi
7921
8103
  }
7922
8104
  };
7923
8105
  }
7924
-
7925
- // src/core/hash.ts
7926
- var FNV_OFFSET_BASIS = 2166136261;
7927
- var FNV_PRIME = 16777619;
7928
- var encoder = new TextEncoder();
7929
- function fnv1aBytes(bytes) {
7930
- return fnv1aContinue(FNV_OFFSET_BASIS, bytes, bytes.length) >>> 0;
7931
- }
7932
- function fnv1aContinue(start, bytes, length) {
7933
- let hash = start;
7934
- for (let i = 0; i < length; i++) {
7935
- hash = Math.imul(hash ^ bytes[i], FNV_PRIME);
7936
- }
7937
- return hash;
7938
- }
7939
- var scratchNumber = new Float64Array(1);
7940
- var scratchBytes = new Uint8Array(scratchNumber.buffer);
7941
- var HOST_IS_LITTLE_ENDIAN = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
7942
- function fnv1aContinueTaggedNumbers(start, tag, numbers) {
7943
- let hash = start;
7944
- const b = scratchBytes;
7945
- for (let i = 0; i < numbers.length; i++) {
7946
- scratchNumber[0] = Math.fround(numbers[i]);
7947
- hash = Math.imul(hash ^ tag, FNV_PRIME);
7948
- if (HOST_IS_LITTLE_ENDIAN) {
7949
- hash = Math.imul(hash ^ b[7], FNV_PRIME);
7950
- hash = Math.imul(hash ^ b[6], FNV_PRIME);
7951
- hash = Math.imul(hash ^ b[5], FNV_PRIME);
7952
- hash = Math.imul(hash ^ b[4], FNV_PRIME);
7953
- hash = Math.imul(hash ^ b[3], FNV_PRIME);
7954
- hash = Math.imul(hash ^ b[2], FNV_PRIME);
7955
- hash = Math.imul(hash ^ b[1], FNV_PRIME);
7956
- hash = Math.imul(hash ^ b[0], FNV_PRIME);
7957
- } else {
7958
- for (let at = 0; at < 8; at++) hash = Math.imul(hash ^ b[at], FNV_PRIME);
7959
- }
7960
- }
7961
- return hash;
7962
- }
7963
- function fnv1aUint32s(values) {
7964
- let hash = FNV_OFFSET_BASIS;
7965
- for (const value of values) {
7966
- for (let shift = 24; shift >= 0; shift -= 8) {
7967
- hash ^= value >>> shift & 255;
7968
- hash = Math.imul(hash, FNV_PRIME);
7969
- }
8106
+ var limitBytes = 0;
8107
+ var limitReadAt = Number.NEGATIVE_INFINITY;
8108
+ function readProcessLimit(residentBytes) {
8109
+ const hostBytes = totalmem();
8110
+ const constrained = typeof process.constrainedMemory === "function" ? process.constrainedMemory() : 0;
8111
+ if (Number.isFinite(constrained) && constrained > 0 && constrained < hostBytes) return constrained;
8112
+ if (process.platform !== "linux") return hostBytes;
8113
+ const availableBytes = freemem();
8114
+ if (!Number.isFinite(availableBytes) || availableBytes < 0) return hostBytes;
8115
+ return Math.min(hostBytes, residentBytes + availableBytes);
8116
+ }
8117
+ function processLimitBytes(residentBytes) {
8118
+ const now = performance.now();
8119
+ if (now - limitReadAt >= PROCESS_LIMIT_REFRESH_INTERVAL_MS) {
8120
+ limitBytes = readProcessLimit(residentBytes);
8121
+ limitReadAt = now;
8122
+ }
8123
+ return limitBytes;
8124
+ }
8125
+ function readResidentMemory() {
8126
+ try {
8127
+ const residentBytes = process.memoryUsage.rss();
8128
+ const limitBytes2 = processLimitBytes(residentBytes);
8129
+ if (!Number.isFinite(residentBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
8130
+ return { residentBytes, limitBytes: limitBytes2 };
8131
+ } catch {
8132
+ return null;
7970
8133
  }
7971
- return hash >>> 0;
7972
- }
7973
- function fnv1a(input) {
7974
- return fnv1aBytes(encoder.encode(input));
7975
8134
  }
7976
8135
 
7977
8136
  // src/partitioning/manager/nested-values.ts
@@ -8942,6 +9101,7 @@ async function fanOutQuery(manager, params, language, schema, config, searchOpti
8942
9101
  const partitionFacets = [];
8943
9102
  const everyValue = params.facets ? everyValueFacetConfig(params.facets) : void 0;
8944
9103
  for (const partition of partitions) {
9104
+ if (turnIsSpent()) await yieldTurn();
8945
9105
  options.patternWork?.clock?.check();
8946
9106
  const result = dispatchSinglePartition(partition, params, language, schema, options);
8947
9107
  if (everyValue) {
@@ -9017,4 +9177,4 @@ function fanOutMatchCount(manager, params, language, schema, options) {
9017
9177
  return count;
9018
9178
  }
9019
9179
 
9020
- export { ARRAY_POSITION_GAP, DEFAULT_BM25_B, DEFAULT_BM25_K1, FIELD_FILTER_OPERATORS, FILTER_EXPRESSION_KEYS, FNV_OFFSET_BASIS, MAX_BM25_B, MAX_BM25_K1, MAX_TERM_FREQUENCY, PATTERN_HOST, ValueAffixes, analyseQueryPhrases, applyPagination, applyPartitionFiltersBitset, applyProjection, applySorting, availablePatternSearch, bm25SetsValue, buildPartialWordTableFrom, clampRowCount, cloneProjected, collectQueryTermStats, copyVectorsInto, countPartialSpelling, countsWithoutScores, createBooleanIndex, createCompositePartition, createEnumIndex, createFrozenPartialWords, createGeoIndex, createNumericIndex, createPartitionIndex, createPatternWorkMeter, createSurfaceRegistry, decodePageCursor, documentValueBytes, documentWithOwnBuffers, encodeFieldIndexes, encodePageCursor, encodePartialSpellingsOf, encodeSegmentState, everyValueFacetConfig, fanOutMatchCount, fanOutQuery, filterTestCount, fnv1a, fnv1aContinue, fnv1aContinueTaggedNumbers, fnv1aUint32s, fulltextMatches, holdsQuotedText, isCompositePartition, joinPatternWorkMeter, kWayMerge, loadPhraseCodeFor, mergeBM25Levels, mergeDocFrequencies, mergeFacets, mergePartitionStats, normalizeSort, oversampledFacetConfig, oversampledShardSize, partialSpellingsOfDocuments, partialWordHighlighter, partialWordsToHighlight, partitionStateOf, partitionsIn, patternIndexOf, projectIncludedPaths, projectionKeepsField, pruneStatsToQueryTerms, readProjectedPath, readSortValues, recordValueSize, registerPartialWordSearch, registerPatternSearch, requireLoadedPhraseCode, requireMatchingCursor, requirePartialWordSearchFor, requirePatternSearch, requirePatternSearchFor, requireSortableFields, requireWithinResultWindow, resolveProjection, sanitizeGlobalStats, scanPostingBlocks, setNestedValue, sortModesOf, sortSignatureEntry, sortSignatureOf, survivorDocumentsOf, undeclaredFieldOnStrictIndex, validatedFilterOf, valueWithOwnBuffers };
9180
+ export { ARRAY_POSITION_GAP, DEFAULT_BM25_B, DEFAULT_BM25_K1, FIELD_FILTER_OPERATORS, FILTER_EXPRESSION_KEYS, MAX_BM25_B, MAX_BM25_K1, MAX_TERM_FREQUENCY, PATTERN_HOST, ValueAffixes, analyseQueryPhrases, applyPagination, applyPartitionFiltersBitset, applyProjection, applySorting, availablePatternSearch, bm25SetsValue, buildPartialWordTableFrom, clampRowCount, cloneProjected, collectQueryTermStats, copyVectorsInto, countPartialSpelling, countsWithoutScores, createBooleanIndex, createCompositePartition, createEnumIndex, createFrozenPartialWords, createGeoIndex, createNumericIndex, createPartitionIndex, createPatternWorkMeter, createSurfaceRegistry, decodePageCursor, documentValueBytes, documentWithOwnBuffers, encodeFieldIndexes, encodePageCursor, encodePartialSpellingsOf, encodeSegmentState, everyValueFacetConfig, fanOutMatchCount, fanOutQuery, filterTestCount, fulltextMatches, holdsQuotedText, isCompositePartition, joinPatternWorkMeter, kWayMerge, loadPhraseCodeFor, mergeBM25Levels, mergeDocFrequencies, mergeFacets, mergePartitionStats, normalizeSort, oversampledFacetConfig, oversampledShardSize, partialSpellingsOfDocuments, partialWordHighlighter, partialWordsToHighlight, partitionStateOf, partitionsIn, patternIndexOf, projectIncludedPaths, projectionKeepsField, pruneStatsToQueryTerms, readHeapStatistics, readOldGenerationStatistics, readProjectedPath, readResidentMemory, readSortValues, recordValueSize, registerPartialWordSearch, registerPatternSearch, requireLoadedPhraseCode, requireMatchingCursor, requirePartialWordSearchFor, requirePatternSearch, requirePatternSearchFor, requireSortableFields, requireWithinResultWindow, resolveProjection, sanitizeGlobalStats, scanPostingBlocks, setNestedValue, sortModesOf, sortSignatureEntry, sortSignatureOf, survivorDocumentsOf, undeclaredFieldOnStrictIndex, validatedFilterOf, valueWithOwnBuffers };
@@ -1,5 +1,4 @@
1
- import { SCRATCH_SLOTS_PER_THREAD_POOL } from './chunk-QSK35UC2.mjs';
2
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
1
+ import { SCRATCH_SLOTS_PER_THREAD_POOL } from './chunk-BTPGQC6Z.mjs';
3
2
 
4
3
  // src/workers/constants.ts
5
4
  var WORKER_YOUNG_GENERATION_MB = 24;
@@ -44,24 +43,4 @@ function splitWorkerBudget(total) {
44
43
  return { keyword, vector: total - keyword };
45
44
  }
46
45
 
47
- // src/workers/entry-point.ts
48
- var DIST_SEGMENT = "/dist/";
49
- function resolveWorkerEntry(moduleUrl, sourceDirectory, distEntry) {
50
- const distIndex = moduleUrl.lastIndexOf(DIST_SEGMENT);
51
- const entry = distIndex !== -1 ? new URL(distEntry, moduleUrl.slice(0, distIndex + DIST_SEGMENT.length)).href : sourceDirectory.test(moduleUrl) ? moduleUrl.replace(sourceDirectory, `${DIST_SEGMENT}${distEntry}`) : null;
52
- return entry === moduleUrl ? null : entry;
53
- }
54
- function missingWorkerEntry(moduleUrl) {
55
- return new NarsilError(
56
- ErrorCodes.CONFIG_INVALID,
57
- `The engine finds no worker entry beside its own module at "${moduleUrl}", which happens where a bundler folds @delali/narsil into an application bundle. Keep @delali/narsil outside the bundle, or set workers.enabled to false`,
58
- { moduleUrl }
59
- );
60
- }
61
-
62
- // src/workers/resource-limits.ts
63
- function workerResourceLimits() {
64
- return { maxYoungGenerationSizeMb: WORKER_YOUNG_GENERATION_MB };
65
- }
66
-
67
- export { CONSECUTIVE_TIMEOUTS_BEFORE_DEATH, DEFAULT_BACKPRESSURE_LIMIT, DEFAULT_REQUEST_TIMEOUT_MS, SHUTDOWN_TIMEOUT_MS, missingWorkerEntry, resolveRequestThreadCount, resolveWorkerCount, resolveWorkerEntry, splitWorkerBudget, workerResourceLimits };
46
+ export { CONSECUTIVE_TIMEOUTS_BEFORE_DEATH, DEFAULT_BACKPRESSURE_LIMIT, DEFAULT_REQUEST_TIMEOUT_MS, SHUTDOWN_TIMEOUT_MS, WORKER_YOUNG_GENERATION_MB, resolveRequestThreadCount, resolveWorkerCount, splitWorkerBudget };
@@ -1,5 +1,5 @@
1
- import { NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND } from './chunk-WCFCHIBB.mjs';
2
- import { NarsilError, ErrorCodes } from './chunk-35B42UFM.mjs';
1
+ import { NUMBER_TAG, DATE_TAG, BYTES_TAG, encodeBase64, startsWithTagPrefix, OBJECT_TAG, MILLISECONDS_PER_SECOND, NANOSECONDS_PER_MILLISECOND } from './chunk-NYSONUB7.mjs';
2
+ import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
3
3
 
4
4
  // src/engine/export/json-line.ts
5
5
  function refuse(path, kind, docId) {