<div class="mobile menubar hidden">
    <nav>
        <ul>
            [% if $menu?search %]
            <li>
                [% if $context('isStatic') %]
                <form action="[[ $context-path ]]/search.html">
                    <input type="search" value="" name="query" placeholder="" data-i18n="[placeholder]search.placeholder"/>
                </form>
                [% else %]
                <pb-search action="[[ $context-path ]]/search.html" value="[[ page:parameter($context, 'query', '') ]]" redirect="redirect"/>
                [% endif %]
            </li>
            [% endif %]
        </ul>
        <ul>
            [% if $menu?language %]
            <li>
                <pb-lang name="lang">
                    [% for $lang in map:keys($languages) %]
                    <option value="[[ $lang ]]">[[ $languages?($lang) ]]</option>
                    [% endfor %]
                </pb-lang>
            </li>
            [% endif %]
            [% if $menu?login and not($context?isStatic) %]
            <li>
                <pb-login id="login" group="[[ $pkg?user?group ]]"/>
            </li>
            [% endif %]
        </ul>
    </nav>
    <aside>
        <nav>
            <ul>
                [% for $item in $menu?items?* %]
                [% if $item?url or $item?url = '' %]
                [% let $url = if (starts-with($item?url, 'http')) then $item?url else $context-path || '/' || $item?url %]
                <li>
                    <a href="[[ replace($url, 'browse\.html', $context?defaults?browse) ]]"><pb-i18n key="menu.[[ $item?id ]]">[[ $item?id ]]</pb-i18n></a>
                </li>
                [% endlet %]
                [% elif exists($item?subitems) %]
                <li>
                    <details class="dropdown">
                        <summary><pb-i18n key="menu.[[ $item?id ]]">[[ $item?id ]]</pb-i18n></summary>
                        <ul>
                            [% for $subitem in $item?subitems?* %]
                            <li>
                                <a href="[[ $context-path ]]/[[ $subitem?url ]]"><pb-i18n key="menu.[[ $subitem?id ]]">[[ $subitem?id ]]</pb-i18n></a>
                            </li>
                            [% endfor %]
                        </ul>
                    </details>
                </li>
                [% endif %]
                [% endfor %]

                [# display download menu items if in document view #]
                [% if exists($context?doc) and $menu?download %]
                    <li>
                        <pb-edit-xml src="document1" data-i18n="[title]menu.download.view-tei" title="view-tei">
                            XML
                        </pb-edit-xml>
                    </li>
                    [% if empty($context?media) or "print" = $context?media %]
                    <li>
                        <a href="[[ $context-path ]]/print/[[ $context?doc?path ]]?odd=[[$context?doc?odd]]" target="_new">Print CSS</a>
                    </li>
                    [% endif %]
                    [% if empty($context?media) or "latex" = $context?media %]
                    <li>
                        <pb-download type="tex" src="document1" dialog="downloadDialog" data-i18n="[title]menu.download.pdf-latex" title="i18n(pdf-latex)">
                            <pb-i18n key="menu.download.pdf-latex">Download</pb-i18n>
                        </pb-download>
                    </li>
                    [% endif %]
                    [% if empty($context?media) or "latex" = $context?media %]
                    <li>
                        <pb-download type="tex" src="document1" dialog="downloadDialog" data-i18n="[title]menu.download.pdf-latex" title="i18n(pdf-latex)" source="source">
                            <pb-i18n key="menu.download.latex-source"/>
                        </pb-download>
                    </li>
                    [% endif %]
                    [% if empty($context?media) or "fo" = $context?media %]
                    <li>
                        <pb-download type="pdf" src="document1" dialog="downloadDialog" data-i18n="[title]menu.download.pdf-fo" title="i18n(pdf-fo)">
                            <pb-i18n key="menu.download.pdf-fo"/>
                        </pb-download>
                    </li>
                    [% endif %]
                    [% if empty($context?media) or "fo" = $context?media %]
                    <li>
                        <pb-download type="pdf" src="document1" dialog="downloadDialog" data-i18n="[title]menu.download.fo-source" title="pdf-fo" source="source">
                            <pb-i18n key="menu.download.fo-source"/>
                        </pb-download>
                    </li>
                    [% endif %]
                    [% if empty($context?media) or "epub" = $context?media %]
                    <li>
                        <pb-download type="epub" src="document1" dialog="downloadDialog">
                            ePUB
                        </pb-download>
                    </li>
                    [% endif %]
                    [% block menu.download %][% endblock %]
                [% endif %]
            </ul>
        </nav>
    </aside>
</div>