@grapadigital/shared-app-modules 0.0.118 → 0.0.119

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,2129 +0,0 @@
1
- import { jsx as Y, jsxs as Ft } from "react/jsx-runtime";
2
- import * as He from "react";
3
- import f, { useMemo as ie, createContext as It, useContext as At, useCallback as q, useRef as he, useLayoutEffect as zt, useState as _e, useEffect as jt } from "react";
4
- import { a as qt, c as w, b as Ht, L as $t, S as Rt, b4 as Zt, b3 as Ut, b5 as $e, B as Vt } from "./switch.BJ3c7vY0.js";
5
- import { addDays as Gt, addMonths as Kt, addWeeks as Jt, addYears as Lt, differenceInCalendarDays as Xt, differenceInCalendarMonths as Qt, eachMonthOfInterval as en, eachYearOfInterval as tn, endOfISOWeek as nn, endOfMonth as on, endOfWeek as rn, endOfYear as an, format as sn, getISOWeek as ln, getMonth as dn, getYear as cn, getWeek as fn, isAfter as un, isBefore as hn, isDate as mn, isSameDay as yn, isSameMonth as pn, isSameYear as gn, max as bn, min as vn, setMonth as kn, setYear as Mn, startOfDay as wn, startOfISOWeek as Dn, startOfMonth as On, startOfWeek as Wn, startOfYear as Cn } from "date-fns";
6
- const Sn = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], Nn = qt("chevron-left", Sn);
7
- function Kr({ className: e, ...t }) {
8
- return /* @__PURE__ */ Y(
9
- "fieldset",
10
- {
11
- "data-slot": "field-set",
12
- className: w(
13
- "flex flex-col gap-6",
14
- "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
15
- e
16
- ),
17
- ...t
18
- }
19
- );
20
- }
21
- function Jr({
22
- className: e,
23
- variant: t = "legend",
24
- ...o
25
- }) {
26
- return /* @__PURE__ */ Y(
27
- "legend",
28
- {
29
- "data-slot": "field-legend",
30
- "data-variant": t,
31
- className: w(
32
- "mb-3 font-medium",
33
- "data-[variant=legend]:text-base",
34
- "data-[variant=label]:text-sm",
35
- e
36
- ),
37
- ...o
38
- }
39
- );
40
- }
41
- function Lr({ className: e, ...t }) {
42
- return /* @__PURE__ */ Y(
43
- "div",
44
- {
45
- "data-slot": "field-group",
46
- className: w(
47
- "group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
48
- e
49
- ),
50
- ...t
51
- }
52
- );
53
- }
54
- const xn = Ht(
55
- "group/field data-[invalid=true]:text-destructive flex w-full gap-3",
56
- {
57
- variants: {
58
- orientation: {
59
- vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
60
- horizontal: [
61
- "flex-row items-center",
62
- "[&>[data-slot=field-label]]:flex-auto",
63
- "has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start"
64
- ],
65
- responsive: [
66
- "@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto",
67
- "@md/field-group:[&>[data-slot=field-label]]:flex-auto",
68
- "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
69
- ]
70
- }
71
- },
72
- defaultVariants: {
73
- orientation: "vertical"
74
- }
75
- }
76
- );
77
- function Xr({
78
- className: e,
79
- orientation: t = "vertical",
80
- ...o
81
- }) {
82
- return /* @__PURE__ */ Y(
83
- "div",
84
- {
85
- role: "group",
86
- "data-slot": "field",
87
- "data-orientation": t,
88
- className: w(xn({ orientation: t }), e),
89
- ...o
90
- }
91
- );
92
- }
93
- function Qr({ className: e, ...t }) {
94
- return /* @__PURE__ */ Y(
95
- "div",
96
- {
97
- "data-slot": "field-content",
98
- className: w(
99
- "group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
100
- e
101
- ),
102
- ...t
103
- }
104
- );
105
- }
106
- function ea({
107
- className: e,
108
- ...t
109
- }) {
110
- return /* @__PURE__ */ Y(
111
- $t,
112
- {
113
- "data-slot": "field-label",
114
- className: w(
115
- "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
116
- "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4",
117
- "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
118
- e
119
- ),
120
- ...t
121
- }
122
- );
123
- }
124
- function ta({ className: e, ...t }) {
125
- return /* @__PURE__ */ Y(
126
- "div",
127
- {
128
- "data-slot": "field-label",
129
- className: w(
130
- "flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50",
131
- e
132
- ),
133
- ...t
134
- }
135
- );
136
- }
137
- function na({ className: e, ...t }) {
138
- return /* @__PURE__ */ Y(
139
- "p",
140
- {
141
- "data-slot": "field-description",
142
- className: w(
143
- "text-muted-foreground text-sm font-normal leading-normal group-has-[[data-orientation=horizontal]]/field:text-balance",
144
- "nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5",
145
- "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
146
- e
147
- ),
148
- ...t
149
- }
150
- );
151
- }
152
- function oa({
153
- children: e,
154
- className: t,
155
- ...o
156
- }) {
157
- return /* @__PURE__ */ Ft(
158
- "div",
159
- {
160
- "data-slot": "field-separator",
161
- "data-content": !!e,
162
- className: w(
163
- "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
164
- t
165
- ),
166
- ...o,
167
- children: [
168
- /* @__PURE__ */ Y(Rt, { className: "absolute inset-0 top-1/2" }),
169
- e && /* @__PURE__ */ Y(
170
- "span",
171
- {
172
- className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
173
- "data-slot": "field-separator-content",
174
- children: e
175
- }
176
- )
177
- ]
178
- }
179
- );
180
- }
181
- function ra({
182
- className: e,
183
- children: t,
184
- errors: o,
185
- ...n
186
- }) {
187
- const r = ie(() => t || (o ? o?.length === 1 && o[0]?.message ? o[0].message : /* @__PURE__ */ Y("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: o.map(
188
- (l, a) => l?.message && /* @__PURE__ */ Y("li", { children: l.message }, a)
189
- ) }) : null), [t, o]);
190
- return r ? /* @__PURE__ */ Y(
191
- "div",
192
- {
193
- role: "alert",
194
- "data-slot": "field-error",
195
- className: w("text-destructive text-sm font-normal", e),
196
- ...n,
197
- children: r
198
- }
199
- ) : null;
200
- }
201
- function _n(e, t, o = "long") {
202
- return new Intl.DateTimeFormat("en-US", {
203
- // Enforces engine to render the time. Without the option JavaScriptCore omits it.
204
- hour: "numeric",
205
- timeZone: e,
206
- timeZoneName: o
207
- }).format(t).split(/\s/g).slice(2).join(" ");
208
- }
209
- const Tn = {}, se = {};
210
- function ne(e, t) {
211
- try {
212
- const n = (Tn[e] ||= new Intl.DateTimeFormat("en-US", {
213
- timeZone: e,
214
- timeZoneName: "longOffset"
215
- }).format)(t).split("GMT")[1];
216
- return n in se ? se[n] : Re(n, n.split(":"));
217
- } catch {
218
- if (e in se) return se[e];
219
- const o = e?.match(En);
220
- return o ? Re(e, o.slice(1)) : NaN;
221
- }
222
- }
223
- const En = /([+-]\d\d):?(\d\d)?/;
224
- function Re(e, t) {
225
- const o = +(t[0] || 0), n = +(t[1] || 0), r = +(t[2] || 0) / 60;
226
- return se[e] = o * 60 + n > 0 ? o * 60 + n + r : o * 60 - n - r;
227
- }
228
- class G extends Date {
229
- //#region static
230
- constructor(...t) {
231
- super(), t.length > 1 && typeof t[t.length - 1] == "string" && (this.timeZone = t.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(ne(this.timeZone, this)) ? this.setTime(NaN) : t.length ? typeof t[0] == "number" && (t.length === 1 || t.length === 2 && typeof t[1] != "number") ? this.setTime(t[0]) : typeof t[0] == "string" ? this.setTime(+new Date(t[0])) : t[0] instanceof Date ? this.setTime(+t[0]) : (this.setTime(+new Date(...t)), Le(this), Te(this)) : this.setTime(Date.now());
232
- }
233
- static tz(t, ...o) {
234
- return o.length ? new G(...o, t) : new G(Date.now(), t);
235
- }
236
- //#endregion
237
- //#region time zone
238
- withTimeZone(t) {
239
- return new G(+this, t);
240
- }
241
- getTimezoneOffset() {
242
- const t = -ne(this.timeZone, this);
243
- return t > 0 ? Math.floor(t) : Math.ceil(t);
244
- }
245
- //#endregion
246
- //#region time
247
- setTime(t) {
248
- return Date.prototype.setTime.apply(this, arguments), Te(this), +this;
249
- }
250
- //#endregion
251
- //#region date-fns integration
252
- [Symbol.for("constructDateFrom")](t) {
253
- return new G(+new Date(t), this.timeZone);
254
- }
255
- //#endregion
256
- }
257
- const Ze = /^(get|set)(?!UTC)/;
258
- Object.getOwnPropertyNames(Date.prototype).forEach((e) => {
259
- if (!Ze.test(e)) return;
260
- const t = e.replace(Ze, "$1UTC");
261
- G.prototype[t] && (e.startsWith("get") ? G.prototype[e] = function() {
262
- return this.internal[t]();
263
- } : (G.prototype[e] = function() {
264
- return Date.prototype[t].apply(this.internal, arguments), Pn(this), +this;
265
- }, G.prototype[t] = function() {
266
- return Date.prototype[t].apply(this, arguments), Te(this), +this;
267
- }));
268
- });
269
- function Te(e) {
270
- e.internal.setTime(+e), e.internal.setUTCSeconds(e.internal.getUTCSeconds() - Math.round(-ne(e.timeZone, e) * 60));
271
- }
272
- function Pn(e) {
273
- Date.prototype.setFullYear.call(e, e.internal.getUTCFullYear(), e.internal.getUTCMonth(), e.internal.getUTCDate()), Date.prototype.setHours.call(e, e.internal.getUTCHours(), e.internal.getUTCMinutes(), e.internal.getUTCSeconds(), e.internal.getUTCMilliseconds()), Le(e);
274
- }
275
- function Le(e) {
276
- const t = ne(e.timeZone, e), o = t > 0 ? Math.floor(t) : Math.ceil(t), n = /* @__PURE__ */ new Date(+e);
277
- n.setUTCHours(n.getUTCHours() - 1);
278
- const r = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset(), l = -(/* @__PURE__ */ new Date(+n)).getTimezoneOffset(), a = r - l, s = Date.prototype.getHours.apply(e) !== e.internal.getUTCHours();
279
- a && s && e.internal.setUTCMinutes(e.internal.getUTCMinutes() + a);
280
- const i = r - o;
281
- i && Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + i);
282
- const d = /* @__PURE__ */ new Date(+e);
283
- d.setUTCSeconds(0);
284
- const u = r > 0 ? d.getSeconds() : (d.getSeconds() - 60) % 60, c = Math.round(-(ne(e.timeZone, e) * 60)) % 60;
285
- (c || u) && (e.internal.setUTCSeconds(e.internal.getUTCSeconds() + c), Date.prototype.setUTCSeconds.call(e, Date.prototype.getUTCSeconds.call(e) + c + u));
286
- const h = ne(e.timeZone, e), g = h > 0 ? Math.floor(h) : Math.ceil(h), N = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset() - g, k = g !== o, W = N - i;
287
- if (k && W) {
288
- Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + W);
289
- const x = ne(e.timeZone, e), v = x > 0 ? Math.floor(x) : Math.ceil(x), D = g - v;
290
- D && (e.internal.setUTCMinutes(e.internal.getUTCMinutes() + D), Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + D));
291
- }
292
- }
293
- class X extends G {
294
- //#region static
295
- static tz(t, ...o) {
296
- return o.length ? new X(...o, t) : new X(Date.now(), t);
297
- }
298
- //#endregion
299
- //#region representation
300
- toISOString() {
301
- const [t, o, n] = this.tzComponents(), r = `${t}${o}:${n}`;
302
- return this.internal.toISOString().slice(0, -1) + r;
303
- }
304
- toString() {
305
- return `${this.toDateString()} ${this.toTimeString()}`;
306
- }
307
- toDateString() {
308
- const [t, o, n, r] = this.internal.toUTCString().split(" ");
309
- return `${t?.slice(0, -1)} ${n} ${o} ${r}`;
310
- }
311
- toTimeString() {
312
- const t = this.internal.toUTCString().split(" ")[4], [o, n, r] = this.tzComponents();
313
- return `${t} GMT${o}${n}${r} (${_n(this.timeZone, this)})`;
314
- }
315
- toLocaleString(t, o) {
316
- return Date.prototype.toLocaleString.call(this, t, {
317
- ...o,
318
- timeZone: o?.timeZone || this.timeZone
319
- });
320
- }
321
- toLocaleDateString(t, o) {
322
- return Date.prototype.toLocaleDateString.call(this, t, {
323
- ...o,
324
- timeZone: o?.timeZone || this.timeZone
325
- });
326
- }
327
- toLocaleTimeString(t, o) {
328
- return Date.prototype.toLocaleTimeString.call(this, t, {
329
- ...o,
330
- timeZone: o?.timeZone || this.timeZone
331
- });
332
- }
333
- //#endregion
334
- //#region private
335
- tzComponents() {
336
- const t = this.getTimezoneOffset(), o = t > 0 ? "-" : "+", n = String(Math.floor(Math.abs(t) / 60)).padStart(2, "0"), r = String(Math.abs(t) % 60).padStart(2, "0");
337
- return [o, n, r];
338
- }
339
- //#endregion
340
- withTimeZone(t) {
341
- return new X(+this, t);
342
- }
343
- //#region date-fns integration
344
- [Symbol.for("constructDateFrom")](t) {
345
- return new X(+new Date(t), this.timeZone);
346
- }
347
- //#endregion
348
- }
349
- const Bn = {
350
- lessThanXSeconds: {
351
- one: "less than a second",
352
- other: "less than {{count}} seconds"
353
- },
354
- xSeconds: {
355
- one: "1 second",
356
- other: "{{count}} seconds"
357
- },
358
- halfAMinute: "half a minute",
359
- lessThanXMinutes: {
360
- one: "less than a minute",
361
- other: "less than {{count}} minutes"
362
- },
363
- xMinutes: {
364
- one: "1 minute",
365
- other: "{{count}} minutes"
366
- },
367
- aboutXHours: {
368
- one: "about 1 hour",
369
- other: "about {{count}} hours"
370
- },
371
- xHours: {
372
- one: "1 hour",
373
- other: "{{count}} hours"
374
- },
375
- xDays: {
376
- one: "1 day",
377
- other: "{{count}} days"
378
- },
379
- aboutXWeeks: {
380
- one: "about 1 week",
381
- other: "about {{count}} weeks"
382
- },
383
- xWeeks: {
384
- one: "1 week",
385
- other: "{{count}} weeks"
386
- },
387
- aboutXMonths: {
388
- one: "about 1 month",
389
- other: "about {{count}} months"
390
- },
391
- xMonths: {
392
- one: "1 month",
393
- other: "{{count}} months"
394
- },
395
- aboutXYears: {
396
- one: "about 1 year",
397
- other: "about {{count}} years"
398
- },
399
- xYears: {
400
- one: "1 year",
401
- other: "{{count}} years"
402
- },
403
- overXYears: {
404
- one: "over 1 year",
405
- other: "over {{count}} years"
406
- },
407
- almostXYears: {
408
- one: "almost 1 year",
409
- other: "almost {{count}} years"
410
- }
411
- }, Yn = (e, t, o) => {
412
- let n;
413
- const r = Bn[e];
414
- return typeof r == "string" ? n = r : t === 1 ? n = r.one : n = r.other.replace("{{count}}", t.toString()), o?.addSuffix ? o.comparison && o.comparison > 0 ? "in " + n : n + " ago" : n;
415
- };
416
- function We(e) {
417
- return (t = {}) => {
418
- const o = t.width ? String(t.width) : e.defaultWidth;
419
- return e.formats[o] || e.formats[e.defaultWidth];
420
- };
421
- }
422
- const Fn = {
423
- full: "EEEE, MMMM do, y",
424
- long: "MMMM do, y",
425
- medium: "MMM d, y",
426
- short: "MM/dd/yyyy"
427
- }, In = {
428
- full: "h:mm:ss a zzzz",
429
- long: "h:mm:ss a z",
430
- medium: "h:mm:ss a",
431
- short: "h:mm a"
432
- }, An = {
433
- full: "{{date}} 'at' {{time}}",
434
- long: "{{date}} 'at' {{time}}",
435
- medium: "{{date}}, {{time}}",
436
- short: "{{date}}, {{time}}"
437
- }, zn = {
438
- date: We({
439
- formats: Fn,
440
- defaultWidth: "full"
441
- }),
442
- time: We({
443
- formats: In,
444
- defaultWidth: "full"
445
- }),
446
- dateTime: We({
447
- formats: An,
448
- defaultWidth: "full"
449
- })
450
- }, jn = {
451
- lastWeek: "'last' eeee 'at' p",
452
- yesterday: "'yesterday at' p",
453
- today: "'today at' p",
454
- tomorrow: "'tomorrow at' p",
455
- nextWeek: "eeee 'at' p",
456
- other: "P"
457
- }, qn = (e, t, o, n) => jn[e];
458
- function re(e) {
459
- return (t, o) => {
460
- const n = o?.context ? String(o.context) : "standalone";
461
- let r;
462
- if (n === "formatting" && e.formattingValues) {
463
- const a = e.defaultFormattingWidth || e.defaultWidth, s = o?.width ? String(o.width) : a;
464
- r = e.formattingValues[s] || e.formattingValues[a];
465
- } else {
466
- const a = e.defaultWidth, s = o?.width ? String(o.width) : e.defaultWidth;
467
- r = e.values[s] || e.values[a];
468
- }
469
- const l = e.argumentCallback ? e.argumentCallback(t) : t;
470
- return r[l];
471
- };
472
- }
473
- const Hn = {
474
- narrow: ["B", "A"],
475
- abbreviated: ["BC", "AD"],
476
- wide: ["Before Christ", "Anno Domini"]
477
- }, $n = {
478
- narrow: ["1", "2", "3", "4"],
479
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
480
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
481
- }, Rn = {
482
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
483
- abbreviated: [
484
- "Jan",
485
- "Feb",
486
- "Mar",
487
- "Apr",
488
- "May",
489
- "Jun",
490
- "Jul",
491
- "Aug",
492
- "Sep",
493
- "Oct",
494
- "Nov",
495
- "Dec"
496
- ],
497
- wide: [
498
- "January",
499
- "February",
500
- "March",
501
- "April",
502
- "May",
503
- "June",
504
- "July",
505
- "August",
506
- "September",
507
- "October",
508
- "November",
509
- "December"
510
- ]
511
- }, Zn = {
512
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
513
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
514
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
515
- wide: [
516
- "Sunday",
517
- "Monday",
518
- "Tuesday",
519
- "Wednesday",
520
- "Thursday",
521
- "Friday",
522
- "Saturday"
523
- ]
524
- }, Un = {
525
- narrow: {
526
- am: "a",
527
- pm: "p",
528
- midnight: "mi",
529
- noon: "n",
530
- morning: "morning",
531
- afternoon: "afternoon",
532
- evening: "evening",
533
- night: "night"
534
- },
535
- abbreviated: {
536
- am: "AM",
537
- pm: "PM",
538
- midnight: "midnight",
539
- noon: "noon",
540
- morning: "morning",
541
- afternoon: "afternoon",
542
- evening: "evening",
543
- night: "night"
544
- },
545
- wide: {
546
- am: "a.m.",
547
- pm: "p.m.",
548
- midnight: "midnight",
549
- noon: "noon",
550
- morning: "morning",
551
- afternoon: "afternoon",
552
- evening: "evening",
553
- night: "night"
554
- }
555
- }, Vn = {
556
- narrow: {
557
- am: "a",
558
- pm: "p",
559
- midnight: "mi",
560
- noon: "n",
561
- morning: "in the morning",
562
- afternoon: "in the afternoon",
563
- evening: "in the evening",
564
- night: "at night"
565
- },
566
- abbreviated: {
567
- am: "AM",
568
- pm: "PM",
569
- midnight: "midnight",
570
- noon: "noon",
571
- morning: "in the morning",
572
- afternoon: "in the afternoon",
573
- evening: "in the evening",
574
- night: "at night"
575
- },
576
- wide: {
577
- am: "a.m.",
578
- pm: "p.m.",
579
- midnight: "midnight",
580
- noon: "noon",
581
- morning: "in the morning",
582
- afternoon: "in the afternoon",
583
- evening: "in the evening",
584
- night: "at night"
585
- }
586
- }, Gn = (e, t) => {
587
- const o = Number(e), n = o % 100;
588
- if (n > 20 || n < 10)
589
- switch (n % 10) {
590
- case 1:
591
- return o + "st";
592
- case 2:
593
- return o + "nd";
594
- case 3:
595
- return o + "rd";
596
- }
597
- return o + "th";
598
- }, Kn = {
599
- ordinalNumber: Gn,
600
- era: re({
601
- values: Hn,
602
- defaultWidth: "wide"
603
- }),
604
- quarter: re({
605
- values: $n,
606
- defaultWidth: "wide",
607
- argumentCallback: (e) => e - 1
608
- }),
609
- month: re({
610
- values: Rn,
611
- defaultWidth: "wide"
612
- }),
613
- day: re({
614
- values: Zn,
615
- defaultWidth: "wide"
616
- }),
617
- dayPeriod: re({
618
- values: Un,
619
- defaultWidth: "wide",
620
- formattingValues: Vn,
621
- defaultFormattingWidth: "wide"
622
- })
623
- };
624
- function ae(e) {
625
- return (t, o = {}) => {
626
- const n = o.width, r = n && e.matchPatterns[n] || e.matchPatterns[e.defaultMatchWidth], l = t.match(r);
627
- if (!l)
628
- return null;
629
- const a = l[0], s = n && e.parsePatterns[n] || e.parsePatterns[e.defaultParseWidth], i = Array.isArray(s) ? Ln(s, (c) => c.test(a)) : (
630
- // [TODO] -- I challenge you to fix the type
631
- Jn(s, (c) => c.test(a))
632
- );
633
- let d;
634
- d = e.valueCallback ? e.valueCallback(i) : i, d = o.valueCallback ? (
635
- // [TODO] -- I challenge you to fix the type
636
- o.valueCallback(d)
637
- ) : d;
638
- const u = t.slice(a.length);
639
- return { value: d, rest: u };
640
- };
641
- }
642
- function Jn(e, t) {
643
- for (const o in e)
644
- if (Object.prototype.hasOwnProperty.call(e, o) && t(e[o]))
645
- return o;
646
- }
647
- function Ln(e, t) {
648
- for (let o = 0; o < e.length; o++)
649
- if (t(e[o]))
650
- return o;
651
- }
652
- function Xn(e) {
653
- return (t, o = {}) => {
654
- const n = t.match(e.matchPattern);
655
- if (!n) return null;
656
- const r = n[0], l = t.match(e.parsePattern);
657
- if (!l) return null;
658
- let a = e.valueCallback ? e.valueCallback(l[0]) : l[0];
659
- a = o.valueCallback ? o.valueCallback(a) : a;
660
- const s = t.slice(r.length);
661
- return { value: a, rest: s };
662
- };
663
- }
664
- const Qn = /^(\d+)(th|st|nd|rd)?/i, eo = /\d+/i, to = {
665
- narrow: /^(b|a)/i,
666
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
667
- wide: /^(before christ|before common era|anno domini|common era)/i
668
- }, no = {
669
- any: [/^b/i, /^(a|c)/i]
670
- }, oo = {
671
- narrow: /^[1234]/i,
672
- abbreviated: /^q[1234]/i,
673
- wide: /^[1234](th|st|nd|rd)? quarter/i
674
- }, ro = {
675
- any: [/1/i, /2/i, /3/i, /4/i]
676
- }, ao = {
677
- narrow: /^[jfmasond]/i,
678
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
679
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
680
- }, so = {
681
- narrow: [
682
- /^j/i,
683
- /^f/i,
684
- /^m/i,
685
- /^a/i,
686
- /^m/i,
687
- /^j/i,
688
- /^j/i,
689
- /^a/i,
690
- /^s/i,
691
- /^o/i,
692
- /^n/i,
693
- /^d/i
694
- ],
695
- any: [
696
- /^ja/i,
697
- /^f/i,
698
- /^mar/i,
699
- /^ap/i,
700
- /^may/i,
701
- /^jun/i,
702
- /^jul/i,
703
- /^au/i,
704
- /^s/i,
705
- /^o/i,
706
- /^n/i,
707
- /^d/i
708
- ]
709
- }, io = {
710
- narrow: /^[smtwf]/i,
711
- short: /^(su|mo|tu|we|th|fr|sa)/i,
712
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
713
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
714
- }, lo = {
715
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
716
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
717
- }, co = {
718
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
719
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
720
- }, fo = {
721
- any: {
722
- am: /^a/i,
723
- pm: /^p/i,
724
- midnight: /^mi/i,
725
- noon: /^no/i,
726
- morning: /morning/i,
727
- afternoon: /afternoon/i,
728
- evening: /evening/i,
729
- night: /night/i
730
- }
731
- }, uo = {
732
- ordinalNumber: Xn({
733
- matchPattern: Qn,
734
- parsePattern: eo,
735
- valueCallback: (e) => parseInt(e, 10)
736
- }),
737
- era: ae({
738
- matchPatterns: to,
739
- defaultMatchWidth: "wide",
740
- parsePatterns: no,
741
- defaultParseWidth: "any"
742
- }),
743
- quarter: ae({
744
- matchPatterns: oo,
745
- defaultMatchWidth: "wide",
746
- parsePatterns: ro,
747
- defaultParseWidth: "any",
748
- valueCallback: (e) => e + 1
749
- }),
750
- month: ae({
751
- matchPatterns: ao,
752
- defaultMatchWidth: "wide",
753
- parsePatterns: so,
754
- defaultParseWidth: "any"
755
- }),
756
- day: ae({
757
- matchPatterns: io,
758
- defaultMatchWidth: "wide",
759
- parsePatterns: lo,
760
- defaultParseWidth: "any"
761
- }),
762
- dayPeriod: ae({
763
- matchPatterns: co,
764
- defaultMatchWidth: "any",
765
- parsePatterns: fo,
766
- defaultParseWidth: "any"
767
- })
768
- }, Xe = {
769
- code: "en-US",
770
- formatDistance: Yn,
771
- formatLong: zn,
772
- formatRelative: qn,
773
- localize: Kn,
774
- match: uo,
775
- options: {
776
- weekStartsOn: 0,
777
- firstWeekContainsDate: 1
778
- }
779
- }, Ue = 5, ho = 4;
780
- function mo(e, t) {
781
- const o = t.startOfMonth(e), n = o.getDay() > 0 ? o.getDay() : 7, r = t.addDays(e, -n + 1), l = t.addDays(r, Ue * 7 - 1);
782
- return t.getMonth(e) === t.getMonth(l) ? Ue : ho;
783
- }
784
- function Qe(e, t) {
785
- const o = t.startOfMonth(e), n = o.getDay();
786
- return n === 1 ? o : n === 0 ? t.addDays(o, -6) : t.addDays(o, -1 * (n - 1));
787
- }
788
- function yo(e, t) {
789
- const o = Qe(e, t), n = mo(e, t);
790
- return t.addDays(o, n * 7 - 1);
791
- }
792
- class z {
793
- /**
794
- * Creates an instance of `DateLib`.
795
- *
796
- * @param options Configuration options for the date library.
797
- * @param overrides Custom overrides for the date library functions.
798
- */
799
- constructor(t, o) {
800
- this.Date = Date, this.today = () => this.overrides?.today ? this.overrides.today() : this.options.timeZone ? X.tz(this.options.timeZone) : new this.Date(), this.newDate = (n, r, l) => this.overrides?.newDate ? this.overrides.newDate(n, r, l) : this.options.timeZone ? new X(n, r, l, this.options.timeZone) : new Date(n, r, l), this.addDays = (n, r) => this.overrides?.addDays ? this.overrides.addDays(n, r) : Gt(n, r), this.addMonths = (n, r) => this.overrides?.addMonths ? this.overrides.addMonths(n, r) : Kt(n, r), this.addWeeks = (n, r) => this.overrides?.addWeeks ? this.overrides.addWeeks(n, r) : Jt(n, r), this.addYears = (n, r) => this.overrides?.addYears ? this.overrides.addYears(n, r) : Lt(n, r), this.differenceInCalendarDays = (n, r) => this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(n, r) : Xt(n, r), this.differenceInCalendarMonths = (n, r) => this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(n, r) : Qt(n, r), this.eachMonthOfInterval = (n) => this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(n) : en(n), this.eachYearOfInterval = (n) => {
801
- const r = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(n) : tn(n), l = new Set(r.map((s) => this.getYear(s)));
802
- if (l.size === r.length)
803
- return r;
804
- const a = [];
805
- return l.forEach((s) => {
806
- a.push(new Date(s, 0, 1));
807
- }), a;
808
- }, this.endOfBroadcastWeek = (n) => this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(n) : yo(n, this), this.endOfISOWeek = (n) => this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(n) : nn(n), this.endOfMonth = (n) => this.overrides?.endOfMonth ? this.overrides.endOfMonth(n) : on(n), this.endOfWeek = (n, r) => this.overrides?.endOfWeek ? this.overrides.endOfWeek(n, r) : rn(n, this.options), this.endOfYear = (n) => this.overrides?.endOfYear ? this.overrides.endOfYear(n) : an(n), this.format = (n, r, l) => {
809
- const a = this.overrides?.format ? this.overrides.format(n, r, this.options) : sn(n, r, this.options);
810
- return this.options.numerals && this.options.numerals !== "latn" ? this.replaceDigits(a) : a;
811
- }, this.getISOWeek = (n) => this.overrides?.getISOWeek ? this.overrides.getISOWeek(n) : ln(n), this.getMonth = (n, r) => this.overrides?.getMonth ? this.overrides.getMonth(n, this.options) : dn(n, this.options), this.getYear = (n, r) => this.overrides?.getYear ? this.overrides.getYear(n, this.options) : cn(n, this.options), this.getWeek = (n, r) => this.overrides?.getWeek ? this.overrides.getWeek(n, this.options) : fn(n, this.options), this.isAfter = (n, r) => this.overrides?.isAfter ? this.overrides.isAfter(n, r) : un(n, r), this.isBefore = (n, r) => this.overrides?.isBefore ? this.overrides.isBefore(n, r) : hn(n, r), this.isDate = (n) => this.overrides?.isDate ? this.overrides.isDate(n) : mn(n), this.isSameDay = (n, r) => this.overrides?.isSameDay ? this.overrides.isSameDay(n, r) : yn(n, r), this.isSameMonth = (n, r) => this.overrides?.isSameMonth ? this.overrides.isSameMonth(n, r) : pn(n, r), this.isSameYear = (n, r) => this.overrides?.isSameYear ? this.overrides.isSameYear(n, r) : gn(n, r), this.max = (n) => this.overrides?.max ? this.overrides.max(n) : bn(n), this.min = (n) => this.overrides?.min ? this.overrides.min(n) : vn(n), this.setMonth = (n, r) => this.overrides?.setMonth ? this.overrides.setMonth(n, r) : kn(n, r), this.setYear = (n, r) => this.overrides?.setYear ? this.overrides.setYear(n, r) : Mn(n, r), this.startOfBroadcastWeek = (n, r) => this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(n, this) : Qe(n, this), this.startOfDay = (n) => this.overrides?.startOfDay ? this.overrides.startOfDay(n) : wn(n), this.startOfISOWeek = (n) => this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(n) : Dn(n), this.startOfMonth = (n) => this.overrides?.startOfMonth ? this.overrides.startOfMonth(n) : On(n), this.startOfWeek = (n, r) => this.overrides?.startOfWeek ? this.overrides.startOfWeek(n, this.options) : Wn(n, this.options), this.startOfYear = (n) => this.overrides?.startOfYear ? this.overrides.startOfYear(n) : Cn(n), this.options = { locale: Xe, ...t }, this.overrides = o;
812
- }
813
- /**
814
- * Generates a mapping of Arabic digits (0-9) to the target numbering system
815
- * digits.
816
- *
817
- * @since 9.5.0
818
- * @returns A record mapping Arabic digits to the target numerals.
819
- */
820
- getDigitMap() {
821
- const { numerals: t = "latn" } = this.options, o = new Intl.NumberFormat("en-US", {
822
- numberingSystem: t
823
- }), n = {};
824
- for (let r = 0; r < 10; r++)
825
- n[r.toString()] = o.format(r);
826
- return n;
827
- }
828
- /**
829
- * Replaces Arabic digits in a string with the target numbering system digits.
830
- *
831
- * @since 9.5.0
832
- * @param input The string containing Arabic digits.
833
- * @returns The string with digits replaced.
834
- */
835
- replaceDigits(t) {
836
- const o = this.getDigitMap();
837
- return t.replace(/\d/g, (n) => o[n] || n);
838
- }
839
- /**
840
- * Formats a number using the configured numbering system.
841
- *
842
- * @since 9.5.0
843
- * @param value The number to format.
844
- * @returns The formatted number as a string.
845
- */
846
- formatNumber(t) {
847
- return this.replaceDigits(t.toString());
848
- }
849
- /**
850
- * Returns the preferred ordering for month and year labels for the current
851
- * locale.
852
- */
853
- getMonthYearOrder() {
854
- const t = this.options.locale?.code;
855
- return t && z.yearFirstLocales.has(t) ? "year-first" : "month-first";
856
- }
857
- /**
858
- * Formats the month/year pair respecting locale conventions.
859
- *
860
- * @since 9.11.0
861
- */
862
- formatMonthYear(t) {
863
- const { locale: o, timeZone: n, numerals: r } = this.options, l = o?.code;
864
- if (l && z.yearFirstLocales.has(l))
865
- try {
866
- return new Intl.DateTimeFormat(l, {
867
- month: "long",
868
- year: "numeric",
869
- timeZone: n,
870
- numberingSystem: r
871
- }).format(t);
872
- } catch {
873
- }
874
- const a = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
875
- return this.format(t, a);
876
- }
877
- }
878
- z.yearFirstLocales = /* @__PURE__ */ new Set([
879
- "eu",
880
- "hu",
881
- "ja",
882
- "ja-Hira",
883
- "ja-JP",
884
- "ko",
885
- "ko-KR",
886
- "lt",
887
- "lt-LT",
888
- "lv",
889
- "lv-LV",
890
- "mn",
891
- "mn-MN",
892
- "zh",
893
- "zh-CN",
894
- "zh-HK",
895
- "zh-TW"
896
- ]);
897
- const K = new z();
898
- class et {
899
- constructor(t, o, n = K) {
900
- this.date = t, this.displayMonth = o, this.outside = !!(o && !n.isSameMonth(t, o)), this.dateLib = n, this.isoDate = n.format(t, "yyyy-MM-dd"), this.displayMonthId = n.format(o, "yyyy-MM"), this.dateMonthId = n.format(t, "yyyy-MM");
901
- }
902
- /**
903
- * Checks if this day is equal to another `CalendarDay`, considering both the
904
- * date and the displayed month.
905
- *
906
- * @param day The `CalendarDay` to compare with.
907
- * @returns `true` if the days are equal, otherwise `false`.
908
- */
909
- isEqualTo(t) {
910
- return this.dateLib.isSameDay(t.date, this.date) && this.dateLib.isSameMonth(t.displayMonth, this.displayMonth);
911
- }
912
- }
913
- class po {
914
- constructor(t, o) {
915
- this.date = t, this.weeks = o;
916
- }
917
- }
918
- class go {
919
- constructor(t, o) {
920
- this.days = o, this.weekNumber = t;
921
- }
922
- }
923
- function bo(e) {
924
- return f.createElement("button", { ...e });
925
- }
926
- function vo(e) {
927
- return f.createElement("span", { ...e });
928
- }
929
- function ko(e) {
930
- const { size: t = 24, orientation: o = "left", className: n } = e;
931
- return (
932
- // biome-ignore lint/a11y/noSvgWithoutTitle: handled by the parent component
933
- f.createElement(
934
- "svg",
935
- { className: n, width: t, height: t, viewBox: "0 0 24 24" },
936
- o === "up" && f.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
937
- o === "down" && f.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
938
- o === "left" && f.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
939
- o === "right" && f.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" })
940
- )
941
- );
942
- }
943
- function Mo(e) {
944
- const { day: t, modifiers: o, ...n } = e;
945
- return f.createElement("td", { ...n });
946
- }
947
- function wo(e) {
948
- const { day: t, modifiers: o, ...n } = e, r = f.useRef(null);
949
- return f.useEffect(() => {
950
- o.focused && r.current?.focus();
951
- }, [o.focused]), f.createElement("button", { ref: r, ...n });
952
- }
953
- var y;
954
- (function(e) {
955
- e.Root = "root", e.Chevron = "chevron", e.Day = "day", e.DayButton = "day_button", e.CaptionLabel = "caption_label", e.Dropdowns = "dropdowns", e.Dropdown = "dropdown", e.DropdownRoot = "dropdown_root", e.Footer = "footer", e.MonthGrid = "month_grid", e.MonthCaption = "month_caption", e.MonthsDropdown = "months_dropdown", e.Month = "month", e.Months = "months", e.Nav = "nav", e.NextMonthButton = "button_next", e.PreviousMonthButton = "button_previous", e.Week = "week", e.Weeks = "weeks", e.Weekday = "weekday", e.Weekdays = "weekdays", e.WeekNumber = "week_number", e.WeekNumberHeader = "week_number_header", e.YearsDropdown = "years_dropdown";
956
- })(y || (y = {}));
957
- var P;
958
- (function(e) {
959
- e.disabled = "disabled", e.hidden = "hidden", e.outside = "outside", e.focused = "focused", e.today = "today";
960
- })(P || (P = {}));
961
- var R;
962
- (function(e) {
963
- e.range_end = "range_end", e.range_middle = "range_middle", e.range_start = "range_start", e.selected = "selected";
964
- })(R || (R = {}));
965
- var A;
966
- (function(e) {
967
- e.weeks_before_enter = "weeks_before_enter", e.weeks_before_exit = "weeks_before_exit", e.weeks_after_enter = "weeks_after_enter", e.weeks_after_exit = "weeks_after_exit", e.caption_after_enter = "caption_after_enter", e.caption_after_exit = "caption_after_exit", e.caption_before_enter = "caption_before_enter", e.caption_before_exit = "caption_before_exit";
968
- })(A || (A = {}));
969
- function Do(e) {
970
- const { options: t, className: o, components: n, classNames: r, ...l } = e, a = [r[y.Dropdown], o].join(" "), s = t?.find(({ value: i }) => i === l.value);
971
- return f.createElement(
972
- "span",
973
- { "data-disabled": l.disabled, className: r[y.DropdownRoot] },
974
- f.createElement(n.Select, { className: a, ...l }, t?.map(({ value: i, label: d, disabled: u }) => f.createElement(n.Option, { key: i, value: i, disabled: u }, d))),
975
- f.createElement(
976
- "span",
977
- { className: r[y.CaptionLabel], "aria-hidden": !0 },
978
- s?.label,
979
- f.createElement(n.Chevron, { orientation: "down", size: 18, className: r[y.Chevron] })
980
- )
981
- );
982
- }
983
- function Oo(e) {
984
- return f.createElement("div", { ...e });
985
- }
986
- function Wo(e) {
987
- return f.createElement("div", { ...e });
988
- }
989
- function Co(e) {
990
- const { calendarMonth: t, displayIndex: o, ...n } = e;
991
- return f.createElement("div", { ...n }, e.children);
992
- }
993
- function So(e) {
994
- const { calendarMonth: t, displayIndex: o, ...n } = e;
995
- return f.createElement("div", { ...n });
996
- }
997
- function No(e) {
998
- return f.createElement("table", { ...e });
999
- }
1000
- function xo(e) {
1001
- return f.createElement("div", { ...e });
1002
- }
1003
- const tt = It(void 0);
1004
- function le() {
1005
- const e = At(tt);
1006
- if (e === void 0)
1007
- throw new Error("useDayPicker() must be used within a custom component.");
1008
- return e;
1009
- }
1010
- function _o(e) {
1011
- const { components: t } = le();
1012
- return f.createElement(t.Dropdown, { ...e });
1013
- }
1014
- function To(e) {
1015
- const { onPreviousClick: t, onNextClick: o, previousMonth: n, nextMonth: r, ...l } = e, { components: a, classNames: s, labels: { labelPrevious: i, labelNext: d } } = le(), u = q((h) => {
1016
- r && o?.(h);
1017
- }, [r, o]), c = q((h) => {
1018
- n && t?.(h);
1019
- }, [n, t]);
1020
- return f.createElement(
1021
- "nav",
1022
- { ...l },
1023
- f.createElement(
1024
- a.PreviousMonthButton,
1025
- { type: "button", className: s[y.PreviousMonthButton], tabIndex: n ? void 0 : -1, "aria-disabled": n ? void 0 : !0, "aria-label": i(n), onClick: c },
1026
- f.createElement(a.Chevron, { disabled: n ? void 0 : !0, className: s[y.Chevron], orientation: "left" })
1027
- ),
1028
- f.createElement(
1029
- a.NextMonthButton,
1030
- { type: "button", className: s[y.NextMonthButton], tabIndex: r ? void 0 : -1, "aria-disabled": r ? void 0 : !0, "aria-label": d(r), onClick: u },
1031
- f.createElement(a.Chevron, { disabled: r ? void 0 : !0, orientation: "right", className: s[y.Chevron] })
1032
- )
1033
- );
1034
- }
1035
- function Eo(e) {
1036
- const { components: t } = le();
1037
- return f.createElement(t.Button, { ...e });
1038
- }
1039
- function Po(e) {
1040
- return f.createElement("option", { ...e });
1041
- }
1042
- function Bo(e) {
1043
- const { components: t } = le();
1044
- return f.createElement(t.Button, { ...e });
1045
- }
1046
- function Yo(e) {
1047
- const { rootRef: t, ...o } = e;
1048
- return f.createElement("div", { ...o, ref: t });
1049
- }
1050
- function Fo(e) {
1051
- return f.createElement("select", { ...e });
1052
- }
1053
- function Io(e) {
1054
- const { week: t, ...o } = e;
1055
- return f.createElement("tr", { ...o });
1056
- }
1057
- function Ao(e) {
1058
- return f.createElement("th", { ...e });
1059
- }
1060
- function zo(e) {
1061
- return f.createElement(
1062
- "thead",
1063
- { "aria-hidden": !0 },
1064
- f.createElement("tr", { ...e })
1065
- );
1066
- }
1067
- function jo(e) {
1068
- const { week: t, ...o } = e;
1069
- return f.createElement("th", { ...o });
1070
- }
1071
- function qo(e) {
1072
- return f.createElement("th", { ...e });
1073
- }
1074
- function Ho(e) {
1075
- return f.createElement("tbody", { ...e });
1076
- }
1077
- function $o(e) {
1078
- const { components: t } = le();
1079
- return f.createElement(t.Dropdown, { ...e });
1080
- }
1081
- const Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1082
- __proto__: null,
1083
- Button: bo,
1084
- CaptionLabel: vo,
1085
- Chevron: ko,
1086
- Day: Mo,
1087
- DayButton: wo,
1088
- Dropdown: Do,
1089
- DropdownNav: Oo,
1090
- Footer: Wo,
1091
- Month: Co,
1092
- MonthCaption: So,
1093
- MonthGrid: No,
1094
- Months: xo,
1095
- MonthsDropdown: _o,
1096
- Nav: To,
1097
- NextMonthButton: Eo,
1098
- Option: Po,
1099
- PreviousMonthButton: Bo,
1100
- Root: Yo,
1101
- Select: Fo,
1102
- Week: Io,
1103
- WeekNumber: jo,
1104
- WeekNumberHeader: qo,
1105
- Weekday: Ao,
1106
- Weekdays: zo,
1107
- Weeks: Ho,
1108
- YearsDropdown: $o
1109
- }, Symbol.toStringTag, { value: "Module" }));
1110
- function Q(e, t, o = !1, n = K) {
1111
- let { from: r, to: l } = e;
1112
- const { differenceInCalendarDays: a, isSameDay: s } = n;
1113
- return r && l ? (a(l, r) < 0 && ([r, l] = [l, r]), a(t, r) >= (o ? 1 : 0) && a(l, t) >= (o ? 1 : 0)) : !o && l ? s(l, t) : !o && r ? s(r, t) : !1;
1114
- }
1115
- function Ee(e) {
1116
- return !!(e && typeof e == "object" && "before" in e && "after" in e);
1117
- }
1118
- function me(e) {
1119
- return !!(e && typeof e == "object" && "from" in e);
1120
- }
1121
- function Pe(e) {
1122
- return !!(e && typeof e == "object" && "after" in e);
1123
- }
1124
- function Be(e) {
1125
- return !!(e && typeof e == "object" && "before" in e);
1126
- }
1127
- function nt(e) {
1128
- return !!(e && typeof e == "object" && "dayOfWeek" in e);
1129
- }
1130
- function ot(e, t) {
1131
- return Array.isArray(e) && e.every(t.isDate);
1132
- }
1133
- function ee(e, t, o = K) {
1134
- const n = Array.isArray(t) ? t : [t], { isSameDay: r, differenceInCalendarDays: l, isAfter: a } = o;
1135
- return n.some((s) => {
1136
- if (typeof s == "boolean")
1137
- return s;
1138
- if (o.isDate(s))
1139
- return r(e, s);
1140
- if (ot(s, o))
1141
- return s.includes(e);
1142
- if (me(s))
1143
- return Q(s, e, !1, o);
1144
- if (nt(s))
1145
- return Array.isArray(s.dayOfWeek) ? s.dayOfWeek.includes(e.getDay()) : s.dayOfWeek === e.getDay();
1146
- if (Ee(s)) {
1147
- const i = l(s.before, e), d = l(s.after, e), u = i > 0, c = d < 0;
1148
- return a(s.before, s.after) ? c && u : u || c;
1149
- }
1150
- return Pe(s) ? l(e, s.after) > 0 : Be(s) ? l(s.before, e) > 0 : typeof s == "function" ? s(e) : !1;
1151
- });
1152
- }
1153
- function Zo(e, t, o, n, r) {
1154
- const { disabled: l, hidden: a, modifiers: s, showOutsideDays: i, broadcastCalendar: d, today: u = r.today() } = t, { isSameDay: c, isSameMonth: h, startOfMonth: g, isBefore: O, endOfMonth: N, isAfter: k } = r, W = o && g(o), x = n && N(n), v = {
1155
- [P.focused]: [],
1156
- [P.outside]: [],
1157
- [P.disabled]: [],
1158
- [P.hidden]: [],
1159
- [P.today]: []
1160
- }, D = {};
1161
- for (const p of e) {
1162
- const { date: m, displayMonth: C } = p, E = !!(C && !h(m, C)), F = !!(W && O(m, W)), B = !!(x && k(m, x)), Z = !!(l && ee(m, l, r)), te = !!(a && ee(m, a, r)) || F || B || // Broadcast calendar will show outside days as default
1163
- !d && !i && E || d && i === !1 && E, J = c(m, u);
1164
- E && v.outside.push(p), Z && v.disabled.push(p), te && v.hidden.push(p), J && v.today.push(p), s && Object.keys(s).forEach((j) => {
1165
- const oe = s?.[j];
1166
- oe && ee(m, oe, r) && (D[j] ? D[j].push(p) : D[j] = [p]);
1167
- });
1168
- }
1169
- return (p) => {
1170
- const m = {
1171
- [P.focused]: !1,
1172
- [P.disabled]: !1,
1173
- [P.hidden]: !1,
1174
- [P.outside]: !1,
1175
- [P.today]: !1
1176
- }, C = {};
1177
- for (const E in v) {
1178
- const F = v[E];
1179
- m[E] = F.some((B) => B === p);
1180
- }
1181
- for (const E in D)
1182
- C[E] = D[E].some((F) => F === p);
1183
- return {
1184
- ...m,
1185
- // custom modifiers should override all the previous ones
1186
- ...C
1187
- };
1188
- };
1189
- }
1190
- function Uo(e, t, o = {}) {
1191
- return Object.entries(e).filter(([, r]) => r === !0).reduce((r, [l]) => (o[l] ? r.push(o[l]) : t[P[l]] ? r.push(t[P[l]]) : t[R[l]] && r.push(t[R[l]]), r), [t[y.Day]]);
1192
- }
1193
- function Vo(e) {
1194
- return {
1195
- ...Ro,
1196
- ...e
1197
- };
1198
- }
1199
- function Go(e) {
1200
- const t = {
1201
- "data-mode": e.mode ?? void 0,
1202
- "data-required": "required" in e ? e.required : void 0,
1203
- "data-multiple-months": e.numberOfMonths && e.numberOfMonths > 1 || void 0,
1204
- "data-week-numbers": e.showWeekNumber || void 0,
1205
- "data-broadcast-calendar": e.broadcastCalendar || void 0,
1206
- "data-nav-layout": e.navLayout || void 0
1207
- };
1208
- return Object.entries(e).forEach(([o, n]) => {
1209
- o.startsWith("data-") && (t[o] = n);
1210
- }), t;
1211
- }
1212
- function Ye() {
1213
- const e = {};
1214
- for (const t in y)
1215
- e[y[t]] = `rdp-${y[t]}`;
1216
- for (const t in P)
1217
- e[P[t]] = `rdp-${P[t]}`;
1218
- for (const t in R)
1219
- e[R[t]] = `rdp-${R[t]}`;
1220
- for (const t in A)
1221
- e[A[t]] = `rdp-${A[t]}`;
1222
- return e;
1223
- }
1224
- function rt(e, t, o) {
1225
- return (o ?? new z(t)).formatMonthYear(e);
1226
- }
1227
- const Ko = rt;
1228
- function Jo(e, t, o) {
1229
- return (o ?? new z(t)).format(e, "d");
1230
- }
1231
- function Lo(e, t = K) {
1232
- return t.format(e, "LLLL");
1233
- }
1234
- function Xo(e, t, o) {
1235
- return (o ?? new z(t)).format(e, "cccccc");
1236
- }
1237
- function Qo(e, t = K) {
1238
- return e < 10 ? t.formatNumber(`0${e.toLocaleString()}`) : t.formatNumber(`${e.toLocaleString()}`);
1239
- }
1240
- function er() {
1241
- return "";
1242
- }
1243
- function at(e, t = K) {
1244
- return t.format(e, "yyyy");
1245
- }
1246
- const tr = at, nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1247
- __proto__: null,
1248
- formatCaption: rt,
1249
- formatDay: Jo,
1250
- formatMonthCaption: Ko,
1251
- formatMonthDropdown: Lo,
1252
- formatWeekNumber: Qo,
1253
- formatWeekNumberHeader: er,
1254
- formatWeekdayName: Xo,
1255
- formatYearCaption: tr,
1256
- formatYearDropdown: at
1257
- }, Symbol.toStringTag, { value: "Module" }));
1258
- function or(e) {
1259
- return e?.formatMonthCaption && !e.formatCaption && (e.formatCaption = e.formatMonthCaption), e?.formatYearCaption && !e.formatYearDropdown && (e.formatYearDropdown = e.formatYearCaption), {
1260
- ...nr,
1261
- ...e
1262
- };
1263
- }
1264
- function rr(e, t, o, n, r) {
1265
- const { startOfMonth: l, startOfYear: a, endOfYear: s, eachMonthOfInterval: i, getMonth: d } = r;
1266
- return i({
1267
- start: a(e),
1268
- end: s(e)
1269
- }).map((h) => {
1270
- const g = n.formatMonthDropdown(h, r), O = d(h), N = t && h < l(t) || o && h > l(o) || !1;
1271
- return { value: O, label: g, disabled: N };
1272
- });
1273
- }
1274
- function ar(e, t = {}, o = {}) {
1275
- let n = { ...t?.[y.Day] };
1276
- return Object.entries(e).filter(([, r]) => r === !0).forEach(([r]) => {
1277
- n = {
1278
- ...n,
1279
- ...o?.[r]
1280
- };
1281
- }), n;
1282
- }
1283
- function sr(e, t, o, n) {
1284
- const r = n ?? e.today(), l = o ? e.startOfBroadcastWeek(r, e) : t ? e.startOfISOWeek(r) : e.startOfWeek(r), a = [];
1285
- for (let s = 0; s < 7; s++) {
1286
- const i = e.addDays(l, s);
1287
- a.push(i);
1288
- }
1289
- return a;
1290
- }
1291
- function ir(e, t, o, n, r = !1) {
1292
- if (!e || !t)
1293
- return;
1294
- const { startOfYear: l, endOfYear: a, eachYearOfInterval: s, getYear: i } = n, d = l(e), u = a(t), c = s({ start: d, end: u });
1295
- return r && c.reverse(), c.map((h) => {
1296
- const g = o.formatYearDropdown(h, n);
1297
- return {
1298
- value: i(h),
1299
- label: g,
1300
- disabled: !1
1301
- };
1302
- });
1303
- }
1304
- function st(e, t, o, n) {
1305
- let r = (n ?? new z(o)).format(e, "PPPP");
1306
- return t.today && (r = `Today, ${r}`), t.selected && (r = `${r}, selected`), r;
1307
- }
1308
- const lr = st;
1309
- function it(e, t, o) {
1310
- return (o ?? new z(t)).formatMonthYear(e);
1311
- }
1312
- const dr = it;
1313
- function cr(e, t, o, n) {
1314
- let r = (n ?? new z(o)).format(e, "PPPP");
1315
- return t?.today && (r = `Today, ${r}`), r;
1316
- }
1317
- function fr(e) {
1318
- return "Choose the Month";
1319
- }
1320
- function ur() {
1321
- return "";
1322
- }
1323
- function hr(e) {
1324
- return "Go to the Next Month";
1325
- }
1326
- function mr(e) {
1327
- return "Go to the Previous Month";
1328
- }
1329
- function yr(e, t, o) {
1330
- return (o ?? new z(t)).format(e, "cccc");
1331
- }
1332
- function pr(e, t) {
1333
- return `Week ${e}`;
1334
- }
1335
- function gr(e) {
1336
- return "Week Number";
1337
- }
1338
- function br(e) {
1339
- return "Choose the Year";
1340
- }
1341
- const vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1342
- __proto__: null,
1343
- labelCaption: dr,
1344
- labelDay: lr,
1345
- labelDayButton: st,
1346
- labelGrid: it,
1347
- labelGridcell: cr,
1348
- labelMonthDropdown: fr,
1349
- labelNav: ur,
1350
- labelNext: hr,
1351
- labelPrevious: mr,
1352
- labelWeekNumber: pr,
1353
- labelWeekNumberHeader: gr,
1354
- labelWeekday: yr,
1355
- labelYearDropdown: br
1356
- }, Symbol.toStringTag, { value: "Module" })), de = (e) => e instanceof HTMLElement ? e : null, Ce = (e) => [
1357
- ...e.querySelectorAll("[data-animated-month]") ?? []
1358
- ], kr = (e) => de(e.querySelector("[data-animated-month]")), Se = (e) => de(e.querySelector("[data-animated-caption]")), Ne = (e) => de(e.querySelector("[data-animated-weeks]")), Mr = (e) => de(e.querySelector("[data-animated-nav]")), wr = (e) => de(e.querySelector("[data-animated-weekdays]"));
1359
- function Dr(e, t, { classNames: o, months: n, focused: r, dateLib: l }) {
1360
- const a = he(null), s = he(n), i = he(!1);
1361
- zt(() => {
1362
- const d = s.current;
1363
- if (s.current = n, !t || !e.current || // safety check because the ref can be set to anything by consumers
1364
- !(e.current instanceof HTMLElement) || // validation required for the animation to work as expected
1365
- n.length === 0 || d.length === 0 || n.length !== d.length)
1366
- return;
1367
- const u = l.isSameMonth(n[0].date, d[0].date), c = l.isAfter(n[0].date, d[0].date), h = c ? o[A.caption_after_enter] : o[A.caption_before_enter], g = c ? o[A.weeks_after_enter] : o[A.weeks_before_enter], O = a.current, N = e.current.cloneNode(!0);
1368
- if (N instanceof HTMLElement ? (Ce(N).forEach((v) => {
1369
- if (!(v instanceof HTMLElement))
1370
- return;
1371
- const D = kr(v);
1372
- D && v.contains(D) && v.removeChild(D);
1373
- const p = Se(v);
1374
- p && p.classList.remove(h);
1375
- const m = Ne(v);
1376
- m && m.classList.remove(g);
1377
- }), a.current = N) : a.current = null, i.current || u || // skip animation if a day is focused because it can cause issues to the animation and is better for a11y
1378
- r)
1379
- return;
1380
- const k = O instanceof HTMLElement ? Ce(O) : [], W = Ce(e.current);
1381
- if (W?.every((x) => x instanceof HTMLElement) && k && k.every((x) => x instanceof HTMLElement)) {
1382
- i.current = !0, e.current.style.isolation = "isolate";
1383
- const x = Mr(e.current);
1384
- x && (x.style.zIndex = "1"), W.forEach((v, D) => {
1385
- const p = k[D];
1386
- if (!p)
1387
- return;
1388
- v.style.position = "relative", v.style.overflow = "hidden";
1389
- const m = Se(v);
1390
- m && m.classList.add(h);
1391
- const C = Ne(v);
1392
- C && C.classList.add(g);
1393
- const E = () => {
1394
- i.current = !1, e.current && (e.current.style.isolation = ""), x && (x.style.zIndex = ""), m && m.classList.remove(h), C && C.classList.remove(g), v.style.position = "", v.style.overflow = "", v.contains(p) && v.removeChild(p);
1395
- };
1396
- p.style.pointerEvents = "none", p.style.position = "absolute", p.style.overflow = "hidden", p.setAttribute("aria-hidden", "true");
1397
- const F = wr(p);
1398
- F && (F.style.opacity = "0");
1399
- const B = Se(p);
1400
- B && (B.classList.add(c ? o[A.caption_before_exit] : o[A.caption_after_exit]), B.addEventListener("animationend", E));
1401
- const Z = Ne(p);
1402
- Z && Z.classList.add(c ? o[A.weeks_before_exit] : o[A.weeks_after_exit]), v.insertBefore(p, v.firstChild);
1403
- });
1404
- }
1405
- });
1406
- }
1407
- function Or(e, t, o, n) {
1408
- const r = e[0], l = e[e.length - 1], { ISOWeek: a, fixedWeeks: s, broadcastCalendar: i } = o ?? {}, { addDays: d, differenceInCalendarDays: u, differenceInCalendarMonths: c, endOfBroadcastWeek: h, endOfISOWeek: g, endOfMonth: O, endOfWeek: N, isAfter: k, startOfBroadcastWeek: W, startOfISOWeek: x, startOfWeek: v } = n, D = i ? W(r, n) : a ? x(r) : v(r), p = i ? h(l) : a ? g(O(l)) : N(O(l)), m = t && (i ? h(t) : a ? g(t) : N(t)), C = m && k(p, m) ? m : p, E = u(C, D), F = c(l, r) + 1, B = [];
1409
- for (let J = 0; J <= E; J++) {
1410
- const j = d(D, J);
1411
- B.push(j);
1412
- }
1413
- const te = (i ? 35 : 42) * F;
1414
- if (s && B.length < te) {
1415
- const J = te - B.length;
1416
- for (let j = 0; j < J; j++) {
1417
- const oe = d(B[B.length - 1], 1);
1418
- B.push(oe);
1419
- }
1420
- }
1421
- return B;
1422
- }
1423
- function Wr(e) {
1424
- const t = [];
1425
- return e.reduce((o, n) => {
1426
- const r = n.weeks.reduce((l, a) => l.concat(a.days.slice()), t.slice());
1427
- return o.concat(r.slice());
1428
- }, t.slice());
1429
- }
1430
- function Cr(e, t, o, n) {
1431
- const { numberOfMonths: r = 1 } = o, l = [];
1432
- for (let a = 0; a < r; a++) {
1433
- const s = n.addMonths(e, a);
1434
- if (t && s > t)
1435
- break;
1436
- l.push(s);
1437
- }
1438
- return l;
1439
- }
1440
- function Ve(e, t, o, n) {
1441
- const { month: r, defaultMonth: l, today: a = n.today(), numberOfMonths: s = 1 } = e;
1442
- let i = r || l || a;
1443
- const { differenceInCalendarMonths: d, addMonths: u, startOfMonth: c } = n;
1444
- if (o && d(o, i) < s - 1) {
1445
- const h = -1 * (s - 1);
1446
- i = u(o, h);
1447
- }
1448
- return t && d(i, t) < 0 && (i = t), c(i);
1449
- }
1450
- function Sr(e, t, o, n) {
1451
- const { addDays: r, endOfBroadcastWeek: l, endOfISOWeek: a, endOfMonth: s, endOfWeek: i, getISOWeek: d, getWeek: u, startOfBroadcastWeek: c, startOfISOWeek: h, startOfWeek: g } = n, O = e.reduce((N, k) => {
1452
- const W = o.broadcastCalendar ? c(k, n) : o.ISOWeek ? h(k) : g(k), x = o.broadcastCalendar ? l(k) : o.ISOWeek ? a(s(k)) : i(s(k)), v = t.filter((C) => C >= W && C <= x), D = o.broadcastCalendar ? 35 : 42;
1453
- if (o.fixedWeeks && v.length < D) {
1454
- const C = t.filter((E) => {
1455
- const F = D - v.length;
1456
- return E > x && E <= r(x, F);
1457
- });
1458
- v.push(...C);
1459
- }
1460
- const p = v.reduce((C, E) => {
1461
- const F = o.ISOWeek ? d(E) : u(E), B = C.find((te) => te.weekNumber === F), Z = new et(E, k, n);
1462
- return B ? B.days.push(Z) : C.push(new go(F, [Z])), C;
1463
- }, []), m = new po(k, p);
1464
- return N.push(m), N;
1465
- }, []);
1466
- return o.reverseMonths ? O.reverse() : O;
1467
- }
1468
- function Nr(e, t) {
1469
- let { startMonth: o, endMonth: n } = e;
1470
- const { startOfYear: r, startOfDay: l, startOfMonth: a, endOfMonth: s, addYears: i, endOfYear: d, newDate: u, today: c } = t, { fromYear: h, toYear: g, fromMonth: O, toMonth: N } = e;
1471
- !o && O && (o = O), !o && h && (o = t.newDate(h, 0, 1)), !n && N && (n = N), !n && g && (n = u(g, 11, 31));
1472
- const k = e.captionLayout === "dropdown" || e.captionLayout === "dropdown-years";
1473
- return o ? o = a(o) : h ? o = u(h, 0, 1) : !o && k && (o = r(i(e.today ?? c(), -100))), n ? n = s(n) : g ? n = u(g, 11, 31) : !n && k && (n = d(e.today ?? c())), [
1474
- o && l(o),
1475
- n && l(n)
1476
- ];
1477
- }
1478
- function xr(e, t, o, n) {
1479
- if (o.disableNavigation)
1480
- return;
1481
- const { pagedNavigation: r, numberOfMonths: l = 1 } = o, { startOfMonth: a, addMonths: s, differenceInCalendarMonths: i } = n, d = r ? l : 1, u = a(e);
1482
- if (!t)
1483
- return s(u, d);
1484
- if (!(i(t, e) < l))
1485
- return s(u, d);
1486
- }
1487
- function _r(e, t, o, n) {
1488
- if (o.disableNavigation)
1489
- return;
1490
- const { pagedNavigation: r, numberOfMonths: l } = o, { startOfMonth: a, addMonths: s, differenceInCalendarMonths: i } = n, d = r ? l ?? 1 : 1, u = a(e);
1491
- if (!t)
1492
- return s(u, -d);
1493
- if (!(i(u, t) <= 0))
1494
- return s(u, -d);
1495
- }
1496
- function Tr(e) {
1497
- const t = [];
1498
- return e.reduce((o, n) => o.concat(n.weeks.slice()), t.slice());
1499
- }
1500
- function ye(e, t) {
1501
- const [o, n] = _e(e);
1502
- return [t === void 0 ? o : t, n];
1503
- }
1504
- function Er(e, t) {
1505
- const [o, n] = Nr(e, t), { startOfMonth: r, endOfMonth: l } = t, a = Ve(e, o, n, t), [s, i] = ye(
1506
- a,
1507
- // initialMonth is always computed from props.month if provided
1508
- e.month ? a : void 0
1509
- );
1510
- jt(() => {
1511
- const D = Ve(e, o, n, t);
1512
- i(D);
1513
- }, [e.timeZone]);
1514
- const { months: d, weeks: u, days: c, previousMonth: h, nextMonth: g } = ie(() => {
1515
- const D = Cr(s, n, { numberOfMonths: e.numberOfMonths }, t), p = Or(D, e.endMonth ? l(e.endMonth) : void 0, {
1516
- ISOWeek: e.ISOWeek,
1517
- fixedWeeks: e.fixedWeeks,
1518
- broadcastCalendar: e.broadcastCalendar
1519
- }, t), m = Sr(D, p, {
1520
- broadcastCalendar: e.broadcastCalendar,
1521
- fixedWeeks: e.fixedWeeks,
1522
- ISOWeek: e.ISOWeek,
1523
- reverseMonths: e.reverseMonths
1524
- }, t), C = Tr(m), E = Wr(m), F = _r(s, o, e, t), B = xr(s, n, e, t);
1525
- return {
1526
- months: m,
1527
- weeks: C,
1528
- days: E,
1529
- previousMonth: F,
1530
- nextMonth: B
1531
- };
1532
- }, [
1533
- t,
1534
- s.getTime(),
1535
- n?.getTime(),
1536
- o?.getTime(),
1537
- e.disableNavigation,
1538
- e.broadcastCalendar,
1539
- e.endMonth?.getTime(),
1540
- e.fixedWeeks,
1541
- e.ISOWeek,
1542
- e.numberOfMonths,
1543
- e.pagedNavigation,
1544
- e.reverseMonths
1545
- ]), { disableNavigation: O, onMonthChange: N } = e, k = (D) => u.some((p) => p.days.some((m) => m.isEqualTo(D))), W = (D) => {
1546
- if (O)
1547
- return;
1548
- let p = r(D);
1549
- o && p < r(o) && (p = r(o)), n && p > r(n) && (p = r(n)), i(p), N?.(p);
1550
- };
1551
- return {
1552
- months: d,
1553
- weeks: u,
1554
- days: c,
1555
- navStart: o,
1556
- navEnd: n,
1557
- previousMonth: h,
1558
- nextMonth: g,
1559
- goToMonth: W,
1560
- goToDay: (D) => {
1561
- k(D) || W(D.date);
1562
- }
1563
- };
1564
- }
1565
- var V;
1566
- (function(e) {
1567
- e[e.Today = 0] = "Today", e[e.Selected = 1] = "Selected", e[e.LastFocused = 2] = "LastFocused", e[e.FocusedModifier = 3] = "FocusedModifier";
1568
- })(V || (V = {}));
1569
- function Ge(e) {
1570
- return !e[P.disabled] && !e[P.hidden] && !e[P.outside];
1571
- }
1572
- function Pr(e, t, o, n) {
1573
- let r, l = -1;
1574
- for (const a of e) {
1575
- const s = t(a);
1576
- Ge(s) && (s[P.focused] && l < V.FocusedModifier ? (r = a, l = V.FocusedModifier) : n?.isEqualTo(a) && l < V.LastFocused ? (r = a, l = V.LastFocused) : o(a.date) && l < V.Selected ? (r = a, l = V.Selected) : s[P.today] && l < V.Today && (r = a, l = V.Today));
1577
- }
1578
- return r || (r = e.find((a) => Ge(t(a)))), r;
1579
- }
1580
- function Br(e, t, o, n, r, l, a) {
1581
- const { ISOWeek: s, broadcastCalendar: i } = l, { addDays: d, addMonths: u, addWeeks: c, addYears: h, endOfBroadcastWeek: g, endOfISOWeek: O, endOfWeek: N, max: k, min: W, startOfBroadcastWeek: x, startOfISOWeek: v, startOfWeek: D } = a;
1582
- let m = {
1583
- day: d,
1584
- week: c,
1585
- month: u,
1586
- year: h,
1587
- startOfWeek: (C) => i ? x(C, a) : s ? v(C) : D(C),
1588
- endOfWeek: (C) => i ? g(C) : s ? O(C) : N(C)
1589
- }[e](o, t === "after" ? 1 : -1);
1590
- return t === "before" && n ? m = k([n, m]) : t === "after" && r && (m = W([r, m])), m;
1591
- }
1592
- function lt(e, t, o, n, r, l, a, s = 0) {
1593
- if (s > 365)
1594
- return;
1595
- const i = Br(e, t, o.date, n, r, l, a), d = !!(l.disabled && ee(i, l.disabled, a)), u = !!(l.hidden && ee(i, l.hidden, a)), c = i, h = new et(i, c, a);
1596
- return !d && !u ? h : lt(e, t, h, n, r, l, a, s + 1);
1597
- }
1598
- function Yr(e, t, o, n, r) {
1599
- const { autoFocus: l } = e, [a, s] = _e(), i = Pr(t.days, o, n || (() => !1), a), [d, u] = _e(l ? i : void 0);
1600
- return {
1601
- isFocusTarget: (N) => !!i?.isEqualTo(N),
1602
- setFocused: u,
1603
- focused: d,
1604
- blur: () => {
1605
- s(d), u(void 0);
1606
- },
1607
- moveFocus: (N, k) => {
1608
- if (!d)
1609
- return;
1610
- const W = lt(N, k, d, t.navStart, t.navEnd, e, r);
1611
- W && (e.disableNavigation && !t.days.some((v) => v.isEqualTo(W)) || (t.goToDay(W), u(W)));
1612
- }
1613
- };
1614
- }
1615
- function Fr(e, t) {
1616
- const { selected: o, required: n, onSelect: r } = e, [l, a] = ye(o, r ? o : void 0), s = r ? o : l, { isSameDay: i } = t, d = (g) => s?.some((O) => i(O, g)) ?? !1, { min: u, max: c } = e;
1617
- return {
1618
- selected: s,
1619
- select: (g, O, N) => {
1620
- let k = [...s ?? []];
1621
- if (d(g)) {
1622
- if (s?.length === u || n && s?.length === 1)
1623
- return;
1624
- k = s?.filter((W) => !i(W, g));
1625
- } else
1626
- s?.length === c ? k = [g] : k = [...k, g];
1627
- return r || a(k), r?.(k, g, O, N), k;
1628
- },
1629
- isSelected: d
1630
- };
1631
- }
1632
- function Ir(e, t, o = 0, n = 0, r = !1, l = K) {
1633
- const { from: a, to: s } = t || {}, { isSameDay: i, isAfter: d, isBefore: u } = l;
1634
- let c;
1635
- if (!a && !s)
1636
- c = { from: e, to: o > 0 ? void 0 : e };
1637
- else if (a && !s)
1638
- i(a, e) ? o === 0 ? c = { from: a, to: e } : r ? c = { from: a, to: void 0 } : c = void 0 : u(e, a) ? c = { from: e, to: a } : c = { from: a, to: e };
1639
- else if (a && s)
1640
- if (i(a, e) && i(s, e))
1641
- r ? c = { from: a, to: s } : c = void 0;
1642
- else if (i(a, e))
1643
- c = { from: a, to: o > 0 ? void 0 : e };
1644
- else if (i(s, e))
1645
- c = { from: e, to: o > 0 ? void 0 : e };
1646
- else if (u(e, a))
1647
- c = { from: e, to: s };
1648
- else if (d(e, a))
1649
- c = { from: a, to: e };
1650
- else if (d(e, s))
1651
- c = { from: a, to: e };
1652
- else
1653
- throw new Error("Invalid range");
1654
- if (c?.from && c?.to) {
1655
- const h = l.differenceInCalendarDays(c.to, c.from);
1656
- n > 0 && h > n ? c = { from: e, to: void 0 } : o > 1 && h < o && (c = { from: e, to: void 0 });
1657
- }
1658
- return c;
1659
- }
1660
- function Ar(e, t, o = K) {
1661
- const n = Array.isArray(t) ? t : [t];
1662
- let r = e.from;
1663
- const l = o.differenceInCalendarDays(e.to, e.from), a = Math.min(l, 6);
1664
- for (let s = 0; s <= a; s++) {
1665
- if (n.includes(r.getDay()))
1666
- return !0;
1667
- r = o.addDays(r, 1);
1668
- }
1669
- return !1;
1670
- }
1671
- function Ke(e, t, o = K) {
1672
- return Q(e, t.from, !1, o) || Q(e, t.to, !1, o) || Q(t, e.from, !1, o) || Q(t, e.to, !1, o);
1673
- }
1674
- function zr(e, t, o = K) {
1675
- const n = Array.isArray(t) ? t : [t];
1676
- if (n.filter((s) => typeof s != "function").some((s) => typeof s == "boolean" ? s : o.isDate(s) ? Q(e, s, !1, o) : ot(s, o) ? s.some((i) => Q(e, i, !1, o)) : me(s) ? s.from && s.to ? Ke(e, { from: s.from, to: s.to }, o) : !1 : nt(s) ? Ar(e, s.dayOfWeek, o) : Ee(s) ? o.isAfter(s.before, s.after) ? Ke(e, {
1677
- from: o.addDays(s.after, 1),
1678
- to: o.addDays(s.before, -1)
1679
- }, o) : ee(e.from, s, o) || ee(e.to, s, o) : Pe(s) || Be(s) ? ee(e.from, s, o) || ee(e.to, s, o) : !1))
1680
- return !0;
1681
- const a = n.filter((s) => typeof s == "function");
1682
- if (a.length) {
1683
- let s = e.from;
1684
- const i = o.differenceInCalendarDays(e.to, e.from);
1685
- for (let d = 0; d <= i; d++) {
1686
- if (a.some((u) => u(s)))
1687
- return !0;
1688
- s = o.addDays(s, 1);
1689
- }
1690
- }
1691
- return !1;
1692
- }
1693
- function jr(e, t) {
1694
- const { disabled: o, excludeDisabled: n, selected: r, required: l, onSelect: a } = e, [s, i] = ye(r, a ? r : void 0), d = a ? r : s;
1695
- return {
1696
- selected: d,
1697
- select: (h, g, O) => {
1698
- const { min: N, max: k } = e, W = h ? Ir(h, d, N, k, l, t) : void 0;
1699
- return n && o && W?.from && W.to && zr({ from: W.from, to: W.to }, o, t) && (W.from = h, W.to = void 0), a || i(W), a?.(W, h, g, O), W;
1700
- },
1701
- isSelected: (h) => d && Q(d, h, !1, t)
1702
- };
1703
- }
1704
- function qr(e, t) {
1705
- const { selected: o, required: n, onSelect: r } = e, [l, a] = ye(o, r ? o : void 0), s = r ? o : l, { isSameDay: i } = t;
1706
- return {
1707
- selected: s,
1708
- select: (c, h, g) => {
1709
- let O = c;
1710
- return !n && s && s && i(c, s) && (O = void 0), r || a(O), r?.(O, c, h, g), O;
1711
- },
1712
- isSelected: (c) => s ? i(s, c) : !1
1713
- };
1714
- }
1715
- function Hr(e, t) {
1716
- const o = qr(e, t), n = Fr(e, t), r = jr(e, t);
1717
- switch (e.mode) {
1718
- case "single":
1719
- return o;
1720
- case "multiple":
1721
- return n;
1722
- case "range":
1723
- return r;
1724
- default:
1725
- return;
1726
- }
1727
- }
1728
- function I(e, t) {
1729
- return e instanceof X && e.timeZone === t ? e : new X(e, t);
1730
- }
1731
- function Je(e, t) {
1732
- return typeof e == "boolean" || typeof e == "function" ? e : e instanceof Date ? I(e, t) : Array.isArray(e) ? e.map((o) => o instanceof Date ? I(o, t) : o) : me(e) ? {
1733
- ...e,
1734
- from: e.from ? I(e.from, t) : e.from,
1735
- to: e.to ? I(e.to, t) : e.to
1736
- } : Ee(e) ? {
1737
- before: I(e.before, t),
1738
- after: I(e.after, t)
1739
- } : Pe(e) ? {
1740
- after: I(e.after, t)
1741
- } : Be(e) ? {
1742
- before: I(e.before, t)
1743
- } : e;
1744
- }
1745
- function xe(e, t) {
1746
- return e && (Array.isArray(e) ? e.map((o) => Je(o, t)) : Je(e, t));
1747
- }
1748
- function $r(e) {
1749
- let t = e;
1750
- const o = t.timeZone;
1751
- if (o && (t = {
1752
- ...e,
1753
- timeZone: o
1754
- }, t.today && (t.today = I(t.today, o)), t.month && (t.month = I(t.month, o)), t.defaultMonth && (t.defaultMonth = I(t.defaultMonth, o)), t.startMonth && (t.startMonth = I(t.startMonth, o)), t.endMonth && (t.endMonth = I(t.endMonth, o)), t.mode === "single" && t.selected ? t.selected = I(t.selected, o) : t.mode === "multiple" && t.selected ? t.selected = t.selected?.map((M) => I(M, o)) : t.mode === "range" && t.selected && (t.selected = {
1755
- from: t.selected.from ? I(t.selected.from, o) : t.selected.from,
1756
- to: t.selected.to ? I(t.selected.to, o) : t.selected.to
1757
- }), t.disabled !== void 0 && (t.disabled = xe(t.disabled, o)), t.hidden !== void 0 && (t.hidden = xe(t.hidden, o)), t.modifiers)) {
1758
- const M = {};
1759
- Object.keys(t.modifiers).forEach((T) => {
1760
- M[T] = xe(t.modifiers?.[T], o);
1761
- }), t.modifiers = M;
1762
- }
1763
- const { components: n, formatters: r, labels: l, dateLib: a, locale: s, classNames: i } = ie(() => {
1764
- const M = { ...Xe, ...t.locale };
1765
- return {
1766
- dateLib: new z({
1767
- locale: M,
1768
- weekStartsOn: t.broadcastCalendar ? 1 : t.weekStartsOn,
1769
- firstWeekContainsDate: t.firstWeekContainsDate,
1770
- useAdditionalWeekYearTokens: t.useAdditionalWeekYearTokens,
1771
- useAdditionalDayOfYearTokens: t.useAdditionalDayOfYearTokens,
1772
- timeZone: t.timeZone,
1773
- numerals: t.numerals
1774
- }, t.dateLib),
1775
- components: Vo(t.components),
1776
- formatters: or(t.formatters),
1777
- labels: { ...vr, ...t.labels },
1778
- locale: M,
1779
- classNames: { ...Ye(), ...t.classNames }
1780
- };
1781
- }, [
1782
- t.locale,
1783
- t.broadcastCalendar,
1784
- t.weekStartsOn,
1785
- t.firstWeekContainsDate,
1786
- t.useAdditionalWeekYearTokens,
1787
- t.useAdditionalDayOfYearTokens,
1788
- t.timeZone,
1789
- t.numerals,
1790
- t.dateLib,
1791
- t.components,
1792
- t.formatters,
1793
- t.labels,
1794
- t.classNames
1795
- ]);
1796
- t.today || (t = { ...t, today: a.today() });
1797
- const { captionLayout: d, mode: u, navLayout: c, numberOfMonths: h = 1, onDayBlur: g, onDayClick: O, onDayFocus: N, onDayKeyDown: k, onDayMouseEnter: W, onDayMouseLeave: x, onNextClick: v, onPrevClick: D, showWeekNumber: p, styles: m } = t, { formatCaption: C, formatDay: E, formatMonthDropdown: F, formatWeekNumber: B, formatWeekNumberHeader: Z, formatWeekdayName: te, formatYearDropdown: J } = r, j = Er(t, a), { days: oe, months: ce, navStart: pe, navEnd: ge, previousMonth: H, nextMonth: $, goToMonth: L } = j, be = Zo(oe, t, pe, ge, a), { isSelected: ve, select: ke, selected: fe } = Hr(t, a) ?? {}, { blur: Fe, focused: Ie, isFocusTarget: dt, moveFocus: Ae, setFocused: ue } = Yr(t, j, be, ve ?? (() => !1), a), { labelDayButton: ct, labelGridcell: ft, labelGrid: ut, labelMonthDropdown: ht, labelNav: ze, labelPrevious: mt, labelNext: yt, labelWeekday: pt, labelWeekNumber: gt, labelWeekNumberHeader: bt, labelYearDropdown: vt } = l, kt = ie(() => sr(a, t.ISOWeek, t.broadcastCalendar, t.today), [a, t.ISOWeek, t.broadcastCalendar, t.today]), je = u !== void 0 || O !== void 0, Me = q(() => {
1798
- H && (L(H), D?.(H));
1799
- }, [H, L, D]), we = q(() => {
1800
- $ && (L($), v?.($));
1801
- }, [L, $, v]), Mt = q((M, T) => (b) => {
1802
- b.preventDefault(), b.stopPropagation(), ue(M), !T.disabled && (ke?.(M.date, T, b), O?.(M.date, T, b));
1803
- }, [ke, O, ue]), wt = q((M, T) => (b) => {
1804
- ue(M), N?.(M.date, T, b);
1805
- }, [N, ue]), Dt = q((M, T) => (b) => {
1806
- Fe(), g?.(M.date, T, b);
1807
- }, [Fe, g]), Ot = q((M, T) => (b) => {
1808
- const _ = {
1809
- ArrowLeft: [
1810
- b.shiftKey ? "month" : "day",
1811
- t.dir === "rtl" ? "after" : "before"
1812
- ],
1813
- ArrowRight: [
1814
- b.shiftKey ? "month" : "day",
1815
- t.dir === "rtl" ? "before" : "after"
1816
- ],
1817
- ArrowDown: [b.shiftKey ? "year" : "week", "after"],
1818
- ArrowUp: [b.shiftKey ? "year" : "week", "before"],
1819
- PageUp: [b.shiftKey ? "year" : "month", "before"],
1820
- PageDown: [b.shiftKey ? "year" : "month", "after"],
1821
- Home: ["startOfWeek", "before"],
1822
- End: ["endOfWeek", "after"]
1823
- };
1824
- if (_[b.key]) {
1825
- b.preventDefault(), b.stopPropagation();
1826
- const [U, S] = _[b.key];
1827
- Ae(U, S);
1828
- }
1829
- k?.(M.date, T, b);
1830
- }, [Ae, k, t.dir]), Wt = q((M, T) => (b) => {
1831
- W?.(M.date, T, b);
1832
- }, [W]), Ct = q((M, T) => (b) => {
1833
- x?.(M.date, T, b);
1834
- }, [x]), St = q((M) => (T) => {
1835
- const b = Number(T.target.value), _ = a.setMonth(a.startOfMonth(M), b);
1836
- L(_);
1837
- }, [a, L]), Nt = q((M) => (T) => {
1838
- const b = Number(T.target.value), _ = a.setYear(a.startOfMonth(M), b);
1839
- L(_);
1840
- }, [a, L]), { className: xt, style: _t } = ie(() => ({
1841
- className: [i[y.Root], t.className].filter(Boolean).join(" "),
1842
- style: { ...m?.[y.Root], ...t.style }
1843
- }), [i, t.className, t.style, m]), Tt = Go(t), qe = he(null);
1844
- Dr(qe, !!t.animate, {
1845
- classNames: i,
1846
- months: ce,
1847
- focused: Ie,
1848
- dateLib: a
1849
- });
1850
- const Et = {
1851
- dayPickerProps: t,
1852
- selected: fe,
1853
- select: ke,
1854
- isSelected: ve,
1855
- months: ce,
1856
- nextMonth: $,
1857
- previousMonth: H,
1858
- goToMonth: L,
1859
- getModifiers: be,
1860
- components: n,
1861
- classNames: i,
1862
- styles: m,
1863
- labels: l,
1864
- formatters: r
1865
- };
1866
- return f.createElement(
1867
- tt.Provider,
1868
- { value: Et },
1869
- f.createElement(
1870
- n.Root,
1871
- { rootRef: t.animate ? qe : void 0, className: xt, style: _t, dir: t.dir, id: t.id, lang: t.lang, nonce: t.nonce, title: t.title, role: t.role, "aria-label": t["aria-label"], "aria-labelledby": t["aria-labelledby"], ...Tt },
1872
- f.createElement(
1873
- n.Months,
1874
- { className: i[y.Months], style: m?.[y.Months] },
1875
- !t.hideNavigation && !c && f.createElement(n.Nav, { "data-animated-nav": t.animate ? "true" : void 0, className: i[y.Nav], style: m?.[y.Nav], "aria-label": ze(), onPreviousClick: Me, onNextClick: we, previousMonth: H, nextMonth: $ }),
1876
- ce.map((M, T) => f.createElement(
1877
- n.Month,
1878
- {
1879
- "data-animated-month": t.animate ? "true" : void 0,
1880
- className: i[y.Month],
1881
- style: m?.[y.Month],
1882
- // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
1883
- key: T,
1884
- displayIndex: T,
1885
- calendarMonth: M
1886
- },
1887
- c === "around" && !t.hideNavigation && T === 0 && f.createElement(
1888
- n.PreviousMonthButton,
1889
- { type: "button", className: i[y.PreviousMonthButton], tabIndex: H ? void 0 : -1, "aria-disabled": H ? void 0 : !0, "aria-label": mt(H), onClick: Me, "data-animated-button": t.animate ? "true" : void 0 },
1890
- f.createElement(n.Chevron, { disabled: H ? void 0 : !0, className: i[y.Chevron], orientation: t.dir === "rtl" ? "right" : "left" })
1891
- ),
1892
- f.createElement(n.MonthCaption, { "data-animated-caption": t.animate ? "true" : void 0, className: i[y.MonthCaption], style: m?.[y.MonthCaption], calendarMonth: M, displayIndex: T }, d?.startsWith("dropdown") ? f.createElement(
1893
- n.DropdownNav,
1894
- { className: i[y.Dropdowns], style: m?.[y.Dropdowns] },
1895
- (() => {
1896
- const b = d === "dropdown" || d === "dropdown-months" ? f.createElement(n.MonthsDropdown, { key: "month", className: i[y.MonthsDropdown], "aria-label": ht(), classNames: i, components: n, disabled: !!t.disableNavigation, onChange: St(M.date), options: rr(M.date, pe, ge, r, a), style: m?.[y.Dropdown], value: a.getMonth(M.date) }) : f.createElement("span", { key: "month" }, F(M.date, a)), _ = d === "dropdown" || d === "dropdown-years" ? f.createElement(n.YearsDropdown, { key: "year", className: i[y.YearsDropdown], "aria-label": vt(a.options), classNames: i, components: n, disabled: !!t.disableNavigation, onChange: Nt(M.date), options: ir(pe, ge, r, a, !!t.reverseYears), style: m?.[y.Dropdown], value: a.getYear(M.date) }) : f.createElement("span", { key: "year" }, J(M.date, a));
1897
- return a.getMonthYearOrder() === "year-first" ? [_, b] : [b, _];
1898
- })(),
1899
- f.createElement("span", { role: "status", "aria-live": "polite", style: {
1900
- border: 0,
1901
- clip: "rect(0 0 0 0)",
1902
- height: "1px",
1903
- margin: "-1px",
1904
- overflow: "hidden",
1905
- padding: 0,
1906
- position: "absolute",
1907
- width: "1px",
1908
- whiteSpace: "nowrap",
1909
- wordWrap: "normal"
1910
- } }, C(M.date, a.options, a))
1911
- ) : f.createElement(n.CaptionLabel, { className: i[y.CaptionLabel], role: "status", "aria-live": "polite" }, C(M.date, a.options, a))),
1912
- c === "around" && !t.hideNavigation && T === h - 1 && f.createElement(
1913
- n.NextMonthButton,
1914
- { type: "button", className: i[y.NextMonthButton], tabIndex: $ ? void 0 : -1, "aria-disabled": $ ? void 0 : !0, "aria-label": yt($), onClick: we, "data-animated-button": t.animate ? "true" : void 0 },
1915
- f.createElement(n.Chevron, { disabled: $ ? void 0 : !0, className: i[y.Chevron], orientation: t.dir === "rtl" ? "left" : "right" })
1916
- ),
1917
- T === h - 1 && c === "after" && !t.hideNavigation && f.createElement(n.Nav, { "data-animated-nav": t.animate ? "true" : void 0, className: i[y.Nav], style: m?.[y.Nav], "aria-label": ze(), onPreviousClick: Me, onNextClick: we, previousMonth: H, nextMonth: $ }),
1918
- f.createElement(
1919
- n.MonthGrid,
1920
- { role: "grid", "aria-multiselectable": u === "multiple" || u === "range", "aria-label": ut(M.date, a.options, a) || void 0, className: i[y.MonthGrid], style: m?.[y.MonthGrid] },
1921
- !t.hideWeekdays && f.createElement(
1922
- n.Weekdays,
1923
- { "data-animated-weekdays": t.animate ? "true" : void 0, className: i[y.Weekdays], style: m?.[y.Weekdays] },
1924
- p && f.createElement(n.WeekNumberHeader, { "aria-label": bt(a.options), className: i[y.WeekNumberHeader], style: m?.[y.WeekNumberHeader], scope: "col" }, Z()),
1925
- kt.map((b) => f.createElement(n.Weekday, { "aria-label": pt(b, a.options, a), className: i[y.Weekday], key: String(b), style: m?.[y.Weekday], scope: "col" }, te(b, a.options, a)))
1926
- ),
1927
- f.createElement(n.Weeks, { "data-animated-weeks": t.animate ? "true" : void 0, className: i[y.Weeks], style: m?.[y.Weeks] }, M.weeks.map((b) => f.createElement(
1928
- n.Week,
1929
- { className: i[y.Week], key: b.weekNumber, style: m?.[y.Week], week: b },
1930
- p && f.createElement(n.WeekNumber, { week: b, style: m?.[y.WeekNumber], "aria-label": gt(b.weekNumber, {
1931
- locale: s
1932
- }), className: i[y.WeekNumber], scope: "row", role: "rowheader" }, B(b.weekNumber, a)),
1933
- b.days.map((_) => {
1934
- const { date: U } = _, S = be(_);
1935
- if (S[P.focused] = !S.hidden && !!Ie?.isEqualTo(_), S[R.selected] = ve?.(U) || S.selected, me(fe)) {
1936
- const { from: De, to: Oe } = fe;
1937
- S[R.range_start] = !!(De && Oe && a.isSameDay(U, De)), S[R.range_end] = !!(De && Oe && a.isSameDay(U, Oe)), S[R.range_middle] = Q(fe, U, !0, a);
1938
- }
1939
- const Pt = ar(S, m, t.modifiersStyles), Bt = Uo(S, i, t.modifiersClassNames), Yt = !je && !S.hidden ? ft(U, S, a.options, a) : void 0;
1940
- return f.createElement(n.Day, { key: `${_.isoDate}_${_.displayMonthId}`, day: _, modifiers: S, className: Bt.join(" "), style: Pt, role: "gridcell", "aria-selected": S.selected || void 0, "aria-label": Yt, "data-day": _.isoDate, "data-month": _.outside ? _.dateMonthId : void 0, "data-selected": S.selected || void 0, "data-disabled": S.disabled || void 0, "data-hidden": S.hidden || void 0, "data-outside": _.outside || void 0, "data-focused": S.focused || void 0, "data-today": S.today || void 0 }, !S.hidden && je ? f.createElement(n.DayButton, { className: i[y.DayButton], style: m?.[y.DayButton], type: "button", day: _, modifiers: S, disabled: !S.focused && S.disabled || void 0, "aria-disabled": S.focused && S.disabled || void 0, tabIndex: dt(_) ? 0 : -1, "aria-label": ct(U, S, a.options, a), onClick: Mt(_, S), onBlur: Dt(_, S), onFocus: wt(_, S), onKeyDown: Ot(_, S), onMouseEnter: Wt(_, S), onMouseLeave: Ct(_, S) }, E(U, a.options, a)) : !S.hidden && E(_.date, a.options, a));
1941
- })
1942
- )))
1943
- )
1944
- ))
1945
- ),
1946
- t.footer && f.createElement(n.Footer, { className: i[y.Footer], style: m?.[y.Footer], role: "status", "aria-live": "polite" }, t.footer)
1947
- )
1948
- );
1949
- }
1950
- function aa({
1951
- className: e,
1952
- classNames: t,
1953
- showOutsideDays: o = !0,
1954
- captionLayout: n = "label",
1955
- buttonVariant: r = "ghost",
1956
- formatters: l,
1957
- components: a,
1958
- ...s
1959
- }) {
1960
- const i = Ye();
1961
- return /* @__PURE__ */ Y(
1962
- $r,
1963
- {
1964
- showOutsideDays: o,
1965
- className: w(
1966
- "bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
1967
- String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
1968
- String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
1969
- e
1970
- ),
1971
- captionLayout: n,
1972
- formatters: {
1973
- formatMonthDropdown: (d) => d.toLocaleString("default", { month: "short" }),
1974
- ...l
1975
- },
1976
- classNames: {
1977
- root: w("w-fit", i.root),
1978
- months: w(
1979
- "relative flex flex-col gap-4 md:flex-row",
1980
- i.months
1981
- ),
1982
- month: w("flex w-full flex-col gap-4", i.month),
1983
- nav: w(
1984
- "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
1985
- i.nav
1986
- ),
1987
- button_previous: w(
1988
- $e({ variant: r }),
1989
- "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
1990
- i.button_previous
1991
- ),
1992
- button_next: w(
1993
- $e({ variant: r }),
1994
- "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
1995
- i.button_next
1996
- ),
1997
- month_caption: w(
1998
- "flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",
1999
- i.month_caption
2000
- ),
2001
- dropdowns: w(
2002
- "flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",
2003
- i.dropdowns
2004
- ),
2005
- dropdown_root: w(
2006
- "has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",
2007
- i.dropdown_root
2008
- ),
2009
- dropdown: w(
2010
- "bg-popover absolute inset-0 opacity-0",
2011
- i.dropdown
2012
- ),
2013
- caption_label: w(
2014
- "select-none font-medium",
2015
- n === "label" ? "text-sm" : "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",
2016
- i.caption_label
2017
- ),
2018
- table: "w-full border-collapse",
2019
- weekdays: w("flex", i.weekdays),
2020
- weekday: w(
2021
- "text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",
2022
- i.weekday
2023
- ),
2024
- week: w("mt-2 flex w-full", i.week),
2025
- week_number_header: w(
2026
- "w-[--cell-size] select-none",
2027
- i.week_number_header
2028
- ),
2029
- week_number: w(
2030
- "text-muted-foreground select-none text-[0.8rem]",
2031
- i.week_number
2032
- ),
2033
- day: w(
2034
- "group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",
2035
- i.day
2036
- ),
2037
- range_start: w(
2038
- "bg-accent rounded-l-md",
2039
- i.range_start
2040
- ),
2041
- range_middle: w("rounded-none", i.range_middle),
2042
- range_end: w("bg-accent rounded-r-md", i.range_end),
2043
- today: w(
2044
- "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
2045
- i.today
2046
- ),
2047
- outside: w(
2048
- "text-muted-foreground aria-selected:text-muted-foreground",
2049
- i.outside
2050
- ),
2051
- disabled: w(
2052
- "text-muted-foreground opacity-50",
2053
- i.disabled
2054
- ),
2055
- hidden: w("invisible", i.hidden),
2056
- ...t
2057
- },
2058
- components: {
2059
- Root: ({ className: d, rootRef: u, ...c }) => /* @__PURE__ */ Y(
2060
- "div",
2061
- {
2062
- "data-slot": "calendar",
2063
- ref: u,
2064
- className: w(d),
2065
- ...c
2066
- }
2067
- ),
2068
- Chevron: ({ className: d, orientation: u, ...c }) => u === "left" ? /* @__PURE__ */ Y(Nn, { className: w("size-4", d), ...c }) : u === "right" ? /* @__PURE__ */ Y(
2069
- Zt,
2070
- {
2071
- className: w("size-4", d),
2072
- ...c
2073
- }
2074
- ) : /* @__PURE__ */ Y(Ut, { className: w("size-4", d), ...c }),
2075
- DayButton: Rr,
2076
- WeekNumber: ({ children: d, ...u }) => /* @__PURE__ */ Y("td", { ...u, children: /* @__PURE__ */ Y("div", { className: "flex size-[--cell-size] items-center justify-center text-center", children: d }) }),
2077
- ...a
2078
- },
2079
- ...s
2080
- }
2081
- );
2082
- }
2083
- function Rr({
2084
- className: e,
2085
- day: t,
2086
- modifiers: o,
2087
- ...n
2088
- }) {
2089
- const r = Ye(), l = He.useRef(null);
2090
- return He.useEffect(() => {
2091
- o.focused && l.current?.focus();
2092
- }, [o.focused]), /* @__PURE__ */ Y(
2093
- Vt,
2094
- {
2095
- ref: l,
2096
- variant: "ghost",
2097
- size: "icon",
2098
- "data-day": t.date.toLocaleDateString(),
2099
- "data-selected-single": o.selected && !o.range_start && !o.range_end && !o.range_middle,
2100
- "data-range-start": o.range_start,
2101
- "data-range-end": o.range_end,
2102
- "data-range-middle": o.range_middle,
2103
- className: w(
2104
- "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",
2105
- r.day,
2106
- e
2107
- ),
2108
- ...n
2109
- }
2110
- );
2111
- }
2112
- export {
2113
- aa as C,
2114
- Xr as F,
2115
- ea as a,
2116
- na as b,
2117
- ra as c,
2118
- Lr as d,
2119
- Jr as e,
2120
- oa as f,
2121
- Kr as g,
2122
- Qr as h,
2123
- ta as i,
2124
- Rr as j,
2125
- We as k,
2126
- re as l,
2127
- ae as m,
2128
- Xn as n
2129
- };