<!DOCTYPE html>
<html>
<head>
    {% for analytic in analytics %}
        {% if analytic.provider == 'GoogleTagManager' and analytic.options.uid %}
            <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','{{ analytic.options.dataVariable|default('dataLayer') }}','{{ analytic.options.uid }}');</script>
        {% endif %}
    {% endfor %}

    {{ renderHook('head.top') }}
    {% block head %}{% endblock %}
    {% block css %}{% endblock %}
    {% block custom_css %}{% endblock %}
    {% block js %}{% endblock %}
    {% block before_custom_js %}{% endblock %}
    {% block custom_js %}{% endblock %}
    {% block after_custom_js %}{% endblock %}
    {{ renderHook('head.bottom') }}
</head>
<body class="{% if user %}app{% else %}guest-app{% endif %}">
    {% for analytic in analytics %}
        {% if analytic.provider == 'GoogleTagManager' and analytic.options.uid %}
            <noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ analytic.options.uid }}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
        {% endif %}
    {% endfor %}

    {{ renderHook('body.top') }}
    {% block content %}{% endblock %}

    {# @TODO : activate
    <script type="text/javascript" data-cfasync="false">
        angular.module('application.config.value', ['ng']).constant('application.config.value', {{ config|json_encode()|raw }} );
    </script>';
    #}

    <script type="text/javascript" data-cfasync="false">
        angular.element(window).one('load', function() {
            angular.bootstrap(angular.element('html'), ['{% if user %}application{% else %}guest{% endif %}']);
        });
    </script>
    {{ renderHook('body.bottom') }}
</body>
</html>