/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */
import type { BaseSelection, NodeKey } from 'lexical';
import { Provider, UserState } from '.';
import { AnyBinding, type BaseBinding, type Binding } from './Bindings';
import { CollabDecoratorNode } from './CollabDecoratorNode';
import { CollabElementNode } from './CollabElementNode';
import { CollabLineBreakNode } from './CollabLineBreakNode';
import { CollabTextNode } from './CollabTextNode';
export type CursorSelection = {
    anchor: {
        key: NodeKey;
        offset: number;
    };
    caret: HTMLElement;
    color: string;
    focus: {
        key: NodeKey;
        offset: number;
    };
    /** Modern path: one CSS Custom Highlight per remote cursor. */
    highlight: Highlight | null;
    highlightName: string;
    name: HTMLSpanElement;
    /** Legacy fallback only: absolutely-positioned rect spans, one per visual rect. */
    selections: HTMLElement[];
};
/**
 * The subset of a binding that {@link getCursorHighlightSheet} reads. Declared
 * structurally so callers pass a full binding and tests pass a lightweight stub,
 * neither needing a cast.
 *
 * @internal
 */
export interface CursorHighlightSheetBinding {
    cursorHighlightSheet: CSSStyleSheet | null;
    editor: {
        getRootElement: () => HTMLElement | null;
    };
}
/**
 * Resolve the per-binding stylesheet that hosts `::highlight(...)` rules,
 * re-adopting it into the editor's current tree scope (document or shadow
 * root) on every call.
 *
 * The editor root can move between the light DOM and a shadow root (a
 * shadow-DOM toggle) without recreating the binding, and `::highlight()` rules
 * only apply in the tree scope that owns the highlighted ranges, so the sheet
 * is re-homed each call. A leftover adoption in a previously-used scope is
 * harmless: shadow encapsulation means a rule there cannot match ranges in the
 * new scope.
 *
 * @internal Exported for tests; not part of the package's public API.
 */
export declare function getCursorHighlightSheet(binding: CursorHighlightSheetBinding): CSSStyleSheet;
export declare function removeCursorHighlightRule(binding: BaseBinding, highlightName: string): void;
export type Cursor = {
    color: string;
    name: string;
    selection: null | CursorSelection;
};
type AnyCollabNode = CollabDecoratorNode | CollabElementNode | CollabTextNode | CollabLineBreakNode;
/**
 * @deprecated Use `$getAnchorAndFocusForUserState` instead.
 */
export declare function getAnchorAndFocusCollabNodesForUserState(binding: Binding, userState: UserState): {
    anchorCollabNode: AnyCollabNode | null;
    anchorOffset: number;
    focusCollabNode: AnyCollabNode | null;
    focusOffset: number;
};
export declare function $getAnchorAndFocusForUserState(binding: AnyBinding, userState: UserState): {
    anchorKey: NodeKey | null;
    anchorOffset: number;
    focusKey: NodeKey | null;
    focusOffset: number;
};
export declare function $syncLocalCursorPosition(binding: AnyBinding, provider: Provider): void;
export type SyncCursorPositionsFn = (binding: AnyBinding, provider: Provider, options?: SyncCursorPositionsOptions) => void;
export type SyncCursorPositionsOptions = {
    getAwarenessStates?: (binding: BaseBinding, provider: Provider) => Map<number, UserState>;
    selectionHighlight?: boolean;
};
export declare function syncCursorPositions(binding: AnyBinding, provider: Provider, options?: SyncCursorPositionsOptions): void;
export declare function syncLexicalSelectionToYjs(binding: AnyBinding, provider: Provider, prevSelection: null | BaseSelection, nextSelection: null | BaseSelection): void;
export {};
