import type { MaskRegion, ProcessingError, RemarkMaskTextOptions, Result, ValidatedOptions } from "./types/index.js";
/** Re-export type guards from ast-types for backward compatibility */
export { isParentNode as isParent, isTextNode } from "./ast-types.js";
/**
 * Escapes special regular expression characters in a string
 *
 * This function is essential for safely using user-provided delimiters
 * in regular expressions without unintended pattern matching. It handles
 * all special regex metacharacters to ensure literal matching.
 *
 * @param text - The string to escape
 * @returns The escaped string safe for use in RegExp
 *
 * @example
 * escapeRegExp('||') // Returns '\\|\\|'
 * escapeRegExp('::') // Returns '::'
 * escapeRegExp('.*') // Returns '\\.\\*'
 */
export declare const escapeRegExp: (text: string) => string;
/**
 * Validates a delimiter string for mask processing
 *
 * Ensures the delimiter meets requirements for safe and effective processing.
 * The delimiter must be non-empty, not contain only whitespace, and not be
 * excessively long to prevent performance issues.
 *
 * @param delimiter - The delimiter to validate
 * @returns Result containing valid delimiter or validation error
 */
export declare const validateDelimiter: (delimiter: string) => Result<string, ProcessingError>;
/**
 * Validates a mask character for content replacement
 *
 * Ensures the mask character is suitable for replacing masked content.
 * Must be exactly one character and not a whitespace character.
 *
 * @param maskChar - The mask character to validate
 * @returns Result containing valid mask character or validation error
 */
export declare const validateMaskCharacter: (maskChar: string) => Result<string, ProcessingError>;
/**
 * Validates and normalizes plugin options
 *
 * Takes user-provided options and validates them, providing defaults for
 * missing values. This ensures all subsequent processing operates on
 * guaranteed-valid configuration.
 *
 * @param options - The user-provided options to validate
 * @returns Result containing validated options or validation errors
 */
export declare const validateOptions: (options: RemarkMaskTextOptions) => Result<ValidatedOptions, ProcessingError>;
/**
 * Optimized function to find all mask regions in text
 *
 * Uses String.prototype.matchAll for better performance compared to
 * exec() loops. Handles nested delimiters by processing outermost pairs first.
 * This approach provides linear time complexity and better memory efficiency.
 *
 * @param text - The text to search for mask regions
 * @param delimiter - The delimiter pattern to search for
 * @returns Result containing mask regions or processing error
 *
 * @example
 * findMaskRegionsOptimized('This is ::secret:: text', '::')
 * // Returns { ok: true, data: [{ start: 8, end: 18, content: 'secret' }] }
 */
export declare const findMaskRegionsOptimized: (text: string, delimiter: string) => Result<readonly MaskRegion[], ProcessingError>;
/**
 * Legacy function for backward compatibility
 *
 * Maintains the original API while delegating to the optimized implementation.
 * This function will be deprecated in future versions.
 *
 * @deprecated Use findMaskRegionsOptimized instead
 * @param text - The text to search for mask regions
 * @param delimiter - The delimiter pattern to search for
 * @returns Array of mask regions found in the text
 */
export declare const findMaskRegions: (text: string, delimiter: string) => MaskRegion[];
/**
 * Functional composition utility for chaining operations
 *
 * Enables elegant composition of processing functions following
 * functional programming principles.
 *
 * @param fns - Array of functions to compose
 * @returns Composed function that applies all functions in sequence
 */
export declare const pipe: <T>(...fns: ((arg: T) => T)[]) => (value: T) => T;
/**
 * Creates a memoized version of a function for performance optimization
 *
 * Useful for caching expensive computations like regex compilation.
 * Uses a simple Map-based cache with size limits to prevent memory leaks.
 *
 * @param fn - The function to memoize
 * @param maxCacheSize - Maximum number of cached results
 * @returns Memoized version of the function
 */
export declare const memoize: <TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => TReturn, maxCacheSize?: number) => (...args: TArgs) => TReturn;
