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