from __future__ import annotations from collections.abc import Mapping from datetime import datetime from .components import _event_label from .html_utils import attr, escape def _account_row(account: Mapping[str, object], csrf: str = "", admin_path: str = "/admin") -> str: raw_hostname = str(account["hostname"]) hostname = escape(raw_hostname) hostname_attr = attr(raw_hostname) status = "Active" if account.get("accepted_at") else "Pending" ipv4_raw = str(account.get("ipv4") or "-") ipv6_raw = str(account.get("ipv6") or "-") updated_raw = str(account.get("updated_at") or "Never") ipv4 = escape(ipv4_raw) ipv6 = escape(ipv6_raw) updated = escape(_short_time(updated_raw, "Never")) safe_admin_path = attr(admin_path) return f"""