kaabalah 6.2.4 → 6.4.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.
Files changed (62) hide show
  1. package/README.md +71 -0
  2. package/dist/{chunk-S4EJ3ZY7.mjs → chunk-6P2CJUTH.mjs} +3 -3
  3. package/dist/{chunk-S4EJ3ZY7.mjs.map → chunk-6P2CJUTH.mjs.map} +1 -1
  4. package/dist/chunk-7WG6PUEN.js +1741 -0
  5. package/dist/chunk-7WG6PUEN.js.map +1 -0
  6. package/dist/{chunk-O3ZBG566.js → chunk-COPYH3O2.js} +23 -23
  7. package/dist/{chunk-O3ZBG566.js.map → chunk-COPYH3O2.js.map} +1 -1
  8. package/dist/{chunk-RZBVUDBM.mjs → chunk-EFZUZI22.mjs} +81 -73
  9. package/dist/chunk-EFZUZI22.mjs.map +1 -0
  10. package/dist/chunk-EMMXVM35.mjs +511 -0
  11. package/dist/chunk-EMMXVM35.mjs.map +1 -0
  12. package/dist/{chunk-2RGUI5FG.mjs → chunk-MTI2SOQ6.mjs} +4 -4
  13. package/dist/{chunk-2RGUI5FG.mjs.map → chunk-MTI2SOQ6.mjs.map} +1 -1
  14. package/dist/{chunk-TMN4PYVG.js → chunk-OKZUVGA3.js} +9 -9
  15. package/dist/{chunk-TMN4PYVG.js.map → chunk-OKZUVGA3.js.map} +1 -1
  16. package/dist/{chunk-Y4PTMABP.js → chunk-PAKYKIZH.js} +4 -4
  17. package/dist/{chunk-Y4PTMABP.js.map → chunk-PAKYKIZH.js.map} +1 -1
  18. package/dist/chunk-PBPYXWX4.mjs +1721 -0
  19. package/dist/chunk-PBPYXWX4.mjs.map +1 -0
  20. package/dist/{chunk-HAMDOCS5.js → chunk-S6KNERP7.js} +81 -73
  21. package/dist/chunk-S6KNERP7.js.map +1 -0
  22. package/dist/chunk-WGYXJEG5.js +518 -0
  23. package/dist/chunk-WGYXJEG5.js.map +1 -0
  24. package/dist/{chunk-G76K6OVQ.mjs → chunk-WIKUOEOB.mjs} +3 -3
  25. package/dist/{chunk-G76K6OVQ.mjs.map → chunk-WIKUOEOB.mjs.map} +1 -1
  26. package/dist/{chunk-WSSELKIB.js → chunk-XTE5DSDO.js} +23 -23
  27. package/dist/{chunk-WSSELKIB.js.map → chunk-XTE5DSDO.js.map} +1 -1
  28. package/dist/{chunk-NBP75BAH.mjs → chunk-ZKIJAZ6B.mjs} +3 -3
  29. package/dist/{chunk-NBP75BAH.mjs.map → chunk-ZKIJAZ6B.mjs.map} +1 -1
  30. package/dist/cli.js +954 -104
  31. package/dist/cli.js.map +1 -1
  32. package/dist/core/index.js +43 -43
  33. package/dist/core/index.mjs +2 -2
  34. package/dist/gematria/index.js +5 -5
  35. package/dist/gematria/index.mjs +2 -2
  36. package/dist/index.d.mts +2 -1
  37. package/dist/index.d.ts +2 -1
  38. package/dist/index.js +191 -114
  39. package/dist/index.mjs +8 -7
  40. package/dist/numerology/index.js +18 -18
  41. package/dist/numerology/index.mjs +3 -3
  42. package/dist/semantic/index.d.mts +150 -2
  43. package/dist/semantic/index.d.ts +150 -2
  44. package/dist/semantic/index.js +65 -10
  45. package/dist/semantic/index.mjs +7 -4
  46. package/dist/tarot/index.js +23 -23
  47. package/dist/tarot/index.mjs +3 -3
  48. package/dist/visual/index.d.mts +64 -0
  49. package/dist/visual/index.d.ts +64 -0
  50. package/dist/visual/index.js +35 -0
  51. package/dist/visual/index.js.map +1 -0
  52. package/dist/visual/index.mjs +6 -0
  53. package/dist/visual/index.mjs.map +1 -0
  54. package/dist/webassembly.md +127 -0
  55. package/package.json +6 -1
  56. package/wasm/build/webassembly.md +127 -0
  57. package/dist/chunk-3KJSW6ZP.js +0 -850
  58. package/dist/chunk-3KJSW6ZP.js.map +0 -1
  59. package/dist/chunk-HAMDOCS5.js.map +0 -1
  60. package/dist/chunk-RWX6HFS5.mjs +0 -843
  61. package/dist/chunk-RWX6HFS5.mjs.map +0 -1
  62. package/dist/chunk-RZBVUDBM.mjs.map +0 -1
