make a prper flow chart of development of respiratory system
cd /home/daytona/workspace && python3 -c " import pdfplumber with pdfplumber.ope…
mkdir -p /home/daytona/workspace/resp-flowchart
~/resp-flowchart/respiratory_development_flowchart.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Development of the Respiratory System — Flowchart</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Inter', Arial, sans-serif;
background: #0d1117;
color: #e6edf3;
padding: 40px 20px 60px;
min-width: 900px;
}
h1 {
text-align: center;
font-size: 26px;
font-weight: 700;
letter-spacing: 1px;
color: #58a6ff;
margin-bottom: 6px;
text-transform: uppercase;
}
.subtitle {
text-align: center;
font-size: 13px;
color: #8b949e;
margin-bottom: 36px;
letter-spacing: 0.5px;
}
/* ── COLUMN LAYOUT ── */
.page {
max-width: 1100px;
margin: 0 auto;
}
/* ── ARROW UTILITY ── */
.arrow-down {
display: flex;
justify-content: center;
align-items: center;
height: 38px;
color: #58a6ff;
font-size: 26px;
line-height: 1;
}
.arrow-down.thin { height: 24px; font-size: 20px; color: #8b949e; }
/* ── BOX STYLES ── */
.box {
border-radius: 10px;
padding: 14px 20px;
margin: 0 auto;
position: relative;
font-size: 13.5px;
line-height: 1.6;
}
/* origin / germ layer banner */
.box-germ {
background: linear-gradient(135deg, #161b22, #1f2937);
border: 1.5px solid #30363d;
max-width: 700px;
}
.box-germ .label {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
color: #8b949e;
margin-bottom: 8px;
}
.box-germ .row { display: flex; gap: 16px; flex-wrap: wrap; }
.pill {
border-radius: 20px;
padding: 5px 16px;
font-size: 12.5px;
font-weight: 600;
}
.pill-endo { background: #0c2a1e; color: #3fb950; border: 1px solid #3fb950; }
.pill-meso { background: #1e2a0c; color: #d29922; border: 1px solid #d29922; }
/* section titles */
.section-title {
text-align: center;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1.5px;
color: #8b949e;
margin: 32px 0 12px;
position: relative;
}
.section-title::before, .section-title::after {
content: '';
display: inline-block;
width: 80px;
height: 1px;
background: #30363d;
vertical-align: middle;
margin: 0 12px;
}
/* stage block */
.stage {
border-radius: 12px;
padding: 0;
margin: 0 auto 0;
max-width: 860px;
overflow: hidden;
border: 1.5px solid transparent;
}
.stage-header {
padding: 10px 20px;
display: flex;
align-items: center;
gap: 12px;
}
.stage-badge {
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1px;
padding: 4px 12px;
border-radius: 20px;
white-space: nowrap;
}
.stage-week {
font-size: 12px;
font-weight: 500;
opacity: 0.75;
}
.stage-title {
font-size: 16px;
font-weight: 700;
flex: 1;
}
.stage-body {
padding: 14px 20px 18px;
background: rgba(0,0,0,0.25);
display: flex;
gap: 20px;
flex-wrap: wrap;
}
.sub-col { flex: 1; min-width: 200px; }
.sub-col h4 {
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1px;
margin-bottom: 8px;
padding-bottom: 4px;
border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sub-col ul {
list-style: none;
padding: 0;
}
.sub-col ul li {
font-size: 12.5px;
line-height: 1.7;
padding-left: 14px;
position: relative;
color: #c9d1d9;
}
.sub-col ul li::before {
content: '›';
position: absolute;
left: 0;
color: inherit;
opacity: 0.6;
}
.sub-col ul li.sub {
padding-left: 26px;
font-size: 12px;
color: #8b949e;
}
.sub-col ul li.sub::before { left: 14px; }
/* colour themes per stage / organ */
.c-larynx { --c: #79c0ff; --bg: #031d2f; --border: #1f6feb; }
.c-trachea { --c: #a5d6a7; --bg: #0c2a1e; --border: #2ea043; }
.c-pseudog { --c: #ffa657; --bg: #2d1b00; --border: #9e6a03; }
.c-canali { --c: #f78166; --bg: #2d0c05; --border: #b91c1c; }
.c-saccular { --c: #d2a8ff; --bg: #1f0a2e; --border: #8957e5; }
.c-alveolar { --c: #ff7b72; --bg: #2d0c05; --border: #da3633; }
.c-birth { --c: #56d364; --bg: #0a2416; --border: #238636; }
.stage { border-color: var(--border); }
.stage .stage-header { background: linear-gradient(90deg, var(--bg), #0d1117); }
.stage .stage-badge { background: var(--bg); color: var(--c); border: 1px solid var(--border); }
.stage .stage-title { color: var(--c); }
.stage .stage-week { color: var(--c); }
.stage .sub-col h4 { color: var(--c); }
.stage .sub-col ul li::before { color: var(--c); }
/* three-column layout for organs */
.organ-grid {
display: grid;
grid-template-columns: 1fr auto 1fr auto 1fr;
gap: 0;
max-width: 1000px;
margin: 0 auto;
align-items: start;
}
.organ-arrow {
display: flex;
align-items: flex-start;
justify-content: center;
padding-top: 60px;
font-size: 22px;
color: #58a6ff;
opacity: 0.5;
}
/* summary table */
.sum-table {
max-width: 860px;
margin: 0 auto;
border-collapse: collapse;
width: 100%;
font-size: 12.5px;
}
.sum-table th {
background: #161b22;
color: #58a6ff;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.8px;
font-size: 11px;
padding: 10px 14px;
border: 1px solid #30363d;
text-align: left;
}
.sum-table td {
padding: 9px 14px;
border: 1px solid #21262d;
vertical-align: top;
color: #c9d1d9;
line-height: 1.6;
}
.sum-table tr:nth-child(even) td { background: #161b22; }
.sum-table tr:nth-child(odd) td { background: #0d1117; }
/* IRDS box */
.irds-box {
max-width: 860px;
margin: 0 auto;
border: 1.5px solid #da3633;
border-radius: 10px;
background: #2d0c05;
padding: 16px 22px;
}
.irds-box h3 { color: #ff7b72; font-size: 14px; margin-bottom: 8px; }
.irds-box ul { list-style: none; padding: 0; }
.irds-box ul li {
font-size: 12.5px;
color: #c9d1d9;
line-height: 1.7;
padding-left: 14px;
position: relative;
}
.irds-box ul li::before { content: '⚠'; position: absolute; left: 0; color: #f85149; font-size: 10px; top: 3px; }
/* connector line between sections */
.vline {
width: 2px;
background: linear-gradient(to bottom, #1f6feb, transparent);
height: 30px;
margin: 0 auto;
}
.legend {
max-width: 860px;
margin: 32px auto 0;
display: flex;
gap: 24px;
flex-wrap: wrap;
align-items: center;
font-size: 12px;
color: #8b949e;
}
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot {
width: 12px; height: 12px; border-radius: 50%;
flex-shrink: 0;
}
</style>
</head>
<body>
<div class="page">
<!-- ══ TITLE ══ -->
<h1>Development of the Respiratory System</h1>
<div class="subtitle">Embryology — Note #14 | Week 2 → 8 years</div>
<!-- ══ GERM LAYER ORIGIN ══ -->
<div class="box box-germ">
<div class="label">Germ Layer Origins</div>
<div class="row">
<div>
<div class="pill pill-endo">Endoderm</div>
<div style="font-size:12px;color:#8b949e;margin-top:5px;">
Epithelial lining + glands of larynx,<br>trachea & lung
</div>
</div>
<div>
<div class="pill pill-meso">Mesoderm (Splanchnic LPM)</div>
<div style="font-size:12px;color:#8b949e;margin-top:5px;">
Cartilage, muscle, connective tissue<br>around larynx, trachea & lung
</div>
</div>
</div>
<div style="margin-top:12px;font-size:12px;color:#8b949e;">
<strong style="color:#c9d1d9;">Gastrulation:</strong> Bilaminar disc → Trilaminar disc (endoderm + mesoderm + ectoderm)<br>
<strong style="color:#c9d1d9;">Folding:</strong> Lateral folding + Craniocaudal folding → Foregut / Midgut / Hindgut tubes
</div>
</div>
<div class="arrow-down">↓</div>
<!-- ══ PHARYNGEAL APPARATUS ══ -->
<div class="box box-germ" style="max-width:700px;border-color:#1f6feb;">
<div class="label" style="color:#79c0ff;">Pharyngeal Apparatus</div>
<div style="font-size:12.5px;color:#c9d1d9;line-height:1.7;">
Primitive pharynx → Pharyngeal pouches (endoderm) + Pharyngeal arches (mesoderm) + Pharyngeal clefts (ectoderm)<br>
<span style="color:#8b949e;">Buccopharyngeal membrane → Mouth</span>
</div>
</div>
<div class="arrow-down">↓</div>
<!-- ══ THREE ORGAN TRACKS ══ -->
<div class="section-title">Three Parallel Organ Developments</div>
<div class="organ-grid">
<!-- LARYNX -->
<div class="stage c-larynx">
<div class="stage-header">
<span class="stage-badge">Larynx</span>
<span class="stage-title">Larynx</span>
</div>
<div class="stage-body" style="flex-direction:column;">
<div class="sub-col" style="min-width:100%">
<h4>Origin</h4>
<ul>
<li><span class="pill pill-endo" style="font-size:11px;padding:2px 8px;">Endoderm</span> → 4th & 6th pharyngeal pouches</li>
<li><span class="pill pill-meso" style="font-size:11px;padding:2px 8px;">Mesoderm</span> → 4th & 6th pharyngeal arch</li>
</ul>
</div>
<div class="sub-col" style="min-width:100%;margin-top:10px;">
<h4>Timeline</h4>
<ul>
<li><strong>Wk 5:</strong> Laryngeal orifice develops; endoderm invades → vocal cord primordia</li>
<li><strong>Wk 6:</strong> Mesoderm → cartilage + muscles; epiglottic & arytenoid swellings form</li>
<li><strong>Wk 6–12:</strong> Epithelium: pseudostratified ciliated columnar; cartilages: thyroid, cricoid, arytenoid, cuneiform, corniculate; muscles: cricoarytenoid, cricothyroid; vagus nerve (CN X) from 4th & 6th arches</li>
<li><strong>Wk 12:</strong> Mature laryngeal inlet, epiglottic folds complete</li>
</ul>
</div>
</div>
</div>
<div class="organ-arrow">→</div>
<!-- TRACHEA -->
<div class="stage c-trachea">
<div class="stage-header">
<span class="stage-badge">Trachea</span>
<span class="stage-title">Trachea</span>
</div>
<div class="stage-body" style="flex-direction:column;">
<div class="sub-col" style="min-width:100%">
<h4>Origin</h4>
<ul>
<li><span class="pill pill-endo" style="font-size:11px;padding:2px 8px;">Endoderm</span> → Foregut</li>
<li><span class="pill pill-meso" style="font-size:11px;padding:2px 8px;">Mesoderm</span> → Splanchnic LPM</li>
</ul>
</div>
<div class="sub-col" style="min-width:100%;margin-top:10px;">
<h4>Timeline</h4>
<ul>
<li><strong>Wk 5:</strong> Lung bud buds off foregut; tracheoesophageal groove/ridge forms anteriorly</li>
<li>Ridges fuse → Tracheoesophageal septum</li>
<li>Diverticulum (anterior) → Trachea</li>
<li>Posterior tube → Esophagus</li>
<li>Endoderm → epithelium & glands of trachea</li>
<li>Splanchnic LPM → trachealis muscle, connective tissue, cartilage rings</li>
</ul>
</div>
</div>
</div>
<div class="organ-arrow">→</div>
<!-- LUNGS -->
<div class="stage c-saccular">
<div class="stage-header">
<span class="stage-badge">Lungs</span>
<span class="stage-title">Lungs</span>
</div>
<div class="stage-body" style="flex-direction:column;">
<div class="sub-col" style="min-width:100%">
<h4>Origin</h4>
<ul>
<li><span class="pill pill-endo" style="font-size:11px;padding:2px 8px;">Endoderm</span> → Foregut</li>
<li><span class="pill pill-meso" style="font-size:11px;padding:2px 8px;">Mesoderm</span> → Splanchnic LPM</li>
</ul>
</div>
<div class="sub-col" style="min-width:100%;margin-top:10px;">
<h4>Initial</h4>
<ul>
<li>Lung bud → bifurcates → <strong>bronchial buds</strong></li>
<li>L & R primary bronchi</li>
<li>Splanchnic LPM → bronchial smooth muscle, connective tissue, cartilage</li>
</ul>
</div>
</div>
</div>
</div><!-- /organ-grid -->
<div class="arrow-down" style="margin-top:20px;">↓</div>
<!-- ══ LUNG DEVELOPMENT STAGES ══ -->
<div class="section-title">Lung Development Stages</div>
<!-- PSEUDO-GLANDULAR -->
<div class="stage c-pseudog">
<div class="stage-header">
<span class="stage-badge">Stage 1</span>
<span class="stage-title">Pseudo-glandular Stage</span>
<span class="stage-week">Week 5 → Week 16</span>
</div>
<div class="stage-body">
<div class="sub-col">
<h4>Airway Branching</h4>
<ul>
<li>Primary bronchi form (L & R)</li>
<li>Primary → Lobar (secondary) bronchi</li>
<li class="sub">3 lobar bronchi — Right (3 lobes)</li>
<li class="sub">2 lobar bronchi — Left (2 lobes)</li>
<li>Lobar → Segmental (tertiary) bronchi</li>
<li class="sub">20 tertiary bronchi — Right</li>
<li class="sub">18 tertiary bronchi — Left</li>
<li>Tertiary → Terminal bronchioles</li>
</ul>
</div>
<div class="sub-col">
<h4>Key Features</h4>
<ul>
<li>Lung resembles exocrine gland histologically</li>
<li>No gas exchange possible yet</li>
<li>Endoderm → epithelium & glands of airways</li>
<li>Splanchnic LPM → cartilage, smooth muscle, CT</li>
</ul>
</div>
</div>
</div>
<div class="arrow-down thin">↓</div>
<!-- CANALICULAR -->
<div class="stage c-canali">
<div class="stage-header">
<span class="stage-badge">Stage 2</span>
<span class="stage-title">Canalicular Stage</span>
<span class="stage-week">Week 16 → Week 26</span>
</div>
<div class="stage-body">
<div class="sub-col">
<h4>Structural Development</h4>
<ul>
<li>Terminal bronchioles → Respiratory bronchioles</li>
<li>Respiratory bronchioles → Alveolar ducts (3–6 each)</li>
<li>Alveolar ducts → Primitive alveoli</li>
</ul>
</div>
<div class="sub-col">
<h4>Histology & Function</h4>
<ul>
<li>Primitive alveoli lined by cuboidal cells</li>
<li>Cuboidal cells = poor gas exchange (too thick)</li>
<li>Pulmonary capillaries begin growing around alveoli</li>
<li>Gas exchange not yet viable</li>
</ul>
</div>
</div>
</div>
<div class="arrow-down thin">↓</div>
<!-- SACCULAR -->
<div class="stage c-saccular">
<div class="stage-header">
<span class="stage-badge">Stage 3</span>
<span class="stage-title">Saccular Stage</span>
<span class="stage-week">Week 26 → Birth</span>
</div>
<div class="stage-body">
<div class="sub-col">
<h4>Structural Development</h4>
<ul>
<li>↑ Number of alveoli & respiratory bronchioles</li>
<li>Basement membrane forms around alveoli</li>
<li>↑ Pulmonary capillaries</li>
<li>Alveolar wall components appear:<br>Type I & II cells, alveolar macrophages, epithelial & capillary basement membranes, capillary endothelium</li>
</ul>
</div>
<div class="sub-col">
<h4>Cell Differentiation</h4>
<ul>
<li>Cuboidal → <strong>Type I pneumocytes</strong> (flat)</li>
<li class="sub">Thin — allow O₂/CO₂ gas exchange</li>
<li>Cuboidal → <strong>Type II pneumocytes</strong></li>
<li class="sub">Produce <strong>surfactant</strong> (protein + lipid complex)</li>
<li class="sub">Surfactant ↓ surface tension → prevents alveolar collapse</li>
<li class="sub">Appears reliably ~week 34+</li>
</ul>
</div>
</div>
</div>
<div class="arrow-down thin">↓</div>
<!-- ALVEOLAR -->
<div class="stage c-alveolar">
<div class="stage-header">
<span class="stage-badge">Stage 4</span>
<span class="stage-title">Alveolar Stage</span>
<span class="stage-week">Week 36 → 8 years</span>
</div>
<div class="stage-body">
<div class="sub-col">
<h4>Structural Maturation</h4>
<ul>
<li>Type I + II cells form alveolar septa (partitions)</li>
<li>Septa ↑ surface area for gas exchange</li>
<li>Thickening of basement membrane</li>
<li>↑ Pulmonary capillaries</li>
</ul>
</div>
<div class="sub-col">
<h4>Alveolar Numbers</h4>
<ul>
<li>~100 million alveoli at birth</li>
<li>→ ~300 million alveoli by 8 years of age</li>
<li>Continues post-natally until full lung maturation</li>
</ul>
</div>
</div>
</div>
<div class="arrow-down">↓</div>
<!-- ══ BIRTH PROCESS ══ -->
<div class="section-title">Birth & First Breath</div>
<div class="stage c-birth">
<div class="stage-header">
<span class="stage-badge">Birth</span>
<span class="stage-title">Transition to Extra-uterine Life</span>
<span class="stage-week">At Birth</span>
</div>
<div class="stage-body">
<div class="sub-col">
<h4>Before Birth</h4>
<ul>
<li>Fetal breathing movements (amniotic fluid)</li>
<li>Strengthens respiratory muscles & lung development</li>
<li>Amniotic fluid fills alveoli</li>
</ul>
</div>
<div class="sub-col">
<h4>At / After Birth</h4>
<ul>
<li>Umbilical cord cut → ↓ O₂ → hypoxia</li>
<li>Hypoxia activates respiratory center → first cry</li>
<li>First breath pushes amniotic fluid into pulmonary capillaries</li>
<li>Thin surfactant layer remains → ↓ surface tension</li>
<li>Alveoli stay open for subsequent breaths</li>
</ul>
</div>
</div>
</div>
<div class="arrow-down thin">↓</div>
<!-- ══ IRDS ══ -->
<div class="irds-box">
<h3>⚠ Infant Respiratory Distress Syndrome (IRDS) — Premature Babies <34 weeks</h3>
<ul>
<li>Insufficient surfactant production → ↑ surface tension → ↑ collapsing pressure</li>
<li>Alveoli collapse (atelectasis) → unequal, collapsed alveoli</li>
<li>Baby must generate enormous effort to re-open each collapsed alveolus with every breath</li>
<li>Leads to respiratory distress → mechanical ventilation required</li>
<li>Also called Neonatal Respiratory Distress Syndrome (NRDS)</li>
</ul>
</div>
<!-- ══ SUMMARY TABLE ══ -->
<div class="section-title" style="margin-top:40px;">Summary Table — Lung Development Stages</div>
<table class="sum-table">
<thead>
<tr>
<th>Stage</th>
<th>Timing</th>
<th>Key Processes</th>
<th>Cell Types / Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong style="color:#ffa657;">Pseudo-glandular</strong></td>
<td>Wk 5–16</td>
<td>Primary → lobar → segmental bronchi → terminal bronchioles</td>
<td>No gas exchange; lung looks like exocrine gland</td>
</tr>
<tr>
<td><strong style="color:#f78166;">Canalicular</strong></td>
<td>Wk 16–26</td>
<td>Terminal bronchioles → respiratory bronchioles → alveolar ducts → primitive alveoli; pulmonary capillaries appear</td>
<td>Cuboidal cells only; poor gas exchange</td>
</tr>
<tr>
<td><strong style="color:#d2a8ff;">Saccular</strong></td>
<td>Wk 26 – Birth</td>
<td>↑ Alveoli; basement membrane forms; Type I & II pneumocytes differentiate; surfactant production begins (~wk 34)</td>
<td>Type I: gas exchange; Type II: surfactant</td>
</tr>
<tr>
<td><strong style="color:#ff7b72;">Alveolar</strong></td>
<td>Wk 36 – 8 yrs</td>
<td>Alveolar septa ↑ SA; ↑ capillaries; ~100 M alveoli at birth → ~300 M by age 8</td>
<td>Post-natal maturation continues</td>
</tr>
</tbody>
</table>
<!-- ══ LEGEND ══ -->
<div class="legend">
<strong style="color:#c9d1d9;">Legend:</strong>
<div class="legend-item"><div class="legend-dot" style="background:#3fb950;"></div> Endoderm-derived</div>
<div class="legend-item"><div class="legend-dot" style="background:#d29922;"></div> Mesoderm-derived</div>
<div class="legend-item"><div class="legend-dot" style="background:#79c0ff;"></div> Larynx track</div>
<div class="legend-item"><div class="legend-dot" style="background:#a5d6a7;"></div> Trachea track</div>
<div class="legend-item"><div class="legend-dot" style="background:#d2a8ff;"></div> Lung stages</div>
<div class="legend-item"><div class="legend-dot" style="background:#da3633;"></div> Pathology (IRDS)</div>
<div style="margin-left:auto;font-size:11px;color:#484f58;">Source: Langman's Medical Embryology; Embryology Note #14</div>
</div>
</div><!-- /page -->
</body>
</html>
cd /home/daytona/workspace/resp-flowchart && \ chromium-browser --headless --d…
which google-chrome chromium wkhtmltopdf weasyprint 2>&1; python3 -c "import wea…
cd /home/daytona/workspace/resp-flowchart && \ chromium --headless --disable-g…
| Section | What's shown |
|---|---|
| Germ Layer Origins | Endoderm vs. Splanchnic LPM (Mesoderm) with colour-coded pills |
| Pharyngeal Apparatus | Primitive pharynx → pouches / arches / clefts |
| 3 Parallel Organ Tracks | Larynx, Trachea, Lungs side-by-side with timelines |
| Larynx detail | Wk 5 → Wk 6 → Wk 6–12 → Wk 12 mature larynx; all cartilages, muscles, vagus nerve |
| Trachea detail | Lung bud, TE groove → TE septum → diverticulum → trachea / esophagus separation |
| Lung Stages | 4 colour-coded stages (Pseudo-glandular → Canalicular → Saccular → Alveolar) with weeks, cell types, and key events |
| Birth / First Breath | Fetal breathing, amniotic fluid clearance, surfactant layer, first cry trigger |
| IRDS | Pathology callout — premature < 34 wks, ↓ surfactant, alveolar collapse, ventilator |
| Summary Table | Quick-reference stage comparison at the bottom |
respiratory development flowchart
HTML File · HTML
respiratory development flowchart
PDF Document · PDF
Make a PowerPoint presentation of the respiratory system development stages
~/resp-flowchart/make_pptx.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"
pres.title = "Development of the Respiratory System";
pres.author = "Embryology – Note #14";
// ── COLOUR PALETTE ──────────────────────────────────────────────
const C = {
bg_dark: "0D1117", // main dark background
bg_card: "161B22", // card background
bg_mid: "1F2937", // slightly lighter dark
accent: "58A6FF", // blue highlight
text_white: "E6EDF3",
text_dim: "8B949E",
green: "3FB950",
yellow: "D29922",
orange: "FFA657",
red: "F78166",
purple: "D2A8FF",
pink: "FF7B72",
teal: "79C0FF",
border: "30363D",
// stage colours
col_pseudo: "FFA657",
col_canal: "F78166",
col_saccul: "D2A8FF",
col_alveol: "FF7B72",
col_larynx: "79C0FF",
col_trachea: "A5D6A7",
col_lung: "D2A8FF",
};
// ── HELPER: dark slide background ───────────────────────────────
function darkBg(slide) {
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: "100%", h: "100%",
fill: { color: C.bg_dark }, line: { color: C.bg_dark }
});
}
// ── HELPER: section divider line ────────────────────────────────
function divider(slide, y) {
slide.addShape(pres.ShapeType.line, {
x: 0.4, y, w: 12.5, h: 0,
line: { color: C.border, width: 0.8 }
});
}
// ── HELPER: coloured badge pill ─────────────────────────────────
function badge(slide, label, x, y, w, h, color, bgHex) {
slide.addShape(pres.ShapeType.roundRect, {
x, y, w, h,
fill: { color: bgHex || C.bg_card },
line: { color, width: 1.2 },
rectRadius: 0.1
});
slide.addText(label, {
x, y, w, h,
fontSize: 9, bold: true, color, align: "center", valign: "middle",
fontFace: "Calibri", margin: 0
});
}
// ── HELPER: info card (rounded rect + text) ──────────────────────
function card(slide, x, y, w, h, title, bullets, accentColor) {
// card border
slide.addShape(pres.ShapeType.roundRect, {
x, y, w, h,
fill: { color: C.bg_card },
line: { color: accentColor, width: 1.5 },
rectRadius: 0.08
});
// left accent bar
slide.addShape(pres.ShapeType.rect, {
x, y: y + 0.01, w: 0.05, h: h - 0.02,
fill: { color: accentColor }, line: { color: accentColor }
});
// title
slide.addText(title, {
x: x + 0.12, y: y + 0.06, w: w - 0.2, h: 0.28,
fontSize: 11, bold: true, color: accentColor,
fontFace: "Calibri", valign: "middle", margin: 0
});
// bullet list
const bulletItems = bullets.map((b, i) => ({
text: b,
options: { bullet: { code: "2022" }, color: C.text_white, fontSize: 9,
fontFace: "Calibri", breakLine: i < bullets.length - 1, paraSpaceBefore: 2 }
}));
slide.addText(bulletItems, {
x: x + 0.18, y: y + 0.38, w: w - 0.28, h: h - 0.46,
valign: "top", margin: 0
});
}
// ── HELPER: stage header bar ─────────────────────────────────────
function stageHeader(slide, x, y, w, label, stageName, week, color) {
slide.addShape(pres.ShapeType.rect, {
x, y, w, h: 0.44,
fill: { color: C.bg_mid }, line: { color: color, width: 1.5 }
});
// badge
badge(slide, label, x + 0.08, y + 0.07, 0.9, 0.3, color, C.bg_dark);
// name
slide.addText(stageName, {
x: x + 1.06, y, w: w - 2.2, h: 0.44,
fontSize: 13, bold: true, color, fontFace: "Calibri", valign: "middle", margin: 0
});
// week
slide.addText(week, {
x: x + w - 1.2, y, w: 1.1, h: 0.44,
fontSize: 9, color, fontFace: "Calibri", align: "right", valign: "middle", margin: 0
});
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
// Decorative top gradient bar
s.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: "100%", h: 0.6,
fill: { type: "solid", color: "0C2A50" }, line: { color: "0C2A50" }
});
// Large decorative lung-icon circle
s.addShape(pres.ShapeType.ellipse, {
x: 9.5, y: 1.0, w: 3.5, h: 3.5,
fill: { color: "0C2040" }, line: { color: C.accent, width: 2 }
});
s.addShape(pres.ShapeType.ellipse, {
x: 9.8, y: 1.3, w: 2.9, h: 2.9,
fill: { color: "0D1117" }, line: { color: "1F6FEB", width: 1 }
});
s.addText("🫁", {
x: 9.6, y: 1.5, w: 3.1, h: 2.5,
fontSize: 72, align: "center", valign: "middle"
});
// Title
s.addText("Development of the", {
x: 0.5, y: 1.2, w: 9.0, h: 0.7,
fontSize: 28, color: C.text_dim, fontFace: "Calibri Light",
bold: false, charSpacing: 2
});
s.addText("Respiratory System", {
x: 0.5, y: 1.9, w: 9.0, h: 1.1,
fontSize: 52, color: C.accent, fontFace: "Calibri", bold: true
});
// Subtitle
s.addText("Embryology – Note #14", {
x: 0.5, y: 3.1, w: 7.0, h: 0.4,
fontSize: 14, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 3.65);
// Tag pills at bottom
const tags = [
["Endoderm", C.green, "0C2A1E"],
["Mesoderm", C.yellow, "1E2A0C"],
["Germ Layers", C.accent, "031D2F"],
["Lung Stages", C.purple, "1F0A2E"],
["IRDS", C.pink, "2D0C05"],
];
tags.forEach(([lbl, col, bg], i) => {
badge(s, lbl, 0.5 + i * 1.62, 3.85, 1.45, 0.32, col, bg);
});
// week range
s.addText("Week 2 → 8 years of age", {
x: 0.5, y: 4.4, w: 8, h: 0.35,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light"
});
// Bottom bar
s.addShape(pres.ShapeType.rect, {
x: 0, y: 7.1, w: "100%", h: 0.4,
fill: { color: "0C2A50" }, line: { color: "0C2A50" }
});
s.addText("Source: Langman's Medical Embryology | Embryology Note #14", {
x: 0.4, y: 7.12, w: 12.5, h: 0.35,
fontSize: 8, color: C.text_dim, fontFace: "Calibri", valign: "middle"
});
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 2 – OVERVIEW / AGENDA
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "0C2A50" }, line: { color: "0C2A50" } });
s.addText("Overview", {
x: 0.4, y: 0.08, w: 12, h: 0.4,
fontSize: 18, bold: true, color: C.accent, fontFace: "Calibri", valign: "middle", margin: 0
});
s.addText("What we will cover", {
x: 0.4, y: 0.7, w: 12, h: 0.38,
fontSize: 14, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.1);
const items = [
{ n: "01", title: "Germ Layer Origins", desc: "Endoderm & Mesoderm — what they build", color: C.green },
{ n: "02", title: "Pharyngeal Apparatus", desc: "Pouches, arches, clefts → Larynx", color: C.teal },
{ n: "03", title: "Larynx Development", desc: "Week 5 → Week 12 — cartilage, muscles, vagus nerve", color: C.col_larynx },
{ n: "04", title: "Trachea Formation", desc: "Lung bud, TE groove/septum, diverticulum", color: C.col_trachea },
{ n: "05", title: "Pseudo-glandular Stage", desc: "Week 5–16 — bronchial tree to terminal bronchioles", color: C.col_pseudo },
{ n: "06", title: "Canalicular Stage", desc: "Week 16–26 — respiratory bronchioles & capillaries", color: C.col_canal },
{ n: "07", title: "Saccular Stage", desc: "Week 26–Birth — Type I & II pneumocytes, surfactant", color: C.col_saccul },
{ n: "08", title: "Alveolar Stage", desc: "Week 36–8 yrs — 100 M → 300 M alveoli", color: C.col_alveol },
{ n: "09", title: "Birth & IRDS", desc: "First breath, surfactant, infant respiratory distress", color: C.pink },
];
const cols = 3;
const rows = Math.ceil(items.length / cols);
const cw = 4.0, ch = 0.88, gx = 0.3, gy = 0.24;
const startX = 0.35, startY = 1.2;
items.forEach((item, i) => {
const col = i % cols;
const row = Math.floor(i / cols);
const x = startX + col * (cw + gx);
const y = startY + row * (ch + gy);
slide_overview_item(s, x, y, cw, ch, item);
});
function slide_overview_item(sl, x, y, w, h, item) {
sl.addShape(pres.ShapeType.roundRect, {
x, y, w, h,
fill: { color: C.bg_card }, line: { color: item.color, width: 1.2 }, rectRadius: 0.08
});
sl.addShape(pres.ShapeType.rect, {
x, y: y + 0.01, w: 0.04, h: h - 0.02,
fill: { color: item.color }, line: { color: item.color }
});
sl.addText(item.n, {
x: x + 0.1, y, w: 0.45, h,
fontSize: 22, bold: true, color: item.color, fontFace: "Calibri",
align: "center", valign: "middle", margin: 0
});
sl.addText(item.title, {
x: x + 0.6, y: y + 0.06, w: w - 0.7, h: 0.3,
fontSize: 10.5, bold: true, color: C.text_white, fontFace: "Calibri", valign: "middle", margin: 0
});
sl.addText(item.desc, {
x: x + 0.6, y: y + 0.38, w: w - 0.7, h: 0.44,
fontSize: 8.5, color: C.text_dim, fontFace: "Calibri", valign: "top", margin: 0
});
}
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 3 – GERM LAYER ORIGINS
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "0C2A50" }, line: { color: "0C2A50" } });
s.addText("Germ Layer Origins", {
x: 0.4, y: 0.08, w: 12, h: 0.4,
fontSize: 18, bold: true, color: C.accent, fontFace: "Calibri", valign: "middle", margin: 0
});
s.addText("The respiratory system arises from two germ layers", {
x: 0.4, y: 0.65, w: 12, h: 0.3,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.0);
// Gastrulation flow
const flow = [
{ label: "Bilaminar Disc\n(Week 2)", color: C.text_dim, bg: C.bg_card },
{ label: "Gastrulation\n(Primitive Streak)", color: C.yellow, bg: "1E2A0C" },
{ label: "Trilaminar Disc\nEndoderm + Mesoderm + Ectoderm", color: C.accent, bg: "031D2F" },
{ label: "Lateral & Craniocaudal\nFolding", color: C.purple, bg: "1F0A2E" },
{ label: "Foregut / Pharyngeal\nApparatus", color: C.teal, bg: "031D2F" },
];
flow.forEach((f, i) => {
const x = 0.2 + i * 2.58;
s.addShape(pres.ShapeType.roundRect, {
x, y: 1.05, w: 2.3, h: 0.75,
fill: { color: f.bg }, line: { color: f.color, width: 1.2 }, rectRadius: 0.08
});
s.addText(f.label, {
x, y: 1.05, w: 2.3, h: 0.75,
fontSize: 9, color: f.color, fontFace: "Calibri", align: "center", valign: "middle", margin: 4
});
if (i < flow.length - 1) {
s.addShape(pres.ShapeType.line, {
x: x + 2.3, y: 1.43, w: 0.28, h: 0,
line: { color: C.border, width: 1.5, endArrowType: "triangle" }
});
}
});
divider(s, 1.95);
// Two germ layer cards side by side
const cardY = 2.1;
const cardH = 4.7;
// ENDODERM
s.addShape(pres.ShapeType.roundRect, {
x: 0.3, y: cardY, w: 5.9, h: cardH,
fill: { color: "0A1A12" }, line: { color: C.green, width: 2 }, rectRadius: 0.1
});
s.addShape(pres.ShapeType.rect, {
x: 0.3, y: cardY + 0.01, w: 0.07, h: cardH - 0.02,
fill: { color: C.green }, line: { color: C.green }
});
badge(s, "ENDODERM", 0.5, cardY + 0.12, 1.4, 0.3, C.green, "0C2A1E");
s.addText("What it builds:", {
x: 0.55, y: cardY + 0.55, w: 5.5, h: 0.28,
fontSize: 10, bold: true, color: C.green, fontFace: "Calibri", margin: 0
});
const endoItems = [
"Epithelial lining of the larynx",
"Pseudostratified ciliated columnar epithelium",
"Vocal cords",
"Epithelial lining of the trachea",
"Epithelial lining of bronchi & bronchioles",
"Alveolar epithelium (Type I & II pneumocytes)",
"Glands of the respiratory tract",
];
s.addText(endoItems.map((t, i) => ({
text: t,
options: { bullet: { code: "2022" }, color: C.text_white, fontSize: 10, fontFace: "Calibri",
breakLine: i < endoItems.length - 1, paraSpaceBefore: 4 }
})), { x: 0.55, y: cardY + 0.88, w: 5.5, h: 3.3, valign: "top", margin: 0 });
s.addText("Origin: 4th & 6th pharyngeal pouches (larynx);\nForegut (trachea & lungs)", {
x: 0.45, y: cardY + 4.25, w: 5.6, h: 0.4,
fontSize: 8.5, color: C.text_dim, fontFace: "Calibri", italic: true, margin: 0
});
// MESODERM
s.addShape(pres.ShapeType.roundRect, {
x: 6.5, y: cardY, w: 6.5, h: cardH,
fill: { color: "141A06" }, line: { color: C.yellow, width: 2 }, rectRadius: 0.1
});
s.addShape(pres.ShapeType.rect, {
x: 6.5, y: cardY + 0.01, w: 0.07, h: cardH - 0.02,
fill: { color: C.yellow }, line: { color: C.yellow }
});
badge(s, "MESODERM (Splanchnic LPM)", 6.7, cardY + 0.12, 2.8, 0.3, C.yellow, "1E2A0C");
s.addText("What it builds:", {
x: 6.75, y: cardY + 0.55, w: 6.1, h: 0.28,
fontSize: 10, bold: true, color: C.yellow, fontFace: "Calibri", margin: 0
});
const mesoItems = [
"Laryngeal cartilages: thyroid, cricoid, arytenoid, cuneiform, corniculate",
"Laryngeal muscles: cricoarytenoid, cricothyroid",
"Vagus nerve (CN X) supply — from 4th & 6th pharyngeal arches",
"Trachealis muscle & tracheal cartilage rings",
"Bronchial smooth muscle",
"Connective tissue of the lung",
"Pleura (visceral & parietal layers)",
];
s.addText(mesoItems.map((t, i) => ({
text: t,
options: { bullet: { code: "2022" }, color: C.text_white, fontSize: 10, fontFace: "Calibri",
breakLine: i < mesoItems.length - 1, paraSpaceBefore: 4 }
})), { x: 6.75, y: cardY + 0.88, w: 6.1, h: 3.3, valign: "top", margin: 0 });
s.addText("Origin: 4th & 6th pharyngeal arch mesoderm (larynx);\nSplanchnic layer of lateral plate mesoderm (trachea & lungs)", {
x: 6.6, y: cardY + 4.25, w: 6.2, h: 0.4,
fontSize: 8.5, color: C.text_dim, fontFace: "Calibri", italic: true, margin: 0
});
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 4 – LARYNX DEVELOPMENT
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "031D2F" }, line: { color: "031D2F" } });
s.addText("Larynx Development", {
x: 0.4, y: 0.08, w: 12, h: 0.4,
fontSize: 18, bold: true, color: C.teal, fontFace: "Calibri", valign: "middle", margin: 0
});
badge(s, "LARYNX", 10.8, 0.08, 1.8, 0.38, C.teal, "031D2F");
s.addText("From the pharyngeal apparatus — 4th & 6th pouches and arches", {
x: 0.4, y: 0.65, w: 12, h: 0.3,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.0);
// 4-step timeline
const steps = [
{
week: "Week 5",
title: "Laryngeal Orifice",
points: [
"Laryngeal orifice (cavity) develops",
"Endodermal tissue from pharyngeal pouches begins invading the orifice",
"Primordia of vocal cords form",
],
color: C.teal
},
{
week: "Week 6",
title: "Swellings Form",
points: [
"Mesoderm → cartilage & muscles around larynx",
"Epiglottic swelling — above orifice",
"Arytenoid swelling — below orifice",
"Endoderm continues to invade → epithelial lining",
],
color: "#56D364"
},
{
week: "Wk 6–12",
title: "Maturation",
points: [
"Endoderm → pseudostratified ciliated columnar epithelium",
"Cartilages: thyroid, cricoid, arytenoid, cuneiform, corniculate",
"Muscles: cricoarytenoid, cricothyroid",
"Vagus nerve (CN X) supplies laryngeal muscles",
],
color: C.orange
},
{
week: "Week 12",
title: "Mature Larynx",
points: [
"Laryngeal orifice → laryngeal inlet",
"Epiglottic folds complete",
"Full cartilaginous skeleton in place",
"Motor & sensory innervation established",
],
color: C.yellow
},
];
steps.forEach((st, i) => {
const x = 0.3 + i * 3.22;
const y = 1.1;
const w = 3.0, h = 5.5;
s.addShape(pres.ShapeType.roundRect, {
x, y, w, h,
fill: { color: C.bg_card }, line: { color: st.color, width: 1.5 }, rectRadius: 0.08
});
// header
s.addShape(pres.ShapeType.rect, {
x, y, w, h: 0.7,
fill: { color: C.bg_mid }, line: { color: st.color, width: 0 }
});
s.addText(st.week, {
x: x + 0.08, y: y + 0.04, w: w - 0.16, h: 0.28,
fontSize: 9, bold: true, color: st.color, fontFace: "Calibri",
align: "center", margin: 0
});
s.addText(st.title, {
x: x + 0.08, y: y + 0.34, w: w - 0.16, h: 0.3,
fontSize: 11.5, bold: true, color: C.text_white, fontFace: "Calibri",
align: "center", margin: 0
});
// bullets
s.addText(st.points.map((p, j) => ({
text: p,
options: { bullet: { code: "2022" }, color: C.text_white, fontSize: 10, fontFace: "Calibri",
breakLine: j < st.points.length - 1, paraSpaceBefore: 6 }
})), { x: x + 0.15, y: y + 0.82, w: w - 0.3, h: h - 0.96, valign: "top", margin: 0 });
// connector arrow
if (i < steps.length - 1) {
s.addShape(pres.ShapeType.line, {
x: x + w, y: y + h / 2, w: 0.22, h: 0,
line: { color: C.border, width: 1.5, endArrowType: "triangle" }
});
}
});
// Origin summary bar at bottom
s.addShape(pres.ShapeType.roundRect, {
x: 0.3, y: 6.8, w: 12.7, h: 0.56,
fill: { color: C.bg_mid }, line: { color: C.border, width: 1 }, rectRadius: 0.06
});
s.addText([
{ text: "Endoderm: ", options: { bold: true, color: C.green, fontSize: 9.5 } },
{ text: "4th & 6th pharyngeal pouches → epithelial lining + vocal cords ", options: { color: C.text_white, fontSize: 9.5 } },
{ text: "Mesoderm: ", options: { bold: true, color: C.yellow, fontSize: 9.5 } },
{ text: "4th & 6th pharyngeal arch mesoderm → cartilage + muscles + vagus nerve (CN X)", options: { color: C.text_white, fontSize: 9.5 } },
], { x: 0.5, y: 6.82, w: 12.4, h: 0.5, valign: "middle", margin: 0, fontFace: "Calibri" });
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 5 – TRACHEA & LUNG BUD FORMATION
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "0C2A1E" }, line: { color: "0C2A1E" } });
s.addText("Trachea & Lung Bud Formation", {
x: 0.4, y: 0.08, w: 12, h: 0.4,
fontSize: 18, bold: true, color: C.col_trachea, fontFace: "Calibri", valign: "middle", margin: 0
});
badge(s, "WEEK 5", 11.4, 0.1, 1.5, 0.35, C.col_trachea, "0C2A1E");
s.addText("Endodermal cells bud off the foregut — separation of respiratory from digestive tract", {
x: 0.4, y: 0.65, w: 12, h: 0.3,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.0);
// Step-by-step flow (vertical on left, cards on right)
const steps = [
{ icon: "1", title: "Lung Bud", desc: "Endodermal cells bud off the foregut → lung bud forms anteriorly", color: C.col_trachea },
{ icon: "2", title: "TE Groove / Ridge", desc: "Lung bud creates a groove along anterior foregut → tracheoesophageal groove / ridge", color: "#A5F3A5" },
{ icon: "3", title: "TE Septum", desc: "Ridges fuse in the midline → tracheoesophageal septum completely separates anterior from posterior", color: C.yellow },
{ icon: "4", title: "Diverticulum → Trachea", desc: "Anterior diverticulum = trachea (anterior to esophagus). Posterior = esophagus", color: C.orange },
{ icon: "5", title: "Bronchial Buds", desc: "Lung bud bifurcates → left & right bronchial buds = primordia of main bronchi", color: C.col_pseudo },
{ icon: "6", title: "Mesodermal Wrapping", desc: "Splanchnic LPM surrounds trachea/bronchi → cartilage rings, smooth muscle, connective tissue", color: C.purple },
];
steps.forEach((st, i) => {
const y = 1.1 + i * 1.02;
const circX = 0.3, circY = y + 0.12;
const cardX = 1.1, cardY2 = y;
// circle number
s.addShape(pres.ShapeType.ellipse, {
x: circX, y: circY, w: 0.44, h: 0.44,
fill: { color: C.bg_dark }, line: { color: st.color, width: 1.5 }
});
s.addText(st.icon, {
x: circX, y: circY, w: 0.44, h: 0.44,
fontSize: 11, bold: true, color: st.color, align: "center", valign: "middle",
fontFace: "Calibri", margin: 0
});
// connector
if (i < steps.length - 1) {
s.addShape(pres.ShapeType.line, {
x: circX + 0.22, y: circY + 0.44, w: 0, h: 0.55,
line: { color: C.border, width: 1, endArrowType: "triangle" }
});
}
// card
s.addShape(pres.ShapeType.roundRect, {
x: cardX, y: cardY2, w: 11.5, h: 0.78,
fill: { color: C.bg_card }, line: { color: st.color, width: 1 }, rectRadius: 0.06
});
s.addText(st.title, {
x: cardX + 0.12, y: cardY2 + 0.06, w: 3, h: 0.3,
fontSize: 11, bold: true, color: st.color, fontFace: "Calibri", margin: 0, valign: "middle"
});
s.addText(st.desc, {
x: cardX + 3.2, y: cardY2 + 0.08, w: 8.1, h: 0.62,
fontSize: 10, color: C.text_white, fontFace: "Calibri", margin: 0, valign: "middle"
});
});
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 6 – PSEUDO-GLANDULAR STAGE
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "2D1B00" }, line: { color: "2D1B00" } });
s.addText("Stage 1 — Pseudo-glandular Stage", {
x: 0.4, y: 0.08, w: 10, h: 0.4,
fontSize: 18, bold: true, color: C.col_pseudo, fontFace: "Calibri", valign: "middle", margin: 0
});
badge(s, "Week 5 – 16", 11.0, 0.1, 2.0, 0.35, C.col_pseudo, "2D1B00");
s.addText("Lung resembles an exocrine gland — bronchial tree forms but no gas exchange possible", {
x: 0.4, y: 0.65, w: 12.5, h: 0.3,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.0);
// Branching hierarchy
const nodes = [
{ label: "Primary Bronchi\n(L & R)", x: 5.4, y: 1.15, w: 2.5, h: 0.6, color: C.col_pseudo },
{ label: "Lobar (Secondary) Bronchi\n3 Right | 2 Left", x: 4.5, y: 2.05, w: 4.3, h: 0.6, color: "#E8913A" },
{ label: "Segmental (Tertiary) Bronchi\n20 Right | 18 Left", x: 3.8, y: 3.0, w: 5.7, h: 0.6, color: "#D47A28" },
{ label: "Bronchioles → Terminal Bronchioles", x: 4.1, y: 3.95, w: 5.1, h: 0.6, color: "#C06018" },
];
nodes.forEach((n, i) => {
s.addShape(pres.ShapeType.roundRect, {
x: n.x, y: n.y, w: n.w, h: n.h,
fill: { color: C.bg_card }, line: { color: n.color, width: 1.5 }, rectRadius: 0.08
});
s.addText(n.label, {
x: n.x, y: n.y, w: n.w, h: n.h,
fontSize: 10.5, bold: true, color: n.color, fontFace: "Calibri",
align: "center", valign: "middle", margin: 4
});
if (i < nodes.length - 1) {
s.addShape(pres.ShapeType.line, {
x: n.x + n.w / 2, y: n.y + n.h, w: 0, h: 0.42,
line: { color: C.border, width: 1.5, endArrowType: "triangle" }
});
}
});
// Right side key features
const features = [
{ title: "No Gas Exchange", desc: "All airways lined by columnar/cuboidal epithelium — too thick for diffusion", color: C.red },
{ title: "Glandular Appearance", desc: "Histologically resembles an exocrine gland — branching tubular structures in mesenchyme", color: C.yellow },
{ title: "Endoderm → Epithelium", desc: "Epithelium & glands of all airways derived from endoderm", color: C.green },
{ title: "Splanchnic LPM", desc: "Surrounds airways → forms cartilage, smooth muscle, connective tissue", color: C.purple },
];
features.forEach((f, i) => {
card(s, 9.9, 1.1 + i * 1.35, 3.0, 1.22, f.title, [f.desc], f.color);
});
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 7 – CANALICULAR STAGE
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "2D0C05" }, line: { color: "2D0C05" } });
s.addText("Stage 2 — Canalicular Stage", {
x: 0.4, y: 0.08, w: 10, h: 0.4,
fontSize: 18, bold: true, color: C.col_canal, fontFace: "Calibri", valign: "middle", margin: 0
});
badge(s, "Week 16 – 26", 10.9, 0.1, 2.1, 0.35, C.col_canal, "2D0C05");
s.addText("Vascularisation begins — capillaries approach future alveoli but gas exchange still not viable", {
x: 0.4, y: 0.65, w: 12.5, h: 0.3,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.0);
// Left: linear progression
const chain = [
{ label: "Terminal\nBronchioles", color: C.col_pseudo },
{ label: "Respiratory\nBronchioles", color: C.col_canal },
{ label: "Alveolar\nDucts\n(3–6 per bronchiole)", color: "#E85040" },
{ label: "Primitive\nAlveoli", color: "#D03020" },
];
chain.forEach((c, i) => {
const x = 0.5;
const y = 1.1 + i * 1.4;
s.addShape(pres.ShapeType.roundRect, {
x, y, w: 3.2, h: 0.9,
fill: { color: C.bg_card }, line: { color: c.color, width: 1.5 }, rectRadius: 0.08
});
s.addText(c.label, {
x, y, w: 3.2, h: 0.9,
fontSize: 11, bold: true, color: c.color, fontFace: "Calibri",
align: "center", valign: "middle", margin: 4
});
if (i < chain.length - 1) {
s.addShape(pres.ShapeType.line, {
x: 2.1, y: y + 0.9, w: 0, h: 0.48,
line: { color: C.border, width: 1.5, endArrowType: "triangle" }
});
}
});
// Right side: features
const feats = [
{ title: "Cuboidal Cells", desc: "Primitive alveoli are lined with cuboidal cells — too thick, not good for gas exchange", color: C.col_canal },
{ title: "Capillary Ingrowth", desc: "Pulmonary capillaries begin growing around primitive alveoli for the first time", color: "#56D364" },
{ title: "Still Not Viable", desc: "Despite capillary proximity, cuboidal cells prevent effective O₂/CO₂ exchange", color: C.yellow },
{ title: "Transition Marker", desc: "End of canalicular stage = immature primitive alveoli only; next stage completes differentiation", color: C.purple },
];
feats.forEach((f, i) => {
card(s, 4.2, 1.1 + i * 1.5, 8.8, 1.35, f.title, [f.desc], f.color);
});
// Viability note
s.addShape(pres.ShapeType.roundRect, {
x: 0.3, y: 6.75, w: 12.7, h: 0.62,
fill: { color: "1A0A0A" }, line: { color: C.red, width: 1.5 }, rectRadius: 0.06
});
s.addText("⚠ Limit of viability: Babies born at the end of the canalicular stage (~week 24–26) may survive with intensive support but face severe respiratory challenges", {
x: 0.5, y: 6.77, w: 12.4, h: 0.58,
fontSize: 10, color: "#FFCDD2", fontFace: "Calibri", valign: "middle", margin: 0
});
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 8 – SACCULAR STAGE
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "1F0A2E" }, line: { color: "1F0A2E" } });
s.addText("Stage 3 — Saccular Stage", {
x: 0.4, y: 0.08, w: 10, h: 0.4,
fontSize: 18, bold: true, color: C.col_saccul, fontFace: "Calibri", valign: "middle", margin: 0
});
badge(s, "Week 26 – Birth", 10.7, 0.1, 2.3, 0.35, C.col_saccul, "1F0A2E");
s.addText("Type I & II pneumocytes differentiate — surfactant production begins", {
x: 0.4, y: 0.65, w: 12, h: 0.3,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.0);
// Two big cards: Type I and Type II pneumocytes
// Type I
s.addShape(pres.ShapeType.roundRect, {
x: 0.3, y: 1.1, w: 5.9, h: 3.0,
fill: { color: "100820" }, line: { color: C.col_saccul, width: 2 }, rectRadius: 0.1
});
s.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.11, w: 0.07, h: 2.98,
fill: { color: C.col_saccul }, line: { color: C.col_saccul } });
badge(s, "TYPE I PNEUMOCYTE", 0.5, 1.18, 2.5, 0.32, C.col_saccul, "1F0A2E");
s.addText("Flat (squamous) cells", {
x: 0.55, y: 1.6, w: 5.5, h: 0.3,
fontSize: 10.5, bold: true, color: C.text_white, fontFace: "Calibri", margin: 0
});
s.addText([
{ text: "Cover ~95% of alveolar surface area", options: { bullet: { code: "2022" }, breakLine: true } },
{ text: "Extremely thin → allows O₂ / CO₂ diffusion", options: { bullet: { code: "2022" }, breakLine: true } },
{ text: "Derived from cuboidal progenitor cells", options: { bullet: { code: "2022" }, breakLine: true } },
{ text: "Primary site of gas exchange", options: { bullet: { code: "2022" } } },
].map(o => ({ text: o.text, options: { ...o.options, color: C.text_white, fontSize: 10, fontFace: "Calibri", paraSpaceBefore: 5 } })),
{ x: 0.55, y: 1.95, w: 5.5, h: 1.1, valign: "top", margin: 0 });
// Type II
s.addShape(pres.ShapeType.roundRect, {
x: 6.5, y: 1.1, w: 6.5, h: 3.0,
fill: { color: "0D0820" }, line: { color: "#A78BFA", width: 2 }, rectRadius: 0.1
});
s.addShape(pres.ShapeType.rect, { x: 6.5, y: 1.11, w: 0.07, h: 2.98,
fill: { color: "#A78BFA" }, line: { color: "#A78BFA" } });
badge(s, "TYPE II PNEUMOCYTE", 6.7, 1.18, 2.6, 0.32, "#A78BFA", "1F0A2E");
s.addText("Cuboidal cells — the surfactant factories", {
x: 6.75, y: 1.6, w: 6.1, h: 0.3,
fontSize: 10.5, bold: true, color: C.text_white, fontFace: "Calibri", margin: 0
});
s.addText([
{ text: "Produce surfactant — protein & lipid complex coating alveolar surface", options: { bullet: { code: "2022" }, breakLine: true } },
{ text: "Surfactant ↓ surface tension → prevents alveolar collapse", options: { bullet: { code: "2022" }, breakLine: true } },
{ text: "Appears reliably from ~week 34 onwards", options: { bullet: { code: "2022" }, breakLine: true } },
{ text: "Can differentiate into Type I pneumocytes (progenitor role)", options: { bullet: { code: "2022" } } },
].map(o => ({ text: o.text, options: { ...o.options, color: C.text_white, fontSize: 10, fontFace: "Calibri", paraSpaceBefore: 5 } })),
{ x: 6.75, y: 1.95, w: 6.1, h: 1.1, valign: "top", margin: 0 });
// Other saccular changes row
divider(s, 4.2);
s.addText("Other Changes During Saccular Stage", {
x: 0.4, y: 4.3, w: 9, h: 0.3,
fontSize: 11, bold: true, color: C.text_dim, fontFace: "Calibri", margin: 0
});
const changes = [
{ t: "↑ Alveolar Number", d: "Rapid increase in number of primitive alveoli", c: C.col_saccul },
{ t: "Basement Membrane", d: "Forms around primitive alveoli\n(4 components)", c: C.teal },
{ t: "↑ Capillaries", d: "More pulmonary capillaries form, closely approximating alveoli", c: C.green },
{ t: "↑ Respiratory\nBronchioles", d: "Numbers of respiratory bronchioles also increase", c: C.yellow },
];
changes.forEach((c2, i) => {
const x = 0.3 + i * 3.26;
s.addShape(pres.ShapeType.roundRect, {
x, y: 4.68, w: 3.0, h: 2.25,
fill: { color: C.bg_card }, line: { color: c2.c, width: 1.2 }, rectRadius: 0.08
});
s.addShape(pres.ShapeType.rect, {
x, y: 4.69, w: 0.05, h: 2.23,
fill: { color: c2.c }, line: { color: c2.c }
});
s.addText(c2.t, {
x: x + 0.12, y: 4.72, w: 2.8, h: 0.45,
fontSize: 10.5, bold: true, color: c2.c, fontFace: "Calibri", margin: 0, valign: "middle"
});
s.addText(c2.d, {
x: x + 0.12, y: 5.2, w: 2.8, h: 1.65,
fontSize: 9.5, color: C.text_white, fontFace: "Calibri", margin: 0, valign: "top"
});
});
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 9 – ALVEOLAR STAGE
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "200808" }, line: { color: "200808" } });
s.addText("Stage 4 — Alveolar Stage", {
x: 0.4, y: 0.08, w: 9.5, h: 0.4,
fontSize: 18, bold: true, color: C.col_alveol, fontFace: "Calibri", valign: "middle", margin: 0
});
badge(s, "Week 36 → 8 Years", 10.5, 0.1, 2.5, 0.35, C.col_alveol, "200808");
s.addText("Final maturation continues long after birth — alveolar numbers triple by age 8", {
x: 0.4, y: 0.65, w: 12.5, h: 0.3,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.0);
// Big stat: alveolar count
s.addShape(pres.ShapeType.roundRect, {
x: 0.3, y: 1.1, w: 12.7, h: 1.08,
fill: { color: "200808" }, line: { color: C.col_alveol, width: 1.5 }, rectRadius: 0.08
});
s.addText([
{ text: "~100 million", options: { bold: true, color: C.col_alveol, fontSize: 22, fontFace: "Calibri" } },
{ text: " alveoli at birth ", options: { color: C.text_dim, fontSize: 14, fontFace: "Calibri" } },
{ text: "→", options: { bold: true, color: C.text_dim, fontSize: 22, fontFace: "Calibri" } },
{ text: " ~300 million", options: { bold: true, color: "#56D364", fontSize: 22, fontFace: "Calibri" } },
{ text: " alveoli by 8 years", options: { color: C.text_dim, fontSize: 14, fontFace: "Calibri" } },
], { x: 0.6, y: 1.1, w: 12.2, h: 1.08, align: "center", valign: "middle", margin: 0 });
// 4 feature cards
const fcards = [
{ title: "Alveolar Septa", desc: "Type I + II cells form septa (partitions) within alveoli — divides saccules into smaller alveoli, greatly increasing surface area for gas exchange", color: C.col_alveol },
{ title: "Basement Membrane\nThickening", desc: "Basement membrane thickens and matures — structural integrity of alveolar-capillary barrier improves", color: C.orange },
{ title: "↑ Pulmonary Capillaries", desc: "Capillary network continues to expand, increasing perfusion surface area and bringing blood supply closer to each alveolus", color: C.green },
{ title: "Post-natal Continuation", desc: "Alveolar development does NOT stop at birth — continues actively until 8 years of age; preterm infants have significantly fewer functional alveoli", color: C.purple },
];
fcards.forEach((fc, i) => {
const x = 0.3 + i * 3.26;
card(s, x, 2.28, 3.0, 4.42, fc.title, [fc.desc], fc.color);
});
// Timeline bar at bottom
const timeline = [
{ wk: "Wk 36", label: "Starts", color: C.col_alveol },
{ wk: "Birth", label: "100 M alveoli", color: C.orange },
{ wk: "1 yr", label: "Active growth", color: C.yellow },
{ wk: "3 yrs", label: "Major expansion", color: C.green },
{ wk: "8 yrs", label: "300 M alveoli\nMature lungs", color: "#56D364" },
];
s.addShape(pres.ShapeType.line, {
x: 0.8, y: 7.0, w: 11.8, h: 0,
line: { color: C.border, width: 1.5 }
});
timeline.forEach((t, i) => {
const x = 0.8 + i * 2.95;
s.addShape(pres.ShapeType.ellipse, {
x: x - 0.12, y: 6.88, w: 0.24, h: 0.24,
fill: { color: t.color }, line: { color: t.color }
});
s.addText(t.wk, { x: x - 0.5, y: 6.65, w: 1.0, h: 0.22,
fontSize: 8.5, color: t.color, fontFace: "Calibri", align: "center", margin: 0, bold: true });
s.addText(t.label, { x: x - 0.6, y: 7.15, w: 1.2, h: 0.3,
fontSize: 8, color: C.text_dim, fontFace: "Calibri", align: "center", margin: 0 });
});
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 10 – BIRTH & FIRST BREATH
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "0A2416" }, line: { color: "0A2416" } });
s.addText("Birth & First Breath", {
x: 0.4, y: 0.08, w: 10, h: 0.4,
fontSize: 18, bold: true, color: C.green, fontFace: "Calibri", valign: "middle", margin: 0
});
badge(s, "AT BIRTH", 11.4, 0.1, 1.6, 0.35, C.green, "0A2416");
s.addText("Transition from intra-uterine fetal breathing to independent air breathing", {
x: 0.4, y: 0.65, w: 12, h: 0.3,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.0);
// 3-phase flow
const phases = [
{
phase: "Before Birth",
icon: "👶",
points: [
"Fetal breathing movements occur in utero",
"Baby inhales amniotic fluid into alveoli",
"Strengthens respiratory muscles & lung tissue",
"Amniotic fluid coats all alveolar surfaces",
],
color: C.teal
},
{
phase: "At Birth",
icon: "✂",
points: [
"Umbilical cord cut → ↓ O₂ → hypoxia",
"Hypoxia activates respiratory centres",
"Respiratory muscles contract → first cry",
"First breath pushes amniotic fluid into pulmonary capillaries",
"Thin surfactant layer remains on alveolar surface",
],
color: C.yellow
},
{
phase: "After Birth",
icon: "🌬",
points: [
"Surfactant ↓ surface tension",
"Alveoli remain open between breaths",
"Normal, effortless breathing established",
"Alveolar development continues to age 8",
],
color: C.green
},
];
phases.forEach((ph, i) => {
const x = 0.3 + i * 4.35;
const y = 1.1;
const w = 4.1, h = 5.8;
s.addShape(pres.ShapeType.roundRect, {
x, y, w, h,
fill: { color: C.bg_card }, line: { color: ph.color, width: 1.8 }, rectRadius: 0.1
});
// header
s.addShape(pres.ShapeType.rect, {
x, y, w, h: 0.75,
fill: { color: C.bg_mid }, line: { color: ph.color, width: 0 }
});
s.addText(ph.phase, {
x: x + 0.1, y, w: w - 0.2, h: 0.75,
fontSize: 13, bold: true, color: ph.color, fontFace: "Calibri",
align: "center", valign: "middle", margin: 0
});
// bullets
s.addText(ph.points.map((p, j) => ({
text: p,
options: { bullet: { code: "2022" }, color: C.text_white, fontSize: 11, fontFace: "Calibri",
breakLine: j < ph.points.length - 1, paraSpaceBefore: 8 }
})), { x: x + 0.18, y: y + 0.88, w: w - 0.3, h: h - 1.0, valign: "top", margin: 0 });
// arrow between phases
if (i < phases.length - 1) {
s.addShape(pres.ShapeType.line, {
x: x + w, y: y + h / 2, w: 0.25, h: 0,
line: { color: C.border, width: 1.5, endArrowType: "triangle" }
});
}
});
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 11 – IRDS
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "2D0C05" }, line: { color: "2D0C05" } });
s.addText("Infant Respiratory Distress Syndrome (IRDS)", {
x: 0.4, y: 0.08, w: 10, h: 0.4,
fontSize: 17, bold: true, color: C.pink, fontFace: "Calibri", valign: "middle", margin: 0
});
badge(s, "PATHOLOGY", 11.0, 0.1, 2.0, 0.35, C.pink, "2D0C05");
s.addText("Also called Neonatal Respiratory Distress Syndrome (NRDS) — premature birth <34 weeks", {
x: 0.4, y: 0.65, w: 12.5, h: 0.3,
fontSize: 12, color: C.text_dim, fontFace: "Calibri Light", italic: true
});
divider(s, 1.0);
// Cascade flow
const cascade = [
{ label: "Premature Birth\n< 34 weeks", color: C.pink },
{ label: "Insufficient Type II\nPneumocyte Maturation", color: "#E85040" },
{ label: "↓ Surfactant Production", color: C.orange },
{ label: "↑ Surface Tension\nin Alveoli", color: C.yellow },
{ label: "↑ Collapsing Pressure\n→ Atelectasis", color: "#D29922" },
{ label: "Alveoli Collapse\n(Unequal, Irregular)", color: C.red },
{ label: "Respiratory\nDistress", color: "#FF4444" },
];
const boxW = 1.65, boxH = 0.75;
const startX = 0.25;
const startY = 1.15;
const gapX = 0.22;
cascade.forEach((c, i) => {
const x = startX + i * (boxW + gapX);
s.addShape(pres.ShapeType.roundRect, {
x, y: startY, w: boxW, h: boxH,
fill: { color: C.bg_card }, line: { color: c.color, width: 1.5 }, rectRadius: 0.08
});
s.addText(c.label, {
x, y: startY, w: boxW, h: boxH,
fontSize: 8.5, bold: true, color: c.color, fontFace: "Calibri",
align: "center", valign: "middle", margin: 4
});
if (i < cascade.length - 1) {
s.addShape(pres.ShapeType.line, {
x: x + boxW, y: startY + boxH / 2, w: gapX, h: 0,
line: { color: C.border, width: 1.5, endArrowType: "triangle" }
});
}
});
divider(s, 2.1);
// Consequences + Management 2-col
const left = [
"Baby must exert enormous effort to re-open collapsed alveoli with every breath",
"Progressive exhaustion → respiratory failure",
"Hypoxia, hypercapnia, metabolic acidosis",
"Characteristic 'ground-glass' appearance on CXR",
];
const right = [
"Mechanical ventilation — positive pressure to keep alveoli open",
"Exogenous surfactant therapy (intratracheal instillation)",
"Antenatal corticosteroids (betamethasone) to mother to accelerate fetal lung maturity",
"CPAP / high-flow O₂ support",
];
s.addText("Consequences", {
x: 0.4, y: 2.22, w: 6, h: 0.32,
fontSize: 11.5, bold: true, color: C.pink, fontFace: "Calibri", margin: 0
});
s.addText(left.map((t, i) => ({
text: t,
options: { bullet: { code: "2022" }, color: C.text_white, fontSize: 10.5, fontFace: "Calibri",
breakLine: i < left.length - 1, paraSpaceBefore: 6 }
})), { x: 0.4, y: 2.58, w: 6.0, h: 4.2, valign: "top", margin: 0 });
s.addShape(pres.ShapeType.line, {
x: 6.65, y: 2.15, w: 0, h: 5.1,
line: { color: C.border, width: 1 }
});
s.addText("Management", {
x: 6.9, y: 2.22, w: 6.1, h: 0.32,
fontSize: 11.5, bold: true, color: C.green, fontFace: "Calibri", margin: 0
});
s.addText(right.map((t, i) => ({
text: t,
options: { bullet: { code: "2022" }, color: C.text_white, fontSize: 10.5, fontFace: "Calibri",
breakLine: i < right.length - 1, paraSpaceBefore: 6 }
})), { x: 6.9, y: 2.58, w: 6.0, h: 4.2, valign: "top", margin: 0 });
}
// ═══════════════════════════════════════════════════════════════
// SLIDE 12 – SUMMARY TABLE
// ═══════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
darkBg(s);
s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.55,
fill: { color: "0C2A50" }, line: { color: "0C2A50" } });
s.addText("Summary — Lung Development Stages", {
x: 0.4, y: 0.08, w: 12, h: 0.4,
fontSize: 18, bold: true, color: C.accent, fontFace: "Calibri", valign: "middle", margin: 0
});
// Table headers
const cols2 = [
{ label: "Stage", w: 1.8, x: 0.2 },
{ label: "Timing", w: 1.6, x: 2.0 },
{ label: "Airways", w: 3.2, x: 3.6 },
{ label: "Cells / Key Events", w: 4.2, x: 6.8 },
{ label: "Gas Exchange?", w: 1.8, x: 11.0 },
];
const hdrY = 0.65, hdrH = 0.5;
cols2.forEach(c => {
s.addShape(pres.ShapeType.rect, {
x: c.x, y: hdrY, w: c.w, h: hdrH,
fill: { color: "0C2A50" }, line: { color: C.border, width: 0.5 }
});
s.addText(c.label, {
x: c.x, y: hdrY, w: c.w, h: hdrH,
fontSize: 10, bold: true, color: C.accent, fontFace: "Calibri",
align: "center", valign: "middle", margin: 4
});
});
const rows2 = [
{
stage: "Pseudo-\nglandular",
timing: "Wk 5–16",
airways: "Primary → lobar → segmental bronchi → terminal bronchioles",
cells: "Columnar/cuboidal epithelium; lung resembles exocrine gland",
gas: "✗ None",
color: C.col_pseudo, bg: "2D1B00"
},
{
stage: "Canalicular",
timing: "Wk 16–26",
airways: "Terminal bronchioles → respiratory bronchioles → alveolar ducts → primitive alveoli",
cells: "Cuboidal cells; capillaries begin to approach alveoli",
gas: "✗ Not yet",
color: C.col_canal, bg: "2D0C05"
},
{
stage: "Saccular",
timing: "Wk 26–Birth",
airways: "↑ Alveolar numbers; basement membrane forms",
cells: "Type I (flat, gas exchange) & Type II (surfactant); ~wk 34+ surfactant produced",
gas: "✓ Begins",
color: C.col_saccul, bg: "1F0A2E"
},
{
stage: "Alveolar",
timing: "Wk 36–8 yrs",
airways: "Alveolar septa form; ↑↑ alveolar numbers",
cells: "100 M alveoli at birth → 300 M by age 8; ↑ capillaries; BM thickens",
gas: "✓✓ Full",
color: C.col_alveol, bg: "200808"
},
];
rows2.forEach((row, i) => {
const y = hdrY + hdrH + i * 1.38;
const rowH = 1.3;
const data = [
{ label: row.stage, w: cols2[0].w, x: cols2[0].x, bold: true, color: row.color },
{ label: row.timing, w: cols2[1].w, x: cols2[1].x, bold: false, color: C.text_dim },
{ label: row.airways, w: cols2[2].w, x: cols2[2].x, bold: false, color: C.text_white },
{ label: row.cells, w: cols2[3].w, x: cols2[3].x, bold: false, color: C.text_white },
{ label: row.gas, w: cols2[4].w, x: cols2[4].x, bold: true,
color: row.gas.startsWith("✓") ? C.green : C.red },
];
data.forEach(d => {
s.addShape(pres.ShapeType.rect, {
x: d.x, y, w: d.w, h: rowH,
fill: { color: row.bg }, line: { color: C.border, width: 0.5 }
});
s.addShape(pres.ShapeType.rect, {
x: d.x, y: y + 0.01, w: 0.04, h: rowH - 0.02,
fill: { color: row.color }, line: { color: row.color }
});
s.addText(d.label, {
x: d.x + 0.1, y, w: d.w - 0.15, h: rowH,
fontSize: 9.5, bold: d.bold, color: d.color, fontFace: "Calibri",
valign: "middle", margin: 4
});
});
});
// footer
s.addShape(pres.ShapeType.rect, {
x: 0, y: 7.1, w: "100%", h: 0.4,
fill: { color: "0C2A50" }, line: { color: "0C2A50" }
});
s.addText("Source: Langman's Medical Embryology | First Aid USMLE Step 1 | Embryology Note #14", {
x: 0.4, y: 7.12, w: 12.5, h: 0.35,
fontSize: 8, color: C.text_dim, fontFace: "Calibri", valign: "middle"
});
}
// ═══════════════════════════════════════════════════════════════
// WRITE FILE
// ═══════════════════════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/resp-flowchart/Respiratory_System_Development.pptx" })
.then(() => console.log("✅ DONE: Respiratory_System_Development.pptx"))
.catch(e => { console.error("ERROR:", e); process.exit(1); });