<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="Jiayuan Mao">
    <title>{{ title }}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
    <link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet">
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="static/css/dashboard.css" rel="stylesheet">
    <link href="static/css/nested-list.css" rel="stylesheet">

    <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script>
    <script src="static/js/dashboard.js"></script>
<style>
</style>
</head>
<body>
    <nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
        <a class="navbar-brand col-md-3 col-lg-2 me-0 px-3" href="#">{{ title }}</a>
        <!--ul class="navbar-nav px-3 d-md-none d-block">
            <li class="nav-item text-nowrap">
                <a class="nav-link" href="#">Sign out</a>
            </li>
        </ul-->
        <input id="search" class="form-control form-control-dark w-100 me-0 me-md-1" type="text" placeholder="Search" aria-label="Search">
    </nav>

<div class="container-fluid">
    <div class="w-100">
        <nav class="col-md-3 col-lg-2 d-md-block bg-light sidebar">
            <div class="sidebar-sticky">
                <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 text-muted">Metainfo</h6>
                <div class="nav flex-column px-3 metainfo">
                    {% for key, value in metainfo.items() %}
                    <div>
                        <b>{{ key }}:</b> <pre>{{ value }}</pre>
                    </div>
                    {% end %}
                </div>
                {% if len(custom_pages) > 0 %}
                <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 text-muted">Custom Pages</h6>
                <div class="list-group list-group-root card">
                    {% for page in custom_pages %}
                    <a href="#custom/{{ page.__name__[7:] }}" class="list-group-item desc-link">
                        {{ page.page_name }}
                    </a>
                    {% end %}
                </div>
                {% end %}
                <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 text-muted">Experiments</h6>
                <div class="mb-md-4" id="desc-accordion">
                    <a href="#desc/__all__" class="list-group-item desc-link">Overview</a>
                    <a href="#desc/__star__" class="list-group-item desc-link">Stared</a>
                    {% for group_name, desc in desc_groups.items() %}
                    <div class="accordion" id="desc-accordion-{{ escape_desc_name(group_name) }}">
                        <div class="accordion-item" data-desc-group="{{ group_name }}">
                            <div class="accordion-header" id="desc-header-{{ escape_desc_name(group_name) }}">
                                <button class="accordion-button list-group-header collapsed" data-bs-toggle="collapse" data-bs-target="#desc-body-{{ escape_desc_name(group_name) }}" aria-expanded="false" aria-controls="desc-body-{{ escape_desc_name(group_name) }}">
                                    {{ group_name }}
                                </button>
                            </div>
                            <div id="desc-body-{{ escape_desc_name(group_name) }}" class="accordion-collapse collapse" aria-labelledby="desc-header-{{ escape_desc_name(group_name) }}" data-bs-parent="#desc-accordion-{{ escape_desc_name(group_name) }}">
                                <div class="accordion-body list-group list-group-root">
                                    <div class="list-group" id="desc-{{ escape_desc_name(group_name) }}">
                                        {% for desc_name, sub_desc in desc.items() %}
                                        {% if not is_deleted(sub_desc) %}
                                        <a href="#desc/{{ sub_desc.desc_name }}" class="list-group-item desc-link">
                                            {{ desc_name }}
                                        </a>
                                        <div class="list-group" id="desc-{{ escape_desc_name(sub_desc.desc_name) }}">
                                            {% for expr in sorted(sub_desc.exprs.execute(), key=lambda x: x.expr_name) %}
                                            {% if not is_deleted(expr) %}
                                            <a href="#desc/{{ sub_desc.desc_name }}/expr/{{ expr.expr_name }}" class="list-group-item expr-link" data-desc="{{ sub_desc.desc_name }}" data-expr="{{ expr.expr_name }}">{{ expr.expr_name }}</a>
                                            {% end %}
                                            {% end %}
                                        </div>
                                        {% end %}
                                        {% end %}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    {% end %}
                </div>
            </div>
        </nav>

        <main role="main" id="main" class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
        </main>
    </div>
</div>
<script>
$(function() {
    loadHash();
    window.onhashchange = loadHash;
    $.getJSON('api/search-list', function(results) {
        $('#search').autocomplete({
            source: results,
            select: function(event, ui) {
                var url = ui.item.value;
                window.location.hash = url;
            }
        });
    });
});

</script>
</body>
</html>
