@props([
    'context' => 'sidebar',
    'company' => null,
])

@php
    $company = $company ?? auth()->user()?->company;
    $logo = $company
        ? app(\App\Support\BrandLogoManager::class)->resolveCompany($company, $context)
        : null;
@endphp

@if($logo && $logo['url'])
<img {{ $attributes->merge(['class' => $logo['class']]) }}
     src="{{ $logo['url'] }}"
     alt="{{ $logo['alt'] }}"
     loading="lazy"
     decoding="async"
     @if($logo['fallback_url'])
     onerror="this.onerror=null;this.src='{{ $logo['fallback_url'] }}';"
     @endif
     @if($logo['source'] === 'app-fallback')
     title="Using application logo — upload a company logo in Settings"
     @endif
>
@endif
