kaabalah 6.6.4 → 6.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.
@@ -1,5 +1,822 @@
1
1
  import { id, createTree } from './chunk-EFZUZI22.mjs';
2
2
 
3
+ // src/visual/archeometer.ts
4
+ var TAU = Math.PI * 2;
5
+ var ARCHEOMETER_DEFAULT_VIEWBOX = {
6
+ minX: 0,
7
+ minY: 0,
8
+ width: 912,
9
+ height: 912
10
+ };
11
+ var ARCHEOMETER_OUTER_CROWN_BLEED = 22;
12
+ var DEFAULT_LAYERS = {
13
+ degreeCrown: true,
14
+ zodiacUtterance: true,
15
+ planetaryUtterance: true,
16
+ cosmologicalMusic: true,
17
+ astralZodiac: true,
18
+ astralPlanetary: true,
19
+ chromicRays: true,
20
+ whiteRays: true,
21
+ solarCenter: true
22
+ };
23
+ var COLOR_RING_FILLS = {
24
+ degreeOuter: "#fff8ef",
25
+ degreeInner: "#fff2e1",
26
+ zodiacUtterance: "#eba0be",
27
+ planetaryUtterance: "#fffaf1",
28
+ cosmologicalMusic: "#fffaf0",
29
+ astralZodiac: "#efc0bc",
30
+ astralPlanetary: "#d2e8df",
31
+ chromicRays: "#fff3d4",
32
+ whiteRays: "#eef1ec",
33
+ solarCenter: "#f7d65b"
34
+ };
35
+ var COLOR_PALETTE = {
36
+ paper: "#fffaf1",
37
+ ink: "#151515",
38
+ subtleInk: "#605a54",
39
+ ringStroke: "#171717",
40
+ degreeTick: "#171717",
41
+ degreeLabel: "#171717",
42
+ whiteRay: "#25395a",
43
+ ringFills: COLOR_RING_FILLS
44
+ };
45
+ var DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES = [
46
+ {
47
+ degree: 0,
48
+ utterance: { id: "ph", degree: 0, letter: "P, Ph", number: 80, color: "#f2d54c", triangleId: "wordJesus", gloss: "Utterance / light" },
49
+ triangleLabel: { degree: 0, label: "S, Sh", number: 300 },
50
+ musicalNote: { degree: 0, note: "Si" },
51
+ zodiacSign: { degree: 0, name: "Capricorn", glyph: "\u2651" },
52
+ planetaryPoint: { degree: 0, name: "Saturn", glyph: "\u2644", phase: "diurnal" }
53
+ },
54
+ {
55
+ degree: 30,
56
+ utterance: { id: "za", degree: 30, letter: "W, OU", number: 70, color: "#b7d56a", triangleId: "ether", gloss: "Ether" },
57
+ triangleLabel: { degree: 30, label: "D", number: 4 },
58
+ musicalNote: { degree: 30, note: "Do" },
59
+ zodiacSign: { degree: 30, name: "Sagittarius", glyph: "\u2650" },
60
+ planetaryPoint: { degree: 30, name: "Jupiter", glyph: "\u2643", phase: "diurnal" }
61
+ },
62
+ {
63
+ degree: 60,
64
+ utterance: { id: "ma", degree: 60, letter: "M", number: 40, color: "#79bf6a", triangleId: "mary", gloss: "Mary" },
65
+ triangleLabel: { degree: 60, label: "C", number: 20 },
66
+ musicalNote: { degree: 60, note: "R\xE9" },
67
+ zodiacSign: { degree: 60, name: "Scorpio", glyph: "\u264F" },
68
+ planetaryPoint: { degree: 60, name: "Mars", glyph: "\u2642", phase: "diurnal" }
69
+ },
70
+ {
71
+ degree: 90,
72
+ utterance: { id: "u", degree: 90, letter: "L", number: 30, color: "#69ad74", triangleId: "divineFire", gloss: "Fire" },
73
+ triangleLabel: { degree: 90, label: "" },
74
+ musicalNote: { degree: 90, note: "Mi" },
75
+ zodiacSign: { degree: 90, name: "Libra", glyph: "\u264E" },
76
+ planetaryPoint: { degree: 90, name: "Venus", glyph: "\u2640", phase: "diurnal" }
77
+ },
78
+ {
79
+ degree: 120,
80
+ utterance: { id: "o", degree: 120, letter: "I, Y, J", number: 10, color: "#efb83e", triangleId: "wordJesus", gloss: "Voice / sound" },
81
+ triangleLabel: { degree: 120, label: "Ts", number: 90 },
82
+ musicalNote: { degree: 120, note: "Fa" },
83
+ zodiacSign: { degree: 120, name: "Virgo", glyph: "\u264D" },
84
+ planetaryPoint: { degree: 120, name: "Mercury", glyph: "\u263F", phase: "diurnal" }
85
+ },
86
+ {
87
+ degree: 150,
88
+ utterance: { id: "la", degree: 150, letter: "T", number: 9, color: "#ec8d3f", triangleId: "ether", gloss: "Ether" },
89
+ triangleLabel: { degree: 150, label: "N", number: 50 },
90
+ musicalNote: { degree: 150, note: "Sol" },
91
+ zodiacSign: { degree: 150, name: "Leo", glyph: "\u264C" },
92
+ planetaryPoint: { degree: 150, name: "Sun", glyph: "\u2609", phase: "diurnal" }
93
+ },
94
+ {
95
+ degree: 180,
96
+ utterance: { id: "ri", degree: 180, letter: "E, H", number: 8, color: "#df4d43", triangleId: "mary", gloss: "Descending R" },
97
+ triangleLabel: { degree: 180, label: "B", number: 2 },
98
+ musicalNote: { degree: 180, note: "La" },
99
+ zodiacSign: { degree: 180, name: "Cancer", glyph: "\u264B" },
100
+ planetaryPoint: { degree: 180, name: "Moon", glyph: "\u263E", phase: "nocturnal" }
101
+ },
102
+ {
103
+ degree: 210,
104
+ utterance: { id: "t", degree: 210, letter: "Z", number: 7, color: "#8b54ad", triangleId: "divineFire", gloss: "Divine fire" },
105
+ triangleLabel: { degree: 210, label: "Ts", number: 90 },
106
+ musicalNote: { degree: 210, note: "Si" },
107
+ zodiacSign: { degree: 210, name: "Gemini", glyph: "\u264A" },
108
+ planetaryPoint: { degree: 210, name: "Mercury", glyph: "\u263F", phase: "nocturnal" }
109
+ },
110
+ {
111
+ degree: 240,
112
+ utterance: { id: "y", degree: 240, letter: "V, OU", number: 6, color: "#d85c43", triangleId: "wordJesus", gloss: "Word / JeShU" },
113
+ triangleLabel: { degree: 240, label: "G", number: 3 },
114
+ musicalNote: { degree: 240, note: "Do" },
115
+ zodiacSign: { degree: 240, name: "Taurus", glyph: "\u2649" },
116
+ planetaryPoint: { degree: 240, name: "Venus", glyph: "\u2640", phase: "nocturnal" }
117
+ },
118
+ {
119
+ degree: 270,
120
+ utterance: { id: "ka", degree: 270, letter: "H, E", number: 5, color: "#3c82c2", triangleId: "ether", gloss: "Etheric power" },
121
+ triangleLabel: { degree: 270, label: "C", number: 20 },
122
+ musicalNote: { degree: 270, note: "R\xE9" },
123
+ zodiacSign: { degree: 270, name: "Aries", glyph: "\u2648" },
124
+ planetaryPoint: { degree: 270, name: "Mars", glyph: "\u2642", phase: "nocturnal" }
125
+ },
126
+ {
127
+ degree: 300,
128
+ utterance: { id: "h", degree: 300, letter: "R", number: 200, color: "#d4579c", triangleId: "mary", gloss: "Living waters" },
129
+ triangleLabel: { degree: 300, label: "D", number: 4 },
130
+ musicalNote: { degree: 300, note: "Mi" },
131
+ zodiacSign: { degree: 300, name: "Pisces", glyph: "\u2653" },
132
+ planetaryPoint: { degree: 300, name: "Jupiter", glyph: "\u2643", phase: "nocturnal" }
133
+ },
134
+ {
135
+ degree: 330,
136
+ utterance: { id: "hou", degree: 330, letter: "K", number: 100, color: "#7963b8", triangleId: "divineFire", gloss: "Divine fire" },
137
+ triangleLabel: { degree: 330, label: "S, Sh", number: 300 },
138
+ musicalNote: { degree: 330, note: "Fa" },
139
+ zodiacSign: { degree: 330, name: "Aquarius", glyph: "\u2652" },
140
+ planetaryPoint: { degree: 330, name: "Saturn", glyph: "\u2644", phase: "nocturnal" }
141
+ }
142
+ ];
143
+ var DEFAULT_ARCHEOMETER_UTTERANCE = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.utterance);
144
+ var DEFAULT_ARCHEOMETER_TRIANGLE_LABELS = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.triangleLabel);
145
+ var DEFAULT_ARCHEOMETER_TRIANGLES = [
146
+ { id: "wordJesus", title: "Triangle of the Word / JeShU", phrase: "Y-PhO", apex: "north", vertices: [0, 120, 240], fill: "#f2cf45", vertexFills: ["#f2cf45", "#5470a5", "#dd3e38"], stroke: "#171717" },
147
+ { id: "mary", title: "Triangle of Mary / Living Waters", phrase: "Ma-Ri-H", apex: "south", vertices: [180, 300, 60], fill: "#e25b61", vertexFills: ["#cc58a1", "#f28a32", "#78bd79"], stroke: "#171717" },
148
+ { id: "ether", title: "Triangle of the Ether", phrase: "La-Ka-Za", apex: "west", vertices: [270, 30, 150], fill: "#78bd79", vertexFills: ["#e96836", "#b7bd58", "#8f69a3"], stroke: "#171717" },
149
+ { id: "divineFire", title: "Triangle of Divine Fire", phrase: "Hou-U-T", apex: "east", vertices: [90, 210, 330], fill: "#cc58a1", vertexFills: ["#63a890", "#d45375", "#f0b33f"], stroke: "#171717" }
150
+ ];
151
+ var DEFAULT_ARCHEOMETER_MUSICAL_NOTES = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.musicalNote);
152
+ var DEFAULT_ARCHEOMETER_ZODIAC = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.zodiacSign);
153
+ var DEFAULT_ARCHEOMETER_PLANETS = DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES.map((sector) => sector.planetaryPoint);
154
+ function getArcheometerRenderModel(options = {}) {
155
+ const viewBox = normalizeViewBox(options.viewBox);
156
+ const scale = Math.min(viewBox.width / ARCHEOMETER_DEFAULT_VIEWBOX.width, viewBox.height / ARCHEOMETER_DEFAULT_VIEWBOX.height);
157
+ const padding = options.padding ?? 0;
158
+ const center = {
159
+ x: round(viewBox.minX + viewBox.width / 2),
160
+ y: round(viewBox.minY + viewBox.height / 2)
161
+ };
162
+ const frameRadius = round(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
163
+ const outerRadius = round(Math.max(0, frameRadius - ARCHEOMETER_OUTER_CROWN_BLEED * scale));
164
+ return {
165
+ viewBox,
166
+ center,
167
+ outerRadius,
168
+ scale,
169
+ rings: buildRings(outerRadius, frameRadius),
170
+ palette: resolvePalette(options.palette),
171
+ rotationDegrees: options.rotationDegrees ?? 0,
172
+ layers: { ...DEFAULT_LAYERS, ...options.layers ?? {} },
173
+ degreeLabelEvery: options.degreeLabelEvery ?? 15,
174
+ utterance: options.utterance ?? DEFAULT_ARCHEOMETER_UTTERANCE,
175
+ triangles: options.triangles ?? DEFAULT_ARCHEOMETER_TRIANGLES,
176
+ triangleLabels: options.triangleLabels ?? DEFAULT_ARCHEOMETER_TRIANGLE_LABELS,
177
+ musicalNotes: options.musicalNotes ?? DEFAULT_ARCHEOMETER_MUSICAL_NOTES,
178
+ zodiacSigns: options.zodiacSigns ?? DEFAULT_ARCHEOMETER_ZODIAC,
179
+ planetaryPoints: options.planetaryPoints ?? DEFAULT_ARCHEOMETER_PLANETS
180
+ };
181
+ }
182
+ var DEFAULT_ARCHETYPE_UTTERANCE = DEFAULT_ARCHEOMETER_UTTERANCE;
183
+ var DEFAULT_ARCHETYPE_TRIANGLES = DEFAULT_ARCHEOMETER_TRIANGLES;
184
+ var DEFAULT_ARCHETYPE_MUSICAL_NOTES = DEFAULT_ARCHEOMETER_MUSICAL_NOTES;
185
+ var DEFAULT_ARCHETYPE_ZODIAC = DEFAULT_ARCHEOMETER_ZODIAC;
186
+ var DEFAULT_ARCHETYPE_PLANETS = DEFAULT_ARCHEOMETER_PLANETS;
187
+ function generateArcheometerSvg(options = {}) {
188
+ const model = getArcheometerRenderModel(options);
189
+ const { viewBox, center, outerRadius, palette } = model;
190
+ const background = options.background ?? "transparent";
191
+ const lines = [];
192
+ const push = (line) => lines.push(line);
193
+ const title = options.title ?? "The Cosmological Archeometer";
194
+ const attrs = [
195
+ `xmlns="http://www.w3.org/2000/svg"`,
196
+ options.width !== void 0 ? `width="${escapeAttr(String(options.width))}"` : "",
197
+ options.height !== void 0 ? `height="${escapeAttr(String(options.height))}"` : "",
198
+ `viewBox="${fmt(viewBox.minX)} ${fmt(viewBox.minY)} ${fmt(viewBox.width)} ${fmt(viewBox.height)}"`,
199
+ `preserveAspectRatio="xMidYMid meet"`,
200
+ `role="img"`,
201
+ `aria-label="${escapeAttr(title)}"`
202
+ ].filter(Boolean);
203
+ push(`<svg ${attrs.join(" ")}>`);
204
+ push(`<title>${escapeText(title)}</title>`);
205
+ if (background !== "transparent") {
206
+ push(`<rect x="${fmt(viewBox.minX)}" y="${fmt(viewBox.minY)}" width="${fmt(viewBox.width)}" height="${fmt(viewBox.height)}" fill="${escapeAttr(background)}"/>`);
207
+ }
208
+ push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(outerRadius)}" fill="${escapeAttr(palette.paper)}"/>`);
209
+ renderDefs(push, model);
210
+ renderRingGrounds(push, model);
211
+ if (model.layers.chromicRays) renderChromicRays(push, model);
212
+ if (model.layers.planetaryUtterance) renderPlanetaryUtterance(push, model);
213
+ if (model.layers.zodiacUtterance) renderZodiacUtterance(push, model);
214
+ if (model.layers.cosmologicalMusic) renderCosmologicalMusic(push, model);
215
+ if (model.layers.astralZodiac) renderAstralZodiac(push, model);
216
+ if (model.layers.astralPlanetary) renderAstralPlanetary(push, model);
217
+ if (model.layers.solarCenter) renderSolarCenter(push, model);
218
+ if (model.layers.whiteRays) renderWhiteRays(push, model);
219
+ if (model.layers.degreeCrown) renderDegreeCrown(push, model);
220
+ renderFrame(push, model);
221
+ push(`</svg>`);
222
+ return lines.join("\n");
223
+ }
224
+ function renderDefs(push, model) {
225
+ const { rings, center } = model;
226
+ const planetaryClipOuter = planetaryTriangleClipOuterRadius(rings);
227
+ const planetaryClipInner = planetaryTriangleClipInnerRadius(rings);
228
+ const chromicClipOuter = chromicCoreOuterRadius(rings);
229
+ const chromicClipInner = chromicCoreInnerRadius(rings);
230
+ push(`<defs>`);
231
+ push(
232
+ `<clipPath id="archeometer-planetary-clip"><path d="${annulusPath(
233
+ center,
234
+ planetaryClipInner,
235
+ planetaryClipOuter
236
+ )}" fill-rule="evenodd" clip-rule="evenodd"/></clipPath>`
237
+ );
238
+ push(
239
+ `<clipPath id="archeometer-chromic-clip"><path d="${annulusPath(
240
+ center,
241
+ chromicClipInner,
242
+ chromicClipOuter
243
+ )}" fill-rule="evenodd" clip-rule="evenodd"/></clipPath>`
244
+ );
245
+ push(`</defs>`);
246
+ }
247
+ function renderRingGrounds(push, model) {
248
+ const { rings, center, palette } = model;
249
+ const order = [
250
+ "degreeOuter",
251
+ "degreeInner",
252
+ "zodiacUtterance",
253
+ "planetaryUtterance",
254
+ "cosmologicalMusic",
255
+ "astralZodiac",
256
+ "astralPlanetary",
257
+ "chromicRays",
258
+ "whiteRays"
259
+ ];
260
+ push(`<g id="archeometer-ring-grounds">`);
261
+ for (const id2 of order) {
262
+ const ring = rings[id2];
263
+ push(`<path id="archeometer-ring-${id2}" d="${annulusPath(center, ring.r1, ring.r2)}" fill="${escapeAttr(palette.ringFills[id2])}" fill-rule="evenodd" stroke="none"/>`);
264
+ }
265
+ push(`</g>`);
266
+ }
267
+ function renderDegreeCrown(push, model) {
268
+ const { center, rings, palette, scale } = model;
269
+ const outer = rings.degreeOuter;
270
+ const inner = rings.degreeInner;
271
+ push(`<g id="archeometer-degree-crown" aria-label="dual 360 degree differential numerical protractor">`);
272
+ for (let degree = 0; degree < 360; degree += 30) {
273
+ const angle = angleOf(model, degree);
274
+ const pOuter = polarToXY(center, (outer.r1 + outer.r2) / 2, angle);
275
+ const pInner = polarToXY(center, (inner.r1 + inner.r2) / 2, angle);
276
+ const rot = tangentRotation(angle);
277
+ const outerText = String(normalizeDegrees(345 + degree) || 360);
278
+ const innerText = String(normalizeDegrees(15 - degree) || 360);
279
+ push(textSvg(outerText, pOuter, 8.4 * scale, palette.degreeLabel, rot, "middle"));
280
+ push(textSvg(innerText, pInner, 7.6 * scale, palette.degreeLabel, rot, "middle"));
281
+ }
282
+ push(`</g>`);
283
+ }
284
+ function renderZodiacUtterance(push, model) {
285
+ const { center, rings, palette, scale } = model;
286
+ const ring = rings.zodiacUtterance;
287
+ const sorted = sortedByDegree(model.utterance);
288
+ push(`<g id="archeometer-zodiacal-utterance" aria-label="zodiacal crown of the utterance">`);
289
+ for (let i = 0; i < 12; i++) {
290
+ const degree = i * 30;
291
+ const sector = annularSectorPath(
292
+ center,
293
+ ring.r1,
294
+ ring.r2,
295
+ angleOf(model, degree - 15),
296
+ angleOf(model, degree + 15),
297
+ 30
298
+ );
299
+ push(
300
+ `<path d="${sector}" fill="${escapeAttr(palette.ringFills.zodiacUtterance)}" fill-opacity="1" stroke="${escapeAttr(
301
+ palette.ringStroke
302
+ )}" stroke-opacity="0.34" stroke-width="${fmt(0.7 * scale)}"/>`
303
+ );
304
+ }
305
+ for (const point of sorted) {
306
+ const a = angleOf(model, point.degree);
307
+ const p = polarToXY(center, ring.r1 + (ring.r2 - ring.r1) * 0.58, a);
308
+ const shieldR = (ring.r2 - ring.r1) * 0.22;
309
+ const letterParts = point.letter.split(",").map((part) => part.trim()).filter(Boolean);
310
+ const isStacked = letterParts.length > 1;
311
+ const letterFontSize = (isStacked ? letterParts.length > 2 ? 8.3 : 10.6 : 14) * scale;
312
+ const letterLineHeight = letterFontSize * (isStacked ? 1.02 : 1);
313
+ const numberFontSize = (isStacked ? 6.6 : 7.1) * scale;
314
+ const numberGap = (isStacked ? 4.8 : 0) * scale;
315
+ const stackedNumberY = p.y + (letterParts.length - 1) * letterLineHeight / 2 + numberGap + numberFontSize * 0.42;
316
+ const singleLetterY = p.y - shieldR * 0.48;
317
+ const firstLineY = isStacked ? p.y - (letterParts.length - 1) * letterLineHeight / 2 - numberFontSize * 0.42 : singleLetterY;
318
+ const numberY = isStacked ? stackedNumberY : p.y + shieldR * 0.72;
319
+ push(
320
+ `<g class="archeometer-utterance-point" data-degree="${fmt(normalizeDegrees(point.degree))}" data-letter="${escapeAttr(
321
+ point.letter
322
+ )}">`
323
+ );
324
+ for (const [index, part] of letterParts.entries()) {
325
+ push(textSvg(part, { x: p.x, y: firstLineY + index * letterLineHeight }, letterFontSize, palette.ink, 0, "middle", 700));
326
+ }
327
+ push(textSvg(String(point.number), { x: p.x, y: numberY }, numberFontSize, palette.ink, 0, "middle"));
328
+ push(`</g>`);
329
+ }
330
+ push(`</g>`);
331
+ }
332
+ function renderPlanetaryUtterance(push, model) {
333
+ const { center, rings, palette, scale } = model;
334
+ const ring = rings.planetaryUtterance;
335
+ const clipOuter = planetaryTriangleClipOuterRadius(rings);
336
+ const vertexRadius = clipOuter;
337
+ push(`<g id="archeometer-planetary-utterance" aria-label="four trigones of the planetary utterance">`);
338
+ push(`<g clip-path="url(#archeometer-planetary-clip)">`);
339
+ for (const triangle of model.triangles) {
340
+ const vertices = triangle.vertices.map((degree) => polarToXY(center, vertexRadius, angleOf(model, degree)));
341
+ if (triangle.vertexFills) {
342
+ const centroid = polygonCentroid(vertices);
343
+ const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
344
+ for (const [index, vertex] of vertices.entries()) {
345
+ const previousMidpoint = midpoints[(index + vertices.length - 1) % vertices.length];
346
+ const nextMidpoint = midpoints[index];
347
+ push(`<path class="archeometer-trigone-vertex-fill" data-triangle="${escapeAttr(triangle.id)}" data-degree="${fmt(normalizeDegrees(triangle.vertices[index]))}" d="${polygonPath([vertex, nextMidpoint, centroid, previousMidpoint])}" fill="${escapeAttr(triangle.vertexFills[index])}" fill-opacity="0.54" stroke="none"/>`);
348
+ }
349
+ push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${polygonPath(vertices)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
350
+ } else {
351
+ push(`<path class="archeometer-trigone" data-triangle="${escapeAttr(triangle.id)}" d="${polygonPath(vertices)}" fill="${escapeAttr(triangle.fill)}" fill-opacity="0.52" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.82" stroke-width="${fmt(1.35 * scale)}"/>`);
352
+ }
353
+ }
354
+ push(`</g>`);
355
+ for (const label of sortedByDegree(model.triangleLabels)) {
356
+ if (!label.label) continue;
357
+ const a = angleOf(model, label.degree);
358
+ const labelPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.56, a);
359
+ push(textSvg(label.label, labelPoint, 12 * scale, palette.ink, 0, "middle", 700));
360
+ if (label.number !== void 0) {
361
+ const numberPoint = polarToXY(center, ring.r1 + (clipOuter - ring.r1) * 0.8, a);
362
+ push(textSvg(String(label.number), numberPoint, 7.5 * scale, palette.ink, 0, "middle", 600));
363
+ }
364
+ }
365
+ push(`</g>`);
366
+ }
367
+ function renderCosmologicalMusic(push, model) {
368
+ const { center, rings, palette, scale } = model;
369
+ const ring = rings.cosmologicalMusic;
370
+ const notes = sortedByDegree(model.musicalNotes);
371
+ push(`<g id="archeometer-cosmological-music" aria-label="cosmological musical crown">`);
372
+ push(`<path id="archeometer-music-backing" d="${annulusPath(center, ring.r1, ring.r2)}" fill="${escapeAttr(palette.paper)}" stroke="${escapeAttr(palette.ringStroke)}" stroke-opacity="0.58" stroke-width="${fmt(0.8 * scale)}" fill-rule="evenodd"/>`);
373
+ for (const note of notes) {
374
+ const point = nearestUtterance(note.degree, model.utterance);
375
+ const start = angleOf(model, note.degree - 15);
376
+ const end = angleOf(model, note.degree + 15);
377
+ const sector = annularSectorPath(center, ring.r1, ring.r2, start, end, 30);
378
+ push(`<path d="${sector}" fill="${escapeAttr(note.color ?? point?.color ?? palette.ringFills.cosmologicalMusic)}" fill-opacity="0.24" stroke="${escapeAttr(palette.ringStroke)}" stroke-opacity="0.3" stroke-width="${fmt(0.55 * scale)}"/>`);
379
+ }
380
+ for (const note of notes) {
381
+ const start = angleOf(model, note.degree - 5.5);
382
+ const end = angleOf(model, note.degree + 5.5);
383
+ for (let i = 1; i <= 5; i++) {
384
+ const r = ring.r1 + (ring.r2 - ring.r1) * i / 6;
385
+ push(`<path class="archeometer-music-staff-line" data-degree="${fmt(normalizeDegrees(note.degree))}" d="${arcSegmentPath(center, r, start, end)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.58" stroke-width="${fmt(0.48 * scale)}" stroke-linecap="round"/>`);
386
+ }
387
+ }
388
+ for (const note of notes) {
389
+ if (!note.note) continue;
390
+ const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, note.degree));
391
+ push(textSvg(note.note, p, 11.8 * scale, palette.ink, tangentRotation(angleOf(model, note.degree)), "middle", 700));
392
+ }
393
+ push(`</g>`);
394
+ }
395
+ function renderAstralZodiac(push, model) {
396
+ const { center, rings, palette, scale } = model;
397
+ const ring = rings.astralZodiac;
398
+ const ringWidth = ring.r2 - ring.r1;
399
+ push(`<g id="archeometer-astral-zodiac" aria-label="astral zodiacal crown">`);
400
+ for (const sign of sortedByDegree(model.zodiacSigns)) {
401
+ const sector = annularSectorPath(
402
+ center,
403
+ ring.r1,
404
+ ring.r2,
405
+ angleOf(model, sign.degree - 15),
406
+ angleOf(model, sign.degree + 15),
407
+ 30
408
+ );
409
+ const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
410
+ push(
411
+ `<path d="${sector}" fill="${escapeAttr(pointColor)}" fill-opacity="0.40" stroke="${escapeAttr(
412
+ palette.ringStroke
413
+ )}" stroke-opacity="0.32" stroke-width="${fmt(0.6 * scale)}"/>`
414
+ );
415
+ }
416
+ const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
417
+ const glyphSize = 17.5 * scale;
418
+ for (const sign of sortedByDegree(model.zodiacSigns)) {
419
+ const pointColor = triangleVertexFillForDegree(model, sign.degree) ?? sign.color ?? nearestUtterance(sign.degree, model.utterance)?.color ?? palette.ringFills.astralZodiac;
420
+ const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, sign.degree));
421
+ push(
422
+ `<g class="archeometer-zodiac-sign" data-sign="${escapeAttr(sign.name)}" data-degree="${fmt(
423
+ normalizeDegrees(sign.degree)
424
+ )}">`
425
+ );
426
+ push(
427
+ `<circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(markerRadius)}" fill="${escapeAttr(
428
+ pointColor
429
+ )}" fill-opacity="0.48" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.75 * scale)}"/>`
430
+ );
431
+ push(textSvg(sign.glyph, p, glyphSize, palette.ink, 0, "middle"));
432
+ push(`</g>`);
433
+ }
434
+ push(`</g>`);
435
+ }
436
+ function renderAstralPlanetary(push, model) {
437
+ const { center, rings, palette, scale } = model;
438
+ const ring = rings.astralPlanetary;
439
+ const ringWidth = ring.r2 - ring.r1;
440
+ push(`<g id="archeometer-astral-planetary" aria-label="astral planetary crown">`);
441
+ for (const planet of sortedByDegree(model.planetaryPoints)) {
442
+ const pointColor = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ringFills.astralPlanetary;
443
+ const sector = annularSectorPath(
444
+ center,
445
+ ring.r1,
446
+ ring.r2,
447
+ angleOf(model, planet.degree - 15),
448
+ angleOf(model, planet.degree + 15),
449
+ 30
450
+ );
451
+ push(
452
+ `<path class="archeometer-astral-planetary-sector" data-degree="${fmt(
453
+ normalizeDegrees(planet.degree)
454
+ )}" d="${sector}" fill="${escapeAttr(pointColor)}" fill-opacity="0.36" stroke="none"/>`
455
+ );
456
+ }
457
+ for (let degree = 15; degree < 360; degree += 30) {
458
+ const line = lineFromPolar(center, ring.r1, ring.r2, angleOf(model, degree));
459
+ push(lineSvg(line, palette.ringStroke, 0.6 * scale, 0.42, "archeometer-astral-planetary-divider", ` data-degree="${fmt(degree)}"`));
460
+ }
461
+ const markerRadius = Math.min(ringWidth * 0.33, 13 * scale);
462
+ for (const planet of sortedByDegree(model.planetaryPoints)) {
463
+ const p = polarToXY(center, (ring.r1 + ring.r2) / 2, angleOf(model, planet.degree));
464
+ const color = triangleVertexFillForDegree(model, planet.degree) ?? planet.color ?? nearestUtterance(planet.degree, model.utterance)?.color ?? palette.ink;
465
+ const glyphSize = (planet.name === "Moon" ? 17 : 18.5) * scale;
466
+ push(
467
+ `<g class="archeometer-planet" data-planet="${escapeAttr(planet.name)}" data-degree="${fmt(
468
+ normalizeDegrees(planet.degree)
469
+ )}">`
470
+ );
471
+ push(
472
+ `<circle cx="${fmt(p.x)}" cy="${fmt(p.y)}" r="${fmt(markerRadius)}" fill="${escapeAttr(
473
+ color
474
+ )}" fill-opacity="0.44" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.8 * scale)}"/>`
475
+ );
476
+ push(textSvg(planet.glyph, p, glyphSize, palette.ink, 0, "middle"));
477
+ push(`</g>`);
478
+ }
479
+ push(`</g>`);
480
+ }
481
+ function renderChromicRays(push, model) {
482
+ push(`<g id="archeometer-chromic-rays" aria-label="dodecagonal crown of chromic circum-solar rays">`);
483
+ push(`<g clip-path="url(#archeometer-chromic-clip)">`);
484
+ renderChromicTriangleCore(push, model);
485
+ push(`</g>`);
486
+ push(`</g>`);
487
+ }
488
+ function renderChromicTriangleCore(push, model) {
489
+ const { center, rings, palette, scale } = model;
490
+ const trianglesById = new Map(model.triangles.map((triangle) => [triangle.id, triangle]));
491
+ const wordJesus = trianglesById.get("wordJesus");
492
+ const mary = trianglesById.get("mary");
493
+ const ether = trianglesById.get("ether");
494
+ const divineFire = trianglesById.get("divineFire");
495
+ const chromicOuter = chromicCoreOuterRadius(rings);
496
+ const chromic = (x, y) => scaleArcheometerReferencePoint(center, chromicOuter, x, y);
497
+ const path = (...commands) => commands.join(" ");
498
+ const move = (x, y) => {
499
+ const p = chromic(x, y);
500
+ return `M ${fmt(p.x)} ${fmt(p.y)}`;
501
+ };
502
+ const line = (x, y) => {
503
+ const p = chromic(x, y);
504
+ return `L ${fmt(p.x)} ${fmt(p.y)}`;
505
+ };
506
+ const cubic = (x1, y1, x2, y2, x, y) => {
507
+ const c1 = chromic(x1, y1);
508
+ const c2 = chromic(x2, y2);
509
+ const p = chromic(x, y);
510
+ return `C ${fmt(c1.x)} ${fmt(c1.y)} ${fmt(c2.x)} ${fmt(c2.y)} ${fmt(p.x)} ${fmt(p.y)}`;
511
+ };
512
+ const strokeWidth = fmt(1.4 * scale);
513
+ const facetStrokeWidth = fmt(0.85 * scale);
514
+ const primaryFacetStrokeWidth = fmt(0.95 * scale);
515
+ const primaryStroke = wordJesus?.stroke ?? palette.ink;
516
+ push(`<g id="archeometer-chromic-triangle-core" aria-label="inner chromic primary triangle core">`);
517
+ push(`<path class="archeometer-chromic-foundation" data-triangle="ether" d="${path(move(1.3999, 137.047), line(204.875, 19.5703), line(204.875, 254.523), "Z")}" fill="${escapeAttr(ether?.fill ?? "#78BD79")}" stroke="${escapeAttr(palette.ink)}" stroke-width="${strokeWidth}"/>`);
518
+ push(`<path class="archeometer-chromic-foundation" data-triangle="divineFire" d="${path(move(272.7, 137.047), line(69.2251, 254.523), line(69.2251, 19.5703), "Z")}" fill="${escapeAttr(divineFire?.fill ?? "#CC58A1")}" stroke="${escapeAttr(palette.ink)}" stroke-width="${strokeWidth}"/>`);
519
+ push(`<path class="archeometer-chromic-foundation" data-triangle="mary" d="${path(move(137.05, 272.702), line(19.5737, 69.2266), line(254.527, 69.2266), "Z")}" fill="${escapeAttr(mary?.fill ?? "#E25B61")}" stroke="${escapeAttr(palette.ink)}" stroke-width="${strokeWidth}"/>`);
520
+ for (const triangle of [ether, divineFire, mary]) {
521
+ if (!triangle?.vertexFills) continue;
522
+ const vertices = triangle.vertices.map((degree) => polarToXY(center, chromicOuter, angleOf(model, degree)));
523
+ const centroid = polygonCentroid(vertices);
524
+ const midpoints = vertices.map((vertex, index) => midpoint(vertex, vertices[(index + 1) % vertices.length]));
525
+ for (const [index, vertex] of vertices.entries()) {
526
+ const previousMidpoint = midpoints[(index + vertices.length - 1) % vertices.length];
527
+ const nextMidpoint = midpoints[index];
528
+ push(`<path class="archeometer-chromic-trigone-facet" data-triangle="${escapeAttr(triangle.id)}" data-degree="${fmt(normalizeDegrees(triangle.vertices[index]))}" d="${polygonPath([vertex, nextMidpoint, centroid, previousMidpoint])}" fill="${escapeAttr(triangle.vertexFills[index])}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.72" stroke-width="${facetStrokeWidth}"/>`);
529
+ }
530
+ }
531
+ push(`<path class="archeometer-chromic-primary-facet" data-triangle="wordJesus" data-degree="120" d="${path(move(137.05, 204.874), line(254.527, 204.874), line(195.789, 103.136), cubic(195.789, 103.136, 215.377, 136.525, 195.789, 170.699), cubic(176.2, 204.874, 137.05, 204.874, 137.05, 204.874), "Z")}" fill="${escapeAttr(wordJesus?.vertexFills?.[1] ?? "#5470A5")}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.78" stroke-width="${primaryFacetStrokeWidth}"/>`);
532
+ push(`<path class="archeometer-chromic-primary-facet" data-triangle="wordJesus" data-degree="240" d="${path(move(19.5737, 204.874), line(137.05, 204.874), cubic(137.05, 204.874, 94.7002, 203.927, 78.312, 170.699), cubic(61.9238, 137.472, 78.312, 103.136, 78.312, 103.136), line(19.5737, 204.874), "Z")}" fill="${escapeAttr(wordJesus?.vertexFills?.[2] ?? "#DD3E38")}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.78" stroke-width="${primaryFacetStrokeWidth}"/>`);
533
+ push(`<path class="archeometer-chromic-primary-facet" data-triangle="wordJesus" data-degree="0" fill-rule="evenodd" clip-rule="evenodd" d="${path(move(195.789, 103.136), line(137.05, 1.39844), line(78.312, 103.136), cubic(78.312, 103.136, 100.9, 71.1992, 137.05, 71.1992), cubic(173.2, 71.1992, 195.789, 103.136, 195.789, 103.136), "Z")}" fill="${escapeAttr(wordJesus?.vertexFills?.[0] ?? "#F2CF45")}" stroke="${escapeAttr(palette.ink)}" stroke-opacity="0.78" stroke-width="${primaryFacetStrokeWidth}"/>`);
534
+ push(`<path class="archeometer-chromic-primary-outline" data-triangle="wordJesus" d="${path(
535
+ move(137.05, 204.874),
536
+ line(254.527, 204.874),
537
+ line(195.789, 103.136),
538
+ move(137.05, 204.874),
539
+ line(19.5737, 204.874),
540
+ line(78.312, 103.136),
541
+ move(137.05, 204.874),
542
+ cubic(137.05, 204.874, 94.7002, 203.927, 78.312, 170.699),
543
+ cubic(61.9238, 137.472, 78.312, 103.136, 78.312, 103.136),
544
+ move(137.05, 204.874),
545
+ cubic(137.05, 204.874, 176.2, 204.874, 195.789, 170.699),
546
+ cubic(215.377, 136.525, 195.789, 103.136, 195.789, 103.136),
547
+ move(195.789, 103.136),
548
+ line(137.05, 1.39844),
549
+ line(78.312, 103.136),
550
+ move(195.789, 103.136),
551
+ cubic(195.789, 103.136, 173.2, 71.1992, 137.05, 71.1992),
552
+ cubic(100.9, 71.1992, 78.312, 103.136, 78.312, 103.136)
553
+ )}" fill="none" stroke="${escapeAttr(primaryStroke)}" stroke-width="${strokeWidth}"/>`);
554
+ push(`</g>`);
555
+ }
556
+ function renderWhiteRays(push, model) {
557
+ const { center, rings, palette, scale } = model;
558
+ const solarRadius = rings.solarCenter.r2;
559
+ const sunCenterCircleRadiusWithPadding = 3 + 0.3;
560
+ push(`<g id="archeometer-white-rays" aria-label="crown of white rays and musical staff">`);
561
+ for (let degree = 0; degree < 180; degree += 30) {
562
+ if (degree === 90 || degree === 270) continue;
563
+ push(lineSvg(lineFromPolar(center, solarRadius, sunCenterCircleRadiusWithPadding, angleOf(model, degree)), palette.whiteRay, 1.55 * scale, 0.92));
564
+ push(lineSvg(lineFromPolar(center, solarRadius, sunCenterCircleRadiusWithPadding, angleOf(model, degree + 180)), palette.whiteRay, 1.55 * scale, 0.92));
565
+ }
566
+ push(`</g>`);
567
+ }
568
+ function renderSolarCenter(push, model) {
569
+ const { center, rings, palette, scale } = model;
570
+ const r = rings.solarCenter.r2;
571
+ const innerR = r * 0.68;
572
+ const arcStart = polarToXY(center, innerR * 0.72, deg2rad(240));
573
+ const arcEnd = polarToXY(center, innerR * 0.72, deg2rad(300));
574
+ const paddingTop = 22;
575
+ const sunCenterCircleRadius = 3;
576
+ push(`<g id="archeometer-solar-center" aria-label="solar center Mi">`);
577
+ push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(r)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.2 * scale)}"/>`);
578
+ push(lineSvg({ x1: center.x - innerR - 13, x2: center.x + innerR + 13, y1: center.y - 1.5, y2: center.y - 1.5 }, palette.whiteRay, 1.55 * scale, 0.92));
579
+ push(lineSvg({ x1: center.x - innerR - 13, x2: center.x + innerR + 13, y1: center.y, y2: center.y }, palette.whiteRay, 1.55 * scale, 0.92));
580
+ push(lineSvg({ x1: center.x - innerR - 13, x2: center.x + innerR + 13, y1: center.y + 1.5, y2: center.y + 1.5 }, palette.whiteRay, 1.55 * scale, 0.92));
581
+ push(`<line x1="${fmt(center.x - innerR - 2.5)}" y1="${fmt(center.y + 8 + paddingTop)}" x2="${fmt(center.x + innerR + 2.5)}" y2="${fmt(center.y + 8 + paddingTop)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
582
+ push(`<line x1="${fmt(center.x - innerR - 7.5)}" y1="${fmt(center.y + paddingTop)}" x2="${fmt(center.x + innerR + 7.5)}" y2="${fmt(center.y + paddingTop)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
583
+ push(`<line x1="${fmt(center.x - innerR - 11)}" y1="${fmt(center.y - 8 + paddingTop)}" x2="${fmt(center.x + innerR + 11)}" y2="${fmt(center.y - 8 + paddingTop)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
584
+ push(`<path d="M ${fmt(arcStart.x)} ${fmt(arcStart.y)} A ${fmt(innerR * 0.72)} ${fmt(innerR * 0.72)} 0 0 1 ${fmt(arcEnd.x)} ${fmt(arcEnd.y)}" fill="none" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(1.1 * scale)}"/>`);
585
+ push(`<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(sunCenterCircleRadius)}" fill="${escapeAttr(palette.paper)}" stroke="${escapeAttr(palette.ink)}" stroke-width="${fmt(0.5 * scale)}"/>`);
586
+ push(`</g>`);
587
+ }
588
+ function renderFrame(push, model) {
589
+ const { center, rings, palette, scale } = model;
590
+ const radii = Array.from(
591
+ new Map(
592
+ [
593
+ rings.degreeOuter.r2,
594
+ rings.degreeOuter.r1,
595
+ rings.degreeInner.r1,
596
+ rings.zodiacUtterance.r1,
597
+ rings.planetaryUtterance.r1,
598
+ rings.cosmologicalMusic.r1,
599
+ rings.astralZodiac.r1,
600
+ rings.astralPlanetary.r1,
601
+ rings.chromicRays.r1,
602
+ rings.solarCenter.r2
603
+ ].map((radius) => [fmt(radius), radius])
604
+ ).values()
605
+ );
606
+ push(`<g id="archeometer-frame" aria-hidden="true">`);
607
+ for (const radius of radii) {
608
+ if (radius <= 0) continue;
609
+ push(
610
+ `<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(radius)}" fill="none" stroke="${escapeAttr(
611
+ palette.ringStroke
612
+ )}" stroke-opacity="0.82" stroke-width="${fmt(0.85 * scale)}"/>`
613
+ );
614
+ }
615
+ push(
616
+ `<circle cx="${fmt(center.x)}" cy="${fmt(center.y)}" r="${fmt(
617
+ rings.degreeOuter.r2
618
+ )}" fill="none" stroke="${escapeAttr(palette.ringStroke)}" stroke-width="${fmt(2.2 * scale)}"/>`
619
+ );
620
+ push(`</g>`);
621
+ }
622
+ function buildRings(contentRadius, frameRadius = contentRadius) {
623
+ const ring = (id2, r1, r2, radius = contentRadius) => ({
624
+ id: id2,
625
+ r1: round(radius * r1),
626
+ r2: round(radius * r2)
627
+ });
628
+ return {
629
+ degreeOuter: ring("degreeOuter", 0.955, 1, frameRadius),
630
+ degreeInner: {
631
+ id: "degreeInner",
632
+ r1: round(contentRadius * 0.955),
633
+ r2: round(frameRadius * 0.955)
634
+ },
635
+ zodiacUtterance: ring("zodiacUtterance", 0.8, 0.955),
636
+ planetaryUtterance: ring("planetaryUtterance", 0.461, 0.8),
637
+ cosmologicalMusic: ring("cosmologicalMusic", 0.395, 0.461),
638
+ astralZodiac: ring("astralZodiac", 0.297, 0.395),
639
+ astralPlanetary: ring("astralPlanetary", 0.198, 0.297),
640
+ chromicRays: ring("chromicRays", 0.198, 0.395),
641
+ whiteRays: ring("whiteRays", 0.12, 0.198),
642
+ solarCenter: ring("solarCenter", 0, 0.099)
643
+ };
644
+ }
645
+ function planetaryTriangleClipInnerRadius(rings) {
646
+ return rings.planetaryUtterance.r1;
647
+ }
648
+ function planetaryTriangleClipOuterRadius(rings) {
649
+ return rings.planetaryUtterance.r2;
650
+ }
651
+ function chromicCoreInnerRadius(rings) {
652
+ return rings.solarCenter.r2;
653
+ }
654
+ function chromicCoreOuterRadius(rings) {
655
+ return rings.whiteRays.r2;
656
+ }
657
+ function resolvePalette(palette) {
658
+ const base = COLOR_PALETTE;
659
+ const overrides = typeof palette === "object" ? palette : {};
660
+ return {
661
+ paper: overrides.paper ?? base.paper,
662
+ ink: overrides.ink ?? base.ink,
663
+ subtleInk: overrides.subtleInk ?? base.subtleInk,
664
+ ringStroke: overrides.ringStroke ?? base.ringStroke,
665
+ degreeTick: overrides.degreeTick ?? base.degreeTick,
666
+ degreeLabel: overrides.degreeLabel ?? base.degreeLabel,
667
+ whiteRay: overrides.whiteRay ?? base.whiteRay,
668
+ ringFills: { ...base.ringFills, ...overrides.ringFills ?? {} }
669
+ };
670
+ }
671
+ function normalizeViewBox(viewBox) {
672
+ return {
673
+ minX: viewBox?.minX ?? ARCHEOMETER_DEFAULT_VIEWBOX.minX,
674
+ minY: viewBox?.minY ?? ARCHEOMETER_DEFAULT_VIEWBOX.minY,
675
+ width: viewBox?.width ?? ARCHEOMETER_DEFAULT_VIEWBOX.width,
676
+ height: viewBox?.height ?? ARCHEOMETER_DEFAULT_VIEWBOX.height
677
+ };
678
+ }
679
+ function angleOf(model, degree) {
680
+ return deg2rad(degree + model.rotationDegrees - 90);
681
+ }
682
+ function polarToXY(center, radius, angleRad) {
683
+ return {
684
+ x: round(center.x + Math.cos(angleRad) * radius),
685
+ y: round(center.y + Math.sin(angleRad) * radius)
686
+ };
687
+ }
688
+ function scaleArcheometerReferencePoint(center, radius, x, y) {
689
+ const referenceCenter = 137.05;
690
+ const referenceRadius = 135.652;
691
+ const scale = radius / referenceRadius;
692
+ return {
693
+ x: round(center.x + (x - referenceCenter) * scale),
694
+ y: round(center.y + (y - referenceCenter) * scale)
695
+ };
696
+ }
697
+ function lineFromPolar(center, r1, r2, angleRad) {
698
+ const p1 = polarToXY(center, r1, angleRad);
699
+ const p2 = polarToXY(center, r2, angleRad);
700
+ return { x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y };
701
+ }
702
+ function lineSvg(line, color, strokeWidth, opacity = 1, className, attributes = "") {
703
+ const classAttr = className ? ` class="${escapeAttr(className)}"` : "";
704
+ return `<line${classAttr}${attributes} x1="${fmt(line.x1)}" y1="${fmt(line.y1)}" x2="${fmt(line.x2)}" y2="${fmt(line.y2)}" stroke="${escapeAttr(color)}" stroke-opacity="${fmt(opacity)}" stroke-width="${fmt(strokeWidth)}" stroke-linecap="round"/>`;
705
+ }
706
+ function textSvg(value, p, fontSize, color, rotation = 0, anchor = "middle", weight, className, attributes = "") {
707
+ const transform = rotation ? ` transform="rotate(${fmt(rotation)} ${fmt(p.x)} ${fmt(p.y)})"` : "";
708
+ const weightAttr = weight ? ` font-weight="${weight}"` : "";
709
+ const classAttr = "";
710
+ return `<text${classAttr}${attributes} x="${fmt(p.x)}" y="${fmt(p.y)}"${transform} font-family="${textFontFamily()}" font-size="${fmt(fontSize)}" text-anchor="${anchor}" dominant-baseline="middle" fill="${escapeAttr(color)}"${weightAttr}>${escapeText(value)}</text>`;
711
+ }
712
+ function annulusPath(center, r1, r2) {
713
+ return [
714
+ `M ${fmt(center.x)} ${fmt(center.y - r2)}`,
715
+ `A ${fmt(r2)} ${fmt(r2)} 0 1 1 ${fmt(center.x)} ${fmt(center.y + r2)}`,
716
+ `A ${fmt(r2)} ${fmt(r2)} 0 1 1 ${fmt(center.x)} ${fmt(center.y - r2)}`,
717
+ `M ${fmt(center.x)} ${fmt(center.y - r1)}`,
718
+ `A ${fmt(r1)} ${fmt(r1)} 0 1 0 ${fmt(center.x)} ${fmt(center.y + r1)}`,
719
+ `A ${fmt(r1)} ${fmt(r1)} 0 1 0 ${fmt(center.x)} ${fmt(center.y - r1)}`,
720
+ `Z`
721
+ ].join(" ");
722
+ }
723
+ function annularSectorPath(center, r1, r2, startAngle, endAngle, spanDegrees) {
724
+ const outerStart = polarToXY(center, r2, startAngle);
725
+ const outerEnd = polarToXY(center, r2, endAngle);
726
+ const innerEnd = polarToXY(center, r1, endAngle);
727
+ const innerStart = polarToXY(center, r1, startAngle);
728
+ const largeArc = Math.abs(spanDegrees) > 180 ? 1 : 0;
729
+ const sweep = 1 ;
730
+ const inverseSweep = 0 ;
731
+ return [
732
+ `M ${fmt(outerStart.x)} ${fmt(outerStart.y)}`,
733
+ `A ${fmt(r2)} ${fmt(r2)} 0 ${largeArc} ${sweep} ${fmt(outerEnd.x)} ${fmt(outerEnd.y)}`,
734
+ `L ${fmt(innerEnd.x)} ${fmt(innerEnd.y)}`,
735
+ `A ${fmt(r1)} ${fmt(r1)} 0 ${largeArc} ${inverseSweep} ${fmt(innerStart.x)} ${fmt(innerStart.y)}`,
736
+ `Z`
737
+ ].join(" ");
738
+ }
739
+ function arcSegmentPath(center, radius, startAngle, endAngle) {
740
+ const start = polarToXY(center, radius, startAngle);
741
+ const end = polarToXY(center, radius, endAngle);
742
+ return `M ${fmt(start.x)} ${fmt(start.y)} A ${fmt(radius)} ${fmt(radius)} 0 0 1 ${fmt(end.x)} ${fmt(end.y)}`;
743
+ }
744
+ function polygonPath(points) {
745
+ if (points.length === 0) return "";
746
+ const [first, ...rest] = points;
747
+ return [`M ${fmt(first.x)} ${fmt(first.y)}`, ...rest.map((p) => `L ${fmt(p.x)} ${fmt(p.y)}`), "Z"].join(" ");
748
+ }
749
+ function midpoint(a, b) {
750
+ return { x: round((a.x + b.x) / 2), y: round((a.y + b.y) / 2) };
751
+ }
752
+ function polygonCentroid(points) {
753
+ const total = points.reduce(
754
+ (sum, point) => ({ x: sum.x + point.x, y: sum.y + point.y }),
755
+ { x: 0, y: 0 }
756
+ );
757
+ return { x: round(total.x / points.length), y: round(total.y / points.length) };
758
+ }
759
+ function sortedByDegree(items) {
760
+ return [...items].sort((a, b) => normalizeDegrees(a.degree) - normalizeDegrees(b.degree));
761
+ }
762
+ function nearestUtterance(degree, utterance) {
763
+ let best;
764
+ let bestDelta = Number.POSITIVE_INFINITY;
765
+ for (const point of utterance) {
766
+ const delta = Math.abs(shortestAngularDistance(degree, point.degree));
767
+ if (delta < bestDelta) {
768
+ best = point;
769
+ bestDelta = delta;
770
+ }
771
+ }
772
+ return best;
773
+ }
774
+ function triangleVertexFillForDegree(model, degree) {
775
+ for (const triangle of model.triangles) {
776
+ if (!triangle.vertexFills) continue;
777
+ for (const [index, vertexDegree] of triangle.vertices.entries()) {
778
+ if (Math.abs(shortestAngularDistance(degree, vertexDegree)) < 1e-3) {
779
+ return triangle.vertexFills[index];
780
+ }
781
+ }
782
+ }
783
+ return void 0;
784
+ }
785
+ function tangentRotation(angleRad) {
786
+ let degrees = rad2deg(angleRad) + 90;
787
+ degrees = (degrees % 360 + 360) % 360;
788
+ if (degrees > 90 && degrees < 270) degrees += 180;
789
+ return (degrees % 360 + 360) % 360;
790
+ }
791
+ function shortestAngularDistance(a, b) {
792
+ return (normalizeDegrees(a) - normalizeDegrees(b) + 540) % 360 - 180;
793
+ }
794
+ function normalizeDegrees(value) {
795
+ return (value % 360 + 360) % 360;
796
+ }
797
+ function deg2rad(degrees) {
798
+ return degrees * (TAU / 360);
799
+ }
800
+ function rad2deg(radians) {
801
+ return radians * (360 / TAU);
802
+ }
803
+ function round(value) {
804
+ return Math.round(value * 1e3) / 1e3;
805
+ }
806
+ function fmt(value) {
807
+ if (!Number.isFinite(value)) return "0";
808
+ return Number.isInteger(value) ? String(value) : value.toFixed(3).replace(/0+$/, "").replace(/\.$/, "");
809
+ }
810
+ function escapeAttr(value) {
811
+ return escapeText(value).replace(/"/g, "&quot;");
812
+ }
813
+ function escapeText(value) {
814
+ return String(value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
815
+ }
816
+ function textFontFamily() {
817
+ return "Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'Segoe UI Symbol', 'Apple Symbols', sans-serif";
818
+ }
819
+
3
820
  // src/visual/astro-glyph-assets.ts
4
821
  var rawGlyph = (markup) => [
5
822
  { kind: "raw", markup }
@@ -248,8 +1065,15 @@ function titleCaseGlyphKey(value) {
248
1065
  }
249
1066
 
250
1067
  // src/visual/astro-wheel.ts
251
- var TAU = Math.PI * 2;
1068
+ var TAU2 = Math.PI * 2;
252
1069
  var GLYPH_OUTLINE_FILTER_ID = "astro-wheel-glyph-outline";
1070
+ var DEFAULT_ASTRO_WHEEL_RING_FRACTIONS = {
1071
+ houses: 7,
1072
+ zodiac: 13,
1073
+ planets: 27,
1074
+ aspects: 53
1075
+ };
1076
+ var DEFAULT_POINT_DISPLACEMENT_DEGREES = 20;
253
1077
  var ASTRO_WHEEL_DEFAULT_VIEWBOX = {
254
1078
  minX: 0,
255
1079
  minY: 0,
@@ -392,10 +1216,10 @@ function generateGlyphSvg(primitives, options = {}) {
392
1216
  const push = (s) => lines.push(s);
393
1217
  push(`<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">`);
394
1218
  if (bg !== "transparent") {
395
- push(`<rect width="${size}" height="${size}" fill="${escapeAttr(bg)}"/>`);
1219
+ push(`<rect width="${size}" height="${size}" fill="${escapeAttr2(bg)}"/>`);
396
1220
  }
397
1221
  const glyphFill = bg === "transparent" ? "#fff" : bg;
398
- push(`<g transform="translate(${cx} ${cy}) scale(${fmt(scale)})" color="${escapeAttr(color)}" fill="${escapeAttr(fillVal)}" stroke="${escapeAttr(color)}" stroke-width="${fmt(sw)}" stroke-linecap="round" stroke-linejoin="round">`);
1222
+ push(`<g transform="translate(${cx} ${cy}) scale(${fmt2(scale)})" color="${escapeAttr2(color)}" fill="${escapeAttr2(fillVal)}" stroke="${escapeAttr2(color)}" stroke-width="${fmt2(sw)}" stroke-linecap="round" stroke-linejoin="round">`);
399
1223
  renderGlyphPrimitives(push, primitives, { color, glyphFill });
400
1224
  push(`</g>`);
401
1225
  push(`</svg>`);
@@ -407,39 +1231,41 @@ function generateAstroGlyphSvg(keyOrGlyph, options = {}) {
407
1231
  throw new Error(`Unknown astrology glyph: ${String(keyOrGlyph)}`);
408
1232
  }
409
1233
  const svg = generateGlyphSvg(glyph.primitives, options);
410
- return svg.replace("<svg ", `<svg data-astro-glyph="${escapeAttr(glyph.key)}" data-astro-glyph-category="${glyph.category}" `);
1234
+ return svg.replace("<svg ", `<svg data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" `);
411
1235
  }
412
1236
  function getAstroWheelRenderModel(chart, options = {}) {
413
- const viewBox = normalizeViewBox(options.viewBox);
414
- const palette = resolvePalette(options.palette, options.background ?? "transparent");
1237
+ const viewBox = normalizeViewBox2(options.viewBox);
1238
+ const palette = resolvePalette2(options.palette, options.background ?? "transparent");
415
1239
  const excludedBodies = resolveExcludedBodies(options.excludeBodies);
416
1240
  const scale = Math.min(
417
1241
  viewBox.width / ASTRO_WHEEL_DEFAULT_VIEWBOX.width,
418
1242
  viewBox.height / ASTRO_WHEEL_DEFAULT_VIEWBOX.height
419
1243
  );
420
- const padding = options.padding ?? round(18 * scale + getExternalPointPadding(options, scale));
1244
+ const padding = options.padding ?? round2(18 * scale + getExternalPointPadding(options, scale));
421
1245
  const center = {
422
- x: round(viewBox.minX + viewBox.width / 2),
423
- y: round(viewBox.minY + viewBox.height / 2)
1246
+ x: round2(viewBox.minX + viewBox.width / 2),
1247
+ y: round2(viewBox.minY + viewBox.height / 2)
424
1248
  };
425
- const outerRadius = round(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
426
- const angleOf = (longitude) => deg2rad(clamp360(180 + chart.houses.ascendant.longitude - longitude));
427
- const rings = buildRings(outerRadius);
1249
+ const outerRadius = round2(Math.max(0, Math.min(viewBox.width, viewBox.height) / 2 - padding));
1250
+ const angleOf2 = (longitude) => deg2rad2(clamp360(180 + chart.houses.ascendant.longitude - longitude));
1251
+ const rings = buildRings2(outerRadius, options.layout?.rings);
1252
+ const pointConnectorMode = options.layout?.pointConnectors ?? "auto";
1253
+ const maxPointDisplacementDegrees = options.layout?.maxPointDisplacementDegrees ?? DEFAULT_POINT_DISPLACEMENT_DEGREES;
428
1254
  const resolvedPoints = resolvePointOptions(options.points);
429
1255
  const resolvedHouses = resolveHouseOptions(options.houses);
430
1256
  const resolvedAspects = resolveAspectOptions(options.aspects);
431
- const zodiacSegments = buildZodiacSegments({ center, angleOf, rings, scale, palette });
1257
+ const zodiacSegments = buildZodiacSegments({ center, angleOf: angleOf2, rings, scale, palette });
432
1258
  const houseCusps = resolvedHouses.cuspLines || resolvedHouses.labels ? buildHouseCusps({
433
1259
  houses: chart.houses.houses,
434
1260
  center,
435
- angleOf,
1261
+ angleOf: angleOf2,
436
1262
  rings,
437
1263
  scale
438
1264
  }) : [];
439
1265
  const angleMarkers = resolvedHouses.angles ? buildAngleMarkers({
440
1266
  chart,
441
1267
  center,
442
- angleOf,
1268
+ angleOf: angleOf2,
443
1269
  rings,
444
1270
  scale
445
1271
  }) : [];
@@ -456,21 +1282,25 @@ function getAstroWheelRenderModel(chart, options = {}) {
456
1282
  collisionThresholdDegrees: resolvedPoints.collisionThresholdDegrees
457
1283
  },
458
1284
  center,
459
- angleOf,
1285
+ angleOf: angleOf2,
460
1286
  rings,
461
1287
  scale,
462
1288
  palette,
463
- excludedBodies
1289
+ excludedBodies,
1290
+ pointConnectorMode,
1291
+ maxDisplacementDegrees: maxPointDisplacementDegrees
464
1292
  });
465
1293
  const extraPointLayers = (options.pointLayers ?? []).map(
466
1294
  (layer) => buildPointLayer({
467
1295
  layer,
468
1296
  center,
469
- angleOf,
1297
+ angleOf: angleOf2,
470
1298
  rings,
471
1299
  scale,
472
1300
  palette,
473
- excludedBodies
1301
+ excludedBodies,
1302
+ pointConnectorMode,
1303
+ maxDisplacementDegrees: maxPointDisplacementDegrees
474
1304
  })
475
1305
  );
476
1306
  const pointLayers = [
@@ -490,7 +1320,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
490
1320
  chart,
491
1321
  pointByKey,
492
1322
  center,
493
- angleOf,
1323
+ angleOf: angleOf2,
494
1324
  rings,
495
1325
  palette,
496
1326
  excludedBodies
@@ -501,7 +1331,7 @@ function getAstroWheelRenderModel(chart, options = {}) {
501
1331
  chart: layer.chart ?? chart,
502
1332
  pointByKey,
503
1333
  center,
504
- angleOf,
1334
+ angleOf: angleOf2,
505
1335
  rings,
506
1336
  palette,
507
1337
  excludedBodies
@@ -540,19 +1370,19 @@ function generateAstroWheelSvg(chart, options = {}) {
540
1370
  const push = (line) => lines.push(line);
541
1371
  const svgAttributes = [
542
1372
  `xmlns="http://www.w3.org/2000/svg"`,
543
- options.width !== void 0 ? `width="${escapeAttr(String(options.width))}"` : "",
544
- options.height !== void 0 ? `height="${escapeAttr(String(options.height))}"` : "",
545
- `viewBox="${fmt(viewBox.minX)} ${fmt(viewBox.minY)} ${fmt(viewBox.width)} ${fmt(viewBox.height)}"`,
1373
+ options.width !== void 0 ? `width="${escapeAttr2(String(options.width))}"` : "",
1374
+ options.height !== void 0 ? `height="${escapeAttr2(String(options.height))}"` : "",
1375
+ `viewBox="${fmt2(viewBox.minX)} ${fmt2(viewBox.minY)} ${fmt2(viewBox.width)} ${fmt2(viewBox.height)}"`,
546
1376
  `preserveAspectRatio="xMidYMid meet"`,
547
1377
  `role="img"`,
548
- `aria-label="${escapeAttr(options.title ?? "Astrological birth chart wheel")}"`
1378
+ `aria-label="${escapeAttr2(options.title ?? "Astrological birth chart wheel")}"`
549
1379
  ].filter(Boolean);
550
1380
  push(`<svg ${svgAttributes.join(" ")}>`);
551
- push(`<title>${escapeText(options.title ?? "Astrological birth chart wheel")}</title>`);
1381
+ push(`<title>${escapeText2(options.title ?? "Astrological birth chart wheel")}</title>`);
552
1382
  renderSvgDefs(push, model);
553
1383
  if (background !== "transparent") {
554
1384
  push(
555
- `<rect x="${fmt(viewBox.minX)}" y="${fmt(viewBox.minY)}" width="${fmt(viewBox.width)}" height="${fmt(viewBox.height)}" fill="${escapeAttr(background)}"/>`
1385
+ `<rect x="${fmt2(viewBox.minX)}" y="${fmt2(viewBox.minY)}" width="${fmt2(viewBox.width)}" height="${fmt2(viewBox.height)}" fill="${escapeAttr2(background)}"/>`
556
1386
  );
557
1387
  }
558
1388
  renderAspects(push, model);
@@ -569,10 +1399,10 @@ function renderSvgDefs(push, model) {
569
1399
  `<filter id="${GLYPH_OUTLINE_FILTER_ID}" x="-45%" y="-45%" width="190%" height="190%">`
570
1400
  );
571
1401
  push(
572
- `<feMorphology in="SourceAlpha" operator="dilate" radius="${fmt(1.75 * model.scale)}" result="dilated"/>`
1402
+ `<feMorphology in="SourceAlpha" operator="dilate" radius="${fmt2(1.75 * model.scale)}" result="dilated"/>`
573
1403
  );
574
1404
  push(
575
- `<feFlood flood-color="${escapeAttr(model.palette.glyphHalo)}" result="haloColor"/>`
1405
+ `<feFlood flood-color="${escapeAttr2(model.palette.glyphHalo)}" result="haloColor"/>`
576
1406
  );
577
1407
  push(
578
1408
  `<feComposite in="haloColor" in2="dilated" operator="in" result="outline"/>`
@@ -592,22 +1422,22 @@ function renderAspects(push, model) {
592
1422
  const innerGuideRadius = guideRadius * 0.52;
593
1423
  push(`<g id="astro-wheel-aspects" aria-label="aspects">`);
594
1424
  push(
595
- `<circle cx="${fmt(model.center.x)}" cy="${fmt(model.center.y)}" r="${fmt(guideRadius)}" fill="none" stroke="${escapeAttr(model.palette.aspectGuide)}" stroke-opacity="0.9" stroke-width="${fmt(1.25 * model.scale)}"/>`
1425
+ `<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(guideRadius)}" fill="none" stroke="${escapeAttr2(model.palette.aspectGuide)}" stroke-opacity="0.9" stroke-width="${fmt2(1.25 * model.scale)}"/>`
596
1426
  );
597
1427
  push(
598
- `<circle cx="${fmt(model.center.x)}" cy="${fmt(model.center.y)}" r="${fmt(innerGuideRadius)}" fill="none" stroke="${escapeAttr(model.palette.aspectGuide)}" stroke-opacity="0.28" stroke-width="${fmt(model.scale)}"/>`
1428
+ `<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(innerGuideRadius)}" fill="none" stroke="${escapeAttr2(model.palette.aspectGuide)}" stroke-opacity="0.28" stroke-width="${fmt2(model.scale)}"/>`
599
1429
  );
600
1430
  for (const layer of model.aspectLayers) {
601
- push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${escapeAttr(layer.id)}"${layer.label ? ` aria-label="${escapeAttr(layer.label)}"` : ""}>`);
1431
+ push(`<g class="astro-wheel-aspect-layer" data-aspect-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
602
1432
  for (const aspect of layer.aspectLines) {
603
1433
  push(
604
- `<line data-aspect-layer="${escapeAttr(aspect.layerId)}" data-aspect="${escapeAttr(aspect.aspect)}" data-planet-a="${escapeAttr(aspect.planetA)}" data-planet-b="${escapeAttr(aspect.planetB)}" x1="${fmt(aspect.line.x1)}" y1="${fmt(aspect.line.y1)}" x2="${fmt(aspect.line.x2)}" y2="${fmt(aspect.line.y2)}" stroke="${escapeAttr(aspect.color)}" stroke-opacity="${fmt(aspect.opacity)}" stroke-width="${fmt(aspect.strokeWidth * model.scale)}" stroke-linecap="round"/>`
1434
+ `<line data-aspect-layer="${escapeAttr2(aspect.layerId)}" data-aspect="${escapeAttr2(aspect.aspect)}" data-planet-a="${escapeAttr2(aspect.planetA)}" data-planet-b="${escapeAttr2(aspect.planetB)}" x1="${fmt2(aspect.line.x1)}" y1="${fmt2(aspect.line.y1)}" x2="${fmt2(aspect.line.x2)}" y2="${fmt2(aspect.line.y2)}" stroke="${escapeAttr2(aspect.color)}" stroke-opacity="${fmt2(aspect.opacity)}" stroke-width="${fmt2(aspect.strokeWidth * model.scale)}" stroke-linecap="round"/>`
605
1435
  );
606
1436
  }
607
1437
  push(`</g>`);
608
1438
  }
609
1439
  push(
610
- `<circle cx="${fmt(model.center.x)}" cy="${fmt(model.center.y)}" r="${fmt(4 * model.scale)}" fill="${escapeAttr(model.palette.aspectGuide)}" fill-opacity="0.75" stroke="none"/>`
1440
+ `<circle cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(4 * model.scale)}" fill="${escapeAttr2(model.palette.aspectGuide)}" fill-opacity="0.75" stroke="none"/>`
611
1441
  );
612
1442
  push(`</g>`);
613
1443
  }
@@ -618,12 +1448,12 @@ function renderZodiac(push, model, options) {
618
1448
  const tickEvery = 1;
619
1449
  const { center, rings, palette, scale } = model;
620
1450
  const thickness = rings.zodiac.r2 - rings.zodiac.r1;
621
- const angleOf = (longitude) => deg2rad(clamp360(180 + model.ascendantLongitude - longitude));
1451
+ const angleOf2 = (longitude) => deg2rad2(clamp360(180 + model.ascendantLongitude - longitude));
622
1452
  push(`<g id="astro-wheel-zodiac" aria-label="zodiac">`);
623
1453
  if (options.segments) {
624
1454
  for (const segment of model.zodiacSegments) {
625
1455
  push(
626
- `<path data-zodiac-sign="${escapeAttr(segment.sign)}" data-zodiac-element="${escapeAttr(segment.element)}" d="${segment.path}" fill="${escapeAttr(segment.fill)}" fill-opacity="0.82" stroke="${escapeAttr(palette.zodiacStroke)}" stroke-width="${fmt(model.scale)}"/>`
1456
+ `<path data-zodiac-sign="${escapeAttr2(segment.sign)}" data-zodiac-element="${escapeAttr2(segment.element)}" d="${segment.path}" fill="${escapeAttr2(segment.fill)}" fill-opacity="0.82" stroke="${escapeAttr2(palette.zodiacStroke)}" stroke-width="${fmt2(model.scale)}"/>`
627
1457
  );
628
1458
  }
629
1459
  }
@@ -636,17 +1466,17 @@ function renderZodiac(push, model, options) {
636
1466
  for (let index = 0; index < 360 / tickEvery; index++) {
637
1467
  const longitude = index * tickEvery;
638
1468
  const signDegree = longitude % 30;
639
- const angle = angleOf(longitude);
1469
+ const angle = angleOf2(longitude);
640
1470
  const isSignBoundary = signDegree === 0;
641
1471
  const isTen = signDegree % 10 === 0;
642
1472
  const isFive = signDegree % 5 === 0;
643
1473
  const length = isSignBoundary ? thickness * 0.58 : isTen ? thickness * 0.42 : isFive ? thickness * 0.29 : thickness * 0.18;
644
1474
  const strokeWidth = isSignBoundary ? 2.2 * scale : isTen ? 1.55 * scale : isFive ? 1.1 * scale : 0.75 * scale;
645
1475
  const opacity = isSignBoundary ? 0.95 : isFive ? 0.82 : 0.62;
646
- const inner = polarToXY(center.x, center.y, rings.zodiac.r2 - length, angle);
647
- const outer = polarToXY(center.x, center.y, rings.zodiac.r2, angle);
1476
+ const inner = polarToXY2(center.x, center.y, rings.zodiac.r2 - length, angle);
1477
+ const outer = polarToXY2(center.x, center.y, rings.zodiac.r2, angle);
648
1478
  push(
649
- `<line data-zodiac-tick="${longitude}" x1="${fmt(inner.x)}" y1="${fmt(inner.y)}" x2="${fmt(outer.x)}" y2="${fmt(outer.y)}" stroke="${escapeAttr(palette.zodiacStroke)}" stroke-opacity="${fmt(opacity)}" stroke-width="${fmt(strokeWidth)}"/>`
1479
+ `<line data-zodiac-tick="${longitude}" x1="${fmt2(inner.x)}" y1="${fmt2(inner.y)}" x2="${fmt2(outer.x)}" y2="${fmt2(outer.y)}" stroke="${escapeAttr2(palette.zodiacStroke)}" stroke-opacity="${fmt2(opacity)}" stroke-width="${fmt2(strokeWidth)}"/>`
650
1480
  );
651
1481
  }
652
1482
  }
@@ -657,9 +1487,9 @@ function renderZodiacGlyph(push, segment, palette) {
657
1487
  const glyphScale = segment.labelFontSize * 0.72;
658
1488
  const strokeWidth = clamp(0.11 / Math.max(glyphScale / 10, 0.6), 0.08, 0.16);
659
1489
  push(
660
- `<g class="astro-wheel-glyph" data-astro-glyph="${escapeAttr(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-zodiac-glyph="${escapeAttr(segment.sign)}" data-zodiac-symbol="${escapeAttr(segment.glyph)}" transform="translate(${fmt(segment.labelPosition.x)} ${fmt(segment.labelPosition.y)}) scale(${fmt(glyphScale)})" color="${escapeAttr(palette.zodiacGlyph)}" fill="none" stroke="${escapeAttr(palette.zodiacGlyph)}" stroke-width="${fmt(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
1490
+ `<g class="astro-wheel-glyph" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-zodiac-glyph="${escapeAttr2(segment.sign)}" data-zodiac-symbol="${escapeAttr2(segment.glyph)}" transform="translate(${fmt2(segment.labelPosition.x)} ${fmt2(segment.labelPosition.y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(palette.zodiacGlyph)}" fill="none" stroke="${escapeAttr2(palette.zodiacGlyph)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
661
1491
  );
662
- push(`<title>${escapeText(`${segment.sign} ${segment.glyph}`)}</title>`);
1492
+ push(`<title>${escapeText2(`${segment.sign} ${segment.glyph}`)}</title>`);
663
1493
  renderGlyphPrimitives(push, glyph.primitives, { color: palette.zodiacGlyph });
664
1494
  push(`</g>`);
665
1495
  }
@@ -672,14 +1502,14 @@ function renderHouses(push, model, options) {
672
1502
  for (const cusp of model.houseCusps) {
673
1503
  const isAngleHouse = cusp.house === 1 || cusp.house === 4 || cusp.house === 7 || cusp.house === 10;
674
1504
  push(
675
- `<line data-house-cusp="${cusp.house}" x1="${fmt(cusp.line.x1)}" y1="${fmt(cusp.line.y1)}" x2="${fmt(cusp.line.x2)}" y2="${fmt(cusp.line.y2)}" stroke="${escapeAttr(model.palette.houseLine)}" stroke-opacity="${fmt(isAngleHouse ? 0.72 : 0.42)}" stroke-width="${fmt(isAngleHouse ? 1.8 * model.scale : 0.95 * model.scale)}"/>`
1505
+ `<line data-house-cusp="${cusp.house}" x1="${fmt2(cusp.line.x1)}" y1="${fmt2(cusp.line.y1)}" x2="${fmt2(cusp.line.x2)}" y2="${fmt2(cusp.line.y2)}" stroke="${escapeAttr2(model.palette.houseLine)}" stroke-opacity="${fmt2(isAngleHouse ? 0.72 : 0.42)}" stroke-width="${fmt2(isAngleHouse ? 1.8 * model.scale : 0.95 * model.scale)}"/>`
676
1506
  );
677
1507
  }
678
1508
  }
679
1509
  if (options.labels) {
680
1510
  for (const cusp of model.houseCusps) {
681
1511
  push(
682
- `<text data-house-label="${cusp.house}" x="${fmt(cusp.labelPosition.x)}" y="${fmt(cusp.labelPosition.y)}" font-family="${textFontFamily()}" font-size="${fmt(cusp.labelFontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr(model.palette.houseLabel)}">${cusp.house}</text>`
1512
+ `<text data-house-label="${cusp.house}" x="${fmt2(cusp.labelPosition.x)}" y="${fmt2(cusp.labelPosition.y)}" font-family="${textFontFamily2()}" font-size="${fmt2(cusp.labelFontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(model.palette.houseLabel)}">${cusp.house}</text>`
683
1513
  );
684
1514
  }
685
1515
  }
@@ -687,7 +1517,7 @@ function renderHouses(push, model, options) {
687
1517
  for (const marker of model.angleMarkers) {
688
1518
  push(`<g data-angle-marker="${marker.key}">`);
689
1519
  push(
690
- `<line x1="${fmt(marker.line.x1)}" y1="${fmt(marker.line.y1)}" x2="${fmt(marker.line.x2)}" y2="${fmt(marker.line.y2)}" stroke="${escapeAttr(model.palette.angleLine)}" stroke-width="${fmt(2 * model.scale)}"/>`
1520
+ `<line x1="${fmt2(marker.line.x1)}" y1="${fmt2(marker.line.y1)}" x2="${fmt2(marker.line.x2)}" y2="${fmt2(marker.line.y2)}" stroke="${escapeAttr2(model.palette.angleLine)}" stroke-width="${fmt2(2 * model.scale)}"/>`
691
1521
  );
692
1522
  push(`</g>`);
693
1523
  }
@@ -703,18 +1533,22 @@ function renderPlanets(push, model) {
703
1533
  renderPointLayerGuide(push, layer, model);
704
1534
  }
705
1535
  for (const layer of model.pointLayers) {
706
- push(`<g class="astro-wheel-point-layer" data-point-layer="${escapeAttr(layer.id)}"${layer.label ? ` aria-label="${escapeAttr(layer.label)}"` : ""}>`);
1536
+ push(`<g class="astro-wheel-point-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)}"` : ""}>`);
707
1537
  for (const point of layer.points) {
708
1538
  push(
709
- `<g class="astro-wheel-point" data-point-layer="${escapeAttr(point.layerId)}" data-point-key="${escapeAttr(point.key)}" data-point-name="${escapeAttr(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt(point.longitude)}">`
1539
+ `<g class="astro-wheel-point" data-point-layer="${escapeAttr2(point.layerId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt2(point.longitude)}">`
710
1540
  );
711
- push(`<title>${escapeText(point.name)} ${fmt(point.longitude)}\xB0</title>`);
1541
+ push(`<title>${escapeText2(point.name)} ${fmt2(point.longitude)}\xB0</title>`);
712
1542
  push(
713
- `<line x1="${fmt(point.tickLine.x1)}" y1="${fmt(point.tickLine.y1)}" x2="${fmt(point.tickLine.x2)}" y2="${fmt(point.tickLine.y2)}" stroke="${escapeAttr(point.tickColor)}" stroke-opacity="0.82" stroke-width="${fmt(model.scale)}" stroke-linecap="round"/>`
1543
+ `<line x1="${fmt2(point.tickLine.x1)}" y1="${fmt2(point.tickLine.y1)}" x2="${fmt2(point.tickLine.x2)}" y2="${fmt2(point.tickLine.y2)}" stroke="${escapeAttr2(point.tickColor)}" stroke-opacity="0.82" stroke-width="${fmt2(model.scale)}" stroke-linecap="round"/>`
714
1544
  );
715
- if (point.leaderLine) {
1545
+ if (point.leaderArc) {
1546
+ push(
1547
+ `<path class="astro-wheel-point-leader" d="${escapeAttr2(point.leaderArc.path)}" fill="none" stroke="${escapeAttr2(point.tickColor)}" stroke-opacity="0.52" stroke-width="${fmt2(0.9 * model.scale)}" stroke-linecap="round" stroke-linejoin="round"/>`
1548
+ );
1549
+ } else if (point.leaderLine) {
716
1550
  push(
717
- `<line class="astro-wheel-point-leader" x1="${fmt(point.leaderLine.x1)}" y1="${fmt(point.leaderLine.y1)}" x2="${fmt(point.leaderLine.x2)}" y2="${fmt(point.leaderLine.y2)}" stroke="${escapeAttr(point.tickColor)}" stroke-opacity="0.52" stroke-width="${fmt(0.9 * model.scale)}" stroke-linecap="round"/>`
1551
+ `<line class="astro-wheel-point-leader" x1="${fmt2(point.leaderLine.x1)}" y1="${fmt2(point.leaderLine.y1)}" x2="${fmt2(point.leaderLine.x2)}" y2="${fmt2(point.leaderLine.y2)}" stroke="${escapeAttr2(point.tickColor)}" stroke-opacity="0.52" stroke-width="${fmt2(0.9 * model.scale)}" stroke-linecap="round"/>`
718
1552
  );
719
1553
  }
720
1554
  push(`</g>`);
@@ -729,7 +1563,7 @@ function renderPointLayerGuide(push, layer, model) {
729
1563
  return;
730
1564
  }
731
1565
  push(
732
- `<circle class="astro-wheel-external-point-ring" data-point-layer="${escapeAttr(layer.id)}" cx="${fmt(model.center.x)}" cy="${fmt(model.center.y)}" r="${fmt(layer.radius)}" fill="none" stroke="${escapeAttr(layer.tickColor)}" stroke-opacity="0.32" stroke-width="${fmt(1.15 * model.scale)}"/>`
1566
+ `<circle class="astro-wheel-external-point-ring" data-point-layer="${escapeAttr2(layer.id)}" cx="${fmt2(model.center.x)}" cy="${fmt2(model.center.y)}" r="${fmt2(layer.radius)}" fill="none" stroke="${escapeAttr2(layer.tickColor)}" stroke-opacity="0.32" stroke-width="${fmt2(1.15 * model.scale)}"/>`
733
1567
  );
734
1568
  }
735
1569
  function renderGlyphOverlay(push, model) {
@@ -747,7 +1581,7 @@ function renderGlyphOverlay(push, model) {
747
1581
  if (model.pointLayers.length > 0) {
748
1582
  push(`<g id="astro-wheel-point-glyphs" aria-label="planet glyphs">`);
749
1583
  for (const layer of model.pointLayers) {
750
- push(`<g class="astro-wheel-point-glyph-layer" data-point-layer="${escapeAttr(layer.id)}"${layer.label ? ` aria-label="${escapeAttr(layer.label)} glyphs"` : ""}>`);
1584
+ push(`<g class="astro-wheel-point-glyph-layer" data-point-layer="${escapeAttr2(layer.id)}"${layer.label ? ` aria-label="${escapeAttr2(layer.label)} glyphs"` : ""}>`);
751
1585
  for (const point of layer.points) {
752
1586
  renderPointLabelGroup(push, point, model);
753
1587
  }
@@ -774,14 +1608,14 @@ function renderAngleGlyph(push, marker, model) {
774
1608
  const signX = degreeX + degreeWidth + gap + signScale / 2;
775
1609
  const minutesX = signX + signScale / 2 + gap;
776
1610
  push(
777
- `<g class="astro-wheel-angle-glyph-label" data-angle-marker="${marker.key}" data-longitude="${fmt(marker.longitude)}" transform="translate(${fmt(marker.labelPosition.x)} ${fmt(marker.labelPosition.y)}) rotate(${fmt(marker.labelRotation)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
1611
+ `<g class="astro-wheel-angle-glyph-label" data-angle-marker="${marker.key}" data-longitude="${fmt2(marker.longitude)}" transform="translate(${fmt2(marker.labelPosition.x)} ${fmt2(marker.labelPosition.y)}) rotate(${fmt2(marker.labelRotation)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
778
1612
  );
779
- push(`<title>${escapeText(`${label} ${position.degreesText} ${position.sign} ${position.minutesText}`)}</title>`);
1613
+ push(`<title>${escapeText2(`${label} ${position.degreesText} ${position.sign} ${position.minutesText}`)}</title>`);
780
1614
  push(
781
- `<text class="astro-wheel-angle-label" x="${fmt(labelX)}" y="0" font-family="${textFontFamily()}" font-size="${fmt(labelFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr(model.palette.angleLabel)}" font-weight="700">${escapeText(label)}</text>`
1615
+ `<text class="astro-wheel-angle-label" x="${fmt2(labelX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(labelFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}" font-weight="700">${escapeText2(label)}</text>`
782
1616
  );
783
1617
  push(
784
- `<text class="astro-wheel-angle-degree" x="${fmt(degreeX)}" y="0" font-family="${textFontFamily()}" font-size="${fmt(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr(model.palette.angleLabel)}">${escapeText(position.degreesText)}</text>`
1618
+ `<text class="astro-wheel-angle-degree" x="${fmt2(degreeX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}">${escapeText2(position.degreesText)}</text>`
785
1619
  );
786
1620
  renderInlineSignGlyph(
787
1621
  push,
@@ -792,7 +1626,7 @@ function renderAngleGlyph(push, marker, model) {
792
1626
  model.palette.angleLabel
793
1627
  );
794
1628
  push(
795
- `<text class="astro-wheel-angle-minutes" x="${fmt(minutesX)}" y="0" font-family="${textFontFamily()}" font-size="${fmt(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr(model.palette.angleLabel)}">${escapeText(position.minutesText)}</text>`
1629
+ `<text class="astro-wheel-angle-minutes" x="${fmt2(minutesX)}" y="0" font-family="${textFontFamily2()}" font-size="${fmt2(positionFontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(model.palette.angleLabel)}">${escapeText2(position.minutesText)}</text>`
796
1630
  );
797
1631
  push(`</g>`);
798
1632
  }
@@ -803,11 +1637,11 @@ function angleDisplayLabel(key) {
803
1637
  }
804
1638
  function renderPointLabelGroup(push, point, model) {
805
1639
  const layout = getPointLabelLayout(point, model.scale);
806
- const boundsAttr = point.labelBounds ? ` data-label-bounds="${escapeAttr(formatLabelBounds(point.labelBounds))}"` : "";
1640
+ const boundsAttr = point.labelBounds ? ` data-label-bounds="${escapeAttr2(formatLabelBounds(point.labelBounds))}"` : "";
807
1641
  push(
808
- `<g class="astro-wheel-point-label" data-point-layer="${escapeAttr(point.layerId)}" data-point-key="${escapeAttr(point.key)}" data-point-name="${escapeAttr(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt(point.longitude)}"${boundsAttr} transform="translate(${fmt(point.glyphPosition.x)} ${fmt(point.glyphPosition.y)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
1642
+ `<g class="astro-wheel-point-label" data-point-layer="${escapeAttr2(point.layerId)}" data-point-key="${escapeAttr2(point.key)}" data-point-name="${escapeAttr2(point.name)}" data-point-kind="${point.kind}" data-longitude="${fmt2(point.longitude)}"${boundsAttr} transform="translate(${fmt2(point.glyphPosition.x)} ${fmt2(point.glyphPosition.y)})" filter="url(#${GLYPH_OUTLINE_FILTER_ID})">`
809
1643
  );
810
- push(`<title>${escapeText(pointLabelTitle(point))}</title>`);
1644
+ push(`<title>${escapeText2(pointLabelTitle(point))}</title>`);
811
1645
  renderPointGlyph(push, point, layout.glyphX, layout.glyphY, layout.glyphScale, model.palette.glyphHalo);
812
1646
  if (point.retrograde) {
813
1647
  renderRetrogradeMarker(
@@ -826,13 +1660,13 @@ function renderPointGlyph(push, point, x, y, glyphScale, glyphFill) {
826
1660
  if (glyph) {
827
1661
  const strokeWidth = clamp(0.12 / Math.max(glyphScale / 10, 0.6), 0.1, 0.18);
828
1662
  push(
829
- `<g class="astro-wheel-glyph" data-astro-glyph="${escapeAttr(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-point-glyph="${escapeAttr(point.name)}" transform="translate(${fmt(x)} ${fmt(y)}) scale(${fmt(glyphScale)})" color="${escapeAttr(point.color)}" fill="none" stroke="${escapeAttr(point.color)}" stroke-width="${fmt(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
1663
+ `<g class="astro-wheel-glyph" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-point-glyph="${escapeAttr2(point.name)}" transform="translate(${fmt2(x)} ${fmt2(y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(point.color)}" fill="none" stroke="${escapeAttr2(point.color)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
830
1664
  );
831
1665
  renderGlyphPrimitives(push, glyph.primitives, { color: point.color, glyphFill });
832
1666
  push(`</g>`);
833
1667
  } else {
834
1668
  push(
835
- `<text class="astro-wheel-glyph" data-point-glyph="${escapeAttr(point.name)}" x="${fmt(x)}" y="${fmt(y)}" font-family="${symbolFontFamily()}" font-size="${fmt(point.glyphFontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr(point.color)}">${escapeText(point.glyph)}</text>`
1669
+ `<text class="astro-wheel-glyph" data-point-glyph="${escapeAttr2(point.name)}" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${symbolFontFamily()}" font-size="${fmt2(point.glyphFontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(point.color)}">${escapeText2(point.glyph)}</text>`
836
1670
  );
837
1671
  }
838
1672
  }
@@ -842,14 +1676,14 @@ function renderRetrogradeMarker(push, x, y, fontSize, color) {
842
1676
  const glyphScale = fontSize * 0.62;
843
1677
  const strokeWidth = clamp(0.12 / Math.max(glyphScale / 10, 0.6), 0.1, 0.18);
844
1678
  push(
845
- `<g class="astro-wheel-point-retrograde" data-astro-glyph="${escapeAttr(glyph.key)}" data-astro-glyph-category="${glyph.category}" transform="translate(${fmt(x)} ${fmt(y)}) scale(${fmt(glyphScale)})" color="${escapeAttr(color)}" fill="none" stroke="${escapeAttr(color)}" stroke-width="${fmt(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
1679
+ `<g class="astro-wheel-point-retrograde" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" transform="translate(${fmt2(x)} ${fmt2(y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(color)}" fill="none" stroke="${escapeAttr2(color)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
846
1680
  );
847
1681
  renderGlyphPrimitives(push, glyph.primitives, { color });
848
1682
  push(`</g>`);
849
1683
  return;
850
1684
  }
851
1685
  push(
852
- `<text class="astro-wheel-point-retrograde" x="${fmt(x)}" y="${fmt(y)}" font-family="${textFontFamily()}" font-size="${fmt(fontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr(color)}" font-weight="700">R</text>`
1686
+ `<text class="astro-wheel-point-retrograde" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${textFontFamily2()}" font-size="${fmt2(fontSize)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(color)}" font-weight="700">R</text>`
853
1687
  );
854
1688
  }
855
1689
  function renderPointInlineDegreeLabel(push, point, layout) {
@@ -857,11 +1691,11 @@ function renderPointInlineDegreeLabel(push, point, layout) {
857
1691
  return;
858
1692
  }
859
1693
  push(
860
- `<text class="astro-wheel-point-degree" x="${fmt(layout.degreeX)}" y="${fmt(layout.degreeY)}" font-family="${textFontFamily()}" font-size="${fmt(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr(point.color)}" fill-opacity="0.9">${escapeText(layout.position.degreesText)}</text>`
1694
+ `<text class="astro-wheel-point-degree" x="${fmt2(layout.degreeX)}" y="${fmt2(layout.degreeY)}" font-family="${textFontFamily2()}" font-size="${fmt2(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(layout.position.degreesText)}</text>`
861
1695
  );
862
1696
  renderInlineSignGlyph(push, layout.position.sign, layout.signX, layout.signY, layout.signScale, point.color);
863
1697
  push(
864
- `<text class="astro-wheel-point-minutes" x="${fmt(layout.minutesX)}" y="${fmt(layout.minutesY)}" font-family="${textFontFamily()}" font-size="${fmt(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr(point.color)}" fill-opacity="0.9">${escapeText(layout.position.minutesText)}</text>`
1698
+ `<text class="astro-wheel-point-minutes" x="${fmt2(layout.minutesX)}" y="${fmt2(layout.minutesY)}" font-family="${textFontFamily2()}" font-size="${fmt2(layout.fontSize)}" text-anchor="start" dominant-baseline="middle" fill="${escapeAttr2(point.color)}" fill-opacity="0.9">${escapeText2(layout.position.minutesText)}</text>`
865
1699
  );
866
1700
  }
867
1701
  function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
@@ -869,14 +1703,14 @@ function renderInlineSignGlyph(push, sign, x, y, glyphScale, color) {
869
1703
  if (glyph) {
870
1704
  const strokeWidth = clamp(0.11 / Math.max(glyphScale / 10, 0.6), 0.08, 0.16);
871
1705
  push(
872
- `<g class="astro-wheel-point-sign-glyph" data-astro-glyph="${escapeAttr(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-zodiac-glyph="${escapeAttr(sign)}" transform="translate(${fmt(x)} ${fmt(y)}) scale(${fmt(glyphScale)})" color="${escapeAttr(color)}" fill="none" stroke="${escapeAttr(color)}" stroke-width="${fmt(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
1706
+ `<g class="astro-wheel-point-sign-glyph" data-astro-glyph="${escapeAttr2(glyph.key)}" data-astro-glyph-category="${glyph.category}" data-zodiac-glyph="${escapeAttr2(sign)}" transform="translate(${fmt2(x)} ${fmt2(y)}) scale(${fmt2(glyphScale)})" color="${escapeAttr2(color)}" fill="none" stroke="${escapeAttr2(color)}" stroke-width="${fmt2(strokeWidth)}" stroke-linecap="round" stroke-linejoin="round">`
873
1707
  );
874
1708
  renderGlyphPrimitives(push, glyph.primitives, { color });
875
1709
  push(`</g>`);
876
1710
  return;
877
1711
  }
878
1712
  push(
879
- `<text class="astro-wheel-point-sign-glyph" x="${fmt(x)}" y="${fmt(y)}" font-family="${symbolFontFamily()}" font-size="${fmt(glyphScale)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr(color)}">${escapeText(sign.charAt(0).toUpperCase())}</text>`
1713
+ `<text class="astro-wheel-point-sign-glyph" x="${fmt2(x)}" y="${fmt2(y)}" font-family="${symbolFontFamily()}" font-size="${fmt2(glyphScale)}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(color)}">${escapeText2(sign.charAt(0).toUpperCase())}</text>`
880
1714
  );
881
1715
  }
882
1716
  function getPointLabelLayout(point, scale) {
@@ -978,7 +1812,7 @@ function formatInlinePosition(position) {
978
1812
  function pointLabelTitle(point) {
979
1813
  const position = point.zodiacPosition ? formatInlinePosition(point.zodiacPosition) : null;
980
1814
  if (!position) {
981
- return `${point.name} ${fmt(point.longitude)}\xB0`;
1815
+ return `${point.name} ${fmt2(point.longitude)}\xB0`;
982
1816
  }
983
1817
  const retrograde = point.retrograde ? " Rx" : "";
984
1818
  return `${point.name} ${position.degreesText} ${position.sign} ${position.minutesText}${retrograde}`;
@@ -990,10 +1824,10 @@ function labelBoundsFor(position, layout, padding) {
990
1824
  const width = layout.width + padding * 2;
991
1825
  const height = layout.height + padding * 2;
992
1826
  return {
993
- x: round(position.x + layout.boundsX - padding),
994
- y: round(position.y + layout.boundsY - padding),
995
- width: round(width),
996
- height: round(height)
1827
+ x: round2(position.x + layout.boundsX - padding),
1828
+ y: round2(position.y + layout.boundsY - padding),
1829
+ width: round2(width),
1830
+ height: round2(height)
997
1831
  };
998
1832
  }
999
1833
  function constrainLabelInsideCircle(params) {
@@ -1017,8 +1851,8 @@ function constrainLabelInsideCircle(params) {
1017
1851
  const dy = position.y - center.y;
1018
1852
  const distance = Math.max(Math.hypot(dx, dy), 1);
1019
1853
  position = {
1020
- x: round(position.x - dx / distance * (overflow + 0.75)),
1021
- y: round(position.y - dy / distance * (overflow + 0.75))
1854
+ x: round2(position.x - dx / distance * (overflow + 0.75)),
1855
+ y: round2(position.y - dy / distance * (overflow + 0.75))
1022
1856
  };
1023
1857
  moved = true;
1024
1858
  }
@@ -1043,7 +1877,7 @@ function labelBoundsCircleOverflow(center, bounds, maxRadius) {
1043
1877
  return farthestCorner - maxRadius;
1044
1878
  }
1045
1879
  function formatLabelBounds(bounds) {
1046
- return `${fmt(bounds.x)} ${fmt(bounds.y)} ${fmt(bounds.width)} ${fmt(bounds.height)}`;
1880
+ return `${fmt2(bounds.x)} ${fmt2(bounds.y)} ${fmt2(bounds.width)} ${fmt2(bounds.height)}`;
1047
1881
  }
1048
1882
  function projectedLabelWidthAlongTangent(angleRad, bounds) {
1049
1883
  const tangentX = -Math.sin(angleRad);
@@ -1093,11 +1927,11 @@ function getExternalPointPadding(options, scale) {
1093
1927
  );
1094
1928
  }
1095
1929
  function buildZodiacSegments(params) {
1096
- const { center, angleOf, rings, scale, palette } = params;
1930
+ const { center, angleOf: angleOf2, rings, scale, palette } = params;
1097
1931
  const boundaries = unwrapAngles(
1098
1932
  Array.from(
1099
1933
  { length: ASTRO_WHEEL_ZODIAC_SIGNS.length + 1 },
1100
- (_, index) => angleOf(index * 30)
1934
+ (_, index) => angleOf2(index * 30)
1101
1935
  ),
1102
1936
  "dec"
1103
1937
  );
@@ -1106,11 +1940,11 @@ function buildZodiacSegments(params) {
1106
1940
  return ASTRO_WHEEL_ZODIAC_SIGNS.map((entry, index) => {
1107
1941
  const angleStart = boundaries[index];
1108
1942
  const angleEnd = boundaries[index + 1];
1109
- const labelPosition = polarToXY(
1943
+ const labelPosition = polarToXY2(
1110
1944
  center.x,
1111
1945
  center.y,
1112
1946
  (rings.zodiac.r1 + rings.zodiac.r2) / 2,
1113
- angleOf(index * 30 + 15)
1947
+ angleOf2(index * 30 + 15)
1114
1948
  );
1115
1949
  return {
1116
1950
  sign: entry.sign,
@@ -1128,14 +1962,14 @@ function buildZodiacSegments(params) {
1128
1962
  });
1129
1963
  }
1130
1964
  function buildHouseCusps(params) {
1131
- const { houses, center, angleOf, rings, scale } = params;
1965
+ const { houses, center, angleOf: angleOf2, rings, scale } = params;
1132
1966
  const ring = rings.houses;
1133
1967
  const spokeInnerRadius = rings.aspects.r2;
1134
1968
  const spokeOuterRadius = ring.r2 + 4 * scale;
1135
1969
  const labelRadius = ring.r2 + 12 * scale;
1136
1970
  const labelFontSize = clamp((ring.r2 - ring.r1) * 0.48, 10 * scale, 19 * scale);
1137
1971
  return houses.map((house, index) => {
1138
- const angle = angleOf(house.longitude);
1972
+ const angle = angleOf2(house.longitude);
1139
1973
  const next = houses[(index + 1) % houses.length];
1140
1974
  const span = clamp360(next.longitude - house.longitude);
1141
1975
  const labelLongitude = clamp360(house.longitude + span / 2);
@@ -1143,16 +1977,20 @@ function buildHouseCusps(params) {
1143
1977
  house: index + 1,
1144
1978
  longitude: normalizeAngle(house.longitude),
1145
1979
  sign: house.sign,
1146
- line: lineFromPolar(center, spokeInnerRadius, spokeOuterRadius, angle),
1147
- labelPosition: polarToXY(center.x, center.y, labelRadius, angleOf(labelLongitude)),
1980
+ line: lineFromPolar2(center, spokeInnerRadius, spokeOuterRadius, angle),
1981
+ labelPosition: polarToXY2(center.x, center.y, labelRadius, angleOf2(labelLongitude)),
1148
1982
  labelFontSize
1149
1983
  };
1150
1984
  });
1151
1985
  }
1152
1986
  function buildAngleMarkers(params) {
1153
- const { chart, center, angleOf, rings, scale } = params;
1987
+ const { chart, center, angleOf: angleOf2, rings, scale } = params;
1154
1988
  const ring = rings.houses;
1155
1989
  const labelFontSize = clamp((ring.r2 - ring.r1) * 0.32, 8 * scale, 18 * scale);
1990
+ const labelRadius = Math.min(
1991
+ ring.r2 + 9 * scale,
1992
+ ring.r2 - Math.max(10 * scale, labelFontSize * 0.6)
1993
+ );
1156
1994
  const markers = [
1157
1995
  { key: "ASC", position: chart.houses.ascendant },
1158
1996
  { key: "MC", position: chart.houses.mc },
@@ -1160,7 +1998,7 @@ function buildAngleMarkers(params) {
1160
1998
  { key: "IC", position: chart.houses.ic }
1161
1999
  ];
1162
2000
  return markers.map((marker) => {
1163
- const angle = angleOf(marker.position.longitude);
2001
+ const angle = angleOf2(marker.position.longitude);
1164
2002
  const angleDeg = clamp360(angle * (180 / Math.PI));
1165
2003
  let labelRotation = angleDeg;
1166
2004
  if (labelRotation > 90 && labelRotation < 270) {
@@ -1170,11 +2008,11 @@ function buildAngleMarkers(params) {
1170
2008
  key: marker.key,
1171
2009
  longitude: normalizeAngle(marker.position.longitude),
1172
2010
  zodiacPosition: marker.position,
1173
- line: lineFromPolar(center, ring.r1 + 4 * scale, ring.r2 - 4 * scale, angle),
2011
+ line: lineFromPolar2(center, ring.r1 + 4 * scale, ring.r2 - 4 * scale, angle),
1174
2012
  labelPosition: polarWithNudge(
1175
2013
  center.x,
1176
2014
  center.y,
1177
- ring.r2 + 9 * scale,
2015
+ labelRadius,
1178
2016
  angle,
1179
2017
  0,
1180
2018
  0
@@ -1185,7 +2023,17 @@ function buildAngleMarkers(params) {
1185
2023
  });
1186
2024
  }
1187
2025
  function buildPointLayer(params) {
1188
- const { layer, center, angleOf, rings, scale, palette, excludedBodies } = params;
2026
+ const {
2027
+ layer,
2028
+ center,
2029
+ angleOf: angleOf2,
2030
+ rings,
2031
+ scale,
2032
+ palette,
2033
+ excludedBodies,
2034
+ pointConnectorMode,
2035
+ maxDisplacementDegrees
2036
+ } = params;
1189
2037
  const ring = rings.planets;
1190
2038
  const requestedRadius = resolvePointLayerRadius(layer, rings);
1191
2039
  const requestedExternalLayer = requestedRadius > rings.houses.r2 + scale;
@@ -1206,7 +2054,7 @@ function buildPointLayer(params) {
1206
2054
  const color = layer.color ?? palette.planetGlyph;
1207
2055
  const tickColor = layer.tickColor ?? color;
1208
2056
  const pointIntents = seeds.map((seed) => {
1209
- const tickAngle = angleOf(seed.longitude);
2057
+ const tickAngle = angleOf2(seed.longitude);
1210
2058
  const pointGlyphFontSize = seed.kind === "vertex" ? glyphFontSize * 0.82 : glyphFontSize;
1211
2059
  const rawGlyphRadius = radius;
1212
2060
  const glyphRadius = isExternalLayer ? rawGlyphRadius : clamp(
@@ -1214,21 +2062,23 @@ function buildPointLayer(params) {
1214
2062
  rings.aspects.r2 + pointGlyphFontSize * 0.65,
1215
2063
  labelMaxRadius - pointGlyphFontSize * 0.5
1216
2064
  );
1217
- const tickLine = isExternalLayer ? lineFromPolar(
2065
+ const connectorRadius = glyphRadius;
2066
+ const tickLine = isExternalLayer ? lineFromPolar2(
1218
2067
  center,
1219
2068
  rings.houses.r2 + 2 * scale,
1220
- Math.max(rings.houses.r2 + 6 * scale, radius - glyphFontSize * 0.44),
2069
+ connectorRadius,
1221
2070
  tickAngle
1222
- ) : lineFromPolar(center, ring.r2 - tickLength, ring.r2, tickAngle);
1223
- const leaderStartRadius = isExternalLayer ? Math.max(rings.houses.r2 + 6 * scale, radius - glyphFontSize * 0.44) : radius;
1224
- const leaderStart = polarToXY(center.x, center.y, leaderStartRadius, tickAngle);
1225
- const idealPosition = polarToXY(center.x, center.y, glyphRadius, tickAngle);
2071
+ ) : lineFromPolar2(
2072
+ center,
2073
+ Math.min(ring.r2, connectorRadius + tickLength),
2074
+ connectorRadius,
2075
+ tickAngle
2076
+ );
2077
+ const idealPosition = polarToXY2(center.x, center.y, glyphRadius, tickAngle);
1226
2078
  const point = makeAstroWheelPoint({
1227
2079
  layer,
1228
2080
  seed,
1229
2081
  tickLine,
1230
- leaderStart,
1231
- tickAngle,
1232
2082
  labelAngle: tickAngle,
1233
2083
  glyphPosition: idealPosition,
1234
2084
  glyphFontSize: pointGlyphFontSize,
@@ -1238,13 +2088,13 @@ function buildPointLayer(params) {
1238
2088
  const layout = getPointLabelLayout(point, scale);
1239
2089
  const labelBounds = labelBoundsFor(idealPosition, layout, collisionPadding);
1240
2090
  const labelTangentDemandPx = projectedLabelWidthAlongTangent(tickAngle, labelBounds);
1241
- const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
2091
+ const configuredTangentDemandPx = layer.collisionThresholdDegrees ? deg2rad2(clamp(layer.collisionThresholdDegrees, 0, 30)) * glyphRadius : 0;
1242
2092
  const tangentDemandPx = Math.max(labelTangentDemandPx, configuredTangentDemandPx);
1243
2093
  return {
1244
2094
  seed,
1245
2095
  tickAngle,
1246
2096
  tickLine,
1247
- leaderStart,
2097
+ connectorRadius,
1248
2098
  glyphRadius,
1249
2099
  pointGlyphFontSize,
1250
2100
  tangentDemandPx
@@ -1257,20 +2107,21 @@ function buildPointLayer(params) {
1257
2107
  radius: intent.glyphRadius,
1258
2108
  tangentDemandPx: intent.tangentDemandPx
1259
2109
  })),
1260
- collisionPadding
2110
+ {
2111
+ paddingPx: collisionPadding,
2112
+ maxDisplacementRad: deg2rad2(clamp(maxDisplacementDegrees, 0, 180))
2113
+ }
1261
2114
  );
1262
2115
  const visualAngleByKey = Object.fromEntries(
1263
2116
  solvedLabels.map(({ item, visualAngle }) => [item.seed.key, visualAngle])
1264
2117
  );
1265
2118
  const points = pointIntents.map((intent) => {
1266
2119
  const visualAngle = visualAngleByKey[intent.seed.key] ?? intent.tickAngle;
1267
- let glyphPosition = polarToXY(center.x, center.y, intent.glyphRadius, visualAngle);
2120
+ let glyphPosition = polarToXY2(center.x, center.y, intent.glyphRadius, visualAngle);
1268
2121
  let point = makeAstroWheelPoint({
1269
2122
  layer,
1270
2123
  seed: intent.seed,
1271
2124
  tickLine: intent.tickLine,
1272
- leaderStart: intent.leaderStart,
1273
- tickAngle: intent.tickAngle,
1274
2125
  labelAngle: visualAngle,
1275
2126
  glyphPosition,
1276
2127
  glyphFontSize: intent.pointGlyphFontSize,
@@ -1290,14 +2141,20 @@ function buildPointLayer(params) {
1290
2141
  point = {
1291
2142
  ...point,
1292
2143
  glyphPosition,
1293
- leaderLine: {
1294
- x1: intent.leaderStart.x,
1295
- y1: intent.leaderStart.y,
1296
- x2: glyphPosition.x,
1297
- y2: glyphPosition.y
1298
- }
2144
+ leaderLine: void 0
1299
2145
  };
1300
2146
  }
2147
+ point = {
2148
+ ...point,
2149
+ leaderArc: buildPointConnector({
2150
+ center,
2151
+ tickAngle: intent.tickAngle,
2152
+ labelAngle: visualAngle,
2153
+ connectorRadius: intent.connectorRadius,
2154
+ glyphPosition,
2155
+ mode: pointConnectorMode
2156
+ })
2157
+ };
1301
2158
  return {
1302
2159
  ...point,
1303
2160
  labelBounds: constrainedLabel.bounds
@@ -1317,15 +2174,12 @@ function makeAstroWheelPoint(params) {
1317
2174
  layer,
1318
2175
  seed,
1319
2176
  tickLine,
1320
- leaderStart,
1321
- tickAngle,
1322
2177
  labelAngle,
1323
2178
  glyphPosition,
1324
2179
  glyphFontSize,
1325
2180
  color,
1326
2181
  tickColor
1327
2182
  } = params;
1328
- const labelDisplaced = circularAngleDistance(labelAngle, tickAngle) > 1e-4;
1329
2183
  return {
1330
2184
  layerId: layer.id,
1331
2185
  key: seed.key,
@@ -1338,12 +2192,8 @@ function makeAstroWheelPoint(params) {
1338
2192
  zodiacPosition: seed.zodiacPosition,
1339
2193
  tickLine,
1340
2194
  labelAngle,
1341
- leaderLine: labelDisplaced ? {
1342
- x1: leaderStart.x,
1343
- y1: leaderStart.y,
1344
- x2: glyphPosition.x,
1345
- y2: glyphPosition.y
1346
- } : void 0,
2195
+ leaderArc: void 0,
2196
+ leaderLine: void 0,
1347
2197
  glyphPosition,
1348
2198
  glyphFontSize,
1349
2199
  retrograde: seed.retrograde,
@@ -1352,7 +2202,7 @@ function makeAstroWheelPoint(params) {
1352
2202
  };
1353
2203
  }
1354
2204
  function buildAspectLayer(params) {
1355
- const { layer, chart, pointByKey, center, angleOf, rings, palette, excludedBodies } = params;
2205
+ const { layer, chart, pointByKey, center, angleOf: angleOf2, rings, palette, excludedBodies } = params;
1356
2206
  const sourceEdges = getSourceAspectEdges(chart, {
1357
2207
  edges: layer.edges,
1358
2208
  aspectSpecs: layer.aspectSpecs
@@ -1375,8 +2225,8 @@ function buildAspectLayer(params) {
1375
2225
  const spec = findAspectSpec(edge.aspect, layer.aspectSpecs);
1376
2226
  const maxOrb = spec?.orb ?? 8;
1377
2227
  const opacity = clamp((1 - edge.orb / Math.max(maxOrb, 1e-3)) * (layer.opacityScale ?? 1), 0.25, 0.92);
1378
- const a = polarToXY(center.x, center.y, aspectRadius, angleOf(planetA.longitude));
1379
- const b = polarToXY(center.x, center.y, aspectRadius, angleOf(planetB.longitude));
2228
+ const a = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetA.longitude));
2229
+ const b = polarToXY2(center.x, center.y, aspectRadius, angleOf2(planetB.longitude));
1380
2230
  return [{
1381
2231
  layerId: layer.id,
1382
2232
  planetA: planetA.name,
@@ -1472,7 +2322,8 @@ function pointSeed(point, layerId) {
1472
2322
  zodiacPosition: point.zodiacPosition
1473
2323
  };
1474
2324
  }
1475
- function solveCircularLabelAngles(items, paddingPx) {
2325
+ function solveCircularLabelAngles(items, options) {
2326
+ const { paddingPx, maxDisplacementRad } = options;
1476
2327
  if (items.length === 0) {
1477
2328
  return [];
1478
2329
  }
@@ -1488,7 +2339,7 @@ function solveCircularLabelAngles(items, paddingPx) {
1488
2339
  for (let i = 0; i < normalized.length; i++) {
1489
2340
  const current = normalized[i];
1490
2341
  const next = normalized[(i + 1) % normalized.length];
1491
- const nextAngle = i === normalized.length - 1 ? next.idealAngle + TAU : next.idealAngle;
2342
+ const nextAngle = i === normalized.length - 1 ? next.idealAngle + TAU2 : next.idealAngle;
1492
2343
  const gap = nextAngle - current.idealAngle;
1493
2344
  if (gap > largestGap) {
1494
2345
  largestGap = gap;
@@ -1502,14 +2353,14 @@ function solveCircularLabelAngles(items, paddingPx) {
1502
2353
  const wrapped = seamIndex > 0 && index >= normalized.length - seamIndex;
1503
2354
  return {
1504
2355
  ...item,
1505
- idealAngle: item.idealAngle + (wrapped ? TAU : 0)
2356
+ idealAngle: item.idealAngle + (wrapped ? TAU2 : 0)
1506
2357
  };
1507
2358
  });
1508
2359
  for (let i = 1; i < linear.length; i++) {
1509
2360
  while (linear[i].idealAngle <= linear[i - 1].idealAngle) {
1510
2361
  linear[i] = {
1511
2362
  ...linear[i],
1512
- idealAngle: linear[i].idealAngle + TAU
2363
+ idealAngle: linear[i].idealAngle + TAU2
1513
2364
  };
1514
2365
  }
1515
2366
  }
@@ -1517,20 +2368,41 @@ function solveCircularLabelAngles(items, paddingPx) {
1517
2368
  ...item,
1518
2369
  visualAngle: item.idealAngle
1519
2370
  }));
1520
- for (let i = 1; i < solved.length; i++) {
1521
- const previous = solved[i - 1];
1522
- const current = solved[i];
1523
- const minGap = labelAngularHalfDemand(previous, paddingPx) + labelAngularHalfDemand(current, paddingPx);
1524
- if (current.visualAngle < previous.visualAngle + minGap) {
1525
- current.visualAngle = previous.visualAngle + minGap;
2371
+ for (let iteration = 0; iteration < 50; iteration++) {
2372
+ const forces = new Array(solved.length).fill(0);
2373
+ let maxForce = 0;
2374
+ for (let i = 0; i < solved.length; i++) {
2375
+ const j = (i + 1) % solved.length;
2376
+ const current = solved[i];
2377
+ const next = solved[j];
2378
+ const nextAngle = j === 0 ? next.visualAngle + TAU2 : next.visualAngle;
2379
+ const gap = nextAngle - current.visualAngle;
2380
+ const minGap = labelAngularHalfDemand(current, paddingPx) + labelAngularHalfDemand(next, paddingPx);
2381
+ if (gap >= minGap) {
2382
+ continue;
2383
+ }
2384
+ const push = (minGap - gap) / 2;
2385
+ forces[i] -= push;
2386
+ forces[j] += push;
2387
+ maxForce = Math.max(maxForce, push);
1526
2388
  }
1527
- }
1528
- for (let i = solved.length - 2; i >= 0; i--) {
1529
- const current = solved[i];
1530
- const next = solved[i + 1];
1531
- const minGap = labelAngularHalfDemand(current, paddingPx) + labelAngularHalfDemand(next, paddingPx);
1532
- if (current.visualAngle > next.visualAngle - minGap) {
1533
- current.visualAngle = next.visualAngle - minGap;
2389
+ if (maxForce < 1e-4) {
2390
+ break;
2391
+ }
2392
+ for (let i = 0; i < solved.length; i++) {
2393
+ const movement = clamp(forces[i], -deg2rad2(2), deg2rad2(2));
2394
+ const moved = solved[i].visualAngle + movement;
2395
+ solved[i].visualAngle = clampAngleAroundIdeal(
2396
+ moved,
2397
+ solved[i].idealAngle,
2398
+ maxDisplacementRad
2399
+ );
2400
+ }
2401
+ solved.sort((a, b) => a.visualAngle - b.visualAngle);
2402
+ for (let i = 1; i < solved.length; i++) {
2403
+ while (solved[i].visualAngle <= solved[i - 1].visualAngle) {
2404
+ solved[i].visualAngle += TAU2;
2405
+ }
1534
2406
  }
1535
2407
  }
1536
2408
  return solved.map((item) => ({
@@ -1538,15 +2410,51 @@ function solveCircularLabelAngles(items, paddingPx) {
1538
2410
  visualAngle: clampRad(item.visualAngle)
1539
2411
  }));
1540
2412
  }
2413
+ function clampAngleAroundIdeal(value, ideal, maxDistance) {
2414
+ if (!Number.isFinite(maxDistance) || maxDistance >= Math.PI) {
2415
+ return value;
2416
+ }
2417
+ const delta = signedAngleDelta(ideal, value);
2418
+ return ideal + clamp(delta, -maxDistance, maxDistance);
2419
+ }
2420
+ function signedAngleDelta(from, to) {
2421
+ let delta = clampRad(to) - clampRad(from);
2422
+ if (delta > Math.PI) {
2423
+ delta -= TAU2;
2424
+ } else if (delta < -Math.PI) {
2425
+ delta += TAU2;
2426
+ }
2427
+ return delta;
2428
+ }
1541
2429
  function labelAngularHalfDemand(item, paddingPx) {
1542
2430
  return (item.tangentDemandPx / 2 + paddingPx) / Math.max(item.radius, 1);
1543
2431
  }
1544
2432
  function clampRad(value) {
1545
- return (value % TAU + TAU) % TAU;
2433
+ return (value % TAU2 + TAU2) % TAU2;
1546
2434
  }
1547
2435
  function circularAngleDistance(a, b) {
1548
2436
  const delta = Math.abs(clampRad(a) - clampRad(b));
1549
- return Math.min(delta, TAU - delta);
2437
+ return Math.min(delta, TAU2 - delta);
2438
+ }
2439
+ function buildPointConnector(params) {
2440
+ const { center, tickAngle, labelAngle, connectorRadius, glyphPosition, mode } = params;
2441
+ const displacement = circularAngleDistance(tickAngle, labelAngle);
2442
+ if (mode === "never" || mode === "auto" && displacement < deg2rad2(0.35)) {
2443
+ return void 0;
2444
+ }
2445
+ const path = arcConnectorPath({
2446
+ center,
2447
+ startAngle: tickAngle,
2448
+ endAngle: labelAngle,
2449
+ radius: connectorRadius,
2450
+ end: glyphPosition
2451
+ });
2452
+ return {
2453
+ startAngle: tickAngle,
2454
+ endAngle: labelAngle,
2455
+ radius: connectorRadius,
2456
+ path
2457
+ };
1550
2458
  }
1551
2459
  function getSourceAspectEdges(chart, options) {
1552
2460
  if (options.edges) {
@@ -1598,12 +2506,16 @@ function getAspectMatch(lonA, lonB, specs) {
1598
2506
  function findAspectSpec(aspect, specs = ASTRO_WHEEL_DEFAULT_ASPECT_SPECS) {
1599
2507
  return specs.find((spec) => spec.name === aspect);
1600
2508
  }
1601
- function buildRings(outerRadius) {
2509
+ function buildRings2(outerRadius, ringFractions = {}) {
2510
+ const fractions = {
2511
+ ...DEFAULT_ASTRO_WHEEL_RING_FRACTIONS,
2512
+ ...ringFractions
2513
+ };
1602
2514
  const ringMap = buildRingMap(outerRadius, [
1603
- { id: "houses", fr: 8 },
1604
- { id: "zodiac", fr: 14 },
1605
- { id: "planets", fr: 22 },
1606
- { id: "aspects", fr: 56 }
2515
+ { id: "houses", fr: fractions.houses },
2516
+ { id: "zodiac", fr: fractions.zodiac },
2517
+ { id: "planets", fr: fractions.planets },
2518
+ { id: "aspects", fr: fractions.aspects }
1607
2519
  ]);
1608
2520
  return {
1609
2521
  aspects: ringMap.aspects,
@@ -1613,23 +2525,27 @@ function buildRings(outerRadius) {
1613
2525
  };
1614
2526
  }
1615
2527
  function buildRingMap(radius, defs) {
1616
- const frTotal = defs.reduce((sum, def) => sum + def.fr, 0);
2528
+ const normalizedDefs = defs.map((def) => ({
2529
+ ...def,
2530
+ fr: Number.isFinite(def.fr) && def.fr > 0 ? def.fr : DEFAULT_ASTRO_WHEEL_RING_FRACTIONS[def.id]
2531
+ }));
2532
+ const frTotal = normalizedDefs.reduce((sum, def) => sum + def.fr, 0);
1617
2533
  let cursor = radius;
1618
2534
  const result = {};
1619
- for (const def of defs) {
2535
+ for (const def of normalizedDefs) {
1620
2536
  const thickness = radius * def.fr / frTotal;
1621
2537
  const r2 = cursor;
1622
2538
  const r1 = cursor - thickness;
1623
2539
  result[def.id] = {
1624
2540
  id: def.id,
1625
- r1: round(r1),
1626
- r2: round(r2)
2541
+ r1: round2(r1),
2542
+ r2: round2(r2)
1627
2543
  };
1628
2544
  cursor = r1;
1629
2545
  }
1630
2546
  return result;
1631
2547
  }
1632
- function resolvePalette(palette = "default", background = "transparent") {
2548
+ function resolvePalette2(palette = "default", background = "transparent") {
1633
2549
  const base = palette === "monochrome" ? MONOCHROME_PALETTE : DEFAULT_PALETTE;
1634
2550
  if (palette === "default" || palette === "monochrome") {
1635
2551
  return {
@@ -1728,7 +2644,7 @@ function resolvePointLayerRadius(layer, rings) {
1728
2644
  const radius = layer.radius === "inner" ? ring.r1 : layer.radius === "outer" ? ring.r2 : typeof layer.radius === "number" ? layer.radius : base;
1729
2645
  return radius + (layer.radiusOffset ?? 0);
1730
2646
  }
1731
- function normalizeViewBox(viewBox) {
2647
+ function normalizeViewBox2(viewBox) {
1732
2648
  return {
1733
2649
  minX: viewBox?.minX ?? ASTRO_WHEEL_DEFAULT_VIEWBOX.minX,
1734
2650
  minY: viewBox?.minY ?? ASTRO_WHEEL_DEFAULT_VIEWBOX.minY,
@@ -1762,16 +2678,16 @@ function pointKeyPrefix(layerId) {
1762
2678
  function renderGlyphPrimitives(push, primitives, options) {
1763
2679
  for (const p of primitives) {
1764
2680
  if (p.kind === "path") {
1765
- push(`<path d="${escapeAttr(p.d)}"/>`);
2681
+ push(`<path d="${escapeAttr2(p.d)}"/>`);
1766
2682
  } else if (p.kind === "circle") {
1767
- push(`<circle cx="${fmt(p.cx)}" cy="${fmt(p.cy)}" r="${fmt(p.r)}"/>`);
2683
+ push(`<circle cx="${fmt2(p.cx)}" cy="${fmt2(p.cy)}" r="${fmt2(p.r)}"/>`);
1768
2684
  } else if (p.kind === "line") {
1769
- push(`<line x1="${fmt(p.x1)}" y1="${fmt(p.y1)}" x2="${fmt(p.x2)}" y2="${fmt(p.y2)}"/>`);
2685
+ push(`<line x1="${fmt2(p.x1)}" y1="${fmt2(p.y1)}" x2="${fmt2(p.x2)}" y2="${fmt2(p.y2)}"/>`);
1770
2686
  } else if (p.kind === "polyline") {
1771
- push(`<polyline points="${escapeAttr(p.points)}"/>`);
2687
+ push(`<polyline points="${escapeAttr2(p.points)}"/>`);
1772
2688
  } else if (p.kind === "text") {
1773
2689
  push(
1774
- `<text x="${fmt(p.x ?? 0)}" y="${fmt(p.y ?? 0)}" font-family="${textFontFamily()}" font-size="${fmt(p.fontSize ?? 0.72)}" font-weight="${escapeAttr(String(p.fontWeight ?? 500))}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr(options.color)}" stroke="none">${escapeText(p.text)}</text>`
2690
+ `<text x="${fmt2(p.x ?? 0)}" y="${fmt2(p.y ?? 0)}" font-family="${textFontFamily2()}" font-size="${fmt2(p.fontSize ?? 0.72)}" font-weight="${escapeAttr2(String(p.fontWeight ?? 500))}" text-anchor="middle" dominant-baseline="middle" fill="${escapeAttr2(options.color)}" stroke="none">${escapeText2(p.text)}</text>`
1775
2691
  );
1776
2692
  } else {
1777
2693
  let markup = p.markup;
@@ -1788,16 +2704,16 @@ function normalizeAngle(value) {
1788
2704
  function clamp360(value) {
1789
2705
  return (value % 360 + 360) % 360;
1790
2706
  }
1791
- function deg2rad(degrees) {
2707
+ function deg2rad2(degrees) {
1792
2708
  return degrees * Math.PI / 180;
1793
2709
  }
1794
2710
  function clamp(value, min, max) {
1795
2711
  return Math.max(min, Math.min(max, value));
1796
2712
  }
1797
- function polarToXY(cx, cy, radius, angleRad) {
2713
+ function polarToXY2(cx, cy, radius, angleRad) {
1798
2714
  return {
1799
- x: round(cx + radius * Math.cos(angleRad)),
1800
- y: round(cy + radius * Math.sin(angleRad))
2715
+ x: round2(cx + radius * Math.cos(angleRad)),
2716
+ y: round2(cy + radius * Math.sin(angleRad))
1801
2717
  };
1802
2718
  }
1803
2719
  function polarWithNudge(cx, cy, radius, angleRad, radialOffset = 0, tangentOffset = 0) {
@@ -1806,13 +2722,13 @@ function polarWithNudge(cx, cy, radius, angleRad, radialOffset = 0, tangentOffse
1806
2722
  const tangentX = -Math.sin(angleRad);
1807
2723
  const tangentY = Math.cos(angleRad);
1808
2724
  return {
1809
- x: round(x + tangentX * tangentOffset),
1810
- y: round(y + tangentY * tangentOffset)
2725
+ x: round2(x + tangentX * tangentOffset),
2726
+ y: round2(y + tangentY * tangentOffset)
1811
2727
  };
1812
2728
  }
1813
- function lineFromPolar(center, r1, r2, angleRad) {
1814
- const p1 = polarToXY(center.x, center.y, r1, angleRad);
1815
- const p2 = polarToXY(center.x, center.y, r2, angleRad);
2729
+ function lineFromPolar2(center, r1, r2, angleRad) {
2730
+ const p1 = polarToXY2(center.x, center.y, r1, angleRad);
2731
+ const p2 = polarToXY2(center.x, center.y, r2, angleRad);
1816
2732
  return {
1817
2733
  x1: p1.x,
1818
2734
  y1: p1.y,
@@ -1821,20 +2737,36 @@ function lineFromPolar(center, r1, r2, angleRad) {
1821
2737
  };
1822
2738
  }
1823
2739
  function arcPath(cx, cy, innerRadius, outerRadius, angleStart, angleEnd) {
1824
- const p0 = polarToXY(cx, cy, outerRadius, angleStart);
1825
- const p1 = polarToXY(cx, cy, outerRadius, angleEnd);
1826
- const p2 = polarToXY(cx, cy, innerRadius, angleEnd);
1827
- const p3 = polarToXY(cx, cy, innerRadius, angleStart);
1828
- const large = Math.abs(angleEnd - angleStart) % TAU > Math.PI ? 1 : 0;
2740
+ const p0 = polarToXY2(cx, cy, outerRadius, angleStart);
2741
+ const p1 = polarToXY2(cx, cy, outerRadius, angleEnd);
2742
+ const p2 = polarToXY2(cx, cy, innerRadius, angleEnd);
2743
+ const p3 = polarToXY2(cx, cy, innerRadius, angleStart);
2744
+ const large = Math.abs(angleEnd - angleStart) % TAU2 > Math.PI ? 1 : 0;
1829
2745
  const sweep = angleEnd > angleStart ? 1 : 0;
1830
2746
  return [
1831
- `M ${fmt(p0.x)},${fmt(p0.y)}`,
1832
- `A ${fmt(outerRadius)},${fmt(outerRadius)} 0 ${large} ${sweep} ${fmt(p1.x)},${fmt(p1.y)}`,
1833
- `L ${fmt(p2.x)},${fmt(p2.y)}`,
1834
- `A ${fmt(innerRadius)},${fmt(innerRadius)} 0 ${large} ${sweep ? 0 : 1} ${fmt(p3.x)},${fmt(p3.y)}`,
2747
+ `M ${fmt2(p0.x)},${fmt2(p0.y)}`,
2748
+ `A ${fmt2(outerRadius)},${fmt2(outerRadius)} 0 ${large} ${sweep} ${fmt2(p1.x)},${fmt2(p1.y)}`,
2749
+ `L ${fmt2(p2.x)},${fmt2(p2.y)}`,
2750
+ `A ${fmt2(innerRadius)},${fmt2(innerRadius)} 0 ${large} ${sweep ? 0 : 1} ${fmt2(p3.x)},${fmt2(p3.y)}`,
1835
2751
  "Z"
1836
2752
  ].join(" ");
1837
2753
  }
2754
+ function arcConnectorPath(params) {
2755
+ const { center, startAngle, endAngle, radius, end } = params;
2756
+ const start = polarToXY2(center.x, center.y, radius, startAngle);
2757
+ const arcEnd = polarToXY2(center.x, center.y, radius, endAngle);
2758
+ const delta = signedAngleDelta(startAngle, endAngle);
2759
+ const large = Math.abs(delta) > Math.PI ? 1 : 0;
2760
+ const sweep = delta >= 0 ? 1 : 0;
2761
+ const commands = [
2762
+ `M ${fmt2(start.x)},${fmt2(start.y)}`,
2763
+ `A ${fmt2(radius)},${fmt2(radius)} 0 ${large} ${sweep} ${fmt2(arcEnd.x)},${fmt2(arcEnd.y)}`
2764
+ ];
2765
+ if (Math.hypot(arcEnd.x - end.x, arcEnd.y - end.y) > 0.5) {
2766
+ commands.push(`L ${fmt2(end.x)},${fmt2(end.y)}`);
2767
+ }
2768
+ return commands.join(" ");
2769
+ }
1838
2770
  function unwrapAngles(angles, direction = "inc") {
1839
2771
  const unwrapped = [];
1840
2772
  if (angles.length === 0) {
@@ -1845,41 +2777,41 @@ function unwrapAngles(angles, direction = "inc") {
1845
2777
  let angle = angles[index];
1846
2778
  if (direction === "inc") {
1847
2779
  while (angle <= unwrapped[index - 1]) {
1848
- angle += TAU;
2780
+ angle += TAU2;
1849
2781
  }
1850
2782
  } else {
1851
2783
  while (angle >= unwrapped[index - 1]) {
1852
- angle -= TAU;
2784
+ angle -= TAU2;
1853
2785
  }
1854
2786
  }
1855
2787
  unwrapped.push(angle);
1856
2788
  }
1857
2789
  return unwrapped;
1858
2790
  }
1859
- function round(value) {
2791
+ function round2(value) {
1860
2792
  return Math.round((value + Number.EPSILON) * 100) / 100;
1861
2793
  }
1862
- function fmt(value) {
1863
- const rounded = round(value);
2794
+ function fmt2(value) {
2795
+ const rounded = round2(value);
1864
2796
  if (Object.is(rounded, -0)) {
1865
2797
  return "0";
1866
2798
  }
1867
2799
  return String(rounded);
1868
2800
  }
1869
- function escapeAttr(value) {
2801
+ function escapeAttr2(value) {
1870
2802
  return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1871
2803
  }
1872
- function escapeText(value) {
2804
+ function escapeText2(value) {
1873
2805
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1874
2806
  }
1875
2807
  function symbolFontFamily() {
1876
- return escapeAttr("'Apple Symbols', 'Arial Unicode MS', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'Segoe UI Symbol', serif, sans-serif");
2808
+ return escapeAttr2("'Apple Symbols', 'Arial Unicode MS', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'Segoe UI Symbol', serif, sans-serif");
1877
2809
  }
1878
- function textFontFamily() {
1879
- return escapeAttr("Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif");
2810
+ function textFontFamily2() {
2811
+ return escapeAttr2("Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif");
1880
2812
  }
1881
2813
 
1882
- // src/visual/tree-svg.ts
2814
+ // src/visual/tree.ts
1883
2815
  var TREE_SVG_DEFAULT_VIEWBOX = {
1884
2816
  minX: 0,
1885
2817
  minY: 0,
@@ -1958,8 +2890,8 @@ function getTreeLayout(system = "kaabalah") {
1958
2890
  function getTreeRenderModel(options = {}) {
1959
2891
  const system = options.system ?? "kaabalah";
1960
2892
  const tree = createTree({ system, parts: ["colors"] });
1961
- const viewBox = normalizeViewBox2(options.viewBox);
1962
- const palette = resolvePalette2(options.palette);
2893
+ const viewBox = normalizeViewBox3(options.viewBox);
2894
+ const palette = resolvePalette3(options.palette);
1963
2895
  const highlights = resolveHighlights(options.highlights);
1964
2896
  const activationMap = resolveActivationMap(options.activations);
1965
2897
  const layout = getTreeLayout(system);
@@ -1969,12 +2901,12 @@ function getTreeRenderModel(options = {}) {
1969
2901
  viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
1970
2902
  viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
1971
2903
  );
1972
- const radius = round2(DEFAULT_SPHERE_RADIUS * scale);
1973
- const pathEdgeWidth = round2(DEFAULT_PATH_EDGE_WIDTH * scale);
1974
- const pathMainWidth = round2(DEFAULT_PATH_MAIN_WIDTH * scale);
1975
- const pathHighlightWidth = round2(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
1976
- const sphereHitRadius = round2(DEFAULT_SPHERE_HIT_RADIUS * scale);
1977
- const pathHitStrokeWidth = round2(DEFAULT_PATH_HIT_STROKE_WIDTH * scale);
2904
+ const radius = round3(DEFAULT_SPHERE_RADIUS * scale);
2905
+ const pathEdgeWidth = round3(DEFAULT_PATH_EDGE_WIDTH * scale);
2906
+ const pathMainWidth = round3(DEFAULT_PATH_MAIN_WIDTH * scale);
2907
+ const pathHighlightWidth = round3(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
2908
+ const sphereHitRadius = round3(DEFAULT_SPHERE_HIT_RADIUS * scale);
2909
+ const pathHitStrokeWidth = round3(DEFAULT_PATH_HIT_STROKE_WIDTH * scale);
1978
2910
  const layers = [
1979
2911
  { name: "background", order: 0, description: "Background rectangle when requested." },
1980
2912
  ...options.daathLayer === "back" ? [{ name: "spheres-behind-paths", order: 1, description: "Daath behind the paths." }] : [],
@@ -2108,8 +3040,8 @@ function generateTreeSvg(options = {}) {
2108
3040
  const system = options.system ?? "kaabalah";
2109
3041
  const daathLayer = options.daathLayer ?? "front";
2110
3042
  const tree = createTree({ system, parts: ["colors"] });
2111
- const viewBox = normalizeViewBox2(options.viewBox);
2112
- const palette = resolvePalette2(options.palette);
3043
+ const viewBox = normalizeViewBox3(options.viewBox);
3044
+ const palette = resolvePalette3(options.palette);
2113
3045
  const highlights = resolveHighlights(options.highlights);
2114
3046
  const activationMap = resolveActivationMap(options.activations);
2115
3047
  const spherePositions = scaleCoordinates(CANONICAL_SPHERE_PERCENTAGES, viewBox);
@@ -2118,17 +3050,17 @@ function generateTreeSvg(options = {}) {
2118
3050
  viewBox.width / TREE_SVG_DEFAULT_VIEWBOX.width,
2119
3051
  viewBox.height / TREE_SVG_DEFAULT_VIEWBOX.height
2120
3052
  );
2121
- const radius = round2(DEFAULT_SPHERE_RADIUS * scale);
2122
- const pathEdgeWidth = round2(DEFAULT_PATH_EDGE_WIDTH * scale);
2123
- const pathMainWidth = round2(DEFAULT_PATH_MAIN_WIDTH * scale);
2124
- const pathHighlightWidth = round2(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
2125
- const sphereStrokeWidth = palette.sphereStrokeWidth ? round2(palette.sphereStrokeWidth * scale) : void 0;
3053
+ const radius = round3(DEFAULT_SPHERE_RADIUS * scale);
3054
+ const pathEdgeWidth = round3(DEFAULT_PATH_EDGE_WIDTH * scale);
3055
+ const pathMainWidth = round3(DEFAULT_PATH_MAIN_WIDTH * scale);
3056
+ const pathHighlightWidth = round3(DEFAULT_PATH_HIGHLIGHT_WIDTH * scale);
3057
+ const sphereStrokeWidth = palette.sphereStrokeWidth ? round3(palette.sphereStrokeWidth * scale) : void 0;
2126
3058
  const lines = [];
2127
3059
  const push = (line) => lines.push(line);
2128
3060
  const svgAttributes = [
2129
3061
  `xmlns="http://www.w3.org/2000/svg"`,
2130
- options.width !== void 0 ? `width="${escapeAttr2(String(options.width))}"` : "",
2131
- options.height !== void 0 ? `height="${escapeAttr2(String(options.height))}"` : "",
3062
+ options.width !== void 0 ? `width="${escapeAttr3(String(options.width))}"` : "",
3063
+ options.height !== void 0 ? `height="${escapeAttr3(String(options.height))}"` : "",
2132
3064
  `viewBox="${viewBox.minX} ${viewBox.minY} ${viewBox.width} ${viewBox.height}"`,
2133
3065
  `preserveAspectRatio="xMidYMid meet"`
2134
3066
  ].filter(Boolean);
@@ -2182,7 +3114,7 @@ function generateTreeSvg(options = {}) {
2182
3114
  const background = options.background ?? "white";
2183
3115
  if (background !== "transparent") {
2184
3116
  push(
2185
- `<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${escapeAttr2(background)}"/>`
3117
+ `<rect x="${viewBox.minX}" y="${viewBox.minY}" width="${viewBox.width}" height="${viewBox.height}" fill="${escapeAttr3(background)}"/>`
2186
3118
  );
2187
3119
  }
2188
3120
  if (daathLayer === "back") {
@@ -2232,18 +3164,18 @@ function generateTreeSvg(options = {}) {
2232
3164
  pathColor: color
2233
3165
  });
2234
3166
  push(
2235
- `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr2(edgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : ""}/>`
3167
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(edgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : ""}/>`
2236
3168
  );
2237
3169
  if (activation?.visible && activation.emphasis > 0) {
2238
3170
  push(
2239
- `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr2(color)}" stroke-opacity="${round2(0.18 + activation.emphasis * 0.28)}" stroke-width="${round2(pathEdgeWidth + activation.emphasis * 10)}" stroke-linecap="round"/>`
3171
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-opacity="${round3(0.18 + activation.emphasis * 0.28)}" stroke-width="${round3(pathEdgeWidth + activation.emphasis * 10)}" stroke-linecap="round"/>`
2240
3172
  );
2241
3173
  }
2242
3174
  push(
2243
- `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr2(color)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
3175
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
2244
3176
  );
2245
3177
  push(
2246
- `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr2(palette.pathHighlightColor)}" stroke-opacity="${palette.pathHighlightOpacity}" stroke-width="${pathHighlightWidth}" stroke-linecap="round"/>`
3178
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(palette.pathHighlightColor)}" stroke-opacity="${palette.pathHighlightOpacity}" stroke-width="${pathHighlightWidth}" stroke-linecap="round"/>`
2247
3179
  );
2248
3180
  }
2249
3181
  push(`</g>`);
@@ -2300,11 +3232,11 @@ function renderSphere(push, params) {
2300
3232
  activation: params.activation
2301
3233
  });
2302
3234
  if (params.activation?.visible && params.activation.emphasis > 0) {
2303
- const haloStrokeWidth = round2(3.2 + params.activation.emphasis * 4.8);
2304
- const haloRadius = round2(params.radius + haloStrokeWidth / 2 + 0.7);
3235
+ const haloStrokeWidth = round3(3.2 + params.activation.emphasis * 4.8);
3236
+ const haloRadius = round3(params.radius + haloStrokeWidth / 2 + 0.7);
2305
3237
  const haloColor = params.activation.displayColor;
2306
3238
  push(
2307
- `<circle cx="${point.x}" cy="${point.y}" r="${haloRadius}" fill="none" stroke="${escapeAttr2(haloColor)}" stroke-opacity="${round2(0.24 + params.activation.emphasis * 0.28)}" stroke-width="${haloStrokeWidth}"/>`
3239
+ `<circle cx="${point.x}" cy="${point.y}" r="${haloRadius}" fill="none" stroke="${escapeAttr3(haloColor)}" stroke-opacity="${round3(0.24 + params.activation.emphasis * 0.28)}" stroke-width="${haloStrokeWidth}"/>`
2308
3240
  );
2309
3241
  }
2310
3242
  push(`<g id="sphere-${slug}" clip-path="url(#clip-${slug})">`);
@@ -2332,12 +3264,12 @@ function renderSphere(push, params) {
2332
3264
  renderSlicedSphere(push, point, params.radius, slicedColors, -135);
2333
3265
  } else {
2334
3266
  push(
2335
- `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr2(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
3267
+ `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr3(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
2336
3268
  );
2337
3269
  }
2338
3270
  } else {
2339
3271
  push(
2340
- `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr2(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
3272
+ `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="${escapeAttr3(toPrimaryFill(activeFill, params.palette.defaultSphereFill))}"/>`
2341
3273
  );
2342
3274
  }
2343
3275
  push(
@@ -2351,7 +3283,7 @@ function renderSphere(push, params) {
2351
3283
  push(`</g>`);
2352
3284
  if (params.palette.sphereStrokeColor && params.sphereStrokeWidth) {
2353
3285
  push(
2354
- `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr2(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
3286
+ `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr3(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
2355
3287
  );
2356
3288
  }
2357
3289
  }
@@ -2396,13 +3328,13 @@ function scaleCoordinates(coordinates, viewBox) {
2396
3328
  for (const currentSphereId of TREE_SPHERE_IDS) {
2397
3329
  const point = coordinates[currentSphereId];
2398
3330
  scaled[currentSphereId] = {
2399
- x: round2(viewBox.minX + point.x / 100 * viewBox.width),
2400
- y: round2(viewBox.minY + point.y / 100 * viewBox.height)
3331
+ x: round3(viewBox.minX + point.x / 100 * viewBox.width),
3332
+ y: round3(viewBox.minY + point.y / 100 * viewBox.height)
2401
3333
  };
2402
3334
  }
2403
3335
  return scaled;
2404
3336
  }
2405
- function normalizeViewBox2(viewBox) {
3337
+ function normalizeViewBox3(viewBox) {
2406
3338
  return {
2407
3339
  minX: viewBox?.minX ?? TREE_SVG_DEFAULT_VIEWBOX.minX,
2408
3340
  minY: viewBox?.minY ?? TREE_SVG_DEFAULT_VIEWBOX.minY,
@@ -2503,17 +3435,17 @@ function getViewBoxAnchor(point, viewBox) {
2503
3435
  };
2504
3436
  }
2505
3437
  function getPercentagePathAnchor(path) {
2506
- const y = round2((path.from.y + path.to.y) / 2);
3438
+ const y = round3((path.from.y + path.to.y) / 2);
2507
3439
  return {
2508
- x: round2((path.from.x + path.to.x) / 2),
3440
+ x: round3((path.from.x + path.to.x) / 2),
2509
3441
  y,
2510
3442
  vertical: y < 18 ? "below" : "above"
2511
3443
  };
2512
3444
  }
2513
3445
  function getViewBoxPathAnchor(path, viewBox) {
2514
- const y = round2((path.from.y + path.to.y) / 2);
3446
+ const y = round3((path.from.y + path.to.y) / 2);
2515
3447
  return {
2516
- x: round2((path.from.x + path.to.x) / 2),
3448
+ x: round3((path.from.x + path.to.x) / 2),
2517
3449
  y,
2518
3450
  vertical: y - viewBox.minY < viewBox.height * 0.18 ? "below" : "above"
2519
3451
  };
@@ -2564,7 +3496,7 @@ function getSphereMaterial(params) {
2564
3496
  function clamp01(value) {
2565
3497
  return Math.max(0, Math.min(1, value));
2566
3498
  }
2567
- function resolvePalette2(palette) {
3499
+ function resolvePalette3(palette) {
2568
3500
  if (palette === void 0 || palette === "color") {
2569
3501
  return {
2570
3502
  mode: "color",
@@ -2670,14 +3602,14 @@ function expandColors(fill, count, fallbackColors) {
2670
3602
  }
2671
3603
  return Array.from({ length: count }, () => fill);
2672
3604
  }
2673
- function round2(value) {
3605
+ function round3(value) {
2674
3606
  return Math.round(value * 100) / 100;
2675
3607
  }
2676
3608
  function polarToCartesian(cx, cy, radius, degrees) {
2677
3609
  const radians = Math.PI / 180 * degrees;
2678
3610
  return {
2679
- x: round2(cx + radius * Math.cos(radians)),
2680
- y: round2(cy + radius * Math.sin(radians))
3611
+ x: round3(cx + radius * Math.cos(radians)),
3612
+ y: round3(cy + radius * Math.sin(radians))
2681
3613
  };
2682
3614
  }
2683
3615
  function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
@@ -2688,24 +3620,24 @@ function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
2688
3620
  }
2689
3621
  function renderKether(push, point, radius, baseFill = "#e0e0e0") {
2690
3622
  push(
2691
- `<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr2(baseFill)}"/>`
3623
+ `<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(baseFill)}"/>`
2692
3624
  );
2693
3625
  push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-glow)"/>`);
2694
3626
  const spokes = 16;
2695
- const innerRadius = round2(radius * 0.18);
2696
- const outerRadius = round2(radius * 0.92);
2697
- const innerWidth = round2(radius * 0.04);
3627
+ const innerRadius = round3(radius * 0.18);
3628
+ const outerRadius = round3(radius * 0.92);
3629
+ const innerWidth = round3(radius * 0.04);
2698
3630
  const angleStep = 360 / spokes;
2699
3631
  push(`<g opacity="0.85">`);
2700
3632
  for (let index = 0; index < spokes; index++) {
2701
3633
  const angle = index * angleStep;
2702
3634
  push(`<g transform="rotate(${angle} ${point.x} ${point.y})">`);
2703
- const x0 = round2(point.x - innerWidth);
2704
- const y0 = round2(point.y - innerRadius);
3635
+ const x0 = round3(point.x - innerWidth);
3636
+ const y0 = round3(point.y - innerRadius);
2705
3637
  const x1 = point.x;
2706
- const y1 = round2(point.y - outerRadius);
2707
- const x2 = round2(point.x + innerWidth);
2708
- const y2 = round2(point.y - innerRadius);
3638
+ const y1 = round3(point.y - outerRadius);
3639
+ const x2 = round3(point.x + innerWidth);
3640
+ const y2 = round3(point.y - innerRadius);
2709
3641
  push(
2710
3642
  `<polygon points="${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}" fill="url(#kether-facet)"/>`
2711
3643
  );
@@ -2720,7 +3652,7 @@ function renderSlicedSphere(push, point, radius, colors, startAngle) {
2720
3652
  let currentAngle = startAngle;
2721
3653
  for (let index = 0; index < segmentCount; index++) {
2722
3654
  const path = arcPath2(point.x, point.y, radius * 0.96, currentAngle, currentAngle + step);
2723
- push(`<path d="${path}" fill="${escapeAttr2(colors[index])}" stroke="none"/>`);
3655
+ push(`<path d="${path}" fill="${escapeAttr3(colors[index])}" stroke="none"/>`);
2724
3656
  currentAngle += step;
2725
3657
  }
2726
3658
  }
@@ -2737,7 +3669,7 @@ function renderIridescent(push, point, radius) {
2737
3669
  [1, "#F0E8EE"]
2738
3670
  ];
2739
3671
  const slices = 72;
2740
- const sphereRadius = round2(radius * 0.96);
3672
+ const sphereRadius = round3(radius * 0.96);
2741
3673
  for (let index = 0; index < slices; index++) {
2742
3674
  const t = index / slices;
2743
3675
  const color = interpolateColorStops(stops, t);
@@ -2776,28 +3708,28 @@ function interpolateColor(start, end, factor) {
2776
3708
  }
2777
3709
  function renderYinYang(push, point, radius, fill) {
2778
3710
  const scale = radius / 50;
2779
- const circleRadius = round2(48 * scale);
2780
- const halfRadius = round2(24 * scale);
2781
- const dotRadius = round2(6 * scale);
3711
+ const circleRadius = round3(48 * scale);
3712
+ const halfRadius = round3(24 * scale);
3713
+ const dotRadius = round3(6 * scale);
2782
3714
  const [lightFill, darkFill] = resolveDualToneFill(fill);
2783
3715
  push(`<g transform="rotate(180 ${point.x} ${point.y})">`);
2784
3716
  push(
2785
- `<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="${escapeAttr2(lightFill)}"/>`
3717
+ `<circle cx="${point.x}" cy="${point.y}" r="${circleRadius}" fill="${escapeAttr3(lightFill)}"/>`
2786
3718
  );
2787
3719
  push(
2788
- `<path d="M${point.x},${round2(point.y - circleRadius)} A${circleRadius},${circleRadius} 0 1,1 ${point.x},${round2(point.y + circleRadius)} A${halfRadius},${halfRadius} 0 1,0 ${point.x},${point.y} A${halfRadius},${halfRadius} 0 1,1 ${point.x},${round2(point.y - circleRadius)}" fill="${escapeAttr2(darkFill)}"/>`
3720
+ `<path d="M${point.x},${round3(point.y - circleRadius)} A${circleRadius},${circleRadius} 0 1,1 ${point.x},${round3(point.y + circleRadius)} A${halfRadius},${halfRadius} 0 1,0 ${point.x},${point.y} A${halfRadius},${halfRadius} 0 1,1 ${point.x},${round3(point.y - circleRadius)}" fill="${escapeAttr3(darkFill)}"/>`
2789
3721
  );
2790
3722
  push(
2791
- `<circle cx="${point.x}" cy="${round2(point.y - halfRadius)}" r="${dotRadius}" fill="${escapeAttr2(lightFill)}"/>`
3723
+ `<circle cx="${point.x}" cy="${round3(point.y - halfRadius)}" r="${dotRadius}" fill="${escapeAttr3(lightFill)}"/>`
2792
3724
  );
2793
3725
  push(
2794
- `<circle cx="${point.x}" cy="${round2(point.y + halfRadius)}" r="${dotRadius}" fill="${escapeAttr2(darkFill)}"/>`
3726
+ `<circle cx="${point.x}" cy="${round3(point.y + halfRadius)}" r="${dotRadius}" fill="${escapeAttr3(darkFill)}"/>`
2795
3727
  );
2796
3728
  push(`</g>`);
2797
3729
  }
2798
3730
  function renderSphereTintOverlay(push, point, radius, fill, opacity) {
2799
3731
  push(
2800
- `<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr2(toPrimaryFill(fill, "#ffffff"))}" fill-opacity="${opacity}"/>`
3732
+ `<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(toPrimaryFill(fill, "#ffffff"))}" fill-opacity="${opacity}"/>`
2801
3733
  );
2802
3734
  }
2803
3735
  function resolveDualToneFill(fill) {
@@ -2809,10 +3741,10 @@ function resolveDualToneFill(fill) {
2809
3741
  }
2810
3742
  return ["white", "black"];
2811
3743
  }
2812
- function escapeAttr2(value) {
3744
+ function escapeAttr3(value) {
2813
3745
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2814
3746
  }
2815
3747
 
2816
- export { ANGLE_GLYPHS, ANGLE_GLYPH_PRIMITIVES, ASPECT_GLYPHS, ASPECT_GLYPH_PRIMITIVES, ASTRO_GLYPHS, ASTRO_WHEEL_DEFAULT_ASPECT_SPECS, ASTRO_WHEEL_DEFAULT_VIEWBOX, ASTRO_WHEEL_POINT_GLYPHS, ASTRO_WHEEL_ZODIAC_SIGNS, PLANET_GLYPHS, PLANET_GLYPH_PRIMITIVES, TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, ZODIAC_GLYPHS, ZODIAC_GLYPH_PRIMITIVES, generateAstroGlyphSvg, generateAstroWheelSvg, generateGlyphSvg, generateTreeSvg, getAstroGlyph, getAstroWheelRenderModel, getTreeLayout, getTreeRenderModel, listAstroGlyphs };
2817
- //# sourceMappingURL=chunk-3TBUVMHV.mjs.map
2818
- //# sourceMappingURL=chunk-3TBUVMHV.mjs.map
3748
+ export { ANGLE_GLYPHS, ANGLE_GLYPH_PRIMITIVES, ARCHEOMETER_DEFAULT_VIEWBOX, ASPECT_GLYPHS, ASPECT_GLYPH_PRIMITIVES, ASTRO_GLYPHS, ASTRO_WHEEL_DEFAULT_ASPECT_SPECS, ASTRO_WHEEL_DEFAULT_VIEWBOX, ASTRO_WHEEL_POINT_GLYPHS, ASTRO_WHEEL_ZODIAC_SIGNS, DEFAULT_ARCHEOMETER_MUSICAL_NOTES, DEFAULT_ARCHEOMETER_PLANETS, DEFAULT_ARCHEOMETER_SECTOR_CORRESPONDENCES, DEFAULT_ARCHEOMETER_TRIANGLES, DEFAULT_ARCHEOMETER_TRIANGLE_LABELS, DEFAULT_ARCHEOMETER_UTTERANCE, DEFAULT_ARCHEOMETER_ZODIAC, DEFAULT_ARCHETYPE_MUSICAL_NOTES, DEFAULT_ARCHETYPE_PLANETS, DEFAULT_ARCHETYPE_TRIANGLES, DEFAULT_ARCHETYPE_UTTERANCE, DEFAULT_ARCHETYPE_ZODIAC, PLANET_GLYPHS, PLANET_GLYPH_PRIMITIVES, TREE_PATH_IDS, TREE_SPHERE_IDS, TREE_SPHERE_NAMES, TREE_SVG_DEFAULT_VIEWBOX, ZODIAC_GLYPHS, ZODIAC_GLYPH_PRIMITIVES, generateArcheometerSvg, generateAstroGlyphSvg, generateAstroWheelSvg, generateGlyphSvg, generateTreeSvg, getArcheometerRenderModel, getAstroGlyph, getAstroWheelRenderModel, getTreeLayout, getTreeRenderModel, listAstroGlyphs };
3749
+ //# sourceMappingURL=chunk-SFUCT6I2.mjs.map
3750
+ //# sourceMappingURL=chunk-SFUCT6I2.mjs.map