import React$1, { ReactNode, CSSProperties } from 'react'; type Direction = 'up' | 'down'; type SpeedTier = 'fast' | 'normal' | 'slow' | 'turtle'; type RandomizeFn = (active: number, total: number) => number; interface SlotMachineOptions { /** Initial active element index (0-based). Default: 0 */ active?: number; /** Duration in ms of each spin. Default: 200 */ delay?: number; /** Animation direction. Default: 'up' */ direction?: Direction; /** * Custom randomize function. * Receives current active index and total item count; returns next active index. * Default: uniform random. */ randomize?: RandomizeFn; /** * Enable ease-in (acceleration) and ease-out (deceleration) phases. * When false, all ticks use constant speed. Default: true. */ easing?: boolean; /** * Duration in ms of each easing phase (ease-in at start, ease-out at stop). * Higher values = longer acceleration/deceleration. Default: 600. */ easeDuration?: number; } interface SlotMachineHandle { /** Start spinning for `spins` iterations. Use Infinity for endless spin. */ shuffle: (spins?: number) => void; /** Schedule a stop after `spins` additional iterations. Use 0 to stop immediately. */ stop: (spins?: number) => void; /** Spin to the next element. */ next: () => void; /** Spin to the previous element. */ prev: () => void; /** Current active index. */ readonly active: number; /** Whether the machine is currently spinning. */ readonly running: boolean; /** Whether the machine is in its stopping phase. */ readonly stopping: boolean; } interface SlotMachineProps { /** Array of slot items (strings, React nodes, or custom render functions). */ items: ReactNode[]; /** * Optional keys/data associated 1:1 with `items`. * When provided, the corresponding key is passed through in `onStop` * so you can identify the winner without relying on array indices. */ itemKeys?: (string | number)[]; /** * A special item shown at position 0 (the starting position). * It is never selected as a winner — only `items` are eligible. * Supports any ReactNode (string, element, fragment, etc.). */ initialItem?: ReactNode; /** SlotMachine options (active, delay, direction, randomize). */ options?: SlotMachineOptions; /** * Called when the machine stops and a winner is selected. * Receives the winning item, its index in the original `items` array, * and the corresponding `itemKeys` value (if provided). */ onStop?: (winner: { item: ReactNode; index: number; key?: string | number; }) => void; /** * Called on every shuffle iteration (useful for reactive UI updates). * Receives the index that will be active next. */ onShuffle?: (nextIndex: number) => void; /** Additional class name for the outer wrapper. */ className?: string; /** Inline styles for the outer wrapper. */ style?: CSSProperties; /** Height of the visible slot window (CSS value, e.g. '100px', '10rem'). Default: '100px'. */ slotHeight?: string; /** Width of the slot window. Default: '100%'. */ slotWidth?: string; /** Border radius of the slot window. Default: '12px'. */ borderRadius?: string; /** Background color of the visible slot area. Default: '#ffffff'. */ slotBackground?: string; /** Box shadow of the slot window. */ slotBoxShadow?: string; /** Enable gradient fade mask on top/bottom edges. Default: true. */ enableGradientMask?: boolean; /** Enable blur effects on tiles while spinning. Default: true. */ enableBlur?: boolean; /** Label for the shuffle button. Default: 'Shuffle!' */ shuffleLabel?: string; /** Label for the stop button. Default: 'Stop!' */ stopLabel?: string; /** Hide built-in buttons (you can use the imperative handle instead). */ hideButtons?: boolean; /** Custom class for the shuffle button. */ shuffleButtonClassName?: string; /** Custom class for the stop button. */ stopButtonClassName?: string; /** Custom class for the buttons container. */ buttonsClassName?: string; /** Icon element for shuffle button. */ shuffleIcon?: ReactNode; /** Icon element for stop button. */ stopIcon?: ReactNode; /** Custom class name applied to each tile wrapper. */ tileClassName?: string; } /** * React SlotMachine component — a 1:1 port of jQuery-SlotMachine. * * @example * ```tsx * console.log('Winner:', item)} * /> * ``` */ declare const SlotMachine: React$1.ForwardRefExoticComponent>; interface SlotMachineEngineOptions { active?: number; delay?: number; /** 'up' or 'down' — direction items appear to scroll. */ direction?: 'up' | 'down'; /** Custom randomize function. (active, total) => nextIndex */ randomize?: (active: number, total: number) => number; /** Enable ease-in/out phases. Default: true. */ easing?: boolean; /** Duration in ms of each easing phase. Default: 600. */ easeDuration?: number; } interface SlotMachineEngineState { /** Current visible item index. */ active: number; /** Is the machine currently spinning? */ running: boolean; /** Is the machine decelerating to a stop? */ stopping: boolean; /** Current speed tier (for blur / visual effects). */ speedTier: SpeedTier | 'stop'; /** Callbacks the engine invokes — set by the consumer. */ callbacks: React.MutableRefObject; } interface SlotMachineCallbacks { onShuffle?: (nextIndex: number) => void; onStop?: (winner: { index: number; }) => void; } interface SlotMachineEngine extends SlotMachineEngineState { shuffle: (spins?: number) => void; stop: (spins?: number) => void; next: () => void; prev: () => void; } /** * Core slot-machine engine as a React hook. * * Manages index state, spin-cycle scheduling, speed tiers, and stop logic. * The consumer (SlotMachine component) reads `active`, `running`, `stopping`, * and `speedTier` to drive CSS animations and blur effects. */ declare function useSlotMachineEngine(itemCount: number, options?: SlotMachineEngineOptions): SlotMachineEngine; export { type Direction, type RandomizeFn, SlotMachine, type SlotMachineCallbacks, type SlotMachineEngineOptions, type SlotMachineHandle, type SlotMachineOptions, type SlotMachineProps, type SpeedTier, SlotMachine as default, useSlotMachineEngine };