@alexandregme/zljs 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1354 @@
1
+ "use client";
2
+ import {
3
+ Error,
4
+ FormInput,
5
+ FormProvider,
6
+ Input
7
+ } from "./chunk-WAQLH7A5.js";
8
+
9
+ // core/icon/icon.tsx
10
+ import * as LucideIcons from "lucide-react";
11
+ import { SiWhatsapp, SiFacebook, SiInstagram, SiShopify } from "react-icons/si";
12
+ import { Fragment, jsx } from "react/jsx-runtime";
13
+ var brandIcons = {
14
+ SiWhatsapp,
15
+ SiFacebook,
16
+ SiInstagram,
17
+ SiShopify
18
+ };
19
+ var Icon = ({ name }) => {
20
+ const isBrand = name.startsWith("Si");
21
+ const IconComponent = isBrand ? brandIcons[name] : LucideIcons[name];
22
+ if (!IconComponent) return /* @__PURE__ */ jsx(Fragment, {});
23
+ return /* @__PURE__ */ jsx("span", { "data-testid": name, children: /* @__PURE__ */ jsx(IconComponent, { size: 16 }) });
24
+ };
25
+
26
+ // core/button/button.styles.ts
27
+ import { tv } from "tailwind-variants";
28
+ var button = tv({
29
+ base: "cursor-pointer font-medium focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center justify-center",
30
+ variants: {
31
+ variant: {
32
+ default: "px-4 py-2 text-white text-sm gap-2 rounded-md focus:ring-2 focus:ring-offset-2",
33
+ icon: "p-1 bg-transparent text-gray-500 hover:text-gray-700 hover:bg-gray-100 focus:ring-gray-500 rounded-md focus:ring-2 focus:ring-offset-2",
34
+ ghost: "px-3 py-2 gap-3 text-sm bg-transparent text-neutral-400 hover:text-white hover:bg-neutral-800 rounded-md focus-visible:ring-2 focus-visible:ring-neutral-600",
35
+ link: "text-xs underline bg-transparent hover:no-underline"
36
+ },
37
+ color: {
38
+ primary: "bg-blue-600 hover:bg-blue-700 focus:ring-blue-500",
39
+ success: "bg-green-600 hover:bg-green-700 focus:ring-green-500",
40
+ danger: "bg-red-600 hover:bg-red-700 focus:ring-red-500",
41
+ warning: "bg-yellow-500 hover:bg-yellow-600 focus:ring-yellow-500 text-gray-900",
42
+ info: "bg-cyan-500 hover:bg-cyan-600 focus:ring-cyan-500",
43
+ none: ""
44
+ }
45
+ },
46
+ compoundVariants: [
47
+ {
48
+ variant: "link",
49
+ color: "primary",
50
+ class: "bg-transparent text-blue-600 hover:text-blue-800"
51
+ },
52
+ {
53
+ variant: "link",
54
+ color: "danger",
55
+ class: "bg-transparent text-red-600 hover:text-red-800"
56
+ },
57
+ {
58
+ variant: "link",
59
+ color: "none",
60
+ class: "text-slate-500 hover:text-slate-700"
61
+ }
62
+ ],
63
+ defaultVariants: {
64
+ variant: "default",
65
+ color: "primary"
66
+ }
67
+ });
68
+
69
+ // core/button/button.tsx
70
+ import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
71
+ var Button = ({
72
+ children,
73
+ type = "button",
74
+ variant: variantProp,
75
+ color = "primary",
76
+ icon,
77
+ iconPosition = "left",
78
+ disabled = false,
79
+ "aria-label": ariaLabel,
80
+ onClick
81
+ }) => {
82
+ const isIconOnly = icon && !children;
83
+ const variant = variantProp ?? (isIconOnly ? "icon" : "default");
84
+ const renderContent = () => {
85
+ if (!icon) {
86
+ return children;
87
+ }
88
+ const iconElement = /* @__PURE__ */ jsx2(Icon, { name: icon });
89
+ if (isIconOnly) {
90
+ return iconElement;
91
+ }
92
+ return iconPosition === "left" ? /* @__PURE__ */ jsxs(Fragment2, { children: [
93
+ iconElement,
94
+ children
95
+ ] }) : /* @__PURE__ */ jsxs(Fragment2, { children: [
96
+ children,
97
+ iconElement
98
+ ] });
99
+ };
100
+ return /* @__PURE__ */ jsx2(
101
+ "button",
102
+ {
103
+ type,
104
+ disabled,
105
+ onClick,
106
+ "aria-label": ariaLabel,
107
+ className: button({
108
+ variant,
109
+ color: variant === "icon" || variant === "ghost" ? "none" : color
110
+ }),
111
+ children: renderContent()
112
+ }
113
+ );
114
+ };
115
+
116
+ // core/data-grid/data-grid.tsx
117
+ import {
118
+ AllCommunityModule,
119
+ ModuleRegistry,
120
+ themeAlpine
121
+ } from "ag-grid-community";
122
+ import { AgGridReact } from "ag-grid-react";
123
+ import { useState as useState2, useCallback } from "react";
124
+
125
+ // core/data-grid/data-grid-toolbar.tsx
126
+ import { useState } from "react";
127
+
128
+ // core/forms/checkbox/checkbox.tsx
129
+ import { useId } from "react";
130
+
131
+ // core/forms/checkbox/checkbox.styles.ts
132
+ import { tv as tv2 } from "tailwind-variants";
133
+ var wrapper = tv2({
134
+ base: "flex flex-col gap-1"
135
+ });
136
+ var innerWrapper = tv2({
137
+ base: "flex items-center gap-2"
138
+ });
139
+ var checkbox = tv2({
140
+ base: "w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 disabled:cursor-not-allowed"
141
+ });
142
+ var label = tv2({
143
+ base: "text-sm text-gray-700 select-none cursor-pointer"
144
+ });
145
+
146
+ // core/forms/checkbox/checkbox.tsx
147
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
148
+ var Checkbox = ({
149
+ label: labelText,
150
+ checked,
151
+ disabled,
152
+ error,
153
+ onChange
154
+ }) => {
155
+ const id = useId();
156
+ return /* @__PURE__ */ jsxs2("div", { className: wrapper(), children: [
157
+ /* @__PURE__ */ jsxs2("div", { className: innerWrapper(), children: [
158
+ /* @__PURE__ */ jsx3(
159
+ "input",
160
+ {
161
+ id,
162
+ type: "checkbox",
163
+ checked,
164
+ disabled,
165
+ onChange,
166
+ className: checkbox()
167
+ }
168
+ ),
169
+ /* @__PURE__ */ jsx3("label", { htmlFor: id, className: label(), children: labelText })
170
+ ] }),
171
+ error && /* @__PURE__ */ jsx3(Error, { message: error })
172
+ ] });
173
+ };
174
+
175
+ // core/forms/form/form.styles.ts
176
+ import { tv as tv3 } from "tailwind-variants";
177
+ var fieldset = tv3({
178
+ base: "border-none p-0"
179
+ });
180
+
181
+ // core/forms/form/form.tsx
182
+ import { jsx as jsx4 } from "react/jsx-runtime";
183
+ var Form = ({ children, onSubmit, disabled }) => {
184
+ const handleSubmit = (event) => {
185
+ event.preventDefault();
186
+ onSubmit?.(event);
187
+ };
188
+ return /* @__PURE__ */ jsx4("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsx4("fieldset", { disabled, className: fieldset(), children }) });
189
+ };
190
+
191
+ // core/forms/radio/radio.tsx
192
+ import { useId as useId2 } from "react";
193
+
194
+ // core/forms/radio/radio.styles.ts
195
+ import { tv as tv4 } from "tailwind-variants";
196
+ var wrapper2 = tv4({
197
+ base: "flex items-center gap-2"
198
+ });
199
+ var radio = tv4({
200
+ base: "w-4 h-4 text-blue-600 border-gray-300 focus:ring-2 focus:ring-blue-500 disabled:cursor-not-allowed"
201
+ });
202
+ var label2 = tv4({
203
+ base: "text-sm text-gray-700 select-none cursor-pointer"
204
+ });
205
+
206
+ // core/forms/radio/radio.tsx
207
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
208
+ var Radio = ({
209
+ label: labelText,
210
+ name,
211
+ value,
212
+ checked,
213
+ disabled,
214
+ onChange
215
+ }) => {
216
+ const id = useId2();
217
+ return /* @__PURE__ */ jsxs3("div", { className: wrapper2(), children: [
218
+ /* @__PURE__ */ jsx5(
219
+ "input",
220
+ {
221
+ id,
222
+ type: "radio",
223
+ name,
224
+ value,
225
+ checked,
226
+ disabled,
227
+ onChange,
228
+ className: radio()
229
+ }
230
+ ),
231
+ /* @__PURE__ */ jsx5("label", { htmlFor: id, className: label2(), children: labelText })
232
+ ] });
233
+ };
234
+
235
+ // core/forms/select/select.tsx
236
+ import { useId as useId3 } from "react";
237
+
238
+ // core/forms/select/select.styles.ts
239
+ import { tv as tv5 } from "tailwind-variants";
240
+ var wrapper3 = tv5({
241
+ base: "flex flex-col gap-1"
242
+ });
243
+ var label3 = tv5({
244
+ base: "text-sm font-medium text-gray-700"
245
+ });
246
+ var select = tv5({
247
+ base: "px-3 py-2 border border-gray-300 rounded-md text-sm bg-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed"
248
+ });
249
+
250
+ // core/forms/select/select.tsx
251
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
252
+ var Select = ({
253
+ label: labelText,
254
+ options,
255
+ value,
256
+ placeholder,
257
+ disabled,
258
+ error,
259
+ onChange
260
+ }) => {
261
+ const id = useId3();
262
+ return /* @__PURE__ */ jsxs4("div", { className: wrapper3(), children: [
263
+ /* @__PURE__ */ jsx6("label", { htmlFor: id, className: label3(), children: labelText }),
264
+ /* @__PURE__ */ jsxs4(
265
+ "select",
266
+ {
267
+ id,
268
+ value,
269
+ disabled,
270
+ onChange,
271
+ className: select(),
272
+ children: [
273
+ placeholder && /* @__PURE__ */ jsx6("option", { value: "", disabled: true, children: placeholder }),
274
+ options.map((option) => /* @__PURE__ */ jsx6("option", { value: option.value, children: option.label }, option.value))
275
+ ]
276
+ }
277
+ ),
278
+ error && /* @__PURE__ */ jsx6(Error, { message: error })
279
+ ] });
280
+ };
281
+
282
+ // core/forms/text-area/text-area.tsx
283
+ import { useId as useId4 } from "react";
284
+
285
+ // core/forms/text-area/text-area.styles.ts
286
+ import { tv as tv6 } from "tailwind-variants";
287
+ var wrapper4 = tv6({
288
+ base: "flex flex-col gap-1"
289
+ });
290
+ var label4 = tv6({
291
+ base: "text-sm font-medium text-gray-700"
292
+ });
293
+ var textarea = tv6({
294
+ base: "px-3 py-2 border border-gray-300 rounded-md text-sm resize-vertical focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:bg-gray-100 disabled:cursor-not-allowed"
295
+ });
296
+
297
+ // core/forms/text-area/text-area.tsx
298
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
299
+ var TextArea = ({
300
+ label: labelText,
301
+ placeholder,
302
+ value,
303
+ rows = 3,
304
+ error,
305
+ disabled,
306
+ onChange
307
+ }) => {
308
+ const id = useId4();
309
+ return /* @__PURE__ */ jsxs5("div", { className: wrapper4(), children: [
310
+ /* @__PURE__ */ jsx7("label", { htmlFor: id, className: label4(), children: labelText }),
311
+ /* @__PURE__ */ jsx7(
312
+ "textarea",
313
+ {
314
+ id,
315
+ placeholder,
316
+ value,
317
+ rows,
318
+ disabled,
319
+ onChange,
320
+ className: textarea()
321
+ }
322
+ ),
323
+ error && /* @__PURE__ */ jsx7(Error, { message: error })
324
+ ] });
325
+ };
326
+
327
+ // core/data-grid/data-grid-toolbar.tsx
328
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
329
+ var DataGridToolbar = ({ gridApi }) => {
330
+ const [searchTerm, setSearchTerm] = useState("");
331
+ const handleSearch = () => {
332
+ gridApi?.setGridOption("quickFilterText", searchTerm);
333
+ };
334
+ const handleClear = () => {
335
+ setSearchTerm("");
336
+ gridApi?.setGridOption("quickFilterText", "");
337
+ };
338
+ const handleKeyDown = (e) => {
339
+ if (e.key === "Enter") {
340
+ handleSearch();
341
+ }
342
+ };
343
+ return /* @__PURE__ */ jsxs6(
344
+ "div",
345
+ {
346
+ className: "flex items-center gap-2 mb-3",
347
+ "data-testid": "data-grid-toolbar",
348
+ children: [
349
+ /* @__PURE__ */ jsx8(
350
+ Input,
351
+ {
352
+ "aria-label": "Buscar na tabela",
353
+ placeholder: "Buscar...",
354
+ value: searchTerm,
355
+ onChange: (e) => setSearchTerm(e.target.value),
356
+ onKeyDown: handleKeyDown
357
+ }
358
+ ),
359
+ /* @__PURE__ */ jsx8(Button, { icon: "Search", color: "primary", onClick: handleSearch, children: "Buscar" }),
360
+ /* @__PURE__ */ jsx8(Button, { icon: "X", color: "danger", onClick: handleClear, children: "Limpar" })
361
+ ]
362
+ }
363
+ );
364
+ };
365
+
366
+ // core/tag/tag.styles.ts
367
+ import { tv as tv7 } from "tailwind-variants";
368
+ var tag = tv7({
369
+ base: "inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium",
370
+ variants: {
371
+ color: {
372
+ blue: "bg-blue-100 text-blue-700",
373
+ green: "bg-green-100 text-green-700",
374
+ red: "bg-red-100 text-red-700",
375
+ yellow: "bg-yellow-100 text-yellow-700",
376
+ gray: "bg-slate-100 text-slate-700"
377
+ }
378
+ },
379
+ defaultVariants: {
380
+ color: "blue"
381
+ }
382
+ });
383
+
384
+ // core/tag/tag.tsx
385
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
386
+ var Tag = ({
387
+ children,
388
+ color = "blue",
389
+ onRemove,
390
+ className
391
+ }) => {
392
+ return /* @__PURE__ */ jsxs7("span", { className: tag({ color, className }), children: [
393
+ children,
394
+ onRemove && /* @__PURE__ */ jsx9(
395
+ "button",
396
+ {
397
+ type: "button",
398
+ onClick: onRemove,
399
+ className: "ml-1 hover:opacity-70 focus:outline-none",
400
+ "aria-label": "Remover",
401
+ children: "\xD7"
402
+ }
403
+ )
404
+ ] });
405
+ };
406
+
407
+ // core/data-grid/data-grid-status-bar.tsx
408
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
409
+ var DataGridStatusBar = ({
410
+ totalRows,
411
+ displayedRows,
412
+ activeFilters,
413
+ gridApi
414
+ }) => {
415
+ const isFiltered = displayedRows !== totalRows || activeFilters.length > 0;
416
+ const handleClearFilter = (column) => {
417
+ if (!gridApi) return;
418
+ const filterInstance = gridApi.getColumnFilterInstance(column);
419
+ if (filterInstance) {
420
+ filterInstance.then((filter) => {
421
+ filter?.setModel(null);
422
+ gridApi.onFilterChanged();
423
+ });
424
+ }
425
+ };
426
+ const handleClearAllFilters = () => {
427
+ if (!gridApi) return;
428
+ gridApi.setFilterModel(null);
429
+ };
430
+ return /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3 px-2 py-1.5 bg-slate-100 border border-slate-200 rounded text-sm text-slate-600 mb-2", children: [
431
+ /* @__PURE__ */ jsx10("span", { className: "font-medium", children: isFiltered ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
432
+ /* @__PURE__ */ jsx10("span", { className: "text-blue-600", children: displayedRows }),
433
+ /* @__PURE__ */ jsx10("span", { className: "text-slate-400", children: " / " }),
434
+ /* @__PURE__ */ jsx10("span", { children: totalRows }),
435
+ /* @__PURE__ */ jsx10("span", { className: "text-slate-500 ml-1", children: "registros" })
436
+ ] }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
437
+ /* @__PURE__ */ jsx10("span", { children: totalRows }),
438
+ /* @__PURE__ */ jsx10("span", { className: "text-slate-500 ml-1", children: "registros" })
439
+ ] }) }),
440
+ activeFilters.length > 0 && /* @__PURE__ */ jsxs8(Fragment3, { children: [
441
+ /* @__PURE__ */ jsx10("span", { className: "text-slate-300", children: "|" }),
442
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 flex-wrap", children: [
443
+ /* @__PURE__ */ jsx10("span", { className: "text-slate-500", children: "Filtros:" }),
444
+ activeFilters.map((filter) => /* @__PURE__ */ jsxs8(
445
+ Tag,
446
+ {
447
+ color: "blue",
448
+ onRemove: () => handleClearFilter(filter.column),
449
+ children: [
450
+ /* @__PURE__ */ jsxs8("span", { className: "font-medium", children: [
451
+ filter.headerName,
452
+ ":"
453
+ ] }),
454
+ /* @__PURE__ */ jsx10("span", { children: filter.value })
455
+ ]
456
+ },
457
+ filter.column
458
+ )),
459
+ /* @__PURE__ */ jsx10(Button, { variant: "link", color: "none", onClick: handleClearAllFilters, children: "Limpar todos" })
460
+ ] })
461
+ ] })
462
+ ] });
463
+ };
464
+
465
+ // core/data-grid/data-grid.tsx
466
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
467
+ ModuleRegistry.registerModules([AllCommunityModule]);
468
+ var tailwind = {
469
+ slate: {
470
+ 50: "#f8fafc",
471
+ 100: "#f1f5f9",
472
+ 200: "#e2e8f0",
473
+ 600: "#475569",
474
+ 700: "#334155",
475
+ 800: "#1e293b"
476
+ },
477
+ sky: {
478
+ 50: "#f0f9ff",
479
+ 100: "#e0f2fe"
480
+ },
481
+ blue: {
482
+ 100: "#dbeafe"
483
+ }
484
+ };
485
+ var customTheme = themeAlpine.withParams({
486
+ headerBackgroundColor: tailwind.slate[700],
487
+ headerTextColor: tailwind.slate[50],
488
+ oddRowBackgroundColor: tailwind.slate[50],
489
+ rowHoverColor: tailwind.sky[100],
490
+ selectedRowBackgroundColor: tailwind.blue[100],
491
+ borderColor: tailwind.slate[200],
492
+ headerColumnBorder: tailwind.slate[600],
493
+ fontSize: 13,
494
+ headerHeight: 36,
495
+ rowHeight: 32,
496
+ cellHorizontalPadding: 8
497
+ });
498
+ var DataGrid = ({
499
+ columns,
500
+ data,
501
+ showSearch = true
502
+ }) => {
503
+ const [gridApi, setGridApi] = useState2(null);
504
+ const [displayedRows, setDisplayedRows] = useState2(0);
505
+ const [activeFilters, setActiveFilters] = useState2([]);
506
+ const updateFilterState = useCallback(
507
+ (api) => {
508
+ setDisplayedRows(api.getDisplayedRowCount());
509
+ const filterModel = api.getFilterModel();
510
+ const filters = [];
511
+ if (filterModel) {
512
+ Object.entries(filterModel).forEach(([colId, model]) => {
513
+ const colDef = columns.find((c) => c.field === colId);
514
+ const headerName = colDef?.headerName || colId;
515
+ const filterValue = model?.filter || model?.values?.join(", ") || JSON.stringify(model);
516
+ filters.push({
517
+ column: colId,
518
+ headerName,
519
+ value: filterValue
520
+ });
521
+ });
522
+ }
523
+ setActiveFilters(filters);
524
+ },
525
+ [columns]
526
+ );
527
+ const handleGridReady = (params) => {
528
+ setGridApi(params.api);
529
+ setDisplayedRows(params.api.getDisplayedRowCount());
530
+ };
531
+ const handleFilterChanged = useCallback(() => {
532
+ if (gridApi) {
533
+ updateFilterState(gridApi);
534
+ }
535
+ }, [gridApi, updateFilterState]);
536
+ const handleModelUpdated = useCallback(() => {
537
+ if (gridApi) {
538
+ setDisplayedRows(gridApi.getDisplayedRowCount());
539
+ }
540
+ }, [gridApi]);
541
+ return /* @__PURE__ */ jsxs9(
542
+ "div",
543
+ {
544
+ "data-testid": "data-grid",
545
+ className: "grid grid-rows-[auto_auto_1fr] grid-cols-1 h-full w-full",
546
+ children: [
547
+ showSearch && /* @__PURE__ */ jsx11(DataGridToolbar, { gridApi }),
548
+ /* @__PURE__ */ jsx11(
549
+ DataGridStatusBar,
550
+ {
551
+ totalRows: data.length,
552
+ displayedRows,
553
+ activeFilters,
554
+ gridApi
555
+ }
556
+ ),
557
+ /* @__PURE__ */ jsx11("div", { className: "ag-grid h-full w-full z-0", children: /* @__PURE__ */ jsx11(
558
+ AgGridReact,
559
+ {
560
+ theme: customTheme,
561
+ columnDefs: columns,
562
+ rowData: data,
563
+ domLayout: "normal",
564
+ autoSizeStrategy: { type: "fitCellContents" },
565
+ onGridReady: handleGridReady,
566
+ onFilterChanged: handleFilterChanged,
567
+ onModelUpdated: handleModelUpdated,
568
+ defaultColDef: {
569
+ filterParams: {
570
+ buttons: ["reset", "apply"]
571
+ }
572
+ }
573
+ }
574
+ ) })
575
+ ]
576
+ }
577
+ );
578
+ };
579
+
580
+ // core/stats-card/stats-card.tsx
581
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
582
+ var colorClasses = {
583
+ blue: {
584
+ card: "bg-blue-100",
585
+ label: "text-blue-800",
586
+ value: "text-blue-900"
587
+ },
588
+ red: {
589
+ card: "bg-red-100",
590
+ label: "text-red-800",
591
+ value: "text-red-900"
592
+ },
593
+ yellow: {
594
+ card: "bg-yellow-100",
595
+ label: "text-yellow-800",
596
+ value: "text-yellow-900"
597
+ },
598
+ green: {
599
+ card: "bg-green-100",
600
+ label: "text-green-800",
601
+ value: "text-green-900"
602
+ },
603
+ gray: {
604
+ card: "bg-gray-100",
605
+ label: "text-gray-800",
606
+ value: "text-gray-900"
607
+ },
608
+ orange: {
609
+ card: "bg-orange-100",
610
+ label: "text-orange-800",
611
+ value: "text-orange-900"
612
+ }
613
+ };
614
+ var StatsCard = ({ label: label5, value, color }) => {
615
+ const styles = colorClasses[color];
616
+ return /* @__PURE__ */ jsxs10("div", { "data-testid": "stats-card", className: `${styles.card} p-4 rounded-lg`, children: [
617
+ /* @__PURE__ */ jsx12("p", { className: `text-sm ${styles.label}`, children: label5 }),
618
+ /* @__PURE__ */ jsx12("p", { className: `text-3xl font-bold ${styles.value}`, children: value })
619
+ ] });
620
+ };
621
+
622
+ // core/modal/modal.tsx
623
+ import * as Dialog from "@radix-ui/react-dialog";
624
+
625
+ // core/modal/modal.styles.ts
626
+ import { tv as tv8 } from "tailwind-variants";
627
+ var overlay = tv8({
628
+ base: "fixed inset-0 bg-black/50"
629
+ });
630
+ var content = tv8({
631
+ base: "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white rounded-lg shadow-lg p-6 w-full focus:outline-none max-h-[90vh] overflow-y-auto",
632
+ variants: {
633
+ size: {
634
+ sm: "max-w-sm",
635
+ md: "max-w-md",
636
+ lg: "max-w-2xl",
637
+ xl: "max-w-4xl",
638
+ full: "max-w-6xl"
639
+ }
640
+ },
641
+ defaultVariants: {
642
+ size: "md"
643
+ }
644
+ });
645
+ var header = tv8({
646
+ base: "flex items-start justify-between"
647
+ });
648
+ var title = tv8({
649
+ base: "text-lg font-semibold text-gray-900 m-0"
650
+ });
651
+ var description = tv8({
652
+ base: "text-sm text-gray-600 mt-2"
653
+ });
654
+ var body = tv8({
655
+ base: "mt-4"
656
+ });
657
+
658
+ // core/modal/modal.tsx
659
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
660
+ var Modal = ({
661
+ open,
662
+ onClose,
663
+ title: title2,
664
+ description: description2,
665
+ children,
666
+ size = "md"
667
+ }) => {
668
+ return /* @__PURE__ */ jsx13(Dialog.Root, { open, onOpenChange: (isOpen) => !isOpen && onClose(), children: /* @__PURE__ */ jsxs11(Dialog.Portal, { children: [
669
+ /* @__PURE__ */ jsx13(Dialog.Overlay, { className: overlay() }),
670
+ /* @__PURE__ */ jsxs11(
671
+ Dialog.Content,
672
+ {
673
+ className: content({ size }),
674
+ ...!description2 && { "aria-describedby": void 0 },
675
+ children: [
676
+ /* @__PURE__ */ jsxs11("div", { className: header(), children: [
677
+ /* @__PURE__ */ jsx13(Dialog.Title, { className: title(), children: title2 }),
678
+ /* @__PURE__ */ jsx13(Button, { icon: "X", "aria-label": "Close", onClick: onClose })
679
+ ] }),
680
+ description2 && /* @__PURE__ */ jsx13(Dialog.Description, { className: description(), children: description2 }),
681
+ children && /* @__PURE__ */ jsx13("div", { className: body(), children })
682
+ ]
683
+ }
684
+ )
685
+ ] }) });
686
+ };
687
+
688
+ // core/whatsapp-button/whatsapp-button.tsx
689
+ import { jsx as jsx14 } from "react/jsx-runtime";
690
+ var WhatsAppButton = ({
691
+ phone,
692
+ message,
693
+ children = "WhatsApp",
694
+ onClick
695
+ }) => {
696
+ const handleClick = () => {
697
+ const userAgent = navigator?.userAgent ?? "";
698
+ const isMobile = /Android|iPhone|iPad|iPod/i.test(userAgent);
699
+ const hasMessage = Boolean(message);
700
+ const encodedMessage = hasMessage ? encodeURIComponent(message) : "";
701
+ const whatsappUrl = hasMessage ? `https://wa.me/${phone}?text=${encodedMessage}` : `https://wa.me/${phone}`;
702
+ const whatsappBusinessUrl = hasMessage ? `whatsapp-business://send?phone=${phone}&text=${encodedMessage}` : `whatsapp-business://send?phone=${phone}`;
703
+ if (isMobile) {
704
+ if (window.location?.assign) {
705
+ window.location.assign(whatsappBusinessUrl);
706
+ } else {
707
+ window.location.href = whatsappBusinessUrl;
708
+ }
709
+ } else {
710
+ window.open(whatsappUrl, "_blank");
711
+ }
712
+ onClick?.();
713
+ };
714
+ return /* @__PURE__ */ jsx14(Button, { color: "success", icon: "SiWhatsapp", onClick: handleClick, children });
715
+ };
716
+
717
+ // core/heading/heading.tsx
718
+ import { jsx as jsx15 } from "react/jsx-runtime";
719
+ var levelStyles = {
720
+ 1: "text-3xl font-bold",
721
+ 2: "text-2xl font-bold",
722
+ 3: "text-xl font-semibold",
723
+ 4: "text-lg font-semibold",
724
+ 5: "text-base font-medium",
725
+ 6: "text-sm font-medium"
726
+ };
727
+ var colorStyles = {
728
+ primary: "text-blue-600",
729
+ success: "text-green-600",
730
+ danger: "text-red-600",
731
+ warning: "text-yellow-600",
732
+ info: "text-sky-600",
733
+ none: ""
734
+ };
735
+ var tags = {
736
+ 1: "h1",
737
+ 2: "h2",
738
+ 3: "h3",
739
+ 4: "h4",
740
+ 5: "h5",
741
+ 6: "h6"
742
+ };
743
+ var Heading = ({ children, level = 1, color }) => {
744
+ const Tag2 = tags[level];
745
+ const className = [levelStyles[level], color && colorStyles[color]].filter(Boolean).join(" ");
746
+ return /* @__PURE__ */ jsx15(Tag2, { className, children });
747
+ };
748
+
749
+ // core/sidebar/sidebar.tsx
750
+ import { useState as useState3 } from "react";
751
+ import Link from "next/link";
752
+
753
+ // core/sidebar/sidebar.styles.ts
754
+ import { tv as tv9 } from "tailwind-variants";
755
+ var sidebar = tv9({
756
+ base: "h-screen bg-neutral-800 text-neutral-300 flex flex-col overflow-hidden transition-all duration-200",
757
+ variants: {
758
+ collapsed: {
759
+ true: "w-14",
760
+ false: "w-64"
761
+ }
762
+ },
763
+ defaultVariants: {
764
+ collapsed: false
765
+ }
766
+ });
767
+ var nav = tv9({
768
+ base: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden"
769
+ });
770
+ var header2 = tv9({
771
+ base: "shrink-0 border-b border-neutral-600/50 grid p-2"
772
+ });
773
+ var section = tv9({
774
+ base: "border-b border-neutral-600/50 last:border-b-0 grid gap-1 p-2"
775
+ });
776
+ var item = tv9({
777
+ base: "flex w-full items-center rounded-md text-sm whitespace-nowrap transition-colors cursor-pointer p-1",
778
+ variants: {
779
+ active: {
780
+ true: "bg-neutral-700 text-white",
781
+ false: "text-neutral-400 hover:bg-neutral-700/50 hover:text-white"
782
+ }
783
+ },
784
+ defaultVariants: {
785
+ active: false
786
+ }
787
+ });
788
+ var itemIcon = tv9({
789
+ base: "p-2"
790
+ });
791
+ var itemLabel = tv9({
792
+ base: "truncate transition-all duration-200",
793
+ variants: {
794
+ collapsed: {
795
+ true: "opacity-0 w-0",
796
+ false: "opacity-100"
797
+ }
798
+ },
799
+ defaultVariants: {
800
+ collapsed: false
801
+ }
802
+ });
803
+ var footer = tv9({
804
+ base: "shrink-0 border-t border-neutral-600/50 p-3 flex items-center gap-3 whitespace-nowrap"
805
+ });
806
+ var avatar = tv9({
807
+ base: "shrink-0 w-8 h-8 rounded-full bg-neutral-600 text-white text-xs font-medium flex items-center justify-center"
808
+ });
809
+ var userInfo = tv9({
810
+ base: "flex flex-col min-w-0"
811
+ });
812
+ var userName = tv9({
813
+ base: "text-sm text-white truncate"
814
+ });
815
+ var userEmail = tv9({
816
+ base: "text-xs text-neutral-400"
817
+ });
818
+ var toggleButton = tv9({
819
+ base: "shrink-0 border-t border-neutral-600/50 grid p-2 [&>button]:justify-start [&>button]:overflow-hidden [&>button]:whitespace-nowrap"
820
+ });
821
+
822
+ // core/sidebar/sidebar.tsx
823
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
824
+ var getInitials = (name) => {
825
+ const parts = name.trim().split(/\s+/);
826
+ if (parts.length >= 2) {
827
+ return `${parts[0][0]}${parts[parts.length - 1][0]}`.toUpperCase();
828
+ }
829
+ return (parts[0]?.[0] ?? "").toUpperCase();
830
+ };
831
+ var Sidebar = ({
832
+ sections,
833
+ user,
834
+ activeHref,
835
+ defaultCollapsed = false,
836
+ collapseLabel,
837
+ homeHref = "/",
838
+ homeLabel,
839
+ onLogout
840
+ }) => {
841
+ const [collapsed, setCollapsed] = useState3(defaultCollapsed);
842
+ const initials = getInitials(user.name);
843
+ return /* @__PURE__ */ jsxs12("aside", { className: sidebar({ collapsed }), children: [
844
+ homeHref && /* @__PURE__ */ jsx16(
845
+ Link,
846
+ {
847
+ href: homeHref,
848
+ className: header2(),
849
+ "aria-label": homeLabel || "Home",
850
+ children: /* @__PURE__ */ jsxs12("span", { className: item({ active: homeHref === activeHref }), children: [
851
+ /* @__PURE__ */ jsx16("span", { className: itemIcon(), children: /* @__PURE__ */ jsx16(Icon, { name: "Home" }) }),
852
+ /* @__PURE__ */ jsx16("span", { className: itemLabel({ collapsed }), children: homeLabel })
853
+ ] })
854
+ }
855
+ ),
856
+ /* @__PURE__ */ jsx16("nav", { "aria-label": "Main navigation", className: nav(), children: sections.map((sectionData, i) => /* @__PURE__ */ jsx16("div", { className: section(), children: sectionData.items.map((sidebarItem) => {
857
+ const isActive = sidebarItem.href === activeHref;
858
+ return /* @__PURE__ */ jsxs12(
859
+ Link,
860
+ {
861
+ href: sidebarItem.href,
862
+ className: item({ active: isActive }),
863
+ ...isActive && { "aria-current": "page" },
864
+ children: [
865
+ /* @__PURE__ */ jsx16("span", { className: itemIcon(), children: /* @__PURE__ */ jsx16(Icon, { name: sidebarItem.icon }) }),
866
+ /* @__PURE__ */ jsx16("span", { className: itemLabel({ collapsed }), children: sidebarItem.label })
867
+ ]
868
+ },
869
+ sidebarItem.href
870
+ );
871
+ }) }, i)) }),
872
+ /* @__PURE__ */ jsxs12("div", { className: footer(), children: [
873
+ /* @__PURE__ */ jsx16("div", { className: avatar(), children: initials }),
874
+ /* @__PURE__ */ jsxs12("div", { className: userInfo(), children: [
875
+ /* @__PURE__ */ jsx16("span", { className: userName(), children: user.name }),
876
+ /* @__PURE__ */ jsx16("span", { className: userEmail(), children: user.email })
877
+ ] }),
878
+ /* @__PURE__ */ jsx16(
879
+ Button,
880
+ {
881
+ variant: "ghost",
882
+ icon: "LogOut",
883
+ "aria-label": "Logout",
884
+ onClick: onLogout
885
+ }
886
+ )
887
+ ] }),
888
+ /* @__PURE__ */ jsx16("div", { className: toggleButton(), children: /* @__PURE__ */ jsx16(
889
+ Button,
890
+ {
891
+ variant: "ghost",
892
+ icon: collapsed ? "ChevronRight" : "ChevronLeft",
893
+ "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
894
+ onClick: () => setCollapsed(!collapsed),
895
+ children: collapseLabel
896
+ }
897
+ ) })
898
+ ] });
899
+ };
900
+
901
+ // core/toaster/toaster.tsx
902
+ import { useEffect } from "react";
903
+ import { Toaster as SonnerToaster, toast } from "sonner";
904
+
905
+ // core/state/toast/toast.store.ts
906
+ import { create } from "zustand";
907
+ import { devtools } from "zustand/middleware";
908
+ var toastId = 0;
909
+ var useToastStore = create()(
910
+ devtools(
911
+ (set, get) => ({
912
+ toasts: [],
913
+ addToast: (message, type = "error") => {
914
+ const id = ++toastId;
915
+ set(
916
+ (s) => ({ toasts: [...s.toasts, { id, message, type }] }),
917
+ false,
918
+ "addToast"
919
+ );
920
+ return id;
921
+ },
922
+ removeToast: (id) => set(
923
+ (s) => ({ toasts: s.toasts.filter((t) => t.id !== id) }),
924
+ false,
925
+ "removeToast"
926
+ ),
927
+ success: (message) => get().addToast(message, "success"),
928
+ error: (message) => get().addToast(message, "error"),
929
+ info: (message) => get().addToast(message, "info"),
930
+ warning: (message) => get().addToast(message, "warning")
931
+ }),
932
+ { name: "zljs", store: "toast" }
933
+ )
934
+ );
935
+
936
+ // core/toaster/toaster.tsx
937
+ import { jsx as jsx17 } from "react/jsx-runtime";
938
+ var Toaster = () => {
939
+ const toasts = useToastStore((s) => s.toasts);
940
+ const removeToast = useToastStore((s) => s.removeToast);
941
+ useEffect(() => {
942
+ toasts.forEach((t) => {
943
+ toast[t.type](t.message, {
944
+ id: t.id,
945
+ onDismiss: () => removeToast(t.id)
946
+ });
947
+ removeToast(t.id);
948
+ });
949
+ }, [toasts, removeToast]);
950
+ return /* @__PURE__ */ jsx17(
951
+ SonnerToaster,
952
+ {
953
+ position: "bottom-right",
954
+ richColors: true,
955
+ closeButton: true,
956
+ duration: 4e3,
957
+ expand: true,
958
+ visibleToasts: 5
959
+ }
960
+ );
961
+ };
962
+
963
+ // core/toaster/index.ts
964
+ import { toast as toast2 } from "sonner";
965
+
966
+ // core/index.ts
967
+ import { toast as toast3 } from "sonner";
968
+
969
+ // core/state/app/app.store.ts
970
+ import { create as create2 } from "zustand";
971
+ import { devtools as devtools2 } from "zustand/middleware";
972
+ var useAppStore = create2()(
973
+ devtools2(
974
+ (set) => ({
975
+ fetchingCalls: 0,
976
+ fetching: false,
977
+ startFetching: () => set(
978
+ (s) => {
979
+ const fetchingCalls = s.fetchingCalls + 1;
980
+ return { fetchingCalls, fetching: true };
981
+ },
982
+ false,
983
+ "startFetching"
984
+ ),
985
+ finishFetching: () => set(
986
+ (s) => {
987
+ const fetchingCalls = Math.max(0, s.fetchingCalls - 1);
988
+ return { fetchingCalls, fetching: fetchingCalls > 0 };
989
+ },
990
+ false,
991
+ "finishFetching"
992
+ )
993
+ }),
994
+ { name: "zljs", store: "app" }
995
+ )
996
+ );
997
+
998
+ // core/state/modal/modal.store.ts
999
+ import { create as create3 } from "zustand";
1000
+ import { devtools as devtools3 } from "zustand/middleware";
1001
+ var useModalStore = create3()(
1002
+ devtools3(
1003
+ (set, get) => ({
1004
+ modals: [],
1005
+ openModal: (name) => set((s) => ({ modals: [...s.modals, { name }] }), false, "openModal"),
1006
+ openModalWithPayload: (name, payload) => set(
1007
+ (s) => ({ modals: [...s.modals, { name, payload }] }),
1008
+ false,
1009
+ "openModalWithPayload"
1010
+ ),
1011
+ closeModal: (name) => set(
1012
+ (s) => ({ modals: s.modals.filter((m) => m.name !== name) }),
1013
+ false,
1014
+ "closeModal"
1015
+ ),
1016
+ isOpen: (name) => get().modals.some((m) => m.name === name),
1017
+ getPayload: (name) => get().modals.find((m) => m.name === name)?.payload
1018
+ }),
1019
+ { name: "zljs", store: "modal" }
1020
+ )
1021
+ );
1022
+
1023
+ // core/state/global-state/global-state.tsx
1024
+ import { Provider } from "react-redux";
1025
+ import {
1026
+ combineReducers,
1027
+ configureStore
1028
+ } from "@reduxjs/toolkit";
1029
+ import { jsx as jsx18 } from "react/jsx-runtime";
1030
+ var store;
1031
+ var persistentReducers = {};
1032
+ var dynamicReducers = {};
1033
+ var createReducer = (coreReducers) => combineReducers({
1034
+ ...dynamicReducers,
1035
+ ...persistentReducers,
1036
+ ...coreReducers
1037
+ });
1038
+ var createStore = (reducers, middlewares, preloadedState, coreReducers) => {
1039
+ persistentReducers = reducers;
1040
+ if (!store) {
1041
+ store = configureStore({
1042
+ reducer: createReducer(coreReducers),
1043
+ middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(middlewares),
1044
+ preloadedState
1045
+ });
1046
+ store.setDynamicReducers = (newDynamicReducers = {}) => {
1047
+ dynamicReducers = newDynamicReducers;
1048
+ store.replaceReducer(createReducer(coreReducers));
1049
+ };
1050
+ } else {
1051
+ store.replaceReducer(createReducer(coreReducers));
1052
+ }
1053
+ return store;
1054
+ };
1055
+ var GlobalState = ({
1056
+ children,
1057
+ reducers = {},
1058
+ middlewares = [],
1059
+ preloadedState = {},
1060
+ coreReducers = {}
1061
+ }) => {
1062
+ const reduxStore = createStore(
1063
+ reducers,
1064
+ middlewares,
1065
+ preloadedState,
1066
+ coreReducers
1067
+ );
1068
+ return /* @__PURE__ */ jsx18(Provider, { store: reduxStore, children });
1069
+ };
1070
+
1071
+ // core/state/router/router.store.ts
1072
+ import { create as create4 } from "zustand";
1073
+ import { devtools as devtools4 } from "zustand/middleware";
1074
+
1075
+ // core/state/router/router.utils.ts
1076
+ var splitURLasPath = (urlAsPath) => {
1077
+ let queryWithoutPath = "";
1078
+ if (urlAsPath?.indexOf("?") >= 0) {
1079
+ const [, query] = urlAsPath.split("?");
1080
+ queryWithoutPath = query ?? "";
1081
+ }
1082
+ if (urlAsPath?.indexOf("#") >= 0) {
1083
+ const [, query] = urlAsPath.split("#");
1084
+ queryWithoutPath = query ?? "";
1085
+ }
1086
+ const parametersAsObject = {};
1087
+ if (queryWithoutPath.length > 0) {
1088
+ queryWithoutPath.split("&").forEach((p) => {
1089
+ const [parameter, value] = p.split("=");
1090
+ if (parameter) {
1091
+ parametersAsObject[parameter] = value ?? "";
1092
+ }
1093
+ });
1094
+ }
1095
+ return parametersAsObject;
1096
+ };
1097
+
1098
+ // core/state/router/router.store.ts
1099
+ var useRouterStore = create4()(
1100
+ devtools4(
1101
+ (set) => ({
1102
+ urlAsPath: "/",
1103
+ query: {},
1104
+ setRoute: (urlAsPath) => set({ urlAsPath, query: splitURLasPath(urlAsPath) }, false, "setRoute")
1105
+ }),
1106
+ { name: "zljs", store: "router" }
1107
+ )
1108
+ );
1109
+
1110
+ // core/state/page/page.store.ts
1111
+ import { create as create5 } from "zustand";
1112
+ import { devtools as devtools5 } from "zustand/middleware";
1113
+ var usePageStore = create5()(
1114
+ devtools5(
1115
+ (set) => ({
1116
+ title: "",
1117
+ setTitle: (title2) => set({ title: title2 }, false, "setTitle")
1118
+ }),
1119
+ { name: "zljs", store: "page" }
1120
+ )
1121
+ );
1122
+
1123
+ // core/page-wrapper/page-wrapper.tsx
1124
+ import { useEffect as useEffect2 } from "react";
1125
+ import { useDispatch, useStore } from "react-redux";
1126
+ import { useRouter } from "next/compat/router";
1127
+ import { Fragment as Fragment4, jsx as jsx19 } from "react/jsx-runtime";
1128
+ var PageWrapper = ({
1129
+ reducers,
1130
+ title: title2,
1131
+ initPage,
1132
+ children
1133
+ }) => {
1134
+ const store2 = useStore();
1135
+ const dispatch = useDispatch();
1136
+ const router = useRouter();
1137
+ const setTitle = usePageStore((s) => s.setTitle);
1138
+ useEffect2(() => {
1139
+ if (reducers) {
1140
+ store2.setDynamicReducers?.(reducers);
1141
+ }
1142
+ }, [reducers]);
1143
+ useEffect2(() => {
1144
+ setTitle(title2);
1145
+ }, [router?.asPath, title2, setTitle]);
1146
+ useEffect2(() => {
1147
+ if (initPage) {
1148
+ initPage(dispatch);
1149
+ }
1150
+ }, []);
1151
+ return /* @__PURE__ */ jsx19(Fragment4, { children });
1152
+ };
1153
+
1154
+ // core/connected-modal/connected-modal.tsx
1155
+ import { jsx as jsx20 } from "react/jsx-runtime";
1156
+ var ConnectedModal = ({
1157
+ modalId,
1158
+ title: title2,
1159
+ description: description2,
1160
+ size,
1161
+ children
1162
+ }) => {
1163
+ const isOpen = useModalStore((s) => s.isOpen(modalId));
1164
+ const closeModal = useModalStore((s) => s.closeModal);
1165
+ return /* @__PURE__ */ jsx20(
1166
+ Modal,
1167
+ {
1168
+ open: isOpen,
1169
+ onClose: () => closeModal(modalId),
1170
+ title: title2,
1171
+ description: description2,
1172
+ size,
1173
+ children
1174
+ }
1175
+ );
1176
+ };
1177
+
1178
+ // core/spinner/spinner.tsx
1179
+ import { LoaderCircle } from "lucide-react";
1180
+
1181
+ // core/spinner/spinner.styles.ts
1182
+ import { tv as tv10 } from "tailwind-variants";
1183
+ var spinner = tv10({
1184
+ base: "animate-spin w-20 h-20 text-white stroke-[0.3]"
1185
+ });
1186
+
1187
+ // core/spinner/spinner.tsx
1188
+ import { jsx as jsx21 } from "react/jsx-runtime";
1189
+ var Spinner = ({ className }) => /* @__PURE__ */ jsx21(LoaderCircle, { className: spinner({ className }), strokeWidth: 1 });
1190
+
1191
+ // core/loader/loader.styles.ts
1192
+ import { tv as tv11 } from "tailwind-variants";
1193
+ var overlay2 = tv11({
1194
+ base: "flex fixed justify-center items-center w-full h-full bg-black/20 z-50"
1195
+ });
1196
+
1197
+ // core/loader/loader.tsx
1198
+ import { jsx as jsx22 } from "react/jsx-runtime";
1199
+ var Loader = ({ label: label5 = "Loading" }) => {
1200
+ const fetching = useAppStore((s) => s.fetching);
1201
+ if (!fetching) return null;
1202
+ return /* @__PURE__ */ jsx22("div", { role: "status", "aria-label": label5, className: overlay2(), children: /* @__PURE__ */ jsx22(Spinner, {}) });
1203
+ };
1204
+
1205
+ // core/app-wrapper/app-wrapper.tsx
1206
+ import { useEffect as useEffect3 } from "react";
1207
+ import { useRouter as useRouter2 } from "next/compat/router";
1208
+ import { SessionProvider } from "next-auth/react";
1209
+ import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
1210
+ var AppWrapper = ({
1211
+ children,
1212
+ reducers,
1213
+ middlewares,
1214
+ coreReducers
1215
+ }) => {
1216
+ const router = useRouter2();
1217
+ const setRoute = useRouterStore((s) => s.setRoute);
1218
+ useEffect3(() => {
1219
+ if (router?.isReady && router.asPath) {
1220
+ setRoute(router.asPath);
1221
+ }
1222
+ }, [router?.isReady, router?.asPath, setRoute]);
1223
+ return /* @__PURE__ */ jsx23(SessionProvider, { children: /* @__PURE__ */ jsxs13(
1224
+ GlobalState,
1225
+ {
1226
+ reducers,
1227
+ middlewares,
1228
+ coreReducers,
1229
+ children: [
1230
+ /* @__PURE__ */ jsx23(Loader, {}),
1231
+ /* @__PURE__ */ jsx23(Toaster, {}),
1232
+ children
1233
+ ]
1234
+ }
1235
+ ) });
1236
+ };
1237
+
1238
+ // core/document-wrapper/document-wrapper.tsx
1239
+ import { jsx as jsx24 } from "react/jsx-runtime";
1240
+ var DocumentWrapper = ({
1241
+ children,
1242
+ lang = "pt-BR",
1243
+ className
1244
+ }) => {
1245
+ return /* @__PURE__ */ jsx24("html", { lang, children: /* @__PURE__ */ jsx24("body", { className, children }) });
1246
+ };
1247
+
1248
+ // core/http/http.client.ts
1249
+ import axios from "axios";
1250
+ var HTTPClient = class {
1251
+ constructor(config) {
1252
+ this.baseUrl = config?.baseUrl ?? "/api";
1253
+ this.headers = config?.headers ?? {};
1254
+ }
1255
+ async request(method, url, config) {
1256
+ const silent = config?.silent ?? false;
1257
+ const headers = { ...this.headers, ...config?.headers };
1258
+ if (!silent) useAppStore.getState().startFetching();
1259
+ try {
1260
+ let response;
1261
+ switch (method) {
1262
+ case "get":
1263
+ response = await axios.get(`${this.baseUrl}${url}`, {
1264
+ headers,
1265
+ params: config?.params
1266
+ });
1267
+ break;
1268
+ case "post":
1269
+ response = await axios.post(
1270
+ `${this.baseUrl}${url}`,
1271
+ config?.payload,
1272
+ { headers }
1273
+ );
1274
+ break;
1275
+ case "put":
1276
+ response = await axios.put(`${this.baseUrl}${url}`, config?.payload, {
1277
+ headers
1278
+ });
1279
+ break;
1280
+ case "delete":
1281
+ response = await axios.delete(`${this.baseUrl}${url}`, {
1282
+ headers,
1283
+ data: config?.payload
1284
+ });
1285
+ break;
1286
+ case "patch":
1287
+ response = await axios.patch(
1288
+ `${this.baseUrl}${url}`,
1289
+ config?.payload,
1290
+ { headers }
1291
+ );
1292
+ break;
1293
+ }
1294
+ return response.data;
1295
+ } catch (e) {
1296
+ const error = e;
1297
+ useToastStore.getState().error(`Something went wrong with the server - ${error.message}`);
1298
+ return void 0;
1299
+ } finally {
1300
+ if (!silent) useAppStore.getState().finishFetching();
1301
+ }
1302
+ }
1303
+ async get(url, config) {
1304
+ return this.request("get", url, config);
1305
+ }
1306
+ async post(url, config) {
1307
+ return this.request("post", url, config);
1308
+ }
1309
+ async put(url, config) {
1310
+ return this.request("put", url, config);
1311
+ }
1312
+ async delete(url, config) {
1313
+ return this.request("delete", url, config);
1314
+ }
1315
+ async patch(url, config) {
1316
+ return this.request("patch", url, config);
1317
+ }
1318
+ };
1319
+ export {
1320
+ AppWrapper,
1321
+ Button,
1322
+ Checkbox,
1323
+ ConnectedModal,
1324
+ DataGrid,
1325
+ DocumentWrapper,
1326
+ Error,
1327
+ Form,
1328
+ FormInput,
1329
+ FormProvider,
1330
+ GlobalState,
1331
+ HTTPClient,
1332
+ Heading,
1333
+ Icon,
1334
+ Input,
1335
+ Loader,
1336
+ Modal,
1337
+ PageWrapper,
1338
+ Radio,
1339
+ Select,
1340
+ Sidebar,
1341
+ Spinner,
1342
+ StatsCard,
1343
+ Tag,
1344
+ TextArea,
1345
+ Toaster,
1346
+ WhatsAppButton,
1347
+ splitURLasPath,
1348
+ toast3 as toast,
1349
+ useAppStore,
1350
+ useModalStore,
1351
+ usePageStore,
1352
+ useRouterStore,
1353
+ useToastStore
1354
+ };