{% set searchWidgetOptions = {
    searchWidgetMinChars: page.header.activeLanguage.productSearchConfig.minSearchLength ?: 3
} %}

{% block layout_header_search %}
    <div class="collapse"
         id="searchCollapse">
        <div class="header-search">
            {% block layout_header_search_form %}
                <form action="{{ path('frontend.search.page') }}"
                      method="get"
                      {# @deprecated tag:v6.6.0 - Registering plugin on selector "data-search-form" is deprecated. Use "data-search-widget" instead #}
                      {% if feature('v6.6.0.0') %}
                          data-search-widget="true"
                      {% else %}
                          data-search-form="true"
                      {% endif %}
                      {# ludtwig-ignore html-string-quotation #}
                      data-search-widget-options='{{ searchWidgetOptions|json_encode }}'
                      data-url="{{ path('frontend.search.suggest') }}?search="
                      class="header-search-form">
                    {% block layout_header_search_input_group %}
                        <div class="input-group">
                            {% block layout_header_search_input %}
                                <input type="search"
                                       name="search"
                                       class="form-control header-search-input"
                                       autocomplete="off"
                                       autocapitalize="off"
                                       placeholder="{{ "header.searchPlaceholder"|trans|striptags }}"
                                       aria-label="{{ "header.searchPlaceholder"|trans|striptags }}"
                                       value="{{ page.searchTerm }}"
                                >
                            {% endblock %}

                            {% block layout_header_search_button %}
                                <button type="submit"
                                        class="btn header-search-btn"
                                        aria-label="{{ "header.searchButton"|trans|striptags }}">
                                    <span class="header-search-icon">
                                        {% sw_icon 'search' %}
                                    </span>
                                </button>
                            {% endblock %}
                        </div>
                    {% endblock %}
                </form>
            {% endblock %}
        </div>
    </div>
{% endblock %}
