// ts/corps.ts var main = document.querySelector("main"); (async () => { const loader = document.querySelector("#loader"); loader.style.display = "block"; try { await render(); } catch (e) { main.textContent = e instanceof Error ? e.message : String(e); } loader.style.display = "none"; })(); async function render() { const corps = await fetch("corps.json").then((r) => r.json()); corps.sort((a, b) => (a.headquartersAddress?.lines.find((line) => line.type === "SYSTEM").entity.naturalId ?? "￿").localeCompare(b.headquartersAddress?.lines.find((line) => line.type === "SYSTEM").entity.naturalId ?? "￿")); main.innerHTML = ` ${corps.map(renderCorpRow).join("")}
code name shareholders HQ
`; } function renderCorpRow(corp) { let hq = ""; if (corp.headquartersAddress !== null) { const planet = corp.headquartersAddress.lines.find((line) => line.type === "PLANET").entity; hq = planet.name; if (planet.name !== planet.naturalId) hq += ` (${planet.naturalId})`; if (!corp.headquartersFinished) hq += " [unfinished]"; } return ` ${corp.code} ${corp.name} ${corp.shareholders.length} ${hq} `; } //# debugId=938663E409BCBBAE64756E2164756E21