fluid-dnd 2.2.0 → 2.3.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.
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-DxKyk1TO.cjs");class h{constructor(){a(this,"handlers");this.handlers=[]}addSubscriber(s){this.handlers.includes(s)||(this.handlers.push(s),r.addClass(s,r.GRAB_CLASS))}toggleGrabClass(s){for(const l of this.handlers)r.toggleClass(l,r.GRAB_CLASS,s)}}exports.HandlerPublisher=h;
1
+ "use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-BYT3HBbe.cjs");class h{constructor(){a(this,"handlers");this.handlers=[]}addSubscriber(s){this.handlers.includes(s)||(this.handlers.push(s),r.addClass(s,r.GRAB_CLASS))}toggleGrabClass(s){for(const l of this.handlers)r.toggleClass(l,r.GRAB_CLASS,s)}}exports.HandlerPublisher=h;
@@ -1,7 +1,7 @@
1
1
  var d = Object.defineProperty;
2
2
  var e = (a, s, l) => s in a ? d(a, s, { enumerable: !0, configurable: !0, writable: !0, value: l }) : a[s] = l;
3
3
  var r = (a, s, l) => e(a, typeof s != "symbol" ? s + "" : s, l);
4
- import { a as h, t as n, G as t } from "./index-Dc95WWpv.js";
4
+ import { a as h, t as n, G as t } from "./index-m7C-XuaH.js";
5
5
  class c {
6
6
  constructor() {
7
7
  r(this, "handlers");
@@ -1,5 +1,5 @@
1
- import { Direction } from "..";
2
- import { BeforeMargin, AfterMargin, BorderWidth, PaddingBefore, Before } from "../../../index";
1
+ import { Direction } from '..';
2
+ import { BeforeMargin, AfterMargin, BorderWidth, PaddingBefore, Before } from '../../../index';
3
3
  export declare const getWindowScroll: () => {
4
4
  scrollX: number;
5
5
  scrollY: number;
@@ -11,7 +11,7 @@ export declare const getTransform: (element: Element) => {
11
11
  y: number;
12
12
  };
13
13
  export declare const draggableIsOutside: (draggable: Element, droppable: Element) => boolean;
14
- export declare const hasIntersection: (element1: Element, element2: Element) => boolean;
14
+ export declare const draggableIsCompleteOutside: (draggable: Element, droppable: Element) => boolean;
15
15
  export declare const getValueFromProperty: (element: HTMLElement | Element | undefined | null, property: PaddingBefore | BorderWidth | BeforeMargin | AfterMargin | Before) => number;
16
16
  export declare const getScrollElement: (element: HTMLElement) => {
17
17
  scrollLeft: number;
@@ -1,12 +1,12 @@
1
- import { HORIZONTAL, VERTICAL } from "..";
2
- import { DRAGGABLE_CLASS } from "./classes";
3
- import { containClass } from "./dom/classList";
1
+ import { HORIZONTAL, VERTICAL } from '..';
2
+ import { DRAGGABLE_CLASS } from './classes';
3
+ import { containClass } from './dom/classList';
4
4
  export const getWindowScroll = () => {
5
5
  const { scrollX, scrollY } = window;
6
6
  return { scrollX, scrollY };
7
7
  };
8
8
  export const parseFloatEmpty = (value) => {
9
- if (!value || value.trim().length == 0 || value == "normal") {
9
+ if (!value || value.trim().length == 0 || value == 'normal') {
10
10
  return 0;
11
11
  }
12
12
  return parseFloat(value);
@@ -22,7 +22,7 @@ export const getTransform = (element) => {
22
22
  const matrix = new DOMMatrixReadOnly(style.transform);
23
23
  return {
24
24
  x: matrix.m41,
25
- y: matrix.m42,
25
+ y: matrix.m42
26
26
  };
27
27
  };
28
28
  const intersection = (firstInterval, secondInterval) => {
@@ -40,22 +40,38 @@ const intersection = (firstInterval, secondInterval) => {
40
40
  export const draggableIsOutside = (draggable, droppable) => {
41
41
  return !hasIntersection(draggable, droppable);
42
42
  };
43
- export const hasIntersection = (element1, element2) => {
43
+ const hasIntersection = (element1, element2) => {
44
+ const { intersectionX, intersectionY, rect1, rect2 } = getIntersection(element1, element2);
45
+ return (intersectionY >= Math.min(rect1.height, rect2.height) / 2 &&
46
+ intersectionX >= Math.min(rect1.width, rect2.width) / 2);
47
+ };
48
+ export const draggableIsCompleteOutside = (draggable, droppable) => {
49
+ return !hasCompleteIntersection(draggable, droppable);
50
+ };
51
+ const hasCompleteIntersection = (element1, element2) => {
52
+ const { intersectionX, intersectionY } = getIntersection(element1, element2);
53
+ return intersectionY >= 0 && intersectionX >= 0;
54
+ };
55
+ const getIntersection = (element1, element2) => {
44
56
  const rect1 = getRect(element1);
45
57
  const rect2 = getRect(element2);
46
58
  const intersectionY = intersectionByDirection(rect1, rect2, VERTICAL);
47
59
  const intersectionX = intersectionByDirection(rect1, rect2, HORIZONTAL);
48
- return (intersectionY >= Math.min(rect1.height, rect2.height) / 2 &&
49
- intersectionX >= Math.min(rect1.width, rect2.width) / 2);
60
+ return {
61
+ rect1,
62
+ rect2,
63
+ intersectionX,
64
+ intersectionY
65
+ };
50
66
  };
51
67
  const intersectionByDirection = (rect1, rect2, direction) => {
52
68
  const { before, distance } = getPropByDirection(direction);
53
69
  return intersection({
54
70
  x1: rect1[before],
55
- x2: rect1[before] + rect1[distance],
71
+ x2: rect1[before] + rect1[distance]
56
72
  }, {
57
73
  x1: rect2[before],
58
- x2: rect2[before] + rect2[distance],
74
+ x2: rect2[before] + rect2[distance]
59
75
  });
60
76
  };
61
77
  export const getValueFromProperty = (element, property) => {
@@ -74,22 +90,22 @@ const getRect = (element) => {
74
90
  export const getPropByDirection = (direction) => {
75
91
  const ifHorizontal = direction == HORIZONTAL;
76
92
  return {
77
- beforeMargin: ifHorizontal ? "marginLeft" : "marginTop",
78
- afterMargin: ifHorizontal ? "marginRight" : "marginBottom",
79
- borderBeforeWidth: ifHorizontal ? "borderLeftWidth" : "borderTopWidth",
80
- before: ifHorizontal ? "left" : "top",
81
- after: ifHorizontal ? "right" : "down",
82
- gap: ifHorizontal ? "columnGap" : "rowGap",
83
- distance: ifHorizontal ? "width" : "height",
84
- axis: ifHorizontal ? "x" : "y",
85
- offset: ifHorizontal ? "offsetX" : "offsetY",
86
- scroll: ifHorizontal ? "scrollX" : "scrollY",
87
- scrollElement: ifHorizontal ? "scrollLeft" : "scrollTop",
88
- page: ifHorizontal ? "pageX" : "pageY",
89
- inner: ifHorizontal ? "innerWidth" : "innerHeight",
90
- offsetElement: ifHorizontal ? "offsetLeft" : "offsetTop",
91
- scrollDistance: ifHorizontal ? "scrollWidth" : "scrollHeight",
92
- clientDistance: ifHorizontal ? "clientWidth" : "clientHeight",
93
+ beforeMargin: ifHorizontal ? 'marginLeft' : 'marginTop',
94
+ afterMargin: ifHorizontal ? 'marginRight' : 'marginBottom',
95
+ borderBeforeWidth: ifHorizontal ? 'borderLeftWidth' : 'borderTopWidth',
96
+ before: ifHorizontal ? 'left' : 'top',
97
+ after: ifHorizontal ? 'right' : 'down',
98
+ gap: ifHorizontal ? 'columnGap' : 'rowGap',
99
+ distance: ifHorizontal ? 'width' : 'height',
100
+ axis: ifHorizontal ? 'x' : 'y',
101
+ offset: ifHorizontal ? 'offsetX' : 'offsetY',
102
+ scroll: ifHorizontal ? 'scrollX' : 'scrollY',
103
+ scrollElement: ifHorizontal ? 'scrollLeft' : 'scrollTop',
104
+ page: ifHorizontal ? 'pageX' : 'pageY',
105
+ inner: ifHorizontal ? 'innerWidth' : 'innerHeight',
106
+ offsetElement: ifHorizontal ? 'offsetLeft' : 'offsetTop',
107
+ scrollDistance: ifHorizontal ? 'scrollWidth' : 'scrollHeight',
108
+ clientDistance: ifHorizontal ? 'clientWidth' : 'clientHeight',
93
109
  paddingBefore: ifHorizontal ? 'paddingLeft' : 'paddingTop',
94
110
  getRect
95
111
  };
@@ -104,21 +120,15 @@ export const getGroupDroppables = (currentDroppable, droppableGroup) => {
104
120
  return Array.from(document.querySelectorAll(`.droppable-group-${droppableGroup}`));
105
121
  };
106
122
  export const getParentDraggableChildren = (parent) => {
107
- const siblings = [...parent.children]
108
- .filter((child) => containClass(child, DRAGGABLE_CLASS));
123
+ const siblings = [...parent.children].filter((child) => containClass(child, DRAGGABLE_CLASS));
109
124
  return siblings;
110
125
  };
111
126
  export const getSiblingsByParent = (current, parent) => {
112
127
  const siblings = [...parent.children]
113
- .filter((child) => containClass(child, DRAGGABLE_CLASS) &&
114
- !child.isEqualNode(current))
128
+ .filter((child) => containClass(child, DRAGGABLE_CLASS) && !child.isEqualNode(current))
115
129
  .toReversed();
116
130
  const positionOnDroppable = [...parent.children].findLastIndex((child) => child.isEqualNode(current));
117
- return [
118
- siblings,
119
- positionOnDroppable,
120
- parent,
121
- ];
131
+ return [siblings, positionOnDroppable, parent];
122
132
  };
123
133
  const getNearestFixedParent = (element) => {
124
134
  let parent = element.parentElement;
@@ -134,5 +144,7 @@ const getNearestFixedParent = (element) => {
134
144
  export const getNearestFixedParentPosition = (element, direction) => {
135
145
  const { before, borderBeforeWidth } = getPropByDirection(direction);
136
146
  const fixedParent = getNearestFixedParent(element);
137
- return fixedParent ? (getRect(fixedParent)[before] + getValueFromProperty(fixedParent, borderBeforeWidth)) : 0;
147
+ return fixedParent
148
+ ? getRect(fixedParent)[before] + getValueFromProperty(fixedParent, borderBeforeWidth)
149
+ : 0;
138
150
  };
@@ -1,12 +1,13 @@
1
- import { draggableIsOutside, getNearestFixedParentPosition, getPropByDirection, getValueFromProperty } from './GetStyles';
1
+ import { getNearestFixedParentPosition, getPropByDirection, getValueFromProperty } from './GetStyles';
2
2
  import { HORIZONTAL, VERTICAL } from '..';
3
- import { scrollByDirection } from './scroll';
3
+ import { useScroll } from './scroll';
4
4
  import { HANDLER_CLASS, DRAGGING_CLASS } from './classes';
5
5
  import { containClass } from './dom/classList';
6
6
  export const useTransform = (draggedElement, coordinateTransforms) => {
7
7
  let currentOffset = { offsetX: 0, offsetY: 0 };
8
8
  let position = { top: 0, left: 0 };
9
9
  let translate = { x: 0, y: 0 };
10
+ const [updateScrollByPosition] = useScroll(draggedElement);
10
11
  const updateTranform = (newTranslate) => {
11
12
  draggedElement.style.transform = `translate( ${newTranslate.x}px, ${newTranslate.y}px)`;
12
13
  };
@@ -41,31 +42,7 @@ export const useTransform = (draggedElement, coordinateTransforms) => {
41
42
  };
42
43
  const updateScroll = (translateDirection) => {
43
44
  if (element && containClass(element, DRAGGING_CLASS) && translateDirection === direction) {
44
- const { before, distance, axis, getRect } = getPropByDirection(direction);
45
- const distanceValue = getRect(element)[distance];
46
- const parentBoundingClientRect = getRect(parent);
47
- const positionInsideParent = position[before] - parentBoundingClientRect[before] + translate[axis];
48
- const parentDistance = parentBoundingClientRect[distance];
49
- const totalDistance = parentDistance - distanceValue;
50
- const relativePosition = positionInsideParent / totalDistance;
51
- const relativeDistanceValue = distanceValue / totalDistance;
52
- const velocity = 0.1;
53
- const infLimit = 0.2;
54
- const upperLimit = 0.8;
55
- let percent = 0;
56
- const isOutside = draggableIsOutside(element, parent);
57
- if (!isOutside &&
58
- relativePosition < infLimit &&
59
- relativePosition > -relativeDistanceValue) {
60
- percent = relativePosition / infLimit - 1;
61
- }
62
- else if (!isOutside &&
63
- relativePosition > upperLimit &&
64
- relativePosition < 1 + relativeDistanceValue) {
65
- percent = (1 / (1 - upperLimit)) * (relativePosition - upperLimit);
66
- }
67
- const scrollAmount = velocity * distanceValue * percent;
68
- scrollByDirection(parent, direction, scrollAmount);
45
+ updateScrollByPosition(direction, parent, position, translate);
69
46
  }
70
47
  };
71
48
  const updateTranlateByDirection = (direction) => {
@@ -1,4 +1,7 @@
1
- import { ElementScroll } from "index";
2
- import { Direction } from "..";
3
- export declare const scrollByDirection: (element: HTMLElement, direction: Direction, scrollAmount: number) => void;
1
+ import { ElementScroll } from 'index';
2
+ import { Coordinate, Direction } from '..';
4
3
  export declare const scrollPercent: (direction: Direction, droppable: HTMLElement, droppableScroll: ElementScroll) => number;
4
+ export declare const useScroll: (draggedElement: HTMLElement) => readonly [(direction: Direction, parent: HTMLElement, position: {
5
+ top: number;
6
+ left: number;
7
+ }, translate: Coordinate) => void];
@@ -1,9 +1,9 @@
1
- import { getPropByDirection } from "./GetStyles";
2
- export const scrollByDirection = (element, direction, scrollAmount) => {
1
+ import { draggableIsCompleteOutside, getPropByDirection } from './GetStyles';
2
+ const scrollByDirection = (element, direction, scrollAmount) => {
3
3
  if (scrollAmount == 0) {
4
4
  return;
5
5
  }
6
- if (direction === "vertical") {
6
+ if (direction === 'vertical') {
7
7
  element.scrollBy(0, scrollAmount);
8
8
  }
9
9
  else {
@@ -12,6 +12,44 @@ export const scrollByDirection = (element, direction, scrollAmount) => {
12
12
  };
13
13
  export const scrollPercent = (direction, droppable, droppableScroll) => {
14
14
  const { scrollDistance, clientDistance, scrollElement } = getPropByDirection(direction);
15
- return (droppableScroll[scrollElement] /
16
- (droppable[scrollDistance] - droppable[clientDistance]));
15
+ return droppableScroll[scrollElement] / (droppable[scrollDistance] - droppable[clientDistance]);
16
+ };
17
+ export const useScroll = (draggedElement) => {
18
+ let lastScrollAmount = 0.5;
19
+ const minScrollAmountDiff = 0.03;
20
+ const updateScrollByPosition = (direction, parent, position, translate) => {
21
+ const { before, distance, axis, getRect } = getPropByDirection(direction);
22
+ const distanceValue = getRect(draggedElement)[distance];
23
+ const parentBoundingClientRect = getRect(parent);
24
+ const positionInsideParent = position[before] - parentBoundingClientRect[before] + translate[axis];
25
+ const parentDistance = parentBoundingClientRect[distance];
26
+ const totalDistance = parentDistance - distanceValue;
27
+ const relativePosition = positionInsideParent / totalDistance;
28
+ const relativeDistanceValue = distanceValue / totalDistance;
29
+ const velocity = 0.25;
30
+ const infLimit = 0.2;
31
+ const upperLimit = 0.8;
32
+ let percent = 0;
33
+ const isOutside = draggableIsCompleteOutside(draggedElement, parent);
34
+ if (!isOutside && relativePosition < infLimit && relativePosition > -relativeDistanceValue) {
35
+ percent = scrollFuncionToStart(relativePosition < 0 ? 0 : relativePosition, infLimit);
36
+ }
37
+ else if (!isOutside &&
38
+ relativePosition > upperLimit &&
39
+ relativePosition < 1 + relativeDistanceValue) {
40
+ percent = scrollFuncionToEnd(relativePosition, upperLimit);
41
+ }
42
+ const scrollAmount = velocity * distanceValue * percent;
43
+ lastScrollAmount =
44
+ Math.sign(scrollAmount) *
45
+ Math.min(Math.abs(scrollAmount), Math.abs(lastScrollAmount) + minScrollAmountDiff);
46
+ scrollByDirection(parent, direction, lastScrollAmount);
47
+ };
48
+ const scrollFuncionToStart = (relativePosition, infLimit) => {
49
+ return Math.pow(relativePosition / infLimit, 1 / 3) - 1;
50
+ };
51
+ const scrollFuncionToEnd = (relativePosition, upperLimit) => {
52
+ return Math.pow((1 / (1 - upperLimit)) * (relativePosition - upperLimit), 3);
53
+ };
54
+ return [updateScrollByPosition];
17
55
  };
@@ -0,0 +1 @@
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;