<noscript>
  <style>
  .js-only {display: none;}
  </style>
</noscript>

<div id="alerts">
{#- Dedupe identical (message, level) pairs queued during this session.
    Redirect loops (e.g. the crypto-payment status poll flashing
    "Payment received! Waiting for confirmations..." on every refresh)
    could pile up dozens of copies of the same alert. Pop everything off
    the queue once, then render each unique pair only the first time
    it's seen. -#}
{%- set _queued = request.session.pop_flash() -%}
{%- set _seen = namespace(items=[]) -%}
{%- for message, level in _queued %}
{%- if (message, level) not in _seen.items %}
{%- if _seen.items.append((message, level)) %}{% endif %}
<div class="alert alert-{{level}}" onclick="this.style.display='none'" name="alert">
    <p class="alert-message">{{message|safe}}</p>
    <label class="close js-only" alt="dismiss" title="Mark as read">X</label>
</div>
{%- endif -%}
{%- endfor %}
</div>
