import { Nullable } from '../../../../types/general';
import { AnnotationAction } from '../actions/annotation-action.abstract';
import { ModifyContentAction } from '../actions/modify-content-action.abstract';
import type { RTEBlock } from '../blocks/block.abstract';
import type { RTETextBlock } from '../blocks/text-block';
import type { VegaRTEContent } from '../content-state';
import type { RTENode } from '../nodes/node.abstract';
import type { RTETextNode } from '../nodes/text-node';
/**
 * The base action handle strategy class, use to modify the rich text node content or modify the annotation.
 */
export declare abstract class ActionHandleStrategy<T extends ModifyContentAction | AnnotationAction, target extends RTENode | RTEBlock | VegaRTEContent, R = void> {
  /**
   * Public method to invoke the handle logic.
   *
   * @typedef R generic type
   * @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
   * @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
   * @returns {R} - The invoke result in special strategy.
   */
  execute(action: T, target: target): R;
  /**
   * Update the custom style annotation of a block or node
   *
   * @param {RTEBlock | RTETextNode} item - block or node
   * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
   */
  protected updateCustomStyleAnnotation(item: RTEBlock | RTETextNode, styleKeys: string[]): void;
  /**
   * Create a new paragraph block with the given text.
   *
   * @param {string} text - The text content for the new paragraph.
   * @returns {Nullable<RTETextBlock>} - The newly created paragraph block, or null if creation failed.
   */
  protected createNewParagraph(text: string): Nullable<RTETextBlock>;
  /**
   * Get the root content from a child block or node.
   *
   * @param {RTEBlock | RTENode} child - The child block or node.
   * @returns {Nullable<VegaRTEContent>} The root content, if found.
   */
  protected getRootContent(child: RTEBlock | RTENode): Nullable<VegaRTEContent>;
  /**
   * Check the caret position at the start of a block.
   *
   * @param {RTEBlock} block - The RTE Block.
   * @param {RTENode} node - The RTE Node.
   * @param {number} offset - The offset position.
   * @returns {boolean} - Whether the caret is at the start of the block.
   */
  protected isCaretPositionAtBlockStart(block: RTEBlock, node: RTENode, offset: number): boolean;
  /**
   * Check the caret position at the end of a block.
   *
   * @param {RTEBlock} block - The RTE Block.
   * @param {RTENode} node - The RTE Node.
   * @param {number} offset - The offset position.
   * @returns {boolean} - Whether the caret is at the end of the block.
   */
  protected isCaretPositionAtBlockEnd(block: RTEBlock, node: RTENode, offset: number): boolean;
  /**
   * Get the registered DOM element by the RTE entity.
   *
   * @param {RTEBlock | RTENode} instance - The RTE block or node instance.
   * @returns {Nullable<HTMLElement>} The registered DOM element.
   */
  protected getDOMByEntity(instance: RTEBlock | RTENode): Nullable<HTMLElement>;
  /**
   * Checks if the caret position is at the end of a specified RTETextNode.
   *
   * @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
   * @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
   * @param {number} startOffset - The position within the text node where the caret is located.
   * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
   */
  private isCaretPositionAtTextBlockEnd;
  /**
   * Checks if the caret position is at the end of a given decorator node.
   *
   * @param {RTEBlock} target - The image block.
   * @param {RTENode} node - `node` is a RTEDecoratorNode or non-editable text node.
   * @param {number} startOffset - The position within the `RTEDecoratorNode` where the caret is located.
   * @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEDecoratorNode`.
   */
  private isCaretPositionAtDecoratorBlockEnd;
  /**
   * Determines if the custom style annotation includes any the custom style.
   *
   * @param {CustomStyleAnnotation} customStyleAnnotation - custom style annotation
   * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
   * @returns {boolean} - True if the custom key includes the custom style, false otherwise.
   */
  private isCustomStyle;
  /**
   * Update the rich text node content or annotation by the action type.
   *
   * @typedef R generic type
   * @param {ModifyContentAction | AnnotationAction} [action] - The modify action instance.
   * @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
   * @returns {R} - The invoke result in special strategy.
   */
  protected abstract handleAction(action: T, target: target): R;
}
