<!doctype html>
{% load wagtailadmin_tags i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% get_current_language_bidi as LANGUAGE_BIDI %}
<html lang="{{ LANGUAGE_CODE }}" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}">
    <head>
        <meta charset="utf-8" />
        <title>{% block titletag %}{% endblock %} - {% block branding_title %}Wagtail{% endblock %}</title>
        <meta name="description" content="" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta name="robots" content="noindex" />

        {% block css %}{% endblock %}

        {% block branding_favicon %}{% endblock %}
    </head>
    {% sidebar_collapsed as sidebar_collapsed %}
    <body id="wagtail" class="{% block bodyclass %}{% endblock %} {% if sidebar_collapsed %}sidebar-collapsed{% endif %} {% if messages %}has-messages{% endif %}">
        <div data-sprite></div>
        <script>
            function loadIconSprite() {
                var spriteURL = '{% url "wagtailadmin_sprite" %}';
                var revisionKey = 'wagtail:spriteRevision';
                var dataKey = 'wagtail:spriteData';
                var isLocalStorage = 'localStorage' in window && typeof window.localStorage !== 'undefined';

                var insertIt = function (data) {
                    var spriteContainer = document.body.querySelector('[data-sprite]');
                    spriteContainer.innerHTML = data;
                }

                var insert = function (data) {
                    if (document.body) {
                        insertIt(data)
                    } else {
                        document.addEventListener('DOMContentLoaded', insertIt.bind(null, data));
                    }
                }

                if (isLocalStorage && localStorage.getItem(revisionKey) === spriteURL) {
                    var data = localStorage.getItem(dataKey);
                    if (data) {
                        insert(data);
                        return true;
                    }
                }

                try {
                    var request = new XMLHttpRequest();
                    request.open('GET', spriteURL, true);
                    request.onload = function () {
                        if (request.status >= 200 && request.status < 400) {
                            data = request.responseText;
                            insert(data);
                            if (isLocalStorage) {
                                localStorage.setItem(dataKey, data);
                                localStorage.setItem(revisionKey, spriteURL);
                            }
                        }
                    }
                    request.send();
                } catch (e) {
                    console.error(e);
                }
            }
            loadIconSprite();
        </script>

        <noscript class="capabilitymessage">
            {% blocktrans trimmed %}
                JavaScript is required to use Wagtail, but it is currently disabled.<br />
                Here are the <a href="https://www.enable-javascript.com/" target="_blank" rel="noreferrer">instructions how to enable JavaScript in your web browser</a>.
            {% endblocktrans %}
        </noscript>

        {% block js %}{% endblock %}

        <a class="skiplink button" href="#main" data-skiplink>{% trans 'Skip to main content' %}</a>

        <div class="wrapper">
            {% block furniture %}{% endblock %}
        </div>
    </body>
</html>
