"use client";
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
const require_index = require('../../css-tokens/dist/index.cjs');
const require_index$1 = require('../../motion-tokens/dist/index.cjs');
const require_components_experimental_client_AvoidMotionLibraryProvider = require('../experimental/client/AvoidMotionLibraryProvider.cjs');
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
let motion_react = require("motion/react");

//#region src/components/client/SpringMotionConfig.tsx
const LAYOUT_VARIANT = require_index$1.SPRING_MOTION_DEFAULTS.layoutVariant;
const LAYOUT_SPEED = require_index$1.SPRING_MOTION_DEFAULTS.layoutSpeed;
const COLOR_VARIANT = require_index$1.SPRING_MOTION_DEFAULTS.colorVariant;
const COLOR_SPEED = require_index$1.SPRING_MOTION_DEFAULTS.colorSpeed;
const defaultLoadFeatures = () => import("@yahoo/uds/__private/motionFeatures/domAnimation").then(({ domAnimation }) => domAnimation);
/**
* **🎬 Spring Motion Config to define motion animations for all UDS components**
*
* @componentType Client component
*
* @description
* The SpringConfig component provides a way to configure the spring animations for the entire application.
* This component provides a way to use uds motion configs with Framer Motion.
*/
function SpringMotionConfig({ children, reducedMotion = "user", loadFeatures = defaultLoadFeatures, layoutVariant = LAYOUT_VARIANT, layoutSpeed = LAYOUT_SPEED, colorVariant = COLOR_VARIANT, colorSpeed = COLOR_SPEED }) {
	const initialLayoutConfig = require_index$1.motion[layoutVariant][layoutSpeed];
	const initialColorConfig = require_index$1.motion[colorVariant][colorSpeed];
	const [layoutConfig, setLayoutConfig] = (0, react.useState)(initialLayoutConfig);
	const [colorConfig, setColorConfig] = (0, react.useState)(initialColorConfig);
	const colorVarConfig = {
		variant: colorVariant,
		speed: colorSpeed
	};
	const colorStiffnessVar = require_index.getMotionVar({
		...colorVarConfig,
		control: "stiffness"
	});
	const colorDampingVar = require_index.getMotionVar({
		...colorVarConfig,
		control: "damping"
	});
	const layoutVarConfig = {
		variant: layoutVariant,
		speed: layoutSpeed
	};
	const layoutStiffnessVar = require_index.getMotionVar({
		...layoutVarConfig,
		control: "stiffness"
	});
	const layoutDampingVar = require_index.getMotionVar({
		...layoutVarConfig,
		control: "damping"
	});
	(0, react.useEffect)(() => {
		const globalComputedStyles = getComputedStyle(document.documentElement);
		const layoutValues = {
			type: "spring",
			damping: Number(globalComputedStyles.getPropertyValue(layoutDampingVar)),
			stiffness: Number(globalComputedStyles.getPropertyValue(layoutStiffnessVar))
		};
		const colorValues = {
			type: "spring",
			damping: Number(globalComputedStyles.getPropertyValue(colorDampingVar)),
			stiffness: Number(globalComputedStyles.getPropertyValue(colorStiffnessVar))
		};
		setLayoutConfig(layoutValues);
		setColorConfig(colorValues);
	}, [
		colorDampingVar,
		colorStiffnessVar,
		layoutDampingVar,
		layoutStiffnessVar
	]);
	const transition = (0, react.useMemo)(() => ({
		type: "spring",
		mass: 1,
		...layoutConfig,
		layout: layoutConfig,
		opacity: colorConfig,
		color: colorConfig,
		borderColor: colorConfig,
		backgroundColor: colorConfig
	}), [colorConfig, layoutConfig]);
	if (require_components_experimental_client_AvoidMotionLibraryProvider.useAvoidMotionLibrary()) return children;
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.LazyMotion, {
		features: loadFeatures,
		strict: true,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.MotionConfig, {
			transition,
			reducedMotion,
			children
		})
	});
}
SpringMotionConfig.displayName = "SpringMotionConfig";

//#endregion
exports.SpringMotionConfig = SpringMotionConfig;