@base-framework/ui 1.2.15 → 1.2.17

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.
@@ -0,0 +1,4587 @@
1
+ import { I as Y, Span as g, Button as w, OnState as T, Div as o, Legend as nt, Fieldset as at, H4 as Ee, P as k, Label as V, Checkbox as ce, Input as p, Textarea as ot, UseParent as W, Img as de, H5 as lt, H2 as J, Form as rt, Header as Z, Footer as ue, A as Ue, H3 as he, Nav as fe, Ul as X, Li as ge, OnStateOpen as me, On as Q, Dialog as it, Th as Ye, Thead as ct, Tr as dt, Table as be, Time as ut, H1 as ht } from "@base-framework/atoms";
2
+ import { Atom as r, Jot as M, Component as C, Html as ft, Data as z, Events as j, DateTime as ee, NavLink as gt, router as ve, DataTracker as Ve } from "@base-framework/base";
3
+ import { Icons as u } from "./icons.es.js";
4
+ import { Timer as mt, TableBody as bt, DataTableBody as xt, ScrollableTableBody as pt, List as yt } from "@base-framework/organisms";
5
+ import { F as U } from "./format-DE4rFWuD.js";
6
+ import { F as wt } from "./bside-template-C7AQgQ6H.js";
7
+ const vt = {
8
+ xs: "w-4 h-4",
9
+ sm: "w-6 h-6",
10
+ md: "w-8 h-8",
11
+ lg: "w-10 h-10",
12
+ xl: "w-12 h-12",
13
+ "2xl": "w-14 h-14",
14
+ "3xl": "w-16 h-16"
15
+ }, ie = r((e, t) => {
16
+ const s = vt[e.size || "sm"];
17
+ return Y({
18
+ ...e,
19
+ // @ts-ignore
20
+ class: `stroke-current icon-size ${s} ${e.class || ""}`,
21
+ html: t[0]?.textContent
22
+ });
23
+ }), ke = {
24
+ xs: "w-4 h-4",
25
+ // 16px - matches Icon
26
+ sm: "w-6 h-6",
27
+ // 24px - matches Icon
28
+ md: "w-8 h-8",
29
+ // 32px - matches Icon
30
+ lg: "w-10 h-10",
31
+ // 40px - matches Icon
32
+ xl: "w-12 h-12",
33
+ // 48px - matches Icon
34
+ "2xl": "w-14 h-14",
35
+ // 56px - matches Icon
36
+ "3xl": "w-16 h-16"
37
+ // 64px - matches Icon
38
+ }, Ce = {
39
+ xs: "16px",
40
+ sm: "24px",
41
+ md: "32px",
42
+ lg: "40px",
43
+ xl: "48px",
44
+ "2xl": "56px",
45
+ "3xl": "64px"
46
+ }, Se = {
47
+ outlined: "material-symbols-outlined",
48
+ filled: "material-symbols-filled",
49
+ rounded: "material-symbols-rounded",
50
+ sharp: "material-symbols-sharp"
51
+ }, $e = r((e) => {
52
+ const t = e.size || "sm", s = e.variant || "outlined", n = ke[t] || ke.sm, a = Ce[t] || Ce.sm, l = Se[s] || Se.outlined;
53
+ return g({
54
+ ...e,
55
+ // @ts-ignore
56
+ class: `inline-flex items-center justify-center ${l} ${n} ${e.class || ""}`,
57
+ // @ts-ignore
58
+ style: `font-size: ${a}; ${e.style || ""}`,
59
+ // Remove props that shouldn't be passed to the DOM element
60
+ size: void 0,
61
+ variant: void 0,
62
+ name: void 0
63
+ // @ts-ignore
64
+ }, e.name);
65
+ }), x = (e = {}, t) => t ? typeof t == "string" && t.includes("<svg") ? ie(e, t) : typeof t == "object" && t.name ? $e({
66
+ ...e,
67
+ name: t.name,
68
+ variant: t.variant || e.variant || "outlined"
69
+ }) : typeof t == "string" ? $e({
70
+ ...e,
71
+ name: t
72
+ }) : ie(e, t) : null, ra = (e) => e ? !!(typeof e == "object" && e.name || typeof e == "string" && !e.includes("<svg")) : !1, ia = (e) => typeof e == "string" && e.includes("<svg"), De = {
73
+ gray: {
74
+ backgroundColor: "bg-gray-50",
75
+ textColor: "text-gray-600",
76
+ ringColor: "ring-gray-500/10"
77
+ },
78
+ red: {
79
+ backgroundColor: "bg-red-50",
80
+ textColor: "text-red-700",
81
+ ringColor: "ring-red-600/10"
82
+ },
83
+ yellow: {
84
+ backgroundColor: "bg-yellow-50",
85
+ textColor: "text-yellow-800",
86
+ ringColor: "ring-yellow-600/20"
87
+ },
88
+ green: {
89
+ backgroundColor: "bg-green-50",
90
+ textColor: "text-green-700",
91
+ ringColor: "ring-green-600/20"
92
+ },
93
+ blue: {
94
+ backgroundColor: "bg-blue-50",
95
+ textColor: "text-blue-700",
96
+ ringColor: "ring-blue-700/10"
97
+ },
98
+ indigo: {
99
+ backgroundColor: "bg-indigo-50",
100
+ textColor: "text-indigo-700",
101
+ ringColor: "ring-indigo-700/10"
102
+ },
103
+ purple: {
104
+ backgroundColor: "bg-purple-50",
105
+ textColor: "text-purple-700",
106
+ ringColor: "ring-purple-700/10"
107
+ },
108
+ pink: {
109
+ backgroundColor: "bg-pink-50",
110
+ textColor: "text-pink-700",
111
+ ringColor: "ring-pink-700/10"
112
+ },
113
+ primary: {
114
+ backgroundColor: "bg-primary",
115
+ textColor: "text-primary-foreground",
116
+ ringColor: "ring-primary/10"
117
+ },
118
+ secondary: {
119
+ backgroundColor: "bg-secondary",
120
+ textColor: "text-secondary-foreground",
121
+ ringColor: "ring-secondary/10"
122
+ },
123
+ destructive: {
124
+ backgroundColor: "bg-destructive",
125
+ textColor: "text-destructive-foreground",
126
+ ringColor: "ring-destructive/10"
127
+ },
128
+ warning: {
129
+ backgroundColor: "bg-warning",
130
+ textColor: "text-warning-foreground",
131
+ ringColor: "ring-warning/10"
132
+ },
133
+ outline: {
134
+ backgroundColor: "bg-background",
135
+ textColor: "text-primary",
136
+ ringColor: "ring-input"
137
+ },
138
+ ghost: {
139
+ backgroundColor: "bg-background",
140
+ textColor: "text-primary",
141
+ ringColor: "ring-background"
142
+ },
143
+ link: {
144
+ backgroundColor: "bg-background",
145
+ textColor: "text-primary",
146
+ ringColor: "ring-background"
147
+ },
148
+ blur: {
149
+ backgroundColor: "bg-background/40 backdrop-blur-sm",
150
+ textColor: "text-foreground",
151
+ ringColor: "ring-white/10"
152
+ }
153
+ }, kt = (e) => De[e] || De.gray, Ct = (e, t = {}) => {
154
+ const s = kt(e), n = t.backgroundColor ?? s.backgroundColor, a = t.textColor ?? s.textColor, l = t.ringColor ?? s.ringColor;
155
+ return `inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors ${n} ${a} ${l}`;
156
+ }, ca = r((e, t) => {
157
+ const { type: s, icon: n, size: a = "xs", backgroundColor: l, textColor: i, ringColor: c, ...h } = e, m = Ct(s, { backgroundColor: l, textColor: i, ringColor: c });
158
+ return g({ ...h, class: m }, [
159
+ n ? x({ size: a, class: "mr-1" }, n) : null,
160
+ ...t || []
161
+ ]);
162
+ });
163
+ class We extends C {
164
+ /**
165
+ * This will set the component context.
166
+ *
167
+ * @param {object|null} context
168
+ * @returns {object|null}
169
+ */
170
+ setContext(t) {
171
+ if (this.data)
172
+ return null;
173
+ const s = this?.parent?.data ?? this?.parent?.context?.data ?? this?.parent?.state ?? null;
174
+ return s ? { data: s } : null;
175
+ }
176
+ }
177
+ const O = (e) => (
178
+ /** @type {VeilComponentConstructor} */
179
+ M(e, We)
180
+ );
181
+ class da extends We {
182
+ /**
183
+ * Declare public props and their defaults.
184
+ */
185
+ declareProps() {
186
+ this.icon = null, this.activeIcon = null, this.value = null, this.dataKey = null, this.active = !1, this.toggle = null, this.size = "sm", this.formatType = "number";
187
+ }
188
+ /**
189
+ * Set up internal states.
190
+ *
191
+ * @returns {object}
192
+ */
193
+ setupStates() {
194
+ return {
195
+ active: this.active ?? !1
196
+ };
197
+ }
198
+ /**
199
+ * Toggle the active state and fire the callback.
200
+ *
201
+ * @returns {void}
202
+ */
203
+ handleToggle() {
204
+ this.state.active = !this.state.active, typeof this.toggle == "function" && this.toggle(this.state.active);
205
+ }
206
+ /**
207
+ * Render the toggle button.
208
+ *
209
+ * @returns {object}
210
+ */
211
+ render() {
212
+ const t = this.size, s = this.icon, n = this.activeIcon || this.icon, a = (() => {
213
+ if (this.dataKey) {
214
+ let l = `[[${this.dataKey}]]`;
215
+ return this.formatType === "number" ? l = U.number(l, "0") : this.formatType === "money" ? l = U.roundMoney(l) : this.formatType === "date" ? l = U.date(l) : this.formatType === "percent" && (l = U.percentage(l)), g({ class: "toggle-btn-value text-sm tabular-nums capitalize" }, l);
216
+ }
217
+ return this.value !== null && this.value !== void 0 ? g({ class: "toggle-btn-value text-sm tabular-nums" }, String(this.value)) : null;
218
+ })();
219
+ return w({
220
+ click: () => this.handleToggle(),
221
+ // @ts-ignore
222
+ class: `toggle-btn inline-flex items-center gap-1.5 bg-transparent border-0 p-0 cursor-pointer text-foreground/70 hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${this.class || ""}`
223
+ }, [
224
+ T(
225
+ "active",
226
+ (l) => x({ size: t }, l ? n : s)
227
+ ),
228
+ a
229
+ ]);
230
+ }
231
+ }
232
+ const ne = {
233
+ xs: "w-6 h-6",
234
+ sm: "w-8 h-8",
235
+ md: "w-10 h-10",
236
+ lg: "w-12 h-12",
237
+ xl: "w-14 h-14",
238
+ "2xl": "w-16 h-16"
239
+ };
240
+ class ua extends C {
241
+ /**
242
+ * Declare public props.
243
+ */
244
+ declareProps() {
245
+ this.icon = null, this.activeIcon = null, this.active = !1, this.size = "md", this.activeClass = "", this.toggle = null;
246
+ }
247
+ /**
248
+ * Set up internal states.
249
+ *
250
+ * @returns {object}
251
+ */
252
+ setupStates() {
253
+ return {
254
+ active: this.active ?? !1
255
+ };
256
+ }
257
+ /**
258
+ * Toggle active state and fire callback.
259
+ *
260
+ * @returns {void}
261
+ */
262
+ handleToggle() {
263
+ this.state.active = !this.state.active, typeof this.toggle == "function" && this.toggle(this.state.active);
264
+ }
265
+ /**
266
+ * Render the circular toggle button.
267
+ *
268
+ * @returns {object}
269
+ */
270
+ render() {
271
+ const t = this.icon, s = this.activeIcon || this.icon, n = ne[this.size] || ne.md, a = ["xs", "sm"].includes(this.size) ? "xs" : "sm", l = this.class ?? "bg-background/40 backdrop-blur-sm", i = "text-foreground", c = this.activeClass || i, h = this.circle ?? !1;
272
+ return w({
273
+ click: () => this.handleToggle(),
274
+ // @ts-ignore
275
+ class: `circle-toggle-btn inline-flex items-center justify-center rounded-full border-0 cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 ${n} ${l}${h ? " rounded-full w-[40px] h-[40px] max-w-[40px]" : ""}`
276
+ }, [
277
+ T("active", (m) => [
278
+ x({
279
+ size: a,
280
+ class: `transition-colors ${m ? c : i}`
281
+ }, m ? s : t)
282
+ ])
283
+ ]);
284
+ }
285
+ }
286
+ const ha = r((e, t) => {
287
+ const s = e.size || "md", n = ne[s] || ne.md, a = ["xs", "sm"].includes(s) ? "xs" : "sm";
288
+ return w({
289
+ ...e,
290
+ // @ts-ignore
291
+ class: `circle-btn inline-flex items-center justify-center rounded-full border-0 bg-background/40 backdrop-blur-sm text-foreground cursor-pointer transition-colors hover:bg-background/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 ${n} ${e.class || ""}`
292
+ }, [
293
+ // @ts-ignore
294
+ e.icon ? x({ size: a }, e.icon) : null,
295
+ ...t || []
296
+ ]);
297
+ }), F = (e) => r((t, s) => w({
298
+ ...e,
299
+ ...t,
300
+ // @ts-ignore
301
+ class: `bttn ${e.class} ${t.class || ""}`
302
+ }, s)), xe = r(
303
+ (e, t) => w({
304
+ ...e,
305
+ // @ts-ignore
306
+ class: e.class
307
+ }, [
308
+ // @ts-ignore
309
+ e.icon && e.position !== "right" ? x({ size: e.size || "sm", class: e.animation ?? null }, e.icon) : null,
310
+ ...t || [],
311
+ // @ts-ignore
312
+ e.icon && e.position === "right" ? x({ size: e.size || "sm", class: e.animation ?? null }, e.icon) : null
313
+ ])
314
+ ), Ie = (e) => r((t, s) => xe({
315
+ ...e,
316
+ ...t,
317
+ // @ts-ignore
318
+ class: `bttn ${e.class} ${t.class || ""}`
319
+ }, s)), St = (e) => () => {
320
+ if (e.allowHistory === !0 && globalThis.history.length > 2) {
321
+ globalThis.history.back();
322
+ return;
323
+ }
324
+ e.backUrl && app.navigate(e.backUrl);
325
+ }, $t = (e) => r((t, s) => (t.icon = t.icon || u.arrows.left, t.click = t.click || St(t), xe({
326
+ ...e,
327
+ ...t
328
+ }, s))), Dt = (e) => {
329
+ const t = globalThis.history.length;
330
+ return () => {
331
+ const a = globalThis.history.length - t + 1;
332
+ if (t > 1) {
333
+ globalThis.history.go(-a);
334
+ return;
335
+ }
336
+ e.backUrl && app.navigate(e.backUrl);
337
+ };
338
+ }, It = (e) => r((t, s) => (t.icon = t.icon || u.arrows.left, t.click = t.click || Dt(t), xe({
339
+ ...e,
340
+ ...t
341
+ }, s))), Tt = r((e, t) => {
342
+ const s = e.size || "md", n = {
343
+ xs: "w-6 h-6",
344
+ sm: "w-8 h-8",
345
+ md: "w-10 h-10",
346
+ lg: "w-12 h-12",
347
+ xl: "w-14 h-14"
348
+ }, a = e.backgroundClass || "bg-background/30 hover:bg-background/50";
349
+ return w({
350
+ ...e,
351
+ // @ts-ignore
352
+ class: `circle-icon-btn inline-flex items-center justify-center rounded-full ${a} text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ring-offset-background transition-colors disabled:pointer-events-none disabled:opacity-50 cursor-pointer ${n[s] || n.md} ${e.class || ""}`
353
+ }, [
354
+ // @ts-ignore
355
+ e.icon ? x({ size: s === "xs" ? "xs" : "sm" }, e.icon) : null,
356
+ ...t || []
357
+ ]);
358
+ }), Te = {
359
+ primary: F({ class: "primary" }),
360
+ secondary: F({ class: "secondary" }),
361
+ destructive: F({ class: "destructive" }),
362
+ warning: F({ class: "warning" }),
363
+ outline: F({ class: "outline" }),
364
+ ghost: F({ class: "ghost" }),
365
+ link: F({ class: "link" }),
366
+ icon: Ie({ class: "icon" }),
367
+ withIcon: Ie({ class: "with-icon" }),
368
+ back: $t({ class: "with-icon back-button" }),
369
+ smartBack: It({ class: "with-icon back-button" }),
370
+ circleIcon: Tt
371
+ }, b = r((e, t) => (Te[e.variant] || Te.primary)(e, t)), fa = r((e, t) => b({ ...e, variant: "withIcon", icon: u.loading, animation: "animate-spin" }, t)), Mt = r((e, t) => {
372
+ const s = e.margin ?? "my-5 mx-5", n = e.padding ?? "p-4", a = e.border ?? "border-border";
373
+ return e.hover && (e.class += " hover:shadow-lg hover:bg-muted/50"), o({
374
+ ...e,
375
+ // @ts-ignore
376
+ class: `rounded-lg ${a} bg-card text-card-foreground shadow-md min-w-[120px] min-h-[80px] ${s} ${n} ${e.class || ""}`
377
+ }, t);
378
+ }), Bt = r((e, t) => nt({
379
+ ...e,
380
+ // @ts-ignore
381
+ class: ` font-medium -mt-4 -mx-1 px-2 py-2 ${e.class || ""}`
382
+ }, t)), ga = r((e, t) => {
383
+ const s = e.border === "full" ? "border rounded-md" : "border-t";
384
+ return at({
385
+ ...e,
386
+ // @ts-ignore
387
+ class: `p-6 ${s} ${e.class || ""}`
388
+ }, [
389
+ // @ts-ignore
390
+ e.legend && Bt(e.legend),
391
+ o({ class: "flex flex-auto flex-col gap-y-6" }, t)
392
+ ]);
393
+ }), Pt = r((e, t) => {
394
+ const s = e.border === !0 ? "border-t" : "";
395
+ return o({
396
+ ...e,
397
+ // @ts-ignore
398
+ class: `grid grid-cols-1 gap-y-4 sm:grid-cols-[1fr_2fr] sm:gap-x-6 pt-8 ${s} ${e.class || ""}`
399
+ }, [
400
+ // @ts-ignore
401
+ e.label && o({
402
+ // @ts-ignore
403
+ ...e.labelProps,
404
+ // @ts-ignore
405
+ class: `flex flex-auto flex-col gap-y-1 ${e.labelProps?.class || ""}`
406
+ }, [
407
+ // @ts-ignore
408
+ Ee({ class: "text-base" }, e.label),
409
+ // @ts-ignore
410
+ e.description && k({ class: "text-sm text-muted-foreground" }, e.description)
411
+ ]),
412
+ // Controls container: grows to fill remaining space, spacing between items
413
+ o({ class: "flex flex-col gap-y-4" }, t)
414
+ ]);
415
+ }), zt = "flex h-10 w-full px-3 py-2 text-sm", B = "rounded-md border border-border bg-input", I = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background", D = "disabled:cursor-not-allowed disabled:opacity-50 [&:user-invalid]:border-destructive", A = "placeholder:text-muted-foreground", pe = `${zt} ${B} ${I} ${A} ${D}`, Ot = ({ id: e, checked: t, bind: s, required: n }) => ce({
416
+ id: e,
417
+ cache: "checkbox",
418
+ class: "absolute opacity-0 w-full h-full cursor-pointer pointer-events-none",
419
+ aria: {
420
+ checked: ["checked"]
421
+ },
422
+ required: n,
423
+ checked: t,
424
+ bind: s
425
+ }), Nt = () => g({ class: "absolute text-xs pointer-events-none" }, [
426
+ T(
427
+ "checked",
428
+ (e) => e ? Y({
429
+ class: "w-2 h-2 pointer-events-none",
430
+ html: u.check
431
+ }) : null
432
+ )
433
+ ]), Rt = ({ id: e, bind: t, checked: s, required: n, clickHandler: a }) => o({
434
+ class: `relative flex items-center justify-center w-5 h-5 transition-colors duration-200 hover:border-accent-foreground
435
+ rounded-md border
436
+ ${I}
437
+ ${D}`.trim(),
438
+ onState: [
439
+ "checked",
440
+ {
441
+ "bg-primary": !0,
442
+ "text-primary-foreground": !0,
443
+ "border-primary": !0
444
+ }
445
+ ],
446
+ role: "checkbox",
447
+ aria: {
448
+ checked: ["checked"]
449
+ },
450
+ tabIndex: 0,
451
+ click: a
452
+ }, [
453
+ Ot({ bind: t, checked: s, id: e, required: n }),
454
+ Nt()
455
+ ]), Ft = ({ id: e, label: t, clickHandler: s }) => V({
456
+ class: "text-base cursor-pointer",
457
+ htmlFor: e,
458
+ click: s
459
+ }, t), Lt = M(
460
+ {
461
+ /**
462
+ * This will initialize the state of the checkbox.
463
+ *
464
+ * @returns {object}
465
+ */
466
+ state() {
467
+ return {
468
+ // @ts-ignore
469
+ checked: this.checked ?? !1
470
+ };
471
+ },
472
+ /**
473
+ * This is added to check the checkbox after the component is rendered
474
+ * to see if the bind updated the checked value.
475
+ *
476
+ * @returns {void}
477
+ */
478
+ after() {
479
+ this.state.checked = this.checkbox.checked;
480
+ },
481
+ /**
482
+ * This will handle the click event for the checkbox.
483
+ *
484
+ * @param {object} e
485
+ * @returns {void}
486
+ */
487
+ clickHandler(e) {
488
+ e.preventDefault(), e.stopPropagation(), this.state.toggle("checked"), this.checkbox.checked = this.state.checked, typeof this.onChange == "function" && this.onChange(this.state.checked, this);
489
+ },
490
+ /**
491
+ * This will render the checkbox component.
492
+ *
493
+ * @returns {object}
494
+ */
495
+ render() {
496
+ const e = this.getId(), t = (s) => this.clickHandler(s);
497
+ return o({ class: `flex items-center gap-x-2 cursor-pointer ${this.class || ""}` }, [
498
+ Rt({
499
+ id: e,
500
+ // @ts-ignore
501
+ bind: this.bind,
502
+ // @ts-ignore
503
+ checked: this.state.checked,
504
+ // @ts-ignore
505
+ required: this.required,
506
+ // @ts-ignore
507
+ clickHandler: t
508
+ }),
509
+ // @ts-ignore
510
+ this.label && Ft({ id: e, label: this.label, clickHandler: t })
511
+ ]);
512
+ }
513
+ }
514
+ ), jt = (e) => {
515
+ if (!e || e.length === 0) return "";
516
+ const s = e.replace(/\D/g, "").match(/^(\d{0,3})(\d{0,3})(\d{0,4})$/);
517
+ return s ? s[2] ? `(${s[1]}) ${s[2]}${s[3] ? "-" + s[3] : ""}` : s[1] || "" : e;
518
+ }, At = (e) => {
519
+ const t = e.target, s = jt(t.value);
520
+ s && (t.value = s);
521
+ }, N = r((e) => p({
522
+ ...e,
523
+ // @ts-ignore
524
+ class: `${pe} ${e.class || ""}`.trim()
525
+ })), ma = r((e) => N({
526
+ ...e,
527
+ type: "tel",
528
+ // @ts-ignore
529
+ name: e.name || "Phone",
530
+ // @ts-ignore
531
+ label: e.label || "Phone",
532
+ placeholder: "(555) 555-5555",
533
+ // @ts-ignore
534
+ pattern: e.pattern || "\\(\\d{3}\\) \\d{3}-\\d{4}",
535
+ keyup: At
536
+ })), ba = r((e) => N({
537
+ ...e,
538
+ type: "email",
539
+ // @ts-ignore
540
+ name: e.name || "Email",
541
+ // @ts-ignore
542
+ label: e.label || "Email",
543
+ placeholder: "Email address"
544
+ })), xa = r((e) => ot({
545
+ ...e,
546
+ as: "textarea",
547
+ // @ts-ignore
548
+ class: `flex w-full h-24 px-3 py-2 text-sm ${B} ${I} ${A} ${D} ${e.class || ""}`.trim()
549
+ })), pa = (e = {}) => o({ class: "flex items-center gap-x-2" }, [
550
+ p({
551
+ ...e,
552
+ type: "radio",
553
+ class: "cursor-pointer appearance-none h-4 w-4 border rounded-full checked:border-primary checked:bg-primary focus:ring focus:ring-primary".trim()
554
+ }),
555
+ e.label && V({ forHTML: e.value, class: "cursor-pointer" }, e.label)
556
+ ]), ya = r((e) => p({
557
+ ...e,
558
+ type: "date",
559
+ // @ts-ignore
560
+ class: `${B} ${I} ${A} ${D} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
561
+ })), wa = r((e) => p({
562
+ ...e,
563
+ type: "time",
564
+ // @ts-ignore
565
+ class: `${B} ${I} ${A} ${D} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
566
+ })), va = r((e) => p({
567
+ ...e,
568
+ type: "datetime-local",
569
+ // @ts-ignore
570
+ class: `${B} ${I} ${A} ${D} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
571
+ })), ka = r((e) => p({
572
+ ...e,
573
+ type: "month",
574
+ // @ts-ignore
575
+ class: `${B} ${I} ${A} ${D} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
576
+ })), Ca = r((e) => p({
577
+ ...e,
578
+ type: "week",
579
+ // @ts-ignore
580
+ class: `${B} ${I} ${A} ${D} px-3 py-2 text-sm ring-offset-background ${e.class || ""}`.trim()
581
+ })), Sa = r((e) => N({
582
+ ...e,
583
+ type: "number"
584
+ })), $a = r((e) => N({
585
+ ...e,
586
+ type: "password"
587
+ }));
588
+ r((e) => N({
589
+ ...e,
590
+ type: "search"
591
+ }));
592
+ const Da = r((e) => N({
593
+ ...e,
594
+ type: "url"
595
+ })), Ia = r((e) => N({
596
+ ...e,
597
+ type: "hidden"
598
+ })), Ta = r((e) => p({
599
+ ...e,
600
+ type: "color",
601
+ // @ts-ignore
602
+ class: `${B} text-foreground p-0 ${D} ${e.class || ""}`.trim()
603
+ }));
604
+ r((e) => ce({
605
+ ...e,
606
+ // @ts-ignore
607
+ class: `flex h-4 w-4 text-foreground ${B} ${I} ${D} ${e.class || ""}`.trim()
608
+ }));
609
+ const Ht = "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground", Ma = r((e) => p({
610
+ ...e,
611
+ type: "file",
612
+ // @ts-ignore
613
+ class: `${pe} ${Ht} ${e.class || ""}`.trim()
614
+ })), Ba = O(
615
+ {
616
+ /**
617
+ * This will create the initial state of the RangeSlider.
618
+ *
619
+ * @returns {object}
620
+ */
621
+ state() {
622
+ return {
623
+ value: this.value ?? 0,
624
+ min: this.min ?? 0,
625
+ max: this.max ?? 100,
626
+ filledPercentage: this.getFillPercentage(this.value)
627
+ };
628
+ },
629
+ /**
630
+ * This will get the fill percentage of the range slider.
631
+ *
632
+ * @param {number} value
633
+ * @returns {number}
634
+ */
635
+ getFillPercentage(e) {
636
+ return (e - this.min) / (this.max - this.min) * 100;
637
+ },
638
+ /**
639
+ * This will render the RangeSlider component.
640
+ *
641
+ * @returns {object}
642
+ */
643
+ render() {
644
+ return o({ class: "relative w-full h-4 flex items-center" }, [
645
+ // Track
646
+ o({ class: "absolute h-2 w-full rounded-full bg-muted" }),
647
+ W(({ state: e }) => [
648
+ // Filled Track
649
+ o({
650
+ class: "absolute h-2 bg-primary rounded-full",
651
+ style: ["width: [[filledPercentage]]%", e]
652
+ }),
653
+ // Thumb
654
+ o({
655
+ class: `
656
+ absolute block h-5 w-5 rounded-full border-2 border-primary bg-background
657
+ ring-offset-background transition-colors focus-visible:outline-none
658
+ focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
659
+ disabled:pointer-events-none disabled:opacity-50 transform -translate-x-1/2
660
+ `.trim(),
661
+ style: ["left: [[filledPercentage]]%", e]
662
+ }),
663
+ // Hidden Range Input
664
+ p({
665
+ type: "range",
666
+ min: ["[[min]]", e],
667
+ max: ["[[max]]", e],
668
+ value: ["[[value]]", e],
669
+ // Incorporate your new classes here
670
+ class: `
671
+ absolute w-full h-full opacity-0 cursor-pointer
672
+ ${I}
673
+ ${D}
674
+ ${this.class || ""}
675
+ `.trim(),
676
+ bind: this.bind,
677
+ input: (t) => {
678
+ const s = Number(t.target.value);
679
+ this.state.value = s, this.state.filledPercentage = this.getFillPercentage(s), typeof this.change == "function" && this.change(s);
680
+ }
681
+ })
682
+ ])
683
+ ]);
684
+ }
685
+ }
686
+ ), Pa = r((e) => ({
687
+ tag: "select",
688
+ onCreated(t) {
689
+ e.options && ft.setupSelectOptions(t, e.options);
690
+ },
691
+ ...e,
692
+ // @ts-ignore
693
+ class: `${pe} ${e.class || ""}`.trim()
694
+ })), Et = r(({ src: e, alt: t, class: s, checkPath: n = !0 }) => !e || (s = s || "", n && e.indexOf(".") === -1 && e.indexOf("[[") === -1) ? null : de({
695
+ class: `absolute w-full h-full object-cover fadeIn ${s}`,
696
+ src: e,
697
+ alt: t,
698
+ load: (a) => a.target.style.visibility = "visible",
699
+ /**
700
+ * If there's an error loading the image, hide it.
701
+ */
702
+ error: (a) => a.target.style.visibility = "hidden"
703
+ })), Ut = (e) => !e || isNaN(e) ? null : e, Me = (e, t) => {
704
+ const s = e, n = 16, a = 2 * Math.PI * n, l = s / 100 * a, i = `
705
+ <svg class="w-40 h-40 mx-auto" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg">
706
+ <!-- Background Circle -->
707
+ <circle
708
+ cx="18"
709
+ cy="18"
710
+ r="${n}"
711
+ fill="none"
712
+ stroke="currentColor"
713
+ stroke-width="4"
714
+ class="bg-muted"
715
+ stroke-opacity="0.2"
716
+ />
717
+ <!-- Progress Circle -->
718
+ <circle
719
+ cx="18"
720
+ cy="18"
721
+ r="${n}"
722
+ fill="none"
723
+ stroke="currentColor"
724
+ stroke-width="4"
725
+ class="stroke-primary"
726
+ stroke-dasharray="${a}"
727
+ stroke-dashoffset="${a - l}"
728
+ stroke-linecap="round"
729
+ class="${t}"
730
+ />
731
+ <!-- Percentage Text -->
732
+ <text
733
+ x="18"
734
+ y="20"
735
+ class="text-[0.25em] font-medium fill-primary"
736
+ text-anchor="middle"
737
+ dominant-baseline="middle">
738
+ ${s}%
739
+ </text>
740
+ </svg>
741
+ `;
742
+ return o({
743
+ class: "circle-graph text-inherit",
744
+ html: i
745
+ });
746
+ }, za = r((e) => {
747
+ const t = e.progress || 0, s = e.class || "", n = Me(t, s);
748
+ return o({
749
+ class: "circle-graph-wrap",
750
+ onSet: [
751
+ // @ts-ignore
752
+ e.prop,
753
+ (a) => (a = Ut(a), a ? Me(a, s) : n)
754
+ ]
755
+ }, [n]);
756
+ }), Yt = () => W(({ state: e }) => o({
757
+ class: "absolute h-full rounded-full bg-primary transition-all duration-300",
758
+ style: ["width: [[progress]]%;", e]
759
+ })), Oa = O(
760
+ {
761
+ /**
762
+ * This will render the progress bar component.
763
+ *
764
+ * @returns {object}
765
+ */
766
+ render() {
767
+ return o({ class: "relative w-full h-4 rounded-full bg-muted" }, [
768
+ Yt()
769
+ ]);
770
+ },
771
+ /**
772
+ * This will initialize the state.
773
+ *
774
+ * @returns {object}
775
+ */
776
+ state() {
777
+ return {
778
+ progress: this.progress ?? 0
779
+ };
780
+ },
781
+ /**
782
+ * This will reset the progress bar.
783
+ *
784
+ * @returns {void}
785
+ */
786
+ reset() {
787
+ this.state.progress = 0;
788
+ },
789
+ /**
790
+ * This will update the progress bar from a file upload.
791
+ *
792
+ * @param {object} evt
793
+ * @returns {void}
794
+ */
795
+ uploadProgress(e) {
796
+ if (e.lengthComputable) {
797
+ const s = Math.round(e.loaded * 100 / e.total);
798
+ this.set(s);
799
+ }
800
+ },
801
+ /**
802
+ * This will set the progress of the progress bar.
803
+ *
804
+ * @param {number} progress
805
+ * @returns {void}
806
+ */
807
+ set(e) {
808
+ e < 0 && (e = 0), e > 100 && (e = 100), this.state.progress = e;
809
+ }
810
+ }
811
+ ), Na = r((e = {}) => {
812
+ const {
813
+ class: t = "",
814
+ background: s = !0,
815
+ blur: n = !0,
816
+ backgroundClass: a = "bg-background/95",
817
+ blurClass: l = "backdrop-blur",
818
+ zIndexClass: i = "z-9999",
819
+ style: c = ""
820
+ } = e, h = [
821
+ "sticky bottom-0 left-0 right-0 w-full",
822
+ i,
823
+ s ? a : "",
824
+ n ? l : "",
825
+ t
826
+ ].filter(Boolean).join(" "), m = `height: env(safe-area-inset-bottom, 0px);${c ? ` ${c}` : ""}`;
827
+ return o({
828
+ class: h,
829
+ style: m,
830
+ "aria-hidden": "true"
831
+ });
832
+ }), Ra = r((e = {}) => {
833
+ const {
834
+ class: t = "",
835
+ background: s = !0,
836
+ blur: n = !0,
837
+ backgroundClass: a = "bg-background/95",
838
+ blurClass: l = "backdrop-blur",
839
+ zIndexClass: i = "z-9999",
840
+ style: c = ""
841
+ } = e, h = [
842
+ "fixed top-0 left-0 right-0 w-full",
843
+ i,
844
+ s ? a : "",
845
+ n ? l : "",
846
+ t
847
+ ].filter(Boolean).join(" "), m = `height: env(safe-area-inset-top, 0px);${c ? ` ${c}` : ""}`;
848
+ return o({
849
+ class: h,
850
+ style: m,
851
+ "aria-hidden": "true"
852
+ });
853
+ }), Be = {
854
+ top: "bottom-full left-1/2 transform -translate-x-1/2 mb-2",
855
+ "top-right": "bottom-full left-full transform -translate-x-1 mb-2",
856
+ "top-left": "bottom-full right-full transform translate-x-1 mb-2",
857
+ bottom: "top-full left-1/2 transform -translate-x-1/2 mt-2",
858
+ "bottom-right": "top-full left-full transform -translate-x-1 mt-2",
859
+ "bottom-left": "top-full right-full transform translate-x-1 mt-2",
860
+ left: "top-1/2 right-full transform -translate-y-1/2 mr-2",
861
+ right: "top-1/2 left-full transform -translate-y-1/2 ml-2"
862
+ }, Vt = (e) => Be[String(e)] || Be.top, Fa = r(({ position: e = "top", content: t }, s) => {
863
+ const n = Vt(e);
864
+ return Array.isArray(s) === !1 && (s = [s]), o({ class: "relative group inline-block" }, [
865
+ ...s,
866
+ // Tooltip box
867
+ g({
868
+ class: `
869
+ absolute z-20 px-2 py-1 border text-sm bg-background rounded shadow-md opacity-0 whitespace-nowrap
870
+ group-hover:opacity-100 transition-opacity duration-200 ${n} pointer-events-none
871
+ `
872
+ }, t)
873
+ ]);
874
+ }), Pe = {
875
+ info: {
876
+ borderColor: "border-blue-500",
877
+ bgColor: "bg-muted/10",
878
+ iconColor: "text-blue-500"
879
+ },
880
+ warning: {
881
+ bgColor: "bg-muted/10",
882
+ borderColor: "border-warning",
883
+ iconColor: "text-warning"
884
+ },
885
+ destructive: {
886
+ bgColor: "bg-muted/10",
887
+ borderColor: "border-destructive",
888
+ iconColor: "text-red-500"
889
+ },
890
+ success: {
891
+ bgColor: "bg-muted/10",
892
+ borderColor: "border-emerald-500",
893
+ iconColor: "text-emerald-500"
894
+ },
895
+ default: {
896
+ borderColor: "border",
897
+ bgColor: "bg-muted/10",
898
+ iconColor: "text-muted-foreground"
899
+ }
900
+ }, Wt = (e, t) => o({ class: `flex items-center justify-center h-6 w-6 mr-3 ${t}` }, [
901
+ x({ size: "sm" }, e)
902
+ ]), qt = (e) => lt({ class: "font-semibold" }, e), Gt = (e) => k({ class: "text-sm text-muted-foreground" }, e), La = r(({ title: e, description: t, icon: s, type: n = "default" }) => {
903
+ const { borderColor: a, bgColor: l, iconColor: i } = Pe[n] || Pe.default;
904
+ return o({ class: `flex items-start p-4 border rounded-lg ${l} ${a}` }, [
905
+ // Icon and content
906
+ s && Wt(s, i),
907
+ o({ class: "flex flex-col" }, [
908
+ qt(e),
909
+ Gt(t)
910
+ ])
911
+ ]);
912
+ }), _t = (e, t) => {
913
+ const s = e ? e.getBoundingClientRect() : { top: 0, bottom: 0, left: 0 }, n = t.getBoundingClientRect(), a = 10, l = globalThis.scrollX, i = globalThis.scrollY;
914
+ let c = s.left + l, h = s.bottom + i;
915
+ const m = globalThis.innerHeight - s.bottom, v = s.top;
916
+ return c + n.width > globalThis.innerWidth && (c = globalThis.innerWidth - n.width - a), m < n.height && v > m ? h = s.top + i - n.height - a : m < n.height && (h = s.bottom + i - (n.height - m) - a), { x: c, y: h };
917
+ };
918
+ class te extends C {
919
+ /**
920
+ * This will set up the data.
921
+ *
922
+ * @returns {object}
923
+ */
924
+ setData() {
925
+ const t = this.parent.data || new z();
926
+ return t.set({
927
+ position: { x: 0, y: 0 }
928
+ }), t;
929
+ }
930
+ /**
931
+ * This will get the class size.
932
+ *
933
+ * @returns {string}
934
+ */
935
+ getSize() {
936
+ switch (this.size || "lg") {
937
+ // @ts-ignore
938
+ case "sm":
939
+ return "w-48";
940
+ // @ts-ignore
941
+ case "md":
942
+ return "w-64";
943
+ case "lg":
944
+ return "w-[250px]";
945
+ // @ts-ignore
946
+ case "xl":
947
+ return "w-96";
948
+ // @ts-ignore
949
+ case "2xl":
950
+ return "w-[400px]";
951
+ // @ts-ignore
952
+ case "fit":
953
+ return "w-fit";
954
+ // @ts-ignore
955
+ case "full":
956
+ return "w-full";
957
+ }
958
+ }
959
+ /**
960
+ * This will render the modal component.
961
+ *
962
+ * @returns {object}
963
+ */
964
+ render() {
965
+ const t = this.getSize();
966
+ return o({
967
+ class: `absolute inset-auto fadeIn mt-2 rounded-md p-0 shadow-lg bg-popover min-h-12 backdrop:bg-transparent text-inherit r z-30 ${t}`,
968
+ popover: "manual",
969
+ toggle: (s, { state: n }) => s.newState === "closed" ? n.open = !1 : null,
970
+ style: "top: [[position.y]]px; left: [[position.x]]px"
971
+ // @ts-ignore
972
+ }, this.children);
973
+ }
974
+ /**
975
+ * This will setup the states.
976
+ *
977
+ * @returns {object}
978
+ */
979
+ setupStates() {
980
+ return {
981
+ open: {
982
+ id: this.parent.getId(),
983
+ callBack: (n) => {
984
+ this.state.open === !1 && this.destroy();
985
+ }
986
+ }
987
+ };
988
+ }
989
+ /**
990
+ * Updates the dropdown position.
991
+ *
992
+ * @returns {void}
993
+ */
994
+ updatePosition() {
995
+ const t = this.button ?? null, s = this.panel, n = _t(t, s);
996
+ this.data.position = n;
997
+ }
998
+ /**
999
+ * This will run after the setup.
1000
+ *
1001
+ * @returns {void}
1002
+ */
1003
+ afterSetup() {
1004
+ this.panel.showPopover(), this.updatePosition();
1005
+ }
1006
+ /**
1007
+ * This will check if the element clicked was in the
1008
+ * component of the button.
1009
+ *
1010
+ * @param {object} element
1011
+ * @returns {boolean}
1012
+ */
1013
+ isOutsideClick(t) {
1014
+ return !this.panel.contains(t) && this.button && !this.button.contains(t);
1015
+ }
1016
+ /**
1017
+ * This will set up the events.
1018
+ *
1019
+ * @returns {array}
1020
+ */
1021
+ setupEvents() {
1022
+ return [
1023
+ ["click", document, (t) => {
1024
+ this.isOutsideClick(t.target) && (this.state.open = !1);
1025
+ }],
1026
+ ["resize", globalThis, (t) => this.updatePosition()],
1027
+ ["scroll", document, (t) => this.updatePosition()]
1028
+ ];
1029
+ }
1030
+ /**
1031
+ * This will override the set up to use the app shell.
1032
+ *
1033
+ * @param {object} container
1034
+ */
1035
+ setContainer(t) {
1036
+ this.container = app.root;
1037
+ }
1038
+ /**
1039
+ * This will hide the popover before destroying.
1040
+ *
1041
+ * @returns {void}
1042
+ */
1043
+ beforeDestroy() {
1044
+ this?.panel?.hidePopover();
1045
+ }
1046
+ }
1047
+ const Kt = r((e, t) => o({ ...e, class: "flex flex-auto flex-col gap-y-2" }, t)), Qt = r((e, t) => V({ ...e, class: "flex auto text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" }, t)), Jt = r((e, t) => k({ ...e, class: "text-sm text-muted-foreground italic" }, t)), Zt = r((e, t) => k({ ...e, class: "text-sm text-destructive" }, t)), ja = r((e, t = []) => Mt({ class: "flex flex-auto flex-col gap-y-0", margin: "m-0", padding: "p-0" }, [
1048
+ // @ts-ignore
1049
+ e.title && J({ class: "text-lg font-semibold py-4 px-6" }, e.title),
1050
+ // @ts-ignore
1051
+ e.description && k({ class: "text-sm text-muted-foreground pb-4 px-6 max-w-[700px]" }, e.description),
1052
+ ...t
1053
+ ])), Aa = r((e, t = []) => (
1054
+ // @ts-ignore
1055
+ Pt({ label: e.label, description: e.description, class: "py-4 px-6", border: e.border }, [
1056
+ o({ class: "flex flex-col gap-y-6" }, t)
1057
+ ])
1058
+ )), Ha = r((e, t = []) => {
1059
+ const s = e.border ? "border-t" : "";
1060
+ return o({ ...e, class: `flex flex-col pb-4 px-6 gap-y-4 ${s} ${e.class || ""}` }, t);
1061
+ }), Xt = (e) => e.tag === "input" || e.tag === "select" || e.tag === "textarea", qe = (e, t, s) => e.map((n) => !n || (n.children && n.children.length > 0 && (n.children = qe(n.children, t, s)), !n.required) ? n : Xt(n) ? {
1062
+ ...n,
1063
+ aria: {
1064
+ invalid: ["hasError"]
1065
+ },
1066
+ invalid: s,
1067
+ input: t
1068
+ } : n), es = r((e, t) => {
1069
+ const a = qe(t, (l) => {
1070
+ l.target.checkValidity() && e.setError(null);
1071
+ }, (l) => {
1072
+ e.setError(l.target.validationMessage);
1073
+ });
1074
+ return o({
1075
+ ...e,
1076
+ class: "w-full"
1077
+ }, a);
1078
+ }), Ea = O(
1079
+ {
1080
+ /**
1081
+ * The initial state of the FormField.
1082
+ *
1083
+ * @member {object} state
1084
+ * @returns {object}
1085
+ */
1086
+ state() {
1087
+ return {
1088
+ error: null,
1089
+ hasError: !1,
1090
+ value: this.defaultValue ?? ""
1091
+ };
1092
+ },
1093
+ /**
1094
+ * Renders the FormField component.
1095
+ *
1096
+ * @returns {object}
1097
+ */
1098
+ render() {
1099
+ const e = this.name, t = this.getId(`${e}`), { label: s, description: n } = this, a = (l) => {
1100
+ this.state.error = l, this.state.hasError = !!l;
1101
+ };
1102
+ return o({ class: "flex flex-auto gap-y-4" }, [
1103
+ Kt([
1104
+ Qt({ htmlFor: t }, s),
1105
+ es({
1106
+ id: t,
1107
+ name: e,
1108
+ value: this.state.value,
1109
+ setError: a
1110
+ }, this.children),
1111
+ n && Jt({ id: this.getId("description") }, n),
1112
+ o({ onState: ["error", (l) => l && Zt(l)] })
1113
+ ])
1114
+ ]);
1115
+ }
1116
+ }
1117
+ ), ts = (e, t, s = null) => {
1118
+ e.target.checkValidity() && (e.preventDefault(), s && s(e, t));
1119
+ }, Ge = r(
1120
+ (e, t) => (
1121
+ // @ts-ignore
1122
+ rt({ ...e, submit: (s, n) => ts(s, n, e.submit), class: `w-full ${e.class ?? ""}` }, t)
1123
+ )
1124
+ ), Ua = r((e, t) => (
1125
+ // @ts-ignore
1126
+ o({ ...e, class: `flex flex-auto flex-col gap-y-6 p-4 md:p-6 divide-y ${e.class || ""}` }, t)
1127
+ )), Ya = r((e, t = []) => o({ class: "flex flex-col gap-y-3 py-4" }, [
1128
+ // @ts-ignore
1129
+ e.title && J({ class: "font-semibold" }, e.title),
1130
+ ...t
1131
+ ])), Va = (e, t) => o({ class: "flex justify-between" }, [
1132
+ g({ class: "text-muted-foreground" }, e),
1133
+ g(t)
1134
+ ]), Wa = (e, t) => o({ class: "flex" }, [
1135
+ g({ class: "text-muted-foreground mr-8 w-24 truncate text-nowrap" }, e),
1136
+ g(t)
1137
+ ]), ss = r(({ title: e, description: t, back: s, icon: n, options: a = [] }) => Z({ class: "modal-header bg-background/80 backdrop-blur-md sticky flex flex-none items-center py-4 px-6 z-10 min-w-0" }, [
1138
+ /**
1139
+ * Back Button (Mobile Only)
1140
+ */
1141
+ s && b({
1142
+ variant: "icon",
1143
+ icon: u.arrows.left,
1144
+ class: "mr-2 p-0 flex sm:hidden",
1145
+ click: (l, i) => i.close()
1146
+ }),
1147
+ /**
1148
+ * Icon Container
1149
+ */
1150
+ n && o({ class: "mr-2 w-12 h-12 rounded-full bg-muted flex flex-none items-center justify-center" }, [
1151
+ x({ size: "md" }, n)
1152
+ ]),
1153
+ o({ class: "flex flex-auto flex-row justify-between ml-2 gap-2 min-w-0" }, [
1154
+ o({ class: "flex flex-auto flex-col min-w-0" }, [
1155
+ J({ class: "text-lg font-semibold m-0 truncate" }, e),
1156
+ t && o({ class: "text-sm text-muted-foreground truncate" }, t)
1157
+ ]),
1158
+ o({ class: "flex flex-none items-center gap-2" }, a)
1159
+ ])
1160
+ ])), qa = r((e, t) => {
1161
+ const s = e.class?.includes("drawer");
1162
+ return o({
1163
+ popover: "manual",
1164
+ // @ts-ignore
1165
+ class: `modal ${s ? "" : "m-auto top-0 right-0 bottom-0 left-0"} ${s ? "" : "h-full max-h-screen"} fixed z-20 grid w-full gap-2 lg:border bg-background text-foreground shadow-xl wrap-break-words p-0 overflow-y-auto ${e.class}`,
1166
+ click: (l, i) => {
1167
+ l.target === i.panel && (l.preventDefault(), l.stopPropagation(), i.state.open = !1);
1168
+ }
1169
+ }, [
1170
+ Ge({
1171
+ class: "modal-content relative bg-background z-1 flex flex-auto flex-col gap-y-4 min-w-0",
1172
+ // @ts-ignore
1173
+ submit: (l, i) => e.onSubmit && e.onSubmit(i),
1174
+ cache: "modalContent",
1175
+ // @ts-ignore
1176
+ ...e.gestureHandlers
1177
+ }, [
1178
+ ss(e),
1179
+ o({ class: "modal-body flex grow flex-col py-0 px-6 z-0", cache: "modalBody" }, t),
1180
+ // @ts-ignore
1181
+ !e.hideFooter && ue({ class: "modal-footer sticky bottom-0 bg-background/80 backdrop-blur-md flex flex-none justify-between py-4 px-6 z-10" }, e.buttons)
1182
+ ])
1183
+ ]);
1184
+ }), ze = {
1185
+ info: {
1186
+ bgColor: "bg-muted/10",
1187
+ borderColor: "border-blue-500",
1188
+ iconColor: "text-blue-500"
1189
+ },
1190
+ warning: {
1191
+ bgColor: "bg-muted/10",
1192
+ borderColor: "border-warning",
1193
+ iconColor: "text-warning"
1194
+ },
1195
+ destructive: {
1196
+ bgColor: "bg-muted/10",
1197
+ borderColor: "border-destructive",
1198
+ iconColor: "text-red-500"
1199
+ },
1200
+ success: {
1201
+ bgColor: "bg-muted/10",
1202
+ borderColor: "border-emerald-500",
1203
+ iconColor: "text-emerald-500"
1204
+ },
1205
+ default: {
1206
+ bgColor: "bg-muted/10",
1207
+ borderColor: "border",
1208
+ iconColor: "text-muted-foreground"
1209
+ }
1210
+ }, ns = (e) => Z({ class: "flex justify-center" }, [
1211
+ he({ class: "text-lg font-bold mb-0" }, e)
1212
+ ]), as = r(({ href: e, class: t }, s) => Ue({
1213
+ class: `bg-popover text-popover-foreground relative flex flex-auto flex-col justify-start shadow-lg pointer-events-auto p-4 border rounded-md min-w-[340px] max-w-[450px] mt-4 ${t}`,
1214
+ href: e,
1215
+ animateIn: "pullRightIn",
1216
+ animateOut: "pullRight",
1217
+ role: "alert"
1218
+ }, s)), os = r(({ close: e, class: t }, s) => o({
1219
+ class: `pullRightIn bg-popover text-popover-foreground relative flex flex-auto flex-col justify-start shadow-lg pointer-events-auto p-4 border rounded-md min-w-[340px] max-w-[450px] mt-4 ${t}`,
1220
+ click: () => e(),
1221
+ animateIn: "pullRightIn",
1222
+ animateOut: "pullRight",
1223
+ role: "alert"
1224
+ }, s));
1225
+ class Ga extends C {
1226
+ /**
1227
+ * This will declare the props for the compiler.
1228
+ *
1229
+ * @returns {void}
1230
+ */
1231
+ declareProps() {
1232
+ this.secondaryAction = null, this.primaryAction = null, this.primary = !1, this.secondary = !1, this.title = null, this.description = null, this.icon = null, this.onClick = null;
1233
+ }
1234
+ /**
1235
+ * This will be called when the component is created.
1236
+ *
1237
+ * @returns {void}
1238
+ */
1239
+ onCreated() {
1240
+ this.duration = this.duration || 4e3;
1241
+ }
1242
+ /**
1243
+ * This will render the component.
1244
+ *
1245
+ * @returns {object}
1246
+ */
1247
+ render() {
1248
+ const { bgColor: t, borderColor: s, iconColor: n } = this.getTypeStyles(), a = this.href || null, l = this.getChildren(n);
1249
+ return a ? as({
1250
+ href: a,
1251
+ class: `${t} ${s}`
1252
+ }, l) : os({
1253
+ close: this.close.bind(this),
1254
+ class: `${t} ${s}`
1255
+ }, l);
1256
+ }
1257
+ /**
1258
+ * This will be called after the component is set up.
1259
+ *
1260
+ * @returns {void}
1261
+ */
1262
+ afterSetup() {
1263
+ const t = this.duration;
1264
+ t !== "infinite" && (this.timer = new mt(t, this.close.bind(this)), this.timer.start());
1265
+ }
1266
+ /**
1267
+ * This will get the style properties based on the notification type.
1268
+ *
1269
+ * @returns {object}
1270
+ */
1271
+ getTypeStyles() {
1272
+ const t = this.type || "default";
1273
+ return ze[t] || ze.default;
1274
+ }
1275
+ /**
1276
+ * This will get the buttons for the notification.
1277
+ *
1278
+ * @returns {array}
1279
+ */
1280
+ getButtons() {
1281
+ return [
1282
+ o({ class: "flex flex-row mt-6 gap-2" }, [
1283
+ this.secondary && b({ variant: "outline", click: () => this.secondaryAction && this.secondaryAction() }, this.secondary),
1284
+ this.primary && b({ click: () => this.primaryAction && this.primaryAction() }, this.primary)
1285
+ ])
1286
+ ];
1287
+ }
1288
+ /**
1289
+ * This will get the children for the notification.
1290
+ *
1291
+ * @param {string} iconColor
1292
+ * @returns {array}
1293
+ */
1294
+ getChildren(t) {
1295
+ return [
1296
+ o({ class: "flex items-start" }, [
1297
+ this.icon && o({ class: `mr-4 ${t}` }, [
1298
+ x({ size: "md" }, this.icon)
1299
+ ]),
1300
+ o({ class: "flex flex-auto flex-col" }, [
1301
+ o({ class: "flex flex-auto flex-row items-center w-full pr-12" }, [
1302
+ this.title && ns(this.title)
1303
+ ]),
1304
+ k({ class: "text-base text-muted-foreground m-0 pr-12" }, this.description),
1305
+ (this.primary || this.secondary) && ue({ class: "margin-top-24 flex align-center" }, this.getButtons())
1306
+ ])
1307
+ ]),
1308
+ b({
1309
+ class: "absolute top-[12px] right-[12px]",
1310
+ variant: "icon",
1311
+ icon: u.x,
1312
+ click: this.close.bind(this)
1313
+ })
1314
+ ];
1315
+ }
1316
+ /**
1317
+ * This will close the notification.
1318
+ *
1319
+ * @param {object} e The event object.
1320
+ * @returns {void}
1321
+ */
1322
+ close(t) {
1323
+ t && t.stopPropagation(), this.duration !== "infinite" && this.timer.stop(), this.onClick && this.onClick(), this.destroy();
1324
+ }
1325
+ }
1326
+ const Oe = globalThis.matchMedia, ae = r(({ value: e, label: t, icon: s }) => w({
1327
+ class: 'text-sm gap-1 font-medium leading-none disabled:cursor-not-allowed disabled:opacity-70 flex flex-col items-center justify-between rounded-md border-2 bg-popover p-4 hover:bg-accent hover:text-accent-foreground data-[state="active"]:border-primary [&:has([data-state="active"])]:border-primary',
1328
+ onState: ["method", { active: e }],
1329
+ dataSet: ["method", ["state", e, "active"]],
1330
+ click: (n, { state: a }) => {
1331
+ a.method = e, localStorage.setItem("theme", e), e === "system" && localStorage.removeItem("theme"), ls(e);
1332
+ }
1333
+ }, [
1334
+ x({}, s),
1335
+ g(t)
1336
+ ])), ls = (e) => {
1337
+ const t = document.documentElement;
1338
+ if (e === "system" && (e = globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light"), Oe && !Oe("(prefers-color-scheme: " + e + ")").matches) {
1339
+ t.classList.add(e);
1340
+ return;
1341
+ }
1342
+ const s = e === "light" ? "dark" : "light";
1343
+ t.classList.remove(s);
1344
+ }, _a = M(
1345
+ {
1346
+ /**
1347
+ * This will render the component.
1348
+ *
1349
+ * @returns {object}
1350
+ */
1351
+ render() {
1352
+ return o({ class: "flex flex-auto flex-col" }, [
1353
+ o({ class: "grid grid-cols-3 gap-4" }, [
1354
+ ae({ label: "System", value: "system", icon: u.adjustments.horizontal }),
1355
+ ae({ label: "Light", value: "light", icon: u.sun }),
1356
+ ae({ label: "Dark", value: "dark", icon: u.moon })
1357
+ ])
1358
+ ]);
1359
+ },
1360
+ /**
1361
+ * This will setup the states.
1362
+ *
1363
+ * @returns {object}
1364
+ */
1365
+ state() {
1366
+ return {
1367
+ method: globalThis.localStorage.getItem("theme") ?? "system"
1368
+ };
1369
+ }
1370
+ }
1371
+ ), Ka = O(
1372
+ {
1373
+ /**
1374
+ * The initial state of the Toggle.
1375
+ *
1376
+ * @returns {object}
1377
+ */
1378
+ state() {
1379
+ return {
1380
+ active: this.active ?? !1
1381
+ };
1382
+ },
1383
+ /**
1384
+ * This is added to check the checkbox after the component is rendered.
1385
+ * to see if the bind updated the checked value.
1386
+ *
1387
+ * @returns {void}
1388
+ */
1389
+ after() {
1390
+ this.state.active = this.checkbox.checked;
1391
+ },
1392
+ /**
1393
+ * Renders the Toggle component.
1394
+ *
1395
+ * @returns {object}
1396
+ */
1397
+ render() {
1398
+ return w({
1399
+ class: "relative inline-flex h-6 w-11 min-w-11 items-center rounded-full bg-muted transition-colors focus:outline-none",
1400
+ onState: ["active", { "bg-primary": !0, "bg-muted": !1 }],
1401
+ click: (t, { state: s }) => {
1402
+ s.toggle("active"), this.checkbox.checked = s.active, this.change && this.change(s.active, t, this);
1403
+ }
1404
+ }, [
1405
+ ce({
1406
+ cache: "checkbox",
1407
+ class: "opacity-0 absolute top-0 left-0 bottom-0 right-0 w-full h-full",
1408
+ /**
1409
+ * This will add the default checked before binding.
1410
+ * If binding it will override the default checked value.
1411
+ */
1412
+ checked: this.state.active,
1413
+ bind: this.bind,
1414
+ required: this.required
1415
+ }),
1416
+ g({
1417
+ class: "absolute h-5 w-5 bg-background rounded-full shadow-md transform transition-transform",
1418
+ onState: ["active", { "translate-x-[22px]": !0, "translate-x-[2px]": !1 }]
1419
+ })
1420
+ ]);
1421
+ }
1422
+ }
1423
+ ), rs = r(({ src: e, alt: t }) => !e || e.indexOf(".") === -1 && e.indexOf("[[") === -1 ? null : Et({
1424
+ src: e,
1425
+ alt: t,
1426
+ class: "rounded-full"
1427
+ })), is = (e) => e && (Array.isArray(e) && (e = e.join(" ")), typeof e != "string" && (e = String(e)), e.split(" ").map((t) => t.charAt(0)).join("").toUpperCase()), _e = (e) => !e || e.length < 2 ? e : is(e), cs = (e) => g([e, (t, s) => {
1428
+ s.textContent = _e(t);
1429
+ }]), Ne = {
1430
+ xs: "h-6 w-6",
1431
+ sm: "h-8 w-8",
1432
+ md: "h-12 w-12",
1433
+ lg: "h-16 w-16",
1434
+ xl: "h-24 w-24",
1435
+ "2xl": "h-32 w-32",
1436
+ "3xl": "h-48 w-48",
1437
+ "4xl": "h-64 w-64",
1438
+ default: "h-12 w-12"
1439
+ }, Re = {
1440
+ xs: "text-[7px]",
1441
+ sm: "text-xs",
1442
+ md: "text-base",
1443
+ lg: "text-xl",
1444
+ xl: "text-2xl",
1445
+ "2xl": "text-3xl",
1446
+ "3xl": "text-4xl",
1447
+ "4xl": "text-5xl",
1448
+ default: "text-base"
1449
+ }, ds = (e) => Ne[e] || Ne.default, us = (e) => Re[e] || Re.default, hs = (e, t = null, s = "md") => {
1450
+ const n = _e(String(e)), a = us(s);
1451
+ return o(
1452
+ {
1453
+ class: `
1454
+ flex items-center justify-center w-full h-full rounded-full
1455
+ bg-muted text-muted-foreground font-medium
1456
+ ${a}
1457
+ `
1458
+ },
1459
+ [
1460
+ t ? cs(t) : g({ class: "uppercase" }, n)
1461
+ ]
1462
+ );
1463
+ }, fs = r(({ src: e, alt: t, fallbackText: s, watcherFallback: n, size: a }) => {
1464
+ const l = ds(a);
1465
+ return o(
1466
+ {
1467
+ class: `relative flex items-center justify-center ${l}`
1468
+ },
1469
+ [
1470
+ rs({ src: e, alt: t }),
1471
+ hs(s, n, a)
1472
+ ]
1473
+ );
1474
+ }), gs = (e) => e.indexOf(".") === -1 && e.indexOf("[[") === -1 && e.indexOf("blob:") === -1, Qa = M(
1475
+ {
1476
+ /**
1477
+ * Get the initial state for the component.
1478
+ *
1479
+ * @returns {object} Initial state for the component
1480
+ */
1481
+ state() {
1482
+ return {
1483
+ // @ts-ignore
1484
+ loaded: !!this.src
1485
+ };
1486
+ },
1487
+ /**
1488
+ * This will open the file browse dialog.
1489
+ *
1490
+ * @returns {void}
1491
+ */
1492
+ openFileBrowse() {
1493
+ const e = this.input;
1494
+ e && (e.value = "", j.trigger("click", e));
1495
+ },
1496
+ /**
1497
+ * Get the URL for the uploaded file.
1498
+ *
1499
+ * @param {File} file - The file to get the URL for.
1500
+ * @returns {string} The object URL for the file.
1501
+ */
1502
+ getFileUrl(e) {
1503
+ return this.url && URL.revokeObjectURL(this.url), this.url = URL.createObjectURL(e);
1504
+ },
1505
+ /**
1506
+ * Render the component.
1507
+ *
1508
+ * @returns {object} Rendered component
1509
+ */
1510
+ render() {
1511
+ const e = "image-upload", t = this.onChange || null;
1512
+ return o({ class: "flex-none items-center" }, [
1513
+ p({
1514
+ id: e,
1515
+ cache: "input",
1516
+ type: "file",
1517
+ accept: "image/*",
1518
+ class: "hidden",
1519
+ change: (s) => {
1520
+ const n = s.target.files?.[0];
1521
+ n && t && (this.state.loaded = !1, t(n, this.parent), this.src = this.getFileUrl(n), this.state.loaded = !0);
1522
+ }
1523
+ }),
1524
+ o({
1525
+ class: "relative w-32 h-32 rounded-full border flex items-center justify-center cursor-pointer hover:bg-muted transition-colors duration-150 overflow-hidden group",
1526
+ click: (s) => {
1527
+ s.preventDefault(), s.stopPropagation(), this.openFileBrowse();
1528
+ }
1529
+ }, [
1530
+ T("loaded", (s) => s === !1 || gs(this.src) ? V({
1531
+ htmlFor: e,
1532
+ class: "z-10 flex flex-col items-center justify-center text-sm text-muted-foreground group-hover:text-primary"
1533
+ }, [
1534
+ ie(u.upload),
1535
+ o("Upload Image")
1536
+ ]) : de({
1537
+ // @ts-ignore
1538
+ src: this.src,
1539
+ class: "absolute inset-0 w-full h-full object-cover rounded-full"
1540
+ }))
1541
+ ])
1542
+ ]);
1543
+ }
1544
+ }
1545
+ ), Ja = M(
1546
+ {
1547
+ /**
1548
+ * Get the initial state for the component.
1549
+ *
1550
+ * @returns {object} Initial state for the component
1551
+ */
1552
+ state() {
1553
+ return {
1554
+ // @ts-ignore
1555
+ loaded: !!this.src
1556
+ };
1557
+ },
1558
+ /**
1559
+ * This will open the file browse dialog.
1560
+ *
1561
+ * @returns {void}
1562
+ */
1563
+ openFileBrowse() {
1564
+ const e = this.input;
1565
+ e && (e.value = "", j.trigger("click", e));
1566
+ },
1567
+ /**
1568
+ * Get the URL for the uploaded file.
1569
+ *
1570
+ * @param {File} file - The file to get the URL for.
1571
+ * @returns {string} The object URL for the file.
1572
+ */
1573
+ getFileUrl(e) {
1574
+ return this.url && URL.revokeObjectURL(this.url), this.url = URL.createObjectURL(e);
1575
+ },
1576
+ /**
1577
+ * Render the component.
1578
+ *
1579
+ * @returns {object} Rendered component
1580
+ */
1581
+ render() {
1582
+ const e = "logo-upload", t = this.onChange || null;
1583
+ return o({ class: "flex-none items-center" }, [
1584
+ p({
1585
+ id: e,
1586
+ cache: "input",
1587
+ type: "file",
1588
+ accept: "image/*",
1589
+ class: "hidden",
1590
+ change: (s) => {
1591
+ const n = s.target.files?.[0];
1592
+ n && t && (this.state.loaded = !1, t(n, this.parent), this.src = this.getFileUrl(n), this.state.loaded = !0);
1593
+ }
1594
+ }),
1595
+ o({
1596
+ class: "relative w-32 h-32 rounded-full border flex items-center justify-center cursor-pointer hover:bg-muted transition-colors duration-150 overflow-hidden group",
1597
+ click: (s) => {
1598
+ s.preventDefault(), s.stopPropagation(), this.openFileBrowse();
1599
+ }
1600
+ }, [
1601
+ T(
1602
+ "loaded",
1603
+ (s) => s ? de({
1604
+ // @ts-ignore
1605
+ src: this.src,
1606
+ class: "absolute inset-0 w-full h-full object-cover rounded-full"
1607
+ }) : V({
1608
+ htmlFor: e,
1609
+ class: "z-10 flex flex-col items-center justify-center text-sm text-muted-foreground group-hover:text-primary"
1610
+ }, [
1611
+ x({}, u.upload),
1612
+ o("Upload logo")
1613
+ ])
1614
+ )
1615
+ ])
1616
+ ]);
1617
+ },
1618
+ /**
1619
+ * Cleanup before destroying the component.
1620
+ *
1621
+ * @returns {void}
1622
+ */
1623
+ destroy() {
1624
+ this.input = null;
1625
+ }
1626
+ }
1627
+ ), ms = (e, t) => Ue(
1628
+ {
1629
+ href: e,
1630
+ "aria-current": t === "Breadcrumb" && "page",
1631
+ // Only set aria-current on the last item
1632
+ class: "text-muted-foreground font-medium hover:text-foreground"
1633
+ },
1634
+ [g(t)]
1635
+ ), bs = () => x({
1636
+ class: "mx-3 text-muted-foreground",
1637
+ "aria-hidden": !0,
1638
+ size: "xs"
1639
+ }, u.chevron.single.right), xs = (e) => o({ class: "flex items-center" }, [
1640
+ e.href ? ms(e.href, e.label) : g(e.label),
1641
+ e.separator && bs()
1642
+ ]), Za = M(
1643
+ {
1644
+ /**
1645
+ * Set initial data
1646
+ *
1647
+ * @returns {Data}
1648
+ */
1649
+ setData() {
1650
+ return new z({
1651
+ // @ts-ignore
1652
+ items: this.items || []
1653
+ });
1654
+ },
1655
+ /**
1656
+ * Render Breadcrumb Component
1657
+ *
1658
+ * @returns {object}
1659
+ */
1660
+ render() {
1661
+ const e = this.data.items.length - 1;
1662
+ return fe(
1663
+ {
1664
+ "aria-label": "Breadcrumb",
1665
+ class: "flex items-center gap-x-1 text-sm"
1666
+ },
1667
+ [
1668
+ o({
1669
+ role: "list",
1670
+ class: "flex items-center",
1671
+ for: ["items", (t, s) => xs({
1672
+ href: t.href,
1673
+ label: t.label,
1674
+ separator: s < e
1675
+ })]
1676
+ })
1677
+ ]
1678
+ );
1679
+ }
1680
+ }
1681
+ ), Fe = {
1682
+ xs: "h-1 w-1",
1683
+ sm: "h-2 w-2",
1684
+ md: "h-4 w-4",
1685
+ lg: "h-8 w-8",
1686
+ xl: "h-12 w-12",
1687
+ "2xl": "h-16 w-16",
1688
+ "3xl": "h-24 w-24",
1689
+ default: "h-4 w-4"
1690
+ }, ps = (e) => Fe[e] || Fe.default, ys = ({ index: e, size: t }) => o({ class: `${t} rounded-full bg-muted cursor-pointer` }, [
1691
+ g({
1692
+ class: "block w-full h-full rounded-full transition-colors",
1693
+ onSet: ["activeIndex", {
1694
+ "bg-primary": e,
1695
+ "shadow-md": e
1696
+ }],
1697
+ click: (s, { data: n, onClick: a }) => {
1698
+ n.activeIndex = e, a && a(e);
1699
+ }
1700
+ })
1701
+ ]), ws = (e, t) => Array.from({ length: e }, (s, n) => ys({
1702
+ index: n,
1703
+ size: t
1704
+ })), Xa = M(
1705
+ {
1706
+ /**
1707
+ * Defines component data (props).
1708
+ *
1709
+ * @returns {Data}
1710
+ */
1711
+ setData() {
1712
+ return new z({
1713
+ // @ts-ignore
1714
+ count: this.count || 4,
1715
+ // total dots
1716
+ // @ts-ignore
1717
+ activeIndex: this.activeIndex || 0
1718
+ });
1719
+ },
1720
+ /**
1721
+ * Renders the dots.
1722
+ *
1723
+ * @returns {object}
1724
+ */
1725
+ render() {
1726
+ const e = this.gap || "gap-2", t = ps(this.size || "sm"), s = ws(this.data.count, t);
1727
+ return o(
1728
+ { class: "flex justify-center items-center py-2" },
1729
+ [
1730
+ o({ class: `flex ${e}` }, s)
1731
+ ]
1732
+ );
1733
+ }
1734
+ }
1735
+ ), vs = ({ toggleDropdown: e }) => w(
1736
+ {
1737
+ cache: "button",
1738
+ class: "relative z-2 inline-flex items-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border bg-input hover:bg-muted h-10 px-4 py-2 justify-between",
1739
+ click: e
1740
+ },
1741
+ [
1742
+ g({ onState: ["selectedLabel", (t) => t || "Select item..."] }),
1743
+ x({ size: "sm" }, u.chevron.upDown)
1744
+ ]
1745
+ ), ks = (e, t, s) => ge({
1746
+ class: "flex flex-auto items-center cursor-pointer p-2 hover:bg-muted/50 rounded-sm",
1747
+ click: () => t(e),
1748
+ onState: [s, "selectedValue", { "bg-secondary": e.value }]
1749
+ }, [
1750
+ e.icon && g({ class: "mr-2 flex items-baseline" }, [x({ size: "xs" }, e.icon)]),
1751
+ g({ class: "text-base font-normal" }, e.label)
1752
+ ]), Cs = (e, t) => o({ class: "w-full border rounded-md" }, [
1753
+ X({ class: "max-h-60 overflow-y-auto p-2 grid gap-1", for: ["items", (s) => ks(s, e, t)] })
1754
+ ]), Ss = ({ onSelect: e, state: t }) => o({ class: "flex flex-auto flex-col" }, [
1755
+ T(
1756
+ "open",
1757
+ (s, n, a) => s ? new te({
1758
+ cache: "dropdown",
1759
+ parent: a,
1760
+ button: a.button
1761
+ }, [
1762
+ Cs(e, t)
1763
+ ]) : null
1764
+ )
1765
+ ]), eo = M(
1766
+ {
1767
+ /**
1768
+ * This will set up the data.
1769
+ *
1770
+ * @returns {Data}
1771
+ */
1772
+ setData() {
1773
+ return new z({
1774
+ // @ts-ignore
1775
+ items: this.items || []
1776
+ });
1777
+ },
1778
+ /**
1779
+ * This will set up the states.
1780
+ *
1781
+ * @returns {object}
1782
+ */
1783
+ state() {
1784
+ return {
1785
+ open: !1,
1786
+ selectedLabel: "",
1787
+ selectedValue: ""
1788
+ };
1789
+ },
1790
+ /**
1791
+ * This will set the state item.
1792
+ *
1793
+ * @param {object} item
1794
+ * @returns {void}
1795
+ */
1796
+ setStateItem(e) {
1797
+ const t = this.state;
1798
+ t.selectedValue = e.value, t.selectedLabel = e.label, t.open = !1;
1799
+ },
1800
+ /**
1801
+ * Handles the selection of an item.
1802
+ *
1803
+ * @param {object} item
1804
+ * @returns {void}
1805
+ */
1806
+ select(e) {
1807
+ this.setStateItem(e), typeof this.onSelect == "function" && this.onSelect(e, this.parent);
1808
+ },
1809
+ /**
1810
+ * Selects the first item in the list.
1811
+ *
1812
+ * @returns {void}
1813
+ */
1814
+ selectFirstItem() {
1815
+ const e = this.data.items[0];
1816
+ this.select(e);
1817
+ },
1818
+ /**
1819
+ * Toggles the dropdown open state.
1820
+ *
1821
+ * @returns {void}
1822
+ */
1823
+ toggleDropdown() {
1824
+ this.state.toggle("open");
1825
+ },
1826
+ /**
1827
+ * This will run after the component is set up.
1828
+ *
1829
+ * @returns {void}
1830
+ */
1831
+ after() {
1832
+ if (this.selectFirst === !0 && this.state.selectedValue === "") {
1833
+ const e = this.data.items[0];
1834
+ e && this.setStateItem(e);
1835
+ }
1836
+ },
1837
+ /**
1838
+ * This will render the component.
1839
+ *
1840
+ * @returns {object}
1841
+ */
1842
+ render() {
1843
+ const e = this.class || "", t = this.maxWidth || "max-w-[250px]", s = this.width || "w-full";
1844
+ return o({ class: `relative ${s} flex flex-auto flex-col ${t} ${e}` }, [
1845
+ // @ts-ignore
1846
+ vs({ toggleDropdown: this.toggleDropdown.bind(this) }),
1847
+ Ss({
1848
+ // @ts-ignore
1849
+ state: this.state,
1850
+ // @ts-ignore
1851
+ onSelect: this.select.bind(this)
1852
+ }),
1853
+ // Hidden required input for form validation
1854
+ // @ts-ignore
1855
+ this.required && p({
1856
+ class: "opacity-0 absolute top-0 left-0 z-1",
1857
+ type: "text",
1858
+ // @ts-ignore
1859
+ name: this.name,
1860
+ required: !0,
1861
+ // @ts-ignore
1862
+ value: ["[[selectedValue]]", this.state]
1863
+ })
1864
+ ]);
1865
+ }
1866
+ }
1867
+ ), Ke = ({ icon: e, click: t, ariaLabel: s }) => b({
1868
+ variant: "icon",
1869
+ class: "flex flex-none",
1870
+ click: t,
1871
+ icon: e,
1872
+ "aria-label": s
1873
+ }), $s = ({ click: e }) => Ke({
1874
+ icon: u.circleMinus,
1875
+ click: e,
1876
+ ariaLabel: "Decrement"
1877
+ }), Ds = ({ click: e }) => Ke({
1878
+ icon: u.circlePlus,
1879
+ click: e,
1880
+ ariaLabel: "Increment"
1881
+ }), Is = ({ bind: e, min: t, max: s, readonly: n = !1 }) => W(({ state: a }) => p({
1882
+ value: ["[[count]]", a],
1883
+ bind: e,
1884
+ blur: (l, { state: i }) => {
1885
+ let c = parseInt(l.target.value, 10);
1886
+ isNaN(c) && (c = t ?? 0), t !== void 0 && (c = Math.max(c, t)), s !== void 0 && (c = Math.min(c, s)), i.count = c;
1887
+ },
1888
+ class: "flex flex-auto text-lg font-medium bg-input text-center border min-w-0",
1889
+ readonly: n,
1890
+ min: t,
1891
+ max: s,
1892
+ type: "number",
1893
+ "aria-label": "Counter"
1894
+ })), to = O(
1895
+ {
1896
+ /**
1897
+ * Initial state for the counter component.
1898
+ *
1899
+ * @member {object} state
1900
+ */
1901
+ state() {
1902
+ return {
1903
+ count: {
1904
+ state: this.initialCount ?? 0,
1905
+ callBack: (e) => this.change && this.change(e)
1906
+ }
1907
+ };
1908
+ },
1909
+ /**
1910
+ * Renders the Counter component.
1911
+ *
1912
+ * @returns {object}
1913
+ */
1914
+ render() {
1915
+ const e = this.class ?? "";
1916
+ return o({ class: `flex flex-auto items-center justify-between gap-x-4 p-4 ${e}` }, [
1917
+ $s({ click: () => this.state.decrement("count") }),
1918
+ Is({
1919
+ bind: this.bind,
1920
+ readonly: this.readonly,
1921
+ min: this.min,
1922
+ max: this.max
1923
+ }),
1924
+ Ds({ click: () => this.state.increment("count") })
1925
+ ]);
1926
+ }
1927
+ }
1928
+ ), Ts = ({ currentMonth: e, currentYear: t, onSelect: s }) => o(
1929
+ { class: "grid grid-cols-3 gap-2" },
1930
+ ee.monthNames.map(
1931
+ (n, a) => b(
1932
+ {
1933
+ click: (l) => {
1934
+ l.preventDefault(), l.stopPropagation(), s(a);
1935
+ },
1936
+ variant: e === a ? "primary" : "ghost",
1937
+ "aria-label": `Select ${n} ${t}`
1938
+ },
1939
+ n.substring(0, 3)
1940
+ )
1941
+ )
1942
+ ), P = (e) => (e *= 1, e < 10 ? `0${e}` : String(e)), Ms = (e) => (e.indexOf("T") === -1 && e.indexOf(" ") === -1 && (e += "T00:00:01"), e.replace(" ", "T"), e), L = (e, t, s) => `${e}-${P(t + 1)}-${P(s)}`, Bs = (e) => e ? "bg-accent text-primary" : "", Ps = (e) => e ? "text-muted-foreground opacity-50" : "", zs = (e, t) => e === t, Os = (e, t) => zs(e, t) ? "bg-primary text-primary-foreground" : "", Ns = (e, t, s, n) => {
1943
+ const a = Os(t, n);
1944
+ return a || (e ? Bs(e) : s ? Ps(s) : "text-foreground");
1945
+ }, oe = (e) => {
1946
+ const {
1947
+ day: t,
1948
+ currentDate: s,
1949
+ date: n,
1950
+ isToday: a,
1951
+ isOutsideMonth: l,
1952
+ select: i,
1953
+ disabled: c
1954
+ } = e;
1955
+ return w(
1956
+ {
1957
+ class: `
1958
+ flex items-center justify-center h-9 w-auto p-0 font-normal text-sm rounded-md cursor-pointer
1959
+ ${Ns(a, s, l, n)}
1960
+ hover:bg-muted/50 hover:text-muted-foreground focus:z-10
1961
+ disabled:pointer-events-none disabled:opacity-50
1962
+ `,
1963
+ disabled: c || t === null,
1964
+ "aria-label": t ? `Day ${t}` : null,
1965
+ // Only call select if it's not disabled.
1966
+ click: () => !c && i(n)
1967
+ },
1968
+ t.toString()
1969
+ );
1970
+ }, le = (e, t, s, n) => e === n.date && t === n.month && s === n.year, Rs = (e, t, s, n = !1) => {
1971
+ const { year: a, month: l } = e, i = L(a, l, e.date), c = new Date(a, l, 1).getDay(), h = new Date(a, l + 1, 0).getDate(), m = new Date(a, l, 0).getDate(), v = [], q = l === 0 ? 11 : l - 1, H = l === 0 ? a - 1 : a;
1972
+ for (let d = c - 1; d >= 0; d--) {
1973
+ const y = m - d, S = le(y, q, H, t), $ = new Date(H, q, y) < new Date(t.year, t.month, t.date), R = n && $;
1974
+ v.push(
1975
+ oe({
1976
+ day: y,
1977
+ currentDate: i,
1978
+ date: L(H, q, y),
1979
+ isToday: S,
1980
+ isOutsideMonth: !0,
1981
+ select: s,
1982
+ disabled: R
1983
+ })
1984
+ );
1985
+ }
1986
+ for (let d = 1; d <= h; d++) {
1987
+ const y = le(d, l, a, t), S = new Date(a, l, d) < new Date(t.year, t.month, t.date), $ = n && S;
1988
+ v.push(
1989
+ oe({
1990
+ day: d,
1991
+ currentDate: i,
1992
+ date: L(a, l, d),
1993
+ isToday: y,
1994
+ isOutsideMonth: !1,
1995
+ select: s,
1996
+ disabled: $
1997
+ })
1998
+ );
1999
+ }
2000
+ const E = l === 11 ? 0 : l + 1, se = l === 11 ? a + 1 : a, f = (7 - v.length % 7) % 7;
2001
+ for (let d = 1; d <= f; d++) {
2002
+ const y = le(d, E, se, t), S = new Date(se, E, d) < new Date(t.year, t.month, t.date), $ = n && S;
2003
+ v.push(
2004
+ oe({
2005
+ day: d,
2006
+ currentDate: i,
2007
+ date: L(se, E, d),
2008
+ isToday: y,
2009
+ isOutsideMonth: !0,
2010
+ select: s,
2011
+ disabled: $
2012
+ })
2013
+ );
2014
+ }
2015
+ return v;
2016
+ }, Le = ({ label: e, click: t }) => b(
2017
+ {
2018
+ class: `
2019
+ inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
2020
+ opacity-50 hover:opacity-100 text-muted-foreground absolute
2021
+ ${e === "Previous" ? "left-1" : "right-1"}
2022
+ focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
2023
+ `,
2024
+ click: t,
2025
+ "aria-label": `${e} month`,
2026
+ variant: "icon",
2027
+ icon: e === "Previous" ? u.chevron.single.left : u.chevron.single.right
2028
+ }
2029
+ ), Fs = ({ onMonthClick: e, onYearClick: t, next: s, previous: n }) => o({ class: "flex items-center justify-center gap-x-2 relative min-h-12 text-sm font-medium" }, [
2030
+ b({ click: e, variant: "ghost", "aria-label": "Select month" }, "[[monthName]]"),
2031
+ b({ click: t, variant: "ghost", "aria-label": "Select year" }, "[[current.year]]"),
2032
+ Le({ label: "Previous", click: n }),
2033
+ Le({ label: "Next", click: s })
2034
+ ]), Ls = (e) => o(
2035
+ { class: "flex items-center justify-center h-9 w-auto text-[0.8rem] font-normal text-muted-foreground" },
2036
+ e
2037
+ ), js = () => ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(Ls), As = (e) => o({ class: "rdp flex flex-auto flex-col w-full gap-y-1" }, [
2038
+ Fs({
2039
+ onMonthClick: e.onMonthClick,
2040
+ onYearClick: e.onYearClick,
2041
+ next: e.next,
2042
+ previous: e.previous
2043
+ }),
2044
+ o({
2045
+ class: "flex flex-auto flex-col w-full",
2046
+ onSet: [
2047
+ "currentDate",
2048
+ () => [
2049
+ o({ class: "grid grid-cols-7" }, js()),
2050
+ o(
2051
+ { class: "grid grid-cols-7" },
2052
+ Rs(
2053
+ e.current,
2054
+ e.today,
2055
+ e.select,
2056
+ e.blockPriorDates
2057
+ )
2058
+ )
2059
+ ]
2060
+ ]
2061
+ })
2062
+ ]), Hs = ({ currentMonth: e, currentYear: t, onSelect: s }) => {
2063
+ const n = t - 50, a = Array.from({ length: 101 }, (l, i) => n + i);
2064
+ return o(
2065
+ { class: "grid grid-cols-4 gap-2 overflow-y-auto max-h-72" },
2066
+ a.map(
2067
+ (l) => b(
2068
+ {
2069
+ click: (i) => {
2070
+ i.preventDefault(), i.stopPropagation(), s(l);
2071
+ },
2072
+ variant: l === t ? "primary" : "ghost",
2073
+ "aria-label": `Select ${l}`
2074
+ },
2075
+ l.toString()
2076
+ )
2077
+ )
2078
+ );
2079
+ };
2080
+ class Es extends C {
2081
+ /**
2082
+ * This will declare the props for the compiler.
2083
+ *
2084
+ * @returns {void}
2085
+ */
2086
+ declareProps() {
2087
+ this.selectedDate = null, this.selectedCallBack = null, this.blockPriorDates = !1;
2088
+ }
2089
+ /**
2090
+ * This will get the selected data.
2091
+ *
2092
+ * @param {object} today
2093
+ * @returns {Date}
2094
+ */
2095
+ getSelectedDate(t) {
2096
+ const s = this.selectedDate ? new Date(Ms(this.selectedDate)) : t;
2097
+ return new Date(s.getFullYear(), s.getMonth(), s.getDate());
2098
+ }
2099
+ /**
2100
+ * This will set up the data for the calendar.
2101
+ *
2102
+ * @returns {Data}
2103
+ */
2104
+ setData() {
2105
+ const t = /* @__PURE__ */ new Date(), s = this.getSelectedDate(t), n = s.getMonth();
2106
+ return new z({
2107
+ monthName: this.getMonthName(n),
2108
+ currentDate: `${s.getFullYear()}-${n + 1}-${s.getDate()}`,
2109
+ current: {
2110
+ date: s.getDate(),
2111
+ year: s.getFullYear(),
2112
+ month: n
2113
+ },
2114
+ today: {
2115
+ date: t.getDate(),
2116
+ month: t.getMonth(),
2117
+ year: t.getFullYear()
2118
+ }
2119
+ });
2120
+ }
2121
+ /**
2122
+ * This will set up the states for the calendar.
2123
+ *
2124
+ * @return {object}
2125
+ */
2126
+ setupStates() {
2127
+ return {
2128
+ view: "calendar"
2129
+ // 'calendar' | 'months' | 'years'
2130
+ };
2131
+ }
2132
+ /**
2133
+ * This will get the name of the month.
2134
+ *
2135
+ * @param {number} month
2136
+ * @returns {string}
2137
+ */
2138
+ getMonthName(t) {
2139
+ return ee.monthNames[t];
2140
+ }
2141
+ /**
2142
+ * This will go to the previous month.
2143
+ *
2144
+ * @returns {void}
2145
+ */
2146
+ goToPreviousMonth() {
2147
+ const t = this.data;
2148
+ let s = t.current.month, n = t.current.year;
2149
+ s === 0 ? (s = 11, n--) : s--, this.setCurrentDate(s, n);
2150
+ }
2151
+ /**
2152
+ * This will go to the next month.
2153
+ *
2154
+ * @returns {void}
2155
+ */
2156
+ goToNextMonth() {
2157
+ const t = this.data;
2158
+ let s = t.current.month, n = t.current.year;
2159
+ s === 11 ? (s = 0, n++) : s++, this.setCurrentDate(s, n);
2160
+ }
2161
+ /**
2162
+ * This will set the current month and year.
2163
+ *
2164
+ * @param {number} month
2165
+ * @param {number} year
2166
+ * @param {number|null} [date=null]
2167
+ * @returns {void}
2168
+ */
2169
+ setCurrentDate(t, s, n = null) {
2170
+ const a = this.data;
2171
+ a.current.month = t, a.current.year = s, typeof n == "number" && (a.current.date = P(n)), a.currentDate = `${s}-${P(t + 1)}-${a.current.date}`, a.monthName = this.getMonthName(t);
2172
+ }
2173
+ /**
2174
+ * This will select a date.
2175
+ *
2176
+ * @param {string} date
2177
+ * @returns {void}
2178
+ */
2179
+ selectDate(t) {
2180
+ const s = /* @__PURE__ */ new Date(t + "T00:00:00");
2181
+ this.setCurrentDate(s.getMonth(), s.getFullYear(), s.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(this.data.currentDate);
2182
+ }
2183
+ /**
2184
+ * This will render the calendar.
2185
+ *
2186
+ * @returns {object}
2187
+ */
2188
+ render() {
2189
+ return o({ class: "calendar-container p-3 rounded-md border min-w-80" }, [
2190
+ T("view", (t) => {
2191
+ switch (t) {
2192
+ case "months":
2193
+ return Ts(
2194
+ {
2195
+ // @ts-ignore
2196
+ currentMonth: this.data.current.month,
2197
+ // @ts-ignore
2198
+ currentYear: this.data.current.year,
2199
+ onSelect: (s) => {
2200
+ this.setCurrentDate(s, this.data.current.year), this.state.view = "calendar";
2201
+ }
2202
+ }
2203
+ );
2204
+ case "years":
2205
+ return Hs(
2206
+ {
2207
+ // @ts-ignore
2208
+ currentMonth: this.data.current.month,
2209
+ // @ts-ignore
2210
+ currentYear: this.data.current.year,
2211
+ onSelect: (s) => {
2212
+ this.setCurrentDate(this.data.current.month, s), this.state.view = "calendar";
2213
+ }
2214
+ }
2215
+ );
2216
+ default:
2217
+ return As({
2218
+ // @ts-ignore
2219
+ current: this.data.current,
2220
+ // @ts-ignore
2221
+ today: this.data.today,
2222
+ select: (s) => this.selectDate(s),
2223
+ next: () => this.goToNextMonth(),
2224
+ previous: () => this.goToPreviousMonth(),
2225
+ blockPriorDates: this.blockPriorDates || !1,
2226
+ onMonthClick: (s) => {
2227
+ s.preventDefault(), s.stopPropagation(), this.state.view = "months";
2228
+ },
2229
+ onYearClick: (s) => {
2230
+ s.preventDefault(), s.stopPropagation(), this.state.view = "years";
2231
+ }
2232
+ });
2233
+ }
2234
+ })
2235
+ ]);
2236
+ }
2237
+ }
2238
+ const Us = (e) => {
2239
+ let t = "";
2240
+ return e.length > 0 && (t = e.substring(0, 2), e.length > 2 && (t += "/" + e.substring(2, 4), e.length > 4 && (t += "/" + e.substring(4, 8)))), t;
2241
+ }, Ys = (e) => {
2242
+ if (e.length !== 8)
2243
+ return null;
2244
+ const t = parseInt(e.substring(0, 2), 10), s = parseInt(e.substring(2, 4), 10), n = parseInt(e.substring(4, 8), 10);
2245
+ return t >= 1 && t <= 12 && s >= 1 && s <= 31 && n >= 1900 ? `${n}-${t.toString().padStart(2, "0")}-${s.toString().padStart(2, "0")}` : null;
2246
+ }, Vs = ({ bind: e, required: t }) => p({
2247
+ cache: "input",
2248
+ class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
2249
+ bind: e,
2250
+ required: t
2251
+ }), Ws = ({ placeholder: e, handleInputChange: t, handleInputFocus: s }) => p({
2252
+ cache: "dateInput",
2253
+ class: "flex-1 bg-transparent outline-none placeholder:text-muted-foreground border-0",
2254
+ placeholder: e || "mm/dd/yyyy",
2255
+ input: t,
2256
+ focus: s,
2257
+ onState: ["selectedDate", (n) => n ? ee.format("standard", n) : ""]
2258
+ }), qs = ({ bind: e, required: t, toggleOpen: s, handleInputChange: n, handleInputFocus: a, placeholder: l }) => o(
2259
+ {
2260
+ class: "relative flex items-center gap-2 w-full justify-between border bg-input hover:bg-muted rounded-md h-10 pr-4 py-2"
2261
+ },
2262
+ [
2263
+ Vs({ bind: e, required: t }),
2264
+ Ws({ placeholder: l, handleInputChange: n, handleInputFocus: a }),
2265
+ w(
2266
+ {
2267
+ class: "shrink-0 hover:bg-muted/50 rounded p-1 cursor-pointer",
2268
+ click: s
2269
+ },
2270
+ [
2271
+ Y({ html: u.calendar.days })
2272
+ ]
2273
+ )
2274
+ ]
2275
+ ), Gs = ({ handleDateSelect: e, blockPriorDates: t }) => me(
2276
+ (s, n, a) => new te({
2277
+ cache: "dropdown",
2278
+ parent: a,
2279
+ button: a.panel,
2280
+ size: "fit"
2281
+ }, [
2282
+ new Es({
2283
+ selectedDate: a.state.selectedDate,
2284
+ selectedCallBack: e,
2285
+ blockPriorDates: t
2286
+ })
2287
+ ])
2288
+ ), so = O(
2289
+ {
2290
+ /**
2291
+ * The initial state of the DatePicker.
2292
+ *
2293
+ * @member {object} state
2294
+ */
2295
+ state() {
2296
+ return {
2297
+ selectedDate: this.selectedDate ?? null,
2298
+ open: !1
2299
+ };
2300
+ },
2301
+ /**
2302
+ * This is added to check the input after the component is rendered.
2303
+ * to see if the bind updated the input value.
2304
+ *
2305
+ * @returns {void}
2306
+ */
2307
+ after() {
2308
+ this.input.value && (this.state.selectedDate = this.input.value);
2309
+ },
2310
+ /**
2311
+ * Handles direct input changes and formats the date.
2312
+ *
2313
+ * @param {Event} e
2314
+ */
2315
+ handleInputChange(e) {
2316
+ const s = e.target.value.replace(/\D/g, "");
2317
+ e.target.value = Us(s);
2318
+ const n = Ys(s);
2319
+ n && (this.state.selectedDate = n, this.input.value = n, j.trigger("change", this.input), typeof this.onChange == "function" && this.onChange(n));
2320
+ },
2321
+ /**
2322
+ * Handles input focus - select all text for easy editing.
2323
+ *
2324
+ * @param {Event} e
2325
+ */
2326
+ handleInputFocus(e) {
2327
+ e.target.select();
2328
+ },
2329
+ /**
2330
+ * Handles date selection from calendar.
2331
+ *
2332
+ * @param {string} date
2333
+ */
2334
+ handleDateSelect(e) {
2335
+ this.state.selectedDate = e, this.state.open = !1, this.input.value = e, j.trigger("change", this.input), typeof this.onChange == "function" && this.onChange(e);
2336
+ },
2337
+ /**
2338
+ * Toggles the calendar popover.
2339
+ *
2340
+ * @param {Event} e
2341
+ * @param {object} context
2342
+ */
2343
+ toggleOpen(e, { state: t }) {
2344
+ t.toggle("open");
2345
+ },
2346
+ /**
2347
+ * Renders the DatePicker component.
2348
+ *
2349
+ * @returns {object}
2350
+ */
2351
+ render() {
2352
+ return o(
2353
+ { class: "relative w-full max-w-[320px]" },
2354
+ [
2355
+ qs({
2356
+ toggleOpen: this.toggleOpen.bind(this),
2357
+ bind: this.bind,
2358
+ required: this.required,
2359
+ handleInputChange: this.handleInputChange.bind(this),
2360
+ handleInputFocus: this.handleInputFocus.bind(this),
2361
+ placeholder: this.placeholder
2362
+ }),
2363
+ Gs({
2364
+ handleDateSelect: this.handleDateSelect.bind(this),
2365
+ blockPriorDates: this.blockPriorDates || !1
2366
+ })
2367
+ ]
2368
+ );
2369
+ }
2370
+ }
2371
+ ), je = ({ label: e, click: t }) => b(
2372
+ {
2373
+ class: `
2374
+ inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
2375
+ opacity-50 hover:opacity-100 text-muted-foreground absolute
2376
+ ${e === "Previous" ? "left-1" : "right-1"}
2377
+ focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
2378
+ `,
2379
+ click: t,
2380
+ "aria-label": `${e} month`,
2381
+ variant: "icon",
2382
+ icon: e === "Previous" ? u.chevron.single.left : u.chevron.single.right
2383
+ }
2384
+ ), _s = ({ onMonthClick: e, onYearClick: t, next: s, previous: n }) => o({ class: "flex items-center justify-center gap-x-2 relative min-h-12 text-sm font-medium" }, [
2385
+ b({ click: e, variant: "ghost", "aria-label": "Select month" }, "[[monthName]]"),
2386
+ b({ click: t, variant: "ghost", "aria-label": "Select year" }, "[[current.year]]"),
2387
+ je({ label: "Previous", click: n }),
2388
+ je({ label: "Next", click: s })
2389
+ ]), Ks = (e) => o({ class: "h-9 flex items-center justify-center font-medium" }, e), Qs = () => o(
2390
+ { class: "grid grid-cols-7 gap-1 text-center text-xs font-medium text-muted-foreground mb-2" },
2391
+ ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(Ks)
2392
+ ), Js = ({ day: e, iso: t, disabled: s, isStart: n, isEnd: a, isBetween: l, isOtherMonth: i, click: c }) => {
2393
+ let h = "ghost", m = "";
2394
+ return n || a ? (h = "default", m = "bg-primary text-primary-foreground hover:bg-primary/90") : l && (m = "bg-accent text-accent-foreground hover:bg-accent/80"), s && (m += " opacity-50 cursor-not-allowed"), i && (m += " text-muted-foreground opacity-50"), b(
2395
+ {
2396
+ class: `flex items-center justify-center p-0 text-sm font-medium rounded-md transition-colors ${m}`,
2397
+ variant: h,
2398
+ disabled: s,
2399
+ click: (v) => {
2400
+ v.preventDefault(), v.stopPropagation(), s || c();
2401
+ }
2402
+ },
2403
+ e.toString()
2404
+ );
2405
+ }, Zs = ({ today: e, current: t, blockPriorDates: s, onDateClick: n }) => {
2406
+ const { start: a, end: l } = t, i = new Date(t.year, t.month, 1).getDay(), c = new Date(t.year, t.month + 1, 0).getDate(), h = [], m = t.month === 0 ? 11 : t.month - 1, v = t.month === 0 ? t.year - 1 : t.year, q = new Date(v, m + 1, 0).getDate(), H = t.month === 11 ? 0 : t.month + 1, E = t.month === 11 ? t.year + 1 : t.year;
2407
+ for (let f = i - 1; f >= 0; f--) {
2408
+ const d = q - f, y = L(v, m, d), S = new Date(v, m, d), $ = new Date(e.year, e.month, e.date), R = S < $, G = s && R, _ = a === y, K = l === y, st = a && l && y > a && y < l;
2409
+ h.push({
2410
+ day: d,
2411
+ iso: y,
2412
+ disabled: G,
2413
+ isStart: _,
2414
+ isEnd: K,
2415
+ isBetween: st,
2416
+ isOtherMonth: !0,
2417
+ click: () => n(y)
2418
+ });
2419
+ }
2420
+ for (let f = 1; f <= c; f++) {
2421
+ const d = L(t.year, t.month, f), y = new Date(t.year, t.month, f), S = new Date(e.year, e.month, e.date), $ = y < S, R = s && $, G = a === d, _ = l === d, K = a && l && d > a && d < l;
2422
+ h.push({
2423
+ day: f,
2424
+ iso: d,
2425
+ disabled: R,
2426
+ isStart: G,
2427
+ isEnd: _,
2428
+ isBetween: K,
2429
+ isOtherMonth: !1,
2430
+ click: () => {
2431
+ n(d);
2432
+ }
2433
+ });
2434
+ }
2435
+ const we = (7 - h.length % 7) % 7;
2436
+ for (let f = 1; f <= we; f++) {
2437
+ const d = L(E, H, f), y = new Date(E, H, f), S = new Date(e.year, e.month, e.date), $ = y < S, R = s && $, G = a === d, _ = l === d, K = a && l && d > a && d < l;
2438
+ h.push({
2439
+ day: f,
2440
+ iso: d,
2441
+ disabled: R,
2442
+ isStart: G,
2443
+ isEnd: _,
2444
+ isBetween: K,
2445
+ isOtherMonth: !0,
2446
+ click: () => n(d)
2447
+ });
2448
+ }
2449
+ return o(
2450
+ { class: "grid grid-cols-7 gap-1" },
2451
+ h.map(
2452
+ (f, d) => Js({
2453
+ day: f.day,
2454
+ iso: f.iso,
2455
+ disabled: f.disabled,
2456
+ isStart: f.isStart,
2457
+ isEnd: f.isEnd,
2458
+ isBetween: f.isBetween,
2459
+ isOtherMonth: f.isOtherMonth,
2460
+ click: f.click
2461
+ })
2462
+ )
2463
+ );
2464
+ }, Xs = r((e, t) => o({ class: "flex flex-auto flex-col" }, [
2465
+ _s({
2466
+ // @ts-ignore
2467
+ onMonthClick: e.onMonthClick,
2468
+ // @ts-ignore
2469
+ onYearClick: e.onYearClick,
2470
+ // @ts-ignore
2471
+ next: e.next,
2472
+ // @ts-ignore
2473
+ previous: e.previous
2474
+ }),
2475
+ o({
2476
+ class: "flex flex-auto flex-col w-full",
2477
+ onSet: [
2478
+ "currentDate",
2479
+ () => [
2480
+ Qs(),
2481
+ Zs({
2482
+ // @ts-ignore
2483
+ today: e.today,
2484
+ // @ts-ignore
2485
+ current: e.current,
2486
+ // @ts-ignore
2487
+ blockPriorDates: e.blockPriorDates,
2488
+ // @ts-ignore
2489
+ onDateClick: e.onDateClick
2490
+ })
2491
+ ]
2492
+ ]
2493
+ })
2494
+ ])), en = ({ currentMonth: e, currentYear: t, onSelect: s }) => o(
2495
+ { class: "grid grid-cols-3 gap-2" },
2496
+ ee.monthNames.map(
2497
+ (n, a) => b(
2498
+ {
2499
+ click: (l) => {
2500
+ l.preventDefault(), l.stopPropagation(), s(a);
2501
+ },
2502
+ variant: e === a ? "primary" : "ghost",
2503
+ "aria-label": `Select ${n} ${t}`
2504
+ },
2505
+ n.substring(0, 3)
2506
+ )
2507
+ )
2508
+ ), tn = ({ start: e, end: t, selecting: s, onSelectStart: n, onSelectEnd: a }) => o({ class: "flex gap-x-2 mb-4" }, [
2509
+ Q("selecting", (l) => b({
2510
+ click: n,
2511
+ variant: l === "start" ? "primary" : "outline",
2512
+ class: "flex-1"
2513
+ }, [
2514
+ o({ class: "font-medium" }, Ae("current.start", "Start Date"))
2515
+ ])),
2516
+ Q("selecting", (l) => b({
2517
+ click: a,
2518
+ variant: l === "end" ? "primary" : "outline",
2519
+ class: "flex-1"
2520
+ }, [
2521
+ o({ class: "font-medium" }, Ae("current.end", "End Date"))
2522
+ ]))
2523
+ ]), Ae = (e, t) => [`[[${e}]]`, (s) => s == null ? t : sn(s)], sn = (e) => {
2524
+ const t = /* @__PURE__ */ new Date(e + "T00:00:00"), s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], n = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
2525
+ return `${s[t.getDay()]}, ${t.getDate()} ${n[t.getMonth()]}`;
2526
+ }, nn = ({ currentYear: e, onSelect: t }) => {
2527
+ const s = e - 50, n = Array.from({ length: 101 }, (a, l) => s + l);
2528
+ return o(
2529
+ { class: "grid grid-cols-4 gap-2 overflow-y-auto max-h-72" },
2530
+ n.map(
2531
+ (a) => b(
2532
+ {
2533
+ click: (l) => {
2534
+ l.preventDefault(), l.stopPropagation(), t(a);
2535
+ },
2536
+ variant: a === e ? "primary" : "ghost",
2537
+ "aria-label": `Select ${a}`
2538
+ },
2539
+ a.toString()
2540
+ )
2541
+ )
2542
+ );
2543
+ };
2544
+ class an extends C {
2545
+ /**
2546
+ * Declare compiler props.
2547
+ *
2548
+ * @returns {void}
2549
+ */
2550
+ declareProps() {
2551
+ this.startDate = null, this.endDate = null, this.onRangeSelect = null, this.blockPriorDates = !1;
2552
+ }
2553
+ /**
2554
+ * Initialize reactive data for today and current view.
2555
+ *
2556
+ * @returns {Data}
2557
+ */
2558
+ setData() {
2559
+ const t = /* @__PURE__ */ new Date(), s = this.startDate ? /* @__PURE__ */ new Date(this.startDate + "T00:00:00") : t, n = s.getMonth(), a = s.getFullYear();
2560
+ return new z({
2561
+ today: {
2562
+ date: t.getDate(),
2563
+ month: t.getMonth(),
2564
+ year: t.getFullYear()
2565
+ },
2566
+ monthName: this.getMonthName(n),
2567
+ currentData: `${s.getFullYear()}-${P(s.getMonth() + 1)}-${P(s.getDate())}`,
2568
+ current: {
2569
+ date: t.getDate(),
2570
+ month: n,
2571
+ year: a,
2572
+ start: this.startDate,
2573
+ end: this.endDate
2574
+ },
2575
+ selecting: "start"
2576
+ });
2577
+ }
2578
+ /**
2579
+ * This will get the name of the month.
2580
+ *
2581
+ * @param {number} month
2582
+ * @returns {string}
2583
+ */
2584
+ getMonthName(t) {
2585
+ return ee.monthNames[t];
2586
+ }
2587
+ /**
2588
+ * Initialize component state.
2589
+ *
2590
+ * @returns {{view:string}}
2591
+ */
2592
+ setupStates() {
2593
+ return {
2594
+ view: "calendar"
2595
+ // 'calendar', 'months', or 'years'
2596
+ };
2597
+ }
2598
+ /**
2599
+ * Handle a date cell click.
2600
+ *
2601
+ * @param {string} isoDate
2602
+ * @returns {void}
2603
+ */
2604
+ handleClick(t) {
2605
+ if (this.data.selecting === "start") {
2606
+ this.data.current.start = t, this.data.current.end = null, this.data.selecting = "end";
2607
+ const s = /* @__PURE__ */ new Date(t + "T00:00:00");
2608
+ this.setCurrent({
2609
+ month: s.getMonth(),
2610
+ year: s.getFullYear(),
2611
+ date: s.getDate()
2612
+ });
2613
+ } else {
2614
+ this.data.current.start && t < this.data.current.start ? (this.data.current.end = this.data.current.start, this.data.current.start = t) : this.data.current.end = t, this.data.selecting = "start";
2615
+ const s = /* @__PURE__ */ new Date(t + "T00:00:00");
2616
+ this.setCurrent({
2617
+ month: s.getMonth(),
2618
+ year: s.getFullYear(),
2619
+ date: s.getDate()
2620
+ }), typeof this.onRangeSelect == "function" && this.onRangeSelect(this.data.current.start, this.data.current.end);
2621
+ }
2622
+ }
2623
+ /**
2624
+ * Update current month/year in data.
2625
+ *
2626
+ * @param {object} obj
2627
+ * @returns {void}
2628
+ */
2629
+ setCurrent({ month: t, year: s, date: n = null }) {
2630
+ const a = this.data.current;
2631
+ a.month = (t + 12) % 12, a.year = s + (t < 0 ? -1 : t > 11 ? 1 : 0), n !== null && (a.date = n), this.data.monthName = this.getMonthName(a.month), this.data.currentDate = `${s}-${P(t + 1)}-${P(a.date)}`;
2632
+ }
2633
+ /**
2634
+ * Render the range calendar.
2635
+ *
2636
+ * @returns {object}
2637
+ */
2638
+ render() {
2639
+ const { today: t, current: s, selecting: n } = this.data, { start: a, end: l } = s;
2640
+ return o({ class: "range-calendar border border-border rounded-lg shadow-md p-4 w-full max-w-sm min-w-80" }, [
2641
+ tn({
2642
+ start: a,
2643
+ end: l,
2644
+ selecting: n,
2645
+ onSelectStart: (i) => {
2646
+ i.preventDefault(), i.stopPropagation(), this.data.selecting = "start";
2647
+ },
2648
+ onSelectEnd: (i) => {
2649
+ i.preventDefault(), i.stopPropagation(), this.data.selecting = "end";
2650
+ }
2651
+ }),
2652
+ T("view", (i) => {
2653
+ switch (i) {
2654
+ case "months":
2655
+ return en(
2656
+ {
2657
+ currentMonth: s.month,
2658
+ currentYear: s.year,
2659
+ onSelect: (c) => {
2660
+ this.setCurrent({ month: c, year: s.year }), this.state.view = "calendar";
2661
+ }
2662
+ }
2663
+ );
2664
+ case "years":
2665
+ return nn(
2666
+ {
2667
+ currentYear: s.year,
2668
+ onSelect: (c) => {
2669
+ this.setCurrent({ month: s.month, year: c }), this.state.view = "calendar";
2670
+ }
2671
+ }
2672
+ );
2673
+ default:
2674
+ return Xs({
2675
+ // @ts-ignore
2676
+ monthName: this.data.monthName,
2677
+ year: s.year,
2678
+ today: t,
2679
+ current: s,
2680
+ blockPriorDates: this.blockPriorDates,
2681
+ onDateClick: (c) => this.handleClick(c),
2682
+ onMonthClick: (c) => {
2683
+ c.preventDefault(), c.stopPropagation(), this.state.view = "months";
2684
+ },
2685
+ onYearClick: (c) => {
2686
+ c.preventDefault(), c.stopPropagation(), this.state.view = "years";
2687
+ },
2688
+ next: () => {
2689
+ const c = this.data.current, h = c.month === 11 ? { month: 0, year: c.year + 1 } : { month: c.month + 1, year: c.year };
2690
+ this.setCurrent(h);
2691
+ },
2692
+ previous: () => {
2693
+ const c = this.data.current, h = c.month === 0 ? { month: 11, year: c.year - 1 } : { month: c.month - 1, year: c.year };
2694
+ this.setCurrent(h);
2695
+ }
2696
+ });
2697
+ }
2698
+ })
2699
+ ]);
2700
+ }
2701
+ }
2702
+ const on = ({ bind: e, required: t }) => p({
2703
+ cache: "input",
2704
+ class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
2705
+ bind: e,
2706
+ required: t
2707
+ }), ln = ({ bind: e, required: t, toggleOpen: s }) => w({
2708
+ class: "relative flex items-center gap-2 w-full justify-between border bg-input hover:bg-muted rounded-md h-10 px-4 py-2",
2709
+ click: s
2710
+ }, [
2711
+ on({ bind: e, required: t }),
2712
+ W(({ state: n }) => [
2713
+ g(U.date(["[[start]]", n], "Start Date")),
2714
+ g(" - "),
2715
+ g(U.date(["[[end]]", n], "End Date"))
2716
+ ]),
2717
+ Y({ html: u.calendar.days })
2718
+ ]), rn = ({ handleDateSelect: e, blockPriorDates: t }) => me((s, n, a) => new te({
2719
+ cache: "dropdown",
2720
+ parent: a,
2721
+ button: a.panel,
2722
+ size: "xl"
2723
+ }, [
2724
+ new an({
2725
+ startDate: a.state.start,
2726
+ endDate: a.state.end,
2727
+ onRangeSelect: e,
2728
+ blockPriorDates: t
2729
+ })
2730
+ ])), no = O(
2731
+ {
2732
+ /**
2733
+ * The initial state of the DateRangePicker.
2734
+ *
2735
+ * @member {object} state
2736
+ */
2737
+ state() {
2738
+ return {
2739
+ start: this.start ?? null,
2740
+ end: this.end ?? null,
2741
+ open: !1
2742
+ };
2743
+ },
2744
+ /**
2745
+ * This is added to check the input after the component is rendered.
2746
+ * to see if the bind updated the input value.
2747
+ *
2748
+ * @returns {void}
2749
+ */
2750
+ after() {
2751
+ if (this.input.value) {
2752
+ const e = this.input.value.split("-");
2753
+ this.state.start = e[0], this.state.end = e[1];
2754
+ }
2755
+ },
2756
+ /**
2757
+ * Renders the DatePicker component.
2758
+ *
2759
+ * @returns {object}
2760
+ */
2761
+ render() {
2762
+ const e = (s, { state: n }) => n.toggle("open"), t = (s, n) => {
2763
+ this.state.start = s, this.state.end = n, this.state.open = !1, this.input.value = `${s}-${n}`, j.trigger("change", this.input), typeof this.onChange == "function" && this.onChange({ start: s, end: n }, this.parent);
2764
+ };
2765
+ return o({ class: "relative w-full max-w-[320px]" }, [
2766
+ ln({
2767
+ toggleOpen: e,
2768
+ bind: this.bind,
2769
+ required: this.required
2770
+ }),
2771
+ rn({
2772
+ handleDateSelect: t,
2773
+ blockPriorDates: this.blockPriorDates || !1
2774
+ })
2775
+ ]);
2776
+ }
2777
+ }
2778
+ );
2779
+ function cn(e) {
2780
+ let t = "";
2781
+ return e.length > 0 && (t = e.substring(0, 2), e.length > 2 && (t += ":" + e.substring(2, 4))), t;
2782
+ }
2783
+ function dn(e) {
2784
+ if (e.length < 4)
2785
+ return { formattedTime: null, hour: null, minute: null, meridian: null };
2786
+ const t = parseInt(e.substring(0, 2), 10), s = parseInt(e.substring(2, 4), 10);
2787
+ if (t < 0 || t > 23 || s < 0 || s > 59)
2788
+ return { formattedTime: null, hour: null, minute: null, meridian: null };
2789
+ let n = t, a = "AM";
2790
+ return t === 0 ? n = 12 : t > 12 ? (n = t - 12, a = "PM") : t === 12 && (a = "PM"), {
2791
+ formattedTime: `${n.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")} ${a}`,
2792
+ hour: n.toString().padStart(2, "0"),
2793
+ minute: s.toString().padStart(2, "0"),
2794
+ meridian: a
2795
+ };
2796
+ }
2797
+ function un({ bind: e, required: t }) {
2798
+ return p({
2799
+ cache: "input",
2800
+ class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
2801
+ bind: e,
2802
+ required: t
2803
+ });
2804
+ }
2805
+ function hn({ placeholder: e, handleInputChange: t, handleInputFocus: s }) {
2806
+ return p({
2807
+ cache: "timeInput",
2808
+ class: "flex-1 bg-transparent outline-none placeholder:text-muted-foreground border-0",
2809
+ placeholder: e || "hh:mm AM/PM",
2810
+ input: t,
2811
+ focus: s,
2812
+ onState: ["selectedTime", (n) => n || ""]
2813
+ });
2814
+ }
2815
+ function fn({ bind: e, required: t, toggleOpen: s, handleInputChange: n, handleInputFocus: a, placeholder: l }) {
2816
+ return o(
2817
+ {
2818
+ class: "relative flex items-center gap-2 w-full justify-between border bg-input hover:bg-muted rounded-md h-10 pr-4 py-2"
2819
+ },
2820
+ [
2821
+ un({ bind: e, required: t }),
2822
+ hn({ placeholder: l, handleInputChange: n, handleInputFocus: a }),
2823
+ w(
2824
+ {
2825
+ class: "shrink-0 hover:bg-muted/50 rounded p-1 cursor-pointer",
2826
+ click: s
2827
+ },
2828
+ [
2829
+ Y({ html: u.clock })
2830
+ ]
2831
+ )
2832
+ ]
2833
+ );
2834
+ }
2835
+ function re({ items: e, handleTimeSelect: t, state: s, stateValue: n, pad: a = !1 }) {
2836
+ return o(
2837
+ { class: "flex flex-col max-h-[200px] overflow-y-auto" },
2838
+ e.map((l) => {
2839
+ let i = a ? l.toString().padStart(2, "0") : l.toString();
2840
+ return w({
2841
+ text: i,
2842
+ class: "hover:bg-muted/50 rounded-md pr-2 py-1",
2843
+ click: () => t({ [n]: i }),
2844
+ onState: [s, n, { "bg-muted": i }]
2845
+ });
2846
+ })
2847
+ );
2848
+ }
2849
+ function gn({ handleTimeSelect: e }) {
2850
+ return me(
2851
+ (t, s, n) => new te(
2852
+ {
2853
+ cache: "dropdown",
2854
+ parent: n,
2855
+ button: n.panel,
2856
+ size: "fit"
2857
+ },
2858
+ [
2859
+ o(
2860
+ { class: "flex flex-auto flex-col border rounded-md shadow-md" },
2861
+ [
2862
+ o(
2863
+ { class: "grid grid-cols-3 gap-2 p-4 text-center max-h-[220px] min-w-[240px]" },
2864
+ [
2865
+ // Hours column
2866
+ re({
2867
+ items: Array.from({ length: 12 }, (a, l) => l + 1),
2868
+ handleTimeSelect: e,
2869
+ state: n.state,
2870
+ stateValue: "hour",
2871
+ pad: !0
2872
+ }),
2873
+ // Minutes column
2874
+ re({
2875
+ items: Array.from({ length: 60 }, (a, l) => l),
2876
+ handleTimeSelect: e,
2877
+ state: n.state,
2878
+ stateValue: "minute",
2879
+ pad: !0
2880
+ }),
2881
+ // AM/PM column
2882
+ re({
2883
+ items: ["AM", "PM"],
2884
+ handleTimeSelect: e,
2885
+ state: n.state,
2886
+ stateValue: "meridian"
2887
+ })
2888
+ ]
2889
+ )
2890
+ ]
2891
+ )
2892
+ ]
2893
+ )
2894
+ );
2895
+ }
2896
+ function He(e) {
2897
+ if (!e)
2898
+ return { hour: null, minute: null, meridian: null };
2899
+ const t = /^(\d{1,2}):(\d{2})(?::(\d{2}))?\s?(AM|PM)?$/i, s = e.match(t);
2900
+ if (!s)
2901
+ return { hour: null, minute: null, meridian: null };
2902
+ let [, n, a, , l] = s, i = parseInt(n, 10), c = parseInt(a, 10);
2903
+ return i < 0 || i > 23 || c < 0 || c > 59 ? { hour: null, minute: null, meridian: null } : (l ? (l = l.toUpperCase(), l === "PM" && i < 12 ? i += 12 : l === "AM" && i === 12 && (i = 12)) : i === 0 ? (l = "AM", i = 12) : i < 12 ? l = "AM" : i === 12 ? l = "PM" : (l = "PM", i -= 12), {
2904
+ hour: i.toString().padStart(2, "0"),
2905
+ minute: c.toString().padStart(2, "0"),
2906
+ meridian: l
2907
+ });
2908
+ }
2909
+ const ao = O(
2910
+ {
2911
+ /**
2912
+ * The initial shallow state of the TimePicker.
2913
+ *
2914
+ * @member {object} state
2915
+ */
2916
+ state() {
2917
+ const e = this.selectedTime ?? null, { hour: t, minute: s, meridian: n } = He(e);
2918
+ return {
2919
+ selectedTime: e,
2920
+ open: !1,
2921
+ hour: t,
2922
+ minute: s,
2923
+ meridian: n
2924
+ };
2925
+ },
2926
+ /**
2927
+ * Updates the state after the input is rendered.
2928
+ *
2929
+ * @returns {void}
2930
+ */
2931
+ after() {
2932
+ if (this.input.value) {
2933
+ const { hour: e, minute: t, meridian: s } = He(this.input.value);
2934
+ this.state.set({
2935
+ hour: e,
2936
+ minute: t,
2937
+ meridian: s,
2938
+ selectedTime: this.input.value
2939
+ });
2940
+ }
2941
+ },
2942
+ /**
2943
+ * Toggles the time picker popover.
2944
+ *
2945
+ * @param {Event} e
2946
+ * @param {object} context
2947
+ */
2948
+ toggleOpen(e, { state: t }) {
2949
+ t.toggle("open");
2950
+ },
2951
+ /**
2952
+ * Handles direct input changes and formats the time.
2953
+ *
2954
+ * @param {Event} e
2955
+ */
2956
+ handleInputChange(e) {
2957
+ let t = e.target.value.replace(/[^\d]/g, ""), s = cn(t);
2958
+ const n = dn(t);
2959
+ n.formattedTime && (s = n.formattedTime, this.state.set({
2960
+ hour: n.hour,
2961
+ minute: n.minute,
2962
+ meridian: n.meridian,
2963
+ selectedTime: n.formattedTime
2964
+ }), this.input.value = n.formattedTime, j.trigger("change", this.input), typeof this.change == "function" && this.change(n.formattedTime)), e.target.value = s;
2965
+ },
2966
+ /**
2967
+ * Handles input focus - select all text for easy editing.
2968
+ *
2969
+ * @param {Event} e
2970
+ */
2971
+ handleInputFocus(e) {
2972
+ e.target.select();
2973
+ },
2974
+ /**
2975
+ * Handles time selection from the picker columns.
2976
+ *
2977
+ * @param {object} params
2978
+ */
2979
+ handleTimeSelect({ hour: e, minute: t, meridian: s }) {
2980
+ if (e && (this.state.hour = e), t && (this.state.minute = t), s && (this.state.meridian = s), this.state.hour && this.state.minute && this.state.meridian) {
2981
+ const n = `${this.state.hour}:${this.state.minute} ${this.state.meridian}`;
2982
+ this.state.selectedTime = n, this.state.open = !1, this.input.value = n, j.trigger("change", this.input), typeof this.change == "function" && this.change(n);
2983
+ }
2984
+ },
2985
+ /**
2986
+ * Renders the TimePicker component.
2987
+ *
2988
+ * @returns {object}
2989
+ */
2990
+ render() {
2991
+ return o(
2992
+ { class: "relative w-full max-w-[320px]" },
2993
+ [
2994
+ fn({
2995
+ toggleOpen: this.toggleOpen.bind(this),
2996
+ bind: this.bind,
2997
+ required: this.required,
2998
+ handleInputChange: this.handleInputChange.bind(this),
2999
+ handleInputFocus: this.handleInputFocus.bind(this),
3000
+ placeholder: this.placeholder
3001
+ }),
3002
+ gn({
3003
+ handleTimeSelect: this.handleTimeSelect.bind(this)
3004
+ })
3005
+ ]
3006
+ );
3007
+ }
3008
+ }
3009
+ ), mn = (e, t) => o({ class: `hidden md:flex items-start justify-center w-6 h-6 mr-3 ${t}` }, [
3010
+ x({ size: "lg" }, e)
3011
+ ]), bn = ({ title: e }) => Z({ class: "flex flex-auto items-center" }, [
3012
+ J({ class: "text-lg font-semibold" }, e)
3013
+ ]), oo = r((e, t) => it(
3014
+ {
3015
+ class: `fixed pullUpIn z-30 w-[98%] border md:w-full max-w-lg bg-popover text-foreground shadow-lg duration-200
3016
+ rounded-lg flex flex-auto flex-col
3017
+ bottom-4 top-auto inset-auto m-auto md:bottom-0 md:top-0 left-0 right-0 ${e.class}`,
3018
+ // @ts-ignore
3019
+ click: e.click,
3020
+ aria: { expanded: ["open"] }
3021
+ },
3022
+ [
3023
+ o({ class: "flex flex-auto p-6 pb-12 md:pb-6" }, [
3024
+ // Icon and content
3025
+ // @ts-ignore
3026
+ e.icon && mn(e.icon, e.iconColor),
3027
+ o({ class: "flex flex-auto flex-col gap-4" }, [
3028
+ o({ class: "flex flex-auto flex-col gap-y-2" }, [
3029
+ bn(e),
3030
+ // @ts-ignore
3031
+ e.description && k({ class: "flex flex-auto flex-col text-sm text-muted-foreground" }, e.description),
3032
+ o({ class: "flex flex-auto flex-col text-sm text-muted-foreground" }, t)
3033
+ ]),
3034
+ // @ts-ignore
3035
+ e.buttons && ue({ class: "flex flex-col-reverse sm:flex-row sm:justify-end mt-6 gap-2 sm:gap-0 sm:gap-x-2" }, e.buttons)
3036
+ ])
3037
+ ])
3038
+ ]
3039
+ )), lo = r((e, t = []) => o({ class: "w-full max-w-md p-6 m-auto" }, [
3040
+ Ge({ class: "flex flex-auto flex-col" }, [
3041
+ o({ class: "flex flex-auto flex-col gap-y-4" }, [
3042
+ o({ class: "flex flex-auto items-center justify-center" }, [
3043
+ // @ts-ignore
3044
+ e.icon && o({ class: "w-16 h-16 mb-2 text-primary" }, [
3045
+ // @ts-ignore
3046
+ x({ size: "lg" }, e.icon)
3047
+ ])
3048
+ ]),
3049
+ Z({ class: "py-4 text-center" }, [
3050
+ // @ts-ignore
3051
+ J({ class: "text-xl font-bold" }, e.title),
3052
+ // @ts-ignore
3053
+ k({ class: "pb-8 text-muted-foreground" }, e.description || ""),
3054
+ ...t
3055
+ ])
3056
+ ])
3057
+ ])
3058
+ ]));
3059
+ r((e, t) => ({
3060
+ class: "flex items-center px-4 py-2",
3061
+ ...e,
3062
+ children: t
3063
+ }));
3064
+ r(({ value: e, label: t }) => w({
3065
+ class: "inline-flex flex-auto items-center justify-center whitespace-nowrap rounded-md px-8 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
3066
+ onState: ["performance", { active: e }],
3067
+ dataSet: ["performance", ["state", e, "active"]],
3068
+ click: (s, { state: n }) => n.performance = e
3069
+ }, t));
3070
+ const xn = (e, t) => {
3071
+ const s = e.toggleAllSelectedRows();
3072
+ t.state.checked = !s;
3073
+ }, pn = (e) => Ye({ class: `cursor-pointer py-3 px-4 text-base w-10 ${e.class || ""}` }, [
3074
+ W((t) => new Lt({ class: "mr-2", onChange: (s, n) => xn(t, n) }))
3075
+ ]), yn = ({ align: e, sortable: t, key: s, label: n, sort: a, class: l }) => {
3076
+ const i = e || "justify-start";
3077
+ return Ye({
3078
+ class: `cursor-pointer py-3 px-4 text-base ${l || ""}`,
3079
+ click: t && (() => a(s))
3080
+ }, [
3081
+ o({ class: `flex flex-auto w-full items-center ${i}` }, [
3082
+ g(n),
3083
+ t && Y({ class: "ml-2", html: u.arrows.upDown })
3084
+ ])
3085
+ ]);
3086
+ }, ye = (e) => ct([
3087
+ dt({
3088
+ class: "text-muted-foreground border-b",
3089
+ map: [
3090
+ e.headers,
3091
+ (t) => t.label === "checkbox" ? pn({ toggle: e.toggle }) : yn({
3092
+ align: t.align,
3093
+ sortable: t.sortable,
3094
+ key: t.key,
3095
+ label: t.label,
3096
+ sort: e.sort
3097
+ })
3098
+ ]
3099
+ })
3100
+ ]), wn = ({ key: e, rows: t, selectRow: s, rowItem: n, emptyState: a, skeleton: l, columnCount: i }) => new bt({
3101
+ cache: "list",
3102
+ key: e,
3103
+ items: t,
3104
+ rowItem: (c) => n(c, s),
3105
+ class: "divide-y divide-border",
3106
+ emptyState: a,
3107
+ skeleton: l,
3108
+ columnCount: i
3109
+ });
3110
+ class Qe extends C {
3111
+ /**
3112
+ * Initializes component data.
3113
+ *
3114
+ * @returns {Data}
3115
+ */
3116
+ setData() {
3117
+ let t = this.rows && this.rows.length > 0;
3118
+ return (this.loadMoreItems || this.tableData) && !t && (t = null), new z({
3119
+ selectedRows: [],
3120
+ // @ts-ignore
3121
+ hasItems: t,
3122
+ selected: !1
3123
+ });
3124
+ }
3125
+ /**
3126
+ * This will toggle all selected rows.
3127
+ *
3128
+ * @returns {boolean}
3129
+ */
3130
+ toggleAllSelectedRows() {
3131
+ const t = this.list.getRows(), s = this.data.selectedRows.length === t.length, n = s ? [] : t;
3132
+ return this.data.selectedRows = n, this.updateSelected(), this.updateTable(!s), s;
3133
+ }
3134
+ /**
3135
+ * This will update the selected state.
3136
+ *
3137
+ * @returns {void}
3138
+ */
3139
+ updateSelected() {
3140
+ const t = this.data.get("selectedRows");
3141
+ this.data.selected = t.length > 0;
3142
+ }
3143
+ /**
3144
+ * This will get the selected rows.
3145
+ *
3146
+ * @returns {Array<object>}
3147
+ */
3148
+ getSelectedRows() {
3149
+ return this.data.get("selectedRows");
3150
+ }
3151
+ /**
3152
+ * This will update the table rows.
3153
+ *
3154
+ * @protected
3155
+ * @param {boolean} selected
3156
+ * @returns {void}
3157
+ */
3158
+ updateTable(t) {
3159
+ const s = this.list.getRows();
3160
+ s.forEach((n) => n.selected = t), this.list.setRows(s);
3161
+ }
3162
+ /**
3163
+ * Handles row selection.
3164
+ *
3165
+ * @param {object} row
3166
+ */
3167
+ selectRow(t) {
3168
+ const s = t.selected ?? !1;
3169
+ t.selected = !s;
3170
+ const n = this.data.get("selectedRows"), a = t.selected ? [...n, t] : n.filter((l) => l !== t);
3171
+ this.data.selectedRows = a, this.updateSelected();
3172
+ }
3173
+ /**
3174
+ * Gets the number of header columns.
3175
+ *
3176
+ * @returns {number}
3177
+ */
3178
+ getHeaderColCount() {
3179
+ return this.customHeader ? this.customHeader?.children[0]?.children?.length : this.headers ? this.headers.length : 3;
3180
+ }
3181
+ /**
3182
+ * Renders the DataTable component.
3183
+ *
3184
+ * @returns {object}
3185
+ */
3186
+ render() {
3187
+ const t = this.border !== !1 ? "border" : "", s = this.getHeaderColCount();
3188
+ return o({ class: "w-full flex flex-auto flex-col" }, [
3189
+ Q("hasItems", (n) => n === !1 && this.emptyState ? this.emptyState() : null),
3190
+ o({ class: `w-full rounded-md ${t} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
3191
+ be({ class: "w-full" }, [
3192
+ // @ts-ignore
3193
+ this.headers && ye({ headers: this.headers, sort: (n) => this.sortRows(n) }),
3194
+ // @ts-ignore
3195
+ this.customHeader ?? null,
3196
+ wn({
3197
+ // @ts-ignore
3198
+ key: this.key,
3199
+ // @ts-ignore
3200
+ rows: this.rows,
3201
+ // @ts-ignore
3202
+ selectRow: this.selectRow.bind(this),
3203
+ // @ts-ignore
3204
+ rowItem: this.rowItem,
3205
+ // @ts-ignore
3206
+ emptyState: this.emptyState,
3207
+ // @ts-ignore
3208
+ skeleton: this.skeleton,
3209
+ columnCount: s
3210
+ })
3211
+ ])
3212
+ ])
3213
+ ]);
3214
+ }
3215
+ /**
3216
+ * This will remove items from the list.
3217
+ *
3218
+ * @public
3219
+ * @param {array} items
3220
+ * @returns {void}
3221
+ */
3222
+ remove(t) {
3223
+ this.list.remove(t);
3224
+ }
3225
+ /**
3226
+ * This will set the items in the list.
3227
+ *
3228
+ * @public
3229
+ * @param {array} rows
3230
+ * @returns {void}
3231
+ */
3232
+ setRows(t) {
3233
+ this.list.setRows(t);
3234
+ }
3235
+ /**
3236
+ * This will append items to the list.
3237
+ *
3238
+ * @public
3239
+ * @param {array|object} items
3240
+ * @returns {void}
3241
+ */
3242
+ append(t) {
3243
+ this.list.append(t);
3244
+ }
3245
+ /**
3246
+ * This will mingle the new items with the old items.
3247
+ *
3248
+ * @public
3249
+ * @param {Array<Object>} newItems
3250
+ * @param {boolean} withDelete
3251
+ * @returns {void}
3252
+ */
3253
+ mingle(t, s = !1) {
3254
+ this.list.mingle(t, s);
3255
+ }
3256
+ /**
3257
+ * This will prepend items to the list.
3258
+ *
3259
+ * @public
3260
+ * @param {array|object} items
3261
+ * @returns {void}
3262
+ */
3263
+ prepend(t) {
3264
+ this.list.prepend(t);
3265
+ }
3266
+ /**
3267
+ * This will remove the selected rows.
3268
+ *
3269
+ * @returns {void}
3270
+ */
3271
+ beforeDestroy() {
3272
+ this.data.selectedRows = [];
3273
+ }
3274
+ }
3275
+ const vn = (e) => new xt({
3276
+ cache: "list",
3277
+ loadMoreItems: e.loadMoreItems,
3278
+ offset: e.offset,
3279
+ limit: e.limit,
3280
+ key: e.key,
3281
+ tableData: e.tableData,
3282
+ items: e.items,
3283
+ rowItem: (t) => e.rowItem(t, e.selectRow),
3284
+ class: "divide-y divide-border",
3285
+ skeleton: e.skeleton,
3286
+ columnCount: e.columnCount
3287
+ });
3288
+ class kn extends Qe {
3289
+ /**
3290
+ * Renders the DataTable component.
3291
+ *
3292
+ * @returns {object}
3293
+ */
3294
+ render() {
3295
+ const t = this.border !== !1 ? "border" : "", s = this.getHeaderColCount();
3296
+ return o({ class: "w-full flex flex-auto flex-col" }, [
3297
+ Q("hasItems", (n) => n === !1 && this.emptyState ? this.emptyState() : null),
3298
+ o({ class: `w-full rounded-md ${t} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
3299
+ be({ class: "w-full" }, [
3300
+ // @ts-ignore
3301
+ this.headers && ye({ headers: this.headers, sort: (n) => this.sortRows(n) }),
3302
+ // @ts-ignore
3303
+ this.customHeader ?? null,
3304
+ vn({
3305
+ // @ts-ignore
3306
+ loadMoreItems: this.loadMoreItems,
3307
+ // @ts-ignore
3308
+ offset: this.offset,
3309
+ // @ts-ignore
3310
+ limit: this.limit,
3311
+ // @ts-ignore
3312
+ class: this.class,
3313
+ // @ts-ignore
3314
+ tableData: this.tableData,
3315
+ // @ts-ignore
3316
+ key: this.key,
3317
+ // @ts-ignore
3318
+ items: this.rows,
3319
+ // @ts-ignore
3320
+ selectRow: this.selectRow.bind(this),
3321
+ // @ts-ignore
3322
+ rowItem: this.rowItem,
3323
+ // @ts-ignore
3324
+ skeleton: this.skeleton,
3325
+ columnCount: s
3326
+ })
3327
+ ])
3328
+ ])
3329
+ ]);
3330
+ }
3331
+ /**
3332
+ * Refreshes the list.
3333
+ *
3334
+ * @returns {void}
3335
+ */
3336
+ refresh() {
3337
+ this.list.refresh();
3338
+ }
3339
+ }
3340
+ const ro = r((e) => new kn(
3341
+ {
3342
+ // @ts-ignore
3343
+ cache: e.cache ?? "list",
3344
+ // @ts-ignore
3345
+ tableData: e.data,
3346
+ // @ts-ignore
3347
+ loadMoreItems: e.loadMoreItems,
3348
+ // @ts-ignore
3349
+ offset: e.offset,
3350
+ // @ts-ignore
3351
+ limit: e.limit,
3352
+ // @ts-ignore
3353
+ class: e.class,
3354
+ // @ts-ignore
3355
+ key: e.key,
3356
+ // @ts-ignore
3357
+ rows: e.rows,
3358
+ // @ts-ignore
3359
+ rowItem: e.rowItem,
3360
+ // @ts-ignore
3361
+ headers: e.headers,
3362
+ // @ts-ignore
3363
+ customHeader: e.customHeader,
3364
+ // @ts-ignore
3365
+ border: e.border,
3366
+ // @ts-ignore
3367
+ emptyState: e.emptyState,
3368
+ // @ts-ignore
3369
+ skeleton: e.skeleton
3370
+ }
3371
+ )), Cn = (e) => new pt({
3372
+ cache: "list",
3373
+ scrollContainer: e.scrollContainer,
3374
+ loadMoreItems: e.loadMoreItems,
3375
+ offset: e.offset,
3376
+ limit: e.limit,
3377
+ key: e.key,
3378
+ tableData: e.tableData,
3379
+ items: e.items,
3380
+ rowItem: (t) => e.rowItem(t, e.selectRow),
3381
+ class: "divide-y divide-border",
3382
+ skeleton: e.skeleton,
3383
+ columnCount: e.columnCount
3384
+ });
3385
+ class Sn extends Qe {
3386
+ /**
3387
+ * Renders the DataTable component.
3388
+ *
3389
+ * @returns {object}
3390
+ */
3391
+ render() {
3392
+ const t = this.border !== !1 ? "border" : "", s = this.getHeaderColCount();
3393
+ return o({ class: "w-full flex flex-auto flex-col" }, [
3394
+ Q("hasItems", (n) => n === !1 && this.emptyState ? this.emptyState() : null),
3395
+ o({ class: `w-full rounded-md ${t} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
3396
+ be({ class: "w-full" }, [
3397
+ // @ts-ignore
3398
+ this.headers && ye({ headers: this.headers, sort: (n) => this.sortRows(n) }),
3399
+ // @ts-ignore
3400
+ this.customHeader ?? null,
3401
+ Cn({
3402
+ // @ts-ignore
3403
+ scrollContainer: this.scrollContainer,
3404
+ // @ts-ignore
3405
+ loadMoreItems: this.loadMoreItems,
3406
+ // @ts-ignore
3407
+ offset: this.offset,
3408
+ // @ts-ignore
3409
+ limit: this.limit,
3410
+ // @ts-ignore
3411
+ class: this.class,
3412
+ // @ts-ignore
3413
+ tableData: this.tableData,
3414
+ // @ts-ignore
3415
+ key: this.key,
3416
+ // @ts-ignore
3417
+ items: this.rows,
3418
+ // @ts-ignore
3419
+ selectRow: this.selectRow.bind(this),
3420
+ // @ts-ignore
3421
+ rowItem: this.rowItem,
3422
+ // @ts-ignore
3423
+ skeleton: this.skeleton,
3424
+ columnCount: s
3425
+ })
3426
+ ])
3427
+ ])
3428
+ ]);
3429
+ }
3430
+ /**
3431
+ * Refreshes the list.
3432
+ *
3433
+ * @returns {void}
3434
+ */
3435
+ refresh() {
3436
+ this.list.refresh();
3437
+ }
3438
+ }
3439
+ const io = r((e) => new Sn(
3440
+ {
3441
+ // @ts-ignore
3442
+ cache: e.cache ?? "list",
3443
+ // @ts-ignore
3444
+ tableData: e.data,
3445
+ // @ts-ignore
3446
+ scrollContainer: e.scrollContainer,
3447
+ // @ts-ignore
3448
+ loadMoreItems: e.loadMoreItems,
3449
+ // @ts-ignore
3450
+ offset: e.offset,
3451
+ // @ts-ignore
3452
+ limit: e.limit,
3453
+ // @ts-ignore
3454
+ class: e.class,
3455
+ // @ts-ignore
3456
+ key: e.key,
3457
+ // @ts-ignore
3458
+ rows: e.rows,
3459
+ // @ts-ignore
3460
+ rowItem: e.rowItem,
3461
+ // @ts-ignore
3462
+ headers: e.headers,
3463
+ // @ts-ignore
3464
+ customHeader: e.customHeader,
3465
+ // @ts-ignore
3466
+ border: e.border,
3467
+ // @ts-ignore
3468
+ emptyState: e.emptyState,
3469
+ // @ts-ignore
3470
+ skeleton: e.skeleton
3471
+ }
3472
+ )), $n = r(({ name: e, email: t }) => o({ class: "min-w-0 flex-auto" }, [
3473
+ k({ class: "text-base font-semibold leading-6 m-0" }, e),
3474
+ k({ class: "truncate text-sm leading-5 text-muted-foreground m-0" }, t)
3475
+ ])), Dn = () => o({ class: "flex items-center gap-x-1.5" }, [
3476
+ o({ class: "flex-none rounded-full bg-emerald-500/20 p-1" }, [
3477
+ o({ class: "h-1.5 w-1.5 rounded-full bg-emerald-500" })
3478
+ ]),
3479
+ k({ class: "text-xs leading-5 text-gray-500" }, "Online")
3480
+ ]), In = (e) => k({ class: "text-xs leading-5 text-muted-foreground" }, [
3481
+ g("Last seen "),
3482
+ ut({ datetime: e }, "3h ago")
3483
+ ]), Tn = (e, t) => e === "online" ? Dn() : In(t), Mn = r(({ role: e, lastSeen: t, status: s }) => o({ class: "hidden shrink-0 sm:flex sm:flex-col sm:items-end" }, [
3484
+ k({ class: "text-sm leading-6 m-0" }, e),
3485
+ Tn(s, t)
3486
+ ])), Bn = (e) => e.split(" ").map((s) => s[0]).join(""), Pn = r((e) => ge({ class: "fadeIn flex justify-between gap-x-6 py-4 px-4 rounded-md hover:bg-muted/50" }, [
3487
+ o({ class: "flex min-w-0 gap-x-4" }, [
3488
+ // @ts-ignore
3489
+ fs({ src: e.image, alt: e.name, fallbackText: Bn(e.name) }),
3490
+ // @ts-ignore
3491
+ $n({ name: e.name, email: e.email })
3492
+ ]),
3493
+ Mn({
3494
+ // @ts-ignore
3495
+ role: e.role,
3496
+ // @ts-ignore
3497
+ lastSeen: e.lastSeen,
3498
+ // @ts-ignore
3499
+ status: e.status
3500
+ })
3501
+ ])), co = r((e) => new yt({
3502
+ cache: "list",
3503
+ key: "name",
3504
+ // @ts-ignore
3505
+ items: e.users,
3506
+ role: "list",
3507
+ class: "divide-y divide-border",
3508
+ rowItem: Pn
3509
+ }));
3510
+ class zn extends C {
3511
+ /**
3512
+ * This will declare the props for the compiler.
3513
+ *
3514
+ * @returns {void}
3515
+ */
3516
+ declareProps() {
3517
+ this.class = "", this.checkCallBack = null;
3518
+ }
3519
+ /**
3520
+ * This will render the component.
3521
+ *
3522
+ * @override
3523
+ * @returns {object}
3524
+ */
3525
+ render() {
3526
+ const t = this.state;
3527
+ return w({
3528
+ class: this.class || "",
3529
+ onState: [
3530
+ ["selected", {
3531
+ selected: !0
3532
+ }],
3533
+ ["active", {
3534
+ active: !0
3535
+ }]
3536
+ ],
3537
+ click: () => {
3538
+ if (t.toggle("active"), !this.checkCallBack)
3539
+ return;
3540
+ const s = t.active ? this : null;
3541
+ this.checkCallBack(s);
3542
+ }
3543
+ }, this.children);
3544
+ }
3545
+ /**
3546
+ * This will set up the states.
3547
+ *
3548
+ * @override
3549
+ * @protected
3550
+ * @returns {object}
3551
+ */
3552
+ setupStates() {
3553
+ return {
3554
+ selected: !1,
3555
+ active: !1
3556
+ };
3557
+ }
3558
+ /**
3559
+ * This will update the states.
3560
+ *
3561
+ * @param {object} selected
3562
+ * @returns {void}
3563
+ */
3564
+ update(t) {
3565
+ this.state.set({
3566
+ selected: t,
3567
+ active: t
3568
+ });
3569
+ }
3570
+ }
3571
+ const On = r(({ options: e, click: t }, s) => ({
3572
+ tag: "li",
3573
+ ...{
3574
+ class: `relative flex flex-row w-auto text-left p-0 transition-all cursor-pointer min-w-[48px] option${e ? " sub" : ""}`,
3575
+ click: t
3576
+ },
3577
+ children: s
3578
+ })), Nn = (e, t = null, s = !1) => [
3579
+ t && o({
3580
+ class: "icon w-12 rounded-md flex items-center justify-center min-w-12",
3581
+ onState: ["selected", {
3582
+ selected: !0
3583
+ }]
3584
+ }, [
3585
+ x({ size: "sm" }, t)
3586
+ ]),
3587
+ V({ class: "label flex flex-auto text-sm items-center cursor-pointer whitespace-nowrap" }, e),
3588
+ s && g(
3589
+ {
3590
+ class: "flex justify-center items-center px-1 transition-all text-muted-foreground mr-2",
3591
+ onState: [
3592
+ ["selected", {
3593
+ rotate: !0
3594
+ }],
3595
+ ["active", {
3596
+ rotate: !0
3597
+ }]
3598
+ ]
3599
+ },
3600
+ [
3601
+ x({ size: "xs" }, u.chevron.single.down)
3602
+ ]
3603
+ )
3604
+ ];
3605
+ class Je extends C {
3606
+ /**
3607
+ * This will declare the props for the compiler.
3608
+ *
3609
+ * @returns {void}
3610
+ */
3611
+ declareProps() {
3612
+ this.label = "", this.icon = null, this.href = null, this.exact = !1, this.options = null, this.content = null, this.callBack = null, this.checkCallBack = null, this.link = null;
3613
+ }
3614
+ /**
3615
+ * This will render the component.
3616
+ *
3617
+ * @override
3618
+ * @returns {object}
3619
+ */
3620
+ render() {
3621
+ const t = !this.options && this.callBack;
3622
+ return On(
3623
+ { options: this.options, click: t },
3624
+ [
3625
+ this.addLink()
3626
+ ]
3627
+ );
3628
+ }
3629
+ /**
3630
+ * This will add the link.
3631
+ *
3632
+ * @returns {object}
3633
+ * @protected
3634
+ */
3635
+ addLink() {
3636
+ const t = this.options && this.options.length > 0, s = this.content || Nn(String(this.label), this.icon, t);
3637
+ return this.href ? new gt(
3638
+ {
3639
+ class: "flex flex-auto flex-row rounded-md transition-all overflow-x-hidden",
3640
+ cache: "link",
3641
+ href: this.href,
3642
+ activeClass: "selected",
3643
+ exact: this.exact || !1
3644
+ },
3645
+ s
3646
+ ) : new zn({
3647
+ class: "flex flex-auto flex-row rounded-md transition-all overflow-x-hidden",
3648
+ cache: "link",
3649
+ checkCallBack: this.checkCallBack
3650
+ }, s);
3651
+ }
3652
+ /**
3653
+ * This will check if the link is selected.
3654
+ *
3655
+ * @returns {boolean}
3656
+ */
3657
+ isSelected() {
3658
+ return this.link.state.get("selected");
3659
+ }
3660
+ update(t) {
3661
+ this.link.update(t);
3662
+ }
3663
+ }
3664
+ const Rn = r(({ map: e }, t) => X({ class: "navigation-group flex flex-col gap-2 list-none m-0 py-2 px-0", map: e }, [
3665
+ Ee({ class: "text-muted-foreground text-sm py-0 px-4 whitespace-nowrap" }, t)
3666
+ ]));
3667
+ class Fn extends C {
3668
+ /**
3669
+ * This will declare the props for the compiler.
3670
+ *
3671
+ * @returns {void}
3672
+ */
3673
+ declareProps() {
3674
+ this.options = [], this.class = "", this.mobileBorder = !1;
3675
+ }
3676
+ /**
3677
+ * This will render the component.
3678
+ *
3679
+ * @returns {object}
3680
+ */
3681
+ render() {
3682
+ const t = this.mapOptions(this.options), s = this.class || "", n = this.mobileBorder ? "border md:border-0 rounded-md" : "";
3683
+ return fe({ class: `navigation flex flex-auto flex-col ${s}` }, [
3684
+ X({
3685
+ class: `relative group flex flex-col gap-2 py-2 px-2 list-none m-0 ${n}`,
3686
+ map: t
3687
+ }),
3688
+ ...this.addSubs()
3689
+ ]);
3690
+ }
3691
+ /**
3692
+ * This will get the options.
3693
+ *
3694
+ * @param {array} options
3695
+ * @returns {array}
3696
+ */
3697
+ mapOptions(t = []) {
3698
+ return [t.map((n) => n.group ? this.addGroup(n) : this.addLink(n)), (n) => n];
3699
+ }
3700
+ /**
3701
+ * This will get the subs.
3702
+ *
3703
+ * @returns {array}
3704
+ */
3705
+ addSubs() {
3706
+ return [];
3707
+ }
3708
+ /**
3709
+ * This will add a group.
3710
+ *
3711
+ * @param {object} option
3712
+ * @returns {object}
3713
+ */
3714
+ addGroup(t) {
3715
+ const s = this.mapOptions(t.options);
3716
+ return Rn({ map: s }, t.group);
3717
+ }
3718
+ /**
3719
+ * This will add a link.
3720
+ *
3721
+ * @param {object} option
3722
+ * @returns {object}
3723
+ */
3724
+ addLink(t) {
3725
+ return new Je(t);
3726
+ }
3727
+ }
3728
+ class Ze extends Fn {
3729
+ onCreated() {
3730
+ this.links = [];
3731
+ }
3732
+ /**
3733
+ * This will set up the sub nav.
3734
+ *
3735
+ * @param {object} link
3736
+ * @returns {object}
3737
+ */
3738
+ setupSubNav(t) {
3739
+ return new An(
3740
+ {
3741
+ parentLink: t,
3742
+ options: t.options
3743
+ }
3744
+ );
3745
+ }
3746
+ /**
3747
+ * This will add a sub navigation.
3748
+ *
3749
+ * @param {object} link
3750
+ * @returns {object}
3751
+ */
3752
+ addSubNav(t) {
3753
+ const s = this.setupSubNav(t);
3754
+ return t.sub = s, s;
3755
+ }
3756
+ /**
3757
+ * This will add a link.
3758
+ *
3759
+ * @param {object} option
3760
+ * @returns {object}
3761
+ */
3762
+ addLink(t) {
3763
+ const s = new Je(t);
3764
+ if (this.links.push(s), !s.options)
3765
+ return s;
3766
+ const n = this.addSubNav(s);
3767
+ return {
3768
+ class: "child-group",
3769
+ link: s,
3770
+ sub: n
3771
+ };
3772
+ }
3773
+ }
3774
+ const Ln = (e, t) => new RegExp(`${e}($|/|\\.).*`).test(t), jn = (e, t) => {
3775
+ const s = e.link.panel.pathname;
3776
+ return !s && e.isSelected() ? !0 : e.exact ? t === s : Ln(s, t);
3777
+ };
3778
+ class An extends Ze {
3779
+ /**
3780
+ * This will declare the props for the compiler.
3781
+ *
3782
+ * @returns {void}
3783
+ */
3784
+ declareProps() {
3785
+ super.declareProps(), this.parentLink = null, this.mainClassName = "";
3786
+ }
3787
+ /**
3788
+ * This will render the component.
3789
+ *
3790
+ * @returns {object}
3791
+ */
3792
+ render() {
3793
+ const t = `navigation flex flex-auto flex-col sub ${this.mainClassName || ""}`, s = this.mapOptions(this.options);
3794
+ return fe({ class: t, onState: this.onState() }, [
3795
+ X({ class: "relative group flex flex-col gap-2 py-2 px-0 list-none m-0" }, [...s, ...this.addSubs(), this.addWatcher()])
3796
+ ]);
3797
+ }
3798
+ /**
3799
+ * This will add awatcher to update the links
3800
+ * when the path changes.
3801
+ *
3802
+ * @returns {object}
3803
+ */
3804
+ addWatcher() {
3805
+ return {
3806
+ watch: {
3807
+ value: ["[[path]]", ve.data],
3808
+ callBack: this.updateLinks.bind(this)
3809
+ }
3810
+ };
3811
+ }
3812
+ /**
3813
+ * This will set up the on state.
3814
+ *
3815
+ * @returns {array}
3816
+ */
3817
+ onState() {
3818
+ return [
3819
+ ["selected", { active: !0 }],
3820
+ ["active", { active: !0 }]
3821
+ ];
3822
+ }
3823
+ /**
3824
+ * This will set up the states.
3825
+ *
3826
+ * @returns {object}
3827
+ */
3828
+ setupStates() {
3829
+ return {
3830
+ remotes: [
3831
+ {
3832
+ /**
3833
+ * This will link the state to the parent link.
3834
+ */
3835
+ id: this.parentLink.link.getId(),
3836
+ selected: null,
3837
+ active: null
3838
+ }
3839
+ ]
3840
+ };
3841
+ }
3842
+ /**
3843
+ * This will update the links after setup.
3844
+ *
3845
+ * @returns {void}
3846
+ */
3847
+ afterSetup() {
3848
+ const t = ve.data.path;
3849
+ this.updateLinks(t);
3850
+ }
3851
+ /**
3852
+ * This will update the links.
3853
+ *
3854
+ * @param {string} value
3855
+ * @returns {void}
3856
+ */
3857
+ updateLinks(t) {
3858
+ let s = !1;
3859
+ for (const n of this.links)
3860
+ if (n.rendered && (s = jn(n, t), s === !0))
3861
+ break;
3862
+ this.parentLink.update(s);
3863
+ }
3864
+ }
3865
+ const Hn = (e) => he({ class: "text-lg ml-2" }, e), En = (e) => o({ class: "sticky flex flex-row items-center bg-popover lg:hidden top-0 z-10 border-0 border-b" }, [
3866
+ b({
3867
+ variant: "icon",
3868
+ class: "m-2",
3869
+ click: (t, { state: s }) => s.toggle("open"),
3870
+ icon: u.arrows.left
3871
+ }),
3872
+ e.title && Hn(e.title)
3873
+ ]), Un = () => o({
3874
+ class: `
3875
+ absolute inset-0 bg-black/40 z-[-1] fadeIn
3876
+ transition-opacity duration-200
3877
+ `,
3878
+ click: (e, { state: t }) => t.open = !1
3879
+ });
3880
+ class Yn extends C {
3881
+ /**
3882
+ * This will declare the props for the compiler.
3883
+ *
3884
+ * @returns {void}
3885
+ */
3886
+ declareProps() {
3887
+ this.title = "";
3888
+ }
3889
+ /**
3890
+ * This will render the modal component.
3891
+ *
3892
+ * @returns {object}
3893
+ */
3894
+ render() {
3895
+ return o({
3896
+ class: "fixed inset-0 z-50",
3897
+ style: "[[typeClass]]"
3898
+ }, [
3899
+ Un(),
3900
+ // Popover Content
3901
+ o({
3902
+ class: `
3903
+ absolute popIn w-auto p-0 bg-popover m-auto shadow-lg rounded-md top-0 bottom-0 left-2 right-2 max-h-[85vh] text-inherit block
3904
+ `,
3905
+ dataSet: ["open", ["expanded", !0, "true"]]
3906
+ }, [
3907
+ o({ class: "flex flex-auto flex-col w-full h-full overflow-y-auto max-h-[85vh] rounded-md bg-popover border" }, [
3908
+ En({ title: this.title }),
3909
+ o({ class: "flex flex-auto flex-col" }, this.children)
3910
+ ])
3911
+ ])
3912
+ ]);
3913
+ }
3914
+ /**
3915
+ * This will setup the states.
3916
+ *
3917
+ * @returns {object}
3918
+ */
3919
+ setupStates() {
3920
+ return {
3921
+ open: {
3922
+ id: this.parent.getId(),
3923
+ callBack: (n) => {
3924
+ n === !1 && (document.documentElement.style.overflowY = "auto", this.destroy());
3925
+ }
3926
+ }
3927
+ };
3928
+ }
3929
+ /**
3930
+ * This will add the body scroll lock.
3931
+ *
3932
+ * @returns {void}
3933
+ */
3934
+ afterSetup() {
3935
+ document.documentElement.style.overflowY = "hidden";
3936
+ }
3937
+ /**
3938
+ * This will override the set up to use the body.
3939
+ *
3940
+ * @param {object} container
3941
+ */
3942
+ setContainer(t) {
3943
+ this.container = app.root;
3944
+ }
3945
+ }
3946
+ const Xe = () => b({ class: "m-2", variant: "ghost", addState() {
3947
+ return {
3948
+ open: !1
3949
+ };
3950
+ }, click: (e, { state: t }) => t.toggle("open") }, [
3951
+ x({}, u.bar.three)
3952
+ ]), Vn = (e) => he({ class: "text-lg ml-2" }, e), Wn = (e) => o({ class: "flex flex-auto flex-row items-center lg:hidden" }, [
3953
+ Xe(),
3954
+ e.title && Vn(e.title)
3955
+ ]), et = (e, t) => {
3956
+ e.forEach((s) => {
3957
+ if (s.options) {
3958
+ et(s.options, t);
3959
+ return;
3960
+ }
3961
+ s.callBack = t;
3962
+ });
3963
+ }, tt = (e) => o({ class: "bg-background flex flex-auto flex-col w-full relative" }, [
3964
+ T(
3965
+ "open",
3966
+ (t) => t ? [
3967
+ new Yn({ title: e.title }, [
3968
+ W(({ state: s }) => {
3969
+ const n = (a) => s.open = !1;
3970
+ return et(e.options, n), new Ze(
3971
+ {
3972
+ options: e.options
3973
+ }
3974
+ );
3975
+ })
3976
+ ])
3977
+ ] : null
3978
+ )
3979
+ ]), uo = r((e) => o({ cache: "mobileNav", class: "inline-flex relative lg:hidden" }, [
3980
+ o([
3981
+ Xe(),
3982
+ tt(e)
3983
+ ])
3984
+ ])), ho = r((e) => o({ cache: "mobileNav", class: "flex flex-auto flex-col w-full relative lg:hidden" }, [
3985
+ o({ class: "flex flex-auto flex-col w-full" }, [
3986
+ Wn(e),
3987
+ tt(e)
3988
+ ])
3989
+ ])), fo = r((e) => {
3990
+ const t = e.margin || "m-4 ml-0";
3991
+ return e.allowHistory = e.allowHistory === !0, o({ class: `flex-none ${t}` }, [
3992
+ b({ variant: "back", class: "ghost", ...e })
3993
+ ]);
3994
+ });
3995
+ class qn extends C {
3996
+ /**
3997
+ * This will declare the props for the compiler.
3998
+ *
3999
+ * @returns {void}
4000
+ */
4001
+ declareProps() {
4002
+ this.class = "";
4003
+ }
4004
+ /**
4005
+ * This will render the component.
4006
+ *
4007
+ * @returns {object}
4008
+ */
4009
+ render() {
4010
+ return o(
4011
+ {
4012
+ class: this.getClassName(),
4013
+ // @ts-ignore
4014
+ animateIn: this.animateIn ?? null,
4015
+ // @ts-ignore
4016
+ animateOut: this.animateOut ?? null,
4017
+ onSet: ["loading", {
4018
+ loading: !0
4019
+ }]
4020
+ },
4021
+ [
4022
+ this.addBody()
4023
+ ]
4024
+ );
4025
+ }
4026
+ /**
4027
+ * This will get the overlay className.
4028
+ *
4029
+ * @returns {string}
4030
+ */
4031
+ getClassName() {
4032
+ return `absolute flex flex-auto flex-col overlay left-0 top-0 right-0 z-20
4033
+ h-svh max-h-svh min-h-svh
4034
+ bg-background pointer-events-auto
4035
+ lg:left-16
4036
+ will-change-contents ${this.class || ""}`;
4037
+ }
4038
+ /**
4039
+ * This will setup and render the component.
4040
+ *
4041
+ * @param {object} container
4042
+ * @returns {void}
4043
+ */
4044
+ setContainer(t) {
4045
+ this.container = app.root;
4046
+ }
4047
+ /**
4048
+ * This will setup the overlay states.
4049
+ *
4050
+ * @returns {object}
4051
+ */
4052
+ setupStates() {
4053
+ return {
4054
+ loading: !1
4055
+ };
4056
+ }
4057
+ /**
4058
+ * This will set the loading state.= to true.
4059
+ *
4060
+ * @returns {void}
4061
+ */
4062
+ addLoading() {
4063
+ this.state.loading = !0;
4064
+ }
4065
+ /**
4066
+ * This will set the loading state to false.
4067
+ *
4068
+ * @returns {void}
4069
+ */
4070
+ removeLoading() {
4071
+ this.state.loading = !1;
4072
+ }
4073
+ /**
4074
+ * This will add the body of the overlay.
4075
+ *
4076
+ * @returns {object}
4077
+ */
4078
+ addBody() {
4079
+ return o({ class: "body fadeIn flex flex-auto flex-col bg-background" }, this.getContents());
4080
+ }
4081
+ /**
4082
+ * This will get the body contents.
4083
+ *
4084
+ * @returns {array|null}
4085
+ */
4086
+ getContents() {
4087
+ return this.children;
4088
+ }
4089
+ }
4090
+ Ve.addType("dockableOverlay", (e) => {
4091
+ if (!e)
4092
+ return;
4093
+ const t = e.component;
4094
+ t && t.rendered === !0 && t.state.docked === !1 && t.destroy();
4095
+ });
4096
+ class go extends qn {
4097
+ /**
4098
+ * This will stop presistence.
4099
+ *
4100
+ * @returns {void}
4101
+ */
4102
+ onCreated() {
4103
+ this.dockSize = this.maxSize || 1024;
4104
+ }
4105
+ /**
4106
+ * This will render the component.
4107
+ *
4108
+ * @returns {object}
4109
+ */
4110
+ render() {
4111
+ const t = this.container;
4112
+ return o(
4113
+ {
4114
+ // @ts-ignore
4115
+ animateIn: this.animateIn ?? null,
4116
+ // @ts-ignore
4117
+ animateOut: this.animateOut ?? null,
4118
+ onState: [
4119
+ ["loading", {
4120
+ loading: !0
4121
+ }],
4122
+ ["docked", (s, n) => {
4123
+ s ? (n.className = this.getDockedClassName(), t.appendChild(n)) : (n.className = this.getClassName(), app.root.appendChild(n));
4124
+ }]
4125
+ ]
4126
+ },
4127
+ [
4128
+ this.addBody()
4129
+ ]
4130
+ );
4131
+ }
4132
+ /**
4133
+ * This will get the docked className.
4134
+ *
4135
+ * @returns {string}
4136
+ */
4137
+ getDockedClassName() {
4138
+ return "flex flex-auto flex-col bg-background flex will-change-contents " + (this.class || "");
4139
+ }
4140
+ /**
4141
+ * This will setup and render the component.
4142
+ *
4143
+ * @param {object} container
4144
+ * @returns {void}
4145
+ */
4146
+ setup(t) {
4147
+ this.container = t, this.initialize();
4148
+ }
4149
+ /**
4150
+ * This will setup the overlay states.
4151
+ *
4152
+ * @returns {object}
4153
+ */
4154
+ setupStates() {
4155
+ return {
4156
+ loading: !1,
4157
+ docked: this.canDock()
4158
+ };
4159
+ }
4160
+ /**
4161
+ * This will check the dock size.
4162
+ *
4163
+ * @returns {void}
4164
+ */
4165
+ afterSetup() {
4166
+ Ve.add(
4167
+ this.container,
4168
+ "dockableOverlay",
4169
+ {
4170
+ component: this
4171
+ }
4172
+ ), this.onResize();
4173
+ }
4174
+ /**
4175
+ * This will setup the overlay events.
4176
+ *
4177
+ * @returns {Array<object>}
4178
+ */
4179
+ setupEvents() {
4180
+ return [
4181
+ ["resize", globalThis, () => this.onResize()]
4182
+ ];
4183
+ }
4184
+ /**
4185
+ * This will check if the overlay can dock.
4186
+ *
4187
+ * @returns {boolean}
4188
+ */
4189
+ canDock() {
4190
+ return globalThis.innerWidth >= this.dockSize;
4191
+ }
4192
+ /**
4193
+ * This will handle the overlay resize.
4194
+ *
4195
+ * @returns {void}
4196
+ */
4197
+ onResize() {
4198
+ this.state.docked = this.canDock();
4199
+ }
4200
+ }
4201
+ const Gn = r(({ index: e, click: t, state: s }, n) => ge({
4202
+ class: "p-2 cursor-pointer hover:bg-muted/50",
4203
+ onState: [
4204
+ [s, "selectedIndex", {
4205
+ "bg-accent": e,
4206
+ "text-white": e
4207
+ }]
4208
+ ],
4209
+ click: () => t(e)
4210
+ }, n)), _n = r(({ selectOption: e, state: t }) => X({
4211
+ class: "border rounded-md list-none m-0 p-0 max-h-[400px] overflow-y-auto",
4212
+ for: ["filteredOptions", (s, n) => Gn({ index: n, click: e, state: t }, s.label)]
4213
+ })), Kn = r((e) => o({ class: "relative flex flex-auto items-center" }, [
4214
+ N({
4215
+ cache: "input",
4216
+ // @ts-ignore
4217
+ class: e.class ?? "",
4218
+ // @ts-ignore
4219
+ placeholder: e.placeholder ?? "Search...",
4220
+ // @ts-ignore
4221
+ bind: e.bind ?? [e.state, "searchQuery"],
4222
+ keyup: (t, s) => {
4223
+ s.state && (s.state.open = !1), typeof e.filterOptions == "function" && e.filterOptions(), s.dropdown && s.dropdown.updatePosition(), e.keyup && e.keyup(t, s);
4224
+ },
4225
+ pointerup: (t, s) => {
4226
+ typeof s.toggleDropdown == "function" && s.toggleDropdown();
4227
+ },
4228
+ keydown: (t) => [
4229
+ // @ts-ignore
4230
+ typeof e.handleKeyDown == "function" && e.handleKeyDown(t)
4231
+ ]
4232
+ }),
4233
+ // @ts-ignore
4234
+ e.icon && o({ class: "absolute flex right-0 mr-2" }, [
4235
+ // @ts-ignore
4236
+ x({ size: "sm" }, e.icon)
4237
+ ])
4238
+ ])), Qn = (e) => o({
4239
+ class: "relative flex fle-auto flex-col",
4240
+ onState: ["open", (t, s, n) => {
4241
+ if (t)
4242
+ return new te({
4243
+ cache: "dropdown",
4244
+ parent: n,
4245
+ button: n.input,
4246
+ size: "xl"
4247
+ }, [
4248
+ _n(e)
4249
+ ]);
4250
+ }]
4251
+ }), mo = M(
4252
+ {
4253
+ /**
4254
+ * This will set up the data object.
4255
+ *
4256
+ * @returns {object} - The data object.
4257
+ */
4258
+ setData() {
4259
+ const e = this.options || [];
4260
+ return new z({
4261
+ options: e,
4262
+ filteredOptions: e
4263
+ });
4264
+ },
4265
+ /**
4266
+ * This will set up the state object.
4267
+ *
4268
+ * @returns {object} - The state object.
4269
+ */
4270
+ state() {
4271
+ return {
4272
+ searchQuery: "",
4273
+ selectedIndex: -1,
4274
+ open: !1
4275
+ };
4276
+ },
4277
+ /**
4278
+ * This will set the selected index by query.
4279
+ *
4280
+ * @returns {void}
4281
+ */
4282
+ setSelectedIndexByQuery() {
4283
+ const e = this.data.filteredOptions;
4284
+ let { searchQuery: t } = this.state;
4285
+ t = t.toLowerCase();
4286
+ const s = e.findIndex((n) => n.label.toLowerCase() === t);
4287
+ s >= 0 && (this.state.selectedIndex = s);
4288
+ },
4289
+ /**
4290
+ * This will filter the options.
4291
+ *
4292
+ * @returns {void}
4293
+ */
4294
+ filterOptions() {
4295
+ const e = this.state.searchQuery.toLowerCase();
4296
+ if (e === "" || e.length === 0) {
4297
+ this.data.filteredOptions = this.data.options;
4298
+ return;
4299
+ }
4300
+ const t = this.data.get("options");
4301
+ this.data.filteredOptions = t.filter(
4302
+ (s) => s.label.toLowerCase().includes(e)
4303
+ );
4304
+ },
4305
+ /**
4306
+ * This will get the selected value.
4307
+ *
4308
+ * @returns {object}
4309
+ */
4310
+ getValue() {
4311
+ const { selectedIndex: e } = this.state;
4312
+ return e < 0 ? null : this.data.get(`filteredOptions[${e}]`);
4313
+ },
4314
+ /**
4315
+ * This will select an option.
4316
+ *
4317
+ * @param {number} index - The index of the option.
4318
+ * @returns {void}
4319
+ */
4320
+ selectOption(e) {
4321
+ this.state.selectedIndex = e;
4322
+ const t = this.data.get(`filteredOptions[${e}]`);
4323
+ this.state.searchQuery = t.label, this.state.open = !1, typeof this.onSelect == "function" && this.onSelect(t);
4324
+ },
4325
+ /**
4326
+ * Toggles the dropdown open state.
4327
+ */
4328
+ toggleDropdown() {
4329
+ this.state.toggle("open"), this.state.open && this.setSelectedIndexByQuery();
4330
+ },
4331
+ /**
4332
+ * This will handle key down events.
4333
+ *
4334
+ * @param {object} event - The event object.
4335
+ * @returns {void}
4336
+ */
4337
+ handleKeyDown(e) {
4338
+ const t = this.data.filteredOptions, { selectedIndex: s } = this.state;
4339
+ e.key === "ArrowDown" ? (e.preventDefault(), this.state.selectedIndex = Math.min(s + 1, t.length - 1)) : e.key === "ArrowUp" ? (e.preventDefault(), this.state.selectedIndex = Math.max(s - 1, 0)) : e.key === "Enter" && s >= 0 && (e.preventDefault(), this.selectOption(s));
4340
+ },
4341
+ /**
4342
+ * This will render the component.
4343
+ *
4344
+ * @returns {object} - The rendered component.
4345
+ */
4346
+ render() {
4347
+ return o({ class: "relative w-full max-w-md" }, [
4348
+ Kn({
4349
+ // @ts-ignore
4350
+ state: this.state,
4351
+ // @ts-ignore
4352
+ icon: this.icon,
4353
+ // @ts-ignore
4354
+ placeholder: this.placeholder,
4355
+ // @ts-ignore
4356
+ filterOptions: this.filterOptions.bind(this),
4357
+ // @ts-ignore
4358
+ handleKeyDown: this.handleKeyDown.bind(this)
4359
+ }),
4360
+ Qn({
4361
+ // @ts-ignore
4362
+ state: this.state,
4363
+ // @ts-ignore
4364
+ setSelected: this.setSelectedIndexByQuery.bind(this),
4365
+ // @ts-ignore
4366
+ selectOption: this.selectOption.bind(this)
4367
+ })
4368
+ ]);
4369
+ }
4370
+ }
4371
+ ), bo = r((e) => {
4372
+ const t = e.icon ?? u.magnifyingGlass.default;
4373
+ return o({
4374
+ // @ts-ignore
4375
+ class: `relative flex items-center w-full rounded-xl bg-muted/30 focus-within:ring-2 focus-within:ring-ring transition-all ${e.containerClass || ""}`
4376
+ }, [
4377
+ o({ class: "absolute left-4 flex items-center pointer-events-none text-muted-foreground" }, [
4378
+ x({ size: "sm" }, t)
4379
+ ]),
4380
+ p({
4381
+ type: "text",
4382
+ // @ts-ignore
4383
+ cache: e.cache ?? "input",
4384
+ // @ts-ignore
4385
+ class: `w-full bg-transparent border-none outline-none pl-12 pr-4 py-4 text-base text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-0 ${e.class || ""}`,
4386
+ // @ts-ignore
4387
+ placeholder: e.placeholder ?? "Search...",
4388
+ // @ts-ignore
4389
+ bind: e.bind,
4390
+ // @ts-ignore
4391
+ value: e.value,
4392
+ // @ts-ignore
4393
+ keyup: e.keyup,
4394
+ // @ts-ignore
4395
+ keydown: e.keydown,
4396
+ // @ts-ignore
4397
+ input: e.input,
4398
+ // @ts-ignore
4399
+ change: e.change,
4400
+ // @ts-ignore
4401
+ focus: e.focus,
4402
+ // @ts-ignore
4403
+ blur: e.blur
4404
+ })
4405
+ ]);
4406
+ });
4407
+ class Jn extends C {
4408
+ /**
4409
+ * This will declare the props for the compiler.
4410
+ *
4411
+ * @returns {void}
4412
+ */
4413
+ declareProps() {
4414
+ this.class = "";
4415
+ }
4416
+ /**
4417
+ * This will render the page.
4418
+ *
4419
+ * @returns {object}
4420
+ */
4421
+ render() {
4422
+ return o({ class: `${this.class || ""}` }, this.children);
4423
+ }
4424
+ }
4425
+ class Zn extends Jn {
4426
+ /**
4427
+ * This will be called every time the route
4428
+ * is activated.
4429
+ *
4430
+ * @param {object} params
4431
+ */
4432
+ update(t) {
4433
+ }
4434
+ }
4435
+ const Xn = r((e, t) => (e.class = "basic-page pt-[80px] sm:pt-0 flex flex-auto flex-col " + (e.class || ""), {
4436
+ tag: "section",
4437
+ ...e,
4438
+ children: t
4439
+ })), ea = r(({ title: e, description: t }) => Z({ class: "sm:py-8 px-6 md:px-5 flex flex-col" }, [
4440
+ ht({ class: "scroll-m-20 text-3xl font-bold tracking-tight" }, e),
4441
+ t && k({ class: "text-base text-muted-foreground py-2 max-w-[700px]" }, t)
4442
+ ]));
4443
+ class xo extends Zn {
4444
+ /**
4445
+ * This will declare the props for the compiler.
4446
+ *
4447
+ * @returns {void}
4448
+ */
4449
+ declareProps() {
4450
+ super.declareProps(), this.title = "", this.description = "";
4451
+ }
4452
+ /**
4453
+ * This will render the page.
4454
+ *
4455
+ * @returns {object}
4456
+ */
4457
+ render() {
4458
+ return Xn([
4459
+ ea({
4460
+ title: this.title,
4461
+ description: this.description
4462
+ }),
4463
+ wt(this.children)
4464
+ ]);
4465
+ }
4466
+ }
4467
+ export {
4468
+ Ia as $,
4469
+ La as A,
4470
+ fo as B,
4471
+ Es as C,
4472
+ Qe as D,
4473
+ Ya as E,
4474
+ oo as F,
4475
+ go as G,
4476
+ Xa as H,
4477
+ ro as I,
4478
+ ba as J,
4479
+ lo as K,
4480
+ ga as L,
4481
+ Ma as M,
4482
+ Ge as N,
4483
+ ja as O,
4484
+ Ha as P,
4485
+ Aa as Q,
4486
+ es as R,
4487
+ Jt as S,
4488
+ Ea as T,
4489
+ Pt as U,
4490
+ Kt as V,
4491
+ Qt as W,
4492
+ Zt as X,
4493
+ L as Y,
4494
+ xo as Z,
4495
+ yn as _,
4496
+ fs as a,
4497
+ P as a$,
4498
+ ie as a0,
4499
+ Et as a1,
4500
+ Qa as a2,
4501
+ Ze as a3,
4502
+ N as a4,
4503
+ Bt as a5,
4504
+ fa as a6,
4505
+ Ja as a7,
4506
+ Je as a8,
4507
+ Xn as a9,
4508
+ mo as aA,
4509
+ Kn as aB,
4510
+ Pa as aC,
4511
+ bo as aD,
4512
+ Va as aE,
4513
+ An as aF,
4514
+ ye as aG,
4515
+ ma as aH,
4516
+ xa as aI,
4517
+ _a as aJ,
4518
+ wa as aK,
4519
+ ao as aL,
4520
+ Wn as aM,
4521
+ Ka as aN,
4522
+ da as aO,
4523
+ Fa as aP,
4524
+ x as aQ,
4525
+ Da as aR,
4526
+ co as aS,
4527
+ Pn as aT,
4528
+ We as aU,
4529
+ O as aV,
4530
+ Ca as aW,
4531
+ Ms as aX,
4532
+ _t as aY,
4533
+ ia as aZ,
4534
+ ra as a_,
4535
+ $e as aa,
4536
+ $s as ab,
4537
+ uo as ac,
4538
+ ho as ad,
4539
+ As as ae,
4540
+ ka as af,
4541
+ Xe as ag,
4542
+ zn as ah,
4543
+ Fn as ai,
4544
+ Rn as aj,
4545
+ Yn as ak,
4546
+ Ga as al,
4547
+ Sa as am,
4548
+ qn as an,
4549
+ Jn as ao,
4550
+ $a as ap,
4551
+ Ds as aq,
4552
+ te as ar,
4553
+ En as as,
4554
+ Oa as at,
4555
+ pa as au,
4556
+ an as av,
4557
+ Ba as aw,
4558
+ Na as ax,
4559
+ Ra as ay,
4560
+ io as az,
4561
+ Un as b,
4562
+ qa as b0,
4563
+ ca as c,
4564
+ Zn as d,
4565
+ Za as e,
4566
+ b as f,
4567
+ Rs as g,
4568
+ Mt as h,
4569
+ Lt as i,
4570
+ pn as j,
4571
+ ha as k,
4572
+ za as l,
4573
+ ua as m,
4574
+ Ta as n,
4575
+ Wa as o,
4576
+ eo as p,
4577
+ Is as q,
4578
+ to as r,
4579
+ wn as s,
4580
+ ya as t,
4581
+ so as u,
4582
+ no as v,
4583
+ va as w,
4584
+ oe as x,
4585
+ Ls as y,
4586
+ Ua as z
4587
+ };