@still-forest/canopy 0.38.0 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2478 @@
1
+ import { j as n } from "./jsx-runtime-B0GD0xBr.js";
2
+ import { c as ee, u as U, B as Ne, h as Tr, i as Pr, j as Se, g as Mr } from "./calendar-C-nHBQQ8.js";
3
+ import * as a from "react";
4
+ import { useState as _e, useEffect as pt, useRef as Ar, useMemo as Dr } from "react";
5
+ import { F as ne, G as Or } from "./Layout-CvVv48kM.js";
6
+ import { T as Te } from "./Heading-DjVutKs1.js";
7
+ import { L as Fr } from "./Loader-B_h7e46-.js";
8
+ import { d as Ie, j as ft, e as te, f as _, h as D, u as et, c as Ce, w as mt, g as ht, x as vt, l as xt, m as gt, n as bt, o as wt, p as Lr, A as Br, i as oe, q as $r, V as Vr, y as Gr, z as Hr, B as Kr, F as Ur, s as zr, t as Wr, r as qr, k as yt, R as Yr, P as Xr, O as Zr, C as Jr } from "./index-CA-6Q-v_.js";
9
+ import { c as B } from "./index-CRiPKpXj.js";
10
+ import * as St from "react-dom";
11
+ /**
12
+ * @license lucide-react v0.544.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */
17
+ const Qr = [
18
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
19
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
20
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
21
+ ["path", { d: "M3 10h18", key: "8toen8" }]
22
+ ], en = ee("calendar", Qr);
23
+ /**
24
+ * @license lucide-react v0.544.0 - ISC
25
+ *
26
+ * This source code is licensed under the ISC license.
27
+ * See the LICENSE file in the root directory of this source tree.
28
+ */
29
+ const tn = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], tt = ee("check", tn);
30
+ /**
31
+ * @license lucide-react v0.544.0 - ISC
32
+ *
33
+ * This source code is licensed under the ISC license.
34
+ * See the LICENSE file in the root directory of this source tree.
35
+ */
36
+ const rn = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], nn = ee("chevron-up", rn);
37
+ /**
38
+ * @license lucide-react v0.544.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */
43
+ const on = [
44
+ ["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
45
+ ["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
46
+ ], an = ee("chevrons-up-down", on);
47
+ /**
48
+ * @license lucide-react v0.544.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */
53
+ const sn = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], ln = ee("circle", sn);
54
+ /**
55
+ * @license lucide-react v0.544.0 - ISC
56
+ *
57
+ * This source code is licensed under the ISC license.
58
+ * See the LICENSE file in the root directory of this source tree.
59
+ */
60
+ const cn = [
61
+ ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
62
+ [
63
+ "path",
64
+ {
65
+ d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
66
+ key: "116196"
67
+ }
68
+ ],
69
+ ["path", { d: "m9 14 2 2 4-4", key: "df797q" }]
70
+ ], dn = ee("clipboard-check", cn);
71
+ /**
72
+ * @license lucide-react v0.544.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */
77
+ const un = [
78
+ ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
79
+ [
80
+ "path",
81
+ {
82
+ d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
83
+ key: "116196"
84
+ }
85
+ ]
86
+ ], pn = ee("clipboard", un);
87
+ /**
88
+ * @license lucide-react v0.544.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */
93
+ const fn = [
94
+ [
95
+ "path",
96
+ {
97
+ d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
98
+ key: "1c8476"
99
+ }
100
+ ],
101
+ ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
102
+ ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
103
+ ], mn = ee("save", fn);
104
+ /**
105
+ * @license lucide-react v0.544.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */
110
+ const hn = [
111
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
112
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
113
+ ], vn = ee("search", hn);
114
+ /**
115
+ * @license lucide-react v0.544.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */
120
+ const xn = [
121
+ [
122
+ "path",
123
+ {
124
+ d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
125
+ key: "1ffxy3"
126
+ }
127
+ ],
128
+ ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
129
+ ], Ve = ee("send", xn);
130
+ /**
131
+ * @license lucide-react v0.544.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */
136
+ const gn = [
137
+ ["path", { d: "M10 11v6", key: "nco0om" }],
138
+ ["path", { d: "M14 11v6", key: "outv1u" }],
139
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
140
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
141
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
142
+ ], bn = ee("trash-2", gn);
143
+ var Ge = "rovingFocusGroup.onEntryFocus", wn = { bubbles: !1, cancelable: !0 }, Re = "RovingFocusGroup", [ze, Ct, yn] = ft(Re), [Sn, It] = Ie(
144
+ Re,
145
+ [yn]
146
+ ), [Cn, In] = Sn(Re), Rt = a.forwardRef(
147
+ (e, r) => /* @__PURE__ */ n.jsx(ze.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ n.jsx(ze.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ n.jsx(Rn, { ...e, ref: r }) }) })
148
+ );
149
+ Rt.displayName = Re;
150
+ var Rn = a.forwardRef((e, r) => {
151
+ const {
152
+ __scopeRovingFocusGroup: t,
153
+ orientation: s,
154
+ loop: o = !1,
155
+ dir: l,
156
+ currentTabStopId: c,
157
+ defaultCurrentTabStopId: i,
158
+ onCurrentTabStopIdChange: u,
159
+ onEntryFocus: d,
160
+ preventScrollOnEntryFocus: p = !1,
161
+ ...m
162
+ } = e, w = a.useRef(null), g = U(r, w), y = et(l), [h, v] = Ce({
163
+ prop: c,
164
+ defaultProp: i ?? null,
165
+ onChange: u,
166
+ caller: Re
167
+ }), [C, b] = a.useState(!1), I = mt(d), L = Ct(t), O = a.useRef(!1), [T, E] = a.useState(0);
168
+ return a.useEffect(() => {
169
+ const M = w.current;
170
+ if (M)
171
+ return M.addEventListener(Ge, I), () => M.removeEventListener(Ge, I);
172
+ }, [I]), /* @__PURE__ */ n.jsx(
173
+ Cn,
174
+ {
175
+ scope: t,
176
+ orientation: s,
177
+ dir: y,
178
+ loop: o,
179
+ currentTabStopId: h,
180
+ onItemFocus: a.useCallback(
181
+ (M) => v(M),
182
+ [v]
183
+ ),
184
+ onItemShiftTab: a.useCallback(() => b(!0), []),
185
+ onFocusableItemAdd: a.useCallback(
186
+ () => E((M) => M + 1),
187
+ []
188
+ ),
189
+ onFocusableItemRemove: a.useCallback(
190
+ () => E((M) => M - 1),
191
+ []
192
+ ),
193
+ children: /* @__PURE__ */ n.jsx(
194
+ _.div,
195
+ {
196
+ tabIndex: C || T === 0 ? -1 : 0,
197
+ "data-orientation": s,
198
+ ...m,
199
+ ref: g,
200
+ style: { outline: "none", ...e.style },
201
+ onMouseDown: D(e.onMouseDown, () => {
202
+ O.current = !0;
203
+ }),
204
+ onFocus: D(e.onFocus, (M) => {
205
+ const Y = !O.current;
206
+ if (M.target === M.currentTarget && Y && !C) {
207
+ const W = new CustomEvent(Ge, wn);
208
+ if (M.currentTarget.dispatchEvent(W), !W.defaultPrevented) {
209
+ const G = L().filter((F) => F.focusable), z = G.find((F) => F.active), X = G.find((F) => F.id === h), K = [z, X, ...G].filter(
210
+ Boolean
211
+ ).map((F) => F.ref.current);
212
+ jt(K, p);
213
+ }
214
+ }
215
+ O.current = !1;
216
+ }),
217
+ onBlur: D(e.onBlur, () => b(!1))
218
+ }
219
+ )
220
+ }
221
+ );
222
+ }), kt = "RovingFocusGroupItem", Et = a.forwardRef(
223
+ (e, r) => {
224
+ const {
225
+ __scopeRovingFocusGroup: t,
226
+ focusable: s = !0,
227
+ active: o = !1,
228
+ tabStopId: l,
229
+ children: c,
230
+ ...i
231
+ } = e, u = te(), d = l || u, p = In(kt, t), m = p.currentTabStopId === d, w = Ct(t), { onFocusableItemAdd: g, onFocusableItemRemove: y, currentTabStopId: h } = p;
232
+ return a.useEffect(() => {
233
+ if (s)
234
+ return g(), () => y();
235
+ }, [s, g, y]), /* @__PURE__ */ n.jsx(
236
+ ze.ItemSlot,
237
+ {
238
+ scope: t,
239
+ id: d,
240
+ focusable: s,
241
+ active: o,
242
+ children: /* @__PURE__ */ n.jsx(
243
+ _.span,
244
+ {
245
+ tabIndex: m ? 0 : -1,
246
+ "data-orientation": p.orientation,
247
+ ...i,
248
+ ref: r,
249
+ onMouseDown: D(e.onMouseDown, (v) => {
250
+ s ? p.onItemFocus(d) : v.preventDefault();
251
+ }),
252
+ onFocus: D(e.onFocus, () => p.onItemFocus(d)),
253
+ onKeyDown: D(e.onKeyDown, (v) => {
254
+ if (v.key === "Tab" && v.shiftKey) {
255
+ p.onItemShiftTab();
256
+ return;
257
+ }
258
+ if (v.target !== v.currentTarget) return;
259
+ const C = jn(v, p.orientation, p.dir);
260
+ if (C !== void 0) {
261
+ if (v.metaKey || v.ctrlKey || v.altKey || v.shiftKey) return;
262
+ v.preventDefault();
263
+ let I = w().filter((L) => L.focusable).map((L) => L.ref.current);
264
+ if (C === "last") I.reverse();
265
+ else if (C === "prev" || C === "next") {
266
+ C === "prev" && I.reverse();
267
+ const L = I.indexOf(v.currentTarget);
268
+ I = p.loop ? Nn(I, L + 1) : I.slice(L + 1);
269
+ }
270
+ setTimeout(() => jt(I));
271
+ }
272
+ }),
273
+ children: typeof c == "function" ? c({ isCurrentTabStop: m, hasTabStop: h != null }) : c
274
+ }
275
+ )
276
+ }
277
+ );
278
+ }
279
+ );
280
+ Et.displayName = kt;
281
+ var kn = {
282
+ ArrowLeft: "prev",
283
+ ArrowUp: "prev",
284
+ ArrowRight: "next",
285
+ ArrowDown: "next",
286
+ PageUp: "first",
287
+ Home: "first",
288
+ PageDown: "last",
289
+ End: "last"
290
+ };
291
+ function En(e, r) {
292
+ return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
293
+ }
294
+ function jn(e, r, t) {
295
+ const s = En(e.key, t);
296
+ if (!(r === "vertical" && ["ArrowLeft", "ArrowRight"].includes(s)) && !(r === "horizontal" && ["ArrowUp", "ArrowDown"].includes(s)))
297
+ return kn[s];
298
+ }
299
+ function jt(e, r = !1) {
300
+ const t = document.activeElement;
301
+ for (const s of e)
302
+ if (s === t || (s.focus({ preventScroll: r }), document.activeElement !== t)) return;
303
+ }
304
+ function Nn(e, r) {
305
+ return e.map((t, s) => e[(r + s) % e.length]);
306
+ }
307
+ var _n = Rt, Tn = Et;
308
+ const _a = ({ disabled: e = !1, handleDelete: r, ...t }) => /* @__PURE__ */ n.jsx(
309
+ Ne,
310
+ {
311
+ disabled: e,
312
+ icon: /* @__PURE__ */ n.jsx(bn, {}),
313
+ onClick: r,
314
+ variant: "outline",
315
+ ...t,
316
+ className: "border-destructive text-destructive hover:bg-destructive hover:text-white",
317
+ children: "Delete"
318
+ }
319
+ ), lt = {
320
+ default: { label: "Submit", submittingLabel: "Submitting", IconComponent: Ve },
321
+ submit: { label: "Submit", submittingLabel: "Submitting", IconComponent: Ve },
322
+ save: { label: "Save", submittingLabel: "Saving", IconComponent: mn },
323
+ send: { label: "Send", submittingLabel: "Sending", IconComponent: Ve }
324
+ }, Ta = ({
325
+ submitting: e = !1,
326
+ disabled: r = !1,
327
+ submittingIcon: t,
328
+ action: s = "default",
329
+ label: o,
330
+ submittingLabel: l,
331
+ icon: c,
332
+ noIcon: i = !1,
333
+ ...u
334
+ }) => {
335
+ if (!lt[s])
336
+ throw new Error(`Invalid action: ${s}`);
337
+ const d = lt[s], p = o || d.label, m = l || d.submittingLabel, w = c || d.IconComponent, g = e ? /* @__PURE__ */ n.jsx(Fr, { icon: t }) : /* @__PURE__ */ n.jsx(w, {});
338
+ return /* @__PURE__ */ n.jsx(
339
+ Ne,
340
+ {
341
+ disabled: r || e,
342
+ icon: i ? void 0 : g,
343
+ type: "submit",
344
+ variant: "primary",
345
+ ...u,
346
+ children: e ? m : p
347
+ }
348
+ );
349
+ };
350
+ function rt(e) {
351
+ const r = a.useRef({ value: e, previous: e });
352
+ return a.useMemo(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
353
+ }
354
+ var Pe = "Checkbox", [Pn, Pa] = Ie(Pe), [Mn, nt] = Pn(Pe);
355
+ function An(e) {
356
+ const {
357
+ __scopeCheckbox: r,
358
+ checked: t,
359
+ children: s,
360
+ defaultChecked: o,
361
+ disabled: l,
362
+ form: c,
363
+ name: i,
364
+ onCheckedChange: u,
365
+ required: d,
366
+ value: p = "on",
367
+ // @ts-expect-error
368
+ internal_do_not_use_render: m
369
+ } = e, [w, g] = Ce({
370
+ prop: t,
371
+ defaultProp: o ?? !1,
372
+ onChange: u,
373
+ caller: Pe
374
+ }), [y, h] = a.useState(null), [v, C] = a.useState(null), b = a.useRef(!1), I = y ? !!c || !!y.closest("form") : (
375
+ // We set this to true by default so that events bubble to forms without JS (SSR)
376
+ !0
377
+ ), L = {
378
+ checked: w,
379
+ disabled: l,
380
+ setChecked: g,
381
+ control: y,
382
+ setControl: h,
383
+ name: i,
384
+ form: c,
385
+ value: p,
386
+ hasConsumerStoppedPropagationRef: b,
387
+ required: d,
388
+ defaultChecked: re(o) ? !1 : o,
389
+ isFormControl: I,
390
+ bubbleInput: v,
391
+ setBubbleInput: C
392
+ };
393
+ return /* @__PURE__ */ n.jsx(
394
+ Mn,
395
+ {
396
+ scope: r,
397
+ ...L,
398
+ children: Dn(m) ? m(L) : s
399
+ }
400
+ );
401
+ }
402
+ var Nt = "CheckboxTrigger", _t = a.forwardRef(
403
+ ({ __scopeCheckbox: e, onKeyDown: r, onClick: t, ...s }, o) => {
404
+ const {
405
+ control: l,
406
+ value: c,
407
+ disabled: i,
408
+ checked: u,
409
+ required: d,
410
+ setControl: p,
411
+ setChecked: m,
412
+ hasConsumerStoppedPropagationRef: w,
413
+ isFormControl: g,
414
+ bubbleInput: y
415
+ } = nt(Nt, e), h = U(o, p), v = a.useRef(u);
416
+ return a.useEffect(() => {
417
+ const C = l?.form;
418
+ if (C) {
419
+ const b = () => m(v.current);
420
+ return C.addEventListener("reset", b), () => C.removeEventListener("reset", b);
421
+ }
422
+ }, [l, m]), /* @__PURE__ */ n.jsx(
423
+ _.button,
424
+ {
425
+ type: "button",
426
+ role: "checkbox",
427
+ "aria-checked": re(u) ? "mixed" : u,
428
+ "aria-required": d,
429
+ "data-state": Ot(u),
430
+ "data-disabled": i ? "" : void 0,
431
+ disabled: i,
432
+ value: c,
433
+ ...s,
434
+ ref: h,
435
+ onKeyDown: D(r, (C) => {
436
+ C.key === "Enter" && C.preventDefault();
437
+ }),
438
+ onClick: D(t, (C) => {
439
+ m((b) => re(b) ? !0 : !b), y && g && (w.current = C.isPropagationStopped(), w.current || C.stopPropagation());
440
+ })
441
+ }
442
+ );
443
+ }
444
+ );
445
+ _t.displayName = Nt;
446
+ var Tt = a.forwardRef(
447
+ (e, r) => {
448
+ const {
449
+ __scopeCheckbox: t,
450
+ name: s,
451
+ checked: o,
452
+ defaultChecked: l,
453
+ required: c,
454
+ disabled: i,
455
+ value: u,
456
+ onCheckedChange: d,
457
+ form: p,
458
+ ...m
459
+ } = e;
460
+ return /* @__PURE__ */ n.jsx(
461
+ An,
462
+ {
463
+ __scopeCheckbox: t,
464
+ checked: o,
465
+ defaultChecked: l,
466
+ disabled: i,
467
+ required: c,
468
+ onCheckedChange: d,
469
+ name: s,
470
+ form: p,
471
+ value: u,
472
+ internal_do_not_use_render: ({ isFormControl: w }) => /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
473
+ /* @__PURE__ */ n.jsx(
474
+ _t,
475
+ {
476
+ ...m,
477
+ ref: r,
478
+ __scopeCheckbox: t
479
+ }
480
+ ),
481
+ w && /* @__PURE__ */ n.jsx(
482
+ Dt,
483
+ {
484
+ __scopeCheckbox: t
485
+ }
486
+ )
487
+ ] })
488
+ }
489
+ );
490
+ }
491
+ );
492
+ Tt.displayName = Pe;
493
+ var Pt = "CheckboxIndicator", Mt = a.forwardRef(
494
+ (e, r) => {
495
+ const { __scopeCheckbox: t, forceMount: s, ...o } = e, l = nt(Pt, t);
496
+ return /* @__PURE__ */ n.jsx(
497
+ ht,
498
+ {
499
+ present: s || re(l.checked) || l.checked === !0,
500
+ children: /* @__PURE__ */ n.jsx(
501
+ _.span,
502
+ {
503
+ "data-state": Ot(l.checked),
504
+ "data-disabled": l.disabled ? "" : void 0,
505
+ ...o,
506
+ ref: r,
507
+ style: { pointerEvents: "none", ...e.style }
508
+ }
509
+ )
510
+ }
511
+ );
512
+ }
513
+ );
514
+ Mt.displayName = Pt;
515
+ var At = "CheckboxBubbleInput", Dt = a.forwardRef(
516
+ ({ __scopeCheckbox: e, ...r }, t) => {
517
+ const {
518
+ control: s,
519
+ hasConsumerStoppedPropagationRef: o,
520
+ checked: l,
521
+ defaultChecked: c,
522
+ required: i,
523
+ disabled: u,
524
+ name: d,
525
+ value: p,
526
+ form: m,
527
+ bubbleInput: w,
528
+ setBubbleInput: g
529
+ } = nt(At, e), y = U(t, g), h = rt(l), v = vt(s);
530
+ a.useEffect(() => {
531
+ const b = w;
532
+ if (!b) return;
533
+ const I = window.HTMLInputElement.prototype, O = Object.getOwnPropertyDescriptor(
534
+ I,
535
+ "checked"
536
+ ).set, T = !o.current;
537
+ if (h !== l && O) {
538
+ const E = new Event("click", { bubbles: T });
539
+ b.indeterminate = re(l), O.call(b, re(l) ? !1 : l), b.dispatchEvent(E);
540
+ }
541
+ }, [w, h, l, o]);
542
+ const C = a.useRef(re(l) ? !1 : l);
543
+ return /* @__PURE__ */ n.jsx(
544
+ _.input,
545
+ {
546
+ type: "checkbox",
547
+ "aria-hidden": !0,
548
+ defaultChecked: c ?? C.current,
549
+ required: i,
550
+ disabled: u,
551
+ name: d,
552
+ value: p,
553
+ form: m,
554
+ ...r,
555
+ tabIndex: -1,
556
+ ref: y,
557
+ style: {
558
+ ...r.style,
559
+ ...v,
560
+ position: "absolute",
561
+ pointerEvents: "none",
562
+ opacity: 0,
563
+ margin: 0,
564
+ // We transform because the input is absolutely positioned but we have
565
+ // rendered it **after** the button. This pulls it back to sit on top
566
+ // of the button.
567
+ transform: "translateX(-100%)"
568
+ }
569
+ }
570
+ );
571
+ }
572
+ );
573
+ Dt.displayName = At;
574
+ function Dn(e) {
575
+ return typeof e == "function";
576
+ }
577
+ function re(e) {
578
+ return e === "indeterminate";
579
+ }
580
+ function Ot(e) {
581
+ return re(e) ? "indeterminate" : e ? "checked" : "unchecked";
582
+ }
583
+ function On({ className: e, ...r }) {
584
+ return /* @__PURE__ */ n.jsx(
585
+ Tt,
586
+ {
587
+ className: B(
588
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
589
+ e
590
+ ),
591
+ "data-slot": "checkbox",
592
+ ...r,
593
+ children: /* @__PURE__ */ n.jsx(
594
+ Mt,
595
+ {
596
+ className: "flex items-center justify-center text-current transition-none",
597
+ "data-slot": "checkbox-indicator",
598
+ children: /* @__PURE__ */ n.jsx(tt, { className: "size-3.5" })
599
+ }
600
+ )
601
+ }
602
+ );
603
+ }
604
+ const Ma = ({ label: e, name: r, value: t, checked: s, onCheckedChange: o }) => {
605
+ const [l, c] = _e(s);
606
+ pt(() => {
607
+ c(s);
608
+ }, [s]);
609
+ let i = r;
610
+ const u = t || r;
611
+ t && (i += `[${t}]`);
612
+ const d = (p) => {
613
+ c(p), o?.(p);
614
+ };
615
+ return /* @__PURE__ */ n.jsxs(ne, { align: "center", gap: "2", children: [
616
+ /* @__PURE__ */ n.jsx(
617
+ On,
618
+ {
619
+ checked: l,
620
+ id: i,
621
+ name: r,
622
+ onCheckedChange: d,
623
+ value: u
624
+ }
625
+ ),
626
+ /* @__PURE__ */ n.jsx(xe, { className: "cursor-pointer", htmlFor: i, children: e })
627
+ ] });
628
+ }, Aa = ({ content: e, className: r, size: t = "md", ...s }) => {
629
+ const [o, l] = _e(!1), c = Ar(null);
630
+ pt(() => () => {
631
+ c.current && clearTimeout(c.current);
632
+ }, []);
633
+ const i = () => {
634
+ const u = navigator.clipboard?.writeText;
635
+ u && (l(!0), u.call(navigator.clipboard, e).then(() => {
636
+ c.current && clearTimeout(c.current), c.current = setTimeout(() => {
637
+ l(!1), c.current = null;
638
+ }, 2e3);
639
+ }).catch(() => {
640
+ l(!1);
641
+ }));
642
+ };
643
+ return /* @__PURE__ */ n.jsx(
644
+ Ne,
645
+ {
646
+ className: B(
647
+ {
648
+ "w-[88px]": t === "xs",
649
+ "w-[96px]": t === "sm",
650
+ "w-[100px]": t === "md",
651
+ "w-[125px]": t === "lg",
652
+ "w-[144px]": t === "xl"
653
+ },
654
+ "justify-start",
655
+ r
656
+ ),
657
+ disabled: o,
658
+ icon: o ? /* @__PURE__ */ n.jsx(dn, {}) : /* @__PURE__ */ n.jsx(pn, {}),
659
+ label: o ? "Copied" : "Copy",
660
+ onClick: i,
661
+ size: t,
662
+ ...s
663
+ }
664
+ );
665
+ }, Da = ({ name: e, label: r, placeholder: t, note: s, className: o, size: l = "md", ...c }) => /* @__PURE__ */ n.jsx(
666
+ Lt,
667
+ {
668
+ className: B(
669
+ l === "xs" && "max-w-[140px] md:max-w-[135px]",
670
+ l === "sm" && "max-w-[150px] md:max-w-[140px]",
671
+ l === "md" && "max-w-[170px] md:max-w-[150px]",
672
+ l === "lg" && "max-w-[180px] md:max-w-[170px]",
673
+ l === "xl" && "max-w-[200px]",
674
+ o
675
+ ),
676
+ label: r,
677
+ name: e,
678
+ note: s,
679
+ placeholder: t,
680
+ size: l,
681
+ type: "date",
682
+ ...c
683
+ }
684
+ ), Oa = ({ onDateSelection: e, initialValue: r, className: t, size: s = "default", error: o }) => {
685
+ const [l, c] = _e(r), i = (u) => {
686
+ c(u), u && e(u);
687
+ };
688
+ return /* @__PURE__ */ n.jsxs(ne, { direction: "col", gap: "2", children: [
689
+ /* @__PURE__ */ n.jsxs(xt, { children: [
690
+ /* @__PURE__ */ n.jsx(gt, { asChild: !0, children: /* @__PURE__ */ n.jsxs(
691
+ Ne,
692
+ {
693
+ className: B("w-[280px] justify-start text-left font-normal", !l && "text-muted-foreground", t),
694
+ size: s,
695
+ variant: "outline",
696
+ children: [
697
+ /* @__PURE__ */ n.jsx(en, { className: "mr-2 h-4 w-4" }),
698
+ l ? l.toISOString().split("T")[0] : /* @__PURE__ */ n.jsx("span", { children: "Select a date" })
699
+ ]
700
+ }
701
+ ) }),
702
+ /* @__PURE__ */ n.jsx(bt, { className: "w-auto p-0", children: /* @__PURE__ */ n.jsx(Tr, { autoFocus: !0, mode: "single", onSelect: i, selected: l }) })
703
+ ] }),
704
+ o && /* @__PURE__ */ n.jsx(ke, { message: o })
705
+ ] });
706
+ }, ke = ({ message: e }) => /* @__PURE__ */ n.jsx(Te, { size: "xs", variant: "destructive", children: e }), Fn = ({ label: e, labelFor: r, className: t = "", labelClassName: s = "", children: o }) => /* @__PURE__ */ n.jsxs(ne, { direction: "col", gap: "2", children: [
707
+ e && /* @__PURE__ */ n.jsx(xe, { className: s, htmlFor: r, children: e }),
708
+ /* @__PURE__ */ n.jsx(ne, { className: `rounded-md border border-input bg-card p-2 shadow-xs ${t}`, gapY: "1", children: o })
709
+ ] });
710
+ var Ln = "Label", Ft = a.forwardRef((e, r) => /* @__PURE__ */ n.jsx(
711
+ _.label,
712
+ {
713
+ ...e,
714
+ ref: r,
715
+ onMouseDown: (t) => {
716
+ t.target.closest("button, input, select, textarea") || (e.onMouseDown?.(t), !t.defaultPrevented && t.detail > 1 && t.preventDefault());
717
+ }
718
+ }
719
+ ));
720
+ Ft.displayName = Ln;
721
+ var Bn = Ft;
722
+ function $n({ className: e, ...r }) {
723
+ return /* @__PURE__ */ n.jsx(
724
+ Bn,
725
+ {
726
+ className: B(
727
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
728
+ e
729
+ ),
730
+ "data-slot": "label",
731
+ ...r
732
+ }
733
+ );
734
+ }
735
+ const xe = ({ htmlFor: e, value: r, children: t, className: s = "", ...o }) => /* @__PURE__ */ n.jsx(
736
+ $n,
737
+ {
738
+ className: B("font-display font-normal text-base text-foreground", s),
739
+ htmlFor: e,
740
+ ...o,
741
+ children: r || t
742
+ }
743
+ ), Lt = ({
744
+ name: e,
745
+ type: r = "text",
746
+ placeholder: t,
747
+ label: s,
748
+ labelOrientation: o = "top",
749
+ note: l,
750
+ size: c = "md",
751
+ className: i,
752
+ error: u,
753
+ ...d
754
+ }) => {
755
+ const p = B(
756
+ "flex w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 shadow-xs outline-none",
757
+ "transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex ",
758
+ "file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm",
759
+ "placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
760
+ "dark:bg-input/30 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
761
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
762
+ c === "xs" && "h-7 text-xs md:text-xs",
763
+ c === "sm" && "h-8 text-sm md:text-xs",
764
+ c === "md" && "h-9 text-base md:text-sm",
765
+ c === "lg" && "h-10 text-lg md:text-base",
766
+ c === "xl" && "h-11 text-xl md:text-lg",
767
+ i
768
+ );
769
+ return /* @__PURE__ */ n.jsxs(ne, { className: "w-full", direction: o === "left" ? "row" : "col", gap: "2", children: [
770
+ s && /* @__PURE__ */ n.jsx(xe, { className: o === "left" ? "text-nowrap" : "", htmlFor: e, children: s }),
771
+ /* @__PURE__ */ n.jsx(
772
+ "input",
773
+ {
774
+ "aria-label": s || e,
775
+ className: p,
776
+ "data-slot": "input",
777
+ id: e,
778
+ name: e,
779
+ placeholder: t,
780
+ type: r,
781
+ ...d
782
+ }
783
+ ),
784
+ l && /* @__PURE__ */ n.jsx(Te, { size: "sm", variant: "muted", children: l }),
785
+ u && /* @__PURE__ */ n.jsx(ke, { message: u })
786
+ ] });
787
+ }, Fa = ({
788
+ name: e,
789
+ label: r,
790
+ placeholder: t,
791
+ note: s,
792
+ // Default to two decimal places for currency and general decimal values
793
+ step: o = ".01",
794
+ className: l,
795
+ ...c
796
+ }) => /* @__PURE__ */ n.jsx(
797
+ Lt,
798
+ {
799
+ className: l,
800
+ label: r,
801
+ name: e,
802
+ note: s,
803
+ placeholder: t,
804
+ step: o,
805
+ type: "number",
806
+ ...c
807
+ }
808
+ );
809
+ var ot = "Radio", [Vn, Bt] = Ie(ot), [Gn, Hn] = Vn(ot), $t = a.forwardRef(
810
+ (e, r) => {
811
+ const {
812
+ __scopeRadio: t,
813
+ name: s,
814
+ checked: o = !1,
815
+ required: l,
816
+ disabled: c,
817
+ value: i = "on",
818
+ onCheck: u,
819
+ form: d,
820
+ ...p
821
+ } = e, [m, w] = a.useState(null), g = U(r, (v) => w(v)), y = a.useRef(!1), h = m ? d || !!m.closest("form") : !0;
822
+ return /* @__PURE__ */ n.jsxs(Gn, { scope: t, checked: o, disabled: c, children: [
823
+ /* @__PURE__ */ n.jsx(
824
+ _.button,
825
+ {
826
+ type: "button",
827
+ role: "radio",
828
+ "aria-checked": o,
829
+ "data-state": Kt(o),
830
+ "data-disabled": c ? "" : void 0,
831
+ disabled: c,
832
+ value: i,
833
+ ...p,
834
+ ref: g,
835
+ onClick: D(e.onClick, (v) => {
836
+ o || u?.(), h && (y.current = v.isPropagationStopped(), y.current || v.stopPropagation());
837
+ })
838
+ }
839
+ ),
840
+ h && /* @__PURE__ */ n.jsx(
841
+ Ht,
842
+ {
843
+ control: m,
844
+ bubbles: !y.current,
845
+ name: s,
846
+ value: i,
847
+ checked: o,
848
+ required: l,
849
+ disabled: c,
850
+ form: d,
851
+ style: { transform: "translateX(-100%)" }
852
+ }
853
+ )
854
+ ] });
855
+ }
856
+ );
857
+ $t.displayName = ot;
858
+ var Vt = "RadioIndicator", Gt = a.forwardRef(
859
+ (e, r) => {
860
+ const { __scopeRadio: t, forceMount: s, ...o } = e, l = Hn(Vt, t);
861
+ return /* @__PURE__ */ n.jsx(ht, { present: s || l.checked, children: /* @__PURE__ */ n.jsx(
862
+ _.span,
863
+ {
864
+ "data-state": Kt(l.checked),
865
+ "data-disabled": l.disabled ? "" : void 0,
866
+ ...o,
867
+ ref: r
868
+ }
869
+ ) });
870
+ }
871
+ );
872
+ Gt.displayName = Vt;
873
+ var Kn = "RadioBubbleInput", Ht = a.forwardRef(
874
+ ({
875
+ __scopeRadio: e,
876
+ control: r,
877
+ checked: t,
878
+ bubbles: s = !0,
879
+ ...o
880
+ }, l) => {
881
+ const c = a.useRef(null), i = U(c, l), u = rt(t), d = vt(r);
882
+ return a.useEffect(() => {
883
+ const p = c.current;
884
+ if (!p) return;
885
+ const m = window.HTMLInputElement.prototype, g = Object.getOwnPropertyDescriptor(
886
+ m,
887
+ "checked"
888
+ ).set;
889
+ if (u !== t && g) {
890
+ const y = new Event("click", { bubbles: s });
891
+ g.call(p, t), p.dispatchEvent(y);
892
+ }
893
+ }, [u, t, s]), /* @__PURE__ */ n.jsx(
894
+ _.input,
895
+ {
896
+ type: "radio",
897
+ "aria-hidden": !0,
898
+ defaultChecked: t,
899
+ ...o,
900
+ tabIndex: -1,
901
+ ref: i,
902
+ style: {
903
+ ...o.style,
904
+ ...d,
905
+ position: "absolute",
906
+ pointerEvents: "none",
907
+ opacity: 0,
908
+ margin: 0
909
+ }
910
+ }
911
+ );
912
+ }
913
+ );
914
+ Ht.displayName = Kn;
915
+ function Kt(e) {
916
+ return e ? "checked" : "unchecked";
917
+ }
918
+ var Un = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Me = "RadioGroup", [zn, La] = Ie(Me, [
919
+ It,
920
+ Bt
921
+ ]), Ut = It(), zt = Bt(), [Wn, qn] = zn(Me), Wt = a.forwardRef(
922
+ (e, r) => {
923
+ const {
924
+ __scopeRadioGroup: t,
925
+ name: s,
926
+ defaultValue: o,
927
+ value: l,
928
+ required: c = !1,
929
+ disabled: i = !1,
930
+ orientation: u,
931
+ dir: d,
932
+ loop: p = !0,
933
+ onValueChange: m,
934
+ ...w
935
+ } = e, g = Ut(t), y = et(d), [h, v] = Ce({
936
+ prop: l,
937
+ defaultProp: o ?? null,
938
+ onChange: m,
939
+ caller: Me
940
+ });
941
+ return /* @__PURE__ */ n.jsx(
942
+ Wn,
943
+ {
944
+ scope: t,
945
+ name: s,
946
+ required: c,
947
+ disabled: i,
948
+ value: h,
949
+ onValueChange: v,
950
+ children: /* @__PURE__ */ n.jsx(
951
+ _n,
952
+ {
953
+ asChild: !0,
954
+ ...g,
955
+ orientation: u,
956
+ dir: y,
957
+ loop: p,
958
+ children: /* @__PURE__ */ n.jsx(
959
+ _.div,
960
+ {
961
+ role: "radiogroup",
962
+ "aria-required": c,
963
+ "aria-orientation": u,
964
+ "data-disabled": i ? "" : void 0,
965
+ dir: y,
966
+ ...w,
967
+ ref: r
968
+ }
969
+ )
970
+ }
971
+ )
972
+ }
973
+ );
974
+ }
975
+ );
976
+ Wt.displayName = Me;
977
+ var qt = "RadioGroupItem", Yt = a.forwardRef(
978
+ (e, r) => {
979
+ const { __scopeRadioGroup: t, disabled: s, ...o } = e, l = qn(qt, t), c = l.disabled || s, i = Ut(t), u = zt(t), d = a.useRef(null), p = U(r, d), m = l.value === o.value, w = a.useRef(!1);
980
+ return a.useEffect(() => {
981
+ const g = (h) => {
982
+ Un.includes(h.key) && (w.current = !0);
983
+ }, y = () => w.current = !1;
984
+ return document.addEventListener("keydown", g), document.addEventListener("keyup", y), () => {
985
+ document.removeEventListener("keydown", g), document.removeEventListener("keyup", y);
986
+ };
987
+ }, []), /* @__PURE__ */ n.jsx(
988
+ Tn,
989
+ {
990
+ asChild: !0,
991
+ ...i,
992
+ focusable: !c,
993
+ active: m,
994
+ children: /* @__PURE__ */ n.jsx(
995
+ $t,
996
+ {
997
+ disabled: c,
998
+ required: l.required,
999
+ checked: m,
1000
+ ...u,
1001
+ ...o,
1002
+ name: l.name,
1003
+ ref: p,
1004
+ onCheck: () => l.onValueChange(o.value),
1005
+ onKeyDown: D((g) => {
1006
+ g.key === "Enter" && g.preventDefault();
1007
+ }),
1008
+ onFocus: D(o.onFocus, () => {
1009
+ w.current && d.current?.click();
1010
+ })
1011
+ }
1012
+ )
1013
+ }
1014
+ );
1015
+ }
1016
+ );
1017
+ Yt.displayName = qt;
1018
+ var Yn = "RadioGroupIndicator", Xt = a.forwardRef(
1019
+ (e, r) => {
1020
+ const { __scopeRadioGroup: t, ...s } = e, o = zt(t);
1021
+ return /* @__PURE__ */ n.jsx(Gt, { ...o, ...s, ref: r });
1022
+ }
1023
+ );
1024
+ Xt.displayName = Yn;
1025
+ var Xn = Wt, Zn = Yt, Jn = Xt;
1026
+ function Qn({ className: e, ...r }) {
1027
+ return /* @__PURE__ */ n.jsx(Xn, { className: B("grid gap-3", e), "data-slot": "radio-group", ...r });
1028
+ }
1029
+ function eo({ className: e, ...r }) {
1030
+ return /* @__PURE__ */ n.jsx(
1031
+ Zn,
1032
+ {
1033
+ className: B(
1034
+ "border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
1035
+ e
1036
+ ),
1037
+ "data-slot": "radio-group-item",
1038
+ ...r,
1039
+ children: /* @__PURE__ */ n.jsx(
1040
+ Jn,
1041
+ {
1042
+ className: "relative flex items-center justify-center",
1043
+ "data-slot": "radio-group-indicator",
1044
+ children: /* @__PURE__ */ n.jsx(ln, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" })
1045
+ }
1046
+ )
1047
+ }
1048
+ );
1049
+ }
1050
+ const Ba = ({ label: e, name: r, options: t, value: s, onChange: o, error: l }) => /* @__PURE__ */ n.jsxs(Fn, { className: "flex flex-col gap-4 px-2 py-1", label: e, labelFor: r, children: [
1051
+ /* @__PURE__ */ n.jsx(Qn, { className: "w-full", name: r, onValueChange: o, value: s, children: /* @__PURE__ */ n.jsx(Or, { cols: "2", children: t.map((c, i) => /* @__PURE__ */ n.jsxs(ne, { align: "center", gap: "2", justify: "start", children: [
1052
+ /* @__PURE__ */ n.jsx(eo, { id: c.value, value: c.value }),
1053
+ /* @__PURE__ */ n.jsx(xe, { htmlFor: c.value, children: c.label })
1054
+ ] }, i)) }) }),
1055
+ l && /* @__PURE__ */ n.jsx(ke, { message: l })
1056
+ ] });
1057
+ function ct(e, [r, t]) {
1058
+ return Math.min(t, Math.max(r, e));
1059
+ }
1060
+ var to = [" ", "Enter", "ArrowUp", "ArrowDown"], ro = [" ", "Enter"], ue = "Select", [Ae, De, no] = ft(ue), [ge, $a] = Ie(ue, [
1061
+ no,
1062
+ wt
1063
+ ]), Oe = wt(), [oo, se] = ge(ue), [ao, so] = ge(ue), Zt = (e) => {
1064
+ const {
1065
+ __scopeSelect: r,
1066
+ children: t,
1067
+ open: s,
1068
+ defaultOpen: o,
1069
+ onOpenChange: l,
1070
+ value: c,
1071
+ defaultValue: i,
1072
+ onValueChange: u,
1073
+ dir: d,
1074
+ name: p,
1075
+ autoComplete: m,
1076
+ disabled: w,
1077
+ required: g,
1078
+ form: y
1079
+ } = e, h = Oe(r), [v, C] = a.useState(null), [b, I] = a.useState(null), [L, O] = a.useState(!1), T = et(d), [E, M] = Ce({
1080
+ prop: s,
1081
+ defaultProp: o ?? !1,
1082
+ onChange: l,
1083
+ caller: ue
1084
+ }), [Y, W] = Ce({
1085
+ prop: c,
1086
+ defaultProp: i,
1087
+ onChange: u,
1088
+ caller: ue
1089
+ }), G = a.useRef(null), z = v ? y || !!v.closest("form") : !0, [X, H] = a.useState(/* @__PURE__ */ new Set()), K = Array.from(X).map((F) => F.props.value).join(";");
1090
+ return /* @__PURE__ */ n.jsx(Lr, { ...h, children: /* @__PURE__ */ n.jsxs(
1091
+ oo,
1092
+ {
1093
+ required: g,
1094
+ scope: r,
1095
+ trigger: v,
1096
+ onTriggerChange: C,
1097
+ valueNode: b,
1098
+ onValueNodeChange: I,
1099
+ valueNodeHasChildren: L,
1100
+ onValueNodeHasChildrenChange: O,
1101
+ contentId: te(),
1102
+ value: Y,
1103
+ onValueChange: W,
1104
+ open: E,
1105
+ onOpenChange: M,
1106
+ dir: T,
1107
+ triggerPointerDownPosRef: G,
1108
+ disabled: w,
1109
+ children: [
1110
+ /* @__PURE__ */ n.jsx(Ae.Provider, { scope: r, children: /* @__PURE__ */ n.jsx(
1111
+ ao,
1112
+ {
1113
+ scope: e.__scopeSelect,
1114
+ onNativeOptionAdd: a.useCallback((F) => {
1115
+ H((q) => new Set(q).add(F));
1116
+ }, []),
1117
+ onNativeOptionRemove: a.useCallback((F) => {
1118
+ H((q) => {
1119
+ const Z = new Set(q);
1120
+ return Z.delete(F), Z;
1121
+ });
1122
+ }, []),
1123
+ children: t
1124
+ }
1125
+ ) }),
1126
+ z ? /* @__PURE__ */ n.jsxs(
1127
+ br,
1128
+ {
1129
+ "aria-hidden": !0,
1130
+ required: g,
1131
+ tabIndex: -1,
1132
+ name: p,
1133
+ autoComplete: m,
1134
+ value: Y,
1135
+ onChange: (F) => W(F.target.value),
1136
+ disabled: w,
1137
+ form: y,
1138
+ children: [
1139
+ Y === void 0 ? /* @__PURE__ */ n.jsx("option", { value: "" }) : null,
1140
+ Array.from(X)
1141
+ ]
1142
+ },
1143
+ K
1144
+ ) : null
1145
+ ]
1146
+ }
1147
+ ) });
1148
+ };
1149
+ Zt.displayName = ue;
1150
+ var Jt = "SelectTrigger", Qt = a.forwardRef(
1151
+ (e, r) => {
1152
+ const { __scopeSelect: t, disabled: s = !1, ...o } = e, l = Oe(t), c = se(Jt, t), i = c.disabled || s, u = U(r, c.onTriggerChange), d = De(t), p = a.useRef("touch"), [m, w, g] = yr((h) => {
1153
+ const v = d().filter((I) => !I.disabled), C = v.find((I) => I.value === c.value), b = Sr(v, h, C);
1154
+ b !== void 0 && c.onValueChange(b.value);
1155
+ }), y = (h) => {
1156
+ i || (c.onOpenChange(!0), g()), h && (c.triggerPointerDownPosRef.current = {
1157
+ x: Math.round(h.pageX),
1158
+ y: Math.round(h.pageY)
1159
+ });
1160
+ };
1161
+ return /* @__PURE__ */ n.jsx(Br, { asChild: !0, ...l, children: /* @__PURE__ */ n.jsx(
1162
+ _.button,
1163
+ {
1164
+ type: "button",
1165
+ role: "combobox",
1166
+ "aria-controls": c.contentId,
1167
+ "aria-expanded": c.open,
1168
+ "aria-required": c.required,
1169
+ "aria-autocomplete": "none",
1170
+ dir: c.dir,
1171
+ "data-state": c.open ? "open" : "closed",
1172
+ disabled: i,
1173
+ "data-disabled": i ? "" : void 0,
1174
+ "data-placeholder": wr(c.value) ? "" : void 0,
1175
+ ...o,
1176
+ ref: u,
1177
+ onClick: D(o.onClick, (h) => {
1178
+ h.currentTarget.focus(), p.current !== "mouse" && y(h);
1179
+ }),
1180
+ onPointerDown: D(o.onPointerDown, (h) => {
1181
+ p.current = h.pointerType;
1182
+ const v = h.target;
1183
+ v.hasPointerCapture(h.pointerId) && v.releasePointerCapture(h.pointerId), h.button === 0 && h.ctrlKey === !1 && h.pointerType === "mouse" && (y(h), h.preventDefault());
1184
+ }),
1185
+ onKeyDown: D(o.onKeyDown, (h) => {
1186
+ const v = m.current !== "";
1187
+ !(h.ctrlKey || h.altKey || h.metaKey) && h.key.length === 1 && w(h.key), !(v && h.key === " ") && to.includes(h.key) && (y(), h.preventDefault());
1188
+ })
1189
+ }
1190
+ ) });
1191
+ }
1192
+ );
1193
+ Qt.displayName = Jt;
1194
+ var er = "SelectValue", tr = a.forwardRef(
1195
+ (e, r) => {
1196
+ const { __scopeSelect: t, className: s, style: o, children: l, placeholder: c = "", ...i } = e, u = se(er, t), { onValueNodeHasChildrenChange: d } = u, p = l !== void 0, m = U(r, u.onValueNodeChange);
1197
+ return oe(() => {
1198
+ d(p);
1199
+ }, [d, p]), /* @__PURE__ */ n.jsx(
1200
+ _.span,
1201
+ {
1202
+ ...i,
1203
+ ref: m,
1204
+ style: { pointerEvents: "none" },
1205
+ children: wr(u.value) ? /* @__PURE__ */ n.jsx(n.Fragment, { children: c }) : l
1206
+ }
1207
+ );
1208
+ }
1209
+ );
1210
+ tr.displayName = er;
1211
+ var lo = "SelectIcon", rr = a.forwardRef(
1212
+ (e, r) => {
1213
+ const { __scopeSelect: t, children: s, ...o } = e;
1214
+ return /* @__PURE__ */ n.jsx(_.span, { "aria-hidden": !0, ...o, ref: r, children: s || "▼" });
1215
+ }
1216
+ );
1217
+ rr.displayName = lo;
1218
+ var co = "SelectPortal", nr = (e) => /* @__PURE__ */ n.jsx($r, { asChild: !0, ...e });
1219
+ nr.displayName = co;
1220
+ var pe = "SelectContent", or = a.forwardRef(
1221
+ (e, r) => {
1222
+ const t = se(pe, e.__scopeSelect), [s, o] = a.useState();
1223
+ if (oe(() => {
1224
+ o(new DocumentFragment());
1225
+ }, []), !t.open) {
1226
+ const l = s;
1227
+ return l ? St.createPortal(
1228
+ /* @__PURE__ */ n.jsx(ar, { scope: e.__scopeSelect, children: /* @__PURE__ */ n.jsx(Ae.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ n.jsx("div", { children: e.children }) }) }),
1229
+ l
1230
+ ) : null;
1231
+ }
1232
+ return /* @__PURE__ */ n.jsx(sr, { ...e, ref: r });
1233
+ }
1234
+ );
1235
+ or.displayName = pe;
1236
+ var Q = 10, [ar, le] = ge(pe), io = "SelectContentImpl", uo = Pr("SelectContent.RemoveScroll"), sr = a.forwardRef(
1237
+ (e, r) => {
1238
+ const {
1239
+ __scopeSelect: t,
1240
+ position: s = "item-aligned",
1241
+ onCloseAutoFocus: o,
1242
+ onEscapeKeyDown: l,
1243
+ onPointerDownOutside: c,
1244
+ //
1245
+ // PopperContent props
1246
+ side: i,
1247
+ sideOffset: u,
1248
+ align: d,
1249
+ alignOffset: p,
1250
+ arrowPadding: m,
1251
+ collisionBoundary: w,
1252
+ collisionPadding: g,
1253
+ sticky: y,
1254
+ hideWhenDetached: h,
1255
+ avoidCollisions: v,
1256
+ //
1257
+ ...C
1258
+ } = e, b = se(pe, t), [I, L] = a.useState(null), [O, T] = a.useState(null), E = U(r, (x) => L(x)), [M, Y] = a.useState(null), [W, G] = a.useState(
1259
+ null
1260
+ ), z = De(t), [X, H] = a.useState(!1), K = a.useRef(!1);
1261
+ a.useEffect(() => {
1262
+ if (I) return Gr(I);
1263
+ }, [I]), Hr();
1264
+ const F = a.useCallback(
1265
+ (x) => {
1266
+ const [N, ...P] = z().map((V) => V.ref.current), [A] = P.slice(-1), $ = document.activeElement;
1267
+ for (const V of x)
1268
+ if (V === $ || (V?.scrollIntoView({ block: "nearest" }), V === N && O && (O.scrollTop = 0), V === A && O && (O.scrollTop = O.scrollHeight), V?.focus(), document.activeElement !== $)) return;
1269
+ },
1270
+ [z, O]
1271
+ ), q = a.useCallback(
1272
+ () => F([M, I]),
1273
+ [F, M, I]
1274
+ );
1275
+ a.useEffect(() => {
1276
+ X && q();
1277
+ }, [X, q]);
1278
+ const { onOpenChange: Z, triggerPointerDownPosRef: J } = b;
1279
+ a.useEffect(() => {
1280
+ if (I) {
1281
+ let x = { x: 0, y: 0 };
1282
+ const N = (A) => {
1283
+ x = {
1284
+ x: Math.abs(Math.round(A.pageX) - (J.current?.x ?? 0)),
1285
+ y: Math.abs(Math.round(A.pageY) - (J.current?.y ?? 0))
1286
+ };
1287
+ }, P = (A) => {
1288
+ x.x <= 10 && x.y <= 10 ? A.preventDefault() : I.contains(A.target) || Z(!1), document.removeEventListener("pointermove", N), J.current = null;
1289
+ };
1290
+ return J.current !== null && (document.addEventListener("pointermove", N), document.addEventListener("pointerup", P, { capture: !0, once: !0 })), () => {
1291
+ document.removeEventListener("pointermove", N), document.removeEventListener("pointerup", P, { capture: !0 });
1292
+ };
1293
+ }
1294
+ }, [I, Z, J]), a.useEffect(() => {
1295
+ const x = () => Z(!1);
1296
+ return window.addEventListener("blur", x), window.addEventListener("resize", x), () => {
1297
+ window.removeEventListener("blur", x), window.removeEventListener("resize", x);
1298
+ };
1299
+ }, [Z]);
1300
+ const [me, ce] = yr((x) => {
1301
+ const N = z().filter(($) => !$.disabled), P = N.find(($) => $.ref.current === document.activeElement), A = Sr(N, x, P);
1302
+ A && setTimeout(() => A.ref.current.focus());
1303
+ }), f = a.useCallback(
1304
+ (x, N, P) => {
1305
+ const A = !K.current && !P;
1306
+ (b.value !== void 0 && b.value === N || A) && (Y(x), A && (K.current = !0));
1307
+ },
1308
+ [b.value]
1309
+ ), R = a.useCallback(() => I?.focus(), [I]), k = a.useCallback(
1310
+ (x, N, P) => {
1311
+ const A = !K.current && !P;
1312
+ (b.value !== void 0 && b.value === N || A) && G(x);
1313
+ },
1314
+ [b.value]
1315
+ ), S = s === "popper" ? We : lr, j = S === We ? {
1316
+ side: i,
1317
+ sideOffset: u,
1318
+ align: d,
1319
+ alignOffset: p,
1320
+ arrowPadding: m,
1321
+ collisionBoundary: w,
1322
+ collisionPadding: g,
1323
+ sticky: y,
1324
+ hideWhenDetached: h,
1325
+ avoidCollisions: v
1326
+ } : {};
1327
+ return /* @__PURE__ */ n.jsx(
1328
+ ar,
1329
+ {
1330
+ scope: t,
1331
+ content: I,
1332
+ viewport: O,
1333
+ onViewportChange: T,
1334
+ itemRefCallback: f,
1335
+ selectedItem: M,
1336
+ onItemLeave: R,
1337
+ itemTextRefCallback: k,
1338
+ focusSelectedItem: q,
1339
+ selectedItemText: W,
1340
+ position: s,
1341
+ isPositioned: X,
1342
+ searchRef: me,
1343
+ children: /* @__PURE__ */ n.jsx(Kr, { as: uo, allowPinchZoom: !0, children: /* @__PURE__ */ n.jsx(
1344
+ Ur,
1345
+ {
1346
+ asChild: !0,
1347
+ trapped: b.open,
1348
+ onMountAutoFocus: (x) => {
1349
+ x.preventDefault();
1350
+ },
1351
+ onUnmountAutoFocus: D(o, (x) => {
1352
+ b.trigger?.focus({ preventScroll: !0 }), x.preventDefault();
1353
+ }),
1354
+ children: /* @__PURE__ */ n.jsx(
1355
+ zr,
1356
+ {
1357
+ asChild: !0,
1358
+ disableOutsidePointerEvents: !0,
1359
+ onEscapeKeyDown: l,
1360
+ onPointerDownOutside: c,
1361
+ onFocusOutside: (x) => x.preventDefault(),
1362
+ onDismiss: () => b.onOpenChange(!1),
1363
+ children: /* @__PURE__ */ n.jsx(
1364
+ S,
1365
+ {
1366
+ role: "listbox",
1367
+ id: b.contentId,
1368
+ "data-state": b.open ? "open" : "closed",
1369
+ dir: b.dir,
1370
+ onContextMenu: (x) => x.preventDefault(),
1371
+ ...C,
1372
+ ...j,
1373
+ onPlaced: () => H(!0),
1374
+ ref: E,
1375
+ style: {
1376
+ // flex layout so we can place the scroll buttons properly
1377
+ display: "flex",
1378
+ flexDirection: "column",
1379
+ // reset the outline by default as the content MAY get focused
1380
+ outline: "none",
1381
+ ...C.style
1382
+ },
1383
+ onKeyDown: D(C.onKeyDown, (x) => {
1384
+ const N = x.ctrlKey || x.altKey || x.metaKey;
1385
+ if (x.key === "Tab" && x.preventDefault(), !N && x.key.length === 1 && ce(x.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(x.key)) {
1386
+ let A = z().filter(($) => !$.disabled).map(($) => $.ref.current);
1387
+ if (["ArrowUp", "End"].includes(x.key) && (A = A.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(x.key)) {
1388
+ const $ = x.target, V = A.indexOf($);
1389
+ A = A.slice(V + 1);
1390
+ }
1391
+ setTimeout(() => F(A)), x.preventDefault();
1392
+ }
1393
+ })
1394
+ }
1395
+ )
1396
+ }
1397
+ )
1398
+ }
1399
+ ) })
1400
+ }
1401
+ );
1402
+ }
1403
+ );
1404
+ sr.displayName = io;
1405
+ var po = "SelectItemAlignedPosition", lr = a.forwardRef((e, r) => {
1406
+ const { __scopeSelect: t, onPlaced: s, ...o } = e, l = se(pe, t), c = le(pe, t), [i, u] = a.useState(null), [d, p] = a.useState(null), m = U(r, (E) => p(E)), w = De(t), g = a.useRef(!1), y = a.useRef(!0), { viewport: h, selectedItem: v, selectedItemText: C, focusSelectedItem: b } = c, I = a.useCallback(() => {
1407
+ if (l.trigger && l.valueNode && i && d && h && v && C) {
1408
+ const E = l.trigger.getBoundingClientRect(), M = d.getBoundingClientRect(), Y = l.valueNode.getBoundingClientRect(), W = C.getBoundingClientRect();
1409
+ if (l.dir !== "rtl") {
1410
+ const $ = W.left - M.left, V = Y.left - $, ie = E.left - V, de = E.width + ie, Le = Math.max(de, M.width), Be = window.innerWidth - Q, $e = ct(V, [
1411
+ Q,
1412
+ // Prevents the content from going off the starting edge of the
1413
+ // viewport. It may still go off the ending edge, but this can be
1414
+ // controlled by the user since they may want to manage overflow in a
1415
+ // specific way.
1416
+ // https://github.com/radix-ui/primitives/issues/2049
1417
+ Math.max(Q, Be - Le)
1418
+ ]);
1419
+ i.style.minWidth = de + "px", i.style.left = $e + "px";
1420
+ } else {
1421
+ const $ = M.right - W.right, V = window.innerWidth - Y.right - $, ie = window.innerWidth - E.right - V, de = E.width + ie, Le = Math.max(de, M.width), Be = window.innerWidth - Q, $e = ct(V, [
1422
+ Q,
1423
+ Math.max(Q, Be - Le)
1424
+ ]);
1425
+ i.style.minWidth = de + "px", i.style.right = $e + "px";
1426
+ }
1427
+ const G = w(), z = window.innerHeight - Q * 2, X = h.scrollHeight, H = window.getComputedStyle(d), K = parseInt(H.borderTopWidth, 10), F = parseInt(H.paddingTop, 10), q = parseInt(H.borderBottomWidth, 10), Z = parseInt(H.paddingBottom, 10), J = K + F + X + Z + q, me = Math.min(v.offsetHeight * 5, J), ce = window.getComputedStyle(h), f = parseInt(ce.paddingTop, 10), R = parseInt(ce.paddingBottom, 10), k = E.top + E.height / 2 - Q, S = z - k, j = v.offsetHeight / 2, x = v.offsetTop + j, N = K + F + x, P = J - N;
1428
+ if (N <= k) {
1429
+ const $ = G.length > 0 && v === G[G.length - 1].ref.current;
1430
+ i.style.bottom = "0px";
1431
+ const V = d.clientHeight - h.offsetTop - h.offsetHeight, ie = Math.max(
1432
+ S,
1433
+ j + // viewport might have padding bottom, include it to avoid a scrollable viewport
1434
+ ($ ? R : 0) + V + q
1435
+ ), de = N + ie;
1436
+ i.style.height = de + "px";
1437
+ } else {
1438
+ const $ = G.length > 0 && v === G[0].ref.current;
1439
+ i.style.top = "0px";
1440
+ const ie = Math.max(
1441
+ k,
1442
+ K + h.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
1443
+ ($ ? f : 0) + j
1444
+ ) + P;
1445
+ i.style.height = ie + "px", h.scrollTop = N - k + h.offsetTop;
1446
+ }
1447
+ i.style.margin = `${Q}px 0`, i.style.minHeight = me + "px", i.style.maxHeight = z + "px", s?.(), requestAnimationFrame(() => g.current = !0);
1448
+ }
1449
+ }, [
1450
+ w,
1451
+ l.trigger,
1452
+ l.valueNode,
1453
+ i,
1454
+ d,
1455
+ h,
1456
+ v,
1457
+ C,
1458
+ l.dir,
1459
+ s
1460
+ ]);
1461
+ oe(() => I(), [I]);
1462
+ const [L, O] = a.useState();
1463
+ oe(() => {
1464
+ d && O(window.getComputedStyle(d).zIndex);
1465
+ }, [d]);
1466
+ const T = a.useCallback(
1467
+ (E) => {
1468
+ E && y.current === !0 && (I(), b?.(), y.current = !1);
1469
+ },
1470
+ [I, b]
1471
+ );
1472
+ return /* @__PURE__ */ n.jsx(
1473
+ mo,
1474
+ {
1475
+ scope: t,
1476
+ contentWrapper: i,
1477
+ shouldExpandOnScrollRef: g,
1478
+ onScrollButtonChange: T,
1479
+ children: /* @__PURE__ */ n.jsx(
1480
+ "div",
1481
+ {
1482
+ ref: u,
1483
+ style: {
1484
+ display: "flex",
1485
+ flexDirection: "column",
1486
+ position: "fixed",
1487
+ zIndex: L
1488
+ },
1489
+ children: /* @__PURE__ */ n.jsx(
1490
+ _.div,
1491
+ {
1492
+ ...o,
1493
+ ref: m,
1494
+ style: {
1495
+ // When we get the height of the content, it includes borders. If we were to set
1496
+ // the height without having `boxSizing: 'border-box'` it would be too big.
1497
+ boxSizing: "border-box",
1498
+ // We need to ensure the content doesn't get taller than the wrapper
1499
+ maxHeight: "100%",
1500
+ ...o.style
1501
+ }
1502
+ }
1503
+ )
1504
+ }
1505
+ )
1506
+ }
1507
+ );
1508
+ });
1509
+ lr.displayName = po;
1510
+ var fo = "SelectPopperPosition", We = a.forwardRef((e, r) => {
1511
+ const {
1512
+ __scopeSelect: t,
1513
+ align: s = "start",
1514
+ collisionPadding: o = Q,
1515
+ ...l
1516
+ } = e, c = Oe(t);
1517
+ return /* @__PURE__ */ n.jsx(
1518
+ Wr,
1519
+ {
1520
+ ...c,
1521
+ ...l,
1522
+ ref: r,
1523
+ align: s,
1524
+ collisionPadding: o,
1525
+ style: {
1526
+ // Ensure border-box for floating-ui calculations
1527
+ boxSizing: "border-box",
1528
+ ...l.style,
1529
+ "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
1530
+ "--radix-select-content-available-width": "var(--radix-popper-available-width)",
1531
+ "--radix-select-content-available-height": "var(--radix-popper-available-height)",
1532
+ "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
1533
+ "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
1534
+ }
1535
+ }
1536
+ );
1537
+ });
1538
+ We.displayName = fo;
1539
+ var [mo, at] = ge(pe, {}), qe = "SelectViewport", cr = a.forwardRef(
1540
+ (e, r) => {
1541
+ const { __scopeSelect: t, nonce: s, ...o } = e, l = le(qe, t), c = at(qe, t), i = U(r, l.onViewportChange), u = a.useRef(0);
1542
+ return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1543
+ /* @__PURE__ */ n.jsx(
1544
+ "style",
1545
+ {
1546
+ dangerouslySetInnerHTML: {
1547
+ __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
1548
+ },
1549
+ nonce: s
1550
+ }
1551
+ ),
1552
+ /* @__PURE__ */ n.jsx(Ae.Slot, { scope: t, children: /* @__PURE__ */ n.jsx(
1553
+ _.div,
1554
+ {
1555
+ "data-radix-select-viewport": "",
1556
+ role: "presentation",
1557
+ ...o,
1558
+ ref: i,
1559
+ style: {
1560
+ // we use position: 'relative' here on the `viewport` so that when we call
1561
+ // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
1562
+ // (independent of the scrollUpButton).
1563
+ position: "relative",
1564
+ flex: 1,
1565
+ // Viewport should only be scrollable in the vertical direction.
1566
+ // This won't work in vertical writing modes, so we'll need to
1567
+ // revisit this if/when that is supported
1568
+ // https://developer.chrome.com/blog/vertical-form-controls
1569
+ overflow: "hidden auto",
1570
+ ...o.style
1571
+ },
1572
+ onScroll: D(o.onScroll, (d) => {
1573
+ const p = d.currentTarget, { contentWrapper: m, shouldExpandOnScrollRef: w } = c;
1574
+ if (w?.current && m) {
1575
+ const g = Math.abs(u.current - p.scrollTop);
1576
+ if (g > 0) {
1577
+ const y = window.innerHeight - Q * 2, h = parseFloat(m.style.minHeight), v = parseFloat(m.style.height), C = Math.max(h, v);
1578
+ if (C < y) {
1579
+ const b = C + g, I = Math.min(y, b), L = b - I;
1580
+ m.style.height = I + "px", m.style.bottom === "0px" && (p.scrollTop = L > 0 ? L : 0, m.style.justifyContent = "flex-end");
1581
+ }
1582
+ }
1583
+ }
1584
+ u.current = p.scrollTop;
1585
+ })
1586
+ }
1587
+ ) })
1588
+ ] });
1589
+ }
1590
+ );
1591
+ cr.displayName = qe;
1592
+ var ir = "SelectGroup", [ho, vo] = ge(ir), xo = a.forwardRef(
1593
+ (e, r) => {
1594
+ const { __scopeSelect: t, ...s } = e, o = te();
1595
+ return /* @__PURE__ */ n.jsx(ho, { scope: t, id: o, children: /* @__PURE__ */ n.jsx(_.div, { role: "group", "aria-labelledby": o, ...s, ref: r }) });
1596
+ }
1597
+ );
1598
+ xo.displayName = ir;
1599
+ var dr = "SelectLabel", go = a.forwardRef(
1600
+ (e, r) => {
1601
+ const { __scopeSelect: t, ...s } = e, o = vo(dr, t);
1602
+ return /* @__PURE__ */ n.jsx(_.div, { id: o.id, ...s, ref: r });
1603
+ }
1604
+ );
1605
+ go.displayName = dr;
1606
+ var je = "SelectItem", [bo, ur] = ge(je), pr = a.forwardRef(
1607
+ (e, r) => {
1608
+ const {
1609
+ __scopeSelect: t,
1610
+ value: s,
1611
+ disabled: o = !1,
1612
+ textValue: l,
1613
+ ...c
1614
+ } = e, i = se(je, t), u = le(je, t), d = i.value === s, [p, m] = a.useState(l ?? ""), [w, g] = a.useState(!1), y = U(
1615
+ r,
1616
+ (b) => u.itemRefCallback?.(b, s, o)
1617
+ ), h = te(), v = a.useRef("touch"), C = () => {
1618
+ o || (i.onValueChange(s), i.onOpenChange(!1));
1619
+ };
1620
+ if (s === "")
1621
+ throw new Error(
1622
+ "A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
1623
+ );
1624
+ return /* @__PURE__ */ n.jsx(
1625
+ bo,
1626
+ {
1627
+ scope: t,
1628
+ value: s,
1629
+ disabled: o,
1630
+ textId: h,
1631
+ isSelected: d,
1632
+ onItemTextChange: a.useCallback((b) => {
1633
+ m((I) => I || (b?.textContent ?? "").trim());
1634
+ }, []),
1635
+ children: /* @__PURE__ */ n.jsx(
1636
+ Ae.ItemSlot,
1637
+ {
1638
+ scope: t,
1639
+ value: s,
1640
+ disabled: o,
1641
+ textValue: p,
1642
+ children: /* @__PURE__ */ n.jsx(
1643
+ _.div,
1644
+ {
1645
+ role: "option",
1646
+ "aria-labelledby": h,
1647
+ "data-highlighted": w ? "" : void 0,
1648
+ "aria-selected": d && w,
1649
+ "data-state": d ? "checked" : "unchecked",
1650
+ "aria-disabled": o || void 0,
1651
+ "data-disabled": o ? "" : void 0,
1652
+ tabIndex: o ? void 0 : -1,
1653
+ ...c,
1654
+ ref: y,
1655
+ onFocus: D(c.onFocus, () => g(!0)),
1656
+ onBlur: D(c.onBlur, () => g(!1)),
1657
+ onClick: D(c.onClick, () => {
1658
+ v.current !== "mouse" && C();
1659
+ }),
1660
+ onPointerUp: D(c.onPointerUp, () => {
1661
+ v.current === "mouse" && C();
1662
+ }),
1663
+ onPointerDown: D(c.onPointerDown, (b) => {
1664
+ v.current = b.pointerType;
1665
+ }),
1666
+ onPointerMove: D(c.onPointerMove, (b) => {
1667
+ v.current = b.pointerType, o ? u.onItemLeave?.() : v.current === "mouse" && b.currentTarget.focus({ preventScroll: !0 });
1668
+ }),
1669
+ onPointerLeave: D(c.onPointerLeave, (b) => {
1670
+ b.currentTarget === document.activeElement && u.onItemLeave?.();
1671
+ }),
1672
+ onKeyDown: D(c.onKeyDown, (b) => {
1673
+ u.searchRef?.current !== "" && b.key === " " || (ro.includes(b.key) && C(), b.key === " " && b.preventDefault());
1674
+ })
1675
+ }
1676
+ )
1677
+ }
1678
+ )
1679
+ }
1680
+ );
1681
+ }
1682
+ );
1683
+ pr.displayName = je;
1684
+ var ye = "SelectItemText", fr = a.forwardRef(
1685
+ (e, r) => {
1686
+ const { __scopeSelect: t, className: s, style: o, ...l } = e, c = se(ye, t), i = le(ye, t), u = ur(ye, t), d = so(ye, t), [p, m] = a.useState(null), w = U(
1687
+ r,
1688
+ (C) => m(C),
1689
+ u.onItemTextChange,
1690
+ (C) => i.itemTextRefCallback?.(C, u.value, u.disabled)
1691
+ ), g = p?.textContent, y = a.useMemo(
1692
+ () => /* @__PURE__ */ n.jsx("option", { value: u.value, disabled: u.disabled, children: g }, u.value),
1693
+ [u.disabled, u.value, g]
1694
+ ), { onNativeOptionAdd: h, onNativeOptionRemove: v } = d;
1695
+ return oe(() => (h(y), () => v(y)), [h, v, y]), /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
1696
+ /* @__PURE__ */ n.jsx(_.span, { id: u.textId, ...l, ref: w }),
1697
+ u.isSelected && c.valueNode && !c.valueNodeHasChildren ? St.createPortal(l.children, c.valueNode) : null
1698
+ ] });
1699
+ }
1700
+ );
1701
+ fr.displayName = ye;
1702
+ var mr = "SelectItemIndicator", hr = a.forwardRef(
1703
+ (e, r) => {
1704
+ const { __scopeSelect: t, ...s } = e;
1705
+ return ur(mr, t).isSelected ? /* @__PURE__ */ n.jsx(_.span, { "aria-hidden": !0, ...s, ref: r }) : null;
1706
+ }
1707
+ );
1708
+ hr.displayName = mr;
1709
+ var Ye = "SelectScrollUpButton", vr = a.forwardRef((e, r) => {
1710
+ const t = le(Ye, e.__scopeSelect), s = at(Ye, e.__scopeSelect), [o, l] = a.useState(!1), c = U(r, s.onScrollButtonChange);
1711
+ return oe(() => {
1712
+ if (t.viewport && t.isPositioned) {
1713
+ let i = function() {
1714
+ const d = u.scrollTop > 0;
1715
+ l(d);
1716
+ };
1717
+ const u = t.viewport;
1718
+ return i(), u.addEventListener("scroll", i), () => u.removeEventListener("scroll", i);
1719
+ }
1720
+ }, [t.viewport, t.isPositioned]), o ? /* @__PURE__ */ n.jsx(
1721
+ gr,
1722
+ {
1723
+ ...e,
1724
+ ref: c,
1725
+ onAutoScroll: () => {
1726
+ const { viewport: i, selectedItem: u } = t;
1727
+ i && u && (i.scrollTop = i.scrollTop - u.offsetHeight);
1728
+ }
1729
+ }
1730
+ ) : null;
1731
+ });
1732
+ vr.displayName = Ye;
1733
+ var Xe = "SelectScrollDownButton", xr = a.forwardRef((e, r) => {
1734
+ const t = le(Xe, e.__scopeSelect), s = at(Xe, e.__scopeSelect), [o, l] = a.useState(!1), c = U(r, s.onScrollButtonChange);
1735
+ return oe(() => {
1736
+ if (t.viewport && t.isPositioned) {
1737
+ let i = function() {
1738
+ const d = u.scrollHeight - u.clientHeight, p = Math.ceil(u.scrollTop) < d;
1739
+ l(p);
1740
+ };
1741
+ const u = t.viewport;
1742
+ return i(), u.addEventListener("scroll", i), () => u.removeEventListener("scroll", i);
1743
+ }
1744
+ }, [t.viewport, t.isPositioned]), o ? /* @__PURE__ */ n.jsx(
1745
+ gr,
1746
+ {
1747
+ ...e,
1748
+ ref: c,
1749
+ onAutoScroll: () => {
1750
+ const { viewport: i, selectedItem: u } = t;
1751
+ i && u && (i.scrollTop = i.scrollTop + u.offsetHeight);
1752
+ }
1753
+ }
1754
+ ) : null;
1755
+ });
1756
+ xr.displayName = Xe;
1757
+ var gr = a.forwardRef((e, r) => {
1758
+ const { __scopeSelect: t, onAutoScroll: s, ...o } = e, l = le("SelectScrollButton", t), c = a.useRef(null), i = De(t), u = a.useCallback(() => {
1759
+ c.current !== null && (window.clearInterval(c.current), c.current = null);
1760
+ }, []);
1761
+ return a.useEffect(() => () => u(), [u]), oe(() => {
1762
+ i().find((p) => p.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1763
+ }, [i]), /* @__PURE__ */ n.jsx(
1764
+ _.div,
1765
+ {
1766
+ "aria-hidden": !0,
1767
+ ...o,
1768
+ ref: r,
1769
+ style: { flexShrink: 0, ...o.style },
1770
+ onPointerDown: D(o.onPointerDown, () => {
1771
+ c.current === null && (c.current = window.setInterval(s, 50));
1772
+ }),
1773
+ onPointerMove: D(o.onPointerMove, () => {
1774
+ l.onItemLeave?.(), c.current === null && (c.current = window.setInterval(s, 50));
1775
+ }),
1776
+ onPointerLeave: D(o.onPointerLeave, () => {
1777
+ u();
1778
+ })
1779
+ }
1780
+ );
1781
+ }), wo = "SelectSeparator", yo = a.forwardRef(
1782
+ (e, r) => {
1783
+ const { __scopeSelect: t, ...s } = e;
1784
+ return /* @__PURE__ */ n.jsx(_.div, { "aria-hidden": !0, ...s, ref: r });
1785
+ }
1786
+ );
1787
+ yo.displayName = wo;
1788
+ var Ze = "SelectArrow", So = a.forwardRef(
1789
+ (e, r) => {
1790
+ const { __scopeSelect: t, ...s } = e, o = Oe(t), l = se(Ze, t), c = le(Ze, t);
1791
+ return l.open && c.position === "popper" ? /* @__PURE__ */ n.jsx(qr, { ...o, ...s, ref: r }) : null;
1792
+ }
1793
+ );
1794
+ So.displayName = Ze;
1795
+ var Co = "SelectBubbleInput", br = a.forwardRef(
1796
+ ({ __scopeSelect: e, value: r, ...t }, s) => {
1797
+ const o = a.useRef(null), l = U(s, o), c = rt(r);
1798
+ return a.useEffect(() => {
1799
+ const i = o.current;
1800
+ if (!i) return;
1801
+ const u = window.HTMLSelectElement.prototype, p = Object.getOwnPropertyDescriptor(
1802
+ u,
1803
+ "value"
1804
+ ).set;
1805
+ if (c !== r && p) {
1806
+ const m = new Event("change", { bubbles: !0 });
1807
+ p.call(i, r), i.dispatchEvent(m);
1808
+ }
1809
+ }, [c, r]), /* @__PURE__ */ n.jsx(
1810
+ _.select,
1811
+ {
1812
+ ...t,
1813
+ style: { ...Vr, ...t.style },
1814
+ ref: l,
1815
+ defaultValue: r
1816
+ }
1817
+ );
1818
+ }
1819
+ );
1820
+ br.displayName = Co;
1821
+ function wr(e) {
1822
+ return e === "" || e === void 0;
1823
+ }
1824
+ function yr(e) {
1825
+ const r = mt(e), t = a.useRef(""), s = a.useRef(0), o = a.useCallback(
1826
+ (c) => {
1827
+ const i = t.current + c;
1828
+ r(i), function u(d) {
1829
+ t.current = d, window.clearTimeout(s.current), d !== "" && (s.current = window.setTimeout(() => u(""), 1e3));
1830
+ }(i);
1831
+ },
1832
+ [r]
1833
+ ), l = a.useCallback(() => {
1834
+ t.current = "", window.clearTimeout(s.current);
1835
+ }, []);
1836
+ return a.useEffect(() => () => window.clearTimeout(s.current), []), [t, o, l];
1837
+ }
1838
+ function Sr(e, r, t) {
1839
+ const o = r.length > 1 && Array.from(r).every((d) => d === r[0]) ? r[0] : r, l = t ? e.indexOf(t) : -1;
1840
+ let c = Io(e, Math.max(l, 0));
1841
+ o.length === 1 && (c = c.filter((d) => d !== t));
1842
+ const u = c.find(
1843
+ (d) => d.textValue.toLowerCase().startsWith(o.toLowerCase())
1844
+ );
1845
+ return u !== t ? u : void 0;
1846
+ }
1847
+ function Io(e, r) {
1848
+ return e.map((t, s) => e[(r + s) % e.length]);
1849
+ }
1850
+ var Ro = Zt, ko = Qt, Eo = tr, jo = rr, No = nr, _o = or, To = cr, Po = pr, Mo = fr, Ao = hr, Do = vr, Oo = xr;
1851
+ function Fo({ ...e }) {
1852
+ return /* @__PURE__ */ n.jsx(Ro, { "data-slot": "select", ...e });
1853
+ }
1854
+ function Lo({ ...e }) {
1855
+ return /* @__PURE__ */ n.jsx(Eo, { "data-slot": "select-value", ...e });
1856
+ }
1857
+ function Bo({
1858
+ className: e,
1859
+ size: r = "default",
1860
+ children: t,
1861
+ ...s
1862
+ }) {
1863
+ return /* @__PURE__ */ n.jsxs(
1864
+ ko,
1865
+ {
1866
+ className: B(
1867
+ "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1868
+ e
1869
+ ),
1870
+ "data-size": r,
1871
+ "data-slot": "select-trigger",
1872
+ ...s,
1873
+ children: [
1874
+ t,
1875
+ /* @__PURE__ */ n.jsx(jo, { asChild: !0, children: /* @__PURE__ */ n.jsx(yt, { className: "size-4 opacity-50" }) })
1876
+ ]
1877
+ }
1878
+ );
1879
+ }
1880
+ function $o({
1881
+ className: e,
1882
+ children: r,
1883
+ position: t = "popper",
1884
+ align: s = "center",
1885
+ ...o
1886
+ }) {
1887
+ return /* @__PURE__ */ n.jsx(No, { children: /* @__PURE__ */ n.jsxs(
1888
+ _o,
1889
+ {
1890
+ align: s,
1891
+ className: B(
1892
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
1893
+ t === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
1894
+ e
1895
+ ),
1896
+ "data-slot": "select-content",
1897
+ position: t,
1898
+ ...o,
1899
+ children: [
1900
+ /* @__PURE__ */ n.jsx(Go, {}),
1901
+ /* @__PURE__ */ n.jsx(
1902
+ To,
1903
+ {
1904
+ className: B(
1905
+ "p-1",
1906
+ t === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
1907
+ ),
1908
+ children: r
1909
+ }
1910
+ ),
1911
+ /* @__PURE__ */ n.jsx(Ho, {})
1912
+ ]
1913
+ }
1914
+ ) });
1915
+ }
1916
+ function Vo({ className: e, children: r, ...t }) {
1917
+ return /* @__PURE__ */ n.jsxs(
1918
+ Po,
1919
+ {
1920
+ className: B(
1921
+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
1922
+ e
1923
+ ),
1924
+ "data-slot": "select-item",
1925
+ ...t,
1926
+ children: [
1927
+ /* @__PURE__ */ n.jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ n.jsx(Ao, { children: /* @__PURE__ */ n.jsx(tt, { className: "size-4" }) }) }),
1928
+ /* @__PURE__ */ n.jsx(Mo, { children: r })
1929
+ ]
1930
+ }
1931
+ );
1932
+ }
1933
+ function Go({ className: e, ...r }) {
1934
+ return /* @__PURE__ */ n.jsx(
1935
+ Do,
1936
+ {
1937
+ className: B("flex cursor-default items-center justify-center py-1", e),
1938
+ "data-slot": "select-scroll-up-button",
1939
+ ...r,
1940
+ children: /* @__PURE__ */ n.jsx(nn, { className: "size-4" })
1941
+ }
1942
+ );
1943
+ }
1944
+ function Ho({
1945
+ className: e,
1946
+ ...r
1947
+ }) {
1948
+ return /* @__PURE__ */ n.jsx(
1949
+ Oo,
1950
+ {
1951
+ className: B("flex cursor-default items-center justify-center py-1", e),
1952
+ "data-slot": "select-scroll-down-button",
1953
+ ...r,
1954
+ children: /* @__PURE__ */ n.jsx(yt, { className: "size-4" })
1955
+ }
1956
+ );
1957
+ }
1958
+ const Va = ({
1959
+ name: e,
1960
+ defaultValue: r,
1961
+ options: t,
1962
+ label: s,
1963
+ placeholder: o,
1964
+ note: l,
1965
+ className: c,
1966
+ value: i,
1967
+ onValueChange: u,
1968
+ error: d,
1969
+ size: p = "md",
1970
+ ...m
1971
+ }) => {
1972
+ const w = B(
1973
+ "min-w-[180px]",
1974
+ p === "xs" && "h-7 text-xs md:text-xs",
1975
+ p === "sm" && "h-8 text-sm md:text-xs",
1976
+ p === "md" && "h-9 text-base md:text-sm",
1977
+ p === "lg" && "h-10 text-lg md:text-base",
1978
+ p === "xl" && "h-11 text-xl md:text-lg",
1979
+ c
1980
+ ), g = p === "xs" || p === "sm" ? "sm" : "default";
1981
+ return /* @__PURE__ */ n.jsxs(ne, { className: "w-full", direction: "col", gap: "2", children: [
1982
+ s && /* @__PURE__ */ n.jsx(xe, { htmlFor: e, children: s }),
1983
+ /* @__PURE__ */ n.jsxs(
1984
+ Fo,
1985
+ {
1986
+ defaultValue: r,
1987
+ name: e,
1988
+ onValueChange: u,
1989
+ value: i,
1990
+ ...m,
1991
+ children: [
1992
+ /* @__PURE__ */ n.jsx(Bo, { className: w, "data-testid": `select-input-${e}`, size: g, children: /* @__PURE__ */ n.jsx(Lo, { placeholder: o }) }),
1993
+ /* @__PURE__ */ n.jsx($o, { children: t.map(({ value: y, label: h }) => /* @__PURE__ */ n.jsx(Vo, { value: y, children: h }, `option-${y}`)) })
1994
+ ]
1995
+ }
1996
+ ),
1997
+ l && /* @__PURE__ */ n.jsx(Te, { size: "sm", variant: "muted", children: l }),
1998
+ d && /* @__PURE__ */ n.jsx(ke, { message: d })
1999
+ ] });
2000
+ };
2001
+ var it = 1, Ko = 0.9, Uo = 0.8, zo = 0.17, He = 0.1, Ke = 0.999, Wo = 0.9999, qo = 0.99, Yo = /[\\\/_+.#"@\[\(\{&]/, Xo = /[\\\/_+.#"@\[\(\{&]/g, Zo = /[\s-]/, Cr = /[\s-]/g;
2002
+ function Je(e, r, t, s, o, l, c) {
2003
+ if (l === r.length) return o === e.length ? it : qo;
2004
+ var i = `${o},${l}`;
2005
+ if (c[i] !== void 0) return c[i];
2006
+ for (var u = s.charAt(l), d = t.indexOf(u, o), p = 0, m, w, g, y; d >= 0; ) m = Je(e, r, t, s, d + 1, l + 1, c), m > p && (d === o ? m *= it : Yo.test(e.charAt(d - 1)) ? (m *= Uo, g = e.slice(o, d - 1).match(Xo), g && o > 0 && (m *= Math.pow(Ke, g.length))) : Zo.test(e.charAt(d - 1)) ? (m *= Ko, y = e.slice(o, d - 1).match(Cr), y && o > 0 && (m *= Math.pow(Ke, y.length))) : (m *= zo, o > 0 && (m *= Math.pow(Ke, d - o))), e.charAt(d) !== r.charAt(l) && (m *= Wo)), (m < He && t.charAt(d - 1) === s.charAt(l + 1) || s.charAt(l + 1) === s.charAt(l) && t.charAt(d - 1) !== s.charAt(l)) && (w = Je(e, r, t, s, d + 1, l + 2, c), w * He > m && (m = w * He)), m > p && (p = m), d = t.indexOf(u, d + 1);
2007
+ return c[i] = p, p;
2008
+ }
2009
+ function dt(e) {
2010
+ return e.toLowerCase().replace(Cr, " ");
2011
+ }
2012
+ function Jo(e, r, t) {
2013
+ return e = t && t.length > 0 ? `${e + " " + t.join(" ")}` : e, Je(e, r, dt(e), dt(r), 0, 0, {});
2014
+ }
2015
+ var we = '[cmdk-group=""]', Ue = '[cmdk-group-items=""]', Qo = '[cmdk-group-heading=""]', Ir = '[cmdk-item=""]', ut = `${Ir}:not([aria-disabled="true"])`, Qe = "cmdk-item-select", he = "data-value", ea = (e, r, t) => Jo(e, r, t), Rr = a.createContext(void 0), Ee = () => a.useContext(Rr), kr = a.createContext(void 0), st = () => a.useContext(kr), Er = a.createContext(void 0), jr = a.forwardRef((e, r) => {
2016
+ let t = ve(() => {
2017
+ var f, R;
2018
+ return { search: "", value: (R = (f = e.value) != null ? f : e.defaultValue) != null ? R : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
2019
+ }), s = ve(() => /* @__PURE__ */ new Set()), o = ve(() => /* @__PURE__ */ new Map()), l = ve(() => /* @__PURE__ */ new Map()), c = ve(() => /* @__PURE__ */ new Set()), i = Nr(e), { label: u, children: d, value: p, onValueChange: m, filter: w, shouldFilter: g, loop: y, disablePointerSelection: h = !1, vimBindings: v = !0, ...C } = e, b = te(), I = te(), L = te(), O = a.useRef(null), T = ua();
2020
+ fe(() => {
2021
+ if (p !== void 0) {
2022
+ let f = p.trim();
2023
+ t.current.value = f, E.emit();
2024
+ }
2025
+ }, [p]), fe(() => {
2026
+ T(6, X);
2027
+ }, []);
2028
+ let E = a.useMemo(() => ({ subscribe: (f) => (c.current.add(f), () => c.current.delete(f)), snapshot: () => t.current, setState: (f, R, k) => {
2029
+ var S, j, x, N;
2030
+ if (!Object.is(t.current[f], R)) {
2031
+ if (t.current[f] = R, f === "search") z(), W(), T(1, G);
2032
+ else if (f === "value") {
2033
+ if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
2034
+ let P = document.getElementById(L);
2035
+ P ? P.focus() : (S = document.getElementById(b)) == null || S.focus();
2036
+ }
2037
+ if (T(7, () => {
2038
+ var P;
2039
+ t.current.selectedItemId = (P = H()) == null ? void 0 : P.id, E.emit();
2040
+ }), k || T(5, X), ((j = i.current) == null ? void 0 : j.value) !== void 0) {
2041
+ let P = R ?? "";
2042
+ (N = (x = i.current).onValueChange) == null || N.call(x, P);
2043
+ return;
2044
+ }
2045
+ }
2046
+ E.emit();
2047
+ }
2048
+ }, emit: () => {
2049
+ c.current.forEach((f) => f());
2050
+ } }), []), M = a.useMemo(() => ({ value: (f, R, k) => {
2051
+ var S;
2052
+ R !== ((S = l.current.get(f)) == null ? void 0 : S.value) && (l.current.set(f, { value: R, keywords: k }), t.current.filtered.items.set(f, Y(R, k)), T(2, () => {
2053
+ W(), E.emit();
2054
+ }));
2055
+ }, item: (f, R) => (s.current.add(f), R && (o.current.has(R) ? o.current.get(R).add(f) : o.current.set(R, /* @__PURE__ */ new Set([f]))), T(3, () => {
2056
+ z(), W(), t.current.value || G(), E.emit();
2057
+ }), () => {
2058
+ l.current.delete(f), s.current.delete(f), t.current.filtered.items.delete(f);
2059
+ let k = H();
2060
+ T(4, () => {
2061
+ z(), k?.getAttribute("id") === f && G(), E.emit();
2062
+ });
2063
+ }), group: (f) => (o.current.has(f) || o.current.set(f, /* @__PURE__ */ new Set()), () => {
2064
+ l.current.delete(f), o.current.delete(f);
2065
+ }), filter: () => i.current.shouldFilter, label: u || e["aria-label"], getDisablePointerSelection: () => i.current.disablePointerSelection, listId: b, inputId: L, labelId: I, listInnerRef: O }), []);
2066
+ function Y(f, R) {
2067
+ var k, S;
2068
+ let j = (S = (k = i.current) == null ? void 0 : k.filter) != null ? S : ea;
2069
+ return f ? j(f, t.current.search, R) : 0;
2070
+ }
2071
+ function W() {
2072
+ if (!t.current.search || i.current.shouldFilter === !1) return;
2073
+ let f = t.current.filtered.items, R = [];
2074
+ t.current.filtered.groups.forEach((S) => {
2075
+ let j = o.current.get(S), x = 0;
2076
+ j.forEach((N) => {
2077
+ let P = f.get(N);
2078
+ x = Math.max(P, x);
2079
+ }), R.push([S, x]);
2080
+ });
2081
+ let k = O.current;
2082
+ K().sort((S, j) => {
2083
+ var x, N;
2084
+ let P = S.getAttribute("id"), A = j.getAttribute("id");
2085
+ return ((x = f.get(A)) != null ? x : 0) - ((N = f.get(P)) != null ? N : 0);
2086
+ }).forEach((S) => {
2087
+ let j = S.closest(Ue);
2088
+ j ? j.appendChild(S.parentElement === j ? S : S.closest(`${Ue} > *`)) : k.appendChild(S.parentElement === k ? S : S.closest(`${Ue} > *`));
2089
+ }), R.sort((S, j) => j[1] - S[1]).forEach((S) => {
2090
+ var j;
2091
+ let x = (j = O.current) == null ? void 0 : j.querySelector(`${we}[${he}="${encodeURIComponent(S[0])}"]`);
2092
+ x?.parentElement.appendChild(x);
2093
+ });
2094
+ }
2095
+ function G() {
2096
+ let f = K().find((k) => k.getAttribute("aria-disabled") !== "true"), R = f?.getAttribute(he);
2097
+ E.setState("value", R || void 0);
2098
+ }
2099
+ function z() {
2100
+ var f, R, k, S;
2101
+ if (!t.current.search || i.current.shouldFilter === !1) {
2102
+ t.current.filtered.count = s.current.size;
2103
+ return;
2104
+ }
2105
+ t.current.filtered.groups = /* @__PURE__ */ new Set();
2106
+ let j = 0;
2107
+ for (let x of s.current) {
2108
+ let N = (R = (f = l.current.get(x)) == null ? void 0 : f.value) != null ? R : "", P = (S = (k = l.current.get(x)) == null ? void 0 : k.keywords) != null ? S : [], A = Y(N, P);
2109
+ t.current.filtered.items.set(x, A), A > 0 && j++;
2110
+ }
2111
+ for (let [x, N] of o.current) for (let P of N) if (t.current.filtered.items.get(P) > 0) {
2112
+ t.current.filtered.groups.add(x);
2113
+ break;
2114
+ }
2115
+ t.current.filtered.count = j;
2116
+ }
2117
+ function X() {
2118
+ var f, R, k;
2119
+ let S = H();
2120
+ S && (((f = S.parentElement) == null ? void 0 : f.firstChild) === S && ((k = (R = S.closest(we)) == null ? void 0 : R.querySelector(Qo)) == null || k.scrollIntoView({ block: "nearest" })), S.scrollIntoView({ block: "nearest" }));
2121
+ }
2122
+ function H() {
2123
+ var f;
2124
+ return (f = O.current) == null ? void 0 : f.querySelector(`${Ir}[aria-selected="true"]`);
2125
+ }
2126
+ function K() {
2127
+ var f;
2128
+ return Array.from(((f = O.current) == null ? void 0 : f.querySelectorAll(ut)) || []);
2129
+ }
2130
+ function F(f) {
2131
+ let R = K()[f];
2132
+ R && E.setState("value", R.getAttribute(he));
2133
+ }
2134
+ function q(f) {
2135
+ var R;
2136
+ let k = H(), S = K(), j = S.findIndex((N) => N === k), x = S[j + f];
2137
+ (R = i.current) != null && R.loop && (x = j + f < 0 ? S[S.length - 1] : j + f === S.length ? S[0] : S[j + f]), x && E.setState("value", x.getAttribute(he));
2138
+ }
2139
+ function Z(f) {
2140
+ let R = H(), k = R?.closest(we), S;
2141
+ for (; k && !S; ) k = f > 0 ? ia(k, we) : da(k, we), S = k?.querySelector(ut);
2142
+ S ? E.setState("value", S.getAttribute(he)) : q(f);
2143
+ }
2144
+ let J = () => F(K().length - 1), me = (f) => {
2145
+ f.preventDefault(), f.metaKey ? J() : f.altKey ? Z(1) : q(1);
2146
+ }, ce = (f) => {
2147
+ f.preventDefault(), f.metaKey ? F(0) : f.altKey ? Z(-1) : q(-1);
2148
+ };
2149
+ return a.createElement(_.div, { ref: r, tabIndex: -1, ...C, "cmdk-root": "", onKeyDown: (f) => {
2150
+ var R;
2151
+ (R = C.onKeyDown) == null || R.call(C, f);
2152
+ let k = f.nativeEvent.isComposing || f.keyCode === 229;
2153
+ if (!(f.defaultPrevented || k)) switch (f.key) {
2154
+ case "n":
2155
+ case "j": {
2156
+ v && f.ctrlKey && me(f);
2157
+ break;
2158
+ }
2159
+ case "ArrowDown": {
2160
+ me(f);
2161
+ break;
2162
+ }
2163
+ case "p":
2164
+ case "k": {
2165
+ v && f.ctrlKey && ce(f);
2166
+ break;
2167
+ }
2168
+ case "ArrowUp": {
2169
+ ce(f);
2170
+ break;
2171
+ }
2172
+ case "Home": {
2173
+ f.preventDefault(), F(0);
2174
+ break;
2175
+ }
2176
+ case "End": {
2177
+ f.preventDefault(), J();
2178
+ break;
2179
+ }
2180
+ case "Enter": {
2181
+ f.preventDefault();
2182
+ let S = H();
2183
+ if (S) {
2184
+ let j = new Event(Qe);
2185
+ S.dispatchEvent(j);
2186
+ }
2187
+ }
2188
+ }
2189
+ } }, a.createElement("label", { "cmdk-label": "", htmlFor: M.inputId, id: M.labelId, style: fa }, u), Fe(e, (f) => a.createElement(kr.Provider, { value: E }, a.createElement(Rr.Provider, { value: M }, f))));
2190
+ }), ta = a.forwardRef((e, r) => {
2191
+ var t, s;
2192
+ let o = te(), l = a.useRef(null), c = a.useContext(Er), i = Ee(), u = Nr(e), d = (s = (t = u.current) == null ? void 0 : t.forceMount) != null ? s : c?.forceMount;
2193
+ fe(() => {
2194
+ if (!d) return i.item(o, c?.id);
2195
+ }, [d]);
2196
+ let p = _r(o, l, [e.value, e.children, l], e.keywords), m = st(), w = ae((T) => T.value && T.value === p.current), g = ae((T) => d || i.filter() === !1 ? !0 : T.search ? T.filtered.items.get(o) > 0 : !0);
2197
+ a.useEffect(() => {
2198
+ let T = l.current;
2199
+ if (!(!T || e.disabled)) return T.addEventListener(Qe, y), () => T.removeEventListener(Qe, y);
2200
+ }, [g, e.onSelect, e.disabled]);
2201
+ function y() {
2202
+ var T, E;
2203
+ h(), (E = (T = u.current).onSelect) == null || E.call(T, p.current);
2204
+ }
2205
+ function h() {
2206
+ m.setState("value", p.current, !0);
2207
+ }
2208
+ if (!g) return null;
2209
+ let { disabled: v, value: C, onSelect: b, forceMount: I, keywords: L, ...O } = e;
2210
+ return a.createElement(_.div, { ref: Se(l, r), ...O, id: o, "cmdk-item": "", role: "option", "aria-disabled": !!v, "aria-selected": !!w, "data-disabled": !!v, "data-selected": !!w, onPointerMove: v || i.getDisablePointerSelection() ? void 0 : h, onClick: v ? void 0 : y }, e.children);
2211
+ }), ra = a.forwardRef((e, r) => {
2212
+ let { heading: t, children: s, forceMount: o, ...l } = e, c = te(), i = a.useRef(null), u = a.useRef(null), d = te(), p = Ee(), m = ae((g) => o || p.filter() === !1 ? !0 : g.search ? g.filtered.groups.has(c) : !0);
2213
+ fe(() => p.group(c), []), _r(c, i, [e.value, e.heading, u]);
2214
+ let w = a.useMemo(() => ({ id: c, forceMount: o }), [o]);
2215
+ return a.createElement(_.div, { ref: Se(i, r), ...l, "cmdk-group": "", role: "presentation", hidden: m ? void 0 : !0 }, t && a.createElement("div", { ref: u, "cmdk-group-heading": "", "aria-hidden": !0, id: d }, t), Fe(e, (g) => a.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": t ? d : void 0 }, a.createElement(Er.Provider, { value: w }, g))));
2216
+ }), na = a.forwardRef((e, r) => {
2217
+ let { alwaysRender: t, ...s } = e, o = a.useRef(null), l = ae((c) => !c.search);
2218
+ return !t && !l ? null : a.createElement(_.div, { ref: Se(o, r), ...s, "cmdk-separator": "", role: "separator" });
2219
+ }), oa = a.forwardRef((e, r) => {
2220
+ let { onValueChange: t, ...s } = e, o = e.value != null, l = st(), c = ae((d) => d.search), i = ae((d) => d.selectedItemId), u = Ee();
2221
+ return a.useEffect(() => {
2222
+ e.value != null && l.setState("search", e.value);
2223
+ }, [e.value]), a.createElement(_.input, { ref: r, ...s, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": u.listId, "aria-labelledby": u.labelId, "aria-activedescendant": i, id: u.inputId, type: "text", value: o ? e.value : c, onChange: (d) => {
2224
+ o || l.setState("search", d.target.value), t?.(d.target.value);
2225
+ } });
2226
+ }), aa = a.forwardRef((e, r) => {
2227
+ let { children: t, label: s = "Suggestions", ...o } = e, l = a.useRef(null), c = a.useRef(null), i = ae((d) => d.selectedItemId), u = Ee();
2228
+ return a.useEffect(() => {
2229
+ if (c.current && l.current) {
2230
+ let d = c.current, p = l.current, m, w = new ResizeObserver(() => {
2231
+ m = requestAnimationFrame(() => {
2232
+ let g = d.offsetHeight;
2233
+ p.style.setProperty("--cmdk-list-height", g.toFixed(1) + "px");
2234
+ });
2235
+ });
2236
+ return w.observe(d), () => {
2237
+ cancelAnimationFrame(m), w.unobserve(d);
2238
+ };
2239
+ }
2240
+ }, []), a.createElement(_.div, { ref: Se(l, r), ...o, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": i, "aria-label": s, id: u.listId }, Fe(e, (d) => a.createElement("div", { ref: Se(c, u.listInnerRef), "cmdk-list-sizer": "" }, d)));
2241
+ }), sa = a.forwardRef((e, r) => {
2242
+ let { open: t, onOpenChange: s, overlayClassName: o, contentClassName: l, container: c, ...i } = e;
2243
+ return a.createElement(Yr, { open: t, onOpenChange: s }, a.createElement(Xr, { container: c }, a.createElement(Zr, { "cmdk-overlay": "", className: o }), a.createElement(Jr, { "aria-label": e.label, "cmdk-dialog": "", className: l }, a.createElement(jr, { ref: r, ...i }))));
2244
+ }), la = a.forwardRef((e, r) => ae((t) => t.filtered.count === 0) ? a.createElement(_.div, { ref: r, ...e, "cmdk-empty": "", role: "presentation" }) : null), ca = a.forwardRef((e, r) => {
2245
+ let { progress: t, children: s, label: o = "Loading...", ...l } = e;
2246
+ return a.createElement(_.div, { ref: r, ...l, "cmdk-loading": "", role: "progressbar", "aria-valuenow": t, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": o }, Fe(e, (c) => a.createElement("div", { "aria-hidden": !0 }, c)));
2247
+ }), be = Object.assign(jr, { List: aa, Item: ta, Input: oa, Group: ra, Separator: na, Dialog: sa, Empty: la, Loading: ca });
2248
+ function ia(e, r) {
2249
+ let t = e.nextElementSibling;
2250
+ for (; t; ) {
2251
+ if (t.matches(r)) return t;
2252
+ t = t.nextElementSibling;
2253
+ }
2254
+ }
2255
+ function da(e, r) {
2256
+ let t = e.previousElementSibling;
2257
+ for (; t; ) {
2258
+ if (t.matches(r)) return t;
2259
+ t = t.previousElementSibling;
2260
+ }
2261
+ }
2262
+ function Nr(e) {
2263
+ let r = a.useRef(e);
2264
+ return fe(() => {
2265
+ r.current = e;
2266
+ }), r;
2267
+ }
2268
+ var fe = typeof window > "u" ? a.useEffect : a.useLayoutEffect;
2269
+ function ve(e) {
2270
+ let r = a.useRef();
2271
+ return r.current === void 0 && (r.current = e()), r;
2272
+ }
2273
+ function ae(e) {
2274
+ let r = st(), t = () => e(r.snapshot());
2275
+ return a.useSyncExternalStore(r.subscribe, t, t);
2276
+ }
2277
+ function _r(e, r, t, s = []) {
2278
+ let o = a.useRef(), l = Ee();
2279
+ return fe(() => {
2280
+ var c;
2281
+ let i = (() => {
2282
+ var d;
2283
+ for (let p of t) {
2284
+ if (typeof p == "string") return p.trim();
2285
+ if (typeof p == "object" && "current" in p) return p.current ? (d = p.current.textContent) == null ? void 0 : d.trim() : o.current;
2286
+ }
2287
+ })(), u = s.map((d) => d.trim());
2288
+ l.value(e, i, u), (c = r.current) == null || c.setAttribute(he, i), o.current = i;
2289
+ }), o;
2290
+ }
2291
+ var ua = () => {
2292
+ let [e, r] = a.useState(), t = ve(() => /* @__PURE__ */ new Map());
2293
+ return fe(() => {
2294
+ t.current.forEach((s) => s()), t.current = /* @__PURE__ */ new Map();
2295
+ }, [e]), (s, o) => {
2296
+ t.current.set(s, o), r({});
2297
+ };
2298
+ };
2299
+ function pa(e) {
2300
+ let r = e.type;
2301
+ return typeof r == "function" ? r(e.props) : "render" in r ? r.render(e.props) : e;
2302
+ }
2303
+ function Fe({ asChild: e, children: r }, t) {
2304
+ return e && a.isValidElement(r) ? a.cloneElement(pa(r), { ref: r.ref }, t(r.props.children)) : t(r);
2305
+ }
2306
+ var fa = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
2307
+ function ma({ className: e, ...r }) {
2308
+ return /* @__PURE__ */ n.jsx(
2309
+ be,
2310
+ {
2311
+ className: B(
2312
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
2313
+ e
2314
+ ),
2315
+ "data-slot": "command",
2316
+ ...r
2317
+ }
2318
+ );
2319
+ }
2320
+ function ha({ className: e, ...r }) {
2321
+ return /* @__PURE__ */ n.jsxs("div", { className: "flex h-9 items-center gap-2 border-b px-3", "data-slot": "command-input-wrapper", children: [
2322
+ /* @__PURE__ */ n.jsx(vn, { className: "size-4 shrink-0 opacity-50" }),
2323
+ /* @__PURE__ */ n.jsx(
2324
+ be.Input,
2325
+ {
2326
+ className: B(
2327
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
2328
+ e
2329
+ ),
2330
+ "data-slot": "command-input",
2331
+ ...r
2332
+ }
2333
+ )
2334
+ ] });
2335
+ }
2336
+ function va({ className: e, ...r }) {
2337
+ return /* @__PURE__ */ n.jsx(
2338
+ be.List,
2339
+ {
2340
+ className: B("max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden", e),
2341
+ "data-slot": "command-list",
2342
+ ...r
2343
+ }
2344
+ );
2345
+ }
2346
+ function xa({ ...e }) {
2347
+ return /* @__PURE__ */ n.jsx(be.Empty, { className: "py-6 text-center text-sm", "data-slot": "command-empty", ...e });
2348
+ }
2349
+ function ga({ className: e, ...r }) {
2350
+ return /* @__PURE__ */ n.jsx(
2351
+ be.Group,
2352
+ {
2353
+ className: B(
2354
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs",
2355
+ e
2356
+ ),
2357
+ "data-slot": "command-group",
2358
+ ...r
2359
+ }
2360
+ );
2361
+ }
2362
+ function ba({ className: e, ...r }) {
2363
+ return /* @__PURE__ */ n.jsx(
2364
+ be.Item,
2365
+ {
2366
+ className: B(
2367
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
2368
+ e
2369
+ ),
2370
+ "data-slot": "command-item",
2371
+ ...r
2372
+ }
2373
+ );
2374
+ }
2375
+ const wa = ({
2376
+ placeholder: e,
2377
+ selected: r,
2378
+ className: t,
2379
+ open: s,
2380
+ renderSelected: o = (l) => l.label
2381
+ }) => /* @__PURE__ */ n.jsx(gt, { asChild: !0, children: /* @__PURE__ */ n.jsxs(Mr, { "aria-expanded": s, className: `justify-between ${t}`, role: "combobox", variant: "outline", children: [
2382
+ o(r || { label: e, value: "" }),
2383
+ /* @__PURE__ */ n.jsx(an, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
2384
+ ] }) }), Ga = ({
2385
+ options: e,
2386
+ value: r = "",
2387
+ placeholder: t = "Select a value...",
2388
+ className: s = "",
2389
+ onSelect: o = () => {
2390
+ },
2391
+ renderSelected: l = (c) => c.label
2392
+ }) => {
2393
+ const [c, i] = _e(!1), u = Dr(() => e.find((d) => d.value === r), [e, r]);
2394
+ return /* @__PURE__ */ n.jsxs(xt, { onOpenChange: i, open: c, children: [
2395
+ /* @__PURE__ */ n.jsx(
2396
+ wa,
2397
+ {
2398
+ className: `w-full ${s}`,
2399
+ open: c,
2400
+ placeholder: t,
2401
+ renderSelected: l,
2402
+ selected: u
2403
+ }
2404
+ ),
2405
+ /* @__PURE__ */ n.jsx(bt, { className: "w-full p-0", children: /* @__PURE__ */ n.jsxs(ma, { value: r, children: [
2406
+ /* @__PURE__ */ n.jsx(ha, { "aria-label": "Search options", className: "h-9", placeholder: "Search" }),
2407
+ /* @__PURE__ */ n.jsxs(va, { children: [
2408
+ /* @__PURE__ */ n.jsx(xa, { children: "No results found" }),
2409
+ /* @__PURE__ */ n.jsx(ga, { children: e.map((d) => /* @__PURE__ */ n.jsxs(
2410
+ ba,
2411
+ {
2412
+ onSelect: () => {
2413
+ i(!1), o(d.value);
2414
+ },
2415
+ value: d.value,
2416
+ children: [
2417
+ d.icon ? /* @__PURE__ */ n.jsx("span", { className: "mr-2", children: d.icon }) : "",
2418
+ d.label,
2419
+ /* @__PURE__ */ n.jsx(tt, { className: B("ml-auto", d.value === r ? "opacity-100" : "opacity-0") })
2420
+ ]
2421
+ },
2422
+ d.value
2423
+ )) })
2424
+ ] })
2425
+ ] }) })
2426
+ ] });
2427
+ };
2428
+ function ya({ className: e, ...r }) {
2429
+ return /* @__PURE__ */ n.jsx(
2430
+ "textarea",
2431
+ {
2432
+ className: B(
2433
+ "field-sizing-content flex min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:ring-destructive/40",
2434
+ e
2435
+ ),
2436
+ "data-slot": "textarea",
2437
+ ...r
2438
+ }
2439
+ );
2440
+ }
2441
+ function Ha({ label: e, name: r, note: t, placeholder: s, className: o, error: l, ...c }) {
2442
+ return /* @__PURE__ */ n.jsxs(ne, { className: "w-full", direction: "col", gap: "2", children: [
2443
+ e && /* @__PURE__ */ n.jsx(xe, { htmlFor: r, children: e }),
2444
+ /* @__PURE__ */ n.jsx(
2445
+ ya,
2446
+ {
2447
+ "aria-label": e || r,
2448
+ className: o,
2449
+ id: r,
2450
+ name: r,
2451
+ placeholder: s,
2452
+ ...c
2453
+ }
2454
+ ),
2455
+ t && /* @__PURE__ */ n.jsx(Te, { size: "sm", variant: "muted", children: t }),
2456
+ l && /* @__PURE__ */ n.jsx(ke, { message: l })
2457
+ ] });
2458
+ }
2459
+ export {
2460
+ Ma as C,
2461
+ _a as D,
2462
+ ke as I,
2463
+ xe as L,
2464
+ Fa as N,
2465
+ Ba as R,
2466
+ Ta as S,
2467
+ Ha as T,
2468
+ Aa as a,
2469
+ Da as b,
2470
+ Oa as c,
2471
+ Fn as d,
2472
+ Va as e,
2473
+ Ga as f,
2474
+ Lt as g,
2475
+ It as h,
2476
+ _n as i,
2477
+ Tn as j
2478
+ };