<div id="sidebar-search" class="{{ (render_hidden_by_default ?? true) ? 'hidden' }}">
    <form action="{{ path('_profiler_search') }}" method="get">
        <div class="form-group">
            <label for="ip">
                {% if 'command' == profile_type %}
                    Application
                {% else %}
                    IP
                {% endif %}
            </label>
            <input type="text" name="ip" id="ip" value="{{ ip }}">
        </div>

        <div class="form-group-row">
            <div class="form-group">
                <label for="method">
                    {% if 'command' == profile_type %}
                        Mode
                    {% else %}
                        Method
                    {% endif %}
                </label>
                <select name="method" id="method">
                    <option value="">Any</option>
                    {% if 'command' == profile_type %}
                        {% set methods = ['BATCH', 'INTERACTIVE'] %}
                    {% else %}
                        {% set methods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'] %}
                    {% endif %}
                    {% for m in methods %}
                        <option {{ m == method ? 'selected="selected"' }}>{{ m }}</option>
                    {% endfor %}
                </select>
            </div>

            <div class="form-group">
                <label for="status_code">
                    {% if 'command' == profile_type %}
                        Exit code
                        {% set min_and_max = 'min=%d max=%d'|format(0, 255) %}
                    {% else %}
                        Status
                        {% set min_and_max = 'min=%d max=%d'|format(100, 599) %}
                    {% endif %}
                </label>
                <input type="number" name="status_code" id="status_code" {{ min_and_max }} value="{{ status_code }}">
            </div>
        </div>

        <div class="form-group">
            <label for="url">
                {% if 'command' == profile_type %}
                    Command
                {% else %}
                    URL
                {% endif %}
            </label>
            <input type="text" name="url" id="url" value="{{ url }}">
        </div>

        <div class="form-group">
            <label for="token">Token</label>
            <input type="text" name="token" id="token" size="8" value="{{ token }}">
        </div>

        <div class="form-group">
            <label for="start">From</label>
            <input type="date" name="start" id="start" value="{{ start }}">
        </div>

        <div class="form-group">
            <label for="end">Until</label>
            <input type="date" name="end" id="end" value="{{ end }}">
        </div>

        <div class="form-group-row form-group-row-search-button">
            <div class="form-group">
                <label for="limit">Results</label>
                <select name="limit" id="limit">
                    {% for l in [10, 50, 100] %}
                        <option {{ l == limit ? 'selected="selected"' }}>{{ l }}</option>
                    {% endfor %}
                </select>
            </div>

            <input type="hidden" name="type" value="{{ profile_type }}">

            <div class="form-group">
                <button type="submit" class="btn btn-sm">Search</button>
            </div>
        </div>
    </form>
</div>
