"""Layer rail hides Vessels and FIRMS only when /api/stats says the key is unset.""" from __future__ import annotations import json import subprocess from pathlib import Path ROOT = Path(__file__).resolve().parent.parent HTML = (ROOT / "app/static/index.html").read_text() def _between(start: str, end: str) -> str: return HTML.split(start, 1)[1].split(end, 1)[0] def _feed_fns() -> str: return _between("function applyFeedConfig", "async function pollLayerStats") def _layer_chunk(elem_id: str) -> str: idx = HTML.index(f'id="{elem_id}"') start = HTML.rfind('