prometeo-design-system 3.0.2 → 3.0.4

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.
Files changed (60) hide show
  1. package/dist/Avatar.es.js +1 -1
  2. package/dist/Button.es.js +1 -1
  3. package/dist/{CardProfile-BB-IP1MR.js → CardProfile-DUBuThnz.js} +13 -13
  4. package/dist/CardProfile.es.js +1 -1
  5. package/dist/CheckBox.es.js +5 -5
  6. package/dist/DatePicker-CzpFYO6L.js +3568 -0
  7. package/dist/DatePicker.es.js +1 -1
  8. package/dist/DialogModal.es.js +1 -1
  9. package/dist/DrawerDesktop.es.js +2 -2
  10. package/dist/DrawerMobile.es.js +1 -1
  11. package/dist/DropZone.es.js +6 -6
  12. package/dist/FAButton.es.js +2 -2
  13. package/dist/Header.es.js +1 -1
  14. package/dist/{HelperComponent-D_Cqdf1J.js → HelperComponent-E_C-E8Iu.js} +8 -8
  15. package/dist/Icons/Home.d.ts +2 -0
  16. package/dist/Icons/Home.es.js +7 -0
  17. package/dist/Icons-BJgYCS_W.js +979 -0
  18. package/dist/Icons.es.js +5 -976
  19. package/dist/Image.es.js +1 -1
  20. package/dist/{ImageGallery-CjaJ0UCN.js → ImageGallery-DqUwjAKn.js} +35 -35
  21. package/dist/ImageGallery.es.js +1 -1
  22. package/dist/{Input-CLsH2Ea0.js → Input-ZXkhyFlL.js} +3 -3
  23. package/dist/Input.es.js +1 -1
  24. package/dist/InputMultiple.es.js +35 -35
  25. package/dist/{LayoutGeneric-B6E-yOYJ.js → LayoutGeneric-CbaoatQB.js} +1 -1
  26. package/dist/LayoutGeneric.es.js +1 -1
  27. package/dist/Logo.es.js +2 -2
  28. package/dist/Menu.es.js +1 -1
  29. package/dist/OtpInput.es.js +44 -44
  30. package/dist/Pagination.es.js +1 -1
  31. package/dist/ProfilePictureUpload.es.js +1 -1
  32. package/dist/ProgressBar.es.js +1 -1
  33. package/dist/RadioButton.es.js +2 -2
  34. package/dist/RecurrentDatePicker.es.js +5 -5
  35. package/dist/RecurrentDatePickerRRule.es.js +2 -2
  36. package/dist/SegmentedButton.es.js +1 -1
  37. package/dist/{Select-Co4rzd96.js → Select-DgUVs2c6.js} +46 -46
  38. package/dist/Select.es.js +1 -1
  39. package/dist/SelectSearch.es.js +2 -2
  40. package/dist/Skeleton.es.js +1 -1
  41. package/dist/Spinner.es.js +1 -1
  42. package/dist/Steps.es.js +2 -2
  43. package/dist/SwipeContainer.es.js +1 -1
  44. package/dist/Switch.es.js +1 -1
  45. package/dist/TabLinks.es.js +1 -1
  46. package/dist/Table.es.js +1 -1
  47. package/dist/TextArea.es.js +1 -1
  48. package/dist/Toast.es.js +23 -23
  49. package/dist/ToastProvider.es.js +1 -1
  50. package/dist/Tooltip.es.js +2 -2
  51. package/dist/exports/Icons.d.ts +4 -2
  52. package/dist/{jsx-runtime-ByW6EXIE.js → jsx-runtime-DKDX3adD.js} +94 -96
  53. package/dist/prometeo-design-system.es.js +48 -48
  54. package/dist/styles.css +1 -1
  55. package/package.json +298 -294
  56. package/src/styles/app.css +1 -1
  57. package/src/styles/base.css +1332 -1332
  58. package/src/styles/fonts.css +45 -45
  59. package/src/styles/palette.css +83 -83
  60. package/dist/DatePicker-odNBd49H.js +0 -3628
