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