{#if status === "downloading"}
{:else if status === "completed"}
{:else if status === "pending"}
{:else if status === "failed"}
{:else}
{/if}
{#if showQualityPicker}
showQualityPicker = false} aria-label="Close quality picker" >
Select Quality
{#each Object.entries(QUALITY_PRESETS) as [key, preset]}
startDownload(key as QualityPreset)} class="w-full px-3 py-2 text-left text-sm hover:bg-gray-700 transition-colors flex justify-between items-center" >
{preset.label}
{#if preset.videoBitrate}
{Math.round(preset.videoBitrate / 1_000_000)}Mbps
{:else}
Direct
{/if}
{/each}
showQualityPicker = false} class="w-full px-3 py-2 text-left text-sm text-gray-400 hover:bg-gray-700 border-t border-gray-700" > Cancel
{/if}