fluid-dnd 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{HandlerPublisher-BNn5KECH.cjs → HandlerPublisher-B68XPAcH.cjs} +1 -1
- package/dist/{HandlerPublisher-xM3zyGAn.js → HandlerPublisher-pcX0Zmas.js} +1 -1
- package/dist/core/{configHandler.d.ts → config/configHandler.d.ts} +2 -2
- package/dist/core/{configHandler.js → config/configHandler.js} +4 -5
- package/dist/core/{utils → config}/droppableConfigurator.d.ts +3 -3
- package/dist/core/{utils → config}/droppableConfigurator.js +28 -11
- package/dist/core/dragAndDrop.d.ts +3 -3
- package/dist/core/dragAndDrop.js +53 -9
- package/dist/core/events/changeDraggableStyles.d.ts +4 -0
- package/dist/core/events/changeDraggableStyles.js +40 -0
- package/dist/core/events/dragAndDrop/dragAndDrop.d.ts +9 -0
- package/dist/core/{utils/events/emitEvents.js → events/dragAndDrop/dragAndDrop.js} +26 -145
- package/dist/core/{utils/translate/GetTranslateBeforeDropping.d.ts → events/dragAndDrop/getTranslateBeforeDropping.d.ts} +2 -2
- package/dist/core/{utils/translate/GetTranslateBeforeDropping.js → events/dragAndDrop/getTranslateBeforeDropping.js} +7 -15
- package/dist/core/{utils/translate/GetTranslationByDraggingAndEvent.d.ts → events/dragAndDrop/getTranslationByDraggingAndEvent.d.ts} +2 -2
- package/dist/core/{utils/translate/GetTranslationByDraggingAndEvent.js → events/dragAndDrop/getTranslationByDraggingAndEvent.js} +4 -4
- package/dist/core/events/insert.d.ts +4 -0
- package/dist/core/events/insert.js +80 -0
- package/dist/core/events/remove.d.ts +4 -0
- package/dist/core/events/remove.js +51 -0
- package/dist/core/{utils/scroll.d.ts → positioning/autoScroll.d.ts} +0 -2
- package/dist/core/{utils/scroll.js → positioning/autoScroll.js} +1 -5
- package/dist/core/{utils/SetTransform.d.ts → positioning/usePositioning.d.ts} +1 -1
- package/dist/core/{utils/SetTransform.js → positioning/usePositioning.js} +5 -5
- package/dist/core/{utils/tempChildren.d.ts → tempChildren.d.ts} +1 -2
- package/dist/core/{utils/tempChildren.js → tempChildren.js} +22 -29
- package/dist/core/useDraggable.js +16 -12
- package/dist/core/utils/SetStyles.d.ts +3 -3
- package/dist/core/utils/SetStyles.js +12 -12
- package/dist/core/utils/observer.d.ts +1 -0
- package/dist/core/utils/observer.js +8 -0
- package/dist/index-2hBSSK9_.cjs +1 -0
- package/dist/index-DFXw7kYo.js +1223 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.mjs +4 -11
- package/dist/react/utils/ReactLilstConfig.d.ts +2 -2
- package/dist/react/utils/ReactLilstConfig.js +7 -17
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.mjs +2 -2
- package/dist/svelte/utils/SvelteListCondig.js +1 -1
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.mjs +2 -2
- package/dist/vue/utils/VueListCondig.d.ts +3 -3
- package/dist/vue/utils/VueListCondig.js +2 -5
- package/package.json +1 -1
- package/dist/core/utils/config.d.ts +0 -5
- package/dist/core/utils/config.js +0 -57
- package/dist/core/utils/events/emitEvents.d.ts +0 -11
- package/dist/index-BYT3HBbe.cjs +0 -1
- package/dist/index-m7C-XuaH.js +0 -1275
- /package/dist/core/utils/{touchDevice.d.ts → typesCheckers.d.ts} +0 -0
- /package/dist/core/utils/{touchDevice.js → typesCheckers.js} +0 -0
package/dist/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-2hBSSK9_.cjs");exports.dragAndDrop=e.dragAndDrop;
|
package/dist/index.mjs
CHANGED
package/dist/react/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),y=require("../HandlerPublisher-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),y=require("../HandlerPublisher-B68XPAcH.cjs"),b=require("../index-2hBSSK9_.cjs"),S=require("react-dom");function A(f,i){const[e,n]=u.useState(f),a=u.useRef(e);u.useEffect(()=>{a.current=e},[e]);function d(t,r=!1){const s=a.current[t],c=()=>{n(o=>[...o.slice(0,t),...o.slice(t+1)])};return r?S.flushSync(c):c(),s}function g(t,r,s=!1){const c=()=>{n(o=>[...o.slice(0,t),r,...o.slice(t)])};s?S.flushSync(c):c()}function h(){return e.length}function m(t){return e[t]}function l(t,r,s){b.insertToListEmpty(t,i.current,r,s)}return[e,n,{removeAtEvent:d,insertEvent:g,getLength:h,getValue:m,insertToListEmpty:l}]}const D=new y.HandlerPublisher;function E(f,i){const e=u.useRef(null),[n,a,d]=A(f,e),[g,h,m]=b.dragAndDrop(d,D,i,"data-index");return u.useEffect(()=>{const l=m(e.current);return()=>{l&&l.disconnect()}},[n.length,i]),[e,n,a,h,g]}exports.useDragAndDrop=E;
|
package/dist/react/index.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useState as S, useRef as h, useEffect as E } from "react";
|
2
|
-
import { H as b } from "../HandlerPublisher-
|
3
|
-
import { i as A, d as C } from "../index-
|
2
|
+
import { H as b } from "../HandlerPublisher-pcX0Zmas.js";
|
3
|
+
import { i as A, d as C } from "../index-DFXw7kYo.js";
|
4
4
|
import { flushSync as p } from "react-dom";
|
5
5
|
function L(l, c) {
|
6
6
|
const [t, n] = S(l), a = h(t);
|
@@ -9,20 +9,13 @@ function L(l, c) {
|
|
9
9
|
}, [t]);
|
10
10
|
function f(e, r = !1) {
|
11
11
|
const s = a.current[e], o = () => {
|
12
|
-
n((i) => [
|
13
|
-
...i.slice(0, e),
|
14
|
-
...i.slice(e + 1)
|
15
|
-
]);
|
12
|
+
n((i) => [...i.slice(0, e), ...i.slice(e + 1)]);
|
16
13
|
};
|
17
14
|
return r ? p(o) : o(), s;
|
18
15
|
}
|
19
16
|
function m(e, r, s = !1) {
|
20
17
|
const o = () => {
|
21
|
-
n((i) => [
|
22
|
-
...i.slice(0, e),
|
23
|
-
r,
|
24
|
-
...i.slice(e)
|
25
|
-
]);
|
18
|
+
n((i) => [...i.slice(0, e), r, ...i.slice(e)]);
|
26
19
|
};
|
27
20
|
s ? p(o) : o();
|
28
21
|
}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { RefObject } from
|
2
|
-
import { ListCondig } from
|
1
|
+
import { RefObject } from 'react';
|
2
|
+
import { ListCondig } from '../../core';
|
3
3
|
export declare function useReactListConfig<T, E extends HTMLElement>(items: T[], parent: RefObject<E>): readonly [T[], import("react").Dispatch<import("react").SetStateAction<T[]>>, ListCondig<T>];
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { useEffect, useRef, useState } from
|
2
|
-
import { insertToListEmpty as insertToListEmptyEvent } from
|
3
|
-
// @ts-ignore
|
4
|
-
import { flushSync } from
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
2
|
+
import { insertToListEmpty as insertToListEmptyEvent } from '../../core/events/insert';
|
3
|
+
// @ts-ignore
|
4
|
+
import { flushSync } from 'react-dom';
|
5
5
|
export function useReactListConfig(items, parent) {
|
6
6
|
const [itemsState, setItemsState] = useState(items);
|
7
7
|
const stateRef = useRef(itemsState);
|
@@ -11,10 +11,7 @@ export function useReactListConfig(items, parent) {
|
|
11
11
|
function removeAtEvent(index, sync = false) {
|
12
12
|
const deletedItem = stateRef.current[index];
|
13
13
|
const removeCallback = () => {
|
14
|
-
setItemsState(prevItems => [
|
15
|
-
...prevItems.slice(0, index),
|
16
|
-
...prevItems.slice(index + 1)
|
17
|
-
]);
|
14
|
+
setItemsState((prevItems) => [...prevItems.slice(0, index), ...prevItems.slice(index + 1)]);
|
18
15
|
};
|
19
16
|
if (sync) {
|
20
17
|
flushSync(removeCallback);
|
@@ -24,15 +21,10 @@ export function useReactListConfig(items, parent) {
|
|
24
21
|
}
|
25
22
|
return deletedItem;
|
26
23
|
}
|
27
|
-
;
|
28
24
|
function insertEvent(index, value, sync = false) {
|
29
25
|
const insertCallback = () => {
|
30
|
-
setItemsState(prevItems => {
|
31
|
-
return [
|
32
|
-
...prevItems.slice(0, index),
|
33
|
-
value,
|
34
|
-
...prevItems.slice(index)
|
35
|
-
];
|
26
|
+
setItemsState((prevItems) => {
|
27
|
+
return [...prevItems.slice(0, index), value, ...prevItems.slice(index)];
|
36
28
|
});
|
37
29
|
};
|
38
30
|
if (sync) {
|
@@ -42,11 +34,9 @@ export function useReactListConfig(items, parent) {
|
|
42
34
|
insertCallback();
|
43
35
|
}
|
44
36
|
}
|
45
|
-
;
|
46
37
|
function getLength() {
|
47
38
|
return itemsState.length;
|
48
39
|
}
|
49
|
-
;
|
50
40
|
function getValue(index) {
|
51
41
|
return itemsState[index];
|
52
42
|
}
|
package/dist/svelte/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var u=Object.defineProperty;var d=(n,t,e)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var s=(n,t,e)=>d(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../HandlerPublisher-
|
1
|
+
"use strict";var u=Object.defineProperty;var d=(n,t,e)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var s=(n,t,e)=>d(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../HandlerPublisher-B68XPAcH.cjs"),o=require("../index-2hBSSK9_.cjs");class g{constructor(t){s(this,"items");s(this,"parent");this.items=t}setParent(t){this.parent=t}removeAtEvent(t){const e=this.items;if(e.length<=0)return;const[r]=e.splice(t,1);return r}insertEvent(t,e){this.items.splice(t,0,e)}getLength(){return this.items.length}getValue(t){return this.items[t]}insertToListEmpty(t,e,r){o.insertToListEmpty(t,this.parent,e,r)}}const h=new c.HandlerPublisher;function m(n,t){const e=new g(n),[r,l,a]=o.dragAndDrop(e,h,t,"data-index");return[i=>(e.setParent(i),a(i),{destroy(){}}),l,r]}exports.useDragAndDrop=m;
|
package/dist/svelte/index.mjs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
var l = Object.defineProperty;
|
2
2
|
var d = (n, t, e) => t in n ? l(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
3
3
|
var r = (n, t, e) => d(n, typeof t != "symbol" ? t + "" : t, e);
|
4
|
-
import { H as c } from "../HandlerPublisher-
|
5
|
-
import { i as m, d as u } from "../index-
|
4
|
+
import { H as c } from "../HandlerPublisher-pcX0Zmas.js";
|
5
|
+
import { i as m, d as u } from "../index-DFXw7kYo.js";
|
6
6
|
class h {
|
7
7
|
constructor(t) {
|
8
8
|
r(this, "items");
|
package/dist/vue/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var c=Object.defineProperty;var h=(n,e,t)=>e in n?c(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var s=(n,e,t)=>h(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),g=require("../HandlerPublisher-
|
1
|
+
"use strict";var c=Object.defineProperty;var h=(n,e,t)=>e in n?c(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var s=(n,e,t)=>h(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),g=require("../HandlerPublisher-B68XPAcH.cjs"),u=require("../index-2hBSSK9_.cjs"),v=(n,e)=>{const t=n.value;if(t.length<=0)return;const[r]=t.splice(e,1);return r},d=(n,e,t)=>{n.value.splice(e,0,t)},m=n=>n.value.length,p=(n,e)=>n.value[e];class V{constructor(e,t){s(this,"items");s(this,"parent");this.items=e,this.parent=t}removeAtEvent(e){return v(this.items,e)}insertEvent(e,t){return d(this.items,e,t)}getLength(){return m(this.items)}getValue(e){return p(this.items,e)}insertToListEmpty(e,t,r){u.insertToListEmpty(e,this.parent.value,t,r)}}const A=new g.HandlerPublisher;function L(n,e){const t=i.ref();var r=new V(n,t);const[l,o,a]=u.dragAndDrop(r,A,e);return i.watch(t,()=>{a(t.value)}),[t,o,l]}exports.useDragAndDrop=L;
|
package/dist/vue/index.mjs
CHANGED
@@ -2,8 +2,8 @@ var l = Object.defineProperty;
|
|
2
2
|
var u = (n, t, e) => t in n ? l(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
3
3
|
var r = (n, t, e) => u(n, typeof t != "symbol" ? t + "" : t, e);
|
4
4
|
import { ref as c, watch as m } from "vue";
|
5
|
-
import { H as h } from "../HandlerPublisher-
|
6
|
-
import { i as p, d as v } from "../index-
|
5
|
+
import { H as h } from "../HandlerPublisher-pcX0Zmas.js";
|
6
|
+
import { i as p, d as v } from "../index-DFXw7kYo.js";
|
7
7
|
const g = (n, t) => {
|
8
8
|
const e = n.value;
|
9
9
|
if (e.length <= 0)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { CoreConfig } from
|
2
|
-
import { ListCondig } from
|
3
|
-
import { Ref } from
|
1
|
+
import { CoreConfig } from '../../core';
|
2
|
+
import { ListCondig } from '../../core';
|
3
|
+
import { Ref } from 'vue';
|
4
4
|
export declare class VueListCondig<T> implements ListCondig<T> {
|
5
5
|
private items;
|
6
6
|
private parent;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { getLength, getValue, onInsertEventOnList, removeAtEventOnList } from
|
2
|
-
import { insertToListEmpty } from
|
1
|
+
import { getLength, getValue, onInsertEventOnList, removeAtEventOnList } from './DropMethods';
|
2
|
+
import { insertToListEmpty } from '../../core/events/insert';
|
3
3
|
export class VueListCondig {
|
4
4
|
items;
|
5
5
|
parent;
|
@@ -10,15 +10,12 @@ export class VueListCondig {
|
|
10
10
|
removeAtEvent(index) {
|
11
11
|
return removeAtEventOnList(this.items, index);
|
12
12
|
}
|
13
|
-
;
|
14
13
|
insertEvent(index, value) {
|
15
14
|
return onInsertEventOnList(this.items, index, value);
|
16
15
|
}
|
17
|
-
;
|
18
16
|
getLength() {
|
19
17
|
return getLength(this.items);
|
20
18
|
}
|
21
|
-
;
|
22
19
|
getValue(index) {
|
23
20
|
return getValue(this.items, index);
|
24
21
|
}
|
package/package.json
CHANGED
@@ -1,5 +0,0 @@
|
|
1
|
-
import { ListCondig, MapFrom } from '..';
|
2
|
-
import { Config, CoreConfig } from '..';
|
3
|
-
import { DroppableConfig } from '../configHandler';
|
4
|
-
export declare const getConfig: <T>(listCondig: ListCondig<T>, config?: Config<T>) => CoreConfig<T>;
|
5
|
-
export declare const MapConfig: <T>(coreConfig: DroppableConfig<any>, mapFrom: MapFrom<T>) => CoreConfig<any>;
|
@@ -1,57 +0,0 @@
|
|
1
|
-
import { VERTICAL } from '..';
|
2
|
-
import { DRAGGABLE_CLASS } from './classes';
|
3
|
-
export const getConfig = (listCondig, config) => {
|
4
|
-
const onRemoveAtEvent = (index, sync) => {
|
5
|
-
return listCondig.removeAtEvent(index, sync);
|
6
|
-
};
|
7
|
-
const onInsertEvent = (index, value, sync) => {
|
8
|
-
return listCondig.insertEvent(index, value, sync);
|
9
|
-
};
|
10
|
-
const onGetLegth = () => {
|
11
|
-
return listCondig.getLength();
|
12
|
-
};
|
13
|
-
const onGetValue = (index) => {
|
14
|
-
return listCondig.getValue(index);
|
15
|
-
};
|
16
|
-
const defaultMapFrom = (object) => {
|
17
|
-
return object;
|
18
|
-
};
|
19
|
-
return {
|
20
|
-
direction: config?.direction ?? VERTICAL,
|
21
|
-
handlerSelector: config?.handlerSelector ?? DRAGGABLE_CLASS,
|
22
|
-
draggingClass: config?.draggingClass ?? 'dragging',
|
23
|
-
droppableClass: config?.droppableClass ?? 'droppable-hover',
|
24
|
-
isDraggable: config?.isDraggable ?? (() => true),
|
25
|
-
onDragStart: config?.onDragStart ?? (() => { }),
|
26
|
-
onDragEnd: config?.onDragEnd ?? (() => { }),
|
27
|
-
droppableGroup: config?.droppableGroup,
|
28
|
-
onRemoveAtEvent,
|
29
|
-
onInsertEvent,
|
30
|
-
onGetLegth,
|
31
|
-
onGetValue,
|
32
|
-
animationDuration: config?.animationDuration ?? 200,
|
33
|
-
removingClass: config?.removingClass ?? 'removing',
|
34
|
-
insertingFromClass: config?.insertingFromClass ?? 'from-inserting',
|
35
|
-
delayBeforeRemove: config?.delayBeforeRemove ?? 200,
|
36
|
-
delayBeforeInsert: config?.delayBeforeInsert ?? 200,
|
37
|
-
mapFrom: config?.mapFrom ?? defaultMapFrom,
|
38
|
-
delayBeforeTouchMoveEvent: config?.delayBeforeTouchMoveEvent ?? 150,
|
39
|
-
coordinateTransform: config?.coordinateTransform ?? [(coordinate) => coordinate]
|
40
|
-
};
|
41
|
-
};
|
42
|
-
export const MapConfig = (coreConfig, mapFrom) => {
|
43
|
-
const { config, droppable } = coreConfig;
|
44
|
-
const { onInsertEvent, onDragEnd } = config;
|
45
|
-
const mapOnInsertEvent = (index, value) => {
|
46
|
-
return onInsertEvent(index, mapFrom(value, droppable), true);
|
47
|
-
};
|
48
|
-
const mapOnDragEnd = (eventData) => {
|
49
|
-
const { index, value } = eventData;
|
50
|
-
onDragEnd({ index, value: mapFrom(value, droppable) });
|
51
|
-
};
|
52
|
-
return {
|
53
|
-
...config,
|
54
|
-
onDragEnd: mapOnDragEnd,
|
55
|
-
onInsertEvent: mapOnInsertEvent
|
56
|
-
};
|
57
|
-
};
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { WindowScroll } from "../../../../index";
|
2
|
-
import { CoreConfig } from "../..";
|
3
|
-
import { DRAG_EVENT, START_DRAG_EVENT, START_DROP_EVENT } from "..";
|
4
|
-
import { DroppableConfig } from "../../configHandler";
|
5
|
-
import HandlerPublisher from '../../HandlerPublisher';
|
6
|
-
type DraggingEvent = typeof DRAG_EVENT | typeof START_DRAG_EVENT;
|
7
|
-
type DragAndDropEvent = DraggingEvent | DropEvent;
|
8
|
-
type DropEvent = "drop" | typeof START_DROP_EVENT;
|
9
|
-
export default function useEmitEvents<T>(currentConfig: CoreConfig<T>, index: number, parent: HTMLElement, droppableGroupClass: string | null, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(draggedElement: HTMLElement, event: DragAndDropEvent, initialWindowScroll: WindowScroll, droppableConfig: DroppableConfig<T> | undefined, positionOnSourceDroppable?: number) => void, (targetIndex: number, draggedElement: HTMLElement, droppableConfig: DroppableConfig<T>, onFinishRemoveEvent: (element: HTMLElement) => void) => void, (targetIndex: number, draggedElement: HTMLElement, droppable: HTMLElement, value: T, startInserting: () => void) => void, (draggedElement: HTMLElement) => void, (element: Element, force: boolean) => void];
|
10
|
-
export declare const insertToListEmpty: <T>(config: CoreConfig<T>, droppable: HTMLElement | undefined | null, targetIndex: number, value: T) => void;
|
11
|
-
export {};
|
package/dist/index-BYT3HBbe.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var Me=Object.defineProperty;var Be=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var V=(e,t,n)=>Be(e,typeof t!="symbol"?t+"":t,n);const _="horizontal",J="vertical",Z="draggable",Xt="droppable",Lt="handler-class",Ft="dragging",Wt="dragging-handler-class",_t="dropping",oe="grabbing",re="grab",Kt="disable-transition",we=(e,t)=>{const n=(c,f)=>e.removeAtEvent(c,f),s=(c,f,p)=>e.insertEvent(c,f,p),o=()=>e.getLength(),r=c=>e.getValue(c),a=c=>c;return{direction:(t==null?void 0:t.direction)??J,handlerSelector:(t==null?void 0:t.handlerSelector)??Z,draggingClass:(t==null?void 0:t.draggingClass)??"dragging",droppableClass:(t==null?void 0:t.droppableClass)??"droppable-hover",isDraggable:(t==null?void 0:t.isDraggable)??(()=>!0),onDragStart:(t==null?void 0:t.onDragStart)??(()=>{}),onDragEnd:(t==null?void 0:t.onDragEnd)??(()=>{}),droppableGroup:t==null?void 0:t.droppableGroup,onRemoveAtEvent:n,onInsertEvent:s,onGetLegth:o,onGetValue:r,animationDuration:(t==null?void 0:t.animationDuration)??200,removingClass:(t==null?void 0:t.removingClass)??"removing",insertingFromClass:(t==null?void 0:t.insertingFromClass)??"from-inserting",delayBeforeRemove:(t==null?void 0:t.delayBeforeRemove)??200,delayBeforeInsert:(t==null?void 0:t.delayBeforeInsert)??200,mapFrom:(t==null?void 0:t.mapFrom)??a,delayBeforeTouchMoveEvent:(t==null?void 0:t.delayBeforeTouchMoveEvent)??150,coordinateTransform:(t==null?void 0:t.coordinateTransform)??[c=>c]}},Re=(e,t)=>{const{config:n,droppable:s}=e,{onInsertEvent:o,onDragEnd:r}=n;return{...n,onDragEnd:f=>{const{index:p,value:S}=f;r({index:p,value:t(S,s)})},onInsertEvent:(f,p)=>o(f,t(p,s),!0)}},tt=(e,t)=>e.classList.contains(t),gt=(e,t,n=!1)=>{e.classList.toggle(t,n)},k=(e,t)=>{e.classList.add(t)},At=(e,t)=>{e.classList.remove(t)},Le=(e,t)=>Mt(t).every(n=>tt(e,n)),pt=e=>e?`.${Mt(e).join(".")}`:"",Oe=(e,t)=>{if(!t)return;const n=Mt(t);e.classList.add(...n)},Mt=e=>e?e.split(" ").filter(t=>t):[],Ne=()=>{const{scrollX:e,scrollY:t}=window;return{scrollX:e,scrollY:t}},zt=e=>!e||e.trim().length==0||e=="normal"?0:parseFloat(e),Fe=e=>e?parseInt(e):-1,Pe=e=>{const t=getComputedStyle(e),n=new DOMMatrixReadOnly(t.transform);return{x:n.m41,y:n.m42}},ie=(e,t)=>e.x1>t.x1?ie(t,e):e.x2<t.x1?0:e.x2>=t.x2?e.x2-e.x1:e.x2-t.x1,xt=(e,t)=>!$e(e,t),$e=(e,t)=>{const{intersectionX:n,intersectionY:s,rect1:o,rect2:r}=ce(e,t);return s>=Math.min(o.height,r.height)/2&&n>=Math.min(o.width,r.width)/2},Ge=(e,t)=>!Ie(e,t),Ie=(e,t)=>{const{intersectionX:n,intersectionY:s}=ce(e,t);return s>=0&&n>=0},ce=(e,t)=>{const n=Ot(e),s=Ot(t),o=Qt(n,s,J),r=Qt(n,s,_);return{rect1:n,rect2:s,intersectionX:r,intersectionY:o}},Qt=(e,t,n)=>{const{before:s,distance:o}=L(n);return ie({x1:e[s],x2:e[s]+e[o]},{x1:t[s],x2:t[s]+t[o]})},O=(e,t)=>e?zt(getComputedStyle(e)[t]):0,Ut=e=>{const{scrollLeft:t,scrollTop:n}=e;return{scrollLeft:t,scrollTop:n}},Ot=e=>e.getBoundingClientRect(),L=e=>{const t=e==_;return{beforeMargin:t?"marginLeft":"marginTop",afterMargin:t?"marginRight":"marginBottom",borderBeforeWidth:t?"borderLeftWidth":"borderTopWidth",before:t?"left":"top",after:t?"right":"down",gap:t?"columnGap":"rowGap",distance:t?"width":"height",axis:t?"x":"y",offset:t?"offsetX":"offsetY",scroll:t?"scrollX":"scrollY",scrollElement:t?"scrollLeft":"scrollTop",page:t?"pageX":"pageY",inner:t?"innerWidth":"innerHeight",offsetElement:t?"offsetLeft":"offsetTop",scrollDistance:t?"scrollWidth":"scrollHeight",clientDistance:t?"clientWidth":"clientHeight",paddingBefore:t?"paddingLeft":"paddingTop",getRect:Ot}},wt=(e,t)=>Ye(e,t),ae=e=>[...e.children].filter(n=>tt(n,Z)),Ye=(e,t)=>{const n=[...t.children].filter(o=>tt(o,Z)&&!o.isEqualNode(e)).toReversed(),s=[...t.children].findLastIndex(o=>o.isEqualNode(e));return[n,s,t]},Xe=e=>{let t=e.parentElement;for(;t;){if(window.getComputedStyle(t).position==="fixed")return t;t=t.parentElement}return null},le=(e,t)=>{const{before:n,borderBeforeWidth:s}=L(t),o=Xe(e);return o?Ot(o)[n]+O(o,s):0},yt=e=>window.TouchEvent&&e instanceof TouchEvent,st=e=>e instanceof HTMLElement,ue=e=>e instanceof MouseEvent,We=["onmouseup","onmousedown","onmousemove"],_e=(e,t,n)=>{e&&(e.style.height=`${t}px`,e.style.width=`${n}px`)},Et=(e,t,n)=>{!e||!st(e)||(n==0&&t==0?e.style.transform="":e.style.transform=`translate(${n}px,${t}px)`)},Ve=(e,t,n,s)=>{e[t]=o=>{if(o.defaultPrevented)return;s&&s(o);const r=Vt(o);n(r)}},It=(e,t,n,s)=>{n&&(He(t)?e[t]=n:Ve(e,t,n,s))},He=e=>We.includes(e),qe=e=>{const{target:t}=e;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:t,offsetX:0,offsetY:0}},ze=(e,t)=>{const n=(s,o)=>Ze(t,window,o,s);if(ue(e)){const{offsetX:s,offsetY:o}=e;return[s,o]}else{const s=e.target;return[n(s,_),n(s,J)]}},Vt=e=>{const t=je(e);if(!t)return qe(e);const[n,s]=ze(e,t),{clientX:o,clientY:r,pageX:a,pageY:c,screenX:f,screenY:p,target:S}=t;return{clientX:o,clientY:r,pageX:a,pageY:c,screenX:f,screenY:p,target:S,offsetX:n,offsetY:s}},je=e=>{if(yt(e))return e.touches[0]??e.changedTouches[0];if(ue(e))return e},Ze=(e,t,n,s)=>{const{page:o,scroll:r,before:a,borderBeforeWidth:c,getRect:f}=L(n),p=f(s);return e[o]-t[r]-p[a]-O(s,c)},Pt=(e,t,n="ease-out",s="transform")=>{st(e)&&(e.style.transitionDuration=`${t}ms`,e.style.transitionTimingFunction=`${n}`,e.style.transitionProperty=`${s}`)},fe=(e,t,n)=>{!e||!st(e)||(e[t]=()=>{n()})},ke=e=>{var t=e.querySelector("style");if(!t){var n=document.createElement("style");return e.appendChild(n),n}return t},Je=(e,t)=>{const n=/\.-?[_a-zA-Z0-9-*\s<>():]+/g,[s]=t.match(n)||[];for(const o of e.cssRules){const[r]=o.cssText.match(n)||[];if(s===r)return!0}return!1},Ke=(e,t)=>{t.forEach(n=>{Qe(e,n)})},Qe=(e,t)=>{var s;var n=ke(e);n.sheet&&(Je(n.sheet,t)||(s=n.sheet)==null||s.insertRule(t,n.sheet.cssRules.length))},de=(e,t={})=>{for(const n of Object.keys(t)){const s=t[n];s!=null&&Ue(e,`--${n}`,s)}},Ue=(e,t,n)=>e&&e.style.setProperty(t,n),tn=(e,t,n)=>{n!=0&&(t==="vertical"?e.scrollBy(0,n):e.scrollBy(n,0))},en=(e,t,n)=>{const{scrollDistance:s,clientDistance:o,scrollElement:r}=L(e);return n[r]/(t[s]-t[o])},nn=e=>{let t=.5;const n=.03,s=(a,c,f,p)=>{const{before:S,distance:m,axis:x,getRect:R}=L(a),w=R(e)[m],N=R(c),D=f[S]-N[S]+p[x],v=N[m]-w,C=D/v,P=w/v,$=.25,G=.2,H=.8;let W=0;const I=Ge(e,c);!I&&C<G&&C>-P?W=o(C<0?0:C,G):!I&&C>H&&C<1+P&&(W=r(C,H));const Y=$*w*W;t=Math.sign(Y)*Math.min(Math.abs(Y),Math.abs(t)+n),tn(c,a,t)},o=(a,c)=>Math.pow(a/c,1/3)-1,r=(a,c)=>Math.pow(1/(1-c)*(a-c),3);return[s]},sn=(e,t)=>{let n={offsetX:0,offsetY:0},s={top:0,left:0},o={x:0,y:0};const[r]=nn(e),a=m=>{e.style.transform=`translate( ${m.x}px, ${m.y}px)`},c=m=>{e.style.top=`${m.top}px`,e.style.left=`${m.left}px`},f=(m,x,R,w)=>{const N=v=>{const{beforeMargin:C,borderBeforeWidth:P,before:$,offset:G,scroll:H,page:W,inner:I,distance:Y,axis:ot,getRect:rt}=L(v),et=R[W],K=window[H],Q=window[I],q=rt(m)[Y],U=O(m,P),it=O(m,C),nt=et-n[G],l=le(m,v);if(nt>=K-q/2&&nt<=K+Q){const d=nt-s[$]-U-it-K-l;return D(v),d}return o[ot]},D=v=>{m&&tt(m,Ft)&&v===w&&r(w,x,s,o)},E=v=>{const{axis:C}=L(v);o[C]=N(v),a(p())};E(_),E(J)},p=()=>{let m=o;for(const x of t)m=x(m,e);return m};return[f,(m,x)=>{const[R,w,N,D]=cn(m,x,e);s={top:R,left:w},c(s),n={offsetX:N,offsetY:D}}]},Rt=(e,t,n)=>{const{borderBeforeWidth:s,before:o,getRect:r}=L(e);return r(t)[o]-r(n)[o]-O(n,s)},on=(e,t)=>{let{offsetX:n,offsetY:s,target:o}=e,r=rn(o,t);const a=o;return a&&r&&!a.isSameNode(r)&&(n+=Rt(_,a,r),s+=Rt(J,a,r)),r&&t!=o&&(n+=Rt(_,r,t),s+=Rt(J,r,t)),[n,s]},rn=(e,t)=>{const n=e==null?void 0:e.closest(`.${Lt}`);return n&&n.isSameNode(t)?e:n},te=(e,t,n,s)=>{const{offset:o,beforeMargin:r,page:a,borderBeforeWidth:c,scroll:f}=L(e),p=le(n,e);return t[a]-s[o]-O(n,r)-O(n,c)-window[f]-p},cn=(e,t,n)=>{const[s,o]=on(e,n);return[te(J,e,t,{offsetX:s,offsetY:o}),te(_,e,t,{offsetX:s,offsetY:o}),s,o]},ge="startDrag",Nt="drag",jt="startDrop",an="drop",lt="temp-child",pe="cubic-bezier(0.2, 0, 0, 1)",ln=e=>e===an||e===jt,Ht=e=>!e||e.length==0?0:zt(e.replace("px","")),un=(e,t)=>{const n=getComputedStyle(e)[t];if(n.match("%")){const o=zt(n.replace("%","")),{width:r}=e.getBoundingClientRect();return r*(o/100)}return Ht(n)},Zt=(e,t)=>{if(!(e instanceof Element))return[0,!1];const n=un(e,t),s=getComputedStyle(e).display,o=n>0||s==="flex";return[n,o]},fn=e=>{const{top:t,left:n}=getComputedStyle(e);return[Ht(t),Ht(n)]},dn=(e,t)=>{const{gap:n}=L(t),[s,o]=Zt(e,n);return o?s:0};function Ct(e,t,n,s,o=e.previousElementSibling,r=e.nextElementSibling){let{height:a,width:c}=gn(n,e,o,r);return xt(e,s)&&t==Nt&&(a=0,c=0),{height:a,width:c}}const gn=(e,t,n,s)=>{const{afterMargin:o,beforeMargin:r,distance:a,gap:c,getRect:f}=L(e),p=O(t,o),S=O(t,r),m=O(s,r),[x,R]=Zt(t.parentElement,c),w=f(t)[a];if(R)return ee(w,S,p,x,0,e);const[N,D,E]=pn(n,m,p,S,o);return ee(w,D,N,0,E,e)},pn=(e,t,n,s,o)=>{const r=Math.max(t,n);let a=s,c=t;if(e){const f=O(e,o);a=Math.max(f,s),c=Math.max(c,f)}return[r,a,c]},ee=(e,t,n,s,o,r)=>hn(r,e+t+n+s-o),hn=(e,t)=>e==_?{width:t,height:0}:{width:0,height:t},ne=(e,t)=>{const{borderBeforeWidth:n,paddingBefore:s,axis:o,getRect:r}=L(e),a=O(t,n),c=O(t,s),f=r(t)[o];return a+c+f},mn=(e,t)=>{const[n,s]=fn(t),o=ne(J,e);return[ne(_,e)-s,o-n]};function Sn(e,t,n,s,o,r,a,c,f){let p=0,S=0;const m=!!(n<0&&f);if(n===s&&!m)return se({height:p,width:S},e,o,a,m);const[x,R,w,N]=Tn(t,n,s,f);if(m){const[U,it]=mn(c,f);p+=it,S+=U}const{scrollElement:D,beforeMargin:E,afterMargin:v,distance:C,gap:P}=L(e),[$,G]=Zt(c,P),[H,W,I]=yn(E,v,x,R==null?void 0:R.previousElementSibling,N,G,m),[Y,ot,rt]=bn(E,v,C,w,$,G),et=Dn(ot,Y,rt,W,H,$),K=m?c[D]:vn(D,c,r),q=(N?et-I:I-et)-K;return e===J?p+=q:e===_&&(S+=q),se({height:p,width:S},e,o,a,m)}const vn=(e,t,n)=>{const s=t[e],o=n[e];return s-o},Dn=(e,t,n,s,o,r)=>{const a=Math.max(t,o);return Math.max(n,s)+e+a+r},Tn=(e,t,n,s)=>{const o=t<n,[r,a]=[t,n].toSorted((S,m)=>S-m),c=e[t]??s,f=e[n];let p=o?e.slice(r+1,a+1):e.slice(r,a);return r<0&&s&&(p=e.slice(r+1,a)),[c,f,p,o]},bn=(e,t,n,s,o,r)=>{if(s.length==0)return[0,0,0];const a=O(s[0],e);let c=0,f=-a;for(const[p,S]of s.entries()){const m=S.getBoundingClientRect()[n],x=O(S,e);r&&(c+=x),r&&p>0?c+=o:c=Math.max(c,x),f+=c+m,c=O(S,t)}return[a,f,c]},se=(e,t,n,s,o)=>{const{scroll:r,distance:a}=L(t),c=window[r],f=n[r],p=o?0:f-2*c+s[r];return e[a]+=p,e},yn=(e,t,n,s,o,r,a)=>{const c=o?n.previousElementSibling:s;return En(e,t,c,n,r,a)},En=(e,t,n,s,o,r)=>{if(o)return[0,0,0];const a=O(r?null:n,t),c=O(s,e);let f=Math.max(a,c);return[a,c,f]},kt=(e,t,n,s=()=>!0)=>{const o=new MutationObserver(r=>{if(r=r.filter(s),r.length>0){const a=r[0];e(o,a)}});return o.observe(t,n),o},Cn="startDrag",he="cubic-bezier(0.2, 0, 0, 1)",me=50,qt=e=>st(e)?e.classList.contains(lt):!1,An=(e,t,n)=>{let s=Ct(t,Cn,n,e);const o=dn(e,n),{distance:r}=L(n);s[r]-=o;const[a,c]=xn(n,t);return s[c]=a,s},xn=(e,t)=>{const n=e==_?J:_,{distance:s,getRect:o}=L(n);return[o(t)[s],s]},ht=(e,t,n)=>{_e(e,t,n),e.style.minWidth=`${n}px`},Mn=(e,t,n)=>s=>{t.contains(e)&&(ht(e,n.height,n.width),s.disconnect())},Bn=(e,t)=>{if(!t)return;const{droppable:n,config:s,scroll:o}=e,{direction:r}=s,a=en(s.direction,n,o)>.99,{scrollDistance:c,clientDistance:f,scrollElement:p}=L(r);a&&(n[p]=n[c]-n[f])},Se=(e,t,n,s)=>{if(!n)return;const{droppable:o,config:r}=n,{direction:a,animationDuration:c}=r;if(Bn(n,t),o.querySelector(`.${lt}`)||!e)return;var f=e.tagName=="LI"?"DIV":e.tagName,p=document.createElement(f);k(p,lt),ht(p,0,0);const S=An(o,e,a);return Pt(p,c,he,"width, min-width, height"),[p,S,o]},Yt=(e,t,n,s,o)=>{const r=Se(e,n,s);if(!r)return;const[a,c,f]=r;t.isSameNode(f)&&ht(a,c.height,c.width),kt(Mn(a,f,c),f,{childList:!0,subtree:!0}),f.appendChild(a)},wn=(e,t,n)=>{const s=Se(e,t,n);if(!s)return;const[o,r,a]=s;a.appendChild(o),Rn(o,r)},Rn=(e,t)=>requestAnimationFrame(()=>{ht(e,t.height,t.width),requestAnimationFrame(()=>{Pt(e,0,he,"width, min-width, height")})}),Ln=(e,t,n,s,o=!0)=>{if(n){var r=document.querySelectorAll(`${pt(n)} > .${lt}`);r.forEach(a=>{const c=a.parentElement;if(c!=null&&c.isSameNode(t)||!o&&(c!=null&&c.isSameNode(e)))return;ht(a,0,0),setTimeout(()=>{var p;(p=a.parentNode)==null||p.removeChild(a)},s+me)})}},bt=(e,t,n=!1)=>{var s=e.querySelectorAll(`.${lt}`);s.forEach(o=>{const r=o;n?(ht(r,0,0),setTimeout(()=>{e.contains(r)&&e.removeChild(r)},t+me)):e.removeChild(o)})},On=50;function Nn(e,t,n,s,o,r){let a=t;const{direction:c,handlerSelector:f,onRemoveAtEvent:p,animationDuration:S,delayBeforeInsert:m,draggingClass:x}=e,R=(l,u,d,T,h)=>{if(!T)return;const{droppable:y,config:A}=T,M=Ct(l,u,A.direction,y);ln(u)?G(l,u,M,d,T,h):E(l,u,M,T)},w=(l,u,d,T,h)=>{const y=Ct(u,"insert",e.direction,d),{onInsertEvent:A}=e,M=ae(d);for(const[F,B]of M.entries())tt(B,Z)&&F>=l&&$(B,y);h(),setTimeout(()=>{A(l,T),ve(l,d,e),U(u),Q(u,n),bt(n,0,!0)},m)},N=(l,u,d,T)=>{if(!d||!d.droppable||!d.config)return;const{droppable:h,config:y}=d;let[A]=wt(u,h);A=[u,...A].toReversed();const M=Ct(u,"remove",y.direction,h);for(const[F,B]of A.entries())F>=l&&(P(B,M),setTimeout(()=>{T(B)},S))},D=l=>{bt(n,S,!0),setTimeout(()=>{U(l),Q(l,n)},S)},E=(l,u,d,T)=>{const{config:h,droppable:y}=T,[A]=wt(l,y),M=xt(l,y);A.length==0&&C(d,1,h.direction,A);for(const[F,B]of A.entries()){if(!tt(B,Z))continue;const X=v(h.direction,l,B,d);if(!M&&X)d=X;else if(!M)continue;const z=A.length-F;C(d,z,h.direction,A),u===ge?P(B,d):u===Nt&&$(B,d)}},v=(l,u,d,T)=>{const{before:h,distance:y,axis:A,getRect:M}=L(l),F=M(u),B=M(d),X=F[h],z=B[h],mt=B[y],St=z+mt/2,ft=Pe(d)[A],ct=St-ft;return X>ct?{height:0,width:0}:T},C=(l,u,d,T)=>{const h=T.filter(A=>tt(A,Z)).length,{distance:y}=L(d);l[y]==0?a=Math.max(a,u):a=Math.min(a,u-1),a=Math.min(a,h)},P=(l,u)=>{const{width:d,height:T}=u;Et(l,T,d)},$=(l,u)=>{const{width:d,height:T}=u;Et(l,T,d),Pt(l,S,pe)},G=(l,u,d,T,h,y)=>{const{droppable:A,scroll:M,config:F}=h,[B,X]=wt(l,A),z=B.toReversed(),mt=X===-1?z.length:X;z.splice(mt,0,l);const[St,ft,ct]=H(l,X,z,A);d=Ct(l,u,F.direction,n,St,ft);const $t=Ne(),vt=Sn(F.direction,z,X,ct,$t,M,T,A,l);B.length==0&&W(void 0,d,l,vt);for(const[Gt,Dt]of B.toReversed().entries()){let Bt=d;ct-1>=Gt&&(Bt={height:0,width:0}),u===jt&&!tt(Dt,lt)&&W(Dt,Bt,l,vt)}I(ct,l,F,A,y)},H=(l,u,d,T)=>{const y=xt(l,T)?u:a,A=()=>u<y?[y,y+1]:u>y?[y-1,y]:[y-1,y+1],[M,F]=A(),B=d[M]??null,X=d[F]??null;return[B,X,y]},W=(l,u,d,T)=>{Et(l,u.height,u.width),Et(d,T.height,T.width)},I=(l,u,d,T,h)=>{const{onInsertEvent:y,onDragEnd:A}=d;k(u,_t),rt(u,n,T,()=>{if(At(u,_t),h!=null){const M=p(h,!0);M!=null&&(y(l,M,!0),A({value:M,index:l})),ot(u),Y()}})},Y=()=>{if(s){var l=document.querySelectorAll(`${pt(s)} > .${Z}`);for(const u of l)q(u)}},ot=l=>{setTimeout(()=>{At(l,x)},On)},rt=(l,u,d,T)=>{setTimeout(()=>{T&&T(),et(u,d),K(d),U(l),Q(l,u),Q(l,d)},S)},et=(l,u)=>{l.isSameNode(u)?bt(l,S):(bt(l,S,!0),bt(u,S))},K=l=>{if(n.isSameNode(l))return;var[u]=n.querySelectorAll(`.${lt}`);if(!u)return;const{distance:d}=L(c);st(u)&&(u.style[d]="0px")},Q=(l,u)=>{const[d]=wt(l,u);for(const T of[...d,l])q(T)},q=l=>{st(l)&&(l.style.transition="",l.style.transform="")},U=l=>{r(),nt(l,!1),l.style.transform="",l.style.transition="",l.style.top="",l.style.left="",de(l,{fixedHeight:"",fixedWidth:""})},it=(l,u)=>{const d=u.querySelector(f);gt(document.body,oe,l),gt(d||u,Wt,l)},nt=(l,u)=>{gt(l,Ft,u),it(u,l),o.toggleGrabClass(!u)};return[R,N,w,D,nt]}const Fn=e=>e.addedNodes.values().filter(n=>!qt(n)).toArray().length>0,ve=(e,t,n)=>{const{insertingFromClass:s,animationDuration:o}=n,r=kt(()=>{const c=ae(t)[e];k(c,s),k(c,Kt),setTimeout(()=>{At(c,Kt),At(c,s),r.disconnect()},o)},t,{childList:!0},Fn)},Pn=(e,t,n,s)=>{if(!t)return;const{onInsertEvent:o,delayBeforeInsert:r}=e;setTimeout(()=>{o(n,s),ve(n,t,e)},r)},j=class j{static addConfig(t,n){const s=j.configs.filter(r=>!r.droppable.isSameNode(t)),o=Ut(t);s.push({droppable:t,config:n,scroll:o}),j.configs=s}static updateScrolls(t,n){for(const s of j.configs){const{droppable:o}=s;(n&&Le(o,n)||o.isSameNode(t))&&(s.scroll=Ut(o))}}static getConfig(t){return j.configs.find(({droppable:s})=>s.isSameNode(t))}};V(j,"configs",[]),V(j,"removeObsoleteConfigs",()=>{const t=j.configs.filter(({droppable:n})=>document.contains(n));j.configs=t});let ut=j;class $n{constructor(t,n,s,o,r,a){V(this,"initial");V(this,"current");V(this,"parent");V(this,"draggableElement");V(this,"groupClass");V(this,"dragEvent");V(this,"changeDroppable");V(this,"mapFrom");this.parent=s,this.draggableElement=t,this.groupClass=n,this.dragEvent=o,this.mapFrom=a,this.initial=s?ut.getConfig(s):void 0,this.changeDroppable=r}getDraggableAncestor(t,n,s){return document.elementsFromPoint(t,n).filter(o=>!o.isSameNode(s))}getElementBelow(t,n,s=!0){const o=a=>{const[c]=a.getDraggableAncestor(n.clientX,n.clientY,t);return c};let r=null;return s?(t.hidden=!0,r=o(this),t.hidden=!1):r=o(this),r}getCurrent(t,n,s=!0){const o=this.getElementBelow(t,n,s);return!this.groupClass||!o?void 0:o.closest(pt(this.groupClass))}isOutsideOfAllDroppables(t){return(this.groupClass?Array.from(document.querySelectorAll(pt(this.groupClass))):[this.parent]).every(s=>xt(t,s))}isNotInsideAnotherDroppable(t,n){return!xt(t,n)||this.isOutsideOfAllDroppables(t)}onScrollEvent(){this.dragEvent()}setOnScroll(t){fe(t,"onscroll",()=>{this.onScrollEvent()})}getConfigFrom(t){const n=ut.getConfig(t);if(n)return t.isSameNode(this.parent)?n:{...n,config:Re(n,this.mapFrom)}}getCurrentConfig(t){var o;const n=this.draggableElement;if(this.current&&this.isNotInsideAnotherDroppable(n,(o=this.current)==null?void 0:o.droppable))return this.current;const s=this.getCurrent(n,t);return s?(st(s)&&!s.onscroll&&this.setOnScroll(s),this.getConfigFrom(s)):this.getConfigFrom(this.parent)}updateConfig(t){const n=this.current;this.current=this.getCurrentConfig(t),this.changeDroppable(this.current,n)}isOutside(t,n=!0){const s=this.draggableElement;return!this.getCurrent(s,t,n)}}function Gn(e,t,n,s,o){const{handlerSelector:r,isDraggable:a,droppableGroup:c,animationDuration:f,delayBeforeRemove:p,draggingClass:S,removingClass:m,onRemoveAtEvent:x,droppableClass:R,onDragStart:w,delayBeforeTouchMoveEvent:N,coordinateTransform:D}=n,E=Mt(c).map(i=>`droppable-group-${i}`).join(" ");let v=0,C={scrollX:0,scrollY:0},P={pageX:0,pageY:0},$,G;const[H,W]=sn(e,D),I=()=>{v=0},[Y,ot,rt,et,K]=Nn(n,t,s,E,o,I),Q=()=>{k(e,Z)},q=i=>{k(i,Lt),o.addSubscriber(i)},U=()=>{if(a(e)){const i=e.querySelector(r);q(i||e)}},it=()=>{U(),Q()},nt=i=>{const g=i==null?void 0:i.querySelector(`.${Lt}`),b=g==null?void 0:g.parentElement;return g&&b&&tt(b,Xt)&&!b.isSameNode(s)?null:g},l=i=>{const g=nt(i)??i;g&&a(i)&&(It(g,"onmousedown",ft("mousemove","mouseup")),It(g,"ontouchstart",ft("touchmove","touchend"),b=>{G={x:b.touches[0].clientX,y:b.touches[0].clientY}}),u(g)),i!=null&&i.isSameNode(g)||It(i,"onmousedown",ct),k(s,Xt)},u=i=>{const g=i.querySelectorAll("img");Array.from(g).forEach(b=>{b.onmousedown=()=>!1})},d=()=>{if(P.pageX==0&&P.pageY==0||!h.current)return;const{droppable:i,config:g}=h.current;H(e,i,P,g.direction),Y(e,Nt,C,h.current)},T=(i,g)=>{g&&v==2&&!(i!=null&&i.droppable.isSameNode(g.droppable))&&Y(e,Nt,C,g)},h=new $n(e,E,s,d,T,n.mapFrom),y=i=>{if(!h.current)return;const g=E?Array.from(document.querySelectorAll(pt(E))):[s];for(const b of g)b.classList.toggle(R,!i&&b.isSameNode(h.current.droppable))},A=(i,g=!1)=>{h.updateConfig(i);const b=h.isOutside(i);y(b),v===1&&!g?Dt(i):v===2&&(M(b),De(i))},M=(i=!0)=>{if(!h.current)return;const{droppable:g}=h.current;Ln(g,s,E,f,i),!i&&Yt(e,s,v==1,h.current)},F=i=>{if(yt(i)&&G&&v==1){const g=Math.abs(i.touches[0].clientX-G.x),b=Math.abs(i.touches[0].clientY-G.y);if(Math.abs(g)>5&&Math.abs(b)>5)return clearTimeout($),!1}return!0},B=i=>{clearTimeout($);const g=Vt(i);if(yt(i)&&i.cancelable&&v==2&&i.preventDefault(),yt(i)&&!i.cancelable||!F(i)){vt("touchmove",i);return}A(g,yt(i))},X=(i,g)=>{i=="touchmove"?$=setTimeout(()=>{g()},N):g()},z=(i,g)=>{const{clientX:b,clientY:dt}=i,at=document.elementFromPoint(b,dt),Tt=at==null?void 0:at.closest(`.${Z}`);return Tt&&g.isSameNode(Tt)},mt=i=>{const g=n.onGetValue(t);return{index:t,element:i,value:g}},St=i=>{h.updateConfig(i),y(h.isOutside(i)),Dt(i)},ft=(i,g)=>b=>{if(!z(b,e))return;ut.updateScrolls(s,E);const{scrollX:dt,scrollY:at}=window;if(C={scrollX:dt,scrollY:at},v===0){v=1;const Tt=mt(e);Tt&&w(Tt),X(i,()=>{i=="touchmove"&&St(b)}),document.addEventListener(i,B,{passive:!1}),Te(s),document.addEventListener(g,$t(i),{once:!0})}},ct=i=>h.updateConfig(i),$t=i=>g=>{vt(i,g)},vt=(i,g)=>{y(!0);const b=Vt(g);ye(h.isOutside(b,!1)),clearTimeout($),document.removeEventListener(i,B),h.updateConfig(b);const dt=h.getCurrentConfig(b);if(dt){const{droppable:at}=dt;Gt(at)}s.onscroll=null,I()},Gt=i=>{if(i.onscroll=null,!E)return;const g=Array.from(document.querySelectorAll(pt(E)));for(const b of g)st(b)&&(b.onscroll=null)},Dt=i=>{Yt(e,s,v==1,h.current),Bt(),Y(e,ge,C,h.current),Ee(e),W(i,e)},Bt=()=>{v=2},De=i=>{const{pageX:g,pageY:b}=i;P={pageX:g,pageY:b},d()},Te=i=>fe(i,"onscroll",be),be=()=>d(),ye=i=>{if(v!==2&&v!==1){I();return}v=3,Jt(e),e.classList.contains(Ft)&&Y(e,jt,C,i?h.initial:h.current,t)},Jt=i=>{Pt(i,f,pe),Et(i,0,0)},Ee=i=>{const{height:g,width:b}=i.getBoundingClientRect();de(i,{fixedHeight:`${g}px`,fixedWidth:`${b}px`}),K(i,!0),gt(i,S,!0),i.style.transition=""},Ce=(i,g)=>{At(e,m),Yt(e,s,v==1,h.initial),ot(i,e,g,b=>{Jt(b),et(e)}),x(t,!0)},Ae=i=>{if(!h.initial)return;const g=h.initial;i==t&&(k(e,m),setTimeout(()=>{Ce(i,g)},p))},xe=(i,g)=>{(i===t||i===n.onGetLegth()&&t===i-1)&&rt(i,e,s,g,()=>{wn(e,v==1,h.initial)})};return it(),l(e),[Ae,xe]}const In=(e,t)=>{e&&Oe(t,e)},Yn=()=>{Ke(document.body,[`.${Z}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Lt}{pointer-events:auto!important;}`,`.${re}{cursor:grab;}`,".temp-child{touch-action:none;pointer-events:none;box-sizing:border-box!important;}",".droppable{box-sizing:border-box!important;}",`.${Ft}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,`.${Wt}{pointer-events:none!important;}`,`.${_t}{pointer-events:none!important;}`,`.${oe}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"])};function Xn(e,t,n,s="index"){const o=s;let r=[],a=[];const{droppableGroup:c}=e;if(!n)return[r,a];const f=Mt(c).map(p=>`droppable-group-${p}`).join(" ");Yn(),In(f,n);for(const p of n.children){const S=p.getAttribute(o),m=Fe(S),x=p;if(x&&m>=0){const[R,w]=Gn(x,m,e,n,t);r.push(R),a.push(w)}}return[r,a]}function Wn(e,t,n,s="index"){let o=[],r=[],a;const c=we(e,n),f=D=>{for(const E of o)E(D)},p=(D,E)=>{if(c.onGetLegth()===0)e.insertToListEmpty(c,D,E);else for(const C of r)C(D,E)},S=D=>{const[E,v]=Xn(c,t,D,s);o=E,r=v},m=D=>{const E=D.addedNodes.values().filter(C=>!qt(C)).toArray(),v=D.removedNodes.values().filter(C=>!qt(C)).toArray();return E.length>0||v.length>0},x=D=>{a=kt(()=>{S(D)},D,{childList:!0},m)},R=D=>{k(D,Xt)},w=D=>{ut.addConfig(D,c)};return[f,p,D=>{if(D)return R(D),w(D),x(D),S(D),ut.removeObsoleteConfigs(),a}]}exports.GRAB_CLASS=re;exports.addClass=k;exports.dragAndDrop=Wn;exports.insertToListEmpty=Pn;exports.toggleClass=gt;
|