export type MediaSetEntry = string | { url: string; name?: string }; export function mediaSetEntryUrl(e: MediaSetEntry): string { return typeof e === 'string' ? e : e.url; } function entryLabel(e: MediaSetEntry, index: number): string { if (typeof e === 'object' && e.name) return `${index + 1}: ${e.name}`; const file = mediaSetEntryUrl(e); const fileName = file.split('/').pop() || file; return `${index + 1}: ${fileName.replace(/\.[^.]+$/, '')}`; } interface MediaSetProps { files: MediaSetEntry[]; activeUrl: string; onSwitch: (url: string) => void; } export default function MediaSet({ files, activeUrl, onSwitch }: MediaSetProps) { return (