export interface RichTextRefs { itemIds: Set; mediaIds: Set; } /** * Every internal reference a rich-text value points at. * * Collected so `buildItemPayload` can look them all up in one query each, rather than one per link. */ export declare function collectRichTextRefs(html: string, into?: RichTextRefs): RichTextRefs; /** * Point a rich-text value's internal item links at different items. * * What a subtree copy needs, and the half `collectRichTextRefs` cannot do: duplicating a catalog * year has to leave the copy's prose linking *within the copy*, or 2027-28's pages all link back * into 2026-27 — a defect with no visible symptom, because every link still works and goes to a real * page that looks almost identical. * * **The marker is kept, never resolved.** `resolveRichTextRefs` replaces `taproot:item:{id}` with a * path because it is building output for a browser; this is rewriting *stored* content, where the * whole point of the marker is that a page which later moves keeps its links. Writing a path here * would silently convert a reference into a frozen URL — the one thing rich-text references exist to * prevent. * * An id with no entry in the map is left exactly as it was, which is what makes this safe for a * partial copy: a link out of the subtree still points where it did. Media is not remapped at all, * because a copy shares the library's assets rather than duplicating them. * * Parsed with `tokenize`, never a regex over the markup, for the reason `sanitizeHtml` gives — a * second opinion about where an attribute ends is a second parser, and the two will disagree. */ export declare function remapRichTextItemRefs(html: string, idMap: ReadonlyMap): string; export interface RichTextTargets { /** Item id → the path to link to. Absent means "do not link": missing, or not visible. */ items: Map; /** Media id → absolute asset URL. */ media: Map; } /** * Rewrite internal references into the URLs they currently resolve to. * * A reference with no target — deleted, or unpublished and this is not a preview — **unwraps**: the * `` goes and its text stays. That mirrors what a menu does with a target it cannot show, and it * is the better of the two failures. The alternative, linking anyway, sends a reader to a 404 that * the page itself claimed was there. * * Rebuilt from the token stream rather than string-replaced, so the output is the tokenizer's idea * of the markup rather than the input with holes cut in it. */ export declare function resolveRichTextRefs(html: string, targets: RichTextTargets): string;