@@ -0,0 +1,511 @@
1
+ import { id, createTree } from './chunk-EFZUZI22.mjs';
2
+
3
+ // src/visual/tree-svg.ts
4
+ var TREE_SVG_DEFAULT_VIEWBOX = {
5
+ minX: 0,
6
+ minY: 0,
7
+ width: 286,
8
+ height: 561
9
+ };
10
+ var TREE_SPHERE_NAMES = [
11
+ "Kether",
12
+ "Chokhmah",
13
+ "Binah",
14
+ "Daath",
15
+ "Chesed",
16
+ "Geburah",
17
+ "Tiphareth",
18
+ "Netzach",
19
+ "Hod",
20
+ "Yesod",
21
+ "Malkuth"
22
+ ];
23
+ var TREE_PATH_NUMBERS = Array.from({ length: 22 }, (_, index) => index + 1);
24
+ var CANONICAL_X_PERCENTAGES = { left: 13.25, mid: 49.94, right: 86.66 };
25
+ var CANONICAL_ROW_Y_PERCENTAGES = [
26
+ 6.83,
27
+ 17.68,
28
+ 28.42,
29
+ 39.26,
30
+ 50.06,
31
+ 60.85,
32
+ 71.68,
33
+ 93.2
34
+ ];
35
+ var DEFAULT_SPHERE_RADIUS = 30;
36
+ var DEFAULT_PATH_EDGE_WIDTH = 26;
37
+ var DEFAULT_PATH_MAIN_WIDTH = 22;
38
+ var DEFAULT_PATH_HIGHLIGHT_WIDTH = 8;
39
+ var sphereId = (name) => id("sphere" /* SPHERE */, name);
40
+ var pathId = (pathNumber) => id("path" /* PATH */, String(pathNumber));
41
+ var TREE_SPHERE_IDS = TREE_SPHERE_NAMES.map(
42
+ (name) => sphereId(name)
43
+ );
44
+ var TREE_PATH_IDS = TREE_PATH_NUMBERS.map(
45
+ (pathNumber) => pathId(pathNumber)
46
+ );
47
+ var CANONICAL_SPHERE_PERCENTAGES = {
48
+ [sphereId("Kether")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[0] },
49
+ [sphereId("Chokhmah")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[1] },
50
+ [sphereId("Binah")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[1] },
51
+ [sphereId("Daath")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[2] },
52
+ [sphereId("Chesed")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[3] },
53
+ [sphereId("Geburah")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[3] },
54
+ [sphereId("Tiphareth")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[4] },
55
+ [sphereId("Netzach")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[5] },
56
+ [sphereId("Hod")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[5] },
57
+ [sphereId("Yesod")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[6] },
58
+ [sphereId("Malkuth")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[7] }
59
+ };
60
+ function getTreeLayout(system = "kaabalah") {
61
+ const tree = createTree({ system });
62
+ const percentages = buildLayoutMap(tree, CANONICAL_SPHERE_PERCENTAGES);
63
+ const viewBoxUnits = buildLayoutMap(
64
+ tree,
65
+ scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, TREE_SVG_DEFAULT_VIEWBOX)
66
+ );
67
+ return {
68
+ system,
69
+ viewBox: { ...TREE_SVG_DEFAULT_VIEWBOX },
70
+ sphereOrder: [...TREE_SPHERE_IDS],
71
+ pathOrder: [...TREE_PATH_IDS],
72
+ percentages,
73
+ viewBoxUnits
74
+ };
75
+ }
76
+ function generateTreeSvg(options = {}) {
77
+ const system = options.system ?? "kaabalah";
78
+ const daathLayer = options.daathLayer ?? "front";
79
+ const tree = createTree({ system, parts: ["colors"] });
80
+ const viewBox = normalizeViewBox(options.viewBox);
81
+ const palette = resolvePalette(options.palette);
82
+ const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
83
+ const layout = buildLayoutMap(tree, spherePositions);
84
+ const scale = Math.min(
85
+ viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
86
+ viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
87
+ );
88
+ const radius = round(DEFAULT_SPHERE_RADIUS * scale);
89
+ const pathEdgeWidth = round(DEFAULT_PATH_EDGE_WIDTH * scale);
90
+ const pathMainWidth = round(DEFAULT_PATH_MAIN_WIDTH * scale);
91
+ const pathHighlightWidth = round(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
92
+ const sphereStrokeWidth = palette.sphereStrokeWidth ? round(palette.sphereStrokeWidth * scale) : void 0;
93
+ const lines = [];
94
+ const push = (line) => lines.push(line);
95
+ const svgAttributes = [
96
+ `xmlns="http://www.w3.org/2000/svg"`,
97
+ options.width !== void 0 ? `width="${escapeAttr(String(options.width))}"` : "",
98
+ options.height !== void 0 ? `height="${escapeAttr(String(options.height))}"` : "",
99
+ `viewBox="${viewBox.minX} ${viewBox.minY} ${viewBox.width} ${viewBox.height}"`,
100
+ `preserveAspectRatio="xMidYMid meet"`
101
+ ].filter(Boolean);
102
+ push(`<svg ${svgAttributes.join(" ")}>`);
103
+ push(`<defs>`);
104
+ push(`<filter id="pathDarken">
105
+ <feComponentTransfer>
106
+ <feFuncR type="linear" slope="0.65"/>
107
+ <feFuncG type="linear" slope="0.65"/>
108
+ <feFuncB type="linear" slope="0.65"/>
109
+ </feComponentTransfer>
110
+ </filter>`);
111
+ for (const sphereName of TREE_SPHERE_NAMES) {
112
+ const currentSphereId = sphereId(sphereName);
113
+ const slug = sphereName.toLowerCase();
114
+ const point = spherePositions[currentSphereId];
115
+ if (!point) {
116
+ continue;
117
+ }
118
+ push(`<radialGradient id="spec-${slug}" cx="30%" cy="25%" r="55%" fx="30%" fy="25%">
119
+ <stop offset="0%" stop-color="white" stop-opacity="0.95"/>
120
+ <stop offset="25%" stop-color="white" stop-opacity="0.45"/>
121
+ <stop offset="50%" stop-color="white" stop-opacity="0.08"/>
122
+ <stop offset="100%" stop-color="white" stop-opacity="0"/>
123
+ </radialGradient>`);
124
+ push(`<radialGradient id="shad-${slug}" cx="78%" cy="80%" r="55%" fx="78%" fy="80%">
125
+ <stop offset="0%" stop-color="black" stop-opacity="0.32"/>
126
+ <stop offset="40%" stop-color="black" stop-opacity="0.12"/>
127
+ <stop offset="100%" stop-color="black" stop-opacity="0"/>
128
+ </radialGradient>`);
129
+ push(
130
+ `<clipPath id="clip-${slug}"><circle cx="${point.x}" cy="${point.y}" r="${radius}"/></clipPath>`
131
+ );
132
+ }
133
+ push(`<radialGradient id="kether-glow" cx="50%" cy="50%" r="50%">
134
+ <stop offset="0%" stop-color="white" stop-opacity="0.95"/>
135
+ <stop offset="45%" stop-color="white" stop-opacity="0.6"/>
136
+ <stop offset="80%" stop-color="white" stop-opacity="0.15"/>
137
+ <stop offset="100%" stop-color="white" stop-opacity="0"/>
138
+ </radialGradient>`);
139
+ push(`<linearGradient id="kether-facet" x1="0" y1="0" x2="0" y2="1">
140
+ <stop offset="0%" stop-color="white" stop-opacity="0.9"/>
141
+ <stop offset="50%" stop-color="white" stop-opacity="0.5"/>
142
+ <stop offset="100%" stop-color="white" stop-opacity="0.1"/>
143
+ </linearGradient>`);
144
+ push(`<radialGradient id="kether-rim" cx="50%" cy="50%" r="75%">
145
+ <stop offset="60%" stop-color="black" stop-opacity="0"/>
146
+ <stop offset="100%" stop-color="black" stop-opacity="0.18"/>
147
+ </radialGradient>`);
148
+ push(`</defs>`);
149
+ const background = options.background ?? "white";
150
+ if (background !== "transparent") {
151
+ push(
152
+ `<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${escapeAttr(background)}"/>`
153
+ );
154
+ }
155
+ if (daathLayer === "back") {
156
+ push(`<g id="spheres-behind-paths">`);
157
+ renderSphere(push, {
158
+ tree,
159
+ palette,
160
+ radius,
161
+ sphereStrokeWidth,
162
+ spherePositions,
163
+ sphereName: "Daath"
164
+ });
165
+ push(`</g>`);
166
+ }
167
+ push(`<g id="paths">`);
168
+ for (const currentPathId of TREE_PATH_IDS) {
169
+ const path = layout.paths[currentPathId];
170
+ const color = resolvePathColor({
171
+ palette,
172
+ tree,
173
+ pathId: currentPathId
174
+ });
175
+ push(
176
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr(palette.pathEdgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : ""}/>`
177
+ );
178
+ push(
179
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr(color)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
180
+ );
181
+ push(
182
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr(palette.pathHighlightColor)}" stroke-opacity="${palette.pathHighlightOpacity}" stroke-width="${pathHighlightWidth}" stroke-linecap="round"/>`
183
+ );
184
+ }
185
+ push(`</g>`);
186
+ const frontSphereNames = daathLayer === "back" ? TREE_SPHERE_NAMES.filter((name) => name !== "Daath") : TREE_SPHERE_NAMES;
187
+ push(`<g id="spheres">`);
188
+ for (const sphereName of frontSphereNames) {
189
+ renderSphere(push, {
190
+ tree,
191
+ palette,
192
+ radius,
193
+ sphereStrokeWidth,
194
+ spherePositions,
195
+ sphereName
196
+ });
197
+ }
198
+ push(`</g>`);
199
+ if (daathLayer === "back") {
200
+ const daathPoint = spherePositions[sphereId("Daath")];
201
+ push(
202
+ `<circle id="sphere-daath-hit-area" data-node-id="sphere:Daath" cx="${daathPoint.x}" cy="${daathPoint.y}" r="${radius}" fill="transparent" pointer-events="all"/>`
203
+ );
204
+ }
205
+ push(`</svg>`);
206
+ return lines.join("\n");
207
+ }
208
+ function renderSphere(push, params) {
209
+ const currentSphereId = sphereId(params.sphereName);
210
+ const point = params.spherePositions[currentSphereId];
211
+ const slug = params.sphereName.toLowerCase();
212
+ const colorData = params.tree.relatedFirst(currentSphereId, "color" /* COLOR */)?.data?.colorHexCodes ?? [];
213
+ const sphereFill = resolveSphereFill({
214
+ palette: params.palette,
215
+ sphereId: currentSphereId,
216
+ defaultColors: colorData
217
+ });
218
+ push(`<g id="sphere-${slug}" clip-path="url(#clip-${slug})">`);
219
+ if (params.palette.specialSphereMode === "preserve") {
220
+ if (params.sphereName === "Kether") {
221
+ renderKether(push, point, params.radius);
222
+ } else if (params.sphereName === "Chokhmah") {
223
+ renderIridescent(push, point, params.radius);
224
+ } else if (params.sphereName === "Daath") {
225
+ renderYinYang(push, point, params.radius);
226
+ } else if (params.sphereName === "Malkuth" && colorData.length >= 4) {
227
+ const slicedColors = Array.isArray(sphereFill) ? sphereFill : colorData.slice(0, 4);
228
+ renderSlicedSphere(push, point, params.radius, slicedColors, -135);
229
+ } else {
230
+ push(
231
+ `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr(toPrimaryFill(sphereFill, params.palette.defaultSphereFill))}"/>`
232
+ );
233
+ }
234
+ } else {
235
+ push(
236
+ `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr(toPrimaryFill(sphereFill, params.palette.defaultSphereFill))}"/>`
237
+ );
238
+ }
239
+ push(
240
+ `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="url(#spec-${slug})"/>`
241
+ );
242
+ if (params.palette.specialSphereMode !== "preserve" || params.sphereName !== "Kether" && params.sphereName !== "Chokhmah") {
243
+ push(
244
+ `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="url(#shad-${slug})"/>`
245
+ );
246
+ }
247
+ push(`</g>`);
248
+ if (params.palette.sphereStrokeColor && params.sphereStrokeWidth) {
249
+ push(
250
+ `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
251
+ );
252
+ }
253
+ }
254
+ function buildLayoutMap(tree, spherePositions) {
255
+ const paths = {};
256
+ for (const currentPathId of TREE_PATH_IDS) {
257
+ const path = tree.getNode(currentPathId);
258
+ const fromId = path?.data?.from;
259
+ const toId = path?.data?.to;
260
+ if (!fromId || !toId) {
261
+ throw new Error(`Tree path ${currentPathId} is missing endpoints.`);
262
+ }
263
+ const from = spherePositions[fromId];
264
+ const to = spherePositions[toId];
265
+ if (!from || !to) {
266
+ throw new Error(
267
+ `Tree path ${currentPathId} references unknown layout spheres: ${fromId}, ${toId}.`
268
+ );
269
+ }
270
+ paths[currentPathId] = {
271
+ fromId,
272
+ toId,
273
+ from: { ...from },
274
+ to: { ...to }
275
+ };
276
+ }
277
+ return {
278
+ spheres: cloneCoordinateMap(spherePositions),
279
+ paths
280
+ };
281
+ }
282
+ function cloneCoordinateMap(coordinates) {
283
+ const clone = {};
284
+ for (const currentSphereId of TREE_SPHERE_IDS) {
285
+ const point = coordinates[currentSphereId];
286
+ clone[currentSphereId] = { ...point };
287
+ }
288
+ return clone;
289
+ }
290
+ function scaleCoordinates(coordinates, viewBox) {
291
+ const scaled = {};
292
+ for (const currentSphereId of TREE_SPHERE_IDS) {
293
+ const point = coordinates[currentSphereId];
294
+ scaled[currentSphereId] = {
295
+ x: round(viewBox.minX + point.x / 100 * viewBox.width),
296
+ y: round(viewBox.minY + point.y / 100 * viewBox.height)
297
+ };
298
+ }
299
+ return scaled;
300
+ }
301
+ function normalizeViewBox(viewBox) {
302
+ return {
303
+ minX: viewBox?.minX ?? TREE_SVG_DEFAULT_VIEWBOX.minX,
304
+ minY: viewBox?.minY ?? TREE_SVG_DEFAULT_VIEWBOX.minY,
305
+ width: viewBox?.width ?? TREE_SVG_DEFAULT_VIEWBOX.width,
306
+ height: viewBox?.height ?? TREE_SVG_DEFAULT_VIEWBOX.height
307
+ };
308
+ }
309
+ function resolvePalette(palette) {
310
+ if (palette === void 0 || palette === "color") {
311
+ return {
312
+ mode: "color",
313
+ defaultSphereFill: "#888888",
314
+ defaultPathColor: "#888888",
315
+ sphereFills: {},
316
+ pathColors: {},
317
+ pathEdgeColor: "#888888",
318
+ pathEdgeUseFilter: true,
319
+ pathHighlightColor: "white",
320
+ pathHighlightOpacity: 0.25,
321
+ specialSphereMode: "preserve"
322
+ };
323
+ }
324
+ if (palette === "monochrome") {
325
+ return {
326
+ mode: "monochrome",
327
+ defaultSphereFill: "#e6ddd0",
328
+ defaultPathColor: "#e0d7ca",
329
+ sphereFills: {},
330
+ pathColors: {},
331
+ pathEdgeColor: "#2f271e",
332
+ pathEdgeUseFilter: false,
333
+ sphereStrokeColor: "#2f271e",
334
+ sphereStrokeWidth: 2.4,
335
+ pathHighlightColor: "white",
336
+ pathHighlightOpacity: 0.2,
337
+ specialSphereMode: "plain"
338
+ };
339
+ }
340
+ return {
341
+ mode: "custom",
342
+ defaultSphereFill: palette.defaultSphereFill ?? "#111111",
343
+ defaultPathColor: palette.defaultPathColor ?? "#111111",
344
+ sphereFills: palette.sphereFills ?? {},
345
+ pathColors: palette.pathColors ?? {},
346
+ pathEdgeColor: palette.pathEdgeColor ?? (palette.defaultPathColor ?? "#111111"),
347
+ pathEdgeUseFilter: false,
348
+ sphereStrokeColor: palette.sphereStrokeColor,
349
+ sphereStrokeWidth: palette.sphereStrokeWidth,
350
+ pathHighlightColor: palette.pathHighlightColor ?? "white",
351
+ pathHighlightOpacity: palette.pathHighlightOpacity ?? 0.18,
352
+ specialSphereMode: palette.specialSphereMode ?? "plain"
353
+ };
354
+ }
355
+ function resolvePathColor(params) {
356
+ const override = params.palette.pathColors[params.pathId];
357
+ if (override) {
358
+ return override;
359
+ }
360
+ if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
361
+ return params.palette.defaultPathColor;
362
+ }
363
+ const treeColor = params.tree.relatedFirst(params.pathId, "color" /* COLOR */)?.data?.colorHexCodes?.[0];
364
+ return treeColor ?? params.palette.defaultPathColor;
365
+ }
366
+ function resolveSphereFill(params) {
367
+ const override = params.palette.sphereFills[params.sphereId];
368
+ if (override) {
369
+ return override;
370
+ }
371
+ if (params.palette.mode === "monochrome" || params.palette.mode === "custom") {
372
+ return params.palette.defaultSphereFill;
373
+ }
374
+ if (params.defaultColors.length > 0) {
375
+ return params.defaultColors;
376
+ }
377
+ return params.palette.defaultSphereFill;
378
+ }
379
+ function toPrimaryFill(fill, fallback) {
380
+ if (Array.isArray(fill)) {
381
+ return fill[0] ?? fallback;
382
+ }
383
+ return fill;
384
+ }
385
+ function round(value) {
386
+ return Math.round(value * 100) / 100;
387
+ }
388
+ function polarToCartesian(cx, cy, radius, degrees) {
389
+ const radians = Math.PI / 180 * degrees;
390
+ return {
391
+ x: round(cx + radius * Math.cos(radians)),
392
+ y: round(cy + radius * Math.sin(radians))
393
+ };
394
+ }
395
+ function arcPath(cx, cy, radius, startDegrees, endDegrees) {
396
+ const start = polarToCartesian(cx, cy, radius, startDegrees);
397
+ const end = polarToCartesian(cx, cy, radius, endDegrees);
398
+ const largeArc = endDegrees - startDegrees <= 180 ? 0 : 1;
399
+ return `M ${cx} ${cy} L ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} 1 ${end.x} ${end.y} Z`;
400
+ }
401
+ function renderKether(push, point, radius) {
402
+ push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="#e0e0e0"/>`);
403
+ push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-glow)"/>`);
404
+ const spokes = 16;
405
+ const innerRadius = round(radius * 0.18);
406
+ const outerRadius = round(radius * 0.92);
407
+ const innerWidth = round(radius * 0.04);
408
+ const angleStep = 360 / spokes;
409
+ push(`<g opacity="0.85">`);
410
+ for (let index = 0; index < spokes; index++) {
411
+ const angle = index * angleStep;
412
+ push(`<g transform="rotate(${angle} ${point.x} ${point.y})">`);
413
+ const x0 = round(point.x - innerWidth);
414
+ const y0 = round(point.y - innerRadius);
415
+ const x1 = point.x;
416
+ const y1 = round(point.y - outerRadius);
417
+ const x2 = round(point.x + innerWidth);
418
+ const y2 = round(point.y - innerRadius);
419
+ push(
420
+ `<polygon points="${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}" fill="url(#kether-facet)"/>`
421
+ );
422
+ push(`</g>`);
423
+ }
424
+ push(`</g>`);
425
+ push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-rim)"/>`);
426
+ }
427
+ function renderSlicedSphere(push, point, radius, colors, startAngle) {
428
+ const segmentCount = colors.length;
429
+ const step = 360 / segmentCount;
430
+ let currentAngle = startAngle;
431
+ for (let index = 0; index < segmentCount; index++) {
432
+ const path = arcPath(point.x, point.y, radius * 0.96, currentAngle, currentAngle + step);
433
+ push(`<path d="${path}" fill="${escapeAttr(colors[index])}" stroke="none"/>`);
434
+ currentAngle += step;
435
+ }
436
+ }
437
+ function renderIridescent(push, point, radius) {
438
+ const stops = [
439
+ [0, "#F0E8EE"],
440
+ [0.1, "#ffa3e6"],
441
+ [0.22, "#a7e0ff"],
442
+ [0.34, "#baff9a"],
443
+ [0.46, "#ffe28a"],
444
+ [0.58, "#c6a4ff"],
445
+ [0.7, "#9ad6ff"],
446
+ [0.82, "#ffa3e6"],
447
+ [1, "#F0E8EE"]
448
+ ];
449
+ const slices = 72;
450
+ const sphereRadius = round(radius * 0.96);
451
+ for (let index = 0; index < slices; index++) {
452
+ const t = index / slices;
453
+ const color = interpolateColorStops(stops, t);
454
+ const startDegrees = t * 360 - 90;
455
+ const endDegrees = startDegrees + 360 / slices + 0.5;
456
+ const path = arcPath(point.x, point.y, sphereRadius, startDegrees, endDegrees);
457
+ push(`<path d="${path}" fill="${color}" stroke="none"/>`);
458
+ }
459
+ }
460
+ function interpolateColorStops(stops, t) {
461
+ let lower = stops[0];
462
+ let upper = stops[stops.length - 1];
463
+ for (let index = 0; index < stops.length - 1; index++) {
464
+ if (t >= stops[index][0] && t <= stops[index + 1][0]) {
465
+ lower = stops[index];
466
+ upper = stops[index + 1];
467
+ break;
468
+ }
469
+ }
470
+ const range = upper[0] - lower[0] || 1;
471
+ return interpolateColor(lower[1], upper[1], (t - lower[0]) / range);
472
+ }
473
+ function interpolateColor(start, end, factor) {
474
+ const parse = (hex) => {
475
+ const match = hex.match(/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
476
+ return match ? [
477
+ Number.parseInt(match[1], 16),
478
+ Number.parseInt(match[2], 16),
479
+ Number.parseInt(match[3], 16)
480
+ ] : [0, 0, 0];
481
+ };
482
+ const [r1, g1, b1] = parse(start);
483
+ const [r2, g2, b2] = parse(end);
484
+ const mix = (left, right) => Math.round(left + (right - left) * factor);
485
+ return `#${mix(r1, r2).toString(16).padStart(2, "0")}${mix(g1, g2).toString(16).padStart(2, "0")}${mix(b1, b2).toString(16).padStart(2, "0")}`;
486
+ }
487
+ function renderYinYang(push, point, radius) {
488
+ const scale = radius / 50;
489
+ const circleRadius = round(48 * scale);
490
+ const halfRadius = round(24 * scale);
491
+ const dotRadius = round(6 * scale);
492
+ push(`<g transform="rotate(180 ${point.x} ${point.y})">`);
493
+ push(`<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="white"/>`);
494
+ push(
495
+ `<path d="M${point.x},${round(point.y - circleRadius)} A${circleRadius},${circleRadius} 0 1,1 ${point.x},${round(point.y + circleRadius)} A${halfRadius},${halfRadius} 0 1,0 ${point.x},${point.y} A${halfRadius},${halfRadius} 0 1,1 ${point.x},${round(point.y - circleRadius)}" fill="black"/>`
496
+ );
497
+ push(
498
+ `<circle cx="${point.x}" cy="${round(point.y - halfRadius)}" r="${dotRadius}" fill="white"/>`
499
+ );
500
+ push(
501
+ `<circle cx="${point.x}" cy="${round(point.y + halfRadius)}" r="${dotRadius}" fill="black"/>`
502
+ );
503
+ push(`</g>`);
504
+ }
505
+ function escapeAttr(value) {
506
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
507
+ }
508
+
509
+ export { TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, generateTreeSvg, getTreeLayout };
510
+ //# sourceMappingURL=chunk-EMMXVM35.mjs.map
511
+ //# sourceMappingURL=chunk-EMMXVM35.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/visual/tree-svg.ts"],"names":[],"mappings":";;;AAoFO,IAAM,wBAAqD,GAAA;AAAA,EAChE,IAAM,EAAA,CAAA;AAAA,EACN,IAAM,EAAA,CAAA;AAAA,EACN,KAAO,EAAA,GAAA;AAAA,EACP,MAAQ,EAAA;AACV;AAEO,IAAM,iBAAoB,GAAA;AAAA,EAC/B,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF;AAEA,IAAM,iBAAA,GAAoB,KAAM,CAAA,IAAA,CAAK,EAAE,MAAA,EAAQ,EAAG,EAAA,EAAG,CAAC,CAAA,EAAG,KAAU,KAAA,KAAA,GAAQ,CAAC,CAAA;AAC5E,IAAM,0BAA0B,EAAE,IAAA,EAAM,OAAO,GAAK,EAAA,KAAA,EAAO,OAAO,KAAM,EAAA;AACxE,IAAM,2BAA8B,GAAA;AAAA,EAClC,IAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA;AAEA,IAAM,qBAAwB,GAAA,EAAA;AAC9B,IAAM,uBAA0B,GAAA,EAAA;AAChC,IAAM,uBAA0B,GAAA,EAAA;AAChC,IAAM,4BAA+B,GAAA,CAAA;AAErC,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AQ,SAAS,CAAA,gBAAA;AAAA,GAC7E;AACA,EAAA,IAAA;AAAA,IACE,CAAA,YAAA,EAAe,KAAM,CAAA,CAAC,CAAS,MAAA,EAAA,KAAA,CAAM,MAAM,CAAI,GAAA,UAAU,CAAC,CAAA,KAAA,EAAQ,SAAS,CAAA,gBAAA;AAAA,GAC7E;AACA,EAAA,IAAA,CAAK,CAAM,IAAA,CAAA,CAAA;AACb;AAEA,SAAS,WAAW,KAAe,EAAA;AACjC,EAAA,OAAO,KACJ,CAAA,OAAA,CAAQ,IAAM,EAAA,OAAO,EACrB,OAAQ,CAAA,IAAA,EAAM,MAAM,CAAA,CACpB,QAAQ,IAAM,EAAA,MAAM,CACpB,CAAA,OAAA,CAAQ,MAAM,QAAQ,CAAA;AAC3B","file":"chunk-EMMXVM35.mjs","sourcesContent":["import {\n createTree,\n id,\n KaabalahTypes,\n MiscTypes,\n type NodeId,\n type SystemKey,\n} from \"../core\";\n\nexport interface TreeSvgViewBox {\n minX?: number;\n minY?: number;\n width: number;\n height: number;\n}\n\nexport interface TreeLayoutCoordinate {\n x: number;\n y: number;\n}\n\nexport type TreeSphereName =\n | \"Kether\"\n | \"Chokhmah\"\n | \"Binah\"\n | \"Daath\"\n | \"Chesed\"\n | \"Geburah\"\n | \"Tiphareth\"\n | \"Netzach\"\n | \"Hod\"\n | \"Yesod\"\n | \"Malkuth\";\n\nexport type TreeSphereId = NodeId<KaabalahTypes.SPHERE>;\nexport type TreePathId = NodeId<KaabalahTypes.PATH>;\n\nexport interface TreeLayoutPath {\n fromId: TreeSphereId;\n toId: TreeSphereId;\n from: TreeLayoutCoordinate;\n to: TreeLayoutCoordinate;\n}\n\nexport interface TreeLayoutMap {\n spheres: Record<TreeSphereId, TreeLayoutCoordinate>;\n paths: Record<TreePathId, TreeLayoutPath>;\n}\n\nexport interface TreeLayout {\n system: SystemKey;\n viewBox: Required<TreeSvgViewBox>;\n sphereOrder: TreeSphereId[];\n pathOrder: TreePathId[];\n percentages: TreeLayoutMap;\n viewBoxUnits: TreeLayoutMap;\n}\n\nexport interface TreeSvgCustomPalette {\n defaultSphereFill?: string;\n defaultPathColor?: string;\n sphereFills?: Partial<Record<TreeSphereId, string | string[]>>;\n pathColors?: Partial<Record<TreePathId, string>>;\n pathEdgeColor?: string;\n sphereStrokeColor?: string;\n sphereStrokeWidth?: number;\n pathHighlightColor?: string;\n pathHighlightOpacity?: number;\n specialSphereMode?: \"preserve\" | \"plain\";\n}\n\nexport type TreeSvgPalette = \"color\" | \"monochrome\" | TreeSvgCustomPalette;\nexport type TreeSvgDaathLayer = \"front\" | \"back\";\n\nexport interface TreeSvgOptions {\n width?: number | string;\n height?: number | string;\n viewBox?: TreeSvgViewBox;\n background?: string | \"transparent\";\n palette?: TreeSvgPalette;\n system?: SystemKey;\n daathLayer?: TreeSvgDaathLayer;\n}\n\nexport const TREE_SVG_DEFAULT_VIEWBOX: Required<TreeSvgViewBox> = {\n minX: 0,\n minY: 0,\n width: 286,\n height: 561,\n};\n\nexport const TREE_SPHERE_NAMES = [\n \"Kether\",\n \"Chokhmah\",\n \"Binah\",\n \"Daath\",\n \"Chesed\",\n \"Geburah\",\n \"Tiphareth\",\n \"Netzach\",\n \"Hod\",\n \"Yesod\",\n \"Malkuth\",\n] as const satisfies readonly TreeSphereName[];\n\nconst TREE_PATH_NUMBERS = Array.from({ length: 22 }, (_, index) => index + 1);\nconst CANONICAL_X_PERCENTAGES = { left: 13.25, mid: 49.94, right: 86.66 } as const;\nconst CANONICAL_ROW_Y_PERCENTAGES = [\n 6.83,\n 17.68,\n 28.42,\n 39.26,\n 50.06,\n 60.85,\n 71.68,\n 93.2,\n] as const;\n\nconst DEFAULT_SPHERE_RADIUS = 30;\nconst DEFAULT_PATH_EDGE_WIDTH = 26;\nconst DEFAULT_PATH_MAIN_WIDTH = 22;\nconst DEFAULT_PATH_HIGHLIGHT_WIDTH = 8;\n\nconst sphereId = (name: TreeSphereName) =>\n id(KaabalahTypes.SPHERE, name) as TreeSphereId;\nconst pathId = (pathNumber: number) =>\n id(KaabalahTypes.PATH, String(pathNumber)) as TreePathId;\n\nexport const TREE_SPHERE_IDS = TREE_SPHERE_NAMES.map((name) =>\n sphereId(name)\n) as TreeSphereId[];\nexport const TREE_PATH_IDS = TREE_PATH_NUMBERS.map((pathNumber) =>\n pathId(pathNumber)\n) as TreePathId[];\n\nconst CANONICAL_SPHERE_PERCENTAGES = {\n [sphereId(\"Kether\")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[0] },\n [sphereId(\"Chokhmah\")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[1] },\n [sphereId(\"Binah\")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[1] },\n [sphereId(\"Daath\")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[2] },\n [sphereId(\"Chesed\")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[3] },\n [sphereId(\"Geburah\")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[3] },\n [sphereId(\"Tiphareth\")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[4] },\n [sphereId(\"Netzach\")]: { x: CANONICAL_X_PERCENTAGES.right, y: CANONICAL_ROW_Y_PERCENTAGES[5] },\n [sphereId(\"Hod\")]: { x: CANONICAL_X_PERCENTAGES.left, y: CANONICAL_ROW_Y_PERCENTAGES[5] },\n [sphereId(\"Yesod\")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[6] },\n [sphereId(\"Malkuth\")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[7] },\n} as Record<TreeSphereId, TreeLayoutCoordinate>;\n\ninterface ResolvedPalette {\n mode: \"color\" | \"monochrome\" | \"custom\";\n defaultSphereFill: string;\n defaultPathColor: string;\n sphereFills: Partial<Record<TreeSphereId, string | string[]>>;\n pathColors: Partial<Record<TreePathId, string>>;\n pathEdgeColor: string;\n pathEdgeUseFilter: boolean;\n sphereStrokeColor?: string;\n sphereStrokeWidth?: number;\n pathHighlightColor: string;\n pathHighlightOpacity: number;\n specialSphereMode: \"preserve\" | \"plain\";\n}\n\nexport function getTreeLayout(system: SystemKey = \"kaabalah\"): TreeLayout {\n const tree = createTree({ system });\n const percentages = buildLayoutMap(tree, CANONICAL_SPHERE_PERCENTAGES);\n const viewBoxUnits = buildLayoutMap(\n tree,\n scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, TREE_SVG_DEFAULT_VIEWBOX)\n );\n\n return {\n system,\n viewBox: { ...TREE_SVG_DEFAULT_VIEWBOX },\n sphereOrder: [...TREE_SPHERE_IDS],\n pathOrder: [...TREE_PATH_IDS],\n percentages,\n viewBoxUnits,\n };\n}\n\nexport function generateTreeSvg(options: TreeSvgOptions = {}): string {\n const system = options.system ?? \"kaabalah\";\n const daathLayer = options.daathLayer ?? \"front\";\n const tree = createTree({ system, parts: [\"colors\"] });\n const viewBox = normalizeViewBox(options.viewBox);\n const palette = resolvePalette(options.palette);\n const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);\n const layout = buildLayoutMap(tree, spherePositions);\n const scale = Math.min(\n viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,\n viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height\n );\n\n const radius = round(DEFAULT_SPHERE_RADIUS * scale);\n const pathEdgeWidth = round(DEFAULT_PATH_EDGE_WIDTH * scale);\n const pathMainWidth = round(DEFAULT_PATH_MAIN_WIDTH * scale);\n const pathHighlightWidth = round(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);\n const sphereStrokeWidth = palette.sphereStrokeWidth\n ? round(palette.sphereStrokeWidth * scale)\n : undefined;\n\n const lines: string[] = [];\n const push = (line: string) => lines.push(line);\n const svgAttributes = [\n `xmlns=\"http://www.w3.org/2000/svg\"`,\n options.width !== undefined ? `width=\"${escapeAttr(String(options.width))}\"` : \"\",\n options.height !== undefined ? `height=\"${escapeAttr(String(options.height))}\"` : \"\",\n `viewBox=\"${viewBox.minX} ${viewBox.minY} ${viewBox.width} ${viewBox.height}\"`,\n `preserveAspectRatio=\"xMidYMid meet\"`,\n ].filter(Boolean);\n\n push(`<svg ${svgAttributes.join(\" \")}>`);\n push(`<defs>`);\n push(`<filter id=\"pathDarken\">\n <feComponentTransfer>\n <feFuncR type=\"linear\" slope=\"0.65\"/>\n <feFuncG type=\"linear\" slope=\"0.65\"/>\n <feFuncB type=\"linear\" slope=\"0.65\"/>\n </feComponentTransfer>\n</filter>`);\n\n for (const sphereName of TREE_SPHERE_NAMES) {\n const currentSphereId = sphereId(sphereName);\n const slug = sphereName.toLowerCase();\n const point = spherePositions[currentSphereId];\n if (!point) {\n continue;\n }\n\n push(`<radialGradient id=\"spec-${slug}\" cx=\"30%\" cy=\"25%\" r=\"55%\" fx=\"30%\" fy=\"25%\">\n <stop offset=\"0%\" stop-color=\"white\" stop-opacity=\"0.95\"/>\n <stop offset=\"25%\" stop-color=\"white\" stop-opacity=\"0.45\"/>\n <stop offset=\"50%\" stop-color=\"white\" stop-opacity=\"0.08\"/>\n <stop offset=\"100%\" stop-color=\"white\" stop-opacity=\"0\"/>\n</radialGradient>`);\n\n push(`<radialGradient id=\"shad-${slug}\" cx=\"78%\" cy=\"80%\" r=\"55%\" fx=\"78%\" fy=\"80%\">\n <stop offset=\"0%\" stop-color=\"black\" stop-opacity=\"0.32\"/>\n <stop offset=\"40%\" stop-color=\"black\" stop-opacity=\"0.12\"/>\n <stop offset=\"100%\" stop-color=\"black\" stop-opacity=\"0\"/>\n</radialGradient>`);\n\n push(\n `<clipPath id=\"clip-${slug}\"><circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${radius}\"/></clipPath>`\n );\n }\n\n push(`<radialGradient id=\"kether-glow\" cx=\"50%\" cy=\"50%\" r=\"50%\">\n <stop offset=\"0%\" stop-color=\"white\" stop-opacity=\"0.95\"/>\n <stop offset=\"45%\" stop-color=\"white\" stop-opacity=\"0.6\"/>\n <stop offset=\"80%\" stop-color=\"white\" stop-opacity=\"0.15\"/>\n <stop offset=\"100%\" stop-color=\"white\" stop-opacity=\"0\"/>\n</radialGradient>`);\n\n push(`<linearGradient id=\"kether-facet\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stop-color=\"white\" stop-opacity=\"0.9\"/>\n <stop offset=\"50%\" stop-color=\"white\" stop-opacity=\"0.5\"/>\n <stop offset=\"100%\" stop-color=\"white\" stop-opacity=\"0.1\"/>\n</linearGradient>`);\n\n push(`<radialGradient id=\"kether-rim\" cx=\"50%\" cy=\"50%\" r=\"75%\">\n <stop offset=\"60%\" stop-color=\"black\" stop-opacity=\"0\"/>\n <stop offset=\"100%\" stop-color=\"black\" stop-opacity=\"0.18\"/>\n</radialGradient>`);\n push(`</defs>`);\n\n const background = options.background ?? \"white\";\n if (background !== \"transparent\") {\n push(\n `<rect x=\"${viewBox.minX}\" y=\"${viewBox.minY}\" width=\"${viewBox.width}\" height=\"${viewBox.height}\" fill=\"${escapeAttr(background)}\"/>`\n );\n }\n\n if (daathLayer === \"back\") {\n push(`<g id=\"spheres-behind-paths\">`);\n renderSphere(push, {\n tree,\n palette,\n radius,\n sphereStrokeWidth,\n spherePositions,\n sphereName: \"Daath\",\n });\n push(`</g>`);\n }\n\n push(`<g id=\"paths\">`);\n for (const currentPathId of TREE_PATH_IDS) {\n const path = layout.paths[currentPathId];\n const color = resolvePathColor({\n palette,\n tree,\n pathId: currentPathId,\n });\n\n push(\n `<line x1=\"${path.from.x}\" y1=\"${path.from.y}\" x2=\"${path.to.x}\" y2=\"${path.to.y}\" stroke=\"${escapeAttr(palette.pathEdgeColor)}\" stroke-width=\"${pathEdgeWidth}\" stroke-linecap=\"round\"${palette.pathEdgeUseFilter ? ` filter=\"url(#pathDarken)\"` : \"\"}/>`\n );\n push(\n `<line x1=\"${path.from.x}\" y1=\"${path.from.y}\" x2=\"${path.to.x}\" y2=\"${path.to.y}\" stroke=\"${escapeAttr(color)}\" stroke-width=\"${pathMainWidth}\" stroke-linecap=\"round\"/>`\n );\n push(\n `<line x1=\"${path.from.x}\" y1=\"${path.from.y}\" x2=\"${path.to.x}\" y2=\"${path.to.y}\" stroke=\"${escapeAttr(palette.pathHighlightColor)}\" stroke-opacity=\"${palette.pathHighlightOpacity}\" stroke-width=\"${pathHighlightWidth}\" stroke-linecap=\"round\"/>`\n );\n }\n push(`</g>`);\n\n const frontSphereNames =\n daathLayer === \"back\"\n ? TREE_SPHERE_NAMES.filter((name): name is Exclude<TreeSphereName, \"Daath\"> => name !== \"Daath\")\n : TREE_SPHERE_NAMES;\n\n push(`<g id=\"spheres\">`);\n for (const sphereName of frontSphereNames) {\n renderSphere(push, {\n tree,\n palette,\n radius,\n sphereStrokeWidth,\n spherePositions,\n sphereName,\n });\n }\n push(`</g>`);\n if (daathLayer === \"back\") {\n const daathPoint = spherePositions[sphereId(\"Daath\")];\n push(\n `<circle id=\"sphere-daath-hit-area\" data-node-id=\"sphere:Daath\" cx=\"${daathPoint.x}\" cy=\"${daathPoint.y}\" r=\"${radius}\" fill=\"transparent\" pointer-events=\"all\"/>`\n );\n }\n push(`</svg>`);\n\n return lines.join(\"\\n\");\n}\n\nfunction renderSphere(\n push: (line: string) => void,\n params: {\n tree: ReturnType<typeof createTree>;\n palette: ResolvedPalette;\n radius: number;\n sphereStrokeWidth?: number;\n spherePositions: Record<TreeSphereId, TreeLayoutCoordinate>;\n sphereName: TreeSphereName;\n }\n) {\n const currentSphereId = sphereId(params.sphereName);\n const point = params.spherePositions[currentSphereId];\n const slug = params.sphereName.toLowerCase();\n const colorData =\n params.tree.relatedFirst(currentSphereId, MiscTypes.COLOR)?.data?.colorHexCodes ?? [];\n const sphereFill = resolveSphereFill({\n palette: params.palette,\n sphereId: currentSphereId,\n defaultColors: colorData,\n });\n\n push(`<g id=\"sphere-${slug}\" clip-path=\"url(#clip-${slug})\">`);\n if (params.palette.specialSphereMode === \"preserve\") {\n if (params.sphereName === \"Kether\") {\n renderKether(push, point, params.radius);\n } else if (params.sphereName === \"Chokhmah\") {\n renderIridescent(push, point, params.radius);\n } else if (params.sphereName === \"Daath\") {\n renderYinYang(push, point, params.radius);\n } else if (params.sphereName === \"Malkuth\" && colorData.length >= 4) {\n const slicedColors = Array.isArray(sphereFill)\n ? sphereFill\n : colorData.slice(0, 4);\n renderSlicedSphere(push, point, params.radius, slicedColors, -135);\n } else {\n push(\n `<circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${params.radius}\" fill=\"${escapeAttr(toPrimaryFill(sphereFill, params.palette.defaultSphereFill))}\"/>`\n );\n }\n } else {\n push(\n `<circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${params.radius}\" fill=\"${escapeAttr(toPrimaryFill(sphereFill, params.palette.defaultSphereFill))}\"/>`\n );\n }\n\n push(\n `<circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${params.radius}\" fill=\"url(#spec-${slug})\"/>`\n );\n if (\n params.palette.specialSphereMode !== \"preserve\" ||\n (params.sphereName !== \"Kether\" && params.sphereName !== \"Chokhmah\")\n ) {\n push(\n `<circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${params.radius}\" fill=\"url(#shad-${slug})\"/>`\n );\n }\n push(`</g>`);\n if (params.palette.sphereStrokeColor && params.sphereStrokeWidth) {\n push(\n `<circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${params.radius}\" fill=\"none\" stroke=\"${escapeAttr(params.palette.sphereStrokeColor)}\" stroke-width=\"${params.sphereStrokeWidth}\"/>`\n );\n }\n}\n\nfunction buildLayoutMap(\n tree: ReturnType<typeof createTree>,\n spherePositions: Record<TreeSphereId, TreeLayoutCoordinate>\n): TreeLayoutMap {\n const paths = {} as Record<TreePathId, TreeLayoutPath>;\n\n for (const currentPathId of TREE_PATH_IDS) {\n const path = tree.getNode(currentPathId);\n const fromId = path?.data?.from as TreeSphereId | undefined;\n const toId = path?.data?.to as TreeSphereId | undefined;\n\n if (!fromId || !toId) {\n throw new Error(`Tree path ${currentPathId} is missing endpoints.`);\n }\n\n const from = spherePositions[fromId];\n const to = spherePositions[toId];\n\n if (!from || !to) {\n throw new Error(\n `Tree path ${currentPathId} references unknown layout spheres: ${fromId}, ${toId}.`\n );\n }\n\n paths[currentPathId] = {\n fromId,\n toId,\n from: { ...from },\n to: { ...to },\n };\n }\n\n return {\n spheres: cloneCoordinateMap(spherePositions),\n paths,\n };\n}\n\nfunction cloneCoordinateMap(\n coordinates: Record<TreeSphereId, TreeLayoutCoordinate>\n): Record<TreeSphereId, TreeLayoutCoordinate> {\n const clone = {} as Record<TreeSphereId, TreeLayoutCoordinate>;\n for (const currentSphereId of TREE_SPHERE_IDS) {\n const point = coordinates[currentSphereId];\n clone[currentSphereId] = { ...point };\n }\n return clone;\n}\n\nfunction scaleCoordinates(\n coordinates: Record<TreeSphereId, TreeLayoutCoordinate>,\n viewBox: Required<TreeSvgViewBox>\n): Record<TreeSphereId, TreeLayoutCoordinate> {\n const scaled = {} as Record<TreeSphereId, TreeLayoutCoordinate>;\n\n for (const currentSphereId of TREE_SPHERE_IDS) {\n const point = coordinates[currentSphereId];\n scaled[currentSphereId] = {\n x: round(viewBox.minX + (point.x / 100) * viewBox.width),\n y: round(viewBox.minY + (point.y / 100) * viewBox.height),\n };\n }\n\n return scaled;\n}\n\nfunction normalizeViewBox(\n viewBox: TreeSvgViewBox | undefined\n): Required<TreeSvgViewBox> {\n return {\n minX: viewBox?.minX ?? TREE_SVG_DEFAULT_VIEWBOX.minX,\n minY: viewBox?.minY ?? TREE_SVG_DEFAULT_VIEWBOX.minY,\n width: viewBox?.width ?? TREE_SVG_DEFAULT_VIEWBOX.width,\n height: viewBox?.height ?? TREE_SVG_DEFAULT_VIEWBOX.height,\n };\n}\n\nfunction resolvePalette(palette: TreeSvgPalette | undefined): ResolvedPalette {\n if (palette === undefined || palette === \"color\") {\n return {\n mode: \"color\",\n defaultSphereFill: \"#888888\",\n defaultPathColor: \"#888888\",\n sphereFills: {},\n pathColors: {},\n pathEdgeColor: \"#888888\",\n pathEdgeUseFilter: true,\n pathHighlightColor: \"white\",\n pathHighlightOpacity: 0.25,\n specialSphereMode: \"preserve\",\n };\n }\n\n if (palette === \"monochrome\") {\n return {\n mode: \"monochrome\",\n defaultSphereFill: \"#e6ddd0\",\n defaultPathColor: \"#e0d7ca\",\n sphereFills: {},\n pathColors: {},\n pathEdgeColor: \"#2f271e\",\n pathEdgeUseFilter: false,\n sphereStrokeColor: \"#2f271e\",\n sphereStrokeWidth: 2.4,\n pathHighlightColor: \"white\",\n pathHighlightOpacity: 0.2,\n specialSphereMode: \"plain\",\n };\n }\n\n return {\n mode: \"custom\",\n defaultSphereFill: palette.defaultSphereFill ?? \"#111111\",\n defaultPathColor: palette.defaultPathColor ?? \"#111111\",\n sphereFills: palette.sphereFills ?? {},\n pathColors: palette.pathColors ?? {},\n pathEdgeColor: palette.pathEdgeColor ?? (palette.defaultPathColor ?? \"#111111\"),\n pathEdgeUseFilter: false,\n sphereStrokeColor: palette.sphereStrokeColor,\n sphereStrokeWidth: palette.sphereStrokeWidth,\n pathHighlightColor: palette.pathHighlightColor ?? \"white\",\n pathHighlightOpacity: palette.pathHighlightOpacity ?? 0.18,\n specialSphereMode: palette.specialSphereMode ?? \"plain\",\n };\n}\n\nfunction resolvePathColor(params: {\n palette: ResolvedPalette;\n tree: ReturnType<typeof createTree>;\n pathId: TreePathId;\n}) {\n const override = params.palette.pathColors[params.pathId];\n if (override) {\n return override;\n }\n\n if (params.palette.mode === \"monochrome\" || params.palette.mode === \"custom\") {\n return params.palette.defaultPathColor;\n }\n\n const treeColor =\n params.tree.relatedFirst(params.pathId, MiscTypes.COLOR)?.data?.colorHexCodes?.[0];\n\n return treeColor ?? params.palette.defaultPathColor;\n}\n\nfunction resolveSphereFill(params: {\n palette: ResolvedPalette;\n sphereId: TreeSphereId;\n defaultColors: string[];\n}) {\n const override = params.palette.sphereFills[params.sphereId];\n if (override) {\n return override;\n }\n\n if (params.palette.mode === \"monochrome\" || params.palette.mode === \"custom\") {\n return params.palette.defaultSphereFill;\n }\n\n if (params.defaultColors.length > 0) {\n return params.defaultColors;\n }\n\n return params.palette.defaultSphereFill;\n}\n\nfunction toPrimaryFill(fill: string | string[], fallback: string) {\n if (Array.isArray(fill)) {\n return fill[0] ?? fallback;\n }\n\n return fill;\n}\n\nfunction round(value: number) {\n return Math.round(value * 100) / 100;\n}\n\nfunction polarToCartesian(\n cx: number,\n cy: number,\n radius: number,\n degrees: number\n) {\n const radians = (Math.PI / 180) * degrees;\n return {\n x: round(cx + radius * Math.cos(radians)),\n y: round(cy + radius * Math.sin(radians)),\n };\n}\n\nfunction arcPath(\n cx: number,\n cy: number,\n radius: number,\n startDegrees: number,\n endDegrees: number\n) {\n const start = polarToCartesian(cx, cy, radius, startDegrees);\n const end = polarToCartesian(cx, cy, radius, endDegrees);\n const largeArc = endDegrees - startDegrees <= 180 ? 0 : 1;\n return `M ${cx} ${cy} L ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} 1 ${end.x} ${end.y} Z`;\n}\n\nfunction renderKether(\n push: (line: string) => void,\n point: TreeLayoutCoordinate,\n radius: number\n) {\n push(`<circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${radius}\" fill=\"#e0e0e0\"/>`);\n push(`<circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${radius}\" fill=\"url(#kether-glow)\"/>`);\n\n const spokes = 16;\n const innerRadius = round(radius * 0.18);\n const outerRadius = round(radius * 0.92);\n const innerWidth = round(radius * 0.04);\n const angleStep = 360 / spokes;\n\n push(`<g opacity=\"0.85\">`);\n for (let index = 0; index < spokes; index++) {\n const angle = index * angleStep;\n push(`<g transform=\"rotate(${angle} ${point.x} ${point.y})\">`);\n const x0 = round(point.x - innerWidth);\n const y0 = round(point.y - innerRadius);\n const x1 = point.x;\n const y1 = round(point.y - outerRadius);\n const x2 = round(point.x + innerWidth);\n const y2 = round(point.y - innerRadius);\n push(\n `<polygon points=\"${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}\" fill=\"url(#kether-facet)\"/>`\n );\n push(`</g>`);\n }\n push(`</g>`);\n push(`<circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${radius}\" fill=\"url(#kether-rim)\"/>`);\n}\n\nfunction renderSlicedSphere(\n push: (line: string) => void,\n point: TreeLayoutCoordinate,\n radius: number,\n colors: string[],\n startAngle: number\n) {\n const segmentCount = colors.length;\n const step = 360 / segmentCount;\n let currentAngle = startAngle;\n\n for (let index = 0; index < segmentCount; index++) {\n const path = arcPath(point.x, point.y, radius * 0.96, currentAngle, currentAngle + step);\n push(`<path d=\"${path}\" fill=\"${escapeAttr(colors[index])}\" stroke=\"none\"/>`);\n currentAngle += step;\n }\n}\n\nfunction renderIridescent(\n push: (line: string) => void,\n point: TreeLayoutCoordinate,\n radius: number\n) {\n const stops: [number, string][] = [\n [0.0, \"#F0E8EE\"],\n [0.1, \"#ffa3e6\"],\n [0.22, \"#a7e0ff\"],\n [0.34, \"#baff9a\"],\n [0.46, \"#ffe28a\"],\n [0.58, \"#c6a4ff\"],\n [0.7, \"#9ad6ff\"],\n [0.82, \"#ffa3e6\"],\n [1.0, \"#F0E8EE\"],\n ];\n\n const slices = 72;\n const sphereRadius = round(radius * 0.96);\n\n for (let index = 0; index < slices; index++) {\n const t = index / slices;\n const color = interpolateColorStops(stops, t);\n const startDegrees = t * 360 - 90;\n const endDegrees = startDegrees + 360 / slices + 0.5;\n const path = arcPath(point.x, point.y, sphereRadius, startDegrees, endDegrees);\n push(`<path d=\"${path}\" fill=\"${color}\" stroke=\"none\"/>`);\n }\n}\n\nfunction interpolateColorStops(stops: [number, string][], t: number): string {\n let lower = stops[0];\n let upper = stops[stops.length - 1];\n\n for (let index = 0; index < stops.length - 1; index++) {\n if (t >= stops[index][0] && t <= stops[index + 1][0]) {\n lower = stops[index];\n upper = stops[index + 1];\n break;\n }\n }\n\n const range = upper[0] - lower[0] || 1;\n return interpolateColor(lower[1], upper[1], (t - lower[0]) / range);\n}\n\nfunction interpolateColor(start: string, end: string, factor: number) {\n const parse = (hex: string) => {\n const match = hex.match(/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);\n return match\n ? [\n Number.parseInt(match[1], 16),\n Number.parseInt(match[2], 16),\n Number.parseInt(match[3], 16),\n ]\n : [0, 0, 0];\n };\n\n const [r1, g1, b1] = parse(start);\n const [r2, g2, b2] = parse(end);\n const mix = (left: number, right: number) =>\n Math.round(left + (right - left) * factor);\n\n return `#${mix(r1, r2).toString(16).padStart(2, \"0\")}${mix(g1, g2)\n .toString(16)\n .padStart(2, \"0\")}${mix(b1, b2).toString(16).padStart(2, \"0\")}`;\n}\n\nfunction renderYinYang(\n push: (line: string) => void,\n point: TreeLayoutCoordinate,\n radius: number\n) {\n const scale = radius / 50;\n const circleRadius = round(48 * scale);\n const halfRadius = round(24 * scale);\n const dotRadius = round(6 * scale);\n\n push(`<g transform=\"rotate(180 ${point.x} ${point.y})\">`);\n push(`<circle cx=\"${point.x}\" cy=\"${point.y}\" r=\"${circleRadius}\" fill=\"white\"/>`);\n push(\n `<path d=\"M${point.x},${round(point.y - circleRadius)} A${circleRadius},${circleRadius} 0 1,1 ${point.x},${round(point.y + circleRadius)} A${halfRadius},${halfRadius} 0 1,0 ${point.x},${point.y} A${halfRadius},${halfRadius} 0 1,1 ${point.x},${round(point.y - circleRadius)}\" fill=\"black\"/>`\n );\n push(\n `<circle cx=\"${point.x}\" cy=\"${round(point.y - halfRadius)}\" r=\"${dotRadius}\" fill=\"white\"/>`\n );\n push(\n `<circle cx=\"${point.x}\" cy=\"${round(point.y + halfRadius)}\" r=\"${dotRadius}\" fill=\"black\"/>`\n );\n push(`</g>`);\n}\n\nfunction escapeAttr(value: string) {\n return value\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\");\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { getCanonicalTree } from './chunk-NBP75BAH.mjs';
2
- import { id, parseId } from './chunk-RZBVUDBM.mjs';
1
+ import { getCanonicalTree } from './chunk-ZKIJAZ6B.mjs';
2
+ import { id, parseId } from './chunk-EFZUZI22.mjs';
3
3
 
4
4
  // src/tarot/index.ts
5
5
  var DEFAULT_TAROT_TREE_ID = "kaabalah";
@@ -2562,5 +2562,5 @@ function drawTarotSpread(options) {
2562
2562
  }
2563
2563
 
2564
2564
  export { ARKANNUS, DEFAULT_TAROT_TREE_ID, TAROT_IMAGE_BASE_URL, TAROT_TREE_IDS, drawTarotSpread, getTarotArchetype, getTarotCardByNumber, getTarotCardNumber, getTarotCardProfile, getTarotCorrespondenceProfile, getTarotRepresentation, getTarotRepresentations, getTarotSpread, listTarotDecks, listTarotSpreads, listTarotTrees, majorArcana, resolveTarotImageUrl, shuffleTarotDeck, validateTarotSpreadSelection };
2565
- //# sourceMappingURL=chunk-2RGUI5FG.mjs.map
2566
- //# sourceMappingURL=chunk-2RGUI5FG.mjs.map
2565
+ //# sourceMappingURL=chunk-MTI2SOQ6.mjs.map
2566
+ //# sourceMappingURL=chunk-MTI2SOQ6.mjs.map