import l from "./index-extends.js";
import g from "./index-objectWithoutPropertiesLoose.js";
import v from "./index-createMixins.js";
import b from "./index-createPalette.js";
import O from "./index-createTypography.js";
import C from "./index-shadows.js";
import E from "./index-createTransitions.js";
import I from "./index-zIndex.js";
import _ from "./index-formatMuiErrorMessage.js";
import k from "./index-createTheme2.js";
import p from "./index-deepmerge.js";
import N from "./index-defaultSxConfig.js";
import S from "./index-styleFunctionSx.js";
import T from "./index-generateUtilityClass.js";
const M = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
function B(o = {}, ...f) {
  const {
    mixins: u = {},
    palette: d = {},
    transitions: h = {},
    typography: y = {}
  } = o, n = g(o, M);
  if (o.vars)
    throw new Error(process.env.NODE_ENV !== "production" ? "MUI: `vars` is a private field used for CSS variables support.\nPlease use another name." : _(18));
  const c = b(d), m = k(o);
  let e = p(m, {
    mixins: v(m.breakpoints, u),
    palette: c,
    // Don't use [...shadows] until you've verified its transpiled code is not invoking the iterator protocol.
    shadows: C.slice(),
    typography: O(c, y),
    transitions: E(h),
    zIndex: l({}, I)
  });
  if (e = p(e, n), e = f.reduce((i, s) => p(i, s), e), process.env.NODE_ENV !== "production") {
    const i = ["active", "checked", "completed", "disabled", "error", "expanded", "focused", "focusVisible", "required", "selected"], s = (t, a) => {
      let r;
      for (r in t) {
        const x = t[r];
        if (i.indexOf(r) !== -1 && Object.keys(x).length > 0) {
          if (process.env.NODE_ENV !== "production") {
            const $ = T("", r);
          }
          t[r] = {};
        }
      }
    };
    Object.keys(e.components).forEach((t) => {
      const a = e.components[t].styleOverrides;
      a && t.indexOf("Mui") === 0 && s(a, t);
    });
  }
  return e.unstable_sxConfig = l({}, N, n == null ? void 0 : n.unstable_sxConfig), e.unstable_sx = function(s) {
    return S({
      sx: s,
      theme: this
    });
  }, e;
}
export {
  B as default
};
