/**
 * Animation utilities for chart components
 *
 * Provides shared spring animation presets and helper functions
 * to ensure consistent animations across all chart components.
 */
/**
 * Spring animation presets for circular charts
 *
 * These presets define the physics of spring animations:
 * - stiffness: How quickly the animation reaches its target (higher = faster)
 * - damping: How much the animation oscillates (lower = more bouncy)
 */
const SPRING_PRESETS = {
    /**
     * Smooth animation - balanced and natural
     * Best for: DonutChart, ActivityRings
     */
    smooth: {
        stiffness: 80,
        damping: 20,
    },
    /**
     * Bouncy animation - more playful with slight overshoot
     * Best for: GaugeChart needle, interactive elements
     */
    bouncy: {
        stiffness: 60,
        damping: 15,
    },
    /**
     * Quick animation - fast and snappy
     * Best for: Small updates, micro-interactions
     */
    quick: {
        stiffness: 120,
        damping: 25,
    },
    /**
     * Slow animation - gentle and deliberate
     * Best for: Large value changes, presentations
     */
    slow: {
        stiffness: 50,
        damping: 25,
    },
};
/**
 * Get spring animation configuration for circular charts
 *
 * @param preset - The animation preset to use
 * @param shouldReduceMotion - Whether to respect reduced motion preferences
 * @param delay - Optional delay before animation starts (in seconds)
 * @returns Animation configuration object for motion components
 *
 * @example
 * ```tsx
 * const animation = getSpringAnimation('smooth', shouldReduceMotion, 0.2);
 * <motion.circle
 *   animate={...}
 *   transition={animation}
 * />
 * ```
 */
function getSpringAnimation(preset = 'smooth', shouldReduceMotion = false, delay) {
    if (shouldReduceMotion) {
        return { duration: 0 };
    }
    const config = SPRING_PRESETS[preset];
    return {
        type: 'spring',
        stiffness: config.stiffness,
        damping: config.damping,
        ...(delay !== undefined && { delay }),
    };
}
/**
 * Create staggered animation delay for multiple elements
 *
 * @param index - The element index
 * @param staggerDelay - The delay between each element (in seconds)
 * @returns The calculated delay for this element
 *
 * @example
 * ```tsx
 * rings.map((ring, index) => (
 *   <motion.circle
 *     transition={{ ...springConfig, delay: getStaggerDelay(index, 0.1) }}
 *   />
 * ))
 * ```
 */
function getStaggerDelay(index, staggerDelay = 0.1) {
    return index * staggerDelay;
}
/**
 * Pre-configured animation settings for specific circular chart types
 */
const CIRCULAR_CHART_ANIMATIONS = {
    /**
     * DonutChart: Smooth spring animation with slight delay
     */
    donut: {
        preset: 'smooth',
        initialDelay: 0.2,
    },
    /**
     * ActivityRings: Smooth spring with staggered rings
     */
    activityRings: {
        preset: 'smooth',
        staggerDelay: 0.1,
        centerLabelDelay: 0.3,
    }};

export { CIRCULAR_CHART_ANIMATIONS, SPRING_PRESETS, getSpringAnimation, getStaggerDelay };
