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