added overlay function for tarot cards

This commit is contained in:
2026-03-08 03:52:25 -07:00
parent 84b340d7d1
commit 78abb582dd
17 changed files with 4050 additions and 1175 deletions

View File

@@ -1,611 +1,8 @@
/* ui-quiz-bank-builtins-domains.js — Built-in quiz domain template generation */
/* ui-quiz-bank-builtins-domains.js — Legacy built-in quiz compatibility layer */
(function () {
"use strict";
function appendBuiltInQuestionBankDomains(context) {
const {
bank,
helpers,
englishLetters,
hebrewLetters,
hebrewById,
signs,
planets,
planetsById,
treePaths,
sephirotById,
flattenDecans,
cubeWalls,
cubeEdges,
cubeCenter,
playingCards,
pools
} = context || {};
const {
createQuestionTemplate,
normalizeId,
normalizeOption,
toTitleCase,
formatHebrewLetterLabel,
getPlanetLabelById,
getSephiraName,
formatPathLetter,
formatDecanLabel,
labelFromId
} = helpers || {};
if (!Array.isArray(bank) || typeof createQuestionTemplate !== "function") {
return;
}
const {
englishGematriaPool,
hebrewNumerologyPool,
hebrewNameAndCharPool,
hebrewCharPool,
planetNamePool,
planetWeekdayPool,
zodiacElementPool,
zodiacTarotPool,
pathNumberPool,
pathLetterPool,
pathTarotPool,
sephirotPlanetPool,
decanLabelPool,
decanRulerPool,
cubeLocationPool,
cubeHebrewLetterPool,
playingTarotPool
} = pools || {};
(englishLetters || []).forEach((entry) => {
if (!entry?.letter || !Number.isFinite(Number(entry?.pythagorean))) {
return;
}
const template = createQuestionTemplate(
{
key: `english-gematria:${entry.letter}`,
categoryId: "english-gematria",
category: "English Gematria",
promptByDifficulty: `${entry.letter} has a simple gematria value of`,
answerByDifficulty: String(entry.pythagorean)
},
englishGematriaPool
);
if (template) {
bank.push(template);
}
});
(hebrewLetters || []).forEach((entry) => {
if (!entry?.name || !entry?.char || !Number.isFinite(Number(entry?.numerology))) {
return;
}
const template = createQuestionTemplate(
{
key: `hebrew-number:${entry.hebrewLetterId || entry.name}`,
categoryId: "hebrew-numerology",
category: "Hebrew Gematria",
promptByDifficulty: {
easy: `${entry.name} (${entry.char}) has a gematria value of`,
normal: `${entry.name} (${entry.char}) has a gematria value of`,
hard: `${entry.char} has a gematria value of`
},
answerByDifficulty: String(entry.numerology)
},
hebrewNumerologyPool
);
if (template) {
bank.push(template);
}
});
(englishLetters || []).forEach((entry) => {
if (!entry?.letter || !entry?.hebrewLetterId) {
return;
}
const mappedHebrew = hebrewById.get(normalizeId(entry.hebrewLetterId));
if (!mappedHebrew?.name || !mappedHebrew?.char) {
return;
}
const template = createQuestionTemplate(
{
key: `english-hebrew:${entry.letter}`,
categoryId: "english-hebrew-mapping",
category: "Alphabet Mapping",
promptByDifficulty: {
easy: `${entry.letter} maps to which Hebrew letter`,
normal: `${entry.letter} maps to which Hebrew letter`,
hard: `${entry.letter} maps to which Hebrew glyph`
},
answerByDifficulty: {
easy: `${mappedHebrew.name} (${mappedHebrew.char})`,
normal: `${mappedHebrew.name} (${mappedHebrew.char})`,
hard: mappedHebrew.char
}
},
{
easy: hebrewNameAndCharPool,
normal: hebrewNameAndCharPool,
hard: hebrewCharPool
}
);
if (template) {
bank.push(template);
}
});
(signs || []).forEach((entry) => {
if (!entry?.name || !entry?.rulingPlanetId) {
return;
}
const rulerName = planetsById[normalizeId(entry.rulingPlanetId)]?.name;
if (!rulerName) {
return;
}
const template = createQuestionTemplate(
{
key: `zodiac-ruler:${entry.id || entry.name}`,
categoryId: "zodiac-rulers",
category: "Zodiac Rulers",
promptByDifficulty: `${entry.name} is ruled by`,
answerByDifficulty: rulerName
},
planetNamePool
);
if (template) {
bank.push(template);
}
});
(signs || []).forEach((entry) => {
if (!entry?.name || !entry?.element) {
return;
}
const template = createQuestionTemplate(
{
key: `zodiac-element:${entry.id || entry.name}`,
categoryId: "zodiac-elements",
category: "Zodiac Elements",
promptByDifficulty: `${entry.name} is`,
answerByDifficulty: toTitleCase(entry.element)
},
zodiacElementPool
);
if (template) {
bank.push(template);
}
});
(planets || []).forEach((entry) => {
if (!entry?.name || !entry?.weekday) {
return;
}
const template = createQuestionTemplate(
{
key: `planet-weekday:${entry.id || entry.name}`,
categoryId: "planetary-weekdays",
category: "Planetary Weekdays",
promptByDifficulty: `${entry.name} corresponds to`,
answerByDifficulty: entry.weekday
},
planetWeekdayPool
);
if (template) {
bank.push(template);
}
});
(signs || []).forEach((entry) => {
if (!entry?.name || !entry?.tarot?.majorArcana) {
return;
}
const template = createQuestionTemplate(
{
key: `zodiac-tarot:${entry.id || entry.name}`,
categoryId: "zodiac-tarot",
category: "Zodiac ↔ Tarot",
promptByDifficulty: `${entry.name} corresponds to`,
answerByDifficulty: entry.tarot.majorArcana
},
zodiacTarotPool
);
if (template) {
bank.push(template);
}
});
(treePaths || []).forEach((path) => {
const pathNo = Number(path?.pathNumber);
if (!Number.isFinite(pathNo)) {
return;
}
const pathNumberLabel = String(Math.trunc(pathNo));
const fromNo = Number(path?.connects?.from);
const toNo = Number(path?.connects?.to);
const fromName = getSephiraName(fromNo, path?.connectIds?.from);
const toName = getSephiraName(toNo, path?.connectIds?.to);
const pathLetter = formatPathLetter(path);
const tarotCard = normalizeOption(path?.tarot?.card);
if (fromName && toName) {
const template = createQuestionTemplate(
{
key: `kabbalah-path-between:${pathNumberLabel}`,
categoryId: "kabbalah-path-between-sephirot",
category: "Kabbalah Paths",
promptByDifficulty: {
easy: `Which path is between ${fromName} and ${toName}`,
normal: `What path connects ${fromName} and ${toName}`,
hard: `${fromName}${toName} is which path`
},
answerByDifficulty: pathNumberLabel
},
pathNumberPool
);
if (template) {
bank.push(template);
}
}
if (pathLetter) {
const numberToLetterTemplate = createQuestionTemplate(
{
key: `kabbalah-path-letter:${pathNumberLabel}`,
categoryId: "kabbalah-path-letter",
category: "Kabbalah Paths",
promptByDifficulty: {
easy: `Which letter is on Path ${pathNumberLabel}`,
normal: `Path ${pathNumberLabel} carries which Hebrew letter`,
hard: `Letter on Path ${pathNumberLabel}`
},
answerByDifficulty: pathLetter
},
pathLetterPool
);
if (numberToLetterTemplate) {
bank.push(numberToLetterTemplate);
}
const letterToNumberTemplate = createQuestionTemplate(
{
key: `kabbalah-letter-path-number:${pathNumberLabel}`,
categoryId: "kabbalah-path-letter",
category: "Kabbalah Paths",
promptByDifficulty: {
easy: `${pathLetter} belongs to which path`,
normal: `${pathLetter} corresponds to Path`,
hard: `${pathLetter} is on Path`
},
answerByDifficulty: pathNumberLabel
},
pathNumberPool
);
if (letterToNumberTemplate) {
bank.push(letterToNumberTemplate);
}
}
if (tarotCard) {
const pathToTarotTemplate = createQuestionTemplate(
{
key: `kabbalah-path-tarot:${pathNumberLabel}`,
categoryId: "kabbalah-path-tarot",
category: "Kabbalah ↔ Tarot",
promptByDifficulty: {
easy: `Path ${pathNumberLabel} corresponds to which Tarot trump`,
normal: `Which Tarot trump is on Path ${pathNumberLabel}`,
hard: `Tarot trump on Path ${pathNumberLabel}`
},
answerByDifficulty: tarotCard
},
pathTarotPool
);
if (pathToTarotTemplate) {
bank.push(pathToTarotTemplate);
}
const tarotToPathTemplate = createQuestionTemplate(
{
key: `tarot-trump-path:${pathNumberLabel}`,
categoryId: "kabbalah-path-tarot",
category: "Tarot ↔ Kabbalah",
promptByDifficulty: {
easy: `${tarotCard} is on which path`,
normal: `Which path corresponds to ${tarotCard}`,
hard: `${tarotCard} corresponds to Path`
},
answerByDifficulty: pathNumberLabel
},
pathNumberPool
);
if (tarotToPathTemplate) {
bank.push(tarotToPathTemplate);
}
}
});
Object.values(sephirotById || {}).forEach((sephira) => {
const sephiraName = String(sephira?.name?.roman || sephira?.name?.en || "").trim();
const planetLabel = getPlanetLabelById(sephira?.planetId);
if (!sephiraName || !planetLabel) {
return;
}
const template = createQuestionTemplate(
{
key: `sephirot-planet:${normalizeId(sephira?.id || sephiraName)}`,
categoryId: "sephirot-planets",
category: "Sephirot ↔ Planet",
promptByDifficulty: {
easy: `${sephiraName} corresponds to which planet`,
normal: `Planetary correspondence of ${sephiraName}`,
hard: `${sephiraName} corresponds to`
},
answerByDifficulty: planetLabel
},
sephirotPlanetPool
);
if (template) {
bank.push(template);
}
});
(flattenDecans || []).forEach((decan) => {
const decanId = String(decan?.id || "").trim();
const card = normalizeOption(decan?.tarotMinorArcana);
const decanLabel = formatDecanLabel(decan);
const rulerLabel = getPlanetLabelById(decan?.rulerPlanetId);
if (!decanId || !card) {
return;
}
if (decanLabel) {
const template = createQuestionTemplate(
{
key: `tarot-decan-sign:${decanId}`,
categoryId: "tarot-decan-sign",
category: "Tarot Decans",
promptByDifficulty: {
easy: `${card} belongs to which decan`,
normal: `Which decan contains ${card}`,
hard: `${card} is in`
},
answerByDifficulty: decanLabel
},
decanLabelPool
);
if (template) {
bank.push(template);
}
}
if (rulerLabel) {
const template = createQuestionTemplate(
{
key: `tarot-decan-ruler:${decanId}`,
categoryId: "tarot-decan-ruler",
category: "Tarot Decans",
promptByDifficulty: {
easy: `The decan of ${card} is ruled by`,
normal: `Who rules the decan for ${card}`,
hard: `${card} decan ruler`
},
answerByDifficulty: rulerLabel
},
decanRulerPool
);
if (template) {
bank.push(template);
}
}
});
(cubeWalls || []).forEach((wall) => {
const wallName = String(wall?.name || labelFromId(wall?.id)).trim();
const wallLabel = wallName ? `${wallName} Wall` : "";
const tarotCard = normalizeOption(wall?.associations?.tarotCard);
const hebrew = hebrewById.get(normalizeId(wall?.hebrewLetterId));
const hebrewLabel = formatHebrewLetterLabel(hebrew, wall?.hebrewLetterId);
if (tarotCard && wallLabel) {
const template = createQuestionTemplate(
{
key: `tarot-cube-wall:${normalizeId(wall?.id || wallName)}`,
categoryId: "tarot-cube-location",
category: "Tarot ↔ Cube",
promptByDifficulty: {
easy: `${tarotCard} is on which Cube wall`,
normal: `Where is ${tarotCard} on the Cube`,
hard: `${tarotCard} location on Cube`
},
answerByDifficulty: wallLabel
},
cubeLocationPool
);
if (template) {
bank.push(template);
}
}
if (wallLabel && hebrewLabel) {
const template = createQuestionTemplate(
{
key: `cube-wall-letter:${normalizeId(wall?.id || wallName)}`,
categoryId: "cube-hebrew-letter",
category: "Cube ↔ Hebrew",
promptByDifficulty: {
easy: `${wallLabel} corresponds to which Hebrew letter`,
normal: `Which Hebrew letter is on ${wallLabel}`,
hard: `${wallLabel} letter`
},
answerByDifficulty: hebrewLabel
},
cubeHebrewLetterPool
);
if (template) {
bank.push(template);
}
}
});
(cubeEdges || []).forEach((edge) => {
const edgeName = String(edge?.name || labelFromId(edge?.id)).trim();
const edgeLabel = edgeName ? `${edgeName} Edge` : "";
const hebrew = hebrewById.get(normalizeId(edge?.hebrewLetterId));
const hebrewLabel = formatHebrewLetterLabel(hebrew, edge?.hebrewLetterId);
const tarotCard = normalizeOption(hebrew?.tarot?.card);
if (tarotCard && edgeLabel) {
const template = createQuestionTemplate(
{
key: `tarot-cube-edge:${normalizeId(edge?.id || edgeName)}`,
categoryId: "tarot-cube-location",
category: "Tarot ↔ Cube",
promptByDifficulty: {
easy: `${tarotCard} is on which Cube edge`,
normal: `Where is ${tarotCard} on the Cube edges`,
hard: `${tarotCard} edge location`
},
answerByDifficulty: edgeLabel
},
cubeLocationPool
);
if (template) {
bank.push(template);
}
}
if (edgeLabel && hebrewLabel) {
const template = createQuestionTemplate(
{
key: `cube-edge-letter:${normalizeId(edge?.id || edgeName)}`,
categoryId: "cube-hebrew-letter",
category: "Cube ↔ Hebrew",
promptByDifficulty: {
easy: `${edgeLabel} corresponds to which Hebrew letter`,
normal: `Which Hebrew letter is on ${edgeLabel}`,
hard: `${edgeLabel} letter`
},
answerByDifficulty: hebrewLabel
},
cubeHebrewLetterPool
);
if (template) {
bank.push(template);
}
}
});
if (cubeCenter) {
const centerTarot = normalizeOption(cubeCenter?.associations?.tarotCard || cubeCenter?.tarotCard);
const centerHebrew = hebrewById.get(normalizeId(cubeCenter?.hebrewLetterId));
const centerHebrewLabel = formatHebrewLetterLabel(centerHebrew, cubeCenter?.hebrewLetterId);
if (centerTarot) {
const template = createQuestionTemplate(
{
key: "tarot-cube-center",
categoryId: "tarot-cube-location",
category: "Tarot ↔ Cube",
promptByDifficulty: {
easy: `${centerTarot} is located at which Cube position`,
normal: `Where is ${centerTarot} on the Cube`,
hard: `${centerTarot} Cube location`
},
answerByDifficulty: "Center"
},
cubeLocationPool
);
if (template) {
bank.push(template);
}
}
if (centerHebrewLabel) {
const template = createQuestionTemplate(
{
key: "cube-center-letter",
categoryId: "cube-hebrew-letter",
category: "Cube ↔ Hebrew",
promptByDifficulty: {
easy: "The Cube center corresponds to which Hebrew letter",
normal: "Which Hebrew letter is at the Cube center",
hard: "Cube center letter"
},
answerByDifficulty: centerHebrewLabel
},
cubeHebrewLetterPool
);
if (template) {
bank.push(template);
}
}
}
(playingCards || []).forEach((entry) => {
const cardId = String(entry?.id || "").trim();
const rankLabel = normalizeOption(entry?.rankLabel || entry?.rank);
const suitLabel = normalizeOption(entry?.suitLabel || labelFromId(entry?.suit));
const tarotCard = normalizeOption(entry?.tarotCard);
if (!cardId || !rankLabel || !suitLabel || !tarotCard) {
return;
}
const template = createQuestionTemplate(
{
key: `playing-card-tarot:${cardId}`,
categoryId: "playing-card-tarot",
category: "Playing Card ↔ Tarot",
promptByDifficulty: {
easy: `${rankLabel} of ${suitLabel} maps to which Tarot card`,
normal: `${rankLabel} of ${suitLabel} corresponds to`,
hard: `${rankLabel} of ${suitLabel} maps to`
},
answerByDifficulty: tarotCard
},
playingTarotPool
);
if (template) {
bank.push(template);
}
});
}
function appendBuiltInQuestionBankDomains() {}
window.QuizQuestionBankBuiltInDomains = {
appendBuiltInQuestionBankDomains