import { useCss } from "./use-css.mjs";
import { useMantineTheme } from "../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/MantineProvider/MantineThemeProvider/MantineThemeProvider.mjs";
import { em } from "../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/utils/units-converters/rem.mjs";
import { px } from "../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/utils/units-converters/px.mjs";
function getStylesRef(refName) {
  return `___ref-${refName || ""}`;
}
function getBreakpointValue(theme, breakpoint) {
  return breakpoint in theme.breakpoints && typeof breakpoint !== "number" ? px(theme.breakpoints[breakpoint]) : px(breakpoint);
}
const getHelpers = (theme) => ({
  light: '[data-mantine-color-scheme="light"] &',
  dark: '[data-mantine-color-scheme="dark"] &',
  rtl: '[dir="rtl"] &',
  ltr: '[dir="ltr"] &',
  notRtl: '[dir="ltr"] &',
  notLtr: '[dir="rtl"] &',
  ref: getStylesRef,
  smallerThan: (breakpoint) => `@media (max-width: ${em(getBreakpointValue(theme, breakpoint) - 0.1)})`,
  largerThan: (breakpoint) => `@media (min-width: ${em(getBreakpointValue(theme, breakpoint))})`
});
function createStyles(input) {
  const getCssObject = typeof input === "function" ? input : () => input;
  return function useStyles(params) {
    const theme = useMantineTheme();
    const helpers = getHelpers(theme);
    const cssObject = getCssObject(theme, params, helpers);
    const { css, cx } = useCss();
    const classes = Object.keys(cssObject).reduce((acc, key) => {
      acc[key] = css(cssObject[key]);
      return acc;
    }, {});
    return { classes, cx, theme };
  };
}
export {
  createStyles,
  getHelpers,
  getStylesRef
};
