{% load static %}
{% with MAP_TYPE="openlayers" %}
{% if MAP_TYPE == "openlayers" %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.4/ol.css" />

{% else %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.css" />
{% endif %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="shortcut icon" type="image/png" href="https://cdn.jslibs.mapstore2.geo-solutions.it/leaflet/favicon.ico" />
{% if MAP_TYPE == "openlayers" %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.4/ol.js"></script>
{% else %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.2/leaflet.draw.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/esri-leaflet/2.2.3/esri-leaflet.js"></script>
{% endif %}

{%  if MAP_DEBUG %}
<script id="ms2-api" src="http://localhost:8081/dist/ms2-geonode-api.js"></script>
{% else %}
<script id="ms2-api" src="{{ STATIC_URL }}mapstore/dist/ms2-geonode-api.js"></script>
{% endif %}

<!-- script to generate Thumbnails from MapStore -->
<script type="text/javascript" src="{{ STATIC_URL}}geonode/js/ms2/utils/thumbnail.js"></script>

{% block plugins %}
<!-- load plugins config-->
{% endblock %}


<style>
    ._ms2_init_center {
            position: fixed;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            overflow: show;
            margin: auto;
            display: flex;
            align-items: center;
    }
    ._ms2_init_spinner {
        height: 176px;
        width: 176px;
    }
    ._ms2_init_spinner > div,
    ._ms2_init_spinner > div:after {
        border-radius: 50%;
        width: 176px;
        height: 176px;
    }
    ._ms2_init_spinner > div {
        box-sizing: border-box;
        text-indent: -9999em;
        border: 16px solid rgba(119,119,119, 0.2);
        border-left: 16px solid #777777;
        -webkit-transform: translateZ(0);
        -ms-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-animation: _ms2_init_anim 1.1s infinite linear;
        animation: _ms2_init_anim 1.1s infinite linear;
    }
    @-webkit-keyframes _ms2_init_anim {
        0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
        }
        100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
        }
    }
    @keyframes _ms2_init_anim {
        0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
        }
        100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
        }
    }
    ._ms2_init_text {
        -webkit-animation: _ms2_init_text_anim 2s linear 0s infinite normal;
        animation: _ms2_init_text_anim 2s linear 0s infinite normal;
        color: #6F6F6f;
        font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
        font-size: 20px;
        font-weight: bold;
        height: 0.75em;
        width:  6em;
        text-align: center;
        margin: auto;
        z-index: 1000;
    }
    @keyframes _ms2_init_text_anim {
        0%  {opacity: 0}
        20% {opacity: 0}
        50% {opacity: 1}
        70% {opacity: .75}
        100%{opacity: 0}
    }    
</style>
{% block style %}{% endblock %}

{% autoescape off %}
<script type="text/javascript">
    const maptype = "{{ MAP_TYPE }}";
    localStorage.setItem("showPopoverSync", false);
    const accessToken = "{{ ACCESS_TOKEN }}";
    const user = {{ USER|default:"false" }};
</script>

{% endautoescape %}
{% endwith %}
{% block app_config %}{% endblock %}

{% block map_content %}
{% endblock %}