@delali/narsil 0.3.1-next.145 → 0.3.1-next.149

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 (207) hide show
  1. package/dist/adapters/filesystem.mjs +2 -2
  2. package/dist/adapters/gcs.mjs +2 -2
  3. package/dist/adapters/indexeddb.mjs +1 -1
  4. package/dist/adapters/s3.mjs +2 -2
  5. package/dist/analysis-change-ZCJNYBJM.mjs +39 -0
  6. package/dist/{analysis-change-entry-V4SQQSXQ.mjs → analysis-change-entry-YN3ELL6C.mjs} +1 -1
  7. package/dist/browser/{analysis-change-QTCQ5ETU.mjs → analysis-change-M65AZQQG.mjs} +8 -5
  8. package/dist/browser/{analysis-change-entry-KYEQSP3I.mjs → analysis-change-entry-H3YIOLXZ.mjs} +1 -1
  9. package/dist/browser/{chunk-GP4QLUQM.mjs → chunk-2JABMB4S.mjs} +10 -6
  10. package/dist/browser/{chunk-5WYWLTM5.mjs → chunk-4DYLCICG.mjs} +2 -2
  11. package/dist/browser/{chunk-75PMIFQA.mjs → chunk-4RD3AFSB.mjs} +1 -1
  12. package/dist/browser/{chunk-XWMEGKDC.mjs → chunk-5V74FFZE.mjs} +2 -2
  13. package/dist/browser/{chunk-PMBSBSCN.mjs → chunk-6OWX3OP2.mjs} +2 -2
  14. package/dist/browser/chunk-BRWY3JCN.mjs +678 -0
  15. package/dist/browser/{chunk-ZALEKEUH.mjs → chunk-BVX2MEHA.mjs} +306 -607
  16. package/dist/browser/{chunk-FXPMF65P.mjs → chunk-D6UFGBF5.mjs} +15 -45
  17. package/dist/browser/{chunk-QNDWMPV2.mjs → chunk-IAXZAVYL.mjs} +25 -66
  18. package/dist/browser/chunk-JNOAKDUM.mjs +31 -0
  19. package/dist/browser/{chunk-BTMRV5MY.mjs → chunk-KAEVGLYN.mjs} +2 -2
  20. package/dist/browser/{chunk-FHO5N7FD.mjs → chunk-LURXVCHG.mjs} +1 -1
  21. package/dist/browser/chunk-MPK76GVS.mjs +63 -0
  22. package/dist/browser/{chunk-6OFS7RUN.mjs → chunk-NVEJJP4R.mjs} +1 -1
  23. package/dist/browser/{chunk-U77XQJOY.mjs → chunk-ODQP7P3H.mjs} +455 -66
  24. package/dist/browser/{chunk-IFGTRRPU.mjs → chunk-PIS7ZAP7.mjs} +3 -25
  25. package/dist/browser/{chunk-XIHLIMFX.mjs → chunk-QMNZFFD3.mjs} +4 -3
  26. package/dist/browser/{chunk-AOKLYVTT.mjs → chunk-SRL47USS.mjs} +2 -2
  27. package/dist/browser/chunk-TY7L6OXO.mjs +69 -0
  28. package/dist/browser/{chunk-LGJ6XMH5.mjs → chunk-W643QV3L.mjs} +6 -5
  29. package/dist/browser/chunk-WXLBZJMT.mjs +25 -0
  30. package/dist/browser/{chunk-ZKVDQ5ZH.mjs → chunk-XILIT5MT.mjs} +8 -8
  31. package/dist/browser/{cold-module-Y2IJAP7S.mjs → cold-module-A5S6JFDN.mjs} +20 -20
  32. package/dist/browser/{durability-wiring-MLXZ5QQF.mjs → durability-wiring-W5AVV3RF.mjs} +53 -30
  33. package/dist/browser/gzip-5S7ROJFJ.mjs +1 -0
  34. package/dist/browser/import-PTT63AGK.mjs +12 -0
  35. package/dist/browser/{module-5LMDGXQH.mjs → module-CEKA7MQH.mjs} +13 -10
  36. package/dist/browser/module-X5PGOE47.mjs +4288 -0
  37. package/dist/browser/{phrase-module-KXNRTWCS.mjs → phrase-module-CNKMUY4U.mjs} +2 -1
  38. package/dist/browser/pool-DTYSPBMQ.mjs +296 -0
  39. package/dist/{restore-queue-UAVGBSJG.mjs → browser/restore-queue-DD4LWZK7.mjs} +2 -2
  40. package/dist/browser/{runtime-ZNEGK33G.mjs → runtime-D2ULZGCN.mjs} +3 -2
  41. package/dist/browser/{snapshot-2EGS2FYU.mjs → snapshot-DQ6A4PQP.mjs} +18 -14
  42. package/dist/browser/{write-WMZA6NSF.mjs → write-MAGRAIEH.mjs} +14 -11
  43. package/dist/{capabilities-CNnzGtqP.d.ts → capabilities-BT-HLDC8.d.ts} +2 -2
  44. package/dist/{chunk-FRJ5RGX7.mjs → chunk-2HJWQPR6.mjs} +2 -2
  45. package/dist/{chunk-DKMZ7JFW.mjs → chunk-3BVGJ4JR.mjs} +10 -4
  46. package/dist/{chunk-QYMAYU7M.mjs → chunk-3HV7M5OJ.mjs} +155 -149
  47. package/dist/chunk-3MXV3VHR.mjs +46 -0
  48. package/dist/{chunk-6FOJKNUR.mjs → chunk-3SBJVQLL.mjs} +2 -2
  49. package/dist/{chunk-PRID7CA6.mjs → chunk-3TVDTACC.mjs} +1 -1
  50. package/dist/{chunk-RTVAWNUL.mjs → chunk-5WB2A3XU.mjs} +9 -6
  51. package/dist/{chunk-LWFK3TC2.mjs → chunk-65WCV5JO.mjs} +1 -1
  52. package/dist/{chunk-G6Q5DEF5.mjs → chunk-6BWLDLS3.mjs} +3 -46
  53. package/dist/{chunk-W6M4RRAT.mjs → chunk-6C5EX2QR.mjs} +3 -3
  54. package/dist/{chunk-HOC5JP2H.mjs → chunk-6F6USYII.mjs} +119 -11
  55. package/dist/{chunk-7523VCM4.mjs → chunk-7HKWO4BJ.mjs} +7 -7
  56. package/dist/{chunk-ONDEEBTA.mjs → chunk-7N223GWV.mjs} +2 -2
  57. package/dist/{chunk-UGQULMSU.mjs → chunk-ADBS5XRI.mjs} +10 -10
  58. package/dist/{chunk-MJTEU2XK.mjs → chunk-AWNHDBKV.mjs} +429 -73
  59. package/dist/{chunk-2E2ZFOPT.mjs → chunk-B2FTZNNF.mjs} +2 -2
  60. package/dist/{chunk-NWTEJ2T7.mjs → chunk-B7XIOAMK.mjs} +3 -3
  61. package/dist/{chunk-W55X2BYN.mjs → chunk-BEZH7VEH.mjs} +1 -1
  62. package/dist/chunk-BTPGQC6Z.mjs +27 -0
  63. package/dist/{chunk-KG5N7LE6.mjs → chunk-CYYSZPVV.mjs} +11 -11
  64. package/dist/{chunk-HTMUGEFU.mjs → chunk-DOY6EG76.mjs} +6 -6
  65. package/dist/{chunk-UHVTEVF5.mjs → chunk-F22IOCR2.mjs} +10 -6
  66. package/dist/{chunk-FTQLF5JI.mjs → chunk-IRWP524D.mjs} +1 -1
  67. package/dist/{chunk-XLAI4OIO.mjs → chunk-IZT3G24Q.mjs} +2 -2
  68. package/dist/{chunk-SE7MKJVK.mjs → chunk-J7M73VY7.mjs} +1 -1
  69. package/dist/chunk-KAKQ74LS.mjs +53 -0
  70. package/dist/{chunk-GVPYMSLO.mjs → chunk-KYVRZAYP.mjs} +1 -1
  71. package/dist/{chunk-F442VZUL.mjs → chunk-KZ5GQE4Z.mjs} +5 -5
  72. package/dist/{chunk-WDEWU46C.mjs → chunk-KZQIVGW7.mjs} +2 -2
  73. package/dist/{chunk-7AJAW6NN.mjs → chunk-L7TIAYPX.mjs} +8 -8
  74. package/dist/{chunk-GRFXSEFF.mjs → chunk-LDGGR7YT.mjs} +4 -81
  75. package/dist/{chunk-WMIV7PJ7.mjs → chunk-LJ4ENXOD.mjs} +15 -14
  76. package/dist/chunk-LQG5G2LY.mjs +39 -0
  77. package/dist/{chunk-IQHZMCLX.mjs → chunk-MDF6PDIA.mjs} +2 -0
  78. package/dist/{chunk-QXH2CS4V.mjs → chunk-NVTFQFUL.mjs} +7 -26
  79. package/dist/{chunk-5K2JHKM3.mjs → chunk-NYSONUB7.mjs} +1 -1
  80. package/dist/{chunk-OH7SX5MY.mjs → chunk-O4KUNDVF.mjs} +12 -10
  81. package/dist/{chunk-EBIHRL7B.mjs → chunk-Q2UL2TPC.mjs} +1 -1
  82. package/dist/{chunk-RNUP6WZ6.mjs → chunk-QEYF2SQ6.mjs} +2 -2
  83. package/dist/{chunk-RVBUQITB.mjs → chunk-QN5WVV5K.mjs} +7 -7
  84. package/dist/{chunk-RIIUZJQ3.mjs → chunk-QYRNLLLI.mjs} +1 -1
  85. package/dist/{chunk-BTARFTEN.mjs → chunk-SOUZMPME.mjs} +4 -4
  86. package/dist/{chunk-ISUOSACK.mjs → chunk-T4CJDBBE.mjs} +1 -1
  87. package/dist/{chunk-DHEJAGVW.mjs → chunk-TTCKT2RT.mjs} +5 -5
  88. package/dist/{chunk-QU2XF7VI.mjs → chunk-U2726TL5.mjs} +5 -4
  89. package/dist/{chunk-LYKUJNAV.mjs → chunk-U46IZNCW.mjs} +2 -2
  90. package/dist/{chunk-SNB4DYL3.mjs → chunk-U6NE6RCV.mjs} +4 -4
  91. package/dist/{chunk-SA52N7G3.mjs → chunk-VP6XRMWR.mjs} +4 -4
  92. package/dist/{chunk-YUCGFPMS.mjs → chunk-VQDZVWN3.mjs} +449 -405
  93. package/dist/{chunk-IWVEG5CX.mjs → chunk-XIHUI4KB.mjs} +2 -2
  94. package/dist/{chunk-IV2XTSS2.mjs → chunk-XKPNKR3V.mjs} +16 -46
  95. package/dist/{chunk-UQS5PAS5.mjs → chunk-YGQOPB2Z.mjs} +1 -1
  96. package/dist/{chunk-SVO6NV4D.mjs → chunk-YKEHQUSZ.mjs} +4 -4
  97. package/dist/{chunk-6Z22L5RN.mjs → chunk-ZAYWOHVG.mjs} +1 -1
  98. package/dist/{chunk-QLDLQW36.mjs → chunk-ZEKDO7YX.mjs} +2 -2
  99. package/dist/chunk-ZXNNR73R.mjs +31 -0
  100. package/dist/{chunk-VJS4JFBQ.mjs → chunk-ZXX5GZEX.mjs} +3 -1
  101. package/dist/{chunk-X5SBWARI.mjs → chunk-ZYKUD5NX.mjs} +9 -7
  102. package/dist/{client-DoYPHcUn.d.ts → client-Cn3gNxUU.d.ts} +3 -3
  103. package/dist/client.d.ts +5 -5
  104. package/dist/client.mjs +2 -0
  105. package/dist/{cold-module-NUD332YD.mjs → cold-module-2WWGBFJC.mjs} +36 -33
  106. package/dist/{config-CuUfls_H.d.ts → config-CfhH1IWQ.d.ts} +1 -1
  107. package/dist/{config-Dzs46im6.d.ts → config-aIsy7mcL.d.ts} +52 -1
  108. package/dist/direct-executor-QLVHMELJ.mjs +24 -0
  109. package/dist/distribution/coordinator/etcd.mjs +1 -1
  110. package/dist/distribution/transport/grpc.mjs +1 -1
  111. package/dist/distribution.d.ts +4 -4
  112. package/dist/distribution.mjs +150 -255
  113. package/dist/{durability-wiring-K7RDXWL6.mjs → durability-wiring-GNWQSZI3.mjs} +67 -42
  114. package/dist/embeddings/openai.mjs +2 -2
  115. package/dist/{engine-C0ifUEcm.d.ts → engine-CJRUHXgf.d.ts} +1 -1
  116. package/dist/gzip-F4HMIEEQ.mjs +1 -0
  117. package/dist/import-DX55PN4G.mjs +41 -0
  118. package/dist/index.browser.mjs +7 -4
  119. package/dist/index.d.ts +539 -5
  120. package/dist/index.mjs +22 -16
  121. package/dist/index.react-native.mjs +19 -0
  122. package/dist/{long-query-thread-FKVHRCHF.mjs → long-query-thread-SCUE62TO.mjs} +20 -17
  123. package/dist/{module-GJUKW5VU.mjs → module-HW6IXUM6.mjs} +601 -108
  124. package/dist/{module-TMFIWOD2.mjs → module-V5K4ZP23.mjs} +29 -23
  125. package/dist/{paged-partition-archive-WNUEMYWM.mjs → paged-partition-archive-FDIIWZNR.mjs} +31 -25
  126. package/dist/partial-words.mjs +5 -5
  127. package/dist/pattern.mjs +3 -3
  128. package/dist/persistence/durability/checkpoint-worker.mjs +28 -22
  129. package/dist/{phrase-module-OMY3QQV7.mjs → phrase-module-OUQIRUQU.mjs} +1 -1
  130. package/dist/pool-UPV5PVPY.mjs +298 -0
  131. package/dist/react-native/chunks/analysis-change-HGW3L6NY.mjs +893 -0
  132. package/dist/react-native/chunks/analysis-change-entry-BNRU6STO.mjs +1 -0
  133. package/dist/react-native/chunks/chunk-2J2727V4.mjs +495 -0
  134. package/dist/react-native/chunks/chunk-3CTWSQRW.mjs +1251 -0
  135. package/dist/react-native/chunks/chunk-5FV4ZEVA.mjs +2619 -0
  136. package/dist/react-native/chunks/chunk-7VWQLEFV.mjs +642 -0
  137. package/dist/react-native/chunks/chunk-AAAETEJK.mjs +27 -0
  138. package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +32 -0
  139. package/dist/react-native/chunks/chunk-B6OD63Z3.mjs +997 -0
  140. package/dist/react-native/chunks/chunk-BRNAVOKP.mjs +177 -0
  141. package/dist/react-native/chunks/chunk-DKJTZ625.mjs +207 -0
  142. package/dist/react-native/chunks/chunk-FKGG4UOF.mjs +177 -0
  143. package/dist/{browser/chunk-K7UFXEJS.mjs → react-native/chunks/chunk-GV5KFQ6M.mjs} +12 -6
  144. package/dist/react-native/chunks/chunk-HURV3ASY.mjs +4416 -0
  145. package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +10 -0
  146. package/dist/react-native/chunks/chunk-JV6VQY2S.mjs +17 -0
  147. package/dist/react-native/chunks/chunk-KUJOBRKS.mjs +217 -0
  148. package/dist/react-native/chunks/chunk-KWRW5U65.mjs +226 -0
  149. package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +110 -0
  150. package/dist/react-native/chunks/chunk-LQ6Q4L5B.mjs +360 -0
  151. package/dist/react-native/chunks/chunk-LQAKO5QV.mjs +523 -0
  152. package/dist/react-native/chunks/chunk-LRGWK367.mjs +11 -0
  153. package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +93 -0
  154. package/dist/react-native/chunks/chunk-NFGBOI46.mjs +14 -0
  155. package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +8 -0
  156. package/dist/react-native/chunks/chunk-PPEPTUVV.mjs +56 -0
  157. package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +9 -0
  158. package/dist/react-native/chunks/chunk-PU55IOG4.mjs +910 -0
  159. package/dist/react-native/chunks/chunk-QC4ZRBSX.mjs +270 -0
  160. package/dist/react-native/chunks/chunk-R4EEMYM6.mjs +21 -0
  161. package/dist/react-native/chunks/chunk-R4OPUZQ5.mjs +86 -0
  162. package/dist/react-native/chunks/chunk-SLGIAD6B.mjs +2634 -0
  163. package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +25 -0
  164. package/dist/react-native/chunks/chunk-TLYD7IJ2.mjs +23 -0
  165. package/dist/react-native/chunks/chunk-UFNCLEQM.mjs +73 -0
  166. package/dist/react-native/chunks/chunk-YH7W556M.mjs +179 -0
  167. package/dist/react-native/chunks/chunk-YJSMEKRE.mjs +22385 -0
  168. package/dist/react-native/chunks/chunk-ZCKNBPQ4.mjs +79 -0
  169. package/dist/react-native/chunks/cold-module-TSFWLYWC.mjs +755 -0
  170. package/dist/react-native/chunks/durability-wiring-PZR6KOQK.mjs +4509 -0
  171. package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +3 -0
  172. package/dist/react-native/chunks/import-VTODLPLO.mjs +22 -0
  173. package/dist/{browser/module-Q6VFGLMG.mjs → react-native/chunks/module-JBBH6PZH.mjs} +609 -144
  174. package/dist/react-native/chunks/module-VEK2KCKU.mjs +25 -0
  175. package/dist/react-native/chunks/phrase-module-76UAPPSG.mjs +329 -0
  176. package/dist/react-native/chunks/pool-CD4ANYUI.mjs +296 -0
  177. package/dist/react-native/chunks/release-D7ZTIANM.mjs +33 -0
  178. package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
  179. package/dist/{browser/restore-queue-SOAHKZSQ.mjs → react-native/chunks/restore-queue-OI5EH7R3.mjs} +2 -2
  180. package/dist/react-native/chunks/runtime-3MCDLJAF.mjs +559 -0
  181. package/dist/react-native/chunks/snapshot-AUZMEV36.mjs +1205 -0
  182. package/dist/react-native/chunks/write-DDC2QBRJ.mjs +197 -0
  183. package/dist/react-native/partial-words.mjs +733 -0
  184. package/dist/react-native/pattern.mjs +2442 -0
  185. package/dist/react-native/synonyms.mjs +460 -0
  186. package/dist/react.d.ts +7 -7
  187. package/dist/react.mjs +2 -0
  188. package/dist/{rerank-ZZ5CHKLW.mjs → rerank-3W54N6P2.mjs} +4 -4
  189. package/dist/rerankers/http.mjs +2 -2
  190. package/dist/restore-queue-BQWWNNQI.mjs +41 -0
  191. package/dist/{runtime-RAOCKSYA.mjs → runtime-L2DZYY6N.mjs} +5 -5
  192. package/dist/server.d.ts +8 -8
  193. package/dist/server.mjs +32 -28
  194. package/dist/{snapshot-DB5ZVCDN.mjs → snapshot-EHXTOTW5.mjs} +39 -33
  195. package/dist/synonyms.mjs +3 -3
  196. package/dist/{tasks-ChWp0wrF.d.ts → tasks-C4ElXr4P.d.ts} +2 -2
  197. package/dist/thread-I7DVHHW7.mjs +31 -0
  198. package/dist/vector/search-worker.mjs +7 -5
  199. package/dist/workers/entry.mjs +9 -9
  200. package/dist/{write-KZVTLGCI.mjs → write-SDJXXQ2G.mjs} +29 -23
  201. package/package.json +88 -7
  202. package/dist/analysis-change-D5APH4Z3.mjs +0 -34
  203. package/dist/browser/import-FTMLTPGQ.mjs +0 -9
  204. package/dist/direct-executor-FDQYQEJQ.mjs +0 -22
  205. package/dist/import-6KXFY6XI.mjs +0 -35
  206. package/dist/thread-OV6T555H.mjs +0 -28
  207. /package/dist/{chunk-22YPZVMG.mjs → chunk-ZXNQEW43.mjs} +0 -0
