fluid-dnd 1.2.0-beta.0 → 1.2.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.
- package/dist/{HandlerPublisher-BrFNCUjc.js → HandlerPublisher-CIc7wXW-.js} +1 -1
- package/dist/{HandlerPublisher-DIbGFZTl.cjs → HandlerPublisher-DiGO5iOY.cjs} +1 -1
- package/dist/core/dragAndDrop.d.ts +1 -1
- package/dist/index/index.cjs +1 -1
- package/dist/index/index.mjs +1 -1
- package/dist/index-BDu6-Hq8.js +1283 -0
- package/dist/index-Tde6DOzb.cjs +1 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.mjs +12 -12
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.mjs +2 -2
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/index-_CLUJ2Ve.cjs +0 -1
- package/dist/index-ekBJgYrv.js +0 -1281
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";var De=Object.defineProperty;var be=(t,e,n)=>e in t?De(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var k=(t,e,n)=>be(t,typeof e!="symbol"?e+"":e,n);const Q="draggable",It="droppable",Ot="handler-class",qt="dragging",Yt="dragging-handler-class",Wt="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)},Ct=(t,e)=>{t.classList.remove(e)},Te=(t,e)=>yt(e).every(n=>nt(t,n)),pt=t=>t?`.${yt(t).join(".")}`:"",Ee=(t,e)=>{if(!e)return;const n=yt(e);t.classList.add(...n)},yt=t=>t?t.split(" ").filter(e=>e):[],V="horizontal",tt="vertical",Ce=()=>{const{scrollX:t,scrollY:e}=window;return{scrollX:t,scrollY:e}},zt=t=>!t||t.trim().length==0||t=="normal"?0:parseFloat(t),ye=t=>t?parseInt(t):-1,Ae=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)=>!xe(t,e),xe=(t,e)=>{const n=Mt(t),s=Mt(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}=w(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}},Mt=t=>t.getBoundingClientRect(),w=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:Mt}},Rt=(t,e)=>we(t,e),ie=t=>[...t.children].filter(n=>nt(n,Q)),we=(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]},Be=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}=w(e),o=Be(t);return o?Mt(o)[n]+O(o,s):0},Xt=t=>window.TouchEvent&&t instanceof TouchEvent,it=t=>t instanceof HTMLElement,ae=t=>t instanceof MouseEvent,Re=["onmouseup","onmousedown","onmousemove"],Le=(t,e,n)=>{t&&(t.style.height=`${e}px`,t.style.width=`${n}px`)},Tt=(t,e,n)=>{!t||!it(t)||(n==0&&e==0?t.style.transform="":t.style.transform=`translate(${n}px,${e}px)`)},Oe=(t,e,n)=>{t[e]=s=>{if(s.defaultPrevented)return;const o=_t(s);n(o)}},$t=(t,e,n)=>{n&&(Me(e)?t[e]=n:Oe(t,e,n))},Me=t=>Re.includes(t),Ne=t=>{const{target:e}=t;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:e,offsetX:0,offsetY:0}},Fe=(t,e)=>{const n=(s,o)=>$e(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=Pe(t);if(!e)return Ne(t);const[n,s]=Fe(t,e),{clientX:o,clientY:r,pageX:a,pageY:l,screenX:u,screenY:d,target:m}=e;return{clientX:o,clientY:r,pageX:a,pageY:l,screenX:u,screenY:d,target:m,offsetX:n,offsetY:s}},Pe=t=>{if(Xt(t))return t.touches[0]??t.changedTouches[0];if(ae(t))return t},$e=(t,e,n,s)=>{const{page:o,scroll:r,before:a,borderBeforeWidth:l,getRect:u}=w(n),d=u(s);return t[o]-e[r]-d[a]-O(s,l)},Ft=(t,e,n="ease-out",s="transform")=>{it(t)&&(t.style.transitionDuration=`${e}ms`,t.style.transitionTimingFunction=`${n}`,t.style.transitionProperty=`${s}`)},le=(t,e,n)=>{!t||!it(t)||(t[e]=()=>{n()})},Ge=t=>{var e=t.querySelector("style");if(!e){var n=document.createElement("style");return t.appendChild(n),n}return e},Ie=(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},Ye=(t,e)=>{e.forEach(n=>{We(t,n)})},We=(t,e)=>{var s;var n=Ge(t);n.sheet&&(Ie(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&&Xe(t,`--${n}`,s)}},Xe=(t,e,n)=>t&&t.style.setProperty(e,n),fe="startDrag",Nt="drag",jt="startDrop",_e="drop",at="temp-child",de="cubic-bezier(0.2, 0, 0, 1)",Ve=t=>t===_e||t===jt,Vt=t=>!t||t.length==0?0:zt(t.replace("px","")),He=(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=He(t,e),s=getComputedStyle(t).display,o=n>0||s==="flex";return[n,o]},qe=t=>{const{top:e,left:n}=getComputedStyle(t);return[Vt(e),Vt(n)]},ze=(t,e)=>{const{gap:n}=w(e),[s,o]=kt(t,n);return o?s:0};function Et(t,e,n,s,o=t.previousElementSibling,r=t.nextElementSibling){let{height:a,width:l}=je(n,t,o,r);return ht(t,s)&&e==Nt&&(a=0,l=0),{height:a,width:l}}const je=(t,e,n,s)=>{const{afterMargin:o,beforeMargin:r,distance:a,gap:l,getRect:u}=w(t),d=O(e,o),m=O(e,r),v=O(s,r),[B,M]=kt(e.parentElement,l),F=u(e)[a];if(M)return Ut(F,m,d,B,0,t);const[C,p,D]=ke(n,v,d,m,o);return Ut(F,p,C,0,D,t)},ke=(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)=>Ze(r,t+e+n+s-o),Ze=(t,e)=>t==V?{width:e,height:0}:{width:0,height:e},te=(t,e)=>{const{borderBeforeWidth:n,paddingBefore:s,axis:o,getRect:r}=w(t),a=O(e,n),l=O(e,s),u=r(e)[o];return a+l+u},Je=(t,e)=>{const[n,s]=qe(e),o=te(tt,t);return[te(V,t)-s,o-n]};function Ke(t,e,n,s,o,r,a,l,u){let d=0,m=0;const v=!!(n<0&&u);if(n===s&&!v)return ee({height:d,width:m},t,o,a,v);const[B,M,F,C]=tn(e,n,s,u);if(v){const[et,ot]=Je(l,u);d+=ot,m+=et}const{scrollElement:p,beforeMargin:D,afterMargin:R,distance:L,gap:Y}=w(t),[W,$]=kt(l,Y),[st,H,P]=nn(D,R,B,M==null?void 0:M.previousElementSibling,C,$,v),[Z,q,z]=en(D,R,L,F,W,$),X=Ue(q,Z,z,H,st,W),j=v?l[p]:Qe(p,l,r),G=(C?X-P:P-X)-j;return t===tt?d+=G:t===V&&(m+=G),ee({height:d,width:m},t,o,a,v)}const Qe=(t,e,n)=>{const s=e[t],o=n[t];return s-o},Ue=(t,e,n,s,o,r)=>{const a=Math.max(e,o);return Math.max(n,s)+t+a+r},tn=(t,e,n,s)=>{const o=e<n,[r,a]=[e,n].toSorted((m,v)=>m-v),l=t[e]??s,u=t[n];let d=o?t.slice(r+1,a+1):t.slice(r,a);return r<0&&s&&(d=t.slice(r+1,a)),[l,u,d,o]},en=(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[d,m]of s.entries()){const v=m.getBoundingClientRect()[n],B=O(m,t);r&&(l+=B),r&&d>0?l+=o:l=Math.max(l,B),u+=l+v,l=O(m,e)}return[a,u,l]},ee=(t,e,n,s,o)=>{const{scroll:r,distance:a}=w(e),l=window[r],u=n[r],d=o?0:u-2*l+s[r];return t[a]+=d,t},nn=(t,e,n,s,o,r,a)=>{const l=o?n.previousElementSibling:s;return sn(t,e,l,n,r,a)},sn=(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},on=(t,e,n)=>{n!=0&&(e==="vertical"?t.scrollBy(0,n):t.scrollBy(n,0))},rn=(t,e,n)=>{const{scrollDistance:s,clientDistance:o,scrollElement:r}=w(t);return n[r]/(e[s]-e[o])},cn="startDrag",ge="cubic-bezier(0.2, 0, 0, 1)",pe=50,Ht=t=>it(t)?t.classList.contains(at):!1,an=(t,e,n)=>{let s=Et(e,cn,n,t);const o=ze(t,n),{distance:r}=w(n);s[r]-=o;const[a,l]=ln(n,e);return s[l]=a,s},ln=(t,e)=>{const n=t==V?tt:V,{distance:s,getRect:o}=w(n);return[o(e)[s],s]},mt=(t,e,n)=>{Le(t,e,n),t.style.minWidth=`${n}px`},un=(t,e,n)=>s=>{e.contains(t)&&(mt(t,n.height,n.width),s.disconnect())},fn=(t,e)=>{if(!e)return;const{droppable:n,config:s,scroll:o}=t,{direction:r}=s,a=rn(s.direction,n,o)>.99,{scrollDistance:l,clientDistance:u,scrollElement:d}=w(r);a&&(n[d]=n[l]-n[u])},he=(t,e,n,s)=>{if(!n)return;const{droppable:o,config:r}=n,{direction:a,animationDuration:l}=r;if(fn(n,e),o.querySelector(`.${at}`)||!t)return;var u=t.tagName=="LI"?"DIV":t.tagName,d=document.createElement(u);U(d,at),mt(d,0,0);const m=an(o,t,a);return Ft(d,l,ge,"width, min-width, height"),[d,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(un(a,u,l),u,{childList:!0,subtree:!0}),u.appendChild(a)},dn=(t,e,n)=>{const s=he(t,e,n);if(!s)return;const[o,r,a]=s;a.appendChild(o),gn(o,r)},gn=(t,e)=>requestAnimationFrame(()=>{mt(t,e.height,e.width),requestAnimationFrame(()=>{Ft(t,0,ge,"width, min-width, height")})}),pn=(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 d;(d=a.parentNode)==null||d.removeChild(a)},s+pe)})}},bt=(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)})},hn=50;function mn(t,e,n,s,o,r){let a=e;const{direction:l,handlerSelector:u,onRemoveAtEvent:d,animationDuration:m,delayBeforeInsert:v,draggingClass:B}=t,M=(i,f,h,S,y)=>{if(!S)return;const{droppable:b,config:T}=S,A=Et(i,f,T.direction,b);Ve(f)?$(i,f,A,h,S,y):D(i,f,A,S)},F=(i,f,h,S,y)=>{const b=Et(f,"insert",t.direction,h),{onInsertEvent:T}=t,A=ie(h);for(const[N,x]of A.entries())nt(x,Q)&&N>=i&&W(x,b);y(),setTimeout(()=>{T(i,S),me(i,h,t),et(f),_(f,n),bt(n,0,!0)},v)},C=(i,f,h,S)=>{if(!h||!h.droppable||!h.config)return;const{droppable:y,config:b}=h;let[T]=Rt(f,y);T=[f,...T].toReversed();const A=Et(f,"remove",b.direction,y);for(const[N,x]of T.entries())N>=i&&(Y(x,A),setTimeout(()=>{S(x)},m))},p=i=>{bt(n,m,!0),setTimeout(()=>{et(i),_(i,n)},m)},D=(i,f,h,S)=>{const{config:y,droppable:b}=S,[T]=Rt(i,b),A=ht(i,b);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===Nt&&W(x,h)}},R=(i,f,h,S)=>{const{before:y,distance:b,axis:T,getRect:A}=w(i),N=A(f),x=A(h),I=N[y],J=x[y],ft=x[b],St=J+ft/2,vt=Ae(h)[T],ct=St-vt;return I>ct?{height:0,width:0}:S},L=(i,f,h,S)=>{const y=S.filter(T=>nt(T,Q)).length,{distance:b}=w(h);i[b]==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;Tt(i,S,h)},W=(i,f)=>{const{width:h,height:S}=f;Tt(i,S,h),Ft(i,m,de)},$=(i,f,h,S,y,b)=>{const{droppable:T,scroll:A,config:N}=y,[x,I]=Rt(i,T),J=x.toReversed(),ft=I===-1?J.length:I;J.splice(ft,0,i);const[St,vt,ct]=st(i,I,J,T);h=Et(i,f,N.direction,n,St,vt);const Pt=Ce(),At=Ke(N.direction,J,I,ct,Pt,A,S,T,i);x.length==0&&H(void 0,h,i,At);for(const[xt,wt]of x.toReversed().entries()){let Bt=h;ct-1>=xt&&(Bt={height:0,width:0}),f===jt&&!nt(wt,at)&&H(wt,Bt,i,At)}P(ct,i,N,T,b)},st=(i,f,h,S)=>{const b=ht(i,S)?f:a,T=()=>f<b?[b,b+1]:f>b?[b-1,b]:[b-1,b+1],[A,N]=T(),x=h[A]??null,I=h[N]??null;return[x,I,b]},H=(i,f,h,S)=>{Tt(i,f.height,f.width),Tt(h,S.height,S.width)},P=(i,f,h,S,y)=>{const{onInsertEvent:b,onDragEnd:T}=h;U(f,Wt),z(f,n,S,()=>{if(Ct(f,Wt),y!=null){const A=d(y,!0);A!=null&&(b(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(()=>{Ct(i,B)},hn)},z=(i,f,h,S)=>{setTimeout(()=>{S&&S(),X(f,h),j(h),et(i),_(i,f),_(i,h)},m)},X=(i,f)=>{i.isSameNode(f)?bt(i,m):(bt(i,m,!0),bt(f,m))},j=i=>{if(n.isSameNode(i))return;var[f]=n.querySelectorAll(`.${at}`);if(!f)return;const{distance:h}=w(l);it(f)&&(f.style[h]="0px")},_=(i,f)=>{const[h]=Rt(i,f);for(const S of[...h,i])G(S)},G=i=>{it(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 Sn=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(()=>{Ct(l,Jt),Ct(l,s),r.disconnect()},o)},e,{childList:!0},Sn)},vn=(t,e,n,s)=>{if(!e)return;const{onInsertEvent:o,delayBeforeInsert:r}=t;setTimeout(()=>{o(n,s),me(n,e,t)},r)},Dn=(t,e)=>{const n=(l,u)=>t.removeAtEvent(l,u),s=(l,u,d)=>t.insertEvent(l,u,d),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}},bn=(t,e)=>{const{config:n,droppable:s}=t,{onInsertEvent:o,onDragEnd:r}=n;return{...n,onDragEnd:u=>{const{index:d,value:m}=u;r({index:d,value:e(m,s)})},onInsertEvent:(u,d)=>o(u,e(d,s),!0)}},Tn=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,d,m,v)=>{const B=C=>{const{beforeMargin:p,borderBeforeWidth:D,before:R,offset:L,scroll:Y,page:W,inner:$,distance:st,axis:H,getRect:P}=w(C),Z=m[W],q=window[Y],z=window[$],X=P(u)[st],j=O(u,D),_=O(u,p),G=Z-e[L],et=ce(u,C);if(G>=q-X/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===v){const{before:p,distance:D,axis:R,getRect:L}=w(v),Y=L(u)[D],W=L(d),$=n[p]-W[p]+s[R],H=W[D]-Y,P=$/H,Z=Y/H,q=.1,z=.2,X=.8;let j=0;const _=ht(u,d);!_&&P<z&&P>-Z?j=P/z-1:!_&&P>X&&P<1+Z&&(j=1/(1-X)*(P-X));const G=q*Y*j;on(d,v,G)}},F=C=>{const{axis:p}=w(C);s[p]=B(C),o(s)};F(V),F(tt)},(u,d)=>{const[m,v,B,M]=yn(u,d,t);n={top:m,left:v},r(n),e={offsetX:B,offsetY:M}}]},Lt=(t,e,n)=>{const{borderBeforeWidth:s,before:o,getRect:r}=w(t);return r(e)[o]-r(n)[o]-O(n,s)},En=(t,e)=>{let{offsetX:n,offsetY:s,target:o}=t,r=Cn(o,e);const a=o;return a&&r&&!a.isSameNode(r)&&(n+=Lt(V,a,r),s+=Lt(tt,a,r)),r&&e!=o&&(n+=Lt(V,r,e),s+=Lt(tt,r,e)),[n,s]},Cn=(t,e)=>{const n=t==null?void 0:t.closest(`.${Ot}`);return n&&n.isSameNode(e)?t:n},ne=(t,e,n,s)=>{const{offset:o,beforeMargin:r,page:a,borderBeforeWidth:l,scroll:u}=w(t),d=ce(n,t);return e[a]-s[o]-O(n,r)-O(n,l)-window[u]-d},yn=(t,e,n)=>{const[s,o]=En(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&&Te(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 An{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:bn(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?(it(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 xn(t,e,n,s,o){const{handlerSelector:r,isDraggable:a,droppableGroup:l,animationDuration:u,delayBeforeRemove:d,draggingClass:m,removingClass:v,onRemoveAtEvent:B,droppableClass:M,onDragStart:F}=n,C=yt(l).map(c=>`droppable-group-${c}`).join(" ");let p=0,D={scrollX:0,scrollY:0},R={pageX:0,pageY:0},L;const[Y,W]=Tn(t),[$,st,H,P,Z]=mn(n,e,s,C,o,()=>p=0),q=()=>{U(t,Q)},z=c=>{U(c,Ot),o.addSubscriber(c)},X=()=>{if(a(t)){const c=t.querySelector(r);z(c||t)}},j=()=>{X(),q()},_=c=>{const g=c==null?void 0:c.querySelector(`.${Ot}`),E=g==null?void 0:g.parentElement;return g&&E&&nt(E,It)&&!E.isSameNode(s)?null:g},G=c=>{const g=_(c)??c;g&&a(c)&&($t(g,"onmousedown",N("mousemove","mouseup")),$t(g,"ontouchstart",N("touchmove","touchend")),et(g)),c!=null&&c.isSameNode(g)||$t(c,"onmousedown",x),U(s,It)},et=c=>{const g=c.querySelectorAll("img");Array.from(g).forEach(E=>{E.onmousedown=()=>!1})},ot=()=>{if(R.pageX==0&&R.pageY==0||!i.current)return;const{droppable:c,config:g}=i.current;Y(t,c,R,g.direction),$(t,Nt,D,i.current)},ut=(c,g)=>{g&&p==2&&!(c!=null&&c.droppable.isSameNode(g.droppable))&&$(t,Nt,D,g)},i=new An(t,C,s,ot,ut,n.mapFrom),f=c=>{if(!i.current)return;const g=C?Array.from(document.querySelectorAll(pt(C))):[s];for(const E of g)E.classList.toggle(M,!c&&E.isSameNode(i.current.droppable))},h=c=>{i.updateConfig(c);const g=i.isOutside(c);f(g),p===1?ft(c):p===2&&(S(g),vt(c))},S=(c=!0)=>{if(!i.current)return;const{droppable:g}=i.current;pn(g,s,C,u,c),!c&&Gt(t,s,p==1,i.current)},y=c=>{if(Xt(c)&&c.cancelable)c.preventDefault();else if(Xt(c))return;const g=_t(c);h(g)},b=(c,g)=>{c=="touchmove"?L=setTimeout(()=>{g()},200):g()},T=(c,g)=>{const{clientX:E,clientY:dt}=c,rt=document.elementFromPoint(E,dt),Dt=rt==null?void 0:rt.closest(`.${Q}`);return rt&&g&&Dt&&!g.isSameNode(Dt)},A=c=>{const g=n.onGetValue(e);return{index:e,element:c,value:g}},N=(c,g)=>E=>{if(T(E,t))return;lt.updateScrolls(s,C);const{scrollX:dt,scrollY:rt}=window;if(D={scrollX:dt,scrollY:rt},p===0){p=1;const Dt=A(t);Dt&&F(Dt),b(c,()=>{c=="touchmove"&&(i.updateConfig(E),f(i.isOutside(E)),ft(E)),document.addEventListener(c,y,{passive:!1})}),ct(s),document.addEventListener(g,I(c),{once:!0})}},x=c=>i.updateConfig(c),I=c=>g=>{f(!0);const E=_t(g);clearTimeout(L),At(i.isOutside(E,!1)),document.removeEventListener(c,y),i.updateConfig(E);const dt=i.getCurrentConfig(E);if(dt){const{droppable:rt}=dt;J(rt)}s.onscroll=null},J=c=>{if(c.onscroll=null,!C)return;const g=Array.from(document.querySelectorAll(pt(C)));for(const E of g)it(E)&&(E.onscroll=null)},ft=c=>{Gt(t,s,p==1,i.current),St(),$(t,fe,D,i.current),wt(t),W(c,t)},St=()=>{p=2},vt=c=>{const{pageX:g,pageY:E}=c;R={pageX:g,pageY:E},ot()},ct=c=>le(c,"onscroll",Pt),Pt=()=>ot(),At=c=>{if(p!==2){p=0;return}p=3,xt(t),$(t,jt,D,c?i.initial:i.current,e)},xt=c=>{Ft(c,u,de),Tt(c,0,0)},wt=c=>{const{height:g,width:E}=c.getBoundingClientRect();ue(c,{fixedHeight:`${g}px`,fixedWidth:`${E}px`}),Z(c,!0),gt(c,m,!0),c.style.transition=""},Bt=(c,g)=>{Ct(t,v),Gt(t,s,p==1,i.initial),st(c,t,g,E=>{xt(E),P(t)}),B(e,!0)},Se=c=>{if(!i.initial)return;const g=i.initial;c==e&&(U(t,v),setTimeout(()=>{Bt(c,g)},d))},ve=(c,g)=>{(c===e||c===n.onGetLegth()&&e===c-1)&&H(c,t,s,g,()=>{dn(t,p==1,i.initial)})};return j(),G(t),[Se,ve]}const wn=(t,e)=>{t&&Ee(e,t)},Bn=()=>{Ye(document.body,[`.${Q}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Ot}{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;}`,`.${Wt}{pointer-events:none!important;}`,`.${se}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"])};function Rn(t,e,n,s="index"){const o=s;let r=[],a=[];const{droppableGroup:l}=t;if(!n)return[r,a];const u=yt(l).map(d=>`droppable-group-${d}`).join(" ");Bn(),wn(u,n);for(const d of n.children){const m=d.getAttribute(o),v=ye(m),B=d;if(B&&v>=0){const[M,F]=xn(B,v,t,n,e);r.push(M),a.push(F)}}return[r,a]}function Ln(t,e,n,s="index",o=!0){let r=[],a=[];const l=Dn(t,n),u=p=>{for(const D of r)D(p)},d=(p,D)=>{if(l.onGetLegth()===0)t.insertToListEmpty(l,p,D);else for(const L of a)L(p,D)},m=p=>{const[D,R]=Rn(l,e,p,s);r=D,a=R},v=p=>{const D=p.addedNodes.values().filter(L=>!Ht(L)).toArray(),R=p.removedNodes.values().filter(L=>!Ht(L)).toArray();return D.length>0||R.length>0},B=p=>{Zt(D=>{m(p),o||D.disconnect()},p,{childList:!0},v)},M=p=>{U(p,It)},F=p=>{lt.addConfig(p,l)};return[u,d,p=>{p&&(M(p),F(p),B(p),m(p),lt.removeObsoleteConfigs())}]}exports.GRAB_CLASS=oe;exports.addClass=U;exports.dragAndDrop=Ln;exports.insertToListEmpty=vn;exports.toggleClass=gt;
|
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-DiGO5iOY.cjs"),S=require("../index-Tde6DOzb.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;
|
package/dist/react/index.mjs
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
import { useState as S, useRef as d, useEffect as h } from "react";
|
2
|
-
import { H as A } from "../HandlerPublisher-
|
3
|
-
import { i as C, d as L } from "../index-
|
2
|
+
import { H as A } from "../HandlerPublisher-CIc7wXW-.js";
|
3
|
+
import { i as C, d as L } from "../index-BDu6-Hq8.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);
|
7
7
|
h(() => {
|
8
8
|
c.current = t;
|
9
9
|
}, [t]);
|
10
|
-
function l(e,
|
11
|
-
const
|
10
|
+
function l(e, s = !1) {
|
11
|
+
const r = c.current[e], o = () => {
|
12
12
|
n((i) => [
|
13
13
|
...i.slice(0, e),
|
14
14
|
...i.slice(e + 1)
|
15
15
|
]);
|
16
16
|
};
|
17
|
-
return
|
17
|
+
return s ? p(o) : o(), r;
|
18
18
|
}
|
19
|
-
function f(e,
|
19
|
+
function f(e, s, r = !1) {
|
20
20
|
const o = () => {
|
21
21
|
n((i) => [
|
22
22
|
...i.slice(0, e),
|
23
|
-
|
23
|
+
s,
|
24
24
|
...i.slice(e)
|
25
25
|
]);
|
26
26
|
};
|
27
|
-
|
27
|
+
r ? p(o) : o();
|
28
28
|
}
|
29
29
|
function m() {
|
30
30
|
return t.length;
|
@@ -32,8 +32,8 @@ function b(a, u) {
|
|
32
32
|
function g(e) {
|
33
33
|
return t[e];
|
34
34
|
}
|
35
|
-
function E(e,
|
36
|
-
C(e, u.current,
|
35
|
+
function E(e, s, r) {
|
36
|
+
C(e, u.current, s, r);
|
37
37
|
}
|
38
38
|
return [t, n, {
|
39
39
|
removeAtEvent: l,
|
@@ -45,10 +45,10 @@ function b(a, u) {
|
|
45
45
|
}
|
46
46
|
const y = new A();
|
47
47
|
function k(a, u) {
|
48
|
-
const t = d(null), [n, c, l] = b(a, t), [f, m, g] = L(l, y, u, "data-index");
|
48
|
+
const t = d(null), [n, c, l] = b(a, t), [f, m, g] = L(l, y, u, "data-index", !1);
|
49
49
|
return h(() => {
|
50
50
|
g(t.current);
|
51
|
-
}
|
51
|
+
}), [t, n, c, m, f];
|
52
52
|
}
|
53
53
|
export {
|
54
54
|
k as useDragAndDrop
|
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-DiGO5iOY.cjs"),o=require("../index-Tde6DOzb.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-CIc7wXW-.js";
|
5
|
+
import { i as m, d as u } from "../index-BDu6-Hq8.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-DiGO5iOY.cjs"),u=require("../index-Tde6DOzb.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-CIc7wXW-.js";
|
6
|
+
import { i as p, d as v } from "../index-BDu6-Hq8.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.2.
|
3
|
+
"version": "1.2.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",
|
package/dist/index-_CLUJ2Ve.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var De=Object.defineProperty;var ve=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var k=(e,t,n)=>ve(e,typeof t!="symbol"?t+"":t,n);const Q="draggable",It="droppable",Ot="handler-class",Ht="dragging",Yt="dragging-handler-class",Wt="dropping",se="grabbing",oe="grab",Zt="disable-transition",nt=(e,t)=>e.classList.contains(t),gt=(e,t,n=!1)=>{e.classList.toggle(t,n)},U=(e,t)=>{e.classList.add(t)},Ct=(e,t)=>{e.classList.remove(t)},be=(e,t)=>yt(t).every(n=>nt(e,n)),pt=e=>e?`.${yt(e).join(".")}`:"",Te=(e,t)=>{if(!t)return;const n=yt(t);e.classList.add(...n)},yt=e=>e?e.split(" ").filter(t=>t):[],V="horizontal",tt="vertical",Ee=()=>{const{scrollX:e,scrollY:t}=window;return{scrollX:e,scrollY:t}},qt=e=>!e||e.trim().length==0||e=="normal"?0:parseFloat(e),Ce=e=>e?parseInt(e):-1,ye=e=>{const t=getComputedStyle(e),n=new DOMMatrixReadOnly(t.transform);return{x:n.m41,y:n.m42}},re=(e,t)=>e.x1>t.x1?re(t,e):e.x2<t.x1?0:e.x2>=t.x2?e.x2-e.x1:e.x2-t.x1,ht=(e,t)=>!Ae(e,t),Ae=(e,t)=>{const n=Mt(e),s=Mt(t),o=Jt(n,s,tt),r=Jt(n,s,V);return o>=Math.min(n.height,s.height)/2&&r>=Math.min(n.width,s.width)/2},Jt=(e,t,n)=>{const{before:s,distance:o}=w(n);return re({x1:e[s],x2:e[s]+e[o]},{x1:t[s],x2:t[s]+t[o]})},L=(e,t)=>e?qt(getComputedStyle(e)[t]):0,Kt=e=>{const{scrollLeft:t,scrollTop:n}=e;return{scrollLeft:t,scrollTop:n}},Mt=e=>e.getBoundingClientRect(),w=e=>{const t=e==V;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:Mt}},Rt=(e,t)=>xe(e,t),ie=e=>[...e.children].filter(n=>nt(n,Q)),xe=(e,t)=>{const n=[...t.children].filter(o=>nt(o,Q)&&!o.isEqualNode(e)).toReversed(),s=[...t.children].findLastIndex(o=>o.isEqualNode(e));return[n,s,t]},we=e=>{let t=e.parentElement;for(;t;){if(window.getComputedStyle(t).position==="fixed")return t;t=t.parentElement}return null},ce=(e,t)=>{const{before:n,borderBeforeWidth:s}=w(t),o=we(e);return o?Mt(o)[n]+L(o,s):0},Xt=e=>window.TouchEvent&&e instanceof TouchEvent,it=e=>e instanceof HTMLElement,ae=e=>e instanceof MouseEvent,Be=["onmouseup","onmousedown","onmousemove"],Re=(e,t,n)=>{e&&(e.style.height=`${t}px`,e.style.width=`${n}px`)},Tt=(e,t,n)=>{!e||!it(e)||(n==0&&t==0?e.style.transform="":e.style.transform=`translate(${n}px,${t}px)`)},Le=(e,t,n)=>{e[t]=s=>{if(s.defaultPrevented)return;const o=_t(s);n(o)}},$t=(e,t,n)=>{n&&(Oe(t)?e[t]=n:Le(e,t,n))},Oe=e=>Be.includes(e),Me=e=>{const{target:t}=e;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:t,offsetX:0,offsetY:0}},Ne=(e,t)=>{const n=(s,o)=>Pe(t,window,o,s);if(ae(e)){const{offsetX:s,offsetY:o}=e;return[s,o]}else{const s=e.target;return[n(s,V),n(s,tt)]}},_t=e=>{const t=Fe(e);if(!t)return Me(e);const[n,s]=Ne(e,t),{clientX:o,clientY:r,pageX:c,pageY:l,screenX:u,screenY:d,target:m}=t;return{clientX:o,clientY:r,pageX:c,pageY:l,screenX:u,screenY:d,target:m,offsetX:n,offsetY:s}},Fe=e=>{if(Xt(e))return e.touches[0]??e.changedTouches[0];if(ae(e))return e},Pe=(e,t,n,s)=>{const{page:o,scroll:r,before:c,borderBeforeWidth:l,getRect:u}=w(n),d=u(s);return e[o]-t[r]-d[c]-L(s,l)},Ft=(e,t,n="ease-out",s="transform")=>{it(e)&&(e.style.transitionDuration=`${t}ms`,e.style.transitionTimingFunction=`${n}`,e.style.transitionProperty=`${s}`)},le=(e,t,n)=>{!e||!it(e)||(e[t]=()=>{n()})},$e=e=>{var t=e.querySelector("style");if(!t){var n=document.createElement("style");return e.appendChild(n),n}return t},Ge=(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},Ie=(e,t)=>{t.forEach(n=>{Ye(e,n)})},Ye=(e,t)=>{var s;var n=$e(e);n.sheet&&(Ge(n.sheet,t)||(s=n.sheet)==null||s.insertRule(t,n.sheet.cssRules.length))},ue=(e,t={})=>{for(const n of Object.keys(t)){const s=t[n];s!=null&&We(e,`--${n}`,s)}},We=(e,t,n)=>e&&e.style.setProperty(t,n),fe="startDrag",Nt="drag",zt="startDrop",Xe="drop",at="temp-child",de="cubic-bezier(0.2, 0, 0, 1)",_e=e=>e===Xe||e===zt,Vt=e=>!e||e.length==0?0:qt(e.replace("px","")),Ve=(e,t)=>{const n=getComputedStyle(e)[t];if(n.match("%")){const o=qt(n.replace("%","")),{width:r}=e.getBoundingClientRect();return r*(o/100)}return Vt(n)},jt=(e,t)=>{if(!(e instanceof Element))return[0,!1];const n=Ve(e,t),s=getComputedStyle(e).display,o=n>0||s==="flex";return[n,o]},He=e=>{const{top:t,left:n}=getComputedStyle(e);return[Vt(t),Vt(n)]},qe=(e,t)=>{const{gap:n}=w(t),[s,o]=jt(e,n);return o?s:0};function Et(e,t,n,s,o=e.previousElementSibling,r=e.nextElementSibling){let{height:c,width:l}=ze(n,e,o,r);return ht(e,s)&&t==Nt&&(c=0,l=0),{height:c,width:l}}const ze=(e,t,n,s)=>{const{afterMargin:o,beforeMargin:r,distance:c,gap:l,getRect:u}=w(e),d=L(t,o),m=L(t,r),v=L(s,r),[B,O]=jt(t.parentElement,l),F=u(t)[c];if(O)return Qt(F,m,d,B,0,e);const[h,S,y]=je(n,v,d,m,o);return Qt(F,S,h,0,y,e)},je=(e,t,n,s,o)=>{const r=Math.max(t,n);let c=s,l=t;if(e){const u=L(e,o);c=Math.max(u,s),l=Math.max(l,u)}return[r,c,l]},Qt=(e,t,n,s,o,r)=>ke(r,e+t+n+s-o),ke=(e,t)=>e==V?{width:t,height:0}:{width:0,height:t},Ut=(e,t)=>{const{borderBeforeWidth:n,paddingBefore:s,axis:o,getRect:r}=w(e),c=L(t,n),l=L(t,s),u=r(t)[o];return c+l+u},Ze=(e,t)=>{const[n,s]=He(t),o=Ut(tt,e);return[Ut(V,e)-s,o-n]};function Je(e,t,n,s,o,r,c,l,u){let d=0,m=0;const v=!!(n<0&&u);if(n===s&&!v)return te({height:d,width:m},e,o,c,v);const[B,O,F,h]=Ue(t,n,s,u);if(v){const[et,ot]=Ze(l,u);d+=ot,m+=et}const{scrollElement:S,beforeMargin:y,afterMargin:R,distance:I,gap:Y}=w(e),[W,P]=jt(l,Y),[st,H,N]=en(y,R,B,O==null?void 0:O.previousElementSibling,h,P,v),[Z,q,z]=tn(y,R,I,F,W,P),X=Qe(q,Z,z,H,st,W),j=v?l[S]:Ke(S,l,r),$=(h?X-N:N-X)-j;return e===tt?d+=$:e===V&&(m+=$),te({height:d,width:m},e,o,c,v)}const Ke=(e,t,n)=>{const s=t[e],o=n[e];return s-o},Qe=(e,t,n,s,o,r)=>{const c=Math.max(t,o);return Math.max(n,s)+e+c+r},Ue=(e,t,n,s)=>{const o=t<n,[r,c]=[t,n].toSorted((m,v)=>m-v),l=e[t]??s,u=e[n];let d=o?e.slice(r+1,c+1):e.slice(r,c);return r<0&&s&&(d=e.slice(r+1,c)),[l,u,d,o]},tn=(e,t,n,s,o,r)=>{if(s.length==0)return[0,0,0];const c=L(s[0],e);let l=0,u=-c;for(const[d,m]of s.entries()){const v=m.getBoundingClientRect()[n],B=L(m,e);r&&(l+=B),r&&d>0?l+=o:l=Math.max(l,B),u+=l+v,l=L(m,t)}return[c,u,l]},te=(e,t,n,s,o)=>{const{scroll:r,distance:c}=w(t),l=window[r],u=n[r],d=o?0:u-2*l+s[r];return e[c]+=d,e},en=(e,t,n,s,o,r,c)=>{const l=o?n.previousElementSibling:s;return nn(e,t,l,n,r,c)},nn=(e,t,n,s,o,r)=>{if(o)return[0,0,0];const c=L(r?null:n,t),l=L(s,e);let u=Math.max(c,l);return[c,l,u]},kt=(e,t,n,s=()=>!0)=>{const o=new MutationObserver(r=>{if(r=r.filter(s),r.length>0){const c=r[0];e(o,c)}});return o.observe(t,n),o},sn=(e,t,n)=>{n!=0&&(t==="vertical"?e.scrollBy(0,n):e.scrollBy(n,0))},on=(e,t,n)=>{const{scrollDistance:s,clientDistance:o,scrollElement:r}=w(e);return n[r]/(t[s]-t[o])},rn="startDrag",ge="cubic-bezier(0.2, 0, 0, 1)",pe=50,ee=e=>it(e)?e.classList.contains(at):!1,cn=(e,t,n)=>{let s=Et(t,rn,n,e);const o=qe(e,n),{distance:r}=w(n);s[r]-=o;const[c,l]=an(n,t);return s[l]=c,s},an=(e,t)=>{const n=e==V?tt:V,{distance:s,getRect:o}=w(n);return[o(t)[s],s]},mt=(e,t,n)=>{Re(e,t,n),e.style.minWidth=`${n}px`},ln=(e,t,n)=>s=>{t.contains(e)&&(mt(e,n.height,n.width),s.disconnect())},un=(e,t)=>{if(!t)return;const{droppable:n,config:s,scroll:o}=e,{direction:r}=s,c=on(s.direction,n,o)>.99,{scrollDistance:l,clientDistance:u,scrollElement:d}=w(r);c&&(n[d]=n[l]-n[u])},he=(e,t,n,s)=>{if(!n)return;const{droppable:o,config:r}=n,{direction:c,animationDuration:l}=r;if(un(n,t),o.querySelector(`.${at}`)||!e)return;var u=e.tagName=="LI"?"DIV":e.tagName,d=document.createElement(u);U(d,at),mt(d,0,0);const m=cn(o,e,c);return Ft(d,l,ge,"width, min-width, height"),[d,m,o]},Gt=(e,t,n,s,o)=>{const r=he(e,n,s);if(!r)return;const[c,l,u]=r;t.isSameNode(u)&&mt(c,l.height,l.width),kt(ln(c,u,l),u,{childList:!0,subtree:!0}),u.appendChild(c)},fn=(e,t,n)=>{const s=he(e,t,n);if(!s)return;const[o,r,c]=s;c.appendChild(o),dn(o,r)},dn=(e,t)=>requestAnimationFrame(()=>{mt(e,t.height,t.width),requestAnimationFrame(()=>{Ft(e,0,ge,"width, min-width, height")})}),gn=(e,t,n,s,o=!0)=>{if(n){var r=document.querySelectorAll(`${pt(n)} > .${at}`);r.forEach(c=>{const l=c.parentElement;if(l!=null&&l.isSameNode(t)||!o&&(l!=null&&l.isSameNode(e)))return;mt(c,0,0),setTimeout(()=>{var d;(d=c.parentNode)==null||d.removeChild(c)},s+pe)})}},bt=(e,t,n=!1)=>{var s=e.querySelectorAll(`.${at}`);s.forEach(o=>{const r=o;n?(mt(r,0,0),setTimeout(()=>{e.contains(r)&&e.removeChild(r)},t+pe)):e.removeChild(o)})},pn=50;function hn(e,t,n,s,o,r){let c=t;const{direction:l,handlerSelector:u,onRemoveAtEvent:d,animationDuration:m,delayBeforeInsert:v,draggingClass:B}=e,O=(i,f,g,D,C)=>{if(!D)return;const{droppable:b,config:T}=D,A=Et(i,f,T.direction,b);_e(f)?P(i,f,A,g,D,C):y(i,f,A,D)},F=(i,f,g,D,C)=>{const b=Et(f,"insert",e.direction,g),{onInsertEvent:T}=e,A=ie(g);for(const[M,x]of A.entries())nt(x,Q)&&M>=i&&W(x,b);C(),setTimeout(()=>{T(i,D),me(i,g,e),et(f),_(f,n),bt(n,0,!0)},v)},h=(i,f,g,D)=>{if(!g||!g.droppable||!g.config)return;const{droppable:C,config:b}=g;let[T]=Rt(f,C);T=[f,...T].toReversed();const A=Et(f,"remove",b.direction,C);for(const[M,x]of T.entries())M>=i&&(Y(x,A),setTimeout(()=>{D(x)},m))},S=i=>{bt(n,m,!0),setTimeout(()=>{et(i),_(i,n)},m)},y=(i,f,g,D)=>{const{config:C,droppable:b}=D,[T]=Rt(i,b),A=ht(i,b);T.length==0&&I(g,1,C.direction,T);for(const[M,x]of T.entries()){if(!nt(x,Q))continue;const G=R(C.direction,i,x,g);if(!A&&G)g=G;else if(!A)continue;const J=T.length-M;I(g,J,C.direction,T),f===fe?Y(x,g):f===Nt&&W(x,g)}},R=(i,f,g,D)=>{const{before:C,distance:b,axis:T,getRect:A}=w(i),M=A(f),x=A(g),G=M[C],J=x[C],ft=x[b],St=J+ft/2,Dt=ye(g)[T],ct=St-Dt;return G>ct?{height:0,width:0}:D},I=(i,f,g,D)=>{const C=D.filter(T=>nt(T,Q)).length,{distance:b}=w(g);i[b]==0?c=Math.max(c,f):c=Math.min(c,f-1),c=Math.min(c,C)},Y=(i,f)=>{const{width:g,height:D}=f;Tt(i,D,g)},W=(i,f)=>{const{width:g,height:D}=f;Tt(i,D,g),Ft(i,m,de)},P=(i,f,g,D,C,b)=>{const{droppable:T,scroll:A,config:M}=C,[x,G]=Rt(i,T),J=x.toReversed(),ft=G===-1?J.length:G;J.splice(ft,0,i);const[St,Dt,ct]=st(i,G,J,T);g=Et(i,f,M.direction,n,St,Dt);const Pt=Ee(),At=Je(M.direction,J,G,ct,Pt,A,D,T,i);x.length==0&&H(void 0,g,i,At);for(const[xt,wt]of x.toReversed().entries()){let Bt=g;ct-1>=xt&&(Bt={height:0,width:0}),f===zt&&!nt(wt,at)&&H(wt,Bt,i,At)}N(ct,i,M,T,b)},st=(i,f,g,D)=>{const b=ht(i,D)?f:c,T=()=>f<b?[b,b+1]:f>b?[b-1,b]:[b-1,b+1],[A,M]=T(),x=g[A]??null,G=g[M]??null;return[x,G,b]},H=(i,f,g,D)=>{Tt(i,f.height,f.width),Tt(g,D.height,D.width)},N=(i,f,g,D,C)=>{const{onInsertEvent:b,onDragEnd:T}=g;U(f,Wt),z(f,n,D,()=>{if(Ct(f,Wt),C!=null){const A=d(C,!0);A!=null&&(b(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)$(f)}},q=i=>{setTimeout(()=>{Ct(i,B)},pn)},z=(i,f,g,D)=>{setTimeout(()=>{D&&D(),X(f,g),j(g),et(i),_(i,f),_(i,g)},m)},X=(i,f)=>{i.isSameNode(f)?bt(i,m):(bt(i,m,!0),bt(f,m))},j=i=>{if(n.isSameNode(i))return;var[f]=n.querySelectorAll(`.${at}`);if(!f)return;const{distance:g}=w(l);it(f)&&(f.style[g]="0px")},_=(i,f)=>{const[g]=Rt(i,f);for(const D of[...g,i])$(D)},$=i=>{it(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 g=f.querySelector(u);gt(document.body,se,i),gt(g||f,Yt,i)},ut=(i,f)=>{gt(i,Ht,f),ot(f,i),o.toggleGrabClass(!f)};return[O,h,F,S,ut]}const me=(e,t,n)=>{const{insertingFromClass:s,animationDuration:o}=n,r=kt(()=>{const l=ie(t)[e];U(l,s),U(l,Zt),setTimeout(()=>{Ct(l,Zt),Ct(l,s),r.disconnect()},o)},t,{childList:!0})},mn=(e,t,n,s)=>{if(!t)return;const{onInsertEvent:o,delayBeforeInsert:r}=e;setTimeout(()=>{o(n,s),me(n,t,e)},r)},Sn=(e,t)=>{const n=(l,u)=>e.removeAtEvent(l,u),s=(l,u,d)=>e.insertEvent(l,u,d),o=()=>e.getLength(),r=l=>e.getValue(l),c=l=>l;return{direction:(t==null?void 0:t.direction)??tt,handlerSelector:(t==null?void 0:t.handlerSelector)??Q,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)??c}},Dn=(e,t)=>{const{config:n,droppable:s}=e,{onInsertEvent:o,onDragEnd:r}=n;return{...n,onDragEnd:u=>{const{index:d,value:m}=u;r({index:d,value:t(m,s)})},onInsertEvent:(u,d)=>o(u,t(d,s),!0)}},vn=e=>{let t={offsetX:0,offsetY:0},n={top:0,left:0},s={x:0,y:0};const o=u=>{e.style.transform=`translate( ${u.x}px, ${u.y}px)`},r=u=>{e.style.top=`${u.top}px`,e.style.left=`${u.left}px`};return[(u,d,m,v)=>{const B=h=>{const{beforeMargin:S,borderBeforeWidth:y,before:R,offset:I,scroll:Y,page:W,inner:P,distance:st,axis:H,getRect:N}=w(h),Z=m[W],q=window[Y],z=window[P],X=N(u)[st],j=L(u,y),_=L(u,S),$=Z-t[I],et=ce(u,h);if($>=q-X/2&&$<=q+z){const ut=$-n[R]-j-_-q-et;return O(h),ut}return s[H]},O=h=>{if(u&&nt(u,Ht)&&h===v){const{before:S,distance:y,axis:R,getRect:I}=w(v),Y=I(u)[y],W=I(d),P=n[S]-W[S]+s[R],H=W[y]-Y,N=P/H,Z=Y/H,q=.1,z=.2,X=.8;let j=0;const _=ht(u,d);!_&&N<z&&N>-Z?j=N/z-1:!_&&N>X&&N<1+Z&&(j=1/(1-X)*(N-X));const $=q*Y*j;sn(d,v,$)}},F=h=>{const{axis:S}=w(h);s[S]=B(h),o(s)};F(V),F(tt)},(u,d)=>{const[m,v,B,O]=En(u,d,e);n={top:m,left:v},r(n),t={offsetX:B,offsetY:O}}]},Lt=(e,t,n)=>{const{borderBeforeWidth:s,before:o,getRect:r}=w(e);return r(t)[o]-r(n)[o]-L(n,s)},bn=(e,t)=>{let{offsetX:n,offsetY:s,target:o}=e,r=Tn(o,t);const c=o;return c&&r&&!c.isSameNode(r)&&(n+=Lt(V,c,r),s+=Lt(tt,c,r)),r&&t!=o&&(n+=Lt(V,r,t),s+=Lt(tt,r,t)),[n,s]},Tn=(e,t)=>{const n=e==null?void 0:e.closest(`.${Ot}`);return n&&n.isSameNode(t)?e:n},ne=(e,t,n,s)=>{const{offset:o,beforeMargin:r,page:c,borderBeforeWidth:l,scroll:u}=w(e),d=ce(n,e);return t[c]-s[o]-L(n,r)-L(n,l)-window[u]-d},En=(e,t,n)=>{const[s,o]=bn(e,n);return[ne(tt,e,t,{offsetX:s,offsetY:o}),ne(V,e,t,{offsetX:s,offsetY:o}),s,o]},K=class K{static addConfig(t,n){const s=K.configs.filter(r=>!r.droppable.isSameNode(t)),o=Kt(t);s.push({droppable:t,config:n,scroll:o}),K.configs=s}static updateScrolls(t,n){for(const s of K.configs){const{droppable:o}=s;(n&&be(o,n)||o.isSameNode(t))&&(s.scroll=Kt(o))}}static getConfig(t){return K.configs.find(({droppable:s})=>s.isSameNode(t))}};k(K,"configs",[]),k(K,"removeObsoleteConfigs",()=>{const t=K.configs.filter(({droppable:n})=>document.contains(n));K.configs=t});let lt=K;class Cn{constructor(t,n,s,o,r,c){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=t,this.groupClass=n,this.dragEvent=o,this.mapFrom=c,this.initial=s?lt.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=c=>{const[l]=c.getDraggableAncestor(n.clientX,n.clientY,t);return l};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=>ht(t,s))}isNotInsideAnotherDroppable(t,n){return!ht(t,n)||this.isOutsideOfAllDroppables(t)}onScrollEvent(){this.dragEvent()}setOnScroll(t){le(t,"onscroll",()=>{this.onScrollEvent()})}getConfigFrom(t){const n=lt.getConfig(t);if(n)return t.isSameNode(this.parent)?n:{...n,config:Dn(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?(it(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 yn(e,t,n,s,o){const{handlerSelector:r,isDraggable:c,droppableGroup:l,animationDuration:u,delayBeforeRemove:d,draggingClass:m,removingClass:v,onRemoveAtEvent:B,droppableClass:O,onDragStart:F}=n,h=yt(l).map(a=>`droppable-group-${a}`).join(" ");let S=0,y={scrollX:0,scrollY:0},R={pageX:0,pageY:0},I;const[Y,W]=vn(e),[P,st,H,N,Z]=hn(n,t,s,h,o,()=>S=0),q=()=>{U(e,Q)},z=a=>{U(a,Ot),o.addSubscriber(a)},X=()=>{if(c(e)){const a=e.querySelector(r);z(a||e)}},j=()=>{X(),q()},_=a=>{const p=a==null?void 0:a.querySelector(`.${Ot}`),E=p==null?void 0:p.parentElement;return p&&E&&nt(E,It)&&!E.isSameNode(s)?null:p},$=a=>{const p=_(a)??a;p&&c(a)&&($t(p,"onmousedown",M("mousemove","mouseup")),$t(p,"ontouchstart",M("touchmove","touchend")),et(p)),a!=null&&a.isSameNode(p)||$t(a,"onmousedown",x),U(s,It)},et=a=>{const p=a.querySelectorAll("img");Array.from(p).forEach(E=>{E.onmousedown=()=>!1})},ot=()=>{if(R.pageX==0&&R.pageY==0||!i.current)return;const{droppable:a,config:p}=i.current;Y(e,a,R,p.direction),P(e,Nt,y,i.current)},ut=(a,p)=>{p&&S==2&&!(a!=null&&a.droppable.isSameNode(p.droppable))&&P(e,Nt,y,p)},i=new Cn(e,h,s,ot,ut,n.mapFrom),f=a=>{if(!i.current)return;const p=h?Array.from(document.querySelectorAll(pt(h))):[s];for(const E of p)E.classList.toggle(O,!a&&E.isSameNode(i.current.droppable))},g=a=>{i.updateConfig(a);const p=i.isOutside(a);f(p),S===1?ft(a):S===2&&(D(p),Dt(a))},D=(a=!0)=>{if(!i.current)return;const{droppable:p}=i.current;gn(p,s,h,u,a),!a&&Gt(e,s,S==1,i.current)},C=a=>{if(Xt(a)&&a.cancelable)a.preventDefault();else if(Xt(a))return;const p=_t(a);g(p)},b=(a,p)=>{a=="touchmove"?I=setTimeout(()=>{p()},200):p()},T=(a,p)=>{const{clientX:E,clientY:dt}=a,rt=document.elementFromPoint(E,dt),vt=rt==null?void 0:rt.closest(`.${Q}`);return rt&&p&&vt&&!p.isSameNode(vt)},A=a=>{const p=n.onGetValue(t);return{index:t,element:a,value:p}},M=(a,p)=>E=>{if(T(E,e))return;lt.updateScrolls(s,h);const{scrollX:dt,scrollY:rt}=window;if(y={scrollX:dt,scrollY:rt},S===0){S=1;const vt=A(e);vt&&F(vt),b(a,()=>{a=="touchmove"&&(i.updateConfig(E),f(i.isOutside(E)),ft(E)),document.addEventListener(a,C,{passive:!1})}),ct(s),document.addEventListener(p,G(a),{once:!0})}},x=a=>i.updateConfig(a),G=a=>p=>{f(!0);const E=_t(p);clearTimeout(I),At(i.isOutside(E,!1)),document.removeEventListener(a,C),i.updateConfig(E);const dt=i.getCurrentConfig(E);if(dt){const{droppable:rt}=dt;J(rt)}s.onscroll=null},J=a=>{if(a.onscroll=null,!h)return;const p=Array.from(document.querySelectorAll(pt(h)));for(const E of p)it(E)&&(E.onscroll=null)},ft=a=>{Gt(e,s,S==1,i.current),St(),P(e,fe,y,i.current),wt(e),W(a,e)},St=()=>{S=2},Dt=a=>{const{pageX:p,pageY:E}=a;R={pageX:p,pageY:E},ot()},ct=a=>le(a,"onscroll",Pt),Pt=()=>ot(),At=a=>{if(S!==2){S=0;return}S=3,xt(e),P(e,zt,y,a?i.initial:i.current,t)},xt=a=>{Ft(a,u,de),Tt(a,0,0)},wt=a=>{const{height:p,width:E}=a.getBoundingClientRect();ue(a,{fixedHeight:`${p}px`,fixedWidth:`${E}px`}),Z(a,!0),gt(a,m,!0),a.style.transition=""},Bt=a=>{if(!i.initial)return;const p=i.initial;a==t&&(U(e,v),setTimeout(()=>{B(t),Ct(e,v),Gt(e,s,S==1,i.initial),st(a,e,p,E=>{xt(E),N(e)})},d))},Se=(a,p)=>{(a===t||a===n.onGetLegth()&&t===a-1)&&H(a,e,s,p,()=>{fn(e,S==1,i.initial)})};return j(),$(e),[Bt,Se]}const An=(e,t)=>{e&&Te(t,e)},xn=()=>{Ie(document.body,[`.${Q}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Ot}{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;}",`.${Ht}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,`.${Yt}{pointer-events:none!important;}`,`.${Wt}{pointer-events:none!important;}`,`.${se}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"])};function wn(e,t,n,s="index"){const o=s;let r=[],c=[];const{droppableGroup:l}=e;if(!n)return[r,c];const u=yt(l).map(d=>`droppable-group-${d}`).join(" ");xn(),An(u,n);for(const d of n.children){const m=d.getAttribute(o),v=Ce(m),B=d;if(B&&v>=0){const[O,F]=yn(B,v,e,n,t);r.push(O),c.push(F)}}return[r,c]}function Bn(e,t,n,s="index"){let o=[],r=[];const c=Sn(e,n),l=h=>{for(const S of o)S(h)},u=(h,S)=>{if(c.onGetLegth()===0)e.insertToListEmpty(c,h,S);else for(const R of r)R(h,S)},d=h=>{const[S,y]=wn(c,t,h,s);o=S,r=y},m=h=>{const S=h.addedNodes.values().filter(R=>!ee(R)).toArray(),y=h.removedNodes.values().filter(R=>!ee(R)).toArray();return S.length>0||y.length>0},v=h=>{kt(()=>{d(h)},h,{childList:!0},m)},B=h=>{U(h,It)},O=h=>{lt.addConfig(h,c)};return[l,u,h=>{h&&(B(h),O(h),v(h),d(h),lt.removeObsoleteConfigs())}]}exports.GRAB_CLASS=oe;exports.addClass=U;exports.dragAndDrop=Bn;exports.insertToListEmpty=mn;exports.toggleClass=gt;
|