/*! © 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_styles_styler = require("../styles/styler.cjs");
const require_components_Icon = require("./Icon.cjs");
let react = require("react");
react = require_runtime.__toESM(react);
let react_jsx_runtime = require("react/jsx-runtime");
let lodash_isFunction_js = require("lodash/isFunction.js");
lodash_isFunction_js = require_runtime.__toESM(lodash_isFunction_js);
//#region src/components/IconSlot.tsx
/**
* A helper container to render a SvgIcon, Icon component, or ReactNode.
*
* Useful in components that use icons and have a startIcon and endIcon. It allows
* consumers to pass in a standard UDS icon (`SvgIcon`) or a ReactNode if they
* need to override props on the icon. For example, pass an `<Icon>` to override
* the icon variant. Pass a `<IconButton>` to support interactivity on an icon slot.
*
* Examples:
* ```
* <Input startIcon={Info} />
* <Input startIcon={<Icon name={Info} variant="fill" />} />
* <Input startIcon={() => <Icon name={Info} variant="fill" />} />
* <Input endIcon={() => <IconButton name={Info} aria-label="My label" />} />
* ```
*/
const IconSlot = (0, react.memo)(function IconSlot({ icon, iconProps, className: slotClassName, ...rest }) {
	if (!icon) return null;
	const { className: iconPropsClassName, ...props } = iconProps || {};
	const mergedClassName = require_styles_styler.cx(slotClassName, iconPropsClassName);
	const svgIcon = icon;
	if (svgIcon.metadata?.isSvgIcon) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
		name: svgIcon,
		...props,
		...rest,
		className: mergedClassName
	});
	if ((0, lodash_isFunction_js.default)(icon)) {
		const iconEl = icon(iconProps || {});
		const elProps = iconEl?.props;
		return (0, react.isValidElement)(iconEl) && (0, react.cloneElement)(iconEl, {
			...rest,
			className: require_styles_styler.cx(mergedClassName, elProps?.className)
		});
	}
	const elProps = icon.props;
	return (0, react.isValidElement)(icon) && (0, react.cloneElement)(icon, {
		...props,
		...elProps,
		...rest,
		className: require_styles_styler.cx(mergedClassName, elProps.className)
	});
});
IconSlot.displayName = "IconSlot";
//#endregion
exports.IconSlot = IconSlot;
