import { Value, Renderable } from '@tempots/dom';
import { Merge } from '@tempots/std';
import { InputOptions } from './input-options';
export type MaskToken = {
    type: 'literal';
    char: string;
} | {
    type: 'pattern';
    name?: string;
    pattern: RegExp;
    optional?: boolean;
    transform?: (char: string) => string;
} | {
    type: 'any';
    optional?: boolean;
    transform?: (char: string) => string;
};
export type Mask = string | Array<string | RegExp | MaskToken> | null;
export interface PipeMeta {
    raw: string;
    previousConformed: string;
    cursor: number;
    completed: boolean;
}
export type PipeResult = string | {
    value: string;
    cursor?: number;
} | false;
export interface UnmaskOptions {
    strategy?: 'none' | 'strip' | 'custom';
    unmask?: (conformed: string) => string;
}
export interface CompletionOptions {
    mode?: 'mask' | 'min' | 'custom';
    minChars?: number;
    isComplete?: (conformed: string) => boolean;
}
export interface CursorBehavior {
    policy?: 'smart' | 'sticky';
    backspaceRubberBand?: boolean;
}
export interface PlaceholderOptions {
    guide?: boolean;
    placeholderChar?: string;
    keepCharPositions?: boolean;
}
export interface MaskDictionary {
    [symbol: string]: {
        pattern: RegExp;
        optional?: boolean;
        transform?: (char: string) => string;
    };
}
export type DynamicMask = (raw: string, meta: PipeMeta) => Mask;
export interface MaskedInputOptions {
    value?: string;
    defaultValue?: string;
    mask: Value<Mask | DynamicMask>;
    definitions?: Value<MaskDictionary>;
    useDefaultDefinitions?: Value<boolean>;
    placeholder?: Value<string>;
    placeholderOptions?: Value<PlaceholderOptions>;
    extraLiterals?: Value<string[]>;
    prefix?: Value<string>;
    suffix?: Value<string>;
    autofix?: Value<'none' | 'pad' | 'truncate'>;
    autoclear?: Value<boolean>;
    cursor?: Value<CursorBehavior>;
    pipe?: (conformed: string, meta: PipeMeta) => PipeResult;
    completion?: Value<CompletionOptions>;
    unmask?: Value<UnmaskOptions>;
    allowMode?: Value<'all' | 'digits' | 'letters' | 'alphanumeric' | 'custom'>;
    allow?: (char: string) => boolean;
    maxLengthHard?: Value<number>;
    debounceMs?: Value<number>;
    compositionSafe?: Value<boolean>;
    onAccept?: (next: {
        raw: string;
        conformed: string;
        completed: boolean;
        cursor: number;
        numericParsed?: number;
    }) => void;
    onComplete?: (finalValue: {
        raw: string;
        conformed: string;
        numericParsed?: number;
    }) => void;
}
export type MaskInputOptions = Merge<InputOptions<string>, Omit<MaskedInputOptions, 'value' | 'defaultValue' | 'onAccept' | 'onComplete'> & {
    onAccept?: MaskedInputOptions['onAccept'];
    onComplete?: MaskedInputOptions['onComplete'];
}>;
export declare const MaskInput: (options: MaskInputOptions) => Renderable;
