@auth
    @php $download = $episode->getDownloadByType('FHD'); @endphp
    @isset($download)
    <p class="font-bold text-gray-800 dark:text-gray-200">
        <i class="fa-solid fa-lock-open pr-[4px] text-green-400"></i> 1080p
    </p>
    <div class="flex flex-wrap justify-around">
        @php
            $dlList = App\Models\Episode::where('hentai_id', $episode->hentai_id)
                ->orderBy('episode', 'asc')
                ->get();
            $fillNumbers = $dlList->count() >= 10;
        @endphp

        @foreach ($dlList as $hdl)
            @include('modals.partials.download-button')
        @endforeach
    </div>

    @include('modals.partials.download-backup')
    @else
    <p class="text-gray-800 dark:text-gray-200 font-bold">
        <i class="fa-solid fa-lock pr-[4px] text-red-600"></i> 1080p
    </p>
    <p class="text-gray-800 dark:text-gray-200">
        Unavailable.
    </p>
    @endisset

    @if ($episode->interpolated)
    @php $download = $episode->getDownloadByType('FHDi'); @endphp
    @isset($download)
    <p class="font-bold text-gray-800 dark:text-gray-200">
        <i class="fa-solid fa-lock-open pr-[4px] text-green-400"></i> 1080p 48fps
    </p>

    <div class="flex flex-wrap justify-around">
        @foreach ($dlList as $hdl)
            @include('modals.partials.download-button-interpolated')
        @endforeach
    </div>
    @else
    <p class="text-gray-800 dark:text-gray-200 font-bold">
        <i class="fa-solid fa-lock pr-[4px] text-red-600"></i> 1080p 48fps
    </p>
    <p class="text-gray-800 dark:text-gray-200">
        Unavailable.
    </p>
    @endisset
    @endif

    <br>
    @php $download = $episode->getDownloadByType('UHD'); @endphp
    @isset($download)
    @if (Auth::user()->hasRole(\App\Enums\UserRole::SUPPORTER) || Auth::user()->hasRole(\App\Enums\UserRole::ADMINISTRATOR))
        <p class="font-bold text-gray-800 dark:text-gray-200">
            <i class="fa-solid fa-lock-open pr-[4px] text-green-400"></i> 4k
        </p>

        @php $dlpdomains = config('hstream.download_domain_4k'); @endphp

        <div class="flex flex-wrap justify-around">
            @foreach ($dlList as $hdl)
                @include('modals.partials.download-button-patreon')
            @endforeach
        </div>
    @else
        @if (config('hstream.free_downloads'))
        <p class="font-bold text-gray-800 dark:text-gray-200">
            <i class="fa-solid fa-lock-open pr-[4px] text-yellow-600"></i> 4k
        </p>
        @livewire('downloads-free', ['episode' => $episode])
        @else
        <p class="font-bold text-gray-800 dark:text-gray-200">
            <i class="fa-solid fa-lock pr-[4px] text-red-600"></i> 4k
        </p>
        <p class="text-gray-800 dark:text-gray-200">
            4k Downloads are restricted to patreon subscribers. If you are subscribed to patreon and you have a patreon role
            on our Discord server, you have to logout and login again.
        </p>
        @endif
    @endif
    @else
    <p class="text-gray-800 dark:text-gray-200 font-bold">
        <i class="fa-solid fa-lock pr-[4px] text-red-600"></i> 4k
    </p>
    <p class="text-gray-800 dark:text-gray-200">
        Unavailable.
    </p>
    @endisset

    <br>
    @if ($episode->interpolated_uhd)
        @if (Auth::user()->hasRole(\App\Enums\UserRole::SUPPORTER) || Auth::user()->hasRole(\App\Enums\UserRole::ADMINISTRATOR) )
            <p class="font-bold text-gray-800 dark:text-gray-200">
                <i class="fa-solid fa-lock-open pr-[4px] text-green-400"></i> 4k 48fps
            </p>

            @php $dlpdomains = config('hstream.download_domain_4k'); @endphp

            <div class="flex flex-wrap justify-around">
                @foreach ($dlList as $hdl)
                    @include('modals.partials.download-button-patreon-interpolated')
                @endforeach
            </div>
        @else
            @if (config('hstream.free_downloads'))
            <p class="font-bold text-gray-800 dark:text-gray-200">
                <i class="fa-solid fa-lock-open pr-[4px] text-yellow-600"></i> 4k 48fps
            </p>
            @livewire('downloads-free', ['episode' => $episode, 'interpolated' => true])
            @else
            <p class="font-bold text-gray-800 dark:text-gray-200">
                <i class="fa-solid fa-lock pr-[4px] text-red-600"></i> 4k 48fps
            </p>
            <p class="text-gray-800 dark:text-gray-200">
                4k 48fps Downloads are restricted to patreon subscribers. If you are subscribed to patreon and you have a patreon role
                on our Discord server, you have to logout and login again.
            </p>
            @endif
        @endif
    @endif

    @include('modals.partials.download-subtitles')
@endauth
