import D from "./index-objectWithoutPropertiesLoose.js";
import f from "./index-extends.js";
import * as b from "react";
import { PickersToolbar as M } from "./index-PickersToolbar.js";
import { useUtils as V, useLocaleText as x } from "./index-useUtils.js";
import { isYearOnlyView as v, isYearAndMonthViews as L } from "./index-shared.js";
import { getDatePickerToolbarUtilityClass as C } from "./index-datePickerToolbarClasses.js";
import { jsx as d } from "react/jsx-runtime";
import K from "./index-useThemeProps.js";
import R from "./index-composeClasses.js";
import u from "./index-styled.js";
import _ from "./index-Typography.js";
const O = ["parsedValue", "isLandscape", "isMobileKeyboardViewOpen", "onChange", "toggleMobileKeyboardView", "toolbarFormat", "toolbarPlaceholder", "toolbarTitle", "views"], S = (r) => {
  const {
    classes: o
  } = r;
  return R({
    root: ["root"],
    title: ["title"]
  }, C, o);
}, U = u(M, {
  name: "MuiDatePickerToolbar",
  slot: "Root",
  overridesResolver: (r, o) => o.root
})({}), W = u(_, {
  name: "MuiDatePickerToolbar",
  slot: "Title",
  overridesResolver: (r, o) => o.title
})(({
  ownerState: r
}) => f({}, r.isLandscape && {
  margin: "auto 16px auto auto"
})), I = /* @__PURE__ */ b.forwardRef(function(o, l) {
  const a = K({
    props: o,
    name: "MuiDatePickerToolbar"
  }), {
    parsedValue: e,
    isLandscape: n,
    isMobileKeyboardViewOpen: T,
    toggleMobileKeyboardView: y,
    toolbarFormat: i,
    toolbarPlaceholder: c = "––",
    toolbarTitle: m,
    views: s
  } = a, P = D(a, O), t = V(), g = x(), p = S(a), h = m ?? g.datePickerDefaultToolbarTitle, w = b.useMemo(() => e ? i ? t.formatByString(e, i) : v(s) ? t.format(e, "year") : L(s) ? t.format(e, "month") : /en/.test(t.getCurrentLocaleCode()) ? t.format(e, "normalDateWithWeekday") : t.format(e, "normalDate") : c, [e, i, c, t, s]), k = a;
  return /* @__PURE__ */ d(U, f({
    ref: l,
    toolbarTitle: h,
    isMobileKeyboardViewOpen: T,
    toggleMobileKeyboardView: y,
    isLandscape: n,
    className: p.root
  }, P, {
    children: /* @__PURE__ */ d(W, {
      variant: "h4",
      align: n ? "left" : "center",
      ownerState: k,
      className: p.title,
      children: w
    })
  }));
});
export {
  I as DatePickerToolbar
};
