import { Gradient } from './spring.js';
import 'solid-js';

/**
 * Numerical Gradient Representation for Spring Physics
 *
 * This file provides the data structures and conversion functions needed
 * to apply spring physics to CSS gradients in the animation system.
 */

/**
 * Represents a color in numerical RGBA form for spring physics calculations
 */
interface NumericalColor {
    r: number;
    g: number;
    b: number;
    a: number;
}
/**
 * Represents a gradient stop in numerical form for spring physics
 */
interface NumericalGradientStop {
    position: number;
    color: NumericalColor;
}
/**
 * Represents a gradient in numerical form suitable for spring physics calculations
 */
interface NumericalGradient {
    type: number;
    angle: number;
    shape: number;
    stops: NumericalGradientStop[];
    _stringRepresentation?: string;
    _pooledGradient?: Gradient;
}
/**
 * Converts a string CSS color to a numerical representation
 *
 * @param colorStr CSS color string (hex, rgb, rgba, hsl, hsla, named)
 * @returns Color in RGBA numerical form
 */
declare function colorToNumerical(colorStr: string): NumericalColor;
/**
 * Converts a numerical color to RGBA string, applying rounding ONLY at this final stage.
 */
declare function numericalToRgbaString(color: NumericalColor): string;
/**
 * Clamps numerical color values to valid ranges WITHOUT rounding.
 * Rounding is deferred to string conversion only.
 */
declare function clampColor(color: NumericalColor): NumericalColor;
/**
 * Converts a Gradient object to numerical representation for spring physics
 */
declare function gradientToNumerical(gradient: Gradient | string): NumericalGradient;
/**
 * Parse a gradient string to a Gradient object
 */
declare function parseGradientString(gradientStr: string): Gradient | null;
/**
 * Converts a numerical gradient back to a Gradient object
 */
declare function numericalToGradient(numerical: NumericalGradient): Gradient;
/**
 * Converts a numerical gradient directly to a CSS string
 */
declare function numericalToGradientString(numerical: NumericalGradient): string;
/**
 * Safely releases a numerical gradient and its pooled resources
 */
declare function releaseNumericalGradient(numerical: NumericalGradient): void;
/**
 * Enhanced normalizeStopCount with better stop matching and preservation.
 */
declare function normalizeStopCount(current: NumericalGradient, target: NumericalGradient): NumericalGradient;
/**
 * Clean up gradient objects - important for memory management
 */
declare function cleanUpGradient(result: Gradient): void;

export { type NumericalColor, type NumericalGradient, type NumericalGradientStop, clampColor, cleanUpGradient, colorToNumerical, gradientToNumerical, normalizeStopCount, numericalToGradient, numericalToGradientString, numericalToRgbaString, parseGradientString, releaseNumericalGradient };
