{%- extends "basic/layout.html" %}
{%- import "static/webpack-macros.html" as _webpack with context %}

{# prev/next buttons #}
{% macro prev_next(prev, next, prev_title='', next_title='') %}
 {%- if prev %}
    <a class='left-prev' id="prev-link" href="{{ prev.link|e }}" title="{{ _('previous page')}}">{{ prev_title or prev.title }}</a>
 {%- endif %}
 {%- if next %}
    <a class='right-next' id="next-link" href="{{ next.link|e }}" title="{{ _('next page')}}">{{ next_title or next.title }}</a>
 {%- endif %}
{% endmacro %}

{%- block css %}
    {{ _webpack.head_pre_bootstrap() }}
    {{ _webpack.head_pre_icons() }}
    {% block fonts %}
      {{ _webpack.head_pre_fonts() }}
    {% endblock %}
    {{- css() }}
    {{ _webpack.head_js_preload() }}
{%- endblock %}

{%- block extrahead %}
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="docsearch:language" content="en" />
{%- endblock %}

{# Silence the sidebar's, relbar's #}
{% block header %}{% endblock %}
{% block relbar1 %}{% endblock %}
{% block relbar2 %}{% endblock %}
{% block sidebarsourcelink %}{% endblock %}

{% block body_tag %}
  <body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80">
{%- endblock %}
{%- block content %}
    {% block docs_navbar %}
    <nav class="navbar navbar-light navbar-expand-lg bg-light fixed-top bd-navbar" id="navbar-main">
      {%- include "docs-navbar.html" %}
    </nav>
    {% endblock %}

    <div class="container-xl">
      <div class="row">
          {% block docs_sidebar %}
            {% if sidebars %}
            <!-- Only show if we have sidebars configured, else just a small margin  -->
            <div class="col-12 col-md-3 bd-sidebar">
                {%- for sidebartemplate in sidebars %}
                {%- include sidebartemplate %}
                {%- endfor %}
            </div>
            {% else %}
            <div class="col-12 col-md-1 col-xl-2 bd-sidebar no-sidebar"></div>
            {% endif %}
          {% endblock %}

          {% block docs_toc %}
          <div class="d-none d-xl-block col-xl-2 bd-toc">
              {% if not (meta is not none and 'notoc' in meta) %}
                {%- include "docs-toc.html" %}
              {% endif %}
          </div>
          {% endblock %}

          {% block docs_main %}
          {% if sidebars %}
            {% set content_col_class = "col-md-9 col-xl-7" %}
          {% else %}
            {% set content_col_class = "col-md-11 col-xl-8" %}
          {% endif %}
          <main class="col-12 {{ content_col_class }} py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
              {% block docs_body %}
              <div>
                {% block body %} {% endblock %}
              </div>
              {% endblock %}
              {% if theme_show_prev_next %}
              <div class='prev-next-bottom'>
                {{ prev_next(prev, next) }}
              </div>
              {% endif %}
          </main>
          {% endblock %}

      </div>
    </div>

    {{ _webpack.body_post() }}

    {% if theme_google_analytics_id %}
    <!-- Google Analytics -->
    <script>
      window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
      ga('create', '{{ theme_google_analytics_id }}', 'auto');
      ga('set', 'anonymizeIp', true);
      ga('send', 'pageview');
    </script>
    <script async src='https://www.google-analytics.com/analytics.js'></script>
    <!-- End Google Analytics -->
    {% endif %}

{%- endblock %}

{%- block footer %}
{%- include "footer.html" %}
{%- endblock %}
