@arcadeai/design-system 3.33.1 → 3.34.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 (65) hide show
  1. package/dist/assets/icons/daytona.js +6 -6
  2. package/dist/components/index.js +595 -567
  3. package/dist/components/ui/atoms/avatar-notification-badge.d.ts +34 -0
  4. package/dist/components/ui/atoms/avatar-notification-badge.d.ts.map +1 -0
  5. package/dist/components/ui/atoms/avatar-notification-badge.js +78 -0
  6. package/dist/components/ui/atoms/command.js +288 -364
  7. package/dist/components/ui/atoms/copy-button.d.ts.map +1 -1
  8. package/dist/components/ui/atoms/copy-button.js +3 -2
  9. package/dist/components/ui/atoms/dropdown-menu.js +1 -1
  10. package/dist/components/ui/atoms/hover-card.js +1 -1
  11. package/dist/components/ui/atoms/icons/daytona.d.ts.map +1 -1
  12. package/dist/components/ui/atoms/icons/daytona.js +9 -14
  13. package/dist/components/ui/atoms/index.d.ts +3 -0
  14. package/dist/components/ui/atoms/index.d.ts.map +1 -1
  15. package/dist/components/ui/atoms/index.js +512 -504
  16. package/dist/components/ui/atoms/json-highlight.d.ts +60 -0
  17. package/dist/components/ui/atoms/json-highlight.d.ts.map +1 -0
  18. package/dist/components/ui/atoms/json-highlight.js +77 -0
  19. package/dist/components/ui/atoms/markdown.js +1 -1
  20. package/dist/components/ui/atoms/popover.js +1 -1
  21. package/dist/components/ui/atoms/scroll-button.js +8 -8
  22. package/dist/components/ui/atoms/select.js +1 -1
  23. package/dist/components/ui/atoms/tooltip.js +1 -1
  24. package/dist/components/ui/atoms/view-tools-control.d.ts +1 -1
  25. package/dist/components/ui/atoms/view-tools-control.d.ts.map +1 -1
  26. package/dist/components/ui/atoms/view-tools-control.js +20 -19
  27. package/dist/components/ui/index.js +595 -567
  28. package/dist/components/ui/molecules/chat-message-list.d.ts +5 -2
  29. package/dist/components/ui/molecules/chat-message-list.d.ts.map +1 -1
  30. package/dist/components/ui/molecules/chat-message-list.js +2 -2
  31. package/dist/components/ui/molecules/index.d.ts +8 -0
  32. package/dist/components/ui/molecules/index.d.ts.map +1 -1
  33. package/dist/components/ui/molecules/index.js +48 -28
  34. package/dist/components/ui/molecules/message.js +1 -1
  35. package/dist/components/ui/molecules/prompt-input.js +20 -20
  36. package/dist/components/ui/molecules/requirement-badges.js +9 -5
  37. package/dist/components/ui/molecules/switcher.d.ts +83 -0
  38. package/dist/components/ui/molecules/switcher.d.ts.map +1 -0
  39. package/dist/components/ui/molecules/switcher.js +164 -0
  40. package/dist/components/ui/molecules/tool-authorization.d.ts +56 -0
  41. package/dist/components/ui/molecules/tool-authorization.d.ts.map +1 -0
  42. package/dist/components/ui/molecules/tool-authorization.js +160 -0
  43. package/dist/components/ui/molecules/tool-call-accordion.d.ts +36 -0
  44. package/dist/components/ui/molecules/tool-call-accordion.d.ts.map +1 -0
  45. package/dist/components/ui/molecules/tool-call-accordion.js +301 -0
  46. package/dist/components/ui/molecules/toolkit-card.js +1 -1
  47. package/dist/components/ui/molecules/user-nav.d.ts +65 -0
  48. package/dist/components/ui/molecules/user-nav.d.ts.map +1 -0
  49. package/dist/components/ui/molecules/user-nav.js +154 -0
  50. package/dist/components/ui/pages/chat-page.d.ts +18 -10
  51. package/dist/components/ui/pages/chat-page.d.ts.map +1 -1
  52. package/dist/components/ui/pages/chat-page.js +328 -243
  53. package/dist/components/ui/templates/chat-template.d.ts +1 -1
  54. package/dist/components/ui/templates/chat-template.d.ts.map +1 -1
  55. package/dist/components/ui/templates/chat-template.js +11 -11
  56. package/dist/highlighted-body-TPN3WLV5-DyOGcftJ.js +19 -0
  57. package/dist/index-BEZCAdXQ.js +1568 -0
  58. package/dist/main.js +621 -593
  59. package/dist/{markdown-ChximrBv.js → markdown-9KGBuupR.js} +6264 -6046
  60. package/dist/mermaid-O7DHMXV3-CUp9wvRi.js +4 -0
  61. package/dist/{toolkit-card-Cb-KDQhU.js → toolkit-card-DAgQXF93.js} +14 -11
  62. package/package.json +1 -1
  63. package/dist/highlighted-body-B3W2YXNL-D6XBJnwx.js +0 -19
  64. package/dist/index-DO05OIM5.js +0 -1545
  65. package/dist/mermaid-3ZIDBTTL-DtIP-JZq.js +0 -4
