import { useState } from 'react'; import { ChevronRight, Copy, Check } from 'lucide-react'; import { Streamdown } from 'streamdown'; import { code } from '@streamdown/code'; interface Props { title: string; content: string; } /** Ensure every newline becomes a visible paragraph break in markdown */ function ensureLineBreaks(text: string): string { return text.split('\n').join('\n\n'); } function formatSize(len: number): string { if (len < 1024) return `${len} chars`; return `${(len / 1024).toFixed(1)} KB`; } export default function BlobyTextCard({ title, content }: Props) { const [expanded, setExpanded] = useState(false); const [copied, setCopied] = useState(false); const handleCopy = async (e: React.MouseEvent) => { e.stopPropagation(); try { await navigator.clipboard.writeText(content); setCopied(true); setTimeout(() => setCopied(false), 1500); } catch { /* clipboard not available */ } }; return (