{% load static %}
{{ MORPHER|json_script:"unicorn:settings:morpher" }}
{% if MINIFIED %}
    <script src="{% static 'unicorn/js/unicorn.min.js' %}"></script>
    {# <script src="../static/unicorn/js/unicorn.min.js"></script> #}
    <script>
        const url = "{% url 'unicorn:message' %}";
        const morpherSettings = JSON.parse(document.getElementById("unicorn:settings:morpher").textContent);
        
        Unicorn.init(url, "{{ CSRF_HEADER_NAME }}", "{{ CSRF_COOKIE_NAME }}", morpherSettings);
    </script>
{% else %}
    <script type="module">
        import * as Unicorn from "{% static 'unicorn/js/unicorn.js' %}";
        import { getMorpher } from "{% static 'unicorn/js/morpher.js' %}";
          
        // Set Unicorn to the global, so it can be used by components
        window.Unicorn = Unicorn;
          
        const url = "{% url 'unicorn:message' %}";
        const morpherSettings = JSON.parse(document.getElementById("unicorn:settings:morpher").textContent);
          
        Unicorn.init(url, "{{ CSRF_HEADER_NAME }}", "{{ CSRF_COOKIE_NAME }}", morpherSettings);
    </script>
{% endif %}
