<!-- This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Luau Fuzzer Report</title>
    <style>
        :root, body {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        body {
            display: flex;
            flex-flow: column nowrap;
            align-items: center;
            font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
        }

        .root {
            width: 100%;
            max-width: 1000px;
        }

        .mono {
            font-family: monospace;
        }

        pre {
            padding: 0.3rem;
            background-color: rgba(0, 0, 0, 8%);
            border-radius: 6px;
            max-height: 50em;
            overflow: auto;
            box-sizing: border-box;
        }

        .metadata-root {
            display: flex;
            flex-flow: row wrap;
        }

        .metadata-item {
            min-width: 10em;
            margin: 0.25em;
            padding: 0.25em;
            border: 1px solid rgba(0, 0, 0, 20%);
            border-radius: 4px;
            box-sizing: border-box;
            flex-grow: 1;
        }

        .metadata-item dt, .metadata-item dl {
            margin: 0;
            padding: 0;
        }

        article dt {
            margin-bottom: 0.1em;
            font-weight: bold;
            box-sizing: border-box;
        }

        article dl {
            margin-top: 0;
            margin-bottom: 1.5rem;
            box-sizing: border-box;
        }

        nav>ul {
            list-style: none;
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
    <div class="root">
        <header>
            <h1>Fuzzer Report</h1>
            <div class="metadata-root">
                <div class="metadata-item">
                    <dt>Crashes</dt>
                    <dl>{{ crashes|length }}</dl>
                </div>
                {% for item in meta %}
                <div class="metadata-item">
                    <dt>{{ item.name }}</dt>
                    <dl>
                        {% if item.link %}
                        <a href="{{ item.link }}">{{ item.value }}</a>
                        {% else %}
                        {{ item.value }}
                        {% endif %}
                    </dl>
                </div>
                {% endfor %}
            </div>
        </header>

        <nav>
            <ul>
                {% for crash in crashes %}
                <li>
                    <a class="mono" href="#{{ crash.id }}">{{ crash.id }}</a>
                </li>
                {% endfor %}
            </ul>
        </nav>

        {% for crash in crashes %}
        <article id="{{ crash.id }}">
            <h2 class="mono">{{ crash.id }}</h2>
            <p><a href="{{ crash.artifact_link() }}">Download reproducer artifact</a></p>
            {% if crash.trace() %}
            <dt>Trace</dt>
            <dl>
                <pre>{{ crash.trace() }}</pre>
            </dl>
            {% endif %}
            <dt>Module set</dt>
            <dl>
                <pre>{{ crash.modules() }}</pre>
            </dl>
            <dl></dl>
        </article>
        {% endfor %}
    </div>
</body>
</html>
