/** * Reading time estimation utility. * * Pure calculation — no LLM needed. * Average adult reading speed: ~238 words per minute. */ /** * Estimate reading time for HTML or plain-text content. * Strips HTML tags before counting words. */ export function estimateReadingTime(content: string): { minutes: number; words: number } { const plain = content.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim(); const words = plain.split(/\s+/).filter(Boolean).length; return { minutes: Math.max(1, Math.ceil(words / 238)), words }; }