import { jsx as e, jsxs as N } from "react/jsx-runtime";
import { useState as d, useMemo as j, useCallback as b, useEffect as F } from "react";
import { t as p } from "../global.module.js";
import { B as K, a as L } from "../tools/icons.js";
import { g, c as R, s as T, a as _, u as $, b as u } from "../tools/tools.js";
import { f as D } from "../lite.js";
const f = /* @__PURE__ */ new Date(), A = function(M) {
  const {
    as: w = "div",
    className: m,
    dropOldClass: v,
    locale: l,
    onDateClick: n,
    selectedDate: c,
    style: x,
    variables: h,
    ...k
  } = M, [s, P] = d(f.getFullYear()), [o, S] = d(f.getMonth()), [B, y] = d(
    g(s, o, [], 6, 1, void 0, c, l)
  ), O = j(() => {
    const r = R(!v && "card card-body border-0 p-0", m), a = T((t, i) => ({ tKey: _(i) }), h, x);
    return {
      className: r,
      style: a
    };
  }, [m, v, x, h]), C = b(
    (r) => {
      const a = new Date(s, o + r);
      P(a.getFullYear()), S(a.getMonth());
    },
    [o, s]
  ), Y = b(
    (r) => {
      const a = { ...r, active: !0 };
      y((t) => $(a, t)), n == null || n(a);
    },
    [n]
  );
  return F(() => {
    y(g(s, o, [], 6, 1, void 0, c, l));
  }, [o, s, l, c]), /* @__PURE__ */ e(w, { ...k, ...O, children: /* @__PURE__ */ N("div", { className: "list-group border-0 row-gap-1 px-3", children: [
    /* @__PURE__ */ N("div", { className: "row align-items-center position-relative text-center mb-2", children: [
      /* @__PURE__ */ e("div", { className: "col px-1", onClick: () => C(-1), children: /* @__PURE__ */ e(
        "div",
        {
          className: u(
            null,
            "user-select-none list-group-item list-group-item-action border-0 px-0 py-1 rounded text-secondary",
            p.brlCursorPointer
          ),
          children: /* @__PURE__ */ e(K, {})
        }
      ) }),
      /* @__PURE__ */ e("div", { className: "col px-1" }),
      /* @__PURE__ */ e("div", { className: "col px-1" }),
      /* @__PURE__ */ e("div", { className: "col px-1" }),
      /* @__PURE__ */ e("div", { className: "col px-1" }),
      /* @__PURE__ */ e("div", { className: "col px-1" }),
      /* @__PURE__ */ e("div", { className: "col px-1", onClick: () => C(1), children: /* @__PURE__ */ e(
        "div",
        {
          className: u(
            null,
            "user-select-none list-group-item list-group-item-action border-0 px-0 py-1 rounded text-secondary",
            p.brlCursorPointer
          ),
          children: /* @__PURE__ */ e(L, {})
        }
      ) }),
      /* @__PURE__ */ e("div", { className: "position-absolute top-50 start-50 translate-middle w-auto text-nowrap", children: D(new Date(s, o), "MMMM yyyy", {
        locale: l
      }) })
    ] }),
    B.rows.map((r, a) => /* @__PURE__ */ e("div", { className: "row text-center", children: r.map((t, i) => a === 0 ? /* @__PURE__ */ e("div", { className: "col px-1", children: /* @__PURE__ */ e("div", { className: "list-group-item border-0 px-0 py-1 rounded text-body-secondary", children: t.value }) }, `${t.value}${i}`) : /* @__PURE__ */ e("div", { className: "col px-1", onClick: () => Y(t), children: /* @__PURE__ */ e(
      "div",
      {
        className: u(
          null,
          "list-group-item list-group-item-action px-0 py-1 rounded",
          p.brlCursorPointer,
          !t.isCurrentMonth && !t.active && "text-body-tertiary",
          t.active && "active",
          t.isToday ? "border-secondary-subtle" : "border-0"
        ),
        children: D(t.date, "d", { locale: l })
      }
    ) }, t.date.toISOString())) }, a))
  ] }) });
};
A.displayName = "BRL.DatePickerDate";
export {
  A as D
};
//# sourceMappingURL=date-picker-date.js.map
