shadcn-zod-formkit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,3637 @@
1
+ import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CheckIcon, XIcon, MinusIcon, GripVerticalIcon, ChevronUpIcon, CalendarIcon, EyeOff, Eye, Plus, MessageCircleWarning } from 'lucide-react';
2
+ import { InfoCircledIcon } from '@radix-ui/react-icons';
3
+ import { cva } from 'class-variance-authority';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
+ import * as React3 from 'react';
7
+ import React3__default, { useState, useEffect, useMemo, startTransition } from 'react';
8
+ import { FormProvider, Controller, useFormContext, useFormState, useForm } from 'react-hook-form';
9
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
10
+ import { Slot } from '@radix-ui/react-slot';
11
+ import { getDefaultClassNames, DayPicker } from 'react-day-picker';
12
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
13
+ import { useColor, ColorPicker } from 'react-color-palette';
14
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
15
+ import 'react-color-palette/css';
16
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
17
+ import * as LabelPrimitive from '@radix-ui/react-label';
18
+ import { OTPInput, OTPInputContext } from 'input-otp';
19
+ import * as ResizablePrimitive from 'react-resizable-panels';
20
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
21
+ import * as SelectPrimitive from '@radix-ui/react-select';
22
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
23
+ import { useTheme } from 'next-themes';
24
+ import { Toaster as Toaster$1 } from 'sonner';
25
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
26
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
27
+ import z2 from 'zod';
28
+ import { zodResolver } from '@hookform/resolvers/zod';
29
+
30
+ // node_modules/clsx/dist/clsx.mjs
31
+ function r(e) {
32
+ var t, f, n = "";
33
+ if ("string" == typeof e || "number" == typeof e) n += e;
34
+ else if ("object" == typeof e) if (Array.isArray(e)) {
35
+ var o = e.length;
36
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
37
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
38
+ return n;
39
+ }
40
+ function clsx() {
41
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
42
+ return n;
43
+ }
44
+ function cn(...inputs) {
45
+ return twMerge(clsx(inputs));
46
+ }
47
+ var alertVariants = cva(
48
+ "relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
49
+ {
50
+ variants: {
51
+ variant: {
52
+ default: "bg-card text-card-foreground",
53
+ destructive: "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"
54
+ }
55
+ },
56
+ defaultVariants: {
57
+ variant: "default"
58
+ }
59
+ }
60
+ );
61
+ function Alert({
62
+ className,
63
+ variant,
64
+ ...props
65
+ }) {
66
+ return /* @__PURE__ */ jsx(
67
+ "div",
68
+ {
69
+ "data-slot": "alert",
70
+ role: "alert",
71
+ className: cn(alertVariants({ variant }), className),
72
+ ...props
73
+ }
74
+ );
75
+ }
76
+ function AlertTitle({ className, ...props }) {
77
+ return /* @__PURE__ */ jsx(
78
+ "div",
79
+ {
80
+ "data-slot": "alert-title",
81
+ className: cn(
82
+ "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
83
+ className
84
+ ),
85
+ ...props
86
+ }
87
+ );
88
+ }
89
+ function AlertDescription({
90
+ className,
91
+ ...props
92
+ }) {
93
+ return /* @__PURE__ */ jsx(
94
+ "div",
95
+ {
96
+ "data-slot": "alert-description",
97
+ className: cn(
98
+ "text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
99
+ className
100
+ ),
101
+ ...props
102
+ }
103
+ );
104
+ }
105
+ var CustomAlert = ({
106
+ title,
107
+ description,
108
+ className = "",
109
+ variant = "info"
110
+ }) => {
111
+ const variantClasses = {
112
+ info: "bg-blue-500/25",
113
+ warning: "bg-yellow-500/25",
114
+ error: "bg-red-500/25",
115
+ success: "bg-green-500/25"
116
+ };
117
+ const variantIcons = {
118
+ info: /* @__PURE__ */ jsx(MessageCircleWarning, { size: 32, className: "text-blue-400" }),
119
+ warning: /* @__PURE__ */ jsx(MessageCircleWarning, { size: 32, className: "text-yellow-400" }),
120
+ error: /* @__PURE__ */ jsx(MessageCircleWarning, { size: 32, className: "text-red-400" }),
121
+ success: /* @__PURE__ */ jsx(InfoCircledIcon, { className: "w-8 h-8 text-green-400" })
122
+ };
123
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
124
+ Alert,
125
+ {
126
+ className: `mb-4 flex items-start gap-3 ${variantClasses[variant]} ${className}`,
127
+ children: [
128
+ /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: variantIcons[variant] }),
129
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
130
+ /* @__PURE__ */ jsx(AlertTitle, { className: "font-semibold text-xl", children: title }),
131
+ /* @__PURE__ */ jsx(AlertDescription, { className: "text-sm text-muted-foreground", children: description })
132
+ ] })
133
+ ]
134
+ }
135
+ ) });
136
+ };
137
+
138
+ // src/components/custom/form/input-errors.ts
139
+ var validationMessages = {
140
+ required: "Este campo es obligatorio",
141
+ email: "El correo electr\xF3nico no es v\xE1lido",
142
+ invalidFormat: "Formato inv\xE1lido",
143
+ onlyPositive: "Solo n\xFAmeros positivos",
144
+ minLength: (length) => `Debe tener al menos ${length} caracteres`,
145
+ maxLength: (length) => `No puede tener m\xE1s de ${length} caracteres`,
146
+ passwordMismatch: "Las contrase\xF1as no coinciden",
147
+ invalidPhone: "El n\xFAmero de tel\xE9fono no es v\xE1lido"
148
+ };
149
+
150
+ // src/components/custom/form/inputs/base/base-input.ts
151
+ var BaseInput = class {
152
+ constructor(input, form) {
153
+ this.input = input;
154
+ this.form = form;
155
+ }
156
+ };
157
+
158
+ // src/components/custom/form/inputs/base/definitions.ts
159
+ var TextInputType = /* @__PURE__ */ ((TextInputType2) => {
160
+ TextInputType2["DEFAULT"] = "default";
161
+ TextInputType2["NUMBER"] = "number";
162
+ TextInputType2["EMAIL"] = "email";
163
+ TextInputType2["PHONE"] = "phone";
164
+ TextInputType2["PASSWORD"] = "password";
165
+ return TextInputType2;
166
+ })(TextInputType || {});
167
+
168
+ // src/components/custom/form/inputs/base/input-types.ts
169
+ var InputTypes = /* @__PURE__ */ ((InputTypes2) => {
170
+ InputTypes2["HIDDEN"] = "hidden";
171
+ InputTypes2["TEXT"] = "text";
172
+ InputTypes2["NUMBER"] = "number";
173
+ InputTypes2["SWITCH"] = "switch";
174
+ InputTypes2["SELECT"] = "select";
175
+ InputTypes2["CHECK_LIST"] = "checklist";
176
+ InputTypes2["GROUPED_SWITCH_LIST"] = "grouped_switchlist";
177
+ InputTypes2["DATE"] = "date";
178
+ InputTypes2["TEXTAREA"] = "textarea";
179
+ InputTypes2["FILE"] = "file";
180
+ InputTypes2["OTP"] = "otp";
181
+ InputTypes2["FORM"] = "form";
182
+ InputTypes2["COLOR"] = "color";
183
+ return InputTypes2;
184
+ })(InputTypes || {});
185
+ var inputFieldComp = [
186
+ "grouped_switchlist" /* GROUPED_SWITCH_LIST */,
187
+ "text" /* TEXT */,
188
+ "switch" /* SWITCH */,
189
+ "color" /* COLOR */,
190
+ "otp" /* OTP */,
191
+ "select" /* SELECT */,
192
+ "date" /* DATE */,
193
+ "file" /* FILE */,
194
+ "form" /* FORM */,
195
+ "number" /* NUMBER */,
196
+ "textarea" /* TEXTAREA */,
197
+ // InputTypes.SWITCH_LIST,
198
+ "hidden" /* HIDDEN */
199
+ ];
200
+ function Accordion({
201
+ ...props
202
+ }) {
203
+ return /* @__PURE__ */ jsx(AccordionPrimitive.Root, { "data-slot": "accordion", ...props });
204
+ }
205
+ function AccordionItem({
206
+ className,
207
+ ...props
208
+ }) {
209
+ return /* @__PURE__ */ jsx(
210
+ AccordionPrimitive.Item,
211
+ {
212
+ "data-slot": "accordion-item",
213
+ className: cn("border-b last:border-b-0", className),
214
+ ...props
215
+ }
216
+ );
217
+ }
218
+ function AccordionTrigger({
219
+ className,
220
+ children,
221
+ ...props
222
+ }) {
223
+ return /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
224
+ AccordionPrimitive.Trigger,
225
+ {
226
+ "data-slot": "accordion-trigger",
227
+ className: cn(
228
+ "focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
229
+ className
230
+ ),
231
+ ...props,
232
+ children: [
233
+ children,
234
+ /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })
235
+ ]
236
+ }
237
+ ) });
238
+ }
239
+ function AccordionContent({
240
+ className,
241
+ children,
242
+ ...props
243
+ }) {
244
+ return /* @__PURE__ */ jsx(
245
+ AccordionPrimitive.Content,
246
+ {
247
+ "data-slot": "accordion-content",
248
+ className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
249
+ ...props,
250
+ children: /* @__PURE__ */ jsx("div", { className: cn("pt-0 pb-4", className), children })
251
+ }
252
+ );
253
+ }
254
+ var badgeVariants = cva(
255
+ "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
256
+ {
257
+ variants: {
258
+ variant: {
259
+ default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
260
+ secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
261
+ destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
262
+ outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
263
+ }
264
+ },
265
+ defaultVariants: {
266
+ variant: "default"
267
+ }
268
+ }
269
+ );
270
+ function Badge({
271
+ className,
272
+ variant,
273
+ asChild = false,
274
+ ...props
275
+ }) {
276
+ const Comp = asChild ? Slot : "span";
277
+ return /* @__PURE__ */ jsx(
278
+ Comp,
279
+ {
280
+ "data-slot": "badge",
281
+ className: cn(badgeVariants({ variant }), className),
282
+ ...props
283
+ }
284
+ );
285
+ }
286
+ var buttonVariants = cva(
287
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
288
+ {
289
+ variants: {
290
+ variant: {
291
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
292
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
293
+ outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
294
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
295
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
296
+ link: "text-primary underline-offset-4 hover:underline"
297
+ },
298
+ size: {
299
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
300
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
301
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
302
+ icon: "size-9"
303
+ }
304
+ },
305
+ defaultVariants: {
306
+ variant: "default",
307
+ size: "default"
308
+ }
309
+ }
310
+ );
311
+ function Button({
312
+ className,
313
+ variant,
314
+ size,
315
+ asChild = false,
316
+ ...props
317
+ }) {
318
+ const Comp = asChild ? Slot : "button";
319
+ return /* @__PURE__ */ jsx(
320
+ Comp,
321
+ {
322
+ "data-slot": "button",
323
+ className: cn(buttonVariants({ variant, size, className })),
324
+ ...props
325
+ }
326
+ );
327
+ }
328
+ function Calendar({
329
+ className,
330
+ classNames,
331
+ showOutsideDays = true,
332
+ captionLayout = "label",
333
+ buttonVariant = "ghost",
334
+ formatters: formatters2,
335
+ components,
336
+ ...props
337
+ }) {
338
+ const defaultClassNames = getDefaultClassNames();
339
+ return /* @__PURE__ */ jsx(
340
+ DayPicker,
341
+ {
342
+ showOutsideDays,
343
+ className: cn(
344
+ "bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
345
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
346
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
347
+ className
348
+ ),
349
+ captionLayout,
350
+ formatters: {
351
+ formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
352
+ ...formatters2
353
+ },
354
+ classNames: {
355
+ root: cn("w-fit", defaultClassNames.root),
356
+ months: cn(
357
+ "flex gap-4 flex-col md:flex-row relative",
358
+ defaultClassNames.months
359
+ ),
360
+ month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
361
+ nav: cn(
362
+ "flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
363
+ defaultClassNames.nav
364
+ ),
365
+ button_previous: cn(
366
+ buttonVariants({ variant: buttonVariant }),
367
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
368
+ defaultClassNames.button_previous
369
+ ),
370
+ button_next: cn(
371
+ buttonVariants({ variant: buttonVariant }),
372
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
373
+ defaultClassNames.button_next
374
+ ),
375
+ month_caption: cn(
376
+ "flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
377
+ defaultClassNames.month_caption
378
+ ),
379
+ dropdowns: cn(
380
+ "w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
381
+ defaultClassNames.dropdowns
382
+ ),
383
+ dropdown_root: cn(
384
+ "relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
385
+ defaultClassNames.dropdown_root
386
+ ),
387
+ dropdown: cn(
388
+ "absolute bg-popover inset-0 opacity-0",
389
+ defaultClassNames.dropdown
390
+ ),
391
+ caption_label: cn(
392
+ "select-none font-medium",
393
+ captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
394
+ defaultClassNames.caption_label
395
+ ),
396
+ table: "w-full border-collapse",
397
+ weekdays: cn("flex", defaultClassNames.weekdays),
398
+ weekday: cn(
399
+ "text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
400
+ defaultClassNames.weekday
401
+ ),
402
+ week: cn("flex w-full mt-2", defaultClassNames.week),
403
+ week_number_header: cn(
404
+ "select-none w-(--cell-size)",
405
+ defaultClassNames.week_number_header
406
+ ),
407
+ week_number: cn(
408
+ "text-[0.8rem] select-none text-muted-foreground",
409
+ defaultClassNames.week_number
410
+ ),
411
+ day: cn(
412
+ "relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
413
+ defaultClassNames.day
414
+ ),
415
+ range_start: cn(
416
+ "rounded-l-md bg-accent",
417
+ defaultClassNames.range_start
418
+ ),
419
+ range_middle: cn("rounded-none", defaultClassNames.range_middle),
420
+ range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
421
+ today: cn(
422
+ "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
423
+ defaultClassNames.today
424
+ ),
425
+ outside: cn(
426
+ "text-muted-foreground aria-selected:text-muted-foreground",
427
+ defaultClassNames.outside
428
+ ),
429
+ disabled: cn(
430
+ "text-muted-foreground opacity-50",
431
+ defaultClassNames.disabled
432
+ ),
433
+ hidden: cn("invisible", defaultClassNames.hidden),
434
+ ...classNames
435
+ },
436
+ components: {
437
+ Root: ({ className: className2, rootRef, ...props2 }) => {
438
+ return /* @__PURE__ */ jsx(
439
+ "div",
440
+ {
441
+ "data-slot": "calendar",
442
+ ref: rootRef,
443
+ className: cn(className2),
444
+ ...props2
445
+ }
446
+ );
447
+ },
448
+ Chevron: ({ className: className2, orientation, ...props2 }) => {
449
+ if (orientation === "left") {
450
+ return /* @__PURE__ */ jsx(ChevronLeftIcon, { className: cn("size-4", className2), ...props2 });
451
+ }
452
+ if (orientation === "right") {
453
+ return /* @__PURE__ */ jsx(
454
+ ChevronRightIcon,
455
+ {
456
+ className: cn("size-4", className2),
457
+ ...props2
458
+ }
459
+ );
460
+ }
461
+ return /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("size-4", className2), ...props2 });
462
+ },
463
+ DayButton: CalendarDayButton,
464
+ WeekNumber: ({ children, ...props2 }) => {
465
+ return /* @__PURE__ */ jsx("td", { ...props2, children: /* @__PURE__ */ jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) });
466
+ },
467
+ ...components
468
+ },
469
+ ...props
470
+ }
471
+ );
472
+ }
473
+ function CalendarDayButton({
474
+ className,
475
+ day,
476
+ modifiers,
477
+ ...props
478
+ }) {
479
+ const defaultClassNames = getDefaultClassNames();
480
+ const ref = React3.useRef(null);
481
+ React3.useEffect(() => {
482
+ if (modifiers.focused) ref.current?.focus();
483
+ }, [modifiers.focused]);
484
+ return /* @__PURE__ */ jsx(
485
+ Button,
486
+ {
487
+ ref,
488
+ variant: "ghost",
489
+ size: "icon",
490
+ "data-day": day.date.toLocaleDateString(),
491
+ "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
492
+ "data-range-start": modifiers.range_start,
493
+ "data-range-end": modifiers.range_end,
494
+ "data-range-middle": modifiers.range_middle,
495
+ className: cn(
496
+ "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
497
+ defaultClassNames.day,
498
+ className
499
+ ),
500
+ ...props
501
+ }
502
+ );
503
+ }
504
+ function Card({ className, ...props }) {
505
+ return /* @__PURE__ */ jsx(
506
+ "div",
507
+ {
508
+ "data-slot": "card",
509
+ className: cn(
510
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
511
+ className
512
+ ),
513
+ ...props
514
+ }
515
+ );
516
+ }
517
+ function CardHeader({ className, ...props }) {
518
+ return /* @__PURE__ */ jsx(
519
+ "div",
520
+ {
521
+ "data-slot": "card-header",
522
+ className: cn(
523
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
524
+ className
525
+ ),
526
+ ...props
527
+ }
528
+ );
529
+ }
530
+ function CardTitle({ className, ...props }) {
531
+ return /* @__PURE__ */ jsx(
532
+ "div",
533
+ {
534
+ "data-slot": "card-title",
535
+ className: cn("leading-none font-semibold", className),
536
+ ...props
537
+ }
538
+ );
539
+ }
540
+ function CardDescription({ className, ...props }) {
541
+ return /* @__PURE__ */ jsx(
542
+ "div",
543
+ {
544
+ "data-slot": "card-description",
545
+ className: cn("text-muted-foreground text-sm", className),
546
+ ...props
547
+ }
548
+ );
549
+ }
550
+ function CardAction({ className, ...props }) {
551
+ return /* @__PURE__ */ jsx(
552
+ "div",
553
+ {
554
+ "data-slot": "card-action",
555
+ className: cn(
556
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
557
+ className
558
+ ),
559
+ ...props
560
+ }
561
+ );
562
+ }
563
+ function CardContent({ className, ...props }) {
564
+ return /* @__PURE__ */ jsx(
565
+ "div",
566
+ {
567
+ "data-slot": "card-content",
568
+ className: cn("px-6", className),
569
+ ...props
570
+ }
571
+ );
572
+ }
573
+ function CardFooter({ className, ...props }) {
574
+ return /* @__PURE__ */ jsx(
575
+ "div",
576
+ {
577
+ "data-slot": "card-footer",
578
+ className: cn("flex items-center px-6 [.border-t]:pt-6", className),
579
+ ...props
580
+ }
581
+ );
582
+ }
583
+ function Checkbox({
584
+ className,
585
+ ...props
586
+ }) {
587
+ return /* @__PURE__ */ jsx(
588
+ CheckboxPrimitive.Root,
589
+ {
590
+ "data-slot": "checkbox",
591
+ className: cn(
592
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
593
+ className
594
+ ),
595
+ ...props,
596
+ children: /* @__PURE__ */ jsx(
597
+ CheckboxPrimitive.Indicator,
598
+ {
599
+ "data-slot": "checkbox-indicator",
600
+ className: "flex items-center justify-center text-current transition-none",
601
+ children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
602
+ }
603
+ )
604
+ }
605
+ );
606
+ }
607
+ function Popover({
608
+ ...props
609
+ }) {
610
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
611
+ }
612
+ function PopoverTrigger({
613
+ ...props
614
+ }) {
615
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
616
+ }
617
+ function PopoverContent({
618
+ className,
619
+ align = "center",
620
+ sideOffset = 4,
621
+ ...props
622
+ }) {
623
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
624
+ PopoverPrimitive.Content,
625
+ {
626
+ "data-slot": "popover-content",
627
+ align,
628
+ sideOffset,
629
+ className: cn(
630
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
631
+ className
632
+ ),
633
+ ...props
634
+ }
635
+ ) });
636
+ }
637
+ function PopoverAnchor({
638
+ ...props
639
+ }) {
640
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
641
+ }
642
+ var ColorCnInput = React3.forwardRef(
643
+ ({ value = "#000000", onChange, onBlur, disabled, className }, ref) => {
644
+ const [color, setColor] = useColor(value);
645
+ const [open, setOpen] = React3.useState(false);
646
+ React3.useEffect(() => {
647
+ if (value !== color.hex) {
648
+ setColor({ ...color, hex: value });
649
+ }
650
+ }, [color, setColor, value]);
651
+ const handleColorChange = (newColor) => {
652
+ setColor(newColor);
653
+ onChange?.(newColor.hex);
654
+ };
655
+ const handleOpenChange = (newOpen) => {
656
+ setOpen(newOpen);
657
+ if (!newOpen) {
658
+ onBlur?.();
659
+ }
660
+ };
661
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
662
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
663
+ Button,
664
+ {
665
+ ref,
666
+ variant: "outline",
667
+ disabled,
668
+ className: cn("w-full justify-start text-left font-normal", !value && "text-muted-foreground", className),
669
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
670
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-4 rounded border border-border", style: { backgroundColor: color.hex } }),
671
+ /* @__PURE__ */ jsx("span", { children: color.hex })
672
+ ] })
673
+ }
674
+ ) }),
675
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-3", align: "start", children: /* @__PURE__ */ jsx(ColorPicker, { color, onChange: handleColorChange, hideInput: ["rgb", "hsv"] }) })
676
+ ] });
677
+ }
678
+ );
679
+ ColorCnInput.displayName = "ColorCnInput";
680
+ function Dialog({
681
+ ...props
682
+ }) {
683
+ return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
684
+ }
685
+ function DialogTrigger({
686
+ ...props
687
+ }) {
688
+ return /* @__PURE__ */ jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
689
+ }
690
+ function DialogPortal({
691
+ ...props
692
+ }) {
693
+ return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
694
+ }
695
+ function DialogClose({
696
+ ...props
697
+ }) {
698
+ return /* @__PURE__ */ jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
699
+ }
700
+ function DialogOverlay({
701
+ className,
702
+ ...props
703
+ }) {
704
+ return /* @__PURE__ */ jsx(
705
+ DialogPrimitive.Overlay,
706
+ {
707
+ "data-slot": "dialog-overlay",
708
+ className: cn(
709
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
710
+ className
711
+ ),
712
+ ...props
713
+ }
714
+ );
715
+ }
716
+ function DialogContent({
717
+ className,
718
+ children,
719
+ showCloseButton = true,
720
+ ...props
721
+ }) {
722
+ return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
723
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
724
+ /* @__PURE__ */ jsxs(
725
+ DialogPrimitive.Content,
726
+ {
727
+ "data-slot": "dialog-content",
728
+ className: cn(
729
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
730
+ className
731
+ ),
732
+ ...props,
733
+ children: [
734
+ children,
735
+ showCloseButton && /* @__PURE__ */ jsxs(
736
+ DialogPrimitive.Close,
737
+ {
738
+ "data-slot": "dialog-close",
739
+ className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
740
+ children: [
741
+ /* @__PURE__ */ jsx(XIcon, {}),
742
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
743
+ ]
744
+ }
745
+ )
746
+ ]
747
+ }
748
+ )
749
+ ] });
750
+ }
751
+ function DialogHeader({ className, ...props }) {
752
+ return /* @__PURE__ */ jsx(
753
+ "div",
754
+ {
755
+ "data-slot": "dialog-header",
756
+ className: cn("flex flex-col gap-2 text-center sm:text-left", className),
757
+ ...props
758
+ }
759
+ );
760
+ }
761
+ function DialogFooter({ className, ...props }) {
762
+ return /* @__PURE__ */ jsx(
763
+ "div",
764
+ {
765
+ "data-slot": "dialog-footer",
766
+ className: cn(
767
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
768
+ className
769
+ ),
770
+ ...props
771
+ }
772
+ );
773
+ }
774
+ function DialogTitle({
775
+ className,
776
+ ...props
777
+ }) {
778
+ return /* @__PURE__ */ jsx(
779
+ DialogPrimitive.Title,
780
+ {
781
+ "data-slot": "dialog-title",
782
+ className: cn("text-lg leading-none font-semibold", className),
783
+ ...props
784
+ }
785
+ );
786
+ }
787
+ function DialogDescription({
788
+ className,
789
+ ...props
790
+ }) {
791
+ return /* @__PURE__ */ jsx(
792
+ DialogPrimitive.Description,
793
+ {
794
+ "data-slot": "dialog-description",
795
+ className: cn("text-muted-foreground text-sm", className),
796
+ ...props
797
+ }
798
+ );
799
+ }
800
+ function Label({
801
+ className,
802
+ ...props
803
+ }) {
804
+ return /* @__PURE__ */ jsx(
805
+ LabelPrimitive.Root,
806
+ {
807
+ "data-slot": "label",
808
+ className: cn(
809
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
810
+ className
811
+ ),
812
+ ...props
813
+ }
814
+ );
815
+ }
816
+ var Form = FormProvider;
817
+ var FormFieldContext = React3.createContext(
818
+ {}
819
+ );
820
+ var FormField = ({
821
+ ...props
822
+ }) => {
823
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
824
+ };
825
+ var useFormField = () => {
826
+ const fieldContext = React3.useContext(FormFieldContext);
827
+ const itemContext = React3.useContext(FormItemContext);
828
+ const { getFieldState } = useFormContext();
829
+ const formState = useFormState({ name: fieldContext.name });
830
+ const fieldState = getFieldState(fieldContext.name, formState);
831
+ if (!fieldContext) {
832
+ throw new Error("useFormField should be used within <FormField>");
833
+ }
834
+ const { id } = itemContext;
835
+ return {
836
+ id,
837
+ name: fieldContext.name,
838
+ formItemId: `${id}-form-item`,
839
+ formDescriptionId: `${id}-form-item-description`,
840
+ formMessageId: `${id}-form-item-message`,
841
+ ...fieldState
842
+ };
843
+ };
844
+ var FormItemContext = React3.createContext(
845
+ {}
846
+ );
847
+ function FormItem({ className, ...props }) {
848
+ const id = React3.useId();
849
+ return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx(
850
+ "div",
851
+ {
852
+ "data-slot": "form-item",
853
+ className: cn("grid gap-2", className),
854
+ ...props
855
+ }
856
+ ) });
857
+ }
858
+ function FormLabel({
859
+ className,
860
+ ...props
861
+ }) {
862
+ const { error, formItemId } = useFormField();
863
+ return /* @__PURE__ */ jsx(
864
+ Label,
865
+ {
866
+ "data-slot": "form-label",
867
+ "data-error": !!error,
868
+ className: cn("data-[error=true]:text-destructive", className),
869
+ htmlFor: formItemId,
870
+ ...props
871
+ }
872
+ );
873
+ }
874
+ function FormControl({ ...props }) {
875
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
876
+ return /* @__PURE__ */ jsx(
877
+ Slot,
878
+ {
879
+ "data-slot": "form-control",
880
+ id: formItemId,
881
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
882
+ "aria-invalid": !!error,
883
+ ...props
884
+ }
885
+ );
886
+ }
887
+ function FormDescription({ className, ...props }) {
888
+ const { formDescriptionId } = useFormField();
889
+ return /* @__PURE__ */ jsx(
890
+ "p",
891
+ {
892
+ "data-slot": "form-description",
893
+ id: formDescriptionId,
894
+ className: cn("text-muted-foreground text-sm", className),
895
+ ...props
896
+ }
897
+ );
898
+ }
899
+ function FormMessage({ className, ...props }) {
900
+ const { error, formMessageId } = useFormField();
901
+ const body = error ? String(error?.message ?? "") : props.children;
902
+ if (!body) {
903
+ return null;
904
+ }
905
+ return /* @__PURE__ */ jsx(
906
+ "p",
907
+ {
908
+ "data-slot": "form-message",
909
+ id: formMessageId,
910
+ className: cn("text-destructive text-sm", className),
911
+ ...props,
912
+ children: body
913
+ }
914
+ );
915
+ }
916
+ function InputOTP({
917
+ className,
918
+ containerClassName,
919
+ ...props
920
+ }) {
921
+ return /* @__PURE__ */ jsx(
922
+ OTPInput,
923
+ {
924
+ "data-slot": "input-otp",
925
+ containerClassName: cn(
926
+ "flex items-center gap-2 has-disabled:opacity-50",
927
+ containerClassName
928
+ ),
929
+ className: cn("disabled:cursor-not-allowed", className),
930
+ ...props
931
+ }
932
+ );
933
+ }
934
+ function InputOTPGroup({ className, ...props }) {
935
+ return /* @__PURE__ */ jsx(
936
+ "div",
937
+ {
938
+ "data-slot": "input-otp-group",
939
+ className: cn("flex items-center", className),
940
+ ...props
941
+ }
942
+ );
943
+ }
944
+ function InputOTPSlot({
945
+ index,
946
+ className,
947
+ ...props
948
+ }) {
949
+ const inputOTPContext = React3.useContext(OTPInputContext);
950
+ const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
951
+ return /* @__PURE__ */ jsxs(
952
+ "div",
953
+ {
954
+ "data-slot": "input-otp-slot",
955
+ "data-active": isActive,
956
+ className: cn(
957
+ "data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
958
+ className
959
+ ),
960
+ ...props,
961
+ children: [
962
+ char,
963
+ hasFakeCaret && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "animate-caret-blink bg-foreground h-4 w-px duration-1000" }) })
964
+ ]
965
+ }
966
+ );
967
+ }
968
+ function InputOTPSeparator({ ...props }) {
969
+ return /* @__PURE__ */ jsx("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx(MinusIcon, {}) });
970
+ }
971
+ function Input({ className, type, ...props }) {
972
+ return /* @__PURE__ */ jsx(
973
+ "input",
974
+ {
975
+ type,
976
+ "data-slot": "input",
977
+ className: cn(
978
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
979
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
980
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
981
+ className
982
+ ),
983
+ ...props
984
+ }
985
+ );
986
+ }
987
+ function ResizablePanelGroup({
988
+ className,
989
+ ...props
990
+ }) {
991
+ return /* @__PURE__ */ jsx(
992
+ ResizablePrimitive.PanelGroup,
993
+ {
994
+ "data-slot": "resizable-panel-group",
995
+ className: cn(
996
+ "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
997
+ className
998
+ ),
999
+ ...props
1000
+ }
1001
+ );
1002
+ }
1003
+ function ResizablePanel({
1004
+ ...props
1005
+ }) {
1006
+ return /* @__PURE__ */ jsx(ResizablePrimitive.Panel, { "data-slot": "resizable-panel", ...props });
1007
+ }
1008
+ function ResizableHandle({
1009
+ withHandle,
1010
+ className,
1011
+ ...props
1012
+ }) {
1013
+ return /* @__PURE__ */ jsx(
1014
+ ResizablePrimitive.PanelResizeHandle,
1015
+ {
1016
+ "data-slot": "resizable-handle",
1017
+ className: cn(
1018
+ "bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",
1019
+ className
1020
+ ),
1021
+ ...props,
1022
+ children: withHandle && /* @__PURE__ */ jsx("div", { className: "bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border", children: /* @__PURE__ */ jsx(GripVerticalIcon, { className: "size-2.5" }) })
1023
+ }
1024
+ );
1025
+ }
1026
+ function ScrollArea({
1027
+ className,
1028
+ children,
1029
+ ...props
1030
+ }) {
1031
+ return /* @__PURE__ */ jsxs(
1032
+ ScrollAreaPrimitive.Root,
1033
+ {
1034
+ "data-slot": "scroll-area",
1035
+ className: cn("relative", className),
1036
+ ...props,
1037
+ children: [
1038
+ /* @__PURE__ */ jsx(
1039
+ ScrollAreaPrimitive.Viewport,
1040
+ {
1041
+ "data-slot": "scroll-area-viewport",
1042
+ className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
1043
+ children
1044
+ }
1045
+ ),
1046
+ /* @__PURE__ */ jsx(ScrollBar, {}),
1047
+ /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
1048
+ ]
1049
+ }
1050
+ );
1051
+ }
1052
+ function ScrollBar({
1053
+ className,
1054
+ orientation = "vertical",
1055
+ ...props
1056
+ }) {
1057
+ return /* @__PURE__ */ jsx(
1058
+ ScrollAreaPrimitive.ScrollAreaScrollbar,
1059
+ {
1060
+ "data-slot": "scroll-area-scrollbar",
1061
+ orientation,
1062
+ className: cn(
1063
+ "flex touch-none p-px transition-colors select-none",
1064
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent",
1065
+ orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
1066
+ className
1067
+ ),
1068
+ ...props,
1069
+ children: /* @__PURE__ */ jsx(
1070
+ ScrollAreaPrimitive.ScrollAreaThumb,
1071
+ {
1072
+ "data-slot": "scroll-area-thumb",
1073
+ className: "bg-border relative flex-1 rounded-full"
1074
+ }
1075
+ )
1076
+ }
1077
+ );
1078
+ }
1079
+ function Select({
1080
+ ...props
1081
+ }) {
1082
+ return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
1083
+ }
1084
+ function SelectGroup({
1085
+ ...props
1086
+ }) {
1087
+ return /* @__PURE__ */ jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
1088
+ }
1089
+ function SelectValue({
1090
+ ...props
1091
+ }) {
1092
+ return /* @__PURE__ */ jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
1093
+ }
1094
+ function SelectTrigger({
1095
+ className,
1096
+ size = "default",
1097
+ children,
1098
+ ...props
1099
+ }) {
1100
+ return /* @__PURE__ */ jsxs(
1101
+ SelectPrimitive.Trigger,
1102
+ {
1103
+ "data-slot": "select-trigger",
1104
+ "data-size": size,
1105
+ className: cn(
1106
+ "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1107
+ className
1108
+ ),
1109
+ ...props,
1110
+ children: [
1111
+ children,
1112
+ /* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 opacity-50" }) })
1113
+ ]
1114
+ }
1115
+ );
1116
+ }
1117
+ function SelectContent({
1118
+ className,
1119
+ children,
1120
+ position = "popper",
1121
+ ...props
1122
+ }) {
1123
+ return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
1124
+ SelectPrimitive.Content,
1125
+ {
1126
+ "data-slot": "select-content",
1127
+ className: cn(
1128
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
1129
+ position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
1130
+ className
1131
+ ),
1132
+ position,
1133
+ ...props,
1134
+ children: [
1135
+ /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
1136
+ /* @__PURE__ */ jsx(
1137
+ SelectPrimitive.Viewport,
1138
+ {
1139
+ className: cn(
1140
+ "p-1",
1141
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
1142
+ ),
1143
+ children
1144
+ }
1145
+ ),
1146
+ /* @__PURE__ */ jsx(SelectScrollDownButton, {})
1147
+ ]
1148
+ }
1149
+ ) });
1150
+ }
1151
+ function SelectLabel({
1152
+ className,
1153
+ ...props
1154
+ }) {
1155
+ return /* @__PURE__ */ jsx(
1156
+ SelectPrimitive.Label,
1157
+ {
1158
+ "data-slot": "select-label",
1159
+ className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
1160
+ ...props
1161
+ }
1162
+ );
1163
+ }
1164
+ function SelectItem({
1165
+ className,
1166
+ children,
1167
+ ...props
1168
+ }) {
1169
+ return /* @__PURE__ */ jsxs(
1170
+ SelectPrimitive.Item,
1171
+ {
1172
+ "data-slot": "select-item",
1173
+ className: cn(
1174
+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
1175
+ className
1176
+ ),
1177
+ ...props,
1178
+ children: [
1179
+ /* @__PURE__ */ jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
1180
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
1181
+ ]
1182
+ }
1183
+ );
1184
+ }
1185
+ function SelectSeparator({
1186
+ className,
1187
+ ...props
1188
+ }) {
1189
+ return /* @__PURE__ */ jsx(
1190
+ SelectPrimitive.Separator,
1191
+ {
1192
+ "data-slot": "select-separator",
1193
+ className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
1194
+ ...props
1195
+ }
1196
+ );
1197
+ }
1198
+ function SelectScrollUpButton({
1199
+ className,
1200
+ ...props
1201
+ }) {
1202
+ return /* @__PURE__ */ jsx(
1203
+ SelectPrimitive.ScrollUpButton,
1204
+ {
1205
+ "data-slot": "select-scroll-up-button",
1206
+ className: cn(
1207
+ "flex cursor-default items-center justify-center py-1",
1208
+ className
1209
+ ),
1210
+ ...props,
1211
+ children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
1212
+ }
1213
+ );
1214
+ }
1215
+ function SelectScrollDownButton({
1216
+ className,
1217
+ ...props
1218
+ }) {
1219
+ return /* @__PURE__ */ jsx(
1220
+ SelectPrimitive.ScrollDownButton,
1221
+ {
1222
+ "data-slot": "select-scroll-down-button",
1223
+ className: cn(
1224
+ "flex cursor-default items-center justify-center py-1",
1225
+ className
1226
+ ),
1227
+ ...props,
1228
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
1229
+ }
1230
+ );
1231
+ }
1232
+ function Separator2({
1233
+ className,
1234
+ orientation = "horizontal",
1235
+ decorative = true,
1236
+ ...props
1237
+ }) {
1238
+ return /* @__PURE__ */ jsx(
1239
+ SeparatorPrimitive.Root,
1240
+ {
1241
+ "data-slot": "separator",
1242
+ decorative,
1243
+ orientation,
1244
+ className: cn(
1245
+ "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
1246
+ className
1247
+ ),
1248
+ ...props
1249
+ }
1250
+ );
1251
+ }
1252
+ var Toaster = ({ ...props }) => {
1253
+ const { theme = "system" } = useTheme();
1254
+ return /* @__PURE__ */ jsx(
1255
+ Toaster$1,
1256
+ {
1257
+ theme,
1258
+ className: "toaster group",
1259
+ style: {
1260
+ "--normal-bg": "var(--popover)",
1261
+ "--normal-text": "var(--popover-foreground)",
1262
+ "--normal-border": "var(--border)"
1263
+ },
1264
+ ...props
1265
+ }
1266
+ );
1267
+ };
1268
+ function Switch({
1269
+ className,
1270
+ ...props
1271
+ }) {
1272
+ return /* @__PURE__ */ jsx(
1273
+ SwitchPrimitive.Root,
1274
+ {
1275
+ "data-slot": "switch",
1276
+ className: cn(
1277
+ "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
1278
+ className
1279
+ ),
1280
+ ...props,
1281
+ children: /* @__PURE__ */ jsx(
1282
+ SwitchPrimitive.Thumb,
1283
+ {
1284
+ "data-slot": "switch-thumb",
1285
+ className: cn(
1286
+ "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
1287
+ )
1288
+ }
1289
+ )
1290
+ }
1291
+ );
1292
+ }
1293
+ function Textarea({ className, ...props }) {
1294
+ return /* @__PURE__ */ jsx(
1295
+ "textarea",
1296
+ {
1297
+ "data-slot": "textarea",
1298
+ className: cn(
1299
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1300
+ className
1301
+ ),
1302
+ ...props
1303
+ }
1304
+ );
1305
+ }
1306
+ function TooltipProvider({
1307
+ delayDuration = 0,
1308
+ ...props
1309
+ }) {
1310
+ return /* @__PURE__ */ jsx(
1311
+ TooltipPrimitive.Provider,
1312
+ {
1313
+ "data-slot": "tooltip-provider",
1314
+ delayDuration,
1315
+ ...props
1316
+ }
1317
+ );
1318
+ }
1319
+ function Tooltip({
1320
+ ...props
1321
+ }) {
1322
+ return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
1323
+ }
1324
+ function TooltipTrigger({
1325
+ ...props
1326
+ }) {
1327
+ return /* @__PURE__ */ jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
1328
+ }
1329
+ function TooltipContent({
1330
+ className,
1331
+ sideOffset = 0,
1332
+ children,
1333
+ ...props
1334
+ }) {
1335
+ return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
1336
+ TooltipPrimitive.Content,
1337
+ {
1338
+ "data-slot": "tooltip-content",
1339
+ sideOffset,
1340
+ className: cn(
1341
+ "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
1342
+ className
1343
+ ),
1344
+ ...props,
1345
+ children: [
1346
+ children,
1347
+ /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
1348
+ ]
1349
+ }
1350
+ ) });
1351
+ }
1352
+ var CheckListInput = class extends BaseInput {
1353
+ render() {
1354
+ const { input } = this;
1355
+ const listConfig = input?.listConfig;
1356
+ let lista = listConfig?.list ?? [];
1357
+ if (lista == void 0) lista = [];
1358
+ const title = "title";
1359
+ const value = input.value;
1360
+ const label = listConfig?.optionLabel ?? "name";
1361
+ const optionValue = listConfig?.optionValue ?? "id";
1362
+ const description = listConfig?.optionDescription ?? "description";
1363
+ return /* @__PURE__ */ jsxs(Card, { children: [
1364
+ /* @__PURE__ */ jsx(CardHeader, { className: "pb-3", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: title }) }),
1365
+ /* @__PURE__ */ jsx(CardContent, { className: "space-y-3", children: lista.map(
1366
+ (item) => /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
1367
+ /* @__PURE__ */ jsx(
1368
+ Checkbox,
1369
+ {
1370
+ id: String(item[optionValue]),
1371
+ checked: value.includes(item[optionValue]),
1372
+ onCheckedChange: () => {
1373
+ }
1374
+ }
1375
+ ),
1376
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-1.5 leading-none", children: [
1377
+ /* @__PURE__ */ jsx(
1378
+ Label,
1379
+ {
1380
+ htmlFor: String(item[optionValue]),
1381
+ className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
1382
+ children: item[label]
1383
+ }
1384
+ ),
1385
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: item[description] })
1386
+ ] })
1387
+ ] }, item[optionValue])
1388
+ ) })
1389
+ ] }, title);
1390
+ }
1391
+ };
1392
+ var ColorInput = class extends BaseInput {
1393
+ render() {
1394
+ const { input, form } = this;
1395
+ return /* @__PURE__ */ jsx(FieldColor, { input, form });
1396
+ }
1397
+ };
1398
+ var FieldColor = ({ form, input }) => {
1399
+ const [ColorCmp, _setColorCmp] = useState(ColorComp);
1400
+ return /* @__PURE__ */ jsx(
1401
+ FormField,
1402
+ {
1403
+ control: form.control,
1404
+ name: input.name,
1405
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
1406
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
1407
+ /* @__PURE__ */ jsx(FormControl, { children: ColorCmp ? /* @__PURE__ */ jsx(
1408
+ ColorCmp,
1409
+ {
1410
+ value: field.value,
1411
+ onChange: field.onChange,
1412
+ onBlur: field.onBlur,
1413
+ disabled: input.disabled,
1414
+ placeholder: input.placeHolder
1415
+ }
1416
+ ) : /* @__PURE__ */ jsx(
1417
+ "input",
1418
+ {
1419
+ type: "color",
1420
+ value: field.value || "#000000",
1421
+ onChange: (e) => field.onChange(e.target.value),
1422
+ onBlur: () => field.onBlur(),
1423
+ disabled: input.disabled,
1424
+ placeholder: input.placeHolder,
1425
+ style: { width: 48, height: 28 }
1426
+ }
1427
+ ) }),
1428
+ /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
1429
+ /* @__PURE__ */ jsx(FormMessage, {})
1430
+ ] })
1431
+ }
1432
+ );
1433
+ };
1434
+ var ColorComp = React3__default.forwardRef(
1435
+ ({ value = "#000000", onChange, onBlur, disabled, className }, ref) => {
1436
+ const [color, setColor] = useColor(value);
1437
+ const [open, setOpen] = React3__default.useState(false);
1438
+ React3__default.useEffect(() => {
1439
+ if (value !== color.hex) {
1440
+ setColor({ ...color, hex: value });
1441
+ }
1442
+ }, [color, setColor, value]);
1443
+ const handleColorChange = (newColor) => {
1444
+ setColor(newColor);
1445
+ onChange?.(newColor.hex);
1446
+ };
1447
+ const handleOpenChange = (newOpen) => {
1448
+ setOpen(newOpen);
1449
+ if (!newOpen) {
1450
+ onBlur?.();
1451
+ }
1452
+ };
1453
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
1454
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
1455
+ Button,
1456
+ {
1457
+ ref,
1458
+ variant: "outline",
1459
+ disabled,
1460
+ className: cn("w-full justify-start text-left font-normal", !value && "text-muted-foreground", className),
1461
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1462
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-4 rounded border border-border", style: { backgroundColor: color.hex } }),
1463
+ /* @__PURE__ */ jsx("span", { children: color.hex })
1464
+ ] })
1465
+ }
1466
+ ) }),
1467
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-3", align: "start", children: /* @__PURE__ */ jsx(ColorPicker, { color, onChange: handleColorChange, hideInput: ["rgb", "hsv"] }) })
1468
+ ] });
1469
+ }
1470
+ );
1471
+ var millisecondsInWeek = 6048e5;
1472
+ var millisecondsInDay = 864e5;
1473
+ var constructFromSymbol = Symbol.for("constructDateFrom");
1474
+
1475
+ // node_modules/date-fns/constructFrom.js
1476
+ function constructFrom(date, value) {
1477
+ if (typeof date === "function") return date(value);
1478
+ if (date && typeof date === "object" && constructFromSymbol in date)
1479
+ return date[constructFromSymbol](value);
1480
+ if (date instanceof Date) return new date.constructor(value);
1481
+ return new Date(value);
1482
+ }
1483
+
1484
+ // node_modules/date-fns/toDate.js
1485
+ function toDate(argument, context) {
1486
+ return constructFrom(context || argument, argument);
1487
+ }
1488
+
1489
+ // node_modules/date-fns/_lib/defaultOptions.js
1490
+ var defaultOptions = {};
1491
+ function getDefaultOptions() {
1492
+ return defaultOptions;
1493
+ }
1494
+
1495
+ // node_modules/date-fns/startOfWeek.js
1496
+ function startOfWeek(date, options) {
1497
+ const defaultOptions2 = getDefaultOptions();
1498
+ const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
1499
+ const _date = toDate(date, options?.in);
1500
+ const day = _date.getDay();
1501
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
1502
+ _date.setDate(_date.getDate() - diff);
1503
+ _date.setHours(0, 0, 0, 0);
1504
+ return _date;
1505
+ }
1506
+
1507
+ // node_modules/date-fns/startOfISOWeek.js
1508
+ function startOfISOWeek(date, options) {
1509
+ return startOfWeek(date, { ...options, weekStartsOn: 1 });
1510
+ }
1511
+
1512
+ // node_modules/date-fns/getISOWeekYear.js
1513
+ function getISOWeekYear(date, options) {
1514
+ const _date = toDate(date, options?.in);
1515
+ const year = _date.getFullYear();
1516
+ const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
1517
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
1518
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
1519
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
1520
+ const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
1521
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
1522
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
1523
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
1524
+ if (_date.getTime() >= startOfNextYear.getTime()) {
1525
+ return year + 1;
1526
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
1527
+ return year;
1528
+ } else {
1529
+ return year - 1;
1530
+ }
1531
+ }
1532
+
1533
+ // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
1534
+ function getTimezoneOffsetInMilliseconds(date) {
1535
+ const _date = toDate(date);
1536
+ const utcDate = new Date(
1537
+ Date.UTC(
1538
+ _date.getFullYear(),
1539
+ _date.getMonth(),
1540
+ _date.getDate(),
1541
+ _date.getHours(),
1542
+ _date.getMinutes(),
1543
+ _date.getSeconds(),
1544
+ _date.getMilliseconds()
1545
+ )
1546
+ );
1547
+ utcDate.setUTCFullYear(_date.getFullYear());
1548
+ return +date - +utcDate;
1549
+ }
1550
+
1551
+ // node_modules/date-fns/_lib/normalizeDates.js
1552
+ function normalizeDates(context, ...dates) {
1553
+ const normalize = constructFrom.bind(
1554
+ null,
1555
+ dates.find((date) => typeof date === "object")
1556
+ );
1557
+ return dates.map(normalize);
1558
+ }
1559
+
1560
+ // node_modules/date-fns/startOfDay.js
1561
+ function startOfDay(date, options) {
1562
+ const _date = toDate(date, options?.in);
1563
+ _date.setHours(0, 0, 0, 0);
1564
+ return _date;
1565
+ }
1566
+
1567
+ // node_modules/date-fns/differenceInCalendarDays.js
1568
+ function differenceInCalendarDays(laterDate, earlierDate, options) {
1569
+ const [laterDate_, earlierDate_] = normalizeDates(
1570
+ options?.in,
1571
+ laterDate,
1572
+ earlierDate
1573
+ );
1574
+ const laterStartOfDay = startOfDay(laterDate_);
1575
+ const earlierStartOfDay = startOfDay(earlierDate_);
1576
+ const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
1577
+ const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
1578
+ return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
1579
+ }
1580
+
1581
+ // node_modules/date-fns/startOfISOWeekYear.js
1582
+ function startOfISOWeekYear(date, options) {
1583
+ const year = getISOWeekYear(date, options);
1584
+ const fourthOfJanuary = constructFrom(date, 0);
1585
+ fourthOfJanuary.setFullYear(year, 0, 4);
1586
+ fourthOfJanuary.setHours(0, 0, 0, 0);
1587
+ return startOfISOWeek(fourthOfJanuary);
1588
+ }
1589
+
1590
+ // node_modules/date-fns/isDate.js
1591
+ function isDate(value) {
1592
+ return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
1593
+ }
1594
+
1595
+ // node_modules/date-fns/isValid.js
1596
+ function isValid(date) {
1597
+ return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
1598
+ }
1599
+
1600
+ // node_modules/date-fns/startOfYear.js
1601
+ function startOfYear(date, options) {
1602
+ const date_ = toDate(date, options?.in);
1603
+ date_.setFullYear(date_.getFullYear(), 0, 1);
1604
+ date_.setHours(0, 0, 0, 0);
1605
+ return date_;
1606
+ }
1607
+
1608
+ // node_modules/date-fns/locale/en-US/_lib/formatDistance.js
1609
+ var formatDistanceLocale = {
1610
+ lessThanXSeconds: {
1611
+ one: "less than a second",
1612
+ other: "less than {{count}} seconds"
1613
+ },
1614
+ xSeconds: {
1615
+ one: "1 second",
1616
+ other: "{{count}} seconds"
1617
+ },
1618
+ halfAMinute: "half a minute",
1619
+ lessThanXMinutes: {
1620
+ one: "less than a minute",
1621
+ other: "less than {{count}} minutes"
1622
+ },
1623
+ xMinutes: {
1624
+ one: "1 minute",
1625
+ other: "{{count}} minutes"
1626
+ },
1627
+ aboutXHours: {
1628
+ one: "about 1 hour",
1629
+ other: "about {{count}} hours"
1630
+ },
1631
+ xHours: {
1632
+ one: "1 hour",
1633
+ other: "{{count}} hours"
1634
+ },
1635
+ xDays: {
1636
+ one: "1 day",
1637
+ other: "{{count}} days"
1638
+ },
1639
+ aboutXWeeks: {
1640
+ one: "about 1 week",
1641
+ other: "about {{count}} weeks"
1642
+ },
1643
+ xWeeks: {
1644
+ one: "1 week",
1645
+ other: "{{count}} weeks"
1646
+ },
1647
+ aboutXMonths: {
1648
+ one: "about 1 month",
1649
+ other: "about {{count}} months"
1650
+ },
1651
+ xMonths: {
1652
+ one: "1 month",
1653
+ other: "{{count}} months"
1654
+ },
1655
+ aboutXYears: {
1656
+ one: "about 1 year",
1657
+ other: "about {{count}} years"
1658
+ },
1659
+ xYears: {
1660
+ one: "1 year",
1661
+ other: "{{count}} years"
1662
+ },
1663
+ overXYears: {
1664
+ one: "over 1 year",
1665
+ other: "over {{count}} years"
1666
+ },
1667
+ almostXYears: {
1668
+ one: "almost 1 year",
1669
+ other: "almost {{count}} years"
1670
+ }
1671
+ };
1672
+ var formatDistance = (token, count, options) => {
1673
+ let result;
1674
+ const tokenValue = formatDistanceLocale[token];
1675
+ if (typeof tokenValue === "string") {
1676
+ result = tokenValue;
1677
+ } else if (count === 1) {
1678
+ result = tokenValue.one;
1679
+ } else {
1680
+ result = tokenValue.other.replace("{{count}}", count.toString());
1681
+ }
1682
+ if (options?.addSuffix) {
1683
+ if (options.comparison && options.comparison > 0) {
1684
+ return "in " + result;
1685
+ } else {
1686
+ return result + " ago";
1687
+ }
1688
+ }
1689
+ return result;
1690
+ };
1691
+
1692
+ // node_modules/date-fns/locale/_lib/buildFormatLongFn.js
1693
+ function buildFormatLongFn(args) {
1694
+ return (options = {}) => {
1695
+ const width = options.width ? String(options.width) : args.defaultWidth;
1696
+ const format2 = args.formats[width] || args.formats[args.defaultWidth];
1697
+ return format2;
1698
+ };
1699
+ }
1700
+
1701
+ // node_modules/date-fns/locale/en-US/_lib/formatLong.js
1702
+ var dateFormats = {
1703
+ full: "EEEE, MMMM do, y",
1704
+ long: "MMMM do, y",
1705
+ medium: "MMM d, y",
1706
+ short: "MM/dd/yyyy"
1707
+ };
1708
+ var timeFormats = {
1709
+ full: "h:mm:ss a zzzz",
1710
+ long: "h:mm:ss a z",
1711
+ medium: "h:mm:ss a",
1712
+ short: "h:mm a"
1713
+ };
1714
+ var dateTimeFormats = {
1715
+ full: "{{date}} 'at' {{time}}",
1716
+ long: "{{date}} 'at' {{time}}",
1717
+ medium: "{{date}}, {{time}}",
1718
+ short: "{{date}}, {{time}}"
1719
+ };
1720
+ var formatLong = {
1721
+ date: buildFormatLongFn({
1722
+ formats: dateFormats,
1723
+ defaultWidth: "full"
1724
+ }),
1725
+ time: buildFormatLongFn({
1726
+ formats: timeFormats,
1727
+ defaultWidth: "full"
1728
+ }),
1729
+ dateTime: buildFormatLongFn({
1730
+ formats: dateTimeFormats,
1731
+ defaultWidth: "full"
1732
+ })
1733
+ };
1734
+
1735
+ // node_modules/date-fns/locale/en-US/_lib/formatRelative.js
1736
+ var formatRelativeLocale = {
1737
+ lastWeek: "'last' eeee 'at' p",
1738
+ yesterday: "'yesterday at' p",
1739
+ today: "'today at' p",
1740
+ tomorrow: "'tomorrow at' p",
1741
+ nextWeek: "eeee 'at' p",
1742
+ other: "P"
1743
+ };
1744
+ var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
1745
+
1746
+ // node_modules/date-fns/locale/_lib/buildLocalizeFn.js
1747
+ function buildLocalizeFn(args) {
1748
+ return (value, options) => {
1749
+ const context = options?.context ? String(options.context) : "standalone";
1750
+ let valuesArray;
1751
+ if (context === "formatting" && args.formattingValues) {
1752
+ const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1753
+ const width = options?.width ? String(options.width) : defaultWidth;
1754
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1755
+ } else {
1756
+ const defaultWidth = args.defaultWidth;
1757
+ const width = options?.width ? String(options.width) : args.defaultWidth;
1758
+ valuesArray = args.values[width] || args.values[defaultWidth];
1759
+ }
1760
+ const index = args.argumentCallback ? args.argumentCallback(value) : value;
1761
+ return valuesArray[index];
1762
+ };
1763
+ }
1764
+
1765
+ // node_modules/date-fns/locale/en-US/_lib/localize.js
1766
+ var eraValues = {
1767
+ narrow: ["B", "A"],
1768
+ abbreviated: ["BC", "AD"],
1769
+ wide: ["Before Christ", "Anno Domini"]
1770
+ };
1771
+ var quarterValues = {
1772
+ narrow: ["1", "2", "3", "4"],
1773
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
1774
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
1775
+ };
1776
+ var monthValues = {
1777
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
1778
+ abbreviated: [
1779
+ "Jan",
1780
+ "Feb",
1781
+ "Mar",
1782
+ "Apr",
1783
+ "May",
1784
+ "Jun",
1785
+ "Jul",
1786
+ "Aug",
1787
+ "Sep",
1788
+ "Oct",
1789
+ "Nov",
1790
+ "Dec"
1791
+ ],
1792
+ wide: [
1793
+ "January",
1794
+ "February",
1795
+ "March",
1796
+ "April",
1797
+ "May",
1798
+ "June",
1799
+ "July",
1800
+ "August",
1801
+ "September",
1802
+ "October",
1803
+ "November",
1804
+ "December"
1805
+ ]
1806
+ };
1807
+ var dayValues = {
1808
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
1809
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1810
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1811
+ wide: [
1812
+ "Sunday",
1813
+ "Monday",
1814
+ "Tuesday",
1815
+ "Wednesday",
1816
+ "Thursday",
1817
+ "Friday",
1818
+ "Saturday"
1819
+ ]
1820
+ };
1821
+ var dayPeriodValues = {
1822
+ narrow: {
1823
+ am: "a",
1824
+ pm: "p",
1825
+ midnight: "mi",
1826
+ noon: "n",
1827
+ morning: "morning",
1828
+ afternoon: "afternoon",
1829
+ evening: "evening",
1830
+ night: "night"
1831
+ },
1832
+ abbreviated: {
1833
+ am: "AM",
1834
+ pm: "PM",
1835
+ midnight: "midnight",
1836
+ noon: "noon",
1837
+ morning: "morning",
1838
+ afternoon: "afternoon",
1839
+ evening: "evening",
1840
+ night: "night"
1841
+ },
1842
+ wide: {
1843
+ am: "a.m.",
1844
+ pm: "p.m.",
1845
+ midnight: "midnight",
1846
+ noon: "noon",
1847
+ morning: "morning",
1848
+ afternoon: "afternoon",
1849
+ evening: "evening",
1850
+ night: "night"
1851
+ }
1852
+ };
1853
+ var formattingDayPeriodValues = {
1854
+ narrow: {
1855
+ am: "a",
1856
+ pm: "p",
1857
+ midnight: "mi",
1858
+ noon: "n",
1859
+ morning: "in the morning",
1860
+ afternoon: "in the afternoon",
1861
+ evening: "in the evening",
1862
+ night: "at night"
1863
+ },
1864
+ abbreviated: {
1865
+ am: "AM",
1866
+ pm: "PM",
1867
+ midnight: "midnight",
1868
+ noon: "noon",
1869
+ morning: "in the morning",
1870
+ afternoon: "in the afternoon",
1871
+ evening: "in the evening",
1872
+ night: "at night"
1873
+ },
1874
+ wide: {
1875
+ am: "a.m.",
1876
+ pm: "p.m.",
1877
+ midnight: "midnight",
1878
+ noon: "noon",
1879
+ morning: "in the morning",
1880
+ afternoon: "in the afternoon",
1881
+ evening: "in the evening",
1882
+ night: "at night"
1883
+ }
1884
+ };
1885
+ var ordinalNumber = (dirtyNumber, _options) => {
1886
+ const number = Number(dirtyNumber);
1887
+ const rem100 = number % 100;
1888
+ if (rem100 > 20 || rem100 < 10) {
1889
+ switch (rem100 % 10) {
1890
+ case 1:
1891
+ return number + "st";
1892
+ case 2:
1893
+ return number + "nd";
1894
+ case 3:
1895
+ return number + "rd";
1896
+ }
1897
+ }
1898
+ return number + "th";
1899
+ };
1900
+ var localize = {
1901
+ ordinalNumber,
1902
+ era: buildLocalizeFn({
1903
+ values: eraValues,
1904
+ defaultWidth: "wide"
1905
+ }),
1906
+ quarter: buildLocalizeFn({
1907
+ values: quarterValues,
1908
+ defaultWidth: "wide",
1909
+ argumentCallback: (quarter) => quarter - 1
1910
+ }),
1911
+ month: buildLocalizeFn({
1912
+ values: monthValues,
1913
+ defaultWidth: "wide"
1914
+ }),
1915
+ day: buildLocalizeFn({
1916
+ values: dayValues,
1917
+ defaultWidth: "wide"
1918
+ }),
1919
+ dayPeriod: buildLocalizeFn({
1920
+ values: dayPeriodValues,
1921
+ defaultWidth: "wide",
1922
+ formattingValues: formattingDayPeriodValues,
1923
+ defaultFormattingWidth: "wide"
1924
+ })
1925
+ };
1926
+
1927
+ // node_modules/date-fns/locale/_lib/buildMatchFn.js
1928
+ function buildMatchFn(args) {
1929
+ return (string, options = {}) => {
1930
+ const width = options.width;
1931
+ const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
1932
+ const matchResult = string.match(matchPattern);
1933
+ if (!matchResult) {
1934
+ return null;
1935
+ }
1936
+ const matchedString = matchResult[0];
1937
+ const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
1938
+ const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
1939
+ // [TODO] -- I challenge you to fix the type
1940
+ findKey(parsePatterns, (pattern) => pattern.test(matchedString))
1941
+ );
1942
+ let value;
1943
+ value = args.valueCallback ? args.valueCallback(key) : key;
1944
+ value = options.valueCallback ? (
1945
+ // [TODO] -- I challenge you to fix the type
1946
+ options.valueCallback(value)
1947
+ ) : value;
1948
+ const rest = string.slice(matchedString.length);
1949
+ return { value, rest };
1950
+ };
1951
+ }
1952
+ function findKey(object, predicate) {
1953
+ for (const key in object) {
1954
+ if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
1955
+ return key;
1956
+ }
1957
+ }
1958
+ return void 0;
1959
+ }
1960
+ function findIndex(array, predicate) {
1961
+ for (let key = 0; key < array.length; key++) {
1962
+ if (predicate(array[key])) {
1963
+ return key;
1964
+ }
1965
+ }
1966
+ return void 0;
1967
+ }
1968
+
1969
+ // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
1970
+ function buildMatchPatternFn(args) {
1971
+ return (string, options = {}) => {
1972
+ const matchResult = string.match(args.matchPattern);
1973
+ if (!matchResult) return null;
1974
+ const matchedString = matchResult[0];
1975
+ const parseResult = string.match(args.parsePattern);
1976
+ if (!parseResult) return null;
1977
+ let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
1978
+ value = options.valueCallback ? options.valueCallback(value) : value;
1979
+ const rest = string.slice(matchedString.length);
1980
+ return { value, rest };
1981
+ };
1982
+ }
1983
+
1984
+ // node_modules/date-fns/locale/en-US/_lib/match.js
1985
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
1986
+ var parseOrdinalNumberPattern = /\d+/i;
1987
+ var matchEraPatterns = {
1988
+ narrow: /^(b|a)/i,
1989
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1990
+ wide: /^(before christ|before common era|anno domini|common era)/i
1991
+ };
1992
+ var parseEraPatterns = {
1993
+ any: [/^b/i, /^(a|c)/i]
1994
+ };
1995
+ var matchQuarterPatterns = {
1996
+ narrow: /^[1234]/i,
1997
+ abbreviated: /^q[1234]/i,
1998
+ wide: /^[1234](th|st|nd|rd)? quarter/i
1999
+ };
2000
+ var parseQuarterPatterns = {
2001
+ any: [/1/i, /2/i, /3/i, /4/i]
2002
+ };
2003
+ var matchMonthPatterns = {
2004
+ narrow: /^[jfmasond]/i,
2005
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
2006
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
2007
+ };
2008
+ var parseMonthPatterns = {
2009
+ narrow: [
2010
+ /^j/i,
2011
+ /^f/i,
2012
+ /^m/i,
2013
+ /^a/i,
2014
+ /^m/i,
2015
+ /^j/i,
2016
+ /^j/i,
2017
+ /^a/i,
2018
+ /^s/i,
2019
+ /^o/i,
2020
+ /^n/i,
2021
+ /^d/i
2022
+ ],
2023
+ any: [
2024
+ /^ja/i,
2025
+ /^f/i,
2026
+ /^mar/i,
2027
+ /^ap/i,
2028
+ /^may/i,
2029
+ /^jun/i,
2030
+ /^jul/i,
2031
+ /^au/i,
2032
+ /^s/i,
2033
+ /^o/i,
2034
+ /^n/i,
2035
+ /^d/i
2036
+ ]
2037
+ };
2038
+ var matchDayPatterns = {
2039
+ narrow: /^[smtwf]/i,
2040
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
2041
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
2042
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
2043
+ };
2044
+ var parseDayPatterns = {
2045
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
2046
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
2047
+ };
2048
+ var matchDayPeriodPatterns = {
2049
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
2050
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
2051
+ };
2052
+ var parseDayPeriodPatterns = {
2053
+ any: {
2054
+ am: /^a/i,
2055
+ pm: /^p/i,
2056
+ midnight: /^mi/i,
2057
+ noon: /^no/i,
2058
+ morning: /morning/i,
2059
+ afternoon: /afternoon/i,
2060
+ evening: /evening/i,
2061
+ night: /night/i
2062
+ }
2063
+ };
2064
+ var match = {
2065
+ ordinalNumber: buildMatchPatternFn({
2066
+ matchPattern: matchOrdinalNumberPattern,
2067
+ parsePattern: parseOrdinalNumberPattern,
2068
+ valueCallback: (value) => parseInt(value, 10)
2069
+ }),
2070
+ era: buildMatchFn({
2071
+ matchPatterns: matchEraPatterns,
2072
+ defaultMatchWidth: "wide",
2073
+ parsePatterns: parseEraPatterns,
2074
+ defaultParseWidth: "any"
2075
+ }),
2076
+ quarter: buildMatchFn({
2077
+ matchPatterns: matchQuarterPatterns,
2078
+ defaultMatchWidth: "wide",
2079
+ parsePatterns: parseQuarterPatterns,
2080
+ defaultParseWidth: "any",
2081
+ valueCallback: (index) => index + 1
2082
+ }),
2083
+ month: buildMatchFn({
2084
+ matchPatterns: matchMonthPatterns,
2085
+ defaultMatchWidth: "wide",
2086
+ parsePatterns: parseMonthPatterns,
2087
+ defaultParseWidth: "any"
2088
+ }),
2089
+ day: buildMatchFn({
2090
+ matchPatterns: matchDayPatterns,
2091
+ defaultMatchWidth: "wide",
2092
+ parsePatterns: parseDayPatterns,
2093
+ defaultParseWidth: "any"
2094
+ }),
2095
+ dayPeriod: buildMatchFn({
2096
+ matchPatterns: matchDayPeriodPatterns,
2097
+ defaultMatchWidth: "any",
2098
+ parsePatterns: parseDayPeriodPatterns,
2099
+ defaultParseWidth: "any"
2100
+ })
2101
+ };
2102
+
2103
+ // node_modules/date-fns/locale/en-US.js
2104
+ var enUS = {
2105
+ code: "en-US",
2106
+ formatDistance,
2107
+ formatLong,
2108
+ formatRelative,
2109
+ localize,
2110
+ match,
2111
+ options: {
2112
+ weekStartsOn: 0,
2113
+ firstWeekContainsDate: 1
2114
+ }
2115
+ };
2116
+
2117
+ // node_modules/date-fns/getDayOfYear.js
2118
+ function getDayOfYear(date, options) {
2119
+ const _date = toDate(date, options?.in);
2120
+ const diff = differenceInCalendarDays(_date, startOfYear(_date));
2121
+ const dayOfYear = diff + 1;
2122
+ return dayOfYear;
2123
+ }
2124
+
2125
+ // node_modules/date-fns/getISOWeek.js
2126
+ function getISOWeek(date, options) {
2127
+ const _date = toDate(date, options?.in);
2128
+ const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
2129
+ return Math.round(diff / millisecondsInWeek) + 1;
2130
+ }
2131
+
2132
+ // node_modules/date-fns/getWeekYear.js
2133
+ function getWeekYear(date, options) {
2134
+ const _date = toDate(date, options?.in);
2135
+ const year = _date.getFullYear();
2136
+ const defaultOptions2 = getDefaultOptions();
2137
+ const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
2138
+ const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
2139
+ firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
2140
+ firstWeekOfNextYear.setHours(0, 0, 0, 0);
2141
+ const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
2142
+ const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
2143
+ firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
2144
+ firstWeekOfThisYear.setHours(0, 0, 0, 0);
2145
+ const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
2146
+ if (+_date >= +startOfNextYear) {
2147
+ return year + 1;
2148
+ } else if (+_date >= +startOfThisYear) {
2149
+ return year;
2150
+ } else {
2151
+ return year - 1;
2152
+ }
2153
+ }
2154
+
2155
+ // node_modules/date-fns/startOfWeekYear.js
2156
+ function startOfWeekYear(date, options) {
2157
+ const defaultOptions2 = getDefaultOptions();
2158
+ const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
2159
+ const year = getWeekYear(date, options);
2160
+ const firstWeek = constructFrom(options?.in || date, 0);
2161
+ firstWeek.setFullYear(year, 0, firstWeekContainsDate);
2162
+ firstWeek.setHours(0, 0, 0, 0);
2163
+ const _date = startOfWeek(firstWeek, options);
2164
+ return _date;
2165
+ }
2166
+
2167
+ // node_modules/date-fns/getWeek.js
2168
+ function getWeek(date, options) {
2169
+ const _date = toDate(date, options?.in);
2170
+ const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
2171
+ return Math.round(diff / millisecondsInWeek) + 1;
2172
+ }
2173
+
2174
+ // node_modules/date-fns/_lib/addLeadingZeros.js
2175
+ function addLeadingZeros(number, targetLength) {
2176
+ const sign = number < 0 ? "-" : "";
2177
+ const output = Math.abs(number).toString().padStart(targetLength, "0");
2178
+ return sign + output;
2179
+ }
2180
+
2181
+ // node_modules/date-fns/_lib/format/lightFormatters.js
2182
+ var lightFormatters = {
2183
+ // Year
2184
+ y(date, token) {
2185
+ const signedYear = date.getFullYear();
2186
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
2187
+ return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
2188
+ },
2189
+ // Month
2190
+ M(date, token) {
2191
+ const month = date.getMonth();
2192
+ return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
2193
+ },
2194
+ // Day of the month
2195
+ d(date, token) {
2196
+ return addLeadingZeros(date.getDate(), token.length);
2197
+ },
2198
+ // AM or PM
2199
+ a(date, token) {
2200
+ const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
2201
+ switch (token) {
2202
+ case "a":
2203
+ case "aa":
2204
+ return dayPeriodEnumValue.toUpperCase();
2205
+ case "aaa":
2206
+ return dayPeriodEnumValue;
2207
+ case "aaaaa":
2208
+ return dayPeriodEnumValue[0];
2209
+ case "aaaa":
2210
+ default:
2211
+ return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
2212
+ }
2213
+ },
2214
+ // Hour [1-12]
2215
+ h(date, token) {
2216
+ return addLeadingZeros(date.getHours() % 12 || 12, token.length);
2217
+ },
2218
+ // Hour [0-23]
2219
+ H(date, token) {
2220
+ return addLeadingZeros(date.getHours(), token.length);
2221
+ },
2222
+ // Minute
2223
+ m(date, token) {
2224
+ return addLeadingZeros(date.getMinutes(), token.length);
2225
+ },
2226
+ // Second
2227
+ s(date, token) {
2228
+ return addLeadingZeros(date.getSeconds(), token.length);
2229
+ },
2230
+ // Fraction of second
2231
+ S(date, token) {
2232
+ const numberOfDigits = token.length;
2233
+ const milliseconds = date.getMilliseconds();
2234
+ const fractionalSeconds = Math.trunc(
2235
+ milliseconds * Math.pow(10, numberOfDigits - 3)
2236
+ );
2237
+ return addLeadingZeros(fractionalSeconds, token.length);
2238
+ }
2239
+ };
2240
+
2241
+ // node_modules/date-fns/_lib/format/formatters.js
2242
+ var dayPeriodEnum = {
2243
+ midnight: "midnight",
2244
+ noon: "noon",
2245
+ morning: "morning",
2246
+ afternoon: "afternoon",
2247
+ evening: "evening",
2248
+ night: "night"
2249
+ };
2250
+ var formatters = {
2251
+ // Era
2252
+ G: function(date, token, localize2) {
2253
+ const era = date.getFullYear() > 0 ? 1 : 0;
2254
+ switch (token) {
2255
+ // AD, BC
2256
+ case "G":
2257
+ case "GG":
2258
+ case "GGG":
2259
+ return localize2.era(era, { width: "abbreviated" });
2260
+ // A, B
2261
+ case "GGGGG":
2262
+ return localize2.era(era, { width: "narrow" });
2263
+ // Anno Domini, Before Christ
2264
+ case "GGGG":
2265
+ default:
2266
+ return localize2.era(era, { width: "wide" });
2267
+ }
2268
+ },
2269
+ // Year
2270
+ y: function(date, token, localize2) {
2271
+ if (token === "yo") {
2272
+ const signedYear = date.getFullYear();
2273
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
2274
+ return localize2.ordinalNumber(year, { unit: "year" });
2275
+ }
2276
+ return lightFormatters.y(date, token);
2277
+ },
2278
+ // Local week-numbering year
2279
+ Y: function(date, token, localize2, options) {
2280
+ const signedWeekYear = getWeekYear(date, options);
2281
+ const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
2282
+ if (token === "YY") {
2283
+ const twoDigitYear = weekYear % 100;
2284
+ return addLeadingZeros(twoDigitYear, 2);
2285
+ }
2286
+ if (token === "Yo") {
2287
+ return localize2.ordinalNumber(weekYear, { unit: "year" });
2288
+ }
2289
+ return addLeadingZeros(weekYear, token.length);
2290
+ },
2291
+ // ISO week-numbering year
2292
+ R: function(date, token) {
2293
+ const isoWeekYear = getISOWeekYear(date);
2294
+ return addLeadingZeros(isoWeekYear, token.length);
2295
+ },
2296
+ // Extended year. This is a single number designating the year of this calendar system.
2297
+ // The main difference between `y` and `u` localizers are B.C. years:
2298
+ // | Year | `y` | `u` |
2299
+ // |------|-----|-----|
2300
+ // | AC 1 | 1 | 1 |
2301
+ // | BC 1 | 1 | 0 |
2302
+ // | BC 2 | 2 | -1 |
2303
+ // Also `yy` always returns the last two digits of a year,
2304
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
2305
+ u: function(date, token) {
2306
+ const year = date.getFullYear();
2307
+ return addLeadingZeros(year, token.length);
2308
+ },
2309
+ // Quarter
2310
+ Q: function(date, token, localize2) {
2311
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
2312
+ switch (token) {
2313
+ // 1, 2, 3, 4
2314
+ case "Q":
2315
+ return String(quarter);
2316
+ // 01, 02, 03, 04
2317
+ case "QQ":
2318
+ return addLeadingZeros(quarter, 2);
2319
+ // 1st, 2nd, 3rd, 4th
2320
+ case "Qo":
2321
+ return localize2.ordinalNumber(quarter, { unit: "quarter" });
2322
+ // Q1, Q2, Q3, Q4
2323
+ case "QQQ":
2324
+ return localize2.quarter(quarter, {
2325
+ width: "abbreviated",
2326
+ context: "formatting"
2327
+ });
2328
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2329
+ case "QQQQQ":
2330
+ return localize2.quarter(quarter, {
2331
+ width: "narrow",
2332
+ context: "formatting"
2333
+ });
2334
+ // 1st quarter, 2nd quarter, ...
2335
+ case "QQQQ":
2336
+ default:
2337
+ return localize2.quarter(quarter, {
2338
+ width: "wide",
2339
+ context: "formatting"
2340
+ });
2341
+ }
2342
+ },
2343
+ // Stand-alone quarter
2344
+ q: function(date, token, localize2) {
2345
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
2346
+ switch (token) {
2347
+ // 1, 2, 3, 4
2348
+ case "q":
2349
+ return String(quarter);
2350
+ // 01, 02, 03, 04
2351
+ case "qq":
2352
+ return addLeadingZeros(quarter, 2);
2353
+ // 1st, 2nd, 3rd, 4th
2354
+ case "qo":
2355
+ return localize2.ordinalNumber(quarter, { unit: "quarter" });
2356
+ // Q1, Q2, Q3, Q4
2357
+ case "qqq":
2358
+ return localize2.quarter(quarter, {
2359
+ width: "abbreviated",
2360
+ context: "standalone"
2361
+ });
2362
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2363
+ case "qqqqq":
2364
+ return localize2.quarter(quarter, {
2365
+ width: "narrow",
2366
+ context: "standalone"
2367
+ });
2368
+ // 1st quarter, 2nd quarter, ...
2369
+ case "qqqq":
2370
+ default:
2371
+ return localize2.quarter(quarter, {
2372
+ width: "wide",
2373
+ context: "standalone"
2374
+ });
2375
+ }
2376
+ },
2377
+ // Month
2378
+ M: function(date, token, localize2) {
2379
+ const month = date.getMonth();
2380
+ switch (token) {
2381
+ case "M":
2382
+ case "MM":
2383
+ return lightFormatters.M(date, token);
2384
+ // 1st, 2nd, ..., 12th
2385
+ case "Mo":
2386
+ return localize2.ordinalNumber(month + 1, { unit: "month" });
2387
+ // Jan, Feb, ..., Dec
2388
+ case "MMM":
2389
+ return localize2.month(month, {
2390
+ width: "abbreviated",
2391
+ context: "formatting"
2392
+ });
2393
+ // J, F, ..., D
2394
+ case "MMMMM":
2395
+ return localize2.month(month, {
2396
+ width: "narrow",
2397
+ context: "formatting"
2398
+ });
2399
+ // January, February, ..., December
2400
+ case "MMMM":
2401
+ default:
2402
+ return localize2.month(month, { width: "wide", context: "formatting" });
2403
+ }
2404
+ },
2405
+ // Stand-alone month
2406
+ L: function(date, token, localize2) {
2407
+ const month = date.getMonth();
2408
+ switch (token) {
2409
+ // 1, 2, ..., 12
2410
+ case "L":
2411
+ return String(month + 1);
2412
+ // 01, 02, ..., 12
2413
+ case "LL":
2414
+ return addLeadingZeros(month + 1, 2);
2415
+ // 1st, 2nd, ..., 12th
2416
+ case "Lo":
2417
+ return localize2.ordinalNumber(month + 1, { unit: "month" });
2418
+ // Jan, Feb, ..., Dec
2419
+ case "LLL":
2420
+ return localize2.month(month, {
2421
+ width: "abbreviated",
2422
+ context: "standalone"
2423
+ });
2424
+ // J, F, ..., D
2425
+ case "LLLLL":
2426
+ return localize2.month(month, {
2427
+ width: "narrow",
2428
+ context: "standalone"
2429
+ });
2430
+ // January, February, ..., December
2431
+ case "LLLL":
2432
+ default:
2433
+ return localize2.month(month, { width: "wide", context: "standalone" });
2434
+ }
2435
+ },
2436
+ // Local week of year
2437
+ w: function(date, token, localize2, options) {
2438
+ const week = getWeek(date, options);
2439
+ if (token === "wo") {
2440
+ return localize2.ordinalNumber(week, { unit: "week" });
2441
+ }
2442
+ return addLeadingZeros(week, token.length);
2443
+ },
2444
+ // ISO week of year
2445
+ I: function(date, token, localize2) {
2446
+ const isoWeek = getISOWeek(date);
2447
+ if (token === "Io") {
2448
+ return localize2.ordinalNumber(isoWeek, { unit: "week" });
2449
+ }
2450
+ return addLeadingZeros(isoWeek, token.length);
2451
+ },
2452
+ // Day of the month
2453
+ d: function(date, token, localize2) {
2454
+ if (token === "do") {
2455
+ return localize2.ordinalNumber(date.getDate(), { unit: "date" });
2456
+ }
2457
+ return lightFormatters.d(date, token);
2458
+ },
2459
+ // Day of year
2460
+ D: function(date, token, localize2) {
2461
+ const dayOfYear = getDayOfYear(date);
2462
+ if (token === "Do") {
2463
+ return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
2464
+ }
2465
+ return addLeadingZeros(dayOfYear, token.length);
2466
+ },
2467
+ // Day of week
2468
+ E: function(date, token, localize2) {
2469
+ const dayOfWeek = date.getDay();
2470
+ switch (token) {
2471
+ // Tue
2472
+ case "E":
2473
+ case "EE":
2474
+ case "EEE":
2475
+ return localize2.day(dayOfWeek, {
2476
+ width: "abbreviated",
2477
+ context: "formatting"
2478
+ });
2479
+ // T
2480
+ case "EEEEE":
2481
+ return localize2.day(dayOfWeek, {
2482
+ width: "narrow",
2483
+ context: "formatting"
2484
+ });
2485
+ // Tu
2486
+ case "EEEEEE":
2487
+ return localize2.day(dayOfWeek, {
2488
+ width: "short",
2489
+ context: "formatting"
2490
+ });
2491
+ // Tuesday
2492
+ case "EEEE":
2493
+ default:
2494
+ return localize2.day(dayOfWeek, {
2495
+ width: "wide",
2496
+ context: "formatting"
2497
+ });
2498
+ }
2499
+ },
2500
+ // Local day of week
2501
+ e: function(date, token, localize2, options) {
2502
+ const dayOfWeek = date.getDay();
2503
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2504
+ switch (token) {
2505
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
2506
+ case "e":
2507
+ return String(localDayOfWeek);
2508
+ // Padded numerical value
2509
+ case "ee":
2510
+ return addLeadingZeros(localDayOfWeek, 2);
2511
+ // 1st, 2nd, ..., 7th
2512
+ case "eo":
2513
+ return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
2514
+ case "eee":
2515
+ return localize2.day(dayOfWeek, {
2516
+ width: "abbreviated",
2517
+ context: "formatting"
2518
+ });
2519
+ // T
2520
+ case "eeeee":
2521
+ return localize2.day(dayOfWeek, {
2522
+ width: "narrow",
2523
+ context: "formatting"
2524
+ });
2525
+ // Tu
2526
+ case "eeeeee":
2527
+ return localize2.day(dayOfWeek, {
2528
+ width: "short",
2529
+ context: "formatting"
2530
+ });
2531
+ // Tuesday
2532
+ case "eeee":
2533
+ default:
2534
+ return localize2.day(dayOfWeek, {
2535
+ width: "wide",
2536
+ context: "formatting"
2537
+ });
2538
+ }
2539
+ },
2540
+ // Stand-alone local day of week
2541
+ c: function(date, token, localize2, options) {
2542
+ const dayOfWeek = date.getDay();
2543
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2544
+ switch (token) {
2545
+ // Numerical value (same as in `e`)
2546
+ case "c":
2547
+ return String(localDayOfWeek);
2548
+ // Padded numerical value
2549
+ case "cc":
2550
+ return addLeadingZeros(localDayOfWeek, token.length);
2551
+ // 1st, 2nd, ..., 7th
2552
+ case "co":
2553
+ return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
2554
+ case "ccc":
2555
+ return localize2.day(dayOfWeek, {
2556
+ width: "abbreviated",
2557
+ context: "standalone"
2558
+ });
2559
+ // T
2560
+ case "ccccc":
2561
+ return localize2.day(dayOfWeek, {
2562
+ width: "narrow",
2563
+ context: "standalone"
2564
+ });
2565
+ // Tu
2566
+ case "cccccc":
2567
+ return localize2.day(dayOfWeek, {
2568
+ width: "short",
2569
+ context: "standalone"
2570
+ });
2571
+ // Tuesday
2572
+ case "cccc":
2573
+ default:
2574
+ return localize2.day(dayOfWeek, {
2575
+ width: "wide",
2576
+ context: "standalone"
2577
+ });
2578
+ }
2579
+ },
2580
+ // ISO day of week
2581
+ i: function(date, token, localize2) {
2582
+ const dayOfWeek = date.getDay();
2583
+ const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
2584
+ switch (token) {
2585
+ // 2
2586
+ case "i":
2587
+ return String(isoDayOfWeek);
2588
+ // 02
2589
+ case "ii":
2590
+ return addLeadingZeros(isoDayOfWeek, token.length);
2591
+ // 2nd
2592
+ case "io":
2593
+ return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
2594
+ // Tue
2595
+ case "iii":
2596
+ return localize2.day(dayOfWeek, {
2597
+ width: "abbreviated",
2598
+ context: "formatting"
2599
+ });
2600
+ // T
2601
+ case "iiiii":
2602
+ return localize2.day(dayOfWeek, {
2603
+ width: "narrow",
2604
+ context: "formatting"
2605
+ });
2606
+ // Tu
2607
+ case "iiiiii":
2608
+ return localize2.day(dayOfWeek, {
2609
+ width: "short",
2610
+ context: "formatting"
2611
+ });
2612
+ // Tuesday
2613
+ case "iiii":
2614
+ default:
2615
+ return localize2.day(dayOfWeek, {
2616
+ width: "wide",
2617
+ context: "formatting"
2618
+ });
2619
+ }
2620
+ },
2621
+ // AM or PM
2622
+ a: function(date, token, localize2) {
2623
+ const hours = date.getHours();
2624
+ const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
2625
+ switch (token) {
2626
+ case "a":
2627
+ case "aa":
2628
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2629
+ width: "abbreviated",
2630
+ context: "formatting"
2631
+ });
2632
+ case "aaa":
2633
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2634
+ width: "abbreviated",
2635
+ context: "formatting"
2636
+ }).toLowerCase();
2637
+ case "aaaaa":
2638
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2639
+ width: "narrow",
2640
+ context: "formatting"
2641
+ });
2642
+ case "aaaa":
2643
+ default:
2644
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2645
+ width: "wide",
2646
+ context: "formatting"
2647
+ });
2648
+ }
2649
+ },
2650
+ // AM, PM, midnight, noon
2651
+ b: function(date, token, localize2) {
2652
+ const hours = date.getHours();
2653
+ let dayPeriodEnumValue;
2654
+ if (hours === 12) {
2655
+ dayPeriodEnumValue = dayPeriodEnum.noon;
2656
+ } else if (hours === 0) {
2657
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
2658
+ } else {
2659
+ dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
2660
+ }
2661
+ switch (token) {
2662
+ case "b":
2663
+ case "bb":
2664
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2665
+ width: "abbreviated",
2666
+ context: "formatting"
2667
+ });
2668
+ case "bbb":
2669
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2670
+ width: "abbreviated",
2671
+ context: "formatting"
2672
+ }).toLowerCase();
2673
+ case "bbbbb":
2674
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2675
+ width: "narrow",
2676
+ context: "formatting"
2677
+ });
2678
+ case "bbbb":
2679
+ default:
2680
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2681
+ width: "wide",
2682
+ context: "formatting"
2683
+ });
2684
+ }
2685
+ },
2686
+ // in the morning, in the afternoon, in the evening, at night
2687
+ B: function(date, token, localize2) {
2688
+ const hours = date.getHours();
2689
+ let dayPeriodEnumValue;
2690
+ if (hours >= 17) {
2691
+ dayPeriodEnumValue = dayPeriodEnum.evening;
2692
+ } else if (hours >= 12) {
2693
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
2694
+ } else if (hours >= 4) {
2695
+ dayPeriodEnumValue = dayPeriodEnum.morning;
2696
+ } else {
2697
+ dayPeriodEnumValue = dayPeriodEnum.night;
2698
+ }
2699
+ switch (token) {
2700
+ case "B":
2701
+ case "BB":
2702
+ case "BBB":
2703
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2704
+ width: "abbreviated",
2705
+ context: "formatting"
2706
+ });
2707
+ case "BBBBB":
2708
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2709
+ width: "narrow",
2710
+ context: "formatting"
2711
+ });
2712
+ case "BBBB":
2713
+ default:
2714
+ return localize2.dayPeriod(dayPeriodEnumValue, {
2715
+ width: "wide",
2716
+ context: "formatting"
2717
+ });
2718
+ }
2719
+ },
2720
+ // Hour [1-12]
2721
+ h: function(date, token, localize2) {
2722
+ if (token === "ho") {
2723
+ let hours = date.getHours() % 12;
2724
+ if (hours === 0) hours = 12;
2725
+ return localize2.ordinalNumber(hours, { unit: "hour" });
2726
+ }
2727
+ return lightFormatters.h(date, token);
2728
+ },
2729
+ // Hour [0-23]
2730
+ H: function(date, token, localize2) {
2731
+ if (token === "Ho") {
2732
+ return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
2733
+ }
2734
+ return lightFormatters.H(date, token);
2735
+ },
2736
+ // Hour [0-11]
2737
+ K: function(date, token, localize2) {
2738
+ const hours = date.getHours() % 12;
2739
+ if (token === "Ko") {
2740
+ return localize2.ordinalNumber(hours, { unit: "hour" });
2741
+ }
2742
+ return addLeadingZeros(hours, token.length);
2743
+ },
2744
+ // Hour [1-24]
2745
+ k: function(date, token, localize2) {
2746
+ let hours = date.getHours();
2747
+ if (hours === 0) hours = 24;
2748
+ if (token === "ko") {
2749
+ return localize2.ordinalNumber(hours, { unit: "hour" });
2750
+ }
2751
+ return addLeadingZeros(hours, token.length);
2752
+ },
2753
+ // Minute
2754
+ m: function(date, token, localize2) {
2755
+ if (token === "mo") {
2756
+ return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
2757
+ }
2758
+ return lightFormatters.m(date, token);
2759
+ },
2760
+ // Second
2761
+ s: function(date, token, localize2) {
2762
+ if (token === "so") {
2763
+ return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
2764
+ }
2765
+ return lightFormatters.s(date, token);
2766
+ },
2767
+ // Fraction of second
2768
+ S: function(date, token) {
2769
+ return lightFormatters.S(date, token);
2770
+ },
2771
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
2772
+ X: function(date, token, _localize) {
2773
+ const timezoneOffset = date.getTimezoneOffset();
2774
+ if (timezoneOffset === 0) {
2775
+ return "Z";
2776
+ }
2777
+ switch (token) {
2778
+ // Hours and optional minutes
2779
+ case "X":
2780
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
2781
+ // Hours, minutes and optional seconds without `:` delimiter
2782
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2783
+ // so this token always has the same output as `XX`
2784
+ case "XXXX":
2785
+ case "XX":
2786
+ return formatTimezone(timezoneOffset);
2787
+ // Hours, minutes and optional seconds with `:` delimiter
2788
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2789
+ // so this token always has the same output as `XXX`
2790
+ case "XXXXX":
2791
+ case "XXX":
2792
+ // Hours and minutes with `:` delimiter
2793
+ default:
2794
+ return formatTimezone(timezoneOffset, ":");
2795
+ }
2796
+ },
2797
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
2798
+ x: function(date, token, _localize) {
2799
+ const timezoneOffset = date.getTimezoneOffset();
2800
+ switch (token) {
2801
+ // Hours and optional minutes
2802
+ case "x":
2803
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
2804
+ // Hours, minutes and optional seconds without `:` delimiter
2805
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2806
+ // so this token always has the same output as `xx`
2807
+ case "xxxx":
2808
+ case "xx":
2809
+ return formatTimezone(timezoneOffset);
2810
+ // Hours, minutes and optional seconds with `:` delimiter
2811
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2812
+ // so this token always has the same output as `xxx`
2813
+ case "xxxxx":
2814
+ case "xxx":
2815
+ // Hours and minutes with `:` delimiter
2816
+ default:
2817
+ return formatTimezone(timezoneOffset, ":");
2818
+ }
2819
+ },
2820
+ // Timezone (GMT)
2821
+ O: function(date, token, _localize) {
2822
+ const timezoneOffset = date.getTimezoneOffset();
2823
+ switch (token) {
2824
+ // Short
2825
+ case "O":
2826
+ case "OO":
2827
+ case "OOO":
2828
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2829
+ // Long
2830
+ case "OOOO":
2831
+ default:
2832
+ return "GMT" + formatTimezone(timezoneOffset, ":");
2833
+ }
2834
+ },
2835
+ // Timezone (specific non-location)
2836
+ z: function(date, token, _localize) {
2837
+ const timezoneOffset = date.getTimezoneOffset();
2838
+ switch (token) {
2839
+ // Short
2840
+ case "z":
2841
+ case "zz":
2842
+ case "zzz":
2843
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2844
+ // Long
2845
+ case "zzzz":
2846
+ default:
2847
+ return "GMT" + formatTimezone(timezoneOffset, ":");
2848
+ }
2849
+ },
2850
+ // Seconds timestamp
2851
+ t: function(date, token, _localize) {
2852
+ const timestamp = Math.trunc(+date / 1e3);
2853
+ return addLeadingZeros(timestamp, token.length);
2854
+ },
2855
+ // Milliseconds timestamp
2856
+ T: function(date, token, _localize) {
2857
+ return addLeadingZeros(+date, token.length);
2858
+ }
2859
+ };
2860
+ function formatTimezoneShort(offset, delimiter = "") {
2861
+ const sign = offset > 0 ? "-" : "+";
2862
+ const absOffset = Math.abs(offset);
2863
+ const hours = Math.trunc(absOffset / 60);
2864
+ const minutes = absOffset % 60;
2865
+ if (minutes === 0) {
2866
+ return sign + String(hours);
2867
+ }
2868
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
2869
+ }
2870
+ function formatTimezoneWithOptionalMinutes(offset, delimiter) {
2871
+ if (offset % 60 === 0) {
2872
+ const sign = offset > 0 ? "-" : "+";
2873
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
2874
+ }
2875
+ return formatTimezone(offset, delimiter);
2876
+ }
2877
+ function formatTimezone(offset, delimiter = "") {
2878
+ const sign = offset > 0 ? "-" : "+";
2879
+ const absOffset = Math.abs(offset);
2880
+ const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
2881
+ const minutes = addLeadingZeros(absOffset % 60, 2);
2882
+ return sign + hours + delimiter + minutes;
2883
+ }
2884
+
2885
+ // node_modules/date-fns/_lib/format/longFormatters.js
2886
+ var dateLongFormatter = (pattern, formatLong2) => {
2887
+ switch (pattern) {
2888
+ case "P":
2889
+ return formatLong2.date({ width: "short" });
2890
+ case "PP":
2891
+ return formatLong2.date({ width: "medium" });
2892
+ case "PPP":
2893
+ return formatLong2.date({ width: "long" });
2894
+ case "PPPP":
2895
+ default:
2896
+ return formatLong2.date({ width: "full" });
2897
+ }
2898
+ };
2899
+ var timeLongFormatter = (pattern, formatLong2) => {
2900
+ switch (pattern) {
2901
+ case "p":
2902
+ return formatLong2.time({ width: "short" });
2903
+ case "pp":
2904
+ return formatLong2.time({ width: "medium" });
2905
+ case "ppp":
2906
+ return formatLong2.time({ width: "long" });
2907
+ case "pppp":
2908
+ default:
2909
+ return formatLong2.time({ width: "full" });
2910
+ }
2911
+ };
2912
+ var dateTimeLongFormatter = (pattern, formatLong2) => {
2913
+ const matchResult = pattern.match(/(P+)(p+)?/) || [];
2914
+ const datePattern = matchResult[1];
2915
+ const timePattern = matchResult[2];
2916
+ if (!timePattern) {
2917
+ return dateLongFormatter(pattern, formatLong2);
2918
+ }
2919
+ let dateTimeFormat;
2920
+ switch (datePattern) {
2921
+ case "P":
2922
+ dateTimeFormat = formatLong2.dateTime({ width: "short" });
2923
+ break;
2924
+ case "PP":
2925
+ dateTimeFormat = formatLong2.dateTime({ width: "medium" });
2926
+ break;
2927
+ case "PPP":
2928
+ dateTimeFormat = formatLong2.dateTime({ width: "long" });
2929
+ break;
2930
+ case "PPPP":
2931
+ default:
2932
+ dateTimeFormat = formatLong2.dateTime({ width: "full" });
2933
+ break;
2934
+ }
2935
+ return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
2936
+ };
2937
+ var longFormatters = {
2938
+ p: timeLongFormatter,
2939
+ P: dateTimeLongFormatter
2940
+ };
2941
+
2942
+ // node_modules/date-fns/_lib/protectedTokens.js
2943
+ var dayOfYearTokenRE = /^D+$/;
2944
+ var weekYearTokenRE = /^Y+$/;
2945
+ var throwTokens = ["D", "DD", "YY", "YYYY"];
2946
+ function isProtectedDayOfYearToken(token) {
2947
+ return dayOfYearTokenRE.test(token);
2948
+ }
2949
+ function isProtectedWeekYearToken(token) {
2950
+ return weekYearTokenRE.test(token);
2951
+ }
2952
+ function warnOrThrowProtectedError(token, format2, input) {
2953
+ const _message = message(token, format2, input);
2954
+ console.warn(_message);
2955
+ if (throwTokens.includes(token)) throw new RangeError(_message);
2956
+ }
2957
+ function message(token, format2, input) {
2958
+ const subject = token[0] === "Y" ? "years" : "days of the month";
2959
+ return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
2960
+ }
2961
+
2962
+ // node_modules/date-fns/format.js
2963
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2964
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2965
+ var escapedStringRegExp = /^'([^]*?)'?$/;
2966
+ var doubleQuoteRegExp = /''/g;
2967
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2968
+ function format(date, formatStr, options) {
2969
+ const defaultOptions2 = getDefaultOptions();
2970
+ const locale = defaultOptions2.locale ?? enUS;
2971
+ const firstWeekContainsDate = defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
2972
+ const weekStartsOn = defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
2973
+ const originalDate = toDate(date, options?.in);
2974
+ if (!isValid(originalDate)) {
2975
+ throw new RangeError("Invalid time value");
2976
+ }
2977
+ let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
2978
+ const firstCharacter = substring[0];
2979
+ if (firstCharacter === "p" || firstCharacter === "P") {
2980
+ const longFormatter = longFormatters[firstCharacter];
2981
+ return longFormatter(substring, locale.formatLong);
2982
+ }
2983
+ return substring;
2984
+ }).join("").match(formattingTokensRegExp).map((substring) => {
2985
+ if (substring === "''") {
2986
+ return { isToken: false, value: "'" };
2987
+ }
2988
+ const firstCharacter = substring[0];
2989
+ if (firstCharacter === "'") {
2990
+ return { isToken: false, value: cleanEscapedString(substring) };
2991
+ }
2992
+ if (formatters[firstCharacter]) {
2993
+ return { isToken: true, value: substring };
2994
+ }
2995
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2996
+ throw new RangeError(
2997
+ "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
2998
+ );
2999
+ }
3000
+ return { isToken: false, value: substring };
3001
+ });
3002
+ if (locale.localize.preprocessor) {
3003
+ parts = locale.localize.preprocessor(originalDate, parts);
3004
+ }
3005
+ const formatterOptions = {
3006
+ firstWeekContainsDate,
3007
+ weekStartsOn,
3008
+ locale
3009
+ };
3010
+ return parts.map((part) => {
3011
+ if (!part.isToken) return part.value;
3012
+ const token = part.value;
3013
+ if (isProtectedWeekYearToken(token) || isProtectedDayOfYearToken(token)) {
3014
+ warnOrThrowProtectedError(token, formatStr, String(date));
3015
+ }
3016
+ const formatter = formatters[token[0]];
3017
+ return formatter(originalDate, token, locale.localize, formatterOptions);
3018
+ }).join("");
3019
+ }
3020
+ function cleanEscapedString(input) {
3021
+ const matched = input.match(escapedStringRegExp);
3022
+ if (!matched) {
3023
+ return input;
3024
+ }
3025
+ return matched[1].replace(doubleQuoteRegExp, "'");
3026
+ }
3027
+ var DateInput = class extends BaseInput {
3028
+ render() {
3029
+ const { input, form } = this;
3030
+ return /* @__PURE__ */ jsx(
3031
+ FormField,
3032
+ {
3033
+ control: form.control,
3034
+ name: input.name,
3035
+ render: ({ field }) => {
3036
+ const [date, setDate] = React3.useState(
3037
+ field.value ? new Date(field.value) : void 0
3038
+ );
3039
+ React3.useEffect(() => {
3040
+ if (field.value && !date) {
3041
+ setDate(new Date(field.value));
3042
+ }
3043
+ }, [field.value]);
3044
+ const handleSelect = (selectedDate) => {
3045
+ setDate(selectedDate);
3046
+ field.onChange(selectedDate);
3047
+ };
3048
+ return /* @__PURE__ */ jsxs(FormItem, { children: [
3049
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
3050
+ /* @__PURE__ */ jsxs(Popover, { children: [
3051
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(
3052
+ Button,
3053
+ {
3054
+ variant: "outline",
3055
+ className: cn(
3056
+ "w-full justify-start text-left font-normal",
3057
+ !date && "text-muted-foreground"
3058
+ ),
3059
+ children: [
3060
+ /* @__PURE__ */ jsx(CalendarIcon, {}),
3061
+ date ? format(date, "PPP") : /* @__PURE__ */ jsx("span", { children: input.placeHolder ?? "Fecha" })
3062
+ ]
3063
+ }
3064
+ ) }) }),
3065
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", children: /* @__PURE__ */ jsx(
3066
+ Calendar,
3067
+ {
3068
+ mode: "single",
3069
+ selected: date,
3070
+ onSelect: handleSelect,
3071
+ initialFocus: true
3072
+ }
3073
+ ) })
3074
+ ] }),
3075
+ /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
3076
+ /* @__PURE__ */ jsx(FormMessage, {})
3077
+ ] });
3078
+ }
3079
+ },
3080
+ input.name
3081
+ );
3082
+ }
3083
+ };
3084
+ var GroupedSwitchInput = class extends BaseInput {
3085
+ render() {
3086
+ const { input } = this;
3087
+ return /* @__PURE__ */ jsx(GroupedSwitches, { options: [], input });
3088
+ }
3089
+ };
3090
+ var GroupedSwitches = ({ options, onChange, input }) => {
3091
+ const mockInputOptions = [
3092
+ { id: 1, name: "MOCK OPTION - PERMISO 1", checked: false },
3093
+ { id: 2, name: "MOCK OPTION - PERMISO 2", checked: true },
3094
+ { id: 3, name: "MOCK OPTION - PERMISO 3", checked: false },
3095
+ { id: 4, name: "MOCK OPTION - PERMISO 4", checked: false }
3096
+ ];
3097
+ const [switches, setSwitches] = useState(options.length == 0 ? mockInputOptions : options);
3098
+ const [allChecked, setAllChecked] = useState(false);
3099
+ const handleMainToggle = (checked) => {
3100
+ const updated = switches.map((opt) => ({ ...opt, checked }));
3101
+ setSwitches(updated);
3102
+ setAllChecked(checked);
3103
+ onChange?.(updated.filter((opt) => opt.checked));
3104
+ };
3105
+ const handleChildToggle = (option, checked) => {
3106
+ const updated = switches.map(
3107
+ (opt) => opt.id === option.id ? { ...opt, checked } : opt
3108
+ );
3109
+ setSwitches(updated);
3110
+ setAllChecked(updated.every((opt) => opt.checked));
3111
+ onChange?.(updated.filter((opt) => opt.checked));
3112
+ };
3113
+ return /* @__PURE__ */ jsxs("div", { className: `space-y-4 p-4 border-2 rounded-xl ${allChecked ? "bg-green-500/5 border-green-400/10" : "bg-black/5"}`, children: [
3114
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b pb-2", children: [
3115
+ /* @__PURE__ */ jsx("div", { children: input.name }),
3116
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-2", children: [
3117
+ /* @__PURE__ */ jsx(Label, { htmlFor: "main", children: "Seleccionar todo" }),
3118
+ /* @__PURE__ */ jsx(Switch, { id: "main", checked: allChecked, onCheckedChange: handleMainToggle })
3119
+ ] })
3120
+ ] }),
3121
+ switches.map((opt, index) => /* @__PURE__ */ jsxs("div", { className: `p-2 rounded-lg flex flex-row w-full items-center justify-between ${!(index % 2) ? "bg-black/5" : "bg-white/5"}`, children: [
3122
+ /* @__PURE__ */ jsx(Label, { htmlFor: opt.id.toString(), children: opt.label || opt.name }),
3123
+ /* @__PURE__ */ jsx(
3124
+ Switch,
3125
+ {
3126
+ id: opt.id.toString(),
3127
+ checked: opt.checked || false,
3128
+ onCheckedChange: (checked) => handleChildToggle(opt, checked)
3129
+ }
3130
+ )
3131
+ ] }, opt.id))
3132
+ ] });
3133
+ };
3134
+ var NumberInput = class extends BaseInput {
3135
+ render() {
3136
+ const { input, form } = this;
3137
+ return /* @__PURE__ */ jsx(
3138
+ FormField,
3139
+ {
3140
+ control: form.control,
3141
+ name: input.name,
3142
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3143
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
3144
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { className: "min-w-[180px] bg-white", placeholder: input.placeHolder, ...field, type: "number", disabled: input.disabled }) }),
3145
+ /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
3146
+ /* @__PURE__ */ jsx(FormMessage, {})
3147
+ ] })
3148
+ },
3149
+ input.name
3150
+ );
3151
+ }
3152
+ };
3153
+ var OTPInput2 = class extends BaseInput {
3154
+ render() {
3155
+ const { input, form } = this;
3156
+ const totalPositions = Array.from({ length: input.min ?? 6 }, (_, i) => i);
3157
+ return /* @__PURE__ */ jsx(
3158
+ FormField,
3159
+ {
3160
+ control: form.control,
3161
+ name: input.name,
3162
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3163
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
3164
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(InputOTP, { maxLength: totalPositions.length, ...field, children: /* @__PURE__ */ jsx(InputOTPGroup, { children: totalPositions.map((position) => /* @__PURE__ */ jsx(InputOTPSlot, { index: position }, position)) }) }) }),
3165
+ /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
3166
+ /* @__PURE__ */ jsx(FormMessage, {})
3167
+ ] })
3168
+ },
3169
+ input.name
3170
+ );
3171
+ }
3172
+ };
3173
+ var SelectInput = class extends BaseInput {
3174
+ render() {
3175
+ const { input, form } = this;
3176
+ return /* @__PURE__ */ jsx(FieldSelect, { input, form });
3177
+ }
3178
+ };
3179
+ var FieldSelect = ({ form, input }) => {
3180
+ const mockInputOptions = [
3181
+ { id: 1, name: "MOCK OPTION - PERMISO 1", checked: false },
3182
+ { id: 2, name: "MOCK OPTION - PERMISO 2", checked: true },
3183
+ { id: 3, name: "MOCK OPTION - PERMISO 3", checked: false },
3184
+ { id: 4, name: "MOCK OPTION - PERMISO 4", checked: false }
3185
+ ];
3186
+ let lista = input?.listConfig?.list ?? mockInputOptions;
3187
+ if (lista == void 0) lista = [];
3188
+ const value = input.value ?? "";
3189
+ const optionValue = input?.listConfig?.optionValue ?? input.optionValue ?? "id";
3190
+ const getValue = (item) => {
3191
+ if (optionValue == "name") return item[optionValue];
3192
+ return item.value ?? item.id;
3193
+ };
3194
+ return /* @__PURE__ */ jsx(
3195
+ FormField,
3196
+ {
3197
+ control: form.control,
3198
+ name: input.name,
3199
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "flex flex-row items-center justify-between rounded-lg border p-3 shadow-lg bg-blue-100/20", children: [
3200
+ /* @__PURE__ */ jsxs("div", { className: "space-y-0.5 pr-5", children: [
3201
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
3202
+ input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
3203
+ /* @__PURE__ */ jsx(FormMessage, {})
3204
+ ] }),
3205
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(Select, { onValueChange: field.onChange, defaultValue: value.toString(), value: field.value?.toString() ?? value.toString(), children: [
3206
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { className: "w-[60%] bg-black/10 dark:bg-white/25", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: input.placeHolder }) }) }),
3207
+ /* @__PURE__ */ jsx(SelectContent, { children: lista.filter((item) => item.name !== void 0).map((item) => /* @__PURE__ */ jsx(SelectItem, { value: getValue(item).toString(), children: item.name }, item.id)) })
3208
+ ] }) })
3209
+ ] })
3210
+ },
3211
+ input.name
3212
+ );
3213
+ };
3214
+ var SwitchInput = class extends BaseInput {
3215
+ render() {
3216
+ const { input, form } = this;
3217
+ const className = input.className;
3218
+ return /* @__PURE__ */ jsx(
3219
+ FormField,
3220
+ {
3221
+ control: form.control,
3222
+ name: input.name,
3223
+ render: ({ field }) => /* @__PURE__ */ jsx(Card, { className: `${className ? className : "p-3 shadow-lg bg-blue-100/20"}`, children: /* @__PURE__ */ jsxs(FormItem, { className: "flex flex-row items-center justify-between rounded-lg", children: [
3224
+ /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
3225
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
3226
+ /* @__PURE__ */ jsx(FormDescription, { children: input.placeHolder ?? input.description }),
3227
+ /* @__PURE__ */ jsx(FormMessage, {})
3228
+ ] }),
3229
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Switch, { checked: field.value, onCheckedChange: field.onChange, "aria-disabled": true, disabled: input.disabled }) })
3230
+ ] }) })
3231
+ },
3232
+ input.name
3233
+ );
3234
+ }
3235
+ };
3236
+ var TextAreaInput = class extends BaseInput {
3237
+ render() {
3238
+ const { input, form } = this;
3239
+ return /* @__PURE__ */ jsx(
3240
+ FormField,
3241
+ {
3242
+ control: form.control,
3243
+ name: input.name,
3244
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "shadow-lg", children: [
3245
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
3246
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Textarea, { className: "min-w-[260px] bg-white", placeholder: input.placeHolder, ...field, disabled: input.disabled }) }),
3247
+ input.description && /* @__PURE__ */ jsx(FormDescription, { children: input.description }),
3248
+ /* @__PURE__ */ jsx(FormMessage, {})
3249
+ ] })
3250
+ },
3251
+ input.name
3252
+ );
3253
+ }
3254
+ };
3255
+ var TextInput = class extends BaseInput {
3256
+ render() {
3257
+ const { input, form } = this;
3258
+ return /* @__PURE__ */ jsx(
3259
+ FormField,
3260
+ {
3261
+ control: form.control,
3262
+ name: input.name,
3263
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: input.className, children: [
3264
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
3265
+ /* @__PURE__ */ jsx(FormControl, { className: "shadow-lg", children: /* @__PURE__ */ jsx(
3266
+ Input,
3267
+ {
3268
+ className: "min-w-[180px]",
3269
+ placeholder: input.placeHolder,
3270
+ ...field,
3271
+ type: input.keyboardType,
3272
+ disabled: input.disabled
3273
+ }
3274
+ ) }),
3275
+ input.description && /* @__PURE__ */ jsxs(FormDescription, { children: [
3276
+ " ",
3277
+ input.description,
3278
+ " "
3279
+ ] }),
3280
+ /* @__PURE__ */ jsx(FormMessage, {})
3281
+ ] })
3282
+ },
3283
+ input.name
3284
+ );
3285
+ }
3286
+ };
3287
+ var FileInput = class extends BaseInput {
3288
+ render() {
3289
+ const { input, form } = this;
3290
+ return /* @__PURE__ */ jsx(FieldFile, { input, form });
3291
+ }
3292
+ };
3293
+ var FieldFile = ({ form, input }) => {
3294
+ const [preview, setPreview] = useState(form.getValues(input.name) ?? null);
3295
+ const [showPreview, setShowPreview] = useState(input.fileConfig?.showPreview ?? false);
3296
+ const accept = input.fileConfig?.accept || "*/*";
3297
+ const multiple = input.fileConfig?.multiple || false;
3298
+ useEffect(() => {
3299
+ setPreview(form.getValues(input.name) || null);
3300
+ }, [input]);
3301
+ const handleFileChange = (e) => {
3302
+ const file = e.target.files?.[0];
3303
+ if (file) {
3304
+ const objectUrl = URL.createObjectURL(file);
3305
+ setPreview(objectUrl);
3306
+ console.log("\u{1F680} ~ handleFileChange ~ objectUrl:", objectUrl);
3307
+ } else {
3308
+ setPreview(null);
3309
+ }
3310
+ };
3311
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
3312
+ FormField,
3313
+ {
3314
+ control: form.control,
3315
+ name: input.name,
3316
+ render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
3317
+ /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx("b", { children: input.label }) }),
3318
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
3319
+ /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
3320
+ Input,
3321
+ {
3322
+ type: "file",
3323
+ accept,
3324
+ multiple,
3325
+ placeholder: input.placeHolder,
3326
+ name: field.name,
3327
+ disabled: input.disabled,
3328
+ onChange: (e) => {
3329
+ field.onChange(e.target.files?.[0]);
3330
+ handleFileChange(e);
3331
+ }
3332
+ }
3333
+ ) }),
3334
+ preview && /* @__PURE__ */ jsx(Button, { type: "button", onClick: () => {
3335
+ setShowPreview(!showPreview);
3336
+ }, children: showPreview ? /* @__PURE__ */ jsx(EyeOff, {}) : /* @__PURE__ */ jsx(Eye, {}) }),
3337
+ /* @__PURE__ */ jsx(FormDescription, { children: input.description })
3338
+ ] }),
3339
+ /* @__PURE__ */ jsx(FormMessage, {}),
3340
+ preview && showPreview && /* @__PURE__ */ jsx(Card, {})
3341
+ ] })
3342
+ },
3343
+ input.name
3344
+ ) });
3345
+ };
3346
+ var inputMap = {
3347
+ ["text" /* TEXT */]: TextInput,
3348
+ ["switch" /* SWITCH */]: SwitchInput,
3349
+ ["color" /* COLOR */]: ColorInput,
3350
+ ["date" /* DATE */]: DateInput,
3351
+ ["number" /* NUMBER */]: NumberInput,
3352
+ ["select" /* SELECT */]: SelectInput,
3353
+ ["grouped_switchlist" /* GROUPED_SWITCH_LIST */]: GroupedSwitchInput,
3354
+ ["otp" /* OTP */]: OTPInput2,
3355
+ ["file" /* FILE */]: FileInput,
3356
+ ["hidden" /* HIDDEN */]: TextInput,
3357
+ //ToDo: // puedes asignar algo genérico
3358
+ ["checklist" /* CHECK_LIST */]: TextInput,
3359
+ //ToDo:
3360
+ // [InputTypes.SWITCH_LIST]: SwitchListInput, //ToDo:
3361
+ ["textarea" /* TEXTAREA */]: TextAreaInput,
3362
+ ["form" /* FORM */]: TextInput
3363
+ //ToDo:
3364
+ };
3365
+ var InputFactory = class {
3366
+ static create(input, form) {
3367
+ const inputType = input.inputType ?? "text" /* TEXT */;
3368
+ const InputClass = inputMap[inputType] ?? TextInput;
3369
+ const instance = new InputClass(input, form);
3370
+ return instance.render();
3371
+ }
3372
+ };
3373
+ function getDefaultValues(entity) {
3374
+ const defaults = {};
3375
+ for (const key in entity) {
3376
+ const value = entity[key];
3377
+ if (value === null || value === void 0) {
3378
+ defaults[key] = "";
3379
+ continue;
3380
+ }
3381
+ switch (typeof value) {
3382
+ case "string":
3383
+ defaults[key] = value ?? "";
3384
+ break;
3385
+ case "number":
3386
+ defaults[key] = value ?? 0;
3387
+ break;
3388
+ case "boolean":
3389
+ defaults[key] = value ?? false;
3390
+ break;
3391
+ case "object":
3392
+ if (Array.isArray(value)) {
3393
+ defaults[key] = [...value];
3394
+ } else {
3395
+ defaults[key] = { ...value };
3396
+ }
3397
+ break;
3398
+ default:
3399
+ defaults[key] = value;
3400
+ }
3401
+ }
3402
+ return defaults;
3403
+ }
3404
+ var getDynamicSchema = (fields) => {
3405
+ const flatFields = fields.flatMap((f) => Array.isArray(f) ? f : [f]);
3406
+ const shape = {};
3407
+ flatFields.forEach((f) => {
3408
+ shape[f.name] = f.zodTypeAny ?? z2.any();
3409
+ });
3410
+ return z2.object(shape);
3411
+ };
3412
+ var FormErrors = ({ formState, fields }) => {
3413
+ const flatFields = fields.flatMap((f) => Array.isArray(f) ? f : [f]);
3414
+ return /* @__PURE__ */ jsx(Fragment, { children: Object.entries(formState.errors).length > 0 && /* @__PURE__ */ jsx(
3415
+ CustomAlert,
3416
+ {
3417
+ title: "Revisar los siguientes criterios",
3418
+ description: /* @__PURE__ */ jsx("ul", { children: Object.entries(formState?.errors).map(([key, value]) => /* @__PURE__ */ jsxs("li", { children: [
3419
+ /* @__PURE__ */ jsxs("strong", { children: [
3420
+ getFieldLabel(key, flatFields),
3421
+ ":"
3422
+ ] }),
3423
+ " ",
3424
+ value?.message?.toString() ?? ""
3425
+ ] }, key)) }),
3426
+ className: "mb-4",
3427
+ variant: "error"
3428
+ }
3429
+ ) });
3430
+ };
3431
+ var getFieldLabel = (fieldErrorKey, fields) => {
3432
+ const findedField = fields.find((field) => field.name == fieldErrorKey);
3433
+ return findedField?.label ?? fieldErrorKey;
3434
+ };
3435
+ var DynamicForm = ({ fields, record = {}, onSubmit }) => {
3436
+ const schema = useMemo(() => getDynamicSchema(fields), [fields]);
3437
+ const defaultValues = useMemo(() => getDefaultValues(record), [record]);
3438
+ const form = useForm({
3439
+ resolver: zodResolver(schema),
3440
+ defaultValues
3441
+ });
3442
+ useEffect(() => {
3443
+ form.reset(defaultValues);
3444
+ }, [defaultValues, fields]);
3445
+ const handleSubmit = (data) => {
3446
+ console.log("\u2705 Datos enviados:", data);
3447
+ startTransition(async () => {
3448
+ onSubmit?.(data);
3449
+ });
3450
+ };
3451
+ return /* @__PURE__ */ jsxs("div", { children: [
3452
+ /* @__PURE__ */ jsx(FormErrors, { formState: form.formState, fields }),
3453
+ /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(handleSubmit), className: "flex flex-col gap-2", children: [
3454
+ /* @__PURE__ */ jsx("div", { className: "w-full grid grid-cols-1", children: fields.map(
3455
+ (input, idx) => Array.isArray(input) ? /* @__PURE__ */ jsx("span", { className: "w-full flex flex-row justify-between py-3", children: input.map((field, subIdx) => /* @__PURE__ */ jsx("div", { className: "w-full px-2", children: InputFactory.create(field, form) }, subIdx)) }, `field-group-${idx}`) : /* @__PURE__ */ jsx("span", { className: "flex flex-col justify-between py-3 w-full px-2", children: InputFactory.create(input, form) }, `field-group-${idx}`)
3456
+ ) }),
3457
+ /* @__PURE__ */ jsx("div", { className: "flex flex-row", children: /* @__PURE__ */ jsx(Button, { type: "submit", children: "Enviar" }) })
3458
+ ] }) })
3459
+ ] });
3460
+ };
3461
+ var DynamicFormExample = () => {
3462
+ const record = {
3463
+ username: "John Doe ",
3464
+ email: "johndoe@example.com",
3465
+ isActive: true,
3466
+ favoriteColor: void 0,
3467
+ age: 25,
3468
+ role: "editor"
3469
+ };
3470
+ return /* @__PURE__ */ jsx(
3471
+ DynamicForm,
3472
+ {
3473
+ fields: mockFields,
3474
+ record,
3475
+ onSubmit: (data) => console.log("\u{1F4E4} Resultado final:", data)
3476
+ }
3477
+ );
3478
+ };
3479
+ var mockFields = [
3480
+ // 🧍‍♂️ Campo requerido simple
3481
+ {
3482
+ name: "username",
3483
+ label: "Nombre de usuario",
3484
+ inputType: "text" /* TEXT */,
3485
+ required: true,
3486
+ zodTypeAny: z2.string().min(3, "El nombre debe tener al menos 3 caracteres").max(20, "El nombre no puede tener m\xE1s de 20 caracteres")
3487
+ },
3488
+ // 📧 Campo de correo con validación personalizada (ZodTypeAny)
3489
+ {
3490
+ name: "email",
3491
+ label: "Correo electr\xF3nico",
3492
+ inputType: "text" /* TEXT */,
3493
+ required: false,
3494
+ zodTypeAny: z2.string().email("Correo inv\xE1lido").toLowerCase().refine((val) => !val.endsWith("@spam.com"), {
3495
+ message: "No se permiten correos de spam.com"
3496
+ })
3497
+ },
3498
+ // 🔒 Campo opcional (no requerido)
3499
+ {
3500
+ name: "password",
3501
+ label: "Contrase\xF1a",
3502
+ inputType: "text" /* TEXT */,
3503
+ required: false,
3504
+ keyboardType: "password" /* PASSWORD */,
3505
+ zodTypeAny: z2.string().min(6, "Debe tener al menos 6 caracteres").max(20, "No m\xE1s de 20 caracteres").optional()
3506
+ },
3507
+ // 🟢 Campo tipo switch (boolean)
3508
+ {
3509
+ name: "isActive",
3510
+ label: "Usuario activo",
3511
+ inputType: "switch" /* SWITCH */,
3512
+ required: false,
3513
+ zodTypeAny: z2.boolean().default(true)
3514
+ },
3515
+ // 🎨 Color con validación personalizada
3516
+ [
3517
+ {
3518
+ name: "favoriteColor",
3519
+ label: "Color favorito",
3520
+ inputType: "color" /* COLOR */,
3521
+ required: false,
3522
+ zodTypeAny: z2.string().regex(/^#([0-9A-Fa-f]{6})$/, "Debe ser un color hexadecimal v\xE1lido")
3523
+ },
3524
+ // 🔢 Número con rango
3525
+ {
3526
+ name: "age",
3527
+ label: "Edad",
3528
+ inputType: "number" /* NUMBER */,
3529
+ required: true,
3530
+ zodTypeAny: z2.coerce.number().min(18, "Debe ser mayor de 18").max(99, "Debe ser menor de 99")
3531
+ }
3532
+ ],
3533
+ // 📅 Fecha
3534
+ {
3535
+ name: "birthDate",
3536
+ label: "Fecha de nacimiento",
3537
+ inputType: "date" /* DATE */,
3538
+ required: true,
3539
+ zodTypeAny: z2.coerce.date().refine((d) => d < /* @__PURE__ */ new Date(), {
3540
+ message: "La fecha no puede ser futura"
3541
+ })
3542
+ },
3543
+ // 🎓 Select con validación personalizada
3544
+ {
3545
+ name: "role",
3546
+ label: "Rol de usuario",
3547
+ inputType: "select" /* SELECT */,
3548
+ required: true,
3549
+ listConfig: {
3550
+ onOptionChange: () => {
3551
+ },
3552
+ list: [
3553
+ { id: 1, name: "Administrador", value: "admin" },
3554
+ { id: 2, name: "Editor", value: "editor" },
3555
+ { id: 3, name: "Lector", value: "reader" }
3556
+ ]
3557
+ },
3558
+ zodTypeAny: z2.enum(["admin", "editor", "reader"])
3559
+ },
3560
+ // 🧾 Campo tipo archivo (file)
3561
+ {
3562
+ name: "profileImage",
3563
+ label: "Imagen de perfil",
3564
+ inputType: "file" /* FILE */,
3565
+ required: false,
3566
+ zodTypeAny: z2.any().refine(
3567
+ (file) => {
3568
+ if (!file) return true;
3569
+ return file.size <= 10 * 1024 * 1024 && ["image/jpeg", "image/png"].includes(file.type);
3570
+ },
3571
+ { message: "Solo se permiten im\xE1genes JPG o PNG de menos de 10MB" }
3572
+ ).optional()
3573
+ },
3574
+ // 🔢 OTP (código)
3575
+ {
3576
+ name: "otpCode",
3577
+ label: "C\xF3digo OTP",
3578
+ inputType: "otp" /* OTP */,
3579
+ required: true,
3580
+ zodTypeAny: z2.string().min(4, "Debe tener al menos 4 d\xEDgitos").max(6, "Debe tener m\xE1ximo 6 d\xEDgitos")
3581
+ }
3582
+ ];
3583
+ var InputList = ({ handleAddInput, inputsTypes }) => {
3584
+ const [inputSetups, setInputSetups] = useState(
3585
+ () => Object.fromEntries(
3586
+ inputsTypes.map((type) => [type, { required: false, disabled: false }])
3587
+ )
3588
+ );
3589
+ const toggleConfig = (type, key) => {
3590
+ setInputSetups((prev) => ({
3591
+ ...prev,
3592
+ [type]: { ...prev[type], [key]: !prev[type][key] }
3593
+ }));
3594
+ };
3595
+ return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-1", children: inputsTypes.map((type) => {
3596
+ const setup = inputSetups[type];
3597
+ return /* @__PURE__ */ jsxs(
3598
+ "div",
3599
+ {
3600
+ className: "border rounded-lg p-2 flex flex-col-2 gap-1 shadow-sm",
3601
+ children: [
3602
+ /* @__PURE__ */ jsx(Button, { size: "icon", onClick: () => handleAddInput(type, setup), children: /* @__PURE__ */ jsx(Plus, {}) }),
3603
+ /* @__PURE__ */ jsx(Accordion, { type: "single", collapsible: true, className: "w-full", children: /* @__PURE__ */ jsxs(AccordionItem, { value: "item-1", children: [
3604
+ /* @__PURE__ */ jsx(AccordionTrigger, { children: /* @__PURE__ */ jsx("div", { className: "flex flex-row justify-center w-full content-center", children: /* @__PURE__ */ jsx("span", { className: "font-semibold text-xl", children: type }) }) }),
3605
+ /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
3606
+ /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
3607
+ /* @__PURE__ */ jsx(
3608
+ Switch,
3609
+ {
3610
+ checked: setup.required,
3611
+ onCheckedChange: () => toggleConfig(type, "required")
3612
+ }
3613
+ ),
3614
+ /* @__PURE__ */ jsx("span", { children: "Required" })
3615
+ ] }),
3616
+ /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
3617
+ /* @__PURE__ */ jsx(
3618
+ Switch,
3619
+ {
3620
+ checked: setup.disabled,
3621
+ onCheckedChange: () => toggleConfig(type, "disabled")
3622
+ }
3623
+ ),
3624
+ /* @__PURE__ */ jsx("span", { children: "Disabled" })
3625
+ ] })
3626
+ ] }) })
3627
+ ] }) })
3628
+ ]
3629
+ },
3630
+ type
3631
+ );
3632
+ }) });
3633
+ };
3634
+
3635
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Badge, BaseInput, Button, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CheckListInput, Checkbox, ColorCnInput, ColorInput, CustomAlert, DateInput, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DynamicForm, DynamicFormExample, FileInput, Form, FormControl, FormDescription, FormErrors, FormField, FormItem, FormLabel, FormMessage, GroupedSwitchInput, Input, InputFactory, InputList, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, InputTypes, Label, NumberInput, OTPInput2 as OTPInput, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectInput, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, Switch, SwitchInput, TextAreaInput, TextInput, TextInputType, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, getDefaultValues, getDynamicSchema, inputFieldComp, mockFields, useFormField, validationMessages };
3636
+ //# sourceMappingURL=index.mjs.map
3637
+ //# sourceMappingURL=index.mjs.map