import b from "./index-objectWithoutPropertiesLoose.js";
import r from "./index-extends.js";
import * as m from "react";
import { clsx as C } from "./index-clsx.m.js";
import { CLOCK_WIDTH as g, CLOCK_HOUR_WIDTH as p } from "./index-shared2.js";
import { getClockPointerUtilityClass as x } from "./index-clockPointerClasses.js";
import { jsx as u } from "react/jsx-runtime";
import y from "./index-useThemeProps.js";
import k from "./index-composeClasses.js";
import d from "./index-styled.js";
const v = ["className", "hasSelected", "isInner", "type", "value"], P = (t) => {
  const {
    classes: o
  } = t;
  return k({
    root: ["root"],
    thumb: ["thumb"]
  }, x, o);
}, R = d("div", {
  name: "MuiClockPointer",
  slot: "Root",
  overridesResolver: (t, o) => o.root
})(({
  theme: t,
  ownerState: o
}) => r({
  width: 2,
  backgroundColor: t.palette.primary.main,
  position: "absolute",
  left: "calc(50% - 1px)",
  bottom: "50%",
  transformOrigin: "center bottom 0px"
}, o.shouldAnimate && {
  transition: t.transitions.create(["transform", "height"])
})), S = d("div", {
  name: "MuiClockPointer",
  slot: "Thumb",
  overridesResolver: (t, o) => o.thumb
})(({
  theme: t,
  ownerState: o
}) => r({
  width: 4,
  height: 4,
  backgroundColor: t.palette.primary.contrastText,
  borderRadius: "50%",
  position: "absolute",
  top: -21,
  left: `calc(50% - ${p / 2}px)`,
  border: `${(p - 4) / 2}px solid ${t.palette.primary.main}`,
  boxSizing: "content-box"
}, o.hasSelected && {
  backgroundColor: t.palette.primary.main
}));
function U(t) {
  const o = y({
    props: t,
    name: "MuiClockPointer"
  }), {
    className: n,
    isInner: h,
    type: e,
    value: i
  } = o, f = b(o, v), a = m.useRef(e);
  m.useEffect(() => {
    a.current = e;
  }, [e]);
  const s = r({}, o, {
    shouldAnimate: a.current !== e
  }), l = P(s);
  return /* @__PURE__ */ u(R, r({
    style: (() => {
      let c = 360 / (e === "hours" ? 12 : 60) * i;
      return e === "hours" && i > 12 && (c -= 360), {
        height: Math.round((h ? 0.26 : 0.4) * g),
        transform: `rotateZ(${c}deg)`
      };
    })(),
    className: C(n, l.root),
    ownerState: s
  }, f, {
    children: /* @__PURE__ */ u(S, {
      ownerState: s,
      className: l.thumb
    })
  }));
}
export {
  U as ClockPointer
};
