import { EditorView } from '@tiptap/pm/view';

/**
 * Host shape for `cx-rich-text-image-viewer` and `cx-rich-text-video-viewer`.
 *
 * - `getPos` / `nodeAttrs`: set by the node view after `customElements.whenDefined`.
 * - `select` / `deselect`: called by `selectNode` / `deselectNode` node-view callbacks
 *   so the viewer shows its resize border on any NodeSelection, not only after a direct click.
 */
export type RichTextInlineViewerHost = HTMLElement & {
    deselect?: () => void;
    getPos?: () => number | undefined;
    nodeAttrs?: Record<string, unknown>;
    select?: () => void;
};
/** Doc mutation operations shared by image and video viewer `cx-tiptap-*-doc-request` events. */
export type RichTextInlineViewerDocMutationDetail = {
    attrs: Record<string, unknown>;
    operation: 'merge-attrs';
} | {
    height: string;
    operation: 'resize-end';
    width: string;
} | {
    height: number;
    operation: 'fix-size';
    width: number;
};
export type RichTextInlineViewerDocRequestDetail = RichTextInlineViewerDocMutationDetail | {
    operation: 'retry-remote-upload';
};
export declare function findRichTextInlineViewerHost(event: Event, viewerLocalName: string): RichTextInlineViewerHost | null;
export declare function getRichTextInlineViewerDocPos(host: RichTextInlineViewerHost | null): number | null;
/**
 * Applies `merge-attrs`, `resize-end`, or `fix-size` from a viewer doc-request event.
 * Returns false for `retry-remote-upload` or unknown operations (callers handle retry separately).
 */
export declare function dispatchRichTextInlineViewerDocMutation(view: EditorView, pos: number, expectedNodeName: 'figure' | 'image' | 'video', detail: RichTextInlineViewerDocRequestDetail): boolean;
