{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!

    @template theme_universe/navbar

    This template renders the top navbar.

    Example context (json):
    {
        "output": {
            "should_display_navbar_logo": true,
            "get_compact_logo_url": "http://placekitten.com/50/50",
            "custom_menu": "<li>..</li>",
            "page_heading_menu": "<li>..</li>",
            "search_box": "<div><input type='text'></div>",
            "navbar_plugin_output": "<div class='dropdown'>Messaging</div>",
            "user_menu": "<div class='dropdown'>John Doe</div>"
        },
        "config": {
            "wwwroot": "#",
            "homeurl": "/my/"
        },
        "sitename": "Moodle Site",
        "mobileprimarynav": [
            {
                "text": "Dashboard",
                "url": "/my",
                "isactive": true
            },
            {
                "text": "Site home",
                "url": "/",
                "isactive": false
            },
            {
                "text": "My courses",
                "url": "/course",
                "isactive": false
            }
        ]
    }
}}
<nav id="topBar" class="rui-topbar-wrapper moodle-has-zindex">

    <div class="rui-mobile-nav">
        {{#topbarlogoareaon}}
            <a id="logo" href="{{{ config.wwwroot }}}" class="d-inline-flex aabtn {{# output.should_display_navbar_logo }}has-logo{{/ output.should_display_navbar_logo }}">
                {{^output.custom_course_logo}}
                    {{#customlogo}}
                        <span class="rui-logo {{#navbarlogobox}}rui-logo-box{{/navbarlogobox}} {{#customdmlogo}}dark-mode-logo{{/customdmlogo}}">
                            <img src="{{customlogo}}" class="rui-custom-logo" alt="{{sitename}}" />
                            {{#customdmlogo}}<img src="{{customdmlogo}}" class="rui-custom-dmlogo" alt="{{sitename}}" />{{/customdmlogo}}
                        </span>
                    {{/customlogo}}
                    {{^customlogo}}
                        {{#customlogoandname}}
                            <span class="site-name">
                                {{^ customlogotxt }}{{{ sitename }}}{{/ customlogotxt }}
                                    {{{ customlogotxt }}}
                            </span>
                        {{/customlogoandname}}
                    {{/customlogo}}
                {{/output.custom_course_logo}}

                {{#output.custom_course_logo}}
                    <span class="rui-logo {{#navbarlogobox}}rui-logo-box{{/navbarlogobox}} {{#output.custom_course_dmlogo}}dark-mode-logo{{/output.custom_course_dmlogo}}">
                        <img src="{{{output.custom_course_logo}}}" class="rui-custom-logo" alt="{{sitename}}" />
                        {{#output.custom_course_dmlogo}}<img src="{{{output.custom_course_dmlogo}}}" class="rui-custom-dmlogo" alt="{{sitename}}" />{{/output.custom_course_dmlogo}}
                    </span>
                {{/output.custom_course_logo }}

                {{^customlogo}}
                    <span class="site-name">
                        {{^ customlogotxt }}{{{ sitename }}}{{/ customlogotxt }}
                            {{{ customlogotxt }}}
                    </span>
                {{/customlogo}}
            </a>
        {{/topbarlogoareaon}}

        <button id="mobileNav" class="rui-mobile-nav-btn rui-topbar-btn">
            <svg width="18" height="18" fill="none" viewBox="0 0 24 24">
                <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.75 5.75H19.25"></path>
                <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.75 18.25H19.25"></path>
                <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.75 12H19.25"></path>
            </svg>
        </button>
    </div>

    <div class="rui-topbar wrapper-fw {{# output.custom_menu }}rui-topbar--custom-menu{{/ output.custom_menu }}">
        <div id="topbarLeft" class="d-inline-flex align-items-center">

            <div class="d-inline-flex align-items-center">
                {{#topbarlogoareaon}}
                    <a id="logo" href="{{{ config.wwwroot }}}" class="d-sm-none d-md-inline-flex align-items-center rui-navbar-brand {{#customlogo}}rui-navbar-brand--img{{/customlogo}} aabtn {{# output.should_display_navbar_logo }}has-logo{{/ output.should_display_navbar_logo }}">

                        {{^output.custom_course_logo}}
                            {{#customlogo}}
                                <span class="rui-logo {{#navbarlogobox}}rui-logo-box{{/navbarlogobox}} {{#customdmlogo}}dark-mode-logo{{/customdmlogo}}">
                                    <img src="{{customlogo}}" class="rui-custom-logo" alt="{{sitename}}" />
                                    {{#customdmlogo}}<img src="{{customdmlogo}}" class="rui-custom-dmlogo" alt="{{sitename}}" />{{/customdmlogo}}
                                </span>
                                {{#customlogoandname}}
                                    <span class="site-name">
                                        {{^ customlogotxt }}{{{ sitename }}}{{/ customlogotxt }}
                                            {{{ customlogotxt }}}
                                    </span>
                                {{/customlogoandname}}
                            {{/customlogo}}
                            {{^customlogo}}
                                {{#customlogoandname}}
                                    <span class="site-name">
                                        {{^ customlogotxt }}{{{ sitename }}}{{/ customlogotxt }}
                                            {{{ customlogotxt }}}
                                    </span>
                                {{/customlogoandname}}
                            {{/customlogo}}
                        {{/output.custom_course_logo}}

                        {{#output.custom_course_logo}}
                            <span class="rui-logo {{#navbarlogobox}}rui-logo-box{{/navbarlogobox}} {{#output.custom_course_dmlogo}}dark-mode-logo{{/output.custom_course_dmlogo}}">
                                <img src="{{{output.custom_course_logo}}}" class="rui-custom-logo" alt="{{sitename}}" />
                                {{#output.custom_course_dmlogo}}<img src="{{{output.custom_course_dmlogo}}}" class="rui-custom-dmlogo" alt="{{sitename}}" />{{/output.custom_course_dmlogo}}
                            </span>
                            <span class="site-name">{{{ output.custom_course_name }}}</span>
                        {{/output.custom_course_logo }}

                    </a>
                {{/topbarlogoareaon}}
            </div>
        </div>
        {{#primarymoremenu}}
            <div class="primary-navigation ml-md-2">
                {{> core/moremenu}}
            </div>
        {{/primarymoremenu}}

        {{#topbarcustomhtml}}
            <div class="rui-topbar-customfield px-3 ml-auto mr-3">{{{.}}}</div>
        {{/topbarcustomhtml}}

        <ul class="rui-icon-menu rui-icon-menu--right {{^topbarcustomhtml}}ml-auto{{/topbarcustomhtml}}">
            {{^isnotloggedin}}
                <li class="rui-icon-menu-search rui-drawer-search">
                    {{{ output.search_box }}}
                </li>
                {{#darkmodetheme}}
                    <li class="rui-icon-menu-darkmode">
                        <button id="darkModeBtn" class="btn--darkmode" aria-checked="false" type="button" data-preference="darkmode-on" {{^sdarkmode}}data-toggle="tooltip" data-placement="left" title="Dark Mode" {{/sdarkmode}}>
                            <div class="rui-dark-mode-status--on rui-tooltip--bottom" data-title="{{{slightmode}}}"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                    <path fill-rule="evenodd" clip-rule="evenodd" d="M12 16C14.2091 16 16 14.2091 16 12C16 9.79086 14.2091 8 12 8C9.79086 8 8 9.79086 8 12C8 14.2091 9.79086 16 12 16ZM12 18C15.3137 18 18 15.3137 18 12C18 8.68629 15.3137 6 12 6C8.68629 6 6 8.68629 6 12C6 15.3137 8.68629 18 12 18Z" fill="currentColor" />
                                    <path fill-rule="evenodd" clip-rule="evenodd" d="M11 0H13V4.06189C12.6724 4.02104 12.3387 4 12 4C11.6613 4 11.3276 4.02104 11 4.06189V0ZM7.0943 5.68018L4.22173 2.80761L2.80752 4.22183L5.6801 7.09441C6.09071 6.56618 6.56608 6.0908 7.0943 5.68018ZM4.06189 11H0V13H4.06189C4.02104 12.6724 4 12.3387 4 12C4 11.6613 4.02104 11.3276 4.06189 11ZM5.6801 16.9056L2.80751 19.7782L4.22173 21.1924L7.0943 18.3198C6.56608 17.9092 6.09071 17.4338 5.6801 16.9056ZM11 19.9381V24H13V19.9381C12.6724 19.979 12.3387 20 12 20C11.6613 20 11.3276 19.979 11 19.9381ZM16.9056 18.3199L19.7781 21.1924L21.1923 19.7782L18.3198 16.9057C17.9092 17.4339 17.4338 17.9093 16.9056 18.3199ZM19.9381 13H24V11H19.9381C19.979 11.3276 20 11.6613 20 12C20 12.3387 19.979 12.6724 19.9381 13ZM18.3198 7.0943L21.1923 4.22183L19.7781 2.80762L16.9056 5.6801C17.4338 6.09071 17.9092 6.56608 18.3198 7.0943Z" fill="currentColor" />
                                </svg></div>
                            <div class="rui-dark-mode-status--off rui-tooltip--bottom" data-title="{{{sdarkmode}}}"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                                    <path fill-rule="evenodd" clip-rule="evenodd" d="M12.2256 2.00253C9.59172 1.94346 6.93894 2.9189 4.92893 4.92891C1.02369 8.83415 1.02369 15.1658 4.92893 19.071C8.83418 22.9763 15.1658 22.9763 19.0711 19.071C21.0811 17.061 22.0565 14.4082 21.9975 11.7743C21.9796 10.9772 21.8669 10.1818 21.6595 9.40643C21.0933 9.9488 20.5078 10.4276 19.9163 10.8425C18.5649 11.7906 17.1826 12.4053 15.9301 12.6837C14.0241 13.1072 12.7156 12.7156 12 12C11.2844 11.2844 10.8928 9.97588 11.3163 8.0699C11.5947 6.81738 12.2094 5.43511 13.1575 4.08368C13.5724 3.49221 14.0512 2.90664 14.5935 2.34046C13.8182 2.13305 13.0228 2.02041 12.2256 2.00253ZM17.6569 17.6568C18.9081 16.4056 19.6582 14.8431 19.9072 13.2186C16.3611 15.2643 12.638 15.4664 10.5858 13.4142C8.53361 11.362 8.73568 7.63895 10.7814 4.09281C9.1569 4.34184 7.59434 5.09193 6.34315 6.34313C3.21895 9.46732 3.21895 14.5326 6.34315 17.6568C9.46734 20.781 14.5327 20.781 17.6569 17.6568Z" fill="currentColor" />
                                </svg></div>
                        </button>
                    </li>
                {{/darkmodetheme}}
            {{/isnotloggedin}}
            <li class="rui-icon-menu-plugins">{{{ output.navbar_plugin_output }}}</li>
            <li class="d-inline-flex mr-2 ml-0">
                {{{ output.render_lang_menu }}}
            </li>
            <li class="rui-icon-menu-user m-0">{{{ output.user_menu }}}</li>
            {{#isnotloggedin}}
                {{#topbaradditionalbtn}}
                    <li class="ml-1">
                        {{#topbaradditionalbtnurl}}
                            <a class="rui-topbar-btn rui-signup-btn" href="{{topbaradditionalbtnurl}}">
                                <span class="rui-login-btn-txt">{{{stopbaradditionalbtn}}}</span>
                            </a>
                        {{/topbaradditionalbtnurl}}
                        {{{topbaradditionalbtnhtml}}}
                    </li>
                {{/topbaradditionalbtn}}
            {{/isnotloggedin}}
        </ul>

        {{{ output.edit_switch }}}

    </div>
</nav>