/**
 * Shared Input System v2 — Public API
 *
 * Single entry point for the shared pointer + keyboard input pipeline.
 */

// --- Types ---
export type {
	GestureType,
	PointerGestureType,
	PointerGesturePhase,
	KeyInputPhase,
	InputPhase,
	GestureSubject,
	SubjectKind,
	PointerGestureEvent,
	KeyInputEvent,
	InputEvent,
	GestureEvent,
	InputPattern,
	GesturePattern,
	Binding,
	MappingContext,
	GuardContext,
	ResolvedAction,
	ActionHandler,
	PhaseHandler,
	Modifiers,
	HeldKeysState,
	HeldKeysPattern,
	Button,
	Vec2,
	InputSource,
	InputMode,
	KeyboardInteractionMode,
} from './types';
export { NO_HELD_KEYS, NO_MODIFIERS, isKeyInputEvent, isPointerGestureEvent } from './types';

// --- Layer 1: Normalize ---
export { normalizePointer, extractModifiers } from './normalize';

// --- Layer 2: Recognize ---
export { transition, IDLE, LONG_PRESS_TIMER, SETTLE_TIMER } from './timed-state';
export { TimedStateRunner } from './timed-state-runner';

// --- Layer 3: Resolve ---
export { specificity } from './specificity';
export { buildMappingIndex, resolve, indexContext } from './mapper';
export type { MappingIndex, ContextIndex } from './mapper';

// --- Layer 3: Built-in Contexts ---
export {
	PALM_REJECTION_CONTEXT,
	ACTIVE_INTERACTION_CONTEXT,
	SEARCH_CONTEXT,
	KEYBOARD_MANIPULATE_CONTEXT,
	KEYBOARD_NAVIGATE_CONTEXT,
	DEFAULT_CONTEXT,
	PICK_NODE_CONTEXT,
	PICK_NODES_CONTEXT,
	PICK_POINT_CONTEXT,
	INPUT_MODE_CONTEXTS,
} from './contexts';

// --- Layer 4: Dispatch ---
export { registerAction, unregisterAction, getHandler, clearHandlers, dispatch } from './dispatcher';

// --- Layer 4: Inertia ---
export { PanInertia, ZoomInertia, VelocitySampler } from './inertia';

// --- Input Action Helpers (pure store functions) ---
export {
	findNearestNode,
	cycleFocus,
	navigateFocus,
	activateFocusedNode,
	nudgeSelection,
	deleteSelection,
	cutSelection,
	cancelActiveInteraction,
	escapeInput,
	getCurrentSubject,
} from './input-action-helpers';
export type { Direction } from './input-action-helpers';

// --- React Hooks ---
export { useCanvasGestures } from './useCanvasGestures';
export type { UseCanvasGesturesConfig } from './useCanvasGestures';

export { useNodeGestures } from './useNodeGestures';
export type { UseNodeGesturesConfig, NodeGestureHandlers } from './useNodeGestures';

export { useInputSystem, useGestureSystem } from './useGestureSystem';
export type { InputSystemConfig, InputSystemAPI, GestureSystemConfig, GestureSystemAPI } from './useGestureSystem';

export { useGuardContext } from './useGuardContext';
export { useInertia, snapZoom } from './useInertia';
export type { InertiaAPI } from './useInertia';

export { createWheelHandler } from './useWheelZoom';
export type { WheelZoomConfig } from './useWheelZoom';

export { createPinchHandlers } from './usePinchZoom';
export type { PinchZoomConfig } from './usePinchZoom';

export { useInputModeGestureContext } from './useInputModeGestureContext';
export { useRegisterInputActions } from './useRegisterInputActions';

// --- React Provider ---
export { InputProvider, useInputContext, GestureProvider, useGestureContext } from './GestureProvider';
export type { InputConfig, InputProviderProps, GestureConfig, GestureProviderProps } from './GestureProvider';
