<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

?>
<?php
/** @var \Magento\LayeredNavigation\Block\Navigation\FilterRenderer $block */
/** @var \Magento\Framework\Escaper $escaper */
/** @var \Magento\LayeredNavigation\ViewModel\Layer\Filter $viewModel */
$viewModel = $block->getData('product_layer_view_model');
?>

<ol class="items">
    <?php foreach ($filterItems as $filterItem): ?>
        <li class="item">
            <?php if ($filterItem->getCount() > 0): ?>
                <a
                    href="<?= $escaper->escapeUrl($filterItem->getUrl()) ?>"
                    rel="nofollow"
                ><?= /* @noEscape */ $filterItem->getLabel() ?><?php
                if ($viewModel->shouldDisplayProductCountOnLayer()): ?><span
                        class="count"><?= /* @noEscape */ (int) $filterItem->getCount() ?><span
                            class="filter-count-label"><?php
                            if ($filterItem->getCount() == 1): ?>
                                <?= $escaper->escapeHtml(__('item')) ?><?php
                            else:
                                ?><?= $escaper->escapeHtml(__('item')) ?><?php
                            endif;?></span></span>
                    <?php endif; ?></a>
            <?php else: ?>
                <?= /* @noEscape */ $filterItem->getLabel() ?><?php
                if ($viewModel->shouldDisplayProductCountOnLayer()): ?><span
                        class="count"><?= /* @noEscape */ (int) $filterItem->getCount() ?><span
                            class="filter-count-label"><?php
                            if ($filterItem->getCount() == 1): ?>
                                <?= $escaper->escapeHtml(__('items')) ?><?php
                            else:
                                ?><?= $escaper->escapeHtml(__('items')) ?><?php
                            endif;?></span></span>
                <?php endif; ?>
            <?php endif; ?>
        </li>
    <?php endforeach ?>
</ol>
