impact-nova 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,192 +1,191 @@
1
- import { jsxs as C, jsx as c } from "react/jsx-runtime";
2
- import * as u from "react";
1
+ import { jsxs as Y, jsx as c } from "react/jsx-runtime";
2
+ import * as d from "react";
3
3
  import { ChevronLeftIcon as we, ChevronRightIcon as ye } from "lucide-react";
4
- import { getDefaultClassNames as Fe, DayPicker as He } from "react-day-picker";
5
- import { cn as d } from "../../lib/utils.js";
6
- import { Button as A } from "./button.js";
7
- import "./button-variants.js";
4
+ import { getDefaultClassNames as He, DayPicker as Be } from "react-day-picker";
5
+ import { cn as f } from "../../lib/utils.js";
6
+ import { Button as R } from "./button.js";
8
7
  import ce from "./select/select.js";
9
- import { FISCAL_PATTERNS as Be, resolveWeekSelection as Te } from "../../lib/fiscal-calendar.js";
10
- import { getIntlLocale as We, getDateFnsLocale as qe } from "../../i18n/getDateFnsLocale.js";
11
- import { useImpactNovaI18n as Ge } from "../../i18n/ImpactNovaI18nContext.js";
12
- const de = u.createContext(0);
13
- function st({
8
+ import { FISCAL_PATTERNS as Fe, resolveWeekSelection as Te } from "../../lib/fiscal-calendar.js";
9
+ import { getIntlLocale as Ke, getDateFnsLocale as We } from "../../i18n/getDateFnsLocale.js";
10
+ import { useImpactNovaI18n as qe } from "../../i18n/ImpactNovaI18nContext.js";
11
+ const ue = d.createContext(0);
12
+ function at({
14
13
  className: ae,
15
- classNames: J,
16
- showOutsideDays: D = !1,
17
- captionLayout: K = "dropdown",
18
- buttonVariant: H = "ghost",
14
+ classNames: G,
15
+ showOutsideDays: y = !1,
16
+ captionLayout: J = "dropdown",
17
+ buttonVariant: B = "ghost",
19
18
  formatters: Q,
20
19
  components: Ne,
21
20
  showFooter: x = !0,
22
21
  onApply: X,
23
- onCancel: ue,
24
- onClear: fe,
25
- mode: B = "single",
26
- selected: b,
27
- onSelect: P,
22
+ onCancel: fe,
23
+ onClear: de,
24
+ mode: F = "single",
25
+ selected: D,
26
+ onSelect: U,
28
27
  // Week picker props
29
- pickerType: f = "date",
30
- weekMode: w = "single",
31
- selectedWeeks: _,
32
- onWeekSelect: S,
33
- calendarType: k = "calendar",
28
+ pickerType: m = "date",
29
+ weekMode: v = "single",
30
+ selectedWeeks: C,
31
+ onWeekSelect: A,
32
+ calendarType: L = "calendar",
34
33
  fiscalMode: Z = "basic",
35
34
  selectionMode: se = "week",
36
- fiscalMonthPattern: oe,
35
+ fiscalMonthPattern: le,
37
36
  fiscalYearStartMonth: me = 1,
38
37
  weekStartsOn: T = 1,
39
38
  // Default Monday
40
39
  // Month picker props
41
- monthMode: v = "single",
42
- selectedMonths: y,
43
- onMonthSelect: N,
44
- month: E,
40
+ monthMode: w = "single",
41
+ selectedMonths: N,
42
+ onMonthSelect: _,
43
+ month: H,
45
44
  defaultMonth: ge,
46
45
  onMonthChange: Ce,
47
- startMonth: _e,
48
- endMonth: Se,
46
+ startMonth: Se,
47
+ endMonth: _e,
49
48
  ...he
50
49
  }) {
51
- const { locale: V, t: m } = Ge(), W = u.useMemo(() => We(V), [V]), Ye = u.useMemo(() => qe(V), [V]), xe = u.useMemo(
50
+ const { locale: V, t: h } = qe(), K = d.useMemo(() => Ke(V), [V]), Ye = d.useMemo(() => We(V), [V]), xe = d.useMemo(
52
51
  () => Array.from(
53
52
  { length: 12 },
54
- (e, n) => new Date(2024, n, 1).toLocaleString(W, { month: "long" })
53
+ (e, n) => new Date(2024, n, 1).toLocaleString(K, { month: "long" })
55
54
  ),
56
- [W]
57
- ), Me = u.useMemo(
55
+ [K]
56
+ ), Ae = d.useMemo(
58
57
  () => Array.from(
59
58
  { length: 12 },
60
- (e, n) => new Date(2024, n, 1).toLocaleString(W, { month: "short" })
59
+ (e, n) => new Date(2024, n, 1).toLocaleString(K, { month: "short" })
61
60
  ),
62
- [W]
63
- ), ee = u.useMemo(() => {
64
- if (k === "fiscal") {
65
- if (oe) return oe;
66
- if (Z === "advanced") return Be["4-4-5"];
61
+ [K]
62
+ ), ee = d.useMemo(() => {
63
+ if (L === "fiscal") {
64
+ if (le) return le;
65
+ if (Z === "advanced") return Fe["4-4-5"];
67
66
  }
68
- }, [k, Z, oe]), g = Fe(), je = u.useMemo(() => new Date(1900, 0, 1), []), Ae = u.useMemo(() => new Date(2100, 11, 31), []), z = _e || je, R = Se || Ae, [q, te] = u.useState(b), [Y, be] = u.useState(() => {
69
- if (E) return E;
67
+ }, [L, Z, le]), b = He(), je = d.useMemo(() => new Date(1900, 0, 1), []), Me = d.useMemo(() => new Date(2100, 11, 31), []), E = Se || je, P = _e || Me, [W, te] = d.useState(D), [j, be] = d.useState(() => {
68
+ if (H) return H;
70
69
  if (ge) return ge;
71
- if (b) {
72
- if (Array.isArray(b))
73
- return b[0] || /* @__PURE__ */ new Date();
74
- if (b instanceof Date)
75
- return b;
76
- if ("from" in b && b.from)
77
- return b.from;
70
+ if (D) {
71
+ if (Array.isArray(D))
72
+ return D[0] || /* @__PURE__ */ new Date();
73
+ if (D instanceof Date)
74
+ return D;
75
+ if ("from" in D && D.from)
76
+ return D.from;
78
77
  }
79
78
  return /* @__PURE__ */ new Date();
80
79
  });
81
- u.useEffect(() => {
82
- E && (be(E), ve(E.getFullYear()));
83
- }, [E]);
84
- const [O, ne] = u.useState(_), [j, re] = u.useState(y), [ke, ve] = u.useState(Y.getFullYear());
85
- u.useEffect(() => {
86
- te(b), ne(_), re(y);
87
- }, [b, _, y]);
88
- const L = (e) => {
80
+ d.useEffect(() => {
81
+ H && (be(H), ve(H.getFullYear()));
82
+ }, [H]);
83
+ const [$, ne] = d.useState(C), [M, re] = d.useState(N), [ke, ve] = d.useState(j.getFullYear());
84
+ d.useEffect(() => {
85
+ te(D), ne(C), re(N);
86
+ }, [D, C, N]);
87
+ const O = (e) => {
89
88
  be(e), ve(e.getFullYear()), Ce?.(e);
90
- }, le = u.useCallback((e) => {
89
+ }, oe = d.useCallback((e) => {
91
90
  let n;
92
91
  return e instanceof Date ? n = e : n = e.days.find((t) => !t.outside)?.date || e.days[0]?.date || /* @__PURE__ */ new Date(), Te(n, {
93
- calendarType: k,
92
+ calendarType: L,
94
93
  fiscalMode: Z,
95
94
  selectionMode: se,
96
95
  fiscalMonthPattern: ee,
97
96
  fiscalYearStartMonth: me,
98
97
  weekStartsOn: T
99
98
  });
100
- }, [k, Z, se, ee, me, T]), ie = u.useCallback((e) => {
99
+ }, [L, Z, se, ee, me, T]), ie = d.useCallback((e) => {
101
100
  const n = (t, r) => t.year === r.year && t.month === r.month && t.weekOfMonth === r.weekOfMonth;
102
101
  if (x)
103
102
  ne((t) => {
104
103
  let r;
105
- if (w === "single")
104
+ if (v === "single")
106
105
  r = e;
107
- else if (w === "multiple") {
106
+ else if (v === "multiple") {
108
107
  const a = t || [];
109
- r = a.some((s) => n(s, e)) ? a.filter((s) => !n(s, e)) : [...a, e];
110
- } else if (w === "range") {
108
+ r = a.some((l) => n(l, e)) ? a.filter((l) => !n(l, e)) : [...a, e];
109
+ } else if (v === "range") {
111
110
  const a = t;
112
111
  if (!a?.from || a.to)
113
112
  r = { from: e };
114
113
  else {
115
- const o = { from: a.from, to: e };
116
- e.startDate < a.from.startDate && (o.from = e, o.to = a.from), r = o;
114
+ const s = { from: a.from, to: e };
115
+ e.startDate < a.from.startDate && (s.from = e, s.to = a.from), r = s;
117
116
  }
118
117
  }
119
- return S?.(r), r;
118
+ return A?.(r), r;
120
119
  });
121
- else if (w === "single")
122
- S?.(e);
123
- else if (w === "multiple") {
124
- const t = _ || [], a = t.some((o) => n(o, e)) ? t.filter((o) => !n(o, e)) : [...t, e];
125
- S?.(a.length > 0 ? a : void 0);
126
- } else if (w === "range") {
127
- const t = _;
120
+ else if (v === "single")
121
+ A?.(e);
122
+ else if (v === "multiple") {
123
+ const t = C || [], a = t.some((s) => n(s, e)) ? t.filter((s) => !n(s, e)) : [...t, e];
124
+ A?.(a.length > 0 ? a : void 0);
125
+ } else if (v === "range") {
126
+ const t = C;
128
127
  if (!t?.from || t.to)
129
- S?.({ from: e });
128
+ A?.({ from: e });
130
129
  else {
131
130
  const r = { from: t.from, to: e };
132
- e.startDate < t.from.startDate && (r.from = e, r.to = t.from), S?.(r);
131
+ e.startDate < t.from.startDate && (r.from = e, r.to = t.from), A?.(r);
133
132
  }
134
133
  }
135
- }, [w, x, _, S]), ze = u.useCallback((e, n) => {
136
- const t = { year: e, month: n }, r = (a, o) => a.year === o.year && a.month === o.month;
134
+ }, [v, x, C, A]), ze = d.useCallback((e, n) => {
135
+ const t = { year: e, month: n }, r = (a, s) => a.year === s.year && a.month === s.month;
137
136
  if (x)
138
137
  re((a) => {
139
- let o;
140
- if (v === "single")
141
- o = t;
142
- else if (v === "multiple") {
143
- const s = a || [];
144
- o = s.some((i) => r(i, t)) ? s.filter((i) => !r(i, t)) : [...s, t];
145
- } else if (v === "range") {
146
- const s = a;
147
- if (!s?.from || s.to)
148
- o = { from: t };
138
+ let s;
139
+ if (w === "single")
140
+ s = t;
141
+ else if (w === "multiple") {
142
+ const l = a || [];
143
+ s = l.some((u) => r(u, t)) ? l.filter((u) => !r(u, t)) : [...l, t];
144
+ } else if (w === "range") {
145
+ const l = a;
146
+ if (!l?.from || l.to)
147
+ s = { from: t };
149
148
  else {
150
- const l = new Date(s.from.year, s.from.month, 1);
151
- new Date(t.year, t.month, 1) < l ? o = { from: t, to: s.from } : o = { from: s.from, to: t };
149
+ const o = new Date(l.from.year, l.from.month, 1);
150
+ new Date(t.year, t.month, 1) < o ? s = { from: t, to: l.from } : s = { from: l.from, to: t };
152
151
  }
153
152
  }
154
- return N?.(o), o;
153
+ return _?.(s), s;
155
154
  });
156
- else if (v === "single")
157
- N?.(t);
158
- else if (v === "multiple") {
159
- const a = y || [], s = a.some((l) => r(l, t)) ? a.filter((l) => !r(l, t)) : [...a, t];
160
- N?.(s.length > 0 ? s : void 0);
161
- } else if (v === "range") {
162
- const a = y;
155
+ else if (w === "single")
156
+ _?.(t);
157
+ else if (w === "multiple") {
158
+ const a = N || [], l = a.some((o) => r(o, t)) ? a.filter((o) => !r(o, t)) : [...a, t];
159
+ _?.(l.length > 0 ? l : void 0);
160
+ } else if (w === "range") {
161
+ const a = N;
163
162
  if (!a?.from || a.to)
164
- N?.({ from: t });
163
+ _?.({ from: t });
165
164
  else {
166
- const o = new Date(a.from.year, a.from.month, 1);
167
- new Date(t.year, t.month, 1) < o ? N?.({ from: t, to: a.from }) : N?.({ from: a.from, to: t });
165
+ const s = new Date(a.from.year, a.from.month, 1);
166
+ new Date(t.year, t.month, 1) < s ? _?.({ from: t, to: a.from }) : _?.({ from: a.from, to: t });
168
167
  }
169
168
  }
170
- }, [v, x, y, N]), pe = u.useCallback(() => {
171
- const e = z.getFullYear(), n = R.getFullYear(), t = [];
169
+ }, [w, x, N, _]), pe = d.useCallback(() => {
170
+ const e = E.getFullYear(), n = P.getFullYear(), t = [];
172
171
  for (let r = e; r <= n; r++)
173
172
  t.push({ label: r.toString(), value: r.toString() });
174
173
  return t;
175
- }, [z, R]), Re = u.useCallback((e) => xe.map((t, r) => ({
174
+ }, [E, P]), Ie = d.useCallback((e) => xe.map((t, r) => ({
176
175
  label: t,
177
176
  value: r.toString()
178
177
  })).filter((t, r) => {
179
178
  const a = new Date(e, r, 1);
180
- return !(z && a < new Date(z.getFullYear(), z.getMonth(), 1) || R && a > new Date(R.getFullYear(), R.getMonth(), 1));
181
- }), [z, R, xe]), G = u.useMemo(() => {
182
- if (f !== "week") return;
183
- const e = x ? O : _;
179
+ return !(E && a < new Date(E.getFullYear(), E.getMonth(), 1) || P && a > new Date(P.getFullYear(), P.getMonth(), 1));
180
+ }), [E, P, xe]), q = d.useMemo(() => {
181
+ if (m !== "week") return;
182
+ const e = x ? $ : C;
184
183
  if (!e) return;
185
184
  const n = [], t = (r) => {
186
185
  let a = new Date(r.startDate);
187
186
  a.setHours(0, 0, 0, 0);
188
- const o = new Date(r.endDate);
189
- for (o.setHours(0, 0, 0, 0); a <= o; )
187
+ const s = new Date(r.endDate);
188
+ for (s.setHours(0, 0, 0, 0); a <= s; )
190
189
  n.push(new Date(a)), a.setDate(a.getDate() + 1);
191
190
  };
192
191
  if (Array.isArray(e))
@@ -205,77 +204,82 @@ function st({
205
204
  } else
206
205
  t(e);
207
206
  return n;
208
- }, [f, x, O, _]), Le = u.useMemo(() => {
209
- if (f !== "week" || !G || G.length === 0)
207
+ }, [m, x, $, C]), Re = d.useMemo(() => {
208
+ if (m !== "week" || !q || q.length === 0)
210
209
  return { range_start: [], range_middle: [], range_end: [] };
211
- const e = [...G].sort((s, l) => s.getTime() - l.getTime()), n = [], t = [], r = [], a = (s, l) => {
212
- if (l === 0) return !1;
213
- const i = e[l - 1];
214
- return s.getTime() - i.getTime() <= 1440 * 60 * 1e3;
215
- }, o = (s, l) => l === e.length - 1 ? !1 : e[l + 1].getTime() - s.getTime() <= 1440 * 60 * 1e3;
216
- return e.forEach((s, l) => {
217
- const i = a(s, l), h = o(s, l);
218
- !i && !h ? (n.push(s), r.push(s)) : i ? h ? t.push(s) : r.push(s) : n.push(s);
210
+ const e = [...q].sort((i, g) => i.getTime() - g.getTime()), n = [], t = [], r = [], a = x ? $ : C, s = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
211
+ v === "multiple" && Array.isArray(a) && a.forEach((i) => {
212
+ const g = i.startDate.toISOString().split("T")[0], p = i.endDate.toISOString().split("T")[0];
213
+ s.add(g), l.add(p);
214
+ });
215
+ const o = (i, g) => {
216
+ if (g === 0) return !1;
217
+ const p = e[g - 1];
218
+ return i.getTime() - p.getTime() <= 1440 * 60 * 1e3;
219
+ }, u = (i, g) => g === e.length - 1 ? !1 : e[g + 1].getTime() - i.getTime() <= 1440 * 60 * 1e3;
220
+ return e.forEach((i, g) => {
221
+ const p = i.toISOString().split("T")[0], k = s.has(p), S = l.has(p), z = o(i, g), I = u(i, g);
222
+ v === "multiple" ? k ? n.push(i) : S ? r.push(i) : t.push(i) : !z && !I ? (n.push(i), r.push(i)) : z ? I ? t.push(i) : r.push(i) : n.push(i);
219
223
  }), {
220
224
  range_start: n,
221
225
  range_middle: t,
222
226
  range_end: r
223
227
  };
224
- }, [f, G]), Ie = u.useCallback((e) => {
225
- if (f === "week" && e) {
228
+ }, [m, q, v, x, $, C]), Le = d.useCallback((e) => {
229
+ if (m === "week" && e) {
226
230
  const n = Array.isArray(e) ? e[e.length - 1] : e instanceof Date ? e : void 0;
227
231
  if (n) {
228
- const t = le(n);
232
+ const t = oe(n);
229
233
  ie(t);
230
234
  return;
231
235
  }
232
236
  }
233
- x && te(e), P?.(e);
234
- }, [x, P, f, le, ie]), Pe = u.useCallback(() => {
235
- f === "week" ? (S?.(O), X?.(O)) : f === "month" ? (N?.(j), X?.(j)) : (P?.(q), X?.(q));
236
- }, [q, O, j, P, S, N, X, f]), $e = u.useCallback(() => {
237
- f === "week" ? ne(_) : f === "month" ? re(y) : te(b), ue?.();
238
- }, [b, _, y, ue, f]), Ee = u.useCallback(() => {
239
- f === "week" ? (ne(void 0), x || S?.(void 0)) : f === "month" ? (re(void 0), x || N?.(void 0)) : (te(void 0), x || P?.(void 0)), fe?.();
240
- }, [x, P, S, N, fe, f]), Oe = u.useCallback((e, n) => {
241
- const t = x ? j : y;
237
+ x && te(e), U?.(e);
238
+ }, [x, U, m, oe, ie]), Ee = d.useCallback(() => {
239
+ m === "week" ? (A?.($), X?.($)) : m === "month" ? (_?.(M), X?.(M)) : (U?.(W), X?.(W));
240
+ }, [W, $, M, U, A, _, X, m]), Pe = d.useCallback(() => {
241
+ m === "week" ? ne(C) : m === "month" ? re(N) : te(D), fe?.();
242
+ }, [D, C, N, fe, m]), $e = d.useCallback(() => {
243
+ m === "week" ? (ne(void 0), x || A?.(void 0)) : m === "month" ? (re(void 0), x || _?.(void 0)) : (te(void 0), x || U?.(void 0)), de?.();
244
+ }, [x, U, A, _, de, m]), Oe = d.useCallback((e, n) => {
245
+ const t = x ? M : N;
242
246
  if (!t) return !1;
243
247
  if (Array.isArray(t))
244
248
  return t.some((r) => r.year === e && r.month === n);
245
249
  if ("from" in t) {
246
- const r = t, a = r.from, o = r.to, s = new Date(e, n, 1).getTime(), l = new Date(a.year, a.month, 1).getTime();
247
- if (!o) return s === l;
248
- const i = new Date(o.year, o.month, 1).getTime();
249
- return s >= l && s <= i;
250
+ const r = t, a = r.from, s = r.to, l = new Date(e, n, 1).getTime(), o = new Date(a.year, a.month, 1).getTime();
251
+ if (!s) return l === o;
252
+ const u = new Date(s.year, s.month, 1).getTime();
253
+ return l >= o && l <= u;
250
254
  } else {
251
255
  const r = t;
252
256
  return r.year === e && r.month === n;
253
257
  }
254
- }, [x, j, y]), Ue = u.useCallback((e, n) => {
255
- const t = x ? j : y;
258
+ }, [x, M, N]), Ue = d.useCallback((e, n) => {
259
+ const t = x ? M : N;
256
260
  if (!t || !("from" in t)) return { isStart: !1, isEnd: !1, isMiddle: !1 };
257
- const r = t, a = r.from, o = r.to, s = new Date(e, n, 1).getTime(), l = new Date(a.year, a.month, 1).getTime();
258
- if (!o) return { isStart: s === l, isEnd: !1, isMiddle: !1 };
259
- const i = new Date(o.year, o.month, 1).getTime();
261
+ const r = t, a = r.from, s = r.to, l = new Date(e, n, 1).getTime(), o = new Date(a.year, a.month, 1).getTime();
262
+ if (!s) return { isStart: l === o, isEnd: !1, isMiddle: !1 };
263
+ const u = new Date(s.year, s.month, 1).getTime();
260
264
  return {
261
- isStart: s === l,
262
- isEnd: s === i,
263
- isMiddle: s > l && s < i
265
+ isStart: l === o,
266
+ isEnd: l === u,
267
+ isMiddle: l > o && l < u
264
268
  };
265
- }, [x, j, y]), De = ({ yearOffset: e = 0 }) => {
269
+ }, [x, M, N]), De = ({ yearOffset: e = 0 }) => {
266
270
  const n = ke + e;
267
- return /* @__PURE__ */ C("div", { className: "flex flex-col gap-4 p-3 min-w-[280px]", children: [
268
- /* @__PURE__ */ C("div", { className: "flex items-center justify-between", children: [
271
+ return /* @__PURE__ */ Y("div", { className: "flex flex-col gap-4 p-3 min-w-[280px]", children: [
272
+ /* @__PURE__ */ Y("div", { className: "flex items-center justify-between", children: [
269
273
  e === 0 && /* @__PURE__ */ c(
270
- A,
274
+ R,
271
275
  {
272
276
  variant: "ghost",
273
277
  size: "icon",
274
278
  className: "h-7 w-7",
275
- "aria-label": m("calendar.previousYear"),
276
- title: m("calendar.previousYear"),
277
- disabled: n <= z.getFullYear(),
278
- onClick: () => L(new Date(n - 1, Y.getMonth(), 1)),
279
+ "aria-label": h("calendar.previousYear"),
280
+ title: h("calendar.previousYear"),
281
+ disabled: n <= E.getFullYear(),
282
+ onClick: () => O(new Date(n - 1, j.getMonth(), 1)),
279
283
  children: /* @__PURE__ */ c(we, { className: "h-4 w-4" })
280
284
  }
281
285
  ),
@@ -286,7 +290,7 @@ function st({
286
290
  onChange: (t) => {
287
291
  if (t && "value" in t) {
288
292
  const r = parseInt(t.value) - e;
289
- L(new Date(r, Y.getMonth(), 1));
293
+ O(new Date(r, j.getMonth(), 1));
290
294
  }
291
295
  },
292
296
  scrollToSelectedOnOpen: !0,
@@ -296,41 +300,41 @@ function st({
296
300
  menuWidth: "140px"
297
301
  }
298
302
  ) }),
299
- (v === "single" || e === 1) && /* @__PURE__ */ c(
300
- A,
303
+ (w === "single" || e === 1) && /* @__PURE__ */ c(
304
+ R,
301
305
  {
302
306
  variant: "ghost",
303
307
  size: "icon",
304
308
  className: "h-7 w-7",
305
- "aria-label": m("calendar.nextYear"),
306
- title: m("calendar.nextYear"),
307
- disabled: n >= R.getFullYear(),
308
- onClick: () => L(new Date(n + 1, Y.getMonth(), 1)),
309
+ "aria-label": h("calendar.nextYear"),
310
+ title: h("calendar.nextYear"),
311
+ disabled: n >= P.getFullYear(),
312
+ onClick: () => O(new Date(n + 1, j.getMonth(), 1)),
309
313
  children: /* @__PURE__ */ c(ye, { className: "h-4 w-4" })
310
314
  }
311
315
  )
312
316
  ] }),
313
- /* @__PURE__ */ c("div", { className: "grid grid-cols-4 gap-y-4 gap-x-0", children: Me.map((t, r) => {
314
- const a = Oe(n, r), { isStart: o, isEnd: s, isMiddle: l } = Ue(n, r), i = v === "range", h = x ? j : y, p = h && "to" in h && !!h.to;
315
- return /* @__PURE__ */ C("div", { className: "relative flex items-center justify-center h-10 w-full group", children: [
316
- i && p && (l || o || s) && /* @__PURE__ */ c("div", { className: d(
317
+ /* @__PURE__ */ c("div", { className: "grid grid-cols-4 gap-y-4 gap-x-0", children: Ae.map((t, r) => {
318
+ const a = Oe(n, r), { isStart: s, isEnd: l, isMiddle: o } = Ue(n, r), u = w === "range", i = x ? M : N, g = i && "to" in i && !!i.to;
319
+ return /* @__PURE__ */ Y("div", { className: "relative flex items-center justify-center h-10 w-full group", children: [
320
+ u && g && (o || s || l) && /* @__PURE__ */ c("div", { className: f(
317
321
  "absolute inset-y-0 inset-x-0 bg-accent",
318
- o && "rounded-l-full left-1/2 -ml-5",
319
- s && "rounded-r-full right-1/2 -mr-5",
320
- l && "inset-x-0",
321
- o && s && "rounded-full inset-x-2"
322
+ s && "rounded-l-full left-1/2 -ml-5",
323
+ l && "rounded-r-full right-1/2 -mr-5",
324
+ o && "inset-x-0",
325
+ s && l && "rounded-full inset-x-2"
322
326
  ) }),
323
327
  /* @__PURE__ */ c(
324
- A,
328
+ R,
325
329
  {
326
330
  variant: "ghost",
327
331
  onClick: () => ze(n, r),
328
- className: d(
332
+ className: f(
329
333
  "relative z-10 w-10 h-10 p-0 text-sm font-normal rounded-lg transition-all",
330
- a && !i && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground",
331
- i && (o || s) && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground rounded-lg",
334
+ a && !u && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground",
335
+ u && (s || l) && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground rounded-lg",
332
336
  !a && "hover:bg-accent hover:text-accent-foreground border border-transparent hover:border-brand",
333
- l && "text-accent-foreground"
337
+ o && "text-accent-foreground"
334
338
  ),
335
339
  children: t
336
340
  }
@@ -339,10 +343,10 @@ function st({
339
343
  }) })
340
344
  ] });
341
345
  };
342
- return /* @__PURE__ */ C("div", { className: "flex flex-col ", "data-component": "calendar", children: [
343
- f === "month" ? /* @__PURE__ */ C("div", { className: "flex flex-col md:flex-row", children: [
346
+ return /* @__PURE__ */ Y("div", { className: "flex flex-col ", "data-component": "calendar", children: [
347
+ m === "month" ? /* @__PURE__ */ Y("div", { className: "flex flex-col md:flex-row", children: [
344
348
  /* @__PURE__ */ c(De, { yearOffset: 0 }),
345
- (v === "range" || v === "multiple") && /* @__PURE__ */ C("div", { className: "flex flex-row gap-0", children: [
349
+ (w === "range" || w === "multiple") && /* @__PURE__ */ Y("div", { className: "flex flex-row gap-0", children: [
346
350
  /* @__PURE__ */ c("div", { className: "w-[1px] bg-stroke-hairline my-4" }),
347
351
  /* @__PURE__ */ c(De, { yearOffset: 1 })
348
352
  ] })
@@ -350,114 +354,114 @@ function st({
350
354
  // @ts-ignore: TS mismatch due to dynamic union types.
351
355
  // FIX: Split rendering into separate `DayPicker` calls for 'single' | 'multiple' | 'range' to strictly match discriminated unions.
352
356
  /* @__PURE__ */ c(
353
- He,
357
+ Be,
354
358
  {
355
- mode: f === "week" ? "multiple" : B,
356
- selected: f === "week" ? G : x ? q : b,
357
- onSelect: Ie,
358
- month: Y,
359
- onMonthChange: L,
360
- showOutsideDays: k === "fiscal" ? !0 : D,
359
+ mode: m === "week" ? "multiple" : F,
360
+ selected: m === "week" ? q : x ? W : D,
361
+ onSelect: Le,
362
+ month: j,
363
+ onMonthChange: O,
364
+ showOutsideDays: L === "fiscal" ? !0 : y,
361
365
  weekStartsOn: T,
362
- modifiers: f === "week" ? Le : void 0,
366
+ modifiers: m === "week" ? Re : void 0,
363
367
  locale: Ye,
364
- className: d(
368
+ className: f(
365
369
  "bg-canvas group/calendar p-2 [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
366
370
  String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
367
371
  String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
368
372
  ae
369
373
  ),
370
- captionLayout: K,
371
- startMonth: z,
372
- endMonth: R,
374
+ captionLayout: J,
375
+ startMonth: E,
376
+ endMonth: P,
373
377
  disabled: he.disabled,
374
- numberOfMonths: B === "range" || B === "multiple" || w === "range" || w === "multiple" ? 2 : 1,
378
+ numberOfMonths: F === "range" || F === "multiple" || v === "range" || v === "multiple" ? 2 : 1,
375
379
  showWeekNumber: !0,
376
380
  formatters: {
377
- formatMonthDropdown: (e) => e.toLocaleString(W, { month: "short" }),
378
- formatWeekNumber: (e) => m("calendar.weekNumber", { number: e }),
381
+ formatMonthDropdown: (e) => e.toLocaleString(K, { month: "short" }),
382
+ formatWeekNumber: (e) => h("calendar.weekNumber", { number: e }),
379
383
  ...Q
380
384
  },
381
385
  classNames: {
382
- root: d("w-fit", g.root),
383
- months: d(
386
+ root: f("w-fit", b.root),
387
+ months: f(
384
388
  "relative flex flex-col gap-2 md:flex-row",
385
- g.months
389
+ b.months
386
390
  ),
387
- month: d(
391
+ month: f(
388
392
  "flex flex-1 min-w-[252px] flex-col gap-2 relative after:absolute after:top-[5.5rem] after:bottom-0 after:left-[30px] after:w-[1px] after:bg-stroke-hairline",
389
- g.month
393
+ b.month
390
394
  ),
391
- nav: d(
395
+ nav: f(
392
396
  "absolute inset-x-0 top-[2px] h-[--cell-size] flex w-full items-center justify-between px-2 gap-1",
393
- g.nav
397
+ b.nav
394
398
  ),
395
- button_previous: d(
399
+ button_previous: f(
396
400
  "h-7 w-7 select-none p-0 z-10 aria-disabled:opacity-50 flex items-center justify-center relative",
397
- g.button_previous
401
+ b.button_previous
398
402
  ),
399
- button_next: d(
403
+ button_next: f(
400
404
  "h-7 w-7 select-none p-0 z-10 aria-disabled:opacity-50 flex items-center justify-center relative",
401
- g.button_next
405
+ b.button_next
402
406
  ),
403
- month_caption: d(
407
+ month_caption: f(
404
408
  "flex h-[--cell-size] w-full items-center justify-center px-[--cell-size] relative ",
405
- g.month_caption
409
+ b.month_caption
406
410
  ),
407
- dropdowns: d(
411
+ dropdowns: f(
408
412
  "flex h-[--cell-size] gap-1 items-center justify-center text-sm font-medium relative ",
409
- g.dropdowns
413
+ b.dropdowns
410
414
  ),
411
- caption_label: d(
415
+ caption_label: f(
412
416
  "select-none font-medium text-sm",
413
- g.caption_label
417
+ b.caption_label
414
418
  ),
415
419
  table: "w-full border-collapse",
416
- weekdays: d("flex w-full relative after:absolute after:bottom-0 after:right-0 after:h-[1px] after:bg-stroke-hairline after:left-[30px]", g.weekdays),
417
- weekday: d(
420
+ weekdays: f("flex w-full relative after:absolute after:bottom-0 after:right-0 after:h-[1px] after:bg-stroke-hairline after:left-[30px]", b.weekdays),
421
+ weekday: f(
418
422
  "flex-1 select-none rounded-md font-normal text-center",
419
423
  "text-[11px] text-content-muted pb-2",
420
424
  "[&:nth-child(2)]:pl-2",
421
- g.weekday
425
+ b.weekday
422
426
  ),
423
- week: d("mt-1 flex w-full items-stretch group/week", g.week),
424
- week_number_header: d(
427
+ week: f("mt-1 flex w-full items-stretch group/week", b.week),
428
+ week_number_header: f(
425
429
  "select-none font-normal text-center h-[30px] flex items-center justify-center",
426
430
  "text-[11px] text-content-muted w-[30px] flex-shrink-0",
427
- g.week_number_header
431
+ b.week_number_header
428
432
  ),
429
- week_number: d(
433
+ week_number: f(
430
434
  "select-none flex items-center justify-center h-[30px]",
431
435
  "text-[11px] text-content-muted w-[30px] flex-shrink-0 transition-colors",
432
- f === "week" && "group-hover/week:bg-accent group-hover/week:rounded-l-lg",
433
- g.week_number
436
+ m === "week" && "group-hover/week:bg-accent group-hover/week:rounded-l-lg",
437
+ b.week_number
434
438
  ),
435
- day: d(
439
+ day: f(
436
440
  "group/day relative select-none p-0 text-center flex-1 h-[30px] flex items-center justify-center [&:nth-child(2)]:pl-2 rdp-day",
437
- f === "week" && "group-hover/week:bg-accent [&:nth-child(2)]:group-hover/week:rounded-l-full [&:nth-child(8)]:group-hover/week:rounded-r-full",
438
- f === "week" && "[&.rdp-selected:nth-child(2)]:rounded-l-full [&.rdp-selected:nth-child(8)]:rounded-r-full",
439
- J?.day
441
+ m === "week" && "group-hover/week:bg-accent [&:nth-child(2)]:group-hover/week:rounded-l-full [&:nth-child(8)]:group-hover/week:rounded-r-full",
442
+ m === "week" && "[&.rdp-selected:nth-child(2)]:rounded-l-full [&.rdp-selected:nth-child(8)]:rounded-r-full",
443
+ G?.day
440
444
  ),
441
- range_start: d(
445
+ range_start: f(
442
446
  "bg-accent rounded-l-full",
443
- g.range_start
447
+ b.range_start
444
448
  ),
445
- range_middle: d("bg-accent rounded-none", g.range_middle),
446
- range_end: d("bg-accent rounded-r-full", g.range_end),
447
- today: d(
449
+ range_middle: f("bg-accent rounded-none", b.range_middle),
450
+ range_end: f("bg-accent rounded-r-full", b.range_end),
451
+ today: f(
448
452
  "text-brand",
449
- g.today
453
+ b.today
450
454
  ),
451
- outside: d(
452
- k === "fiscal" || D ? "text-content-muted opacity-50" : "invisible",
453
- g.outside
455
+ outside: f(
456
+ L === "fiscal" || y ? "text-content-muted opacity-50" : "invisible",
457
+ b.outside
454
458
  ),
455
- disabled: d(
459
+ disabled: f(
456
460
  "text-content-muted opacity-50",
457
- g.disabled
461
+ b.disabled
458
462
  ),
459
- hidden: d("invisible", g.hidden),
460
- ...J
463
+ hidden: f("invisible", b.hidden),
464
+ ...G
461
465
  },
462
466
  components: {
463
467
  Root: ({ className: e, rootRef: n, ...t }) => /* @__PURE__ */ c(
@@ -465,83 +469,83 @@ function st({
465
469
  {
466
470
  "data-slot": "calendar",
467
471
  ref: n,
468
- className: d(e),
472
+ className: f(e),
469
473
  ...t
470
474
  }
471
475
  ),
472
- Chevron: ({ className: e, orientation: n, ...t }) => n === "left" ? /* @__PURE__ */ c(we, { className: d("size-4 text-content", e), ...t }) : n === "right" ? /* @__PURE__ */ c(
476
+ Chevron: ({ className: e, orientation: n, ...t }) => n === "left" ? /* @__PURE__ */ c(we, { className: f("size-4 text-content", e), ...t }) : n === "right" ? /* @__PURE__ */ c(
473
477
  ye,
474
478
  {
475
- className: d("size-4 text-content", e),
479
+ className: f("size-4 text-content", e),
476
480
  ...t
477
481
  }
478
482
  ) : /* @__PURE__ */ c("span", {}),
479
483
  PreviousMonthButton: (e) => /* @__PURE__ */ c(
480
- A,
484
+ R,
481
485
  {
482
- variant: H,
486
+ variant: B,
483
487
  size: "icon",
484
488
  className: "h-7 w-7",
485
- "aria-label": m("calendar.previousMonth"),
486
- title: m("calendar.previousMonth"),
489
+ "aria-label": h("calendar.previousMonth"),
490
+ title: h("calendar.previousMonth"),
487
491
  ...e
488
492
  }
489
493
  ),
490
494
  NextMonthButton: (e) => /* @__PURE__ */ c(
491
- A,
495
+ R,
492
496
  {
493
- variant: H,
497
+ variant: B,
494
498
  size: "icon",
495
499
  className: "h-7 w-7",
496
- "aria-label": m("calendar.nextMonth"),
497
- title: m("calendar.nextMonth"),
500
+ "aria-label": h("calendar.nextMonth"),
501
+ title: h("calendar.nextMonth"),
498
502
  ...e
499
503
  }
500
504
  ),
501
- MonthCaption: ({ displayIndex: e, ...n }) => /* @__PURE__ */ c(de.Provider, { value: e, children: /* @__PURE__ */ c("div", { ...n }) }),
505
+ MonthCaption: ({ displayIndex: e, ...n }) => /* @__PURE__ */ c(ue.Provider, { value: e, children: /* @__PURE__ */ c("div", { ...n }) }),
502
506
  MonthsDropdown: ({ value: e }) => {
503
- const n = u.useContext(de), t = n > 0, a = new Date(Y.getFullYear(), Y.getMonth() + n, 1).getFullYear(), o = Re(a);
507
+ const n = d.useContext(ue), t = n > 0, a = new Date(j.getFullYear(), j.getMonth() + n, 1).getFullYear(), s = Ie(a);
504
508
  return /* @__PURE__ */ c(
505
509
  ce,
506
510
  {
507
- value: o.find((s) => s.value === e?.toString()),
508
- onChange: (s) => {
509
- if (s && "value" in s) {
510
- const l = parseInt(s.value);
511
+ value: s.find((l) => l.value === e?.toString()),
512
+ onChange: (l) => {
513
+ if (l && "value" in l) {
514
+ const o = parseInt(l.value);
511
515
  if (t) {
512
- const i = new Date(a, l - 1, 1);
513
- L(i);
516
+ const u = new Date(a, o - 1, 1);
517
+ O(u);
514
518
  } else {
515
- const i = new Date(a, l, 1);
516
- L(i);
519
+ const u = new Date(a, o, 1);
520
+ O(u);
517
521
  }
518
522
  }
519
523
  },
520
524
  scrollToSelectedOnOpen: !0,
521
- options: o,
525
+ options: s,
522
526
  className: "w-[95px]",
523
527
  menuWidth: "140px",
524
528
  isSearchable: !0,
525
529
  isClearable: !1,
526
- placeholder: m("calendar.monthPlaceholder")
530
+ placeholder: h("calendar.monthPlaceholder")
527
531
  }
528
532
  );
529
533
  },
530
534
  YearsDropdown: ({ value: e }) => {
531
- const t = u.useContext(de) > 0, r = pe();
535
+ const t = d.useContext(ue) > 0, r = pe();
532
536
  return /* @__PURE__ */ c(
533
537
  ce,
534
538
  {
535
539
  value: r.find((a) => a.value === e?.toString()),
536
540
  onChange: (a) => {
537
541
  if (a && "value" in a) {
538
- const o = parseInt(a.value);
542
+ const s = parseInt(a.value);
539
543
  if (t) {
540
- const s = new Date(Y.getFullYear(), Y.getMonth() + 1, 1).getMonth(), l = new Date(o, s - 1, 1);
541
- L(l);
544
+ const l = new Date(j.getFullYear(), j.getMonth() + 1, 1).getMonth(), o = new Date(s, l - 1, 1);
545
+ O(o);
542
546
  } else {
543
- const s = new Date(o, Y.getMonth(), 1);
544
- L(s);
547
+ const l = new Date(s, j.getMonth(), 1);
548
+ O(l);
545
549
  }
546
550
  }
547
551
  },
@@ -551,54 +555,54 @@ function st({
551
555
  menuWidth: "140px",
552
556
  isSearchable: !0,
553
557
  isClearable: !1,
554
- placeholder: m("calendar.yearPlaceholder")
558
+ placeholder: h("calendar.yearPlaceholder")
555
559
  }
556
560
  );
557
561
  },
558
562
  DayButton: (e) => /* @__PURE__ */ c(
559
- Je,
563
+ Ge,
560
564
  {
561
565
  ...e,
562
- pickerType: f
566
+ pickerType: m
563
567
  }
564
568
  ),
565
569
  WeekNumber: ({ week: e, ...n }) => {
566
- const t = e.days.find((F) => !F.outside)?.date;
570
+ const t = e.days.find((I) => !I.outside)?.date;
567
571
  if (!t)
568
- return /* @__PURE__ */ c("td", { ...n, className: d("select-none flex items-center justify-center h-8 text-[11px] text-content-muted w-8 flex-shrink-0 rdp-week_number", n.className), children: /* @__PURE__ */ c("div", { className: "flex size-[--cell-size] items-center justify-center text-center" }) });
569
- const r = t.getFullYear(), a = t.getMonth(), l = (new Date(r, a, 1).getDay() + 7 - T) % 7, i = new Date(r, a, 1 - l), h = new Date(t), I = (t.getDay() + 7 - T) % 7;
570
- h.setDate(t.getDate() - I);
571
- const M = Math.round((h.getTime() - i.getTime()) / (10080 * 60 * 1e3)) + 1, U = m("calendar.weekLabel", { number: M });
572
- return f === "week" ? /* @__PURE__ */ c(
572
+ return /* @__PURE__ */ c("td", { ...n, className: f("select-none flex items-center justify-center h-8 text-[11px] text-content-muted w-8 flex-shrink-0 rdp-week_number", n.className), children: /* @__PURE__ */ c("div", { className: "flex size-[--cell-size] items-center justify-center text-center" }) });
573
+ const r = t.getFullYear(), a = t.getMonth(), o = (new Date(r, a, 1).getDay() + 7 - T) % 7, u = new Date(r, a, 1 - o), i = new Date(t), p = (t.getDay() + 7 - T) % 7;
574
+ i.setDate(t.getDate() - p);
575
+ const S = Math.round((i.getTime() - u.getTime()) / (10080 * 60 * 1e3)) + 1, z = h("calendar.weekLabel", { number: S });
576
+ return m === "week" ? /* @__PURE__ */ c(
573
577
  "td",
574
578
  {
575
579
  ...n,
576
- "aria-label": U,
577
- "data-week-index": M,
578
- "data-week-number": M,
579
- className: d(
580
+ "aria-label": z,
581
+ "data-week-index": S,
582
+ "data-week-number": S,
583
+ className: f(
580
584
  "select-none flex items-center justify-center h-[30px] w-[30px] flex-shrink-0 rdp-week_number cursor-pointer hover:bg-accent hover:text-accent-foreground group-hover/week:bg-accent group-hover/week:rounded-l-lg rounded-lg transition-colors",
581
585
  n.className
582
586
  ),
583
587
  scope: "row",
584
588
  role: "rowheader",
585
- onClick: (F) => {
586
- F.preventDefault(), F.stopPropagation(), ie(le(e));
589
+ onClick: (I) => {
590
+ I.preventDefault(), I.stopPropagation(), ie(oe(e));
587
591
  },
588
- children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center text-[11px] text-content-muted", children: m("calendar.weekNumber", { number: M }) })
592
+ children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center text-[11px] text-content-muted", children: h("calendar.weekNumber", { number: S }) })
589
593
  }
590
594
  ) : /* @__PURE__ */ c(
591
595
  "td",
592
596
  {
593
597
  ...n,
594
- "aria-label": U,
595
- className: d(
598
+ "aria-label": z,
599
+ className: f(
596
600
  "select-none flex items-center justify-center h-[30px] text-[11px] text-content-muted w-[30px] flex-shrink-0 rdp-week_number",
597
601
  n.className
598
602
  ),
599
603
  scope: "row",
600
604
  role: "rowheader",
601
- children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center", children: m("calendar.weekNumber", { number: M }) })
605
+ children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center", children: h("calendar.weekNumber", { number: S }) })
602
606
  }
603
607
  );
604
608
  },
@@ -608,11 +612,11 @@ function st({
608
612
  }
609
613
  )
610
614
  ),
611
- x && /* @__PURE__ */ C("div", { className: d("flex items-center gap-2 border-t pt-3 p-3", f === "month" && v !== "single" || B === "range" || w === "range" || w === "multiple" ? "justify-between" : "justify-end"), children: [
612
- B === "range" && f === "date" && /* @__PURE__ */ C("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
615
+ x && /* @__PURE__ */ Y("div", { className: f("flex items-center gap-2 border-t pt-3 p-3", m === "month" && w !== "single" || F === "range" || v === "range" || v === "multiple" ? "justify-between" : "justify-end"), children: [
616
+ F === "range" && m === "date" && /* @__PURE__ */ Y("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
613
617
  "Selected:",
614
618
  /* @__PURE__ */ c("span", { className: "text-content font-semibold", children: (() => {
615
- const e = q;
619
+ const e = W;
616
620
  if (e?.from && e?.to) {
617
621
  const n = Math.abs(e.to.getTime() - e.from.getTime()), t = Math.ceil(n / (1e3 * 60 * 60 * 24)) + 1;
618
622
  return `${t} day${t !== 1 ? "s" : ""}`;
@@ -620,123 +624,123 @@ function st({
620
624
  return "0 days";
621
625
  })() })
622
626
  ] }),
623
- f === "week" && (w === "range" || w === "multiple") && /* @__PURE__ */ C("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
627
+ m === "week" && (v === "range" || v === "multiple") && /* @__PURE__ */ Y("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
624
628
  "Selected:",
625
629
  /* @__PURE__ */ c("span", { className: "text-content font-semibold", children: (() => {
626
- const e = O;
630
+ const e = $;
627
631
  if (!e) return "0 weeks";
628
- const n = (l) => Date.UTC(l.getFullYear(), l.getMonth(), l.getDate()), t = (l) => {
629
- const i = Math.floor(l / 7), h = l % 7, p = [];
630
- return i > 0 && p.push(`${i} week${i !== 1 ? "s" : ""}`), (h > 0 || i === 0) && p.push(`${h} day${h !== 1 ? "s" : ""}`), p.join(" ");
631
- }, r = k === "fiscal" && se === "fiscalMonth", a = k === "fiscal", o = r ? "fiscal month" : a ? "fiscal week" : "week", s = r ? "fiscal months" : a ? "fiscal weeks" : "weeks";
632
+ const n = (o) => Date.UTC(o.getFullYear(), o.getMonth(), o.getDate()), t = (o) => {
633
+ const u = Math.floor(o / 7), i = o % 7, g = [];
634
+ return u > 0 && g.push(`${u} week${u !== 1 ? "s" : ""}`), (i > 0 || u === 0) && g.push(`${i} day${i !== 1 ? "s" : ""}`), g.join(" ");
635
+ }, r = L === "fiscal" && se === "fiscalMonth", a = L === "fiscal", s = r ? "fiscal month" : a ? "fiscal week" : "week", l = r ? "fiscal months" : a ? "fiscal weeks" : "weeks";
632
636
  if (Array.isArray(e))
633
637
  if (a || r) {
634
- const l = e.length;
635
- return `${l} ${l !== 1 ? s : o}`;
638
+ const o = e.length;
639
+ return `${o} ${o !== 1 ? l : s}`;
636
640
  } else {
637
- let l = 0;
638
- return e.forEach((i) => {
639
- const h = n(i.startDate), p = n(i.endDate);
640
- l += Math.round((p - h) / (1e3 * 60 * 60 * 24)) + 1;
641
- }), t(l);
641
+ let o = 0;
642
+ return e.forEach((u) => {
643
+ const i = n(u.startDate), g = n(u.endDate);
644
+ o += Math.round((g - i) / (1e3 * 60 * 60 * 24)) + 1;
645
+ }), t(o);
642
646
  }
643
647
  else if ("from" in e) {
644
- const { from: l, to: i } = e;
648
+ const { from: o, to: u } = e;
645
649
  if (r) {
646
- if (!i) return `1 ${o}`;
647
- const h = n(l.startDate), p = n(i.endDate), I = Math.round(Math.abs(p - h) / (1e3 * 60 * 60 * 24)) + 1, $ = ee ? ee.reduce((U, F) => U + F, 0) / 12 : 4.33, M = Math.max(1, Math.round(I / ($ * 7)));
648
- return `${M} ${M !== 1 ? s : o}`;
650
+ if (!u) return `1 ${s}`;
651
+ const i = n(o.startDate), g = n(u.endDate), p = Math.round(Math.abs(g - i) / (1e3 * 60 * 60 * 24)) + 1, k = ee ? ee.reduce((z, I) => z + I, 0) / 12 : 4.33, S = Math.max(1, Math.round(p / (k * 7)));
652
+ return `${S} ${S !== 1 ? l : s}`;
649
653
  } else if (a) {
650
- if (!i) return `1 ${o}`;
651
- const h = n(l.startDate), p = n(i.endDate), I = Math.round((p - h) / (10080 * 60 * 1e3)), $ = I > 0 ? I : 1;
652
- return `${$} ${$ !== 1 ? s : o}`;
654
+ if (!u) return `1 ${s}`;
655
+ const i = n(o.startDate), g = n(u.endDate), p = Math.round((g - i) / (10080 * 60 * 1e3)), k = p > 0 ? p : 1;
656
+ return `${k} ${k !== 1 ? l : s}`;
653
657
  } else {
654
- if (!i) {
655
- const $ = n(l.startDate), M = n(l.endDate), U = Math.round((M - $) / (1e3 * 60 * 60 * 24)) + 1;
656
- return t(U);
658
+ if (!u) {
659
+ const k = n(o.startDate), S = n(o.endDate), z = Math.round((S - k) / (1e3 * 60 * 60 * 24)) + 1;
660
+ return t(z);
657
661
  }
658
- const h = n(l.startDate), p = n(i.endDate), I = Math.round(Math.abs(p - h) / (1e3 * 60 * 60 * 24)) + 1;
659
- return t(I);
662
+ const i = n(o.startDate), g = n(u.endDate), p = Math.round(Math.abs(g - i) / (1e3 * 60 * 60 * 24)) + 1;
663
+ return t(p);
660
664
  }
661
665
  } else
662
- return `1 ${o}`;
666
+ return `1 ${s}`;
663
667
  })() })
664
668
  ] }),
665
- f === "month" && (v === "range" || v === "multiple") && /* @__PURE__ */ C("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
669
+ m === "month" && (w === "range" || w === "multiple") && /* @__PURE__ */ Y("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
666
670
  "Selected:",
667
671
  /* @__PURE__ */ c("span", { className: "text-content font-semibold", children: (() => {
668
- const e = j;
672
+ const e = M;
669
673
  if (!e) return "0 months";
670
674
  if (Array.isArray(e)) {
671
675
  const n = e.length;
672
- return n === 1 ? m("calendar.monthRange") : m("calendar.monthRangePlural", { count: n });
676
+ return n === 1 ? h("calendar.monthRange") : h("calendar.monthRangePlural", { count: n });
673
677
  } else if ("from" in e) {
674
678
  const n = e;
675
- if (!n.to) return m("calendar.monthRange");
679
+ if (!n.to) return h("calendar.monthRange");
676
680
  const t = new Date(n.from.year, n.from.month, 1), r = new Date(n.to.year, n.to.month, 1), a = (r.getFullYear() - t.getFullYear()) * 12 + (r.getMonth() - t.getMonth()) + 1;
677
- return a === 1 ? m("calendar.monthRange") : m("calendar.monthRangePlural", { count: a });
681
+ return a === 1 ? h("calendar.monthRange") : h("calendar.monthRangePlural", { count: a });
678
682
  } else
679
- return m("calendar.monthRange");
683
+ return h("calendar.monthRange");
680
684
  })() })
681
685
  ] }),
682
- /* @__PURE__ */ C("div", { className: "flex items-center gap-2", children: [
686
+ /* @__PURE__ */ Y("div", { className: "flex items-center gap-2", children: [
683
687
  /* @__PURE__ */ c(
684
- A,
688
+ R,
685
689
  {
686
690
  variant: "link",
687
691
  size: "sm",
688
- onClick: Ee,
689
- children: m("calendar.clear")
692
+ onClick: $e,
693
+ children: h("calendar.clear")
690
694
  }
691
695
  ),
692
696
  /* @__PURE__ */ c(
693
- A,
697
+ R,
694
698
  {
695
699
  variant: "outline",
696
700
  size: "sm",
697
- onClick: $e,
698
- children: m("calendar.cancel")
701
+ onClick: Pe,
702
+ children: h("calendar.cancel")
699
703
  }
700
704
  ),
701
705
  /* @__PURE__ */ c(
702
- A,
706
+ R,
703
707
  {
704
708
  variant: "default",
705
709
  size: "sm",
706
- onClick: Pe,
707
- children: m("calendar.apply")
710
+ onClick: Ee,
711
+ children: h("calendar.apply")
708
712
  }
709
713
  )
710
714
  ] })
711
715
  ] })
712
716
  ] });
713
717
  }
714
- function Je({
718
+ function Ge({
715
719
  className: ae,
716
- day: J,
717
- modifiers: D,
718
- pickerType: K,
719
- ...H
720
+ day: G,
721
+ modifiers: y,
722
+ pickerType: J,
723
+ ...B
720
724
  }) {
721
- const Q = u.useRef(null);
722
- return u.useEffect(() => {
723
- D.focused && Q.current?.focus();
724
- }, [D.focused]), /* @__PURE__ */ c(
725
- A,
725
+ const Q = d.useRef(null);
726
+ return d.useEffect(() => {
727
+ y.focused && Q.current?.focus();
728
+ }, [y.focused]), /* @__PURE__ */ c(
729
+ R,
726
730
  {
727
731
  ref: Q,
728
732
  variant: "ghost",
729
733
  size: "sm",
730
- "data-day": J.date.toLocaleDateString(),
731
- "data-selected-single": D.selected && !D.range_start && !D.range_end && !D.range_middle,
732
- "data-range-start": D.range_start,
733
- "data-range-end": D.range_end,
734
- "data-range-middle": D.range_middle,
735
- className: d(
734
+ "data-day": G.date.toLocaleDateString(),
735
+ "data-selected-single": y.selected && !y.range_start && !y.range_end && !y.range_middle,
736
+ "data-range-start": y.range_start,
737
+ "data-range-end": y.range_end,
738
+ "data-range-middle": y.range_middle,
739
+ className: f(
736
740
  "gap-2 whitespace-nowrap focus-visible:ring-1 focus-visible:ring-focus-ring disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 px-3 rounded-lg flex items-center justify-center font-normal transition-colors w-5 h-5 border border-transparent focus-visible:outline-none text-sm rdp-day rdp-day_button",
737
741
  // Hover styling
738
- K !== "week" && "hover:bg-accent hover:text-accent-foreground hover:border-brand",
739
- K === "week" && "hover:bg-transparent hover:text-inherit hover:border-transparent",
742
+ J !== "week" && "hover:bg-accent hover:text-accent-foreground hover:border-brand",
743
+ J === "week" && "hover:bg-transparent hover:text-inherit hover:border-transparent",
740
744
  // Selection state
741
745
  "data-[selected-single=true]:bg-brand data-[selected-single=true]:text-brand-foreground data-[selected-single=true]:rounded-lg data-[selected-single=true]:border-transparent",
742
746
  "data-[range-start=true]:bg-brand data-[range-start=true]:text-brand-foreground data-[range-start=true]:rounded-lg data-[range-start=true]:border-transparent",
@@ -745,12 +749,12 @@ function Je({
745
749
  ae
746
750
  ),
747
751
  "data-component": "calendar-day",
748
- ...H,
749
- disabled: H.disabled || D.disabled
752
+ ...B,
753
+ disabled: B.disabled || y.disabled
750
754
  }
751
755
  );
752
756
  }
753
757
  export {
754
- st as Calendar,
755
- Je as CalendarDayButton
758
+ at as Calendar,
759
+ Ge as CalendarDayButton
756
760
  };