fluid-dnd 1.3.0-beta.0 → 1.3.1-beta.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.
@@ -0,0 +1 @@
1
+ "use strict";var Ce=Object.defineProperty;var ye=(t,e,n)=>e in t?Ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Z=(t,e,n)=>ye(t,typeof e!="symbol"?e+"":e,n);const U="draggable",It="droppable",Ot="handler-class",qt="dragging",Xt="dragging-handler-class",Wt="dropping",oe="grabbing",re="grab",Kt="disable-transition",st=(t,e)=>t.classList.contains(e),gt=(t,e,n=!1)=>{t.classList.toggle(e,n)},tt=(t,e)=>{t.classList.add(e)},Ct=(t,e)=>{t.classList.remove(e)},Ae=(t,e)=>yt(e).every(n=>st(t,n)),pt=t=>t?`.${yt(t).join(".")}`:"",xe=(t,e)=>{if(!e)return;const n=yt(e);t.classList.add(...n)},yt=t=>t?t.split(" ").filter(e=>e):[],_="horizontal",et="vertical",Be=()=>{const{scrollX:t,scrollY:e}=window;return{scrollX:t,scrollY:e}},zt=t=>!t||t.trim().length==0||t=="normal"?0:parseFloat(t),we=t=>t?parseInt(t):-1,Re=t=>{const e=getComputedStyle(t),n=new DOMMatrixReadOnly(e.transform);return{x:n.m41,y:n.m42}},ie=(t,e)=>t.x1>e.x1?ie(e,t):t.x2<e.x1?0:t.x2>=e.x2?t.x2-t.x1:t.x2-e.x1,ht=(t,e)=>!Le(t,e),Le=(t,e)=>{const n=Mt(t),s=Mt(e),o=Qt(n,s,et),r=Qt(n,s,_);return o>=Math.min(n.height,s.height)/2&&r>=Math.min(n.width,s.width)/2},Qt=(t,e,n)=>{const{before:s,distance:o}=w(n);return ie({x1:t[s],x2:t[s]+t[o]},{x1:e[s],x2:e[s]+e[o]})},O=(t,e)=>t?zt(getComputedStyle(t)[e]):0,Ut=t=>{const{scrollLeft:e,scrollTop:n}=t;return{scrollLeft:e,scrollTop:n}},Mt=t=>t.getBoundingClientRect(),w=t=>{const e=t==_;return{beforeMargin:e?"marginLeft":"marginTop",afterMargin:e?"marginRight":"marginBottom",borderBeforeWidth:e?"borderLeftWidth":"borderTopWidth",before:e?"left":"top",after:e?"right":"down",gap:e?"columnGap":"rowGap",distance:e?"width":"height",axis:e?"x":"y",offset:e?"offsetX":"offsetY",scroll:e?"scrollX":"scrollY",scrollElement:e?"scrollLeft":"scrollTop",page:e?"pageX":"pageY",inner:e?"innerWidth":"innerHeight",offsetElement:e?"offsetLeft":"offsetTop",scrollDistance:e?"scrollWidth":"scrollHeight",clientDistance:e?"clientWidth":"clientHeight",paddingBefore:e?"paddingLeft":"paddingTop",getRect:Mt}},wt=(t,e)=>Oe(t,e),ce=t=>[...t.children].filter(n=>st(n,U)),Oe=(t,e)=>{const n=[...e.children].filter(o=>st(o,U)&&!o.isEqualNode(t)).toReversed(),s=[...e.children].findLastIndex(o=>o.isEqualNode(t));return[n,s,e]},Me=t=>{let e=t.parentElement;for(;e;){if(window.getComputedStyle(e).position==="fixed")return e;e=e.parentElement}return null},ae=(t,e)=>{const{before:n,borderBeforeWidth:s}=w(e),o=Me(t);return o?Mt(o)[n]+O(o,s):0},Lt=t=>window.TouchEvent&&t instanceof TouchEvent,rt=t=>t instanceof HTMLElement,le=t=>t instanceof MouseEvent,Ne=["onmouseup","onmousedown","onmousemove"],Fe=(t,e,n)=>{t&&(t.style.height=`${e}px`,t.style.width=`${n}px`)},Tt=(t,e,n)=>{!t||!rt(t)||(n==0&&e==0?t.style.transform="":t.style.transform=`translate(${n}px,${e}px)`)},Pe=(t,e,n,s)=>{t[e]=o=>{if(o.defaultPrevented)return;s&&s(o);const r=_t(o);n(r)}},Gt=(t,e,n,s)=>{n&&($e(e)?t[e]=n:Pe(t,e,n,s))},$e=t=>Ne.includes(t),Ge=t=>{const{target:e}=t;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:e,offsetX:0,offsetY:0}},Ye=(t,e)=>{const n=(s,o)=>Xe(e,window,o,s);if(le(t)){const{offsetX:s,offsetY:o}=t;return[s,o]}else{const s=t.target;return[n(s,_),n(s,et)]}},_t=t=>{const e=Ie(t);if(!e)return Ge(t);const[n,s]=Ye(t,e),{clientX:o,clientY:r,pageX:c,pageY:a,screenX:f,screenY:g,target:m}=e;return{clientX:o,clientY:r,pageX:c,pageY:a,screenX:f,screenY:g,target:m,offsetX:n,offsetY:s}},Ie=t=>{if(Lt(t))return t.touches[0]??t.changedTouches[0];if(le(t))return t},Xe=(t,e,n,s)=>{const{page:o,scroll:r,before:c,borderBeforeWidth:a,getRect:f}=w(n),g=f(s);return t[o]-e[r]-g[c]-O(s,a)},Ft=(t,e,n="ease-out",s="transform")=>{rt(t)&&(t.style.transitionDuration=`${e}ms`,t.style.transitionTimingFunction=`${n}`,t.style.transitionProperty=`${s}`)},ue=(t,e,n)=>{!t||!rt(t)||(t[e]=()=>{n()})},We=t=>{var e=t.querySelector("style");if(!e){var n=document.createElement("style");return t.appendChild(n),n}return e},_e=(t,e)=>{const n=/\.-?[_a-zA-Z0-9-*\s<>():]+/g,[s]=e.match(n)||[];for(const o of t.cssRules){const[r]=o.cssText.match(n)||[];if(s===r)return!0}return!1},Ve=(t,e)=>{e.forEach(n=>{He(t,n)})},He=(t,e)=>{var s;var n=We(t);n.sheet&&(_e(n.sheet,e)||(s=n.sheet)==null||s.insertRule(e,n.sheet.cssRules.length))},fe=(t,e={})=>{for(const n of Object.keys(e)){const s=e[n];s!=null&&qe(t,`--${n}`,s)}},qe=(t,e,n)=>t&&t.style.setProperty(e,n),de="startDrag",Nt="drag",jt="startDrop",ze="drop",lt="temp-child",ge="cubic-bezier(0.2, 0, 0, 1)",je=t=>t===ze||t===jt,Vt=t=>!t||t.length==0?0:zt(t.replace("px","")),Ze=(t,e)=>{const n=getComputedStyle(t)[e];if(n.match("%")){const o=zt(n.replace("%","")),{width:r}=t.getBoundingClientRect();return r*(o/100)}return Vt(n)},Zt=(t,e)=>{if(!(t instanceof Element))return[0,!1];const n=Ze(t,e),s=getComputedStyle(t).display,o=n>0||s==="flex";return[n,o]},ke=t=>{const{top:e,left:n}=getComputedStyle(t);return[Vt(e),Vt(n)]},Je=(t,e)=>{const{gap:n}=w(e),[s,o]=Zt(t,n);return o?s:0};function Et(t,e,n,s,o=t.previousElementSibling,r=t.nextElementSibling){let{height:c,width:a}=Ke(n,t,o,r);return ht(t,s)&&e==Nt&&(c=0,a=0),{height:c,width:a}}const Ke=(t,e,n,s)=>{const{afterMargin:o,beforeMargin:r,distance:c,gap:a,getRect:f}=w(t),g=O(e,o),m=O(e,r),v=O(s,r),[R,M]=Zt(e.parentElement,a),F=f(e)[c];if(M)return te(F,m,g,R,0,t);const[C,p,b]=Qe(n,v,g,m,o);return te(F,p,C,0,b,t)},Qe=(t,e,n,s,o)=>{const r=Math.max(e,n);let c=s,a=e;if(t){const f=O(t,o);c=Math.max(f,s),a=Math.max(a,f)}return[r,c,a]},te=(t,e,n,s,o,r)=>Ue(r,t+e+n+s-o),Ue=(t,e)=>t==_?{width:e,height:0}:{width:0,height:e},ee=(t,e)=>{const{borderBeforeWidth:n,paddingBefore:s,axis:o,getRect:r}=w(t),c=O(e,n),a=O(e,s),f=r(e)[o];return c+a+f},tn=(t,e)=>{const[n,s]=ke(e),o=ee(et,t);return[ee(_,t)-s,o-n]};function en(t,e,n,s,o,r,c,a,f){let g=0,m=0;const v=!!(n<0&&f);if(n===s&&!v)return ne({height:g,width:m},t,o,c,v);const[R,M,F,C]=on(e,n,s,f);if(v){const[nt,ft]=tn(a,f);g+=ft,m+=nt}const{scrollElement:p,beforeMargin:b,afterMargin:L,distance:B,gap:$}=w(t),[X,k]=Zt(a,$),[V,H,P]=cn(b,L,R,M==null?void 0:M.previousElementSibling,C,k,v),[J,q,K]=rn(b,L,B,F,X,k),G=sn(q,J,K,H,V,X),z=v?a[p]:nn(p,a,r),Y=(C?G-P:P-G)-z;return t===et?g+=Y:t===_&&(m+=Y),ne({height:g,width:m},t,o,c,v)}const nn=(t,e,n)=>{const s=e[t],o=n[t];return s-o},sn=(t,e,n,s,o,r)=>{const c=Math.max(e,o);return Math.max(n,s)+t+c+r},on=(t,e,n,s)=>{const o=e<n,[r,c]=[e,n].toSorted((m,v)=>m-v),a=t[e]??s,f=t[n];let g=o?t.slice(r+1,c+1):t.slice(r,c);return r<0&&s&&(g=t.slice(r+1,c)),[a,f,g,o]},rn=(t,e,n,s,o,r)=>{if(s.length==0)return[0,0,0];const c=O(s[0],t);let a=0,f=-c;for(const[g,m]of s.entries()){const v=m.getBoundingClientRect()[n],R=O(m,t);r&&(a+=R),r&&g>0?a+=o:a=Math.max(a,R),f+=a+v,a=O(m,e)}return[c,f,a]},ne=(t,e,n,s,o)=>{const{scroll:r,distance:c}=w(e),a=window[r],f=n[r],g=o?0:f-2*a+s[r];return t[c]+=g,t},cn=(t,e,n,s,o,r,c)=>{const a=o?n.previousElementSibling:s;return an(t,e,a,n,r,c)},an=(t,e,n,s,o,r)=>{if(o)return[0,0,0];const c=O(r?null:n,e),a=O(s,t);let f=Math.max(c,a);return[c,a,f]},kt=(t,e,n,s=()=>!0)=>{const o=new MutationObserver(r=>{if(r=r.filter(s),r.length>0){const c=r[0];t(o,c)}});return o.observe(e,n),o},ln=(t,e,n)=>{n!=0&&(e==="vertical"?t.scrollBy(0,n):t.scrollBy(n,0))},un=(t,e,n)=>{const{scrollDistance:s,clientDistance:o,scrollElement:r}=w(t);return n[r]/(e[s]-e[o])},fn="startDrag",pe="cubic-bezier(0.2, 0, 0, 1)",he=50,Ht=t=>rt(t)?t.classList.contains(lt):!1,dn=(t,e,n)=>{let s=Et(e,fn,n,t);const o=Je(t,n),{distance:r}=w(n);s[r]-=o;const[c,a]=gn(n,e);return s[a]=c,s},gn=(t,e)=>{const n=t==_?et:_,{distance:s,getRect:o}=w(n);return[o(e)[s],s]},mt=(t,e,n)=>{Fe(t,e,n),t.style.minWidth=`${n}px`},pn=(t,e,n)=>s=>{e.contains(t)&&(mt(t,n.height,n.width),s.disconnect())},hn=(t,e)=>{if(!e)return;const{droppable:n,config:s,scroll:o}=t,{direction:r}=s,c=un(s.direction,n,o)>.99,{scrollDistance:a,clientDistance:f,scrollElement:g}=w(r);c&&(n[g]=n[a]-n[f])},me=(t,e,n,s)=>{if(!n)return;const{droppable:o,config:r}=n,{direction:c,animationDuration:a}=r;if(hn(n,e),o.querySelector(`.${lt}`)||!t)return;var f=t.tagName=="LI"?"DIV":t.tagName,g=document.createElement(f);tt(g,lt),mt(g,0,0);const m=dn(o,t,c);return Ft(g,a,pe,"width, min-width, height"),[g,m,o]},Yt=(t,e,n,s,o)=>{const r=me(t,n,s);if(!r)return;const[c,a,f]=r;e.isSameNode(f)&&mt(c,a.height,a.width),kt(pn(c,f,a),f,{childList:!0,subtree:!0}),f.appendChild(c)},mn=(t,e,n)=>{const s=me(t,e,n);if(!s)return;const[o,r,c]=s;c.appendChild(o),Sn(o,r)},Sn=(t,e)=>requestAnimationFrame(()=>{mt(t,e.height,e.width),requestAnimationFrame(()=>{Ft(t,0,pe,"width, min-width, height")})}),Dn=(t,e,n,s,o=!0)=>{if(n){var r=document.querySelectorAll(`${pt(n)} > .${lt}`);r.forEach(c=>{const a=c.parentElement;if(a!=null&&a.isSameNode(e)||!o&&(a!=null&&a.isSameNode(t)))return;mt(c,0,0),setTimeout(()=>{var g;(g=c.parentNode)==null||g.removeChild(c)},s+he)})}},bt=(t,e,n=!1)=>{var s=t.querySelectorAll(`.${lt}`);s.forEach(o=>{const r=o;n?(mt(r,0,0),setTimeout(()=>{t.contains(r)&&t.removeChild(r)},e+he)):t.removeChild(o)})},vn=50;function bn(t,e,n,s,o,r){let c=e;const{direction:a,handlerSelector:f,onRemoveAtEvent:g,animationDuration:m,delayBeforeInsert:v,draggingClass:R}=t,M=(u,l,h,S,y)=>{if(!S)return;const{droppable:T,config:E}=S,A=Et(u,l,E.direction,T);je(l)?k(u,l,A,h,S,y):b(u,l,A,S)},F=(u,l,h,S,y)=>{const T=Et(l,"insert",t.direction,h),{onInsertEvent:E}=t,A=ce(h);for(const[N,x]of A.entries())st(x,U)&&N>=u&&X(x,T);y(),setTimeout(()=>{E(u,S),Se(u,h,t),nt(l),W(l,n),bt(n,0,!0)},v)},C=(u,l,h,S)=>{if(!h||!h.droppable||!h.config)return;const{droppable:y,config:T}=h;let[E]=wt(l,y);E=[l,...E].toReversed();const A=Et(l,"remove",T.direction,y);for(const[N,x]of E.entries())N>=u&&($(x,A),setTimeout(()=>{S(x)},m))},p=u=>{bt(n,m,!0),setTimeout(()=>{nt(u),W(u,n)},m)},b=(u,l,h,S)=>{const{config:y,droppable:T}=S,[E]=wt(u,T),A=ht(u,T);E.length==0&&B(h,1,y.direction,E);for(const[N,x]of E.entries()){if(!st(x,U))continue;const I=L(y.direction,u,x,h);if(!A&&I)h=I;else if(!A)continue;const j=E.length-N;B(h,j,y.direction,E),l===de?$(x,h):l===Nt&&X(x,h)}},L=(u,l,h,S)=>{const{before:y,distance:T,axis:E,getRect:A}=w(u),N=A(l),x=A(h),I=N[y],j=x[y],St=x[T],Dt=j+St/2,it=Re(h)[E],ct=Dt-it;return I>ct?{height:0,width:0}:S},B=(u,l,h,S)=>{const y=S.filter(E=>st(E,U)).length,{distance:T}=w(h);u[T]==0?c=Math.max(c,l):c=Math.min(c,l-1),c=Math.min(c,y)},$=(u,l)=>{const{width:h,height:S}=l;Tt(u,S,h)},X=(u,l)=>{const{width:h,height:S}=l;Tt(u,S,h),Ft(u,m,ge)},k=(u,l,h,S,y,T)=>{const{droppable:E,scroll:A,config:N}=y,[x,I]=wt(u,E),j=x.toReversed(),St=I===-1?j.length:I;j.splice(St,0,u);const[Dt,it,ct]=V(u,I,j,E);h=Et(u,l,N.direction,n,Dt,it);const Pt=Be(),At=en(N.direction,j,I,ct,Pt,A,S,E,u);x.length==0&&H(void 0,h,u,At);for(const[$t,xt]of x.toReversed().entries()){let Bt=h;ct-1>=$t&&(Bt={height:0,width:0}),l===jt&&!st(xt,lt)&&H(xt,Bt,u,At)}P(ct,u,N,E,T)},V=(u,l,h,S)=>{const T=ht(u,S)?l:c,E=()=>l<T?[T,T+1]:l>T?[T-1,T]:[T-1,T+1],[A,N]=E(),x=h[A]??null,I=h[N]??null;return[x,I,T]},H=(u,l,h,S)=>{Tt(u,l.height,l.width),Tt(h,S.height,S.width)},P=(u,l,h,S,y)=>{const{onInsertEvent:T,onDragEnd:E}=h;tt(l,Wt),K(l,n,S,()=>{if(Ct(l,Wt),y!=null){const A=g(y,!0);A!=null&&(T(u,A,!0),E({value:A,index:u})),q(l),J()}})},J=()=>{if(s){var u=document.querySelectorAll(`${pt(s)} > .${U}`);for(const l of u)Y(l)}},q=u=>{setTimeout(()=>{Ct(u,R)},vn)},K=(u,l,h,S)=>{setTimeout(()=>{S&&S(),G(l,h),z(h),nt(u),W(u,l),W(u,h)},m)},G=(u,l)=>{u.isSameNode(l)?bt(u,m):(bt(u,m,!0),bt(l,m))},z=u=>{if(n.isSameNode(u))return;var[l]=n.querySelectorAll(`.${lt}`);if(!l)return;const{distance:h}=w(a);rt(l)&&(l.style[h]="0px")},W=(u,l)=>{const[h]=wt(u,l);for(const S of[...h,u])Y(S)},Y=u=>{rt(u)&&(u.style.transition="",u.style.transform="")},nt=u=>{r(),ot(u,!1),u.style.transform="",u.style.transition="",u.style.top="",u.style.left="",fe(u,{fixedHeight:"",fixedWidth:""})},ft=(u,l)=>{const h=l.querySelector(f);gt(document.body,oe,u),gt(h||l,Xt,u)},ot=(u,l)=>{gt(u,qt,l),ft(l,u),o.toggleGrabClass(!l)};return[M,C,F,p,ot]}const Tn=t=>t.addedNodes.values().filter(n=>!Ht(n)).toArray().length>0,Se=(t,e,n)=>{const{insertingFromClass:s,animationDuration:o}=n,r=kt(()=>{const a=ce(e)[t];tt(a,s),tt(a,Kt),setTimeout(()=>{Ct(a,Kt),Ct(a,s),r.disconnect()},o)},e,{childList:!0},Tn)},En=(t,e,n,s)=>{if(!e)return;const{onInsertEvent:o,delayBeforeInsert:r}=t;setTimeout(()=>{o(n,s),Se(n,e,t)},r)},Cn=(t,e)=>{const n=(a,f)=>t.removeAtEvent(a,f),s=(a,f,g)=>t.insertEvent(a,f,g),o=()=>t.getLength(),r=a=>t.getValue(a),c=a=>a;return{direction:(e==null?void 0:e.direction)??et,handlerSelector:(e==null?void 0:e.handlerSelector)??U,draggingClass:(e==null?void 0:e.draggingClass)??"dragging",droppableClass:(e==null?void 0:e.droppableClass)??"droppable-hover",isDraggable:(e==null?void 0:e.isDraggable)??(()=>!0),onDragStart:(e==null?void 0:e.onDragStart)??(()=>{}),onDragEnd:(e==null?void 0:e.onDragEnd)??(()=>{}),droppableGroup:e==null?void 0:e.droppableGroup,onRemoveAtEvent:n,onInsertEvent:s,onGetLegth:o,onGetValue:r,animationDuration:(e==null?void 0:e.animationDuration)??200,removingClass:(e==null?void 0:e.removingClass)??"removing",insertingFromClass:(e==null?void 0:e.insertingFromClass)??"from-inserting",delayBeforeRemove:(e==null?void 0:e.delayBeforeRemove)??200,delayBeforeInsert:(e==null?void 0:e.delayBeforeInsert)??200,mapFrom:(e==null?void 0:e.mapFrom)??c}},yn=(t,e)=>{const{config:n,droppable:s}=t,{onInsertEvent:o,onDragEnd:r}=n;return{...n,onDragEnd:f=>{const{index:g,value:m}=f;r({index:g,value:e(m,s)})},onInsertEvent:(f,g)=>o(f,e(g,s),!0)}},An=t=>{let e={offsetX:0,offsetY:0},n={top:0,left:0},s={x:0,y:0};const o=f=>{t.style.transform=`translate( ${f.x}px, ${f.y}px)`},r=f=>{t.style.top=`${f.top}px`,t.style.left=`${f.left}px`};return[(f,g,m,v)=>{const R=C=>{const{beforeMargin:p,borderBeforeWidth:b,before:L,offset:B,scroll:$,page:X,inner:k,distance:V,axis:H,getRect:P}=w(C),J=m[X],q=window[$],K=window[k],G=P(f)[V],z=O(f,b),W=O(f,p),Y=J-e[B],nt=ae(f,C);if(Y>=q-G/2&&Y<=q+K){const ot=Y-n[L]-z-W-q-nt;return M(C),ot}return s[H]},M=C=>{if(f&&st(f,qt)&&C===v){const{before:p,distance:b,axis:L,getRect:B}=w(v),$=B(f)[b],X=B(g),k=n[p]-X[p]+s[L],H=X[b]-$,P=k/H,J=$/H,q=.1,K=.2,G=.8;let z=0;const W=ht(f,g);!W&&P<K&&P>-J?z=P/K-1:!W&&P>G&&P<1+J&&(z=1/(1-G)*(P-G));const Y=q*$*z;ln(g,v,Y)}},F=C=>{const{axis:p}=w(C);s[p]=R(C),o(s)};F(_),F(et)},(f,g)=>{const[m,v,R,M]=wn(f,g,t);n={top:m,left:v},r(n),e={offsetX:R,offsetY:M}}]},Rt=(t,e,n)=>{const{borderBeforeWidth:s,before:o,getRect:r}=w(t);return r(e)[o]-r(n)[o]-O(n,s)},xn=(t,e)=>{let{offsetX:n,offsetY:s,target:o}=t,r=Bn(o,e);const c=o;return c&&r&&!c.isSameNode(r)&&(n+=Rt(_,c,r),s+=Rt(et,c,r)),r&&e!=o&&(n+=Rt(_,r,e),s+=Rt(et,r,e)),[n,s]},Bn=(t,e)=>{const n=t==null?void 0:t.closest(`.${Ot}`);return n&&n.isSameNode(e)?t:n},se=(t,e,n,s)=>{const{offset:o,beforeMargin:r,page:c,borderBeforeWidth:a,scroll:f}=w(t),g=ae(n,t);return e[c]-s[o]-O(n,r)-O(n,a)-window[f]-g},wn=(t,e,n)=>{const[s,o]=xn(t,n);return[se(et,t,e,{offsetX:s,offsetY:o}),se(_,t,e,{offsetX:s,offsetY:o}),s,o]},Q=class Q{static addConfig(e,n){const s=Q.configs.filter(r=>!r.droppable.isSameNode(e)),o=Ut(e);s.push({droppable:e,config:n,scroll:o}),Q.configs=s}static updateScrolls(e,n){for(const s of Q.configs){const{droppable:o}=s;(n&&Ae(o,n)||o.isSameNode(e))&&(s.scroll=Ut(o))}}static getConfig(e){return Q.configs.find(({droppable:s})=>s.isSameNode(e))}};Z(Q,"configs",[]),Z(Q,"removeObsoleteConfigs",()=>{const e=Q.configs.filter(({droppable:n})=>document.contains(n));Q.configs=e});let ut=Q;class Rn{constructor(e,n,s,o,r,c){Z(this,"initial");Z(this,"current");Z(this,"parent");Z(this,"draggableElement");Z(this,"groupClass");Z(this,"dragEvent");Z(this,"changeDroppable");Z(this,"mapFrom");this.parent=s,this.draggableElement=e,this.groupClass=n,this.dragEvent=o,this.mapFrom=c,this.initial=s?ut.getConfig(s):void 0,this.changeDroppable=r}getDraggableAncestor(e,n,s){return document.elementsFromPoint(e,n).filter(o=>!o.isSameNode(s))}getElementBelow(e,n,s=!0){const o=c=>{const[a]=c.getDraggableAncestor(n.clientX,n.clientY,e);return a};let r=null;return s?(e.hidden=!0,r=o(this),e.hidden=!1):r=o(this),r}getCurrent(e,n,s=!0){const o=this.getElementBelow(e,n,s);return!this.groupClass||!o?void 0:o.closest(pt(this.groupClass))}isOutsideOfAllDroppables(e){return(this.groupClass?Array.from(document.querySelectorAll(pt(this.groupClass))):[this.parent]).every(s=>ht(e,s))}isNotInsideAnotherDroppable(e,n){return!ht(e,n)||this.isOutsideOfAllDroppables(e)}onScrollEvent(){this.dragEvent()}setOnScroll(e){ue(e,"onscroll",()=>{this.onScrollEvent()})}getConfigFrom(e){const n=ut.getConfig(e);if(n)return e.isSameNode(this.parent)?n:{...n,config:yn(n,this.mapFrom)}}getCurrentConfig(e){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,e);return s?(rt(s)&&!s.onscroll&&this.setOnScroll(s),this.getConfigFrom(s)):this.getConfigFrom(this.parent)}updateConfig(e){const n=this.current;this.current=this.getCurrentConfig(e),this.changeDroppable(this.current,n)}isOutside(e,n=!0){const s=this.draggableElement;return!this.getCurrent(s,e,n)}}function Ln(t,e,n,s,o){const{handlerSelector:r,isDraggable:c,droppableGroup:a,animationDuration:f,delayBeforeRemove:g,draggingClass:m,removingClass:v,onRemoveAtEvent:R,droppableClass:M,onDragStart:F}=n,C=yt(a).map(i=>`droppable-group-${i}`).join(" ");let p=0,b={scrollX:0,scrollY:0},L={pageX:0,pageY:0},B,$;const[X,k]=An(t),[V,H,P,J,q]=bn(n,e,s,C,o,()=>p=0),K=()=>{tt(t,U)},G=i=>{tt(i,Ot),o.addSubscriber(i)},z=()=>{if(c(t)){const i=t.querySelector(r);G(i||t)}},W=()=>{z(),K()},Y=i=>{const d=i==null?void 0:i.querySelector(`.${Ot}`),D=d==null?void 0:d.parentElement;return d&&D&&st(D,It)&&!D.isSameNode(s)?null:d},nt=i=>{const d=Y(i)??i;d&&c(i)&&(Gt(d,"onmousedown",j("mousemove","mouseup")),Gt(d,"ontouchstart",j("touchmove","touchend"),D=>{B=D.changedTouches[0].clientY}),ft(d)),i!=null&&i.isSameNode(d)||Gt(i,"onmousedown",St),tt(s,It)},ft=i=>{const d=i.querySelectorAll("img");Array.from(d).forEach(D=>{D.onmousedown=()=>!1})},ot=()=>{if(L.pageX==0&&L.pageY==0||!l.current)return;const{droppable:i,config:d}=l.current;X(t,i,L,d.direction),V(t,Nt,b,l.current)},u=(i,d)=>{d&&p==2&&!(i!=null&&i.droppable.isSameNode(d.droppable))&&V(t,Nt,b,d)},l=new Rn(t,C,s,ot,u,n.mapFrom),h=i=>{if(!l.current)return;const d=C?Array.from(document.querySelectorAll(pt(C))):[s];for(const D of d)D.classList.toggle(M,!i&&D.isSameNode(l.current.droppable))},S=i=>{l.updateConfig(i);const d=l.isOutside(i);h(d),p===1?Pt(i):p===2&&(y(d),$t(i))},y=(i=!0)=>{if(!l.current)return;const{droppable:d}=l.current;Dn(d,s,C,f,i),!i&&Yt(t,s,p==1,l.current)},T=i=>{const d=t.getBoundingClientRect();return i.clientX>=d.left&&i.clientX<=d.right&&i.clientY>=d.top&&i.clientY<=d.bottom},E=i=>{if(Lt(i)&&B&&p==1){const d=i.touches[0].clientY,D=d-B;if(B=d,Math.abs(D)>5)return it("touchmove",i),!0}return!1},A=i=>{const d=_t(i);if(Lt(i)&&i.cancelable&&i.preventDefault(),Lt(i)&&!i.cancelable||!T(d)||E(i)){it("touchmove",i);return}S(d)},N=(i,d)=>{i=="touchmove"?$=setTimeout(()=>{d()},200):d()},x=(i,d)=>{const{clientX:D,clientY:dt}=i,at=document.elementFromPoint(D,dt),vt=at==null?void 0:at.closest(`.${U}`);return vt&&d.isSameNode(vt)},I=i=>{const d=n.onGetValue(e);return{index:e,element:i,value:d}},j=(i,d)=>D=>{if(!x(D,t))return;ut.updateScrolls(s,C);const{scrollX:dt,scrollY:at}=window;if(b={scrollX:dt,scrollY:at},p===0){p=1;const vt=I(t);vt&&F(vt),N(i,()=>{document.addEventListener(i,A,{passive:!1})}),xt(s),document.addEventListener(d,Dt(i),{once:!0})}},St=i=>l.updateConfig(i),Dt=i=>d=>{it(i,d)},it=(i,d)=>{h(!0);const D=_t(d);clearTimeout($),De(l.isOutside(D,!1)),document.removeEventListener(i,A),l.updateConfig(D);const dt=l.getCurrentConfig(D);if(dt){const{droppable:at}=dt;ct(at)}s.onscroll=null},ct=i=>{if(i.onscroll=null,!C)return;const d=Array.from(document.querySelectorAll(pt(C)));for(const D of d)rt(D)&&(D.onscroll=null)},Pt=i=>{Yt(t,s,p==1,l.current),At(),V(t,de,b,l.current),ve(t),k(i,t)},At=()=>{p=2},$t=i=>{const{pageX:d,pageY:D}=i;L={pageX:d,pageY:D},ot()},xt=i=>ue(i,"onscroll",Bt),Bt=()=>ot(),De=i=>{if(p!==2){p=0;return}p=3,Jt(t),V(t,jt,b,i?l.initial:l.current,e)},Jt=i=>{Ft(i,f,ge),Tt(i,0,0)},ve=i=>{const{height:d,width:D}=i.getBoundingClientRect();fe(i,{fixedHeight:`${d}px`,fixedWidth:`${D}px`}),q(i,!0),gt(i,m,!0),i.style.transition=""},be=(i,d)=>{Ct(t,v),Yt(t,s,p==1,l.initial),H(i,t,d,D=>{Jt(D),J(t)}),R(e,!0)},Te=i=>{if(!l.initial)return;const d=l.initial;i==e&&(tt(t,v),setTimeout(()=>{be(i,d)},g))},Ee=(i,d)=>{(i===e||i===n.onGetLegth()&&e===i-1)&&P(i,t,s,d,()=>{mn(t,p==1,l.initial)})};return W(),nt(t),[Te,Ee]}const On=(t,e)=>{t&&xe(e,t)},Mn=()=>{Ve(document.body,[`.${U}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Ot}{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;}",`.${qt}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,`.${Xt}{pointer-events:none!important;}`,`.${Wt}{pointer-events:none!important;}`,`.${oe}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"])};function Nn(t,e,n,s="index"){const o=s;let r=[],c=[];const{droppableGroup:a}=t;if(!n)return[r,c];const f=yt(a).map(g=>`droppable-group-${g}`).join(" ");Mn(),On(f,n);for(const g of n.children){const m=g.getAttribute(o),v=we(m),R=g;if(R&&v>=0){const[M,F]=Ln(R,v,t,n,e);r.push(M),c.push(F)}}return[r,c]}function Fn(t,e,n,s="index",o=!0){let r=[],c=[];const a=Cn(t,n),f=p=>{for(const b of r)b(p)},g=(p,b)=>{if(a.onGetLegth()===0)t.insertToListEmpty(a,p,b);else for(const B of c)B(p,b)},m=p=>{const[b,L]=Nn(a,e,p,s);r=b,c=L},v=p=>{const b=p.addedNodes.values().filter(B=>!Ht(B)).toArray(),L=p.removedNodes.values().filter(B=>!Ht(B)).toArray();return b.length>0||L.length>0},R=p=>{kt(b=>{m(p),o||b.disconnect()},p,{childList:!0},v)},M=p=>{tt(p,It)},F=p=>{ut.addConfig(p,a)};return[f,g,p=>{p&&(M(p),F(p),R(p),m(p),ut.removeObsoleteConfigs())}]}exports.GRAB_CLASS=re;exports.addClass=tt;exports.dragAndDrop=Fn;exports.insertToListEmpty=En;exports.toggleClass=gt;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),y=require("../HandlerPublisher-rYH-wwka.cjs"),S=require("../index-D7zMRS0J.cjs"),h=require("react-dom");function A(a,l){const[e,n]=u.useState(a),i=u.useRef(e);u.useEffect(()=>{i.current=e},[e]);function f(t,r=!1){const s=i.current[t],c=()=>{n(o=>[...o.slice(0,t),...o.slice(t+1)])};return r?h.flushSync(c):c(),s}function d(t,r,s=!1){const c=()=>{n(o=>[...o.slice(0,t),r,...o.slice(t)])};s?h.flushSync(c):c()}function g(){return e.length}function m(t){return e[t]}function b(t,r,s){S.insertToListEmpty(t,l.current,r,s)}return[e,n,{removeAtEvent:f,insertEvent:d,getLength:g,getValue:m,insertToListEmpty:b}]}const D=new y.HandlerPublisher;function E(a,l){const e=u.useRef(null),[n,i,f]=A(a,e),[d,g,m]=S.dragAndDrop(f,D,l,"data-index",!1);return u.useEffect(()=>{m(e.current)}),[e,n,i,g,d]}exports.useDragAndDrop=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),y=require("../HandlerPublisher-CJjcAWlb.cjs"),S=require("../index-D1uENWRM.cjs"),h=require("react-dom");function A(a,l){const[e,n]=u.useState(a),i=u.useRef(e);u.useEffect(()=>{i.current=e},[e]);function f(t,r=!1){const s=i.current[t],c=()=>{n(o=>[...o.slice(0,t),...o.slice(t+1)])};return r?h.flushSync(c):c(),s}function d(t,r,s=!1){const c=()=>{n(o=>[...o.slice(0,t),r,...o.slice(t)])};s?h.flushSync(c):c()}function g(){return e.length}function m(t){return e[t]}function b(t,r,s){S.insertToListEmpty(t,l.current,r,s)}return[e,n,{removeAtEvent:f,insertEvent:d,getLength:g,getValue:m,insertToListEmpty:b}]}const D=new y.HandlerPublisher;function E(a,l){const e=u.useRef(null),[n,i,f]=A(a,e),[d,g,m]=S.dragAndDrop(f,D,l,"data-index",!1);return u.useEffect(()=>{m(e.current)}),[e,n,i,g,d]}exports.useDragAndDrop=E;
@@ -1,6 +1,6 @@
1
1
  import { useState as S, useRef as d, useEffect as h } from "react";
2
- import { H as A } from "../HandlerPublisher-D01uHwrp.js";
3
- import { i as C, d as L } from "../index-DFUAc_q_.js";
2
+ import { H as A } from "../HandlerPublisher-BK0HGzXk.js";
3
+ import { i as C, d as L } from "../index-Cm06gxy7.js";
4
4
  import { flushSync as p } from "react-dom";
5
5
  function b(a, u) {
6
6
  const [t, n] = S(a), c = d(t);
@@ -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-rYH-wwka.cjs"),o=require("../index-D7zMRS0J.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;
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-CJjcAWlb.cjs"),o=require("../index-D1uENWRM.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;
@@ -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-D01uHwrp.js";
5
- import { i as m, d as u } from "../index-DFUAc_q_.js";
4
+ import { H as c } from "../HandlerPublisher-BK0HGzXk.js";
5
+ import { i as m, d as u } from "../index-Cm06gxy7.js";
6
6
  class h {
7
7
  constructor(t) {
8
8
  r(this, "items");
@@ -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-rYH-wwka.cjs"),u=require("../index-D7zMRS0J.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;
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-CJjcAWlb.cjs"),u=require("../index-D1uENWRM.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;
@@ -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-D01uHwrp.js";
6
- import { i as p, d as v } from "../index-DFUAc_q_.js";
5
+ import { H as h } from "../HandlerPublisher-BK0HGzXk.js";
6
+ import { i as p, d as v } from "../index-Cm06gxy7.js";
7
7
  const g = (n, t) => {
8
8
  const e = n.value;
9
9
  if (e.length <= 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-dnd",
3
- "version": "1.3.0-beta.0",
3
+ "version": "1.3.1-beta.0",
4
4
  "description": "An agnostic drag and drop library to sort all kind of lists. With current support for vue, react and svelte",
5
5
  "type": "module",
6
6
  "homepage": "https://fluid-dnd.netlify.app",
@@ -1 +0,0 @@
1
- "use strict";var Te=Object.defineProperty;var Ee=(t,e,n)=>e in t?Te(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var k=(t,e,n)=>Ee(t,typeof e!="symbol"?e+"":e,n);const Q="draggable",It="droppable",Lt="handler-class",qt="dragging",Yt="dragging-handler-class",Xt="dropping",se="grabbing",oe="grab",Jt="disable-transition",nt=(t,e)=>t.classList.contains(e),gt=(t,e,n=!1)=>{t.classList.toggle(e,n)},U=(t,e)=>{t.classList.add(e)},yt=(t,e)=>{t.classList.remove(e)},Ce=(t,e)=>At(e).every(n=>nt(t,n)),pt=t=>t?`.${At(t).join(".")}`:"",ye=(t,e)=>{if(!e)return;const n=At(e);t.classList.add(...n)},At=t=>t?t.split(" ").filter(e=>e):[],V="horizontal",tt="vertical",Ae=()=>{const{scrollX:t,scrollY:e}=window;return{scrollX:t,scrollY:e}},zt=t=>!t||t.trim().length==0||t=="normal"?0:parseFloat(t),xe=t=>t?parseInt(t):-1,Be=t=>{const e=getComputedStyle(t),n=new DOMMatrixReadOnly(e.transform);return{x:n.m41,y:n.m42}},re=(t,e)=>t.x1>e.x1?re(e,t):t.x2<e.x1?0:t.x2>=e.x2?t.x2-t.x1:t.x2-e.x1,ht=(t,e)=>!we(t,e),we=(t,e)=>{const n=Ot(t),s=Ot(e),o=Kt(n,s,tt),r=Kt(n,s,V);return o>=Math.min(n.height,s.height)/2&&r>=Math.min(n.width,s.width)/2},Kt=(t,e,n)=>{const{before:s,distance:o}=B(n);return re({x1:t[s],x2:t[s]+t[o]},{x1:e[s],x2:e[s]+e[o]})},O=(t,e)=>t?zt(getComputedStyle(t)[e]):0,Qt=t=>{const{scrollLeft:e,scrollTop:n}=t;return{scrollLeft:e,scrollTop:n}},Ot=t=>t.getBoundingClientRect(),B=t=>{const e=t==V;return{beforeMargin:e?"marginLeft":"marginTop",afterMargin:e?"marginRight":"marginBottom",borderBeforeWidth:e?"borderLeftWidth":"borderTopWidth",before:e?"left":"top",after:e?"right":"down",gap:e?"columnGap":"rowGap",distance:e?"width":"height",axis:e?"x":"y",offset:e?"offsetX":"offsetY",scroll:e?"scrollX":"scrollY",scrollElement:e?"scrollLeft":"scrollTop",page:e?"pageX":"pageY",inner:e?"innerWidth":"innerHeight",offsetElement:e?"offsetLeft":"offsetTop",scrollDistance:e?"scrollWidth":"scrollHeight",clientDistance:e?"clientWidth":"clientHeight",paddingBefore:e?"paddingLeft":"paddingTop",getRect:Ot}},wt=(t,e)=>Re(t,e),ie=t=>[...t.children].filter(n=>nt(n,Q)),Re=(t,e)=>{const n=[...e.children].filter(o=>nt(o,Q)&&!o.isEqualNode(t)).toReversed(),s=[...e.children].findLastIndex(o=>o.isEqualNode(t));return[n,s,e]},Le=t=>{let e=t.parentElement;for(;e;){if(window.getComputedStyle(e).position==="fixed")return e;e=e.parentElement}return null},ce=(t,e)=>{const{before:n,borderBeforeWidth:s}=B(e),o=Le(t);return o?Ot(o)[n]+O(o,s):0},Wt=t=>window.TouchEvent&&t instanceof TouchEvent,rt=t=>t instanceof HTMLElement,ae=t=>t instanceof MouseEvent,Oe=["onmouseup","onmousedown","onmousemove"],Me=(t,e,n)=>{t&&(t.style.height=`${e}px`,t.style.width=`${n}px`)},Et=(t,e,n)=>{!t||!rt(t)||(n==0&&e==0?t.style.transform="":t.style.transform=`translate(${n}px,${e}px)`)},Ne=(t,e,n)=>{t[e]=s=>{if(s.defaultPrevented)return;const o=_t(s);n(o)}},$t=(t,e,n)=>{n&&(Fe(e)?t[e]=n:Ne(t,e,n))},Fe=t=>Oe.includes(t),Pe=t=>{const{target:e}=t;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:e,offsetX:0,offsetY:0}},$e=(t,e)=>{const n=(s,o)=>Ie(e,window,o,s);if(ae(t)){const{offsetX:s,offsetY:o}=t;return[s,o]}else{const s=t.target;return[n(s,V),n(s,tt)]}},_t=t=>{const e=Ge(t);if(!e)return Pe(t);const[n,s]=$e(t,e),{clientX:o,clientY:r,pageX:a,pageY:l,screenX:u,screenY:g,target:m}=e;return{clientX:o,clientY:r,pageX:a,pageY:l,screenX:u,screenY:g,target:m,offsetX:n,offsetY:s}},Ge=t=>{if(Wt(t))return t.touches[0]??t.changedTouches[0];if(ae(t))return t},Ie=(t,e,n,s)=>{const{page:o,scroll:r,before:a,borderBeforeWidth:l,getRect:u}=B(n),g=u(s);return t[o]-e[r]-g[a]-O(s,l)},Nt=(t,e,n="ease-out",s="transform")=>{rt(t)&&(t.style.transitionDuration=`${e}ms`,t.style.transitionTimingFunction=`${n}`,t.style.transitionProperty=`${s}`)},le=(t,e,n)=>{!t||!rt(t)||(t[e]=()=>{n()})},Ye=t=>{var e=t.querySelector("style");if(!e){var n=document.createElement("style");return t.appendChild(n),n}return e},Xe=(t,e)=>{const n=/\.-?[_a-zA-Z0-9-*\s<>():]+/g,[s]=e.match(n)||[];for(const o of t.cssRules){const[r]=o.cssText.match(n)||[];if(s===r)return!0}return!1},We=(t,e)=>{e.forEach(n=>{_e(t,n)})},_e=(t,e)=>{var s;var n=Ye(t);n.sheet&&(Xe(n.sheet,e)||(s=n.sheet)==null||s.insertRule(e,n.sheet.cssRules.length))},ue=(t,e={})=>{for(const n of Object.keys(e)){const s=e[n];s!=null&&Ve(t,`--${n}`,s)}},Ve=(t,e,n)=>t&&t.style.setProperty(e,n),fe="startDrag",Mt="drag",jt="startDrop",He="drop",at="temp-child",de="cubic-bezier(0.2, 0, 0, 1)",qe=t=>t===He||t===jt,Vt=t=>!t||t.length==0?0:zt(t.replace("px","")),ze=(t,e)=>{const n=getComputedStyle(t)[e];if(n.match("%")){const o=zt(n.replace("%","")),{width:r}=t.getBoundingClientRect();return r*(o/100)}return Vt(n)},kt=(t,e)=>{if(!(t instanceof Element))return[0,!1];const n=ze(t,e),s=getComputedStyle(t).display,o=n>0||s==="flex";return[n,o]},je=t=>{const{top:e,left:n}=getComputedStyle(t);return[Vt(e),Vt(n)]},ke=(t,e)=>{const{gap:n}=B(e),[s,o]=kt(t,n);return o?s:0};function Ct(t,e,n,s,o=t.previousElementSibling,r=t.nextElementSibling){let{height:a,width:l}=Ze(n,t,o,r);return ht(t,s)&&e==Mt&&(a=0,l=0),{height:a,width:l}}const Ze=(t,e,n,s)=>{const{afterMargin:o,beforeMargin:r,distance:a,gap:l,getRect:u}=B(t),g=O(e,o),m=O(e,r),D=O(s,r),[w,M]=kt(e.parentElement,l),F=u(e)[a];if(M)return Ut(F,m,g,w,0,t);const[C,p,b]=Je(n,D,g,m,o);return Ut(F,p,C,0,b,t)},Je=(t,e,n,s,o)=>{const r=Math.max(e,n);let a=s,l=e;if(t){const u=O(t,o);a=Math.max(u,s),l=Math.max(l,u)}return[r,a,l]},Ut=(t,e,n,s,o,r)=>Ke(r,t+e+n+s-o),Ke=(t,e)=>t==V?{width:e,height:0}:{width:0,height:e},te=(t,e)=>{const{borderBeforeWidth:n,paddingBefore:s,axis:o,getRect:r}=B(t),a=O(e,n),l=O(e,s),u=r(e)[o];return a+l+u},Qe=(t,e)=>{const[n,s]=je(e),o=te(tt,t);return[te(V,t)-s,o-n]};function Ue(t,e,n,s,o,r,a,l,u){let g=0,m=0;const D=!!(n<0&&u);if(n===s&&!D)return ee({height:g,width:m},t,o,a,D);const[w,M,F,C]=nn(e,n,s,u);if(D){const[et,ot]=Qe(l,u);g+=ot,m+=et}const{scrollElement:p,beforeMargin:b,afterMargin:R,distance:L,gap:Y}=B(t),[X,$]=kt(l,Y),[st,H,P]=on(b,R,w,M==null?void 0:M.previousElementSibling,C,$,D),[Z,q,z]=sn(b,R,L,F,X,$),W=en(q,Z,z,H,st,X),j=D?l[p]:tn(p,l,r),G=(C?W-P:P-W)-j;return t===tt?g+=G:t===V&&(m+=G),ee({height:g,width:m},t,o,a,D)}const tn=(t,e,n)=>{const s=e[t],o=n[t];return s-o},en=(t,e,n,s,o,r)=>{const a=Math.max(e,o);return Math.max(n,s)+t+a+r},nn=(t,e,n,s)=>{const o=e<n,[r,a]=[e,n].toSorted((m,D)=>m-D),l=t[e]??s,u=t[n];let g=o?t.slice(r+1,a+1):t.slice(r,a);return r<0&&s&&(g=t.slice(r+1,a)),[l,u,g,o]},sn=(t,e,n,s,o,r)=>{if(s.length==0)return[0,0,0];const a=O(s[0],t);let l=0,u=-a;for(const[g,m]of s.entries()){const D=m.getBoundingClientRect()[n],w=O(m,t);r&&(l+=w),r&&g>0?l+=o:l=Math.max(l,w),u+=l+D,l=O(m,e)}return[a,u,l]},ee=(t,e,n,s,o)=>{const{scroll:r,distance:a}=B(e),l=window[r],u=n[r],g=o?0:u-2*l+s[r];return t[a]+=g,t},on=(t,e,n,s,o,r,a)=>{const l=o?n.previousElementSibling:s;return rn(t,e,l,n,r,a)},rn=(t,e,n,s,o,r)=>{if(o)return[0,0,0];const a=O(r?null:n,e),l=O(s,t);let u=Math.max(a,l);return[a,l,u]},Zt=(t,e,n,s=()=>!0)=>{const o=new MutationObserver(r=>{if(r=r.filter(s),r.length>0){const a=r[0];t(o,a)}});return o.observe(e,n),o},cn=(t,e,n)=>{n!=0&&(e==="vertical"?t.scrollBy(0,n):t.scrollBy(n,0))},an=(t,e,n)=>{const{scrollDistance:s,clientDistance:o,scrollElement:r}=B(t);return n[r]/(e[s]-e[o])},ln="startDrag",ge="cubic-bezier(0.2, 0, 0, 1)",pe=50,Ht=t=>rt(t)?t.classList.contains(at):!1,un=(t,e,n)=>{let s=Ct(e,ln,n,t);const o=ke(t,n),{distance:r}=B(n);s[r]-=o;const[a,l]=fn(n,e);return s[l]=a,s},fn=(t,e)=>{const n=t==V?tt:V,{distance:s,getRect:o}=B(n);return[o(e)[s],s]},mt=(t,e,n)=>{Me(t,e,n),t.style.minWidth=`${n}px`},dn=(t,e,n)=>s=>{e.contains(t)&&(mt(t,n.height,n.width),s.disconnect())},gn=(t,e)=>{if(!e)return;const{droppable:n,config:s,scroll:o}=t,{direction:r}=s,a=an(s.direction,n,o)>.99,{scrollDistance:l,clientDistance:u,scrollElement:g}=B(r);a&&(n[g]=n[l]-n[u])},he=(t,e,n,s)=>{if(!n)return;const{droppable:o,config:r}=n,{direction:a,animationDuration:l}=r;if(gn(n,e),o.querySelector(`.${at}`)||!t)return;var u=t.tagName=="LI"?"DIV":t.tagName,g=document.createElement(u);U(g,at),mt(g,0,0);const m=un(o,t,a);return Nt(g,l,ge,"width, min-width, height"),[g,m,o]},Gt=(t,e,n,s,o)=>{const r=he(t,n,s);if(!r)return;const[a,l,u]=r;e.isSameNode(u)&&mt(a,l.height,l.width),Zt(dn(a,u,l),u,{childList:!0,subtree:!0}),u.appendChild(a)},pn=(t,e,n)=>{const s=he(t,e,n);if(!s)return;const[o,r,a]=s;a.appendChild(o),hn(o,r)},hn=(t,e)=>requestAnimationFrame(()=>{mt(t,e.height,e.width),requestAnimationFrame(()=>{Nt(t,0,ge,"width, min-width, height")})}),mn=(t,e,n,s,o=!0)=>{if(n){var r=document.querySelectorAll(`${pt(n)} > .${at}`);r.forEach(a=>{const l=a.parentElement;if(l!=null&&l.isSameNode(e)||!o&&(l!=null&&l.isSameNode(t)))return;mt(a,0,0),setTimeout(()=>{var g;(g=a.parentNode)==null||g.removeChild(a)},s+pe)})}},Tt=(t,e,n=!1)=>{var s=t.querySelectorAll(`.${at}`);s.forEach(o=>{const r=o;n?(mt(r,0,0),setTimeout(()=>{t.contains(r)&&t.removeChild(r)},e+pe)):t.removeChild(o)})},Sn=50;function vn(t,e,n,s,o,r){let a=e;const{direction:l,handlerSelector:u,onRemoveAtEvent:g,animationDuration:m,delayBeforeInsert:D,draggingClass:w}=t,M=(i,f,h,S,y)=>{if(!S)return;const{droppable:v,config:T}=S,A=Ct(i,f,T.direction,v);qe(f)?$(i,f,A,h,S,y):b(i,f,A,S)},F=(i,f,h,S,y)=>{const v=Ct(f,"insert",t.direction,h),{onInsertEvent:T}=t,A=ie(h);for(const[N,x]of A.entries())nt(x,Q)&&N>=i&&X(x,v);y(),setTimeout(()=>{T(i,S),me(i,h,t),et(f),_(f,n),Tt(n,0,!0)},D)},C=(i,f,h,S)=>{if(!h||!h.droppable||!h.config)return;const{droppable:y,config:v}=h;let[T]=wt(f,y);T=[f,...T].toReversed();const A=Ct(f,"remove",v.direction,y);for(const[N,x]of T.entries())N>=i&&(Y(x,A),setTimeout(()=>{S(x)},m))},p=i=>{Tt(n,m,!0),setTimeout(()=>{et(i),_(i,n)},m)},b=(i,f,h,S)=>{const{config:y,droppable:v}=S,[T]=wt(i,v),A=ht(i,v);T.length==0&&L(h,1,y.direction,T);for(const[N,x]of T.entries()){if(!nt(x,Q))continue;const I=R(y.direction,i,x,h);if(!A&&I)h=I;else if(!A)continue;const J=T.length-N;L(h,J,y.direction,T),f===fe?Y(x,h):f===Mt&&X(x,h)}},R=(i,f,h,S)=>{const{before:y,distance:v,axis:T,getRect:A}=B(i),N=A(f),x=A(h),I=N[y],J=x[y],ft=x[v],St=J+ft/2,vt=Be(h)[T],it=St-vt;return I>it?{height:0,width:0}:S},L=(i,f,h,S)=>{const y=S.filter(T=>nt(T,Q)).length,{distance:v}=B(h);i[v]==0?a=Math.max(a,f):a=Math.min(a,f-1),a=Math.min(a,y)},Y=(i,f)=>{const{width:h,height:S}=f;Et(i,S,h)},X=(i,f)=>{const{width:h,height:S}=f;Et(i,S,h),Nt(i,m,de)},$=(i,f,h,S,y,v)=>{const{droppable:T,scroll:A,config:N}=y,[x,I]=wt(i,T),J=x.toReversed(),ft=I===-1?J.length:I;J.splice(ft,0,i);const[St,vt,it]=st(i,I,J,T);h=Ct(i,f,N.direction,n,St,vt);const Ft=Ae(),xt=Ue(N.direction,J,I,it,Ft,A,S,T,i);x.length==0&&H(void 0,h,i,xt);for(const[Pt,Bt]of x.toReversed().entries()){let Dt=h;it-1>=Pt&&(Dt={height:0,width:0}),f===jt&&!nt(Bt,at)&&H(Bt,Dt,i,xt)}P(it,i,N,T,v)},st=(i,f,h,S)=>{const v=ht(i,S)?f:a,T=()=>f<v?[v,v+1]:f>v?[v-1,v]:[v-1,v+1],[A,N]=T(),x=h[A]??null,I=h[N]??null;return[x,I,v]},H=(i,f,h,S)=>{Et(i,f.height,f.width),Et(h,S.height,S.width)},P=(i,f,h,S,y)=>{const{onInsertEvent:v,onDragEnd:T}=h;U(f,Xt),z(f,n,S,()=>{if(yt(f,Xt),y!=null){const A=g(y,!0);A!=null&&(v(i,A,!0),T({value:A,index:i})),q(f),Z()}})},Z=()=>{if(s){var i=document.querySelectorAll(`${pt(s)} > .${Q}`);for(const f of i)G(f)}},q=i=>{setTimeout(()=>{yt(i,w)},Sn)},z=(i,f,h,S)=>{setTimeout(()=>{S&&S(),W(f,h),j(h),et(i),_(i,f),_(i,h)},m)},W=(i,f)=>{i.isSameNode(f)?Tt(i,m):(Tt(i,m,!0),Tt(f,m))},j=i=>{if(n.isSameNode(i))return;var[f]=n.querySelectorAll(`.${at}`);if(!f)return;const{distance:h}=B(l);rt(f)&&(f.style[h]="0px")},_=(i,f)=>{const[h]=wt(i,f);for(const S of[...h,i])G(S)},G=i=>{rt(i)&&(i.style.transition="",i.style.transform="")},et=i=>{r(),ut(i,!1),i.style.transform="",i.style.transition="",i.style.top="",i.style.left="",ue(i,{fixedHeight:"",fixedWidth:""})},ot=(i,f)=>{const h=f.querySelector(u);gt(document.body,se,i),gt(h||f,Yt,i)},ut=(i,f)=>{gt(i,qt,f),ot(f,i),o.toggleGrabClass(!f)};return[M,C,F,p,ut]}const Dn=t=>t.addedNodes.values().filter(n=>!Ht(n)).toArray().length>0,me=(t,e,n)=>{const{insertingFromClass:s,animationDuration:o}=n,r=Zt(()=>{const l=ie(e)[t];U(l,s),U(l,Jt),setTimeout(()=>{yt(l,Jt),yt(l,s),r.disconnect()},o)},e,{childList:!0},Dn)},bn=(t,e,n,s)=>{if(!e)return;const{onInsertEvent:o,delayBeforeInsert:r}=t;setTimeout(()=>{o(n,s),me(n,e,t)},r)},Tn=(t,e)=>{const n=(l,u)=>t.removeAtEvent(l,u),s=(l,u,g)=>t.insertEvent(l,u,g),o=()=>t.getLength(),r=l=>t.getValue(l),a=l=>l;return{direction:(e==null?void 0:e.direction)??tt,handlerSelector:(e==null?void 0:e.handlerSelector)??Q,draggingClass:(e==null?void 0:e.draggingClass)??"dragging",droppableClass:(e==null?void 0:e.droppableClass)??"droppable-hover",isDraggable:(e==null?void 0:e.isDraggable)??(()=>!0),onDragStart:(e==null?void 0:e.onDragStart)??(()=>{}),onDragEnd:(e==null?void 0:e.onDragEnd)??(()=>{}),droppableGroup:e==null?void 0:e.droppableGroup,onRemoveAtEvent:n,onInsertEvent:s,onGetLegth:o,onGetValue:r,animationDuration:(e==null?void 0:e.animationDuration)??200,removingClass:(e==null?void 0:e.removingClass)??"removing",insertingFromClass:(e==null?void 0:e.insertingFromClass)??"from-inserting",delayBeforeRemove:(e==null?void 0:e.delayBeforeRemove)??200,delayBeforeInsert:(e==null?void 0:e.delayBeforeInsert)??200,mapFrom:(e==null?void 0:e.mapFrom)??a}},En=(t,e)=>{const{config:n,droppable:s}=t,{onInsertEvent:o,onDragEnd:r}=n;return{...n,onDragEnd:u=>{const{index:g,value:m}=u;r({index:g,value:e(m,s)})},onInsertEvent:(u,g)=>o(u,e(g,s),!0)}},Cn=t=>{let e={offsetX:0,offsetY:0},n={top:0,left:0},s={x:0,y:0};const o=u=>{t.style.transform=`translate( ${u.x}px, ${u.y}px)`},r=u=>{t.style.top=`${u.top}px`,t.style.left=`${u.left}px`};return[(u,g,m,D)=>{const w=C=>{const{beforeMargin:p,borderBeforeWidth:b,before:R,offset:L,scroll:Y,page:X,inner:$,distance:st,axis:H,getRect:P}=B(C),Z=m[X],q=window[Y],z=window[$],W=P(u)[st],j=O(u,b),_=O(u,p),G=Z-e[L],et=ce(u,C);if(G>=q-W/2&&G<=q+z){const ut=G-n[R]-j-_-q-et;return M(C),ut}return s[H]},M=C=>{if(u&&nt(u,qt)&&C===D){const{before:p,distance:b,axis:R,getRect:L}=B(D),Y=L(u)[b],X=L(g),$=n[p]-X[p]+s[R],H=X[b]-Y,P=$/H,Z=Y/H,q=.1,z=.2,W=.8;let j=0;const _=ht(u,g);!_&&P<z&&P>-Z?j=P/z-1:!_&&P>W&&P<1+Z&&(j=1/(1-W)*(P-W));const G=q*Y*j;cn(g,D,G)}},F=C=>{const{axis:p}=B(C);s[p]=w(C),o(s)};F(V),F(tt)},(u,g)=>{const[m,D,w,M]=xn(u,g,t);n={top:m,left:D},r(n),e={offsetX:w,offsetY:M}}]},Rt=(t,e,n)=>{const{borderBeforeWidth:s,before:o,getRect:r}=B(t);return r(e)[o]-r(n)[o]-O(n,s)},yn=(t,e)=>{let{offsetX:n,offsetY:s,target:o}=t,r=An(o,e);const a=o;return a&&r&&!a.isSameNode(r)&&(n+=Rt(V,a,r),s+=Rt(tt,a,r)),r&&e!=o&&(n+=Rt(V,r,e),s+=Rt(tt,r,e)),[n,s]},An=(t,e)=>{const n=t==null?void 0:t.closest(`.${Lt}`);return n&&n.isSameNode(e)?t:n},ne=(t,e,n,s)=>{const{offset:o,beforeMargin:r,page:a,borderBeforeWidth:l,scroll:u}=B(t),g=ce(n,t);return e[a]-s[o]-O(n,r)-O(n,l)-window[u]-g},xn=(t,e,n)=>{const[s,o]=yn(t,n);return[ne(tt,t,e,{offsetX:s,offsetY:o}),ne(V,t,e,{offsetX:s,offsetY:o}),s,o]},K=class K{static addConfig(e,n){const s=K.configs.filter(r=>!r.droppable.isSameNode(e)),o=Qt(e);s.push({droppable:e,config:n,scroll:o}),K.configs=s}static updateScrolls(e,n){for(const s of K.configs){const{droppable:o}=s;(n&&Ce(o,n)||o.isSameNode(e))&&(s.scroll=Qt(o))}}static getConfig(e){return K.configs.find(({droppable:s})=>s.isSameNode(e))}};k(K,"configs",[]),k(K,"removeObsoleteConfigs",()=>{const e=K.configs.filter(({droppable:n})=>document.contains(n));K.configs=e});let lt=K;class Bn{constructor(e,n,s,o,r,a){k(this,"initial");k(this,"current");k(this,"parent");k(this,"draggableElement");k(this,"groupClass");k(this,"dragEvent");k(this,"changeDroppable");k(this,"mapFrom");this.parent=s,this.draggableElement=e,this.groupClass=n,this.dragEvent=o,this.mapFrom=a,this.initial=s?lt.getConfig(s):void 0,this.changeDroppable=r}getDraggableAncestor(e,n,s){return document.elementsFromPoint(e,n).filter(o=>!o.isSameNode(s))}getElementBelow(e,n,s=!0){const o=a=>{const[l]=a.getDraggableAncestor(n.clientX,n.clientY,e);return l};let r=null;return s?(e.hidden=!0,r=o(this),e.hidden=!1):r=o(this),r}getCurrent(e,n,s=!0){const o=this.getElementBelow(e,n,s);return!this.groupClass||!o?void 0:o.closest(pt(this.groupClass))}isOutsideOfAllDroppables(e){return(this.groupClass?Array.from(document.querySelectorAll(pt(this.groupClass))):[this.parent]).every(s=>ht(e,s))}isNotInsideAnotherDroppable(e,n){return!ht(e,n)||this.isOutsideOfAllDroppables(e)}onScrollEvent(){this.dragEvent()}setOnScroll(e){le(e,"onscroll",()=>{this.onScrollEvent()})}getConfigFrom(e){const n=lt.getConfig(e);if(n)return e.isSameNode(this.parent)?n:{...n,config:En(n,this.mapFrom)}}getCurrentConfig(e){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,e);return s?(rt(s)&&!s.onscroll&&this.setOnScroll(s),this.getConfigFrom(s)):this.getConfigFrom(this.parent)}updateConfig(e){const n=this.current;this.current=this.getCurrentConfig(e),this.changeDroppable(this.current,n)}isOutside(e,n=!0){const s=this.draggableElement;return!this.getCurrent(s,e,n)}}function wn(t,e,n,s,o){const{handlerSelector:r,isDraggable:a,droppableGroup:l,animationDuration:u,delayBeforeRemove:g,draggingClass:m,removingClass:D,onRemoveAtEvent:w,droppableClass:M,onDragStart:F}=n,C=At(l).map(c=>`droppable-group-${c}`).join(" ");let p=0,b={scrollX:0,scrollY:0},R={pageX:0,pageY:0},L;const[Y,X]=Cn(t),[$,st,H,P,Z]=vn(n,e,s,C,o,()=>p=0),q=()=>{U(t,Q)},z=c=>{U(c,Lt),o.addSubscriber(c)},W=()=>{if(a(t)){const c=t.querySelector(r);z(c||t)}},j=()=>{W(),q()},_=c=>{const d=c==null?void 0:c.querySelector(`.${Lt}`),E=d==null?void 0:d.parentElement;return d&&E&&nt(E,It)&&!E.isSameNode(s)?null:d},G=c=>{const d=_(c)??c;d&&a(c)&&($t(d,"onmousedown",x("mousemove","mouseup")),$t(d,"ontouchstart",x("touchmove","touchend")),et(d)),c!=null&&c.isSameNode(d)||$t(c,"onmousedown",I),U(s,It)},et=c=>{const d=c.querySelectorAll("img");Array.from(d).forEach(E=>{E.onmousedown=()=>!1})},ot=()=>{if(R.pageX==0&&R.pageY==0||!i.current)return;const{droppable:c,config:d}=i.current;Y(t,c,R,d.direction),$(t,Mt,b,i.current)},ut=(c,d)=>{d&&p==2&&!(c!=null&&c.droppable.isSameNode(d.droppable))&&$(t,Mt,b,d)},i=new Bn(t,C,s,ot,ut,n.mapFrom),f=c=>{if(!i.current)return;const d=C?Array.from(document.querySelectorAll(pt(C))):[s];for(const E of d)E.classList.toggle(M,!c&&E.isSameNode(i.current.droppable))},h=c=>{i.updateConfig(c);const d=i.isOutside(c);f(d),p===1?vt(c):p===2&&(S(d),Ft(c))},S=(c=!0)=>{if(!i.current)return;const{droppable:d}=i.current;mn(d,s,C,u,c),!c&&Gt(t,s,p==1,i.current)},y=c=>{const d=t.getBoundingClientRect();return c.clientX>=d.left&&c.clientX<=d.right&&c.clientY>=d.top&&c.clientY<=d.bottom},v=c=>{const d=_t(c);if(Wt(c)&&c.cancelable&&c.preventDefault(),Wt(c)&&!c.cancelable||!y(d)){ft("touchmove",c);return}h(d)},T=(c,d)=>{c=="touchmove"?L=setTimeout(()=>{d()},200):d()},A=(c,d)=>{const{clientX:E,clientY:dt}=c,ct=document.elementFromPoint(E,dt),bt=ct==null?void 0:ct.closest(`.${Q}`);return bt&&d.isSameNode(bt)},N=c=>{const d=n.onGetValue(e);return{index:e,element:c,value:d}},x=(c,d)=>E=>{if(!A(E,t))return;lt.updateScrolls(s,C);const{scrollX:dt,scrollY:ct}=window;if(b={scrollX:dt,scrollY:ct},p===0){p=1;const bt=N(t);bt&&F(bt),T(c,()=>{document.addEventListener(c,v,{passive:!1})}),xt(s),document.addEventListener(d,J(c),{once:!0})}},I=c=>i.updateConfig(c),J=c=>d=>{ft(c,d)},ft=(c,d)=>{f(!0);const E=_t(d);clearTimeout(L),Bt(i.isOutside(E,!1)),document.removeEventListener(c,v),i.updateConfig(E);const dt=i.getCurrentConfig(E);if(dt){const{droppable:ct}=dt;St(ct)}s.onscroll=null},St=c=>{if(c.onscroll=null,!C)return;const d=Array.from(document.querySelectorAll(pt(C)));for(const E of d)rt(E)&&(E.onscroll=null)},vt=c=>{Gt(t,s,p==1,i.current),it(),$(t,fe,b,i.current),Se(t),X(c,t)},it=()=>{p=2},Ft=c=>{const{pageX:d,pageY:E}=c;R={pageX:d,pageY:E},ot()},xt=c=>le(c,"onscroll",Pt),Pt=()=>ot(),Bt=c=>{if(p!==2){p=0;return}p=3,Dt(t),$(t,jt,b,c?i.initial:i.current,e)},Dt=c=>{Nt(c,u,de),Et(c,0,0)},Se=c=>{const{height:d,width:E}=c.getBoundingClientRect();ue(c,{fixedHeight:`${d}px`,fixedWidth:`${E}px`}),Z(c,!0),gt(c,m,!0),c.style.transition=""},ve=(c,d)=>{yt(t,D),Gt(t,s,p==1,i.initial),st(c,t,d,E=>{Dt(E),P(t)}),w(e,!0)},De=c=>{if(!i.initial)return;const d=i.initial;c==e&&(U(t,D),setTimeout(()=>{ve(c,d)},g))},be=(c,d)=>{(c===e||c===n.onGetLegth()&&e===c-1)&&H(c,t,s,d,()=>{pn(t,p==1,i.initial)})};return j(),G(t),[De,be]}const Rn=(t,e)=>{t&&ye(e,t)},Ln=()=>{We(document.body,[`.${Q}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Lt}{pointer-events:auto!important;}`,`.${oe}{cursor:grab;}`,".temp-child{touch-action:none;pointer-events:none;box-sizing:border-box!important;}",".droppable{box-sizing:border-box!important;}",`.${qt}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,`.${Yt}{pointer-events:none!important;}`,`.${Xt}{pointer-events:none!important;}`,`.${se}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"])};function On(t,e,n,s="index"){const o=s;let r=[],a=[];const{droppableGroup:l}=t;if(!n)return[r,a];const u=At(l).map(g=>`droppable-group-${g}`).join(" ");Ln(),Rn(u,n);for(const g of n.children){const m=g.getAttribute(o),D=xe(m),w=g;if(w&&D>=0){const[M,F]=wn(w,D,t,n,e);r.push(M),a.push(F)}}return[r,a]}function Mn(t,e,n,s="index",o=!0){let r=[],a=[];const l=Tn(t,n),u=p=>{for(const b of r)b(p)},g=(p,b)=>{if(l.onGetLegth()===0)t.insertToListEmpty(l,p,b);else for(const L of a)L(p,b)},m=p=>{const[b,R]=On(l,e,p,s);r=b,a=R},D=p=>{const b=p.addedNodes.values().filter(L=>!Ht(L)).toArray(),R=p.removedNodes.values().filter(L=>!Ht(L)).toArray();return b.length>0||R.length>0},w=p=>{Zt(b=>{m(p),o||b.disconnect()},p,{childList:!0},D)},M=p=>{U(p,It)},F=p=>{lt.addConfig(p,l)};return[u,g,p=>{p&&(M(p),F(p),w(p),m(p),lt.removeObsoleteConfigs())}]}exports.GRAB_CLASS=oe;exports.addClass=U;exports.dragAndDrop=Mn;exports.insertToListEmpty=bn;exports.toggleClass=gt;