@roxyapi/ui 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/AGENTS.md +3 -1
  2. package/README.md +9 -1
  3. package/components-catalog.json +125 -125
  4. package/dist/cdn/components/endpoint-form.js +1 -1
  5. package/dist/cdn/components/endpoint-form.js.map +1 -1
  6. package/dist/cdn/components/natal-chart.js.map +2 -2
  7. package/dist/cdn/components/relocation-wheel.js.map +2 -2
  8. package/dist/cdn/components/transit-wheel.js +12 -12
  9. package/dist/cdn/components/transit-wheel.js.map +3 -3
  10. package/dist/cdn/locales/de.js +1 -1
  11. package/dist/cdn/locales/de.js.map +2 -2
  12. package/dist/cdn/locales/es.js +1 -1
  13. package/dist/cdn/locales/es.js.map +2 -2
  14. package/dist/cdn/locales/fr.js +1 -1
  15. package/dist/cdn/locales/fr.js.map +2 -2
  16. package/dist/cdn/locales/hi.js +1 -1
  17. package/dist/cdn/locales/hi.js.map +2 -2
  18. package/dist/cdn/locales/pt.js +1 -1
  19. package/dist/cdn/locales/pt.js.map +2 -2
  20. package/dist/cdn/locales/ru.js +1 -1
  21. package/dist/cdn/locales/ru.js.map +2 -2
  22. package/dist/cdn/locales/tr.js +1 -1
  23. package/dist/cdn/locales/tr.js.map +2 -2
  24. package/dist/cdn/roxy-ui.js +17 -17
  25. package/dist/cdn/roxy-ui.js.map +3 -3
  26. package/dist/components/endpoint-form.js +1 -1
  27. package/dist/components/endpoint-form.js.map +1 -1
  28. package/dist/components/natal-chart.d.ts +4 -0
  29. package/dist/components/natal-chart.d.ts.map +1 -1
  30. package/dist/components/natal-chart.js.map +2 -2
  31. package/dist/components/relocation-wheel.js.map +2 -2
  32. package/dist/components/transit-wheel.d.ts +79 -37
  33. package/dist/components/transit-wheel.d.ts.map +1 -1
  34. package/dist/components/transit-wheel.js +11 -11
  35. package/dist/components/transit-wheel.js.map +3 -3
  36. package/dist/i18n/chrome-strings.d.ts +1 -1
  37. package/dist/i18n/chrome-strings.d.ts.map +1 -1
  38. package/dist/index.cjs +5 -5
  39. package/dist/index.cjs.map +3 -3
  40. package/dist/index.js +5 -5
  41. package/dist/index.js.map +3 -3
  42. package/dist/locales/de.d.ts.map +1 -1
  43. package/dist/locales/de.js +1 -1
  44. package/dist/locales/de.js.map +2 -2
  45. package/dist/locales/es.d.ts.map +1 -1
  46. package/dist/locales/es.js +1 -1
  47. package/dist/locales/es.js.map +2 -2
  48. package/dist/locales/fr.d.ts.map +1 -1
  49. package/dist/locales/fr.js +1 -1
  50. package/dist/locales/fr.js.map +2 -2
  51. package/dist/locales/hi.d.ts.map +1 -1
  52. package/dist/locales/hi.js +1 -1
  53. package/dist/locales/hi.js.map +2 -2
  54. package/dist/locales/pt.d.ts.map +1 -1
  55. package/dist/locales/pt.js +1 -1
  56. package/dist/locales/pt.js.map +2 -2
  57. package/dist/locales/ru.d.ts.map +1 -1
  58. package/dist/locales/ru.js +1 -1
  59. package/dist/locales/ru.js.map +2 -2
  60. package/dist/locales/tr.d.ts.map +1 -1
  61. package/dist/locales/tr.js +1 -1
  62. package/dist/locales/tr.js.map +2 -2
  63. package/dist/types/types.gen.d.ts +46 -0
  64. package/dist/types/types.gen.d.ts.map +1 -1
  65. package/dist/version.d.ts +1 -1
  66. package/package.json +1 -1
  67. package/src/components/natal-chart.ts +11 -1
  68. package/src/components/transit-wheel.ts +115 -49
  69. package/src/i18n/chrome-strings.ts +1 -0
  70. package/src/locales/de.ts +1 -0
  71. package/src/locales/es.ts +2 -0
  72. package/src/locales/fr.ts +1 -0
  73. package/src/locales/hi.ts +1 -0
  74. package/src/locales/pt.ts +1 -0
  75. package/src/locales/ru.ts +1 -0
  76. package/src/locales/tr.ts +1 -0
  77. package/src/types/types.gen.ts +46 -0
  78. package/src/version.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/relocation-wheel.ts", "../../src/components/natal-chart.ts", "../../src/utils/string.ts", "../../src/tokens/index.ts", "../../src/utils/base-element.ts", "../../src/i18n/lang.ts", "../../src/i18n/registry.ts", "../../src/i18n/locale-controller.ts", "../../src/utils/base-styles.ts", "../../src/utils/key-guard.ts", "../../src/utils/fetch-controller.ts", "../../src/utils/interp-accordion.ts", "../../src/utils/disclosure.ts", "../../src/utils/markup-data.ts", "../../src/utils/degree.ts", "../../src/utils/format.ts", "../../src/utils/localized.ts", "../../src/utils/tablist.ts"],
4
- "sourcesContent": ["import { css, html, nothing } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n// Registers <roxy-natal-chart>, reused below as the wheel renderer. The\n// relocation response is structurally a natal chart (same planets, houses, and\n// angles), so the wheel is shared rather than duplicated.\nimport './natal-chart.js';\nimport { planetGlyph } from '../tokens/index.js';\nimport type { RelocationChartResponse } from '../types/index.js';\nimport { RoxyDataElement } from '../utils/base-element.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { formatInteger } from '../utils/format.js';\n\ntype HouseChange =\n\tRelocationChartResponse['changes']['planetsChangedHouse'][number];\n\nconst glyphFor = (name: string): string => planetGlyph(name) ?? '';\n\n/**\n * Relocation chart. The birth instant is unchanged, so every planet keeps its\n * natal sign and degree while the houses and angles are recomputed for a new\n * place. Reuses {@link RoxyNatalChart} for the wheel (identical data shape) and\n * adds the relocation read: the move geometry, the planets that change house,\n * and the bodies pulled onto a relocated angle.\n *\n * @remarks\n * Composing another component means two things have to be forwarded or they stop\n * at the boundary: `hide-readings` is passed down, so suppressing prose here also\n * suppresses the wheel's planet readings; and the wheel's parts are re-exported,\n * because a part is only addressable one shadow root deep.\n */\n@customElement('roxy-relocation-wheel')\nexport class RoxyRelocationWheel extends RoxyDataElement<RelocationChartResponse> {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.stack{gap:var(--roxy-space-md,1rem);display:grid}.changes{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);gap:var(--roxy-space-md,1rem);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-primary,#0f172a);margin:0}.move{gap:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-muted,#71717a);flex-wrap:wrap;display:flex}.summary{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a);margin:0}.block-label{font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.06em;color:var(--roxy-muted,#71717a);margin:0 0 var(--roxy-space-xs,.25rem);font-weight:600}.chips{gap:var(--roxy-space-xs,.25rem);flex-wrap:wrap;display:flex}.chip{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 16%, transparent);color:var(--roxy-fg,#0a0a0a);padding:2px 10px}.moves-list{gap:2px;margin:0;padding:0;list-style:none;display:grid}.moves-list li{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a)}.moves-list .arrow{color:var(--roxy-muted,#71717a)}.empty-note{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-muted,#71717a);margin:0}`,\n\t];\n\n\tprotected renderEmpty() {\n\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No relocation data</div>`;\n\t}\n\n\tprotected renderData(data: RelocationChartResponse) {\n\t\tconst c = data.changes;\n\t\treturn html`<div class=\"stack\" part=\"stack\"><roxy-natal-chart heading=\"Relocation chart\" lang=\"${ifDefined(this.effectiveLang())}\" exportparts=\"card, header, tablist, tab, panel, chart, table, aspect-grid, element-modality, legend, details, section, patterns, pattern, readings, reading\" ?hide-readings=\"${this.hideReadings}\" .data=\"${data}\"></roxy-natal-chart><section class=\"changes\" part=\"card changes\"><h3 class=\"title\">What changes at this location</h3><div class=\"move\" part=\"details\">${\n\t\t\t\t\t\ttypeof c?.distanceKm === 'number'\n\t\t\t\t\t\t\t? html`<span>${\n\t\t\t\t\t\t\t\t\t// Under a kilometre the bearing is noise: \"0 km south of\n\t\t\t\t\t\t\t\t\t// birthplace\" reads as a broken calculation, not a same-place\n\t\t\t\t\t\t\t\t\t// relocation.\n\t\t\t\t\t\t\t\t\tMath.round(c.distanceKm) === 0\n\t\t\t\t\t\t\t\t\t\t? 'Same location as birth'\n\t\t\t\t\t\t\t\t\t\t: `${formatInteger(this.effectiveLang(), c.distanceKm)} km ${c.direction ?? ''} of birthplace`\n\t\t\t\t\t\t\t\t}</span>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t} ${\n\t\t\t\t\t\tc\n\t\t\t\t\t\t\t? html`<span>${\n\t\t\t\t\t\t\t\t\t// Name the sign in BOTH branches. Reporting only the boolean\n\t\t\t\t\t\t\t\t\t// put \"Ascendant keeps its sign\" directly above a summary\n\t\t\t\t\t\t\t\t\t// reading \"The Ascendant moves to Gemini\", and a reader\n\t\t\t\t\t\t\t\t\t// cannot tell which one is wrong. Neither was: the sign is\n\t\t\t\t\t\t\t\t\t// Gemini either way. Stating it reconciles the two.\n\t\t\t\t\t\t\t\t\tdata.ascendant?.sign\n\t\t\t\t\t\t\t\t\t\t? `Ascendant ${c.ascendantSignChanged ? 'moves to' : 'stays in'} ${data.ascendant.sign}`\n\t\t\t\t\t\t\t\t\t\t: c.ascendantSignChanged\n\t\t\t\t\t\t\t\t\t\t\t? 'Ascendant changes sign'\n\t\t\t\t\t\t\t\t\t\t\t: 'Ascendant keeps its sign'\n\t\t\t\t\t\t\t\t}</span>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t}</div>${\n\t\t\t\t\t// The only prose here. The move geometry, the angular planets and the\n\t\t\t\t\t// house changes below it are all data and survive hide-readings.\n\t\t\t\t\tdata.interpretation?.summary && !this.hideReadings\n\t\t\t\t\t\t? html`<p class=\"summary\">${data.interpretation.summary}</p>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\tc?.angularPlanets?.length\n\t\t\t\t\t\t? html`<div part=\"section angular-planets\"><p class=\"block-label\">Angular planets here</p><div class=\"chips\">${c.angularPlanets.map((p) => html`<span class=\"chip\">${glyphFor(p)} ${p}</span>`)}</div></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}<div part=\"section house-changes\"><p class=\"block-label\">Planets that change house</p>${\n\t\t\t\t\t\tc?.planetsChangedHouse?.length\n\t\t\t\t\t\t\t? html`<ul class=\"moves-list\">${c.planetsChangedHouse.map(\n\t\t\t\t\t\t\t\t\t(m: HouseChange) =>\n\t\t\t\t\t\t\t\t\t\thtml`<li>${glyphFor(m.planet)} ${m.planet}: house ${m.natalHouse} <span class=\"arrow\">to</span> ${m.relocatedHouse}</li>`,\n\t\t\t\t\t\t\t\t)}</ul>`\n\t\t\t\t\t\t\t: html`<p class=\"empty-note\">No planet changes house at this location.</p>`\n\t\t\t\t\t}</div></section></div>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-relocation-wheel': RoxyRelocationWheel;\n\t}\n}\n", "import { css, html, nothing, svg } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport {\n\taspectSymbol,\n\tplanetGlyph,\n\tSIGNS_ORDER,\n\tsignGlyph,\n} from '../tokens/index.js';\nimport type { NatalChartResponse } from '../types/index.js';\nimport { RoxyDataElement } from '../utils/base-element.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport {\n\tarcMidpoint,\n\tlongitudeToSignPosition,\n\tnormalizeLongitude,\n\toppositePoint,\n\tpolarToCartesian,\n} from '../utils/degree.js';\nimport { disclosureStyles } from '../utils/disclosure.js';\nimport {\n\tASPECT_CLASS,\n\tformatAspectName,\n\tformatDateTime,\n\tformatNumber,\n\tnormalizeAspect,\n} from '../utils/format.js';\nimport {\n\ttype InterpSection,\n\tinterpAccordionStyles,\n} from '../utils/interp-accordion.js';\nimport { display, displayList } from '../utils/localized.js';\nimport { capitalize, lookupKey } from '../utils/string.js';\nimport { renderTablist, tablistStyles } from '../utils/tablist.js';\n\ntype PlanetEntry = NatalChartResponse['planets'][number];\ntype AspectEntry = NatalChartResponse['aspects'][number];\ntype PatternEntry = NonNullable<NatalChartResponse['patterns']>[number];\n\n/**\n * Reading order for detected configurations. A practitioner reads the rare, chart-defining figures first (a Grand Cross reframes the whole chart) and the common ones last, so the response order is re-sorted rather than dumped. Ties break on tightness, the closest to exact first.\n */\nconst PATTERN_ORDER: Record<string, number> = {\n\tGRAND_CROSS: 0,\n\tGRAND_TRINE: 1,\n\tKITE: 2,\n\tT_SQUARE: 3,\n\tYOD: 4,\n\tMYSTIC_RECTANGLE: 5,\n\tSTELLIUM: 6,\n};\n\nconst SIZE = 420;\nconst CENTER = SIZE / 2;\nconst OUTER_R = 164;\nconst SIGN_R = 146;\nconst HOUSE_R = 120;\nconst PLANET_R = 96;\nconst ANGLE_TICK_R = 178;\nconst ANGLE_LABEL_R = 196;\n\n/**\n * The chart shape the wheel actually renders.\n *\n * @remarks\n * `RelocationChartResponse` carries the same planets, houses, angles and birth details as `NatalChartResponse` (`RelocationPlanet` is field-for-field identical to the natal planet item), and differs only by having no `aspects`, `aspectsInterpretation`, `patterns`, `partOfFortune` or `summary`. The wheel already renders without them, so those five are simply optional here.\n *\n * Typing that contract is what lets {@link RoxyRelocationWheel} compose this component honestly. It used to pass its response through a `data as unknown as NatalChartResponse` double cast, which silently asserted five required fields that were not there.\n */\ntype ChartExtras =\n\t| 'aspects'\n\t| 'aspectsInterpretation'\n\t| 'patterns'\n\t| 'partOfFortune'\n\t| 'summary';\nexport type WheelChart = Omit<NatalChartResponse, ChartExtras> &\n\tPartial<Pick<NatalChartResponse, ChartExtras>>;\n\n/**\n * Western natal chart wheel. Renders the 12 zodiac signs, 12 houses, planet\n * markers, and aspect lines from a /astrology/natal-chart response.\n *\n * @remarks\n * **There is deliberately no `house-system` input, and re-adding one would be a\n * lie in the types.** The house system is a REQUEST parameter: /astrology/natal-chart\n * and /astrology/relocation-chart both take it and both echo the system they\n * actually used as a required `houseSystem` field, which is what the legend\n * chip reads. This component computes nothing astrological, so an attribute\n * could never move a cusp; all it could do is print a label contradicting the\n * cusps drawn beside it. One shipped anyway, declared and typed and wired\n * through both framework wrappers, and nothing ever read it, so a consumer who\n * followed our own generated types set it and got silence. Change the system in\n * the REQUEST (the self-fetch form already offers it, straight off the spec) and\n * the response relabels itself.\n *\n * **The equal-sector fallback is visible, on purpose.** With fewer than twelve\n * cusps in the response the wheel draws twelve equal 30 degree sectors from the\n * Ascendant, which is a different chart from a Placidus one; it says so in the\n * accessible name and in a legend chip rather than numbering the sectors 1 to 12\n * and letting a reader assume the response carried them.\n */\n@customElement('roxy-natal-chart')\nexport class RoxyNatalChart extends RoxyDataElement<WheelChart> {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\ttablistStyles,\n\t\tdisclosureStyles,\n\t\tinterpAccordionStyles,\n\t\tcss`.wrap{background:var(--roxy-surface,#fff);width:100%;color:var(--roxy-fg,#0a0a0a);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);gap:var(--roxy-space-md,1rem);grid-template-columns:minmax(0,1fr);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-primary,#0f172a);margin:0}.meta{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}svg{width:100%;max-width:var(--roxy-chart-max-width,560px);aspect-ratio:1;height:auto;margin:0 auto;display:block}.wheel-line{fill:none;stroke:var(--roxy-border,#e4e4e7)}.sign-glyph{fill:var(--roxy-secondary,#475569);font-size:14px;font-family:var(--roxy-font-sans)}.planet-glyph{fill:var(--roxy-accent,#f59e0b);font-size:14px;font-weight:600;font-family:var(--roxy-font-sans)}.planet-deg{fill:var(--roxy-fg,#0a0a0a);font-size:7px;font-family:var(--roxy-font-sans)}@container (width<=480px){.sign-glyph,.planet-glyph{font-size:18px}.planet-deg{font-size:10px}.house-num{font-size:12px}}.planet-deg .retro{fill:var(--roxy-danger,#dc2626)}.planet-leader{stroke:var(--roxy-accent,#f59e0b);stroke-width:.5px;opacity:.55}.house-num{fill:var(--roxy-muted,#71717a);font-size:9px;font-family:var(--roxy-font-sans)}.cusp-deg{fill:var(--roxy-muted,#71717a);font-size:6px;font-family:var(--roxy-font-sans)}.tick{stroke:var(--roxy-border,#e4e4e7)}.tick-major{stroke:var(--roxy-secondary,#475569)}.aspect{stroke-width:.8px;fill:none;opacity:.55}.aspect-trine,.aspect-sextile{stroke:var(--roxy-success,#16a34a)}.aspect-square,.aspect-opposition{stroke:var(--roxy-danger,#dc2626)}.aspect-conjunction{stroke:var(--roxy-accent-ink,#b45309)}.aspect-other{stroke:var(--roxy-muted,#71717a);opacity:.4}.angle-marker{fill:var(--roxy-accent-ink,#b45309);font-size:10px;font-weight:700;font-family:var(--roxy-font-sans);letter-spacing:.04em}.angle-tick{stroke:var(--roxy-accent-ink,#b45309);stroke-width:1.5px}.legend{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);gap:var(--roxy-space-md,1rem);flex-wrap:wrap;display:flex}.legend-swatch{vertical-align:middle;border-radius:50%;width:8px;height:8px;margin-right:4px;display:inline-block}.legend .caveat{color:var(--roxy-fg,#0a0a0a);font-weight:var(--roxy-weight-bold,600);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-full,9999px);padding:1px 8px}.grid-scroll{-webkit-overflow-scrolling:touch;min-width:0;overflow-x:auto}table.aspect-grid{border-collapse:collapse;font-size:var(--roxy-text-xs,.75rem);margin:0 auto}table.aspect-grid th,table.aspect-grid td{text-align:center;border:1px solid var(--roxy-border,#e4e4e7);width:1.6rem;height:1.6rem;padding:0}table.aspect-grid th{color:var(--roxy-secondary,#475569);font-weight:var(--roxy-weight-bold,600)}table.aspect-grid td.cell{cursor:default}table.aspect-grid td.empty{background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 18%, transparent)}table.aspect-grid td .asp{font-size:.95em;line-height:1}table.aspect-grid td.aspect-trine .asp,table.aspect-grid td.aspect-sextile .asp{color:var(--roxy-success,#16a34a)}table.aspect-grid td.aspect-square .asp,table.aspect-grid td.aspect-opposition .asp{color:var(--roxy-danger,#dc2626)}table.aspect-grid td.aspect-conjunction .asp{color:var(--roxy-accent-ink,#b45309)}table.aspect-grid td.aspect-other .asp{color:var(--roxy-muted,#71717a)}.details{margin-top:var(--roxy-space-md,1rem)}.pill-row{gap:var(--roxy-space-xs,.25rem);margin-bottom:var(--roxy-space-xs,.25rem);flex-wrap:wrap;display:flex}.pill{border-radius:var(--roxy-radius-sm,4px);font-size:var(--roxy-text-xs,.75rem);background:color-mix(in srgb, var(--roxy-fg,#0f172a) 8%, transparent);color:var(--roxy-fg,#0f172a);padding:2px 8px}.pill--success{background:color-mix(in srgb, var(--roxy-success,#16a34a) 15%, transparent);color:var(--roxy-success,#16a34a)}.pill--danger{background:color-mix(in srgb, var(--roxy-danger,#dc2626) 15%, transparent);color:var(--roxy-danger,#dc2626)}.pill--muted{background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent);color:var(--roxy-fg,#0a0a0a)}.summary{color:var(--roxy-fg,#0f172a);font-size:var(--roxy-text-sm,.875rem);margin:var(--roxy-space-md,1rem) 0}.em-grid{border-collapse:collapse;font-size:var(--roxy-text-xs,.75rem);width:100%}.em-grid caption{caption-side:top;text-align:left;color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);padding-bottom:var(--roxy-space-xs,.25rem)}.em-grid th,.em-grid td{border:1px solid var(--roxy-border,#e4e4e7);text-align:center;vertical-align:middle;padding:3px 5px}.em-grid th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;letter-spacing:.04em}.em-grid th[scope=row]{text-align:left}.em-grid td{color:var(--roxy-accent,#f59e0b);min-width:1.4rem;font-size:.95em;line-height:1.4}.em-grid .em-total{color:var(--roxy-fg,#0a0a0a);font-weight:var(--roxy-weight-bold,600);background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 25%, transparent)}.em-grid .dominant{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 10%, transparent)}.em-grid th.dominant,.em-grid td.em-total.dominant{color:var(--roxy-fg,#0a0a0a)}.pattern{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);margin-bottom:var(--roxy-space-xs,.25rem);gap:.35rem;display:grid}.pattern-head{flex-wrap:wrap;align-items:baseline;gap:.5rem;display:flex}.pattern-name{font-weight:var(--roxy-weight-bold,600)}.pattern-tag{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 55%, transparent);color:var(--roxy-fg,#0a0a0a);text-transform:capitalize;padding:1px 8px}.pattern-tight{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);font-variant-numeric:tabular-nums;margin-left:auto}.pattern-planets{flex-wrap:wrap;gap:.25rem;display:flex}.planet-chip{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 45%, transparent);color:var(--roxy-fg,#0a0a0a);align-items:baseline;gap:.3rem;padding:1px 8px;display:inline-flex}.planet-chip.apex{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 20%, transparent);font-weight:var(--roxy-weight-bold,600)}.planet-chip .apex-tag{text-transform:uppercase;letter-spacing:.04em;font-size:.85em;font-weight:400}.pattern-interp{color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);margin:0;line-height:1.45}.interp-keywords{flex-wrap:wrap;gap:.25rem;display:flex}.interp-keywords .kw{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-xs,.75rem);border-radius:9999px;padding:1px 8px}`,\n\t];\n\n\t/** Heading above the wheel. Defaults to \"Natal chart\"; reuse (e.g. the relocation wheel) sets its own. */\n\t@property({ type: String })\n\theading = 'Natal chart';\n\n\t/** Which view is showing: the wheel or the planet-by-planet aspect grid. */\n\t@state()\n\tprivate view: 'wheel' | 'grid' = 'wheel';\n\n\tprivate getPlanets(): PlanetEntry[] {\n\t\treturn this.data?.planets ?? [];\n\t}\n\n\tprivate getAscendant(): number {\n\t\treturn this.data?.ascendant?.longitude ?? 0;\n\t}\n\n\tprivate getMidheaven(): number | null {\n\t\tconst m = this.data?.midheaven?.longitude;\n\t\treturn typeof m === 'number' ? m : null;\n\t}\n\n\t/**\n\t * True when the response carried all twelve house cusps, so every house on the\n\t * wheel is a longitude the API sent rather than a 30 degree sector this\n\t * component invented. Read by the spokes, the numbers, the cusp degrees, the\n\t * accessible name and the legend, so the drawing and the words about it cannot\n\t * disagree about which chart is on screen.\n\t */\n\tprivate get hasCusps(): boolean {\n\t\treturn (this.data?.houses ?? []).length === 12;\n\t}\n\n\tprivate toAngle(lon: number): number {\n\t\treturn 180 + this.getAscendant() - lon;\n\t}\n\n\tprotected renderEmpty() {\n\t\treturn html`<div class=\"roxy-empty\" role=\"status\">${this.t('No chart data')}</div>`;\n\t}\n\n\tprotected renderData(data: WheelChart) {\n\t\tconst planets = this.getPlanets();\n\t\tconst aspects = data.aspects ?? [];\n\t\tconst view = this.view;\n\n\t\treturn html`<div class=\"wrap\" part=\"card\"><header part=\"header\"><h2 class=\"title\">${this.t(this.heading)}</h2>${\n\t\t\t\t\tdata.birthDetails\n\t\t\t\t\t\t? html`<div class=\"meta\">${formatDateTime(this.effectiveLang(), data.birthDetails.date, data.birthDetails.time)}</div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</header>${\n\t\t\t\taspects.length > 0\n\t\t\t\t\t? html`${renderTablist({\n\t\t\t\t\t\t\titems: [\n\t\t\t\t\t\t\t\t{ id: 'wheel', label: this.t('Wheel') },\n\t\t\t\t\t\t\t\t{ id: 'grid', label: this.t('Aspect grid') },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tactive: view,\n\t\t\t\t\t\t\tonSelect: (v) => {\n\t\t\t\t\t\t\t\tthis.view = v;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: this.t('Natal chart views'),\n\t\t\t\t\t\t\tidPrefix: 'natal',\n\t\t\t\t\t\t\tcontrols: true,\n\t\t\t\t\t\t})}<div id=\"natal-panel-${view}\" part=\"panel\" role=\"tabpanel\" aria-labelledby=\"natal-tab-${view}\">${view === 'wheel' ? this.renderWheel(planets, aspects) : this.renderAspectGrid(planets, aspects)}</div>`\n\t\t\t\t\t: this.renderWheel(planets, aspects)\n\t\t\t}<div class=\"legend\" part=\"legend\"><span>${this.t('{{count}} planets', { count: planets.length })}</span> ${aspects.length > 0 ? html`<span>${this.t('{{count}} aspects', { count: aspects.length })}</span>` : nothing} ${\n\t\t\t\t\t// The system names the CUSPS, so it is only true while there are\n\t\t\t\t\t// cusps. Without them the caveat takes its place rather than sitting\n\t\t\t\t\t// beside it and contradicting it.\n\t\t\t\t\tthis.hasCusps && data.houseSystem\n\t\t\t\t\t\t? html`<span>${this.t('{{system}} houses', { system: data.houseSystem })}</span>`\n\t\t\t\t\t\t: html`<span class=\"caveat\">${this.t('Equal sectors from the Ascendant, no house cusps in this response')}</span>`\n\t\t\t\t} ${\n\t\t\t\t\taspects.length > 0\n\t\t\t\t\t\t? html`<span><span class=\"legend-swatch\" style=\"background:var(--roxy-success)\"></span>${this.t('Harmonious')}</span> <span><span class=\"legend-swatch\" style=\"background:var(--roxy-danger)\"></span>${this.t('Challenging')}</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</div>${this.renderDetails()} ${this.renderPatterns()} ${this.renderInterpretations()}</div>`;\n\t}\n\n\tprivate renderWheel(planets: PlanetEntry[], aspects: AspectEntry[]) {\n\t\treturn html`<svg viewBox=\"0 0 ${SIZE} ${SIZE}\" part=\"chart\" role=\"img\" aria-label=\"${\n\t\t\t\tthis.hasCusps\n\t\t\t\t\t? this.t('Natal chart wheel with twelve houses, planets, and aspects')\n\t\t\t\t\t: this.t(\n\t\t\t\t\t\t\t'Natal chart wheel with planets and aspects, houses shown as equal sectors from the Ascendant',\n\t\t\t\t\t\t)\n\t\t\t}\"><title>${this.t('Natal chart wheel')}</title><desc>${this.t('Twelve zodiac sign segments around a circular wheel. Planet glyphs are placed at their ecliptic longitudes. Aspect lines connect related planets.')}</desc><circle class=\"wheel-line\" cx=\"${CENTER}\" cy=\"${CENTER}\" r=\"${OUTER_R}\" stroke-width=\"1.5\"/><circle class=\"wheel-line\" cx=\"${CENTER}\" cy=\"${CENTER}\" r=\"${SIGN_R - 14}\" stroke-width=\"0.8\"/><circle class=\"wheel-line\" cx=\"${CENTER}\" cy=\"${CENTER}\" r=\"${HOUSE_R}\" stroke-width=\"1\"/><circle class=\"wheel-line\" cx=\"${CENTER}\" cy=\"${CENTER}\" r=\"${PLANET_R - 16}\" stroke-width=\"0.5\"/>${this.renderTicks()} ${this.renderSpokes()} ${this.renderSigns()} ${this.renderHouseNumbers()} ${this.renderCuspDegrees()} ${this.renderAspects(planets, aspects)} ${this.renderPlanets(planets)} ${this.renderAngles()}</svg>`;\n\t}\n\n\t/**\n\t * Planet-by-planet aspect grid: the lower-triangular matrix astrologers read\n\t * alongside the wheel. Each filled cell shows the aspect glyph colored by\n\t * nature, with the exact orb in the SVG-free `<title>` tooltip.\n\t */\n\tprivate renderAspectGrid(planets: PlanetEntry[], aspects: AspectEntry[]) {\n\t\t// Both values per body, deliberately: `name` is the English one the pairing\n\t\t// and the glyph table are keyed on, `label` is the one a reader sees. The\n\t\t// label is rendered verbatim, never through `capitalize`, which lowercases\n\t\t// the rest of the string and made a tooltip read \"North node\"; the pairing\n\t\t// folds through `lookupKey`, the same normalizer the glyph table uses.\n\t\tconst bodies = planets.map((p) => ({\n\t\t\tname: p.name,\n\t\t\tlabel: display(p, 'name'),\n\t\t}));\n\t\tconst pairKey = (a: string, b: string) =>\n\t\t\t[lookupKey(a), lookupKey(b)].sort().join('|');\n\t\tconst byPair = new Map<string, AspectEntry>();\n\t\tfor (const a of aspects) byPair.set(pairKey(a.planet1, a.planet2), a);\n\t\tif (bodies.length === 0)\n\t\t\treturn html`<p class=\"roxy-empty\" role=\"status\">${this.t('No planets to grid')}</p>`;\n\n\t\treturn html`<div class=\"grid-scroll\" part=\"table aspect-grid\"><table class=\"aspect-grid\"><caption class=\"roxy-sr-only\">${this.t('Planet by planet aspect grid: the aspect each pair of planets forms, read from the planet naming the row across to the planet naming the column.')}</caption><thead><tr><th></th>${bodies.slice(0, -1).map((b) => {\n\t\t\t\t\t\t\tconst g = planetGlyph(b.name) ?? b.label;\n\t\t\t\t\t\t\treturn html`<th scope=\"col\" title=\"${b.label}\">${g}</th>`;\n\t\t\t\t\t\t})}</tr></thead><tbody>${bodies.slice(1).map((row, ri) => {\n\t\t\t\t\t\tconst rowGlyph = planetGlyph(row.name) ?? row.label;\n\t\t\t\t\t\t// Row i (1-based) pairs with columns 0..i-1.\n\t\t\t\t\t\treturn html`<tr><th scope=\"row\" title=\"${row.label}\">${rowGlyph}</th>${bodies.slice(0, ri + 1).map((col) => {\n\t\t\t\t\t\t\t\tconst a = byPair.get(pairKey(row.name, col.name));\n\t\t\t\t\t\t\t\tif (!a) return html`<td class=\"empty\"></td>`;\n\t\t\t\t\t\t\t\tconst name = normalizeAspect(a);\n\t\t\t\t\t\t\t\t// Every aspect the API returns has a glyph, and a miss falls\n\t\t\t\t\t\t\t\t// back to the full aspect NAME. Never to initials or a slice:\n\t\t\t\t\t\t\t\t// an invented two-letter code in a one-glyph cell reads as a\n\t\t\t\t\t\t\t\t// deliberate abbreviation, which is how `sesquiquadrate`\n\t\t\t\t\t\t\t\t// once shipped rendering as the literal text `ses`.\n\t\t\t\t\t\t\t\tconst sym =\n\t\t\t\t\t\t\t\t\taspectSymbol(name) ?? display(a, 'type', formatAspectName(a));\n\t\t\t\t\t\t\t\tconst cls = ASPECT_CLASS[name] ?? 'aspect-other';\n\t\t\t\t\t\t\t\tconst orb = formatNumber(a.orb, 1);\n\t\t\t\t\t\t\t\treturn html`<td class=\"${`cell ${cls}`}\" title=\"${`${row.label} ${display(a, 'type', name)} ${col.label}${orb ? ` (${this.t('orb')} ${orb}\u00B0)` : ''}`}\"><span class=\"asp\">${sym}</span></td>`;\n\t\t\t\t\t\t\t})} ${bodies.slice(ri + 1, -1).map(() => html`<td class=\"empty\"></td>`)}</tr>`;\n\t\t\t\t\t})}</tbody></table></div>`;\n\t}\n\n\tprivate renderAngles() {\n\t\tconst asc = this.getAscendant();\n\t\tconst mc = this.getMidheaven();\n\t\t// ASC/DESC and MC/IC are exact axes; DESC and IC are the opposite points.\n\t\tconst items = [\n\t\t\tthis.renderAngleMark(asc, 'ASC'),\n\t\t\tthis.renderAngleMark(oppositePoint(asc), 'DSC'),\n\t\t];\n\t\tif (mc !== null) {\n\t\t\titems.push(this.renderAngleMark(mc, 'MC'));\n\t\t\titems.push(this.renderAngleMark(oppositePoint(mc), 'IC'));\n\t\t}\n\t\tconst pof = this.data?.partOfFortune?.longitude;\n\t\tif (typeof pof === 'number') {\n\t\t\titems.push(this.renderAngleMark(normalizeLongitude(pof), 'PoF'));\n\t\t}\n\t\tconst vertex = this.data?.vertex?.longitude;\n\t\tif (typeof vertex === 'number') {\n\t\t\titems.push(this.renderAngleMark(normalizeLongitude(vertex), 'Vtx'));\n\t\t}\n\t\treturn items;\n\t}\n\n\tprivate renderAngleMark(longitude: number, label: string) {\n\t\t// Tick AND label share the same angle so the label sits right at the\n\t\t// tip of the arrow, where a practitioner expects to find it. The label\n\t\t// halo at radius ANGLE_LABEL_R is clear of the wheel rim, so there is\n\t\t// no overlap with house dividers despite the shared angle.\n\t\tconst angle = this.toAngle(longitude);\n\t\tconst tickInner = polarToCartesian(CENTER, CENTER, OUTER_R, angle);\n\t\tconst tickOuter = polarToCartesian(CENTER, CENTER, ANGLE_TICK_R, angle);\n\t\tconst labelPos = polarToCartesian(CENTER, CENTER, ANGLE_LABEL_R, angle);\n\t\treturn svg`\n\t\t\t<g>\n\t\t\t\t<line class=\"angle-tick\" x1=${tickInner.x} y1=${tickInner.y} x2=${tickOuter.x} y2=${tickOuter.y} />\n\t\t\t\t<text class=\"angle-marker\" x=${labelPos.x} y=${labelPos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${label}</text>\n\t\t\t</g>\n\t\t`;\n\t}\n\n\tprivate renderSpokes() {\n\t\t// Draw a spoke at each real house cusp longitude so Placidus / Koch\n\t\t// unequal houses render correctly. Fall back to 12 equal spokes from the\n\t\t// Ascendant only when the response carries no houses array, which the\n\t\t// accessible name and the legend caveat both declare.\n\t\tconst houses = this.data?.houses ?? [];\n\t\tconst cuspLongitudes = this.hasCusps\n\t\t\t? houses.map((h) => h.longitude)\n\t\t\t: Array.from({ length: 12 }, (_, i) => this.getAscendant() + i * 30);\n\t\treturn cuspLongitudes.map((lon) => {\n\t\t\tconst angle = this.toAngle(lon);\n\t\t\tconst start = polarToCartesian(CENTER, CENTER, HOUSE_R, angle);\n\t\t\tconst end = polarToCartesian(CENTER, CENTER, OUTER_R, angle);\n\t\t\treturn svg`<line class=\"wheel-line\" x1=${start.x} y1=${start.y} x2=${end.x} y2=${end.y} stroke-width=\"0.8\" />`;\n\t\t});\n\t}\n\n\tprivate renderSigns() {\n\t\treturn SIGNS_ORDER.map((sign, i) => {\n\t\t\tconst angle = this.toAngle(i * 30 + 15);\n\t\t\tconst pos = polarToCartesian(CENTER, CENTER, SIGN_R, angle);\n\t\t\treturn svg`<text class=\"sign-glyph\" x=${pos.x} y=${pos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${signGlyph(sign) ?? ''}</text>`;\n\t\t});\n\t}\n\n\tprivate renderHouseNumbers() {\n\t\tconst houses = this.data?.houses ?? [];\n\t\t// Place each house number at the angular midpoint between its cusp and\n\t\t// the next, so the label sits inside the house even when houses are\n\t\t// unequal. Fall back to equal 30-degree sectors when houses are absent.\n\t\tif (this.hasCusps) {\n\t\t\treturn houses.map((house, i) => {\n\t\t\t\tconst next = houses[(i + 1) % 12];\n\t\t\t\tconst mid = arcMidpoint(\n\t\t\t\t\thouse.longitude,\n\t\t\t\t\tnext ? next.longitude : house.longitude + 30,\n\t\t\t\t);\n\t\t\t\tconst pos = polarToCartesian(\n\t\t\t\t\tCENTER,\n\t\t\t\t\tCENTER,\n\t\t\t\t\tHOUSE_R - 12,\n\t\t\t\t\tthis.toAngle(mid),\n\t\t\t\t);\n\t\t\t\treturn svg`<text class=\"house-num\" x=${pos.x} y=${pos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${house.number}</text>`;\n\t\t\t});\n\t\t}\n\t\tconst ascSignIndex = Math.floor(this.getAscendant() / 30);\n\t\treturn Array.from({ length: 12 }, (_, i) => {\n\t\t\tconst angle = this.toAngle(i * 30 + 15);\n\t\t\tconst pos = polarToCartesian(CENTER, CENTER, HOUSE_R - 12, angle);\n\t\t\tconst houseNum = ((i - ascSignIndex + 12) % 12) + 1;\n\t\t\treturn svg`<text class=\"house-num\" x=${pos.x} y=${pos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${houseNum}</text>`;\n\t\t});\n\t}\n\n\t/**\n\t * Degree ticks on the outer zodiac band: a short mark every 5 degrees and a\n\t * longer one on each 30-degree sign cusp, so the wheel reads like a\n\t * reference-grade chart rather than a bare ring of glyphs.\n\t */\n\tprivate renderTicks() {\n\t\tconst ticks = [];\n\t\tfor (let deg = 0; deg < 360; deg += 5) {\n\t\t\tconst angle = this.toAngle(deg);\n\t\t\tconst isMajor = deg % 30 === 0;\n\t\t\tconst inner = isMajor ? SIGN_R - 14 : OUTER_R - 5;\n\t\t\tconst a = polarToCartesian(CENTER, CENTER, inner, angle);\n\t\t\tconst b = polarToCartesian(CENTER, CENTER, OUTER_R, angle);\n\t\t\tticks.push(\n\t\t\t\tsvg`<line class=${isMajor ? 'tick tick-major' : 'tick'} x1=${a.x} y1=${a.y} x2=${b.x} y2=${b.y} stroke-width=${isMajor ? 1 : 0.5} />`,\n\t\t\t);\n\t\t}\n\t\treturn ticks;\n\t}\n\n\t/**\n\t * Degree-and-minute label printed next to each house cusp on the wheel, so\n\t * the exact cusp position is readable without leaving the chart.\n\t */\n\tprivate renderCuspDegrees() {\n\t\tconst houses = this.data?.houses ?? [];\n\t\tif (!this.hasCusps) return nothing;\n\t\treturn houses.map((house) => {\n\t\t\tconst angle = this.toAngle(house.longitude);\n\t\t\tconst pos = polarToCartesian(CENTER, CENTER, HOUSE_R + 9, angle);\n\t\t\tconst sp = longitudeToSignPosition(house.longitude);\n\t\t\treturn svg`<text class=\"cusp-deg\" x=${pos.x} y=${pos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${sp.degree}\u00B0${String(sp.minute).padStart(2, '0')}'</text>`;\n\t\t});\n\t}\n\n\tprivate renderPlanets(planets: PlanetEntry[]) {\n\t\t// Stellium-aware angular fan-out. Conjunctions within 8\u00B0 are the norm\n\t\t// in professional natal charts (Sun-Mercury-Venus cluster, outer-planet\n\t\t// stacks). To keep every glyph legible without losing precision, sort\n\t\t// by longitude and push later members forward in angle until they\n\t\t// clear a minimum separation, then draw a thin leader line from each\n\t\t// displaced glyph back to the planet's true position on the outer\n\t\t// rim. Conventional approach used by professional Western natal\n\t\t// software; preserves both readability and astronomical accuracy.\n\t\tconst MIN_SEPARATION = 7;\n\t\ttype Placed = {\n\t\t\tp: PlanetEntry;\n\t\t\ttrueLon: number;\n\t\t\tdisplayLon: number;\n\t\t};\n\t\tconst sorted: Placed[] = planets\n\t\t\t.filter((p) => Number.isFinite(p.longitude))\n\t\t\t.map((p) => ({\n\t\t\t\tp,\n\t\t\t\ttrueLon: normalizeLongitude(p.longitude),\n\t\t\t\tdisplayLon: normalizeLongitude(p.longitude),\n\t\t\t}))\n\t\t\t.sort((a, b) => a.trueLon - b.trueLon);\n\t\t// Forward sweep: clamp each to at least prev + MIN_SEPARATION.\n\t\tfor (let i = 1; i < sorted.length; i++) {\n\t\t\tconst prev = sorted[i - 1];\n\t\t\tconst cur = sorted[i];\n\t\t\tif (!prev || !cur) continue;\n\t\t\tconst wanted = prev.displayLon + MIN_SEPARATION;\n\t\t\tif (cur.displayLon < wanted) cur.displayLon = wanted;\n\t\t}\n\t\t// If the cluster overshot 360\u00B0, slide everything back equally so the\n\t\t// stack stays anchored near the original longitudes.\n\t\tconst last = sorted[sorted.length - 1];\n\t\tif (last && last.displayLon > 360) {\n\t\t\tconst shift = last.displayLon - 360;\n\t\t\tfor (const s of sorted) s.displayLon -= shift;\n\t\t}\n\t\treturn sorted.map(({ p, trueLon, displayLon }) => {\n\t\t\tconst trueAngle = this.toAngle(trueLon);\n\t\t\tconst displayAngle = this.toAngle(displayLon);\n\t\t\tconst glyphPos = polarToCartesian(CENTER, CENTER, PLANET_R, displayAngle);\n\t\t\tconst degPos = polarToCartesian(\n\t\t\t\tCENTER,\n\t\t\t\tCENTER,\n\t\t\t\tPLANET_R - 13,\n\t\t\t\tdisplayAngle,\n\t\t\t);\n\t\t\tconst rimPos = polarToCartesian(CENTER, CENTER, OUTER_R - 4, trueAngle);\n\t\t\tconst leaderInner = polarToCartesian(\n\t\t\t\tCENTER,\n\t\t\t\tCENTER,\n\t\t\t\tPLANET_R + 8,\n\t\t\t\tdisplayAngle,\n\t\t\t);\n\t\t\t// The glyph is looked up on the canonical English name and its fallback is\n\t\t\t// the localized one, because the fallback is TEXT the reader is left with.\n\t\t\tconst label = display(p, 'name');\n\t\t\tconst glyph = planetGlyph(p.name) ?? label;\n\t\t\tconst sp = longitudeToSignPosition(p.longitude);\n\t\t\tconst retro = p.isRetrograde === true;\n\t\t\tconst degLabel = `${sp.degree}\u00B0${String(sp.minute).padStart(2, '0')}'`;\n\t\t\tconst offset = Math.abs(displayLon - trueLon) > 0.5;\n\t\t\treturn svg`<g>\n\t\t\t\t${\n\t\t\t\t\toffset\n\t\t\t\t\t\t? svg`<line class=\"planet-leader\" x1=${rimPos.x} y1=${rimPos.y} x2=${leaderInner.x} y2=${leaderInner.y} />`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}\n\t\t\t\t<text class=\"planet-glyph\" x=${glyphPos.x} y=${glyphPos.y} text-anchor=\"middle\" dominant-baseline=\"central\"><title>${label}${retro ? ` ${this.t('retrograde')}` : ''} - ${degLabel} ${display(p, 'sign')}</title>${glyph}</text>\n\t\t\t\t<text class=\"planet-deg\" x=${degPos.x} y=${degPos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${degLabel}${retro ? svg`<tspan class=\"retro\"> \u211E</tspan>` : nothing}</text>\n\t\t\t</g>`;\n\t\t});\n\t}\n\n\tprivate renderDetails() {\n\t\tconst summary = this.data?.summary;\n\t\tconst ai = this.data?.aspectsInterpretation;\n\t\tif (!summary && !ai) return nothing;\n\n\t\t// Pairs, not names: the glyph beside each retrograde body is looked up on the\n\t\t// English value while the pill prints the localized one, and the two arrays\n\t\t// the API returns are index-aligned, which is what makes that possible.\n\t\tconst retrogrades = displayList(summary, 'retrogradePlanets');\n\n\t\treturn html`<div class=\"details\" part=\"details\">${\n\t\t\t\tsummary?.dominantElement || summary?.dominantModality\n\t\t\t\t\t? html`<div class=\"pill-row\">${summary.dominantElement ? html`<span class=\"pill\">${this.t('Dominant element')}: ${display(summary, 'dominantElement')}</span>` : nothing} ${summary.dominantModality ? html`<span class=\"pill\">${this.t('Dominant modality')}: ${display(summary, 'dominantModality')}</span>` : nothing}</div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tai\n\t\t\t\t\t? html`<div class=\"pill-row\"><span class=\"pill pill--success\">${this.t('Harmonious')} ${ai.harmonious}</span> <span class=\"pill pill--danger\">${this.t('Challenging')} ${ai.challenging}</span> <span class=\"pill pill--muted\">${this.t('Neutral')} ${ai.neutral}</span></div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tretrogrades.length > 0\n\t\t\t\t\t? html`<div class=\"pill-row\">${retrogrades.map(({ value, label }) => {\n\t\t\t\t\t\t\t// `?? ''` and never a slice: the full name is printed right\n\t\t\t\t\t\t\t// beside the glyph, so a miss must drop the glyph, not invent\n\t\t\t\t\t\t\t// one. This is the site that shipped `No North Node R`,\n\t\t\t\t\t\t\t// `So South Node R` and `Bl Black Moon Lilith` to a customer.\n\t\t\t\t\t\t\tconst glyph = planetGlyph(value) ?? '';\n\t\t\t\t\t\t\treturn html`<span class=\"pill pill--muted\">${glyph} ${label} R</span>`;\n\t\t\t\t\t\t})}</div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\t// Prose about the aspect balance, not the balance itself: the counts\n\t\t\t\t// above it are the data and stay.\n\t\t\t\tai?.summary && !this.hideReadings\n\t\t\t\t\t? html`<p class=\"summary\">${ai.summary}</p>`\n\t\t\t\t\t: nothing\n\t\t\t} ${this.renderElementModalityGrid()}</div>`;\n\t}\n\n\t/**\n\t * Element by modality grid: the 4x3 cross-tab astrologers read for chart balance. Each body is placed by its sign into one cell (Fire/Earth/Air/Water row, Cardinal/Fixed/Mutable column).\n\t *\n\t * @remarks\n\t * The cells are derived from the planet signs, not read from `summary.elementDistribution`, because a 1D distribution cannot fill a cross-tab. That makes the body set the reconciliation risk: the API counts every body it returns (nodes, Chiron, and Black Moon Lilith included), so the grid must too, or the totals here would contradict the dominant-element pill rendered right above it. Hence the totals count placed bodies rather than `planets.length` (an unrecognized sign would otherwise inflate the grand total past the sum of its rows), the caption names the body set, and the dominant row and column are tinted from `summary` so the pill and the grid land on the same cell.\n\t *\n\t * **The seven headers are CHROME, not response vocabulary, and that is what licenses translating them.** The axes are the component's own 4x3 construction, so six of the seven have no field in the response to defer to and the seventh (the dominant pair) would otherwise have been the only translated word in the table. They therefore go through the chrome catalogue like every other heading here, and each catalogue value is pinned to what the API returns for `dominantElementLocalized` / `dominantModalityLocalized` so the tinted pill above the grid and the header on its row cannot read two different words for one element. Verified live on 2026-08-09 against `/astrology/natal-chart?lang=` in all seven languages; `tests/i18n.test.ts` re-asserts the agreement on a render.\n\t *\n\t * **The English arrays stay, because they are the CELL KEYS.** `SIGNS_ORDER.indexOf` resolves each sign to an index and the modulo picks the bucket, so the array values are compared and keyed on, never read (lesson 31). Only the header text nodes move.\n\t */\n\tprivate renderElementModalityGrid() {\n\t\tconst planets = this.getPlanets();\n\t\tif (planets.length === 0) return nothing;\n\t\tconst ELEMENTS = ['Fire', 'Earth', 'Air', 'Water'] as const;\n\t\tconst MODALITIES = ['Cardinal', 'Fixed', 'Mutable'] as const;\n\t\t// Header text, keyed by the canonical bucket name. Written out as literal\n\t\t// `t()` calls rather than `this.t(el)` so the static scan in\n\t\t// `tests/i18n.test.ts` can see every one of them: a dynamic key is exactly\n\t\t// the shape that ships a string no catalogue carries.\n\t\tconst ELEMENT_LABEL: Record<string, string> = {\n\t\t\tFire: this.t('Fire'),\n\t\t\tEarth: this.t('Earth'),\n\t\t\tAir: this.t('Air'),\n\t\t\tWater: this.t('Water'),\n\t\t};\n\t\t// The column is three glyphs wide, so it shows an abbreviation the\n\t\t// CATALOGUE supplies and carries the full word as its `title`. Never a\n\t\t// substring of the translated word: `slice(0, 3)` counts UTF-16 units with\n\t\t// no idea where the word ends, so Spanish read `Fij` and Devanagari split a\n\t\t// matra off its consonant. `tokens.test.ts` fails on any small slice now.\n\t\tconst MODALITY_LABEL: Record<string, { abbr: string; full: string }> = {\n\t\t\tCardinal: { abbr: this.t('Car'), full: this.t('Cardinal') },\n\t\t\tFixed: { abbr: this.t('Fix'), full: this.t('Fixed') },\n\t\t\tMutable: { abbr: this.t('Mut'), full: this.t('Mutable') },\n\t\t};\n\t\tconst order = SIGNS_ORDER as readonly string[];\n\t\tconst summary = this.data?.summary;\n\t\t// English on both sides, on purpose. These three are lookups, not labels:\n\t\t// the dominant pair is COMPARED against the local element and modality\n\t\t// arrays and each sign is resolved to its index in SIGNS_ORDER, so reading\n\t\t// `dominantElementLocalized` or `signLocalized` here would match nothing on\n\t\t// a translated page and everything on an English one.\n\t\tconst dominantEl = capitalize(summary?.dominantElement ?? '');\n\t\tconst dominantMod = capitalize(summary?.dominantModality ?? '');\n\n\t\tconst cells: Record<string, Record<string, string[]>> = {};\n\t\tfor (const el of ELEMENTS)\n\t\t\tcells[el] = { Cardinal: [], Fixed: [], Mutable: [] };\n\t\tlet placed = 0;\n\t\tfor (const p of planets) {\n\t\t\tconst idx = order.indexOf(capitalize(p.sign ?? ''));\n\t\t\tif (idx < 0) continue;\n\t\t\tconst el = ELEMENTS[idx % 4];\n\t\t\tconst mod = MODALITIES[idx % 3];\n\t\t\t// The cell shows the glyph alone, so a miss falls back to the full name:\n\t\t\t// wide and obviously wrong, rather than a plausible two-letter code.\n\t\t\tconst glyph = planetGlyph(p.name) ?? display(p, 'name');\n\t\t\tcells[el]?.[mod]?.push(glyph);\n\t\t\tplaced++;\n\t\t}\n\t\tif (placed === 0) return nothing;\n\n\t\tconst colTotal = (m: string) =>\n\t\t\tELEMENTS.reduce((s, el) => s + (cells[el]?.[m]?.length ?? 0), 0);\n\n\t\t// Same scroll box as the aspect grid beside it. A cell holds a joined list\n\t\t// of glyphs, so it is normally tiny, but a body with no glyph renders its\n\t\t// FULL name there by design, and the table has to carry that without\n\t\t// dragging the card out with it. `.grid-scroll` pairs `overflow-x: auto`\n\t\t// with `min-width: 0`, and it is the `min-width` half that actually lets a\n\t\t// grid item scroll instead of growing to fit.\n\t\treturn html`<div class=\"grid-scroll\"><table class=\"em-grid\" part=\"table element-modality\" aria-label=\"${this.t('Element and modality distribution')}\"><caption>${this.t('All {{count}} bodies in the chart, placed by sign', { count: placed })}</caption><thead><tr><th></th>${MODALITIES.map(\n\t\t\t\t\t\t(m) =>\n\t\t\t\t\t\t\thtml`<th scope=\"col\" title=\"${MODALITY_LABEL[m]?.full ?? m}\" class=\"${m === dominantMod ? 'dominant' : ''}\">${MODALITY_LABEL[m]?.abbr ?? m}</th>`,\n\t\t\t\t\t)}<th scope=\"col\">${this.t('Total')}</th></tr></thead><tbody>${ELEMENTS.map((el) => {\n\t\t\t\t\tconst isDomRow = el === dominantEl;\n\t\t\t\t\tconst rowTotal = MODALITIES.reduce(\n\t\t\t\t\t\t(s, m) => s + (cells[el]?.[m]?.length ?? 0),\n\t\t\t\t\t\t0,\n\t\t\t\t\t);\n\t\t\t\t\treturn html`<tr><th scope=\"row\" class=\"${isDomRow ? 'dominant' : ''}\">${ELEMENT_LABEL[el] ?? el}</th>${MODALITIES.map(\n\t\t\t\t\t\t\t(m) =>\n\t\t\t\t\t\t\t\thtml`<td class=\"${isDomRow || m === dominantMod ? 'dominant' : ''}\">${(cells[el]?.[m] ?? []).join(' ')}</td>`,\n\t\t\t\t\t\t)}<td class=\"${isDomRow ? 'em-total dominant' : 'em-total'}\">${rowTotal}</td></tr>`;\n\t\t\t\t})}<tr><th scope=\"row\">${this.t('Total')}</th>${MODALITIES.map(\n\t\t\t\t\t\t(m) =>\n\t\t\t\t\t\t\thtml`<td class=\"${m === dominantMod ? 'em-total dominant' : 'em-total'}\">${colTotal(m)}</td>`,\n\t\t\t\t\t)}<td class=\"em-total\">${placed}</td></tr></tbody></table></div>`;\n\t}\n\n\t/**\n\t * Detected multi-planet configurations. Each card names the figure, tags the element or modality it pivots on, flags a dissociate (out-of-sign) figure, and puts the apex planet first with its own chip, because the apex is the point the whole configuration discharges through.\n\t *\n\t * @remarks\n\t * A pattern carries no localized partner for its `name`, `element`, `modality` or its `planets` list, so all four render English on every page. Do NOT translate the chips by looking each body up in `planets[].nameLocalized`: the response is the authority for its own vocabulary, and a second translation of the same fact assembled here is exactly what can end up disagreeing with the wheel beside it.\n\t */\n\tprivate renderPatterns() {\n\t\tconst patterns = this.data?.patterns ?? [];\n\t\tif (patterns.length === 0) return nothing;\n\t\tconst sorted = [...patterns].sort(\n\t\t\t(a, b) =>\n\t\t\t\t(PATTERN_ORDER[a.kind] ?? 9) - (PATTERN_ORDER[b.kind] ?? 9) ||\n\t\t\t\t(b.tightness ?? 0) - (a.tightness ?? 0),\n\t\t);\n\t\treturn html`<section class=\"block\" part=\"section patterns\"><h3>${this.t('Chart patterns')}</h3>${sorted.map((p) => this.renderPattern(p))}</section>`;\n\t}\n\n\tprivate renderPattern(p: PatternEntry) {\n\t\tconst planets = p.planets ?? [];\n\t\t// Apex first: the spec already orders it first for Kite, T-Square, and Yod,\n\t\t// but sorting here keeps the chip row honest for any future pattern kind.\n\t\tconst ordered = p.apex\n\t\t\t? [...planets].sort((a, b) => Number(b === p.apex) - Number(a === p.apex))\n\t\t\t: planets;\n\t\treturn html`<div class=\"pattern\" part=\"pattern\"><div class=\"pattern-head\"><span class=\"pattern-name\">${p.name}</span> ${p.element ? html`<span class=\"pattern-tag\">${p.element}</span>` : nothing} ${p.modality ? html`<span class=\"pattern-tag\">${p.modality}</span>` : nothing} ${\n\t\t\t\t\tp.dissociate\n\t\t\t\t\t\t? html`<span class=\"pattern-tag\" title=\"${this.t('Out of sign: one or more planets sit outside the pattern element or modality, so the theme holds but runs weaker.')}\">${this.t('Dissociate')}</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\t// Math.round, not formatNumber(x, 0): that helper strips trailing\n\t\t\t\t\t// zeros, so a 100% tight pattern renders as \"1%\".\n\t\t\t\t\ttypeof p.tightness === 'number'\n\t\t\t\t\t\t? html`<span class=\"pattern-tight\">${this.t('{{percent}}% tight', { percent: Math.round(p.tightness) })}</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</div><div class=\"pattern-planets\">${ordered.map((name) => {\n\t\t\t\t\tconst glyph = planetGlyph(name);\n\t\t\t\t\tconst isApex = Boolean(p.apex) && name === p.apex;\n\t\t\t\t\treturn html`<span class=\"${isApex ? 'planet-chip apex' : 'planet-chip'}\">${glyph ? html`<span aria-hidden=\"true\">${glyph}</span>` : nothing}${name}${isApex ? html`<span class=\"apex-tag\">${this.t('apex')}</span>` : nothing}</span>`;\n\t\t\t\t})}</div>${\n\t\t\t\t// The figure, its planets and its tightness are the finding; the\n\t\t\t\t// paragraph is the reading of it.\n\t\t\t\tp.interpretation && !this.hideReadings\n\t\t\t\t\t? html`<p class=\"pattern-interp\">${p.interpretation}</p>`\n\t\t\t\t\t: nothing\n\t\t\t}</div>`;\n\t}\n\n\tprivate renderInterpretations() {\n\t\tconst sections: InterpSection[] = this.getPlanets()\n\t\t\t.filter((p) => p.interpretation)\n\t\t\t.map((p) => {\n\t\t\t\tconst interp = p.interpretation!;\n\t\t\t\tconst glyph = planetGlyph(p.name) ?? '';\n\t\t\t\tconst deg = formatNumber(p.degree ?? 0, 1);\n\t\t\t\tconst label = display(p, 'name');\n\t\t\t\tconst lead = interp.summary || interp.detailed || '';\n\t\t\t\t// `detailed` only becomes a second paragraph when `summary` already\n\t\t\t\t// took the lead line, so a response carrying one or the other never\n\t\t\t\t// prints the same prose twice.\n\t\t\t\tconst detail = interp.summary ? interp.detailed : undefined;\n\t\t\t\treturn {\n\t\t\t\t\tlabel: `${glyph} ${label}`.trim(),\n\t\t\t\t\taside: [display(p, 'sign'), deg].filter(Boolean).join(' '),\n\t\t\t\t\tbody: lead,\n\t\t\t\t\textra: html`${detail ? html`<p>${detail}</p>` : nothing} ${\n\t\t\t\t\t\tinterp.keywords?.length\n\t\t\t\t\t\t\t? html`<div class=\"interp-keywords\">${interp.keywords.map((k) => html`<span class=\"kw\">${k}</span>`)}</div>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t}`,\n\t\t\t\t};\n\t\t\t});\n\t\treturn this.renderInterpretation(\n\t\t\tsections,\n\t\t\t'natal-planet-readings',\n\t\t\tthis.t('Planet readings'),\n\t\t);\n\t}\n\n\tprivate renderAspects(planets: PlanetEntry[], aspects: AspectEntry[]) {\n\t\t// Keyed on the canonical English name at BOTH ends, because this map is how\n\t\t// an aspect finds the two longitudes its line is drawn between. The localized\n\t\t// names go in the `<title>` and nowhere near the key.\n\t\tconst planetMap = new Map<string, number>();\n\t\tfor (const p of planets) {\n\t\t\tif (typeof p.longitude !== 'number') continue;\n\t\t\tconst name = lookupKey(p.name);\n\t\t\tif (name) planetMap.set(name, p.longitude);\n\t\t}\n\t\treturn aspects.map((a) => {\n\t\t\tconst l1 = planetMap.get(lookupKey(a.planet1));\n\t\t\tconst l2 = planetMap.get(lookupKey(a.planet2));\n\t\t\tif (l1 === undefined || l2 === undefined) return nothing;\n\t\t\tconst p1 = polarToCartesian(\n\t\t\t\tCENTER,\n\t\t\t\tCENTER,\n\t\t\t\tPLANET_R - 18,\n\t\t\t\tthis.toAngle(l1),\n\t\t\t);\n\t\t\tconst p2 = polarToCartesian(\n\t\t\t\tCENTER,\n\t\t\t\tCENTER,\n\t\t\t\tPLANET_R - 18,\n\t\t\t\tthis.toAngle(l2),\n\t\t\t);\n\t\t\tconst aspectName = normalizeAspect(a);\n\t\t\tconst aspectClass = ASPECT_CLASS[aspectName] ?? 'aspect-other';\n\t\t\tconst orbLabel = formatNumber(a.orb, 1);\n\t\t\treturn svg`<line class=${`aspect ${aspectClass}`} x1=${p1.x} y1=${p1.y} x2=${p2.x} y2=${p2.y}><title>${display(a, 'planet1')} ${display(a, 'type', aspectName)} ${display(a, 'planet2')}${orbLabel ? ` (${this.t('orb')} ${orbLabel}\u00B0)` : ''}</title></line>`;\n\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-natal-chart': RoxyNatalChart;\n\t}\n}\n", "/**\n * Shared string helpers used across components. Single source of truth so the\n * same formatting rules apply to every key/label/title that surfaces in the\n * shadow tree.\n *\n * - `lookupKey`: the ONE normalizer every lookup table in this library is keyed\n * and read by (`tokens/index.ts` glyphs and abbreviations, `i18n/` chrome\n * strings).\n * - `capitalize`: title-cases the first character, lowercases the rest. A\n * DISPLAY helper only; it is not a lookup key (see `lookupKey`).\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\n/**\n * Fold a name to the canonical key its lookup table is stored under: lower case, every run of spaces, underscores and hyphens collapsed to one space, trimmed.\n *\n * @remarks\n * This exists because a GUESSED key spelling is a defect class this repo has now shipped twice. The glyph tables were keyed off whatever {@link capitalize} happened to produce (`North node`), while the API returns `North Node`, so every call site that reached the table without first calling `capitalize` missed and fell through to a fabricated abbreviation. Aspects hit the same wall from the other side: `/aspects` returns `SEMI SEXTILE` where synastry returns `SEMI_SEXTILE`.\n *\n * One normalizer, applied when a table is DEFINED and again when it is READ, removes the whole class: no call site has to remember a convention, and no table has to guess a spelling. Use it for every new table keyed by an API-supplied name.\n *\n * @example\n * ```ts\n * lookupKey('North Node'); // 'north node'\n * lookupKey('SEMI_SEXTILE'); // 'semi sextile'\n * lookupKey('semi-sextile'); // 'semi sextile'\n * ```\n */\nexport function lookupKey(s: string): string {\n\treturn s\n\t\t.toLowerCase()\n\t\t.replace(/[\\s_-]+/g, ' ')\n\t\t.trim();\n}\n\nexport function capitalize(s: string): string {\n\tif (!s) return '';\n\treturn s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n}\n\nexport function humanize(s: string): string {\n\treturn (\n\t\ts\n\t\t\t.replace(/[_-]+/g, ' ')\n\t\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t\t// Split a trailing/embedded digit off a word so \"person1\" reads \"Person 1\"\n\t\t\t// and every group legend and field label spaces its ordinal.\n\t\t\t.replace(/([a-z])([0-9])/g, '$1 $2')\n\t\t\t.replace(/^\\w/, (c) => c.toUpperCase())\n\t);\n}\n", "/**\n * Symbol constants used across components. Single source of truth so chart\n * wheels, card headers, hexagram displays, and panchang tables stay visually\n * consistent.\n *\n * @remarks\n * **Every table here is keyed by {@link lookupKey} and read ONLY through the accessor beside it.** The raw records are deliberately not exported: a component that indexes a record directly has to guess the key convention, and a guessed spelling is what shipped `No North Node R`, `So South Node R` and `Bl Black Moon Lilith` into a live customer's natal chart. The API returns `North Node` with a space; the table was keyed `North node`, the spelling {@link capitalize} happens to produce, so every call site that forgot to call `capitalize` first missed the table.\n *\n * **A miss returns `undefined`, never a manufactured abbreviation.** The old `?? name.slice(0, 2)` fallback is what made the defect survive review: a failed lookup renders as a plausible two-letter code that reads exactly like an intentional abbreviation, so nothing about the output says \"this is broken\". A caller that can omit the glyph should omit it (`?? ''`); a caller that must show something falls back to the FULL name, which is visibly wrong at the size these slots are drawn.\n *\n * `tests/tokens.test.ts` resolves every body, sign and aspect name the committed spec can emit against these tables, so a vocabulary the API gains cannot ship unglyphed.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Look one name up in a normalized table. The single read path for every map in this file. */\nconst resolve = (\n\ttable: Record<string, string>,\n\tname: string | undefined | null,\n): string | undefined => (name ? table[lookupKey(name)] : undefined);\n\nconst PLANET_GLYPH: Record<string, string> = {\n\tsun: '\u2609',\n\tmoon: '\u263D',\n\tmercury: '\u263F',\n\tvenus: '\u2640',\n\tearth: '\u2641',\n\tmars: '\u2642',\n\tjupiter: '\u2643',\n\tsaturn: '\u2644',\n\turanus: '\u2645',\n\tneptune: '\u2646',\n\tpluto: '\u2647',\n\trahu: '\u260A',\n\tketu: '\u260B',\n\tascendant: 'Asc',\n\tlagna: 'La',\n\t'north node': '\u260A',\n\t'south node': '\u260B',\n\tchiron: '\u26B7',\n\tlilith: '\u26B8',\n\t'black moon lilith': '\u26B8',\n};\n\n/** Astrological glyph for a planet or point, or `undefined` when the library has none for it. */\nexport const planetGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_GLYPH, name);\n\nconst PLANET_ABBR: Record<string, string> = {\n\tsun: 'Su',\n\tmoon: 'Mo',\n\tmercury: 'Me',\n\tvenus: 'Ve',\n\tmars: 'Ma',\n\tjupiter: 'Ju',\n\tsaturn: 'Sa',\n\turanus: 'Ur',\n\tneptune: 'Ne',\n\tpluto: 'Pl',\n\trahu: 'Ra',\n\tketu: 'Ke',\n\tascendant: 'Asc',\n\tlagna: 'La',\n};\n\n/** Two-letter graha code for the tight cells of a North/South Indian kundli, or `undefined`. */\nexport const planetAbbr = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_ABBR, name);\n\nconst SIGN_GLYPH: Record<string, string> = {\n\taries: '\u2648',\n\ttaurus: '\u2649',\n\tgemini: '\u264A',\n\tcancer: '\u264B',\n\tleo: '\u264C',\n\tvirgo: '\u264D',\n\tlibra: '\u264E',\n\tscorpio: '\u264F',\n\tsagittarius: '\u2650',\n\tcapricorn: '\u2651',\n\taquarius: '\u2652',\n\tpisces: '\u2653',\n};\n\n/** Zodiac glyph for a sign name in any case, or `undefined`. */\nexport const signGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(SIGN_GLYPH, name);\n\nconst SIGN_ABBR: Record<string, string> = {\n\taries: 'Ar',\n\ttaurus: 'Ta',\n\tgemini: 'Ge',\n\tcancer: 'Cn',\n\tleo: 'Le',\n\tvirgo: 'Vi',\n\tlibra: 'Li',\n\tscorpio: 'Sc',\n\tsagittarius: 'Sg',\n\tcapricorn: 'Cp',\n\taquarius: 'Aq',\n\tpisces: 'Pi',\n};\n\n/** Two-letter rashi code for kundli cells and grid headers, or `undefined`. */\nexport const signAbbr = (name: string | undefined | null): string | undefined =>\n\tresolve(SIGN_ABBR, name);\n\n/** The twelve signs in zodiacal order. Display values, not lookup keys: read them through {@link signGlyph} / {@link signAbbr}. */\nexport const SIGNS_ORDER = [\n\t'Aries',\n\t'Taurus',\n\t'Gemini',\n\t'Cancer',\n\t'Leo',\n\t'Virgo',\n\t'Libra',\n\t'Scorpio',\n\t'Sagittarius',\n\t'Capricorn',\n\t'Aquarius',\n\t'Pisces',\n] as const;\n\n/**\n * Glyph per aspect. Used by the natal, transit and synastry aspect tables.\n *\n * @remarks\n * These are the nine aspects Unicode itself defines as a set, in its Miscellaneous Symbols block note: `260C, 26BA, 2220, 26B9, 25A1, 25B3, 26BC, 26BB, 260D` for 0, 30, 45, 60, 90, 120, 135, 150 and 180 degrees. That is exactly the vocabulary the API returns, so every aspect resolves to a real glyph and none falls through to a truncated slug.\n *\n * Do not substitute the visually similar maths operators. Unicode lists `\u22BB` XOR and `\u22BC` NAND as cross-references FROM the real quincunx and semisextile glyphs, so they look like safe stand-ins and are easy to pair the wrong way round, which renders a 150 degree quincunx with the 30 degree semisextile symbol. An astrologer reads the glyph, not the tooltip.\n */\nconst ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\tsemisextile: '\u26BA',\n\t'semi sextile': '\u26BA',\n\tsemisquare: '\u2220',\n\t'semi square': '\u2220',\n\tsextile: '\u26B9',\n\tsquare: '\u25A1',\n\ttrine: '\u25B3',\n\tsesquiquadrate: '\u26BC',\n\tquincunx: '\u26BB',\n\topposition: '\u260D',\n};\n\n/** Aspect glyph for any of the separator forms the endpoints use (`SEMI_SEXTILE`, `SEMI SEXTILE`, `semi-sextile`), or `undefined`. */\nexport const aspectSymbol = (\n\tname: string | undefined | null,\n): string | undefined => resolve(ASPECT_SYMBOL, name);\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nconst TRIGRAM_GLYPH: Record<string, string> = {\n\theaven: '\u2630',\n\tlake: '\u2631',\n\tfire: '\u2632',\n\tthunder: '\u2633',\n\twind: '\u2634',\n\twater: '\u2635',\n\tmountain: '\u2636',\n\tearth: '\u2637',\n};\n\n/** Trigram glyph for a trigram name in any case, or `undefined`. */\nexport const trigramGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(TRIGRAM_GLYPH, name);\n\n/** Moon phase emoji set. Used by the moon phase card. */\nconst MOON_PHASE_EMOJI: Record<string, string> = {\n\t'new moon': '\uD83C\uDF11',\n\t'waxing crescent': '\uD83C\uDF12',\n\t'first quarter': '\uD83C\uDF13',\n\t'waxing gibbous': '\uD83C\uDF14',\n\t'full moon': '\uD83C\uDF15',\n\t'waning gibbous': '\uD83C\uDF16',\n\t'last quarter': '\uD83C\uDF17',\n\t'waning crescent': '\uD83C\uDF18',\n};\n\n/**\n * Emoji for a lunar phase, or `undefined`.\n *\n * @remarks\n * The live API suffixes most phase names (`Waxing Gibbous Moon`) and calls the third quarter `Third Quarter Moon`, while only new and full moon carry the suffix in the table. Both reconciliations live here rather than in the card, so any component reading a phase name resolves the same eight phases from the same four spellings.\n */\nexport const moonPhaseEmoji = (\n\tname: string | undefined | null,\n): string | undefined => {\n\tif (!name) return undefined;\n\tconst key = lookupKey(name);\n\tconst bare = key.replace(/ moon$/, '');\n\tconst alias = bare === 'third quarter' ? 'last quarter' : bare;\n\treturn MOON_PHASE_EMOJI[key] ?? MOON_PHASE_EMOJI[alias];\n};\n", "import {\n\ttype CSSResultGroup,\n\thtml,\n\tLitElement,\n\tnothing,\n\ttype PropertyValues,\n} from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { resolveLang } from '../i18n/lang.js';\nimport { LocaleController } from '../i18n/locale-controller.js';\nimport { translate } from '../i18n/registry.js';\nimport { baseStyles } from './base-styles.js';\nimport { buildRequest, FetchController } from './fetch-controller.js';\nimport {\n\ttype InterpSection,\n\trenderInterpAccordion,\n} from './interp-accordion.js';\nimport { MarkupDataController } from './markup-data.js';\n\n/**\n * Shared base for every data-driven Roxy component. Consolidates the things every component used to repeat by hand and adds the self-contained, drop-in behavior: controlled-mode hydration, an opt-in self-fetch (form, request, loading, error, empty), the typed `data` slot, and the render switch. A subclass implements one method, {@link RoxyDataElement.renderData}.\n *\n * @remarks\n * Two render modes, one component, which is the whole drop-in contract:\n *\n * - Controlled: a server (WordPress, JSX SSR, static HTML) fetches the response and injects it as a direct-child `<script type=\"application/json\" class=\"roxy-data\">`. {@link MarkupDataController} hydrates `data` from it on connect. No key reaches the browser. This is the path the WordPress plugin drives, and it is unchanged by the base class.\n * - Uncontrolled: no data is injected, but a `data-endpoint` and a `pk_` `publishable-key` are set. The component renders its own `<roxy-endpoint-form>` (an internal detail, never placed by the consumer), and on submit fetches through {@link FetchController}, which refuses any non-publishable key. The result populates `data` and the component renders it.\n *\n * The JavaScript `data` property always wins over markup, so a host that assigns `el.data = \u2026` after upgrade is authoritative.\n *\n * Self-fetch needs `<roxy-endpoint-form>` (and `<roxy-location-search>`) registered. The CDN bundle and the full `@roxyapi/ui` entry register everything; per-component ESM consumers that want self-fetch import the form component too.\n *\n * Two things every subclass inherits for the host page to shape the render from outside the shadow root, with no JavaScript: the `hide-readings` attribute ({@link RoxyDataElement.hideReadings}), and the `part` names on the base's own branches (`form`, `loading`, `error`, `edit-bar`, `attribution`). A component adds `part` to its own structural blocks; the vocabulary is in `docs/authoring.md`.\n *\n * @example\n * ```ts\n * @customElement('roxy-dream-card')\n * export class RoxyDreamCard extends RoxyDataElement<GetDreamSymbolResponse> {\n * static styles = [baseStyles, css`.card { \u2026 }`];\n * protected renderData(d: GetDreamSymbolResponse) {\n * return html`<article class=\"card\">\u2026</article>`;\n * }\n * protected renderEmpty() {\n * return html`<div class=\"roxy-empty\" role=\"status\">No dream symbol</div>`;\n * }\n * }\n * ```\n */\nexport abstract class RoxyDataElement<T = unknown> extends LitElement {\n\tstatic styles: CSSResultGroup = [baseStyles];\n\n\t/** Typed RoxyAPI response. Assigned in JavaScript, hydrated from the roxy-data island, or set by a self-fetch. */\n\t@property({ attribute: false })\n\tdata: T | null = null;\n\n\t/** Endpoint path for self-fetch, e.g. \"astrology/natal-chart\" or \"dreams/symbols/{id}\". Empty disables self-fetch (controlled mode only). */\n\t@property({ type: String, attribute: 'data-endpoint' })\n\tendpoint = '';\n\n\t/** HTTP method for self-fetch. */\n\t@property({ type: String })\n\tmethod: 'GET' | 'POST' = 'POST';\n\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side. */\n\t@property({ type: String, attribute: 'publishable-key' })\n\tpublishableKey?: string;\n\n\t/** Override the API origin for self-hosted or proxied deployments. */\n\t@property({ type: String, attribute: 'base-url' })\n\tbaseUrl?: string;\n\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\t@property({ type: String, attribute: 'spec-url' })\n\tspecUrl?: string;\n\n\t/** Consumer backend route that proxies the request (holds the secret key). When set, self-fetch POSTs the request here instead of calling RoxyAPI directly, so no key reaches the browser. The server-rendered (WordPress) path. */\n\t@property({ type: String, attribute: 'submit-url' })\n\tsubmitUrl?: string;\n\n\t/** Persist the last self-fetch form values in sessionStorage (keyed by endpoint) and prefill the form on reload. */\n\t@property({ type: Boolean })\n\tremember = false;\n\n\t/**\n\t * Render the chart and the data, and omit the written interpretation. Off by default, so a component that does not set it is byte-identical to before.\n\t *\n\t * @remarks\n\t * The suppressed content is the prose an endpoint returns ABOUT the result: the interpretation accordion, the interpretive paragraphs, and the keyword chips that belong to them. Everything a practitioner reads the numbers off stays: wheels, tables, grids, legends, pills, counts and dates. The reading is dropped from the DOM rather than hidden with CSS, so a page that publishes the chart alone never ships the prose it is not showing.\n\t *\n\t * Set it when the page supplies its own words, which is the common case for a practitioner site that wants the graphic under its own writing.\n\t */\n\t@property({ type: Boolean, attribute: 'hide-readings', reflect: true })\n\thideReadings = false;\n\n\t/** Override the self-fetch form's submit-button label. Empty derives one from the endpoint. */\n\t@property({ type: String, attribute: 'submit-label' })\n\tsubmitLabel?: string;\n\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch or auto-mount result. Off by default; any value except \"off\"/\"false\" enables it. The one-tag widgets script turns it on unless data-attribution=\"off\". Never shown in controlled mode. */\n\t@property({ type: String })\n\tattribution?: string;\n\n\t/** True while an uncontrolled self-fetch is in flight. Public so {@link FetchController} can drive it. */\n\t@state()\n\tloading = false;\n\n\t/** Message from a failed self-fetch, or null. Public so {@link FetchController} can drive it. */\n\t@state()\n\terror: string | null = null;\n\n\t/**\n\t * True once a self-fetch (not a consumer-assigned or island-hydrated `data`) produced the current result. It gates the interactive result affordances, so controlled mode never shows an Edit control or a sticky picker.\n\t */\n\t@state()\n\tprivate selfFetched = false;\n\n\t/** True when the visitor asked to edit a self-fetch result, so the form is restored over the result. */\n\t@state()\n\tprivate editing = false;\n\n\t/** True when the last self-fetch form was a single-enum picker, so it stays visible above the result and a change refetches. */\n\t@state()\n\tprivate sticky = false;\n\n\t/** Last submitted form values (nested per group), kept in memory to restore the form on Edit and to prefill the sticky picker. */\n\tprivate lastValues?: Record<string, unknown>;\n\n\tprivate fetcher: FetchController<T>;\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Controlled mode: hydrate `data` from a direct-child roxy-data island when\n\t\t// no JS property was assigned. Keyless; the server already fetched.\n\t\tnew MarkupDataController<T>(this);\n\t\t// Re-render if a chrome-string catalogue lands after this element upgraded.\n\t\tnew LocaleController(this);\n\t\tthis.fetcher = new FetchController<T>(this);\n\t}\n\n\t/**\n\t * The chrome string for this element's language, keyed by its own English source text.\n\t *\n\t * @remarks\n\t * Pass the English copy, never a key. With no catalogue registered the source string is returned unchanged, so an English page pays nothing and a language we do not ship degrades to English rather than to a visible key.\n\t *\n\t * Chrome only. A value the API returned (a planet, a sign, an aspect, a house system) is NOT translated here: it is rendered as the response carries it, so the words on the chart and the words in the response can never disagree.\n\t *\n\t * @example\n\t * ```ts\n\t * this.t('Aspect grid'); // 'Cuadricula de aspectos' under lang=\"es\"\n\t * this.t('{{count}} planets', { count: 12 }); // '12 planetas'\n\t * ```\n\t */\n\tprotected t(source: string, vars?: Record<string, string | number>): string {\n\t\treturn translate(this.effectiveLang(), source, vars);\n\t}\n\n\t/** {@link RoxyDataElement.t} as a value, bound once, for a shared render helper that has no host of its own and therefore cannot resolve a page language (`utils/hd-reading.ts`). Named `translator` and not `translate` because `HTMLElement.translate` is a real DOM property and shadowing it with a protected member makes every `@customElement` decorator in the library fail to typecheck. */\n\tprotected readonly translator = (\n\t\tsource: string,\n\t\tvars?: Record<string, string | number>,\n\t): string => this.t(source, vars);\n\n\tprotected willUpdate(changed: PropertyValues): void {\n\t\tif (changed.has('publishableKey')) {\n\t\t\tthis.fetcher.publishableKey = this.publishableKey;\n\t\t}\n\t\tif (changed.has('baseUrl') && this.baseUrl) {\n\t\t\tthis.fetcher.baseUrl = this.baseUrl;\n\t\t}\n\t\tif (changed.has('submitUrl')) {\n\t\t\tthis.fetcher.submitUrl = this.submitUrl;\n\t\t}\n\t}\n\n\trender(): unknown {\n\t\tif (this.loading) return this.renderLoading();\n\t\tif (this.error != null) return this.renderError(this.error);\n\t\tif (this.data != null) {\n\t\t\t// Controlled mode (consumer-assigned or island-hydrated data) renders the\n\t\t\t// result alone, byte-identical to before: no picker, no Edit. The one\n\t\t\t// exception is the widgets auto-mount attrs-complete path, which assigns\n\t\t\t// data directly AND sets `attribution`; a real controlled consumer never\n\t\t\t// sets the attribute, so this stays byte-identical for them.\n\t\t\tif (!this.selfFetched) {\n\t\t\t\treturn this.showAttribution()\n\t\t\t\t\t? html`${this.renderData(this.data)}${this.renderAttribution()}`\n\t\t\t\t\t: this.renderData(this.data);\n\t\t\t}\n\t\t\tif (this.editing) return this.renderForm();\n\t\t\treturn this.renderResult(this.data);\n\t\t}\n\t\treturn this.renderNoData();\n\t}\n\n\t/** Render the populated response. The single method every component implements. */\n\tprotected abstract renderData(data: T): unknown;\n\n\t/**\n\t * The interpretation accordion, gated by {@link RoxyDataElement.hideReadings}. Every component that shows a written reading routes through here instead of calling {@link renderInterpAccordion} directly.\n\t *\n\t * @remarks\n\t * The gate lives on the base rather than in each component because the property does, and a plain render function cannot read component state. One call site per accordion, one place that decides whether prose renders, and the section it emits carries the same `readings` part in every component.\n\t *\n\t * Prose that is NOT in an accordion (a summary paragraph, a per-item interpretation) is still the component's own to gate, since only the component knows which of its blocks are readings.\n\t */\n\tprotected renderInterpretation(\n\t\tsections: InterpSection[],\n\t\tname: string,\n\t\theading?: string,\n\t): unknown {\n\t\tif (this.hideReadings) return nothing;\n\t\t// The default heading is localized HERE rather than in the accordion:\n\t\t// that is a plain render function with no host, so it cannot read a\n\t\t// language, and this is the one call site every component routes through.\n\t\treturn renderInterpAccordion(sections, name, heading ?? this.t('Reading'));\n\t}\n\n\t/**\n\t * A self-fetch result plus its re-query affordance. A single-enum form keeps its picker above the result so a new selection refetches (a sign switch is a new reading); any other form gets a compact Edit control that restores the form with the previous values.\n\t */\n\tprotected renderResult(data: T): unknown {\n\t\tconst body = this.sticky\n\t\t\t? html`${this.renderForm()}${this.renderData(data)}`\n\t\t\t: html`<div class=\"roxy-edit-bar\" part=\"edit-bar\"><button type=\"button\" class=\"roxy-edit\" @click=\"${this.onEdit}\">${this.t('Edit query')}</button></div>${this.renderData(data)}`;\n\t\treturn this.showAttribution()\n\t\t\t? html`${body}${this.renderAttribution()}`\n\t\t\t: body;\n\t}\n\n\tprivate onEdit = () => {\n\t\tthis.editing = true;\n\t};\n\n\t/** True when the attribution credit renders: the attribute is present and not explicitly disabled. */\n\tprivate showAttribution(): boolean {\n\t\treturn (\n\t\t\tthis.attribution != null &&\n\t\t\tthis.attribution !== 'off' &&\n\t\t\tthis.attribution !== 'false'\n\t\t);\n\t}\n\n\t/** Small muted credit under a self-fetch or auto-mount result. Reached only from the result path, so controlled mode never renders it. */\n\tprotected renderAttribution(): unknown {\n\t\treturn html`<div class=\"roxy-attribution\" part=\"attribution\"><a href=\"https://roxyapi.com/?utm_source=widget&utm_medium=embed\" target=\"_blank\" rel=\"noopener\">${this.t('Spiritual data by RoxyAPI')}</a></div>`;\n\t}\n\n\t/** The data-absent branch: the self-fetch form when an endpoint is set, otherwise the empty state. */\n\tprotected renderNoData(): unknown {\n\t\treturn this.endpoint ? this.renderForm() : this.renderEmpty();\n\t}\n\n\t/** Internal self-fetch form. Reuses the introspecting `<roxy-endpoint-form>`; the consumer never places it. */\n\tprotected renderForm(): unknown {\n\t\treturn html`<roxy-endpoint-form part=\"form\" data-endpoint=\"${this.endpoint}\" method=\"${this.method}\" spec-url=\"${ifDefined(this.specUrl)}\" publishable-key=\"${ifDefined(this.publishableKey)}\" submit-label=\"${ifDefined(this.submitLabel)}\" lang=\"${ifDefined(this.effectiveLang())}\" .initialValues=\"${this.formInitialValues()}\" @roxy-submit=\"${this.onFormSubmit}\"></roxy-endpoint-form>`;\n\t}\n\n\t/** Prefill source for the form: the last submission (Edit / sticky refetch) wins over remembered storage. */\n\tprivate formInitialValues(): Record<string, unknown> | undefined {\n\t\treturn (\n\t\t\tthis.lastValues ?? (this.remember ? this.readRemembered() : undefined)\n\t\t);\n\t}\n\n\t/**\n\t * Site-owner language for this element: the `lang` attribute, the nearest ancestor carrying one, or the document. Protected so a component that composes another can forward it (a child inside this shadow root cannot reach the host page on its own).\n\t *\n\t * Full tag, region included. The truncation to what `?lang=` accepts happens where the request is built, in `<roxy-endpoint-form>`.\n\t */\n\tprotected effectiveLang(): string | undefined {\n\t\treturn resolveLang(this);\n\t}\n\n\tprivate onFormSubmit = (e: Event) => {\n\t\tconst detail = (e as CustomEvent).detail as {\n\t\t\tvalues: Record<string, unknown>;\n\t\t\tqueryKeys?: string[];\n\t\t\tsticky?: boolean;\n\t\t};\n\t\tthis.lastValues = detail.values;\n\t\tthis.sticky = !!detail.sticky;\n\t\tthis.selfFetched = true;\n\t\tthis.editing = false;\n\t\tif (this.remember) this.writeRemembered(detail.values);\n\t\tvoid this.fetcher.run(\n\t\t\tbuildRequest(\n\t\t\t\tthis.endpoint,\n\t\t\t\tthis.method,\n\t\t\t\tdetail.values,\n\t\t\t\tdetail.queryKeys ?? [],\n\t\t\t),\n\t\t);\n\t};\n\n\t/** sessionStorage key for this component's remembered form values, scoped by endpoint. */\n\tprivate rememberKey(): string {\n\t\treturn `roxy-ui:form:${this.endpoint}`;\n\t}\n\n\tprivate readRemembered(): Record<string, unknown> | undefined {\n\t\ttry {\n\t\t\tconst raw = sessionStorage.getItem(this.rememberKey());\n\t\t\treturn raw ? (JSON.parse(raw) as Record<string, unknown>) : undefined;\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate writeRemembered(values: Record<string, unknown>): void {\n\t\ttry {\n\t\t\tsessionStorage.setItem(this.rememberKey(), JSON.stringify(values));\n\t\t} catch {\n\t\t\t// Private mode / disabled storage: remembering is best-effort, never fatal.\n\t\t}\n\t}\n\n\t/** Terminal empty state. Subclasses override for a domain-specific message. */\n\tprotected renderEmpty(): unknown {\n\t\treturn html`<div class=\"roxy-empty\" role=\"status\">${this.t('No data')}</div>`;\n\t}\n\n\t/** Loading placeholder shown during a self-fetch. */\n\tprotected renderLoading(): unknown {\n\t\treturn html`<div class=\"roxy-skeleton\" style=\"height:8rem\" role=\"status\" aria-label=\"${this.t('Loading')}\" part=\"loading\"></div>`;\n\t}\n\n\t/** Error state shown when a self-fetch fails. Keeps the form in view so the request can be retried. */\n\tprotected renderError(message: string): unknown {\n\t\tconst banner = html`<div class=\"roxy-error\" role=\"alert\" part=\"error\">${message}</div>`;\n\t\treturn this.endpoint ? html`${banner}${this.renderForm()}` : banner;\n\t}\n}\n", "/**\n * Where a component's language comes from, and what is safe to send to the API.\n *\n * @remarks\n * Two different answers, and conflating them is the whole reason this file is separate from the catalogue:\n *\n * - {@link resolveLang} answers \"what language is this PAGE in\", and keeps the full tag, because `es-AR` is a legitimate thing for a catalogue to want to differ on.\n * - {@link apiLang} answers \"what may go on the query string\", which is a narrower question with a hard edge: `?lang=es-AR` is a 400, `?lang=es` is a 200.\n *\n * The full tag is not a nicety the catalogue happens to tolerate: `utils/format.ts` hands it to `Intl`, which reads the region and writes `15 de ene de 1990` for `es-AR` where it writes `15 ene 1990` for `es`. Passing the API answer to a formatter demotes every regional visitor to the base language and nothing fails, so the two values are never interchangeable.\n */\n\nimport { API_LANGUAGES } from '../generated/api-languages.js';\n\n/**\n * The site-owner language for an element, resolved through the four-link chain the revamp design specifies.\n *\n * @remarks\n * 1. the element's own `lang` attribute (the explicit per-embed override),\n * 2. the nearest ancestor carrying `lang`, so one wrapper localizes a whole section,\n * 3. `document.documentElement.lang`, which is what makes this work on a real CMS with no markup change at all: WordPress emits `<html lang=\"es-AR\">` on every page of a Spanish site,\n * 4. nothing, which the callers read as English.\n *\n * Only link 1 used to be implemented, so a component on a fully Spanish page rendered English chrome and there was no way to fix it except hand-editing every embed.\n *\n * `navigator.language` is deliberately NOT in the chain. It is the VISITOR's preference, not the site's: it fragments the API cache across every locale a visitor might carry and silently serves two people different content from the same URL.\n *\n * Link 2 uses `closest`, which stops at a shadow boundary. A component composed INSIDE another component's shadow root therefore cannot see the host page, which is why every composing component forwards `lang` to its children explicitly.\n */\nexport function resolveLang(el: HTMLElement): string | undefined {\n\t// Native accessor, never a Lit @property: declaring one would shadow\n\t// HTMLElement.lang and break the platform attribute for every consumer.\n\tif (el.lang) return el.lang;\n\tif (typeof document === 'undefined') return undefined;\n\tconst inherited = el.closest?.('[lang]')?.getAttribute('lang');\n\tif (inherited) return inherited;\n\treturn document.documentElement.lang || undefined;\n}\n\n/**\n * The value safe to put on `?lang=`, or `undefined` to leave the request on the API default.\n *\n * @remarks\n * Two narrowings, both of which are load-bearing the moment {@link resolveLang} starts reading `<html lang>`:\n *\n * - **The region is dropped.** A regional tag is a 400, so a Spanish WordPress site would go from English-but-working to broken the day the language chain was completed. `es-AR`, `es-419` and `ES` all send `es`.\n * - **An unsupported language is omitted, not sent.** The chain now surfaces whatever the host page carries, including languages the API does not translate, and an unlisted tag is the same 400. Omitting it degrades to English, which is the behaviour those pages already had.\n */\nexport function apiLang(el: HTMLElement): string | undefined {\n\tconst tag = resolveLang(el);\n\tif (!tag) return undefined;\n\tconst base = tag.toLowerCase().split('-')[0] as string;\n\treturn API_LANGUAGES.includes(base) ? base : undefined;\n}\n", "/**\n * The chrome-string catalogue: one resolver reading one registry, so a translation can arrive from anywhere without a component changing.\n *\n * @remarks\n * **The key IS the canonical English string**, folded through {@link lookupKey}. There is no invented key vocabulary to keep in sync with the copy, which is the same rule the glyph tables in `tokens/index.ts` follow (they key off the exact value the API returns). Two consequences that are the whole point:\n *\n * - **English costs zero bytes.** A miss returns the source string, so the English build ships no catalogue at all, and a site that never loads a locale payload is byte-identical to one built before this file existed.\n * - **A missing translation degrades to English, never to a key.** The failure mode of a keyed catalogue is a raw `natal.tabs.wheel` rendered at a customer; here the worst case is the English word.\n *\n * **The registry lives on `globalThis`, not in module scope, because it has to.** Every `dist/cdn/components/*.js` is a self-contained IIFE with its own copy of this module, so a `Map` here would be invisible to the second component on the page. One global object, written by the locale payload and read by every bundle, is what makes `dist/cdn/locales/es.js` a single download that translates all of them.\n *\n * Load order is not guaranteed on a real host (WordPress enqueues scripts in an order the plugin does not fully control, and a payload may be deferred), so {@link onLocaleChange} lets an element that has already rendered in English re-render when its catalogue lands.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Shared mutable state, addressed by a name rather than a module binding so every bundle on the page reaches the same object. */\ninterface LocaleRegistry {\n\t/** Language tag (lower case) to catalogue, keyed by {@link lookupKey} of the English source string. */\n\tcatalogs: Record<string, Record<string, string>>;\n\t/** Elements waiting to re-render when a catalogue arrives. */\n\tlisteners: Set<() => void>;\n}\n\nconst GLOBAL_KEY = '__ROXY_UI_I18N__';\n\nfunction registry(): LocaleRegistry {\n\tconst holder = globalThis as unknown as Record<string, LocaleRegistry>;\n\tconst existing = holder[GLOBAL_KEY];\n\tif (existing) return existing;\n\tconst created: LocaleRegistry = { catalogs: {}, listeners: new Set() };\n\tholder[GLOBAL_KEY] = created;\n\treturn created;\n}\n\n/**\n * Publish a catalogue for a language tag and wake every mounted element.\n *\n * @remarks\n * The catalogue is authored keyed by the English source string, exactly as it appears at the call site, and normalized here. That keeps the source file readable and diffable against the component that renders it, while the runtime lookup stays a single property read.\n *\n * This is the ONLY way into the registry, so a catalogue can later come from a static file, a server response, or a host page inlining a script tag, without a component knowing the difference.\n */\nexport function registerLocale(\n\tlang: string,\n\tcatalog: Record<string, string>,\n): void {\n\tconst reg = registry();\n\tconst normalized: Record<string, string> = {};\n\tfor (const [source, translated] of Object.entries(catalog)) {\n\t\tnormalized[lookupKey(source)] = translated;\n\t}\n\treg.catalogs[lang.toLowerCase()] = normalized;\n\tfor (const listener of reg.listeners) listener();\n}\n\n/**\n * Replace `{{name}}` placeholders. Copied from the API-side translator so both sides of the product interpolate identically; an unknown placeholder is left verbatim rather than blanked, so a typo in a catalogue is visible instead of silently eating the value.\n */\nexport function interpolate(\n\ttemplate: string,\n\tvars?: Record<string, string | number>,\n): string {\n\tif (!vars) return template;\n\treturn template.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key: string) =>\n\t\tkey in vars ? String(vars[key] ?? '') : match,\n\t);\n}\n\n/**\n * The chrome string for `lang`, falling back to the English `source` it is keyed by.\n *\n * @remarks\n * A regional tag resolves against its base language, so `es-AR` and `es-419` both read the `es` catalogue and a site does not have to know which tags we happen to ship. An exact regional catalogue still wins if one is ever registered.\n */\nexport function translate(\n\tlang: string | undefined,\n\tsource: string,\n\tvars?: Record<string, string | number>,\n): string {\n\tif (!lang) return interpolate(source, vars);\n\tconst { catalogs } = registry();\n\tconst tag = lang.toLowerCase();\n\tconst catalog = catalogs[tag] ?? catalogs[tag.split('-')[0] as string];\n\treturn interpolate(catalog?.[lookupKey(source)] ?? source, vars);\n}\n\n/** Subscribe to catalogue arrivals. Returns the unsubscribe, so an element can drop it on disconnect. */\nexport function onLocaleChange(listener: () => void): () => void {\n\tconst { listeners } = registry();\n\tlisteners.add(listener);\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t};\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport { onLocaleChange } from './registry.js';\n\n/**\n * Re-renders its host when a chrome-string catalogue arrives.\n *\n * @remarks\n * Without this the catalogue would have to be on the page BEFORE the elements upgrade, which is not something a component can require of a real host. WordPress orders enqueued scripts by dependency and a site owner can add `defer` to any of them; a CDN embed is two independent `<script src>` tags. Any of those can land the locale payload after the first paint, and the visible result would be a chart that renders in English on a Spanish page for no reason the site owner can see or fix.\n *\n * Mirrors `MarkupDataController`: constructed in {@link RoxyDataElement}'s constructor, subscribes on connect, drops the subscription on disconnect. Registration is idempotent and a re-register of the same language simply re-renders, so a payload loaded twice is harmless.\n */\nexport class LocaleController implements ReactiveController {\n\tprivate readonly host: ReactiveControllerHost;\n\tprivate unsubscribe?: () => void;\n\n\tconstructor(host: ReactiveControllerHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected(): void {\n\t\tthis.unsubscribe = onLocaleChange(() => this.host.requestUpdate());\n\t}\n\n\thostDisconnected(): void {\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribe = undefined;\n\t}\n}\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif))}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "/**\n * The one place the \"publishable key only\" rule lives. Every client-side fetch boundary ({@link ../components/location-search.ts}, {@link ./fetch-controller.ts}) calls through here so a secret or legacy unprefixed key is refused identically: no network call, the same visible message, the same `roxy-validation-error` event. Centralising it is what stops the two paths drifting, which is exactly how `<roxy-location-search>` used to warn-then-fetch a secret key while the controller fail-closed.\n */\n\n/** Canonical refusal message. Both fetch boundaries surface this exact wording. */\nexport const KEY_REFUSED_MESSAGE =\n\t'Client-side components accept a pk_ publishable key only. Use a publishable key with an origin allowlist, or render server-side.';\n\n/** True when the key is a browser-safe `pk_` publishable key. */\nexport function isPublishableKey(key: string | undefined | null): boolean {\n\treturn !!key && key.startsWith('pk_');\n}\n\n/**\n * The fail-closed condition: a key is PRESENT and is NOT a `pk_` key. An absent key is not refused, so a keyless public call (a form-slotted city search with no key set) still proceeds; only a real secret/legacy token in the browser is stopped.\n */\nexport function keyIsRefused(key: string | undefined | null): boolean {\n\treturn !!key && !key.startsWith('pk_');\n}\n\n/**\n * Announce a refused key: dispatch the shared `roxy-validation-error` (bubbling, composed) and, when `warn` is set, log it once for the developer. The caller sets its own visible error state and skips the fetch; this only handles the parts both boundaries share.\n */\nexport function dispatchKeyRefusal(\n\thost: EventTarget,\n\topts: { warn?: boolean } = {},\n): void {\n\tif (opts.warn) console.warn(KEY_REFUSED_MESSAGE);\n\thost.dispatchEvent(\n\t\tnew CustomEvent('roxy-validation-error', {\n\t\t\tdetail: { reason: 'possible-secret-key', message: KEY_REFUSED_MESSAGE },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t}),\n\t);\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport {\n\tdispatchKeyRefusal,\n\tKEY_REFUSED_MESSAGE,\n\tkeyIsRefused,\n} from './key-guard.js';\n\n/**\n * Host slots the controller drives. {@link RoxyDataElement} satisfies this, so the form mixin can attach a controller without the component wiring state by hand.\n *\n * @remarks\n * Intersected with `HTMLElement` because the controller dispatches events on the host. Lit's `ReactiveControllerHost` is the update-lifecycle contract only (`addController`, `requestUpdate`, `updateComplete`) and carries no DOM surface, even though every real host is a `LitElement` and therefore an `HTMLElement`. Declaring the DOM half is what the controller actually needs; it used to reach it through a `this.host as unknown as EventTarget` double cast instead, which asserted a capability the type never promised.\n */\ntype FetchHost<T> = ReactiveControllerHost &\n\tHTMLElement & {\n\t\tdata: T | null;\n\t\tloading: boolean;\n\t\terror: string | null;\n\t};\n\n/** Default RoxyAPI v2 origin. A component overrides it per instance via its `base-url` attribute. */\nconst DEFAULT_BASE_URL = 'https://roxyapi.com/api/v2';\n\n/** A single request the controller issues on the component's behalf. */\nexport interface RoxyRequest {\n\t/** Path under the API base, e.g. \"/dreams/symbols/water\" or \"/astrology/natal-chart\". */\n\tpath: string;\n\tmethod?: 'GET' | 'POST';\n\t/** JSON body for POST endpoints. */\n\tbody?: unknown;\n\t/** Query string parameters; nullish values are dropped. */\n\tquery?: Record<string, string | number | undefined>;\n}\n\n/**\n * Client-side fetch for uncontrolled (self-fetching) components: drives `host.data` / `host.loading` / `host.error` and cancels a stale request when a newer one starts or the host disconnects.\n *\n * @remarks\n * Security boundary. The only credential this ever sends is a `pk_` publishable key, which carries a server-side origin allowlist. A secret (`sk_`) or legacy unprefixed key is refused before any network call and surfaced as an error, so a server secret cannot leak into a browser request. This centralizes the guard that originated in `<roxy-location-search>` so every self-fetching component enforces it identically.\n *\n * Controlled-mode components never construct this. When a server injects the response as a `<script class=\"roxy-data\">` island, there is no key and no fetch, which is the path server-rendered consumers (WordPress, JSX SSR, static HTML) rely on.\n */\nexport class FetchController<T = unknown> implements ReactiveController {\n\tprivate readonly host: FetchHost<T>;\n\tprivate abort?: AbortController;\n\n\t/** Browser-safe publishable key. Set by the host from its `publishable-key` attribute. */\n\tpublishableKey?: string;\n\t/** API origin, overridable for self-hosted or proxied deployments. */\n\tbaseUrl = DEFAULT_BASE_URL;\n\t/**\n\t * Consumer backend route that holds the secret key. When set, the request is POSTed here as `{ path, method, body, query }` instead of called against RoxyAPI directly, so no key (publishable or secret) is sent from the browser. This is the canonical path for server-rendered hosts (WordPress); the backend proxies the request with its own `sk_` key and returns the JSON response.\n\t */\n\tsubmitUrl?: string;\n\n\tconstructor(host: FetchHost<T>) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostDisconnected() {\n\t\tthis.abort?.abort();\n\t\tthis.abort = undefined;\n\t}\n\n\t/**\n\t * Issue the request and resolve once `host.data` (success) or `host.error`\n\t * (failure) is set. A no-op return when a non-publishable key is present:\n\t * the error is already surfaced and nothing is sent.\n\t */\n\tasync run(req: RoxyRequest): Promise<void> {\n\t\t// submit-url proxy: no key leaves the browser; the consumer's backend holds it.\n\t\tif (!this.submitUrl && this.secretKeyRefused()) return;\n\t\tthis.abort?.abort();\n\t\tconst controller = new AbortController();\n\t\tthis.abort = controller;\n\t\tthis.host.loading = true;\n\t\tthis.host.error = null;\n\t\ttry {\n\t\t\tconst res = this.submitUrl\n\t\t\t\t? await fetch(this.submitUrl, {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\tAccept: 'application/json',\n\t\t\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: JSON.stringify(req),\n\t\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t\t})\n\t\t\t\t: await this.callApi(req, controller.signal);\n\t\t\tif (!res.ok) throw new Error(await this.readError(res));\n\t\t\tconst json = (await res.json()) as T;\n\t\t\tif (controller.signal.aborted) return;\n\t\t\tthis.host.data = json;\n\t\t} catch (err) {\n\t\t\tif ((err as { name?: string })?.name === 'AbortError') return;\n\t\t\tthis.host.error = err instanceof Error ? err.message : String(err);\n\t\t} finally {\n\t\t\tif (this.abort === controller) this.abort = undefined;\n\t\t\tif (!controller.signal.aborted) this.host.loading = false;\n\t\t}\n\t}\n\n\t/** Direct call against RoxyAPI with the publishable key (the no-backend path). */\n\tprivate callApi(req: RoxyRequest, signal: AbortSignal): Promise<Response> {\n\t\tconst url = new URL(`${this.baseUrl}${req.path}`);\n\t\tfor (const [k, v] of Object.entries(req.query ?? {})) {\n\t\t\tif (v != null) url.searchParams.set(k, String(v));\n\t\t}\n\t\tconst headers: Record<string, string> = { Accept: 'application/json' };\n\t\tif (this.publishableKey) headers['X-API-Key'] = this.publishableKey;\n\t\tif (req.body != null) headers['Content-Type'] = 'application/json';\n\t\treturn fetch(url, {\n\t\t\tmethod: req.method ?? 'GET',\n\t\t\theaders,\n\t\t\tbody: req.body != null ? JSON.stringify(req.body) : undefined,\n\t\t\tsignal,\n\t\t});\n\t}\n\n\t/** True when a key is set and it is not a browser-safe `pk_` publishable key. Surfaces the error and refuses to send, via the shared {@link keyIsRefused} guard so every fetch boundary fail-closes identically. */\n\tprivate secretKeyRefused(): boolean {\n\t\tif (!keyIsRefused(this.publishableKey)) return false;\n\t\tthis.host.error = KEY_REFUSED_MESSAGE;\n\t\tdispatchKeyRefusal(this.host);\n\t\treturn true;\n\t}\n\n\t/** Surface the `{ error, code }` message the API returns on failure, falling back to the status code. */\n\tprivate async readError(res: Response): Promise<string> {\n\t\ttry {\n\t\t\tconst body = (await res.json()) as { error?: string };\n\t\t\tif (body?.error) return body.error;\n\t\t} catch {\n\t\t\t// Non-JSON error body: fall through to the status line.\n\t\t}\n\t\treturn `Request failed (${res.status})`;\n\t}\n}\n\n/**\n * Translate flat form values into a {@link RoxyRequest} for an endpoint. The `{name}` segments in the endpoint template are substituted from the values and removed; the rest become the JSON body for POST or query parameters for GET. This is the spec-light request builder the base element uses to turn a `<roxy-endpoint-form>` submission into a self-fetch, so a component needs no per-endpoint glue.\n *\n * @param queryKeys - Names the spec declares as `in: query` for this operation, which `<roxy-endpoint-form>` reports on its `roxy-submit` event. A POST operation can still take query parameters (every localized endpoint takes `?lang=`), and sending one in the JSON body silently drops it, so those names are routed to the query string on POST as well as GET.\n */\nexport function buildRequest(\n\tendpoint: string,\n\tmethod: 'GET' | 'POST',\n\tvalues: Record<string, unknown>,\n\tqueryKeys: readonly string[] = [],\n): RoxyRequest {\n\tconst rest: Record<string, unknown> = { ...values };\n\tconst path = `/${endpoint.replace(/^\\//, '')}`.replace(\n\t\t/\\{([^}]+)\\}/g,\n\t\t(_match, name: string) => {\n\t\t\tconst v = rest[name];\n\t\t\tdelete rest[name];\n\t\t\treturn encodeURIComponent(String(v ?? ''));\n\t\t},\n\t);\n\tconst inQuery = new Set(queryKeys);\n\tconst query: Record<string, string | number | undefined> = {};\n\tconst body: Record<string, unknown> = {};\n\tfor (const [k, v] of Object.entries(rest)) {\n\t\tif (v === undefined || v === '') continue;\n\t\tif (method === 'GET' || inQuery.has(k)) query[k] = v as string | number;\n\t\telse body[k] = v;\n\t}\n\treturn { path, method, query, body: method === 'POST' ? body : undefined };\n}\n", "/**\n * The interpretation accordion: the one way this library shows a label, a short value, and a body of prose behind a disclosure.\n *\n * @remarks\n * Exclusive by construction (`<details name>`), so a card grows by at most one open section and never becomes a wall of text. Callers pass their own group `name` so two accordions on one page do not fight over which section is open.\n *\n * This lives here rather than in a component because the same accordion is the right shape wherever an endpoint returns a labelled reading: the Human Design bodygraph and type card use it for strategy, authority, and aura; `roxy-hexagram` uses it for the changing lines. The CSS was copy-pasted into six components before 2026-07 and had already drifted (`.interp-body` had five distinct definitions), which is the drift this exists to stop. Migrate the remaining copies to it when they are next touched.\n *\n * **Call it through `RoxyDataElement.renderInterpretation`, never directly.** That method is where `hide-readings` is honoured, so a direct call renders prose a host asked to be left out. The section it emits carries `part=\"section readings\"` and each row `part=\"reading\"`, which is what makes the readings of EVERY component addressable under one name from outside the shadow root.\n */\n\nimport { css, html, nothing } from 'lit';\nimport { chevron } from './disclosure.js';\n\n/** One row: the label, the short value shown as the aside, and the interpretation body. `extra` renders under the body for a section that carries more than prose. */\nexport interface InterpSection {\n\tlabel: string;\n\taside?: string;\n\tbody: string;\n\textra?: unknown;\n}\n\nexport const interpAccordionStyles = css`.block{border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem)}.block h3{margin:0 0 var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.06em}.interp-card{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);margin-bottom:var(--roxy-space-xs,.25rem)}.interp-card summary{cursor:pointer;color:var(--roxy-fg,#0a0a0a);align-items:center;gap:var(--roxy-space-sm,.5rem);font-weight:500;font-size:var(--roxy-text-sm,.875rem);display:flex}.interp-card summary:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-radius:var(--roxy-radius-sm,4px)}.interp-lead{flex-wrap:wrap;flex:auto;order:1;align-items:baseline;gap:.4rem;min-width:0;display:inline-flex}.interp-aside{flex-shrink:0;order:2;align-items:center;gap:.5rem;display:inline-flex}.roxy-chevron{order:3}.interp-aside small{color:var(--roxy-muted,#71717a);white-space:nowrap;font-weight:400}@container (width<=26rem){.interp-card summary{flex-wrap:wrap}.roxy-chevron{order:2}.interp-aside{flex-basis:100%;order:3;justify-content:flex-end}}.interp-body{margin-top:var(--roxy-space-sm,.5rem);gap:var(--roxy-space-sm,.5rem);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);overflow-wrap:anywhere;line-height:1.6;display:grid}.interp-body p{margin:0}`;\n\n/**\n * Render the accordion. Sections with no body are dropped, so a caller can pass the full set and let a narrower response render only what it carries. `name` groups the `<details>` exclusively, so opening one closes the last.\n */\nexport function renderInterpAccordion(\n\tsections: InterpSection[],\n\tname: string,\n\theading = 'Reading',\n) {\n\tconst shown = sections.filter((s) => Boolean(s.body));\n\tif (shown.length === 0) return nothing;\n\n\treturn html`<section class=\"block\" part=\"section readings\"><h3>${heading}</h3>${shown.map(\n\t\t\t(\n\t\t\t\ts,\n\t\t\t\ti,\n\t\t\t) => html`<details class=\"interp-card\" part=\"reading\" name=\"${name}\" ?open=\"${i === 0}\"><summary><span class=\"interp-lead\">${s.label}</span> ${chevron()} ${s.aside ? html`<span class=\"interp-aside\"><small>${s.aside}</small></span>` : nothing}</summary><div class=\"interp-body\"><p>${s.body}</p>${s.extra ?? nothing}</div></details>`,\n\t\t)}</section>`;\n}\n", "import type { TemplateResult } from 'lit';\nimport { css, html } from 'lit';\n\n/**\n * Disclosure chevron for `<details>`/`<summary>` accordions. Replaces the\n * browser default triangle with a thin chevron that rotates when the host\n * `<details>` opens. Render it inside the `<summary>` and pair with\n * {@link disclosureStyles}.\n */\nexport function chevron(): TemplateResult {\n\treturn html`<svg class=\"roxy-chevron\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\"><path d=\"M4 6l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n}\n\n/**\n * Shared `<details>` accordion styling: hides the native disclosure triangle\n * and rotates the {@link chevron} 180 degrees when the accordion is open.\n * Import into any component that renders disclosure accordions so the chevron\n * looks and behaves identically.\n */\nexport const disclosureStyles = css`summary{list-style:none}summary::-webkit-details-marker{display:none}.roxy-chevron{aspect-ratio:auto;width:14px;height:14px;color:var(--roxy-muted,#71717a);transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0}details[open]>summary .roxy-chevron{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){.roxy-chevron{transition:none}}`;\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * Serialize a RoxyAPI response for embedding inside an inline `<script type=\"application/json\" class=\"roxy-data\">`. This is the safe writer counterpart to {@link MarkupDataController}, the reader: server-rendered and cached consumers (WordPress, JSX SSR, static HTML) emit the script with this, and the component hydrates `data` from it on connect.\n *\n * @remarks\n * Use this instead of a bare `JSON.stringify`. A raw stringify of a response that contains the literal text `</script>` (common in long interpretation prose) closes the script element early, corrupting the page and creating an HTML-injection vector. This escapes the script-unsafe characters to their `\\uXXXX` JSON escapes, which `JSON.parse` restores to the original characters, so the value the component receives is identical to the response you passed.\n *\n * `<` is the load-bearing escape (it defeats `</script>` and `<!--`). `>` and `&` are escaped for defence in depth, and U+2028 / U+2029 because they are valid in JSON yet are line terminators in a `<script>` context and break some parsers. The escapes introduce only `\\uXXXX` sequences, so the replacements never feed each other and order is irrelevant.\n *\n * Pass the unwrapped RoxyAPI response, the same shape you would assign to `element.data`. Do not pass the SDK envelope (`{ data, error, request, response }`).\n *\n * @example\n * ```ts\n * import { serializeRoxyData } from '@roxyapi/ui';\n *\n * const { data } = await roxy.dreams.getDreamSymbol({ path: { id: 'water' } });\n * const html = `<roxy-dream-card><script type=\"application/json\" class=\"roxy-data\">${serializeRoxyData(data)}</script></roxy-dream-card>`;\n * ```\n */\nexport function serializeRoxyData(data: unknown): string {\n\treturn JSON.stringify(data)\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n\n/**\n * Build the complete `<script type=\"application/json\" class=\"roxy-data\">\u2026</script>` element a server nests inside a `roxy-*` component for the no-JavaScript hydration path. The payload is escaped via {@link serializeRoxyData}, so it is safe to drop straight into HTML output.\n *\n * @remarks\n * The element carries both `type=\"application/json\"` and `class=\"roxy-data\"` because {@link MarkupDataController} reads only a direct-child script that has both. Emit one of these inside the target component; the JavaScript `data` property still wins if it is later assigned.\n *\n * @example\n * ```ts\n * import { roxyDataScript } from '@roxyapi/ui';\n *\n * const { data } = await roxy.crystals.getCrystal({ path: { id: 'amethyst' } });\n * const html = `<roxy-crystal-grid>${roxyDataScript(data)}</roxy-crystal-grid>`;\n * ```\n */\nexport function roxyDataScript(data: unknown): string {\n\treturn `<script type=\"application/json\" class=\"${ROXY_DATA_CLASS}\">${serializeRoxyData(data)}</script>`;\n}\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n", "/**\n * Math helpers for converting raw ecliptic longitude decimals into the\n * sign / degree / minute / second triplet used across chart components.\n */\n\nimport { SIGNS_ORDER } from '../tokens/index.js';\n\nexport interface SignPosition {\n\tsign: string;\n\tsignIndex: number;\n\tdegree: number;\n\tminute: number;\n\tsecond: number;\n}\n\n/**\n * Wrap longitude into [0, 360) so negative or out-of-range values still\n * resolve to a real sign. Robust to wonky upstream data.\n */\nexport function normalizeLongitude(lon: number): number {\n\tconst wrapped = lon % 360;\n\treturn wrapped < 0 ? wrapped + 360 : wrapped;\n}\n\n/**\n * Convert decimal ecliptic longitude (0-360) into sign/degree/minute/second.\n * Used by every chart wheel and aspect table.\n */\nexport function longitudeToSignPosition(longitude: number): SignPosition {\n\tconst lon = normalizeLongitude(longitude);\n\tconst signIndex = Math.floor(lon / 30) % 12;\n\tconst within = lon % 30;\n\tconst degree = Math.floor(within);\n\tconst minuteFloat = (within - degree) * 60;\n\tconst minute = Math.floor(minuteFloat);\n\tconst second = Math.round((minuteFloat - minute) * 60);\n\treturn {\n\t\tsign: SIGNS_ORDER[signIndex] ?? 'Aries',\n\t\tsignIndex,\n\t\tdegree,\n\t\tminute,\n\t\tsecond,\n\t};\n}\n\n/** Compact display string like \"12\u00B0 Leo 34'\". Used in chart labels. */\nexport function formatSignPosition(longitude: number): string {\n\tconst { sign, degree, minute } = longitudeToSignPosition(longitude);\n\treturn `${degree}\u00B0 ${sign} ${String(minute).padStart(2, '0')}'`;\n}\n\n/** Format a within-sign decimal degree (0-30) as degree-and-minute, e.g. 17.99 to \"17\u00B059'\". The reference-grade form astrologers read when the sign is already known (asteroids, lots, directed points, fixed stars). */\nexport function formatDegreeInSign(deg: number): string {\n\tlet d = Math.floor(deg);\n\tlet m = Math.round((deg - d) * 60);\n\tif (m === 60) {\n\t\tm = 0;\n\t\td += 1;\n\t}\n\treturn `${d}\u00B0${String(m).padStart(2, '0')}'`;\n}\n\n/**\n * The point diametrically opposite a longitude (e.g. Descendant from\n * Ascendant, IC from MC). Exact derivation, always 180 degrees away.\n */\nexport function oppositePoint(longitude: number): number {\n\treturn normalizeLongitude(longitude + 180);\n}\n\n/**\n * Midpoint of the forward arc from `start` to `end` (both ecliptic\n * longitudes). Handles the 360/0 wrap, so a house spanning 350 to 20 degrees\n * yields a midpoint of 5, not 185. Used to place house numbers between two\n * cusps regardless of how unequal the house is.\n */\nexport function arcMidpoint(start: number, end: number): number {\n\tconst s = normalizeLongitude(start);\n\tlet span = normalizeLongitude(end) - s;\n\tif (span < 0) span += 360;\n\treturn normalizeLongitude(s + span / 2);\n}\n\n/** A body placed on a wheel: where it really is, and where its glyph had to be drawn to stay legible. */\nexport interface FannedPoint<T> {\n\titem: T;\n\t/** The true ecliptic longitude. Where a leader line points, and the only value a reader should take as the position. */\n\tlongitude: number;\n\t/** Where the glyph is drawn, pushed forward only as far as it takes to clear its neighbour. Equal to {@link FannedPoint.longitude} whenever nothing was in the way. */\n\tdisplayLongitude: number;\n}\n\n/**\n * Spread a cluster of bodies apart along a wheel so every glyph stays readable,\n * without moving any of them off its real position in the data.\n *\n * @remarks\n * Conjunctions inside a few degrees are the norm, not the exception: a\n * Sun-Mercury-Venus cluster or a stack of outer planets will pile four glyphs on\n * top of each other and print their degree labels over one another. Sorting by\n * longitude and pushing each later member forward until it clears\n * `minSeparation` is the conventional fix in professional chart software, and it\n * is why {@link FannedPoint} carries BOTH longitudes: the caller draws the glyph\n * at the display value and a leader line back to the true one, so nothing about\n * the drawing claims a position the response did not give.\n *\n * `minSeparation` is an ANGLE, so it depends on the radius the caller is drawing\n * at: the same glyph needs more degrees of arc on a small ring than a large one.\n *\n * If a cluster runs past 360 degrees the whole set slides back by the overshoot,\n * which keeps the stack anchored near its real longitudes instead of wrapping\n * one member around to the far side of the wheel.\n */\nexport function fanOut<T>(\n\titems: readonly T[],\n\tlongitudeOf: (item: T) => number,\n\tminSeparation: number,\n): FannedPoint<T>[] {\n\tconst placed: FannedPoint<T>[] = items\n\t\t.filter((item) => Number.isFinite(longitudeOf(item)))\n\t\t.map((item) => {\n\t\t\tconst longitude = normalizeLongitude(longitudeOf(item));\n\t\t\treturn { item, longitude, displayLongitude: longitude };\n\t\t})\n\t\t.sort((a, b) => a.longitude - b.longitude);\n\n\tfor (let i = 1; i < placed.length; i++) {\n\t\tconst prev = placed[i - 1];\n\t\tconst cur = placed[i];\n\t\tif (!prev || !cur) continue;\n\t\tconst wanted = prev.displayLongitude + minSeparation;\n\t\tif (cur.displayLongitude < wanted) cur.displayLongitude = wanted;\n\t}\n\n\tconst last = placed[placed.length - 1];\n\tif (last && last.displayLongitude > 360) {\n\t\tconst shift = last.displayLongitude - 360;\n\t\tfor (const p of placed) p.displayLongitude -= shift;\n\t}\n\treturn placed;\n}\n\n/**\n * Degrees of arc a mark of `width` user units occupies at `radius`, which is the\n * separation {@link fanOut} needs to keep two of them from touching. One\n * expression instead of a magic number per ring, so an inner ring automatically\n * asks for more degrees than an outer one.\n */\nexport function arcSeparation(width: number, radius: number): number {\n\treturn radius > 0 ? (width / radius) * (180 / Math.PI) : 0;\n}\n\n/** Polar to cartesian for SVG wheel positioning. Angle in degrees, 0 at 3 o'clock. */\nexport function polarToCartesian(\n\tcx: number,\n\tcy: number,\n\tradius: number,\n\tangleDeg: number,\n): { x: number; y: number } {\n\tconst angleRad = (angleDeg * Math.PI) / 180;\n\treturn {\n\t\tx: cx + radius * Math.cos(angleRad),\n\t\ty: cy + radius * Math.sin(angleRad),\n\t};\n}\n", "/**\n * Display formatters for ISO timestamps and floats coming back from the API.\n * Every helper returns \"\" for nullish or unparseable input so it falls out of\n * template literals cleanly.\n *\n * @remarks\n * **This file is the ONLY place in the library that may call `Intl` or a `toLocale*` method, and every helper that does takes the locale as its first argument, required.** Both halves are enforced by a source scan in `tests/i18n.test.ts`.\n *\n * The locale is the DISPLAY locale, the full tag `resolveLang` returns, region included. It is NOT the value that goes on `?lang=`: that one is truncated to a supported two-letter code because the API rejects anything else, and handing THAT to Intl would render every Argentine visitor's dates in Castilian conventions. `es-AR` is exactly the tag Intl wants.\n *\n * It is required rather than optional because the defect it replaces was an omission: `toLocaleDateString(undefined, ...)` means \"the locale of whoever is looking\", so a Spanish page rendered `Carta natal` above `Jan 15, 1990, 2:30 PM`, and two visitors to the same page saw two different strings. An optional parameter defaults straight back to that. A missing argument is now a typecheck failure at every call site.\n */\n\nimport { capitalize, humanize } from './string.js';\n\nconst DATE_ONLY = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst BARE_TIME = /^\\d{2}:\\d{2}(:\\d{2})?$/;\n/** An ISO datetime with NO timezone designator: a wall clock, not an instant. */\nconst NAIVE_DATETIME = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?$/;\n\n/** Canonical form per tag seen, so a page carrying an unparseable `lang` does not throw once per rendered date. */\nconst CANONICAL: Map<string, string> = new Map();\n\n/**\n * The locale list to hand Intl: the page's tag first, English behind it.\n *\n * @remarks\n * Two failure modes, both reachable from a `lang` attribute a site owner typed by hand and neither of which may reach a visitor:\n *\n * - **A structurally invalid tag throws.** `lang=\"english\"` or `lang=\"en_US\"` makes every `toLocale*` call raise a RangeError, which inside a render is a blank component rather than a wrong date. Canonicalizing behind a try/catch degrades it to English instead.\n * - **A valid-but-unknown tag falls back to the RUNTIME default**, which is the viewer's browser again, so the bug reappears for exactly the pages least likely to notice. Naming `en` as the second entry makes the fallback the page's, not the visitor's.\n *\n * No language signal at all resolves to English for the same reason the chrome catalogue does: a page that never declares a language is English as far as this library is concerned, and English chrome over German dates is the inconsistency this whole file exists to remove. `navigator.language` is deliberately absent from the chain here as it is in `resolveLang`: it is the VISITOR's preference, not the site's.\n */\nfunction intlLocales(locale: string | undefined): string[] {\n\tif (!locale) return ['en'];\n\tconst cached = CANONICAL.get(locale);\n\tif (cached) return [cached, 'en'];\n\tlet canonical = 'en';\n\ttry {\n\t\tcanonical = Intl.getCanonicalLocales(locale)[0] ?? 'en';\n\t} catch {\n\t\tcanonical = 'en';\n\t}\n\tCANONICAL.set(locale, canonical);\n\treturn [canonical, 'en'];\n}\n\n/**\n * Resolve an API timestamp to a Date plus the timezone it must be RENDERED in.\n *\n * @remarks\n * The API returns chart times naive (`2026-07-13T04:36:00`): that is 04:36 in the CHART's timezone, not UTC and not the viewer's. A wall clock must read the same for every viewer on earth, so hora at sunrise says 04:36 in Tokyo and in Chicago alike.\n *\n * Handing a naive string to `new Date()` makes the runtime interpret it in the VIEWER's zone, which is a silent corruption whenever that wall clock lands in the viewer's DST gap. In America/New_York `2026-03-08T02:30:00` does not exist, so the clock jumps and it renders as `3:30 AM`. Pinning the wall clock to UTC, which has no DST and therefore no gap, preserves the digits exactly while Intl still writes them in the PAGE locale conventions.\n *\n * An offset-bearing timestamp (`...Z`, `...+05:30`) IS a real instant, so it keeps the normal behaviour and converts to the viewer's local time.\n *\n * Deliberately NOT exported. It used to be, so a component needing a shape these helpers did not offer could pin its own wall clock and call Intl itself, which is how `dasha-timeline` came to hardcode `toLocaleString('en', ...)` and pin every boundary date to English. A shape that is missing is added here, beside the locale handling, not reimplemented in a component.\n */\nfunction resolveDisplayDate(input: string): {\n\td: Date;\n\ttimeZone?: string;\n} {\n\tconst naive = BARE_TIME.test(input)\n\t\t? `1970-01-01T${input}`\n\t\t: NAIVE_DATETIME.test(input)\n\t\t\t? input\n\t\t\t: null;\n\treturn naive\n\t\t? { d: new Date(`${naive}Z`), timeZone: 'UTC' }\n\t\t: { d: new Date(input) };\n}\n\n/**\n * The clock, in the page locale: `2:30 PM` in English, `14:30` in German.\n *\n * @remarks\n * The hour cycle is the locale's, never ours. It used to be pinned `hour12: true`, which put an AM/PM clock on every page in Europe and Latin America while the embedded form beside it labelled its own input \"formato de 24 horas\". CLDR already knows which convention each locale reads, including the ones that surprise you (`es` is 24-hour, `es-AR` is 12-hour with `p. m.`), so asserting a cycle here is asserting we know better than the locale data.\n */\nexport function formatTime(locale: string | undefined, input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (DATE_ONLY.test(input)) return '';\n\tconst { d, timeZone } = resolveDisplayDate(input);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleTimeString(intlLocales(locale), {\n\t\thour: 'numeric',\n\t\tminute: '2-digit',\n\t\ttimeZone,\n\t});\n}\n\nexport function formatDate(locale: string | undefined, input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tconst { d, timeZone } = resolveDisplayDate(\n\t\tDATE_ONLY.test(input) ? `${input}T00:00:00` : input,\n\t);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleDateString(intlLocales(locale), {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t\tyear: 'numeric',\n\t\ttimeZone,\n\t});\n}\n\nexport function formatTimeRange(\n\tlocale: string | undefined,\n\tt: { start?: string; end?: string } | undefined,\n): string {\n\tif (!t) return '';\n\tconst start = formatTime(locale, t.start);\n\tconst end = formatTime(locale, t.end);\n\tif (start && end) return `${start} - ${end}`;\n\treturn start || end || '';\n}\n\n/** Two dates as one label: `Jan 1, 2026 - Jan 7, 2026`. Falls back to whichever end parses when the other is absent. */\nexport function formatDateRange(\n\tlocale: string | undefined,\n\tstart: unknown,\n\tend: unknown,\n): string {\n\tconst a = formatDate(locale, start);\n\tconst b = formatDate(locale, end);\n\tif (a && b) return `${a} - ${b}`;\n\treturn a || b;\n}\n\n/** How much of a timestamp a label shows. `time` is the whole date plus the clock. */\nexport type DateGrain = 'year' | 'month' | 'day' | 'time';\n\n/**\n * A timestamp at a chosen granularity, for an axis or a bar end where the full date would not fit.\n *\n * @remarks\n * Every grain below `year` carries the year, because a period routinely straddles new year and a label reading `28 Dec - 3 Jan` says nothing about which side moved. `year` is sliced off the string rather than formatted, since a bare four-digit year is the same in every locale this library ships and running it through Intl would introduce era and numbering-system differences into an axis tick.\n */\nexport function formatDateGrain(\n\tlocale: string | undefined,\n\tinput: unknown,\n\tgrain: DateGrain,\n): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (grain === 'year') {\n\t\tconst m = input.match(/^(\\d{4})/);\n\t\treturn m?.[1] ?? input;\n\t}\n\tconst { d, timeZone } = resolveDisplayDate(input);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleString(intlLocales(locale), {\n\t\tday: grain === 'month' ? undefined : 'numeric',\n\t\tmonth: 'short',\n\t\tyear: 'numeric',\n\t\thour: grain === 'time' ? 'numeric' : undefined,\n\t\tminute: grain === 'time' ? '2-digit' : undefined,\n\t\ttimeZone,\n\t});\n}\n\n/**\n * Month name from a 1-based month number: `January`, `enero`, `janvier`.\n *\n * @remarks\n * Two components carried a byte-identical array of twelve English month names, which is both a duplicated table and a table of something the platform already knows in every language. Anchored to a UTC noon so no timezone can roll the date into the neighbouring month.\n */\nexport function monthName(locale: string | undefined, month: unknown): string {\n\tif (typeof month !== 'number' || !Number.isInteger(month)) return '';\n\tif (month < 1 || month > 12) return '';\n\treturn new Date(Date.UTC(2000, month - 1, 1, 12)).toLocaleDateString(\n\t\tintlLocales(locale),\n\t\t{ month: 'long', timeZone: 'UTC' },\n\t);\n}\n\n/**\n * A whole number with the page locale's digit grouping: `12,345` in English, `12.345` in Spanish.\n *\n * @remarks\n * Rounds rather than truncating, so a caller testing the magnitude (`Math.round(km) === 0`) and this label agree about which side of a boundary a value fell.\n */\nexport function formatInteger(\n\tlocale: string | undefined,\n\tvalue: unknown,\n): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\treturn value.toLocaleString(intlLocales(locale), {\n\t\tmaximumFractionDigits: 0,\n\t});\n}\n\n/**\n * Format a number, dropping trailing zeros in the FRACTIONAL part only: `2.50` becomes `2.5`, `2.0` becomes `2`, and `100` stays `100`.\n *\n * @remarks\n * Guard on the decimal point, and never strip from the integer side. A naive `.replace(/\\.?0+$/, '')` over the whole string eats zeros off the INTEGER whenever there is no decimal point, so at `dp = 0` it turns `100` into `1`, `90` into `9` and `0` into the empty string.\n *\n * @example\n * ```ts\n * formatNumber(100, 0); // '100'\n * formatNumber(2.5, 1); // '2.5'\n * formatNumber(2, 1); // '2'\n * formatNumber(0, 0); // '0'\n * ```\n */\nexport function formatNumber(value: unknown, dp = 1): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\tconst fixed = value.toFixed(dp);\n\treturn fixed.includes('.') ? fixed.replace(/\\.?0+$/, '') : fixed;\n}\n\nexport function formatPercent(value: unknown, dp = 1): string {\n\tconst n = formatNumber(value, dp);\n\treturn n ? `${n}%` : '';\n}\n\n/**\n * CSS class name per aspect type. Used by natal and synastry chart aspect\n * lines so the same color encoding (harmonious vs challenging) applies in\n * both wheels. Keys are lowercase canonical names, values are CSS class\n * suffixes the chart components define in their `:host` styles.\n */\nexport const ASPECT_CLASS: Record<string, string> = {\n\tconjunction: 'aspect-conjunction',\n\tsextile: 'aspect-sextile',\n\tsquare: 'aspect-square',\n\ttrine: 'aspect-trine',\n\topposition: 'aspect-opposition',\n};\n\n/**\n * Normalize the `type` field on an aspect entry to a lowercase, hyphen-separated canonical name (`SEMI_SEXTILE` and `SEMI SEXTILE` both become `semi-sextile`). Accepts any aspect-shaped object so both natal and synastry inter-aspect entries can share this.\n *\n * @remarks\n * Spaces are folded as well as underscores because the endpoints do not agree on the separator: aspects returns `SEMI SEXTILE` where synastry returns `SEMI_SEXTILE`. Handling only the underscore left the space form failing every {@link ASPECT_CLASS} and `ASPECT_SYMBOL` lookup, so the same aspect rendered hyphenated and correctly coloured in one component and space-separated in the neutral fallback colour in another.\n */\nexport function normalizeAspect(a: { type?: string }): string {\n\treturn (a.type ?? '')\n\t\t.toLowerCase()\n\t\t.trim()\n\t\t.replace(/[\\s_]+/g, '-');\n}\n\n/**\n * Display label for an aspect: `SEMI_SEXTILE` -> `Semi-sextile`.\n *\n * The raw value is an API enum and the table column it lands in is read by practitioners, not parsers. {@link normalizeAspect} stays the lookup key for classes and glyphs; this is the human-facing form.\n */\nexport function formatAspectName(a: { type?: string }): string {\n\treturn capitalize(normalizeAspect(a));\n}\n\n/**\n * Display label for an ayanamsa identifier. `kp-newcomb` -> `KP Newcomb`.\n *\n * The raw values are API enums, and every one of them needs a human form that {@link humanize} cannot derive: KP is an initialism that must stay uppercase, and `raman` is a person, B.V. Raman, not a word. Anything unmapped degrades to a humanized slug rather than rendering the enum. That fallback is a safety net, not a licence to skip the map, since a humanized slug reads as a bare surname where a full name belongs. A test fails if the committed spec gains a frame this map lacks.\n */\nexport const AYANAMSA_LABEL: Record<string, string> = {\n\t'kp-newcomb': 'KP Newcomb',\n\t'kp-old': 'KP Old',\n\tlahiri: 'Lahiri',\n\traman: 'B.V. Raman',\n\n\tcustom: 'Custom',\n};\n\nexport function formatAyanamsa(type: unknown, degrees?: unknown): string {\n\tconst label =\n\t\ttypeof type === 'string' ? (AYANAMSA_LABEL[type] ?? humanize(type)) : '';\n\tconst deg =\n\t\ttypeof degrees === 'number' ? `${formatNumber(degrees, 2)}\\u00b0` : '';\n\tif (label && deg) return `${label} (${deg})`;\n\treturn label || deg;\n}\n\n/**\n * Date plus time in one label: `Jan 15, 1990, 2:30 PM`.\n *\n * @remarks\n * Components were concatenating a raw date and a raw time (`1990-01-15 \\u00b7 14:30:00`) while siblings rendered the same instant through {@link formatDate}. One helper keeps every card reading the same way.\n *\n * Birth details arrive as two fields rather than one timestamp, so `time` may be passed separately; it is merged into a naive datetime, which {@link formatDate} and {@link formatTime} pin to UTC so the wall clock renders identically for every viewer.\n *\n * @example\n * ```ts\n * formatDateTime('en', '1990-01-15T14:30:00'); // 'Jan 15, 1990, 2:30 PM'\n * formatDateTime('en', '1990-01-15', '14:30:00'); // 'Jan 15, 1990, 2:30 PM'\n * formatDateTime('de', '1990-01-15T14:30:00'); // '15. Jan. 1990, 14:30'\n * formatDateTime('en', '1990-01-15'); // 'Jan 15, 1990'\n * ```\n */\nexport function formatDateTime(\n\tlocale: string | undefined,\n\tinput: unknown,\n\ttime?: unknown,\n): string {\n\tconst merged =\n\t\ttypeof input === 'string' &&\n\t\tDATE_ONLY.test(input) &&\n\t\ttypeof time === 'string' &&\n\t\tBARE_TIME.test(time)\n\t\t\t? `${input}T${time}`\n\t\t\t: input;\n\tconst date = formatDate(locale, merged);\n\tconst clock = formatTime(locale, merged);\n\tif (date && clock) return `${date}, ${clock}`;\n\treturn date || clock;\n}\n\n/**\n * The Sanskrit form of a name, but only when it actually differs from the English one.\n *\n * @remarks\n * Several endpoints pair an English `name` with a `sanskritName` that is sometimes the SAME string, because the tradition and the translation coincide (a nakshatra is `Ashwini` either way). Rendering the pair unconditionally then prints `Ashwini (Ashwini)`. That guard is the whole reason this exists: it is one comparison, it is easy to leave out, and leaving it out is invisible until a reader hits a name where the two agree.\n *\n * Presentation deliberately stays with the caller, since the same fact is drawn as a parenthetical in a table cell and as a middot-separated span on a chart heading.\n */\nexport function distinctSanskrit(\n\tname: unknown,\n\tsanskritName: unknown,\n): string | undefined {\n\tif (typeof sanskritName !== 'string' || !sanskritName) return undefined;\n\treturn sanskritName === name ? undefined : sanskritName;\n}\n\n/**\n * `English (Sanskrit)` for a value that carries both, falling back to whichever one exists.\n *\n * @example\n * ```ts\n * formatWithSanskrit('Tuesday', 'Mangalavara'); // 'Tuesday (Mangalavara)'\n * formatWithSanskrit('Ashwini', 'Ashwini'); // 'Ashwini'\n * ```\n */\nexport function formatWithSanskrit(\n\tname: unknown,\n\tsanskritName: unknown,\n): string {\n\tconst english = typeof name === 'string' ? name : '';\n\tconst sanskrit = distinctSanskrit(english, sanskritName);\n\tif (!english) return sanskrit ?? '';\n\treturn sanskrit ? `${english} (${sanskrit})` : english;\n}\n", "/**\n * The value a READER sees, for a response field the API returns twice.\n *\n * @remarks\n * Several endpoints now echo a display translation beside the canonical value: `nameLocalized` next to `name`, `signLocalized` next to `sign`, `typeLocalized` next to `type`. **The canonical field is deliberately always English, whatever `?lang=` says, so it stays safe to compare against in code**, and the localized one is deliberately absent from an English response.\n *\n * That split is the whole contract, and inverting it breaks charts silently rather than loudly: `planetGlyph`, `signGlyph`, `aspectSymbol`, `ASPECT_CLASS`, `SIGNS_ORDER.indexOf`, every `Map` key and every CSS class fragment is keyed on the English name, so pointing one of them at `nameLocalized` resolves to nothing on a translated page and to the same value on an English one, which is exactly the shape of defect that passes every gate (lesson 24). **The lookup stays on the canonical value; only the printed text node, the `title` and the `aria-label` move.**\n *\n * These two helpers exist so that rule lives in one place rather than as a `??` at every call site, and so an English response, where the localized field simply is not there, degrades by construction instead of by remembering. Both take the KEY of the canonical field and derive its partner, so a mistyped key or a field that is not a display string is a compile error rather than a silent empty string.\n */\n\n/** The one naming convention every helper here derives from. Ratified by the API and spreading to more operations, so it is matched as a convention and never as a list of field names. */\nconst LOCALIZED = 'Localized';\n\n/** A response row carrying a canonical English `K` plus the optional localized partner the API writes beside it. */\nexport type Localizable<K extends string> = Partial<\n\tRecord<K | `${K}Localized`, string>\n>;\n\n/** The same pairing where the value is a LIST of names, e.g. `retrogradePlanets`. */\nexport type LocalizableList<K extends string> = Partial<\n\tRecord<K | `${K}Localized`, string[]>\n>;\n\n/**\n * The text to print for `key`: the localized value when the response carried one, else the English one.\n *\n * @param english - What to print in the English case INSTEAD of the raw field, for a canonical value that is an API enum with a display form of its own (`type` is `SEMI_SEXTILE` on the wire and `Semi-sextile` on screen). Omit it wherever the canonical value is already the readable one.\n *\n * @example\n * ```ts\n * display(planet, 'name'); // 'Sol' on ?lang=es, 'Sun' on English\n * planetGlyph(planet.name) ?? display(planet, 'name'); // the lookup stays English, the fallback TEXT does not\n * display(aspect, 'type', formatAspectName(aspect)); // 'Tr\u00EDgono', else 'Trine' and never 'TRINE'\n * ```\n */\nexport function display<\n\tT extends Localizable<K>,\n\tK extends Extract<keyof T, string>,\n>(row: T | null | undefined, key: K, english?: string): string {\n\tconst rec = row as Record<string, unknown> | null | undefined;\n\tconst localized = rec?.[`${key}${LOCALIZED}`];\n\tif (typeof localized === 'string' && localized !== '') return localized;\n\tif (english !== undefined) return english;\n\tconst canonical = rec?.[key];\n\treturn typeof canonical === 'string' ? canonical : '';\n}\n\n/**\n * A list field as `{ value, label }` pairs: the English `value` every lookup is keyed on, and the `label` a reader sees.\n *\n * @remarks\n * The localized array is INDEX-ALIGNED with the canonical one, which is the only thing that makes the pairing possible, so it is zipped by position and neither side is ever sorted, filtered or deduped on its own. A list that is short or absent falls back per item, so a partial translation still resolves every glyph.\n */\nexport function displayList<\n\tT extends LocalizableList<K>,\n\tK extends Extract<keyof T, string>,\n>(row: T | null | undefined, key: K): Array<{ value: string; label: string }> {\n\tconst rec = row as Record<string, unknown> | null | undefined;\n\tconst canonical = rec?.[key];\n\tif (!Array.isArray(canonical)) return [];\n\tconst localized = rec?.[`${key}${LOCALIZED}`];\n\tconst labels = Array.isArray(localized) ? localized : [];\n\treturn canonical.map((value, i) => {\n\t\tconst label = labels[i];\n\t\treturn {\n\t\t\tvalue: String(value),\n\t\t\tlabel: typeof label === 'string' && label !== '' ? label : String(value),\n\t\t};\n\t});\n}\n\n/**\n * Fold every `XLocalized` field into its `X` partner: the reader's value under the canonical NAME, and the duplicate key gone.\n *\n * @remarks\n * For a renderer that has no idea what its fields MEAN and derives its columns from `Object.keys(row)`, which is how `<roxy-data>` started drawing `Planet | Planet Localized | Longitude | Sign | Sign Localized` the day the API began sending both. Two extra columns, headed in English, carrying the same fact twice, on a page whose owner changed nothing. That is a regression rather than a missing feature, so it is repaired at the key layer every render path already funnels through rather than at each of them.\n *\n * Three rules, and each has a way of going wrong:\n *\n * - **A `*Localized` key with no canonical partner stays put.** Suppressing on the name alone deletes data the response carries and nothing else is rendering.\n * - **The canonical key keeps its POSITION**, so a translated response and an English one lay out identically, column for column.\n * - **A row with nothing to fold is returned as the same object**, so the English path is not merely equivalent but untouched.\n *\n * The English value is dropped rather than shown beside its translation because the two are the same fact, and the caller here is generic: it cannot know that `sign` is the value a lookup would be keyed on. A component that needs both halves reads them itself with {@link display}.\n */\nexport function foldLocalized<V>(row: Record<string, V>): Record<string, V> {\n\tlet folded: Record<string, V> | undefined;\n\tfor (const key of Object.keys(row)) {\n\t\tif (!key.endsWith(LOCALIZED)) continue;\n\t\tconst base = key.slice(0, -LOCALIZED.length);\n\t\tif (base === '' || !(base in row)) continue;\n\t\tfolded ??= { ...row };\n\t\tconst value = row[key];\n\t\tif (value !== undefined && value !== null && value !== '')\n\t\t\tfolded[base] = value;\n\t\tdelete folded[key];\n\t}\n\treturn folded ?? row;\n}\n", "import type { TemplateResult } from 'lit';\nimport { css, html, nothing } from 'lit';\n\n/** A single tab in a {@link renderTablist} strip. */\nexport interface TablistItem<T extends string = string> {\n\tid: T;\n\tlabel: string;\n}\n\n/**\n * Shared styling for every horizontal tab strip in the library (natal chart\n * views, transits, kundli styles). Keeping one rule set means the tabs look\n * identical everywhere and theme through the same --roxy-* tokens.\n */\nexport const tablistStyles = css`.roxy-tablist{border-bottom:2px solid var(--roxy-border,#e4e4e7);scrollbar-width:thin;gap:2px;min-width:0;display:flex;overflow-x:auto}.roxy-tab{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);cursor:pointer;color:var(--roxy-muted,#71717a);transition:color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);background:0 0;border:none;border-bottom:2px solid #0000;flex-shrink:0;margin-bottom:-2px;font-family:inherit}.roxy-tab[aria-selected=true]{color:var(--roxy-accent-ink,#b45309);border-bottom-color:var(--roxy-accent,#f59e0b);font-weight:var(--roxy-weight-bold,600)}.roxy-tab:hover:not([aria-selected=true]){color:var(--roxy-fg,#0a0a0a)}.roxy-tab:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:-2px;border-radius:4px}`;\n\n/**\n * Render a WAI-ARIA tablist. The host component owns the active-tab state; this\n * helper draws the buttons, wires click plus Left/Right arrow navigation with a\n * roving tabindex, and moves focus to the newly selected tab. Pair with\n * {@link tablistStyles}.\n *\n * The strip carries `part=\"tablist\"` and each button `part=\"tab\"`, so a host page can restyle or hide the view switch from outside the shadow root without knowing which component drew it.\n *\n * Pass `controls: true` when each tab governs a sibling\n * `<div role=\"tabpanel\" id=\"${idPrefix}-panel-${id}\">` so the buttons advertise\n * `aria-controls`. The host renders only the ACTIVE panel; this helper emits an\n * empty hidden panel for each of the others so the `aria-controls` on every tab\n * resolves. Omit it for tablists that swap a single rendered view in place with\n * no separate panel element (the kundli style switch).\n *\n * @example\n * ```ts\n * renderTablist({\n * items: [{ id: 'wheel', label: 'Wheel' }, { id: 'grid', label: 'Aspect grid' }],\n * active: this.view,\n * onSelect: (v) => { this.view = v; },\n * label: 'Natal chart views',\n * idPrefix: 'natal',\n * controls: true,\n * })\n * ```\n */\nexport function renderTablist<T extends string>(opts: {\n\titems: ReadonlyArray<TablistItem<T>>;\n\tactive: T;\n\tonSelect: (id: T) => void;\n\tlabel: string;\n\tidPrefix: string;\n\tcontrols?: boolean;\n}): TemplateResult {\n\tconst { items, active, onSelect, label, idPrefix, controls = false } = opts;\n\tconst onKeyDown = (e: KeyboardEvent) => {\n\t\tif (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return;\n\t\te.preventDefault();\n\t\tconst idx = items.findIndex((it) => it.id === active);\n\t\tif (idx === -1) return;\n\t\tconst delta = e.key === 'ArrowRight' ? 1 : -1;\n\t\tconst next = items[(idx + delta + items.length) % items.length];\n\t\tif (!next) return;\n\t\tonSelect(next.id);\n\t\tconst root = (e.currentTarget as HTMLElement).getRootNode() as\n\t\t\t| ShadowRoot\n\t\t\t| Document;\n\t\trequestAnimationFrame(() => {\n\t\t\troot\n\t\t\t\t.querySelector<HTMLButtonElement>(`#${idPrefix}-tab-${next.id}`)\n\t\t\t\t?.focus();\n\t\t});\n\t};\n\treturn html`<div class=\"roxy-tablist\" part=\"tablist\" role=\"tablist\" aria-label=\"${label}\" @keydown=\"${onKeyDown}\">${items.map(\n\t\t\t(it) => html`<button type=\"button\" class=\"roxy-tab\" part=\"tab\" role=\"tab\" id=\"${idPrefix}-tab-${it.id}\" aria-selected=\"${active === it.id ? 'true' : 'false'}\" aria-controls=\"${controls ? `${idPrefix}-panel-${it.id}` : nothing}\" tabindex=\"${active === it.id ? '0' : '-1'}\" @click=\"${() => onSelect(it.id)}\">${it.label}</button>`,\n\t\t)}</div>${\n\t\t/**\n\t\t * Stand-in panels for the tabs that are not selected.\n\t\t *\n\t\t * The APG requires `aria-controls` on EVERY tab, not just the active one, and it must resolve to a real `tabpanel`. Components render one panel at a time, so without these the other tabs either carried a dangling IDREF or, as here previously, dropped the attribute and lost the relationship entirely: a screen reader user could not tell what any inactive tab governed.\n\t\t *\n\t\t * Empty and `hidden`, so they cost two nodes and no layout, and the panel content stays lazy: a natal chart does not build its wheel, aspect grid and positions table all at once just to satisfy an IDREF. The host still renders the ACTIVE panel itself, at `${idPrefix}-panel-${active}`, which is why these skip it.\n\t\t */\n\t\tcontrols\n\t\t\t? items\n\t\t\t\t\t.filter((it) => it.id !== active)\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(it) => html`<div role=\"tabpanel\" id=\"${idPrefix}-panel-${it.id}\" aria-labelledby=\"${idPrefix}-tab-${it.id}\" hidden></div>`,\n\t\t\t\t\t)\n\t\t\t: nothing\n\t}`;\n}\n"],
5
- "mappings": "4MAAA,OAAS,OAAAA,GAAK,QAAAC,EAAM,WAAAC,MAAe,MACnC,OAAS,iBAAAC,OAAqB,oBAC9B,OAAS,aAAAC,OAAiB,+BCF1B,OAAS,OAAAC,GAAK,QAAAC,EAAM,WAAAC,EAAS,OAAAC,MAAW,MACxC,OAAS,iBAAAC,GAAe,YAAAC,GAAU,SAAAC,OAAa,oBC4BxC,SAASC,EAAU,EAAmB,CAC5C,OAAO,EACL,YAAY,EACZ,QAAQ,WAAY,GAAG,EACvB,KAAK,CACR,CAEO,SAASC,EAAW,EAAmB,CAC7C,OAAK,EACE,EAAE,OAAO,CAAC,EAAE,YAAY,EAAI,EAAE,MAAM,CAAC,EAAE,YAAY,EAD3C,EAEhB,CCvBA,IAAMC,EAAU,CACfC,EACAC,IACyBA,EAAOD,EAAME,EAAUD,CAAI,CAAC,EAAI,OAEpDE,GAAuC,CAC5C,IAAK,SACL,KAAM,SACN,QAAS,SACT,MAAO,SACP,MAAO,SACP,KAAM,SACN,QAAS,SACT,OAAQ,SACR,OAAQ,SACR,QAAS,SACT,MAAO,SACP,KAAM,SACN,KAAM,SACN,UAAW,MACX,MAAO,KACP,aAAc,SACd,aAAc,SACd,OAAQ,SACR,OAAQ,SACR,oBAAqB,QACtB,EAGaC,EACZH,GACwBF,EA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A,CAAC,SAAS,CAAC,eAC7LD,CACJ,yFACEH,GAAG,qBAAqB,OACrBF,2BAA8BE,EAAE,oBAAoB,IACnDK,GACAP,QAAWL,GAASY,EAAE,MAAM,CAAC,IAAIA,EAAE,MAAM,WAAWA,EAAE,UAAU,kCAAkCA,EAAE,cAAc,OACpH,CAAC,QACAP,sEACJ,wBACJ,CACD,EAzDaF,EACL,OAAS,CACfU,EACAC,26CACD,EAJYX,EAANY,EAAA,CADNC,GAAc,uBAAuB,GACzBb",
4
+ "sourcesContent": ["import { css, html, nothing } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n// Registers <roxy-natal-chart>, reused below as the wheel renderer. The\n// relocation response is structurally a natal chart (same planets, houses, and\n// angles), so the wheel is shared rather than duplicated.\nimport './natal-chart.js';\nimport { planetGlyph } from '../tokens/index.js';\nimport type { RelocationChartResponse } from '../types/index.js';\nimport { RoxyDataElement } from '../utils/base-element.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport { formatInteger } from '../utils/format.js';\n\ntype HouseChange =\n\tRelocationChartResponse['changes']['planetsChangedHouse'][number];\n\nconst glyphFor = (name: string): string => planetGlyph(name) ?? '';\n\n/**\n * Relocation chart. The birth instant is unchanged, so every planet keeps its\n * natal sign and degree while the houses and angles are recomputed for a new\n * place. Reuses {@link RoxyNatalChart} for the wheel (identical data shape) and\n * adds the relocation read: the move geometry, the planets that change house,\n * and the bodies pulled onto a relocated angle.\n *\n * @remarks\n * Composing another component means two things have to be forwarded or they stop\n * at the boundary: `hide-readings` is passed down, so suppressing prose here also\n * suppresses the wheel's planet readings; and the wheel's parts are re-exported,\n * because a part is only addressable one shadow root deep.\n */\n@customElement('roxy-relocation-wheel')\nexport class RoxyRelocationWheel extends RoxyDataElement<RelocationChartResponse> {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tcss`.stack{gap:var(--roxy-space-md,1rem);display:grid}.changes{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);gap:var(--roxy-space-md,1rem);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-primary,#0f172a);margin:0}.move{gap:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-muted,#71717a);flex-wrap:wrap;display:flex}.summary{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a);margin:0}.block-label{font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.06em;color:var(--roxy-muted,#71717a);margin:0 0 var(--roxy-space-xs,.25rem);font-weight:600}.chips{gap:var(--roxy-space-xs,.25rem);flex-wrap:wrap;display:flex}.chip{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 16%, transparent);color:var(--roxy-fg,#0a0a0a);padding:2px 10px}.moves-list{gap:2px;margin:0;padding:0;list-style:none;display:grid}.moves-list li{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-fg,#0a0a0a)}.moves-list .arrow{color:var(--roxy-muted,#71717a)}.empty-note{font-size:var(--roxy-text-sm,.875rem);color:var(--roxy-muted,#71717a);margin:0}`,\n\t];\n\n\tprotected renderEmpty() {\n\t\treturn html`<div class=\"roxy-empty\" role=\"status\">No relocation data</div>`;\n\t}\n\n\tprotected renderData(data: RelocationChartResponse) {\n\t\tconst c = data.changes;\n\t\treturn html`<div class=\"stack\" part=\"stack\"><roxy-natal-chart heading=\"Relocation chart\" lang=\"${ifDefined(this.effectiveLang())}\" exportparts=\"card, header, tablist, tab, panel, chart, table, aspect-grid, element-modality, legend, details, section, patterns, pattern, readings, reading\" ?hide-readings=\"${this.hideReadings}\" .data=\"${data}\"></roxy-natal-chart><section class=\"changes\" part=\"card changes\"><h3 class=\"title\">What changes at this location</h3><div class=\"move\" part=\"details\">${\n\t\t\t\t\t\ttypeof c?.distanceKm === 'number'\n\t\t\t\t\t\t\t? html`<span>${\n\t\t\t\t\t\t\t\t\t// Under a kilometre the bearing is noise: \"0 km south of\n\t\t\t\t\t\t\t\t\t// birthplace\" reads as a broken calculation, not a same-place\n\t\t\t\t\t\t\t\t\t// relocation.\n\t\t\t\t\t\t\t\t\tMath.round(c.distanceKm) === 0\n\t\t\t\t\t\t\t\t\t\t? 'Same location as birth'\n\t\t\t\t\t\t\t\t\t\t: `${formatInteger(this.effectiveLang(), c.distanceKm)} km ${c.direction ?? ''} of birthplace`\n\t\t\t\t\t\t\t\t}</span>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t} ${\n\t\t\t\t\t\tc\n\t\t\t\t\t\t\t? html`<span>${\n\t\t\t\t\t\t\t\t\t// Name the sign in BOTH branches. Reporting only the boolean\n\t\t\t\t\t\t\t\t\t// put \"Ascendant keeps its sign\" directly above a summary\n\t\t\t\t\t\t\t\t\t// reading \"The Ascendant moves to Gemini\", and a reader\n\t\t\t\t\t\t\t\t\t// cannot tell which one is wrong. Neither was: the sign is\n\t\t\t\t\t\t\t\t\t// Gemini either way. Stating it reconciles the two.\n\t\t\t\t\t\t\t\t\tdata.ascendant?.sign\n\t\t\t\t\t\t\t\t\t\t? `Ascendant ${c.ascendantSignChanged ? 'moves to' : 'stays in'} ${data.ascendant.sign}`\n\t\t\t\t\t\t\t\t\t\t: c.ascendantSignChanged\n\t\t\t\t\t\t\t\t\t\t\t? 'Ascendant changes sign'\n\t\t\t\t\t\t\t\t\t\t\t: 'Ascendant keeps its sign'\n\t\t\t\t\t\t\t\t}</span>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t}</div>${\n\t\t\t\t\t// The only prose here. The move geometry, the angular planets and the\n\t\t\t\t\t// house changes below it are all data and survive hide-readings.\n\t\t\t\t\tdata.interpretation?.summary && !this.hideReadings\n\t\t\t\t\t\t? html`<p class=\"summary\">${data.interpretation.summary}</p>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\tc?.angularPlanets?.length\n\t\t\t\t\t\t? html`<div part=\"section angular-planets\"><p class=\"block-label\">Angular planets here</p><div class=\"chips\">${c.angularPlanets.map((p) => html`<span class=\"chip\">${glyphFor(p)} ${p}</span>`)}</div></div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}<div part=\"section house-changes\"><p class=\"block-label\">Planets that change house</p>${\n\t\t\t\t\t\tc?.planetsChangedHouse?.length\n\t\t\t\t\t\t\t? html`<ul class=\"moves-list\">${c.planetsChangedHouse.map(\n\t\t\t\t\t\t\t\t\t(m: HouseChange) =>\n\t\t\t\t\t\t\t\t\t\thtml`<li>${glyphFor(m.planet)} ${m.planet}: house ${m.natalHouse} <span class=\"arrow\">to</span> ${m.relocatedHouse}</li>`,\n\t\t\t\t\t\t\t\t)}</ul>`\n\t\t\t\t\t\t\t: html`<p class=\"empty-note\">No planet changes house at this location.</p>`\n\t\t\t\t\t}</div></section></div>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-relocation-wheel': RoxyRelocationWheel;\n\t}\n}\n", "import { css, html, nothing, svg } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport {\n\taspectSymbol,\n\tplanetGlyph,\n\tSIGNS_ORDER,\n\tsignGlyph,\n} from '../tokens/index.js';\nimport type { NatalChartResponse } from '../types/index.js';\nimport { RoxyDataElement } from '../utils/base-element.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport {\n\tarcMidpoint,\n\tlongitudeToSignPosition,\n\tnormalizeLongitude,\n\toppositePoint,\n\tpolarToCartesian,\n} from '../utils/degree.js';\nimport { disclosureStyles } from '../utils/disclosure.js';\nimport {\n\tASPECT_CLASS,\n\tformatAspectName,\n\tformatDateTime,\n\tformatNumber,\n\tnormalizeAspect,\n} from '../utils/format.js';\nimport {\n\ttype InterpSection,\n\tinterpAccordionStyles,\n} from '../utils/interp-accordion.js';\nimport { display, displayList } from '../utils/localized.js';\nimport { capitalize, lookupKey } from '../utils/string.js';\nimport { renderTablist, tablistStyles } from '../utils/tablist.js';\n\ntype PlanetEntry = NatalChartResponse['planets'][number];\ntype AspectEntry = NatalChartResponse['aspects'][number];\ntype PatternEntry = NonNullable<NatalChartResponse['patterns']>[number];\n\n/**\n * Reading order for detected configurations. A practitioner reads the rare, chart-defining figures first (a Grand Cross reframes the whole chart) and the common ones last, so the response order is re-sorted rather than dumped. Ties break on tightness, the closest to exact first.\n */\nconst PATTERN_ORDER: Record<string, number> = {\n\tGRAND_CROSS: 0,\n\tGRAND_TRINE: 1,\n\tKITE: 2,\n\tT_SQUARE: 3,\n\tYOD: 4,\n\tMYSTIC_RECTANGLE: 5,\n\tSTELLIUM: 6,\n};\n\nconst SIZE = 420;\nconst CENTER = SIZE / 2;\nconst OUTER_R = 164;\nconst SIGN_R = 146;\nconst HOUSE_R = 120;\nconst PLANET_R = 96;\nconst ANGLE_TICK_R = 178;\nconst ANGLE_LABEL_R = 196;\n\n/**\n * The chart shape the wheel actually renders.\n *\n * @remarks\n * `RelocationChartResponse` carries the same planets, houses, angles and birth details as `NatalChartResponse` (`RelocationPlanet` is field-for-field identical to the natal planet item), and differs only by having no `aspects`, `aspectsInterpretation`, `patterns`, `partOfFortune` or `summary`. The wheel already renders without them, so those five are simply optional here.\n *\n * Typing that contract is what lets {@link RoxyRelocationWheel} compose this component honestly. It used to pass its response through a `data as unknown as NatalChartResponse` double cast, which silently asserted five required fields that were not there.\n */\ntype ChartExtras =\n\t| 'aspects'\n\t| 'aspectsInterpretation'\n\t| 'patterns'\n\t| 'partOfFortune'\n\t| 'summary';\nexport type WheelChart = Omit<NatalChartResponse, ChartExtras> &\n\tPartial<Pick<NatalChartResponse, ChartExtras>>;\n\n/**\n * Western natal chart wheel. Renders the 12 zodiac signs, 12 houses, planet\n * markers, and aspect lines from a /astrology/natal-chart response.\n *\n * @remarks\n * **There is deliberately no `house-system` input, and re-adding one would be a\n * lie in the types.** The house system is a REQUEST parameter: /astrology/natal-chart\n * and /astrology/relocation-chart both take it and both echo the system they\n * actually used as a required `houseSystem` field, which is what the legend\n * chip reads. This component computes nothing astrological, so an attribute\n * could never move a cusp; all it could do is print a label contradicting the\n * cusps drawn beside it. One shipped anyway, declared and typed and wired\n * through both framework wrappers, and nothing ever read it, so a consumer who\n * followed our own generated types set it and got silence. Change the system in\n * the REQUEST (the self-fetch form already offers it, straight off the spec) and\n * the response relabels itself.\n *\n * **The equal-sector fallback is visible, on purpose.** With fewer than twelve\n * cusps in the response the wheel draws twelve equal 30 degree sectors from the\n * Ascendant, which is a different chart from a Placidus one; it says so in the\n * accessible name and in a legend chip rather than numbering the sectors 1 to 12\n * and letting a reader assume the response carried them.\n */\n@customElement('roxy-natal-chart')\nexport class RoxyNatalChart extends RoxyDataElement<WheelChart> {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\ttablistStyles,\n\t\tdisclosureStyles,\n\t\tinterpAccordionStyles,\n\t\tcss`.wrap{background:var(--roxy-surface,#fff);width:100%;color:var(--roxy-fg,#0a0a0a);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-lg,1.5rem);box-shadow:var(--roxy-shadow-sm);gap:var(--roxy-space-md,1rem);grid-template-columns:minmax(0,1fr);display:grid}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-primary,#0f172a);margin:0}.meta{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-sm,.875rem)}svg{width:100%;max-width:var(--roxy-chart-max-width,560px);aspect-ratio:1;height:auto;margin:0 auto;display:block}.wheel-line{fill:none;stroke:var(--roxy-border,#e4e4e7)}.sign-glyph{fill:var(--roxy-secondary,#475569);font-size:14px;font-family:var(--roxy-font-sans)}.planet-glyph{fill:var(--roxy-accent,#f59e0b);font-size:14px;font-weight:600;font-family:var(--roxy-font-sans)}.planet-deg{fill:var(--roxy-fg,#0a0a0a);font-size:7px;font-family:var(--roxy-font-sans)}@container (width<=480px){.sign-glyph,.planet-glyph{font-size:18px}.planet-deg{font-size:10px}.house-num{font-size:12px}}.planet-deg .retro{fill:var(--roxy-danger,#dc2626)}.planet-leader{stroke:var(--roxy-accent,#f59e0b);stroke-width:.5px;opacity:.55}.house-num{fill:var(--roxy-muted,#71717a);font-size:9px;font-family:var(--roxy-font-sans)}.cusp-deg{fill:var(--roxy-muted,#71717a);font-size:6px;font-family:var(--roxy-font-sans)}.tick{stroke:var(--roxy-border,#e4e4e7)}.tick-major{stroke:var(--roxy-secondary,#475569)}.aspect{stroke-width:.8px;fill:none;opacity:.55}.aspect-trine,.aspect-sextile{stroke:var(--roxy-success,#16a34a)}.aspect-square,.aspect-opposition{stroke:var(--roxy-danger,#dc2626)}.aspect-conjunction{stroke:var(--roxy-accent-ink,#b45309)}.aspect-other{stroke:var(--roxy-muted,#71717a);opacity:.4}.angle-marker{fill:var(--roxy-accent-ink,#b45309);font-size:10px;font-weight:700;font-family:var(--roxy-font-sans);letter-spacing:.04em}.angle-tick{stroke:var(--roxy-accent-ink,#b45309);stroke-width:1.5px}.legend{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);gap:var(--roxy-space-md,1rem);flex-wrap:wrap;display:flex}.legend-swatch{vertical-align:middle;border-radius:50%;width:8px;height:8px;margin-right:4px;display:inline-block}.legend .caveat{color:var(--roxy-fg,#0a0a0a);font-weight:var(--roxy-weight-bold,600);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-full,9999px);padding:1px 8px}.grid-scroll{-webkit-overflow-scrolling:touch;min-width:0;overflow-x:auto}table.aspect-grid{border-collapse:collapse;font-size:var(--roxy-text-xs,.75rem);margin:0 auto}table.aspect-grid th,table.aspect-grid td{text-align:center;border:1px solid var(--roxy-border,#e4e4e7);width:1.6rem;height:1.6rem;padding:0}table.aspect-grid th{color:var(--roxy-secondary,#475569);font-weight:var(--roxy-weight-bold,600)}table.aspect-grid td.cell{cursor:default}table.aspect-grid td.empty{background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 18%, transparent)}table.aspect-grid td .asp{font-size:.95em;line-height:1}table.aspect-grid td.aspect-trine .asp,table.aspect-grid td.aspect-sextile .asp{color:var(--roxy-success,#16a34a)}table.aspect-grid td.aspect-square .asp,table.aspect-grid td.aspect-opposition .asp{color:var(--roxy-danger,#dc2626)}table.aspect-grid td.aspect-conjunction .asp{color:var(--roxy-accent-ink,#b45309)}table.aspect-grid td.aspect-other .asp{color:var(--roxy-muted,#71717a)}.details{margin-top:var(--roxy-space-md,1rem)}.pill-row{gap:var(--roxy-space-xs,.25rem);margin-bottom:var(--roxy-space-xs,.25rem);flex-wrap:wrap;display:flex}.pill{border-radius:var(--roxy-radius-sm,4px);font-size:var(--roxy-text-xs,.75rem);background:color-mix(in srgb, var(--roxy-fg,#0f172a) 8%, transparent);color:var(--roxy-fg,#0f172a);padding:2px 8px}.pill--success{background:color-mix(in srgb, var(--roxy-success,#16a34a) 15%, transparent);color:var(--roxy-success,#16a34a)}.pill--danger{background:color-mix(in srgb, var(--roxy-danger,#dc2626) 15%, transparent);color:var(--roxy-danger,#dc2626)}.pill--muted{background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent);color:var(--roxy-fg,#0a0a0a)}.summary{color:var(--roxy-fg,#0f172a);font-size:var(--roxy-text-sm,.875rem);margin:var(--roxy-space-md,1rem) 0}.em-grid{border-collapse:collapse;font-size:var(--roxy-text-xs,.75rem);width:100%}.em-grid caption{caption-side:top;text-align:left;color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);padding-bottom:var(--roxy-space-xs,.25rem)}.em-grid th,.em-grid td{border:1px solid var(--roxy-border,#e4e4e7);text-align:center;vertical-align:middle;padding:3px 5px}.em-grid th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;letter-spacing:.04em}.em-grid th[scope=row]{text-align:left}.em-grid td{color:var(--roxy-accent,#f59e0b);min-width:1.4rem;font-size:.95em;line-height:1.4}.em-grid .em-total{color:var(--roxy-fg,#0a0a0a);font-weight:var(--roxy-weight-bold,600);background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 25%, transparent)}.em-grid .dominant{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 10%, transparent)}.em-grid th.dominant,.em-grid td.em-total.dominant{color:var(--roxy-fg,#0a0a0a)}.pattern{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);margin-bottom:var(--roxy-space-xs,.25rem);gap:.35rem;display:grid}.pattern-head{flex-wrap:wrap;align-items:baseline;gap:.5rem;display:flex}.pattern-name{font-weight:var(--roxy-weight-bold,600)}.pattern-tag{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 55%, transparent);color:var(--roxy-fg,#0a0a0a);text-transform:capitalize;padding:1px 8px}.pattern-tight{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);font-variant-numeric:tabular-nums;margin-left:auto}.pattern-planets{flex-wrap:wrap;gap:.25rem;display:flex}.planet-chip{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 45%, transparent);color:var(--roxy-fg,#0a0a0a);align-items:baseline;gap:.3rem;padding:1px 8px;display:inline-flex}.planet-chip.apex{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 20%, transparent);font-weight:var(--roxy-weight-bold,600)}.planet-chip .apex-tag{text-transform:uppercase;letter-spacing:.04em;font-size:.85em;font-weight:400}.pattern-interp{color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);margin:0;line-height:1.45}.interp-keywords{flex-wrap:wrap;gap:.25rem;display:flex}.interp-keywords .kw{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-xs,.75rem);border-radius:9999px;padding:1px 8px}`,\n\t];\n\n\t/** Heading above the wheel. Defaults to \"Natal chart\"; reuse (e.g. the relocation wheel) sets its own. */\n\t@property({ type: String })\n\theading = 'Natal chart';\n\n\t/** Which view is showing: the wheel or the planet-by-planet aspect grid. */\n\t@state()\n\tprivate view: 'wheel' | 'grid' = 'wheel';\n\n\tprivate getPlanets(): PlanetEntry[] {\n\t\treturn this.data?.planets ?? [];\n\t}\n\n\tprivate getAscendant(): number {\n\t\treturn this.data?.ascendant?.longitude ?? 0;\n\t}\n\n\tprivate getMidheaven(): number | null {\n\t\tconst m = this.data?.midheaven?.longitude;\n\t\treturn typeof m === 'number' ? m : null;\n\t}\n\n\t/**\n\t * True when the response carried all twelve house cusps, so every house on the\n\t * wheel is a longitude the API sent rather than a 30 degree sector this\n\t * component invented. Read by the spokes, the numbers, the cusp degrees, the\n\t * accessible name and the legend, so the drawing and the words about it cannot\n\t * disagree about which chart is on screen.\n\t */\n\tprivate get hasCusps(): boolean {\n\t\treturn (this.data?.houses ?? []).length === 12;\n\t}\n\n\tprivate toAngle(lon: number): number {\n\t\treturn 180 + this.getAscendant() - lon;\n\t}\n\n\tprotected renderEmpty() {\n\t\treturn html`<div class=\"roxy-empty\" role=\"status\">${this.t('No chart data')}</div>`;\n\t}\n\n\tprotected renderData(data: WheelChart) {\n\t\tconst planets = this.getPlanets();\n\t\tconst aspects = data.aspects ?? [];\n\t\tconst view = this.view;\n\n\t\treturn html`<div class=\"wrap\" part=\"card\"><header part=\"header\"><h2 class=\"title\">${this.t(this.heading)}</h2>${\n\t\t\t\t\tdata.birthDetails\n\t\t\t\t\t\t? html`<div class=\"meta\">${formatDateTime(this.effectiveLang(), data.birthDetails.date, data.birthDetails.time)}</div>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</header>${\n\t\t\t\taspects.length > 0\n\t\t\t\t\t? html`${renderTablist({\n\t\t\t\t\t\t\titems: [\n\t\t\t\t\t\t\t\t{ id: 'wheel', label: this.t('Wheel') },\n\t\t\t\t\t\t\t\t{ id: 'grid', label: this.t('Aspect grid') },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tactive: view,\n\t\t\t\t\t\t\tonSelect: (v) => {\n\t\t\t\t\t\t\t\tthis.view = v;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tlabel: this.t('Natal chart views'),\n\t\t\t\t\t\t\tidPrefix: 'natal',\n\t\t\t\t\t\t\tcontrols: true,\n\t\t\t\t\t\t})}<div id=\"natal-panel-${view}\" part=\"panel\" role=\"tabpanel\" aria-labelledby=\"natal-tab-${view}\">${view === 'wheel' ? this.renderWheel(planets, aspects) : this.renderAspectGrid(planets, aspects)}</div>`\n\t\t\t\t\t: this.renderWheel(planets, aspects)\n\t\t\t}<div class=\"legend\" part=\"legend\"><span>${this.t('{{count}} planets', { count: planets.length })}</span> ${aspects.length > 0 ? html`<span>${this.t('{{count}} aspects', { count: aspects.length })}</span>` : nothing} ${\n\t\t\t\t\t// The system names the CUSPS, so it is only true while there are\n\t\t\t\t\t// cusps. Without them the caveat takes its place rather than sitting\n\t\t\t\t\t// beside it and contradicting it.\n\t\t\t\t\tthis.hasCusps && data.houseSystem\n\t\t\t\t\t\t? html`<span>${this.t('{{system}} houses', { system: data.houseSystem })}</span>`\n\t\t\t\t\t\t: html`<span class=\"caveat\">${this.t('Equal sectors from the Ascendant, no house cusps in this response')}</span>`\n\t\t\t\t} ${\n\t\t\t\t\taspects.length > 0\n\t\t\t\t\t\t? html`<span><span class=\"legend-swatch\" style=\"background:var(--roxy-success)\"></span>${this.t('Harmonious')}</span> <span><span class=\"legend-swatch\" style=\"background:var(--roxy-danger)\"></span>${this.t('Challenging')}</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</div>${this.renderDetails()} ${\n\t\t\t\t// Ungated on purpose. The figures are chart geometry, not a reading, and\n\t\t\t\t// only the paragraph inside each card answers to hide-readings. Do NOT\n\t\t\t\t// wrap this call in the flag: the reasoning, and the escape hatch for a\n\t\t\t\t// page that wants the block gone anyway, are on renderPatterns.\n\t\t\t\tthis.renderPatterns()\n\t\t\t} ${this.renderInterpretations()}</div>`;\n\t}\n\n\tprivate renderWheel(planets: PlanetEntry[], aspects: AspectEntry[]) {\n\t\treturn html`<svg viewBox=\"0 0 ${SIZE} ${SIZE}\" part=\"chart\" role=\"img\" aria-label=\"${\n\t\t\t\tthis.hasCusps\n\t\t\t\t\t? this.t('Natal chart wheel with twelve houses, planets, and aspects')\n\t\t\t\t\t: this.t(\n\t\t\t\t\t\t\t'Natal chart wheel with planets and aspects, houses shown as equal sectors from the Ascendant',\n\t\t\t\t\t\t)\n\t\t\t}\"><title>${this.t('Natal chart wheel')}</title><desc>${this.t('Twelve zodiac sign segments around a circular wheel. Planet glyphs are placed at their ecliptic longitudes. Aspect lines connect related planets.')}</desc><circle class=\"wheel-line\" cx=\"${CENTER}\" cy=\"${CENTER}\" r=\"${OUTER_R}\" stroke-width=\"1.5\"/><circle class=\"wheel-line\" cx=\"${CENTER}\" cy=\"${CENTER}\" r=\"${SIGN_R - 14}\" stroke-width=\"0.8\"/><circle class=\"wheel-line\" cx=\"${CENTER}\" cy=\"${CENTER}\" r=\"${HOUSE_R}\" stroke-width=\"1\"/><circle class=\"wheel-line\" cx=\"${CENTER}\" cy=\"${CENTER}\" r=\"${PLANET_R - 16}\" stroke-width=\"0.5\"/>${this.renderTicks()} ${this.renderSpokes()} ${this.renderSigns()} ${this.renderHouseNumbers()} ${this.renderCuspDegrees()} ${this.renderAspects(planets, aspects)} ${this.renderPlanets(planets)} ${this.renderAngles()}</svg>`;\n\t}\n\n\t/**\n\t * Planet-by-planet aspect grid: the lower-triangular matrix astrologers read\n\t * alongside the wheel. Each filled cell shows the aspect glyph colored by\n\t * nature, with the exact orb in the SVG-free `<title>` tooltip.\n\t */\n\tprivate renderAspectGrid(planets: PlanetEntry[], aspects: AspectEntry[]) {\n\t\t// Both values per body, deliberately: `name` is the English one the pairing\n\t\t// and the glyph table are keyed on, `label` is the one a reader sees. The\n\t\t// label is rendered verbatim, never through `capitalize`, which lowercases\n\t\t// the rest of the string and made a tooltip read \"North node\"; the pairing\n\t\t// folds through `lookupKey`, the same normalizer the glyph table uses.\n\t\tconst bodies = planets.map((p) => ({\n\t\t\tname: p.name,\n\t\t\tlabel: display(p, 'name'),\n\t\t}));\n\t\tconst pairKey = (a: string, b: string) =>\n\t\t\t[lookupKey(a), lookupKey(b)].sort().join('|');\n\t\tconst byPair = new Map<string, AspectEntry>();\n\t\tfor (const a of aspects) byPair.set(pairKey(a.planet1, a.planet2), a);\n\t\tif (bodies.length === 0)\n\t\t\treturn html`<p class=\"roxy-empty\" role=\"status\">${this.t('No planets to grid')}</p>`;\n\n\t\treturn html`<div class=\"grid-scroll\" part=\"table aspect-grid\"><table class=\"aspect-grid\"><caption class=\"roxy-sr-only\">${this.t('Planet by planet aspect grid: the aspect each pair of planets forms, read from the planet naming the row across to the planet naming the column.')}</caption><thead><tr><th></th>${bodies.slice(0, -1).map((b) => {\n\t\t\t\t\t\t\tconst g = planetGlyph(b.name) ?? b.label;\n\t\t\t\t\t\t\treturn html`<th scope=\"col\" title=\"${b.label}\">${g}</th>`;\n\t\t\t\t\t\t})}</tr></thead><tbody>${bodies.slice(1).map((row, ri) => {\n\t\t\t\t\t\tconst rowGlyph = planetGlyph(row.name) ?? row.label;\n\t\t\t\t\t\t// Row i (1-based) pairs with columns 0..i-1.\n\t\t\t\t\t\treturn html`<tr><th scope=\"row\" title=\"${row.label}\">${rowGlyph}</th>${bodies.slice(0, ri + 1).map((col) => {\n\t\t\t\t\t\t\t\tconst a = byPair.get(pairKey(row.name, col.name));\n\t\t\t\t\t\t\t\tif (!a) return html`<td class=\"empty\"></td>`;\n\t\t\t\t\t\t\t\tconst name = normalizeAspect(a);\n\t\t\t\t\t\t\t\t// Every aspect the API returns has a glyph, and a miss falls\n\t\t\t\t\t\t\t\t// back to the full aspect NAME. Never to initials or a slice:\n\t\t\t\t\t\t\t\t// an invented two-letter code in a one-glyph cell reads as a\n\t\t\t\t\t\t\t\t// deliberate abbreviation, which is how `sesquiquadrate`\n\t\t\t\t\t\t\t\t// once shipped rendering as the literal text `ses`.\n\t\t\t\t\t\t\t\tconst sym =\n\t\t\t\t\t\t\t\t\taspectSymbol(name) ?? display(a, 'type', formatAspectName(a));\n\t\t\t\t\t\t\t\tconst cls = ASPECT_CLASS[name] ?? 'aspect-other';\n\t\t\t\t\t\t\t\tconst orb = formatNumber(a.orb, 1);\n\t\t\t\t\t\t\t\treturn html`<td class=\"${`cell ${cls}`}\" title=\"${`${row.label} ${display(a, 'type', name)} ${col.label}${orb ? ` (${this.t('orb')} ${orb}\u00B0)` : ''}`}\"><span class=\"asp\">${sym}</span></td>`;\n\t\t\t\t\t\t\t})} ${bodies.slice(ri + 1, -1).map(() => html`<td class=\"empty\"></td>`)}</tr>`;\n\t\t\t\t\t})}</tbody></table></div>`;\n\t}\n\n\tprivate renderAngles() {\n\t\tconst asc = this.getAscendant();\n\t\tconst mc = this.getMidheaven();\n\t\t// ASC/DESC and MC/IC are exact axes; DESC and IC are the opposite points.\n\t\tconst items = [\n\t\t\tthis.renderAngleMark(asc, 'ASC'),\n\t\t\tthis.renderAngleMark(oppositePoint(asc), 'DSC'),\n\t\t];\n\t\tif (mc !== null) {\n\t\t\titems.push(this.renderAngleMark(mc, 'MC'));\n\t\t\titems.push(this.renderAngleMark(oppositePoint(mc), 'IC'));\n\t\t}\n\t\tconst pof = this.data?.partOfFortune?.longitude;\n\t\tif (typeof pof === 'number') {\n\t\t\titems.push(this.renderAngleMark(normalizeLongitude(pof), 'PoF'));\n\t\t}\n\t\tconst vertex = this.data?.vertex?.longitude;\n\t\tif (typeof vertex === 'number') {\n\t\t\titems.push(this.renderAngleMark(normalizeLongitude(vertex), 'Vtx'));\n\t\t}\n\t\treturn items;\n\t}\n\n\tprivate renderAngleMark(longitude: number, label: string) {\n\t\t// Tick AND label share the same angle so the label sits right at the\n\t\t// tip of the arrow, where a practitioner expects to find it. The label\n\t\t// halo at radius ANGLE_LABEL_R is clear of the wheel rim, so there is\n\t\t// no overlap with house dividers despite the shared angle.\n\t\tconst angle = this.toAngle(longitude);\n\t\tconst tickInner = polarToCartesian(CENTER, CENTER, OUTER_R, angle);\n\t\tconst tickOuter = polarToCartesian(CENTER, CENTER, ANGLE_TICK_R, angle);\n\t\tconst labelPos = polarToCartesian(CENTER, CENTER, ANGLE_LABEL_R, angle);\n\t\treturn svg`\n\t\t\t<g>\n\t\t\t\t<line class=\"angle-tick\" x1=${tickInner.x} y1=${tickInner.y} x2=${tickOuter.x} y2=${tickOuter.y} />\n\t\t\t\t<text class=\"angle-marker\" x=${labelPos.x} y=${labelPos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${label}</text>\n\t\t\t</g>\n\t\t`;\n\t}\n\n\tprivate renderSpokes() {\n\t\t// Draw a spoke at each real house cusp longitude so Placidus / Koch\n\t\t// unequal houses render correctly. Fall back to 12 equal spokes from the\n\t\t// Ascendant only when the response carries no houses array, which the\n\t\t// accessible name and the legend caveat both declare.\n\t\tconst houses = this.data?.houses ?? [];\n\t\tconst cuspLongitudes = this.hasCusps\n\t\t\t? houses.map((h) => h.longitude)\n\t\t\t: Array.from({ length: 12 }, (_, i) => this.getAscendant() + i * 30);\n\t\treturn cuspLongitudes.map((lon) => {\n\t\t\tconst angle = this.toAngle(lon);\n\t\t\tconst start = polarToCartesian(CENTER, CENTER, HOUSE_R, angle);\n\t\t\tconst end = polarToCartesian(CENTER, CENTER, OUTER_R, angle);\n\t\t\treturn svg`<line class=\"wheel-line\" x1=${start.x} y1=${start.y} x2=${end.x} y2=${end.y} stroke-width=\"0.8\" />`;\n\t\t});\n\t}\n\n\tprivate renderSigns() {\n\t\treturn SIGNS_ORDER.map((sign, i) => {\n\t\t\tconst angle = this.toAngle(i * 30 + 15);\n\t\t\tconst pos = polarToCartesian(CENTER, CENTER, SIGN_R, angle);\n\t\t\treturn svg`<text class=\"sign-glyph\" x=${pos.x} y=${pos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${signGlyph(sign) ?? ''}</text>`;\n\t\t});\n\t}\n\n\tprivate renderHouseNumbers() {\n\t\tconst houses = this.data?.houses ?? [];\n\t\t// Place each house number at the angular midpoint between its cusp and\n\t\t// the next, so the label sits inside the house even when houses are\n\t\t// unequal. Fall back to equal 30-degree sectors when houses are absent.\n\t\tif (this.hasCusps) {\n\t\t\treturn houses.map((house, i) => {\n\t\t\t\tconst next = houses[(i + 1) % 12];\n\t\t\t\tconst mid = arcMidpoint(\n\t\t\t\t\thouse.longitude,\n\t\t\t\t\tnext ? next.longitude : house.longitude + 30,\n\t\t\t\t);\n\t\t\t\tconst pos = polarToCartesian(\n\t\t\t\t\tCENTER,\n\t\t\t\t\tCENTER,\n\t\t\t\t\tHOUSE_R - 12,\n\t\t\t\t\tthis.toAngle(mid),\n\t\t\t\t);\n\t\t\t\treturn svg`<text class=\"house-num\" x=${pos.x} y=${pos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${house.number}</text>`;\n\t\t\t});\n\t\t}\n\t\tconst ascSignIndex = Math.floor(this.getAscendant() / 30);\n\t\treturn Array.from({ length: 12 }, (_, i) => {\n\t\t\tconst angle = this.toAngle(i * 30 + 15);\n\t\t\tconst pos = polarToCartesian(CENTER, CENTER, HOUSE_R - 12, angle);\n\t\t\tconst houseNum = ((i - ascSignIndex + 12) % 12) + 1;\n\t\t\treturn svg`<text class=\"house-num\" x=${pos.x} y=${pos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${houseNum}</text>`;\n\t\t});\n\t}\n\n\t/**\n\t * Degree ticks on the outer zodiac band: a short mark every 5 degrees and a\n\t * longer one on each 30-degree sign cusp, so the wheel reads like a\n\t * reference-grade chart rather than a bare ring of glyphs.\n\t */\n\tprivate renderTicks() {\n\t\tconst ticks = [];\n\t\tfor (let deg = 0; deg < 360; deg += 5) {\n\t\t\tconst angle = this.toAngle(deg);\n\t\t\tconst isMajor = deg % 30 === 0;\n\t\t\tconst inner = isMajor ? SIGN_R - 14 : OUTER_R - 5;\n\t\t\tconst a = polarToCartesian(CENTER, CENTER, inner, angle);\n\t\t\tconst b = polarToCartesian(CENTER, CENTER, OUTER_R, angle);\n\t\t\tticks.push(\n\t\t\t\tsvg`<line class=${isMajor ? 'tick tick-major' : 'tick'} x1=${a.x} y1=${a.y} x2=${b.x} y2=${b.y} stroke-width=${isMajor ? 1 : 0.5} />`,\n\t\t\t);\n\t\t}\n\t\treturn ticks;\n\t}\n\n\t/**\n\t * Degree-and-minute label printed next to each house cusp on the wheel, so\n\t * the exact cusp position is readable without leaving the chart.\n\t */\n\tprivate renderCuspDegrees() {\n\t\tconst houses = this.data?.houses ?? [];\n\t\tif (!this.hasCusps) return nothing;\n\t\treturn houses.map((house) => {\n\t\t\tconst angle = this.toAngle(house.longitude);\n\t\t\tconst pos = polarToCartesian(CENTER, CENTER, HOUSE_R + 9, angle);\n\t\t\tconst sp = longitudeToSignPosition(house.longitude);\n\t\t\treturn svg`<text class=\"cusp-deg\" x=${pos.x} y=${pos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${sp.degree}\u00B0${String(sp.minute).padStart(2, '0')}'</text>`;\n\t\t});\n\t}\n\n\tprivate renderPlanets(planets: PlanetEntry[]) {\n\t\t// Stellium-aware angular fan-out. Conjunctions within 8\u00B0 are the norm\n\t\t// in professional natal charts (Sun-Mercury-Venus cluster, outer-planet\n\t\t// stacks). To keep every glyph legible without losing precision, sort\n\t\t// by longitude and push later members forward in angle until they\n\t\t// clear a minimum separation, then draw a thin leader line from each\n\t\t// displaced glyph back to the planet's true position on the outer\n\t\t// rim. Conventional approach used by professional Western natal\n\t\t// software; preserves both readability and astronomical accuracy.\n\t\tconst MIN_SEPARATION = 7;\n\t\ttype Placed = {\n\t\t\tp: PlanetEntry;\n\t\t\ttrueLon: number;\n\t\t\tdisplayLon: number;\n\t\t};\n\t\tconst sorted: Placed[] = planets\n\t\t\t.filter((p) => Number.isFinite(p.longitude))\n\t\t\t.map((p) => ({\n\t\t\t\tp,\n\t\t\t\ttrueLon: normalizeLongitude(p.longitude),\n\t\t\t\tdisplayLon: normalizeLongitude(p.longitude),\n\t\t\t}))\n\t\t\t.sort((a, b) => a.trueLon - b.trueLon);\n\t\t// Forward sweep: clamp each to at least prev + MIN_SEPARATION.\n\t\tfor (let i = 1; i < sorted.length; i++) {\n\t\t\tconst prev = sorted[i - 1];\n\t\t\tconst cur = sorted[i];\n\t\t\tif (!prev || !cur) continue;\n\t\t\tconst wanted = prev.displayLon + MIN_SEPARATION;\n\t\t\tif (cur.displayLon < wanted) cur.displayLon = wanted;\n\t\t}\n\t\t// If the cluster overshot 360\u00B0, slide everything back equally so the\n\t\t// stack stays anchored near the original longitudes.\n\t\tconst last = sorted[sorted.length - 1];\n\t\tif (last && last.displayLon > 360) {\n\t\t\tconst shift = last.displayLon - 360;\n\t\t\tfor (const s of sorted) s.displayLon -= shift;\n\t\t}\n\t\treturn sorted.map(({ p, trueLon, displayLon }) => {\n\t\t\tconst trueAngle = this.toAngle(trueLon);\n\t\t\tconst displayAngle = this.toAngle(displayLon);\n\t\t\tconst glyphPos = polarToCartesian(CENTER, CENTER, PLANET_R, displayAngle);\n\t\t\tconst degPos = polarToCartesian(\n\t\t\t\tCENTER,\n\t\t\t\tCENTER,\n\t\t\t\tPLANET_R - 13,\n\t\t\t\tdisplayAngle,\n\t\t\t);\n\t\t\tconst rimPos = polarToCartesian(CENTER, CENTER, OUTER_R - 4, trueAngle);\n\t\t\tconst leaderInner = polarToCartesian(\n\t\t\t\tCENTER,\n\t\t\t\tCENTER,\n\t\t\t\tPLANET_R + 8,\n\t\t\t\tdisplayAngle,\n\t\t\t);\n\t\t\t// The glyph is looked up on the canonical English name and its fallback is\n\t\t\t// the localized one, because the fallback is TEXT the reader is left with.\n\t\t\tconst label = display(p, 'name');\n\t\t\tconst glyph = planetGlyph(p.name) ?? label;\n\t\t\tconst sp = longitudeToSignPosition(p.longitude);\n\t\t\tconst retro = p.isRetrograde === true;\n\t\t\tconst degLabel = `${sp.degree}\u00B0${String(sp.minute).padStart(2, '0')}'`;\n\t\t\tconst offset = Math.abs(displayLon - trueLon) > 0.5;\n\t\t\treturn svg`<g>\n\t\t\t\t${\n\t\t\t\t\toffset\n\t\t\t\t\t\t? svg`<line class=\"planet-leader\" x1=${rimPos.x} y1=${rimPos.y} x2=${leaderInner.x} y2=${leaderInner.y} />`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}\n\t\t\t\t<text class=\"planet-glyph\" x=${glyphPos.x} y=${glyphPos.y} text-anchor=\"middle\" dominant-baseline=\"central\"><title>${label}${retro ? ` ${this.t('retrograde')}` : ''} - ${degLabel} ${display(p, 'sign')}</title>${glyph}</text>\n\t\t\t\t<text class=\"planet-deg\" x=${degPos.x} y=${degPos.y} text-anchor=\"middle\" dominant-baseline=\"central\">${degLabel}${retro ? svg`<tspan class=\"retro\"> \u211E</tspan>` : nothing}</text>\n\t\t\t</g>`;\n\t\t});\n\t}\n\n\tprivate renderDetails() {\n\t\tconst summary = this.data?.summary;\n\t\tconst ai = this.data?.aspectsInterpretation;\n\t\tif (!summary && !ai) return nothing;\n\n\t\t// Pairs, not names: the glyph beside each retrograde body is looked up on the\n\t\t// English value while the pill prints the localized one, and the two arrays\n\t\t// the API returns are index-aligned, which is what makes that possible.\n\t\tconst retrogrades = displayList(summary, 'retrogradePlanets');\n\n\t\treturn html`<div class=\"details\" part=\"details\">${\n\t\t\t\tsummary?.dominantElement || summary?.dominantModality\n\t\t\t\t\t? html`<div class=\"pill-row\">${summary.dominantElement ? html`<span class=\"pill\">${this.t('Dominant element')}: ${display(summary, 'dominantElement')}</span>` : nothing} ${summary.dominantModality ? html`<span class=\"pill\">${this.t('Dominant modality')}: ${display(summary, 'dominantModality')}</span>` : nothing}</div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tai\n\t\t\t\t\t? html`<div class=\"pill-row\"><span class=\"pill pill--success\">${this.t('Harmonious')} ${ai.harmonious}</span> <span class=\"pill pill--danger\">${this.t('Challenging')} ${ai.challenging}</span> <span class=\"pill pill--muted\">${this.t('Neutral')} ${ai.neutral}</span></div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\tretrogrades.length > 0\n\t\t\t\t\t? html`<div class=\"pill-row\">${retrogrades.map(({ value, label }) => {\n\t\t\t\t\t\t\t// `?? ''` and never a slice: the full name is printed right\n\t\t\t\t\t\t\t// beside the glyph, so a miss must drop the glyph, not invent\n\t\t\t\t\t\t\t// one. This is the site that shipped `No North Node R`,\n\t\t\t\t\t\t\t// `So South Node R` and `Bl Black Moon Lilith` to a customer.\n\t\t\t\t\t\t\tconst glyph = planetGlyph(value) ?? '';\n\t\t\t\t\t\t\treturn html`<span class=\"pill pill--muted\">${glyph} ${label} R</span>`;\n\t\t\t\t\t\t})}</div>`\n\t\t\t\t\t: nothing\n\t\t\t} ${\n\t\t\t\t// Prose about the aspect balance, not the balance itself: the counts\n\t\t\t\t// above it are the data and stay.\n\t\t\t\tai?.summary && !this.hideReadings\n\t\t\t\t\t? html`<p class=\"summary\">${ai.summary}</p>`\n\t\t\t\t\t: nothing\n\t\t\t} ${this.renderElementModalityGrid()}</div>`;\n\t}\n\n\t/**\n\t * Element by modality grid: the 4x3 cross-tab astrologers read for chart balance. Each body is placed by its sign into one cell (Fire/Earth/Air/Water row, Cardinal/Fixed/Mutable column).\n\t *\n\t * @remarks\n\t * The cells are derived from the planet signs, not read from `summary.elementDistribution`, because a 1D distribution cannot fill a cross-tab. That makes the body set the reconciliation risk: the API counts every body it returns (nodes, Chiron, and Black Moon Lilith included), so the grid must too, or the totals here would contradict the dominant-element pill rendered right above it. Hence the totals count placed bodies rather than `planets.length` (an unrecognized sign would otherwise inflate the grand total past the sum of its rows), the caption names the body set, and the dominant row and column are tinted from `summary` so the pill and the grid land on the same cell.\n\t *\n\t * **The seven headers are CHROME, not response vocabulary, and that is what licenses translating them.** The axes are the component's own 4x3 construction, so six of the seven have no field in the response to defer to and the seventh (the dominant pair) would otherwise have been the only translated word in the table. They therefore go through the chrome catalogue like every other heading here, and each catalogue value is pinned to what the API returns for `dominantElementLocalized` / `dominantModalityLocalized` so the tinted pill above the grid and the header on its row cannot read two different words for one element. Verified live on 2026-08-09 against `/astrology/natal-chart?lang=` in all seven languages; `tests/i18n.test.ts` re-asserts the agreement on a render.\n\t *\n\t * **The English arrays stay, because they are the CELL KEYS.** `SIGNS_ORDER.indexOf` resolves each sign to an index and the modulo picks the bucket, so the array values are compared and keyed on, never read (lesson 31). Only the header text nodes move.\n\t */\n\tprivate renderElementModalityGrid() {\n\t\tconst planets = this.getPlanets();\n\t\tif (planets.length === 0) return nothing;\n\t\tconst ELEMENTS = ['Fire', 'Earth', 'Air', 'Water'] as const;\n\t\tconst MODALITIES = ['Cardinal', 'Fixed', 'Mutable'] as const;\n\t\t// Header text, keyed by the canonical bucket name. Written out as literal\n\t\t// `t()` calls rather than `this.t(el)` so the static scan in\n\t\t// `tests/i18n.test.ts` can see every one of them: a dynamic key is exactly\n\t\t// the shape that ships a string no catalogue carries.\n\t\tconst ELEMENT_LABEL: Record<string, string> = {\n\t\t\tFire: this.t('Fire'),\n\t\t\tEarth: this.t('Earth'),\n\t\t\tAir: this.t('Air'),\n\t\t\tWater: this.t('Water'),\n\t\t};\n\t\t// The column is three glyphs wide, so it shows an abbreviation the\n\t\t// CATALOGUE supplies and carries the full word as its `title`. Never a\n\t\t// substring of the translated word: `slice(0, 3)` counts UTF-16 units with\n\t\t// no idea where the word ends, so Spanish read `Fij` and Devanagari split a\n\t\t// matra off its consonant. `tokens.test.ts` fails on any small slice now.\n\t\tconst MODALITY_LABEL: Record<string, { abbr: string; full: string }> = {\n\t\t\tCardinal: { abbr: this.t('Car'), full: this.t('Cardinal') },\n\t\t\tFixed: { abbr: this.t('Fix'), full: this.t('Fixed') },\n\t\t\tMutable: { abbr: this.t('Mut'), full: this.t('Mutable') },\n\t\t};\n\t\tconst order = SIGNS_ORDER as readonly string[];\n\t\tconst summary = this.data?.summary;\n\t\t// English on both sides, on purpose. These three are lookups, not labels:\n\t\t// the dominant pair is COMPARED against the local element and modality\n\t\t// arrays and each sign is resolved to its index in SIGNS_ORDER, so reading\n\t\t// `dominantElementLocalized` or `signLocalized` here would match nothing on\n\t\t// a translated page and everything on an English one.\n\t\tconst dominantEl = capitalize(summary?.dominantElement ?? '');\n\t\tconst dominantMod = capitalize(summary?.dominantModality ?? '');\n\n\t\tconst cells: Record<string, Record<string, string[]>> = {};\n\t\tfor (const el of ELEMENTS)\n\t\t\tcells[el] = { Cardinal: [], Fixed: [], Mutable: [] };\n\t\tlet placed = 0;\n\t\tfor (const p of planets) {\n\t\t\tconst idx = order.indexOf(capitalize(p.sign ?? ''));\n\t\t\tif (idx < 0) continue;\n\t\t\tconst el = ELEMENTS[idx % 4];\n\t\t\tconst mod = MODALITIES[idx % 3];\n\t\t\t// The cell shows the glyph alone, so a miss falls back to the full name:\n\t\t\t// wide and obviously wrong, rather than a plausible two-letter code.\n\t\t\tconst glyph = planetGlyph(p.name) ?? display(p, 'name');\n\t\t\tcells[el]?.[mod]?.push(glyph);\n\t\t\tplaced++;\n\t\t}\n\t\tif (placed === 0) return nothing;\n\n\t\tconst colTotal = (m: string) =>\n\t\t\tELEMENTS.reduce((s, el) => s + (cells[el]?.[m]?.length ?? 0), 0);\n\n\t\t// Same scroll box as the aspect grid beside it. A cell holds a joined list\n\t\t// of glyphs, so it is normally tiny, but a body with no glyph renders its\n\t\t// FULL name there by design, and the table has to carry that without\n\t\t// dragging the card out with it. `.grid-scroll` pairs `overflow-x: auto`\n\t\t// with `min-width: 0`, and it is the `min-width` half that actually lets a\n\t\t// grid item scroll instead of growing to fit.\n\t\treturn html`<div class=\"grid-scroll\"><table class=\"em-grid\" part=\"table element-modality\" aria-label=\"${this.t('Element and modality distribution')}\"><caption>${this.t('All {{count}} bodies in the chart, placed by sign', { count: placed })}</caption><thead><tr><th></th>${MODALITIES.map(\n\t\t\t\t\t\t(m) =>\n\t\t\t\t\t\t\thtml`<th scope=\"col\" title=\"${MODALITY_LABEL[m]?.full ?? m}\" class=\"${m === dominantMod ? 'dominant' : ''}\">${MODALITY_LABEL[m]?.abbr ?? m}</th>`,\n\t\t\t\t\t)}<th scope=\"col\">${this.t('Total')}</th></tr></thead><tbody>${ELEMENTS.map((el) => {\n\t\t\t\t\tconst isDomRow = el === dominantEl;\n\t\t\t\t\tconst rowTotal = MODALITIES.reduce(\n\t\t\t\t\t\t(s, m) => s + (cells[el]?.[m]?.length ?? 0),\n\t\t\t\t\t\t0,\n\t\t\t\t\t);\n\t\t\t\t\treturn html`<tr><th scope=\"row\" class=\"${isDomRow ? 'dominant' : ''}\">${ELEMENT_LABEL[el] ?? el}</th>${MODALITIES.map(\n\t\t\t\t\t\t\t(m) =>\n\t\t\t\t\t\t\t\thtml`<td class=\"${isDomRow || m === dominantMod ? 'dominant' : ''}\">${(cells[el]?.[m] ?? []).join(' ')}</td>`,\n\t\t\t\t\t\t)}<td class=\"${isDomRow ? 'em-total dominant' : 'em-total'}\">${rowTotal}</td></tr>`;\n\t\t\t\t})}<tr><th scope=\"row\">${this.t('Total')}</th>${MODALITIES.map(\n\t\t\t\t\t\t(m) =>\n\t\t\t\t\t\t\thtml`<td class=\"${m === dominantMod ? 'em-total dominant' : 'em-total'}\">${colTotal(m)}</td>`,\n\t\t\t\t\t)}<td class=\"em-total\">${placed}</td></tr></tbody></table></div>`;\n\t}\n\n\t/**\n\t * Detected multi-planet configurations. Each card names the figure, tags the element or modality it pivots on, flags a dissociate (out-of-sign) figure, and puts the apex planet first with its own chip, because the apex is the point the whole configuration discharges through.\n\t *\n\t * @remarks\n\t * A pattern carries no localized partner for its `name`, `element`, `modality` or its `planets` list, so all four render English on every page. Do NOT translate the chips by looking each body up in `planets[].nameLocalized`: the response is the authority for its own vocabulary, and a second translation of the same fact assembled here is exactly what can end up disagreeing with the wheel beside it.\n\t *\n\t * **This block is DATA, so `hide-readings` thins it rather than removing it, and that split is deliberate.** A T-Square is a geometric fact about where the bodies sit, exactly like the aspect rows and the house cusps: the figure, its element and modality, its tightness and its planets are all measurements, and the only reading in the card is the paragraph, which {@link RoxyNatalChart.renderPattern} already drops. The line is the one the library states everywhere else and the one the docs promise: \"wheels, maps, tables, grids, legends, badges and every number stay, the interpretive prose goes\". `<roxy-aspects-table>` renders this identical `patterns` payload and makes the identical cut, so gating the whole block here would make the same figure appear and disappear depending on which component a page reached for.\n\t *\n\t * **A page that wants the block gone entirely has a lever, and it is not this flag.** The section carries `part=\"section patterns\"`, so `roxy-natal-chart::part(patterns) { display: none }` removes it. That is the documented answer for dropping a block of DATA, the same way `::part(readings)` styles the interpretation; `hide-readings` is the answer for prose, and stretching it to cover measurements would leave a practitioner with no way to publish the figures without the words.\n\t */\n\tprivate renderPatterns() {\n\t\tconst patterns = this.data?.patterns ?? [];\n\t\tif (patterns.length === 0) return nothing;\n\t\tconst sorted = [...patterns].sort(\n\t\t\t(a, b) =>\n\t\t\t\t(PATTERN_ORDER[a.kind] ?? 9) - (PATTERN_ORDER[b.kind] ?? 9) ||\n\t\t\t\t(b.tightness ?? 0) - (a.tightness ?? 0),\n\t\t);\n\t\treturn html`<section class=\"block\" part=\"section patterns\"><h3>${this.t('Chart patterns')}</h3>${sorted.map((p) => this.renderPattern(p))}</section>`;\n\t}\n\n\tprivate renderPattern(p: PatternEntry) {\n\t\tconst planets = p.planets ?? [];\n\t\t// Apex first: the spec already orders it first for Kite, T-Square, and Yod,\n\t\t// but sorting here keeps the chip row honest for any future pattern kind.\n\t\tconst ordered = p.apex\n\t\t\t? [...planets].sort((a, b) => Number(b === p.apex) - Number(a === p.apex))\n\t\t\t: planets;\n\t\treturn html`<div class=\"pattern\" part=\"pattern\"><div class=\"pattern-head\"><span class=\"pattern-name\">${p.name}</span> ${p.element ? html`<span class=\"pattern-tag\">${p.element}</span>` : nothing} ${p.modality ? html`<span class=\"pattern-tag\">${p.modality}</span>` : nothing} ${\n\t\t\t\t\tp.dissociate\n\t\t\t\t\t\t? html`<span class=\"pattern-tag\" title=\"${this.t('Out of sign: one or more planets sit outside the pattern element or modality, so the theme holds but runs weaker.')}\">${this.t('Dissociate')}</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t} ${\n\t\t\t\t\t// Math.round, not formatNumber(x, 0): that helper strips trailing\n\t\t\t\t\t// zeros, so a 100% tight pattern renders as \"1%\".\n\t\t\t\t\ttypeof p.tightness === 'number'\n\t\t\t\t\t\t? html`<span class=\"pattern-tight\">${this.t('{{percent}}% tight', { percent: Math.round(p.tightness) })}</span>`\n\t\t\t\t\t\t: nothing\n\t\t\t\t}</div><div class=\"pattern-planets\">${ordered.map((name) => {\n\t\t\t\t\tconst glyph = planetGlyph(name);\n\t\t\t\t\tconst isApex = Boolean(p.apex) && name === p.apex;\n\t\t\t\t\treturn html`<span class=\"${isApex ? 'planet-chip apex' : 'planet-chip'}\">${glyph ? html`<span aria-hidden=\"true\">${glyph}</span>` : nothing}${name}${isApex ? html`<span class=\"apex-tag\">${this.t('apex')}</span>` : nothing}</span>`;\n\t\t\t\t})}</div>${\n\t\t\t\t// The figure, its planets and its tightness are the finding; the\n\t\t\t\t// paragraph is the reading of it.\n\t\t\t\tp.interpretation && !this.hideReadings\n\t\t\t\t\t? html`<p class=\"pattern-interp\">${p.interpretation}</p>`\n\t\t\t\t\t: nothing\n\t\t\t}</div>`;\n\t}\n\n\tprivate renderInterpretations() {\n\t\tconst sections: InterpSection[] = this.getPlanets()\n\t\t\t.filter((p) => p.interpretation)\n\t\t\t.map((p) => {\n\t\t\t\tconst interp = p.interpretation!;\n\t\t\t\tconst glyph = planetGlyph(p.name) ?? '';\n\t\t\t\tconst deg = formatNumber(p.degree ?? 0, 1);\n\t\t\t\tconst label = display(p, 'name');\n\t\t\t\tconst lead = interp.summary || interp.detailed || '';\n\t\t\t\t// `detailed` only becomes a second paragraph when `summary` already\n\t\t\t\t// took the lead line, so a response carrying one or the other never\n\t\t\t\t// prints the same prose twice.\n\t\t\t\tconst detail = interp.summary ? interp.detailed : undefined;\n\t\t\t\treturn {\n\t\t\t\t\tlabel: `${glyph} ${label}`.trim(),\n\t\t\t\t\taside: [display(p, 'sign'), deg].filter(Boolean).join(' '),\n\t\t\t\t\tbody: lead,\n\t\t\t\t\textra: html`${detail ? html`<p>${detail}</p>` : nothing} ${\n\t\t\t\t\t\tinterp.keywords?.length\n\t\t\t\t\t\t\t? html`<div class=\"interp-keywords\">${interp.keywords.map((k) => html`<span class=\"kw\">${k}</span>`)}</div>`\n\t\t\t\t\t\t\t: nothing\n\t\t\t\t\t}`,\n\t\t\t\t};\n\t\t\t});\n\t\treturn this.renderInterpretation(\n\t\t\tsections,\n\t\t\t'natal-planet-readings',\n\t\t\tthis.t('Planet readings'),\n\t\t);\n\t}\n\n\tprivate renderAspects(planets: PlanetEntry[], aspects: AspectEntry[]) {\n\t\t// Keyed on the canonical English name at BOTH ends, because this map is how\n\t\t// an aspect finds the two longitudes its line is drawn between. The localized\n\t\t// names go in the `<title>` and nowhere near the key.\n\t\tconst planetMap = new Map<string, number>();\n\t\tfor (const p of planets) {\n\t\t\tif (typeof p.longitude !== 'number') continue;\n\t\t\tconst name = lookupKey(p.name);\n\t\t\tif (name) planetMap.set(name, p.longitude);\n\t\t}\n\t\treturn aspects.map((a) => {\n\t\t\tconst l1 = planetMap.get(lookupKey(a.planet1));\n\t\t\tconst l2 = planetMap.get(lookupKey(a.planet2));\n\t\t\tif (l1 === undefined || l2 === undefined) return nothing;\n\t\t\tconst p1 = polarToCartesian(\n\t\t\t\tCENTER,\n\t\t\t\tCENTER,\n\t\t\t\tPLANET_R - 18,\n\t\t\t\tthis.toAngle(l1),\n\t\t\t);\n\t\t\tconst p2 = polarToCartesian(\n\t\t\t\tCENTER,\n\t\t\t\tCENTER,\n\t\t\t\tPLANET_R - 18,\n\t\t\t\tthis.toAngle(l2),\n\t\t\t);\n\t\t\tconst aspectName = normalizeAspect(a);\n\t\t\tconst aspectClass = ASPECT_CLASS[aspectName] ?? 'aspect-other';\n\t\t\tconst orbLabel = formatNumber(a.orb, 1);\n\t\t\treturn svg`<line class=${`aspect ${aspectClass}`} x1=${p1.x} y1=${p1.y} x2=${p2.x} y2=${p2.y}><title>${display(a, 'planet1')} ${display(a, 'type', aspectName)} ${display(a, 'planet2')}${orbLabel ? ` (${this.t('orb')} ${orbLabel}\u00B0)` : ''}</title></line>`;\n\t\t});\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-natal-chart': RoxyNatalChart;\n\t}\n}\n", "/**\n * Shared string helpers used across components. Single source of truth so the\n * same formatting rules apply to every key/label/title that surfaces in the\n * shadow tree.\n *\n * - `lookupKey`: the ONE normalizer every lookup table in this library is keyed\n * and read by (`tokens/index.ts` glyphs and abbreviations, `i18n/` chrome\n * strings).\n * - `capitalize`: title-cases the first character, lowercases the rest. A\n * DISPLAY helper only; it is not a lookup key (see `lookupKey`).\n * - `humanize`: turns an API key (`birth_date`, `birthDate`, `mahadasha-end`)\n * into a label suitable for display (\"Birth date\", \"Mahadasha end\").\n */\n\n/**\n * Fold a name to the canonical key its lookup table is stored under: lower case, every run of spaces, underscores and hyphens collapsed to one space, trimmed.\n *\n * @remarks\n * This exists because a GUESSED key spelling is a defect class this repo has now shipped twice. The glyph tables were keyed off whatever {@link capitalize} happened to produce (`North node`), while the API returns `North Node`, so every call site that reached the table without first calling `capitalize` missed and fell through to a fabricated abbreviation. Aspects hit the same wall from the other side: `/aspects` returns `SEMI SEXTILE` where synastry returns `SEMI_SEXTILE`.\n *\n * One normalizer, applied when a table is DEFINED and again when it is READ, removes the whole class: no call site has to remember a convention, and no table has to guess a spelling. Use it for every new table keyed by an API-supplied name.\n *\n * @example\n * ```ts\n * lookupKey('North Node'); // 'north node'\n * lookupKey('SEMI_SEXTILE'); // 'semi sextile'\n * lookupKey('semi-sextile'); // 'semi sextile'\n * ```\n */\nexport function lookupKey(s: string): string {\n\treturn s\n\t\t.toLowerCase()\n\t\t.replace(/[\\s_-]+/g, ' ')\n\t\t.trim();\n}\n\nexport function capitalize(s: string): string {\n\tif (!s) return '';\n\treturn s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n}\n\nexport function humanize(s: string): string {\n\treturn (\n\t\ts\n\t\t\t.replace(/[_-]+/g, ' ')\n\t\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t\t// Split a trailing/embedded digit off a word so \"person1\" reads \"Person 1\"\n\t\t\t// and every group legend and field label spaces its ordinal.\n\t\t\t.replace(/([a-z])([0-9])/g, '$1 $2')\n\t\t\t.replace(/^\\w/, (c) => c.toUpperCase())\n\t);\n}\n", "/**\n * Symbol constants used across components. Single source of truth so chart\n * wheels, card headers, hexagram displays, and panchang tables stay visually\n * consistent.\n *\n * @remarks\n * **Every table here is keyed by {@link lookupKey} and read ONLY through the accessor beside it.** The raw records are deliberately not exported: a component that indexes a record directly has to guess the key convention, and a guessed spelling is what shipped `No North Node R`, `So South Node R` and `Bl Black Moon Lilith` into a live customer's natal chart. The API returns `North Node` with a space; the table was keyed `North node`, the spelling {@link capitalize} happens to produce, so every call site that forgot to call `capitalize` first missed the table.\n *\n * **A miss returns `undefined`, never a manufactured abbreviation.** The old `?? name.slice(0, 2)` fallback is what made the defect survive review: a failed lookup renders as a plausible two-letter code that reads exactly like an intentional abbreviation, so nothing about the output says \"this is broken\". A caller that can omit the glyph should omit it (`?? ''`); a caller that must show something falls back to the FULL name, which is visibly wrong at the size these slots are drawn.\n *\n * `tests/tokens.test.ts` resolves every body, sign and aspect name the committed spec can emit against these tables, so a vocabulary the API gains cannot ship unglyphed.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Look one name up in a normalized table. The single read path for every map in this file. */\nconst resolve = (\n\ttable: Record<string, string>,\n\tname: string | undefined | null,\n): string | undefined => (name ? table[lookupKey(name)] : undefined);\n\nconst PLANET_GLYPH: Record<string, string> = {\n\tsun: '\u2609',\n\tmoon: '\u263D',\n\tmercury: '\u263F',\n\tvenus: '\u2640',\n\tearth: '\u2641',\n\tmars: '\u2642',\n\tjupiter: '\u2643',\n\tsaturn: '\u2644',\n\turanus: '\u2645',\n\tneptune: '\u2646',\n\tpluto: '\u2647',\n\trahu: '\u260A',\n\tketu: '\u260B',\n\tascendant: 'Asc',\n\tlagna: 'La',\n\t'north node': '\u260A',\n\t'south node': '\u260B',\n\tchiron: '\u26B7',\n\tlilith: '\u26B8',\n\t'black moon lilith': '\u26B8',\n};\n\n/** Astrological glyph for a planet or point, or `undefined` when the library has none for it. */\nexport const planetGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_GLYPH, name);\n\nconst PLANET_ABBR: Record<string, string> = {\n\tsun: 'Su',\n\tmoon: 'Mo',\n\tmercury: 'Me',\n\tvenus: 'Ve',\n\tmars: 'Ma',\n\tjupiter: 'Ju',\n\tsaturn: 'Sa',\n\turanus: 'Ur',\n\tneptune: 'Ne',\n\tpluto: 'Pl',\n\trahu: 'Ra',\n\tketu: 'Ke',\n\tascendant: 'Asc',\n\tlagna: 'La',\n};\n\n/** Two-letter graha code for the tight cells of a North/South Indian kundli, or `undefined`. */\nexport const planetAbbr = (\n\tname: string | undefined | null,\n): string | undefined => resolve(PLANET_ABBR, name);\n\nconst SIGN_GLYPH: Record<string, string> = {\n\taries: '\u2648',\n\ttaurus: '\u2649',\n\tgemini: '\u264A',\n\tcancer: '\u264B',\n\tleo: '\u264C',\n\tvirgo: '\u264D',\n\tlibra: '\u264E',\n\tscorpio: '\u264F',\n\tsagittarius: '\u2650',\n\tcapricorn: '\u2651',\n\taquarius: '\u2652',\n\tpisces: '\u2653',\n};\n\n/** Zodiac glyph for a sign name in any case, or `undefined`. */\nexport const signGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(SIGN_GLYPH, name);\n\nconst SIGN_ABBR: Record<string, string> = {\n\taries: 'Ar',\n\ttaurus: 'Ta',\n\tgemini: 'Ge',\n\tcancer: 'Cn',\n\tleo: 'Le',\n\tvirgo: 'Vi',\n\tlibra: 'Li',\n\tscorpio: 'Sc',\n\tsagittarius: 'Sg',\n\tcapricorn: 'Cp',\n\taquarius: 'Aq',\n\tpisces: 'Pi',\n};\n\n/** Two-letter rashi code for kundli cells and grid headers, or `undefined`. */\nexport const signAbbr = (name: string | undefined | null): string | undefined =>\n\tresolve(SIGN_ABBR, name);\n\n/** The twelve signs in zodiacal order. Display values, not lookup keys: read them through {@link signGlyph} / {@link signAbbr}. */\nexport const SIGNS_ORDER = [\n\t'Aries',\n\t'Taurus',\n\t'Gemini',\n\t'Cancer',\n\t'Leo',\n\t'Virgo',\n\t'Libra',\n\t'Scorpio',\n\t'Sagittarius',\n\t'Capricorn',\n\t'Aquarius',\n\t'Pisces',\n] as const;\n\n/**\n * Glyph per aspect. Used by the natal, transit and synastry aspect tables.\n *\n * @remarks\n * These are the nine aspects Unicode itself defines as a set, in its Miscellaneous Symbols block note: `260C, 26BA, 2220, 26B9, 25A1, 25B3, 26BC, 26BB, 260D` for 0, 30, 45, 60, 90, 120, 135, 150 and 180 degrees. That is exactly the vocabulary the API returns, so every aspect resolves to a real glyph and none falls through to a truncated slug.\n *\n * Do not substitute the visually similar maths operators. Unicode lists `\u22BB` XOR and `\u22BC` NAND as cross-references FROM the real quincunx and semisextile glyphs, so they look like safe stand-ins and are easy to pair the wrong way round, which renders a 150 degree quincunx with the 30 degree semisextile symbol. An astrologer reads the glyph, not the tooltip.\n */\nconst ASPECT_SYMBOL: Record<string, string> = {\n\tconjunction: '\u260C',\n\tsemisextile: '\u26BA',\n\t'semi sextile': '\u26BA',\n\tsemisquare: '\u2220',\n\t'semi square': '\u2220',\n\tsextile: '\u26B9',\n\tsquare: '\u25A1',\n\ttrine: '\u25B3',\n\tsesquiquadrate: '\u26BC',\n\tquincunx: '\u26BB',\n\topposition: '\u260D',\n};\n\n/** Aspect glyph for any of the separator forms the endpoints use (`SEMI_SEXTILE`, `SEMI SEXTILE`, `semi-sextile`), or `undefined`. */\nexport const aspectSymbol = (\n\tname: string | undefined | null,\n): string | undefined => resolve(ASPECT_SYMBOL, name);\n\n/** Trigrams used by I Ching hexagrams. Eight trigrams compose 64 hexagrams. */\nconst TRIGRAM_GLYPH: Record<string, string> = {\n\theaven: '\u2630',\n\tlake: '\u2631',\n\tfire: '\u2632',\n\tthunder: '\u2633',\n\twind: '\u2634',\n\twater: '\u2635',\n\tmountain: '\u2636',\n\tearth: '\u2637',\n};\n\n/** Trigram glyph for a trigram name in any case, or `undefined`. */\nexport const trigramGlyph = (\n\tname: string | undefined | null,\n): string | undefined => resolve(TRIGRAM_GLYPH, name);\n\n/** Moon phase emoji set. Used by the moon phase card. */\nconst MOON_PHASE_EMOJI: Record<string, string> = {\n\t'new moon': '\uD83C\uDF11',\n\t'waxing crescent': '\uD83C\uDF12',\n\t'first quarter': '\uD83C\uDF13',\n\t'waxing gibbous': '\uD83C\uDF14',\n\t'full moon': '\uD83C\uDF15',\n\t'waning gibbous': '\uD83C\uDF16',\n\t'last quarter': '\uD83C\uDF17',\n\t'waning crescent': '\uD83C\uDF18',\n};\n\n/**\n * Emoji for a lunar phase, or `undefined`.\n *\n * @remarks\n * The live API suffixes most phase names (`Waxing Gibbous Moon`) and calls the third quarter `Third Quarter Moon`, while only new and full moon carry the suffix in the table. Both reconciliations live here rather than in the card, so any component reading a phase name resolves the same eight phases from the same four spellings.\n */\nexport const moonPhaseEmoji = (\n\tname: string | undefined | null,\n): string | undefined => {\n\tif (!name) return undefined;\n\tconst key = lookupKey(name);\n\tconst bare = key.replace(/ moon$/, '');\n\tconst alias = bare === 'third quarter' ? 'last quarter' : bare;\n\treturn MOON_PHASE_EMOJI[key] ?? MOON_PHASE_EMOJI[alias];\n};\n", "import {\n\ttype CSSResultGroup,\n\thtml,\n\tLitElement,\n\tnothing,\n\ttype PropertyValues,\n} from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { resolveLang } from '../i18n/lang.js';\nimport { LocaleController } from '../i18n/locale-controller.js';\nimport { translate } from '../i18n/registry.js';\nimport { baseStyles } from './base-styles.js';\nimport { buildRequest, FetchController } from './fetch-controller.js';\nimport {\n\ttype InterpSection,\n\trenderInterpAccordion,\n} from './interp-accordion.js';\nimport { MarkupDataController } from './markup-data.js';\n\n/**\n * Shared base for every data-driven Roxy component. Consolidates the things every component used to repeat by hand and adds the self-contained, drop-in behavior: controlled-mode hydration, an opt-in self-fetch (form, request, loading, error, empty), the typed `data` slot, and the render switch. A subclass implements one method, {@link RoxyDataElement.renderData}.\n *\n * @remarks\n * Two render modes, one component, which is the whole drop-in contract:\n *\n * - Controlled: a server (WordPress, JSX SSR, static HTML) fetches the response and injects it as a direct-child `<script type=\"application/json\" class=\"roxy-data\">`. {@link MarkupDataController} hydrates `data` from it on connect. No key reaches the browser. This is the path the WordPress plugin drives, and it is unchanged by the base class.\n * - Uncontrolled: no data is injected, but a `data-endpoint` and a `pk_` `publishable-key` are set. The component renders its own `<roxy-endpoint-form>` (an internal detail, never placed by the consumer), and on submit fetches through {@link FetchController}, which refuses any non-publishable key. The result populates `data` and the component renders it.\n *\n * The JavaScript `data` property always wins over markup, so a host that assigns `el.data = \u2026` after upgrade is authoritative.\n *\n * Self-fetch needs `<roxy-endpoint-form>` (and `<roxy-location-search>`) registered. The CDN bundle and the full `@roxyapi/ui` entry register everything; per-component ESM consumers that want self-fetch import the form component too.\n *\n * Two things every subclass inherits for the host page to shape the render from outside the shadow root, with no JavaScript: the `hide-readings` attribute ({@link RoxyDataElement.hideReadings}), and the `part` names on the base's own branches (`form`, `loading`, `error`, `edit-bar`, `attribution`). A component adds `part` to its own structural blocks; the vocabulary is in `docs/authoring.md`.\n *\n * @example\n * ```ts\n * @customElement('roxy-dream-card')\n * export class RoxyDreamCard extends RoxyDataElement<GetDreamSymbolResponse> {\n * static styles = [baseStyles, css`.card { \u2026 }`];\n * protected renderData(d: GetDreamSymbolResponse) {\n * return html`<article class=\"card\">\u2026</article>`;\n * }\n * protected renderEmpty() {\n * return html`<div class=\"roxy-empty\" role=\"status\">No dream symbol</div>`;\n * }\n * }\n * ```\n */\nexport abstract class RoxyDataElement<T = unknown> extends LitElement {\n\tstatic styles: CSSResultGroup = [baseStyles];\n\n\t/** Typed RoxyAPI response. Assigned in JavaScript, hydrated from the roxy-data island, or set by a self-fetch. */\n\t@property({ attribute: false })\n\tdata: T | null = null;\n\n\t/** Endpoint path for self-fetch, e.g. \"astrology/natal-chart\" or \"dreams/symbols/{id}\". Empty disables self-fetch (controlled mode only). */\n\t@property({ type: String, attribute: 'data-endpoint' })\n\tendpoint = '';\n\n\t/** HTTP method for self-fetch. */\n\t@property({ type: String })\n\tmethod: 'GET' | 'POST' = 'POST';\n\n\t/** Browser-safe publishable key (pk_) for self-fetch. A secret key is refused client-side. */\n\t@property({ type: String, attribute: 'publishable-key' })\n\tpublishableKey?: string;\n\n\t/** Override the API origin for self-hosted or proxied deployments. */\n\t@property({ type: String, attribute: 'base-url' })\n\tbaseUrl?: string;\n\n\t/** Override the OpenAPI spec URL the self-fetch form introspects. */\n\t@property({ type: String, attribute: 'spec-url' })\n\tspecUrl?: string;\n\n\t/** Consumer backend route that proxies the request (holds the secret key). When set, self-fetch POSTs the request here instead of calling RoxyAPI directly, so no key reaches the browser. The server-rendered (WordPress) path. */\n\t@property({ type: String, attribute: 'submit-url' })\n\tsubmitUrl?: string;\n\n\t/** Persist the last self-fetch form values in sessionStorage (keyed by endpoint) and prefill the form on reload. */\n\t@property({ type: Boolean })\n\tremember = false;\n\n\t/**\n\t * Render the chart and the data, and omit the written interpretation. Off by default, so a component that does not set it is byte-identical to before.\n\t *\n\t * @remarks\n\t * The suppressed content is the prose an endpoint returns ABOUT the result: the interpretation accordion, the interpretive paragraphs, and the keyword chips that belong to them. Everything a practitioner reads the numbers off stays: wheels, tables, grids, legends, pills, counts and dates. The reading is dropped from the DOM rather than hidden with CSS, so a page that publishes the chart alone never ships the prose it is not showing.\n\t *\n\t * Set it when the page supplies its own words, which is the common case for a practitioner site that wants the graphic under its own writing.\n\t */\n\t@property({ type: Boolean, attribute: 'hide-readings', reflect: true })\n\thideReadings = false;\n\n\t/** Override the self-fetch form's submit-button label. Empty derives one from the endpoint. */\n\t@property({ type: String, attribute: 'submit-label' })\n\tsubmitLabel?: string;\n\n\t/** Render a small \"Spiritual data by RoxyAPI\" credit under a self-fetch or auto-mount result. Off by default; any value except \"off\"/\"false\" enables it. The one-tag widgets script turns it on unless data-attribution=\"off\". Never shown in controlled mode. */\n\t@property({ type: String })\n\tattribution?: string;\n\n\t/** True while an uncontrolled self-fetch is in flight. Public so {@link FetchController} can drive it. */\n\t@state()\n\tloading = false;\n\n\t/** Message from a failed self-fetch, or null. Public so {@link FetchController} can drive it. */\n\t@state()\n\terror: string | null = null;\n\n\t/**\n\t * True once a self-fetch (not a consumer-assigned or island-hydrated `data`) produced the current result. It gates the interactive result affordances, so controlled mode never shows an Edit control or a sticky picker.\n\t */\n\t@state()\n\tprivate selfFetched = false;\n\n\t/** True when the visitor asked to edit a self-fetch result, so the form is restored over the result. */\n\t@state()\n\tprivate editing = false;\n\n\t/** True when the last self-fetch form was a single-enum picker, so it stays visible above the result and a change refetches. */\n\t@state()\n\tprivate sticky = false;\n\n\t/** Last submitted form values (nested per group), kept in memory to restore the form on Edit and to prefill the sticky picker. */\n\tprivate lastValues?: Record<string, unknown>;\n\n\tprivate fetcher: FetchController<T>;\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Controlled mode: hydrate `data` from a direct-child roxy-data island when\n\t\t// no JS property was assigned. Keyless; the server already fetched.\n\t\tnew MarkupDataController<T>(this);\n\t\t// Re-render if a chrome-string catalogue lands after this element upgraded.\n\t\tnew LocaleController(this);\n\t\tthis.fetcher = new FetchController<T>(this);\n\t}\n\n\t/**\n\t * The chrome string for this element's language, keyed by its own English source text.\n\t *\n\t * @remarks\n\t * Pass the English copy, never a key. With no catalogue registered the source string is returned unchanged, so an English page pays nothing and a language we do not ship degrades to English rather than to a visible key.\n\t *\n\t * Chrome only. A value the API returned (a planet, a sign, an aspect, a house system) is NOT translated here: it is rendered as the response carries it, so the words on the chart and the words in the response can never disagree.\n\t *\n\t * @example\n\t * ```ts\n\t * this.t('Aspect grid'); // 'Cuadricula de aspectos' under lang=\"es\"\n\t * this.t('{{count}} planets', { count: 12 }); // '12 planetas'\n\t * ```\n\t */\n\tprotected t(source: string, vars?: Record<string, string | number>): string {\n\t\treturn translate(this.effectiveLang(), source, vars);\n\t}\n\n\t/** {@link RoxyDataElement.t} as a value, bound once, for a shared render helper that has no host of its own and therefore cannot resolve a page language (`utils/hd-reading.ts`). Named `translator` and not `translate` because `HTMLElement.translate` is a real DOM property and shadowing it with a protected member makes every `@customElement` decorator in the library fail to typecheck. */\n\tprotected readonly translator = (\n\t\tsource: string,\n\t\tvars?: Record<string, string | number>,\n\t): string => this.t(source, vars);\n\n\tprotected willUpdate(changed: PropertyValues): void {\n\t\tif (changed.has('publishableKey')) {\n\t\t\tthis.fetcher.publishableKey = this.publishableKey;\n\t\t}\n\t\tif (changed.has('baseUrl') && this.baseUrl) {\n\t\t\tthis.fetcher.baseUrl = this.baseUrl;\n\t\t}\n\t\tif (changed.has('submitUrl')) {\n\t\t\tthis.fetcher.submitUrl = this.submitUrl;\n\t\t}\n\t}\n\n\trender(): unknown {\n\t\tif (this.loading) return this.renderLoading();\n\t\tif (this.error != null) return this.renderError(this.error);\n\t\tif (this.data != null) {\n\t\t\t// Controlled mode (consumer-assigned or island-hydrated data) renders the\n\t\t\t// result alone, byte-identical to before: no picker, no Edit. The one\n\t\t\t// exception is the widgets auto-mount attrs-complete path, which assigns\n\t\t\t// data directly AND sets `attribution`; a real controlled consumer never\n\t\t\t// sets the attribute, so this stays byte-identical for them.\n\t\t\tif (!this.selfFetched) {\n\t\t\t\treturn this.showAttribution()\n\t\t\t\t\t? html`${this.renderData(this.data)}${this.renderAttribution()}`\n\t\t\t\t\t: this.renderData(this.data);\n\t\t\t}\n\t\t\tif (this.editing) return this.renderForm();\n\t\t\treturn this.renderResult(this.data);\n\t\t}\n\t\treturn this.renderNoData();\n\t}\n\n\t/** Render the populated response. The single method every component implements. */\n\tprotected abstract renderData(data: T): unknown;\n\n\t/**\n\t * The interpretation accordion, gated by {@link RoxyDataElement.hideReadings}. Every component that shows a written reading routes through here instead of calling {@link renderInterpAccordion} directly.\n\t *\n\t * @remarks\n\t * The gate lives on the base rather than in each component because the property does, and a plain render function cannot read component state. One call site per accordion, one place that decides whether prose renders, and the section it emits carries the same `readings` part in every component.\n\t *\n\t * Prose that is NOT in an accordion (a summary paragraph, a per-item interpretation) is still the component's own to gate, since only the component knows which of its blocks are readings.\n\t */\n\tprotected renderInterpretation(\n\t\tsections: InterpSection[],\n\t\tname: string,\n\t\theading?: string,\n\t): unknown {\n\t\tif (this.hideReadings) return nothing;\n\t\t// The default heading is localized HERE rather than in the accordion:\n\t\t// that is a plain render function with no host, so it cannot read a\n\t\t// language, and this is the one call site every component routes through.\n\t\treturn renderInterpAccordion(sections, name, heading ?? this.t('Reading'));\n\t}\n\n\t/**\n\t * A self-fetch result plus its re-query affordance. A single-enum form keeps its picker above the result so a new selection refetches (a sign switch is a new reading); any other form gets a compact Edit control that restores the form with the previous values.\n\t */\n\tprotected renderResult(data: T): unknown {\n\t\tconst body = this.sticky\n\t\t\t? html`${this.renderForm()}${this.renderData(data)}`\n\t\t\t: html`<div class=\"roxy-edit-bar\" part=\"edit-bar\"><button type=\"button\" class=\"roxy-edit\" @click=\"${this.onEdit}\">${this.t('Edit query')}</button></div>${this.renderData(data)}`;\n\t\treturn this.showAttribution()\n\t\t\t? html`${body}${this.renderAttribution()}`\n\t\t\t: body;\n\t}\n\n\tprivate onEdit = () => {\n\t\tthis.editing = true;\n\t};\n\n\t/** True when the attribution credit renders: the attribute is present and not explicitly disabled. */\n\tprivate showAttribution(): boolean {\n\t\treturn (\n\t\t\tthis.attribution != null &&\n\t\t\tthis.attribution !== 'off' &&\n\t\t\tthis.attribution !== 'false'\n\t\t);\n\t}\n\n\t/** Small muted credit under a self-fetch or auto-mount result. Reached only from the result path, so controlled mode never renders it. */\n\tprotected renderAttribution(): unknown {\n\t\treturn html`<div class=\"roxy-attribution\" part=\"attribution\"><a href=\"https://roxyapi.com/?utm_source=widget&utm_medium=embed\" target=\"_blank\" rel=\"noopener\">${this.t('Spiritual data by RoxyAPI')}</a></div>`;\n\t}\n\n\t/** The data-absent branch: the self-fetch form when an endpoint is set, otherwise the empty state. */\n\tprotected renderNoData(): unknown {\n\t\treturn this.endpoint ? this.renderForm() : this.renderEmpty();\n\t}\n\n\t/** Internal self-fetch form. Reuses the introspecting `<roxy-endpoint-form>`; the consumer never places it. */\n\tprotected renderForm(): unknown {\n\t\treturn html`<roxy-endpoint-form part=\"form\" data-endpoint=\"${this.endpoint}\" method=\"${this.method}\" spec-url=\"${ifDefined(this.specUrl)}\" publishable-key=\"${ifDefined(this.publishableKey)}\" submit-label=\"${ifDefined(this.submitLabel)}\" lang=\"${ifDefined(this.effectiveLang())}\" .initialValues=\"${this.formInitialValues()}\" @roxy-submit=\"${this.onFormSubmit}\"></roxy-endpoint-form>`;\n\t}\n\n\t/** Prefill source for the form: the last submission (Edit / sticky refetch) wins over remembered storage. */\n\tprivate formInitialValues(): Record<string, unknown> | undefined {\n\t\treturn (\n\t\t\tthis.lastValues ?? (this.remember ? this.readRemembered() : undefined)\n\t\t);\n\t}\n\n\t/**\n\t * Site-owner language for this element: the `lang` attribute, the nearest ancestor carrying one, or the document. Protected so a component that composes another can forward it (a child inside this shadow root cannot reach the host page on its own).\n\t *\n\t * Full tag, region included. The truncation to what `?lang=` accepts happens where the request is built, in `<roxy-endpoint-form>`.\n\t */\n\tprotected effectiveLang(): string | undefined {\n\t\treturn resolveLang(this);\n\t}\n\n\tprivate onFormSubmit = (e: Event) => {\n\t\tconst detail = (e as CustomEvent).detail as {\n\t\t\tvalues: Record<string, unknown>;\n\t\t\tqueryKeys?: string[];\n\t\t\tsticky?: boolean;\n\t\t};\n\t\tthis.lastValues = detail.values;\n\t\tthis.sticky = !!detail.sticky;\n\t\tthis.selfFetched = true;\n\t\tthis.editing = false;\n\t\tif (this.remember) this.writeRemembered(detail.values);\n\t\tvoid this.fetcher.run(\n\t\t\tbuildRequest(\n\t\t\t\tthis.endpoint,\n\t\t\t\tthis.method,\n\t\t\t\tdetail.values,\n\t\t\t\tdetail.queryKeys ?? [],\n\t\t\t),\n\t\t);\n\t};\n\n\t/** sessionStorage key for this component's remembered form values, scoped by endpoint. */\n\tprivate rememberKey(): string {\n\t\treturn `roxy-ui:form:${this.endpoint}`;\n\t}\n\n\tprivate readRemembered(): Record<string, unknown> | undefined {\n\t\ttry {\n\t\t\tconst raw = sessionStorage.getItem(this.rememberKey());\n\t\t\treturn raw ? (JSON.parse(raw) as Record<string, unknown>) : undefined;\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate writeRemembered(values: Record<string, unknown>): void {\n\t\ttry {\n\t\t\tsessionStorage.setItem(this.rememberKey(), JSON.stringify(values));\n\t\t} catch {\n\t\t\t// Private mode / disabled storage: remembering is best-effort, never fatal.\n\t\t}\n\t}\n\n\t/** Terminal empty state. Subclasses override for a domain-specific message. */\n\tprotected renderEmpty(): unknown {\n\t\treturn html`<div class=\"roxy-empty\" role=\"status\">${this.t('No data')}</div>`;\n\t}\n\n\t/** Loading placeholder shown during a self-fetch. */\n\tprotected renderLoading(): unknown {\n\t\treturn html`<div class=\"roxy-skeleton\" style=\"height:8rem\" role=\"status\" aria-label=\"${this.t('Loading')}\" part=\"loading\"></div>`;\n\t}\n\n\t/** Error state shown when a self-fetch fails. Keeps the form in view so the request can be retried. */\n\tprotected renderError(message: string): unknown {\n\t\tconst banner = html`<div class=\"roxy-error\" role=\"alert\" part=\"error\">${message}</div>`;\n\t\treturn this.endpoint ? html`${banner}${this.renderForm()}` : banner;\n\t}\n}\n", "/**\n * Where a component's language comes from, and what is safe to send to the API.\n *\n * @remarks\n * Two different answers, and conflating them is the whole reason this file is separate from the catalogue:\n *\n * - {@link resolveLang} answers \"what language is this PAGE in\", and keeps the full tag, because `es-AR` is a legitimate thing for a catalogue to want to differ on.\n * - {@link apiLang} answers \"what may go on the query string\", which is a narrower question with a hard edge: `?lang=es-AR` is a 400, `?lang=es` is a 200.\n *\n * The full tag is not a nicety the catalogue happens to tolerate: `utils/format.ts` hands it to `Intl`, which reads the region and writes `15 de ene de 1990` for `es-AR` where it writes `15 ene 1990` for `es`. Passing the API answer to a formatter demotes every regional visitor to the base language and nothing fails, so the two values are never interchangeable.\n */\n\nimport { API_LANGUAGES } from '../generated/api-languages.js';\n\n/**\n * The site-owner language for an element, resolved through the four-link chain the revamp design specifies.\n *\n * @remarks\n * 1. the element's own `lang` attribute (the explicit per-embed override),\n * 2. the nearest ancestor carrying `lang`, so one wrapper localizes a whole section,\n * 3. `document.documentElement.lang`, which is what makes this work on a real CMS with no markup change at all: WordPress emits `<html lang=\"es-AR\">` on every page of a Spanish site,\n * 4. nothing, which the callers read as English.\n *\n * Only link 1 used to be implemented, so a component on a fully Spanish page rendered English chrome and there was no way to fix it except hand-editing every embed.\n *\n * `navigator.language` is deliberately NOT in the chain. It is the VISITOR's preference, not the site's: it fragments the API cache across every locale a visitor might carry and silently serves two people different content from the same URL.\n *\n * Link 2 uses `closest`, which stops at a shadow boundary. A component composed INSIDE another component's shadow root therefore cannot see the host page, which is why every composing component forwards `lang` to its children explicitly.\n */\nexport function resolveLang(el: HTMLElement): string | undefined {\n\t// Native accessor, never a Lit @property: declaring one would shadow\n\t// HTMLElement.lang and break the platform attribute for every consumer.\n\tif (el.lang) return el.lang;\n\tif (typeof document === 'undefined') return undefined;\n\tconst inherited = el.closest?.('[lang]')?.getAttribute('lang');\n\tif (inherited) return inherited;\n\treturn document.documentElement.lang || undefined;\n}\n\n/**\n * The value safe to put on `?lang=`, or `undefined` to leave the request on the API default.\n *\n * @remarks\n * Two narrowings, both of which are load-bearing the moment {@link resolveLang} starts reading `<html lang>`:\n *\n * - **The region is dropped.** A regional tag is a 400, so a Spanish WordPress site would go from English-but-working to broken the day the language chain was completed. `es-AR`, `es-419` and `ES` all send `es`.\n * - **An unsupported language is omitted, not sent.** The chain now surfaces whatever the host page carries, including languages the API does not translate, and an unlisted tag is the same 400. Omitting it degrades to English, which is the behaviour those pages already had.\n */\nexport function apiLang(el: HTMLElement): string | undefined {\n\tconst tag = resolveLang(el);\n\tif (!tag) return undefined;\n\tconst base = tag.toLowerCase().split('-')[0] as string;\n\treturn API_LANGUAGES.includes(base) ? base : undefined;\n}\n", "/**\n * The chrome-string catalogue: one resolver reading one registry, so a translation can arrive from anywhere without a component changing.\n *\n * @remarks\n * **The key IS the canonical English string**, folded through {@link lookupKey}. There is no invented key vocabulary to keep in sync with the copy, which is the same rule the glyph tables in `tokens/index.ts` follow (they key off the exact value the API returns). Two consequences that are the whole point:\n *\n * - **English costs zero bytes.** A miss returns the source string, so the English build ships no catalogue at all, and a site that never loads a locale payload is byte-identical to one built before this file existed.\n * - **A missing translation degrades to English, never to a key.** The failure mode of a keyed catalogue is a raw `natal.tabs.wheel` rendered at a customer; here the worst case is the English word.\n *\n * **The registry lives on `globalThis`, not in module scope, because it has to.** Every `dist/cdn/components/*.js` is a self-contained IIFE with its own copy of this module, so a `Map` here would be invisible to the second component on the page. One global object, written by the locale payload and read by every bundle, is what makes `dist/cdn/locales/es.js` a single download that translates all of them.\n *\n * Load order is not guaranteed on a real host (WordPress enqueues scripts in an order the plugin does not fully control, and a payload may be deferred), so {@link onLocaleChange} lets an element that has already rendered in English re-render when its catalogue lands.\n */\n\nimport { lookupKey } from '../utils/string.js';\n\n/** Shared mutable state, addressed by a name rather than a module binding so every bundle on the page reaches the same object. */\ninterface LocaleRegistry {\n\t/** Language tag (lower case) to catalogue, keyed by {@link lookupKey} of the English source string. */\n\tcatalogs: Record<string, Record<string, string>>;\n\t/** Elements waiting to re-render when a catalogue arrives. */\n\tlisteners: Set<() => void>;\n}\n\nconst GLOBAL_KEY = '__ROXY_UI_I18N__';\n\nfunction registry(): LocaleRegistry {\n\tconst holder = globalThis as unknown as Record<string, LocaleRegistry>;\n\tconst existing = holder[GLOBAL_KEY];\n\tif (existing) return existing;\n\tconst created: LocaleRegistry = { catalogs: {}, listeners: new Set() };\n\tholder[GLOBAL_KEY] = created;\n\treturn created;\n}\n\n/**\n * Publish a catalogue for a language tag and wake every mounted element.\n *\n * @remarks\n * The catalogue is authored keyed by the English source string, exactly as it appears at the call site, and normalized here. That keeps the source file readable and diffable against the component that renders it, while the runtime lookup stays a single property read.\n *\n * This is the ONLY way into the registry, so a catalogue can later come from a static file, a server response, or a host page inlining a script tag, without a component knowing the difference.\n */\nexport function registerLocale(\n\tlang: string,\n\tcatalog: Record<string, string>,\n): void {\n\tconst reg = registry();\n\tconst normalized: Record<string, string> = {};\n\tfor (const [source, translated] of Object.entries(catalog)) {\n\t\tnormalized[lookupKey(source)] = translated;\n\t}\n\treg.catalogs[lang.toLowerCase()] = normalized;\n\tfor (const listener of reg.listeners) listener();\n}\n\n/**\n * Replace `{{name}}` placeholders. Copied from the API-side translator so both sides of the product interpolate identically; an unknown placeholder is left verbatim rather than blanked, so a typo in a catalogue is visible instead of silently eating the value.\n */\nexport function interpolate(\n\ttemplate: string,\n\tvars?: Record<string, string | number>,\n): string {\n\tif (!vars) return template;\n\treturn template.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key: string) =>\n\t\tkey in vars ? String(vars[key] ?? '') : match,\n\t);\n}\n\n/**\n * The chrome string for `lang`, falling back to the English `source` it is keyed by.\n *\n * @remarks\n * A regional tag resolves against its base language, so `es-AR` and `es-419` both read the `es` catalogue and a site does not have to know which tags we happen to ship. An exact regional catalogue still wins if one is ever registered.\n */\nexport function translate(\n\tlang: string | undefined,\n\tsource: string,\n\tvars?: Record<string, string | number>,\n): string {\n\tif (!lang) return interpolate(source, vars);\n\tconst { catalogs } = registry();\n\tconst tag = lang.toLowerCase();\n\tconst catalog = catalogs[tag] ?? catalogs[tag.split('-')[0] as string];\n\treturn interpolate(catalog?.[lookupKey(source)] ?? source, vars);\n}\n\n/** Subscribe to catalogue arrivals. Returns the unsubscribe, so an element can drop it on disconnect. */\nexport function onLocaleChange(listener: () => void): () => void {\n\tconst { listeners } = registry();\n\tlisteners.add(listener);\n\treturn () => {\n\t\tlisteners.delete(listener);\n\t};\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport { onLocaleChange } from './registry.js';\n\n/**\n * Re-renders its host when a chrome-string catalogue arrives.\n *\n * @remarks\n * Without this the catalogue would have to be on the page BEFORE the elements upgrade, which is not something a component can require of a real host. WordPress orders enqueued scripts by dependency and a site owner can add `defer` to any of them; a CDN embed is two independent `<script src>` tags. Any of those can land the locale payload after the first paint, and the visible result would be a chart that renders in English on a Spanish page for no reason the site owner can see or fix.\n *\n * Mirrors `MarkupDataController`: constructed in {@link RoxyDataElement}'s constructor, subscribes on connect, drops the subscription on disconnect. Registration is idempotent and a re-register of the same language simply re-renders, so a payload loaded twice is harmless.\n */\nexport class LocaleController implements ReactiveController {\n\tprivate readonly host: ReactiveControllerHost;\n\tprivate unsubscribe?: () => void;\n\n\tconstructor(host: ReactiveControllerHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected(): void {\n\t\tthis.unsubscribe = onLocaleChange(() => this.host.requestUpdate());\n\t}\n\n\thostDisconnected(): void {\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribe = undefined;\n\t}\n}\n", "import { css } from 'lit';\n\n/**\n * Shared host styles every component pulls in. Sets default font, color,\n * container query support, and the entry fade-in.\n */\nexport const baseStyles = css`:host{font-family:var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-base,1rem);line-height:var(--roxy-leading-normal,1.5);animation:roxy-fade-in var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,cubic-bezier(.4, 0, .2, 1)) both;background:0 0;display:block;container-type:inline-size}:host([bare]){--roxy-surface:transparent;--roxy-shadow-sm:none;--roxy-shadow-md:none}*,:before,:after{box-sizing:border-box}h1,h2,h3,h4{font-family:var(--roxy-font-display,var(--roxy-font-sans,system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif))}@keyframes roxy-fade-in{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){:host{animation:none}}.roxy-skeleton{background:linear-gradient(90deg, var(--roxy-border,#e4e4e7) 0%, color-mix(in srgb, var(--roxy-border,#e4e4e7) 60%, transparent) 50%, var(--roxy-border,#e4e4e7) 100%);border-radius:var(--roxy-radius-md,8px);background-size:200% 100%;animation:1.4s ease-in-out infinite roxy-shimmer}@keyframes roxy-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){.roxy-skeleton{animation:none}}.roxy-sr-only{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;position:absolute;overflow:hidden}.roxy-empty{padding:var(--roxy-space-lg,1.5rem);color:var(--roxy-muted,#71717a);text-align:center;font-size:var(--roxy-text-sm,.875rem)}.roxy-error{gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-lg,1.5rem);background:var(--roxy-surface,#fff);border:1px solid var(--roxy-danger,#dc2626);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-danger-fg,#991b1b);font-size:var(--roxy-text-sm,.875rem);justify-items:start;display:grid}.roxy-surface{background:var(--roxy-surface,#fff);color:var(--roxy-fg,#0a0a0a)}:host(:focus-within) .roxy-card{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-attribution{margin-top:var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-align:right}.roxy-attribution a{color:inherit;text-decoration:none}.roxy-attribution a:hover{color:var(--roxy-accent-ink,#b45309);text-decoration:underline}.roxy-attribution a:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}.roxy-edit-bar{margin-bottom:var(--roxy-space-sm,.5rem);justify-content:flex-end;display:flex}.roxy-edit{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);color:var(--roxy-fg,#0a0a0a);font-family:inherit;font-size:var(--roxy-text-sm,.875rem);cursor:pointer;background:0 0}.roxy-edit:hover{border-color:var(--roxy-accent,#f59e0b);color:var(--roxy-accent-ink,#b45309)}.roxy-edit:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px}:host{font-variant-emoji:text}`;\n", "/**\n * The one place the \"publishable key only\" rule lives. Every client-side fetch boundary ({@link ../components/location-search.ts}, {@link ./fetch-controller.ts}) calls through here so a secret or legacy unprefixed key is refused identically: no network call, the same visible message, the same `roxy-validation-error` event. Centralising it is what stops the two paths drifting, which is exactly how `<roxy-location-search>` used to warn-then-fetch a secret key while the controller fail-closed.\n */\n\n/** Canonical refusal message. Both fetch boundaries surface this exact wording. */\nexport const KEY_REFUSED_MESSAGE =\n\t'Client-side components accept a pk_ publishable key only. Use a publishable key with an origin allowlist, or render server-side.';\n\n/** True when the key is a browser-safe `pk_` publishable key. */\nexport function isPublishableKey(key: string | undefined | null): boolean {\n\treturn !!key && key.startsWith('pk_');\n}\n\n/**\n * The fail-closed condition: a key is PRESENT and is NOT a `pk_` key. An absent key is not refused, so a keyless public call (a form-slotted city search with no key set) still proceeds; only a real secret/legacy token in the browser is stopped.\n */\nexport function keyIsRefused(key: string | undefined | null): boolean {\n\treturn !!key && !key.startsWith('pk_');\n}\n\n/**\n * Announce a refused key: dispatch the shared `roxy-validation-error` (bubbling, composed) and, when `warn` is set, log it once for the developer. The caller sets its own visible error state and skips the fetch; this only handles the parts both boundaries share.\n */\nexport function dispatchKeyRefusal(\n\thost: EventTarget,\n\topts: { warn?: boolean } = {},\n): void {\n\tif (opts.warn) console.warn(KEY_REFUSED_MESSAGE);\n\thost.dispatchEvent(\n\t\tnew CustomEvent('roxy-validation-error', {\n\t\t\tdetail: { reason: 'possible-secret-key', message: KEY_REFUSED_MESSAGE },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t}),\n\t);\n}\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport {\n\tdispatchKeyRefusal,\n\tKEY_REFUSED_MESSAGE,\n\tkeyIsRefused,\n} from './key-guard.js';\n\n/**\n * Host slots the controller drives. {@link RoxyDataElement} satisfies this, so the form mixin can attach a controller without the component wiring state by hand.\n *\n * @remarks\n * Intersected with `HTMLElement` because the controller dispatches events on the host. Lit's `ReactiveControllerHost` is the update-lifecycle contract only (`addController`, `requestUpdate`, `updateComplete`) and carries no DOM surface, even though every real host is a `LitElement` and therefore an `HTMLElement`. Declaring the DOM half is what the controller actually needs; it used to reach it through a `this.host as unknown as EventTarget` double cast instead, which asserted a capability the type never promised.\n */\ntype FetchHost<T> = ReactiveControllerHost &\n\tHTMLElement & {\n\t\tdata: T | null;\n\t\tloading: boolean;\n\t\terror: string | null;\n\t};\n\n/** Default RoxyAPI v2 origin. A component overrides it per instance via its `base-url` attribute. */\nconst DEFAULT_BASE_URL = 'https://roxyapi.com/api/v2';\n\n/** A single request the controller issues on the component's behalf. */\nexport interface RoxyRequest {\n\t/** Path under the API base, e.g. \"/dreams/symbols/water\" or \"/astrology/natal-chart\". */\n\tpath: string;\n\tmethod?: 'GET' | 'POST';\n\t/** JSON body for POST endpoints. */\n\tbody?: unknown;\n\t/** Query string parameters; nullish values are dropped. */\n\tquery?: Record<string, string | number | undefined>;\n}\n\n/**\n * Client-side fetch for uncontrolled (self-fetching) components: drives `host.data` / `host.loading` / `host.error` and cancels a stale request when a newer one starts or the host disconnects.\n *\n * @remarks\n * Security boundary. The only credential this ever sends is a `pk_` publishable key, which carries a server-side origin allowlist. A secret (`sk_`) or legacy unprefixed key is refused before any network call and surfaced as an error, so a server secret cannot leak into a browser request. This centralizes the guard that originated in `<roxy-location-search>` so every self-fetching component enforces it identically.\n *\n * Controlled-mode components never construct this. When a server injects the response as a `<script class=\"roxy-data\">` island, there is no key and no fetch, which is the path server-rendered consumers (WordPress, JSX SSR, static HTML) rely on.\n */\nexport class FetchController<T = unknown> implements ReactiveController {\n\tprivate readonly host: FetchHost<T>;\n\tprivate abort?: AbortController;\n\n\t/** Browser-safe publishable key. Set by the host from its `publishable-key` attribute. */\n\tpublishableKey?: string;\n\t/** API origin, overridable for self-hosted or proxied deployments. */\n\tbaseUrl = DEFAULT_BASE_URL;\n\t/**\n\t * Consumer backend route that holds the secret key. When set, the request is POSTed here as `{ path, method, body, query }` instead of called against RoxyAPI directly, so no key (publishable or secret) is sent from the browser. This is the canonical path for server-rendered hosts (WordPress); the backend proxies the request with its own `sk_` key and returns the JSON response.\n\t */\n\tsubmitUrl?: string;\n\n\tconstructor(host: FetchHost<T>) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostDisconnected() {\n\t\tthis.abort?.abort();\n\t\tthis.abort = undefined;\n\t}\n\n\t/**\n\t * Issue the request and resolve once `host.data` (success) or `host.error`\n\t * (failure) is set. A no-op return when a non-publishable key is present:\n\t * the error is already surfaced and nothing is sent.\n\t */\n\tasync run(req: RoxyRequest): Promise<void> {\n\t\t// submit-url proxy: no key leaves the browser; the consumer's backend holds it.\n\t\tif (!this.submitUrl && this.secretKeyRefused()) return;\n\t\tthis.abort?.abort();\n\t\tconst controller = new AbortController();\n\t\tthis.abort = controller;\n\t\tthis.host.loading = true;\n\t\tthis.host.error = null;\n\t\ttry {\n\t\t\tconst res = this.submitUrl\n\t\t\t\t? await fetch(this.submitUrl, {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\tAccept: 'application/json',\n\t\t\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbody: JSON.stringify(req),\n\t\t\t\t\t\tsignal: controller.signal,\n\t\t\t\t\t})\n\t\t\t\t: await this.callApi(req, controller.signal);\n\t\t\tif (!res.ok) throw new Error(await this.readError(res));\n\t\t\tconst json = (await res.json()) as T;\n\t\t\tif (controller.signal.aborted) return;\n\t\t\tthis.host.data = json;\n\t\t} catch (err) {\n\t\t\tif ((err as { name?: string })?.name === 'AbortError') return;\n\t\t\tthis.host.error = err instanceof Error ? err.message : String(err);\n\t\t} finally {\n\t\t\tif (this.abort === controller) this.abort = undefined;\n\t\t\tif (!controller.signal.aborted) this.host.loading = false;\n\t\t}\n\t}\n\n\t/** Direct call against RoxyAPI with the publishable key (the no-backend path). */\n\tprivate callApi(req: RoxyRequest, signal: AbortSignal): Promise<Response> {\n\t\tconst url = new URL(`${this.baseUrl}${req.path}`);\n\t\tfor (const [k, v] of Object.entries(req.query ?? {})) {\n\t\t\tif (v != null) url.searchParams.set(k, String(v));\n\t\t}\n\t\tconst headers: Record<string, string> = { Accept: 'application/json' };\n\t\tif (this.publishableKey) headers['X-API-Key'] = this.publishableKey;\n\t\tif (req.body != null) headers['Content-Type'] = 'application/json';\n\t\treturn fetch(url, {\n\t\t\tmethod: req.method ?? 'GET',\n\t\t\theaders,\n\t\t\tbody: req.body != null ? JSON.stringify(req.body) : undefined,\n\t\t\tsignal,\n\t\t});\n\t}\n\n\t/** True when a key is set and it is not a browser-safe `pk_` publishable key. Surfaces the error and refuses to send, via the shared {@link keyIsRefused} guard so every fetch boundary fail-closes identically. */\n\tprivate secretKeyRefused(): boolean {\n\t\tif (!keyIsRefused(this.publishableKey)) return false;\n\t\tthis.host.error = KEY_REFUSED_MESSAGE;\n\t\tdispatchKeyRefusal(this.host);\n\t\treturn true;\n\t}\n\n\t/** Surface the `{ error, code }` message the API returns on failure, falling back to the status code. */\n\tprivate async readError(res: Response): Promise<string> {\n\t\ttry {\n\t\t\tconst body = (await res.json()) as { error?: string };\n\t\t\tif (body?.error) return body.error;\n\t\t} catch {\n\t\t\t// Non-JSON error body: fall through to the status line.\n\t\t}\n\t\treturn `Request failed (${res.status})`;\n\t}\n}\n\n/**\n * Translate flat form values into a {@link RoxyRequest} for an endpoint. The `{name}` segments in the endpoint template are substituted from the values and removed; the rest become the JSON body for POST or query parameters for GET. This is the spec-light request builder the base element uses to turn a `<roxy-endpoint-form>` submission into a self-fetch, so a component needs no per-endpoint glue.\n *\n * @param queryKeys - Names the spec declares as `in: query` for this operation, which `<roxy-endpoint-form>` reports on its `roxy-submit` event. A POST operation can still take query parameters (every localized endpoint takes `?lang=`), and sending one in the JSON body silently drops it, so those names are routed to the query string on POST as well as GET.\n */\nexport function buildRequest(\n\tendpoint: string,\n\tmethod: 'GET' | 'POST',\n\tvalues: Record<string, unknown>,\n\tqueryKeys: readonly string[] = [],\n): RoxyRequest {\n\tconst rest: Record<string, unknown> = { ...values };\n\tconst path = `/${endpoint.replace(/^\\//, '')}`.replace(\n\t\t/\\{([^}]+)\\}/g,\n\t\t(_match, name: string) => {\n\t\t\tconst v = rest[name];\n\t\t\tdelete rest[name];\n\t\t\treturn encodeURIComponent(String(v ?? ''));\n\t\t},\n\t);\n\tconst inQuery = new Set(queryKeys);\n\tconst query: Record<string, string | number | undefined> = {};\n\tconst body: Record<string, unknown> = {};\n\tfor (const [k, v] of Object.entries(rest)) {\n\t\tif (v === undefined || v === '') continue;\n\t\tif (method === 'GET' || inQuery.has(k)) query[k] = v as string | number;\n\t\telse body[k] = v;\n\t}\n\treturn { path, method, query, body: method === 'POST' ? body : undefined };\n}\n", "/**\n * The interpretation accordion: the one way this library shows a label, a short value, and a body of prose behind a disclosure.\n *\n * @remarks\n * Exclusive by construction (`<details name>`), so a card grows by at most one open section and never becomes a wall of text. Callers pass their own group `name` so two accordions on one page do not fight over which section is open.\n *\n * This lives here rather than in a component because the same accordion is the right shape wherever an endpoint returns a labelled reading: the Human Design bodygraph and type card use it for strategy, authority, and aura; `roxy-hexagram` uses it for the changing lines. The CSS was copy-pasted into six components before 2026-07 and had already drifted (`.interp-body` had five distinct definitions), which is the drift this exists to stop. Migrate the remaining copies to it when they are next touched.\n *\n * **Call it through `RoxyDataElement.renderInterpretation`, never directly.** That method is where `hide-readings` is honoured, so a direct call renders prose a host asked to be left out. The section it emits carries `part=\"section readings\"` and each row `part=\"reading\"`, which is what makes the readings of EVERY component addressable under one name from outside the shadow root.\n */\n\nimport { css, html, nothing } from 'lit';\nimport { chevron } from './disclosure.js';\n\n/** One row: the label, the short value shown as the aside, and the interpretation body. `extra` renders under the body for a section that carries more than prose. */\nexport interface InterpSection {\n\tlabel: string;\n\taside?: string;\n\tbody: string;\n\textra?: unknown;\n}\n\nexport const interpAccordionStyles = css`.block{border-top:1px solid var(--roxy-border,#e4e4e7);padding-top:var(--roxy-space-md,1rem)}.block h3{margin:0 0 var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.06em}.interp-card{border:1px solid var(--roxy-border,#e4e4e7);border-radius:var(--roxy-radius-md,8px);padding:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);margin-bottom:var(--roxy-space-xs,.25rem)}.interp-card summary{cursor:pointer;color:var(--roxy-fg,#0a0a0a);align-items:center;gap:var(--roxy-space-sm,.5rem);font-weight:500;font-size:var(--roxy-text-sm,.875rem);display:flex}.interp-card summary:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:2px;border-radius:var(--roxy-radius-sm,4px)}.interp-lead{flex-wrap:wrap;flex:auto;order:1;align-items:baseline;gap:.4rem;min-width:0;display:inline-flex}.interp-aside{flex-shrink:0;order:2;align-items:center;gap:.5rem;display:inline-flex}.roxy-chevron{order:3}.interp-aside small{color:var(--roxy-muted,#71717a);white-space:nowrap;font-weight:400}@container (width<=26rem){.interp-card summary{flex-wrap:wrap}.roxy-chevron{order:2}.interp-aside{flex-basis:100%;order:3;justify-content:flex-end}}.interp-body{margin-top:var(--roxy-space-sm,.5rem);gap:var(--roxy-space-sm,.5rem);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);overflow-wrap:anywhere;line-height:1.6;display:grid}.interp-body p{margin:0}`;\n\n/**\n * Render the accordion. Sections with no body are dropped, so a caller can pass the full set and let a narrower response render only what it carries. `name` groups the `<details>` exclusively, so opening one closes the last.\n */\nexport function renderInterpAccordion(\n\tsections: InterpSection[],\n\tname: string,\n\theading = 'Reading',\n) {\n\tconst shown = sections.filter((s) => Boolean(s.body));\n\tif (shown.length === 0) return nothing;\n\n\treturn html`<section class=\"block\" part=\"section readings\"><h3>${heading}</h3>${shown.map(\n\t\t\t(\n\t\t\t\ts,\n\t\t\t\ti,\n\t\t\t) => html`<details class=\"interp-card\" part=\"reading\" name=\"${name}\" ?open=\"${i === 0}\"><summary><span class=\"interp-lead\">${s.label}</span> ${chevron()} ${s.aside ? html`<span class=\"interp-aside\"><small>${s.aside}</small></span>` : nothing}</summary><div class=\"interp-body\"><p>${s.body}</p>${s.extra ?? nothing}</div></details>`,\n\t\t)}</section>`;\n}\n", "import type { TemplateResult } from 'lit';\nimport { css, html } from 'lit';\n\n/**\n * Disclosure chevron for `<details>`/`<summary>` accordions. Replaces the\n * browser default triangle with a thin chevron that rotates when the host\n * `<details>` opens. Render it inside the `<summary>` and pair with\n * {@link disclosureStyles}.\n */\nexport function chevron(): TemplateResult {\n\treturn html`<svg class=\"roxy-chevron\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\"><path d=\"M4 6l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n}\n\n/**\n * Shared `<details>` accordion styling: hides the native disclosure triangle\n * and rotates the {@link chevron} 180 degrees when the accordion is open.\n * Import into any component that renders disclosure accordions so the chevron\n * looks and behaves identically.\n */\nexport const disclosureStyles = css`summary{list-style:none}summary::-webkit-details-marker{display:none}.roxy-chevron{aspect-ratio:auto;width:14px;height:14px;color:var(--roxy-muted,#71717a);transition:transform var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);flex-shrink:0}details[open]>summary .roxy-chevron{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){.roxy-chevron{transition:none}}`;\n", "import type { ReactiveController, ReactiveControllerHost } from 'lit';\n\n/**\n * Marker class on the inline JSON script a server emits inside a component.\n *\n * @example\n * ```html\n * <roxy-natal-chart>\n * <script type=\"application/json\" class=\"roxy-data\">{ ...response... }</script>\n * </roxy-natal-chart>\n * ```\n */\nconst ROXY_DATA_CLASS = 'roxy-data';\n\n/**\n * Serialize a RoxyAPI response for embedding inside an inline `<script type=\"application/json\" class=\"roxy-data\">`. This is the safe writer counterpart to {@link MarkupDataController}, the reader: server-rendered and cached consumers (WordPress, JSX SSR, static HTML) emit the script with this, and the component hydrates `data` from it on connect.\n *\n * @remarks\n * Use this instead of a bare `JSON.stringify`. A raw stringify of a response that contains the literal text `</script>` (common in long interpretation prose) closes the script element early, corrupting the page and creating an HTML-injection vector. This escapes the script-unsafe characters to their `\\uXXXX` JSON escapes, which `JSON.parse` restores to the original characters, so the value the component receives is identical to the response you passed.\n *\n * `<` is the load-bearing escape (it defeats `</script>` and `<!--`). `>` and `&` are escaped for defence in depth, and U+2028 / U+2029 because they are valid in JSON yet are line terminators in a `<script>` context and break some parsers. The escapes introduce only `\\uXXXX` sequences, so the replacements never feed each other and order is irrelevant.\n *\n * Pass the unwrapped RoxyAPI response, the same shape you would assign to `element.data`. Do not pass the SDK envelope (`{ data, error, request, response }`).\n *\n * @example\n * ```ts\n * import { serializeRoxyData } from '@roxyapi/ui';\n *\n * const { data } = await roxy.dreams.getDreamSymbol({ path: { id: 'water' } });\n * const html = `<roxy-dream-card><script type=\"application/json\" class=\"roxy-data\">${serializeRoxyData(data)}</script></roxy-dream-card>`;\n * ```\n */\nexport function serializeRoxyData(data: unknown): string {\n\treturn JSON.stringify(data)\n\t\t.replace(/</g, '\\\\u003c')\n\t\t.replace(/>/g, '\\\\u003e')\n\t\t.replace(/&/g, '\\\\u0026')\n\t\t.replace(/\\u2028/g, '\\\\u2028')\n\t\t.replace(/\\u2029/g, '\\\\u2029');\n}\n\n/**\n * Build the complete `<script type=\"application/json\" class=\"roxy-data\">\u2026</script>` element a server nests inside a `roxy-*` component for the no-JavaScript hydration path. The payload is escaped via {@link serializeRoxyData}, so it is safe to drop straight into HTML output.\n *\n * @remarks\n * The element carries both `type=\"application/json\"` and `class=\"roxy-data\"` because {@link MarkupDataController} reads only a direct-child script that has both. Emit one of these inside the target component; the JavaScript `data` property still wins if it is later assigned.\n *\n * @example\n * ```ts\n * import { roxyDataScript } from '@roxyapi/ui';\n *\n * const { data } = await roxy.crystals.getCrystal({ path: { id: 'amethyst' } });\n * const html = `<roxy-crystal-grid>${roxyDataScript(data)}</roxy-crystal-grid>`;\n * ```\n */\nexport function roxyDataScript(data: unknown): string {\n\treturn `<script type=\"application/json\" class=\"${ROXY_DATA_CLASS}\">${serializeRoxyData(data)}</script>`;\n}\n\n/**\n * True when the element is a `<script type=\"application/json\">`. Uses tag name and attribute rather than `instanceof HTMLScriptElement` so the check holds in every DOM implementation, including server-rendered and hydration runtimes where the constructor global may be absent.\n */\nfunction isJsonScript(el: Element): boolean {\n\treturn (\n\t\tel.nodeName === 'SCRIPT' && el.getAttribute('type') === 'application/json'\n\t);\n}\n\n/**\n * Host shape the controller drives: any reactive element that exposes a public `data` slot. The controller only writes `data` when the host left it unset, so the JavaScript property path always wins.\n */\ninterface DataHost extends ReactiveControllerHost, HTMLElement {\n\tdata?: unknown;\n}\n\n/**\n * Reactive controller that lets a component hydrate its `data` from embedded markup when no `data` property was assigned in JavaScript.\n *\n * @remarks\n * The server-side and cached-render model: a backend renders the RoxyAPI response into a direct-child `<script type=\"application/json\" class=\"roxy-data\">` element, ships static HTML, and never runs per-element JavaScript to assign a property. On connect this controller reads that script, parses it, and feeds the result to the host. The JavaScript property path is untouched and authoritative: if `host.data` already holds a value when the host connects, the controller does nothing and the markup is ignored.\n *\n * Source resolution order on connect, first hit wins:\n *\n * 1. `host.data` already set in JavaScript -> leave it, read nothing.\n * 2. A direct-child `<script type=\"application/json\" class=\"roxy-data\">` -> parse and use. Direct-child only, so a nested component's own script is never read by an ancestor.\n *\n * Fetching from a URL is intentionally unsupported: that would require a browser-visible key and breaks the server-rendered, cached model these consumers rely on.\n *\n * Timing: {@link hostConnected} runs inside the host `connectedCallback`. For an element parsed from server HTML, its direct children are present by the time the custom element upgrades and connects, so the script is readable here. For an element created with `document.createElement` and connected before any child is appended, there is nothing to read and the property path is the only source, which is exactly the existing behavior.\n *\n * Failure is safe: malformed JSON or a missing script leaves `host.data` untouched, so the host renders its normal empty state.\n *\n * Reading the script never mutates it, and only the marked script is touched, so any sibling fallback markup a server nested inside the element (for no-JavaScript, AMP, or crawler rendering) is left in place.\n *\n * @example\n * ```ts\n * import { MarkupDataController } from '../utils/markup-data.js';\n *\n * export class RoxyExample extends LitElement {\n * constructor() {\n * super();\n * new MarkupDataController(this);\n * }\n *\n * @property({ attribute: false })\n * data: ExampleResponse | null = null;\n * }\n * ```\n */\nexport class MarkupDataController<T = unknown> implements ReactiveController {\n\tprivate readonly host: DataHost;\n\n\tconstructor(host: DataHost) {\n\t\tthis.host = host;\n\t\thost.addController(this);\n\t}\n\n\thostConnected() {\n\t\t// Property path wins. If the consumer (React, vanilla `.data =`, the\n\t\t// widgets script, an MCP agent) already set data, never look at markup.\n\t\tif (this.host.data != null) return;\n\n\t\tconst parsed = this.read();\n\t\tif (parsed === undefined) return;\n\n\t\tthis.host.data = parsed as T;\n\t\tthis.host.requestUpdate();\n\t}\n\n\t/**\n\t * Resolve the embedded payload. Returns `undefined` when there is nothing valid to read so the caller can leave `host.data` untouched.\n\t */\n\tprivate read(): T | undefined {\n\t\tconst inline = this.findInlineScript();\n\t\treturn inline ? this.parse(inline.textContent) : undefined;\n\t}\n\n\t/**\n\t * Direct-child `<script type=\"application/json\" class=\"roxy-data\">`. Scoped to immediate children so a nested data-driven component never has its script read by an ancestor, and so sibling fallback markup is ignored.\n\t */\n\tprivate findInlineScript(): Element | null {\n\t\tfor (const child of Array.from(this.host.children)) {\n\t\t\tif (isJsonScript(child) && child.classList.contains(ROXY_DATA_CLASS)) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate parse(text: string | null): T | undefined {\n\t\tif (!text?.trim()) return undefined;\n\t\ttry {\n\t\t\treturn JSON.parse(text) as T;\n\t\t} catch {\n\t\t\t// Malformed embedded JSON: fail safe, leave the host empty state in\n\t\t\t// place rather than throwing during connect.\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n", "/**\n * Math helpers for converting raw ecliptic longitude decimals into the\n * sign / degree / minute / second triplet used across chart components.\n */\n\nimport { SIGNS_ORDER } from '../tokens/index.js';\n\nexport interface SignPosition {\n\tsign: string;\n\tsignIndex: number;\n\tdegree: number;\n\tminute: number;\n\tsecond: number;\n}\n\n/**\n * Wrap longitude into [0, 360) so negative or out-of-range values still\n * resolve to a real sign. Robust to wonky upstream data.\n */\nexport function normalizeLongitude(lon: number): number {\n\tconst wrapped = lon % 360;\n\treturn wrapped < 0 ? wrapped + 360 : wrapped;\n}\n\n/**\n * Convert decimal ecliptic longitude (0-360) into sign/degree/minute/second.\n * Used by every chart wheel and aspect table.\n */\nexport function longitudeToSignPosition(longitude: number): SignPosition {\n\tconst lon = normalizeLongitude(longitude);\n\tconst signIndex = Math.floor(lon / 30) % 12;\n\tconst within = lon % 30;\n\tconst degree = Math.floor(within);\n\tconst minuteFloat = (within - degree) * 60;\n\tconst minute = Math.floor(minuteFloat);\n\tconst second = Math.round((minuteFloat - minute) * 60);\n\treturn {\n\t\tsign: SIGNS_ORDER[signIndex] ?? 'Aries',\n\t\tsignIndex,\n\t\tdegree,\n\t\tminute,\n\t\tsecond,\n\t};\n}\n\n/** Compact display string like \"12\u00B0 Leo 34'\". Used in chart labels. */\nexport function formatSignPosition(longitude: number): string {\n\tconst { sign, degree, minute } = longitudeToSignPosition(longitude);\n\treturn `${degree}\u00B0 ${sign} ${String(minute).padStart(2, '0')}'`;\n}\n\n/** Format a within-sign decimal degree (0-30) as degree-and-minute, e.g. 17.99 to \"17\u00B059'\". The reference-grade form astrologers read when the sign is already known (asteroids, lots, directed points, fixed stars). */\nexport function formatDegreeInSign(deg: number): string {\n\tlet d = Math.floor(deg);\n\tlet m = Math.round((deg - d) * 60);\n\tif (m === 60) {\n\t\tm = 0;\n\t\td += 1;\n\t}\n\treturn `${d}\u00B0${String(m).padStart(2, '0')}'`;\n}\n\n/**\n * The point diametrically opposite a longitude (e.g. Descendant from\n * Ascendant, IC from MC). Exact derivation, always 180 degrees away.\n */\nexport function oppositePoint(longitude: number): number {\n\treturn normalizeLongitude(longitude + 180);\n}\n\n/**\n * Midpoint of the forward arc from `start` to `end` (both ecliptic\n * longitudes). Handles the 360/0 wrap, so a house spanning 350 to 20 degrees\n * yields a midpoint of 5, not 185. Used to place house numbers between two\n * cusps regardless of how unequal the house is.\n */\nexport function arcMidpoint(start: number, end: number): number {\n\tconst s = normalizeLongitude(start);\n\tlet span = normalizeLongitude(end) - s;\n\tif (span < 0) span += 360;\n\treturn normalizeLongitude(s + span / 2);\n}\n\n/** A body placed on a wheel: where it really is, and where its glyph had to be drawn to stay legible. */\nexport interface FannedPoint<T> {\n\titem: T;\n\t/** The true ecliptic longitude. Where a leader line points, and the only value a reader should take as the position. */\n\tlongitude: number;\n\t/** Where the glyph is drawn, pushed forward only as far as it takes to clear its neighbour. Equal to {@link FannedPoint.longitude} whenever nothing was in the way. */\n\tdisplayLongitude: number;\n}\n\n/**\n * Spread a cluster of bodies apart along a wheel so every glyph stays readable,\n * without moving any of them off its real position in the data.\n *\n * @remarks\n * Conjunctions inside a few degrees are the norm, not the exception: a\n * Sun-Mercury-Venus cluster or a stack of outer planets will pile four glyphs on\n * top of each other and print their degree labels over one another. Sorting by\n * longitude and pushing each later member forward until it clears\n * `minSeparation` is the conventional fix in professional chart software, and it\n * is why {@link FannedPoint} carries BOTH longitudes: the caller draws the glyph\n * at the display value and a leader line back to the true one, so nothing about\n * the drawing claims a position the response did not give.\n *\n * `minSeparation` is an ANGLE, so it depends on the radius the caller is drawing\n * at: the same glyph needs more degrees of arc on a small ring than a large one.\n *\n * If a cluster runs past 360 degrees the whole set slides back by the overshoot,\n * which keeps the stack anchored near its real longitudes instead of wrapping\n * one member around to the far side of the wheel.\n */\nexport function fanOut<T>(\n\titems: readonly T[],\n\tlongitudeOf: (item: T) => number,\n\tminSeparation: number,\n): FannedPoint<T>[] {\n\tconst placed: FannedPoint<T>[] = items\n\t\t.filter((item) => Number.isFinite(longitudeOf(item)))\n\t\t.map((item) => {\n\t\t\tconst longitude = normalizeLongitude(longitudeOf(item));\n\t\t\treturn { item, longitude, displayLongitude: longitude };\n\t\t})\n\t\t.sort((a, b) => a.longitude - b.longitude);\n\n\tfor (let i = 1; i < placed.length; i++) {\n\t\tconst prev = placed[i - 1];\n\t\tconst cur = placed[i];\n\t\tif (!prev || !cur) continue;\n\t\tconst wanted = prev.displayLongitude + minSeparation;\n\t\tif (cur.displayLongitude < wanted) cur.displayLongitude = wanted;\n\t}\n\n\tconst last = placed[placed.length - 1];\n\tif (last && last.displayLongitude > 360) {\n\t\tconst shift = last.displayLongitude - 360;\n\t\tfor (const p of placed) p.displayLongitude -= shift;\n\t}\n\treturn placed;\n}\n\n/**\n * Degrees of arc a mark of `width` user units occupies at `radius`, which is the\n * separation {@link fanOut} needs to keep two of them from touching. One\n * expression instead of a magic number per ring, so an inner ring automatically\n * asks for more degrees than an outer one.\n */\nexport function arcSeparation(width: number, radius: number): number {\n\treturn radius > 0 ? (width / radius) * (180 / Math.PI) : 0;\n}\n\n/** Polar to cartesian for SVG wheel positioning. Angle in degrees, 0 at 3 o'clock. */\nexport function polarToCartesian(\n\tcx: number,\n\tcy: number,\n\tradius: number,\n\tangleDeg: number,\n): { x: number; y: number } {\n\tconst angleRad = (angleDeg * Math.PI) / 180;\n\treturn {\n\t\tx: cx + radius * Math.cos(angleRad),\n\t\ty: cy + radius * Math.sin(angleRad),\n\t};\n}\n", "/**\n * Display formatters for ISO timestamps and floats coming back from the API.\n * Every helper returns \"\" for nullish or unparseable input so it falls out of\n * template literals cleanly.\n *\n * @remarks\n * **This file is the ONLY place in the library that may call `Intl` or a `toLocale*` method, and every helper that does takes the locale as its first argument, required.** Both halves are enforced by a source scan in `tests/i18n.test.ts`.\n *\n * The locale is the DISPLAY locale, the full tag `resolveLang` returns, region included. It is NOT the value that goes on `?lang=`: that one is truncated to a supported two-letter code because the API rejects anything else, and handing THAT to Intl would render every Argentine visitor's dates in Castilian conventions. `es-AR` is exactly the tag Intl wants.\n *\n * It is required rather than optional because the defect it replaces was an omission: `toLocaleDateString(undefined, ...)` means \"the locale of whoever is looking\", so a Spanish page rendered `Carta natal` above `Jan 15, 1990, 2:30 PM`, and two visitors to the same page saw two different strings. An optional parameter defaults straight back to that. A missing argument is now a typecheck failure at every call site.\n */\n\nimport { capitalize, humanize } from './string.js';\n\nconst DATE_ONLY = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst BARE_TIME = /^\\d{2}:\\d{2}(:\\d{2})?$/;\n/** An ISO datetime with NO timezone designator: a wall clock, not an instant. */\nconst NAIVE_DATETIME = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?$/;\n\n/** Canonical form per tag seen, so a page carrying an unparseable `lang` does not throw once per rendered date. */\nconst CANONICAL: Map<string, string> = new Map();\n\n/**\n * The locale list to hand Intl: the page's tag first, English behind it.\n *\n * @remarks\n * Two failure modes, both reachable from a `lang` attribute a site owner typed by hand and neither of which may reach a visitor:\n *\n * - **A structurally invalid tag throws.** `lang=\"english\"` or `lang=\"en_US\"` makes every `toLocale*` call raise a RangeError, which inside a render is a blank component rather than a wrong date. Canonicalizing behind a try/catch degrades it to English instead.\n * - **A valid-but-unknown tag falls back to the RUNTIME default**, which is the viewer's browser again, so the bug reappears for exactly the pages least likely to notice. Naming `en` as the second entry makes the fallback the page's, not the visitor's.\n *\n * No language signal at all resolves to English for the same reason the chrome catalogue does: a page that never declares a language is English as far as this library is concerned, and English chrome over German dates is the inconsistency this whole file exists to remove. `navigator.language` is deliberately absent from the chain here as it is in `resolveLang`: it is the VISITOR's preference, not the site's.\n */\nfunction intlLocales(locale: string | undefined): string[] {\n\tif (!locale) return ['en'];\n\tconst cached = CANONICAL.get(locale);\n\tif (cached) return [cached, 'en'];\n\tlet canonical = 'en';\n\ttry {\n\t\tcanonical = Intl.getCanonicalLocales(locale)[0] ?? 'en';\n\t} catch {\n\t\tcanonical = 'en';\n\t}\n\tCANONICAL.set(locale, canonical);\n\treturn [canonical, 'en'];\n}\n\n/**\n * Resolve an API timestamp to a Date plus the timezone it must be RENDERED in.\n *\n * @remarks\n * The API returns chart times naive (`2026-07-13T04:36:00`): that is 04:36 in the CHART's timezone, not UTC and not the viewer's. A wall clock must read the same for every viewer on earth, so hora at sunrise says 04:36 in Tokyo and in Chicago alike.\n *\n * Handing a naive string to `new Date()` makes the runtime interpret it in the VIEWER's zone, which is a silent corruption whenever that wall clock lands in the viewer's DST gap. In America/New_York `2026-03-08T02:30:00` does not exist, so the clock jumps and it renders as `3:30 AM`. Pinning the wall clock to UTC, which has no DST and therefore no gap, preserves the digits exactly while Intl still writes them in the PAGE locale conventions.\n *\n * An offset-bearing timestamp (`...Z`, `...+05:30`) IS a real instant, so it keeps the normal behaviour and converts to the viewer's local time.\n *\n * Deliberately NOT exported. It used to be, so a component needing a shape these helpers did not offer could pin its own wall clock and call Intl itself, which is how `dasha-timeline` came to hardcode `toLocaleString('en', ...)` and pin every boundary date to English. A shape that is missing is added here, beside the locale handling, not reimplemented in a component.\n */\nfunction resolveDisplayDate(input: string): {\n\td: Date;\n\ttimeZone?: string;\n} {\n\tconst naive = BARE_TIME.test(input)\n\t\t? `1970-01-01T${input}`\n\t\t: NAIVE_DATETIME.test(input)\n\t\t\t? input\n\t\t\t: null;\n\treturn naive\n\t\t? { d: new Date(`${naive}Z`), timeZone: 'UTC' }\n\t\t: { d: new Date(input) };\n}\n\n/**\n * The clock, in the page locale: `2:30 PM` in English, `14:30` in German.\n *\n * @remarks\n * The hour cycle is the locale's, never ours. It used to be pinned `hour12: true`, which put an AM/PM clock on every page in Europe and Latin America while the embedded form beside it labelled its own input \"formato de 24 horas\". CLDR already knows which convention each locale reads, including the ones that surprise you (`es` is 24-hour, `es-AR` is 12-hour with `p. m.`), so asserting a cycle here is asserting we know better than the locale data.\n */\nexport function formatTime(locale: string | undefined, input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (DATE_ONLY.test(input)) return '';\n\tconst { d, timeZone } = resolveDisplayDate(input);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleTimeString(intlLocales(locale), {\n\t\thour: 'numeric',\n\t\tminute: '2-digit',\n\t\ttimeZone,\n\t});\n}\n\nexport function formatDate(locale: string | undefined, input: unknown): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tconst { d, timeZone } = resolveDisplayDate(\n\t\tDATE_ONLY.test(input) ? `${input}T00:00:00` : input,\n\t);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleDateString(intlLocales(locale), {\n\t\tmonth: 'short',\n\t\tday: 'numeric',\n\t\tyear: 'numeric',\n\t\ttimeZone,\n\t});\n}\n\nexport function formatTimeRange(\n\tlocale: string | undefined,\n\tt: { start?: string; end?: string } | undefined,\n): string {\n\tif (!t) return '';\n\tconst start = formatTime(locale, t.start);\n\tconst end = formatTime(locale, t.end);\n\tif (start && end) return `${start} - ${end}`;\n\treturn start || end || '';\n}\n\n/** Two dates as one label: `Jan 1, 2026 - Jan 7, 2026`. Falls back to whichever end parses when the other is absent. */\nexport function formatDateRange(\n\tlocale: string | undefined,\n\tstart: unknown,\n\tend: unknown,\n): string {\n\tconst a = formatDate(locale, start);\n\tconst b = formatDate(locale, end);\n\tif (a && b) return `${a} - ${b}`;\n\treturn a || b;\n}\n\n/** How much of a timestamp a label shows. `time` is the whole date plus the clock. */\nexport type DateGrain = 'year' | 'month' | 'day' | 'time';\n\n/**\n * A timestamp at a chosen granularity, for an axis or a bar end where the full date would not fit.\n *\n * @remarks\n * Every grain below `year` carries the year, because a period routinely straddles new year and a label reading `28 Dec - 3 Jan` says nothing about which side moved. `year` is sliced off the string rather than formatted, since a bare four-digit year is the same in every locale this library ships and running it through Intl would introduce era and numbering-system differences into an axis tick.\n */\nexport function formatDateGrain(\n\tlocale: string | undefined,\n\tinput: unknown,\n\tgrain: DateGrain,\n): string {\n\tif (typeof input !== 'string' || input.length === 0) return '';\n\tif (grain === 'year') {\n\t\tconst m = input.match(/^(\\d{4})/);\n\t\treturn m?.[1] ?? input;\n\t}\n\tconst { d, timeZone } = resolveDisplayDate(input);\n\tif (Number.isNaN(d.getTime())) return input;\n\treturn d.toLocaleString(intlLocales(locale), {\n\t\tday: grain === 'month' ? undefined : 'numeric',\n\t\tmonth: 'short',\n\t\tyear: 'numeric',\n\t\thour: grain === 'time' ? 'numeric' : undefined,\n\t\tminute: grain === 'time' ? '2-digit' : undefined,\n\t\ttimeZone,\n\t});\n}\n\n/**\n * Month name from a 1-based month number: `January`, `enero`, `janvier`.\n *\n * @remarks\n * Two components carried a byte-identical array of twelve English month names, which is both a duplicated table and a table of something the platform already knows in every language. Anchored to a UTC noon so no timezone can roll the date into the neighbouring month.\n */\nexport function monthName(locale: string | undefined, month: unknown): string {\n\tif (typeof month !== 'number' || !Number.isInteger(month)) return '';\n\tif (month < 1 || month > 12) return '';\n\treturn new Date(Date.UTC(2000, month - 1, 1, 12)).toLocaleDateString(\n\t\tintlLocales(locale),\n\t\t{ month: 'long', timeZone: 'UTC' },\n\t);\n}\n\n/**\n * A whole number with the page locale's digit grouping: `12,345` in English, `12.345` in Spanish.\n *\n * @remarks\n * Rounds rather than truncating, so a caller testing the magnitude (`Math.round(km) === 0`) and this label agree about which side of a boundary a value fell.\n */\nexport function formatInteger(\n\tlocale: string | undefined,\n\tvalue: unknown,\n): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\treturn value.toLocaleString(intlLocales(locale), {\n\t\tmaximumFractionDigits: 0,\n\t});\n}\n\n/**\n * Format a number, dropping trailing zeros in the FRACTIONAL part only: `2.50` becomes `2.5`, `2.0` becomes `2`, and `100` stays `100`.\n *\n * @remarks\n * Guard on the decimal point, and never strip from the integer side. A naive `.replace(/\\.?0+$/, '')` over the whole string eats zeros off the INTEGER whenever there is no decimal point, so at `dp = 0` it turns `100` into `1`, `90` into `9` and `0` into the empty string.\n *\n * @example\n * ```ts\n * formatNumber(100, 0); // '100'\n * formatNumber(2.5, 1); // '2.5'\n * formatNumber(2, 1); // '2'\n * formatNumber(0, 0); // '0'\n * ```\n */\nexport function formatNumber(value: unknown, dp = 1): string {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) return '';\n\tconst fixed = value.toFixed(dp);\n\treturn fixed.includes('.') ? fixed.replace(/\\.?0+$/, '') : fixed;\n}\n\nexport function formatPercent(value: unknown, dp = 1): string {\n\tconst n = formatNumber(value, dp);\n\treturn n ? `${n}%` : '';\n}\n\n/**\n * CSS class name per aspect type. Used by natal and synastry chart aspect\n * lines so the same color encoding (harmonious vs challenging) applies in\n * both wheels. Keys are lowercase canonical names, values are CSS class\n * suffixes the chart components define in their `:host` styles.\n */\nexport const ASPECT_CLASS: Record<string, string> = {\n\tconjunction: 'aspect-conjunction',\n\tsextile: 'aspect-sextile',\n\tsquare: 'aspect-square',\n\ttrine: 'aspect-trine',\n\topposition: 'aspect-opposition',\n};\n\n/**\n * Normalize the `type` field on an aspect entry to a lowercase, hyphen-separated canonical name (`SEMI_SEXTILE` and `SEMI SEXTILE` both become `semi-sextile`). Accepts any aspect-shaped object so both natal and synastry inter-aspect entries can share this.\n *\n * @remarks\n * Spaces are folded as well as underscores because the endpoints do not agree on the separator: aspects returns `SEMI SEXTILE` where synastry returns `SEMI_SEXTILE`. Handling only the underscore left the space form failing every {@link ASPECT_CLASS} and `ASPECT_SYMBOL` lookup, so the same aspect rendered hyphenated and correctly coloured in one component and space-separated in the neutral fallback colour in another.\n */\nexport function normalizeAspect(a: { type?: string }): string {\n\treturn (a.type ?? '')\n\t\t.toLowerCase()\n\t\t.trim()\n\t\t.replace(/[\\s_]+/g, '-');\n}\n\n/**\n * Display label for an aspect: `SEMI_SEXTILE` -> `Semi-sextile`.\n *\n * The raw value is an API enum and the table column it lands in is read by practitioners, not parsers. {@link normalizeAspect} stays the lookup key for classes and glyphs; this is the human-facing form.\n */\nexport function formatAspectName(a: { type?: string }): string {\n\treturn capitalize(normalizeAspect(a));\n}\n\n/**\n * Display label for an ayanamsa identifier. `kp-newcomb` -> `KP Newcomb`.\n *\n * The raw values are API enums, and every one of them needs a human form that {@link humanize} cannot derive: KP is an initialism that must stay uppercase, and `raman` is a person, B.V. Raman, not a word. Anything unmapped degrades to a humanized slug rather than rendering the enum. That fallback is a safety net, not a licence to skip the map, since a humanized slug reads as a bare surname where a full name belongs. A test fails if the committed spec gains a frame this map lacks.\n */\nexport const AYANAMSA_LABEL: Record<string, string> = {\n\t'kp-newcomb': 'KP Newcomb',\n\t'kp-old': 'KP Old',\n\tlahiri: 'Lahiri',\n\traman: 'B.V. Raman',\n\n\tcustom: 'Custom',\n};\n\nexport function formatAyanamsa(type: unknown, degrees?: unknown): string {\n\tconst label =\n\t\ttypeof type === 'string' ? (AYANAMSA_LABEL[type] ?? humanize(type)) : '';\n\tconst deg =\n\t\ttypeof degrees === 'number' ? `${formatNumber(degrees, 2)}\\u00b0` : '';\n\tif (label && deg) return `${label} (${deg})`;\n\treturn label || deg;\n}\n\n/**\n * Date plus time in one label: `Jan 15, 1990, 2:30 PM`.\n *\n * @remarks\n * Components were concatenating a raw date and a raw time (`1990-01-15 \\u00b7 14:30:00`) while siblings rendered the same instant through {@link formatDate}. One helper keeps every card reading the same way.\n *\n * Birth details arrive as two fields rather than one timestamp, so `time` may be passed separately; it is merged into a naive datetime, which {@link formatDate} and {@link formatTime} pin to UTC so the wall clock renders identically for every viewer.\n *\n * @example\n * ```ts\n * formatDateTime('en', '1990-01-15T14:30:00'); // 'Jan 15, 1990, 2:30 PM'\n * formatDateTime('en', '1990-01-15', '14:30:00'); // 'Jan 15, 1990, 2:30 PM'\n * formatDateTime('de', '1990-01-15T14:30:00'); // '15. Jan. 1990, 14:30'\n * formatDateTime('en', '1990-01-15'); // 'Jan 15, 1990'\n * ```\n */\nexport function formatDateTime(\n\tlocale: string | undefined,\n\tinput: unknown,\n\ttime?: unknown,\n): string {\n\tconst merged =\n\t\ttypeof input === 'string' &&\n\t\tDATE_ONLY.test(input) &&\n\t\ttypeof time === 'string' &&\n\t\tBARE_TIME.test(time)\n\t\t\t? `${input}T${time}`\n\t\t\t: input;\n\tconst date = formatDate(locale, merged);\n\tconst clock = formatTime(locale, merged);\n\tif (date && clock) return `${date}, ${clock}`;\n\treturn date || clock;\n}\n\n/**\n * The Sanskrit form of a name, but only when it actually differs from the English one.\n *\n * @remarks\n * Several endpoints pair an English `name` with a `sanskritName` that is sometimes the SAME string, because the tradition and the translation coincide (a nakshatra is `Ashwini` either way). Rendering the pair unconditionally then prints `Ashwini (Ashwini)`. That guard is the whole reason this exists: it is one comparison, it is easy to leave out, and leaving it out is invisible until a reader hits a name where the two agree.\n *\n * Presentation deliberately stays with the caller, since the same fact is drawn as a parenthetical in a table cell and as a middot-separated span on a chart heading.\n */\nexport function distinctSanskrit(\n\tname: unknown,\n\tsanskritName: unknown,\n): string | undefined {\n\tif (typeof sanskritName !== 'string' || !sanskritName) return undefined;\n\treturn sanskritName === name ? undefined : sanskritName;\n}\n\n/**\n * `English (Sanskrit)` for a value that carries both, falling back to whichever one exists.\n *\n * @example\n * ```ts\n * formatWithSanskrit('Tuesday', 'Mangalavara'); // 'Tuesday (Mangalavara)'\n * formatWithSanskrit('Ashwini', 'Ashwini'); // 'Ashwini'\n * ```\n */\nexport function formatWithSanskrit(\n\tname: unknown,\n\tsanskritName: unknown,\n): string {\n\tconst english = typeof name === 'string' ? name : '';\n\tconst sanskrit = distinctSanskrit(english, sanskritName);\n\tif (!english) return sanskrit ?? '';\n\treturn sanskrit ? `${english} (${sanskrit})` : english;\n}\n", "/**\n * The value a READER sees, for a response field the API returns twice.\n *\n * @remarks\n * Several endpoints now echo a display translation beside the canonical value: `nameLocalized` next to `name`, `signLocalized` next to `sign`, `typeLocalized` next to `type`. **The canonical field is deliberately always English, whatever `?lang=` says, so it stays safe to compare against in code**, and the localized one is deliberately absent from an English response.\n *\n * That split is the whole contract, and inverting it breaks charts silently rather than loudly: `planetGlyph`, `signGlyph`, `aspectSymbol`, `ASPECT_CLASS`, `SIGNS_ORDER.indexOf`, every `Map` key and every CSS class fragment is keyed on the English name, so pointing one of them at `nameLocalized` resolves to nothing on a translated page and to the same value on an English one, which is exactly the shape of defect that passes every gate (lesson 24). **The lookup stays on the canonical value; only the printed text node, the `title` and the `aria-label` move.**\n *\n * These two helpers exist so that rule lives in one place rather than as a `??` at every call site, and so an English response, where the localized field simply is not there, degrades by construction instead of by remembering. Both take the KEY of the canonical field and derive its partner, so a mistyped key or a field that is not a display string is a compile error rather than a silent empty string.\n */\n\n/** The one naming convention every helper here derives from. Ratified by the API and spreading to more operations, so it is matched as a convention and never as a list of field names. */\nconst LOCALIZED = 'Localized';\n\n/** A response row carrying a canonical English `K` plus the optional localized partner the API writes beside it. */\nexport type Localizable<K extends string> = Partial<\n\tRecord<K | `${K}Localized`, string>\n>;\n\n/** The same pairing where the value is a LIST of names, e.g. `retrogradePlanets`. */\nexport type LocalizableList<K extends string> = Partial<\n\tRecord<K | `${K}Localized`, string[]>\n>;\n\n/**\n * The text to print for `key`: the localized value when the response carried one, else the English one.\n *\n * @param english - What to print in the English case INSTEAD of the raw field, for a canonical value that is an API enum with a display form of its own (`type` is `SEMI_SEXTILE` on the wire and `Semi-sextile` on screen). Omit it wherever the canonical value is already the readable one.\n *\n * @example\n * ```ts\n * display(planet, 'name'); // 'Sol' on ?lang=es, 'Sun' on English\n * planetGlyph(planet.name) ?? display(planet, 'name'); // the lookup stays English, the fallback TEXT does not\n * display(aspect, 'type', formatAspectName(aspect)); // 'Tr\u00EDgono', else 'Trine' and never 'TRINE'\n * ```\n */\nexport function display<\n\tT extends Localizable<K>,\n\tK extends Extract<keyof T, string>,\n>(row: T | null | undefined, key: K, english?: string): string {\n\tconst rec = row as Record<string, unknown> | null | undefined;\n\tconst localized = rec?.[`${key}${LOCALIZED}`];\n\tif (typeof localized === 'string' && localized !== '') return localized;\n\tif (english !== undefined) return english;\n\tconst canonical = rec?.[key];\n\treturn typeof canonical === 'string' ? canonical : '';\n}\n\n/**\n * A list field as `{ value, label }` pairs: the English `value` every lookup is keyed on, and the `label` a reader sees.\n *\n * @remarks\n * The localized array is INDEX-ALIGNED with the canonical one, which is the only thing that makes the pairing possible, so it is zipped by position and neither side is ever sorted, filtered or deduped on its own. A list that is short or absent falls back per item, so a partial translation still resolves every glyph.\n */\nexport function displayList<\n\tT extends LocalizableList<K>,\n\tK extends Extract<keyof T, string>,\n>(row: T | null | undefined, key: K): Array<{ value: string; label: string }> {\n\tconst rec = row as Record<string, unknown> | null | undefined;\n\tconst canonical = rec?.[key];\n\tif (!Array.isArray(canonical)) return [];\n\tconst localized = rec?.[`${key}${LOCALIZED}`];\n\tconst labels = Array.isArray(localized) ? localized : [];\n\treturn canonical.map((value, i) => {\n\t\tconst label = labels[i];\n\t\treturn {\n\t\t\tvalue: String(value),\n\t\t\tlabel: typeof label === 'string' && label !== '' ? label : String(value),\n\t\t};\n\t});\n}\n\n/**\n * Fold every `XLocalized` field into its `X` partner: the reader's value under the canonical NAME, and the duplicate key gone.\n *\n * @remarks\n * For a renderer that has no idea what its fields MEAN and derives its columns from `Object.keys(row)`, which is how `<roxy-data>` started drawing `Planet | Planet Localized | Longitude | Sign | Sign Localized` the day the API began sending both. Two extra columns, headed in English, carrying the same fact twice, on a page whose owner changed nothing. That is a regression rather than a missing feature, so it is repaired at the key layer every render path already funnels through rather than at each of them.\n *\n * Three rules, and each has a way of going wrong:\n *\n * - **A `*Localized` key with no canonical partner stays put.** Suppressing on the name alone deletes data the response carries and nothing else is rendering.\n * - **The canonical key keeps its POSITION**, so a translated response and an English one lay out identically, column for column.\n * - **A row with nothing to fold is returned as the same object**, so the English path is not merely equivalent but untouched.\n *\n * The English value is dropped rather than shown beside its translation because the two are the same fact, and the caller here is generic: it cannot know that `sign` is the value a lookup would be keyed on. A component that needs both halves reads them itself with {@link display}.\n */\nexport function foldLocalized<V>(row: Record<string, V>): Record<string, V> {\n\tlet folded: Record<string, V> | undefined;\n\tfor (const key of Object.keys(row)) {\n\t\tif (!key.endsWith(LOCALIZED)) continue;\n\t\tconst base = key.slice(0, -LOCALIZED.length);\n\t\tif (base === '' || !(base in row)) continue;\n\t\tfolded ??= { ...row };\n\t\tconst value = row[key];\n\t\tif (value !== undefined && value !== null && value !== '')\n\t\t\tfolded[base] = value;\n\t\tdelete folded[key];\n\t}\n\treturn folded ?? row;\n}\n", "import type { TemplateResult } from 'lit';\nimport { css, html, nothing } from 'lit';\n\n/** A single tab in a {@link renderTablist} strip. */\nexport interface TablistItem<T extends string = string> {\n\tid: T;\n\tlabel: string;\n}\n\n/**\n * Shared styling for every horizontal tab strip in the library (natal chart\n * views, transits, kundli styles). Keeping one rule set means the tabs look\n * identical everywhere and theme through the same --roxy-* tokens.\n */\nexport const tablistStyles = css`.roxy-tablist{border-bottom:2px solid var(--roxy-border,#e4e4e7);scrollbar-width:thin;gap:2px;min-width:0;display:flex;overflow-x:auto}.roxy-tab{padding:var(--roxy-space-xs,.25rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-sm,.875rem);cursor:pointer;color:var(--roxy-muted,#71717a);transition:color var(--roxy-motion-duration,.2s) var(--roxy-motion-easing,ease);background:0 0;border:none;border-bottom:2px solid #0000;flex-shrink:0;margin-bottom:-2px;font-family:inherit}.roxy-tab[aria-selected=true]{color:var(--roxy-accent-ink,#b45309);border-bottom-color:var(--roxy-accent,#f59e0b);font-weight:var(--roxy-weight-bold,600)}.roxy-tab:hover:not([aria-selected=true]){color:var(--roxy-fg,#0a0a0a)}.roxy-tab:focus-visible{outline:2px solid var(--roxy-ring,#f59e0b66);outline-offset:-2px;border-radius:4px}`;\n\n/**\n * Render a WAI-ARIA tablist. The host component owns the active-tab state; this\n * helper draws the buttons, wires click plus Left/Right arrow navigation with a\n * roving tabindex, and moves focus to the newly selected tab. Pair with\n * {@link tablistStyles}.\n *\n * The strip carries `part=\"tablist\"` and each button `part=\"tab\"`, so a host page can restyle or hide the view switch from outside the shadow root without knowing which component drew it.\n *\n * Pass `controls: true` when each tab governs a sibling\n * `<div role=\"tabpanel\" id=\"${idPrefix}-panel-${id}\">` so the buttons advertise\n * `aria-controls`. The host renders only the ACTIVE panel; this helper emits an\n * empty hidden panel for each of the others so the `aria-controls` on every tab\n * resolves. Omit it for tablists that swap a single rendered view in place with\n * no separate panel element (the kundli style switch).\n *\n * @example\n * ```ts\n * renderTablist({\n * items: [{ id: 'wheel', label: 'Wheel' }, { id: 'grid', label: 'Aspect grid' }],\n * active: this.view,\n * onSelect: (v) => { this.view = v; },\n * label: 'Natal chart views',\n * idPrefix: 'natal',\n * controls: true,\n * })\n * ```\n */\nexport function renderTablist<T extends string>(opts: {\n\titems: ReadonlyArray<TablistItem<T>>;\n\tactive: T;\n\tonSelect: (id: T) => void;\n\tlabel: string;\n\tidPrefix: string;\n\tcontrols?: boolean;\n}): TemplateResult {\n\tconst { items, active, onSelect, label, idPrefix, controls = false } = opts;\n\tconst onKeyDown = (e: KeyboardEvent) => {\n\t\tif (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return;\n\t\te.preventDefault();\n\t\tconst idx = items.findIndex((it) => it.id === active);\n\t\tif (idx === -1) return;\n\t\tconst delta = e.key === 'ArrowRight' ? 1 : -1;\n\t\tconst next = items[(idx + delta + items.length) % items.length];\n\t\tif (!next) return;\n\t\tonSelect(next.id);\n\t\tconst root = (e.currentTarget as HTMLElement).getRootNode() as\n\t\t\t| ShadowRoot\n\t\t\t| Document;\n\t\trequestAnimationFrame(() => {\n\t\t\troot\n\t\t\t\t.querySelector<HTMLButtonElement>(`#${idPrefix}-tab-${next.id}`)\n\t\t\t\t?.focus();\n\t\t});\n\t};\n\treturn html`<div class=\"roxy-tablist\" part=\"tablist\" role=\"tablist\" aria-label=\"${label}\" @keydown=\"${onKeyDown}\">${items.map(\n\t\t\t(it) => html`<button type=\"button\" class=\"roxy-tab\" part=\"tab\" role=\"tab\" id=\"${idPrefix}-tab-${it.id}\" aria-selected=\"${active === it.id ? 'true' : 'false'}\" aria-controls=\"${controls ? `${idPrefix}-panel-${it.id}` : nothing}\" tabindex=\"${active === it.id ? '0' : '-1'}\" @click=\"${() => onSelect(it.id)}\">${it.label}</button>`,\n\t\t)}</div>${\n\t\t/**\n\t\t * Stand-in panels for the tabs that are not selected.\n\t\t *\n\t\t * The APG requires `aria-controls` on EVERY tab, not just the active one, and it must resolve to a real `tabpanel`. Components render one panel at a time, so without these the other tabs either carried a dangling IDREF or, as here previously, dropped the attribute and lost the relationship entirely: a screen reader user could not tell what any inactive tab governed.\n\t\t *\n\t\t * Empty and `hidden`, so they cost two nodes and no layout, and the panel content stays lazy: a natal chart does not build its wheel, aspect grid and positions table all at once just to satisfy an IDREF. The host still renders the ACTIVE panel itself, at `${idPrefix}-panel-${active}`, which is why these skip it.\n\t\t */\n\t\tcontrols\n\t\t\t? items\n\t\t\t\t\t.filter((it) => it.id !== active)\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(it) => html`<div role=\"tabpanel\" id=\"${idPrefix}-panel-${it.id}\" aria-labelledby=\"${idPrefix}-tab-${it.id}\" hidden></div>`,\n\t\t\t\t\t)\n\t\t\t: nothing\n\t}`;\n}\n"],
5
+ "mappings": "4MAAA,OAAS,OAAAA,GAAK,QAAAC,EAAM,WAAAC,MAAe,MACnC,OAA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0I,GAAYC,GAAyBC,EAAYD,CAAI,GAAK,GAgBnDE,EAAN,cAAkCC,CAAyC,CAMvE,aAAc,CACvB,OAAOC,iEACR,CAEU,WAAWC,EAA+B,CACnD,IAAMC,EAAID,EAAK,QACf,OAAOD,uFAA0FG,GAAU,KAAK,cAAc,CAAC,CAAC,kLAAkL,KAAK,YAAY,YAAYF,CAAI,0JAC/U,OAAOC,GAAG,YAAe,SACtBF,UAIA,KAAK,MAAME,EAAE,UAAU,IAAM,EAC1B,yBACA,GAAGE,GAAc,KAAK,cAAc,EAAGF,EAAE,UAAU,CAAC,OAAOA,EAAE,WAAa,EAAE,gBAChF,UACCG,CACJ,IACCH,EACGF,UAMAC,EAAK,WAAW,KACb,aAAaC,EAAE,qBAAuB,WAAa,UAAU,IAAID,EAAK,UAAU,IAAI,GACpFC,EAAE,qBACD,yBACA,0BACL,UACCG,CACJ,SAGAJ,EAAK,gBAAgB,SAAW,CAAC,KAAK,aACnCD,uBAA0BC,EAAK,eAAe,OAAO,OACrDI,CACJ,IACCH,GAAG,gBAAgB,OAChBF,0GAA6GE,EAAE,eAAe,IAAKI,GAAMN,uBAA0BL,GAASW,CAAC,CAAC,IAAIA,CAAC,SAAS,CAAC,eAC7LD,CACJ,yFACEH,GAAG,qBAAqB,OACrBF,2BAA8BE,EAAE,oBAAoB,IACnDK,GACAP,QAAWL,GAASY,EAAE,MAAM,CAAC,IAAIA,EAAE,MAAM,WAAWA,EAAE,UAAU,kCAAkCA,EAAE,cAAc,OACpH,CAAC,QACAP,sEACJ,wBACJ,CACD,EAzDaF,EACL,OAAS,CACfU,EACAC,26CACD,EAJYX,EAANY,EAAA,CADNC,GAAc,uBAAuB,GACzBb",
6
6
  "names": ["css", "html", "nothing", "customElement", "ifDefined", "css", "html", "nothing", "svg", "customElement", "property", "state", "lookupKey", "capitalize", "resolve", "table", "name", "lookupKey", "PLANET_GLYPH", "planetGlyph", "SIGN_GLYPH", "signGlyph", "name", "resolve", "SIGNS_ORDER", "ASPECT_SYMBOL", "aspectSymbol", "name", "resolve", "html", "LitElement", "nothing", "property", "state", "ifDefined", "resolveLang", "el", "inherited", "GLOBAL_KEY", "registry", "holder", "existing", "created", "interpolate", "template", "vars", "match", "key", "translate", "lang", "source", "catalogs", "registry", "tag", "catalog", "lookupKey", "onLocaleChange", "listener", "listeners", "LocaleController", "host", "onLocaleChange", "css", "baseStyles", "KEY_REFUSED_MESSAGE", "keyIsRefused", "key", "dispatchKeyRefusal", "host", "opts", "KEY_REFUSED_MESSAGE", "DEFAULT_BASE_URL", "FetchController", "host", "req", "controller", "res", "json", "err", "signal", "url", "k", "v", "headers", "keyIsRefused", "KEY_REFUSED_MESSAGE", "dispatchKeyRefusal", "body", "buildRequest", "endpoint", "method", "values", "queryKeys", "rest", "path", "_match", "name", "inQuery", "query", "css", "html", "nothing", "css", "html", "chevron", "disclosureStyles", "interpAccordionStyles", "css", "renderInterpAccordion", "sections", "name", "heading", "shown", "s", "nothing", "html", "i", "chevron", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "ROXY_DATA_CLASS", "text", "RoxyDataElement", "LitElement", "source", "vars", "detail", "buildRequest", "MarkupDataController", "LocaleController", "FetchController", "baseStyles", "translate", "changed", "html", "sections", "name", "heading", "nothing", "renderInterpAccordion", "data", "body", "ifDefined", "resolveLang", "raw", "values", "message", "banner", "__decorateClass", "property", "state", "normalizeLongitude", "lon", "wrapped", "longitudeToSignPosition", "longitude", "signIndex", "within", "degree", "minuteFloat", "minute", "second", "SIGNS_ORDER", "oppositePoint", "longitude", "normalizeLongitude", "arcMidpoint", "start", "end", "s", "span", "polarToCartesian", "cx", "cy", "radius", "angleDeg", "angleRad", "DATE_ONLY", "BARE_TIME", "NAIVE_DATETIME", "CANONICAL", "intlLocales", "locale", "cached", "canonical", "resolveDisplayDate", "input", "naive", "formatTime", "d", "timeZone", "formatDate", "formatInteger", "locale", "value", "intlLocales", "formatNumber", "dp", "fixed", "ASPECT_CLASS", "normalizeAspect", "a", "formatAspectName", "capitalize", "formatDateTime", "locale", "input", "time", "merged", "DATE_ONLY", "BARE_TIME", "date", "formatDate", "clock", "formatTime", "LOCALIZED", "display", "row", "key", "english", "rec", "localized", "canonical", "displayList", "labels", "value", "label", "css", "html", "nothing", "tablistStyles", "renderTablist", "opts", "items", "active", "onSelect", "label", "idPrefix", "controls", "e", "idx", "it", "delta", "next", "root", "PATTERN_ORDER", "SIZE", "CENTER", "OUTER_R", "SIGN_R", "HOUSE_R", "PLANET_R", "ANGLE_TICK_R", "ANGLE_LABEL_R", "RoxyNatalChart", "RoxyDataElement", "m", "lon", "html", "data", "planets", "aspects", "view", "formatDateTime", "nothing", "renderTablist", "v", "bodies", "p", "display", "pairKey", "a", "b", "lookupKey", "byPair", "g", "planetGlyph", "row", "ri", "rowGlyph", "col", "name", "normalizeAspect", "sym", "aspectSymbol", "formatAspectName", "cls", "ASPECT_CLASS", "orb", "formatNumber", "asc", "mc", "items", "oppositePoint", "pof", "normalizeLongitude", "vertex", "longitude", "label", "angle", "tickInner", "polarToCartesian", "tickOuter", "labelPos", "svg", "houses", "h", "_", "i", "start", "end", "SIGNS_ORDER", "sign", "pos", "signGlyph", "house", "next", "mid", "arcMidpoint", "ascSignIndex", "houseNum", "ticks", "deg", "isMajor", "inner", "sp", "longitudeToSignPosition", "sorted", "prev", "cur", "wanted", "last", "shift", "s", "trueLon", "displayLon", "trueAngle", "displayAngle", "glyphPos", "degPos", "rimPos", "leaderInner", "glyph", "retro", "degLabel", "offset", "summary", "ai", "retrogrades", "displayList", "value", "ELEMENTS", "MODALITIES", "ELEMENT_LABEL", "MODALITY_LABEL", "order", "dominantEl", "capitalize", "dominantMod", "cells", "el", "placed", "idx", "mod", "colTotal", "isDomRow", "rowTotal", "patterns", "ordered", "isApex", "sections", "interp", "lead", "detail", "k", "planetMap", "l1", "l2", "p1", "p2", "aspectName", "aspectClass", "orbLabel", "baseStyles", "tablistStyles", "disclosureStyles", "interpAccordionStyles", "css", "__decorateClass", "property", "state", "customElement", "glyphFor", "name", "planetGlyph", "RoxyRelocationWheel", "RoxyDataElement", "html", "data", "c", "ifDefined", "formatInteger", "nothing", "p", "m", "baseStyles", "css", "__decorateClass", "customElement"]
7
7
  }