{# Shared bits of markup. Nothing here is ever marked |safe: every value on a
console page is agent-authored or storage-derived and stays escaped. #}
{% macro ts(value) -%}
{%- endmacro %}
{% macro badge(value, extra="") -%}
{% if value %}{{ value }}{% else %}—{% endif %}
{%- endmacro %}
{# A record id: short in the page, full in the tooltip, selectable in one click. #}
{% macro rid(value) -%}
{% if value %}{{ value | short_id }}{% else %}—{% endif %}
{%- endmacro %}
{% macro msg_link(value) -%}
{% if value %}{{ value | short_id }}{% else %}—{% endif %}
{%- endmacro %}
{% macro agent_link(agent_id, handle) -%}
{% if agent_id %}
{{ ("@" ~ handle) if handle else (agent_id | short_id) }}
{% else %}—{% endif %}
{%- endmacro %}
{% macro thread_link(key) -%}
{% if key %}{{ key | short_id }}{% else %}—{% endif %}
{%- endmacro %}
{# Delivery mix for one message, e.g. "3 pending · 1 acked". #}
{% macro delivery_mix(counts) -%}
{% if counts %}
{% for state, n in counts.items() %}{{ n }} {{ state }} {% endfor %}
{% else %}none{% endif %}
{%- endmacro %}
{# `request` is passed in: an imported macro does not inherit the caller's
template context, so a macro that needs it must say so. #}
{% macro pager(request, next_cursor) -%}