@@ -0,0 +1,1251 @@
1
+ import { NarsilError, ErrorCodes } from './chunk-YH7W556M.mjs';
2
+
3
+ // src/analysis/registry.ts
4
+ var tokenizers = /* @__PURE__ */ new Map();
5
+ var stopWordSets = /* @__PURE__ */ new Map();
6
+ function requireName(name, kind) {
7
+ if (typeof name !== "string" || name.trim().length === 0) {
8
+ throw new NarsilError(ErrorCodes.CONFIG_INVALID, `A registered ${kind} needs a non-empty name`, { name });
9
+ }
10
+ }
11
+ function registerTokenizer(name, tokenizer) {
12
+ requireName(name, "tokenizer");
13
+ if (typeof tokenizer?.tokenize !== "function") {
14
+ throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Tokenizer "${name}" needs a tokenize method`, { tokenizer: name });
15
+ }
16
+ tokenizers.set(name, tokenizer);
17
+ }
18
+ function registerStopWords(name, stopWords2) {
19
+ requireName(name, "stop word set");
20
+ if (!(stopWords2 instanceof Set) && typeof stopWords2 !== "function") {
21
+ throw new NarsilError(
22
+ ErrorCodes.CONFIG_INVALID,
23
+ `Stop word set "${name}" needs a Set of words or a function returning one`,
24
+ { stopWords: name }
25
+ );
26
+ }
27
+ stopWordSets.set(name, stopWords2);
28
+ }
29
+ function hasTokenizer(name) {
30
+ return tokenizers.has(name);
31
+ }
32
+ function hasStopWords(name) {
33
+ return stopWordSets.has(name);
34
+ }
35
+ function getTokenizer(name) {
36
+ const tokenizer = tokenizers.get(name);
37
+ if (!tokenizer) {
38
+ throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Tokenizer "${name}" is not registered on this engine`, {
39
+ tokenizer: name,
40
+ available: [...tokenizers.keys()]
41
+ });
42
+ }
43
+ return tokenizer;
44
+ }
45
+ function getStopWords(name) {
46
+ const stopWords2 = stopWordSets.get(name);
47
+ if (!stopWords2) {
48
+ throw new NarsilError(ErrorCodes.CONFIG_INVALID, `Stop word set "${name}" is not registered on this engine`, {
49
+ stopWords: name,
50
+ available: [...stopWordSets.keys()]
51
+ });
52
+ }
53
+ return stopWords2;
54
+ }
55
+ function holdsPositionsOutOfOrder(entries) {
56
+ for (let index = 1; index < entries.length; index++) {
57
+ if (entries[index].position < entries[index - 1].position) return true;
58
+ }
59
+ return false;
60
+ }
61
+ function inPositionOrder(tokenizer) {
62
+ return {
63
+ tokenize(text) {
64
+ const entries = tokenizer.tokenize(text);
65
+ if (!holdsPositionsOutOfOrder(entries)) return entries;
66
+ return [...entries].sort((first, second) => first.position - second.position);
67
+ }
68
+ };
69
+ }
70
+ function resolveIndexAnalysis(config) {
71
+ const tokenizer = typeof config.tokenizer === "string" ? getTokenizer(config.tokenizer) : config.tokenizer;
72
+ return {
73
+ stopWords: typeof config.stopWords === "string" ? getStopWords(config.stopWords) : config.stopWords,
74
+ customTokenizer: tokenizer === void 0 ? void 0 : inPositionOrder(tokenizer)
75
+ };
76
+ }
77
+
78
+ // src/languages/snowball/base-stemmer.ts
79
+ var BaseStemmer = class {
80
+ current = "";
81
+ c = 0;
82
+ limit = 0;
83
+ limit_backward = 0;
84
+ bra = 0;
85
+ ket = 0;
86
+ af = 0;
87
+ setCurrent(value) {
88
+ this.current = value;
89
+ this.c = 0;
90
+ this.limit = this.current.length;
91
+ this.limit_backward = 0;
92
+ this.bra = 0;
93
+ this.ket = 0;
94
+ }
95
+ getCurrent() {
96
+ return this.current;
97
+ }
98
+ in_grouping(s, min, max) {
99
+ if (this.c >= this.limit) return false;
100
+ let ch = this.current.charCodeAt(this.c);
101
+ if (ch > max || ch < min) return false;
102
+ ch -= min;
103
+ if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return false;
104
+ this.c++;
105
+ return true;
106
+ }
107
+ go_in_grouping(s, min, max) {
108
+ while (this.c < this.limit) {
109
+ let ch = this.current.charCodeAt(this.c);
110
+ if (ch > max || ch < min) return true;
111
+ ch -= min;
112
+ if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return true;
113
+ this.c++;
114
+ }
115
+ return false;
116
+ }
117
+ in_grouping_b(s, min, max) {
118
+ if (this.c <= this.limit_backward) return false;
119
+ let ch = this.current.charCodeAt(this.c - 1);
120
+ if (ch > max || ch < min) return false;
121
+ ch -= min;
122
+ if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return false;
123
+ this.c--;
124
+ return true;
125
+ }
126
+ go_in_grouping_b(s, min, max) {
127
+ while (this.c > this.limit_backward) {
128
+ let ch = this.current.charCodeAt(this.c - 1);
129
+ if (ch > max || ch < min) return true;
130
+ ch -= min;
131
+ if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) return true;
132
+ this.c--;
133
+ }
134
+ return false;
135
+ }
136
+ out_grouping(s, min, max) {
137
+ if (this.c >= this.limit) return false;
138
+ let ch = this.current.charCodeAt(this.c);
139
+ if (ch > max || ch < min) {
140
+ this.c++;
141
+ return true;
142
+ }
143
+ ch -= min;
144
+ if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) {
145
+ this.c++;
146
+ return true;
147
+ }
148
+ return false;
149
+ }
150
+ go_out_grouping(s, min, max) {
151
+ while (this.c < this.limit) {
152
+ let ch = this.current.charCodeAt(this.c);
153
+ if (ch <= max && ch >= min) {
154
+ ch -= min;
155
+ if ((s[ch >>> 3] & 1 << (ch & 7)) !== 0) return true;
156
+ }
157
+ this.c++;
158
+ }
159
+ return false;
160
+ }
161
+ out_grouping_b(s, min, max) {
162
+ if (this.c <= this.limit_backward) return false;
163
+ let ch = this.current.charCodeAt(this.c - 1);
164
+ if (ch > max || ch < min) {
165
+ this.c--;
166
+ return true;
167
+ }
168
+ ch -= min;
169
+ if ((s[ch >>> 3] & 1 << (ch & 7)) === 0) {
170
+ this.c--;
171
+ return true;
172
+ }
173
+ return false;
174
+ }
175
+ go_out_grouping_b(s, min, max) {
176
+ while (this.c > this.limit_backward) {
177
+ let ch = this.current.charCodeAt(this.c - 1);
178
+ if (ch <= max && ch >= min) {
179
+ ch -= min;
180
+ if ((s[ch >>> 3] & 1 << (ch & 7)) !== 0) return true;
181
+ }
182
+ this.c--;
183
+ }
184
+ return false;
185
+ }
186
+ eq_s(s) {
187
+ if (this.limit - this.c < s.length) return false;
188
+ if (!this.current.startsWith(s, this.c)) return false;
189
+ this.c += s.length;
190
+ return true;
191
+ }
192
+ eq_s_b(s) {
193
+ if (this.c - this.limit_backward < s.length) return false;
194
+ if (!this.current.endsWith(s, this.c)) return false;
195
+ this.c -= s.length;
196
+ return true;
197
+ }
198
+ find_among(v, call_among_func) {
199
+ let i = 0;
200
+ let j = v.length;
201
+ const c = this.c;
202
+ const l = this.limit;
203
+ let common_i = 0;
204
+ let common_j = 0;
205
+ let first_key_inspected = false;
206
+ while (true) {
207
+ const k = i + (j - i >>> 1);
208
+ let diff = 0;
209
+ let common = common_i < common_j ? common_i : common_j;
210
+ const s = v[k][0];
211
+ for (let i2 = common; i2 < s.length; i2++) {
212
+ if (c + common === l) {
213
+ diff = -1;
214
+ break;
215
+ }
216
+ diff = this.current.charCodeAt(c + common) - s.charCodeAt(i2);
217
+ if (diff !== 0) break;
218
+ common++;
219
+ }
220
+ if (diff < 0) {
221
+ j = k;
222
+ common_j = common;
223
+ } else {
224
+ i = k;
225
+ common_i = common;
226
+ }
227
+ if (j - i <= 1) {
228
+ if (i > 0) break;
229
+ if (j === i) break;
230
+ if (first_key_inspected) break;
231
+ first_key_inspected = true;
232
+ }
233
+ }
234
+ while (true) {
235
+ const w = v[i];
236
+ const len = w[0].length;
237
+ if (common_i >= len) {
238
+ this.c = c + len;
239
+ const action = w[3];
240
+ if (action === void 0) return w[1];
241
+ this.af = action;
242
+ if (call_among_func?.call(this) === true) {
243
+ this.c = c + len;
244
+ return w[1];
245
+ }
246
+ }
247
+ const back = w[2];
248
+ if (back === void 0 || back === 0) return 0;
249
+ i -= back;
250
+ }
251
+ }
252
+ find_among_b(v, call_among_func) {
253
+ let i = 0;
254
+ let j = v.length;
255
+ const c = this.c;
256
+ const lb = this.limit_backward;
257
+ let common_i = 0;
258
+ let common_j = 0;
259
+ let first_key_inspected = false;
260
+ while (true) {
261
+ const k = i + (j - i >> 1);
262
+ let diff = 0;
263
+ let common = common_i < common_j ? common_i : common_j;
264
+ const s = v[k][0];
265
+ for (let i2 = s.length - 1 - common; i2 >= 0; i2--) {
266
+ if (c - common === lb) {
267
+ diff = -1;
268
+ break;
269
+ }
270
+ diff = this.current.charCodeAt(c - 1 - common) - s.charCodeAt(i2);
271
+ if (diff !== 0) break;
272
+ common++;
273
+ }
274
+ if (diff < 0) {
275
+ j = k;
276
+ common_j = common;
277
+ } else {
278
+ i = k;
279
+ common_i = common;
280
+ }
281
+ if (j - i <= 1) {
282
+ if (i > 0) break;
283
+ if (j === i) break;
284
+ if (first_key_inspected) break;
285
+ first_key_inspected = true;
286
+ }
287
+ }
288
+ while (true) {
289
+ const w = v[i];
290
+ const len = w[0].length;
291
+ if (common_i >= len) {
292
+ this.c = c - len;
293
+ const action = w[3];
294
+ if (action === void 0) return w[1];
295
+ this.af = action;
296
+ if (call_among_func?.call(this) === true) {
297
+ this.c = c - len;
298
+ return w[1];
299
+ }
300
+ }
301
+ const back = w[2];
302
+ if (back === void 0 || back === 0) return 0;
303
+ i -= back;
304
+ }
305
+ }
306
+ replace_s(c_bra, c_ket, s) {
307
+ const adjustment = s.length - (c_ket - c_bra);
308
+ this.current = this.current.slice(0, c_bra) + s + this.current.slice(c_ket);
309
+ this.limit += adjustment;
310
+ if (this.c >= c_ket) this.c += adjustment;
311
+ else if (this.c > c_bra) this.c = c_bra;
312
+ return adjustment;
313
+ }
314
+ slice_from(s) {
315
+ this.replace_s(this.bra, this.ket, s);
316
+ this.ket = this.bra + s.length;
317
+ }
318
+ slice_del() {
319
+ this.slice_from("");
320
+ }
321
+ insert(c_bra, c_ket, s) {
322
+ const adjustment = this.replace_s(c_bra, c_ket, s);
323
+ if (c_bra <= this.bra) this.bra += adjustment;
324
+ if (c_bra <= this.ket) this.ket += adjustment;
325
+ }
326
+ slice_to() {
327
+ return this.current.slice(this.bra, this.ket);
328
+ }
329
+ };
330
+
331
+ // src/languages/snowball/english.ts
332
+ var a_0 = [
333
+ ["arsen", -1],
334
+ ["commun", -1],
335
+ ["emerg", -1],
336
+ ["gener", -1],
337
+ ["inter", -1],
338
+ ["later", -1],
339
+ ["organ", -1],
340
+ ["past", -1],
341
+ ["univers", -1]
342
+ ];
343
+ var a_1 = [
344
+ ["'", 1],
345
+ ["'s'", 1, 1],
346
+ ["'s", 1]
347
+ ];
348
+ var a_2 = [
349
+ ["ied", 2],
350
+ ["s", 3],
351
+ ["ies", 2, 1],
352
+ ["sses", 1, 2],
353
+ ["ss", -1, 3],
354
+ ["us", -1, 4]
355
+ ];
356
+ var a_3 = [
357
+ ["succ", 1],
358
+ ["proc", 1],
359
+ ["exc", 1]
360
+ ];
361
+ var a_4 = [
362
+ ["even", 2],
363
+ ["cann", 2],
364
+ ["inn", 2],
365
+ ["earr", 2],
366
+ ["herr", 2],
367
+ ["out", 2],
368
+ ["y", 1]
369
+ ];
370
+ var a_5 = [
371
+ ["", -1],
372
+ ["ed", 2, 1],
373
+ ["eed", 1, 1],
374
+ ["ing", 3, 3],
375
+ ["edly", 2, 4],
376
+ ["eedly", 1, 1],
377
+ ["ingly", 2, 6]
378
+ ];
379
+ var a_6 = [
380
+ ["", 3],
381
+ ["bb", 2, 1],
382
+ ["dd", 2, 2],
383
+ ["ff", 2, 3],
384
+ ["gg", 2, 4],
385
+ ["bl", 1, 5],
386
+ ["mm", 2, 6],
387
+ ["nn", 2, 7],
388
+ ["pp", 2, 8],
389
+ ["rr", 2, 9],
390
+ ["at", 1, 10],
391
+ ["tt", 2, 11],
392
+ ["iz", 1, 12]
393
+ ];
394
+ var a_7 = [
395
+ ["anci", 3],
396
+ ["enci", 2],
397
+ ["ogi", 14],
398
+ ["li", 16],
399
+ ["bli", 12, 1],
400
+ ["abli", 4, 1],
401
+ ["alli", 8, 3],
402
+ ["fulli", 9, 4],
403
+ ["lessli", 15, 5],
404
+ ["ousli", 10, 6],
405
+ ["entli", 5, 7],
406
+ ["aliti", 8],
407
+ ["biliti", 12],
408
+ ["iviti", 11],
409
+ ["tional", 1],
410
+ ["ational", 7, 1],
411
+ ["alism", 8],
412
+ ["ation", 7],
413
+ ["ization", 6, 1],
414
+ ["izer", 6],
415
+ ["ator", 7],
416
+ ["iveness", 11],
417
+ ["fulness", 9],
418
+ ["ousness", 10],
419
+ ["ogist", 13]
420
+ ];
421
+ var a_8 = [
422
+ ["icate", 4],
423
+ ["ative", 6],
424
+ ["alize", 3],
425
+ ["iciti", 4],
426
+ ["ical", 4],
427
+ ["tional", 1],
428
+ ["ational", 2, 1],
429
+ ["ful", 5],
430
+ ["ness", 5]
431
+ ];
432
+ var a_9 = [
433
+ ["ic", 1],
434
+ ["ance", 1],
435
+ ["ence", 1],
436
+ ["able", 1],
437
+ ["ible", 1],
438
+ ["ate", 1],
439
+ ["ive", 1],
440
+ ["ize", 1],
441
+ ["iti", 1],
442
+ ["al", 1],
443
+ ["ism", 1],
444
+ ["ion", 2],
445
+ ["er", 1],
446
+ ["ous", 1],
447
+ ["ant", 1],
448
+ ["ent", 1],
449
+ ["ment", 1, 1],
450
+ ["ement", 1, 1]
451
+ ];
452
+ var a_10 = [
453
+ ["e", 1],
454
+ ["l", 2]
455
+ ];
456
+ var a_11 = [
457
+ ["andes", -1],
458
+ ["atlas", -1],
459
+ ["bias", -1],
460
+ ["cosmos", -1],
461
+ ["early", 6],
462
+ ["gently", 4],
463
+ ["howe", -1],
464
+ ["idly", 3],
465
+ ["news", -1],
466
+ ["only", 7],
467
+ ["singly", 8],
468
+ ["skies", 2],
469
+ ["skis", 1],
470
+ ["sky", -1],
471
+ ["ugly", 5]
472
+ ];
473
+ var as_11 = ["ski", "sky", "idl", "gentl", "ugli", "earli", "onli", "singl"];
474
+ var g_aeo = [17, 64];
475
+ var g_v = [17, 65, 16, 1];
476
+ var g_v_WXY = [1, 17, 65, 208, 1];
477
+ var g_valid_LI = [55, 141, 2];
478
+ var EnglishStemmer = class extends BaseStemmer {
479
+ #r_shortv() {
480
+ lab0: {
481
+ const v_1 = this.limit - this.c;
482
+ lab1: {
483
+ if (!this.out_grouping_b(g_v_WXY, 89, 121)) break lab1;
484
+ if (!this.in_grouping_b(g_v, 97, 121)) break lab1;
485
+ if (!this.out_grouping_b(g_v, 97, 121)) break lab1;
486
+ break lab0;
487
+ }
488
+ this.c = this.limit - v_1;
489
+ lab2: {
490
+ if (!this.out_grouping_b(g_v, 97, 121)) break lab2;
491
+ if (!this.in_grouping_b(g_v, 97, 121)) break lab2;
492
+ if (
493
+ /**@type {boolean}*/
494
+ this.c > this.limit_backward
495
+ ) break lab2;
496
+ break lab0;
497
+ }
498
+ this.c = this.limit - v_1;
499
+ if (!this.eq_s_b("past")) return false;
500
+ }
501
+ return true;
502
+ }
503
+ #stem() {
504
+ let a;
505
+ let B_Y_found;
506
+ let I_p2;
507
+ let I_p1;
508
+ lab0: {
509
+ const v_1 = this.c;
510
+ lab1: {
511
+ this.bra = this.c;
512
+ a = this.find_among(a_11);
513
+ if (a === 0) break lab1;
514
+ this.ket = this.c;
515
+ if (
516
+ /**@type {boolean}*/
517
+ this.c < this.limit
518
+ ) break lab1;
519
+ if (a > 0) {
520
+ this.slice_from(as_11[a - 1]);
521
+ }
522
+ break lab0;
523
+ }
524
+ this.c = v_1;
525
+ lab2: {
526
+ lab3: {
527
+ if (this.c + 3 > this.limit) break lab3;
528
+ this.c += 3;
529
+ break lab2;
530
+ }
531
+ break lab0;
532
+ }
533
+ this.c = v_1;
534
+ {
535
+ B_Y_found = false;
536
+ const v_2 = this.c;
537
+ lab5: {
538
+ this.bra = this.c;
539
+ if (!this.eq_s("'")) break lab5;
540
+ this.ket = this.c;
541
+ this.slice_del();
542
+ }
543
+ this.c = v_2;
544
+ const v_3 = this.c;
545
+ lab6: {
546
+ this.bra = this.c;
547
+ if (!this.eq_s("y")) break lab6;
548
+ this.ket = this.c;
549
+ this.slice_from("Y");
550
+ B_Y_found = true;
551
+ }
552
+ this.c = v_3;
553
+ const v_4 = this.c;
554
+ while (true) {
555
+ const v_5 = this.c;
556
+ lab8: {
557
+ while (true) {
558
+ const v_6 = this.c;
559
+ lab10: {
560
+ if (!this.in_grouping(g_v, 97, 121)) break lab10;
561
+ this.bra = this.c;
562
+ if (!this.eq_s("y")) break lab10;
563
+ this.ket = this.c;
564
+ this.c = v_6;
565
+ break;
566
+ }
567
+ this.c = v_6;
568
+ if (this.c >= this.limit) break lab8;
569
+ this.c++;
570
+ }
571
+ this.slice_from("Y");
572
+ B_Y_found = true;
573
+ continue;
574
+ }
575
+ this.c = v_5;
576
+ break;
577
+ }
578
+ this.c = v_4;
579
+ }
580
+ {
581
+ I_p1 = this.limit;
582
+ I_p2 = this.limit;
583
+ const v_7 = this.c;
584
+ lab12: {
585
+ lab13: {
586
+ const v_8 = this.c;
587
+ lab14: {
588
+ if (this.find_among(a_0) === 0) break lab14;
589
+ break lab13;
590
+ }
591
+ this.c = v_8;
592
+ if (!this.go_out_grouping(g_v, 97, 121)) break lab12;
593
+ this.c++;
594
+ if (!this.go_in_grouping(g_v, 97, 121)) break lab12;
595
+ this.c++;
596
+ }
597
+ I_p1 = this.c;
598
+ if (!this.go_out_grouping(g_v, 97, 121)) break lab12;
599
+ this.c++;
600
+ if (!this.go_in_grouping(g_v, 97, 121)) break lab12;
601
+ this.c++;
602
+ I_p2 = this.c;
603
+ }
604
+ this.c = v_7;
605
+ }
606
+ this.limit_backward = this.c;
607
+ this.c = this.limit;
608
+ const v_9 = this.limit - this.c;
609
+ lab15: {
610
+ const v_10 = this.limit - this.c;
611
+ lab16: {
612
+ this.ket = this.c;
613
+ if (this.find_among_b(a_1) === 0) {
614
+ this.c = this.limit - v_10;
615
+ break lab16;
616
+ }
617
+ this.bra = this.c;
618
+ this.slice_del();
619
+ }
620
+ this.ket = this.c;
621
+ a = this.find_among_b(a_2);
622
+ if (a === 0) break lab15;
623
+ this.bra = this.c;
624
+ switch (a) {
625
+ case 1: {
626
+ this.slice_from("ss");
627
+ break;
628
+ }
629
+ case 2: {
630
+ lab17: {
631
+ const v_11 = this.limit - this.c;
632
+ lab18: {
633
+ if (this.c - 2 < this.limit_backward) break lab18;
634
+ this.c -= 2;
635
+ this.slice_from("i");
636
+ break lab17;
637
+ }
638
+ this.c = this.limit - v_11;
639
+ this.slice_from("ie");
640
+ }
641
+ break;
642
+ }
643
+ case 3: {
644
+ if (this.c <= this.limit_backward) break lab15;
645
+ this.c--;
646
+ if (!this.go_out_grouping_b(g_v, 97, 121)) break lab15;
647
+ this.c--;
648
+ this.slice_del();
649
+ break;
650
+ }
651
+ }
652
+ }
653
+ this.c = this.limit - v_9;
654
+ const v_12 = this.limit - this.c;
655
+ lab19: {
656
+ this.ket = this.c;
657
+ a = this.find_among_b(a_5);
658
+ this.bra = this.c;
659
+ lab20: {
660
+ const v_13 = this.limit - this.c;
661
+ lab21: {
662
+ switch (a) {
663
+ case 1: {
664
+ const v_14 = this.limit - this.c;
665
+ lab22: {
666
+ if (
667
+ /**@type {boolean}*/
668
+ I_p1 > this.c
669
+ ) break lab22;
670
+ lab23: {
671
+ const v_15 = this.limit - this.c;
672
+ lab24: {
673
+ if (this.find_among_b(a_3) === 0) break lab24;
674
+ if (
675
+ /**@type {boolean}*/
676
+ this.c > this.limit_backward
677
+ ) break lab24;
678
+ break lab23;
679
+ }
680
+ this.c = this.limit - v_15;
681
+ this.slice_from("ee");
682
+ }
683
+ }
684
+ this.c = this.limit - v_14;
685
+ break;
686
+ }
687
+ case 2: {
688
+ break lab21;
689
+ }
690
+ case 3: {
691
+ a = this.find_among_b(a_4);
692
+ if (a === 0) break lab21;
693
+ switch (a) {
694
+ case 1: {
695
+ const v_16 = this.limit - this.c;
696
+ if (!this.out_grouping_b(g_v, 97, 121)) break lab21;
697
+ if (
698
+ /**@type {boolean}*/
699
+ this.c > this.limit_backward
700
+ ) break lab21;
701
+ this.c = this.limit - v_16;
702
+ this.bra = this.c;
703
+ this.slice_from("ie");
704
+ break;
705
+ }
706
+ case 2: {
707
+ if (
708
+ /**@type {boolean}*/
709
+ this.c > this.limit_backward
710
+ ) break lab21;
711
+ break;
712
+ }
713
+ }
714
+ break;
715
+ }
716
+ }
717
+ break lab20;
718
+ }
719
+ this.c = this.limit - v_13;
720
+ const v_17 = this.limit - this.c;
721
+ if (!this.go_out_grouping_b(g_v, 97, 121)) break lab19;
722
+ this.c--;
723
+ this.c = this.limit - v_17;
724
+ this.slice_del();
725
+ this.ket = this.c;
726
+ this.bra = this.c;
727
+ const v_18 = this.limit - this.c;
728
+ a = this.find_among_b(a_6);
729
+ switch (a) {
730
+ case 1: {
731
+ this.slice_from("e");
732
+ break lab19;
733
+ }
734
+ case 2: {
735
+ {
736
+ const v_19 = this.limit - this.c;
737
+ lab25: {
738
+ if (!this.in_grouping_b(g_aeo, 97, 111)) break lab25;
739
+ if (
740
+ /**@type {boolean}*/
741
+ this.c > this.limit_backward
742
+ ) break lab25;
743
+ break lab19;
744
+ }
745
+ this.c = this.limit - v_19;
746
+ }
747
+ break;
748
+ }
749
+ case 3: {
750
+ if (
751
+ /**@type {boolean}*/
752
+ this.c !== I_p1
753
+ ) break lab19;
754
+ const v_20 = this.limit - this.c;
755
+ if (!this.#r_shortv()) break lab19;
756
+ this.c = this.limit - v_20;
757
+ this.slice_from("e");
758
+ break lab19;
759
+ }
760
+ }
761
+ this.c = this.limit - v_18;
762
+ this.ket = this.c;
763
+ if (this.c <= this.limit_backward) break lab19;
764
+ this.c--;
765
+ this.bra = this.c;
766
+ this.slice_del();
767
+ }
768
+ }
769
+ this.c = this.limit - v_12;
770
+ const v_21 = this.limit - this.c;
771
+ lab26: {
772
+ this.ket = this.c;
773
+ lab27: {
774
+ lab28: {
775
+ if (!this.eq_s_b("y")) break lab28;
776
+ break lab27;
777
+ }
778
+ if (!this.eq_s_b("Y")) break lab26;
779
+ }
780
+ this.bra = this.c;
781
+ if (!this.out_grouping_b(g_v, 97, 121)) break lab26;
782
+ if (
783
+ /**@type {boolean}*/
784
+ this.c <= this.limit_backward
785
+ ) break lab26;
786
+ this.slice_from("i");
787
+ }
788
+ this.c = this.limit - v_21;
789
+ const v_22 = this.limit - this.c;
790
+ lab29: {
791
+ this.ket = this.c;
792
+ a = this.find_among_b(a_7);
793
+ if (a === 0) break lab29;
794
+ this.bra = this.c;
795
+ if (
796
+ /**@type {boolean}*/
797
+ I_p1 > this.c
798
+ ) break lab29;
799
+ switch (a) {
800
+ case 1: {
801
+ this.slice_from("tion");
802
+ break;
803
+ }
804
+ case 2: {
805
+ this.slice_from("ence");
806
+ break;
807
+ }
808
+ case 3: {
809
+ this.slice_from("ance");
810
+ break;
811
+ }
812
+ case 4: {
813
+ this.slice_from("able");
814
+ break;
815
+ }
816
+ case 5: {
817
+ this.slice_from("ent");
818
+ break;
819
+ }
820
+ case 6: {
821
+ this.slice_from("ize");
822
+ break;
823
+ }
824
+ case 7: {
825
+ this.slice_from("ate");
826
+ break;
827
+ }
828
+ case 8: {
829
+ this.slice_from("al");
830
+ break;
831
+ }
832
+ case 9: {
833
+ this.slice_from("ful");
834
+ break;
835
+ }
836
+ case 10: {
837
+ this.slice_from("ous");
838
+ break;
839
+ }
840
+ case 11: {
841
+ this.slice_from("ive");
842
+ break;
843
+ }
844
+ case 12: {
845
+ this.slice_from("ble");
846
+ break;
847
+ }
848
+ case 13: {
849
+ this.slice_from("og");
850
+ break;
851
+ }
852
+ case 14: {
853
+ if (!this.eq_s_b("l")) break lab29;
854
+ this.slice_from("og");
855
+ break;
856
+ }
857
+ case 15: {
858
+ this.slice_from("less");
859
+ break;
860
+ }
861
+ case 16: {
862
+ if (!this.in_grouping_b(g_valid_LI, 99, 116)) break lab29;
863
+ this.slice_del();
864
+ break;
865
+ }
866
+ }
867
+ }
868
+ this.c = this.limit - v_22;
869
+ const v_23 = this.limit - this.c;
870
+ lab30: {
871
+ this.ket = this.c;
872
+ a = this.find_among_b(a_8);
873
+ if (a === 0) break lab30;
874
+ this.bra = this.c;
875
+ if (
876
+ /**@type {boolean}*/
877
+ I_p1 > this.c
878
+ ) break lab30;
879
+ switch (a) {
880
+ case 1: {
881
+ this.slice_from("tion");
882
+ break;
883
+ }
884
+ case 2: {
885
+ this.slice_from("ate");
886
+ break;
887
+ }
888
+ case 3: {
889
+ this.slice_from("al");
890
+ break;
891
+ }
892
+ case 4: {
893
+ this.slice_from("ic");
894
+ break;
895
+ }
896
+ case 5: {
897
+ this.slice_del();
898
+ break;
899
+ }
900
+ case 6: {
901
+ if (
902
+ /**@type {boolean}*/
903
+ I_p2 > this.c
904
+ ) break lab30;
905
+ this.slice_del();
906
+ break;
907
+ }
908
+ }
909
+ }
910
+ this.c = this.limit - v_23;
911
+ const v_24 = this.limit - this.c;
912
+ lab31: {
913
+ this.ket = this.c;
914
+ a = this.find_among_b(a_9);
915
+ if (a === 0) break lab31;
916
+ this.bra = this.c;
917
+ if (
918
+ /**@type {boolean}*/
919
+ I_p2 > this.c
920
+ ) break lab31;
921
+ switch (a) {
922
+ case 1: {
923
+ this.slice_del();
924
+ break;
925
+ }
926
+ case 2: {
927
+ lab32: {
928
+ lab33: {
929
+ if (!this.eq_s_b("s")) break lab33;
930
+ break lab32;
931
+ }
932
+ if (!this.eq_s_b("t")) break lab31;
933
+ }
934
+ this.slice_del();
935
+ break;
936
+ }
937
+ }
938
+ }
939
+ this.c = this.limit - v_24;
940
+ const v_25 = this.limit - this.c;
941
+ lab34: {
942
+ this.ket = this.c;
943
+ a = this.find_among_b(a_10);
944
+ if (a === 0) break lab34;
945
+ this.bra = this.c;
946
+ switch (a) {
947
+ case 1: {
948
+ lab35: {
949
+ lab36: {
950
+ if (
951
+ /**@type {boolean}*/
952
+ I_p2 > this.c
953
+ ) break lab36;
954
+ break lab35;
955
+ }
956
+ if (
957
+ /**@type {boolean}*/
958
+ I_p1 > this.c
959
+ ) break lab34;
960
+ {
961
+ const v_26 = this.limit - this.c;
962
+ lab37: {
963
+ if (!this.#r_shortv()) break lab37;
964
+ break lab34;
965
+ }
966
+ this.c = this.limit - v_26;
967
+ }
968
+ }
969
+ this.slice_del();
970
+ break;
971
+ }
972
+ case 2: {
973
+ if (
974
+ /**@type {boolean}*/
975
+ I_p2 > this.c
976
+ ) break lab34;
977
+ if (!this.eq_s_b("l")) break lab34;
978
+ this.slice_del();
979
+ break;
980
+ }
981
+ }
982
+ }
983
+ this.c = this.limit - v_25;
984
+ this.c = this.limit_backward;
985
+ const v_27 = this.c;
986
+ lab38: {
987
+ if (!B_Y_found) break lab38;
988
+ while (true) {
989
+ const v_28 = this.c;
990
+ lab39: {
991
+ while (true) {
992
+ const v_29 = this.c;
993
+ lab41: {
994
+ this.bra = this.c;
995
+ if (!this.eq_s("Y")) break lab41;
996
+ this.ket = this.c;
997
+ this.c = v_29;
998
+ break;
999
+ }
1000
+ this.c = v_29;
1001
+ if (this.c >= this.limit) break lab39;
1002
+ this.c++;
1003
+ }
1004
+ this.slice_from("y");
1005
+ continue;
1006
+ }
1007
+ this.c = v_28;
1008
+ break;
1009
+ }
1010
+ }
1011
+ this.c = v_27;
1012
+ }
1013
+ return true;
1014
+ }
1015
+ stem(input) {
1016
+ this.setCurrent(input);
1017
+ this.#stem();
1018
+ return this.getCurrent();
1019
+ }
1020
+ };
1021
+ var shared = new EnglishStemmer();
1022
+ function stem(token) {
1023
+ return shared.stem(token);
1024
+ }
1025
+
1026
+ // src/languages/english.ts
1027
+ var stopWords = /* @__PURE__ */ new Set([
1028
+ "a",
1029
+ "an",
1030
+ "the",
1031
+ "i",
1032
+ "me",
1033
+ "my",
1034
+ "myself",
1035
+ "we",
1036
+ "us",
1037
+ "our",
1038
+ "ours",
1039
+ "ourselves",
1040
+ "you",
1041
+ "your",
1042
+ "yours",
1043
+ "yourself",
1044
+ "yourselves",
1045
+ "he",
1046
+ "him",
1047
+ "his",
1048
+ "himself",
1049
+ "she",
1050
+ "her",
1051
+ "hers",
1052
+ "herself",
1053
+ "it",
1054
+ "its",
1055
+ "itself",
1056
+ "they",
1057
+ "them",
1058
+ "their",
1059
+ "theirs",
1060
+ "themselves",
1061
+ "what",
1062
+ "which",
1063
+ "who",
1064
+ "whom",
1065
+ "this",
1066
+ "that",
1067
+ "these",
1068
+ "those",
1069
+ "am",
1070
+ "is",
1071
+ "are",
1072
+ "was",
1073
+ "were",
1074
+ "be",
1075
+ "been",
1076
+ "being",
1077
+ "have",
1078
+ "has",
1079
+ "had",
1080
+ "having",
1081
+ "do",
1082
+ "does",
1083
+ "did",
1084
+ "doing",
1085
+ "will",
1086
+ "would",
1087
+ "shall",
1088
+ "should",
1089
+ "can",
1090
+ "could",
1091
+ "may",
1092
+ "might",
1093
+ "must",
1094
+ "ought",
1095
+ "i'm",
1096
+ "you're",
1097
+ "we're",
1098
+ "they're",
1099
+ "i've",
1100
+ "you've",
1101
+ "we've",
1102
+ "they've",
1103
+ "i'd",
1104
+ "you'd",
1105
+ "he'd",
1106
+ "she'd",
1107
+ "we'd",
1108
+ "they'd",
1109
+ "i'll",
1110
+ "you'll",
1111
+ "he'll",
1112
+ "she'll",
1113
+ "we'll",
1114
+ "they'll",
1115
+ "isn't",
1116
+ "aren't",
1117
+ "wasn't",
1118
+ "weren't",
1119
+ "hasn't",
1120
+ "haven't",
1121
+ "hadn't",
1122
+ "doesn't",
1123
+ "don't",
1124
+ "didn't",
1125
+ "won't",
1126
+ "wouldn't",
1127
+ "shan't",
1128
+ "shouldn't",
1129
+ "can't",
1130
+ "cannot",
1131
+ "couldn't",
1132
+ "mustn't",
1133
+ "and",
1134
+ "but",
1135
+ "if",
1136
+ "or",
1137
+ "because",
1138
+ "as",
1139
+ "until",
1140
+ "while",
1141
+ "of",
1142
+ "at",
1143
+ "by",
1144
+ "for",
1145
+ "with",
1146
+ "about",
1147
+ "against",
1148
+ "between",
1149
+ "into",
1150
+ "through",
1151
+ "during",
1152
+ "before",
1153
+ "after",
1154
+ "above",
1155
+ "below",
1156
+ "to",
1157
+ "from",
1158
+ "up",
1159
+ "down",
1160
+ "in",
1161
+ "out",
1162
+ "on",
1163
+ "off",
1164
+ "over",
1165
+ "under",
1166
+ "again",
1167
+ "further",
1168
+ "then",
1169
+ "once",
1170
+ "here",
1171
+ "there",
1172
+ "when",
1173
+ "where",
1174
+ "why",
1175
+ "how",
1176
+ "all",
1177
+ "any",
1178
+ "both",
1179
+ "each",
1180
+ "few",
1181
+ "more",
1182
+ "most",
1183
+ "other",
1184
+ "some",
1185
+ "such",
1186
+ "no",
1187
+ "nor",
1188
+ "not",
1189
+ "only",
1190
+ "own",
1191
+ "same",
1192
+ "so",
1193
+ "than",
1194
+ "too",
1195
+ "very"
1196
+ ]);
1197
+ var english = {
1198
+ name: "english",
1199
+ revision: "ebae3448ae674b59",
1200
+ stemmer: stem,
1201
+ stopWords,
1202
+ tokenizer: {
1203
+ splitPattern: /[^\p{L}\p{M}\p{N}_']+/u,
1204
+ stripPossessive: true
1205
+ }
1206
+ };
1207
+
1208
+ // src/languages/registry.ts
1209
+ var languages = /* @__PURE__ */ new Map();
1210
+ languages.set("english", english);
1211
+ function registerLanguage(module) {
1212
+ languages.set(module.name, module);
1213
+ }
1214
+ function getLanguage(name) {
1215
+ const lang = languages.get(name);
1216
+ if (!lang) {
1217
+ throw new NarsilError(ErrorCodes.LANGUAGE_NOT_SUPPORTED, `Language "${name}" is not registered`, { language: name });
1218
+ }
1219
+ return lang;
1220
+ }
1221
+
1222
+ // src/engine/serial-index-update.ts
1223
+ var updatingByCore = /* @__PURE__ */ new WeakMap();
1224
+ async function withOpenIndex(core, indexName, action) {
1225
+ core.guardShutdown();
1226
+ core.requireIndex(indexName);
1227
+ const release = await core.indexState.acquire(indexName);
1228
+ try {
1229
+ return await action();
1230
+ } finally {
1231
+ release();
1232
+ }
1233
+ }
1234
+ async function oneAtATime(core, indexName, action) {
1235
+ let chains = updatingByCore.get(core);
1236
+ if (chains === void 0) {
1237
+ chains = /* @__PURE__ */ new Map();
1238
+ updatingByCore.set(core, chains);
1239
+ }
1240
+ const updating = chains;
1241
+ const earlier = updating.get(indexName) ?? Promise.resolve();
1242
+ const current = earlier.catch(() => void 0).then(action);
1243
+ updating.set(indexName, current);
1244
+ try {
1245
+ return await current;
1246
+ } finally {
1247
+ if (updating.get(indexName) === current) updating.delete(indexName);
1248
+ }
1249
+ }
1250
+
1251
+ export { getLanguage, getStopWords, getTokenizer, hasStopWords, hasTokenizer, oneAtATime, registerLanguage, registerStopWords, registerTokenizer, resolveIndexAnalysis, withOpenIndex };