cspell-trie-lib 9.7.0 → 9.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10,7 +10,6 @@ function* iteratorToIterable(iterator) {
10
10
  iterator.return?.();
11
11
  }
12
12
  }
13
-
14
13
  //#endregion
15
14
  //#region ../cspell-pipe/dist/operators/append.js
16
15
  /**
@@ -25,7 +24,6 @@ function opAppendSync(...iterablesToAppend) {
25
24
  }
26
25
  return fnAppend;
27
26
  }
28
-
29
27
  //#endregion
30
28
  //#region ../cspell-pipe/dist/operators/combine.js
31
29
  function opCombineSync(...fns) {
@@ -35,7 +33,6 @@ function opCombineSync(...fns) {
35
33
  }
36
34
  return combine;
37
35
  }
38
-
39
36
  //#endregion
40
37
  //#region ../cspell-pipe/dist/operators/concatMap.js
41
38
  function opConcatMapSync(mapFn) {
@@ -64,7 +61,6 @@ function opConcatMapSync(mapFn) {
64
61
  }
65
62
  return fnConcatMapSync;
66
63
  }
67
-
68
64
  //#endregion
69
65
  //#region ../cspell-pipe/dist/operators/filter.js
70
66
  function opFilterSync(filterFn) {
@@ -87,7 +83,6 @@ function opFilterSync(filterFn) {
87
83
  }
88
84
  return opFilterIterable;
89
85
  }
90
-
91
86
  //#endregion
92
87
  //#region ../cspell-pipe/dist/operators/flatten.js
93
88
  function opFlattenSync() {
@@ -96,7 +91,6 @@ function opFlattenSync() {
96
91
  }
97
92
  return fn;
98
93
  }
99
-
100
94
  //#endregion
101
95
  //#region ../cspell-pipe/dist/operators/map.js
102
96
  function opMapSync(mapFn) {
@@ -117,7 +111,6 @@ function opMapSync(mapFn) {
117
111
  }
118
112
  return opMapIterable;
119
113
  }
120
-
121
114
  //#endregion
122
115
  //#region ../cspell-pipe/dist/operators/reduce.js
123
116
  function opReduceSync(reduceFn, initialValue) {
@@ -144,7 +137,6 @@ function headTail(iter) {
144
137
  tail: iteratorToIterable(iterator)
145
138
  };
146
139
  }
147
-
148
140
  //#endregion
149
141
  //#region ../cspell-pipe/dist/operators/unique.js
150
142
  function opUniqueSync(k) {
@@ -170,19 +162,16 @@ function opUniqueSync(k) {
170
162
  }
171
163
  return k ? fnK(k) : fn;
172
164
  }
173
-
174
165
  //#endregion
175
166
  //#region ../cspell-pipe/dist/pipe.js
176
167
  function pipeSync(i, ...fns) {
177
168
  return opCombineSync(...fns)(i);
178
169
  }
179
-
180
170
  //#endregion
181
171
  //#region ../cspell-pipe/dist/reduce.js
182
172
  function reduceSync(iter, reduceFn, initialValue) {
183
173
  return [...initialValue === void 0 ? pipeSync(iter, opReduceSync(reduceFn)) : pipeSync(iter, opReduceSync(reduceFn, initialValue))][0];
184
174
  }
185
-
186
175
  //#endregion
187
176
  //#region src/lib/utils/memorizeLastCall.ts
188
177
  const SymEmpty = Symbol("memorizeLastCall");
@@ -197,7 +186,6 @@ function memorizeLastCall(fn) {
197
186
  }
198
187
  return calc;
199
188
  }
200
-
201
189
  //#endregion
202
190
  //#region src/lib/ITrieNode/find.ts
203
191
  const defaultLegacyMinCompoundLength$2 = 3;
@@ -490,23 +478,18 @@ function _createFindOptions$1(options) {
490
478
  compoundSeparator: options.compoundSeparator ?? d.compoundSeparator
491
479
  };
492
480
  }
493
-
494
481
  //#endregion
495
482
  //#region src/lib/walker/walkerTypes.ts
496
483
  const JOIN_SEPARATOR = "+";
497
484
  const WORD_SEPARATOR = " ";
498
- const CompoundWordsMethodEnum = {
485
+ const CompoundWordsMethod = {
499
486
  NONE: 0,
500
487
  SEPARATE_WORDS: 1,
501
- JOIN_WORDS: 2
502
- };
503
- const CompoundWordsMethod = {
504
- ...CompoundWordsMethodEnum,
488
+ JOIN_WORDS: 2,
505
489
  0: "NONE",
506
490
  1: "SEPARATE_WORDS",
507
491
  2: "JOIN_WORDS"
508
492
  };
509
-
510
493
  //#endregion
511
494
  //#region src/lib/ITrieNode/walker/walker.ts
512
495
  /**
@@ -517,8 +500,8 @@ function* compoundWalker$1(root, compoundingMethod) {
517
500
  const empty = Object.freeze([]);
518
501
  const roots = {
519
502
  [CompoundWordsMethod.NONE]: empty,
520
- [CompoundWordsMethod.JOIN_WORDS]: [[JOIN_SEPARATOR, root]],
521
- [CompoundWordsMethod.SEPARATE_WORDS]: [[WORD_SEPARATOR, root]]
503
+ [CompoundWordsMethod.JOIN_WORDS]: [["+", root]],
504
+ [CompoundWordsMethod.SEPARATE_WORDS]: [[" ", root]]
522
505
  };
523
506
  const rc = roots[compoundingMethod].length ? roots[compoundingMethod] : void 0;
524
507
  function children(n) {
@@ -657,7 +640,6 @@ function* walkerWordsITrie(root) {
657
640
  depth -= 1;
658
641
  }
659
642
  }
660
-
661
643
  //#endregion
662
644
  //#region src/lib/ITrieNode/trie-util.ts
663
645
  /**
@@ -687,20 +669,17 @@ function countWords$1(root) {
687
669
  }
688
670
  return walk(root);
689
671
  }
690
-
691
672
  //#endregion
692
673
  //#region src/lib/utils/debugger.ts
693
674
  let debuggerIsAttached = false;
694
675
  function isDebuggerAttached() {
695
676
  return debuggerIsAttached;
696
677
  }
697
-
698
678
  //#endregion
699
679
  //#region src/lib/utils/isDefined.ts
700
680
  function isDefined(t) {
701
681
  return t !== void 0;
702
682
  }
703
-
704
683
  //#endregion
705
684
  //#region src/lib/walker/hintedWalker.ts
706
685
  function hintedWalker(root, ignoreCase, hint, compoundingMethod, emitWordSeparator) {
@@ -730,8 +709,8 @@ function* hintedWalkerNext(root, ignoreCase, hint, compoundingMethod, emitWordSe
730
709
  const rootsForCompoundMethods = [...roots, ...compoundRoots];
731
710
  const compoundMethodRoots = {
732
711
  [CompoundWordsMethod.NONE]: [],
733
- [CompoundWordsMethod.JOIN_WORDS]: rootsForCompoundMethods.map((r) => [JOIN_SEPARATOR, r]),
734
- [CompoundWordsMethod.SEPARATE_WORDS]: rootsForCompoundMethods.map((r) => [WORD_SEPARATOR, r])
712
+ [CompoundWordsMethod.JOIN_WORDS]: rootsForCompoundMethods.map((r) => ["+", r]),
713
+ [CompoundWordsMethod.SEPARATE_WORDS]: rootsForCompoundMethods.map((r) => [" ", r])
735
714
  };
736
715
  function* children(n, hintOffset) {
737
716
  if (n.c) {
@@ -794,7 +773,6 @@ function existMap(values) {
794
773
  for (const v of values) m[v] = true;
795
774
  return m;
796
775
  }
797
-
798
776
  //#endregion
799
777
  //#region src/lib/TrieNode/trie.ts
800
778
  function trieRootToITrieRoot(root) {
@@ -918,7 +896,6 @@ var ImplITrieRoot = class extends ImplITrieNode {
918
896
  return new this(node);
919
897
  }
920
898
  };
921
-
922
899
  //#endregion
923
900
  //#region src/lib/walker/walker.ts
924
901
  /**
@@ -928,8 +905,8 @@ var ImplITrieRoot = class extends ImplITrieNode {
928
905
  function* compoundWalker(root, compoundingMethod) {
929
906
  const roots = {
930
907
  [CompoundWordsMethod.NONE]: [],
931
- [CompoundWordsMethod.JOIN_WORDS]: [[JOIN_SEPARATOR, root]],
932
- [CompoundWordsMethod.SEPARATE_WORDS]: [[WORD_SEPARATOR, root]]
908
+ [CompoundWordsMethod.JOIN_WORDS]: [["+", root]],
909
+ [CompoundWordsMethod.SEPARATE_WORDS]: [[" ", root]]
933
910
  };
934
911
  const rc = roots[compoundingMethod].length ? roots[compoundingMethod] : void 0;
935
912
  const empty = [];
@@ -1070,16 +1047,10 @@ function* _walkerWords(root) {
1070
1047
  function walker(root, compoundingMethod = CompoundWordsMethod.NONE) {
1071
1048
  return compoundingMethod === CompoundWordsMethod.NONE ? nodeWalker(root) : compoundWalker(root, compoundingMethod);
1072
1049
  }
1073
-
1074
- //#endregion
1075
- //#region src/lib/suggestions/genSuggestionsOptions.ts
1076
- const defaultGenSuggestionOptions = {
1050
+ const defaultSuggestionOptions = {
1077
1051
  compoundMethod: CompoundWordsMethod.NONE,
1078
1052
  ignoreCase: true,
1079
- changeLimit: 5
1080
- };
1081
- const defaultSuggestionOptions = {
1082
- ...defaultGenSuggestionOptions,
1053
+ changeLimit: 5,
1083
1054
  numSuggestions: 8,
1084
1055
  includeTies: true,
1085
1056
  get timeout() {
@@ -1111,7 +1082,6 @@ function createSuggestionOptions(...opts) {
1111
1082
  function assign(dest, src, k) {
1112
1083
  dest[k] = src[k] ?? dest[k];
1113
1084
  }
1114
-
1115
1085
  //#endregion
1116
1086
  //#region src/lib/utils/PairingHeap.ts
1117
1087
  var PairingHeap = class {
@@ -1202,10 +1172,8 @@ function mergeSiblings(compare, n) {
1202
1172
  const m = merge(compare, n, s);
1203
1173
  return ss ? merge(compare, m, mergeSiblings(compare, ss)) : m;
1204
1174
  }
1205
-
1206
1175
  //#endregion
1207
1176
  //#region src/lib/suggestions/constants.ts
1208
- const DEFAULT_COMPOUNDED_WORD_SEPARATOR = "∙";
1209
1177
  const opCosts = {
1210
1178
  baseCost: 100,
1211
1179
  swapCost: 75,
@@ -1216,11 +1184,7 @@ const opCosts = {
1216
1184
  wordBreak: 99,
1217
1185
  wordLengthCostFactor: .5
1218
1186
  };
1219
-
1220
- //#endregion
1221
- //#region src/lib/suggestions/orthography.ts
1222
- const intl = new Intl.Collator("en", { sensitivity: "base" });
1223
- const compare$2 = intl.compare;
1187
+ new Intl.Collator("en", { sensitivity: "base" }).compare;
1224
1188
  /**
1225
1189
  * This a set of letters that look like each other.
1226
1190
  * There can be a maximum of 30 groups.
@@ -1278,14 +1242,12 @@ function calcVisualLetterMasks(groups) {
1278
1242
  }
1279
1243
  return map;
1280
1244
  }
1281
-
1282
1245
  //#endregion
1283
1246
  //#region src/lib/utils/assert.ts
1284
1247
  function assert(condition, message = "Assert Failed") {
1285
1248
  if (condition) return;
1286
1249
  throw new Error(message);
1287
1250
  }
1288
-
1289
1251
  //#endregion
1290
1252
  //#region src/lib/distance/weightedMaps.ts
1291
1253
  const matchPossibleWordSeparators = /[+∙•・●]/g;
@@ -1501,9 +1463,8 @@ function normalizeDef(def) {
1501
1463
  };
1502
1464
  }
1503
1465
  function normalizeMap(map) {
1504
- return map.replaceAll(matchPossibleWordSeparators, DEFAULT_COMPOUNDED_WORD_SEPARATOR);
1466
+ return map.replaceAll(matchPossibleWordSeparators, "∙");
1505
1467
  }
1506
-
1507
1468
  //#endregion
1508
1469
  //#region src/lib/distance/distanceAStarWeighted.ts
1509
1470
  /**
@@ -1643,7 +1604,6 @@ function idx(r, c, cols) {
1643
1604
  function compare$1(a, b) {
1644
1605
  return a.c - b.c || b.ai + b.bi - a.ai - a.bi;
1645
1606
  }
1646
-
1647
1607
  //#endregion
1648
1608
  //#region src/lib/distance/levenshtein.ts
1649
1609
  const initialRow = [...".".repeat(50)].map((_, i) => i);
@@ -1692,7 +1652,6 @@ function levenshteinDistance(a, b) {
1692
1652
  }
1693
1653
  return pRow[nA];
1694
1654
  }
1695
-
1696
1655
  //#endregion
1697
1656
  //#region src/lib/distance/distance.ts
1698
1657
  const defaultCost = 100;
@@ -1726,14 +1685,12 @@ function editDistanceWeighted(wordA, wordB, weights, editCost = defaultCost) {
1726
1685
  function createWeightedMap(defs) {
1727
1686
  return createWeightMap(...defs);
1728
1687
  }
1729
-
1730
1688
  //#endregion
1731
1689
  //#region src/lib/utils/timer.ts
1732
1690
  function startTimer() {
1733
1691
  const start = performance.now();
1734
1692
  return () => performance.now() - start;
1735
1693
  }
1736
-
1737
1694
  //#endregion
1738
1695
  //#region src/lib/utils/util.ts
1739
1696
  function isDefined$1(a) {
@@ -1777,7 +1734,6 @@ function replaceAllFactory(match, replaceWithText) {
1777
1734
  const r = RegExp(regexQuote(match), "g");
1778
1735
  return (text) => text.replace(r, replaceWithText);
1779
1736
  }
1780
-
1781
1737
  //#endregion
1782
1738
  //#region src/lib/suggestions/suggestCollector.ts
1783
1739
  const defaultMaxNumberSuggestions = 10;
@@ -1785,7 +1741,7 @@ const BASE_COST = 100;
1785
1741
  const MAX_NUM_CHANGES = 5;
1786
1742
  const MAX_ALLOWED_COST_SCALE = 1.03 * .5;
1787
1743
  const collator = new Intl.Collator();
1788
- const regexSeparator = new RegExp(`[${regexQuote(WORD_SEPARATOR)}]`, "g");
1744
+ const regexSeparator = new RegExp(`[${regexQuote(" ")}]`, "g");
1789
1745
  const wordLengthCost = [
1790
1746
  0,
1791
1747
  50,
@@ -1817,7 +1773,7 @@ function suggestionCollector(wordToMatch, options) {
1817
1773
  const numSugToHold = weightMap ? numSuggestions * 2 : numSuggestions;
1818
1774
  const sugs = /* @__PURE__ */ new Map();
