@rinzai/zen 0.1.10 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/index.d.ts +2 -17
  2. package/dist/packages/badge/index.d.ts.map +1 -0
  3. package/dist/packages/button/index.d.ts.map +1 -0
  4. package/dist/packages/collapse/index.d.ts.map +1 -0
  5. package/dist/packages/dropdown/index.d.ts.map +1 -0
  6. package/dist/packages/icons/chevron-down.d.ts.map +1 -0
  7. package/dist/packages/icons/chevron-up.d.ts.map +1 -0
  8. package/dist/packages/icons/icon.types.d.ts.map +1 -0
  9. package/dist/packages/icons/index.d.ts.map +1 -0
  10. package/dist/packages/icons/search.d.ts.map +1 -0
  11. package/dist/packages/icons/x-mark.d.ts.map +1 -0
  12. package/dist/packages/index.d.ts +17 -0
  13. package/dist/packages/index.d.ts.map +1 -0
  14. package/dist/packages/input/index.d.ts.map +1 -0
  15. package/dist/{popover → packages/popover}/index.d.ts +2 -0
  16. package/dist/packages/popover/index.d.ts.map +1 -0
  17. package/dist/packages/textarea/index.d.ts.map +1 -0
  18. package/dist/packages/toggle/index.d.ts.map +1 -0
  19. package/dist/packages/utils/cva.d.ts.map +1 -0
  20. package/dist/packages/utils/cx.d.ts.map +1 -0
  21. package/dist/packages/utils/useClickOutside.d.ts.map +1 -0
  22. package/dist/zen.css +3 -1
  23. package/dist/zen.js +893 -2143
  24. package/package.json +81 -75
  25. package/dist/badge/index.d.ts.map +0 -1
  26. package/dist/button/index.d.ts.map +0 -1
  27. package/dist/collapse/index.d.ts.map +0 -1
  28. package/dist/dropdown/index.d.ts.map +0 -1
  29. package/dist/icons/chevron-down.d.ts.map +0 -1
  30. package/dist/icons/chevron-up.d.ts.map +0 -1
  31. package/dist/icons/icon.types.d.ts.map +0 -1
  32. package/dist/icons/index.d.ts.map +0 -1
  33. package/dist/icons/search.d.ts.map +0 -1
  34. package/dist/icons/x-mark.d.ts.map +0 -1
  35. package/dist/index.d.ts.map +0 -1
  36. package/dist/input/index.d.ts.map +0 -1
  37. package/dist/popover/index.d.ts.map +0 -1
  38. package/dist/textarea/index.d.ts.map +0 -1
  39. package/dist/toggle/index.d.ts.map +0 -1
  40. package/dist/utils/cva.d.ts.map +0 -1
  41. package/dist/utils/cx.d.ts.map +0 -1
  42. package/dist/utils/useClickOutside.d.ts.map +0 -1
  43. /package/dist/{badge → packages/badge}/index.d.ts +0 -0
  44. /package/dist/{button → packages/button}/index.d.ts +0 -0
  45. /package/dist/{collapse → packages/collapse}/index.d.ts +0 -0
  46. /package/dist/{dropdown → packages/dropdown}/index.d.ts +0 -0
  47. /package/dist/{icons → packages/icons}/chevron-down.d.ts +0 -0
  48. /package/dist/{icons → packages/icons}/chevron-up.d.ts +0 -0
  49. /package/dist/{icons → packages/icons}/icon.types.d.ts +0 -0
  50. /package/dist/{icons → packages/icons}/index.d.ts +0 -0
  51. /package/dist/{icons → packages/icons}/search.d.ts +0 -0
  52. /package/dist/{icons → packages/icons}/x-mark.d.ts +0 -0
  53. /package/dist/{input → packages/input}/index.d.ts +0 -0
  54. /package/dist/{textarea → packages/textarea}/index.d.ts +0 -0
  55. /package/dist/{toggle → packages/toggle}/index.d.ts +0 -0
  56. /package/dist/{utils → packages/utils}/cva.d.ts +0 -0
  57. /package/dist/{utils → packages/utils}/cx.d.ts +0 -0
  58. /package/dist/{utils → packages/utils}/useClickOutside.d.ts +0 -0
