import { jsxs as t, jsx as a } from "react/jsx-runtime";
import { Box as c, Typography as l, Tooltip as f } from "@mui/material";
import { useMemoizedFn as p } from "ahooks";
import h from "../../hooks/use-clock.js";
import { translate as d } from "../../Locale/util.js";
import { useLocaleContext as x } from "../../Locale/context.js";
const u = {
  en: {
    localTime: "Local Time",
    timezonePhase: {
      dawn: "AM",
      morning: "AM",
      afternoon: "PM",
      night: "PM"
    }
  },
  zh: {
    localTime: "本地时间",
    timezonePhase: {
      dawn: "凌晨",
      morning: "上午",
      afternoon: "下午",
      night: "晚上"
    }
  }
};
function P({ value: n, ...i }) {
  const { locale: e } = x() || { locale: "en" }, r = p((m, s = {}) => d(u, m, e, "en", s)), o = h(n, e);
  return /* @__PURE__ */ t(
    c,
    {
      sx: {
        display: "flex",
        alignItems: "center",
        gap: 1,
        flex: 1,
        justifyContent: "flex-start",
        overflow: "hidden",
        width: "100%"
      },
      children: [
        /* @__PURE__ */ a(
          l,
          {
            ...i,
            noWrap: !0,
            component: "span",
            sx: {
              flex: "0 1 auto",
              minWidth: 0,
              ...i.sx
            },
            children: n
          }
        ),
        /* @__PURE__ */ a(
          f,
          {
            enterDelay: 200,
            title: /* @__PURE__ */ t("span", { children: [
              r("localTime"),
              " ",
              o.fullDateTime
            ] }),
            placement: "top",
            arrow: !0,
            children: /* @__PURE__ */ t(
              l,
              {
                component: "span",
                noWrap: !0,
                sx: {
                  fontSize: 14,
                  whiteSpace: "nowrap",
                  overflow: "hidden",
                  textOverflow: "ellipsis",
                  flex: "0 0 auto",
                  maxWidth: "100%"
                },
                children: [
                  "(",
                  e === "zh" ? `${r(`timezonePhase.${o.phase}`)} ` : "",
                  o.formattedTime,
                  ")"
                ]
              }
            )
          }
        )
      ]
    }
  );
}
export {
  P as default
};
