import { RTETableCellBlock } from './dto/table-cell-block';
import type { RTETableHeadCellBlock } from './dto/table-head-cell-block';
import { RTEExtensionContext } from '../../interface';
/**
 * Table selection helper used for mouse drag selection of cells.
 */
export declare class RTETableSelection {
  /**
   *  Indicates whether the user is currently performing a drag selection.
   */
  private dragging;
  /**
   * Anchor cell where the drag selection started.
   */
  private anchorCell;
  /**
   * Collection of currently selected cells.
   */
  private selectedCells;
  /**
   * Extension context
   */
  private context;
  private syncRTESelectionWithDebounce;
  private handleSelectionChangeWithDebounce;
  /**
   * Compute all cells inside the rectangle defined by the start and end cells.
   *
   * Note: this only performs the calculation and does not modify the internal `selectedCells` set,
   * so callers can decide how to apply the result.
   *
   * @param {RTETableCellBlock | RTETableHeadCellBlock} anchor - Drag start cell (anchor cell).
   * @param {RTETableCellBlock | RTETableHeadCellBlock} focus - Current drag focus cell.
   * @returns {(RTETableCellBlock | RTETableHeadCellBlock)[]} All cells in the rectangular selection area.
   */
  static computeRectRange(anchor: RTETableCellBlock | RTETableHeadCellBlock, focus: RTETableCellBlock | RTETableHeadCellBlock): (RTETableCellBlock | RTETableHeadCellBlock)[];
  /**
   * Get the rowSpan and colSpan attributes from a cell's DOM element.
   *
   * @param {RTETableCellBlock} cell - The cell to get span values from.
   * @returns {CellSpanType} Object with rowSpan and colSpan properties.
   */
  private static getCellSpan;
  /**
   * Build a grid representation of the table that accounts for rowSpan and colSpan.
   * Each cell in the grid array points to the actual cell block that occupies that position.
   *
   * @param {RTETableRowBlock[]} allRows - All rows in the table.
   * @returns {CellGridMetaType} Object with grid and cellMeta properties.
   */
  private static buildCellGrid;
  /**
   * Clean up event listeners.
   */
  destroy(): void;
  /**
   * Inject the extension context and set up selection change listener.
   *
   * @param {RTEExtensionContext} context - The extension context.
   */
  init(context: RTEExtensionContext): void;
  /**
   * Set the selected cells to the given list, replacing any existing selection.
   *
   * @param {RTETableCellBlock} cells - The cells to select.
   */
  setSelectedCells(cells: RTETableCellBlock[]): void;
  /**
   * Get all currently selected cells.
   *
   * @returns {(RTETableCellBlock | RTETableHeadCellBlock)[]} A flat list of selected cells.
   */
  getSelectedCells(): (RTETableCellBlock | RTETableHeadCellBlock)[];
  /**
   * Handle mouse down on a cell: start drag selection from the given cell.
   *
   * @param {HTMLElement} cellRef - The cell where the drag starts.
   */
  focusCell(cellRef: HTMLElement): void;
  /**
   * Handle drag over a cell (typically called on `mouseenter` while dragging).
   * Maintains a rectangular selection between the anchor cell and the current cell.
   *
   * @param {RTETableCellBlock | RTETableHeadCellBlock} cell - The cell currently under the drag.
   */
  dragOver(cell: RTETableCellBlock | RTETableHeadCellBlock): void;
  /**
   * Handle mouse up: stop drag selection.
   */
  endDrag(): void;
  /**
   * Emit table-cell selection change notify for the owning table.
   *
   * @param {RTETableCellBlock} firstCell - First cell of the table.
   * @param {RTETableCellBlock[]} cells - The current selected table cells.
   */
  private emitCellSelectionChange;
  /**
   * Clear the current selection state without changing the drag flag.
   */
  private clearSelection;
  /**
   * Add a selectionchange listener to the document to handle cell click selection.
   */
  private addSelectionChangeListener;
  /**
   * Remove the selectionchange listener from the document.
   */
  private removeSelectionChangeListener;
  /**
   * Handle selection change events from the document for the cell click selection.
   */
  private handleSelectionChange;
  /**
   * Recursively filter and collect selected table cell blocks within the given node.
   *
   * @param {Range} range - The current selection range.
   * @param {Node} node - The current node to check for selection.
   * @returns {RTETableCellBlock[]} A list of selected table cell blocks.
   */
  private filterSelectedCell;
  /**
   * Mark the beginning of a drag operation.
   */
  private startDrag;
  /**
   * Add the given cells to the current selection set.
   *
   * @param {RTETableCellBlock[]} cells - The cells to add to the selection.
   * @param {{ debounceSync?: boolean }} [options] - Options for updating selection.
   * @param {boolean} [options.debounceSync] - Whether to debounce the RTE selection sync.
   */
  private updateSelectedCells;
  /**
   * Update the styles of the selected cells.
   *
   * @param {RTETableCellBlock} cell - The cell to update style for.
   * @param {number} total - The total number of selected cells.
   */
  private updateSelectedStyles;
  /**
   * Synchronizes the rich text editor selection with the selected table cells.
   */
  private syncRTESelection;
  /**
   * Prevents text selection during drag operations.
   *
   * @param {RTETableCellBlock[]} selectedCells - The currently selected table cells.
   */
  private preventTextSelection;
  /**
   * Adds a mouse up listener to the document to finish drag selection.
   *
   */
  private addListeners;
  /**
   * Handles the document mouse up event to finish drag selection.
   */
  private handleDocMouseUp;
  /**
   * Resets the table selection when clicking outside the table.
   */
  private handleContentClick;
}
