"""Selected map engine for newly generated HTML pages.""" from __future__ import annotations import logging from typing import Literal logger = logging.getLogger(__name__) HtmlMapEngine = Literal["echarts", "leaflet"] def html_map_engine() -> HtmlMapEngine: """Return the admin-selected HTML map engine, defaulting to ECharts.""" try: from deerflow.config.system_settings import load_system_settings engine = load_system_settings().html_map.engine except Exception: logger.debug("Failed to read the HTML map engine; using ECharts", exc_info=True) return "echarts" if engine == "leaflet": return "leaflet" return "echarts"