import { Node as ProseMirrorNode } from 'prosemirror-model';
import { Editor } from '../../core/Editor.js';
import { BlockNodeAddress, BlockNodeType, NodeAddress, NodeType } from '@superdoc/document-api';
/** A block-level node found during document traversal, with its position and resolved identity. */
export type BlockCandidate = {
    node: ProseMirrorNode;
    pos: number;
    end: number;
    nodeType: BlockNodeType;
    nodeId: string;
};
/**
 * Positional index of all block-level nodes in the document.
 *
 * Built by {@link buildBlockIndex}. The index is a snapshot — it must be
 * rebuilt after any document mutation.
 */
export type BlockIndex = {
    candidates: BlockCandidate[];
    byId: Map<string, BlockCandidate>;
};
/**
 * Returns `true` if `nodeType` is a block-level type supported by the adapter index.
 *
 * @param nodeType - A node type string (block, inline, or the literal `'text'`).
 * @returns Whether the type is a supported {@link BlockNodeType}.
 */
export declare function isSupportedNodeType(nodeType: NodeType | 'text'): nodeType is BlockNodeType;
/**
 * Extracts the heading level (1–6) from an OOXML styleId string.
 *
 * @param styleId - A paragraph styleId (e.g. `"Heading1"`, `"heading 3"`).
 * @returns The heading level, or `undefined` if the styleId is not a heading.
 */
export declare function getHeadingLevel(styleId?: string | null): number | undefined;
/**
 * Converts a {@link BlockCandidate} into a stable {@link NodeAddress}.
 *
 * @param candidate - The block candidate to convert.
 * @returns A block-kind node address.
 */
export declare function toBlockAddress(candidate: BlockCandidate): BlockNodeAddress;
/**
 * Walks the editor document and builds a positional index of all recognised
 * block-level nodes.
 *
 * The returned index is a **snapshot** tied to the current document state.
 * It must be rebuilt after any transaction that mutates the document.
 *
 * @param editor - The editor whose document will be indexed.
 * @returns A {@link BlockIndex} containing ordered candidates and a lookup map.
 */
export declare function buildBlockIndex(editor: Editor): BlockIndex;
/**
 * Looks up a block candidate by its {@link NodeAddress}.
 *
 * @param index - The block index to search.
 * @param address - The address to resolve. Non-block addresses return `undefined`.
 * @returns The matching candidate, or `undefined` if not found.
 */
export declare function findBlockById(index: BlockIndex, address: NodeAddress): BlockCandidate | undefined;
/**
 * Finds a block candidate by raw nodeId without requiring a nodeType.
 *
 * This is needed for create operations that position relative to _any_ block type.
 *
 * @param index - The block index to search.
 * @param nodeId - The node ID to resolve.
 * @returns The single matching candidate.
 * @throws {DocumentApiAdapterError} `TARGET_NOT_FOUND` if no candidate matches.
 * @throws {DocumentApiAdapterError} `AMBIGUOUS_TARGET` if more than one candidate matches.
 */
export declare function findBlockByNodeIdOnly(index: BlockIndex, nodeId: string): BlockCandidate;
/**
 * Returns true for block candidates that accept inline text content.
 */
export declare function isTextBlockCandidate(candidate: BlockCandidate): boolean;
/**
 * Finds a block candidate whose range contains the given position.
 *
 * Note: nested blocks (e.g. table > row > cell > paragraph) produce overlapping
 * candidates. This returns whichever the binary search lands on first, not
 * necessarily the innermost. This is sufficient for resolving a containing block
 * for match context but callers needing the most specific block should filter further.
 */
export declare function findBlockByPos(index: BlockIndex, pos: number): BlockCandidate | undefined;
//# sourceMappingURL=node-address-resolver.d.ts.map