/** Safely run `querySelector`; invalid selectors return `null`. */ export declare function querySelectorSafe(root: ParentNode, selector: string): HTMLElement | null; /** Safely run `querySelectorAll`; invalid selectors return `[]`. */ export declare function querySelectorAllSafe(root: ParentNode, selector: string): HTMLElement[]; /** Slugify heading text for generated fragment IDs. */ export declare function slugifyHeadingText(text: string): string; /** * Assign a unique `id` when missing, avoiding collisions with `usedIds` and the document. * * @remarks * Existing IDs are left untouched and recorded in `usedIds`. Generated IDs use * `base`, `base-2`, … until free. */ export declare function ensureUniqueHeadingId(heading: HTMLElement, usedIds: Set, isTaken?: (id: string) => boolean): string; /** Viewport Y where a heading counts as active (`scrollOffset` below the scroll root top). */ export declare function trackingLineY(scrollRoot: HTMLElement | Window, scrollOffset: number): number; /** Scroll so `heading` sits `scrollOffset` below the scroll root's visible top. */ export declare function scrollHeadingIntoView(heading: HTMLElement, scrollRoot: HTMLElement | Window, scrollOffset: number, behavior: ScrollBehavior): void;