@mngh/jalali-datepicker 1.0.0

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.
package/dist/index.mjs ADDED
@@ -0,0 +1,1934 @@
1
+ import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
2
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ //#region src/core/constants.ts
4
+ var d = [
5
+ "فروردین",
6
+ "اردیبهشت",
7
+ "خرداد",
8
+ "تیر",
9
+ "مرداد",
10
+ "شهریور",
11
+ "مهر",
12
+ "آبان",
13
+ "آذر",
14
+ "دی",
15
+ "بهمن",
16
+ "اسفند"
17
+ ], f = [
18
+ "Farvardin",
19
+ "Ordibehesht",
20
+ "Khordad",
21
+ "Tir",
22
+ "Mordad",
23
+ "Shahrivar",
24
+ "Mehr",
25
+ "Aban",
26
+ "Azar",
27
+ "Dey",
28
+ "Bahman",
29
+ "Esfand"
30
+ ], p = [
31
+ "ش",
32
+ "ی",
33
+ "د",
34
+ "س",
35
+ "چ",
36
+ "پ",
37
+ "ج"
38
+ ], m = [
39
+ "شنبه",
40
+ "یکشنبه",
41
+ "دوشنبه",
42
+ "سه‌شنبه",
43
+ "چهارشنبه",
44
+ "پنج‌شنبه",
45
+ "جمعه"
46
+ ];
47
+ //#endregion
48
+ //#region src/core/jalali-math.ts
49
+ function h(e) {
50
+ let t = [
51
+ -61,
52
+ 9,
53
+ 38,
54
+ 199,
55
+ 426,
56
+ 686,
57
+ 756,
58
+ 818,
59
+ 1111,
60
+ 1181,
61
+ 1210,
62
+ 1635,
63
+ 2060,
64
+ 2097,
65
+ 2192,
66
+ 2262,
67
+ 2324,
68
+ 2394,
69
+ 2456,
70
+ 3178
71
+ ], n = t[0], r = 0;
72
+ if (e < n || e >= t[t.length - 1]) throw Error(`Jalali year ${e} is outside supported range.`);
73
+ for (let i = 1; i < t.length; i++) {
74
+ let a = t[i];
75
+ if (r = a - n, e < a) break;
76
+ n = a;
77
+ }
78
+ let i = e - n;
79
+ r - i < 6 && (i = i - r + (r + 4) / 33 * 33);
80
+ let a = (i + 1) % 33 - 1;
81
+ return a === -1 && (a = 4), a % 4 == 0;
82
+ }
83
+ function g(e, t) {
84
+ if (t < 0 || t > 11) throw RangeError("Month index must be between 0 (Farvardin) and 11 (Esfand).");
85
+ return t <= 5 ? 31 : t <= 10 || h(e) ? 30 : 29;
86
+ }
87
+ function _(e, t, n) {
88
+ let r = [
89
+ 0,
90
+ 31,
91
+ e % 4 == 0 && e % 100 != 0 || e % 400 == 0 ? 29 : 28,
92
+ 31,
93
+ 30,
94
+ 31,
95
+ 30,
96
+ 31,
97
+ 31,
98
+ 30,
99
+ 31,
100
+ 30,
101
+ 31
102
+ ], i, a, o, s = t > 2 ? e + 1 : e, c = 355666 + 365 * e + Math.floor((s + 3) / 4) - Math.floor((s + 99) / 100) + Math.floor((s + 399) / 400) + n;
103
+ for (let e = 0; e < t; ++e) c += r[e];
104
+ return i = -1595 + 33 * Math.floor(c / 12053), c %= 12053, i += 4 * Math.floor(c / 1461), c %= 1461, c > 365 && (i += Math.floor((c - 1) / 365), c = (c - 1) % 365), c < 186 ? (a = Math.floor(c / 31), o = 1 + c % 31) : (a = 6 + Math.floor((c - 186) / 30), o = 1 + (c - 186) % 30), {
105
+ year: i,
106
+ month: a,
107
+ day: o
108
+ };
109
+ }
110
+ function v(e, t, n) {
111
+ let r, i, a, o = e + 1595, s = -355668 + 365 * o + Math.floor(o / 33) * 8 + Math.floor((o % 33 + 3) / 4) + n + (t < 6 ? t * 31 : (t - 6) * 30 + 186);
112
+ r = 400 * Math.floor(s / 146097), s %= 146097, s > 36524 && (r += 100 * Math.floor(--s / 36524), s %= 36524, s >= 365 && s++), r += 4 * Math.floor(s / 1461), s %= 1461, s > 365 && (r += Math.floor((s - 1) / 365), s = (s - 1) % 365), a = s + 1;
113
+ let c = [
114
+ 0,
115
+ 31,
116
+ r % 4 == 0 && r % 100 != 0 || r % 400 == 0 ? 29 : 28,
117
+ 31,
118
+ 30,
119
+ 31,
120
+ 30,
121
+ 31,
122
+ 31,
123
+ 30,
124
+ 31,
125
+ 30,
126
+ 31
127
+ ];
128
+ for (i = 0; i < 13 && a > c[i]; i++) a -= c[i];
129
+ let l = new Date(r, i - 1, a);
130
+ return l.setHours(0, 0, 0, 0), l;
131
+ }
132
+ function y() {
133
+ let e = /* @__PURE__ */ new Date();
134
+ return _(e.getFullYear(), e.getMonth() + 1, e.getDate());
135
+ }
136
+ function b(e, t) {
137
+ return !e || !t ? !1 : e.year === t.year && e.month === t.month && e.day === t.day;
138
+ }
139
+ //#endregion
140
+ //#region src/core/calendar-grid.ts
141
+ function x(e) {
142
+ return e instanceof Date ? _(e.getFullYear(), e.getMonth() + 1, e.getDate()) : e;
143
+ }
144
+ function S(e) {
145
+ let { year: t, month: n, firstDayOfWeek: r = 0, selectedDate: i, minDate: a, maxDate: o, isDateDisabled: s } = e, c = [], l = y(), u = i ? x(i) : null, d = a ? x(a) : null, f = o ? x(o) : null, p = ((v(t, n, 1).getDay() + 1) % 7 - r + 7) % 7, m = n === 0 ? 11 : n - 1, h = n === 0 ? t - 1 : t, _ = g(h, m);
146
+ for (let e = p - 1; e >= 0; e--) {
147
+ let t = {
148
+ year: h,
149
+ month: m,
150
+ day: _ - e
151
+ };
152
+ c.push(E(t, !1));
153
+ }
154
+ let S = g(t, n);
155
+ for (let e = 1; e <= S; e++) {
156
+ let r = {
157
+ year: t,
158
+ month: n,
159
+ day: e
160
+ };
161
+ c.push(E(r, !0));
162
+ }
163
+ let C = n === 11 ? 0 : n + 1, w = n === 11 ? t + 1 : t, T = 42 - c.length;
164
+ for (let e = 1; e <= T; e++) {
165
+ let t = {
166
+ year: w,
167
+ month: C,
168
+ day: e
169
+ };
170
+ c.push(E(t, !1));
171
+ }
172
+ function E(e, t) {
173
+ let n = v(e.year, e.month, e.day), r = b(e, l), i = u ? b(e, u) : !1, a = !1;
174
+ if (d) {
175
+ let e = v(d.year, d.month, d.day);
176
+ n.getTime() < e.getTime() && (a = !0);
177
+ }
178
+ if (f) {
179
+ let e = v(f.year, f.month, f.day);
180
+ n.getTime() > e.getTime() && (a = !0);
181
+ }
182
+ return s && s(e, n) && (a = !0), {
183
+ jalali: e,
184
+ gregorianDate: n,
185
+ dayNumber: e.day,
186
+ isCurrentMonth: t,
187
+ isToday: r,
188
+ isSelected: i,
189
+ isDisabled: a
190
+ };
191
+ }
192
+ return c;
193
+ }
194
+ //#endregion
195
+ //#region src/core/jalali-helpers.ts
196
+ function C(e, t, n) {
197
+ return (v(e, t, n).getDay() + 1) % 7;
198
+ }
199
+ function w(e, t) {
200
+ let n = v(e.year, e.month, e.day);
201
+ return n.setDate(n.getDate() + t), _(n.getFullYear(), n.getMonth() + 1, n.getDate());
202
+ }
203
+ var T = w;
204
+ function E(e, t) {
205
+ return e.year === t.year ? e.month === t.month ? e.day === t.day ? 0 : e.day < t.day ? -1 : 1 : e.month < t.month ? -1 : 1 : e.year < t.year ? -1 : 1;
206
+ }
207
+ function D(e, t, n, r = !0) {
208
+ let i = E(t, n) <= 0 ? t : n, a = E(t, n) <= 0 ? n : t, o = E(e, i), s = E(e, a);
209
+ return r ? o >= 0 && s <= 0 : o > 0 && s < 0;
210
+ }
211
+ function O(e) {
212
+ let t = w(e, -C(e.year, e.month, e.day));
213
+ return [t, w(t, 6)];
214
+ }
215
+ function k(e) {
216
+ let t = g(e.year, e.month);
217
+ return [{
218
+ year: e.year,
219
+ month: e.month,
220
+ day: 1
221
+ }, {
222
+ year: e.year,
223
+ month: e.month,
224
+ day: t
225
+ }];
226
+ }
227
+ //#endregion
228
+ //#region src/hooks/useJalaliDatePicker.ts
229
+ function A(e = {}) {
230
+ let { mode: t = "single", value: r, defaultValue: i, onChange: o, initialViewDate: c, firstDayOfWeek: l = 0, minDate: u, maxDate: d, isDateDisabled: f } = e, [p, m] = s(() => i === void 0 ? t === "single" ? null : t === "range" ? [null, null] : [] : i), h = r === void 0 ? p : r, [g, _] = s(null), v = a(() => y(), []), [x, C] = s(() => {
231
+ if (c) return c;
232
+ if (t === "single" && h) return {
233
+ year: h.year,
234
+ month: h.month
235
+ };
236
+ if (t === "range" && h?.[0]) {
237
+ let e = h[0];
238
+ return {
239
+ year: e.year,
240
+ month: e.month
241
+ };
242
+ }
243
+ return {
244
+ year: v.year,
245
+ month: v.month
246
+ };
247
+ }), w = n(() => {
248
+ C((e) => e.month === 11 ? {
249
+ year: e.year + 1,
250
+ month: 0
251
+ } : {
252
+ year: e.year,
253
+ month: e.month + 1
254
+ });
255
+ }, []), T = n(() => {
256
+ C((e) => e.month === 0 ? {
257
+ year: e.year - 1,
258
+ month: 11
259
+ } : {
260
+ year: e.year,
261
+ month: e.month - 1
262
+ });
263
+ }, []), O = n((e, t) => {
264
+ C({
265
+ year: e,
266
+ month: t
267
+ });
268
+ }, []), k = n(() => {
269
+ C({
270
+ year: v.year,
271
+ month: v.month
272
+ });
273
+ }, [v]), A = n((e) => {
274
+ if (t === "single") return b(h, e);
275
+ if (t === "range") {
276
+ let [t, n] = h || [null, null];
277
+ return b(t, e) || b(n, e);
278
+ }
279
+ return t === "multiple" && (h || []).some((t) => b(t, e));
280
+ }, [t, h]), j = n((e) => {
281
+ r === void 0 && m(e), o?.(e);
282
+ }, [r, o]), M = n((e) => {
283
+ if (t === "single") j(e);
284
+ else if (t === "multiple") {
285
+ let t = h || [], n = t.some((t) => b(t, e)) ? t.filter((t) => !b(t, e)) : [...t, e].sort(E);
286
+ j(n);
287
+ } else if (t === "range") {
288
+ let [t, n] = h || [null, null];
289
+ !t || t && n ? j([e, null]) : (E(e, t) < 0 ? j([e, t]) : j([t, e]), _(null));
290
+ }
291
+ }, [
292
+ t,
293
+ h,
294
+ j
295
+ ]), N = n(() => {
296
+ j(t === "single" ? null : t === "range" ? [null, null] : []);
297
+ }, [t, j]), P = a(() => S({
298
+ year: x.year,
299
+ month: x.month,
300
+ firstDayOfWeek: l,
301
+ minDate: u,
302
+ maxDate: d,
303
+ isDateDisabled: f
304
+ }), [
305
+ x.year,
306
+ x.month,
307
+ l,
308
+ u,
309
+ d,
310
+ f
311
+ ]), F = a(() => {
312
+ let e = t === "range" ? h?.[0] : null, n = (t === "range" ? h?.[1] : null) ?? (e && g ? g : null);
313
+ return P.map((r) => {
314
+ let i = A(r.jalali), a = !1, o = !1, s = !1;
315
+ return t === "range" && e && (o = b(r.jalali, e), s = n ? b(r.jalali, n) : !1, n && (a = D(r.jalali, e, n))), {
316
+ ...r,
317
+ isSelected: i,
318
+ isInRange: a,
319
+ isRangeStart: o,
320
+ isRangeEnd: s
321
+ };
322
+ });
323
+ }, [
324
+ P,
325
+ t,
326
+ h,
327
+ g,
328
+ A
329
+ ]);
330
+ return {
331
+ selected: h,
332
+ viewYear: x.year,
333
+ viewMonth: x.month,
334
+ grid: F,
335
+ goToPrevMonth: T,
336
+ goToNextMonth: w,
337
+ setView: O,
338
+ goToToday: k,
339
+ selectDate: M,
340
+ setHoverDate: _,
341
+ clear: N,
342
+ isDateSelected: A,
343
+ hoverDate: g
344
+ };
345
+ }
346
+ //#endregion
347
+ //#region src/a11y/keyboard-navigation.ts
348
+ function j(e) {
349
+ let { currentFocused: t, key: n, isRtl: r = !0 } = e, { year: i, month: a, day: o } = t, s = !1, c = !0, l = r ? 1 : -1, u = r ? -1 : 1;
350
+ switch (n) {
351
+ case "ArrowRight":
352
+ o += u;
353
+ break;
354
+ case "ArrowLeft":
355
+ o += l;
356
+ break;
357
+ case "ArrowUp":
358
+ o -= 7;
359
+ break;
360
+ case "ArrowDown":
361
+ o += 7;
362
+ break;
363
+ case "Home":
364
+ o = 1;
365
+ break;
366
+ case "End":
367
+ o = g(i, a);
368
+ break;
369
+ case "PageUp":
370
+ a === 0 ? (--i, a = 11) : --a, s = !0;
371
+ break;
372
+ case "PageDown":
373
+ a === 11 ? (i += 1, a = 0) : a += 1, s = !0;
374
+ break;
375
+ default: return c = !1, {
376
+ nextDate: t,
377
+ viewChanged: !1,
378
+ handled: !1
379
+ };
380
+ }
381
+ for (; o < 1;) a === 0 ? (--i, a = 11) : --a, o += g(i, a), s = !0;
382
+ for (; o > g(i, a);) o -= g(i, a), a === 11 ? (i += 1, a = 0) : a += 1, s = !0;
383
+ return {
384
+ nextDate: {
385
+ year: i,
386
+ month: a,
387
+ day: o
388
+ },
389
+ viewChanged: s,
390
+ handled: c
391
+ };
392
+ }
393
+ //#endregion
394
+ //#region src/a11y/aria-helpers.ts
395
+ function M(e) {
396
+ let t = m[(v(e.year, e.month, e.day).getDay() + 1) % 7], n = d[e.month];
397
+ return `${t}، ${e.day} ${n} ${e.year}`;
398
+ }
399
+ //#endregion
400
+ //#region src/a11y/useCalendarKeyboard.ts
401
+ function N(e) {
402
+ let { viewYear: t, viewMonth: r, selectedDate: i, onSelectDate: a, onViewChange: o, isRtl: c = !0 } = e, [l, u] = s(() => i ?? {
403
+ year: t,
404
+ month: r,
405
+ day: 1
406
+ });
407
+ return {
408
+ focusedDate: l,
409
+ setFocusedDate: u,
410
+ handleKeyDown: n((e) => {
411
+ if (e.key === "Enter" || e.key === " ") {
412
+ e.preventDefault(), a(l);
413
+ return;
414
+ }
415
+ let t = j({
416
+ currentFocused: l,
417
+ key: e.key,
418
+ isRtl: c
419
+ });
420
+ t.handled && (e.preventDefault(), u(t.nextDate), t.viewChanged && o(t.nextDate.year, t.nextDate.month));
421
+ }, [
422
+ l,
423
+ c,
424
+ a,
425
+ o
426
+ ]),
427
+ getCellTabIndex: n((e) => b(e, l) ? 0 : -1, [l])
428
+ };
429
+ }
430
+ //#endregion
431
+ //#region src/formatters/persian-digits.ts
432
+ var P = [
433
+ "۰",
434
+ "۱",
435
+ "۲",
436
+ "۳",
437
+ "۴",
438
+ "۵",
439
+ "۶",
440
+ "۷",
441
+ "۸",
442
+ "۹"
443
+ ], F = {
444
+ "۰": "0",
445
+ "۱": "1",
446
+ "۲": "2",
447
+ "۳": "3",
448
+ "۴": "4",
449
+ "۵": "5",
450
+ "۶": "6",
451
+ "۷": "7",
452
+ "۸": "8",
453
+ "۹": "9",
454
+ "٠": "0",
455
+ "١": "1",
456
+ "٢": "2",
457
+ "٣": "3",
458
+ "٤": "4",
459
+ "٥": "5",
460
+ "٦": "6",
461
+ "٧": "7",
462
+ "٨": "8",
463
+ "٩": "9"
464
+ };
465
+ function I(e) {
466
+ return String(e).replace(/[0-9]/g, (e) => P[+e]);
467
+ }
468
+ function L(e) {
469
+ return e.replace(/[۰-۹٠-٩]/g, (e) => F[e] ?? e);
470
+ }
471
+ //#endregion
472
+ //#region src/formatters/jalali-formatter.ts
473
+ function R(e, t = "YYYY/MM/DD", n = {}) {
474
+ if (!e) return "";
475
+ let { digitType: r = "persian" } = n, i = (v(e.year, e.month, e.day).getDay() + 1) % 7, a = String(e.year), o = a.slice(-2), s = e.month + 1, c = s < 10 ? `0${s}` : String(s), l = d[e.month], u = e.day < 10 ? `0${e.day}` : String(e.day), f = m[i], p = t.replace(/\bYYYY\b/g, a).replace(/\bYY\b/g, o).replace(/\bMMMM\b/g, l).replace(/\bMM\b/g, c).replace(/\bM\b/g, String(s)).replace(/\bdddd\b/g, f).replace(/\bDD\b/g, u).replace(/\bD\b/g, String(e.day));
476
+ return r === "persian" && (p = p.replace(/\d+/g, (e) => I(e))), p;
477
+ }
478
+ //#endregion
479
+ //#region src/theme/tokens.ts
480
+ var z = {
481
+ primaryColor: "#0284c7",
482
+ primaryHover: "#0369a1",
483
+ primaryActive: "#075985",
484
+ primaryContrastText: "#ffffff",
485
+ rangeBetweenBg: "#e0f2fe",
486
+ rangeBetweenText: "#0369a1",
487
+ surfaceBg: "#ffffff",
488
+ surfaceBorder: "#e2e8f0",
489
+ headerBg: "#f8fafc",
490
+ textPrimary: "#0f172a",
491
+ textSecondary: "#475569",
492
+ textMuted: "#94a3b8",
493
+ textDisabled: "#cbd5e1",
494
+ todayIndicatorColor: "#0284c7",
495
+ borderRadius: "8px",
496
+ cellSize: "36px",
497
+ shadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
498
+ fontFamily: "inherit"
499
+ }, ee = {
500
+ primaryColor: "#38bdf8",
501
+ primaryHover: "#7dd3fc",
502
+ primaryActive: "#bae6fd",
503
+ primaryContrastText: "#0f172a",
504
+ rangeBetweenBg: "#082f49",
505
+ rangeBetweenText: "#7dd3fc",
506
+ surfaceBg: "#0f172a",
507
+ surfaceBorder: "#334155",
508
+ headerBg: "#1e293b",
509
+ textPrimary: "#f8fafc",
510
+ textSecondary: "#cbd5e1",
511
+ textMuted: "#64748b",
512
+ textDisabled: "#475569",
513
+ todayIndicatorColor: "#38bdf8",
514
+ borderRadius: "8px",
515
+ cellSize: "36px",
516
+ shadow: "0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)",
517
+ fontFamily: "inherit"
518
+ };
519
+ function te(e) {
520
+ let t = {};
521
+ for (let [n, r] of Object.entries(e)) if (r !== void 0) {
522
+ let e = `--pdp-${n.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
523
+ t[e] = r;
524
+ }
525
+ return t;
526
+ }
527
+ //#endregion
528
+ //#region src/theme/ThemeProvider.tsx
529
+ var ne = t({
530
+ tokens: z,
531
+ mode: "light"
532
+ }), B = ({ mode: e = "light", customTokens: t, children: n }) => {
533
+ let r = a(() => ({
534
+ ...e === "dark" ? ee : z,
535
+ ...t
536
+ }), [e, t]), i = a(() => te(r), [r]);
537
+ return /* @__PURE__ */ l(ne.Provider, {
538
+ value: {
539
+ tokens: r,
540
+ mode: e
541
+ },
542
+ children: /* @__PURE__ */ l("div", {
543
+ className: "pdp-theme-root",
544
+ dir: "rtl",
545
+ style: {
546
+ ...i,
547
+ display: "inline-block",
548
+ fontFamily: r.fontFamily
549
+ },
550
+ children: n
551
+ })
552
+ });
553
+ }, V = () => r(ne), re = ({ year: e, month: t, onPrevMonth: n, onNextMonth: r, onTogglePicker: i, classNames: a, styles: o }) => /* @__PURE__ */ u("div", {
554
+ className: a?.header,
555
+ style: {
556
+ display: "flex",
557
+ alignItems: "center",
558
+ justifyContent: "space-between",
559
+ marginBottom: "12px",
560
+ padding: "0 4px",
561
+ height: "28px",
562
+ ...o?.header
563
+ },
564
+ children: [
565
+ /* @__PURE__ */ l("button", {
566
+ type: "button",
567
+ "aria-label": "ماه قبل",
568
+ onClick: n,
569
+ className: a?.navButton,
570
+ style: {
571
+ width: "28px",
572
+ height: "28px",
573
+ borderRadius: "6px",
574
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
575
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
576
+ color: "var(--pdp-text-primary, #0f172a)",
577
+ cursor: "pointer",
578
+ ...o?.navButton
579
+ },
580
+ children: "›"
581
+ }),
582
+ /* @__PURE__ */ u("button", {
583
+ type: "button",
584
+ onClick: i,
585
+ className: a?.headerTitle,
586
+ style: {
587
+ background: "none",
588
+ border: "none",
589
+ cursor: "pointer",
590
+ fontSize: "15px",
591
+ fontWeight: 600,
592
+ color: "var(--pdp-text-primary, #0f172a)",
593
+ display: "flex",
594
+ gap: "6px",
595
+ ...o?.headerTitle
596
+ },
597
+ children: [/* @__PURE__ */ l("span", { children: d[t] }), /* @__PURE__ */ l("span", { children: I(e) })]
598
+ }),
599
+ /* @__PURE__ */ l("button", {
600
+ type: "button",
601
+ "aria-label": "ماه بعد",
602
+ onClick: r,
603
+ className: a?.navButton,
604
+ style: {
605
+ width: "28px",
606
+ height: "28px",
607
+ borderRadius: "6px",
608
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
609
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
610
+ color: "var(--pdp-text-primary, #0f172a)",
611
+ cursor: "pointer",
612
+ ...o?.navButton
613
+ },
614
+ children: "‹"
615
+ })
616
+ ]
617
+ }), ie = ({ firstDayOfWeek: e = 0, classNames: t, styles: n }) => {
618
+ let r = [...p.slice(e), ...p.slice(0, e)];
619
+ return /* @__PURE__ */ l("div", {
620
+ role: "row",
621
+ "aria-label": "روزهای هفته",
622
+ className: t?.weekdays,
623
+ style: {
624
+ display: "grid",
625
+ gridTemplateColumns: "repeat(7, var(--pdp-cell-size, 36px))",
626
+ gap: "4px",
627
+ marginBottom: "6px",
628
+ textAlign: "center",
629
+ ...n?.weekdays
630
+ },
631
+ children: r.map((e, r) => /* @__PURE__ */ l("div", {
632
+ role: "columnheader",
633
+ className: t?.weekdayCell,
634
+ style: {
635
+ fontSize: "12px",
636
+ fontWeight: 600,
637
+ color: "var(--pdp-text-muted, #94a3b8)",
638
+ userSelect: "none",
639
+ ...n?.weekdayCell
640
+ },
641
+ children: e
642
+ }, r))
643
+ });
644
+ }, ae = ({ cell: e, tabIndex: t, digitType: n = "persian", isHoliday: r = !1, holidayTitle: i, events: a = [], classNames: o, styles: c, onSelect: d, onHover: f, onFocus: p }) => {
645
+ let { jalali: m, isCurrentMonth: h, isToday: g, isSelected: _, isDisabled: v, isInRange: y, isRangeStart: b, isRangeEnd: x } = e, [S, C] = s(!1), w = n === "persian" ? I(e.dayNumber) : e.dayNumber, T = M(m);
646
+ r && i && (T += ` (${i})`);
647
+ let E = "transparent", D = h ? r ? "var(--pdp-holiday-color, #ef4444)" : "var(--pdp-text-primary, #0f172a)" : "var(--pdp-text-disabled, #cbd5e1)";
648
+ y && !_ && (E = "var(--pdp-range-between-bg, #e0f2fe)", D = "var(--pdp-range-between-text, #0369a1)"), (_ || b || x) && (E = "var(--pdp-primary-color, #0284c7)", D = "var(--pdp-primary-contrast-text, #ffffff)");
649
+ let O = [
650
+ o?.dayCell,
651
+ g && o?.todayCell,
652
+ _ && o?.selectedCell,
653
+ y && !_ && o?.rangeBetweenCell,
654
+ v && o?.disabledCell,
655
+ r && o?.holidayCell
656
+ ].filter(Boolean).join(" "), k = {
657
+ width: "var(--pdp-cell-size, 36px)",
658
+ height: "var(--pdp-cell-size, 36px)",
659
+ display: "inline-flex",
660
+ flexDirection: "column",
661
+ alignItems: "center",
662
+ justifyContent: "center",
663
+ borderRadius: b || x || !y && _ ? "var(--pdp-border-radius, 8px)" : "4px",
664
+ border: g && !_ ? "1px solid var(--pdp-today-indicator-color, #0284c7)" : "none",
665
+ backgroundColor: E,
666
+ color: D,
667
+ fontWeight: g || _ || r ? 700 : 400,
668
+ fontSize: "14px",
669
+ cursor: v ? "not-allowed" : "pointer",
670
+ opacity: v ? .4 : 1,
671
+ transition: "background-color 0.15s ease, color 0.15s ease",
672
+ outline: "none",
673
+ position: "relative",
674
+ ...c?.dayCell,
675
+ ...g ? c?.todayCell : {},
676
+ ..._ ? c?.selectedCell : {},
677
+ ...y && !_ ? c?.rangeBetweenCell : {},
678
+ ...v ? c?.disabledCell : {},
679
+ ...r ? c?.holidayCell : {}
680
+ }, A = a.length > 0, j = A ? a[0].color ?? "var(--pdp-primary-color, #0284c7)" : void 0;
681
+ return /* @__PURE__ */ u("div", {
682
+ style: {
683
+ position: "relative",
684
+ display: "inline-flex"
685
+ },
686
+ onMouseEnter: () => {
687
+ C(!0), v || f?.(m);
688
+ },
689
+ onMouseLeave: () => {
690
+ C(!1), f?.(null);
691
+ },
692
+ children: [/* @__PURE__ */ u("button", {
693
+ type: "button",
694
+ role: "gridcell",
695
+ tabIndex: v ? -1 : t,
696
+ "aria-selected": _ || b || x,
697
+ "aria-disabled": v,
698
+ "aria-label": T,
699
+ disabled: v,
700
+ onClick: () => !v && d(m),
701
+ onFocus: () => !v && p?.(m),
702
+ className: O || void 0,
703
+ style: k,
704
+ children: [/* @__PURE__ */ l("span", {
705
+ style: { lineHeight: 1 },
706
+ children: w
707
+ }), A && !_ && /* @__PURE__ */ l("div", {
708
+ className: o?.eventBadge,
709
+ style: {
710
+ display: "flex",
711
+ gap: "2px",
712
+ position: "absolute",
713
+ bottom: "3px",
714
+ ...c?.eventBadge
715
+ },
716
+ children: a.slice(0, 3).map((e, t) => /* @__PURE__ */ l("span", { style: {
717
+ width: "4px",
718
+ height: "4px",
719
+ borderRadius: "50%",
720
+ backgroundColor: e.color ?? j,
721
+ display: "inline-block"
722
+ } }, t))
723
+ })]
724
+ }), S && (A || r && i) && /* @__PURE__ */ u("div", {
725
+ role: "tooltip",
726
+ style: {
727
+ position: "absolute",
728
+ bottom: "calc(100% + 6px)",
729
+ left: "50%",
730
+ transform: "translateX(-50%)",
731
+ zIndex: 100,
732
+ backgroundColor: "#0f172a",
733
+ color: "#f8fafc",
734
+ padding: "6px 10px",
735
+ borderRadius: "6px",
736
+ fontSize: "11px",
737
+ whiteSpace: "nowrap",
738
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.3)",
739
+ pointerEvents: "none",
740
+ display: "flex",
741
+ flexDirection: "column",
742
+ gap: "2px",
743
+ minWidth: "max-content",
744
+ maxWidth: "200px",
745
+ textAlign: "center"
746
+ },
747
+ children: [
748
+ r && i && /* @__PURE__ */ l("div", {
749
+ style: {
750
+ color: "#f87171",
751
+ fontWeight: 600
752
+ },
753
+ children: i
754
+ }),
755
+ a.map((e) => /* @__PURE__ */ u("div", {
756
+ style: {
757
+ display: "flex",
758
+ alignItems: "center",
759
+ gap: "4px",
760
+ justifyContent: "center"
761
+ },
762
+ children: [e.color && /* @__PURE__ */ l("span", { style: {
763
+ width: "6px",
764
+ height: "6px",
765
+ borderRadius: "50%",
766
+ backgroundColor: e.color,
767
+ display: "inline-block"
768
+ } }), /* @__PURE__ */ l("span", {
769
+ style: { fontWeight: 500 },
770
+ children: e.title
771
+ })]
772
+ }, e.id)),
773
+ /* @__PURE__ */ l("div", { style: {
774
+ position: "absolute",
775
+ top: "100%",
776
+ left: "50%",
777
+ transform: "translateX(-50%)",
778
+ borderWidth: "4px",
779
+ borderStyle: "solid",
780
+ borderColor: "#0f172a transparent transparent transparent"
781
+ } })
782
+ ]
783
+ })]
784
+ });
785
+ }, oe = ({ currentYear: e, currentMonth: t, onSelectMonth: n, onSelectYear: r, onClose: i }) => {
786
+ let [a, o] = s("months"), [c, f] = s(Math.floor(e / 12) * 12), p = Array.from({ length: 12 }, (e, t) => c + t);
787
+ return /* @__PURE__ */ u("div", {
788
+ style: {
789
+ padding: "8px",
790
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
791
+ borderRadius: "var(--pdp-border-radius, 8px)"
792
+ },
793
+ children: [
794
+ /* @__PURE__ */ u("div", {
795
+ style: {
796
+ display: "flex",
797
+ justifyContent: "space-between",
798
+ alignItems: "center",
799
+ marginBottom: "12px"
800
+ },
801
+ children: [
802
+ /* @__PURE__ */ l("button", {
803
+ type: "button",
804
+ onClick: () => a === "years" ? f((e) => e - 12) : null,
805
+ style: {
806
+ background: "none",
807
+ border: "none",
808
+ cursor: "pointer",
809
+ fontSize: "16px",
810
+ color: "var(--pdp-text-primary)"
811
+ },
812
+ children: "‹"
813
+ }),
814
+ /* @__PURE__ */ u("div", {
815
+ style: {
816
+ display: "flex",
817
+ gap: "8px"
818
+ },
819
+ children: [/* @__PURE__ */ l("button", {
820
+ type: "button",
821
+ onClick: () => o("months"),
822
+ style: {
823
+ fontWeight: a === "months" ? 700 : 400,
824
+ background: "none",
825
+ border: "none",
826
+ cursor: "pointer",
827
+ color: "var(--pdp-primary-color, #0284c7)"
828
+ },
829
+ children: d[t]
830
+ }), /* @__PURE__ */ l("button", {
831
+ type: "button",
832
+ onClick: () => o("years"),
833
+ style: {
834
+ fontWeight: a === "years" ? 700 : 400,
835
+ background: "none",
836
+ border: "none",
837
+ cursor: "pointer",
838
+ color: "var(--pdp-primary-color, #0284c7)"
839
+ },
840
+ children: I(e)
841
+ })]
842
+ }),
843
+ /* @__PURE__ */ l("button", {
844
+ type: "button",
845
+ onClick: () => a === "years" ? f((e) => e + 12) : null,
846
+ style: {
847
+ background: "none",
848
+ border: "none",
849
+ cursor: "pointer",
850
+ fontSize: "16px",
851
+ color: "var(--pdp-text-primary)"
852
+ },
853
+ children: "›"
854
+ })
855
+ ]
856
+ }),
857
+ a === "months" && /* @__PURE__ */ l("div", {
858
+ style: {
859
+ display: "grid",
860
+ gridTemplateColumns: "repeat(3, 1fr)",
861
+ gap: "8px"
862
+ },
863
+ children: d.map((e, r) => /* @__PURE__ */ l("button", {
864
+ type: "button",
865
+ onClick: () => {
866
+ n(r), i();
867
+ },
868
+ style: {
869
+ padding: "8px 4px",
870
+ borderRadius: "6px",
871
+ border: "none",
872
+ cursor: "pointer",
873
+ backgroundColor: t === r ? "var(--pdp-primary-color, #0284c7)" : "transparent",
874
+ color: t === r ? "#ffffff" : "var(--pdp-text-primary, #0f172a)",
875
+ fontSize: "13px"
876
+ },
877
+ children: e
878
+ }, e))
879
+ }),
880
+ a === "years" && /* @__PURE__ */ l("div", {
881
+ style: {
882
+ display: "grid",
883
+ gridTemplateColumns: "repeat(3, 1fr)",
884
+ gap: "8px"
885
+ },
886
+ children: p.map((t) => /* @__PURE__ */ l("button", {
887
+ type: "button",
888
+ onClick: () => {
889
+ r(t), o("months");
890
+ },
891
+ style: {
892
+ padding: "8px 4px",
893
+ borderRadius: "6px",
894
+ border: "none",
895
+ cursor: "pointer",
896
+ backgroundColor: e === t ? "var(--pdp-primary-color, #0284c7)" : "transparent",
897
+ color: e === t ? "#ffffff" : "var(--pdp-text-primary, #0f172a)",
898
+ fontSize: "13px"
899
+ },
900
+ children: I(t)
901
+ }, t))
902
+ })
903
+ ]
904
+ });
905
+ };
906
+ //#endregion
907
+ //#region src/plugins/time-picker/time-utils.ts
908
+ function H(e, t = "persian") {
909
+ let n = e < 10 ? `0${e}` : `${e}`;
910
+ return t === "persian" ? I(n) : n;
911
+ }
912
+ function U() {
913
+ let e = /* @__PURE__ */ new Date();
914
+ return {
915
+ hour: e.getHours(),
916
+ minute: e.getMinutes(),
917
+ second: e.getSeconds()
918
+ };
919
+ }
920
+ function W(e) {
921
+ return {
922
+ hour: Math.max(0, Math.min(23, e.hour)),
923
+ minute: Math.max(0, Math.min(59, e.minute)),
924
+ second: e.second === void 0 ? void 0 : Math.max(0, Math.min(59, e.second))
925
+ };
926
+ }
927
+ function se(e, t = !1, n = "persian") {
928
+ if (!e) return "";
929
+ let r = H(e.hour, n), i = H(e.minute, n);
930
+ return t && e.second !== void 0 ? `${r}:${i}:${H(e.second, n)}` : `${r}:${i}`;
931
+ }
932
+ //#endregion
933
+ //#region src/components/footer/CalendarFooter.tsx
934
+ var ce = ({ selectedDate: e, selectedRange: t, selectedDates: n, selectedTime: r, mode: i = "single", digitType: a = "persian", showStatusText: o = !0, showActions: s = !0, onToday: c, onClear: d, onConfirm: f, classNames: p, styles: m }) => {
935
+ let h = () => {
936
+ let o = "هیچ تاریخی انتخاب نشده است";
937
+ if (i === "single" && e) o = R(e, "dddd D MMMM YYYY", { digitType: a }), r && (o += ` - ${se(r, !1, a)}`);
938
+ else if (i === "range") {
939
+ let [e, n] = t || [null, null];
940
+ e && n ? o = `${R(e, "YYYY/MM/DD", { digitType: a })} تا ${R(n, "YYYY/MM/DD", { digitType: a })}` : e && (o = `شروع: ${R(e, "YYYY/MM/DD", { digitType: a })} (پایان را انتخاب کنید)`);
941
+ } else i === "multiple" && n && n.length > 0 && (o = `${a === "persian" ? I(n.length) : n.length} روز انتخاب شده`);
942
+ return o;
943
+ };
944
+ return /* @__PURE__ */ u("div", {
945
+ className: p?.footer,
946
+ style: {
947
+ marginTop: "8px",
948
+ paddingTop: "8px",
949
+ borderTop: "1px solid var(--pdp-surface-border, #e2e8f0)",
950
+ display: "flex",
951
+ flexDirection: "column",
952
+ gap: "6px",
953
+ ...m?.footer
954
+ },
955
+ children: [o && /* @__PURE__ */ l("div", {
956
+ "aria-live": "polite",
957
+ style: {
958
+ fontSize: "12px",
959
+ color: "var(--pdp-text-secondary, #475569)",
960
+ textAlign: "center",
961
+ minHeight: "18px",
962
+ fontWeight: 500
963
+ },
964
+ children: h()
965
+ }), s && /* @__PURE__ */ u("div", {
966
+ style: {
967
+ display: "flex",
968
+ justifyContent: "space-between",
969
+ alignItems: "center",
970
+ gap: "8px"
971
+ },
972
+ children: [/* @__PURE__ */ u("div", {
973
+ style: {
974
+ display: "flex",
975
+ gap: "4px"
976
+ },
977
+ children: [c && /* @__PURE__ */ l("button", {
978
+ type: "button",
979
+ onClick: c,
980
+ style: {
981
+ padding: "3px 8px",
982
+ fontSize: "11px",
983
+ borderRadius: "4px",
984
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
985
+ backgroundColor: "transparent",
986
+ color: "var(--pdp-text-primary, #0f172a)",
987
+ cursor: "pointer"
988
+ },
989
+ children: "امروز"
990
+ }), d && /* @__PURE__ */ l("button", {
991
+ type: "button",
992
+ onClick: d,
993
+ style: {
994
+ padding: "3px 8px",
995
+ fontSize: "11px",
996
+ borderRadius: "4px",
997
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
998
+ backgroundColor: "transparent",
999
+ color: "var(--pdp-text-muted, #94a3b8)",
1000
+ cursor: "pointer"
1001
+ },
1002
+ children: "پاک کردن"
1003
+ })]
1004
+ }), f && /* @__PURE__ */ l("button", {
1005
+ type: "button",
1006
+ onClick: f,
1007
+ style: {
1008
+ padding: "4px 12px",
1009
+ fontSize: "12px",
1010
+ fontWeight: 600,
1011
+ borderRadius: "6px",
1012
+ border: "none",
1013
+ backgroundColor: "var(--pdp-primary-color, #0284c7)",
1014
+ color: "var(--pdp-primary-contrast-text, #ffffff)",
1015
+ cursor: "pointer"
1016
+ },
1017
+ children: "تایید"
1018
+ })]
1019
+ })]
1020
+ });
1021
+ }, le = ({ value: t, defaultValue: r, onChange: i, minuteStep: a = 1, hourStep: o = 1, showSeconds: s = !1, digitType: d = "persian", disabled: f = !1, styles: p, classNames: m }) => {
1022
+ let [h, g] = e.useState(r ?? U()), _ = t === void 0 ? h : t ?? U(), v = n((e) => {
1023
+ let n = W(e);
1024
+ t === void 0 && g(n), i?.(n);
1025
+ }, [t, i]), y = (e) => {
1026
+ let t = (_.hour + e * o + 24) % 24;
1027
+ v({
1028
+ ..._,
1029
+ hour: t
1030
+ });
1031
+ }, b = (e) => {
1032
+ let t = (_.minute + e * a + 60) % 60;
1033
+ v({
1034
+ ..._,
1035
+ minute: t
1036
+ });
1037
+ }, x = (e) => {
1038
+ if (!s) return;
1039
+ let t = ((_.second ?? 0) + e + 60) % 60;
1040
+ v({
1041
+ ..._,
1042
+ second: t
1043
+ });
1044
+ }, S = {
1045
+ background: "none",
1046
+ border: "none",
1047
+ cursor: f ? "not-allowed" : "pointer",
1048
+ color: "var(--pdp-primary-color, #0284c7)",
1049
+ fontSize: "12px",
1050
+ padding: "2px 6px",
1051
+ lineHeight: 1
1052
+ }, C = {
1053
+ display: "flex",
1054
+ flexDirection: "column",
1055
+ alignItems: "center",
1056
+ justifyContent: "center"
1057
+ }, w = {
1058
+ fontSize: "15px",
1059
+ fontWeight: 600,
1060
+ color: "var(--pdp-text-primary, #0f172a)",
1061
+ minWidth: "24px",
1062
+ textAlign: "center"
1063
+ };
1064
+ return /* @__PURE__ */ u("div", {
1065
+ role: "group",
1066
+ "aria-label": "Time Selection",
1067
+ className: m?.timePicker,
1068
+ style: {
1069
+ display: "flex",
1070
+ alignItems: "center",
1071
+ justifyContent: "center",
1072
+ gap: "6px",
1073
+ padding: "8px 12px",
1074
+ borderTop: "1px solid var(--pdp-surface-border, #e2e8f0)",
1075
+ backgroundColor: "var(--pdp-header-bg, #f8fafc)",
1076
+ borderRadius: "0 0 var(--pdp-border-radius, 8px) var(--pdp-border-radius, 8px)",
1077
+ direction: "ltr",
1078
+ ...p?.timePicker
1079
+ },
1080
+ children: [
1081
+ /* @__PURE__ */ u("div", {
1082
+ style: C,
1083
+ children: [
1084
+ /* @__PURE__ */ l("button", {
1085
+ type: "button",
1086
+ disabled: f,
1087
+ onClick: () => y(1),
1088
+ style: S,
1089
+ "aria-label": "Increase Hour",
1090
+ children: "▼"
1091
+ }),
1092
+ /* @__PURE__ */ l("span", {
1093
+ style: w,
1094
+ children: H(_.hour, d)
1095
+ }),
1096
+ /* @__PURE__ */ l("button", {
1097
+ type: "button",
1098
+ disabled: f,
1099
+ onClick: () => y(-1),
1100
+ style: S,
1101
+ "aria-label": "Decrease Hour",
1102
+ children: "▲"
1103
+ })
1104
+ ]
1105
+ }),
1106
+ /* @__PURE__ */ l("span", {
1107
+ style: {
1108
+ fontWeight: 700,
1109
+ color: "var(--pdp-text-secondary, #475569)"
1110
+ },
1111
+ children: ":"
1112
+ }),
1113
+ /* @__PURE__ */ u("div", {
1114
+ style: C,
1115
+ children: [
1116
+ /* @__PURE__ */ l("button", {
1117
+ type: "button",
1118
+ disabled: f,
1119
+ onClick: () => b(1),
1120
+ style: S,
1121
+ "aria-label": "Increase Minute",
1122
+ children: "▲"
1123
+ }),
1124
+ /* @__PURE__ */ l("span", {
1125
+ style: w,
1126
+ children: H(_.minute, d)
1127
+ }),
1128
+ /* @__PURE__ */ l("button", {
1129
+ type: "button",
1130
+ disabled: f,
1131
+ onClick: () => b(-1),
1132
+ style: S,
1133
+ "aria-label": "Decrease Minute",
1134
+ children: "▼"
1135
+ })
1136
+ ]
1137
+ }),
1138
+ s && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("span", {
1139
+ style: {
1140
+ fontWeight: 700,
1141
+ color: "var(--pdp-text-secondary, #475569)"
1142
+ },
1143
+ children: ":"
1144
+ }), /* @__PURE__ */ u("div", {
1145
+ style: C,
1146
+ children: [
1147
+ /* @__PURE__ */ l("button", {
1148
+ type: "button",
1149
+ disabled: f,
1150
+ onClick: () => x(1),
1151
+ style: S,
1152
+ "aria-label": "Increase Second",
1153
+ children: "▲"
1154
+ }),
1155
+ /* @__PURE__ */ l("span", {
1156
+ style: w,
1157
+ children: H(_.second ?? 0, d)
1158
+ }),
1159
+ /* @__PURE__ */ l("button", {
1160
+ type: "button",
1161
+ disabled: f,
1162
+ onClick: () => x(-1),
1163
+ style: S,
1164
+ "aria-label": "Decrease Second",
1165
+ children: "▼"
1166
+ })
1167
+ ]
1168
+ })] })
1169
+ ]
1170
+ });
1171
+ };
1172
+ //#endregion
1173
+ //#region src/plugins/presets/default-presets.ts
1174
+ function G(e = "persian") {
1175
+ let t = (t) => e === "persian" ? I(t) : `${t}`;
1176
+ return [
1177
+ {
1178
+ id: "today",
1179
+ label: "امروز",
1180
+ getValue: () => y()
1181
+ },
1182
+ {
1183
+ id: "this_week",
1184
+ label: "این هفته",
1185
+ getValue: () => O(y())
1186
+ },
1187
+ {
1188
+ id: "last_7_days",
1189
+ label: `${t(7)} روز گذشته`,
1190
+ getValue: () => {
1191
+ let e = y();
1192
+ return [w(e, -6), e];
1193
+ }
1194
+ },
1195
+ {
1196
+ id: "this_month",
1197
+ label: "این ماه",
1198
+ getValue: () => k(y())
1199
+ },
1200
+ {
1201
+ id: "last_month",
1202
+ label: "ماه گذشته",
1203
+ getValue: () => {
1204
+ let e = y(), t = e.year, n = e.month - 1;
1205
+ n < 0 && (n = 11, --t);
1206
+ let r = g(t, n);
1207
+ return [{
1208
+ year: t,
1209
+ month: n,
1210
+ day: 1
1211
+ }, {
1212
+ year: t,
1213
+ month: n,
1214
+ day: r
1215
+ }];
1216
+ }
1217
+ },
1218
+ {
1219
+ id: "last_30_days",
1220
+ label: `${t(30)} روز گذشته`,
1221
+ getValue: () => {
1222
+ let e = y();
1223
+ return [w(e, -29), e];
1224
+ }
1225
+ }
1226
+ ];
1227
+ }
1228
+ var ue = G("persian"), de = ({ presets: e, onSelectPreset: t, selectedValue: n, orientation: r = "vertical", digitType: i = "persian", disabled: o = !1, classNames: s, styles: c }) => {
1229
+ let u = a(() => e ?? G(i), [e, i]), d = (e) => {
1230
+ if (!n) return !1;
1231
+ let t = e.getValue();
1232
+ if (!Array.isArray(t) && !Array.isArray(n)) return b(t, n);
1233
+ if (Array.isArray(t) && Array.isArray(n)) {
1234
+ let [e, r] = t, [i, a] = n;
1235
+ return !e || !r || !i || !a ? !1 : b(e, i) && b(r, a);
1236
+ }
1237
+ return !1;
1238
+ }, f = {
1239
+ display: "flex",
1240
+ flexDirection: r === "vertical" ? "column" : "row",
1241
+ gap: "4px",
1242
+ padding: "8px",
1243
+ backgroundColor: "var(--pdp-header-bg, #f8fafc)",
1244
+ borderLeft: r === "vertical" ? "1px solid var(--pdp-surface-border, #e2e8f0)" : "none",
1245
+ borderBottom: r === "horizontal" ? "1px solid var(--pdp-surface-border, #e2e8f0)" : "none",
1246
+ overflowX: r === "horizontal" ? "auto" : "visible",
1247
+ maxHeight: r === "vertical" ? "280px" : "none",
1248
+ overflowY: r === "vertical" ? "auto" : "visible",
1249
+ minWidth: r === "vertical" ? "110px" : "auto",
1250
+ ...c?.presetsBar
1251
+ };
1252
+ return /* @__PURE__ */ l("div", {
1253
+ role: "group",
1254
+ "aria-label": "کلیدهای میانبر تاریخ",
1255
+ className: s?.presetsBar,
1256
+ style: f,
1257
+ children: u.map((e) => {
1258
+ let n = d(e);
1259
+ return /* @__PURE__ */ l("button", {
1260
+ type: "button",
1261
+ disabled: o,
1262
+ onClick: () => t(e.getValue()),
1263
+ style: {
1264
+ padding: "6px 10px",
1265
+ fontSize: "12px",
1266
+ fontWeight: n ? 600 : 400,
1267
+ textAlign: "right",
1268
+ border: "none",
1269
+ borderRadius: "var(--pdp-border-radius, 6px)",
1270
+ cursor: o ? "not-allowed" : "pointer",
1271
+ backgroundColor: n ? "var(--pdp-primary-color, #0284c7)" : "transparent",
1272
+ color: n ? "var(--pdp-primary-contrast-text, #ffffff)" : "var(--pdp-text-primary, #0f172a)",
1273
+ whiteSpace: "nowrap",
1274
+ transition: "background-color 0.15s ease, color 0.15s ease"
1275
+ },
1276
+ children: e.label
1277
+ }, e.id);
1278
+ })
1279
+ });
1280
+ };
1281
+ //#endregion
1282
+ //#region src/components/masked-input/mask-utils.ts
1283
+ function K(e, t = "persian") {
1284
+ let n = L(e).replace(/\D/g, "").slice(0, 8), r = "";
1285
+ return n.length > 0 && (r = n.slice(0, 4)), n.length >= 5 && (r += `/${n.slice(4, 6)}`), n.length >= 7 && (r += `/${n.slice(6, 8)}`), t === "persian" ? I(r) : r;
1286
+ }
1287
+ function fe(e, t, n, r) {
1288
+ let i = L(e).trim();
1289
+ if (!i) return {
1290
+ isValid: !0,
1291
+ date: null
1292
+ };
1293
+ let a = i.split("/");
1294
+ if (a.length !== 3 || a[0].length !== 4 || a[1].length !== 2 || a[2].length !== 2) return {
1295
+ isValid: !1,
1296
+ date: null,
1297
+ error: "INVALID_FORMAT"
1298
+ };
1299
+ let o = parseInt(a[0], 10), s = parseInt(a[1], 10), c = parseInt(a[2], 10);
1300
+ if (s < 1 || s > 12) return {
1301
+ isValid: !1,
1302
+ date: null,
1303
+ error: "INVALID_MONTH"
1304
+ };
1305
+ let l = s - 1, u = g(o, l);
1306
+ if (c < 1 || c > u) return {
1307
+ isValid: !1,
1308
+ date: null,
1309
+ error: "INVALID_DAY"
1310
+ };
1311
+ let d = {
1312
+ year: o,
1313
+ month: l,
1314
+ day: c
1315
+ };
1316
+ return t && E(d, t) < 0 ? {
1317
+ isValid: !1,
1318
+ date: d,
1319
+ error: "OUT_OF_MIN_BOUNDS"
1320
+ } : n && E(d, n) > 0 ? {
1321
+ isValid: !1,
1322
+ date: d,
1323
+ error: "OUT_OF_MAX_BOUNDS"
1324
+ } : r && r(d) ? {
1325
+ isValid: !1,
1326
+ date: d,
1327
+ error: "DISABLED_DATE"
1328
+ } : {
1329
+ isValid: !0,
1330
+ date: d
1331
+ };
1332
+ }
1333
+ //#endregion
1334
+ //#region src/components/masked-input/MaskedDateInput.tsx
1335
+ var pe = ({ value: e, defaultValue: t = null, onChange: r, onValidationError: a, digitType: c = "persian", minDate: d, maxDate: f, isDateDisabled: p, clearable: m = !0, placeholder: h = "۱۴۰۵/۰۱/۱۵", disabled: g = !1, style: _, ...v }) => {
1336
+ let [y, b] = s(t), x = e === void 0 ? y : e, [S, C] = s(() => x ? R(x, "YYYY/MM/DD", { digitType: c }) : ""), [w, T] = s(!1), E = o(null);
1337
+ i(() => {
1338
+ e !== void 0 && (C(e ? R(e, "YYYY/MM/DD", { digitType: c }) : ""), T(!1));
1339
+ }, [e, c]);
1340
+ let D = (t) => {
1341
+ let n = t.target.value, i = K(n, c);
1342
+ if (C(i), i.length === 10 || i.length === 0) {
1343
+ let t = fe(i, d, f, p);
1344
+ t.isValid ? (T(!1), a?.(null), e === void 0 && b(t.date), r?.(t.date)) : (T(!0), a?.(t.error));
1345
+ } else T(!1), a?.(null);
1346
+ }, O = n(() => {
1347
+ C(""), T(!1), a?.(null), e === void 0 && b(null), r?.(null), E.current?.focus();
1348
+ }, [
1349
+ e,
1350
+ r,
1351
+ a
1352
+ ]);
1353
+ return /* @__PURE__ */ u("div", {
1354
+ style: {
1355
+ position: "relative",
1356
+ display: "inline-flex",
1357
+ alignItems: "center",
1358
+ direction: "rtl"
1359
+ },
1360
+ children: [/* @__PURE__ */ l("input", {
1361
+ ref: E,
1362
+ type: "text",
1363
+ inputMode: "numeric",
1364
+ disabled: g,
1365
+ placeholder: c === "persian" ? h : "1405/01/15",
1366
+ value: S,
1367
+ onChange: D,
1368
+ style: {
1369
+ width: "180px",
1370
+ padding: "8px 12px",
1371
+ paddingLeft: m && S ? "32px" : "12px",
1372
+ borderRadius: "var(--pdp-border-radius, 8px)",
1373
+ border: `1px solid ${w ? "#ef4444" : "var(--pdp-surface-border, #e2e8f0)"}`,
1374
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1375
+ color: "var(--pdp-text-primary, #0f172a)",
1376
+ fontSize: "14px",
1377
+ fontFamily: "inherit",
1378
+ outline: "none",
1379
+ textAlign: "center",
1380
+ letterSpacing: "1px",
1381
+ transition: "border-color 0.15s ease",
1382
+ ..._
1383
+ },
1384
+ ...v
1385
+ }), m && S && !g && /* @__PURE__ */ l("button", {
1386
+ type: "button",
1387
+ "aria-label": "پاک کردن",
1388
+ onClick: O,
1389
+ style: {
1390
+ position: "absolute",
1391
+ left: "8px",
1392
+ background: "none",
1393
+ border: "none",
1394
+ cursor: "pointer",
1395
+ color: "var(--pdp-text-muted, #94a3b8)",
1396
+ fontSize: "14px",
1397
+ lineHeight: 1,
1398
+ display: "flex",
1399
+ alignItems: "center",
1400
+ justifyContent: "center",
1401
+ padding: "2px"
1402
+ },
1403
+ children: "✕"
1404
+ })]
1405
+ });
1406
+ };
1407
+ //#endregion
1408
+ //#region src/events/event-utils.ts
1409
+ function me(e, t) {
1410
+ return !t || t.length === 0 ? [] : t.filter((t) => b(t.date, e));
1411
+ }
1412
+ //#endregion
1413
+ //#region src/holidays/iran-holidays.ts
1414
+ var he = {
1415
+ "0-1": "جشن نوروز / سال نو",
1416
+ "0-2": "عید نوروز",
1417
+ "0-3": "عید نوروز",
1418
+ "0-4": "عید نوروز",
1419
+ "0-12": "روز جمهوری اسلامی ایران",
1420
+ "0-13": "روز طبیعت (سیزده‌بدر)",
1421
+ "2-14": "رحلت امام خمینی",
1422
+ "2-15": "قیام ۱۵ خرداد",
1423
+ "10-22": "پیروزی انقلاب اسلامی",
1424
+ "11-29": "روز ملی شدن صنعت نفت"
1425
+ };
1426
+ function q(e) {
1427
+ return v(e.year, e.month, e.day).getDay() === 5;
1428
+ }
1429
+ function ge(e, t) {
1430
+ if (t && t.length > 0) {
1431
+ let n = t.find((t) => t.date.year === e.year && t.date.month === e.month && t.date.day === e.day);
1432
+ if (n) return {
1433
+ title: n.title,
1434
+ type: "custom",
1435
+ isOff: n.isOff ?? !0
1436
+ };
1437
+ }
1438
+ let n = `${e.month}-${e.day}`;
1439
+ return he[n] ? {
1440
+ title: he[n],
1441
+ type: "solar",
1442
+ isOff: !0
1443
+ } : q(e) ? {
1444
+ title: "جمعه (تعطیل پایان هفته)",
1445
+ type: "solar",
1446
+ isOff: !0
1447
+ } : null;
1448
+ }
1449
+ //#endregion
1450
+ //#region src/components/JalaliDatePicker.tsx
1451
+ function _e({ variant: e = "inline", placeholder: t = "انتخاب تاریخ...", digitType: r = "persian", className: f, style: p, classNames: m, styles: h, showFooter: g = !1, showStatusText: _ = !0, showActions: v = !0, onConfirm: y, defaultValue: x, enableTime: C = !1, timeValue: w, defaultTimeValue: T, onTimeChange: E, minuteStep: O = 1, hourStep: k = 1, showSeconds: j = !1, enablePresets: M = !1, presets: P, presetsOrientation: F = "vertical", numberOfMonths: L = 1, useMaskedInput: z = !1, events: ee, showHolidays: te = !1, customHolidays: ne, ...B }) {
1452
+ let [V, H] = s(e === "inline"), [W, G] = s(!1), ue = o(null), K = e === "modal", [fe, he] = s(() => T ?? U()), q = w === void 0 ? fe : w ?? U(), _e = n((e) => {
1453
+ w === void 0 && he(e), E?.(e);
1454
+ }, [w, E]), { selected: J, viewYear: Y, viewMonth: X, grid: ve, goToPrevMonth: ye, goToNextMonth: be, setView: Z, goToToday: xe, selectDate: Q, setHoverDate: Se, hoverDate: Ce, clear: we } = A({
1455
+ defaultValue: x,
1456
+ ...B
1457
+ }), Te = B.mode === "single" ? J : null, Ee = (t) => {
1458
+ Q(t), e === "popover" && B.mode === "single" && !C && H(!1);
1459
+ }, { handleKeyDown: De, getCellTabIndex: Oe, setFocusedDate: ke } = N({
1460
+ viewYear: Y,
1461
+ viewMonth: X,
1462
+ selectedDate: Te,
1463
+ onSelectDate: Ee,
1464
+ onViewChange: Z,
1465
+ isRtl: !0
1466
+ });
1467
+ i(() => {
1468
+ if (!K || !V) return;
1469
+ let e = document.body.style.overflow;
1470
+ document.body.style.overflow = "hidden";
1471
+ let t = (e) => {
1472
+ e.key === "Escape" && H(!1);
1473
+ };
1474
+ return window.addEventListener("keydown", t), () => {
1475
+ document.body.style.overflow = e, window.removeEventListener("keydown", t);
1476
+ };
1477
+ }, [K, V]);
1478
+ let Ae = (t) => {
1479
+ if (B.mode === "single" && !Array.isArray(t)) Q(t), Z(t.year, t.month), e === "popover" && !C && H(!1);
1480
+ else if (B.mode === "range" && Array.isArray(t)) {
1481
+ let [e, n] = t;
1482
+ e && n && (Q(e), Q(n), Z(e.year, e.month));
1483
+ }
1484
+ }, $ = a(() => X === 11 ? {
1485
+ year: Y + 1,
1486
+ month: 0
1487
+ } : {
1488
+ year: Y,
1489
+ month: X + 1
1490
+ }, [Y, X]), je = a(() => {
1491
+ if (L !== 2) return [];
1492
+ let e = S({
1493
+ year: $.year,
1494
+ month: $.month,
1495
+ firstDayOfWeek: B.firstDayOfWeek ?? 0,
1496
+ minDate: B.minDate,
1497
+ maxDate: B.maxDate,
1498
+ isDateDisabled: B.isDateDisabled
1499
+ });
1500
+ if (B.mode !== "range") return e;
1501
+ let [t, n] = J || [null, null], r = n ?? (t && Ce ? Ce : null);
1502
+ return e.map((e) => {
1503
+ let n = t ? b(e.jalali, t) : !1, i = r ? b(e.jalali, r) : !1, a = !1;
1504
+ return t && r && (a = D(e.jalali, t, r)), {
1505
+ ...e,
1506
+ isSelected: n || i,
1507
+ isInRange: a,
1508
+ isRangeStart: n,
1509
+ isRangeEnd: i
1510
+ };
1511
+ });
1512
+ }, [
1513
+ L,
1514
+ $,
1515
+ B,
1516
+ J,
1517
+ Ce
1518
+ ]), Me = a(() => {
1519
+ if (!J) return "";
1520
+ if (B.mode === "single") {
1521
+ let e = R(J, "YYYY/MM/DD", { digitType: r });
1522
+ return C && q ? `${e} ${se(q, j, r)}` : e;
1523
+ }
1524
+ if (B.mode === "range") {
1525
+ let [e, t] = J || [null, null];
1526
+ if (e && t) return `${R(e, "YYYY/MM/DD", { digitType: r })} - ${R(t, "YYYY/MM/DD", { digitType: r })}`;
1527
+ if (e) return R(e, "YYYY/MM/DD", { digitType: r });
1528
+ }
1529
+ return "";
1530
+ }, [
1531
+ J,
1532
+ B.mode,
1533
+ r,
1534
+ C,
1535
+ q,
1536
+ j
1537
+ ]), Ne = (e, t, n, i = !0, a = !0) => /* @__PURE__ */ u("div", {
1538
+ style: { minWidth: "270px" },
1539
+ children: [
1540
+ /* @__PURE__ */ l(re, {
1541
+ year: e,
1542
+ month: t,
1543
+ onPrevMonth: i ? ye : () => {},
1544
+ onNextMonth: a ? be : () => {},
1545
+ onTogglePicker: () => L === 1 && G(!0),
1546
+ onGoToToday: xe,
1547
+ classNames: m,
1548
+ styles: h
1549
+ }),
1550
+ /* @__PURE__ */ l(ie, {
1551
+ firstDayOfWeek: B.firstDayOfWeek,
1552
+ classNames: m,
1553
+ styles: h
1554
+ }),
1555
+ /* @__PURE__ */ l("div", {
1556
+ role: "grid",
1557
+ "aria-label": `${d[t]} ${I(e)}`,
1558
+ className: m?.grid,
1559
+ style: {
1560
+ display: "grid",
1561
+ gridTemplateColumns: "repeat(7, var(--pdp-cell-size, 36px))",
1562
+ gap: "4px",
1563
+ ...h?.grid
1564
+ },
1565
+ children: n.map((e, t) => {
1566
+ let n = te ? ge(e.jalali, ne) : null, i = me(e.jalali, ee);
1567
+ return /* @__PURE__ */ l(ae, {
1568
+ cell: e,
1569
+ digitType: r,
1570
+ isHoliday: !!n,
1571
+ holidayTitle: n?.title,
1572
+ events: i,
1573
+ classNames: m,
1574
+ styles: h,
1575
+ tabIndex: Oe(e.jalali),
1576
+ onSelect: Ee,
1577
+ onHover: Se,
1578
+ onFocus: ke
1579
+ }, t);
1580
+ })
1581
+ })
1582
+ ]
1583
+ }), Pe = /* @__PURE__ */ u("div", {
1584
+ role: K ? "dialog" : "region",
1585
+ "aria-modal": K ? !0 : void 0,
1586
+ "aria-label": "تقویم شمسی",
1587
+ onKeyDown: De,
1588
+ onClick: (e) => K && e.stopPropagation(),
1589
+ className: m?.calendar,
1590
+ style: {
1591
+ position: e === "popover" ? "absolute" : K ? "relative" : "static",
1592
+ top: e === "popover" ? "calc(100% + 4px)" : void 0,
1593
+ right: e === "popover" ? 0 : void 0,
1594
+ zIndex: K ? 1001 : 50,
1595
+ padding: "16px",
1596
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1597
+ borderRadius: "var(--pdp-border-radius, 12px)",
1598
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1599
+ boxShadow: K ? "0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3)" : "var(--pdp-shadow)",
1600
+ width: "fit-content",
1601
+ userSelect: "none",
1602
+ display: "flex",
1603
+ flexDirection: F === "horizontal" ? "column" : "row",
1604
+ gap: "12px",
1605
+ ...h?.calendar
1606
+ },
1607
+ children: [
1608
+ K && /* @__PURE__ */ l("button", {
1609
+ type: "button",
1610
+ "aria-label": "بستن",
1611
+ onClick: () => H(!1),
1612
+ style: {
1613
+ position: "absolute",
1614
+ top: "10px",
1615
+ left: "10px",
1616
+ background: "none",
1617
+ border: "none",
1618
+ cursor: "pointer",
1619
+ fontSize: "16px",
1620
+ color: "var(--pdp-text-muted, #94a3b8)",
1621
+ lineHeight: 1,
1622
+ zIndex: 10
1623
+ },
1624
+ children: "✕"
1625
+ }),
1626
+ M && /* @__PURE__ */ l(de, {
1627
+ presets: P,
1628
+ orientation: F,
1629
+ digitType: r,
1630
+ selectedValue: J,
1631
+ onSelectPreset: Ae,
1632
+ classNames: m,
1633
+ styles: h
1634
+ }),
1635
+ /* @__PURE__ */ l("div", {
1636
+ style: {
1637
+ display: "flex",
1638
+ flexDirection: "column",
1639
+ gap: "8px"
1640
+ },
1641
+ children: W ? /* @__PURE__ */ l(oe, {
1642
+ currentYear: Y,
1643
+ currentMonth: X,
1644
+ onSelectMonth: (e) => Z(Y, e),
1645
+ onSelectYear: (e) => Z(e, X),
1646
+ onClose: () => G(!1)
1647
+ }) : /* @__PURE__ */ u(c, { children: [
1648
+ /* @__PURE__ */ u("div", {
1649
+ style: {
1650
+ display: "flex",
1651
+ gap: "16px",
1652
+ alignItems: "flex-start"
1653
+ },
1654
+ children: [Ne(Y, X, ve, !0, L === 1), L === 2 && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", { style: {
1655
+ width: "1px",
1656
+ backgroundColor: "var(--pdp-surface-border, #e2e8f0)",
1657
+ alignSelf: "stretch"
1658
+ } }), Ne($.year, $.month, je, !1, !0)] })]
1659
+ }),
1660
+ C && /* @__PURE__ */ l(le, {
1661
+ value: q,
1662
+ onChange: _e,
1663
+ minuteStep: O,
1664
+ hourStep: k,
1665
+ showSeconds: j,
1666
+ digitType: r,
1667
+ classNames: m,
1668
+ styles: h
1669
+ }),
1670
+ g && /* @__PURE__ */ l(ce, {
1671
+ mode: B.mode,
1672
+ digitType: r,
1673
+ showStatusText: _,
1674
+ showActions: v,
1675
+ selectedDate: B.mode === "single" ? J : null,
1676
+ selectedRange: B.mode === "range" ? J : void 0,
1677
+ selectedDates: B.mode === "multiple" ? J : void 0,
1678
+ selectedTime: C ? q : void 0,
1679
+ onToday: xe,
1680
+ onClear: we,
1681
+ onConfirm: () => {
1682
+ e !== "inline" && H(!1), y?.();
1683
+ },
1684
+ classNames: m,
1685
+ styles: h
1686
+ })
1687
+ ] })
1688
+ })
1689
+ ]
1690
+ });
1691
+ return /* @__PURE__ */ u("div", {
1692
+ ref: ue,
1693
+ className: f ?? m?.root,
1694
+ style: {
1695
+ position: "relative",
1696
+ display: "inline-block",
1697
+ ...p,
1698
+ ...h?.root
1699
+ },
1700
+ children: [e !== "inline" && (z && B.mode === "single" && e === "popover" ? /* @__PURE__ */ l(pe, {
1701
+ value: Te,
1702
+ digitType: r,
1703
+ placeholder: t,
1704
+ onChange: (e) => {
1705
+ e ? (Q(e), Z(e.year, e.month)) : we();
1706
+ },
1707
+ onClick: () => H(!0),
1708
+ className: m?.input,
1709
+ style: h?.input
1710
+ }) : /* @__PURE__ */ l("input", {
1711
+ type: "text",
1712
+ readOnly: !0,
1713
+ placeholder: t,
1714
+ value: Me,
1715
+ onClick: () => H(!0),
1716
+ className: m?.input,
1717
+ style: {
1718
+ padding: "8px 12px",
1719
+ borderRadius: "var(--pdp-border-radius, 8px)",
1720
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1721
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1722
+ color: "var(--pdp-text-primary, #0f172a)",
1723
+ cursor: "pointer",
1724
+ textAlign: "right",
1725
+ direction: "rtl",
1726
+ fontSize: "14px",
1727
+ minWidth: C ? "200px" : L === 2 ? "240px" : "150px",
1728
+ ...h?.input
1729
+ }
1730
+ })), V && (K ? /* @__PURE__ */ l("div", {
1731
+ role: "presentation",
1732
+ onClick: () => H(!1),
1733
+ className: m?.modalBackdrop,
1734
+ style: {
1735
+ position: "fixed",
1736
+ top: 0,
1737
+ left: 0,
1738
+ right: 0,
1739
+ bottom: 0,
1740
+ backgroundColor: "rgba(15, 23, 42, 0.6)",
1741
+ backdropFilter: "blur(4px)",
1742
+ zIndex: 1e3,
1743
+ display: "flex",
1744
+ alignItems: "center",
1745
+ justifyContent: "center",
1746
+ padding: "16px",
1747
+ direction: "rtl",
1748
+ ...h?.modalBackdrop
1749
+ },
1750
+ children: Pe
1751
+ }) : Pe)]
1752
+ });
1753
+ }
1754
+ //#endregion
1755
+ //#region src/components/dual-calendar/DualMonthCalendar.tsx
1756
+ var J = ({ value: e, defaultValue: t = [null, null], onChange: r, initialViewDate: i, firstDayOfWeek: o = 0, digitType: c = "persian", minDate: f, maxDate: p, isDateDisabled: m }) => {
1757
+ let [h, g] = s(t), _ = e === void 0 ? h : e, [v, x] = s(null), C = a(() => y(), []), [w, T] = s(() => i || (_[0] ? {
1758
+ year: _[0].year,
1759
+ month: _[0].month
1760
+ } : {
1761
+ year: C.year,
1762
+ month: C.month
1763
+ })), O = a(() => w.month === 11 ? {
1764
+ year: w.year + 1,
1765
+ month: 0
1766
+ } : {
1767
+ year: w.year,
1768
+ month: w.month + 1
1769
+ }, [w]), k = () => {
1770
+ T((e) => e.month === 0 ? {
1771
+ year: e.year - 1,
1772
+ month: 11
1773
+ } : {
1774
+ year: e.year,
1775
+ month: e.month - 1
1776
+ });
1777
+ }, A = () => {
1778
+ T((e) => e.month === 11 ? {
1779
+ year: e.year + 1,
1780
+ month: 0
1781
+ } : {
1782
+ year: e.year,
1783
+ month: e.month + 1
1784
+ });
1785
+ }, j = n((t) => {
1786
+ let [n, i] = _, a;
1787
+ !n || n && i ? a = [t, null] : (a = E(t, n) < 0 ? [t, n] : [n, t], x(null)), e === void 0 && g(a), r?.(a);
1788
+ }, [
1789
+ _,
1790
+ e,
1791
+ r
1792
+ ]), M = n((e, t) => {
1793
+ let n = S({
1794
+ year: e,
1795
+ month: t,
1796
+ firstDayOfWeek: o,
1797
+ minDate: f,
1798
+ maxDate: p,
1799
+ isDateDisabled: m
1800
+ }), [r, i] = _, a = i ?? (r && v ? v : null);
1801
+ return n.map((e) => {
1802
+ let t = r ? b(e.jalali, r) : !1, n = a ? b(e.jalali, a) : !1, i = !1;
1803
+ return r && a && (i = D(e.jalali, r, a)), {
1804
+ ...e,
1805
+ isSelected: t || n,
1806
+ isInRange: i,
1807
+ isRangeStart: t,
1808
+ isRangeEnd: n
1809
+ };
1810
+ });
1811
+ }, [
1812
+ o,
1813
+ f,
1814
+ p,
1815
+ m,
1816
+ _,
1817
+ v
1818
+ ]), N = a(() => M(w.year, w.month), [
1819
+ M,
1820
+ w.year,
1821
+ w.month
1822
+ ]), P = a(() => M(O.year, O.month), [
1823
+ M,
1824
+ O.year,
1825
+ O.month
1826
+ ]), F = (e, t, n, r) => /* @__PURE__ */ u("div", {
1827
+ style: {
1828
+ display: "flex",
1829
+ flexDirection: "column",
1830
+ gap: "8px",
1831
+ minWidth: "270px"
1832
+ },
1833
+ children: [
1834
+ /* @__PURE__ */ u("div", {
1835
+ style: {
1836
+ display: "flex",
1837
+ alignItems: "center",
1838
+ justifyContent: "space-between",
1839
+ padding: "0 4px",
1840
+ height: "32px"
1841
+ },
1842
+ children: [
1843
+ r ? /* @__PURE__ */ l("button", {
1844
+ type: "button",
1845
+ "aria-label": "ماه قبل",
1846
+ onClick: k,
1847
+ style: {
1848
+ width: "28px",
1849
+ height: "28px",
1850
+ borderRadius: "6px",
1851
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1852
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1853
+ color: "var(--pdp-text-primary, #0f172a)",
1854
+ cursor: "pointer"
1855
+ },
1856
+ children: "›"
1857
+ }) : /* @__PURE__ */ l("div", { style: { width: "28px" } }),
1858
+ /* @__PURE__ */ u("div", {
1859
+ style: {
1860
+ fontWeight: 600,
1861
+ fontSize: "14px",
1862
+ color: "var(--pdp-text-primary, #0f172a)"
1863
+ },
1864
+ children: [
1865
+ d[t],
1866
+ " ",
1867
+ I(e)
1868
+ ]
1869
+ }),
1870
+ r ? /* @__PURE__ */ l("div", { style: { width: "28px" } }) : /* @__PURE__ */ l("button", {
1871
+ type: "button",
1872
+ "aria-label": "ماه بعد",
1873
+ onClick: A,
1874
+ style: {
1875
+ width: "28px",
1876
+ height: "28px",
1877
+ borderRadius: "6px",
1878
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1879
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1880
+ color: "var(--pdp-text-primary, #0f172a)",
1881
+ cursor: "pointer"
1882
+ },
1883
+ children: "‹"
1884
+ })
1885
+ ]
1886
+ }),
1887
+ /* @__PURE__ */ l(ie, { firstDayOfWeek: o }),
1888
+ /* @__PURE__ */ l("div", {
1889
+ role: "grid",
1890
+ "aria-label": `${d[t]} ${I(e)}`,
1891
+ style: {
1892
+ display: "grid",
1893
+ gridTemplateColumns: "repeat(7, var(--pdp-cell-size, 36px))",
1894
+ gap: "4px"
1895
+ },
1896
+ children: n.map((e, t) => /* @__PURE__ */ l(ae, {
1897
+ cell: e,
1898
+ digitType: c,
1899
+ tabIndex: 0,
1900
+ onSelect: j,
1901
+ onHover: x
1902
+ }, t))
1903
+ })
1904
+ ]
1905
+ });
1906
+ return /* @__PURE__ */ u("div", {
1907
+ role: "region",
1908
+ "aria-label": "تقویم دوقلو شمسی",
1909
+ style: {
1910
+ display: "flex",
1911
+ flexWrap: "wrap",
1912
+ gap: "24px",
1913
+ padding: "16px",
1914
+ backgroundColor: "var(--pdp-surface-bg, #ffffff)",
1915
+ borderRadius: "var(--pdp-border-radius, 8px)",
1916
+ border: "1px solid var(--pdp-surface-border, #e2e8f0)",
1917
+ boxShadow: "var(--pdp-shadow)",
1918
+ width: "fit-content",
1919
+ direction: "rtl"
1920
+ },
1921
+ children: [
1922
+ F(w.year, w.month, N, !0),
1923
+ /* @__PURE__ */ l("div", { style: {
1924
+ width: "1px",
1925
+ backgroundColor: "var(--pdp-surface-border, #e2e8f0)"
1926
+ } }),
1927
+ F(O.year, O.month, P, !1)
1928
+ ]
1929
+ });
1930
+ };
1931
+ //#endregion
1932
+ export { ue as DEFAULT_DATE_PICKER_PRESETS, B as DatePickerThemeProvider, ae as DayCell, J as DualMonthCalendar, re as Header, f as JALALI_MONTH_NAMES_EN, _e as JalaliDatePicker, pe as MaskedDateInput, oe as MonthYearPicker, d as PERSIAN_MONTH_NAMES, m as PERSIAN_WEEK_DAYS_LONG, p as PERSIAN_WEEK_DAYS_SHORT, de as PresetsBar, le as TimePicker, ie as Weekdays, w as addDaysToJalali, T as addJalaliDays, K as applyDateMask, j as calculateNextFocusedDate, W as clampTime, E as compareJalaliDates, ee as darkThemeTokens, R as formatJalaliDate, H as formatTimeSegment, se as formatTimeString, S as generateJalaliCalendarGrid, M as getAriaDayLabel, U as getCurrentTime, g as getDaysInJalaliMonth, G as getDefaultJalaliPresets, me as getEventsForDate, C as getJalaliDayOfWeek, k as getJalaliMonthRange, O as getJalaliWeekRange, y as getTodayJalali, _ as gregorianToJalali, D as isJalaliDateBetween, h as isJalaliLeapYear, b as isSameJalaliDay, v as jalaliToGregorian, z as lightThemeTokens, fe as parseAndValidateJalaliString, x as toJalaliDate, L as toLatinDigits, I as toPersianDigits, te as tokensToCssVariables, N as useCalendarKeyboard, V as useDatePickerTheme, A as useJalaliDatePicker };
1933
+
1934
+ //# sourceMappingURL=index.mjs.map