@roxyapi/ui 0.31.0 → 0.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/hd-connection.ts", "../../src/utils/base-element.ts", "../../src/i18n/localized-element.ts", "../../src/i18n/lang.ts", "../../src/utils/string.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/bodygraph-render.ts", "../../src/utils/bodygraph-styles.ts", "../../src/utils/hd-reading.ts"],
4
- "sourcesContent": ["import { css, html, nothing } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport type { CalculateConnectionResponse } from '../types/index.js';\nimport { RoxyDataElement } from '../utils/base-element.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport {\n\tBODYGRAPH_VIEWBOX,\n\ttype BodygraphCenterId,\n\ttype GateSources,\n\trenderBodygraphSvg,\n} from '../utils/bodygraph-render.js';\nimport { bodygraphChartStyles } from '../utils/bodygraph-styles.js';\nimport { disclosureStyles } from '../utils/disclosure.js';\nimport { hdReadingStyles, renderHdFacts } from '../utils/hd-reading.js';\nimport {\n\ttype InterpSection,\n\tinterpAccordionStyles,\n} from '../utils/interp-accordion.js';\nimport { humanize } from '../utils/string.js';\n\ntype Connection = CalculateConnectionResponse;\ntype ConnectionChannel = Connection['channels'][number];\ntype CombinedCenter = Connection['centers'][number];\n\n/**\n * Human Design connection chart. Renders /human-design/connection: the composite of two charts as the electromagnetic / compromise / dominance channels they form together, plus the combined definition and a summary. The HD analog of synastry. Each channel row shows its two gates, name, circuit, the relationship dynamic, and which person carries which gate.\n *\n * @remarks\n * The chart answers one question: what exists between these two that does not exist in either of them alone. It leads with the combined bodygraph, drawn on the same geometry a single chart uses with each gate marked for whoever carries it, then the combined centers, then the channel list. `defined` is the state of the COMBINED bodygraph, `definedBy` names who already defines that center in their own chart, and the gap between the two is the reading: a center that comes back defined with an empty `definedBy` is defined by the connection itself, present when the two are together and absent when they are apart.\n *\n * The four dynamics are the taxonomy the summary counts, and a bare count of \"Dominance: 2\" means nothing to a reader who does not already know the system, so each one carries its definition behind the shared disclosure rather than shipping as a bare label.\n */\n@customElement('roxy-hd-connection')\nexport class RoxyHdConnection extends RoxyDataElement<Connection> {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tdisclosureStyles,\n\t\tinterpAccordionStyles,\n\t\thdReadingStyles,\n\t\tbodygraphChartStyles,\n\t\tcss`.wrap{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);grid-template-columns:minmax(0,1fr);display:grid}.head{justify-content:space-between;align-items:baseline;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.count{color:var(--roxy-accent-ink,#b45309);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);font-variant-numeric:tabular-nums}.note{margin:0 0 var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);line-height:1.6}.row{align-items:center;gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-sm,.5rem) 0;border-bottom:1px solid var(--roxy-border,#e4e4e7);font-size:var(--roxy-text-sm,.875rem);flex-wrap:wrap;display:flex}.row:last-child{border-bottom:none}.cname{flex:1;min-width:8rem}.badge{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);font-weight:var(--roxy-weight-bold,600);padding:1px 8px;display:inline-flex}.badge.defined{background:color-mix(in srgb, var(--roxy-success,#16a34a) 16%, transparent);color:var(--roxy-success-fg,#166534)}.badge.open{background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 45%, transparent);color:var(--roxy-fg,#0a0a0a)}.badge.together{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 18%, transparent);color:var(--roxy-fg,#0a0a0a)}.who{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem)}table{border-collapse:collapse;width:100%;font-size:var(--roxy-text-sm,.875rem)}th,td{text-align:left;padding:var(--roxy-space-sm,.5rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);white-space:nowrap}th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;font-size:var(--roxy-text-xs,.75rem);letter-spacing:.04em}tbody tr:last-child td{border-bottom:none}.gates{font-variant-numeric:tabular-nums;color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.dyn{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:1px 8px;display:inline-block}.held{font-variant-numeric:tabular-nums}.scroll{min-width:0;overflow-x:auto}.wrap{--src-left:#1f6fb2;--src-right:#b04e14;--src-ink:#fff}`,\n\t];\n\n\t/**\n\t * The combined bodygraph the two charts make together, on the same geometry a\n\t * single chart uses.\n\t *\n\t * @remarks\n\t * A gate is marked for whoever carries it, so a channel each person half owns\n\t * draws in two colours and a channel one person holds outright draws in one.\n\t * That is the electromagnetic and dominance distinction the summary counts,\n\t * shown rather than tallied. Centers take the COMBINED state, which is the\n\t * chart the two of them are when together; who defines one alone is named in\n\t * the centers section, where the badge can say it in words.\n\t */\n\tprivate renderChart(d: Connection) {\n\t\tconst gateSources = new Map<number, GateSources>();\n\t\tfor (const c of d.channels ?? []) {\n\t\t\tconst left = new Set(c.personAGates ?? []);\n\t\t\tconst right = new Set(c.personBGates ?? []);\n\t\t\tfor (const gate of [c.gateA, c.gateB]) {\n\t\t\t\tif (gate == null) continue;\n\t\t\t\tconst held = gateSources.get(gate) ?? { left: false, right: false };\n\t\t\t\theld.left ||= left.has(gate);\n\t\t\t\theld.right ||= right.has(gate);\n\t\t\t\tgateSources.set(gate, held);\n\t\t\t}\n\t\t}\n\t\tconst definedCenters = new Set<BodygraphCenterId>(\n\t\t\t(d.centers ?? [])\n\t\t\t\t.filter((c) => c.defined)\n\t\t\t\t.map((c) => c.id as BodygraphCenterId),\n\t\t);\n\t\tconst centerNames = new Map<BodygraphCenterId, string>(\n\t\t\t(d.centers ?? []).map((c) => [c.id as BodygraphCenterId, c.name]),\n\t\t);\n\t\tconst gateTitles = new Map<number, string>();\n\t\tfor (const c of d.channels ?? []) {\n\t\t\tconst name = c.name;\n\t\t\tfor (const gate of [c.gateA, c.gateB]) {\n\t\t\t\tif (gate == null) continue;\n\t\t\t\tconst held = gateSources.get(gate);\n\t\t\t\tconst who = [held?.left && 'A', held?.right && 'B']\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(' + ');\n\t\t\t\tgateTitles.set(\n\t\t\t\t\tgate,\n\t\t\t\t\t[`Gate ${gate}`, name, who].filter(Boolean).join(' · '),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn html`<svg class=\"chart\" part=\"chart\" viewBox=\"${BODYGRAPH_VIEWBOX}\" preserveAspectRatio=\"xMidYMid meet\" role=\"img\" aria-label=\"Combined Human Design bodygraph for two charts, with each gate marked for the person who carries it\"><title>Combined bodygraph</title>${renderBodygraphSvg({\n\t\t\t\tdefinedCenters,\n\t\t\t\tgateSources,\n\t\t\t\tgateTitles,\n\t\t\t\tcenterNames,\n\t\t\t\tstateWords: { defined: 'Defined', open: 'Open' },\n\t\t\t})}</svg><div class=\"legend\" part=\"legend\"><span><span class=\"swatch source src-left\"></span>Person A</span> <span><span class=\"swatch source src-right\"></span>Person B</span> <span><span class=\"swatch\"></span>Open center</span></div>`;\n\t}\n\n\tprotected renderData(d: Connection) {\n\t\tconst channels = d.channels ?? [];\n\t\tconst centers = d.centers ?? [];\n\t\tconst definedCenters = centers.filter((c) => c.defined).length;\n\n\t\treturn html`<div class=\"wrap\" part=\"card\" aria-label=\"Human Design connection\"><header class=\"head\" part=\"header\"><h2 class=\"title\">Connection</h2>${typeof d.totalChannels === 'number' ? html`<span class=\"count\">${d.totalChannels} channels</span>` : nothing}</header>${this.renderChart(d)} ${renderHdFacts([\n\t\t\t\t{ label: 'Channels', value: d.totalChannels?.toString() },\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Combined definition',\n\t\t\t\t\tvalue: d.combinedDefinition\n\t\t\t\t\t\t? humanize(String(d.combinedDefinition))\n\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Centers defined',\n\t\t\t\t\tvalue:\n\t\t\t\t\t\tcenters.length > 0\n\t\t\t\t\t\t\t? `${definedCenters} of ${centers.length}`\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t])} ${\n\t\t\t\tthis.hideReadings\n\t\t\t\t\t? nothing\n\t\t\t\t\t: html`<p class=\"lead\">A connection chart reads the two charts as one bodygraph. Wherever the two of them together hold both gates of a channel, that channel is defined between them, and the centers it joins are defined in the connection whether or not either person defines them alone.</p>`\n\t\t\t} ${this.renderDynamics(d.summary)} ${this.renderCenters(centers)} ${this.renderChannels(channels, centers)}</div>`;\n\t}\n\n\t/**\n\t * The four ways two charts can meet in a channel, in canonical order, each with what it means. The count is the aside, so the taxonomy and the tally read as one thing: a dynamic with no channels still shows, because its absence is as much a fact of the connection as its presence.\n\t */\n\tprivate renderDynamics(s: Connection['summary'] | undefined) {\n\t\tif (!s) return nothing;\n\t\tconst sections: InterpSection[] = [\n\t\t\t{\n\t\t\t\tlabel: 'Electromagnetic',\n\t\t\t\taside: channelCount(s.electromagnetic),\n\t\t\t\tbody: 'Each person holds one of the two gates, so the channel completes only when they are together. The classic point of attraction.',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'Dominance',\n\t\t\t\taside: channelCount(s.dominance),\n\t\t\t\tbody: 'One person holds both gates and the other holds neither, so the conditioning runs one way, from the person who carries the channel to the person who does not.',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'Compromise',\n\t\t\t\taside: channelCount(s.compromise),\n\t\t\t\tbody: 'One person holds both gates and the other holds a single hanging gate of the same channel, so the channel is complete for one of them and half open for the other.',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'Companionship',\n\t\t\t\taside: channelCount(s.companionship),\n\t\t\t\tbody: 'Both people independently hold both gates, so neither needs the other to complete it. A shared and familiar frequency rather than an attraction.',\n\t\t\t},\n\t\t];\n\t\treturn this.renderInterpretation(\n\t\t\tsections,\n\t\t\t'hd-connection-dynamic',\n\t\t\t'Dynamics',\n\t\t);\n\t}\n\n\t/**\n\t * The nine centers of the combined chart. `defined` is the combined state and `definedBy` is who carries it alone, so the two together say whether a center is brought to the connection or created by it.\n\t */\n\tprivate renderCenters(centers: CombinedCenter[]) {\n\t\tif (centers.length === 0) return nothing;\n\t\treturn html`<section class=\"block\" part=\"section centers\"><h3>Centers</h3>${\n\t\t\t\t// The rows below are the state of each center and stay; this note is the\n\t\t\t\t// explanation of how to read them.\n\t\t\t\tthis.hideReadings\n\t\t\t\t\t? nothing\n\t\t\t\t\t: html`<p class=\"note\">Defined is the state of the combined chart. Beside it is who already defines that center in their own chart. A center defined only together is what the connection itself creates: it is there when the two are together and gone when they are apart. The combined definition counts how the defined centers hang together, so Single is one connected piece and a split is more than one.</p>`\n\t\t\t} ${centers.map((c) => {\n\t\t\t\tconst by = c.definedBy ?? [];\n\t\t\t\tconst a = by.includes('A');\n\t\t\t\tconst b = by.includes('B');\n\t\t\t\t// Only the connection defines it: defined in the combined chart, and in\n\t\t\t\t// neither chart on its own.\n\t\t\t\tconst together = Boolean(c.defined) && !a && !b;\n\t\t\t\treturn html`<div class=\"row\"><span class=\"cname\">${c.name ?? humanize(String(c.id ?? ''))}</span> <span class=\"badge ${c.defined ? (together ? 'together' : 'defined') : 'open'}\">${c.defined ? (together ? 'Only together' : 'Defined') : 'Open'} </span><span class=\"who\">${centerWho(Boolean(c.defined), a, b)}</span></div>`;\n\t\t\t})}</section>`;\n\t}\n\n\t/**\n\t * Every connected channel. The centers a channel joins are named, not left as ids, because the row is what explains a defined center in the block above: this is the wiring that produced it.\n\t */\n\tprivate renderChannels(\n\t\tchannels: ConnectionChannel[],\n\t\tcenters: CombinedCenter[],\n\t) {\n\t\tif (channels.length === 0) return nothing;\n\t\tconst names = new Map(\n\t\t\tcenters.map((c) => [String(c.id ?? ''), c.name ?? ''] as const),\n\t\t);\n\t\tconst centerName = (id: string) => names.get(id) || humanize(id);\n\n\t\treturn html`<section class=\"block\" part=\"section channels\"><h3>Channels</h3><div class=\"scroll\" part=\"table\" tabindex=\"0\" role=\"region\" aria-label=\"Connection channels\"><table role=\"table\"><caption class=\"roxy-sr-only\">Connection channels: each channel with its gates, the centers it links, its circuit and dynamic, and the gates person A and person B each hold.</caption><thead><tr><th scope=\"col\">Channel</th><th scope=\"col\">Gates</th><th scope=\"col\">Centers</th><th scope=\"col\">Circuit</th><th scope=\"col\">Dynamic</th><th scope=\"col\">Person A holds</th><th scope=\"col\">Person B holds</th></tr></thead><tbody>${channels.map(\n\t\t\t\t\t\t\t(c) => html`<tr><td>${c.name ?? ''}</td><td class=\"gates\">${c.gateA}-${c.gateB}</td><td>${(c.centers ?? []).map(centerName).join(' to ')}</td><td>${c.circuit ?? ''}</td><td>${c.dynamic ? html`<span class=\"dyn\">${c.dynamic}</span>` : nothing}</td><td class=\"held\">${gateList(c.personAGates)}</td><td class=\"held\">${gateList(c.personBGates)}</td></tr>`,\n\t\t\t\t\t\t)}</tbody></table></div></section>`;\n\t}\n}\n\n/** The aside of a dynamic. A zero is stated rather than hidden: no companionship channels is a finding about the pair. */\nfunction channelCount(n: number | undefined): string | undefined {\n\tif (typeof n !== 'number') return undefined;\n\tif (n === 0) return 'None';\n\treturn n === 1 ? '1 channel' : `${n} channels`;\n}\n\n/** Which gates of the channel this person carries. Neither is possible: a dominance channel is held entirely by the other person. */\nfunction gateList(gates: number[] | undefined): string {\n\tconst list = gates ?? [];\n\treturn list.length > 0 ? list.join(', ') : 'Neither';\n}\n\n/** Who defines the center in their own chart, spelled out. `definedBy` is empty both when the center is open in both charts and when only the connection defines it, so the combined state has to disambiguate. */\nfunction centerWho(defined: boolean, a: boolean, b: boolean): string {\n\tif (a && b) return 'Defined in both charts';\n\tif (a) return 'Defined by A';\n\tif (b) return 'Defined by B';\n\treturn defined\n\t\t? 'Defined by neither alone, only by the connection'\n\t\t: 'Open in both charts';\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-hd-connection': RoxyHdConnection;\n\t}\n}\n", "import { type CSSResultGroup, html, nothing, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type { ChromeString } from '../i18n/chrome-strings.js';\nimport { RoxyLocalizedElement } from '../i18n/localized-element.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 = …` 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`, `empty`, `edit-bar`, `attribution`). A component adds `part` to its own structural blocks, drawn from the published part vocabulary.\n *\n * Translation is inherited rather than defined here: `t()`, `translator` and `effectiveLang()` live on {@link RoxyLocalizedElement}, which the two declared widgets extend as well, so the form a visitor fills and the card it produces read the same catalogue.\n *\n * @example\n * ```ts\n * @customElement('roxy-dream-card')\n * export class RoxyDreamCard extends RoxyDataElement<GetDreamSymbolResponse> {\n * static styles = [baseStyles, css`.card { … }`];\n * protected renderData(d: GetDreamSymbolResponse) {\n * return html`<article class=\"card\">…</article>`;\n * }\n * }\n * ```\n */\nexport abstract class RoxyDataElement<\n\tT = unknown,\n> extends RoxyLocalizedElement {\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/**\n\t * Remove named structural blocks from this component, as a comma-separated list of `part` names.\n\t *\n\t * @remarks\n\t * The sibling of {@link RoxyDataElement.hideReadings} and deliberately a different tool. `hide-readings` drops the PROSE an endpoint returns about a result; this drops a whole block whatever it contains, which is what a page wants when the block is measurement rather than writing. Hiding the chart-pattern list on a teaching page is the case it exists for: a T-square is data, so `hide-readings` leaves it standing on purpose.\n\t *\n\t * Any name in `components-catalog.json` works, on any component that publishes it, because the rule is generated from the name rather than from a list of components that opted in. A name no block carries costs nothing and hides nothing.\n\t *\n\t * **This hides with CSS, it does not remove from the DOM, and the difference is the reason both exist.** A part name is a rendering concern the base can act on generically; whether a block is prose is a question only the component can answer. So a page that must not SHIP the words uses `hide-readings`, and a page that just should not SHOW a block uses this.\n\t *\n\t * @example\n\t * ```html\n\t * <roxy-natal-chart hide-sections=\"patterns\"></roxy-natal-chart>\n\t * <roxy-natal-chart hide-sections=\"patterns, aspects\"></roxy-natal-chart>\n\t * ```\n\t */\n\t@property({ type: String, attribute: 'hide-sections', reflect: true })\n\thideSections = '';\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\tthis.fetcher = new FetchController<T>(this);\n\t}\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\treturn html`${this.hiddenSectionsStyle()}${this.renderState()}`;\n\t}\n\n\t/**\n\t * The one rule set that acts on {@link RoxyDataElement.hideSections}, generated from the names rather than from a list of components.\n\t *\n\t * @remarks\n\t * `[part~=\"name\"]` is the selector because `part` is a space-separated list: the natal chart's aspect grid carries `section aspects table aspect-grid`, so a `~=` match reaches it by any one of its names while `=` would reach it by none. It is emitted INSIDE the shadow root, which is the only place a rule can see a `part` attribute on the element that declares it.\n\t *\n\t * Names are filtered to the same `[a-z][a-z0-9-]*` shape the catalog and the WordPress setting both use, so nothing a page passes can close the rule or inject a second one. An unknown name compiles to a selector that matches nothing, which is why there is no validation error and no list of legal names to keep in sync.\n\t *\n\t * A `<style>` element in the template rather than a static stylesheet, because static styles are evaluated once and shared across every instance, so two charts on one page could not hide different blocks. Lit supports per-instance style elements; the documented cost is a re-parse when the expression changes, which is irrelevant here because the value is set once from a page attribute and effectively never changes after that.\n\t *\n\t * **`!important` is load-bearing and is not a shortcut around specificity.** Lit puts static `styles` in `adoptedStyleSheets`, and the scoping spec applies those AFTER any `<style>` element inside the same shadow root, so an in-tree rule loses to the component's own stylesheet at equal specificity no matter how it is written. Measured: `patterns` is a bare `section` with no declared display and hid correctly without it, while `legend` carries `display:flex` from the static sheet and stayed visible. The WordPress site-wide rule needs no `!important` for the opposite reason, that an outer-tree `::part()` rule already outranks anything inside.\n\t */\n\tprivate hiddenSectionsStyle(): unknown {\n\t\tconst names = this.hideSections\n\t\t\t.split(',')\n\t\t\t.map((n) => n.trim().toLowerCase())\n\t\t\t.filter((n) => /^[a-z][a-z0-9-]*$/.test(n));\n\t\tif (names.length === 0) return nothing;\n\t\tconst rules = names\n\t\t\t.map((n) => `[part~=\"${n}\"]{display:none!important}`)\n\t\t\t.join('');\n\t\treturn html`<style>${rules}</style>`;\n\t}\n\n\t/** The state machine every render goes through, split out so {@link render} can pair it with the per-instance rules above. */\n\tprivate renderState(): 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\t * @param heading - English source copy, translated here. Typed as {@link ChromeString} so the compiler, not a reviewer, rejects a heading no catalogue carries.\n\t */\n\tprotected renderInterpretation(\n\t\tsections: InterpSection[],\n\t\tname: string,\n\t\theading?: ChromeString,\n\t): unknown {\n\t\tif (this.hideReadings) return nothing;\n\t\t// Localized HERE rather than in the accordion: that is a plain render\n\t\t// function with no host, so it cannot read a language, and this is the one\n\t\t// call site every component routes through.\n\t\treturn renderInterpAccordion(sections, name, this.t(heading ?? '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\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: one translated message for every component, addressable as `::part(empty)`. Override only where an empty state must DO something a message cannot. */\n\tprotected renderEmpty(): unknown {\n\t\treturn html`<div class=\"roxy-empty\" role=\"status\" part=\"empty\">${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/**\n\t * Error state shown when a self-fetch fails. Keeps the form in view so the request can be retried.\n\t *\n\t * The message goes through `t()` because ONE of the messages that reaches here is ours: `KEY_REFUSED_MESSAGE` (`utils/key-guard.ts`), which {@link FetchController} assigns when a site owner pastes a secret key into a browser page, and which `<roxy-location-search>` renders in its own shadow root from the same constant. Translating it in one place and not the other would put two languages on one page. Everything else that lands here is a wire fact (an HTTP status, a browser network error), misses the catalogue and renders unchanged.\n\t */\n\tprotected renderError(message: string): unknown {\n\t\tconst banner = html`<div class=\"roxy-error\" role=\"alert\" part=\"error\">${this.t(message)}</div>`;\n\t\treturn this.endpoint ? html`${banner}${this.renderForm()}` : banner;\n\t}\n}\n", "import { LitElement } from 'lit';\nimport { resolveLang } from './lang.js';\nimport { LocaleController } from './locale-controller.js';\nimport { translate } from './registry.js';\n\n/**\n * The base every element that writes WORDS extends: it resolves the page language and translates its own chrome.\n *\n * @remarks\n * This is deliberately smaller than {@link RoxyDataElement}, and the split is what makes the widgets translatable at all. `<roxy-endpoint-form>` and `<roxy-location-search>` are the two declared widgets: they fetch, they hold state, and they are NOT data components, so they cannot inherit the data base without dragging its controlled-mode hydration, its self-fetch controller and its own form rendering (which renders the form, so the form inheriting it would compose itself). They extended `LitElement` directly instead, which meant they had no `t()` and no {@link LocaleController}, so a Spanish page rendered a Spanish result card over an English form and neither widget re-rendered when a deferred locale payload landed.\n *\n * So the mechanism lives here ONCE and all three inherit it. There is no second translator, no second registry and no second way to resolve a language: adding one is how a catalogue entry and a call site drift apart.\n *\n * Two costs are why this is its own module rather than a second export of `utils/base-element.ts`. Every `dist/cdn/components/*.js` is a self-contained IIFE, so importing the data base into the city search would compile `FetchController`, `MarkupDataController` and the interpretation accordion into a bundle that uses none of them. And `utils/base-element.ts` imports THIS file, so putting the class there would close a cycle the moment a widget imported it.\n */\nexport abstract class RoxyLocalizedElement extends LitElement {\n\tconstructor() {\n\t\tsuper();\n\t\t// Re-render if a chrome-string catalogue lands after this element upgraded.\n\t\t// A host page loads the payload as its own script tag, so it can arrive\n\t\t// after first paint and there is nothing the site owner could do about it.\n\t\tnew LocaleController(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. The same holds for a label derived from a spec field NAME through `humanize()`: a catalogue keyed on English source text cannot reach a string computed per response. A derived name is catalogued only where the set it comes from is CLOSED and small enough to enumerate against the spec, which is true of the nine form group names and of nothing else so far.\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 RoxyLocalizedElement.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\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", "/**\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 * All four links matter: with only the first, a component on a fully Spanish page renders English chrome and the only remedy is 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 * 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 * 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` on the page; 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/**\n\t * Language tag (lower case) to the API's field-label map: `fields` keyed by wire name,\n\t * `enums` keyed `{fieldName}.{value}`.\n\t *\n\t * A SEPARATE key space from `catalogs` on purpose. A chrome string is keyed by the English\n\t * text a component writes, which is a constant in our source; a field label is keyed by a\n\t * name that only the OpenAPI spec knows, computed per operation, so no catalogue keyed on\n\t * English source text can ever reach it. Same registry because the delivery problem is\n\t * identical (a payload that may land after first paint), so it reuses one global object and\n\t * one listener set rather than growing a second of each.\n\t */\n\tfieldLabels: Record<string, FieldLabels>;\n\t/** Language tags whose fetch is in flight or done, so N forms on a page cost ONE request. */\n\trequested: Set<string>;\n\t/** Elements waiting to re-render when a catalogue arrives. */\n\tlisteners: Set<() => void>;\n}\n\n/** The `/languages/field-labels` payload, minus the echoed `lang`. */\nexport interface FieldLabels {\n\tfields: Record<string, string>;\n\tenums: Record<string, string>;\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 = {\n\t\tcatalogs: {},\n\t\tfieldLabels: {},\n\t\trequested: new Set(),\n\t\tlisteners: new Set(),\n\t};\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/**\n * Publish a field-label map for a language tag and wake every mounted element.\n *\n * @remarks\n * Exported so a host that already has the payload (a server-rendered page, a test, a WordPress\n * plugin inlining it) can supply it without a network call, exactly as {@link registerLocale}\n * allows for chrome strings.\n */\nexport function registerFieldLabels(lang: string, labels: FieldLabels): void {\n\tconst reg = registry();\n\treg.fieldLabels[lang.toLowerCase()] = labels;\n\tfor (const listener of reg.listeners) listener();\n}\n\n/** The field-label map for `lang`, resolving a regional tag against its base language. */\nfunction labelsFor(lang: string | undefined): FieldLabels | undefined {\n\tif (!lang) return undefined;\n\tconst { fieldLabels } = registry();\n\tconst tag = lang.toLowerCase();\n\treturn fieldLabels[tag] ?? fieldLabels[tag.split('-')[0] as string];\n}\n\n/**\n * The label for a request field name, or `undefined` when nothing has been published.\n *\n * @remarks\n * Returning `undefined` rather than the name is deliberate: the caller owns the fallback, which is\n * `humanize()`, and that keeps this resolver honest about what it actually knows. A form renders\n * identically to before until a payload arrives.\n */\nexport function fieldLabel(\n\tlang: string | undefined,\n\tname: string,\n): string | undefined {\n\treturn labelsFor(lang)?.fields[name];\n}\n\n/** The label for one selectable option, keyed `{fieldName}.{value}` as the API publishes it. */\nexport function optionLabel(\n\tlang: string | undefined,\n\tfield: string,\n\tvalue: string,\n): string | undefined {\n\treturn labelsFor(lang)?.enums[`${field}.${value}`];\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. */\n/** The public API root. Exported so anything else that must reach the API (the field-label\n * fetch in `endpoint-form`) uses the SAME origin as every data request instead of a second copy. */\nexport const DEFAULT_BASE_URL = 'https://roxyapi.com/api/v2';\n\n/**\n * Turn a failed `Response` into the message to show: the API's own `{ error }` string when the body carries one, else the status line.\n *\n * @remarks\n * Exported so every client-side fetch boundary renders the same words for the same failure, the way {@link keyIsRefused} centralizes the key refusal. A boundary that discards the response body cannot tell a rejected request from an empty result, and renders the two identically.\n */\nexport async function readApiError(res: Response): Promise<string> {\n\ttry {\n\t\tconst body = (await res.json()) as { error?: string };\n\t\tif (body?.error) return body.error;\n\t} catch {\n\t\t// Non-JSON error body: fall through to the status line.\n\t}\n\treturn `Request failed (${res.status})`;\n}\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 readApiError(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\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. A card that draws its own disclosure, because its summary carries more than a label and an aside, still renders the shared body and imports {@link readingDetailStyles} for it rather than restating those rules.\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 type { ChromeString } from '../i18n/chrome-strings.js';\nimport { chevron } from './disclosure.js';\nimport type { Translate } from './hd-reading.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\n/**\n * Styles for the markup {@link renderReadingDetail} emits. Import this wherever that helper is called; {@link interpAccordionStyles} already embeds it, so an accordion caller needs only the one.\n *\n * @remarks\n * Separate from the accordion shell because the two are needed independently: a card can draw its own disclosure and still render the shared reading body, and hand-copying these rules is how the chip colour and spacing drifted apart across five components.\n *\n * No margin-top on the chip row. The body above already spaces its children, so a margin here would set the chips twice as far out as every other row.\n */\nexport const readingDetailStyles = css`.interp-keywords{flex-wrap:wrap;gap:.25rem;display:flex}.interp-keywords .kw{border-radius:var(--roxy-radius-full,9999px);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-xs,.75rem);padding:1px 8px}`;\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}${readingDetailStyles}`;\n\n/** The keyword chips a reading carries, or nothing. One renderer because four components drew the identical row, and the markup has to match {@link readingDetailStyles}, which is the pairing that drifts when it is copied. */\nexport function renderKeywordChips(keywords: readonly string[] | undefined) {\n\tif (!keywords?.length) return nothing;\n\treturn html`<div class=\"interp-keywords\">${keywords.map((k) => html`<span class=\"kw\">${k}</span>`)}</div>`;\n}\n\n/** The prose an endpoint returns ABOUT one contact: a summary, up to three labelled lines, and the keyword chips under them. Every field is optional, so a narrower response renders fewer rows rather than empty ones. */\nexport interface ReadingDetail {\n\tsummary?: string;\n\timpact?: string;\n\ttiming?: string;\n\tguidance?: string;\n\tkeywords?: readonly string[];\n}\n\n/** Render one {@link ReadingDetail}. The three labels are copy, so this takes the translator, and they are typed {@link ChromeString} because the lookup is one indirection from the call: a scan of `t(...)` sites cannot follow that, and the compiler can. */\nexport function renderReadingDetail(\n\td: ReadingDetail | undefined,\n\tt: Translate,\n) {\n\tif (!d) return nothing;\n\tconst line = (label: ChromeString, value: string | undefined) =>\n\t\tvalue ? html`<p><strong>${t(label)}</strong> ${value}</p>` : nothing;\n\treturn html`${d.summary ? html`<p>${d.summary}</p>` : nothing} ${line('Impact:', d.impact)}${line('Timing:', d.timing)}${line('Guidance:', d.guidance)} ${renderKeywordChips(d.keywords)}`;\n}\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: string,\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\">…</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", "import type { TemplateResult } from 'lit';\nimport { nothing, svg } from 'lit';\n\n/**\n * Fixed geometry and renderer for the Human Design bodygraph: nine centers, 36 channels, all 64 gates, over a front-facing silhouette. Only which centers are defined and which gates are activated changes per chart.\n *\n * @remarks\n * Points are authored in a 0 to 100 grid and mapped into {@link BODYGRAPH_VIEWBOX} by {@link g}, so the chart and the silhouette share one space. The window is tight to the drawing rather than square, because every unused grid unit costs gate-number size. `tests/bodygraph.test.ts` holds the layout to the canonical shapes, orientations and row order.\n */\n\nexport type BodygraphCenterId =\n\t| 'head'\n\t| 'ajna'\n\t| 'throat'\n\t| 'g'\n\t| 'heart'\n\t| 'sacral'\n\t| 'solar-plexus'\n\t| 'spleen'\n\t| 'root';\n\ninterface Point {\n\tx: number;\n\ty: number;\n}\n\n/** Which of the two sources activated a gate; both splits the circle. The renderer names neither, so one card reads them as the two sides of a person and another as two people. */\nexport interface GateSources {\n\tleft: boolean;\n\tright: boolean;\n}\n\n/** One center's drawable geometry, plus the English fallback name for its accessible title when the response carries none. */\ninterface CenterGeometry {\n\tid: BodygraphCenterId;\n\tlabel: string;\n\tcolor: CenterColor;\n\tpoints: Point[];\n}\n\n/** Traditional center color group: gold for Head and G, green for Ajna, red for the Heart and Sacral motors, brown for the rest. A defined center is filled with it; an open one takes the card surface so the wiring passes behind. */\nexport type CenterColor = 'gold' | 'green' | 'red' | 'brown';\n\n/** The grid window the viewBox covers, with nothing to spare: margin here is space the drawing does not get. Symmetric about {@link AXIS}, and the topmost element is the Head apex rather than the silhouette. */\nconst X_MIN = 14;\nconst X_MAX = 86;\nconst Y_MIN = 0;\nconst Y_MAX = 102;\n/** Grid units to viewBox units. One number sets the resolution of every coordinate below. */\nconst UNIT = 6;\nconst VIEW_W = (X_MAX - X_MIN) * UNIT;\nconst VIEW_H = (Y_MAX - Y_MIN) * UNIT;\n\n/** Map a normalized grid point into viewBox units. */\nfunction g(x: number, y: number): Point {\n\treturn { x: (x - X_MIN) * UNIT, y: (y - Y_MIN) * UNIT };\n}\n\n/** Chart horizontal center, the axis of symmetry for the body and the side centers. */\nconst AXIS = 50;\n\n/** Reflect a normalized grid x across {@link AXIS}. */\nconst mirrorX = (x: number): number => 2 * AXIS - x;\n\n/** Gate circle and number size, in grid units. Bounded by the closest pair on the chart (Throat 12 and 45, 2.3 apart) and by fitting two digits inside the circle. */\nexport const GATE_RADIUS = 1.02 * UNIT;\nexport const GATE_FONT_SIZE = 1.35 * UNIT;\n\n/** The three x offsets from {@link AXIS} a central-column gate sits on: the inner triples, the outer column of the square centers, and the G's wider waist pair. Named so they cannot drift apart one edit at a time. */\nconst COL = 2.87;\nconst EDGE = 4.4;\nconst G_EDGE = 5.65;\n\n/** Gate positions per center, in canonical reading order. Symmetry is structural rather than typed: the central column is authored as offsets from {@link AXIS}, and the Solar Plexus is left empty and filled by reflecting the Spleen in {@link buildGatePoints}. */\nconst GATES_BY_CENTER: Record<\n\tBodygraphCenterId,\n\tRecord<number, [number, number]>\n> = {\n\thead: { 64: [AXIS - COL, 11.2], 61: [AXIS, 11.2], 63: [AXIS + COL, 11.2] },\n\tajna: {\n\t\t47: [AXIS - COL, 18.0],\n\t\t24: [AXIS, 18.0],\n\t\t4: [AXIS + COL, 18.0],\n\t\t17: [AXIS - COL, 20.6],\n\t\t11: [AXIS + COL, 20.6],\n\t\t43: [AXIS, 25.3],\n\t},\n\tthroat: {\n\t\t62: [AXIS - COL, 32.4],\n\t\t23: [AXIS, 32.4],\n\t\t56: [AXIS + COL, 32.4],\n\t\t16: [AXIS - EDGE, 34.7],\n\t\t35: [AXIS + EDGE, 34.7],\n\t\t20: [AXIS - EDGE, 37.3],\n\t\t12: [AXIS + EDGE, 37.3],\n\t\t45: [AXIS + EDGE, 39.6],\n\t\t31: [AXIS - COL, 41.9],\n\t\t8: [AXIS, 41.9],\n\t\t33: [AXIS + COL, 41.9],\n\t},\n\tg: {\n\t\t1: [AXIS, 47.7],\n\t\t7: [AXIS - COL, 50.3],\n\t\t13: [AXIS + COL, 50.3],\n\t\t10: [AXIS - G_EDGE, 53.4],\n\t\t25: [AXIS + G_EDGE, 53.4],\n\t\t15: [AXIS - COL, 56.8],\n\t\t46: [AXIS + COL, 56.8],\n\t\t2: [AXIS, 59.2],\n\t},\n\theart: {\n\t\t21: [63.9, 59.5],\n\t\t51: [62.1, 61.3],\n\t\t26: [60.1, 63.3],\n\t\t40: [66.6, 63.3],\n\t},\n\tspleen: {\n\t\t48: [20.0, 70.8],\n\t\t57: [22.5, 72.4],\n\t\t44: [25.0, 73.8],\n\t\t50: [27.7, 75.3],\n\t\t32: [25.0, 76.6],\n\t\t28: [22.5, 78.0],\n\t\t18: [20.0, 79.5],\n\t},\n\tsacral: {\n\t\t5: [AXIS - COL, 72.7],\n\t\t14: [AXIS, 72.7],\n\t\t29: [AXIS + COL, 72.7],\n\t\t34: [AXIS - EDGE, 75.4],\n\t\t27: [AXIS - EDGE, 79.0],\n\t\t59: [AXIS + EDGE, 79.0],\n\t\t42: [AXIS - COL, 81.7],\n\t\t3: [AXIS, 81.7],\n\t\t9: [AXIS + COL, 81.7],\n\t},\n\t'solar-plexus': {},\n\troot: {\n\t\t53: [AXIS - COL, 90.2],\n\t\t60: [AXIS, 90.2],\n\t\t52: [AXIS + COL, 90.2],\n\t\t54: [AXIS - EDGE, 92.6],\n\t\t19: [AXIS + EDGE, 92.6],\n\t\t38: [AXIS - EDGE, 95.3],\n\t\t39: [AXIS + EDGE, 95.3],\n\t\t58: [AXIS - EDGE, 98.1],\n\t\t41: [AXIS + EDGE, 98.1],\n\t},\n};\n\n/** Spleen gate to the Solar Plexus gate at its mirror position (base-top, ..., apex, ..., base-bottom). */\nconst SPLEEN_TO_SOLAR_PLEXUS: Record<number, number> = {\n\t48: 36,\n\t57: 22,\n\t44: 37,\n\t50: 6,\n\t32: 49,\n\t28: 55,\n\t18: 30,\n};\n\n/** Gate anchors and the gate-to-center index, filling the Solar Plexus by reflecting the Spleen so the two can never drift apart. */\nfunction buildGatePoints(): {\n\tpoints: Record<number, Point>;\n\tcenterOf: Record<number, BodygraphCenterId>;\n} {\n\tconst points: Record<number, Point> = {};\n\tconst centerOf: Record<number, BodygraphCenterId> = {};\n\tfor (const [spleenGate, [x, y]] of Object.entries(GATES_BY_CENTER.spleen)) {\n\t\tGATES_BY_CENTER['solar-plexus'][\n\t\t\tSPLEEN_TO_SOLAR_PLEXUS[Number(spleenGate)]\n\t\t] = [mirrorX(x), y];\n\t}\n\tfor (const [center, gates] of Object.entries(GATES_BY_CENTER) as Array<\n\t\t[BodygraphCenterId, Record<number, [number, number]>]\n\t>) {\n\t\tfor (const [gate, [x, y]] of Object.entries(gates)) {\n\t\t\tpoints[Number(gate)] = g(x, y);\n\t\t\tcenterOf[Number(gate)] = center;\n\t\t}\n\t}\n\treturn { points, centerOf };\n}\n\n/**\n * The viewBox-space gate anchors ({@link GATE_POINTS}) and the gate to center\n * index ({@link GATE_CENTER}). Exported so the geometry tests can assert the\n * layout invariants (side-center mirror symmetry, central-column balance, gates\n * inside their centers, circles that never overlap) without rendering.\n */\nexport const { points: GATE_POINTS, centerOf: GATE_CENTER } = buildGatePoints();\n\n/** Horizontal axis of symmetry in viewBox units, the reflection axis for geometry tests. */\nexport const CHART_AXIS_X = VIEW_W / 2;\n\n/** Build a polygon from normalized grid corner pairs, mapping each through {@link g}. */\nfunction shape(corners: ReadonlyArray<readonly [number, number]>): Point[] {\n\treturn corners.map(([x, y]) => g(x, y));\n}\n\n/** A square center, centered on {@link AXIS}, spanning the given half-width and y range. */\nfunction squareShape(halfWidth: number, top: number, bottom: number): Point[] {\n\treturn shape([\n\t\t[AXIS - halfWidth, top],\n\t\t[AXIS + halfWidth, top],\n\t\t[AXIS + halfWidth, bottom],\n\t\t[AXIS - halfWidth, bottom],\n\t]);\n}\n\n/** Measured half-width of the three square centers (Throat, Sacral, Root), which share one width. */\nconst SQUARE_HALF = 5.9;\n\n/** The Spleen triangle (base on the far-left edge, apex pointing right toward center). */\nconst SPLEEN_SHAPE: ReadonlyArray<readonly [number, number]> = [\n\t[18.3, 68.3],\n\t[18.3, 82.0],\n\t[30.3, 75.15],\n];\n\n/**\n * Center shapes in canonical orientation and color. Central-column centers are\n * built centered on {@link AXIS}; the Solar Plexus shape is the Spleen reflected\n * across the axis, so the side centers stay exact mirrors. The Heart is the\n * deliberate off-axis exception and points UP, not right.\n */\nexport const CENTER_GEOMETRY: readonly CenterGeometry[] = [\n\t{\n\t\tid: 'head',\n\t\tlabel: 'Head',\n\t\tcolor: 'gold',\n\t\tpoints: shape([\n\t\t\t[43.55, 12.5],\n\t\t\t[56.45, 12.5],\n\t\t\t[50.0, 1.7],\n\t\t]),\n\t},\n\t{\n\t\tid: 'ajna',\n\t\tlabel: 'Ajna',\n\t\tcolor: 'green',\n\t\tpoints: shape([\n\t\t\t[43.55, 16.5],\n\t\t\t[56.45, 16.5],\n\t\t\t[50.0, 27.7],\n\t\t]),\n\t},\n\t{\n\t\tid: 'throat',\n\t\tlabel: 'Throat',\n\t\tcolor: 'brown',\n\t\tpoints: squareShape(SQUARE_HALF, 31.0, 43.3),\n\t},\n\t{\n\t\tid: 'g',\n\t\tlabel: 'G',\n\t\tcolor: 'gold',\n\t\tpoints: shape([\n\t\t\t[50.0, 45.8],\n\t\t\t[57.7, 53.6],\n\t\t\t[50.0, 61.4],\n\t\t\t[42.3, 53.6],\n\t\t]),\n\t},\n\t{\n\t\tid: 'heart',\n\t\tlabel: 'Heart',\n\t\tcolor: 'red',\n\t\tpoints: shape([\n\t\t\t[56.65, 65.23],\n\t\t\t[64.2, 56.74],\n\t\t\t[69.75, 65.23],\n\t\t]),\n\t},\n\t{\n\t\tid: 'spleen',\n\t\tlabel: 'Spleen',\n\t\tcolor: 'brown',\n\t\tpoints: shape(SPLEEN_SHAPE),\n\t},\n\t{\n\t\tid: 'sacral',\n\t\tlabel: 'Sacral',\n\t\tcolor: 'red',\n\t\tpoints: squareShape(SQUARE_HALF, 71.3, 83.1),\n\t},\n\t{\n\t\tid: 'solar-plexus',\n\t\tlabel: 'Solar Plexus',\n\t\tcolor: 'brown',\n\t\tpoints: shape(\n\t\t\tSPLEEN_SHAPE.map(([x, y]) => [mirrorX(x), y] as [number, number]),\n\t\t),\n\t},\n\t{\n\t\tid: 'root',\n\t\tlabel: 'Root',\n\t\tcolor: 'brown',\n\t\tpoints: squareShape(SQUARE_HALF, 88.5, 99.8),\n\t},\n];\n\n/**\n * The 36 channels as ordered gate pairs. This is the canonical Human Design\n * channel set; a channel is active only when both of its gates are activated,\n * which the live response reports in its `channels` array. The static list lets\n * the renderer draw every channel as an inactive connector and overlay the\n * activated halves, so an open bodygraph still shows its full wiring skeleton.\n */\nexport const CHANNEL_PAIRS: ReadonlyArray<readonly [number, number]> = [\n\t[64, 47],\n\t[61, 24],\n\t[63, 4],\n\t[17, 62],\n\t[11, 56],\n\t[43, 23],\n\t[16, 48],\n\t[20, 34],\n\t[20, 10],\n\t[7, 31],\n\t[1, 8],\n\t[13, 33],\n\t[21, 45],\n\t[12, 22],\n\t[35, 36],\n\t[57, 20],\n\t[15, 5],\n\t[2, 14],\n\t[46, 29],\n\t[34, 10],\n\t[10, 57],\n\t[25, 51],\n\t[27, 50],\n\t[57, 34],\n\t[26, 44],\n\t[18, 58],\n\t[28, 38],\n\t[32, 54],\n\t[3, 60],\n\t[9, 52],\n\t[42, 53],\n\t[59, 6],\n\t[19, 49],\n\t[39, 55],\n\t[41, 30],\n\t[37, 40],\n];\n\n/**\n * Front-facing standing figure behind the chart, mirror-symmetric about {@link\n * AXIS} and authored in the same grid as the centers so the two scale together:\n * a rounded head holding the Head and Ajna, a short neck at the Throat, shoulders\n * sloping to arms whose span frames the Spleen and Solar Plexus, then hips ending\n * just below the Root. The right half is built from cubic beziers and reflected,\n * so the figure is exactly symmetric. Drawn first; the centers paint over it,\n * which is what makes an open center read as a cut-out rather than a tint.\n */\nconst BODY_PATH = buildBodyPath();\n\nfunction buildBodyPath(): string {\n\tconst m = mirrorX;\n\t// Right-side outline in grid units (x, y) from the crown down to the\n\t// pelvis-right corner: a start point, then triples of (ctrl1, ctrl2, end).\n\tconst r: Array<[number, number]> = [\n\t\t[50, 3], // crown apex (start), below the Head apex so the triangle reads above it\n\t\t[58, 3], // crown round (ctrl)\n\t\t[60, 10], // head side (ctrl)\n\t\t[57, 17.5], // brow, the head holds Head + Ajna (end)\n\t\t[56.5, 20.5], // cheek (ctrl)\n\t\t[53.5, 23.5], // jaw (ctrl)\n\t\t[51.5, 27], // neck right, narrowed to the Ajna apex (end)\n\t\t[54, 28], // neck base (ctrl)\n\t\t[64, 30], // trapezius slope (ctrl)\n\t\t[79, 35], // shoulder / deltoid, the widest point (end)\n\t\t[83, 42], // upper arm (ctrl)\n\t\t[84, 58], // outer arm, frames the side centers (ctrl)\n\t\t[83, 74], // arm past Spleen / Solar Plexus (end)\n\t\t[83, 86], // waist, held wide enough to contain the side-center bases (ctrl)\n\t\t[76, 93], // hip (ctrl)\n\t\t[68, 97], // hip (end)\n\t\t[64, 99], // toward the pelvis (ctrl)\n\t\t[62, 100.5], // pelvis (ctrl)\n\t\t[60, 100.5], // pelvis-right corner (end)\n\t];\n\tconst segs: string[] = [`M ${pt(r[0])}`];\n\t// Walk the right side as cubic beziers, three points per segment.\n\tfor (let i = 1; i + 2 < r.length; i += 3) {\n\t\tsegs.push(`C ${pt(r[i])} ${pt(r[i + 1])} ${pt(r[i + 2])}`);\n\t}\n\t// Flat pelvis hem across to the mirrored corner.\n\tsegs.push(`L ${ptm(r[r.length - 1], m)}`);\n\t// Mirror the right walk back up the left side to the crown.\n\tfor (let i = r.length - 3; i >= 1; i -= 3) {\n\t\tsegs.push(`C ${ptm(r[i + 1], m)} ${ptm(r[i], m)} ${ptm(r[i - 1], m)}`);\n\t}\n\tsegs.push('Z');\n\treturn segs.join(' ');\n}\n\nfunction pt([x, y]: [number, number]): string {\n\tconst p = g(x, y);\n\treturn `${p.x} ${p.y}`;\n}\n\nfunction ptm([x, y]: [number, number], m: (x: number) => number): string {\n\tconst p = g(m(x), y);\n\treturn `${p.x} ${p.y}`;\n}\n\nfunction polygonPoints(pts: Point[]): string {\n\treturn pts.map((p) => `${p.x},${p.y}`).join(' ');\n}\n\n/** The class for a source pair, or `both` when the mark has to carry two colours. */\nfunction sourceClass(s: GateSources): 'src-left' | 'src-right' | 'both' {\n\tif (s.left && s.right) return 'both';\n\treturn s.left ? 'src-left' : 'src-right';\n}\n\n/** Render the body silhouette behind the chart. */\nfunction renderBody(): TemplateResult {\n\treturn svg`<path class=\"bg-body\" d=${BODY_PATH} />`;\n}\n\n/**\n * Render every channel as a pair of halves meeting at the midpoint, so one\n * function draws both states a bodygraph distinguishes: both gates activated\n * reads as one continuous bar, a single activated gate as that gate hanging\n * halfway out of its center. Each half takes the colour of the gate at ITS end,\n * so a channel carrying one Personality gate and one Design gate is half dark and\n * half red rather than forced to one of the two.\n *\n * @remarks\n * A `pd` half is drawn twice, a solid Design line under a dashed Personality one,\n * for the striped bar a gate both sides activated takes. The inactive connector\n * is drawn first so the full 36-channel skeleton stays visible on an open chart.\n */\nfunction renderChannels(\n\tgateSources: ReadonlyMap<number, GateSources>,\n): TemplateResult[] {\n\tconst lines: TemplateResult[] = [];\n\tfor (const [a, b] of CHANNEL_PAIRS) {\n\t\tconst pa = GATE_POINTS[a];\n\t\tconst pb = GATE_POINTS[b];\n\t\tif (!pa || !pb) continue;\n\t\tlines.push(\n\t\t\tsvg`<line class=\"bg-channel\" x1=${pa.x} y1=${pa.y} x2=${pb.x} y2=${pb.y} />`,\n\t\t);\n\t\tconst mid = { x: (pa.x + pb.x) / 2, y: (pa.y + pb.y) / 2 };\n\t\tfor (const [gate, from] of [\n\t\t\t[a, pa],\n\t\t\t[b, pb],\n\t\t] as const) {\n\t\t\tconst sources = gateSources.get(gate);\n\t\t\tif (!sources) continue;\n\t\t\tconst cls = sourceClass(sources);\n\t\t\tlines.push(\n\t\t\t\tsvg`<line class=\"bg-half ${cls === 'both' ? 'src-left' : cls}\" x1=${from.x} y1=${from.y} x2=${mid.x} y2=${mid.y} />`,\n\t\t\t);\n\t\t\tif (cls === 'both') {\n\t\t\t\tlines.push(\n\t\t\t\t\tsvg`<line class=\"bg-half src-right stripe\" x1=${from.x} y1=${from.y} x2=${mid.x} y2=${mid.y} />`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn lines;\n}\n\n/**\n * Render the nine center shapes: filled with their semantic color when defined,\n * filled with the card surface and outlined when open so the wiring and the\n * silhouette pass behind them. Each carries a `<title>` naming it in the reader's\n * language, which is both the hover tooltip and the accessible name.\n */\nfunction renderCenters(\n\tdefined: Set<BodygraphCenterId>,\n\tnames: ReadonlyMap<BodygraphCenterId, string> | undefined,\n\tstateWords: { defined: string; open: string },\n): TemplateResult[] {\n\treturn CENTER_GEOMETRY.map((c) => {\n\t\tconst isDefined = defined.has(c.id);\n\t\tconst cls = `bg-center bg-${c.color}${isDefined ? ' defined' : ''}`;\n\t\tconst label = names?.get(c.id) || c.label;\n\t\treturn svg`<polygon class=${cls} points=${polygonPoints(c.points)}><title>${label}: ${isDefined ? stateWords.defined : stateWords.open}</title></polygon>`;\n\t});\n}\n\n/** A half-disc starting at the top of the circle and sweeping to the bottom. `sweep` 1 is the right half. */\nfunction halfDisc(p: Point, sweep: 0 | 1): string {\n\treturn `M ${p.x} ${p.y - GATE_RADIUS} A ${GATE_RADIUS} ${GATE_RADIUS} 0 0 ${sweep} ${p.x} ${p.y + GATE_RADIUS} Z`;\n}\n\n/**\n * Render all 64 gate numbers at their fixed points: an unactivated gate is a named\n * position on the chart, not an absence, so it draws as an outlined circle with a\n * muted number while an activated one is a filled disc with a knocked-out number.\n * A gate both sources activated is split down the middle.\n */\nfunction renderGates(\n\tgateSources: ReadonlyMap<number, GateSources>,\n\ttitles: ReadonlyMap<number, string>,\n): TemplateResult[] {\n\tconst out: TemplateResult[] = [];\n\tfor (const [gate, p] of Object.entries(GATE_POINTS)) {\n\t\tconst num = Number(gate);\n\t\tconst sources = gateSources.get(num);\n\t\tconst cls = sources ? sourceClass(sources) : '';\n\t\tconst title = titles.get(num);\n\t\tout.push(svg`<g class=\"bg-gate-node\">\n\t\t\t${\n\t\t\t\tcls === 'both'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\tsvg`<path class=\"bg-gate-dot on src-left\" d=${halfDisc(p, 0)} />`,\n\t\t\t\t\t\t\tsvg`<path class=\"bg-gate-dot on src-right\" d=${halfDisc(p, 1)} />`,\n\t\t\t\t\t\t]\n\t\t\t\t\t: svg`<circle class=\"bg-gate-dot ${cls && `on ${cls}`}\" cx=${p.x} cy=${p.y} r=${GATE_RADIUS} />`\n\t\t\t}\n\t\t\t<text class=\"bg-gate ${sources ? 'on' : ''}\" x=${p.x} y=${p.y} text-anchor=\"middle\" dominant-baseline=\"central\">${num}</text>\n\t\t\t${title ? svg`<title>${title}</title>` : nothing}\n\t\t</g>`);\n\t}\n\treturn out;\n}\n\nexport interface BodygraphRenderInput {\n\tdefinedCenters: Set<BodygraphCenterId>;\n\t/** Which source(s) activated each gate; absent means unactivated. The only wiring input, because a channel is defined exactly when both of its gates are. */\n\tgateSources: ReadonlyMap<number, GateSources>;\n\tgateTitles: ReadonlyMap<number, string>;\n\t/** What to name each center in its `<title>`, keyed by center id. The response is the authority for its own vocabulary, so this carries `centers[].nameLocalized` where the API sent one and `centers[].name` otherwise; an id with no entry keeps the chart's own English label. */\n\tcenterNames?: ReadonlyMap<BodygraphCenterId, string>;\n\t/** The two words a center shape states its state with in its tooltip. Supplied by the caller because only a component can reach a chrome catalogue. */\n\tstateWords?: { defined: string; open: string };\n}\n\nexport const BODYGRAPH_VIEWBOX = `0 0 ${VIEW_W} ${VIEW_H}`;\n\n/**\n * Render the full bodygraph SVG inner content for the given live state. The\n * caller wraps it in an `<svg>` with {@link BODYGRAPH_VIEWBOX} and applies its\n * own theming CSS. Draw order: body silhouette under channels under centers\n * under gates, so the body is the backdrop, the wiring runs behind the shapes,\n * and every gate circle sits on top of whatever it lands on.\n */\nexport function renderBodygraphSvg(\n\tinput: BodygraphRenderInput,\n): TemplateResult {\n\treturn svg`\n\t\t${renderBody()}\n\t\t${renderChannels(input.gateSources)}\n\t\t${renderCenters(\n\t\t\tinput.definedCenters,\n\t\t\tinput.centerNames,\n\t\t\tinput.stateWords ?? { defined: 'defined', open: 'open' },\n\t\t)}\n\t\t${renderGates(input.gateSources, input.gateTitles)}\n\t`;\n}\n", "import { css } from 'lit';\nimport { GATE_FONT_SIZE } from './bodygraph-render.js';\n\n/**\n * The stylesheet for anything `renderBodygraphSvg` draws, so a second chart on the same geometry cannot fork the first one's appearance.\n *\n * @remarks\n * The renderer marks each gate and channel half `src-left` or `src-right` and names neither, so a card supplies the meaning by declaring those two colours on its own root and nothing else. Each must clear 4.5:1 against the ink knocked out of it and 3:1 against the card surface, in both themes. A card still owns its `.wrap`, its layout and its legend copy.\n */\nexport const bodygraphChartStyles = css`.chart{width:100%;max-width:var(--roxy-chart-max-width,30rem);height:auto;margin:0 auto;display:block}@container (width<=26rem){.chart{width:calc(100% + 2 * var(--roxy-space-lg,1.5rem));margin-inline:calc(-1 * var(--roxy-space-lg,1.5rem))}}.bg-body{fill:color-mix(in srgb, var(--roxy-secondary,#475569) 8%, transparent);stroke:var(--roxy-border,#e4e4e7);stroke-width:1px}.bg-channel{stroke:var(--roxy-border,#e4e4e7);stroke-width:5px;stroke-linecap:round}.bg-half{stroke-width:5px;stroke-linecap:round}.bg-half.stripe{stroke-linecap:butt;stroke-dasharray:7 7}.bg-center{fill:var(--roxy-surface,#fff);stroke:var(--roxy-secondary,#475569);stroke-width:1.8px}.bg-center.defined{stroke:color-mix(in srgb, var(--roxy-fg,#0a0a0a) 45%, transparent)}:host{--center-gold:#e0a200;--center-green:#2f8f00;--center-red:#c41f1f;--center-brown:#76502f}.bg-center.bg-gold.defined,.legend .swatch.bg-gold{fill:var(--center-gold);background:var(--center-gold)}.bg-center.bg-green.defined,.legend .swatch.bg-green{fill:var(--center-green);background:var(--center-green)}.bg-center.bg-red.defined,.legend .swatch.bg-red{fill:var(--center-red);background:var(--center-red)}.bg-center.bg-brown.defined,.legend .swatch.bg-brown{fill:var(--center-brown);background:var(--center-brown)}.bg-gate-dot{fill:var(--roxy-surface,#fff);stroke:var(--roxy-border,#e4e4e7);stroke-width:1px}.bg-gate-dot.on{stroke:none}.bg-gate{fill:var(--roxy-muted,#71717a);font-size:${GATE_FONT_SIZE}px;font-weight:600;font-family:var(--roxy-font-sans)}.bg-gate.on{fill:var(--src-ink,var(--roxy-surface,#fff))}.legend{gap:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);flex-wrap:wrap;display:flex}.legend .swatch{vertical-align:middle;border:1px solid var(--roxy-secondary,#475569);border-radius:2px;width:10px;height:10px;margin-right:4px;display:inline-block}.bg-half.src-left{stroke:var(--src-left)}.bg-half.src-right{stroke:var(--src-right)}.bg-gate-dot.on.src-left{fill:var(--src-left)}.bg-gate-dot.on.src-right{fill:var(--src-right)}.legend .swatch.src-left{background:var(--src-left)}.legend .swatch.src-right{background:var(--src-right)}.legend .swatch.source{border-radius:var(--roxy-radius-full,9999px);border-color:#0000}`;\n", "/**\n * The Human Design reading surface: the fact tiles, the lead paragraph, the signature and not-self pills, and the profile keynotes.\n *\n * @remarks\n * `/human-design/type` returns a strict subset of the `/human-design/bodygraph` interpretation fields (type, aura, strategy, authority, their descriptions, signature, not-self, profile), so `roxy-bodygraph` and `roxy-hd-type-card` would otherwise render the same markup and carry the same CSS twice. Both import from here instead: the bodygraph wraps the chart around it, the type card is the reading on its own.\n *\n * The disclosure accordion itself is NOT here. It lives in `utils/interp-accordion.ts`, because the same accordion serves any endpoint that returns a labelled reading (`roxy-hexagram` uses it for the changing lines), and both HD components draw it through `RoxyDataElement.renderInterpretation` so `hide-readings` is honoured. Import `interpAccordionStyles` alongside `hdReadingStyles`.\n */\n\nimport { css, html, nothing } from 'lit';\nimport type { InterpSection } from './interp-accordion.js';\n\n/** One row of the reading accordion. Alias of the shared {@link InterpSection} so HD call sites keep reading naturally. */\nexport type ReadingSection = InterpSection;\n\n/**\n * A component's own {@link RoxyDataElement.t}, threaded in so a shared render helper can name its rows.\n *\n * @remarks\n * These helpers are plain functions with no host, so they cannot resolve a page language on their own, and a label they hardcode is one English word inside otherwise translated chrome. Taking the translator as an argument keeps each English source literal in the file that renders it, which is what `tests/i18n.test.ts` scans (it walks `utils/` as well as `components/`), so a string added here still cannot ship without a catalogue entry. That scanner reads comments too, so do not write a sample call in one.\n */\nexport type Translate = (\n\tsource: string,\n\tvars?: Record<string, string | number>,\n) => string;\n\n/** A labelled value tile. A fact with no value is dropped, so a narrower response renders fewer tiles rather than empty ones. */\nexport interface Fact {\n\tlabel: string;\n\tvalue?: string;\n}\n\n/** The two profile lines with the keynote of each. Normalized: the bodygraph nests these under `profileKeynotes`, `/human-design/profile` returns them flat, and both map onto this. */\nexport interface ProfileKeynotes {\n\tpersonality?: string;\n\tpersonalityLine?: number;\n\tdesign?: string;\n\tdesignLine?: number;\n}\n\nexport const hdReadingStyles = css`.facts{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.fact{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);background:var(--roxy-surface,#fff)}.fact span{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.06em;display:block}.fact strong{font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a)}.lead{color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);margin:0;line-height:1.6}.themes{gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.pill{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);padding:2px 10px}.pill--good{background:color-mix(in srgb, var(--roxy-success,#16a34a) 16%, transparent);color:var(--roxy-success-fg,#166534)}.pill--shadow{background:color-mix(in srgb, var(--roxy-danger,#dc2626) 16%, transparent);color:var(--roxy-danger-fg,#991b1b)}.keynotes{gap:var(--roxy-space-xs,.25rem);margin:0;display:grid}.keynotes dt{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.05em}.keynotes dd{margin:0}`;\n\n/**\n * The chart side as a word a reader sees.\n *\n * @remarks\n * Personality is the conscious side calculated at birth, design the unconscious side 88 degrees of solar arc before it, and the wire carries them as the machine enum `personality` and `design` with no localized partner. The component is what turns an enum into a word, so this is chrome and comes from the catalogue: the same two words label the bodygraph activation tabs, name the side inside a chart tooltip, and sit under a Variables arrow. An unrecognized value is passed through rather than guessed at.\n */\nexport function sideWord(side: string | undefined, t: Translate): string {\n\tif (side === 'design') return t('Design');\n\tif (side === 'personality') return t('Personality');\n\treturn side ?? '';\n}\n\n/** The labelled value tiles. Values the response does not carry are dropped rather than rendered empty. */\nexport function renderHdFacts(facts: Fact[]) {\n\tconst shown = facts.filter((f) => Boolean(f.value));\n\tif (shown.length === 0) return nothing;\n\treturn html`<div class=\"facts\" part=\"facts\">${shown.map(\n\t\t\t(f) => html`<div class=\"fact\" part=\"fact\"><span>${f.label}</span> <strong>${f.value}</strong></div>`,\n\t\t)}</div>`;\n}\n\n/**\n * The signature and not-self pills: the feeling of being in alignment, and the one that signals being out of it.\n *\n * @remarks\n * Both values arrive already resolved to what a reader should see, because the response carries `signatureLocalized` and `notSelfLocalized` beside the canonical English pair and only the caller knows which half it is holding. The two words around them are this card's own and go through `t`.\n */\nexport function renderHdThemes(\n\tsignature: string | undefined,\n\tnotSelf: string | undefined,\n\tt: Translate,\n) {\n\tif (!signature && !notSelf) return nothing;\n\treturn html`<div class=\"themes\" part=\"themes\">${signature ? html`<span class=\"pill pill--good\">${t('Signature: {{value}}', { value: signature })}</span>` : nothing} ${notSelf ? html`<span class=\"pill pill--shadow\">${t('Not-self: {{value}}', { value: notSelf })}</span>` : nothing}</div>`;\n}\n\n/** The two profile lines, each with the keynote of the line. Personality first: it is the conscious line and the one the profile is read from. */\nexport function renderHdKeynotes(k: ProfileKeynotes | undefined, t: Translate) {\n\tif (!k?.personality && !k?.design) return nothing;\n\treturn html`<dl class=\"keynotes\" part=\"keynotes\">${\n\t\t\tk.personality\n\t\t\t\t? html`<dt>${t('Line {{line}} · Personality', { line: k.personalityLine ?? '' })}</dt><dd>${k.personality}</dd>`\n\t\t\t\t: nothing\n\t\t} ${\n\t\t\tk.design\n\t\t\t\t? html`<dt>${t('Line {{line}} · Design', { line: k.designLine ?? '' })}</dt><dd>${k.design}</dd>`\n\t\t\t\t: nothing\n\t\t}</dl>`;\n}\n"],
5
- "mappings": "4MAAA,OAAS,OAAAA,GAAK,QAAAC,EAAM,WAAAC,MAAe,MACnC,OAAS,iBAAAC,OAAqB,oBCD9B,OAA8B,QAAAC,EAAM,WAAAC,OAAoC,MACxE,OAAS,YAAAC,EAAU,SAAAC,MAAa,oBAChC,OAAS,aAAAC,MAAiB,+BCF1B,OAAS,cAAAC,OAAkB,MC6BpB,SAASC,EAAYC,EAAqC,CAGhE,GAAIA,EAAG,KAAM,OAAOA,EAAG,KACvB,GAAI,OAAO,SAAa,IAAa,OACrC,IAAMC,EAAYD,EAAG,UAAU,QAAQ,GAAG,aAAa,MAAM,EAC7D,OAAIC,GACG,SAAS,gBAAgB,MAAQ,MACzC,CCRO,SAASC,EAAUC,EAAmB,CAC5C,OAAOA,EACL,YAAY,EACZ,QAAQ,WAAY,GAAG,EACvB,KAAK,CACR,CAOO,SAASC,EAASC,EAAmB,CAC3C,OACCA,EACE,QAAQ,SAAU,GAAG,EACrB,QAAQ,kBAAmB,OAAO,EAGlC,QAAQ,kBAAmB,OAAO,EAClC,QAAQ,MAAQC,GAAMA,EAAE,YAAY,CAAC,CAEzC,CCPA,IAAMC,EAAa,mBAEnB,SAASC,GAA2B,CACnC,IAAMC,EAAS,WACTC,EAAWD,EAAOF,CAAU,EAClC,GAAIG,EAAU,OAAOA,EACrB,IAAMC,EAA0B,CAC/B,SAAU,CAAC,EACX,YAAa,CAAC,EACd,UAAW,IAAI,IACf,UAAW,IAAI,GAChB,EACA,OAAAF,EAAOF,CAAU,EAAII,EACdA,CACR,CA0BO,SAASC,EACfC,EACAC,EACS,CACT,OAAKA,EACED,EAAS,QAAQ,iBA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AAW,CAAC,GAAG,IAAI2B,CAAU,EAAE,KAAK,MAAM,CAAC,YAAY3B,EAAE,SAAW,EAAE,YAAYA,EAAE,QAAUU,sBAAyBV,EAAE,OAAO,UAAYe,CAAO,yBAAyBc,GAAS7B,EAAE,YAAY,CAAC,yBAAyB6B,GAAS7B,EAAE,YAAY,CAAC,YACnV,CAAC,kCACN,CACD,EAxKaJ,EACL,OAAS,CACfkC,EACAC,GACAC,GACAC,GACAC,GACAC,wgFACD,EARYvC,EAANwC,EAAA,CADNC,GAAc,oBAAoB,GACtBzC,GA2Kb,SAASwB,EAAakB,EAA2C,CAChE,GAAI,OAAOA,GAAM,SACjB,OAAIA,IAAM,EAAU,OACbA,IAAM,EAAI,YAAc,GAAGA,CAAC,WACpC,CAGA,SAAST,GAASU,EAAqC,CACtD,IAAMC,EAAOD,GAAS,CAAC,EACvB,OAAOC,EAAK,OAAS,EAAIA,EAAK,KAAK,IAAI,EAAI,SAC5C,CAGA,SAASf,GAAUgB,EAAkBnB,EAAYC,EAAoB,CACpE,OAAID,GAAKC,EAAU,yBACfD,EAAU,eACVC,EAAU,eACPkB,EACJ,mDACA,qBACJ",
6
- "names": ["css", "html", "nothing", "customElement", "html", "nothing", "property", "state", "ifDefined", "LitElement", "resolveLang", "el", "inherited", "lookupKey", "s", "humanize", "s", "c", "GLOBAL_KEY", "registry", "holder", "existing", "created", "interpolate", "template", "vars", "match", "key", "translate", "lang", "source", "catalogs", "registry", "tag", "catalog", "lookupKey", "onLocaleChange", "listener", "listeners", "registry", "LocaleController", "host", "onLocaleChange", "RoxyLocalizedElement", "LitElement", "source", "vars", "LocaleController", "translate", "resolveLang", "css", "baseStyles", "KEY_REFUSED_MESSAGE", "keyIsRefused", "key", "dispatchKeyRefusal", "host", "opts", "KEY_REFUSED_MESSAGE", "DEFAULT_BASE_URL", "readApiError", "res", "body", "FetchController", "host", "req", "controller", "json", "err", "signal", "url", "k", "v", "headers", "keyIsRefused", "KEY_REFUSED_MESSAGE", "dispatchKeyRefusal", "buildRequest", "endpoint", "method", "values", "queryKeys", "rest", "path", "_match", "name", "inQuery", "query", "css", "html", "nothing", "css", "html", "chevron", "disclosureStyles", "readingDetailStyles", "css", "interpAccordionStyles", "renderInterpAccordion", "sections", "name", "heading", "shown", "s", "nothing", "html", "chevron", "ROXY_DATA_CLASS", "isJsonScript", "el", "MarkupDataController", "host", "parsed", "inline", "child", "ROXY_DATA_CLASS", "text", "RoxyDataElement", "RoxyLocalizedElement", "e", "detail", "buildRequest", "MarkupDataController", "FetchController", "baseStyles", "changed", "html", "names", "n", "nothing", "rules", "sections", "name", "heading", "renderInterpAccordion", "data", "body", "ifDefined", "raw", "values", "message", "banner", "__decorateClass", "property", "state", "nothing", "svg", "X_MIN", "X_MAX", "Y_MIN", "Y_MAX", "UNIT", "VIEW_W", "VIEW_H", "g", "x", "y", "AXIS", "mirrorX", "GATE_RADIUS", "GATE_FONT_SIZE", "COL", "EDGE", "G_EDGE", "GATES_BY_CENTER", "SPLEEN_TO_SOLAR_PLEXUS", "buildGatePoints", "points", "centerOf", "spleenGate", "center", "gates", "gate", "GATE_POINTS", "GATE_CENTER", "CHART_AXIS_X", "shape", "corners", "squareShape", "halfWidth", "top", "bottom", "SQUARE_HALF", "SPLEEN_SHAPE", "CENTER_GEOMETRY", "CHANNEL_PAIRS", "BODY_PATH", "buildBodyPath", "m", "r", "segs", "pt", "i", "ptm", "p", "polygonPoints", "pts", "sourceClass", "s", "renderBody", "renderChannels", "gateSources", "lines", "a", "b", "pa", "pb", "mid", "from", "sources", "cls", "renderCenters", "defined", "names", "stateWords", "c", "isDefined", "label", "halfDisc", "sweep", "renderGates", "titles", "out", "num", "title", "BODYGRAPH_VIEWBOX", "renderBodygraphSvg", "input", "css", "bodygraphChartStyles", "css", "GATE_FONT_SIZE", "css", "html", "nothing", "hdReadingStyles", "renderHdFacts", "facts", "shown", "f", "nothing", "html", "RoxyHdConnection", "RoxyDataElement", "d", "gateSources", "c", "left", "right", "gate", "held", "definedCenters", "centerNames", "gateTitles", "name", "who", "html", "BODYGRAPH_VIEWBOX", "renderBodygraphSvg", "channels", "centers", "nothing", "renderHdFacts", "humanize", "s", "sections", "channelCount", "by", "a", "b", "together", "centerWho", "names", "centerName", "id", "gateList", "baseStyles", "disclosureStyles", "interpAccordionStyles", "hdReadingStyles", "bodygraphChartStyles", "css", "__decorateClass", "customElement", "n", "gates", "list", "defined"]
4
+ "sourcesContent": ["import { css, html, nothing } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport type { CalculateConnectionResponse } from '../types/index.js';\nimport { RoxyDataElement } from '../utils/base-element.js';\nimport { baseStyles } from '../utils/base-styles.js';\nimport {\n\tBODYGRAPH_VIEWBOX,\n\ttype BodygraphCenterId,\n\ttype GateSources,\n\trenderBodygraphSvg,\n} from '../utils/bodygraph-render.js';\nimport { bodygraphChartStyles } from '../utils/bodygraph-styles.js';\nimport { disclosureStyles } from '../utils/disclosure.js';\nimport { hdReadingStyles, renderHdFacts } from '../utils/hd-reading.js';\nimport {\n\ttype InterpSection,\n\tinterpAccordionStyles,\n} from '../utils/interp-accordion.js';\nimport { humanize } from '../utils/string.js';\n\ntype Connection = CalculateConnectionResponse;\ntype ConnectionChannel = Connection['channels'][number];\ntype CombinedCenter = Connection['centers'][number];\n\n/**\n * Human Design connection chart. Renders /human-design/connection: the composite of two charts as the electromagnetic / compromise / dominance channels they form together, plus the combined definition and a summary. The HD analog of synastry. Each channel row shows its two gates, name, circuit, the relationship dynamic, and which person carries which gate.\n *\n * @remarks\n * The chart answers one question: what exists between these two that does not exist in either of them alone. It leads with the combined bodygraph, drawn on the same geometry a single chart uses with each gate marked for whoever carries it, then the combined centers, then the channel list. `defined` is the state of the COMBINED bodygraph, `definedBy` names who already defines that center in their own chart, and the gap between the two is the reading: a center that comes back defined with an empty `definedBy` is defined by the connection itself, present when the two are together and absent when they are apart.\n *\n * The four dynamics are the taxonomy the summary counts, and a bare count of \"Dominance: 2\" means nothing to a reader who does not already know the system, so each one carries its definition behind the shared disclosure rather than shipping as a bare label.\n */\n@customElement('roxy-hd-connection')\nexport class RoxyHdConnection extends RoxyDataElement<Connection> {\n\tstatic styles = [\n\t\tbaseStyles,\n\t\tdisclosureStyles,\n\t\tinterpAccordionStyles,\n\t\thdReadingStyles,\n\t\tbodygraphChartStyles,\n\t\tcss`.wrap{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);grid-template-columns:minmax(0,1fr);display:grid}.head{justify-content:space-between;align-items:baseline;gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.title{font-size:var(--roxy-text-lg,1.125rem);font-weight:var(--roxy-weight-bold,600);margin:0}.count{color:var(--roxy-accent-ink,#b45309);font-size:var(--roxy-text-sm,.875rem);font-weight:var(--roxy-weight-bold,600);font-variant-numeric:tabular-nums}.note{margin:0 0 var(--roxy-space-sm,.5rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);line-height:1.6}.row{align-items:center;gap:var(--roxy-space-sm,.5rem);padding:var(--roxy-space-sm,.5rem) 0;border-bottom:1px solid var(--roxy-border,#e4e4e7);font-size:var(--roxy-text-sm,.875rem);flex-wrap:wrap;display:flex}.row:last-child{border-bottom:none}.cname{flex:1;min-width:8rem}.badge{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);font-weight:var(--roxy-weight-bold,600);padding:1px 8px;display:inline-flex}.badge.defined{background:color-mix(in srgb, var(--roxy-success,#16a34a) 16%, transparent);color:var(--roxy-success-fg,#166534)}.badge.open{background:color-mix(in srgb, var(--roxy-border,#e4e4e7) 45%, transparent);color:var(--roxy-fg,#0a0a0a)}.badge.together{background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 18%, transparent);color:var(--roxy-fg,#0a0a0a)}.who{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem)}table{border-collapse:collapse;width:100%;font-size:var(--roxy-text-sm,.875rem)}th,td{text-align:left;padding:var(--roxy-space-sm,.5rem);border-bottom:1px solid var(--roxy-border,#e4e4e7);white-space:nowrap}th{color:var(--roxy-muted,#71717a);font-weight:var(--roxy-weight-bold,600);text-transform:uppercase;font-size:var(--roxy-text-xs,.75rem);letter-spacing:.04em}tbody tr:last-child td{border-bottom:none}.gates{font-variant-numeric:tabular-nums;color:var(--roxy-accent-ink,#b45309);font-weight:var(--roxy-weight-bold,600)}.dyn{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:1px 8px;display:inline-block}.held{font-variant-numeric:tabular-nums}.scroll{min-width:0;overflow-x:auto}.wrap{--src-left:#1f6fb2;--src-right:#b04e14;--src-ink:#fff}`,\n\t];\n\n\t/**\n\t * The combined bodygraph the two charts make together, on the same geometry a\n\t * single chart uses.\n\t *\n\t * @remarks\n\t * A gate is marked for whoever carries it, so a channel each person half owns\n\t * draws in two colours and a channel one person holds outright draws in one.\n\t * That is the electromagnetic and dominance distinction the summary counts,\n\t * shown rather than tallied. Centers take the COMBINED state, which is the\n\t * chart the two of them are when together; who defines one alone is named in\n\t * the centers section, where the badge can say it in words.\n\t */\n\tprivate renderChart(d: Connection) {\n\t\tconst gateSources = new Map<number, GateSources>();\n\t\tfor (const c of d.channels ?? []) {\n\t\t\tconst left = new Set(c.personAGates ?? []);\n\t\t\tconst right = new Set(c.personBGates ?? []);\n\t\t\tfor (const gate of [c.gateA, c.gateB]) {\n\t\t\t\tif (gate == null) continue;\n\t\t\t\tconst held = gateSources.get(gate) ?? { left: false, right: false };\n\t\t\t\theld.left ||= left.has(gate);\n\t\t\t\theld.right ||= right.has(gate);\n\t\t\t\tgateSources.set(gate, held);\n\t\t\t}\n\t\t}\n\t\tconst definedCenters = new Set<BodygraphCenterId>(\n\t\t\t(d.centers ?? [])\n\t\t\t\t.filter((c) => c.defined)\n\t\t\t\t.map((c) => c.id as BodygraphCenterId),\n\t\t);\n\t\tconst centerNames = new Map<BodygraphCenterId, string>(\n\t\t\t(d.centers ?? []).map((c) => [c.id as BodygraphCenterId, c.name]),\n\t\t);\n\t\tconst gateTitles = new Map<number, string>();\n\t\tfor (const c of d.channels ?? []) {\n\t\t\tconst name = c.name;\n\t\t\tfor (const gate of [c.gateA, c.gateB]) {\n\t\t\t\tif (gate == null) continue;\n\t\t\t\tconst held = gateSources.get(gate);\n\t\t\t\tconst who = [held?.left && 'A', held?.right && 'B']\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(' + ');\n\t\t\t\tgateTitles.set(\n\t\t\t\t\tgate,\n\t\t\t\t\t[`Gate ${gate}`, name, who].filter(Boolean).join(' · '),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn html`<svg class=\"chart\" part=\"chart\" viewBox=\"${BODYGRAPH_VIEWBOX}\" preserveAspectRatio=\"xMidYMid meet\" role=\"img\" aria-label=\"Combined Human Design bodygraph for two charts, with each gate marked for the person who carries it\"><title>Combined bodygraph</title>${renderBodygraphSvg({\n\t\t\t\tdefinedCenters,\n\t\t\t\tgateSources,\n\t\t\t\tgateTitles,\n\t\t\t\tcenterNames,\n\t\t\t\tstateWords: { defined: 'Defined', open: 'Open' },\n\t\t\t})}</svg><div class=\"legend\" part=\"legend\"><span><span class=\"swatch source src-left\"></span>Person A</span> <span><span class=\"swatch source src-right\"></span>Person B</span> <span><span class=\"swatch\"></span>Open center</span></div>`;\n\t}\n\n\tprotected renderData(d: Connection) {\n\t\tconst channels = d.channels ?? [];\n\t\tconst centers = d.centers ?? [];\n\t\tconst definedCenters = centers.filter((c) => c.defined).length;\n\n\t\treturn html`<div class=\"wrap\" part=\"card\" aria-label=\"Human Design connection\"><header class=\"head\" part=\"header\"><h2 class=\"title\">Connection</h2>${typeof d.totalChannels === 'number' ? html`<span class=\"count\">${d.totalChannels} channels</span>` : nothing}</header>${this.renderChart(d)} ${renderHdFacts([\n\t\t\t\t{ label: 'Channels', value: d.totalChannels?.toString() },\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Combined definition',\n\t\t\t\t\tvalue: d.combinedDefinition\n\t\t\t\t\t\t? humanize(String(d.combinedDefinition))\n\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Centers defined',\n\t\t\t\t\tvalue:\n\t\t\t\t\t\tcenters.length > 0\n\t\t\t\t\t\t\t? `${definedCenters} of ${centers.length}`\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t])} ${\n\t\t\t\tthis.hideReadings\n\t\t\t\t\t? nothing\n\t\t\t\t\t: html`<p class=\"lead\">A connection chart reads the two charts as one bodygraph. Wherever the two of them together hold both gates of a channel, that channel is defined between them, and the centers it joins are defined in the connection whether or not either person defines them alone.</p>`\n\t\t\t} ${this.renderDynamics(d.summary)} ${this.renderCenters(centers)} ${this.renderChannels(channels, centers)}</div>`;\n\t}\n\n\t/**\n\t * The four ways two charts can meet in a channel, in canonical order, each with what it means. The count is the aside, so the taxonomy and the tally read as one thing: a dynamic with no channels still shows, because its absence is as much a fact of the connection as its presence.\n\t */\n\tprivate renderDynamics(s: Connection['summary'] | undefined) {\n\t\tif (!s) return nothing;\n\t\tconst sections: InterpSection[] = [\n\t\t\t{\n\t\t\t\tlabel: 'Electromagnetic',\n\t\t\t\taside: channelCount(s.electromagnetic),\n\t\t\t\tbody: 'Each person holds one of the two gates, so the channel completes only when they are together. The classic point of attraction.',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'Dominance',\n\t\t\t\taside: channelCount(s.dominance),\n\t\t\t\tbody: 'One person holds both gates and the other holds neither, so the conditioning runs one way, from the person who carries the channel to the person who does not.',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'Compromise',\n\t\t\t\taside: channelCount(s.compromise),\n\t\t\t\tbody: 'One person holds both gates and the other holds a single hanging gate of the same channel, so the channel is complete for one of them and half open for the other.',\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: 'Companionship',\n\t\t\t\taside: channelCount(s.companionship),\n\t\t\t\tbody: 'Both people independently hold both gates, so neither needs the other to complete it. A shared and familiar frequency rather than an attraction.',\n\t\t\t},\n\t\t];\n\t\treturn this.renderInterpretation(\n\t\t\tsections,\n\t\t\t'hd-connection-dynamic',\n\t\t\t'Dynamics',\n\t\t);\n\t}\n\n\t/**\n\t * The nine centers of the combined chart. `defined` is the combined state and `definedBy` is who carries it alone, so the two together say whether a center is brought to the connection or created by it.\n\t */\n\tprivate renderCenters(centers: CombinedCenter[]) {\n\t\tif (centers.length === 0) return nothing;\n\t\treturn html`<section class=\"block\" part=\"section centers\"><h3>Centers</h3>${\n\t\t\t\t// The rows below are the state of each center and stay; this note is the\n\t\t\t\t// explanation of how to read them.\n\t\t\t\tthis.hideReadings\n\t\t\t\t\t? nothing\n\t\t\t\t\t: html`<p class=\"note\">Defined is the state of the combined chart. Beside it is who already defines that center in their own chart. A center defined only together is what the connection itself creates: it is there when the two are together and gone when they are apart. The combined definition counts how the defined centers hang together, so Single is one connected piece and a split is more than one.</p>`\n\t\t\t} ${centers.map((c) => {\n\t\t\t\tconst by = c.definedBy ?? [];\n\t\t\t\tconst a = by.includes('A');\n\t\t\t\tconst b = by.includes('B');\n\t\t\t\t// Only the connection defines it: defined in the combined chart, and in\n\t\t\t\t// neither chart on its own.\n\t\t\t\tconst together = Boolean(c.defined) && !a && !b;\n\t\t\t\treturn html`<div class=\"row\"><span class=\"cname\">${c.name ?? humanize(String(c.id ?? ''))}</span> <span class=\"badge ${c.defined ? (together ? 'together' : 'defined') : 'open'}\">${c.defined ? (together ? 'Only together' : 'Defined') : 'Open'} </span><span class=\"who\">${centerWho(Boolean(c.defined), a, b)}</span></div>`;\n\t\t\t})}</section>`;\n\t}\n\n\t/**\n\t * Every connected channel. The centers a channel joins are named, not left as ids, because the row is what explains a defined center in the block above: this is the wiring that produced it.\n\t */\n\tprivate renderChannels(\n\t\tchannels: ConnectionChannel[],\n\t\tcenters: CombinedCenter[],\n\t) {\n\t\tif (channels.length === 0) return nothing;\n\t\tconst names = new Map(\n\t\t\tcenters.map((c) => [String(c.id ?? ''), c.name ?? ''] as const),\n\t\t);\n\t\tconst centerName = (id: string) => names.get(id) || humanize(id);\n\n\t\treturn html`<section class=\"block\" part=\"section channels\"><h3>Channels</h3><div class=\"scroll\" part=\"table\" tabindex=\"0\" role=\"region\" aria-label=\"Connection channels\"><table role=\"table\"><caption class=\"roxy-sr-only\">Connection channels: each channel with its gates, the centers it links, its circuit and dynamic, and the gates person A and person B each hold.</caption><thead><tr><th scope=\"col\">Channel</th><th scope=\"col\">Gates</th><th scope=\"col\">Centers</th><th scope=\"col\">Circuit</th><th scope=\"col\">Dynamic</th><th scope=\"col\">Person A holds</th><th scope=\"col\">Person B holds</th></tr></thead><tbody>${channels.map(\n\t\t\t\t\t\t\t(c) => html`<tr><td>${c.name ?? ''}</td><td class=\"gates\">${c.gateA}-${c.gateB}</td><td>${(c.centers ?? []).map(centerName).join(' to ')}</td><td>${c.circuit ?? ''}</td><td>${c.dynamic ? html`<span class=\"dyn\">${c.dynamic}</span>` : nothing}</td><td class=\"held\">${gateList(c.personAGates)}</td><td class=\"held\">${gateList(c.personBGates)}</td></tr>`,\n\t\t\t\t\t\t)}</tbody></table></div></section>`;\n\t}\n}\n\n/** The aside of a dynamic. A zero is stated rather than hidden: no companionship channels is a finding about the pair. */\nfunction channelCount(n: number | undefined): string | undefined {\n\tif (typeof n !== 'number') return undefined;\n\tif (n === 0) return 'None';\n\treturn n === 1 ? '1 channel' : `${n} channels`;\n}\n\n/** Which gates of the channel this person carries. Neither is possible: a dominance channel is held entirely by the other person. */\nfunction gateList(gates: number[] | undefined): string {\n\tconst list = gates ?? [];\n\treturn list.length > 0 ? list.join(', ') : 'Neither';\n}\n\n/** Who defines the center in their own chart, spelled out. `definedBy` is empty both when the center is open in both charts and when only the connection defines it, so the combined state has to disambiguate. */\nfunction centerWho(defined: boolean, a: boolean, b: boolean): string {\n\tif (a && b) return 'Defined in both charts';\n\tif (a) return 'Defined by A';\n\tif (b) return 'Defined by B';\n\treturn defined\n\t\t? 'Defined by neither alone, only by the connection'\n\t\t: 'Open in both charts';\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'roxy-hd-connection': RoxyHdConnection;\n\t}\n}\n", "import { type CSSResultGroup, html, nothing, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type { ChromeString } from '../i18n/chrome-strings.js';\nimport { RoxyLocalizedElement } from '../i18n/localized-element.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 = …` 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`, `empty`, `edit-bar`, `attribution`). A component adds `part` to its own structural blocks, drawn from the published part vocabulary.\n *\n * Translation is inherited rather than defined here: `t()`, `translator` and `effectiveLang()` live on {@link RoxyLocalizedElement}, which the two declared widgets extend as well, so the form a visitor fills and the card it produces read the same catalogue.\n *\n * @example\n * ```ts\n * @customElement('roxy-dream-card')\n * export class RoxyDreamCard extends RoxyDataElement<GetDreamSymbolResponse> {\n * static styles = [baseStyles, css`.card { … }`];\n * protected renderData(d: GetDreamSymbolResponse) {\n * return html`<article class=\"card\">…</article>`;\n * }\n * }\n * ```\n */\nexport abstract class RoxyDataElement<\n\tT = unknown,\n> extends RoxyLocalizedElement {\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/**\n\t * Remove named structural blocks from this component, as a comma-separated list of `part` names.\n\t *\n\t * @remarks\n\t * The sibling of {@link RoxyDataElement.hideReadings} and deliberately a different tool. `hide-readings` drops the PROSE an endpoint returns about a result; this drops a whole block whatever it contains, which is what a page wants when the block is measurement rather than writing. Hiding the chart-pattern list on a teaching page is the case it exists for: a T-square is data, so `hide-readings` leaves it standing on purpose.\n\t *\n\t * Any name in `components-catalog.json` works, on any component that publishes it, because the rule is generated from the name rather than from a list of components that opted in. A name no block carries costs nothing and hides nothing.\n\t *\n\t * **This hides with CSS, it does not remove from the DOM, and the difference is the reason both exist.** A part name is a rendering concern the base can act on generically; whether a block is prose is a question only the component can answer. So a page that must not SHIP the words uses `hide-readings`, and a page that just should not SHOW a block uses this.\n\t *\n\t * @example\n\t * ```html\n\t * <roxy-natal-chart hide-sections=\"patterns\"></roxy-natal-chart>\n\t * <roxy-natal-chart hide-sections=\"patterns, aspects\"></roxy-natal-chart>\n\t * ```\n\t */\n\t@property({ type: String, attribute: 'hide-sections', reflect: true })\n\thideSections = '';\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\tthis.fetcher = new FetchController<T>(this);\n\t}\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\treturn html`${this.hiddenSectionsStyle()}${this.renderState()}`;\n\t}\n\n\t/**\n\t * The one rule set that acts on {@link RoxyDataElement.hideSections}, generated from the names rather than from a list of components.\n\t *\n\t * @remarks\n\t * `[part~=\"name\"]` is the selector because `part` is a space-separated list: the natal chart's aspect grid carries `section aspects table aspect-grid`, so a `~=` match reaches it by any one of its names while `=` would reach it by none. It is emitted INSIDE the shadow root, which is the only place a rule can see a `part` attribute on the element that declares it.\n\t *\n\t * Names are filtered to the same `[a-z][a-z0-9-]*` shape the catalog and the WordPress setting both use, so nothing a page passes can close the rule or inject a second one. An unknown name compiles to a selector that matches nothing, which is why there is no validation error and no list of legal names to keep in sync.\n\t *\n\t * A `<style>` element in the template rather than a static stylesheet, because static styles are evaluated once and shared across every instance, so two charts on one page could not hide different blocks. Lit supports per-instance style elements; the documented cost is a re-parse when the expression changes, which is irrelevant here because the value is set once from a page attribute and effectively never changes after that.\n\t *\n\t * **`!important` is load-bearing and is not a shortcut around specificity.** Lit puts static `styles` in `adoptedStyleSheets`, and the scoping spec applies those AFTER any `<style>` element inside the same shadow root, so an in-tree rule loses to the component's own stylesheet at equal specificity no matter how it is written. Measured: `patterns` is a bare `section` with no declared display and hid correctly without it, while `legend` carries `display:flex` from the static sheet and stayed visible. The WordPress site-wide rule needs no `!important` for the opposite reason, that an outer-tree `::part()` rule already outranks anything inside.\n\t */\n\tprivate hiddenSectionsStyle(): unknown {\n\t\tconst names = this.hideSections\n\t\t\t.split(',')\n\t\t\t.map((n) => n.trim().toLowerCase())\n\t\t\t.filter((n) => /^[a-z][a-z0-9-]*$/.test(n));\n\t\tif (names.length === 0) return nothing;\n\t\tconst rules = names\n\t\t\t.map((n) => `[part~=\"${n}\"]{display:none!important}`)\n\t\t\t.join('');\n\t\treturn html`<style>${rules}</style>`;\n\t}\n\n\t/** The state machine every render goes through, split out so {@link render} can pair it with the per-instance rules above. */\n\tprivate renderState(): 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\t * @param heading - English source copy, translated here. Typed as {@link ChromeString} so the compiler, not a reviewer, rejects a heading no catalogue carries.\n\t */\n\tprotected renderInterpretation(\n\t\tsections: InterpSection[],\n\t\tname: string,\n\t\theading?: ChromeString,\n\t): unknown {\n\t\tif (this.hideReadings) return nothing;\n\t\t// Localized HERE rather than in the accordion: that is a plain render\n\t\t// function with no host, so it cannot read a language, and this is the one\n\t\t// call site every component routes through.\n\t\treturn renderInterpAccordion(sections, name, this.t(heading ?? '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\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: one translated message for every component, addressable as `::part(empty)`. Override only where an empty state must DO something a message cannot. */\n\tprotected renderEmpty(): unknown {\n\t\treturn html`<div class=\"roxy-empty\" role=\"status\" part=\"empty\">${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/**\n\t * Error state shown when a self-fetch fails. Keeps the form in view so the request can be retried.\n\t *\n\t * The message goes through `t()` because ONE of the messages that reaches here is ours: `KEY_REFUSED_MESSAGE` (`utils/key-guard.ts`), which {@link FetchController} assigns when a site owner pastes a secret key into a browser page, and which `<roxy-location-search>` renders in its own shadow root from the same constant. Translating it in one place and not the other would put two languages on one page. Everything else that lands here is a wire fact (an HTTP status, a browser network error), misses the catalogue and renders unchanged.\n\t */\n\tprotected renderError(message: string): unknown {\n\t\tconst banner = html`<div class=\"roxy-error\" role=\"alert\" part=\"error\">${this.t(message)}</div>`;\n\t\treturn this.endpoint ? html`${banner}${this.renderForm()}` : banner;\n\t}\n}\n", "import { LitElement } from 'lit';\nimport { resolveLang } from './lang.js';\nimport { LocaleController } from './locale-controller.js';\nimport { translate } from './registry.js';\n\n/**\n * The base every element that writes WORDS extends: it resolves the page language and translates its own chrome.\n *\n * @remarks\n * This is deliberately smaller than {@link RoxyDataElement}, and the split is what makes the widgets translatable at all. `<roxy-endpoint-form>` and `<roxy-location-search>` are the two declared widgets: they fetch, they hold state, and they are NOT data components, so they cannot inherit the data base without dragging its controlled-mode hydration, its self-fetch controller and its own form rendering (which renders the form, so the form inheriting it would compose itself). They extended `LitElement` directly instead, which meant they had no `t()` and no {@link LocaleController}, so a Spanish page rendered a Spanish result card over an English form and neither widget re-rendered when a deferred locale payload landed.\n *\n * So the mechanism lives here ONCE and all three inherit it. There is no second translator, no second registry and no second way to resolve a language: adding one is how a catalogue entry and a call site drift apart.\n *\n * Two costs are why this is its own module rather than a second export of `utils/base-element.ts`. Every `dist/cdn/components/*.js` is a self-contained IIFE, so importing the data base into the city search would compile `FetchController`, `MarkupDataController` and the interpretation accordion into a bundle that uses none of them. And `utils/base-element.ts` imports THIS file, so putting the class there would close a cycle the moment a widget imported it.\n */\nexport abstract class RoxyLocalizedElement extends LitElement {\n\tconstructor() {\n\t\tsuper();\n\t\t// Re-render if a chrome-string catalogue lands after this element upgraded.\n\t\t// A host page loads the payload as its own script tag, so it can arrive\n\t\t// after first paint and there is nothing the site owner could do about it.\n\t\tnew LocaleController(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. The same holds for a label derived from a spec field NAME through `humanize()`: a catalogue keyed on English source text cannot reach a string computed per response. A derived name is catalogued only where the set it comes from is CLOSED and small enough to enumerate against the spec, which is true of the nine form group names and of nothing else so far.\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 RoxyLocalizedElement.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\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", "/**\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 * All four links matter: with only the first, a component on a fully Spanish page renders English chrome and the only remedy is 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 * 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 * 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` on the page; 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/**\n\t * Language tag (lower case) to the API's field-label map: `fields` keyed by wire name,\n\t * `enums` keyed `{fieldName}.{value}`.\n\t *\n\t * A SEPARATE key space from `catalogs` on purpose. A chrome string is keyed by the English\n\t * text a component writes, which is a constant in our source; a field label is keyed by a\n\t * name that only the OpenAPI spec knows, computed per operation, so no catalogue keyed on\n\t * English source text can ever reach it. Same registry because the delivery problem is\n\t * identical (a payload that may land after first paint), so it reuses one global object and\n\t * one listener set rather than growing a second of each.\n\t */\n\tfieldLabels: Record<string, FieldLabels>;\n\t/** Language tags whose fetch is in flight or done, so N forms on a page cost ONE request. */\n\trequested: Set<string>;\n\t/** Elements waiting to re-render when a catalogue arrives. */\n\tlisteners: Set<() => void>;\n}\n\n/** The `/languages/field-labels` payload, minus the echoed `lang`. */\nexport interface FieldLabels {\n\tfields: Record<string, string>;\n\tenums: Record<string, string>;\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 = {\n\t\tcatalogs: {},\n\t\tfieldLabels: {},\n\t\trequested: new Set(),\n\t\tlisteners: new Set(),\n\t};\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/**\n * Publish a field-label map for a language tag and wake every mounted element.\n *\n * @remarks\n * Exported so a host that already has the payload (a server-rendered page, a test, a WordPress\n * plugin inlining it) can supply it without a network call, exactly as {@link registerLocale}\n * allows for chrome strings.\n */\nexport function registerFieldLabels(lang: string, labels: FieldLabels): void {\n\tconst reg = registry();\n\treg.fieldLabels[lang.toLowerCase()] = labels;\n\tfor (const listener of reg.listeners) listener();\n}\n\n/** The field-label map for `lang`, resolving a regional tag against its base language. */\nfunction labelsFor(lang: string | undefined): FieldLabels | undefined {\n\tif (!lang) return undefined;\n\tconst { fieldLabels } = registry();\n\tconst tag = lang.toLowerCase();\n\treturn fieldLabels[tag] ?? fieldLabels[tag.split('-')[0] as string];\n}\n\n/**\n * The label for a request field name, or `undefined` when nothing has been published.\n *\n * @remarks\n * Returning `undefined` rather than the name is deliberate: the caller owns the fallback, which is\n * `humanize()`, and that keeps this resolver honest about what it actually knows. A form renders\n * identically to before until a payload arrives.\n */\nexport function fieldLabel(\n\tlang: string | undefined,\n\tname: string,\n): string | undefined {\n\treturn labelsFor(lang)?.fields[name];\n}\n\n/** The label for one selectable option, keyed `{fieldName}.{value}` as the API publishes it. */\nexport function optionLabel(\n\tlang: string | undefined,\n\tfield: string,\n\tvalue: string,\n): string | undefined {\n\treturn labelsFor(lang)?.enums[`${field}.${value}`];\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. */\n/** The public API root. Exported so anything else that must reach the API (the field-label\n * fetch in `endpoint-form`) uses the SAME origin as every data request instead of a second copy. */\nexport const DEFAULT_BASE_URL = 'https://roxyapi.com/api/v2';\n\n/**\n * Turn a failed `Response` into the message to show: the API's own `{ error }` string when the body carries one, else the status line.\n *\n * @remarks\n * Exported so every client-side fetch boundary renders the same words for the same failure, the way {@link keyIsRefused} centralizes the key refusal. A boundary that discards the response body cannot tell a rejected request from an empty result, and renders the two identically.\n */\nexport async function readApiError(res: Response): Promise<string> {\n\ttry {\n\t\tconst body = (await res.json()) as { error?: string };\n\t\tif (body?.error) return body.error;\n\t} catch {\n\t\t// Non-JSON error body: fall through to the status line.\n\t}\n\treturn `Request failed (${res.status})`;\n}\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 readApiError(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\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. A card that draws its own disclosure, because its summary carries more than a label and an aside, still renders the shared body and imports {@link readingDetailStyles} for it rather than restating those rules.\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 type { ChromeString } from '../i18n/chrome-strings.js';\nimport { chevron } from './disclosure.js';\nimport type { Translate } from './hd-reading.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\n/**\n * Styles for the markup {@link renderReadingDetail} emits. Import this wherever that helper is called; {@link interpAccordionStyles} already embeds it, so an accordion caller needs only the one.\n *\n * @remarks\n * Separate from the accordion shell because the two are needed independently: a card can draw its own disclosure and still render the shared reading body, and hand-copying these rules is how the chip colour and spacing drifted apart across five components.\n *\n * No margin-top on the chip row. The body above already spaces its children, so a margin here would set the chips twice as far out as every other row.\n */\nexport const readingDetailStyles = css`.interp-keywords{flex-wrap:wrap;gap:.25rem;display:flex}.interp-keywords .kw{border-radius:var(--roxy-radius-full,9999px);background:color-mix(in srgb, var(--roxy-accent,#f59e0b) 14%, transparent);color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-xs,.75rem);padding:1px 8px}`;\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}${readingDetailStyles}`;\n\n/** The keyword chips a reading carries, or nothing. One renderer because four components drew the identical row, and the markup has to match {@link readingDetailStyles}, which is the pairing that drifts when it is copied. */\nexport function renderKeywordChips(keywords: readonly string[] | undefined) {\n\tif (!keywords?.length) return nothing;\n\treturn html`<div class=\"interp-keywords\">${keywords.map((k) => html`<span class=\"kw\">${k}</span>`)}</div>`;\n}\n\n/** The prose an endpoint returns ABOUT one contact: a summary, up to three labelled lines, and the keyword chips under them. Every field is optional, so a narrower response renders fewer rows rather than empty ones. */\nexport interface ReadingDetail {\n\tsummary?: string;\n\timpact?: string;\n\ttiming?: string;\n\tguidance?: string;\n\tkeywords?: readonly string[];\n}\n\n/** Render one {@link ReadingDetail}. The three labels are copy, so this takes the translator, and they are typed {@link ChromeString} because the lookup is one indirection from the call: a scan of `t(...)` sites cannot follow that, and the compiler can. */\nexport function renderReadingDetail(\n\td: ReadingDetail | undefined,\n\tt: Translate,\n) {\n\tif (!d) return nothing;\n\tconst line = (label: ChromeString, value: string | undefined) =>\n\t\tvalue ? html`<p><strong>${t(label)}</strong> ${value}</p>` : nothing;\n\treturn html`${d.summary ? html`<p>${d.summary}</p>` : nothing} ${line('Impact:', d.impact)}${line('Timing:', d.timing)}${line('Guidance:', d.guidance)} ${renderKeywordChips(d.keywords)}`;\n}\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: string,\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\">…</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", "import type { TemplateResult } from 'lit';\nimport { nothing, svg } from 'lit';\n\n/**\n * Fixed geometry and renderer for the Human Design bodygraph: nine centers, 36 channels, all 64 gates, over a front-facing silhouette. Only which centers are defined and which gates are activated changes per chart.\n *\n * @remarks\n * Points are authored in a 0 to 100 grid and mapped into {@link BODYGRAPH_VIEWBOX} by {@link g}, so the chart and the silhouette share one space. The window is tight to the drawing rather than square, because every unused grid unit costs gate-number size. `tests/bodygraph.test.ts` holds the layout to the canonical shapes, orientations and row order.\n */\n\nexport type BodygraphCenterId =\n\t| 'head'\n\t| 'ajna'\n\t| 'throat'\n\t| 'g'\n\t| 'heart'\n\t| 'sacral'\n\t| 'solar-plexus'\n\t| 'spleen'\n\t| 'root';\n\ninterface Point {\n\tx: number;\n\ty: number;\n}\n\n/** Which of the two sources activated a gate; both splits the circle. The renderer names neither, so one card reads them as the two sides of a person and another as two people. */\nexport interface GateSources {\n\tleft: boolean;\n\tright: boolean;\n}\n\n/** One center's drawable geometry, plus the English fallback name for its accessible title when the response carries none. */\ninterface CenterGeometry {\n\tid: BodygraphCenterId;\n\tlabel: string;\n\tcolor: CenterColor;\n\tpoints: Point[];\n\t/** Where the centre name sits, when the shape's middle is taken by a gate number. Defaults to the centroid. */\n\tlabelAt?: Point;\n}\n\n/** Traditional center color group: gold for Head and G, green for Ajna, red for the Heart and Sacral motors, brown for the rest. A defined center is filled with it; an open one takes the card surface so the wiring passes behind. */\nexport type CenterColor = 'gold' | 'green' | 'red' | 'brown';\n\n/** The grid window the viewBox covers, with nothing to spare: margin here is space the drawing does not get. Symmetric about {@link AXIS}, and the topmost element is the Head apex rather than the silhouette. */\nconst X_MIN = 14;\nconst X_MAX = 86;\nconst Y_MIN = 0;\nconst Y_MAX = 102;\n/** Grid units to viewBox units. One number sets the resolution of every coordinate below. */\nconst UNIT = 6;\nconst VIEW_W = (X_MAX - X_MIN) * UNIT;\nconst VIEW_H = (Y_MAX - Y_MIN) * UNIT;\n\n/** Map a normalized grid point into viewBox units. */\nfunction g(x: number, y: number): Point {\n\treturn { x: (x - X_MIN) * UNIT, y: (y - Y_MIN) * UNIT };\n}\n\n/** Chart horizontal center, the axis of symmetry for the body and the side centers. */\nconst AXIS = 50;\n\n/** Reflect a normalized grid x across {@link AXIS}. */\nconst mirrorX = (x: number): number => 2 * AXIS - x;\n\n/** Gate circle and number size, in grid units. Bounded by the closest pair on the chart (Throat 12 and 45, 2.3 apart) and by fitting two digits inside the circle. */\nexport const GATE_RADIUS = 1.02 * UNIT;\nexport const GATE_FONT_SIZE = 1.35 * UNIT;\n/** The centre name behind the numbers. Smaller than a gate number so it reads as ground rather than as another value. */\nexport const CENTER_NAME_FONT_SIZE = 1.15 * UNIT;\n\n/** The three x offsets from {@link AXIS} a central-column gate sits on: the inner triples, the outer column of the square centers, and the G's wider waist pair. Named so they cannot drift apart one edit at a time. */\nconst COL = 2.87;\nconst EDGE = 4.4;\nconst G_EDGE = 5.65;\n\n/** Gate positions per center, in canonical reading order. Symmetry is structural rather than typed: the central column is authored as offsets from {@link AXIS}, and the Solar Plexus is left empty and filled by reflecting the Spleen in {@link buildGatePoints}. */\nconst GATES_BY_CENTER: Record<\n\tBodygraphCenterId,\n\tRecord<number, [number, number]>\n> = {\n\thead: { 64: [AXIS - COL, 11.2], 61: [AXIS, 11.2], 63: [AXIS + COL, 11.2] },\n\tajna: {\n\t\t47: [AXIS - COL, 18.0],\n\t\t24: [AXIS, 18.0],\n\t\t4: [AXIS + COL, 18.0],\n\t\t17: [AXIS - COL, 20.6],\n\t\t11: [AXIS + COL, 20.6],\n\t\t43: [AXIS, 25.3],\n\t},\n\tthroat: {\n\t\t62: [AXIS - COL, 32.4],\n\t\t23: [AXIS, 32.4],\n\t\t56: [AXIS + COL, 32.4],\n\t\t16: [AXIS - EDGE, 34.7],\n\t\t35: [AXIS + EDGE, 34.7],\n\t\t20: [AXIS - EDGE, 37.3],\n\t\t12: [AXIS + EDGE, 37.3],\n\t\t45: [AXIS + EDGE, 39.6],\n\t\t31: [AXIS - COL, 41.9],\n\t\t8: [AXIS, 41.9],\n\t\t33: [AXIS + COL, 41.9],\n\t},\n\tg: {\n\t\t1: [AXIS, 47.7],\n\t\t7: [AXIS - COL, 50.3],\n\t\t13: [AXIS + COL, 50.3],\n\t\t10: [AXIS - G_EDGE, 53.4],\n\t\t25: [AXIS + G_EDGE, 53.4],\n\t\t15: [AXIS - COL, 56.8],\n\t\t46: [AXIS + COL, 56.8],\n\t\t2: [AXIS, 59.2],\n\t},\n\theart: {\n\t\t21: [63.9, 59.5],\n\t\t51: [62.1, 61.3],\n\t\t26: [60.1, 63.3],\n\t\t40: [66.6, 63.3],\n\t},\n\tspleen: {\n\t\t48: [20.0, 70.8],\n\t\t57: [22.5, 72.4],\n\t\t44: [25.0, 73.8],\n\t\t50: [27.7, 75.3],\n\t\t32: [25.0, 76.6],\n\t\t28: [22.5, 78.0],\n\t\t18: [20.0, 79.5],\n\t},\n\tsacral: {\n\t\t5: [AXIS - COL, 72.7],\n\t\t14: [AXIS, 72.7],\n\t\t29: [AXIS + COL, 72.7],\n\t\t34: [AXIS - EDGE, 75.4],\n\t\t27: [AXIS - EDGE, 79.0],\n\t\t59: [AXIS + EDGE, 79.0],\n\t\t42: [AXIS - COL, 81.7],\n\t\t3: [AXIS, 81.7],\n\t\t9: [AXIS + COL, 81.7],\n\t},\n\t'solar-plexus': {},\n\troot: {\n\t\t53: [AXIS - COL, 90.2],\n\t\t60: [AXIS, 90.2],\n\t\t52: [AXIS + COL, 90.2],\n\t\t54: [AXIS - EDGE, 92.6],\n\t\t19: [AXIS + EDGE, 92.6],\n\t\t38: [AXIS - EDGE, 95.3],\n\t\t39: [AXIS + EDGE, 95.3],\n\t\t58: [AXIS - EDGE, 98.1],\n\t\t41: [AXIS + EDGE, 98.1],\n\t},\n};\n\n/** Spleen gate to the Solar Plexus gate at its mirror position (base-top, ..., apex, ..., base-bottom). */\nconst SPLEEN_TO_SOLAR_PLEXUS: Record<number, number> = {\n\t48: 36,\n\t57: 22,\n\t44: 37,\n\t50: 6,\n\t32: 49,\n\t28: 55,\n\t18: 30,\n};\n\n/** Gate anchors and the gate-to-center index, filling the Solar Plexus by reflecting the Spleen so the two can never drift apart. */\nfunction buildGatePoints(): {\n\tpoints: Record<number, Point>;\n\tcenterOf: Record<number, BodygraphCenterId>;\n} {\n\tconst points: Record<number, Point> = {};\n\tconst centerOf: Record<number, BodygraphCenterId> = {};\n\tfor (const [spleenGate, [x, y]] of Object.entries(GATES_BY_CENTER.spleen)) {\n\t\tGATES_BY_CENTER['solar-plexus'][\n\t\t\tSPLEEN_TO_SOLAR_PLEXUS[Number(spleenGate)]\n\t\t] = [mirrorX(x), y];\n\t}\n\tfor (const [center, gates] of Object.entries(GATES_BY_CENTER) as Array<\n\t\t[BodygraphCenterId, Record<number, [number, number]>]\n\t>) {\n\t\tfor (const [gate, [x, y]] of Object.entries(gates)) {\n\t\t\tpoints[Number(gate)] = g(x, y);\n\t\t\tcenterOf[Number(gate)] = center;\n\t\t}\n\t}\n\treturn { points, centerOf };\n}\n\n/**\n * The viewBox-space gate anchors ({@link GATE_POINTS}) and the gate to center\n * index ({@link GATE_CENTER}). Exported so the geometry tests can assert the\n * layout invariants (side-center mirror symmetry, central-column balance, gates\n * inside their centers, circles that never overlap) without rendering.\n */\nexport const { points: GATE_POINTS, centerOf: GATE_CENTER } = buildGatePoints();\n\n/** Horizontal axis of symmetry in viewBox units, the reflection axis for geometry tests. */\nexport const CHART_AXIS_X = VIEW_W / 2;\n\n/** Build a polygon from normalized grid corner pairs, mapping each through {@link g}. */\nfunction shape(corners: ReadonlyArray<readonly [number, number]>): Point[] {\n\treturn corners.map(([x, y]) => g(x, y));\n}\n\n/** A square center, centered on {@link AXIS}, spanning the given half-width and y range. */\nfunction squareShape(halfWidth: number, top: number, bottom: number): Point[] {\n\treturn shape([\n\t\t[AXIS - halfWidth, top],\n\t\t[AXIS + halfWidth, top],\n\t\t[AXIS + halfWidth, bottom],\n\t\t[AXIS - halfWidth, bottom],\n\t]);\n}\n\n/** Measured half-width of the three square centers (Throat, Sacral, Root), which share one width. */\nconst SQUARE_HALF = 5.9;\n\n/** The Spleen triangle (base on the far-left edge, apex pointing right toward center). */\nconst SPLEEN_SHAPE: ReadonlyArray<readonly [number, number]> = [\n\t[18.3, 68.3],\n\t[18.3, 82.0],\n\t[30.3, 75.15],\n];\n\n/**\n * Center shapes in canonical orientation and color. Central-column centers are\n * built centered on {@link AXIS}; the Solar Plexus shape is the Spleen reflected\n * across the axis, so the side centers stay exact mirrors. The Heart is the\n * deliberate off-axis exception and points UP, not right.\n */\nexport const CENTER_GEOMETRY: readonly CenterGeometry[] = [\n\t{\n\t\tid: 'head',\n\t\tlabel: 'Head',\n\t\tcolor: 'gold',\n\t\tpoints: shape([\n\t\t\t[43.55, 12.5],\n\t\t\t[56.45, 12.5],\n\t\t\t[50.0, 1.7],\n\t\t]),\n\t},\n\t{\n\t\tid: 'ajna',\n\t\tlabel: 'Ajna',\n\t\tcolor: 'green',\n\t\tpoints: shape([\n\t\t\t[43.55, 16.5],\n\t\t\t[56.45, 16.5],\n\t\t\t[50.0, 27.7],\n\t\t]),\n\t},\n\t{\n\t\tid: 'throat',\n\t\tlabel: 'Throat',\n\t\tcolor: 'brown',\n\t\tpoints: squareShape(SQUARE_HALF, 31.0, 43.3),\n\t},\n\t{\n\t\tid: 'g',\n\t\tlabel: 'G',\n\t\tcolor: 'gold',\n\t\tpoints: shape([\n\t\t\t[50.0, 45.8],\n\t\t\t[57.7, 53.6],\n\t\t\t[50.0, 61.4],\n\t\t\t[42.3, 53.6],\n\t\t]),\n\t},\n\t{\n\t\tid: 'heart',\n\t\tlabel: 'Heart',\n\t\tcolor: 'red',\n\t\tpoints: shape([\n\t\t\t[56.65, 65.23],\n\t\t\t[64.2, 56.74],\n\t\t\t[69.75, 65.23],\n\t\t]),\n\t},\n\t{\n\t\tid: 'spleen',\n\t\tlabel: 'Spleen',\n\t\tcolor: 'brown',\n\t\tpoints: shape(SPLEEN_SHAPE),\n\t},\n\t{\n\t\tid: 'sacral',\n\t\tlabel: 'Sacral',\n\t\tcolor: 'red',\n\t\tpoints: squareShape(SQUARE_HALF, 71.3, 83.1),\n\t},\n\t{\n\t\tid: 'solar-plexus',\n\t\tlabel: 'Solar Plexus',\n\t\tcolor: 'brown',\n\t\tpoints: shape(\n\t\t\tSPLEEN_SHAPE.map(([x, y]) => [mirrorX(x), y] as [number, number]),\n\t\t),\n\t},\n\t{\n\t\tid: 'root',\n\t\tlabel: 'Root',\n\t\tcolor: 'brown',\n\t\tpoints: squareShape(SQUARE_HALF, 88.5, 99.8),\n\t},\n];\n\n/**\n * The 36 channels as ordered gate pairs. This is the canonical Human Design\n * channel set; a channel is active only when both of its gates are activated,\n * which the live response reports in its `channels` array. The static list lets\n * the renderer draw every channel as an inactive connector and overlay the\n * activated halves, so an open bodygraph still shows its full wiring skeleton.\n */\nexport const CHANNEL_PAIRS: ReadonlyArray<readonly [number, number]> = [\n\t[64, 47],\n\t[61, 24],\n\t[63, 4],\n\t[17, 62],\n\t[11, 56],\n\t[43, 23],\n\t[16, 48],\n\t[20, 34],\n\t[20, 10],\n\t[7, 31],\n\t[1, 8],\n\t[13, 33],\n\t[21, 45],\n\t[12, 22],\n\t[35, 36],\n\t[57, 20],\n\t[15, 5],\n\t[2, 14],\n\t[46, 29],\n\t[34, 10],\n\t[10, 57],\n\t[25, 51],\n\t[27, 50],\n\t[57, 34],\n\t[26, 44],\n\t[18, 58],\n\t[28, 38],\n\t[32, 54],\n\t[3, 60],\n\t[9, 52],\n\t[42, 53],\n\t[59, 6],\n\t[19, 49],\n\t[39, 55],\n\t[41, 30],\n\t[37, 40],\n];\n\n/**\n * Front-facing standing figure behind the chart, mirror-symmetric about {@link\n * AXIS} and authored in the same grid as the centers so the two scale together:\n * a rounded head holding the Head and Ajna, a short neck at the Throat, shoulders\n * sloping to arms whose span frames the Spleen and Solar Plexus, then hips ending\n * just below the Root. The right half is built from cubic beziers and reflected,\n * so the figure is exactly symmetric. Drawn first; the centers paint over it,\n * which is what makes an open center read as a cut-out rather than a tint.\n */\nconst BODY_PATH = buildBodyPath();\n\nfunction buildBodyPath(): string {\n\tconst m = mirrorX;\n\t// Right-side outline in grid units (x, y) from the crown down to the\n\t// pelvis-right corner: a start point, then triples of (ctrl1, ctrl2, end).\n\tconst r: Array<[number, number]> = [\n\t\t[50, 3], // crown apex (start), below the Head apex so the triangle reads above it\n\t\t[58, 3], // crown round (ctrl)\n\t\t[60, 10], // head side (ctrl)\n\t\t[57, 17.5], // brow, the head holds Head + Ajna (end)\n\t\t[56.5, 20.5], // cheek (ctrl)\n\t\t[53.5, 23.5], // jaw (ctrl)\n\t\t[51.5, 27], // neck right, narrowed to the Ajna apex (end)\n\t\t[54, 28], // neck base (ctrl)\n\t\t[64, 30], // trapezius slope (ctrl)\n\t\t[79, 35], // shoulder / deltoid, the widest point (end)\n\t\t[83, 42], // upper arm (ctrl)\n\t\t[84, 58], // outer arm, frames the side centers (ctrl)\n\t\t[83, 74], // arm past Spleen / Solar Plexus (end)\n\t\t[83, 86], // waist, held wide enough to contain the side-center bases (ctrl)\n\t\t[76, 93], // hip (ctrl)\n\t\t[68, 97], // hip (end)\n\t\t[64, 99], // toward the pelvis (ctrl)\n\t\t[62, 100.5], // pelvis (ctrl)\n\t\t[60, 100.5], // pelvis-right corner (end)\n\t];\n\tconst segs: string[] = [`M ${pt(r[0])}`];\n\t// Walk the right side as cubic beziers, three points per segment.\n\tfor (let i = 1; i + 2 < r.length; i += 3) {\n\t\tsegs.push(`C ${pt(r[i])} ${pt(r[i + 1])} ${pt(r[i + 2])}`);\n\t}\n\t// Flat pelvis hem across to the mirrored corner.\n\tsegs.push(`L ${ptm(r[r.length - 1], m)}`);\n\t// Mirror the right walk back up the left side to the crown.\n\tfor (let i = r.length - 3; i >= 1; i -= 3) {\n\t\tsegs.push(`C ${ptm(r[i + 1], m)} ${ptm(r[i], m)} ${ptm(r[i - 1], m)}`);\n\t}\n\tsegs.push('Z');\n\treturn segs.join(' ');\n}\n\nfunction pt([x, y]: [number, number]): string {\n\tconst p = g(x, y);\n\treturn `${p.x} ${p.y}`;\n}\n\nfunction ptm([x, y]: [number, number], m: (x: number) => number): string {\n\tconst p = g(m(x), y);\n\treturn `${p.x} ${p.y}`;\n}\n\nfunction polygonPoints(pts: Point[]): string {\n\treturn pts.map((p) => `${p.x},${p.y}`).join(' ');\n}\n\n/** The class for a source pair, or `both` when the mark has to carry two colours. */\nfunction sourceClass(s: GateSources): 'src-left' | 'src-right' | 'both' {\n\tif (s.left && s.right) return 'both';\n\treturn s.left ? 'src-left' : 'src-right';\n}\n\n/** Render the body silhouette behind the chart. */\nfunction renderBody(): TemplateResult {\n\treturn svg`<path class=\"bg-body\" d=${BODY_PATH} />`;\n}\n\n/**\n * Render every channel as a pair of halves meeting at the midpoint, so one\n * function draws both states a bodygraph distinguishes: both gates activated\n * reads as one continuous bar, a single activated gate as that gate hanging\n * halfway out of its center. Each half takes the colour of the gate at ITS end,\n * so a channel carrying one Personality gate and one Design gate is half dark and\n * half red rather than forced to one of the two.\n *\n * @remarks\n * A `pd` half is drawn twice, a solid Design line under a dashed Personality one,\n * for the striped bar a gate both sides activated takes. The inactive connector\n * is drawn first so the full 36-channel skeleton stays visible on an open chart.\n */\nfunction renderChannels(\n\tgateSources: ReadonlyMap<number, GateSources>,\n): TemplateResult[] {\n\tconst lines: TemplateResult[] = [];\n\tfor (const [a, b] of CHANNEL_PAIRS) {\n\t\tconst pa = GATE_POINTS[a];\n\t\tconst pb = GATE_POINTS[b];\n\t\tif (!pa || !pb) continue;\n\t\tlines.push(\n\t\t\tsvg`<line class=\"bg-channel\" x1=${pa.x} y1=${pa.y} x2=${pb.x} y2=${pb.y} />`,\n\t\t);\n\t\tconst mid = { x: (pa.x + pb.x) / 2, y: (pa.y + pb.y) / 2 };\n\t\tfor (const [gate, from] of [\n\t\t\t[a, pa],\n\t\t\t[b, pb],\n\t\t] as const) {\n\t\t\tconst sources = gateSources.get(gate);\n\t\t\tif (!sources) continue;\n\t\t\tconst cls = sourceClass(sources);\n\t\t\tlines.push(\n\t\t\t\tsvg`<line class=\"bg-half ${cls === 'both' ? 'src-left' : cls}\" x1=${from.x} y1=${from.y} x2=${mid.x} y2=${mid.y} />`,\n\t\t\t);\n\t\t\tif (cls === 'both') {\n\t\t\t\tlines.push(\n\t\t\t\t\tsvg`<line class=\"bg-half src-right stripe\" x1=${from.x} y1=${from.y} x2=${mid.x} y2=${mid.y} />`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn lines;\n}\n\n/**\n * Render the nine center shapes: filled with their semantic color when defined,\n * filled with the card surface and outlined when open so the wiring and the\n * silhouette pass behind them. Each carries a `<title>` naming it in the reader's\n * language, which is both the hover tooltip and the accessible name.\n */\nfunction renderCenters(\n\tdefined: Set<BodygraphCenterId>,\n\tnames: ReadonlyMap<BodygraphCenterId, string> | undefined,\n\tstateWords: { defined: string; open: string },\n): TemplateResult[] {\n\treturn CENTER_GEOMETRY.flatMap((c) => {\n\t\tconst isDefined = defined.has(c.id);\n\t\tconst cls = `bg-center bg-${c.color}${isDefined ? ' defined' : ''}`;\n\t\tconst label = names?.get(c.id) || c.label;\n\t\tconst at = c.labelAt ?? centroid(c.points);\n\t\treturn [\n\t\t\tsvg`<polygon class=${cls} points=${polygonPoints(c.points)}><title>${label}: ${isDefined ? stateWords.defined : stateWords.open}</title></polygon>`,\n\t\t\t// Drawn with the shapes, so the gate numbers paint over it. Hidden from\n\t\t\t// the accessibility tree because the polygon `<title>` above already\n\t\t\t// names this centre, and announcing it twice is worse than once.\n\t\t\trenderCenterName(label, at, isDefined, c.points),\n\t\t];\n\t});\n}\n\n/**\n * The centre name as ground behind the gate numbers.\n *\n * @remarks\n * A multi-word name stacks one word per line rather than running past the shape: the two side triangles taper to a point, so `Solar Plexus` on one line overruns its own outline while `SOLAR` over `PLEXUS` sits inside it. Splitting on whitespace is one rule for every language rather than a width measured per label, and a name that is one long word in some language simply stays one line.\n */\nfunction renderCenterName(\n\tlabel: string,\n\tat: Point,\n\tisDefined: boolean,\n\tpoints: readonly Point[],\n): TemplateResult {\n\tconst words = label.split(/\\s+/).filter(Boolean);\n\tconst longest = words.reduce((n, w) => Math.max(n, w.length), 0);\n\t// Shrink to the room the shape actually has at this height rather than\n\t// trusting one size to fit every name: the side centres taper to a point, and\n\t// a translated name is a different length in every language.\n\tconst room = widthAt(points, at.y) * 0.86;\n\tconst size = Math.min(\n\t\tCENTER_NAME_FONT_SIZE,\n\t\troom / Math.max(1, longest * UPPERCASE_EM),\n\t);\n\tconst step = size * 1.05;\n\tconst top = at.y - (step * (words.length - 1)) / 2;\n\treturn svg`<text class=\"bg-center-name ${isDefined ? 'defined' : ''}\" style=${`font-size:${size}px`} x=${at.x} y=${at.y} text-anchor=\"middle\" dominant-baseline=\"central\" aria-hidden=\"true\">${words.map(\n\t\t(w, i) => svg`<tspan x=${at.x} y=${top + i * step}>${w}</tspan>`,\n\t)}</text>`;\n}\n\n/** Advance width of one uppercase character at the label weight, as a fraction of the font size. Approximate on purpose: it only has to keep a name inside its own outline, and it is applied with room to spare. */\nconst UPPERCASE_EM = 0.66;\n\n/** Horizontal span of a convex polygon at height `y`: how much room a line of text has there. */\nfunction widthAt(points: readonly Point[], y: number): number {\n\tconst xs: number[] = [];\n\tfor (let i = 0; i < points.length; i++) {\n\t\tconst a = points[i] as Point;\n\t\tconst b = points[(i + 1) % points.length] as Point;\n\t\tif (a.y === b.y) continue;\n\t\tconst lo = Math.min(a.y, b.y);\n\t\tconst hi = Math.max(a.y, b.y);\n\t\tif (y < lo || y > hi) continue;\n\t\txs.push(a.x + ((y - a.y) / (b.y - a.y)) * (b.x - a.x));\n\t}\n\tif (xs.length < 2) return 0;\n\treturn Math.max(...xs) - Math.min(...xs);\n}\n\n/** Average of a shape's vertices: the visual middle of every centre this chart draws, all of which are convex. */\nfunction centroid(points: readonly Point[]): Point {\n\tconst n = points.length || 1;\n\treturn {\n\t\tx: points.reduce((t, p) => t + p.x, 0) / n,\n\t\ty: points.reduce((t, p) => t + p.y, 0) / n,\n\t};\n}\n\n/** A half-disc starting at the top of the circle and sweeping to the bottom. `sweep` 1 is the right half. */\nfunction halfDisc(p: Point, sweep: 0 | 1): string {\n\treturn `M ${p.x} ${p.y - GATE_RADIUS} A ${GATE_RADIUS} ${GATE_RADIUS} 0 0 ${sweep} ${p.x} ${p.y + GATE_RADIUS} Z`;\n}\n\n/**\n * Render all 64 gate numbers at their fixed points: an unactivated gate is a named\n * position on the chart, not an absence, so it draws as an outlined circle with a\n * muted number while an activated one is a filled disc with a knocked-out number.\n * A gate both sources activated is split down the middle.\n */\nfunction renderGates(\n\tgateSources: ReadonlyMap<number, GateSources>,\n\ttitles: ReadonlyMap<number, string>,\n): TemplateResult[] {\n\tconst out: TemplateResult[] = [];\n\tfor (const [gate, p] of Object.entries(GATE_POINTS)) {\n\t\tconst num = Number(gate);\n\t\tconst sources = gateSources.get(num);\n\t\tconst cls = sources ? sourceClass(sources) : '';\n\t\tconst title = titles.get(num);\n\t\tout.push(svg`<g class=\"bg-gate-node\">\n\t\t\t${\n\t\t\t\tcls === 'both'\n\t\t\t\t\t? [\n\t\t\t\t\t\t\tsvg`<path class=\"bg-gate-dot on src-left\" d=${halfDisc(p, 0)} />`,\n\t\t\t\t\t\t\tsvg`<path class=\"bg-gate-dot on src-right\" d=${halfDisc(p, 1)} />`,\n\t\t\t\t\t\t]\n\t\t\t\t\t: svg`<circle class=\"bg-gate-dot ${cls && `on ${cls}`}\" cx=${p.x} cy=${p.y} r=${GATE_RADIUS} />`\n\t\t\t}\n\t\t\t<text class=\"bg-gate ${sources ? 'on' : ''}\" x=${p.x} y=${p.y} text-anchor=\"middle\" dominant-baseline=\"central\">${num}</text>\n\t\t\t${title ? svg`<title>${title}</title>` : nothing}\n\t\t</g>`);\n\t}\n\treturn out;\n}\n\nexport interface BodygraphRenderInput {\n\tdefinedCenters: Set<BodygraphCenterId>;\n\t/** Which source(s) activated each gate; absent means unactivated. The only wiring input, because a channel is defined exactly when both of its gates are. */\n\tgateSources: ReadonlyMap<number, GateSources>;\n\tgateTitles: ReadonlyMap<number, string>;\n\t/** What to name each center in its `<title>`, keyed by center id. The response is the authority for its own vocabulary, so this carries `centers[].nameLocalized` where the API sent one and `centers[].name` otherwise; an id with no entry keeps the chart's own English label. */\n\tcenterNames?: ReadonlyMap<BodygraphCenterId, string>;\n\t/** The two words a center shape states its state with in its tooltip. Supplied by the caller because only a component can reach a chrome catalogue. */\n\tstateWords?: { defined: string; open: string };\n}\n\nexport const BODYGRAPH_VIEWBOX = `0 0 ${VIEW_W} ${VIEW_H}`;\n\n/**\n * Render the full bodygraph SVG inner content for the given live state. The\n * caller wraps it in an `<svg>` with {@link BODYGRAPH_VIEWBOX} and applies its\n * own theming CSS. Draw order: body silhouette under channels under centers\n * under gates, so the body is the backdrop, the wiring runs behind the shapes,\n * and every gate circle sits on top of whatever it lands on.\n */\nexport function renderBodygraphSvg(\n\tinput: BodygraphRenderInput,\n): TemplateResult {\n\treturn svg`\n\t\t${renderBody()}\n\t\t${renderChannels(input.gateSources)}\n\t\t${renderCenters(\n\t\t\tinput.definedCenters,\n\t\t\tinput.centerNames,\n\t\t\tinput.stateWords ?? { defined: 'defined', open: 'open' },\n\t\t)}\n\t\t${renderGates(input.gateSources, input.gateTitles)}\n\t`;\n}\n", "import { css } from 'lit';\nimport { CENTER_NAME_FONT_SIZE, GATE_FONT_SIZE } from './bodygraph-render.js';\n\n/**\n * The stylesheet for anything `renderBodygraphSvg` draws, so a second chart on the same geometry cannot fork the first one's appearance.\n *\n * @remarks\n * The renderer marks each gate and channel half `src-left` or `src-right` and names neither, so a card supplies the meaning by declaring those two colours on its own root and nothing else. Each must clear 4.5:1 against the ink knocked out of it and 3:1 against the card surface, in both themes. A card still owns its `.wrap`, its layout and its legend copy.\n */\nexport const bodygraphChartStyles = css`.chart{width:100%;max-width:var(--roxy-chart-max-width,30rem);height:auto;margin:0 auto;display:block}@container (width<=26rem){.chart{width:calc(100% + 2 * var(--roxy-space-lg,1.5rem));margin-inline:calc(-1 * var(--roxy-space-lg,1.5rem))}}.bg-body{fill:color-mix(in srgb, var(--roxy-secondary,#475569) 8%, transparent);stroke:var(--roxy-border,#e4e4e7);stroke-width:1px}.bg-channel{stroke:var(--roxy-border,#e4e4e7);stroke-width:5px;stroke-linecap:round}.bg-half{stroke-width:5px;stroke-linecap:round}.bg-half.stripe{stroke-linecap:butt;stroke-dasharray:7 7}.bg-center{fill:var(--roxy-surface,#fff);stroke:var(--roxy-secondary,#475569);stroke-width:1.8px}.bg-center.defined{stroke:color-mix(in srgb, var(--roxy-fg,#0a0a0a) 45%, transparent)}:host{--center-gold:#e0a200;--center-green:#2f8f00;--center-red:#c41f1f;--center-brown:#76502f}.bg-center.bg-gold.defined,.legend .swatch.bg-gold{fill:var(--center-gold);background:var(--center-gold)}.bg-center.bg-green.defined,.legend .swatch.bg-green{fill:var(--center-green);background:var(--center-green)}.bg-center.bg-red.defined,.legend .swatch.bg-red{fill:var(--center-red);background:var(--center-red)}.bg-center.bg-brown.defined,.legend .swatch.bg-brown{fill:var(--center-brown);background:var(--center-brown)}.bg-gate-dot{fill:var(--roxy-surface,#fff);stroke:var(--roxy-border,#e4e4e7);stroke-width:1px}.bg-gate-dot.on{stroke:none}.bg-center-name{fill:var(--roxy-muted,#71717a);opacity:.5;font-size:${CENTER_NAME_FONT_SIZE}px;letter-spacing:.08em;text-transform:uppercase;pointer-events:none;font-weight:600}.bg-center-name.defined{fill:var(--roxy-surface,#fff);opacity:.62}.bg-gate{fill:var(--roxy-muted,#71717a);font-size:${GATE_FONT_SIZE}px;font-weight:600;font-family:var(--roxy-font-sans)}.bg-gate.on{fill:var(--src-ink,var(--roxy-surface,#fff))}.legend{gap:var(--roxy-space-sm,.5rem) var(--roxy-space-md,1rem);font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);flex-wrap:wrap;display:flex}.legend .swatch{vertical-align:middle;border:1px solid var(--roxy-secondary,#475569);border-radius:2px;width:10px;height:10px;margin-right:4px;display:inline-block}.bg-half.src-left{stroke:var(--src-left)}.bg-half.src-right{stroke:var(--src-right)}.bg-gate-dot.on.src-left{fill:var(--src-left)}.bg-gate-dot.on.src-right{fill:var(--src-right)}.legend .swatch.src-left{background:var(--src-left)}.legend .swatch.src-right{background:var(--src-right)}.legend .swatch.source{border-radius:var(--roxy-radius-full,9999px);border-color:#0000}`;\n", "/**\n * The Human Design reading surface: the fact tiles, the lead paragraph, the signature and not-self pills, and the profile keynotes.\n *\n * @remarks\n * `/human-design/type` returns a strict subset of the `/human-design/bodygraph` interpretation fields (type, aura, strategy, authority, their descriptions, signature, not-self, profile), so `roxy-bodygraph` and `roxy-hd-type-card` would otherwise render the same markup and carry the same CSS twice. Both import from here instead: the bodygraph wraps the chart around it, the type card is the reading on its own.\n *\n * The disclosure accordion itself is NOT here. It lives in `utils/interp-accordion.ts`, because the same accordion serves any endpoint that returns a labelled reading (`roxy-hexagram` uses it for the changing lines), and both HD components draw it through `RoxyDataElement.renderInterpretation` so `hide-readings` is honoured. Import `interpAccordionStyles` alongside `hdReadingStyles`.\n */\n\nimport { css, html, nothing } from 'lit';\nimport type { InterpSection } from './interp-accordion.js';\n\n/** One row of the reading accordion. Alias of the shared {@link InterpSection} so HD call sites keep reading naturally. */\nexport type ReadingSection = InterpSection;\n\n/**\n * A component's own {@link RoxyDataElement.t}, threaded in so a shared render helper can name its rows.\n *\n * @remarks\n * These helpers are plain functions with no host, so they cannot resolve a page language on their own, and a label they hardcode is one English word inside otherwise translated chrome. Taking the translator as an argument keeps each English source literal in the file that renders it, which is what `tests/i18n.test.ts` scans (it walks `utils/` as well as `components/`), so a string added here still cannot ship without a catalogue entry. That scanner reads comments too, so do not write a sample call in one.\n */\nexport type Translate = (\n\tsource: string,\n\tvars?: Record<string, string | number>,\n) => string;\n\n/** A labelled value tile. A fact with no value is dropped, so a narrower response renders fewer tiles rather than empty ones. */\nexport interface Fact {\n\tlabel: string;\n\tvalue?: string;\n}\n\n/** The two profile lines with the keynote of each. Normalized: the bodygraph nests these under `profileKeynotes`, `/human-design/profile` returns them flat, and both map onto this. */\nexport interface ProfileKeynotes {\n\tpersonality?: string;\n\tpersonalityLine?: number;\n\tdesign?: string;\n\tdesignLine?: number;\n}\n\nexport const hdReadingStyles = css`.facts{gap:var(--roxy-space-sm,.5rem);grid-template-columns:repeat(auto-fit,minmax(8rem,1fr));display:grid}.fact{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);background:var(--roxy-surface,#fff)}.fact span{color:var(--roxy-muted,#71717a);font-size:var(--roxy-text-xs,.75rem);text-transform:uppercase;letter-spacing:.06em;display:block}.fact strong{font-size:var(--roxy-text-base,1rem);color:var(--roxy-fg,#0a0a0a)}.lead{color:var(--roxy-fg,#0a0a0a);font-size:var(--roxy-text-sm,.875rem);margin:0;line-height:1.6}.themes{gap:var(--roxy-space-sm,.5rem);flex-wrap:wrap;display:flex}.pill{border-radius:var(--roxy-radius-full,9999px);font-size:var(--roxy-text-xs,.75rem);padding:2px 10px}.pill--good{background:color-mix(in srgb, var(--roxy-success,#16a34a) 16%, transparent);color:var(--roxy-success-fg,#166534)}.pill--shadow{background:color-mix(in srgb, var(--roxy-danger,#dc2626) 16%, transparent);color:var(--roxy-danger-fg,#991b1b)}.keynotes{gap:var(--roxy-space-xs,.25rem);margin:0;display:grid}.keynotes dt{font-size:var(--roxy-text-xs,.75rem);color:var(--roxy-muted,#71717a);text-transform:uppercase;letter-spacing:.05em}.keynotes dd{margin:0}`;\n\n/**\n * The chart side as a word a reader sees.\n *\n * @remarks\n * Personality is the conscious side calculated at birth, design the unconscious side 88 degrees of solar arc before it, and the wire carries them as the machine enum `personality` and `design` with no localized partner. The component is what turns an enum into a word, so this is chrome and comes from the catalogue: the same two words label the bodygraph activation tabs, name the side inside a chart tooltip, and sit under a Variables arrow. An unrecognized value is passed through rather than guessed at.\n */\nexport function sideWord(side: string | undefined, t: Translate): string {\n\tif (side === 'design') return t('Design');\n\tif (side === 'personality') return t('Personality');\n\treturn side ?? '';\n}\n\n/** The labelled value tiles. Values the response does not carry are dropped rather than rendered empty. */\nexport function renderHdFacts(facts: Fact[]) {\n\tconst shown = facts.filter((f) => Boolean(f.value));\n\tif (shown.length === 0) return nothing;\n\treturn html`<div class=\"facts\" part=\"facts\">${shown.map(\n\t\t\t(f) => html`<div class=\"fact\" part=\"fact\"><span>${f.label}</span> <strong>${f.value}</strong></div>`,\n\t\t)}</div>`;\n}\n\n/**\n * The signature and not-self pills: the feeling of being in alignment, and the one that signals being out of it.\n *\n * @remarks\n * Both values arrive already resolved to what a reader should see, because the response carries `signatureLocalized` and `notSelfLocalized` beside the canonical English pair and only the caller knows which half it is holding. The two words around them are this card's own and go through `t`.\n */\nexport function renderHdThemes(\n\tsignature: string | undefined,\n\tnotSelf: string | undefined,\n\tt: Translate,\n) {\n\tif (!signature && !notSelf) return nothing;\n\treturn html`<div class=\"themes\" part=\"themes\">${signature ? html`<span class=\"pill pill--good\">${t('Signature: {{value}}', { value: signature })}</span>` : nothing} ${notSelf ? html`<span class=\"pill pill--shadow\">${t('Not-self: {{value}}', { value: notSelf })}</span>` : nothing}</div>`;\n}\n\n/** The two profile lines, each with the keynote of the line. Personality first: it is the conscious line and the one the profile is read from. */\nexport function renderHdKeynotes(k: ProfileKeynotes | undefined, t: Translate) {\n\tif (!k?.personality && !k?.design) return nothing;\n\treturn html`<dl class=\"keynotes\" part=\"keynotes\">${\n\t\t\tk.personality\n\t\t\t\t? html`<dt>${t('Line {{line}} · Personality', { line: k.personalityLine ?? '' })}</dt><dd>${k.personality}</dd>`\n\t\t\t\t: nothing\n\t\t} ${\n\t\t\tk.design\n\t\t\t\t? html`<dt>${t('Line {{line}} · Design', { line: k.designLine ?? '' })}</dt><dd>${k.design}</dd>`\n\t\t\t\t: nothing\n\t\t}</dl>`;\n}\n"],
5
+ "mappings": "4MAAA,OAAS,OAAAA,GAAK,QAAAC,EAAM,WAAAC,MAAe,MACnC,OAAS,iBAAAC,OAAqB,oBCD9B,OAA8B,QAAAC,EAAM,WAAAC,OAAoC,MACxE,OAAS,YAAAC,EAAU,SAAAC,MAAa,oBAChC,OAAS,aAAAC,MAAiB,+BCF1B,OAAS,cAAAC,OAAkB,MC6BpB,SAASC,EAAYC,EAAqC,CAGhE,GAAIA,EAAG,KAAM,OAAOA,EAAG,KACvB,GAAI,OAAO,SAAa,IAAa,OACrC,IAAMC,EAAYD,EAAG,UAAU,QAAQ,GAAG,aAAa,MAAM,EAC7D,OAAIC,GACG,SAAS,gBAAgB,MAAQ,MACzC,CCRO,SAASC,EAAUC,EAAm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,GACAC,GACAC,GACAC,GACAC,wgFACD,EARYvC,EAANwC,EAAA,CADNC,GAAc,oBAAoB,GACtBzC,GA2Kb,SAASwB,EAAakB,EAA2C,CAChE,GAAI,OAAOA,GAAM,SACjB,OAAIA,IAAM,EAAU,OACbA,IAAM,EAAI,YAAc,GAAGA,CAAC,WACpC,CAGA,SAAST,GAASU,EAAqC,CACtD,IAAMC,EAAOD,GAAS,CAAC,EACvB,OAAOC,EAAK,OAAS,EAAIA,EAAK,KAAK,IAAI,EAAI,SAC5C,CAGA,SAASf,GAAUgB,EAAkBnB,EAAYC,EAAoB,CACpE,OAAID,GAAKC,EAAU,yBACfD,EAAU,eACVC,EAAU,eACPkB,EACJ,mDACA,qBACJ",
6
+ "names": ["css", "html", "nothing", "customElement", "html", "nothing", "property", "state", "ifDefined", "LitElement", "resolveLang", "el", "inherited", "lookupKey", "s", "humanize", "s", "c", "GLOBAL_KEY", "registry", "holder", "existing", "created", "interpolate", "template", "vars", "match", "key", "translate", "lang", "source", "catalogs", "registry", "tag", "catalog", "lookupKey", "onLocaleChange", "listener", "listeners", "registry", "LocaleController", "host", "onLocaleChange", "RoxyLocalizedElement", "LitElement", "source", "vars", "LocaleController", "translate", "resolveLang", "css", "baseStyles", "KEY_REFUSED_MESSAGE", "keyIsRefused", "key", "dispatchKeyRefusal", "host", "opts", "KEY_REFUSED_MESSAGE", "DEFAULT_BASE_URL", "readApiError", "res", "body", "FetchController", "host", "req", "controller", "json", "err", "signal", "url", "k", "v", "headers", "keyIsRefused", "KEY_REFUSED_MESSAGE", "dispatchKeyRefusal", "buildRequest", "endpoint", "method", "values", "queryKeys", "rest", "path", "_match", "name", "inQuery", "query", "css", "html", "nothing", "css", "html", "chevron", "disclosureStyles", "readingDetailStyles", "css", "interpAccordionStyles", "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", "RoxyLocalizedElement", "e", "detail", "buildRequest", "MarkupDataController", "FetchController", "baseStyles", "changed", "html", "names", "n", "nothing", "rules", "sections", "name", "heading", "renderInterpAccordion", "data", "body", "ifDefined", "raw", "values", "message", "banner", "__decorateClass", "property", "state", "nothing", "svg", "X_MIN", "X_MAX", "Y_MIN", "Y_MAX", "UNIT", "VIEW_W", "VIEW_H", "g", "x", "y", "AXIS", "mirrorX", "GATE_RADIUS", "GATE_FONT_SIZE", "CENTER_NAME_FONT_SIZE", "COL", "EDGE", "G_EDGE", "GATES_BY_CENTER", "SPLEEN_TO_SOLAR_PLEXUS", "buildGatePoints", "points", "centerOf", "spleenGate", "center", "gates", "gate", "GATE_POINTS", "GATE_CENTER", "CHART_AXIS_X", "shape", "corners", "squareShape", "halfWidth", "top", "bottom", "SQUARE_HALF", "SPLEEN_SHAPE", "CENTER_GEOMETRY", "CHANNEL_PAIRS", "BODY_PATH", "buildBodyPath", "m", "r", "segs", "pt", "i", "ptm", "p", "polygonPoints", "pts", "sourceClass", "s", "renderBody", "renderChannels", "gateSources", "lines", "a", "b", "pa", "pb", "mid", "from", "sources", "cls", "renderCenters", "defined", "names", "stateWords", "c", "isDefined", "label", "at", "centroid", "renderCenterName", "words", "longest", "n", "w", "room", "widthAt", "size", "UPPERCASE_EM", "step", "xs", "lo", "hi", "t", "halfDisc", "sweep", "renderGates", "titles", "out", "num", "title", "BODYGRAPH_VIEWBOX", "renderBodygraphSvg", "input", "css", "bodygraphChartStyles", "css", "CENTER_NAME_FONT_SIZE", "GATE_FONT_SIZE", "css", "html", "nothing", "hdReadingStyles", "renderHdFacts", "facts", "shown", "f", "nothing", "html", "RoxyHdConnection", "RoxyDataElement", "d", "gateSources", "c", "left", "right", "gate", "held", "definedCenters", "centerNames", "gateTitles", "name", "who", "html", "BODYGRAPH_VIEWBOX", "renderBodygraphSvg", "channels", "centers", "nothing", "renderHdFacts", "humanize", "s", "sections", "channelCount", "by", "a", "b", "together", "centerWho", "names", "centerName", "id", "gateList", "baseStyles", "disclosureStyles", "interpAccordionStyles", "hdReadingStyles", "bodygraphChartStyles", "css", "__decorateClass", "customElement", "n", "gates", "list", "defined"]
7
7
  }