import { jsx as l } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { ButtonVariant as u } from "../../Button/types.js";
import { useCallback as c } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import f from "../../../../hooks/element/useDetachedRender.js";
import d from "../../../../core/Context/preact/useCoreContext.js";
import { Icon as p } from "../../Icon/Icon.js";
import b from "../../Button/Button.js";
import { isFunction as h } from "../../../../utils/value/is.js";
const T = (e) => {
  const { i18n: a } = d();
  return f(
    c(
      ((m, t, r) => {
        if (!(m instanceof HTMLElement)) return null;
        if (h(e)) return e(t, r);
        let o, i, n;
        switch (t) {
          case "PREV":
            o = "prev", i = "previous", n = "chevron-left";
            break;
          case "NEXT":
            o = i = "next", n = "chevron-right";
            break;
          default:
            return null;
        }
        const s = r();
        return s ? /* @__PURE__ */ l(
          b,
          {
            "aria-label": a.get(`common.filters.types.date.calendar.navigation.${i}Month`),
            variant: u.TERTIARY,
            disabled: !s,
            classNameModifiers: ["circle", o],
            iconButton: !0,
            onClick: r,
            children: /* @__PURE__ */ l(p, { name: n })
          },
          t
        ) : null;
      }),
      [a, e]
    )
  );
};
export {
  T as default
};
