${this.t('Ayurvedic constitution')}
${c?.type ? html`${formatType(c.type)}` : nothing}
${this.renderBar(locale, d)}
${
c?.dominant
? html`${this.t('Dominant')}${capitalize(c.dominant)}`
: nothing
}
${
c?.secondary
? html`${this.t('Secondary')}${capitalize(c.secondary)}`
: nothing
}
${
d.lagnaSign
? html`${this.t('Lagna')}${capitalize(d.lagnaSign)}`
: nothing
}
${
d.moonSign
? html`${this.t('Moon sign')}${capitalize(d.moonSign)}`
: nothing
}
${this.renderFactors(locale, d.factors)}
${this.renderRanking(locale, d.strengthRanking)}
${this.renderPlanetDoshas(d.planetDoshas)}
${
d.summary && !this.hideReadings
? html`${d.summary}
`
: nothing
}
${renderFrameCaption(locale, d.frame, this.translator)}
${
// The scope of everything above it, so it is never behind the readings
// gate: a page showing only the chart needs it more, not less.
d.meta?.disclaimer
? html`${d.meta.disclaimer}
`
: nothing
}
`;
}
/** The composite as one stacked bar plus the three shares written out beside it. */
private renderBar(locale: string | undefined, d: Constitution) {
const c = d.composite;
const shares = HUMOURS.map((h) => ({ humour: h, value: c?.[h] ?? 0 }));
const total = shares.reduce((n, s) => n + s.value, 0);
if (total <= 0) return nothing;
return html`
`${capitalize(s.humour)} ${formatPercent(locale, s.value, 0)}`,
)
.join(', ')}
>
${shares
.filter((s) => s.value > 0)
.map(
(s) =>
html`
`,
)}
${shares.map(
(s) =>
html`${capitalize(
s.humour,
)}
${formatPercent(locale, s.value, 0)}`,
)}
`;
}
/** The three scored factors: what each read, the humours it carries, its weight and its verse. */
private renderFactors(
locale: string | undefined,
factors: Constitution['factors'],
) {
const rows = factors ?? [];
if (rows.length === 0) return nothing;
return html`