/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
import { entries } from "../packages/utils/dist/entries.js";
import { getShadowLayerValue } from "../packages/css-tokens/dist/index.js";
//#region ../tailwind-internal/dist/utils/getShadowPresetValues.js
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
/**
* Generate shadow values from the shadow config presets.
* Each size can have multiple shadow presets that are combined into a single box-shadow.
*
* For regular shadows:
* - Uses the outer shadow configuration from the shadow config
* - Uses CSS variables with the --uds-shadow-* prefix for shadow properties
* - The first shadow uses default variable names, subsequent shadows are numbered (e.g. --uds-shadow-2-*)
* - Shadow colors are scoped to the element, allowing for instance-specific colors
*
* For inset shadows:
* - Uses the inner shadow configuration from the shadow config
* - Uses CSS variables with the --uds-inset-shadow-* prefix for shadow properties
* - Adds the 'inset' keyword to each shadow value
* - Shadow colors are scoped to the element, allowing for instance-specific colors
*
* This approach ensures that both regular and inset shadows use the correct CSS variables
* set by the shadow utilities, while allowing for instance-specific color customization.
* The separation of variable namespaces allows both shadow types to be used together on the same element.
*
* When both shadow and inset-shadow utilities are used together on an element,
* they combine to create a box-shadow with both outer and inner shadows.
*
* @returns A record of shadow values by size (xs, sm, md, etc.)
*/
function getShadowPresetValues({ config, shadowType }) {
	const presets = config?.shadow?.[shadowType];
	if (!presets) return {};
	const result = {};
	entries(presets).forEach(([key, presetArray]) => {
		if (key === "none") {
			result[`--uds-${shadowType}-shadow-${key}`] = "0 0 transparent";
			return;
		}
		const shadowValues = presetArray.map((preset, index) => getShadowLayerValue({
			preset,
			prefix: index > 0 ? `${index + 1}` : void 0,
			shadowType
		}));
		result[`--uds-${shadowType}-shadow-${key}`] = `${shadowValues.join(", ")}`;
	});
	return result;
}
//#endregion
export { getShadowPresetValues };
