"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
require("react");
const getSize = require("../../core/utils/get-size/get-size.cjs");
const createVarsResolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
require("clsx");
const getThemeColor = require("../../core/MantineProvider/color-functions/get-theme-color/get-theme-color.cjs");
const useProps = require("../../core/MantineProvider/use-props/use-props.cjs");
const useStyles = require("../../core/styles-api/use-styles/use-styles.cjs");
const Box = require("../../core/Box/Box.cjs");
const factory = require("../../core/factory/factory.cjs");
const Bars = require("./loaders/Bars.cjs");
const Dots = require("./loaders/Dots.cjs");
const Oval = require("./loaders/Oval.cjs");
const Loader_module_css = require("./Loader.module.css.cjs");
const defaultLoaders = {
  bars: Bars.Bars,
  oval: Oval.Oval,
  dots: Dots.Dots
};
const defaultProps = {
  loaders: defaultLoaders,
  type: "oval"
};
const varsResolver = createVarsResolver.createVarsResolver((theme, { size, color }) => ({
  root: {
    "--loader-size": getSize.getSize(size, "loader-size"),
    "--loader-color": color ? getThemeColor.getThemeColor(color, theme) : void 0
  }
}));
const Loader = factory.factory((_props, ref) => {
  const props = useProps.useProps("Loader", defaultProps, _props);
  const {
    size,
    color,
    type,
    vars,
    className,
    style,
    classNames,
    styles,
    unstyled,
    loaders,
    variant,
    children,
    ...others
  } = props;
  const getStyles = useStyles.useStyles({
    name: "Loader",
    props,
    classes: Loader_module_css.default,
    className,
    style,
    classNames,
    styles,
    unstyled,
    vars,
    varsResolver
  });
  if (children) {
    return /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { ...getStyles("root"), ref, ...others, children });
  }
  return /* @__PURE__ */ jsxRuntime.jsx(
    Box.Box,
    {
      ...getStyles("root"),
      ref,
      component: loaders[type],
      variant,
      size,
      ...others
    }
  );
});
Loader.defaultLoaders = defaultLoaders;
Loader.classes = Loader_module_css.default;
Loader.displayName = "@mantine/core/Loader";
exports.Loader = Loader;
exports.defaultLoaders = defaultLoaders;