package/dist/zen.js CHANGED
@@ -1,2149 +1,899 @@
1
- import { jsx as y, jsxs as W, Fragment as Ve } from "react/jsx-runtime";
2
- import * as C from "react";
3
- import { useLayoutEffect as ot, useEffect as re, useState as de, useId as it, useMemo as ve, useRef as Ee } from "react";
4
- import * as st from "react-dom";
5
- import { createPortal as rt, flushSync as lt } from "react-dom";
6
- const M = (...e) => e.reduce((o, t) => t == null || t === !1 ? o : typeof t == "string" || typeof t == "number" ? o + " " + t : Array.isArray(t) ? o + " " + M(...t) : typeof t == "object" ? o + " " + Object.entries(t).reduce((n, [i, s]) => s == null || s === !1 ? n : typeof s == "string" || typeof s == "number" ? n + " " + i + "-" + s : typeof s == "boolean" && s ? n + " " + i : n, "") : o, ""), Ae = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, We = (e, o) => (t) => {
7
- var a;
8
- if ((o == null ? void 0 : o.variants) == null) return M(e, t == null ? void 0 : t.class, t == null ? void 0 : t.className);
9
- const { variants: n, defaultVariants: i } = o, s = Object.keys(n).map((c) => {
10
- const u = t == null ? void 0 : t[c], d = i == null ? void 0 : i[c];
11
- if (u === null) return null;
12
- const h = Ae(u) || Ae(d);
13
- return n[c][h];
14
- }), r = t && Object.entries(t).reduce(
15
- (c, [u, d]) => (d === void 0 || (c[u] = d), c),
16
- {}
17
- ), l = (a = o == null ? void 0 : o.compoundVariants) == null ? void 0 : a.reduce(
18
- (c, { class: u, className: d, ...h }) => Object.entries(h).every(
19
- ([f, g]) => Array.isArray(g) ? g.includes(
20
- {
21
- ...i,
22
- ...r
23
- }[f]
24
- ) : {
25
- ...i,
26
- ...r
27
- }[f] === g
28
- ) ? [...c, u, d] : c,
29
- []
30
- );
31
- return M(e, s, l, t == null ? void 0 : t.class, t == null ? void 0 : t.className);
1
+ import * as e from "react";
2
+ import { useEffect as t, useId as n, useMemo as r, useRef as i, useState as a } from "react";
3
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
4
+ import { flushSync as l } from "react-dom";
5
+ //#region packages/utils/cx.ts
6
+ var u = (...e) => e.reduce((e, t) => t == null || t === !1 ? e : typeof t == "string" || typeof t == "number" ? e + " " + t : Array.isArray(t) ? e + " " + u(...t) : typeof t == "object" ? e + " " + Object.entries(t).reduce((e, [t, n]) => n == null || n === !1 ? e : typeof n == "string" || typeof n == "number" ? e + " " + t + "-" + n : typeof n == "boolean" && n ? e + " " + t : e, "") : e, ""), d = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, f = (e, t) => (n) => {
7
+ if (t?.variants == null) return u(e, n?.class, n?.className);
8
+ let { variants: r, defaultVariants: i } = t, a = Object.keys(r).map((e) => {
9
+ let t = n?.[e], a = i?.[e];
10
+ if (t === null) return null;
11
+ let o = d(t) || d(a);
12
+ return r[e][o];
13
+ }), o = n && Object.entries(n).reduce((e, [t, n]) => (n === void 0 || (e[t] = n), e), {}), s = t?.compoundVariants?.reduce((e, { class: t, className: n, ...r }) => Object.entries(r).every(([e, t]) => Array.isArray(t) ? t.includes({
14
+ ...i,
15
+ ...o
16
+ }[e]) : {
17
+ ...i,
18
+ ...o
19
+ }[e] === t) ? [
20
+ ...e,
21
+ t,
22
+ n
23
+ ] : e, []);
24
+ return u(e, a, s, n?.class, n?.className);
32
25
  };
33
- function Be({ variant: e, className: o, ...t }) {
34
- return /* @__PURE__ */ y("span", { ...t, className: ct({ variant: e, className: o }) });
35
- }
36
- const ct = We(
37
- "zen__badge inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors whitespace-nowrap",
38
- {
39
- variants: {
40
- variant: {
41
- default: "border-transparent bg-primary text-primary-foreground shadow-sm",
42
- secondary: "border-transparent bg-secondary text-secondary-foreground",
43
- destructive: "border-transparent bg-destructive text-destructive-foreground shadow-sm",
44
- outline: "text-foreground"
45
- }
46
- },
47
- defaultVariants: {
48
- variant: "default"
49
- }
50
- }
51
- );
52
- function at({ className: e, variant: o, size: t, ...n }) {
53
- return /* @__PURE__ */ y("button", { className: ut({ variant: o, size: t, className: e }), ...n });
54
- }
55
- const ut = We(
56
- "zen__button inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
57
- {
58
- variants: {
59
- variant: {
60
- default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
61
- destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",
62
- outline: "border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
63
- secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
64
- ghost: "hover:bg-accent hover:text-accent-foreground",
65
- link: "text-primary underline-offset-4 hover:underline",
66
- icon: ""
67
- },
68
- size: {
69
- default: "h-9 px-4 py-2",
70
- sm: "h-8 rounded-md px-3 text-xs",
71
- lg: "h-10 rounded-md px-8",
72
- icon: ""
73
- }
74
- },
75
- defaultVariants: {
76
- variant: "default",
77
- size: "default"
78
- }
79
- }
80
- ), le = Math.min, H = Math.max, ce = Math.round, ie = Math.floor, _ = (e) => ({
81
- x: e,
82
- y: e
83
- }), ft = {
84
- left: "right",
85
- right: "left",
86
- bottom: "top",
87
- top: "bottom"
88
- }, dt = {
89
- start: "end",
90
- end: "start"
91
- };
92
- function Te(e, o, t) {
93
- return H(e, le(o, t));
94
- }
95
- function he(e, o) {
96
- return typeof e == "function" ? e(o) : e;
97
- }
98
- function U(e) {
99
- return e.split("-")[0];
100
- }
101
- function me(e) {
102
- return e.split("-")[1];
103
- }
104
- function je(e) {
105
- return e === "x" ? "y" : "x";
106
- }
107
- function $e(e) {
108
- return e === "y" ? "height" : "width";
109
- }
110
- function G(e) {
111
- return ["top", "bottom"].includes(U(e)) ? "y" : "x";
112
- }
113
- function He(e) {
114
- return je(G(e));
115
- }
116
- function ht(e, o, t) {
117
- t === void 0 && (t = !1);
118
- const n = me(e), i = He(e), s = $e(i);
119
- let r = i === "x" ? n === (t ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
120
- return o.reference[s] > o.floating[s] && (r = ae(r)), [r, ae(r)];
121
- }
122
- function mt(e) {
123
- const o = ae(e);
124
- return [Se(e), o, Se(o)];
125
- }
126
- function Se(e) {
127
- return e.replace(/start|end/g, (o) => dt[o]);
128
- }
129
- function gt(e, o, t) {
130
- const n = ["left", "right"], i = ["right", "left"], s = ["top", "bottom"], r = ["bottom", "top"];
131
- switch (e) {
132
- case "top":
133
- case "bottom":
134
- return t ? o ? i : n : o ? n : i;
135
- case "left":
136
- case "right":
137
- return o ? s : r;
138
- default:
139
- return [];
140
- }
141
- }
142
- function pt(e, o, t, n) {
143
- const i = me(e);
144
- let s = gt(U(e), t === "start", n);
145
- return i && (s = s.map((r) => r + "-" + i), o && (s = s.concat(s.map(Se)))), s;
146
- }
147
- function ae(e) {
148
- return e.replace(/left|right|bottom|top/g, (o) => ft[o]);
149
- }
150
- function xt(e) {
151
- return {
152
- top: 0,
153
- right: 0,
154
- bottom: 0,
155
- left: 0,
156
- ...e
157
- };
158
- }
159
- function wt(e) {
160
- return typeof e != "number" ? xt(e) : {
161
- top: e,
162
- right: e,
163
- bottom: e,
164
- left: e
165
- };
166
- }
167
- function ue(e) {
168
- const {
169
- x: o,
170
- y: t,
171
- width: n,
172
- height: i
173
- } = e;
174
- return {
175
- width: n,
176
- height: i,
177
- top: t,
178
- left: o,
179
- right: o + n,
180
- bottom: t + i,
181
- x: o,
182
- y: t
183
- };
184
- }
185
- function ze(e, o, t) {
186
- let {
187
- reference: n,
188
- floating: i
189
- } = e;
190
- const s = G(o), r = He(o), l = $e(r), a = U(o), c = s === "y", u = n.x + n.width / 2 - i.width / 2, d = n.y + n.height / 2 - i.height / 2, h = n[l] / 2 - i[l] / 2;
191
- let f;
192
- switch (a) {
193
- case "top":
194
- f = {
195
- x: u,
196
- y: n.y - i.height
197
- };
198
- break;
199
- case "bottom":
200
- f = {
201
- x: u,
202
- y: n.y + n.height
203
- };
204
- break;
205
- case "right":
206
- f = {
207
- x: n.x + n.width,
208
- y: d
209
- };
210
- break;
211
- case "left":
212
- f = {
213
- x: n.x - i.width,
214
- y: d
215
- };
216
- break;
217
- default:
218
- f = {
219
- x: n.x,
220
- y: n.y
221
- };
222
- }
223
- switch (me(o)) {
224
- case "start":
225
- f[r] -= h * (t && c ? -1 : 1);
226
- break;
227
- case "end":
228
- f[r] += h * (t && c ? -1 : 1);
229
- break;
230
- }
231
- return f;
232
- }
233
- const bt = async (e, o, t) => {
234
- const {
235
- placement: n = "bottom",
236
- strategy: i = "absolute",
237
- middleware: s = [],
238
- platform: r
239
- } = t, l = s.filter(Boolean), a = await (r.isRTL == null ? void 0 : r.isRTL(o));
240
- let c = await r.getElementRects({
241
- reference: e,
242
- floating: o,
243
- strategy: i
244
- }), {
245
- x: u,
246
- y: d
247
- } = ze(c, n, a), h = n, f = {}, g = 0;
248
- for (let x = 0; x < l.length; x++) {
249
- const {
250
- name: w,
251
- fn: m
252
- } = l[x], {
253
- x: p,
254
- y: v,
255
- data: E,
256
- reset: b
257
- } = await m({
258
- x: u,
259
- y: d,
260
- initialPlacement: n,
261
- placement: h,
262
- strategy: i,
263
- middlewareData: f,
264
- rects: c,
265
- platform: r,
266
- elements: {
267
- reference: e,
268
- floating: o
269
- }
270
- });
271
- u = p ?? u, d = v ?? d, f = {
272
- ...f,
273
- [w]: {
274
- ...f[w],
275
- ...E
276
- }
277
- }, b && g <= 50 && (g++, typeof b == "object" && (b.placement && (h = b.placement), b.rects && (c = b.rects === !0 ? await r.getElementRects({
278
- reference: e,
279
- floating: o,
280
- strategy: i
281
- }) : b.rects), {
282
- x: u,
283
- y: d
284
- } = ze(c, h, a)), x = -1);
285
- }
286
- return {
287
- x: u,
288
- y: d,
289
- placement: h,
290
- strategy: i,
291
- middlewareData: f
292
- };
293
- };
294
- async function Ue(e, o) {
295
- var t;
296
- o === void 0 && (o = {});
297
- const {
298
- x: n,
299
- y: i,
300
- platform: s,
301
- rects: r,
302
- elements: l,
303
- strategy: a
304
- } = e, {
305
- boundary: c = "clippingAncestors",
306
- rootBoundary: u = "viewport",
307
- elementContext: d = "floating",
308
- altBoundary: h = !1,
309
- padding: f = 0
310
- } = he(o, e), g = wt(f), w = l[h ? d === "floating" ? "reference" : "floating" : d], m = ue(await s.getClippingRect({
311
- element: (t = await (s.isElement == null ? void 0 : s.isElement(w))) == null || t ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
312
- boundary: c,
313
- rootBoundary: u,
314
- strategy: a
315
- })), p = d === "floating" ? {
316
- x: n,
317
- y: i,
318
- width: r.floating.width,
319
- height: r.floating.height
320
- } : r.reference, v = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), E = await (s.isElement == null ? void 0 : s.isElement(v)) ? await (s.getScale == null ? void 0 : s.getScale(v)) || {
321
- x: 1,
322
- y: 1
323
- } : {
324
- x: 1,
325
- y: 1
326
- }, b = ue(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
327
- elements: l,
328
- rect: p,
329
- offsetParent: v,
330
- strategy: a
331
- }) : p);
332
- return {
333
- top: (m.top - b.top + g.top) / E.y,
334
- bottom: (b.bottom - m.bottom + g.bottom) / E.y,
335
- left: (m.left - b.left + g.left) / E.x,
336
- right: (b.right - m.right + g.right) / E.x
337
- };
338
- }
339
- const yt = function(e) {
340
- return e === void 0 && (e = {}), {
341
- name: "flip",
342
- options: e,
343
- async fn(o) {
344
- var t, n;
345
- const {
346
- placement: i,
347
- middlewareData: s,
348
- rects: r,
349
- initialPlacement: l,
350
- platform: a,
351
- elements: c
352
- } = o, {
353
- mainAxis: u = !0,
354
- crossAxis: d = !0,
355
- fallbackPlacements: h,
356
- fallbackStrategy: f = "bestFit",
357
- fallbackAxisSideDirection: g = "none",
358
- flipAlignment: x = !0,
359
- ...w
360
- } = he(e, o);
361
- if ((t = s.arrow) != null && t.alignmentOffset)
362
- return {};
363
- const m = U(i), p = G(l), v = U(l) === l, E = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), b = h || (v || !x ? [ae(l)] : mt(l)), R = g !== "none";
364
- !h && R && b.push(...pt(l, x, g, E));
365
- const O = [l, ...b], z = await Ue(o, w), K = [];
366
- let P = ((n = s.flip) == null ? void 0 : n.overflows) || [];
367
- if (u && K.push(z[m]), d) {
368
- const N = ht(i, r, E);
369
- K.push(z[N[0]], z[N[1]]);
370
- }
371
- if (P = [...P, {
372
- placement: i,
373
- overflows: K
374
- }], !K.every((N) => N <= 0)) {
375
- var Y, ee;
376
- const N = (((Y = s.flip) == null ? void 0 : Y.index) || 0) + 1, te = O[N];
377
- if (te)
378
- return {
379
- data: {
380
- index: N,
381
- overflows: P
382
- },
383
- reset: {
384
- placement: te
385
- }
386
- };
387
- let k = (ee = P.filter((V) => V.overflows[0] <= 0).sort((V, S) => V.overflows[1] - S.overflows[1])[0]) == null ? void 0 : ee.placement;
388
- if (!k)
389
- switch (f) {
390
- case "bestFit": {
391
- var B;
392
- const V = (B = P.filter((S) => {
393
- if (R) {
394
- const A = G(S.placement);
395
- return A === p || // Create a bias to the `y` side axis due to horizontal
396
- // reading directions favoring greater width.
397
- A === "y";
398
- }
399
- return !0;
400
- }).map((S) => [S.placement, S.overflows.filter((A) => A > 0).reduce((A, j) => A + j, 0)]).sort((S, A) => S[1] - A[1])[0]) == null ? void 0 : B[0];
401
- V && (k = V);
402
- break;
403
- }
404
- case "initialPlacement":
405
- k = l;
406
- break;
407
- }
408
- if (i !== k)
409
- return {
410
- reset: {
411
- placement: k
412
- }
413
- };
414
- }
415
- return {};
416
- }
417
- };
418
- };
419
- async function vt(e, o) {
420
- const {
421
- placement: t,
422
- platform: n,
423
- elements: i
424
- } = e, s = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), r = U(t), l = me(t), a = G(t) === "y", c = ["left", "top"].includes(r) ? -1 : 1, u = s && a ? -1 : 1, d = he(o, e);
425
- let {
426
- mainAxis: h,
427
- crossAxis: f,
428
- alignmentAxis: g
429
- } = typeof d == "number" ? {
430
- mainAxis: d,
431
- crossAxis: 0,
432
- alignmentAxis: null
433
- } : {
434
- mainAxis: d.mainAxis || 0,
435
- crossAxis: d.crossAxis || 0,
436
- alignmentAxis: d.alignmentAxis
437
- };
438
- return l && typeof g == "number" && (f = l === "end" ? g * -1 : g), a ? {
439
- x: f * u,
440
- y: h * c
441
- } : {
442
- x: h * c,
443
- y: f * u
444
- };
445
- }
446
- const Et = function(e) {
447
- return e === void 0 && (e = 0), {
448
- name: "offset",
449
- options: e,
450
- async fn(o) {
451
- var t, n;
452
- const {
453
- x: i,
454
- y: s,
455
- placement: r,
456
- middlewareData: l
457
- } = o, a = await vt(o, e);
458
- return r === ((t = l.offset) == null ? void 0 : t.placement) && (n = l.arrow) != null && n.alignmentOffset ? {} : {
459
- x: i + a.x,
460
- y: s + a.y,
461
- data: {
462
- ...a,
463
- placement: r
464
- }
465
- };
466
- }
467
- };
468
- }, St = function(e) {
469
- return e === void 0 && (e = {}), {
470
- name: "shift",
471
- options: e,
472
- async fn(o) {
473
- const {
474
- x: t,
475
- y: n,
476
- placement: i
477
- } = o, {
478
- mainAxis: s = !0,
479
- crossAxis: r = !1,
480
- limiter: l = {
481
- fn: (w) => {
482
- let {
483
- x: m,
484
- y: p
485
- } = w;
486
- return {
487
- x: m,
488
- y: p
489
- };
490
- }
491
- },
492
- ...a
493
- } = he(e, o), c = {
494
- x: t,
495
- y: n
496
- }, u = await Ue(o, a), d = G(U(i)), h = je(d);
497
- let f = c[h], g = c[d];
498
- if (s) {
499
- const w = h === "y" ? "top" : "left", m = h === "y" ? "bottom" : "right", p = f + u[w], v = f - u[m];
500
- f = Te(p, f, v);
501
- }
502
- if (r) {
503
- const w = d === "y" ? "top" : "left", m = d === "y" ? "bottom" : "right", p = g + u[w], v = g - u[m];
504
- g = Te(p, g, v);
505
- }
506
- const x = l.fn({
507
- ...o,
508
- [h]: f,
509
- [d]: g
510
- });
511
- return {
512
- ...x,
513
- data: {
514
- x: x.x - t,
515
- y: x.y - n,
516
- enabled: {
517
- [h]: s,
518
- [d]: r
519
- }
520
- }
521
- };
522
- }
523
- };
524
- };
525
- function ge() {
526
- return typeof window < "u";
527
- }
528
- function Q(e) {
529
- return qe(e) ? (e.nodeName || "").toLowerCase() : "#document";
530
- }
531
- function T(e) {
532
- var o;
533
- return (e == null || (o = e.ownerDocument) == null ? void 0 : o.defaultView) || window;
534
- }
535
- function F(e) {
536
- var o;
537
- return (o = (qe(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : o.documentElement;
538
- }
539
- function qe(e) {
540
- return ge() ? e instanceof Node || e instanceof T(e).Node : !1;
541
- }
542
- function I(e) {
543
- return ge() ? e instanceof Element || e instanceof T(e).Element : !1;
544
- }
545
- function D(e) {
546
- return ge() ? e instanceof HTMLElement || e instanceof T(e).HTMLElement : !1;
547
- }
548
- function Ne(e) {
549
- return !ge() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof T(e).ShadowRoot;
550
- }
551
- function oe(e) {
552
- const {
553
- overflow: o,
554
- overflowX: t,
555
- overflowY: n,
556
- display: i
557
- } = L(e);
558
- return /auto|scroll|overlay|hidden|clip/.test(o + n + t) && !["inline", "contents"].includes(i);
559
- }
560
- function Ot(e) {
561
- return ["table", "td", "th"].includes(Q(e));
562
- }
563
- function pe(e) {
564
- return [":popover-open", ":modal"].some((o) => {
565
- try {
566
- return e.matches(o);
567
- } catch {
568
- return !1;
569
- }
570
- });
571
- }
572
- function Ce(e) {
573
- const o = Re(), t = I(e) ? L(e) : e;
574
- return ["transform", "translate", "scale", "rotate", "perspective"].some((n) => t[n] ? t[n] !== "none" : !1) || (t.containerType ? t.containerType !== "normal" : !1) || !o && (t.backdropFilter ? t.backdropFilter !== "none" : !1) || !o && (t.filter ? t.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((n) => (t.willChange || "").includes(n)) || ["paint", "layout", "strict", "content"].some((n) => (t.contain || "").includes(n));
575
- }
576
- function Ct(e) {
577
- let o = $(e);
578
- for (; D(o) && !J(o); ) {
579
- if (Ce(o))
580
- return o;
581
- if (pe(o))
582
- return null;
583
- o = $(o);
584
- }
585
- return null;
586
- }
587
- function Re() {
588
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
589
- }
590
- function J(e) {
591
- return ["html", "body", "#document"].includes(Q(e));
592
- }
593
- function L(e) {
594
- return T(e).getComputedStyle(e);
595
- }
596
- function xe(e) {
597
- return I(e) ? {
598
- scrollLeft: e.scrollLeft,
599
- scrollTop: e.scrollTop
600
- } : {
601
- scrollLeft: e.scrollX,
602
- scrollTop: e.scrollY
603
- };
604
- }
605
- function $(e) {
606
- if (Q(e) === "html")
607
- return e;
608
- const o = (
609
- // Step into the shadow DOM of the parent of a slotted node.
610
- e.assignedSlot || // DOM Element detected.
611
- e.parentNode || // ShadowRoot detected.
612
- Ne(e) && e.host || // Fallback.
613
- F(e)
614
- );
615
- return Ne(o) ? o.host : o;
616
- }
617
- function Ke(e) {
618
- const o = $(e);
619
- return J(o) ? e.ownerDocument ? e.ownerDocument.body : e.body : D(o) && oe(o) ? o : Ke(o);
620
- }
621
- function ne(e, o, t) {
622
- var n;
623
- o === void 0 && (o = []), t === void 0 && (t = !0);
624
- const i = Ke(e), s = i === ((n = e.ownerDocument) == null ? void 0 : n.body), r = T(i);
625
- if (s) {
626
- const l = Oe(r);
627
- return o.concat(r, r.visualViewport || [], oe(i) ? i : [], l && t ? ne(l) : []);
628
- }
629
- return o.concat(i, ne(i, [], t));
630
- }
631
- function Oe(e) {
632
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
633
- }
634
- function Ye(e) {
635
- const o = L(e);
636
- let t = parseFloat(o.width) || 0, n = parseFloat(o.height) || 0;
637
- const i = D(e), s = i ? e.offsetWidth : t, r = i ? e.offsetHeight : n, l = ce(t) !== s || ce(n) !== r;
638
- return l && (t = s, n = r), {
639
- width: t,
640
- height: n,
641
- $: l
642
- };
643
- }
644
- function Me(e) {
645
- return I(e) ? e : e.contextElement;
646
- }
647
- function Z(e) {
648
- const o = Me(e);
649
- if (!D(o))
650
- return _(1);
651
- const t = o.getBoundingClientRect(), {
652
- width: n,
653
- height: i,
654
- $: s
655
- } = Ye(o);
656
- let r = (s ? ce(t.width) : t.width) / n, l = (s ? ce(t.height) : t.height) / i;
657
- return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
658
- x: r,
659
- y: l
660
- };
661
- }
662
- const Rt = /* @__PURE__ */ _(0);
663
- function Xe(e) {
664
- const o = T(e);
665
- return !Re() || !o.visualViewport ? Rt : {
666
- x: o.visualViewport.offsetLeft,
667
- y: o.visualViewport.offsetTop
668
- };
669
- }
670
- function Mt(e, o, t) {
671
- return o === void 0 && (o = !1), !t || o && t !== T(e) ? !1 : o;
672
- }
673
- function q(e, o, t, n) {
674
- o === void 0 && (o = !1), t === void 0 && (t = !1);
675
- const i = e.getBoundingClientRect(), s = Me(e);
676
- let r = _(1);
677
- o && (n ? I(n) && (r = Z(n)) : r = Z(e));
678
- const l = Mt(s, t, n) ? Xe(s) : _(0);
679
- let a = (i.left + l.x) / r.x, c = (i.top + l.y) / r.y, u = i.width / r.x, d = i.height / r.y;
680
- if (s) {
681
- const h = T(s), f = n && I(n) ? T(n) : n;
682
- let g = h, x = Oe(g);
683
- for (; x && n && f !== g; ) {
684
- const w = Z(x), m = x.getBoundingClientRect(), p = L(x), v = m.left + (x.clientLeft + parseFloat(p.paddingLeft)) * w.x, E = m.top + (x.clientTop + parseFloat(p.paddingTop)) * w.y;
685
- a *= w.x, c *= w.y, u *= w.x, d *= w.y, a += v, c += E, g = T(x), x = Oe(g);
686
- }
687
- }
688
- return ue({
689
- width: u,
690
- height: d,
691
- x: a,
692
- y: c
693
- });
694
- }
695
- function ke(e, o) {
696
- const t = xe(e).scrollLeft;
697
- return o ? o.left + t : q(F(e)).left + t;
698
- }
699
- function Ze(e, o, t) {
700
- t === void 0 && (t = !1);
701
- const n = e.getBoundingClientRect(), i = n.left + o.scrollLeft - (t ? 0 : (
702
- // RTL <body> scrollbar.
703
- ke(e, n)
704
- )), s = n.top + o.scrollTop;
705
- return {
706
- x: i,
707
- y: s
708
- };
709
- }
710
- function kt(e) {
711
- let {
712
- elements: o,
713
- rect: t,
714
- offsetParent: n,
715
- strategy: i
716
- } = e;
717
- const s = i === "fixed", r = F(n), l = o ? pe(o.floating) : !1;
718
- if (n === r || l && s)
719
- return t;
720
- let a = {
721
- scrollLeft: 0,
722
- scrollTop: 0
723
- }, c = _(1);
724
- const u = _(0), d = D(n);
725
- if ((d || !d && !s) && ((Q(n) !== "body" || oe(r)) && (a = xe(n)), D(n))) {
726
- const f = q(n);
727
- c = Z(n), u.x = f.x + n.clientLeft, u.y = f.y + n.clientTop;
728
- }
729
- const h = r && !d && !s ? Ze(r, a, !0) : _(0);
730
- return {
731
- width: t.width * c.x,
732
- height: t.height * c.y,
733
- x: t.x * c.x - a.scrollLeft * c.x + u.x + h.x,
734
- y: t.y * c.y - a.scrollTop * c.y + u.y + h.y
735
- };
736
- }
737
- function At(e) {
738
- return Array.from(e.getClientRects());
739
- }
740
- function Tt(e) {
741
- const o = F(e), t = xe(e), n = e.ownerDocument.body, i = H(o.scrollWidth, o.clientWidth, n.scrollWidth, n.clientWidth), s = H(o.scrollHeight, o.clientHeight, n.scrollHeight, n.clientHeight);
742
- let r = -t.scrollLeft + ke(e);
743
- const l = -t.scrollTop;
744
- return L(n).direction === "rtl" && (r += H(o.clientWidth, n.clientWidth) - i), {
745
- width: i,
746
- height: s,
747
- x: r,
748
- y: l
749
- };
750
- }
751
- function zt(e, o) {
752
- const t = T(e), n = F(e), i = t.visualViewport;
753
- let s = n.clientWidth, r = n.clientHeight, l = 0, a = 0;
754
- if (i) {
755
- s = i.width, r = i.height;
756
- const c = Re();
757
- (!c || c && o === "fixed") && (l = i.offsetLeft, a = i.offsetTop);
758
- }
759
- return {
760
- width: s,
761
- height: r,
762
- x: l,
763
- y: a
764
- };
765
- }
766
- function Nt(e, o) {
767
- const t = q(e, !0, o === "fixed"), n = t.top + e.clientTop, i = t.left + e.clientLeft, s = D(e) ? Z(e) : _(1), r = e.clientWidth * s.x, l = e.clientHeight * s.y, a = i * s.x, c = n * s.y;
768
- return {
769
- width: r,
770
- height: l,
771
- x: a,
772
- y: c
773
- };
774
- }
775
- function Ie(e, o, t) {
776
- let n;
777
- if (o === "viewport")
778
- n = zt(e, t);
779
- else if (o === "document")
780
- n = Tt(F(e));
781
- else if (I(o))
782
- n = Nt(o, t);
783
- else {
784
- const i = Xe(e);
785
- n = {
786
- x: o.x - i.x,
787
- y: o.y - i.y,
788
- width: o.width,
789
- height: o.height
790
- };
791
- }
792
- return ue(n);
793
- }
794
- function Ge(e, o) {
795
- const t = $(e);
796
- return t === o || !I(t) || J(t) ? !1 : L(t).position === "fixed" || Ge(t, o);
797
- }
798
- function It(e, o) {
799
- const t = o.get(e);
800
- if (t)
801
- return t;
802
- let n = ne(e, [], !1).filter((l) => I(l) && Q(l) !== "body"), i = null;
803
- const s = L(e).position === "fixed";
804
- let r = s ? $(e) : e;
805
- for (; I(r) && !J(r); ) {
806
- const l = L(r), a = Ce(r);
807
- !a && l.position === "fixed" && (i = null), (s ? !a && !i : !a && l.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || oe(r) && !a && Ge(e, r)) ? n = n.filter((u) => u !== r) : i = l, r = $(r);
808
- }
809
- return o.set(e, n), n;
810
- }
811
- function Lt(e) {
812
- let {
813
- element: o,
814
- boundary: t,
815
- rootBoundary: n,
816
- strategy: i
817
- } = e;
818
- const r = [...t === "clippingAncestors" ? pe(o) ? [] : It(o, this._c) : [].concat(t), n], l = r[0], a = r.reduce((c, u) => {
819
- const d = Ie(o, u, i);
820
- return c.top = H(d.top, c.top), c.right = le(d.right, c.right), c.bottom = le(d.bottom, c.bottom), c.left = H(d.left, c.left), c;
821
- }, Ie(o, l, i));
822
- return {
823
- width: a.right - a.left,
824
- height: a.bottom - a.top,
825
- x: a.left,
826
- y: a.top
827
- };
828
- }
829
- function _t(e) {
830
- const {
831
- width: o,
832
- height: t
833
- } = Ye(e);
834
- return {
835
- width: o,
836
- height: t
837
- };
838
- }
839
- function Dt(e, o, t) {
840
- const n = D(o), i = F(o), s = t === "fixed", r = q(e, !0, s, o);
841
- let l = {
842
- scrollLeft: 0,
843
- scrollTop: 0
844
- };
845
- const a = _(0);
846
- if (n || !n && !s)
847
- if ((Q(o) !== "body" || oe(i)) && (l = xe(o)), n) {
848
- const h = q(o, !0, s, o);
849
- a.x = h.x + o.clientLeft, a.y = h.y + o.clientTop;
850
- } else i && (a.x = ke(i));
851
- const c = i && !n && !s ? Ze(i, l) : _(0), u = r.left + l.scrollLeft - a.x - c.x, d = r.top + l.scrollTop - a.y - c.y;
852
- return {
853
- x: u,
854
- y: d,
855
- width: r.width,
856
- height: r.height
857
- };
858
- }
859
- function we(e) {
860
- return L(e).position === "static";
861
- }
862
- function Le(e, o) {
863
- if (!D(e) || L(e).position === "fixed")
864
- return null;
865
- if (o)
866
- return o(e);
867
- let t = e.offsetParent;
868
- return F(e) === t && (t = t.ownerDocument.body), t;
869
- }
870
- function Je(e, o) {
871
- const t = T(e);
872
- if (pe(e))
873
- return t;
874
- if (!D(e)) {
875
- let i = $(e);
876
- for (; i && !J(i); ) {
877
- if (I(i) && !we(i))
878
- return i;
879
- i = $(i);
880
- }
881
- return t;
882
- }
883
- let n = Le(e, o);
884
- for (; n && Ot(n) && we(n); )
885
- n = Le(n, o);
886
- return n && J(n) && we(n) && !Ce(n) ? t : n || Ct(e) || t;
887
- }
888
- const Ft = async function(e) {
889
- const o = this.getOffsetParent || Je, t = this.getDimensions, n = await t(e.floating);
890
- return {
891
- reference: Dt(e.reference, await o(e.floating), e.strategy),
892
- floating: {
893
- x: 0,
894
- y: 0,
895
- width: n.width,
896
- height: n.height
897
- }
898
- };
899
- };
900
- function Pt(e) {
901
- return L(e).direction === "rtl";
902
- }
903
- const Vt = {
904
- convertOffsetParentRelativeRectToViewportRelativeRect: kt,
905
- getDocumentElement: F,
906
- getClippingRect: Lt,
907
- getOffsetParent: Je,
908
- getElementRects: Ft,
909
- getClientRects: At,
910
- getDimensions: _t,
911
- getScale: Z,
912
- isElement: I,
913
- isRTL: Pt
914
- };
915
- function Qe(e, o) {
916
- return e.x === o.x && e.y === o.y && e.width === o.width && e.height === o.height;
917
- }
918
- function Wt(e, o) {
919
- let t = null, n;
920
- const i = F(e);
921
- function s() {
922
- var l;
923
- clearTimeout(n), (l = t) == null || l.disconnect(), t = null;
924
- }
925
- function r(l, a) {
926
- l === void 0 && (l = !1), a === void 0 && (a = 1), s();
927
- const c = e.getBoundingClientRect(), {
928
- left: u,
929
- top: d,
930
- width: h,
931
- height: f
932
- } = c;
933
- if (l || o(), !h || !f)
934
- return;
935
- const g = ie(d), x = ie(i.clientWidth - (u + h)), w = ie(i.clientHeight - (d + f)), m = ie(u), v = {
936
- rootMargin: -g + "px " + -x + "px " + -w + "px " + -m + "px",
937
- threshold: H(0, le(1, a)) || 1
938
- };
939
- let E = !0;
940
- function b(R) {
941
- const O = R[0].intersectionRatio;
942
- if (O !== a) {
943
- if (!E)
944
- return r();
945
- O ? r(!1, O) : n = setTimeout(() => {
946
- r(!1, 1e-7);
947
- }, 1e3);
948
- }
949
- O === 1 && !Qe(c, e.getBoundingClientRect()) && r(), E = !1;
950
- }
951
- try {
952
- t = new IntersectionObserver(b, {
953
- ...v,
954
- // Handle <iframe>s
955
- root: i.ownerDocument
956
- });
957
- } catch {
958
- t = new IntersectionObserver(b, v);
959
- }
960
- t.observe(e);
961
- }
962
- return r(!0), s;
963
- }
964
- function Bt(e, o, t, n) {
965
- n === void 0 && (n = {});
966
- const {
967
- ancestorScroll: i = !0,
968
- ancestorResize: s = !0,
969
- elementResize: r = typeof ResizeObserver == "function",
970
- layoutShift: l = typeof IntersectionObserver == "function",
971
- animationFrame: a = !1
972
- } = n, c = Me(e), u = i || s ? [...c ? ne(c) : [], ...ne(o)] : [];
973
- u.forEach((m) => {
974
- i && m.addEventListener("scroll", t, {
975
- passive: !0
976
- }), s && m.addEventListener("resize", t);
977
- });
978
- const d = c && l ? Wt(c, t) : null;
979
- let h = -1, f = null;
980
- r && (f = new ResizeObserver((m) => {
981
- let [p] = m;
982
- p && p.target === c && f && (f.unobserve(o), cancelAnimationFrame(h), h = requestAnimationFrame(() => {
983
- var v;
984
- (v = f) == null || v.observe(o);
985
- })), t();
986
- }), c && !a && f.observe(c), f.observe(o));
987
- let g, x = a ? q(e) : null;
988
- a && w();
989
- function w() {
990
- const m = q(e);
991
- x && !Qe(x, m) && t(), x = m, g = requestAnimationFrame(w);
992
- }
993
- return t(), () => {
994
- var m;
995
- u.forEach((p) => {
996
- i && p.removeEventListener("scroll", t), s && p.removeEventListener("resize", t);
997
- }), d == null || d(), (m = f) == null || m.disconnect(), f = null, a && cancelAnimationFrame(g);
998
- };
999
- }
1000
- const jt = Et, $t = St, Ht = yt, Ut = (e, o, t) => {
1001
- const n = /* @__PURE__ */ new Map(), i = {
1002
- platform: Vt,
1003
- ...t
1004
- }, s = {
1005
- ...i.platform,
1006
- _c: n
1007
- };
1008
- return bt(e, o, {
1009
- ...i,
1010
- platform: s
1011
- });
1012
- };
1013
- var se = typeof document < "u" ? ot : re;
1014
- function fe(e, o) {
1015
- if (e === o)
1016
- return !0;
1017
- if (typeof e != typeof o)
1018
- return !1;
1019
- if (typeof e == "function" && e.toString() === o.toString())
1020
- return !0;
1021
- let t, n, i;
1022
- if (e && o && typeof e == "object") {
1023
- if (Array.isArray(e)) {
1024
- if (t = e.length, t !== o.length) return !1;
1025
- for (n = t; n-- !== 0; )
1026
- if (!fe(e[n], o[n]))
1027
- return !1;
1028
- return !0;
1029
- }
1030
- if (i = Object.keys(e), t = i.length, t !== Object.keys(o).length)
1031
- return !1;
1032
- for (n = t; n-- !== 0; )
1033
- if (!{}.hasOwnProperty.call(o, i[n]))
1034
- return !1;
1035
- for (n = t; n-- !== 0; ) {
1036
- const s = i[n];
1037
- if (!(s === "_owner" && e.$$typeof) && !fe(e[s], o[s]))
1038
- return !1;
1039
- }
1040
- return !0;
1041
- }
1042
- return e !== e && o !== o;
1043
- }
1044
- function et(e) {
1045
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1046
- }
1047
- function _e(e, o) {
1048
- const t = et(e);
1049
- return Math.round(o * t) / t;
1050
- }
1051
- function be(e) {
1052
- const o = C.useRef(e);
1053
- return se(() => {
1054
- o.current = e;
1055
- }), o;
1056
- }
1057
- function qt(e) {
1058
- e === void 0 && (e = {});
1059
- const {
1060
- placement: o = "bottom",
1061
- strategy: t = "absolute",
1062
- middleware: n = [],
1063
- platform: i,
1064
- elements: {
1065
- reference: s,
1066
- floating: r
1067
- } = {},
1068
- transform: l = !0,
1069
- whileElementsMounted: a,
1070
- open: c
1071
- } = e, [u, d] = C.useState({
1072
- x: 0,
1073
- y: 0,
1074
- strategy: t,
1075
- placement: o,
1076
- middlewareData: {},
1077
- isPositioned: !1
1078
- }), [h, f] = C.useState(n);
1079
- fe(h, n) || f(n);
1080
- const [g, x] = C.useState(null), [w, m] = C.useState(null), p = C.useCallback((S) => {
1081
- S !== R.current && (R.current = S, x(S));
1082
- }, []), v = C.useCallback((S) => {
1083
- S !== O.current && (O.current = S, m(S));
1084
- }, []), E = s || g, b = r || w, R = C.useRef(null), O = C.useRef(null), z = C.useRef(u), K = a != null, P = be(a), Y = be(i), ee = be(c), B = C.useCallback(() => {
1085
- if (!R.current || !O.current)
1086
- return;
1087
- const S = {
1088
- placement: o,
1089
- strategy: t,
1090
- middleware: h
1091
- };
1092
- Y.current && (S.platform = Y.current), Ut(R.current, O.current, S).then((A) => {
1093
- const j = {
1094
- ...A,
1095
- // The floating element's position may be recomputed while it's closed
1096
- // but still mounted (such as when transitioning out). To ensure
1097
- // `isPositioned` will be `false` initially on the next open, avoid
1098
- // setting it to `true` when `open === false` (must be specified).
1099
- isPositioned: ee.current !== !1
1100
- };
1101
- N.current && !fe(z.current, j) && (z.current = j, st.flushSync(() => {
1102
- d(j);
1103
- }));
1104
- });
1105
- }, [h, o, t, Y, ee]);
1106
- se(() => {
1107
- c === !1 && z.current.isPositioned && (z.current.isPositioned = !1, d((S) => ({
1108
- ...S,
1109
- isPositioned: !1
1110
- })));
1111
- }, [c]);
1112
- const N = C.useRef(!1);
1113
- se(() => (N.current = !0, () => {
1114
- N.current = !1;
1115
- }), []), se(() => {
1116
- if (E && (R.current = E), b && (O.current = b), E && b) {
1117
- if (P.current)
1118
- return P.current(E, b, B);
1119
- B();
1120
- }
1121
- }, [E, b, B, P, K]);
1122
- const te = C.useMemo(() => ({
1123
- reference: R,
1124
- floating: O,
1125
- setReference: p,
1126
- setFloating: v
1127
- }), [p, v]), k = C.useMemo(() => ({
1128
- reference: E,
1129
- floating: b
1130
- }), [E, b]), V = C.useMemo(() => {
1131
- const S = {
1132
- position: t,
1133
- left: 0,
1134
- top: 0
1135
- };
1136
- if (!k.floating)
1137
- return S;
1138
- const A = _e(k.floating, u.x), j = _e(k.floating, u.y);
1139
- return l ? {
1140
- ...S,
1141
- transform: "translate(" + A + "px, " + j + "px)",
1142
- ...et(k.floating) >= 1.5 && {
1143
- willChange: "transform"
1144
- }
1145
- } : {
1146
- position: t,
1147
- left: A,
1148
- top: j
1149
- };
1150
- }, [t, l, k.floating, u.x, u.y]);
1151
- return C.useMemo(() => ({
1152
- ...u,
1153
- update: B,
1154
- refs: te,
1155
- elements: k,
1156
- floatingStyles: V
1157
- }), [u, B, te, k, V]);
1158
- }
1159
- const Kt = (e, o) => ({
1160
- ...jt(e),
1161
- options: [e, o]
1162
- }), Yt = (e, o) => ({
1163
- ...$t(e),
1164
- options: [e, o]
1165
- }), Xt = (e, o) => ({
1166
- ...Ht(e),
1167
- options: [e, o]
26
+ //#endregion
27
+ //#region packages/badge/index.tsx
28
+ function p({ variant: e, className: t, ...n }) {
29
+ return /* @__PURE__ */ s("span", {
30
+ ...n,
31
+ className: m({
32
+ variant: e,
33
+ className: t
34
+ })
35
+ });
36
+ }
37
+ var m = f("zen__badge inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors whitespace-nowrap", {
38
+ variants: { variant: {
39
+ default: "border-transparent bg-primary text-primary-foreground shadow-sm",
40
+ secondary: "border-transparent bg-secondary text-secondary-foreground",
41
+ destructive: "border-transparent bg-destructive text-destructive-foreground shadow-sm",
42
+ outline: "text-foreground"
43
+ } },
44
+ defaultVariants: { variant: "default" }
1168
45
  });
1169
- function Zt(e, o) {
1170
- return () => {
1171
- if (typeof document > "u")
1172
- return;
1173
- const t = (n) => {
1174
- !e.current || e.current.contains(n.target) || o(!0);
1175
- };
1176
- return document.addEventListener("mousedown", t), () => {
1177
- document.removeEventListener("mousedown", t);
1178
- };
1179
- };
1180
- }
1181
- function tt(e) {
1182
- const {
1183
- className: o,
1184
- placement: t = "bottom-start",
1185
- trigger: n = "hover",
1186
- content: i,
1187
- children: s,
1188
- onClose: r,
1189
- onOpen: l,
1190
- disabled: a = !1,
1191
- show: c = !1,
1192
- setShow: u,
1193
- role: d = "tooltip",
1194
- style: h,
1195
- ...f
1196
- } = e, [g, x] = de(c), w = () => u !== void 0 && c !== void 0 ? c : g, m = () => u !== void 0 && c !== void 0 ? u : x, { x: p, y: v, strategy: E, refs: b } = qt({
1197
- open: w(),
1198
- middleware: [Kt(4), Xt(), Yt()],
1199
- whileElementsMounted: Bt,
1200
- placement: t
1201
- }), R = it();
1202
- return re(
1203
- Zt(b.floating, (O) => {
1204
- O && m()(!1);
1205
- }),
1206
- []
1207
- ), /* @__PURE__ */ W(Ve, { children: [
1208
- /* @__PURE__ */ y(
1209
- "div",
1210
- {
1211
- className: "z-auto min-w-fit max-w-fit",
1212
- id: `zen__popover-${R}`,
1213
- ref: b.setReference,
1214
- onClick: (O) => {
1215
- if (n === "click") {
1216
- if (a)
1217
- return;
1218
- w() ? (m()(!1), r == null || r()) : (m()(!0), l == null || l());
1219
- }
1220
- O.stopPropagation();
1221
- },
1222
- role: d,
1223
- children: s
1224
- }
1225
- ),
1226
- w() && rt(
1227
- /* @__PURE__ */ y(
1228
- "div",
1229
- {
1230
- ...f,
1231
- onClick: (O) => O.stopPropagation(),
1232
- role: "tooltip",
1233
- className: M(
1234
- "zen__popover z-50 w-fit rounded border border-border bg-background shadow-secondary",
1235
- o
1236
- ),
1237
- ref: b.setFloating,
1238
- style: {
1239
- ...h,
1240
- position: E,
1241
- top: v ?? 0,
1242
- left: p ?? 0
1243
- },
1244
- children: i
1245
- }
1246
- ),
1247
- document.body
1248
- )
1249
- ] });
1250
- }
1251
- function Gt(e) {
1252
- var x, w;
1253
- const {
1254
- items: o = [],
1255
- children: t,
1256
- moreItemsLabel: n = "",
1257
- parentRef: i,
1258
- data: s,
1259
- estimator: r = (m, p) => p + 30,
1260
- font: l = "12px Inter",
1261
- badgeVariant: a = "secondary",
1262
- badgeStyles: c
1263
- } = e, [u, d] = de({
1264
- visible: o,
1265
- hidden: []
1266
- }), h = ve(() => {
1267
- if (typeof document > "u")
1268
- return null;
1269
- const p = document.createElement("canvas").getContext("2d");
1270
- return p && (p.font = l), p;
1271
- }, []), f = () => {
1272
- const m = i == null ? void 0 : i.current;
1273
- if (!m)
1274
- return;
1275
- const p = m.offsetWidth, v = [], E = [], b = r(
1276
- n,
1277
- ((h == null ? void 0 : h.measureText(n).width) ?? 0) + 10
1278
- );
1279
- g == null || g.reduce((R, O, z) => (R + O + b > p - 20 ? E.push(o[z]) : v.push(o[z]), R + O), 0), d({
1280
- visible: v,
1281
- hidden: E
1282
- });
1283
- }, g = ve(
1284
- () => (o == null ? void 0 : o.map((m) => r(m, (h == null ? void 0 : h.measureText(m).width) ?? 0))) ?? [],
1285
- [o]
1286
- );
1287
- return re(() => {
1288
- f();
1289
- }, [o]), re(() => {
1290
- if (!(i != null && i.current)) return;
1291
- const m = new ResizeObserver(() => {
1292
- f();
1293
- });
1294
- return m.observe(i.current), () => {
1295
- m.disconnect();
1296
- };
1297
- }, [o]), /* @__PURE__ */ W(Ve, { children: [
1298
- (x = u.visible) == null ? void 0 : x.map((m, p) => t(m, p, s == null ? void 0 : s[p])),
1299
- ((w = u.hidden) == null ? void 0 : w.length) > 0 && /* @__PURE__ */ y(
1300
- tt,
1301
- {
1302
- trigger: "click",
1303
- content: /* @__PURE__ */ y("div", { className: "grid max-h-60 grid-flow-row grid-cols-2 gap-3 overflow-auto p-2", children: u.hidden.map(
1304
- (m, p) => t(
1305
- m,
1306
- u.visible.length + p,
1307
- s == null ? void 0 : s[u.visible.length + p]
1308
- )
1309
- ) }),
1310
- children: /* @__PURE__ */ y(Be, { className: c, variant: a, children: /* @__PURE__ */ y("p", { children: `+${u.hidden.length} ${n}` }) }, "more_items_button")
1311
- }
1312
- )
1313
- ] });
1314
- }
1315
- function X(e, o, t) {
1316
- let n = t.initialDeps ?? [], i;
1317
- return () => {
1318
- var s, r, l, a;
1319
- let c;
1320
- t.key && ((s = t.debug) != null && s.call(t)) && (c = Date.now());
1321
- const u = e();
1322
- if (!(u.length !== n.length || u.some((f, g) => n[g] !== f)))
1323
- return i;
1324
- n = u;
1325
- let h;
1326
- if (t.key && ((r = t.debug) != null && r.call(t)) && (h = Date.now()), i = o(...u), t.key && ((l = t.debug) != null && l.call(t))) {
1327
- const f = Math.round((Date.now() - c) * 100) / 100, g = Math.round((Date.now() - h) * 100) / 100, x = g / 16, w = (m, p) => {
1328
- for (m = String(m); m.length < p; )
1329
- m = " " + m;
1330
- return m;
1331
- };
1332
- console.info(
1333
- `%c⏱ ${w(g, 5)} /${w(f, 5)} ms`,
1334
- `
46
+ //#endregion
47
+ //#region packages/button/index.tsx
48
+ function h({ className: e, variant: t, size: n, ...r }) {
49
+ return /* @__PURE__ */ s("button", {
50
+ className: g({
51
+ variant: t,
52
+ size: n,
53
+ className: e
54
+ }),
55
+ ...r
56
+ });
57
+ }
58
+ var g = f("zen__button inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", {
59
+ variants: {
60
+ variant: {
61
+ default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/70 active:bg-primary/90",
62
+ destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/70 active:bg-destructive",
63
+ outline: "border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground active:bg-accent",
64
+ secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/70 active:bg-secondary/90",
65
+ ghost: "hover:bg-accent hover:text-accent-foreground active:bg-accent",
66
+ link: "text-primary underline-offset-4 hover:underline active:underline",
67
+ icon: ""
68
+ },
69
+ size: {
70
+ default: "h-9 px-4 py-2",
71
+ sm: "h-8 rounded-md px-3 text-xs",
72
+ lg: "h-10 rounded-md px-8",
73
+ icon: ""
74
+ }
75
+ },
76
+ defaultVariants: {
77
+ variant: "default",
78
+ size: "default"
79
+ }
80
+ });
81
+ //#endregion
82
+ //#region packages/popover/index.tsx
83
+ function _(e) {
84
+ let { className: n, content: r, children: a, role: o = "tooltip", triggerType: l = "auto", trigger: d = "click", gap: f = "5px", show: p, setShow: m, style: h, ...g } = e, _ = crypto.randomUUID(), v = i(null);
85
+ return t(() => {
86
+ let t = v.current;
87
+ if (!t) return;
88
+ let n = () => e.onOpen?.(), r = () => e.onClose?.();
89
+ return t.addEventListener("popover:open", n), t.addEventListener("popover:close", r), () => {
90
+ t.removeEventListener("popover:open", n), t.removeEventListener("popover:close", r);
91
+ };
92
+ }, [e.onOpen, e.onClose]), t(() => {
93
+ l === "manual" && (p ? v.current?.showPopover?.() : v.current?.hidePopover?.());
94
+ }, [p, l]), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("div", {
95
+ className: "z-auto max-w-fit min-w-fit",
96
+ style: { "anchor-name": `--zen-popover-anchor-${_}` },
97
+ popoverTarget: `zen__popover-${_}`,
98
+ popoverTargetAction: "toggle",
99
+ onClick: d === "click" ? (e) => {
100
+ switch (e.stopPropagation(), e.nativeEvent.stopImmediatePropagation(), l) {
101
+ case "auto":
102
+ v.current?.togglePopover?.();
103
+ break;
104
+ case "manual":
105
+ m?.(!p);
106
+ break;
107
+ }
108
+ } : void 0,
109
+ onMouseEnter: d === "hover" ? (e) => {
110
+ e.stopPropagation(), v.current?.showPopover?.();
111
+ } : void 0,
112
+ onMouseLeave: d === "hover" ? (e) => {
113
+ e.stopPropagation(), v.current?.hidePopover?.();
114
+ } : void 0,
115
+ children: a
116
+ }), /* @__PURE__ */ s("div", {
117
+ ...g,
118
+ ref: v,
119
+ role: "tooltip",
120
+ popover: l,
121
+ id: `zen__popover-${_}`,
122
+ className: u("zen__popover border-border bg-background shadow-secondary fixed z-50 w-[anchor-size(width)] min-w-max [justify-self:anchor-center] rounded border [position-area:block-end_center]", n),
123
+ style: {
124
+ ...h,
125
+ "--gap": f,
126
+ top: "calc(anchor(bottom) + var(--gap))",
127
+ "position-anchor": `--zen-popover-anchor-${_}`
128
+ },
129
+ children: r
130
+ })] });
131
+ }
132
+ //#endregion
133
+ //#region packages/collapse/index.tsx
134
+ function v(e) {
135
+ let { items: n = [], children: i, moreItemsLabel: l = "", parentRef: u, data: d, estimator: f = (e, t) => t + 30, font: m = "12px Inter", badgeVariant: h = "secondary", badgeStyles: g } = e, [v, y] = a({
136
+ visible: n,
137
+ hidden: []
138
+ }), b = r(() => {
139
+ if (typeof document > "u") return null;
140
+ let e = document.createElement("canvas").getContext("2d");
141
+ return e && (e.font = m), e;
142
+ }, []), x = () => {
143
+ let e = u?.current;
144
+ if (!e) return;
145
+ let t = e.offsetWidth, r = [], i = [], a = f(l, (b?.measureText(l).width ?? 0) + 10);
146
+ S?.reduce((e, o, s) => (e + o + a > t - 20 ? i.push(n[s]) : r.push(n[s]), e + o), 0), y({
147
+ visible: r,
148
+ hidden: i
149
+ });
150
+ }, S = r(() => n?.map((e) => f(e, b?.measureText(e).width ?? 0)) ?? [], [n]);
151
+ return t(() => {
152
+ x();
153
+ }, [n]), t(() => {
154
+ if (!u?.current) return;
155
+ let e = new ResizeObserver(() => {
156
+ x();
157
+ });
158
+ return e.observe(u.current), () => {
159
+ e.disconnect();
160
+ };
161
+ }, [n]), /* @__PURE__ */ c(o, { children: [v.visible?.map((e, t) => i(e, t, d?.[t])), v.hidden?.length > 0 && /* @__PURE__ */ s(_, {
162
+ trigger: "click",
163
+ content: /* @__PURE__ */ s("div", {
164
+ className: "grid max-h-60 grid-flow-row grid-cols-2 gap-3 overflow-auto p-2",
165
+ children: v.hidden.map((e, t) => i(e, v.visible.length + t, d?.[v.visible.length + t]))
166
+ }),
167
+ children: /* @__PURE__ */ s(p, {
168
+ className: g,
169
+ variant: h,
170
+ children: /* @__PURE__ */ s("p", { children: `+${v.hidden.length} ${l}` })
171
+ }, "more_items_button")
172
+ })] });
173
+ }
174
+ //#endregion
175
+ //#region node_modules/.pnpm/@tanstack+virtual-core@3.14.0/node_modules/@tanstack/virtual-core/dist/esm/utils.js
176
+ function y(e, t, n) {
177
+ let r = n.initialDeps ?? [], i, a = !0;
178
+ function o() {
179
+ let o;
180
+ n.key && n.debug?.call(n) && (o = Date.now());
181
+ let s = e();
182
+ if (!(s.length !== r.length || s.some((e, t) => r[t] !== e))) return i;
183
+ r = s;
184
+ let c;
185
+ if (n.key && n.debug?.call(n) && (c = Date.now()), i = t(...s), n.key && n.debug?.call(n)) {
186
+ let e = Math.round((Date.now() - o) * 100) / 100, t = Math.round((Date.now() - c) * 100) / 100, r = t / 16, i = (e, t) => {
187
+ for (e = String(e); e.length < t;) e = " " + e;
188
+ return e;
189
+ };
190
+ console.info(`%c⏱ ${i(t, 5)} /${i(e, 5)} ms`, `
1335
191
  font-size: .6rem;
1336
192
  font-weight: bold;
1337
- color: hsl(${Math.max(
1338
- 0,
1339
- Math.min(120 - 120 * x, 120)
1340
- )}deg 100% 31%);`,
1341
- t == null ? void 0 : t.key
1342
- );
1343
- }
1344
- return (a = t == null ? void 0 : t.onChange) == null || a.call(t, i), i;
1345
- };
1346
- }
1347
- function ye(e, o) {
1348
- if (e === void 0)
1349
- throw new Error("Unexpected undefined");
1350
- return e;
1351
- }
1352
- const Jt = (e, o) => Math.abs(e - o) < 1, Qt = (e, o, t) => {
1353
- let n;
1354
- return function(...i) {
1355
- e.clearTimeout(n), n = e.setTimeout(() => o.apply(this, i), t);
1356
- };
1357
- }, en = (e) => e, tn = (e) => {
1358
- const o = Math.max(e.startIndex - e.overscan, 0), t = Math.min(e.endIndex + e.overscan, e.count - 1), n = [];
1359
- for (let i = o; i <= t; i++)
1360
- n.push(i);
1361
- return n;
1362
- }, nn = (e, o) => {
1363
- const t = e.scrollElement;
1364
- if (!t)
1365
- return;
1366
- const n = e.targetWindow;
1367
- if (!n)
1368
- return;
1369
- const i = (r) => {
1370
- const { width: l, height: a } = r;
1371
- o({ width: Math.round(l), height: Math.round(a) });
1372
- };
1373
- if (i(t.getBoundingClientRect()), !n.ResizeObserver)
1374
- return () => {
1375
- };
1376
- const s = new n.ResizeObserver((r) => {
1377
- const l = () => {
1378
- const a = r[0];
1379
- if (a != null && a.borderBoxSize) {
1380
- const c = a.borderBoxSize[0];
1381
- if (c) {
1382
- i({ width: c.inlineSize, height: c.blockSize });
1383
- return;
1384
- }
1385
- }
1386
- i(t.getBoundingClientRect());
1387
- };
1388
- e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(l) : l();
1389
- });
1390
- return s.observe(t, { box: "border-box" }), () => {
1391
- s.unobserve(t);
1392
- };
1393
- }, De = {
1394
- passive: !0
1395
- }, Fe = typeof window > "u" ? !0 : "onscrollend" in window, on = (e, o) => {
1396
- const t = e.scrollElement;
1397
- if (!t)
1398
- return;
1399
- const n = e.targetWindow;
1400
- if (!n)
1401
- return;
1402
- let i = 0;
1403
- const s = e.options.useScrollendEvent && Fe ? () => {
1404
- } : Qt(
1405
- n,
1406
- () => {
1407
- o(i, !1);
1408
- },
1409
- e.options.isScrollingResetDelay
1410
- ), r = (u) => () => {
1411
- const { horizontal: d, isRtl: h } = e.options;
1412
- i = d ? t.scrollLeft * (h && -1 || 1) : t.scrollTop, s(), o(i, u);
1413
- }, l = r(!0), a = r(!1);
1414
- a(), t.addEventListener("scroll", l, De);
1415
- const c = e.options.useScrollendEvent && Fe;
1416
- return c && t.addEventListener("scrollend", a, De), () => {
1417
- t.removeEventListener("scroll", l), c && t.removeEventListener("scrollend", a);
1418
- };
1419
- }, sn = (e, o, t) => {
1420
- if (o != null && o.borderBoxSize) {
1421
- const n = o.borderBoxSize[0];
1422
- if (n)
1423
- return Math.round(
1424
- n[t.options.horizontal ? "inlineSize" : "blockSize"]
1425
- );
1426
- }
1427
- return Math.round(
1428
- e.getBoundingClientRect()[t.options.horizontal ? "width" : "height"]
1429
- );
1430
- }, rn = (e, {
1431
- adjustments: o = 0,
1432
- behavior: t
1433
- }, n) => {
1434
- var i, s;
1435
- const r = e + o;
1436
- (s = (i = n.scrollElement) == null ? void 0 : i.scrollTo) == null || s.call(i, {
1437
- [n.options.horizontal ? "left" : "top"]: r,
1438
- behavior: t
1439
- });
1440
- };
1441
- class ln {
1442
- constructor(o) {
1443
- this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollToIndexTimeoutId = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
1444
- let t = null;
1445
- const n = () => t || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : t = new this.targetWindow.ResizeObserver((i) => {
1446
- i.forEach((s) => {
1447
- const r = () => {
1448
- this._measureElement(s.target, s);
1449
- };
1450
- this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
1451
- });
1452
- }));
1453
- return {
1454
- disconnect: () => {
1455
- var i;
1456
- (i = n()) == null || i.disconnect(), t = null;
1457
- },
1458
- observe: (i) => {
1459
- var s;
1460
- return (s = n()) == null ? void 0 : s.observe(i, { box: "border-box" });
1461
- },
1462
- unobserve: (i) => {
1463
- var s;
1464
- return (s = n()) == null ? void 0 : s.unobserve(i);
1465
- }
1466
- };
1467
- })(), this.range = null, this.setOptions = (t) => {
1468
- Object.entries(t).forEach(([n, i]) => {
1469
- typeof i > "u" && delete t[n];
1470
- }), this.options = {
1471
- debug: !1,
1472
- initialOffset: 0,
1473
- overscan: 1,
1474
- paddingStart: 0,
1475
- paddingEnd: 0,
1476
- scrollPaddingStart: 0,
1477
- scrollPaddingEnd: 0,
1478
- horizontal: !1,
1479
- getItemKey: en,
1480
- rangeExtractor: tn,
1481
- onChange: () => {
1482
- },
1483
- measureElement: sn,
1484
- initialRect: { width: 0, height: 0 },
1485
- scrollMargin: 0,
1486
- gap: 0,
1487
- indexAttribute: "data-index",
1488
- initialMeasurementsCache: [],
1489
- lanes: 1,
1490
- isScrollingResetDelay: 150,
1491
- enabled: !0,
1492
- isRtl: !1,
1493
- useScrollendEvent: !0,
1494
- useAnimationFrameWithResizeObserver: !1,
1495
- ...t
1496
- };
1497
- }, this.notify = (t) => {
1498
- var n, i;
1499
- (i = (n = this.options).onChange) == null || i.call(n, this, t);
1500
- }, this.maybeNotify = X(
1501
- () => (this.calculateRange(), [
1502
- this.isScrolling,
1503
- this.range ? this.range.startIndex : null,
1504
- this.range ? this.range.endIndex : null
1505
- ]),
1506
- (t) => {
1507
- this.notify(t);
1508
- },
1509
- {
1510
- key: process.env.NODE_ENV !== "production" && "maybeNotify",
1511
- debug: () => this.options.debug,
1512
- initialDeps: [
1513
- this.isScrolling,
1514
- this.range ? this.range.startIndex : null,
1515
- this.range ? this.range.endIndex : null
1516
- ]
1517
- }
1518
- ), this.cleanup = () => {
1519
- this.unsubs.filter(Boolean).forEach((t) => t()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null;
1520
- }, this._didMount = () => () => {
1521
- this.cleanup();
1522
- }, this._willUpdate = () => {
1523
- var t;
1524
- const n = this.options.enabled ? this.options.getScrollElement() : null;
1525
- if (this.scrollElement !== n) {
1526
- if (this.cleanup(), !n) {
1527
- this.maybeNotify();
1528
- return;
1529
- }
1530
- this.scrollElement = n, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((t = this.scrollElement) == null ? void 0 : t.window) ?? null, this.elementsCache.forEach((i) => {
1531
- this.observer.observe(i);
1532
- }), this._scrollToOffset(this.getScrollOffset(), {
1533
- adjustments: void 0,
1534
- behavior: void 0
1535
- }), this.unsubs.push(
1536
- this.options.observeElementRect(this, (i) => {
1537
- this.scrollRect = i, this.maybeNotify();
1538
- })
1539
- ), this.unsubs.push(
1540
- this.options.observeElementOffset(this, (i, s) => {
1541
- this.scrollAdjustments = 0, this.scrollDirection = s ? this.getScrollOffset() < i ? "forward" : "backward" : null, this.scrollOffset = i, this.isScrolling = s, this.maybeNotify();
1542
- })
1543
- );
1544
- }
1545
- }, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (t, n) => {
1546
- const i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
1547
- for (let r = n - 1; r >= 0; r--) {
1548
- const l = t[r];
1549
- if (i.has(l.lane))
1550
- continue;
1551
- const a = s.get(
1552
- l.lane
1553
- );
1554
- if (a == null || l.end > a.end ? s.set(l.lane, l) : l.end < a.end && i.set(l.lane, !0), i.size === this.options.lanes)
1555
- break;
1556
- }
1557
- return s.size === this.options.lanes ? Array.from(s.values()).sort((r, l) => r.end === l.end ? r.index - l.index : r.end - l.end)[0] : void 0;
1558
- }, this.getMeasurementOptions = X(
1559
- () => [
1560
- this.options.count,
1561
- this.options.paddingStart,
1562
- this.options.scrollMargin,
1563
- this.options.getItemKey,
1564
- this.options.enabled
1565
- ],
1566
- (t, n, i, s, r) => (this.pendingMeasuredCacheIndexes = [], {
1567
- count: t,
1568
- paddingStart: n,
1569
- scrollMargin: i,
1570
- getItemKey: s,
1571
- enabled: r
1572
- }),
1573
- {
1574
- key: !1
1575
- }
1576
- ), this.getMeasurements = X(
1577
- () => [this.getMeasurementOptions(), this.itemSizeCache],
1578
- ({ count: t, paddingStart: n, scrollMargin: i, getItemKey: s, enabled: r }, l) => {
1579
- if (!r)
1580
- return this.measurementsCache = [], this.itemSizeCache.clear(), [];
1581
- this.measurementsCache.length === 0 && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((u) => {
1582
- this.itemSizeCache.set(u.key, u.size);
1583
- }));
1584
- const a = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
1585
- this.pendingMeasuredCacheIndexes = [];
1586
- const c = this.measurementsCache.slice(0, a);
1587
- for (let u = a; u < t; u++) {
1588
- const d = s(u), h = this.options.lanes === 1 ? c[u - 1] : this.getFurthestMeasurement(c, u), f = h ? h.end + this.options.gap : n + i, g = l.get(d), x = typeof g == "number" ? g : this.options.estimateSize(u), w = f + x, m = h ? h.lane : u % this.options.lanes;
1589
- c[u] = {
1590
- index: u,
1591
- start: f,
1592
- size: x,
1593
- end: w,
1594
- key: d,
1595
- lane: m
1596
- };
1597
- }
1598
- return this.measurementsCache = c, c;
1599
- },
1600
- {
1601
- key: process.env.NODE_ENV !== "production" && "getMeasurements",
1602
- debug: () => this.options.debug
1603
- }
1604
- ), this.calculateRange = X(
1605
- () => [
1606
- this.getMeasurements(),
1607
- this.getSize(),
1608
- this.getScrollOffset(),
1609
- this.options.lanes
1610
- ],
1611
- (t, n, i, s) => this.range = t.length > 0 && n > 0 ? cn({
1612
- measurements: t,
1613
- outerSize: n,
1614
- scrollOffset: i,
1615
- lanes: s
1616
- }) : null,
1617
- {
1618
- key: process.env.NODE_ENV !== "production" && "calculateRange",
1619
- debug: () => this.options.debug
1620
- }
1621
- ), this.getVirtualIndexes = X(
1622
- () => {
1623
- let t = null, n = null;
1624
- const i = this.calculateRange();
1625
- return i && (t = i.startIndex, n = i.endIndex), [
1626
- this.options.rangeExtractor,
1627
- this.options.overscan,
1628
- this.options.count,
1629
- t,
1630
- n
1631
- ];
1632
- },
1633
- (t, n, i, s, r) => s === null || r === null ? [] : t({
1634
- startIndex: s,
1635
- endIndex: r,
1636
- overscan: n,
1637
- count: i
1638
- }),
1639
- {
1640
- key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
1641
- debug: () => this.options.debug
1642
- }
1643
- ), this.indexFromElement = (t) => {
1644
- const n = this.options.indexAttribute, i = t.getAttribute(n);
1645
- return i ? parseInt(i, 10) : (console.warn(
1646
- `Missing attribute name '${n}={index}' on measured element.`
1647
- ), -1);
1648
- }, this._measureElement = (t, n) => {
1649
- const i = this.indexFromElement(t), s = this.measurementsCache[i];
1650
- if (!s)
1651
- return;
1652
- const r = s.key, l = this.elementsCache.get(r);
1653
- l !== t && (l && this.observer.unobserve(l), this.observer.observe(t), this.elementsCache.set(r, t)), t.isConnected && this.resizeItem(i, this.options.measureElement(t, n, this));
1654
- }, this.resizeItem = (t, n) => {
1655
- const i = this.measurementsCache[t];
1656
- if (!i)
1657
- return;
1658
- const s = this.itemSizeCache.get(i.key) ?? i.size, r = n - s;
1659
- r !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(i, r, this) : i.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", r), this._scrollToOffset(this.getScrollOffset(), {
1660
- adjustments: this.scrollAdjustments += r,
1661
- behavior: void 0
1662
- })), this.pendingMeasuredCacheIndexes.push(i.index), this.itemSizeCache = new Map(this.itemSizeCache.set(i.key, n)), this.notify(!1));
1663
- }, this.measureElement = (t) => {
1664
- if (!t) {
1665
- this.elementsCache.forEach((n, i) => {
1666
- n.isConnected || (this.observer.unobserve(n), this.elementsCache.delete(i));
1667
- });
1668
- return;
1669
- }
1670
- this._measureElement(t, void 0);
1671
- }, this.getVirtualItems = X(
1672
- () => [this.getVirtualIndexes(), this.getMeasurements()],
1673
- (t, n) => {
1674
- const i = [];
1675
- for (let s = 0, r = t.length; s < r; s++) {
1676
- const l = t[s], a = n[l];
1677
- i.push(a);
1678
- }
1679
- return i;
1680
- },
1681
- {
1682
- key: process.env.NODE_ENV !== "production" && "getVirtualItems",
1683
- debug: () => this.options.debug
1684
- }
1685
- ), this.getVirtualItemForOffset = (t) => {
1686
- const n = this.getMeasurements();
1687
- if (n.length !== 0)
1688
- return ye(
1689
- n[nt(
1690
- 0,
1691
- n.length - 1,
1692
- (i) => ye(n[i]).start,
1693
- t
1694
- )]
1695
- );
1696
- }, this.getOffsetForAlignment = (t, n, i = 0) => {
1697
- const s = this.getSize(), r = this.getScrollOffset();
1698
- n === "auto" && (n = t >= r + s ? "end" : "start"), n === "center" ? t += (i - s) / 2 : n === "end" && (t -= s);
1699
- const l = this.options.horizontal ? "scrollWidth" : "scrollHeight", c = (this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[l] : this.scrollElement[l] : 0) - s;
1700
- return Math.max(Math.min(c, t), 0);
1701
- }, this.getOffsetForIndex = (t, n = "auto") => {
1702
- t = Math.max(0, Math.min(t, this.options.count - 1));
1703
- const i = this.measurementsCache[t];
1704
- if (!i)
1705
- return;
1706
- const s = this.getSize(), r = this.getScrollOffset();
1707
- if (n === "auto")
1708
- if (i.end >= r + s - this.options.scrollPaddingEnd)
1709
- n = "end";
1710
- else if (i.start <= r + this.options.scrollPaddingStart)
1711
- n = "start";
1712
- else
1713
- return [r, n];
1714
- const l = n === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
1715
- return [
1716
- this.getOffsetForAlignment(l, n, i.size),
1717
- n
1718
- ];
1719
- }, this.isDynamicMode = () => this.elementsCache.size > 0, this.cancelScrollToIndex = () => {
1720
- this.scrollToIndexTimeoutId !== null && this.targetWindow && (this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId), this.scrollToIndexTimeoutId = null);
1721
- }, this.scrollToOffset = (t, { align: n = "start", behavior: i } = {}) => {
1722
- this.cancelScrollToIndex(), i === "smooth" && this.isDynamicMode() && console.warn(
1723
- "The `smooth` scroll behavior is not fully supported with dynamic size."
1724
- ), this._scrollToOffset(this.getOffsetForAlignment(t, n), {
1725
- adjustments: void 0,
1726
- behavior: i
1727
- });
1728
- }, this.scrollToIndex = (t, { align: n = "auto", behavior: i } = {}) => {
1729
- t = Math.max(0, Math.min(t, this.options.count - 1)), this.cancelScrollToIndex(), i === "smooth" && this.isDynamicMode() && console.warn(
1730
- "The `smooth` scroll behavior is not fully supported with dynamic size."
1731
- );
1732
- const s = this.getOffsetForIndex(t, n);
1733
- if (!s) return;
1734
- const [r, l] = s;
1735
- this._scrollToOffset(r, { adjustments: void 0, behavior: i }), i !== "smooth" && this.isDynamicMode() && this.targetWindow && (this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
1736
- if (this.scrollToIndexTimeoutId = null, this.elementsCache.has(
1737
- this.options.getItemKey(t)
1738
- )) {
1739
- const [c] = ye(
1740
- this.getOffsetForIndex(t, l)
1741
- );
1742
- Jt(c, this.getScrollOffset()) || this.scrollToIndex(t, { align: l, behavior: i });
1743
- } else
1744
- this.scrollToIndex(t, { align: l, behavior: i });
1745
- }));
1746
- }, this.scrollBy = (t, { behavior: n } = {}) => {
1747
- this.cancelScrollToIndex(), n === "smooth" && this.isDynamicMode() && console.warn(
1748
- "The `smooth` scroll behavior is not fully supported with dynamic size."
1749
- ), this._scrollToOffset(this.getScrollOffset() + t, {
1750
- adjustments: void 0,
1751
- behavior: n
1752
- });
1753
- }, this.getTotalSize = () => {
1754
- var t;
1755
- const n = this.getMeasurements();
1756
- let i;
1757
- return n.length === 0 ? i = this.options.paddingStart : i = this.options.lanes === 1 ? ((t = n[n.length - 1]) == null ? void 0 : t.end) ?? 0 : Math.max(
1758
- ...n.slice(-this.options.lanes).map((s) => s.end)
1759
- ), Math.max(
1760
- i - this.options.scrollMargin + this.options.paddingEnd,
1761
- 0
1762
- );
1763
- }, this._scrollToOffset = (t, {
1764
- adjustments: n,
1765
- behavior: i
1766
- }) => {
1767
- this.options.scrollToFn(t, { behavior: i, adjustments: n }, this);
1768
- }, this.measure = () => {
1769
- this.itemSizeCache = /* @__PURE__ */ new Map(), this.notify(!1);
1770
- }, this.setOptions(o);
1771
- }
1772
- }
1773
- const nt = (e, o, t, n) => {
1774
- for (; e <= o; ) {
1775
- const i = (e + o) / 2 | 0, s = t(i);
1776
- if (s < n)
1777
- e = i + 1;
1778
- else if (s > n)
1779
- o = i - 1;
1780
- else
1781
- return i;
1782
- }
1783
- return e > 0 ? e - 1 : 0;
193
+ color: hsl(${Math.max(0, Math.min(120 - 120 * r, 120))}deg 100% 31%);`, n?.key);
194
+ }
195
+ return n?.onChange && !(a && n.skipInitialOnChange) && n.onChange(i), a = !1, i;
196
+ }
197
+ return o.updateDeps = (e) => {
198
+ r = e;
199
+ }, o;
200
+ }
201
+ function b(e, t) {
202
+ if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
203
+ return e;
204
+ }
205
+ var x = (e, t) => Math.abs(e - t) < 1.01, S = (e, t, n) => {
206
+ let r;
207
+ return function(...i) {
208
+ e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
209
+ };
210
+ }, C = (e) => {
211
+ let { offsetWidth: t, offsetHeight: n } = e;
212
+ return {
213
+ width: t,
214
+ height: n
215
+ };
216
+ }, w = (e) => e, T = (e) => {
217
+ let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1), r = [];
218
+ for (let e = t; e <= n; e++) r.push(e);
219
+ return r;
220
+ }, E = (e, t) => {
221
+ let n = e.scrollElement;
222
+ if (!n) return;
223
+ let r = e.targetWindow;
224
+ if (!r) return;
225
+ let i = (e) => {
226
+ let { width: n, height: r } = e;
227
+ t({
228
+ width: Math.round(n),
229
+ height: Math.round(r)
230
+ });
231
+ };
232
+ if (i(C(n)), !r.ResizeObserver) return () => {};
233
+ let a = new r.ResizeObserver((t) => {
234
+ let r = () => {
235
+ let e = t[0];
236
+ if (e?.borderBoxSize) {
237
+ let t = e.borderBoxSize[0];
238
+ if (t) {
239
+ i({
240
+ width: t.inlineSize,
241
+ height: t.blockSize
242
+ });
243
+ return;
244
+ }
245
+ }
246
+ i(C(n));
247
+ };
248
+ e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
249
+ });
250
+ return a.observe(n, { box: "border-box" }), () => {
251
+ a.unobserve(n);
252
+ };
253
+ }, D = { passive: !0 }, O = typeof window > "u" ? !0 : "onscrollend" in window, k = (e, t) => {
254
+ let n = e.scrollElement;
255
+ if (!n) return;
256
+ let r = e.targetWindow;
257
+ if (!r) return;
258
+ let i = 0, a = e.options.useScrollendEvent && O ? () => void 0 : S(r, () => {
259
+ t(i, !1);
260
+ }, e.options.isScrollingResetDelay), o = (r) => () => {
261
+ let { horizontal: o, isRtl: s } = e.options;
262
+ i = o ? n.scrollLeft * (s && -1 || 1) : n.scrollTop, a(), t(i, r);
263
+ }, s = o(!0), c = o(!1);
264
+ n.addEventListener("scroll", s, D);
265
+ let l = e.options.useScrollendEvent && O;
266
+ return l && n.addEventListener("scrollend", c, D), () => {
267
+ n.removeEventListener("scroll", s), l && n.removeEventListener("scrollend", c);
268
+ };
269
+ }, A = (e, t, n) => {
270
+ if (t?.borderBoxSize) {
271
+ let e = t.borderBoxSize[0];
272
+ if (e) return Math.round(e[n.options.horizontal ? "inlineSize" : "blockSize"]);
273
+ }
274
+ return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
275
+ }, j = (e, { adjustments: t = 0, behavior: n }, r) => {
276
+ var i, a;
277
+ let o = e + t;
278
+ (a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
279
+ [r.options.horizontal ? "left" : "top"]: o,
280
+ behavior: n
281
+ });
282
+ }, M = class {
283
+ constructor(e) {
284
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => {
285
+ var e;
286
+ return ((e = this.targetWindow?.performance)?.now)?.call(e) ?? Date.now();
287
+ }, this.observer = /* @__PURE__ */ (() => {
288
+ let e = null, t = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((e) => {
289
+ e.forEach((e) => {
290
+ let t = () => {
291
+ let t = e.target, n = this.indexFromElement(t);
292
+ if (!t.isConnected) {
293
+ this.observer.unobserve(t);
294
+ return;
295
+ }
296
+ this.shouldMeasureDuringScroll(n) && this.resizeItem(n, this.options.measureElement(t, e, this));
297
+ };
298
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(t) : t();
299
+ });
300
+ }));
301
+ return {
302
+ disconnect: () => {
303
+ var n;
304
+ (n = t()) == null || n.disconnect(), e = null;
305
+ },
306
+ observe: (e) => t()?.observe(e, { box: "border-box" }),
307
+ unobserve: (e) => t()?.unobserve(e)
308
+ };
309
+ })(), this.range = null, this.setOptions = (e) => {
310
+ Object.entries(e).forEach(([t, n]) => {
311
+ n === void 0 && delete e[t];
312
+ }), this.options = {
313
+ debug: !1,
314
+ initialOffset: 0,
315
+ overscan: 1,
316
+ paddingStart: 0,
317
+ paddingEnd: 0,
318
+ scrollPaddingStart: 0,
319
+ scrollPaddingEnd: 0,
320
+ horizontal: !1,
321
+ getItemKey: w,
322
+ rangeExtractor: T,
323
+ onChange: () => {},
324
+ measureElement: A,
325
+ initialRect: {
326
+ width: 0,
327
+ height: 0
328
+ },
329
+ scrollMargin: 0,
330
+ gap: 0,
331
+ indexAttribute: "data-index",
332
+ initialMeasurementsCache: [],
333
+ lanes: 1,
334
+ isScrollingResetDelay: 150,
335
+ enabled: !0,
336
+ isRtl: !1,
337
+ useScrollendEvent: !1,
338
+ useAnimationFrameWithResizeObserver: !1,
339
+ laneAssignmentMode: "estimate",
340
+ ...e
341
+ };
342
+ }, this.notify = (e) => {
343
+ var t, n;
344
+ (n = (t = this.options).onChange) == null || n.call(t, this, e);
345
+ }, this.maybeNotify = y(() => (this.calculateRange(), [
346
+ this.isScrolling,
347
+ this.range ? this.range.startIndex : null,
348
+ this.range ? this.range.endIndex : null
349
+ ]), (e) => {
350
+ this.notify(e);
351
+ }, {
352
+ key: process.env.NODE_ENV !== "production" && "maybeNotify",
353
+ debug: () => this.options.debug,
354
+ initialDeps: [
355
+ this.isScrolling,
356
+ this.range ? this.range.startIndex : null,
357
+ this.range ? this.range.endIndex : null
358
+ ]
359
+ }), this.cleanup = () => {
360
+ this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.rafId != null && this.targetWindow && (this.targetWindow.cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollState = null, this.scrollElement = null, this.targetWindow = null;
361
+ }, this._didMount = () => () => {
362
+ this.cleanup();
363
+ }, this._willUpdate = () => {
364
+ let e = this.options.enabled ? this.options.getScrollElement() : null;
365
+ if (this.scrollElement !== e) {
366
+ if (this.cleanup(), !e) {
367
+ this.maybeNotify();
368
+ return;
369
+ }
370
+ this.scrollElement = e, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = this.scrollElement?.window ?? null, this.elementsCache.forEach((e) => {
371
+ this.observer.observe(e);
372
+ }), this.unsubs.push(this.options.observeElementRect(this, (e) => {
373
+ this.scrollRect = e, this.maybeNotify();
374
+ })), this.unsubs.push(this.options.observeElementOffset(this, (e, t) => {
375
+ this.scrollAdjustments = 0, this.scrollDirection = t ? this.getScrollOffset() < e ? "forward" : "backward" : null, this.scrollOffset = e, this.isScrolling = t, this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify();
376
+ })), this._scrollToOffset(this.getScrollOffset(), {
377
+ adjustments: void 0,
378
+ behavior: void 0
379
+ });
380
+ }
381
+ }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, t) => {
382
+ let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
383
+ for (let i = t - 1; i >= 0; i--) {
384
+ let t = e[i];
385
+ if (n.has(t.lane)) continue;
386
+ let a = r.get(t.lane);
387
+ if (a == null || t.end > a.end ? r.set(t.lane, t) : t.end < a.end && n.set(t.lane, !0), n.size === this.options.lanes) break;
388
+ }
389
+ return r.size === this.options.lanes ? Array.from(r.values()).sort((e, t) => e.end === t.end ? e.index - t.index : e.end - t.end)[0] : void 0;
390
+ }, this.getMeasurementOptions = y(() => [
391
+ this.options.count,
392
+ this.options.paddingStart,
393
+ this.options.scrollMargin,
394
+ this.options.getItemKey,
395
+ this.options.enabled,
396
+ this.options.lanes,
397
+ this.options.laneAssignmentMode
398
+ ], (e, t, n, r, i, a, o) => (this.prevLanes !== void 0 && this.prevLanes !== a && (this.lanesChangedFlag = !0), this.prevLanes = a, this.pendingMeasuredCacheIndexes = [], {
399
+ count: e,
400
+ paddingStart: t,
401
+ scrollMargin: n,
402
+ getItemKey: r,
403
+ enabled: i,
404
+ lanes: a,
405
+ laneAssignmentMode: o
406
+ }), { key: !1 }), this.getMeasurements = y(() => [this.getMeasurementOptions(), this.itemSizeCache], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o }, s) => {
407
+ if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
408
+ if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
409
+ this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => {
410
+ this.itemSizeCache.set(e.key, e.size);
411
+ }));
412
+ let c = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
413
+ this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
414
+ let l = this.measurementsCache.slice(0, c), u = Array(a).fill(void 0);
415
+ for (let e = 0; e < c; e++) {
416
+ let t = l[e];
417
+ t && (u[t.lane] = e);
418
+ }
419
+ for (let i = c; i < e; i++) {
420
+ let e = r(i), a = this.laneAssignments.get(i), c, d, f = o === "estimate" || s.has(e);
421
+ if (a !== void 0 && this.options.lanes > 1) {
422
+ c = a;
423
+ let e = u[c], r = e === void 0 ? void 0 : l[e];
424
+ d = r ? r.end + this.options.gap : t + n;
425
+ } else {
426
+ let e = this.options.lanes === 1 ? l[i - 1] : this.getFurthestMeasurement(l, i);
427
+ d = e ? e.end + this.options.gap : t + n, c = e ? e.lane : i % this.options.lanes, this.options.lanes > 1 && f && this.laneAssignments.set(i, c);
428
+ }
429
+ let p = s.get(e), m = typeof p == "number" ? p : this.options.estimateSize(i), h = d + m;
430
+ l[i] = {
431
+ index: i,
432
+ start: d,
433
+ size: m,
434
+ end: h,
435
+ key: e,
436
+ lane: c
437
+ }, u[c] = i;
438
+ }
439
+ return this.measurementsCache = l, l;
440
+ }, {
441
+ key: process.env.NODE_ENV !== "production" && "getMeasurements",
442
+ debug: () => this.options.debug
443
+ }), this.calculateRange = y(() => [
444
+ this.getMeasurements(),
445
+ this.getSize(),
446
+ this.getScrollOffset(),
447
+ this.options.lanes
448
+ ], (e, t, n, r) => this.range = e.length > 0 && t > 0 ? P({
449
+ measurements: e,
450
+ outerSize: t,
451
+ scrollOffset: n,
452
+ lanes: r
453
+ }) : null, {
454
+ key: process.env.NODE_ENV !== "production" && "calculateRange",
455
+ debug: () => this.options.debug
456
+ }), this.getVirtualIndexes = y(() => {
457
+ let e = null, t = null, n = this.calculateRange();
458
+ return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
459
+ this.isScrolling,
460
+ e,
461
+ t
462
+ ]), [
463
+ this.options.rangeExtractor,
464
+ this.options.overscan,
465
+ this.options.count,
466
+ e,
467
+ t
468
+ ];
469
+ }, (e, t, n, r, i) => r === null || i === null ? [] : e({
470
+ startIndex: r,
471
+ endIndex: i,
472
+ overscan: t,
473
+ count: n
474
+ }), {
475
+ key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
476
+ debug: () => this.options.debug
477
+ }), this.indexFromElement = (e) => {
478
+ let t = this.options.indexAttribute, n = e.getAttribute(t);
479
+ return n ? parseInt(n, 10) : (console.warn(`Missing attribute name '${t}={index}' on measured element.`), -1);
480
+ }, this.shouldMeasureDuringScroll = (e) => {
481
+ if (!this.scrollState || this.scrollState.behavior !== "smooth") return !0;
482
+ let t = this.scrollState.index ?? this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;
483
+ if (t !== void 0 && this.range) {
484
+ let n = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2)), r = Math.max(0, t - n), i = Math.min(this.options.count - 1, t + n);
485
+ return e >= r && e <= i;
486
+ }
487
+ return !0;
488
+ }, this.measureElement = (e) => {
489
+ if (!e) {
490
+ this.elementsCache.forEach((e, t) => {
491
+ e.isConnected || (this.observer.unobserve(e), this.elementsCache.delete(t));
492
+ });
493
+ return;
494
+ }
495
+ let t = this.indexFromElement(e), n = this.options.getItemKey(t), r = this.elementsCache.get(n);
496
+ r !== e && (r && this.observer.unobserve(r), this.observer.observe(e), this.elementsCache.set(n, e)), (!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(t) && this.resizeItem(t, this.options.measureElement(e, void 0, this));
497
+ }, this.resizeItem = (e, t) => {
498
+ let n = this.measurementsCache[e];
499
+ if (!n) return;
500
+ let r = t - (this.itemSizeCache.get(n.key) ?? n.size);
501
+ r !== 0 && (this.scrollState?.behavior !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange === void 0 ? n.start < this.getScrollOffset() + this.scrollAdjustments : this.shouldAdjustScrollPositionOnItemSizeChange(n, r, this)) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", r), this._scrollToOffset(this.getScrollOffset(), {
502
+ adjustments: this.scrollAdjustments += r,
503
+ behavior: void 0
504
+ })), this.pendingMeasuredCacheIndexes.push(n.index), this.itemSizeCache = new Map(this.itemSizeCache.set(n.key, t)), this.notify(!1));
505
+ }, this.getVirtualItems = y(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => {
506
+ let n = [];
507
+ for (let r = 0, i = e.length; r < i; r++) {
508
+ let i = t[e[r]];
509
+ n.push(i);
510
+ }
511
+ return n;
512
+ }, {
513
+ key: process.env.NODE_ENV !== "production" && "getVirtualItems",
514
+ debug: () => this.options.debug
515
+ }), this.getVirtualItemForOffset = (e) => {
516
+ let t = this.getMeasurements();
517
+ if (t.length !== 0) return b(t[N(0, t.length - 1, (e) => b(t[e]).start, e)]);
518
+ }, this.getMaxScrollOffset = () => {
519
+ if (!this.scrollElement) return 0;
520
+ if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
521
+ {
522
+ let e = this.scrollElement.document.documentElement;
523
+ return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight;
524
+ }
525
+ }, this.getOffsetForAlignment = (e, t, n = 0) => {
526
+ if (!this.scrollElement) return 0;
527
+ let r = this.getSize(), i = this.getScrollOffset();
528
+ t === "auto" && (t = e >= i + r ? "end" : "start"), t === "center" ? e += (n - r) / 2 : t === "end" && (e -= r);
529
+ let a = this.getMaxScrollOffset();
530
+ return Math.max(Math.min(a, e), 0);
531
+ }, this.getOffsetForIndex = (e, t = "auto") => {
532
+ e = Math.max(0, Math.min(e, this.options.count - 1));
533
+ let n = this.getSize(), r = this.getScrollOffset(), i = this.measurementsCache[e];
534
+ if (!i) return;
535
+ if (t === "auto") if (i.end >= r + n - this.options.scrollPaddingEnd) t = "end";
536
+ else if (i.start <= r + this.options.scrollPaddingStart) t = "start";
537
+ else return [r, t];
538
+ if (t === "end" && e === this.options.count - 1) return [this.getMaxScrollOffset(), t];
539
+ let a = t === "end" ? i.end + this.options.scrollPaddingEnd : i.start - this.options.scrollPaddingStart;
540
+ return [this.getOffsetForAlignment(a, t, i.size), t];
541
+ }, this.scrollToOffset = (e, { align: t = "start", behavior: n = "auto" } = {}) => {
542
+ let r = this.getOffsetForAlignment(e, t), i = this.now();
543
+ this.scrollState = {
544
+ index: null,
545
+ align: t,
546
+ behavior: n,
547
+ startedAt: i,
548
+ lastTargetOffset: r,
549
+ stableFrames: 0
550
+ }, this._scrollToOffset(r, {
551
+ adjustments: void 0,
552
+ behavior: n
553
+ }), this.scheduleScrollReconcile();
554
+ }, this.scrollToIndex = (e, { align: t = "auto", behavior: n = "auto" } = {}) => {
555
+ e = Math.max(0, Math.min(e, this.options.count - 1));
556
+ let r = this.getOffsetForIndex(e, t);
557
+ if (!r) return;
558
+ let [i, a] = r, o = this.now();
559
+ this.scrollState = {
560
+ index: e,
561
+ align: a,
562
+ behavior: n,
563
+ startedAt: o,
564
+ lastTargetOffset: i,
565
+ stableFrames: 0
566
+ }, this._scrollToOffset(i, {
567
+ adjustments: void 0,
568
+ behavior: n
569
+ }), this.scheduleScrollReconcile();
570
+ }, this.scrollBy = (e, { behavior: t = "auto" } = {}) => {
571
+ let n = this.getScrollOffset() + e, r = this.now();
572
+ this.scrollState = {
573
+ index: null,
574
+ align: "start",
575
+ behavior: t,
576
+ startedAt: r,
577
+ lastTargetOffset: n,
578
+ stableFrames: 0
579
+ }, this._scrollToOffset(n, {
580
+ adjustments: void 0,
581
+ behavior: t
582
+ }), this.scheduleScrollReconcile();
583
+ }, this.getTotalSize = () => {
584
+ let e = this.getMeasurements(), t;
585
+ if (e.length === 0) t = this.options.paddingStart;
586
+ else if (this.options.lanes === 1) t = e[e.length - 1]?.end ?? 0;
587
+ else {
588
+ let n = Array(this.options.lanes).fill(null), r = e.length - 1;
589
+ for (; r >= 0 && n.some((e) => e === null);) {
590
+ let t = e[r];
591
+ n[t.lane] === null && (n[t.lane] = t.end), r--;
592
+ }
593
+ t = Math.max(...n.filter((e) => e !== null));
594
+ }
595
+ return Math.max(t - this.options.scrollMargin + this.options.paddingEnd, 0);
596
+ }, this._scrollToOffset = (e, { adjustments: t, behavior: n }) => {
597
+ this.options.scrollToFn(e, {
598
+ behavior: n,
599
+ adjustments: t
600
+ }, this);
601
+ }, this.measure = () => {
602
+ this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.notify(!1);
603
+ }, this.setOptions(e);
604
+ }
605
+ scheduleScrollReconcile() {
606
+ if (!this.targetWindow) {
607
+ this.scrollState = null;
608
+ return;
609
+ }
610
+ this.rafId ??= this.targetWindow.requestAnimationFrame(() => {
611
+ this.rafId = null, this.reconcileScroll();
612
+ });
613
+ }
614
+ reconcileScroll() {
615
+ if (!this.scrollState || !this.scrollElement) return;
616
+ if (this.now() - this.scrollState.startedAt > 5e3) {
617
+ this.scrollState = null;
618
+ return;
619
+ }
620
+ let e = this.scrollState.index == null ? void 0 : this.getOffsetForIndex(this.scrollState.index, this.scrollState.align), t = e ? e[0] : this.scrollState.lastTargetOffset, n = t !== this.scrollState.lastTargetOffset;
621
+ if (!n && x(t, this.getScrollOffset())) {
622
+ if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) {
623
+ this.scrollState = null;
624
+ return;
625
+ }
626
+ } else this.scrollState.stableFrames = 0, n && (this.scrollState.lastTargetOffset = t, this.scrollState.behavior = "auto", this._scrollToOffset(t, {
627
+ adjustments: void 0,
628
+ behavior: "auto"
629
+ }));
630
+ this.scheduleScrollReconcile();
631
+ }
632
+ }, N = (e, t, n, r) => {
633
+ for (; e <= t;) {
634
+ let i = (e + t) / 2 | 0, a = n(i);
635
+ if (a < r) e = i + 1;
636
+ else if (a > r) t = i - 1;
637
+ else return i;
638
+ }
639
+ return e > 0 ? e - 1 : 0;
1784
640
  };
