@itaptec/form_components 0.0.1-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,3016 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+
33
+ // src/components/forms/button/button.tsx
34
+ import { Button, CircularProgress } from "@mui/material";
35
+ import { CheckCircle, Error as Error2 } from "@mui/icons-material";
36
+ import { useState } from "react";
37
+ import { jsx } from "react/jsx-runtime";
38
+ function ItaptecButton(_a) {
39
+ var _b = _a, {
40
+ startIcon,
41
+ color,
42
+ onClick
43
+ } = _b, rest = __objRest(_b, [
44
+ "startIcon",
45
+ "color",
46
+ "onClick"
47
+ ]);
48
+ const [status, setStatus] = useState("idle");
49
+ const onClickHandler = (event) => {
50
+ if (!onClick) return;
51
+ const result = onClick(event);
52
+ if (result instanceof Promise) {
53
+ setStatus("loading");
54
+ result.then(() => setStatus("success")).catch(() => setStatus("error"));
55
+ }
56
+ };
57
+ return /* @__PURE__ */ jsx(
58
+ Button,
59
+ __spreadProps(__spreadValues({}, rest), {
60
+ disabled: status === "loading",
61
+ startIcon: status === "loading" ? /* @__PURE__ */ jsx(CircularProgress, { size: 20 }) : status === "error" ? /* @__PURE__ */ jsx(Error2, {}) : status === "success" ? /* @__PURE__ */ jsx(CheckCircle, {}) : startIcon,
62
+ color: status === "error" ? "error" : status === "success" ? "success" : color,
63
+ onClick: onClickHandler
64
+ })
65
+ );
66
+ }
67
+
68
+ // src/components/forms/split-button/split-button.tsx
69
+ import React2, { useEffect, useRef, useState as useState2 } from "react";
70
+ import {
71
+ Button as Button2,
72
+ ButtonGroup,
73
+ CircularProgress as CircularProgress2,
74
+ ListItemIcon,
75
+ ListItemText,
76
+ MenuItem,
77
+ MenuList,
78
+ Popover
79
+ } from "@mui/material";
80
+ import { ArrowDropDown } from "@mui/icons-material";
81
+
82
+ // src/hooks/useField.ts
83
+ import {
84
+ useController
85
+ } from "react-hook-form";
86
+ function useField(props) {
87
+ const _a = useController(props), {
88
+ field: _b
89
+ } = _a, _c = _b, { value } = _c, restField = __objRest(_c, ["value"]), {
90
+ fieldState,
91
+ formState
92
+ } = _a;
93
+ const val = value;
94
+ return { field: __spreadValues({ value: val }, restField), fieldState, formState };
95
+ }
96
+
97
+ // src/hooks/useOptions.ts
98
+ import { useQuery } from "@tanstack/react-query";
99
+ function useOptions(props) {
100
+ const { getOptions } = props;
101
+ const {
102
+ data: options,
103
+ isSuccess,
104
+ isRefetching,
105
+ isLoading
106
+ } = useQuery({
107
+ queryKey: [
108
+ // `select-${name}`,
109
+ // ...(optionsDeps ?? [])
110
+ // TODO: hay que tener en cuenta que si cambian las opciones,
111
+ // hay que hacerle reset al hook form
112
+ ],
113
+ // staleTime: Infinity,
114
+ // enabled: !loadOnOpen, // The query will be disabled if loadOnOpen is true.
115
+ queryFn: () => {
116
+ if (Array.isArray(getOptions)) {
117
+ return Promise.resolve(getOptions);
118
+ }
119
+ const result = getOptions();
120
+ if (Array.isArray(result)) {
121
+ return Promise.resolve(result);
122
+ }
123
+ return result;
124
+ }
125
+ });
126
+ return {
127
+ options,
128
+ isSuccess,
129
+ isLoading: isLoading || isRefetching
130
+ };
131
+ }
132
+
133
+ // src/components/forms/split-button/split-button.tsx
134
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
135
+ function SplitButton(props) {
136
+ const { loadOptions, onClick } = props;
137
+ const [optionsMenuIsOpen, setOptionsMenuIsOpen] = useState2(false);
138
+ const [selectedOption, setSelectedOptions] = React2.useState();
139
+ const [actionLoading, setActionLoading] = React2.useState(false);
140
+ const { options, isSuccess, isLoading } = useOptions({
141
+ getOptions: loadOptions
142
+ });
143
+ useEffect(() => {
144
+ if (options && options.length) {
145
+ setSelectedOptions(options[0]);
146
+ }
147
+ }, [options == null ? void 0 : options.length]);
148
+ const anchorRef = useRef(null);
149
+ const handleClick = (event) => {
150
+ if (!selectedOption) return;
151
+ const result = onClick(event, selectedOption);
152
+ if (result instanceof Promise) {
153
+ setActionLoading(true);
154
+ result.finally(() => setActionLoading(false));
155
+ }
156
+ if (!result) return;
157
+ return result;
158
+ };
159
+ const handleMenuItemClick = (event, selection) => {
160
+ setSelectedOptions(selection);
161
+ setOptionsMenuIsOpen(false);
162
+ };
163
+ const handleToggle = () => {
164
+ setOptionsMenuIsOpen((prevOpen) => !prevOpen);
165
+ };
166
+ const handleClose = (event) => {
167
+ if (anchorRef.current && anchorRef.current.contains(event.target))
168
+ return;
169
+ setOptionsMenuIsOpen(false);
170
+ };
171
+ return /* @__PURE__ */ jsxs(React2.Fragment, { children: [
172
+ /* @__PURE__ */ jsxs(ButtonGroup, __spreadProps(__spreadValues({}, props.ButtonGroupProps), { children: [
173
+ /* @__PURE__ */ jsx2(
174
+ ItaptecButton,
175
+ {
176
+ onClick: handleClick,
177
+ disabled: !isSuccess,
178
+ startIcon: selectedOption == null ? void 0 : selectedOption.icon,
179
+ children: isLoading ? /* @__PURE__ */ jsx2(CircularProgress2, { color: "inherit", size: 20 }) : selectedOption ? selectedOption.label : null
180
+ },
181
+ selectedOption == null ? void 0 : selectedOption.value
182
+ ),
183
+ /* @__PURE__ */ jsx2(
184
+ Button2,
185
+ {
186
+ ref: anchorRef,
187
+ size: "small",
188
+ onClick: handleToggle,
189
+ disabled: !options || !options.length || actionLoading,
190
+ children: /* @__PURE__ */ jsx2(ArrowDropDown, {})
191
+ }
192
+ )
193
+ ] })),
194
+ /* @__PURE__ */ jsx2(
195
+ Popover,
196
+ __spreadProps(__spreadValues({
197
+ open: optionsMenuIsOpen,
198
+ anchorEl: anchorRef.current,
199
+ onClose: handleClose,
200
+ anchorOrigin: {
201
+ vertical: "bottom",
202
+ horizontal: "right"
203
+ },
204
+ transformOrigin: {
205
+ vertical: "top",
206
+ horizontal: "right"
207
+ }
208
+ }, props.PopoverProps), {
209
+ children: /* @__PURE__ */ jsx2(MenuList, __spreadProps(__spreadValues({}, props.MenuListProps), { children: options && options.map((option) => /* @__PURE__ */ jsxs(
210
+ MenuItem,
211
+ {
212
+ value: option.value,
213
+ selected: selectedOption && option.value === selectedOption.value,
214
+ onClick: (event) => handleMenuItemClick(event, option),
215
+ children: [
216
+ option.icon && /* @__PURE__ */ jsx2(ListItemIcon, { children: option.icon }),
217
+ /* @__PURE__ */ jsx2(ListItemText, { children: option.label })
218
+ ]
219
+ },
220
+ option.value
221
+ )) }))
222
+ })
223
+ )
224
+ ] });
225
+ }
226
+
227
+ // src/components/forms/text-field/text-field.tsx
228
+ import { TextField } from "@mui/material";
229
+ import { Controller } from "react-hook-form";
230
+ import { useIMask } from "react-imask";
231
+ import { useRef as useRef2, useState as useState3 } from "react";
232
+ import { jsx as jsx3 } from "react/jsx-runtime";
233
+ function ControlledTextField(_a) {
234
+ var _b = _a, {
235
+ control,
236
+ name,
237
+ mask,
238
+ ControllerProps: ControllerProps2,
239
+ debounce = false,
240
+ debounceTime = 300
241
+ } = _b, rest = __objRest(_b, [
242
+ "control",
243
+ "name",
244
+ "mask",
245
+ "ControllerProps",
246
+ "debounce",
247
+ "debounceTime"
248
+ ]);
249
+ const [displayedValue, setDisplayedValue] = useState3("");
250
+ const displayedValueRef = useRef2(displayedValue);
251
+ const timerRef = useRef2(void 0);
252
+ const handleChange = (newValue, onChange) => {
253
+ setDisplayedValue(newValue);
254
+ if (debounce) {
255
+ if (timerRef.current) {
256
+ clearTimeout(timerRef.current);
257
+ }
258
+ timerRef.current = setTimeout(() => {
259
+ onChange(newValue);
260
+ }, debounceTime);
261
+ } else {
262
+ onChange(newValue);
263
+ }
264
+ };
265
+ return /* @__PURE__ */ jsx3(
266
+ Controller,
267
+ __spreadProps(__spreadValues({
268
+ control,
269
+ name
270
+ }, ControllerProps2), {
271
+ render: ({ field: { onChange, value }, fieldState: { error } }) => {
272
+ return mask ? /* @__PURE__ */ jsx3(
273
+ TextFieldWithMask,
274
+ __spreadValues({
275
+ mask,
276
+ onChange: (e) => handleChange(e.target.value, onChange),
277
+ value: displayedValue,
278
+ error: !!error,
279
+ helperText: error && error.message
280
+ }, rest)
281
+ ) : /* @__PURE__ */ jsx3(
282
+ TextField,
283
+ __spreadValues({
284
+ onChange: (e) => handleChange(e.target.value, onChange),
285
+ value: displayedValue,
286
+ error: !!error,
287
+ helperText: error && error.message
288
+ }, rest)
289
+ );
290
+ }
291
+ })
292
+ );
293
+ }
294
+ var TextFieldWithMask = (props) => {
295
+ const _a = props, { mask, onChange } = _a, textFieldProps = __objRest(_a, ["mask", "onChange"]);
296
+ const [value, setValue] = useState3("");
297
+ const { ref } = useIMask(mask, {
298
+ onAccept: (value2, mask2) => {
299
+ setValue(value2);
300
+ const event = {
301
+ target: { name: props.name, value: value2 }
302
+ };
303
+ onChange(event);
304
+ }
305
+ });
306
+ return /* @__PURE__ */ jsx3(TextField, __spreadProps(__spreadValues({}, textFieldProps), { value, inputRef: ref }));
307
+ };
308
+
309
+ // src/components/forms/date-pickers/ControlledDateRangePicker.tsx
310
+ import { useState as useState4 } from "react";
311
+ import { Controller as Controller2 } from "react-hook-form";
312
+ import { DateRangePicker } from "react-date-range";
313
+
314
+ // node_modules/date-fns/locale/_lib/buildFormatLongFn.mjs
315
+ function buildFormatLongFn(args) {
316
+ return (options = {}) => {
317
+ const width = options.width ? String(options.width) : args.defaultWidth;
318
+ const format2 = args.formats[width] || args.formats[args.defaultWidth];
319
+ return format2;
320
+ };
321
+ }
322
+
323
+ // node_modules/date-fns/locale/_lib/buildLocalizeFn.mjs
324
+ function buildLocalizeFn(args) {
325
+ return (value, options) => {
326
+ const context = (options == null ? void 0 : options.context) ? String(options.context) : "standalone";
327
+ let valuesArray;
328
+ if (context === "formatting" && args.formattingValues) {
329
+ const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
330
+ const width = (options == null ? void 0 : options.width) ? String(options.width) : defaultWidth;
331
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
332
+ } else {
333
+ const defaultWidth = args.defaultWidth;
334
+ const width = (options == null ? void 0 : options.width) ? String(options.width) : args.defaultWidth;
335
+ valuesArray = args.values[width] || args.values[defaultWidth];
336
+ }
337
+ const index = args.argumentCallback ? args.argumentCallback(value) : value;
338
+ return valuesArray[index];
339
+ };
340
+ }
341
+
342
+ // node_modules/date-fns/locale/_lib/buildMatchFn.mjs
343
+ function buildMatchFn(args) {
344
+ return (string, options = {}) => {
345
+ const width = options.width;
346
+ const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
347
+ const matchResult = string.match(matchPattern);
348
+ if (!matchResult) {
349
+ return null;
350
+ }
351
+ const matchedString = matchResult[0];
352
+ const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
353
+ const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
354
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
355
+ findKey(parsePatterns, (pattern) => pattern.test(matchedString))
356
+ );
357
+ let value;
358
+ value = args.valueCallback ? args.valueCallback(key) : key;
359
+ value = options.valueCallback ? (
360
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
361
+ options.valueCallback(value)
362
+ ) : value;
363
+ const rest = string.slice(matchedString.length);
364
+ return { value, rest };
365
+ };
366
+ }
367
+ function findKey(object, predicate) {
368
+ for (const key in object) {
369
+ if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
370
+ return key;
371
+ }
372
+ }
373
+ return void 0;
374
+ }
375
+ function findIndex(array, predicate) {
376
+ for (let key = 0; key < array.length; key++) {
377
+ if (predicate(array[key])) {
378
+ return key;
379
+ }
380
+ }
381
+ return void 0;
382
+ }
383
+
384
+ // node_modules/date-fns/locale/_lib/buildMatchPatternFn.mjs
385
+ function buildMatchPatternFn(args) {
386
+ return (string, options = {}) => {
387
+ const matchResult = string.match(args.matchPattern);
388
+ if (!matchResult) return null;
389
+ const matchedString = matchResult[0];
390
+ const parseResult = string.match(args.parsePattern);
391
+ if (!parseResult) return null;
392
+ let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
393
+ value = options.valueCallback ? options.valueCallback(value) : value;
394
+ const rest = string.slice(matchedString.length);
395
+ return { value, rest };
396
+ };
397
+ }
398
+
399
+ // node_modules/date-fns/toDate.mjs
400
+ function toDate(argument) {
401
+ const argStr = Object.prototype.toString.call(argument);
402
+ if (argument instanceof Date || typeof argument === "object" && argStr === "[object Date]") {
403
+ return new argument.constructor(+argument);
404
+ } else if (typeof argument === "number" || argStr === "[object Number]" || typeof argument === "string" || argStr === "[object String]") {
405
+ return new Date(argument);
406
+ } else {
407
+ return /* @__PURE__ */ new Date(NaN);
408
+ }
409
+ }
410
+
411
+ // node_modules/date-fns/_lib/defaultOptions.mjs
412
+ var defaultOptions = {};
413
+ function getDefaultOptions() {
414
+ return defaultOptions;
415
+ }
416
+
417
+ // node_modules/date-fns/startOfWeek.mjs
418
+ function startOfWeek(date, options) {
419
+ var _a, _b, _c, _d, _e, _f, _g, _h;
420
+ const defaultOptions2 = getDefaultOptions();
421
+ const weekStartsOn = (_h = (_g = (_d = (_c = options == null ? void 0 : options.weekStartsOn) != null ? _c : (_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) != null ? _d : defaultOptions2.weekStartsOn) != null ? _g : (_f = (_e = defaultOptions2.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.weekStartsOn) != null ? _h : 0;
422
+ const _date = toDate(date);
423
+ const day = _date.getDay();
424
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
425
+ _date.setDate(_date.getDate() - diff);
426
+ _date.setHours(0, 0, 0, 0);
427
+ return _date;
428
+ }
429
+
430
+ // node_modules/date-fns/locale/en-US/_lib/formatDistance.mjs
431
+ var formatDistanceLocale = {
432
+ lessThanXSeconds: {
433
+ one: "less than a second",
434
+ other: "less than {{count}} seconds"
435
+ },
436
+ xSeconds: {
437
+ one: "1 second",
438
+ other: "{{count}} seconds"
439
+ },
440
+ halfAMinute: "half a minute",
441
+ lessThanXMinutes: {
442
+ one: "less than a minute",
443
+ other: "less than {{count}} minutes"
444
+ },
445
+ xMinutes: {
446
+ one: "1 minute",
447
+ other: "{{count}} minutes"
448
+ },
449
+ aboutXHours: {
450
+ one: "about 1 hour",
451
+ other: "about {{count}} hours"
452
+ },
453
+ xHours: {
454
+ one: "1 hour",
455
+ other: "{{count}} hours"
456
+ },
457
+ xDays: {
458
+ one: "1 day",
459
+ other: "{{count}} days"
460
+ },
461
+ aboutXWeeks: {
462
+ one: "about 1 week",
463
+ other: "about {{count}} weeks"
464
+ },
465
+ xWeeks: {
466
+ one: "1 week",
467
+ other: "{{count}} weeks"
468
+ },
469
+ aboutXMonths: {
470
+ one: "about 1 month",
471
+ other: "about {{count}} months"
472
+ },
473
+ xMonths: {
474
+ one: "1 month",
475
+ other: "{{count}} months"
476
+ },
477
+ aboutXYears: {
478
+ one: "about 1 year",
479
+ other: "about {{count}} years"
480
+ },
481
+ xYears: {
482
+ one: "1 year",
483
+ other: "{{count}} years"
484
+ },
485
+ overXYears: {
486
+ one: "over 1 year",
487
+ other: "over {{count}} years"
488
+ },
489
+ almostXYears: {
490
+ one: "almost 1 year",
491
+ other: "almost {{count}} years"
492
+ }
493
+ };
494
+ var formatDistance = (token, count, options) => {
495
+ let result;
496
+ const tokenValue = formatDistanceLocale[token];
497
+ if (typeof tokenValue === "string") {
498
+ result = tokenValue;
499
+ } else if (count === 1) {
500
+ result = tokenValue.one;
501
+ } else {
502
+ result = tokenValue.other.replace("{{count}}", count.toString());
503
+ }
504
+ if (options == null ? void 0 : options.addSuffix) {
505
+ if (options.comparison && options.comparison > 0) {
506
+ return "in " + result;
507
+ } else {
508
+ return result + " ago";
509
+ }
510
+ }
511
+ return result;
512
+ };
513
+
514
+ // node_modules/date-fns/locale/en-US/_lib/formatRelative.mjs
515
+ var formatRelativeLocale = {
516
+ lastWeek: "'last' eeee 'at' p",
517
+ yesterday: "'yesterday at' p",
518
+ today: "'today at' p",
519
+ tomorrow: "'tomorrow at' p",
520
+ nextWeek: "eeee 'at' p",
521
+ other: "P"
522
+ };
523
+ var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
524
+
525
+ // node_modules/date-fns/locale/en-US/_lib/localize.mjs
526
+ var eraValues = {
527
+ narrow: ["B", "A"],
528
+ abbreviated: ["BC", "AD"],
529
+ wide: ["Before Christ", "Anno Domini"]
530
+ };
531
+ var quarterValues = {
532
+ narrow: ["1", "2", "3", "4"],
533
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
534
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
535
+ };
536
+ var monthValues = {
537
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
538
+ abbreviated: [
539
+ "Jan",
540
+ "Feb",
541
+ "Mar",
542
+ "Apr",
543
+ "May",
544
+ "Jun",
545
+ "Jul",
546
+ "Aug",
547
+ "Sep",
548
+ "Oct",
549
+ "Nov",
550
+ "Dec"
551
+ ],
552
+ wide: [
553
+ "January",
554
+ "February",
555
+ "March",
556
+ "April",
557
+ "May",
558
+ "June",
559
+ "July",
560
+ "August",
561
+ "September",
562
+ "October",
563
+ "November",
564
+ "December"
565
+ ]
566
+ };
567
+ var dayValues = {
568
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
569
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
570
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
571
+ wide: [
572
+ "Sunday",
573
+ "Monday",
574
+ "Tuesday",
575
+ "Wednesday",
576
+ "Thursday",
577
+ "Friday",
578
+ "Saturday"
579
+ ]
580
+ };
581
+ var dayPeriodValues = {
582
+ narrow: {
583
+ am: "a",
584
+ pm: "p",
585
+ midnight: "mi",
586
+ noon: "n",
587
+ morning: "morning",
588
+ afternoon: "afternoon",
589
+ evening: "evening",
590
+ night: "night"
591
+ },
592
+ abbreviated: {
593
+ am: "AM",
594
+ pm: "PM",
595
+ midnight: "midnight",
596
+ noon: "noon",
597
+ morning: "morning",
598
+ afternoon: "afternoon",
599
+ evening: "evening",
600
+ night: "night"
601
+ },
602
+ wide: {
603
+ am: "a.m.",
604
+ pm: "p.m.",
605
+ midnight: "midnight",
606
+ noon: "noon",
607
+ morning: "morning",
608
+ afternoon: "afternoon",
609
+ evening: "evening",
610
+ night: "night"
611
+ }
612
+ };
613
+ var formattingDayPeriodValues = {
614
+ narrow: {
615
+ am: "a",
616
+ pm: "p",
617
+ midnight: "mi",
618
+ noon: "n",
619
+ morning: "in the morning",
620
+ afternoon: "in the afternoon",
621
+ evening: "in the evening",
622
+ night: "at night"
623
+ },
624
+ abbreviated: {
625
+ am: "AM",
626
+ pm: "PM",
627
+ midnight: "midnight",
628
+ noon: "noon",
629
+ morning: "in the morning",
630
+ afternoon: "in the afternoon",
631
+ evening: "in the evening",
632
+ night: "at night"
633
+ },
634
+ wide: {
635
+ am: "a.m.",
636
+ pm: "p.m.",
637
+ midnight: "midnight",
638
+ noon: "noon",
639
+ morning: "in the morning",
640
+ afternoon: "in the afternoon",
641
+ evening: "in the evening",
642
+ night: "at night"
643
+ }
644
+ };
645
+ var ordinalNumber = (dirtyNumber, _options) => {
646
+ const number = Number(dirtyNumber);
647
+ const rem100 = number % 100;
648
+ if (rem100 > 20 || rem100 < 10) {
649
+ switch (rem100 % 10) {
650
+ case 1:
651
+ return number + "st";
652
+ case 2:
653
+ return number + "nd";
654
+ case 3:
655
+ return number + "rd";
656
+ }
657
+ }
658
+ return number + "th";
659
+ };
660
+ var localize = {
661
+ ordinalNumber,
662
+ era: buildLocalizeFn({
663
+ values: eraValues,
664
+ defaultWidth: "wide"
665
+ }),
666
+ quarter: buildLocalizeFn({
667
+ values: quarterValues,
668
+ defaultWidth: "wide",
669
+ argumentCallback: (quarter) => quarter - 1
670
+ }),
671
+ month: buildLocalizeFn({
672
+ values: monthValues,
673
+ defaultWidth: "wide"
674
+ }),
675
+ day: buildLocalizeFn({
676
+ values: dayValues,
677
+ defaultWidth: "wide"
678
+ }),
679
+ dayPeriod: buildLocalizeFn({
680
+ values: dayPeriodValues,
681
+ defaultWidth: "wide",
682
+ formattingValues: formattingDayPeriodValues,
683
+ defaultFormattingWidth: "wide"
684
+ })
685
+ };
686
+
687
+ // node_modules/date-fns/locale/en-US/_lib/match.mjs
688
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
689
+ var parseOrdinalNumberPattern = /\d+/i;
690
+ var matchEraPatterns = {
691
+ narrow: /^(b|a)/i,
692
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
693
+ wide: /^(before christ|before common era|anno domini|common era)/i
694
+ };
695
+ var parseEraPatterns = {
696
+ any: [/^b/i, /^(a|c)/i]
697
+ };
698
+ var matchQuarterPatterns = {
699
+ narrow: /^[1234]/i,
700
+ abbreviated: /^q[1234]/i,
701
+ wide: /^[1234](th|st|nd|rd)? quarter/i
702
+ };
703
+ var parseQuarterPatterns = {
704
+ any: [/1/i, /2/i, /3/i, /4/i]
705
+ };
706
+ var matchMonthPatterns = {
707
+ narrow: /^[jfmasond]/i,
708
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
709
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
710
+ };
711
+ var parseMonthPatterns = {
712
+ narrow: [
713
+ /^j/i,
714
+ /^f/i,
715
+ /^m/i,
716
+ /^a/i,
717
+ /^m/i,
718
+ /^j/i,
719
+ /^j/i,
720
+ /^a/i,
721
+ /^s/i,
722
+ /^o/i,
723
+ /^n/i,
724
+ /^d/i
725
+ ],
726
+ any: [
727
+ /^ja/i,
728
+ /^f/i,
729
+ /^mar/i,
730
+ /^ap/i,
731
+ /^may/i,
732
+ /^jun/i,
733
+ /^jul/i,
734
+ /^au/i,
735
+ /^s/i,
736
+ /^o/i,
737
+ /^n/i,
738
+ /^d/i
739
+ ]
740
+ };
741
+ var matchDayPatterns = {
742
+ narrow: /^[smtwf]/i,
743
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
744
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
745
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
746
+ };
747
+ var parseDayPatterns = {
748
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
749
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
750
+ };
751
+ var matchDayPeriodPatterns = {
752
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
753
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
754
+ };
755
+ var parseDayPeriodPatterns = {
756
+ any: {
757
+ am: /^a/i,
758
+ pm: /^p/i,
759
+ midnight: /^mi/i,
760
+ noon: /^no/i,
761
+ morning: /morning/i,
762
+ afternoon: /afternoon/i,
763
+ evening: /evening/i,
764
+ night: /night/i
765
+ }
766
+ };
767
+ var match = {
768
+ ordinalNumber: buildMatchPatternFn({
769
+ matchPattern: matchOrdinalNumberPattern,
770
+ parsePattern: parseOrdinalNumberPattern,
771
+ valueCallback: (value) => parseInt(value, 10)
772
+ }),
773
+ era: buildMatchFn({
774
+ matchPatterns: matchEraPatterns,
775
+ defaultMatchWidth: "wide",
776
+ parsePatterns: parseEraPatterns,
777
+ defaultParseWidth: "any"
778
+ }),
779
+ quarter: buildMatchFn({
780
+ matchPatterns: matchQuarterPatterns,
781
+ defaultMatchWidth: "wide",
782
+ parsePatterns: parseQuarterPatterns,
783
+ defaultParseWidth: "any",
784
+ valueCallback: (index) => index + 1
785
+ }),
786
+ month: buildMatchFn({
787
+ matchPatterns: matchMonthPatterns,
788
+ defaultMatchWidth: "wide",
789
+ parsePatterns: parseMonthPatterns,
790
+ defaultParseWidth: "any"
791
+ }),
792
+ day: buildMatchFn({
793
+ matchPatterns: matchDayPatterns,
794
+ defaultMatchWidth: "wide",
795
+ parsePatterns: parseDayPatterns,
796
+ defaultParseWidth: "any"
797
+ }),
798
+ dayPeriod: buildMatchFn({
799
+ matchPatterns: matchDayPeriodPatterns,
800
+ defaultMatchWidth: "any",
801
+ parsePatterns: parseDayPeriodPatterns,
802
+ defaultParseWidth: "any"
803
+ })
804
+ };
805
+
806
+ // node_modules/date-fns/locale/en-US/_lib/formatLong.mjs
807
+ var dateFormats = {
808
+ full: "EEEE, MMMM do, y",
809
+ long: "MMMM do, y",
810
+ medium: "MMM d, y",
811
+ short: "MM/dd/yyyy"
812
+ };
813
+ var timeFormats = {
814
+ full: "h:mm:ss a zzzz",
815
+ long: "h:mm:ss a z",
816
+ medium: "h:mm:ss a",
817
+ short: "h:mm a"
818
+ };
819
+ var dateTimeFormats = {
820
+ full: "{{date}} 'at' {{time}}",
821
+ long: "{{date}} 'at' {{time}}",
822
+ medium: "{{date}}, {{time}}",
823
+ short: "{{date}}, {{time}}"
824
+ };
825
+ var formatLong = {
826
+ date: buildFormatLongFn({
827
+ formats: dateFormats,
828
+ defaultWidth: "full"
829
+ }),
830
+ time: buildFormatLongFn({
831
+ formats: timeFormats,
832
+ defaultWidth: "full"
833
+ }),
834
+ dateTime: buildFormatLongFn({
835
+ formats: dateTimeFormats,
836
+ defaultWidth: "full"
837
+ })
838
+ };
839
+
840
+ // node_modules/date-fns/locale/en-US.mjs
841
+ var enUS = {
842
+ code: "en-US",
843
+ formatDistance,
844
+ formatLong,
845
+ formatRelative,
846
+ localize,
847
+ match,
848
+ options: {
849
+ weekStartsOn: 0,
850
+ firstWeekContainsDate: 1
851
+ }
852
+ };
853
+
854
+ // node_modules/date-fns/locale/es/_lib/formatDistance.mjs
855
+ var formatDistanceLocale2 = {
856
+ lessThanXSeconds: {
857
+ one: "menos de un segundo",
858
+ other: "menos de {{count}} segundos"
859
+ },
860
+ xSeconds: {
861
+ one: "1 segundo",
862
+ other: "{{count}} segundos"
863
+ },
864
+ halfAMinute: "medio minuto",
865
+ lessThanXMinutes: {
866
+ one: "menos de un minuto",
867
+ other: "menos de {{count}} minutos"
868
+ },
869
+ xMinutes: {
870
+ one: "1 minuto",
871
+ other: "{{count}} minutos"
872
+ },
873
+ aboutXHours: {
874
+ one: "alrededor de 1 hora",
875
+ other: "alrededor de {{count}} horas"
876
+ },
877
+ xHours: {
878
+ one: "1 hora",
879
+ other: "{{count}} horas"
880
+ },
881
+ xDays: {
882
+ one: "1 d\xEDa",
883
+ other: "{{count}} d\xEDas"
884
+ },
885
+ aboutXWeeks: {
886
+ one: "alrededor de 1 semana",
887
+ other: "alrededor de {{count}} semanas"
888
+ },
889
+ xWeeks: {
890
+ one: "1 semana",
891
+ other: "{{count}} semanas"
892
+ },
893
+ aboutXMonths: {
894
+ one: "alrededor de 1 mes",
895
+ other: "alrededor de {{count}} meses"
896
+ },
897
+ xMonths: {
898
+ one: "1 mes",
899
+ other: "{{count}} meses"
900
+ },
901
+ aboutXYears: {
902
+ one: "alrededor de 1 a\xF1o",
903
+ other: "alrededor de {{count}} a\xF1os"
904
+ },
905
+ xYears: {
906
+ one: "1 a\xF1o",
907
+ other: "{{count}} a\xF1os"
908
+ },
909
+ overXYears: {
910
+ one: "m\xE1s de 1 a\xF1o",
911
+ other: "m\xE1s de {{count}} a\xF1os"
912
+ },
913
+ almostXYears: {
914
+ one: "casi 1 a\xF1o",
915
+ other: "casi {{count}} a\xF1os"
916
+ }
917
+ };
918
+ var formatDistance2 = (token, count, options) => {
919
+ let result;
920
+ const tokenValue = formatDistanceLocale2[token];
921
+ if (typeof tokenValue === "string") {
922
+ result = tokenValue;
923
+ } else if (count === 1) {
924
+ result = tokenValue.one;
925
+ } else {
926
+ result = tokenValue.other.replace("{{count}}", count.toString());
927
+ }
928
+ if (options == null ? void 0 : options.addSuffix) {
929
+ if (options.comparison && options.comparison > 0) {
930
+ return "en " + result;
931
+ } else {
932
+ return "hace " + result;
933
+ }
934
+ }
935
+ return result;
936
+ };
937
+
938
+ // node_modules/date-fns/locale/es/_lib/formatLong.mjs
939
+ var dateFormats2 = {
940
+ full: "EEEE, d 'de' MMMM 'de' y",
941
+ long: "d 'de' MMMM 'de' y",
942
+ medium: "d MMM y",
943
+ short: "dd/MM/y"
944
+ };
945
+ var timeFormats2 = {
946
+ full: "HH:mm:ss zzzz",
947
+ long: "HH:mm:ss z",
948
+ medium: "HH:mm:ss",
949
+ short: "HH:mm"
950
+ };
951
+ var dateTimeFormats2 = {
952
+ full: "{{date}} 'a las' {{time}}",
953
+ long: "{{date}} 'a las' {{time}}",
954
+ medium: "{{date}}, {{time}}",
955
+ short: "{{date}}, {{time}}"
956
+ };
957
+ var formatLong2 = {
958
+ date: buildFormatLongFn({
959
+ formats: dateFormats2,
960
+ defaultWidth: "full"
961
+ }),
962
+ time: buildFormatLongFn({
963
+ formats: timeFormats2,
964
+ defaultWidth: "full"
965
+ }),
966
+ dateTime: buildFormatLongFn({
967
+ formats: dateTimeFormats2,
968
+ defaultWidth: "full"
969
+ })
970
+ };
971
+
972
+ // node_modules/date-fns/locale/es/_lib/formatRelative.mjs
973
+ var formatRelativeLocale2 = {
974
+ lastWeek: "'el' eeee 'pasado a la' p",
975
+ yesterday: "'ayer a la' p",
976
+ today: "'hoy a la' p",
977
+ tomorrow: "'ma\xF1ana a la' p",
978
+ nextWeek: "eeee 'a la' p",
979
+ other: "P"
980
+ };
981
+ var formatRelativeLocalePlural = {
982
+ lastWeek: "'el' eeee 'pasado a las' p",
983
+ yesterday: "'ayer a las' p",
984
+ today: "'hoy a las' p",
985
+ tomorrow: "'ma\xF1ana a las' p",
986
+ nextWeek: "eeee 'a las' p",
987
+ other: "P"
988
+ };
989
+ var formatRelative2 = (token, date, _baseDate, _options) => {
990
+ if (date.getHours() !== 1) {
991
+ return formatRelativeLocalePlural[token];
992
+ } else {
993
+ return formatRelativeLocale2[token];
994
+ }
995
+ };
996
+
997
+ // node_modules/date-fns/locale/es/_lib/localize.mjs
998
+ var eraValues2 = {
999
+ narrow: ["AC", "DC"],
1000
+ abbreviated: ["AC", "DC"],
1001
+ wide: ["antes de cristo", "despu\xE9s de cristo"]
1002
+ };
1003
+ var quarterValues2 = {
1004
+ narrow: ["1", "2", "3", "4"],
1005
+ abbreviated: ["T1", "T2", "T3", "T4"],
1006
+ wide: ["1\xBA trimestre", "2\xBA trimestre", "3\xBA trimestre", "4\xBA trimestre"]
1007
+ };
1008
+ var monthValues2 = {
1009
+ narrow: ["e", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
1010
+ abbreviated: [
1011
+ "ene",
1012
+ "feb",
1013
+ "mar",
1014
+ "abr",
1015
+ "may",
1016
+ "jun",
1017
+ "jul",
1018
+ "ago",
1019
+ "sep",
1020
+ "oct",
1021
+ "nov",
1022
+ "dic"
1023
+ ],
1024
+ wide: [
1025
+ "enero",
1026
+ "febrero",
1027
+ "marzo",
1028
+ "abril",
1029
+ "mayo",
1030
+ "junio",
1031
+ "julio",
1032
+ "agosto",
1033
+ "septiembre",
1034
+ "octubre",
1035
+ "noviembre",
1036
+ "diciembre"
1037
+ ]
1038
+ };
1039
+ var dayValues2 = {
1040
+ narrow: ["d", "l", "m", "m", "j", "v", "s"],
1041
+ short: ["do", "lu", "ma", "mi", "ju", "vi", "s\xE1"],
1042
+ abbreviated: ["dom", "lun", "mar", "mi\xE9", "jue", "vie", "s\xE1b"],
1043
+ wide: [
1044
+ "domingo",
1045
+ "lunes",
1046
+ "martes",
1047
+ "mi\xE9rcoles",
1048
+ "jueves",
1049
+ "viernes",
1050
+ "s\xE1bado"
1051
+ ]
1052
+ };
1053
+ var dayPeriodValues2 = {
1054
+ narrow: {
1055
+ am: "a",
1056
+ pm: "p",
1057
+ midnight: "mn",
1058
+ noon: "md",
1059
+ morning: "ma\xF1ana",
1060
+ afternoon: "tarde",
1061
+ evening: "tarde",
1062
+ night: "noche"
1063
+ },
1064
+ abbreviated: {
1065
+ am: "AM",
1066
+ pm: "PM",
1067
+ midnight: "medianoche",
1068
+ noon: "mediodia",
1069
+ morning: "ma\xF1ana",
1070
+ afternoon: "tarde",
1071
+ evening: "tarde",
1072
+ night: "noche"
1073
+ },
1074
+ wide: {
1075
+ am: "a.m.",
1076
+ pm: "p.m.",
1077
+ midnight: "medianoche",
1078
+ noon: "mediodia",
1079
+ morning: "ma\xF1ana",
1080
+ afternoon: "tarde",
1081
+ evening: "tarde",
1082
+ night: "noche"
1083
+ }
1084
+ };
1085
+ var formattingDayPeriodValues2 = {
1086
+ narrow: {
1087
+ am: "a",
1088
+ pm: "p",
1089
+ midnight: "mn",
1090
+ noon: "md",
1091
+ morning: "de la ma\xF1ana",
1092
+ afternoon: "de la tarde",
1093
+ evening: "de la tarde",
1094
+ night: "de la noche"
1095
+ },
1096
+ abbreviated: {
1097
+ am: "AM",
1098
+ pm: "PM",
1099
+ midnight: "medianoche",
1100
+ noon: "mediodia",
1101
+ morning: "de la ma\xF1ana",
1102
+ afternoon: "de la tarde",
1103
+ evening: "de la tarde",
1104
+ night: "de la noche"
1105
+ },
1106
+ wide: {
1107
+ am: "a.m.",
1108
+ pm: "p.m.",
1109
+ midnight: "medianoche",
1110
+ noon: "mediodia",
1111
+ morning: "de la ma\xF1ana",
1112
+ afternoon: "de la tarde",
1113
+ evening: "de la tarde",
1114
+ night: "de la noche"
1115
+ }
1116
+ };
1117
+ var ordinalNumber2 = (dirtyNumber, _options) => {
1118
+ const number = Number(dirtyNumber);
1119
+ return number + "\xBA";
1120
+ };
1121
+ var localize2 = {
1122
+ ordinalNumber: ordinalNumber2,
1123
+ era: buildLocalizeFn({
1124
+ values: eraValues2,
1125
+ defaultWidth: "wide"
1126
+ }),
1127
+ quarter: buildLocalizeFn({
1128
+ values: quarterValues2,
1129
+ defaultWidth: "wide",
1130
+ argumentCallback: (quarter) => Number(quarter) - 1
1131
+ }),
1132
+ month: buildLocalizeFn({
1133
+ values: monthValues2,
1134
+ defaultWidth: "wide"
1135
+ }),
1136
+ day: buildLocalizeFn({
1137
+ values: dayValues2,
1138
+ defaultWidth: "wide"
1139
+ }),
1140
+ dayPeriod: buildLocalizeFn({
1141
+ values: dayPeriodValues2,
1142
+ defaultWidth: "wide",
1143
+ formattingValues: formattingDayPeriodValues2,
1144
+ defaultFormattingWidth: "wide"
1145
+ })
1146
+ };
1147
+
1148
+ // node_modules/date-fns/locale/es/_lib/match.mjs
1149
+ var matchOrdinalNumberPattern2 = /^(\d+)(º)?/i;
1150
+ var parseOrdinalNumberPattern2 = /\d+/i;
1151
+ var matchEraPatterns2 = {
1152
+ narrow: /^(ac|dc|a|d)/i,
1153
+ abbreviated: /^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,
1154
+ wide: /^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i
1155
+ };
1156
+ var parseEraPatterns2 = {
1157
+ any: [/^ac/i, /^dc/i],
1158
+ wide: [
1159
+ /^(antes de cristo|antes de la era com[uú]n)/i,
1160
+ /^(despu[eé]s de cristo|era com[uú]n)/i
1161
+ ]
1162
+ };
1163
+ var matchQuarterPatterns2 = {
1164
+ narrow: /^[1234]/i,
1165
+ abbreviated: /^T[1234]/i,
1166
+ wide: /^[1234](º)? trimestre/i
1167
+ };
1168
+ var parseQuarterPatterns2 = {
1169
+ any: [/1/i, /2/i, /3/i, /4/i]
1170
+ };
1171
+ var matchMonthPatterns2 = {
1172
+ narrow: /^[efmajsond]/i,
1173
+ abbreviated: /^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,
1174
+ wide: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i
1175
+ };
1176
+ var parseMonthPatterns2 = {
1177
+ narrow: [
1178
+ /^e/i,
1179
+ /^f/i,
1180
+ /^m/i,
1181
+ /^a/i,
1182
+ /^m/i,
1183
+ /^j/i,
1184
+ /^j/i,
1185
+ /^a/i,
1186
+ /^s/i,
1187
+ /^o/i,
1188
+ /^n/i,
1189
+ /^d/i
1190
+ ],
1191
+ any: [
1192
+ /^en/i,
1193
+ /^feb/i,
1194
+ /^mar/i,
1195
+ /^abr/i,
1196
+ /^may/i,
1197
+ /^jun/i,
1198
+ /^jul/i,
1199
+ /^ago/i,
1200
+ /^sep/i,
1201
+ /^oct/i,
1202
+ /^nov/i,
1203
+ /^dic/i
1204
+ ]
1205
+ };
1206
+ var matchDayPatterns2 = {
1207
+ narrow: /^[dlmjvs]/i,
1208
+ short: /^(do|lu|ma|mi|ju|vi|s[áa])/i,
1209
+ abbreviated: /^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,
1210
+ wide: /^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i
1211
+ };
1212
+ var parseDayPatterns2 = {
1213
+ narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^j/i, /^v/i, /^s/i],
1214
+ any: [/^do/i, /^lu/i, /^ma/i, /^mi/i, /^ju/i, /^vi/i, /^sa/i]
1215
+ };
1216
+ var matchDayPeriodPatterns2 = {
1217
+ narrow: /^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,
1218
+ any: /^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i
1219
+ };
1220
+ var parseDayPeriodPatterns2 = {
1221
+ any: {
1222
+ am: /^a/i,
1223
+ pm: /^p/i,
1224
+ midnight: /^mn/i,
1225
+ noon: /^md/i,
1226
+ morning: /mañana/i,
1227
+ afternoon: /tarde/i,
1228
+ evening: /tarde/i,
1229
+ night: /noche/i
1230
+ }
1231
+ };
1232
+ var match2 = {
1233
+ ordinalNumber: buildMatchPatternFn({
1234
+ matchPattern: matchOrdinalNumberPattern2,
1235
+ parsePattern: parseOrdinalNumberPattern2,
1236
+ valueCallback: function(value) {
1237
+ return parseInt(value, 10);
1238
+ }
1239
+ }),
1240
+ era: buildMatchFn({
1241
+ matchPatterns: matchEraPatterns2,
1242
+ defaultMatchWidth: "wide",
1243
+ parsePatterns: parseEraPatterns2,
1244
+ defaultParseWidth: "any"
1245
+ }),
1246
+ quarter: buildMatchFn({
1247
+ matchPatterns: matchQuarterPatterns2,
1248
+ defaultMatchWidth: "wide",
1249
+ parsePatterns: parseQuarterPatterns2,
1250
+ defaultParseWidth: "any",
1251
+ valueCallback: (index) => index + 1
1252
+ }),
1253
+ month: buildMatchFn({
1254
+ matchPatterns: matchMonthPatterns2,
1255
+ defaultMatchWidth: "wide",
1256
+ parsePatterns: parseMonthPatterns2,
1257
+ defaultParseWidth: "any"
1258
+ }),
1259
+ day: buildMatchFn({
1260
+ matchPatterns: matchDayPatterns2,
1261
+ defaultMatchWidth: "wide",
1262
+ parsePatterns: parseDayPatterns2,
1263
+ defaultParseWidth: "any"
1264
+ }),
1265
+ dayPeriod: buildMatchFn({
1266
+ matchPatterns: matchDayPeriodPatterns2,
1267
+ defaultMatchWidth: "any",
1268
+ parsePatterns: parseDayPeriodPatterns2,
1269
+ defaultParseWidth: "any"
1270
+ })
1271
+ };
1272
+
1273
+ // node_modules/date-fns/locale/es.mjs
1274
+ var es = {
1275
+ code: "es",
1276
+ formatDistance: formatDistance2,
1277
+ formatLong: formatLong2,
1278
+ formatRelative: formatRelative2,
1279
+ localize: localize2,
1280
+ match: match2,
1281
+ options: {
1282
+ weekStartsOn: 1,
1283
+ firstWeekContainsDate: 1
1284
+ }
1285
+ };
1286
+
1287
+ // node_modules/date-fns/constructFrom.mjs
1288
+ function constructFrom(date, value) {
1289
+ if (date instanceof Date) {
1290
+ return new date.constructor(value);
1291
+ } else {
1292
+ return new Date(value);
1293
+ }
1294
+ }
1295
+
1296
+ // node_modules/date-fns/addDays.mjs
1297
+ function addDays(date, amount) {
1298
+ const _date = toDate(date);
1299
+ if (isNaN(amount)) return constructFrom(date, NaN);
1300
+ if (!amount) {
1301
+ return _date;
1302
+ }
1303
+ _date.setDate(_date.getDate() + amount);
1304
+ return _date;
1305
+ }
1306
+
1307
+ // node_modules/date-fns/addMonths.mjs
1308
+ function addMonths(date, amount) {
1309
+ const _date = toDate(date);
1310
+ if (isNaN(amount)) return constructFrom(date, NaN);
1311
+ if (!amount) {
1312
+ return _date;
1313
+ }
1314
+ const dayOfMonth = _date.getDate();
1315
+ const endOfDesiredMonth = constructFrom(date, _date.getTime());
1316
+ endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
1317
+ const daysInMonth = endOfDesiredMonth.getDate();
1318
+ if (dayOfMonth >= daysInMonth) {
1319
+ return endOfDesiredMonth;
1320
+ } else {
1321
+ _date.setFullYear(
1322
+ endOfDesiredMonth.getFullYear(),
1323
+ endOfDesiredMonth.getMonth(),
1324
+ dayOfMonth
1325
+ );
1326
+ return _date;
1327
+ }
1328
+ }
1329
+
1330
+ // node_modules/date-fns/constants.mjs
1331
+ var daysInYear = 365.2425;
1332
+ var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
1333
+ var minTime = -maxTime;
1334
+ var millisecondsInWeek = 6048e5;
1335
+ var millisecondsInDay = 864e5;
1336
+ var secondsInHour = 3600;
1337
+ var secondsInDay = secondsInHour * 24;
1338
+ var secondsInWeek = secondsInDay * 7;
1339
+ var secondsInYear = secondsInDay * daysInYear;
1340
+ var secondsInMonth = secondsInYear / 12;
1341
+ var secondsInQuarter = secondsInMonth * 3;
1342
+
1343
+ // node_modules/date-fns/startOfISOWeek.mjs
1344
+ function startOfISOWeek(date) {
1345
+ return startOfWeek(date, { weekStartsOn: 1 });
1346
+ }
1347
+
1348
+ // node_modules/date-fns/getISOWeekYear.mjs
1349
+ function getISOWeekYear(date) {
1350
+ const _date = toDate(date);
1351
+ const year = _date.getFullYear();
1352
+ const fourthOfJanuaryOfNextYear = constructFrom(date, 0);
1353
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
1354
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
1355
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
1356
+ const fourthOfJanuaryOfThisYear = constructFrom(date, 0);
1357
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
1358
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
1359
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
1360
+ if (_date.getTime() >= startOfNextYear.getTime()) {
1361
+ return year + 1;
1362
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
1363
+ return year;
1364
+ } else {
1365
+ return year - 1;
1366
+ }
1367
+ }
1368
+
1369
+ // node_modules/date-fns/startOfDay.mjs
1370
+ function startOfDay(date) {
1371
+ const _date = toDate(date);
1372
+ _date.setHours(0, 0, 0, 0);
1373
+ return _date;
1374
+ }
1375
+
1376
+ // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs
1377
+ function getTimezoneOffsetInMilliseconds(date) {
1378
+ const utcDate = new Date(
1379
+ Date.UTC(
1380
+ date.getFullYear(),
1381
+ date.getMonth(),
1382
+ date.getDate(),
1383
+ date.getHours(),
1384
+ date.getMinutes(),
1385
+ date.getSeconds(),
1386
+ date.getMilliseconds()
1387
+ )
1388
+ );
1389
+ utcDate.setUTCFullYear(date.getFullYear());
1390
+ return date.getTime() - utcDate.getTime();
1391
+ }
1392
+
1393
+ // node_modules/date-fns/differenceInCalendarDays.mjs
1394
+ function differenceInCalendarDays(dateLeft, dateRight) {
1395
+ const startOfDayLeft = startOfDay(dateLeft);
1396
+ const startOfDayRight = startOfDay(dateRight);
1397
+ const timestampLeft = startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft);
1398
+ const timestampRight = startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight);
1399
+ return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
1400
+ }
1401
+
1402
+ // node_modules/date-fns/startOfISOWeekYear.mjs
1403
+ function startOfISOWeekYear(date) {
1404
+ const year = getISOWeekYear(date);
1405
+ const fourthOfJanuary = constructFrom(date, 0);
1406
+ fourthOfJanuary.setFullYear(year, 0, 4);
1407
+ fourthOfJanuary.setHours(0, 0, 0, 0);
1408
+ return startOfISOWeek(fourthOfJanuary);
1409
+ }
1410
+
1411
+ // node_modules/date-fns/isSameDay.mjs
1412
+ function isSameDay(dateLeft, dateRight) {
1413
+ const dateLeftStartOfDay = startOfDay(dateLeft);
1414
+ const dateRightStartOfDay = startOfDay(dateRight);
1415
+ return +dateLeftStartOfDay === +dateRightStartOfDay;
1416
+ }
1417
+
1418
+ // node_modules/date-fns/isDate.mjs
1419
+ function isDate(value) {
1420
+ return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
1421
+ }
1422
+
1423
+ // node_modules/date-fns/isValid.mjs
1424
+ function isValid(date) {
1425
+ if (!isDate(date) && typeof date !== "number") {
1426
+ return false;
1427
+ }
1428
+ const _date = toDate(date);
1429
+ return !isNaN(Number(_date));
1430
+ }
1431
+
1432
+ // node_modules/date-fns/endOfDay.mjs
1433
+ function endOfDay(date) {
1434
+ const _date = toDate(date);
1435
+ _date.setHours(23, 59, 59, 999);
1436
+ return _date;
1437
+ }
1438
+
1439
+ // node_modules/date-fns/endOfMonth.mjs
1440
+ function endOfMonth(date) {
1441
+ const _date = toDate(date);
1442
+ const month = _date.getMonth();
1443
+ _date.setFullYear(_date.getFullYear(), month + 1, 0);
1444
+ _date.setHours(23, 59, 59, 999);
1445
+ return _date;
1446
+ }
1447
+
1448
+ // node_modules/date-fns/startOfMonth.mjs
1449
+ function startOfMonth(date) {
1450
+ const _date = toDate(date);
1451
+ _date.setDate(1);
1452
+ _date.setHours(0, 0, 0, 0);
1453
+ return _date;
1454
+ }
1455
+
1456
+ // node_modules/date-fns/startOfYear.mjs
1457
+ function startOfYear(date) {
1458
+ const cleanDate = toDate(date);
1459
+ const _date = constructFrom(date, 0);
1460
+ _date.setFullYear(cleanDate.getFullYear(), 0, 1);
1461
+ _date.setHours(0, 0, 0, 0);
1462
+ return _date;
1463
+ }
1464
+
1465
+ // node_modules/date-fns/endOfWeek.mjs
1466
+ function endOfWeek(date, options) {
1467
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1468
+ const defaultOptions2 = getDefaultOptions();
1469
+ const weekStartsOn = (_h = (_g = (_d = (_c = options == null ? void 0 : options.weekStartsOn) != null ? _c : (_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) != null ? _d : defaultOptions2.weekStartsOn) != null ? _g : (_f = (_e = defaultOptions2.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.weekStartsOn) != null ? _h : 0;
1470
+ const _date = toDate(date);
1471
+ const day = _date.getDay();
1472
+ const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
1473
+ _date.setDate(_date.getDate() + diff);
1474
+ _date.setHours(23, 59, 59, 999);
1475
+ return _date;
1476
+ }
1477
+
1478
+ // node_modules/date-fns/getDayOfYear.mjs
1479
+ function getDayOfYear(date) {
1480
+ const _date = toDate(date);
1481
+ const diff = differenceInCalendarDays(_date, startOfYear(_date));
1482
+ const dayOfYear = diff + 1;
1483
+ return dayOfYear;
1484
+ }
1485
+
1486
+ // node_modules/date-fns/getISOWeek.mjs
1487
+ function getISOWeek(date) {
1488
+ const _date = toDate(date);
1489
+ const diff = startOfISOWeek(_date).getTime() - startOfISOWeekYear(_date).getTime();
1490
+ return Math.round(diff / millisecondsInWeek) + 1;
1491
+ }
1492
+
1493
+ // node_modules/date-fns/getWeekYear.mjs
1494
+ function getWeekYear(date, options) {
1495
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1496
+ const _date = toDate(date);
1497
+ const year = _date.getFullYear();
1498
+ const defaultOptions2 = getDefaultOptions();
1499
+ const firstWeekContainsDate = (_h = (_g = (_d = (_c = options == null ? void 0 : options.firstWeekContainsDate) != null ? _c : (_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) != null ? _d : defaultOptions2.firstWeekContainsDate) != null ? _g : (_f = (_e = defaultOptions2.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.firstWeekContainsDate) != null ? _h : 1;
1500
+ const firstWeekOfNextYear = constructFrom(date, 0);
1501
+ firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
1502
+ firstWeekOfNextYear.setHours(0, 0, 0, 0);
1503
+ const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
1504
+ const firstWeekOfThisYear = constructFrom(date, 0);
1505
+ firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
1506
+ firstWeekOfThisYear.setHours(0, 0, 0, 0);
1507
+ const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
1508
+ if (_date.getTime() >= startOfNextYear.getTime()) {
1509
+ return year + 1;
1510
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
1511
+ return year;
1512
+ } else {
1513
+ return year - 1;
1514
+ }
1515
+ }
1516
+
1517
+ // node_modules/date-fns/startOfWeekYear.mjs
1518
+ function startOfWeekYear(date, options) {
1519
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1520
+ const defaultOptions2 = getDefaultOptions();
1521
+ const firstWeekContainsDate = (_h = (_g = (_d = (_c = options == null ? void 0 : options.firstWeekContainsDate) != null ? _c : (_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) != null ? _d : defaultOptions2.firstWeekContainsDate) != null ? _g : (_f = (_e = defaultOptions2.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.firstWeekContainsDate) != null ? _h : 1;
1522
+ const year = getWeekYear(date, options);
1523
+ const firstWeek = constructFrom(date, 0);
1524
+ firstWeek.setFullYear(year, 0, firstWeekContainsDate);
1525
+ firstWeek.setHours(0, 0, 0, 0);
1526
+ const _date = startOfWeek(firstWeek, options);
1527
+ return _date;
1528
+ }
1529
+
1530
+ // node_modules/date-fns/getWeek.mjs
1531
+ function getWeek(date, options) {
1532
+ const _date = toDate(date);
1533
+ const diff = startOfWeek(_date, options).getTime() - startOfWeekYear(_date, options).getTime();
1534
+ return Math.round(diff / millisecondsInWeek) + 1;
1535
+ }
1536
+
1537
+ // node_modules/date-fns/_lib/addLeadingZeros.mjs
1538
+ function addLeadingZeros(number, targetLength) {
1539
+ const sign = number < 0 ? "-" : "";
1540
+ const output = Math.abs(number).toString().padStart(targetLength, "0");
1541
+ return sign + output;
1542
+ }
1543
+
1544
+ // node_modules/date-fns/_lib/format/lightFormatters.mjs
1545
+ var lightFormatters = {
1546
+ // Year
1547
+ y(date, token) {
1548
+ const signedYear = date.getFullYear();
1549
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
1550
+ return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
1551
+ },
1552
+ // Month
1553
+ M(date, token) {
1554
+ const month = date.getMonth();
1555
+ return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
1556
+ },
1557
+ // Day of the month
1558
+ d(date, token) {
1559
+ return addLeadingZeros(date.getDate(), token.length);
1560
+ },
1561
+ // AM or PM
1562
+ a(date, token) {
1563
+ const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
1564
+ switch (token) {
1565
+ case "a":
1566
+ case "aa":
1567
+ return dayPeriodEnumValue.toUpperCase();
1568
+ case "aaa":
1569
+ return dayPeriodEnumValue;
1570
+ case "aaaaa":
1571
+ return dayPeriodEnumValue[0];
1572
+ case "aaaa":
1573
+ default:
1574
+ return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
1575
+ }
1576
+ },
1577
+ // Hour [1-12]
1578
+ h(date, token) {
1579
+ return addLeadingZeros(date.getHours() % 12 || 12, token.length);
1580
+ },
1581
+ // Hour [0-23]
1582
+ H(date, token) {
1583
+ return addLeadingZeros(date.getHours(), token.length);
1584
+ },
1585
+ // Minute
1586
+ m(date, token) {
1587
+ return addLeadingZeros(date.getMinutes(), token.length);
1588
+ },
1589
+ // Second
1590
+ s(date, token) {
1591
+ return addLeadingZeros(date.getSeconds(), token.length);
1592
+ },
1593
+ // Fraction of second
1594
+ S(date, token) {
1595
+ const numberOfDigits = token.length;
1596
+ const milliseconds = date.getMilliseconds();
1597
+ const fractionalSeconds = Math.floor(
1598
+ milliseconds * Math.pow(10, numberOfDigits - 3)
1599
+ );
1600
+ return addLeadingZeros(fractionalSeconds, token.length);
1601
+ }
1602
+ };
1603
+
1604
+ // node_modules/date-fns/_lib/format/formatters.mjs
1605
+ var dayPeriodEnum = {
1606
+ am: "am",
1607
+ pm: "pm",
1608
+ midnight: "midnight",
1609
+ noon: "noon",
1610
+ morning: "morning",
1611
+ afternoon: "afternoon",
1612
+ evening: "evening",
1613
+ night: "night"
1614
+ };
1615
+ var formatters = {
1616
+ // Era
1617
+ G: function(date, token, localize3) {
1618
+ const era = date.getFullYear() > 0 ? 1 : 0;
1619
+ switch (token) {
1620
+ // AD, BC
1621
+ case "G":
1622
+ case "GG":
1623
+ case "GGG":
1624
+ return localize3.era(era, { width: "abbreviated" });
1625
+ // A, B
1626
+ case "GGGGG":
1627
+ return localize3.era(era, { width: "narrow" });
1628
+ // Anno Domini, Before Christ
1629
+ case "GGGG":
1630
+ default:
1631
+ return localize3.era(era, { width: "wide" });
1632
+ }
1633
+ },
1634
+ // Year
1635
+ y: function(date, token, localize3) {
1636
+ if (token === "yo") {
1637
+ const signedYear = date.getFullYear();
1638
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
1639
+ return localize3.ordinalNumber(year, { unit: "year" });
1640
+ }
1641
+ return lightFormatters.y(date, token);
1642
+ },
1643
+ // Local week-numbering year
1644
+ Y: function(date, token, localize3, options) {
1645
+ const signedWeekYear = getWeekYear(date, options);
1646
+ const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
1647
+ if (token === "YY") {
1648
+ const twoDigitYear = weekYear % 100;
1649
+ return addLeadingZeros(twoDigitYear, 2);
1650
+ }
1651
+ if (token === "Yo") {
1652
+ return localize3.ordinalNumber(weekYear, { unit: "year" });
1653
+ }
1654
+ return addLeadingZeros(weekYear, token.length);
1655
+ },
1656
+ // ISO week-numbering year
1657
+ R: function(date, token) {
1658
+ const isoWeekYear = getISOWeekYear(date);
1659
+ return addLeadingZeros(isoWeekYear, token.length);
1660
+ },
1661
+ // Extended year. This is a single number designating the year of this calendar system.
1662
+ // The main difference between `y` and `u` localizers are B.C. years:
1663
+ // | Year | `y` | `u` |
1664
+ // |------|-----|-----|
1665
+ // | AC 1 | 1 | 1 |
1666
+ // | BC 1 | 1 | 0 |
1667
+ // | BC 2 | 2 | -1 |
1668
+ // Also `yy` always returns the last two digits of a year,
1669
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1670
+ u: function(date, token) {
1671
+ const year = date.getFullYear();
1672
+ return addLeadingZeros(year, token.length);
1673
+ },
1674
+ // Quarter
1675
+ Q: function(date, token, localize3) {
1676
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
1677
+ switch (token) {
1678
+ // 1, 2, 3, 4
1679
+ case "Q":
1680
+ return String(quarter);
1681
+ // 01, 02, 03, 04
1682
+ case "QQ":
1683
+ return addLeadingZeros(quarter, 2);
1684
+ // 1st, 2nd, 3rd, 4th
1685
+ case "Qo":
1686
+ return localize3.ordinalNumber(quarter, { unit: "quarter" });
1687
+ // Q1, Q2, Q3, Q4
1688
+ case "QQQ":
1689
+ return localize3.quarter(quarter, {
1690
+ width: "abbreviated",
1691
+ context: "formatting"
1692
+ });
1693
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1694
+ case "QQQQQ":
1695
+ return localize3.quarter(quarter, {
1696
+ width: "narrow",
1697
+ context: "formatting"
1698
+ });
1699
+ // 1st quarter, 2nd quarter, ...
1700
+ case "QQQQ":
1701
+ default:
1702
+ return localize3.quarter(quarter, {
1703
+ width: "wide",
1704
+ context: "formatting"
1705
+ });
1706
+ }
1707
+ },
1708
+ // Stand-alone quarter
1709
+ q: function(date, token, localize3) {
1710
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
1711
+ switch (token) {
1712
+ // 1, 2, 3, 4
1713
+ case "q":
1714
+ return String(quarter);
1715
+ // 01, 02, 03, 04
1716
+ case "qq":
1717
+ return addLeadingZeros(quarter, 2);
1718
+ // 1st, 2nd, 3rd, 4th
1719
+ case "qo":
1720
+ return localize3.ordinalNumber(quarter, { unit: "quarter" });
1721
+ // Q1, Q2, Q3, Q4
1722
+ case "qqq":
1723
+ return localize3.quarter(quarter, {
1724
+ width: "abbreviated",
1725
+ context: "standalone"
1726
+ });
1727
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1728
+ case "qqqqq":
1729
+ return localize3.quarter(quarter, {
1730
+ width: "narrow",
1731
+ context: "standalone"
1732
+ });
1733
+ // 1st quarter, 2nd quarter, ...
1734
+ case "qqqq":
1735
+ default:
1736
+ return localize3.quarter(quarter, {
1737
+ width: "wide",
1738
+ context: "standalone"
1739
+ });
1740
+ }
1741
+ },
1742
+ // Month
1743
+ M: function(date, token, localize3) {
1744
+ const month = date.getMonth();
1745
+ switch (token) {
1746
+ case "M":
1747
+ case "MM":
1748
+ return lightFormatters.M(date, token);
1749
+ // 1st, 2nd, ..., 12th
1750
+ case "Mo":
1751
+ return localize3.ordinalNumber(month + 1, { unit: "month" });
1752
+ // Jan, Feb, ..., Dec
1753
+ case "MMM":
1754
+ return localize3.month(month, {
1755
+ width: "abbreviated",
1756
+ context: "formatting"
1757
+ });
1758
+ // J, F, ..., D
1759
+ case "MMMMM":
1760
+ return localize3.month(month, {
1761
+ width: "narrow",
1762
+ context: "formatting"
1763
+ });
1764
+ // January, February, ..., December
1765
+ case "MMMM":
1766
+ default:
1767
+ return localize3.month(month, { width: "wide", context: "formatting" });
1768
+ }
1769
+ },
1770
+ // Stand-alone month
1771
+ L: function(date, token, localize3) {
1772
+ const month = date.getMonth();
1773
+ switch (token) {
1774
+ // 1, 2, ..., 12
1775
+ case "L":
1776
+ return String(month + 1);
1777
+ // 01, 02, ..., 12
1778
+ case "LL":
1779
+ return addLeadingZeros(month + 1, 2);
1780
+ // 1st, 2nd, ..., 12th
1781
+ case "Lo":
1782
+ return localize3.ordinalNumber(month + 1, { unit: "month" });
1783
+ // Jan, Feb, ..., Dec
1784
+ case "LLL":
1785
+ return localize3.month(month, {
1786
+ width: "abbreviated",
1787
+ context: "standalone"
1788
+ });
1789
+ // J, F, ..., D
1790
+ case "LLLLL":
1791
+ return localize3.month(month, {
1792
+ width: "narrow",
1793
+ context: "standalone"
1794
+ });
1795
+ // January, February, ..., December
1796
+ case "LLLL":
1797
+ default:
1798
+ return localize3.month(month, { width: "wide", context: "standalone" });
1799
+ }
1800
+ },
1801
+ // Local week of year
1802
+ w: function(date, token, localize3, options) {
1803
+ const week = getWeek(date, options);
1804
+ if (token === "wo") {
1805
+ return localize3.ordinalNumber(week, { unit: "week" });
1806
+ }
1807
+ return addLeadingZeros(week, token.length);
1808
+ },
1809
+ // ISO week of year
1810
+ I: function(date, token, localize3) {
1811
+ const isoWeek = getISOWeek(date);
1812
+ if (token === "Io") {
1813
+ return localize3.ordinalNumber(isoWeek, { unit: "week" });
1814
+ }
1815
+ return addLeadingZeros(isoWeek, token.length);
1816
+ },
1817
+ // Day of the month
1818
+ d: function(date, token, localize3) {
1819
+ if (token === "do") {
1820
+ return localize3.ordinalNumber(date.getDate(), { unit: "date" });
1821
+ }
1822
+ return lightFormatters.d(date, token);
1823
+ },
1824
+ // Day of year
1825
+ D: function(date, token, localize3) {
1826
+ const dayOfYear = getDayOfYear(date);
1827
+ if (token === "Do") {
1828
+ return localize3.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
1829
+ }
1830
+ return addLeadingZeros(dayOfYear, token.length);
1831
+ },
1832
+ // Day of week
1833
+ E: function(date, token, localize3) {
1834
+ const dayOfWeek = date.getDay();
1835
+ switch (token) {
1836
+ // Tue
1837
+ case "E":
1838
+ case "EE":
1839
+ case "EEE":
1840
+ return localize3.day(dayOfWeek, {
1841
+ width: "abbreviated",
1842
+ context: "formatting"
1843
+ });
1844
+ // T
1845
+ case "EEEEE":
1846
+ return localize3.day(dayOfWeek, {
1847
+ width: "narrow",
1848
+ context: "formatting"
1849
+ });
1850
+ // Tu
1851
+ case "EEEEEE":
1852
+ return localize3.day(dayOfWeek, {
1853
+ width: "short",
1854
+ context: "formatting"
1855
+ });
1856
+ // Tuesday
1857
+ case "EEEE":
1858
+ default:
1859
+ return localize3.day(dayOfWeek, {
1860
+ width: "wide",
1861
+ context: "formatting"
1862
+ });
1863
+ }
1864
+ },
1865
+ // Local day of week
1866
+ e: function(date, token, localize3, options) {
1867
+ const dayOfWeek = date.getDay();
1868
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1869
+ switch (token) {
1870
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
1871
+ case "e":
1872
+ return String(localDayOfWeek);
1873
+ // Padded numerical value
1874
+ case "ee":
1875
+ return addLeadingZeros(localDayOfWeek, 2);
1876
+ // 1st, 2nd, ..., 7th
1877
+ case "eo":
1878
+ return localize3.ordinalNumber(localDayOfWeek, { unit: "day" });
1879
+ case "eee":
1880
+ return localize3.day(dayOfWeek, {
1881
+ width: "abbreviated",
1882
+ context: "formatting"
1883
+ });
1884
+ // T
1885
+ case "eeeee":
1886
+ return localize3.day(dayOfWeek, {
1887
+ width: "narrow",
1888
+ context: "formatting"
1889
+ });
1890
+ // Tu
1891
+ case "eeeeee":
1892
+ return localize3.day(dayOfWeek, {
1893
+ width: "short",
1894
+ context: "formatting"
1895
+ });
1896
+ // Tuesday
1897
+ case "eeee":
1898
+ default:
1899
+ return localize3.day(dayOfWeek, {
1900
+ width: "wide",
1901
+ context: "formatting"
1902
+ });
1903
+ }
1904
+ },
1905
+ // Stand-alone local day of week
1906
+ c: function(date, token, localize3, options) {
1907
+ const dayOfWeek = date.getDay();
1908
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1909
+ switch (token) {
1910
+ // Numerical value (same as in `e`)
1911
+ case "c":
1912
+ return String(localDayOfWeek);
1913
+ // Padded numerical value
1914
+ case "cc":
1915
+ return addLeadingZeros(localDayOfWeek, token.length);
1916
+ // 1st, 2nd, ..., 7th
1917
+ case "co":
1918
+ return localize3.ordinalNumber(localDayOfWeek, { unit: "day" });
1919
+ case "ccc":
1920
+ return localize3.day(dayOfWeek, {
1921
+ width: "abbreviated",
1922
+ context: "standalone"
1923
+ });
1924
+ // T
1925
+ case "ccccc":
1926
+ return localize3.day(dayOfWeek, {
1927
+ width: "narrow",
1928
+ context: "standalone"
1929
+ });
1930
+ // Tu
1931
+ case "cccccc":
1932
+ return localize3.day(dayOfWeek, {
1933
+ width: "short",
1934
+ context: "standalone"
1935
+ });
1936
+ // Tuesday
1937
+ case "cccc":
1938
+ default:
1939
+ return localize3.day(dayOfWeek, {
1940
+ width: "wide",
1941
+ context: "standalone"
1942
+ });
1943
+ }
1944
+ },
1945
+ // ISO day of week
1946
+ i: function(date, token, localize3) {
1947
+ const dayOfWeek = date.getDay();
1948
+ const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1949
+ switch (token) {
1950
+ // 2
1951
+ case "i":
1952
+ return String(isoDayOfWeek);
1953
+ // 02
1954
+ case "ii":
1955
+ return addLeadingZeros(isoDayOfWeek, token.length);
1956
+ // 2nd
1957
+ case "io":
1958
+ return localize3.ordinalNumber(isoDayOfWeek, { unit: "day" });
1959
+ // Tue
1960
+ case "iii":
1961
+ return localize3.day(dayOfWeek, {
1962
+ width: "abbreviated",
1963
+ context: "formatting"
1964
+ });
1965
+ // T
1966
+ case "iiiii":
1967
+ return localize3.day(dayOfWeek, {
1968
+ width: "narrow",
1969
+ context: "formatting"
1970
+ });
1971
+ // Tu
1972
+ case "iiiiii":
1973
+ return localize3.day(dayOfWeek, {
1974
+ width: "short",
1975
+ context: "formatting"
1976
+ });
1977
+ // Tuesday
1978
+ case "iiii":
1979
+ default:
1980
+ return localize3.day(dayOfWeek, {
1981
+ width: "wide",
1982
+ context: "formatting"
1983
+ });
1984
+ }
1985
+ },
1986
+ // AM or PM
1987
+ a: function(date, token, localize3) {
1988
+ const hours = date.getHours();
1989
+ const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
1990
+ switch (token) {
1991
+ case "a":
1992
+ case "aa":
1993
+ return localize3.dayPeriod(dayPeriodEnumValue, {
1994
+ width: "abbreviated",
1995
+ context: "formatting"
1996
+ });
1997
+ case "aaa":
1998
+ return localize3.dayPeriod(dayPeriodEnumValue, {
1999
+ width: "abbreviated",
2000
+ context: "formatting"
2001
+ }).toLowerCase();
2002
+ case "aaaaa":
2003
+ return localize3.dayPeriod(dayPeriodEnumValue, {
2004
+ width: "narrow",
2005
+ context: "formatting"
2006
+ });
2007
+ case "aaaa":
2008
+ default:
2009
+ return localize3.dayPeriod(dayPeriodEnumValue, {
2010
+ width: "wide",
2011
+ context: "formatting"
2012
+ });
2013
+ }
2014
+ },
2015
+ // AM, PM, midnight, noon
2016
+ b: function(date, token, localize3) {
2017
+ const hours = date.getHours();
2018
+ let dayPeriodEnumValue;
2019
+ if (hours === 12) {
2020
+ dayPeriodEnumValue = dayPeriodEnum.noon;
2021
+ } else if (hours === 0) {
2022
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
2023
+ } else {
2024
+ dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
2025
+ }
2026
+ switch (token) {
2027
+ case "b":
2028
+ case "bb":
2029
+ return localize3.dayPeriod(dayPeriodEnumValue, {
2030
+ width: "abbreviated",
2031
+ context: "formatting"
2032
+ });
2033
+ case "bbb":
2034
+ return localize3.dayPeriod(dayPeriodEnumValue, {
2035
+ width: "abbreviated",
2036
+ context: "formatting"
2037
+ }).toLowerCase();
2038
+ case "bbbbb":
2039
+ return localize3.dayPeriod(dayPeriodEnumValue, {
2040
+ width: "narrow",
2041
+ context: "formatting"
2042
+ });
2043
+ case "bbbb":
2044
+ default:
2045
+ return localize3.dayPeriod(dayPeriodEnumValue, {
2046
+ width: "wide",
2047
+ context: "formatting"
2048
+ });
2049
+ }
2050
+ },
2051
+ // in the morning, in the afternoon, in the evening, at night
2052
+ B: function(date, token, localize3) {
2053
+ const hours = date.getHours();
2054
+ let dayPeriodEnumValue;
2055
+ if (hours >= 17) {
2056
+ dayPeriodEnumValue = dayPeriodEnum.evening;
2057
+ } else if (hours >= 12) {
2058
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
2059
+ } else if (hours >= 4) {
2060
+ dayPeriodEnumValue = dayPeriodEnum.morning;
2061
+ } else {
2062
+ dayPeriodEnumValue = dayPeriodEnum.night;
2063
+ }
2064
+ switch (token) {
2065
+ case "B":
2066
+ case "BB":
2067
+ case "BBB":
2068
+ return localize3.dayPeriod(dayPeriodEnumValue, {
2069
+ width: "abbreviated",
2070
+ context: "formatting"
2071
+ });
2072
+ case "BBBBB":
2073
+ return localize3.dayPeriod(dayPeriodEnumValue, {
2074
+ width: "narrow",
2075
+ context: "formatting"
2076
+ });
2077
+ case "BBBB":
2078
+ default:
2079
+ return localize3.dayPeriod(dayPeriodEnumValue, {
2080
+ width: "wide",
2081
+ context: "formatting"
2082
+ });
2083
+ }
2084
+ },
2085
+ // Hour [1-12]
2086
+ h: function(date, token, localize3) {
2087
+ if (token === "ho") {
2088
+ let hours = date.getHours() % 12;
2089
+ if (hours === 0) hours = 12;
2090
+ return localize3.ordinalNumber(hours, { unit: "hour" });
2091
+ }
2092
+ return lightFormatters.h(date, token);
2093
+ },
2094
+ // Hour [0-23]
2095
+ H: function(date, token, localize3) {
2096
+ if (token === "Ho") {
2097
+ return localize3.ordinalNumber(date.getHours(), { unit: "hour" });
2098
+ }
2099
+ return lightFormatters.H(date, token);
2100
+ },
2101
+ // Hour [0-11]
2102
+ K: function(date, token, localize3) {
2103
+ const hours = date.getHours() % 12;
2104
+ if (token === "Ko") {
2105
+ return localize3.ordinalNumber(hours, { unit: "hour" });
2106
+ }
2107
+ return addLeadingZeros(hours, token.length);
2108
+ },
2109
+ // Hour [1-24]
2110
+ k: function(date, token, localize3) {
2111
+ let hours = date.getHours();
2112
+ if (hours === 0) hours = 24;
2113
+ if (token === "ko") {
2114
+ return localize3.ordinalNumber(hours, { unit: "hour" });
2115
+ }
2116
+ return addLeadingZeros(hours, token.length);
2117
+ },
2118
+ // Minute
2119
+ m: function(date, token, localize3) {
2120
+ if (token === "mo") {
2121
+ return localize3.ordinalNumber(date.getMinutes(), { unit: "minute" });
2122
+ }
2123
+ return lightFormatters.m(date, token);
2124
+ },
2125
+ // Second
2126
+ s: function(date, token, localize3) {
2127
+ if (token === "so") {
2128
+ return localize3.ordinalNumber(date.getSeconds(), { unit: "second" });
2129
+ }
2130
+ return lightFormatters.s(date, token);
2131
+ },
2132
+ // Fraction of second
2133
+ S: function(date, token) {
2134
+ return lightFormatters.S(date, token);
2135
+ },
2136
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
2137
+ X: function(date, token, _localize, options) {
2138
+ const originalDate = options._originalDate || date;
2139
+ const timezoneOffset = originalDate.getTimezoneOffset();
2140
+ if (timezoneOffset === 0) {
2141
+ return "Z";
2142
+ }
2143
+ switch (token) {
2144
+ // Hours and optional minutes
2145
+ case "X":
2146
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
2147
+ // Hours, minutes and optional seconds without `:` delimiter
2148
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2149
+ // so this token always has the same output as `XX`
2150
+ case "XXXX":
2151
+ case "XX":
2152
+ return formatTimezone(timezoneOffset);
2153
+ // Hours, minutes and optional seconds with `:` delimiter
2154
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2155
+ // so this token always has the same output as `XXX`
2156
+ case "XXXXX":
2157
+ case "XXX":
2158
+ // Hours and minutes with `:` delimiter
2159
+ default:
2160
+ return formatTimezone(timezoneOffset, ":");
2161
+ }
2162
+ },
2163
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
2164
+ x: function(date, token, _localize, options) {
2165
+ const originalDate = options._originalDate || date;
2166
+ const timezoneOffset = originalDate.getTimezoneOffset();
2167
+ switch (token) {
2168
+ // Hours and optional minutes
2169
+ case "x":
2170
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
2171
+ // Hours, minutes and optional seconds without `:` delimiter
2172
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2173
+ // so this token always has the same output as `xx`
2174
+ case "xxxx":
2175
+ case "xx":
2176
+ return formatTimezone(timezoneOffset);
2177
+ // Hours, minutes and optional seconds with `:` delimiter
2178
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2179
+ // so this token always has the same output as `xxx`
2180
+ case "xxxxx":
2181
+ case "xxx":
2182
+ // Hours and minutes with `:` delimiter
2183
+ default:
2184
+ return formatTimezone(timezoneOffset, ":");
2185
+ }
2186
+ },
2187
+ // Timezone (GMT)
2188
+ O: function(date, token, _localize, options) {
2189
+ const originalDate = options._originalDate || date;
2190
+ const timezoneOffset = originalDate.getTimezoneOffset();
2191
+ switch (token) {
2192
+ // Short
2193
+ case "O":
2194
+ case "OO":
2195
+ case "OOO":
2196
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2197
+ // Long
2198
+ case "OOOO":
2199
+ default:
2200
+ return "GMT" + formatTimezone(timezoneOffset, ":");
2201
+ }
2202
+ },
2203
+ // Timezone (specific non-location)
2204
+ z: function(date, token, _localize, options) {
2205
+ const originalDate = options._originalDate || date;
2206
+ const timezoneOffset = originalDate.getTimezoneOffset();
2207
+ switch (token) {
2208
+ // Short
2209
+ case "z":
2210
+ case "zz":
2211
+ case "zzz":
2212
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2213
+ // Long
2214
+ case "zzzz":
2215
+ default:
2216
+ return "GMT" + formatTimezone(timezoneOffset, ":");
2217
+ }
2218
+ },
2219
+ // Seconds timestamp
2220
+ t: function(date, token, _localize, options) {
2221
+ const originalDate = options._originalDate || date;
2222
+ const timestamp = Math.floor(originalDate.getTime() / 1e3);
2223
+ return addLeadingZeros(timestamp, token.length);
2224
+ },
2225
+ // Milliseconds timestamp
2226
+ T: function(date, token, _localize, options) {
2227
+ const originalDate = options._originalDate || date;
2228
+ const timestamp = originalDate.getTime();
2229
+ return addLeadingZeros(timestamp, token.length);
2230
+ }
2231
+ };
2232
+ function formatTimezoneShort(offset, delimiter = "") {
2233
+ const sign = offset > 0 ? "-" : "+";
2234
+ const absOffset = Math.abs(offset);
2235
+ const hours = Math.floor(absOffset / 60);
2236
+ const minutes = absOffset % 60;
2237
+ if (minutes === 0) {
2238
+ return sign + String(hours);
2239
+ }
2240
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
2241
+ }
2242
+ function formatTimezoneWithOptionalMinutes(offset, delimiter) {
2243
+ if (offset % 60 === 0) {
2244
+ const sign = offset > 0 ? "-" : "+";
2245
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
2246
+ }
2247
+ return formatTimezone(offset, delimiter);
2248
+ }
2249
+ function formatTimezone(offset, delimiter = "") {
2250
+ const sign = offset > 0 ? "-" : "+";
2251
+ const absOffset = Math.abs(offset);
2252
+ const hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
2253
+ const minutes = addLeadingZeros(absOffset % 60, 2);
2254
+ return sign + hours + delimiter + minutes;
2255
+ }
2256
+
2257
+ // node_modules/date-fns/_lib/format/longFormatters.mjs
2258
+ var dateLongFormatter = (pattern, formatLong3) => {
2259
+ switch (pattern) {
2260
+ case "P":
2261
+ return formatLong3.date({ width: "short" });
2262
+ case "PP":
2263
+ return formatLong3.date({ width: "medium" });
2264
+ case "PPP":
2265
+ return formatLong3.date({ width: "long" });
2266
+ case "PPPP":
2267
+ default:
2268
+ return formatLong3.date({ width: "full" });
2269
+ }
2270
+ };
2271
+ var timeLongFormatter = (pattern, formatLong3) => {
2272
+ switch (pattern) {
2273
+ case "p":
2274
+ return formatLong3.time({ width: "short" });
2275
+ case "pp":
2276
+ return formatLong3.time({ width: "medium" });
2277
+ case "ppp":
2278
+ return formatLong3.time({ width: "long" });
2279
+ case "pppp":
2280
+ default:
2281
+ return formatLong3.time({ width: "full" });
2282
+ }
2283
+ };
2284
+ var dateTimeLongFormatter = (pattern, formatLong3) => {
2285
+ const matchResult = pattern.match(/(P+)(p+)?/) || [];
2286
+ const datePattern = matchResult[1];
2287
+ const timePattern = matchResult[2];
2288
+ if (!timePattern) {
2289
+ return dateLongFormatter(pattern, formatLong3);
2290
+ }
2291
+ let dateTimeFormat;
2292
+ switch (datePattern) {
2293
+ case "P":
2294
+ dateTimeFormat = formatLong3.dateTime({ width: "short" });
2295
+ break;
2296
+ case "PP":
2297
+ dateTimeFormat = formatLong3.dateTime({ width: "medium" });
2298
+ break;
2299
+ case "PPP":
2300
+ dateTimeFormat = formatLong3.dateTime({ width: "long" });
2301
+ break;
2302
+ case "PPPP":
2303
+ default:
2304
+ dateTimeFormat = formatLong3.dateTime({ width: "full" });
2305
+ break;
2306
+ }
2307
+ return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong3)).replace("{{time}}", timeLongFormatter(timePattern, formatLong3));
2308
+ };
2309
+ var longFormatters = {
2310
+ p: timeLongFormatter,
2311
+ P: dateTimeLongFormatter
2312
+ };
2313
+
2314
+ // node_modules/date-fns/_lib/protectedTokens.mjs
2315
+ var protectedDayOfYearTokens = ["D", "DD"];
2316
+ var protectedWeekYearTokens = ["YY", "YYYY"];
2317
+ function isProtectedDayOfYearToken(token) {
2318
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
2319
+ }
2320
+ function isProtectedWeekYearToken(token) {
2321
+ return protectedWeekYearTokens.indexOf(token) !== -1;
2322
+ }
2323
+ function throwProtectedError(token, format2, input) {
2324
+ if (token === "YYYY") {
2325
+ throw new RangeError(
2326
+ `Use \`yyyy\` instead of \`YYYY\` (in \`${format2}\`) for formatting years to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`
2327
+ );
2328
+ } else if (token === "YY") {
2329
+ throw new RangeError(
2330
+ `Use \`yy\` instead of \`YY\` (in \`${format2}\`) for formatting years to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`
2331
+ );
2332
+ } else if (token === "D") {
2333
+ throw new RangeError(
2334
+ `Use \`d\` instead of \`D\` (in \`${format2}\`) for formatting days of the month to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`
2335
+ );
2336
+ } else if (token === "DD") {
2337
+ throw new RangeError(
2338
+ `Use \`dd\` instead of \`DD\` (in \`${format2}\`) for formatting days of the month to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`
2339
+ );
2340
+ }
2341
+ }
2342
+
2343
+ // node_modules/date-fns/format.mjs
2344
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2345
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2346
+ var escapedStringRegExp = /^'([^]*?)'?$/;
2347
+ var doubleQuoteRegExp = /''/g;
2348
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2349
+ function format(date, formatStr, options) {
2350
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
2351
+ const defaultOptions2 = getDefaultOptions();
2352
+ const locale = (_b = (_a = options == null ? void 0 : options.locale) != null ? _a : defaultOptions2.locale) != null ? _b : enUS;
2353
+ const firstWeekContainsDate = (_j = (_i = (_f = (_e = options == null ? void 0 : options.firstWeekContainsDate) != null ? _e : (_d = (_c = options == null ? void 0 : options.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) != null ? _f : defaultOptions2.firstWeekContainsDate) != null ? _i : (_h = (_g = defaultOptions2.locale) == null ? void 0 : _g.options) == null ? void 0 : _h.firstWeekContainsDate) != null ? _j : 1;
2354
+ const weekStartsOn = (_r = (_q = (_n = (_m = options == null ? void 0 : options.weekStartsOn) != null ? _m : (_l = (_k = options == null ? void 0 : options.locale) == null ? void 0 : _k.options) == null ? void 0 : _l.weekStartsOn) != null ? _n : defaultOptions2.weekStartsOn) != null ? _q : (_p = (_o = defaultOptions2.locale) == null ? void 0 : _o.options) == null ? void 0 : _p.weekStartsOn) != null ? _r : 0;
2355
+ const originalDate = toDate(date);
2356
+ if (!isValid(originalDate)) {
2357
+ throw new RangeError("Invalid time value");
2358
+ }
2359
+ const formatterOptions = {
2360
+ firstWeekContainsDate,
2361
+ weekStartsOn,
2362
+ locale,
2363
+ _originalDate: originalDate
2364
+ };
2365
+ const result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
2366
+ const firstCharacter = substring[0];
2367
+ if (firstCharacter === "p" || firstCharacter === "P") {
2368
+ const longFormatter = longFormatters[firstCharacter];
2369
+ return longFormatter(substring, locale.formatLong);
2370
+ }
2371
+ return substring;
2372
+ }).join("").match(formattingTokensRegExp).map(function(substring) {
2373
+ if (substring === "''") {
2374
+ return "'";
2375
+ }
2376
+ const firstCharacter = substring[0];
2377
+ if (firstCharacter === "'") {
2378
+ return cleanEscapedString(substring);
2379
+ }
2380
+ const formatter = formatters[firstCharacter];
2381
+ if (formatter) {
2382
+ if (!(options == null ? void 0 : options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2383
+ throwProtectedError(substring, formatStr, String(date));
2384
+ }
2385
+ if (!(options == null ? void 0 : options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2386
+ throwProtectedError(substring, formatStr, String(date));
2387
+ }
2388
+ return formatter(
2389
+ originalDate,
2390
+ substring,
2391
+ locale.localize,
2392
+ formatterOptions
2393
+ );
2394
+ }
2395
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2396
+ throw new RangeError(
2397
+ "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
2398
+ );
2399
+ }
2400
+ return substring;
2401
+ }).join("");
2402
+ return result;
2403
+ }
2404
+ function cleanEscapedString(input) {
2405
+ const matched = input.match(escapedStringRegExp);
2406
+ if (!matched) {
2407
+ return input;
2408
+ }
2409
+ return matched[1].replace(doubleQuoteRegExp, "'");
2410
+ }
2411
+
2412
+ // src/components/forms/date-pickers/ControlledDateRangePicker.tsx
2413
+ import "react-date-range/dist/styles.css";
2414
+ import "react-date-range/dist/theme/default.css";
2415
+ import { Button as Button3, Popover as Popover2, Stack, TextField as TextField2, useTheme } from "@mui/material";
2416
+ import { Event } from "@mui/icons-material";
2417
+
2418
+ // src/components/forms/date-pickers/utils/staticRanges.ts
2419
+ var defineds = {
2420
+ startOfWeek: startOfWeek(/* @__PURE__ */ new Date()),
2421
+ endOfWeek: endOfWeek(/* @__PURE__ */ new Date()),
2422
+ startOfLastWeek: startOfWeek(addDays(/* @__PURE__ */ new Date(), -7)),
2423
+ endOfLastWeek: endOfWeek(addDays(/* @__PURE__ */ new Date(), -7)),
2424
+ startOfToday: startOfDay(/* @__PURE__ */ new Date()),
2425
+ endOfToday: endOfDay(/* @__PURE__ */ new Date()),
2426
+ startOfYesterday: startOfDay(addDays(/* @__PURE__ */ new Date(), -1)),
2427
+ endOfYesterday: endOfDay(addDays(/* @__PURE__ */ new Date(), -1)),
2428
+ startOfMonth: startOfMonth(/* @__PURE__ */ new Date()),
2429
+ endOfMonth: endOfMonth(/* @__PURE__ */ new Date()),
2430
+ startOfLastMonth: startOfMonth(addMonths(/* @__PURE__ */ new Date(), -1)),
2431
+ endOfLastMonth: endOfMonth(addMonths(/* @__PURE__ */ new Date(), -1))
2432
+ };
2433
+ var staticRangeHandler = {
2434
+ range: function() {
2435
+ return {
2436
+ startDate: /* @__PURE__ */ new Date(),
2437
+ endDate: /* @__PURE__ */ new Date(),
2438
+ color: void 0
2439
+ // color is optional
2440
+ };
2441
+ },
2442
+ isSelected: function(range) {
2443
+ const definedRange = this.range();
2444
+ return isSameDay(range.startDate || 0, definedRange.startDate) && isSameDay(range.endDate || 0, definedRange.endDate);
2445
+ }
2446
+ };
2447
+ function createStaticRanges(ranges) {
2448
+ return ranges.map((range) => __spreadValues(__spreadValues({}, staticRangeHandler), range));
2449
+ }
2450
+ var defaultStaticRanges = createStaticRanges(
2451
+ [
2452
+ {
2453
+ label: "Hoy",
2454
+ range: () => ({
2455
+ startDate: defineds.startOfToday,
2456
+ endDate: defineds.endOfToday,
2457
+ color: void 0
2458
+ })
2459
+ },
2460
+ {
2461
+ label: "Ayer",
2462
+ range: () => ({
2463
+ startDate: defineds.startOfYesterday,
2464
+ endDate: defineds.endOfYesterday,
2465
+ color: void 0
2466
+ })
2467
+ },
2468
+ {
2469
+ label: "Esta semana",
2470
+ range: () => ({
2471
+ startDate: defineds.startOfWeek,
2472
+ endDate: defineds.endOfWeek,
2473
+ color: void 0
2474
+ })
2475
+ },
2476
+ {
2477
+ label: "Semana pasada",
2478
+ range: () => ({
2479
+ startDate: defineds.startOfLastWeek,
2480
+ endDate: defineds.endOfLastWeek,
2481
+ color: void 0
2482
+ })
2483
+ },
2484
+ {
2485
+ label: "Este Mes",
2486
+ range: () => ({
2487
+ startDate: defineds.startOfMonth,
2488
+ endDate: defineds.endOfMonth,
2489
+ color: void 0
2490
+ })
2491
+ },
2492
+ {
2493
+ label: "Mes Pasado",
2494
+ range: () => ({
2495
+ startDate: defineds.startOfLastMonth,
2496
+ endDate: defineds.endOfLastMonth,
2497
+ color: void 0
2498
+ })
2499
+ }
2500
+ ]
2501
+ );
2502
+ var defaultInputRanges = [
2503
+ {
2504
+ label: "d\xEDas hasta hoy",
2505
+ range(value) {
2506
+ return {
2507
+ startDate: addDays(defineds.startOfToday, (Math.max(Number(value), 1) - 1) * -1),
2508
+ endDate: defineds.endOfToday
2509
+ };
2510
+ },
2511
+ getCurrentValue(range) {
2512
+ if (!isSameDay(range.endDate || 0, defineds.endOfToday)) return "-";
2513
+ if (!range.startDate) return "\u221E";
2514
+ return differenceInCalendarDays(defineds.endOfToday, range.startDate) + 1;
2515
+ }
2516
+ },
2517
+ {
2518
+ label: "d\xEDas desde hoy",
2519
+ range(value) {
2520
+ const today = /* @__PURE__ */ new Date();
2521
+ return {
2522
+ startDate: today,
2523
+ endDate: addDays(today, Math.max(Number(value), 1) - 1)
2524
+ };
2525
+ },
2526
+ getCurrentValue(range) {
2527
+ if (!isSameDay(range.startDate || 0, defineds.startOfToday)) return "-";
2528
+ if (!range.endDate) return "\u221E";
2529
+ return differenceInCalendarDays(range.endDate, defineds.startOfToday) + 1;
2530
+ }
2531
+ }
2532
+ ];
2533
+
2534
+ // src/components/forms/date-pickers/ControlledDateRangePicker.tsx
2535
+ import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
2536
+ var ControlledDateRangePicker = ({
2537
+ control,
2538
+ startDateName,
2539
+ endDateName,
2540
+ label,
2541
+ dateFormatter
2542
+ }) => {
2543
+ const theme = useTheme();
2544
+ const [anchorEl, setAnchorEl] = useState4(null);
2545
+ const handleClick = (event) => {
2546
+ setAnchorEl(event.currentTarget);
2547
+ };
2548
+ const handleClose = () => {
2549
+ setAnchorEl(null);
2550
+ };
2551
+ const open = !!anchorEl;
2552
+ const toShortDate = (date) => {
2553
+ if (!date) return "";
2554
+ return dateFormatter ? dateFormatter(date) : format(new Date(date), "dd/MM/yyyy");
2555
+ };
2556
+ return /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsx4(
2557
+ Controller2,
2558
+ {
2559
+ control,
2560
+ name: startDateName,
2561
+ render: ({ field: { onChange: onStartDateChange, value: valueStart } }) => /* @__PURE__ */ jsx4(
2562
+ Controller2,
2563
+ {
2564
+ control,
2565
+ name: endDateName,
2566
+ render: ({ field: { onChange: onEndDateChange, value: valueEnd } }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
2567
+ /* @__PURE__ */ jsx4(
2568
+ TextField2,
2569
+ {
2570
+ label: label || "Fecha Desde - Hasta",
2571
+ value: `${toShortDate(valueStart)} - ${toShortDate(valueEnd)}`,
2572
+ onClick: (e) => handleClick(e),
2573
+ InputProps: {
2574
+ readOnly: true,
2575
+ endAdornment: /* @__PURE__ */ jsx4(Event, {})
2576
+ },
2577
+ size: "small"
2578
+ }
2579
+ ),
2580
+ /* @__PURE__ */ jsx4(
2581
+ Popover2,
2582
+ {
2583
+ id: "date-picker-popover",
2584
+ open,
2585
+ anchorEl,
2586
+ onClose: handleClose,
2587
+ anchorOrigin: {
2588
+ vertical: "bottom",
2589
+ horizontal: "left"
2590
+ },
2591
+ children: /* @__PURE__ */ jsxs2(
2592
+ Stack,
2593
+ {
2594
+ direction: "column",
2595
+ alignItems: "flex-end",
2596
+ children: [
2597
+ /* @__PURE__ */ jsx4(
2598
+ DateRangePicker,
2599
+ {
2600
+ onChange: (item) => {
2601
+ const { startDate, endDate } = item.selection;
2602
+ onStartDateChange(startDate);
2603
+ onEndDateChange(endDate);
2604
+ },
2605
+ moveRangeOnFirstSelection: false,
2606
+ retainEndDateOnFirstSelection: false,
2607
+ months: 2,
2608
+ ranges: [
2609
+ {
2610
+ startDate: valueStart || /* @__PURE__ */ new Date(),
2611
+ endDate: valueEnd || /* @__PURE__ */ new Date(),
2612
+ key: "selection",
2613
+ color: theme.palette.primary.main
2614
+ }
2615
+ ],
2616
+ direction: "horizontal",
2617
+ preventSnapRefocus: true,
2618
+ calendarFocus: "backwards",
2619
+ locale: es,
2620
+ staticRanges: defaultStaticRanges,
2621
+ color: theme.palette.primary.main,
2622
+ showPreview: true,
2623
+ inputRanges: defaultInputRanges
2624
+ }
2625
+ ),
2626
+ /* @__PURE__ */ jsxs2(Stack, { direction: "row", children: [
2627
+ /* @__PURE__ */ jsx4(Button3, { onClick: () => {
2628
+ onEndDateChange(void 0);
2629
+ onStartDateChange(void 0);
2630
+ }, children: "Limpiar" }),
2631
+ /* @__PURE__ */ jsx4(
2632
+ Button3,
2633
+ {
2634
+ onClick: handleClose,
2635
+ sx: { width: 1 / 4 },
2636
+ children: "Cerrar"
2637
+ }
2638
+ )
2639
+ ] })
2640
+ ]
2641
+ }
2642
+ )
2643
+ }
2644
+ )
2645
+ ] })
2646
+ }
2647
+ )
2648
+ }
2649
+ ) });
2650
+ };
2651
+
2652
+ // src/components/forms/select/select.tsx
2653
+ import {
2654
+ Autocomplete,
2655
+ CircularProgress as CircularProgress3,
2656
+ InputAdornment,
2657
+ ListItemIcon as ListItemIcon2,
2658
+ ListItemText as ListItemText2,
2659
+ MenuItem as MenuItem2,
2660
+ TextField as TextField3
2661
+ } from "@mui/material";
2662
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
2663
+ import { createElement } from "react";
2664
+ function ControlledSelect(props) {
2665
+ const _a = props, {
2666
+ control,
2667
+ name,
2668
+ getOptions,
2669
+ label,
2670
+ disabled,
2671
+ required,
2672
+ variant,
2673
+ size,
2674
+ searchable
2675
+ } = _a, rest = __objRest(_a, [
2676
+ "control",
2677
+ "name",
2678
+ "getOptions",
2679
+ "label",
2680
+ "disabled",
2681
+ "required",
2682
+ "variant",
2683
+ "size",
2684
+ "searchable"
2685
+ ]);
2686
+ const { field, fieldState, formState } = useField({
2687
+ name,
2688
+ control
2689
+ });
2690
+ const { options, isSuccess, isLoading } = useOptions({
2691
+ getOptions
2692
+ });
2693
+ return /* @__PURE__ */ jsx5(
2694
+ Autocomplete,
2695
+ __spreadValues({
2696
+ options: options ? options : [],
2697
+ loading: isLoading,
2698
+ value: field.value || "",
2699
+ onChange: (event, newValue) => {
2700
+ field.onChange(newValue || void 0);
2701
+ },
2702
+ getOptionKey: (option) => option.value,
2703
+ renderOption: (props2, option) => {
2704
+ return /* @__PURE__ */ createElement(MenuItem2, __spreadProps(__spreadValues({}, props2), { key: option.value }), option.icon && /* @__PURE__ */ jsx5(ListItemIcon2, { children: option.icon }), /* @__PURE__ */ jsx5(ListItemText2, { children: option.label }));
2705
+ },
2706
+ isOptionEqualToValue: (option, value) => option.value === value.value,
2707
+ filterOptions: searchable ? (options2, state) => options2.filter(
2708
+ (option) => option.label.toLowerCase().includes(state.inputValue.toLowerCase())
2709
+ // TODO: se puede mejorar el filtro para que sea de tipo "localeContains"
2710
+ ) : void 0,
2711
+ renderInput: (params) => {
2712
+ var _a2, _b, _c;
2713
+ return /* @__PURE__ */ jsx5(
2714
+ TextField3,
2715
+ __spreadProps(__spreadValues({}, params), {
2716
+ label: props.label,
2717
+ error: !!fieldState.error,
2718
+ helperText: (_a2 = fieldState.error) == null ? void 0 : _a2.message,
2719
+ required: props.required,
2720
+ variant,
2721
+ size,
2722
+ inputProps: __spreadProps(__spreadValues({}, params.inputProps), {
2723
+ readOnly: !searchable,
2724
+ style: {
2725
+ cursor: !searchable ? "pointer" : void 0
2726
+ }
2727
+ }),
2728
+ InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
2729
+ endAdornment: /* @__PURE__ */ jsxs3(Fragment2, { children: [
2730
+ isLoading ? /* @__PURE__ */ jsx5(CircularProgress3, { color: "inherit", size: 20 }) : null,
2731
+ params.InputProps.endAdornment
2732
+ ] }),
2733
+ startAdornment: ((_b = field.value) == null ? void 0 : _b.icon) ? /* @__PURE__ */ jsx5(InputAdornment, { position: "start", children: (_c = field.value) == null ? void 0 : _c.icon }) : void 0,
2734
+ // value: field.value?.label,
2735
+ sx: {
2736
+ cursor: !searchable ? "pointer" : void 0
2737
+ }
2738
+ })
2739
+ })
2740
+ );
2741
+ }
2742
+ }, rest)
2743
+ );
2744
+ }
2745
+
2746
+ // src/components/forms/multiselect/multiselect.tsx
2747
+ import {
2748
+ Autocomplete as Autocomplete2,
2749
+ Chip,
2750
+ CircularProgress as CircularProgress4,
2751
+ ListItemIcon as ListItemIcon3,
2752
+ ListItemText as ListItemText3,
2753
+ MenuItem as MenuItem3,
2754
+ TextField as TextField4
2755
+ } from "@mui/material";
2756
+ import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
2757
+ function ControlledMultiselect(props) {
2758
+ const _a = props, {
2759
+ control,
2760
+ name,
2761
+ getOptions,
2762
+ label,
2763
+ disabled,
2764
+ required,
2765
+ variant,
2766
+ size,
2767
+ TagComponent,
2768
+ searchable
2769
+ } = _a, rest = __objRest(_a, [
2770
+ "control",
2771
+ "name",
2772
+ "getOptions",
2773
+ "label",
2774
+ "disabled",
2775
+ "required",
2776
+ "variant",
2777
+ "size",
2778
+ "TagComponent",
2779
+ "searchable"
2780
+ ]);
2781
+ const { field, fieldState, formState } = useField({
2782
+ name,
2783
+ control
2784
+ });
2785
+ const { options, isSuccess, isLoading } = useOptions({
2786
+ getOptions
2787
+ });
2788
+ return /* @__PURE__ */ jsx6(
2789
+ Autocomplete2,
2790
+ __spreadValues({
2791
+ multiple: true,
2792
+ options: options ? options : [],
2793
+ loading: isLoading,
2794
+ value: field.value || [],
2795
+ onChange: (event, newValue) => {
2796
+ field.onChange(newValue || void 0);
2797
+ },
2798
+ getOptionKey: (option) => option.value,
2799
+ renderOption: (props2, option, state, ownerState) => {
2800
+ return /* @__PURE__ */ jsxs4(MenuItem3, __spreadProps(__spreadValues({}, props2), { children: [
2801
+ option.icon && /* @__PURE__ */ jsx6(ListItemIcon3, { children: option.icon }),
2802
+ /* @__PURE__ */ jsx6(ListItemText3, { children: option.label })
2803
+ ] }));
2804
+ },
2805
+ isOptionEqualToValue: (option, value) => option.value === value.value,
2806
+ filterOptions: searchable ? (options2, state) => options2.filter(
2807
+ (option) => option.label.toLowerCase().includes(state.inputValue.toLowerCase())
2808
+ // TODO: se puede mejorar el filtro para que sea de tipo "localeContains"
2809
+ ) : void 0,
2810
+ renderInput: (params) => {
2811
+ var _a2;
2812
+ return /* @__PURE__ */ jsx6(
2813
+ TextField4,
2814
+ __spreadProps(__spreadValues({}, params), {
2815
+ label: props.label,
2816
+ error: !!fieldState.error,
2817
+ helperText: (_a2 = fieldState.error) == null ? void 0 : _a2.message,
2818
+ required: props.required,
2819
+ variant,
2820
+ size,
2821
+ inputProps: __spreadProps(__spreadValues({}, params.inputProps), {
2822
+ readOnly: !searchable,
2823
+ style: {
2824
+ cursor: !searchable ? "pointer" : void 0
2825
+ }
2826
+ }),
2827
+ InputProps: __spreadProps(__spreadValues({}, params.InputProps), {
2828
+ endAdornment: /* @__PURE__ */ jsxs4(Fragment3, { children: [
2829
+ isLoading ? /* @__PURE__ */ jsx6(CircularProgress4, { color: "inherit", size: 20 }) : null,
2830
+ params.InputProps.endAdornment
2831
+ ] }),
2832
+ // value: field.value?.label,
2833
+ sx: {
2834
+ cursor: !searchable ? "pointer" : void 0
2835
+ }
2836
+ })
2837
+ })
2838
+ );
2839
+ },
2840
+ renderTags: (value, getTagProps) => {
2841
+ return value.map((option, index) => {
2842
+ if (TagComponent) {
2843
+ return /* @__PURE__ */ jsx6(TagComponent, __spreadValues({ value: option }, getTagProps({ index })));
2844
+ }
2845
+ return /* @__PURE__ */ jsx6(
2846
+ Chip,
2847
+ __spreadValues({
2848
+ variant: "outlined",
2849
+ label: option.label
2850
+ }, getTagProps({ index }))
2851
+ );
2852
+ });
2853
+ }
2854
+ }, rest)
2855
+ );
2856
+ }
2857
+
2858
+ // src/components/forms/toggle-button-group/toggle-button-group.tsx
2859
+ import {
2860
+ ToggleButton,
2861
+ ToggleButtonGroup
2862
+ } from "@mui/material";
2863
+ import { jsx as jsx7 } from "react/jsx-runtime";
2864
+ function ItecToggleButtonGroup(props) {
2865
+ const _a = props, { options, renderOption, onChange, value, toggleButtonProps } = _a, rest = __objRest(_a, ["options", "renderOption", "onChange", "value", "toggleButtonProps"]);
2866
+ return /* @__PURE__ */ jsx7(
2867
+ ToggleButtonGroup,
2868
+ __spreadProps(__spreadValues({
2869
+ value: value || 0,
2870
+ exclusive: true,
2871
+ onChange: (_, newValue) => {
2872
+ onChange(newValue);
2873
+ }
2874
+ }, rest), {
2875
+ children: options.map((option) => /* @__PURE__ */ jsx7(
2876
+ ToggleButton,
2877
+ __spreadProps(__spreadValues({
2878
+ value: option.value
2879
+ }, toggleButtonProps ? typeof toggleButtonProps === "function" ? toggleButtonProps(option) : toggleButtonProps : {}), {
2880
+ children: renderOption ? renderOption(option) : option.label
2881
+ }),
2882
+ option.value
2883
+ ))
2884
+ })
2885
+ );
2886
+ }
2887
+
2888
+ // src/components/forms/toggle-button-group/controlled-toggle-button-group.tsx
2889
+ import { FormControl, FormHelperText, FormLabel } from "@mui/material";
2890
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
2891
+ function ControlledToggleButtonGroup(props) {
2892
+ var _b, _c;
2893
+ const _a = props, {
2894
+ name,
2895
+ control,
2896
+ label,
2897
+ helperText,
2898
+ enforceValueSet,
2899
+ options
2900
+ } = _a, rest = __objRest(_a, [
2901
+ "name",
2902
+ "control",
2903
+ "label",
2904
+ "helperText",
2905
+ "enforceValueSet",
2906
+ "options"
2907
+ ]);
2908
+ const { field, fieldState, formState } = useField({
2909
+ name,
2910
+ control
2911
+ });
2912
+ const handleChange = (value) => {
2913
+ var _a2;
2914
+ if (!value && enforceValueSet) return;
2915
+ if (value === ((_a2 = field.value) == null ? void 0 : _a2.value)) {
2916
+ field.onChange(void 0);
2917
+ } else {
2918
+ field.onChange(options.find((v) => v.value === value));
2919
+ }
2920
+ };
2921
+ return /* @__PURE__ */ jsxs5(FormControl, { error: !!fieldState.error, children: [
2922
+ label && /* @__PURE__ */ jsx8(FormLabel, { children: label }),
2923
+ /* @__PURE__ */ jsx8(
2924
+ ItecToggleButtonGroup,
2925
+ __spreadValues({
2926
+ value: (_b = field.value) == null ? void 0 : _b.value,
2927
+ onChange: handleChange,
2928
+ options
2929
+ }, rest)
2930
+ ),
2931
+ /* @__PURE__ */ jsx8(FormHelperText, { children: ((_c = fieldState.error) == null ? void 0 : _c.message) || helperText && helperText })
2932
+ ] });
2933
+ }
2934
+
2935
+ // src/components/forms/toggle-button-group/toggle-button-group-multiple.tsx
2936
+ import {
2937
+ ToggleButton as ToggleButton2,
2938
+ ToggleButtonGroup as ToggleButtonGroup2
2939
+ } from "@mui/material";
2940
+ import { jsx as jsx9 } from "react/jsx-runtime";
2941
+ function ItecToggleButtonGroupMultiple(props) {
2942
+ const _a = props, { options, renderOption, onChange, value, toggleButtonProps } = _a, rest = __objRest(_a, ["options", "renderOption", "onChange", "value", "toggleButtonProps"]);
2943
+ return /* @__PURE__ */ jsx9(
2944
+ ToggleButtonGroup2,
2945
+ __spreadProps(__spreadValues({
2946
+ value: value || [],
2947
+ onChange: (_, newValue) => {
2948
+ onChange(newValue);
2949
+ }
2950
+ }, rest), {
2951
+ children: options.map((option) => /* @__PURE__ */ jsx9(
2952
+ ToggleButton2,
2953
+ __spreadProps(__spreadValues({
2954
+ value: option.value
2955
+ }, toggleButtonProps ? typeof toggleButtonProps === "function" ? toggleButtonProps(option) : toggleButtonProps : {}), {
2956
+ children: renderOption ? renderOption(option) : option.label
2957
+ }),
2958
+ option.value
2959
+ ))
2960
+ })
2961
+ );
2962
+ }
2963
+
2964
+ // src/components/forms/toggle-button-group/controlled-toggle-button-group-multiple.tsx
2965
+ import { FormControl as FormControl2, FormHelperText as FormHelperText2, FormLabel as FormLabel2 } from "@mui/material";
2966
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
2967
+ function ControlledToggleButtonGroupMultiple(props) {
2968
+ var _b, _c, _d;
2969
+ const _a = props, {
2970
+ name,
2971
+ control,
2972
+ label,
2973
+ helperText,
2974
+ enforceValueSet,
2975
+ options
2976
+ } = _a, rest = __objRest(_a, [
2977
+ "name",
2978
+ "control",
2979
+ "label",
2980
+ "helperText",
2981
+ "enforceValueSet",
2982
+ "options"
2983
+ ]);
2984
+ const { field, fieldState, formState } = useField({
2985
+ name,
2986
+ control
2987
+ });
2988
+ const handleChange = (value) => {
2989
+ if (!value.length && enforceValueSet) return;
2990
+ field.onChange(options.filter((v) => value.includes(v.value)));
2991
+ };
2992
+ return /* @__PURE__ */ jsxs6(FormControl2, { error: !!fieldState.error, children: [
2993
+ label && /* @__PURE__ */ jsx10(FormLabel2, { children: label }),
2994
+ /* @__PURE__ */ jsx10(
2995
+ ItecToggleButtonGroupMultiple,
2996
+ __spreadValues({
2997
+ value: (_c = (_b = field.value) == null ? void 0 : _b.map((v) => v.value)) != null ? _c : [],
2998
+ onChange: handleChange,
2999
+ options
3000
+ }, rest)
3001
+ ),
3002
+ /* @__PURE__ */ jsx10(FormHelperText2, { children: ((_d = fieldState.error) == null ? void 0 : _d.message) || helperText && helperText })
3003
+ ] });
3004
+ }
3005
+ export {
3006
+ ItaptecButton as Button,
3007
+ ControlledDateRangePicker,
3008
+ ItecToggleButtonGroup,
3009
+ ControlledMultiselect as Multiselect,
3010
+ ControlledSelect as Select,
3011
+ SplitButton,
3012
+ ControlledTextField as TextField,
3013
+ ControlledToggleButtonGroup as ToggleButtonGroup,
3014
+ ControlledToggleButtonGroupMultiple as ToggleButtonGroupMultiple
3015
+ };
3016
+ //# sourceMappingURL=index.mjs.map