GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Kuiper, cosmos and drawing engines / stars / /

Standalone and 2 more files

A JavaScript module in the library folder of Stars that maps Renewable Energy Planning Database (REPD) master and heavy emitters UK, using SHA-256, and uses data from the GridAtlas repository.

700 lines of JavaScript and HTML from stars, in 3 files. Topic: Kuiper, cosmos and drawing engines. Section 1562 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Code render · stars / code.html lines 1–137
  2. Stars — Index Page render · stars / index.html lines 1–24
  3. Standalone geodesy · stars / library/standalone.mjs lines 1–539

Code

A web page in Stars that draws blocks, families and names, using haversine, and uses data from the ventus-grid-engine repository. Published at https://ventusltd.github.io/stars/code.html.

renderstars / code.html · lines 1–137 of 137 · Entry point · pattern fetchSource (shared by 2 files)

What it does
It draws blocks, families and names. Defines 9 functions or classes, including $, esc, byName, purposeOf, loadFamily. Side effects: changes the web page (DOM); makes network requests.
Inputs & outputs
In: data source: ventus-grid-engine data; JSON file blocks.json; JSON file families.json; JSON file index.json; JSON file names.json; form fields (user input). Out: web page.
Downstream impact
Used directly by 10 files: VEDIC Verify Reuse Routes (vedic-); Start (stars, https://ventusltd.github.io/stars/start.html); Table (stars, https://ventusltd.github.io/stars/table.html); Species — Estate Activity Page (spiders, https://ventusltd.github.io/spiders/species/estate-activity/); and 6 more. Reached from 377 other entry points, including Code Generator — Index Page (code-generator, https://ventusltd.github.io/code-generator/); Generate (code-generator, https://ventusltd.github.io/code-generator/); 404 (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/404.html). It is itself an entry point, published at https://ventusltd.github.io/stars/code.html.
What it achieves
It loads family (`loadFamily`) and fetches source (`fetchSource`). GlobalGrid2050 architecture development. It reads `./blocks/blocks.json`.
Why it matters
Loaded by the Start page at https://ventusltd.github.io/stars/start.html and 5 other pages. Also imported by VEDIC Verify Reuse Routes, Generate Workflow and Lens Grammar Proof, from Code Generator, GlobalGrid2050 and VEDIC. Checked by VEDIC Browser Smoke.
Application
stars · / · page
Uses
Start (link), Table (link), Standalone (estate URL)
Used by
named by URL in VEDIC Verify Reuse Routes (estate URL), linked from Start (link), linked from Table (link), linked from Species — Estate Activity Page (link), named by URL in VEDIC — Index Page (estate URL), named by URL in VEDIC Browser Smoke (estate URL), named by URL in Generate Workflow (estate URL), named by URL in Lens Grammar Proof (estate URL), and 2 more
Produces
$, esc, byName, purposeOf, loadFamily, search, fetchSource, show, gh
Defines here
$, esc, byName, purposeOf, loadFamily, search, fetchSource, show, gh
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
stars@030ebc202d35959fecd162327892f671d1d9a0cc code.html:1-137 · blob c27d5d8b6bf533a5e5487a9382e3958d5d9c8df2 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: unknown · users: none · canonical: unknown
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Code report · globalgrid2050 architecture development</title>
<style>
  :root{color-scheme:dark}
  body{margin:0;padding:16px 18px 40px;background:#0b0d12;color:#d8dee9;font:14px/1.5 ui-monospace,Menlo,Consolas,monospace}
  a{color:#00e5ff}
  h1{font-size:22px;margin:0 0 4px}
  .ey{color:#7da0c8;text-transform:uppercase;letter-spacing:.08em;font-size:11px}
  .nav{display:flex;flex-wrap:wrap;gap:6px 14px;margin:8px 0 6px;font-size:13px}
  input{width:100%;box-sizing:border-box;padding:10px;background:#12151c;border:1px solid #2a3140;color:inherit;font:inherit;border-radius:6px;margin:12px 0}
  .hits a{display:block;padding:4px 0;border-bottom:1px solid #1a1f2a}
  .card{border:1px solid #2a3140;border-radius:8px;padding:14px;margin:14px 0;background:#0f1218}
  .green{color:#39d353}.amber{color:#ffd54a}.grey{color:#8b93a7}
  table{border-collapse:collapse;width:100%;font-size:13px}
  td,th{text-align:left;padding:4px 6px;border-bottom:1px solid #1a1f2a;vertical-align:top}
  .scroll{overflow-x:auto}
  pre{background:#070910;border:1px solid #1a1f2a;border-radius:6px;padding:10px;overflow:auto;font-size:12.5px;line-height:1.45}
  .ln{color:#4b5568;user-select:none;display:inline-block;min-width:7ch;text-align:right;margin-right:12px}
  button{background:#12151c;border:1px solid #385464;color:#d8dee9;padding:7px 12px;border-radius:6px;font:inherit;cursor:pointer;margin:4px 6px 4px 0}
  button:hover{border-color:#00e5ff}
  a > button{color:#d8dee9}
  .first button{border-color:#00e5ff}
  .muted{color:#8b93a7}
  details{margin-top:10px}summary{cursor:pointer;color:#8b93a7}
  .examples a{margin-right:12px}
  @media(max-width:600px){body{padding:12px}}
</style>
<div class="ey">Ventus · Global Grid 2050</div>
<h1>Code report</h1>
<nav class="nav"><a href="https://ventusltd.github.io/ventus-grid-engine/?graph=modular">← Map</a><a href="https://globalgrid2050.com/">Home</a><a href="./start.html">Start here</a><a href="./table.html">Blocks</a></nav>
<div class="muted" id="status">Loading the index…</div>
<input id="q" placeholder="Type part of a function name, or its number (for example distanceKm, or 511)" autocomplete="off" aria-label="Search functions by name or number">
<div class="hits" id="hits"></div>
<div id="view"><div class="card" id="landing">
  <div>One function per report: what it is for, where it is used, the live page it runs on, and the code itself when you open it.</div>
  <div class="muted" style="margin-top:8px">Matches appear as you type. Try:</div>
  <div class="examples" style="margin-top:4px"><a href="?family=511">#511 distanceKm</a> <a href="?family=440">#440 haversine</a> <a href="?family=514">#514 nearestSubstations</a> <a href="?family=77484">#77484 voltageDrop</a></div>
  <div class="muted" style="margin-top:8px">Do not know the name? <a href="./table.html">Browse the blocks by subject</a>, then open a block's parts list.</div>
</div></div>
<p class="muted">Every function has a permanent number, shared by all copies of the same logic. Numbered lines are the permanent numbers of each line. The code is fetched from GitHub at the exact commit. Public repositories only. <a href="https://github.com/Ventusltd/stars/blob/main/MODULAR-STAR.md">What this is</a> · <a href="https://github.com/Ventusltd/stars/blob/main/modular/SUMMARY.md">Summar  … [line shortened here: 505 characters; full line on GitHub]
<script>
const $ = s => document.querySelector(s);
const esc = s => String(s).replace(/[&<>"]/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]));
const byName = (a, b) => String(a).localeCompare(String(b), 'en');
let index, names;
const bucketCache = new Map();
let blocksPromise = null;
async function purposeOf(n) {
  if (!blocksPromise) blocksPromise = Promise.all([fetch('./blocks/blocks.json').then(r => r.json()), fetch('./blocks/families.json').then(r => r.json())]);
  const [table, fams] = await blocksPromise;
  const sym = Object.keys(fams).find(s => fams[s].includes(n)); if (!sym) return null;
  const block = table.blocks.find(b => b.symbol === sym) || { symbol: sym, title: 'other tools', category: 'other' };
  return { block, category: table.categories.find(c => c.id === block.category) || { id: 'other', title: 'Other tools' } };
}
async function loadFamily(n) {
  const b = Math.floor(n / index.bucket_size);
  if (!bucketCache.has(b)) bucketCache.set(b, fetch(`./code/f/${b}.json`, {cache: 'no-cache'}).then(r => r.ok ? r.json() : {}));
  return (await bucketCache.get(b))[n] || null;
}
function search(q) {
  q = q.trim(); const hits = $('#hits'); hits.innerHTML = '';
  if (!q) return;
  if (/^#?\d+$/.test(q)) { history.pushState(null, '', `?family=${q.replace('#', '')}`); show(Number(q.replace('#', ''))); return; }
  const ql = q.toLowerCase();
  const found = Object.keys(names).filter(k => k.toLowerCase().includes(ql)).sort((a, b) => (a.toLowerCase().startsWith(ql) ? 0 : 1) - (b.toLowerCase().startsWith(ql) ? 0 : 1) || a.length - b.length || byName(a, b)).slice(0, 40);
  for (const k of found) for (const n of names[k].slice(0, 8)) {
    const a = document.createElement('a'); a.href = `?family=${n}`; a.textContent = `#${n} ${k}`;
    a.onclick = e => { e.preventDefault(); history.pushState(null, '', `?family=${n}`); show(n); };
    hits.append(a);
  }
  if (!found.length) hits.textContent = 'No function has a name containing "' + q + '". Try a shorter part of the name, or browse the blocks by subject.';
}
async function fetchSource(p) {
  const url = `https://raw.githubusercontent.com/${p.repo}/${p.commit}/${p.path.split('/').map(encodeURIComponent).join('/')}`;
  const r = await fetch(url); if (!r.ok) throw new Error(`GitHub ${r.status}`);
  return (await r.text()).split('\n').slice(p.first - 1, p.last);
}
async function show(n) {
  $('#hits').innerHTML = ''; const v = $('#view'); v.innerHTML = '<div class="card">Loading…</div>';
  const f = await loadFamily(n);
  if (!f) { v.innerHTML = `<div class="card">There is no function with the number ${esc(n)}. Type a name in the search box, or <a href="./table.html">browse the blocks by subject</a>.</div>`; return; }
  const gh = p => `https://github.com/${p.repo}/blob/${p.commit}/${p.path.split('/').map(encodeURIComponent).join('/')}#L${p.first}-L${p.last}`;
  const c = f.places[0];
  const rag = f.standalone ? 'green' : 'amber';
  const kind = { function: 'a function', class: 'a class', method: 'a method' }[f.kind] || f.kind;
  const places = f.places.slice().sort((a, b) => (b.live ? 1 : 0) - (a.live ? 1 : 0) || byName(a.repo, b.repo) || byName(a.path, b.path) || a.first - b.first);
  const uses = (f.uses || []).slice().sort((a, b) => byName(a.name, b.name));
  const usedBy = (f.used_by || []).slice().sort((a, b) => a.family - b.family);
  v.innerHTML = `<div class="card">
    <div class="ey">function #${f.n}</div>
    <h1>${esc(f.names[0])}</h1>
    <div><span class="${rag}">●</span> ${f.standalone ? 'self-contained: works on its own' : 'needs from elsewhere: ' + (f.needs && f.needs.length ? esc(f.needs.slice().sort(byName).join(', ')) : 'its surrounding file')}
      · ${esc(kind)} · used in ${f.places.length}${f.places.length === 40 ? '+' : ''} place${f.places.length === 1 ? '' : 's'} across ${f.files} file${f.files === 1 ? '' : 's'} in ${f.repos.length} repositor${f.repos.length === 1 ? 'y' : 'ies'} · ${f.versions} version${f.versions === 1 ? '' : 's'}${f.first_written ? ' · first written ' + f.first_written.slice(0, 10) : ''}</div>
    ${f.names.length > 1 ? `<div class="muted">also named: ${f.names.slice(1).map(esc).join(', ')}</div>` : ''}
    <div id="purpose" class="muted"></div>
    ${uses.length || usedBy.length ? `<div style="margin-top:6px">${uses.length ? `<div><span class="muted">uses:</span> ${uses.slice(0, 10).map(u => `<a href="?family=${u.family}">#${u.family} ${esc(u.name)}</a>`).join(', ')}</div>` : ''}${usedBy.length ? `<div><span class="muted">used by:</span> ${usedBy.slice(0, 12).map(u => `<a href="?family=${u.family}">#${u.family}</a>`).join(', ')}${usedBy.  … [line shortened here: 506 characters; full line on GitHub]
    <div style="margin-top:10px">
      ${c.live ? `<a class="first" href="${esc(c.live)}" target="_blank" rel="noopener"><button>Open the live page</button></a>` : ''}
      <a href="https://ventusltd.github.io/ventus-grid-engine/?graph=modular&focus=${encodeURIComponent('#' + f.n + ' ' + f.names[0])}"><button>See it on the map</button></a>
      <a href="${gh(c)}" target="_blank" rel="noopener"><button>Open on GitHub</button></a>
      <button id="copy">Copy the code</button>
      ${f.library ? `<button id="copyImport">Copy an import line</button>` : ''}
    </div>
    <div class="ey" style="margin-top:12px">where it is used (live pages first)</div>
    <div class="scroll"><table><tr><th>repository</th><th>file</th><th>lines</th><th>live page</th></tr>
    ${places.map(p => `<tr><td>${esc(p.repo.split('/')[1])}</td><td><a href="${gh(p)}" target="_blank" rel="noopener">${esc(p.path)}</a></td><td>${p.first}–${p.last}</td><td>${p.live ? `<a href="${esc(p.live)}" target="_blank" rel="noopener">open</a>` : '<span class="muted">not published</span>'}</td></tr>`).join('')}
    </table></div>
    <details open><summary>The code (${c.last - c.first + 1} lines, from ${esc(c.repo.split('/')[1])})</summary><pre id="src">Fetching the code from GitHub…</pre></details>
    ${f.library ? `<p class="muted">In the compiled library as <code>${esc(f.library)}</code>: <code>import { ${esc(f.library)} } from 'https://ventusltd.github.io/stars/library/standalone.mjs'</code></p>` : ''}
  </div>`;
  purposeOf(n).then(p => { const el = $('#purpose'); if (el && p) el.innerHTML = `part of: <a href="./table.html?category=${esc(p.category.id)}">${esc(p.category.title)}</a> › <a href="./table.html?block=${esc(p.block.symbol)}">${esc(p.block.symbol)} ${esc(p.block.title)}</a>`; }).catch(() => {});
  document.querySelectorAll('#view a[href^="?family="]').forEach(a => a.onclick = e => { e.preventDefault(); const m = new URLSearchParams(a.getAttribute('href')).get('family'); history.pushState(null, '', `?family=${m}`); show(Number(m)); });
  let source = '';
  try {
    const lines = await fetchSource(c);
    source = lines.join('\n');
    $('#src').innerHTML = lines.map((t, i) => `<span class="ln">${f.lines[i] ?? ''}</span>${esc(t)}`).join('\n');
  } catch (e) { $('#src').textContent = 'The code could not be fetched from GitHub: ' + e.message; }
  $('#copy').onclick = () => navigator.clipboard.writeText(`// function #${f.n} ${f.names[0]} · ${gh(c)}\n${source}\n`).then(() => $('#copy').textContent = 'Copied');
  const ci = $('#copyImport'); if (ci) ci.onclick = () => navigator.clipboard.writeText(`import { ${f.library} } from 'https://ventusltd.github.io/stars/library/standalone.mjs';\n`).then(() => ci.textContent = 'Copied');
}
(async () => {
  try {
    [index, names] = await Promise.all([fetch('./code/index.json', {cache: 'no-cache'}).then(r => r.json()), fetch('./code/names.json', {cache: 'no-cache'}).then(r => r.json())]);
    $('#status').textContent = `${index.families.toLocaleString('en-GB')} functions with a permanent number · ${index.elements.toLocaleString('en-GB')} functions and classes in the code · ${index.lines.toLocaleString('en-GB')} unique lines · updated ${index.generated_utc.slice(0, 16).replace('T', ' ')} UTC`;
    $('#q').oninput = e => search(e.target.value);
    document.querySelectorAll('#landing a[href^="?family="]').forEach(a => a.onclick = e => { e.preventDefault(); const m = new URLSearchParams(a.getAttribute('href')).get('family'); history.pushState(null, '', `?family=${m}`); show(Number(m)); });
    const n = new URLSearchParams(location.search).get('family');
    if (n) show(Number(n));
    window.onpopstate = () => { const m = new URLSearchParams(location.search).get('family'); if (m) show(Number(m)); else location.reload(); };
  } catch (e) { $('#status').textContent = 'The code index is not published yet: ' + e.message; }
})();
</script>
</html>

Stars — Index Page

A web page using data from the ventus-grid-engine repository. Published at https://ventusltd.github.io/stars/.

renderstars / index.html · lines 1–24 of 24 · Entry point

What it does
It draws its content. Side effects: changes the web page (DOM).
Inputs & outputs
Out: web page.
Downstream impact
Used directly by 37 files: Pilot (globalgrid2050, https://globalgrid2050.com/testcode/wafer-development-environment/202609190330-cable-cross-sections/); Testcode — Code Map (globalgrid2050, https://globalgrid2050.com/testcode/202609141754/code-map/); Galaxies Wafers — App (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/); Card (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/31-code-card-everywhere/); and 33 more. Reached from 356 other entry points, including 404 (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/404.html); Galaxies Wafers — Index Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/); Galaxies Wafers — Iterations Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/). It is itself an entry point, published at https://ventusltd.github.io/stars/.
What it achieves
GlobalGrid2050 architecture development.
Why it matters
Loaded by the V3 Bundles Derived Links page in Testcode and 5 other pages. Also imported by 31 files, including Pilot, Testcode — Code Map and Galaxies Wafers — App, from Code Generator, Galaxies Wafers, GlobalGrid2050 and others.
Application
stars · / · page
Uses
Start (link), Table (link)
Used by
named by URL in Pilot (estate URL), named by URL in Testcode — Code Map (estate URL), named by URL in Galaxies Wafers — App (estate URL), named by URL in Card (estate URL), named by URL in Iterations — 32 Spider and Galaxy (estate URL), named by URL in Iterations — 42 Counts That Say Themselves (estate URL), named by URL in Pilot (estate URL), named by URL in Pilot (estate URL), and 29 more
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
stars@030ebc202d35959fecd162327892f671d1d9a0cc index.html:1-24 · blob f2e787eb0f85c0db71b3f2515e2de32ae7735b00 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: unknown
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="refresh" content="0; url=./start.html">
<link rel="canonical" href="./start.html">
<title>globalgrid2050 architecture development</title>
<style>
  :root{color-scheme:dark}
  body{margin:0;padding:16px 18px 40px;background:#0b0d12;color:#d8dee9;font:15px/1.55 ui-monospace,Menlo,Consolas,monospace;max-width:720px}
  a{color:#00e5ff}
  h1{font-size:22px;margin:0 0 10px}
  .ey{color:#7da0c8;text-transform:uppercase;letter-spacing:.08em;font-size:11px}
  li{margin:6px 0}
</style>
<div class="ey">Ventus · Global Grid 2050</div>
<h1>globalgrid2050 architecture development</h1>
<p>Opening the start page. If it does not open, choose a page:</p>
<ul>
  <li><a href="./start.html">Start here</a>: three plain questions lead to the right page</li>
  <li><a href="./table.html">Periodic table</a>: every block, with a permanent number</li>
  <li><a href="https://ventusltd.github.io/ventus-grid-engine/">Relational mapping</a>: the dashboard of graphs</li>
  <li><a href="https://globalgrid2050.com/">Home</a></li>
</ul>

Standalone

A JavaScript module in the library folder of Stars that maps Renewable Energy Planning Database (REPD) master and heavy emitters UK, using SHA-256, and uses data from the GridAtlas repository.

Set aside from the main view: A comment at the top of the file says a tool wrote it. (noise-generated, proposed by noise.py). All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line 2 comment: // Generated by the modular star 2026-12-05T23:26:43.596Z. Each export is one family's earliest-seen copy, unchanged; the comment links its source.

geodesystars / library/standalone.mjs · lines 1–539 of 12585 · Entry point · pattern segmentConductors (shared by 2 files)

What it does
It maps REPD master, heavy emitters UK, notice and substations. Defines 1111 functions or classes, including f1586_invariant, f8767_representativePoint, f8768_voltagesKv, f8772_voltageOf, f8773_ratingsOf. Side effects: changes the web page (DOM); reads or writes files; makes network requests; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain terms in the code: substations, 750kV, 400kV, 275kV, 132kV, 66kV.
Inputs & outputs
In: data source: gridatlas data; JSON file repd_master.json; JSON file heavy_emitters_uk.json; JSON file notice.json; form fields (user input). Out: canvas drawing. Coordinate systems named: OSGB36 / EPSG:27700 (British National Grid), WGS84 / EPSG:4326. Voltage levels named: 750kV, 400kV, 275kV, 132kV, 66kV, 33kV, 1.5kV, 1500V.
Downstream impact
Used directly by 4 files: Code (stars, https://ventusltd.github.io/stars/code.html); Proof (stars); Modular Star Workflow (stars); Testcode — Code Record Page (globalgrid2050, https://globalgrid2050.com/testcode/202609141754/code-record/). Reached from 383 other entry points, including Code Generator — Index Page (code-generator, https://ventusltd.github.io/code-generator/); Generate (code-generator, https://ventusltd.github.io/code-generator/); 404 (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/404.html).
What it achieves
It snaps coordinate (`snapCoordinate`), paints cursor (`paintCursor`) and sets plan (`setPlan`). Compiled library of self-contained JavaScript functions that appear in two or more places across Ventusltd code. Its code works with 33 kV, 132 kV and 275 kV. It responds to abort events.
Why it matters
Loaded by the Code page at https://ventusltd.github.io/stars/code.html and 1 other page. Run by Proof and Modular Star Workflow.
Application
stars · library · JavaScript module
VEDIC
MEASURE (GG2050-VEDIC-000001): GridAtlas / Geodesy · Mathematics / Spherical geometry. coordinate_pair, coordinate_pair → distance_km
VEDIC
REPRESENT (GG2050-VEDIC-000002): GridAtlas / Geodesy · Computer science / Geometry processing. geojson_geometry → coordinate_pair_or_null
VEDIC
VOLTAGE (GG2050-VEDIC-000003): GridAtlas / Geodesy · Computer science / Data normalisation. voltage_properties → kilovolt_list
Uses
GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (estate URL), Declared Connections (estate URL)
Used by
named by URL in Code (estate URL), run by Proof (script call), run by Modular Star Workflow (workflow run), named by URL in Testcode — Code Record Page (estate URL)
Produces
f1586_invariant, f8767_representativePoint, f8768_voltagesKv, f8772_voltageOf, f8773_ratingsOf, f8775_parametersOf, f5168_escapeHTML, f8321_suppliedArrivalFields, f8850__anonymous_, f8786_crossing, f8788_legality, f8789_startNodes
Defines here
f1586_invariant, f8767_representativePoint, f8768_voltagesKv, f8772_voltageOf, f8773_ratingsOf, f8775_parametersOf, f5168_escapeHTML, f8321_suppliedArrivalFields, numberOrNull, textOrNull, f8850__anonymous_, f8786_crossing, f8788_legality, f8789_startNodes, f8791__anonymous_, f8774_physicalUnits, f8299_rowObject, f5167_deepFreeze, f5169_normalizeStatus, f5175_fmt, f5206__anonymous_, f5652_snapLines, snapCoordinate, f8955_escapeAttribute, f5799_evalFilter, f5800__anonymous_, f5802__anonymous_, f8281_escapeHtml, f8282_sqlString, f8283_normaliseCompact
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
stars@030ebc202d35959fecd162327892f671d1d9a0cc library/standalone.mjs:1-539 · blob fc3d8c8b93e14d4a56b8a26da47071d60bc5bc4d · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, network, storage · domain stage: unknown · users: none · canonical: unknown
// Compiled library of self-contained JavaScript functions that appear in two or more places across Ventusltd code.
// Generated by the modular star 2026-12-05T23:26:43.596Z. Each export is one family's earliest-seen copy, unchanged; the comment links its source.
// Candidates for reuse, not reviewed or tested: check the source before depending on one.

// Family #1586 · element #8276 · 551 places in 6 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L58-L60
export const f1586_invariant = function invariant(condition, message) {
    if (!condition) throw new Error(message);
  };

// Family #8767 · element #8767 · 264 places in 6 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1557-L1575
export const f8767_representativePoint = function representativePoint(geometry) {
    if (!geometry) return null;
    const { type, coordinates } = geometry;
    if (type === 'Point') {
      return Array.isArray(coordinates) && coordinates.length >= 2
        ? [coordinates[0], coordinates[1]] : null;
    }
    const ring = type === 'Polygon' ? coordinates && coordinates[0]
      : type === 'MultiPolygon' ? coordinates && coordinates[0] && coordinates[0][0]
        : null;
    if (!Array.isArray(ring) || !ring.length) return null;
    let sumLon = 0;
    let sumLat = 0;
    for (const point of ring) {
      sumLon += point[0];
      sumLat += point[1];
    }
    return [sumLon / ring.length, sumLat / ring.length];
  };

// Family #8768 · element #8768 · 264 places in 6 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1583-L1601
export const f8768_voltagesKv = function voltagesKv(properties) {
    if (!properties) return [];
    const out = [];
    const explicit = properties.kv ?? properties.KV;
    if (explicit != null && String(explicit).trim() !== '') {
      for (const token of String(explicit).match(/\d+(?:\.\d+)?/g) || []) {
        const value = Number(token);
        if (Number.isFinite(value) && value > 0) out.push(value);
      }
    }
    const volts = properties.voltage ?? properties.VOLTAGE;
    if (volts != null) {
      for (const token of String(volts).match(/\d+(?:\.\d+)?/g) || []) {
        const value = Number(token);
        if (Number.isFinite(value) && value > 0) out.push(value / 1000);
      }
    }
    return [...new Set(out)].sort((a, b) => b - a);
  };

// Family #8772 · element #8772 · 189 places in 6 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1723-L1727
export const f8772_voltageOf = function voltageOf(node) {
    if (!node) return null;
    if (node.voltage_consistent_with_site !== true) return null;
    return Number.isFinite(node.voltage_kv) ? node.voltage_kv : null;
  };

// Family #8773 · element #8773 · 189 places in 6 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1731-L1739
export const f8773_ratingsOf = function ratingsOf(row) {
    const seasons = { winter: row.winter_mva, spring: row.spring_mva,
      summer: row.summer_mva, autumn: row.autumn_mva };
    const published = {};
    for (const [season, value] of Object.entries(seasons)) {
      if (Number.isFinite(value)) published[season] = value;
    }
    return Object.keys(published).length ? published : null;
  };

// Family #8775 · element #8775 · 189 places in 6 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1790-L1797
export const f8775_parametersOf = function parametersOf(row) {
    const published = {};
    for (const [key, field] of [['r_pct', 'r_pct_100mva'], ['x_pct', 'x_pct_100mva'],
      ['b_pct', 'b_pct_100mva']]) {
      if (Number.isFinite(row[field])) published[key] = row[field];
    }
    return Object.keys(published).length ? published : null;
  };

// Family #5168 · element #5602 · 199 places in 5 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L18-L22
export const f5168_escapeHTML = function escapeHTML(value) {
        return String(value ?? '')
            .replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
            .replace(/"/g, '&quot;').replace(/'/g, '&#39;');
    };

// Family #8321 · element #8321 · 86 places in 5 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L615-L638
export const f8321_suppliedArrivalFields = function suppliedArrivalFields(params, repdRef) {
    const numberOrNull = (name) => {
      const raw = params.get(name);
      if (raw === null || String(raw).trim() === '') return null;
      const value = Number(raw);
      return Number.isFinite(value) ? value : null;
    };
    const textOrNull = (name) => {
      const value = String(params.get(name) || '').trim();
      return value || null;
    };
    return Object.freeze({
      repd_ref: repdRef,
      name: textOrNull('project'),
      technology: textOrNull('technology'),
      capacity_mw: numberOrNull('capacity_mw'),
      longitude: numberOrNull('longitude'),
      latitude: numberOrNull('latitude'),
      // Pipeline News 0144 does not send status. Retain it only when another
      // authorised producer explicitly supplies it; never present it as an
      // official active-register value.
      supplied_status: textOrNull('status')
    });
  };

// Family #8850 · element #8850 · 226 places in 5 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L4617-L4623
export const f8850__anonymous_ = function (menu) {
      menu.classList.remove('gm-open');
      var title = menu.querySelector('.gm-title');
      var panel = menu.querySelector('.gm-panel');
      if (title) title.setAttribute('aria-expanded', 'false');
      if (panel) panel.hidden = true;
    };

// Family #8786 · element #8786 · 183 places in 5 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L2104-L2113
export const f8786_crossing = function crossing(graph, nearNode, farNode) {
    const near = graph.nodeVoltageKv(nearNode);
    const far = graph.nodeVoltageKv(farNode);
    return {
      near_kv: near,
      far_kv: far,
      both_declared: near != null && far != null,
      changes: near != null && far != null && near !== far
    };
  };

// Family #8788 · element #8788 · 183 places in 5 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L2152-L2161
export const f8788_legality = function legality(kind, cross) {
    if (!cross.changes) return { legal: true, refusal: null };
    if (kind === 'transformer') return { legal: true, refusal: null };
    return {
      legal: false,
      refusal: 'a ' + kind + ' whose two ends carry different declared '
        + 'voltages (' + cross.near_kv + ' kV and ' + cross.far_kv + ' kV); '
        + 'only a transformer may change voltage, so this edge is not walked'
    };
  };

// Family #8789 · element #8789 · 183 places in 5 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L2163-L2167
export const f8789_startNodes = function startNodes(graph, site, voltageKv) {
    const nodes = graph.nodesOfSite(site.code);
    if (voltageKv == null) return nodes;
    return nodes.filter((name) => graph.nodeVoltageKv(name) === voltageKv);
  };

// Family #8791 · element #8791 · 183 places in 5 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L2374-L2377
export const f8791__anonymous_ = (acc, s) => {
          acc[s.hops] = (acc[s.hops] || 0) + 1;
          return acc;
        };

// Family #8774 · element #8774 · 175 places in 5 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1770-L1788
export const f8774_physicalUnits = function physicalUnits(records) {
    const pairs = new Map();
    for (const record of records) {
      const near = String(record.from_node);
      const far = String(record.to_node);
      const forward = near < far;
      const key = forward ? near + '\u0000' + far : far + '\u0000' + near;
      if (!pairs.has(key)) pairs.set(key, { forward: 0, reverse: 0 });
      const seen = pairs.get(key);
      if (forward) seen.forward += 1; else seen.reverse += 1;
    }
    let units = 0;
    for (const seen of pairs.values()) {
      units += (seen.forward && seen.reverse)
        ? Math.max(seen.forward, seen.reverse)
        : seen.forward + seen.reverse;
    }
    return units;
  };

// Family #8299 · element #8299 · 173 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L277-L279
export const f8299_rowObject = function rowObject(row) {
    return row && typeof row.toJSON === 'function' ? row.toJSON() : row;
  };

// Family #5167 · element #5601 · 209 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L11-L16
export const f5167_deepFreeze = function deepFreeze(obj) {
        Object.keys(obj).forEach(prop => {
            if (typeof obj[prop] === 'object' && obj[prop] !== null) deepFreeze(obj[prop]);
        });
        return Object.freeze(obj);
    };

// Family #5169 · element #5603 · 197 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L24-L26
export const f5169_normalizeStatus = function normalizeStatus(status) {
        return String(status ?? '').trim().toLowerCase();
    };

// Family #5175 · element #5604 · 197 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L28-L30
export const f5175_fmt = function fmt(n, decimals) {
        return n.toLocaleString('en-GB', { maximumFractionDigits: decimals, minimumFractionDigits: decimals });
    };

// Family #5206 · element #5664 · 197 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L874-L877
export const f5206__anonymous_ = f => {
            const p = f.properties; const [lon, lat] = f.geometry.coordinates;
            return [`"${(p.name||'').replace(/"/g, '""')}"`,`"${(p.tech||'').replace(/"/g, '""')}"`,`"${(p.raw_tech||'').replace(/"/g, '""')}"`,p.capacity,`"${(p.status||'').replace(/"/g, '""')}"`,`"${(p.operator||'').replace(/"/g, '""')}"`,`"${(p.mounting||'').replace(/"/g, '""')}"`,lon, lat].join(',');
        };

// Family #5652 · element #5768 · 194 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L682-L726
export const f5652_snapLines = function snapLines(features, subs) {
        if (!subs || !subs.length) return features;

        const TOLERANCE_DEG_SQ = 0.001 * 0.001; 
        const RAD = Math.PI / 180;

        const snapCoordinate = (coord) => {
            let best = coord, min = Infinity;
            const latCos = Math.cos(coord[1] * RAD);
            subs.forEach(s => {
                const sc = s.geometry && s.geometry.coordinates;
                if (!sc) return;
                const dx = (coord[0] - sc[0]) * latCos;
                const dy = (coord[1] - sc[1]);
                const d = dx * dx + dy * dy;
                if (d < min && d <= TOLERANCE_DEG_SQ) { min = d; best = sc; }
            });
            return best;
        };

        return features.map(f => {
            const geom = f.geometry;
            if (!geom || !geom.coordinates) return f;
            if (geom.type === 'LineString') {
                const c = [...geom.coordinates];
                if (c.length > 0) { 
                    c[0] = snapCoordinate(c[0]); 
                    c[c.length - 1] = snapCoordinate(c[c.length - 1]); 
                }
                return { ...f, geometry: { ...geom, coordinates: c } };
            }
            if (geom.type === 'MultiLineString') {
                const coords = geom.coordinates.map(line => {
                    const l = [...line];
                    if (l.length > 0) { 
                        l[0] = snapCoordinate(l[0]); 
                        l[l.length - 1] = snapCoordinate(l[l.length - 1]); 
                    }
                    return l;
                });
                return { ...f, geometry: { ...geom, coordinates: coords } };
            }
            return f;
        });
    };

// Family #8955 · element #8955 · 219 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/index.html#L23-L25
export const f8955_escapeAttribute = function escapeAttribute(value) {
      return String(value).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;');
    };

// Family #5799 · element #5799 · 190 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1225-L1232
export const f5799_evalFilter = function evalFilter(filter, props) {
                        if (!filter) return true;
                        const op = filter[0];
                        if (op === '==') { const v = filter[1][0] === 'get' ? props[filter[1][1]] : null; return String(v).toLowerCase() === String(filter[2]).toLowerCase(); }
                        if (op === 'all') { return filter.slice(1).every(f => evalFilter(f, props)); }
                        if (op === '>=') { const v = filter[1][0] === 'coalesce' ? (parseFloat(props[filter[1][1][1]]) || 0) : 0; return v >= filter[2]; }
                        return true;
                    };

// Family #5800 · element #5800 · 190 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1238-L1242
export const f5800__anonymous_ = (acc, f) => { 
                            acc.count++; 
                            acc.mw += parseFloat(f.properties.capacity) || 0; 
                            return acc; 
                        };

// Family #5802 · element #5802 · 190 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1247-L1251
export const f5802__anonymous_ = (acc, f) => { 
                        acc.count++; 
                        acc.mw += parseFloat(f.properties.emission_tco2e) || 0; 
                        return acc; 
                    };

// Family #8281 · element #8281 · 93 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L101-L105
export const f8281_escapeHtml = function escapeHtml(value) {
    return String(value ?? '')
      .replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
      .replace(/"/g, '&quot;').replace(/'/g, '&#39;');
  };

// Family #8282 · element #8282 · 93 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L107-L109
export const f8282_sqlString = function sqlString(value) {
    return `'${String(value).replaceAll("'", "''")}'`;
  };

// Family #8283 · element #8283 · 93 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L111-L113
export const f8283_normaliseCompact = function normaliseCompact(value) {
    return String(value ?? '').toUpperCase().replace(/[^A-Z0-9]/g, '');
  };

// Family #8284 · element #8284 · 93 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L115-L122
export const f8284_parseGroups = function parseGroups(query) {
    return String(query ?? '')
      .trim()
      .toLowerCase()
      .split(/\s+/)
      .map(group => group.split('/').map(term => term.replace(/[^a-z0-9]/g, '')).filter(Boolean))
      .filter(group => group.length);
  };

// Family #8300 · element #8300 · 93 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L298-L311
export const f8300__anonymous_ = row => ({
      repd_ref: String(row.repd_ref ?? ''),
      name: String(row.name ?? ''),
      address: String(row.repd_address_display ?? ''),
      postcode: String(row.repd_postcode ?? ''),
      county: String(row.county ?? ''),
      planning_authority: String(row.planning_authority ?? ''),
      technology: String(row.technology ?? ''),
      status: String(row.status ?? ''),
      capacity_mw: row.capacity_mw == null ? null : Number(row.capacity_mw),
      longitude: row.longitude == null ? null : Number(row.longitude),
      latitude: row.latitude == null ? null : Number(row.latitude),
      score: Number(row.search_score || 0)
    });

// Family #8306 · element #8306 · 88 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L389-L391
export const f8306_joinParts = function joinParts(...parts) {
    return parts.filter(Boolean).join(' · ');
  };

// Family #8311 · element #8311 · 86 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609041945-place-global-search-v9-5.js#L496-L502
export const f8311_dedupeGlobalLocations = function dedupeGlobalLocations(ukResults, globalResults) {
    return globalResults.filter(globalResult => !ukResults.some(ukResult => {
      const sameLabel = String(globalResult.label).trim().toLowerCase() === String(ukResult.label).trim().toLowerCase();
      const close = Math.abs(globalResult.longitude - ukResult.longitude) < 0.03 && Math.abs(globalResult.latitude - ukResult.latitude) < 0.03;
      return sameLabel && close;
    }));
  };

// Family #8466 · element #8466 · 137 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L3215-L3227
export const f8466_deepLinkPlan = function deepLinkPlan(rawLon, rawLat, rawRepdRef) {
    const longitude = rawLon === null ? NaN : Number(rawLon);
    const latitude = rawLat === null ? NaN : Number(rawLat);
    const repdRef = String(rawRepdRef || '').trim();
    const coordinatesUsable = Number.isFinite(longitude) && Number.isFinite(latitude)
      && Math.abs(longitude) <= 180 && Math.abs(latitude) <= 90
      && !(Math.abs(longitude) < 1e-9 && Math.abs(latitude) < 1e-9);
    return Object.freeze({
      longitude, latitude, repd_ref: repdRef, coordinates_usable: coordinatesUsable,
      route: coordinatesUsable ? 'MEASURE_LINK_FIRST'
        : (repdRef ? 'WAIT_FOR_REGISTER' : 'NO_USABLE_POINT')
    });
  };

// Family #8841 · element #8841 · 243 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L4285-L4287
export const f8841_cleanText = function cleanText(value) {
    return String(value == null ? '' : value).replace(/\s+/g, ' ').trim();
  };

// Family #8840 · element #8840 · 225 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L4281-L4283
export const f8840_array = function array(value) {
    return Array.prototype.slice.call(value || []);
  };

// Family #8842 · element #8842 · 225 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L4289-L4295
export const f8842_layerKey = function layerKey(input) {
    if (!input || !input.getAttribute) return '';
    var engine = input.getAttribute('data-layer-id');
    if (engine) return 'engine:' + engine;
    var pipeline = input.getAttribute('data-pn-layer');
    return pipeline ? 'pipeline:' + pipeline : '';
  };

// Family #8861 · element #8861 · 209 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L4855-L4858
export const f8861__anonymous_ = function (response) {
      if (!response.ok) throw new Error('HTTP ' + response.status);
      return response.json();
    };

// Family #8872 · element #8872 · 205 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L5027-L5030
export const f8872_exportStamp = function exportStamp() {
    var now = new Date();
    return now.toISOString().replace('T', ' ').slice(0, 16) + ' UTC';
  };

// Family #8584 · element #8584 · 131 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L5837-L5840
export const f8584__anonymous_ = (owner) => ({
              resolved: owner?.status === 'RESOLVED' ? owner : null,
              terminal: owner?.status || 'UNKNOWN'
            });

// Family #1 · element #1 · 41 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051905/layer-apps/solar-bess-topology-v7/cable-geometry-visualiser/calculations.js#L3-L7
export const f1_clampInteger = function clampInteger(value, fallback, minValue) {
        const num = Number(value);
        if (!Number.isFinite(num)) return fallback;
        return Math.max(Math.round(num), minValue);
    };

// Family #8380 · element #8380 · 175 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609050354-sld-sandbox-v9-8.js#L951-L954
export const f8380_financeNumber = value => {
    const number = Number(value);
    return Number.isFinite(number) ? number : 0;
  };

// Family #8738 · element #8738 · 153 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1126-L1132
export const f8738_transitExpressionValue = function transitExpressionValue(expression, feature) {
        if (!Array.isArray(expression)) return expression;
        if (expression[0] === 'get') return feature && feature.properties
            ? feature.properties[expression[1]] : undefined;
        if (expression[0] === 'literal') return expression[1];
        return undefined;
    };

// Family #8740 · element #8740 · 153 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L1153-L1158
export const f8740_geometryFitsMapLayer = function geometryFitsMapLayer(layerType, geometryType) {
        if (layerType === 'circle' || layerType === 'heatmap') return geometryType === 'Point' || geometryType === 'MultiPoint';
        if (layerType === 'line') return geometryType === 'LineString' || geometryType === 'MultiLineString';
        if (layerType === 'fill' || layerType === 'fill-extrusion') return geometryType === 'Polygon' || geometryType === 'MultiPolygon';
        return true;
    };

// Family #2 · element #2 · 40 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051905/layer-apps/solar-bess-topology-v7/cable-geometry-visualiser/calculations.js#L11-L15
export const f2_effectiveGap = function effectiveGap(basis, spacing, od) {
        if (basis === "touching")         return 0;
        if (basis === "centre_to_centre") return Math.max(spacing - od, 0);
        return spacing;
    };

// Family #8 · element #8 · 40 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051905/layer-apps/solar-bess-topology-v7/cable-geometry-visualiser/calculations.js#L69-L83
export const f8_getGroupGeometry = function getGroupGeometry(inputs) {
        const d = inputs.cable_od_mm;
        const sqrt3 = Math.sqrt(3);
        switch (inputs.formation_type) {
            case "trefoil_single_row": return { width: d*2, depth: d*(1+sqrt3/2), drawType: "trefoil",     note: "Trefoil 1c groups" };
            case "flat_single_row":    return { width: d*3, depth: d,             drawType: "flat_3",      note: "Flat 1c groups" };
            case "stacked_two_high":   return { width: d*3, depth: d*2,           drawType: "stacked_2x3", note: "Stacked 2 high 1c groups" };
            case "multicore_3c":       return { width: d,   depth: d,             drawType: "multicore_3c",note: "Three core cable groups" };
            case "multicore_4c":       return { width: d,   depth: d,             drawType: "multicore_4c",note: "Four core cable groups" };
            case "multicore_5c":       return { width: d,   depth: d,             drawType: "multicore_5c",note: "Five core cable groups" };
            case "dc_pair_horizontal": return { width: d*2, depth: d,             drawType: "dc_pair_h",   note: "DC horizontal pair" };
            case "dc_pair_vertical":   return { width: d,   depth: d*2,           drawType: "dc_pair_v",   note: "DC vertical pair" };
            default:                   return { width: d*2, depth: d*(1+sqrt3/2), drawType: "trefoil",     note: "Trefoil 1c groups" };
        }
    };

// Family #17 · element #17 · 40 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051905/layer-apps/solar-bess-topology-v7/cable-geometry-visualiser/rendering.js#L41-L46
export const f17_getServiceColours = function getServiceColours(serviceType) {
        if (serviceType === "mv")  return { fill: "#b87333", stroke: "#ff5555" };
        if (serviceType === "ehv") return { fill: "#ffd700", stroke: "#ff8800" };
        if (serviceType === "lv")  return { fill: "#666",    stroke: "#00ffff" };
        return { fill: "#777", stroke: "#ff00ff" };
    };

// Family #8800 · element #8800 · 180 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L2767-L2791
export const f8800_makeUnionFind = function makeUnionFind() {
    const parent = new Map();
    function find(x) {
      if (!parent.has(x)) { parent.set(x, x); return x; }
      let root = x;
      while (parent.get(root) !== root) root = parent.get(root);
      let cursor = x;
      while (parent.get(cursor) !== cursor) {
        const next = parent.get(cursor);
        parent.set(cursor, root);
        cursor = next;
      }
      return root;
    }
    return {
      find,
      union(a, b) {
        const ra = find(a);
        const rb = find(b);
        if (ra === rb) return false;
        parent.set(ra, rb);
        return true;
      }
    };
  };

// Family #8802 · element #8802 · 180 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L2896-L2911
export const f8802_multiply = function multiply(model, x, slackIndex) {
    const y = new Float64Array(x.length);
    for (const e of model.edges) {
      if (e.i === slackIndex || e.j === slackIndex) {
        /* the slack angle is pinned at zero, so its column contributes
           nothing and its row is not solved */
        if (e.i !== slackIndex) y[e.i] += e.b * x[e.i];
        if (e.j !== slackIndex) y[e.j] += e.b * x[e.j];
        continue;
      }
      const d = x[e.i] - x[e.j];
      y[e.i] += e.b * d;
      y[e.j] -= e.b * d;
    }
    return y;
  };

// Family #8809 · element #8809 · 177 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L3290-L3293
export const f8809_yearRank = function yearRank(year) {
    const n = Number(year);
    return Number.isFinite(n) ? n : Number.POSITIVE_INFINITY;
  };

// Family #8810 · element #8810 · 177 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L3300-L3308
export const f8810_publishedToday = function publishedToday(graph, nearNode, farNode) {
    const today = { circuit: false, transformer: false };
    for (const entry of graph.edgesAt(nearNode)) {
      if (entry.row[entry.far] !== farNode) continue;
      if (entry.kind === 'circuit') today.circuit = true;
      if (entry.kind === 'transformer') today.transformer = true;
    }
    return today;
  };

// Family #8913 · element #8913 · 176 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L5912-L5925
export const f8913__anonymous_ = (feature) => {
        const properties = feature.properties || {};
        const coordinates = (feature.geometry || {}).coordinates || [];
        return {
          name: properties.name || '',
          operator: properties.operator || '',
          tech: properties.tech || 'other',
          raw: properties.raw_tech || '',
          status: properties.status || '',
          mw: Number(properties.capacity) || 0,
          lon: Number(coordinates[0]),
          lat: Number(coordinates[1])
        };
      };

// Family #8924 · element #8924 · 176 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L6089-L6091
export const f8924__anonymous_ = (character) => ({
        '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;'
      }[character]);

// Family #8925 · element #8925 · 176 places in 4 repositories · https://github.com/Ventusltd/testcode/blob/a8a215982b13d6e2f6019b40bf0bef5755719773/sandbox/202609051152/atlas/cartridges/202609051152-substation-intelligence.js#L6087-L6092