import { VegaRTEAnnotations } from '../../interface';
import { Nullable } from '../../../../types/general';
import { RTEFilterInlineStylesResult } from '../../interface';
import { RTEBlock } from '../blocks/block.abstract';
import { RTENode } from '../nodes/node.abstract';
export declare type RTEFilterStyles = Record<string, string>;
/**
 * Abstract strategy class for filtering default styles in the rich text editor.
 * Concrete strategies define which styles to strip via `stylesToBeFiltered`.
 *
 * This base is shared by two kinds of concrete strategies:
 *   1. Block/node output strategies – filter inline styles when converting DTO → HTML.
 *   2. Annotation parsing strategies – strip redundant defaults when converting HTML → DTO.
 */
export declare abstract class RTEFilterStylesStrategy {
  /**
   * Used for generate the style text, all styles should inside the content container.
   * For example, if the style text is .v-rte-title {font-size: 24px;} the final generated style text should be .vega-rte-content .v-rte-title {font-size: 24px;} to make sure the styles are only applied to the elements inside the content container.
   */
  static RTE_CONTENT_CONTAINER_CLASS_NAME: string;
  /**
   * The class name to be added to the element if the styles are successfully filtered. This should be defined in the concrete implementation of the strategy if needed.
   * After the class name is added to the element, it will be removed in the next refill process to avoid redundant class names.
   * The class name will only be added when the styles are successfully extracted, which means the expected styles are present in the full styles object and have been deleted from it.
   */
  protected classNameToBeAdded: string;
  /**
   * The styles that the strategy is responsible for filtering.
   * Must be defined in each concrete implementation.
   */
  protected abstract stylesToBeFiltered: RTEFilterStyles;
  /**
   * Removes matched default styles from the `customStyle` property of the given annotations object.
   * If all custom styles are defaults, the `customStyle` key is deleted entirely.
   *
   * @param {VegaRTEAnnotations} annotations - The annotations object (mutated in place).
   * @returns {VegaRTEAnnotations} The same annotations reference.
   */
  filterAnnotations(annotations: VegaRTEAnnotations): VegaRTEAnnotations;
  /**
   * Filters and deletes the matched styles from the full styles object, add the corresponding class name if necessary, and returns the result.
   *
   * @param {RTEFilterStyles} fullStyles - The full set of styles to filter.
   * @param {string[]} classNames - The class names to consider.
   * @returns {RTEFilterInlineStylesResult} The filtered styles and class names.
   */
  filterAndDeleteStyles(fullStyles: Nullable<RTEFilterStyles>, classNames: Nullable<string[]>): RTEFilterInlineStylesResult;
  /**
   * Refills the external styles for a given HTML element based on a matched external style rule.
   *
   * @param {HTMLElement} element - The HTML element to apply the styles to. The element's existing styles will be merged with the matched rule's styles, and the matched class name will be removed from the element.
   */
  refillStyles(element: HTMLElement): void;
  /**
   * Determines if the strategy can filter the given block or node instance.
   * Return false by default, concrete strategies should override this method to specify the filtering logic based on the block or node instance's properties, such as its type or annotations.
   *
   * @param {RTEBlock | RTENode} _blockOrNodeInstance - The block or node instance to check.
   * @returns {boolean} True if the strategy can filter the instance, false otherwise.
   */
  canFilter(_blockOrNodeInstance: RTEBlock | RTENode): boolean;
  /**
   * Determines if the strategy can refill styles for the given block or node class name and element.
   * Return false by default to avoid unnecessary refill attempts, concrete strategies should override this method to specify the refilling logic based on the class name and element properties, such as the presence of certain attributes or existing styles.
   *
   * @param {string} _blockOrNodeClassName - The class name of the block or node.
   * @param {HTMLElement} _element - The HTML element to apply the styles to.
   * @returns {boolean} True if the strategy can refill styles, false otherwise.
   */
  canRefill(_blockOrNodeClassName: string, _element: HTMLElement): boolean;
  /**
   * Generates the CSS text to be applied to the element based on the strategy's styles to filter. This method should be implemented in the concrete strategy class to return the appropriate CSS text for the styles it handles.
   * Return an empty string by default to avoid applying any styles when the method is not implemented in a concrete strategy.
   *
   * @returns {string} The CSS text to be applied to the element.
   */
  toCssText(): string;
  /**
   * Whether this strategy should always filter, regardless of `autoMatchFormat`.
   * Override to `true` when the filtered styles are always emitted as inline
   * styles by the DTO (e.g. image `vertical-align`), so stripping them from
   * `customStyle` is always safe.
   *
   * Defaults to `false` – the strategy only runs when `autoMatchFormat` is enabled.
   * Used before invoke the filterAnnotations method.
   *
   * @returns {boolean} Whether filtering should always apply.
   */
  get alwaysFilter(): boolean;
  /**
   * Removes configured default style properties from the target styles object.
   * Only properties whose value matches the configured default exactly are deleted.
   *
   * @param {Nullable<RTEFilterStyles>} styles - The styles object to mutate.
   * @returns {boolean} `true` if at least one style was extracted.
   */
  protected extractAndDeleteMatchedStyles(styles: Nullable<RTEFilterStyles>): boolean;
  /**
   * Converts the styles map to a CSS text string.
   *
   * @param {string} tagName The HTML tag name.
   * @param {string} [className] The optional class name.
   * @returns {string} The CSS text string.
   */
  protected buildCssTextForStyles(tagName: string, className?: string): string;
  /**
   * Converts the styles map to a CSS text string.
   *
   * @param {RTEFilterStyles} [styles] The styles to convert. If not provided, the strategy's stylesToBeFiltered will be used.
   * @returns {string} The CSS text string.
   */
  protected convertStylesMapToCssText(styles?: RTEFilterStyles): string;
  /**
   * Check if the styles of the block or node instance match the default paragraph styles.
   *
   * @param {RTEBlock | RTENode} blockOrNodeInstance - The block or node instance to check.
   * @param {string[]} [checkedKeys] - Optional array of style keys to check. If not provided, all keys in stylesToBeFiltered will be checked.
   * @returns {boolean} - True if the styles match the default paragraph styles, false otherwise.
   */
  protected isBlockOrNodeStylesMatchFilterStyles(blockOrNodeInstance: RTEBlock | RTENode, checkedKeys?: string[]): boolean;
  /**
   * Checks if the given itemStyles match the default paragraph styles.
   *
   * @param {RTEFilterStyles} itemStyles - The styles to check against the default paragraph styles.
   * @param {string[]} [checkedKeys] - Optional array of style keys to check. If not provided, all keys in stylesToBeFiltered will be checked.
   * @returns {boolean} - True if the itemStyles match the default paragraph styles, false otherwise.
   */
  protected isMatchFilterStyles(itemStyles: RTEFilterStyles, checkedKeys?: string[]): boolean;
}
