import { I as InlineAnnotation } from '../types-DnPOMbQV.js'; import { P as PageSlice, R as RenderEntry, s as RenderPage, t as RenderSegment, q as BookParagraph, k as ParagraphKind } from '../measures-BildgW3g.js'; export { H as HeadingStyle, L as LineMetric, u as LineMetricsResult, M as MeasureOptions, v as RenderLine, w as RenderParagraph, x as adjustExclusionSlots, y as buildColumnSlots, z as buildLineMetrics, A as buildParagraphMeasures, D as findPhysicalColumn, F as getImageXOffset, G as packPageLines } from '../measures-BildgW3g.js'; /** * Node of the nested inline tree {@link buildInlineNodes} produces — one variant * per {@link InlineAnnotation} kind, plus the `text` leaf. * * Every element variant carries both its own flattened content (`text`, or * `base` for ruby) and its `children`. `children` is empty when nothing is * nested inside the span, in which case consumers render the flattened string; * when it is non-empty it covers exactly the same character range, so rendering * both would duplicate the text. */ type InlineNode = { type: 'text'; text: string; } | { type: 'ruby'; rubyText: string; base: string; children: InlineNode[]; } | { type: 'emphasis'; style: 'sesame' | 'dot' | 'circle'; text: string; children: InlineNode[]; } | { type: 'tcy'; text: string; children: InlineNode[]; } | { type: 'em'; text: string; children: InlineNode[]; } | { type: 'strong'; text: string; children: InlineNode[]; } | { type: 'link'; text: string; href: string; title?: string; children: InlineNode[]; } | { type: 'footnote-ref'; text: string; noteId: string; children: InlineNode[]; }; /** * Builds the inline node tree for the `[start, end)` slice of a paragraph. * * Annotations that cross the slice boundary are clamped to it — the same way a * CSS inline box is split across line boxes — so a span covering `[5, 10)` of a * paragraph broken at 8 contributes `[5, 8)` to one slice and `[8, 10)` to the * next, keeping its type and metadata (`href`, `noteId`, emphasis style) on both * halves. Ruby is the one exception: a reading cannot be repeated over two * halves of its base, so a ruby annotation whose base starts before `start` * contributes plain text and the reading stays on the slice that owns its start. * * @param chars - Character array of the whole paragraph. * @param annotations - Inline annotations addressed in paragraph coordinates. * @param start - Start index of the slice (inclusive). * @param end - End index of the slice (exclusive). * @returns Inline nodes covering exactly `chars[start..end)`. */ declare function buildInlineNodes(chars: readonly string[], annotations: readonly InlineAnnotation[], start?: number, end?: number): InlineNode[]; /** * Nesting depth an annotation kind occupies when several cover the same range. * * Lower ranks become outer elements: links and footnote references wrap * emphasis, which wraps tate-chu-yoko, which wraps ruby. The order matches the * markup HTML expects — a `` inside an `` rather than the reverse — * and is the last tiebreaker when sorting equally positioned annotations. * * @returns Rank from 0 (outermost) to 3 (innermost). */ declare function annotationNestingRank(ann: InlineAnnotation): number; /** * Reports whether two annotations interleave rather than nest. * * Ranges that are disjoint, identical, or fully contained one in the other are * expressible as a tree and return `false`; only a straddling pair such as * `[0, 4)` and `[2, 6)` returns `true`. {@link buildInlineNodes} drops both * members of such a pair, since no well-formed markup can express them, and * comparing an annotation with itself is therefore not an overlap. */ declare function partiallyOverlaps(a: InlineAnnotation, b: InlineAnnotation): boolean; /** * Builds a render page data structure from page slices and render entries. * * Converts layout results (break points, characters, ruby annotations) into * a framework-agnostic `RenderPage` structure containing paragraphs, lines, * and segments ready for rendering. * * @param slices - Page slices from `paginate()` for a single page. * @param entries - Render entries for all paragraphs in the chapter. * @returns A `RenderPage` data structure for the page. */ declare function buildRenderPage(slices: PageSlice[], entries: RenderEntry[]): RenderPage; /** * HTML element names {@link segmentToInlineNode} emits. Deliberately a closed * set, so a renderer can map it to its own element factory (or to a non-DOM * target) without a catch-all branch. */ type InlineRenderTag = 'ruby' | 'rt' | 'span' | 'em' | 'strong' | 'a'; /** * Framework-agnostic description of the markup for one {@link RenderSegment}. * * Unlike {@link InlineNode}, an element node carries no flattened text: its * content is entirely in `children`, which is never empty for an element, so a * renderer walks the tree without deciding between children and a fallback * string. `className`, `href` and `title` are left undefined unless the segment * calls for them, so a renderer should skip the attribute rather than emit it * empty. */ type InlineRenderNode = { type: 'text'; text: string; } | { type: 'element'; tag: InlineRenderTag; className?: string; href?: string; title?: string; children: InlineRenderNode[]; }; /** * Resolves one {@link RenderSegment} — nested `children` included — into the * markup tree mejiro's own page components render, so a third-party renderer * reuses the annotation policy instead of re-deriving it. * * Ruby becomes `` with a trailing ``; emphasis dots and * tate-chu-yoko become `` carrying the `mejiro-emphasis` / * `mejiro-emphasis--