/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
const require_componentStatePseudoStates = require("./componentStatePseudoStates.cjs");
const require_resolvePropertyStates = require("./resolvePropertyStates.cjs");
const require_variantConfigGuards = require("./variantConfigGuards.cjs");
const require_getConfigComponentVariant = require("./getConfigComponentVariant.cjs");
//#region ../automated-config/dist/utils/getConfigVariantPseudoStates.js
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
/**
* Returns a map of state key → reactive properties for a variant. The state
* set comes from `resolvePropertyStates` — rest, atoms, and auto-generated
* compounds (modifier × interactive, modifier × modifier × interactive,
* etc.). The Configurator's StateBuilder caps user composition at the same
* depth, so every selectable state is in this map.
*/
function getConfigVariantPseudoStates(config, variantKey, state, subComponentName, componentStateValue) {
	const componentVariant = require_getConfigComponentVariant.getConfigComponentVariant(config, variantKey, subComponentName);
	if (!componentVariant) return null;
	const componentStateConfig = state && require_variantConfigGuards.isVariantConfigWithComponentStates(componentVariant) ? componentVariant.componentStates[state] : void 0;
	const excludedPseudoStates = componentStateConfig && componentStateValue ? require_componentStatePseudoStates.getExcludedPseudoStatesForComponentStateOption(componentStateConfig, componentStateValue) : [];
	const excludedLayers = componentStateConfig && componentStateValue ? require_componentStatePseudoStates.getExcludedLayersForComponentStateOption(componentStateConfig, componentStateValue) : [];
	const variantLayers = require_variantConfigGuards.isVariantConfigWithProperties(componentVariant) ? Object.entries(componentVariant?.layers ?? {}) : [];
	const stateLayers = require_variantConfigGuards.isVariantConfigWithComponentStates(componentVariant) && state ? Object.entries(componentVariant.componentStates[state].layers ?? {}) : [];
	const excludedLayerSet = new Set(excludedLayers);
	return [...variantLayers, ...stateLayers].filter(([layerKey]) => !excludedLayerSet.has(layerKey)).flatMap(([layerKey, layer]) => Object.entries(layer.properties).map(([propertyKey, property]) => [
		layerKey,
		layer,
		propertyKey,
		property
	])).flatMap(([layerKey, layer, propertyKey, property]) => require_componentStatePseudoStates.filterPseudoStatesByExclusion(require_resolvePropertyStates.resolvePropertyStates(layer, property), excludedPseudoStates).map((pseudoState) => [
		layerKey,
		propertyKey,
		property,
		pseudoState
	])).reduce((acc, [layerKey, propertyKey, property, pseudoState]) => {
		acc[pseudoState] = acc[pseudoState] ?? [];
		acc[pseudoState].push([
			layerKey,
			propertyKey,
			property
		]);
		return acc;
	}, {});
}
//#endregion
exports.getConfigVariantPseudoStates = getConfigVariantPseudoStates;
