/** * IMask-compatible pattern mask utilities. * * @see https://imask.js.org/guide.html#masked-pattern * * Default slot definitions: * - `0` — digit * - `a` — letter * - `*` — any character * * Other syntax: * - `{text}` — fixed value (included in extracted input) * - `[…]` — optional section * - `\` — escape the next character (e.g. `\0` for a literal zero) * - all other characters — fixed literals (`+`, `(`, `-`, …) */ export type MaskInputKind = 'digit' | 'letter' | 'any'; export type MaskToken = { type: 'literal'; value: string; } | { type: 'fixed'; value: string; } | { type: 'input'; definition: string; kind: MaskInputKind; pattern?: RegExp; optional?: boolean; }; export type MaskDefinitions = Record; /** Parses an IMask pattern string into tokens. */ export declare function parseMaskPattern(pattern: string, definitions?: MaskDefinitions): MaskToken[]; export declare function maskInputSlotCount(tokens: MaskToken[], options?: { requiredOnly?: boolean; }): number; /** Placeholder using IMask's default `_` for input slots. */ export declare function maskToPlaceholder(pattern: string, definitions?: MaskDefinitions): string; /** Extracts user-typed characters from a masked value (skips fixed segments and literals). */ export declare function extractMaskInput(masked: string, tokens: MaskToken[]): string; /** * Formats extracted input characters into a masked display string. * * Returns `''` when `input` is empty. */ export declare function formatWithMask(input: string, tokens: MaskToken[]): string; /** Normalizes user input to a masked display value. */ export declare function applyInputMask(raw: string, pattern: string, definitions?: MaskDefinitions): string;