1785
- function cn({
1786
- measurements: e,
1787
- outerSize: o,
1788
- scrollOffset: t,
1789
- lanes: n
1790
- }) {
1791
- const i = e.length - 1;
1792
- let r = nt(
1793
- 0,
1794
- i,
1795
- (a) => e[a].start,
1796
- t
1797
- ), l = r;
1798
- for (; l < i && e[l].end < t + o; )
1799
- l++;
1800
- return n > 1 && (r = Math.max(0, r - r % n), l = Math.min(i, l + (n - 1 - l % n))), { startIndex: r, endIndex: l };
1801
- }
1802
- const Pe = typeof document < "u" ? C.useLayoutEffect : C.useEffect;
1803
- function an(e) {
1804
- const o = C.useReducer(() => ({}), {})[1], t = {
1805
- ...e,
1806
- onChange: (i, s) => {
1807
- var r;
1808
- s ? lt(o) : o(), (r = e.onChange) == null || r.call(e, i, s);
1809
- }
1810
- }, [n] = C.useState(
1811
- () => new ln(t)
1812
- );
1813
- return n.setOptions(t), Pe(() => n._didMount(), []), Pe(() => n._willUpdate()), n;
1814
- }
1815
- function un(e) {
1816
- return an({
1817
- observeElementRect: nn,
1818
- observeElementOffset: on,
1819
- scrollToFn: rn,
1820
- ...e
1821
- });
641
+ function P({ measurements: e, outerSize: t, scrollOffset: n, lanes: r }) {
642
+ let i = e.length - 1, a = (t) => e[t].start;
643
+ if (e.length <= r) return {
644
+ startIndex: 0,
645
+ endIndex: i
646
+ };
647
+ let o = N(0, i, a, n), s = o;
648
+ if (r === 1) for (; s < i && e[s].end < n + t;) s++;
649
+ else if (r > 1) {
650
+ let a = Array(r).fill(0);
651
+ for (; s < i && a.some((e) => e < n + t);) {
652
+ let t = e[s];
653
+ a[t.lane] = t.end, s++;
654
+ }
655
+ let c = Array(r).fill(n + t);
656
+ for (; o >= 0 && c.some((e) => e >= n);) {
657
+ let t = e[o];
658
+ c[t.lane] = t.start, o--;
659
+ }
660
+ o = Math.max(0, o - o % r), s = Math.min(i, s + (r - 1 - s % r));
661
+ }
662
+ return {
663
+ startIndex: o,
664
+ endIndex: s
665
+ };
666
+ }
667
+ //#endregion
668
+ //#region node_modules/.pnpm/@tanstack+react-virtual@3.13.24_react-dom@19.2.5_react@19.2.5__react@19.2.5/node_modules/@tanstack/react-virtual/dist/esm/index.js
669
+ var F = typeof document < "u" ? e.useLayoutEffect : e.useEffect;
670
+ function I({ useFlushSync: t = !0, ...n }) {
671
+ let r = e.useReducer(() => ({}), {})[1], i = {
672
+ ...n,
673
+ onChange: (e, i) => {
674
+ var a;
675
+ t && i ? l(r) : r(), (a = n.onChange) == null || a.call(n, e, i);
676
+ }
677
+ }, [a] = e.useState(() => new M(i));
678
+ return a.setOptions(i), F(() => a._didMount(), []), F(() => a._willUpdate()), a;
1822
679
  }
1823
- function fn(e) {
1824
- return /* @__PURE__ */ y(
1825
- "svg",
1826
- {
1827
- xmlns: "http://www.w3.org/2000/svg",
1828
- fill: "none",
1829
- viewBox: "0 0 24 24",
1830
- strokeWidth: 1.5,
1831
- stroke: "currentColor",
1832
- className: "h-6 w-6",
1833
- ...e,
1834
- children: /* @__PURE__ */ y("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m19.5 8.25-7.5 7.5-7.5-7.5" })
1835
- }
1836
- );
1837
- }
1838
- function dn(e) {
1839
- return /* @__PURE__ */ y(
1840
- "svg",
1841
- {
1842
- xmlns: "http://www.w3.org/2000/svg",
1843
- fill: "none",
1844
- viewBox: "0 0 24 24",
1845
- strokeWidth: 1.5,
1846
- stroke: "currentColor",
1847
- className: "h-6 w-6",
1848
- ...e,
1849
- children: /* @__PURE__ */ y(
1850
- "path",
1851
- {
1852
- strokeLinecap: "round",
1853
- strokeLinejoin: "round",
1854
- d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"
1855
- }
1856
- )
1857
- }
1858
- );
1859
- }
1860
- function hn(e) {
1861
- return /* @__PURE__ */ y(
1862
- "svg",
1863
- {
1864
- xmlns: "http://www.w3.org/2000/svg",
1865
- fill: "none",
1866
- viewBox: "0 0 24 24",
1867
- strokeWidth: 1.5,
1868
- stroke: "currentColor",
1869
- className: "h-6 w-6",
1870
- ...e,
1871
- children: /* @__PURE__ */ y("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18 18 6M6 6l12 12" })
1872
- }
1873
- );
1874
- }
1875
- function wn(e) {
1876
- var g;
1877
- const {
1878
- items: o,
1879
- selected: t,
1880
- className: n,
1881
- onChange: i,
1882
- disabled: s,
1883
- placeholder: r = "Select an Item",
1884
- multiple: l,
1885
- mutable: a,
1886
- onAdd: c
1887
- } = e, u = Ee(null), [d, h] = de(!1), f = Ee(null);
1888
- return /* @__PURE__ */ y(
1889
- tt,
1890
- {
1891
- placement: "bottom",
1892
- trigger: "click",
1893
- show: d,
1894
- setShow: h,
1895
- role: "combobox",
1896
- disabled: s,
1897
- style: {
1898
- "--input-width": `${(g = f.current) == null ? void 0 : g.offsetWidth}px`
1899
- },
1900
- content: /* @__PURE__ */ y(
1901
- mn,
1902
- {
1903
- ...a ? { mutable: a, onAdd: c } : { mutable: a },
1904
- ...l ? { multiple: l, items: o, onChange: i, selected: t } : { items: o, onChange: i, selected: t }
1905
- }
1906
- ),
1907
- children: /* @__PURE__ */ W(
1908
- "div",
1909
- {
1910
- className: M(
1911
- "inline-flex h-10 w-56 grow items-center justify-between rounded border-2 border-input bg-background p-2 transition",
1912
- s ? "cursor-not-allowed bg-muted text-muted" : "cursor-pointer",
1913
- d && "border-primary shadow-xs shadow-ring",
1914
- n
1915
- ),
1916
- ref: f,
1917
- children: [
1918
- /* @__PURE__ */ y(
1919
- "div",
1920
- {
1921
- className: M(
1922
- "flex max-w-[calc(100%-30px)] flex-none grow items-center gap-1 text-sm",
1923
- s ? "text-muted-foreground" : "text-foreground"
1924
- ),
1925
- ref: u,
1926
- children: l ? /* @__PURE__ */ y(
1927
- Gt,
1928
- {
1929
- items: t.map((x) => x.text),
1930
- data: t,
1931
- parentRef: u,
1932
- estimator: (x, w) => w + 40,
1933
- badgeVariant: "secondary",
1934
- badgeStyles: "bg-input! h-6 min-w-min gap-2 bg-input!",
1935
- children: (x, w, m) => /* @__PURE__ */ W(
1936
- Be,
1937
- {
1938
- className: "flex h-6 min-w-min gap-2 bg-input! pr-1",
1939
- variant: "secondary",
1940
- children: [
1941
- x,
1942
- /* @__PURE__ */ y(
1943
- at,
1944
- {
1945
- onClick: () => {
1946
- i(t.filter((p) => p.key !== (m == null ? void 0 : m.key)));
1947
- },
1948
- variant: "icon",
1949
- size: "icon",
1950
- className: "group bg-muted p-0.5 hover:bg-muted-foreground",
1951
- children: /* @__PURE__ */ y(hn, { className: "size-3 transition duration-300 group-hover:rotate-90 group-hover:text-muted" })
1952
- }
1953
- )
1954
- ]
1955
- },
1956
- `collapsed_item_${w}`
1957
- )
1958
- }
1959
- ) : t.text ?? r
1960
- }
1961
- ),
1962
- /* @__PURE__ */ y(
1963
- fn,
1964
- {
1965
- className: M(
1966
- "size-4 rounded-full bg-input p-0.5 transition duration-300 ease-in-out",
1967
- d ? "rotate-180" : "rotate-0",
1968
- s ? "text-muted-foreground" : "text-foreground"
1969
- )
1970
- }
1971
- )
1972
- ]
1973
- }
1974
- )
1975
- }
1976
- );
1977
- }
1978
- function mn(e) {
1979
- const { items: o, multiple: t, selected: n, onChange: i, mutable: s, onAdd: r } = e, [l, a] = de(""), c = Ee(null), u = ve(
1980
- () => o.reduce((f, g) => ((!l.length || g.text.toLowerCase().includes(l.toLowerCase())) && f.push(g), f), []),
1981
- [o, l]
1982
- ), d = un({
1983
- count: u.length,
1984
- getScrollElement: () => c.current,
1985
- estimateSize: () => 35
1986
- }), h = n instanceof Array ? n.map((f) => f.key) : [n.key];
1987
- return /* @__PURE__ */ W("div", { className: "flex min-w-[var(--input-width)] flex-col divide-y-2 divide-border overflow-hidden rounded border border-input bg-background", children: [
1988
- /* @__PURE__ */ W("div", { className: M("inline-flex grow items-center rounded px-3 py-2"), children: [
1989
- /* @__PURE__ */ y(dn, { className: "left-3 top-3 mr-2 size-4 text-muted-foreground" }),
1990
- /* @__PURE__ */ y(
1991
- "input",
1992
- {
1993
- className: "inline-flex grow bg-transparent text-sm text-foreground outline-hidden",
1994
- placeholder: "Search",
1995
- value: l,
1996
- onChange: (f) => a(f.target.value)
1997
- }
1998
- )
1999
- ] }),
2000
- /* @__PURE__ */ W(
2001
- "ul",
2002
- {
2003
- className: M("max-h-60 grow overflow-auto shadow-sm", "focus:outline-hidden focus:ring-0"),
2004
- ref: c,
2005
- children: [
2006
- /* @__PURE__ */ y(
2007
- "div",
2008
- {
2009
- style: {
2010
- height: `${d.getTotalSize()}px`,
2011
- width: "100%",
2012
- position: "relative"
2013
- },
2014
- children: d.getVirtualItems().map((f) => /* @__PURE__ */ y(
2015
- "li",
2016
- {
2017
- style: {
2018
- height: `${f.size}px`,
2019
- transform: `translateY(${f.start}px)`
2020
- },
2021
- className: M(
2022
- "absolute left-0 top-0 w-full cursor-pointer px-3 py-2 text-sm text-foreground",
2023
- h.includes(u[f.index].key) ? "bg-primary/90 text-primary-foreground" : "transition hover:bg-primary/60"
2024
- ),
2025
- onClick: () => {
2026
- t ? h.includes(u[f.index].key) ? i(
2027
- structuredClone(
2028
- n.filter(
2029
- (g) => g.key !== u[f.index].key
2030
- )
2031
- )
2032
- ) : i(structuredClone([...n, u[f.index]])) : i(u[f.index]);
2033
- },
2034
- children: u[f.index].text
2035
- },
2036
- f.key
2037
- ))
2038
- }
2039
- ),
2040
- l.length > 0 && u.length === 0 && (s ? /* @__PURE__ */ W(
2041
- "li",
2042
- {
2043
- className: M("px-3 py-2 text-sm text-foreground"),
2044
- onClick: () => {
2045
- r({ text: l, key: l }), a("");
2046
- },
2047
- children: [
2048
- "Add ",
2049
- l
2050
- ]
2051
- }
2052
- ) : /* @__PURE__ */ y("li", { className: M("cursor-not-allowed px-3 py-2 text-sm text-foreground"), children: "No results found" }))
2053
- ]
2054
- }
2055
- )
2056
- ] });
2057
- }
2058
- function bn(e) {
2059
- return /* @__PURE__ */ y(
2060
- "svg",
2061
- {
2062
- xmlns: "http://www.w3.org/2000/svg",
2063
- fill: "none",
2064
- viewBox: "0 0 24 24",
2065
- strokeWidth: 1.5,
2066
- stroke: "currentColor",
2067
- className: "h-6 w-6",
2068
- ...e,
2069
- children: /* @__PURE__ */ y("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m4.5 15.75 7.5-7.5 7.5 7.5" })
2070
- }
2071
- );
2072
- }
2073
- function yn(e) {
2074
- const { className: o, ...t } = e;
2075
- return /* @__PURE__ */ y(
2076
- "input",
2077
- {
2078
- className: M(
2079
- "h-10 w-full rounded border-2 border-input bg-background px-3 py-2 text-sm text-foreground transition",
2080
- "focus-visible:border-primary focus-visible:shadow-xs focus-visible:shadow-ring focus-visible:outline-hidden",
2081
- "read-only:cursor-pointer read-only:border-none! read-only:bg-transparent read-only:text-foreground read-only:shadow-none! read-only:outline-hidden!",
2082
- "disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted",
2083
- "file:border-0 file:bg-transparent file:text-sm file:font-medium",
2084
- o
2085
- ),
2086
- ...t
2087
- }
2088
- );
2089
- }
2090
- function vn(e) {
2091
- const { className: o, checked: t, onChange: n, defaultChecked: i, ...s } = e;
2092
- return /* @__PURE__ */ W(
2093
- "div",
2094
- {
2095
- className: M(
2096
- "rounded-full",
2097
- "h-5 w-10",
2098
- "border border-muted bg-secondary",
2099
- "flex items-center",
2100
- o
2101
- ),
2102
- onClick: () => n == null ? void 0 : n(!t),
2103
- children: [
2104
- /* @__PURE__ */ y("input", { type: "hidden", readOnly: !0, ...s, defaultChecked: i, checked: t }),
2105
- /* @__PURE__ */ y(
2106
- "div",
2107
- {
2108
- className: M(
2109
- "[animation-timing-function:cubic-bezier(1, 0, 0, 1)] duration-250 h-4 w-4 rounded-full bg-primary transition-all",
2110
- t ? "translate-x-5" : "translate-x-1"
2111
- )
2112
- }
2113
- )
2114
- ]
2115
- }
2116
- );
2117
- }
2118
- function En(e) {
2119
- const { className: o, ...t } = e;
2120
- return /* @__PURE__ */ y(
2121
- "textarea",
2122
- {
2123
- className: M(
2124
- "border-input bg-background text-foreground h-10 w-full rounded border-2 px-3 py-2 text-sm transition",
2125
- "focus-visible:border-primary focus-visible:shadow-ring focus-visible:shadow-xs focus-visible:outline-hidden",
2126
- "read-only:text-foreground read-only:cursor-pointer read-only:border-none! read-only:bg-transparent read-only:shadow-none! read-only:outline-hidden!",
2127
- "disabled:bg-muted disabled:text-muted disabled:cursor-not-allowed",
2128
- "file:border-0 file:bg-transparent file:text-sm file:font-medium",
2129
- o
2130
- ),
2131
- ...t
2132
- }
2133
- );
2134
- }
2135
- export {
2136
- Be as Badge,
2137
- at as Button,
2138
- bn as ChevronDown,
2139
- fn as ChevronUp,
2140
- Gt as Collapse,
2141
- wn as Dropdown,
2142
- yn as Input,
2143
- tt as Popover,
2144
- dn as Search,
2145
- En as TextArea,
2146
- vn as Toggle,
2147
- We as cva,
2148
- M as cx
2149
- };
680
+ function L(e) {
681
+ return I({
682
+ observeElementRect: E,
683
+ observeElementOffset: k,
684
+ scrollToFn: j,
685
+ ...e
686
+ });
687
+ }
688
+ //#endregion
689
+ //#region packages/icons/chevron-up.tsx
690
+ function R(e) {
691
+ return /* @__PURE__ */ s("svg", {
692
+ xmlns: "http://www.w3.org/2000/svg",
693
+ fill: "none",
694
+ viewBox: "0 0 24 24",
695
+ strokeWidth: 1.5,
696
+ stroke: "currentColor",
697
+ className: "h-6 w-6",
698
+ ...e,
699
+ children: /* @__PURE__ */ s("path", {
700
+ strokeLinecap: "round",
701
+ strokeLinejoin: "round",
702
+ d: "m19.5 8.25-7.5 7.5-7.5-7.5"
703
+ })
704
+ });
705
+ }
706
+ //#endregion
707
+ //#region packages/icons/search.tsx
708
+ function z(e) {
709
+ return /* @__PURE__ */ s("svg", {
710
+ xmlns: "http://www.w3.org/2000/svg",
711
+ fill: "none",
712
+ viewBox: "0 0 24 24",
713
+ strokeWidth: 1.5,
714
+ stroke: "currentColor",
715
+ className: "h-6 w-6",
716
+ ...e,
717
+ children: /* @__PURE__ */ s("path", {
718
+ strokeLinecap: "round",
719
+ strokeLinejoin: "round",
720
+ d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"
721
+ })
722
+ });
723
+ }
724
+ //#endregion
725
+ //#region packages/icons/x-mark.tsx
726
+ function B(e) {
727
+ return /* @__PURE__ */ s("svg", {
728
+ xmlns: "http://www.w3.org/2000/svg",
729
+ fill: "none",
730
+ viewBox: "0 0 24 24",
731
+ strokeWidth: 1.5,
732
+ stroke: "currentColor",
733
+ className: "h-6 w-6",
734
+ ...e,
735
+ children: /* @__PURE__ */ s("path", {
736
+ strokeLinecap: "round",
737
+ strokeLinejoin: "round",
738
+ d: "M6 18 18 6M6 6l12 12"
739
+ })
740
+ });
741
+ }
742
+ //#endregion
743
+ //#region packages/dropdown/index.tsx
744
+ function V(e) {
745
+ let { items: t, selected: r, className: o, onChange: l, disabled: d, placeholder: f = "Select an Item", multiple: m, mutable: g, onAdd: y } = e, b = i(null), [x, S] = a(!1);
746
+ return i(null), n(), /* @__PURE__ */ s(_, {
747
+ content: /* @__PURE__ */ s(H, {
748
+ ...g ? {
749
+ mutable: g,
750
+ onAdd: y
751
+ } : { mutable: g },
752
+ ...m ? {
753
+ multiple: m,
754
+ items: t,
755
+ onChange: l,
756
+ selected: r
757
+ } : {
758
+ items: t,
759
+ onChange: l,
760
+ selected: r
761
+ }
762
+ }),
763
+ children: /* @__PURE__ */ c("div", {
764
+ className: u("border-input bg-background inline-flex h-10 w-56 grow items-center justify-between rounded border-2 p-2 transition", d ? "bg-muted text-muted cursor-not-allowed" : "cursor-pointer", x && "border-primary", o),
765
+ children: [/* @__PURE__ */ s("div", {
766
+ className: u("flex max-w-[calc(100%-30px)] flex-none grow items-center gap-1 text-sm", d ? "text-muted-foreground" : "text-foreground"),
767
+ ref: b,
768
+ children: m ? /* @__PURE__ */ s(v, {
769
+ items: r.map((e) => e.text),
770
+ data: r,
771
+ parentRef: b,
772
+ estimator: (e, t) => t + 40,
773
+ badgeVariant: "secondary",
774
+ badgeStyles: "bg-input! h-6 min-w-min gap-2 bg-input!",
775
+ children: (e, t, n) => /* @__PURE__ */ c(p, {
776
+ className: "bg-input! flex h-6 min-w-min gap-2 pr-1",
777
+ variant: "secondary",
778
+ children: [e, /* @__PURE__ */ s(h, {
779
+ onClick: () => {
780
+ l(r.filter((e) => e.key !== n?.key));
781
+ },
782
+ variant: "icon",
783
+ size: "icon",
784
+ className: "group bg-muted hover:bg-muted-foreground p-0.5",
785
+ children: /* @__PURE__ */ s(B, { className: "group-hover:text-muted size-3 transition duration-300 group-hover:rotate-90" })
786
+ })]
787
+ }, `collapsed_item_${n?.key ?? t}`)
788
+ }) : r.text ?? f
789
+ }), /* @__PURE__ */ s(R, { className: u("bg-input size-4 rounded-full p-0.5 transition duration-300 ease-in-out", x ? "rotate-180" : "rotate-0", d ? "text-muted-foreground" : "text-foreground") })]
790
+ })
791
+ });
792
+ }
793
+ function H(e) {
794
+ let { items: t, multiple: n, selected: o, onChange: l, mutable: d, onAdd: f } = e, [p, m] = a(""), h = i(null), g = r(() => t.reduce((e, t) => ((!p.length || t.text.toLowerCase().includes(p.toLowerCase())) && e.push(t), e), []), [t, p]), _ = L({
795
+ count: g.length,
796
+ getScrollElement: () => h.current,
797
+ estimateSize: () => 35
798
+ }), v = o instanceof Array ? o.map((e) => e.key) : [o.key];
799
+ return /* @__PURE__ */ c("div", {
800
+ className: "divide-border border-input bg-background w-full flex-col divide-y-2 overflow-hidden rounded border",
801
+ children: [/* @__PURE__ */ c("div", {
802
+ className: u("flex grow items-center rounded px-3 py-2"),
803
+ children: [/* @__PURE__ */ s(z, { className: "text-muted-foreground top-3 left-3 mr-2 size-4" }), /* @__PURE__ */ s("input", {
804
+ className: "text-foreground inline-flex grow bg-transparent text-sm outline-hidden",
805
+ placeholder: "Search",
806
+ value: p,
807
+ onChange: (e) => m(e.target.value)
808
+ })]
809
+ }), /* @__PURE__ */ c("ul", {
810
+ className: u("max-h-60 grow overflow-auto shadow-sm", "focus:ring-0 focus:outline-hidden"),
811
+ ref: h,
812
+ children: [/* @__PURE__ */ s("div", {
813
+ style: {
814
+ height: `${_.getTotalSize()}px`,
815
+ width: "100%",
816
+ position: "relative"
817
+ },
818
+ children: _.getVirtualItems().map((e) => /* @__PURE__ */ s("li", {
819
+ style: {
820
+ height: `${e.size}px`,
821
+ transform: `translateY(${e.start}px)`
822
+ },
823
+ className: u("text-foreground absolute top-0 left-0 w-full cursor-pointer px-3 py-2 text-sm transition", v.includes(g[e.index].key) ? "bg-primary/90 text-primary-foreground dark:text-foreground" : "hover:bg-primary/60 hover:text-primary-foreground dark:hover:text-foreground"),
824
+ onClick: () => {
825
+ n ? v.includes(g[e.index].key) ? l(structuredClone(o.filter((t) => t.key !== g[e.index].key))) : l(structuredClone([...o, g[e.index]])) : l(g[e.index]);
826
+ },
827
+ children: g[e.index].text
828
+ }, e.key))
829
+ }), p.length > 0 && g.length === 0 && (d ? /* @__PURE__ */ c("li", {
830
+ className: u("text-foreground px-3 py-2 text-sm"),
831
+ onClick: () => {
832
+ f({
833
+ text: p,
834
+ key: p
835
+ }), m("");
836
+ },
837
+ children: ["Add ", p]
838
+ }) : /* @__PURE__ */ s("li", {
839
+ className: u("text-foreground cursor-not-allowed px-3 py-2 text-sm"),
840
+ children: "No results found"
841
+ }))]
842
+ })]
843
+ });
844
+ }
845
+ //#endregion
846
+ //#region packages/icons/chevron-down.tsx
847
+ function U(e) {
848
+ return /* @__PURE__ */ s("svg", {
849
+ xmlns: "http://www.w3.org/2000/svg",
850
+ fill: "none",
851
+ viewBox: "0 0 24 24",
852
+ strokeWidth: 1.5,
853
+ stroke: "currentColor",
854
+ className: "h-6 w-6",
855
+ ...e,
856
+ children: /* @__PURE__ */ s("path", {
857
+ strokeLinecap: "round",
858
+ strokeLinejoin: "round",
859
+ d: "m4.5 15.75 7.5-7.5 7.5 7.5"
860
+ })
861
+ });
862
+ }
863
+ //#endregion
864
+ //#region packages/input/index.tsx
865
+ function W(e) {
866
+ let { className: t, ...n } = e;
867
+ return /* @__PURE__ */ s("input", {
868
+ className: u("border-input bg-background text-foreground h-10 w-full rounded border-2 px-3 py-2 text-sm transition", "focus-visible:border-primary focus-visible:shadow-ring focus-visible:outline-hidden", "active:border-primary active:shadow-ring active:outline-hidden", "read-only:text-foreground read-only:cursor-pointer read-only:border-none! read-only:bg-transparent read-only:shadow-none! read-only:outline-hidden!", "disabled:bg-muted disabled:text-muted disabled:cursor-not-allowed", "file:border-0 file:bg-transparent file:text-sm file:font-medium", "[[type=\"checkbox\"]]:accent-primary [[type=\"checkbox\"]]:h-4 [[type=\"checkbox\"]]:w-4 [[type=\"checkbox\"]]:rounded-sm", "[[type=\"radio\"]]:accent-primary [[type=\"radio\"]]:h-4 [[type=\"radio\"]]:w-4", t),
869
+ ...n
870
+ });
871
+ }
872
+ //#endregion
873
+ //#region packages/textarea/index.tsx
874
+ function G(e) {
875
+ let { className: t, ...n } = e;
876
+ return /* @__PURE__ */ s("textarea", {
877
+ className: u("border-input bg-background text-foreground h-30 w-full rounded border-2 px-3 py-2 text-sm transition", "focus-visible:border-primary focus-visible:shadow-ring focus-visible:shadow-xs focus-visible:outline-hidden", "read-only:text-foreground read-only:cursor-pointer read-only:border-none! read-only:bg-transparent read-only:shadow-none! read-only:outline-hidden!", "disabled:bg-muted disabled:text-muted disabled:cursor-not-allowed", "file:border-0 file:bg-transparent file:text-sm file:font-medium", t),
878
+ ...n
879
+ });
880
+ }
881
+ //#endregion
882
+ //#region packages/toggle/index.tsx
883
+ function K(e) {
884
+ let { className: t, checked: n, onChange: r, defaultChecked: i, ...a } = e;
885
+ return /* @__PURE__ */ c("div", {
886
+ className: u("rounded-full", "h-5 w-10", "border-primary dark:bg-primary-foreground bg-secondary border", "flex items-center", t),
887
+ onClick: () => r?.(!n),
888
+ children: [/* @__PURE__ */ s("input", {
889
+ type: "hidden",
890
+ ...a,
891
+ readOnly: !0,
892
+ className: "peer/toggle",
893
+ defaultChecked: i,
894
+ checked: n
895
+ }), /* @__PURE__ */ s("div", { className: u("[animation-timing-function:cubic-bezier(1, 0, 0, 1)] bg-primary size-4 rounded-full transition-all duration-250", n ? "translate-x-5" : "translate-x-0.5") })]
896
+ });
897
+ }
898
+ //#endregion
899
+ export { p as Badge, h as Button, U as ChevronDown, R as ChevronUp, v as Collapse, V as Dropdown, W as Input, _ as Popover, z as Search, G as TextArea, K as Toggle, f as cva, u as cx };