@@ -1,1545 +0,0 @@
1
- import * as O from "react";
2
- import { useLayoutEffect as be } from "react";
3
- import * as Ae from "react-dom";
4
- import { P as bt } from "./index-DLohNuco.js";
5
- import { jsx as j } from "react/jsx-runtime";
6
- import { u as Xt } from "./index-D2LZVjSn.js";
7
- import { c as Re } from "./index-DFZozV_h.js";
8
- import { u as Oe } from "./index-0ioNhtNM.js";
9
- import { u as Tt } from "./index-CCKe-Mpx.js";
10
- import { u as Ce } from "./index-BGQepRFJ.js";
11
- const Pe = ["top", "right", "bottom", "left"], Z = Math.min, W = Math.max, lt = Math.round, st = Math.floor, I = (t) => ({
12
- x: t,
13
- y: t
14
- }), Se = {
15
- left: "right",
16
- right: "left",
17
- bottom: "top",
18
- top: "bottom"
19
- }, Ee = {
20
- start: "end",
21
- end: "start"
22
- };
23
- function xt(t, e, n) {
24
- return W(t, Z(e, n));
25
- }
26
- function q(t, e) {
27
- return typeof t == "function" ? t(e) : t;
28
- }
29
- function U(t) {
30
- return t.split("-")[0];
31
- }
32
- function tt(t) {
33
- return t.split("-")[1];
34
- }
35
- function At(t) {
36
- return t === "x" ? "y" : "x";
37
- }
38
- function Rt(t) {
39
- return t === "y" ? "height" : "width";
40
- }
41
- const Le = /* @__PURE__ */ new Set(["top", "bottom"]);
42
- function z(t) {
43
- return Le.has(U(t)) ? "y" : "x";
44
- }
45
- function Ot(t) {
46
- return At(z(t));
47
- }
48
- function De(t, e, n) {
49
- n === void 0 && (n = !1);
50
- const o = tt(t), r = Ot(t), i = Rt(r);
51
- let s = r === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
52
- return e.reference[i] > e.floating[i] && (s = at(s)), [s, at(s)];
53
- }
54
- function Me(t) {
55
- const e = at(t);
56
- return [yt(t), e, yt(e)];
57
- }
58
- function yt(t) {
59
- return t.replace(/start|end/g, (e) => Ee[e]);
60
- }
61
- const $t = ["left", "right"], kt = ["right", "left"], Te = ["top", "bottom"], $e = ["bottom", "top"];
62
- function ke(t, e, n) {
63
- switch (t) {
64
- case "top":
65
- case "bottom":
66
- return n ? e ? kt : $t : e ? $t : kt;
67
- case "left":
68
- case "right":
69
- return e ? Te : $e;
70
- default:
71
- return [];
72
- }
73
- }
74
- function Fe(t, e, n, o) {
75
- const r = tt(t);
76
- let i = ke(U(t), n === "start", o);
77
- return r && (i = i.map((s) => s + "-" + r), e && (i = i.concat(i.map(yt)))), i;
78
- }
79
- function at(t) {
80
- return t.replace(/left|right|bottom|top/g, (e) => Se[e]);
81
- }
82
- function Ne(t) {
83
- return {
84
- top: 0,
85
- right: 0,
86
- bottom: 0,
87
- left: 0,
88
- ...t
89
- };
90
- }
91
- function Yt(t) {
92
- return typeof t != "number" ? Ne(t) : {
93
- top: t,
94
- right: t,
95
- bottom: t,
96
- left: t
97
- };
98
- }
99
- function ft(t) {
100
- const {
101
- x: e,
102
- y: n,
103
- width: o,
104
- height: r
105
- } = t;
106
- return {
107
- width: o,
108
- height: r,
109
- top: n,
110
- left: e,
111
- right: e + o,
112
- bottom: n + r,
113
- x: e,
114
- y: n
115
- };
116
- }
117
- function Ft(t, e, n) {
118
- let {
119
- reference: o,
120
- floating: r
121
- } = t;
122
- const i = z(e), s = Ot(e), c = Rt(s), l = U(e), a = i === "y", f = o.x + o.width / 2 - r.width / 2, u = o.y + o.height / 2 - r.height / 2, p = o[c] / 2 - r[c] / 2;
123
- let d;
124
- switch (l) {
125
- case "top":
126
- d = {
127
- x: f,
128
- y: o.y - r.height
129
- };
130
- break;
131
- case "bottom":
132
- d = {
133
- x: f,
134
- y: o.y + o.height
135
- };
136
- break;
137
- case "right":
138
- d = {
139
- x: o.x + o.width,
140
- y: u
141
- };
142
- break;
143
- case "left":
144
- d = {
145
- x: o.x - r.width,
146
- y: u
147
- };
148
- break;
149
- default:
150
- d = {
151
- x: o.x,
152
- y: o.y
153
- };
154
- }
155
- switch (tt(e)) {
156
- case "start":
157
- d[s] -= p * (n && a ? -1 : 1);
158
- break;
159
- case "end":
160
- d[s] += p * (n && a ? -1 : 1);
161
- break;
162
- }
163
- return d;
164
- }
165
- async function We(t, e) {
166
- var n;
167
- e === void 0 && (e = {});
168
- const {
169
- x: o,
170
- y: r,
171
- platform: i,
172
- rects: s,
173
- elements: c,
174
- strategy: l
175
- } = t, {
176
- boundary: a = "clippingAncestors",
177
- rootBoundary: f = "viewport",
178
- elementContext: u = "floating",
179
- altBoundary: p = !1,
180
- padding: d = 0
181
- } = q(e, t), m = Yt(d), w = c[p ? u === "floating" ? "reference" : "floating" : u], g = ft(await i.getClippingRect({
182
- element: (n = await (i.isElement == null ? void 0 : i.isElement(w))) == null || n ? w : w.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)),
183
- boundary: a,
184
- rootBoundary: f,
185
- strategy: l
186
- })), v = u === "floating" ? {
187
- x: o,
188
- y: r,
189
- width: s.floating.width,
190
- height: s.floating.height
191
- } : s.reference, y = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), x = await (i.isElement == null ? void 0 : i.isElement(y)) ? await (i.getScale == null ? void 0 : i.getScale(y)) || {
192
- x: 1,
193
- y: 1
194
- } : {
195
- x: 1,
196
- y: 1
197
- }, A = ft(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
198
- elements: c,
199
- rect: v,
200
- offsetParent: y,
201
- strategy: l
202
- }) : v);
203
- return {
204
- top: (g.top - A.top + m.top) / x.y,
205
- bottom: (A.bottom - g.bottom + m.bottom) / x.y,
206
- left: (g.left - A.left + m.left) / x.x,
207
- right: (A.right - g.right + m.right) / x.x
208
- };
209
- }
210
- const He = async (t, e, n) => {
211
- const {
212
- placement: o = "bottom",
213
- strategy: r = "absolute",
214
- middleware: i = [],
215
- platform: s
216
- } = n, c = i.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(e));
217
- let a = await s.getElementRects({
218
- reference: t,
219
- floating: e,
220
- strategy: r
221
- }), {
222
- x: f,
223
- y: u
224
- } = Ft(a, o, l), p = o, d = {}, m = 0;
225
- for (let w = 0; w < c.length; w++) {
226
- var h;
227
- const {
228
- name: g,
229
- fn: v
230
- } = c[w], {
231
- x: y,
232
- y: x,
233
- data: A,
234
- reset: R
235
- } = await v({
236
- x: f,
237
- y: u,
238
- initialPlacement: o,
239
- placement: p,
240
- strategy: r,
241
- middlewareData: d,
242
- rects: a,
243
- platform: {
244
- ...s,
245
- detectOverflow: (h = s.detectOverflow) != null ? h : We
246
- },
247
- elements: {
248
- reference: t,
249
- floating: e
250
- }
251
- });
252
- f = y ?? f, u = x ?? u, d = {
253
- ...d,
254
- [g]: {
255
- ...d[g],
256
- ...A
257
- }
258
- }, R && m <= 50 && (m++, typeof R == "object" && (R.placement && (p = R.placement), R.rects && (a = R.rects === !0 ? await s.getElementRects({
259
- reference: t,
260
- floating: e,
261
- strategy: r
262
- }) : R.rects), {
263
- x: f,
264
- y: u
265
- } = Ft(a, p, l)), w = -1);
266
- }
267
- return {
268
- x: f,
269
- y: u,
270
- placement: p,
271
- strategy: r,
272
- middlewareData: d
273
- };
274
- }, _e = (t) => ({
275
- name: "arrow",
276
- options: t,
277
- async fn(e) {
278
- const {
279
- x: n,
280
- y: o,
281
- placement: r,
282
- rects: i,
283
- platform: s,
284
- elements: c,
285
- middlewareData: l
286
- } = e, {
287
- element: a,
288
- padding: f = 0
289
- } = q(t, e) || {};
290
- if (a == null)
291
- return {};
292
- const u = Yt(f), p = {
293
- x: n,
294
- y: o
295
- }, d = Ot(r), m = Rt(d), h = await s.getDimensions(a), w = d === "y", g = w ? "top" : "left", v = w ? "bottom" : "right", y = w ? "clientHeight" : "clientWidth", x = i.reference[m] + i.reference[d] - p[d] - i.floating[m], A = p[d] - i.reference[d], R = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a));
296
- let C = R ? R[y] : 0;
297
- (!C || !await (s.isElement == null ? void 0 : s.isElement(R))) && (C = c.floating[y] || i.floating[m]);
298
- const M = x / 2 - A / 2, F = C / 2 - h[m] / 2 - 1, D = Z(u[g], F), $ = Z(u[v], F), k = D, S = C - h[m] - $, P = C / 2 - h[m] / 2 + M, N = xt(k, P, S), E = !l.arrow && tt(r) != null && P !== N && i.reference[m] / 2 - (P < k ? D : $) - h[m] / 2 < 0, L = E ? P < k ? P - k : P - S : 0;
299
- return {
300
- [d]: p[d] + L,
301
- data: {
302
- [d]: N,
303
- centerOffset: P - N - L,
304
- ...E && {
305
- alignmentOffset: L
306
- }
307
- },
308
- reset: E
309
- };
310
- }
311
- }), Be = function(t) {
312
- return t === void 0 && (t = {}), {
313
- name: "flip",
314
- options: t,
315
- async fn(e) {
316
- var n, o;
317
- const {
318
- placement: r,
319
- middlewareData: i,
320
- rects: s,
321
- initialPlacement: c,
322
- platform: l,
323
- elements: a
324
- } = e, {
325
- mainAxis: f = !0,
326
- crossAxis: u = !0,
327
- fallbackPlacements: p,
328
- fallbackStrategy: d = "bestFit",
329
- fallbackAxisSideDirection: m = "none",
330
- flipAlignment: h = !0,
331
- ...w
332
- } = q(t, e);
333
- if ((n = i.arrow) != null && n.alignmentOffset)
334
- return {};
335
- const g = U(r), v = z(c), y = U(c) === c, x = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), A = p || (y || !h ? [at(c)] : Me(c)), R = m !== "none";
336
- !p && R && A.push(...Fe(c, h, m, x));
337
- const C = [c, ...A], M = await l.detectOverflow(e, w), F = [];
338
- let D = ((o = i.flip) == null ? void 0 : o.overflows) || [];
339
- if (f && F.push(M[g]), u) {
340
- const P = De(r, s, x);
341
- F.push(M[P[0]], M[P[1]]);
342
- }
343
- if (D = [...D, {
344
- placement: r,
345
- overflows: F
346
- }], !F.every((P) => P <= 0)) {
347
- var $, k;
348
- const P = ((($ = i.flip) == null ? void 0 : $.index) || 0) + 1, N = C[P];
349
- if (N && (!(u === "alignment" ? v !== z(N) : !1) || // We leave the current main axis only if every placement on that axis
350
- // overflows the main axis.
351
- D.every((b) => z(b.placement) === v ? b.overflows[0] > 0 : !0)))
352
- return {
353
- data: {
354
- index: P,
355
- overflows: D
356
- },
357
- reset: {
358
- placement: N
359
- }
360
- };
361
- let E = (k = D.filter((L) => L.overflows[0] <= 0).sort((L, b) => L.overflows[1] - b.overflows[1])[0]) == null ? void 0 : k.placement;
362
- if (!E)
363
- switch (d) {
364
- case "bestFit": {
365
- var S;
366
- const L = (S = D.filter((b) => {
367
- if (R) {
368
- const T = z(b.placement);
369
- return T === v || // Create a bias to the `y` side axis due to horizontal
370
- // reading directions favoring greater width.
371
- T === "y";
372
- }
373
- return !0;
374
- }).map((b) => [b.placement, b.overflows.filter((T) => T > 0).reduce((T, V) => T + V, 0)]).sort((b, T) => b[1] - T[1])[0]) == null ? void 0 : S[0];
375
- L && (E = L);
376
- break;
377
- }
378
- case "initialPlacement":
379
- E = c;
380
- break;
381
- }
382
- if (r !== E)
383
- return {
384
- reset: {
385
- placement: E
386
- }
387
- };
388
- }
389
- return {};
390
- }
391
- };
392
- };
393
- function Nt(t, e) {
394
- return {
395
- top: t.top - e.height,
396
- right: t.right - e.width,
397
- bottom: t.bottom - e.height,
398
- left: t.left - e.width
399
- };
400
- }
401
- function Wt(t) {
402
- return Pe.some((e) => t[e] >= 0);
403
- }
404
- const Ve = function(t) {
405
- return t === void 0 && (t = {}), {
406
- name: "hide",
407
- options: t,
408
- async fn(e) {
409
- const {
410
- rects: n,
411
- platform: o
412
- } = e, {
413
- strategy: r = "referenceHidden",
414
- ...i
415
- } = q(t, e);
416
- switch (r) {
417
- case "referenceHidden": {
418
- const s = await o.detectOverflow(e, {
419
- ...i,
420
- elementContext: "reference"
421
- }), c = Nt(s, n.reference);
422
- return {
423
- data: {
424
- referenceHiddenOffsets: c,
425
- referenceHidden: Wt(c)
426
- }
427
- };
428
- }
429
- case "escaped": {
430
- const s = await o.detectOverflow(e, {
431
- ...i,
432
- altBoundary: !0
433
- }), c = Nt(s, n.floating);
434
- return {
435
- data: {
436
- escapedOffsets: c,
437
- escaped: Wt(c)
438
- }
439
- };
440
- }
441
- default:
442
- return {};
443
- }
444
- }
445
- };
446
- }, jt = /* @__PURE__ */ new Set(["left", "top"]);
447
- async function ze(t, e) {
448
- const {
449
- placement: n,
450
- platform: o,
451
- elements: r
452
- } = t, i = await (o.isRTL == null ? void 0 : o.isRTL(r.floating)), s = U(n), c = tt(n), l = z(n) === "y", a = jt.has(s) ? -1 : 1, f = i && l ? -1 : 1, u = q(e, t);
453
- let {
454
- mainAxis: p,
455
- crossAxis: d,
456
- alignmentAxis: m
457
- } = typeof u == "number" ? {
458
- mainAxis: u,
459
- crossAxis: 0,
460
- alignmentAxis: null
461
- } : {
462
- mainAxis: u.mainAxis || 0,
463
- crossAxis: u.crossAxis || 0,
464
- alignmentAxis: u.alignmentAxis
465
- };
466
- return c && typeof m == "number" && (d = c === "end" ? m * -1 : m), l ? {
467
- x: d * f,
468
- y: p * a
469
- } : {
470
- x: p * a,
471
- y: d * f
472
- };
473
- }
474
- const Ie = function(t) {
475
- return t === void 0 && (t = 0), {
476
- name: "offset",
477
- options: t,
478
- async fn(e) {
479
- var n, o;
480
- const {
481
- x: r,
482
- y: i,
483
- placement: s,
484
- middlewareData: c
485
- } = e, l = await ze(e, t);
486
- return s === ((n = c.offset) == null ? void 0 : n.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
487
- x: r + l.x,
488
- y: i + l.y,
489
- data: {
490
- ...l,
491
- placement: s
492
- }
493
- };
494
- }
495
- };
496
- }, Xe = function(t) {
497
- return t === void 0 && (t = {}), {
498
- name: "shift",
499
- options: t,
500
- async fn(e) {
501
- const {
502
- x: n,
503
- y: o,
504
- placement: r,
505
- platform: i
506
- } = e, {
507
- mainAxis: s = !0,
508
- crossAxis: c = !1,
509
- limiter: l = {
510
- fn: (g) => {
511
- let {
512
- x: v,
513
- y
514
- } = g;
515
- return {
516
- x: v,
517
- y
518
- };
519
- }
520
- },
521
- ...a
522
- } = q(t, e), f = {
523
- x: n,
524
- y: o
525
- }, u = await i.detectOverflow(e, a), p = z(U(r)), d = At(p);
526
- let m = f[d], h = f[p];
527
- if (s) {
528
- const g = d === "y" ? "top" : "left", v = d === "y" ? "bottom" : "right", y = m + u[g], x = m - u[v];
529
- m = xt(y, m, x);
530
- }
531
- if (c) {
532
- const g = p === "y" ? "top" : "left", v = p === "y" ? "bottom" : "right", y = h + u[g], x = h - u[v];
533
- h = xt(y, h, x);
534
- }
535
- const w = l.fn({
536
- ...e,
537
- [d]: m,
538
- [p]: h
539
- });
540
- return {
541
- ...w,
542
- data: {
543
- x: w.x - n,
544
- y: w.y - o,
545
- enabled: {
546
- [d]: s,
547
- [p]: c
548
- }
549
- }
550
- };
551
- }
552
- };
553
- }, Ye = function(t) {
554
- return t === void 0 && (t = {}), {
555
- options: t,
556
- fn(e) {
557
- const {
558
- x: n,
559
- y: o,
560
- placement: r,
561
- rects: i,
562
- middlewareData: s
563
- } = e, {
564
- offset: c = 0,
565
- mainAxis: l = !0,
566
- crossAxis: a = !0
567
- } = q(t, e), f = {
568
- x: n,
569
- y: o
570
- }, u = z(r), p = At(u);
571
- let d = f[p], m = f[u];
572
- const h = q(c, e), w = typeof h == "number" ? {
573
- mainAxis: h,
574
- crossAxis: 0
575
- } : {
576
- mainAxis: 0,
577
- crossAxis: 0,
578
- ...h
579
- };
580
- if (l) {
581
- const y = p === "y" ? "height" : "width", x = i.reference[p] - i.floating[y] + w.mainAxis, A = i.reference[p] + i.reference[y] - w.mainAxis;
582
- d < x ? d = x : d > A && (d = A);
583
- }
584
- if (a) {
585
- var g, v;
586
- const y = p === "y" ? "width" : "height", x = jt.has(U(r)), A = i.reference[u] - i.floating[y] + (x && ((g = s.offset) == null ? void 0 : g[u]) || 0) + (x ? 0 : w.crossAxis), R = i.reference[u] + i.reference[y] + (x ? 0 : ((v = s.offset) == null ? void 0 : v[u]) || 0) - (x ? w.crossAxis : 0);
587
- m < A ? m = A : m > R && (m = R);
588
- }
589
- return {
590
- [p]: d,
591
- [u]: m
592
- };
593
- }
594
- };
595
- }, je = function(t) {
596
- return t === void 0 && (t = {}), {
597
- name: "size",
598
- options: t,
599
- async fn(e) {
600
- var n, o;
601
- const {
602
- placement: r,
603
- rects: i,
604
- platform: s,
605
- elements: c
606
- } = e, {
607
- apply: l = () => {
608
- },
609
- ...a
610
- } = q(t, e), f = await s.detectOverflow(e, a), u = U(r), p = tt(r), d = z(r) === "y", {
611
- width: m,
612
- height: h
613
- } = i.floating;
614
- let w, g;
615
- u === "top" || u === "bottom" ? (w = u, g = p === (await (s.isRTL == null ? void 0 : s.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (g = u, w = p === "end" ? "top" : "bottom");
616
- const v = h - f.top - f.bottom, y = m - f.left - f.right, x = Z(h - f[w], v), A = Z(m - f[g], y), R = !e.middlewareData.shift;
617
- let C = x, M = A;
618
- if ((n = e.middlewareData.shift) != null && n.enabled.x && (M = y), (o = e.middlewareData.shift) != null && o.enabled.y && (C = v), R && !p) {
619
- const D = W(f.left, 0), $ = W(f.right, 0), k = W(f.top, 0), S = W(f.bottom, 0);
620
- d ? M = m - 2 * (D !== 0 || $ !== 0 ? D + $ : W(f.left, f.right)) : C = h - 2 * (k !== 0 || S !== 0 ? k + S : W(f.top, f.bottom));
621
- }
622
- await l({
623
- ...e,
624
- availableWidth: M,
625
- availableHeight: C
626
- });
627
- const F = await s.getDimensions(c.floating);
628
- return m !== F.width || h !== F.height ? {
629
- reset: {
630
- rects: !0
631
- }
632
- } : {};
633
- }
634
- };
635
- };
636
- function dt() {
637
- return typeof window < "u";
638
- }
639
- function et(t) {
640
- return qt(t) ? (t.nodeName || "").toLowerCase() : "#document";
641
- }
642
- function H(t) {
643
- var e;
644
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
645
- }
646
- function Y(t) {
647
- var e;
648
- return (e = (qt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
649
- }
650
- function qt(t) {
651
- return dt() ? t instanceof Node || t instanceof H(t).Node : !1;
652
- }
653
- function _(t) {
654
- return dt() ? t instanceof Element || t instanceof H(t).Element : !1;
655
- }
656
- function X(t) {
657
- return dt() ? t instanceof HTMLElement || t instanceof H(t).HTMLElement : !1;
658
- }
659
- function Ht(t) {
660
- return !dt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof H(t).ShadowRoot;
661
- }
662
- const qe = /* @__PURE__ */ new Set(["inline", "contents"]);
663
- function rt(t) {
664
- const {
665
- overflow: e,
666
- overflowX: n,
667
- overflowY: o,
668
- display: r
669
- } = B(t);
670
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !qe.has(r);
671
- }
672
- const Ue = /* @__PURE__ */ new Set(["table", "td", "th"]);
673
- function Ze(t) {
674
- return Ue.has(et(t));
675
- }
676
- const Ke = [":popover-open", ":modal"];
677
- function mt(t) {
678
- return Ke.some((e) => {
679
- try {
680
- return t.matches(e);
681
- } catch {
682
- return !1;
683
- }
684
- });
685
- }
686
- const Ge = ["transform", "translate", "scale", "rotate", "perspective"], Je = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Qe = ["paint", "layout", "strict", "content"];
687
- function Ct(t) {
688
- const e = Pt(), n = _(t) ? B(t) : t;
689
- return Ge.some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || Je.some((o) => (n.willChange || "").includes(o)) || Qe.some((o) => (n.contain || "").includes(o));
690
- }
691
- function tn(t) {
692
- let e = K(t);
693
- for (; X(e) && !Q(e); ) {
694
- if (Ct(e))
695
- return e;
696
- if (mt(e))
697
- return null;
698
- e = K(e);
699
- }
700
- return null;
701
- }
702
- function Pt() {
703
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
704
- }
705
- const en = /* @__PURE__ */ new Set(["html", "body", "#document"]);
706
- function Q(t) {
707
- return en.has(et(t));
708
- }
709
- function B(t) {
710
- return H(t).getComputedStyle(t);
711
- }
712
- function pt(t) {
713
- return _(t) ? {
714
- scrollLeft: t.scrollLeft,
715
- scrollTop: t.scrollTop
716
- } : {
717
- scrollLeft: t.scrollX,
718
- scrollTop: t.scrollY
719
- };
720
- }
721
- function K(t) {
722
- if (et(t) === "html")
723
- return t;
724
- const e = (
725
- // Step into the shadow DOM of the parent of a slotted node.
726
- t.assignedSlot || // DOM Element detected.
727
- t.parentNode || // ShadowRoot detected.
728
- Ht(t) && t.host || // Fallback.
729
- Y(t)
730
- );
731
- return Ht(e) ? e.host : e;
732
- }
733
- function Ut(t) {
734
- const e = K(t);
735
- return Q(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : X(e) && rt(e) ? e : Ut(e);
736
- }
737
- function ot(t, e, n) {
738
- var o;
739
- e === void 0 && (e = []), n === void 0 && (n = !0);
740
- const r = Ut(t), i = r === ((o = t.ownerDocument) == null ? void 0 : o.body), s = H(r);
741
- if (i) {
742
- const c = vt(s);
743
- return e.concat(s, s.visualViewport || [], rt(r) ? r : [], c && n ? ot(c) : []);
744
- }
745
- return e.concat(r, ot(r, [], n));
746
- }
747
- function vt(t) {
748
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
749
- }
750
- function Zt(t) {
751
- const e = B(t);
752
- let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
753
- const r = X(t), i = r ? t.offsetWidth : n, s = r ? t.offsetHeight : o, c = lt(n) !== i || lt(o) !== s;
754
- return c && (n = i, o = s), {
755
- width: n,
756
- height: o,
757
- $: c
758
- };
759
- }
760
- function St(t) {
761
- return _(t) ? t : t.contextElement;
762
- }
763
- function J(t) {
764
- const e = St(t);
765
- if (!X(e))
766
- return I(1);
767
- const n = e.getBoundingClientRect(), {
768
- width: o,
769
- height: r,
770
- $: i
771
- } = Zt(e);
772
- let s = (i ? lt(n.width) : n.width) / o, c = (i ? lt(n.height) : n.height) / r;
773
- return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
774
- x: s,
775
- y: c
776
- };
777
- }
778
- const nn = /* @__PURE__ */ I(0);
779
- function Kt(t) {
780
- const e = H(t);
781
- return !Pt() || !e.visualViewport ? nn : {
782
- x: e.visualViewport.offsetLeft,
783
- y: e.visualViewport.offsetTop
784
- };
785
- }
786
- function on(t, e, n) {
787
- return e === void 0 && (e = !1), !n || e && n !== H(t) ? !1 : e;
788
- }
789
- function G(t, e, n, o) {
790
- e === void 0 && (e = !1), n === void 0 && (n = !1);
791
- const r = t.getBoundingClientRect(), i = St(t);
792
- let s = I(1);
793
- e && (o ? _(o) && (s = J(o)) : s = J(t));
794
- const c = on(i, n, o) ? Kt(i) : I(0);
795
- let l = (r.left + c.x) / s.x, a = (r.top + c.y) / s.y, f = r.width / s.x, u = r.height / s.y;
796
- if (i) {
797
- const p = H(i), d = o && _(o) ? H(o) : o;
798
- let m = p, h = vt(m);
799
- for (; h && o && d !== m; ) {
800
- const w = J(h), g = h.getBoundingClientRect(), v = B(h), y = g.left + (h.clientLeft + parseFloat(v.paddingLeft)) * w.x, x = g.top + (h.clientTop + parseFloat(v.paddingTop)) * w.y;
801
- l *= w.x, a *= w.y, f *= w.x, u *= w.y, l += y, a += x, m = H(h), h = vt(m);
802
- }
803
- }
804
- return ft({
805
- width: f,
806
- height: u,
807
- x: l,
808
- y: a
809
- });
810
- }
811
- function ht(t, e) {
812
- const n = pt(t).scrollLeft;
813
- return e ? e.left + n : G(Y(t)).left + n;
814
- }
815
- function Gt(t, e) {
816
- const n = t.getBoundingClientRect(), o = n.left + e.scrollLeft - ht(t, n), r = n.top + e.scrollTop;
817
- return {
818
- x: o,
819
- y: r
820
- };
821
- }
822
- function rn(t) {
823
- let {
824
- elements: e,
825
- rect: n,
826
- offsetParent: o,
827
- strategy: r
828
- } = t;
829
- const i = r === "fixed", s = Y(o), c = e ? mt(e.floating) : !1;
830
- if (o === s || c && i)
831
- return n;
832
- let l = {
833
- scrollLeft: 0,
834
- scrollTop: 0
835
- }, a = I(1);
836
- const f = I(0), u = X(o);
837
- if ((u || !u && !i) && ((et(o) !== "body" || rt(s)) && (l = pt(o)), X(o))) {
838
- const d = G(o);
839
- a = J(o), f.x = d.x + o.clientLeft, f.y = d.y + o.clientTop;
840
- }
841
- const p = s && !u && !i ? Gt(s, l) : I(0);
842
- return {
843
- width: n.width * a.x,
844
- height: n.height * a.y,
845
- x: n.x * a.x - l.scrollLeft * a.x + f.x + p.x,
846
- y: n.y * a.y - l.scrollTop * a.y + f.y + p.y
847
- };
848
- }
849
- function sn(t) {
850
- return Array.from(t.getClientRects());
851
- }
852
- function cn(t) {
853
- const e = Y(t), n = pt(t), o = t.ownerDocument.body, r = W(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), i = W(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
854
- let s = -n.scrollLeft + ht(t);
855
- const c = -n.scrollTop;
856
- return B(o).direction === "rtl" && (s += W(e.clientWidth, o.clientWidth) - r), {
857
- width: r,
858
- height: i,
859
- x: s,
860
- y: c
861
- };
862
- }
863
- const _t = 25;
864
- function ln(t, e) {
865
- const n = H(t), o = Y(t), r = n.visualViewport;
866
- let i = o.clientWidth, s = o.clientHeight, c = 0, l = 0;
867
- if (r) {
868
- i = r.width, s = r.height;
869
- const f = Pt();
870
- (!f || f && e === "fixed") && (c = r.offsetLeft, l = r.offsetTop);
871
- }
872
- const a = ht(o);
873
- if (a <= 0) {
874
- const f = o.ownerDocument, u = f.body, p = getComputedStyle(u), d = f.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, m = Math.abs(o.clientWidth - u.clientWidth - d);
875
- m <= _t && (i -= m);
876
- } else a <= _t && (i += a);
877
- return {
878
- width: i,
879
- height: s,
880
- x: c,
881
- y: l
882
- };
883
- }
884
- const an = /* @__PURE__ */ new Set(["absolute", "fixed"]);
885
- function fn(t, e) {
886
- const n = G(t, !0, e === "fixed"), o = n.top + t.clientTop, r = n.left + t.clientLeft, i = X(t) ? J(t) : I(1), s = t.clientWidth * i.x, c = t.clientHeight * i.y, l = r * i.x, a = o * i.y;
887
- return {
888
- width: s,
889
- height: c,
890
- x: l,
891
- y: a
892
- };
893
- }
894
- function Bt(t, e, n) {
895
- let o;
896
- if (e === "viewport")
897
- o = ln(t, n);
898
- else if (e === "document")
899
- o = cn(Y(t));
900
- else if (_(e))
901
- o = fn(e, n);
902
- else {
903
- const r = Kt(t);
904
- o = {
905
- x: e.x - r.x,
906
- y: e.y - r.y,
907
- width: e.width,
908
- height: e.height
909
- };
910
- }
911
- return ft(o);
912
- }
913
- function Jt(t, e) {
914
- const n = K(t);
915
- return n === e || !_(n) || Q(n) ? !1 : B(n).position === "fixed" || Jt(n, e);
916
- }
917
- function un(t, e) {
918
- const n = e.get(t);
919
- if (n)
920
- return n;
921
- let o = ot(t, [], !1).filter((c) => _(c) && et(c) !== "body"), r = null;
922
- const i = B(t).position === "fixed";
923
- let s = i ? K(t) : t;
924
- for (; _(s) && !Q(s); ) {
925
- const c = B(s), l = Ct(s);
926
- !l && c.position === "fixed" && (r = null), (i ? !l && !r : !l && c.position === "static" && !!r && an.has(r.position) || rt(s) && !l && Jt(t, s)) ? o = o.filter((f) => f !== s) : r = c, s = K(s);
927
- }
928
- return e.set(t, o), o;
929
- }
930
- function dn(t) {
931
- let {
932
- element: e,
933
- boundary: n,
934
- rootBoundary: o,
935
- strategy: r
936
- } = t;
937
- const s = [...n === "clippingAncestors" ? mt(e) ? [] : un(e, this._c) : [].concat(n), o], c = s[0], l = s.reduce((a, f) => {
938
- const u = Bt(e, f, r);
939
- return a.top = W(u.top, a.top), a.right = Z(u.right, a.right), a.bottom = Z(u.bottom, a.bottom), a.left = W(u.left, a.left), a;
940
- }, Bt(e, c, r));
941
- return {
942
- width: l.right - l.left,
943
- height: l.bottom - l.top,
944
- x: l.left,
945
- y: l.top
946
- };
947
- }
948
- function mn(t) {
949
- const {
950
- width: e,
951
- height: n
952
- } = Zt(t);
953
- return {
954
- width: e,
955
- height: n
956
- };
957
- }
958
- function pn(t, e, n) {
959
- const o = X(e), r = Y(e), i = n === "fixed", s = G(t, !0, i, e);
960
- let c = {
961
- scrollLeft: 0,
962
- scrollTop: 0
963
- };
964
- const l = I(0);
965
- function a() {
966
- l.x = ht(r);
967
- }
968
- if (o || !o && !i)
969
- if ((et(e) !== "body" || rt(r)) && (c = pt(e)), o) {
970
- const d = G(e, !0, i, e);
971
- l.x = d.x + e.clientLeft, l.y = d.y + e.clientTop;
972
- } else r && a();
973
- i && !o && r && a();
974
- const f = r && !o && !i ? Gt(r, c) : I(0), u = s.left + c.scrollLeft - l.x - f.x, p = s.top + c.scrollTop - l.y - f.y;
975
- return {
976
- x: u,
977
- y: p,
978
- width: s.width,
979
- height: s.height
980
- };
981
- }
982
- function gt(t) {
983
- return B(t).position === "static";
984
- }
985
- function Vt(t, e) {
986
- if (!X(t) || B(t).position === "fixed")
987
- return null;
988
- if (e)
989
- return e(t);
990
- let n = t.offsetParent;
991
- return Y(t) === n && (n = n.ownerDocument.body), n;
992
- }
993
- function Qt(t, e) {
994
- const n = H(t);
995
- if (mt(t))
996
- return n;
997
- if (!X(t)) {
998
- let r = K(t);
999
- for (; r && !Q(r); ) {
1000
- if (_(r) && !gt(r))
1001
- return r;
1002
- r = K(r);
1003
- }
1004
- return n;
1005
- }
1006
- let o = Vt(t, e);
1007
- for (; o && Ze(o) && gt(o); )
1008
- o = Vt(o, e);
1009
- return o && Q(o) && gt(o) && !Ct(o) ? n : o || tn(t) || n;
1010
- }
1011
- const hn = async function(t) {
1012
- const e = this.getOffsetParent || Qt, n = this.getDimensions, o = await n(t.floating);
1013
- return {
1014
- reference: pn(t.reference, await e(t.floating), t.strategy),
1015
- floating: {
1016
- x: 0,
1017
- y: 0,
1018
- width: o.width,
1019
- height: o.height
1020
- }
1021
- };
1022
- };
1023
- function gn(t) {
1024
- return B(t).direction === "rtl";
1025
- }
1026
- const wn = {
1027
- convertOffsetParentRelativeRectToViewportRelativeRect: rn,
1028
- getDocumentElement: Y,
1029
- getClippingRect: dn,
1030
- getOffsetParent: Qt,
1031
- getElementRects: hn,
1032
- getClientRects: sn,
1033
- getDimensions: mn,
1034
- getScale: J,
1035
- isElement: _,
1036
- isRTL: gn
1037
- };
1038
- function te(t, e) {
1039
- return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
1040
- }
1041
- function xn(t, e) {
1042
- let n = null, o;
1043
- const r = Y(t);
1044
- function i() {
1045
- var c;
1046
- clearTimeout(o), (c = n) == null || c.disconnect(), n = null;
1047
- }
1048
- function s(c, l) {
1049
- c === void 0 && (c = !1), l === void 0 && (l = 1), i();
1050
- const a = t.getBoundingClientRect(), {
1051
- left: f,
1052
- top: u,
1053
- width: p,
1054
- height: d
1055
- } = a;
1056
- if (c || e(), !p || !d)
1057
- return;
1058
- const m = st(u), h = st(r.clientWidth - (f + p)), w = st(r.clientHeight - (u + d)), g = st(f), y = {
1059
- rootMargin: -m + "px " + -h + "px " + -w + "px " + -g + "px",
1060
- threshold: W(0, Z(1, l)) || 1
1061
- };
1062
- let x = !0;
1063
- function A(R) {
1064
- const C = R[0].intersectionRatio;
1065
- if (C !== l) {
1066
- if (!x)
1067
- return s();
1068
- C ? s(!1, C) : o = setTimeout(() => {
1069
- s(!1, 1e-7);
1070
- }, 1e3);
1071
- }
1072
- C === 1 && !te(a, t.getBoundingClientRect()) && s(), x = !1;
1073
- }
1074
- try {
1075
- n = new IntersectionObserver(A, {
1076
- ...y,
1077
- // Handle <iframe>s
1078
- root: r.ownerDocument
1079
- });
1080
- } catch {
1081
- n = new IntersectionObserver(A, y);
1082
- }
1083
- n.observe(t);
1084
- }
1085
- return s(!0), i;
1086
- }
1087
- function yn(t, e, n, o) {
1088
- o === void 0 && (o = {});
1089
- const {
1090
- ancestorScroll: r = !0,
1091
- ancestorResize: i = !0,
1092
- elementResize: s = typeof ResizeObserver == "function",
1093
- layoutShift: c = typeof IntersectionObserver == "function",
1094
- animationFrame: l = !1
1095
- } = o, a = St(t), f = r || i ? [...a ? ot(a) : [], ...ot(e)] : [];
1096
- f.forEach((g) => {
1097
- r && g.addEventListener("scroll", n, {
1098
- passive: !0
1099
- }), i && g.addEventListener("resize", n);
1100
- });
1101
- const u = a && c ? xn(a, n) : null;
1102
- let p = -1, d = null;
1103
- s && (d = new ResizeObserver((g) => {
1104
- let [v] = g;
1105
- v && v.target === a && d && (d.unobserve(e), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1106
- var y;
1107
- (y = d) == null || y.observe(e);
1108
- })), n();
1109
- }), a && !l && d.observe(a), d.observe(e));
1110
- let m, h = l ? G(t) : null;
1111
- l && w();
1112
- function w() {
1113
- const g = G(t);
1114
- h && !te(h, g) && n(), h = g, m = requestAnimationFrame(w);
1115
- }
1116
- return n(), () => {
1117
- var g;
1118
- f.forEach((v) => {
1119
- r && v.removeEventListener("scroll", n), i && v.removeEventListener("resize", n);
1120
- }), u?.(), (g = d) == null || g.disconnect(), d = null, l && cancelAnimationFrame(m);
1121
- };
1122
- }
1123
- const vn = Ie, bn = Xe, An = Be, Rn = je, On = Ve, zt = _e, Cn = Ye, Pn = (t, e, n) => {
1124
- const o = /* @__PURE__ */ new Map(), r = {
1125
- platform: wn,
1126
- ...n
1127
- }, i = {
1128
- ...r.platform,
1129
- _c: o
1130
- };
1131
- return He(t, e, {
1132
- ...r,
1133
- platform: i
1134
- });
1135
- };
1136
- var Sn = typeof document < "u", En = function() {
1137
- }, ct = Sn ? be : En;
1138
- function ut(t, e) {
1139
- if (t === e)
1140
- return !0;
1141
- if (typeof t != typeof e)
1142
- return !1;
1143
- if (typeof t == "function" && t.toString() === e.toString())
1144
- return !0;
1145
- let n, o, r;
1146
- if (t && e && typeof t == "object") {
1147
- if (Array.isArray(t)) {
1148
- if (n = t.length, n !== e.length) return !1;
1149
- for (o = n; o-- !== 0; )
1150
- if (!ut(t[o], e[o]))
1151
- return !1;
1152
- return !0;
1153
- }
1154
- if (r = Object.keys(t), n = r.length, n !== Object.keys(e).length)
1155
- return !1;
1156
- for (o = n; o-- !== 0; )
1157
- if (!{}.hasOwnProperty.call(e, r[o]))
1158
- return !1;
1159
- for (o = n; o-- !== 0; ) {
1160
- const i = r[o];
1161
- if (!(i === "_owner" && t.$$typeof) && !ut(t[i], e[i]))
1162
- return !1;
1163
- }
1164
- return !0;
1165
- }
1166
- return t !== t && e !== e;
1167
- }
1168
- function ee(t) {
1169
- return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
1170
- }
1171
- function It(t, e) {
1172
- const n = ee(t);
1173
- return Math.round(e * n) / n;
1174
- }
1175
- function wt(t) {
1176
- const e = O.useRef(t);
1177
- return ct(() => {
1178
- e.current = t;
1179
- }), e;
1180
- }
1181
- function Ln(t) {
1182
- t === void 0 && (t = {});
1183
- const {
1184
- placement: e = "bottom",
1185
- strategy: n = "absolute",
1186
- middleware: o = [],
1187
- platform: r,
1188
- elements: {
1189
- reference: i,
1190
- floating: s
1191
- } = {},
1192
- transform: c = !0,
1193
- whileElementsMounted: l,
1194
- open: a
1195
- } = t, [f, u] = O.useState({
1196
- x: 0,
1197
- y: 0,
1198
- strategy: n,
1199
- placement: e,
1200
- middlewareData: {},
1201
- isPositioned: !1
1202
- }), [p, d] = O.useState(o);
1203
- ut(p, o) || d(o);
1204
- const [m, h] = O.useState(null), [w, g] = O.useState(null), v = O.useCallback((b) => {
1205
- b !== R.current && (R.current = b, h(b));
1206
- }, []), y = O.useCallback((b) => {
1207
- b !== C.current && (C.current = b, g(b));
1208
- }, []), x = i || m, A = s || w, R = O.useRef(null), C = O.useRef(null), M = O.useRef(f), F = l != null, D = wt(l), $ = wt(r), k = wt(a), S = O.useCallback(() => {
1209
- if (!R.current || !C.current)
1210
- return;
1211
- const b = {
1212
- placement: e,
1213
- strategy: n,
1214
- middleware: p
1215
- };
1216
- $.current && (b.platform = $.current), Pn(R.current, C.current, b).then((T) => {
1217
- const V = {
1218
- ...T,
1219
- // The floating element's position may be recomputed while it's closed
1220
- // but still mounted (such as when transitioning out). To ensure
1221
- // `isPositioned` will be `false` initially on the next open, avoid
1222
- // setting it to `true` when `open === false` (must be specified).
1223
- isPositioned: k.current !== !1
1224
- };
1225
- P.current && !ut(M.current, V) && (M.current = V, Ae.flushSync(() => {
1226
- u(V);
1227
- }));
1228
- });
1229
- }, [p, e, n, $, k]);
1230
- ct(() => {
1231
- a === !1 && M.current.isPositioned && (M.current.isPositioned = !1, u((b) => ({
1232
- ...b,
1233
- isPositioned: !1
1234
- })));
1235
- }, [a]);
1236
- const P = O.useRef(!1);
1237
- ct(() => (P.current = !0, () => {
1238
- P.current = !1;
1239
- }), []), ct(() => {
1240
- if (x && (R.current = x), A && (C.current = A), x && A) {
1241
- if (D.current)
1242
- return D.current(x, A, S);
1243
- S();
1244
- }
1245
- }, [x, A, S, D, F]);
1246
- const N = O.useMemo(() => ({
1247
- reference: R,
1248
- floating: C,
1249
- setReference: v,
1250
- setFloating: y
1251
- }), [v, y]), E = O.useMemo(() => ({
1252
- reference: x,
1253
- floating: A
1254
- }), [x, A]), L = O.useMemo(() => {
1255
- const b = {
1256
- position: n,
1257
- left: 0,
1258
- top: 0
1259
- };
1260
- if (!E.floating)
1261
- return b;
1262
- const T = It(E.floating, f.x), V = It(E.floating, f.y);
1263
- return c ? {
1264
- ...b,
1265
- transform: "translate(" + T + "px, " + V + "px)",
1266
- ...ee(E.floating) >= 1.5 && {
1267
- willChange: "transform"
1268
- }
1269
- } : {
1270
- position: n,
1271
- left: T,
1272
- top: V
1273
- };
1274
- }, [n, c, E.floating, f.x, f.y]);
1275
- return O.useMemo(() => ({
1276
- ...f,
1277
- update: S,
1278
- refs: N,
1279
- elements: E,
1280
- floatingStyles: L
1281
- }), [f, S, N, E, L]);
1282
- }
1283
- const Dn = (t) => {
1284
- function e(n) {
1285
- return {}.hasOwnProperty.call(n, "current");
1286
- }
1287
- return {
1288
- name: "arrow",
1289
- options: t,
1290
- fn(n) {
1291
- const {
1292
- element: o,
1293
- padding: r
1294
- } = typeof t == "function" ? t(n) : t;
1295
- return o && e(o) ? o.current != null ? zt({
1296
- element: o.current,
1297
- padding: r
1298
- }).fn(n) : {} : o ? zt({
1299
- element: o,
1300
- padding: r
1301
- }).fn(n) : {};
1302
- }
1303
- };
1304
- }, Mn = (t, e) => ({
1305
- ...vn(t),
1306
- options: [t, e]
1307
- }), Tn = (t, e) => ({
1308
- ...bn(t),
1309
- options: [t, e]
1310
- }), $n = (t, e) => ({
1311
- ...Cn(t),
1312
- options: [t, e]
1313
- }), kn = (t, e) => ({
1314
- ...An(t),
1315
- options: [t, e]
1316
- }), Fn = (t, e) => ({
1317
- ...Rn(t),
1318
- options: [t, e]
1319
- }), Nn = (t, e) => ({
1320
- ...On(t),
1321
- options: [t, e]
1322
- }), Wn = (t, e) => ({
1323
- ...Dn(t),
1324
- options: [t, e]
1325
- });
1326
- var Hn = "Arrow", ne = O.forwardRef((t, e) => {
1327
- const { children: n, width: o = 10, height: r = 5, ...i } = t;
1328
- return /* @__PURE__ */ j(
1329
- bt.svg,
1330
- {
1331
- ...i,
1332
- ref: e,
1333
- width: o,
1334
- height: r,
1335
- viewBox: "0 0 30 10",
1336
- preserveAspectRatio: "none",
1337
- children: t.asChild ? n : /* @__PURE__ */ j("polygon", { points: "0,0 30,0 15,10" })
1338
- }
1339
- );
1340
- });
1341
- ne.displayName = Hn;
1342
- var _n = ne, Et = "Popper", [oe, to] = Re(Et), [Bn, re] = oe(Et), ie = (t) => {
1343
- const { __scopePopper: e, children: n } = t, [o, r] = O.useState(null);
1344
- return /* @__PURE__ */ j(Bn, { scope: e, anchor: o, onAnchorChange: r, children: n });
1345
- };
1346
- ie.displayName = Et;
1347
- var se = "PopperAnchor", ce = O.forwardRef(
1348
- (t, e) => {
1349
- const { __scopePopper: n, virtualRef: o, ...r } = t, i = re(se, n), s = O.useRef(null), c = Xt(e, s), l = O.useRef(null);
1350
- return O.useEffect(() => {
1351
- const a = l.current;
1352
- l.current = o?.current || s.current, a !== l.current && i.onAnchorChange(l.current);
1353
- }), o ? null : /* @__PURE__ */ j(bt.div, { ...r, ref: c });
1354
- }
1355
- );
1356
- ce.displayName = se;
1357
- var Lt = "PopperContent", [Vn, zn] = oe(Lt), le = O.forwardRef(
1358
- (t, e) => {
1359
- const {
1360
- __scopePopper: n,
1361
- side: o = "bottom",
1362
- sideOffset: r = 0,
1363
- align: i = "center",
1364
- alignOffset: s = 0,
1365
- arrowPadding: c = 0,
1366
- avoidCollisions: l = !0,
1367
- collisionBoundary: a = [],
1368
- collisionPadding: f = 0,
1369
- sticky: u = "partial",
1370
- hideWhenDetached: p = !1,
1371
- updatePositionStrategy: d = "optimized",
1372
- onPlaced: m,
1373
- ...h
1374
- } = t, w = re(Lt, n), [g, v] = O.useState(null), y = Xt(e, (nt) => v(nt)), [x, A] = O.useState(null), R = Ce(x), C = R?.width ?? 0, M = R?.height ?? 0, F = o + (i !== "center" ? "-" + i : ""), D = typeof f == "number" ? f : { top: 0, right: 0, bottom: 0, left: 0, ...f }, $ = Array.isArray(a) ? a : [a], k = $.length > 0, S = {
1375
- padding: D,
1376
- boundary: $.filter(Xn),
1377
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
1378
- altBoundary: k
1379
- }, { refs: P, floatingStyles: N, placement: E, isPositioned: L, middlewareData: b } = Ln({
1380
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
1381
- strategy: "fixed",
1382
- placement: F,
1383
- whileElementsMounted: (...nt) => yn(...nt, {
1384
- animationFrame: d === "always"
1385
- }),
1386
- elements: {
1387
- reference: w.anchor
1388
- },
1389
- middleware: [
1390
- Mn({ mainAxis: r + M, alignmentAxis: s }),
1391
- l && Tn({
1392
- mainAxis: !0,
1393
- crossAxis: !1,
1394
- limiter: u === "partial" ? $n() : void 0,
1395
- ...S
1396
- }),
1397
- l && kn({ ...S }),
1398
- Fn({
1399
- ...S,
1400
- apply: ({ elements: nt, rects: Mt, availableWidth: we, availableHeight: xe }) => {
1401
- const { width: ye, height: ve } = Mt.reference, it = nt.floating.style;
1402
- it.setProperty("--radix-popper-available-width", `${we}px`), it.setProperty("--radix-popper-available-height", `${xe}px`), it.setProperty("--radix-popper-anchor-width", `${ye}px`), it.setProperty("--radix-popper-anchor-height", `${ve}px`);
1403
- }
1404
- }),
1405
- x && Wn({ element: x, padding: c }),
1406
- Yn({ arrowWidth: C, arrowHeight: M }),
1407
- p && Nn({ strategy: "referenceHidden", ...S })
1408
- ]
1409
- }), [T, V] = ue(E), Dt = Oe(m);
1410
- Tt(() => {
1411
- L && Dt?.();
1412
- }, [L, Dt]);
1413
- const de = b.arrow?.x, me = b.arrow?.y, pe = b.arrow?.centerOffset !== 0, [he, ge] = O.useState();
1414
- return Tt(() => {
1415
- g && ge(window.getComputedStyle(g).zIndex);
1416
- }, [g]), /* @__PURE__ */ j(
1417
- "div",
1418
- {
1419
- ref: P.setFloating,
1420
- "data-radix-popper-content-wrapper": "",
1421
- style: {
1422
- ...N,
1423
- transform: L ? N.transform : "translate(0, -200%)",
1424
- // keep off the page when measuring
1425
- minWidth: "max-content",
1426
- zIndex: he,
1427
- "--radix-popper-transform-origin": [
1428
- b.transformOrigin?.x,
1429
- b.transformOrigin?.y
1430
- ].join(" "),
1431
- // hide the content if using the hide middleware and should be hidden
1432
- // set visibility to hidden and disable pointer events so the UI behaves
1433
- // as if the PopperContent isn't there at all
1434
- ...b.hide?.referenceHidden && {
1435
- visibility: "hidden",
1436
- pointerEvents: "none"
1437
- }
1438
- },
1439
- dir: t.dir,
1440
- children: /* @__PURE__ */ j(
1441
- Vn,
1442
- {
1443
- scope: n,
1444
- placedSide: T,
1445
- onArrowChange: A,
1446
- arrowX: de,
1447
- arrowY: me,
1448
- shouldHideArrow: pe,
1449
- children: /* @__PURE__ */ j(
1450
- bt.div,
1451
- {
1452
- "data-side": T,
1453
- "data-align": V,
1454
- ...h,
1455
- ref: y,
1456
- style: {
1457
- ...h.style,
1458
- // if the PopperContent hasn't been placed yet (not all measurements done)
1459
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
1460
- animation: L ? void 0 : "none"
1461
- }
1462
- }
1463
- )
1464
- }
1465
- )
1466
- }
1467
- );
1468
- }
1469
- );
1470
- le.displayName = Lt;
1471
- var ae = "PopperArrow", In = {
1472
- top: "bottom",
1473
- right: "left",
1474
- bottom: "top",
1475
- left: "right"
1476
- }, fe = O.forwardRef(function(e, n) {
1477
- const { __scopePopper: o, ...r } = e, i = zn(ae, o), s = In[i.placedSide];
1478
- return (
1479
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
1480
- // doesn't report size as we'd expect on SVG elements.
1481
- // it reports their bounding box which is effectively the largest path inside the SVG.
1482
- /* @__PURE__ */ j(
1483
- "span",
1484
- {
1485
- ref: i.onArrowChange,
1486
- style: {
1487
- position: "absolute",
1488
- left: i.arrowX,
1489
- top: i.arrowY,
1490
- [s]: 0,
1491
- transformOrigin: {
1492
- top: "",
1493
- right: "0 0",
1494
- bottom: "center 0",
1495
- left: "100% 0"
1496
- }[i.placedSide],
1497
- transform: {
1498
- top: "translateY(100%)",
1499
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
1500
- bottom: "rotate(180deg)",
1501
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
1502
- }[i.placedSide],
1503
- visibility: i.shouldHideArrow ? "hidden" : void 0
1504
- },
1505
- children: /* @__PURE__ */ j(
1506
- _n,
1507
- {
1508
- ...r,
1509
- ref: n,
1510
- style: {
1511
- ...r.style,
1512
- // ensures the element can be measured correctly (mostly for if SVG)
1513
- display: "block"
1514
- }
1515
- }
1516
- )
1517
- }
1518
- )
1519
- );
1520
- });
1521
- fe.displayName = ae;
1522
- function Xn(t) {
1523
- return t !== null;
1524
- }
1525
- var Yn = (t) => ({
1526
- name: "transformOrigin",
1527
- options: t,
1528
- fn(e) {
1529
- const { placement: n, rects: o, middlewareData: r } = e, s = r.arrow?.centerOffset !== 0, c = s ? 0 : t.arrowWidth, l = s ? 0 : t.arrowHeight, [a, f] = ue(n), u = { start: "0%", center: "50%", end: "100%" }[f], p = (r.arrow?.x ?? 0) + c / 2, d = (r.arrow?.y ?? 0) + l / 2;
1530
- let m = "", h = "";
1531
- return a === "bottom" ? (m = s ? u : `${p}px`, h = `${-l}px`) : a === "top" ? (m = s ? u : `${p}px`, h = `${o.floating.height + l}px`) : a === "right" ? (m = `${-l}px`, h = s ? u : `${d}px`) : a === "left" && (m = `${o.floating.width + l}px`, h = s ? u : `${d}px`), { data: { x: m, y: h } };
1532
- }
1533
- });
1534
- function ue(t) {
1535
- const [e, n = "center"] = t.split("-");
1536
- return [e, n];
1537
- }
1538
- var eo = ie, no = ce, oo = le, ro = fe;
1539
- export {
1540
- no as A,
1541
- oo as C,
1542
- eo as R,
1543
- ro as a,
1544
- to as c
1545
- };