kaabalah 6.2.2 → 6.2.3

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.
@@ -987,6 +987,12 @@ function buildDefaultArkannus(cards) {
987
987
  });
988
988
  }
989
989
  var ARKANNUS = buildDefaultArkannus(RAW_ARKANNUS);
990
+ var TAROT_COURT_RANKS = [
991
+ "king",
992
+ "queen",
993
+ "knight",
994
+ "page"
995
+ ];
990
996
  var MAJOR_ARCANA_CARDS = ARKANNUS.filter(
991
997
  (card) => card.type === "major" && majorArcana.includes(card.tarotCardFilename)
992
998
  );
@@ -996,6 +1002,13 @@ function toTarotCardKind(card) {
996
1002
  }
997
1003
  return card.type === "minor" ? "minor" : "court";
998
1004
  }
1005
+ function toTarotCourtRank(card) {
1006
+ if (card.type !== "daat+royalship") {
1007
+ return void 0;
1008
+ }
1009
+ const [rank] = card.tarotCardFilename.split("_");
1010
+ return TAROT_COURT_RANKS.includes(rank) ? rank : void 0;
1011
+ }
999
1012
  function toTarotAssetPathType(card) {
1000
1013
  return card.type;
1001
1014
  }
@@ -1017,6 +1030,180 @@ function toAstrologyCorrespondence(node) {
1017
1030
  label: chunkHAMDOCS5_js.parseId(node.id)
1018
1031
  };
1019
1032
  }
