import { ActionHandleStrategy } from '../../../dto/action-handle-strategies/action-handle-strategy.abstract';
import { ModifyContentAction } from '../../../dto/actions/modify-content-action.abstract';
import { RTETableBlock } from '../dto/table-block';
import { RTETableCellBlock, VegaRTETableCellBlock } from '../dto/table-cell-block';
import { RTETableHeadCellBlock, VegaRTETableHeadCellBlock } from '../dto/table-head-cell-block';
import { RTETableRowBlock } from '../dto/table-row-block';
export declare type CellToMove = {
  cell: RTETableCellBlock | RTETableHeadCellBlock;
  newRowSpan: number;
  cellIndex: number;
  logicalStartCol: number;
};
export declare type LogicalStartSpanCell = {
  cell?: RTETableCellBlock;
  rowIndex: number;
};
/**
 * Abstract base strategy for table row actions. Provides common utilities for row manipulations.
 */
export declare abstract class TableRowCommonUtilitiesStrategy<A extends ModifyContentAction, T extends RTETableBlock> extends ActionHandleStrategy<A, T> {
  static readonly DEFAULT_CELLSPAN: number;
  /**
   * Calculates the maximum number of cells in any row, accounting for colSpan.
   *
   * @param {RTETableRowBlock[]} rows - The rows to analyze.
   * @returns {number} The maximum cell count across the rows.
   */
  protected getRowsMaxCellCount(rows: RTETableRowBlock[]): number;
  /**
   * Compute logical start columns for each row's cells, accounting for colSpan and rowSpan.
   *
   * @param {RTETableRowBlock[]} rows - Table rows in a section.
   * @returns {number[][]} Array of row cell start columns by cell index.
   */
  protected getRowCellStartCols(rows: RTETableRowBlock[]): number[][];
  /**
   * Updates the rowspan/colspan attribute of a table cell.
   *
   * @param {RTETableCellBlock | RTETableHeadCellBlock} cell - The cell to update.
   * @param {'rowspan' | 'colspan'} spanKey - The attribute key to update.
   * @param {number} newSpan - The new rowspan/colspan value.
   */
  protected updateCellSpan(cell: RTETableCellBlock | RTETableHeadCellBlock, spanKey: 'rowspan' | 'colspan', newSpan: number): void;
  /**
   * Insert moved cells into target rows using logical column positions.
   *
   * @param {Map<number, CellToMove[]>} cellsToMove - Cells grouped by target row.
   * @param {RTETableRowBlock[]} allRows - All rows in the section.
   * @param {number[][]} rowCellStartCols - Logical start columns per row.
   */
  protected insertMovedCells(cellsToMove: Map<number, CellToMove[]>, allRows: RTETableRowBlock[], rowCellStartCols: number[][]): void;
  /**
   * Splits the selected rows into head rows and body rows.
   *
   * @param {RTETableRowBlock[]} rows - The rows to be split.
   * @returns {RTETableRowBlock[][]} - An array containing two arrays: the first with head rows and the second with body rows.
   */
  protected splitRowsBySection(rows: RTETableRowBlock[]): RTETableRowBlock[][];
  /**
   * Build indices for selected rows within the section.
   *
   * @param {RTETableRowBlock[]} selectedRows - Selected rows.
   * @param {RTETableRowBlock[]} allRows - All rows in the section.
   * @returns {Set<number>} The set of selected row indices.
   */
  protected buildSelectedIndices(selectedRows: RTETableRowBlock[], allRows: RTETableRowBlock[]): Set<number>;
  /**
   * Determine whether a cell's row span intersects the removal range.
   *
   * @param {number} cellStartIndex - Cell start row index.
   * @param {number} cellEndIndex - Cell end row index.
   * @param {number} firstRemovalIndex - First row index to remove.
   * @param {number} lastRemovalIndex - Last row index to remove.
   * @returns {boolean} True if the ranges intersect.
   */
  protected intersectsRemovalRange(cellStartIndex: number, cellEndIndex: number, firstRemovalIndex: number, lastRemovalIndex: number): boolean;
  /**
   * Count how many rows in the cell span are being removed.
   *
   * @param {number} cellStartIndex - Cell start row index.
   * @param {number} cellEndIndex - Cell end row index.
   * @param {Set<number>} removalIndices - Indices of rows to remove.
   * @returns {number} Count of removed rows in the span.
   */
  protected countRemovedRows(cellStartIndex: number, cellEndIndex: number, removalIndices: Set<number>): number;
  /**
   * Get the column head end index in a table row.
   *
   * @param {RTETableRowBlock} tableRow - The table row block.
   * @returns {number} The end index of the column head.
   */
  protected getHeadCellLength(tableRow: RTETableRowBlock): number;
  /**
   * Gets the starting cell for a given cell index by checking row spans.
   *
   * @param {RTETableRowBlock[]} allRows - All rows in the section to check for row spans.
   * @param {number[][]} rowsStartCols - Pre-calculated starting column indices for each cell in each row.
   * @param {number} rowIndex - The index of the row to start checking from.
   * @param {number} cellIndex - The logical cell index to find the starting cell for.
   * @returns {LogicalStartSpanCell} - The starting cell and its row index if found, otherwise the cell is undefined.
   */
  protected getTheStartSpanCell(allRows: RTETableRowBlock[], rowsStartCols: number[][], rowIndex: number, cellIndex: number): LogicalStartSpanCell;
  /**
   * Get the default cell block template.
   *
   * @param {string} cellType - The type of the cell block.
   * @param {number} colSpan - The colspan attribute for the cell.
   * @param {number} rowSpan - The rowspan attribute for the cell.
   * @returns {VegaRTETableCellBlock | VegaRTETableHeadCellBlock} The default cell block template.
   */
  protected getDefaultCellBlockTemplate(cellType: string, colSpan: number, rowSpan?: number): VegaRTETableCellBlock | VegaRTETableHeadCellBlock;
  /**
   * Convert a numeric-keyed map to an array sorted by ascending key.
   *
   * @typedef T - The type of the values in the map.
   * @param {Map<number, T>} valueMap - The map with numeric keys to convert.
   * @returns {T[]} An array of values sorted by their numeric keys.
   */
  protected getSortedValuesByNumericKey<T>(valueMap: Map<number, T>): T[];
}
