{% load static %}
{% if show_releases_section %}
{% if distribution_installable %}
<section class="sub-downloads fade-in" aria-labelledby="sub-dl-heading">
  <div class="sub-downloads-header">
    <h2 class="sub-downloads-title" id="sub-dl-heading">
      <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
        <path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/>
      </svg>
      Downloads
    </h2>
    {% if downloads_section_link %}
    <a href="{{ downloads_section_link.url }}" class="sub-downloads-corner-link link-arrow" target="_blank" rel="noopener noreferrer">{{ downloads_section_link.text }}</a>
    {% endif %}
  </div>

  {% if featured_version %}
  {% include "products/_installable_download_channel.html" with channel=featured_channel %}
  {% endif %}

  {% for channel in inline_download_channels %}
  {% include "products/_installable_download_channel.html" %}
  {% endfor %}

  {% if show_older_versions_link %}
  <p class="sub-older-versions-inner">
    <a href="{{ versions_archive_url }}" class="link-arrow">Older releases</a>
  </p>
  {% endif %}
</section>

{% elif distribution_package %}
<section class="sub-downloads sub-downloads--package fade-in" aria-labelledby="sub-resources-heading">
  <div class="sub-downloads-header">
    <h2 class="sub-downloads-title" id="sub-resources-heading">
      <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
        <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
        <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
      </svg>
      Resources
    </h2>
    {% if downloads_section_link %}
    <a href="{{ downloads_section_link.url }}" class="sub-downloads-corner-link link-arrow" target="_blank" rel="noopener noreferrer">{{ downloads_section_link.text }}</a>
    {% endif %}
  </div>
  <ul class="pkg-version-list" role="list">
    {% for ver in package_versions %}
    <li class="pkg-version-row">
      <div class="pkg-version-meta">
        <span class="download-version">{{ ver.version }}</span>
        {% include "products/_release_channel_badge.html" with version=ver %}
      </div>
      <div class="pkg-version-actions">
        {% if ver.package_resource_url %}
        <a href="{{ ver.package_resource_url }}" class="btn-primary btn--sm" target="_blank" rel="noopener noreferrer">{{ package_resource_button_text }}</a>
        {% endif %}
        {% if ver.resolved_source_code_url %}
        <a href="{{ ver.resolved_source_code_url }}" class="btn-ghost btn--sm"{% if ver.source_code_url %} target="_blank" rel="noopener noreferrer"{% endif %}>{{ package_source_button_text }}</a>
        {% endif %}
      </div>
      {% if ver.release_notes %}
      <p class="pkg-version-notes">{{ ver.release_notes }}</p>
      {% endif %}
    </li>
    {% endfor %}
  </ul>
</section>
{% endif %}
{% endif %}
