"use client";
import { keys } from "../../core/utils/keys/keys.mjs";
import { filterProps } from "../../core/utils/filter-props/filter-props.mjs";
import { getSpacing } from "../../core/utils/get-size/get-size.mjs";
import { getSortedBreakpoints } from "../../core/utils/get-sorted-breakpoints/get-sorted-breakpoints.mjs";
import { getBaseValue } from "../../core/utils/get-base-value/get-base-value.mjs";
import { useMantineTheme } from "../../core/MantineProvider/MantineThemeProvider/MantineThemeProvider.mjs";
import { InlineStyles } from "../../core/InlineStyles/InlineStyles.mjs";
import { jsx } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/Grid/GridVariables.tsx
function GridVariables({ gap, rowGap, columnGap, selector, breakpoints, type }) {
	const theme = useMantineTheme();
	const _breakpoints = breakpoints || theme.breakpoints;
	const baseStyles = filterProps({
		"--grid-gap": getSpacing(getBaseValue(gap)),
		"--grid-row-gap": getSpacing(getBaseValue(rowGap)),
		"--grid-column-gap": getSpacing(getBaseValue(columnGap))
	});
	const queries = keys(_breakpoints).reduce((acc, breakpoint) => {
		if (!acc[breakpoint]) acc[breakpoint] = {};
		if (typeof gap === "object" && gap[breakpoint] !== void 0) acc[breakpoint]["--grid-gap"] = getSpacing(gap[breakpoint]);
		if (typeof rowGap === "object" && rowGap[breakpoint] !== void 0) acc[breakpoint]["--grid-row-gap"] = getSpacing(rowGap[breakpoint]);
		if (typeof columnGap === "object" && columnGap[breakpoint] !== void 0) acc[breakpoint]["--grid-column-gap"] = getSpacing(columnGap[breakpoint]);
		return acc;
	}, {});
	const values = getSortedBreakpoints(keys(queries), _breakpoints).filter((breakpoint) => keys(queries[breakpoint.value]).length > 0).map((breakpoint) => ({
		query: type === "container" ? `mantine-grid (min-width: ${_breakpoints[breakpoint.value]})` : `(min-width: ${_breakpoints[breakpoint.value]})`,
		styles: queries[breakpoint.value]
	}));
	return /* @__PURE__ */ jsx(InlineStyles, {
		styles: baseStyles,
		media: type === "container" ? void 0 : values,
		container: type === "container" ? values : void 0,
		selector
	});
}
//#endregion
export { GridVariables };

//# sourceMappingURL=GridVariables.mjs.map