@object-ui/plugin-kanban 3.1.3 → 3.1.5

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