@spear-ai/spectral 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1598 @@
1
+ "use client";
2
+ import * as a from "react";
3
+ import F, { useState as st } from "react";
4
+ import { jsx as R, jsxs as ct } from "react/jsx-runtime";
5
+ import * as ut from "react-dom";
6
+ import lt from "react-dom";
7
+ function D(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
8
+ return function(o) {
9
+ if (e?.(o), n === !1 || !o.defaultPrevented)
10
+ return t?.(o);
11
+ };
12
+ }
13
+ function Ee(e, t) {
14
+ if (typeof e == "function")
15
+ return e(t);
16
+ e != null && (e.current = t);
17
+ }
18
+ function Ie(...e) {
19
+ return (t) => {
20
+ let n = !1;
21
+ const r = e.map((o) => {
22
+ const s = Ee(o, t);
23
+ return !n && typeof s == "function" && (n = !0), s;
24
+ });
25
+ if (n)
26
+ return () => {
27
+ for (let o = 0; o < r.length; o++) {
28
+ const s = r[o];
29
+ typeof s == "function" ? s() : Ee(e[o], null);
30
+ }
31
+ };
32
+ };
33
+ }
34
+ function M(...e) {
35
+ return a.useCallback(Ie(...e), e);
36
+ }
37
+ function or(e, t) {
38
+ const n = a.createContext(t), r = (s) => {
39
+ const { children: c, ...i } = s, f = a.useMemo(() => i, Object.values(i));
40
+ return /* @__PURE__ */ R(n.Provider, { value: f, children: c });
41
+ };
42
+ r.displayName = e + "Provider";
43
+ function o(s) {
44
+ const c = a.useContext(n);
45
+ if (c) return c;
46
+ if (t !== void 0) return t;
47
+ throw new Error(`\`${s}\` must be used within \`${e}\``);
48
+ }
49
+ return [r, o];
50
+ }
51
+ function Le(e, t = []) {
52
+ let n = [];
53
+ function r(s, c) {
54
+ const i = a.createContext(c), f = n.length;
55
+ n = [...n, c];
56
+ const d = (l) => {
57
+ const { scope: h, children: g, ...b } = l, u = h?.[e]?.[f] || i, m = a.useMemo(() => b, Object.values(b));
58
+ return /* @__PURE__ */ R(u.Provider, { value: m, children: g });
59
+ };
60
+ d.displayName = s + "Provider";
61
+ function v(l, h) {
62
+ const g = h?.[e]?.[f] || i, b = a.useContext(g);
63
+ if (b) return b;
64
+ if (c !== void 0) return c;
65
+ throw new Error(`\`${l}\` must be used within \`${s}\``);
66
+ }
67
+ return [d, v];
68
+ }
69
+ const o = () => {
70
+ const s = n.map((c) => a.createContext(c));
71
+ return function(i) {
72
+ const f = i?.[e] || s;
73
+ return a.useMemo(
74
+ () => ({ [`__scope${e}`]: { ...i, [e]: f } }),
75
+ [i, f]
76
+ );
77
+ };
78
+ };
79
+ return o.scopeName = e, [r, dt(o, ...t)];
80
+ }
81
+ function dt(...e) {
82
+ const t = e[0];
83
+ if (e.length === 1) return t;
84
+ const n = () => {
85
+ const r = e.map((o) => ({
86
+ useScope: o(),
87
+ scopeName: o.scopeName
88
+ }));
89
+ return function(s) {
90
+ const c = r.reduce((i, { useScope: f, scopeName: d }) => {
91
+ const l = f(s)[`__scope${d}`];
92
+ return { ...i, ...l };
93
+ }, {});
94
+ return a.useMemo(() => ({ [`__scope${t.scopeName}`]: c }), [c]);
95
+ };
96
+ };
97
+ return n.scopeName = t.scopeName, n;
98
+ }
99
+ var z = globalThis?.document ? a.useLayoutEffect : () => {
100
+ }, ft = a[" useId ".trim().toString()] || (() => {
101
+ }), vt = 0;
102
+ function ir(e) {
103
+ const [t, n] = a.useState(ft());
104
+ return z(() => {
105
+ n((r) => r ?? String(vt++));
106
+ }, [e]), e || (t ? `radix-${t}` : "");
107
+ }
108
+ var mt = a[" useInsertionEffect ".trim().toString()] || z;
109
+ function ht({
110
+ prop: e,
111
+ defaultProp: t,
112
+ onChange: n = () => {
113
+ },
114
+ caller: r
115
+ }) {
116
+ const [o, s, c] = pt({
117
+ defaultProp: t,
118
+ onChange: n
119
+ }), i = e !== void 0, f = i ? e : o;
120
+ {
121
+ const v = a.useRef(e !== void 0);
122
+ a.useEffect(() => {
123
+ const l = v.current;
124
+ l !== i && console.warn(
125
+ `${r} is changing from ${l ? "controlled" : "uncontrolled"} to ${i ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
126
+ ), v.current = i;
127
+ }, [i, r]);
128
+ }
129
+ const d = a.useCallback(
130
+ (v) => {
131
+ if (i) {
132
+ const l = gt(v) ? v(e) : v;
133
+ l !== e && c.current?.(l);
134
+ } else
135
+ s(v);
136
+ },
137
+ [i, e, s, c]
138
+ );
139
+ return [f, d];
140
+ }
141
+ function pt({
142
+ defaultProp: e,
143
+ onChange: t
144
+ }) {
145
+ const [n, r] = a.useState(e), o = a.useRef(n), s = a.useRef(t);
146
+ return mt(() => {
147
+ s.current = t;
148
+ }, [t]), a.useEffect(() => {
149
+ o.current !== n && (s.current?.(n), o.current = n);
150
+ }, [n, o]), [n, r, s];
151
+ }
152
+ function gt(e) {
153
+ return typeof e == "function";
154
+ }
155
+ // @__NO_SIDE_EFFECTS__
156
+ function de(e) {
157
+ const t = /* @__PURE__ */ St(e), n = a.forwardRef((r, o) => {
158
+ const { children: s, ...c } = r, i = a.Children.toArray(s), f = i.find(Et);
159
+ if (f) {
160
+ const d = f.props.children, v = i.map((l) => l === f ? a.Children.count(d) > 1 ? a.Children.only(null) : a.isValidElement(d) ? d.props.children : null : l);
161
+ return /* @__PURE__ */ R(t, { ...c, ref: o, children: a.isValidElement(d) ? a.cloneElement(d, void 0, v) : null });
162
+ }
163
+ return /* @__PURE__ */ R(t, { ...c, ref: o, children: s });
164
+ });
165
+ return n.displayName = `${e}.Slot`, n;
166
+ }
167
+ // @__NO_SIDE_EFFECTS__
168
+ function St(e) {
169
+ const t = a.forwardRef((n, r) => {
170
+ const { children: o, ...s } = n;
171
+ if (a.isValidElement(o)) {
172
+ const c = wt(o), i = bt(s, o.props);
173
+ return o.type !== a.Fragment && (i.ref = r ? Ie(r, c) : c), a.cloneElement(o, i);
174
+ }
175
+ return a.Children.count(o) > 1 ? a.Children.only(null) : null;
176
+ });
177
+ return t.displayName = `${e}.SlotClone`, t;
178
+ }
179
+ var yt = Symbol("radix.slottable");
180
+ function Et(e) {
181
+ return a.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === yt;
182
+ }
183
+ function bt(e, t) {
184
+ const n = { ...t };
185
+ for (const r in t) {
186
+ const o = e[r], s = t[r];
187
+ /^on[A-Z]/.test(r) ? o && s ? n[r] = (...i) => {
188
+ const f = s(...i);
189
+ return o(...i), f;
190
+ } : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...s } : r === "className" && (n[r] = [o, s].filter(Boolean).join(" "));
191
+ }
192
+ return { ...e, ...n };
193
+ }
194
+ function wt(e) {
195
+ let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
196
+ return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
197
+ }
198
+ var Ct = [
199
+ "a",
200
+ "button",
201
+ "div",
202
+ "form",
203
+ "h2",
204
+ "h3",
205
+ "img",
206
+ "input",
207
+ "label",
208
+ "li",
209
+ "nav",
210
+ "ol",
211
+ "p",
212
+ "select",
213
+ "span",
214
+ "svg",
215
+ "ul"
216
+ ], T = Ct.reduce((e, t) => {
217
+ const n = /* @__PURE__ */ de(`Primitive.${t}`), r = a.forwardRef((o, s) => {
218
+ const { asChild: c, ...i } = o, f = c ? n : t;
219
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ R(f, { ...i, ref: s });
220
+ });
221
+ return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
222
+ }, {});
223
+ function Rt(e, t) {
224
+ e && ut.flushSync(() => e.dispatchEvent(t));
225
+ }
226
+ function j(e) {
227
+ const t = a.useRef(e);
228
+ return a.useEffect(() => {
229
+ t.current = e;
230
+ }), a.useMemo(() => (...n) => t.current?.(...n), []);
231
+ }
232
+ function Pt(e, t = globalThis?.document) {
233
+ const n = j(e);
234
+ a.useEffect(() => {
235
+ const r = (o) => {
236
+ o.key === "Escape" && n(o);
237
+ };
238
+ return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
239
+ }, [n, t]);
240
+ }
241
+ var At = "DismissableLayer", fe = "dismissableLayer.update", Mt = "dismissableLayer.pointerDownOutside", xt = "dismissableLayer.focusOutside", be, _e = a.createContext({
242
+ layers: /* @__PURE__ */ new Set(),
243
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
244
+ branches: /* @__PURE__ */ new Set()
245
+ }), Ot = a.forwardRef(
246
+ (e, t) => {
247
+ const {
248
+ disableOutsidePointerEvents: n = !1,
249
+ onEscapeKeyDown: r,
250
+ onPointerDownOutside: o,
251
+ onFocusOutside: s,
252
+ onInteractOutside: c,
253
+ onDismiss: i,
254
+ ...f
255
+ } = e, d = a.useContext(_e), [v, l] = a.useState(null), h = v?.ownerDocument ?? globalThis?.document, [, g] = a.useState({}), b = M(t, (w) => l(w)), u = Array.from(d.layers), [m] = [...d.layersWithOutsidePointerEventsDisabled].slice(-1), p = u.indexOf(m), E = v ? u.indexOf(v) : -1, y = d.layersWithOutsidePointerEventsDisabled.size > 0, S = E >= p, C = Tt((w) => {
256
+ const x = w.target, L = [...d.branches].some((N) => N.contains(x));
257
+ !S || L || (o?.(w), c?.(w), w.defaultPrevented || i?.());
258
+ }, h), P = It((w) => {
259
+ const x = w.target;
260
+ [...d.branches].some((N) => N.contains(x)) || (s?.(w), c?.(w), w.defaultPrevented || i?.());
261
+ }, h);
262
+ return Pt((w) => {
263
+ E === d.layers.size - 1 && (r?.(w), !w.defaultPrevented && i && (w.preventDefault(), i()));
264
+ }, h), a.useEffect(() => {
265
+ if (v)
266
+ return n && (d.layersWithOutsidePointerEventsDisabled.size === 0 && (be = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), d.layersWithOutsidePointerEventsDisabled.add(v)), d.layers.add(v), we(), () => {
267
+ n && d.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = be);
268
+ };
269
+ }, [v, h, n, d]), a.useEffect(() => () => {
270
+ v && (d.layers.delete(v), d.layersWithOutsidePointerEventsDisabled.delete(v), we());
271
+ }, [v, d]), a.useEffect(() => {
272
+ const w = () => g({});
273
+ return document.addEventListener(fe, w), () => document.removeEventListener(fe, w);
274
+ }, []), /* @__PURE__ */ R(
275
+ T.div,
276
+ {
277
+ ...f,
278
+ ref: b,
279
+ style: {
280
+ pointerEvents: y ? S ? "auto" : "none" : void 0,
281
+ ...e.style
282
+ },
283
+ onFocusCapture: D(e.onFocusCapture, P.onFocusCapture),
284
+ onBlurCapture: D(e.onBlurCapture, P.onBlurCapture),
285
+ onPointerDownCapture: D(
286
+ e.onPointerDownCapture,
287
+ C.onPointerDownCapture
288
+ )
289
+ }
290
+ );
291
+ }
292
+ );
293
+ Ot.displayName = At;
294
+ var Nt = "DismissableLayerBranch", Dt = a.forwardRef((e, t) => {
295
+ const n = a.useContext(_e), r = a.useRef(null), o = M(t, r);
296
+ return a.useEffect(() => {
297
+ const s = r.current;
298
+ if (s)
299
+ return n.branches.add(s), () => {
300
+ n.branches.delete(s);
301
+ };
302
+ }, [n.branches]), /* @__PURE__ */ R(T.div, { ...e, ref: o });
303
+ });
304
+ Dt.displayName = Nt;
305
+ function Tt(e, t = globalThis?.document) {
306
+ const n = j(e), r = a.useRef(!1), o = a.useRef(() => {
307
+ });
308
+ return a.useEffect(() => {
309
+ const s = (i) => {
310
+ if (i.target && !r.current) {
311
+ let f = function() {
312
+ ke(
313
+ Mt,
314
+ n,
315
+ d,
316
+ { discrete: !0 }
317
+ );
318
+ };
319
+ const d = { originalEvent: i };
320
+ i.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = f, t.addEventListener("click", o.current, { once: !0 })) : f();
321
+ } else
322
+ t.removeEventListener("click", o.current);
323
+ r.current = !1;
324
+ }, c = window.setTimeout(() => {
325
+ t.addEventListener("pointerdown", s);
326
+ }, 0);
327
+ return () => {
328
+ window.clearTimeout(c), t.removeEventListener("pointerdown", s), t.removeEventListener("click", o.current);
329
+ };
330
+ }, [t, n]), {
331
+ // ensures we check React component tree (not just DOM tree)
332
+ onPointerDownCapture: () => r.current = !0
333
+ };
334
+ }
335
+ function It(e, t = globalThis?.document) {
336
+ const n = j(e), r = a.useRef(!1);
337
+ return a.useEffect(() => {
338
+ const o = (s) => {
339
+ s.target && !r.current && ke(xt, n, { originalEvent: s }, {
340
+ discrete: !1
341
+ });
342
+ };
343
+ return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
344
+ }, [t, n]), {
345
+ onFocusCapture: () => r.current = !0,
346
+ onBlurCapture: () => r.current = !1
347
+ };
348
+ }
349
+ function we() {
350
+ const e = new CustomEvent(fe);
351
+ document.dispatchEvent(e);
352
+ }
353
+ function ke(e, t, n, { discrete: r }) {
354
+ const o = n.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
355
+ t && o.addEventListener(e, t, { once: !0 }), r ? Rt(o, s) : o.dispatchEvent(s);
356
+ }
357
+ var oe = "focusScope.autoFocusOnMount", ie = "focusScope.autoFocusOnUnmount", Ce = { bubbles: !1, cancelable: !0 }, Lt = "FocusScope", _t = a.forwardRef((e, t) => {
358
+ const {
359
+ loop: n = !1,
360
+ trapped: r = !1,
361
+ onMountAutoFocus: o,
362
+ onUnmountAutoFocus: s,
363
+ ...c
364
+ } = e, [i, f] = a.useState(null), d = j(o), v = j(s), l = a.useRef(null), h = M(t, (u) => f(u)), g = a.useRef({
365
+ paused: !1,
366
+ pause() {
367
+ this.paused = !0;
368
+ },
369
+ resume() {
370
+ this.paused = !1;
371
+ }
372
+ }).current;
373
+ a.useEffect(() => {
374
+ if (r) {
375
+ let u = function(y) {
376
+ if (g.paused || !i) return;
377
+ const S = y.target;
378
+ i.contains(S) ? l.current = S : I(l.current, { select: !0 });
379
+ }, m = function(y) {
380
+ if (g.paused || !i) return;
381
+ const S = y.relatedTarget;
382
+ S !== null && (i.contains(S) || I(l.current, { select: !0 }));
383
+ }, p = function(y) {
384
+ if (document.activeElement === document.body)
385
+ for (const C of y)
386
+ C.removedNodes.length > 0 && I(i);
387
+ };
388
+ document.addEventListener("focusin", u), document.addEventListener("focusout", m);
389
+ const E = new MutationObserver(p);
390
+ return i && E.observe(i, { childList: !0, subtree: !0 }), () => {
391
+ document.removeEventListener("focusin", u), document.removeEventListener("focusout", m), E.disconnect();
392
+ };
393
+ }
394
+ }, [r, i, g.paused]), a.useEffect(() => {
395
+ if (i) {
396
+ Pe.add(g);
397
+ const u = document.activeElement;
398
+ if (!i.contains(u)) {
399
+ const p = new CustomEvent(oe, Ce);
400
+ i.addEventListener(oe, d), i.dispatchEvent(p), p.defaultPrevented || (kt(Kt(Fe(i)), { select: !0 }), document.activeElement === u && I(i));
401
+ }
402
+ return () => {
403
+ i.removeEventListener(oe, d), setTimeout(() => {
404
+ const p = new CustomEvent(ie, Ce);
405
+ i.addEventListener(ie, v), i.dispatchEvent(p), p.defaultPrevented || I(u ?? document.body, { select: !0 }), i.removeEventListener(ie, v), Pe.remove(g);
406
+ }, 0);
407
+ };
408
+ }
409
+ }, [i, d, v, g]);
410
+ const b = a.useCallback(
411
+ (u) => {
412
+ if (!n && !r || g.paused) return;
413
+ const m = u.key === "Tab" && !u.altKey && !u.ctrlKey && !u.metaKey, p = document.activeElement;
414
+ if (m && p) {
415
+ const E = u.currentTarget, [y, S] = Ft(E);
416
+ y && S ? !u.shiftKey && p === S ? (u.preventDefault(), n && I(y, { select: !0 })) : u.shiftKey && p === y && (u.preventDefault(), n && I(S, { select: !0 })) : p === E && u.preventDefault();
417
+ }
418
+ },
419
+ [n, r, g.paused]
420
+ );
421
+ return /* @__PURE__ */ R(T.div, { tabIndex: -1, ...c, ref: h, onKeyDown: b });
422
+ });
423
+ _t.displayName = Lt;
424
+ function kt(e, { select: t = !1 } = {}) {
425
+ const n = document.activeElement;
426
+ for (const r of e)
427
+ if (I(r, { select: t }), document.activeElement !== n) return;
428
+ }
429
+ function Ft(e) {
430
+ const t = Fe(e), n = Re(t, e), r = Re(t.reverse(), e);
431
+ return [n, r];
432
+ }
433
+ function Fe(e) {
434
+ const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
435
+ acceptNode: (r) => {
436
+ const o = r.tagName === "INPUT" && r.type === "hidden";
437
+ return r.disabled || r.hidden || o ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
438
+ }
439
+ });
440
+ for (; n.nextNode(); ) t.push(n.currentNode);
441
+ return t;
442
+ }
443
+ function Re(e, t) {
444
+ for (const n of e)
445
+ if (!Bt(n, { upTo: t })) return n;
446
+ }
447
+ function Bt(e, { upTo: t }) {
448
+ if (getComputedStyle(e).visibility === "hidden") return !0;
449
+ for (; e; ) {
450
+ if (t !== void 0 && e === t) return !1;
451
+ if (getComputedStyle(e).display === "none") return !0;
452
+ e = e.parentElement;
453
+ }
454
+ return !1;
455
+ }
456
+ function Wt(e) {
457
+ return e instanceof HTMLInputElement && "select" in e;
458
+ }
459
+ function I(e, { select: t = !1 } = {}) {
460
+ if (e && e.focus) {
461
+ const n = document.activeElement;
462
+ e.focus({ preventScroll: !0 }), e !== n && Wt(e) && t && e.select();
463
+ }
464
+ }
465
+ var Pe = Ut();
466
+ function Ut() {
467
+ let e = [];
468
+ return {
469
+ add(t) {
470
+ const n = e[0];
471
+ t !== n && n?.pause(), e = Ae(e, t), e.unshift(t);
472
+ },
473
+ remove(t) {
474
+ e = Ae(e, t), e[0]?.resume();
475
+ }
476
+ };
477
+ }
478
+ function Ae(e, t) {
479
+ const n = [...e], r = n.indexOf(t);
480
+ return r !== -1 && n.splice(r, 1), n;
481
+ }
482
+ function Kt(e) {
483
+ return e.filter((t) => t.tagName !== "A");
484
+ }
485
+ var Vt = "Portal", zt = a.forwardRef((e, t) => {
486
+ const { container: n, ...r } = e, [o, s] = a.useState(!1);
487
+ z(() => s(!0), []);
488
+ const c = n || o && globalThis?.document?.body;
489
+ return c ? lt.createPortal(/* @__PURE__ */ R(T.div, { ...r, ref: t }), c) : null;
490
+ });
491
+ zt.displayName = Vt;
492
+ function Ht(e, t) {
493
+ return a.useReducer((n, r) => t[n][r] ?? n, e);
494
+ }
495
+ var $t = (e) => {
496
+ const { present: t, children: n } = e, r = jt(t), o = typeof n == "function" ? n({ present: r.isPresent }) : a.Children.only(n), s = M(r.ref, Yt(o));
497
+ return typeof n == "function" || r.isPresent ? a.cloneElement(o, { ref: s }) : null;
498
+ };
499
+ $t.displayName = "Presence";
500
+ function jt(e) {
501
+ const [t, n] = a.useState(), r = a.useRef(null), o = a.useRef(e), s = a.useRef("none"), c = e ? "mounted" : "unmounted", [i, f] = Ht(c, {
502
+ mounted: {
503
+ UNMOUNT: "unmounted",
504
+ ANIMATION_OUT: "unmountSuspended"
505
+ },
506
+ unmountSuspended: {
507
+ MOUNT: "mounted",
508
+ ANIMATION_END: "unmounted"
509
+ },
510
+ unmounted: {
511
+ MOUNT: "mounted"
512
+ }
513
+ });
514
+ return a.useEffect(() => {
515
+ const d = Y(r.current);
516
+ s.current = i === "mounted" ? d : "none";
517
+ }, [i]), z(() => {
518
+ const d = r.current, v = o.current;
519
+ if (v !== e) {
520
+ const h = s.current, g = Y(d);
521
+ e ? f("MOUNT") : g === "none" || d?.display === "none" ? f("UNMOUNT") : f(v && h !== g ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
522
+ }
523
+ }, [e, f]), z(() => {
524
+ if (t) {
525
+ let d;
526
+ const v = t.ownerDocument.defaultView ?? window, l = (g) => {
527
+ const u = Y(r.current).includes(CSS.escape(g.animationName));
528
+ if (g.target === t && u && (f("ANIMATION_END"), !o.current)) {
529
+ const m = t.style.animationFillMode;
530
+ t.style.animationFillMode = "forwards", d = v.setTimeout(() => {
531
+ t.style.animationFillMode === "forwards" && (t.style.animationFillMode = m);
532
+ });
533
+ }
534
+ }, h = (g) => {
535
+ g.target === t && (s.current = Y(r.current));
536
+ };
537
+ return t.addEventListener("animationstart", h), t.addEventListener("animationcancel", l), t.addEventListener("animationend", l), () => {
538
+ v.clearTimeout(d), t.removeEventListener("animationstart", h), t.removeEventListener("animationcancel", l), t.removeEventListener("animationend", l);
539
+ };
540
+ } else
541
+ f("ANIMATION_END");
542
+ }, [t, f]), {
543
+ isPresent: ["mounted", "unmountSuspended"].includes(i),
544
+ ref: a.useCallback((d) => {
545
+ r.current = d ? getComputedStyle(d) : null, n(d);
546
+ }, [])
547
+ };
548
+ }
549
+ function Y(e) {
550
+ return e?.animationName || "none";
551
+ }
552
+ function Yt(e) {
553
+ let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
554
+ return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
555
+ }
556
+ var ae = 0;
557
+ function ar() {
558
+ a.useEffect(() => {
559
+ const e = document.querySelectorAll("[data-radix-focus-guard]");
560
+ return document.body.insertAdjacentElement("afterbegin", e[0] ?? Me()), document.body.insertAdjacentElement("beforeend", e[1] ?? Me()), ae++, () => {
561
+ ae === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), ae--;
562
+ };
563
+ }, []);
564
+ }
565
+ function Me() {
566
+ const e = document.createElement("span");
567
+ return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
568
+ }
569
+ var O = function() {
570
+ return O = Object.assign || function(t) {
571
+ for (var n, r = 1, o = arguments.length; r < o; r++) {
572
+ n = arguments[r];
573
+ for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
574
+ }
575
+ return t;
576
+ }, O.apply(this, arguments);
577
+ };
578
+ function Be(e, t) {
579
+ var n = {};
580
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
581
+ if (e != null && typeof Object.getOwnPropertySymbols == "function")
582
+ for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++)
583
+ t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]);
584
+ return n;
585
+ }
586
+ function Xt(e, t, n) {
587
+ if (n || arguments.length === 2) for (var r = 0, o = t.length, s; r < o; r++)
588
+ (s || !(r in t)) && (s || (s = Array.prototype.slice.call(t, 0, r)), s[r] = t[r]);
589
+ return e.concat(s || Array.prototype.slice.call(t));
590
+ }
591
+ var Q = "right-scroll-bar-position", J = "width-before-scroll-bar", Gt = "with-scroll-bars-hidden", Zt = "--removed-body-scroll-bar-size";
592
+ function se(e, t) {
593
+ return typeof e == "function" ? e(t) : e && (e.current = t), e;
594
+ }
595
+ function qt(e, t) {
596
+ var n = st(function() {
597
+ return {
598
+ // value
599
+ value: e,
600
+ // last callback
601
+ callback: t,
602
+ // "memoized" public interface
603
+ facade: {
604
+ get current() {
605
+ return n.value;
606
+ },
607
+ set current(r) {
608
+ var o = n.value;
609
+ o !== r && (n.value = r, n.callback(r, o));
610
+ }
611
+ }
612
+ };
613
+ })[0];
614
+ return n.callback = t, n.facade;
615
+ }
616
+ var Qt = typeof window < "u" ? a.useLayoutEffect : a.useEffect, xe = /* @__PURE__ */ new WeakMap();
617
+ function Jt(e, t) {
618
+ var n = qt(null, function(r) {
619
+ return e.forEach(function(o) {
620
+ return se(o, r);
621
+ });
622
+ });
623
+ return Qt(function() {
624
+ var r = xe.get(n);
625
+ if (r) {
626
+ var o = new Set(r), s = new Set(e), c = n.current;
627
+ o.forEach(function(i) {
628
+ s.has(i) || se(i, null);
629
+ }), s.forEach(function(i) {
630
+ o.has(i) || se(i, c);
631
+ });
632
+ }
633
+ xe.set(n, e);
634
+ }, [e]), n;
635
+ }
636
+ function en(e) {
637
+ return e;
638
+ }
639
+ function tn(e, t) {
640
+ t === void 0 && (t = en);
641
+ var n = [], r = !1, o = {
642
+ read: function() {
643
+ if (r)
644
+ throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
645
+ return n.length ? n[n.length - 1] : e;
646
+ },
647
+ useMedium: function(s) {
648
+ var c = t(s, r);
649
+ return n.push(c), function() {
650
+ n = n.filter(function(i) {
651
+ return i !== c;
652
+ });
653
+ };
654
+ },
655
+ assignSyncMedium: function(s) {
656
+ for (r = !0; n.length; ) {
657
+ var c = n;
658
+ n = [], c.forEach(s);
659
+ }
660
+ n = {
661
+ push: function(i) {
662
+ return s(i);
663
+ },
664
+ filter: function() {
665
+ return n;
666
+ }
667
+ };
668
+ },
669
+ assignMedium: function(s) {
670
+ r = !0;
671
+ var c = [];
672
+ if (n.length) {
673
+ var i = n;
674
+ n = [], i.forEach(s), c = n;
675
+ }
676
+ var f = function() {
677
+ var v = c;
678
+ c = [], v.forEach(s);
679
+ }, d = function() {
680
+ return Promise.resolve().then(f);
681
+ };
682
+ d(), n = {
683
+ push: function(v) {
684
+ c.push(v), d();
685
+ },
686
+ filter: function(v) {
687
+ return c = c.filter(v), n;
688
+ }
689
+ };
690
+ }
691
+ };
692
+ return o;
693
+ }
694
+ function nn(e) {
695
+ e === void 0 && (e = {});
696
+ var t = tn(null);
697
+ return t.options = O({ async: !0, ssr: !1 }, e), t;
698
+ }
699
+ var We = function(e) {
700
+ var t = e.sideCar, n = Be(e, ["sideCar"]);
701
+ if (!t)
702
+ throw new Error("Sidecar: please provide `sideCar` property to import the right car");
703
+ var r = t.read();
704
+ if (!r)
705
+ throw new Error("Sidecar medium not found");
706
+ return a.createElement(r, O({}, n));
707
+ };
708
+ We.isSideCarExport = !0;
709
+ function rn(e, t) {
710
+ return e.useMedium(t), We;
711
+ }
712
+ var Ue = nn(), ce = function() {
713
+ }, ee = a.forwardRef(function(e, t) {
714
+ var n = a.useRef(null), r = a.useState({
715
+ onScrollCapture: ce,
716
+ onWheelCapture: ce,
717
+ onTouchMoveCapture: ce
718
+ }), o = r[0], s = r[1], c = e.forwardProps, i = e.children, f = e.className, d = e.removeScrollBar, v = e.enabled, l = e.shards, h = e.sideCar, g = e.noRelative, b = e.noIsolation, u = e.inert, m = e.allowPinchZoom, p = e.as, E = p === void 0 ? "div" : p, y = e.gapMode, S = Be(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), C = h, P = Jt([n, t]), w = O(O({}, S), o);
719
+ return a.createElement(
720
+ a.Fragment,
721
+ null,
722
+ v && a.createElement(C, { sideCar: Ue, removeScrollBar: d, shards: l, noRelative: g, noIsolation: b, inert: u, setCallbacks: s, allowPinchZoom: !!m, lockRef: n, gapMode: y }),
723
+ c ? a.cloneElement(a.Children.only(i), O(O({}, w), { ref: P })) : a.createElement(E, O({}, w, { className: f, ref: P }), i)
724
+ );
725
+ });
726
+ ee.defaultProps = {
727
+ enabled: !0,
728
+ removeScrollBar: !0,
729
+ inert: !1
730
+ };
731
+ ee.classNames = {
732
+ fullWidth: J,
733
+ zeroRight: Q
734
+ };
735
+ var on = function() {
736
+ if (typeof __webpack_nonce__ < "u")
737
+ return __webpack_nonce__;
738
+ };
739
+ function an() {
740
+ if (!document)
741
+ return null;
742
+ var e = document.createElement("style");
743
+ e.type = "text/css";
744
+ var t = on();
745
+ return t && e.setAttribute("nonce", t), e;
746
+ }
747
+ function sn(e, t) {
748
+ e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
749
+ }
750
+ function cn(e) {
751
+ var t = document.head || document.getElementsByTagName("head")[0];
752
+ t.appendChild(e);
753
+ }
754
+ var un = function() {
755
+ var e = 0, t = null;
756
+ return {
757
+ add: function(n) {
758
+ e == 0 && (t = an()) && (sn(t, n), cn(t)), e++;
759
+ },
760
+ remove: function() {
761
+ e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
762
+ }
763
+ };
764
+ }, ln = function() {
765
+ var e = un();
766
+ return function(t, n) {
767
+ a.useEffect(function() {
768
+ return e.add(t), function() {
769
+ e.remove();
770
+ };
771
+ }, [t && n]);
772
+ };
773
+ }, Ke = function() {
774
+ var e = ln(), t = function(n) {
775
+ var r = n.styles, o = n.dynamic;
776
+ return e(r, o), null;
777
+ };
778
+ return t;
779
+ }, dn = {
780
+ left: 0,
781
+ top: 0,
782
+ right: 0,
783
+ gap: 0
784
+ }, ue = function(e) {
785
+ return parseInt(e || "", 10) || 0;
786
+ }, fn = function(e) {
787
+ var t = window.getComputedStyle(document.body), n = t[e === "padding" ? "paddingLeft" : "marginLeft"], r = t[e === "padding" ? "paddingTop" : "marginTop"], o = t[e === "padding" ? "paddingRight" : "marginRight"];
788
+ return [ue(n), ue(r), ue(o)];
789
+ }, vn = function(e) {
790
+ if (e === void 0 && (e = "margin"), typeof window > "u")
791
+ return dn;
792
+ var t = fn(e), n = document.documentElement.clientWidth, r = window.innerWidth;
793
+ return {
794
+ left: t[0],
795
+ top: t[1],
796
+ right: t[2],
797
+ gap: Math.max(0, r - n + t[2] - t[0])
798
+ };
799
+ }, mn = Ke(), V = "data-scroll-locked", hn = function(e, t, n, r) {
800
+ var o = e.left, s = e.top, c = e.right, i = e.gap;
801
+ return n === void 0 && (n = "margin"), `
802
+ .`.concat(Gt, ` {
803
+ overflow: hidden `).concat(r, `;
804
+ padding-right: `).concat(i, "px ").concat(r, `;
805
+ }
806
+ body[`).concat(V, `] {
807
+ overflow: hidden `).concat(r, `;
808
+ overscroll-behavior: contain;
809
+ `).concat([
810
+ t && "position: relative ".concat(r, ";"),
811
+ n === "margin" && `
812
+ padding-left: `.concat(o, `px;
813
+ padding-top: `).concat(s, `px;
814
+ padding-right: `).concat(c, `px;
815
+ margin-left:0;
816
+ margin-top:0;
817
+ margin-right: `).concat(i, "px ").concat(r, `;
818
+ `),
819
+ n === "padding" && "padding-right: ".concat(i, "px ").concat(r, ";")
820
+ ].filter(Boolean).join(""), `
821
+ }
822
+
823
+ .`).concat(Q, ` {
824
+ right: `).concat(i, "px ").concat(r, `;
825
+ }
826
+
827
+ .`).concat(J, ` {
828
+ margin-right: `).concat(i, "px ").concat(r, `;
829
+ }
830
+
831
+ .`).concat(Q, " .").concat(Q, ` {
832
+ right: 0 `).concat(r, `;
833
+ }
834
+
835
+ .`).concat(J, " .").concat(J, ` {
836
+ margin-right: 0 `).concat(r, `;
837
+ }
838
+
839
+ body[`).concat(V, `] {
840
+ `).concat(Zt, ": ").concat(i, `px;
841
+ }
842
+ `);
843
+ }, Oe = function() {
844
+ var e = parseInt(document.body.getAttribute(V) || "0", 10);
845
+ return isFinite(e) ? e : 0;
846
+ }, pn = function() {
847
+ a.useEffect(function() {
848
+ return document.body.setAttribute(V, (Oe() + 1).toString()), function() {
849
+ var e = Oe() - 1;
850
+ e <= 0 ? document.body.removeAttribute(V) : document.body.setAttribute(V, e.toString());
851
+ };
852
+ }, []);
853
+ }, gn = function(e) {
854
+ var t = e.noRelative, n = e.noImportant, r = e.gapMode, o = r === void 0 ? "margin" : r;
855
+ pn();
856
+ var s = a.useMemo(function() {
857
+ return vn(o);
858
+ }, [o]);
859
+ return a.createElement(mn, { styles: hn(s, !t, o, n ? "" : "!important") });
860
+ }, ve = !1;
861
+ if (typeof window < "u")
862
+ try {
863
+ var X = Object.defineProperty({}, "passive", {
864
+ get: function() {
865
+ return ve = !0, !0;
866
+ }
867
+ });
868
+ window.addEventListener("test", X, X), window.removeEventListener("test", X, X);
869
+ } catch {
870
+ ve = !1;
871
+ }
872
+ var W = ve ? { passive: !1 } : !1, Sn = function(e) {
873
+ return e.tagName === "TEXTAREA";
874
+ }, Ve = function(e, t) {
875
+ if (!(e instanceof Element))
876
+ return !1;
877
+ var n = window.getComputedStyle(e);
878
+ return (
879
+ // not-not-scrollable
880
+ n[t] !== "hidden" && // contains scroll inside self
881
+ !(n.overflowY === n.overflowX && !Sn(e) && n[t] === "visible")
882
+ );
883
+ }, yn = function(e) {
884
+ return Ve(e, "overflowY");
885
+ }, En = function(e) {
886
+ return Ve(e, "overflowX");
887
+ }, Ne = function(e, t) {
888
+ var n = t.ownerDocument, r = t;
889
+ do {
890
+ typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host);
891
+ var o = ze(e, r);
892
+ if (o) {
893
+ var s = He(e, r), c = s[1], i = s[2];
894
+ if (c > i)
895
+ return !0;
896
+ }
897
+ r = r.parentNode;
898
+ } while (r && r !== n.body);
899
+ return !1;
900
+ }, bn = function(e) {
901
+ var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight;
902
+ return [
903
+ t,
904
+ n,
905
+ r
906
+ ];
907
+ }, wn = function(e) {
908
+ var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth;
909
+ return [
910
+ t,
911
+ n,
912
+ r
913
+ ];
914
+ }, ze = function(e, t) {
915
+ return e === "v" ? yn(t) : En(t);
916
+ }, He = function(e, t) {
917
+ return e === "v" ? bn(t) : wn(t);
918
+ }, Cn = function(e, t) {
919
+ return e === "h" && t === "rtl" ? -1 : 1;
920
+ }, Rn = function(e, t, n, r, o) {
921
+ var s = Cn(e, window.getComputedStyle(t).direction), c = s * r, i = n.target, f = t.contains(i), d = !1, v = c > 0, l = 0, h = 0;
922
+ do {
923
+ if (!i)
924
+ break;
925
+ var g = He(e, i), b = g[0], u = g[1], m = g[2], p = u - m - s * b;
926
+ (b || p) && ze(e, i) && (l += p, h += b);
927
+ var E = i.parentNode;
928
+ i = E && E.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? E.host : E;
929
+ } while (
930
+ // portaled content
931
+ !f && i !== document.body || // self content
932
+ f && (t.contains(i) || t === i)
933
+ );
934
+ return (v && Math.abs(l) < 1 || !v && Math.abs(h) < 1) && (d = !0), d;
935
+ }, G = function(e) {
936
+ return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
937
+ }, De = function(e) {
938
+ return [e.deltaX, e.deltaY];
939
+ }, Te = function(e) {
940
+ return e && "current" in e ? e.current : e;
941
+ }, Pn = function(e, t) {
942
+ return e[0] === t[0] && e[1] === t[1];
943
+ }, An = function(e) {
944
+ return `
945
+ .block-interactivity-`.concat(e, ` {pointer-events: none;}
946
+ .allow-interactivity-`).concat(e, ` {pointer-events: all;}
947
+ `);
948
+ }, Mn = 0, U = [];
949
+ function xn(e) {
950
+ var t = a.useRef([]), n = a.useRef([0, 0]), r = a.useRef(), o = a.useState(Mn++)[0], s = a.useState(Ke)[0], c = a.useRef(e);
951
+ a.useEffect(function() {
952
+ c.current = e;
953
+ }, [e]), a.useEffect(function() {
954
+ if (e.inert) {
955
+ document.body.classList.add("block-interactivity-".concat(o));
956
+ var u = Xt([e.lockRef.current], (e.shards || []).map(Te), !0).filter(Boolean);
957
+ return u.forEach(function(m) {
958
+ return m.classList.add("allow-interactivity-".concat(o));
959
+ }), function() {
960
+ document.body.classList.remove("block-interactivity-".concat(o)), u.forEach(function(m) {
961
+ return m.classList.remove("allow-interactivity-".concat(o));
962
+ });
963
+ };
964
+ }
965
+ }, [e.inert, e.lockRef.current, e.shards]);
966
+ var i = a.useCallback(function(u, m) {
967
+ if ("touches" in u && u.touches.length === 2 || u.type === "wheel" && u.ctrlKey)
968
+ return !c.current.allowPinchZoom;
969
+ var p = G(u), E = n.current, y = "deltaX" in u ? u.deltaX : E[0] - p[0], S = "deltaY" in u ? u.deltaY : E[1] - p[1], C, P = u.target, w = Math.abs(y) > Math.abs(S) ? "h" : "v";
970
+ if ("touches" in u && w === "h" && P.type === "range")
971
+ return !1;
972
+ var x = Ne(w, P);
973
+ if (!x)
974
+ return !0;
975
+ if (x ? C = w : (C = w === "v" ? "h" : "v", x = Ne(w, P)), !x)
976
+ return !1;
977
+ if (!r.current && "changedTouches" in u && (y || S) && (r.current = C), !C)
978
+ return !0;
979
+ var L = r.current || C;
980
+ return Rn(L, m, u, L === "h" ? y : S);
981
+ }, []), f = a.useCallback(function(u) {
982
+ var m = u;
983
+ if (!(!U.length || U[U.length - 1] !== s)) {
984
+ var p = "deltaY" in m ? De(m) : G(m), E = t.current.filter(function(C) {
985
+ return C.name === m.type && (C.target === m.target || m.target === C.shadowParent) && Pn(C.delta, p);
986
+ })[0];
987
+ if (E && E.should) {
988
+ m.cancelable && m.preventDefault();
989
+ return;
990
+ }
991
+ if (!E) {
992
+ var y = (c.current.shards || []).map(Te).filter(Boolean).filter(function(C) {
993
+ return C.contains(m.target);
994
+ }), S = y.length > 0 ? i(m, y[0]) : !c.current.noIsolation;
995
+ S && m.cancelable && m.preventDefault();
996
+ }
997
+ }
998
+ }, []), d = a.useCallback(function(u, m, p, E) {
999
+ var y = { name: u, delta: m, target: p, should: E, shadowParent: On(p) };
1000
+ t.current.push(y), setTimeout(function() {
1001
+ t.current = t.current.filter(function(S) {
1002
+ return S !== y;
1003
+ });
1004
+ }, 1);
1005
+ }, []), v = a.useCallback(function(u) {
1006
+ n.current = G(u), r.current = void 0;
1007
+ }, []), l = a.useCallback(function(u) {
1008
+ d(u.type, De(u), u.target, i(u, e.lockRef.current));
1009
+ }, []), h = a.useCallback(function(u) {
1010
+ d(u.type, G(u), u.target, i(u, e.lockRef.current));
1011
+ }, []);
1012
+ a.useEffect(function() {
1013
+ return U.push(s), e.setCallbacks({
1014
+ onScrollCapture: l,
1015
+ onWheelCapture: l,
1016
+ onTouchMoveCapture: h
1017
+ }), document.addEventListener("wheel", f, W), document.addEventListener("touchmove", f, W), document.addEventListener("touchstart", v, W), function() {
1018
+ U = U.filter(function(u) {
1019
+ return u !== s;
1020
+ }), document.removeEventListener("wheel", f, W), document.removeEventListener("touchmove", f, W), document.removeEventListener("touchstart", v, W);
1021
+ };
1022
+ }, []);
1023
+ var g = e.removeScrollBar, b = e.inert;
1024
+ return a.createElement(
1025
+ a.Fragment,
1026
+ null,
1027
+ b ? a.createElement(s, { styles: An(o) }) : null,
1028
+ g ? a.createElement(gn, { noRelative: e.noRelative, gapMode: e.gapMode }) : null
1029
+ );
1030
+ }
1031
+ function On(e) {
1032
+ for (var t = null; e !== null; )
1033
+ e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
1034
+ return t;
1035
+ }
1036
+ const Nn = rn(Ue, xn);
1037
+ var Dn = a.forwardRef(function(e, t) {
1038
+ return a.createElement(ee, O({}, e, { ref: t, sideCar: Nn }));
1039
+ });
1040
+ Dn.classNames = ee.classNames;
1041
+ var Tn = function(e) {
1042
+ if (typeof document > "u")
1043
+ return null;
1044
+ var t = Array.isArray(e) ? e[0] : e;
1045
+ return t.ownerDocument.body;
1046
+ }, K = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new WeakMap(), q = {}, le = 0, $e = function(e) {
1047
+ return e && (e.host || $e(e.parentNode));
1048
+ }, In = function(e, t) {
1049
+ return t.map(function(n) {
1050
+ if (e.contains(n))
1051
+ return n;
1052
+ var r = $e(n);
1053
+ return r && e.contains(r) ? r : (console.error("aria-hidden", n, "in not contained inside", e, ". Doing nothing"), null);
1054
+ }).filter(function(n) {
1055
+ return !!n;
1056
+ });
1057
+ }, Ln = function(e, t, n, r) {
1058
+ var o = In(t, Array.isArray(e) ? e : [e]);
1059
+ q[n] || (q[n] = /* @__PURE__ */ new WeakMap());
1060
+ var s = q[n], c = [], i = /* @__PURE__ */ new Set(), f = new Set(o), d = function(l) {
1061
+ !l || i.has(l) || (i.add(l), d(l.parentNode));
1062
+ };
1063
+ o.forEach(d);
1064
+ var v = function(l) {
1065
+ !l || f.has(l) || Array.prototype.forEach.call(l.children, function(h) {
1066
+ if (i.has(h))
1067
+ v(h);
1068
+ else
1069
+ try {
1070
+ var g = h.getAttribute(r), b = g !== null && g !== "false", u = (K.get(h) || 0) + 1, m = (s.get(h) || 0) + 1;
1071
+ K.set(h, u), s.set(h, m), c.push(h), u === 1 && b && Z.set(h, !0), m === 1 && h.setAttribute(n, "true"), b || h.setAttribute(r, "true");
1072
+ } catch (p) {
1073
+ console.error("aria-hidden: cannot operate on ", h, p);
1074
+ }
1075
+ });
1076
+ };
1077
+ return v(t), i.clear(), le++, function() {
1078
+ c.forEach(function(l) {
1079
+ var h = K.get(l) - 1, g = s.get(l) - 1;
1080
+ K.set(l, h), s.set(l, g), h || (Z.has(l) || l.removeAttribute(r), Z.delete(l)), g || l.removeAttribute(n);
1081
+ }), le--, le || (K = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new WeakMap(), q = {});
1082
+ };
1083
+ }, sr = function(e, t, n) {
1084
+ n === void 0 && (n = "data-aria-hidden");
1085
+ var r = Array.from(Array.isArray(e) ? e : [e]), o = Tn(e);
1086
+ return o ? (r.push.apply(r, Array.from(o.querySelectorAll("[aria-live], script"))), Ln(r, o, n, "aria-hidden")) : function() {
1087
+ return null;
1088
+ };
1089
+ };
1090
+ function je(e, [t, n]) {
1091
+ return Math.min(n, Math.max(t, e));
1092
+ }
1093
+ var _n = a.createContext(void 0);
1094
+ function kn(e) {
1095
+ const t = a.useContext(_n);
1096
+ return e || t || "ltr";
1097
+ }
1098
+ function Fn(e) {
1099
+ const t = a.useRef({ value: e, previous: e });
1100
+ return a.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
1101
+ }
1102
+ function Bn(e) {
1103
+ const [t, n] = a.useState(void 0);
1104
+ return z(() => {
1105
+ if (e) {
1106
+ n({ width: e.offsetWidth, height: e.offsetHeight });
1107
+ const r = new ResizeObserver((o) => {
1108
+ if (!Array.isArray(o) || !o.length)
1109
+ return;
1110
+ const s = o[0];
1111
+ let c, i;
1112
+ if ("borderBoxSize" in s) {
1113
+ const f = s.borderBoxSize, d = Array.isArray(f) ? f[0] : f;
1114
+ c = d.inlineSize, i = d.blockSize;
1115
+ } else
1116
+ c = e.offsetWidth, i = e.offsetHeight;
1117
+ n({ width: c, height: i });
1118
+ });
1119
+ return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
1120
+ } else
1121
+ n(void 0);
1122
+ }, [e]), t;
1123
+ }
1124
+ function Wn(e) {
1125
+ const t = e + "CollectionProvider", [n, r] = Le(t), [o, s] = n(
1126
+ t,
1127
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
1128
+ ), c = (u) => {
1129
+ const { scope: m, children: p } = u, E = F.useRef(null), y = F.useRef(/* @__PURE__ */ new Map()).current;
1130
+ return /* @__PURE__ */ R(o, { scope: m, itemMap: y, collectionRef: E, children: p });
1131
+ };
1132
+ c.displayName = t;
1133
+ const i = e + "CollectionSlot", f = /* @__PURE__ */ de(i), d = F.forwardRef(
1134
+ (u, m) => {
1135
+ const { scope: p, children: E } = u, y = s(i, p), S = M(m, y.collectionRef);
1136
+ return /* @__PURE__ */ R(f, { ref: S, children: E });
1137
+ }
1138
+ );
1139
+ d.displayName = i;
1140
+ const v = e + "CollectionItemSlot", l = "data-radix-collection-item", h = /* @__PURE__ */ de(v), g = F.forwardRef(
1141
+ (u, m) => {
1142
+ const { scope: p, children: E, ...y } = u, S = F.useRef(null), C = M(m, S), P = s(v, p);
1143
+ return F.useEffect(() => (P.itemMap.set(S, { ref: S, ...y }), () => void P.itemMap.delete(S))), /* @__PURE__ */ R(h, { [l]: "", ref: C, children: E });
1144
+ }
1145
+ );
1146
+ g.displayName = v;
1147
+ function b(u) {
1148
+ const m = s(e + "CollectionConsumer", u);
1149
+ return F.useCallback(() => {
1150
+ const E = m.collectionRef.current;
1151
+ if (!E) return [];
1152
+ const y = Array.from(E.querySelectorAll(`[${l}]`));
1153
+ return Array.from(m.itemMap.values()).sort(
1154
+ (P, w) => y.indexOf(P.ref.current) - y.indexOf(w.ref.current)
1155
+ );
1156
+ }, [m.collectionRef, m.itemMap]);
1157
+ }
1158
+ return [
1159
+ { Provider: c, Slot: d, ItemSlot: g },
1160
+ b,
1161
+ r
1162
+ ];
1163
+ }
1164
+ var Ye = ["PageUp", "PageDown"], Xe = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Ge = {
1165
+ "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
1166
+ "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
1167
+ "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
1168
+ "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
1169
+ }, H = "Slider", [me, Un, Kn] = Wn(H), [Ze, cr] = Le(H, [
1170
+ Kn
1171
+ ]), [Vn, te] = Ze(H), qe = a.forwardRef(
1172
+ (e, t) => {
1173
+ const {
1174
+ name: n,
1175
+ min: r = 0,
1176
+ max: o = 100,
1177
+ step: s = 1,
1178
+ orientation: c = "horizontal",
1179
+ disabled: i = !1,
1180
+ minStepsBetweenThumbs: f = 0,
1181
+ defaultValue: d = [r],
1182
+ value: v,
1183
+ onValueChange: l = () => {
1184
+ },
1185
+ onValueCommit: h = () => {
1186
+ },
1187
+ inverted: g = !1,
1188
+ form: b,
1189
+ ...u
1190
+ } = e, m = a.useRef(/* @__PURE__ */ new Set()), p = a.useRef(0), y = c === "horizontal" ? zn : Hn, [S = [], C] = ht({
1191
+ prop: v,
1192
+ defaultProp: d,
1193
+ onChange: (A) => {
1194
+ [...m.current][p.current]?.focus(), l(A);
1195
+ }
1196
+ }), P = a.useRef(S);
1197
+ function w(A) {
1198
+ const _ = Gn(S, A);
1199
+ N(A, _);
1200
+ }
1201
+ function x(A) {
1202
+ N(A, p.current);
1203
+ }
1204
+ function L() {
1205
+ const A = P.current[p.current];
1206
+ S[p.current] !== A && h(S);
1207
+ }
1208
+ function N(A, _, { commit: ne } = { commit: !1 }) {
1209
+ const Se = Jn(s), re = er(Math.round((A - r) / s) * s + r, Se), $ = je(re, [r, o]);
1210
+ C((B = []) => {
1211
+ const k = Yn(B, $, _);
1212
+ if (Qn(k, f * s)) {
1213
+ p.current = k.indexOf($);
1214
+ const ye = String(k) !== String(B);
1215
+ return ye && ne && h(k), ye ? k : B;
1216
+ } else
1217
+ return B;
1218
+ });
1219
+ }
1220
+ return /* @__PURE__ */ R(
1221
+ Vn,
1222
+ {
1223
+ scope: e.__scopeSlider,
1224
+ name: n,
1225
+ disabled: i,
1226
+ min: r,
1227
+ max: o,
1228
+ valueIndexToChangeRef: p,
1229
+ thumbs: m.current,
1230
+ values: S,
1231
+ orientation: c,
1232
+ form: b,
1233
+ children: /* @__PURE__ */ R(me.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ R(me.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ R(
1234
+ y,
1235
+ {
1236
+ "aria-disabled": i,
1237
+ "data-disabled": i ? "" : void 0,
1238
+ ...u,
1239
+ ref: t,
1240
+ onPointerDown: D(u.onPointerDown, () => {
1241
+ i || (P.current = S);
1242
+ }),
1243
+ min: r,
1244
+ max: o,
1245
+ inverted: g,
1246
+ onSlideStart: i ? void 0 : w,
1247
+ onSlideMove: i ? void 0 : x,
1248
+ onSlideEnd: i ? void 0 : L,
1249
+ onHomeKeyDown: () => !i && N(r, 0, { commit: !0 }),
1250
+ onEndKeyDown: () => !i && N(o, S.length - 1, { commit: !0 }),
1251
+ onStepKeyDown: ({ event: A, direction: _ }) => {
1252
+ if (!i) {
1253
+ const re = Ye.includes(A.key) || A.shiftKey && Xe.includes(A.key) ? 10 : 1, $ = p.current, B = S[$], k = s * re * _;
1254
+ N(B + k, $, { commit: !0 });
1255
+ }
1256
+ }
1257
+ }
1258
+ ) }) })
1259
+ }
1260
+ );
1261
+ }
1262
+ );
1263
+ qe.displayName = H;
1264
+ var [Qe, Je] = Ze(H, {
1265
+ startEdge: "left",
1266
+ endEdge: "right",
1267
+ size: "width",
1268
+ direction: 1
1269
+ }), zn = a.forwardRef(
1270
+ (e, t) => {
1271
+ const {
1272
+ min: n,
1273
+ max: r,
1274
+ dir: o,
1275
+ inverted: s,
1276
+ onSlideStart: c,
1277
+ onSlideMove: i,
1278
+ onSlideEnd: f,
1279
+ onStepKeyDown: d,
1280
+ ...v
1281
+ } = e, [l, h] = a.useState(null), g = M(t, (y) => h(y)), b = a.useRef(void 0), u = kn(o), m = u === "ltr", p = m && !s || !m && s;
1282
+ function E(y) {
1283
+ const S = b.current || l.getBoundingClientRect(), C = [0, S.width], w = ge(C, p ? [n, r] : [r, n]);
1284
+ return b.current = S, w(y - S.left);
1285
+ }
1286
+ return /* @__PURE__ */ R(
1287
+ Qe,
1288
+ {
1289
+ scope: e.__scopeSlider,
1290
+ startEdge: p ? "left" : "right",
1291
+ endEdge: p ? "right" : "left",
1292
+ direction: p ? 1 : -1,
1293
+ size: "width",
1294
+ children: /* @__PURE__ */ R(
1295
+ et,
1296
+ {
1297
+ dir: u,
1298
+ "data-orientation": "horizontal",
1299
+ ...v,
1300
+ ref: g,
1301
+ style: {
1302
+ ...v.style,
1303
+ "--radix-slider-thumb-transform": "translateX(-50%)"
1304
+ },
1305
+ onSlideStart: (y) => {
1306
+ const S = E(y.clientX);
1307
+ c?.(S);
1308
+ },
1309
+ onSlideMove: (y) => {
1310
+ const S = E(y.clientX);
1311
+ i?.(S);
1312
+ },
1313
+ onSlideEnd: () => {
1314
+ b.current = void 0, f?.();
1315
+ },
1316
+ onStepKeyDown: (y) => {
1317
+ const C = Ge[p ? "from-left" : "from-right"].includes(y.key);
1318
+ d?.({ event: y, direction: C ? -1 : 1 });
1319
+ }
1320
+ }
1321
+ )
1322
+ }
1323
+ );
1324
+ }
1325
+ ), Hn = a.forwardRef(
1326
+ (e, t) => {
1327
+ const {
1328
+ min: n,
1329
+ max: r,
1330
+ inverted: o,
1331
+ onSlideStart: s,
1332
+ onSlideMove: c,
1333
+ onSlideEnd: i,
1334
+ onStepKeyDown: f,
1335
+ ...d
1336
+ } = e, v = a.useRef(null), l = M(t, v), h = a.useRef(void 0), g = !o;
1337
+ function b(u) {
1338
+ const m = h.current || v.current.getBoundingClientRect(), p = [0, m.height], y = ge(p, g ? [r, n] : [n, r]);
1339
+ return h.current = m, y(u - m.top);
1340
+ }
1341
+ return /* @__PURE__ */ R(
1342
+ Qe,
1343
+ {
1344
+ scope: e.__scopeSlider,
1345
+ startEdge: g ? "bottom" : "top",
1346
+ endEdge: g ? "top" : "bottom",
1347
+ size: "height",
1348
+ direction: g ? 1 : -1,
1349
+ children: /* @__PURE__ */ R(
1350
+ et,
1351
+ {
1352
+ "data-orientation": "vertical",
1353
+ ...d,
1354
+ ref: l,
1355
+ style: {
1356
+ ...d.style,
1357
+ "--radix-slider-thumb-transform": "translateY(50%)"
1358
+ },
1359
+ onSlideStart: (u) => {
1360
+ const m = b(u.clientY);
1361
+ s?.(m);
1362
+ },
1363
+ onSlideMove: (u) => {
1364
+ const m = b(u.clientY);
1365
+ c?.(m);
1366
+ },
1367
+ onSlideEnd: () => {
1368
+ h.current = void 0, i?.();
1369
+ },
1370
+ onStepKeyDown: (u) => {
1371
+ const p = Ge[g ? "from-bottom" : "from-top"].includes(u.key);
1372
+ f?.({ event: u, direction: p ? -1 : 1 });
1373
+ }
1374
+ }
1375
+ )
1376
+ }
1377
+ );
1378
+ }
1379
+ ), et = a.forwardRef(
1380
+ (e, t) => {
1381
+ const {
1382
+ __scopeSlider: n,
1383
+ onSlideStart: r,
1384
+ onSlideMove: o,
1385
+ onSlideEnd: s,
1386
+ onHomeKeyDown: c,
1387
+ onEndKeyDown: i,
1388
+ onStepKeyDown: f,
1389
+ ...d
1390
+ } = e, v = te(H, n);
1391
+ return /* @__PURE__ */ R(
1392
+ T.span,
1393
+ {
1394
+ ...d,
1395
+ ref: t,
1396
+ onKeyDown: D(e.onKeyDown, (l) => {
1397
+ l.key === "Home" ? (c(l), l.preventDefault()) : l.key === "End" ? (i(l), l.preventDefault()) : Ye.concat(Xe).includes(l.key) && (f(l), l.preventDefault());
1398
+ }),
1399
+ onPointerDown: D(e.onPointerDown, (l) => {
1400
+ const h = l.target;
1401
+ h.setPointerCapture(l.pointerId), l.preventDefault(), v.thumbs.has(h) ? h.focus() : r(l);
1402
+ }),
1403
+ onPointerMove: D(e.onPointerMove, (l) => {
1404
+ l.target.hasPointerCapture(l.pointerId) && o(l);
1405
+ }),
1406
+ onPointerUp: D(e.onPointerUp, (l) => {
1407
+ const h = l.target;
1408
+ h.hasPointerCapture(l.pointerId) && (h.releasePointerCapture(l.pointerId), s(l));
1409
+ })
1410
+ }
1411
+ );
1412
+ }
1413
+ ), tt = "SliderTrack", nt = a.forwardRef(
1414
+ (e, t) => {
1415
+ const { __scopeSlider: n, ...r } = e, o = te(tt, n);
1416
+ return /* @__PURE__ */ R(
1417
+ T.span,
1418
+ {
1419
+ "data-disabled": o.disabled ? "" : void 0,
1420
+ "data-orientation": o.orientation,
1421
+ ...r,
1422
+ ref: t
1423
+ }
1424
+ );
1425
+ }
1426
+ );
1427
+ nt.displayName = tt;
1428
+ var he = "SliderRange", rt = a.forwardRef(
1429
+ (e, t) => {
1430
+ const { __scopeSlider: n, ...r } = e, o = te(he, n), s = Je(he, n), c = a.useRef(null), i = M(t, c), f = o.values.length, d = o.values.map(
1431
+ (h) => at(h, o.min, o.max)
1432
+ ), v = f > 1 ? Math.min(...d) : 0, l = 100 - Math.max(...d);
1433
+ return /* @__PURE__ */ R(
1434
+ T.span,
1435
+ {
1436
+ "data-orientation": o.orientation,
1437
+ "data-disabled": o.disabled ? "" : void 0,
1438
+ ...r,
1439
+ ref: i,
1440
+ style: {
1441
+ ...e.style,
1442
+ [s.startEdge]: v + "%",
1443
+ [s.endEdge]: l + "%"
1444
+ }
1445
+ }
1446
+ );
1447
+ }
1448
+ );
1449
+ rt.displayName = he;
1450
+ var pe = "SliderThumb", ot = a.forwardRef(
1451
+ (e, t) => {
1452
+ const n = Un(e.__scopeSlider), [r, o] = a.useState(null), s = M(t, (i) => o(i)), c = a.useMemo(
1453
+ () => r ? n().findIndex((i) => i.ref.current === r) : -1,
1454
+ [n, r]
1455
+ );
1456
+ return /* @__PURE__ */ R($n, { ...e, ref: s, index: c });
1457
+ }
1458
+ ), $n = a.forwardRef(
1459
+ (e, t) => {
1460
+ const { __scopeSlider: n, index: r, name: o, ...s } = e, c = te(pe, n), i = Je(pe, n), [f, d] = a.useState(null), v = M(t, (E) => d(E)), l = f ? c.form || !!f.closest("form") : !0, h = Bn(f), g = c.values[r], b = g === void 0 ? 0 : at(g, c.min, c.max), u = Xn(r, c.values.length), m = h?.[i.size], p = m ? Zn(m, b, i.direction) : 0;
1461
+ return a.useEffect(() => {
1462
+ if (f)
1463
+ return c.thumbs.add(f), () => {
1464
+ c.thumbs.delete(f);
1465
+ };
1466
+ }, [f, c.thumbs]), /* @__PURE__ */ ct(
1467
+ "span",
1468
+ {
1469
+ style: {
1470
+ transform: "var(--radix-slider-thumb-transform)",
1471
+ position: "absolute",
1472
+ [i.startEdge]: `calc(${b}% + ${p}px)`
1473
+ },
1474
+ children: [
1475
+ /* @__PURE__ */ R(me.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ R(
1476
+ T.span,
1477
+ {
1478
+ role: "slider",
1479
+ "aria-label": e["aria-label"] || u,
1480
+ "aria-valuemin": c.min,
1481
+ "aria-valuenow": g,
1482
+ "aria-valuemax": c.max,
1483
+ "aria-orientation": c.orientation,
1484
+ "data-orientation": c.orientation,
1485
+ "data-disabled": c.disabled ? "" : void 0,
1486
+ tabIndex: c.disabled ? void 0 : 0,
1487
+ ...s,
1488
+ ref: v,
1489
+ style: g === void 0 ? { display: "none" } : e.style,
1490
+ onFocus: D(e.onFocus, () => {
1491
+ c.valueIndexToChangeRef.current = r;
1492
+ })
1493
+ }
1494
+ ) }),
1495
+ l && /* @__PURE__ */ R(
1496
+ it,
1497
+ {
1498
+ name: o ?? (c.name ? c.name + (c.values.length > 1 ? "[]" : "") : void 0),
1499
+ form: c.form,
1500
+ value: g
1501
+ },
1502
+ r
1503
+ )
1504
+ ]
1505
+ }
1506
+ );
1507
+ }
1508
+ );
1509
+ ot.displayName = pe;
1510
+ var jn = "RadioBubbleInput", it = a.forwardRef(
1511
+ ({ __scopeSlider: e, value: t, ...n }, r) => {
1512
+ const o = a.useRef(null), s = M(o, r), c = Fn(t);
1513
+ return a.useEffect(() => {
1514
+ const i = o.current;
1515
+ if (!i) return;
1516
+ const f = window.HTMLInputElement.prototype, v = Object.getOwnPropertyDescriptor(f, "value").set;
1517
+ if (c !== t && v) {
1518
+ const l = new Event("input", { bubbles: !0 });
1519
+ v.call(i, t), i.dispatchEvent(l);
1520
+ }
1521
+ }, [c, t]), /* @__PURE__ */ R(
1522
+ T.input,
1523
+ {
1524
+ style: { display: "none" },
1525
+ ...n,
1526
+ ref: s,
1527
+ defaultValue: t
1528
+ }
1529
+ );
1530
+ }
1531
+ );
1532
+ it.displayName = jn;
1533
+ function Yn(e = [], t, n) {
1534
+ const r = [...e];
1535
+ return r[n] = t, r.sort((o, s) => o - s);
1536
+ }
1537
+ function at(e, t, n) {
1538
+ const s = 100 / (n - t) * (e - t);
1539
+ return je(s, [0, 100]);
1540
+ }
1541
+ function Xn(e, t) {
1542
+ return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
1543
+ }
1544
+ function Gn(e, t) {
1545
+ if (e.length === 1) return 0;
1546
+ const n = e.map((o) => Math.abs(o - t)), r = Math.min(...n);
1547
+ return n.indexOf(r);
1548
+ }
1549
+ function Zn(e, t, n) {
1550
+ const r = e / 2, s = ge([0, 50], [0, r]);
1551
+ return (r - s(t) * n) * n;
1552
+ }
1553
+ function qn(e) {
1554
+ return e.slice(0, -1).map((t, n) => e[n + 1] - t);
1555
+ }
1556
+ function Qn(e, t) {
1557
+ if (t > 0) {
1558
+ const n = qn(e);
1559
+ return Math.min(...n) >= t;
1560
+ }
1561
+ return !0;
1562
+ }
1563
+ function ge(e, t) {
1564
+ return (n) => {
1565
+ if (e[0] === e[1] || t[0] === t[1]) return t[0];
1566
+ const r = (t[1] - t[0]) / (e[1] - e[0]);
1567
+ return t[0] + r * (n - e[0]);
1568
+ };
1569
+ }
1570
+ function Jn(e) {
1571
+ return (String(e).split(".")[1] || "").length;
1572
+ }
1573
+ function er(e, t) {
1574
+ const n = Math.pow(10, t);
1575
+ return Math.round(e * n) / n;
1576
+ }
1577
+ var ur = qe, lr = nt, dr = rt, fr = ot;
1578
+ export {
1579
+ Ot as D,
1580
+ _t as F,
1581
+ T as P,
1582
+ Dn as R,
1583
+ lr as T,
1584
+ D as a,
1585
+ ht as b,
1586
+ Le as c,
1587
+ ir as d,
1588
+ $t as e,
1589
+ zt as f,
1590
+ de as g,
1591
+ sr as h,
1592
+ ar as i,
1593
+ or as j,
1594
+ ur as k,
1595
+ dr as l,
1596
+ fr as m,
1597
+ M as u
1598
+ };