import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import * as React from "react";
import { clsx } from "../../../clsx/dist/clsx.js";
import styled from "../../styled-engine/index.js";
import useTheme from "./useTheme.js";
import { jsx } from "react/jsx-runtime";
import styleFunctionSx from "./styleFunctionSx/styleFunctionSx.js";
import extendSxProp from "./styleFunctionSx/extendSxProp.js";
const _excluded = ["className", "component"];
function createBox(options = {}) {
  const {
    themeId,
    defaultTheme,
    defaultClassName = "MuiBox-root",
    generateClassName
  } = options;
  const BoxRoot = styled("div", {
    shouldForwardProp: (prop) => prop !== "theme" && prop !== "sx" && prop !== "as"
  })(styleFunctionSx);
  const Box = /* @__PURE__ */ React.forwardRef(function Box2(inProps, ref) {
    const theme = useTheme(defaultTheme);
    const _extendSxProp = extendSxProp(inProps), {
      className,
      component = "div"
    } = _extendSxProp, other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded);
    return /* @__PURE__ */ jsx(BoxRoot, _extends({
      as: component,
      ref,
      className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
      theme: themeId ? theme[themeId] || theme : theme
    }, other));
  });
  return Box;
}
export {
  createBox as default
};