1819
1775
  let maxCost = BASE_COST * Math.min(wordToMatch.length * MAX_ALLOWED_COST_SCALE, changeLimit);
1820
- const useSeparator = compoundSeparator || (weightMap ? DEFAULT_COMPOUNDED_WORD_SEPARATOR : defaultSuggestionCollectorOptions.compoundSeparator);
1776
+ const useSeparator = compoundSeparator || (weightMap ? "∙" : defaultSuggestionCollectorOptions.compoundSeparator);
1821
1777
  const fnCleanWord = !useSeparator || useSeparator === compoundSeparator ? (w) => w : replaceAllFactory(useSeparator, "");
1822
1778
  if (useSeparator && weightMap) addDefToWeightMap(weightMap, {
1823
1779
  map: useSeparator,
@@ -1966,7 +1922,6 @@ function isSuggestionResult(s) {
1966
1922
  const r = s;
1967
1923
  return !!r && typeof r === "object" && r?.cost !== void 0 && r.word !== void 0;
1968
1924
  }
1969
-
1970
1925
  //#endregion
1971
1926
  //#region src/lib/suggestions/suggestAStar.ts
1972
1927
  /**
@@ -2000,7 +1955,7 @@ function* getSuggestionsAStar(trie, srcWord, options = {}) {
2000
1955
  const BC = opCosts.baseCost;
2001
1956
  const VC = opCosts.visuallySimilar;
2002
1957
  const DL = opCosts.duplicateLetterCost;
2003
- const wordSeparator = compoundMethod === CompoundWordsMethod.JOIN_WORDS ? JOIN_SEPARATOR : WORD_SEPARATOR;
1958
+ const wordSeparator = compoundMethod === CompoundWordsMethod.JOIN_WORDS ? "+" : " ";
2004
1959
  const sc = specialChars(trie.info);
2005
1960
  const comp = trie.info.compoundCharacter;
2006
1961
  const compRoot = root.get(comp);
@@ -2238,7 +2193,6 @@ function searchTrieCostNodesMatchingTrie2(trie, node, emit, s = "") {
2238
2193
  if (t.n) searchTrieCostNodesMatchingTrie2(t, c, emit, pfx);
2239
2194
  }
2240
2195
  }
2241
-
2242
2196
  //#endregion
2243
2197
  //#region src/lib/ITrieNode/TrieInfo.ts
2244
2198
  const defaultTrieInfoSettings = {
@@ -2411,7 +2365,6 @@ function revTrieInfo(info) {
2411
2365
  }
2412
2366
  return rev;
2413
2367
  }
2414
-
2415
2368
  //#endregion
2416
2369
  //#region src/lib/utils/endian.ts
2417
2370
  let cachedEndianness;
@@ -2421,7 +2374,6 @@ function endianness() {
2421
2374
  cachedEndianness = new Uint8Array(uint32s.buffer)[0] === 10 ? "BE" : "LE";
2422
2375
  return cachedEndianness;
2423
2376
  }
2424
-
2425
2377
  //#endregion
2426
2378
  //#region src/lib/binary/binaryFormat.ts
2427
2379
  const isLittleEndian = endianness() === "LE";
@@ -3056,7 +3008,6 @@ function byteAlign(offset, alignment) {
3056
3008
  function isByteAlignment(value) {
3057
3009
  return value === 1 || value === 2 || value === 4 || value === 8;
3058
3010
  }
3059
-
3060
3011
  //#endregion
3061
3012
  //#region src/lib/GTrie/GTrie.ts
3062
3013
  var GTrieNode = class {
@@ -3143,7 +3094,6 @@ var GTrie = class GTrie {
3143
3094
  return trie;
3144
3095
  }
3145
3096
  };
3146
-
3147
3097
  //#endregion
3148
3098
  //#region ../cspell-performance-monitor/dist/index.js
3149
3099
  const symbolCSpell = Symbol.for("cspell");
@@ -3178,7 +3128,6 @@ function makeDisposableFunction(fn) {
3178
3128
  function isEnabledPerformanceMeasurements() {
3179
3129
  return !!globalThisCSpell[symbolCSpell]?.enablePerformanceMeasurements;
3180
3130
  }
3181
-
3182
3131
  //#endregion
3183
3132
  //#region src/lib/StringTable/StringTable.ts
3184
3133
  /**
@@ -3397,7 +3346,6 @@ function toU32Array(data) {
3397
3346
  if (data instanceof Uint32Array) return data;
3398
3347
  return new Uint32Array(data);
3399
3348
  }
3400
-
3401
3349
  //#endregion
3402
3350
  //#region src/lib/utils/text.ts
3403
3351
  /**
@@ -3517,7 +3465,6 @@ function toCharCodes(s) {
3517
3465
  for (let i = 0; i < s.length; ++i) values.push(s.charCodeAt(i));
3518
3466
  return values;
3519
3467
  }
3520
-
3521
3468
  //#endregion
3522
3469
  //#region src/lib/TrieBlob/Utf8.ts
3523
3470
  /**
@@ -3681,7 +3628,6 @@ function encodeTextToUtf8(text) {
3681
3628
  encodeTextToUtf8Into(text, into);
3682
3629
  return into;
3683
3630
  }
3684
-
3685
3631
  //#endregion
3686
3632
  //#region src/lib/TrieBlob/CharIndex.ts
3687
3633
  Object.freeze([0]);
@@ -3801,17 +3747,9 @@ function splitUtf8(utf8) {
3801
3747
  utf8 & 255
3802
3748
  ].filter((v) => v);
3803
3749
  }
3804
-
3805
3750
  //#endregion
3806
3751
  //#region src/lib/TrieBlob/TrieBlobFormat.ts
3807
- const NodeHeaderNumChildrenShift = 0;
3808
- const NodeHeaderEOWMask = 256;
3809
3752
  const NodeHeaderPrefixMask = 1073741312;
3810
- const NodeHeaderPrefixShift = 9;
3811
- const NodeHeaderNumChildrenMask = 255;
3812
- const NodeMaskCharByte = 255;
3813
- const NodeChildIndexRefShift = 8;
3814
-
3815
3753
  //#endregion
3816
3754
  //#region src/lib/TrieBlob/optimizeNodes.ts
3817
3755
  const MAX_AUTO_ADD_TO_STRING_TABLE = 4;
@@ -3962,15 +3900,15 @@ function optimizeNodesWithStringTable(src) {
3962
3900
  const node = nodes[nodeIdx];
3963
3901
  if (node.length !== 2) return;
3964
3902
  const header = node[0];
3965
- if ((header & NodeHeaderEOWMask) !== 0) return;
3966
- if (header & NodeHeaderPrefixMask) return;
3903
+ if ((header & 256) !== 0) return;
3904
+ if (header & 1073741312) return;
3967
3905
  const childEntry = node[1];
3968
- const charByte = childEntry & NodeMaskCharByte;
3906
+ const charByte = childEntry & 255;
3969
3907
  const childIdx = childEntry >>> 8;
3970
3908
  if (multipleNodeRefs.has(childIdx)) return;
3971
3909
  const childNode = nodes[childIdx];
3972
3910
  const childHeader = childNode[0];
3973
- const childPrefixIdx = (childHeader & NodeHeaderPrefixMask) >>> NodeHeaderPrefixShift;
3911
+ const childPrefixIdx = (childHeader & NodeHeaderPrefixMask) >>> 9;
3974
3912
  const childBytes = builder.getEntry(childPrefixIdx) || [];
3975
3913
  if (!multiStringRefs.has(childPrefixIdx)) {
3976
3914
  multiStringRefs.add(childPrefixIdx);
@@ -3979,7 +3917,7 @@ function optimizeNodesWithStringTable(src) {
3979
3917
  const prefixBytes = [charByte, ...childBytes];
3980
3918
  const prefixIdx = builder.addStringBytes(prefixBytes);
3981
3919
  const newNode = Uint32Array.from(childNode);
3982
- newNode[0] = prefixIdx << NodeHeaderPrefixShift | childHeader & ~NodeHeaderPrefixMask;
3920
+ newNode[0] = prefixIdx << 9 | childHeader & ~NodeHeaderPrefixMask;
3983
3921
  nodes[nodeIdx] = newNode;
3984
3922
  }
3985
3923
  }
@@ -4008,7 +3946,6 @@ function walkNodes(nodes, nodeIdx, options) {
4008
3946
  }
4009
3947
  walk(nodeIdx);
4010
3948
  }
4011
-
4012
3949
  //#endregion
4013
3950
  //#region src/lib/TrieBlob/resolveMap.ts
4014
3951
  function resolveMap(map, key, resolve) {
@@ -4018,24 +3955,18 @@ function resolveMap(map, key, resolve) {
4018
3955
  map.set(key, v);
4019
3956
  return v;
4020
3957
  }
4021
-
4022
3958
  //#endregion
4023
3959
  //#region src/lib/constants.ts
4024
3960
  const COMPOUND_FIX = "+";
4025
3961
  const OPTIONAL_COMPOUND_FIX = "*";
4026
3962
  const CASE_INSENSITIVE_PREFIX = "~";
4027
3963
  const FORBID_PREFIX = "!";
4028
- const LINE_COMMENT = "#";
4029
- const IDENTITY_PREFIX = "=";
4030
- const SUGGESTION_PREFIX = ":";
4031
- const SUGGESTIONS_DISABLED = " ";
4032
3964
  const defaultTrieInfo = Object.freeze({
4033
- compoundCharacter: COMPOUND_FIX,
4034
- forbiddenWordPrefix: FORBID_PREFIX,
4035
- stripCaseAndAccentsPrefix: CASE_INSENSITIVE_PREFIX,
4036
- suggestionPrefix: SUGGESTION_PREFIX
3965
+ compoundCharacter: "+",
3966
+ forbiddenWordPrefix: "!",
3967
+ stripCaseAndAccentsPrefix: "~",
3968
+ suggestionPrefix: ":"
4037
3969
  });
4038
-
4039
3970
  //#endregion
4040
3971
  //#region src/lib/utils/mergeDefaults.ts
4041
3972
  /**
@@ -4052,13 +3983,11 @@ function mergeDefaults(value, defaultValue) {
4052
3983
  }
4053
3984
  return result;
4054
3985
  }
4055
-
4056
3986
  //#endregion
4057
3987
  //#region src/lib/utils/mergeOptionalWithDefaults.ts
4058
3988
  function mergeOptionalWithDefaults(...options) {
4059
3989
  return options.reduce((acc, opt) => mergeDefaults(opt, acc), defaultTrieInfo);
4060
3990
  }
4061
-
4062
3991
  //#endregion
4063
3992
  //#region src/lib/TrieBlob/prefix.ts
4064
3993
  function matchEntirePrefix(text, prefix) {
@@ -4071,13 +4000,11 @@ function matchEntirePrefix(text, prefix) {
4071
4000
  }
4072
4001
  return true;
4073
4002
  }
4074
-
4075
4003
  //#endregion
4076
4004
  //#region src/lib/utils/rawData.ts
4077
4005
  function toUint8Array(data) {
4078
4006
  return data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
4079
4007
  }
4080
-
4081
4008
  //#endregion
4082
4009
  //#region src/lib/TrieBlob/TrieBlobEncoder.ts
4083
4010
  const headerSig = "TrieBlob";
@@ -4130,7 +4057,6 @@ function isBTrieData(data) {
4130
4057
  for (let i = 0; i < 8; i++) if (buf[i] !== headerSig.codePointAt(i)) return false;
4131
4058
  return true;
4132
4059
  }
4133
-
4134
4060
  //#endregion
4135
4061
  //#region src/lib/TrieBlob/TrieBlobNodeRef.ts
4136
4062
  function trieBlobNodeRefToITrieNodeId(ref) {
@@ -4143,7 +4069,6 @@ function iTrieNodeIdToTrieBlobNodeRefParts(id) {
4143
4069
  pfx: Number(id & 4294967295n)
4144
4070
  };
4145
4071
  }
4146
-
4147
4072
  //#endregion
4148
4073
  //#region src/lib/TrieBlob/TrieBlobIRoot.ts
4149
4074
  const EMPTY_KEYS = Object.freeze([]);
@@ -4266,7 +4191,6 @@ var TrieBlobIRoot = class extends TrieBlobINode {
4266
4191
  return this.info.suggestionPrefix;
4267
4192
  }
4268
4193
  };
4269
-
4270
4194
  //#endregion
4271
4195
  //#region src/lib/TrieBlob/TypedArrayCursor.ts
4272
4196
  var TypedArrayCursor = class {
@@ -4296,7 +4220,6 @@ var TypedArrayCursor = class {
4296
4220
  function createUint8ArrayCursor(array, i = 0) {
4297
4221
  return new TypedArrayCursor(array, i);
4298
4222
  }
4299
-
4300
4223
  //#endregion
4301
4224
  //#region src/lib/TrieBlob/Utf8Cursor.ts
4302
4225
  var Utf8CursorImpl = class {
@@ -4327,7 +4250,6 @@ var Utf8CursorImpl = class {
4327
4250
  function createTextToUtf8Cursor(text, offset = 0) {
4328
4251
  return new Utf8CursorImpl(text, offset);
4329
4252
  }
4330
-
4331
4253
  //#endregion
4332
4254
  //#region src/lib/TrieBlob/TrieBlob.ts
4333
4255
  var TrieBlob = class TrieBlob {
@@ -4365,8 +4287,8 @@ var TrieBlob = class TrieBlob {
4365
4287
  this.hasForbiddenWords = !!this.#forbidIdx;
4366
4288
  this.hasCompoundWords = !!this.#compoundIdx;
4367
4289
  this.hasNonStrictWords = !!this.#nonStrictIdx;
4368
- this.NodeMaskNumChildren = NodeHeaderNumChildrenMask;
4369
- this.NodeChildRefShift = NodeChildIndexRefShift;
4290
+ this.NodeMaskNumChildren = 255;
4291
+ this.NodeChildRefShift = 8;
4370
4292
  this.hasPreferredSuggestions = !!this.#suggestIdx;
4371
4293
  }
4372
4294
  has(word) {
@@ -4454,7 +4376,7 @@ var TrieBlob = class TrieBlob {
4454
4376
  if (!nodeRef) return void 0;
4455
4377
  const _nodes = this.nodes;
4456
4378
  const _nodes8 = this.#nodes8;
4457
- const pfxShift = NodeHeaderPrefixShift;
4379
+ const pfxShift = 9;
4458
4380
  let { nodeIdx, pfx, prefix } = nodeRef;
4459
4381
  const t = createTextToUtf8Cursor(text);
4460
4382
  for (; !t.done; t.next()) {
@@ -4512,11 +4434,11 @@ var TrieBlob = class TrieBlob {
4512
4434
  for (const suffix of this.#walkWords(nodeIdx)) yield prefix + suffix;
4513
4435
  }
4514
4436
  *#walkWords(rootRef) {
4515
- const NodeMaskNumChildren = NodeHeaderNumChildrenMask;
4516
- const NodeMaskEOW = NodeHeaderEOWMask;
4517
- const NodeMaskChildCharIndex = NodeMaskCharByte;
4518
- const NodeChildRefShift = NodeChildIndexRefShift;
4519
- const nodeHeaderPrefixShift = NodeHeaderPrefixShift;
4437
+ const NodeMaskNumChildren = 255;
4438
+ const NodeMaskEOW = 256;
4439
+ const NodeMaskChildCharIndex = 255;
4440
+ const NodeChildRefShift = 8;
4441
+ const nodeHeaderPrefixShift = 9;
4520
4442
  const nodes = this.nodes;
4521
4443
  const st = this.#stringTable;
4522
4444
  const stack = [{
@@ -4562,7 +4484,7 @@ var TrieBlob = class TrieBlob {
4562
4484
  }
4563
4485
  get size() {
4564
4486
  if (this.#size) return this.#size;
4565
- const NodeMaskNumChildren = NodeHeaderNumChildrenMask;
4487
+ const NodeMaskNumChildren = 255;
4566
4488
  const nodes = this.nodes;
4567
4489
  let p = 0;
4568
4490
  let count = 0;
@@ -4601,11 +4523,11 @@ var TrieBlob = class TrieBlob {
4601
4523
  * @yields the depth in the stack. The stack will contain the current Reference.
4602
4524
  */
4603
4525
  *#walk(stack, depth = 0) {
4604
- const MaskNumChildren = NodeHeaderNumChildrenMask;
4605
- const NodeRefShift = NodeChildIndexRefShift;
4606
- const CharMask = NodeMaskCharByte;
4526
+ const MaskNumChildren = 255;
4527
+ const NodeRefShift = 8;
4528
+ const CharMask = 255;
4607
4529
  const PrefixMask = NodeHeaderPrefixMask;
4608
- const PrefixShift = NodeHeaderPrefixShift;
4530
+ const PrefixShift = 9;
4609
4531
  const nodes = this.nodes;
4610
4532
  stack[0] ||= {
4611
4533
  nodeIdx: 0,
@@ -4674,7 +4596,7 @@ var TrieBlob = class TrieBlob {
4674
4596
  hasChildren(ref) {
4675
4597
  const node = this.nodes[ref.nodeIdx];
4676
4598
  const pfxV = node & NodeHeaderPrefixMask;
4677
- const has = (node & NodeHeaderNumChildrenMask) !== 0;
4599
+ const has = (node & 255) !== 0;
4678
4600
  if (!pfxV) return has;
4679
4601
  if (isRefPfx(ref)) return ref.prefix ? true : has;
4680
4602
  ref = this.#cvtToRefPfx(ref);
@@ -4722,11 +4644,11 @@ var TrieBlob = class TrieBlob {
4722
4644
  */
4723
4645
  isRefEOW(ref) {
4724
4646
  if (ref.prefix && ref.pfx < ref.prefix.length) return false;
4725
- return !!(this.nodes[ref.nodeIdx] & NodeHeaderEOWMask);
4647
+ return !!(this.nodes[ref.nodeIdx] & 256);
4726
4648
  }
4727
4649
  #getNodePrefix(nodeIdx, pfx) {
4728
4650
  const pfxV = this.nodes[nodeIdx] & NodeHeaderPrefixMask;
4729
- const prefix = pfxV ? this.#stringTable.getStringBytes(pfxV >>> NodeHeaderPrefixShift) : void 0;
4651
+ const prefix = pfxV ? this.#stringTable.getStringBytes(pfxV >>> 9) : void 0;
4730
4652
  if (!prefix) return void 0;
4731
4653
  if (pfx >= prefix.length) return void 0;
4732
4654
  return prefix;
@@ -4748,13 +4670,13 @@ var TrieBlob = class TrieBlob {
4748
4670
  }
4749
4671
  getNodeDebugInfo(ref) {
4750
4672
  const node = this.nodes[ref.nodeIdx];
4751
- const isEOW = !!(node & NodeHeaderEOWMask);
4752
- const count = node & NodeHeaderNumChildrenMask;
4673
+ const isEOW = !!(node & 256);
4674
+ const count = node & 255;
4753
4675
  const children = /* @__PURE__ */ new Map();
4754
4676
  for (let i = 1; i <= count; ++i) {
4755
4677
  const entry = this.nodes[ref.nodeIdx + i];
4756
- const c = entry & NodeMaskCharByte;
4757
- const idx = entry >>> NodeChildIndexRefShift;
4678
+ const c = entry & 255;
4679
+ const idx = entry >>> 8;
4758
4680
  children.set(charToHex(c), numberToHex(idx) + " " + idx);
4759
4681
  }
4760
4682
  return {
@@ -4772,12 +4694,12 @@ var TrieBlob = class TrieBlob {
4772
4694
  function nodesToJson(nodes) {
4773
4695
  function nodeElement(offset) {
4774
4696
  const node = nodes[offset];
4775
- const numChildren = node & NodeHeaderNumChildrenMask;
4776
- const eow = !!(node & NodeHeaderEOWMask);
4697
+ const numChildren = node & 255;
4698
+ const eow = !!(node & 256);
4777
4699
  const children = [];
4778
4700
  for (let i = 1; i <= numChildren; ++i) children.push({
4779
- c: ("00" + (nodes[offset + i] & NodeMaskCharByte).toString(16)).slice(-2),
4780
- o: nodes[offset + i] >>> NodeChildIndexRefShift
4701
+ c: ("00" + (nodes[offset + i] & 255).toString(16)).slice(-2),
4702
+ o: nodes[offset + i] >>> 8
4781
4703
  });
4782
4704
  return {
4783
4705
  id: offset,
@@ -4800,8 +4722,8 @@ function nodesToJson(nodes) {
4800
4722
  * @param data
4801
4723
  */
4802
4724
  function trieBlobSort(data) {
4803
- const MaskNumChildren = NodeHeaderNumChildrenMask;
4804
- const MaskChildCharIndex = NodeMaskCharByte;
4725
+ const MaskNumChildren = 255;
4726
+ const MaskChildCharIndex = 255;
4805
4727
  const limit = data.length;
4806
4728
  let idx = 0;
4807
4729
  let node = data[0];
@@ -4831,7 +4753,6 @@ function charToHex(c) {
4831
4753
  function isRefPfx(ref) {
4832
4754
  return "prefix" in ref;
4833
4755
  }
4834
-
4835
4756
  //#endregion
4836
4757
  //#region src/lib/TrieBlob/TrieBuilderUtils.ts
4837
4758
  /**
@@ -4875,8 +4796,8 @@ function isSorted(node, mask, start, end) {
4875
4796
  }
4876
4797
  function toTrieBlob(nodes, stringTable, info) {
4877
4798
  const endPerf = measurePerf("TrieBlob.toTrieBlob");
4878
- const nodeMaskChildCharIndex = NodeMaskCharByte;
4879
- const nodeChildRefShift = NodeChildIndexRefShift;
4799
+ const nodeMaskChildCharIndex = 255;
4800
+ const nodeChildRefShift = 8;
4880
4801
  function calcNodeToIndex(nodes) {
4881
4802
  let offset = 0;
4882
4803
  const idx = Array(nodes.length + 1);
@@ -4890,9 +4811,9 @@ function toTrieBlob(nodes, stringTable, info) {
4890
4811
  const nodeToIndex = calcNodeToIndex(nodes);
4891
4812
  const nodeElementCount = nodeToIndex[nodeToIndex.length - 1];
4892
4813
  const binNodes = new Uint32Array(nodeElementCount);
4893
- const lenShift = NodeHeaderNumChildrenShift;
4894
- const refShift = NodeChildIndexRefShift;
4895
- const NodeHeaderMask = ~NodeHeaderNumChildrenMask;
4814
+ const lenShift = 0;
4815
+ const refShift = 8;
4816
+ const NodeHeaderMask = -256;
4896
4817
  let offset = 0;
4897
4818
  for (let i = 0; i < nodes.length; ++i) {
4898
4819
  const node = nodes[i];
@@ -4908,7 +4829,6 @@ function toTrieBlob(nodes, stringTable, info) {
4908
4829
  endPerf();
4909
4830
  return t;
4910
4831
  }
4911
-
4912
4832
  //#endregion
4913
4833
  //#region src/lib/TrieBlob/TrieBlobBuilder.ts
4914
4834
  const AUTO_OPTIMIZE_NODE_COUNT = 0;
@@ -4922,7 +4842,7 @@ var TrieBlobBuilder = class TrieBlobBuilder {
4922
4842
  wordToCharacters = (word) => [...word];
4923
4843
  #infoBuilder;
4924
4844
  constructor(options, characteristics) {
4925
- this.nodes = [[0], Object.freeze([NodeHeaderEOWMask])];
4845
+ this.nodes = [[0], Object.freeze([256])];
4926
4846
  this.IdxEOW = 1;
4927
4847
  this.#infoBuilder = new TrieInfoBuilder(options, characteristics);
4928
4848
  }
@@ -4951,9 +4871,9 @@ var TrieBlobBuilder = class TrieBlobBuilder {
4951
4871
  }
4952
4872
  createCursor(id) {
4953
4873
  const endPerf = measurePerf("TrieBlobBuilder.cursor");
4954
- const nodeChildRefShift = NodeChildIndexRefShift;
4955
- const NodeMaskEOW = NodeHeaderEOWMask;
4956
- const LetterMask = NodeMaskCharByte;
4874
+ const nodeChildRefShift = 8;
4875
+ const NodeMaskEOW = 256;
4876
+ const LetterMask = 255;
4957
4877
  const refNodes = [0, 1];
4958
4878
  const lookupCharCode = createCharUtf8_32RevLookup();
4959
4879
  let disposed = false;
@@ -5083,9 +5003,9 @@ var TrieBlobBuilder = class TrieBlobBuilder {
5083
5003
  word = word.trim();
5084
5004
  if (!word) return this;
5085
5005
  this.#infoBuilder.addWord(word);
5086
- const NodeMaskChildCharIndex = NodeMaskCharByte;
5087
- const nodeChildRefShift = NodeChildIndexRefShift;
5088
- const NodeMaskEOW = NodeHeaderEOWMask;
5006
+ const NodeMaskChildCharIndex = 255;
5007
+ const nodeChildRefShift = 8;
5008
+ const NodeMaskEOW = 256;
5089
5009
  const IdxEOW = this.IdxEOW;
5090
5010
  const nodes = this.nodes;
5091
5011
  let nodeIdx = 0;
@@ -5122,9 +5042,9 @@ var TrieBlobBuilder = class TrieBlobBuilder {
5122
5042
  return this;
5123
5043
  }
5124
5044
  has(word) {
5125
- const NodeMaskChildCharIndex = NodeMaskCharByte;
5126
- const nodeChildRefShift = NodeChildIndexRefShift;
5127
- const NodeMaskEOW = NodeHeaderEOWMask;
5045
+ const NodeMaskChildCharIndex = 255;
5046
+ const nodeChildRefShift = 8;
5047
+ const NodeMaskEOW = 256;
5128
5048
  const nodes = this.nodes;
5129
5049
  const charIndexes = this.wordToUtf8Seq(word);
5130
5050
  const len = charIndexes.length;
@@ -5157,7 +5077,7 @@ var TrieBlobBuilder = class TrieBlobBuilder {
5157
5077
  const { optimize, useStringTable } = buildOptions || {};
5158
5078
  const info = this.#infoBuilder.build();
5159
5079
  const bNodes = this.nodes;
5160
- let sortedNodes = sortNodes(bNodes, NodeMaskCharByte);
5080
+ let sortedNodes = sortNodes(bNodes, 255);
5161
5081
  if (optimize ?? sortNodes.length < AUTO_OPTIMIZE_NODE_COUNT) sortedNodes = optimizeNodes(sortedNodes);
5162
5082
  const stringTable = new StringTableBuilder().build();
5163
5083
  const r = useStringTable ? optimizeNodesWithStringTable({
@@ -5199,9 +5119,9 @@ var TrieBlobBuilder = class TrieBlobBuilder {
5199
5119
  */
5200
5120
  static fromTrieRoot(root, buildOptions) {
5201
5121
  const endPerf = measurePerf("TrieBlobBuilder.fromTrieRoot");
5202
- const NodeCharIndexMask = NodeMaskCharByte;
5203
- const nodeChildRefShift = NodeChildIndexRefShift;
5204
- const NodeMaskEOW = NodeHeaderEOWMask;
5122
+ const NodeCharIndexMask = 255;
5123
+ const nodeChildRefShift = 8;
5124
+ const NodeMaskEOW = 256;
5205
5125
  const tf = new TrieBlobBuilder(void 0, root);
5206
5126
  const IdxEOW = tf.IdxEOW;
5207
5127
  const known = new Map([[root, 0]]);
@@ -5259,9 +5179,9 @@ var TrieBlobBuilder = class TrieBlobBuilder {
5259
5179
  */
5260
5180
  static fromITrieRoot(root, buildOptions) {
5261
5181
  const endPerf = measurePerf("TrieBlobBuilder.fromITrieRoot");
5262
- const NodeCharIndexMask = NodeMaskCharByte;
5263
- const nodeChildRefShift = NodeChildIndexRefShift;
5264
- const NodeMaskEOW = NodeHeaderEOWMask;
5182
+ const NodeCharIndexMask = 255;
5183
+ const nodeChildRefShift = 8;
5184
+ const NodeMaskEOW = 256;
5265
5185
  const tf = new TrieBlobBuilder(void 0, root);
5266
5186
  const IdxEOW = tf.IdxEOW;
5267
5187
  const known = new Map([[root.id, 0]]);
@@ -5325,7 +5245,6 @@ function createCharUtf8_32RevLookup(maxSize = 256) {
5325
5245
  return code;
5326
5246
  };
5327
5247
  }
5328
-
5329
5248
  //#endregion
5330
5249
  //#region src/lib/utils/clean.ts
5331
5250
  function clean(t) {
@@ -5333,7 +5252,6 @@ function clean(t) {
5333
5252
  for (const key of Object.keys(copy)) if (copy[key] === void 0) delete copy[key];
5334
5253
  return copy;
5335
5254
  }
5336
-
5337
5255
  //#endregion
5338
5256
  //#region src/lib/ITrie.ts
5339
5257
  const defaultLegacyMinCompoundLength$1 = 3;
@@ -5563,7 +5481,6 @@ var ITrieImpl = class ITrieImpl {
5563
5481
  return createFindOptions$1(options);
5564
5482
  }
5565
5483
  };
5566
-
5567
5484
  //#endregion
5568
5485
  //#region src/lib/buildITrie.ts
5569
5486
  function buildITrieFromWords(words, info = {}, buildOptions) {
@@ -5576,7 +5493,6 @@ function buildITrieFromWords(words, info = {}, buildOptions) {
5576
5493
  endPerf();
5577
5494
  }
5578
5495
  }
5579
-
5580
5496
  //#endregion
5581
5497
  //#region src/lib/utils/isValidChar.ts
5582
5498
  function isValidChar(char) {
@@ -5588,11 +5504,9 @@ function assertIsValidChar(char, message) {
5588
5504
  function formatCharCodes(char) {
5589
5505
  return char.split("").map((c) => "0x" + c.charCodeAt(0).toString(16).padStart(4, "0").toUpperCase()).join(":");
5590
5506
  }
5591
-
5592
5507
  //#endregion
5593
5508
  //#region src/lib/TrieNode/TrieNode.ts
5594
5509
  const FLAG_WORD = 1;
5595
-
5596
5510
  //#endregion
5597
5511
  //#region src/lib/TrieNode/trie-util.ts
5598
5512
  function insert(word, root = {}) {
@@ -5605,11 +5519,11 @@ function insert(word, root = {}) {
5605
5519
  node = c[head] || {};
5606
5520
  c[head] = node;
5607
5521
  }
5608
- node.f = (node.f || 0) | FLAG_WORD;
5522
+ node.f = (node.f || 0) | 1;
5609
5523
  return root;
5610
5524
  }
5611
5525
  function isWordTerminationNode(node) {
5612
- return ((node.f || 0) & FLAG_WORD) === FLAG_WORD;
5526
+ return ((node.f || 0) & 1) === 1;
5613
5527
  }
5614
5528
  /**
5615
5529
  * Sorts the nodes in a trie in place.
@@ -5649,7 +5563,7 @@ function has(node, word) {
5649
5563
  h = t.slice(0, 1);
5650
5564
  t = t.slice(1);
5651
5565
  }
5652
- return !h.length && !!((node.f || 0) & FLAG_WORD);
5566
+ return !h.length && !!((node.f || 0) & 1);
5653
5567
  }
5654
5568
  function findNode(node, word) {
5655
5569
  for (let i = 0; i < word.length; ++i) {
@@ -5771,7 +5685,6 @@ var CTrieRoot = class CTrieRoot {
5771
5685
  return root;
5772
5686
  }
5773
5687
  };
5774
-
5775
5688
  //#endregion
5776
5689
  //#region src/lib/consolidate.ts
5777
5690
  /**
@@ -5840,14 +5753,13 @@ function consolidate(root) {
5840
5753
  return n;
5841
5754
  }
5842
5755
  const eow = findEow(root) || {
5843
- f: FLAG_WORD,
5756
+ f: 1,
5844
5757
  c: void 0
5845
5758
  };
5846
5759
  signatures.set(signature(eow), eow);
5847
5760
  cached.set(eow, count++);
5848
5761
  return trieNodeToRoot(process(root), root);
5849
5762
  }
5850
-
5851
5763
  //#endregion
5852
5764
  //#region src/lib/TrieBlob/trieDataEncoder.ts
5853
5765
  function encodeITrieToBTrie(trie, buildOptions) {
@@ -5860,15 +5772,14 @@ function encodeTrieDataToBTrie(data, buildOptions) {
5860
5772
  function decodeBTrie(data) {
5861
5773
  return TrieBlob.decodeBin(data);
5862
5774
  }
5863
-
5864
5775
  //#endregion
5865
5776
  //#region src/lib/TrieNode/find.ts
5866
5777
  const _defaultFindOptions = {
5867
5778
  matchCase: false,
5868
5779
  compoundMode: "compound",
5869
- forbidPrefix: FORBID_PREFIX,
5870
- compoundFix: COMPOUND_FIX,
5871
- caseInsensitivePrefix: CASE_INSENSITIVE_PREFIX,
5780
+ forbidPrefix: "!",
5781
+ compoundFix: "+",
5782
+ caseInsensitivePrefix: "~",
5872
5783
  legacyMinCompoundLength: 3,
5873
5784
  compoundSeparator: void 0
5874
5785
  };
@@ -6038,7 +5949,7 @@ function findWordExact(root, word) {
6038
5949
  return isEndOfWordNode(walk$1(root, word));
6039
5950
  }
6040
5951
  function isEndOfWordNode(n) {
6041
- return n?.f === FLAG_WORD;
5952
+ return n?.f === 1;
6042
5953
  }
6043
5954
  function walk$1(root, word) {
6044
5955
  const w = [...word];
@@ -6126,7 +6037,6 @@ const createFindOptions = memorizeLastCall(_createFindOptions);
6126
6037
  function _createFindOptions(options) {
6127
6038
  return mergeDefaults(options, _defaultFindOptions);
6128
6039
  }
6129
-
6130
6040
  //#endregion
6131
6041
  //#region src/lib/TrieNode/TrieNodeTrie.ts
6132
6042
  var TrieNodeTrie = class TrieNodeTrie {
@@ -6182,13 +6092,11 @@ var TrieNodeTrie = class TrieNodeTrie {
6182
6092
  return new TrieNodeTrie(consolidate(createTrieRootFromList(words, options)));
6183
6093
  }
6184
6094
  };
6185
-
6186
6095
  //#endregion
6187
6096
  //#region ../../node_modules/.pnpm/gensequence@8.0.8/node_modules/gensequence/dist/util/util.js
6188
6097
  function* toIterableIterator$2(i) {
6189
6098
  yield* i;
6190
6099
  }
6191
-
6192
6100
  //#endregion
6193
6101
  //#region ../../node_modules/.pnpm/gensequence@8.0.8/node_modules/gensequence/dist/operators/operatorsBase.js
6194
6102
  /**
@@ -6335,7 +6243,6 @@ function isIterable(i) {
6335
6243
  function isIterableIterator(i) {
6336
6244
  return typeof i.next == "function";
6337
6245
  }
6338
-
6339
6246
  //#endregion
6340
6247
  //#region ../../node_modules/.pnpm/gensequence@8.0.8/node_modules/gensequence/dist/operators/operators.js
6341
6248
  /**
@@ -6407,7 +6314,6 @@ function pipe(...fns) {
6407
6314
  return i;
6408
6315
  };
6409
6316
  }
6410
-
6411
6317
  //#endregion
6412
6318
  //#region ../../node_modules/.pnpm/gensequence@8.0.8/node_modules/gensequence/dist/ImplSequence.js
6413
6319
  var ImplSequence = class ImplSequence {
@@ -6501,13 +6407,11 @@ var ImplSequence = class ImplSequence {
6501
6407
  return toIterableIterator$2(this.iter);
6502
6408
  }
6503
6409
  };
6504
-
6505
6410
  //#endregion
6506
6411
  //#region ../../node_modules/.pnpm/gensequence@8.0.8/node_modules/gensequence/dist/GenSequence.js
6507
6412
  function genSequence(i) {
6508
6413
  return new ImplSequence(i);
6509
6414
  }
6510
-
6511
6415
  //#endregion
6512
6416
  //#region src/lib/convertToTrieRefNodes.ts
6513
6417
  const MinReferenceCount = 3;
@@ -6517,7 +6421,7 @@ const MinReferenceCount = 3;
6517
6421
  */
6518
6422
  function convertToTrieRefNodes(root) {
6519
6423
  const eow = {
6520
- f: FLAG_WORD,
6424
+ f: 1,
6521
6425
  c: void 0
6522
6426
  };
6523
6427
  const tallies = new Map([[eow, 0]]);
@@ -6582,11 +6486,9 @@ function convertToTrieRefNodes(root) {
6582
6486
  rollup(root);
6583
6487
  return walk(root);
6584
6488
  }
6585
-
6586
6489
  //#endregion
6587
6490
  //#region src/lib/io/importExportV1.ts
6588
- const EOW$3 = "*";
6589
- const DATA$4 = EOW$3;
6491
+ const EOW$2 = "*";
6590
6492
  function toReferences(node) {
6591
6493
  return genSequence(convertToTrieRefNodes(node));
6592
6494
  }
@@ -6597,7 +6499,7 @@ function escapeChar(char) {
6597
6499
  }
6598
6500
  function trieToExportString(node, base) {
6599
6501
  function* walk(node) {
6600
- if (node.f) yield EOW$3;
6502
+ if (node.f) yield EOW$2;
6601
6503
  if (node.r) {
6602
6504
  const refs = [...node.r].sort((a, b) => a[0] < b[0] ? -1 : 1);
6603
6505
  for (const n of refs) {
@@ -6656,7 +6558,7 @@ function importTrie$5(linesX) {
6656
6558
  if (next.done) break;
6657
6559
  const line = next.value.trim();
6658
6560
  if (!line || comment.test(line)) continue;
6659
- if (line === DATA$4) break;
6561
+ if (line === "*") break;
6660
6562
  headerRows.push(line);
6661
6563
  }
6662
6564
  parseHeaderRows(headerRows);
@@ -6664,12 +6566,12 @@ function importTrie$5(linesX) {
6664
6566
  const regNotEscapedCommas = /(^|[^\\]),/g;
6665
6567
  const regUnescapeCommas = /__COMMA__/g;
6666
6568
  const regUnescape = /[\\](.)/g;
6667
- const flagsWord = { f: FLAG_WORD };
6569
+ const flagsWord = { f: 1 };
6668
6570
  function splitLine(line) {
6669
6571
  return line.replaceAll(regNotEscapedCommas, "$1__COMMA__").split(regUnescapeCommas).map((a) => a.replaceAll(regUnescape, "$1"));
6670
6572
  }
6671
6573
  function decodeLine(line, nodes) {
6672
- const isWord = line[0] === EOW$3;
6574
+ const isWord = line[0] === EOW$2;
6673
6575
  line = isWord ? line.slice(1) : line;
6674
6576
  const flags = isWord ? flagsWord : {};
6675
6577
  const children = splitLine(line).filter((a) => !!a).map((a) => [a[0], Number.parseInt(a.slice(1) || "0", radix)]).map(([k, i]) => [k, nodes[i]]);
@@ -6679,7 +6581,7 @@ function importTrie$5(linesX) {
6679
6581
  };
6680
6582
  }
6681
6583
  readHeader(iter);
6682
- return trieNodeToRoot(genSequence([DATA$4]).concat(iter).map((a) => a.replace(/\r?\n/, "")).filter((a) => !!a).reduce((acc, line) => {
6584
+ return trieNodeToRoot(genSequence(["*"]).concat(iter).map((a) => a.replace(/\r?\n/, "")).filter((a) => !!a).reduce((acc, line) => {
6683
6585
  const { lines, nodes } = acc;
6684
6586
  const root = decodeLine(line, nodes);
6685
6587
  nodes[lines] = root;
@@ -6694,10 +6596,9 @@ function importTrie$5(linesX) {
6694
6596
  root: {}
6695
6597
  }).root, {});
6696
6598
  }
6697
-
6698
6599
  //#endregion
6699
6600
  //#region src/lib/io/importExportV2.ts
6700
- const EOW$2 = "*";
6601
+ const EOW$1 = "*";
6701
6602
  const DATA$3 = "__DATA__";
6702
6603
  function leaves(node) {
6703
6604
  function toRefNode(node, k) {
@@ -6748,12 +6649,12 @@ function flattenToReferences(node) {
6748
6649
  return genSequence(walk());
6749
6650
  }
6750
6651
  function signature(node) {
6751
- const flags = node.f ? EOW$2 : "";
6652
+ const flags = node.f ? EOW$1 : "";
6752
6653
  const refs = node.r ? node.r.sort((a, b) => a - b).join(",") : "";
6753
6654
  return node.s + flags + refs;
6754
6655
  }
6755
6656
  function toLine(node, base) {
6756
- const flags = node.f ? EOW$2 : "";
6657
+ const flags = node.f ? EOW$1 : "";
6757
6658
  const refs = node.r ? node.r.sort((a, b) => a - b).map((r) => r.toString(base)).join(",") : "";
6758
6659
  return node.s + flags + refs;
6759
6660
  }
@@ -6804,13 +6705,13 @@ function importTrie$4(linesX) {
6804
6705
  if (next.done) break;
6805
6706
  const line = next.value.trim();
6806
6707
  if (!line || comment.test(line)) continue;
6807
- if (line === DATA$3) break;
6708
+ if (line === "__DATA__") break;
6808
6709
  headerRows.push(line);
6809
6710
  }
6810
6711
  parseHeaderRows(headerRows);
6811
6712
  }
6812
6713
  function parseLine(line, base) {
6813
- const isWord = line[1] === EOW$2;
6714
+ const isWord = line[1] === EOW$1;
6814
6715
  const refOffset = isWord ? 2 : 1;
6815
6716
  const refs = line.slice(refOffset).split(",").filter((a) => !!a).map((r) => Number.parseInt(r, base));
6816
6717
  return {
@@ -6819,7 +6720,7 @@ function importTrie$4(linesX) {
6819
6720
  refs
6820
6721
  };
6821
6722
  }
6822
- const flagsWord = { f: FLAG_WORD };
6723
+ const flagsWord = { f: 1 };
6823
6724
  function decodeLine(line, nodes) {
6824
6725
  const { letter, isWord, refs } = parseLine(line, radix);
6825
6726
  const flags = isWord ? flagsWord : {};
@@ -6847,7 +6748,6 @@ function importTrie$4(linesX) {
6847
6748
  }
6848
6749
  }).root, {});
6849
6750
  }
6850
-
6851
6751
  //#endregion
6852
6752
  //#region src/lib/utils/bufferLines.ts
6853
6753
  function* buffer(iter, bufferSize) {
@@ -6868,26 +6768,6 @@ function* bufferLines(iter, bufferSize, eol) {
6868
6768
  if (eol) for (const s of buffer(iter, bufferSize)) yield s.join("") + eol;
6869
6769
  else for (const s of buffer(iter, bufferSize)) yield s.join("");
6870
6770
  }
6871
-
6872
- //#endregion
6873
- //#region src/lib/io/constants.ts
6874
- /** End of word */
6875
- const EOW$1 = "$";
6876
- /** Move up the tree */
6877
- const BACK = "<";
6878
- /** End of Line (ignored) */
6879
- const EOL = "\n";
6880
- /** Line Feed (ignored) */
6881
- const LF = "\r";
6882
- /** Start of Absolute Reference */
6883
- const REF = "#";
6884
- /** Start indexed of Reference */
6885
- const REF_REL = "@";
6886
- /** End of Reference */
6887
- const EOR = ";";
6888
- /** Escape the next character */
6889
- const ESCAPE = "\\";
6890
-
6891
6771
  //#endregion
6892
6772
  //#region src/lib/io/importExportV4.ts
6893
6773
  /**
@@ -6915,14 +6795,14 @@ const REF_INDEX_BEGIN = "[";
6915
6795
  const REF_INDEX_END = "]";
6916
6796
  const INLINE_DATA_COMMENT_LINE = "/";
6917
6797
  const specialCharacters$1 = stringToCharSet$2([
6918
- EOW$1,
6919
- BACK,
6920
- EOL,
6921
- REF,
6922
- REF_REL,
6923
- EOR,
6924
- ESCAPE,
6925
- LF,
6798
+ "$",
6799
+ "<",
6800
+ "\n",
6801
+ "#",
6802
+ "@",
6803
+ ";",
6804
+ "\\",
6805
+ "\r",
6926
6806
  REF_INDEX_BEGIN,
6927
6807
  REF_INDEX_END,
6928
6808
  INLINE_DATA_COMMENT_LINE,
@@ -6934,7 +6814,7 @@ const SPECIAL_CHARACTERS_MAP = [
6934
6814
  ["\r", "\\r"],
6935
6815
  ["\\", "\\\\"]
6936
6816
  ];
6937
- const specialCharacterMap$2 = stringToCharMap(SPECIAL_CHARACTERS_MAP);
6817
+ const specialCharacterMap$1 = stringToCharMap(SPECIAL_CHARACTERS_MAP);
6938
6818
  const characterMap$1 = stringToCharMap(SPECIAL_CHARACTERS_MAP.map((a) => [a[1], a[0]]));
6939
6819
  const specialPrefix$1 = stringToCharSet$2("~!");
6940
6820
  const WORDS_PER_LINE$1 = 20;
@@ -6968,48 +6848,50 @@ function serializeTrie$2(root, options = 16) {
6968
6848
  };
6969
6849
  const wordChars = [];
6970
6850
  function ref(n, idx) {
6971
- const r = idx === void 0 || n < idx ? REF + n.toString(radix) : REF_REL + idx.toString(radix);
6851
+ const r = idx === void 0 || n < idx ? "#" + n.toString(radix) : "@" + idx.toString(radix);
6972
6852
  return radix === 10 ? r : r + ";";
6973
6853
  }
6974
6854
  function escape(s) {
6975
- return s in specialCharacters$1 ? ESCAPE + (specialCharacterMap$2[s] || s) : s;
6855
+ return s in specialCharacters$1 ? "\\" + (specialCharacterMap$1[s] || s) : s;
6976
6856
  }
6977
6857
  function* flush() {
6978
6858
  while (backBuffer.count) {
6979
6859
  const n = Math.min(9, backBuffer.count);
6980
6860
  yield n > 1 ? backBuffer.last + n : backBuffer.last;
6981
- backBuffer.last = BACK;
6861
+ backBuffer.last = "<";
6982
6862
  backBuffer.count -= n;
6983
6863
  }
6984
6864
  if (backBuffer.eol) {
6985
- yield EOL;
6865
+ yield "\n";
6986
6866
  backBuffer.eol = false;
6987
6867
  backBuffer.words = 0;
6988
6868
  }
6989
6869
  }
6990
6870
  function* emit(s) {
6991
6871
  switch (s) {
6992
- case EOW$1:
6872
+ case "$":
6993
6873
  yield* flush();
6994
- backBuffer.last = EOW$1;
6874
+ backBuffer.last = "$";
6995
6875
  backBuffer.count = 0;
6996
6876
  backBuffer.words++;
6997
6877
  break;
6998
- case BACK:
6878
+ case "<":
6999
6879
  backBuffer.count++;
7000
6880
  break;
7001
- case EOL:
6881
+ case "\n":
7002
6882
  backBuffer.eol = true;
7003
6883
  break;
7004
6884
  default:
7005
6885
  if (backBuffer.words >= WORDS_PER_LINE$1) backBuffer.eol = true;
7006
6886
  yield* flush();
7007
- if (s.startsWith(REF) || s.startsWith(REF_REL)) backBuffer.words++;
6887
+ if (s.startsWith("#") || s.startsWith("@")) backBuffer.words++;
7008
6888
  yield s;
7009
6889
  }
7010
6890
  }
7011
- const comment_begin = `${EOL}${INLINE_DATA_COMMENT_LINE}* `;
7012
- const comment_end = ` *${INLINE_DATA_COMMENT_LINE}${EOL}`;
6891
+ const comment_begin = `
6892
+ ${INLINE_DATA_COMMENT_LINE}* `;
6893
+ const comment_end = ` *${INLINE_DATA_COMMENT_LINE}
6894
+ `;
7013
6895
  function* walk(node, depth) {
7014
6896
  const nodeNumber = cache.get(node);
7015
6897
  const refIndex = nodeToIndexMap.get(node);
@@ -7025,12 +6907,12 @@ function serializeTrie$2(root, options = 16) {
7025
6907
  wordChars[depth] = s;
7026
6908
  yield* emit(escape(s));
7027
6909
  yield* walk(n, depth + 1);
7028
- yield* emit(BACK);
7029
- if (depth === 0) yield* emit(EOL);
6910
+ yield* emit("<");
6911
+ if (depth === 0) yield* emit("\n");
7030
6912
  }
7031
6913
  }
7032
- if (node.f) yield* emit(EOW$1);
7033
- if (depth === 2 || depth === 3 && wordChars[0] in specialPrefix$1) yield* emit(EOL);
6914
+ if (node.f) yield* emit("$");
6915
+ if (depth === 2 || depth === 3 && wordChars[0] in specialPrefix$1) yield* emit("\n");
7034
6916
  }
7035
6917
  function* serialize(node) {
7036
6918
  yield* walk(node, 0);
@@ -7086,7 +6968,7 @@ function importTrie$3(linesX) {
7086
6968
  for (const value of iter) {
7087
6969
  const line = value.trim();
7088
6970
  if (!line || comment.test(line)) continue;
7089
- if (line === DATA$2) break;
6971
+ if (line === "__DATA__") break;
7090
6972
  headerRows.push(line);
7091
6973
  }
7092
6974
  parseHeaderRows(headerRows);
@@ -7100,10 +6982,10 @@ function parseStream$1(radix, iter) {
7100
6982
  let refIndex = [];
7101
6983
  const root = trieNodeToRoot({}, {});
7102
6984
  function parseReference(acc, s) {
7103
- const isIndexRef = s === REF_REL;
6985
+ const isIndexRef = s === "@";
7104
6986
  let ref = "";
7105
6987
  function parser(acc, s) {
7106
- if (s === EOR || radix === 10 && !(s in numbersSet)) {
6988
+ if (s === ";" || radix === 10 && !(s in numbersSet)) {
7107
6989
  const { root, nodes, stack } = acc;
7108
6990
  const r = Number.parseInt(ref, radix);
7109
6991
  const top = stack[stack.length - 1];
@@ -7116,7 +6998,7 @@ function parseStream$1(radix, iter) {
7116
6998
  stack,
7117
6999
  parser: void 0
7118
7000
  };
7119
- return s === EOR ? rr : parserMain(rr, s);
7001
+ return s === ";" ? rr : parserMain(rr, s);
7120
7002
  }
7121
7003
  ref = ref + s;
7122
7004
  return acc;
@@ -7139,7 +7021,7 @@ function parseStream$1(radix, iter) {
7139
7021
  parser: void 0
7140
7022
  }, s);
7141
7023
  }
7142
- if (s === ESCAPE) {
7024
+ if (s === "\\") {
7143
7025
  prev = s;
7144
7026
  return acc;
7145
7027
  }
@@ -7161,7 +7043,7 @@ function parseStream$1(radix, iter) {
7161
7043
  isEscaped = false;
7162
7044
  return acc;
7163
7045
  }
7164
- if (s === ESCAPE) {
7046
+ if (s === "\\") {
7165
7047
  isEscaped = true;
7166
7048
  return acc;
7167
7049
  }
@@ -7205,7 +7087,7 @@ function parseStream$1(radix, iter) {
7205
7087
  const { root, nodes, stack } = acc;
7206
7088
  const top = stack[stack.length - 1];
7207
7089
  const node = top.node;
7208
- node.f = FLAG_WORD;
7090
+ node.f = 1;
7209
7091
  if (!node.c) {
7210
7092
  top.node = eow;
7211
7093
  const p = stack[stack.length - 2].node;
@@ -7220,13 +7102,13 @@ function parseStream$1(radix, iter) {
7220
7102
  parser
7221
7103
  };
7222
7104
  }
7223
- const charactersBack = stringToCharSet$2(BACK + "23456789");
7105
+ const charactersBack = stringToCharSet$2("<23456789");
7224
7106
  function parseBack(acc, s) {
7225
7107
  if (!(s in charactersBack)) return parserMain({
7226
7108
  ...acc,
7227
7109
  parser: void 0
7228
7110
  }, s);
7229
- let n = s === BACK ? 1 : Number.parseInt(s, 10) - 1;
7111
+ let n = s === "<" ? 1 : Number.parseInt(s, 10) - 1;
7230
7112
  const { stack } = acc;
7231
7113
  while (n-- > 0) stack.pop();
7232
7114
  return {
@@ -7238,13 +7120,13 @@ function parseStream$1(radix, iter) {
7238
7120
  return acc;
7239
7121
  }
7240
7122
  const parsers = createStringLookupMap([
7241
- [EOW$1, parseEOW],
7242
- [BACK, parseBack],
7243
- [REF, parseReference],
7244
- [REF_REL, parseReference],
7245
- [ESCAPE, parseEscapeCharacter],
7246
- [EOL, parseIgnore],
7247
- [LF, parseIgnore],
7123
+ ["$", parseEOW],
7124
+ ["<", parseBack],
7125
+ ["#", parseReference],
7126
+ ["@", parseReference],
7127
+ ["\\", parseEscapeCharacter],
7128
+ ["\n", parseIgnore],
7129
+ ["\r", parseIgnore],
7248
7130
  [INLINE_DATA_COMMENT_LINE, parseComment]
7249
7131
  ]);
7250
7132
  function parserMain(acc, s) {
@@ -7329,7 +7211,6 @@ function tapIterable(iterable) {
7329
7211
  }
7330
7212
  return { [Symbol.iterator]: iterableFn };
7331
7213
  }
7332
-
7333
7214
  //#endregion
7334
7215
  //#region src/lib/TrieNode/TrieNodeBuilder.ts
7335
7216
  const EOW = Object.freeze({
@@ -7429,15 +7310,13 @@ var TrieNodeBuilder = class {
7429
7310
  if (this.shouldSort) this.sortChildren(this.root);
7430
7311
  }
7431
7312
  };
7432
-
7433
7313
  //#endregion
7434
7314
  //#region src/lib/io/importV3.ts
7435
- const specialCharacterMap$1 = new Map([
7315
+ const characterMap = new Map([...new Map([
7436
7316
  ["\n", "\\n"],
7437
7317
  ["\r", "\\r"],
7438
7318
  ["\\", "\\\\"]
7439
- ]);
7440
- const characterMap = new Map([...specialCharacterMap$1].map((a) => [a[1], a[0]]));
7319
+ ])].map((a) => [a[1], a[0]]));
7441
7320
  const DATA$1 = "__DATA__";
7442
7321
  function importTrieV3AsTrieRoot(srcLines) {
7443
7322
  return importTrieV3WithBuilder(new TrieNodeBuilder(), srcLines);
@@ -7489,7 +7368,7 @@ function parseStream(radix) {
7489
7368
  function parseReference(acc, _) {
7490
7369
  let ref = "";
7491
7370
  function parser(acc, s) {
7492
- if (s === EOR) {
7371
+ if (s === ";") {
7493
7372
  const { cursor } = acc;
7494
7373
  const r = Number.parseInt(ref, radix);
7495
7374
  cursor.reference(r + 1);
@@ -7510,7 +7389,7 @@ function parseStream(radix) {
7510
7389
  acc.parser = void 0;
7511
7390
  return parseCharacter(acc, s);
7512
7391
  }
7513
- if (s === ESCAPE) {
7392
+ if (s === "\\") {
7514
7393
  prev = s;
7515
7394
  return acc;
7516
7395
  }
@@ -7531,13 +7410,13 @@ function parseStream(radix) {
7531
7410
  acc.cursor.backStep(1);
7532
7411
  return acc;
7533
7412
  }
7534
- const charactersBack = stringToCharSet$1(BACK + "23456789");
7413
+ const charactersBack = stringToCharSet$1("<23456789");
7535
7414
  function parseBack(acc, s) {
7536
7415
  if (!(s in charactersBack)) {
7537
7416
  acc.parser = void 0;
7538
7417
  return parserMain(acc, s);
7539
7418
  }
7540
- const n = s === BACK ? 1 : Number.parseInt(s, 10) - 1;
7419
+ const n = s === "<" ? 1 : Number.parseInt(s, 10) - 1;
7541
7420
  acc.cursor.backStep(n);
7542
7421
  acc.parser = parseBack;
7543
7422
  return acc;
@@ -7546,12 +7425,12 @@ function parseStream(radix) {
7546
7425
  return acc;
7547
7426
  }
7548
7427
  const parsers = new Map([
7549
- [EOW$1, parseEOW],
7550
- [BACK, parseBack],
7551
- [REF, parseReference],
7552
- [ESCAPE, parseEscapeCharacter],
7553
- [EOL, parseIgnore],
7554
- [LF, parseIgnore]
7428
+ ["$", parseEOW],
7429
+ ["<", parseBack],
7430
+ ["#", parseReference],
7431
+ ["\\", parseEscapeCharacter],
7432
+ ["\n", parseIgnore],
7433
+ ["\r", parseIgnore]
7555
7434
  ]);
7556
7435
  function parserMain(acc, s) {
7557
7436
  return (acc.parser ?? parsers.get(s) ?? parseCharacter)(acc, s);
@@ -7564,13 +7443,11 @@ function stringToCharSet$1(values) {
7564
7443
  for (let i = 0; i < len; ++i) set[values[i]] = true;
7565
7444
  return set;
7566
7445
  }
7567
-
7568
7446
  //#endregion
7569
7447
  //#region src/lib/io/importV3FastBlob.ts
7570
7448
  function importTrieV3AsTrieBlob(srcLines) {
7571
7449
  return importTrieV3WithBuilder(new TrieBlobBuilder(), srcLines);
7572
7450
  }
7573
-
7574
7451
  //#endregion
7575
7452
  //#region src/lib/io/decode.ts
7576
7453
  function decodeTrieData(raw) {
@@ -7604,7 +7481,7 @@ function importTrie$2(input) {
7604
7481
  for (const entry of iter) {
7605
7482
  const line = entry.trim();
7606
7483
  headerRows.push(line);
7607
- if (line === DATA$4 || line === DATA$3) break;
7484
+ if (line === "*" || line === "__DATA__") break;
7608
7485
  }
7609
7486
  return headerRows;
7610
7487
  }
@@ -7613,7 +7490,6 @@ function importTrie$2(input) {
7613
7490
  if (!method) throw new Error(`Unsupported version: ${version}`);
7614
7491
  return method(lines);
7615
7492
  }
7616
-
7617
7493
  //#endregion
7618
7494
  //#region src/lib/suggestions/suggest.ts
7619
7495
  const baseCost = opCosts.baseCost;
@@ -7622,7 +7498,7 @@ const insertSpaceCost = -1;
7622
7498
  const mapSubCost = opCosts.visuallySimilar;
7623
7499
  const maxCostScale = opCosts.wordLengthCostFactor;
7624
7500
  const discourageInsertCost = baseCost;
7625
- const setOfSeparators = new Set([JOIN_SEPARATOR, WORD_SEPARATOR]);
7501
+ const setOfSeparators = new Set(["+", " "]);
7626
7502
  function suggest(root, word, options = {}) {
7627
7503
  const opts = createSuggestionOptions(options);
7628
7504
  const collector = suggestionCollector(word, clean(opts));
@@ -7647,8 +7523,8 @@ function* genCompoundableSuggestions(root, word, options = {}) {
7647
7523
  const x = " " + word;
7648
7524
  const mx = x.length - 1;
7649
7525
  const specialInsCosts = Object.assign(Object.create(null), {
7650
- [WORD_SEPARATOR]: insertSpaceCost,
7651
- [JOIN_SEPARATOR]: insertSpaceCost
7526
+ [" "]: insertSpaceCost,
7527
+ ["+"]: insertSpaceCost
7652
7528
  });
7653
7529
  const specialSubCosts = Object.assign(Object.create(null), { "-": discourageInsertCost });
7654
7530
  let stopNow = false;
@@ -7765,7 +7641,6 @@ function* genCompoundableSuggestions(root, word, options = {}) {
7765
7641
  goDeeper = min <= costLimit;
7766
7642
  }
7767
7643
  }
7768
-
7769
7644
  //#endregion
7770
7645
  //#region src/lib/trie.ts
7771
7646
  const defaultLegacyMinCompoundLength = 3;
@@ -7967,7 +7842,6 @@ var Trie = class Trie {
7967
7842
  return findOptions;
7968
7843
  }
7969
7844
  };
7970
-
7971
7845
  //#endregion
7972
7846
  //#region src/lib/utils/secondChanceCache.ts
7973
7847
  var SecondChanceCache = class {
@@ -8022,7 +7896,6 @@ var SecondChanceCache = class {
8022
7896
  return [...this.map1, ...this.map0];
8023
7897
  }
8024
7898
  };
8025
-
8026
7899
  //#endregion
8027
7900
  //#region src/lib/TrieBuilder.ts
8028
7901
  /**
@@ -8280,7 +8153,6 @@ function assertFrozen(n) {
8280
8153
  if (!("id" in n)) console.warn("%o", n);
8281
8154
  if (!Object.isFrozen(n) || !("id" in n)) throw new Error("Must be TrieNodeExFrozen");
8282
8155
  }
8283
-
8284
8156
  //#endregion
8285
8157
  //#region src/lib/utils/normalizeWord.ts
8286
8158
  /**
@@ -8305,17 +8177,16 @@ const normalizeWordForCaseInsensitive = (text) => {
8305
8177
  const t = text.toLowerCase();
8306
8178
  return [t, t.normalize("NFD").replaceAll(/\p{M}/gu, "")];
8307
8179
  };
8308
-
8309
8180
  //#endregion
8310
8181
  //#region src/lib/SimpleDictionaryParser.ts
8311
8182
  const BATCH_SIZE = 0;
8312
8183
  const _defaultOptions = {
8313
- commentCharacter: LINE_COMMENT,
8314
- optionalCompoundCharacter: OPTIONAL_COMPOUND_FIX,
8315
- compoundCharacter: COMPOUND_FIX,
8316
- forbiddenPrefix: FORBID_PREFIX,
8317
- caseInsensitivePrefix: CASE_INSENSITIVE_PREFIX,
8318
- keepExactPrefix: IDENTITY_PREFIX,
8184
+ commentCharacter: "#",
8185
+ optionalCompoundCharacter: "*",
8186
+ compoundCharacter: "+",
8187
+ forbiddenPrefix: "!",
8188
+ caseInsensitivePrefix: "~",
8189
+ keepExactPrefix: "=",
8319
8190
  stripCaseAndAccents: true,
8320
8191
  stripCaseAndAccentsKeepDuplicate: false,
8321
8192
  stripCaseAndAccentsOnForbidden: false,
@@ -8323,11 +8194,11 @@ const _defaultOptions = {
8323
8194
  splitKeepBoth: false,
8324
8195
  splitSeparator: /[\s,;]/g,
8325
8196
  keepOptionalCompoundCharacter: false,
8326
- suggestionPrefix: SUGGESTION_PREFIX,
8197
+ suggestionPrefix: ":",
8327
8198
  disableSuggestionHandling: false,
8328
8199
  makeWordsForbidden: false
8329
8200
  };
8330
- const defaultParseDictionaryOptions = Object.freeze(_defaultOptions);
8201
+ Object.freeze(_defaultOptions);
8331
8202
  const cSpellToolDirective = "cspell-dictionary:";
8332
8203
  /**
8333
8204
  * Normalizes a dictionary words based upon prefix / suffixes.
@@ -8345,7 +8216,7 @@ function createDictionaryLineParserMapper(options) {
8345
8216
  " ",
8346
8217
  "\0"
8347
8218
  ].includes(suggestionPrefix);
8348
- if (disableSuggestionHandling) suggestionPrefix = SUGGESTIONS_DISABLED;
8219
+ if (disableSuggestionHandling) suggestionPrefix = " ";
8349
8220
  function isString(line) {
8350
8221
  return typeof line === "string";
8351
8222
  }
@@ -8548,8 +8419,8 @@ function parseDictionary(text, options) {
8548
8419
  }
8549
8420
  function trieInfoFromOptions(options) {
8550
8421
  const info = extractTrieInfo(options);
8551
- const sugPrefix = info.suggestionPrefix ?? SUGGESTION_PREFIX;
8552
- if (options?.disableSuggestionHandling || sugPrefix !== SUGGESTION_PREFIX) info.suggestionPrefix = SUGGESTIONS_DISABLED;
8422
+ const sugPrefix = info.suggestionPrefix ?? ":";
8423
+ if (options?.disableSuggestionHandling || sugPrefix !== ":") info.suggestionPrefix = " ";
8553
8424
  return info;
8554
8425
  }
8555
8426
  function mergeOptions(base, ...partials) {
@@ -8591,7 +8462,6 @@ function createBatchAndSortLines(batchSize = BATCH_SIZE) {
8591
8462
  }
8592
8463
  return batchAndSortLines;
8593
8464
  }
8594
-
8595
8465
  //#endregion
8596
8466
  //#region src/lib/utils/decompress.ts
8597
8467
  async function decompress(data, method = "gzip") {
@@ -8620,7 +8490,6 @@ async function decompress(data, method = "gzip") {
8620
8490
  writer.releaseLock();
8621
8491
  }
8622
8492
  }
8623
-
8624
8493
  //#endregion
8625
8494
  //#region src/lib/decodeTrie.ts
8626
8495
  function decodeTrie(raw) {
@@ -8649,17 +8518,16 @@ async function convertToBTrie(file, options) {
8649
8518
  content: bTrieData
8650
8519
  };
8651
8520
  }
8652
-
8653
8521
  //#endregion
8654
8522
  //#region src/lib/io/importExportV3.ts
8655
8523
  const specialCharacters = stringToCharSet([
8656
- EOW$1,
8657
- BACK,
8658
- EOL,
8659
- REF,
8660
- EOR,
8661
- ESCAPE,
8662
- LF,
8524
+ "$",
8525
+ "<",
8526
+ "\n",
8527
+ "#",
8528
+ ";",
8529
+ "\\",
8530
+ "\r",
8663
8531
  "0123456789",
8664
8532
  "`~!@#$%^&*()_-+=[]{};:'\"<>,./?\\|"
8665
8533
  ].join(""));
@@ -8706,39 +8574,39 @@ function serializeTrie$1(root, options = 16) {
8706
8574
  return "#" + n.toString(radix) + ";";
8707
8575
  }
8708
8576
  function escape(s) {
8709
- return s in specialCharacters ? ESCAPE + (specialCharacterMap.get(s) || s) : s;
8577
+ return s in specialCharacters ? "\\" + (specialCharacterMap.get(s) || s) : s;
8710
8578
  }
8711
8579
  function* flush() {
8712
8580
  while (backBuffer.count) {
8713
8581
  const n = Math.min(9, backBuffer.count);
8714
8582
  yield n > 1 ? backBuffer.last + n : backBuffer.last;
8715
- backBuffer.last = BACK;
8583
+ backBuffer.last = "<";
8716
8584
  backBuffer.count -= n;
8717
8585
  }
8718
8586
  if (backBuffer.eol) {
8719
- yield EOL;
8587
+ yield "\n";
8720
8588
  backBuffer.eol = false;
8721
8589
  backBuffer.words = 0;
8722
8590
  }
8723
8591
  }
8724
8592
  function* emit(s) {
8725
8593
  switch (s) {
8726
- case EOW$1:
8594
+ case "$":
8727
8595
  yield* flush();
8728
- backBuffer.last = EOW$1;
8596
+ backBuffer.last = "$";
8729
8597
  backBuffer.count = 0;
8730
8598
  backBuffer.words++;
8731
8599
  break;
8732
- case BACK:
8600
+ case "<":
8733
8601
  backBuffer.count++;
8734
8602
  break;
8735
- case EOL:
8603
+ case "\n":
8736
8604
  backBuffer.eol = true;
8737
8605
  break;
8738
8606
  default:
8739
8607
  if (backBuffer.words >= WORDS_PER_LINE) backBuffer.eol = true;
8740
8608
  yield* flush();
8741
- if (s.startsWith(REF)) backBuffer.words++;
8609
+ if (s.startsWith("#")) backBuffer.words++;
8742
8610
  yield s;
8743
8611
  }
8744
8612
  }
@@ -8749,19 +8617,19 @@ function serializeTrie$1(root, options = 16) {
8749
8617
  return;
8750
8618
  }
8751
8619
  if (node.c) {
8752
- if (addBreaks && depth > 0 && depth <= 2) yield* emit(EOL);
8620
+ if (addBreaks && depth > 0 && depth <= 2) yield* emit("\n");
8753
8621
  cache.set(node, count++);
8754
8622
  const c = Object.entries(node.c).sort((a, b) => a[0] < b[0] ? -1 : 1);
8755
8623
  for (const [s, n] of c) {
8756
8624
  wordChars[depth] = s;
8757
8625
  yield* emit(escape(s));
8758
8626
  yield* walk(n, depth + 1);
8759
- yield* emit(BACK);
8760
- if (depth === 0) yield* emit(EOL);
8627
+ yield* emit("<");
8628
+ if (depth === 0) yield* emit("\n");
8761
8629
  }
8762
8630
  }
8763
- if (node.f) yield* emit(EOW$1);
8764
- if (addBreaks && (depth === 2 || depth === 3 && wordChars[0] in specialPrefix)) yield* emit(EOL);
8631
+ if (node.f) yield* emit("$");
8632
+ if (addBreaks && (depth === 2 || depth === 3 && wordChars[0] in specialPrefix)) yield* emit("\n");
8765
8633
  }
8766
8634
  function* serialize(node) {
8767
8635
  yield* walk(node, 0);
@@ -8792,7 +8660,6 @@ function stringToCharSet(values) {
8792
8660
  for (let i = 0; i < len; ++i) set[values[i]] = true;
8793
8661
  return set;
8794
8662
  }
8795
-
8796
8663
  //#endregion
8797
8664
  //#region src/lib/io/importExport.ts
8798
8665
  const serializers = [
@@ -8837,7 +8704,7 @@ function importTrie(input) {
8837
8704
  for (const entry of iter) {
8838
8705
  const line = entry.trim();
8839
8706
  headerRows.push(line);
8840
- if (line === DATA$4 || line === DATA$3) break;
8707
+ if (line === "*" || line === "__DATA__") break;
8841
8708
  }
8842
8709
  return headerRows;
8843
8710
  }
@@ -8846,7 +8713,6 @@ function importTrie(input) {
8846
8713
  if (!method) throw new Error(`Unsupported version: ${version}`);
8847
8714
  return method(lines);
8848
8715
  }
8849
-
8850
8716
  //#endregion
8851
8717
  //#region src/lib/models/locale/knownLocales.ts
8852
8718
  const codes = [
@@ -10945,7 +10811,6 @@ const codes = [
10945
10811
  "South Africa"
10946
10812
  ]
10947
10813
  ];
10948
-
10949
10814
  //#endregion
10950
10815
  //#region src/lib/models/locale/locale.ts
10951
10816
  let codesByLocale;
@@ -11008,7 +10873,6 @@ function parseLocale(locales) {
11008
10873
  locales = typeof locales === "string" ? locales.split(",") : locales;
11009
10874
  return locales.map(createLocale);
11010
10875
  }
11011
-
11012
10876
  //#endregion
11013
10877
  //#region src/lib/mappers/mapCosts.ts
11014
10878
  const defaultEditCosts = {
@@ -11038,7 +10902,6 @@ function mapEditCosts(costs = {}) {
11038
10902
  ...cleanCopy(costs)
11039
10903
  };
11040
10904
  }
11041
-
11042
10905
  //#endregion
11043
10906
  //#region src/lib/mappers/joinLetters.ts
11044
10907
  /**
@@ -11050,7 +10913,6 @@ function mapEditCosts(costs = {}) {
11050
10913
  function joinLetters(letters) {
11051
10914
  return [...letters].map((a) => a.length > 1 || !a.length ? `(${a})` : a).join("");
11052
10915
  }
11053
-
11054
10916
  //#endregion
11055
10917
  //#region src/lib/mappers/mapToSuggestionCostDef.ts
11056
10918
  function parseAlphabet(cs, locale, editCost) {
@@ -11139,7 +11001,6 @@ function* splitMap(map) {
11139
11001
  yield char;
11140
11002
  }
11141
11003
  }
11142
-
11143
11004
  //#endregion
11144
11005
  //#region src/lib/mappers/mapHunspellInformation.ts
11145
11006
  function hunspellInformationToSuggestionCostDef(hunInfo, locales) {
@@ -11286,7 +11147,6 @@ function reducer(fn, initialVal) {
11286
11147
  function asArrayOf(v) {
11287
11148
  return Array.isArray(v) ? v : [v];
11288
11149
  }
11289
-
11290
11150
  //#endregion
11291
11151
  //#region src/lib/mappers/mapDictionaryInfo.ts
11292
11152
  function mapDictionaryInformation(dictInfo) {
@@ -11332,7 +11192,6 @@ function mapAdjustment(adj) {
11332
11192
  penalty
11333
11193
  };
11334
11194
  }
11335
-
11336
11195
  //#endregion
11337
11196
  //#region src/lib/mappers/mapDictionaryInfoToWeightMap.ts
11338
11197
  const defaultDefs = [{
@@ -11364,7 +11223,7 @@ function mapDictionaryInformationToWeightMap(dictInfo) {
11364
11223
  addAdjustment(map, ...defaultAdjustments, ...adjustments);
11365
11224
  return map;
11366
11225
  }
11367
-
11368
11226
  //#endregion
11369
11227
  export { CASE_INSENSITIVE_PREFIX, COMPOUND_FIX, CompoundWordsMethod, FLAG_WORD, FORBID_PREFIX, GTrie, GTrieNode, JOIN_SEPARATOR, OPTIONAL_COMPOUND_FIX, Trie, TrieBuilder, WORD_SEPARATOR, buildITrieFromWords, buildTrie, buildTrieFast, consolidate, convertToBTrie, countNodes, countWords, createDictionaryLineParserMapper as createDictionaryLineParser, createTrieRoot, createTrieRootFromList, createWeightedMap, decodeFile, decodeTrie, defaultTrieInfo, defaultTrieInfo as defaultTrieOptions, editDistance, editDistanceWeighted, encodeITrieToBTrie, encodeTrieDataToBTrie, expandCharacterSet, findNode, has, hintedWalker, impersonateCollector, importTrie, insert, isCircular, isDefined, isWordTerminationNode, iterateTrie, iteratorTrieWords, mapDictionaryInformationToWeightMap, mergeDefaults, mergeOptionalWithDefaults, normalizeWord, normalizeWordForCaseInsensitive, normalizeWordToLowercase, orderTrie, parseDictionary, parseDictionaryLegacy, parseDictionaryLines, serializeTrie, suggestionCollector, trieNodeToRoot, walk, walker };
11228
+
11370
11229
  //# sourceMappingURL=index.js.map