@@ -1,3628 +0,0 @@
1
- import { j as U } from "./jsx-runtime-ByW6EXIE.js";
2
- import m, { createContext as pn, useContext as wn, useCallback as R, useRef as Ye, useLayoutEffect as bn, useState as ke, useEffect as _e, useMemo as se, memo as Mn } from "react";
3
- import Dn from "./InputMultiple.es.js";
4
- import { I as vn } from "./Input-CLsH2Ea0.js";
5
- import { createPortal as kn } from "react-dom";
6
- import { c as Ze } from "./cn-B6yFEsav.js";
7
- import { Calendar as Nt } from "./Icons.es.js";
8
- import Pt from "./Button.es.js";
9
- function On(e, t, o = "long") {
10
- return new Intl.DateTimeFormat("en-US", {
11
- // Enforces engine to render the time. Without the option JavaScriptCore omits it.
12
- hour: "numeric",
13
- timeZone: e,
14
- timeZoneName: o
15
- }).format(t).split(/\s/g).slice(2).join(" ");
16
- }
17
- const Wn = {}, Ue = {};
18
- function Ie(e, t) {
19
- try {
20
- const n = (Wn[e] ||= new Intl.DateTimeFormat("en-US", {
21
- timeZone: e,
22
- timeZoneName: "longOffset"
23
- }).format)(t).split("GMT")[1];
24
- return n in Ue ? Ue[n] : Tt(n, n.split(":"));
25
- } catch {
26
- if (e in Ue) return Ue[e];
27
- const o = e?.match(Sn);
28
- return o ? Tt(e, o.slice(1)) : NaN;
29
- }
30
- }
31
- const Sn = /([+-]\d\d):?(\d\d)?/;
32
- function Tt(e, t) {
33
- const o = +(t[0] || 0), n = +(t[1] || 0), r = +(t[2] || 0) / 60;
34
- return Ue[e] = o * 60 + n > 0 ? o * 60 + n + r : o * 60 - n - r;
35
- }
36
- class we extends Date {
37
- //#region static
38
- constructor(...t) {
39
- super(), t.length > 1 && typeof t[t.length - 1] == "string" && (this.timeZone = t.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(Ie(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)), Lt(this), kt(this)) : this.setTime(Date.now());
40
- }
41
- static tz(t, ...o) {
42
- return o.length ? new we(...o, t) : new we(Date.now(), t);
43
- }
44
- //#endregion
45
- //#region time zone
46
- withTimeZone(t) {
47
- return new we(+this, t);
48
- }
49
- getTimezoneOffset() {
50
- const t = -Ie(this.timeZone, this);
51
- return t > 0 ? Math.floor(t) : Math.ceil(t);
52
- }
53
- //#endregion
54
- //#region time
55
- setTime(t) {
56
- return Date.prototype.setTime.apply(this, arguments), kt(this), +this;
57
- }
58
- //#endregion
59
- //#region date-fns integration
60
- [Symbol.for("constructDateFrom")](t) {
61
- return new we(+new Date(t), this.timeZone);
62
- }
63
- //#endregion
64
- }
65
- const Yt = /^(get|set)(?!UTC)/;
66
- Object.getOwnPropertyNames(Date.prototype).forEach((e) => {
67
- if (!Yt.test(e)) return;
68
- const t = e.replace(Yt, "$1UTC");
69
- we.prototype[t] && (e.startsWith("get") ? we.prototype[e] = function() {
70
- return this.internal[t]();
71
- } : (we.prototype[e] = function() {
72
- return Date.prototype[t].apply(this.internal, arguments), Cn(this), +this;
73
- }, we.prototype[t] = function() {
74
- return Date.prototype[t].apply(this, arguments), kt(this), +this;
75
- }));
76
- });
77
- function kt(e) {
78
- e.internal.setTime(+e), e.internal.setUTCSeconds(e.internal.getUTCSeconds() - Math.round(-Ie(e.timeZone, e) * 60));
79
- }
80
- function Cn(e) {
81
- 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()), Lt(e);
82
- }
83
- function Lt(e) {
84
- const t = Ie(e.timeZone, e), o = t > 0 ? Math.floor(t) : Math.ceil(t), n = /* @__PURE__ */ new Date(+e);
85
- n.setUTCHours(n.getUTCHours() - 1);
86
- const r = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset(), s = -(/* @__PURE__ */ new Date(+n)).getTimezoneOffset(), a = r - s, i = Date.prototype.getHours.apply(e) !== e.internal.getUTCHours();
87
- a && i && e.internal.setUTCMinutes(e.internal.getUTCMinutes() + a);
88
- const c = r - o;
89
- c && Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + c);
90
- const d = /* @__PURE__ */ new Date(+e);
91
- d.setUTCSeconds(0);
92
- const f = r > 0 ? d.getSeconds() : (d.getSeconds() - 60) % 60, u = Math.round(-(Ie(e.timeZone, e) * 60)) % 60;
93
- (u || f) && (e.internal.setUTCSeconds(e.internal.getUTCSeconds() + u), Date.prototype.setUTCSeconds.call(e, Date.prototype.getUTCSeconds.call(e) + u + f));
94
- const l = Ie(e.timeZone, e), M = l > 0 ? Math.floor(l) : Math.ceil(l), N = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset() - M, O = M !== o, D = N - c;
95
- if (O && D) {
96
- Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + D);
97
- const g = Ie(e.timeZone, e), p = g > 0 ? Math.floor(g) : Math.ceil(g), S = M - p;
98
- S && (e.internal.setUTCMinutes(e.internal.getUTCMinutes() + S), Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + S));
99
- }
100
- }
101
- class Oe extends we {
102
- //#region static
103
- static tz(t, ...o) {
104
- return o.length ? new Oe(...o, t) : new Oe(Date.now(), t);
105
- }
106
- //#endregion
107
- //#region representation
108
- toISOString() {
109
- const [t, o, n] = this.tzComponents(), r = `${t}${o}:${n}`;
110
- return this.internal.toISOString().slice(0, -1) + r;
111
- }
112
- toString() {
113
- return `${this.toDateString()} ${this.toTimeString()}`;
114
- }
115
- toDateString() {
116
- const [t, o, n, r] = this.internal.toUTCString().split(" ");
117
- return `${t?.slice(0, -1)} ${n} ${o} ${r}`;
118
- }
119
- toTimeString() {
120
- const t = this.internal.toUTCString().split(" ")[4], [o, n, r] = this.tzComponents();
121
- return `${t} GMT${o}${n}${r} (${On(this.timeZone, this)})`;
122
- }
123
- toLocaleString(t, o) {
124
- return Date.prototype.toLocaleString.call(this, t, {
125
- ...o,
126
- timeZone: o?.timeZone || this.timeZone
127
- });
128
- }
129
- toLocaleDateString(t, o) {
130
- return Date.prototype.toLocaleDateString.call(this, t, {
131
- ...o,
132
- timeZone: o?.timeZone || this.timeZone
133
- });
134
- }
135
- toLocaleTimeString(t, o) {
136
- return Date.prototype.toLocaleTimeString.call(this, t, {
137
- ...o,
138
- timeZone: o?.timeZone || this.timeZone
139
- });
140
- }
141
- //#endregion
142
- //#region private
143
- tzComponents() {
144
- 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");
145
- return [o, n, r];
146
- }
147
- //#endregion
148
- withTimeZone(t) {
149
- return new Oe(+this, t);
150
- }
151
- //#region date-fns integration
152
- [Symbol.for("constructDateFrom")](t) {
153
- return new Oe(+new Date(t), this.timeZone);
154
- }
155
- //#endregion
156
- }
157
- const zt = 6048e5, xn = 864e5, Et = Symbol.for("constructDateFrom");
158
- function Q(e, t) {
159
- return typeof e == "function" ? e(t) : e && typeof e == "object" && Et in e ? e[Et](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
160
- }
161
- function F(e, t) {
162
- return Q(t || e, e);
163
- }
164
- function Gt(e, t, o) {
165
- const n = F(e, o?.in);
166
- return isNaN(t) ? Q(e, NaN) : (t && n.setDate(n.getDate() + t), n);
167
- }
168
- function Vt(e, t, o) {
169
- const n = F(e, o?.in);
170
- if (isNaN(t)) return Q(e, NaN);
171
- if (!t)
172
- return n;
173
- const r = n.getDate(), s = Q(e, n.getTime());
174
- s.setMonth(n.getMonth() + t + 1, 0);
175
- const a = s.getDate();
176
- return r >= a ? s : (n.setFullYear(
177
- s.getFullYear(),
178
- s.getMonth(),
179
- r
180
- ), n);
181
- }
182
- let Nn = {};
183
- function et() {
184
- return Nn;
185
- }
186
- function ze(e, t) {
187
- const o = et(), n = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? o.weekStartsOn ?? o.locale?.options?.weekStartsOn ?? 0, r = F(e, t?.in), s = r.getDay(), a = (s < n ? 7 : 0) + s - n;
188
- return r.setDate(r.getDate() - a), r.setHours(0, 0, 0, 0), r;
189
- }
190
- function Ke(e, t) {
191
- return ze(e, { ...t, weekStartsOn: 1 });
192
- }
193
- function Xt(e, t) {
194
- const o = F(e, t?.in), n = o.getFullYear(), r = Q(o, 0);
195
- r.setFullYear(n + 1, 0, 4), r.setHours(0, 0, 0, 0);
196
- const s = Ke(r), a = Q(o, 0);
197
- a.setFullYear(n, 0, 4), a.setHours(0, 0, 0, 0);
198
- const i = Ke(a);
199
- return o.getTime() >= s.getTime() ? n + 1 : o.getTime() >= i.getTime() ? n : n - 1;
200
- }
201
- function _t(e) {
202
- const t = F(e), o = new Date(
203
- Date.UTC(
204
- t.getFullYear(),
205
- t.getMonth(),
206
- t.getDate(),
207
- t.getHours(),
208
- t.getMinutes(),
209
- t.getSeconds(),
210
- t.getMilliseconds()
211
- )
212
- );
213
- return o.setUTCFullYear(t.getFullYear()), +e - +o;
214
- }
215
- function Ge(e, ...t) {
216
- const o = Q.bind(
217
- null,
218
- t.find((n) => typeof n == "object")
219
- );
220
- return t.map(o);
221
- }
222
- function Je(e, t) {
223
- const o = F(e, t?.in);
224
- return o.setHours(0, 0, 0, 0), o;
225
- }
226
- function Qt(e, t, o) {
227
- const [n, r] = Ge(
228
- o?.in,
229
- e,
230
- t
231
- ), s = Je(n), a = Je(r), i = +s - _t(s), c = +a - _t(a);
232
- return Math.round((i - c) / xn);
233
- }
234
- function Pn(e, t) {
235
- const o = Xt(e, t), n = Q(e, 0);
236
- return n.setFullYear(o, 0, 4), n.setHours(0, 0, 0, 0), Ke(n);
237
- }
238
- function Tn(e, t, o) {
239
- return Gt(e, t * 7, o);
240
- }
241
- function Yn(e, t, o) {
242
- return Vt(e, t * 12, o);
243
- }
244
- function En(e, t) {
245
- let o, n = t?.in;
246
- return e.forEach((r) => {
247
- !n && typeof r == "object" && (n = Q.bind(null, r));
248
- const s = F(r, n);
249
- (!o || o < s || isNaN(+s)) && (o = s);
250
- }), Q(n, o || NaN);
251
- }
252
- function _n(e, t) {
253
- let o, n = t?.in;
254
- return e.forEach((r) => {
255
- !n && typeof r == "object" && (n = Q.bind(null, r));
256
- const s = F(r, n);
257
- (!o || o > s || isNaN(+s)) && (o = s);
258
- }), Q(n, o || NaN);
259
- }
260
- function Fn(e, t, o) {
261
- const [n, r] = Ge(
262
- o?.in,
263
- e,
264
- t
265
- );
266
- return +Je(n) == +Je(r);
267
- }
268
- function Ut(e) {
269
- return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
270
- }
271
- function In(e) {
272
- return !(!Ut(e) && typeof e != "number" || isNaN(+F(e)));
273
- }
274
- function Bn(e, t, o) {
275
- const [n, r] = Ge(
276
- o?.in,
277
- e,
278
- t
279
- ), s = n.getFullYear() - r.getFullYear(), a = n.getMonth() - r.getMonth();
280
- return s * 12 + a;
281
- }
282
- function jn(e, t) {
283
- const o = F(e, t?.in), n = o.getMonth();
284
- return o.setFullYear(o.getFullYear(), n + 1, 0), o.setHours(23, 59, 59, 999), o;
285
- }
286
- function Zt(e, t) {
287
- const [o, n] = Ge(e, t.start, t.end);
288
- return { start: o, end: n };
289
- }
290
- function An(e, t) {
291
- const { start: o, end: n } = Zt(t?.in, e);
292
- let r = +o > +n;
293
- const s = r ? +o : +n, a = r ? n : o;
294
- a.setHours(0, 0, 0, 0), a.setDate(1);
295
- let i = 1;
296
- const c = [];
297
- for (; +a <= s; )
298
- c.push(Q(o, a)), a.setMonth(a.getMonth() + i);
299
- return r ? c.reverse() : c;
300
- }
301
- function $n(e, t) {
302
- const o = F(e, t?.in);
303
- return o.setDate(1), o.setHours(0, 0, 0, 0), o;
304
- }
305
- function Hn(e, t) {
306
- const o = F(e, t?.in), n = o.getFullYear();
307
- return o.setFullYear(n + 1, 0, 0), o.setHours(23, 59, 59, 999), o;
308
- }
309
- function Kt(e, t) {
310
- const o = F(e, t?.in);
311
- return o.setFullYear(o.getFullYear(), 0, 1), o.setHours(0, 0, 0, 0), o;
312
- }
313
- function qn(e, t) {
314
- const { start: o, end: n } = Zt(t?.in, e);
315
- let r = +o > +n;
316
- const s = r ? +o : +n, a = r ? n : o;
317
- a.setHours(0, 0, 0, 0), a.setMonth(0, 1);
318
- let i = 1;
319
- const c = [];
320
- for (; +a <= s; )
321
- c.push(Q(o, a)), a.setFullYear(a.getFullYear() + i);
322
- return r ? c.reverse() : c;
323
- }
324
- function Jt(e, t) {
325
- const o = et(), n = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? o.weekStartsOn ?? o.locale?.options?.weekStartsOn ?? 0, r = F(e, t?.in), s = r.getDay(), a = (s < n ? -7 : 0) + 6 - (s - n);
326
- return r.setDate(r.getDate() + a), r.setHours(23, 59, 59, 999), r;
327
- }
328
- function Rn(e, t) {
329
- return Jt(e, { ...t, weekStartsOn: 1 });
330
- }
331
- const Ln = {
332
- lessThanXSeconds: {
333
- one: "less than a second",
334
- other: "less than {{count}} seconds"
335
- },
336
- xSeconds: {
337
- one: "1 second",
338
- other: "{{count}} seconds"
339
- },
340
- halfAMinute: "half a minute",
341
- lessThanXMinutes: {
342
- one: "less than a minute",
343
- other: "less than {{count}} minutes"
344
- },
345
- xMinutes: {
346
- one: "1 minute",
347
- other: "{{count}} minutes"
348
- },
349
- aboutXHours: {
350
- one: "about 1 hour",
351
- other: "about {{count}} hours"
352
- },
353
- xHours: {
354
- one: "1 hour",
355
- other: "{{count}} hours"
356
- },
357
- xDays: {
358
- one: "1 day",
359
- other: "{{count}} days"
360
- },
361
- aboutXWeeks: {
362
- one: "about 1 week",
363
- other: "about {{count}} weeks"
364
- },
365
- xWeeks: {
366
- one: "1 week",
367
- other: "{{count}} weeks"
368
- },
369
- aboutXMonths: {
370
- one: "about 1 month",
371
- other: "about {{count}} months"
372
- },
373
- xMonths: {
374
- one: "1 month",
375
- other: "{{count}} months"
376
- },
377
- aboutXYears: {
378
- one: "about 1 year",
379
- other: "about {{count}} years"
380
- },
381
- xYears: {
382
- one: "1 year",
383
- other: "{{count}} years"
384
- },
385
- overXYears: {
386
- one: "over 1 year",
387
- other: "over {{count}} years"
388
- },
389
- almostXYears: {
390
- one: "almost 1 year",
391
- other: "almost {{count}} years"
392
- }
393
- }, zn = (e, t, o) => {
394
- let n;
395
- const r = Ln[e];
396
- 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;
397
- };
398
- function Le(e) {
399
- return (t = {}) => {
400
- const o = t.width ? String(t.width) : e.defaultWidth;
401
- return e.formats[o] || e.formats[e.defaultWidth];
402
- };
403
- }
404
- const Gn = {
405
- full: "EEEE, MMMM do, y",
406
- long: "MMMM do, y",
407
- medium: "MMM d, y",
408
- short: "MM/dd/yyyy"
409
- }, Vn = {
410
- full: "h:mm:ss a zzzz",
411
- long: "h:mm:ss a z",
412
- medium: "h:mm:ss a",
413
- short: "h:mm a"
414
- }, Xn = {
415
- full: "{{date}} 'at' {{time}}",
416
- long: "{{date}} 'at' {{time}}",
417
- medium: "{{date}}, {{time}}",
418
- short: "{{date}}, {{time}}"
419
- }, Qn = {
420
- date: Le({
421
- formats: Gn,
422
- defaultWidth: "full"
423
- }),
424
- time: Le({
425
- formats: Vn,
426
- defaultWidth: "full"
427
- }),
428
- dateTime: Le({
429
- formats: Xn,
430
- defaultWidth: "full"
431
- })
432
- }, Un = {
433
- lastWeek: "'last' eeee 'at' p",
434
- yesterday: "'yesterday at' p",
435
- today: "'today at' p",
436
- tomorrow: "'tomorrow at' p",
437
- nextWeek: "eeee 'at' p",
438
- other: "P"
439
- }, Zn = (e, t, o, n) => Un[e];
440
- function ge(e) {
441
- return (t, o) => {
442
- const n = o?.context ? String(o.context) : "standalone";
443
- let r;
444
- if (n === "formatting" && e.formattingValues) {
445
- const a = e.defaultFormattingWidth || e.defaultWidth, i = o?.width ? String(o.width) : a;
446
- r = e.formattingValues[i] || e.formattingValues[a];
447
- } else {
448
- const a = e.defaultWidth, i = o?.width ? String(o.width) : e.defaultWidth;
449
- r = e.values[i] || e.values[a];
450
- }
451
- const s = e.argumentCallback ? e.argumentCallback(t) : t;
452
- return r[s];
453
- };
454
- }
455
- const Kn = {
456
- narrow: ["B", "A"],
457
- abbreviated: ["BC", "AD"],
458
- wide: ["Before Christ", "Anno Domini"]
459
- }, Jn = {
460
- narrow: ["1", "2", "3", "4"],
461
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
462
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
463
- }, eo = {
464
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
465
- abbreviated: [
466
- "Jan",
467
- "Feb",
468
- "Mar",
469
- "Apr",
470
- "May",
471
- "Jun",
472
- "Jul",
473
- "Aug",
474
- "Sep",
475
- "Oct",
476
- "Nov",
477
- "Dec"
478
- ],
479
- wide: [
480
- "January",
481
- "February",
482
- "March",
483
- "April",
484
- "May",
485
- "June",
486
- "July",
487
- "August",
488
- "September",
489
- "October",
490
- "November",
491
- "December"
492
- ]
493
- }, to = {
494
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
495
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
496
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
497
- wide: [
498
- "Sunday",
499
- "Monday",
500
- "Tuesday",
501
- "Wednesday",
502
- "Thursday",
503
- "Friday",
504
- "Saturday"
505
- ]
506
- }, no = {
507
- narrow: {
508
- am: "a",
509
- pm: "p",
510
- midnight: "mi",
511
- noon: "n",
512
- morning: "morning",
513
- afternoon: "afternoon",
514
- evening: "evening",
515
- night: "night"
516
- },
517
- abbreviated: {
518
- am: "AM",
519
- pm: "PM",
520
- midnight: "midnight",
521
- noon: "noon",
522
- morning: "morning",
523
- afternoon: "afternoon",
524
- evening: "evening",
525
- night: "night"
526
- },
527
- wide: {
528
- am: "a.m.",
529
- pm: "p.m.",
530
- midnight: "midnight",
531
- noon: "noon",
532
- morning: "morning",
533
- afternoon: "afternoon",
534
- evening: "evening",
535
- night: "night"
536
- }
537
- }, oo = {
538
- narrow: {
539
- am: "a",
540
- pm: "p",
541
- midnight: "mi",
542
- noon: "n",
543
- morning: "in the morning",
544
- afternoon: "in the afternoon",
545
- evening: "in the evening",
546
- night: "at night"
547
- },
548
- abbreviated: {
549
- am: "AM",
550
- pm: "PM",
551
- midnight: "midnight",
552
- noon: "noon",
553
- morning: "in the morning",
554
- afternoon: "in the afternoon",
555
- evening: "in the evening",
556
- night: "at night"
557
- },
558
- wide: {
559
- am: "a.m.",
560
- pm: "p.m.",
561
- midnight: "midnight",
562
- noon: "noon",
563
- morning: "in the morning",
564
- afternoon: "in the afternoon",
565
- evening: "in the evening",
566
- night: "at night"
567
- }
568
- }, ro = (e, t) => {
569
- const o = Number(e), n = o % 100;
570
- if (n > 20 || n < 10)
571
- switch (n % 10) {
572
- case 1:
573
- return o + "st";
574
- case 2:
575
- return o + "nd";
576
- case 3:
577
- return o + "rd";
578
- }
579
- return o + "th";
580
- }, ao = {
581
- ordinalNumber: ro,
582
- era: ge({
583
- values: Kn,
584
- defaultWidth: "wide"
585
- }),
586
- quarter: ge({
587
- values: Jn,
588
- defaultWidth: "wide",
589
- argumentCallback: (e) => e - 1
590
- }),
591
- month: ge({
592
- values: eo,
593
- defaultWidth: "wide"
594
- }),
595
- day: ge({
596
- values: to,
597
- defaultWidth: "wide"
598
- }),
599
- dayPeriod: ge({
600
- values: no,
601
- defaultWidth: "wide",
602
- formattingValues: oo,
603
- defaultFormattingWidth: "wide"
604
- })
605
- };
606
- function pe(e) {
607
- return (t, o = {}) => {
608
- const n = o.width, r = n && e.matchPatterns[n] || e.matchPatterns[e.defaultMatchWidth], s = t.match(r);
609
- if (!s)
610
- return null;
611
- const a = s[0], i = n && e.parsePatterns[n] || e.parsePatterns[e.defaultParseWidth], c = Array.isArray(i) ? io(i, (u) => u.test(a)) : (
612
- // [TODO] -- I challenge you to fix the type
613
- so(i, (u) => u.test(a))
614
- );
615
- let d;
616
- d = e.valueCallback ? e.valueCallback(c) : c, d = o.valueCallback ? (
617
- // [TODO] -- I challenge you to fix the type
618
- o.valueCallback(d)
619
- ) : d;
620
- const f = t.slice(a.length);
621
- return { value: d, rest: f };
622
- };
623
- }
624
- function so(e, t) {
625
- for (const o in e)
626
- if (Object.prototype.hasOwnProperty.call(e, o) && t(e[o]))
627
- return o;
628
- }
629
- function io(e, t) {
630
- for (let o = 0; o < e.length; o++)
631
- if (t(e[o]))
632
- return o;
633
- }
634
- function en(e) {
635
- return (t, o = {}) => {
636
- const n = t.match(e.matchPattern);
637
- if (!n) return null;
638
- const r = n[0], s = t.match(e.parsePattern);
639
- if (!s) return null;
640
- let a = e.valueCallback ? e.valueCallback(s[0]) : s[0];
641
- a = o.valueCallback ? o.valueCallback(a) : a;
642
- const i = t.slice(r.length);
643
- return { value: a, rest: i };
644
- };
645
- }
646
- const co = /^(\d+)(th|st|nd|rd)?/i, uo = /\d+/i, lo = {
647
- narrow: /^(b|a)/i,
648
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
649
- wide: /^(before christ|before common era|anno domini|common era)/i
650
- }, fo = {
651
- any: [/^b/i, /^(a|c)/i]
652
- }, mo = {
653
- narrow: /^[1234]/i,
654
- abbreviated: /^q[1234]/i,
655
- wide: /^[1234](th|st|nd|rd)? quarter/i
656
- }, ho = {
657
- any: [/1/i, /2/i, /3/i, /4/i]
658
- }, yo = {
659
- narrow: /^[jfmasond]/i,
660
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
661
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
662
- }, go = {
663
- narrow: [
664
- /^j/i,
665
- /^f/i,
666
- /^m/i,
667
- /^a/i,
668
- /^m/i,
669
- /^j/i,
670
- /^j/i,
671
- /^a/i,
672
- /^s/i,
673
- /^o/i,
674
- /^n/i,
675
- /^d/i
676
- ],
677
- any: [
678
- /^ja/i,
679
- /^f/i,
680
- /^mar/i,
681
- /^ap/i,
682
- /^may/i,
683
- /^jun/i,
684
- /^jul/i,
685
- /^au/i,
686
- /^s/i,
687
- /^o/i,
688
- /^n/i,
689
- /^d/i
690
- ]
691
- }, po = {
692
- narrow: /^[smtwf]/i,
693
- short: /^(su|mo|tu|we|th|fr|sa)/i,
694
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
695
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
696
- }, wo = {
697
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
698
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
699
- }, bo = {
700
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
701
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
702
- }, Mo = {
703
- any: {
704
- am: /^a/i,
705
- pm: /^p/i,
706
- midnight: /^mi/i,
707
- noon: /^no/i,
708
- morning: /morning/i,
709
- afternoon: /afternoon/i,
710
- evening: /evening/i,
711
- night: /night/i
712
- }
713
- }, Do = {
714
- ordinalNumber: en({
715
- matchPattern: co,
716
- parsePattern: uo,
717
- valueCallback: (e) => parseInt(e, 10)
718
- }),
719
- era: pe({
720
- matchPatterns: lo,
721
- defaultMatchWidth: "wide",
722
- parsePatterns: fo,
723
- defaultParseWidth: "any"
724
- }),
725
- quarter: pe({
726
- matchPatterns: mo,
727
- defaultMatchWidth: "wide",
728
- parsePatterns: ho,
729
- defaultParseWidth: "any",
730
- valueCallback: (e) => e + 1
731
- }),
732
- month: pe({
733
- matchPatterns: yo,
734
- defaultMatchWidth: "wide",
735
- parsePatterns: go,
736
- defaultParseWidth: "any"
737
- }),
738
- day: pe({
739
- matchPatterns: po,
740
- defaultMatchWidth: "wide",
741
- parsePatterns: wo,
742
- defaultParseWidth: "any"
743
- }),
744
- dayPeriod: pe({
745
- matchPatterns: bo,
746
- defaultMatchWidth: "any",
747
- parsePatterns: Mo,
748
- defaultParseWidth: "any"
749
- })
750
- }, Wt = {
751
- code: "en-US",
752
- formatDistance: zn,
753
- formatLong: Qn,
754
- formatRelative: Zn,
755
- localize: ao,
756
- match: Do,
757
- options: {
758
- weekStartsOn: 0,
759
- firstWeekContainsDate: 1
760
- }
761
- };
762
- function vo(e, t) {
763
- const o = F(e, t?.in);
764
- return Qt(o, Kt(o)) + 1;
765
- }
766
- function tn(e, t) {
767
- const o = F(e, t?.in), n = +Ke(o) - +Pn(o);
768
- return Math.round(n / zt) + 1;
769
- }
770
- function nn(e, t) {
771
- const o = F(e, t?.in), n = o.getFullYear(), r = et(), s = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, a = Q(t?.in || e, 0);
772
- a.setFullYear(n + 1, 0, s), a.setHours(0, 0, 0, 0);
773
- const i = ze(a, t), c = Q(t?.in || e, 0);
774
- c.setFullYear(n, 0, s), c.setHours(0, 0, 0, 0);
775
- const d = ze(c, t);
776
- return +o >= +i ? n + 1 : +o >= +d ? n : n - 1;
777
- }
778
- function ko(e, t) {
779
- const o = et(), n = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? o.firstWeekContainsDate ?? o.locale?.options?.firstWeekContainsDate ?? 1, r = nn(e, t), s = Q(t?.in || e, 0);
780
- return s.setFullYear(r, 0, n), s.setHours(0, 0, 0, 0), ze(s, t);
781
- }
782
- function on(e, t) {
783
- const o = F(e, t?.in), n = +ze(o, t) - +ko(o, t);
784
- return Math.round(n / zt) + 1;
785
- }
786
- function _(e, t) {
787
- const o = e < 0 ? "-" : "", n = Math.abs(e).toString().padStart(t, "0");
788
- return o + n;
789
- }
790
- const Te = {
791
- // Year
792
- y(e, t) {
793
- const o = e.getFullYear(), n = o > 0 ? o : 1 - o;
794
- return _(t === "yy" ? n % 100 : n, t.length);
795
- },
796
- // Month
797
- M(e, t) {
798
- const o = e.getMonth();
799
- return t === "M" ? String(o + 1) : _(o + 1, 2);
800
- },
801
- // Day of the month
802
- d(e, t) {
803
- return _(e.getDate(), t.length);
804
- },
805
- // AM or PM
806
- a(e, t) {
807
- const o = e.getHours() / 12 >= 1 ? "pm" : "am";
808
- switch (t) {
809
- case "a":
810
- case "aa":
811
- return o.toUpperCase();
812
- case "aaa":
813
- return o;
814
- case "aaaaa":
815
- return o[0];
816
- case "aaaa":
817
- default:
818
- return o === "am" ? "a.m." : "p.m.";
819
- }
820
- },
821
- // Hour [1-12]
822
- h(e, t) {
823
- return _(e.getHours() % 12 || 12, t.length);
824
- },
825
- // Hour [0-23]
826
- H(e, t) {
827
- return _(e.getHours(), t.length);
828
- },
829
- // Minute
830
- m(e, t) {
831
- return _(e.getMinutes(), t.length);
832
- },
833
- // Second
834
- s(e, t) {
835
- return _(e.getSeconds(), t.length);
836
- },
837
- // Fraction of second
838
- S(e, t) {
839
- const o = t.length, n = e.getMilliseconds(), r = Math.trunc(
840
- n * Math.pow(10, o - 3)
841
- );
842
- return _(r, t.length);
843
- }
844
- }, Re = {
845
- midnight: "midnight",
846
- noon: "noon",
847
- morning: "morning",
848
- afternoon: "afternoon",
849
- evening: "evening",
850
- night: "night"
851
- }, Ft = {
852
- // Era
853
- G: function(e, t, o) {
854
- const n = e.getFullYear() > 0 ? 1 : 0;
855
- switch (t) {
856
- // AD, BC
857
- case "G":
858
- case "GG":
859
- case "GGG":
860
- return o.era(n, { width: "abbreviated" });
861
- // A, B
862
- case "GGGGG":
863
- return o.era(n, { width: "narrow" });
864
- // Anno Domini, Before Christ
865
- case "GGGG":
866
- default:
867
- return o.era(n, { width: "wide" });
868
- }
869
- },
870
- // Year
871
- y: function(e, t, o) {
872
- if (t === "yo") {
873
- const n = e.getFullYear(), r = n > 0 ? n : 1 - n;
874
- return o.ordinalNumber(r, { unit: "year" });
875
- }
876
- return Te.y(e, t);
877
- },
878
- // Local week-numbering year
879
- Y: function(e, t, o, n) {
880
- const r = nn(e, n), s = r > 0 ? r : 1 - r;
881
- if (t === "YY") {
882
- const a = s % 100;
883
- return _(a, 2);
884
- }
885
- return t === "Yo" ? o.ordinalNumber(s, { unit: "year" }) : _(s, t.length);
886
- },
887
- // ISO week-numbering year
888
- R: function(e, t) {
889
- const o = Xt(e);
890
- return _(o, t.length);
891
- },
892
- // Extended year. This is a single number designating the year of this calendar system.
893
- // The main difference between `y` and `u` localizers are B.C. years:
894
- // | Year | `y` | `u` |
895
- // |------|-----|-----|
896
- // | AC 1 | 1 | 1 |
897
- // | BC 1 | 1 | 0 |
898
- // | BC 2 | 2 | -1 |
899
- // Also `yy` always returns the last two digits of a year,
900
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
901
- u: function(e, t) {
902
- const o = e.getFullYear();
903
- return _(o, t.length);
904
- },
905
- // Quarter
906
- Q: function(e, t, o) {
907
- const n = Math.ceil((e.getMonth() + 1) / 3);
908
- switch (t) {
909
- // 1, 2, 3, 4
910
- case "Q":
911
- return String(n);
912
- // 01, 02, 03, 04
913
- case "QQ":
914
- return _(n, 2);
915
- // 1st, 2nd, 3rd, 4th
916
- case "Qo":
917
- return o.ordinalNumber(n, { unit: "quarter" });
918
- // Q1, Q2, Q3, Q4
919
- case "QQQ":
920
- return o.quarter(n, {
921
- width: "abbreviated",
922
- context: "formatting"
923
- });
924
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
925
- case "QQQQQ":
926
- return o.quarter(n, {
927
- width: "narrow",
928
- context: "formatting"
929
- });
930
- // 1st quarter, 2nd quarter, ...
931
- case "QQQQ":
932
- default:
933
- return o.quarter(n, {
934
- width: "wide",
935
- context: "formatting"
936
- });
937
- }
938
- },
939
- // Stand-alone quarter
940
- q: function(e, t, o) {
941
- const n = Math.ceil((e.getMonth() + 1) / 3);
942
- switch (t) {
943
- // 1, 2, 3, 4
944
- case "q":
945
- return String(n);
946
- // 01, 02, 03, 04
947
- case "qq":
948
- return _(n, 2);
949
- // 1st, 2nd, 3rd, 4th
950
- case "qo":
951
- return o.ordinalNumber(n, { unit: "quarter" });
952
- // Q1, Q2, Q3, Q4
953
- case "qqq":
954
- return o.quarter(n, {
955
- width: "abbreviated",
956
- context: "standalone"
957
- });
958
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
959
- case "qqqqq":
960
- return o.quarter(n, {
961
- width: "narrow",
962
- context: "standalone"
963
- });
964
- // 1st quarter, 2nd quarter, ...
965
- case "qqqq":
966
- default:
967
- return o.quarter(n, {
968
- width: "wide",
969
- context: "standalone"
970
- });
971
- }
972
- },
973
- // Month
974
- M: function(e, t, o) {
975
- const n = e.getMonth();
976
- switch (t) {
977
- case "M":
978
- case "MM":
979
- return Te.M(e, t);
980
- // 1st, 2nd, ..., 12th
981
- case "Mo":
982
- return o.ordinalNumber(n + 1, { unit: "month" });
983
- // Jan, Feb, ..., Dec
984
- case "MMM":
985
- return o.month(n, {
986
- width: "abbreviated",
987
- context: "formatting"
988
- });
989
- // J, F, ..., D
990
- case "MMMMM":
991
- return o.month(n, {
992
- width: "narrow",
993
- context: "formatting"
994
- });
995
- // January, February, ..., December
996
- case "MMMM":
997
- default:
998
- return o.month(n, { width: "wide", context: "formatting" });
999
- }
1000
- },
1001
- // Stand-alone month
1002
- L: function(e, t, o) {
1003
- const n = e.getMonth();
1004
- switch (t) {
1005
- // 1, 2, ..., 12
1006
- case "L":
1007
- return String(n + 1);
1008
- // 01, 02, ..., 12
1009
- case "LL":
1010
- return _(n + 1, 2);
1011
- // 1st, 2nd, ..., 12th
1012
- case "Lo":
1013
- return o.ordinalNumber(n + 1, { unit: "month" });
1014
- // Jan, Feb, ..., Dec
1015
- case "LLL":
1016
- return o.month(n, {
1017
- width: "abbreviated",
1018
- context: "standalone"
1019
- });
1020
- // J, F, ..., D
1021
- case "LLLLL":
1022
- return o.month(n, {
1023
- width: "narrow",
1024
- context: "standalone"
1025
- });
1026
- // January, February, ..., December
1027
- case "LLLL":
1028
- default:
1029
- return o.month(n, { width: "wide", context: "standalone" });
1030
- }
1031
- },
1032
- // Local week of year
1033
- w: function(e, t, o, n) {
1034
- const r = on(e, n);
1035
- return t === "wo" ? o.ordinalNumber(r, { unit: "week" }) : _(r, t.length);
1036
- },
1037
- // ISO week of year
1038
- I: function(e, t, o) {
1039
- const n = tn(e);
1040
- return t === "Io" ? o.ordinalNumber(n, { unit: "week" }) : _(n, t.length);
1041
- },
1042
- // Day of the month
1043
- d: function(e, t, o) {
1044
- return t === "do" ? o.ordinalNumber(e.getDate(), { unit: "date" }) : Te.d(e, t);
1045
- },
1046
- // Day of year
1047
- D: function(e, t, o) {
1048
- const n = vo(e);
1049
- return t === "Do" ? o.ordinalNumber(n, { unit: "dayOfYear" }) : _(n, t.length);
1050
- },
1051
- // Day of week
1052
- E: function(e, t, o) {
1053
- const n = e.getDay();
1054
- switch (t) {
1055
- // Tue
1056
- case "E":
1057
- case "EE":
1058
- case "EEE":
1059
- return o.day(n, {
1060
- width: "abbreviated",
1061
- context: "formatting"
1062
- });
1063
- // T
1064
- case "EEEEE":
1065
- return o.day(n, {
1066
- width: "narrow",
1067
- context: "formatting"
1068
- });
1069
- // Tu
1070
- case "EEEEEE":
1071
- return o.day(n, {
1072
- width: "short",
1073
- context: "formatting"
1074
- });
1075
- // Tuesday
1076
- case "EEEE":
1077
- default:
1078
- return o.day(n, {
1079
- width: "wide",
1080
- context: "formatting"
1081
- });
1082
- }
1083
- },
1084
- // Local day of week
1085
- e: function(e, t, o, n) {
1086
- const r = e.getDay(), s = (r - n.weekStartsOn + 8) % 7 || 7;
1087
- switch (t) {
1088
- // Numerical value (Nth day of week with current locale or weekStartsOn)
1089
- case "e":
1090
- return String(s);
1091
- // Padded numerical value
1092
- case "ee":
1093
- return _(s, 2);
1094
- // 1st, 2nd, ..., 7th
1095
- case "eo":
1096
- return o.ordinalNumber(s, { unit: "day" });
1097
- case "eee":
1098
- return o.day(r, {
1099
- width: "abbreviated",
1100
- context: "formatting"
1101
- });
1102
- // T
1103
- case "eeeee":
1104
- return o.day(r, {
1105
- width: "narrow",
1106
- context: "formatting"
1107
- });
1108
- // Tu
1109
- case "eeeeee":
1110
- return o.day(r, {
1111
- width: "short",
1112
- context: "formatting"
1113
- });
1114
- // Tuesday
1115
- case "eeee":
1116
- default:
1117
- return o.day(r, {
1118
- width: "wide",
1119
- context: "formatting"
1120
- });
1121
- }
1122
- },
1123
- // Stand-alone local day of week
1124
- c: function(e, t, o, n) {
1125
- const r = e.getDay(), s = (r - n.weekStartsOn + 8) % 7 || 7;
1126
- switch (t) {
1127
- // Numerical value (same as in `e`)
1128
- case "c":
1129
- return String(s);
1130
- // Padded numerical value
1131
- case "cc":
1132
- return _(s, t.length);
1133
- // 1st, 2nd, ..., 7th
1134
- case "co":
1135
- return o.ordinalNumber(s, { unit: "day" });
1136
- case "ccc":
1137
- return o.day(r, {
1138
- width: "abbreviated",
1139
- context: "standalone"
1140
- });
1141
- // T
1142
- case "ccccc":
1143
- return o.day(r, {
1144
- width: "narrow",
1145
- context: "standalone"
1146
- });
1147
- // Tu
1148
- case "cccccc":
1149
- return o.day(r, {
1150
- width: "short",
1151
- context: "standalone"
1152
- });
1153
- // Tuesday
1154
- case "cccc":
1155
- default:
1156
- return o.day(r, {
1157
- width: "wide",
1158
- context: "standalone"
1159
- });
1160
- }
1161
- },
1162
- // ISO day of week
1163
- i: function(e, t, o) {
1164
- const n = e.getDay(), r = n === 0 ? 7 : n;
1165
- switch (t) {
1166
- // 2
1167
- case "i":
1168
- return String(r);
1169
- // 02
1170
- case "ii":
1171
- return _(r, t.length);
1172
- // 2nd
1173
- case "io":
1174
- return o.ordinalNumber(r, { unit: "day" });
1175
- // Tue
1176
- case "iii":
1177
- return o.day(n, {
1178
- width: "abbreviated",
1179
- context: "formatting"
1180
- });
1181
- // T
1182
- case "iiiii":
1183
- return o.day(n, {
1184
- width: "narrow",
1185
- context: "formatting"
1186
- });
1187
- // Tu
1188
- case "iiiiii":
1189
- return o.day(n, {
1190
- width: "short",
1191
- context: "formatting"
1192
- });
1193
- // Tuesday
1194
- case "iiii":
1195
- default:
1196
- return o.day(n, {
1197
- width: "wide",
1198
- context: "formatting"
1199
- });
1200
- }
1201
- },
1202
- // AM or PM
1203
- a: function(e, t, o) {
1204
- const r = e.getHours() / 12 >= 1 ? "pm" : "am";
1205
- switch (t) {
1206
- case "a":
1207
- case "aa":
1208
- return o.dayPeriod(r, {
1209
- width: "abbreviated",
1210
- context: "formatting"
1211
- });
1212
- case "aaa":
1213
- return o.dayPeriod(r, {
1214
- width: "abbreviated",
1215
- context: "formatting"
1216
- }).toLowerCase();
1217
- case "aaaaa":
1218
- return o.dayPeriod(r, {
1219
- width: "narrow",
1220
- context: "formatting"
1221
- });
1222
- case "aaaa":
1223
- default:
1224
- return o.dayPeriod(r, {
1225
- width: "wide",
1226
- context: "formatting"
1227
- });
1228
- }
1229
- },
1230
- // AM, PM, midnight, noon
1231
- b: function(e, t, o) {
1232
- const n = e.getHours();
1233
- let r;
1234
- switch (n === 12 ? r = Re.noon : n === 0 ? r = Re.midnight : r = n / 12 >= 1 ? "pm" : "am", t) {
1235
- case "b":
1236
- case "bb":
1237
- return o.dayPeriod(r, {
1238
- width: "abbreviated",
1239
- context: "formatting"
1240
- });
1241
- case "bbb":
1242
- return o.dayPeriod(r, {
1243
- width: "abbreviated",
1244
- context: "formatting"
1245
- }).toLowerCase();
1246
- case "bbbbb":
1247
- return o.dayPeriod(r, {
1248
- width: "narrow",
1249
- context: "formatting"
1250
- });
1251
- case "bbbb":
1252
- default:
1253
- return o.dayPeriod(r, {
1254
- width: "wide",
1255
- context: "formatting"
1256
- });
1257
- }
1258
- },
1259
- // in the morning, in the afternoon, in the evening, at night
1260
- B: function(e, t, o) {
1261
- const n = e.getHours();
1262
- let r;
1263
- switch (n >= 17 ? r = Re.evening : n >= 12 ? r = Re.afternoon : n >= 4 ? r = Re.morning : r = Re.night, t) {
1264
- case "B":
1265
- case "BB":
1266
- case "BBB":
1267
- return o.dayPeriod(r, {
1268
- width: "abbreviated",
1269
- context: "formatting"
1270
- });
1271
- case "BBBBB":
1272
- return o.dayPeriod(r, {
1273
- width: "narrow",
1274
- context: "formatting"
1275
- });
1276
- case "BBBB":
1277
- default:
1278
- return o.dayPeriod(r, {
1279
- width: "wide",
1280
- context: "formatting"
1281
- });
1282
- }
1283
- },
1284
- // Hour [1-12]
1285
- h: function(e, t, o) {
1286
- if (t === "ho") {
1287
- let n = e.getHours() % 12;
1288
- return n === 0 && (n = 12), o.ordinalNumber(n, { unit: "hour" });
1289
- }
1290
- return Te.h(e, t);
1291
- },
1292
- // Hour [0-23]
1293
- H: function(e, t, o) {
1294
- return t === "Ho" ? o.ordinalNumber(e.getHours(), { unit: "hour" }) : Te.H(e, t);
1295
- },
1296
- // Hour [0-11]
1297
- K: function(e, t, o) {
1298
- const n = e.getHours() % 12;
1299
- return t === "Ko" ? o.ordinalNumber(n, { unit: "hour" }) : _(n, t.length);
1300
- },
1301
- // Hour [1-24]
1302
- k: function(e, t, o) {
1303
- let n = e.getHours();
1304
- return n === 0 && (n = 24), t === "ko" ? o.ordinalNumber(n, { unit: "hour" }) : _(n, t.length);
1305
- },
1306
- // Minute
1307
- m: function(e, t, o) {
1308
- return t === "mo" ? o.ordinalNumber(e.getMinutes(), { unit: "minute" }) : Te.m(e, t);
1309
- },
1310
- // Second
1311
- s: function(e, t, o) {
1312
- return t === "so" ? o.ordinalNumber(e.getSeconds(), { unit: "second" }) : Te.s(e, t);
1313
- },
1314
- // Fraction of second
1315
- S: function(e, t) {
1316
- return Te.S(e, t);
1317
- },
1318
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1319
- X: function(e, t, o) {
1320
- const n = e.getTimezoneOffset();
1321
- if (n === 0)
1322
- return "Z";
1323
- switch (t) {
1324
- // Hours and optional minutes
1325
- case "X":
1326
- return Bt(n);
1327
- // Hours, minutes and optional seconds without `:` delimiter
1328
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1329
- // so this token always has the same output as `XX`
1330
- case "XXXX":
1331
- case "XX":
1332
- return Fe(n);
1333
- // Hours, minutes and optional seconds with `:` delimiter
1334
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1335
- // so this token always has the same output as `XXX`
1336
- case "XXXXX":
1337
- case "XXX":
1338
- // Hours and minutes with `:` delimiter
1339
- default:
1340
- return Fe(n, ":");
1341
- }
1342
- },
1343
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1344
- x: function(e, t, o) {
1345
- const n = e.getTimezoneOffset();
1346
- switch (t) {
1347
- // Hours and optional minutes
1348
- case "x":
1349
- return Bt(n);
1350
- // Hours, minutes and optional seconds without `:` delimiter
1351
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1352
- // so this token always has the same output as `xx`
1353
- case "xxxx":
1354
- case "xx":
1355
- return Fe(n);
1356
- // Hours, minutes and optional seconds with `:` delimiter
1357
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1358
- // so this token always has the same output as `xxx`
1359
- case "xxxxx":
1360
- case "xxx":
1361
- // Hours and minutes with `:` delimiter
1362
- default:
1363
- return Fe(n, ":");
1364
- }
1365
- },
1366
- // Timezone (GMT)
1367
- O: function(e, t, o) {
1368
- const n = e.getTimezoneOffset();
1369
- switch (t) {
1370
- // Short
1371
- case "O":
1372
- case "OO":
1373
- case "OOO":
1374
- return "GMT" + It(n, ":");
1375
- // Long
1376
- case "OOOO":
1377
- default:
1378
- return "GMT" + Fe(n, ":");
1379
- }
1380
- },
1381
- // Timezone (specific non-location)
1382
- z: function(e, t, o) {
1383
- const n = e.getTimezoneOffset();
1384
- switch (t) {
1385
- // Short
1386
- case "z":
1387
- case "zz":
1388
- case "zzz":
1389
- return "GMT" + It(n, ":");
1390
- // Long
1391
- case "zzzz":
1392
- default:
1393
- return "GMT" + Fe(n, ":");
1394
- }
1395
- },
1396
- // Seconds timestamp
1397
- t: function(e, t, o) {
1398
- const n = Math.trunc(+e / 1e3);
1399
- return _(n, t.length);
1400
- },
1401
- // Milliseconds timestamp
1402
- T: function(e, t, o) {
1403
- return _(+e, t.length);
1404
- }
1405
- };
1406
- function It(e, t = "") {
1407
- const o = e > 0 ? "-" : "+", n = Math.abs(e), r = Math.trunc(n / 60), s = n % 60;
1408
- return s === 0 ? o + String(r) : o + String(r) + t + _(s, 2);
1409
- }
1410
- function Bt(e, t) {
1411
- return e % 60 === 0 ? (e > 0 ? "-" : "+") + _(Math.abs(e) / 60, 2) : Fe(e, t);
1412
- }
1413
- function Fe(e, t = "") {
1414
- const o = e > 0 ? "-" : "+", n = Math.abs(e), r = _(Math.trunc(n / 60), 2), s = _(n % 60, 2);
1415
- return o + r + t + s;
1416
- }
1417
- const jt = (e, t) => {
1418
- switch (e) {
1419
- case "P":
1420
- return t.date({ width: "short" });
1421
- case "PP":
1422
- return t.date({ width: "medium" });
1423
- case "PPP":
1424
- return t.date({ width: "long" });
1425
- case "PPPP":
1426
- default:
1427
- return t.date({ width: "full" });
1428
- }
1429
- }, rn = (e, t) => {
1430
- switch (e) {
1431
- case "p":
1432
- return t.time({ width: "short" });
1433
- case "pp":
1434
- return t.time({ width: "medium" });
1435
- case "ppp":
1436
- return t.time({ width: "long" });
1437
- case "pppp":
1438
- default:
1439
- return t.time({ width: "full" });
1440
- }
1441
- }, Oo = (e, t) => {
1442
- const o = e.match(/(P+)(p+)?/) || [], n = o[1], r = o[2];
1443
- if (!r)
1444
- return jt(e, t);
1445
- let s;
1446
- switch (n) {
1447
- case "P":
1448
- s = t.dateTime({ width: "short" });
1449
- break;
1450
- case "PP":
1451
- s = t.dateTime({ width: "medium" });
1452
- break;
1453
- case "PPP":
1454
- s = t.dateTime({ width: "long" });
1455
- break;
1456
- case "PPPP":
1457
- default:
1458
- s = t.dateTime({ width: "full" });
1459
- break;
1460
- }
1461
- return s.replace("{{date}}", jt(n, t)).replace("{{time}}", rn(r, t));
1462
- }, Wo = {
1463
- p: rn,
1464
- P: Oo
1465
- }, So = /^D+$/, Co = /^Y+$/, xo = ["D", "DD", "YY", "YYYY"];
1466
- function No(e) {
1467
- return So.test(e);
1468
- }
1469
- function Po(e) {
1470
- return Co.test(e);
1471
- }
1472
- function To(e, t, o) {
1473
- const n = Yo(e, t, o);
1474
- if (console.warn(n), xo.includes(e)) throw new RangeError(n);
1475
- }
1476
- function Yo(e, t, o) {
1477
- const n = e[0] === "Y" ? "years" : "days of the month";
1478
- return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${o}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
1479
- }
1480
- const Eo = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, _o = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Fo = /^'([^]*?)'?$/, Io = /''/g, Bo = /[a-zA-Z]/;
1481
- function jo(e, t, o) {
1482
- const n = et(), r = o?.locale ?? n.locale ?? Wt, s = o?.firstWeekContainsDate ?? o?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, a = o?.weekStartsOn ?? o?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, i = F(e, o?.in);
1483
- if (!In(i))
1484
- throw new RangeError("Invalid time value");
1485
- let c = t.match(_o).map((f) => {
1486
- const u = f[0];
1487
- if (u === "p" || u === "P") {
1488
- const l = Wo[u];
1489
- return l(f, r.formatLong);
1490
- }
1491
- return f;
1492
- }).join("").match(Eo).map((f) => {
1493
- if (f === "''")
1494
- return { isToken: !1, value: "'" };
1495
- const u = f[0];
1496
- if (u === "'")
1497
- return { isToken: !1, value: Ao(f) };
1498
- if (Ft[u])
1499
- return { isToken: !0, value: f };
1500
- if (u.match(Bo))
1501
- throw new RangeError(
1502
- "Format string contains an unescaped latin alphabet character `" + u + "`"
1503
- );
1504
- return { isToken: !1, value: f };
1505
- });
1506
- r.localize.preprocessor && (c = r.localize.preprocessor(i, c));
1507
- const d = {
1508
- firstWeekContainsDate: s,
1509
- weekStartsOn: a,
1510
- locale: r
1511
- };
1512
- return c.map((f) => {
1513
- if (!f.isToken) return f.value;
1514
- const u = f.value;
1515
- (!o?.useAdditionalWeekYearTokens && Po(u) || !o?.useAdditionalDayOfYearTokens && No(u)) && To(u, t, String(e));
1516
- const l = Ft[u[0]];
1517
- return l(i, u, r.localize, d);
1518
- }).join("");
1519
- }
1520
- function Ao(e) {
1521
- const t = e.match(Fo);
1522
- return t ? t[1].replace(Io, "'") : e;
1523
- }
1524
- function $o(e, t) {
1525
- const o = F(e, t?.in), n = o.getFullYear(), r = o.getMonth(), s = Q(o, 0);
1526
- return s.setFullYear(n, r + 1, 0), s.setHours(0, 0, 0, 0), s.getDate();
1527
- }
1528
- function Ho(e, t) {
1529
- return F(e, t?.in).getMonth();
1530
- }
1531
- function qo(e, t) {
1532
- return F(e, t?.in).getFullYear();
1533
- }
1534
- function Ro(e, t) {
1535
- return +F(e) > +F(t);
1536
- }
1537
- function Lo(e, t) {
1538
- return +F(e) < +F(t);
1539
- }
1540
- function zo(e, t, o) {
1541
- const [n, r] = Ge(
1542
- o?.in,
1543
- e,
1544
- t
1545
- );
1546
- return n.getFullYear() === r.getFullYear() && n.getMonth() === r.getMonth();
1547
- }
1548
- function Go(e, t, o) {
1549
- const [n, r] = Ge(
1550
- o?.in,
1551
- e,
1552
- t
1553
- );
1554
- return n.getFullYear() === r.getFullYear();
1555
- }
1556
- function Vo(e, t, o) {
1557
- const n = F(e, o?.in), r = n.getFullYear(), s = n.getDate(), a = Q(e, 0);
1558
- a.setFullYear(r, t, 15), a.setHours(0, 0, 0, 0);
1559
- const i = $o(a);
1560
- return n.setMonth(t, Math.min(s, i)), n;
1561
- }
1562
- function Xo(e, t, o) {
1563
- const n = F(e, o?.in);
1564
- return isNaN(+n) ? Q(e, NaN) : (n.setFullYear(t), n);
1565
- }
1566
- const At = 5, Qo = 4;
1567
- function Uo(e, t) {
1568
- const o = t.startOfMonth(e), n = o.getDay() > 0 ? o.getDay() : 7, r = t.addDays(e, -n + 1), s = t.addDays(r, At * 7 - 1);
1569
- return t.getMonth(e) === t.getMonth(s) ? At : Qo;
1570
- }
1571
- function an(e, t) {
1572
- const o = t.startOfMonth(e), n = o.getDay();
1573
- return n === 1 ? o : n === 0 ? t.addDays(o, -6) : t.addDays(o, -1 * (n - 1));
1574
- }
1575
- function Zo(e, t) {
1576
- const o = an(e, t), n = Uo(e, t);
1577
- return t.addDays(o, n * 7 - 1);
1578
- }
1579
- class ie {
1580
- /**
1581
- * Creates an instance of `DateLib`.
1582
- *
1583
- * @param options Configuration options for the date library.
1584
- * @param overrides Custom overrides for the date library functions.
1585
- */
1586
- constructor(t, o) {
1587
- this.Date = Date, this.today = () => this.overrides?.today ? this.overrides.today() : this.options.timeZone ? Oe.tz(this.options.timeZone) : new this.Date(), this.newDate = (n, r, s) => this.overrides?.newDate ? this.overrides.newDate(n, r, s) : this.options.timeZone ? new Oe(n, r, s, this.options.timeZone) : new Date(n, r, s), 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) : Vt(n, r), this.addWeeks = (n, r) => this.overrides?.addWeeks ? this.overrides.addWeeks(n, r) : Tn(n, r), this.addYears = (n, r) => this.overrides?.addYears ? this.overrides.addYears(n, r) : Yn(n, r), this.differenceInCalendarDays = (n, r) => this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(n, r) : Qt(n, r), this.differenceInCalendarMonths = (n, r) => this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(n, r) : Bn(n, r), this.eachMonthOfInterval = (n) => this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(n) : An(n), this.eachYearOfInterval = (n) => {
1588
- const r = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(n) : qn(n), s = new Set(r.map((i) => this.getYear(i)));
1589
- if (s.size === r.length)
1590
- return r;
1591
- const a = [];
1592
- return s.forEach((i) => {
1593
- a.push(new Date(i, 0, 1));
1594
- }), a;
1595
- }, this.endOfBroadcastWeek = (n) => this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(n) : Zo(n, this), this.endOfISOWeek = (n) => this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(n) : Rn(n), this.endOfMonth = (n) => this.overrides?.endOfMonth ? this.overrides.endOfMonth(n) : jn(n), this.endOfWeek = (n, r) => this.overrides?.endOfWeek ? this.overrides.endOfWeek(n, r) : Jt(n, this.options), this.endOfYear = (n) => this.overrides?.endOfYear ? this.overrides.endOfYear(n) : Hn(n), this.format = (n, r, s) => {
1596
- const a = this.overrides?.format ? this.overrides.format(n, r, this.options) : jo(n, r, this.options);
1597
- return this.options.numerals && this.options.numerals !== "latn" ? this.replaceDigits(a) : a;
1598
- }, this.getISOWeek = (n) => this.overrides?.getISOWeek ? this.overrides.getISOWeek(n) : tn(n), this.getMonth = (n, r) => this.overrides?.getMonth ? this.overrides.getMonth(n, this.options) : Ho(n, this.options), this.getYear = (n, r) => this.overrides?.getYear ? this.overrides.getYear(n, this.options) : qo(n, this.options), this.getWeek = (n, r) => this.overrides?.getWeek ? this.overrides.getWeek(n, this.options) : on(n, this.options), this.isAfter = (n, r) => this.overrides?.isAfter ? this.overrides.isAfter(n, r) : Ro(n, r), this.isBefore = (n, r) => this.overrides?.isBefore ? this.overrides.isBefore(n, r) : Lo(n, r), this.isDate = (n) => this.overrides?.isDate ? this.overrides.isDate(n) : Ut(n), this.isSameDay = (n, r) => this.overrides?.isSameDay ? this.overrides.isSameDay(n, r) : Fn(n, r), this.isSameMonth = (n, r) => this.overrides?.isSameMonth ? this.overrides.isSameMonth(n, r) : zo(n, r), this.isSameYear = (n, r) => this.overrides?.isSameYear ? this.overrides.isSameYear(n, r) : Go(n, r), this.max = (n) => this.overrides?.max ? this.overrides.max(n) : En(n), this.min = (n) => this.overrides?.min ? this.overrides.min(n) : _n(n), this.setMonth = (n, r) => this.overrides?.setMonth ? this.overrides.setMonth(n, r) : Vo(n, r), this.setYear = (n, r) => this.overrides?.setYear ? this.overrides.setYear(n, r) : Xo(n, r), this.startOfBroadcastWeek = (n, r) => this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(n, this) : an(n, this), this.startOfDay = (n) => this.overrides?.startOfDay ? this.overrides.startOfDay(n) : Je(n), this.startOfISOWeek = (n) => this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(n) : Ke(n), this.startOfMonth = (n) => this.overrides?.startOfMonth ? this.overrides.startOfMonth(n) : $n(n), this.startOfWeek = (n, r) => this.overrides?.startOfWeek ? this.overrides.startOfWeek(n, this.options) : ze(n, this.options), this.startOfYear = (n) => this.overrides?.startOfYear ? this.overrides.startOfYear(n) : Kt(n), this.options = { locale: Wt, ...t }, this.overrides = o;
1599
- }
1600
- /**
1601
- * Generates a mapping of Arabic digits (0-9) to the target numbering system
1602
- * digits.
1603
- *
1604
- * @since 9.5.0
1605
- * @returns A record mapping Arabic digits to the target numerals.
1606
- */
1607
- getDigitMap() {
1608
- const { numerals: t = "latn" } = this.options, o = new Intl.NumberFormat("en-US", {
1609
- numberingSystem: t
1610
- }), n = {};
1611
- for (let r = 0; r < 10; r++)
1612
- n[r.toString()] = o.format(r);
1613
- return n;
1614
- }
1615
- /**
1616
- * Replaces Arabic digits in a string with the target numbering system digits.
1617
- *
1618
- * @since 9.5.0
1619
- * @param input The string containing Arabic digits.
1620
- * @returns The string with digits replaced.
1621
- */
1622
- replaceDigits(t) {
1623
- const o = this.getDigitMap();
1624
- return t.replace(/\d/g, (n) => o[n] || n);
1625
- }
1626
- /**
1627
- * Formats a number using the configured numbering system.
1628
- *
1629
- * @since 9.5.0
1630
- * @param value The number to format.
1631
- * @returns The formatted number as a string.
1632
- */
1633
- formatNumber(t) {
1634
- return this.replaceDigits(t.toString());
1635
- }
1636
- /**
1637
- * Returns the preferred ordering for month and year labels for the current
1638
- * locale.
1639
- */
1640
- getMonthYearOrder() {
1641
- const t = this.options.locale?.code;
1642
- return t && ie.yearFirstLocales.has(t) ? "year-first" : "month-first";
1643
- }
1644
- /**
1645
- * Formats the month/year pair respecting locale conventions.
1646
- *
1647
- * @since 9.11.0
1648
- */
1649
- formatMonthYear(t) {
1650
- const { locale: o, timeZone: n, numerals: r } = this.options, s = o?.code;
1651
- if (s && ie.yearFirstLocales.has(s))
1652
- try {
1653
- return new Intl.DateTimeFormat(s, {
1654
- month: "long",
1655
- year: "numeric",
1656
- timeZone: n,
1657
- numberingSystem: r
1658
- }).format(t);
1659
- } catch {
1660
- }
1661
- const a = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
1662
- return this.format(t, a);
1663
- }
1664
- }
1665
- ie.yearFirstLocales = /* @__PURE__ */ new Set([
1666
- "eu",
1667
- "hu",
1668
- "ja",
1669
- "ja-Hira",
1670
- "ja-JP",
1671
- "ko",
1672
- "ko-KR",
1673
- "lt",
1674
- "lt-LT",
1675
- "lv",
1676
- "lv-LV",
1677
- "mn",
1678
- "mn-MN",
1679
- "zh",
1680
- "zh-CN",
1681
- "zh-HK",
1682
- "zh-TW"
1683
- ]);
1684
- const be = new ie();
1685
- class sn {
1686
- constructor(t, o, n = be) {
1687
- 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");
1688
- }
1689
- /**
1690
- * Checks if this day is equal to another `CalendarDay`, considering both the
1691
- * date and the displayed month.
1692
- *
1693
- * @param day The `CalendarDay` to compare with.
1694
- * @returns `true` if the days are equal, otherwise `false`.
1695
- */
1696
- isEqualTo(t) {
1697
- return this.dateLib.isSameDay(t.date, this.date) && this.dateLib.isSameMonth(t.displayMonth, this.displayMonth);
1698
- }
1699
- }
1700
- class Ko {
1701
- constructor(t, o) {
1702
- this.date = t, this.weeks = o;
1703
- }
1704
- }
1705
- class Jo {
1706
- constructor(t, o) {
1707
- this.days = o, this.weekNumber = t;
1708
- }
1709
- }
1710
- function er(e) {
1711
- return m.createElement("button", { ...e });
1712
- }
1713
- function tr(e) {
1714
- return m.createElement("span", { ...e });
1715
- }
1716
- function nr(e) {
1717
- const { size: t = 24, orientation: o = "left", className: n } = e;
1718
- return (
1719
- // biome-ignore lint/a11y/noSvgWithoutTitle: handled by the parent component
1720
- m.createElement(
1721
- "svg",
1722
- { className: n, width: t, height: t, viewBox: "0 0 24 24" },
1723
- o === "up" && m.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
1724
- o === "down" && m.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
1725
- o === "left" && m.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
1726
- o === "right" && m.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" })
1727
- )
1728
- );
1729
- }
1730
- function or(e) {
1731
- const { day: t, modifiers: o, ...n } = e;
1732
- return m.createElement("td", { ...n });
1733
- }
1734
- function rr(e) {
1735
- const { day: t, modifiers: o, ...n } = e, r = m.useRef(null);
1736
- return m.useEffect(() => {
1737
- o.focused && r.current?.focus();
1738
- }, [o.focused]), m.createElement("button", { ref: r, ...n });
1739
- }
1740
- var w;
1741
- (function(e) {
1742
- 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";
1743
- })(w || (w = {}));
1744
- var L;
1745
- (function(e) {
1746
- e.disabled = "disabled", e.hidden = "hidden", e.outside = "outside", e.focused = "focused", e.today = "today";
1747
- })(L || (L = {}));
1748
- var le;
1749
- (function(e) {
1750
- e.range_end = "range_end", e.range_middle = "range_middle", e.range_start = "range_start", e.selected = "selected";
1751
- })(le || (le = {}));
1752
- var ae;
1753
- (function(e) {
1754
- 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";
1755
- })(ae || (ae = {}));
1756
- function ar(e) {
1757
- const { options: t, className: o, components: n, classNames: r, ...s } = e, a = [r[w.Dropdown], o].join(" "), i = t?.find(({ value: c }) => c === s.value);
1758
- return m.createElement(
1759
- "span",
1760
- { "data-disabled": s.disabled, className: r[w.DropdownRoot] },
1761
- m.createElement(n.Select, { className: a, ...s }, t?.map(({ value: c, label: d, disabled: f }) => m.createElement(n.Option, { key: c, value: c, disabled: f }, d))),
1762
- m.createElement(
1763
- "span",
1764
- { className: r[w.CaptionLabel], "aria-hidden": !0 },
1765
- i?.label,
1766
- m.createElement(n.Chevron, { orientation: "down", size: 18, className: r[w.Chevron] })
1767
- )
1768
- );
1769
- }
1770
- function sr(e) {
1771
- return m.createElement("div", { ...e });
1772
- }
1773
- function ir(e) {
1774
- return m.createElement("div", { ...e });
1775
- }
1776
- function cr(e) {
1777
- const { calendarMonth: t, displayIndex: o, ...n } = e;
1778
- return m.createElement("div", { ...n }, e.children);
1779
- }
1780
- function ur(e) {
1781
- const { calendarMonth: t, displayIndex: o, ...n } = e;
1782
- return m.createElement("div", { ...n });
1783
- }
1784
- function dr(e) {
1785
- return m.createElement("table", { ...e });
1786
- }
1787
- function lr(e) {
1788
- return m.createElement("div", { ...e });
1789
- }
1790
- const cn = pn(void 0);
1791
- function tt() {
1792
- const e = wn(cn);
1793
- if (e === void 0)
1794
- throw new Error("useDayPicker() must be used within a custom component.");
1795
- return e;
1796
- }
1797
- function fr(e) {
1798
- const { components: t } = tt();
1799
- return m.createElement(t.Dropdown, { ...e });
1800
- }
1801
- function mr(e) {
1802
- const { onPreviousClick: t, onNextClick: o, previousMonth: n, nextMonth: r, ...s } = e, { components: a, classNames: i, labels: { labelPrevious: c, labelNext: d } } = tt(), f = R((l) => {
1803
- r && o?.(l);
1804
- }, [r, o]), u = R((l) => {
1805
- n && t?.(l);
1806
- }, [n, t]);
1807
- return m.createElement(
1808
- "nav",
1809
- { ...s },
1810
- m.createElement(
1811
- a.PreviousMonthButton,
1812
- { type: "button", className: i[w.PreviousMonthButton], tabIndex: n ? void 0 : -1, "aria-disabled": n ? void 0 : !0, "aria-label": c(n), onClick: u },
1813
- m.createElement(a.Chevron, { disabled: n ? void 0 : !0, className: i[w.Chevron], orientation: "left" })
1814
- ),
1815
- m.createElement(
1816
- a.NextMonthButton,
1817
- { type: "button", className: i[w.NextMonthButton], tabIndex: r ? void 0 : -1, "aria-disabled": r ? void 0 : !0, "aria-label": d(r), onClick: f },
1818
- m.createElement(a.Chevron, { disabled: r ? void 0 : !0, orientation: "right", className: i[w.Chevron] })
1819
- )
1820
- );
1821
- }
1822
- function hr(e) {
1823
- const { components: t } = tt();
1824
- return m.createElement(t.Button, { ...e });
1825
- }
1826
- function yr(e) {
1827
- return m.createElement("option", { ...e });
1828
- }
1829
- function gr(e) {
1830
- const { components: t } = tt();
1831
- return m.createElement(t.Button, { ...e });
1832
- }
1833
- function pr(e) {
1834
- const { rootRef: t, ...o } = e;
1835
- return m.createElement("div", { ...o, ref: t });
1836
- }
1837
- function wr(e) {
1838
- return m.createElement("select", { ...e });
1839
- }
1840
- function br(e) {
1841
- const { week: t, ...o } = e;
1842
- return m.createElement("tr", { ...o });
1843
- }
1844
- function Mr(e) {
1845
- return m.createElement("th", { ...e });
1846
- }
1847
- function Dr(e) {
1848
- return m.createElement(
1849
- "thead",
1850
- { "aria-hidden": !0 },
1851
- m.createElement("tr", { ...e })
1852
- );
1853
- }
1854
- function vr(e) {
1855
- const { week: t, ...o } = e;
1856
- return m.createElement("th", { ...o });
1857
- }
1858
- function kr(e) {
1859
- return m.createElement("th", { ...e });
1860
- }
1861
- function Or(e) {
1862
- return m.createElement("tbody", { ...e });
1863
- }
1864
- function Wr(e) {
1865
- const { components: t } = tt();
1866
- return m.createElement(t.Dropdown, { ...e });
1867
- }
1868
- const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1869
- __proto__: null,
1870
- Button: er,
1871
- CaptionLabel: tr,
1872
- Chevron: nr,
1873
- Day: or,
1874
- DayButton: rr,
1875
- Dropdown: ar,
1876
- DropdownNav: sr,
1877
- Footer: ir,
1878
- Month: cr,
1879
- MonthCaption: ur,
1880
- MonthGrid: dr,
1881
- Months: lr,
1882
- MonthsDropdown: fr,
1883
- Nav: mr,
1884
- NextMonthButton: hr,
1885
- Option: yr,
1886
- PreviousMonthButton: gr,
1887
- Root: pr,
1888
- Select: wr,
1889
- Week: br,
1890
- WeekNumber: vr,
1891
- WeekNumberHeader: kr,
1892
- Weekday: Mr,
1893
- Weekdays: Dr,
1894
- Weeks: Or,
1895
- YearsDropdown: Wr
1896
- }, Symbol.toStringTag, { value: "Module" }));
1897
- function We(e, t, o = !1, n = be) {
1898
- let { from: r, to: s } = e;
1899
- const { differenceInCalendarDays: a, isSameDay: i } = n;
1900
- return r && s ? (a(s, r) < 0 && ([r, s] = [s, r]), a(t, r) >= (o ? 1 : 0) && a(s, t) >= (o ? 1 : 0)) : !o && s ? i(s, t) : !o && r ? i(r, t) : !1;
1901
- }
1902
- function St(e) {
1903
- return !!(e && typeof e == "object" && "before" in e && "after" in e);
1904
- }
1905
- function it(e) {
1906
- return !!(e && typeof e == "object" && "from" in e);
1907
- }
1908
- function Ct(e) {
1909
- return !!(e && typeof e == "object" && "after" in e);
1910
- }
1911
- function xt(e) {
1912
- return !!(e && typeof e == "object" && "before" in e);
1913
- }
1914
- function un(e) {
1915
- return !!(e && typeof e == "object" && "dayOfWeek" in e);
1916
- }
1917
- function dn(e, t) {
1918
- return Array.isArray(e) && e.every(t.isDate);
1919
- }
1920
- function Se(e, t, o = be) {
1921
- const n = Array.isArray(t) ? t : [t], { isSameDay: r, differenceInCalendarDays: s, isAfter: a } = o;
1922
- return n.some((i) => {
1923
- if (typeof i == "boolean")
1924
- return i;
1925
- if (o.isDate(i))
1926
- return r(e, i);
1927
- if (dn(i, o))
1928
- return i.includes(e);
1929
- if (it(i))
1930
- return We(i, e, !1, o);
1931
- if (un(i))
1932
- return Array.isArray(i.dayOfWeek) ? i.dayOfWeek.includes(e.getDay()) : i.dayOfWeek === e.getDay();
1933
- if (St(i)) {
1934
- const c = s(i.before, e), d = s(i.after, e), f = c > 0, u = d < 0;
1935
- return a(i.before, i.after) ? u && f : f || u;
1936
- }
1937
- return Ct(i) ? s(e, i.after) > 0 : xt(i) ? s(i.before, e) > 0 : typeof i == "function" ? i(e) : !1;
1938
- });
1939
- }
1940
- function Cr(e, t, o, n, r) {
1941
- const { disabled: s, hidden: a, modifiers: i, showOutsideDays: c, broadcastCalendar: d, today: f = r.today() } = t, { isSameDay: u, isSameMonth: l, startOfMonth: M, isBefore: b, endOfMonth: N, isAfter: O } = r, D = o && M(o), g = n && N(n), p = {
1942
- [L.focused]: [],
1943
- [L.outside]: [],
1944
- [L.disabled]: [],
1945
- [L.hidden]: [],
1946
- [L.today]: []
1947
- }, S = {};
1948
- for (const v of e) {
1949
- const { date: y, displayMonth: k } = v, C = !!(k && !l(y, k)), A = !!(D && b(y, D)), I = !!(g && O(y, g)), G = !!(s && Se(y, s, r)), $ = !!(a && Se(y, a, r)) || A || I || // Broadcast calendar will show outside days as default
1950
- !d && !c && C || d && c === !1 && C, Z = u(y, f);
1951
- C && p.outside.push(v), G && p.disabled.push(v), $ && p.hidden.push(v), Z && p.today.push(v), i && Object.keys(i).forEach((B) => {
1952
- const Ce = i?.[B];
1953
- Ce && Se(y, Ce, r) && (S[B] ? S[B].push(v) : S[B] = [v]);
1954
- });
1955
- }
1956
- return (v) => {
1957
- const y = {
1958
- [L.focused]: !1,
1959
- [L.disabled]: !1,
1960
- [L.hidden]: !1,
1961
- [L.outside]: !1,
1962
- [L.today]: !1
1963
- }, k = {};
1964
- for (const C in p) {
1965
- const A = p[C];
1966
- y[C] = A.some((I) => I === v);
1967
- }
1968
- for (const C in S)
1969
- k[C] = S[C].some((A) => A === v);
1970
- return {
1971
- ...y,
1972
- // custom modifiers should override all the previous ones
1973
- ...k
1974
- };
1975
- };
1976
- }
1977
- function xr(e, t, o = {}) {
1978
- return Object.entries(e).filter(([, r]) => r === !0).reduce((r, [s]) => (o[s] ? r.push(o[s]) : t[L[s]] ? r.push(t[L[s]]) : t[le[s]] && r.push(t[le[s]]), r), [t[w.Day]]);
1979
- }
1980
- function Nr(e) {
1981
- return {
1982
- ...Sr,
1983
- ...e
1984
- };
1985
- }
1986
- function Pr(e) {
1987
- const t = {
1988
- "data-mode": e.mode ?? void 0,
1989
- "data-required": "required" in e ? e.required : void 0,
1990
- "data-multiple-months": e.numberOfMonths && e.numberOfMonths > 1 || void 0,
1991
- "data-week-numbers": e.showWeekNumber || void 0,
1992
- "data-broadcast-calendar": e.broadcastCalendar || void 0,
1993
- "data-nav-layout": e.navLayout || void 0
1994
- };
1995
- return Object.entries(e).forEach(([o, n]) => {
1996
- o.startsWith("data-") && (t[o] = n);
1997
- }), t;
1998
- }
1999
- function Tr() {
2000
- const e = {};
2001
- for (const t in w)
2002
- e[w[t]] = `rdp-${w[t]}`;
2003
- for (const t in L)
2004
- e[L[t]] = `rdp-${L[t]}`;
2005
- for (const t in le)
2006
- e[le[t]] = `rdp-${le[t]}`;
2007
- for (const t in ae)
2008
- e[ae[t]] = `rdp-${ae[t]}`;
2009
- return e;
2010
- }
2011
- function ln(e, t, o) {
2012
- return (o ?? new ie(t)).formatMonthYear(e);
2013
- }
2014
- const Yr = ln;
2015
- function Er(e, t, o) {
2016
- return (o ?? new ie(t)).format(e, "d");
2017
- }
2018
- function _r(e, t = be) {
2019
- return t.format(e, "LLLL");
2020
- }
2021
- function Fr(e, t, o) {
2022
- return (o ?? new ie(t)).format(e, "cccccc");
2023
- }
2024
- function Ir(e, t = be) {
2025
- return e < 10 ? t.formatNumber(`0${e.toLocaleString()}`) : t.formatNumber(`${e.toLocaleString()}`);
2026
- }
2027
- function Br() {
2028
- return "";
2029
- }
2030
- function fn(e, t = be) {
2031
- return t.format(e, "yyyy");
2032
- }
2033
- const jr = fn, Ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2034
- __proto__: null,
2035
- formatCaption: ln,
2036
- formatDay: Er,
2037
- formatMonthCaption: Yr,
2038
- formatMonthDropdown: _r,
2039
- formatWeekNumber: Ir,
2040
- formatWeekNumberHeader: Br,
2041
- formatWeekdayName: Fr,
2042
- formatYearCaption: jr,
2043
- formatYearDropdown: fn
2044
- }, Symbol.toStringTag, { value: "Module" }));
2045
- function $r(e) {
2046
- return e?.formatMonthCaption && !e.formatCaption && (e.formatCaption = e.formatMonthCaption), e?.formatYearCaption && !e.formatYearDropdown && (e.formatYearDropdown = e.formatYearCaption), {
2047
- ...Ar,
2048
- ...e
2049
- };
2050
- }
2051
- function Hr(e, t, o, n, r) {
2052
- const { startOfMonth: s, startOfYear: a, endOfYear: i, eachMonthOfInterval: c, getMonth: d } = r;
2053
- return c({
2054
- start: a(e),
2055
- end: i(e)
2056
- }).map((l) => {
2057
- const M = n.formatMonthDropdown(l, r), b = d(l), N = t && l < s(t) || o && l > s(o) || !1;
2058
- return { value: b, label: M, disabled: N };
2059
- });
2060
- }
2061
- function qr(e, t = {}, o = {}) {
2062
- let n = { ...t?.[w.Day] };
2063
- return Object.entries(e).filter(([, r]) => r === !0).forEach(([r]) => {
2064
- n = {
2065
- ...n,
2066
- ...o?.[r]
2067
- };
2068
- }), n;
2069
- }
2070
- function Rr(e, t, o, n) {
2071
- const r = n ?? e.today(), s = o ? e.startOfBroadcastWeek(r, e) : t ? e.startOfISOWeek(r) : e.startOfWeek(r), a = [];
2072
- for (let i = 0; i < 7; i++) {
2073
- const c = e.addDays(s, i);
2074
- a.push(c);
2075
- }
2076
- return a;
2077
- }
2078
- function Lr(e, t, o, n, r = !1) {
2079
- if (!e || !t)
2080
- return;
2081
- const { startOfYear: s, endOfYear: a, eachYearOfInterval: i, getYear: c } = n, d = s(e), f = a(t), u = i({ start: d, end: f });
2082
- return r && u.reverse(), u.map((l) => {
2083
- const M = o.formatYearDropdown(l, n);
2084
- return {
2085
- value: c(l),
2086
- label: M,
2087
- disabled: !1
2088
- };
2089
- });
2090
- }
2091
- function mn(e, t, o, n) {
2092
- let r = (n ?? new ie(o)).format(e, "PPPP");
2093
- return t.today && (r = `Today, ${r}`), t.selected && (r = `${r}, selected`), r;
2094
- }
2095
- const zr = mn;
2096
- function hn(e, t, o) {
2097
- return (o ?? new ie(t)).formatMonthYear(e);
2098
- }
2099
- const Gr = hn;
2100
- function Vr(e, t, o, n) {
2101
- let r = (n ?? new ie(o)).format(e, "PPPP");
2102
- return t?.today && (r = `Today, ${r}`), r;
2103
- }
2104
- function Xr(e) {
2105
- return "Choose the Month";
2106
- }
2107
- function Qr() {
2108
- return "";
2109
- }
2110
- function Ur(e) {
2111
- return "Go to the Next Month";
2112
- }
2113
- function Zr(e) {
2114
- return "Go to the Previous Month";
2115
- }
2116
- function Kr(e, t, o) {
2117
- return (o ?? new ie(t)).format(e, "cccc");
2118
- }
2119
- function Jr(e, t) {
2120
- return `Week ${e}`;
2121
- }
2122
- function ea(e) {
2123
- return "Week Number";
2124
- }
2125
- function ta(e) {
2126
- return "Choose the Year";
2127
- }
2128
- const na = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2129
- __proto__: null,
2130
- labelCaption: Gr,
2131
- labelDay: zr,
2132
- labelDayButton: mn,
2133
- labelGrid: hn,
2134
- labelGridcell: Vr,
2135
- labelMonthDropdown: Xr,
2136
- labelNav: Qr,
2137
- labelNext: Ur,
2138
- labelPrevious: Zr,
2139
- labelWeekNumber: Jr,
2140
- labelWeekNumberHeader: ea,
2141
- labelWeekday: Kr,
2142
- labelYearDropdown: ta
2143
- }, Symbol.toStringTag, { value: "Module" })), nt = (e) => e instanceof HTMLElement ? e : null, pt = (e) => [
2144
- ...e.querySelectorAll("[data-animated-month]") ?? []
2145
- ], oa = (e) => nt(e.querySelector("[data-animated-month]")), wt = (e) => nt(e.querySelector("[data-animated-caption]")), bt = (e) => nt(e.querySelector("[data-animated-weeks]")), ra = (e) => nt(e.querySelector("[data-animated-nav]")), aa = (e) => nt(e.querySelector("[data-animated-weekdays]"));
2146
- function sa(e, t, { classNames: o, months: n, focused: r, dateLib: s }) {
2147
- const a = Ye(null), i = Ye(n), c = Ye(!1);
2148
- bn(() => {
2149
- const d = i.current;
2150
- if (i.current = n, !t || !e.current || // safety check because the ref can be set to anything by consumers
2151
- !(e.current instanceof HTMLElement) || // validation required for the animation to work as expected
2152
- n.length === 0 || d.length === 0 || n.length !== d.length)
2153
- return;
2154
- const f = s.isSameMonth(n[0].date, d[0].date), u = s.isAfter(n[0].date, d[0].date), l = u ? o[ae.caption_after_enter] : o[ae.caption_before_enter], M = u ? o[ae.weeks_after_enter] : o[ae.weeks_before_enter], b = a.current, N = e.current.cloneNode(!0);
2155
- if (N instanceof HTMLElement ? (pt(N).forEach((p) => {
2156
- if (!(p instanceof HTMLElement))
2157
- return;
2158
- const S = oa(p);
2159
- S && p.contains(S) && p.removeChild(S);
2160
- const v = wt(p);
2161
- v && v.classList.remove(l);
2162
- const y = bt(p);
2163
- y && y.classList.remove(M);
2164
- }), a.current = N) : a.current = null, c.current || f || // skip animation if a day is focused because it can cause issues to the animation and is better for a11y
2165
- r)
2166
- return;
2167
- const O = b instanceof HTMLElement ? pt(b) : [], D = pt(e.current);
2168
- if (D?.every((g) => g instanceof HTMLElement) && O && O.every((g) => g instanceof HTMLElement)) {
2169
- c.current = !0, e.current.style.isolation = "isolate";
2170
- const g = ra(e.current);
2171
- g && (g.style.zIndex = "1"), D.forEach((p, S) => {
2172
- const v = O[S];
2173
- if (!v)
2174
- return;
2175
- p.style.position = "relative", p.style.overflow = "hidden";
2176
- const y = wt(p);
2177
- y && y.classList.add(l);
2178
- const k = bt(p);
2179
- k && k.classList.add(M);
2180
- const C = () => {
2181
- c.current = !1, e.current && (e.current.style.isolation = ""), g && (g.style.zIndex = ""), y && y.classList.remove(l), k && k.classList.remove(M), p.style.position = "", p.style.overflow = "", p.contains(v) && p.removeChild(v);
2182
- };
2183
- v.style.pointerEvents = "none", v.style.position = "absolute", v.style.overflow = "hidden", v.setAttribute("aria-hidden", "true");
2184
- const A = aa(v);
2185
- A && (A.style.opacity = "0");
2186
- const I = wt(v);
2187
- I && (I.classList.add(u ? o[ae.caption_before_exit] : o[ae.caption_after_exit]), I.addEventListener("animationend", C));
2188
- const G = bt(v);
2189
- G && G.classList.add(u ? o[ae.weeks_before_exit] : o[ae.weeks_after_exit]), p.insertBefore(v, p.firstChild);
2190
- });
2191
- }
2192
- });
2193
- }
2194
- function ia(e, t, o, n) {
2195
- const r = e[0], s = e[e.length - 1], { ISOWeek: a, fixedWeeks: i, broadcastCalendar: c } = o ?? {}, { addDays: d, differenceInCalendarDays: f, differenceInCalendarMonths: u, endOfBroadcastWeek: l, endOfISOWeek: M, endOfMonth: b, endOfWeek: N, isAfter: O, startOfBroadcastWeek: D, startOfISOWeek: g, startOfWeek: p } = n, S = c ? D(r, n) : a ? g(r) : p(r), v = c ? l(s) : a ? M(b(s)) : N(b(s)), y = f(v, S), k = u(s, r) + 1, C = [];
2196
- for (let G = 0; G <= y; G++) {
2197
- const $ = d(S, G);
2198
- if (t && O($, t))
2199
- break;
2200
- C.push($);
2201
- }
2202
- const I = (c ? 35 : 42) * k;
2203
- if (i && C.length < I) {
2204
- const G = I - C.length;
2205
- for (let $ = 0; $ < G; $++) {
2206
- const Z = d(C[C.length - 1], 1);
2207
- C.push(Z);
2208
- }
2209
- }
2210
- return C;
2211
- }
2212
- function ca(e) {
2213
- const t = [];
2214
- return e.reduce((o, n) => {
2215
- const r = n.weeks.reduce((s, a) => s.concat(a.days.slice()), t.slice());
2216
- return o.concat(r.slice());
2217
- }, t.slice());
2218
- }
2219
- function ua(e, t, o, n) {
2220
- const { numberOfMonths: r = 1 } = o, s = [];
2221
- for (let a = 0; a < r; a++) {
2222
- const i = n.addMonths(e, a);
2223
- if (t && i > t)
2224
- break;
2225
- s.push(i);
2226
- }
2227
- return s;
2228
- }
2229
- function $t(e, t, o, n) {
2230
- const { month: r, defaultMonth: s, today: a = n.today(), numberOfMonths: i = 1 } = e;
2231
- let c = r || s || a;
2232
- const { differenceInCalendarMonths: d, addMonths: f, startOfMonth: u } = n;
2233
- if (o && d(o, c) < i - 1) {
2234
- const l = -1 * (i - 1);
2235
- c = f(o, l);
2236
- }
2237
- return t && d(c, t) < 0 && (c = t), u(c);
2238
- }
2239
- function da(e, t, o, n) {
2240
- const { addDays: r, endOfBroadcastWeek: s, endOfISOWeek: a, endOfMonth: i, endOfWeek: c, getISOWeek: d, getWeek: f, startOfBroadcastWeek: u, startOfISOWeek: l, startOfWeek: M } = n, b = e.reduce((N, O) => {
2241
- const D = o.broadcastCalendar ? u(O, n) : o.ISOWeek ? l(O) : M(O), g = o.broadcastCalendar ? s(O) : o.ISOWeek ? a(i(O)) : c(i(O)), p = t.filter((k) => k >= D && k <= g), S = o.broadcastCalendar ? 35 : 42;
2242
- if (o.fixedWeeks && p.length < S) {
2243
- const k = t.filter((C) => {
2244
- const A = S - p.length;
2245
- return C > g && C <= r(g, A);
2246
- });
2247
- p.push(...k);
2248
- }
2249
- const v = p.reduce((k, C) => {
2250
- const A = o.ISOWeek ? d(C) : f(C), I = k.find(($) => $.weekNumber === A), G = new sn(C, O, n);
2251
- return I ? I.days.push(G) : k.push(new Jo(A, [G])), k;
2252
- }, []), y = new Ko(O, v);
2253
- return N.push(y), N;
2254
- }, []);
2255
- return o.reverseMonths ? b.reverse() : b;
2256
- }
2257
- function la(e, t) {
2258
- let { startMonth: o, endMonth: n } = e;
2259
- const { startOfYear: r, startOfDay: s, startOfMonth: a, endOfMonth: i, addYears: c, endOfYear: d, newDate: f, today: u } = t, { fromYear: l, toYear: M, fromMonth: b, toMonth: N } = e;
2260
- !o && b && (o = b), !o && l && (o = t.newDate(l, 0, 1)), !n && N && (n = N), !n && M && (n = f(M, 11, 31));
2261
- const O = e.captionLayout === "dropdown" || e.captionLayout === "dropdown-years";
2262
- return o ? o = a(o) : l ? o = f(l, 0, 1) : !o && O && (o = r(c(e.today ?? u(), -100))), n ? n = i(n) : M ? n = f(M, 11, 31) : !n && O && (n = d(e.today ?? u())), [
2263
- o && s(o),
2264
- n && s(n)
2265
- ];
2266
- }
2267
- function fa(e, t, o, n) {
2268
- if (o.disableNavigation)
2269
- return;
2270
- const { pagedNavigation: r, numberOfMonths: s = 1 } = o, { startOfMonth: a, addMonths: i, differenceInCalendarMonths: c } = n, d = r ? s : 1, f = a(e);
2271
- if (!t)
2272
- return i(f, d);
2273
- if (!(c(t, e) < s))
2274
- return i(f, d);
2275
- }
2276
- function ma(e, t, o, n) {
2277
- if (o.disableNavigation)
2278
- return;
2279
- const { pagedNavigation: r, numberOfMonths: s } = o, { startOfMonth: a, addMonths: i, differenceInCalendarMonths: c } = n, d = r ? s ?? 1 : 1, f = a(e);
2280
- if (!t)
2281
- return i(f, -d);
2282
- if (!(c(f, t) <= 0))
2283
- return i(f, -d);
2284
- }
2285
- function ha(e) {
2286
- const t = [];
2287
- return e.reduce((o, n) => o.concat(n.weeks.slice()), t.slice());
2288
- }
2289
- function ct(e, t) {
2290
- const [o, n] = ke(e);
2291
- return [t === void 0 ? o : t, n];
2292
- }
2293
- function ya(e, t) {
2294
- const [o, n] = la(e, t), { startOfMonth: r, endOfMonth: s } = t, a = $t(e, o, n, t), [i, c] = ct(
2295
- a,
2296
- // initialMonth is always computed from props.month if provided
2297
- e.month ? a : void 0
2298
- );
2299
- _e(() => {
2300
- const S = $t(e, o, n, t);
2301
- c(S);
2302
- }, [e.timeZone]);
2303
- const { months: d, weeks: f, days: u, previousMonth: l, nextMonth: M } = se(() => {
2304
- const S = ua(i, n, { numberOfMonths: e.numberOfMonths }, t), v = ia(S, e.endMonth ? s(e.endMonth) : void 0, {
2305
- ISOWeek: e.ISOWeek,
2306
- fixedWeeks: e.fixedWeeks,
2307
- broadcastCalendar: e.broadcastCalendar
2308
- }, t), y = da(S, v, {
2309
- broadcastCalendar: e.broadcastCalendar,
2310
- fixedWeeks: e.fixedWeeks,
2311
- ISOWeek: e.ISOWeek,
2312
- reverseMonths: e.reverseMonths
2313
- }, t), k = ha(y), C = ca(y), A = ma(i, o, e, t), I = fa(i, n, e, t);
2314
- return {
2315
- months: y,
2316
- weeks: k,
2317
- days: C,
2318
- previousMonth: A,
2319
- nextMonth: I
2320
- };
2321
- }, [
2322
- t,
2323
- i.getTime(),
2324
- n?.getTime(),
2325
- o?.getTime(),
2326
- e.disableNavigation,
2327
- e.broadcastCalendar,
2328
- e.endMonth?.getTime(),
2329
- e.fixedWeeks,
2330
- e.ISOWeek,
2331
- e.numberOfMonths,
2332
- e.pagedNavigation,
2333
- e.reverseMonths
2334
- ]), { disableNavigation: b, onMonthChange: N } = e, O = (S) => f.some((v) => v.days.some((y) => y.isEqualTo(S))), D = (S) => {
2335
- if (b)
2336
- return;
2337
- let v = r(S);
2338
- o && v < r(o) && (v = r(o)), n && v > r(n) && (v = r(n)), c(v), N?.(v);
2339
- };
2340
- return {
2341
- months: d,
2342
- weeks: f,
2343
- days: u,
2344
- navStart: o,
2345
- navEnd: n,
2346
- previousMonth: l,
2347
- nextMonth: M,
2348
- goToMonth: D,
2349
- goToDay: (S) => {
2350
- O(S) || D(S.date);
2351
- }
2352
- };
2353
- }
2354
- var ye;
2355
- (function(e) {
2356
- e[e.Today = 0] = "Today", e[e.Selected = 1] = "Selected", e[e.LastFocused = 2] = "LastFocused", e[e.FocusedModifier = 3] = "FocusedModifier";
2357
- })(ye || (ye = {}));
2358
- function Ht(e) {
2359
- return !e[L.disabled] && !e[L.hidden] && !e[L.outside];
2360
- }
2361
- function ga(e, t, o, n) {
2362
- let r, s = -1;
2363
- for (const a of e) {
2364
- const i = t(a);
2365
- Ht(i) && (i[L.focused] && s < ye.FocusedModifier ? (r = a, s = ye.FocusedModifier) : n?.isEqualTo(a) && s < ye.LastFocused ? (r = a, s = ye.LastFocused) : o(a.date) && s < ye.Selected ? (r = a, s = ye.Selected) : i[L.today] && s < ye.Today && (r = a, s = ye.Today));
2366
- }
2367
- return r || (r = e.find((a) => Ht(t(a)))), r;
2368
- }
2369
- function pa(e, t, o, n, r, s, a) {
2370
- const { ISOWeek: i, broadcastCalendar: c } = s, { addDays: d, addMonths: f, addWeeks: u, addYears: l, endOfBroadcastWeek: M, endOfISOWeek: b, endOfWeek: N, max: O, min: D, startOfBroadcastWeek: g, startOfISOWeek: p, startOfWeek: S } = a;
2371
- let y = {
2372
- day: d,
2373
- week: u,
2374
- month: f,
2375
- year: l,
2376
- startOfWeek: (k) => c ? g(k, a) : i ? p(k) : S(k),
2377
- endOfWeek: (k) => c ? M(k) : i ? b(k) : N(k)
2378
- }[e](o, t === "after" ? 1 : -1);
2379
- return t === "before" && n ? y = O([n, y]) : t === "after" && r && (y = D([r, y])), y;
2380
- }
2381
- function yn(e, t, o, n, r, s, a, i = 0) {
2382
- if (i > 365)
2383
- return;
2384
- const c = pa(e, t, o.date, n, r, s, a), d = !!(s.disabled && Se(c, s.disabled, a)), f = !!(s.hidden && Se(c, s.hidden, a)), u = c, l = new sn(c, u, a);
2385
- return !d && !f ? l : yn(e, t, l, n, r, s, a, i + 1);
2386
- }
2387
- function wa(e, t, o, n, r) {
2388
- const { autoFocus: s } = e, [a, i] = ke(), c = ga(t.days, o, n || (() => !1), a), [d, f] = ke(s ? c : void 0);
2389
- return {
2390
- isFocusTarget: (N) => !!c?.isEqualTo(N),
2391
- setFocused: f,
2392
- focused: d,
2393
- blur: () => {
2394
- i(d), f(void 0);
2395
- },
2396
- moveFocus: (N, O) => {
2397
- if (!d)
2398
- return;
2399
- const D = yn(N, O, d, t.navStart, t.navEnd, e, r);
2400
- D && (e.disableNavigation && !t.days.some((p) => p.isEqualTo(D)) || (t.goToDay(D), f(D)));
2401
- }
2402
- };
2403
- }
2404
- function ba(e, t) {
2405
- const { selected: o, required: n, onSelect: r } = e, [s, a] = ct(o, r ? o : void 0), i = r ? o : s, { isSameDay: c } = t, d = (M) => i?.some((b) => c(b, M)) ?? !1, { min: f, max: u } = e;
2406
- return {
2407
- selected: i,
2408
- select: (M, b, N) => {
2409
- let O = [...i ?? []];
2410
- if (d(M)) {
2411
- if (i?.length === f || n && i?.length === 1)
2412
- return;
2413
- O = i?.filter((D) => !c(D, M));
2414
- } else
2415
- i?.length === u ? O = [M] : O = [...O, M];
2416
- return r || a(O), r?.(O, M, b, N), O;
2417
- },
2418
- isSelected: d
2419
- };
2420
- }
2421
- function Ma(e, t, o = 0, n = 0, r = !1, s = be) {
2422
- const { from: a, to: i } = t || {}, { isSameDay: c, isAfter: d, isBefore: f } = s;
2423
- let u;
2424
- if (!a && !i)
2425
- u = { from: e, to: o > 0 ? void 0 : e };
2426
- else if (a && !i)
2427
- c(a, e) ? o === 0 ? u = { from: a, to: e } : r ? u = { from: a, to: void 0 } : u = void 0 : f(e, a) ? u = { from: e, to: a } : u = { from: a, to: e };
2428
- else if (a && i)
2429
- if (c(a, e) && c(i, e))
2430
- r ? u = { from: a, to: i } : u = void 0;
2431
- else if (c(a, e))
2432
- u = { from: a, to: o > 0 ? void 0 : e };
2433
- else if (c(i, e))
2434
- u = { from: e, to: o > 0 ? void 0 : e };
2435
- else if (f(e, a))
2436
- u = { from: e, to: i };
2437
- else if (d(e, a))
2438
- u = { from: a, to: e };
2439
- else if (d(e, i))
2440
- u = { from: a, to: e };
2441
- else
2442
- throw new Error("Invalid range");
2443
- if (u?.from && u?.to) {
2444
- const l = s.differenceInCalendarDays(u.to, u.from);
2445
- n > 0 && l > n ? u = { from: e, to: void 0 } : o > 1 && l < o && (u = { from: e, to: void 0 });
2446
- }
2447
- return u;
2448
- }
2449
- function Da(e, t, o = be) {
2450
- const n = Array.isArray(t) ? t : [t];
2451
- let r = e.from;
2452
- const s = o.differenceInCalendarDays(e.to, e.from), a = Math.min(s, 6);
2453
- for (let i = 0; i <= a; i++) {
2454
- if (n.includes(r.getDay()))
2455
- return !0;
2456
- r = o.addDays(r, 1);
2457
- }
2458
- return !1;
2459
- }
2460
- function qt(e, t, o = be) {
2461
- return We(e, t.from, !1, o) || We(e, t.to, !1, o) || We(t, e.from, !1, o) || We(t, e.to, !1, o);
2462
- }
2463
- function va(e, t, o = be) {
2464
- const n = Array.isArray(t) ? t : [t];
2465
- if (n.filter((i) => typeof i != "function").some((i) => typeof i == "boolean" ? i : o.isDate(i) ? We(e, i, !1, o) : dn(i, o) ? i.some((c) => We(e, c, !1, o)) : it(i) ? i.from && i.to ? qt(e, { from: i.from, to: i.to }, o) : !1 : un(i) ? Da(e, i.dayOfWeek, o) : St(i) ? o.isAfter(i.before, i.after) ? qt(e, {
2466
- from: o.addDays(i.after, 1),
2467
- to: o.addDays(i.before, -1)
2468
- }, o) : Se(e.from, i, o) || Se(e.to, i, o) : Ct(i) || xt(i) ? Se(e.from, i, o) || Se(e.to, i, o) : !1))
2469
- return !0;
2470
- const a = n.filter((i) => typeof i == "function");
2471
- if (a.length) {
2472
- let i = e.from;
2473
- const c = o.differenceInCalendarDays(e.to, e.from);
2474
- for (let d = 0; d <= c; d++) {
2475
- if (a.some((f) => f(i)))
2476
- return !0;
2477
- i = o.addDays(i, 1);
2478
- }
2479
- }
2480
- return !1;
2481
- }
2482
- function ka(e, t) {
2483
- const { disabled: o, excludeDisabled: n, selected: r, required: s, onSelect: a } = e, [i, c] = ct(r, a ? r : void 0), d = a ? r : i;
2484
- return {
2485
- selected: d,
2486
- select: (l, M, b) => {
2487
- const { min: N, max: O } = e, D = l ? Ma(l, d, N, O, s, t) : void 0;
2488
- return n && o && D?.from && D.to && va({ from: D.from, to: D.to }, o, t) && (D.from = l, D.to = void 0), a || c(D), a?.(D, l, M, b), D;
2489
- },
2490
- isSelected: (l) => d && We(d, l, !1, t)
2491
- };
2492
- }
2493
- function Oa(e, t) {
2494
- const { selected: o, required: n, onSelect: r } = e, [s, a] = ct(o, r ? o : void 0), i = r ? o : s, { isSameDay: c } = t;
2495
- return {
2496
- selected: i,
2497
- select: (u, l, M) => {
2498
- let b = u;
2499
- return !n && i && i && c(u, i) && (b = void 0), r || a(b), r?.(b, u, l, M), b;
2500
- },
2501
- isSelected: (u) => i ? c(i, u) : !1
2502
- };
2503
- }
2504
- function Wa(e, t) {
2505
- const o = Oa(e, t), n = ba(e, t), r = ka(e, t);
2506
- switch (e.mode) {
2507
- case "single":
2508
- return o;
2509
- case "multiple":
2510
- return n;
2511
- case "range":
2512
- return r;
2513
- default:
2514
- return;
2515
- }
2516
- }
2517
- function K(e, t) {
2518
- return e instanceof Oe && e.timeZone === t ? e : new Oe(e, t);
2519
- }
2520
- function Rt(e, t) {
2521
- return typeof e == "boolean" || typeof e == "function" ? e : e instanceof Date ? K(e, t) : Array.isArray(e) ? e.map((o) => o instanceof Date ? K(o, t) : o) : it(e) ? {
2522
- ...e,
2523
- from: e.from ? K(e.from, t) : e.from,
2524
- to: e.to ? K(e.to, t) : e.to
2525
- } : St(e) ? {
2526
- before: K(e.before, t),
2527
- after: K(e.after, t)
2528
- } : Ct(e) ? {
2529
- after: K(e.after, t)
2530
- } : xt(e) ? {
2531
- before: K(e.before, t)
2532
- } : e;
2533
- }
2534
- function Mt(e, t) {
2535
- return e && (Array.isArray(e) ? e.map((o) => Rt(o, t)) : Rt(e, t));
2536
- }
2537
- function Dt(e) {
2538
- let t = e;
2539
- const o = t.timeZone;
2540
- if (o && (t = {
2541
- ...e,
2542
- timeZone: o
2543
- }, t.today && (t.today = K(t.today, o)), t.month && (t.month = K(t.month, o)), t.defaultMonth && (t.defaultMonth = K(t.defaultMonth, o)), t.startMonth && (t.startMonth = K(t.startMonth, o)), t.endMonth && (t.endMonth = K(t.endMonth, o)), t.mode === "single" && t.selected ? t.selected = K(t.selected, o) : t.mode === "multiple" && t.selected ? t.selected = t.selected?.map((x) => K(x, o)) : t.mode === "range" && t.selected && (t.selected = {
2544
- from: t.selected.from ? K(t.selected.from, o) : t.selected.from,
2545
- to: t.selected.to ? K(t.selected.to, o) : t.selected.to
2546
- }), t.disabled !== void 0 && (t.disabled = Mt(t.disabled, o)), t.hidden !== void 0 && (t.hidden = Mt(t.hidden, o)), t.modifiers)) {
2547
- const x = {};
2548
- Object.keys(t.modifiers).forEach((E) => {
2549
- x[E] = Mt(t.modifiers?.[E], o);
2550
- }), t.modifiers = x;
2551
- }
2552
- const { components: n, formatters: r, labels: s, dateLib: a, locale: i, classNames: c } = se(() => {
2553
- const x = { ...Wt, ...t.locale };
2554
- return {
2555
- dateLib: new ie({
2556
- locale: x,
2557
- weekStartsOn: t.broadcastCalendar ? 1 : t.weekStartsOn,
2558
- firstWeekContainsDate: t.firstWeekContainsDate,
2559
- useAdditionalWeekYearTokens: t.useAdditionalWeekYearTokens,
2560
- useAdditionalDayOfYearTokens: t.useAdditionalDayOfYearTokens,
2561
- timeZone: t.timeZone,
2562
- numerals: t.numerals
2563
- }, t.dateLib),
2564
- components: Nr(t.components),
2565
- formatters: $r(t.formatters),
2566
- labels: { ...na, ...t.labels },
2567
- locale: x,
2568
- classNames: { ...Tr(), ...t.classNames }
2569
- };
2570
- }, [
2571
- t.locale,
2572
- t.broadcastCalendar,
2573
- t.weekStartsOn,
2574
- t.firstWeekContainsDate,
2575
- t.useAdditionalWeekYearTokens,
2576
- t.useAdditionalDayOfYearTokens,
2577
- t.timeZone,
2578
- t.numerals,
2579
- t.dateLib,
2580
- t.components,
2581
- t.formatters,
2582
- t.labels,
2583
- t.classNames
2584
- ]);
2585
- t.today || (t = { ...t, today: a.today() });
2586
- const { captionLayout: d, mode: f, navLayout: u, numberOfMonths: l = 1, onDayBlur: M, onDayClick: b, onDayFocus: N, onDayKeyDown: O, onDayMouseEnter: D, onDayMouseLeave: g, onNextClick: p, onPrevClick: S, showWeekNumber: v, styles: y } = t, { formatCaption: k, formatDay: C, formatMonthDropdown: A, formatWeekNumber: I, formatWeekNumberHeader: G, formatWeekdayName: $, formatYearDropdown: Z } = r, B = ya(t, a), { days: Ce, months: Me, navStart: fe, navEnd: Be, previousMonth: ne, nextMonth: V, goToMonth: J } = B, De = Cr(Ce, t, fe, Be, a), { isSelected: je, select: Ee, selected: me } = Wa(t, a) ?? {}, { blur: Ae, focused: ce, isFocusTarget: ot, moveFocus: Ve, setFocused: he } = wa(t, B, De, je ?? (() => !1), a), { labelDayButton: ut, labelGridcell: dt, labelGrid: rt, labelMonthDropdown: at, labelNav: Xe, labelPrevious: xe, labelNext: ve, labelWeekday: $e, labelWeekNumber: Qe, labelWeekNumberHeader: lt, labelYearDropdown: ft } = s, mt = se(() => Rr(a, t.ISOWeek, t.broadcastCalendar, t.today), [a, t.ISOWeek, t.broadcastCalendar, t.today]), h = f !== void 0 || b !== void 0, T = R(() => {
2587
- ne && (J(ne), S?.(ne));
2588
- }, [ne, J, S]), H = R(() => {
2589
- V && (J(V), p?.(V));
2590
- }, [J, V, p]), X = R((x, E) => (W) => {
2591
- W.preventDefault(), W.stopPropagation(), he(x), Ee?.(x.date, E, W), b?.(x.date, E, W);
2592
- }, [Ee, b, he]), z = R((x, E) => (W) => {
2593
- he(x), N?.(x.date, E, W);
2594
- }, [N, he]), ee = R((x, E) => (W) => {
2595
- Ae(), M?.(x.date, E, W);
2596
- }, [Ae, M]), re = R((x, E) => (W) => {
2597
- const Y = {
2598
- ArrowLeft: [
2599
- W.shiftKey ? "month" : "day",
2600
- t.dir === "rtl" ? "after" : "before"
2601
- ],
2602
- ArrowRight: [
2603
- W.shiftKey ? "month" : "day",
2604
- t.dir === "rtl" ? "before" : "after"
2605
- ],
2606
- ArrowDown: [W.shiftKey ? "year" : "week", "after"],
2607
- ArrowUp: [W.shiftKey ? "year" : "week", "before"],
2608
- PageUp: [W.shiftKey ? "year" : "month", "before"],
2609
- PageDown: [W.shiftKey ? "year" : "month", "after"],
2610
- Home: ["startOfWeek", "before"],
2611
- End: ["endOfWeek", "after"]
2612
- };
2613
- if (Y[W.key]) {
2614
- W.preventDefault(), W.stopPropagation();
2615
- const [de, P] = Y[W.key];
2616
- Ve(de, P);
2617
- }
2618
- O?.(x.date, E, W);
2619
- }, [Ve, O, t.dir]), oe = R((x, E) => (W) => {
2620
- D?.(x.date, E, W);
2621
- }, [D]), j = R((x, E) => (W) => {
2622
- g?.(x.date, E, W);
2623
- }, [g]), ue = R((x) => (E) => {
2624
- const W = Number(E.target.value), Y = a.setMonth(a.startOfMonth(x), W);
2625
- J(Y);
2626
- }, [a, J]), te = R((x) => (E) => {
2627
- const W = Number(E.target.value), Y = a.setYear(a.startOfMonth(x), W);
2628
- J(Y);
2629
- }, [a, J]), { className: q, style: He } = se(() => ({
2630
- className: [c[w.Root], t.className].filter(Boolean).join(" "),
2631
- style: { ...y?.[w.Root], ...t.style }
2632
- }), [c, t.className, t.style, y]), qe = Pr(t), Ne = Ye(null);
2633
- sa(Ne, !!t.animate, {
2634
- classNames: c,
2635
- months: Me,
2636
- focused: ce,
2637
- dateLib: a
2638
- });
2639
- const Pe = {
2640
- dayPickerProps: t,
2641
- selected: me,
2642
- select: Ee,
2643
- isSelected: je,
2644
- months: Me,
2645
- nextMonth: V,
2646
- previousMonth: ne,
2647
- goToMonth: J,
2648
- getModifiers: De,
2649
- components: n,
2650
- classNames: c,
2651
- styles: y,
2652
- labels: s,
2653
- formatters: r
2654
- };
2655
- return m.createElement(
2656
- cn.Provider,
2657
- { value: Pe },
2658
- m.createElement(
2659
- n.Root,
2660
- { rootRef: t.animate ? Ne : void 0, className: q, style: He, 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"], ...qe },
2661
- m.createElement(
2662
- n.Months,
2663
- { className: c[w.Months], style: y?.[w.Months] },
2664
- !t.hideNavigation && !u && m.createElement(n.Nav, { "data-animated-nav": t.animate ? "true" : void 0, className: c[w.Nav], style: y?.[w.Nav], "aria-label": Xe(), onPreviousClick: T, onNextClick: H, previousMonth: ne, nextMonth: V }),
2665
- Me.map((x, E) => m.createElement(
2666
- n.Month,
2667
- {
2668
- "data-animated-month": t.animate ? "true" : void 0,
2669
- className: c[w.Month],
2670
- style: y?.[w.Month],
2671
- // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
2672
- key: E,
2673
- displayIndex: E,
2674
- calendarMonth: x
2675
- },
2676
- u === "around" && !t.hideNavigation && E === 0 && m.createElement(
2677
- n.PreviousMonthButton,
2678
- { type: "button", className: c[w.PreviousMonthButton], tabIndex: ne ? void 0 : -1, "aria-disabled": ne ? void 0 : !0, "aria-label": xe(ne), onClick: T, "data-animated-button": t.animate ? "true" : void 0 },
2679
- m.createElement(n.Chevron, { disabled: ne ? void 0 : !0, className: c[w.Chevron], orientation: t.dir === "rtl" ? "right" : "left" })
2680
- ),
2681
- m.createElement(n.MonthCaption, { "data-animated-caption": t.animate ? "true" : void 0, className: c[w.MonthCaption], style: y?.[w.MonthCaption], calendarMonth: x, displayIndex: E }, d?.startsWith("dropdown") ? m.createElement(
2682
- n.DropdownNav,
2683
- { className: c[w.Dropdowns], style: y?.[w.Dropdowns] },
2684
- (() => {
2685
- const W = d === "dropdown" || d === "dropdown-months" ? m.createElement(n.MonthsDropdown, { key: "month", className: c[w.MonthsDropdown], "aria-label": at(), classNames: c, components: n, disabled: !!t.disableNavigation, onChange: ue(x.date), options: Hr(x.date, fe, Be, r, a), style: y?.[w.Dropdown], value: a.getMonth(x.date) }) : m.createElement("span", { key: "month" }, A(x.date, a)), Y = d === "dropdown" || d === "dropdown-years" ? m.createElement(n.YearsDropdown, { key: "year", className: c[w.YearsDropdown], "aria-label": ft(a.options), classNames: c, components: n, disabled: !!t.disableNavigation, onChange: te(x.date), options: Lr(fe, Be, r, a, !!t.reverseYears), style: y?.[w.Dropdown], value: a.getYear(x.date) }) : m.createElement("span", { key: "year" }, Z(x.date, a));
2686
- return a.getMonthYearOrder() === "year-first" ? [Y, W] : [W, Y];
2687
- })(),
2688
- m.createElement("span", { role: "status", "aria-live": "polite", style: {
2689
- border: 0,
2690
- clip: "rect(0 0 0 0)",
2691
- height: "1px",
2692
- margin: "-1px",
2693
- overflow: "hidden",
2694
- padding: 0,
2695
- position: "absolute",
2696
- width: "1px",
2697
- whiteSpace: "nowrap",
2698
- wordWrap: "normal"
2699
- } }, k(x.date, a.options, a))
2700
- ) : (
2701
- // biome-ignore lint/a11y/useSemanticElements: breaking change
2702
- m.createElement(n.CaptionLabel, { className: c[w.CaptionLabel], role: "status", "aria-live": "polite" }, k(x.date, a.options, a))
2703
- )),
2704
- u === "around" && !t.hideNavigation && E === l - 1 && m.createElement(
2705
- n.NextMonthButton,
2706
- { type: "button", className: c[w.NextMonthButton], tabIndex: V ? void 0 : -1, "aria-disabled": V ? void 0 : !0, "aria-label": ve(V), onClick: H, "data-animated-button": t.animate ? "true" : void 0 },
2707
- m.createElement(n.Chevron, { disabled: V ? void 0 : !0, className: c[w.Chevron], orientation: t.dir === "rtl" ? "left" : "right" })
2708
- ),
2709
- E === l - 1 && u === "after" && !t.hideNavigation && m.createElement(n.Nav, { "data-animated-nav": t.animate ? "true" : void 0, className: c[w.Nav], style: y?.[w.Nav], "aria-label": Xe(), onPreviousClick: T, onNextClick: H, previousMonth: ne, nextMonth: V }),
2710
- m.createElement(
2711
- n.MonthGrid,
2712
- { role: "grid", "aria-multiselectable": f === "multiple" || f === "range", "aria-label": rt(x.date, a.options, a) || void 0, className: c[w.MonthGrid], style: y?.[w.MonthGrid] },
2713
- !t.hideWeekdays && m.createElement(
2714
- n.Weekdays,
2715
- { "data-animated-weekdays": t.animate ? "true" : void 0, className: c[w.Weekdays], style: y?.[w.Weekdays] },
2716
- v && m.createElement(n.WeekNumberHeader, { "aria-label": lt(a.options), className: c[w.WeekNumberHeader], style: y?.[w.WeekNumberHeader], scope: "col" }, G()),
2717
- mt.map((W) => m.createElement(n.Weekday, { "aria-label": $e(W, a.options, a), className: c[w.Weekday], key: String(W), style: y?.[w.Weekday], scope: "col" }, $(W, a.options, a)))
2718
- ),
2719
- m.createElement(n.Weeks, { "data-animated-weeks": t.animate ? "true" : void 0, className: c[w.Weeks], style: y?.[w.Weeks] }, x.weeks.map((W) => m.createElement(
2720
- n.Week,
2721
- { className: c[w.Week], key: W.weekNumber, style: y?.[w.Week], week: W },
2722
- v && // biome-ignore lint/a11y/useSemanticElements: react component
2723
- m.createElement(n.WeekNumber, { week: W, style: y?.[w.WeekNumber], "aria-label": Qe(W.weekNumber, {
2724
- locale: i
2725
- }), className: c[w.WeekNumber], scope: "row", role: "rowheader" }, I(W.weekNumber, a)),
2726
- W.days.map((Y) => {
2727
- const { date: de } = Y, P = De(Y);
2728
- if (P[L.focused] = !P.hidden && !!ce?.isEqualTo(Y), P[le.selected] = je?.(de) || P.selected, it(me)) {
2729
- const { from: yt, to: gt } = me;
2730
- P[le.range_start] = !!(yt && gt && a.isSameDay(de, yt)), P[le.range_end] = !!(yt && gt && a.isSameDay(de, gt)), P[le.range_middle] = We(me, de, !0, a);
2731
- }
2732
- const st = qr(P, y, t.modifiersStyles), ht = xr(P, c, t.modifiersClassNames), gn = !h && !P.hidden ? dt(de, P, a.options, a) : void 0;
2733
- return (
2734
- // biome-ignore lint/a11y/useSemanticElements: react component
2735
- m.createElement(n.Day, { key: `${Y.isoDate}_${Y.displayMonthId}`, day: Y, modifiers: P, className: ht.join(" "), style: st, role: "gridcell", "aria-selected": P.selected || void 0, "aria-label": gn, "data-day": Y.isoDate, "data-month": Y.outside ? Y.dateMonthId : void 0, "data-selected": P.selected || void 0, "data-disabled": P.disabled || void 0, "data-hidden": P.hidden || void 0, "data-outside": Y.outside || void 0, "data-focused": P.focused || void 0, "data-today": P.today || void 0 }, !P.hidden && h ? m.createElement(n.DayButton, { className: c[w.DayButton], style: y?.[w.DayButton], type: "button", day: Y, modifiers: P, disabled: !P.focused && P.disabled || void 0, "aria-disabled": P.focused && P.disabled || void 0, tabIndex: ot(Y) ? 0 : -1, "aria-label": ut(de, P, a.options, a), onClick: X(Y, P), onBlur: ee(Y, P), onFocus: z(Y, P), onKeyDown: re(Y, P), onMouseEnter: oe(Y, P), onMouseLeave: j(Y, P) }, C(de, a.options, a)) : !P.hidden && C(Y.date, a.options, a))
2736
- );
2737
- })
2738
- )))
2739
- )
2740
- ))
2741
- ),
2742
- t.footer && // biome-ignore lint/a11y/useSemanticElements: react component
2743
- m.createElement(n.Footer, { className: c[w.Footer], style: y?.[w.Footer], role: "status", "aria-live": "polite" }, t.footer)
2744
- )
2745
- );
2746
- }
2747
- const Sa = {
2748
- lessThanXSeconds: {
2749
- one: "menos de un segundo",
2750
- other: "menos de {{count}} segundos"
2751
- },
2752
- xSeconds: {
2753
- one: "1 segundo",
2754
- other: "{{count}} segundos"
2755
- },
2756
- halfAMinute: "medio minuto",
2757
- lessThanXMinutes: {
2758
- one: "menos de un minuto",
2759
- other: "menos de {{count}} minutos"
2760
- },
2761
- xMinutes: {
2762
- one: "1 minuto",
2763
- other: "{{count}} minutos"
2764
- },
2765
- aboutXHours: {
2766
- one: "alrededor de 1 hora",
2767
- other: "alrededor de {{count}} horas"
2768
- },
2769
- xHours: {
2770
- one: "1 hora",
2771
- other: "{{count}} horas"
2772
- },
2773
- xDays: {
2774
- one: "1 día",
2775
- other: "{{count}} días"
2776
- },
2777
- aboutXWeeks: {
2778
- one: "alrededor de 1 semana",
2779
- other: "alrededor de {{count}} semanas"
2780
- },
2781
- xWeeks: {
2782
- one: "1 semana",
2783
- other: "{{count}} semanas"
2784
- },
2785
- aboutXMonths: {
2786
- one: "alrededor de 1 mes",
2787
- other: "alrededor de {{count}} meses"
2788
- },
2789
- xMonths: {
2790
- one: "1 mes",
2791
- other: "{{count}} meses"
2792
- },
2793
- aboutXYears: {
2794
- one: "alrededor de 1 año",
2795
- other: "alrededor de {{count}} años"
2796
- },
2797
- xYears: {
2798
- one: "1 año",
2799
- other: "{{count}} años"
2800
- },
2801
- overXYears: {
2802
- one: "más de 1 año",
2803
- other: "más de {{count}} años"
2804
- },
2805
- almostXYears: {
2806
- one: "casi 1 año",
2807
- other: "casi {{count}} años"
2808
- }
2809
- }, Ca = (e, t, o) => {
2810
- let n;
2811
- const r = Sa[e];
2812
- 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 ? "en " + n : "hace " + n : n;
2813
- }, xa = {
2814
- full: "EEEE, d 'de' MMMM 'de' y",
2815
- long: "d 'de' MMMM 'de' y",
2816
- medium: "d MMM y",
2817
- short: "dd/MM/y"
2818
- }, Na = {
2819
- full: "HH:mm:ss zzzz",
2820
- long: "HH:mm:ss z",
2821
- medium: "HH:mm:ss",
2822
- short: "HH:mm"
2823
- }, Pa = {
2824
- full: "{{date}} 'a las' {{time}}",
2825
- long: "{{date}} 'a las' {{time}}",
2826
- medium: "{{date}}, {{time}}",
2827
- short: "{{date}}, {{time}}"
2828
- }, Ta = {
2829
- date: Le({
2830
- formats: xa,
2831
- defaultWidth: "full"
2832
- }),
2833
- time: Le({
2834
- formats: Na,
2835
- defaultWidth: "full"
2836
- }),
2837
- dateTime: Le({
2838
- formats: Pa,
2839
- defaultWidth: "full"
2840
- })
2841
- }, Ya = {
2842
- lastWeek: "'el' eeee 'pasado a la' p",
2843
- yesterday: "'ayer a la' p",
2844
- today: "'hoy a la' p",
2845
- tomorrow: "'mañana a la' p",
2846
- nextWeek: "eeee 'a la' p",
2847
- other: "P"
2848
- }, Ea = {
2849
- lastWeek: "'el' eeee 'pasado a las' p",
2850
- yesterday: "'ayer a las' p",
2851
- today: "'hoy a las' p",
2852
- tomorrow: "'mañana a las' p",
2853
- nextWeek: "eeee 'a las' p",
2854
- other: "P"
2855
- }, _a = (e, t, o, n) => t.getHours() !== 1 ? Ea[e] : Ya[e], Fa = {
2856
- narrow: ["AC", "DC"],
2857
- abbreviated: ["AC", "DC"],
2858
- wide: ["antes de cristo", "después de cristo"]
2859
- }, Ia = {
2860
- narrow: ["1", "2", "3", "4"],
2861
- abbreviated: ["T1", "T2", "T3", "T4"],
2862
- wide: ["1º trimestre", "2º trimestre", "3º trimestre", "4º trimestre"]
2863
- }, Ba = {
2864
- narrow: ["e", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
2865
- abbreviated: [
2866
- "ene",
2867
- "feb",
2868
- "mar",
2869
- "abr",
2870
- "may",
2871
- "jun",
2872
- "jul",
2873
- "ago",
2874
- "sep",
2875
- "oct",
2876
- "nov",
2877
- "dic"
2878
- ],
2879
- wide: [
2880
- "enero",
2881
- "febrero",
2882
- "marzo",
2883
- "abril",
2884
- "mayo",
2885
- "junio",
2886
- "julio",
2887
- "agosto",
2888
- "septiembre",
2889
- "octubre",
2890
- "noviembre",
2891
- "diciembre"
2892
- ]
2893
- }, ja = {
2894
- narrow: ["d", "l", "m", "m", "j", "v", "s"],
2895
- short: ["do", "lu", "ma", "mi", "ju", "vi", "sá"],
2896
- abbreviated: ["dom", "lun", "mar", "mié", "jue", "vie", "sáb"],
2897
- wide: [
2898
- "domingo",
2899
- "lunes",
2900
- "martes",
2901
- "miércoles",
2902
- "jueves",
2903
- "viernes",
2904
- "sábado"
2905
- ]
2906
- }, Aa = {
2907
- narrow: {
2908
- am: "a",
2909
- pm: "p",
2910
- midnight: "mn",
2911
- noon: "md",
2912
- morning: "mañana",
2913
- afternoon: "tarde",
2914
- evening: "tarde",
2915
- night: "noche"
2916
- },
2917
- abbreviated: {
2918
- am: "AM",
2919
- pm: "PM",
2920
- midnight: "medianoche",
2921
- noon: "mediodia",
2922
- morning: "mañana",
2923
- afternoon: "tarde",
2924
- evening: "tarde",
2925
- night: "noche"
2926
- },
2927
- wide: {
2928
- am: "a.m.",
2929
- pm: "p.m.",
2930
- midnight: "medianoche",
2931
- noon: "mediodia",
2932
- morning: "mañana",
2933
- afternoon: "tarde",
2934
- evening: "tarde",
2935
- night: "noche"
2936
- }
2937
- }, $a = {
2938
- narrow: {
2939
- am: "a",
2940
- pm: "p",
2941
- midnight: "mn",
2942
- noon: "md",
2943
- morning: "de la mañana",
2944
- afternoon: "de la tarde",
2945
- evening: "de la tarde",
2946
- night: "de la noche"
2947
- },
2948
- abbreviated: {
2949
- am: "AM",
2950
- pm: "PM",
2951
- midnight: "medianoche",
2952
- noon: "mediodia",
2953
- morning: "de la mañana",
2954
- afternoon: "de la tarde",
2955
- evening: "de la tarde",
2956
- night: "de la noche"
2957
- },
2958
- wide: {
2959
- am: "a.m.",
2960
- pm: "p.m.",
2961
- midnight: "medianoche",
2962
- noon: "mediodia",
2963
- morning: "de la mañana",
2964
- afternoon: "de la tarde",
2965
- evening: "de la tarde",
2966
- night: "de la noche"
2967
- }
2968
- }, Ha = (e, t) => Number(e) + "º", qa = {
2969
- ordinalNumber: Ha,
2970
- era: ge({
2971
- values: Fa,
2972
- defaultWidth: "wide"
2973
- }),
2974
- quarter: ge({
2975
- values: Ia,
2976
- defaultWidth: "wide",
2977
- argumentCallback: (e) => Number(e) - 1
2978
- }),
2979
- month: ge({
2980
- values: Ba,
2981
- defaultWidth: "wide"
2982
- }),
2983
- day: ge({
2984
- values: ja,
2985
- defaultWidth: "wide"
2986
- }),
2987
- dayPeriod: ge({
2988
- values: Aa,
2989
- defaultWidth: "wide",
2990
- formattingValues: $a,
2991
- defaultFormattingWidth: "wide"
2992
- })
2993
- }, Ra = /^(\d+)(º)?/i, La = /\d+/i, za = {
2994
- narrow: /^(ac|dc|a|d)/i,
2995
- abbreviated: /^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,
2996
- wide: /^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i
2997
- }, Ga = {
2998
- any: [/^ac/i, /^dc/i],
2999
- wide: [
3000
- /^(antes de cristo|antes de la era com[uú]n)/i,
3001
- /^(despu[eé]s de cristo|era com[uú]n)/i
3002
- ]
3003
- }, Va = {
3004
- narrow: /^[1234]/i,
3005
- abbreviated: /^T[1234]/i,
3006
- wide: /^[1234](º)? trimestre/i
3007
- }, Xa = {
3008
- any: [/1/i, /2/i, /3/i, /4/i]
3009
- }, Qa = {
3010
- narrow: /^[efmajsond]/i,
3011
- abbreviated: /^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,
3012
- wide: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i
3013
- }, Ua = {
3014
- narrow: [
3015
- /^e/i,
3016
- /^f/i,
3017
- /^m/i,
3018
- /^a/i,
3019
- /^m/i,
3020
- /^j/i,
3021
- /^j/i,
3022
- /^a/i,
3023
- /^s/i,
3024
- /^o/i,
3025
- /^n/i,
3026
- /^d/i
3027
- ],
3028
- any: [
3029
- /^en/i,
3030
- /^feb/i,
3031
- /^mar/i,
3032
- /^abr/i,
3033
- /^may/i,
3034
- /^jun/i,
3035
- /^jul/i,
3036
- /^ago/i,
3037
- /^sep/i,
3038
- /^oct/i,
3039
- /^nov/i,
3040
- /^dic/i
3041
- ]
3042
- }, Za = {
3043
- narrow: /^[dlmjvs]/i,
3044
- short: /^(do|lu|ma|mi|ju|vi|s[áa])/i,
3045
- abbreviated: /^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,
3046
- wide: /^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i
3047
- }, Ka = {
3048
- narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
3049
- any: [/^do/i, /^lu/i, /^ma/i, /^mi/i, /^ju/i, /^vi/i, /^sa/i]
3050
- }, Ja = {
3051
- narrow: /^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,
3052
- any: /^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i
3053
- }, es = {
3054
- any: {
3055
- am: /^a/i,
3056
- pm: /^p/i,
3057
- midnight: /^mn/i,
3058
- noon: /^md/i,
3059
- morning: /mañana/i,
3060
- afternoon: /tarde/i,
3061
- evening: /tarde/i,
3062
- night: /noche/i
3063
- }
3064
- }, ts = {
3065
- ordinalNumber: en({
3066
- matchPattern: Ra,
3067
- parsePattern: La,
3068
- valueCallback: function(e) {
3069
- return parseInt(e, 10);
3070
- }
3071
- }),
3072
- era: pe({
3073
- matchPatterns: za,
3074
- defaultMatchWidth: "wide",
3075
- parsePatterns: Ga,
3076
- defaultParseWidth: "any"
3077
- }),
3078
- quarter: pe({
3079
- matchPatterns: Va,
3080
- defaultMatchWidth: "wide",
3081
- parsePatterns: Xa,
3082
- defaultParseWidth: "any",
3083
- valueCallback: (e) => e + 1
3084
- }),
3085
- month: pe({
3086
- matchPatterns: Qa,
3087
- defaultMatchWidth: "wide",
3088
- parsePatterns: Ua,
3089
- defaultParseWidth: "any"
3090
- }),
3091
- day: pe({
3092
- matchPatterns: Za,
3093
- defaultMatchWidth: "wide",
3094
- parsePatterns: Ka,
3095
- defaultParseWidth: "any"
3096
- }),
3097
- dayPeriod: pe({
3098
- matchPatterns: Ja,
3099
- defaultMatchWidth: "any",
3100
- parsePatterns: es,
3101
- defaultParseWidth: "any"
3102
- })
3103
- }, vt = {
3104
- code: "es",
3105
- formatDistance: Ca,
3106
- formatLong: Ta,
3107
- formatRelative: _a,
3108
- localize: qa,
3109
- match: ts,
3110
- options: {
3111
- weekStartsOn: 1,
3112
- firstWeekContainsDate: 1
3113
- }
3114
- }, ds = (e) => {
3115
- const {
3116
- mode: t = "single",
3117
- required: o = !1,
3118
- selected: n,
3119
- onSelect: r,
3120
- disabledDates: s,
3121
- header: a,
3122
- footer: i,
3123
- hideOutsideDays: c = !1,
3124
- numberOfMonths: d = 1,
3125
- startMonth: f,
3126
- endMonth: u,
3127
- showActionButtons: l = !1,
3128
- applyLabel: M = "Aplicar",
3129
- cancelLabel: b = "Cancelar",
3130
- onApply: N,
3131
- onCancel: O,
3132
- hideFooter: D = !1,
3133
- variant: g = "input",
3134
- inputProps: p,
3135
- label: S = "",
3136
- name: v = "datepicker",
3137
- className: y
3138
- } = e, k = t === "range" || t === "multiple" ? e.min : void 0, C = t === "range" || t === "multiple" ? e.max : void 0, A = t === "range" ? e.excludeDisabled : void 0, [I, G] = ke({}), [$, Z] = ke(!1), [B, Ce] = ke(!1), [Me, fe] = ke(n), [Be, ne] = ke(!1), [V, J] = ke(""), De = Ye(null), je = Ye(null), Ee = Ye(null), me = Ye(null), Ae = l ? Me : n, ce = l ? n : Ae;
3139
- _e(() => {
3140
- window.innerWidth < 768 ? ne(!0) : ne(!1);
3141
- }, []), _e(() => {
3142
- l && fe(n);
3143
- }, [n, l]), _e(() => {
3144
- if (g !== "input" || !$) return;
3145
- const h = (T) => {
3146
- De.current && !De.current.contains(T.target) && (Z(!1), l && fe(n));
3147
- };
3148
- return document.addEventListener("mousedown", h), () => {
3149
- document.removeEventListener("mousedown", h);
3150
- };
3151
- }, [g, $, n, l]), _e(() => {
3152
- if (!$ || g !== "input" || !De.current) {
3153
- Ce(!1);
3154
- return;
3155
- }
3156
- const h = 16, T = () => {
3157
- const z = De?.current?.getBoundingClientRect(), ee = je?.current?.getBoundingClientRect();
3158
- if (!z || !ee) return;
3159
- const re = window.innerHeight, oe = window.innerWidth, j = z.height, ue = z.width, te = ee.left, q = ee.bottom, He = q, qe = re - q, Ne = oe - ee.left, Pe = ue - Ne, x = Pe > 0 && Ne >= ue + h, E = He >= j + h, W = qe >= j + h, Y = !W && E, de = !W && !E;
3160
- let P = Y ? void 0 : `${q + 8}px`, st = Y ? `${qe + ee.height + 8}px` : void 0;
3161
- de && (P = void 0, st = `${h}px`);
3162
- const ht = Pe > 0 ? Pe : 0;
3163
- G(
3164
- {
3165
- top: P,
3166
- bottom: st,
3167
- right: x ? "0" : void 0,
3168
- left: x ? void 0 : `${te - ht}px`
3169
- }
3170
- ), Ce(!0);
3171
- }, H = () => {
3172
- Z(!1), Ce(!1);
3173
- };
3174
- window.addEventListener("scroll", H, !0);
3175
- const X = setTimeout(T, 0);
3176
- return () => {
3177
- clearTimeout(X), window.removeEventListener("scroll", H, !0);
3178
- };
3179
- }, [$, g]);
3180
- const ot = R(() => {
3181
- N?.(Me), r?.(Me), g === "input" && Z(!1);
3182
- }, [N, r, Me, g]), Ve = R(() => {
3183
- fe(n), O?.(), g === "input" && Z(!1);
3184
- }, [O, n, g]), he = se(() => {
3185
- if (!ce) return "";
3186
- if (t === "single")
3187
- return ce.toLocaleDateString("es-ES", { day: "2-digit", month: "2-digit", year: "numeric" });
3188
- if (t === "range") {
3189
- const h = ce;
3190
- if (!h.from) return "";
3191
- const T = h.from.toLocaleDateString("es-ES", { day: "2-digit", month: "2-digit", year: "numeric" });
3192
- if (!h.to) return T;
3193
- const H = h.to.toLocaleDateString("es-ES", { day: "2-digit", month: "2-digit", year: "numeric" });
3194
- return `${T} - ${H}`;
3195
- }
3196
- if (t === "multiple") {
3197
- const h = ce;
3198
- return h.length === 0 ? "" : h.length === 1 ? h[0].toLocaleDateString("es-ES", { day: "2-digit", month: "2-digit", year: "numeric" }) : `${h.length} fechas seleccionadas`;
3199
- }
3200
- return "";
3201
- }, [ce, t]);
3202
- _e(() => {
3203
- J(he);
3204
- }, [he]), _e(() => {
3205
- if (me.current !== null && Ee.current) {
3206
- const h = me.current;
3207
- Ee.current.setSelectionRange(h, h), me.current = null;
3208
- }
3209
- }, [V]);
3210
- const ut = se(() => g === "input" || g === "input-and-calendar", [g]), dt = se(() => g === "only-calendar" || g === "input-and-calendar" || g === "input", [g]), rt = R((h) => {
3211
- r?.(h);
3212
- }, [r]), at = R((h) => {
3213
- const T = new Date(parseInt(h.slice(6, 10)), parseInt(h.slice(3, 5)) - 1, parseInt(h.slice(0, 2)));
3214
- if (t === "multiple") {
3215
- const X = (ce || []).filter((z) => z.getTime() !== T.getTime());
3216
- l ? (r?.(X), fe(X)) : rt(X);
3217
- }
3218
- }, [t, ce, l, r, rt]), Xe = R((h) => {
3219
- if (l) {
3220
- fe(h);
3221
- return;
3222
- }
3223
- g === "input" && t === "single" && Z(!1), r?.(h);
3224
- }, [l, g, t, r]), xe = R((h) => {
3225
- if (l) {
3226
- fe(h);
3227
- return;
3228
- }
3229
- r?.(h);
3230
- }, [l, r]), ve = R((h) => {
3231
- const T = h.trim();
3232
- if (!T) return null;
3233
- const [H, X, z] = T.split("/").map((ue) => ue.trim()), ee = parseInt(H, 10), re = parseInt(X, 10), oe = parseInt(z, 10);
3234
- if (Number.isNaN(ee) || Number.isNaN(re) || Number.isNaN(oe) || oe < 1e3 || oe > 9999) return null;
3235
- const j = new Date(oe, re - 1, ee);
3236
- return j.getFullYear() !== oe || j.getMonth() !== re - 1 || j.getDate() !== ee ? null : j;
3237
- }, []), $e = R((h) => {
3238
- const T = h.trim();
3239
- if (!T) return null;
3240
- const [H, X] = T.split("-"), z = ve(H ?? "");
3241
- if (!z) return null;
3242
- const ee = X?.trim() ?? "", oe = (ee ? ve(ee) : void 0) || void 0;
3243
- let j = { from: z, to: oe };
3244
- if (j.to && j.from && j.to.getTime() < j.from.getTime()) {
3245
- const ue = j.from;
3246
- j = { from: j.to, to: ue };
3247
- }
3248
- if (t === "range" && (k || C) && j.from && j.to) {
3249
- const te = Math.round((j.to.getTime() - j.from.getTime()) / 864e5) + 1;
3250
- if (k && te < k || C && te > C) return null;
3251
- }
3252
- return j;
3253
- }, [t, k, C, ve]), Qe = R(() => {
3254
- const h = V.trim();
3255
- if (!h) {
3256
- (t === "single" || t === "range") && r?.(void 0);
3257
- return;
3258
- }
3259
- if (t === "single") {
3260
- const T = ve(h);
3261
- if (!T) {
3262
- J(he);
3263
- return;
3264
- }
3265
- xe(T);
3266
- return;
3267
- }
3268
- if (t === "range") {
3269
- const T = $e(h);
3270
- if (!T) {
3271
- J(he);
3272
- return;
3273
- }
3274
- xe(T);
3275
- }
3276
- }, [V, t, ve, $e, xe, he]), lt = R((h) => {
3277
- if (h.key === "Enter") {
3278
- h.preventDefault(), Qe();
3279
- return;
3280
- }
3281
- if (h.key === "ArrowUp" || h.key === "ArrowDown") {
3282
- const T = h.key === "ArrowUp" ? 1 : -1, H = h.currentTarget.selectionStart ?? 0;
3283
- if (t === "single") {
3284
- const X = ve(V);
3285
- if (!X) return;
3286
- h.preventDefault();
3287
- const z = new Date(X);
3288
- H <= 2 ? z.setDate(z.getDate() + T) : H <= 5 ? z.setMonth(z.getMonth() + T) : z.setFullYear(z.getFullYear() + T), me.current = H, J(z.toLocaleDateString("es-ES", { day: "2-digit", month: "2-digit", year: "numeric" })), xe(z);
3289
- return;
3290
- }
3291
- if (t === "range") {
3292
- const X = $e(V);
3293
- if (!X || !X.from) return;
3294
- h.preventDefault();
3295
- const re = V.indexOf("-") === -1 || H <= 9, oe = re ? H : Math.max(0, H - 13), j = new Date(X.from), ue = X.to ? new Date(X.to) : void 0, te = re ? j : ue ?? j;
3296
- oe <= 2 ? te.setDate(te.getDate() + T) : oe <= 5 ? te.setMonth(te.getMonth() + T) : te.setFullYear(te.getFullYear() + T);
3297
- let q = {
3298
- from: re ? te : j,
3299
- to: re ? ue : te
3300
- };
3301
- if (q.to && q.from && q.to.getTime() < q.from.getTime()) {
3302
- const Ne = q.from;
3303
- q = { from: q.to, to: Ne };
3304
- }
3305
- if ((k || C) && q.from && q.to) {
3306
- const Pe = Math.round((q.to.getTime() - q.from.getTime()) / 864e5) + 1;
3307
- if (k && Pe < k || C && Pe > C) return;
3308
- }
3309
- if (!q.from) return;
3310
- const He = q.from.toLocaleDateString("es-ES", { day: "2-digit", month: "2-digit", year: "numeric" }), qe = q.to ? q.to.toLocaleDateString("es-ES", { day: "2-digit", month: "2-digit", year: "numeric" }) : "";
3311
- me.current = H, J(q.to ? `${He} - ${qe}` : He), xe(q);
3312
- return;
3313
- }
3314
- }
3315
- }, [Qe, t, V, ve, $e, k, C, xe]), ft = R(() => {
3316
- const h = ce || [];
3317
- return /* @__PURE__ */ U.jsx(
3318
- Dn,
3319
- {
3320
- label: S,
3321
- placeholder: "Seleccione una o más fechas",
3322
- name: v,
3323
- value: h.sort((T, H) => T.getTime() - H.getTime()).map((T) => T.toLocaleDateString("es-ES", { day: "2-digit", month: "2-digit", year: "numeric" })),
3324
- onChange: () => {
3325
- },
3326
- onClick: () => Z(!0),
3327
- className: Ze("w-[360px]", p?.className),
3328
- readonly: !0,
3329
- onValueDelete: at,
3330
- icon: /* @__PURE__ */ U.jsx(Nt, {})
3331
- }
3332
- );
3333
- }, [ce, S, v, at, p]), mt = se(() => ({
3334
- top: I?.top,
3335
- left: I?.left,
3336
- bottom: I?.bottom,
3337
- right: I?.right,
3338
- opacity: B && $ ? 1 : 0,
3339
- transition: "opacity 0.15s linear",
3340
- position: "fixed",
3341
- zIndex: 1e3,
3342
- pointerEvents: B && $ ? "auto" : "none"
3343
- }), [I, B, $]);
3344
- return /* @__PURE__ */ U.jsxs("div", { className: Ze("relative w-max flex flex-col gap-2 lg:min-w-[360px] min-w-auto", p?.className), children: [
3345
- ut && /* @__PURE__ */ U.jsx(
3346
- "div",
3347
- {
3348
- ref: je,
3349
- className: "relative w-full",
3350
- children: t === "multiple" ? ft() : /* @__PURE__ */ U.jsx(
3351
- vn,
3352
- {
3353
- ...p,
3354
- ref: Ee,
3355
- readOnly: l || p?.readOnly,
3356
- icon: /* @__PURE__ */ U.jsx(Nt, {}),
3357
- iconPosition: "right",
3358
- type: "text",
3359
- inputMode: p?.inputMode ?? "numeric",
3360
- value: V,
3361
- onChange: (h) => {
3362
- if (l) {
3363
- p?.onChange?.(h);
3364
- return;
3365
- }
3366
- J(h.target.value);
3367
- },
3368
- name: v,
3369
- label: S,
3370
- onFocus: (h) => {
3371
- h.stopPropagation(), p?.onFocus?.(h), g === "input" && Z(!0);
3372
- },
3373
- onClick: (h) => {
3374
- h.stopPropagation(), g === "input" && !$ && Z(!0);
3375
- },
3376
- onBlur: (h) => {
3377
- p?.onBlur?.(h), l || Qe();
3378
- },
3379
- onKeyDown: (h) => {
3380
- p?.onKeyDown?.(h), l || lt(h);
3381
- }
3382
- }
3383
- )
3384
- }
3385
- ),
3386
- dt && (g === "input" ? document?.body && kn(
3387
- /* @__PURE__ */ U.jsx(
3388
- Ot,
3389
- {
3390
- mode: t,
3391
- footer: i,
3392
- header: a,
3393
- selected: n,
3394
- ref: De,
3395
- endMonth: u,
3396
- required: o,
3397
- onApply: ot,
3398
- onCancel: Ve,
3399
- hideFooter: D,
3400
- startMonth: f,
3401
- applyLabel: M,
3402
- cancelLabel: b,
3403
- displayValue: Ae,
3404
- disabledDates: s,
3405
- numberOfMonths: Be ? 1 : d,
3406
- onSelect: Xe,
3407
- hideOutsideDays: c,
3408
- showActionButtons: l,
3409
- min: k,
3410
- max: C,
3411
- excludeDisabled: A,
3412
- className: Ze("bg-neutral-strong-default text-neutral-default-default shadow", y),
3413
- style: mt
3414
- }
3415
- ),
3416
- document.body
3417
- ) : /* @__PURE__ */ U.jsx(
3418
- Ot,
3419
- {
3420
- min: k,
3421
- max: C,
3422
- mode: t,
3423
- header: a,
3424
- footer: i,
3425
- required: o,
3426
- endMonth: u,
3427
- selected: n,
3428
- className: y,
3429
- onApply: ot,
3430
- startMonth: f,
3431
- applyLabel: M,
3432
- hideFooter: D,
3433
- onCancel: Ve,
3434
- cancelLabel: b,
3435
- displayValue: Ae,
3436
- disabledDates: s,
3437
- numberOfMonths: Be ? 1 : d,
3438
- onSelect: Xe,
3439
- hideOutsideDays: c,
3440
- showActionButtons: l,
3441
- excludeDisabled: A
3442
- }
3443
- ))
3444
- ] });
3445
- }, Ot = Mn((e) => {
3446
- const {
3447
- ref: t,
3448
- min: o,
3449
- max: n,
3450
- style: r,
3451
- header: s,
3452
- footer: a,
3453
- onApply: i,
3454
- onCancel: c,
3455
- onSelect: d,
3456
- required: f,
3457
- endMonth: u,
3458
- className: l,
3459
- startMonth: M,
3460
- displayValue: b,
3461
- disabledDates: N,
3462
- excludeDisabled: O,
3463
- mode: D = "single",
3464
- readonly: g = !1,
3465
- numberOfMonths: p = 1,
3466
- hideFooter: S = !1,
3467
- applyLabel: v = "Aplicar",
3468
- cancelLabel: y = "Cancelar",
3469
- hideOutsideDays: k = !1,
3470
- showActionButtons: C = !1
3471
- } = e, A = se(() => {
3472
- if (b) {
3473
- if (D === "single")
3474
- return b;
3475
- if (D === "range") {
3476
- const B = b;
3477
- return B.to ? B.to : B.from ? B.from : void 0;
3478
- }
3479
- if (D === "multiple") {
3480
- const B = b;
3481
- return B.length > 0 ? B[B.length - 1] : void 0;
3482
- }
3483
- }
3484
- }, [b, D]), I = se(() => ({
3485
- formatWeekdayName: (B) => B.toLocaleDateString("es-ES", { weekday: "narrow" }).toUpperCase()
3486
- }), []), G = se(() => ({
3487
- // Días de la semana (cabecera)
3488
- weekday: " prometeo-fonts-body-large text-neutral-default-default h-12 w-12 ",
3489
- // Días del mes
3490
- day: `w-12 h-12 p-1 prometeo-fonts-body-large text-neutral-default-default ${g ? "" : "active:text-neutral-default-focused"}`,
3491
- day_button: `w-full h-full rounded-[4px] ${g ? "cursor-default" : "cursor-pointer"}`,
3492
- // Día seleccionado
3493
- selected: "selected-day-button",
3494
- // Día de hoy
3495
- today: `today-day-button text-primary-default-default! ${g ? "cursor-default" : "active:text-primary-default-focused! hover:text-primary-default-hover! cursor-pointer"} opacity-100`,
3496
- // Rango de fechas
3497
- range_start: "text-white rounded-l-lg range-start-day-button",
3498
- range_end: "text-white rounded-r-lg range-end-day-button",
3499
- range_middle: "text-neutral-default-default range-middle-day-button",
3500
- // Día deshabilitado
3501
- disabled: " opacity-10",
3502
- // Días fuera del mes actual
3503
- outside: "text-neutral-medium-default",
3504
- //Contenedor
3505
- months: "flex gap-4 justify-center relative w-full flex-wrap overflow-auto ",
3506
- root: "px-2 text-neutral-default-default "
3507
- }), [g]), $ = se(() => {
3508
- if (u) return u;
3509
- const B = /* @__PURE__ */ new Date();
3510
- return new Date(B.getFullYear() + 20, 11, 31);
3511
- }, [u]), Z = se(() => {
3512
- const B = b ? JSON.stringify(b) : "empty";
3513
- return `${D}-${B}`;
3514
- }, [D, b]);
3515
- return /* @__PURE__ */ U.jsxs(
3516
- "div",
3517
- {
3518
- ref: t,
3519
- className: Ze(
3520
- "border border-neutral-default-default rounded-lg",
3521
- l
3522
- ),
3523
- style: {
3524
- ...r,
3525
- width: p * 360,
3526
- overflowX: "auto"
3527
- },
3528
- children: [
3529
- s && /* @__PURE__ */ U.jsx("div", { className: "pt-6 pl-6 pr-3 pb-2 min-h-[68px]", children: typeof s == "string" ? /* @__PURE__ */ U.jsx("p", { className: "prometeo-fonts-label-large text-neutral-medium-default w-64 ", children: s }) : s }),
3530
- D === "single" && /* @__PURE__ */ U.jsx(
3531
- Dt,
3532
- {
3533
- locale: vt,
3534
- mode: "single",
3535
- captionLayout: "dropdown",
3536
- formatters: I,
3537
- classNames: G,
3538
- required: f,
3539
- disabled: N,
3540
- selected: b,
3541
- defaultMonth: A,
3542
- className: "px-3",
3543
- showOutsideDays: !k,
3544
- numberOfMonths: p,
3545
- startMonth: M,
3546
- endMonth: $,
3547
- onSelect: g ? () => {
3548
- } : d
3549
- },
3550
- Z
3551
- ),
3552
- D === "range" && /* @__PURE__ */ U.jsx(
3553
- Dt,
3554
- {
3555
- mode: "range",
3556
- captionLayout: "dropdown",
3557
- formatters: I,
3558
- classNames: G,
3559
- numberOfMonths: p,
3560
- selected: b,
3561
- defaultMonth: A,
3562
- onSelect: g ? () => {
3563
- } : d,
3564
- required: f,
3565
- disabled: N,
3566
- startMonth: M,
3567
- endMonth: $,
3568
- min: o,
3569
- max: n,
3570
- pagedNavigation: !0,
3571
- locale: vt,
3572
- excludeDisabled: O ?? !0
3573
- },
3574
- Z
3575
- ),
3576
- D === "multiple" && /* @__PURE__ */ U.jsx(
3577
- Dt,
3578
- {
3579
- mode: "multiple",
3580
- captionLayout: "dropdown",
3581
- formatters: I,
3582
- classNames: G,
3583
- selected: b,
3584
- defaultMonth: A,
3585
- onSelect: g ? () => {
3586
- } : d,
3587
- required: f,
3588
- disabled: N,
3589
- startMonth: M,
3590
- endMonth: u,
3591
- min: o,
3592
- max: n,
3593
- locale: vt
3594
- },
3595
- Z
3596
- ),
3597
- !S && /* @__PURE__ */ U.jsx("div", { className: Ze(
3598
- "w-full min-h-[40px] pt-2 px-3 pb-3 flex items-center relative"
3599
- ), children: typeof a == "string" ? /* @__PURE__ */ U.jsx("p", { className: "prometeo-fonts-label-large text-neutral-medium-default w-64 ", children: a }) : a }),
3600
- C && /* @__PURE__ */ U.jsxs("div", { className: "w-full px-3 pb-3 pt-2 flex gap-2 justify-end ", children: [
3601
- /* @__PURE__ */ U.jsx(
3602
- Pt,
3603
- {
3604
- variant: "text",
3605
- onClick: c,
3606
- color: "secondary",
3607
- children: y
3608
- }
3609
- ),
3610
- /* @__PURE__ */ U.jsx(
3611
- Pt,
3612
- {
3613
- onClick: i,
3614
- variant: "text",
3615
- color: "primary",
3616
- children: v
3617
- }
3618
- )
3619
- ] })
3620
- ]
3621
- }
3622
- );
3623
- });
3624
- Ot.displayName = "Calendar";
3625
- export {
3626
- Ot as C,
3627
- ds as D
3628
- };