{# One CDI entry — recurses into groups, renders a form row for a leaf.
Called with `entry` (a projected group/field dict) and inherits
`alias` from the enclosing scope. #}
{% if entry.kind == 'group' %}
{{ entry.name or 'Group' }}
{% if entry.replication and entry.replication > 1 %}
× {{ entry.replication }}
{% endif %}
{% if entry.description %}
{{ entry.description }}
{% endif %}
{% for child in entry.children %}
{% with entry = child %}{% include "_openlcb_cdi_entry.html" %}{% endwith %}
{% endfor %}
{% elif entry.kind == 'field' %}
{# Per-field row: label + input + Read/Save. htmx swaps only the
status cell so a change to one field doesn't rerender the page. #}
{% set cell_id = 'cdi-status-' ~ alias ~ '-' ~ entry.space ~ '-' ~ entry.offset ~ '-' ~ (entry.bit or 0) %}