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