import So from "./index-objectWithoutPropertiesLoose.js";
import l from "./index-extends.js";
import * as u from "react";
import o from "./index-_virtual16.js";
import { clsx as to } from "./index-clsx.js";
import Eo from "./index-formControlState.js";
import Io from "./index-FormControlContext.js";
import Oo from "./index-useFormControl.js";
import lo from "./index-styled.js";
import { isFilled as To } from "./index-utils8.js";
import W, { getInputBaseUtilityClass as ko } from "./index-inputBaseClasses.js";
import { jsxs as ro, jsx as L } from "react/jsx-runtime";
import { useDefaultProps as Fo } from "./index-DefaultPropsProvider.js";
import Po from "./index-useForkRef.js";
import zo from "./index-useEnhancedEffect2.js";
import Ao from "./index-TextareaAutosize.js";
import io from "./index-isHostComponent.js";
import U from "./index-capitalize.js";
import No from "./index-composeClasses.js";
import Bo from "./index-GlobalStyles.js";
import jo from "./index-formatMuiErrorMessage.js";
import Do from "./index-refType.js";
import Mo from "./index-elementTypeAcceptingRef.js";
const Wo = ["aria-describedby", "autoComplete", "autoFocus", "className", "color", "components", "componentsProps", "defaultValue", "disabled", "disableInjectingGlobalStyles", "endAdornment", "error", "fullWidth", "id", "inputComponent", "inputProps", "inputRef", "margin", "maxRows", "minRows", "multiline", "name", "onBlur", "onChange", "onClick", "onFocus", "onKeyDown", "onKeyUp", "placeholder", "readOnly", "renderSuffix", "rows", "size", "slotProps", "slots", "startAdornment", "type", "value"], Lo = (r, e) => {
  const {
    ownerState: n
  } = r;
  return [e.root, n.formControl && e.formControl, n.startAdornment && e.adornedStart, n.endAdornment && e.adornedEnd, n.error && e.error, n.size === "small" && e.sizeSmall, n.multiline && e.multiline, n.color && e[`color${U(n.color)}`], n.fullWidth && e.fullWidth, n.hiddenLabel && e.hiddenLabel];
}, Uo = (r, e) => {
  const {
    ownerState: n
  } = r;
  return [e.input, n.size === "small" && e.inputSizeSmall, n.multiline && e.inputMultiline, n.type === "search" && e.inputTypeSearch, n.startAdornment && e.inputAdornedStart, n.endAdornment && e.inputAdornedEnd, n.hiddenLabel && e.inputHiddenLabel];
}, Vo = (r) => {
  const {
    classes: e,
    color: n,
    disabled: p,
    error: s,
    endAdornment: c,
    focused: O,
    formControl: T,
    fullWidth: k,
    hiddenLabel: h,
    multiline: y,
    readOnly: x,
    size: f,
    startAdornment: v,
    type: R
  } = r, F = {
    root: ["root", `color${U(n)}`, p && "disabled", s && "error", k && "fullWidth", O && "focused", T && "formControl", f && f !== "medium" && `size${U(f)}`, y && "multiline", v && "adornedStart", c && "adornedEnd", h && "hiddenLabel", x && "readOnly"],
    input: ["input", p && "disabled", R === "search" && "inputTypeSearch", y && "inputMultiline", f === "small" && "inputSizeSmall", h && "inputHiddenLabel", v && "inputAdornedStart", c && "inputAdornedEnd", x && "readOnly"]
  };
  return No(F, ko, e);
}, _o = lo("div", {
  name: "MuiInputBase",
  slot: "Root",
  overridesResolver: Lo
})(({
  theme: r,
  ownerState: e
}) => l({}, r.typography.body1, {
  color: (r.vars || r).palette.text.primary,
  lineHeight: "1.4375em",
  // 23px
  boxSizing: "border-box",
  // Prevent padding issue with fullWidth.
  position: "relative",
  cursor: "text",
  display: "inline-flex",
  alignItems: "center",
  [`&.${W.disabled}`]: {
    color: (r.vars || r).palette.text.disabled,
    cursor: "default"
  }
}, e.multiline && l({
  padding: "4px 0 5px"
}, e.size === "small" && {
  paddingTop: 1
}), e.fullWidth && {
  width: "100%"
})), Ko = lo("input", {
  name: "MuiInputBase",
  slot: "Input",
  overridesResolver: Uo
})(({
  theme: r,
  ownerState: e
}) => {
  const n = r.palette.mode === "light", p = l({
    color: "currentColor"
  }, r.vars ? {
    opacity: r.vars.opacity.inputPlaceholder
  } : {
    opacity: n ? 0.42 : 0.5
  }, {
    transition: r.transitions.create("opacity", {
      duration: r.transitions.duration.shorter
    })
  }), s = {
    opacity: "0 !important"
  }, c = r.vars ? {
    opacity: r.vars.opacity.inputPlaceholder
  } : {
    opacity: n ? 0.42 : 0.5
  };
  return l({
    font: "inherit",
    letterSpacing: "inherit",
    color: "currentColor",
    padding: "4px 0 5px",
    border: 0,
    boxSizing: "content-box",
    background: "none",
    height: "1.4375em",
    // Reset 23pxthe native input line-height
    margin: 0,
    // Reset for Safari
    WebkitTapHighlightColor: "transparent",
    display: "block",
    // Make the flex item shrink with Firefox
    minWidth: 0,
    width: "100%",
    // Fix IE11 width issue
    animationName: "mui-auto-fill-cancel",
    animationDuration: "10ms",
    "&::-webkit-input-placeholder": p,
    "&::-moz-placeholder": p,
    // Firefox 19+
    "&:-ms-input-placeholder": p,
    // IE11
    "&::-ms-input-placeholder": p,
    // Edge
    "&:focus": {
      outline: 0
    },
    // Reset Firefox invalid required input style
    "&:invalid": {
      boxShadow: "none"
    },
    "&::-webkit-search-decoration": {
      // Remove the padding when type=search.
      WebkitAppearance: "none"
    },
    // Show and hide the placeholder logic
    [`label[data-shrink=false] + .${W.formControl} &`]: {
      "&::-webkit-input-placeholder": s,
      "&::-moz-placeholder": s,
      // Firefox 19+
      "&:-ms-input-placeholder": s,
      // IE11
      "&::-ms-input-placeholder": s,
      // Edge
      "&:focus::-webkit-input-placeholder": c,
      "&:focus::-moz-placeholder": c,
      // Firefox 19+
      "&:focus:-ms-input-placeholder": c,
      // IE11
      "&:focus::-ms-input-placeholder": c
      // Edge
    },
    [`&.${W.disabled}`]: {
      opacity: 1,
      // Reset iOS opacity
      WebkitTextFillColor: (r.vars || r).palette.text.disabled
      // Fix opacity Safari bug
    },
    "&:-webkit-autofill": {
      animationDuration: "5000s",
      animationName: "mui-auto-fill"
    }
  }, e.size === "small" && {
    paddingTop: 1
  }, e.multiline && {
    height: "auto",
    resize: "none",
    padding: 0,
    paddingTop: 0
  }, e.type === "search" && {
    // Improve type search style.
    MozAppearance: "textfield"
  });
}), Ho = /* @__PURE__ */ L(Bo, {
  styles: {
    "@keyframes mui-auto-fill": {
      from: {
        display: "block"
      }
    },
    "@keyframes mui-auto-fill-cancel": {
      from: {
        display: "block"
      }
    }
  }
}), $o = /* @__PURE__ */ u.forwardRef(function(e, n) {
  var p;
  const s = Fo({
    props: e,
    name: "MuiInputBase"
  }), {
    "aria-describedby": c,
    autoComplete: O,
    autoFocus: T,
    className: k,
    components: h = {},
    componentsProps: y = {},
    defaultValue: x,
    disabled: f,
    disableInjectingGlobalStyles: v,
    endAdornment: R,
    fullWidth: F = !1,
    id: ao,
    inputComponent: so = "input",
    inputProps: d = {},
    inputRef: uo,
    maxRows: V,
    minRows: _,
    multiline: K = !1,
    name: po,
    onBlur: g,
    onChange: H,
    onClick: $,
    onFocus: G,
    onKeyDown: co,
    onKeyUp: mo,
    placeholder: fo,
    readOnly: P,
    renderSuffix: q,
    rows: S,
    slotProps: Y = {},
    slots: J = {},
    startAdornment: C,
    type: Q = "text",
    value: bo
  } = s, ho = So(s, Wo), E = d.value != null ? d.value : bo, {
    current: z
  } = u.useRef(E != null), b = u.useRef(), yo = u.useCallback((t) => {
    process.env.NODE_ENV !== "production" && t && t.nodeName !== "INPUT" && t.focus;
  }, []), go = Po(b, uo, d.ref, yo), [A, N] = u.useState(!1), i = Oo();
  process.env.NODE_ENV !== "production" && u.useEffect(() => {
    if (i)
      return i.registerEffect();
  }, [i]);
  const a = Eo({
    props: s,
    muiFormControl: i,
    states: ["color", "disabled", "error", "hiddenLabel", "size", "required", "filled"]
  });
  a.focused = i ? i.focused : A, u.useEffect(() => {
    !i && f && A && (N(!1), g && g());
  }, [i, f, A, g]);
  const B = i && i.onFilled, j = i && i.onEmpty, w = u.useCallback((t) => {
    To(t) ? B && B() : j && j();
  }, [B, j]);
  zo(() => {
    z && w({
      value: E
    });
  }, [E, w, z]);
  const Co = (t) => {
    if (a.disabled) {
      t.stopPropagation();
      return;
    }
    G && G(t), d.onFocus && d.onFocus(t), i && i.onFocus ? i.onFocus(t) : N(!0);
  }, wo = (t) => {
    g && g(t), d.onBlur && d.onBlur(t), i && i.onBlur ? i.onBlur(t) : N(!1);
  }, xo = (t, ...eo) => {
    if (!z) {
      const no = t.target || b.current;
      if (no == null)
        throw new Error(process.env.NODE_ENV !== "production" ? "MUI: Expected valid input target. Did you use a custom `inputComponent` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info." : jo(1));
      w({
        value: no.value
      });
    }
    d.onChange && d.onChange(t, ...eo), H && H(t, ...eo);
  };
  u.useEffect(() => {
    w(b.current);
  }, []);
  const vo = (t) => {
    b.current && t.currentTarget === t.target && b.current.focus(), $ && $(t);
  };
  let D = so, m = d;
  K && D === "input" && (S ? (process.env.NODE_ENV, m = l({
    type: void 0,
    minRows: S,
    maxRows: S
  }, m)) : m = l({
    type: void 0,
    maxRows: V,
    minRows: _
  }, m), D = Ao);
  const Ro = (t) => {
    w(t.animationName === "mui-auto-fill-cancel" ? b.current : {
      value: "x"
    });
  };
  u.useEffect(() => {
    i && i.setAdornedStart(!!C);
  }, [i, C]);
  const I = l({}, s, {
    color: a.color || "primary",
    disabled: a.disabled,
    endAdornment: R,
    error: a.error,
    focused: a.focused,
    formControl: i,
    fullWidth: F,
    hiddenLabel: a.hiddenLabel,
    multiline: K,
    size: a.size,
    startAdornment: C,
    type: Q
  }), X = Vo(I), Z = J.root || h.Root || _o, M = Y.root || y.root || {}, oo = J.input || h.Input || Ko;
  return m = l({}, m, (p = Y.input) != null ? p : y.input), /* @__PURE__ */ ro(u.Fragment, {
    children: [!v && Ho, /* @__PURE__ */ ro(Z, l({}, M, !io(Z) && {
      ownerState: l({}, I, M.ownerState)
    }, {
      ref: n,
      onClick: vo
    }, ho, {
      className: to(X.root, M.className, k, P && "MuiInputBase-readOnly"),
      children: [C, /* @__PURE__ */ L(Io.Provider, {
        value: null,
        children: /* @__PURE__ */ L(oo, l({
          ownerState: I,
          "aria-invalid": a.error,
          "aria-describedby": c,
          autoComplete: O,
          autoFocus: T,
          defaultValue: x,
          disabled: a.disabled,
          id: ao,
          onAnimationStart: Ro,
          name: po,
          placeholder: fo,
          readOnly: P,
          required: a.required,
          rows: S,
          value: E,
          onKeyDown: co,
          onKeyUp: mo,
          type: Q
        }, m, !io(oo) && {
          as: D,
          ownerState: l({}, I, m.ownerState)
        }, {
          ref: go,
          className: to(X.input, m.className, P && "MuiInputBase-readOnly"),
          onBlur: wo,
          onChange: xo,
          onFocus: Co
        }))
      }), R, q ? q(l({}, a, {
        startAdornment: C
      })) : null]
    }))]
  });
});
process.env.NODE_ENV !== "production" && ($o.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * @ignore
   */
  "aria-describedby": o.string,
  /**
   * This prop helps users to fill forms faster, especially on mobile devices.
   * The name can be confusing, as it's more like an autofill.
   * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill).
   */
  autoComplete: o.string,
  /**
   * If `true`, the `input` element is focused during the first mount.
   */
  autoFocus: o.bool,
  /**
   * 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).
   * The prop defaults to the value (`'primary'`) inherited from the parent FormControl component.
   */
  color: o.oneOfType([o.oneOf(["primary", "secondary", "error", "info", "success", "warning"]), o.string]),
  /**
   * The components used for each slot inside.
   *
   * This prop is an alias for the `slots` prop.
   * It's recommended to use the `slots` prop instead.
   *
   * @default {}
   */
  components: o.shape({
    Input: o.elementType,
    Root: o.elementType
  }),
  /**
   * The extra props for the slot components.
   * You can override the existing props or add new ones.
   *
   * This prop is an alias for the `slotProps` prop.
   * It's recommended to use the `slotProps` prop instead, as `componentsProps` will be deprecated in the future.
   *
   * @default {}
   */
  componentsProps: o.shape({
    input: o.object,
    root: o.object
  }),
  /**
   * The default value. Use when the component is not controlled.
   */
  defaultValue: o.any,
  /**
   * If `true`, the component is disabled.
   * The prop defaults to the value (`false`) inherited from the parent FormControl component.
   */
  disabled: o.bool,
  /**
   * If `true`, GlobalStyles for the auto-fill keyframes will not be injected/removed on mount/unmount. Make sure to inject them at the top of your application.
   * This option is intended to help with boosting the initial rendering performance if you are loading a big amount of Input components at once.
   * @default false
   */
  disableInjectingGlobalStyles: o.bool,
  /**
   * End `InputAdornment` for this component.
   */
  endAdornment: o.node,
  /**
   * If `true`, the `input` will indicate an error.
   * The prop defaults to the value (`false`) inherited from the parent FormControl component.
   */
  error: o.bool,
  /**
   * If `true`, the `input` will take up the full width of its container.
   * @default false
   */
  fullWidth: o.bool,
  /**
   * The id of the `input` element.
   */
  id: o.string,
  /**
   * The component used for the `input` element.
   * Either a string to use a HTML element or a component.
   * @default 'input'
   */
  inputComponent: Mo,
  /**
   * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
   * @default {}
   */
  inputProps: o.object,
  /**
   * Pass a ref to the `input` element.
   */
  inputRef: Do,
  /**
   * If `dense`, will adjust vertical spacing. This is normally obtained via context from
   * FormControl.
   * The prop defaults to the value (`'none'`) inherited from the parent FormControl component.
   */
  margin: o.oneOf(["dense", "none"]),
  /**
   * Maximum number of rows to display when multiline option is set to true.
   */
  maxRows: o.oneOfType([o.number, o.string]),
  /**
   * Minimum number of rows to display when multiline option is set to true.
   */
  minRows: o.oneOfType([o.number, o.string]),
  /**
   * If `true`, a [TextareaAutosize](/material-ui/react-textarea-autosize/) element is rendered.
   * @default false
   */
  multiline: o.bool,
  /**
   * Name attribute of the `input` element.
   */
  name: o.string,
  /**
   * Callback fired when the `input` is blurred.
   *
   * Notice that the first argument (event) might be undefined.
   */
  onBlur: o.func,
  /**
   * Callback fired when the value is changed.
   *
   * @param {React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>} event The event source of the callback.
   * You can pull out the new value by accessing `event.target.value` (string).
   */
  onChange: o.func,
  /**
   * @ignore
   */
  onClick: o.func,
  /**
   * @ignore
   */
  onFocus: o.func,
  /**
   * Callback fired when the `input` doesn't satisfy its constraints.
   */
  onInvalid: o.func,
  /**
   * @ignore
   */
  onKeyDown: o.func,
  /**
   * @ignore
   */
  onKeyUp: o.func,
  /**
   * The short hint displayed in the `input` before the user enters a value.
   */
  placeholder: o.string,
  /**
   * It prevents the user from changing the value of the field
   * (not from interacting with the field).
   */
  readOnly: o.bool,
  /**
   * @ignore
   */
  renderSuffix: o.func,
  /**
   * If `true`, the `input` element is required.
   * The prop defaults to the value (`false`) inherited from the parent FormControl component.
   */
  required: o.bool,
  /**
   * Number of rows to display when multiline option is set to true.
   */
  rows: o.oneOfType([o.number, o.string]),
  /**
   * The size of the component.
   */
  size: o.oneOfType([o.oneOf(["medium", "small"]), o.string]),
  /**
   * The extra props for the slot components.
   * You can override the existing props or add new ones.
   *
   * This prop is an alias for the `componentsProps` prop, which will be deprecated in the future.
   *
   * @default {}
   */
  slotProps: o.shape({
    input: o.object,
    root: o.object
  }),
  /**
   * The components used for each slot inside.
   *
   * This prop is an alias for the `components` prop, which will be deprecated in the future.
   *
   * @default {}
   */
  slots: o.shape({
    input: o.elementType,
    root: o.elementType
  }),
  /**
   * Start `InputAdornment` for this component.
   */
  startAdornment: o.node,
  /**
   * 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]),
  /**
   * Type of the `input` element. It should be [a valid HTML5 input type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types).
   * @default 'text'
   */
  type: o.string,
  /**
   * The value of the `input` element, required for a controlled component.
   */
  value: o.any
});
export {
  Ko as InputBaseComponent,
  _o as InputBaseRoot,
  $o as default,
  Uo as inputOverridesResolver,
  Lo as rootOverridesResolver
};
