@clevertask/react-sortable-tree 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3789 @@
1
+ import { jsx as _, jsxs as fn } from "react/jsx-runtime";
2
+ import j, { useMemo as T, useLayoutEffect as Qn, useEffect as k, useRef as z, useCallback as $, useState as V, createContext as Ke, memo as ut, useReducer as Nt, useContext as we, cloneElement as er, forwardRef as dt } from "react";
3
+ import { unstable_batchedUpdates as je, createPortal as gn } from "react-dom";
4
+ function tr() {
5
+ for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
6
+ t[n] = arguments[n];
7
+ return T(
8
+ () => (r) => {
9
+ t.forEach((o) => o(r));
10
+ },
11
+ // eslint-disable-next-line react-hooks/exhaustive-deps
12
+ t
13
+ );
14
+ }
15
+ const ft = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
16
+ function Ne(e) {
17
+ const t = Object.prototype.toString.call(e);
18
+ return t === "[object Window]" || // In Electron context the Window object serializes to [object global]
19
+ t === "[object global]";
20
+ }
21
+ function Lt(e) {
22
+ return "nodeType" in e;
23
+ }
24
+ function G(e) {
25
+ var t, n;
26
+ return e ? Ne(e) ? e : Lt(e) && (t = (n = e.ownerDocument) == null ? void 0 : n.defaultView) != null ? t : window : window;
27
+ }
28
+ function Pt(e) {
29
+ const {
30
+ Document: t
31
+ } = G(e);
32
+ return e instanceof t;
33
+ }
34
+ function Ue(e) {
35
+ return Ne(e) ? !1 : e instanceof G(e).HTMLElement;
36
+ }
37
+ function hn(e) {
38
+ return e instanceof G(e).SVGElement;
39
+ }
40
+ function Le(e) {
41
+ return e ? Ne(e) ? e.document : Lt(e) ? Pt(e) ? e : Ue(e) || hn(e) ? e.ownerDocument : document : document : document;
42
+ }
43
+ const ie = ft ? Qn : k;
44
+ function gt(e) {
45
+ const t = z(e);
46
+ return ie(() => {
47
+ t.current = e;
48
+ }), $(function() {
49
+ for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
50
+ r[o] = arguments[o];
51
+ return t.current == null ? void 0 : t.current(...r);
52
+ }, []);
53
+ }
54
+ function nr() {
55
+ const e = z(null), t = $((r, o) => {
56
+ e.current = setInterval(r, o);
57
+ }, []), n = $(() => {
58
+ e.current !== null && (clearInterval(e.current), e.current = null);
59
+ }, []);
60
+ return [t, n];
61
+ }
62
+ function Ye(e, t) {
63
+ t === void 0 && (t = [e]);
64
+ const n = z(e);
65
+ return ie(() => {
66
+ n.current !== e && (n.current = e);
67
+ }, t), n;
68
+ }
69
+ function We(e, t) {
70
+ const n = z();
71
+ return T(
72
+ () => {
73
+ const r = e(n.current);
74
+ return n.current = r, r;
75
+ },
76
+ // eslint-disable-next-line react-hooks/exhaustive-deps
77
+ [...t]
78
+ );
79
+ }
80
+ function ot(e) {
81
+ const t = gt(e), n = z(null), r = $(
82
+ (o) => {
83
+ o !== n.current && (t == null || t(o, n.current)), n.current = o;
84
+ },
85
+ //eslint-disable-next-line
86
+ []
87
+ );
88
+ return [n, r];
89
+ }
90
+ function it(e) {
91
+ const t = z();
92
+ return k(() => {
93
+ t.current = e;
94
+ }, [e]), t.current;
95
+ }
96
+ let wt = {};
97
+ function Je(e, t) {
98
+ return T(() => {
99
+ if (t)
100
+ return t;
101
+ const n = wt[e] == null ? 0 : wt[e] + 1;
102
+ return wt[e] = n, e + "-" + n;
103
+ }, [e, t]);
104
+ }
105
+ function pn(e) {
106
+ return function(t) {
107
+ for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++)
108
+ r[o - 1] = arguments[o];
109
+ return r.reduce((i, s) => {
110
+ const a = Object.entries(s);
111
+ for (const [l, c] of a) {
112
+ const u = i[l];
113
+ u != null && (i[l] = u + e * c);
114
+ }
115
+ return i;
116
+ }, {
117
+ ...t
118
+ });
119
+ };
120
+ }
121
+ const Ae = /* @__PURE__ */ pn(1), st = /* @__PURE__ */ pn(-1);
122
+ function rr(e) {
123
+ return "clientX" in e && "clientY" in e;
124
+ }
125
+ function ht(e) {
126
+ if (!e)
127
+ return !1;
128
+ const {
129
+ KeyboardEvent: t
130
+ } = G(e.target);
131
+ return t && e instanceof t;
132
+ }
133
+ function or(e) {
134
+ if (!e)
135
+ return !1;
136
+ const {
137
+ TouchEvent: t
138
+ } = G(e.target);
139
+ return t && e instanceof t;
140
+ }
141
+ function at(e) {
142
+ if (or(e)) {
143
+ if (e.touches && e.touches.length) {
144
+ const {
145
+ clientX: t,
146
+ clientY: n
147
+ } = e.touches[0];
148
+ return {
149
+ x: t,
150
+ y: n
151
+ };
152
+ } else if (e.changedTouches && e.changedTouches.length) {
153
+ const {
154
+ clientX: t,
155
+ clientY: n
156
+ } = e.changedTouches[0];
157
+ return {
158
+ x: t,
159
+ y: n
160
+ };
161
+ }
162
+ }
163
+ return rr(e) ? {
164
+ x: e.clientX,
165
+ y: e.clientY
166
+ } : null;
167
+ }
168
+ const ge = /* @__PURE__ */ Object.freeze({
169
+ Translate: {
170
+ toString(e) {
171
+ if (!e)
172
+ return;
173
+ const {
174
+ x: t,
175
+ y: n
176
+ } = e;
177
+ return "translate3d(" + (t ? Math.round(t) : 0) + "px, " + (n ? Math.round(n) : 0) + "px, 0)";
178
+ }
179
+ },
180
+ Scale: {
181
+ toString(e) {
182
+ if (!e)
183
+ return;
184
+ const {
185
+ scaleX: t,
186
+ scaleY: n
187
+ } = e;
188
+ return "scaleX(" + t + ") scaleY(" + n + ")";
189
+ }
190
+ },
191
+ Transform: {
192
+ toString(e) {
193
+ if (e)
194
+ return [ge.Translate.toString(e), ge.Scale.toString(e)].join(" ");
195
+ }
196
+ },
197
+ Transition: {
198
+ toString(e) {
199
+ let {
200
+ property: t,
201
+ duration: n,
202
+ easing: r
203
+ } = e;
204
+ return t + " " + n + "ms " + r;
205
+ }
206
+ }
207
+ }), qt = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
208
+ function ir(e) {
209
+ return e.matches(qt) ? e : e.querySelector(qt);
210
+ }
211
+ const sr = {
212
+ display: "none"
213
+ };
214
+ function ar(e) {
215
+ let {
216
+ id: t,
217
+ value: n
218
+ } = e;
219
+ return j.createElement("div", {
220
+ id: t,
221
+ style: sr
222
+ }, n);
223
+ }
224
+ function lr(e) {
225
+ let {
226
+ id: t,
227
+ announcement: n,
228
+ ariaLiveType: r = "assertive"
229
+ } = e;
230
+ const o = {
231
+ position: "fixed",
232
+ width: 1,
233
+ height: 1,
234
+ margin: -1,
235
+ border: 0,
236
+ padding: 0,
237
+ overflow: "hidden",
238
+ clip: "rect(0 0 0 0)",
239
+ clipPath: "inset(100%)",
240
+ whiteSpace: "nowrap"
241
+ };
242
+ return j.createElement("div", {
243
+ id: t,
244
+ style: o,
245
+ role: "status",
246
+ "aria-live": r,
247
+ "aria-atomic": !0
248
+ }, n);
249
+ }
250
+ function cr() {
251
+ const [e, t] = V("");
252
+ return {
253
+ announce: $((r) => {
254
+ r != null && t(r);
255
+ }, []),
256
+ announcement: e
257
+ };
258
+ }
259
+ const vn = /* @__PURE__ */ Ke(null);
260
+ function ur(e) {
261
+ const t = we(vn);
262
+ k(() => {
263
+ if (!t)
264
+ throw new Error("useDndMonitor must be used within a children of <DndContext>");
265
+ return t(e);
266
+ }, [e, t]);
267
+ }
268
+ function dr() {
269
+ const [e] = V(() => /* @__PURE__ */ new Set()), t = $((r) => (e.add(r), () => e.delete(r)), [e]);
270
+ return [$((r) => {
271
+ let {
272
+ type: o,
273
+ event: i
274
+ } = r;
275
+ e.forEach((s) => {
276
+ var a;
277
+ return (a = s[o]) == null ? void 0 : a.call(s, i);
278
+ });
279
+ }, [e]), t];
280
+ }
281
+ const fr = {
282
+ draggable: `
283
+ To pick up a draggable item, press the space bar.
284
+ While dragging, use the arrow keys to move the item.
285
+ Press space again to drop the item in its new position, or press escape to cancel.
286
+ `
287
+ }, gr = {
288
+ onDragStart(e) {
289
+ let {
290
+ active: t
291
+ } = e;
292
+ return "Picked up draggable item " + t.id + ".";
293
+ },
294
+ onDragOver(e) {
295
+ let {
296
+ active: t,
297
+ over: n
298
+ } = e;
299
+ return n ? "Draggable item " + t.id + " was moved over droppable area " + n.id + "." : "Draggable item " + t.id + " is no longer over a droppable area.";
300
+ },
301
+ onDragEnd(e) {
302
+ let {
303
+ active: t,
304
+ over: n
305
+ } = e;
306
+ return n ? "Draggable item " + t.id + " was dropped over droppable area " + n.id : "Draggable item " + t.id + " was dropped.";
307
+ },
308
+ onDragCancel(e) {
309
+ let {
310
+ active: t
311
+ } = e;
312
+ return "Dragging was cancelled. Draggable item " + t.id + " was dropped.";
313
+ }
314
+ };
315
+ function hr(e) {
316
+ let {
317
+ announcements: t = gr,
318
+ container: n,
319
+ hiddenTextDescribedById: r,
320
+ screenReaderInstructions: o = fr
321
+ } = e;
322
+ const {
323
+ announce: i,
324
+ announcement: s
325
+ } = cr(), a = Je("DndLiveRegion"), [l, c] = V(!1);
326
+ if (k(() => {
327
+ c(!0);
328
+ }, []), ur(T(() => ({
329
+ onDragStart(d) {
330
+ let {
331
+ active: f
332
+ } = d;
333
+ i(t.onDragStart({
334
+ active: f
335
+ }));
336
+ },
337
+ onDragMove(d) {
338
+ let {
339
+ active: f,
340
+ over: h
341
+ } = d;
342
+ t.onDragMove && i(t.onDragMove({
343
+ active: f,
344
+ over: h
345
+ }));
346
+ },
347
+ onDragOver(d) {
348
+ let {
349
+ active: f,
350
+ over: h
351
+ } = d;
352
+ i(t.onDragOver({
353
+ active: f,
354
+ over: h
355
+ }));
356
+ },
357
+ onDragEnd(d) {
358
+ let {
359
+ active: f,
360
+ over: h
361
+ } = d;
362
+ i(t.onDragEnd({
363
+ active: f,
364
+ over: h
365
+ }));
366
+ },
367
+ onDragCancel(d) {
368
+ let {
369
+ active: f,
370
+ over: h
371
+ } = d;
372
+ i(t.onDragCancel({
373
+ active: f,
374
+ over: h
375
+ }));
376
+ }
377
+ }), [i, t])), !l)
378
+ return null;
379
+ const u = j.createElement(j.Fragment, null, j.createElement(ar, {
380
+ id: r,
381
+ value: o.draggable
382
+ }), j.createElement(lr, {
383
+ id: a,
384
+ announcement: s
385
+ }));
386
+ return n ? gn(u, n) : u;
387
+ }
388
+ var X;
389
+ (function(e) {
390
+ e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
391
+ })(X || (X = {}));
392
+ function lt() {
393
+ }
394
+ function Gt(e, t) {
395
+ return T(
396
+ () => ({
397
+ sensor: e,
398
+ options: t ?? {}
399
+ }),
400
+ // eslint-disable-next-line react-hooks/exhaustive-deps
401
+ [e, t]
402
+ );
403
+ }
404
+ function pr() {
405
+ for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
406
+ t[n] = arguments[n];
407
+ return T(
408
+ () => [...t].filter((r) => r != null),
409
+ // eslint-disable-next-line react-hooks/exhaustive-deps
410
+ [...t]
411
+ );
412
+ }
413
+ const de = /* @__PURE__ */ Object.freeze({
414
+ x: 0,
415
+ y: 0
416
+ });
417
+ function bn(e, t) {
418
+ return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
419
+ }
420
+ function vr(e, t) {
421
+ const n = at(e);
422
+ if (!n)
423
+ return "0 0";
424
+ const r = {
425
+ x: (n.x - t.left) / t.width * 100,
426
+ y: (n.y - t.top) / t.height * 100
427
+ };
428
+ return r.x + "% " + r.y + "%";
429
+ }
430
+ function mn(e, t) {
431
+ let {
432
+ data: {
433
+ value: n
434
+ }
435
+ } = e, {
436
+ data: {
437
+ value: r
438
+ }
439
+ } = t;
440
+ return n - r;
441
+ }
442
+ function br(e, t) {
443
+ let {
444
+ data: {
445
+ value: n
446
+ }
447
+ } = e, {
448
+ data: {
449
+ value: r
450
+ }
451
+ } = t;
452
+ return r - n;
453
+ }
454
+ function Zt(e) {
455
+ let {
456
+ left: t,
457
+ top: n,
458
+ height: r,
459
+ width: o
460
+ } = e;
461
+ return [{
462
+ x: t,
463
+ y: n
464
+ }, {
465
+ x: t + o,
466
+ y: n
467
+ }, {
468
+ x: t,
469
+ y: n + r
470
+ }, {
471
+ x: t + o,
472
+ y: n + r
473
+ }];
474
+ }
475
+ function yn(e, t) {
476
+ if (!e || e.length === 0)
477
+ return null;
478
+ const [n] = e;
479
+ return n[t];
480
+ }
481
+ function Qt(e, t, n) {
482
+ return t === void 0 && (t = e.left), n === void 0 && (n = e.top), {
483
+ x: t + e.width * 0.5,
484
+ y: n + e.height * 0.5
485
+ };
486
+ }
487
+ const mr = (e) => {
488
+ let {
489
+ collisionRect: t,
490
+ droppableRects: n,
491
+ droppableContainers: r
492
+ } = e;
493
+ const o = Qt(t, t.left, t.top), i = [];
494
+ for (const s of r) {
495
+ const {
496
+ id: a
497
+ } = s, l = n.get(a);
498
+ if (l) {
499
+ const c = bn(Qt(l), o);
500
+ i.push({
501
+ id: a,
502
+ data: {
503
+ droppableContainer: s,
504
+ value: c
505
+ }
506
+ });
507
+ }
508
+ }
509
+ return i.sort(mn);
510
+ }, yr = (e) => {
511
+ let {
512
+ collisionRect: t,
513
+ droppableRects: n,
514
+ droppableContainers: r
515
+ } = e;
516
+ const o = Zt(t), i = [];
517
+ for (const s of r) {
518
+ const {
519
+ id: a
520
+ } = s, l = n.get(a);
521
+ if (l) {
522
+ const c = Zt(l), u = o.reduce((f, h, b) => f + bn(c[b], h), 0), d = Number((u / 4).toFixed(4));
523
+ i.push({
524
+ id: a,
525
+ data: {
526
+ droppableContainer: s,
527
+ value: d
528
+ }
529
+ });
530
+ }
531
+ }
532
+ return i.sort(mn);
533
+ };
534
+ function wr(e, t) {
535
+ const n = Math.max(t.top, e.top), r = Math.max(t.left, e.left), o = Math.min(t.left + t.width, e.left + e.width), i = Math.min(t.top + t.height, e.top + e.height), s = o - r, a = i - n;
536
+ if (r < o && n < i) {
537
+ const l = t.width * t.height, c = e.width * e.height, u = s * a, d = u / (l + c - u);
538
+ return Number(d.toFixed(4));
539
+ }
540
+ return 0;
541
+ }
542
+ const xr = (e) => {
543
+ let {
544
+ collisionRect: t,
545
+ droppableRects: n,
546
+ droppableContainers: r
547
+ } = e;
548
+ const o = [];
549
+ for (const i of r) {
550
+ const {
551
+ id: s
552
+ } = i, a = n.get(s);
553
+ if (a) {
554
+ const l = wr(a, t);
555
+ l > 0 && o.push({
556
+ id: s,
557
+ data: {
558
+ droppableContainer: i,
559
+ value: l
560
+ }
561
+ });
562
+ }
563
+ }
564
+ return o.sort(br);
565
+ };
566
+ function Dr(e, t, n) {
567
+ return {
568
+ ...e,
569
+ scaleX: t && n ? t.width / n.width : 1,
570
+ scaleY: t && n ? t.height / n.height : 1
571
+ };
572
+ }
573
+ function wn(e, t) {
574
+ return e && t ? {
575
+ x: e.left - t.left,
576
+ y: e.top - t.top
577
+ } : de;
578
+ }
579
+ function Cr(e) {
580
+ return function(n) {
581
+ for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
582
+ o[i - 1] = arguments[i];
583
+ return o.reduce((s, a) => ({
584
+ ...s,
585
+ top: s.top + e * a.y,
586
+ bottom: s.bottom + e * a.y,
587
+ left: s.left + e * a.x,
588
+ right: s.right + e * a.x
589
+ }), {
590
+ ...n
591
+ });
592
+ };
593
+ }
594
+ const Sr = /* @__PURE__ */ Cr(1);
595
+ function xn(e) {
596
+ if (e.startsWith("matrix3d(")) {
597
+ const t = e.slice(9, -1).split(/, /);
598
+ return {
599
+ x: +t[12],
600
+ y: +t[13],
601
+ scaleX: +t[0],
602
+ scaleY: +t[5]
603
+ };
604
+ } else if (e.startsWith("matrix(")) {
605
+ const t = e.slice(7, -1).split(/, /);
606
+ return {
607
+ x: +t[4],
608
+ y: +t[5],
609
+ scaleX: +t[0],
610
+ scaleY: +t[3]
611
+ };
612
+ }
613
+ return null;
614
+ }
615
+ function Ir(e, t, n) {
616
+ const r = xn(t);
617
+ if (!r)
618
+ return e;
619
+ const {
620
+ scaleX: o,
621
+ scaleY: i,
622
+ x: s,
623
+ y: a
624
+ } = r, l = e.left - s - (1 - o) * parseFloat(n), c = e.top - a - (1 - i) * parseFloat(n.slice(n.indexOf(" ") + 1)), u = o ? e.width / o : e.width, d = i ? e.height / i : e.height;
625
+ return {
626
+ width: u,
627
+ height: d,
628
+ top: c,
629
+ right: l + u,
630
+ bottom: c + d,
631
+ left: l
632
+ };
633
+ }
634
+ const Rr = {
635
+ ignoreTransform: !1
636
+ };
637
+ function Pe(e, t) {
638
+ t === void 0 && (t = Rr);
639
+ let n = e.getBoundingClientRect();
640
+ if (t.ignoreTransform) {
641
+ const {
642
+ transform: c,
643
+ transformOrigin: u
644
+ } = G(e).getComputedStyle(e);
645
+ c && (n = Ir(n, c, u));
646
+ }
647
+ const {
648
+ top: r,
649
+ left: o,
650
+ width: i,
651
+ height: s,
652
+ bottom: a,
653
+ right: l
654
+ } = n;
655
+ return {
656
+ top: r,
657
+ left: o,
658
+ width: i,
659
+ height: s,
660
+ bottom: a,
661
+ right: l
662
+ };
663
+ }
664
+ function en(e) {
665
+ return Pe(e, {
666
+ ignoreTransform: !0
667
+ });
668
+ }
669
+ function Er(e) {
670
+ const t = e.innerWidth, n = e.innerHeight;
671
+ return {
672
+ top: 0,
673
+ left: 0,
674
+ right: t,
675
+ bottom: n,
676
+ width: t,
677
+ height: n
678
+ };
679
+ }
680
+ function Or(e, t) {
681
+ return t === void 0 && (t = G(e).getComputedStyle(e)), t.position === "fixed";
682
+ }
683
+ function Tr(e, t) {
684
+ t === void 0 && (t = G(e).getComputedStyle(e));
685
+ const n = /(auto|scroll|overlay)/;
686
+ return ["overflow", "overflowX", "overflowY"].some((o) => {
687
+ const i = t[o];
688
+ return typeof i == "string" ? n.test(i) : !1;
689
+ });
690
+ }
691
+ function kt(e, t) {
692
+ const n = [];
693
+ function r(o) {
694
+ if (t != null && n.length >= t || !o)
695
+ return n;
696
+ if (Pt(o) && o.scrollingElement != null && !n.includes(o.scrollingElement))
697
+ return n.push(o.scrollingElement), n;
698
+ if (!Ue(o) || hn(o) || n.includes(o))
699
+ return n;
700
+ const i = G(e).getComputedStyle(o);
701
+ return o !== e && Tr(o, i) && n.push(o), Or(o, i) ? n : r(o.parentNode);
702
+ }
703
+ return e ? r(e) : n;
704
+ }
705
+ function Dn(e) {
706
+ const [t] = kt(e, 1);
707
+ return t ?? null;
708
+ }
709
+ function xt(e) {
710
+ return !ft || !e ? null : Ne(e) ? e : Lt(e) ? Pt(e) || e === Le(e).scrollingElement ? window : Ue(e) ? e : null : null;
711
+ }
712
+ function Cn(e) {
713
+ return Ne(e) ? e.scrollX : e.scrollLeft;
714
+ }
715
+ function Sn(e) {
716
+ return Ne(e) ? e.scrollY : e.scrollTop;
717
+ }
718
+ function Rt(e) {
719
+ return {
720
+ x: Cn(e),
721
+ y: Sn(e)
722
+ };
723
+ }
724
+ var Y;
725
+ (function(e) {
726
+ e[e.Forward = 1] = "Forward", e[e.Backward = -1] = "Backward";
727
+ })(Y || (Y = {}));
728
+ function In(e) {
729
+ return !ft || !e ? !1 : e === document.scrollingElement;
730
+ }
731
+ function Rn(e) {
732
+ const t = {
733
+ x: 0,
734
+ y: 0
735
+ }, n = In(e) ? {
736
+ height: window.innerHeight,
737
+ width: window.innerWidth
738
+ } : {
739
+ height: e.clientHeight,
740
+ width: e.clientWidth
741
+ }, r = {
742
+ x: e.scrollWidth - n.width,
743
+ y: e.scrollHeight - n.height
744
+ }, o = e.scrollTop <= t.y, i = e.scrollLeft <= t.x, s = e.scrollTop >= r.y, a = e.scrollLeft >= r.x;
745
+ return {
746
+ isTop: o,
747
+ isLeft: i,
748
+ isBottom: s,
749
+ isRight: a,
750
+ maxScroll: r,
751
+ minScroll: t
752
+ };
753
+ }
754
+ const Ar = {
755
+ x: 0.2,
756
+ y: 0.2
757
+ };
758
+ function Mr(e, t, n, r, o) {
759
+ let {
760
+ top: i,
761
+ left: s,
762
+ right: a,
763
+ bottom: l
764
+ } = n;
765
+ r === void 0 && (r = 10), o === void 0 && (o = Ar);
766
+ const {
767
+ isTop: c,
768
+ isBottom: u,
769
+ isLeft: d,
770
+ isRight: f
771
+ } = Rn(e), h = {
772
+ x: 0,
773
+ y: 0
774
+ }, b = {
775
+ x: 0,
776
+ y: 0
777
+ }, g = {
778
+ height: t.height * o.y,
779
+ width: t.width * o.x
780
+ };
781
+ return !c && i <= t.top + g.height ? (h.y = Y.Backward, b.y = r * Math.abs((t.top + g.height - i) / g.height)) : !u && l >= t.bottom - g.height && (h.y = Y.Forward, b.y = r * Math.abs((t.bottom - g.height - l) / g.height)), !f && a >= t.right - g.width ? (h.x = Y.Forward, b.x = r * Math.abs((t.right - g.width - a) / g.width)) : !d && s <= t.left + g.width && (h.x = Y.Backward, b.x = r * Math.abs((t.left + g.width - s) / g.width)), {
782
+ direction: h,
783
+ speed: b
784
+ };
785
+ }
786
+ function Nr(e) {
787
+ if (e === document.scrollingElement) {
788
+ const {
789
+ innerWidth: i,
790
+ innerHeight: s
791
+ } = window;
792
+ return {
793
+ top: 0,
794
+ left: 0,
795
+ right: i,
796
+ bottom: s,
797
+ width: i,
798
+ height: s
799
+ };
800
+ }
801
+ const {
802
+ top: t,
803
+ left: n,
804
+ right: r,
805
+ bottom: o
806
+ } = e.getBoundingClientRect();
807
+ return {
808
+ top: t,
809
+ left: n,
810
+ right: r,
811
+ bottom: o,
812
+ width: e.clientWidth,
813
+ height: e.clientHeight
814
+ };
815
+ }
816
+ function En(e) {
817
+ return e.reduce((t, n) => Ae(t, Rt(n)), de);
818
+ }
819
+ function Lr(e) {
820
+ return e.reduce((t, n) => t + Cn(n), 0);
821
+ }
822
+ function Pr(e) {
823
+ return e.reduce((t, n) => t + Sn(n), 0);
824
+ }
825
+ function On(e, t) {
826
+ if (t === void 0 && (t = Pe), !e)
827
+ return;
828
+ const {
829
+ top: n,
830
+ left: r,
831
+ bottom: o,
832
+ right: i
833
+ } = t(e);
834
+ Dn(e) && (o <= 0 || i <= 0 || n >= window.innerHeight || r >= window.innerWidth) && e.scrollIntoView({
835
+ block: "center",
836
+ inline: "center"
837
+ });
838
+ }
839
+ const kr = [["x", ["left", "right"], Lr], ["y", ["top", "bottom"], Pr]];
840
+ class zt {
841
+ constructor(t, n) {
842
+ this.rect = void 0, this.width = void 0, this.height = void 0, this.top = void 0, this.bottom = void 0, this.right = void 0, this.left = void 0;
843
+ const r = kt(n), o = En(r);
844
+ this.rect = {
845
+ ...t
846
+ }, this.width = t.width, this.height = t.height;
847
+ for (const [i, s, a] of kr)
848
+ for (const l of s)
849
+ Object.defineProperty(this, l, {
850
+ get: () => {
851
+ const c = a(r), u = o[i] - c;
852
+ return this.rect[l] + u;
853
+ },
854
+ enumerable: !0
855
+ });
856
+ Object.defineProperty(this, "rect", {
857
+ enumerable: !1
858
+ });
859
+ }
860
+ }
861
+ class Fe {
862
+ constructor(t) {
863
+ this.target = void 0, this.listeners = [], this.removeAll = () => {
864
+ this.listeners.forEach((n) => {
865
+ var r;
866
+ return (r = this.target) == null ? void 0 : r.removeEventListener(...n);
867
+ });
868
+ }, this.target = t;
869
+ }
870
+ add(t, n, r) {
871
+ var o;
872
+ (o = this.target) == null || o.addEventListener(t, n, r), this.listeners.push([t, n, r]);
873
+ }
874
+ }
875
+ function zr(e) {
876
+ const {
877
+ EventTarget: t
878
+ } = G(e);
879
+ return e instanceof t ? e : Le(e);
880
+ }
881
+ function Dt(e, t) {
882
+ const n = Math.abs(e.x), r = Math.abs(e.y);
883
+ return typeof t == "number" ? Math.sqrt(n ** 2 + r ** 2) > t : "x" in t && "y" in t ? n > t.x && r > t.y : "x" in t ? n > t.x : "y" in t ? r > t.y : !1;
884
+ }
885
+ var oe;
886
+ (function(e) {
887
+ e.Click = "click", e.DragStart = "dragstart", e.Keydown = "keydown", e.ContextMenu = "contextmenu", e.Resize = "resize", e.SelectionChange = "selectionchange", e.VisibilityChange = "visibilitychange";
888
+ })(oe || (oe = {}));
889
+ function tn(e) {
890
+ e.preventDefault();
891
+ }
892
+ function Br(e) {
893
+ e.stopPropagation();
894
+ }
895
+ var S;
896
+ (function(e) {
897
+ e.Space = "Space", e.Down = "ArrowDown", e.Right = "ArrowRight", e.Left = "ArrowLeft", e.Up = "ArrowUp", e.Esc = "Escape", e.Enter = "Enter";
898
+ })(S || (S = {}));
899
+ const Tn = {
900
+ start: [S.Space, S.Enter],
901
+ cancel: [S.Esc],
902
+ end: [S.Space, S.Enter]
903
+ }, $r = (e, t) => {
904
+ let {
905
+ currentCoordinates: n
906
+ } = t;
907
+ switch (e.code) {
908
+ case S.Right:
909
+ return {
910
+ ...n,
911
+ x: n.x + 25
912
+ };
913
+ case S.Left:
914
+ return {
915
+ ...n,
916
+ x: n.x - 25
917
+ };
918
+ case S.Down:
919
+ return {
920
+ ...n,
921
+ y: n.y + 25
922
+ };
923
+ case S.Up:
924
+ return {
925
+ ...n,
926
+ y: n.y - 25
927
+ };
928
+ }
929
+ };
930
+ class Bt {
931
+ constructor(t) {
932
+ this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = t;
933
+ const {
934
+ event: {
935
+ target: n
936
+ }
937
+ } = t;
938
+ this.props = t, this.listeners = new Fe(Le(n)), this.windowListeners = new Fe(G(n)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
939
+ }
940
+ attach() {
941
+ this.handleStart(), this.windowListeners.add(oe.Resize, this.handleCancel), this.windowListeners.add(oe.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(oe.Keydown, this.handleKeyDown));
942
+ }
943
+ handleStart() {
944
+ const {
945
+ activeNode: t,
946
+ onStart: n
947
+ } = this.props, r = t.node.current;
948
+ r && On(r), n(de);
949
+ }
950
+ handleKeyDown(t) {
951
+ if (ht(t)) {
952
+ const {
953
+ active: n,
954
+ context: r,
955
+ options: o
956
+ } = this.props, {
957
+ keyboardCodes: i = Tn,
958
+ coordinateGetter: s = $r,
959
+ scrollBehavior: a = "smooth"
960
+ } = o, {
961
+ code: l
962
+ } = t;
963
+ if (i.end.includes(l)) {
964
+ this.handleEnd(t);
965
+ return;
966
+ }
967
+ if (i.cancel.includes(l)) {
968
+ this.handleCancel(t);
969
+ return;
970
+ }
971
+ const {
972
+ collisionRect: c
973
+ } = r.current, u = c ? {
974
+ x: c.left,
975
+ y: c.top
976
+ } : de;
977
+ this.referenceCoordinates || (this.referenceCoordinates = u);
978
+ const d = s(t, {
979
+ active: n,
980
+ context: r.current,
981
+ currentCoordinates: u
982
+ });
983
+ if (d) {
984
+ const f = st(d, u), h = {
985
+ x: 0,
986
+ y: 0
987
+ }, {
988
+ scrollableAncestors: b
989
+ } = r.current;
990
+ for (const g of b) {
991
+ const p = t.code, {
992
+ isTop: m,
993
+ isRight: w,
994
+ isLeft: y,
995
+ isBottom: C,
996
+ maxScroll: x,
997
+ minScroll: I
998
+ } = Rn(g), R = Nr(g), E = {
999
+ x: Math.min(p === S.Right ? R.right - R.width / 2 : R.right, Math.max(p === S.Right ? R.left : R.left + R.width / 2, d.x)),
1000
+ y: Math.min(p === S.Down ? R.bottom - R.height / 2 : R.bottom, Math.max(p === S.Down ? R.top : R.top + R.height / 2, d.y))
1001
+ }, N = p === S.Right && !w || p === S.Left && !y, B = p === S.Down && !C || p === S.Up && !m;
1002
+ if (N && E.x !== d.x) {
1003
+ const A = g.scrollLeft + f.x, Z = p === S.Right && A <= x.x || p === S.Left && A >= I.x;
1004
+ if (Z && !f.y) {
1005
+ g.scrollTo({
1006
+ left: A,
1007
+ behavior: a
1008
+ });
1009
+ return;
1010
+ }
1011
+ Z ? h.x = g.scrollLeft - A : h.x = p === S.Right ? g.scrollLeft - x.x : g.scrollLeft - I.x, h.x && g.scrollBy({
1012
+ left: -h.x,
1013
+ behavior: a
1014
+ });
1015
+ break;
1016
+ } else if (B && E.y !== d.y) {
1017
+ const A = g.scrollTop + f.y, Z = p === S.Down && A <= x.y || p === S.Up && A >= I.y;
1018
+ if (Z && !f.x) {
1019
+ g.scrollTo({
1020
+ top: A,
1021
+ behavior: a
1022
+ });
1023
+ return;
1024
+ }
1025
+ Z ? h.y = g.scrollTop - A : h.y = p === S.Down ? g.scrollTop - x.y : g.scrollTop - I.y, h.y && g.scrollBy({
1026
+ top: -h.y,
1027
+ behavior: a
1028
+ });
1029
+ break;
1030
+ }
1031
+ }
1032
+ this.handleMove(t, Ae(st(d, this.referenceCoordinates), h));
1033
+ }
1034
+ }
1035
+ }
1036
+ handleMove(t, n) {
1037
+ const {
1038
+ onMove: r
1039
+ } = this.props;
1040
+ t.preventDefault(), r(n);
1041
+ }
1042
+ handleEnd(t) {
1043
+ const {
1044
+ onEnd: n
1045
+ } = this.props;
1046
+ t.preventDefault(), this.detach(), n();
1047
+ }
1048
+ handleCancel(t) {
1049
+ const {
1050
+ onCancel: n
1051
+ } = this.props;
1052
+ t.preventDefault(), this.detach(), n();
1053
+ }
1054
+ detach() {
1055
+ this.listeners.removeAll(), this.windowListeners.removeAll();
1056
+ }
1057
+ }
1058
+ Bt.activators = [{
1059
+ eventName: "onKeyDown",
1060
+ handler: (e, t, n) => {
1061
+ let {
1062
+ keyboardCodes: r = Tn,
1063
+ onActivation: o
1064
+ } = t, {
1065
+ active: i
1066
+ } = n;
1067
+ const {
1068
+ code: s
1069
+ } = e.nativeEvent;
1070
+ if (r.start.includes(s)) {
1071
+ const a = i.activatorNode.current;
1072
+ return a && e.target !== a ? !1 : (e.preventDefault(), o == null || o({
1073
+ event: e.nativeEvent
1074
+ }), !0);
1075
+ }
1076
+ return !1;
1077
+ }
1078
+ }];
1079
+ function nn(e) {
1080
+ return !!(e && "distance" in e);
1081
+ }
1082
+ function rn(e) {
1083
+ return !!(e && "delay" in e);
1084
+ }
1085
+ class $t {
1086
+ constructor(t, n, r) {
1087
+ var o;
1088
+ r === void 0 && (r = zr(t.event.target)), this.props = void 0, this.events = void 0, this.autoScrollEnabled = !0, this.document = void 0, this.activated = !1, this.initialCoordinates = void 0, this.timeoutId = null, this.listeners = void 0, this.documentListeners = void 0, this.windowListeners = void 0, this.props = t, this.events = n;
1089
+ const {
1090
+ event: i
1091
+ } = t, {
1092
+ target: s
1093
+ } = i;
1094
+ this.props = t, this.events = n, this.document = Le(s), this.documentListeners = new Fe(this.document), this.listeners = new Fe(r), this.windowListeners = new Fe(G(s)), this.initialCoordinates = (o = at(i)) != null ? o : de, this.handleStart = this.handleStart.bind(this), this.handleMove = this.handleMove.bind(this), this.handleEnd = this.handleEnd.bind(this), this.handleCancel = this.handleCancel.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.removeTextSelection = this.removeTextSelection.bind(this), this.attach();
1095
+ }
1096
+ attach() {
1097
+ const {
1098
+ events: t,
1099
+ props: {
1100
+ options: {
1101
+ activationConstraint: n,
1102
+ bypassActivationConstraint: r
1103
+ }
1104
+ }
1105
+ } = this;
1106
+ if (this.listeners.add(t.move.name, this.handleMove, {
1107
+ passive: !1
1108
+ }), this.listeners.add(t.end.name, this.handleEnd), this.windowListeners.add(oe.Resize, this.handleCancel), this.windowListeners.add(oe.DragStart, tn), this.windowListeners.add(oe.VisibilityChange, this.handleCancel), this.windowListeners.add(oe.ContextMenu, tn), this.documentListeners.add(oe.Keydown, this.handleKeydown), n) {
1109
+ if (r != null && r({
1110
+ event: this.props.event,
1111
+ activeNode: this.props.activeNode,
1112
+ options: this.props.options
1113
+ }))
1114
+ return this.handleStart();
1115
+ if (rn(n)) {
1116
+ this.timeoutId = setTimeout(this.handleStart, n.delay);
1117
+ return;
1118
+ }
1119
+ if (nn(n))
1120
+ return;
1121
+ }
1122
+ this.handleStart();
1123
+ }
1124
+ detach() {
1125
+ this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
1126
+ }
1127
+ handleStart() {
1128
+ const {
1129
+ initialCoordinates: t
1130
+ } = this, {
1131
+ onStart: n
1132
+ } = this.props;
1133
+ t && (this.activated = !0, this.documentListeners.add(oe.Click, Br, {
1134
+ capture: !0
1135
+ }), this.removeTextSelection(), this.documentListeners.add(oe.SelectionChange, this.removeTextSelection), n(t));
1136
+ }
1137
+ handleMove(t) {
1138
+ var n;
1139
+ const {
1140
+ activated: r,
1141
+ initialCoordinates: o,
1142
+ props: i
1143
+ } = this, {
1144
+ onMove: s,
1145
+ options: {
1146
+ activationConstraint: a
1147
+ }
1148
+ } = i;
1149
+ if (!o)
1150
+ return;
1151
+ const l = (n = at(t)) != null ? n : de, c = st(o, l);
1152
+ if (!r && a) {
1153
+ if (nn(a)) {
1154
+ if (a.tolerance != null && Dt(c, a.tolerance))
1155
+ return this.handleCancel();
1156
+ if (Dt(c, a.distance))
1157
+ return this.handleStart();
1158
+ }
1159
+ return rn(a) && Dt(c, a.tolerance) ? this.handleCancel() : void 0;
1160
+ }
1161
+ t.cancelable && t.preventDefault(), s(l);
1162
+ }
1163
+ handleEnd() {
1164
+ const {
1165
+ onEnd: t
1166
+ } = this.props;
1167
+ this.detach(), t();
1168
+ }
1169
+ handleCancel() {
1170
+ const {
1171
+ onCancel: t
1172
+ } = this.props;
1173
+ this.detach(), t();
1174
+ }
1175
+ handleKeydown(t) {
1176
+ t.code === S.Esc && this.handleCancel();
1177
+ }
1178
+ removeTextSelection() {
1179
+ var t;
1180
+ (t = this.document.getSelection()) == null || t.removeAllRanges();
1181
+ }
1182
+ }
1183
+ const _r = {
1184
+ move: {
1185
+ name: "pointermove"
1186
+ },
1187
+ end: {
1188
+ name: "pointerup"
1189
+ }
1190
+ };
1191
+ class _t extends $t {
1192
+ constructor(t) {
1193
+ const {
1194
+ event: n
1195
+ } = t, r = Le(n.target);
1196
+ super(t, _r, r);
1197
+ }
1198
+ }
1199
+ _t.activators = [{
1200
+ eventName: "onPointerDown",
1201
+ handler: (e, t) => {
1202
+ let {
1203
+ nativeEvent: n
1204
+ } = e, {
1205
+ onActivation: r
1206
+ } = t;
1207
+ return !n.isPrimary || n.button !== 0 ? !1 : (r == null || r({
1208
+ event: n
1209
+ }), !0);
1210
+ }
1211
+ }];
1212
+ const jr = {
1213
+ move: {
1214
+ name: "mousemove"
1215
+ },
1216
+ end: {
1217
+ name: "mouseup"
1218
+ }
1219
+ };
1220
+ var Et;
1221
+ (function(e) {
1222
+ e[e.RightClick = 2] = "RightClick";
1223
+ })(Et || (Et = {}));
1224
+ class Fr extends $t {
1225
+ constructor(t) {
1226
+ super(t, jr, Le(t.event.target));
1227
+ }
1228
+ }
1229
+ Fr.activators = [{
1230
+ eventName: "onMouseDown",
1231
+ handler: (e, t) => {
1232
+ let {
1233
+ nativeEvent: n
1234
+ } = e, {
1235
+ onActivation: r
1236
+ } = t;
1237
+ return n.button === Et.RightClick ? !1 : (r == null || r({
1238
+ event: n
1239
+ }), !0);
1240
+ }
1241
+ }];
1242
+ const Ct = {
1243
+ move: {
1244
+ name: "touchmove"
1245
+ },
1246
+ end: {
1247
+ name: "touchend"
1248
+ }
1249
+ };
1250
+ class Hr extends $t {
1251
+ constructor(t) {
1252
+ super(t, Ct);
1253
+ }
1254
+ static setup() {
1255
+ return window.addEventListener(Ct.move.name, t, {
1256
+ capture: !1,
1257
+ passive: !1
1258
+ }), function() {
1259
+ window.removeEventListener(Ct.move.name, t);
1260
+ };
1261
+ function t() {
1262
+ }
1263
+ }
1264
+ }
1265
+ Hr.activators = [{
1266
+ eventName: "onTouchStart",
1267
+ handler: (e, t) => {
1268
+ let {
1269
+ nativeEvent: n
1270
+ } = e, {
1271
+ onActivation: r
1272
+ } = t;
1273
+ const {
1274
+ touches: o
1275
+ } = n;
1276
+ return o.length > 1 ? !1 : (r == null || r({
1277
+ event: n
1278
+ }), !0);
1279
+ }
1280
+ }];
1281
+ var He;
1282
+ (function(e) {
1283
+ e[e.Pointer = 0] = "Pointer", e[e.DraggableRect = 1] = "DraggableRect";
1284
+ })(He || (He = {}));
1285
+ var ct;
1286
+ (function(e) {
1287
+ e[e.TreeOrder = 0] = "TreeOrder", e[e.ReversedTreeOrder = 1] = "ReversedTreeOrder";
1288
+ })(ct || (ct = {}));
1289
+ function Xr(e) {
1290
+ let {
1291
+ acceleration: t,
1292
+ activator: n = He.Pointer,
1293
+ canScroll: r,
1294
+ draggingRect: o,
1295
+ enabled: i,
1296
+ interval: s = 5,
1297
+ order: a = ct.TreeOrder,
1298
+ pointerCoordinates: l,
1299
+ scrollableAncestors: c,
1300
+ scrollableAncestorRects: u,
1301
+ delta: d,
1302
+ threshold: f
1303
+ } = e;
1304
+ const h = Vr({
1305
+ delta: d,
1306
+ disabled: !i
1307
+ }), [b, g] = nr(), p = z({
1308
+ x: 0,
1309
+ y: 0
1310
+ }), m = z({
1311
+ x: 0,
1312
+ y: 0
1313
+ }), w = T(() => {
1314
+ switch (n) {
1315
+ case He.Pointer:
1316
+ return l ? {
1317
+ top: l.y,
1318
+ bottom: l.y,
1319
+ left: l.x,
1320
+ right: l.x
1321
+ } : null;
1322
+ case He.DraggableRect:
1323
+ return o;
1324
+ }
1325
+ }, [n, o, l]), y = z(null), C = $(() => {
1326
+ const I = y.current;
1327
+ if (!I)
1328
+ return;
1329
+ const R = p.current.x * m.current.x, E = p.current.y * m.current.y;
1330
+ I.scrollBy(R, E);
1331
+ }, []), x = T(() => a === ct.TreeOrder ? [...c].reverse() : c, [a, c]);
1332
+ k(
1333
+ () => {
1334
+ if (!i || !c.length || !w) {
1335
+ g();
1336
+ return;
1337
+ }
1338
+ for (const I of x) {
1339
+ if ((r == null ? void 0 : r(I)) === !1)
1340
+ continue;
1341
+ const R = c.indexOf(I), E = u[R];
1342
+ if (!E)
1343
+ continue;
1344
+ const {
1345
+ direction: N,
1346
+ speed: B
1347
+ } = Mr(I, E, w, t, f);
1348
+ for (const A of ["x", "y"])
1349
+ h[A][N[A]] || (B[A] = 0, N[A] = 0);
1350
+ if (B.x > 0 || B.y > 0) {
1351
+ g(), y.current = I, b(C, s), p.current = B, m.current = N;
1352
+ return;
1353
+ }
1354
+ }
1355
+ p.current = {
1356
+ x: 0,
1357
+ y: 0
1358
+ }, m.current = {
1359
+ x: 0,
1360
+ y: 0
1361
+ }, g();
1362
+ },
1363
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1364
+ [
1365
+ t,
1366
+ C,
1367
+ r,
1368
+ g,
1369
+ i,
1370
+ s,
1371
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1372
+ JSON.stringify(w),
1373
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1374
+ JSON.stringify(h),
1375
+ b,
1376
+ c,
1377
+ x,
1378
+ u,
1379
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1380
+ JSON.stringify(f)
1381
+ ]
1382
+ );
1383
+ }
1384
+ const Yr = {
1385
+ x: {
1386
+ [Y.Backward]: !1,
1387
+ [Y.Forward]: !1
1388
+ },
1389
+ y: {
1390
+ [Y.Backward]: !1,
1391
+ [Y.Forward]: !1
1392
+ }
1393
+ };
1394
+ function Vr(e) {
1395
+ let {
1396
+ delta: t,
1397
+ disabled: n
1398
+ } = e;
1399
+ const r = it(t);
1400
+ return We((o) => {
1401
+ if (n || !r || !o)
1402
+ return Yr;
1403
+ const i = {
1404
+ x: Math.sign(t.x - r.x),
1405
+ y: Math.sign(t.y - r.y)
1406
+ };
1407
+ return {
1408
+ x: {
1409
+ [Y.Backward]: o.x[Y.Backward] || i.x === -1,
1410
+ [Y.Forward]: o.x[Y.Forward] || i.x === 1
1411
+ },
1412
+ y: {
1413
+ [Y.Backward]: o.y[Y.Backward] || i.y === -1,
1414
+ [Y.Forward]: o.y[Y.Forward] || i.y === 1
1415
+ }
1416
+ };
1417
+ }, [n, t, r]);
1418
+ }
1419
+ function Kr(e, t) {
1420
+ const n = t !== null ? e.get(t) : void 0, r = n ? n.node.current : null;
1421
+ return We((o) => {
1422
+ var i;
1423
+ return t === null ? null : (i = r ?? o) != null ? i : null;
1424
+ }, [r, t]);
1425
+ }
1426
+ function Ur(e, t) {
1427
+ return T(() => e.reduce((n, r) => {
1428
+ const {
1429
+ sensor: o
1430
+ } = r, i = o.activators.map((s) => ({
1431
+ eventName: s.eventName,
1432
+ handler: t(s.handler, r)
1433
+ }));
1434
+ return [...n, ...i];
1435
+ }, []), [e, t]);
1436
+ }
1437
+ var Me;
1438
+ (function(e) {
1439
+ e[e.Always = 0] = "Always", e[e.BeforeDragging = 1] = "BeforeDragging", e[e.WhileDragging = 2] = "WhileDragging";
1440
+ })(Me || (Me = {}));
1441
+ var Ot;
1442
+ (function(e) {
1443
+ e.Optimized = "optimized";
1444
+ })(Ot || (Ot = {}));
1445
+ const on = /* @__PURE__ */ new Map();
1446
+ function Wr(e, t) {
1447
+ let {
1448
+ dragging: n,
1449
+ dependencies: r,
1450
+ config: o
1451
+ } = t;
1452
+ const [i, s] = V(null), {
1453
+ frequency: a,
1454
+ measure: l,
1455
+ strategy: c
1456
+ } = o, u = z(e), d = p(), f = Ye(d), h = $(function(m) {
1457
+ m === void 0 && (m = []), !f.current && s((w) => w === null ? m : w.concat(m.filter((y) => !w.includes(y))));
1458
+ }, [f]), b = z(null), g = We((m) => {
1459
+ if (d && !n)
1460
+ return on;
1461
+ if (!m || m === on || u.current !== e || i != null) {
1462
+ const w = /* @__PURE__ */ new Map();
1463
+ for (let y of e) {
1464
+ if (!y)
1465
+ continue;
1466
+ if (i && i.length > 0 && !i.includes(y.id) && y.rect.current) {
1467
+ w.set(y.id, y.rect.current);
1468
+ continue;
1469
+ }
1470
+ const C = y.node.current, x = C ? new zt(l(C), C) : null;
1471
+ y.rect.current = x, x && w.set(y.id, x);
1472
+ }
1473
+ return w;
1474
+ }
1475
+ return m;
1476
+ }, [e, i, n, d, l]);
1477
+ return k(() => {
1478
+ u.current = e;
1479
+ }, [e]), k(
1480
+ () => {
1481
+ d || h();
1482
+ },
1483
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1484
+ [n, d]
1485
+ ), k(
1486
+ () => {
1487
+ i && i.length > 0 && s(null);
1488
+ },
1489
+ //eslint-disable-next-line react-hooks/exhaustive-deps
1490
+ [JSON.stringify(i)]
1491
+ ), k(
1492
+ () => {
1493
+ d || typeof a != "number" || b.current !== null || (b.current = setTimeout(() => {
1494
+ h(), b.current = null;
1495
+ }, a));
1496
+ },
1497
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1498
+ [a, d, h, ...r]
1499
+ ), {
1500
+ droppableRects: g,
1501
+ measureDroppableContainers: h,
1502
+ measuringScheduled: i != null
1503
+ };
1504
+ function p() {
1505
+ switch (c) {
1506
+ case Me.Always:
1507
+ return !1;
1508
+ case Me.BeforeDragging:
1509
+ return n;
1510
+ default:
1511
+ return !n;
1512
+ }
1513
+ }
1514
+ }
1515
+ function jt(e, t) {
1516
+ return We((n) => e ? n || (typeof t == "function" ? t(e) : e) : null, [t, e]);
1517
+ }
1518
+ function Jr(e, t) {
1519
+ return jt(e, t);
1520
+ }
1521
+ function qr(e) {
1522
+ let {
1523
+ callback: t,
1524
+ disabled: n
1525
+ } = e;
1526
+ const r = gt(t), o = T(() => {
1527
+ if (n || typeof window > "u" || typeof window.MutationObserver > "u")
1528
+ return;
1529
+ const {
1530
+ MutationObserver: i
1531
+ } = window;
1532
+ return new i(r);
1533
+ }, [r, n]);
1534
+ return k(() => () => o == null ? void 0 : o.disconnect(), [o]), o;
1535
+ }
1536
+ function pt(e) {
1537
+ let {
1538
+ callback: t,
1539
+ disabled: n
1540
+ } = e;
1541
+ const r = gt(t), o = T(
1542
+ () => {
1543
+ if (n || typeof window > "u" || typeof window.ResizeObserver > "u")
1544
+ return;
1545
+ const {
1546
+ ResizeObserver: i
1547
+ } = window;
1548
+ return new i(r);
1549
+ },
1550
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1551
+ [n]
1552
+ );
1553
+ return k(() => () => o == null ? void 0 : o.disconnect(), [o]), o;
1554
+ }
1555
+ function Gr(e) {
1556
+ return new zt(Pe(e), e);
1557
+ }
1558
+ function sn(e, t, n) {
1559
+ t === void 0 && (t = Gr);
1560
+ const [r, o] = Nt(a, null), i = qr({
1561
+ callback(l) {
1562
+ if (e)
1563
+ for (const c of l) {
1564
+ const {
1565
+ type: u,
1566
+ target: d
1567
+ } = c;
1568
+ if (u === "childList" && d instanceof HTMLElement && d.contains(e)) {
1569
+ o();
1570
+ break;
1571
+ }
1572
+ }
1573
+ }
1574
+ }), s = pt({
1575
+ callback: o
1576
+ });
1577
+ return ie(() => {
1578
+ o(), e ? (s == null || s.observe(e), i == null || i.observe(document.body, {
1579
+ childList: !0,
1580
+ subtree: !0
1581
+ })) : (s == null || s.disconnect(), i == null || i.disconnect());
1582
+ }, [e]), r;
1583
+ function a(l) {
1584
+ if (!e)
1585
+ return null;
1586
+ if (e.isConnected === !1) {
1587
+ var c;
1588
+ return (c = l ?? n) != null ? c : null;
1589
+ }
1590
+ const u = t(e);
1591
+ return JSON.stringify(l) === JSON.stringify(u) ? l : u;
1592
+ }
1593
+ }
1594
+ function Zr(e) {
1595
+ const t = jt(e);
1596
+ return wn(e, t);
1597
+ }
1598
+ const an = [];
1599
+ function Qr(e) {
1600
+ const t = z(e), n = We((r) => e ? r && r !== an && e && t.current && e.parentNode === t.current.parentNode ? r : kt(e) : an, [e]);
1601
+ return k(() => {
1602
+ t.current = e;
1603
+ }, [e]), n;
1604
+ }
1605
+ function eo(e) {
1606
+ const [t, n] = V(null), r = z(e), o = $((i) => {
1607
+ const s = xt(i.target);
1608
+ s && n((a) => a ? (a.set(s, Rt(s)), new Map(a)) : null);
1609
+ }, []);
1610
+ return k(() => {
1611
+ const i = r.current;
1612
+ if (e !== i) {
1613
+ s(i);
1614
+ const a = e.map((l) => {
1615
+ const c = xt(l);
1616
+ return c ? (c.addEventListener("scroll", o, {
1617
+ passive: !0
1618
+ }), [c, Rt(c)]) : null;
1619
+ }).filter((l) => l != null);
1620
+ n(a.length ? new Map(a) : null), r.current = e;
1621
+ }
1622
+ return () => {
1623
+ s(e), s(i);
1624
+ };
1625
+ function s(a) {
1626
+ a.forEach((l) => {
1627
+ const c = xt(l);
1628
+ c == null || c.removeEventListener("scroll", o);
1629
+ });
1630
+ }
1631
+ }, [o, e]), T(() => e.length ? t ? Array.from(t.values()).reduce((i, s) => Ae(i, s), de) : En(e) : de, [e, t]);
1632
+ }
1633
+ function ln(e, t) {
1634
+ t === void 0 && (t = []);
1635
+ const n = z(null);
1636
+ return k(
1637
+ () => {
1638
+ n.current = null;
1639
+ },
1640
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1641
+ t
1642
+ ), k(() => {
1643
+ const r = e !== de;
1644
+ r && !n.current && (n.current = e), !r && n.current && (n.current = null);
1645
+ }, [e]), n.current ? st(e, n.current) : de;
1646
+ }
1647
+ function to(e) {
1648
+ k(
1649
+ () => {
1650
+ if (!ft)
1651
+ return;
1652
+ const t = e.map((n) => {
1653
+ let {
1654
+ sensor: r
1655
+ } = n;
1656
+ return r.setup == null ? void 0 : r.setup();
1657
+ });
1658
+ return () => {
1659
+ for (const n of t)
1660
+ n == null || n();
1661
+ };
1662
+ },
1663
+ // TO-DO: Sensors length could theoretically change which would not be a valid dependency
1664
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1665
+ e.map((t) => {
1666
+ let {
1667
+ sensor: n
1668
+ } = t;
1669
+ return n;
1670
+ })
1671
+ );
1672
+ }
1673
+ function no(e, t) {
1674
+ return T(() => e.reduce((n, r) => {
1675
+ let {
1676
+ eventName: o,
1677
+ handler: i
1678
+ } = r;
1679
+ return n[o] = (s) => {
1680
+ i(s, t);
1681
+ }, n;
1682
+ }, {}), [e, t]);
1683
+ }
1684
+ function An(e) {
1685
+ return T(() => e ? Er(e) : null, [e]);
1686
+ }
1687
+ const St = [];
1688
+ function ro(e, t) {
1689
+ t === void 0 && (t = Pe);
1690
+ const [n] = e, r = An(n ? G(n) : null), [o, i] = Nt(a, St), s = pt({
1691
+ callback: i
1692
+ });
1693
+ return e.length > 0 && o === St && i(), ie(() => {
1694
+ e.length ? e.forEach((l) => s == null ? void 0 : s.observe(l)) : (s == null || s.disconnect(), i());
1695
+ }, [e]), o;
1696
+ function a() {
1697
+ return e.length ? e.map((l) => In(l) ? r : new zt(t(l), l)) : St;
1698
+ }
1699
+ }
1700
+ function Mn(e) {
1701
+ if (!e)
1702
+ return null;
1703
+ if (e.children.length > 1)
1704
+ return e;
1705
+ const t = e.children[0];
1706
+ return Ue(t) ? t : e;
1707
+ }
1708
+ function oo(e) {
1709
+ let {
1710
+ measure: t
1711
+ } = e;
1712
+ const [n, r] = V(null), o = $((c) => {
1713
+ for (const {
1714
+ target: u
1715
+ } of c)
1716
+ if (Ue(u)) {
1717
+ r((d) => {
1718
+ const f = t(u);
1719
+ return d ? {
1720
+ ...d,
1721
+ width: f.width,
1722
+ height: f.height
1723
+ } : f;
1724
+ });
1725
+ break;
1726
+ }
1727
+ }, [t]), i = pt({
1728
+ callback: o
1729
+ }), s = $((c) => {
1730
+ const u = Mn(c);
1731
+ i == null || i.disconnect(), u && (i == null || i.observe(u)), r(u ? t(u) : null);
1732
+ }, [t, i]), [a, l] = ot(s);
1733
+ return T(() => ({
1734
+ nodeRef: a,
1735
+ rect: n,
1736
+ setRef: l
1737
+ }), [n, a, l]);
1738
+ }
1739
+ const io = [{
1740
+ sensor: _t,
1741
+ options: {}
1742
+ }, {
1743
+ sensor: Bt,
1744
+ options: {}
1745
+ }], so = {
1746
+ current: {}
1747
+ }, rt = {
1748
+ draggable: {
1749
+ measure: en
1750
+ },
1751
+ droppable: {
1752
+ measure: en,
1753
+ strategy: Me.WhileDragging,
1754
+ frequency: Ot.Optimized
1755
+ },
1756
+ dragOverlay: {
1757
+ measure: Pe
1758
+ }
1759
+ };
1760
+ class Xe extends Map {
1761
+ get(t) {
1762
+ var n;
1763
+ return t != null && (n = super.get(t)) != null ? n : void 0;
1764
+ }
1765
+ toArray() {
1766
+ return Array.from(this.values());
1767
+ }
1768
+ getEnabled() {
1769
+ return this.toArray().filter((t) => {
1770
+ let {
1771
+ disabled: n
1772
+ } = t;
1773
+ return !n;
1774
+ });
1775
+ }
1776
+ getNodeFor(t) {
1777
+ var n, r;
1778
+ return (n = (r = this.get(t)) == null ? void 0 : r.node.current) != null ? n : void 0;
1779
+ }
1780
+ }
1781
+ const ao = {
1782
+ activatorEvent: null,
1783
+ active: null,
1784
+ activeNode: null,
1785
+ activeNodeRect: null,
1786
+ collisions: null,
1787
+ containerNodeRect: null,
1788
+ draggableNodes: /* @__PURE__ */ new Map(),
1789
+ droppableRects: /* @__PURE__ */ new Map(),
1790
+ droppableContainers: /* @__PURE__ */ new Xe(),
1791
+ over: null,
1792
+ dragOverlay: {
1793
+ nodeRef: {
1794
+ current: null
1795
+ },
1796
+ rect: null,
1797
+ setRef: lt
1798
+ },
1799
+ scrollableAncestors: [],
1800
+ scrollableAncestorRects: [],
1801
+ measuringConfiguration: rt,
1802
+ measureDroppableContainers: lt,
1803
+ windowRect: null,
1804
+ measuringScheduled: !1
1805
+ }, Nn = {
1806
+ activatorEvent: null,
1807
+ activators: [],
1808
+ active: null,
1809
+ activeNodeRect: null,
1810
+ ariaDescribedById: {
1811
+ draggable: ""
1812
+ },
1813
+ dispatch: lt,
1814
+ draggableNodes: /* @__PURE__ */ new Map(),
1815
+ over: null,
1816
+ measureDroppableContainers: lt
1817
+ }, qe = /* @__PURE__ */ Ke(Nn), Ln = /* @__PURE__ */ Ke(ao);
1818
+ function lo() {
1819
+ return {
1820
+ draggable: {
1821
+ active: null,
1822
+ initialCoordinates: {
1823
+ x: 0,
1824
+ y: 0
1825
+ },
1826
+ nodes: /* @__PURE__ */ new Map(),
1827
+ translate: {
1828
+ x: 0,
1829
+ y: 0
1830
+ }
1831
+ },
1832
+ droppable: {
1833
+ containers: new Xe()
1834
+ }
1835
+ };
1836
+ }
1837
+ function co(e, t) {
1838
+ switch (t.type) {
1839
+ case X.DragStart:
1840
+ return {
1841
+ ...e,
1842
+ draggable: {
1843
+ ...e.draggable,
1844
+ initialCoordinates: t.initialCoordinates,
1845
+ active: t.active
1846
+ }
1847
+ };
1848
+ case X.DragMove:
1849
+ return e.draggable.active ? {
1850
+ ...e,
1851
+ draggable: {
1852
+ ...e.draggable,
1853
+ translate: {
1854
+ x: t.coordinates.x - e.draggable.initialCoordinates.x,
1855
+ y: t.coordinates.y - e.draggable.initialCoordinates.y
1856
+ }
1857
+ }
1858
+ } : e;
1859
+ case X.DragEnd:
1860
+ case X.DragCancel:
1861
+ return {
1862
+ ...e,
1863
+ draggable: {
1864
+ ...e.draggable,
1865
+ active: null,
1866
+ initialCoordinates: {
1867
+ x: 0,
1868
+ y: 0
1869
+ },
1870
+ translate: {
1871
+ x: 0,
1872
+ y: 0
1873
+ }
1874
+ }
1875
+ };
1876
+ case X.RegisterDroppable: {
1877
+ const {
1878
+ element: n
1879
+ } = t, {
1880
+ id: r
1881
+ } = n, o = new Xe(e.droppable.containers);
1882
+ return o.set(r, n), {
1883
+ ...e,
1884
+ droppable: {
1885
+ ...e.droppable,
1886
+ containers: o
1887
+ }
1888
+ };
1889
+ }
1890
+ case X.SetDroppableDisabled: {
1891
+ const {
1892
+ id: n,
1893
+ key: r,
1894
+ disabled: o
1895
+ } = t, i = e.droppable.containers.get(n);
1896
+ if (!i || r !== i.key)
1897
+ return e;
1898
+ const s = new Xe(e.droppable.containers);
1899
+ return s.set(n, {
1900
+ ...i,
1901
+ disabled: o
1902
+ }), {
1903
+ ...e,
1904
+ droppable: {
1905
+ ...e.droppable,
1906
+ containers: s
1907
+ }
1908
+ };
1909
+ }
1910
+ case X.UnregisterDroppable: {
1911
+ const {
1912
+ id: n,
1913
+ key: r
1914
+ } = t, o = e.droppable.containers.get(n);
1915
+ if (!o || r !== o.key)
1916
+ return e;
1917
+ const i = new Xe(e.droppable.containers);
1918
+ return i.delete(n), {
1919
+ ...e,
1920
+ droppable: {
1921
+ ...e.droppable,
1922
+ containers: i
1923
+ }
1924
+ };
1925
+ }
1926
+ default:
1927
+ return e;
1928
+ }
1929
+ }
1930
+ function uo(e) {
1931
+ let {
1932
+ disabled: t
1933
+ } = e;
1934
+ const {
1935
+ active: n,
1936
+ activatorEvent: r,
1937
+ draggableNodes: o
1938
+ } = we(qe), i = it(r), s = it(n == null ? void 0 : n.id);
1939
+ return k(() => {
1940
+ if (!t && !r && i && s != null) {
1941
+ if (!ht(i) || document.activeElement === i.target)
1942
+ return;
1943
+ const a = o.get(s);
1944
+ if (!a)
1945
+ return;
1946
+ const {
1947
+ activatorNode: l,
1948
+ node: c
1949
+ } = a;
1950
+ if (!l.current && !c.current)
1951
+ return;
1952
+ requestAnimationFrame(() => {
1953
+ for (const u of [l.current, c.current]) {
1954
+ if (!u)
1955
+ continue;
1956
+ const d = ir(u);
1957
+ if (d) {
1958
+ d.focus();
1959
+ break;
1960
+ }
1961
+ }
1962
+ });
1963
+ }
1964
+ }, [r, t, o, s, i]), null;
1965
+ }
1966
+ function Pn(e, t) {
1967
+ let {
1968
+ transform: n,
1969
+ ...r
1970
+ } = t;
1971
+ return e != null && e.length ? e.reduce((o, i) => i({
1972
+ transform: o,
1973
+ ...r
1974
+ }), n) : n;
1975
+ }
1976
+ function fo(e) {
1977
+ return T(
1978
+ () => ({
1979
+ draggable: {
1980
+ ...rt.draggable,
1981
+ ...e == null ? void 0 : e.draggable
1982
+ },
1983
+ droppable: {
1984
+ ...rt.droppable,
1985
+ ...e == null ? void 0 : e.droppable
1986
+ },
1987
+ dragOverlay: {
1988
+ ...rt.dragOverlay,
1989
+ ...e == null ? void 0 : e.dragOverlay
1990
+ }
1991
+ }),
1992
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1993
+ [e == null ? void 0 : e.draggable, e == null ? void 0 : e.droppable, e == null ? void 0 : e.dragOverlay]
1994
+ );
1995
+ }
1996
+ function go(e) {
1997
+ let {
1998
+ activeNode: t,
1999
+ measure: n,
2000
+ initialRect: r,
2001
+ config: o = !0
2002
+ } = e;
2003
+ const i = z(!1), {
2004
+ x: s,
2005
+ y: a
2006
+ } = typeof o == "boolean" ? {
2007
+ x: o,
2008
+ y: o
2009
+ } : o;
2010
+ ie(() => {
2011
+ if (!s && !a || !t) {
2012
+ i.current = !1;
2013
+ return;
2014
+ }
2015
+ if (i.current || !r)
2016
+ return;
2017
+ const c = t == null ? void 0 : t.node.current;
2018
+ if (!c || c.isConnected === !1)
2019
+ return;
2020
+ const u = n(c), d = wn(u, r);
2021
+ if (s || (d.x = 0), a || (d.y = 0), i.current = !0, Math.abs(d.x) > 0 || Math.abs(d.y) > 0) {
2022
+ const f = Dn(c);
2023
+ f && f.scrollBy({
2024
+ top: d.y,
2025
+ left: d.x
2026
+ });
2027
+ }
2028
+ }, [t, s, a, r, n]);
2029
+ }
2030
+ const vt = /* @__PURE__ */ Ke({
2031
+ ...de,
2032
+ scaleX: 1,
2033
+ scaleY: 1
2034
+ });
2035
+ var ye;
2036
+ (function(e) {
2037
+ e[e.Uninitialized = 0] = "Uninitialized", e[e.Initializing = 1] = "Initializing", e[e.Initialized = 2] = "Initialized";
2038
+ })(ye || (ye = {}));
2039
+ const ho = /* @__PURE__ */ ut(function(t) {
2040
+ var n, r, o, i;
2041
+ let {
2042
+ id: s,
2043
+ accessibility: a,
2044
+ autoScroll: l = !0,
2045
+ children: c,
2046
+ sensors: u = io,
2047
+ collisionDetection: d = xr,
2048
+ measuring: f,
2049
+ modifiers: h,
2050
+ ...b
2051
+ } = t;
2052
+ const g = Nt(co, void 0, lo), [p, m] = g, [w, y] = dr(), [C, x] = V(ye.Uninitialized), I = C === ye.Initialized, {
2053
+ draggable: {
2054
+ active: R,
2055
+ nodes: E,
2056
+ translate: N
2057
+ },
2058
+ droppable: {
2059
+ containers: B
2060
+ }
2061
+ } = p, A = R ? E.get(R) : null, Z = z({
2062
+ initial: null,
2063
+ translated: null
2064
+ }), Q = T(() => {
2065
+ var U;
2066
+ return R != null ? {
2067
+ id: R,
2068
+ // It's possible for the active node to unmount while dragging
2069
+ data: (U = A == null ? void 0 : A.data) != null ? U : so,
2070
+ rect: Z
2071
+ } : null;
2072
+ }, [R, A]), ne = z(null), [xe, De] = V(null), [J, Ce] = V(null), se = Ye(b, Object.values(b)), Se = Je("DndDescribedBy", s), v = T(() => B.getEnabled(), [B]), D = fo(f), {
2073
+ droppableRects: P,
2074
+ measureDroppableContainers: M,
2075
+ measuringScheduled: F
2076
+ } = Wr(v, {
2077
+ dragging: I,
2078
+ dependencies: [N.x, N.y],
2079
+ config: D.droppable
2080
+ }), H = Kr(E, R), K = T(() => J ? at(J) : null, [J]), q = Zn(), W = Jr(H, D.draggable.measure);
2081
+ go({
2082
+ activeNode: R ? E.get(R) : null,
2083
+ config: q.layoutShiftCompensation,
2084
+ initialRect: W,
2085
+ measure: D.draggable.measure
2086
+ });
2087
+ const O = sn(H, D.draggable.measure, W), he = sn(H ? H.parentElement : null), L = z({
2088
+ activatorEvent: null,
2089
+ active: null,
2090
+ activeNode: H,
2091
+ collisionRect: null,
2092
+ collisions: null,
2093
+ droppableRects: P,
2094
+ draggableNodes: E,
2095
+ draggingNode: null,
2096
+ draggingNodeRect: null,
2097
+ droppableContainers: B,
2098
+ over: null,
2099
+ scrollableAncestors: [],
2100
+ scrollAdjustedTranslate: null
2101
+ }), pe = B.getNodeFor((n = L.current.over) == null ? void 0 : n.id), ae = oo({
2102
+ measure: D.dragOverlay.measure
2103
+ }), Ie = (r = ae.nodeRef.current) != null ? r : H, Re = I ? (o = ae.rect) != null ? o : O : null, Ft = !!(ae.nodeRef.current && ae.rect), Ht = Zr(Ft ? null : O), mt = An(Ie ? G(Ie) : null), ve = Qr(I ? pe ?? H : null), Ge = ro(ve), Ze = Pn(h, {
2104
+ transform: {
2105
+ x: N.x - Ht.x,
2106
+ y: N.y - Ht.y,
2107
+ scaleX: 1,
2108
+ scaleY: 1
2109
+ },
2110
+ activatorEvent: J,
2111
+ active: Q,
2112
+ activeNodeRect: O,
2113
+ containerNodeRect: he,
2114
+ draggingNodeRect: Re,
2115
+ over: L.current.over,
2116
+ overlayNodeRect: ae.rect,
2117
+ scrollableAncestors: ve,
2118
+ scrollableAncestorRects: Ge,
2119
+ windowRect: mt
2120
+ }), Xt = K ? Ae(K, N) : null, Yt = eo(ve), Vn = ln(Yt), Kn = ln(Yt, [O]), Ee = Ae(Ze, Vn), Oe = Re ? Sr(Re, Ze) : null, ke = Q && Oe ? d({
2121
+ active: Q,
2122
+ collisionRect: Oe,
2123
+ droppableRects: P,
2124
+ droppableContainers: v,
2125
+ pointerCoordinates: Xt
2126
+ }) : null, Vt = yn(ke, "id"), [be, Kt] = V(null), Un = Ft ? Ze : Ae(Ze, Kn), Wn = Dr(Un, (i = be == null ? void 0 : be.rect) != null ? i : null, O), Ut = $(
2127
+ (U, ee) => {
2128
+ let {
2129
+ sensor: te,
2130
+ options: me
2131
+ } = ee;
2132
+ if (ne.current == null)
2133
+ return;
2134
+ const re = E.get(ne.current);
2135
+ if (!re)
2136
+ return;
2137
+ const le = U.nativeEvent, fe = new te({
2138
+ active: ne.current,
2139
+ activeNode: re,
2140
+ event: le,
2141
+ options: me,
2142
+ // Sensors need to be instantiated with refs for arguments that change over time
2143
+ // otherwise they are frozen in time with the stale arguments
2144
+ context: L,
2145
+ onStart(ce) {
2146
+ const ze = ne.current;
2147
+ if (ze == null)
2148
+ return;
2149
+ const Be = E.get(ze);
2150
+ if (!Be)
2151
+ return;
2152
+ const {
2153
+ onDragStart: Qe
2154
+ } = se.current, et = {
2155
+ active: {
2156
+ id: ze,
2157
+ data: Be.data,
2158
+ rect: Z
2159
+ }
2160
+ };
2161
+ je(() => {
2162
+ Qe == null || Qe(et), x(ye.Initializing), m({
2163
+ type: X.DragStart,
2164
+ initialCoordinates: ce,
2165
+ active: ze
2166
+ }), w({
2167
+ type: "onDragStart",
2168
+ event: et
2169
+ });
2170
+ });
2171
+ },
2172
+ onMove(ce) {
2173
+ m({
2174
+ type: X.DragMove,
2175
+ coordinates: ce
2176
+ });
2177
+ },
2178
+ onEnd: Te(X.DragEnd),
2179
+ onCancel: Te(X.DragCancel)
2180
+ });
2181
+ je(() => {
2182
+ De(fe), Ce(U.nativeEvent);
2183
+ });
2184
+ function Te(ce) {
2185
+ return async function() {
2186
+ const {
2187
+ active: Be,
2188
+ collisions: Qe,
2189
+ over: et,
2190
+ scrollAdjustedTranslate: Jt
2191
+ } = L.current;
2192
+ let $e = null;
2193
+ if (Be && Jt) {
2194
+ const {
2195
+ cancelDrop: _e
2196
+ } = se.current;
2197
+ $e = {
2198
+ activatorEvent: le,
2199
+ active: Be,
2200
+ collisions: Qe,
2201
+ delta: Jt,
2202
+ over: et
2203
+ }, ce === X.DragEnd && typeof _e == "function" && await Promise.resolve(_e($e)) && (ce = X.DragCancel);
2204
+ }
2205
+ ne.current = null, je(() => {
2206
+ m({
2207
+ type: ce
2208
+ }), x(ye.Uninitialized), Kt(null), De(null), Ce(null);
2209
+ const _e = ce === X.DragEnd ? "onDragEnd" : "onDragCancel";
2210
+ if ($e) {
2211
+ const yt = se.current[_e];
2212
+ yt == null || yt($e), w({
2213
+ type: _e,
2214
+ event: $e
2215
+ });
2216
+ }
2217
+ });
2218
+ };
2219
+ }
2220
+ },
2221
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2222
+ [E]
2223
+ ), Jn = $((U, ee) => (te, me) => {
2224
+ const re = te.nativeEvent, le = E.get(me);
2225
+ if (
2226
+ // Another sensor is already instantiating
2227
+ ne.current !== null || // No active draggable
2228
+ !le || // Event has already been captured
2229
+ re.dndKit || re.defaultPrevented
2230
+ )
2231
+ return;
2232
+ const fe = {
2233
+ active: le
2234
+ };
2235
+ U(te, ee.options, fe) === !0 && (re.dndKit = {
2236
+ capturedBy: ee.sensor
2237
+ }, ne.current = me, Ut(te, ee));
2238
+ }, [E, Ut]), Wt = Ur(u, Jn);
2239
+ to(u), ie(() => {
2240
+ O && C === ye.Initializing && x(ye.Initialized);
2241
+ }, [O, C]), k(
2242
+ () => {
2243
+ const {
2244
+ onDragMove: U
2245
+ } = se.current, {
2246
+ active: ee,
2247
+ activatorEvent: te,
2248
+ collisions: me,
2249
+ over: re
2250
+ } = L.current;
2251
+ if (!ee || !te)
2252
+ return;
2253
+ const le = {
2254
+ active: ee,
2255
+ activatorEvent: te,
2256
+ collisions: me,
2257
+ delta: {
2258
+ x: Ee.x,
2259
+ y: Ee.y
2260
+ },
2261
+ over: re
2262
+ };
2263
+ je(() => {
2264
+ U == null || U(le), w({
2265
+ type: "onDragMove",
2266
+ event: le
2267
+ });
2268
+ });
2269
+ },
2270
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2271
+ [Ee.x, Ee.y]
2272
+ ), k(
2273
+ () => {
2274
+ const {
2275
+ active: U,
2276
+ activatorEvent: ee,
2277
+ collisions: te,
2278
+ droppableContainers: me,
2279
+ scrollAdjustedTranslate: re
2280
+ } = L.current;
2281
+ if (!U || ne.current == null || !ee || !re)
2282
+ return;
2283
+ const {
2284
+ onDragOver: le
2285
+ } = se.current, fe = me.get(Vt), Te = fe && fe.rect.current ? {
2286
+ id: fe.id,
2287
+ rect: fe.rect.current,
2288
+ data: fe.data,
2289
+ disabled: fe.disabled
2290
+ } : null, ce = {
2291
+ active: U,
2292
+ activatorEvent: ee,
2293
+ collisions: te,
2294
+ delta: {
2295
+ x: re.x,
2296
+ y: re.y
2297
+ },
2298
+ over: Te
2299
+ };
2300
+ je(() => {
2301
+ Kt(Te), le == null || le(ce), w({
2302
+ type: "onDragOver",
2303
+ event: ce
2304
+ });
2305
+ });
2306
+ },
2307
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2308
+ [Vt]
2309
+ ), ie(() => {
2310
+ L.current = {
2311
+ activatorEvent: J,
2312
+ active: Q,
2313
+ activeNode: H,
2314
+ collisionRect: Oe,
2315
+ collisions: ke,
2316
+ droppableRects: P,
2317
+ draggableNodes: E,
2318
+ draggingNode: Ie,
2319
+ draggingNodeRect: Re,
2320
+ droppableContainers: B,
2321
+ over: be,
2322
+ scrollableAncestors: ve,
2323
+ scrollAdjustedTranslate: Ee
2324
+ }, Z.current = {
2325
+ initial: Re,
2326
+ translated: Oe
2327
+ };
2328
+ }, [Q, H, ke, Oe, E, Ie, Re, P, B, be, ve, Ee]), Xr({
2329
+ ...q,
2330
+ delta: N,
2331
+ draggingRect: Oe,
2332
+ pointerCoordinates: Xt,
2333
+ scrollableAncestors: ve,
2334
+ scrollableAncestorRects: Ge
2335
+ });
2336
+ const qn = T(() => ({
2337
+ active: Q,
2338
+ activeNode: H,
2339
+ activeNodeRect: O,
2340
+ activatorEvent: J,
2341
+ collisions: ke,
2342
+ containerNodeRect: he,
2343
+ dragOverlay: ae,
2344
+ draggableNodes: E,
2345
+ droppableContainers: B,
2346
+ droppableRects: P,
2347
+ over: be,
2348
+ measureDroppableContainers: M,
2349
+ scrollableAncestors: ve,
2350
+ scrollableAncestorRects: Ge,
2351
+ measuringConfiguration: D,
2352
+ measuringScheduled: F,
2353
+ windowRect: mt
2354
+ }), [Q, H, O, J, ke, he, ae, E, B, P, be, M, ve, Ge, D, F, mt]), Gn = T(() => ({
2355
+ activatorEvent: J,
2356
+ activators: Wt,
2357
+ active: Q,
2358
+ activeNodeRect: O,
2359
+ ariaDescribedById: {
2360
+ draggable: Se
2361
+ },
2362
+ dispatch: m,
2363
+ draggableNodes: E,
2364
+ over: be,
2365
+ measureDroppableContainers: M
2366
+ }), [J, Wt, Q, O, m, Se, E, be, M]);
2367
+ return j.createElement(vn.Provider, {
2368
+ value: y
2369
+ }, j.createElement(qe.Provider, {
2370
+ value: Gn
2371
+ }, j.createElement(Ln.Provider, {
2372
+ value: qn
2373
+ }, j.createElement(vt.Provider, {
2374
+ value: Wn
2375
+ }, c)), j.createElement(uo, {
2376
+ disabled: (a == null ? void 0 : a.restoreFocus) === !1
2377
+ })), j.createElement(hr, {
2378
+ ...a,
2379
+ hiddenTextDescribedById: Se
2380
+ }));
2381
+ function Zn() {
2382
+ const U = (xe == null ? void 0 : xe.autoScrollEnabled) === !1, ee = typeof l == "object" ? l.enabled === !1 : l === !1, te = I && !U && !ee;
2383
+ return typeof l == "object" ? {
2384
+ ...l,
2385
+ enabled: te
2386
+ } : {
2387
+ enabled: te
2388
+ };
2389
+ }
2390
+ }), po = /* @__PURE__ */ Ke(null), cn = "button", vo = "Droppable";
2391
+ function bo(e) {
2392
+ let {
2393
+ id: t,
2394
+ data: n,
2395
+ disabled: r = !1,
2396
+ attributes: o
2397
+ } = e;
2398
+ const i = Je(vo), {
2399
+ activators: s,
2400
+ activatorEvent: a,
2401
+ active: l,
2402
+ activeNodeRect: c,
2403
+ ariaDescribedById: u,
2404
+ draggableNodes: d,
2405
+ over: f
2406
+ } = we(qe), {
2407
+ role: h = cn,
2408
+ roleDescription: b = "draggable",
2409
+ tabIndex: g = 0
2410
+ } = o ?? {}, p = (l == null ? void 0 : l.id) === t, m = we(p ? vt : po), [w, y] = ot(), [C, x] = ot(), I = no(s, t), R = Ye(n);
2411
+ ie(
2412
+ () => (d.set(t, {
2413
+ id: t,
2414
+ key: i,
2415
+ node: w,
2416
+ activatorNode: C,
2417
+ data: R
2418
+ }), () => {
2419
+ const N = d.get(t);
2420
+ N && N.key === i && d.delete(t);
2421
+ }),
2422
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2423
+ [d, t]
2424
+ );
2425
+ const E = T(() => ({
2426
+ role: h,
2427
+ tabIndex: g,
2428
+ "aria-disabled": r,
2429
+ "aria-pressed": p && h === cn ? !0 : void 0,
2430
+ "aria-roledescription": b,
2431
+ "aria-describedby": u.draggable
2432
+ }), [r, h, g, p, b, u.draggable]);
2433
+ return {
2434
+ active: l,
2435
+ activatorEvent: a,
2436
+ activeNodeRect: c,
2437
+ attributes: E,
2438
+ isDragging: p,
2439
+ listeners: r ? void 0 : I,
2440
+ node: w,
2441
+ over: f,
2442
+ setNodeRef: y,
2443
+ setActivatorNodeRef: x,
2444
+ transform: m
2445
+ };
2446
+ }
2447
+ function kn() {
2448
+ return we(Ln);
2449
+ }
2450
+ const mo = "Droppable", yo = {
2451
+ timeout: 25
2452
+ };
2453
+ function wo(e) {
2454
+ let {
2455
+ data: t,
2456
+ disabled: n = !1,
2457
+ id: r,
2458
+ resizeObserverConfig: o
2459
+ } = e;
2460
+ const i = Je(mo), {
2461
+ active: s,
2462
+ dispatch: a,
2463
+ over: l,
2464
+ measureDroppableContainers: c
2465
+ } = we(qe), u = z({
2466
+ disabled: n
2467
+ }), d = z(!1), f = z(null), h = z(null), {
2468
+ disabled: b,
2469
+ updateMeasurementsFor: g,
2470
+ timeout: p
2471
+ } = {
2472
+ ...yo,
2473
+ ...o
2474
+ }, m = Ye(g ?? r), w = $(
2475
+ () => {
2476
+ if (!d.current) {
2477
+ d.current = !0;
2478
+ return;
2479
+ }
2480
+ h.current != null && clearTimeout(h.current), h.current = setTimeout(() => {
2481
+ c(Array.isArray(m.current) ? m.current : [m.current]), h.current = null;
2482
+ }, p);
2483
+ },
2484
+ //eslint-disable-next-line react-hooks/exhaustive-deps
2485
+ [p]
2486
+ ), y = pt({
2487
+ callback: w,
2488
+ disabled: b || !s
2489
+ }), C = $((E, N) => {
2490
+ y && (N && (y.unobserve(N), d.current = !1), E && y.observe(E));
2491
+ }, [y]), [x, I] = ot(C), R = Ye(t);
2492
+ return k(() => {
2493
+ !y || !x.current || (y.disconnect(), d.current = !1, y.observe(x.current));
2494
+ }, [x, y]), ie(
2495
+ () => (a({
2496
+ type: X.RegisterDroppable,
2497
+ element: {
2498
+ id: r,
2499
+ key: i,
2500
+ disabled: n,
2501
+ node: x,
2502
+ rect: f,
2503
+ data: R
2504
+ }
2505
+ }), () => a({
2506
+ type: X.UnregisterDroppable,
2507
+ key: i,
2508
+ id: r
2509
+ })),
2510
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2511
+ [r]
2512
+ ), k(() => {
2513
+ n !== u.current.disabled && (a({
2514
+ type: X.SetDroppableDisabled,
2515
+ id: r,
2516
+ key: i,
2517
+ disabled: n
2518
+ }), u.current.disabled = n);
2519
+ }, [r, i, n, a]), {
2520
+ active: s,
2521
+ rect: f,
2522
+ isOver: (l == null ? void 0 : l.id) === r,
2523
+ node: x,
2524
+ over: l,
2525
+ setNodeRef: I
2526
+ };
2527
+ }
2528
+ function xo(e) {
2529
+ let {
2530
+ animation: t,
2531
+ children: n
2532
+ } = e;
2533
+ const [r, o] = V(null), [i, s] = V(null), a = it(n);
2534
+ return !n && !r && a && o(a), ie(() => {
2535
+ if (!i)
2536
+ return;
2537
+ const l = r == null ? void 0 : r.key, c = r == null ? void 0 : r.props.id;
2538
+ if (l == null || c == null) {
2539
+ o(null);
2540
+ return;
2541
+ }
2542
+ Promise.resolve(t(c, i)).then(() => {
2543
+ o(null);
2544
+ });
2545
+ }, [t, r, i]), j.createElement(j.Fragment, null, n, r ? er(r, {
2546
+ ref: s
2547
+ }) : null);
2548
+ }
2549
+ const Do = {
2550
+ x: 0,
2551
+ y: 0,
2552
+ scaleX: 1,
2553
+ scaleY: 1
2554
+ };
2555
+ function Co(e) {
2556
+ let {
2557
+ children: t
2558
+ } = e;
2559
+ return j.createElement(qe.Provider, {
2560
+ value: Nn
2561
+ }, j.createElement(vt.Provider, {
2562
+ value: Do
2563
+ }, t));
2564
+ }
2565
+ const So = {
2566
+ position: "fixed",
2567
+ touchAction: "none"
2568
+ }, Io = (e) => ht(e) ? "transform 250ms ease" : void 0, Ro = /* @__PURE__ */ dt((e, t) => {
2569
+ let {
2570
+ as: n,
2571
+ activatorEvent: r,
2572
+ adjustScale: o,
2573
+ children: i,
2574
+ className: s,
2575
+ rect: a,
2576
+ style: l,
2577
+ transform: c,
2578
+ transition: u = Io
2579
+ } = e;
2580
+ if (!a)
2581
+ return null;
2582
+ const d = o ? c : {
2583
+ ...c,
2584
+ scaleX: 1,
2585
+ scaleY: 1
2586
+ }, f = {
2587
+ ...So,
2588
+ width: a.width,
2589
+ height: a.height,
2590
+ top: a.top,
2591
+ left: a.left,
2592
+ transform: ge.Transform.toString(d),
2593
+ transformOrigin: o && r ? vr(r, a) : void 0,
2594
+ transition: typeof u == "function" ? u(r) : u,
2595
+ ...l
2596
+ };
2597
+ return j.createElement(n, {
2598
+ className: s,
2599
+ style: f,
2600
+ ref: t
2601
+ }, i);
2602
+ }), Eo = (e) => (t) => {
2603
+ let {
2604
+ active: n,
2605
+ dragOverlay: r
2606
+ } = t;
2607
+ const o = {}, {
2608
+ styles: i,
2609
+ className: s
2610
+ } = e;
2611
+ if (i != null && i.active)
2612
+ for (const [a, l] of Object.entries(i.active))
2613
+ l !== void 0 && (o[a] = n.node.style.getPropertyValue(a), n.node.style.setProperty(a, l));
2614
+ if (i != null && i.dragOverlay)
2615
+ for (const [a, l] of Object.entries(i.dragOverlay))
2616
+ l !== void 0 && r.node.style.setProperty(a, l);
2617
+ return s != null && s.active && n.node.classList.add(s.active), s != null && s.dragOverlay && r.node.classList.add(s.dragOverlay), function() {
2618
+ for (const [l, c] of Object.entries(o))
2619
+ n.node.style.setProperty(l, c);
2620
+ s != null && s.active && n.node.classList.remove(s.active);
2621
+ };
2622
+ }, Oo = (e) => {
2623
+ let {
2624
+ transform: {
2625
+ initial: t,
2626
+ final: n
2627
+ }
2628
+ } = e;
2629
+ return [{
2630
+ transform: ge.Transform.toString(t)
2631
+ }, {
2632
+ transform: ge.Transform.toString(n)
2633
+ }];
2634
+ }, Tt = {
2635
+ duration: 250,
2636
+ easing: "ease",
2637
+ keyframes: Oo,
2638
+ sideEffects: /* @__PURE__ */ Eo({
2639
+ styles: {
2640
+ active: {
2641
+ opacity: "0"
2642
+ }
2643
+ }
2644
+ })
2645
+ };
2646
+ function To(e) {
2647
+ let {
2648
+ config: t,
2649
+ draggableNodes: n,
2650
+ droppableContainers: r,
2651
+ measuringConfiguration: o
2652
+ } = e;
2653
+ return gt((i, s) => {
2654
+ if (t === null)
2655
+ return;
2656
+ const a = n.get(i);
2657
+ if (!a)
2658
+ return;
2659
+ const l = a.node.current;
2660
+ if (!l)
2661
+ return;
2662
+ const c = Mn(s);
2663
+ if (!c)
2664
+ return;
2665
+ const {
2666
+ transform: u
2667
+ } = G(s).getComputedStyle(s), d = xn(u);
2668
+ if (!d)
2669
+ return;
2670
+ const f = typeof t == "function" ? t : Ao(t);
2671
+ return On(l, o.draggable.measure), f({
2672
+ active: {
2673
+ id: i,
2674
+ data: a.data,
2675
+ node: l,
2676
+ rect: o.draggable.measure(l)
2677
+ },
2678
+ draggableNodes: n,
2679
+ dragOverlay: {
2680
+ node: s,
2681
+ rect: o.dragOverlay.measure(c)
2682
+ },
2683
+ droppableContainers: r,
2684
+ measuringConfiguration: o,
2685
+ transform: d
2686
+ });
2687
+ });
2688
+ }
2689
+ function Ao(e) {
2690
+ const {
2691
+ duration: t,
2692
+ easing: n,
2693
+ sideEffects: r,
2694
+ keyframes: o
2695
+ } = {
2696
+ ...Tt,
2697
+ ...e
2698
+ };
2699
+ return (i) => {
2700
+ let {
2701
+ active: s,
2702
+ dragOverlay: a,
2703
+ transform: l,
2704
+ ...c
2705
+ } = i;
2706
+ if (!t)
2707
+ return;
2708
+ const u = {
2709
+ x: a.rect.left - s.rect.left,
2710
+ y: a.rect.top - s.rect.top
2711
+ }, d = {
2712
+ scaleX: l.scaleX !== 1 ? s.rect.width * l.scaleX / a.rect.width : 1,
2713
+ scaleY: l.scaleY !== 1 ? s.rect.height * l.scaleY / a.rect.height : 1
2714
+ }, f = {
2715
+ x: l.x - u.x,
2716
+ y: l.y - u.y,
2717
+ ...d
2718
+ }, h = o({
2719
+ ...c,
2720
+ active: s,
2721
+ dragOverlay: a,
2722
+ transform: {
2723
+ initial: l,
2724
+ final: f
2725
+ }
2726
+ }), [b] = h, g = h[h.length - 1];
2727
+ if (JSON.stringify(b) === JSON.stringify(g))
2728
+ return;
2729
+ const p = r == null ? void 0 : r({
2730
+ active: s,
2731
+ dragOverlay: a,
2732
+ ...c
2733
+ }), m = a.node.animate(h, {
2734
+ duration: t,
2735
+ easing: n,
2736
+ fill: "forwards"
2737
+ });
2738
+ return new Promise((w) => {
2739
+ m.onfinish = () => {
2740
+ p == null || p(), w();
2741
+ };
2742
+ });
2743
+ };
2744
+ }
2745
+ let un = 0;
2746
+ function Mo(e) {
2747
+ return T(() => {
2748
+ if (e != null)
2749
+ return un++, un;
2750
+ }, [e]);
2751
+ }
2752
+ const No = /* @__PURE__ */ j.memo((e) => {
2753
+ let {
2754
+ adjustScale: t = !1,
2755
+ children: n,
2756
+ dropAnimation: r,
2757
+ style: o,
2758
+ transition: i,
2759
+ modifiers: s,
2760
+ wrapperElement: a = "div",
2761
+ className: l,
2762
+ zIndex: c = 999
2763
+ } = e;
2764
+ const {
2765
+ activatorEvent: u,
2766
+ active: d,
2767
+ activeNodeRect: f,
2768
+ containerNodeRect: h,
2769
+ draggableNodes: b,
2770
+ droppableContainers: g,
2771
+ dragOverlay: p,
2772
+ over: m,
2773
+ measuringConfiguration: w,
2774
+ scrollableAncestors: y,
2775
+ scrollableAncestorRects: C,
2776
+ windowRect: x
2777
+ } = kn(), I = we(vt), R = Mo(d == null ? void 0 : d.id), E = Pn(s, {
2778
+ activatorEvent: u,
2779
+ active: d,
2780
+ activeNodeRect: f,
2781
+ containerNodeRect: h,
2782
+ draggingNodeRect: p.rect,
2783
+ over: m,
2784
+ overlayNodeRect: p.rect,
2785
+ scrollableAncestors: y,
2786
+ scrollableAncestorRects: C,
2787
+ transform: I,
2788
+ windowRect: x
2789
+ }), N = jt(f), B = To({
2790
+ config: r,
2791
+ draggableNodes: b,
2792
+ droppableContainers: g,
2793
+ measuringConfiguration: w
2794
+ }), A = N ? p.setRef : void 0;
2795
+ return j.createElement(Co, null, j.createElement(xo, {
2796
+ animation: B
2797
+ }, d && R ? j.createElement(Ro, {
2798
+ key: R,
2799
+ id: d.id,
2800
+ ref: A,
2801
+ as: a,
2802
+ activatorEvent: u,
2803
+ adjustScale: t,
2804
+ className: l,
2805
+ transition: i,
2806
+ rect: N,
2807
+ style: {
2808
+ zIndex: c,
2809
+ ...o
2810
+ },
2811
+ transform: E
2812
+ }, n) : null));
2813
+ });
2814
+ function Ve(e, t, n) {
2815
+ const r = e.slice();
2816
+ return r.splice(n < 0 ? r.length + n : n, 0, r.splice(t, 1)[0]), r;
2817
+ }
2818
+ function Lo(e, t) {
2819
+ return e.reduce((n, r, o) => {
2820
+ const i = t.get(r);
2821
+ return i && (n[o] = i), n;
2822
+ }, Array(e.length));
2823
+ }
2824
+ function tt(e) {
2825
+ return e !== null && e >= 0;
2826
+ }
2827
+ function Po(e, t) {
2828
+ if (e === t)
2829
+ return !0;
2830
+ if (e.length !== t.length)
2831
+ return !1;
2832
+ for (let n = 0; n < e.length; n++)
2833
+ if (e[n] !== t[n])
2834
+ return !1;
2835
+ return !0;
2836
+ }
2837
+ function ko(e) {
2838
+ return typeof e == "boolean" ? {
2839
+ draggable: e,
2840
+ droppable: e
2841
+ } : e;
2842
+ }
2843
+ const zn = (e) => {
2844
+ let {
2845
+ rects: t,
2846
+ activeIndex: n,
2847
+ overIndex: r,
2848
+ index: o
2849
+ } = e;
2850
+ const i = Ve(t, r, n), s = t[o], a = i[o];
2851
+ return !a || !s ? null : {
2852
+ x: a.left - s.left,
2853
+ y: a.top - s.top,
2854
+ scaleX: a.width / s.width,
2855
+ scaleY: a.height / s.height
2856
+ };
2857
+ }, nt = {
2858
+ scaleX: 1,
2859
+ scaleY: 1
2860
+ }, zo = (e) => {
2861
+ var t;
2862
+ let {
2863
+ activeIndex: n,
2864
+ activeNodeRect: r,
2865
+ index: o,
2866
+ rects: i,
2867
+ overIndex: s
2868
+ } = e;
2869
+ const a = (t = i[n]) != null ? t : r;
2870
+ if (!a)
2871
+ return null;
2872
+ if (o === n) {
2873
+ const c = i[s];
2874
+ return c ? {
2875
+ x: 0,
2876
+ y: n < s ? c.top + c.height - (a.top + a.height) : c.top - a.top,
2877
+ ...nt
2878
+ } : null;
2879
+ }
2880
+ const l = Bo(i, o, n);
2881
+ return o > n && o <= s ? {
2882
+ x: 0,
2883
+ y: -a.height - l,
2884
+ ...nt
2885
+ } : o < n && o >= s ? {
2886
+ x: 0,
2887
+ y: a.height + l,
2888
+ ...nt
2889
+ } : {
2890
+ x: 0,
2891
+ y: 0,
2892
+ ...nt
2893
+ };
2894
+ };
2895
+ function Bo(e, t, n) {
2896
+ const r = e[t], o = e[t - 1], i = e[t + 1];
2897
+ return r ? n < t ? o ? r.top - (o.top + o.height) : i ? i.top - (r.top + r.height) : 0 : i ? i.top - (r.top + r.height) : o ? r.top - (o.top + o.height) : 0 : 0;
2898
+ }
2899
+ const Bn = "Sortable", $n = /* @__PURE__ */ j.createContext({
2900
+ activeIndex: -1,
2901
+ containerId: Bn,
2902
+ disableTransforms: !1,
2903
+ items: [],
2904
+ overIndex: -1,
2905
+ useDragOverlay: !1,
2906
+ sortedRects: [],
2907
+ strategy: zn,
2908
+ disabled: {
2909
+ draggable: !1,
2910
+ droppable: !1
2911
+ }
2912
+ });
2913
+ function $o(e) {
2914
+ let {
2915
+ children: t,
2916
+ id: n,
2917
+ items: r,
2918
+ strategy: o = zn,
2919
+ disabled: i = !1
2920
+ } = e;
2921
+ const {
2922
+ active: s,
2923
+ dragOverlay: a,
2924
+ droppableRects: l,
2925
+ over: c,
2926
+ measureDroppableContainers: u
2927
+ } = kn(), d = Je(Bn, n), f = a.rect !== null, h = T(() => r.map((I) => typeof I == "object" && "id" in I ? I.id : I), [r]), b = s != null, g = s ? h.indexOf(s.id) : -1, p = c ? h.indexOf(c.id) : -1, m = z(h), w = !Po(h, m.current), y = p !== -1 && g === -1 || w, C = ko(i);
2928
+ ie(() => {
2929
+ w && b && u(h);
2930
+ }, [w, h, b, u]), k(() => {
2931
+ m.current = h;
2932
+ }, [h]);
2933
+ const x = T(
2934
+ () => ({
2935
+ activeIndex: g,
2936
+ containerId: d,
2937
+ disabled: C,
2938
+ disableTransforms: y,
2939
+ items: h,
2940
+ overIndex: p,
2941
+ useDragOverlay: f,
2942
+ sortedRects: Lo(h, l),
2943
+ strategy: o
2944
+ }),
2945
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2946
+ [g, d, C.draggable, C.droppable, y, h, p, l, f, o]
2947
+ );
2948
+ return j.createElement($n.Provider, {
2949
+ value: x
2950
+ }, t);
2951
+ }
2952
+ const _o = (e) => {
2953
+ let {
2954
+ id: t,
2955
+ items: n,
2956
+ activeIndex: r,
2957
+ overIndex: o
2958
+ } = e;
2959
+ return Ve(n, r, o).indexOf(t);
2960
+ }, jo = (e) => {
2961
+ let {
2962
+ containerId: t,
2963
+ isSorting: n,
2964
+ wasDragging: r,
2965
+ index: o,
2966
+ items: i,
2967
+ newIndex: s,
2968
+ previousItems: a,
2969
+ previousContainerId: l,
2970
+ transition: c
2971
+ } = e;
2972
+ return !c || !r || a !== i && o === s ? !1 : n ? !0 : s !== o && t === l;
2973
+ }, Fo = {
2974
+ duration: 200,
2975
+ easing: "ease"
2976
+ }, _n = "transform", Ho = /* @__PURE__ */ ge.Transition.toString({
2977
+ property: _n,
2978
+ duration: 0,
2979
+ easing: "linear"
2980
+ }), Xo = {
2981
+ roleDescription: "sortable"
2982
+ };
2983
+ function Yo(e) {
2984
+ let {
2985
+ disabled: t,
2986
+ index: n,
2987
+ node: r,
2988
+ rect: o
2989
+ } = e;
2990
+ const [i, s] = V(null), a = z(n);
2991
+ return ie(() => {
2992
+ if (!t && n !== a.current && r.current) {
2993
+ const l = o.current;
2994
+ if (l) {
2995
+ const c = Pe(r.current, {
2996
+ ignoreTransform: !0
2997
+ }), u = {
2998
+ x: l.left - c.left,
2999
+ y: l.top - c.top,
3000
+ scaleX: l.width / c.width,
3001
+ scaleY: l.height / c.height
3002
+ };
3003
+ (u.x || u.y) && s(u);
3004
+ }
3005
+ }
3006
+ n !== a.current && (a.current = n);
3007
+ }, [t, n, r, o]), k(() => {
3008
+ i && s(null);
3009
+ }, [i]), i;
3010
+ }
3011
+ function Vo(e) {
3012
+ let {
3013
+ animateLayoutChanges: t = jo,
3014
+ attributes: n,
3015
+ disabled: r,
3016
+ data: o,
3017
+ getNewIndex: i = _o,
3018
+ id: s,
3019
+ strategy: a,
3020
+ resizeObserverConfig: l,
3021
+ transition: c = Fo
3022
+ } = e;
3023
+ const {
3024
+ items: u,
3025
+ containerId: d,
3026
+ activeIndex: f,
3027
+ disabled: h,
3028
+ disableTransforms: b,
3029
+ sortedRects: g,
3030
+ overIndex: p,
3031
+ useDragOverlay: m,
3032
+ strategy: w
3033
+ } = we($n), y = Ko(r, h), C = u.indexOf(s), x = T(() => ({
3034
+ sortable: {
3035
+ containerId: d,
3036
+ index: C,
3037
+ items: u
3038
+ },
3039
+ ...o
3040
+ }), [d, o, C, u]), I = T(() => u.slice(u.indexOf(s)), [u, s]), {
3041
+ rect: R,
3042
+ node: E,
3043
+ isOver: N,
3044
+ setNodeRef: B
3045
+ } = wo({
3046
+ id: s,
3047
+ data: x,
3048
+ disabled: y.droppable,
3049
+ resizeObserverConfig: {
3050
+ updateMeasurementsFor: I,
3051
+ ...l
3052
+ }
3053
+ }), {
3054
+ active: A,
3055
+ activatorEvent: Z,
3056
+ activeNodeRect: Q,
3057
+ attributes: ne,
3058
+ setNodeRef: xe,
3059
+ listeners: De,
3060
+ isDragging: J,
3061
+ over: Ce,
3062
+ setActivatorNodeRef: se,
3063
+ transform: Se
3064
+ } = bo({
3065
+ id: s,
3066
+ data: x,
3067
+ attributes: {
3068
+ ...Xo,
3069
+ ...n
3070
+ },
3071
+ disabled: y.draggable
3072
+ }), v = tr(B, xe), D = !!A, P = D && !b && tt(f) && tt(p), M = !m && J, F = M && P ? Se : null, K = P ? F ?? (a ?? w)({
3073
+ rects: g,
3074
+ activeNodeRect: Q,
3075
+ activeIndex: f,
3076
+ overIndex: p,
3077
+ index: C
3078
+ }) : null, q = tt(f) && tt(p) ? i({
3079
+ id: s,
3080
+ items: u,
3081
+ activeIndex: f,
3082
+ overIndex: p
3083
+ }) : C, W = A == null ? void 0 : A.id, O = z({
3084
+ activeId: W,
3085
+ items: u,
3086
+ newIndex: q,
3087
+ containerId: d
3088
+ }), he = u !== O.current.items, L = t({
3089
+ active: A,
3090
+ containerId: d,
3091
+ isDragging: J,
3092
+ isSorting: D,
3093
+ id: s,
3094
+ index: C,
3095
+ items: u,
3096
+ newIndex: O.current.newIndex,
3097
+ previousItems: O.current.items,
3098
+ previousContainerId: O.current.containerId,
3099
+ transition: c,
3100
+ wasDragging: O.current.activeId != null
3101
+ }), pe = Yo({
3102
+ disabled: !L,
3103
+ index: C,
3104
+ node: E,
3105
+ rect: R
3106
+ });
3107
+ return k(() => {
3108
+ D && O.current.newIndex !== q && (O.current.newIndex = q), d !== O.current.containerId && (O.current.containerId = d), u !== O.current.items && (O.current.items = u);
3109
+ }, [D, q, d, u]), k(() => {
3110
+ if (W === O.current.activeId)
3111
+ return;
3112
+ if (W && !O.current.activeId) {
3113
+ O.current.activeId = W;
3114
+ return;
3115
+ }
3116
+ const Ie = setTimeout(() => {
3117
+ O.current.activeId = W;
3118
+ }, 50);
3119
+ return () => clearTimeout(Ie);
3120
+ }, [W]), {
3121
+ active: A,
3122
+ activeIndex: f,
3123
+ attributes: ne,
3124
+ data: x,
3125
+ rect: R,
3126
+ index: C,
3127
+ newIndex: q,
3128
+ items: u,
3129
+ isOver: N,
3130
+ isSorting: D,
3131
+ isDragging: J,
3132
+ listeners: De,
3133
+ node: E,
3134
+ overIndex: p,
3135
+ over: Ce,
3136
+ setNodeRef: v,
3137
+ setActivatorNodeRef: se,
3138
+ setDroppableNodeRef: B,
3139
+ setDraggableNodeRef: xe,
3140
+ transform: pe ?? K,
3141
+ transition: ae()
3142
+ };
3143
+ function ae() {
3144
+ if (
3145
+ // Temporarily disable transitions for a single frame to set up derived transforms
3146
+ pe || // Or to prevent items jumping to back to their "new" position when items change
3147
+ he && O.current.newIndex === C
3148
+ )
3149
+ return Ho;
3150
+ if (!(M && !ht(Z) || !c) && (D || L))
3151
+ return ge.Transition.toString({
3152
+ ...c,
3153
+ property: _n
3154
+ });
3155
+ }
3156
+ }
3157
+ function Ko(e, t) {
3158
+ var n, r;
3159
+ return typeof e == "boolean" ? {
3160
+ draggable: e,
3161
+ // Backwards compatibility
3162
+ droppable: !1
3163
+ } : {
3164
+ draggable: (n = e == null ? void 0 : e.draggable) != null ? n : t.draggable,
3165
+ droppable: (r = e == null ? void 0 : e.droppable) != null ? r : t.droppable
3166
+ };
3167
+ }
3168
+ S.Down, S.Right, S.Up, S.Left;
3169
+ const Uo = /iPad|iPhone|iPod/.test(navigator.platform);
3170
+ function Wo(e, t) {
3171
+ return Math.round(e / t);
3172
+ }
3173
+ function At(e, t, n, r, o) {
3174
+ const i = e.findIndex(({ id: m }) => m === n), s = e.findIndex(({ id: m }) => m === t), a = e[s], l = Ve(e, s, i), c = l[i - 1], u = l[i + 1], d = Wo(r, o), f = a.depth + d, h = Jo({
3175
+ previousItem: c
3176
+ }), b = qo({ nextItem: u });
3177
+ let g = f;
3178
+ return f >= h ? g = h : f < b && (g = b), { depth: g, maxDepth: h, minDepth: b, parentId: p() };
3179
+ function p() {
3180
+ var w;
3181
+ return g === 0 || !c ? null : g === c.depth ? c.parentId : g > c.depth ? c.id : ((w = l.slice(0, i).reverse().find((y) => y.depth === g)) == null ? void 0 : w.parentId) ?? null;
3182
+ }
3183
+ }
3184
+ function Jo({ previousItem: e }) {
3185
+ return e ? e.depth + 1 : 0;
3186
+ }
3187
+ function qo({ nextItem: e }) {
3188
+ return e ? e.depth : 0;
3189
+ }
3190
+ function jn(e, t = null, n = 0) {
3191
+ return e.reduce((r, o, i) => (r.push({ ...o, parentId: t, depth: n, index: i }), r.push(...jn(o.children, o.id, n + 1)), r), []);
3192
+ }
3193
+ function It(e) {
3194
+ return jn(e);
3195
+ }
3196
+ function Go(e) {
3197
+ const t = { id: "root", label: "", children: [] }, n = { [t.id]: t }, r = e.map((o) => ({ ...o, children: [] }));
3198
+ for (const o of r) {
3199
+ const { id: i, children: s, label: a } = o, l = o.parentId ?? t.id, c = n[l] ?? Zo(r, l);
3200
+ n[i] = { id: i, label: a, children: s }, c.children.push(o);
3201
+ }
3202
+ return t.children;
3203
+ }
3204
+ function Zo(e, t) {
3205
+ return e.find(({ id: n }) => n === t);
3206
+ }
3207
+ function Fn(e, t) {
3208
+ for (const n of e) {
3209
+ const { id: r, children: o } = n;
3210
+ if (r === t)
3211
+ return n;
3212
+ if (o.length) {
3213
+ const i = Fn(o, t);
3214
+ if (i)
3215
+ return i;
3216
+ }
3217
+ }
3218
+ }
3219
+ function Qo(e, t) {
3220
+ const { items: n, itemMap: r } = e, o = new Map(r);
3221
+ function i(a) {
3222
+ return a.filter((l) => l.id === t ? (o.delete(t), !1) : (l.children.length && (l.children = i(l.children)), !0));
3223
+ }
3224
+ return { items: i(n), itemMap: o };
3225
+ }
3226
+ function ei(e, t, n) {
3227
+ const { items: r, itemMap: o } = e, i = o.get(t);
3228
+ if (!i) return e;
3229
+ const s = { ...i, ...n(i) }, a = new Map(o);
3230
+ a.set(t, s);
3231
+ function l(u) {
3232
+ return u.map((d) => d.id === t ? (s.children && s.children.forEach((f) => {
3233
+ a.set(f.id, f);
3234
+ }), s) : d.children.length ? { ...d, children: l(d.children) } : d);
3235
+ }
3236
+ return { items: l(r), itemMap: a };
3237
+ }
3238
+ function ti(e) {
3239
+ const t = /* @__PURE__ */ new Map();
3240
+ function n(r) {
3241
+ t.set(r.id, r), r.children.forEach(n);
3242
+ }
3243
+ return e.forEach(n), { items: e, itemMap: t };
3244
+ }
3245
+ function Hn(e, t = 0) {
3246
+ return e.reduce((n, { children: r }) => r.length ? Hn(r, n + 1) : n + 1, t);
3247
+ }
3248
+ function ni(e, t) {
3249
+ const n = Fn(e, t);
3250
+ return n ? Hn(n.children) : 0;
3251
+ }
3252
+ function ri(e, t) {
3253
+ const n = [...t];
3254
+ return e.filter((r) => r.parentId && n.includes(r.parentId) ? (r.children.length && n.push(r.id), !1) : !0);
3255
+ }
3256
+ const oi = [
3257
+ S.Down,
3258
+ S.Right,
3259
+ S.Up,
3260
+ S.Left
3261
+ ], ii = [S.Left, S.Right], si = (e, t, n) => (r, {
3262
+ currentCoordinates: o,
3263
+ context: { active: i, over: s, collisionRect: a, droppableRects: l, droppableContainers: c }
3264
+ }) => {
3265
+ if (oi.includes(r.code)) {
3266
+ if (!i || !a)
3267
+ return;
3268
+ r.preventDefault();
3269
+ const {
3270
+ current: { items: u, offset: d }
3271
+ } = e;
3272
+ if (ii.includes(r.code) && (s != null && s.id)) {
3273
+ const { depth: g, maxDepth: p, minDepth: m } = At(
3274
+ u,
3275
+ i.id,
3276
+ s.id,
3277
+ d,
3278
+ n
3279
+ );
3280
+ switch (r.code) {
3281
+ case S.Left:
3282
+ if (g > m)
3283
+ return {
3284
+ ...o,
3285
+ x: o.x - n
3286
+ };
3287
+ break;
3288
+ case S.Right:
3289
+ if (g < p)
3290
+ return {
3291
+ ...o,
3292
+ x: o.x + n
3293
+ };
3294
+ break;
3295
+ }
3296
+ return;
3297
+ }
3298
+ const f = [];
3299
+ c.forEach((g) => {
3300
+ if (g != null && g.disabled || g.id === (s == null ? void 0 : s.id))
3301
+ return;
3302
+ const p = l.get(g.id);
3303
+ if (p)
3304
+ switch (r.code) {
3305
+ case S.Down:
3306
+ a.top < p.top && f.push(g);
3307
+ break;
3308
+ case S.Up:
3309
+ a.top > p.top && f.push(g);
3310
+ break;
3311
+ }
3312
+ });
3313
+ const h = yr({
3314
+ active: i,
3315
+ collisionRect: a,
3316
+ pointerCoordinates: null,
3317
+ droppableRects: l,
3318
+ droppableContainers: f
3319
+ });
3320
+ let b = yn(h, "id");
3321
+ if (b === (s == null ? void 0 : s.id) && h.length > 1 && (b = h[1].id), b && (s != null && s.id)) {
3322
+ const g = l.get(i.id), p = l.get(b), m = c.get(b);
3323
+ if (g && p && m) {
3324
+ const w = u.findIndex(({ id: I }) => I === b), y = u[w], C = u.findIndex(({ id: I }) => I === i.id), x = u[C];
3325
+ if (y && x) {
3326
+ const { depth: I } = At(
3327
+ u,
3328
+ i.id,
3329
+ b,
3330
+ (y.depth - x.depth) * n,
3331
+ n
3332
+ ), E = w > C ? 1 : -1, N = t ? (a.height - g.height) / 2 : 0;
3333
+ return {
3334
+ x: p.left + I * n,
3335
+ y: p.top + E * N
3336
+ };
3337
+ }
3338
+ }
3339
+ }
3340
+ }
3341
+ }, ai = "_Wrapper_1ewsl_1", li = "_clone_1ewsl_8", ci = "_TreeItem_1ewsl_16", ui = "_ghost_1ewsl_23", di = "_indicator_1ewsl_23", fi = "_Text_1ewsl_78", gi = "_Count_1ewsl_90", hi = "_disableInteraction_1ewsl_106", pi = "_disableSelection_1ewsl_110", vi = "_Collapse_1ewsl_118", bi = "_collapsed_1ewsl_122", ue = {
3342
+ Wrapper: ai,
3343
+ clone: li,
3344
+ TreeItem: ci,
3345
+ ghost: ui,
3346
+ indicator: di,
3347
+ Text: fi,
3348
+ Count: gi,
3349
+ disableInteraction: hi,
3350
+ disableSelection: pi,
3351
+ Collapse: vi,
3352
+ collapsed: bi
3353
+ };
3354
+ function mi(e) {
3355
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3356
+ }
3357
+ var Xn = { exports: {} };
3358
+ /*!
3359
+ Copyright (c) 2018 Jed Watson.
3360
+ Licensed under the MIT License (MIT), see
3361
+ http://jedwatson.github.io/classnames
3362
+ */
3363
+ (function(e) {
3364
+ (function() {
3365
+ var t = {}.hasOwnProperty;
3366
+ function n() {
3367
+ for (var i = "", s = 0; s < arguments.length; s++) {
3368
+ var a = arguments[s];
3369
+ a && (i = o(i, r(a)));
3370
+ }
3371
+ return i;
3372
+ }
3373
+ function r(i) {
3374
+ if (typeof i == "string" || typeof i == "number")
3375
+ return i;
3376
+ if (typeof i != "object")
3377
+ return "";
3378
+ if (Array.isArray(i))
3379
+ return n.apply(null, i);
3380
+ if (i.toString !== Object.prototype.toString && !i.toString.toString().includes("[native code]"))
3381
+ return i.toString();
3382
+ var s = "";
3383
+ for (var a in i)
3384
+ t.call(i, a) && i[a] && (s = o(s, a));
3385
+ return s;
3386
+ }
3387
+ function o(i, s) {
3388
+ return s ? i ? i + " " + s : i + s : i;
3389
+ }
3390
+ e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
3391
+ })();
3392
+ })(Xn);
3393
+ var yi = Xn.exports;
3394
+ const Mt = /* @__PURE__ */ mi(yi), wi = "_Action_1vzup_1", xi = {
3395
+ Action: wi
3396
+ }, bt = dt(
3397
+ ({ active: e, className: t, cursor: n, style: r, ...o }, i) => /* @__PURE__ */ _(
3398
+ "button",
3399
+ {
3400
+ ref: i,
3401
+ ...o,
3402
+ className: Mt(xi.Action, t),
3403
+ tabIndex: 0,
3404
+ style: {
3405
+ ...r,
3406
+ cursor: n,
3407
+ "--fill": e == null ? void 0 : e.fill,
3408
+ "--background": e == null ? void 0 : e.background
3409
+ }
3410
+ }
3411
+ )
3412
+ ), Di = dt(
3413
+ (e, t) => /* @__PURE__ */ _(
3414
+ bt,
3415
+ {
3416
+ ref: t,
3417
+ cursor: "grab",
3418
+ "data-cypress": "draggable-handle",
3419
+ ...e,
3420
+ children: /* @__PURE__ */ _("svg", { viewBox: "0 0 20 20", width: "12", children: /* @__PURE__ */ _("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) })
3421
+ }
3422
+ )
3423
+ );
3424
+ function Ci(e) {
3425
+ return /* @__PURE__ */ _(
3426
+ bt,
3427
+ {
3428
+ ...e,
3429
+ active: {
3430
+ fill: "rgba(255, 70, 70, 0.95)",
3431
+ background: "rgba(255, 70, 70, 0.1)"
3432
+ },
3433
+ children: /* @__PURE__ */ _(
3434
+ "svg",
3435
+ {
3436
+ width: "18",
3437
+ height: "18",
3438
+ viewBox: "0 0 18 18",
3439
+ fill: "none",
3440
+ xmlns: "http://www.w3.org/2000/svg",
3441
+ children: /* @__PURE__ */ _("path", { d: "M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z" })
3442
+ }
3443
+ )
3444
+ }
3445
+ );
3446
+ }
3447
+ function Si(e) {
3448
+ return /* @__PURE__ */ _(
3449
+ bt,
3450
+ {
3451
+ ...e,
3452
+ active: {
3453
+ fill: "rgba(255, 70, 70, 0.95)",
3454
+ background: "rgba(255, 70, 70, 0.1)"
3455
+ },
3456
+ children: /* @__PURE__ */ _(
3457
+ "svg",
3458
+ {
3459
+ width: "18",
3460
+ height: "18",
3461
+ viewBox: "0 0 18 18",
3462
+ fill: "none",
3463
+ xmlns: "http://www.w3.org/2000/svg",
3464
+ children: /* @__PURE__ */ _("path", { d: "M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z" })
3465
+ }
3466
+ )
3467
+ }
3468
+ );
3469
+ }
3470
+ const Ii = dt(
3471
+ ({
3472
+ childCount: e,
3473
+ clone: t,
3474
+ depth: n,
3475
+ disableSelection: r,
3476
+ disableInteraction: o,
3477
+ disableDragging: i,
3478
+ ghost: s,
3479
+ handleProps: a,
3480
+ indentationWidth: l,
3481
+ indicator: c,
3482
+ collapsed: u,
3483
+ onCollapse: d,
3484
+ onRemove: f,
3485
+ onAdd: h,
3486
+ onLabelClick: b,
3487
+ style: g,
3488
+ value: p,
3489
+ wrapperRef: m,
3490
+ ...w
3491
+ }, y) => /* @__PURE__ */ _(
3492
+ "li",
3493
+ {
3494
+ className: Mt(
3495
+ ue.Wrapper,
3496
+ t && ue.clone,
3497
+ s && ue.ghost,
3498
+ c && ue.indicator,
3499
+ r && ue.disableSelection,
3500
+ o && ue.disableInteraction
3501
+ ),
3502
+ ref: m,
3503
+ style: {
3504
+ "--spacing": `${l * n}px`
3505
+ },
3506
+ ...w,
3507
+ children: /* @__PURE__ */ fn("div", { className: ue.TreeItem, ref: y, style: g, children: [
3508
+ !i && /* @__PURE__ */ _(Di, { ...a }),
3509
+ d && /* @__PURE__ */ _(bt, { onClick: d, className: Mt(ue.Collapse, u && ue.collapsed), children: Ri }),
3510
+ /* @__PURE__ */ _("span", { onClick: b, className: ue.Text, children: p }),
3511
+ !t && f && /* @__PURE__ */ _(Ci, { onClick: f }),
3512
+ !t && h && /* @__PURE__ */ _(Si, { onClick: h }),
3513
+ t && e && e > 1 ? /* @__PURE__ */ _("span", { className: ue.Count, children: e }) : null
3514
+ ] })
3515
+ }
3516
+ )
3517
+ ), Ri = /* @__PURE__ */ _("svg", { width: "10", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 70 41", children: /* @__PURE__ */ _("path", { d: "M30.76 39.2402C31.885 40.3638 33.41 40.995 35 40.995C36.59 40.995 38.115 40.3638 39.24 39.2402L68.24 10.2402C69.2998 9.10284 69.8768 7.59846 69.8494 6.04406C69.822 4.48965 69.1923 3.00657 68.093 1.90726C66.9937 0.807959 65.5106 0.178263 63.9562 0.150837C62.4018 0.123411 60.8974 0.700397 59.76 1.76024L35 26.5102L10.24 1.76024C9.10259 0.700397 7.59822 0.123411 6.04381 0.150837C4.4894 0.178263 3.00632 0.807959 1.90702 1.90726C0.807714 3.00657 0.178019 4.48965 0.150593 6.04406C0.123167 7.59846 0.700153 9.10284 1.75999 10.2402L30.76 39.2402Z" }) }), Ei = ut(Ii), Oi = ({ isSorting: e, wasDragging: t }) => !(e || t);
3518
+ function Ti({ id: e, depth: t, ...n }) {
3519
+ const {
3520
+ attributes: r,
3521
+ isDragging: o,
3522
+ isSorting: i,
3523
+ listeners: s,
3524
+ setDraggableNodeRef: a,
3525
+ setDroppableNodeRef: l,
3526
+ transform: c,
3527
+ transition: u
3528
+ } = Vo({
3529
+ id: e,
3530
+ animateLayoutChanges: Oi
3531
+ }), d = {
3532
+ transform: ge.Translate.toString(c),
3533
+ transition: u
3534
+ };
3535
+ return /* @__PURE__ */ _(
3536
+ Ei,
3537
+ {
3538
+ ref: a,
3539
+ wrapperRef: l,
3540
+ style: d,
3541
+ depth: t,
3542
+ ghost: o,
3543
+ disableSelection: Uo,
3544
+ disableInteraction: i,
3545
+ handleProps: n.disableDragging ? null : {
3546
+ ...r,
3547
+ ...s
3548
+ },
3549
+ ...n
3550
+ }
3551
+ );
3552
+ }
3553
+ const dn = ut(Ti), Ai = {
3554
+ droppable: {
3555
+ strategy: Me.Always
3556
+ }
3557
+ }, Mi = {
3558
+ keyframes({ transform: e }) {
3559
+ return [
3560
+ { opacity: 1, transform: ge.Transform.toString(e.initial) },
3561
+ {
3562
+ opacity: 0,
3563
+ transform: ge.Transform.toString({
3564
+ ...e.final,
3565
+ x: e.final.x + 5,
3566
+ y: e.final.y + 5
3567
+ })
3568
+ }
3569
+ ];
3570
+ },
3571
+ easing: "ease-out",
3572
+ sideEffects({ active: e }) {
3573
+ e.node.animate([{ opacity: 0 }, { opacity: 1 }], {
3574
+ duration: Tt.duration,
3575
+ easing: Tt.easing
3576
+ });
3577
+ }
3578
+ };
3579
+ function Ni({
3580
+ items: e,
3581
+ onItemsChange: t,
3582
+ isCollapsible: n,
3583
+ onLazyLoadChildren: r,
3584
+ showDropIndicator: o = !1,
3585
+ indentationWidth: i = 50,
3586
+ isRemovable: s,
3587
+ onRemoveItem: a,
3588
+ allowNestedItemAddition: l,
3589
+ onAddItem: c,
3590
+ onDragEnd: u,
3591
+ onItemClick: d
3592
+ }) {
3593
+ const [f, h] = V(null), [b, g] = V(null), [p, m] = V(0), [w, y] = V(null), C = T(() => {
3594
+ let v = It(e);
3595
+ const D = v.filter(({ parentId: M }) => !M);
3596
+ D.length === 1 && (v = v.map(
3597
+ (M) => M.id === D[0].id ? {
3598
+ ...M,
3599
+ disableDragging: !0
3600
+ } : M
3601
+ ));
3602
+ const P = v.reduce((M, { children: F, collapsed: H, id: K }) => (H && F.length && M.push(K), M), []);
3603
+ return ri(v, f ? [f, ...P] : P);
3604
+ }, [f, e]), x = f && b ? At(C, f, b, p, i) : null, I = z({
3605
+ items: C,
3606
+ offset: p
3607
+ }), [R] = V(
3608
+ () => si(I, o, i)
3609
+ ), E = pr(
3610
+ Gt(_t),
3611
+ Gt(Bt, {
3612
+ coordinateGetter: R
3613
+ })
3614
+ ), N = T(() => C.map(({ id: v }) => v), [C]), B = f ? C.find(({ id: v }) => v === f) : null;
3615
+ k(() => {
3616
+ I.current = {
3617
+ items: C,
3618
+ offset: p
3619
+ };
3620
+ }, [C, p]);
3621
+ const A = $(
3622
+ ({ active: { id: v } }) => {
3623
+ h(v), g(v);
3624
+ const D = C.find(({ id: P }) => P === v);
3625
+ D && y({
3626
+ parentId: D.parentId,
3627
+ overId: v
3628
+ }), document.body.style.setProperty("cursor", "grabbing");
3629
+ },
3630
+ [C]
3631
+ ), Z = $(({ delta: v }) => {
3632
+ m(v.x);
3633
+ }, []), Q = $(({ over: v }) => {
3634
+ g((v == null ? void 0 : v.id) ?? null);
3635
+ }, []), ne = $(
3636
+ ({ active: v, over: D }) => {
3637
+ if (De(), x && D) {
3638
+ const { depth: P, parentId: M } = x, F = JSON.parse(JSON.stringify(It(e))), H = F.findIndex(({ id: L }) => L === D.id), K = F.findIndex(({ id: L }) => L === v.id), q = F[K];
3639
+ F[K] = { ...q, depth: P, parentId: M };
3640
+ const W = Ve(F, K, H), O = Go(W), he = Yn(O, F[K].id, M);
3641
+ t(ti(O)), u == null || u(he);
3642
+ }
3643
+ },
3644
+ [e, x]
3645
+ ), xe = $(() => {
3646
+ De();
3647
+ }, []), De = $(() => {
3648
+ g(null), h(null), m(0), y(null), document.body.style.setProperty("cursor", "");
3649
+ }, []), J = $((v) => {
3650
+ t((D) => Qo(D, v));
3651
+ }, []), Ce = $(
3652
+ ({
3653
+ id: v,
3654
+ canFetchChildren: D,
3655
+ collapsed: P
3656
+ }) => D ? r == null ? void 0 : r(v, !!P) : t(
3657
+ (M) => ei(M, v, (F) => ({ collapsed: !F.collapsed }))
3658
+ ),
3659
+ []
3660
+ ), se = $(
3661
+ (v, D, P) => {
3662
+ if (P && x) {
3663
+ if (v !== "onDragEnd") {
3664
+ if (w && x.parentId === w.parentId && P === w.overId)
3665
+ return;
3666
+ y({
3667
+ parentId: x.parentId,
3668
+ overId: P
3669
+ });
3670
+ }
3671
+ const M = JSON.parse(JSON.stringify(It(e))), F = M.findIndex(({ id: L }) => L === P), H = M.findIndex(({ id: L }) => L === D), K = Ve(M, H, F), q = K[F - 1];
3672
+ let W;
3673
+ const O = v === "onDragEnd" ? "dropped" : "moved", he = v === "onDragEnd" ? "dropped" : "nested";
3674
+ if (q)
3675
+ if (x.depth > q.depth)
3676
+ W = `${D} was ${he} under ${q.id}.`;
3677
+ else {
3678
+ let L = q;
3679
+ for (; L && x.depth < L.depth; ) {
3680
+ const pe = L.parentId;
3681
+ L = K.find(({ id: ae }) => ae === pe);
3682
+ }
3683
+ L && (W = `${D} was ${O} after ${L.id}.`);
3684
+ }
3685
+ else {
3686
+ const L = K[F + 1];
3687
+ W = `${D} was ${O} before ${L.id}.`;
3688
+ }
3689
+ return W;
3690
+ }
3691
+ },
3692
+ [w, e, x]
3693
+ );
3694
+ return /* @__PURE__ */ _(
3695
+ ho,
3696
+ {
3697
+ accessibility: { announcements: {
3698
+ onDragStart({ active: v }) {
3699
+ return `Picked up ${v.id}.`;
3700
+ },
3701
+ onDragMove({ active: v, over: D }) {
3702
+ return se("onDragMove", v.id, D == null ? void 0 : D.id);
3703
+ },
3704
+ onDragOver({ active: v, over: D }) {
3705
+ return se("onDragOver", v.id, D == null ? void 0 : D.id);
3706
+ },
3707
+ onDragEnd({ active: v, over: D }) {
3708
+ return se("onDragEnd", v.id, D == null ? void 0 : D.id);
3709
+ },
3710
+ onDragCancel({ active: v }) {
3711
+ return `Moving was cancelled. ${v.id} was dropped in its original position.`;
3712
+ }
3713
+ } },
3714
+ sensors: E,
3715
+ collisionDetection: mr,
3716
+ measuring: Ai,
3717
+ onDragStart: A,
3718
+ onDragMove: Z,
3719
+ onDragOver: Q,
3720
+ onDragEnd: ne,
3721
+ onDragCancel: xe,
3722
+ children: /* @__PURE__ */ fn($o, { items: N, strategy: zo, children: [
3723
+ C.map(({ id: v, label: D, children: P, collapsed: M, depth: F, canFetchChildren: H, disableDragging: K }) => /* @__PURE__ */ _(
3724
+ dn,
3725
+ {
3726
+ id: v,
3727
+ value: D,
3728
+ disableDragging: !!K,
3729
+ depth: v === f && x ? x.depth : F,
3730
+ indentationWidth: i,
3731
+ indicator: o,
3732
+ collapsed: !!(M && (P.length || H)),
3733
+ onCollapse: n && (P.length || H) ? () => Ce({ id: v, canFetchChildren: H, collapsed: M }) : void 0,
3734
+ onRemove: s ? () => a ? a(v) : J(v) : void 0,
3735
+ onAdd: l ? () => c == null ? void 0 : c(v) : void 0,
3736
+ onLabelClick: d ? () => d(v) : void 0
3737
+ },
3738
+ v
3739
+ )),
3740
+ gn(
3741
+ /* @__PURE__ */ _(
3742
+ No,
3743
+ {
3744
+ dropAnimation: Mi,
3745
+ modifiers: o ? [Li] : void 0,
3746
+ children: f && B ? /* @__PURE__ */ _(
3747
+ dn,
3748
+ {
3749
+ id: f,
3750
+ depth: B.depth,
3751
+ clone: !0,
3752
+ childCount: ni(e, f) + 1,
3753
+ value: B.label,
3754
+ indentationWidth: i
3755
+ }
3756
+ ) : null
3757
+ }
3758
+ ),
3759
+ document.body
3760
+ )
3761
+ ] })
3762
+ }
3763
+ );
3764
+ }
3765
+ const Li = ({ transform: e }) => ({
3766
+ ...e,
3767
+ y: e.y - 25
3768
+ });
3769
+ function Yn(e, t, n = null) {
3770
+ for (let r = 0; r < e.length; r++) {
3771
+ const o = e[r];
3772
+ if (o.id === t)
3773
+ return { index: r, parent: n, movedItem: o };
3774
+ if (o.children && o.children.length > 0) {
3775
+ const i = Yn(o.children, t, o.id);
3776
+ if (i)
3777
+ return i;
3778
+ }
3779
+ }
3780
+ return null;
3781
+ }
3782
+ const Bi = ut(Ni);
3783
+ export {
3784
+ Bi as SortableTree,
3785
+ ti as createOptimizedTreeStructure,
3786
+ Qo as removeItemById,
3787
+ ei as setTreeItemProperties
3788
+ };
3789
+ //# sourceMappingURL=react-sortable-tree.js.map