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