import "react";
import "react/jsx-runtime";
import { useMantineStylesTransform } from "../../MantineProvider/Mantine.context.mjs";
import { useMantineTheme } from "../../MantineProvider/MantineThemeProvider/MantineThemeProvider.mjs";
function useStylesTransform({ props, stylesCtx, themeName }) {
  var _a;
  const theme = useMantineTheme();
  const stylesTransform = (_a = useMantineStylesTransform()) == null ? void 0 : _a();
  const getTransformedStyles = (styles) => {
    if (!stylesTransform) {
      return [];
    }
    const transformedStyles = styles.map(
      (style) => stylesTransform(style, { props, theme, ctx: stylesCtx })
    );
    return [
      ...transformedStyles,
      ...themeName.map(
        (n) => {
          var _a2;
          return stylesTransform((_a2 = theme.components[n]) == null ? void 0 : _a2.styles, { props, theme, ctx: stylesCtx });
        }
      )
    ].filter(Boolean);
  };
  return {
    getTransformedStyles,
    withStylesTransform: !!stylesTransform
  };
}
export {
  useStylesTransform
};
