/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
import { createContext, useContext } from "react";
import { jsx } from "react/jsx-runtime";
//#region src/components/client/Toast/UDSToastConfigProvider.tsx
const ToastContext = createContext(void 0);
const UDSToastConfigProvider = ({ children, value }) => {
	const existingContext = useContext(ToastContext);
	const isMerge = typeof value === "object" && "type" in value && value.type === "merge";
	if (isMerge && !existingContext) throw new Error("Cannot merge context values without an existing ToastContext");
	const finalValue = isMerge ? {
		...existingContext,
		...value.value
	} : value;
	return /* @__PURE__ */ jsx(ToastContext.Provider, {
		value: finalValue,
		children
	});
};
UDSToastConfigProvider.displayName = "UDSToastConfigProvider";
const useToastConfig = (sizeProp, variantProp) => {
	const context = useContext(ToastContext);
	if (!context) throw new Error("useToastConfig must be used within a UDSConfigProvider or UDSToastConfigProvider");
	const { defaultSize, defaultVariant, textVariant, textColor, iconSize, buttonSize, buttonVariant, iconVariant, ...rest } = context;
	const size = sizeProp ?? defaultSize;
	const variant = variantProp ?? defaultVariant;
	return {
		...rest,
		size,
		variant,
		textVariant: textVariant[size],
		textColor: textColor[variant],
		iconSize: iconSize[size],
		buttonSize: buttonSize[size],
		buttonVariant: buttonVariant[variant],
		iconVariant: iconVariant[variant]
	};
};
//#endregion
export { UDSToastConfigProvider, useToastConfig };
