{#
 SPDX-FileCopyrightText: (c) 2020 Pradyun Gedam <mail@pradyunsg.me>
 SPDX-License-Identifier: MIT
 #}
{% extends "base.html" %}

{% block body -%}
{% include "partials/icons.html" %}

<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
<label class="overlay sidebar-overlay" for="__navigation"></label>
<label class="overlay toc-overlay" for="__toc"></label>

{% if theme_announcement -%}
<div class="announcement">
  <aside class="announcement-content">
    {% block announcement %} {{ theme_announcement }} {% endblock announcement %}
  </aside>
</div>
{%- endif %}

<div class="page">
  <header class="mobile-header">
    <div class="header-left">
      <label class="nav-overlay-icon" for="__navigation">
        <i class="icon"><svg><use href="#svg-menu"></use></svg></i>
      </label>
    </div>
    <div class="header-center">
      <a href="{{ pathto(master_doc) }}"><div class="brand">{{ docstitle }}</div></a>
    </div>
    <div class="header-right">
      <label class="toc-overlay-icon toc-header-icon{% if furo_hide_toc %} no-toc{% endif %}" for="__toc">
        <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
      </label>
    </div>
  </header>
  <aside class="sidebar-drawer">
    <div class="sidebar-container">
      {% block left_sidebar %}
      <div class="sidebar-sticky">
        {%- for sidebar_section in sidebars %}
          {%- include sidebar_section %}
        {%- endfor %}
      </div>
      {% endblock left_sidebar %}
    </div>
  </aside>
  <main class="main">
    <div class="content">
      <article role="main">
        <label class="toc-overlay-icon toc-content-icon{% if furo_hide_toc %} no-toc{% endif %}" for="__toc">
          <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
        </label>
        {% block content %}{{ body }}{% endblock %}
      </article>
      <footer>
        {% block footer %}
        <div class="related-pages">
          {% if next -%}
            <a class="next-page" href="{{ next.link }}">
              <div class="page-info">
                <div class="context">
                  <span>{{ _("Next") }}</span>
                </div>
                <div class="title">{{ next.title }}</div>
              </div>
              <svg><use href="#svg-arrow-right"></use></svg>
            </a>
          {%- endif %}
          {% if prev -%}
            <a class="prev-page" href="{{ prev.link }}">
              <svg><use href="#svg-arrow-right"></use></svg>
              <div class="page-info">
                <div class="context">
                  <span>{{ _("Previous") }}</span>
                </div>
                {% if prev.link == pathto(master_doc) %}
                <div class="title">{{ _("Home") }}</div>
                {% else %}
                <div class="title">{{ prev.title }}</div>
                {% endif %}
              </div>
            </a>
          {%- endif %}
        </div>

        <div class="related-information" style="text-align: center;">
          {%- if show_copyright %}
            {%- if hasdoc('copyright') %}
              {% trans path=pathto('copyright'), copyright=copyright|e -%}
                <a href="{{ path }}">Copyright</a> &#169; {{ copyright }}.
              {%- endtrans %}
            {%- else %}
              {% trans copyright=copyright|e -%}
                Copyright &#169; {{ copyright }}
              {%- endtrans %}
            {%- endif %}
          {%- endif %}
          {%- if last_updated %}
            |
            {% trans last_updated=last_updated|e -%}
              Last updated on {{ last_updated }}.
            {%- endtrans %}
          {%- endif %}
          {%- if show_sphinx %}
            <br>
            {% trans -%}
              Built with <a href="https://www.sphinx-doc.org/">Sphinx</a>
              and
              <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s
              <a href="https://github.com/pradyunsg/furo">Furo theme</a>.
            {%- endtrans %}
          {%- endif %}
          {%- if show_source and has_source and sourcename %}
            |
            <a class="muted-link" href="{{ pathto('_sources/' + sourcename, true)|e }}"
               rel="nofollow">
              {{ _('Show Source') }}
            </a>
          {%- endif %}

          {%- if show_languages %}
            <p style="text-align: center;">
            {% for code, text in languages %}
              <a href="{{ pathto('../' + code,1) }}/{{ pagename }}.html">{{ text }}</a>&nbsp;
            {% endfor %}
          {%- endif %}
          </p>
        </div>
        {% endblock footer %}
      </footer>
    </div>
    <aside class="toc-drawer{% if furo_hide_toc %} no-toc{% endif %}">
      {% block right_sidebar %}
      {% if not furo_hide_toc %}
      <div class="toc-sticky toc-scroll">
        <div class="toc-title-container">
          <span class="toc-title">
            {{ _("Contents") }}
          </span>
        </div>
        <div class="toc-tree-container">
          <div class="toc-tree">
            {{ toc }}
          </div>
        </div>
      </div>
      {% endif %}
      {% endblock right_sidebar %}
    </aside>
  </main>
</div>
{%- endblock %}
