/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
import { BACKGROUND_BLUR_COLOR_PREFIX, BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX, BORDER_RADIUS_PREFIX, BUTTON_SCALE_EFFECT, DROP_SHADOW_PREFIX, getShadowLayerValue, textVariantsSafe } from "../../css-tokens/dist/index.js";
import { assertUnreachable } from "../../utils/dist/assertUnreachable.js";
import { mapTextVariantFixtureToValue } from "./mapTextVariantFixtureToValue.js";
import { mapColorFixtureToValue } from "./utils/mapColorFixtureToValue.js";
import { SCALE_EFFECTS } from "../../motion-tokens/dist/index.js";
//#region ../automated-config/dist/properties.js
/*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
const isInputWrapperCtx = (context) => {
	return context.componentName === "input" && context.layer === "inputWrapper";
};
const hexToRgb = (hex) => {
	hex = hex.replace("#", "");
	if (hex.length === 3) hex = hex.split("").map((char) => char + char).join("");
	return `${parseInt(hex.substring(0, 2), 16)} ${parseInt(hex.substring(2, 4), 16)} ${parseInt(hex.substring(4, 6), 16)}`;
};
const backgroundColor = {
	name: "backgroundColor",
	cssProperties: "background-color",
	twThemePath: () => {
		return ``;
	},
	possibleFixtures: [
		"backgroundPaletteColors",
		"spectrumColors",
		"alwaysPaletteAliases",
		"elevationAliases"
	],
	customValueRenderer: ({ value, type }, schema, theme) => {
		if (type === "elevationAliases") return `var(--uds-background-color-${value})`;
		return theme(mapColorFixtureToValue(type, value));
	}
};
const color = {
	name: "color",
	cssProperties: "color",
	twThemePath: mapColorFixtureToValue,
	possibleFixtures: [
		"alwaysPaletteAliases",
		"spectrumColors",
		"foregroundPaletteColors"
	]
};
const fontSize = {
	name: "fontSize",
	cssProperties: "font-size",
	twThemePath: mapTextVariantFixtureToValue("fontSize"),
	possibleFixtures: ["textVariants"]
};
const fontVariationSettings = {
	name: "fontVariationSettings",
	cssProperties: "font-variation-settings",
	twThemePath: () => {
		return ``;
	},
	possibleFixtures: ["textVariants"],
	customValueRenderer: (schemaValue) => {
		const { value: rawValue } = schemaValue;
		const value = textVariantsSafe(rawValue);
		return `"wght" var(--uds-font-weight-${value}), "slnt" var(--uds-font-slant-${value}), "ital" var(--uds-font-slant-${value}), "wdth" var(--uds-font-width-${value})`;
	}
};
const fontWeight = {
	name: "fontWeight",
	cssProperties: "font-weight",
	twThemePath: mapTextVariantFixtureToValue("fontWeight"),
	possibleFixtures: ["textVariants"]
};
const fontFamily = {
	name: "fontFamily",
	cssProperties: "font-family",
	twThemePath: mapTextVariantFixtureToValue("fontFamily"),
	possibleFixtures: ["textVariants"]
};
const textTransform = {
	name: "textTransform",
	cssProperties: "text-transform",
	twThemePath: mapTextVariantFixtureToValue("textTransform"),
	possibleFixtures: ["textVariants"]
};
const lineHeight = {
	name: "lineHeight",
	cssProperties: "line-height",
	twThemePath: mapTextVariantFixtureToValue("lineHeight"),
	possibleFixtures: ["textVariants"]
};
const letterSpacing = {
	name: "letterSpacing",
	cssProperties: "letter-spacing",
	twThemePath: mapTextVariantFixtureToValue("letterSpacing"),
	possibleFixtures: ["textVariants"]
};
const textVariant = {
	name: "textVariant",
	cssProperties: [],
	twThemePath: () => {
		return ``;
	},
	possibleFixtures: ["textVariants"],
	extendedProperties: [
		"fontSize",
		"fontWeight",
		"fontFamily",
		"lineHeight",
		"textTransform",
		"fontVariationSettings",
		"letterSpacing"
	]
};
const textDecorationLine = {
	name: "textDecorationLine",
	cssProperties: "text-decoration-line",
	possibleFixtures: ["textDecorationLines"],
	twThemePath: () => {
		return ``;
	},
	customValueRenderer: (schemaValue) => {
		return String(schemaValue.value);
	}
};
const gap = {
	name: "gap",
	cssProperties: "gap",
	twThemePath: (fixtureType, value) => fixtureType === "spacingAliases" ? `spacing[${value}]` : "",
	possibleFixtures: ["spacingAliases"]
};
const borderWidth = {
	name: "borderWidth",
	cssProperties: "border-width",
	twThemePath: (fixtureType, value) => {
		switch (fixtureType) {
			case "borderWidths":
			case "elevationAliases": return `udsBorderWidth[${value}]`;
			case "spacingAliases": return `spacing[${value}]`;
		}
		return assertUnreachable(fixtureType);
	},
	possibleFixtures: [
		"borderWidths",
		"spacingAliases",
		"elevationAliases"
	],
	extendedProperties: (context) => {
		if (isInputWrapperCtx(context)) return [
			"outlineWidth",
			"insetOutlineOffset",
			"solidOutline"
		];
		return false;
	}
};
const strokeWidth = {
	...borderWidth,
	name: "strokeWidth",
	cssProperties: "stroke-width"
};
const underlineWidth = {
	...borderWidth,
	name: "underlineWidth",
	cssProperties: "border-bottom-width"
};
const borderColor = {
	name: "borderColor",
	cssProperties: "border-color",
	twThemePath: mapColorFixtureToValue,
	possibleFixtures: [
		"alwaysPaletteAliases",
		"spectrumColors",
		"linePaletteColors",
		"elevationAliases"
	],
	extendedProperties: (context) => {
		if (isInputWrapperCtx(context)) return ["outlineColor"];
		return false;
	}
};
const stroke = {
	...borderColor,
	name: "stroke",
	cssProperties: "stroke"
};
const underlineColor = {
	...borderColor,
	name: "underlineColor",
	cssProperties: "border-bottom-color"
};
const outlineWidth = {
	name: "outlineWidth",
	cssProperties: "outline-width",
	twThemePath: (type, value) => type === "borderWidths" ? `udsBorderWidth[${value}]` : `spacing[${value}]`,
	possibleFixtures: ["borderWidths", "spacingAliases"]
};
const solidOutline = {
	name: "solidOutline",
	cssProperties: "outline-style",
	twThemePath: () => "",
	customValueRenderer: () => "solid",
	possibleFixtures: []
};
const insetOutlineOffset = {
	name: "insetOutlineOffset",
	cssProperties: "outline-offset",
	twThemePath: () => "",
	customValueRenderer: ({ value, type }, schema, theme) => {
		return `calc(-1 * ${type === "borderWidths" ? theme(`udsBorderWidth[${value}]`) : theme(`spacing[${value}]`)})`;
	},
	possibleFixtures: ["borderWidths", "spacingAliases"]
};
const outlineColor = {
	name: "outlineColor",
	cssProperties: "outline-color",
	twThemePath: mapColorFixtureToValue,
	possibleFixtures: [
		"alwaysPaletteAliases",
		"spectrumColors",
		"linePaletteColors"
	]
};
const borderRadius = {
	name: "borderRadius",
	cssProperties: "border-radius",
	twThemePath: (_, value) => `udsBorderRadius.${value}`,
	possibleFixtures: ["borderRadii"]
};
const borderRadiusVar = {
	...borderRadius,
	name: "borderRadiusVar",
	cssProperties: `--${BORDER_RADIUS_PREFIX}`
};
const spacing = {
	name: "spacing",
	cssProperties: "padding",
	twThemePath: (_, value) => `spacing[${value}]`,
	possibleFixtures: ["spacingAliases"]
};
const spacingHorizontal = {
	name: "spacingHorizontal",
	cssProperties: ["padding-right", "padding-left"],
	twThemePath: (_, value) => `spacing[${value}]`,
	possibleFixtures: ["spacingAliases"]
};
const spacingVertical = {
	name: "spacingVertical",
	cssProperties: ["padding-top", "padding-bottom"],
	twThemePath: (_, value) => `spacing[${value}]`,
	possibleFixtures: ["spacingAliases"]
};
const spacingTop = {
	name: "spacingTop",
	cssProperties: "padding-top",
	twThemePath: (_, value) => `spacing[${value}]`,
	possibleFixtures: ["spacingAliases"]
};
const spacingBottom = {
	name: "spacingBottom",
	cssProperties: "padding-bottom",
	twThemePath: (_, value) => `spacing[${value}]`,
	possibleFixtures: ["spacingAliases"]
};
const horizontalMargin = {
	name: "horizontalMargin",
	cssProperties: ["margin-left", "margin-right"],
	twThemePath: (_, value) => `spacing[${value}]`,
	possibleFixtures: ["spacingAliases"]
};
const bottomMargin = {
	name: "bottomMargin",
	cssProperties: "margin-bottom",
	twThemePath: (_, value) => `spacing[${value}]`,
	possibleFixtures: ["spacingAliases"]
};
const height = {
	name: "height",
	cssProperties: "height",
	twThemePath: (_, value) => {
		return `height[${value}]`;
	},
	possibleFixtures: ["spacingAliases"]
};
const width = {
	name: "width",
	cssProperties: "width",
	twThemePath: (_, value) => `width[${value}]`,
	possibleFixtures: ["spacingAliases"]
};
const shadow = {
	name: "drop shadow",
	cssProperties: "box-shadow",
	twThemePath: () => {
		return ``;
	},
	concatenate: true,
	customValueRenderer: (schemaValue) => {
		const shadowType = "drop";
		const noneValue = "0 0 0 transparent";
		if (schemaValue.valueType === "alias") {
			const noneValue = "0 0 0 transparent";
			if (schemaValue.value === "none") return noneValue;
			if (schemaValue.value !== "custom") return `var(--uds-${shadowType}-shadow-${schemaValue.value})`;
		} else if (schemaValue.valueType === "custom") return schemaValue.value.map((preset, index) => getShadowLayerValue({
			preset,
			shadowType,
			prefix: index > 0 ? `${index + 1}` : void 0
		}))?.join(", ") || noneValue;
		throw new Error("Invalid valueType");
	},
	possibleFixtures: [
		"shadowVariants",
		"shadowVariantConfig",
		"elevationAliases"
	]
};
const insetShadow = {
	name: "inset shadow",
	cssProperties: "box-shadow",
	twThemePath: () => {
		return ``;
	},
	concatenate: true,
	customValueRenderer: (schemaValue) => {
		const shadowType = "inset";
		const noneValue = "0 0 0 transparent";
		if (schemaValue.valueType === "alias") {
			const noneValue = "0 0 0 transparent";
			if (schemaValue.value === "none") return noneValue;
			if (schemaValue.value !== "custom") return `var(--uds-${shadowType}-shadow-${schemaValue.value})`;
		} else if (schemaValue.valueType === "custom") return schemaValue.value.map((preset, index) => getShadowLayerValue({
			preset,
			shadowType,
			prefix: index > 0 ? `${index + 1}` : void 0
		}))?.join(", ") || noneValue;
		throw new Error("Invalid valueType");
	},
	possibleFixtures: ["shadowVariantsWithInvert"]
};
const shadowVar = {
	...shadow,
	name: "shadowVar",
	cssProperties: `--${DROP_SHADOW_PREFIX}`
};
const opacity = {
	name: "opacity",
	cssProperties: "opacity",
	twThemePath: (_, value) => `opacity[${value}]`,
	possibleFixtures: ["opacitySteps"]
};
const fillOpacity = {
	name: "fillOpacity",
	cssProperties: "fill-opacity",
	twThemePath: (_, value) => `opacity[${value}]`,
	possibleFixtures: ["opacitySteps"]
};
const iconSize = {
	name: "iconSize",
	cssProperties: ["width", "height"],
	twThemePath: (_, value) => `sizing.icon.${value}`,
	possibleFixtures: ["iconSizes"]
};
const scaleEffect = {
	name: "scaleEffect",
	cssProperties: BUTTON_SCALE_EFFECT,
	possibleFixtures: ["scaleEffects"],
	twThemePath: () => {
		return ``;
	},
	customValueRenderer: (schemaValue) => {
		const value = schemaValue.value;
		return String(SCALE_EFFECTS[String(value)] ?? SCALE_EFFECTS.none);
	}
};
const blurBackgroundColor = {
	...backgroundColor,
	name: "blurBackgroundColor",
	cssProperties: `--${BACKGROUND_BLUR_COLOR_PREFIX}`
};
const backdropBlur = {
	name: "backdropBlur",
	possibleFixtures: ["positiveIntegers"],
	cssProperties: "--uds-backdrop-blur",
	twThemePath: () => {
		return ``;
	},
	customValueRenderer: (schemaValue, schema, _theme, originalPropertyDefinition) => {
		if (originalPropertyDefinition && originalPropertyDefinition.layerReference) {
			const { variablePath, propertyName } = originalPropertyDefinition.layerReference;
			const property = schema.variables[variablePath][propertyName].rest;
			if (property.type === "elevationAliases") return `var(--uds-background-blur-radius-${property.value})`;
		}
		return schemaValue.value === 0 ? "none" : `blur(${schemaValue.value}px)`;
	}
};
const blurBackgroundColorFallback = {
	...backgroundColor,
	name: "blurBackgroundColorFallback",
	cssProperties: `--${BACKGROUND_BLUR_FALLBACK_COLOR_PREFIX}`
};
const buttonSize = {
	name: "buttonSize",
	cssProperties: "--uds-button-size",
	possibleFixtures: ["buttonSizes"],
	twThemePath: () => {
		return ``;
	},
	customValueRenderer: (schemaValue) => {
		return String(schemaValue.value);
	}
};
const buttonVariant = {
	name: "buttonVariant",
	cssProperties: "--uds-button-variant",
	possibleFixtures: ["buttonVariantsFlat"],
	twThemePath: () => {
		return ``;
	},
	customValueRenderer: (schemaValue) => {
		return String(schemaValue.value);
	}
};
const iconVariant = {
	name: "iconVariant",
	cssProperties: "--uds-icon-variant",
	possibleFixtures: ["iconVariants"],
	twThemePath: () => {
		return ``;
	},
	customValueRenderer: (schemaValue) => {
		return String(schemaValue.value);
	}
};
const paginationWidthVar = {
	name: "paginationWidthVar",
	cssProperties: "--uds-pagination-control-size",
	possibleFixtures: ["positiveIntegers"],
	twThemePath: (_, value) => `${value}px`
};
const publicProperties = {
	backgroundColor,
	borderWidth,
	underlineWidth,
	strokeWidth,
	borderRadius,
	borderRadiusVar,
	borderColor,
	underlineColor,
	stroke,
	buttonSize,
	buttonVariant,
	fontFamily,
	fontSize,
	fontVariationSettings,
	lineHeight,
	textTransform,
	letterSpacing,
	gap,
	color,
	opacity,
	fillOpacity,
	fontWeight,
	iconSize,
	spacing,
	iconVariant,
	horizontalMargin,
	bottomMargin,
	spacingHorizontal,
	spacingVertical,
	spacingTop,
	spacingBottom,
	textVariant,
	textDecorationLine,
	shadow,
	shadowVar,
	insetShadow,
	bannerInnerShadow: {
		name: "bannerInnerShadow",
		cssProperties: "box-shadow",
		twThemePath: () => {
			return ``;
		},
		possibleFixtures: ["bannerInnerShadowOptions"],
		customValueRenderer: (schemaValue) => {
			const noneValue = "0 0 0 transparent";
			if (schemaValue.value === "none") return noneValue;
			if (schemaValue.value === "subtle") return getShadowLayerValue({
				preset: {
					offsetX: "0",
					offsetY: "-5",
					blur: "5",
					spread: "-2.5",
					opacity: "5",
					color: {
						type: "spectrum",
						value: "carbon-12"
					}
				},
				shadowType: "inset",
				cssVarPrefix: "--uds-banner-inset-shadow-"
			});
			throw new Error("Invalid bannerInnerShadow value");
		}
	},
	height,
	width,
	scaleEffect,
	backdropBlur,
	blurBackgroundColor,
	blurBackgroundColorFallback,
	scrimBackgroundColor: {
		name: "scrimBackgroundColor",
		cssProperties: "--uds-scrim-background-color",
		twThemePath: () => {
			return ``;
		},
		possibleFixtures: [
			"backgroundPaletteColors",
			"spectrumColors",
			"alwaysPaletteAliases"
		],
		customValueRenderer: ({ value, type }, schema, theme) => {
			const resolved = theme(mapColorFixtureToValue(type, value));
			if (resolved.startsWith("#")) return hexToRgb(resolved) ?? resolved;
			if (resolved.startsWith("rgb(") && resolved.endsWith(")")) return resolved.slice(4, -1);
			return resolved;
		}
	},
	scrimOpacity: {
		...opacity,
		name: "scrimOpacity",
		cssProperties: "--uds-scrim-opacity",
		twThemePath: () => "",
		customValueRenderer: ({ value }) => `${String(value)}%`
	},
	paginationWidthVar
};
const internalProperties = {
	outlineWidth,
	outlineColor,
	insetOutlineOffset,
	solidOutline
};
const configurableProperties = {
	...publicProperties,
	...internalProperties
};
//#endregion
export { configurableProperties };
