kaabalah 4.5.1 → 4.7.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/{chunk-35GIQ624.mjs → chunk-72YKYKCA.mjs} +3 -3
- package/dist/{chunk-35GIQ624.mjs.map → chunk-72YKYKCA.mjs.map} +1 -1
- package/dist/{chunk-F2EUKWX6.js → chunk-FI7E5IS6.js} +4 -4
- package/dist/{chunk-F2EUKWX6.js.map → chunk-FI7E5IS6.js.map} +1 -1
- package/dist/{chunk-R6AU54TJ.js → chunk-JOYHXU24.js} +569 -2
- package/dist/chunk-JOYHXU24.js.map +1 -0
- package/dist/{chunk-7DBEXADC.mjs → chunk-VBO5EFEQ.mjs} +569 -3
- package/dist/chunk-VBO5EFEQ.mjs.map +1 -0
- package/dist/gematria/index.d.mts +43 -2
- package/dist/gematria/index.d.ts +43 -2
- package/dist/gematria/index.js +7 -3
- package/dist/gematria/index.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -19
- package/dist/index.mjs +2 -2
- package/dist/numerology/index.js +17 -17
- package/dist/numerology/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-7DBEXADC.mjs.map +0 -1
- package/dist/chunk-R6AU54TJ.js.map +0 -1
|
@@ -239,6 +239,572 @@ function getMissingGematriaValues(tree, includedGematriaValues) {
|
|
|
239
239
|
missingGematriaValues.sort((a, b) => a.value - b.value);
|
|
240
240
|
return missingGematriaValues;
|
|
241
241
|
}
|
|
242
|
+
function buildLetterInfo(tree, letter, isStarting) {
|
|
243
|
+
const latinLetterId = chunk5AIYNAGI_js.id("latinLetter" /* LATIN_LETTER */, letter);
|
|
244
|
+
const latinLetterNode = tree.getNode(latinLetterId);
|
|
245
|
+
if (!latinLetterNode?.data) return void 0;
|
|
246
|
+
const mapping = getLetterMapping({ tree, letterId: latinLetterId, isStarting });
|
|
247
|
+
if (!mapping?.data) return void 0;
|
|
248
|
+
return {
|
|
249
|
+
letter,
|
|
250
|
+
normalValue: mapping.data.gematriaValue,
|
|
251
|
+
endingValue: mapping.data.gematriaValueWhenEnding,
|
|
252
|
+
isVowel: latinLetterNode.data.isVowel,
|
|
253
|
+
isDigraph: DIGRAPHS.has(letter),
|
|
254
|
+
hebrewLetterId: mapping.id,
|
|
255
|
+
hebrewCharacter: mapping.data.character,
|
|
256
|
+
hebrewCharacterWhenEnding: mapping.data.characterWhenEnding
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function getAvailableLetters(tree, includeDigraphs) {
|
|
260
|
+
const singleLetters = [
|
|
261
|
+
"A",
|
|
262
|
+
"B",
|
|
263
|
+
"C",
|
|
264
|
+
"D",
|
|
265
|
+
"E",
|
|
266
|
+
"F",
|
|
267
|
+
"G",
|
|
268
|
+
"H",
|
|
269
|
+
"I",
|
|
270
|
+
"J",
|
|
271
|
+
"K",
|
|
272
|
+
"L",
|
|
273
|
+
"M",
|
|
274
|
+
"N",
|
|
275
|
+
"O",
|
|
276
|
+
"P",
|
|
277
|
+
"Q",
|
|
278
|
+
"R",
|
|
279
|
+
"S",
|
|
280
|
+
"T",
|
|
281
|
+
"U",
|
|
282
|
+
"V",
|
|
283
|
+
"W",
|
|
284
|
+
"X",
|
|
285
|
+
"Y",
|
|
286
|
+
"Z"
|
|
287
|
+
];
|
|
288
|
+
const digraphs = includeDigraphs ? Array.from(DIGRAPHS) : [];
|
|
289
|
+
return [...singleLetters, ...digraphs];
|
|
290
|
+
}
|
|
291
|
+
function parseSuggestionToLetterUnits(text) {
|
|
292
|
+
const upper = text.toUpperCase();
|
|
293
|
+
const units = [];
|
|
294
|
+
let i = 0;
|
|
295
|
+
while (i < upper.length) {
|
|
296
|
+
const char = upper[i];
|
|
297
|
+
if (i + 1 < upper.length) {
|
|
298
|
+
const twoChar = char + upper[i + 1].toLowerCase();
|
|
299
|
+
if (DIGRAPHS.has(twoChar)) {
|
|
300
|
+
units.push(twoChar);
|
|
301
|
+
i += 2;
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
units.push(char);
|
|
306
|
+
i += 1;
|
|
307
|
+
}
|
|
308
|
+
return units;
|
|
309
|
+
}
|
|
310
|
+
function countLetterUnits(units) {
|
|
311
|
+
const counts = /* @__PURE__ */ new Map();
|
|
312
|
+
for (const unit of units) {
|
|
313
|
+
counts.set(unit, (counts.get(unit) || 0) + 1);
|
|
314
|
+
}
|
|
315
|
+
return counts;
|
|
316
|
+
}
|
|
317
|
+
var reverseGematria = (options, tree) => {
|
|
318
|
+
const {
|
|
319
|
+
targetVowels,
|
|
320
|
+
targetConsonants,
|
|
321
|
+
targetSynthesis,
|
|
322
|
+
minLength = 1,
|
|
323
|
+
maxLength = 8,
|
|
324
|
+
maxResults = 100,
|
|
325
|
+
includeDigraphs = true,
|
|
326
|
+
maxLetterRepeat,
|
|
327
|
+
suggestionText,
|
|
328
|
+
suggestionMode = "subsequence"
|
|
329
|
+
} = options;
|
|
330
|
+
if (targetVowels === void 0 && targetConsonants === void 0 && targetSynthesis === void 0) {
|
|
331
|
+
return { results: [], hasMore: false, totalFound: 0 };
|
|
332
|
+
}
|
|
333
|
+
if (!tree) {
|
|
334
|
+
tree = chunk5AIYNAGI_js.createTree({ system: chunk5AIYNAGI_js.SYSTEM, parts: [] });
|
|
335
|
+
}
|
|
336
|
+
if (suggestionText !== void 0) {
|
|
337
|
+
if (suggestionMode === "subsequence") {
|
|
338
|
+
return reverseGematriaFromSubsequence(options, tree);
|
|
339
|
+
} else {
|
|
340
|
+
return reverseGematriaAnagram(options, tree);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const results = [];
|
|
344
|
+
let totalFound = 0;
|
|
345
|
+
let hasMore = false;
|
|
346
|
+
const availableLetters = getAvailableLetters(tree, includeDigraphs);
|
|
347
|
+
const letterInfoCache = /* @__PURE__ */ new Map();
|
|
348
|
+
const getLetterInfoCached = (letter, isStarting) => {
|
|
349
|
+
const cacheKey = `${letter}-${isStarting}`;
|
|
350
|
+
if (!letterInfoCache.has(cacheKey)) {
|
|
351
|
+
letterInfoCache.set(cacheKey, buildLetterInfo(tree, letter, isStarting));
|
|
352
|
+
}
|
|
353
|
+
return letterInfoCache.get(cacheKey);
|
|
354
|
+
};
|
|
355
|
+
const backtrack = (currentLetters, currentInfos, runningVowelsSum, runningConsonantsSum, letterCounts) => {
|
|
356
|
+
if (results.length >= maxResults) {
|
|
357
|
+
hasMore = true;
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const currentLength = currentLetters.length;
|
|
361
|
+
if (currentLength >= minLength && currentLength <= maxLength) {
|
|
362
|
+
let actualVowelsSum = runningVowelsSum;
|
|
363
|
+
let actualConsonantsSum = runningConsonantsSum;
|
|
364
|
+
if (currentLength > 1) {
|
|
365
|
+
const lastInfo = currentInfos[currentLength - 1];
|
|
366
|
+
if (lastInfo.endingValue !== void 0) {
|
|
367
|
+
const diff = lastInfo.endingValue - lastInfo.normalValue;
|
|
368
|
+
if (lastInfo.isVowel) {
|
|
369
|
+
actualVowelsSum += diff;
|
|
370
|
+
} else {
|
|
371
|
+
actualConsonantsSum += diff;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const actualSynthesisSum = actualVowelsSum + actualConsonantsSum;
|
|
376
|
+
const matchesVowels = targetVowels === void 0 || actualVowelsSum === targetVowels;
|
|
377
|
+
const matchesConsonants = targetConsonants === void 0 || actualConsonantsSum === targetConsonants;
|
|
378
|
+
const matchesSynthesis = targetSynthesis === void 0 || actualSynthesisSum === targetSynthesis;
|
|
379
|
+
if (matchesVowels && matchesConsonants && matchesSynthesis) {
|
|
380
|
+
totalFound++;
|
|
381
|
+
if (results.length < maxResults) {
|
|
382
|
+
const letterDetails = currentInfos.map((info, idx) => {
|
|
383
|
+
const isEnding = idx === currentLength - 1 && currentLength > 1;
|
|
384
|
+
const useEndingValue = isEnding && info.endingValue !== void 0;
|
|
385
|
+
return {
|
|
386
|
+
latinLetterId: chunk5AIYNAGI_js.id("latinLetter" /* LATIN_LETTER */, info.letter),
|
|
387
|
+
value: useEndingValue ? info.endingValue : info.normalValue,
|
|
388
|
+
hebrewLetterId: info.hebrewLetterId,
|
|
389
|
+
hebrewCharacter: useEndingValue && info.hebrewCharacterWhenEnding ? info.hebrewCharacterWhenEnding : info.hebrewCharacter,
|
|
390
|
+
isVowel: info.isVowel
|
|
391
|
+
};
|
|
392
|
+
});
|
|
393
|
+
results.push({
|
|
394
|
+
letters: currentLetters.join("").toUpperCase(),
|
|
395
|
+
letterDetails,
|
|
396
|
+
vowelsSum: actualVowelsSum,
|
|
397
|
+
consonantsSum: actualConsonantsSum,
|
|
398
|
+
synthesisSum: actualSynthesisSum
|
|
399
|
+
});
|
|
400
|
+
} else {
|
|
401
|
+
hasMore = true;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
if (currentLength >= maxLength) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
if (targetVowels !== void 0 && runningVowelsSum > targetVowels) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
if (targetConsonants !== void 0 && runningConsonantsSum > targetConsonants) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
if (targetSynthesis !== void 0 && runningVowelsSum + runningConsonantsSum > targetSynthesis) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
for (const letter of availableLetters) {
|
|
418
|
+
const isStarting = currentLength === 0;
|
|
419
|
+
const letterInfo = getLetterInfoCached(letter, isStarting);
|
|
420
|
+
if (!letterInfo) continue;
|
|
421
|
+
if (maxLetterRepeat !== void 0) {
|
|
422
|
+
const currentCount = letterCounts.get(letter) || 0;
|
|
423
|
+
if (currentCount >= maxLetterRepeat) {
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const value = letterInfo.normalValue;
|
|
428
|
+
const newVowelsSum = runningVowelsSum + (letterInfo.isVowel ? value : 0);
|
|
429
|
+
const newConsonantsSum = runningConsonantsSum + (letterInfo.isVowel ? 0 : value);
|
|
430
|
+
if (targetVowels !== void 0 && newVowelsSum > targetVowels) {
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
if (targetConsonants !== void 0 && newConsonantsSum > targetConsonants) {
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
if (targetSynthesis !== void 0 && newVowelsSum + newConsonantsSum > targetSynthesis) {
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
currentLetters.push(letter);
|
|
440
|
+
currentInfos.push(letterInfo);
|
|
441
|
+
letterCounts.set(letter, (letterCounts.get(letter) || 0) + 1);
|
|
442
|
+
backtrack(currentLetters, currentInfos, newVowelsSum, newConsonantsSum, letterCounts);
|
|
443
|
+
currentLetters.pop();
|
|
444
|
+
currentInfos.pop();
|
|
445
|
+
letterCounts.set(letter, letterCounts.get(letter) - 1);
|
|
446
|
+
if (results.length >= maxResults) {
|
|
447
|
+
hasMore = true;
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
backtrack([], [], 0, 0, /* @__PURE__ */ new Map());
|
|
453
|
+
return {
|
|
454
|
+
results,
|
|
455
|
+
hasMore,
|
|
456
|
+
totalFound
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
function reverseGematriaAnagram(options, tree) {
|
|
460
|
+
const {
|
|
461
|
+
targetVowels,
|
|
462
|
+
targetConsonants,
|
|
463
|
+
targetSynthesis,
|
|
464
|
+
minLength = 1,
|
|
465
|
+
maxLength = 8,
|
|
466
|
+
maxResults = 100,
|
|
467
|
+
maxLetterRepeat,
|
|
468
|
+
suggestionText = ""
|
|
469
|
+
} = options;
|
|
470
|
+
const results = [];
|
|
471
|
+
let totalFound = 0;
|
|
472
|
+
let hasMore = false;
|
|
473
|
+
const suggestionUnits = parseSuggestionToLetterUnits(suggestionText);
|
|
474
|
+
const letterUnits = suggestionUnits.filter((u) => u !== " ");
|
|
475
|
+
const maxSpaces = suggestionUnits.filter((u) => u === " ").length;
|
|
476
|
+
const availablePool = countLetterUnits(letterUnits);
|
|
477
|
+
const availableLetters = Array.from(availablePool.keys());
|
|
478
|
+
const letterInfoCache = /* @__PURE__ */ new Map();
|
|
479
|
+
const getLetterInfoCached = (letter, isStarting) => {
|
|
480
|
+
const cacheKey = `${letter}-${isStarting}`;
|
|
481
|
+
if (!letterInfoCache.has(cacheKey)) {
|
|
482
|
+
letterInfoCache.set(cacheKey, buildLetterInfo(tree, letter, isStarting));
|
|
483
|
+
}
|
|
484
|
+
return letterInfoCache.get(cacheKey);
|
|
485
|
+
};
|
|
486
|
+
const seenResults = /* @__PURE__ */ new Set();
|
|
487
|
+
const backtrack = (currentLetters, currentInfos, runningVowelsSum, runningConsonantsSum, letterCounts, usedFromPool, spacesUsed) => {
|
|
488
|
+
if (results.length >= maxResults) {
|
|
489
|
+
hasMore = true;
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
const letterOnlyLength = currentLetters.filter((l) => l !== " ").length;
|
|
493
|
+
if (letterOnlyLength >= minLength && letterOnlyLength <= maxLength) {
|
|
494
|
+
let actualVowelsSum = runningVowelsSum;
|
|
495
|
+
let actualConsonantsSum = runningConsonantsSum;
|
|
496
|
+
if (currentInfos.length > 1) {
|
|
497
|
+
const lastInfo = currentInfos[currentInfos.length - 1];
|
|
498
|
+
if (lastInfo.endingValue !== void 0) {
|
|
499
|
+
const diff = lastInfo.endingValue - lastInfo.normalValue;
|
|
500
|
+
if (lastInfo.isVowel) {
|
|
501
|
+
actualVowelsSum += diff;
|
|
502
|
+
} else {
|
|
503
|
+
actualConsonantsSum += diff;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
const actualSynthesisSum = actualVowelsSum + actualConsonantsSum;
|
|
508
|
+
const matchesVowels = targetVowels === void 0 || actualVowelsSum === targetVowels;
|
|
509
|
+
const matchesConsonants = targetConsonants === void 0 || actualConsonantsSum === targetConsonants;
|
|
510
|
+
const matchesSynthesis = targetSynthesis === void 0 || actualSynthesisSum === targetSynthesis;
|
|
511
|
+
if (matchesVowels && matchesConsonants && matchesSynthesis) {
|
|
512
|
+
const lettersStr = currentLetters.join("").toUpperCase();
|
|
513
|
+
if (!seenResults.has(lettersStr)) {
|
|
514
|
+
seenResults.add(lettersStr);
|
|
515
|
+
totalFound++;
|
|
516
|
+
if (results.length < maxResults) {
|
|
517
|
+
const letterDetails = currentInfos.map((info, idx) => {
|
|
518
|
+
const isEnding = idx === currentInfos.length - 1 && currentInfos.length > 1;
|
|
519
|
+
const useEndingValue = isEnding && info.endingValue !== void 0;
|
|
520
|
+
return {
|
|
521
|
+
latinLetterId: chunk5AIYNAGI_js.id("latinLetter" /* LATIN_LETTER */, info.letter),
|
|
522
|
+
value: useEndingValue ? info.endingValue : info.normalValue,
|
|
523
|
+
hebrewLetterId: info.hebrewLetterId,
|
|
524
|
+
hebrewCharacter: useEndingValue && info.hebrewCharacterWhenEnding ? info.hebrewCharacterWhenEnding : info.hebrewCharacter,
|
|
525
|
+
isVowel: info.isVowel
|
|
526
|
+
};
|
|
527
|
+
});
|
|
528
|
+
results.push({
|
|
529
|
+
letters: lettersStr,
|
|
530
|
+
letterDetails,
|
|
531
|
+
vowelsSum: actualVowelsSum,
|
|
532
|
+
consonantsSum: actualConsonantsSum,
|
|
533
|
+
synthesisSum: actualSynthesisSum
|
|
534
|
+
});
|
|
535
|
+
} else {
|
|
536
|
+
hasMore = true;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
if (letterOnlyLength >= maxLength) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
if (targetVowels !== void 0 && runningVowelsSum > targetVowels) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if (targetConsonants !== void 0 && runningConsonantsSum > targetConsonants) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
if (targetSynthesis !== void 0 && runningVowelsSum + runningConsonantsSum > targetSynthesis) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (spacesUsed < maxSpaces && currentLetters.length > 0 && currentLetters[currentLetters.length - 1] !== " ") {
|
|
554
|
+
currentLetters.push(" ");
|
|
555
|
+
backtrack(
|
|
556
|
+
currentLetters,
|
|
557
|
+
currentInfos,
|
|
558
|
+
runningVowelsSum,
|
|
559
|
+
runningConsonantsSum,
|
|
560
|
+
letterCounts,
|
|
561
|
+
usedFromPool,
|
|
562
|
+
spacesUsed + 1
|
|
563
|
+
);
|
|
564
|
+
currentLetters.pop();
|
|
565
|
+
if (results.length >= maxResults) {
|
|
566
|
+
hasMore = true;
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
for (const letter of availableLetters) {
|
|
571
|
+
const poolLimit = availablePool.get(letter) || 0;
|
|
572
|
+
const usedCount = usedFromPool.get(letter) || 0;
|
|
573
|
+
if (usedCount >= poolLimit) {
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
if (maxLetterRepeat !== void 0) {
|
|
577
|
+
const currentCount = letterCounts.get(letter) || 0;
|
|
578
|
+
if (currentCount >= maxLetterRepeat) {
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
const isStarting = currentInfos.length === 0;
|
|
583
|
+
const letterInfo = getLetterInfoCached(letter, isStarting);
|
|
584
|
+
if (!letterInfo) continue;
|
|
585
|
+
const value = letterInfo.normalValue;
|
|
586
|
+
const newVowelsSum = runningVowelsSum + (letterInfo.isVowel ? value : 0);
|
|
587
|
+
const newConsonantsSum = runningConsonantsSum + (letterInfo.isVowel ? 0 : value);
|
|
588
|
+
if (targetVowels !== void 0 && newVowelsSum > targetVowels) {
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
if (targetConsonants !== void 0 && newConsonantsSum > targetConsonants) {
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
if (targetSynthesis !== void 0 && newVowelsSum + newConsonantsSum > targetSynthesis) {
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
currentLetters.push(letter);
|
|
598
|
+
currentInfos.push(letterInfo);
|
|
599
|
+
letterCounts.set(letter, (letterCounts.get(letter) || 0) + 1);
|
|
600
|
+
usedFromPool.set(letter, usedCount + 1);
|
|
601
|
+
backtrack(
|
|
602
|
+
currentLetters,
|
|
603
|
+
currentInfos,
|
|
604
|
+
newVowelsSum,
|
|
605
|
+
newConsonantsSum,
|
|
606
|
+
letterCounts,
|
|
607
|
+
usedFromPool,
|
|
608
|
+
spacesUsed
|
|
609
|
+
);
|
|
610
|
+
currentLetters.pop();
|
|
611
|
+
currentInfos.pop();
|
|
612
|
+
letterCounts.set(letter, letterCounts.get(letter) - 1);
|
|
613
|
+
usedFromPool.set(letter, usedCount);
|
|
614
|
+
if (results.length >= maxResults) {
|
|
615
|
+
hasMore = true;
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
backtrack([], [], 0, 0, /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), 0);
|
|
621
|
+
return {
|
|
622
|
+
results,
|
|
623
|
+
hasMore,
|
|
624
|
+
totalFound
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
function reverseGematriaFromSubsequence(options, tree) {
|
|
628
|
+
const {
|
|
629
|
+
targetVowels,
|
|
630
|
+
targetConsonants,
|
|
631
|
+
targetSynthesis,
|
|
632
|
+
minLength = 1,
|
|
633
|
+
maxLength = 8,
|
|
634
|
+
maxResults = 100,
|
|
635
|
+
maxLetterRepeat,
|
|
636
|
+
suggestionText = ""
|
|
637
|
+
} = options;
|
|
638
|
+
const results = [];
|
|
639
|
+
let totalFound = 0;
|
|
640
|
+
let hasMore = false;
|
|
641
|
+
const suggestionUnits = parseSuggestionToLetterUnits(suggestionText);
|
|
642
|
+
const letterUnitsWithPositions = [];
|
|
643
|
+
for (let i = 0; i < suggestionUnits.length; i++) {
|
|
644
|
+
letterUnitsWithPositions.push({
|
|
645
|
+
unit: suggestionUnits[i],
|
|
646
|
+
isSpace: suggestionUnits[i] === " ",
|
|
647
|
+
originalIndex: i
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
const letterOnlyUnits = letterUnitsWithPositions.filter((u) => !u.isSpace);
|
|
651
|
+
const maxSpaces = letterUnitsWithPositions.filter((u) => u.isSpace).length;
|
|
652
|
+
const letterInfoCache = /* @__PURE__ */ new Map();
|
|
653
|
+
const getLetterInfoCached = (letter, isStarting) => {
|
|
654
|
+
const cacheKey = `${letter}-${isStarting}`;
|
|
655
|
+
if (!letterInfoCache.has(cacheKey)) {
|
|
656
|
+
letterInfoCache.set(cacheKey, buildLetterInfo(tree, letter, isStarting));
|
|
657
|
+
}
|
|
658
|
+
return letterInfoCache.get(cacheKey);
|
|
659
|
+
};
|
|
660
|
+
const seenResults = /* @__PURE__ */ new Set();
|
|
661
|
+
const generateSubsequences = (index, currentLetters, currentInfos, runningVowelsSum, runningConsonantsSum, letterCounts, spacesUsed) => {
|
|
662
|
+
if (results.length >= maxResults) {
|
|
663
|
+
hasMore = true;
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
const letterOnlyLength = currentLetters.filter((l) => l !== " ").length;
|
|
667
|
+
if (letterOnlyLength >= minLength && letterOnlyLength <= maxLength) {
|
|
668
|
+
let actualVowelsSum = runningVowelsSum;
|
|
669
|
+
let actualConsonantsSum = runningConsonantsSum;
|
|
670
|
+
if (currentInfos.length > 1) {
|
|
671
|
+
const lastInfo = currentInfos[currentInfos.length - 1];
|
|
672
|
+
if (lastInfo.endingValue !== void 0) {
|
|
673
|
+
const diff = lastInfo.endingValue - lastInfo.normalValue;
|
|
674
|
+
if (lastInfo.isVowel) {
|
|
675
|
+
actualVowelsSum += diff;
|
|
676
|
+
} else {
|
|
677
|
+
actualConsonantsSum += diff;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
const actualSynthesisSum = actualVowelsSum + actualConsonantsSum;
|
|
682
|
+
const matchesVowels = targetVowels === void 0 || actualVowelsSum === targetVowels;
|
|
683
|
+
const matchesConsonants = targetConsonants === void 0 || actualConsonantsSum === targetConsonants;
|
|
684
|
+
const matchesSynthesis = targetSynthesis === void 0 || actualSynthesisSum === targetSynthesis;
|
|
685
|
+
if (matchesVowels && matchesConsonants && matchesSynthesis) {
|
|
686
|
+
const lettersStr = currentLetters.join("").toUpperCase();
|
|
687
|
+
if (!seenResults.has(lettersStr)) {
|
|
688
|
+
seenResults.add(lettersStr);
|
|
689
|
+
totalFound++;
|
|
690
|
+
if (results.length < maxResults) {
|
|
691
|
+
const letterDetails = currentInfos.map((info, idx) => {
|
|
692
|
+
const isEnding = idx === currentInfos.length - 1 && currentInfos.length > 1;
|
|
693
|
+
const useEndingValue = isEnding && info.endingValue !== void 0;
|
|
694
|
+
return {
|
|
695
|
+
latinLetterId: chunk5AIYNAGI_js.id("latinLetter" /* LATIN_LETTER */, info.letter),
|
|
696
|
+
value: useEndingValue ? info.endingValue : info.normalValue,
|
|
697
|
+
hebrewLetterId: info.hebrewLetterId,
|
|
698
|
+
hebrewCharacter: useEndingValue && info.hebrewCharacterWhenEnding ? info.hebrewCharacterWhenEnding : info.hebrewCharacter,
|
|
699
|
+
isVowel: info.isVowel
|
|
700
|
+
};
|
|
701
|
+
});
|
|
702
|
+
results.push({
|
|
703
|
+
letters: lettersStr,
|
|
704
|
+
letterDetails,
|
|
705
|
+
vowelsSum: actualVowelsSum,
|
|
706
|
+
consonantsSum: actualConsonantsSum,
|
|
707
|
+
synthesisSum: actualSynthesisSum
|
|
708
|
+
});
|
|
709
|
+
} else {
|
|
710
|
+
hasMore = true;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
if (index >= letterOnlyUnits.length || letterOnlyLength >= maxLength) {
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
if (targetVowels !== void 0 && runningVowelsSum > targetVowels) {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
if (targetConsonants !== void 0 && runningConsonantsSum > targetConsonants) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
if (targetSynthesis !== void 0 && runningVowelsSum + runningConsonantsSum > targetSynthesis) {
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
generateSubsequences(
|
|
728
|
+
index + 1,
|
|
729
|
+
currentLetters,
|
|
730
|
+
currentInfos,
|
|
731
|
+
runningVowelsSum,
|
|
732
|
+
runningConsonantsSum,
|
|
733
|
+
letterCounts,
|
|
734
|
+
spacesUsed
|
|
735
|
+
);
|
|
736
|
+
if (results.length >= maxResults) {
|
|
737
|
+
hasMore = true;
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
const letter = letterOnlyUnits[index].unit;
|
|
741
|
+
if (maxLetterRepeat !== void 0) {
|
|
742
|
+
const currentCount = letterCounts.get(letter) || 0;
|
|
743
|
+
if (currentCount >= maxLetterRepeat) {
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
const isStarting = currentInfos.length === 0;
|
|
748
|
+
const letterInfo = getLetterInfoCached(letter, isStarting);
|
|
749
|
+
if (!letterInfo) return;
|
|
750
|
+
const value = letterInfo.normalValue;
|
|
751
|
+
const newVowelsSum = runningVowelsSum + (letterInfo.isVowel ? value : 0);
|
|
752
|
+
const newConsonantsSum = runningConsonantsSum + (letterInfo.isVowel ? 0 : value);
|
|
753
|
+
if (targetVowels !== void 0 && newVowelsSum > targetVowels) {
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
if (targetConsonants !== void 0 && newConsonantsSum > targetConsonants) {
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
if (targetSynthesis !== void 0 && newVowelsSum + newConsonantsSum > targetSynthesis) {
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
currentLetters.push(letter);
|
|
763
|
+
currentInfos.push(letterInfo);
|
|
764
|
+
letterCounts.set(letter, (letterCounts.get(letter) || 0) + 1);
|
|
765
|
+
generateSubsequences(
|
|
766
|
+
index + 1,
|
|
767
|
+
currentLetters,
|
|
768
|
+
currentInfos,
|
|
769
|
+
newVowelsSum,
|
|
770
|
+
newConsonantsSum,
|
|
771
|
+
letterCounts,
|
|
772
|
+
spacesUsed
|
|
773
|
+
);
|
|
774
|
+
currentLetters.pop();
|
|
775
|
+
currentInfos.pop();
|
|
776
|
+
letterCounts.set(letter, letterCounts.get(letter) - 1);
|
|
777
|
+
if (results.length >= maxResults) {
|
|
778
|
+
hasMore = true;
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
if (spacesUsed < maxSpaces && currentLetters.length > 0 && currentLetters[currentLetters.length - 1] !== " ") {
|
|
782
|
+
currentLetters.push(" ");
|
|
783
|
+
currentLetters.push(letter);
|
|
784
|
+
currentInfos.push(letterInfo);
|
|
785
|
+
letterCounts.set(letter, (letterCounts.get(letter) || 0) + 1);
|
|
786
|
+
generateSubsequences(
|
|
787
|
+
index + 1,
|
|
788
|
+
currentLetters,
|
|
789
|
+
currentInfos,
|
|
790
|
+
newVowelsSum,
|
|
791
|
+
newConsonantsSum,
|
|
792
|
+
letterCounts,
|
|
793
|
+
spacesUsed + 1
|
|
794
|
+
);
|
|
795
|
+
currentLetters.pop();
|
|
796
|
+
currentLetters.pop();
|
|
797
|
+
currentInfos.pop();
|
|
798
|
+
letterCounts.set(letter, letterCounts.get(letter) - 1);
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
generateSubsequences(0, [], [], 0, 0, /* @__PURE__ */ new Map(), 0);
|
|
802
|
+
return {
|
|
803
|
+
results,
|
|
804
|
+
hasMore,
|
|
805
|
+
totalFound
|
|
806
|
+
};
|
|
807
|
+
}
|
|
242
808
|
var calculateGematria = (phrase, options = {
|
|
243
809
|
missing: false,
|
|
244
810
|
percentages: false
|
|
@@ -307,5 +873,6 @@ var calculateGematria = (phrase, options = {
|
|
|
307
873
|
|
|
308
874
|
exports.calculateGematria = calculateGematria;
|
|
309
875
|
exports.data_exports = data_exports;
|
|
310
|
-
|
|
311
|
-
//# sourceMappingURL=chunk-
|
|
876
|
+
exports.reverseGematria = reverseGematria;
|
|
877
|
+
//# sourceMappingURL=chunk-JOYHXU24.js.map
|
|
878
|
+
//# sourceMappingURL=chunk-JOYHXU24.js.map
|