import R from "./index-objectWithoutPropertiesLoose.js";
import a from "./index-extends.js";
import * as m from "react";
import r from "./index-_virtual16.js";
import { clsx as N } from "./index-clsx.js";
import p, { getNativeSelectUtilityClasses as C } from "./index-nativeSelectClasses.js";
import b from "./index-styled.js";
import { jsxs as h, jsx as v } from "react/jsx-runtime";
import f from "./index-capitalize.js";
import I from "./index-composeClasses.js";
import x from "./index-rootShouldForwardProp.js";
import k from "./index-refType.js";
const y = ["className", "disabled", "error", "IconComponent", "inputRef", "variant"], $ = (o) => {
  const {
    classes: e,
    variant: t,
    disabled: n,
    multiple: i,
    open: s,
    error: l
  } = o, c = {
    select: ["select", t, n && "disabled", i && "multiple", l && "error"],
    icon: ["icon", `icon${f(t)}`, s && "iconOpen", n && "disabled"]
  };
  return I(c, C, e);
}, w = ({
  ownerState: o,
  theme: e
}) => a({
  MozAppearance: "none",
  // Reset
  WebkitAppearance: "none",
  // Reset
  // When interacting quickly, the text can end up selected.
  // Native select can't be selected either.
  userSelect: "none",
  borderRadius: 0,
  // Reset
  cursor: "pointer",
  "&:focus": a({}, e.vars ? {
    backgroundColor: `rgba(${e.vars.palette.common.onBackgroundChannel} / 0.05)`
  } : {
    backgroundColor: e.palette.mode === "light" ? "rgba(0, 0, 0, 0.05)" : "rgba(255, 255, 255, 0.05)"
  }, {
    borderRadius: 0
    // Reset Chrome style
  }),
  // Remove IE11 arrow
  "&::-ms-expand": {
    display: "none"
  },
  [`&.${p.disabled}`]: {
    cursor: "default"
  },
  "&[multiple]": {
    height: "auto"
  },
  "&:not([multiple]) option, &:not([multiple]) optgroup": {
    backgroundColor: (e.vars || e).palette.background.paper
  },
  // Bump specificity to allow extending custom inputs
  "&&&": {
    paddingRight: 24,
    minWidth: 16
    // So it doesn't collapse.
  }
}, o.variant === "filled" && {
  "&&&": {
    paddingRight: 32
  }
}, o.variant === "outlined" && {
  borderRadius: (e.vars || e).shape.borderRadius,
  "&:focus": {
    borderRadius: (e.vars || e).shape.borderRadius
    // Reset the reset for Chrome style
  },
  "&&&": {
    paddingRight: 32
  }
}), j = b("select", {
  name: "MuiNativeSelect",
  slot: "Select",
  shouldForwardProp: x,
  overridesResolver: (o, e) => {
    const {
      ownerState: t
    } = o;
    return [e.select, e[t.variant], t.error && e.error, {
      [`&.${p.multiple}`]: e.multiple
    }];
  }
})(w), O = ({
  ownerState: o,
  theme: e
}) => a({
  // We use a position absolute over a flexbox in order to forward the pointer events
  // to the input and to support wrapping tags..
  position: "absolute",
  right: 0,
  top: "calc(50% - .5em)",
  // Center vertically, height is 1em
  pointerEvents: "none",
  // Don't block pointer events on the select under the icon.
  color: (e.vars || e).palette.action.active,
  [`&.${p.disabled}`]: {
    color: (e.vars || e).palette.action.disabled
  }
}, o.open && {
  transform: "rotate(180deg)"
}, o.variant === "filled" && {
  right: 7
}, o.variant === "outlined" && {
  right: 7
}), P = b("svg", {
  name: "MuiNativeSelect",
  slot: "Icon",
  overridesResolver: (o, e) => {
    const {
      ownerState: t
    } = o;
    return [e.icon, t.variant && e[`icon${f(t.variant)}`], t.open && e.iconOpen];
  }
})(O), T = /* @__PURE__ */ m.forwardRef(function(e, t) {
  const {
    className: n,
    disabled: i,
    error: s,
    IconComponent: l,
    inputRef: c,
    variant: g = "standard"
  } = e, S = R(e, y), d = a({}, e, {
    disabled: i,
    variant: g,
    error: s
  }), u = $(d);
  return /* @__PURE__ */ h(m.Fragment, {
    children: [/* @__PURE__ */ v(j, a({
      ownerState: d,
      className: N(u.select, n),
      disabled: i,
      ref: c || t
    }, S)), e.multiple ? null : /* @__PURE__ */ v(P, {
      as: l,
      ownerState: d,
      className: u.icon
    })]
  });
});
process.env.NODE_ENV !== "production" && (T.propTypes = {
  /**
   * The option elements to populate the select with.
   * Can be some `<option>` elements.
   */
  children: r.node,
  /**
   * Override or extend the styles applied to the component.
   */
  classes: r.object,
  /**
   * The CSS class name of the select element.
   */
  className: r.string,
  /**
   * If `true`, the select is disabled.
   */
  disabled: r.bool,
  /**
   * If `true`, the `select input` will indicate an error.
   */
  error: r.bool,
  /**
   * The icon that displays the arrow.
   */
  IconComponent: r.elementType.isRequired,
  /**
   * Use that prop to pass a ref to the native select element.
   * @deprecated
   */
  inputRef: k,
  /**
   * @ignore
   */
  multiple: r.bool,
  /**
   * Name attribute of the `select` or hidden `input` element.
   */
  name: r.string,
  /**
   * Callback fired when a menu item is selected.
   *
   * @param {object} event The event source of the callback.
   * You can pull out the new value by accessing `event.target.value` (string).
   */
  onChange: r.func,
  /**
   * The input value.
   */
  value: r.any,
  /**
   * The variant to use.
   */
  variant: r.oneOf(["standard", "outlined", "filled"])
});
export {
  T as default,
  O as nativeSelectIconStyles,
  w as nativeSelectSelectStyles
};
