import v from "./index-objectWithoutPropertiesLoose.js";
import c from "./index-extends.js";
import * as F from "react";
import o from "./index-_virtual16.js";
import { clsx as L } from "./index-clsx.js";
import q from "./index-formControlState.js";
import x from "./index-useFormControl.js";
import y from "./index-styled.js";
import i, { getFormLabelUtilityClasses as C } from "./index-formLabelClasses.js";
import { jsxs as b } from "react/jsx-runtime";
import { useDefaultProps as g } from "./index-DefaultPropsProvider.js";
import N from "./index-capitalize.js";
import k from "./index-composeClasses.js";
const O = ["children", "className", "color", "component", "disabled", "error", "filled", "focused", "required"], R = (r) => {
  const {
    classes: e,
    color: d,
    focused: l,
    disabled: n,
    error: t,
    filled: a,
    required: p
  } = r, m = {
    root: ["root", `color${N(d)}`, n && "disabled", t && "error", a && "filled", l && "focused", p && "required"],
    asterisk: ["asterisk", t && "error"]
  };
  return k(m, C, e);
}, T = y("label", {
  name: "MuiFormLabel",
  slot: "Root",
  overridesResolver: ({
    ownerState: r
  }, e) => c({}, e.root, r.color === "secondary" && e.colorSecondary, r.filled && e.filled)
})(({
  theme: r,
  ownerState: e
}) => c({
  color: (r.vars || r).palette.text.secondary
}, r.typography.body1, {
  lineHeight: "1.4375em",
  padding: 0,
  position: "relative",
  [`&.${i.focused}`]: {
    color: (r.vars || r).palette[e.color].main
  },
  [`&.${i.disabled}`]: {
    color: (r.vars || r).palette.text.disabled
  },
  [`&.${i.error}`]: {
    color: (r.vars || r).palette.error.main
  }
})), j = y("span", {
  name: "MuiFormLabel",
  slot: "Asterisk",
  overridesResolver: (r, e) => e.asterisk
})(({
  theme: r
}) => ({
  [`&.${i.error}`]: {
    color: (r.vars || r).palette.error.main
  }
})), $ = /* @__PURE__ */ F.forwardRef(function(e, d) {
  const l = g({
    props: e,
    name: "MuiFormLabel"
  }), {
    children: n,
    className: t,
    component: a = "label"
  } = l, p = v(l, O), m = x(), s = q({
    props: l,
    muiFormControl: m,
    states: ["color", "required", "focused", "disabled", "error", "filled"]
  }), f = c({}, l, {
    color: s.color || "primary",
    component: a,
    disabled: s.disabled,
    error: s.error,
    filled: s.filled,
    focused: s.focused,
    required: s.required
  }), u = R(f);
  return /* @__PURE__ */ b(T, c({
    as: a,
    ownerState: f,
    className: L(u.root, t),
    ref: d
  }, p, {
    children: [n, s.required && /* @__PURE__ */ b(j, {
      ownerState: f,
      "aria-hidden": !0,
      className: u.asterisk,
      children: [" ", "*"]
    })]
  }));
});
process.env.NODE_ENV !== "production" && ($.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * The content of the component.
   */
  children: o.node,
  /**
   * Override or extend the styles applied to the component.
   */
  classes: o.object,
  /**
   * @ignore
   */
  className: o.string,
  /**
   * The color of the component.
   * It supports both default and custom theme colors, which can be added as shown in the
   * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
   */
  color: o.oneOfType([o.oneOf(["error", "info", "primary", "secondary", "success", "warning"]), o.string]),
  /**
   * The component used for the root node.
   * Either a string to use a HTML element or a component.
   */
  component: o.elementType,
  /**
   * If `true`, the label should be displayed in a disabled state.
   */
  disabled: o.bool,
  /**
   * If `true`, the label is displayed in an error state.
   */
  error: o.bool,
  /**
   * If `true`, the label should use filled classes key.
   */
  filled: o.bool,
  /**
   * If `true`, the input of this label is focused (used by `FormGroup` components).
   */
  focused: o.bool,
  /**
   * If `true`, the label will indicate that the `input` is required.
   */
  required: o.bool,
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object])
});
export {
  T as FormLabelRoot,
  $ as default
};
