{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "video-playlist",
  "title": "Video Playlist",
  "description": "A video with a playlist: the player next to the episode list, where selecting an entry swaps the media and the title without recreating the player.",
  "dependencies": [
    "cn",
    "lucide-react"
  ],
  "registryDependencies": [
    "litingyes/blocove/video-player",
    "scroll-area"
  ],
  "files": [
    {
      "path": "src/registry/blocove/blocks/video-playlist.tsx",
      "content": "import { cn } from 'cn'\nimport { PlayIcon } from 'lucide-react'\nimport { useState } from 'react'\nimport { VideoMedia, VideoPlayer } from '@/components/blocove/media/video'\nimport { ScrollArea } from '@/components/ui/scroll-area'\n\n/** One entry in the playlist. */\nexport interface VideoPlaylistItem {\n  /** Stable identifier, used as the React key and the selection value. */\n  id: string\n  /** Episode title. */\n  title: string\n  /** The video source. */\n  src: string\n  /** The poster shown before playback. */\n  poster?: string\n  /** A human readable duration, for example `12:40`. */\n  duration?: string\n  /** A short description shown under the player for the active entry. */\n  description?: string\n}\n\nexport interface VideoPlaylistProps {\n  /** The entries, played in order. */\n  items: VideoPlaylistItem[]\n  /** The entry selected on first render. Defaults to the first one. */\n  defaultId?: string\n  className?: string\n}\n\n/**\n * A video with a playlist: the player on the left, the episodes on the right.\n * Selecting an episode swaps the media and the title; the player itself is\n * never recreated, only the media element it plays.\n */\nexport function VideoPlaylist({\n  items,\n  defaultId,\n  className,\n}: VideoPlaylistProps) {\n  const [activeId, setActiveId] = useState(defaultId ?? items[0]?.id)\n  const active = items.find(item => item.id === activeId) ?? items[0]\n\n  if (!active) {\n    return null\n  }\n\n  return (\n    <div\n      data-slot=\"video-playlist\"\n      className={cn(\n        'grid w-full gap-4 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]',\n        className,\n      )}\n    >\n      <div className=\"flex min-w-0 flex-col gap-3\">\n        <VideoPlayer title={active.title} poster={active.poster}>\n          <VideoMedia key={active.id} src={active.src} />\n        </VideoPlayer>\n\n        <div className=\"flex flex-col gap-1\">\n          <h3 className=\"text-base font-semibold tracking-tight\">\n            {active.title}\n          </h3>\n          {active.description\n            ? (\n                <p className=\"text-sm text-muted-foreground\">\n                  {active.description}\n                </p>\n              )\n            : null}\n        </div>\n      </div>\n\n      <ScrollArea className=\"max-h-80 rounded-lg border\">\n        <ul aria-label=\"Playlist\" className=\"flex flex-col gap-1 p-1\">\n          {items.map((item, index) => {\n            const isActive = item.id === active.id\n\n            return (\n              <li key={item.id}>\n                <button\n                  type=\"button\"\n                  aria-current={isActive ? 'true' : undefined}\n                  className={cn(\n                    'flex w-full items-start gap-3 rounded-md px-2.5 py-2 text-left transition-colors outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50',\n                    isActive && 'bg-muted',\n                  )}\n                  onClick={() => setActiveId(item.id)}\n                >\n                  <span className=\"mt-0.5 text-xs text-muted-foreground tabular-nums\">\n                    {String(index + 1).padStart(2, '0')}\n                  </span>\n\n                  <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n                    <span className=\"truncate text-sm font-medium\">\n                      {item.title}\n                    </span>\n                    {item.duration\n                      ? (\n                          <span className=\"text-xs text-muted-foreground tabular-nums\">\n                            {item.duration}\n                          </span>\n                        )\n                      : null}\n                  </span>\n\n                  {isActive\n                    ? <PlayIcon className=\"mt-0.5 size-4 shrink-0\" />\n                    : null}\n                </button>\n              </li>\n            )\n          })}\n        </ul>\n      </ScrollArea>\n    </div>\n  )\n}\n",
      "type": "registry:block",
      "target": "components/blocove/video-playlist.tsx"
    }
  ],
  "categories": [
    "media",
    "block"
  ],
  "type": "registry:block"
}