tempest-react-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3425 @@
1
+ import { jsxs as b, jsx as l, Fragment as ve } from "react/jsx-runtime";
2
+ import { useState as v, useMemo as F, Fragment as Pe, forwardRef as O, useRef as E, useEffect as k, useId as ie, useContext as ee, createContext as te, cloneElement as He, useCallback as x, lazy as Ve, Component as Qe, useSyncExternalStore as Ae } from "react";
3
+ import { createPortal as Ne } from "react-dom";
4
+ import { QueryClient as Ye, QueryClientProvider as Ze } from "@tanstack/react-query";
5
+ import { create as Xe } from "zustand";
6
+ import { persist as et, createJSONStorage as tt } from "zustand/middleware";
7
+ import nt from "dexie";
8
+ import { useForm as rt } from "react-hook-form";
9
+ function y(...e) {
10
+ const t = [];
11
+ for (const n of e)
12
+ if (!(n == null || n === !1 || n === !0)) {
13
+ if (typeof n == "string")
14
+ n && t.push(n);
15
+ else if (typeof n == "number" || typeof n == "bigint")
16
+ t.push(String(n));
17
+ else if (Array.isArray(n)) {
18
+ const r = y(...n);
19
+ r && t.push(r);
20
+ }
21
+ }
22
+ return t.join(" ");
23
+ }
24
+ const st = "tempest_avatar_3xMuZ", ot = "tempest_image_ieqGp", it = "tempest_xs_oSaLL", at = "tempest_sm_sZ2bk", ct = "tempest_md_Fdkbz", lt = "tempest_lg_pTTUA", ut = "tempest_xl_mW58F", dt = "tempest_status_ISBnL", pt = "tempest_dot_Wgfo-", ft = "tempest_online_-aWoW", mt = "tempest_offline_-StX3", ht = "tempest_busy_TbwuF", V = {
25
+ avatar: st,
26
+ image: ot,
27
+ xs: it,
28
+ sm: at,
29
+ md: ct,
30
+ lg: lt,
31
+ xl: ut,
32
+ status: dt,
33
+ dot: pt,
34
+ online: ft,
35
+ offline: mt,
36
+ busy: ht
37
+ };
38
+ function gt(e) {
39
+ const t = e.trim().split(/\s+/).filter(Boolean);
40
+ return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2) : `${t[0].charAt(0)}${t[t.length - 1].charAt(0)}`;
41
+ }
42
+ function Ai({
43
+ src: e,
44
+ alt: t,
45
+ name: n = "",
46
+ size: r = "md",
47
+ status: s,
48
+ className: o,
49
+ onClick: i
50
+ }) {
51
+ const [c, a] = v(!1), u = F(() => gt(n), [n]), d = e && !c, p = i ? "button" : void 0, f = i ? 0 : void 0;
52
+ return /* @__PURE__ */ b(
53
+ "span",
54
+ {
55
+ className: y(V.avatar, V[r], s && V.status, o),
56
+ role: p,
57
+ tabIndex: f,
58
+ onClick: i,
59
+ onKeyDown: i ? (m) => {
60
+ (m.key === "Enter" || m.key === " ") && (m.preventDefault(), i());
61
+ } : void 0,
62
+ children: [
63
+ d ? /* @__PURE__ */ l(
64
+ "img",
65
+ {
66
+ src: e,
67
+ alt: t ?? n,
68
+ className: V.image,
69
+ onError: () => a(!0)
70
+ }
71
+ ) : /* @__PURE__ */ l("span", { "aria-label": t ?? n, children: u }),
72
+ s && /* @__PURE__ */ l("span", { className: y(V.dot, V[s]), "aria-hidden": !0 })
73
+ ]
74
+ }
75
+ );
76
+ }
77
+ const _t = "tempest_badge_RsuMz", yt = "tempest_neutral_lulSm", bt = "tempest_success_u9JiS", wt = "tempest_warning_nsGp-", vt = "tempest_danger_PD2hz", Nt = "tempest_info_na6DQ", Se = {
78
+ badge: _t,
79
+ neutral: yt,
80
+ success: bt,
81
+ warning: wt,
82
+ danger: vt,
83
+ info: Nt
84
+ };
85
+ function Ri({ variant: e = "neutral", className: t, children: n, ...r }) {
86
+ return /* @__PURE__ */ l("span", { className: y(Se.badge, Se[e], t), ...r, children: n });
87
+ }
88
+ const $t = "tempest_nav_H4g6P", kt = "tempest_item_O4g3P", St = "tempest_link_7WM67", xt = "tempest_current_JdlcS", Et = "tempest_separator_zGWyJ", ne = {
89
+ nav: $t,
90
+ item: kt,
91
+ link: St,
92
+ current: xt,
93
+ separator: Et
94
+ };
95
+ function Fi({ items: e, separator: t = "/", className: n }) {
96
+ return /* @__PURE__ */ l("nav", { "aria-label": "breadcrumb", className: y(ne.nav, n), children: e.map((r, s) => {
97
+ const o = s === e.length - 1, i = !o && (r.href || r.onClick);
98
+ return /* @__PURE__ */ b(Pe, { children: [
99
+ /* @__PURE__ */ l("span", { className: ne.item, children: i ? /* @__PURE__ */ l(
100
+ "a",
101
+ {
102
+ href: r.href,
103
+ onClick: (c) => {
104
+ r.onClick && (c.preventDefault(), r.onClick());
105
+ },
106
+ className: ne.link,
107
+ children: r.label
108
+ }
109
+ ) : /* @__PURE__ */ l(
110
+ "span",
111
+ {
112
+ "aria-current": o ? "page" : void 0,
113
+ className: o ? ne.current : void 0,
114
+ children: r.label
115
+ }
116
+ ) }),
117
+ !o && /* @__PURE__ */ l("span", { className: ne.separator, "aria-hidden": !0, children: t })
118
+ ] }, s);
119
+ }) });
120
+ }
121
+ const Tt = "tempest_button_2ZuB7", Ct = "tempest_primary_s1sM6", Lt = "tempest_secondary_R0waJ", It = "tempest_danger_V4fX8", Dt = "tempest_ghost_1KINV", Mt = "tempest_sm_NhG0g", Pt = "tempest_md_hH4h3", At = "tempest_lg_2plQf", Rt = "tempest_fullWidth_36oJT", Ft = "tempest_loading_EQAt2", Ot = "tempest_hiddenText_hIiJ2", Wt = "tempest_spinner_ZExvW", Bt = "tempest_tempest-spin_UOSVC", G = {
122
+ button: Tt,
123
+ primary: Ct,
124
+ secondary: Lt,
125
+ danger: It,
126
+ ghost: Dt,
127
+ sm: Mt,
128
+ md: Pt,
129
+ lg: At,
130
+ fullWidth: Rt,
131
+ loading: Ft,
132
+ hiddenText: Ot,
133
+ spinner: Wt,
134
+ tempestSpin: Bt
135
+ };
136
+ function be({
137
+ variant: e = "primary",
138
+ size: t = "md",
139
+ loading: n = !1,
140
+ fullWidth: r = !1,
141
+ leftIcon: s,
142
+ rightIcon: o,
143
+ disabled: i,
144
+ className: c,
145
+ children: a,
146
+ ...u
147
+ }) {
148
+ return /* @__PURE__ */ b(
149
+ "button",
150
+ {
151
+ className: y(
152
+ G.button,
153
+ G[e],
154
+ G[t],
155
+ n && G.loading,
156
+ r && G.fullWidth,
157
+ c
158
+ ),
159
+ disabled: i || n,
160
+ ...u,
161
+ children: [
162
+ n && /* @__PURE__ */ l("span", { className: G.spinner, "aria-hidden": !0, children: /* @__PURE__ */ l(Ut, {}) }),
163
+ /* @__PURE__ */ b("span", { className: y(n && G.hiddenText), children: [
164
+ s,
165
+ a,
166
+ o
167
+ ] })
168
+ ]
169
+ }
170
+ );
171
+ }
172
+ function Ut() {
173
+ return /* @__PURE__ */ l(
174
+ "svg",
175
+ {
176
+ width: "16",
177
+ height: "16",
178
+ viewBox: "0 0 24 24",
179
+ fill: "none",
180
+ xmlns: "http://www.w3.org/2000/svg",
181
+ children: /* @__PURE__ */ l(
182
+ "path",
183
+ {
184
+ d: "M21 12a9 9 0 1 1-6.219-8.56",
185
+ stroke: "currentColor",
186
+ strokeWidth: "2",
187
+ strokeLinecap: "round"
188
+ }
189
+ )
190
+ }
191
+ );
192
+ }
193
+ const jt = "tempest_card_Cb1o4", zt = "tempest_padded_oOxwN", Jt = "tempest_flush_aiDZi", qt = "tempest_header_PTXf2", Gt = "tempest_title_mSgoo", Kt = "tempest_body_W441Z", Q = {
194
+ card: jt,
195
+ padded: zt,
196
+ flush: Jt,
197
+ header: qt,
198
+ title: Gt,
199
+ body: Kt
200
+ };
201
+ function Oi({ title: e, actions: t, flush: n = !1, className: r, children: s, ...o }) {
202
+ const i = e || t;
203
+ return /* @__PURE__ */ b(
204
+ "div",
205
+ {
206
+ className: y(
207
+ Q.card,
208
+ !i && !n && Q.padded,
209
+ n && Q.flush,
210
+ r
211
+ ),
212
+ ...o,
213
+ children: [
214
+ i && /* @__PURE__ */ b("header", { className: Q.header, children: [
215
+ typeof e == "string" ? /* @__PURE__ */ l("h3", { className: Q.title, children: e }) : e,
216
+ t
217
+ ] }),
218
+ i ? /* @__PURE__ */ l("div", { className: Q.body, children: s }) : s
219
+ ]
220
+ }
221
+ );
222
+ }
223
+ const Ht = "tempest_wrapper_rpthW", Vt = "tempest_disabled_x7-eg", Qt = "tempest_input_2kt-h", Yt = "tempest_box_OCPee", Zt = "tempest_labelWrap_Ktbp0", Xt = "tempest_label_cwRtI", en = "tempest_description_rMhG1", K = {
224
+ wrapper: Ht,
225
+ disabled: Vt,
226
+ input: Qt,
227
+ box: Yt,
228
+ labelWrap: Zt,
229
+ label: Xt,
230
+ description: en
231
+ }, Wi = O(function({ label: t, description: n, indeterminate: r, disabled: s, wrapperClassName: o, className: i, ...c }, a) {
232
+ const u = E(null);
233
+ k(() => {
234
+ u.current && (u.current.indeterminate = !!r);
235
+ }, [r]);
236
+ function d(p) {
237
+ u.current = p, typeof a == "function" ? a(p) : a && (a.current = p);
238
+ }
239
+ return /* @__PURE__ */ b("label", { className: y(K.wrapper, s && K.disabled, o), children: [
240
+ /* @__PURE__ */ l(
241
+ "input",
242
+ {
243
+ ref: d,
244
+ type: "checkbox",
245
+ disabled: s,
246
+ className: y(K.input, i),
247
+ ...c
248
+ }
249
+ ),
250
+ /* @__PURE__ */ l("span", { className: K.box, "aria-hidden": !0, children: r ? /* @__PURE__ */ l(nn, {}) : /* @__PURE__ */ l(tn, {}) }),
251
+ (t || n) && /* @__PURE__ */ b("span", { className: K.labelWrap, children: [
252
+ t && /* @__PURE__ */ l("span", { className: K.label, children: t }),
253
+ n && /* @__PURE__ */ l("span", { className: K.description, children: n })
254
+ ] })
255
+ ] });
256
+ });
257
+ function tn() {
258
+ return /* @__PURE__ */ l("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ l(
259
+ "path",
260
+ {
261
+ d: "M5 12l5 5L20 7",
262
+ stroke: "currentColor",
263
+ strokeWidth: "3",
264
+ strokeLinecap: "round",
265
+ strokeLinejoin: "round"
266
+ }
267
+ ) });
268
+ }
269
+ function nn() {
270
+ return /* @__PURE__ */ l("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ l("path", { d: "M5 12h14", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) });
271
+ }
272
+ const rn = "tempest_wrapper_KR4-F", sn = "tempest_label_Mz-wX", on = "tempest_field_iIBJw", an = "tempest_error_O9n-9", cn = "tempest_chip_GEwrc", ln = "tempest_remove_JYDIq", un = "tempest_input_frJmk", dn = "tempest_helper_Yts53", pn = "tempest_errorText_llJGq", W = {
273
+ wrapper: rn,
274
+ label: sn,
275
+ field: on,
276
+ error: an,
277
+ chip: cn,
278
+ remove: ln,
279
+ input: un,
280
+ helper: dn,
281
+ errorText: pn
282
+ };
283
+ function Bi({
284
+ value: e,
285
+ onChange: t,
286
+ label: n,
287
+ placeholder: r = "Adicionar e pressionar Enter…",
288
+ helperText: s,
289
+ error: o,
290
+ commitKeys: i = ["Enter", ",", "Tab"],
291
+ normalize: c = !0,
292
+ className: a
293
+ }) {
294
+ const [u, d] = v(""), p = E(null);
295
+ function f() {
296
+ const h = c ? u.trim().toLowerCase() : u.trim();
297
+ if (h) {
298
+ if (e.includes(h)) {
299
+ d("");
300
+ return;
301
+ }
302
+ t([...e, h]), d("");
303
+ }
304
+ }
305
+ function m(h) {
306
+ if (i.includes(h.key)) {
307
+ h.preventDefault(), f();
308
+ return;
309
+ }
310
+ h.key === "Backspace" && !u && e.length > 0 && t(e.slice(0, -1));
311
+ }
312
+ function g(h) {
313
+ const w = e.slice();
314
+ w.splice(h, 1), t(w);
315
+ }
316
+ return /* @__PURE__ */ b("div", { className: y(W.wrapper, o && W.error, a), children: [
317
+ n && /* @__PURE__ */ l("label", { className: W.label, children: n }),
318
+ /* @__PURE__ */ b("div", { className: W.field, onClick: () => p.current?.focus(), children: [
319
+ e.map((h, w) => /* @__PURE__ */ b("span", { className: W.chip, children: [
320
+ h,
321
+ /* @__PURE__ */ l(
322
+ "button",
323
+ {
324
+ type: "button",
325
+ className: W.remove,
326
+ "aria-label": `Remover ${h}`,
327
+ onClick: () => g(w),
328
+ children: "×"
329
+ }
330
+ )
331
+ ] }, `${h}-${w}`)),
332
+ /* @__PURE__ */ l(
333
+ "input",
334
+ {
335
+ ref: p,
336
+ className: W.input,
337
+ value: u,
338
+ placeholder: e.length === 0 ? r : "",
339
+ onChange: (h) => d(h.target.value),
340
+ onKeyDown: m,
341
+ onBlur: f
342
+ }
343
+ )
344
+ ] }),
345
+ o ? /* @__PURE__ */ l("span", { className: W.errorText, children: o }) : s ? /* @__PURE__ */ l("span", { className: W.helper, children: s }) : null
346
+ ] });
347
+ }
348
+ const fn = "tempest_overlay_dd9h1", mn = "tempest_tempest-fade-in_DvgSp", hn = "tempest_dialog_ptM-K", gn = "tempest_tempest-modal-in_UoxQC", _n = "tempest_sm_K5k3W", yn = "tempest_md_gvyR7", bn = "tempest_lg_BgB1a", wn = "tempest_xl_MR-68", vn = "tempest_header_ILG9i", Nn = "tempest_title_A5OeE", $n = "tempest_close_-ER1C", kn = "tempest_body_lVhql", Sn = "tempest_footer_rro2w", z = {
349
+ overlay: fn,
350
+ tempestFadeIn: mn,
351
+ dialog: hn,
352
+ tempestModalIn: gn,
353
+ sm: _n,
354
+ md: yn,
355
+ lg: bn,
356
+ xl: wn,
357
+ header: vn,
358
+ title: Nn,
359
+ close: $n,
360
+ body: kn,
361
+ footer: Sn
362
+ };
363
+ function xn({
364
+ open: e,
365
+ onClose: t,
366
+ title: n,
367
+ children: r,
368
+ footer: s,
369
+ size: o = "md",
370
+ closeOnBackdrop: i = !0,
371
+ closeOnEsc: c = !0,
372
+ className: a,
373
+ hideCloseButton: u = !1
374
+ }) {
375
+ return k(() => {
376
+ if (!e) return;
377
+ const d = document.body.style.overflow;
378
+ document.body.style.overflow = "hidden";
379
+ const p = (f) => {
380
+ c && f.key === "Escape" && t();
381
+ };
382
+ return window.addEventListener("keydown", p), () => {
383
+ document.body.style.overflow = d, window.removeEventListener("keydown", p);
384
+ };
385
+ }, [e, c, t]), !e || typeof document > "u" ? null : Ne(
386
+ /* @__PURE__ */ l(
387
+ "div",
388
+ {
389
+ className: z.overlay,
390
+ role: "presentation",
391
+ onClick: () => {
392
+ i && t();
393
+ },
394
+ children: /* @__PURE__ */ b(
395
+ "div",
396
+ {
397
+ role: "dialog",
398
+ "aria-modal": "true",
399
+ className: y(z.dialog, z[o], a),
400
+ onClick: (d) => d.stopPropagation(),
401
+ children: [
402
+ (n || !u) && /* @__PURE__ */ b("header", { className: z.header, children: [
403
+ /* @__PURE__ */ l("h3", { className: z.title, children: n }),
404
+ !u && /* @__PURE__ */ l(
405
+ "button",
406
+ {
407
+ type: "button",
408
+ className: z.close,
409
+ "aria-label": "Fechar",
410
+ onClick: t,
411
+ children: /* @__PURE__ */ l(En, {})
412
+ }
413
+ )
414
+ ] }),
415
+ /* @__PURE__ */ l("div", { className: z.body, children: r }),
416
+ s && /* @__PURE__ */ l("footer", { className: z.footer, children: s })
417
+ ]
418
+ }
419
+ )
420
+ }
421
+ ),
422
+ document.body
423
+ );
424
+ }
425
+ function En() {
426
+ return /* @__PURE__ */ l("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ l(
427
+ "path",
428
+ {
429
+ d: "M6 6l12 12M6 18L18 6",
430
+ stroke: "currentColor",
431
+ strokeWidth: "2",
432
+ strokeLinecap: "round"
433
+ }
434
+ ) });
435
+ }
436
+ function Ui({
437
+ open: e,
438
+ title: t,
439
+ description: n,
440
+ confirmLabel: r = "Confirmar",
441
+ cancelLabel: s = "Cancelar",
442
+ variant: o = "primary",
443
+ loading: i = !1,
444
+ onConfirm: c,
445
+ onCancel: a
446
+ }) {
447
+ return /* @__PURE__ */ l(
448
+ xn,
449
+ {
450
+ open: e,
451
+ onClose: a,
452
+ title: t,
453
+ size: "sm",
454
+ footer: /* @__PURE__ */ b(ve, { children: [
455
+ /* @__PURE__ */ l(be, { variant: "secondary", onClick: a, disabled: i, children: s }),
456
+ /* @__PURE__ */ l(be, { variant: o, loading: i, onClick: () => {
457
+ c();
458
+ }, children: r })
459
+ ] }),
460
+ children: n
461
+ }
462
+ );
463
+ }
464
+ const Tn = "tempest_wrapper_iHNUs", Cn = "tempest_label_-OEBL", Ln = "tempest_required_CTss-", In = "tempest_field_65yGJ", Dn = "tempest_input_WjT81", Mn = "tempest_hasLeftIcon_xYO-v", Pn = "tempest_hasRightIcon_C7uyr", An = "tempest_iconLeft_KrUhI", Rn = "tempest_iconRight_Ssr47", Fn = "tempest_error_VLISa", On = "tempest_helper_7Vc-s", Wn = "tempest_errorText_xz4xS", P = {
465
+ wrapper: Tn,
466
+ label: Cn,
467
+ required: Ln,
468
+ field: In,
469
+ input: Dn,
470
+ hasLeftIcon: Mn,
471
+ hasRightIcon: Pn,
472
+ iconLeft: An,
473
+ iconRight: Rn,
474
+ error: Fn,
475
+ helper: On,
476
+ errorText: Wn
477
+ }, $e = O(function({
478
+ label: t,
479
+ helperText: n,
480
+ error: r,
481
+ leftIcon: s,
482
+ rightIcon: o,
483
+ wrapperClassName: i,
484
+ className: c,
485
+ id: a,
486
+ required: u,
487
+ ...d
488
+ }, p) {
489
+ const f = ie(), m = a ?? f, g = r ? `${m}-error` : n ? `${m}-helper` : void 0;
490
+ return /* @__PURE__ */ b("div", { className: y(P.wrapper, r && P.error, i), children: [
491
+ t && /* @__PURE__ */ b("label", { htmlFor: m, className: P.label, children: [
492
+ t,
493
+ u && /* @__PURE__ */ l("span", { className: P.required, children: "*" })
494
+ ] }),
495
+ /* @__PURE__ */ b("div", { className: P.field, children: [
496
+ s && /* @__PURE__ */ l("span", { className: P.iconLeft, children: s }),
497
+ /* @__PURE__ */ l(
498
+ "input",
499
+ {
500
+ ref: p,
501
+ id: m,
502
+ "aria-invalid": !!r,
503
+ "aria-describedby": g,
504
+ required: u,
505
+ className: y(
506
+ P.input,
507
+ s && P.hasLeftIcon,
508
+ o && P.hasRightIcon,
509
+ c
510
+ ),
511
+ ...d
512
+ }
513
+ ),
514
+ o && /* @__PURE__ */ l("span", { className: P.iconRight, children: o })
515
+ ] }),
516
+ r ? /* @__PURE__ */ l("span", { id: `${m}-error`, className: P.errorText, children: r }) : n ? /* @__PURE__ */ l("span", { id: `${m}-helper`, className: P.helper, children: n }) : null
517
+ ] });
518
+ }), ji = O(function({ value: t, onChange: n, mode: r = "date", ...s }, o) {
519
+ return /* @__PURE__ */ l(
520
+ $e,
521
+ {
522
+ ...s,
523
+ ref: o,
524
+ type: r,
525
+ value: t,
526
+ onChange: (i) => n(i.target.value)
527
+ }
528
+ );
529
+ }), Bn = "tempest_overlay_hcG1G", Un = "tempest_tempest-drawer-overlay_XFbxY", jn = "tempest_panel_wUX0N", zn = "tempest_right_-oX-6", Jn = "tempest_tempest-drawer-in-right_pWYHv", qn = "tempest_left_xi3nD", Gn = "tempest_tempest-drawer-in-left_o7JSb", Kn = "tempest_top_7rGCn", Hn = "tempest_tempest-drawer-in-top_kn6AF", Vn = "tempest_bottom_zd-25", Qn = "tempest_tempest-drawer-in-bottom_0x3u7", Yn = "tempest_header_sYoP1", Zn = "tempest_title_LqUOu", Xn = "tempest_close_tYPhU", er = "tempest_body_aV9FG", tr = "tempest_footer_AuvUP", J = {
530
+ overlay: Bn,
531
+ tempestDrawerOverlay: Un,
532
+ panel: jn,
533
+ right: zn,
534
+ tempestDrawerInRight: Jn,
535
+ left: qn,
536
+ tempestDrawerInLeft: Gn,
537
+ top: Kn,
538
+ tempestDrawerInTop: Hn,
539
+ bottom: Vn,
540
+ tempestDrawerInBottom: Qn,
541
+ header: Yn,
542
+ title: Zn,
543
+ close: Xn,
544
+ body: er,
545
+ footer: tr
546
+ };
547
+ function zi({
548
+ open: e,
549
+ onClose: t,
550
+ placement: n = "right",
551
+ title: r,
552
+ children: s,
553
+ footer: o,
554
+ closeOnBackdrop: i = !0,
555
+ closeOnEsc: c = !0,
556
+ hideCloseButton: a = !1,
557
+ className: u
558
+ }) {
559
+ return k(() => {
560
+ if (!e) return;
561
+ const d = document.body.style.overflow;
562
+ document.body.style.overflow = "hidden";
563
+ const p = (f) => {
564
+ c && f.key === "Escape" && t();
565
+ };
566
+ return window.addEventListener("keydown", p), () => {
567
+ document.body.style.overflow = d, window.removeEventListener("keydown", p);
568
+ };
569
+ }, [e, c, t]), !e || typeof document > "u" ? null : Ne(
570
+ /* @__PURE__ */ b(ve, { children: [
571
+ /* @__PURE__ */ l(
572
+ "div",
573
+ {
574
+ className: J.overlay,
575
+ onClick: () => {
576
+ i && t();
577
+ }
578
+ }
579
+ ),
580
+ /* @__PURE__ */ b(
581
+ "aside",
582
+ {
583
+ role: "dialog",
584
+ "aria-modal": "true",
585
+ className: y(J.panel, J[n], u),
586
+ children: [
587
+ (r || !a) && /* @__PURE__ */ b("header", { className: J.header, children: [
588
+ /* @__PURE__ */ l("h3", { className: J.title, children: r }),
589
+ !a && /* @__PURE__ */ l(
590
+ "button",
591
+ {
592
+ type: "button",
593
+ "aria-label": "Fechar",
594
+ className: J.close,
595
+ onClick: t,
596
+ children: /* @__PURE__ */ l(nr, {})
597
+ }
598
+ )
599
+ ] }),
600
+ /* @__PURE__ */ l("div", { className: J.body, children: s }),
601
+ o && /* @__PURE__ */ l("footer", { className: J.footer, children: o })
602
+ ]
603
+ }
604
+ )
605
+ ] }),
606
+ document.body
607
+ );
608
+ }
609
+ function nr() {
610
+ return /* @__PURE__ */ l("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ l(
611
+ "path",
612
+ {
613
+ d: "M6 6l12 12M6 18L18 6",
614
+ stroke: "currentColor",
615
+ strokeWidth: "2",
616
+ strokeLinecap: "round"
617
+ }
618
+ ) });
619
+ }
620
+ const rr = "tempest_wrapper_gzyTd", sr = "tempest_icon_qVCyh", or = "tempest_title_xPfUf", ir = "tempest_description_oWwH1", ar = "tempest_action_dqxw1", re = {
621
+ wrapper: rr,
622
+ icon: sr,
623
+ title: or,
624
+ description: ir,
625
+ action: ar
626
+ };
627
+ function Ji({ icon: e, title: t, description: n, action: r, className: s }) {
628
+ return /* @__PURE__ */ b("div", { className: y(re.wrapper, s), children: [
629
+ e && /* @__PURE__ */ l("div", { className: re.icon, children: e }),
630
+ /* @__PURE__ */ l("h4", { className: re.title, children: t }),
631
+ n && /* @__PURE__ */ l("p", { className: re.description, children: n }),
632
+ r && /* @__PURE__ */ l("div", { className: re.action, children: r })
633
+ ] });
634
+ }
635
+ const cr = "tempest_wrapper_luRyF", lr = "tempest_icon_dEdBl", ur = "tempest_title_StutD", dr = "tempest_description_A2XCb", pr = "tempest_action_vm1LC", se = {
636
+ wrapper: cr,
637
+ icon: lr,
638
+ title: ur,
639
+ description: dr,
640
+ action: pr
641
+ };
642
+ function qi({
643
+ title: e = "Algo deu errado",
644
+ description: t = "Não foi possível carregar essas informações.",
645
+ onRetry: n,
646
+ retryLabel: r = "Tentar novamente",
647
+ icon: s,
648
+ className: o
649
+ }) {
650
+ return /* @__PURE__ */ b("div", { className: y(se.wrapper, o), children: [
651
+ /* @__PURE__ */ l("div", { className: se.icon, children: s ?? /* @__PURE__ */ l(fr, {}) }),
652
+ /* @__PURE__ */ l("h4", { className: se.title, children: e }),
653
+ t && /* @__PURE__ */ l("p", { className: se.description, children: t }),
654
+ n && /* @__PURE__ */ l("div", { className: se.action, children: /* @__PURE__ */ l(be, { variant: "secondary", onClick: n, children: r }) })
655
+ ] });
656
+ }
657
+ function fr() {
658
+ return /* @__PURE__ */ l("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ l(
659
+ "path",
660
+ {
661
+ d: "M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z",
662
+ stroke: "currentColor",
663
+ strokeWidth: "2",
664
+ strokeLinecap: "round",
665
+ strokeLinejoin: "round"
666
+ }
667
+ ) });
668
+ }
669
+ const mr = "tempest_wrapper_E0qHs", hr = "tempest_label_lbMkx", gr = "tempest_dropzone_jqua0", _r = "tempest_active_CG9Uk", yr = "tempest_disabled_WNUUl", br = "tempest_icon_i9fGH", wr = "tempest_title_bTVFl", vr = "tempest_subtitle_S54OV", Nr = "tempest_files_WljYm", $r = "tempest_file_Lp-dR", kr = "tempest_fileMeta_LTnN2", Sr = "tempest_remove_jskra", xr = "tempest_hidden_ReEq6", D = {
670
+ wrapper: mr,
671
+ label: hr,
672
+ dropzone: gr,
673
+ active: _r,
674
+ disabled: yr,
675
+ icon: br,
676
+ title: wr,
677
+ subtitle: vr,
678
+ files: Nr,
679
+ file: $r,
680
+ fileMeta: kr,
681
+ remove: Sr,
682
+ hidden: xr
683
+ };
684
+ function Er(e) {
685
+ return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
686
+ }
687
+ function Tr(e, t) {
688
+ if (!t) return !0;
689
+ const n = t.split(",").map((o) => o.trim().toLowerCase()), r = e.name.toLowerCase(), s = e.type.toLowerCase();
690
+ return n.some((o) => o.startsWith(".") ? r.endsWith(o) : o.endsWith("/*") ? s.startsWith(o.replace("/*", "/")) : s === o);
691
+ }
692
+ function Gi({
693
+ value: e,
694
+ onChange: t,
695
+ label: n,
696
+ accept: r,
697
+ multiple: s = !1,
698
+ maxSize: o,
699
+ onReject: i,
700
+ disabled: c,
701
+ title: a = "Arraste arquivos aqui ou clique para selecionar",
702
+ subtitle: u,
703
+ className: d
704
+ }) {
705
+ const [p, f] = v(!1), m = E(null);
706
+ function g(_) {
707
+ const N = [], $ = [];
708
+ for (const I of Array.from(_)) {
709
+ if (!Tr(I, r)) {
710
+ $.push({ file: I, reason: "type" });
711
+ continue;
712
+ }
713
+ if (o && I.size > o) {
714
+ $.push({ file: I, reason: "size" });
715
+ continue;
716
+ }
717
+ N.push(I);
718
+ }
719
+ if ($.length > 0 && i?.($), N.length === 0) return;
720
+ const C = s ? [...e, ...N] : N.slice(0, 1);
721
+ t(C);
722
+ }
723
+ function h(_) {
724
+ _.preventDefault(), f(!1), !c && _.dataTransfer?.files && g(_.dataTransfer.files);
725
+ }
726
+ function w(_) {
727
+ const N = e.slice();
728
+ N.splice(_, 1), t(N);
729
+ }
730
+ return /* @__PURE__ */ b("div", { className: y(D.wrapper, d), children: [
731
+ n && /* @__PURE__ */ l("label", { className: D.label, children: n }),
732
+ /* @__PURE__ */ b(
733
+ "div",
734
+ {
735
+ className: y(
736
+ D.dropzone,
737
+ p && D.active,
738
+ c && D.disabled
739
+ ),
740
+ role: "button",
741
+ tabIndex: c ? -1 : 0,
742
+ onClick: () => !c && m.current?.click(),
743
+ onKeyDown: (_) => {
744
+ (_.key === "Enter" || _.key === " ") && (_.preventDefault(), m.current?.click());
745
+ },
746
+ onDragEnter: (_) => {
747
+ _.preventDefault(), c || f(!0);
748
+ },
749
+ onDragOver: (_) => _.preventDefault(),
750
+ onDragLeave: () => f(!1),
751
+ onDrop: h,
752
+ children: [
753
+ /* @__PURE__ */ l("div", { className: D.icon, "aria-hidden": !0, children: /* @__PURE__ */ l(Cr, {}) }),
754
+ /* @__PURE__ */ l("p", { className: D.title, children: a }),
755
+ u && /* @__PURE__ */ l("p", { className: D.subtitle, children: u }),
756
+ /* @__PURE__ */ l(
757
+ "input",
758
+ {
759
+ ref: m,
760
+ type: "file",
761
+ accept: r,
762
+ multiple: s,
763
+ disabled: c,
764
+ className: D.hidden,
765
+ onChange: (_) => {
766
+ _.target.files && g(_.target.files), _.target.value = "";
767
+ }
768
+ }
769
+ )
770
+ ]
771
+ }
772
+ ),
773
+ e.length > 0 && /* @__PURE__ */ l("ul", { className: D.files, children: e.map((_, N) => /* @__PURE__ */ b("li", { className: D.file, children: [
774
+ /* @__PURE__ */ b("div", { children: [
775
+ /* @__PURE__ */ l("div", { children: _.name }),
776
+ /* @__PURE__ */ l("div", { className: D.fileMeta, children: Er(_.size) })
777
+ ] }),
778
+ /* @__PURE__ */ l(
779
+ "button",
780
+ {
781
+ type: "button",
782
+ "aria-label": `Remover ${_.name}`,
783
+ className: D.remove,
784
+ onClick: () => w(N),
785
+ children: "×"
786
+ }
787
+ )
788
+ ] }, `${_.name}-${N}`)) })
789
+ ] });
790
+ }
791
+ function Cr() {
792
+ return /* @__PURE__ */ l("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ l(
793
+ "path",
794
+ {
795
+ d: "M12 16V4m0 0l-4 4m4-4l4 4M4 20h16",
796
+ stroke: "currentColor",
797
+ strokeWidth: "2",
798
+ strokeLinecap: "round",
799
+ strokeLinejoin: "round"
800
+ }
801
+ ) });
802
+ }
803
+ const Lr = "tempest_container_fJfOt", Ir = "tempest_sm_k8D4-", Dr = "tempest_md_EnpYy", Mr = "tempest_lg_UU-Ig", Pr = "tempest_xl_2TEWj", Ar = "tempest_full_l8bvG", Rr = "tempest_stack_sxR8u", Fr = "tempest_vertical_2TMf5", Or = "tempest_horizontal_r7-c-", Wr = "tempest_center_EDSAh", Br = "tempest_start_ucQ-K", Ur = "tempest_end_pnKlF", jr = "tempest_stretch_pX6l7", zr = "tempest_justifyStart_lHYsS", Jr = "tempest_justifyCenter_JH2m6", qr = "tempest_justifyEnd_EBisT", Gr = "tempest_justifyBetween_mAJwT", Kr = "tempest_wrap_-xxOh", Hr = "tempest_grid_o-JIX", A = {
804
+ container: Lr,
805
+ sm: Ir,
806
+ md: Dr,
807
+ lg: Mr,
808
+ xl: Pr,
809
+ full: Ar,
810
+ stack: Rr,
811
+ vertical: Fr,
812
+ horizontal: Or,
813
+ center: Wr,
814
+ start: Br,
815
+ end: Ur,
816
+ stretch: jr,
817
+ justifyStart: zr,
818
+ justifyCenter: Jr,
819
+ justifyEnd: qr,
820
+ justifyBetween: Gr,
821
+ wrap: Kr,
822
+ grid: Hr
823
+ };
824
+ function Ki({ size: e = "lg", className: t, children: n, ...r }) {
825
+ return /* @__PURE__ */ l("div", { className: y(A.container, A[e], t), ...r, children: n });
826
+ }
827
+ function Hi({
828
+ direction: e = "vertical",
829
+ gap: t = 2,
830
+ align: n,
831
+ justify: r,
832
+ wrap: s = !1,
833
+ className: o,
834
+ style: i,
835
+ children: c,
836
+ ...a
837
+ }) {
838
+ const d = { gap: typeof t == "number" ? `${t * 4}px` : t, ...i }, p = r === "between" ? A.justifyBetween : r === "center" ? A.justifyCenter : r === "end" ? A.justifyEnd : r === "start" ? A.justifyStart : void 0;
839
+ return /* @__PURE__ */ l(
840
+ "div",
841
+ {
842
+ className: y(
843
+ A.stack,
844
+ e === "vertical" ? A.vertical : A.horizontal,
845
+ n && A[n],
846
+ p,
847
+ s && A.wrap,
848
+ o
849
+ ),
850
+ style: d,
851
+ ...a,
852
+ children: c
853
+ }
854
+ );
855
+ }
856
+ function Vi({ columns: e = 2, gap: t = 4, className: n, style: r, children: s, ...o }) {
857
+ const i = typeof e == "number" ? `repeat(${e}, minmax(0, 1fr))` : e, c = typeof t == "number" ? `${t * 4}px` : t;
858
+ return /* @__PURE__ */ l(
859
+ "div",
860
+ {
861
+ className: y(A.grid, n),
862
+ style: { gridTemplateColumns: i, gap: c, ...r },
863
+ ...o,
864
+ children: s
865
+ }
866
+ );
867
+ }
868
+ const Vr = "tempest_wrapper_cRGQm", Qr = "tempest_controls_fdL-y", Yr = "tempest_page_WjG0l", Zr = "tempest_active_1kqsJ", Xr = "tempest_ellipsis_V294k", es = "tempest_sizeSelect_ZayTo", q = {
869
+ wrapper: Vr,
870
+ controls: Qr,
871
+ page: Yr,
872
+ active: Zr,
873
+ ellipsis: Xr,
874
+ sizeSelect: es
875
+ };
876
+ function ts(e, t, n) {
877
+ const r = n + 4;
878
+ if (t <= r)
879
+ return Array.from({ length: t }, (c, a) => a + 1);
880
+ const s = Math.max(2, e - Math.floor(n / 2)), o = Math.min(t - 1, s + n - 1), i = [1];
881
+ s > 2 && i.push("...");
882
+ for (let c = s; c <= o; c++) i.push(c);
883
+ return o < t - 1 && i.push("..."), i.push(t), i;
884
+ }
885
+ function Qi({
886
+ page: e,
887
+ totalPages: t,
888
+ onPageChange: n,
889
+ pageSize: r,
890
+ onPageSizeChange: s,
891
+ pageSizeOptions: o = [10, 25, 50, 100],
892
+ totalItems: i,
893
+ siblingCount: c = 3,
894
+ className: a
895
+ }) {
896
+ const u = F(
897
+ () => ts(e, t, c),
898
+ [e, t, c]
899
+ );
900
+ return t <= 1 && !s ? null : /* @__PURE__ */ b("div", { className: y(q.wrapper, a), children: [
901
+ /* @__PURE__ */ l("div", { children: typeof i == "number" ? `${i} resultado${i === 1 ? "" : "s"}` : null }),
902
+ /* @__PURE__ */ b("div", { className: q.controls, children: [
903
+ /* @__PURE__ */ l(
904
+ "button",
905
+ {
906
+ type: "button",
907
+ className: q.page,
908
+ onClick: () => n(Math.max(1, e - 1)),
909
+ disabled: e <= 1,
910
+ "aria-label": "Página anterior",
911
+ children: "‹"
912
+ }
913
+ ),
914
+ u.map(
915
+ (d, p) => d === "..." ? /* @__PURE__ */ l("span", { className: q.ellipsis, children: "…" }, `ellipsis-${p}`) : /* @__PURE__ */ l(
916
+ "button",
917
+ {
918
+ type: "button",
919
+ className: y(q.page, d === e && q.active),
920
+ onClick: () => n(d),
921
+ "aria-current": d === e ? "page" : void 0,
922
+ children: d
923
+ },
924
+ d
925
+ )
926
+ ),
927
+ /* @__PURE__ */ l(
928
+ "button",
929
+ {
930
+ type: "button",
931
+ className: q.page,
932
+ onClick: () => n(Math.min(t, e + 1)),
933
+ disabled: e >= t,
934
+ "aria-label": "Próxima página",
935
+ children: "›"
936
+ }
937
+ ),
938
+ s && /* @__PURE__ */ l(
939
+ "select",
940
+ {
941
+ className: q.sizeSelect,
942
+ value: r,
943
+ onChange: (d) => s(Number(d.target.value)),
944
+ "aria-label": "Itens por página",
945
+ children: o.map((d) => /* @__PURE__ */ b("option", { value: d, children: [
946
+ d,
947
+ " / página"
948
+ ] }, d))
949
+ }
950
+ )
951
+ ] })
952
+ ] });
953
+ }
954
+ const ns = "tempest_wrapper_BQek1", rs = "tempest_bar_uC-0x", ss = "tempest_fill_vmg7x", os = "tempest_success_gWJ8U", is = "tempest_warning_DGkPO", as = "tempest_danger_gfwHh", cs = "tempest_indeterminate_HojUj", ls = "tempest_tempest-progress-loop_0nEdF", us = "tempest_label_qqHJM", Y = {
955
+ wrapper: ns,
956
+ bar: rs,
957
+ fill: ss,
958
+ success: os,
959
+ warning: is,
960
+ danger: as,
961
+ indeterminate: cs,
962
+ tempestProgressLoop: ls,
963
+ label: us
964
+ };
965
+ function Yi({
966
+ value: e = 0,
967
+ max: t = 100,
968
+ variant: n = "primary",
969
+ indeterminate: r = !1,
970
+ showLabel: s = !1,
971
+ label: o,
972
+ className: i
973
+ }) {
974
+ const c = r ? 0 : Math.max(0, Math.min(100, e / t * 100));
975
+ return /* @__PURE__ */ b("div", { className: y(Y.wrapper, i), children: [
976
+ (s || o) && /* @__PURE__ */ b("div", { className: Y.label, children: [
977
+ o && /* @__PURE__ */ l("span", { children: o }),
978
+ s && !r && /* @__PURE__ */ b("span", { children: [
979
+ Math.round(c),
980
+ "%"
981
+ ] })
982
+ ] }),
983
+ /* @__PURE__ */ l(
984
+ "div",
985
+ {
986
+ role: "progressbar",
987
+ "aria-valuemin": 0,
988
+ "aria-valuemax": t,
989
+ "aria-valuenow": r ? void 0 : e,
990
+ className: y(Y.bar, r && Y.indeterminate),
991
+ children: /* @__PURE__ */ l(
992
+ "div",
993
+ {
994
+ className: y(Y.fill, n !== "primary" && Y[n]),
995
+ style: { width: r ? void 0 : `${c}%` }
996
+ }
997
+ )
998
+ }
999
+ )
1000
+ ] });
1001
+ }
1002
+ const ds = "tempest_wrapper_P-gFm", ps = "tempest_disabled_0-cna", fs = "tempest_input_7R8ZN", ms = "tempest_dot_P7ejP", hs = "tempest_labelWrap_iQ1HR", gs = "tempest_label_vAFIP", _s = "tempest_description_bEB8u", ys = "tempest_group_oi329", bs = "tempest_horizontal_1Ovgu", j = {
1003
+ wrapper: ds,
1004
+ disabled: ps,
1005
+ input: fs,
1006
+ dot: ms,
1007
+ labelWrap: hs,
1008
+ label: gs,
1009
+ description: _s,
1010
+ group: ys,
1011
+ horizontal: bs
1012
+ }, Re = te(null), Zi = O(function({
1013
+ label: t,
1014
+ description: n,
1015
+ value: r,
1016
+ disabled: s,
1017
+ name: o,
1018
+ checked: i,
1019
+ onChange: c,
1020
+ wrapperClassName: a,
1021
+ className: u,
1022
+ ...d
1023
+ }, p) {
1024
+ const f = ee(Re), m = f?.name ?? o, g = f?.disabled ?? s, h = f ? f.value === r : i;
1025
+ function w(_) {
1026
+ f && f.onChange?.(r), c?.(_);
1027
+ }
1028
+ return /* @__PURE__ */ b(
1029
+ "label",
1030
+ {
1031
+ className: y(j.wrapper, g && j.disabled, a),
1032
+ children: [
1033
+ /* @__PURE__ */ l(
1034
+ "input",
1035
+ {
1036
+ ref: p,
1037
+ type: "radio",
1038
+ name: m,
1039
+ value: r,
1040
+ checked: h,
1041
+ disabled: g,
1042
+ onChange: w,
1043
+ className: y(j.input, u),
1044
+ ...d
1045
+ }
1046
+ ),
1047
+ /* @__PURE__ */ l("span", { className: j.dot, "aria-hidden": !0 }),
1048
+ (t || n) && /* @__PURE__ */ b("span", { className: j.labelWrap, children: [
1049
+ t && /* @__PURE__ */ l("span", { className: j.label, children: t }),
1050
+ n && /* @__PURE__ */ l("span", { className: j.description, children: n })
1051
+ ] })
1052
+ ]
1053
+ }
1054
+ );
1055
+ });
1056
+ function Xi({
1057
+ value: e,
1058
+ defaultValue: t,
1059
+ onChange: n,
1060
+ name: r,
1061
+ disabled: s,
1062
+ horizontal: o = !1,
1063
+ className: i,
1064
+ children: c
1065
+ }) {
1066
+ const a = ie(), u = r ?? a, [d, p] = v(t), f = e !== void 0, m = f ? e : d;
1067
+ function g(h) {
1068
+ f || p(h), n?.(h);
1069
+ }
1070
+ return /* @__PURE__ */ l(
1071
+ Re.Provider,
1072
+ {
1073
+ value: { name: u, value: m, onChange: g, disabled: s },
1074
+ children: /* @__PURE__ */ l(
1075
+ "div",
1076
+ {
1077
+ role: "radiogroup",
1078
+ className: y(j.group, o && j.horizontal, i),
1079
+ children: c
1080
+ }
1081
+ )
1082
+ }
1083
+ );
1084
+ }
1085
+ const ws = "tempest_wrapper_dKXJJ", vs = "tempest_input_m0lPc", Ns = "tempest_iconLeft_030-U", $s = "tempest_clear_nb6lG", ce = {
1086
+ wrapper: ws,
1087
+ input: vs,
1088
+ iconLeft: Ns,
1089
+ clear: $s
1090
+ }, ea = O(function({ value: t, onChange: n, onClear: r, wrapperClassName: s, placeholder: o = "Buscar...", className: i, ...c }, a) {
1091
+ function u() {
1092
+ n(""), r?.();
1093
+ }
1094
+ return /* @__PURE__ */ b("div", { className: y(ce.wrapper, s), children: [
1095
+ /* @__PURE__ */ l("span", { className: ce.iconLeft, "aria-hidden": !0, children: /* @__PURE__ */ l(ks, {}) }),
1096
+ /* @__PURE__ */ l(
1097
+ "input",
1098
+ {
1099
+ ref: a,
1100
+ type: "search",
1101
+ value: t,
1102
+ onChange: (d) => n(d.target.value),
1103
+ placeholder: o,
1104
+ className: y(ce.input, i),
1105
+ ...c
1106
+ }
1107
+ ),
1108
+ t && /* @__PURE__ */ l(
1109
+ "button",
1110
+ {
1111
+ type: "button",
1112
+ className: ce.clear,
1113
+ "aria-label": "Limpar busca",
1114
+ onClick: u,
1115
+ children: /* @__PURE__ */ l(Ss, {})
1116
+ }
1117
+ )
1118
+ ] });
1119
+ });
1120
+ function ks() {
1121
+ return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [
1122
+ /* @__PURE__ */ l("circle", { cx: "11", cy: "11", r: "7", stroke: "currentColor", strokeWidth: "2" }),
1123
+ /* @__PURE__ */ l("path", { d: "M20 20l-3.5-3.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })
1124
+ ] });
1125
+ }
1126
+ function Ss() {
1127
+ return /* @__PURE__ */ l("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ l(
1128
+ "path",
1129
+ {
1130
+ d: "M6 6l12 12M6 18L18 6",
1131
+ stroke: "currentColor",
1132
+ strokeWidth: "2",
1133
+ strokeLinecap: "round"
1134
+ }
1135
+ ) });
1136
+ }
1137
+ const xs = "tempest_wrapper_KS2K3", Es = "tempest_label_Lmgos", Ts = "tempest_required_PvDVJ", Cs = "tempest_field_h-wBy", Ls = "tempest_select_cjdcr", Is = "tempest_caret_MdCao", Ds = "tempest_error_sw9MU", Ms = "tempest_helper_frosK", Ps = "tempest_errorText_-zd6i", B = {
1138
+ wrapper: xs,
1139
+ label: Es,
1140
+ required: Ts,
1141
+ field: Cs,
1142
+ select: Ls,
1143
+ caret: Is,
1144
+ error: Ds,
1145
+ helper: Ms,
1146
+ errorText: Ps
1147
+ }, ta = O(function({
1148
+ label: t,
1149
+ helperText: n,
1150
+ error: r,
1151
+ options: s,
1152
+ placeholder: o,
1153
+ wrapperClassName: i,
1154
+ className: c,
1155
+ children: a,
1156
+ id: u,
1157
+ required: d,
1158
+ ...p
1159
+ }, f) {
1160
+ const m = ie(), g = u ?? m;
1161
+ return /* @__PURE__ */ b("div", { className: y(B.wrapper, r && B.error, i), children: [
1162
+ t && /* @__PURE__ */ b("label", { htmlFor: g, className: B.label, children: [
1163
+ t,
1164
+ d && /* @__PURE__ */ l("span", { className: B.required, children: "*" })
1165
+ ] }),
1166
+ /* @__PURE__ */ b("div", { className: B.field, children: [
1167
+ /* @__PURE__ */ b(
1168
+ "select",
1169
+ {
1170
+ ref: f,
1171
+ id: g,
1172
+ "aria-invalid": !!r,
1173
+ required: d,
1174
+ className: y(B.select, c),
1175
+ ...p,
1176
+ children: [
1177
+ o && /* @__PURE__ */ l("option", { value: "", disabled: !0, hidden: !0, children: o }),
1178
+ s?.map((h) => /* @__PURE__ */ l("option", { value: h.value, disabled: h.disabled, children: h.label }, h.value)),
1179
+ a
1180
+ ]
1181
+ }
1182
+ ),
1183
+ /* @__PURE__ */ l("span", { className: B.caret, "aria-hidden": !0, children: /* @__PURE__ */ l(As, {}) })
1184
+ ] }),
1185
+ r ? /* @__PURE__ */ l("span", { className: B.errorText, children: r }) : n ? /* @__PURE__ */ l("span", { className: B.helper, children: n }) : null
1186
+ ] });
1187
+ });
1188
+ function As() {
1189
+ return /* @__PURE__ */ l("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ l(
1190
+ "path",
1191
+ {
1192
+ d: "M6 9l6 6 6-6",
1193
+ stroke: "currentColor",
1194
+ strokeWidth: "2",
1195
+ strokeLinecap: "round",
1196
+ strokeLinejoin: "round"
1197
+ }
1198
+ ) });
1199
+ }
1200
+ const Rs = "tempest_skeleton_CB4uF", Fs = "tempest_text_-A8IF", Os = "tempest_circle_DYcl8", me = {
1201
+ skeleton: Rs,
1202
+ text: Fs,
1203
+ circle: Os
1204
+ };
1205
+ function na({ variant: e = "rect", width: t, height: n, className: r, style: s }) {
1206
+ return /* @__PURE__ */ l(
1207
+ "span",
1208
+ {
1209
+ "aria-hidden": !0,
1210
+ className: y(
1211
+ me.skeleton,
1212
+ e === "text" && me.text,
1213
+ e === "circle" && me.circle,
1214
+ r
1215
+ ),
1216
+ style: { width: t, height: n, ...s }
1217
+ }
1218
+ );
1219
+ }
1220
+ const Ws = "tempest_spinner_GpFZS", Bs = "tempest_tempest-spinner_wKVCY", Us = "tempest_sm_3sIoD", js = "tempest_md_M2sPj", zs = "tempest_lg_IxTw2", xe = {
1221
+ spinner: Ws,
1222
+ tempestSpinner: Bs,
1223
+ sm: Us,
1224
+ md: js,
1225
+ lg: zs
1226
+ };
1227
+ function ra({ size: e = "md", className: t, label: n = "Carregando" }) {
1228
+ return /* @__PURE__ */ l(
1229
+ "span",
1230
+ {
1231
+ role: "status",
1232
+ "aria-label": n,
1233
+ className: y(xe.spinner, xe[e], t)
1234
+ }
1235
+ );
1236
+ }
1237
+ const Js = "tempest_stepper_w3qjQ", qs = "tempest_vertical_d4mOs", Gs = "tempest_step_s2nqL", Ks = "tempest_dot_d1bSL", Hs = "tempest_completed_gcFHM", Vs = "tempest_active_kL-CH", Qs = "tempest_label_8irAI", Ys = "tempest_connector_lyeWp", U = {
1238
+ stepper: Js,
1239
+ vertical: qs,
1240
+ step: Gs,
1241
+ dot: Ks,
1242
+ completed: Hs,
1243
+ active: Vs,
1244
+ label: Qs,
1245
+ connector: Ys
1246
+ };
1247
+ function sa({ steps: e, current: t, orientation: n = "horizontal", className: r }) {
1248
+ return /* @__PURE__ */ l(
1249
+ "ol",
1250
+ {
1251
+ className: y(U.stepper, n === "vertical" && U.vertical, r),
1252
+ children: e.map((s, o) => {
1253
+ const i = o < t, c = o === t;
1254
+ return /* @__PURE__ */ b(Pe, { children: [
1255
+ /* @__PURE__ */ b(
1256
+ "li",
1257
+ {
1258
+ className: y(
1259
+ U.step,
1260
+ i && U.completed,
1261
+ c && U.active
1262
+ ),
1263
+ "aria-current": c ? "step" : void 0,
1264
+ children: [
1265
+ /* @__PURE__ */ l("span", { className: U.dot, children: i ? "✓" : o + 1 }),
1266
+ /* @__PURE__ */ l("span", { className: U.label, children: s.label })
1267
+ ]
1268
+ }
1269
+ ),
1270
+ o < e.length - 1 && /* @__PURE__ */ l(
1271
+ "span",
1272
+ {
1273
+ className: y(U.connector, i && U.completed),
1274
+ "aria-hidden": !0
1275
+ }
1276
+ )
1277
+ ] }, o);
1278
+ })
1279
+ }
1280
+ );
1281
+ }
1282
+ const Zs = "tempest_wrapper_kudO9", Xs = "tempest_disabled_2aZ0V", eo = "tempest_input_5BPNu", to = "tempest_track_7ObdZ", no = "tempest_thumb_-FTeK", ro = "tempest_label_LrH7V", Z = {
1283
+ wrapper: Zs,
1284
+ disabled: Xs,
1285
+ input: eo,
1286
+ track: to,
1287
+ thumb: no,
1288
+ label: ro
1289
+ }, oa = O(function({ label: t, disabled: n, wrapperClassName: r, className: s, ...o }, i) {
1290
+ return /* @__PURE__ */ b("label", { className: y(Z.wrapper, n && Z.disabled, r), children: [
1291
+ /* @__PURE__ */ l(
1292
+ "input",
1293
+ {
1294
+ ref: i,
1295
+ type: "checkbox",
1296
+ role: "switch",
1297
+ disabled: n,
1298
+ className: y(Z.input, s),
1299
+ ...o
1300
+ }
1301
+ ),
1302
+ /* @__PURE__ */ l("span", { className: Z.track, "aria-hidden": !0, children: /* @__PURE__ */ l("span", { className: Z.thumb }) }),
1303
+ t && /* @__PURE__ */ l("span", { className: Z.label, children: t })
1304
+ ] });
1305
+ }), so = "tempest_scroll_unrJp", oo = "tempest_table_Dkosn", io = "tempest_th_PNuEx", ao = "tempest_td_jv9tA", co = "tempest_tr_7UG8J", lo = "tempest_clickable_B6Si-", uo = "tempest_alignRight_9hY0G", po = "tempest_alignCenter_YiUQy", fo = "tempest_emptyRow_kdMiv", R = {
1306
+ scroll: so,
1307
+ table: oo,
1308
+ th: io,
1309
+ td: ao,
1310
+ tr: co,
1311
+ clickable: lo,
1312
+ alignRight: uo,
1313
+ alignCenter: po,
1314
+ emptyRow: fo
1315
+ };
1316
+ function ia({
1317
+ columns: e,
1318
+ data: t,
1319
+ rowKey: n,
1320
+ onRowClick: r,
1321
+ emptyMessage: s = "Nenhum registro encontrado.",
1322
+ className: o
1323
+ }) {
1324
+ return /* @__PURE__ */ l("div", { className: y(R.scroll, o), children: /* @__PURE__ */ b("table", { className: R.table, children: [
1325
+ /* @__PURE__ */ l("thead", { children: /* @__PURE__ */ l("tr", { children: e.map((i) => /* @__PURE__ */ l(
1326
+ "th",
1327
+ {
1328
+ className: y(
1329
+ R.th,
1330
+ i.align === "right" && R.alignRight,
1331
+ i.align === "center" && R.alignCenter
1332
+ ),
1333
+ style: { width: i.width },
1334
+ children: i.header
1335
+ },
1336
+ i.key
1337
+ )) }) }),
1338
+ /* @__PURE__ */ l("tbody", { children: t.length === 0 ? /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { className: R.emptyRow, colSpan: e.length, children: s }) }) : t.map((i, c) => /* @__PURE__ */ l(
1339
+ "tr",
1340
+ {
1341
+ className: y(R.tr, r && R.clickable),
1342
+ onClick: r ? () => r(i) : void 0,
1343
+ children: e.map((a) => {
1344
+ const u = a.render ? a.render(i, c) : i[a.key];
1345
+ return /* @__PURE__ */ l(
1346
+ "td",
1347
+ {
1348
+ className: y(
1349
+ R.td,
1350
+ a.align === "right" && R.alignRight,
1351
+ a.align === "center" && R.alignCenter,
1352
+ a.className
1353
+ ),
1354
+ children: u
1355
+ },
1356
+ a.key
1357
+ );
1358
+ })
1359
+ },
1360
+ n(i, c)
1361
+ )) })
1362
+ ] }) });
1363
+ }
1364
+ const mo = "tempest_tablist_WR6ag", ho = "tempest_tab_IdDYc", go = "tempest_active_PTNtG", _o = "tempest_panel_08i9c", yo = "tempest_pill_lGuqn", oe = {
1365
+ tablist: mo,
1366
+ tab: ho,
1367
+ active: go,
1368
+ panel: _o,
1369
+ pill: yo
1370
+ };
1371
+ function aa({
1372
+ items: e,
1373
+ defaultId: t,
1374
+ activeId: n,
1375
+ onChange: r,
1376
+ variant: s = "underline",
1377
+ className: o
1378
+ }) {
1379
+ const i = e.find((m) => !m.disabled), [c, a] = v(t ?? i?.id), u = n !== void 0, d = u ? n : c, p = e.find((m) => m.id === d) ?? i;
1380
+ function f(m) {
1381
+ u || a(m), r?.(m);
1382
+ }
1383
+ return /* @__PURE__ */ b("div", { className: o, children: [
1384
+ /* @__PURE__ */ l("div", { role: "tablist", className: y(oe.tablist, s === "pill" && oe.pill), children: e.map((m) => {
1385
+ const g = m.id === p?.id;
1386
+ return /* @__PURE__ */ l(
1387
+ "button",
1388
+ {
1389
+ type: "button",
1390
+ role: "tab",
1391
+ "aria-selected": g,
1392
+ "aria-controls": `panel-${m.id}`,
1393
+ id: `tab-${m.id}`,
1394
+ disabled: m.disabled,
1395
+ className: y(oe.tab, g && oe.active),
1396
+ onClick: () => f(m.id),
1397
+ children: m.label
1398
+ },
1399
+ m.id
1400
+ );
1401
+ }) }),
1402
+ p && /* @__PURE__ */ l(
1403
+ "div",
1404
+ {
1405
+ role: "tabpanel",
1406
+ id: `panel-${p.id}`,
1407
+ "aria-labelledby": `tab-${p.id}`,
1408
+ className: oe.panel,
1409
+ children: p.content
1410
+ }
1411
+ )
1412
+ ] });
1413
+ }
1414
+ const bo = "tempest_wrapper_C0gfg", wo = "tempest_label_cWLXP", vo = "tempest_required_rDZXE", No = "tempest_textarea_Z-y6g", $o = "tempest_error_NWC9f", ko = "tempest_helper_gedut", So = "tempest_errorText_ey07q", H = {
1415
+ wrapper: bo,
1416
+ label: wo,
1417
+ required: vo,
1418
+ textarea: No,
1419
+ error: $o,
1420
+ helper: ko,
1421
+ errorText: So
1422
+ }, ca = O(function({ label: t, helperText: n, error: r, wrapperClassName: s, className: o, id: i, required: c, ...a }, u) {
1423
+ const d = ie(), p = i ?? d;
1424
+ return /* @__PURE__ */ b("div", { className: y(H.wrapper, r && H.error, s), children: [
1425
+ t && /* @__PURE__ */ b("label", { htmlFor: p, className: H.label, children: [
1426
+ t,
1427
+ c && /* @__PURE__ */ l("span", { className: H.required, children: "*" })
1428
+ ] }),
1429
+ /* @__PURE__ */ l(
1430
+ "textarea",
1431
+ {
1432
+ ref: u,
1433
+ id: p,
1434
+ "aria-invalid": !!r,
1435
+ required: c,
1436
+ className: y(H.textarea, o),
1437
+ ...a
1438
+ }
1439
+ ),
1440
+ r ? /* @__PURE__ */ l("span", { className: H.errorText, children: r }) : n ? /* @__PURE__ */ l("span", { className: H.helper, children: n }) : null
1441
+ ] });
1442
+ }), xo = "tempest_trigger_Dmc5E", Eo = "tempest_bubble_TPGHB", To = "tempest_tempest-tooltip-in_csYeZ", Co = "tempest_top_m2tnn", Lo = "tempest_bottom_9Twz4", Io = "tempest_left_UPdrG", Do = "tempest_right_CV--T", he = {
1443
+ trigger: xo,
1444
+ bubble: Eo,
1445
+ tempestTooltipIn: To,
1446
+ top: Co,
1447
+ bottom: Lo,
1448
+ left: Io,
1449
+ right: Do
1450
+ };
1451
+ function la({
1452
+ content: e,
1453
+ placement: t = "top",
1454
+ children: n,
1455
+ disabled: r = !1,
1456
+ openDelay: s = 150
1457
+ }) {
1458
+ const [o, i] = v(!1), c = ie();
1459
+ let a = null;
1460
+ function u() {
1461
+ r || (a && clearTimeout(a), a = setTimeout(() => i(!0), s));
1462
+ }
1463
+ function d() {
1464
+ a && (clearTimeout(a), a = null), i(!1);
1465
+ }
1466
+ const p = He(n, {
1467
+ onMouseEnter: u,
1468
+ onMouseLeave: d,
1469
+ onFocus: u,
1470
+ onBlur: d,
1471
+ "aria-describedby": o ? c : void 0
1472
+ });
1473
+ return /* @__PURE__ */ b("span", { className: he.trigger, children: [
1474
+ p,
1475
+ o && /* @__PURE__ */ l(
1476
+ "span",
1477
+ {
1478
+ id: c,
1479
+ role: "tooltip",
1480
+ className: y(he.bubble, he[t]),
1481
+ children: e
1482
+ }
1483
+ )
1484
+ ] });
1485
+ }
1486
+ const Mo = "tempest_container_x4-Qm", Po = "tempest_toast_FLdHz", Ao = "tempest_tempest-toast-in_E2d-A", Ro = "tempest_success_Oy694", Fo = "tempest_warning_84GC8", Oo = "tempest_error_hrQAA", Wo = "tempest_info_eq5bQ", Bo = "tempest_title_-H6R2", Uo = "tempest_description_-QwfC", jo = "tempest_close_i10-s", X = {
1487
+ container: Mo,
1488
+ toast: Po,
1489
+ tempestToastIn: Ao,
1490
+ success: Ro,
1491
+ warning: Fo,
1492
+ error: Oo,
1493
+ info: Wo,
1494
+ title: Bo,
1495
+ description: Uo,
1496
+ close: jo
1497
+ }, Fe = te(null);
1498
+ function ua() {
1499
+ const e = ee(Fe);
1500
+ if (!e) throw new Error("useToast must be used inside a <ToastProvider>");
1501
+ return e;
1502
+ }
1503
+ function da({ children: e, defaultDuration: t = 4e3 }) {
1504
+ const [n, r] = v([]), s = E(0), o = x((a) => {
1505
+ r((u) => u.filter((d) => d.id !== a));
1506
+ }, []), i = x(
1507
+ (a) => {
1508
+ const u = a.id ?? `toast-${++s.current}`, d = {
1509
+ id: u,
1510
+ title: a.title,
1511
+ description: a.description,
1512
+ variant: a.variant ?? "info",
1513
+ duration: a.duration ?? t
1514
+ };
1515
+ return r((p) => [...p, d]), u;
1516
+ },
1517
+ [t]
1518
+ ), c = F(
1519
+ () => ({
1520
+ show: i,
1521
+ dismiss: o,
1522
+ success: (a, u) => i({ ...u, description: a, variant: "success" }),
1523
+ error: (a, u) => i({ ...u, description: a, variant: "error" }),
1524
+ warning: (a, u) => i({ ...u, description: a, variant: "warning" }),
1525
+ info: (a, u) => i({ ...u, description: a, variant: "info" })
1526
+ }),
1527
+ [i, o]
1528
+ );
1529
+ return /* @__PURE__ */ b(Fe.Provider, { value: c, children: [
1530
+ e,
1531
+ /* @__PURE__ */ l(zo, { toasts: n, onDismiss: o })
1532
+ ] });
1533
+ }
1534
+ function zo({ toasts: e, onDismiss: t }) {
1535
+ return typeof document > "u" ? null : Ne(
1536
+ /* @__PURE__ */ l("div", { className: X.container, "aria-live": "polite", "aria-atomic": "true", children: e.map((n) => /* @__PURE__ */ l(Jo, { toast: n, onDismiss: t }, n.id)) }),
1537
+ document.body
1538
+ );
1539
+ }
1540
+ function Jo({ toast: e, onDismiss: t }) {
1541
+ return k(() => {
1542
+ if (!e.duration) return;
1543
+ const n = setTimeout(() => t(e.id), e.duration);
1544
+ return () => clearTimeout(n);
1545
+ }, [e.id, e.duration, t]), /* @__PURE__ */ b("div", { className: y(X.toast, X[e.variant]), role: "status", children: [
1546
+ /* @__PURE__ */ b("div", { children: [
1547
+ e.title && /* @__PURE__ */ l("p", { className: X.title, children: e.title }),
1548
+ e.description && /* @__PURE__ */ l("p", { className: X.description, children: e.description })
1549
+ ] }),
1550
+ /* @__PURE__ */ l(
1551
+ "button",
1552
+ {
1553
+ type: "button",
1554
+ className: X.close,
1555
+ "aria-label": "Fechar notificação",
1556
+ onClick: () => t(e.id),
1557
+ children: /* @__PURE__ */ l(qo, {})
1558
+ }
1559
+ )
1560
+ ] });
1561
+ }
1562
+ function qo() {
1563
+ return /* @__PURE__ */ l("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ l(
1564
+ "path",
1565
+ {
1566
+ d: "M6 6l12 12M6 18L18 6",
1567
+ stroke: "currentColor",
1568
+ strokeWidth: "2",
1569
+ strokeLinecap: "round"
1570
+ }
1571
+ ) });
1572
+ }
1573
+ const Go = "tempest_scroll_8Giwl", Ko = "tempest_spacer_P3Pvl", Ho = "tempest_row_Ff0VU", ge = {
1574
+ scroll: Go,
1575
+ spacer: Ko,
1576
+ row: Ho
1577
+ };
1578
+ function pa({
1579
+ items: e,
1580
+ itemHeight: t,
1581
+ renderItem: n,
1582
+ height: r,
1583
+ overscan: s = 4,
1584
+ getKey: o,
1585
+ className: i,
1586
+ style: c
1587
+ }) {
1588
+ const a = E(null), [u, d] = v(0), [p, f] = v(0);
1589
+ k(() => {
1590
+ const _ = a.current;
1591
+ if (!_ || (f(_.clientHeight), typeof ResizeObserver > "u")) return;
1592
+ const N = new ResizeObserver(() => f(_.clientHeight));
1593
+ return N.observe(_), () => N.disconnect();
1594
+ }, []);
1595
+ const m = e.length * t, g = Math.max(0, Math.floor(u / t) - s), h = Math.ceil(p / t) + s * 2, w = Math.min(e.length, g + h);
1596
+ return /* @__PURE__ */ l(
1597
+ "div",
1598
+ {
1599
+ ref: a,
1600
+ className: y(ge.scroll, i),
1601
+ style: { height: r, ...c },
1602
+ onScroll: (_) => d(_.target.scrollTop),
1603
+ role: "list",
1604
+ children: /* @__PURE__ */ l("div", { className: ge.spacer, style: { height: m }, children: e.slice(g, w).map((_, N) => {
1605
+ const $ = g + N, C = o ? o(_, $) : $;
1606
+ return /* @__PURE__ */ l(
1607
+ "div",
1608
+ {
1609
+ role: "listitem",
1610
+ className: ge.row,
1611
+ style: { top: $ * t, height: t },
1612
+ children: n(_, $)
1613
+ },
1614
+ C
1615
+ );
1616
+ }) })
1617
+ }
1618
+ );
1619
+ }
1620
+ function fa(e, t = 300) {
1621
+ const [n, r] = v(e);
1622
+ return k(() => {
1623
+ const s = setTimeout(() => r(e), t);
1624
+ return () => clearTimeout(s);
1625
+ }, [e, t]), n;
1626
+ }
1627
+ function ma(e = 1, t = 50) {
1628
+ const [n, r] = v(e), [s, o] = v(t), i = x(() => r(1), []);
1629
+ return { page: n, size: s, setPage: r, setSize: o, reset: i };
1630
+ }
1631
+ function ha(e, t, n) {
1632
+ return F(() => {
1633
+ const r = t.trim().toLowerCase();
1634
+ return r ? typeof n == "function" ? e.filter((s) => n(s, r)) : e.filter(
1635
+ (s) => n.some((o) => {
1636
+ const i = s[o];
1637
+ return i != null && String(i).toLowerCase().includes(r);
1638
+ })
1639
+ ) : e;
1640
+ }, [e, t, n]);
1641
+ }
1642
+ function ga(e) {
1643
+ const [t, n] = v(() => typeof window > "u" ? !1 : window.matchMedia(e).matches);
1644
+ return k(() => {
1645
+ if (typeof window > "u") return;
1646
+ const r = window.matchMedia(e), s = (o) => n(o.matches);
1647
+ return n(r.matches), r.addEventListener("change", s), () => r.removeEventListener("change", s);
1648
+ }, [e]), t;
1649
+ }
1650
+ function _a() {
1651
+ const [e, t] = v(
1652
+ () => typeof navigator > "u" ? !0 : navigator.onLine
1653
+ );
1654
+ return k(() => {
1655
+ if (typeof window > "u") return;
1656
+ const n = () => t(!0), r = () => t(!1);
1657
+ return window.addEventListener("online", n), window.addEventListener("offline", r), () => {
1658
+ window.removeEventListener("online", n), window.removeEventListener("offline", r);
1659
+ };
1660
+ }, []), e;
1661
+ }
1662
+ function ya() {
1663
+ const [e, t] = v(
1664
+ () => typeof document > "u" ? "visible" : document.visibilityState
1665
+ );
1666
+ return k(() => {
1667
+ if (typeof document > "u") return;
1668
+ const n = () => t(document.visibilityState);
1669
+ return document.addEventListener("visibilitychange", n), () => document.removeEventListener("visibilitychange", n);
1670
+ }, []), e;
1671
+ }
1672
+ function ba(e, t = {}) {
1673
+ const [n, r] = v(null), { once: s = !1, root: o, rootMargin: i, threshold: c } = t;
1674
+ return k(() => {
1675
+ const a = e.current;
1676
+ if (!a || typeof IntersectionObserver > "u") return;
1677
+ const u = new IntersectionObserver(
1678
+ ([d]) => {
1679
+ d && (r(d), s && d.isIntersecting && u.unobserve(a));
1680
+ },
1681
+ { root: o, rootMargin: i, threshold: c }
1682
+ );
1683
+ return u.observe(a), () => u.disconnect();
1684
+ }, [e, s, o, i, c]), n;
1685
+ }
1686
+ function wa(e) {
1687
+ const [t, n] = v(null);
1688
+ return k(() => {
1689
+ const r = e.current;
1690
+ if (!r || typeof ResizeObserver > "u") return;
1691
+ const s = new ResizeObserver((o) => {
1692
+ const i = o[0];
1693
+ if (!i) return;
1694
+ const c = i.contentRect;
1695
+ n({ width: c.width, height: c.height });
1696
+ });
1697
+ return s.observe(r), () => s.disconnect();
1698
+ }, [e]), t;
1699
+ }
1700
+ function va(e = {}) {
1701
+ const { resetAfter: t = 1500 } = e, [n, r] = v(!1), s = E(null), o = x(() => {
1702
+ s.current && (clearTimeout(s.current), s.current = null), r(!1);
1703
+ }, []);
1704
+ k(() => () => o(), [o]);
1705
+ const i = x(
1706
+ async (c) => {
1707
+ try {
1708
+ if (typeof navigator < "u" && navigator.clipboard?.writeText)
1709
+ await navigator.clipboard.writeText(c);
1710
+ else if (typeof document < "u") {
1711
+ const a = document.createElement("textarea");
1712
+ a.value = c, a.style.position = "fixed", a.style.opacity = "0", document.body.appendChild(a), a.select(), document.execCommand("copy"), document.body.removeChild(a);
1713
+ } else
1714
+ return !1;
1715
+ return r(!0), s.current && clearTimeout(s.current), s.current = setTimeout(() => r(!1), t), !0;
1716
+ } catch {
1717
+ return !1;
1718
+ }
1719
+ },
1720
+ [t]
1721
+ );
1722
+ return { copied: n, copy: i, reset: o };
1723
+ }
1724
+ function Vo(e, t) {
1725
+ if (e.key.toLowerCase() !== t.key.toLowerCase()) return !1;
1726
+ const n = !!t.ctrl, r = !!t.meta, s = !!t.shift, o = !!t.alt;
1727
+ if (t.mod) {
1728
+ if (!e.ctrlKey && !e.metaKey) return !1;
1729
+ } else if (e.ctrlKey !== n || e.metaKey !== r) return !1;
1730
+ return !(e.shiftKey !== s || e.altKey !== o);
1731
+ }
1732
+ function Qo(e) {
1733
+ if (!(e instanceof HTMLElement)) return !1;
1734
+ const t = e.tagName.toLowerCase();
1735
+ return t === "input" || t === "textarea" || t === "select" ? !0 : e.isContentEditable;
1736
+ }
1737
+ function Na(e, t, n = {}) {
1738
+ const { disabled: r = !1, ignoreInput: s = !0 } = n;
1739
+ k(() => {
1740
+ if (r || typeof window > "u") return;
1741
+ const o = (i) => {
1742
+ s && Qo(i.target) || Vo(i, e) && t(i);
1743
+ };
1744
+ return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
1745
+ }, [
1746
+ r,
1747
+ s,
1748
+ e.key,
1749
+ e.ctrl,
1750
+ e.meta,
1751
+ e.shift,
1752
+ e.alt,
1753
+ e.mod,
1754
+ t
1755
+ ]);
1756
+ }
1757
+ function $a() {
1758
+ const [e, t] = v(null), [n, r] = v(!1);
1759
+ k(() => {
1760
+ if (typeof window > "u") return;
1761
+ const o = (c) => {
1762
+ c.preventDefault(), t(c);
1763
+ }, i = () => {
1764
+ t(null), r(!0);
1765
+ };
1766
+ return window.addEventListener("beforeinstallprompt", o), window.addEventListener("appinstalled", i), () => {
1767
+ window.removeEventListener("beforeinstallprompt", o), window.removeEventListener("appinstalled", i);
1768
+ };
1769
+ }, []);
1770
+ const s = x(async () => {
1771
+ if (!e) return "unsupported";
1772
+ await e.prompt();
1773
+ const o = await e.userChoice;
1774
+ return t(null), o.outcome === "accepted" && r(!0), o.outcome;
1775
+ }, [e]);
1776
+ return {
1777
+ installable: !!e,
1778
+ installed: n,
1779
+ prompt: s
1780
+ };
1781
+ }
1782
+ const Ee = [
1783
+ "mousemove",
1784
+ "mousedown",
1785
+ "keydown",
1786
+ "touchstart",
1787
+ "wheel",
1788
+ "scroll"
1789
+ ];
1790
+ function ka(e = 6e4) {
1791
+ const [t, n] = v(!1);
1792
+ return k(() => {
1793
+ if (typeof window > "u") return;
1794
+ let r = setTimeout(() => n(!0), e);
1795
+ function s() {
1796
+ n(!1), clearTimeout(r), r = setTimeout(() => n(!0), e);
1797
+ }
1798
+ for (const o of Ee)
1799
+ window.addEventListener(o, s, { passive: !0 });
1800
+ return () => {
1801
+ clearTimeout(r);
1802
+ for (const o of Ee)
1803
+ window.removeEventListener(o, s);
1804
+ };
1805
+ }, [e]), t;
1806
+ }
1807
+ function Sa(e = {}) {
1808
+ const { watch: t = !1, disabled: n = !1, ...r } = e, [s, o] = v({
1809
+ loading: !n,
1810
+ error: null,
1811
+ coords: null,
1812
+ timestamp: null
1813
+ });
1814
+ return k(() => {
1815
+ if (n || typeof navigator > "u" || !navigator.geolocation) {
1816
+ o((a) => ({ ...a, loading: !1 }));
1817
+ return;
1818
+ }
1819
+ const i = (a) => {
1820
+ o({
1821
+ loading: !1,
1822
+ error: null,
1823
+ coords: a.coords,
1824
+ timestamp: a.timestamp
1825
+ });
1826
+ }, c = (a) => {
1827
+ o((u) => ({ ...u, loading: !1, error: a }));
1828
+ };
1829
+ if (t) {
1830
+ const a = navigator.geolocation.watchPosition(
1831
+ i,
1832
+ c,
1833
+ r
1834
+ );
1835
+ return () => navigator.geolocation.clearWatch(a);
1836
+ }
1837
+ navigator.geolocation.getCurrentPosition(i, c, r);
1838
+ }, [
1839
+ n,
1840
+ t,
1841
+ r.enableHighAccuracy,
1842
+ r.maximumAge,
1843
+ r.timeout
1844
+ ]), s;
1845
+ }
1846
+ function xa(e) {
1847
+ k(() => {
1848
+ if (!e || typeof document > "u") return;
1849
+ const t = document.body, n = t.style.overflow;
1850
+ return t.style.overflow = "hidden", () => {
1851
+ t.style.overflow = n;
1852
+ };
1853
+ }, [e]);
1854
+ }
1855
+ const Yo = [
1856
+ "a[href]",
1857
+ "button:not([disabled])",
1858
+ "textarea:not([disabled])",
1859
+ "input:not([disabled])",
1860
+ "select:not([disabled])",
1861
+ "[tabindex]:not([tabindex='-1'])"
1862
+ ].join(",");
1863
+ function Ea(e, t) {
1864
+ k(() => {
1865
+ if (!t) return;
1866
+ const n = e.current;
1867
+ if (!n) return;
1868
+ const r = document.activeElement;
1869
+ function s() {
1870
+ return Array.from(
1871
+ n?.querySelectorAll(Yo) ?? []
1872
+ ).filter((c) => {
1873
+ if (c.hasAttribute("aria-hidden")) return !1;
1874
+ const a = typeof window < "u" ? window.getComputedStyle(c) : null;
1875
+ return !(a && (a.display === "none" || a.visibility === "hidden"));
1876
+ });
1877
+ }
1878
+ function o(c) {
1879
+ if (c.key !== "Tab") return;
1880
+ const a = s();
1881
+ if (a.length === 0) {
1882
+ c.preventDefault();
1883
+ return;
1884
+ }
1885
+ const u = a[0], d = a[a.length - 1], p = document.activeElement;
1886
+ c.shiftKey ? (p === u || !p || !n?.contains(p)) && (c.preventDefault(), d.focus()) : p === d && (c.preventDefault(), u.focus());
1887
+ }
1888
+ return s()[0]?.focus(), document.addEventListener("keydown", o), () => {
1889
+ document.removeEventListener("keydown", o), r?.focus?.();
1890
+ };
1891
+ }, [e, t]);
1892
+ }
1893
+ function Ta(e) {
1894
+ const t = E(e);
1895
+ return t.current = e, x((...n) => t.current(...n), []);
1896
+ }
1897
+ function we(e, t) {
1898
+ if (Object.is(e, t)) return !0;
1899
+ if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
1900
+ if (Array.isArray(e) && Array.isArray(t))
1901
+ return e.length !== t.length ? !1 : e.every((s, o) => we(s, t[o]));
1902
+ const n = Object.keys(e), r = Object.keys(t);
1903
+ return n.length !== r.length ? !1 : n.every(
1904
+ (s) => we(e[s], t[s])
1905
+ );
1906
+ }
1907
+ function Ca(e) {
1908
+ const t = E(e);
1909
+ return we(t.current, e) || (t.current = e), t.current;
1910
+ }
1911
+ function Zo(e, t, n) {
1912
+ const r = new URL(t, e.endsWith("/") ? e : `${e}/`);
1913
+ if (n)
1914
+ for (const [s, o] of Object.entries(n))
1915
+ o != null && r.searchParams.set(s, String(o));
1916
+ return r.toString();
1917
+ }
1918
+ function Xo(e) {
1919
+ return typeof FormData < "u" && e instanceof FormData;
1920
+ }
1921
+ async function Te(e) {
1922
+ let t = null;
1923
+ try {
1924
+ t = await e.clone().json();
1925
+ } catch {
1926
+ try {
1927
+ t = await e.text();
1928
+ } catch {
1929
+ t = null;
1930
+ }
1931
+ }
1932
+ const n = (typeof t == "object" && t !== null ? t.detail ?? t.message : void 0) ?? `Erro ${e.status}`;
1933
+ return {
1934
+ status: e.status,
1935
+ detail: String(n),
1936
+ body: t
1937
+ };
1938
+ }
1939
+ function La(e) {
1940
+ const t = e.fetcher ?? globalThis.fetch.bind(globalThis);
1941
+ function n() {
1942
+ const i = e.getToken?.();
1943
+ return i ? { Authorization: `Bearer ${i}` } : {};
1944
+ }
1945
+ async function r(i, c) {
1946
+ const { body: a, params: u, headers: d, ...p } = c, f = Xo(a), m = {
1947
+ ...f ? {} : { "Content-Type": "application/json" },
1948
+ ...e.headers,
1949
+ ...n(),
1950
+ ...d
1951
+ }, g = {
1952
+ ...p,
1953
+ headers: m,
1954
+ credentials: e.withCredentials ? "include" : p.credentials,
1955
+ body: a == null ? void 0 : f ? a : JSON.stringify(a)
1956
+ };
1957
+ return t(Zo(e.baseURL, i, u), g);
1958
+ }
1959
+ async function s(i, c = {}) {
1960
+ let a = await r(i, c);
1961
+ if (a.status === 401)
1962
+ if (e.refresh)
1963
+ try {
1964
+ await e.refresh(), a = await r(i, c);
1965
+ } catch {
1966
+ throw await e.onUnauthorized?.(a), await Te(a);
1967
+ }
1968
+ else
1969
+ await e.onUnauthorized?.(a);
1970
+ if (!a.ok)
1971
+ throw await Te(a);
1972
+ return a.status === 204 ? void 0 : (a.headers.get("content-type") ?? "").includes("application/json") ? await a.json() : await a.text();
1973
+ }
1974
+ async function o(i, c, a = "POST") {
1975
+ return s(i, { method: a, body: c });
1976
+ }
1977
+ return {
1978
+ request: s,
1979
+ get: (i, c) => s(i, { ...c, method: "GET" }),
1980
+ post: (i, c) => s(i, { ...c, method: "POST" }),
1981
+ put: (i, c) => s(i, { ...c, method: "PUT" }),
1982
+ patch: (i, c) => s(i, { ...c, method: "PATCH" }),
1983
+ delete: (i, c) => s(i, { ...c, method: "DELETE" }),
1984
+ upload: o
1985
+ };
1986
+ }
1987
+ function Ia(e, t, n) {
1988
+ const r = e.safeParse(t);
1989
+ if (r.success)
1990
+ return r.data;
1991
+ if (typeof process < "u" && (process.env?.NODE_ENV === "development" || process.env?.NODE_ENV === "test")) {
1992
+ const o = r.error.issues.map((i) => ` - ${i.path.join(".") || "<root>"}: ${i.message}`).join(`
1993
+ `);
1994
+ throw new Error(
1995
+ `[parseResponse] Contract drift on ${n}:
1996
+ ${o}
1997
+
1998
+ Raw payload: ${JSON.stringify(t, null, 2)}`
1999
+ );
2000
+ }
2001
+ throw new Error(`Resposta inválida do servidor (${n}).`);
2002
+ }
2003
+ function ei(e) {
2004
+ if (!e) return null;
2005
+ try {
2006
+ return JSON.parse(e);
2007
+ } catch {
2008
+ return e;
2009
+ }
2010
+ }
2011
+ function Da(e) {
2012
+ const {
2013
+ url: t,
2014
+ body: n,
2015
+ method: r = "POST",
2016
+ headers: s = {},
2017
+ getToken: o,
2018
+ withCredentials: i = !1,
2019
+ onProgress: c,
2020
+ signal: a,
2021
+ parser: u = JSON.parse
2022
+ } = e;
2023
+ return new Promise((d, p) => {
2024
+ if (a?.aborted) {
2025
+ p(new DOMException("Aborted", "AbortError"));
2026
+ return;
2027
+ }
2028
+ const f = new XMLHttpRequest();
2029
+ f.open(r, t), f.withCredentials = i;
2030
+ const m = o?.(), g = { ...s };
2031
+ m && !("Authorization" in g) && (g.Authorization = `Bearer ${m}`);
2032
+ for (const [w, _] of Object.entries(g))
2033
+ f.setRequestHeader(w, _);
2034
+ c && (f.upload.onprogress = (w) => {
2035
+ c({
2036
+ loaded: w.loaded,
2037
+ total: w.total,
2038
+ fraction: w.lengthComputable ? w.loaded / w.total : null,
2039
+ lengthComputable: w.lengthComputable
2040
+ });
2041
+ });
2042
+ function h() {
2043
+ f.abort();
2044
+ }
2045
+ a?.addEventListener("abort", h), f.onload = () => {
2046
+ a?.removeEventListener("abort", h);
2047
+ const w = f.status >= 200 && f.status < 300, _ = f.getResponseHeader("content-type") ?? "";
2048
+ if (!w) {
2049
+ const N = ei(f.responseText), $ = (typeof N == "object" && N !== null ? N.detail ?? N.message : void 0) ?? `Erro ${f.status}`, C = {
2050
+ status: f.status,
2051
+ detail: String($),
2052
+ body: N
2053
+ };
2054
+ p(C);
2055
+ return;
2056
+ }
2057
+ if (f.status === 204 || !f.responseText) {
2058
+ d(void 0);
2059
+ return;
2060
+ }
2061
+ if (_.includes("application/json"))
2062
+ try {
2063
+ d(u(f.responseText));
2064
+ } catch (N) {
2065
+ p(N);
2066
+ }
2067
+ else
2068
+ d(f.responseText);
2069
+ }, f.onerror = () => {
2070
+ a?.removeEventListener("abort", h), p({ status: 0, detail: "Falha de rede no upload." });
2071
+ }, f.onabort = () => {
2072
+ a?.removeEventListener("abort", h), p(new DOMException("Aborted", "AbortError"));
2073
+ }, f.send(n);
2074
+ });
2075
+ }
2076
+ function ti(e, t) {
2077
+ return new Promise((n, r) => {
2078
+ if (t?.aborted) {
2079
+ r(new DOMException("Aborted", "AbortError"));
2080
+ return;
2081
+ }
2082
+ const s = setTimeout(n, e);
2083
+ t?.addEventListener(
2084
+ "abort",
2085
+ () => {
2086
+ clearTimeout(s), r(new DOMException("Aborted", "AbortError"));
2087
+ },
2088
+ { once: !0 }
2089
+ );
2090
+ });
2091
+ }
2092
+ async function Ma(e, t = {}) {
2093
+ const {
2094
+ retries: n = 3,
2095
+ initialDelay: r = 300,
2096
+ maxDelay: s = 1e4,
2097
+ shouldRetry: o = () => !0,
2098
+ onRetry: i,
2099
+ signal: c
2100
+ } = t;
2101
+ let a = 0, u;
2102
+ for (; a < n; ) {
2103
+ if (c?.aborted) throw new DOMException("Aborted", "AbortError");
2104
+ try {
2105
+ return await e();
2106
+ } catch (d) {
2107
+ if (u = d, a += 1, a >= n || !o(d, a))
2108
+ throw d;
2109
+ const p = Math.min(r * 2 ** (a - 1), s);
2110
+ i?.({ attempt: a, delay: p, error: d }), await ti(p, c);
2111
+ }
2112
+ }
2113
+ throw u;
2114
+ }
2115
+ function Pa() {
2116
+ return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
2117
+ const t = Math.random() * 16;
2118
+ return (e === "x" ? Math.floor(t) : Math.floor(t) & 3 | 8).toString(16);
2119
+ });
2120
+ }
2121
+ function Aa(e, t) {
2122
+ const { interval: n, disabled: r = !1, stopWhen: s, onError: o } = t, [i, c] = v(null), [a, u] = v(null), [d, p] = v(!r), f = E(r), m = E(!1), g = E(null);
2123
+ async function h() {
2124
+ if (!(f.current || m.current)) {
2125
+ m.current = !0;
2126
+ try {
2127
+ const w = await e();
2128
+ if (f.current) return;
2129
+ c(w), u(null), s?.(w) && (f.current = !0);
2130
+ } catch (w) {
2131
+ f.current || (u(w), o?.(w));
2132
+ } finally {
2133
+ m.current = !1, p(!1), f.current || (g.current = setTimeout(h, n));
2134
+ }
2135
+ }
2136
+ }
2137
+ return k(() => {
2138
+ if (f.current = r, r) {
2139
+ g.current && clearTimeout(g.current);
2140
+ return;
2141
+ }
2142
+ return p(!0), h(), () => {
2143
+ f.current = !0, g.current && clearTimeout(g.current);
2144
+ };
2145
+ }, [n, r]), {
2146
+ data: i,
2147
+ error: a,
2148
+ loading: d,
2149
+ stop: () => {
2150
+ f.current = !0, g.current && clearTimeout(g.current);
2151
+ },
2152
+ start: () => {
2153
+ f.current && (f.current = !1, h());
2154
+ }
2155
+ };
2156
+ }
2157
+ function Ra(e = {}) {
2158
+ const t = e.name ?? "tempest-auth", n = e.storage === "session" ? () => sessionStorage : () => localStorage;
2159
+ return Xe()(
2160
+ et(
2161
+ (r) => ({
2162
+ user: e.initialUser ?? null,
2163
+ token: e.initialToken ?? null,
2164
+ isAuthenticated: !!e.initialToken,
2165
+ setSession: ({ user: s, token: o }) => r({ user: s, token: o, isAuthenticated: !0 }),
2166
+ setUser: (s) => r({ user: s }),
2167
+ setToken: (s) => r({ token: s, isAuthenticated: !!s }),
2168
+ logout: () => r({ user: null, token: null, isAuthenticated: !1 })
2169
+ }),
2170
+ {
2171
+ name: t,
2172
+ storage: tt(n),
2173
+ partialize: (r) => ({ user: r.user, token: r.token }),
2174
+ onRehydrateStorage: () => (r) => {
2175
+ r && (r.isAuthenticated = !!r.token);
2176
+ }
2177
+ }
2178
+ )
2179
+ );
2180
+ }
2181
+ function Fa({ isAuthenticated: e, children: t, fallback: n }) {
2182
+ return /* @__PURE__ */ l(ve, { children: e ? t : n });
2183
+ }
2184
+ function Ce(e) {
2185
+ const t = e.replace(/-/g, "+").replace(/_/g, "/"), n = t.length % 4 === 0 ? "" : "=".repeat(4 - t.length % 4);
2186
+ return typeof atob < "u" ? atob(t + n) : Buffer.from(t + n, "base64").toString("binary");
2187
+ }
2188
+ function ni(e) {
2189
+ const t = e.split(".");
2190
+ if (t.length !== 3) throw new Error("Invalid JWT: must contain three segments.");
2191
+ const [n, r, s] = t;
2192
+ try {
2193
+ return {
2194
+ header: JSON.parse(Ce(n)),
2195
+ payload: JSON.parse(Ce(r)),
2196
+ signature: s
2197
+ };
2198
+ } catch {
2199
+ throw new Error("Invalid JWT: header or payload is not valid JSON.");
2200
+ }
2201
+ }
2202
+ function Oa(e, t = 0) {
2203
+ try {
2204
+ const { payload: n } = ni(e);
2205
+ if (typeof n.exp != "number") return !0;
2206
+ const r = Math.floor(Date.now() / 1e3);
2207
+ return n.exp <= r + t;
2208
+ } catch {
2209
+ return !0;
2210
+ }
2211
+ }
2212
+ function Wa(e, t = {}) {
2213
+ const { retries: n = 3, initialDelay: r = 400, reloadOnFinalFailure: s = !0 } = t;
2214
+ async function o(i = 1) {
2215
+ try {
2216
+ return await e();
2217
+ } catch (c) {
2218
+ if (i >= n)
2219
+ throw s && typeof window < "u" && window.location.reload(), c;
2220
+ return await new Promise((a) => setTimeout(a, r * 2 ** (i - 1))), o(i + 1);
2221
+ }
2222
+ }
2223
+ return Ve(o);
2224
+ }
2225
+ function Ba(e) {
2226
+ let t = null;
2227
+ return () => t || (t = (async () => {
2228
+ try {
2229
+ await e();
2230
+ } finally {
2231
+ t = null;
2232
+ }
2233
+ })(), t);
2234
+ }
2235
+ const ri = {
2236
+ SHORT: 30 * 1e3,
2237
+ DEFAULT: 300 * 1e3,
2238
+ LONG: 1800 * 1e3,
2239
+ INFINITE: 1 / 0
2240
+ }, si = {
2241
+ SHORT: 300 * 1e3,
2242
+ DEFAULT: 1800 * 1e3,
2243
+ LONG: 3600 * 1e3
2244
+ }, Ua = {
2245
+ REALTIME: 5 * 1e3,
2246
+ FAST: 30 * 1e3,
2247
+ DEFAULT: 60 * 1e3,
2248
+ SLOW: 300 * 1e3
2249
+ };
2250
+ function ja(e, t) {
2251
+ const n = { all: [e] };
2252
+ for (const [r, s] of Object.entries(t))
2253
+ typeof s == "function" ? n[r] = (...o) => [e, ...s(...o)] : n[r] = [e, ...s];
2254
+ return n;
2255
+ }
2256
+ function za({ children: e, client: t, defaultOptions: n }) {
2257
+ const [r] = v(
2258
+ () => t ?? new Ye({
2259
+ defaultOptions: {
2260
+ queries: {
2261
+ staleTime: ri.DEFAULT,
2262
+ gcTime: si.DEFAULT,
2263
+ retry: 1,
2264
+ refetchOnWindowFocus: !1,
2265
+ ...n?.queries ?? {}
2266
+ },
2267
+ mutations: {
2268
+ retry: 0,
2269
+ ...n?.mutations ?? {}
2270
+ }
2271
+ }
2272
+ })
2273
+ );
2274
+ return /* @__PURE__ */ l(Ze, { client: r, children: e });
2275
+ }
2276
+ function oi(e) {
2277
+ try {
2278
+ return JSON.parse(e);
2279
+ } catch {
2280
+ return e;
2281
+ }
2282
+ }
2283
+ function ii(e, t = {}) {
2284
+ const {
2285
+ withCredentials: n = !1,
2286
+ namedEvents: r = [],
2287
+ heartbeatEvents: s = ["ping"],
2288
+ maxRetries: o = 10,
2289
+ initialBackoff: i = 1e3,
2290
+ maxBackoff: c = 3e4,
2291
+ parser: a = oi,
2292
+ onOpen: u,
2293
+ onMessage: d,
2294
+ onError: p,
2295
+ onStatusChange: f
2296
+ } = t;
2297
+ let m = null, g = null, h = 0, w = "idle", _ = !1;
2298
+ function N(S) {
2299
+ w !== S && (w = S, f?.(S));
2300
+ }
2301
+ function $(S, L) {
2302
+ s.includes(S) || d?.({
2303
+ event: S,
2304
+ data: a(L.data),
2305
+ id: L.lastEventId || void 0,
2306
+ raw: L
2307
+ });
2308
+ }
2309
+ function C() {
2310
+ if (_) return;
2311
+ if (h >= o) {
2312
+ N("error");
2313
+ return;
2314
+ }
2315
+ const S = Math.min(i * 2 ** h, c);
2316
+ h += 1, g = setTimeout(I, S);
2317
+ }
2318
+ function I() {
2319
+ if (_) return;
2320
+ m && m.close(), N("connecting");
2321
+ const S = new EventSource(e, { withCredentials: n });
2322
+ m = S, S.onopen = () => {
2323
+ h = 0, N("open"), u?.();
2324
+ }, S.onmessage = (L) => $("message", L);
2325
+ for (const L of r)
2326
+ S.addEventListener(L, (fe) => $(L, fe));
2327
+ for (const L of s)
2328
+ S.addEventListener(L, () => {
2329
+ });
2330
+ S.onerror = (L) => {
2331
+ p?.(L), S.close(), m = null, N("closed"), C();
2332
+ };
2333
+ }
2334
+ function de() {
2335
+ _ = !0, g && (clearTimeout(g), g = null), h = 0, m && (m.close(), m = null), N("closed");
2336
+ }
2337
+ function pe() {
2338
+ g && (clearTimeout(g), g = null), h = 0, _ = !1, I();
2339
+ }
2340
+ return I(), {
2341
+ close: de,
2342
+ reconnect: pe,
2343
+ get status() {
2344
+ return w;
2345
+ }
2346
+ };
2347
+ }
2348
+ function Ja(e, t = {}) {
2349
+ const { enabled: n = !0, onMessage: r, ...s } = t, [o, i] = v("idle"), [c, a] = v(null), u = E(null), d = E(r);
2350
+ return d.current = r, k(() => {
2351
+ if (!n || !e) {
2352
+ i("idle");
2353
+ return;
2354
+ }
2355
+ const p = ii(e, {
2356
+ ...s,
2357
+ onStatusChange: i,
2358
+ onMessage: (f) => {
2359
+ a(f), d.current?.(f);
2360
+ }
2361
+ });
2362
+ return u.current = p.reconnect, () => {
2363
+ p.close(), u.current = null;
2364
+ };
2365
+ }, [e, n]), {
2366
+ status: o,
2367
+ lastMessage: c,
2368
+ reconnect: () => u.current?.()
2369
+ };
2370
+ }
2371
+ function ai(e) {
2372
+ const t = "=".repeat((4 - e.length % 4) % 4), n = (e + t).replace(/-/g, "+").replace(/_/g, "/"), r = window.atob(n), s = new ArrayBuffer(r.length), o = new Uint8Array(s);
2373
+ for (let i = 0; i < r.length; i++)
2374
+ o[i] = r.charCodeAt(i);
2375
+ return o;
2376
+ }
2377
+ function le() {
2378
+ return typeof window < "u" && "serviceWorker" in navigator && "PushManager" in window && "Notification" in window;
2379
+ }
2380
+ class Le extends Error {
2381
+ constructor() {
2382
+ super("Web Push não suportado neste navegador."), this.name = "WebPushUnsupportedError";
2383
+ }
2384
+ }
2385
+ class ci extends Error {
2386
+ constructor() {
2387
+ super("Permissão de notificação negada pelo usuário."), this.name = "WebPushPermissionDeniedError";
2388
+ }
2389
+ }
2390
+ class li {
2391
+ config;
2392
+ constructor(t) {
2393
+ this.config = t;
2394
+ }
2395
+ /** Whether the runtime supports the Push API. */
2396
+ static isSupported() {
2397
+ return le();
2398
+ }
2399
+ async registration() {
2400
+ if (!le()) throw new Le();
2401
+ return this.config.getRegistration ? await this.config.getRegistration() : await navigator.serviceWorker.ready;
2402
+ }
2403
+ /** Current `Notification.permission` value, or `"unsupported"`. */
2404
+ permission() {
2405
+ return typeof Notification > "u" ? "unsupported" : Notification.permission;
2406
+ }
2407
+ /**
2408
+ * Ask the user for notification permission.
2409
+ *
2410
+ * @throws {WebPushUnsupportedError} If the runtime lacks the Notification API.
2411
+ * @returns The resulting `NotificationPermission` value.
2412
+ */
2413
+ async requestPermission() {
2414
+ if (typeof Notification > "u") throw new Le();
2415
+ return Notification.requestPermission();
2416
+ }
2417
+ /** Return the active push subscription, if any. */
2418
+ async getSubscription() {
2419
+ return (await this.registration()).pushManager.getSubscription();
2420
+ }
2421
+ /** True when a subscription already exists for this browser. */
2422
+ async isSubscribed() {
2423
+ return le() ? await this.getSubscription() !== null : !1;
2424
+ }
2425
+ /**
2426
+ * Subscribe the current device. Requests permission, creates a push
2427
+ * subscription if none exists, and forwards the JSON payload to
2428
+ * `onSubscribe` for backend persistence.
2429
+ *
2430
+ * @returns The active `PushSubscription`.
2431
+ * @throws {WebPushUnsupportedError} If Web Push is unavailable.
2432
+ * @throws {WebPushPermissionDeniedError} If the user denies the prompt.
2433
+ */
2434
+ async subscribe() {
2435
+ if (await this.requestPermission() !== "granted") throw new ci();
2436
+ const n = await this.registration(), r = await n.pushManager.getSubscription();
2437
+ if (r)
2438
+ return await this.config.onSubscribe(r.toJSON()), r;
2439
+ const s = await n.pushManager.subscribe({
2440
+ userVisibleOnly: !0,
2441
+ applicationServerKey: ai(this.config.vapidPublicKey)
2442
+ });
2443
+ return await this.config.onSubscribe(s.toJSON()), s;
2444
+ }
2445
+ /**
2446
+ * Cancel the current subscription. Calls `onUnsubscribe` first (so the
2447
+ * backend can purge the record) and then `subscription.unsubscribe()`.
2448
+ *
2449
+ * @returns True when an active subscription was removed, false otherwise.
2450
+ */
2451
+ async unsubscribe() {
2452
+ const t = await this.getSubscription();
2453
+ return t ? (this.config.onUnsubscribe && await this.config.onUnsubscribe(t.toJSON()), t.unsubscribe()) : !1;
2454
+ }
2455
+ }
2456
+ function qa(e) {
2457
+ const t = E(e);
2458
+ t.current = e;
2459
+ const n = F(
2460
+ () => new li({
2461
+ vapidPublicKey: e.vapidPublicKey,
2462
+ onSubscribe: (h) => t.current.onSubscribe(h),
2463
+ onUnsubscribe: (h) => t.current.onUnsubscribe?.(h),
2464
+ getRegistration: e.getRegistration
2465
+ }),
2466
+ [e.vapidPublicKey, e.getRegistration]
2467
+ ), [r] = v(() => le()), [s, o] = v(
2468
+ () => n.permission()
2469
+ ), [i, c] = v(!1), [a, u] = v(!1), [d, p] = v(null), f = x(async () => {
2470
+ if (r) {
2471
+ o(n.permission());
2472
+ try {
2473
+ const h = await n.isSubscribed();
2474
+ c(h);
2475
+ } catch (h) {
2476
+ p(h instanceof Error ? h : new Error(String(h)));
2477
+ }
2478
+ }
2479
+ }, [n, r]);
2480
+ k(() => {
2481
+ f();
2482
+ }, [f]);
2483
+ const m = x(async () => {
2484
+ if (r) {
2485
+ u(!0), p(null);
2486
+ try {
2487
+ await n.subscribe(), c(!0), o(n.permission());
2488
+ } catch (h) {
2489
+ throw p(h instanceof Error ? h : new Error(String(h))), h;
2490
+ } finally {
2491
+ u(!1);
2492
+ }
2493
+ }
2494
+ }, [n, r]), g = x(async () => {
2495
+ if (r) {
2496
+ u(!0), p(null);
2497
+ try {
2498
+ await n.unsubscribe(), c(!1);
2499
+ } catch (h) {
2500
+ throw p(h instanceof Error ? h : new Error(String(h))), h;
2501
+ } finally {
2502
+ u(!1);
2503
+ }
2504
+ }
2505
+ }, [n, r]);
2506
+ return {
2507
+ supported: r,
2508
+ permission: s,
2509
+ subscribed: i,
2510
+ loading: a,
2511
+ error: d,
2512
+ subscribe: m,
2513
+ unsubscribe: g,
2514
+ refresh: f
2515
+ };
2516
+ }
2517
+ async function Ga(e) {
2518
+ if (typeof navigator > "u" || !("serviceWorker" in navigator))
2519
+ return null;
2520
+ try {
2521
+ const t = await navigator.serviceWorker.register(e.url, {
2522
+ scope: e.scope
2523
+ });
2524
+ return t.active && e.onReady?.(t), t.addEventListener("updatefound", () => {
2525
+ const n = t.installing;
2526
+ n && n.addEventListener("statechange", () => {
2527
+ n.state === "installed" && navigator.serviceWorker.controller && e.onUpdate?.(n, t);
2528
+ });
2529
+ }), t;
2530
+ } catch (t) {
2531
+ return e.onError?.(t), null;
2532
+ }
2533
+ }
2534
+ function Ka(e) {
2535
+ e.postMessage({ type: "SKIP_WAITING" });
2536
+ }
2537
+ async function Ha() {
2538
+ if (typeof navigator > "u" || !("serviceWorker" in navigator)) return 0;
2539
+ const e = await navigator.serviceWorker.getRegistrations();
2540
+ let t = 0;
2541
+ for (const n of e)
2542
+ await n.unregister() && (t += 1);
2543
+ return t;
2544
+ }
2545
+ function ke() {
2546
+ return globalThis;
2547
+ }
2548
+ function Va(e = {}) {
2549
+ const t = ke(), { defaultTitle: n = "Notificação", defaultIcon: r, defaultBadge: s, transform: o } = e;
2550
+ t.addEventListener("push", (i) => {
2551
+ if (!i.data) return;
2552
+ let c;
2553
+ try {
2554
+ c = i.data.json();
2555
+ } catch {
2556
+ c = { title: n, body: i.data.text() };
2557
+ }
2558
+ const a = o ? o(c) : c;
2559
+ if (!a) return;
2560
+ const u = a.title ?? n, d = {
2561
+ body: a.body,
2562
+ icon: a.icon ?? r,
2563
+ badge: a.badge ?? s,
2564
+ image: a.image,
2565
+ tag: a.tag,
2566
+ data: { url: a.url ?? "/", ...a.data ?? {} }
2567
+ };
2568
+ i.waitUntil(t.registration.showNotification(u, d));
2569
+ });
2570
+ }
2571
+ function Qa(e = {}) {
2572
+ const t = ke(), n = e.resolveUrl ?? ((r) => {
2573
+ if (typeof r == "string") return r;
2574
+ if (r && typeof r == "object" && "url" in r) {
2575
+ const s = r.url;
2576
+ return typeof s == "string" ? s : "/";
2577
+ }
2578
+ return "/";
2579
+ });
2580
+ t.addEventListener("notificationclick", (r) => {
2581
+ r.notification.close();
2582
+ const s = n(r.notification.data);
2583
+ r.waitUntil(
2584
+ (async () => {
2585
+ const o = await t.clients.matchAll({
2586
+ type: "window",
2587
+ includeUncontrolled: !0
2588
+ });
2589
+ for (const i of o)
2590
+ if (i.url.includes(s))
2591
+ return i.focus();
2592
+ return t.clients.openWindow(s);
2593
+ })()
2594
+ );
2595
+ });
2596
+ }
2597
+ function Ya() {
2598
+ const e = ke();
2599
+ e.addEventListener("message", (t) => {
2600
+ t.data?.type === "SKIP_WAITING" && e.skipWaiting();
2601
+ });
2602
+ }
2603
+ function Oe() {
2604
+ let e = null;
2605
+ async function t(r, {
2606
+ volume: s = 1,
2607
+ loop: o = !1,
2608
+ autoplay: i = !0,
2609
+ stopPrevious: c = !1,
2610
+ onEnded: a,
2611
+ onError: u
2612
+ } = {}) {
2613
+ try {
2614
+ c && e && (e.pause(), e.currentTime = 0);
2615
+ const d = new Audio(r);
2616
+ return d.volume = Math.max(0, Math.min(1, s)), d.loop = o, d.preload = "auto", a && (d.onended = a), u && (d.onerror = (p) => u(p)), e = d, i && await d.play(), d;
2617
+ } catch (d) {
2618
+ return u?.(d), null;
2619
+ }
2620
+ }
2621
+ function n() {
2622
+ e && (e.pause(), e.currentTime = 0);
2623
+ }
2624
+ return { play: t, stop: n, current: () => e };
2625
+ }
2626
+ let _e = null;
2627
+ function We() {
2628
+ return _e || (_e = Oe()), _e;
2629
+ }
2630
+ async function Za(e, t) {
2631
+ return We().play(e, t);
2632
+ }
2633
+ function Xa() {
2634
+ We().stop();
2635
+ }
2636
+ function ec() {
2637
+ const e = E(null), [t, n] = v(!1);
2638
+ e.current || (e.current = Oe()), k(() => () => {
2639
+ e.current?.stop();
2640
+ }, []);
2641
+ const r = x(async (o, i) => {
2642
+ await e.current.play(o, i) && n(!0);
2643
+ }, []), s = x(() => {
2644
+ e.current?.stop();
2645
+ }, []);
2646
+ return { play: r, stop: s, unlocked: t };
2647
+ }
2648
+ class ui extends nt {
2649
+ store;
2650
+ constructor(t, n, r, s) {
2651
+ super(t), this.version(n).stores({ [r]: s }), this.store = this.table(r);
2652
+ }
2653
+ }
2654
+ function tc(e) {
2655
+ const { databaseName: t, version: n, tableName: r, indexes: s, keyPath: o = "id", ownerField: i } = e, c = new ui(t, n, r, s), a = c.store;
2656
+ function u(p, f) {
2657
+ return !i || !f ? p : { ...p, [i]: f };
2658
+ }
2659
+ async function d(p, f = {}) {
2660
+ const { orderBy: m = o, reverse: g = !1, limit: h, offset: w, filter: _ } = f;
2661
+ let N = i && p ? a.where(i).equals(p) : a.toCollection();
2662
+ _ && (N = N.filter(_));
2663
+ let $ = m === o ? await N.toArray() : await N.sortBy(m);
2664
+ return g && ($ = $.reverse()), w && ($ = $.slice(w)), typeof h == "number" && ($ = $.slice(0, h)), $;
2665
+ }
2666
+ return {
2667
+ put: (p, f) => a.put(u(p, f)),
2668
+ bulkPut: (p, f) => a.bulkPut(p.map((m) => u(m, f))),
2669
+ get: (p) => a.get(p),
2670
+ list: d,
2671
+ update: (p, f) => a.update(p, f),
2672
+ updateMany: async (p, f) => {
2673
+ const m = f;
2674
+ return i && p ? a.where(i).equals(p).modify(m) : a.toCollection().modify(m);
2675
+ },
2676
+ delete: (p) => a.delete(p),
2677
+ clear: async (p) => {
2678
+ if (i && p) {
2679
+ await a.where(i).equals(p).delete();
2680
+ return;
2681
+ }
2682
+ await a.clear();
2683
+ },
2684
+ count: (p) => i && p ? a.where(i).equals(p).count() : a.count(),
2685
+ raw: a,
2686
+ db: c
2687
+ };
2688
+ }
2689
+ function di(e = [], t = []) {
2690
+ if (e.length !== t.length) return !0;
2691
+ for (let n = 0; n < e.length; n++)
2692
+ if (!Object.is(e[n], t[n])) return !0;
2693
+ return !1;
2694
+ }
2695
+ class nc extends Qe {
2696
+ state = { error: null };
2697
+ static getDerivedStateFromError(t) {
2698
+ return { error: t };
2699
+ }
2700
+ componentDidCatch(t, n) {
2701
+ this.props.onError?.(t, n);
2702
+ }
2703
+ componentDidUpdate(t) {
2704
+ this.state.error && di(t.resetKeys, this.props.resetKeys) && this.reset();
2705
+ }
2706
+ reset = () => {
2707
+ this.setState({ error: null });
2708
+ };
2709
+ render() {
2710
+ const { error: t } = this.state;
2711
+ if (!t) return this.props.children;
2712
+ const { fallback: n } = this.props;
2713
+ return typeof n == "function" ? n({ error: t, reset: this.reset }) : n;
2714
+ }
2715
+ }
2716
+ function rc() {
2717
+ const [, e] = v(null);
2718
+ return x((t) => {
2719
+ e(() => {
2720
+ throw t instanceof Error ? t : new Error(String(t));
2721
+ });
2722
+ }, []);
2723
+ }
2724
+ function sc(e, t) {
2725
+ const n = e.safeParse(t);
2726
+ if (n.success)
2727
+ return { success: !0, data: n.data, errors: {} };
2728
+ const r = {};
2729
+ for (const s of n.error.issues) {
2730
+ const o = s.path.length === 0 ? "_root" : s.path.join(".");
2731
+ o in r || (r[o] = s.message);
2732
+ }
2733
+ return { success: !1, errors: r };
2734
+ }
2735
+ function pi(e) {
2736
+ return async (t, n, r) => {
2737
+ const s = e.safeParse(t);
2738
+ if (s.success)
2739
+ return { values: s.data, errors: {} };
2740
+ const o = {}, i = r.criteriaMode ?? "firstError";
2741
+ for (const c of s.error.issues) {
2742
+ const a = c.path.length === 0 ? "_root" : c.path.join(".");
2743
+ i === "firstError" && o[a] || (o[a] = { type: c.code, message: c.message });
2744
+ }
2745
+ return { values: {}, errors: o };
2746
+ };
2747
+ }
2748
+ function oc(e, t = {}) {
2749
+ return rt({
2750
+ ...t,
2751
+ resolver: pi(e)
2752
+ });
2753
+ }
2754
+ function ae(e) {
2755
+ return e.replace(/\D/g, "");
2756
+ }
2757
+ function ic(e) {
2758
+ const t = ae(e);
2759
+ if (t.length !== 11 || /^(\d)\1+$/.test(t)) return !1;
2760
+ const n = t.split("").map(Number);
2761
+ let r = 0;
2762
+ for (let o = 0; o < 9; o++) r += n[o] * (10 - o);
2763
+ let s = r * 10 % 11;
2764
+ if (s === 10 && (s = 0), s !== n[9]) return !1;
2765
+ r = 0;
2766
+ for (let o = 0; o < 10; o++) r += n[o] * (11 - o);
2767
+ return s = r * 10 % 11, s === 10 && (s = 0), s === n[10];
2768
+ }
2769
+ function ac(e) {
2770
+ const t = ae(e);
2771
+ if (t.length !== 14 || /^(\d)\1+$/.test(t)) return !1;
2772
+ const n = t.split("").map(Number), r = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2], s = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
2773
+ let o = 0;
2774
+ for (let c = 0; c < 12; c++) o += n[c] * r[c];
2775
+ let i = o % 11;
2776
+ if (i = i < 2 ? 0 : 11 - i, i !== n[12]) return !1;
2777
+ o = 0;
2778
+ for (let c = 0; c < 13; c++) o += n[c] * s[c];
2779
+ return i = o % 11, i = i < 2 ? 0 : 11 - i, i === n[13];
2780
+ }
2781
+ function fi(e) {
2782
+ return ae(e).slice(0, 8).replace(/(\d{5})(\d)/, "$1-$2");
2783
+ }
2784
+ function mi(e) {
2785
+ return ae(e).slice(0, 14).replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1/$2").replace(/(\d{4})(\d)/, "$1-$2");
2786
+ }
2787
+ function cc(e) {
2788
+ return ae(e);
2789
+ }
2790
+ function lc(e) {
2791
+ return new Intl.NumberFormat("pt-BR", {
2792
+ style: "currency",
2793
+ currency: "BRL"
2794
+ }).format(e);
2795
+ }
2796
+ function uc(e) {
2797
+ const t = typeof e == "string" ? new Date(e) : e;
2798
+ return Number.isNaN(t.getTime()) ? "" : new Intl.DateTimeFormat("pt-BR").format(t);
2799
+ }
2800
+ function dc(e) {
2801
+ const t = typeof e == "string" ? new Date(e) : e;
2802
+ return Number.isNaN(t.getTime()) ? "" : new Intl.DateTimeFormat("pt-BR", {
2803
+ dateStyle: "short",
2804
+ timeStyle: "short"
2805
+ }).format(t);
2806
+ }
2807
+ function hi(e) {
2808
+ const t = e.replace(/\D/g, "").slice(0, 11);
2809
+ return t.length <= 10 ? t.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{4})(\d)/, "$1-$2") : t.replace(/(\d{2})(\d)/, "($1) $2").replace(/(\d{5})(\d)/, "$1-$2");
2810
+ }
2811
+ function gi(e) {
2812
+ return e.replace(/\D/g, "").slice(0, 11).replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2");
2813
+ }
2814
+ function pc(e) {
2815
+ return new Intl.NumberFormat("pt-BR", {
2816
+ style: "percent",
2817
+ minimumFractionDigits: 1,
2818
+ maximumFractionDigits: 1
2819
+ }).format(e);
2820
+ }
2821
+ function ue(e, t = "numeric") {
2822
+ return O(function({ value: r, onChange: s, ...o }, i) {
2823
+ return /* @__PURE__ */ l(
2824
+ $e,
2825
+ {
2826
+ ...o,
2827
+ ref: i,
2828
+ value: e(r ?? ""),
2829
+ inputMode: t,
2830
+ onChange: (c) => s(e(c.target.value))
2831
+ }
2832
+ );
2833
+ });
2834
+ }
2835
+ const fc = ue(gi), mc = ue(mi), hc = ue(hi, "tel"), gc = ue(fi);
2836
+ function _i(e, t, n) {
2837
+ return new Intl.NumberFormat(t, { style: "currency", currency: n }).format(e / 100);
2838
+ }
2839
+ function yi(e) {
2840
+ const t = e.replace(/\D/g, "");
2841
+ return t ? Number.parseInt(t, 10) : 0;
2842
+ }
2843
+ const _c = O(function({ value: t, onChange: n, currency: r = "BRL", locale: s = "pt-BR", ...o }, i) {
2844
+ return /* @__PURE__ */ l(
2845
+ $e,
2846
+ {
2847
+ ...o,
2848
+ ref: i,
2849
+ type: "text",
2850
+ inputMode: "numeric",
2851
+ value: _i(t || 0, s, r),
2852
+ onChange: (c) => n(yi(c.target.value))
2853
+ }
2854
+ );
2855
+ });
2856
+ function yc() {
2857
+ const [e, t] = v(!1), [n, r] = v(null), [s, o] = v(null), i = x(async (a) => {
2858
+ const u = a.replace(/\D/g, "");
2859
+ if (u.length !== 8)
2860
+ return r("CEP inválido."), null;
2861
+ t(!0), r(null);
2862
+ try {
2863
+ const p = await (await fetch(`https://viacep.com.br/ws/${u}/json/`)).json();
2864
+ return "erro" in p && p.erro ? (r("CEP não encontrado."), o(null), null) : (o(p), p);
2865
+ } catch (d) {
2866
+ return r(d instanceof Error ? d.message : String(d)), null;
2867
+ } finally {
2868
+ t(!1);
2869
+ }
2870
+ }, []), c = x(() => {
2871
+ t(!1), r(null), o(null);
2872
+ }, []);
2873
+ return { loading: e, error: n, data: s, lookup: i, reset: c };
2874
+ }
2875
+ function bi(e) {
2876
+ try {
2877
+ return JSON.parse(e);
2878
+ } catch {
2879
+ return e;
2880
+ }
2881
+ }
2882
+ function wi(e, t = {}) {
2883
+ const {
2884
+ protocols: n,
2885
+ maxRetries: r = 10,
2886
+ initialBackoff: s = 1e3,
2887
+ maxBackoff: o = 3e4,
2888
+ pingInterval: i = 0,
2889
+ pingPayload: c = JSON.stringify({ type: "ping" }),
2890
+ parser: a = bi,
2891
+ onOpen: u,
2892
+ onMessage: d,
2893
+ onClose: p,
2894
+ onError: f,
2895
+ onStatusChange: m
2896
+ } = t;
2897
+ let g = null, h = null, w = null, _ = 0, N = "idle", $ = !1;
2898
+ function C(T) {
2899
+ N !== T && (N = T, m?.(T));
2900
+ }
2901
+ function I() {
2902
+ w && (clearInterval(w), w = null);
2903
+ }
2904
+ function de() {
2905
+ !i || i <= 0 || (I(), w = setInterval(() => {
2906
+ g?.readyState === WebSocket.OPEN && g.send(c);
2907
+ }, i));
2908
+ }
2909
+ function pe() {
2910
+ if ($) return;
2911
+ if (_ >= r) {
2912
+ C("error");
2913
+ return;
2914
+ }
2915
+ const T = Math.min(s * 2 ** _, o);
2916
+ _ += 1, h = setTimeout(S, T);
2917
+ }
2918
+ function S() {
2919
+ if ($) return;
2920
+ g && (g.onopen = null, g.onmessage = null, g.onclose = null, g.onerror = null, g.close()), C("connecting");
2921
+ const T = new WebSocket(e, n);
2922
+ g = T, T.onopen = (M) => {
2923
+ _ = 0, C("open"), de(), u?.(M);
2924
+ }, T.onmessage = (M) => {
2925
+ const Ke = typeof M.data == "string" ? M.data : "";
2926
+ d?.({
2927
+ data: a(Ke),
2928
+ raw: M
2929
+ });
2930
+ }, T.onerror = (M) => {
2931
+ f?.(M);
2932
+ }, T.onclose = (M) => {
2933
+ I(), p?.(M), g = null, C("closed"), !$ && !M.wasClean && pe();
2934
+ };
2935
+ }
2936
+ function L(T) {
2937
+ return g?.readyState !== WebSocket.OPEN ? !1 : (g.send(T), !0);
2938
+ }
2939
+ function fe(T, M) {
2940
+ $ = !0, h && (clearTimeout(h), h = null), I(), _ = 0, g && (C("closing"), g.close(T, M), g = null), C("closed");
2941
+ }
2942
+ function Ge() {
2943
+ h && (clearTimeout(h), h = null), _ = 0, $ = !1, S();
2944
+ }
2945
+ return S(), {
2946
+ send: L,
2947
+ close: fe,
2948
+ reconnect: Ge,
2949
+ get status() {
2950
+ return N;
2951
+ }
2952
+ };
2953
+ }
2954
+ function bc(e, t = {}) {
2955
+ const { enabled: n = !0, onMessage: r, ...s } = t, [o, i] = v("idle"), [c, a] = v(null), u = E(null), d = E(r);
2956
+ d.current = r, k(() => {
2957
+ if (!n || !e) {
2958
+ i("idle");
2959
+ return;
2960
+ }
2961
+ const m = wi(e, {
2962
+ ...s,
2963
+ onStatusChange: i,
2964
+ onMessage: (g) => {
2965
+ a(g), d.current?.(g);
2966
+ }
2967
+ });
2968
+ return u.current = m, () => {
2969
+ m.close(), u.current = null;
2970
+ };
2971
+ }, [e, n]);
2972
+ const p = x(
2973
+ (m) => u.current?.send(m) ?? !1,
2974
+ []
2975
+ ), f = x(() => {
2976
+ u.current?.reconnect();
2977
+ }, []);
2978
+ return { status: o, lastMessage: c, send: p, reconnect: f };
2979
+ }
2980
+ const Be = te(null);
2981
+ function Ie(e) {
2982
+ return e === "dark" || e === "light" ? e : typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
2983
+ }
2984
+ function vi(e) {
2985
+ if (!e || typeof window > "u") return null;
2986
+ try {
2987
+ const t = window.localStorage.getItem(e);
2988
+ return t === "light" || t === "dark" || t === "system" ? t : null;
2989
+ } catch {
2990
+ return null;
2991
+ }
2992
+ }
2993
+ function wc({
2994
+ children: e,
2995
+ defaultTheme: t = "system",
2996
+ storageKey: n = "tempest-theme",
2997
+ target: r,
2998
+ attribute: s = "data-tempest-theme"
2999
+ }) {
3000
+ const [o, i] = v(
3001
+ () => vi(n) ?? t
3002
+ ), [c, a] = v(() => Ie(o)), u = E(r);
3003
+ u.current = r, k(() => {
3004
+ const m = u.current?.() ?? document.documentElement;
3005
+ if (!m) return;
3006
+ const g = Ie(o);
3007
+ m.setAttribute(s, g), a(g);
3008
+ }, [o, s]), k(() => {
3009
+ if (o !== "system" || typeof window > "u") return;
3010
+ const m = window.matchMedia("(prefers-color-scheme: dark)"), g = () => {
3011
+ const h = u.current?.() ?? document.documentElement, w = m.matches ? "dark" : "light";
3012
+ h?.setAttribute(s, w), a(w);
3013
+ };
3014
+ return m.addEventListener("change", g), () => m.removeEventListener("change", g);
3015
+ }, [o, s]);
3016
+ const d = x(
3017
+ (m) => {
3018
+ if (i(m), n && typeof window < "u")
3019
+ try {
3020
+ window.localStorage.setItem(n, m);
3021
+ } catch {
3022
+ }
3023
+ },
3024
+ [n]
3025
+ ), p = x(() => {
3026
+ d(c === "dark" ? "light" : "dark");
3027
+ }, [c, d]), f = F(
3028
+ () => ({ theme: o, resolvedTheme: c, setTheme: d, toggle: p }),
3029
+ [o, c, d, p]
3030
+ );
3031
+ return /* @__PURE__ */ l(Be.Provider, { value: f, children: e });
3032
+ }
3033
+ function vc() {
3034
+ const e = ee(Be);
3035
+ if (!e) throw new Error("useTheme must be used inside a <ThemeProvider>");
3036
+ return e;
3037
+ }
3038
+ function Nc(e = {}) {
3039
+ const { storageKey: t = "tempest-theme", defaultTheme: n = "system" } = e;
3040
+ if (typeof window > "u")
3041
+ return n === "dark" ? "dark" : "light";
3042
+ let r = null;
3043
+ try {
3044
+ r = window.localStorage.getItem(t);
3045
+ } catch {
3046
+ r = null;
3047
+ }
3048
+ const s = r ?? n;
3049
+ return s === "dark" || s === "light" ? s : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
3050
+ }
3051
+ function $c(e = {}) {
3052
+ const t = e.storageKey ?? "tempest-theme", n = e.defaultTheme ?? "system";
3053
+ return `
3054
+ (function(){try{
3055
+ var key=${JSON.stringify(t)};
3056
+ var def=${JSON.stringify(n)};
3057
+ var stored=localStorage.getItem(key);
3058
+ var mode=stored||def;
3059
+ var resolved=mode==="dark"||mode==="light"?mode:(matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");
3060
+ document.documentElement.setAttribute("data-tempest-theme",resolved);
3061
+ }catch(e){}})();
3062
+ `.trim();
3063
+ }
3064
+ function De(e, t) {
3065
+ return t ? e.replace(/\{(\w+)\}/g, (n, r) => {
3066
+ const s = t[r];
3067
+ return s === void 0 ? `{${r}}` : String(s);
3068
+ }) : e;
3069
+ }
3070
+ function ye(e, t, n, r) {
3071
+ const s = e[t]?.[r];
3072
+ if (s !== void 0) return s;
3073
+ if (n) {
3074
+ const o = e[n]?.[r];
3075
+ if (o !== void 0) return o;
3076
+ }
3077
+ return null;
3078
+ }
3079
+ function Ue(e) {
3080
+ const { locale: t, fallbackLocale: n = null, messages: r } = e;
3081
+ function s(a, u) {
3082
+ const d = ye(r, t, n, a);
3083
+ return d === null ? a : De(d, u);
3084
+ }
3085
+ function o(a, u, d) {
3086
+ const f = ye(r, t, n, `${a}${u === 1 ? "_one" : "_other"}`) ?? ye(r, t, n, a);
3087
+ return f === null ? a : De(f, { count: u, ...d ?? {} });
3088
+ }
3089
+ function i(a, u) {
3090
+ return new Intl.NumberFormat(t, u).format(a);
3091
+ }
3092
+ function c(a, u) {
3093
+ const d = typeof a == "string" ? new Date(a) : a;
3094
+ return Number.isNaN(d.getTime()) ? "" : new Intl.DateTimeFormat(t, u).format(d);
3095
+ }
3096
+ return {
3097
+ locale: t,
3098
+ fallbackLocale: n,
3099
+ t: s,
3100
+ plural: o,
3101
+ formatNumber: i,
3102
+ formatDate: c,
3103
+ withLocale: (a) => Ue({
3104
+ locale: a,
3105
+ fallbackLocale: n ?? void 0,
3106
+ messages: r
3107
+ })
3108
+ };
3109
+ }
3110
+ const je = te(null);
3111
+ function Ni(e, t) {
3112
+ if (!e || typeof window > "u") return null;
3113
+ try {
3114
+ const n = window.localStorage.getItem(e);
3115
+ return n && t.includes(n) ? n : null;
3116
+ } catch {
3117
+ return null;
3118
+ }
3119
+ }
3120
+ function kc({
3121
+ children: e,
3122
+ locale: t,
3123
+ fallbackLocale: n,
3124
+ messages: r,
3125
+ storageKey: s = "tempest-locale"
3126
+ }) {
3127
+ const o = F(() => Object.keys(r), [r]), [i, c] = v(
3128
+ () => Ni(s, o) ?? t
3129
+ );
3130
+ k(() => {
3131
+ typeof document < "u" && document.documentElement.setAttribute("lang", i);
3132
+ }, [i]);
3133
+ const a = x(
3134
+ (d) => {
3135
+ if (c(d), s && typeof window < "u")
3136
+ try {
3137
+ window.localStorage.setItem(s, d);
3138
+ } catch {
3139
+ }
3140
+ },
3141
+ [s]
3142
+ ), u = F(() => ({ ...Ue({ locale: i, fallbackLocale: n, messages: r }), setLocale: a, availableLocales: o }), [i, n, r, a, o]);
3143
+ return /* @__PURE__ */ l(je.Provider, { value: u, children: e });
3144
+ }
3145
+ function $i() {
3146
+ const e = ee(je);
3147
+ if (!e) throw new Error("useI18n must be used inside an <I18nProvider>");
3148
+ return e;
3149
+ }
3150
+ function Sc() {
3151
+ return $i().t;
3152
+ }
3153
+ const Me = ["debug", "info", "warn", "error"];
3154
+ function ki(e, t) {
3155
+ return Me.indexOf(t) >= Me.indexOf(e);
3156
+ }
3157
+ const Si = ({ level: e, message: t, context: n }) => {
3158
+ const r = e === "debug" ? "log" : e;
3159
+ n ? console[r](t, n) : console[r](t);
3160
+ };
3161
+ function xi(e = {}) {
3162
+ const t = e.level ?? "info", n = e.sinks ?? [Si], r = e.namespace ?? "";
3163
+ function s(o, i, c) {
3164
+ if (!ki(t, o)) return;
3165
+ const a = {
3166
+ level: o,
3167
+ message: r ? `[${r}] ${i}` : i,
3168
+ context: c,
3169
+ timestamp: Date.now()
3170
+ };
3171
+ for (const u of n)
3172
+ try {
3173
+ u(a);
3174
+ } catch {
3175
+ }
3176
+ }
3177
+ return {
3178
+ debug: (o, i) => s("debug", o, i),
3179
+ info: (o, i) => s("info", o, i),
3180
+ warn: (o, i) => s("warn", o, i),
3181
+ error: (o, i) => s("error", o, i),
3182
+ child: (o) => xi({
3183
+ level: t,
3184
+ sinks: n,
3185
+ namespace: r ? `${r}:${o}` : o
3186
+ })
3187
+ };
3188
+ }
3189
+ const ze = te(null);
3190
+ function xc({ adapter: e, children: t }) {
3191
+ k(() => (e.init?.(), () => {
3192
+ e.flush?.();
3193
+ }), [e]);
3194
+ const n = F(() => e, [e]);
3195
+ return /* @__PURE__ */ l(ze.Provider, { value: n, children: t });
3196
+ }
3197
+ function Ec() {
3198
+ return ee(ze);
3199
+ }
3200
+ const Tc = {
3201
+ identify(e) {
3202
+ console.info("[telemetry] identify", e);
3203
+ },
3204
+ track(e) {
3205
+ console.info("[telemetry] track", e.name, e.properties);
3206
+ },
3207
+ captureException(e, t) {
3208
+ console.error("[telemetry] exception", e, t);
3209
+ }
3210
+ }, Je = te(null);
3211
+ function Cc({ adapter: e, children: t }) {
3212
+ const n = F(() => e, [e]);
3213
+ return k(() => {
3214
+ }, [n]), /* @__PURE__ */ l(Je.Provider, { value: n, children: t });
3215
+ }
3216
+ function qe() {
3217
+ const e = ee(Je);
3218
+ if (!e) throw new Error("useFeatureFlag requires <FeatureFlagsProvider>");
3219
+ return e;
3220
+ }
3221
+ function Lc(e, t = !1) {
3222
+ const n = qe(), r = (o) => n.onChange ? n.onChange(o) : () => {
3223
+ }, s = () => n.isEnabled(e, t);
3224
+ return Ae(r, s, s);
3225
+ }
3226
+ function Ic(e, t) {
3227
+ const n = qe(), r = (o) => n.onChange ? n.onChange(o) : () => {
3228
+ }, s = () => n.get(e, t);
3229
+ return Ae(r, s, s);
3230
+ }
3231
+ function Dc(e = {}) {
3232
+ const t = { ...e.initial ?? {} }, n = /* @__PURE__ */ new Set();
3233
+ function r() {
3234
+ for (const s of n) s();
3235
+ }
3236
+ return {
3237
+ isEnabled(s, o = !1) {
3238
+ return s in t ? !!t[s] : o;
3239
+ },
3240
+ get(s, o) {
3241
+ return s in t ? t[s] : o;
3242
+ },
3243
+ onChange(s) {
3244
+ return n.add(s), () => n.delete(s);
3245
+ },
3246
+ set(s, o) {
3247
+ t[s] = o, r();
3248
+ }
3249
+ };
3250
+ }
3251
+ async function Mc(e) {
3252
+ if (typeof navigator > "u" || !("share" in navigator))
3253
+ return { shared: !1, unsupported: !0, cancelled: !1 };
3254
+ if (e.files && !navigator.canShare?.({ files: e.files }))
3255
+ return { shared: !1, unsupported: !0, cancelled: !1 };
3256
+ try {
3257
+ return await navigator.share(e), { shared: !0, unsupported: !1, cancelled: !1 };
3258
+ } catch (t) {
3259
+ return t instanceof DOMException && t.name === "AbortError" ? { shared: !1, unsupported: !1, cancelled: !0 } : { shared: !1, unsupported: !1, cancelled: !1, error: t };
3260
+ }
3261
+ }
3262
+ function Pc() {
3263
+ return typeof navigator < "u" && "share" in navigator;
3264
+ }
3265
+ const Ac = {
3266
+ get(e, t) {
3267
+ if (typeof window > "u") return t;
3268
+ try {
3269
+ const n = window.localStorage.getItem(e);
3270
+ return n === null ? t : JSON.parse(n);
3271
+ } catch {
3272
+ return t;
3273
+ }
3274
+ },
3275
+ set(e, t) {
3276
+ if (!(typeof window > "u"))
3277
+ try {
3278
+ window.localStorage.setItem(e, JSON.stringify(t));
3279
+ } catch {
3280
+ }
3281
+ },
3282
+ remove(e) {
3283
+ if (!(typeof window > "u"))
3284
+ try {
3285
+ window.localStorage.removeItem(e);
3286
+ } catch {
3287
+ }
3288
+ }
3289
+ };
3290
+ export {
3291
+ Fa as AuthGuard,
3292
+ Ai as Avatar,
3293
+ Ri as Badge,
3294
+ Fi as Breadcrumbs,
3295
+ be as Button,
3296
+ si as CACHE_TIME,
3297
+ gc as CEPInput,
3298
+ mc as CNPJInput,
3299
+ fc as CPFInput,
3300
+ Oi as Card,
3301
+ Wi as Checkbox,
3302
+ Bi as ChipInput,
3303
+ Ui as ConfirmDialog,
3304
+ Ki as Container,
3305
+ ji as DatePicker,
3306
+ zi as Drawer,
3307
+ Ji as EmptyState,
3308
+ nc as ErrorBoundary,
3309
+ qi as ErrorState,
3310
+ Cc as FeatureFlagsProvider,
3311
+ Gi as FileUpload,
3312
+ Vi as Grid,
3313
+ kc as I18nProvider,
3314
+ $e as Input,
3315
+ xn as Modal,
3316
+ _c as MoneyInput,
3317
+ Qi as Pagination,
3318
+ hc as PhoneInput,
3319
+ Yi as Progress,
3320
+ za as QueryProvider,
3321
+ Ua as REFETCH_TIME,
3322
+ Zi as Radio,
3323
+ Xi as RadioGroup,
3324
+ ri as STALE_TIME,
3325
+ ea as SearchBar,
3326
+ ta as Select,
3327
+ na as Skeleton,
3328
+ ra as Spinner,
3329
+ Hi as Stack,
3330
+ sa as Stepper,
3331
+ oa as Switch,
3332
+ ia as Table,
3333
+ aa as Tabs,
3334
+ xc as TelemetryProvider,
3335
+ ca as Textarea,
3336
+ wc as ThemeProvider,
3337
+ da as ToastProvider,
3338
+ la as Tooltip,
3339
+ pa as VirtualList,
3340
+ li as WebPushClient,
3341
+ ci as WebPushPermissionDeniedError,
3342
+ Le as WebPushUnsupportedError,
3343
+ y as cn,
3344
+ Si as consoleSink,
3345
+ Tc as consoleTelemetryAdapter,
3346
+ La as createApiClient,
3347
+ Oe as createAudioPlayer,
3348
+ Ra as createAuthStore,
3349
+ ii as createEventStream,
3350
+ Ue as createI18n,
3351
+ Dc as createInMemoryFlags,
3352
+ xi as createLogger,
3353
+ tc as createOfflineStore,
3354
+ ja as createQueryKeys,
3355
+ Ba as createRefreshQueue,
3356
+ wi as createWebSocket,
3357
+ ni as decodeJWT,
3358
+ fi as formatCEP,
3359
+ mi as formatCNPJ,
3360
+ gi as formatCPF,
3361
+ lc as formatCurrency,
3362
+ uc as formatDate,
3363
+ dc as formatDateTime,
3364
+ pc as formatPercent,
3365
+ hi as formatPhone,
3366
+ Pa as generateIdempotencyKey,
3367
+ Nc as getInitialTheme,
3368
+ Qa as installNotificationClickHandler,
3369
+ Va as installPushHandler,
3370
+ Ya as installSkipWaitingListener,
3371
+ Oa as isJWTExpired,
3372
+ le as isPushSupported,
3373
+ Pc as isShareSupported,
3374
+ Wa as lazyWithRetry,
3375
+ Ia as parseResponse,
3376
+ Za as playAudio,
3377
+ Ga as registerServiceWorker,
3378
+ Ma as retry,
3379
+ Mc as share,
3380
+ Ka as skipWaiting,
3381
+ Xa as stopAudio,
3382
+ Ac as storage,
3383
+ $c as themeInitScript,
3384
+ cc as unmask,
3385
+ Ha as unregisterAllServiceWorkers,
3386
+ Da as uploadWithProgress,
3387
+ ai as urlBase64ToUint8Array,
3388
+ ec as useAudio,
3389
+ $a as useBeforeInstallPrompt,
3390
+ ha as useClientFilter,
3391
+ va as useClipboard,
3392
+ fa as useDebounce,
3393
+ Ca as useDeepMemo,
3394
+ ya as useDocumentVisibility,
3395
+ rc as useErrorHandler,
3396
+ Ja as useEventStream,
3397
+ Lc as useFeatureFlag,
3398
+ Ic as useFlagValue,
3399
+ Ea as useFocusTrap,
3400
+ Sa as useGeolocation,
3401
+ $i as useI18n,
3402
+ ka as useIdle,
3403
+ ba as useIntersectionObserver,
3404
+ Na as useKeyboardShortcut,
3405
+ ga as useMediaQuery,
3406
+ _a as useOnline,
3407
+ ma as usePagination,
3408
+ Aa as usePoll,
3409
+ qa as usePushSubscription,
3410
+ wa as useResizeObserver,
3411
+ xa as useScrollLock,
3412
+ Ta as useStableCallback,
3413
+ Ec as useTelemetry,
3414
+ vc as useTheme,
3415
+ ua as useToast,
3416
+ Sc as useTranslate,
3417
+ yc as useViaCEP,
3418
+ bc as useWebSocket,
3419
+ oc as useZodForm,
3420
+ ac as validateCNPJ,
3421
+ ic as validateCPF,
3422
+ sc as validateForm,
3423
+ pi as zodResolver
3424
+ };
3425
+ //# sourceMappingURL=tempest-react-sdk.js.map