1033
+ function getTarotCorrespondenceTree(treeId = DEFAULT_TAROT_TREE_ID) {
1034
+ return chunkTMN4PYVG_js.getCanonicalTree({
1035
+ system: treeId,
1036
+ parts: ["westernAstrology", "tarot"]
1037
+ });
1038
+ }
1039
+ function getCorrespondenceNodes(tree, sourceId, type, depth = 1, limit) {
1040
+ return tree.getCorrespondences(sourceId, {
1041
+ type,
1042
+ depth,
1043
+ limit
1044
+ }).map(({ node }) => node);
1045
+ }
1046
+ function getFirstCorrespondenceNode(tree, sourceId, type, depth = 1) {
1047
+ return getCorrespondenceNodes(tree, sourceId, type, depth, 1)[0];
1048
+ }
1049
+ function toCorrespondenceNode(node) {
1050
+ if (!node) {
1051
+ return void 0;
1052
+ }
1053
+ return {
1054
+ id: node.id,
1055
+ label: chunkHAMDOCS5_js.parseId(node.id)
1056
+ };
1057
+ }
1058
+ function toUniqueCorrespondenceNodes(nodes) {
1059
+ const seen = /* @__PURE__ */ new Set();
1060
+ return nodes.flatMap((node) => {
1061
+ const key = String(node.id);
1062
+ if (seen.has(key)) {
1063
+ return [];
1064
+ }
1065
+ seen.add(key);
1066
+ return [toCorrespondenceNode(node)];
1067
+ });
1068
+ }
1069
+ function toTarotCorrespondenceProfileBase(card) {
1070
+ return {
1071
+ tarotArkAnnuId: card.tarotArkAnnuId,
1072
+ tarotCardNumber: card.tarotCardNumber,
1073
+ tarotCardName: card.tarotCardName,
1074
+ tarotCardFilename: card.tarotCardFilename,
1075
+ tarotMeaning: card.tarotMeaning,
1076
+ suit: card.suit
1077
+ };
1078
+ }
1079
+ function resolveTarotCardProfileForTree(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
1080
+ if ("tarotCardNumber" in lookup) {
1081
+ return getTarotCardByNumber(lookup.tarotCardNumber, treeId);
1082
+ }
1083
+ return getTarotCardProfile(lookup);
1084
+ }
1085
+ function buildMajorCorrespondenceProfile(card, tree) {
1086
+ const pathNode = getFirstCorrespondenceNode(
1087
+ tree,
1088
+ card.tarotArkAnnuId,
1089
+ "path" /* PATH */
1090
+ );
1091
+ const hebrewLetterNode = pathNode ? getFirstCorrespondenceNode(
1092
+ tree,
1093
+ pathNode.id,
1094
+ "hebrewLetter" /* HEBREW_LETTER */
1095
+ ) : void 0;
1096
+ const pathNumberNode = pathNode ? getFirstCorrespondenceNode(tree, pathNode.id, "number" /* NUMBER */) : void 0;
1097
+ const pathNumber = pathNumberNode ? Number.parseInt(chunkHAMDOCS5_js.parseId(pathNumberNode.id), 10) : Number.NaN;
1098
+ const fromSphereNode = pathNode?.data?.from ? tree.getNode(pathNode.data.from) : void 0;
1099
+ const toSphereNode = pathNode?.data?.to ? tree.getNode(pathNode.data.to) : void 0;
1100
+ if (!pathNode || !hebrewLetterNode || !fromSphereNode || !toSphereNode || !Number.isFinite(pathNumber)) {
1101
+ return void 0;
1102
+ }
1103
+ return {
1104
+ ...toTarotCorrespondenceProfileBase(card),
1105
+ kind: "major",
1106
+ correspondences: {
1107
+ astrology: getCorrespondenceNodes(
1108
+ tree,
1109
+ pathNode.id,
1110
+ [
1111
+ "westernElement" /* WESTERN_ELEMENT */,
1112
+ "planet" /* PLANET */,
1113
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */
1114
+ ]
1115
+ ).map(
1116
+ (node) => toAstrologyCorrespondence(
1117
+ node
1118
+ )
1119
+ ),
1120
+ path: {
1121
+ pathId: pathNode.id,
1122
+ pathNumber,
1123
+ pathSlug: chunkHAMDOCS5_js.parseId(hebrewLetterNode.id).toLowerCase(),
1124
+ meaning: pathNode.data?.meaning,
1125
+ hebrewLetter: toCorrespondenceNode(hebrewLetterNode),
1126
+ fromSphere: toCorrespondenceNode(
1127
+ fromSphereNode
1128
+ ),
1129
+ toSphere: toCorrespondenceNode(
1130
+ toSphereNode
1131
+ )
1132
+ }
1133
+ }
1134
+ };
1135
+ }
1136
+ function buildCourtCorrespondenceProfile(card, tree) {
1137
+ const suitNode = getFirstCorrespondenceNode(
1138
+ tree,
1139
+ card.tarotArkAnnuId,
1140
+ "tarotSuit" /* TAROT_SUIT */
1141
+ );
1142
+ if (!card.courtRank) {
1143
+ return void 0;
1144
+ }
1145
+ if (card.courtRank === "page") {
1146
+ const elementNode = suitNode ? getFirstCorrespondenceNode(
1147
+ tree,
1148
+ suitNode.id,
1149
+ "westernElement" /* WESTERN_ELEMENT */
1150
+ ) : void 0;
1151
+ if (!elementNode) {
1152
+ return void 0;
1153
+ }
1154
+ return {
1155
+ ...toTarotCorrespondenceProfileBase(card),
1156
+ kind: "court",
1157
+ courtRank: "page",
1158
+ correspondences: {
1159
+ element: toCorrespondenceNode(elementNode)
1160
+ }
1161
+ };
1162
+ }
1163
+ const signNode = getFirstCorrespondenceNode(
1164
+ tree,
1165
+ card.tarotArkAnnuId,
1166
+ "westernZodiacSign" /* WESTERN_ZODIAC_SIGN */
1167
+ );
1168
+ if (!signNode) {
1169
+ return void 0;
1170
+ }
1171
+ return {
1172
+ ...toTarotCorrespondenceProfileBase(card),
1173
+ kind: "court",
1174
+ courtRank: card.courtRank,
1175
+ correspondences: {
1176
+ sign: toCorrespondenceNode(signNode),
1177
+ planets: toUniqueCorrespondenceNodes(
1178
+ getCorrespondenceNodes(
1179
+ tree,
1180
+ signNode.id,
1181
+ "planet" /* PLANET */
1182
+ )
1183
+ )
1184
+ }
1185
+ };
1186
+ }
1187
+ function buildMinorCorrespondenceProfile(card, tree) {
1188
+ const sphereNode = getFirstCorrespondenceNode(
1189
+ tree,
1190
+ card.tarotArkAnnuId,
1191
+ "sphere" /* SPHERE */
1192
+ );
1193
+ if (!sphereNode) {
1194
+ return void 0;
1195
+ }
1196
+ return {
1197
+ ...toTarotCorrespondenceProfileBase(card),
1198
+ kind: "minor",
1199
+ correspondences: {
1200
+ sphere: toCorrespondenceNode(sphereNode),
1201
+ planets: toUniqueCorrespondenceNodes(
1202
+ getCorrespondenceNodes(tree, sphereNode.id, "planet" /* PLANET */)
1203
+ )
1204
+ }
1205
+ };
1206
+ }
1020
1207
  function buildDescriptionsByDeck(tarotArkAnnu) {
1021
1208
  const descriptions = {};
1022
1209
  for (const deck of TAROT_DECK_METADATA) {
@@ -1126,6 +1313,7 @@ function getTarotCardProfileCache() {
1126
1313
  kind: toTarotCardKind(card),
1127
1314
  assetPathType: toTarotAssetPathType(card),
1128
1315
  suit: card.suit,
1316
+ courtRank: toTarotCourtRank(card),
1129
1317
  availableDeckIds,
1130
1318
  descriptionsByDeck
1131
1319
  };
@@ -1264,6 +1452,21 @@ function getTarotArchetype(lookup) {
1264
1452
  }
1265
1453
  return cache.byTarotCardNumber.get(lookup.tarotCardNumber);
1266
1454
  }
1455
+ function getTarotCorrespondenceProfile(lookup, treeId = DEFAULT_TAROT_TREE_ID) {
1456
+ const card = resolveTarotCardProfileForTree(lookup, treeId);
1457
+ if (!card) {
1458
+ return void 0;
1459
+ }
1460
+ const tree = getTarotCorrespondenceTree(treeId);
1461
+ switch (card.kind) {
1462
+ case "major":
1463
+ return buildMajorCorrespondenceProfile(card, tree);
1464
+ case "court":
1465
+ return buildCourtCorrespondenceProfile(card, tree);
1466
+ case "minor":
1467
+ return buildMinorCorrespondenceProfile(card, tree);
1468
+ }
1469
+ }
1267
1470
  function getTarotRepresentations(lookup) {
1268
1471
  const card = getTarotCardProfile(lookup);
1269
1472
  if (!card) {
@@ -2369,6 +2572,7 @@ exports.getTarotArchetype = getTarotArchetype;
2369
2572
  exports.getTarotCardByNumber = getTarotCardByNumber;
2370
2573
  exports.getTarotCardNumber = getTarotCardNumber;
2371
2574
  exports.getTarotCardProfile = getTarotCardProfile;
2575
+ exports.getTarotCorrespondenceProfile = getTarotCorrespondenceProfile;
2372
2576
  exports.getTarotRepresentation = getTarotRepresentation;
2373
2577
  exports.getTarotRepresentations = getTarotRepresentations;
2374
2578
  exports.getTarotSpread = getTarotSpread;
@@ -2379,5 +2583,5 @@ exports.majorArcana = majorArcana;
2379
2583
  exports.resolveTarotImageUrl = resolveTarotImageUrl;
2380
2584
  exports.shuffleTarotDeck = shuffleTarotDeck;
2381
2585
  exports.validateTarotSpreadSelection = validateTarotSpreadSelection;
2382
- //# sourceMappingURL=chunk-25YFW677.js.map
2383
- //# sourceMappingURL=chunk-25YFW677.js.map
2586
+ //# sourceMappingURL=chunk-WSSELKIB.js.map
2587
+ //# sourceMappingURL=chunk-WSSELKIB.js.map