@arturoliveira/vesta-ui 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.
package/dist/index.mjs ADDED
@@ -0,0 +1,4731 @@
1
+ import { jsxs as I, jsx as h, Fragment as ut } from "react/jsx-runtime";
2
+ import { clsx as Es } from "clsx";
3
+ import { twMerge as Ts } from "tailwind-merge";
4
+ import { createContext as Je, useContext as fn, useRef as re, useLayoutEffect as Ns, useEffect as Ie, useSyncExternalStore as hn, useCallback as pn, useMemo as ze, memo as Cs, forwardRef as R, createElement as ws, Children as gn, isValidElement as Ps, cloneElement as xs, useId as mn, useState as dt } from "react";
5
+ import { createPortal as Os } from "react-dom";
6
+ import { X as yn, Check as Ss, ChevronDown as ks, Info as Is, AlertTriangle as Ds, AlertCircle as As, CheckCircle as Rs } from "lucide-react";
7
+ import { Select as H, createListCollection as Ls } from "@ark-ui/react";
8
+ function E(...e) {
9
+ return Ts(Es(e));
10
+ }
11
+ const jt = {
12
+ variant: {
13
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
14
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
15
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
16
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
17
+ ghost: "hover:bg-accent hover:text-accent-foreground",
18
+ link: "text-primary underline-offset-4 hover:underline"
19
+ },
20
+ size: {
21
+ default: "h-10 px-4 py-2",
22
+ sm: "h-9 rounded-md px-3",
23
+ lg: "h-11 rounded-md px-8",
24
+ icon: "h-10 w-10"
25
+ }
26
+ };
27
+ function Vt({
28
+ className: e,
29
+ variant: t = "default",
30
+ size: n = "default",
31
+ children: s,
32
+ loading: r = !1,
33
+ disabled: o,
34
+ ...c
35
+ }) {
36
+ return /* @__PURE__ */ I(
37
+ "button",
38
+ {
39
+ className: E(
40
+ // Base styles
41
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium",
42
+ "ring-offset-background transition-colors",
43
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
44
+ "disabled:pointer-events-none disabled:opacity-50",
45
+ "[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
46
+ // Variants
47
+ jt.variant[t],
48
+ // Sizes
49
+ jt.size[n],
50
+ e
51
+ ),
52
+ disabled: o || r,
53
+ ...c,
54
+ children: [
55
+ r && /* @__PURE__ */ I(
56
+ "svg",
57
+ {
58
+ className: "animate-spin h-4 w-4",
59
+ xmlns: "http://www.w3.org/2000/svg",
60
+ fill: "none",
61
+ viewBox: "0 0 24 24",
62
+ "aria-hidden": "true",
63
+ children: [
64
+ /* @__PURE__ */ h(
65
+ "circle",
66
+ {
67
+ className: "opacity-25",
68
+ cx: "12",
69
+ cy: "12",
70
+ r: "10",
71
+ stroke: "currentColor",
72
+ strokeWidth: "4"
73
+ }
74
+ ),
75
+ /* @__PURE__ */ h(
76
+ "path",
77
+ {
78
+ className: "opacity-75",
79
+ fill: "currentColor",
80
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
81
+ }
82
+ )
83
+ ]
84
+ }
85
+ ),
86
+ s
87
+ ]
88
+ }
89
+ );
90
+ }
91
+ function Aa({ className: e, ...t }) {
92
+ return /* @__PURE__ */ h(
93
+ "div",
94
+ {
95
+ className: E("rounded-lg border border-border bg-card text-card-foreground", e),
96
+ ...t
97
+ }
98
+ );
99
+ }
100
+ function Ra({ className: e, ...t }) {
101
+ return /* @__PURE__ */ h("div", { className: E("flex flex-col space-y-1.5 p-6", e), ...t });
102
+ }
103
+ function La({ className: e, ...t }) {
104
+ return /* @__PURE__ */ h(
105
+ "h3",
106
+ {
107
+ className: E("text-2xl font-semibold leading-none tracking-tight", e),
108
+ ...t
109
+ }
110
+ );
111
+ }
112
+ function Fa({ className: e, ...t }) {
113
+ return /* @__PURE__ */ h("p", { className: E("text-sm text-muted-foreground", e), ...t });
114
+ }
115
+ function Ma({ className: e, ...t }) {
116
+ return /* @__PURE__ */ h("div", { className: E("p-6 pt-0", e), ...t });
117
+ }
118
+ function _a({ className: e, ...t }) {
119
+ return /* @__PURE__ */ h("div", { className: E("flex items-center p-6 pt-0", e), ...t });
120
+ }
121
+ function Fs(e, t) {
122
+ return `${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`;
123
+ }
124
+ function J(e = {}) {
125
+ const {
126
+ name: t,
127
+ strict: n = !0,
128
+ hookName: s = "useContext",
129
+ providerName: r = "Provider",
130
+ errorMessage: o,
131
+ defaultValue: c
132
+ } = e, i = Je(c);
133
+ i.displayName = t;
134
+ function u() {
135
+ var l;
136
+ const a = fn(i);
137
+ if (!a && n) {
138
+ const d = new Error(o ?? Fs(s, r));
139
+ throw d.name = "ContextError", (l = Error.captureStackTrace) == null || l.call(Error, d, u), d;
140
+ }
141
+ return a;
142
+ }
143
+ return [i.Provider, u, i];
144
+ }
145
+ const [Ms, Qe] = J({
146
+ name: "CheckboxContext",
147
+ hookName: "useCheckboxContext",
148
+ providerName: "<CheckboxProvider />"
149
+ }), _s = Symbol(), wt = Symbol(), we = "a", vn = "f", Gt = "p", bn = "c", En = "t", Tn = "h", Ue = "w", Nn = "o", Cn = "k";
150
+ let Bs = (e, t) => new Proxy(e, t);
151
+ const ft = Object.getPrototypeOf, ht = /* @__PURE__ */ new WeakMap(), wn = (e) => e && (ht.has(e) ? ht.get(e) : ft(e) === Object.prototype || ft(e) === Array.prototype), Ut = (e) => typeof e == "object" && e !== null, $s = (e) => Object.values(Object.getOwnPropertyDescriptors(e)).some((t) => !t.configurable && !t.writable), Hs = (e) => {
152
+ if (Array.isArray(e))
153
+ return Array.from(e);
154
+ const t = Object.getOwnPropertyDescriptors(e);
155
+ return Object.values(t).forEach((n) => {
156
+ n.configurable = !0;
157
+ }), Object.create(ft(e), t);
158
+ }, js = (e, t) => {
159
+ const n = {
160
+ [vn]: t
161
+ };
162
+ let s = !1;
163
+ const r = (i, u) => {
164
+ if (!s) {
165
+ let a = n[we].get(e);
166
+ if (a || (a = {}, n[we].set(e, a)), i === Ue)
167
+ a[Ue] = !0;
168
+ else {
169
+ let l = a[i];
170
+ l || (l = /* @__PURE__ */ new Set(), a[i] = l), l.add(u);
171
+ }
172
+ }
173
+ }, o = () => {
174
+ s = !0, n[we].delete(e);
175
+ }, c = {
176
+ get(i, u) {
177
+ return u === wt ? e : (r(Cn, u), xn(Reflect.get(i, u), n[we], n[bn], n[En]));
178
+ },
179
+ has(i, u) {
180
+ return u === _s ? (o(), !0) : (r(Tn, u), Reflect.has(i, u));
181
+ },
182
+ getOwnPropertyDescriptor(i, u) {
183
+ return r(Nn, u), Reflect.getOwnPropertyDescriptor(i, u);
184
+ },
185
+ ownKeys(i) {
186
+ return r(Ue), Reflect.ownKeys(i);
187
+ }
188
+ };
189
+ return t && (c.set = c.deleteProperty = () => !1), [c, n];
190
+ }, Pn = (e) => (
191
+ // unwrap proxy
192
+ e[wt] || // otherwise
193
+ e
194
+ ), xn = (e, t, n, s) => {
195
+ if (!wn(e))
196
+ return e;
197
+ let r = s && s.get(e);
198
+ if (!r) {
199
+ const u = Pn(e);
200
+ $s(u) ? r = [u, Hs(u)] : r = [u], s == null || s.set(e, r);
201
+ }
202
+ const [o, c] = r;
203
+ let i = n && n.get(o);
204
+ return (!i || i[1][vn] !== !!c) && (i = js(o, !!c), i[1][Gt] = Bs(c || o, i[0]), n && n.set(o, i)), i[1][we] = t, i[1][bn] = n, i[1][En] = s, i[1][Gt];
205
+ }, Vs = (e, t) => {
206
+ const n = Reflect.ownKeys(e), s = Reflect.ownKeys(t);
207
+ return n.length !== s.length || n.some((r, o) => r !== s[o]);
208
+ }, On = (e, t, n, s, r = Object.is) => {
209
+ if (r(e, t))
210
+ return !1;
211
+ if (!Ut(e) || !Ut(t))
212
+ return !0;
213
+ const o = n.get(Pn(e));
214
+ if (!o)
215
+ return !0;
216
+ if (s) {
217
+ if (s.get(e) === t)
218
+ return !1;
219
+ s.set(e, t);
220
+ }
221
+ let c = null;
222
+ for (const i of o[Tn] || [])
223
+ if (c = Reflect.has(e, i) !== Reflect.has(t, i), c)
224
+ return c;
225
+ if (o[Ue] === !0) {
226
+ if (c = Vs(e, t), c)
227
+ return c;
228
+ } else
229
+ for (const i of o[Nn] || []) {
230
+ const u = !!Reflect.getOwnPropertyDescriptor(e, i), a = !!Reflect.getOwnPropertyDescriptor(t, i);
231
+ if (c = u !== a, c)
232
+ return c;
233
+ }
234
+ for (const i of o[Cn] || [])
235
+ if (c = On(e[i], t[i], n, s, r), c)
236
+ return c;
237
+ if (c === null)
238
+ throw new Error("invalid used");
239
+ return c;
240
+ }, Gs = (e) => wn(e) && e[wt] || null, Kt = (e, t = !0) => {
241
+ ht.set(e, t);
242
+ };
243
+ function Us() {
244
+ if (typeof globalThis < "u") return globalThis;
245
+ if (typeof self < "u") return self;
246
+ if (typeof window < "u") return window;
247
+ if (typeof global < "u") return global;
248
+ }
249
+ function Pt(e, t) {
250
+ const n = Us();
251
+ return n ? (n[e] || (n[e] = t()), n[e]) : t();
252
+ }
253
+ var xe = Pt("__zag__refSet", () => /* @__PURE__ */ new WeakSet()), Ks = (e) => typeof e == "object" && e !== null && "$$typeof" in e && "props" in e, Ws = (e) => typeof e == "object" && e !== null && "__v_isVNode" in e, zs = (e) => typeof e == "object" && e !== null && "nodeType" in e && typeof e.nodeName == "string", qs = (e) => Ks(e) || Ws(e) || zs(e), pt = (e) => e !== null && typeof e == "object", gt = (e) => pt(e) && !xe.has(e) && (Array.isArray(e) || !(Symbol.iterator in e)) && !qs(e) && !(e instanceof WeakMap) && !(e instanceof WeakSet) && !(e instanceof Error) && !(e instanceof Number) && !(e instanceof Date) && !(e instanceof String) && !(e instanceof RegExp) && !(e instanceof ArrayBuffer) && !(e instanceof Promise), qe = () => process.env.NODE_ENV !== "production";
254
+ function Wt(e, t, n) {
255
+ typeof n.value == "object" && !gt(n.value) && (n.value = ce(n.value)), !n.enumerable || n.get || n.set || !n.configurable || !n.writable || t === "__proto__" ? Object.defineProperty(e, t, n) : e[t] = n.value;
256
+ }
257
+ function ce(e) {
258
+ if (typeof e != "object") return e;
259
+ var t = 0, n, s, r, o = Object.prototype.toString.call(e);
260
+ if (o === "[object Object]" ? r = Object.create(Object.getPrototypeOf(e) || null) : o === "[object Array]" ? r = Array(e.length) : o === "[object Set]" ? (r = /* @__PURE__ */ new Set(), e.forEach(function(c) {
261
+ r.add(ce(c));
262
+ })) : o === "[object Map]" ? (r = /* @__PURE__ */ new Map(), e.forEach(function(c, i) {
263
+ r.set(ce(i), ce(c));
264
+ })) : o === "[object Date]" ? r = /* @__PURE__ */ new Date(+e) : o === "[object RegExp]" ? r = new RegExp(e.source, e.flags) : o === "[object DataView]" ? r = new e.constructor(ce(e.buffer)) : o === "[object ArrayBuffer]" ? r = e.slice(0) : o === "[object Blob]" ? r = e.slice() : o.slice(-6) === "Array]" && (r = new e.constructor(e)), r) {
265
+ for (s = Object.getOwnPropertySymbols(e); t < s.length; t++)
266
+ Wt(r, s[t], Object.getOwnPropertyDescriptor(e, s[t]));
267
+ for (t = 0, s = Object.getOwnPropertyNames(e); t < s.length; t++)
268
+ Object.hasOwnProperty.call(r, n = s[t]) && r[n] === e[n] || Wt(r, n, Object.getOwnPropertyDescriptor(e, n));
269
+ }
270
+ return r || e;
271
+ }
272
+ var ae = Pt("__zag__proxyStateMap", () => /* @__PURE__ */ new WeakMap()), Ys = (e = Object.is, t = (i, u) => new Proxy(i, u), n = /* @__PURE__ */ new WeakMap(), s = (i, u) => {
273
+ const a = n.get(i);
274
+ if ((a == null ? void 0 : a[0]) === u)
275
+ return a[1];
276
+ const l = Array.isArray(i) ? [] : Object.create(Object.getPrototypeOf(i));
277
+ return Kt(l, !0), n.set(i, [u, l]), Reflect.ownKeys(i).forEach((d) => {
278
+ const f = Reflect.get(i, d);
279
+ xe.has(f) ? (Kt(f, !1), l[d] = f) : ae.has(f) ? l[d] = ne(f) : l[d] = f;
280
+ }), Object.freeze(l);
281
+ }, r = /* @__PURE__ */ new WeakMap(), o = [1, 1], c = (i) => {
282
+ if (!pt(i))
283
+ throw new Error("object required");
284
+ const u = r.get(i);
285
+ if (u)
286
+ return u;
287
+ let a = o[0];
288
+ const l = /* @__PURE__ */ new Set(), d = (b, T = ++o[0]) => {
289
+ a !== T && (a = T, l.forEach((x) => x(b, T)));
290
+ };
291
+ let f = o[1];
292
+ const p = (b = ++o[1]) => (f !== b && !l.size && (f = b, m.forEach(([T]) => {
293
+ const x = T[1](b);
294
+ x > a && (a = x);
295
+ })), a), g = (b) => (T, x) => {
296
+ const M = [...T];
297
+ M[1] = [b, ...M[1]], d(M, x);
298
+ }, m = /* @__PURE__ */ new Map(), w = (b, T) => {
299
+ if (qe() && m.has(b))
300
+ throw new Error("prop listener already exists");
301
+ if (l.size) {
302
+ const x = T[3](g(b));
303
+ m.set(b, [T, x]);
304
+ } else
305
+ m.set(b, [T]);
306
+ }, v = (b) => {
307
+ var x;
308
+ const T = m.get(b);
309
+ T && (m.delete(b), (x = T[1]) == null || x.call(T));
310
+ }, O = (b) => (l.add(b), l.size === 1 && m.forEach(([x, M], Q) => {
311
+ if (qe() && M)
312
+ throw new Error("remove already exists");
313
+ const ee = x[3](g(Q));
314
+ m.set(Q, [x, ee]);
315
+ }), () => {
316
+ l.delete(b), l.size === 0 && m.forEach(([x, M], Q) => {
317
+ M && (M(), m.set(Q, [x]));
318
+ });
319
+ }), N = Array.isArray(i) ? [] : Object.create(Object.getPrototypeOf(i)), P = t(N, {
320
+ deleteProperty(b, T) {
321
+ const x = Reflect.get(b, T);
322
+ v(T);
323
+ const M = Reflect.deleteProperty(b, T);
324
+ return M && d(["delete", [T], x]), M;
325
+ },
326
+ set(b, T, x, M) {
327
+ var $t;
328
+ const Q = Reflect.has(b, T), ee = Reflect.get(b, T, M);
329
+ if (Q && (e(ee, x) || r.has(x) && e(ee, r.get(x))))
330
+ return !0;
331
+ v(T), pt(x) && (x = Gs(x) || x);
332
+ let Me = x;
333
+ if (!(($t = Object.getOwnPropertyDescriptor(b, T)) != null && $t.set)) {
334
+ !ae.has(x) && gt(x) && (Me = xt(x));
335
+ const Ht = !xe.has(Me) && ae.get(Me);
336
+ Ht && w(T, Ht);
337
+ }
338
+ return Reflect.set(b, T, Me, M), d(["set", [T], x, ee]), !0;
339
+ }
340
+ });
341
+ r.set(i, P);
342
+ const D = [N, p, s, O];
343
+ return ae.set(P, D), Reflect.ownKeys(i).forEach((b) => {
344
+ const T = Object.getOwnPropertyDescriptor(i, b);
345
+ T.get || T.set ? Object.defineProperty(N, b, T) : P[b] = i[b];
346
+ }), P;
347
+ }) => [
348
+ // public functions
349
+ c,
350
+ // shared state
351
+ ae,
352
+ xe,
353
+ // internal things
354
+ e,
355
+ t,
356
+ gt,
357
+ n,
358
+ s,
359
+ r,
360
+ o
361
+ ], [Xs] = Ys();
362
+ function xt(e = {}) {
363
+ return Xs(e);
364
+ }
365
+ function Ye(e, t, n) {
366
+ const s = ae.get(e);
367
+ qe() && !s && console.warn("Please use proxy object");
368
+ let r;
369
+ const o = [], c = s[3];
370
+ let i = !1;
371
+ const a = c((l) => {
372
+ if (o.push(l), n) {
373
+ t(o.splice(0));
374
+ return;
375
+ }
376
+ r || (r = Promise.resolve().then(() => {
377
+ r = void 0, i && t(o.splice(0));
378
+ }));
379
+ });
380
+ return i = !0, () => {
381
+ i = !1, a();
382
+ };
383
+ }
384
+ function ne(e) {
385
+ const t = ae.get(e);
386
+ qe() && !t && console.warn("Please use proxy object");
387
+ const [n, s, r] = t;
388
+ return r(n, s());
389
+ }
390
+ function De(e) {
391
+ return xe.add(e), e;
392
+ }
393
+ function Zs(e, t) {
394
+ Object.keys(t).forEach((r) => {
395
+ if (Object.getOwnPropertyDescriptor(e, r))
396
+ throw new Error("object property already defined");
397
+ const o = t[r], { get: c, set: i } = typeof o == "function" ? { get: o } : o, u = {};
398
+ u.get = () => c(ne(s)), i && (u.set = (a) => i(s, a)), Object.defineProperty(e, r, u);
399
+ });
400
+ const s = xt(e);
401
+ return s;
402
+ }
403
+ function Js(e) {
404
+ for (; e.length > 0; ) e.pop();
405
+ return e;
406
+ }
407
+ var zt = (e) => (e == null ? void 0 : e.constructor.name) === "Array", Qs = (e, t) => {
408
+ if (e.length !== t.length) return !1;
409
+ for (let n = 0; n < e.length; n++)
410
+ if (!Ot(e[n], t[n])) return !1;
411
+ return !0;
412
+ }, Ot = (e, t) => {
413
+ if (Object.is(e, t)) return !0;
414
+ if (e == null && t != null || e != null && t == null) return !1;
415
+ if (typeof (e == null ? void 0 : e.isEqual) == "function" && typeof (t == null ? void 0 : t.isEqual) == "function")
416
+ return e.isEqual(t);
417
+ if (typeof e == "function" && typeof t == "function")
418
+ return e.toString() === t.toString();
419
+ if (zt(e) && zt(t))
420
+ return Qs(Array.from(e), Array.from(t));
421
+ if (typeof e != "object" || typeof t != "object") return !1;
422
+ const n = Object.keys(t ?? /* @__PURE__ */ Object.create(null)), s = n.length;
423
+ for (let r = 0; r < s; r++)
424
+ if (!Reflect.has(e, n[r])) return !1;
425
+ for (let r = 0; r < s; r++) {
426
+ const o = n[r];
427
+ if (!Ot(e[o], t[o])) return !1;
428
+ }
429
+ return !0;
430
+ }, Oe = (e, ...t) => (typeof e == "function" ? e(...t) : e) ?? void 0, Z = (e) => e, er = () => {
431
+ }, mt = (...e) => (...t) => {
432
+ e.forEach(function(n) {
433
+ n == null || n(...t);
434
+ });
435
+ }, yt = /* @__PURE__ */ (() => {
436
+ let e = 0;
437
+ return () => (e++, e.toString(36));
438
+ })(), tr = () => process.env.NODE_ENV !== "production", Xe = (e) => Array.isArray(e), Sn = (e) => e != null && typeof e == "object", Ke = (e) => Sn(e) && !Xe(e), nr = (e) => typeof e == "number" && !Number.isNaN(e), G = (e) => typeof e == "string", ve = (e) => typeof e == "function", kn = (e, t) => Object.prototype.hasOwnProperty.call(e, t), sr = (e) => Object.prototype.toString.call(e), In = Function.prototype.toString, rr = In.call(Object), _e = (e) => {
439
+ if (!Sn(e) || sr(e) != "[object Object]") return !1;
440
+ const t = Object.getPrototypeOf(e);
441
+ if (t === null) return !0;
442
+ const n = kn(t, "constructor") && t.constructor;
443
+ return typeof n == "function" && n instanceof n && In.call(n) == rr;
444
+ };
445
+ function ue(e) {
446
+ if (!or(e) || e === void 0) return e;
447
+ const t = Reflect.ownKeys(e).filter((s) => typeof s == "string"), n = {};
448
+ for (const s of t) {
449
+ const r = e[s];
450
+ r !== void 0 && (n[s] = ue(r));
451
+ }
452
+ return n;
453
+ }
454
+ var or = (e) => e && typeof e == "object" && e.constructor === Object;
455
+ function me(...e) {
456
+ const t = e.length === 1 ? e[0] : e[1];
457
+ (e.length === 2 ? e[0] : !0) && process.env.NODE_ENV !== "production" && console.warn(t);
458
+ }
459
+ function We(...e) {
460
+ const t = e.length === 1 ? e[0] : e[1];
461
+ if ((e.length === 2 ? e[0] : !0) && process.env.NODE_ENV !== "production")
462
+ throw new Error(t);
463
+ }
464
+ var ir = Object.defineProperty, ar = (e, t, n) => t in e ? ir(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, y = (e, t, n) => ar(e, typeof t != "symbol" ? t + "" : t, n);
465
+ function Dn(e, ...t) {
466
+ if (!_e(e))
467
+ throw new TypeError("Source argument must be a plain object");
468
+ for (const n of t) {
469
+ if (!_e(n)) continue;
470
+ const s = ue(n);
471
+ for (const r in s) {
472
+ if (!Object.prototype.hasOwnProperty.call(s, r) || r === "__proto__" || r === "constructor" || r === "prototype") continue;
473
+ const o = e[r], c = n[r];
474
+ _e(c) ? e[r] = _e(o) ? Dn(o, c) : { ...c } : e[r] = c;
475
+ }
476
+ }
477
+ return e;
478
+ }
479
+ function q(e) {
480
+ return G(e) ? { type: e } : e;
481
+ }
482
+ function te(e) {
483
+ return e ? Xe(e) ? e.slice() : [e] : [];
484
+ }
485
+ function An(e) {
486
+ return Ke(e) && e.predicate != null;
487
+ }
488
+ var cr = () => !0;
489
+ function St(e, t, n, s) {
490
+ return (r) => {
491
+ var o;
492
+ return G(r) ? !!((o = e[r]) != null && o.call(e, t, n, s)) : ve(r) ? r(t, n, s) : r.predicate(e)(t, n, s);
493
+ };
494
+ }
495
+ function lr(...e) {
496
+ return {
497
+ predicate: (t) => (n, s, r) => e.map(St(t, n, s, r)).some(Boolean)
498
+ };
499
+ }
500
+ function ur(...e) {
501
+ return {
502
+ predicate: (t) => (n, s, r) => e.map(St(t, n, s, r)).every(Boolean)
503
+ };
504
+ }
505
+ function dr(e) {
506
+ return {
507
+ predicate: (t) => (n, s, r) => !St(t, n, s, r)(e)
508
+ };
509
+ }
510
+ var Rn = { or: lr, and: ur, not: dr };
511
+ function Ln(e, t) {
512
+ return e = e ?? cr, (n, s, r) => {
513
+ if (G(e)) {
514
+ const o = t[e];
515
+ return ve(o) ? o(n, s, r) : o;
516
+ }
517
+ return An(e) ? e.predicate(t)(n, s, r) : e == null ? void 0 : e(n, s, r);
518
+ };
519
+ }
520
+ function st(e, t) {
521
+ return (n, s, r) => An(e) ? e.predicate(t)(n, s, r) : e;
522
+ }
523
+ function fr(e) {
524
+ var o, c;
525
+ const t = e.computed ?? Z({}), n = e.context ?? Z({}), s = e.initial ? (c = (o = e.states) == null ? void 0 : o[e.initial]) == null ? void 0 : c.tags : [], r = xt({
526
+ value: e.initial ?? "",
527
+ previousValue: "",
528
+ event: Z({}),
529
+ previousEvent: Z({}),
530
+ context: Zs(n, t),
531
+ done: !1,
532
+ tags: s ?? [],
533
+ hasTag(i) {
534
+ return this.tags.includes(i);
535
+ },
536
+ matches(...i) {
537
+ return i.includes(this.value);
538
+ },
539
+ can(i) {
540
+ return Z(this).nextEvents.includes(i);
541
+ },
542
+ get nextEvents() {
543
+ var a, l;
544
+ const i = ((l = (a = e.states) == null ? void 0 : a[this.value]) == null ? void 0 : l.on) ?? {}, u = (e == null ? void 0 : e.on) ?? {};
545
+ return Object.keys({ ...i, ...u });
546
+ },
547
+ get changed() {
548
+ return this.event.value === "machine.init" || !this.previousValue ? !1 : this.value !== this.previousValue;
549
+ }
550
+ });
551
+ return Z(r);
552
+ }
553
+ function Ee(e, t) {
554
+ return (n, s) => {
555
+ if (nr(e)) return e;
556
+ if (ve(e))
557
+ return e(n, s);
558
+ if (G(e)) {
559
+ const r = Number.parseFloat(e);
560
+ if (!Number.isNaN(r))
561
+ return r;
562
+ if (t) {
563
+ const o = t == null ? void 0 : t[e];
564
+ return We(
565
+ o == null,
566
+ `[@zag-js/core > determine-delay] Cannot determine delay for \`${e}\`. It doesn't exist in \`options.delays\``
567
+ ), ve(o) ? o(n, s) : o;
568
+ }
569
+ }
570
+ };
571
+ }
572
+ function hr(e) {
573
+ return G(e) ? { target: e } : e;
574
+ }
575
+ function pr(e, t) {
576
+ return (n, s, r) => te(e).map(hr).find((o) => Ln(o.guard, t)(n, s, r) ?? o.target ?? o.actions);
577
+ }
578
+ var Fn = class {
579
+ // Let's get started!
580
+ constructor(e, t) {
581
+ var n, s, r, o, c;
582
+ y(
583
+ this,
584
+ "status",
585
+ "Not Started"
586
+ /* NotStarted */
587
+ ), y(this, "state"), y(this, "initialState"), y(this, "initialContext"), y(this, "id"), y(
588
+ this,
589
+ "type",
590
+ "machine"
591
+ /* Machine */
592
+ ), y(this, "activityEvents", /* @__PURE__ */ new Map()), y(this, "delayedEvents", /* @__PURE__ */ new Map()), y(this, "stateListeners", /* @__PURE__ */ new Set()), y(this, "doneListeners", /* @__PURE__ */ new Set()), y(this, "contextWatchers", /* @__PURE__ */ new Set()), y(this, "removeStateListener", er), y(this, "parent"), y(this, "children", /* @__PURE__ */ new Map()), y(this, "guardMap"), y(this, "actionMap"), y(this, "delayMap"), y(this, "activityMap"), y(this, "sync"), y(this, "options"), y(this, "config"), y(this, "_created", () => {
593
+ if (!this.config.created) return;
594
+ const i = q(
595
+ "machine.created"
596
+ /* Created */
597
+ );
598
+ this.executeActions(this.config.created, i);
599
+ }), y(this, "start", (i) => {
600
+ if (this.state.value = "", this.state.tags = [], this.status === "Running")
601
+ return this;
602
+ this.status = "Running", this.removeStateListener = Ye(
603
+ this.state,
604
+ () => {
605
+ this.stateListeners.forEach((p) => {
606
+ p(this.stateSnapshot);
607
+ });
608
+ },
609
+ this.sync
610
+ ), this.setupContextWatchers(), this.executeActivities(
611
+ q(
612
+ "machine.start"
613
+ /* Start */
614
+ ),
615
+ te(this.config.activities),
616
+ "machine.start"
617
+ /* Start */
618
+ ), this.executeActions(this.config.entry, q(
619
+ "machine.start"
620
+ /* Start */
621
+ ));
622
+ const u = q(
623
+ "machine.init"
624
+ /* Init */
625
+ ), a = Ke(i) ? i.value : i, l = Ke(i) ? i.context : void 0;
626
+ l && this.setContext(l);
627
+ const d = {
628
+ target: a ?? this.config.initial
629
+ }, f = this.getNextStateInfo(d, u);
630
+ return this.initialState = f, this.performStateChangeEffects(this.state.value, f, u), this;
631
+ }), y(this, "setupContextWatchers", () => {
632
+ const { watch: i } = this.config;
633
+ if (!i) return;
634
+ let u = ne(this.state.context);
635
+ const a = Ye(this.state.context, () => {
636
+ var d;
637
+ const l = ne(this.state.context);
638
+ for (const [f, p] of Object.entries(i))
639
+ (((d = this.options.compareFns) == null ? void 0 : d[f]) ?? Object.is)(u[f], l[f]) || this.executeActions(p, this.state.event);
640
+ u = l;
641
+ });
642
+ this.contextWatchers.add(a);
643
+ }), y(this, "stop", () => {
644
+ if (this.status !== "Stopped")
645
+ return this.performExitEffects(this.state.value, q(
646
+ "machine.stop"
647
+ /* Stop */
648
+ )), this.executeActions(this.config.exit, q(
649
+ "machine.stop"
650
+ /* Stop */
651
+ )), this.setState(""), this.setEvent(
652
+ "machine.stop"
653
+ /* Stop */
654
+ ), this.stopStateListeners(), this.stopChildren(), this.stopActivities(), this.stopDelayedEvents(), this.stopContextWatchers(), this.status = "Stopped", this;
655
+ }), y(this, "stopStateListeners", () => {
656
+ this.removeStateListener(), this.stateListeners.clear();
657
+ }), y(this, "stopContextWatchers", () => {
658
+ this.contextWatchers.forEach((i) => i()), this.contextWatchers.clear();
659
+ }), y(this, "stopDelayedEvents", () => {
660
+ this.delayedEvents.forEach((i) => {
661
+ i.forEach((u) => u());
662
+ }), this.delayedEvents.clear();
663
+ }), y(this, "stopActivities", (i) => {
664
+ var u, a;
665
+ i ? ((u = this.activityEvents.get(i)) == null || u.forEach((l) => l()), (a = this.activityEvents.get(i)) == null || a.clear(), this.activityEvents.delete(i)) : (this.activityEvents.forEach((l) => {
666
+ l.forEach((d) => d()), l.clear();
667
+ }), this.activityEvents.clear());
668
+ }), y(this, "sendChild", (i, u) => {
669
+ const a = q(i), l = Oe(u, this.contextSnapshot), d = this.children.get(l);
670
+ d || We(`[@zag-js/core] Cannot send '${a.type}' event to unknown child`), d.send(a);
671
+ }), y(this, "stopChild", (i) => {
672
+ this.children.has(i) || We(`[@zag-js/core > stop-child] Cannot stop unknown child ${i}`), this.children.get(i).stop(), this.children.delete(i);
673
+ }), y(this, "removeChild", (i) => {
674
+ this.children.delete(i);
675
+ }), y(this, "stopChildren", () => {
676
+ this.children.forEach((i) => i.stop()), this.children.clear();
677
+ }), y(this, "setParent", (i) => {
678
+ this.parent = i;
679
+ }), y(this, "spawn", (i, u) => {
680
+ const a = Oe(i);
681
+ return u && (a.id = u), a.type = "machine.actor", a.setParent(this), this.children.set(a.id, Z(a)), a.onDone(() => {
682
+ this.removeChild(a.id);
683
+ }).start(), Z(De(a));
684
+ }), y(this, "stopActivity", (i) => {
685
+ var a;
686
+ if (!this.state.value) return;
687
+ const u = this.activityEvents.get(this.state.value);
688
+ (a = u == null ? void 0 : u.get(i)) == null || a(), u == null || u.delete(i);
689
+ }), y(this, "addActivityCleanup", (i, u, a) => {
690
+ var l;
691
+ i && (this.activityEvents.has(i) ? (l = this.activityEvents.get(i)) == null || l.set(u, a) : this.activityEvents.set(i, /* @__PURE__ */ new Map([[u, a]])));
692
+ }), y(this, "setState", (i) => {
693
+ this.state.previousValue = this.state.value, this.state.value = i;
694
+ const u = this.getStateNode(i);
695
+ i == null ? Js(this.state.tags) : this.state.tags = te(u == null ? void 0 : u.tags);
696
+ }), y(this, "setContext", (i) => {
697
+ i && Dn(this.state.context, i);
698
+ }), y(this, "setOptions", (i) => {
699
+ const u = ue(i);
700
+ this.actionMap = { ...this.actionMap, ...u.actions }, this.delayMap = { ...this.delayMap, ...u.delays }, this.activityMap = { ...this.activityMap, ...u.activities }, this.guardMap = { ...this.guardMap, ...u.guards };
701
+ }), y(this, "getStateNode", (i) => {
702
+ var u;
703
+ if (i)
704
+ return (u = this.config.states) == null ? void 0 : u[i];
705
+ }), y(this, "getNextStateInfo", (i, u) => {
706
+ const a = this.determineTransition(i, u), l = !(a != null && a.target), d = (a == null ? void 0 : a.target) ?? this.state.value, f = this.state.value !== d, p = this.getStateNode(d), m = {
707
+ reenter: !l && !f && !(a != null && a.internal),
708
+ transition: a,
709
+ stateNode: p,
710
+ target: d,
711
+ changed: f
712
+ };
713
+ return this.log("NextState:", `[${u.type}]`, this.state.value, "---->", m.target), m;
714
+ }), y(this, "getAfterActions", (i, u) => {
715
+ let a;
716
+ const l = this.state.value;
717
+ return {
718
+ entry: () => {
719
+ a = globalThis.setTimeout(() => {
720
+ const d = this.getNextStateInfo(i, this.state.event);
721
+ this.performStateChangeEffects(l, d, this.state.event);
722
+ }, u);
723
+ },
724
+ exit: () => {
725
+ globalThis.clearTimeout(a);
726
+ }
727
+ };
728
+ }), y(this, "getDelayedEventActions", (i) => {
729
+ const u = this.getStateNode(i), a = this.state.event;
730
+ if (!u || !u.after) return;
731
+ const l = [], d = [];
732
+ if (Xe(u.after)) {
733
+ const f = this.determineTransition(u.after, a);
734
+ if (!f) return;
735
+ if (!kn(f, "delay"))
736
+ throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(f)}`);
737
+ const g = Ee(f.delay, this.delayMap)(this.contextSnapshot, a), m = this.getAfterActions(f, g);
738
+ return l.push(m.entry), d.push(m.exit), { entries: l, exits: d };
739
+ }
740
+ if (Ke(u.after))
741
+ for (const f in u.after) {
742
+ const p = u.after[f], m = Ee(f, this.delayMap)(this.contextSnapshot, a), w = this.getAfterActions(p, m);
743
+ l.push(w.entry), d.push(w.exit);
744
+ }
745
+ return { entries: l, exits: d };
746
+ }), y(this, "executeActions", (i, u) => {
747
+ var l;
748
+ const a = st(i, this.guardMap)(this.contextSnapshot, u, this.guardMeta);
749
+ for (const d of te(a)) {
750
+ const f = G(d) ? (l = this.actionMap) == null ? void 0 : l[d] : d;
751
+ me(
752
+ G(d) && !f,
753
+ `[@zag-js/core > execute-actions] No implementation found for action: \`${d}\``
754
+ ), f == null || f(this.state.context, u, this.meta);
755
+ }
756
+ }), y(this, "executeActivities", (i, u, a) => {
757
+ var l;
758
+ for (const d of u) {
759
+ const f = G(d) ? (l = this.activityMap) == null ? void 0 : l[d] : d;
760
+ if (!f) {
761
+ me(`[@zag-js/core > execute-activity] No implementation found for activity: \`${d}\``);
762
+ continue;
763
+ }
764
+ const p = f(this.state.context, i, this.meta);
765
+ if (p) {
766
+ const g = G(d) ? d : d.name || yt();
767
+ this.addActivityCleanup(a ?? this.state.value, g, p);
768
+ }
769
+ }
770
+ }), y(this, "createEveryActivities", (i, u) => {
771
+ if (i)
772
+ if (Xe(i)) {
773
+ const a = te(i).find((p) => {
774
+ const g = p.delay, w = Ee(g, this.delayMap)(this.contextSnapshot, this.state.event);
775
+ return Ln(p.guard, this.guardMap)(this.contextSnapshot, this.state.event, this.guardMeta) ?? w != null;
776
+ });
777
+ if (!a) return;
778
+ const d = Ee(a.delay, this.delayMap)(this.contextSnapshot, this.state.event);
779
+ u(() => {
780
+ const p = globalThis.setInterval(() => {
781
+ this.executeActions(a.actions, this.state.event);
782
+ }, d);
783
+ return () => {
784
+ globalThis.clearInterval(p);
785
+ };
786
+ });
787
+ } else
788
+ for (const a in i) {
789
+ const l = i == null ? void 0 : i[a], f = Ee(a, this.delayMap)(this.contextSnapshot, this.state.event);
790
+ u(() => {
791
+ const g = globalThis.setInterval(() => {
792
+ this.executeActions(l, this.state.event);
793
+ }, f);
794
+ return () => {
795
+ globalThis.clearInterval(g);
796
+ };
797
+ });
798
+ }
799
+ }), y(this, "setEvent", (i) => {
800
+ this.state.previousEvent = this.state.event, this.state.event = De(q(i));
801
+ }), y(this, "performExitEffects", (i, u) => {
802
+ const a = this.state.value;
803
+ if (a === "") return;
804
+ const l = i ? this.getStateNode(i) : void 0;
805
+ this.stopActivities(a);
806
+ const d = st(l == null ? void 0 : l.exit, this.guardMap)(this.contextSnapshot, u, this.guardMeta), f = te(d), p = this.delayedEvents.get(a);
807
+ p && f.push(...p), this.executeActions(f, u), this.delayedEvents.delete(a);
808
+ }), y(this, "performEntryEffects", (i, u) => {
809
+ const a = this.getStateNode(i), l = te(a == null ? void 0 : a.activities);
810
+ this.createEveryActivities(a == null ? void 0 : a.every, (g) => {
811
+ l.unshift(g);
812
+ }), l.length > 0 && this.executeActivities(u, l);
813
+ const d = st(a == null ? void 0 : a.entry, this.guardMap)(
814
+ this.contextSnapshot,
815
+ u,
816
+ this.guardMeta
817
+ ), f = te(d), p = this.getDelayedEventActions(i);
818
+ a != null && a.after && p && (this.delayedEvents.set(i, p == null ? void 0 : p.exits), f.push(...p.entries)), this.executeActions(f, u), (a == null ? void 0 : a.type) === "final" && (this.state.done = !0, this.doneListeners.forEach((g) => {
819
+ g(this.stateSnapshot);
820
+ }), this.stop());
821
+ }), y(this, "performTransitionEffects", (i, u) => {
822
+ const a = this.determineTransition(i, u);
823
+ this.executeActions(a == null ? void 0 : a.actions, u);
824
+ }), y(this, "performStateChangeEffects", (i, u, a) => {
825
+ this.setEvent(a);
826
+ const l = u.changed || u.reenter;
827
+ l && this.performExitEffects(i, a), this.performTransitionEffects(u.transition, a), this.setState(u.target), l && this.performEntryEffects(u.target, a);
828
+ }), y(this, "determineTransition", (i, u) => {
829
+ const a = pr(i, this.guardMap);
830
+ return a == null ? void 0 : a(this.contextSnapshot, u, this.guardMeta);
831
+ }), y(this, "sendParent", (i) => {
832
+ var a;
833
+ this.parent || We("[@zag-js/core > send-parent] Cannot send event to an unknown parent");
834
+ const u = q(i);
835
+ (a = this.parent) == null || a.send(u);
836
+ }), y(this, "log", (...i) => {
837
+ tr() && this.options.debug && console.log(...i);
838
+ }), y(this, "send", (i) => {
839
+ const u = q(i);
840
+ this.transition(this.state.value, u);
841
+ }), y(this, "transition", (i, u) => {
842
+ var p, g;
843
+ const a = G(i) ? this.getStateNode(i) : i == null ? void 0 : i.stateNode, l = q(u);
844
+ if (!a && !this.config.on) {
845
+ const m = this.status === "Stopped" ? "[@zag-js/core > transition] Cannot transition a stopped machine" : `[@zag-js/core > transition] State does not have a definition for \`state\`: ${i}, \`event\`: ${l.type}`;
846
+ me(m);
847
+ return;
848
+ }
849
+ const d = (
850
+ // @ts-expect-error - Fix this
851
+ ((p = a == null ? void 0 : a.on) == null ? void 0 : p[l.type]) ?? ((g = this.config.on) == null ? void 0 : g[l.type])
852
+ ), f = this.getNextStateInfo(d, l);
853
+ return this.performStateChangeEffects(this.state.value, f, l), f.stateNode;
854
+ }), y(this, "subscribe", (i) => (this.stateListeners.add(i), this.status === "Running" && i(this.stateSnapshot), () => {
855
+ this.stateListeners.delete(i);
856
+ })), y(this, "onDone", (i) => (this.doneListeners.add(i), this)), y(this, "onTransition", (i) => (this.stateListeners.add(i), this.status === "Running" && i(this.stateSnapshot), this)), this.config = ce(e), this.options = ce(t ?? {}), this.id = this.config.id ?? `machine-${yt()}`, this.guardMap = ((n = this.options) == null ? void 0 : n.guards) ?? {}, this.actionMap = ((s = this.options) == null ? void 0 : s.actions) ?? {}, this.delayMap = ((r = this.options) == null ? void 0 : r.delays) ?? {}, this.activityMap = ((o = this.options) == null ? void 0 : o.activities) ?? {}, this.sync = ((c = this.options) == null ? void 0 : c.sync) ?? !1, this.state = fr(this.config), this.initialContext = ne(this.state.context);
857
+ }
858
+ // immutable state value
859
+ get stateSnapshot() {
860
+ return Z(ne(this.state));
861
+ }
862
+ getState() {
863
+ return this.stateSnapshot;
864
+ }
865
+ // immutable context value
866
+ get contextSnapshot() {
867
+ return this.stateSnapshot.context;
868
+ }
869
+ /**
870
+ * A reference to the instance methods of the machine.
871
+ * Useful when spawning child machines and managing the communication between them.
872
+ */
873
+ get self() {
874
+ const e = this;
875
+ return {
876
+ id: this.id,
877
+ send: this.send.bind(this),
878
+ sendParent: this.sendParent.bind(this),
879
+ sendChild: this.sendChild.bind(this),
880
+ stop: this.stop.bind(this),
881
+ stopChild: this.stopChild.bind(this),
882
+ spawn: this.spawn.bind(this),
883
+ stopActivity: this.stopActivity.bind(this),
884
+ get state() {
885
+ return e.stateSnapshot;
886
+ },
887
+ get initialContext() {
888
+ return e.initialContext;
889
+ },
890
+ get initialState() {
891
+ var t;
892
+ return ((t = e.initialState) == null ? void 0 : t.target) ?? "";
893
+ }
894
+ };
895
+ }
896
+ get meta() {
897
+ var e;
898
+ return {
899
+ state: this.stateSnapshot,
900
+ guards: this.guardMap,
901
+ send: this.send.bind(this),
902
+ self: this.self,
903
+ initialContext: this.initialContext,
904
+ initialState: ((e = this.initialState) == null ? void 0 : e.target) ?? "",
905
+ getState: () => this.stateSnapshot,
906
+ getAction: (t) => this.actionMap[t],
907
+ getGuard: (t) => this.guardMap[t]
908
+ };
909
+ }
910
+ get guardMeta() {
911
+ return {
912
+ state: this.stateSnapshot
913
+ };
914
+ }
915
+ get [Symbol.toStringTag]() {
916
+ return "Machine";
917
+ }
918
+ getHydrationState() {
919
+ const e = this.getState();
920
+ return {
921
+ value: e.value,
922
+ tags: e.tags
923
+ };
924
+ }
925
+ }, Re = (e, t) => new Fn(e, t), gr = (e) => e instanceof Fn || (e == null ? void 0 : e.type) === "machine", mr = (...e) => e.map((t) => {
926
+ var n;
927
+ return (n = t == null ? void 0 : t.trim) == null ? void 0 : n.call(t);
928
+ }).filter(Boolean).join(" "), yr = /((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g, qt = (e) => {
929
+ const t = {};
930
+ let n;
931
+ for (; n = yr.exec(e); )
932
+ t[n[1]] = n[2];
933
+ return t;
934
+ }, vr = (e, t) => {
935
+ if (G(e)) {
936
+ if (G(t)) return `${e};${t}`;
937
+ e = qt(e);
938
+ } else G(t) && (t = qt(t));
939
+ return Object.assign({}, e ?? {}, t ?? {});
940
+ };
941
+ function k(...e) {
942
+ let t = {};
943
+ for (let n of e) {
944
+ for (let s in t) {
945
+ if (s.startsWith("on") && typeof t[s] == "function" && typeof n[s] == "function") {
946
+ t[s] = mt(n[s], t[s]);
947
+ continue;
948
+ }
949
+ if (s === "className" || s === "class") {
950
+ t[s] = mr(t[s], n[s]);
951
+ continue;
952
+ }
953
+ if (s === "style") {
954
+ t[s] = vr(t[s], n[s]);
955
+ continue;
956
+ }
957
+ t[s] = n[s] !== void 0 ? n[s] : t[s];
958
+ }
959
+ for (let s in n)
960
+ t[s] === void 0 && (t[s] = n[s]);
961
+ }
962
+ return t;
963
+ }
964
+ function br(e) {
965
+ return new Proxy({}, {
966
+ get() {
967
+ return e;
968
+ }
969
+ });
970
+ }
971
+ var kt = () => (e) => Array.from(new Set(e)), Le = br((e) => e), Yt = (e) => (e == null ? void 0 : e.constructor.name) === "Array", Er = (e, t) => {
972
+ if (e.length !== t.length) return !1;
973
+ for (let n = 0; n < e.length; n++)
974
+ if (!It(e[n], t[n])) return !1;
975
+ return !0;
976
+ }, It = (e, t) => {
977
+ if (Object.is(e, t)) return !0;
978
+ if (e == null && t != null || e != null && t == null) return !1;
979
+ if (typeof (e == null ? void 0 : e.isEqual) == "function" && typeof (t == null ? void 0 : t.isEqual) == "function")
980
+ return e.isEqual(t);
981
+ if (typeof e == "function" && typeof t == "function")
982
+ return e.toString() === t.toString();
983
+ if (Yt(e) && Yt(t))
984
+ return Er(Array.from(e), Array.from(t));
985
+ if (typeof e != "object" || typeof t != "object") return !1;
986
+ const n = Object.keys(t ?? /* @__PURE__ */ Object.create(null)), s = n.length;
987
+ for (let r = 0; r < s; r++)
988
+ if (!Reflect.has(e, n[r])) return !1;
989
+ for (let r = 0; r < s; r++) {
990
+ const o = n[r];
991
+ if (!It(e[o], t[o])) return !1;
992
+ }
993
+ return !0;
994
+ }, Tr = () => process.env.NODE_ENV !== "production", Nr = Function.prototype.toString;
995
+ Nr.call(Object);
996
+ function Mn(e) {
997
+ if (!Cr(e) || e === void 0) return e;
998
+ const t = Reflect.ownKeys(e).filter((s) => typeof s == "string"), n = {};
999
+ for (const s of t) {
1000
+ const r = e[s];
1001
+ r !== void 0 && (n[s] = Mn(r));
1002
+ }
1003
+ return n;
1004
+ }
1005
+ var Cr = (e) => e && typeof e == "object" && e.constructor === Object;
1006
+ function wr(e, t) {
1007
+ const n = re(!1), s = re(!1);
1008
+ Ie(() => {
1009
+ if (n.current && s.current)
1010
+ return e();
1011
+ s.current = !0;
1012
+ }, t), Ie(() => (n.current = !0, () => {
1013
+ n.current = !1;
1014
+ }), []);
1015
+ }
1016
+ var Pr = Pt("__zag__targetCache", () => /* @__PURE__ */ new WeakMap());
1017
+ function _n(e, t) {
1018
+ const { actions: n, context: s, sync: r } = t ?? {}, o = re(void 0), c = re(void 0), i = hn(
1019
+ pn((d) => Ye(e.state, d, r), [r]),
1020
+ () => {
1021
+ const d = ne(e.state);
1022
+ try {
1023
+ if (o.current && c.current && !On(o.current, d, c.current, /* @__PURE__ */ new WeakMap()))
1024
+ return o.current;
1025
+ } catch {
1026
+ }
1027
+ return d;
1028
+ },
1029
+ () => ne(e.state)
1030
+ );
1031
+ e.setOptions({ actions: n });
1032
+ const u = ze(() => Mn(s ?? {}), [s]);
1033
+ wr(() => {
1034
+ const d = Object.entries(u), f = e.contextSnapshot ?? {};
1035
+ d.map(([m, w]) => ({
1036
+ key: m,
1037
+ curr: w,
1038
+ prev: f[m],
1039
+ equal: It(f[m], w)
1040
+ })).every(({ equal: m }) => m) || e.setContext(u);
1041
+ }, [u]);
1042
+ const a = /* @__PURE__ */ new WeakMap();
1043
+ Ie(() => {
1044
+ o.current = i, c.current = a;
1045
+ });
1046
+ const l = ze(() => /* @__PURE__ */ new WeakMap(), []);
1047
+ return xn(i, a, l, Pr);
1048
+ }
1049
+ function xr(e) {
1050
+ return [_n(e), e.send];
1051
+ }
1052
+ function Or(e) {
1053
+ const t = re(void 0);
1054
+ return t.current || (t.current = { v: e() }), t.current.v;
1055
+ }
1056
+ var Sr = typeof document < "u" ? Ns : Ie;
1057
+ function kr(e, t) {
1058
+ const { state: n, context: s } = t ?? {}, r = Or(() => {
1059
+ const c = typeof e == "function" ? e() : e;
1060
+ return s && c.setContext(s), c._created(), c;
1061
+ }), o = re(void 0);
1062
+ return Sr(() => {
1063
+ const c = n ?? o.current;
1064
+ return r.start(c), () => {
1065
+ Tr() && (o.current = r.getHydrationState()), r.stop();
1066
+ };
1067
+ }, []), r;
1068
+ }
1069
+ function et(e, t) {
1070
+ const n = kr(e, t);
1071
+ return [_n(n, t), n.send, n];
1072
+ }
1073
+ function Ir(e, t) {
1074
+ typeof e == "function" ? e(t) : e != null && (e.current = t);
1075
+ }
1076
+ function Dt(...e) {
1077
+ return (t) => {
1078
+ for (const n of e)
1079
+ Ir(n, t);
1080
+ };
1081
+ }
1082
+ function Dr(e) {
1083
+ var s, r;
1084
+ let t = (s = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : s.get, n = t && "isReactWarning" in t && t.isReactWarning;
1085
+ return n ? e.ref : (t = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
1086
+ }
1087
+ const rt = (e) => {
1088
+ const t = Cs(
1089
+ R((n, s) => {
1090
+ const { asChild: r, children: o, ...c } = n;
1091
+ if (!r)
1092
+ return ws(e, { ...c, ref: s }, o);
1093
+ const i = gn.only(o);
1094
+ if (!Ps(i))
1095
+ return null;
1096
+ const u = Dr(i);
1097
+ return xs(i, {
1098
+ ...k(c, i.props),
1099
+ ref: s ? Dt(s, u) : u
1100
+ });
1101
+ })
1102
+ );
1103
+ return t.displayName = e.displayName || e.name, t;
1104
+ }, Ar = () => {
1105
+ const e = /* @__PURE__ */ new Map();
1106
+ return new Proxy(rt, {
1107
+ apply(t, n, s) {
1108
+ return rt(s[0]);
1109
+ },
1110
+ get(t, n) {
1111
+ const s = n;
1112
+ return e.has(s) || e.set(s, rt(s)), e.get(s);
1113
+ }
1114
+ });
1115
+ }, F = Ar(), Bn = R((e, t) => {
1116
+ const n = Qe(), s = k(n.getControlProps(), e);
1117
+ return /* @__PURE__ */ h(F.div, { ...s, ref: t });
1118
+ });
1119
+ Bn.displayName = "CheckboxControl";
1120
+ const At = () => (e, t) => t.reduce(
1121
+ (n, s) => {
1122
+ const [r, o] = n, c = s;
1123
+ return o[c] !== void 0 && (r[c] = o[c]), delete o[c], [r, o];
1124
+ },
1125
+ [{}, { ...e }]
1126
+ );
1127
+ var ye = (e, t = []) => ({
1128
+ parts: (...n) => {
1129
+ if (Rr(t))
1130
+ return ye(e, n);
1131
+ throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?");
1132
+ },
1133
+ extendWith: (...n) => ye(e, [...t, ...n]),
1134
+ rename: (n) => ye(n, t),
1135
+ keys: () => t,
1136
+ build: () => [...new Set(t)].reduce(
1137
+ (n, s) => Object.assign(n, {
1138
+ [s]: {
1139
+ selector: [
1140
+ `&[data-scope="${he(e)}"][data-part="${he(s)}"]`,
1141
+ `& [data-scope="${he(e)}"][data-part="${he(s)}"]`
1142
+ ].join(", "),
1143
+ attrs: { "data-scope": he(e), "data-part": he(s) }
1144
+ }
1145
+ }),
1146
+ {}
1147
+ )
1148
+ }), he = (e) => e.replace(/([A-Z])([A-Z])/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(), Rr = (e) => e.length === 0, ot = (...e) => (t) => e.reduce((n, s) => s(n), t), Be = () => {
1149
+ }, tt = (e) => typeof e == "object" && e !== null, Lr = 2147483647, j = (e) => e ? "" : void 0, Fr = 1, Mr = 9, _r = 11, $ = (e) => tt(e) && e.nodeType === Fr && typeof e.nodeName == "string", Rt = (e) => tt(e) && e.nodeType === Mr, Br = (e) => tt(e) && e === e.window, $n = (e) => $(e) ? e.localName || "" : "#document";
1150
+ function $r(e) {
1151
+ return ["html", "body", "#document"].includes($n(e));
1152
+ }
1153
+ var Hr = (e) => tt(e) && e.nodeType !== void 0, Ae = (e) => Hr(e) && e.nodeType === _r && "host" in e, jr = (e) => $(e) && e.localName === "input", Vr = (e) => $(e) ? e.offsetWidth > 0 || e.offsetHeight > 0 || e.getClientRects().length > 0 : !1, Gr = /(textarea|select)/;
1154
+ function Ur(e) {
1155
+ if (e == null || !$(e)) return !1;
1156
+ try {
1157
+ return jr(e) && e.selectionStart != null || Gr.test(e.localName) || e.isContentEditable || e.getAttribute("contenteditable") === "true" || e.getAttribute("contenteditable") === "";
1158
+ } catch {
1159
+ return !1;
1160
+ }
1161
+ }
1162
+ function be(e, t) {
1163
+ var s;
1164
+ if (!e || !t || !$(e) || !$(t)) return !1;
1165
+ const n = (s = t.getRootNode) == null ? void 0 : s.call(t);
1166
+ if (e === t || e.contains(t)) return !0;
1167
+ if (n && Ae(n)) {
1168
+ let r = t;
1169
+ for (; r; ) {
1170
+ if (e === r) return !0;
1171
+ r = r.parentNode || r.host;
1172
+ }
1173
+ }
1174
+ return !1;
1175
+ }
1176
+ function K(e) {
1177
+ return Rt(e) ? e : Br(e) ? e.document : (e == null ? void 0 : e.ownerDocument) ?? document;
1178
+ }
1179
+ function Kr(e) {
1180
+ return K(e).documentElement;
1181
+ }
1182
+ function U(e) {
1183
+ var t;
1184
+ return Ae(e) ? U(e.host) : Rt(e) ? e.defaultView ?? window : $(e) ? ((t = e.ownerDocument) == null ? void 0 : t.defaultView) ?? window : window;
1185
+ }
1186
+ function Hn(e) {
1187
+ let t = e.activeElement;
1188
+ for (; t != null && t.shadowRoot; ) {
1189
+ const n = t.shadowRoot.activeElement;
1190
+ if (n === t) break;
1191
+ t = n;
1192
+ }
1193
+ return t;
1194
+ }
1195
+ function Wr(e) {
1196
+ if ($n(e) === "html") return e;
1197
+ const t = e.assignedSlot || e.parentNode || Ae(e) && e.host || Kr(e);
1198
+ return Ae(t) ? t.host : t;
1199
+ }
1200
+ var it = /* @__PURE__ */ new WeakMap();
1201
+ function zr(e) {
1202
+ return it.has(e) || it.set(e, U(e).getComputedStyle(e)), it.get(e);
1203
+ }
1204
+ var qr = () => typeof document < "u";
1205
+ function Yr() {
1206
+ const e = navigator.userAgentData;
1207
+ return (e == null ? void 0 : e.platform) ?? navigator.platform;
1208
+ }
1209
+ var jn = (e) => qr() && e.test(Yr()), Vn = () => jn(/^Mac/), Xr = () => jn(/iP(hone|ad|od)|iOS/);
1210
+ function Zr(e) {
1211
+ var t, n, s;
1212
+ return ((t = e.composedPath) == null ? void 0 : t.call(e)) ?? ((s = (n = e.nativeEvent) == null ? void 0 : n.composedPath) == null ? void 0 : s.call(n));
1213
+ }
1214
+ function z(e) {
1215
+ const t = Zr(e);
1216
+ return (t == null ? void 0 : t[0]) ?? e.target;
1217
+ }
1218
+ var Jr = (e) => e.button === 2 || Vn() && e.ctrlKey && e.button === 0, Qr = (e) => "touches" in e && e.touches.length > 0;
1219
+ function eo(e, t = "client") {
1220
+ const n = Qr(e) ? e.touches[0] || e.changedTouches[0] : e;
1221
+ return { x: n[`${t}X`], y: n[`${t}Y`] };
1222
+ }
1223
+ var A = (e, t, n, s) => {
1224
+ const r = typeof e == "function" ? e() : e;
1225
+ return r == null || r.addEventListener(t, n, s), () => {
1226
+ r == null || r.removeEventListener(t, n, s);
1227
+ };
1228
+ };
1229
+ function Gn(e, t) {
1230
+ const { type: n = "HTMLInputElement", property: s = "value" } = t, r = U(e)[n].prototype;
1231
+ return Object.getOwnPropertyDescriptor(r, s) ?? {};
1232
+ }
1233
+ function to(e) {
1234
+ if (e.localName === "input") return "HTMLInputElement";
1235
+ if (e.localName === "textarea") return "HTMLTextAreaElement";
1236
+ if (e.localName === "select") return "HTMLSelectElement";
1237
+ }
1238
+ function no(e, t, n = "value") {
1239
+ var r;
1240
+ const s = to(e);
1241
+ s && ((r = Gn(e, { type: s, property: n }).set) == null || r.call(e, t)), e.setAttribute(n, t);
1242
+ }
1243
+ function Un(e, t) {
1244
+ var s;
1245
+ (s = Gn(e, { type: "HTMLInputElement", property: "checked" }).set) == null || s.call(e, t), t ? e.setAttribute("checked", "") : e.removeAttribute("checked");
1246
+ }
1247
+ function so(e, t) {
1248
+ const { checked: n, bubbles: s = !0 } = t;
1249
+ if (!e) return;
1250
+ const r = U(e);
1251
+ e instanceof r.HTMLInputElement && (Un(e, n), e.dispatchEvent(new r.Event("click", { bubbles: s })));
1252
+ }
1253
+ function ro(e) {
1254
+ return oo(e) ? e.form : e.closest("form");
1255
+ }
1256
+ function oo(e) {
1257
+ return e.matches("textarea, input, select, button");
1258
+ }
1259
+ function io(e, t) {
1260
+ if (!e) return;
1261
+ const n = ro(e), s = (r) => {
1262
+ r.defaultPrevented || t();
1263
+ };
1264
+ return n == null || n.addEventListener("reset", s, { passive: !0 }), () => n == null ? void 0 : n.removeEventListener("reset", s);
1265
+ }
1266
+ function ao(e, t) {
1267
+ const n = e == null ? void 0 : e.closest("fieldset");
1268
+ if (!n) return;
1269
+ t(n.disabled);
1270
+ const s = U(n), r = new s.MutationObserver(() => t(n.disabled));
1271
+ return r.observe(n, {
1272
+ attributes: !0,
1273
+ attributeFilter: ["disabled"]
1274
+ }), () => r.disconnect();
1275
+ }
1276
+ function co(e, t) {
1277
+ if (!e) return;
1278
+ const { onFieldsetDisabledChange: n, onFormReset: s } = t, r = [io(e, s), ao(e, n)];
1279
+ return () => r.forEach((o) => o == null ? void 0 : o());
1280
+ }
1281
+ var Kn = (e) => $(e) && e.tagName === "IFRAME", lo = (e) => !Number.isNaN(parseInt(e.getAttribute("tabindex") || "0", 10)), uo = (e) => parseInt(e.getAttribute("tabindex") || "0", 10) < 0, Lt = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type", Wn = (e, t = !1) => {
1282
+ if (!e) return [];
1283
+ const n = Array.from(e.querySelectorAll(Lt));
1284
+ (t == !0 || t == "if-empty" && n.length === 0) && $(e) && se(e) && n.unshift(e);
1285
+ const r = n.filter(se);
1286
+ return r.forEach((o, c) => {
1287
+ if (Kn(o) && o.contentDocument) {
1288
+ const i = o.contentDocument.body;
1289
+ r.splice(c, 1, ...Wn(i));
1290
+ }
1291
+ }), r;
1292
+ };
1293
+ function se(e) {
1294
+ return !e || e.closest("[inert]") ? !1 : e.matches(Lt) && Vr(e);
1295
+ }
1296
+ function zn(e, t) {
1297
+ if (!e) return [];
1298
+ const s = Array.from(e.querySelectorAll(Lt)).filter(ie);
1299
+ return s.forEach((r, o) => {
1300
+ if (Kn(r) && r.contentDocument) {
1301
+ const c = r.contentDocument.body, i = zn(c);
1302
+ s.splice(o, 1, ...i);
1303
+ }
1304
+ }), s.length, s;
1305
+ }
1306
+ function ie(e) {
1307
+ return e != null && e.tabIndex > 0 ? !0 : se(e) && !uo(e);
1308
+ }
1309
+ function Te(e) {
1310
+ return e.tabIndex < 0 && (/^(audio|video|details)$/.test(e.localName) || Ur(e)) && !lo(e) ? 0 : e.tabIndex;
1311
+ }
1312
+ function Y(e) {
1313
+ const t = globalThis.requestAnimationFrame(e);
1314
+ return () => {
1315
+ globalThis.cancelAnimationFrame(t);
1316
+ };
1317
+ }
1318
+ function vt(e) {
1319
+ const t = Wr(e);
1320
+ return $r(t) ? K(t).body : $(t) && ho(t) ? t : vt(t);
1321
+ }
1322
+ var fo = /auto|scroll|overlay|hidden|clip/;
1323
+ function ho(e) {
1324
+ const t = U(e), { overflow: n, overflowX: s, overflowY: r, display: o } = t.getComputedStyle(e);
1325
+ return fo.test(n + r + s) && !["inline", "contents"].includes(o);
1326
+ }
1327
+ function po(e) {
1328
+ const {
1329
+ pointerNode: t,
1330
+ keyboardNode: n = t,
1331
+ onPress: s,
1332
+ onPressStart: r,
1333
+ onPressEnd: o,
1334
+ isValidKey: c = (N) => N.key === "Enter"
1335
+ } = e;
1336
+ if (!t) return Be;
1337
+ const i = U(t), u = K(t);
1338
+ let a = Be, l = Be, d = Be;
1339
+ const f = (N) => ({
1340
+ point: eo(N),
1341
+ event: N
1342
+ });
1343
+ function p(N) {
1344
+ r == null || r(f(N));
1345
+ }
1346
+ function g(N) {
1347
+ o == null || o(f(N));
1348
+ }
1349
+ const w = A(t, "pointerdown", (N) => {
1350
+ l();
1351
+ const P = A(i, "pointerup", (b) => {
1352
+ const T = z(b);
1353
+ be(t, T) ? s == null || s(f(b)) : o == null || o(f(b));
1354
+ }, { passive: !s }), D = A(i, "pointercancel", g, { passive: !o });
1355
+ l = ot(P, D), u.activeElement === n && N.pointerType === "mouse" && N.preventDefault(), p(N);
1356
+ }, { passive: !r }), v = A(n, "focus", O);
1357
+ a = ot(w, v);
1358
+ function O() {
1359
+ const N = (b) => {
1360
+ if (!c(b)) return;
1361
+ const T = (M) => {
1362
+ if (!c(M)) return;
1363
+ const Q = new i.PointerEvent("pointerup"), ee = f(Q);
1364
+ s == null || s(ee), o == null || o(ee);
1365
+ };
1366
+ l(), l = A(n, "keyup", T);
1367
+ const x = new i.PointerEvent("pointerdown");
1368
+ p(x);
1369
+ }, X = () => {
1370
+ const b = new i.PointerEvent("pointercancel");
1371
+ g(b);
1372
+ }, P = A(n, "keydown", N), D = A(n, "blur", X);
1373
+ d = ot(P, D);
1374
+ }
1375
+ return () => {
1376
+ a(), l(), d();
1377
+ };
1378
+ }
1379
+ function go(e, t) {
1380
+ return Array.from((e == null ? void 0 : e.querySelectorAll(t)) ?? []);
1381
+ }
1382
+ function Ft(e) {
1383
+ const t = {
1384
+ getRootNode: (n) => {
1385
+ var s;
1386
+ return ((s = n.getRootNode) == null ? void 0 : s.call(n)) ?? document;
1387
+ },
1388
+ getDoc: (n) => K(t.getRootNode(n)),
1389
+ getWin: (n) => t.getDoc(n).defaultView ?? window,
1390
+ getActiveElement: (n) => Hn(t.getRootNode(n)),
1391
+ isActiveElement: (n, s) => s === t.getActiveElement(n),
1392
+ getById: (n, s) => t.getRootNode(n).getElementById(s),
1393
+ setValue: (n, s) => {
1394
+ n == null || s == null || no(n, s.toString());
1395
+ }
1396
+ };
1397
+ return { ...t, ...e };
1398
+ }
1399
+ var at = /* @__PURE__ */ new WeakMap();
1400
+ function mo(e, t, n) {
1401
+ at.has(e) || at.set(e, /* @__PURE__ */ new Map());
1402
+ const s = at.get(e), r = s.get(t);
1403
+ if (!r)
1404
+ return s.set(t, n()), () => {
1405
+ var i;
1406
+ (i = s.get(t)) == null || i(), s.delete(t);
1407
+ };
1408
+ const o = n(), c = () => {
1409
+ o(), r(), s.delete(t);
1410
+ };
1411
+ return s.set(t, c), () => {
1412
+ s.get(t) === c && (o(), s.set(t, r));
1413
+ };
1414
+ }
1415
+ function yo(e, t) {
1416
+ return e ? mo(e, "style", () => {
1417
+ const s = e.style.cssText;
1418
+ return Object.assign(e.style, t), () => {
1419
+ e.style.cssText = s;
1420
+ };
1421
+ }) : () => {
1422
+ };
1423
+ }
1424
+ var vo = {
1425
+ border: "0",
1426
+ clip: "rect(0 0 0 0)",
1427
+ height: "1px",
1428
+ margin: "-1px",
1429
+ overflow: "hidden",
1430
+ padding: "0",
1431
+ position: "absolute",
1432
+ width: "1px",
1433
+ whiteSpace: "nowrap",
1434
+ wordWrap: "normal"
1435
+ }, bo = 1e3 / 60;
1436
+ function Eo(e, t) {
1437
+ const n = e();
1438
+ if ($(n) && n.isConnected)
1439
+ return t(n), () => {
1440
+ };
1441
+ {
1442
+ const s = setInterval(() => {
1443
+ const r = e();
1444
+ $(r) && r.isConnected && (t(r), clearInterval(s));
1445
+ }, bo);
1446
+ return () => clearInterval(s);
1447
+ }
1448
+ }
1449
+ function To(e, t) {
1450
+ const n = [];
1451
+ return e == null || e.forEach((s) => {
1452
+ const r = Eo(s, t);
1453
+ n.push(r);
1454
+ }), () => {
1455
+ n.forEach((s) => s());
1456
+ };
1457
+ }
1458
+ function No(e) {
1459
+ return e.mozInputSource === 0 && e.isTrusted ? !0 : e.detail === 0 && !e.pointerType;
1460
+ }
1461
+ function Co(e) {
1462
+ return !(e.metaKey || !Vn() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
1463
+ }
1464
+ var wo = /* @__PURE__ */ new Set(["checkbox", "radio", "range", "color", "file", "image", "button", "submit", "reset"]);
1465
+ function Po(e, t, n) {
1466
+ const s = n ? z(n) : null, r = U(s);
1467
+ return e = e || s instanceof r.HTMLInputElement && !wo.has(s == null ? void 0 : s.type) || s instanceof r.HTMLTextAreaElement || s instanceof r.HTMLElement && s.isContentEditable, !(e && t === "keyboard" && n instanceof r.KeyboardEvent && !Reflect.has(xo, n.key));
1468
+ }
1469
+ var de = null, bt = /* @__PURE__ */ new Set(), Se = /* @__PURE__ */ new Map(), le = !1, Et = !1, xo = {
1470
+ Tab: !0,
1471
+ Escape: !0
1472
+ };
1473
+ function nt(e, t) {
1474
+ for (let n of bt)
1475
+ n(e, t);
1476
+ }
1477
+ function Ze(e) {
1478
+ le = !0, Co(e) && (de = "keyboard", nt("keyboard", e));
1479
+ }
1480
+ function W(e) {
1481
+ de = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (le = !0, nt("pointer", e));
1482
+ }
1483
+ function qn(e) {
1484
+ No(e) && (le = !0, de = "virtual");
1485
+ }
1486
+ function Yn(e) {
1487
+ const t = z(e);
1488
+ t === U(t) || t === K(t) || (!le && !Et && (de = "virtual", nt("virtual", e)), le = !1, Et = !1);
1489
+ }
1490
+ function Xn() {
1491
+ le = !1, Et = !0;
1492
+ }
1493
+ function Oo(e) {
1494
+ if (typeof window > "u" || Se.get(U(e)))
1495
+ return;
1496
+ const t = U(e), n = K(e);
1497
+ let s = t.HTMLElement.prototype.focus;
1498
+ t.HTMLElement.prototype.focus = function() {
1499
+ de = "virtual", nt("virtual", null), le = !0, s.apply(this, arguments);
1500
+ }, n.addEventListener("keydown", Ze, !0), n.addEventListener("keyup", Ze, !0), n.addEventListener("click", qn, !0), t.addEventListener("focus", Yn, !0), t.addEventListener("blur", Xn, !1), typeof t.PointerEvent < "u" ? (n.addEventListener("pointerdown", W, !0), n.addEventListener("pointermove", W, !0), n.addEventListener("pointerup", W, !0)) : (n.addEventListener("mousedown", W, !0), n.addEventListener("mousemove", W, !0), n.addEventListener("mouseup", W, !0)), t.addEventListener(
1501
+ "beforeunload",
1502
+ () => {
1503
+ So(e);
1504
+ },
1505
+ { once: !0 }
1506
+ ), Se.set(t, { focus: s });
1507
+ }
1508
+ var So = (e, t) => {
1509
+ const n = U(e), s = K(e);
1510
+ Se.has(n) && (n.HTMLElement.prototype.focus = Se.get(n).focus, s.removeEventListener("keydown", Ze, !0), s.removeEventListener("keyup", Ze, !0), s.removeEventListener("click", qn, !0), n.removeEventListener("focus", Yn, !0), n.removeEventListener("blur", Xn, !1), typeof n.PointerEvent < "u" ? (s.removeEventListener("pointerdown", W, !0), s.removeEventListener("pointermove", W, !0), s.removeEventListener("pointerup", W, !0)) : (s.removeEventListener("mousedown", W, !0), s.removeEventListener("mousemove", W, !0), s.removeEventListener("mouseup", W, !0)), Se.delete(n));
1511
+ };
1512
+ function Tt() {
1513
+ return de === "keyboard";
1514
+ }
1515
+ function ko(e = {}) {
1516
+ const { isTextInput: t, autoFocus: n, onChange: s, root: r } = e;
1517
+ Oo(r), s == null || s({ isFocusVisible: n || Tt(), modality: de });
1518
+ const o = (c, i) => {
1519
+ Po(!!t, c, i) && (s == null || s({ isFocusVisible: Tt(), modality: c }));
1520
+ };
1521
+ return bt.add(o), () => {
1522
+ bt.delete(o);
1523
+ };
1524
+ }
1525
+ var Io = ye("checkbox").parts("root", "label", "control", "indicator"), $e = Io.build(), L = Ft({
1526
+ getRootId: (e) => {
1527
+ var t;
1528
+ return ((t = e.ids) == null ? void 0 : t.root) ?? `checkbox:${e.id}`;
1529
+ },
1530
+ getLabelId: (e) => {
1531
+ var t;
1532
+ return ((t = e.ids) == null ? void 0 : t.label) ?? `checkbox:${e.id}:label`;
1533
+ },
1534
+ getControlId: (e) => {
1535
+ var t;
1536
+ return ((t = e.ids) == null ? void 0 : t.control) ?? `checkbox:${e.id}:control`;
1537
+ },
1538
+ getHiddenInputId: (e) => {
1539
+ var t;
1540
+ return ((t = e.ids) == null ? void 0 : t.hiddenInput) ?? `checkbox:${e.id}:input`;
1541
+ },
1542
+ getRootEl: (e) => L.getById(e, L.getRootId(e)),
1543
+ getHiddenInputEl: (e) => L.getById(e, L.getHiddenInputId(e))
1544
+ });
1545
+ function Do(e, t, n) {
1546
+ const s = e.context.isDisabled, r = e.context.readOnly, o = !s && e.context.focused, c = !s && e.context.focusVisible, i = e.context.isChecked, u = e.context.isIndeterminate, a = {
1547
+ "data-active": j(e.context.active),
1548
+ "data-focus": j(o),
1549
+ "data-focus-visible": j(c),
1550
+ "data-readonly": j(r),
1551
+ "data-hover": j(e.context.hovered),
1552
+ "data-disabled": j(s),
1553
+ "data-state": u ? "indeterminate" : e.context.checked ? "checked" : "unchecked",
1554
+ "data-invalid": j(e.context.invalid)
1555
+ };
1556
+ return {
1557
+ checked: i,
1558
+ disabled: s,
1559
+ indeterminate: u,
1560
+ focused: o,
1561
+ checkedState: e.context.checked,
1562
+ setChecked(l) {
1563
+ t({ type: "CHECKED.SET", checked: l, isTrusted: !1 });
1564
+ },
1565
+ toggleChecked() {
1566
+ t({ type: "CHECKED.TOGGLE", checked: i, isTrusted: !1 });
1567
+ },
1568
+ getRootProps() {
1569
+ return n.label({
1570
+ ...$e.root.attrs,
1571
+ ...a,
1572
+ dir: e.context.dir,
1573
+ id: L.getRootId(e.context),
1574
+ htmlFor: L.getHiddenInputId(e.context),
1575
+ onPointerMove() {
1576
+ s || t({ type: "CONTEXT.SET", context: { hovered: !0 } });
1577
+ },
1578
+ onPointerLeave() {
1579
+ s || t({ type: "CONTEXT.SET", context: { hovered: !1 } });
1580
+ },
1581
+ onClick(l) {
1582
+ z(l) === L.getHiddenInputEl(e.context) && l.stopPropagation();
1583
+ }
1584
+ });
1585
+ },
1586
+ getLabelProps() {
1587
+ return n.element({
1588
+ ...$e.label.attrs,
1589
+ ...a,
1590
+ dir: e.context.dir,
1591
+ id: L.getLabelId(e.context)
1592
+ });
1593
+ },
1594
+ getControlProps() {
1595
+ return n.element({
1596
+ ...$e.control.attrs,
1597
+ ...a,
1598
+ dir: e.context.dir,
1599
+ id: L.getControlId(e.context),
1600
+ "aria-hidden": !0
1601
+ });
1602
+ },
1603
+ getIndicatorProps() {
1604
+ return n.element({
1605
+ ...$e.indicator.attrs,
1606
+ ...a,
1607
+ dir: e.context.dir,
1608
+ hidden: !u && !e.context.checked
1609
+ });
1610
+ },
1611
+ getHiddenInputProps() {
1612
+ return n.input({
1613
+ id: L.getHiddenInputId(e.context),
1614
+ type: "checkbox",
1615
+ required: e.context.required,
1616
+ defaultChecked: i,
1617
+ disabled: s,
1618
+ "aria-labelledby": L.getLabelId(e.context),
1619
+ "aria-invalid": e.context.invalid,
1620
+ name: e.context.name,
1621
+ form: e.context.form,
1622
+ value: e.context.value,
1623
+ style: vo,
1624
+ onFocus() {
1625
+ const l = Tt();
1626
+ t({ type: "CONTEXT.SET", context: { focused: !0, focusVisible: l } });
1627
+ },
1628
+ onBlur() {
1629
+ t({ type: "CONTEXT.SET", context: { focused: !1, focusVisible: !1 } });
1630
+ },
1631
+ onClick(l) {
1632
+ if (r) {
1633
+ l.preventDefault();
1634
+ return;
1635
+ }
1636
+ const d = l.currentTarget.checked;
1637
+ t({ type: "CHECKED.SET", checked: d, isTrusted: !0 });
1638
+ }
1639
+ });
1640
+ }
1641
+ };
1642
+ }
1643
+ var { not: Xt } = Rn;
1644
+ function Ao(e) {
1645
+ const t = ue(e);
1646
+ return Re(
1647
+ {
1648
+ id: "checkbox",
1649
+ initial: "ready",
1650
+ context: {
1651
+ checked: !1,
1652
+ value: "on",
1653
+ disabled: !1,
1654
+ ...t,
1655
+ fieldsetDisabled: !1,
1656
+ focusVisible: !1
1657
+ },
1658
+ watch: {
1659
+ disabled: "removeFocusIfNeeded",
1660
+ checked: "syncInputElement"
1661
+ },
1662
+ activities: ["trackFormControlState", "trackPressEvent", "trackFocusVisible"],
1663
+ on: {
1664
+ "CHECKED.TOGGLE": [
1665
+ {
1666
+ guard: Xt("isTrusted"),
1667
+ actions: ["toggleChecked", "dispatchChangeEvent"]
1668
+ },
1669
+ {
1670
+ actions: ["toggleChecked"]
1671
+ }
1672
+ ],
1673
+ "CHECKED.SET": [
1674
+ {
1675
+ guard: Xt("isTrusted"),
1676
+ actions: ["setChecked", "dispatchChangeEvent"]
1677
+ },
1678
+ {
1679
+ actions: ["setChecked"]
1680
+ }
1681
+ ],
1682
+ "CONTEXT.SET": {
1683
+ actions: ["setContext"]
1684
+ }
1685
+ },
1686
+ computed: {
1687
+ isIndeterminate: (n) => Nt(n.checked),
1688
+ isChecked: (n) => Zt(n.checked),
1689
+ isDisabled: (n) => !!n.disabled || n.fieldsetDisabled
1690
+ },
1691
+ states: {
1692
+ ready: {}
1693
+ }
1694
+ },
1695
+ {
1696
+ guards: {
1697
+ isTrusted: (n, s) => !!s.isTrusted
1698
+ },
1699
+ activities: {
1700
+ trackPressEvent(n) {
1701
+ if (!n.isDisabled)
1702
+ return po({
1703
+ pointerNode: L.getRootEl(n),
1704
+ keyboardNode: L.getHiddenInputEl(n),
1705
+ isValidKey: (s) => s.key === " ",
1706
+ onPress: () => n.active = !1,
1707
+ onPressStart: () => n.active = !0,
1708
+ onPressEnd: () => n.active = !1
1709
+ });
1710
+ },
1711
+ trackFocusVisible(n) {
1712
+ if (!n.isDisabled)
1713
+ return ko({ root: L.getRootNode(n) });
1714
+ },
1715
+ trackFormControlState(n, s, { send: r, initialContext: o }) {
1716
+ return co(L.getHiddenInputEl(n), {
1717
+ onFieldsetDisabledChange(c) {
1718
+ n.fieldsetDisabled = c;
1719
+ },
1720
+ onFormReset() {
1721
+ r({ type: "CHECKED.SET", checked: !!o.checked });
1722
+ }
1723
+ });
1724
+ }
1725
+ },
1726
+ actions: {
1727
+ setContext(n, s) {
1728
+ Object.assign(n, s.context);
1729
+ },
1730
+ syncInputElement(n) {
1731
+ const s = L.getHiddenInputEl(n);
1732
+ s && (Un(s, n.isChecked), s.indeterminate = n.isIndeterminate);
1733
+ },
1734
+ removeFocusIfNeeded(n) {
1735
+ n.disabled && n.focused && (n.focused = !1, n.focusVisible = !1);
1736
+ },
1737
+ setChecked(n, s) {
1738
+ Jt.checked(n, s.checked);
1739
+ },
1740
+ toggleChecked(n) {
1741
+ const s = Nt(n.checked) ? !0 : !n.checked;
1742
+ Jt.checked(n, s);
1743
+ },
1744
+ dispatchChangeEvent(n) {
1745
+ const s = L.getHiddenInputEl(n);
1746
+ so(s, { checked: Zt(n.checked) });
1747
+ }
1748
+ }
1749
+ }
1750
+ );
1751
+ }
1752
+ function Nt(e) {
1753
+ return e === "indeterminate";
1754
+ }
1755
+ function Zt(e) {
1756
+ return Nt(e) ? !1 : !!e;
1757
+ }
1758
+ var Ro = {
1759
+ change: (e) => {
1760
+ var t;
1761
+ (t = e.onCheckedChange) == null || t.call(e, { checked: e.checked });
1762
+ }
1763
+ }, Jt = {
1764
+ checked: (e, t) => {
1765
+ Ot(e.checked, t) || (e.checked = t, Ro.change(e));
1766
+ }
1767
+ };
1768
+ kt()([
1769
+ "checked",
1770
+ "dir",
1771
+ "disabled",
1772
+ "form",
1773
+ "getRootNode",
1774
+ "id",
1775
+ "ids",
1776
+ "invalid",
1777
+ "name",
1778
+ "onCheckedChange",
1779
+ "readOnly",
1780
+ "required",
1781
+ "value"
1782
+ ]);
1783
+ function ke(e, t = {}) {
1784
+ const { sync: n = !1 } = t, s = Lo(e);
1785
+ return pn(
1786
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
1787
+ (...r) => {
1788
+ var o;
1789
+ return n ? queueMicrotask(() => {
1790
+ var c;
1791
+ return (c = s.current) == null ? void 0 : c.call(s, ...r);
1792
+ }) : (o = s.current) == null ? void 0 : o.call(s, ...r);
1793
+ },
1794
+ [n, s]
1795
+ );
1796
+ }
1797
+ function Lo(e) {
1798
+ const t = re(e);
1799
+ return t.current = e, t;
1800
+ }
1801
+ const [Ba, Fo] = J({
1802
+ name: "CheckboxGroupContext",
1803
+ hookName: "useCheckboxGroupContext",
1804
+ providerName: "<CheckboxGroupProvider />",
1805
+ strict: !1
1806
+ }), [$a, Zn] = J({
1807
+ name: "FieldContext",
1808
+ hookName: "useFieldContext",
1809
+ providerName: "<FieldProvider />",
1810
+ strict: !1
1811
+ }), Jn = R(
1812
+ (e, t) => {
1813
+ const n = Qe(), s = k(n.getHiddenInputProps(), e), r = Zn();
1814
+ return /* @__PURE__ */ h(F.input, { "aria-describedby": r == null ? void 0 : r.ariaDescribedby, ...s, ref: t });
1815
+ }
1816
+ );
1817
+ Jn.displayName = "CheckboxHiddenInput";
1818
+ const Qn = R(
1819
+ (e, t) => {
1820
+ const { indeterminate: n, ...s } = e, r = Qe(), o = k(r.getIndicatorProps(), s), c = n ? r.indeterminate : r.checked;
1821
+ return /* @__PURE__ */ h(F.div, { ...o, hidden: !c, ref: t });
1822
+ }
1823
+ );
1824
+ Qn.displayName = "CheckboxIndicator";
1825
+ const es = R((e, t) => {
1826
+ const n = Qe(), s = k(n.getLabelProps(), e);
1827
+ return /* @__PURE__ */ h(F.span, { ...s, ref: t });
1828
+ });
1829
+ es.displayName = "CheckboxLabel";
1830
+ const [Ha, Mt] = J({
1831
+ name: "EnvironmentContext",
1832
+ hookName: "useEnvironmentContext",
1833
+ providerName: "<EnvironmentProvider />",
1834
+ strict: !1,
1835
+ defaultValue: {
1836
+ getRootNode: () => document,
1837
+ getDocument: () => document,
1838
+ getWindow: () => window
1839
+ }
1840
+ }), [ja, ts] = J({
1841
+ name: "LocaleContext",
1842
+ hookName: "useLocaleContext",
1843
+ providerName: "<LocaleProvider />",
1844
+ strict: !1,
1845
+ defaultValue: { dir: "ltr", locale: "en-US" }
1846
+ }), Mo = (e = {}) => {
1847
+ const t = Fo(), n = Zn(), s = ze(() => k(e, (t == null ? void 0 : t.getItemProps({ value: e.value })) ?? {}), [e, t]), { getRootNode: r } = Mt(), { dir: o } = ts(), c = {
1848
+ id: mn(),
1849
+ ids: {
1850
+ label: n == null ? void 0 : n.ids.label,
1851
+ hiddenInput: n == null ? void 0 : n.ids.control
1852
+ },
1853
+ dir: o,
1854
+ disabled: n == null ? void 0 : n.disabled,
1855
+ readOnly: n == null ? void 0 : n.readOnly,
1856
+ invalid: n == null ? void 0 : n.invalid,
1857
+ required: n == null ? void 0 : n.required,
1858
+ getRootNode: r,
1859
+ checked: s.defaultChecked,
1860
+ ...s
1861
+ }, i = {
1862
+ ...c,
1863
+ checked: s.checked,
1864
+ onCheckedChange: ke(s.onCheckedChange, { sync: !0 })
1865
+ }, [u, a] = et(Ao(c), { context: i });
1866
+ return Do(u, a, Le);
1867
+ }, ns = R((e, t) => {
1868
+ const [n, s] = At()(e, [
1869
+ "checked",
1870
+ "defaultChecked",
1871
+ "disabled",
1872
+ "form",
1873
+ "id",
1874
+ "ids",
1875
+ "invalid",
1876
+ "name",
1877
+ "onCheckedChange",
1878
+ "readOnly",
1879
+ "required",
1880
+ "value"
1881
+ ]), r = Mo(n), o = k(r.getRootProps(), s);
1882
+ return /* @__PURE__ */ h(Ms, { value: r, children: /* @__PURE__ */ h(F.label, { ...o, ref: t }) });
1883
+ });
1884
+ ns.displayName = "CheckboxRoot";
1885
+ function Va({
1886
+ children: e,
1887
+ checked: t,
1888
+ defaultChecked: n,
1889
+ disabled: s = !1,
1890
+ indeterminate: r = !1,
1891
+ onChange: o,
1892
+ name: c,
1893
+ value: i,
1894
+ className: u
1895
+ }) {
1896
+ return /* @__PURE__ */ I(
1897
+ ns,
1898
+ {
1899
+ checked: t,
1900
+ defaultChecked: n,
1901
+ disabled: s,
1902
+ onCheckedChange: (a) => o == null ? void 0 : o(a.checked === !0),
1903
+ name: c,
1904
+ value: i,
1905
+ className: E(
1906
+ "inline-flex items-center gap-2 cursor-pointer select-none text-sm",
1907
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
1908
+ u
1909
+ ),
1910
+ children: [
1911
+ /* @__PURE__ */ h(
1912
+ Bn,
1913
+ {
1914
+ className: E(
1915
+ "relative h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background",
1916
+ "data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
1917
+ "data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground",
1918
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1919
+ "disabled:cursor-not-allowed disabled:opacity-50",
1920
+ "transition-colors"
1921
+ ),
1922
+ children: /* @__PURE__ */ h(Qn, { className: "absolute inset-0 flex items-center justify-center text-current", children: r ? /* @__PURE__ */ h("svg", { width: "12", height: "12", viewBox: "0 0 15 15", fill: "none", children: /* @__PURE__ */ h(
1923
+ "path",
1924
+ {
1925
+ d: "M2.25 7.5C2.25 7.22386 2.47386 7 2.75 7H12.25C12.5261 7 12.75 7.22386 12.75 7.5C12.75 7.77614 12.5261 8 12.25 8H2.75C2.47386 8 2.25 7.77614 2.25 7.5Z",
1926
+ fill: "currentColor",
1927
+ fillRule: "evenodd",
1928
+ clipRule: "evenodd"
1929
+ }
1930
+ ) }) : /* @__PURE__ */ h("svg", { width: "12", height: "12", viewBox: "0 0 15 15", fill: "none", children: /* @__PURE__ */ h(
1931
+ "path",
1932
+ {
1933
+ d: "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
1934
+ fill: "currentColor",
1935
+ fillRule: "evenodd",
1936
+ clipRule: "evenodd"
1937
+ }
1938
+ ) }) })
1939
+ }
1940
+ ),
1941
+ e && /* @__PURE__ */ h(es, { className: "cursor-pointer leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: e }),
1942
+ /* @__PURE__ */ h(Jn, {})
1943
+ ]
1944
+ }
1945
+ );
1946
+ }
1947
+ const [_o, Bo] = J({
1948
+ name: "RenderStrategyContext",
1949
+ hookName: "useRenderStrategyContext",
1950
+ providerName: "<RenderStrategyPropsProvider />"
1951
+ }), $o = (e) => At()(e, ["lazyMount", "unmountOnExit"]);
1952
+ function Ho(e, t, n) {
1953
+ const s = e.matches("mounted", "unmountSuspended");
1954
+ return {
1955
+ skip: !e.context.initial && s,
1956
+ present: s,
1957
+ setNode(r) {
1958
+ r && t({ type: "NODE.SET", node: r });
1959
+ },
1960
+ unmount() {
1961
+ t({ type: "UNMOUNT" });
1962
+ }
1963
+ };
1964
+ }
1965
+ function jo(e) {
1966
+ return Re(
1967
+ {
1968
+ initial: e.present ? "mounted" : "unmounted",
1969
+ context: {
1970
+ node: null,
1971
+ styles: null,
1972
+ unmountAnimationName: null,
1973
+ prevAnimationName: null,
1974
+ present: !1,
1975
+ initial: !1,
1976
+ ...e
1977
+ },
1978
+ exit: ["clearInitial", "cleanupNode"],
1979
+ watch: {
1980
+ present: ["setInitial", "syncPresence"]
1981
+ },
1982
+ on: {
1983
+ "NODE.SET": {
1984
+ actions: ["setNode", "setStyles"]
1985
+ }
1986
+ },
1987
+ states: {
1988
+ mounted: {
1989
+ on: {
1990
+ UNMOUNT: {
1991
+ target: "unmounted",
1992
+ actions: ["invokeOnExitComplete"]
1993
+ },
1994
+ "UNMOUNT.SUSPEND": "unmountSuspended"
1995
+ }
1996
+ },
1997
+ unmountSuspended: {
1998
+ activities: ["trackAnimationEvents"],
1999
+ after: {
2000
+ // Fallback to timeout to ensure we exit this state even if the `animationend` event
2001
+ // did not get trigger
2002
+ ANIMATION_DURATION: {
2003
+ target: "unmounted",
2004
+ actions: ["invokeOnExitComplete"]
2005
+ }
2006
+ },
2007
+ on: {
2008
+ MOUNT: {
2009
+ target: "mounted",
2010
+ actions: ["setPrevAnimationName"]
2011
+ },
2012
+ UNMOUNT: {
2013
+ target: "unmounted",
2014
+ actions: ["invokeOnExitComplete"]
2015
+ }
2016
+ }
2017
+ },
2018
+ unmounted: {
2019
+ entry: ["clearPrevAnimationName"],
2020
+ on: {
2021
+ MOUNT: {
2022
+ target: "mounted",
2023
+ actions: ["setPrevAnimationName"]
2024
+ }
2025
+ }
2026
+ }
2027
+ }
2028
+ },
2029
+ {
2030
+ delays: {
2031
+ ANIMATION_DURATION(t) {
2032
+ var n, s;
2033
+ return Qt((n = t.styles) == null ? void 0 : n.animationDuration) + Qt((s = t.styles) == null ? void 0 : s.animationDelay) + Vo;
2034
+ }
2035
+ },
2036
+ actions: {
2037
+ setInitial(t) {
2038
+ t.initial = !0;
2039
+ },
2040
+ clearInitial(t) {
2041
+ t.initial = !1;
2042
+ },
2043
+ cleanupNode(t) {
2044
+ t.node = null, t.styles = null;
2045
+ },
2046
+ invokeOnExitComplete(t) {
2047
+ var n;
2048
+ (n = t.onExitComplete) == null || n.call(t);
2049
+ },
2050
+ setNode(t, n) {
2051
+ t.node = De(n.node);
2052
+ },
2053
+ setStyles(t, n) {
2054
+ const s = n.node.ownerDocument.defaultView || window;
2055
+ t.styles = De(s.getComputedStyle(n.node));
2056
+ },
2057
+ syncPresence(t, n, { send: s }) {
2058
+ var c;
2059
+ if (t.present) {
2060
+ s({ type: "MOUNT", src: "presence.changed" });
2061
+ return;
2062
+ }
2063
+ if (!t.present && ((c = t.node) == null ? void 0 : c.ownerDocument.visibilityState) === "hidden") {
2064
+ s({ type: "UNMOUNT", src: "visibilitychange" });
2065
+ return;
2066
+ }
2067
+ const r = He(t.styles);
2068
+ (t.immediate ? queueMicrotask : requestAnimationFrame)(() => {
2069
+ var i, u;
2070
+ t.unmountAnimationName = r, r === "none" || r === t.prevAnimationName || ((i = t.styles) == null ? void 0 : i.display) === "none" || ((u = t.styles) == null ? void 0 : u.animationDuration) === "0s" ? s({ type: "UNMOUNT", src: "presence.changed" }) : s({ type: "UNMOUNT.SUSPEND" });
2071
+ });
2072
+ },
2073
+ setPrevAnimationName(t) {
2074
+ (t.immediate ? queueMicrotask : requestAnimationFrame)(() => {
2075
+ t.prevAnimationName = He(t.styles);
2076
+ });
2077
+ },
2078
+ clearPrevAnimationName(t) {
2079
+ t.prevAnimationName = null;
2080
+ }
2081
+ },
2082
+ activities: {
2083
+ trackAnimationEvents(t, n, { send: s }) {
2084
+ const r = t.node;
2085
+ if (!r) return;
2086
+ const o = (i) => {
2087
+ var a, l;
2088
+ (((l = (a = i.composedPath) == null ? void 0 : a.call(i)) == null ? void 0 : l[0]) ?? i.target) === r && (t.prevAnimationName = He(t.styles));
2089
+ }, c = (i) => {
2090
+ var l, d;
2091
+ const u = He(t.styles);
2092
+ (((d = (l = i.composedPath) == null ? void 0 : l.call(i)) == null ? void 0 : d[0]) ?? i.target) === r && u === t.unmountAnimationName && s({ type: "UNMOUNT", src: "animationend" });
2093
+ };
2094
+ return r.addEventListener("animationstart", o), r.addEventListener("animationcancel", c), r.addEventListener("animationend", c), () => {
2095
+ r.removeEventListener("animationstart", o), r.removeEventListener("animationcancel", c), r.removeEventListener("animationend", c);
2096
+ };
2097
+ }
2098
+ }
2099
+ }
2100
+ );
2101
+ }
2102
+ function He(e) {
2103
+ return (e == null ? void 0 : e.animationName) || "none";
2104
+ }
2105
+ function Qt(e) {
2106
+ return parseFloat(e || "0") * 1e3;
2107
+ }
2108
+ var Vo = 16.667;
2109
+ kt()(["onExitComplete", "present", "immediate"]);
2110
+ const ss = (e) => {
2111
+ const { lazyMount: t, unmountOnExit: n, present: s, ...r } = e, o = re(!1), c = {
2112
+ ...r,
2113
+ present: s,
2114
+ onExitComplete: ke(e.onExitComplete)
2115
+ }, [i, u] = et(jo(c), { context: c }), a = Ho(i, u);
2116
+ a.present && (o.current = !0);
2117
+ const l = !a.present && !o.current && t || n && !a.present && o.current, d = () => ({
2118
+ "data-state": s ? "open" : "closed",
2119
+ hidden: !a.present
2120
+ });
2121
+ return {
2122
+ ref: a.setNode,
2123
+ getPresenceProps: d,
2124
+ present: a.present,
2125
+ unmounted: l
2126
+ };
2127
+ }, [Go, fe] = J({
2128
+ name: "DialogContext",
2129
+ hookName: "useDialogContext",
2130
+ providerName: "<DialogProvider />"
2131
+ }), rs = R((e, t) => {
2132
+ const n = fe(), s = Bo(), r = ss({ ...s, present: n.open }), o = k(n.getBackdropProps(), r.getPresenceProps(), e);
2133
+ return r.unmounted ? null : /* @__PURE__ */ h(F.div, { ...o, ref: Dt(r.ref, t) });
2134
+ });
2135
+ rs.displayName = "DialogBackdrop";
2136
+ const os = R(
2137
+ (e, t) => {
2138
+ const n = fe(), s = k(n.getCloseTriggerProps(), e);
2139
+ return /* @__PURE__ */ h(F.button, { ...s, ref: t });
2140
+ }
2141
+ );
2142
+ os.displayName = "DialogCloseTrigger";
2143
+ const [Uo, _t] = J({
2144
+ name: "PresenceContext",
2145
+ hookName: "usePresenceContext",
2146
+ providerName: "<PresenceProvider />"
2147
+ }), is = R((e, t) => {
2148
+ const n = fe(), s = _t(), r = k(n.getContentProps(), s.getPresenceProps(), e);
2149
+ return s.unmounted ? null : /* @__PURE__ */ h(F.div, { ...r, ref: Dt(s.ref, t) });
2150
+ });
2151
+ is.displayName = "DialogContent";
2152
+ const as = R(
2153
+ (e, t) => {
2154
+ const n = fe(), s = k(n.getDescriptionProps(), e);
2155
+ return /* @__PURE__ */ h(F.div, { ...s, ref: t });
2156
+ }
2157
+ );
2158
+ as.displayName = "DialogDescription";
2159
+ const cs = R((e, t) => {
2160
+ const n = fe(), s = k(n.getPositionerProps(), e);
2161
+ return _t().unmounted ? null : /* @__PURE__ */ h(F.div, { ...s, ref: t });
2162
+ });
2163
+ cs.displayName = "DialogPositioner";
2164
+ const Ko = (e) => At()(e, [
2165
+ "immediate",
2166
+ "lazyMount",
2167
+ "onExitComplete",
2168
+ "present",
2169
+ "unmountOnExit"
2170
+ ]);
2171
+ var pe = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), Ve = {}, ct = 0, ls = (e) => e && (e.host || ls(e.parentNode)), Wo = (e, t) => t.map((n) => {
2172
+ if (e.contains(n)) return n;
2173
+ const s = ls(n);
2174
+ return s && e.contains(s) ? s : (console.error("[zag-js > ariaHidden] target", n, "in not contained inside", e, ". Doing nothing"), null);
2175
+ }).filter((n) => !!n), zo = (e) => e.localName === "next-route-announcer" || e.localName === "script" || e.hasAttribute("aria-live") ? !0 : e.matches("[data-live-announcer]"), qo = (e, t) => {
2176
+ const { parentNode: n, markerName: s, controlAttribute: r, explicitBooleanValue: o } = t, c = Wo(n, Array.isArray(e) ? e : [e]);
2177
+ Ve[s] || (Ve[s] = /* @__PURE__ */ new WeakMap());
2178
+ const i = Ve[s], u = [], a = /* @__PURE__ */ new Set(), l = new Set(c), d = (p) => {
2179
+ !p || a.has(p) || (a.add(p), d(p.parentNode));
2180
+ };
2181
+ c.forEach(d);
2182
+ const f = (p) => {
2183
+ !p || l.has(p) || Array.prototype.forEach.call(p.children, (g) => {
2184
+ if (a.has(g))
2185
+ f(g);
2186
+ else
2187
+ try {
2188
+ if (zo(g)) return;
2189
+ const m = g.getAttribute(r), w = o ? m === "true" : m !== null && m !== "false", v = (pe.get(g) || 0) + 1, O = (i.get(g) || 0) + 1;
2190
+ pe.set(g, v), i.set(g, O), u.push(g), v === 1 && w && je.set(g, !0), O === 1 && g.setAttribute(s, ""), w || g.setAttribute(r, o ? "true" : "");
2191
+ } catch (m) {
2192
+ console.error("[zag-js > ariaHidden] cannot operate on ", g, m);
2193
+ }
2194
+ });
2195
+ };
2196
+ return f(n), a.clear(), ct++, () => {
2197
+ u.forEach((p) => {
2198
+ const g = pe.get(p) - 1, m = i.get(p) - 1;
2199
+ pe.set(p, g), i.set(p, m), g || (je.has(p) || p.removeAttribute(r), je.delete(p)), m || p.removeAttribute(s);
2200
+ }), ct--, ct || (pe = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), je = /* @__PURE__ */ new WeakMap(), Ve = {});
2201
+ };
2202
+ }, Yo = (e) => (Array.isArray(e) ? e[0] : e).ownerDocument.body, Xo = (e, t = Yo(e), n = "data-aria-hidden") => {
2203
+ if (t)
2204
+ return qo(e, {
2205
+ parentNode: t,
2206
+ markerName: n,
2207
+ controlAttribute: "aria-hidden",
2208
+ explicitBooleanValue: !0
2209
+ });
2210
+ }, Zo = (e) => {
2211
+ const t = requestAnimationFrame(() => e());
2212
+ return () => cancelAnimationFrame(t);
2213
+ };
2214
+ function Jo(e, t = {}) {
2215
+ const { defer: n = !0 } = t, s = n ? Zo : (o) => o(), r = [];
2216
+ return r.push(
2217
+ s(() => {
2218
+ const c = (typeof e == "function" ? e() : e).filter(Boolean);
2219
+ c.length !== 0 && r.push(Xo(c));
2220
+ })
2221
+ ), () => {
2222
+ r.forEach((o) => o == null ? void 0 : o());
2223
+ };
2224
+ }
2225
+ function Qo(e) {
2226
+ const t = {
2227
+ each(n) {
2228
+ var s;
2229
+ for (let r = 0; r < ((s = e.frames) == null ? void 0 : s.length); r += 1) {
2230
+ const o = e.frames[r];
2231
+ o && n(o);
2232
+ }
2233
+ },
2234
+ addEventListener(n, s, r) {
2235
+ return t.each((o) => {
2236
+ try {
2237
+ o.document.addEventListener(n, s, r);
2238
+ } catch {
2239
+ }
2240
+ }), () => {
2241
+ try {
2242
+ t.removeEventListener(n, s, r);
2243
+ } catch {
2244
+ }
2245
+ };
2246
+ },
2247
+ removeEventListener(n, s, r) {
2248
+ t.each((o) => {
2249
+ try {
2250
+ o.document.removeEventListener(n, s, r);
2251
+ } catch {
2252
+ }
2253
+ });
2254
+ }
2255
+ };
2256
+ return t;
2257
+ }
2258
+ function ei(e) {
2259
+ const t = e.frameElement != null ? e.parent : null;
2260
+ return {
2261
+ addEventListener: (n, s, r) => {
2262
+ try {
2263
+ t == null || t.addEventListener(n, s, r);
2264
+ } catch {
2265
+ }
2266
+ return () => {
2267
+ try {
2268
+ t == null || t.removeEventListener(n, s, r);
2269
+ } catch {
2270
+ }
2271
+ };
2272
+ },
2273
+ removeEventListener: (n, s, r) => {
2274
+ try {
2275
+ t == null || t.removeEventListener(n, s, r);
2276
+ } catch {
2277
+ }
2278
+ }
2279
+ };
2280
+ }
2281
+ var en = "pointerdown.outside", tn = "focus.outside";
2282
+ function ti(e) {
2283
+ for (const t of e)
2284
+ if ($(t) && se(t)) return !0;
2285
+ return !1;
2286
+ }
2287
+ var us = (e) => "clientY" in e;
2288
+ function ni(e, t) {
2289
+ if (!us(t) || !e) return !1;
2290
+ const n = e.getBoundingClientRect();
2291
+ return n.width === 0 || n.height === 0 ? !1 : n.top <= t.clientY && t.clientY <= n.top + n.height && n.left <= t.clientX && t.clientX <= n.left + n.width;
2292
+ }
2293
+ function si(e, t) {
2294
+ return e.y <= t.y && t.y <= e.y + e.height && e.x <= t.x && t.x <= e.x + e.width;
2295
+ }
2296
+ function nn(e, t) {
2297
+ if (!t || !us(e)) return !1;
2298
+ const n = t.scrollHeight > t.clientHeight, s = n && e.clientX > t.offsetLeft + t.clientWidth, r = t.scrollWidth > t.clientWidth, o = r && e.clientY > t.offsetTop + t.clientHeight, c = {
2299
+ x: t.offsetLeft,
2300
+ y: t.offsetTop,
2301
+ width: t.clientWidth + (n ? 16 : 0),
2302
+ height: t.clientHeight + (r ? 16 : 0)
2303
+ }, i = {
2304
+ x: e.clientX,
2305
+ y: e.clientY
2306
+ };
2307
+ return si(c, i) ? s || o : !1;
2308
+ }
2309
+ function ri(e, t) {
2310
+ const { exclude: n, onFocusOutside: s, onPointerDownOutside: r, onInteractOutside: o, defer: c } = t;
2311
+ if (!e) return;
2312
+ const i = K(e), u = U(e), a = Qo(u), l = ei(u);
2313
+ function d(v) {
2314
+ const O = z(v);
2315
+ if (!$(O) || !O.isConnected || be(e, O) || ni(e, v)) return !1;
2316
+ const N = i.querySelector(`[aria-controls="${e.id}"]`);
2317
+ if (N) {
2318
+ const P = vt(N);
2319
+ if (nn(v, P)) return !1;
2320
+ }
2321
+ const X = vt(e);
2322
+ return nn(v, X) ? !1 : !(n != null && n(O));
2323
+ }
2324
+ const f = /* @__PURE__ */ new Set();
2325
+ function p(v) {
2326
+ function O() {
2327
+ var P;
2328
+ const N = c ? Y : (D) => D(), X = ((P = v.composedPath) == null ? void 0 : P.call(v)) ?? [v.target];
2329
+ N(() => {
2330
+ if (!(!e || !d(v))) {
2331
+ if (r || o) {
2332
+ const D = mt(r, o);
2333
+ e.addEventListener(en, D, { once: !0 });
2334
+ }
2335
+ sn(e, en, {
2336
+ bubbles: !1,
2337
+ cancelable: !0,
2338
+ detail: {
2339
+ originalEvent: v,
2340
+ contextmenu: Jr(v),
2341
+ focusable: ti(X)
2342
+ }
2343
+ });
2344
+ }
2345
+ });
2346
+ }
2347
+ v.pointerType === "touch" ? (f.forEach((N) => N()), f.add(A(i, "click", O, { once: !0 })), f.add(l.addEventListener("click", O, { once: !0 })), f.add(a.addEventListener("click", O, { once: !0 }))) : O();
2348
+ }
2349
+ const g = /* @__PURE__ */ new Set(), m = setTimeout(() => {
2350
+ g.add(A(i, "pointerdown", p, !0)), g.add(l.addEventListener("pointerdown", p, !0)), g.add(a.addEventListener("pointerdown", p, !0));
2351
+ }, 0);
2352
+ function w(v) {
2353
+ (c ? Y : (N) => N())(() => {
2354
+ if (!(!e || !d(v))) {
2355
+ if (s || o) {
2356
+ const N = mt(s, o);
2357
+ e.addEventListener(tn, N, { once: !0 });
2358
+ }
2359
+ sn(e, tn, {
2360
+ bubbles: !1,
2361
+ cancelable: !0,
2362
+ detail: {
2363
+ originalEvent: v,
2364
+ contextmenu: !1,
2365
+ focusable: se(z(v))
2366
+ }
2367
+ });
2368
+ }
2369
+ });
2370
+ }
2371
+ return g.add(A(i, "focusin", w, !0)), g.add(l.addEventListener("focusin", w, !0)), g.add(a.addEventListener("focusin", w, !0)), () => {
2372
+ clearTimeout(m), f.forEach((v) => v()), g.forEach((v) => v());
2373
+ };
2374
+ }
2375
+ function oi(e, t) {
2376
+ const { defer: n } = t, s = n ? Y : (o) => o(), r = [];
2377
+ return r.push(
2378
+ s(() => {
2379
+ const o = typeof e == "function" ? e() : e;
2380
+ r.push(ri(o, t));
2381
+ })
2382
+ ), () => {
2383
+ r.forEach((o) => o == null ? void 0 : o());
2384
+ };
2385
+ }
2386
+ function sn(e, t, n) {
2387
+ const s = e.ownerDocument.defaultView || window, r = new s.CustomEvent(t, n);
2388
+ return e.dispatchEvent(r);
2389
+ }
2390
+ function ii(e, t) {
2391
+ const n = (s) => {
2392
+ s.key === "Escape" && (s.isComposing || t == null || t(s));
2393
+ };
2394
+ return A(K(e), "keydown", n, { capture: !0 });
2395
+ }
2396
+ var V = {
2397
+ layers: [],
2398
+ branches: [],
2399
+ count() {
2400
+ return this.layers.length;
2401
+ },
2402
+ pointerBlockingLayers() {
2403
+ return this.layers.filter((e) => e.pointerBlocking);
2404
+ },
2405
+ topMostPointerBlockingLayer() {
2406
+ return [...this.pointerBlockingLayers()].slice(-1)[0];
2407
+ },
2408
+ hasPointerBlockingLayer() {
2409
+ return this.pointerBlockingLayers().length > 0;
2410
+ },
2411
+ isBelowPointerBlockingLayer(e) {
2412
+ var s;
2413
+ const t = this.indexOf(e), n = this.topMostPointerBlockingLayer() ? this.indexOf((s = this.topMostPointerBlockingLayer()) == null ? void 0 : s.node) : -1;
2414
+ return t < n;
2415
+ },
2416
+ isTopMost(e) {
2417
+ const t = this.layers[this.count() - 1];
2418
+ return (t == null ? void 0 : t.node) === e;
2419
+ },
2420
+ getNestedLayers(e) {
2421
+ return Array.from(this.layers).slice(this.indexOf(e) + 1);
2422
+ },
2423
+ isInNestedLayer(e, t) {
2424
+ return this.getNestedLayers(e).some((n) => be(n.node, t));
2425
+ },
2426
+ isInBranch(e) {
2427
+ return Array.from(this.branches).some((t) => be(t, e));
2428
+ },
2429
+ add(e) {
2430
+ const t = this.layers.push(e);
2431
+ e.node.style.setProperty("--layer-index", `${t}`);
2432
+ },
2433
+ addBranch(e) {
2434
+ this.branches.push(e);
2435
+ },
2436
+ remove(e) {
2437
+ const t = this.indexOf(e);
2438
+ t < 0 || (t < this.count() - 1 && this.getNestedLayers(e).forEach((s) => s.dismiss()), this.layers.splice(t, 1), e.style.removeProperty("--layer-index"));
2439
+ },
2440
+ removeBranch(e) {
2441
+ const t = this.branches.indexOf(e);
2442
+ t >= 0 && this.branches.splice(t, 1);
2443
+ },
2444
+ indexOf(e) {
2445
+ return this.layers.findIndex((t) => t.node === e);
2446
+ },
2447
+ dismiss(e) {
2448
+ var t;
2449
+ (t = this.layers[this.indexOf(e)]) == null || t.dismiss();
2450
+ },
2451
+ clear() {
2452
+ this.remove(this.layers[0].node);
2453
+ }
2454
+ }, rn;
2455
+ function on() {
2456
+ V.layers.forEach(({ node: e }) => {
2457
+ e.style.pointerEvents = V.isBelowPointerBlockingLayer(e) ? "none" : "auto";
2458
+ });
2459
+ }
2460
+ function ai(e) {
2461
+ e.style.pointerEvents = "";
2462
+ }
2463
+ function ci(e, t) {
2464
+ const n = K(e), s = [];
2465
+ if (V.hasPointerBlockingLayer() && !n.body.hasAttribute("data-inert") && (rn = document.body.style.pointerEvents, queueMicrotask(() => {
2466
+ n.body.style.pointerEvents = "none", n.body.setAttribute("data-inert", "");
2467
+ })), t) {
2468
+ const r = To(t, (o) => {
2469
+ s.push(yo(o, { pointerEvents: "auto" }));
2470
+ });
2471
+ s.push(r);
2472
+ }
2473
+ return () => {
2474
+ V.hasPointerBlockingLayer() || (queueMicrotask(() => {
2475
+ n.body.style.pointerEvents = rn, n.body.removeAttribute("data-inert"), n.body.style.length === 0 && n.body.removeAttribute("style");
2476
+ }), s.forEach((r) => r()));
2477
+ };
2478
+ }
2479
+ function li(e, t) {
2480
+ if (!e) {
2481
+ me("[@zag-js/dismissable] node is `null` or `undefined`");
2482
+ return;
2483
+ }
2484
+ const { onDismiss: n, pointerBlocking: s, exclude: r, debug: o } = t, c = { dismiss: n, node: e, pointerBlocking: s };
2485
+ V.add(c), on();
2486
+ function i(f) {
2487
+ var g, m;
2488
+ const p = z(f.detail.originalEvent);
2489
+ V.isBelowPointerBlockingLayer(e) || V.isInBranch(p) || ((g = t.onPointerDownOutside) == null || g.call(t, f), (m = t.onInteractOutside) == null || m.call(t, f), !f.defaultPrevented && (o && console.log("onPointerDownOutside:", f.detail.originalEvent), n == null || n()));
2490
+ }
2491
+ function u(f) {
2492
+ var g, m;
2493
+ const p = z(f.detail.originalEvent);
2494
+ V.isInBranch(p) || ((g = t.onFocusOutside) == null || g.call(t, f), (m = t.onInteractOutside) == null || m.call(t, f), !f.defaultPrevented && (o && console.log("onFocusOutside:", f.detail.originalEvent), n == null || n()));
2495
+ }
2496
+ function a(f) {
2497
+ var p;
2498
+ V.isTopMost(e) && ((p = t.onEscapeKeyDown) == null || p.call(t, f), !f.defaultPrevented && n && (f.preventDefault(), n()));
2499
+ }
2500
+ function l(f) {
2501
+ var w;
2502
+ if (!e) return !1;
2503
+ const p = typeof r == "function" ? r() : r, g = Array.isArray(p) ? p : [p], m = (w = t.persistentElements) == null ? void 0 : w.map((v) => v()).filter($);
2504
+ return m && g.push(...m), g.some((v) => be(v, f)) || V.isInNestedLayer(e, f);
2505
+ }
2506
+ const d = [
2507
+ s ? ci(e, t.persistentElements) : void 0,
2508
+ ii(e, a),
2509
+ oi(e, { exclude: l, onFocusOutside: u, onPointerDownOutside: i, defer: t.defer })
2510
+ ];
2511
+ return () => {
2512
+ V.remove(e), on(), ai(e), d.forEach((f) => f == null ? void 0 : f());
2513
+ };
2514
+ }
2515
+ function ui(e, t) {
2516
+ const { defer: n } = t, s = n ? Y : (o) => o(), r = [];
2517
+ return r.push(
2518
+ s(() => {
2519
+ const o = ve(e) ? e() : e;
2520
+ r.push(li(o, t));
2521
+ })
2522
+ ), () => {
2523
+ r.forEach((o) => o == null ? void 0 : o());
2524
+ };
2525
+ }
2526
+ function di(e, t = {}) {
2527
+ const { defer: n } = t, s = n ? Y : (o) => o(), r = [];
2528
+ return r.push(
2529
+ s(() => {
2530
+ const o = ve(e) ? e() : e;
2531
+ if (!o) {
2532
+ me("[@zag-js/dismissable] branch node is `null` or `undefined`");
2533
+ return;
2534
+ }
2535
+ V.addBranch(o), r.push(() => {
2536
+ V.removeBranch(o);
2537
+ });
2538
+ })
2539
+ ), () => {
2540
+ r.forEach((o) => o == null ? void 0 : o());
2541
+ };
2542
+ }
2543
+ var fi = Object.defineProperty, hi = (e, t, n) => t in e ? fi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, S = (e, t, n) => hi(e, typeof t != "symbol" ? t + "" : t, n), an = {
2544
+ activateTrap(e, t) {
2545
+ if (e.length > 0) {
2546
+ const s = e[e.length - 1];
2547
+ s !== t && s.pause();
2548
+ }
2549
+ const n = e.indexOf(t);
2550
+ n === -1 || e.splice(n, 1), e.push(t);
2551
+ },
2552
+ deactivateTrap(e, t) {
2553
+ const n = e.indexOf(t);
2554
+ n !== -1 && e.splice(n, 1), e.length > 0 && e[e.length - 1].unpause();
2555
+ }
2556
+ }, pi = [], gi = class {
2557
+ constructor(e, t) {
2558
+ S(this, "trapStack"), S(this, "config"), S(this, "doc"), S(this, "state", {
2559
+ containers: [],
2560
+ containerGroups: [],
2561
+ tabbableGroups: [],
2562
+ nodeFocusedBeforeActivation: null,
2563
+ mostRecentlyFocusedNode: null,
2564
+ active: !1,
2565
+ paused: !1,
2566
+ delayInitialFocusTimer: void 0,
2567
+ recentNavEvent: void 0
2568
+ }), S(this, "listenerCleanups", []), S(this, "handleFocus", (s) => {
2569
+ const r = z(s), o = this.findContainerIndex(r, s) >= 0;
2570
+ if (o || Rt(r))
2571
+ o && (this.state.mostRecentlyFocusedNode = r);
2572
+ else {
2573
+ s.stopImmediatePropagation();
2574
+ let c, i = !0;
2575
+ if (this.state.mostRecentlyFocusedNode)
2576
+ if (Te(this.state.mostRecentlyFocusedNode) > 0) {
2577
+ const u = this.findContainerIndex(this.state.mostRecentlyFocusedNode), { tabbableNodes: a } = this.state.containerGroups[u];
2578
+ if (a.length > 0) {
2579
+ const l = a.findIndex((d) => d === this.state.mostRecentlyFocusedNode);
2580
+ l >= 0 && (this.config.isKeyForward(this.state.recentNavEvent) ? l + 1 < a.length && (c = a[l + 1], i = !1) : l - 1 >= 0 && (c = a[l - 1], i = !1));
2581
+ }
2582
+ } else
2583
+ this.state.containerGroups.some((u) => u.tabbableNodes.some((a) => Te(a) > 0)) || (i = !1);
2584
+ else
2585
+ i = !1;
2586
+ i && (c = this.findNextNavNode({
2587
+ // move FROM the MRU node, not event-related node (which will be the node that is
2588
+ // outside the trap causing the focus escape we're trying to fix)
2589
+ target: this.state.mostRecentlyFocusedNode,
2590
+ isBackward: this.config.isKeyBackward(this.state.recentNavEvent)
2591
+ })), c ? this.tryFocus(c) : this.tryFocus(this.state.mostRecentlyFocusedNode || this.getInitialFocusNode());
2592
+ }
2593
+ this.state.recentNavEvent = void 0;
2594
+ }), S(this, "handlePointerDown", (s) => {
2595
+ const r = z(s);
2596
+ if (!(this.findContainerIndex(r, s) >= 0)) {
2597
+ if (Ce(this.config.clickOutsideDeactivates, s)) {
2598
+ this.deactivate({ returnFocus: this.config.returnFocusOnDeactivate });
2599
+ return;
2600
+ }
2601
+ Ce(this.config.allowOutsideClick, s) || s.preventDefault();
2602
+ }
2603
+ }), S(this, "handleClick", (s) => {
2604
+ const r = z(s);
2605
+ this.findContainerIndex(r, s) >= 0 || Ce(this.config.clickOutsideDeactivates, s) || Ce(this.config.allowOutsideClick, s) || (s.preventDefault(), s.stopImmediatePropagation());
2606
+ }), S(this, "handleTabKey", (s) => {
2607
+ if (this.config.isKeyForward(s) || this.config.isKeyBackward(s)) {
2608
+ this.state.recentNavEvent = s;
2609
+ const r = this.config.isKeyBackward(s), o = this.findNextNavNode({ event: s, isBackward: r });
2610
+ if (!o) return;
2611
+ Ne(s) && s.preventDefault(), this.tryFocus(o);
2612
+ }
2613
+ }), S(this, "handleEscapeKey", (s) => {
2614
+ mi(s) && Ce(this.config.escapeDeactivates, s) !== !1 && (s.preventDefault(), this.deactivate());
2615
+ }), S(this, "_mutationObserver"), S(this, "setupMutationObserver", () => {
2616
+ const s = this.doc.defaultView || window;
2617
+ this._mutationObserver = new s.MutationObserver((r) => {
2618
+ r.some((c) => Array.from(c.removedNodes).some((u) => u === this.state.mostRecentlyFocusedNode)) && this.tryFocus(this.getInitialFocusNode());
2619
+ });
2620
+ }), S(this, "updateObservedNodes", () => {
2621
+ var s;
2622
+ (s = this._mutationObserver) == null || s.disconnect(), this.state.active && !this.state.paused && this.state.containers.map((r) => {
2623
+ var o;
2624
+ (o = this._mutationObserver) == null || o.observe(r, { subtree: !0, childList: !0 });
2625
+ });
2626
+ }), S(this, "getInitialFocusNode", () => {
2627
+ let s = this.getNodeForOption("initialFocus", { hasFallback: !0 });
2628
+ if (s === !1)
2629
+ return !1;
2630
+ if (s === void 0 || s && !se(s))
2631
+ if (this.findContainerIndex(this.doc.activeElement) >= 0)
2632
+ s = this.doc.activeElement;
2633
+ else {
2634
+ const r = this.state.tabbableGroups[0];
2635
+ s = r && r.firstTabbableNode || this.getNodeForOption("fallbackFocus");
2636
+ }
2637
+ else s === null && (s = this.getNodeForOption("fallbackFocus"));
2638
+ if (!s)
2639
+ throw new Error("Your focus-trap needs to have at least one focusable element");
2640
+ return s.isConnected || (s = this.getNodeForOption("fallbackFocus")), s;
2641
+ }), S(this, "tryFocus", (s) => {
2642
+ if (s !== !1 && s !== Hn(this.doc)) {
2643
+ if (!s || !s.focus) {
2644
+ this.tryFocus(this.getInitialFocusNode());
2645
+ return;
2646
+ }
2647
+ s.focus({ preventScroll: !!this.config.preventScroll }), this.state.mostRecentlyFocusedNode = s, yi(s) && s.select();
2648
+ }
2649
+ }), S(this, "deactivate", (s) => {
2650
+ if (!this.state.active) return this;
2651
+ const r = {
2652
+ onDeactivate: this.config.onDeactivate,
2653
+ onPostDeactivate: this.config.onPostDeactivate,
2654
+ checkCanReturnFocus: this.config.checkCanReturnFocus,
2655
+ ...s
2656
+ };
2657
+ clearTimeout(this.state.delayInitialFocusTimer), this.state.delayInitialFocusTimer = void 0, this.removeListeners(), this.state.active = !1, this.state.paused = !1, this.updateObservedNodes(), an.deactivateTrap(this.trapStack, this);
2658
+ const o = this.getOption(r, "onDeactivate"), c = this.getOption(r, "onPostDeactivate"), i = this.getOption(r, "checkCanReturnFocus"), u = this.getOption(r, "returnFocus", "returnFocusOnDeactivate");
2659
+ o == null || o();
2660
+ const a = () => {
2661
+ cn(() => {
2662
+ if (u) {
2663
+ const l = this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);
2664
+ this.tryFocus(l);
2665
+ }
2666
+ c == null || c();
2667
+ });
2668
+ };
2669
+ if (u && i) {
2670
+ const l = this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);
2671
+ return i(l).then(a, a), this;
2672
+ }
2673
+ return a(), this;
2674
+ }), S(this, "pause", (s) => {
2675
+ if (this.state.paused || !this.state.active)
2676
+ return this;
2677
+ const r = this.getOption(s, "onPause"), o = this.getOption(s, "onPostPause");
2678
+ return this.state.paused = !0, r == null || r(), this.removeListeners(), this.updateObservedNodes(), o == null || o(), this;
2679
+ }), S(this, "unpause", (s) => {
2680
+ if (!this.state.paused || !this.state.active)
2681
+ return this;
2682
+ const r = this.getOption(s, "onUnpause"), o = this.getOption(s, "onPostUnpause");
2683
+ return this.state.paused = !1, r == null || r(), this.updateTabbableNodes(), this.addListeners(), this.updateObservedNodes(), o == null || o(), this;
2684
+ }), S(this, "updateContainerElements", (s) => (this.state.containers = Array.isArray(s) ? s.filter(Boolean) : [s].filter(Boolean), this.state.active && this.updateTabbableNodes(), this.updateObservedNodes(), this)), S(this, "getReturnFocusNode", (s) => {
2685
+ const r = this.getNodeForOption("setReturnFocus", {
2686
+ params: [s]
2687
+ });
2688
+ return r || (r === !1 ? !1 : s);
2689
+ }), S(this, "getOption", (s, r, o) => s && s[r] !== void 0 ? s[r] : (
2690
+ // @ts-expect-error
2691
+ this.config[o || r]
2692
+ )), S(this, "getNodeForOption", (s, { hasFallback: r = !1, params: o = [] } = {}) => {
2693
+ let c = this.config[s];
2694
+ if (typeof c == "function" && (c = c(...o)), c === !0 && (c = void 0), !c) {
2695
+ if (c === void 0 || c === !1)
2696
+ return c;
2697
+ throw new Error(`\`${s}\` was specified but was not a node, or did not return a node`);
2698
+ }
2699
+ let i = c;
2700
+ if (typeof c == "string") {
2701
+ try {
2702
+ i = this.doc.querySelector(c);
2703
+ } catch (u) {
2704
+ throw new Error(`\`${s}\` appears to be an invalid selector; error="${u.message}"`);
2705
+ }
2706
+ if (!i && !r)
2707
+ throw new Error(`\`${s}\` as selector refers to no known node`);
2708
+ }
2709
+ return i;
2710
+ }), S(this, "findNextNavNode", (s) => {
2711
+ const { event: r, isBackward: o = !1 } = s, c = s.target || z(r);
2712
+ this.updateTabbableNodes();
2713
+ let i = null;
2714
+ if (this.state.tabbableGroups.length > 0) {
2715
+ const u = this.findContainerIndex(c, r), a = u >= 0 ? this.state.containerGroups[u] : void 0;
2716
+ if (u < 0)
2717
+ o ? i = this.state.tabbableGroups[this.state.tabbableGroups.length - 1].lastTabbableNode : i = this.state.tabbableGroups[0].firstTabbableNode;
2718
+ else if (o) {
2719
+ let l = this.state.tabbableGroups.findIndex(
2720
+ ({ firstTabbableNode: d }) => c === d
2721
+ );
2722
+ if (l < 0 && ((a == null ? void 0 : a.container) === c || se(c) && !ie(c) && !(a != null && a.nextTabbableNode(c, !1))) && (l = u), l >= 0) {
2723
+ const d = l === 0 ? this.state.tabbableGroups.length - 1 : l - 1, f = this.state.tabbableGroups[d];
2724
+ i = Te(c) >= 0 ? f.lastTabbableNode : f.lastDomTabbableNode;
2725
+ } else Ne(r) || (i = a == null ? void 0 : a.nextTabbableNode(c, !1));
2726
+ } else {
2727
+ let l = this.state.tabbableGroups.findIndex(
2728
+ ({ lastTabbableNode: d }) => c === d
2729
+ );
2730
+ if (l < 0 && ((a == null ? void 0 : a.container) === c || se(c) && !ie(c) && !(a != null && a.nextTabbableNode(c))) && (l = u), l >= 0) {
2731
+ const d = l === this.state.tabbableGroups.length - 1 ? 0 : l + 1, f = this.state.tabbableGroups[d];
2732
+ i = Te(c) >= 0 ? f.firstTabbableNode : f.firstDomTabbableNode;
2733
+ } else Ne(r) || (i = a == null ? void 0 : a.nextTabbableNode(c));
2734
+ }
2735
+ } else
2736
+ i = this.getNodeForOption("fallbackFocus");
2737
+ return i;
2738
+ }), this.trapStack = t.trapStack || pi;
2739
+ const n = {
2740
+ returnFocusOnDeactivate: !0,
2741
+ escapeDeactivates: !0,
2742
+ delayInitialFocus: !0,
2743
+ isKeyForward(s) {
2744
+ return Ne(s) && !s.shiftKey;
2745
+ },
2746
+ isKeyBackward(s) {
2747
+ return Ne(s) && s.shiftKey;
2748
+ },
2749
+ ...t
2750
+ };
2751
+ this.doc = n.document || K(Array.isArray(e) ? e[0] : e), this.config = n, this.updateContainerElements(e), this.setupMutationObserver();
2752
+ }
2753
+ get active() {
2754
+ return this.state.active;
2755
+ }
2756
+ get paused() {
2757
+ return this.state.paused;
2758
+ }
2759
+ findContainerIndex(e, t) {
2760
+ const n = typeof (t == null ? void 0 : t.composedPath) == "function" ? t.composedPath() : void 0;
2761
+ return this.state.containerGroups.findIndex(
2762
+ ({ container: s, tabbableNodes: r }) => s.contains(e) || (n == null ? void 0 : n.includes(s)) || r.find((o) => o === e)
2763
+ );
2764
+ }
2765
+ updateTabbableNodes() {
2766
+ if (this.state.containerGroups = this.state.containers.map((e) => {
2767
+ const t = zn(e), n = Wn(e), s = t.length > 0 ? t[0] : void 0, r = t.length > 0 ? t[t.length - 1] : void 0, o = n.find((a) => ie(a)), c = n.slice().reverse().find((a) => ie(a)), i = !!t.find((a) => Te(a) > 0);
2768
+ function u(a, l = !0) {
2769
+ const d = t.indexOf(a);
2770
+ return d < 0 ? l ? n.slice(n.indexOf(a) + 1).find((f) => ie(f)) : n.slice(0, n.indexOf(a)).reverse().find((f) => ie(f)) : t[d + (l ? 1 : -1)];
2771
+ }
2772
+ return {
2773
+ container: e,
2774
+ tabbableNodes: t,
2775
+ focusableNodes: n,
2776
+ posTabIndexesFound: i,
2777
+ firstTabbableNode: s,
2778
+ lastTabbableNode: r,
2779
+ firstDomTabbableNode: o,
2780
+ lastDomTabbableNode: c,
2781
+ nextTabbableNode: u
2782
+ };
2783
+ }), this.state.tabbableGroups = this.state.containerGroups.filter((e) => e.tabbableNodes.length > 0), this.state.tabbableGroups.length <= 0 && !this.getNodeForOption("fallbackFocus"))
2784
+ throw new Error(
2785
+ "Your focus-trap must have at least one container with at least one tabbable node in it at all times"
2786
+ );
2787
+ if (this.state.containerGroups.find((e) => e.posTabIndexesFound) && this.state.containerGroups.length > 1)
2788
+ throw new Error(
2789
+ "At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps."
2790
+ );
2791
+ }
2792
+ addListeners() {
2793
+ if (this.state.active)
2794
+ return an.activateTrap(this.trapStack, this), this.state.delayInitialFocusTimer = this.config.delayInitialFocus ? cn(() => {
2795
+ this.tryFocus(this.getInitialFocusNode());
2796
+ }) : this.tryFocus(this.getInitialFocusNode()), this.listenerCleanups.push(
2797
+ A(this.doc, "focusin", this.handleFocus, !0),
2798
+ A(this.doc, "mousedown", this.handlePointerDown, { capture: !0, passive: !1 }),
2799
+ A(this.doc, "touchstart", this.handlePointerDown, { capture: !0, passive: !1 }),
2800
+ A(this.doc, "click", this.handleClick, { capture: !0, passive: !1 }),
2801
+ A(this.doc, "keydown", this.handleTabKey, { capture: !0, passive: !1 }),
2802
+ A(this.doc, "keydown", this.handleEscapeKey)
2803
+ ), this;
2804
+ }
2805
+ removeListeners() {
2806
+ if (this.state.active)
2807
+ return this.listenerCleanups.forEach((e) => e()), this.listenerCleanups = [], this;
2808
+ }
2809
+ activate(e) {
2810
+ if (this.state.active)
2811
+ return this;
2812
+ const t = this.getOption(e, "onActivate"), n = this.getOption(e, "onPostActivate"), s = this.getOption(e, "checkCanFocusTrap");
2813
+ s || this.updateTabbableNodes(), this.state.active = !0, this.state.paused = !1, this.state.nodeFocusedBeforeActivation = this.doc.activeElement || null, t == null || t();
2814
+ const r = () => {
2815
+ s && this.updateTabbableNodes(), this.addListeners(), this.updateObservedNodes(), n == null || n();
2816
+ };
2817
+ return s ? (s(this.state.containers.concat()).then(r, r), this) : (r(), this);
2818
+ }
2819
+ }, Ne = (e) => e.key === "Tab", Ce = (e, ...t) => typeof e == "function" ? e(...t) : e, mi = (e) => !e.isComposing && e.key === "Escape", cn = (e) => setTimeout(e, 0), yi = (e) => e.localName === "input" && "select" in e && typeof e.select == "function";
2820
+ function vi(e, t = {}) {
2821
+ let n;
2822
+ const s = Y(() => {
2823
+ const r = typeof e == "function" ? e() : e;
2824
+ if (r) {
2825
+ n = new gi(r, {
2826
+ escapeDeactivates: !1,
2827
+ allowOutsideClick: !0,
2828
+ preventScroll: !0,
2829
+ returnFocusOnDeactivate: !0,
2830
+ delayInitialFocus: !1,
2831
+ fallbackFocus: r,
2832
+ ...t,
2833
+ document: K(r)
2834
+ });
2835
+ try {
2836
+ n.activate();
2837
+ } catch {
2838
+ }
2839
+ }
2840
+ });
2841
+ return function() {
2842
+ n == null || n.deactivate(), s();
2843
+ };
2844
+ }
2845
+ var lt = "data-scroll-lock";
2846
+ function ln(e, t) {
2847
+ if (!e) return;
2848
+ const n = Object.keys(t).reduce(
2849
+ (s, r) => (s[r] = e.style.getPropertyValue(r), s),
2850
+ {}
2851
+ );
2852
+ return Object.assign(e.style, t), () => {
2853
+ Object.assign(e.style, n);
2854
+ };
2855
+ }
2856
+ function bi(e, t, n) {
2857
+ if (!e) return;
2858
+ const s = e.style.getPropertyValue(t);
2859
+ return e.style.setProperty(t, n), () => {
2860
+ s ? e.style.setProperty(t, s) : e.style.removeProperty(t);
2861
+ };
2862
+ }
2863
+ function Ei(e) {
2864
+ const t = e.getBoundingClientRect().left;
2865
+ return Math.round(t) + e.scrollLeft ? "paddingLeft" : "paddingRight";
2866
+ }
2867
+ function Ti(e) {
2868
+ const t = e ?? document, n = t.defaultView ?? window, { documentElement: s, body: r } = t;
2869
+ if (r.hasAttribute(lt)) return;
2870
+ r.setAttribute(lt, "");
2871
+ const c = n.innerWidth - s.clientWidth, i = () => bi(s, "--scrollbar-width", `${c}px`), u = Ei(s), a = () => ln(r, {
2872
+ overflow: "hidden",
2873
+ [u]: `${c}px`
2874
+ }), l = () => {
2875
+ const { scrollX: f, scrollY: p, visualViewport: g } = n, m = (g == null ? void 0 : g.offsetLeft) ?? 0, w = (g == null ? void 0 : g.offsetTop) ?? 0, v = ln(r, {
2876
+ position: "fixed",
2877
+ overflow: "hidden",
2878
+ top: `${-(p - Math.floor(w))}px`,
2879
+ left: `${-(f - Math.floor(m))}px`,
2880
+ right: "0",
2881
+ [u]: `${c}px`
2882
+ });
2883
+ return () => {
2884
+ v == null || v(), n.scrollTo({ left: f, top: p, behavior: "instant" });
2885
+ };
2886
+ }, d = [i(), Xr() ? l() : a()];
2887
+ return () => {
2888
+ d.forEach((f) => f == null ? void 0 : f()), r.removeAttribute(lt);
2889
+ };
2890
+ }
2891
+ var Ni = ye("dialog").parts(
2892
+ "trigger",
2893
+ "backdrop",
2894
+ "positioner",
2895
+ "content",
2896
+ "title",
2897
+ "description",
2898
+ "closeTrigger"
2899
+ ), oe = Ni.build(), C = Ft({
2900
+ getPositionerId: (e) => {
2901
+ var t;
2902
+ return ((t = e.ids) == null ? void 0 : t.positioner) ?? `dialog:${e.id}:positioner`;
2903
+ },
2904
+ getBackdropId: (e) => {
2905
+ var t;
2906
+ return ((t = e.ids) == null ? void 0 : t.backdrop) ?? `dialog:${e.id}:backdrop`;
2907
+ },
2908
+ getContentId: (e) => {
2909
+ var t;
2910
+ return ((t = e.ids) == null ? void 0 : t.content) ?? `dialog:${e.id}:content`;
2911
+ },
2912
+ getTriggerId: (e) => {
2913
+ var t;
2914
+ return ((t = e.ids) == null ? void 0 : t.trigger) ?? `dialog:${e.id}:trigger`;
2915
+ },
2916
+ getTitleId: (e) => {
2917
+ var t;
2918
+ return ((t = e.ids) == null ? void 0 : t.title) ?? `dialog:${e.id}:title`;
2919
+ },
2920
+ getDescriptionId: (e) => {
2921
+ var t;
2922
+ return ((t = e.ids) == null ? void 0 : t.description) ?? `dialog:${e.id}:description`;
2923
+ },
2924
+ getCloseTriggerId: (e) => {
2925
+ var t;
2926
+ return ((t = e.ids) == null ? void 0 : t.closeTrigger) ?? `dialog:${e.id}:close`;
2927
+ },
2928
+ getContentEl: (e) => C.getById(e, C.getContentId(e)),
2929
+ getPositionerEl: (e) => C.getById(e, C.getPositionerId(e)),
2930
+ getBackdropEl: (e) => C.getById(e, C.getBackdropId(e)),
2931
+ getTriggerEl: (e) => C.getById(e, C.getTriggerId(e)),
2932
+ getTitleEl: (e) => C.getById(e, C.getTitleId(e)),
2933
+ getDescriptionEl: (e) => C.getById(e, C.getDescriptionId(e)),
2934
+ getCloseTriggerEl: (e) => C.getById(e, C.getCloseTriggerId(e))
2935
+ });
2936
+ function Ci(e, t, n) {
2937
+ const s = e.context["aria-label"], r = e.matches("open"), o = e.context.renderedElements;
2938
+ return {
2939
+ open: r,
2940
+ setOpen(c) {
2941
+ c !== r && t(c ? "OPEN" : "CLOSE");
2942
+ },
2943
+ getTriggerProps() {
2944
+ return n.button({
2945
+ ...oe.trigger.attrs,
2946
+ dir: e.context.dir,
2947
+ id: C.getTriggerId(e.context),
2948
+ "aria-haspopup": "dialog",
2949
+ type: "button",
2950
+ "aria-expanded": r,
2951
+ "data-state": r ? "open" : "closed",
2952
+ "aria-controls": C.getContentId(e.context),
2953
+ onClick(c) {
2954
+ c.defaultPrevented || t("TOGGLE");
2955
+ }
2956
+ });
2957
+ },
2958
+ getBackdropProps() {
2959
+ return n.element({
2960
+ ...oe.backdrop.attrs,
2961
+ dir: e.context.dir,
2962
+ hidden: !r,
2963
+ id: C.getBackdropId(e.context),
2964
+ "data-state": r ? "open" : "closed"
2965
+ });
2966
+ },
2967
+ getPositionerProps() {
2968
+ return n.element({
2969
+ ...oe.positioner.attrs,
2970
+ dir: e.context.dir,
2971
+ id: C.getPositionerId(e.context),
2972
+ style: {
2973
+ pointerEvents: r ? void 0 : "none"
2974
+ }
2975
+ });
2976
+ },
2977
+ getContentProps() {
2978
+ return n.element({
2979
+ ...oe.content.attrs,
2980
+ dir: e.context.dir,
2981
+ role: e.context.role,
2982
+ hidden: !r,
2983
+ id: C.getContentId(e.context),
2984
+ tabIndex: -1,
2985
+ "data-state": r ? "open" : "closed",
2986
+ "aria-modal": !0,
2987
+ "aria-label": s || void 0,
2988
+ "aria-labelledby": s || !o.title ? void 0 : C.getTitleId(e.context),
2989
+ "aria-describedby": o.description ? C.getDescriptionId(e.context) : void 0
2990
+ });
2991
+ },
2992
+ getTitleProps() {
2993
+ return n.element({
2994
+ ...oe.title.attrs,
2995
+ dir: e.context.dir,
2996
+ id: C.getTitleId(e.context)
2997
+ });
2998
+ },
2999
+ getDescriptionProps() {
3000
+ return n.element({
3001
+ ...oe.description.attrs,
3002
+ dir: e.context.dir,
3003
+ id: C.getDescriptionId(e.context)
3004
+ });
3005
+ },
3006
+ getCloseTriggerProps() {
3007
+ return n.button({
3008
+ ...oe.closeTrigger.attrs,
3009
+ dir: e.context.dir,
3010
+ id: C.getCloseTriggerId(e.context),
3011
+ type: "button",
3012
+ onClick(c) {
3013
+ c.defaultPrevented || (c.stopPropagation(), t("CLOSE"));
3014
+ }
3015
+ });
3016
+ }
3017
+ };
3018
+ }
3019
+ function wi(e) {
3020
+ const t = ue(e);
3021
+ return Re(
3022
+ {
3023
+ id: "dialog",
3024
+ initial: t.open ? "open" : "closed",
3025
+ context: {
3026
+ role: "dialog",
3027
+ renderedElements: {
3028
+ title: !0,
3029
+ description: !0
3030
+ },
3031
+ modal: !0,
3032
+ trapFocus: !0,
3033
+ preventScroll: !0,
3034
+ closeOnInteractOutside: !0,
3035
+ closeOnEscape: !0,
3036
+ restoreFocus: !0,
3037
+ ...t
3038
+ },
3039
+ created: ["setAlertDialogProps"],
3040
+ watch: {
3041
+ open: ["toggleVisibility"]
3042
+ },
3043
+ states: {
3044
+ open: {
3045
+ entry: ["checkRenderedElements", "syncZIndex"],
3046
+ activities: ["trackDismissableElement", "trapFocus", "preventScroll", "hideContentBelow"],
3047
+ on: {
3048
+ "CONTROLLED.CLOSE": {
3049
+ target: "closed"
3050
+ },
3051
+ CLOSE: [
3052
+ {
3053
+ guard: "isOpenControlled",
3054
+ actions: ["invokeOnClose"]
3055
+ },
3056
+ {
3057
+ target: "closed",
3058
+ actions: ["invokeOnClose"]
3059
+ }
3060
+ ],
3061
+ TOGGLE: [
3062
+ {
3063
+ guard: "isOpenControlled",
3064
+ actions: ["invokeOnClose"]
3065
+ },
3066
+ {
3067
+ target: "closed",
3068
+ actions: ["invokeOnClose"]
3069
+ }
3070
+ ]
3071
+ }
3072
+ },
3073
+ closed: {
3074
+ on: {
3075
+ "CONTROLLED.OPEN": {
3076
+ target: "open"
3077
+ },
3078
+ OPEN: [
3079
+ {
3080
+ guard: "isOpenControlled",
3081
+ actions: ["invokeOnOpen"]
3082
+ },
3083
+ {
3084
+ target: "open",
3085
+ actions: ["invokeOnOpen"]
3086
+ }
3087
+ ],
3088
+ TOGGLE: [
3089
+ {
3090
+ guard: "isOpenControlled",
3091
+ actions: ["invokeOnOpen"]
3092
+ },
3093
+ {
3094
+ target: "open",
3095
+ actions: ["invokeOnOpen"]
3096
+ }
3097
+ ]
3098
+ }
3099
+ }
3100
+ }
3101
+ },
3102
+ {
3103
+ guards: {
3104
+ isOpenControlled: (n) => !!n["open.controlled"]
3105
+ },
3106
+ activities: {
3107
+ trackDismissableElement(n, s, { send: r }) {
3108
+ return ui(() => C.getContentEl(n), {
3109
+ defer: !0,
3110
+ pointerBlocking: n.modal,
3111
+ exclude: [C.getTriggerEl(n)],
3112
+ onInteractOutside(c) {
3113
+ var i;
3114
+ (i = n.onInteractOutside) == null || i.call(n, c), n.closeOnInteractOutside || c.preventDefault();
3115
+ },
3116
+ persistentElements: n.persistentElements,
3117
+ onFocusOutside: n.onFocusOutside,
3118
+ onPointerDownOutside: n.onPointerDownOutside,
3119
+ onEscapeKeyDown(c) {
3120
+ var i;
3121
+ (i = n.onEscapeKeyDown) == null || i.call(n, c), n.closeOnEscape || c.preventDefault();
3122
+ },
3123
+ onDismiss() {
3124
+ r({ type: "CLOSE", src: "interact-outside" });
3125
+ }
3126
+ });
3127
+ },
3128
+ preventScroll(n) {
3129
+ if (n.preventScroll)
3130
+ return Ti(C.getDoc(n));
3131
+ },
3132
+ trapFocus(n) {
3133
+ return !n.trapFocus || !n.modal ? void 0 : vi(() => C.getContentEl(n), {
3134
+ preventScroll: !0,
3135
+ returnFocusOnDeactivate: !!n.restoreFocus,
3136
+ initialFocus: n.initialFocusEl,
3137
+ setReturnFocus: (r) => {
3138
+ var o;
3139
+ return ((o = n.finalFocusEl) == null ? void 0 : o.call(n)) ?? r;
3140
+ }
3141
+ });
3142
+ },
3143
+ hideContentBelow(n) {
3144
+ return n.modal ? Jo(() => [C.getContentEl(n)], { defer: !0 }) : void 0;
3145
+ }
3146
+ },
3147
+ actions: {
3148
+ setAlertDialogProps(n) {
3149
+ n.role === "alertdialog" && (n.initialFocusEl || (n.initialFocusEl = () => C.getCloseTriggerEl(n)), n.closeOnInteractOutside = !1);
3150
+ },
3151
+ checkRenderedElements(n) {
3152
+ Y(() => {
3153
+ n.renderedElements.title = !!C.getTitleEl(n), n.renderedElements.description = !!C.getDescriptionEl(n);
3154
+ });
3155
+ },
3156
+ syncZIndex(n) {
3157
+ Y(() => {
3158
+ const s = C.getContentEl(n);
3159
+ if (!s) return;
3160
+ const r = zr(s);
3161
+ [C.getPositionerEl(n), C.getBackdropEl(n)].forEach((c) => {
3162
+ c == null || c.style.setProperty("--z-index", r.zIndex);
3163
+ });
3164
+ });
3165
+ },
3166
+ invokeOnClose(n) {
3167
+ var s;
3168
+ (s = n.onOpenChange) == null || s.call(n, { open: !1 });
3169
+ },
3170
+ invokeOnOpen(n) {
3171
+ var s;
3172
+ (s = n.onOpenChange) == null || s.call(n, { open: !0 });
3173
+ },
3174
+ toggleVisibility(n, s, { send: r }) {
3175
+ r({ type: n.open ? "CONTROLLED.OPEN" : "CONTROLLED.CLOSE", previousEvent: s });
3176
+ }
3177
+ }
3178
+ }
3179
+ );
3180
+ }
3181
+ kt()([
3182
+ "aria-label",
3183
+ "closeOnEscape",
3184
+ "closeOnInteractOutside",
3185
+ "dir",
3186
+ "finalFocusEl",
3187
+ "getRootNode",
3188
+ "getRootNode",
3189
+ "id",
3190
+ "id",
3191
+ "ids",
3192
+ "initialFocusEl",
3193
+ "modal",
3194
+ "onEscapeKeyDown",
3195
+ "onFocusOutside",
3196
+ "onInteractOutside",
3197
+ "onOpenChange",
3198
+ "onPointerDownOutside",
3199
+ "open.controlled",
3200
+ "open",
3201
+ "persistentElements",
3202
+ "preventScroll",
3203
+ "restoreFocus",
3204
+ "role",
3205
+ "trapFocus"
3206
+ ]);
3207
+ const Pi = (e = {}) => {
3208
+ const { getRootNode: t } = Mt(), { dir: n } = ts(), s = {
3209
+ id: mn(),
3210
+ getRootNode: t,
3211
+ dir: n,
3212
+ open: e.defaultOpen,
3213
+ "open.controlled": e.open !== void 0,
3214
+ ...e
3215
+ }, r = {
3216
+ ...s,
3217
+ open: e.open,
3218
+ onOpenChange: ke(e.onOpenChange, { sync: !0 }),
3219
+ onEscapeKeyDown: ke(e.onEscapeKeyDown),
3220
+ onInteractOutside: ke(e.onInteractOutside)
3221
+ }, [o, c] = et(wi(s), { context: r });
3222
+ return Ci(o, c, Le);
3223
+ }, xi = (e) => {
3224
+ const [t, { children: n, ...s }] = Ko(e), [r] = $o(t), o = Pi(s), c = ss(k({ present: o.open }, t));
3225
+ return /* @__PURE__ */ h(Go, { value: o, children: /* @__PURE__ */ h(_o, { value: r, children: /* @__PURE__ */ h(Uo, { value: c, children: n }) }) });
3226
+ }, ds = R((e, t) => {
3227
+ const n = fe(), s = k(n.getTitleProps(), e);
3228
+ return /* @__PURE__ */ h(F.h2, { ...s, ref: t });
3229
+ });
3230
+ ds.displayName = "DialogTitle";
3231
+ const fs = R((e, t) => {
3232
+ const n = fe(), s = _t(), r = k(
3233
+ {
3234
+ ...n.getTriggerProps(),
3235
+ "aria-controls": s.unmounted ? void 0 : n.getTriggerProps()["aria-controls"]
3236
+ },
3237
+ e
3238
+ );
3239
+ return /* @__PURE__ */ h(F.button, { ...r, ref: t });
3240
+ });
3241
+ fs.displayName = "DialogTrigger";
3242
+ const Oi = (e) => {
3243
+ var u;
3244
+ const { children: t, disabled: n } = e, [s, r] = dt((u = e.container) == null ? void 0 : u.current), o = hn(
3245
+ ki,
3246
+ () => !1,
3247
+ () => !0
3248
+ ), { getRootNode: c } = Mt();
3249
+ if (Ie(() => {
3250
+ r(() => {
3251
+ var a;
3252
+ return (a = e.container) == null ? void 0 : a.current;
3253
+ });
3254
+ }, [e.container]), o || n) return /* @__PURE__ */ h(ut, { children: t });
3255
+ const i = s ?? Si(c);
3256
+ return /* @__PURE__ */ h(ut, { children: gn.map(t, (a) => Os(a, i)) });
3257
+ }, Si = (e) => {
3258
+ const t = e == null ? void 0 : e(), n = t.getRootNode();
3259
+ return Ae(n) ? n : K(t).body;
3260
+ }, ki = () => () => {
3261
+ }, Ii = Je({}), Di = {
3262
+ sm: "max-w-sm",
3263
+ md: "max-w-md",
3264
+ lg: "max-w-lg",
3265
+ full: "max-w-full mx-4"
3266
+ };
3267
+ function Ai({
3268
+ open: e,
3269
+ onOpenChange: t,
3270
+ children: n,
3271
+ modal: s = !0,
3272
+ closeOnInteractOutside: r = !0,
3273
+ closeOnEscape: o = !0
3274
+ }) {
3275
+ return /* @__PURE__ */ h(
3276
+ xi,
3277
+ {
3278
+ open: e,
3279
+ onOpenChange: t,
3280
+ modal: s,
3281
+ closeOnInteractOutside: r,
3282
+ closeOnEscape: o,
3283
+ children: n
3284
+ }
3285
+ );
3286
+ }
3287
+ function Ri({
3288
+ children: e,
3289
+ className: t
3290
+ }) {
3291
+ return /* @__PURE__ */ h(fs, { className: t, children: e });
3292
+ }
3293
+ function Li({ children: e }) {
3294
+ return /* @__PURE__ */ h(Oi, { children: e });
3295
+ }
3296
+ function Fi({ className: e }) {
3297
+ return /* @__PURE__ */ h(
3298
+ rs,
3299
+ {
3300
+ className: E(
3301
+ "fixed inset-0 bg-black/50 backdrop-blur-sm",
3302
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
3303
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
3304
+ e
3305
+ ),
3306
+ style: { zIndex: 9999 }
3307
+ }
3308
+ );
3309
+ }
3310
+ function Mi({ children: e }) {
3311
+ return /* @__PURE__ */ h(
3312
+ cs,
3313
+ {
3314
+ className: "fixed inset-0 flex items-center justify-center p-4",
3315
+ style: { zIndex: 1e4 },
3316
+ children: e
3317
+ }
3318
+ );
3319
+ }
3320
+ function _i({
3321
+ children: e,
3322
+ size: t = "md",
3323
+ className: n
3324
+ }) {
3325
+ return /* @__PURE__ */ h(Ii.Provider, { value: { size: t }, children: /* @__PURE__ */ h(
3326
+ is,
3327
+ {
3328
+ className: E(
3329
+ "relative w-full rounded-lg bg-card text-card-foreground shadow-lg border border-border",
3330
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
3331
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
3332
+ "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
3333
+ "data-[state=closed]:slide-out-to-bottom-[2%] data-[state=open]:slide-in-from-bottom-[2%]",
3334
+ "duration-200",
3335
+ Di[t],
3336
+ n
3337
+ ),
3338
+ children: e
3339
+ }
3340
+ ) });
3341
+ }
3342
+ function Bi({
3343
+ children: e,
3344
+ className: t
3345
+ }) {
3346
+ return /* @__PURE__ */ h(
3347
+ "div",
3348
+ {
3349
+ className: E(
3350
+ "flex items-start justify-between gap-4 p-6 pb-4",
3351
+ t
3352
+ ),
3353
+ children: e
3354
+ }
3355
+ );
3356
+ }
3357
+ function $i({
3358
+ children: e,
3359
+ className: t
3360
+ }) {
3361
+ return /* @__PURE__ */ h(ds, { className: E("text-lg font-semibold text-foreground", t), children: e });
3362
+ }
3363
+ function Hi({
3364
+ children: e,
3365
+ className: t
3366
+ }) {
3367
+ return /* @__PURE__ */ h(as, { className: E("text-sm text-muted-foreground", t), children: e });
3368
+ }
3369
+ function ji({
3370
+ children: e,
3371
+ className: t
3372
+ }) {
3373
+ return /* @__PURE__ */ h("div", { className: E("px-6 py-4", t), children: e });
3374
+ }
3375
+ function Vi({
3376
+ children: e,
3377
+ className: t
3378
+ }) {
3379
+ return /* @__PURE__ */ h("div", { className: E("flex justify-end gap-2 p-6 pt-4", t), children: e });
3380
+ }
3381
+ function Gi({
3382
+ className: e
3383
+ }) {
3384
+ return /* @__PURE__ */ h(
3385
+ os,
3386
+ {
3387
+ className: E(
3388
+ "absolute right-4 top-4 rounded-md p-2 text-muted-foreground",
3389
+ "hover:bg-secondary hover:text-foreground",
3390
+ "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
3391
+ "disabled:pointer-events-none",
3392
+ "transition-colors",
3393
+ e
3394
+ ),
3395
+ "aria-label": "Close dialog",
3396
+ children: /* @__PURE__ */ h(yn, { className: "h-4 w-4" })
3397
+ }
3398
+ );
3399
+ }
3400
+ const Ga = {
3401
+ Root: Ai,
3402
+ Trigger: Ri,
3403
+ Portal: Li,
3404
+ Backdrop: Fi,
3405
+ Positioner: Mi,
3406
+ Content: _i,
3407
+ Header: Bi,
3408
+ Title: $i,
3409
+ Description: Hi,
3410
+ Body: ji,
3411
+ Footer: Vi,
3412
+ CloseTrigger: Gi
3413
+ };
3414
+ function Ua({ className: e, type: t = "text", label: n, id: s, ...r }) {
3415
+ const o = /* @__PURE__ */ h(
3416
+ "input",
3417
+ {
3418
+ id: s,
3419
+ type: t,
3420
+ className: E(
3421
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
3422
+ "ring-offset-background",
3423
+ "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
3424
+ "placeholder:text-muted-foreground",
3425
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
3426
+ "disabled:cursor-not-allowed disabled:opacity-50",
3427
+ e
3428
+ ),
3429
+ ...r
3430
+ }
3431
+ );
3432
+ return n ? /* @__PURE__ */ I("div", { className: "w-full", children: [
3433
+ /* @__PURE__ */ h("label", { htmlFor: s, className: "block text-sm font-medium mb-1.5 text-card-foreground", children: n }),
3434
+ o
3435
+ ] }) : o;
3436
+ }
3437
+ const Ui = {
3438
+ default: "bg-primary",
3439
+ success: "bg-green-600",
3440
+ warning: "bg-yellow-600",
3441
+ error: "bg-destructive"
3442
+ }, Ki = {
3443
+ sm: "h-1",
3444
+ md: "h-2",
3445
+ lg: "h-3"
3446
+ };
3447
+ function Ka({
3448
+ value: e = 0,
3449
+ indeterminate: t = !1,
3450
+ label: n,
3451
+ showValue: s = !1,
3452
+ variant: r = "default",
3453
+ size: o = "md",
3454
+ className: c
3455
+ }) {
3456
+ const i = Math.min(100, Math.max(0, e));
3457
+ return /* @__PURE__ */ I("div", { className: E("w-full", c), children: [
3458
+ (n || s) && /* @__PURE__ */ I("div", { className: "flex justify-between items-center mb-2", children: [
3459
+ n && /* @__PURE__ */ h("span", { className: "text-sm font-medium", children: n }),
3460
+ s && !t && /* @__PURE__ */ I("span", { className: "text-sm text-muted-foreground", children: [
3461
+ i,
3462
+ "%"
3463
+ ] })
3464
+ ] }),
3465
+ /* @__PURE__ */ h(
3466
+ "div",
3467
+ {
3468
+ className: E(
3469
+ "w-full overflow-hidden rounded-full bg-muted",
3470
+ Ki[o]
3471
+ ),
3472
+ role: "progressbar",
3473
+ "aria-valuenow": t ? void 0 : i,
3474
+ "aria-valuemin": 0,
3475
+ "aria-valuemax": 100,
3476
+ "aria-label": n || "Progress",
3477
+ children: /* @__PURE__ */ h(
3478
+ "div",
3479
+ {
3480
+ className: E(
3481
+ "h-full rounded-full transition-all duration-500 ease-out",
3482
+ Ui[r],
3483
+ t && "animate-pulse w-full"
3484
+ ),
3485
+ style: {
3486
+ width: t ? "100%" : `${i}%`
3487
+ }
3488
+ }
3489
+ )
3490
+ }
3491
+ )
3492
+ ] });
3493
+ }
3494
+ const hs = Je({});
3495
+ function Wi({
3496
+ children: e,
3497
+ variant: t = "default",
3498
+ interactive: n = !1,
3499
+ className: s
3500
+ }) {
3501
+ return /* @__PURE__ */ h(hs.Provider, { value: { variant: t, interactive: n }, children: /* @__PURE__ */ h("div", { className: E("relative w-full overflow-x-auto", s), children: /* @__PURE__ */ h("table", { className: "w-full caption-bottom text-sm", children: e }) }) });
3502
+ }
3503
+ function zi({ children: e, className: t }) {
3504
+ return /* @__PURE__ */ h("thead", { className: E("[&_tr]:border-b", t), children: e });
3505
+ }
3506
+ function qi({ children: e, className: t }) {
3507
+ return /* @__PURE__ */ h("tbody", { className: E("[&_tr:last-child]:border-0", t), children: e });
3508
+ }
3509
+ function Yi({ children: e, onClick: t, selected: n = !1, className: s }) {
3510
+ const { interactive: r } = fn(hs);
3511
+ return /* @__PURE__ */ h(
3512
+ "tr",
3513
+ {
3514
+ className: E(
3515
+ "border-b transition-colors",
3516
+ (t || r) && "cursor-pointer hover:bg-muted/50 data-[state=selected]:bg-muted",
3517
+ n && "bg-muted",
3518
+ s
3519
+ ),
3520
+ onClick: t,
3521
+ role: t ? "button" : void 0,
3522
+ tabIndex: t ? 0 : void 0,
3523
+ "data-state": n ? "selected" : void 0,
3524
+ onKeyDown: (c) => {
3525
+ t && (c.key === "Enter" || c.key === " ") && (c.preventDefault(), t());
3526
+ },
3527
+ children: e
3528
+ }
3529
+ );
3530
+ }
3531
+ function Xi({
3532
+ children: e,
3533
+ align: t = "left",
3534
+ sortable: n = !1,
3535
+ sorted: s = !1,
3536
+ onSort: r,
3537
+ className: o
3538
+ }) {
3539
+ const c = () => {
3540
+ n && r && r();
3541
+ };
3542
+ return /* @__PURE__ */ h(
3543
+ "th",
3544
+ {
3545
+ className: E(
3546
+ "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
3547
+ t === "center" && "text-center",
3548
+ t === "right" && "text-right",
3549
+ n && "cursor-pointer select-none hover:bg-muted/50 transition-colors",
3550
+ o
3551
+ ),
3552
+ onClick: c,
3553
+ role: n ? "button" : void 0,
3554
+ tabIndex: n ? 0 : void 0,
3555
+ "aria-sort": s ? s === "asc" ? "ascending" : "descending" : void 0,
3556
+ onKeyDown: (i) => {
3557
+ n && r && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), r());
3558
+ },
3559
+ children: /* @__PURE__ */ I(
3560
+ "div",
3561
+ {
3562
+ className: E(
3563
+ "flex items-center gap-2",
3564
+ t === "center" && "justify-center",
3565
+ t === "right" && "justify-end"
3566
+ ),
3567
+ children: [
3568
+ e,
3569
+ n && /* @__PURE__ */ h("span", { className: "text-xs", "aria-hidden": "true", children: s === "asc" ? "↑" : s === "desc" ? "↓" : "↕" })
3570
+ ]
3571
+ }
3572
+ )
3573
+ }
3574
+ );
3575
+ }
3576
+ function Zi({ children: e, align: t = "left", className: n }) {
3577
+ return /* @__PURE__ */ h(
3578
+ "td",
3579
+ {
3580
+ className: E(
3581
+ "p-4 align-middle [&:has([role=checkbox])]:pr-0",
3582
+ t === "center" && "text-center",
3583
+ t === "right" && "text-right",
3584
+ n
3585
+ ),
3586
+ children: e
3587
+ }
3588
+ );
3589
+ }
3590
+ function Ji({ children: e, className: t }) {
3591
+ return /* @__PURE__ */ h("tfoot", { className: E("border-t font-medium", t), children: e });
3592
+ }
3593
+ function Qi({ children: e, className: t }) {
3594
+ return /* @__PURE__ */ h("caption", { className: E("mt-4 text-sm text-muted-foreground", t), children: e });
3595
+ }
3596
+ const B = {
3597
+ Root: Wi,
3598
+ Header: zi,
3599
+ Body: qi,
3600
+ Row: Yi,
3601
+ HeadCell: Xi,
3602
+ Cell: Zi,
3603
+ Footer: Ji,
3604
+ Caption: Qi
3605
+ };
3606
+ function Wa({
3607
+ products: e,
3608
+ isLoading: t = !1,
3609
+ isError: n = !1,
3610
+ error: s,
3611
+ onRefresh: r,
3612
+ onProductClick: o,
3613
+ className: c,
3614
+ currency: i = "USD",
3615
+ sortField: u,
3616
+ sortDirection: a,
3617
+ onSort: l
3618
+ }) {
3619
+ const [d, f] = dt("name"), [p, g] = dt("asc"), m = u ?? d, w = a ?? p, v = (P) => {
3620
+ const D = m === P && w === "asc" ? "desc" : "asc";
3621
+ l ? l(P, D) : (f(P), g(D));
3622
+ }, O = [...e].sort((P, D) => {
3623
+ let b = 0;
3624
+ switch (m) {
3625
+ case "name":
3626
+ b = P.name.localeCompare(D.name);
3627
+ break;
3628
+ case "price":
3629
+ b = P.price - D.price;
3630
+ break;
3631
+ case "expiration":
3632
+ b = new Date(P.expiration).getTime() - new Date(D.expiration).getTime();
3633
+ break;
3634
+ }
3635
+ return w === "asc" ? b : -b;
3636
+ }), N = (P) => new Intl.NumberFormat("en-US", {
3637
+ style: "currency",
3638
+ currency: i || "USD"
3639
+ }).format(P), X = (P) => new Intl.DateTimeFormat("en-US", {
3640
+ year: "numeric",
3641
+ month: "short",
3642
+ day: "numeric"
3643
+ }).format(new Date(P));
3644
+ return n ? /* @__PURE__ */ I("div", { className: "flex flex-col items-center justify-center gap-4 p-8 border rounded-lg text-center", children: [
3645
+ /* @__PURE__ */ h("h3", { className: "text-2xl font-semibold", children: "Error Loading Products" }),
3646
+ /* @__PURE__ */ h("p", { className: "text-sm max-w-md", children: (s == null ? void 0 : s.message) || "Failed to load products" }),
3647
+ r && /* @__PURE__ */ h(Vt, { onClick: r, variant: "default", children: "Retry" })
3648
+ ] }) : /* @__PURE__ */ I("div", { className: E("w-full", c), children: [
3649
+ r && /* @__PURE__ */ I("div", { className: "flex items-center justify-between py-4 mb-4 border-b", children: [
3650
+ /* @__PURE__ */ h("h2", { className: "text-2xl font-semibold", children: "Products Catalog" }),
3651
+ /* @__PURE__ */ h(Vt, { onClick: r, variant: "ghost", size: "sm", loading: t, children: "Refresh" })
3652
+ ] }),
3653
+ /* @__PURE__ */ I(B.Root, { variant: "bordered", interactive: !0, children: [
3654
+ /* @__PURE__ */ h(B.Header, { children: /* @__PURE__ */ I(B.Row, { children: [
3655
+ /* @__PURE__ */ h(
3656
+ B.HeadCell,
3657
+ {
3658
+ sortable: !0,
3659
+ sorted: m === "name" ? w : !1,
3660
+ onSort: () => v("name"),
3661
+ children: "Product Name"
3662
+ }
3663
+ ),
3664
+ /* @__PURE__ */ h(
3665
+ B.HeadCell,
3666
+ {
3667
+ align: "right",
3668
+ sortable: !0,
3669
+ sorted: m === "price" ? w : !1,
3670
+ onSort: () => v("price"),
3671
+ children: "Price"
3672
+ }
3673
+ ),
3674
+ /* @__PURE__ */ h(
3675
+ B.HeadCell,
3676
+ {
3677
+ align: "right",
3678
+ sortable: !0,
3679
+ sorted: m === "expiration" ? w : !1,
3680
+ onSort: () => v("expiration"),
3681
+ children: "Expiration Date"
3682
+ }
3683
+ )
3684
+ ] }) }),
3685
+ /* @__PURE__ */ h(B.Body, { children: t ? /* @__PURE__ */ h(B.Row, { children: /* @__PURE__ */ h(B.Cell, { align: "center", className: "py-8 text-center italic", children: "Loading products..." }) }) : O.length === 0 ? /* @__PURE__ */ h(B.Row, { children: /* @__PURE__ */ h(B.Cell, { align: "center", className: "py-8 text-center text-muted-foreground italic", children: "No products found" }) }) : O.map((P) => /* @__PURE__ */ I(
3686
+ B.Row,
3687
+ {
3688
+ onClick: o ? () => o(P) : void 0,
3689
+ children: [
3690
+ /* @__PURE__ */ h(B.Cell, { children: P.name }),
3691
+ /* @__PURE__ */ h(B.Cell, { align: "right", className: "font-medium", children: (() => {
3692
+ var b;
3693
+ if (i === "USD") return N(P.price);
3694
+ const D = (b = P.rates) == null ? void 0 : b.find((T) => T.currency === i);
3695
+ return N(D ? D.convertedPrice : P.price);
3696
+ })() }),
3697
+ /* @__PURE__ */ h(B.Cell, { align: "right", children: X(P.expiration) })
3698
+ ]
3699
+ },
3700
+ P.id
3701
+ )) })
3702
+ ] })
3703
+ ] });
3704
+ }
3705
+ function ea({ children: e, className: t }) {
3706
+ return /* @__PURE__ */ h(H.Positioner, { style: { zIndex: 9999 }, children: /* @__PURE__ */ h(
3707
+ H.Content,
3708
+ {
3709
+ style: { backgroundColor: "white", zIndex: 9999 },
3710
+ className: E(
3711
+ "w-full mt-1 max-h-60 overflow-auto rounded-md border border-gray-200 shadow-lg",
3712
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
3713
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
3714
+ "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
3715
+ t
3716
+ ),
3717
+ children: e
3718
+ }
3719
+ ) });
3720
+ }
3721
+ function ta() {
3722
+ return /* @__PURE__ */ h(H.HiddenSelect, {});
3723
+ }
3724
+ function na({ className: e, children: t, ...n }) {
3725
+ return /* @__PURE__ */ I(
3726
+ H.Item,
3727
+ {
3728
+ className: E(
3729
+ "relative flex cursor-pointer items-center gap-2 px-3 py-2 text-sm outline-none",
3730
+ "hover:bg-gray-100",
3731
+ "data-[highlighted]:bg-gray-100",
3732
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
3733
+ e
3734
+ ),
3735
+ ...n,
3736
+ children: [
3737
+ /* @__PURE__ */ h(H.ItemText, { children: t }),
3738
+ /* @__PURE__ */ h(H.ItemIndicator, { className: "ml-auto", children: /* @__PURE__ */ h(Ss, { className: "h-2 w-2 text-blue-600" }) })
3739
+ ]
3740
+ }
3741
+ );
3742
+ }
3743
+ function sa({ className: e, children: t, ...n }) {
3744
+ return /* @__PURE__ */ h(H.ItemGroup, { className: E("py-1", e), ...n, children: t });
3745
+ }
3746
+ function ra({ className: e, children: t, ...n }) {
3747
+ return /* @__PURE__ */ h(
3748
+ H.ItemGroupLabel,
3749
+ {
3750
+ className: E("px-3 py-1.5 text-xs font-semibold text-gray-500", e),
3751
+ ...n,
3752
+ children: t
3753
+ }
3754
+ );
3755
+ }
3756
+ function oa({ children: e, className: t }) {
3757
+ return /* @__PURE__ */ h(H.Label, { className: E("mb-1 block text-sm font-medium text-gray-700", t), children: e });
3758
+ }
3759
+ const ia = Je({});
3760
+ function aa(e) {
3761
+ const { items: t, ...n } = e, s = ze(() => Ls({ items: t }), [t]);
3762
+ return /* @__PURE__ */ h(ia.Provider, { value: {}, children: /* @__PURE__ */ h(H.Root, { collection: s, positioning: { sameWidth: !0 }, ...n }) });
3763
+ }
3764
+ function ca({ className: e, placeholder: t }) {
3765
+ return /* @__PURE__ */ I(
3766
+ H.Control,
3767
+ {
3768
+ className: E(
3769
+ "flex items-center justify-between gap-2 rounded-md border border-gray-300 bg-white px-3 py-2 text-sm",
3770
+ "hover:border-gray-400",
3771
+ "focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500",
3772
+ "disabled:cursor-not-allowed disabled:opacity-50",
3773
+ e
3774
+ ),
3775
+ children: [
3776
+ /* @__PURE__ */ h(H.Trigger, { className: "flex flex-1 items-center gap-2", children: /* @__PURE__ */ h(H.ValueText, { placeholder: t || "Select an option" }) }),
3777
+ /* @__PURE__ */ h(H.Indicator, { children: /* @__PURE__ */ h(ks, { className: "h-4 w-4 text-gray-500" }) })
3778
+ ]
3779
+ }
3780
+ );
3781
+ }
3782
+ const za = {
3783
+ Root: aa,
3784
+ Label: oa,
3785
+ Trigger: ca,
3786
+ Content: ea,
3787
+ Item: na,
3788
+ ItemGroup: sa,
3789
+ ItemGroupLabel: ra,
3790
+ HiddenSelect: ta
3791
+ };
3792
+ var la = ye("toast").parts(
3793
+ "group",
3794
+ "root",
3795
+ "title",
3796
+ "description",
3797
+ "actionTrigger",
3798
+ "closeTrigger"
3799
+ ), ge = la.build(), _ = Ft({
3800
+ getRegionId: (e) => `toast-group:${e}`,
3801
+ getRegionEl: (e, t) => _.getById(e, `toast-group:${t}`),
3802
+ getRootId: (e) => `toast:${e.id}`,
3803
+ getRootEl: (e) => _.getById(e, _.getRootId(e)),
3804
+ getTitleId: (e) => `toast:${e.id}:title`,
3805
+ getDescriptionId: (e) => `toast:${e.id}:description`,
3806
+ getCloseTriggerId: (e) => `toast${e.id}:close`
3807
+ });
3808
+ function Bt(e, t) {
3809
+ return e.filter((n) => n.state.context.placement === t);
3810
+ }
3811
+ var un = {
3812
+ info: 5e3,
3813
+ error: 5e3,
3814
+ success: 2e3,
3815
+ loading: 1 / 0,
3816
+ DEFAULT: 5e3
3817
+ };
3818
+ function dn(e, t) {
3819
+ return e ?? un[t] ?? un.DEFAULT;
3820
+ }
3821
+ function ua(e, t) {
3822
+ var l;
3823
+ const n = e.offsets, s = typeof n == "string" ? { left: n, right: n, bottom: n, top: n } : n, r = e.dir === "rtl", o = t.replace("-start", r ? "-right" : "-left").replace("-end", r ? "-left" : "-right"), c = o.includes("right"), i = o.includes("left"), u = {
3824
+ position: "fixed",
3825
+ pointerEvents: e.count > 0 ? void 0 : "none",
3826
+ display: "flex",
3827
+ flexDirection: "column",
3828
+ "--gap": `${e.gap}px`,
3829
+ "--first-height": `${((l = e.heights[0]) == null ? void 0 : l.height) || 0}px`,
3830
+ zIndex: Lr
3831
+ };
3832
+ let a = "center";
3833
+ if (c && (a = "flex-end"), i && (a = "flex-start"), u.alignItems = a, o.includes("top")) {
3834
+ const d = s.top;
3835
+ u.top = `max(env(safe-area-inset-top, 0px), ${d})`;
3836
+ }
3837
+ if (o.includes("bottom")) {
3838
+ const d = s.bottom;
3839
+ u.bottom = `max(env(safe-area-inset-bottom, 0px), ${d})`;
3840
+ }
3841
+ if (!o.includes("left")) {
3842
+ const d = s.right;
3843
+ u.insetInlineEnd = `calc(env(safe-area-inset-right, 0px) + ${d})`;
3844
+ }
3845
+ if (!o.includes("right")) {
3846
+ const d = s.left;
3847
+ u.insetInlineStart = `calc(env(safe-area-inset-left, 0px) + ${d})`;
3848
+ }
3849
+ return u;
3850
+ }
3851
+ function da(e, t) {
3852
+ const [n] = e.placement.split("-"), s = !e.frontmost, r = !e.stacked, o = {
3853
+ position: "absolute",
3854
+ pointerEvents: "auto",
3855
+ "--opacity": "0",
3856
+ "--remove-delay": `${e.removeDelay}ms`,
3857
+ "--duration": `${e.type === "loading" ? Number.MAX_SAFE_INTEGER : e.duration}ms`,
3858
+ "--initial-height": `${e.height}px`,
3859
+ "--offset": `${e.offset}px`,
3860
+ "--index": e.index,
3861
+ "--z-index": e.zIndex,
3862
+ "--lift-amount": "calc(var(--lift) * var(--gap))",
3863
+ "--y": "100%",
3864
+ "--x": "0"
3865
+ }, c = (i) => Object.assign(o, i);
3866
+ return n === "top" ? c({
3867
+ top: "0",
3868
+ "--sign": "-1",
3869
+ "--y": "-100%",
3870
+ "--lift": "1"
3871
+ }) : n === "bottom" && c({
3872
+ bottom: "0",
3873
+ "--sign": "1",
3874
+ "--y": "100%",
3875
+ "--lift": "-1"
3876
+ }), e.mounted && (c({
3877
+ "--y": "0",
3878
+ "--opacity": "1"
3879
+ }), e.stacked && c({
3880
+ "--y": "calc(var(--lift) * var(--offset))",
3881
+ "--height": "var(--initial-height)"
3882
+ })), t || c({
3883
+ "--opacity": "0",
3884
+ pointerEvents: "none"
3885
+ }), s && r && (c({
3886
+ "--base-scale": "var(--index) * 0.05 + 1",
3887
+ "--y": "calc(var(--lift-amount) * var(--index))",
3888
+ "--scale": "calc(-1 * var(--base-scale))",
3889
+ "--height": "var(--first-height)"
3890
+ }), t || c({
3891
+ "--y": "calc(var(--sign) * 40%)"
3892
+ })), s && e.stacked && !t && c({
3893
+ "--y": "calc(var(--lift) * var(--offset) + var(--lift) * -100%)"
3894
+ }), e.frontmost && !t && c({
3895
+ "--y": "calc(var(--lift) * -100%)"
3896
+ }), o;
3897
+ }
3898
+ function fa(e, t) {
3899
+ const n = {
3900
+ position: "absolute",
3901
+ inset: "0",
3902
+ scale: "1 2",
3903
+ pointerEvents: t ? "none" : "auto"
3904
+ }, s = (r) => Object.assign(n, r);
3905
+ return e.frontmost && !t && s({
3906
+ height: "calc(var(--initial-height) + 80%)"
3907
+ }), n;
3908
+ }
3909
+ function ha(e, t) {
3910
+ return {
3911
+ position: "absolute",
3912
+ left: "0",
3913
+ height: "calc(var(--gap) + 2px)",
3914
+ bottom: "100%",
3915
+ width: "100%"
3916
+ };
3917
+ }
3918
+ function pa(e, t, n) {
3919
+ function s() {
3920
+ return gr(e) ? e.getState() : e;
3921
+ }
3922
+ function r(l) {
3923
+ return Bt(s().context.toasts, l);
3924
+ }
3925
+ function o(l) {
3926
+ const d = s().context.toasts;
3927
+ return d.length ? !!d.find((f) => f.id == l) : !1;
3928
+ }
3929
+ function c(l) {
3930
+ const d = `toast:${yt()}`, f = l.id ? l.id : d;
3931
+ return o(f) || t({ type: "ADD_TOAST", toast: { ...l, id: f } }), f;
3932
+ }
3933
+ function i(l, d) {
3934
+ return o(l) && t({ type: "UPDATE_TOAST", id: l, toast: d }), l;
3935
+ }
3936
+ function u(l) {
3937
+ const { id: d } = l;
3938
+ return (d ? o(d) : !1) && d != null ? i(d, l) : c(l);
3939
+ }
3940
+ function a(l) {
3941
+ l == null ? t("DISMISS_ALL") : o(l) && t({ type: "DISMISS_TOAST", id: l });
3942
+ }
3943
+ return {
3944
+ getCount() {
3945
+ return s().context.count;
3946
+ },
3947
+ getPlacements() {
3948
+ const d = s().context.toasts.map((f) => f.state.context.placement);
3949
+ return Array.from(new Set(d));
3950
+ },
3951
+ getToastsByPlacement: r,
3952
+ isVisible: o,
3953
+ create: c,
3954
+ update: i,
3955
+ upsert: u,
3956
+ dismiss: a,
3957
+ remove(l) {
3958
+ l == null ? t("REMOVE_ALL") : o(l) && t({ type: "REMOVE_TOAST", id: l });
3959
+ },
3960
+ dismissByPlacement(l) {
3961
+ r(l).forEach((f) => a(f.id));
3962
+ },
3963
+ loading(l) {
3964
+ return u({ ...l, type: "loading" });
3965
+ },
3966
+ success(l) {
3967
+ return u({ ...l, type: "success" });
3968
+ },
3969
+ error(l) {
3970
+ return u({ ...l, type: "error" });
3971
+ },
3972
+ promise(l, d, f = {}) {
3973
+ const p = u({ ...f, ...d.loading, type: "loading" });
3974
+ return Oe(l).then((g) => {
3975
+ const m = Oe(d.success, g);
3976
+ u({ ...f, ...m, id: p, type: "success" });
3977
+ }).catch((g) => {
3978
+ const m = Oe(d.error, g);
3979
+ u({ ...f, ...m, id: p, type: "error" });
3980
+ }).finally(() => {
3981
+ var g;
3982
+ (g = d.finally) == null || g.call(d);
3983
+ }), p;
3984
+ },
3985
+ pause(l) {
3986
+ l == null ? t("PAUSE_ALL") : o(l) && t({ type: "PAUSE_TOAST", id: l });
3987
+ },
3988
+ resume(l) {
3989
+ l == null ? t("RESUME_ALL") : o(l) && t({ type: "RESUME_TOAST", id: l });
3990
+ },
3991
+ getGroupProps(l) {
3992
+ const { placement: d, label: f = "Notifications" } = l, p = s(), g = p.context.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, ""), [m, w = "center"] = d.split("-");
3993
+ return n.element({
3994
+ ...ge.group.attrs,
3995
+ dir: p.context.dir,
3996
+ tabIndex: -1,
3997
+ "aria-label": `${d} ${f} ${g}`,
3998
+ id: _.getRegionId(d),
3999
+ "data-placement": d,
4000
+ "data-side": m,
4001
+ "data-align": w,
4002
+ "aria-live": "polite",
4003
+ role: "region",
4004
+ style: ua(p.context, d),
4005
+ onMouseMove() {
4006
+ t({ type: "REGION.POINTER_ENTER", placement: d });
4007
+ },
4008
+ onMouseLeave() {
4009
+ t({ type: "REGION.POINTER_LEAVE", placement: d });
4010
+ },
4011
+ onFocus(v) {
4012
+ t({ type: "REGION.FOCUS", target: v.relatedTarget });
4013
+ },
4014
+ onBlur(v) {
4015
+ p.context.isFocusWithin && !be(v.currentTarget, v.relatedTarget) && t({ type: "REGION.BLUR" });
4016
+ }
4017
+ });
4018
+ },
4019
+ subscribe(l) {
4020
+ const d = s();
4021
+ return Ye(d.context.toasts, () => {
4022
+ const p = r(d.context.placement).map((g) => g.getState().context);
4023
+ l(p);
4024
+ });
4025
+ }
4026
+ };
4027
+ }
4028
+ var { not: ga, and: ma, or: ya } = Rn;
4029
+ function va(e) {
4030
+ const { type: t = "info", duration: n, id: s = "1", placement: r = "bottom", removeDelay: o = 200, ...c } = e, i = ue(c), u = dn(n, t);
4031
+ return Re(
4032
+ {
4033
+ id: s,
4034
+ context: {
4035
+ id: s,
4036
+ type: t,
4037
+ remaining: u,
4038
+ duration: u,
4039
+ removeDelay: o,
4040
+ createdAt: Date.now(),
4041
+ placement: r,
4042
+ ...i,
4043
+ height: 0,
4044
+ offset: 0,
4045
+ frontmost: !1,
4046
+ mounted: !1,
4047
+ index: -1,
4048
+ zIndex: 0
4049
+ },
4050
+ initial: t === "loading" ? "visible:persist" : "visible",
4051
+ on: {
4052
+ UPDATE: [
4053
+ {
4054
+ guard: ma("hasTypeChanged", "isChangingToLoading"),
4055
+ target: "visible:persist",
4056
+ actions: ["setContext"]
4057
+ },
4058
+ {
4059
+ guard: ya("hasDurationChanged", "hasTypeChanged"),
4060
+ target: "visible:updating",
4061
+ actions: ["setContext"]
4062
+ },
4063
+ {
4064
+ actions: ["setContext"]
4065
+ }
4066
+ ],
4067
+ MEASURE: {
4068
+ actions: ["measureHeight"]
4069
+ }
4070
+ },
4071
+ entry: ["invokeOnVisible"],
4072
+ activities: ["trackHeight"],
4073
+ states: {
4074
+ "visible:updating": {
4075
+ tags: ["visible", "updating"],
4076
+ after: {
4077
+ 0: "visible"
4078
+ }
4079
+ },
4080
+ "visible:persist": {
4081
+ tags: ["visible", "paused"],
4082
+ on: {
4083
+ RESUME: {
4084
+ guard: ga("isLoadingType"),
4085
+ target: "visible",
4086
+ actions: ["setCreatedAt"]
4087
+ },
4088
+ DISMISS: "dismissing"
4089
+ }
4090
+ },
4091
+ visible: {
4092
+ tags: ["visible"],
4093
+ after: {
4094
+ VISIBLE_DURATION: "dismissing"
4095
+ },
4096
+ on: {
4097
+ DISMISS: "dismissing",
4098
+ PAUSE: {
4099
+ target: "visible:persist",
4100
+ actions: "setRemainingDuration"
4101
+ }
4102
+ }
4103
+ },
4104
+ dismissing: {
4105
+ entry: "invokeOnDismiss",
4106
+ after: {
4107
+ REMOVE_DELAY: {
4108
+ target: "unmounted",
4109
+ actions: "notifyParentToRemove"
4110
+ }
4111
+ }
4112
+ },
4113
+ unmounted: {
4114
+ entry: "invokeOnUnmount",
4115
+ type: "final"
4116
+ }
4117
+ }
4118
+ },
4119
+ {
4120
+ activities: {
4121
+ trackHeight(a, l, { self: d }) {
4122
+ let f;
4123
+ return Y(() => {
4124
+ const p = _.getRootEl(a);
4125
+ if (!p) return;
4126
+ a.mounted = !0;
4127
+ const g = go(p, "[data-ghost]");
4128
+ me(
4129
+ g.length !== 2,
4130
+ "[toast] No ghost element found in toast. Render the `ghostBefore` and `ghostAfter` elements"
4131
+ );
4132
+ const m = () => {
4133
+ const O = p.style.height;
4134
+ p.style.height = "auto";
4135
+ const N = p.getBoundingClientRect().height;
4136
+ p.style.height = O, a.height = N, d.sendParent({ type: "UPDATE_HEIGHT", id: d.id, height: N, placement: a.placement });
4137
+ };
4138
+ m();
4139
+ const w = _.getWin(a), v = new w.MutationObserver(m);
4140
+ v.observe(p, { childList: !0, subtree: !0, characterData: !0 }), f = () => v.disconnect();
4141
+ }), () => f == null ? void 0 : f();
4142
+ }
4143
+ },
4144
+ guards: {
4145
+ isChangingToLoading: (a, l) => {
4146
+ var d;
4147
+ return ((d = l.toast) == null ? void 0 : d.type) === "loading";
4148
+ },
4149
+ isLoadingType: (a) => a.type === "loading",
4150
+ hasTypeChanged: (a, l) => {
4151
+ var d;
4152
+ return ((d = l.toast) == null ? void 0 : d.type) != null && l.toast.type !== a.type;
4153
+ },
4154
+ hasDurationChanged: (a, l) => {
4155
+ var d;
4156
+ return ((d = l.toast) == null ? void 0 : d.duration) != null && l.toast.duration !== a.duration;
4157
+ }
4158
+ },
4159
+ delays: {
4160
+ VISIBLE_DURATION: (a) => a.remaining,
4161
+ REMOVE_DELAY: (a) => a.removeDelay
4162
+ },
4163
+ actions: {
4164
+ measureHeight(a, l, { self: d }) {
4165
+ Y(() => {
4166
+ const f = _.getRootEl(a);
4167
+ if (!f) return;
4168
+ a.mounted = !0;
4169
+ const p = f.style.height;
4170
+ f.style.height = "auto";
4171
+ const g = f.getBoundingClientRect().height;
4172
+ f.style.height = p, a.height = g, d.sendParent({ type: "UPDATE_HEIGHT", id: d.id, height: g, placement: a.placement });
4173
+ });
4174
+ },
4175
+ setRemainingDuration(a) {
4176
+ a.remaining -= Date.now() - a.createdAt;
4177
+ },
4178
+ setCreatedAt(a) {
4179
+ a.createdAt = Date.now();
4180
+ },
4181
+ notifyParentToRemove(a, l, { self: d }) {
4182
+ d.sendParent({ type: "REMOVE_TOAST", id: d.id });
4183
+ },
4184
+ invokeOnDismiss(a) {
4185
+ var l;
4186
+ (l = a.onStatusChange) == null || l.call(a, { status: "dismissing" });
4187
+ },
4188
+ invokeOnUnmount(a) {
4189
+ var l;
4190
+ (l = a.onStatusChange) == null || l.call(a, { status: "unmounted" });
4191
+ },
4192
+ invokeOnVisible(a) {
4193
+ var l;
4194
+ (l = a.onStatusChange) == null || l.call(a, { status: "visible" });
4195
+ },
4196
+ setContext(a, l) {
4197
+ var g, m;
4198
+ const d = (g = l.toast) == null ? void 0 : g.duration, f = ((m = l.toast) == null ? void 0 : m.type) ?? a.type, p = dn(d, f);
4199
+ Object.assign(a, {
4200
+ ...l.toast,
4201
+ duration: p,
4202
+ remaining: p
4203
+ });
4204
+ }
4205
+ }
4206
+ }
4207
+ );
4208
+ }
4209
+ function ba(e) {
4210
+ const t = ue(e);
4211
+ return Re(
4212
+ {
4213
+ id: "toaster",
4214
+ initial: t.overlap ? "overlap" : "stack",
4215
+ context: {
4216
+ dir: "ltr",
4217
+ max: Number.MAX_SAFE_INTEGER,
4218
+ gap: 16,
4219
+ pauseOnPageIdle: !1,
4220
+ hotkey: ["altKey", "KeyT"],
4221
+ offsets: "1rem",
4222
+ placement: "bottom",
4223
+ removeDelay: 200,
4224
+ ...t,
4225
+ toasts: [],
4226
+ lastFocusedEl: null,
4227
+ isFocusWithin: !1,
4228
+ heights: []
4229
+ },
4230
+ computed: {
4231
+ count: (n) => n.toasts.length
4232
+ },
4233
+ activities: ["trackDocumentVisibility", "trackHotKeyPress"],
4234
+ watch: {
4235
+ toasts: ["collapsedIfEmpty", "setDismissableBranch"]
4236
+ },
4237
+ exit: ["removeToasts", "clearDismissableBranch", "clearLastFocusedEl"],
4238
+ on: {
4239
+ PAUSE_TOAST: {
4240
+ actions: ["pauseToast"]
4241
+ },
4242
+ PAUSE_ALL: {
4243
+ actions: ["pauseToasts"]
4244
+ },
4245
+ RESUME_TOAST: {
4246
+ actions: ["resumeToast"]
4247
+ },
4248
+ RESUME_ALL: {
4249
+ actions: ["resumeToasts"]
4250
+ },
4251
+ ADD_TOAST: {
4252
+ guard: "isWithinRange",
4253
+ actions: ["createToast", "syncToastIndex"]
4254
+ },
4255
+ UPDATE_TOAST: {
4256
+ actions: ["updateToast"]
4257
+ },
4258
+ DISMISS_TOAST: {
4259
+ actions: ["dismissToast"]
4260
+ },
4261
+ DISMISS_ALL: {
4262
+ actions: ["dismissToasts"]
4263
+ },
4264
+ REMOVE_TOAST: {
4265
+ actions: ["removeToast", "syncToastIndex", "syncToastOffset"]
4266
+ },
4267
+ REMOVE_ALL: {
4268
+ actions: ["removeToasts"]
4269
+ },
4270
+ UPDATE_HEIGHT: {
4271
+ actions: ["syncHeights", "syncToastOffset"]
4272
+ },
4273
+ "DOC.HOTKEY": {
4274
+ actions: ["focusRegionEl"]
4275
+ },
4276
+ "REGION.BLUR": [
4277
+ {
4278
+ guard: "isOverlapping",
4279
+ target: "overlap",
4280
+ actions: ["resumeToasts", "restoreLastFocusedEl"]
4281
+ },
4282
+ {
4283
+ actions: ["resumeToasts", "restoreLastFocusedEl"]
4284
+ }
4285
+ ]
4286
+ },
4287
+ states: {
4288
+ stack: {
4289
+ entry: ["expandToasts"],
4290
+ on: {
4291
+ "REGION.POINTER_LEAVE": [
4292
+ {
4293
+ guard: "isOverlapping",
4294
+ target: "overlap",
4295
+ actions: ["resumeToasts"]
4296
+ },
4297
+ {
4298
+ actions: ["resumeToasts"]
4299
+ }
4300
+ ],
4301
+ "REGION.OVERLAP": {
4302
+ target: "overlap"
4303
+ },
4304
+ "REGION.FOCUS": {
4305
+ actions: ["setLastFocusedEl", "pauseToasts"]
4306
+ },
4307
+ "REGION.POINTER_ENTER": {
4308
+ actions: ["pauseToasts"]
4309
+ }
4310
+ }
4311
+ },
4312
+ overlap: {
4313
+ entry: ["collapseToasts"],
4314
+ on: {
4315
+ "REGION.STACK": {
4316
+ target: "stack"
4317
+ },
4318
+ "REGION.POINTER_ENTER": {
4319
+ target: "stack",
4320
+ actions: ["pauseToasts"]
4321
+ },
4322
+ "REGION.FOCUS": {
4323
+ target: "stack",
4324
+ actions: ["setLastFocusedEl", "pauseToasts"]
4325
+ }
4326
+ }
4327
+ }
4328
+ }
4329
+ },
4330
+ {
4331
+ guards: {
4332
+ isWithinRange: (n) => n.toasts.length < n.max,
4333
+ isOverlapping: (n) => !!n.overlap
4334
+ },
4335
+ activities: {
4336
+ trackHotKeyPress(n, s, { send: r }) {
4337
+ return A(document, "keydown", (c) => {
4338
+ n.hotkey.every((u) => c[u] || c.code === u) && r({ type: "DOC.HOTKEY" });
4339
+ }, { capture: !0 });
4340
+ },
4341
+ trackDocumentVisibility(n, s, { send: r }) {
4342
+ if (!n.pauseOnPageIdle) return;
4343
+ const o = _.getDoc(n);
4344
+ return A(o, "visibilitychange", () => {
4345
+ r(o.visibilityState === "hidden" ? "PAUSE_ALL" : "RESUME_ALL");
4346
+ });
4347
+ }
4348
+ },
4349
+ actions: {
4350
+ setDismissableBranch(n) {
4351
+ var c;
4352
+ const r = Bt(n.toasts, n.placement).length > 0;
4353
+ if (!r) {
4354
+ (c = n._cleanup) == null || c.call(n);
4355
+ return;
4356
+ }
4357
+ if (r && n._cleanup)
4358
+ return;
4359
+ const o = () => _.getRegionEl(n, n.placement);
4360
+ n._cleanup = di(o, { defer: !0 });
4361
+ },
4362
+ clearDismissableBranch(n) {
4363
+ var s;
4364
+ (s = n._cleanup) == null || s.call(n);
4365
+ },
4366
+ focusRegionEl(n) {
4367
+ queueMicrotask(() => {
4368
+ var s;
4369
+ (s = _.getRegionEl(n, n.placement)) == null || s.focus();
4370
+ });
4371
+ },
4372
+ expandToasts(n) {
4373
+ Ge(n, (s) => {
4374
+ s.state.context.stacked = !0;
4375
+ });
4376
+ },
4377
+ collapseToasts(n) {
4378
+ Ge(n, (s) => {
4379
+ s.state.context.stacked = !1;
4380
+ });
4381
+ },
4382
+ collapsedIfEmpty(n, s, { send: r }) {
4383
+ !n.overlap || n.toasts.length > 1 || r("REGION.OVERLAP");
4384
+ },
4385
+ pauseToast(n, s, { self: r }) {
4386
+ r.sendChild("PAUSE", s.id);
4387
+ },
4388
+ pauseToasts(n) {
4389
+ n.toasts.forEach((s) => s.send("PAUSE"));
4390
+ },
4391
+ resumeToast(n, s, { self: r }) {
4392
+ r.sendChild("RESUME", s.id);
4393
+ },
4394
+ resumeToasts(n) {
4395
+ n.toasts.forEach((s) => s.send("RESUME"));
4396
+ },
4397
+ measureToasts(n) {
4398
+ n.toasts.forEach((s) => s.send("MEASURE"));
4399
+ },
4400
+ createToast(n, s, { self: r, getState: o }) {
4401
+ const c = {
4402
+ placement: n.placement,
4403
+ duration: n.duration,
4404
+ removeDelay: n.removeDelay,
4405
+ ...s.toast,
4406
+ dir: n.dir,
4407
+ getRootNode: n.getRootNode,
4408
+ stacked: o().matches("stack")
4409
+ }, i = va(c), u = r.spawn(i);
4410
+ n.toasts = [u, ...n.toasts];
4411
+ },
4412
+ updateToast(n, s, { self: r }) {
4413
+ r.sendChild({ type: "UPDATE", toast: s.toast }, s.id);
4414
+ },
4415
+ dismissToast(n, s, { self: r }) {
4416
+ r.sendChild("DISMISS", s.id);
4417
+ },
4418
+ dismissToasts(n) {
4419
+ n.toasts.forEach((s) => s.send("DISMISS"));
4420
+ },
4421
+ removeToast(n, s, { self: r }) {
4422
+ r.stopChild(s.id), n.toasts = n.toasts.filter((o) => o.id !== s.id), n.heights = n.heights.filter((o) => o.id !== s.id);
4423
+ },
4424
+ removeToasts(n, s, { self: r }) {
4425
+ n.toasts.forEach((o) => r.stopChild(o.id)), n.toasts = [], n.heights = [];
4426
+ },
4427
+ syncHeights(n, s) {
4428
+ const r = n.heights.find((o) => o.id === s.id);
4429
+ if (r)
4430
+ r.height = s.height, r.placement = s.placement;
4431
+ else {
4432
+ const o = { id: s.id, height: s.height, placement: s.placement };
4433
+ n.heights = [o, ...n.heights];
4434
+ }
4435
+ },
4436
+ syncToastIndex(n) {
4437
+ Ge(n, (s, r, o) => {
4438
+ s.state.context.index = r, s.state.context.frontmost = r === 0, s.state.context.zIndex = o.length - r;
4439
+ });
4440
+ },
4441
+ syncToastOffset(n, s) {
4442
+ const r = s.placement ?? n.placement;
4443
+ Ge({ ...n, placement: r }, (o) => {
4444
+ const c = Math.max(
4445
+ n.heights.findIndex((u) => u.id === o.id),
4446
+ 0
4447
+ ), i = n.heights.reduce((u, a, l) => l >= c ? u : u + a.height, 0);
4448
+ o.state.context.offset = c * n.gap + i;
4449
+ });
4450
+ },
4451
+ setLastFocusedEl(n, s) {
4452
+ n.isFocusWithin || !s.target || (n.isFocusWithin = !0, n.lastFocusedEl = De(s.target));
4453
+ },
4454
+ restoreLastFocusedEl(n) {
4455
+ n.isFocusWithin = !1, n.lastFocusedEl && (n.lastFocusedEl.focus({ preventScroll: !0 }), n.lastFocusedEl = null);
4456
+ },
4457
+ clearLastFocusedEl(n) {
4458
+ n.lastFocusedEl && (n.lastFocusedEl.focus({ preventScroll: !0 }), n.lastFocusedEl = null, n.isFocusWithin = !1);
4459
+ }
4460
+ }
4461
+ }
4462
+ );
4463
+ }
4464
+ function Ge(e, t) {
4465
+ Bt(e.toasts, e.placement).forEach(t);
4466
+ }
4467
+ function Ea(e, t, n) {
4468
+ const s = e.hasTag("visible"), r = e.hasTag("paused"), o = e.context.placement, c = e.context.type, [i, u = "center"] = o.split("-");
4469
+ return {
4470
+ type: c,
4471
+ title: e.context.title,
4472
+ description: e.context.description,
4473
+ placement: o,
4474
+ visible: s,
4475
+ paused: r,
4476
+ pause() {
4477
+ t("PAUSE");
4478
+ },
4479
+ resume() {
4480
+ t("RESUME");
4481
+ },
4482
+ dismiss() {
4483
+ t("DISMISS");
4484
+ },
4485
+ getRootProps() {
4486
+ return n.element({
4487
+ ...ge.root.attrs,
4488
+ dir: e.context.dir,
4489
+ id: _.getRootId(e.context),
4490
+ "data-state": s ? "open" : "closed",
4491
+ "data-type": c,
4492
+ "data-placement": o,
4493
+ "data-align": u,
4494
+ "data-side": i,
4495
+ "data-mounted": j(e.context.mounted),
4496
+ "data-paused": j(r),
4497
+ "data-first": j(e.context.frontmost),
4498
+ "data-sibling": j(!e.context.frontmost),
4499
+ "data-stack": j(e.context.stacked),
4500
+ "data-overlap": j(!e.context.stacked),
4501
+ role: "status",
4502
+ "aria-atomic": "true",
4503
+ "aria-describedby": e.context.description ? _.getDescriptionId(e.context) : void 0,
4504
+ "aria-labelledby": e.context.title ? _.getTitleId(e.context) : void 0,
4505
+ tabIndex: 0,
4506
+ style: da(e.context, s),
4507
+ onKeyDown(a) {
4508
+ a.defaultPrevented || a.key == "Escape" && (t("DISMISS"), a.preventDefault());
4509
+ }
4510
+ });
4511
+ },
4512
+ /* Leave a ghost div to avoid setting hover to false when transitioning out */
4513
+ getGhostBeforeProps() {
4514
+ return n.element({
4515
+ "data-ghost": "before",
4516
+ style: fa(e.context, s)
4517
+ });
4518
+ },
4519
+ /* Needed to avoid setting hover to false when in between toasts */
4520
+ getGhostAfterProps() {
4521
+ return n.element({
4522
+ "data-ghost": "after",
4523
+ style: ha()
4524
+ });
4525
+ },
4526
+ getTitleProps() {
4527
+ return n.element({
4528
+ ...ge.title.attrs,
4529
+ id: _.getTitleId(e.context)
4530
+ });
4531
+ },
4532
+ getDescriptionProps() {
4533
+ return n.element({
4534
+ ...ge.description.attrs,
4535
+ id: _.getDescriptionId(e.context)
4536
+ });
4537
+ },
4538
+ getActionTriggerProps() {
4539
+ return n.button({
4540
+ ...ge.actionTrigger.attrs,
4541
+ type: "button",
4542
+ onClick(a) {
4543
+ var l, d;
4544
+ a.defaultPrevented || ((d = (l = e.context.action) == null ? void 0 : l.onClick) == null || d.call(l), t("DISMISS"));
4545
+ }
4546
+ });
4547
+ },
4548
+ getCloseTriggerProps() {
4549
+ return n.button({
4550
+ id: _.getCloseTriggerId(e.context),
4551
+ ...ge.closeTrigger.attrs,
4552
+ type: "button",
4553
+ "aria-label": "Dismiss notification",
4554
+ onClick(a) {
4555
+ a.defaultPrevented || t("DISMISS");
4556
+ }
4557
+ });
4558
+ }
4559
+ };
4560
+ }
4561
+ var Ct = {
4562
+ connect: pa,
4563
+ machine: ba
4564
+ };
4565
+ const Ta = (e) => {
4566
+ const t = Ct.machine({ id: "1", ...e });
4567
+ return { ...Ct.connect(t, t.send, Le), machine: t };
4568
+ }, [Na, Fe] = J({
4569
+ name: "ToastContext",
4570
+ hookName: "useToastContext",
4571
+ providerName: "<ToastProvider />"
4572
+ }), ps = R(
4573
+ (e, t) => {
4574
+ const n = Fe(), s = k(n.getActionTriggerProps(), e);
4575
+ return /* @__PURE__ */ h(F.button, { ...s, ref: t });
4576
+ }
4577
+ );
4578
+ ps.displayName = "ToastActionTrigger";
4579
+ const gs = R(
4580
+ (e, t) => {
4581
+ const n = Fe(), s = k(n.getCloseTriggerProps(), e);
4582
+ return /* @__PURE__ */ h(F.button, { ...s, ref: t });
4583
+ }
4584
+ );
4585
+ gs.displayName = "ToastCloseTrigger";
4586
+ const ms = R((e, t) => {
4587
+ const n = Fe(), s = k(n.getDescriptionProps(), e);
4588
+ return /* @__PURE__ */ h(F.div, { ...s, ref: t });
4589
+ });
4590
+ ms.displayName = "ToastDescription";
4591
+ const ys = R((e, t) => {
4592
+ const n = Fe(), s = k(n.getRootProps(), e);
4593
+ return /* @__PURE__ */ I("div", { ...s, ref: t, children: [
4594
+ /* @__PURE__ */ h("div", { ...n.getGhostBeforeProps() }),
4595
+ e.children,
4596
+ /* @__PURE__ */ h("div", { ...n.getGhostAfterProps() })
4597
+ ] });
4598
+ });
4599
+ ys.displayName = "ToastRoot";
4600
+ const vs = R((e, t) => {
4601
+ const n = Fe(), s = k(n.getTitleProps(), e);
4602
+ return /* @__PURE__ */ h(F.div, { ...s, ref: t });
4603
+ });
4604
+ vs.displayName = "ToastTitle";
4605
+ const bs = R((e, t) => {
4606
+ const { toaster: n, children: s, ...r } = e, [o, c] = et(n.machine), i = o.context.placement, u = Ct.connect(o, c, Le), a = u.getToastsByPlacement(i), l = k(u.getGroupProps({ placement: i }), r);
4607
+ return /* @__PURE__ */ h(F.div, { ...l, ref: t, children: a.map((d) => /* @__PURE__ */ h(Ca, { value: d, children: (f) => s(f) }, d.id)) });
4608
+ });
4609
+ bs.displayName = "Toaster";
4610
+ const Ca = (e) => {
4611
+ const [t, n] = xr(e.value), s = Ea(t, n, Le);
4612
+ return /* @__PURE__ */ h(Na, { value: s, children: e.children(t.context) });
4613
+ }, Pe = Ta({
4614
+ placement: "bottom-end",
4615
+ duration: 5e3,
4616
+ overlap: !0,
4617
+ gap: 16
4618
+ }), wa = {
4619
+ success: {
4620
+ container: "border-green-200 bg-green-50 text-green-900",
4621
+ icon: "text-green-600",
4622
+ IconComponent: Rs
4623
+ },
4624
+ error: {
4625
+ container: "border-red-200 bg-red-50 text-red-900",
4626
+ icon: "text-red-600",
4627
+ IconComponent: As
4628
+ },
4629
+ warning: {
4630
+ container: "border-yellow-200 bg-yellow-50 text-yellow-900",
4631
+ icon: "text-yellow-600",
4632
+ IconComponent: Ds
4633
+ },
4634
+ info: {
4635
+ container: "border-blue-200 bg-blue-50 text-blue-900",
4636
+ icon: "text-blue-600",
4637
+ IconComponent: Is
4638
+ }
4639
+ };
4640
+ function qa({ children: e }) {
4641
+ return /* @__PURE__ */ I(ut, { children: [
4642
+ e,
4643
+ /* @__PURE__ */ h(bs, { toaster: Pe, children: (t) => {
4644
+ const n = t.type || "info", s = wa[n], r = s.IconComponent;
4645
+ return /* @__PURE__ */ I(
4646
+ ys,
4647
+ {
4648
+ className: E(
4649
+ // Base styles
4650
+ "flex items-start gap-3 rounded-lg border p-4 shadow-lg",
4651
+ "min-w-[320px] max-w-[420px]",
4652
+ // Animation variables - CRITICAL for Ark UI animations
4653
+ "[translate:var(--x)_var(--y)]",
4654
+ "[scale:var(--scale)]",
4655
+ "[z-index:var(--z-index)]",
4656
+ "[height:var(--height)]",
4657
+ "[opacity:var(--opacity)]",
4658
+ // Variant styles
4659
+ s.container
4660
+ ),
4661
+ children: [
4662
+ /* @__PURE__ */ h(r, { className: E("h-5 w-5 flex-shrink-0 mt-0.5", s.icon) }),
4663
+ /* @__PURE__ */ I("div", { className: "flex-1 space-y-1", children: [
4664
+ /* @__PURE__ */ h(vs, { className: "text-sm font-semibold", children: t.title }),
4665
+ t.description && /* @__PURE__ */ h(ms, { className: "text-sm opacity-90", children: t.description }),
4666
+ t.action && /* @__PURE__ */ h(
4667
+ ps,
4668
+ {
4669
+ className: E(
4670
+ "mt-2 inline-flex items-center text-sm font-medium underline-offset-4 hover:underline"
4671
+ ),
4672
+ children: t.action.label
4673
+ }
4674
+ )
4675
+ ] }),
4676
+ /* @__PURE__ */ h(
4677
+ gs,
4678
+ {
4679
+ className: E(
4680
+ "flex-shrink-0 rounded-md p-1 hover:bg-black/5",
4681
+ "focus:outline-none focus:ring-2 focus:ring-offset-2"
4682
+ ),
4683
+ "aria-label": "Close notification",
4684
+ children: /* @__PURE__ */ h(yn, { className: "h-4 w-4" })
4685
+ }
4686
+ )
4687
+ ]
4688
+ }
4689
+ );
4690
+ } })
4691
+ ] });
4692
+ }
4693
+ const Ya = {
4694
+ success: (e) => Pe.create({
4695
+ ...e,
4696
+ type: "success"
4697
+ }),
4698
+ error: (e) => Pe.create({
4699
+ ...e,
4700
+ type: "error"
4701
+ }),
4702
+ warning: (e) => Pe.create({
4703
+ ...e,
4704
+ type: "warning"
4705
+ }),
4706
+ info: (e) => Pe.create({
4707
+ ...e,
4708
+ type: "info"
4709
+ })
4710
+ };
4711
+ export {
4712
+ Vt as Button,
4713
+ Aa as Card,
4714
+ Ma as CardContent,
4715
+ Fa as CardDescription,
4716
+ _a as CardFooter,
4717
+ Ra as CardHeader,
4718
+ La as CardTitle,
4719
+ Va as Checkbox,
4720
+ Ga as Dialog,
4721
+ Ua as Input,
4722
+ Wa as ProductsTable,
4723
+ Ka as Progress,
4724
+ za as Select,
4725
+ B as Table,
4726
+ qa as ToastProvider,
4727
+ E as cn,
4728
+ Ya as toast,
4729
+ Pe as toaster
4730
+ };
4731
+ //# sourceMappingURL=index.mjs.map