@php
    /** @var \App\View\Components\Ui\Layout\AppSidebar $megaSidebar */
    $megaSidebar = new \App\View\Components\Ui\Layout\AppSidebar($navMegaGroups ?? []);
    /** @var array<string, int> $badges */
    $badges = is_array($navMegaSignals['badges'] ?? null) ? $navMegaSignals['badges'] : [];
    $recent = is_array($navRecentTrail ?? null) ? $navRecentTrail : [];
@endphp

@if (($navMegaGroups ?? []) === [])
@else
    <ul class="header-nav-menu d-flex align-items-center gap-1 gap-lg-2 mb-0 list-unstyled">
        @foreach ($navMegaGroups as $group)
            <x-ui.layout.partials.mega-group-dropdown :group="$group" :mega-sidebar="$megaSidebar" :badges="$badges"
                :recent="$recent" />
        @endforeach
    </ul>
@endif
