{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "episode-feed",
  "title": "Episode Feed",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/episode-feed/EpisodeFeed.tsx",
      "content": "import { useMemo, useState, type ReactNode } from 'react'\nimport { FlatList, I18nManager, View, type ViewProps } from 'react-native'\nimport { ChevronLeft, ChevronRight, CircleCheck } from 'lucide-react-native'\nimport { Button } from '@/components/ui/button'\nimport { Icon } from '@/components/ui/icon'\nimport { ListItem, ListItemContent, ListItemDescription, ListItemTitle, ListSeparator } from '@/components/ui/list'\nimport { Progress } from '@/components/ui/progress'\nimport { SegmentedControl, SegmentedControlItem } from '@/components/ui/segmented-control'\nimport { Text } from '@/components/ui/text'\nimport { useAnnouncement } from '@/lib/accessibility'\nimport { cn } from '@/lib/utils'\n\nexport type EpisodeFeedFilter = 'all' | 'unplayed' | 'played'\n\nexport interface EpisodeFeedEntry {\n  id: string\n  title: string\n  metadata?: string\n  summary?: string\n  /** Persisted player state in seconds. Only the caller marks an episode played. */\n  position?: number\n  duration?: number\n  played?: boolean\n}\n\nconst percentFormat = new Intl.NumberFormat(undefined, { style: 'percent', maximumFractionDigits: 0 })\nconst defaultLabels = {\n  filter: 'Filter episodes',\n  all: 'All',\n  unplayed: 'Unplayed',\n  played: 'Played',\n  inProgress: 'In progress',\n  progress: (value: number) => `${percentFormat.format(value)} played`,\n  empty: 'No episodes yet.',\n  emptyUnplayed: 'No unplayed episodes.',\n  emptyPlayed: 'No played episodes.',\n  showAll: 'Show all episodes',\n  count: (value: number) => `${value} ${value === 1 ? 'episode' : 'episodes'}`,\n}\n\nexport interface EpisodeFeedProps<Entry extends EpisodeFeedEntry = EpisodeFeedEntry> extends Omit<\n  ViewProps,\n  'children'\n> {\n  className?: string\n  title: string\n  summary?: string\n  episodes?: readonly Entry[]\n  /** Optional content above the series title, inside the list's scroll region. */\n  header?: ReactNode\n  /** Owns the row layout when supplied. The feed continues to own filtering and virtualization. */\n  renderEpisode?: (episode: Entry) => ReactNode\n  filter?: EpisodeFeedFilter\n  defaultFilter?: EpisodeFeedFilter\n  onFilterChange?: (filter: EpisodeFeedFilter) => void\n  onOpen?: (episode: Entry) => void\n  labels?: Partial<typeof defaultLabels>\n}\n\nexport function EpisodeFeed<Entry extends EpisodeFeedEntry>({\n  title,\n  summary,\n  episodes = [],\n  header,\n  renderEpisode,\n  filter,\n  defaultFilter = 'all',\n  onFilterChange,\n  onOpen,\n  labels,\n  className,\n  ...props\n}: EpisodeFeedProps<Entry>) {\n  const copy = { ...defaultLabels, ...labels }\n  const [internalFilter, setInternalFilter] = useState(defaultFilter)\n  const selected = filter ?? internalFilter\n  const canFilter = filter === undefined || onFilterChange !== undefined\n  const items = useMemo(\n    () => (selected === 'all' ? episodes : episodes.filter((episode) => !!episode.played === (selected === 'played'))),\n    [episodes, selected],\n  )\n  useAnnouncement(selected !== 'all' ? `${copy[selected]}. ${copy.count(items.length)}.` : undefined)\n\n  function changeFilter(next: string) {\n    if (!canFilter || next === selected || (next !== 'all' && next !== 'unplayed' && next !== 'played')) return\n    if (filter === undefined) setInternalFilter(next)\n    onFilterChange?.(next)\n  }\n\n  return (\n    <View {...props} className={cn('min-h-0 flex-1 bg-background', className)}>\n      <FlatList\n        data={items}\n        keyExtractor={(episode) => episode.id}\n        ItemSeparatorComponent={ListSeparator}\n        contentContainerStyle={{ paddingBottom: 16 }}\n        ListHeaderComponent={\n          <View className=\"gap-[12px] pb-[12px]\">\n            {header}\n            <View className=\"gap-[4px]\">\n              <Text size=\"title\" accessibilityRole=\"header\">\n                {title}\n              </Text>\n              {summary ? <Text variant=\"muted\">{summary}</Text> : null}\n            </View>\n            <SegmentedControl\n              accessibilityLabel={copy.filter}\n              value={selected}\n              onValueChange={changeFilter}\n              disabled={!canFilter}\n            >\n              <SegmentedControlItem value=\"all\">{copy.all}</SegmentedControlItem>\n              <SegmentedControlItem value=\"unplayed\">{copy.unplayed}</SegmentedControlItem>\n              <SegmentedControlItem value=\"played\">{copy.played}</SegmentedControlItem>\n            </SegmentedControl>\n          </View>\n        }\n        ListEmptyComponent={\n          <View className=\"gap-[8px] rounded-lg border border-border bg-card p-[16px]\">\n            <Text variant=\"muted\">\n              {selected === 'played' ? copy.emptyPlayed : selected === 'unplayed' ? copy.emptyUnplayed : copy.empty}\n            </Text>\n            {episodes.length && selected !== 'all' && canFilter ? (\n              <Button variant=\"outline\" accessibilityLabel={copy.showAll} onPress={() => changeFilter('all')}>\n                {copy.showAll}\n              </Button>\n            ) : null}\n          </View>\n        }\n        renderItem={({ item }) => {\n          if (renderEpisode) return renderEpisode(item)\n          const position = item.position ?? 0\n          const duration = item.duration ?? 0\n          const started = Number.isFinite(position) && position > 0\n          const progress = started && Number.isFinite(duration) && duration > 0 ? Math.min(1, position / duration) : 0\n          const percentage = Math.round(progress * 100)\n          const status = item.played\n            ? copy.played\n            : progress > 0\n              ? copy.progress(progress)\n              : started\n                ? copy.inProgress\n                : copy.unplayed\n\n          return (\n            <ListItem\n              className=\"items-start px-0\"\n              onPress={onOpen ? () => onOpen(item) : undefined}\n              accessibilityLabel={onOpen ? [item.title, item.metadata, status].filter(Boolean).join(', ') : undefined}\n              accessibilityHint={onOpen ? item.summary : undefined}\n            >\n              <ListItemContent>\n                <ListItemTitle>{item.title}</ListItemTitle>\n                {item.metadata ? <ListItemDescription>{item.metadata}</ListItemDescription> : null}\n                {item.summary ? <ListItemDescription>{item.summary}</ListItemDescription> : null}\n                <View className=\"flex-row flex-wrap items-center gap-[6px]\">\n                  {item.played ? <Icon icon={CircleCheck} size={16} className=\"text-muted-foreground\" /> : null}\n                  <Text size=\"xs\" variant=\"muted\" style={{ fontVariant: ['tabular-nums'] }}>\n                    {status}\n                  </Text>\n                </View>\n                {!item.played && progress > 0 ? (\n                  <Progress\n                    value={percentage}\n                    accessibilityLabel={status}\n                    className=\"mt-[4px] max-w-[192px]\"\n                    aria-hidden={!!onOpen}\n                  />\n                ) : null}\n              </ListItemContent>\n              {onOpen ? (\n                <Icon\n                  icon={I18nManager.isRTL ? ChevronLeft : ChevronRight}\n                  size={18}\n                  className=\"mt-[4px] text-muted-foreground\"\n                />\n              ) : null}\n            </ListItem>\n          )\n        }}\n      />\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/episode-feed/EpisodeFeed.tsx"
    },
    {
      "path": "packages/registry-native/blocks/episode-feed/index.ts",
      "content": "export { EpisodeFeed, type EpisodeFeedEntry, type EpisodeFeedFilter, type EpisodeFeedProps } from './EpisodeFeed'\n",
      "type": "registry:block",
      "target": "~/components/blocks/episode-feed/index.ts"
    }
  ],
  "dependencies": [
    "lucide-react-native"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/accessibility.json",
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/icon.json",
    "https://native.uipkge.dev/r/native/list.json",
    "https://native.uipkge.dev/r/native/progress.json",
    "https://native.uipkge.dev/r/native/segmented-control.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Virtualized series feed with played and unplayed filters, readable progress, and caller-owned episode destinations.",
  "categories": [
    "media"
  ]
}