--- import { getMessages } from '../../i18n/messages.ts'; interface Props { locale: string; /** Unique per diagram on the page; prefixes ids inside the SVG. */ uid: string; } const { locale, uid } = Astro.props; const t = getMessages(locale); const arrowV = `${uid}-dorv-arrow-v`; const arrowA = `${uid}-dorv-arrow-a`; const arrowMix = `${uid}-dorv-arrow-mix`; const mixFill = `${uid}-dorv-mix`; // Labels too long for one line in their free space are split in two. function twoLines(label: string): [string, string] { const words = label.split(' '); const split = Math.ceil(words.length / 2); return [words.slice(0, split).join(' '), words.slice(split).join(' ')]; } const lungFlowLines = twoLines(t['diagram.label.much-blood-to-lungs']); const mixedLines = twoLines(t['diagram.label.mixed-blood']); // The heart is drawn in its own coordinates and shifted right by 160, as in the tetralogy and // truncus diagrams; labels sit in the free column on the left. Vessels are tubes: a wide stroke in // the wall colour under a narrower one in the blood colour. const vessel = { // Normal: the pulmonary artery from the right ventricle, the aorta from the left (MSD Manual). pulmonary: 'M100,176 V30', aorta: 'M225,176 V26', // Double outlet right ventricle, the variant with the defect below the aorta (MSD Manual): both // vessels leave the right ventricle and none leaves the left one. Their mutual position is not // drawn as a fact: the sources give it only as something echocardiography shows. pulmonaryFromRv: 'M78,176 V30', aortaFromRv: 'M133,176 V26', }; const flow = { toPulmonary: 'M100,282 L100,46', toAorta: 'M225,282 L225,40', // The left ventricle empties only through the defect into the right ventricle; from there mixed // blood goes into both vessels, and the stream to the lungs is thicker because the lungs get too // much blood. fromLv: 'M240,282 C238,240 200,206 150,198', toAortaMixed: 'M133,186 L133,40', toLungsMixed: 'M78,256 L78,46', }; --- {t['diagram.label.rv']} {t['diagram.label.rv']} {t['diagram.label.lv']} {t['diagram.label.aorta']} {t['diagram.label.aorta']} {t['diagram.label.septum']} {t['diagram.label.defect-below-aorta']} {t['diagram.label.pulmonaryArtery']} {lungFlowLines[0]} {lungFlowLines[1]} {t['diagram.label.pulmonaryArtery']} {mixedLines[0]} {mixedLines[1]}