/** * HTML section extractor — converts raw HTML into structured sections * for LLM-based block mapping. * * Instead of sending 50KB of raw HTML to the LLM, this module identifies * semantic section boundaries, classifies them by CSS class patterns, * extracts structured content, and resolves lazy-loaded images. */ import type { ExtractedSection, NavExtraction, PageOutline, LayoutNode, VisualSection, RepeatGroup } from "./types.ts"; /** Classify a section by its CSS classes and content */ export declare function classifySection(openTag: string, innerHTML: string, preExtracted?: { headings: Array<{ level: number; text: string; }>; }): { classHints: string[]; suggestedBlockType?: string; }; /** * Extract structured sections from HTML. * * Identifies section boundaries using semantic tags, Elementor containers, * and generic div analysis. Classifies each section by CSS class patterns * and content heuristics. Resolves lazy-loaded images. */ export declare function extractSections(html: string, baseUrl: string): ExtractedSection[]; /** * Segment layout nodes into visual sections by detecting vertical gaps. */ export declare function segmentByVisualGaps(nodes: LayoutNode[], viewportWidth?: number): VisualSection[]; /** * Detect repeated structural patterns within a set of layout nodes. * Groups nodes by structural signature and classifies repeat groups. */ export declare function detectRepeatedPatterns(nodes: LayoutNode[]): RepeatGroup[]; /** * Extract a compact page outline from HTML. * * Splits the page at heading boundaries (h1/h2) to produce a section-per-heading * representation that captures the FULL page structure in ~2KB regardless of HTML size. * This ensures the LLM sees every section even when the raw HTML is truncated. */ export declare function extractPageOutline(html: string, baseUrl: string, layoutNodes?: LayoutNode[]): PageOutline; export declare function extractNavigation(html: string, baseUrl: string): NavExtraction; /** * Resolve lazy-loaded image sources in HTML. * Replaces data-src, data-lazy-src, etc. with actual src attributes. */ export declare function resolveLazyImages(html: string): string;