@vue-dnd-kit/core 2.0.8 → 2.0.10

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,5 +1,5 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-default-overlay{transform:translate3d(var(--position-x),var(--position-y),0)}.dnd-kit-overlay-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing;z-index:9999}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- import { ref as j, watch as re, shallowRef as te, reactive as q, computed as y, onScopeDispose as je, onMounted as U, onBeforeUnmount as V, inject as Be, defineComponent as Fe, unref as k, openBlock as C, createElementBlock as J, normalizeStyle as Le, Fragment as he, renderList as Je, createBlock as ne, resolveDynamicComponent as be, createCommentVNode as Qe, useTemplateRef as et, provide as tt, renderSlot as Ce, Teleport as nt, createElementVNode as st, mergeProps as ot } from "vue";
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-default-overlay{transform:translate3d(var(--position-x),var(--position-y),0)}pre{position:fixed;bottom:0;left:0;margin:0;padding:8px;font-size:12px;background-color:#fffc;border-top-right-radius:4px;z-index:9999}.dnd-kit-overlay-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing;z-index:9999}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ import { ref as j, watch as ie, shallowRef as te, reactive as q, computed as y, onScopeDispose as Qe, onMounted as U, onBeforeUnmount as V, inject as Fe, defineComponent as _e, unref as C, openBlock as I, createElementBlock as J, normalizeStyle as Le, Fragment as he, renderList as et, createBlock as ne, resolveDynamicComponent as be, createCommentVNode as tt, useTemplateRef as nt, provide as st, renderSlot as Ce, Teleport as ot, createElementVNode as Ie, mergeProps as at, toDisplayString as it } from "vue";
3
3
  const T = {
4
4
  SELECT_AREA: "data-dnd-kit-select-area",
5
5
  DRAGGABLE: "data-dnd-kit-draggable",
@@ -9,26 +9,26 @@ const T = {
9
9
  SELECT_AREA: `[${T.SELECT_AREA}]`,
10
10
  DRAGGABLE: `[${T.DRAGGABLE}]`,
11
11
  CONSTRAINT_AREA: `[${T.CONSTRAINT_AREA}]`
12
- }, we = "VueDnDKitProvider", Ie = (e, t, s, n) => {
12
+ }, ve = "VueDnDKitProvider", Re = (e, t, s, n) => {
13
13
  const o = /* @__PURE__ */ new Set();
14
- return t.forEach((r) => {
15
- const a = e.get(r), i = n ? n(r) : a?.disabled;
16
- if (!a || i) return;
14
+ return t.forEach((i) => {
15
+ const a = e.get(i), r = n ? n(i) : a?.disabled;
16
+ if (!a || r) return;
17
17
  const g = a.modifier?.keys, l = a.modifier?.method;
18
18
  if (!g || !l || g.length === 0) {
19
- o.add(r);
19
+ o.add(i);
20
20
  return;
21
21
  }
22
- g[l]((c) => s.value.has(c)) && o.add(r);
22
+ g[l]((c) => s.value.has(c)) && o.add(i);
23
23
  }), o;
24
24
  };
25
- let _e = "", at = "", rt = "";
26
- const D = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, K = (e, t) => e !== t && e.contains(t), it = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), ye = () => {
25
+ let Ge = "", rt = "", lt = "";
26
+ const D = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, K = (e, t) => e !== t && e.contains(t), ct = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), ye = () => {
27
27
  const e = document.body;
28
- _e = e.style.userSelect, e.style.userSelect = "none", window.addEventListener("contextmenu", M), window.addEventListener("selectstart", M), window.addEventListener("touchstart", M), window.addEventListener("touchmove", M);
28
+ Ge = e.style.userSelect, e.style.userSelect = "none", window.addEventListener("contextmenu", M), window.addEventListener("selectstart", M), window.addEventListener("touchstart", M), window.addEventListener("touchmove", M);
29
29
  }, pe = () => {
30
30
  const e = document.body;
31
- e.style.userSelect = _e, e.style.touchAction = at, e.style.overscrollBehavior = rt, window.removeEventListener("contextmenu", M), window.removeEventListener("selectstart", M), window.removeEventListener("touchstart", M), window.removeEventListener("touchmove", M);
31
+ e.style.userSelect = Ge, e.style.touchAction = rt, e.style.overscrollBehavior = lt, window.removeEventListener("contextmenu", M), window.removeEventListener("selectstart", M), window.removeEventListener("touchstart", M), window.removeEventListener("touchmove", M);
32
32
  }, M = (e) => e.preventDefault(), xe = (e, t) => {
33
33
  if (t.entities.draggableMap.get(e)?.disabled) return !0;
34
34
  for (const n of t.entities.visibleDraggableSet)
@@ -44,31 +44,31 @@ const D = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$e
44
44
  const s = new Set(t);
45
45
  return e.some((n) => s.has(n));
46
46
  };
47
- function lt(e, t, s, n) {
47
+ function gt(e, t, s, n) {
48
48
  const o = /* @__PURE__ */ new Set();
49
- for (const i of t.keys()) {
50
- const g = s.get(i);
49
+ for (const r of t.keys()) {
50
+ const g = s.get(r);
51
51
  for (const l of g?.groups ?? []) o.add(l);
52
52
  }
53
- const r = [...o], a = /* @__PURE__ */ new Set();
54
- for (const i of e) {
55
- const l = n.get(i)?.groups ?? [];
56
- Ae(r, l) && a.add(i);
53
+ const i = [...o], a = /* @__PURE__ */ new Set();
54
+ for (const r of e) {
55
+ const l = n.get(r)?.groups ?? [];
56
+ Ae(i, l) && a.add(r);
57
57
  }
58
58
  return a;
59
59
  }
60
- function ct(e, t, s) {
60
+ function ut(e, t, s) {
61
61
  const n = /* @__PURE__ */ new Set();
62
62
  for (const a of t.keys()) {
63
- const i = s.get(a);
64
- for (const g of i?.groups ?? []) n.add(g);
63
+ const r = s.get(a);
64
+ for (const g of r?.groups ?? []) n.add(g);
65
65
  }
66
- const o = [...n], r = /* @__PURE__ */ new Set();
66
+ const o = [...n], i = /* @__PURE__ */ new Set();
67
67
  for (const a of e) {
68
68
  const g = s.get(a)?.groups ?? [];
69
- Ae(o, g) && r.add(a);
69
+ Ae(o, g) && i.add(a);
70
70
  }
71
- return r;
71
+ return i;
72
72
  }
73
73
  const ge = (e) => {
74
74
  const t = new IntersectionObserver((s) => {
@@ -82,23 +82,23 @@ const ge = (e) => {
82
82
  unobserve: (s) => t.unobserve(s),
83
83
  disconnect: () => t.disconnect()
84
84
  };
85
- }, gt = (e) => {
85
+ }, ft = (e) => {
86
86
  const t = new ResizeObserver((s) => {
87
87
  const n = s[0];
88
88
  if (!n) return;
89
- const { width: o, height: r } = n.contentRect;
90
- e.value = { width: o, height: r };
89
+ const { width: o, height: i } = n.contentRect;
90
+ e.value = { width: o, height: i };
91
91
  });
92
92
  return {
93
93
  observe: (s) => t.observe(s),
94
94
  unobserve: (s) => t.unobserve(s),
95
95
  disconnect: () => t.disconnect()
96
96
  };
97
- }, ut = (e) => {
98
- const t = j(null), s = gt(t), n = re(
97
+ }, dt = (e) => {
98
+ const t = j(null), s = ft(t), n = ie(
99
99
  e,
100
- (r) => {
101
- s.disconnect(), r && s.observe(r);
100
+ (i) => {
101
+ s.disconnect(), i && s.observe(i);
102
102
  },
103
103
  { immediate: !0 }
104
104
  );
@@ -115,11 +115,11 @@ function Se(e, t = 0, s = 0) {
115
115
  offset: { x: t, y: s }
116
116
  };
117
117
  }
118
- function Ge(e, t) {
118
+ function He(e, t) {
119
119
  const s = t.getBoundingClientRect(), n = s.width > 0 ? (e.clientX - s.left) / s.width : 0.5, o = s.height > 0 ? (e.clientY - s.top) / s.height : 0.5;
120
120
  return { x: n, y: o };
121
121
  }
122
- function He(e, t) {
122
+ function Ke(e, t) {
123
123
  return {
124
124
  ...t,
125
125
  initialHTML: e.innerHTML,
@@ -127,34 +127,34 @@ function He(e, t) {
127
127
  initialOuterHTML: e.outerHTML
128
128
  };
129
129
  }
130
- function ft(e, t, s) {
130
+ function mt(e, t, s) {
131
131
  e.forEach((n) => {
132
132
  const o = t.get(n);
133
- s.set(n, He(n, o));
133
+ s.set(n, Ke(n, o));
134
134
  }), e.clear();
135
135
  }
136
- function dt(e, t, s) {
136
+ function ht(e, t, s) {
137
137
  s.clear();
138
138
  const n = t.get(e);
139
- s.set(e, He(e, n));
139
+ s.set(e, Ke(e, n));
140
140
  }
141
141
  function se(e) {
142
- e.entities.initiatingDraggable && (e.state.value = "dragging", mt(
142
+ e.entities.initiatingDraggable && (e.state.value = "dragging", bt(
143
143
  e.entities.initiatingDraggable,
144
144
  e.entities.selectedSet,
145
145
  e.entities.draggableMap,
146
146
  e.entities.draggingMap
147
147
  ));
148
148
  }
149
- function mt(e, t, s, n) {
150
- t.has(e) ? ft(t, s, n) : (t.clear(), dt(e, s, n));
149
+ function bt(e, t, s, n) {
150
+ t.has(e) ? mt(t, s, n) : (t.clear(), ht(e, s, n));
151
151
  }
152
- function Ke(e, t, s, n) {
152
+ function Ze(e, t, s, n) {
153
153
  if (n || !s) return !0;
154
154
  const o = e.closest(s);
155
155
  return o ? t.contains(o) : !1;
156
156
  }
157
- function ht(e, t) {
157
+ function yt(e, t) {
158
158
  if (!e || !t) return 1;
159
159
  const s = Math.abs(e.current.x - e.start.x), n = Math.abs(e.current.y - e.start.y);
160
160
  if (typeof t == "number") {
@@ -163,31 +163,31 @@ function ht(e, t) {
163
163
  }
164
164
  const {
165
165
  x: o = 0,
166
- y: r = 0,
166
+ y: i = 0,
167
167
  condition: a = "any"
168
168
  } = t;
169
- if (o === 0 && r === 0) return 1;
170
- const i = o > 0 ? Math.min(s / o, 1) : 1, g = r > 0 ? Math.min(n / r, 1) : 1;
171
- return a === "both" ? Math.min(i, g) : Math.max(i, g);
169
+ if (o === 0 && i === 0) return 1;
170
+ const r = o > 0 ? Math.min(s / o, 1) : 1, g = i > 0 ? Math.min(n / i, 1) : 1;
171
+ return a === "both" ? Math.min(r, g) : Math.max(r, g);
172
172
  }
173
- function Ze(e, t, s) {
173
+ function Ne(e, t, s) {
174
174
  if (!s) return !0;
175
175
  const n = s.distance != null, o = s.delay != null;
176
176
  return !n && !o ? !0 : n && !o ? e >= 1 : !n && o ? t >= 1 : (s.condition ?? "both") === "both" ? e >= 1 && t >= 1 : e >= 1 || t >= 1;
177
177
  }
178
- function bt(e) {
178
+ function pt(e) {
179
179
  if (e.state.value !== "activating" || !e.entities.initiatingDraggable)
180
180
  return !1;
181
181
  const t = e.entities.draggableMap.get(
182
182
  e.entities.initiatingDraggable
183
183
  );
184
- return Ze(
184
+ return Ne(
185
185
  e.distanceProgress.value,
186
186
  e.delay.progress,
187
187
  t?.activation
188
188
  ) ? (se(e), !0) : !1;
189
189
  }
190
- function yt(e, t) {
190
+ function St(e, t) {
191
191
  let s = null;
192
192
  const n = () => {
193
193
  if (e.state.value !== "activating" || !e.entities.initiatingDraggable) {
@@ -196,15 +196,15 @@ function yt(e, t) {
196
196
  }
197
197
  const o = e.entities.draggableMap.get(
198
198
  e.entities.initiatingDraggable
199
- ), r = o?.activation?.delay;
200
- if (!r) {
199
+ ), i = o?.activation?.delay;
200
+ if (!i) {
201
201
  s = null;
202
202
  return;
203
203
  }
204
204
  e.delay.progress = Math.min(
205
- (Date.now() - e.delay.startTime) / (r * 1e3),
205
+ (Date.now() - e.delay.startTime) / (i * 1e3),
206
206
  1
207
- ), Ze(
207
+ ), Ne(
208
208
  e.distanceProgress.value,
209
209
  e.delay.progress,
210
210
  o?.activation
@@ -216,7 +216,7 @@ function yt(e, t) {
216
216
  }
217
217
  };
218
218
  }
219
- function pt(e, t) {
219
+ function Dt(e, t) {
220
220
  const s = e.closest(
221
221
  _.CONSTRAINT_AREA
222
222
  );
@@ -225,41 +225,41 @@ function pt(e, t) {
225
225
  entity: t.get(s)
226
226
  };
227
227
  }
228
- function St(e, t, s, n) {
228
+ function Mt(e, t, s, n) {
229
229
  return s === "x" ? { x: e, y: n.top } : s === "y" ? { x: n.left, y: t } : { x: e, y: t };
230
230
  }
231
- function Dt(e, t, s, n, o) {
232
- let r = e, a = t;
233
- return s !== "y" && (r = Math.max(
231
+ function wt(e, t, s, n, o) {
232
+ let i = e, a = t;
233
+ return s !== "y" && (i = Math.max(
234
234
  n.left,
235
235
  Math.min(n.right - o.width, e)
236
236
  )), s !== "x" && (a = Math.max(
237
237
  n.top,
238
238
  Math.min(n.bottom - o.height, t)
239
- )), { x: r, y: a };
239
+ )), { x: i, y: a };
240
240
  }
241
- function Mt(e, t, s, n, o) {
241
+ function vt(e, t, s, n, o) {
242
242
  if (!e || !t)
243
243
  return { x: 0, y: 0 };
244
- const r = t.getBoundingClientRect(), a = r.width || o?.width || 0, i = r.height || o?.height || 0;
245
- let g = e.current.x - a * e.offset.x, l = e.current.y - i * e.offset.y;
244
+ const i = t.getBoundingClientRect(), a = i.width || o?.width || 0, r = i.height || o?.height || 0;
245
+ let g = e.current.x - a * e.offset.x, l = e.current.y - r * e.offset.y;
246
246
  if (!s)
247
247
  return { x: g, y: l };
248
- const u = pt(s, n);
248
+ const u = Dt(s, n);
249
249
  if (!u)
250
250
  return { x: g, y: l };
251
- const { element: c, entity: f } = u, d = c.getBoundingClientRect(), m = s.getBoundingClientRect(), h = St(
251
+ const { element: c, entity: f } = u, d = c.getBoundingClientRect(), m = s.getBoundingClientRect(), h = Mt(
252
252
  g,
253
253
  l,
254
254
  f.axis || "both",
255
255
  m
256
256
  );
257
- return f.restrictToArea ? Dt(
257
+ return f.restrictToArea ? wt(
258
258
  h.x,
259
259
  h.y,
260
260
  f.axis || "both",
261
261
  d,
262
- r
262
+ i
263
263
  ) : h;
264
264
  }
265
265
  const N = {
@@ -278,8 +278,8 @@ const N = {
278
278
  ],
279
279
  forMoveFaster: ["ShiftLeft", "ShiftRight"]
280
280
  };
281
- function vt(e, t) {
282
- const s = te(), n = j(), r = {
281
+ function xt(e, t) {
282
+ const s = te(), n = j(), i = {
283
283
  keys: {
284
284
  pressedKeys: j(/* @__PURE__ */ new Set()),
285
285
  forDrag: [...N.forDrag],
@@ -299,32 +299,33 @@ function vt(e, t) {
299
299
  selectingArea: void 0,
300
300
  draggingMap: /* @__PURE__ */ new Map(),
301
301
  selectedSet: /* @__PURE__ */ new Set(),
302
- allowedDroppableSet: y(() => s.value ? lt(
302
+ selectionBase: /* @__PURE__ */ new Set(),
303
+ allowedDroppableSet: y(() => s.value ? gt(
303
304
  a.visibleDroppableSet,
304
305
  a.draggingMap,
305
306
  a.draggableMap,
306
307
  a.droppableMap
307
308
  ) : /* @__PURE__ */ new Set()),
308
- allowedDraggableSet: y(() => s.value ? ct(
309
+ allowedDraggableSet: y(() => s.value ? ut(
309
310
  a.visibleDraggableSet,
310
311
  a.draggingMap,
311
312
  a.draggableMap
312
313
  ) : /* @__PURE__ */ new Set()),
313
- modifiersSelectableAreaSet: y(() => Ie(
314
+ modifiersSelectableAreaSet: y(() => Re(
314
315
  a.selectableAreaMap,
315
316
  a.visibleSelectableAreaSet,
316
- r.keys.pressedKeys
317
+ i.keys.pressedKeys
317
318
  )),
318
- modifiersDraggableSet: y(() => Ie(
319
+ modifiersDraggableSet: y(() => Re(
319
320
  a.draggableMap,
320
321
  a.visibleDraggableSet,
321
- r.keys.pressedKeys,
322
- (w) => xe(w, { entities: a })
322
+ i.keys.pressedKeys,
323
+ (v) => xe(v, { entities: a })
323
324
  )),
324
325
  visibleDraggableSet: /* @__PURE__ */ new Set(),
325
326
  visibleDroppableSet: /* @__PURE__ */ new Set(),
326
327
  visibleSelectableAreaSet: /* @__PURE__ */ new Set()
327
- }), i = q({
328
+ }), r = q({
328
329
  draggable: /* @__PURE__ */ new Map(),
329
330
  droppable: /* @__PURE__ */ new Map()
330
331
  }), g = {
@@ -337,17 +338,17 @@ function vt(e, t) {
337
338
  startTime: 0
338
339
  }), c = y(() => {
339
340
  if (!n.value || !a.initiatingDraggable) return 0;
340
- const w = a.draggableMap.get(a.initiatingDraggable)?.activation?.distance;
341
- return w ? ht(n.value, w) : 1;
341
+ const v = a.draggableMap.get(a.initiatingDraggable)?.activation?.distance;
342
+ return v ? yt(n.value, v) : 1;
342
343
  }), f = ge(
343
344
  a.visibleDraggableSet
344
345
  ), d = ge(
345
346
  a.visibleDroppableSet
346
347
  ), m = ge(
347
348
  a.visibleSelectableAreaSet
348
- ), { overlaySize: h, overlaySizeObserver: S } = ut(e), b = j(), v = y(() => {
349
+ ), { overlaySize: h, overlaySizeObserver: S } = dt(e), b = j(), w = y(() => {
349
350
  const p = a.initiatingDraggable;
350
- return Mt(
351
+ return vt(
351
352
  n.value,
352
353
  e.value,
353
354
  p || null,
@@ -362,15 +363,15 @@ function vt(e, t) {
362
363
  state: s,
363
364
  pointer: n,
364
365
  entities: a,
365
- keyboard: r,
366
+ keyboard: i,
366
367
  scrollPosition: l,
367
368
  delay: u,
368
369
  distanceProgress: c,
369
- hovered: i,
370
+ hovered: r,
370
371
  collision: g,
371
372
  overlay: {
372
373
  size: h,
373
- position: v,
374
+ position: w,
374
375
  render: b,
375
376
  ref: e,
376
377
  to: E
@@ -396,9 +397,9 @@ const oe = (e) => {
396
397
  const n = e.entities.droppableMap.get(s);
397
398
  n && (n.hoveredPlacement = void 0);
398
399
  }
399
- e.lib.rectCache.clear(), e.pointer.value = void 0, e.state.value = void 0, e.entities.selectingArea = void 0, e.entities.initiatingDraggable = void 0, e.delay.progress = 0, e.delay.startTime = 0, e.entities.draggingMap.clear(), e.hovered.draggable.clear(), e.hovered.droppable.clear();
400
+ e.lib.rectCache.clear(), e.pointer.value = void 0, e.state.value = void 0, e.entities.selectingArea = void 0, e.entities.selectionBase.clear(), e.entities.initiatingDraggable = void 0, e.delay.progress = 0, e.delay.startTime = 0, e.entities.draggingMap.clear(), e.hovered.draggable.clear(), e.hovered.droppable.clear();
400
401
  };
401
- function I(e, t, s) {
402
+ function R(e, t, s) {
402
403
  const n = Math.max(0, Math.min(t, e.length));
403
404
  return [...e.slice(0, n), ...s, ...e.slice(n)];
404
405
  }
@@ -407,140 +408,140 @@ function Ee(e, t, s = 1) {
407
408
  return [...e.slice(0, n), ...e.slice(n + o)];
408
409
  }
409
410
  function H(e, t) {
410
- const s = [...new Set(t)].filter((o) => o >= 0 && o < e.length).sort((o, r) => r - o);
411
+ const s = [...new Set(t)].filter((o) => o >= 0 && o < e.length).sort((o, i) => i - o);
411
412
  let n = e;
412
413
  for (const o of s) n = Ee(n, o, 1);
413
414
  return n;
414
415
  }
415
- function Ne(e, t, s) {
416
+ function Ye(e, t, s) {
416
417
  if (t === s || t < 0 || s < 0 || t >= e.length || s >= e.length)
417
418
  return e;
418
419
  const n = [...e];
419
420
  return [n[t], n[s]] = [n[s], n[t]], n;
420
421
  }
421
- const R = {
422
+ const k = {
422
423
  getInsertSide(e, t) {
423
424
  return e ? t === "vertical" ? e.top && !e.bottom ? "before" : e.bottom && !e.top ? "after" : e.top ? "before" : null : e.left && !e.right ? "before" : e.right && !e.left ? "after" : e.left ? "before" : null : null;
424
425
  },
425
426
  isAtZoneStart(e, t) {
426
- return R.getInsertSide(e, t) === "before" && !e?.center;
427
+ return k.getInsertSide(e, t) === "before" && !e?.center;
427
428
  },
428
429
  isAtZoneEnd(e, t) {
429
- return R.getInsertSide(e, t) === "after" && !e?.center;
430
+ return k.getInsertSide(e, t) === "after" && !e?.center;
430
431
  }
431
432
  };
432
- function Ye(e, t) {
433
+ function Xe(e, t) {
433
434
  const { draggedItems: s, dropZone: n, hoveredDraggable: o } = e;
434
435
  if (!s.length) return null;
435
- const r = o?.placement.center === !0 && n != null && n.items !== o.items, a = r ? n.items : o?.items ?? n?.items;
436
+ const i = o?.placement.center === !0 && n != null && n.items !== o.items, a = i ? n.items : o?.items ?? n?.items;
436
437
  if (!a) return null;
437
- const i = s[0].items, g = s.map((f) => f.index), l = a.length;
438
+ const r = s[0].items, g = s.map((f) => f.index), l = a.length;
438
439
  let u, c;
439
- if (o && !r) {
440
- const f = o.items === i && g.includes(o.index);
440
+ if (o && !i) {
441
+ const f = o.items === r && g.includes(o.index);
441
442
  if (f && s.length === 1) {
442
- const d = R.isAtZoneStart(n?.placement, t);
443
+ const d = k.isAtZoneStart(n?.placement, t);
443
444
  u = d ? 0 : l, c = d ? "prepend" : "append";
444
445
  } else {
445
446
  if (f)
446
447
  return null;
447
448
  {
448
- const d = R.getInsertSide(o.placement, t), m = o.index;
449
+ const d = k.getInsertSide(o.placement, t), m = o.index;
449
450
  d === "before" ? (u = Math.max(0, m), c = "insert") : d === "after" ? (u = Math.min(l, m + 1), c = "insert") : (u = l, c = "append");
450
451
  }
451
452
  }
452
453
  } else {
453
454
  if (!n) return null;
454
- const f = R.isAtZoneStart(n.placement, t);
455
+ const f = k.isAtZoneStart(n.placement, t);
455
456
  u = f ? 0 : l, c = f ? "prepend" : "append";
456
457
  }
457
458
  return { targetIndex: u, mode: c, targetArr: a };
458
459
  }
459
- function wt(e, t = "vertical") {
460
+ function At(e, t = "vertical") {
460
461
  const { draggedItems: s } = e;
461
462
  if (!s.length) return null;
462
- const n = Ye(e, t);
463
+ const n = Xe(e, t);
463
464
  if (!n) return null;
464
- const { targetArr: o, mode: r } = n;
465
+ const { targetArr: o, mode: i } = n;
465
466
  let { targetIndex: a } = n;
466
- const i = s.map((c) => c.index), g = s.map((c) => c.item), l = s[0].items;
467
+ const r = s.map((c) => c.index), g = s.map((c) => c.item), l = s[0].items;
467
468
  if (l === o) {
468
- const c = i.filter((d) => d < a).length;
469
+ const c = r.filter((d) => d < a).length;
469
470
  a = Math.max(0, a - c);
470
- const f = I(H(l, i), a, g);
471
- return { sourceItems: f, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex: a, mode: r, sameList: !0 };
471
+ const f = R(H(l, r), a, g);
472
+ return { sourceItems: f, targetItems: f, draggedItems: g, sourceIndexes: r, targetIndex: a, mode: i, sameList: !0 };
472
473
  } else {
473
- const c = H(l, i), f = I(o, a, g);
474
- return { sourceItems: c, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex: a, mode: r, sameList: !1 };
474
+ const c = H(l, r), f = R(o, a, g);
475
+ return { sourceItems: c, targetItems: f, draggedItems: g, sourceIndexes: r, targetIndex: a, mode: i, sameList: !1 };
475
476
  }
476
477
  }
477
- function xt(e) {
478
+ function Et(e) {
478
479
  const { draggedItems: t, hoveredDraggable: s } = e;
479
480
  if (!t.length || !s) return null;
480
- const n = t.map((u) => u.index), o = s.index, r = t.map((u) => u.item), a = s.item, i = t[0].items, g = s.items, l = i === g;
481
+ const n = t.map((u) => u.index), o = s.index, i = t.map((u) => u.item), a = s.item, r = t[0].items, g = s.items, l = r === g;
481
482
  if (l && n.includes(o)) return null;
482
483
  if (t.length === 1) {
483
484
  const u = n[0];
484
485
  if (l) {
485
- const c = Ne(i, u, o);
486
+ const c = Ye(r, u, o);
486
487
  return { sourceItems: c, targetItems: c, sourceIndexes: n, targetIndex: o, sameList: !0 };
487
488
  } else {
488
- const c = [...i], f = [...g];
489
- return c[u] = g[o], f[o] = i[u], { sourceItems: c, targetItems: f, sourceIndexes: n, targetIndex: o, sameList: !1 };
489
+ const c = [...r], f = [...g];
490
+ return c[u] = g[o], f[o] = r[u], { sourceItems: c, targetItems: f, sourceIndexes: n, targetIndex: o, sameList: !1 };
490
491
  }
491
492
  } else {
492
493
  const u = Math.min(...n);
493
494
  if (l) {
494
495
  const c = n.filter((b) => b < o).length, f = Math.max(0, o - c), d = n.filter((b) => b < u).length, m = Math.max(0, u - d);
495
- let h = H(i, n);
496
- h = I(h, f, r);
497
- const S = m >= f ? m + r.length : m;
498
- return h = I(h, S, [a]), { sourceItems: h, targetItems: h, sourceIndexes: n, targetIndex: f, sameList: !0 };
496
+ let h = H(r, n);
497
+ h = R(h, f, i);
498
+ const S = m >= f ? m + i.length : m;
499
+ return h = R(h, S, [a]), { sourceItems: h, targetItems: h, sourceIndexes: n, targetIndex: f, sameList: !0 };
499
500
  } else {
500
501
  const c = n.filter((h) => h < u).length, f = Math.max(0, u - c);
501
- let d = H(i, n);
502
- d = I(d, f, [a]);
502
+ let d = H(r, n);
503
+ d = R(d, f, [a]);
503
504
  let m = Ee(g, o);
504
- return m = I(m, o, r), { sourceItems: d, targetItems: m, sourceIndexes: n, targetIndex: o, sameList: !1 };
505
+ return m = R(m, o, i), { sourceItems: d, targetItems: m, sourceIndexes: n, targetIndex: o, sameList: !1 };
505
506
  }
506
507
  }
507
508
  }
508
- function At(e, t = "vertical") {
509
+ function Lt(e, t = "vertical") {
509
510
  const { draggedItems: s } = e;
510
511
  if (!s.length) return null;
511
- const n = Ye(e, t);
512
+ const n = Xe(e, t);
512
513
  if (!n) return null;
513
- const { targetArr: o, targetIndex: r, mode: a } = n, i = s.map((l) => l.item);
514
- return { targetItems: I(o, r, i), copiedItems: i, targetIndex: r, mode: a };
514
+ const { targetArr: o, targetIndex: i, mode: a } = n, r = s.map((l) => l.item);
515
+ return { targetItems: R(o, i, r), copiedItems: r, targetIndex: i, mode: a };
515
516
  }
516
- function Et(e) {
517
+ function Ct(e) {
517
518
  const { draggedItems: t } = e;
518
519
  if (!t.length) return null;
519
520
  const s = t.map((a) => a.index), n = t.map((a) => a.item), o = t[0].items;
520
521
  return { sourceItems: H(o, s), removedItems: n, sourceIndexes: s };
521
522
  }
522
- function Lt(e) {
523
+ function It(e) {
523
524
  return {
524
525
  // Low-level array ops
525
- insertAt: I,
526
+ insertAt: R,
526
527
  removeAt: Ee,
527
528
  removeIndexes: H,
528
- swapAt: Ne,
529
+ swapAt: Ye,
529
530
  // Placement helpers
530
- getInsertSide: (t, s) => R.getInsertSide(t, s),
531
- isAtZoneStart: (t, s) => R.isAtZoneStart(t, s),
532
- isAtZoneEnd: (t, s) => R.isAtZoneEnd(t, s),
531
+ getInsertSide: (t, s) => k.getInsertSide(t, s),
532
+ isAtZoneStart: (t, s) => k.isAtZoneStart(t, s),
533
+ isAtZoneEnd: (t, s) => k.isAtZoneEnd(t, s),
533
534
  // High-level (event-bound)
534
- suggestSort: (t) => wt(e, t),
535
- suggestSwap: () => xt(e),
536
- suggestCopy: (t) => At(e, t),
537
- suggestRemove: () => Et(e)
535
+ suggestSort: (t) => At(e, t),
536
+ suggestSwap: () => Et(e),
537
+ suggestCopy: (t) => Lt(e, t),
538
+ suggestRemove: () => Ct(e)
538
539
  };
539
540
  }
540
- const P = (e) => e.keys().next().value, Ct = (e) => e.target.closest(
541
+ const P = (e) => e.keys().next().value, Rt = (e) => e.target.closest(
541
542
  _.DRAGGABLE
542
543
  );
543
- function It(e) {
544
+ function kt(e) {
544
545
  const t = e.entities.initiatingDraggable;
545
546
  if (!t) return [];
546
547
  const s = e.entities.draggingMap.get(t) ?? e.entities.draggableMap.get(t), n = s?.payload;
@@ -548,10 +549,10 @@ function It(e) {
548
549
  return s?.data ? [{ index: -1, item: void 0, items: [], data: s.data() }] : [];
549
550
  const o = n();
550
551
  if (!Array.isArray(o) || o.length < 2) return [];
551
- const [r, a] = o, i = Number(r), g = a, l = /* @__PURE__ */ new Map();
552
- return l.set(i, {
553
- index: i,
554
- item: g[i],
552
+ const [i, a] = o, r = Number(i), g = a, l = /* @__PURE__ */ new Map();
553
+ return l.set(r, {
554
+ index: r,
555
+ item: g[r],
555
556
  items: g,
556
557
  data: s?.data?.()
557
558
  }), e.entities.draggingMap.forEach((u, c) => {
@@ -571,16 +572,16 @@ function It(e) {
571
572
  }), [...l.values()].sort((u, c) => u.index - c.index);
572
573
  }
573
574
  const A = (e, t) => {
574
- const s = It(e);
575
+ const s = kt(e);
575
576
  let n, o;
576
577
  if (t) {
577
- const r = e.entities.droppableMap.get(t);
578
- if (r) {
579
- const g = r.payload;
578
+ const i = e.entities.droppableMap.get(t);
579
+ if (i) {
580
+ const g = i.payload;
580
581
  n = {
581
582
  items: g ? g() : [],
582
583
  placement: e.hovered.droppable.get(t),
583
- data: r.data?.()
584
+ data: i.data?.()
584
585
  };
585
586
  }
586
587
  const a = P(e.hovered.draggable);
@@ -614,7 +615,7 @@ const A = (e, t) => {
614
615
  dropZone: n,
615
616
  hoveredDraggable: o,
616
617
  provider: e,
617
- helpers: Lt({ draggedItems: s, dropZone: n, hoveredDraggable: o })
618
+ helpers: It({ draggedItems: s, dropZone: n, hoveredDraggable: o })
618
619
  };
619
620
  }, F = (e, t, s) => {
620
621
  if (!t) return;
@@ -625,7 +626,7 @@ const A = (e, t) => {
625
626
  e.entities.draggingMap.forEach((n) => {
626
627
  n.disabled || n.events?.[t]?.(s);
627
628
  });
628
- }, Rt = (e, t, s) => {
629
+ }, Pt = (e, t, s) => {
629
630
  if (t !== s) {
630
631
  if (t && !G(t, e)) {
631
632
  const n = A(e, t);
@@ -636,7 +637,7 @@ const A = (e, t) => {
636
637
  e.entities.droppableMap.get(s)?.events?.onEnter?.(n);
637
638
  }
638
639
  }
639
- }, kt = (e, t, s) => {
640
+ }, Tt = (e, t, s) => {
640
641
  if (t !== s) {
641
642
  const n = A(e);
642
643
  if (t) {
@@ -649,60 +650,62 @@ const A = (e, t) => {
649
650
  }
650
651
  }
651
652
  }, ue = (e, t, s) => {
652
- const n = Ct(t);
653
+ const n = Rt(t);
653
654
  !n || !e.entities.draggingMap.has(n) || e.entities.draggingMap.get(n)?.events?.[s]?.(A(e));
654
- }, Pt = (e, t) => {
655
+ }, zt = (e, t) => {
655
656
  const s = P(t.droppable);
656
657
  s && !G(s, e) && e.entities.droppableMap.get(s)?.events?.onLeave?.(A(e, s));
657
- }, Xe = (e, t) => {
658
+ }, Ue = (e, t) => {
658
659
  const s = P(t.droppable);
659
660
  s && !G(s, e) && e.entities.droppableMap.get(s)?.events?.onLeave?.(A(e, s));
660
661
  };
661
- function Tt(e) {
662
+ function Bt(e) {
662
663
  return e.parentElement?.closest(_.SELECT_AREA) ?? null;
663
664
  }
664
- const zt = (e, t, s) => {
665
+ const Ot = (e, t, s) => {
665
666
  if (!s) return {};
666
- const n = s.getBoundingClientRect(), o = Math.max(n.left, Math.min(e.x, t.x)), r = Math.max(n.top, Math.min(e.y, t.y)), a = Math.min(n.right, Math.max(e.x, t.x)), i = Math.min(n.bottom, Math.max(e.y, t.y)), g = Math.max(0, a - o), l = Math.max(0, i - r);
667
+ const n = s.getBoundingClientRect(), o = Math.max(n.left, Math.min(e.x, t.x)), i = Math.max(n.top, Math.min(e.y, t.y)), a = Math.min(n.right, Math.max(e.x, t.x)), r = Math.min(n.bottom, Math.max(e.y, t.y)), g = Math.max(0, a - o), l = Math.max(0, r - i), u = o - n.left + s.scrollLeft, c = i - n.top + s.scrollTop;
667
668
  return {
668
- left: `${o}px`,
669
- top: `${r}px`,
669
+ position: "absolute",
670
+ left: `${u}px`,
671
+ top: `${c}px`,
670
672
  width: `${g}px`,
671
673
  height: `${l}px`,
672
- position: "fixed",
673
674
  pointerEvents: "none",
674
675
  border: "1px solid #3b82f6",
675
676
  backgroundColor: "#3b82f61a"
676
677
  };
677
- }, Ot = (e) => {
678
+ }, Ve = (e) => {
678
679
  if (!e.pointer.value || !e.entities.selectingArea) return;
679
- const { selectingArea: t } = e.entities, s = Bt(
680
+ const { selectingArea: t } = e.entities, s = Ft(
680
681
  e.pointer.value.start,
681
682
  e.pointer.value.current
682
683
  ), n = e.entities.selectableAreaMap.get(t)?.groups ?? [], o = e.lib.rectCache;
683
- e.entities.visibleDraggableSet.forEach((r) => {
684
- if (r === t || !t.contains(r)) return;
685
- const a = Tt(r);
684
+ e.entities.visibleDraggableSet.forEach((i) => {
685
+ if (i === t || !t.contains(i)) return;
686
+ const a = Bt(i);
686
687
  if (a && a !== t) {
687
- e.entities.selectedSet.delete(r);
688
+ e.entities.selectedSet.delete(i);
688
689
  return;
689
690
  }
690
- if (xe(r, e)) {
691
- e.entities.selectedSet.delete(r);
691
+ if (xe(i, e)) {
692
+ e.entities.selectedSet.delete(i);
692
693
  return;
693
694
  }
694
- const g = e.entities.draggableMap.get(r)?.groups ?? [];
695
+ const g = e.entities.draggableMap.get(i)?.groups ?? [];
695
696
  if (!Ae(n, g)) {
696
- e.entities.selectedSet.delete(r);
697
+ e.entities.selectedSet.delete(i);
697
698
  return;
698
699
  }
699
- let l = o.get(r);
700
- l || (l = r.getBoundingClientRect(), o.set(r, l)), it(s, l) ? e.entities.selectedSet.add(r) : e.entities.selectedSet.delete(r);
700
+ let l = o.get(i);
701
+ l || (l = i.getBoundingClientRect(), o.set(i, l));
702
+ const u = e.entities.selectionBase.has(i);
703
+ ct(s, l) ? u ? e.entities.selectedSet.delete(i) : e.entities.selectedSet.add(i) : u ? e.entities.selectedSet.add(i) : e.entities.selectedSet.delete(i);
701
704
  });
702
- }, Bt = (e, t) => {
703
- const s = Math.min(e.x, t.x), n = Math.min(e.y, t.y), o = Math.max(e.x, t.x), r = Math.max(e.y, t.y), a = o - s, i = r - n;
704
- return new DOMRect(s, n, a, i);
705
- }, Ft = (e, t, s = 5) => {
705
+ }, Ft = (e, t) => {
706
+ const s = Math.min(e.x, t.x), n = Math.min(e.y, t.y), o = Math.max(e.x, t.x), i = Math.max(e.y, t.y), a = o - s, r = i - n;
707
+ return new DOMRect(s, n, a, r);
708
+ }, _t = (e, t, s = 5) => {
706
709
  const n = s / 2;
707
710
  return {
708
711
  left: e - n,
@@ -710,13 +713,13 @@ const zt = (e, t, s) => {
710
713
  width: s,
711
714
  height: s
712
715
  };
713
- }, _t = (e) => {
716
+ }, Gt = (e) => {
714
717
  const t = e.pointer.value?.current, s = t?.x ?? 0, n = t?.y ?? 0;
715
- return Ft(s, n, 5);
716
- }, O = (e, t, s) => {
718
+ return _t(s, n, 5);
719
+ }, B = (e, t, s) => {
717
720
  const n = e.left + e.width / 2, o = e.top + e.height / 2;
718
721
  if (s) {
719
- const i = s.top ?? 0, g = s.right ?? 0, l = s.bottom ?? 0, u = s.left ?? 0, c = t.left + u, f = t.right - g, d = t.top + i, m = t.bottom - l;
722
+ const r = s.top ?? 0, g = s.right ?? 0, l = s.bottom ?? 0, u = s.left ?? 0, c = t.left + u, f = t.right - g, d = t.top + r, m = t.bottom - l;
720
723
  if (c < f && d < m && n >= c && n <= f && o >= d && o <= m)
721
724
  return {
722
725
  top: !1,
@@ -726,74 +729,74 @@ const zt = (e, t, s) => {
726
729
  center: !0
727
730
  };
728
731
  }
729
- const r = t.left + t.width / 2, a = t.top + t.height / 2;
732
+ const i = t.left + t.width / 2, a = t.top + t.height / 2;
730
733
  return {
731
734
  top: o <= a,
732
735
  bottom: o > a,
733
- left: n <= r,
734
- right: n > r,
736
+ left: n <= i,
737
+ right: n > i,
735
738
  center: !1
736
739
  };
737
- }, Gt = (e) => ({
740
+ }, Ht = (e) => ({
738
741
  x: e.left + e.width / 2,
739
742
  y: e.top + e.height / 2
740
- }), Re = (e, t) => {
741
- const s = Gt(t);
743
+ }), ke = (e, t) => {
744
+ const s = Ht(t);
742
745
  return Math.hypot(e.x - s.x, e.y - s.y);
743
746
  };
744
- function Ht(e, t) {
747
+ function Kt(e, t) {
745
748
  return e === t ? !0 : !e || !t ? !1 : e.top === t.top && e.right === t.right && e.bottom === t.bottom && e.left === t.left && e.center === t.center;
746
749
  }
747
750
  function W(e, t) {
748
- Ht(e.hoveredPlacement, t) || (e.hoveredPlacement = t);
751
+ Kt(e.hoveredPlacement, t) || (e.hoveredPlacement = t);
749
752
  }
750
- const Kt = (e, t) => e.find((s) => s !== t && K(t, s)), ae = (e, t, s) => {
753
+ const Zt = (e, t) => e.find((s) => s !== t && K(t, s)), ae = (e, t, s) => {
751
754
  const n = P(t.droppable), o = P(t.draggable);
752
755
  o && t.draggable.delete(o), n && t.droppable.delete(n);
753
- const r = _t(e), a = s.zones[0], i = s.elements[0];
754
- if (a && i && a === i && e.entities.droppableMap.has(a) && a) {
755
- const c = a.getBoundingClientRect(), f = e.entities.draggableMap.get(a)?.placementMargins, d = O(r, c, f);
756
+ const i = Gt(e), a = s.zones[0], r = s.elements[0];
757
+ if (a && r && a === r && e.entities.droppableMap.has(a) && a) {
758
+ const c = a.getBoundingClientRect(), f = e.entities.draggableMap.get(a)?.placementMargins, d = B(i, c, f);
756
759
  if (d.center) {
757
760
  t.droppable.set(a, d);
758
- const m = Kt(s.elements, a);
761
+ const m = Zt(s.elements, a);
759
762
  if (m) {
760
763
  const h = m.getBoundingClientRect();
761
764
  t.draggable.set(
762
765
  m,
763
- O(r, h, void 0)
766
+ B(i, h, void 0)
764
767
  );
765
768
  }
766
769
  } else
767
- t.draggable.set(i, d);
770
+ t.draggable.set(r, d);
768
771
  } else {
769
772
  if (a) {
770
773
  const c = a.getBoundingClientRect();
771
- t.droppable.set(a, O(r, c));
774
+ t.droppable.set(a, B(i, c));
772
775
  }
773
- if (i)
776
+ if (r)
774
777
  if (a)
775
- if (K(a, i)) {
776
- const c = i.getBoundingClientRect(), f = e.entities.draggableMap.get(i)?.placementMargins;
778
+ if (K(a, r)) {
779
+ const c = r.getBoundingClientRect(), f = e.entities.draggableMap.get(r)?.placementMargins;
777
780
  t.draggable.set(
778
- i,
779
- O(r, c, f)
781
+ r,
782
+ B(i, c, f)
780
783
  );
781
784
  } else {
782
- const c = e.pointer.value?.current ?? { x: 0, y: 0 }, f = a.getBoundingClientRect(), d = i.getBoundingClientRect(), m = Re(c, f);
783
- if (Re(c, d) < m) {
785
+ const c = e.pointer.value?.current ?? { x: 0, y: 0 }, f = a.getBoundingClientRect(), d = r.getBoundingClientRect(), m = ke(c, f);
786
+ if (ke(c, d) < m) {
784
787
  t.droppable.clear();
785
- const S = e.entities.draggableMap.get(i)?.placementMargins;
788
+ const S = e.entities.draggableMap.get(r)?.placementMargins;
786
789
  t.draggable.set(
787
- i,
788
- O(r, d, S)
790
+ r,
791
+ B(i, d, S)
789
792
  );
790
793
  }
791
794
  }
792
795
  else {
793
- const c = i.getBoundingClientRect(), f = e.entities.draggableMap.get(i)?.placementMargins;
796
+ const c = r.getBoundingClientRect(), f = e.entities.draggableMap.get(r)?.placementMargins;
794
797
  t.draggable.set(
795
- i,
796
- O(r, c, f)
798
+ r,
799
+ B(i, c, f)
797
800
  );
798
801
  }
799
802
  }
@@ -814,7 +817,7 @@ const Kt = (e, t) => e.find((s) => s !== t && K(t, s)), ae = (e, t, s) => {
814
817
  const c = e.entities.droppableMap.get(l);
815
818
  c && W(c, t.droppable.get(l));
816
819
  }
817
- Rt(e, n, l), kt(e, o, u);
820
+ Pt(e, n, l), Tt(e, o, u);
818
821
  }, fe = (e, t) => e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y, X = (e) => {
819
822
  if (!e)
820
823
  return { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 };
@@ -832,78 +835,78 @@ const Kt = (e, t) => e.find((s) => s !== t && K(t, s)), ae = (e, t, s) => {
832
835
  }, Y = (e) => ({
833
836
  x: e.x + e.width / 2,
834
837
  y: e.y + e.height / 2
835
- }), Zt = (e, t) => Math.hypot(t.x - e.x, t.y - e.y), Q = (e, t) => {
838
+ }), Nt = (e, t) => Math.hypot(t.x - e.x, t.y - e.y), Q = (e, t) => {
836
839
  const s = Math.max(
837
840
  0,
838
841
  Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)
839
842
  ), n = Math.max(
840
843
  0,
841
844
  Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
842
- ), o = s * n, r = e.width * e.height, a = t.width * t.height;
843
- return r === 0 || a === 0 ? 0 : (o / r * 100 + o / a * 100) / 2;
844
- }, Nt = (e, t, s) => t >= e.x && t <= e.x + e.width && s >= e.y && s <= e.y + e.height, Yt = (e) => e.overlay.ref?.value ?? null, ke = (e) => {
845
+ ), o = s * n, i = e.width * e.height, a = t.width * t.height;
846
+ return i === 0 || a === 0 ? 0 : (o / i * 100 + o / a * 100) / 2;
847
+ }, Yt = (e, t, s) => t >= e.x && t <= e.x + e.width && s >= e.y && s <= e.y + e.height, Xt = (e) => e.overlay.ref?.value ?? null, Pe = (e) => {
845
848
  const t = e.overlay.position?.value ?? { x: 0, y: 0 }, { x: s, y: n } = t, o = e.overlay.size?.value;
846
- let r, a;
849
+ let i, a;
847
850
  if (o)
848
- r = o.width, a = o.height;
851
+ i = o.width, a = o.height;
849
852
  else {
850
- const i = e.overlay.ref?.value?.getBoundingClientRect();
851
- r = i?.width ?? 0, a = i?.height ?? 0;
853
+ const r = e.overlay.ref?.value?.getBoundingClientRect();
854
+ i = r?.width ?? 0, a = r?.height ?? 0;
852
855
  }
853
856
  return {
854
857
  x: s,
855
858
  y: n,
856
- width: r,
859
+ width: i,
857
860
  height: a,
858
861
  top: n,
859
862
  left: s,
860
- right: s + r,
863
+ right: s + i,
861
864
  bottom: n + a
862
865
  };
863
- }, De = (e) => e.entities.allowedDraggableSet, Ue = (e) => e.entities.allowedDroppableSet, Xt = (e, t) => !t.entities.draggingMap.has(e), Ut = (e, t) => ![...t.entities.draggingMap.keys()].some(
866
+ }, De = (e) => e.entities.allowedDraggableSet, $e = (e) => e.entities.allowedDroppableSet, Ut = (e, t) => !t.entities.draggingMap.has(e), Vt = (e, t) => ![...t.entities.draggingMap.keys()].some(
864
867
  (s) => K(s, e)
865
- ), Vt = (e, t) => t.entities.draggableMap.has(e) ? !xe(e, t) : t.entities.droppableMap.has(e) ? !G(e, t) : !0, ee = (e, t) => Xt(e, t) && Ut(e, t) && Vt(e, t), de = 10;
866
- function B(e, t) {
868
+ ), $t = (e, t) => t.entities.draggableMap.has(e) ? !xe(e, t) : t.entities.droppableMap.has(e) ? !G(e, t) : !0, ee = (e, t) => Ut(e, t) && Vt(e, t) && $t(e, t), de = 10;
869
+ function O(e, t) {
867
870
  return Math.hypot(
868
871
  t.x - (e.x + e.width / 2),
869
872
  t.y - (e.y + e.height / 2)
870
873
  );
871
874
  }
872
- function $t(e) {
875
+ function qt(e) {
873
876
  const t = e.pointer.value?.current ?? { x: 0, y: 0 }, s = document.elementFromPoint(t.x, t.y);
874
877
  if (!s) return null;
875
- const n = De(e), o = Ue(e), r = [], a = [];
876
- let i = s;
877
- for (; i; )
878
- (n.has(i) || o.has(i)) && ee(i, e) && (n.has(i) && r.push(i), o.has(i) && a.push(i)), i = i.parentElement;
879
- return r.length === 0 && a.length === 0 ? null : { elements: r, zones: a };
878
+ const n = De(e), o = $e(e), i = [], a = [];
879
+ let r = s;
880
+ for (; r; )
881
+ (n.has(r) || o.has(r)) && ee(r, e) && (n.has(r) && i.push(r), o.has(r) && a.push(r)), r = r.parentElement;
882
+ return i.length === 0 && a.length === 0 ? null : { elements: i, zones: a };
880
883
  }
881
884
  const Me = (e) => {
882
- if (!Yt(e)) return { elements: [], zones: [] };
883
- const s = e.pointer.value?.current ?? { x: 0, y: 0 }, n = $t(e);
885
+ if (!Xt(e)) return { elements: [], zones: [] };
886
+ const s = e.pointer.value?.current ?? { x: 0, y: 0 }, n = qt(e);
884
887
  if (n) {
885
888
  if (n.elements.length > 0) return n;
886
889
  const l = n.zones[0];
887
890
  if (!l) return n;
888
- const u = ke(e);
891
+ const u = Pe(e);
889
892
  return { elements: [...De(e)].filter(
890
893
  (d) => l.contains(d) && ee(d, e)
891
894
  ).map((d) => ({ el: d, box: X(d) })).filter(
892
895
  ({ box: d }) => fe(d, u) && Q(d, u) >= de
893
- ).sort((d, m) => B(d.box, s) - B(m.box, s)).map(({ el: d }) => d), zones: n.zones };
896
+ ).sort((d, m) => O(d.box, s) - O(m.box, s)).map(({ el: d }) => d), zones: n.zones };
894
897
  }
895
- const o = ke(e), r = [...De(e)].filter(
898
+ const o = Pe(e), i = [...De(e)].filter(
896
899
  (l) => ee(l, e)
897
- ), a = [...Ue(e)].filter(
900
+ ), a = [...$e(e)].filter(
898
901
  (l) => ee(l, e)
899
- ), i = r.map((l) => ({ n: l, box: X(l) })).filter(
902
+ ), r = i.map((l) => ({ n: l, box: X(l) })).filter(
900
903
  ({ box: l }) => fe(l, o) && Q(l, o) >= de
901
- ).sort((l, u) => B(l.box, s) - B(u.box, s)).map(({ n: l }) => l), g = a.map((l) => ({ n: l, box: X(l) })).filter(
904
+ ).sort((l, u) => O(l.box, s) - O(u.box, s)).map(({ n: l }) => l), g = a.map((l) => ({ n: l, box: X(l) })).filter(
902
905
  ({ box: l }) => fe(l, o) && Q(l, o) >= de
903
- ).sort((l, u) => B(l.box, s) - B(u.box, s)).map(({ n: l }) => l);
904
- return { elements: i, zones: g };
906
+ ).sort((l, u) => O(l.box, s) - O(u.box, s)).map(({ n: l }) => l);
907
+ return { elements: r, zones: g };
905
908
  };
906
- function ve(e) {
909
+ function we(e) {
907
910
  if (e.collision?.run) {
908
911
  const s = e.collision.run(e);
909
912
  ae(e, e.hovered, s);
@@ -912,16 +915,16 @@ function ve(e) {
912
915
  const t = Me(e);
913
916
  ae(e, e.hovered, t);
914
917
  }
915
- function qt(e, t) {
918
+ function Wt(e, t) {
916
919
  const s = e.collision?.throttle?.value ?? 0;
917
920
  if (s <= 0) {
918
- ve(e);
921
+ we(e);
919
922
  return;
920
923
  }
921
924
  const n = Date.now();
922
- n - t.value >= s && (t.value = n, ve(e));
925
+ n - t.value >= s && (t.value = n, we(e));
923
926
  }
924
- async function Ve(e) {
927
+ async function qe(e) {
925
928
  const t = e.hovered.droppable.keys().next().value;
926
929
  if (!t || G(t, e)) return "accept";
927
930
  const s = e.entities.droppableMap.get(t), n = A(e, t), o = s?.events?.onDrop?.(n);
@@ -931,77 +934,77 @@ async function Ve(e) {
931
934
  try {
932
935
  a = await o;
933
936
  } catch {
934
- const i = e.entities.initiatingDraggable;
935
- return F(e, i, "onSelfDragCancel"), x(e, "onDragCancel"), Xe(e, e.hovered), "cancel";
937
+ const r = e.entities.initiatingDraggable;
938
+ return F(e, r, "onSelfDragCancel"), x(e, "onDragCancel"), Ue(e, e.hovered), "cancel";
936
939
  }
937
940
  return a === !1 ? (e.state.value = "dragging", "decline") : "accept";
938
941
  }
939
942
  return o === !1 ? "decline" : "accept";
940
943
  }
941
- function $e(e) {
944
+ function We(e) {
942
945
  const t = e.entities.initiatingDraggable;
943
- F(e, t, "onSelfDragEnd"), x(e, "onDragEnd"), Pt(e, e.hovered);
946
+ F(e, t, "onSelfDragEnd"), x(e, "onDragEnd"), zt(e, e.hovered);
944
947
  }
945
- function Wt(e) {
948
+ function jt(e) {
946
949
  const t = e.entities.selectingArea;
947
950
  if (!t) return;
948
951
  const s = e.entities.selectableAreaMap.get(t), n = [...e.entities.selectedSet];
949
952
  s?.events?.onSelected?.(n);
950
953
  }
951
- const jt = (e) => {
954
+ const Jt = (e) => {
952
955
  const t = {
953
956
  current: null
954
957
  }, s = { value: 0 }, n = async () => {
955
958
  pe(), t.current?.cancel(), t.current = null;
956
- const i = e.state.value;
957
- if (i === "dragging") {
958
- const g = await Ve(e);
959
- if (g === "accept" && $e(e), g === "accept" || g === "cancel") {
959
+ const r = e.state.value;
960
+ if (r === "dragging") {
961
+ const g = await qe(e);
962
+ if (g === "accept" && We(e), g === "accept" || g === "cancel") {
960
963
  oe(e), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o);
961
964
  return;
962
965
  }
963
966
  return;
964
- } else i === "selecting" && Wt(e);
967
+ } else r === "selecting" && jt(e);
965
968
  oe(e), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o);
966
- }, o = (i) => {
969
+ }, o = (r) => {
967
970
  if (e.pointer.value) {
968
- if (e.pointer.value.current = { x: i.clientX, y: i.clientY }, bt(e)) {
969
- ue(e, i, "onSelfDragStart"), x(e, "onDragStart");
971
+ if (e.pointer.value.current = { x: r.clientX, y: r.clientY }, pt(e)) {
972
+ ue(e, r, "onSelfDragStart"), x(e, "onDragStart");
970
973
  return;
971
974
  }
972
975
  if (e.state.value === "dragging") {
973
- qt(e, s);
976
+ Wt(e, s);
974
977
  const g = e.entities.initiatingDraggable;
975
978
  F(e, g, "onSelfDragMove"), x(e, "onDragMove");
976
979
  }
977
- e.state.value === "selecting" && Ot(e);
980
+ e.state.value === "selecting" && Ve(e);
978
981
  }
979
982
  };
980
- return { pointerDown: (i) => {
983
+ return { pointerDown: (r) => {
981
984
  document.addEventListener("pointerup", n), document.addEventListener("pointermove", o);
982
- const g = i.target, l = g.closest(
985
+ const g = r.target, l = g.closest(
983
986
  _.SELECT_AREA
984
987
  ), u = g.closest(
985
988
  _.DRAGGABLE
986
989
  );
987
990
  if (e.entities.modifiersSelectableAreaSet.size > 0 && e.entities.modifiersSelectableAreaSet.has(l)) {
988
- ye(), e.pointer.value = Se(i), e.state.value = "selecting", e.entities.selectingArea = l;
991
+ ye(), e.pointer.value = Se(r), e.state.value = "selecting", e.entities.selectingArea = l, e.entities.selectionBase = new Set(e.entities.selectedSet);
989
992
  return;
990
993
  }
991
994
  if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(u)) {
992
995
  const c = e.entities.draggableMap.get(u);
993
- if (!Ke(g, u, c?.dragHandle))
996
+ if (!Ze(g, u, c?.dragHandle))
994
997
  return;
995
998
  ye(), e.entities.initiatingDraggable = u;
996
- const f = Ge(i, u);
997
- e.pointer.value = Se(i, f.x, f.y), c?.activation?.distance || c?.activation?.delay ? (e.state.value = "activating", c?.activation?.delay && (e.delay.startTime = Date.now(), t.current = yt(e, () => {
998
- se(e), ue(e, i, "onSelfDragStart"), x(e, "onDragStart");
999
- }))) : (se(e), ue(e, i, "onSelfDragStart"), x(e, "onDragStart"));
999
+ const f = He(r, u);
1000
+ e.pointer.value = Se(r, f.x, f.y), c?.activation?.distance || c?.activation?.delay ? (e.state.value = "activating", c?.activation?.delay && (e.delay.startTime = Date.now(), t.current = St(e, () => {
1001
+ se(e), ue(e, r, "onSelfDragStart"), x(e, "onDragStart");
1002
+ }))) : (se(e), ue(e, r, "onSelfDragStart"), x(e, "onDragStart"));
1000
1003
  }
1001
1004
  }, pointerUp: n, pointerMove: o, cleanup: () => {
1002
1005
  t.current?.cancel(), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o), e.lib.draggableObserver.disconnect(), e.lib.droppableObserver.disconnect(), e.lib.selectableAreaObserver.disconnect(), e.lib.overlaySizeObserver.disconnect();
1003
1006
  } };
1004
- }, Jt = {
1007
+ }, Qt = {
1005
1008
  ArrowUp: { dx: 0, dy: -1 },
1006
1009
  ArrowDown: { dx: 0, dy: 1 },
1007
1010
  ArrowLeft: { dx: -1, dy: 0 },
@@ -1010,7 +1013,7 @@ const jt = (e) => {
1010
1013
  KeyA: { dx: -1, dy: 0 },
1011
1014
  KeyS: { dx: 0, dy: 1 },
1012
1015
  KeyD: { dx: 1, dy: 0 }
1013
- }, Qt = (e) => (t) => {
1016
+ }, en = (e) => (t) => {
1014
1017
  const { keys: s } = e.keyboard;
1015
1018
  if (s.pressedKeys.value.add(t.code), e.state.value === "dragging") {
1016
1019
  if (s.forCancel.includes(t.code)) {
@@ -1018,19 +1021,19 @@ const jt = (e) => {
1018
1021
  e,
1019
1022
  e.entities.initiatingDraggable,
1020
1023
  "onSelfDragCancel"
1021
- ), x(e, "onDragCancel"), Xe(e, e.hovered), oe(e);
1024
+ ), x(e, "onDragCancel"), Ue(e, e.hovered), oe(e);
1022
1025
  return;
1023
1026
  }
1024
1027
  if (s.forDrop.includes(t.code)) {
1025
- t.preventDefault(), (async () => (await Ve(e) && $e(e), pe(), oe(e)))();
1028
+ t.preventDefault(), (async () => (await qe(e) && We(e), pe(), oe(e)))();
1026
1029
  return;
1027
1030
  }
1028
- const o = Jt[t.code];
1031
+ const o = Qt[t.code];
1029
1032
  if (o && s.forMove.includes(t.code) && e.pointer.value) {
1030
1033
  t.preventDefault();
1031
- const r = s.forMoveFaster.some(
1034
+ const i = s.forMoveFaster.some(
1032
1035
  (l) => s.pressedKeys.value.has(l)
1033
- ), a = e.keyboard.step * (r ? e.keyboard.moveFaster : 1);
1036
+ ), a = e.keyboard.step * (i ? e.keyboard.moveFaster : 1);
1034
1037
  e.pointer.value.current = {
1035
1038
  x: e.pointer.value.current.x + o.dx * a,
1036
1039
  y: e.pointer.value.current.y + o.dy * a
@@ -1048,41 +1051,50 @@ const jt = (e) => {
1048
1051
  if (s.forDrag.includes(t.code)) {
1049
1052
  const o = document.activeElement;
1050
1053
  if (!o) return;
1051
- const r = o.closest(
1054
+ const i = o.closest(
1052
1055
  _.DRAGGABLE
1053
1056
  );
1054
- if (!r || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(r))
1057
+ if (!i || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(i))
1055
1058
  return;
1056
- const a = e.entities.draggableMap.get(r);
1057
- if (!Ke(o, r, a?.dragHandle, !0))
1059
+ const a = e.entities.draggableMap.get(i);
1060
+ if (!Ze(o, i, a?.dragHandle, !0))
1058
1061
  return;
1059
1062
  t.preventDefault(), ye();
1060
- const i = r.getBoundingClientRect(), g = i.left + i.width / 2, l = i.top + i.height / 2, u = {
1063
+ const r = i.getBoundingClientRect(), g = r.left + r.width / 2, l = r.top + r.height / 2, u = {
1061
1064
  clientX: g,
1062
1065
  clientY: l
1063
1066
  };
1064
- e.entities.initiatingDraggable = r;
1065
- const c = Ge(u, r);
1067
+ e.entities.initiatingDraggable = i;
1068
+ const c = He(u, i);
1066
1069
  e.pointer.value = Se(
1067
1070
  u,
1068
1071
  c.x,
1069
1072
  c.y
1070
1073
  ), se(e);
1071
1074
  const d = (e.collision?.run ?? Me)(e);
1072
- ae(e, e.hovered, d), F(e, r, "onSelfDragStart"), x(e, "onDragStart");
1075
+ ae(e, e.hovered, d), F(e, i, "onSelfDragStart"), x(e, "onDragStart");
1073
1076
  }
1074
- }, en = (e) => (t) => {
1077
+ }, tn = (e) => (t) => {
1075
1078
  e.keyboard.keys.pressedKeys.value.delete(t.code);
1076
- }, tn = (e) => () => {
1079
+ }, nn = (e) => () => {
1077
1080
  e.keyboard.keys.pressedKeys.value.clear();
1078
1081
  }, me = {
1079
- keyDown: Qt,
1080
- keyUp: en,
1081
- clear: tn
1082
- }, nn = (e) => () => {
1083
- e.state.value && (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY, e.lib.rectCache.clear(), e.state.value === "dragging" && ve(e));
1084
- }, L = 50, sn = 144, Pe = 1e3 / sn;
1085
- function on(e) {
1082
+ keyDown: en,
1083
+ keyUp: tn,
1084
+ clear: nn
1085
+ }, sn = (e) => () => {
1086
+ if (!e.state.value) return;
1087
+ const t = e.scrollPosition.x, s = e.scrollPosition.y;
1088
+ if (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY, e.lib.rectCache.clear(), e.state.value === "dragging") {
1089
+ we(e);
1090
+ return;
1091
+ }
1092
+ if (e.state.value === "selecting" && e.pointer.value) {
1093
+ const n = window.scrollX - t, o = window.scrollY - s;
1094
+ e.pointer.value.start.x -= n, e.pointer.value.start.y -= o, Ve(e);
1095
+ }
1096
+ }, L = 50, on = 144, Te = 1e3 / on;
1097
+ function an(e) {
1086
1098
  return e == null ? {
1087
1099
  top: L,
1088
1100
  right: L,
@@ -1100,7 +1112,7 @@ function on(e) {
1100
1112
  left: e.left ?? L
1101
1113
  };
1102
1114
  }
1103
- const an = {
1115
+ const rn = {
1104
1116
  getScrollState(e) {
1105
1117
  return {
1106
1118
  scrollTop: e.scrollTop,
@@ -1111,29 +1123,29 @@ const an = {
1111
1123
  e.scrollTop = t, e.scrollLeft = s;
1112
1124
  }
1113
1125
  };
1114
- function qe(e, t, s, n = an, o) {
1115
- const { speed: r = 10, disabled: a = !1 } = t, i = on(t.threshold);
1126
+ function je(e, t, s, n = rn, o) {
1127
+ const { speed: i = 10, disabled: a = !1 } = t, r = an(t.threshold);
1116
1128
  let g = null, l = null, u = null, c = 0, f = 0;
1117
1129
  const d = (b) => {
1118
1130
  o && (o.value = b);
1119
1131
  }, m = (b) => {
1120
- const v = e.value, E = s();
1121
- if (!v || !E || a) {
1132
+ const w = e.value, E = s();
1133
+ if (!w || !E || a) {
1122
1134
  d(!1);
1123
1135
  return;
1124
1136
  }
1125
1137
  l || (l = b);
1126
1138
  const $ = b - l;
1127
- if ($ < Pe) {
1139
+ if ($ < Te) {
1128
1140
  g = requestAnimationFrame(m);
1129
1141
  return;
1130
1142
  }
1131
- const p = r * ($ / Pe);
1143
+ const p = i * ($ / Te);
1132
1144
  l = b;
1133
- const { scrollTop: w, scrollLeft: Z } = n.getScrollState(v);
1134
- (!u || c !== w || f !== Z) && (u = n.getRect ? n.getRect(v) : v.getBoundingClientRect(), c = w, f = Z);
1135
- let z = !1, le = w, ce = Z;
1136
- i.top > 0 && E.y - u.top < i.top ? (le = w - p, z = !0) : i.bottom > 0 && u.bottom - E.y < i.bottom && (le = w + p, z = !0), i.left > 0 && E.x - u.left < i.left ? (ce = Z - p, z = !0) : i.right > 0 && u.right - E.x < i.right && (ce = Z + p, z = !0), z && n.setScroll(v, le, ce), d(z), g = requestAnimationFrame(m);
1145
+ const { scrollTop: v, scrollLeft: Z } = n.getScrollState(w);
1146
+ (!u || c !== v || f !== Z) && (u = n.getRect ? n.getRect(w) : w.getBoundingClientRect(), c = v, f = Z);
1147
+ let z = !1, le = v, ce = Z;
1148
+ r.top > 0 && E.y - u.top < r.top ? (le = v - p, z = !0) : r.bottom > 0 && u.bottom - E.y < r.bottom && (le = v + p, z = !0), r.left > 0 && E.x - u.left < r.left ? (ce = Z - p, z = !0) : r.right > 0 && u.right - E.x < r.right && (ce = Z + p, z = !0), z && n.setScroll(w, le, ce), d(z), g = requestAnimationFrame(m);
1137
1149
  };
1138
1150
  return { run: () => {
1139
1151
  l = null, g = requestAnimationFrame(m);
@@ -1141,7 +1153,7 @@ function qe(e, t, s, n = an, o) {
1141
1153
  g && (cancelAnimationFrame(g), g = null), u = null, c = 0, f = 0, l = null, d(!1);
1142
1154
  } };
1143
1155
  }
1144
- const rn = {
1156
+ const ln = {
1145
1157
  getScrollState() {
1146
1158
  return {
1147
1159
  scrollTop: window.scrollY ?? document.documentElement.scrollTop,
@@ -1154,58 +1166,58 @@ const rn = {
1154
1166
  getRect() {
1155
1167
  return new DOMRect(0, 0, window.innerWidth, window.innerHeight);
1156
1168
  }
1157
- }, ln = {
1169
+ }, cn = {
1158
1170
  get value() {
1159
1171
  return typeof document < "u" ? document.documentElement : null;
1160
1172
  }
1161
1173
  };
1162
- function cn(e, t) {
1163
- const s = te(!1), o = qe(
1164
- ln,
1174
+ function gn(e, t) {
1175
+ const s = te(!1), o = je(
1176
+ cn,
1165
1177
  t ?? {},
1166
1178
  () => {
1167
1179
  if (e.state.value !== "dragging") return null;
1168
- const i = e.overlay.position.value, g = e.overlay.size.value;
1169
- return i ? g?.width && g?.height ? {
1170
- x: i.x + g.width / 2,
1171
- y: i.y + g.height / 2
1172
- } : i : null;
1180
+ const r = e.overlay.position.value, g = e.overlay.size.value;
1181
+ return r ? g?.width && g?.height ? {
1182
+ x: r.x + g.width / 2,
1183
+ y: r.y + g.height / 2
1184
+ } : r : null;
1173
1185
  },
1174
- rn,
1186
+ ln,
1175
1187
  s
1176
- ), r = re(
1188
+ ), i = ie(
1177
1189
  () => e.state.value,
1178
- (i) => {
1179
- i === "dragging" ? o.run() : o.stop();
1190
+ (r) => {
1191
+ r === "dragging" ? o.run() : o.stop();
1180
1192
  }
1181
1193
  ), a = () => {
1182
- r(), o.stop();
1194
+ i(), o.stop();
1183
1195
  };
1184
- return je(a), { isScrolling: s, stop: a };
1196
+ return Qe(a), { isScrolling: s, stop: a };
1185
1197
  }
1186
- const gn = (e) => {
1187
- const t = jt(e), s = me.keyDown(e), n = me.keyUp(e), o = me.clear(e), r = nn(e);
1198
+ const un = (e) => {
1199
+ const t = Jt(e), s = me.keyDown(e), n = me.keyUp(e), o = me.clear(e), i = sn(e);
1188
1200
  let a = null;
1189
- re(
1201
+ ie(
1190
1202
  e.autoScrollViewport,
1191
- (i) => {
1192
- a?.(), a = null, (i === !0 || i && typeof i == "object") && (a = cn(
1203
+ (r) => {
1204
+ a?.(), a = null, (r === !0 || r && typeof r == "object") && (a = gn(
1193
1205
  e,
1194
- i === !0 ? {} : i
1206
+ r === !0 ? {} : r
1195
1207
  ).stop);
1196
1208
  },
1197
1209
  { immediate: !0 }
1198
1210
  ), U(() => {
1199
- document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", s), document.addEventListener("keyup", n), document.addEventListener("blur", o), document.addEventListener("scroll", r, !0);
1211
+ document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", s), document.addEventListener("keyup", n), document.addEventListener("blur", o), document.addEventListener("scroll", i, !0);
1200
1212
  }), V(() => {
1201
- document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", s), document.removeEventListener("keyup", n), document.removeEventListener("blur", o), document.removeEventListener("scroll", r, !0), a?.(), t.cleanup();
1213
+ document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", s), document.removeEventListener("keyup", n), document.removeEventListener("blur", o), document.removeEventListener("scroll", i, !0), a?.(), t.cleanup();
1202
1214
  });
1203
- }, ie = () => {
1204
- const e = Be(we);
1215
+ }, re = () => {
1216
+ const e = Fe(ve);
1205
1217
  if (!e) throw Error("DnD provider not found");
1206
1218
  return e;
1207
- }, We = () => {
1208
- const e = ie();
1219
+ }, Je = () => {
1220
+ const e = re();
1209
1221
  return {
1210
1222
  overlay: e.overlay,
1211
1223
  delay: e.delay,
@@ -1219,31 +1231,31 @@ const gn = (e) => {
1219
1231
  collision: e.collision,
1220
1232
  autoScrollViewport: e.autoScrollViewport
1221
1233
  };
1222
- }, un = /* @__PURE__ */ Fe({
1234
+ }, fn = /* @__PURE__ */ _e({
1223
1235
  __name: "DefaultOverlay",
1224
1236
  setup(e) {
1225
- const { entities: t, state: s, overlay: n } = We();
1226
- return (o, r) => k(s) === "dragging" ? (C(), J("div", {
1237
+ const { entities: t, state: s, overlay: n } = Je();
1238
+ return (o, i) => C(s) === "dragging" ? (I(), J("div", {
1227
1239
  key: 0,
1228
1240
  class: "dnd-kit-default-overlay",
1229
1241
  style: Le({
1230
- "--position-x": k(n).position.value.x + "px",
1231
- "--position-y": k(n).position.value.y + "px"
1242
+ "--position-x": C(n).position.value.x + "px",
1243
+ "--position-y": C(n).position.value.y + "px"
1232
1244
  })
1233
1245
  }, [
1234
- (C(!0), J(he, null, Je(k(t).draggingMap, ([a, i]) => (C(), J(he, null, [
1235
- k(t).draggableMap.get(a)?.render ? (C(), ne(be(k(t).draggableMap.get(a)?.render), { key: 0 })) : (C(), ne(be(a.tagName), {
1246
+ (I(!0), J(he, null, et(C(t).draggingMap, ([a, r]) => (I(), J(he, null, [
1247
+ C(t).draggableMap.get(a)?.render ? (I(), ne(be(C(t).draggableMap.get(a)?.render), { key: 0 })) : (I(), ne(be(a.tagName), {
1236
1248
  key: 1,
1237
- innerHTML: i.initialOuterHTML,
1249
+ innerHTML: r.initialOuterHTML,
1238
1250
  style: Le({
1239
- width: i.initialRect.width + "px",
1240
- height: i.initialRect.height + "px"
1251
+ width: r.initialRect.width + "px",
1252
+ height: r.initialRect.height + "px"
1241
1253
  })
1242
1254
  }, null, 8, ["innerHTML", "style"]))
1243
1255
  ], 64))), 256))
1244
- ], 4)) : Qe("", !0);
1256
+ ], 4)) : tt("", !0);
1245
1257
  }
1246
- }), hn = /* @__PURE__ */ Fe({
1258
+ }), bn = /* @__PURE__ */ _e({
1247
1259
  __name: "DnDProvider",
1248
1260
  props: {
1249
1261
  autoScrollViewport: { type: [Object, Boolean, null] },
@@ -1252,34 +1264,35 @@ const gn = (e) => {
1252
1264
  class: {}
1253
1265
  },
1254
1266
  setup(e) {
1255
- const t = e, s = et("overlayRef"), n = vt(s, t);
1256
- gn(n);
1267
+ const t = e, s = nt("overlayRef"), n = xt(s, t);
1268
+ un(n);
1257
1269
  const o = y(
1258
- () => n.overlay.render.value ?? un
1270
+ () => n.overlay.render.value ?? fn
1259
1271
  );
1260
- return tt(we, n), (r, a) => (C(), J(he, null, [
1261
- Ce(r.$slots, "default"),
1262
- (C(), ne(nt, {
1263
- to: k(n).overlay.to.value || "body"
1272
+ return st(ve, n), (i, a) => (I(), J(he, null, [
1273
+ Ce(i.$slots, "default"),
1274
+ (I(), ne(ot, {
1275
+ to: C(n).overlay.to.value || "body"
1264
1276
  }, [
1265
- st("div", ot({
1277
+ Ie("div", at({
1266
1278
  ref_key: "overlayRef",
1267
1279
  ref: s,
1268
1280
  class: "dnd-kit-overlay-container"
1269
1281
  }, t), [
1270
- Ce(r.$slots, "overlay", { overlay: o.value }, () => [
1271
- (C(), ne(be(o.value)))
1282
+ Ce(i.$slots, "overlay", { overlay: o.value }, () => [
1283
+ (I(), ne(be(o.value)))
1272
1284
  ])
1273
1285
  ], 16)
1274
- ], 8, ["to"]))
1286
+ ], 8, ["to"])),
1287
+ Ie("pre", null, it(C(n).entities.selectedSet), 1)
1275
1288
  ], 64));
1276
1289
  }
1277
1290
  });
1278
- function bn(e, t, s) {
1279
- const n = ie();
1280
- let o, r, a;
1281
- typeof t == "function" ? (o = {}, r = t) : (o = t ?? {}, r = s);
1282
- const i = y({
1291
+ function yn(e, t, s) {
1292
+ const n = re();
1293
+ let o, i, a;
1294
+ typeof t == "function" ? (o = {}, i = t) : (o = t ?? {}, i = s);
1295
+ const r = y({
1283
1296
  get() {
1284
1297
  const c = D(e);
1285
1298
  return c ? n.entities.selectedSet.has(c) : !1;
@@ -1306,7 +1319,7 @@ function bn(e, t, s) {
1306
1319
  groups: o.groups ?? [],
1307
1320
  modifier: o.modifier,
1308
1321
  events: o.events,
1309
- payload: r,
1322
+ payload: i,
1310
1323
  data: o.data,
1311
1324
  dragHandle: o.dragHandle,
1312
1325
  activation: o.activation,
@@ -1316,14 +1329,14 @@ function bn(e, t, s) {
1316
1329
  }), V(() => {
1317
1330
  a && (n.lib.draggableObserver.unobserve(a), n.entities.visibleDraggableSet.delete(a), n.entities.draggableMap.delete(a), n.entities.modifiersDraggableSet.delete(a));
1318
1331
  }), {
1319
- selected: i,
1332
+ selected: r,
1320
1333
  isDragging: g,
1321
1334
  isAllowed: l,
1322
1335
  isDragOver: u
1323
1336
  };
1324
1337
  }
1325
- const yn = (e, t) => {
1326
- const s = ie(), n = y(() => e.value === s.entities.selectingArea);
1338
+ const pn = (e, t) => {
1339
+ const s = re(), n = y(() => e.value === s.entities.selectingArea);
1327
1340
  let o = null;
1328
1341
  U(() => {
1329
1342
  o = D(e), o && (o.setAttribute(T.SELECT_AREA, ""), s.lib.selectableAreaObserver.observe(o), s.entities.selectableAreaMap.set(o, {
@@ -1338,18 +1351,18 @@ const yn = (e, t) => {
1338
1351
  }), V(() => {
1339
1352
  o && (s.lib.selectableAreaObserver.unobserve(o), s.entities.visibleSelectableAreaSet.delete(o), s.entities.modifiersSelectableAreaSet.delete(o), s.entities.selectableAreaMap.delete(o));
1340
1353
  });
1341
- const r = y(() => {
1354
+ const i = y(() => {
1342
1355
  s.scrollPosition.x, s.scrollPosition.y;
1343
1356
  const a = s.pointer.value;
1344
- return !a || s.state.value !== "selecting" || !o || !n.value ? {} : zt(a.start, a.current, o);
1357
+ return !a || s.state.value !== "selecting" || !o || !n.value ? {} : Ot(a.start, a.current, o);
1345
1358
  });
1346
1359
  return {
1347
1360
  isSelecting: n,
1348
- style: r
1361
+ style: i
1349
1362
  };
1350
1363
  };
1351
- function pn(e, t) {
1352
- const s = Be(we);
1364
+ function Sn(e, t) {
1365
+ const s = Fe(ve);
1353
1366
  if (!s) throw Error("DnD provider not found");
1354
1367
  let n = null;
1355
1368
  return U(() => {
@@ -1361,11 +1374,11 @@ function pn(e, t) {
1361
1374
  n && s.entities.constraintsAreaMap.delete(n);
1362
1375
  }), {};
1363
1376
  }
1364
- function Sn(e, t, s) {
1365
- const n = ie();
1366
- let o = null, r, a;
1367
- typeof t == "function" ? (r = {}, a = t) : (r = t ?? {}, a = s);
1368
- const i = y(() => {
1377
+ function Dn(e, t, s) {
1378
+ const n = re();
1379
+ let o = null, i, a;
1380
+ typeof t == "function" ? (i = {}, a = t) : (i = t ?? {}, a = s);
1381
+ const r = y(() => {
1369
1382
  const l = D(e);
1370
1383
  return l ? n.entities.allowedDroppableSet.has(l) : !1;
1371
1384
  }), g = y(() => {
@@ -1375,82 +1388,82 @@ function Sn(e, t, s) {
1375
1388
  });
1376
1389
  return U(() => {
1377
1390
  o = D(e), o && (o.setAttribute(T.DROPPABLE, ""), n.lib.droppableObserver.observe(o), n.entities.droppableMap.set(o, {
1378
- disabled: r.disabled ?? !1,
1379
- groups: r.groups ?? [],
1380
- events: r.events,
1391
+ disabled: i.disabled ?? !1,
1392
+ groups: i.groups ?? [],
1393
+ events: i.events,
1381
1394
  payload: a,
1382
- data: r.data,
1395
+ data: i.data,
1383
1396
  hoveredPlacement: void 0
1384
1397
  }));
1385
1398
  }), V(() => {
1386
1399
  o && (n.lib.droppableObserver.unobserve(o), n.entities.visibleDroppableSet.delete(o), n.entities.droppableMap.delete(o));
1387
1400
  }), {
1388
- isAllowed: i,
1401
+ isAllowed: r,
1389
1402
  isDragOver: g
1390
1403
  };
1391
1404
  }
1392
- const Dn = (e, t) => {
1393
- const s = We(), n = te(!1), r = qe(
1405
+ const Mn = (e, t) => {
1406
+ const s = Je(), n = te(!1), i = je(
1394
1407
  e,
1395
1408
  t ?? {},
1396
1409
  () => {
1397
1410
  if (s.state.value !== "dragging") return null;
1398
- const a = s.overlay.position.value, i = s.overlay.size.value;
1399
- return a ? i?.width && i?.height ? {
1400
- x: a.x + i.width / 2,
1401
- y: a.y + i.height / 2
1411
+ const a = s.overlay.position.value, r = s.overlay.size.value;
1412
+ return a ? r?.width && r?.height ? {
1413
+ x: a.x + r.width / 2,
1414
+ y: a.y + r.height / 2
1402
1415
  } : a : null;
1403
1416
  },
1404
1417
  void 0,
1405
1418
  n
1406
1419
  );
1407
- return re(
1420
+ return ie(
1408
1421
  () => s.state.value,
1409
1422
  (a) => {
1410
- a === "dragging" ? r.run() : r.stop();
1423
+ a === "dragging" ? i.run() : i.stop();
1411
1424
  }
1412
1425
  ), { isScrolling: n };
1413
1426
  };
1414
- function Te(e, t) {
1427
+ function ze(e, t) {
1415
1428
  return t <= 0 ? e : Math.round(e / t) * t;
1416
1429
  }
1417
- function Mn(e, t) {
1430
+ function wn(e, t) {
1418
1431
  const s = t && "grid" in t && t.grid != null, n = t ? s ? t.grid : t.gridX : 1, o = t ? s ? t.grid : t.gridY : 1;
1419
1432
  return y(() => {
1420
- const { x: r, y: a } = e.value;
1433
+ const { x: i, y: a } = e.value;
1421
1434
  return {
1422
- x: Te(r, n),
1423
- y: Te(a, o)
1435
+ x: ze(i, n),
1436
+ y: ze(a, o)
1424
1437
  };
1425
1438
  });
1426
1439
  }
1427
- const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1440
+ const Be = () => !0, Oe = () => 0, dn = "separate", mn = () => {
1428
1441
  const e = {
1429
- filterElements: ze,
1430
- filterZones: ze,
1442
+ filterElements: Be,
1443
+ filterZones: Be,
1431
1444
  sortElements: Oe,
1432
1445
  sortZones: Oe,
1433
- mergeStrategy: fn,
1446
+ mergeStrategy: dn,
1434
1447
  pickClosestBetweenFirst: !1
1435
- }, t = (n, o, r, a, i, g, l) => {
1436
- const u = a instanceof Set ? a : new Set(a), c = { containerBox: o, pointer: r }, f = e.minOverlapPercent, d = [];
1448
+ }, t = (n, o, i, a, r, g, l) => {
1449
+ const u = a instanceof Set ? a : new Set(a), c = { containerBox: o, pointer: i }, f = e.minOverlapPercent, d = [];
1437
1450
  for (const m of u) {
1438
- if (!i(m, n)) continue;
1451
+ if (!r(m, n)) continue;
1439
1452
  const h = X(m);
1440
1453
  if (!l(h, c)) continue;
1441
1454
  const S = Q(h, o);
1442
1455
  if (f !== void 0 && S < f) continue;
1443
1456
  let b = 0;
1444
- for (const v of u)
1445
- v !== m && K(v, m) && b++;
1457
+ for (const w of u)
1458
+ w !== m && K(w, m) && b++;
1446
1459
  d.push({
1447
1460
  node: m,
1448
1461
  box: h,
1449
1462
  meta: {
1450
- isPointerInElement: Nt(h, r.x, r.y),
1463
+ isPointerInElement: Yt(h, i.x, i.y),
1451
1464
  overlapPercent: S,
1452
1465
  depth: b,
1453
- centerDistance: Zt(
1466
+ centerDistance: Nt(
1454
1467
  Y(o),
1455
1468
  Y(h)
1456
1469
  )
@@ -1502,12 +1515,12 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1502
1515
  "sensor: container, elements, zones, collision are required"
1503
1516
  );
1504
1517
  return (o) => {
1505
- const r = n.container(o);
1506
- if (!r) return { elements: [], zones: [] };
1507
- const a = n.containerBox ? n.containerBox(o) : X(r), i = o.pointer.value?.current ?? { x: 0, y: 0 }, g = t(
1518
+ const i = n.container(o);
1519
+ if (!i) return { elements: [], zones: [] };
1520
+ const a = n.containerBox ? n.containerBox(o) : X(i), r = o.pointer.value?.current ?? { x: 0, y: 0 }, g = t(
1508
1521
  o,
1509
1522
  a,
1510
- i,
1523
+ r,
1511
1524
  n.elements(o),
1512
1525
  n.filterElements,
1513
1526
  n.sortElements,
@@ -1515,7 +1528,7 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1515
1528
  ), l = t(
1516
1529
  o,
1517
1530
  a,
1518
- i,
1531
+ r,
1519
1532
  n.zones(o),
1520
1533
  n.filterZones,
1521
1534
  n.sortZones,
@@ -1540,8 +1553,8 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1540
1553
  for (const f of u) {
1541
1554
  const d = Y(f.box);
1542
1555
  f.distance = Math.hypot(
1543
- i.x - d.x,
1544
- i.y - d.y
1556
+ r.x - d.x,
1557
+ r.y - d.y
1545
1558
  );
1546
1559
  }
1547
1560
  const c = u.reduce(
@@ -1551,12 +1564,12 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1551
1564
  }
1552
1565
  if (n.pickClosestBetweenFirst && g[0] && l[0]) {
1553
1566
  const u = Y(l[0].box), c = Y(g[0].box), f = Math.hypot(
1554
- i.x - u.x,
1555
- i.y - u.y
1567
+ r.x - u.x,
1568
+ r.y - u.y
1556
1569
  );
1557
1570
  return Math.hypot(
1558
- i.x - c.x,
1559
- i.y - c.y
1571
+ r.x - c.x,
1572
+ r.y - c.y
1560
1573
  ) < f ? { elements: g.map((m) => m.node), zones: [] } : { elements: [], zones: l.map((m) => m.node) };
1561
1574
  }
1562
1575
  return {
@@ -1567,16 +1580,16 @@ const ze = () => !0, Oe = () => 0, fn = "separate", dn = () => {
1567
1580
  }
1568
1581
  };
1569
1582
  return s;
1570
- }, vn = () => dn();
1583
+ }, vn = () => mn();
1571
1584
  export {
1572
- hn as DnDProvider,
1585
+ bn as DnDProvider,
1573
1586
  vn as createSensor,
1574
1587
  Me as defaultCollisionDetection,
1575
- Dn as makeAutoScroll,
1576
- pn as makeConstraintArea,
1577
- bn as makeDraggable,
1578
- Sn as makeDroppable,
1579
- yn as makeSelectionArea,
1580
- Mn as makeSnappedOverlayPosition,
1581
- We as useDnDProvider
1588
+ Mn as makeAutoScroll,
1589
+ Sn as makeConstraintArea,
1590
+ yn as makeDraggable,
1591
+ Dn as makeDroppable,
1592
+ pn as makeSelectionArea,
1593
+ wn as makeSnappedOverlayPosition,
1594
+ Je as useDnDProvider
1582
1595
  };