import { type xy } from "@synnaxlabs/x";
import { z } from "zod";
/** All the mouse keys that can be used in a trigger */
export declare const MOUSE_KEYS: readonly ["MouseLeft", "MouseMiddle", "MouseRight"];
export declare const mouseKeyZ: z.ZodEnum<["MouseLeft", "MouseMiddle", "MouseRight"]>;
export type MouseKey = z.infer<typeof mouseKeyZ>;
/** A list of all the alphanumeric keys that can be used in a trigger i.e. 0-9, A-Z */
export declare const ALPHANUMERIC_KEYS: string[];
export declare const ALPHANUMERIC_KEYS_SET: Set<string>;
/** The set of all possible keyboard and mouse inputs that can be used in a trigger */
export declare const KEYS: readonly ["MouseLeft", "MouseMiddle", "MouseRight", ...string[], "Backspace", "Tab", "Enter", "Shift", "Control", "Alt", "CapsLock", "Escape", "Space", "PageUp", "PageDown", "End", "Home", "ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", "Insert", "Delete", "ContextMenu", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24", "NumLock", "ScrollLock", "AudioVolumeMute", "AudioVolumeDown", "AudioVolumeUp", "AudioTrackNext", "AudioTrackPrevious", "AudioStop", "AudioPlay", "AudioPause", "AudioRewind", "AudioForward", "AudioRepeat", "AudioRandomPlay", "AudioSelect", "LaunchMail", "LaunchApp2", "LaunchApp1", "SelectTask", "LaunchScreenSaver", "BrowserSearch", "BrowserHome", "BrowserBack", "BrowserForward", "BrowserStop", "BrowserRefresh", "BrowserFavorites", "ZoomToggle", "Clear", "Power", "Eject"];
export declare const keyZ: z.ZodEnum<["MouseLeft", "MouseMiddle", "MouseRight", ...string[], string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string]>;
/** An enum of all the possible keyboard and mouse inputs that can be used in a trigger */
export type Key = z.infer<typeof keyZ>;
export declare const triggerZ: z.ZodArray<z.ZodEnum<["MouseLeft", "MouseMiddle", "MouseRight", ...string[], string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string]>, "many">;
/**
 * A sequence of unordered keyboard and mouse inputs that can be used to fire
 * a trigger. Repeated keys that represent double presses are allowed, but must be
 * placed next to each other.
 */
export type Trigger = z.infer<typeof triggerZ>;
/**
 * The stage of a trigger. The 'start' event fires when the trigger is first activated.
 * The 'during' state is only fired in hooks that track cursor movement. The 'end' state
 * is fired when the trigger is released.
 */
export type Stage = "start" | "during" | "end";
/**
 * An event fired when a trigger is activated in Triggers.use.
 */
export interface Event {
    /** The target element that the trigger was fired on. */
    target: HTMLElement;
    /** Previously held triggers that are now released. */
    prev: Trigger[];
    /** Triggers that were not previously held that are now activated. */
    next: Trigger[];
    /** The current cursor position. */
    cursor: xy.XY;
}
/** A callback that is fired when a trigger is activated. */
export type Callback = (e: Event) => void;
/** Parses the TriggerKey from the provided KeyboardEvent or MouseEvent. */
export declare const eventKey: (e: KeyboardEvent | MouseEvent | React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLElement>) => Key;
/**
 * Parses the TriggerKey from the provided KeyboardEvent.
 * @param e - The KeyboardEvent to parse.
 * @returns the TriggerKey.
 */
export declare const keyboardKey: (e: KeyboardEvent | React.KeyboardEvent<HTMLElement>) => Key;
/**
 * Converts a mouse button number to a TriggerKey.
 * @param button - The mouse button number.
 * @returns the TriggerKey.
 */
export declare const mouseKey: (button: number) => Key;
/**
 * Match compares the expected triggers against the actual triggers.
 *
 * @param expected - The reference triggers to match the actual triggers against.
 * @param actual - The actual triggers that were fired.
 * @param loose - If true, triggers in actual that are a superset of those in expected
 * will still be considered a match i.e. if expected is [["Control"]] and actual is
 * [["Control", "A"]], then match will return true.
 * @returns true if any triggers in expected match those in actual.
 *
 */
export declare const match: (expected: Trigger[], actual: Trigger[], loose?: boolean) => boolean;
/**
 * Filter compares the expected triggers against the actual triggers and returns
 * an array of triggers in expected that match those in actual.
 *
 * @param expected - The reference triggers to match the actual triggers against.
 * @param actual - The actual triggers that were fired.
 * @param loose - If true, triggers in actual that are a superset of those in expected
 * will still be considered a match i.e. if expected is [["Control"]] and actual is
 * [["Control", "A"]], then filter will return [["Control"]].
 */
export declare const filter: (expected: Trigger[], actual: Trigger[], loose?: boolean) => Trigger[];
/**
 * Removes all triggers from the source that strongly match those in toPurge.
 *
 * @param source - The source triggers to purge from.
 * @param toPurge - The triggers to purge from the source.
 * @returns the source triggers with all triggers in toPurge removed.
 */
export declare const purge: (source: Trigger[], toPurge: Trigger[]) => Trigger[];
/**
 *  Finds the difference between two sets of triggers.
 *
 * @param a - The first set of triggers.
 * @param b - The second set of triggers.
 * @returns a tuple, where the first element is the triggers in a that are not in b,
 * and the second element is the triggers in b that are not in a.
 */
export declare const diff: (a: Trigger[], b: Trigger[]) => [Trigger[], Trigger[]];
/** ModeConfig is a mapping of modes to triggers along with a default mode. */
export type ModeConfig<M extends string | number | symbol> = Record<M, Trigger[]> & {
    defaultMode: M;
};
/**
 * DetermineMode determines the mode that should be used given the provided triggers.
 * It's important to note that this object uses Object.entries to iterate over the
 * config, so the order of modes is guaranteed by the insertion order of modes into
 * the config object, or, in the case of numeric keys, the order of the keys.
 *
 * @param config - The mode config to use.
 * @param triggers - The triggers to use to determine the mode.
 * @param loose - If true, if the triggers are a superset of the triggers in a mode,
 * then that mode will be used.
 */
export declare const determineMode: <K extends string | number | symbol>(config: ModeConfig<K>, triggers: Trigger[], loose?: boolean) => K;
/**
 * A useMemoCompare function that compares two ModeConfigs.
 * @returns true if the two ModeConfigs are equal.
 */
export declare const compareModeConfigs: <K extends string | number | symbol>([a]: (ModeConfig<K> | null | undefined)[], [b]: (ModeConfig<K> | null | undefined)[]) => boolean;
/**
 * Flattens the given ModeConfig into a list of triggers, excluding the default mode.
 * @param config - The ModeConfig to flatten.
 * @returns a list of triggers.
 */
export declare const flattenConfig: <K extends string | number | symbol>(config: ModeConfig<K>) => Trigger[];
/**
 * @returns a memoized flattened config, only recomputing when the config changes.
 */
export declare const useFlattenedMemoConfig: <K extends string | number | symbol>(config: ModeConfig<K>) => Trigger[];
/** Purges all mouse keys from the given triggers. If the resulting trigger is empty,
 * it will be removed from the list of triggers. */
export declare const purgeMouse: (triggers: Trigger[]) => Trigger[];
