/*! © 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/Modal/UDSModalConfigProvider.tsx
const ModalContext = createContext(void 0);
const UDSModalConfigProvider = ({ children, value }) => {
	const existingContext = useContext(ModalContext);
	if ("type" in value) {
		if (!existingContext) throw new Error("Cannot merge context values without an existing ModalContext");
		return /* @__PURE__ */ jsx(ModalContext.Provider, {
			value: {
				...existingContext,
				...value.value
			},
			children
		});
	}
	return /* @__PURE__ */ jsx(ModalContext.Provider, {
		value,
		children
	});
};
UDSModalConfigProvider.displayName = "UDSModalConfigProvider";
function useModalConfig(sizeProp, variantProp) {
	const context = useContext(ModalContext);
	if (!context) throw new Error("useModalConfig must be used within a UDSConfigProvider or UDSModalConfigProvider");
	const { defaultSize, defaultVariant, gutter, animationDuration, animationEasing } = context;
	const size = sizeProp ?? defaultSize;
	return {
		size,
		variant: variantProp ?? defaultVariant,
		animationDuration,
		animationEasing,
		gutter: gutter[size]
	};
}
//#endregion
export { UDSModalConfigProvider, useModalConfig };
