@dnd-kit/core
Advanced tools
Comparing version 4.0.0-next-202162115243 to 4.0.0-next-2021621163226
# @dnd-kit/core | ||
## 4.0.0-next-202162115243 | ||
## 4.0.0-next-2021621163226 | ||
@@ -14,2 +14,8 @@ ### Major Changes | ||
- [#350](https://github.com/clauderic/dnd-kit/pull/350) [`a13dbb6`](https://github.com/clauderic/dnd-kit/commit/a13dbb66586edbf2998c7b251e236604255fd227) Thanks [@wmain](https://github.com/wmain)! - Breaking change: The `CollisionDetection` interface has been refactored. It now receives an object that contains the `active` draggable node, along with the `collisionRect` and an array of `droppableContainers`. | ||
If you've built custom collision detection algorithms, you'll need to update them. Refer to [this PR](https://github.com/clauderic/dnd-kit/pull/350) for examples of how to refactor collision detection functions to the new `CollisionDetection` interface. | ||
The `sortableKeyboardCoordinates` method has also been updated since it relies on the `closestCorners` collision detection algorithm. If you were using collision detection strategies in a custom `sortableKeyboardCoordinates` method, you'll need to update those as well. | ||
### Minor Changes | ||
@@ -24,3 +30,3 @@ | ||
- Updated dependencies [[`13be602`](https://github.com/clauderic/dnd-kit/commit/13be602229c6d5723b3ae98bca7b8f45f0773366)]: | ||
- @dnd-kit/utilities@2.1.0-next-202162115243 | ||
- @dnd-kit/utilities@2.1.0-next-2021621163226 | ||
@@ -27,0 +33,0 @@ ## 3.1.1 |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-dom"),o=require("@dnd-kit/utilities"),a=require("@dnd-kit/accessibility");const s={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},i={onDragStart:e=>`Picked up draggable item ${e}.`,onDragOver:(e,t)=>t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`,onDragEnd:(e,t)=>t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`,onDragCancel:e=>`Dragging was cancelled. Draggable item ${e} was dropped.`};var l;!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(l||(l={}));const c=e=>u(e,(e,t)=>e<t);function u(e,t){if(0===e.length)return-1;let n=e[0],r=0;for(var o=1;o<e.length;o++)t(e[o],n)&&(r=o,n=e[o]);return r}function d(...e){}function f(e,t){const{[e]:n,...r}=t;return r}const p=t.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:d,draggableNodes:{},droppableRects:new Map,droppableContainers:{},over:null,overlayNode:{nodeRef:{current:null},rect:null,setRef:d},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:d,windowRect:null,willRecomputeLayouts:!1}),h=Object.freeze({x:0,y:0});function g(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function v(e,t){if(e instanceof KeyboardEvent)return"0 0";const n=o.getEventCoordinates(e);return`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`}function y(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+.5*e.width,y:n+.5*e.height}}function b(e){return function(t,...n){return n.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x,offsetLeft:t.offsetLeft+e*n.x,offsetTop:t.offsetTop+e*n.y}),{...t})}}const m=b(1);function x(e){const t=[];return e?function e(n){return n?n instanceof Document&&null!=n.scrollingElement?(t.push(n.scrollingElement),t):!(n instanceof HTMLElement)||n instanceof SVGElement?t:(function(e){const t=window.getComputedStyle(e),n=/(auto|scroll|overlay)/;return null!=["overflow","overflowX","overflowY"].find(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(n)&&t.push(n),e(n.parentNode)):t}(e.parentNode):t}function w(e){return o.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function D(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var R;function C(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(R||(R={}));const E={x:.2,y:.2};function M(e,t,{top:n,left:r,right:a,bottom:s},i=10,l=E){const{clientHeight:c,clientWidth:u}=e,d=(f=e,o.canUseDOM&&f&&f===document.scrollingElement?{top:0,left:0,right:u,bottom:c,width:u,height:c}:t);var f;const{isTop:p,isBottom:h,isLeft:g,isRight:v}=C(e),y={x:0,y:0},b={x:0,y:0},m=d.height*l.y,x=d.width*l.x;return!p&&n<=d.top+m?(y.y=R.Backward,b.y=i*Math.abs((d.top+m-n)/m)):!h&&s>=d.bottom-m&&(y.y=R.Forward,b.y=i*Math.abs((d.bottom-m-s)/m)),!v&&a>=d.right-x?(y.x=R.Forward,b.x=i*Math.abs((d.right-x-a)/x)):!g&&r<=d.left+x&&(y.x=R.Backward,b.x=i*Math.abs((d.left+x-r)/x)),{direction:y,speed:b}}function S(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function L(e){return e.reduce((e,t)=>o.add(e,D(t)),h)}function N(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=function e(t,n,r=h){if(!(t&&t instanceof HTMLElement))return r;const o={x:r.x+t.offsetLeft,y:r.y+t.offsetTop};return t.offsetParent===n?o:e(t.offsetParent,n,o)}(e,null);return{width:t,height:n,offsetTop:o,offsetLeft:r}}function A(e){if(e instanceof Window){const e=window.innerWidth,t=window.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t,offsetTop:0,offsetLeft:0}}const{offsetTop:t,offsetLeft:n}=N(e),{width:r,height:o,top:a,bottom:s,left:i,right:l}=e.getBoundingClientRect();return{width:r,height:o,top:a,bottom:s,right:l,left:i,offsetTop:t,offsetLeft:n}}function T(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=N(e),a=L(x(e)),s=r-a.y,i=o-a.x;return{width:t,height:n,top:s,bottom:s+n,right:i+t,left:i,offsetTop:r,offsetLeft:o}}function K(e){return"top"in e}function O(e,t=e.offsetLeft,n=e.offsetTop){return[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}const B=(e,t)=>{const n=e.map(([e,n])=>function(e,t){const n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),a=Math.min(t.top+t.height,e.offsetTop+e.height);if(r<o&&n<a){const s=(o-r)*(a-n);return Number((s/(t.width*t.height+e.width*e.height-s)).toFixed(4))}return 0}(n,t)),r=u(n,(e,t)=>e>t);return n[r]<=0?null:e[r]?e[r][0]:null};function I(e){return e instanceof HTMLElement?e.ownerDocument:document}function k(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}}}function P(e,t){switch(t.type){case l.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case l.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case l.DragEnd:case l.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case l.RegisterDroppable:{const{element:n}=t,{id:r}=n;return{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[r]:n}}}}case l.SetDroppableDisabled:{const{id:n,disabled:r}=t,o=e.droppable.containers[n];return o?{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[n]:{...o,disabled:r}}}}:e}case l.UnregisterDroppable:{const{id:n}=t;return{...e,droppable:{...e.droppable,containers:f(n,e.droppable.containers)}}}default:return e}}const j=t.createContext({type:null,event:null});function q({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:a}){const s=t.useContext(j),i=t.useRef(s);t.useEffect(()=>{if(s!==i.current){const{type:t,event:c}=s;switch(t){case l.DragStart:null==e||e(c);break;case l.DragMove:null==n||n(c);break;case l.DragOver:null==r||r(c);break;case l.DragCancel:null==a||a(c);break;case l.DragEnd:null==o||o(c)}i.current=s}},[s,e,n,r,o,a])}function U({announcements:e=i,hiddenTextDescribedById:s,screenReaderInstructions:l}){const{announce:c,announcement:u}=a.useAnnouncement(),d=o.useUniqueId("DndLiveRegion"),[f,p]=t.useState(!1);return t.useEffect(()=>{p(!0)},[]),q(t.useMemo(()=>({onDragStart({active:t}){c(e.onDragStart(t.id))},onDragMove({active:t,over:n}){e.onDragMove&&c(e.onDragMove(t.id,null==n?void 0:n.id))},onDragOver({active:t,over:n}){c(e.onDragOver(t.id,null==n?void 0:n.id))},onDragEnd({active:t,over:n}){c(e.onDragEnd(t.id,null==n?void 0:n.id))},onDragCancel({active:t}){c(e.onDragCancel(t.id))}}),[c,e])),f?r.createPortal(n.createElement(n.Fragment,null,n.createElement(a.HiddenText,{id:s,value:l.draggable}),n.createElement(a.LiveRegion,{id:d,announcement:u})),document.body):null}var H,z,W;function F(e){const n=t.useRef(e);return o.useIsomorphicLayoutEffect(()=>{n.current!==e&&(n.current=e)},[e]),n}(H=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[H.Pointer=0]="Pointer",H[H.DraggableRect=1]="DraggableRect",(z=exports.TraversalOrder||(exports.TraversalOrder={}))[z.TreeOrder=0]="TreeOrder",z[z.ReversedTreeOrder=1]="ReversedTreeOrder",(W=exports.LayoutMeasuringStrategy||(exports.LayoutMeasuringStrategy={}))[W.Always=0]="Always",W[W.BeforeDragging=1]="BeforeDragging",W[W.WhileDragging=2]="WhileDragging",(exports.LayoutMeasuringFrequency||(exports.LayoutMeasuringFrequency={})).Optimized="optimized";const $=new Map,X={strategy:exports.LayoutMeasuringStrategy.WhileDragging,frequency:exports.LayoutMeasuringFrequency.Optimized},Y=[],_=J(A),V=Q(A),G=J(T);function J(e){return function(n,r){const a=t.useRef(n);return o.useLazyMemo(t=>n?r||!t&&n||n!==a.current?n instanceof HTMLElement&&null==n.parentNode?null:e(n):null!=t?t:null:null,[n,r])}}function Q(e){const n=[];return function(r,a){const s=t.useRef(r);return o.useLazyMemo(t=>r.length?a||!t&&r.length||r!==s.current?r.map(t=>e(t)):null!=t?t:n:n,[r,a])}}class Z{constructor(e){this.target=e,this.listeners=[]}add(e,t,n){this.target.addEventListener(e,t,n),this.listeners.push({eventName:e,handler:t})}removeAll(){this.listeners.forEach(({eventName:e,handler:t})=>this.target.removeEventListener(e,t))}}function ee(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var te;(te=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",te.Down="ArrowDown",te.Right="ArrowRight",te.Left="ArrowLeft",te.Up="ArrowUp",te.Esc="Escape",te.Enter="Enter";const ne={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},re=(e,{currentCoordinates:t})=>{switch(e.code){case exports.KeyboardCode.Right:return{...t,x:t.x+25};case exports.KeyboardCode.Left:return{...t,x:t.x-25};case exports.KeyboardCode.Down:return{...t,y:t.y+25};case exports.KeyboardCode.Up:return{...t,y:t.y-25}}};class oe{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=h;const{event:{target:t}}=e;this.props=e,this.listeners=new Z(I(t)),this.windowListeners=new Z(function(e){var t;return null!=(t=I(e).defaultView)?t:window}(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),setTimeout(()=>{this.listeners.add("keydown",this.handleKeyDown),this.windowListeners.add("resize",this.handleCancel)})}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const n=A(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(e instanceof KeyboardEvent){const{coordinates:t}=this,{active:n,context:r,options:a}=this.props,{keyboardCodes:s=ne,coordinateGetter:i=re,scrollBehavior:l="smooth"}=a,{code:c}=e;if(s.end.includes(c))return void this.handleEnd(e);if(s.cancel.includes(c))return void this.handleCancel(e);const u=i(e,{active:n,context:r.current,currentCoordinates:t});if(u){const n={x:0,y:0},{scrollableAncestors:a}=r.current;for(const r of a){const a=e.code,s=o.subtract(u,t),{isTop:i,isRight:c,isLeft:d,isBottom:f,maxScroll:p,minScroll:h}=C(r),g=S(r),v={x:Math.min(a===exports.KeyboardCode.Right?g.right-g.width/2:g.right,Math.max(a===exports.KeyboardCode.Right?g.left:g.left+g.width/2,u.x)),y:Math.min(a===exports.KeyboardCode.Down?g.bottom-g.height/2:g.bottom,Math.max(a===exports.KeyboardCode.Down?g.top:g.top+g.height/2,u.y))},y=a===exports.KeyboardCode.Right&&!c||a===exports.KeyboardCode.Left&&!d,b=a===exports.KeyboardCode.Down&&!f||a===exports.KeyboardCode.Up&&!i;if(y&&v.x!==u.x){if(a===exports.KeyboardCode.Right&&r.scrollLeft+s.x<=p.x||a===exports.KeyboardCode.Left&&r.scrollLeft+s.x>=h.x)return void r.scrollBy({left:s.x,behavior:l});n.x=a===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-h.x,r.scrollBy({left:-n.x,behavior:l});break}if(b&&v.y!==u.y){if(a===exports.KeyboardCode.Down&&r.scrollTop+s.y<=p.y||a===exports.KeyboardCode.Up&&r.scrollTop+s.y>=h.y)return void r.scrollBy({top:s.y,behavior:l});n.y=a===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-h.y,r.scrollBy({top:-n.y,behavior:l});break}}this.handleMove(e,o.add(u,n))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t),this.coordinates=t}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function ae(e){return Boolean(e&&"distance"in e)}function se(e){return Boolean(e&&"delay"in e)}var ie;oe.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=ne,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}],function(e){e.Keydown="keydown"}(ie||(ie={}));class le{constructor(e,t,n=function(e){return e instanceof EventTarget?e:I(e)}(e.event.target)){this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:r}=e;this.props=e,this.events=t,this.ownerDocument=I(r.target),this.listeners=new Z(n),this.initialCoordinates=o.getEventCoordinates(r),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,!1),this.listeners.add(e.end.name,this.handleEnd),this.ownerDocument.addEventListener(ie.Keydown,this.handleKeydown),t){if(ae(t))return;if(se(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(ie.Keydown,this.handleKeydown),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,t(e))}handleMove(e){const{activated:t,initialCoordinates:n,props:r}=this,{onMove:a,options:{activationConstraint:s}}=r;if(!n)return;const i=o.getEventCoordinates(e),l=o.subtract(n,i);if(!t&&s){if(se(s))return ee(l,s.tolerance)?this.handleCancel():void 0;if(ae(s))return ee(l,s.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),a(i)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===exports.KeyboardCode.Esc&&this.handleCancel()}}const ce={move:{name:"pointermove"},end:{name:"pointerup"}};class ue extends le{constructor(e){const{event:t}=e,n=I(t.target);super(e,ce,n)}}ue.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const de={move:{name:"mousemove"},end:{name:"mouseup"}};var fe;!function(e){e[e.RightClick=2]="RightClick"}(fe||(fe={}));class pe extends le{constructor(e){super(e,de,I(e.event.target))}}pe.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==fe.RightClick&&(null==t||t({event:e}),!0)}];const he={move:{name:"touchmove"},end:{name:"touchend"}};class ge extends le{constructor(e){super(e,he)}}function ve(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return t instanceof HTMLElement?t:e}function ye(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}ge.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}];const be=[{sensor:ue,options:{}},{sensor:oe,options:{}}],me={current:{}},xe=t.createContext({...h,scaleX:1,scaleY:1}),we=t.memo((function({id:e,autoScroll:a=!0,announcements:i,children:c,sensors:u=be,collisionDetection:d=B,layoutMeasuring:f,modifiers:g,screenReaderInstructions:v=s,...y}){var b,R,C;const E=t.useReducer(P,void 0,k),[S,A]=E,[T,K]=t.useState(()=>({type:null,event:null})),[O,I]=t.useState(!1),{draggable:{active:q,nodes:H,translate:z},droppable:{containers:W}}=S,F=q?H[q]:null,J=t.useRef({initial:null,translated:null}),Q=t.useMemo(()=>{var e;return null!=q?{id:q,data:null!=(e=null==F?void 0:F.data)?e:me,rect:J}:null},[q,F]),Z=t.useRef(null),[ee,te]=t.useState(null),[ne,re]=t.useState(null),oe=t.useRef(y),ae=o.useUniqueId("DndDescribedBy",e),{layoutRectMap:se,recomputeLayouts:ie,willRecomputeLayouts:le}=function(e,{dragging:n,dependencies:r,config:a}){const[s,i]=t.useState(!1),{frequency:l,strategy:c}=(u=a)?{...X,...u}:X;var u;const d=t.useRef(e),f=t.useCallback(()=>i(!0),[]),p=t.useRef(null),h=function(){switch(c){case exports.LayoutMeasuringStrategy.Always:return!1;case exports.LayoutMeasuringStrategy.BeforeDragging:return n;default:return!n}}(),g=o.useLazyMemo(t=>{if(h&&!n)return $;if(!t||t===$||d.current!==e||s){for(let t of Object.values(e))t&&(t.rect.current=t.node.current?N(t.node.current):null);return function(e){const t=new Map;if(e)for(const n of Object.values(e)){if(!n)continue;const{id:e,rect:r,disabled:o}=n;o||null==r.current||t.set(e,r.current)}return t}(e)}return t},[e,n,h,s]);return t.useEffect(()=>{d.current=e},[e]),t.useEffect(()=>{s&&i(!1)},[s]),t.useEffect((function(){h||requestAnimationFrame(f)}),[n,h]),t.useEffect((function(){h||"number"!=typeof l||null!==p.current||(p.current=setTimeout(()=>{f(),p.current=null},l))}),[l,h,f,...r]),{layoutRectMap:g,recomputeLayouts:f,willRecomputeLayouts:s}}(W,{dragging:O,dependencies:[z.x,z.y],config:f}),ce=function(e,t){const n=null!==t?e[t]:void 0,r=n?n.node.current:null;return o.useLazyMemo(e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(H,q),ue=ne?o.getEventCoordinates(ne):null,de=G(ce),fe=_(ce),pe=t.useRef(null),he=(we=pe.current,(ge=de)&&we?{x:ge.left-we.left,y:ge.top-we.top}:h);var ge,we;const De=t.useRef({active:null,activeNode:ce,collisionRect:null,droppableRects:se,draggableNodes:H,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),Re=function(e,t){var n,r;return e&&null!=(n=null==(r=t[e])?void 0:r.node.current)?n:null}(null!=(b=null==(R=De.current.over)?void 0:R.id)?b:null,W),Ce=_(ce?ce.ownerDocument.defaultView:null),Ee=_(ce?ce.parentElement:null),Me=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:x(e):Y,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(q?null!=Re?Re:ce:null),Se=V(Me),[Le,Ne]=o.useNodeRef(),Ae=_(q?ve(Le.current):null,le),Te=null!=Ae?Ae:de,Ke=ye(g,{transform:{x:z.x-he.x,y:z.y-he.y,scaleX:1,scaleY:1},activatorEvent:ne,active:Q,activeNodeRect:fe,containerNodeRect:Ee,draggingNodeRect:Te,over:De.current.over,overlayNodeRect:Ae,scrollableAncestors:Me,scrollableAncestorRects:Se,windowRect:Ce}),Oe=ue?o.add(ue,z):null,Be=function(e){const[n,r]=t.useState(null),a=t.useRef(e),s=t.useCallback(e=>{const t=w(e.target);t&&r(e=>e?(e.set(t,D(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=a.current;if(e!==t){n(t);const o=e.map(e=>{const t=w(e);return t?(t.addEventListener("scroll",s,{passive:!0}),[t,D(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),a.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=w(e);null==t||t.removeEventListener("scroll",s)})}},[s,e]),t.useMemo(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>o.add(e,t),h):L(e):h,[e,n])}(Me),Ie=o.add(Ke,Be),ke=Ae&&de?{...de,height:Ae.height,width:Ae.width}:de,Pe=ke?m(ke,Ke):null,je=Pe?m(Pe,Be):null,qe=function(e,t){var n;return e&&null!=(n=t[e])?n:null}(Q&&je?d(Array.from(se.entries()),je):null,W),Ue=t.useMemo(()=>qe&&qe.rect.current?{id:qe.id,rect:qe.rect.current,data:qe.data,disabled:qe.disabled}:null,[qe]),He=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Ke,null!=(C=null==qe?void 0:qe.rect.current)?C:null,de),ze=t.useCallback((e,{sensor:t,options:n})=>{if(!Z.current)return;const o=H[Z.current];if(!o)return;const a=new t({active:Z.current,activeNode:o,event:e.nativeEvent,options:n,context:De,onStart(e){const t=Z.current;if(!t)return;const n=H[t];if(!n)return;const{onDragStart:o}=oe.current,a={active:{id:t,data:n.data,rect:J}};r.unstable_batchedUpdates(()=>{A({type:l.DragStart,initialCoordinates:e,active:t}),K({type:l.DragStart,event:a})}),null==o||o(a)},onMove(e){A({type:l.DragMove,coordinates:e})},onEnd:s(l.DragEnd),onCancel:s(l.DragCancel)});function s(e){return async function(){const{active:t,over:n,scrollAdjustedTranslate:o}=De.current;let a=null;if(t&&o){const{cancelDrop:r}=oe.current;a={active:t,delta:o,over:n},e===l.DragEnd&&"function"==typeof r&&await Promise.resolve(r(a))&&(e=l.DragCancel)}if(Z.current=null,r.unstable_batchedUpdates(()=>{A({type:e}),I(!1),te(null),re(null),a&&K({type:e,event:a})}),a){const{onDragCancel:t,onDragEnd:n}=oe.current,r=e===l.DragEnd?n:t;null==r||r(a)}}}r.unstable_batchedUpdates(()=>{te(a),re(e.nativeEvent)})},[A,H]),We=function(e,n){return t.useMemo(()=>e.reduce((e,t)=>{const{sensor:r}=t;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}))]},[]),[e,n])}(u,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==Z.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},Z.current=r,ze(n,t))},[ze]));o.useIsomorphicLayoutEffect(()=>{oe.current=y},Object.values(y)),t.useEffect(()=>{null!=q&&I(!0)},[q]),t.useEffect(()=>{Q||(pe.current=null),Q&&de&&!pe.current&&(pe.current=de)},[de,Q]),t.useEffect(()=>{const{onDragMove:e}=oe.current,{active:t,over:n}=De.current;if(!t)return;const r={active:t,delta:{x:Ie.x,y:Ie.y},over:n};K({type:l.DragMove,event:r}),null==e||e(r)},[Ie.x,Ie.y]),t.useEffect(()=>{const{active:e,scrollAdjustedTranslate:t}=De.current;if(!e||!Z.current||!t)return;const{onDragOver:n}=oe.current,r={active:e,delta:{x:t.x,y:t.y},over:Ue};K({type:l.DragOver,event:r}),null==n||n(r)},[null==Ue?void 0:Ue.id]),o.useIsomorphicLayoutEffect(()=>{De.current={active:Q,activeNode:ce,collisionRect:je,droppableRects:se,draggableNodes:H,draggingNodeRect:Te,droppableContainers:W,over:Ue,scrollableAncestors:Me,scrollAdjustedTranslate:Ie,translatedRect:Pe},J.current={initial:Te,translated:Pe}},[Q,ce,je,H,Te,se,W,Ue,Me,Ie,Pe]),function({acceleration:e,activator:n=exports.AutoScrollActivator.Pointer,canScroll:r,draggingRect:a,enabled:s,interval:i=5,order:l=exports.TraversalOrder.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,threshold:f}){const[p,g]=o.useInterval(),v=t.useRef({x:1,y:1}),y=t.useMemo(()=>{switch(n){case exports.AutoScrollActivator.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case exports.AutoScrollActivator.DraggableRect:return a}return null},[n,a,c]),b=t.useRef(h),m=t.useRef(null),x=t.useCallback(()=>{const e=m.current;e&&e.scrollBy(v.current.x*b.current.x,v.current.y*b.current.y)},[]),w=t.useMemo(()=>l===exports.TraversalOrder.TreeOrder?[...u].reverse():u,[l,u]);t.useEffect(()=>{if(s&&u.length&&y){for(const t of w){if(!1===(null==r?void 0:r(t)))continue;const n=u.indexOf(t),o=d[n];if(!o)continue;const{direction:a,speed:s}=M(t,o,y,e,f);if(s.x>0||s.y>0)return g(),m.current=t,p(x,i),v.current=s,void(b.current=a)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,x,r,g,s,i,JSON.stringify(y),p,u,w,d,JSON.stringify(f)])}({...function(){const e=!(!1===(null==ee?void 0:ee.autoScrollEnabled)||("object"==typeof a?!1===a.enabled:!1===a));return"object"==typeof a?{...a,enabled:e}:{enabled:e}}(),draggingRect:Pe,pointerCoordinates:Oe,scrollableAncestors:Me,scrollableAncestorRects:Se});const Fe=t.useMemo(()=>({active:Q,activeNode:ce,activeNodeRect:de,activeNodeClientRect:fe,activatorEvent:ne,activators:We,ariaDescribedById:{draggable:ae},overlayNode:{nodeRef:Le,rect:Ae,setRef:Ne},containerNodeRect:Ee,dispatch:A,draggableNodes:H,droppableContainers:W,droppableRects:se,over:Ue,recomputeLayouts:ie,scrollableAncestors:Me,scrollableAncestorRects:Se,willRecomputeLayouts:le,windowRect:Ce}),[Q,ce,fe,de,ne,We,Ee,Ae,Le,A,H,ae,W,se,Ue,ie,Me,Se,Ne,le,Ce]);return n.createElement(j.Provider,{value:T},n.createElement(p.Provider,{value:Fe},n.createElement(xe.Provider,{value:He},c)),n.createElement(U,{announcements:i,hiddenTextDescribedById:ae,screenReaderInstructions:v}))})),De=t.createContext(null),Re="button";function Ce(){return t.useContext(p)}const Ee=e=>e instanceof KeyboardEvent?"transform 250ms ease":void 0,Me={duration:250,easing:"ease",dragSourceOpacity:0},Se=n.memo(({adjustScale:e=!1,children:r,dropAnimation:a=Me,style:s,transition:i=Ee,modifiers:l,wrapperElement:c="div",className:u,zIndex:d=999})=>{var f,p;const{active:h,activeNodeRect:g,activeNodeClientRect:y,containerNodeRect:b,draggableNodes:m,activatorEvent:x,over:w,overlayNode:D,scrollableAncestors:R,scrollableAncestorRects:C,windowRect:E}=Ce(),M=t.useContext(xe),S=ye(l,{activatorEvent:x,active:h,activeNodeRect:y,containerNodeRect:b,draggingNodeRect:D.rect,over:w,overlayNodeRect:D.rect,scrollableAncestors:R,scrollableAncestorRects:C,transform:M,windowRect:E}),L=function(e,n,r){const a=t.useRef(n);return o.useLazyMemo(t=>{const o=a.current;if(n!==o){if(n&&o&&(o.left!==n.left||o.top!==n.top)&&!t){const t=null==r?void 0:r.getBoundingClientRect();if(t)return{...e,x:t.left-n.left,y:t.top-n.top}}a.current=n}},[n,e,r])}(S,g,D.nodeRef.current),N=null!==h,A=null!=L?L:S,K=e?A:{...A,scaleX:1,scaleY:1},O=g?{position:"fixed",width:g.width,height:g.height,top:g.top,left:g.left,zIndex:d,transform:o.CSS.Transform.toString(K),touchAction:"none",transformOrigin:e&&x?v(x,g):void 0,transition:L?void 0:"function"==typeof i?i(x):i,...s}:void 0,B=N?{style:O,children:r,className:u,transform:K}:void 0,I=t.useRef(B),k=null!=B?B:I.current,{children:P,...j}=null!=k?k:{},q=t.useRef(null!=(f=null==h?void 0:h.id)?f:null),U=function({animate:e,adjustScale:n,activeId:r,draggableNodes:a,duration:s,easing:i,dragSourceOpacity:l,node:c,transform:u}){const[d,f]=t.useState(!1);return t.useEffect(()=>{e&&r&&i&&s?requestAnimationFrame(()=>{var e;const t=null==(e=a[r])?void 0:e.node.current;if(u&&c&&t&&null!==t.parentNode){const e=ve(c);if(e){const r=e.getBoundingClientRect(),a=T(t),d={x:r.left-a.left,y:r.top-a.top};if(Math.abs(d.x)||Math.abs(d.y)){const e=o.CSS.Transform.toString({x:u.x-d.x,y:u.y-d.y,scaleX:n?a.width*u.scaleX/r.width:1,scaleY:n?a.height*u.scaleY/r.height:1}),p=t.style.opacity;return null!=l&&(t.style.opacity=""+l),void(c.animate([{transform:o.CSS.Transform.toString(u)},{transform:e}],{easing:i,duration:s}).onfinish=()=>{c.style.display="none",f(!0),t&&null!=l&&(t.style.opacity=p)})}}}f(!0)}):e&&f(!0)},[e,r,n,a,s,i,l,c,u]),o.useIsomorphicLayoutEffect(()=>{d&&f(!1)},[d]),d}({animate:Boolean(a&&q.current&&!h),adjustScale:e,activeId:q.current,draggableNodes:m,duration:null==a?void 0:a.duration,easing:null==a?void 0:a.easing,dragSourceOpacity:null==a?void 0:a.dragSourceOpacity,node:D.nodeRef.current,transform:null==(p=I.current)?void 0:p.transform}),H=Boolean(P&&(r||a&&!U));return t.useEffect(()=>{var e;(null==h?void 0:h.id)!==q.current&&(q.current=null!=(e=null==h?void 0:h.id)?e:null),h&&I.current!==B&&(I.current=B)},[h,B]),t.useEffect(()=>{U&&(I.current=void 0)},[U]),H?n.createElement(c,{...j,ref:D.setRef},P):null});exports.DndContext=we,exports.DragOverlay=Se,exports.KeyboardSensor=oe,exports.MouseSensor=pe,exports.PointerSensor=ue,exports.TouchSensor=ge,exports.applyModifiers=ye,exports.closestCenter=(e,t)=>{const n=y(t,t.left,t.top),r=e.map(([e,t])=>g(y(t),n)),o=c(r);return e[o]?e[o][0]:null},exports.closestCorners=(e,t)=>{const n=O(t,t.left,t.top),r=e.map(([e,t])=>{const r=O(t,K(t)?t.left:void 0,K(t)?t.top:void 0),o=n.reduce((e,t,n)=>e+g(r[n],t),0);return Number((o/4).toFixed(4))}),o=c(r);return e[o]?e[o][0]:null},exports.defaultAnnouncements=i,exports.defaultCoordinates=h,exports.defaultDropAnimation=Me,exports.getBoundingClientRect=A,exports.getScrollableAncestors=x,exports.getViewRect=T,exports.rectIntersection=B,exports.useDndContext=Ce,exports.useDndMonitor=q,exports.useDraggable=function({id:e,data:n,disabled:r=!1,attributes:a}){const{active:s,activeNodeRect:i,activatorEvent:l,ariaDescribedById:c,draggableNodes:u,droppableRects:d,activators:f,over:h}=t.useContext(p),{role:g=Re,roleDescription:v="draggable",tabIndex:y=0}=null!=a?a:{},b=(null==s?void 0:s.id)===e,m=t.useContext(b?xe:De),[x,w]=o.useNodeRef(),D=function(e,n){return t.useMemo(()=>e.reduce((e,{eventName:t,handler:r})=>(e[t]=e=>{r(e,n)},e),{}),[e,n])}(f,e),R=F(n);return t.useEffect(()=>(u[e]={node:x,data:R},()=>{delete u[e]}),[u,e]),{active:s,activeNodeRect:i,activatorEvent:l,attributes:t.useMemo(()=>({role:g,tabIndex:y,"aria-pressed":!(!b||g!==Re)||void 0,"aria-roledescription":v,"aria-describedby":c.draggable}),[g,y,b,v,c.draggable]),droppableRects:d,isDragging:b,listeners:r?void 0:D,node:x,over:h,setNodeRef:w,transform:m}},exports.useDroppable=function({data:e,disabled:n=!1,id:r}){const{active:a,dispatch:s,over:i}=t.useContext(p),c=t.useRef(null),[u,d]=o.useNodeRef(),f=F(e);return o.useIsomorphicLayoutEffect(()=>(s({type:l.RegisterDroppable,element:{id:r,disabled:n,node:u,rect:c,data:f}}),()=>s({type:l.UnregisterDroppable,id:r})),[r]),t.useEffect(()=>{s({type:l.SetDroppableDisabled,id:r,disabled:n})},[n]),{active:a,rect:c,isOver:(null==i?void 0:i.id)===r,node:u,over:i,setNodeRef:d}},exports.useSensor=function(e,n){return t.useMemo(()=>({sensor:e,options:null!=n?n:{}}),[e,n])},exports.useSensors=function(...e){return t.useMemo(()=>[...e].filter(e=>null!=e),[...e])}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-dom"),o=require("@dnd-kit/utilities"),a=require("@dnd-kit/accessibility");const s={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},i={onDragStart:e=>`Picked up draggable item ${e}.`,onDragOver:(e,t)=>t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`,onDragEnd:(e,t)=>t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`,onDragCancel:e=>`Dragging was cancelled. Draggable item ${e} was dropped.`};var l;function c(...e){}function u(e,t){const{[e]:n,...r}=t;return r}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(l||(l={}));const d=t.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:c,draggableNodes:{},droppableRects:new Map,droppableContainers:{},over:null,overlayNode:{nodeRef:{current:null},rect:null,setRef:c},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:c,windowRect:null,willRecomputeLayouts:!1}),f=Object.freeze({x:0,y:0});function p(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function h(e,t){if(e instanceof KeyboardEvent)return"0 0";const n=o.getEventCoordinates(e);return`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`}function g(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+.5*e.width,y:n+.5*e.height}}function v(e){return function(t,...n){return n.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x,offsetLeft:t.offsetLeft+e*n.x,offsetTop:t.offsetTop+e*n.y}),{...t})}}const y=v(1);function b(e){const t=[];return e?function e(n){return n?n instanceof Document&&null!=n.scrollingElement?(t.push(n.scrollingElement),t):!(n instanceof HTMLElement)||n instanceof SVGElement?t:(function(e){const t=window.getComputedStyle(e),n=/(auto|scroll|overlay)/;return null!=["overflow","overflowX","overflowY"].find(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(n)&&t.push(n),e(n.parentNode)):t}(e.parentNode):t}function m(e){return o.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function x(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var w;function D(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(w||(w={}));const R={x:.2,y:.2};function C(e,t,{top:n,left:r,right:a,bottom:s},i=10,l=R){const{clientHeight:c,clientWidth:u}=e,d=(f=e,o.canUseDOM&&f&&f===document.scrollingElement?{top:0,left:0,right:u,bottom:c,width:u,height:c}:t);var f;const{isTop:p,isBottom:h,isLeft:g,isRight:v}=D(e),y={x:0,y:0},b={x:0,y:0},m=d.height*l.y,x=d.width*l.x;return!p&&n<=d.top+m?(y.y=w.Backward,b.y=i*Math.abs((d.top+m-n)/m)):!h&&s>=d.bottom-m&&(y.y=w.Forward,b.y=i*Math.abs((d.bottom-m-s)/m)),!v&&a>=d.right-x?(y.x=w.Forward,b.x=i*Math.abs((d.right-x-a)/x)):!g&&r<=d.left+x&&(y.x=w.Backward,b.x=i*Math.abs((d.left+x-r)/x)),{direction:y,speed:b}}function E(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function M(e){return e.reduce((e,t)=>o.add(e,x(t)),f)}function S(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=function e(t,n,r=f){if(!(t&&t instanceof HTMLElement))return r;const o={x:r.x+t.offsetLeft,y:r.y+t.offsetTop};return t.offsetParent===n?o:e(t.offsetParent,n,o)}(e,null);return{width:t,height:n,offsetTop:o,offsetLeft:r}}function L(e){if(e instanceof Window){const e=window.innerWidth,t=window.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t,offsetTop:0,offsetLeft:0}}const{offsetTop:t,offsetLeft:n}=S(e),{width:r,height:o,top:a,bottom:s,left:i,right:l}=e.getBoundingClientRect();return{width:r,height:o,top:a,bottom:s,right:l,left:i,offsetTop:t,offsetLeft:n}}function N(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=S(e),a=M(b(e)),s=r-a.y,i=o-a.x;return{width:t,height:n,top:s,bottom:s+n,right:i+t,left:i,offsetTop:r,offsetLeft:o}}function T(e){return"top"in e}function A(e,t=e.offsetLeft,n=e.offsetTop){return[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}function K(e,t){const n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),a=Math.min(t.top+t.height,e.offsetTop+e.height);if(r<o&&n<a){const s=(o-r)*(a-n);return Number((s/(t.width*t.height+e.width*e.height-s)).toFixed(4))}return 0}const O=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(const o of t){const{rect:{current:t}}=o;if(t){const a=K(t,e);a>n&&(n=a,r=o.id)}}return r};function B(e){return e instanceof HTMLElement?e.ownerDocument:document}function I(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}}}function k(e,t){switch(t.type){case l.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case l.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case l.DragEnd:case l.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case l.RegisterDroppable:{const{element:n}=t,{id:r}=n;return{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[r]:n}}}}case l.SetDroppableDisabled:{const{id:n,disabled:r}=t,o=e.droppable.containers[n];return o?{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[n]:{...o,disabled:r}}}}:e}case l.UnregisterDroppable:{const{id:n}=t;return{...e,droppable:{...e.droppable,containers:u(n,e.droppable.containers)}}}default:return e}}const P=t.createContext({type:null,event:null});function j({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:a}){const s=t.useContext(P),i=t.useRef(s);t.useEffect(()=>{if(s!==i.current){const{type:t,event:c}=s;switch(t){case l.DragStart:null==e||e(c);break;case l.DragMove:null==n||n(c);break;case l.DragOver:null==r||r(c);break;case l.DragCancel:null==a||a(c);break;case l.DragEnd:null==o||o(c)}i.current=s}},[s,e,n,r,o,a])}function q({announcements:e=i,hiddenTextDescribedById:s,screenReaderInstructions:l}){const{announce:c,announcement:u}=a.useAnnouncement(),d=o.useUniqueId("DndLiveRegion"),[f,p]=t.useState(!1);return t.useEffect(()=>{p(!0)},[]),j(t.useMemo(()=>({onDragStart({active:t}){c(e.onDragStart(t.id))},onDragMove({active:t,over:n}){e.onDragMove&&c(e.onDragMove(t.id,null==n?void 0:n.id))},onDragOver({active:t,over:n}){c(e.onDragOver(t.id,null==n?void 0:n.id))},onDragEnd({active:t,over:n}){c(e.onDragEnd(t.id,null==n?void 0:n.id))},onDragCancel({active:t}){c(e.onDragCancel(t.id))}}),[c,e])),f?r.createPortal(n.createElement(n.Fragment,null,n.createElement(a.HiddenText,{id:s,value:l.draggable}),n.createElement(a.LiveRegion,{id:d,announcement:u})),document.body):null}var U,H,z;function W(e){const n=t.useRef(e);return o.useIsomorphicLayoutEffect(()=>{n.current!==e&&(n.current=e)},[e]),n}(U=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[U.Pointer=0]="Pointer",U[U.DraggableRect=1]="DraggableRect",(H=exports.TraversalOrder||(exports.TraversalOrder={}))[H.TreeOrder=0]="TreeOrder",H[H.ReversedTreeOrder=1]="ReversedTreeOrder",(z=exports.LayoutMeasuringStrategy||(exports.LayoutMeasuringStrategy={}))[z.Always=0]="Always",z[z.BeforeDragging=1]="BeforeDragging",z[z.WhileDragging=2]="WhileDragging",(exports.LayoutMeasuringFrequency||(exports.LayoutMeasuringFrequency={})).Optimized="optimized";const F=new Map,$={strategy:exports.LayoutMeasuringStrategy.WhileDragging,frequency:exports.LayoutMeasuringFrequency.Optimized},X=[],Y=G(L),_=J(L),V=G(N);function G(e){return function(n,r){const a=t.useRef(n);return o.useLazyMemo(t=>n?r||!t&&n||n!==a.current?n instanceof HTMLElement&&null==n.parentNode?null:e(n):null!=t?t:null:null,[n,r])}}function J(e){const n=[];return function(r,a){const s=t.useRef(r);return o.useLazyMemo(t=>r.length?a||!t&&r.length||r!==s.current?r.map(t=>e(t)):null!=t?t:n:n,[r,a])}}class Q{constructor(e){this.target=e,this.listeners=[]}add(e,t,n){this.target.addEventListener(e,t,n),this.listeners.push({eventName:e,handler:t})}removeAll(){this.listeners.forEach(({eventName:e,handler:t})=>this.target.removeEventListener(e,t))}}function Z(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var ee;(ee=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",ee.Down="ArrowDown",ee.Right="ArrowRight",ee.Left="ArrowLeft",ee.Up="ArrowUp",ee.Esc="Escape",ee.Enter="Enter";const te={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},ne=(e,{currentCoordinates:t})=>{switch(e.code){case exports.KeyboardCode.Right:return{...t,x:t.x+25};case exports.KeyboardCode.Left:return{...t,x:t.x-25};case exports.KeyboardCode.Down:return{...t,y:t.y+25};case exports.KeyboardCode.Up:return{...t,y:t.y-25}}};class re{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=f;const{event:{target:t}}=e;this.props=e,this.listeners=new Q(B(t)),this.windowListeners=new Q(function(e){var t;return null!=(t=B(e).defaultView)?t:window}(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),setTimeout(()=>{this.listeners.add("keydown",this.handleKeyDown),this.windowListeners.add("resize",this.handleCancel)})}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const n=L(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(e instanceof KeyboardEvent){const{coordinates:t}=this,{active:n,context:r,options:a}=this.props,{keyboardCodes:s=te,coordinateGetter:i=ne,scrollBehavior:l="smooth"}=a,{code:c}=e;if(s.end.includes(c))return void this.handleEnd(e);if(s.cancel.includes(c))return void this.handleCancel(e);const u=i(e,{active:n,context:r.current,currentCoordinates:t});if(u){const n={x:0,y:0},{scrollableAncestors:a}=r.current;for(const r of a){const a=e.code,s=o.subtract(u,t),{isTop:i,isRight:c,isLeft:d,isBottom:f,maxScroll:p,minScroll:h}=D(r),g=E(r),v={x:Math.min(a===exports.KeyboardCode.Right?g.right-g.width/2:g.right,Math.max(a===exports.KeyboardCode.Right?g.left:g.left+g.width/2,u.x)),y:Math.min(a===exports.KeyboardCode.Down?g.bottom-g.height/2:g.bottom,Math.max(a===exports.KeyboardCode.Down?g.top:g.top+g.height/2,u.y))},y=a===exports.KeyboardCode.Right&&!c||a===exports.KeyboardCode.Left&&!d,b=a===exports.KeyboardCode.Down&&!f||a===exports.KeyboardCode.Up&&!i;if(y&&v.x!==u.x){if(a===exports.KeyboardCode.Right&&r.scrollLeft+s.x<=p.x||a===exports.KeyboardCode.Left&&r.scrollLeft+s.x>=h.x)return void r.scrollBy({left:s.x,behavior:l});n.x=a===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-h.x,r.scrollBy({left:-n.x,behavior:l});break}if(b&&v.y!==u.y){if(a===exports.KeyboardCode.Down&&r.scrollTop+s.y<=p.y||a===exports.KeyboardCode.Up&&r.scrollTop+s.y>=h.y)return void r.scrollBy({top:s.y,behavior:l});n.y=a===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-h.y,r.scrollBy({top:-n.y,behavior:l});break}}this.handleMove(e,o.add(u,n))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t),this.coordinates=t}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function oe(e){return Boolean(e&&"distance"in e)}function ae(e){return Boolean(e&&"delay"in e)}var se;re.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=te,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}],function(e){e.Keydown="keydown"}(se||(se={}));class ie{constructor(e,t,n=function(e){return e instanceof EventTarget?e:B(e)}(e.event.target)){this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:r}=e;this.props=e,this.events=t,this.ownerDocument=B(r.target),this.listeners=new Q(n),this.initialCoordinates=o.getEventCoordinates(r),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,!1),this.listeners.add(e.end.name,this.handleEnd),this.ownerDocument.addEventListener(se.Keydown,this.handleKeydown),t){if(oe(t))return;if(ae(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(se.Keydown,this.handleKeydown),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,t(e))}handleMove(e){const{activated:t,initialCoordinates:n,props:r}=this,{onMove:a,options:{activationConstraint:s}}=r;if(!n)return;const i=o.getEventCoordinates(e),l=o.subtract(n,i);if(!t&&s){if(ae(s))return Z(l,s.tolerance)?this.handleCancel():void 0;if(oe(s))return Z(l,s.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),a(i)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===exports.KeyboardCode.Esc&&this.handleCancel()}}const le={move:{name:"pointermove"},end:{name:"pointerup"}};class ce extends ie{constructor(e){const{event:t}=e,n=B(t.target);super(e,le,n)}}ce.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const ue={move:{name:"mousemove"},end:{name:"mouseup"}};var de;!function(e){e[e.RightClick=2]="RightClick"}(de||(de={}));class fe extends ie{constructor(e){super(e,ue,B(e.event.target))}}fe.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==de.RightClick&&(null==t||t({event:e}),!0)}];const pe={move:{name:"touchmove"},end:{name:"touchend"}};class he extends ie{constructor(e){super(e,pe)}}function ge(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return t instanceof HTMLElement?t:e}function ve(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}he.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}];const ye=[{sensor:ce,options:{}},{sensor:re,options:{}}],be={current:{}},me=t.createContext({...f,scaleX:1,scaleY:1}),xe=t.memo((function({id:e,autoScroll:a=!0,announcements:i,children:c,sensors:u=ye,collisionDetection:p=O,layoutMeasuring:h,modifiers:g,screenReaderInstructions:v=s,...w}){var D,R,E;const L=t.useReducer(k,void 0,I),[N,T]=L,[A,K]=t.useState(()=>({type:null,event:null})),[B,j]=t.useState(!1),{draggable:{active:U,nodes:H,translate:z},droppable:{containers:W}}=N,G=U?H[U]:null,J=t.useRef({initial:null,translated:null}),Q=t.useMemo(()=>{var e;return null!=U?{id:U,data:null!=(e=null==G?void 0:G.data)?e:be,rect:J}:null},[U,G]),Z=t.useRef(null),[ee,te]=t.useState(null),[ne,re]=t.useState(null),oe=t.useRef(w),ae=o.useUniqueId("DndDescribedBy",e),{layoutRectMap:se,recomputeLayouts:ie,willRecomputeLayouts:le}=function(e,{dragging:n,dependencies:r,config:a}){const[s,i]=t.useState(!1),{frequency:l,strategy:c}=(u=a)?{...$,...u}:$;var u;const d=t.useRef(e),f=t.useCallback(()=>i(!0),[]),p=t.useRef(null),h=function(){switch(c){case exports.LayoutMeasuringStrategy.Always:return!1;case exports.LayoutMeasuringStrategy.BeforeDragging:return n;default:return!n}}(),g=o.useLazyMemo(t=>{if(h&&!n)return F;if(!t||t===F||d.current!==e||s){for(let t of Object.values(e))t&&(t.rect.current=t.node.current?S(t.node.current):null);return function(e){const t=new Map;if(e)for(const n of Object.values(e)){if(!n)continue;const{id:e,rect:r,disabled:o}=n;o||null==r.current||t.set(e,r.current)}return t}(e)}return t},[e,n,h,s]);return t.useEffect(()=>{d.current=e},[e]),t.useEffect(()=>{s&&i(!1)},[s]),t.useEffect((function(){h||requestAnimationFrame(f)}),[n,h]),t.useEffect((function(){h||"number"!=typeof l||null!==p.current||(p.current=setTimeout(()=>{f(),p.current=null},l))}),[l,h,f,...r]),{layoutRectMap:g,recomputeLayouts:f,willRecomputeLayouts:s}}(W,{dragging:B,dependencies:[z.x,z.y],config:h}),ce=function(e,t){const n=null!==t?e[t]:void 0,r=n?n.node.current:null;return o.useLazyMemo(e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(H,U),ue=ne?o.getEventCoordinates(ne):null,de=V(ce),fe=Y(ce),pe=t.useRef(null),he=(we=pe.current,(xe=de)&&we?{x:xe.left-we.left,y:xe.top-we.top}:f);var xe,we;const De=t.useRef({active:null,activeNode:ce,collisionRect:null,droppableRects:se,draggableNodes:H,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),Re=function(e,t){var n,r;return e&&null!=(n=null==(r=t[e])?void 0:r.node.current)?n:null}(null!=(D=null==(R=De.current.over)?void 0:R.id)?D:null,W),Ce=Y(ce?ce.ownerDocument.defaultView:null),Ee=Y(ce?ce.parentElement:null),Me=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:b(e):X,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(U?null!=Re?Re:ce:null),Se=_(Me),[Le,Ne]=o.useNodeRef(),Te=Y(U?ge(Le.current):null,le),Ae=null!=Te?Te:de,Ke=ve(g,{transform:{x:z.x-he.x,y:z.y-he.y,scaleX:1,scaleY:1},activatorEvent:ne,active:Q,activeNodeRect:fe,containerNodeRect:Ee,draggingNodeRect:Ae,over:De.current.over,overlayNodeRect:Te,scrollableAncestors:Me,scrollableAncestorRects:Se,windowRect:Ce}),Oe=ue?o.add(ue,z):null,Be=function(e){const[n,r]=t.useState(null),a=t.useRef(e),s=t.useCallback(e=>{const t=m(e.target);t&&r(e=>e?(e.set(t,x(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=a.current;if(e!==t){n(t);const o=e.map(e=>{const t=m(e);return t?(t.addEventListener("scroll",s,{passive:!0}),[t,x(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),a.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=m(e);null==t||t.removeEventListener("scroll",s)})}},[s,e]),t.useMemo(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>o.add(e,t),f):M(e):f,[e,n])}(Me),Ie=o.add(Ke,Be),ke=Te&&de?{...de,height:Te.height,width:Te.width}:de,Pe=ke?y(ke,Ke):null,je=Pe?y(Pe,Be):null,qe=t.useMemo(()=>Object.values(W).filter(Boolean),[W]),Ue=function(e,t){var n;return e&&null!=(n=t[e])?n:null}(Q&&je?p({active:Q,collisionRect:je,droppableContainers:qe}):null,W),He=t.useMemo(()=>Ue&&Ue.rect.current?{id:Ue.id,rect:Ue.rect.current,data:Ue.data,disabled:Ue.disabled}:null,[Ue]),ze=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Ke,null!=(E=null==Ue?void 0:Ue.rect.current)?E:null,de),We=t.useCallback((e,{sensor:t,options:n})=>{if(!Z.current)return;const o=H[Z.current];if(!o)return;const a=new t({active:Z.current,activeNode:o,event:e.nativeEvent,options:n,context:De,onStart(e){const t=Z.current;if(!t)return;const n=H[t];if(!n)return;const{onDragStart:o}=oe.current,a={active:{id:t,data:n.data,rect:J}};r.unstable_batchedUpdates(()=>{T({type:l.DragStart,initialCoordinates:e,active:t}),K({type:l.DragStart,event:a})}),null==o||o(a)},onMove(e){T({type:l.DragMove,coordinates:e})},onEnd:s(l.DragEnd),onCancel:s(l.DragCancel)});function s(e){return async function(){const{active:t,over:n,scrollAdjustedTranslate:o}=De.current;let a=null;if(t&&o){const{cancelDrop:r}=oe.current;a={active:t,delta:o,over:n},e===l.DragEnd&&"function"==typeof r&&await Promise.resolve(r(a))&&(e=l.DragCancel)}if(Z.current=null,r.unstable_batchedUpdates(()=>{T({type:e}),j(!1),te(null),re(null),a&&K({type:e,event:a})}),a){const{onDragCancel:t,onDragEnd:n}=oe.current,r=e===l.DragEnd?n:t;null==r||r(a)}}}r.unstable_batchedUpdates(()=>{te(a),re(e.nativeEvent)})},[T,H]),Fe=function(e,n){return t.useMemo(()=>e.reduce((e,t)=>{const{sensor:r}=t;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}))]},[]),[e,n])}(u,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==Z.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},Z.current=r,We(n,t))},[We]));o.useIsomorphicLayoutEffect(()=>{oe.current=w},Object.values(w)),t.useEffect(()=>{null!=U&&j(!0)},[U]),t.useEffect(()=>{Q||(pe.current=null),Q&&de&&!pe.current&&(pe.current=de)},[de,Q]),t.useEffect(()=>{const{onDragMove:e}=oe.current,{active:t,over:n}=De.current;if(!t)return;const r={active:t,delta:{x:Ie.x,y:Ie.y},over:n};K({type:l.DragMove,event:r}),null==e||e(r)},[Ie.x,Ie.y]),t.useEffect(()=>{const{active:e,scrollAdjustedTranslate:t}=De.current;if(!e||!Z.current||!t)return;const{onDragOver:n}=oe.current,r={active:e,delta:{x:t.x,y:t.y},over:He};K({type:l.DragOver,event:r}),null==n||n(r)},[null==He?void 0:He.id]),o.useIsomorphicLayoutEffect(()=>{De.current={active:Q,activeNode:ce,collisionRect:je,droppableRects:se,draggableNodes:H,draggingNodeRect:Ae,droppableContainers:W,over:He,scrollableAncestors:Me,scrollAdjustedTranslate:Ie,translatedRect:Pe},J.current={initial:Ae,translated:Pe}},[Q,ce,je,H,Ae,se,W,He,Me,Ie,Pe]),function({acceleration:e,activator:n=exports.AutoScrollActivator.Pointer,canScroll:r,draggingRect:a,enabled:s,interval:i=5,order:l=exports.TraversalOrder.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,threshold:p}){const[h,g]=o.useInterval(),v=t.useRef({x:1,y:1}),y=t.useMemo(()=>{switch(n){case exports.AutoScrollActivator.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case exports.AutoScrollActivator.DraggableRect:return a}return null},[n,a,c]),b=t.useRef(f),m=t.useRef(null),x=t.useCallback(()=>{const e=m.current;e&&e.scrollBy(v.current.x*b.current.x,v.current.y*b.current.y)},[]),w=t.useMemo(()=>l===exports.TraversalOrder.TreeOrder?[...u].reverse():u,[l,u]);t.useEffect(()=>{if(s&&u.length&&y){for(const t of w){if(!1===(null==r?void 0:r(t)))continue;const n=u.indexOf(t),o=d[n];if(!o)continue;const{direction:a,speed:s}=C(t,o,y,e,p);if(s.x>0||s.y>0)return g(),m.current=t,h(x,i),v.current=s,void(b.current=a)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,x,r,g,s,i,JSON.stringify(y),h,u,w,d,JSON.stringify(p)])}({...function(){const e=!(!1===(null==ee?void 0:ee.autoScrollEnabled)||("object"==typeof a?!1===a.enabled:!1===a));return"object"==typeof a?{...a,enabled:e}:{enabled:e}}(),draggingRect:Pe,pointerCoordinates:Oe,scrollableAncestors:Me,scrollableAncestorRects:Se});const $e=t.useMemo(()=>({active:Q,activeNode:ce,activeNodeRect:de,activeNodeClientRect:fe,activatorEvent:ne,activators:Fe,ariaDescribedById:{draggable:ae},overlayNode:{nodeRef:Le,rect:Te,setRef:Ne},containerNodeRect:Ee,dispatch:T,draggableNodes:H,droppableContainers:W,droppableRects:se,over:He,recomputeLayouts:ie,scrollableAncestors:Me,scrollableAncestorRects:Se,willRecomputeLayouts:le,windowRect:Ce}),[Q,ce,fe,de,ne,Fe,Ee,Te,Le,T,H,ae,W,se,He,ie,Me,Se,Ne,le,Ce]);return n.createElement(P.Provider,{value:A},n.createElement(d.Provider,{value:$e},n.createElement(me.Provider,{value:ze},c)),n.createElement(q,{announcements:i,hiddenTextDescribedById:ae,screenReaderInstructions:v}))})),we=t.createContext(null),De="button";function Re(){return t.useContext(d)}const Ce=e=>e instanceof KeyboardEvent?"transform 250ms ease":void 0,Ee={duration:250,easing:"ease",dragSourceOpacity:0},Me=n.memo(({adjustScale:e=!1,children:r,dropAnimation:a=Ee,style:s,transition:i=Ce,modifiers:l,wrapperElement:c="div",className:u,zIndex:d=999})=>{var f,p;const{active:g,activeNodeRect:v,activeNodeClientRect:y,containerNodeRect:b,draggableNodes:m,activatorEvent:x,over:w,overlayNode:D,scrollableAncestors:R,scrollableAncestorRects:C,windowRect:E}=Re(),M=t.useContext(me),S=ve(l,{activatorEvent:x,active:g,activeNodeRect:y,containerNodeRect:b,draggingNodeRect:D.rect,over:w,overlayNodeRect:D.rect,scrollableAncestors:R,scrollableAncestorRects:C,transform:M,windowRect:E}),L=function(e,n,r){const a=t.useRef(n);return o.useLazyMemo(t=>{const o=a.current;if(n!==o){if(n&&o&&(o.left!==n.left||o.top!==n.top)&&!t){const t=null==r?void 0:r.getBoundingClientRect();if(t)return{...e,x:t.left-n.left,y:t.top-n.top}}a.current=n}},[n,e,r])}(S,v,D.nodeRef.current),T=null!==g,A=null!=L?L:S,K=e?A:{...A,scaleX:1,scaleY:1},O=v?{position:"fixed",width:v.width,height:v.height,top:v.top,left:v.left,zIndex:d,transform:o.CSS.Transform.toString(K),touchAction:"none",transformOrigin:e&&x?h(x,v):void 0,transition:L?void 0:"function"==typeof i?i(x):i,...s}:void 0,B=T?{style:O,children:r,className:u,transform:K}:void 0,I=t.useRef(B),k=null!=B?B:I.current,{children:P,...j}=null!=k?k:{},q=t.useRef(null!=(f=null==g?void 0:g.id)?f:null),U=function({animate:e,adjustScale:n,activeId:r,draggableNodes:a,duration:s,easing:i,dragSourceOpacity:l,node:c,transform:u}){const[d,f]=t.useState(!1);return t.useEffect(()=>{e&&r&&i&&s?requestAnimationFrame(()=>{var e;const t=null==(e=a[r])?void 0:e.node.current;if(u&&c&&t&&null!==t.parentNode){const e=ge(c);if(e){const r=e.getBoundingClientRect(),a=N(t),d={x:r.left-a.left,y:r.top-a.top};if(Math.abs(d.x)||Math.abs(d.y)){const e=o.CSS.Transform.toString({x:u.x-d.x,y:u.y-d.y,scaleX:n?a.width*u.scaleX/r.width:1,scaleY:n?a.height*u.scaleY/r.height:1}),p=t.style.opacity;return null!=l&&(t.style.opacity=""+l),void(c.animate([{transform:o.CSS.Transform.toString(u)},{transform:e}],{easing:i,duration:s}).onfinish=()=>{c.style.display="none",f(!0),t&&null!=l&&(t.style.opacity=p)})}}}f(!0)}):e&&f(!0)},[e,r,n,a,s,i,l,c,u]),o.useIsomorphicLayoutEffect(()=>{d&&f(!1)},[d]),d}({animate:Boolean(a&&q.current&&!g),adjustScale:e,activeId:q.current,draggableNodes:m,duration:null==a?void 0:a.duration,easing:null==a?void 0:a.easing,dragSourceOpacity:null==a?void 0:a.dragSourceOpacity,node:D.nodeRef.current,transform:null==(p=I.current)?void 0:p.transform}),H=Boolean(P&&(r||a&&!U));return t.useEffect(()=>{var e;(null==g?void 0:g.id)!==q.current&&(q.current=null!=(e=null==g?void 0:g.id)?e:null),g&&I.current!==B&&(I.current=B)},[g,B]),t.useEffect(()=>{U&&(I.current=void 0)},[U]),H?n.createElement(c,{...j,ref:D.setRef},P):null});exports.DndContext=xe,exports.DragOverlay=Me,exports.KeyboardSensor=re,exports.MouseSensor=fe,exports.PointerSensor=ce,exports.TouchSensor=he,exports.applyModifiers=ve,exports.closestCenter=({collisionRect:e,droppableContainers:t})=>{const n=g(e,e.left,e.top);let r=Infinity,o=null;for(const e of t){const{rect:{current:t}}=e;if(t){const a=p(g(t),n);a<r&&(r=a,o=e.id)}}return o},exports.closestCorners=({collisionRect:e,droppableContainers:t})=>{let n=Infinity,r=null;const o=A(e,e.left,e.top);for(const e of t){const{rect:{current:t}}=e;if(t){const a=A(t,T(t)?t.left:void 0,T(t)?t.top:void 0),s=o.reduce((e,t,n)=>e+p(a[n],t),0),i=Number((s/4).toFixed(4));i<n&&(n=i,r=e.id)}}return r},exports.defaultAnnouncements=i,exports.defaultCoordinates=f,exports.defaultDropAnimation=Ee,exports.getBoundingClientRect=L,exports.getScrollableAncestors=b,exports.getViewRect=N,exports.rectIntersection=O,exports.useDndContext=Re,exports.useDndMonitor=j,exports.useDraggable=function({id:e,data:n,disabled:r=!1,attributes:a}){const{active:s,activeNodeRect:i,activatorEvent:l,ariaDescribedById:c,draggableNodes:u,droppableRects:f,activators:p,over:h}=t.useContext(d),{role:g=De,roleDescription:v="draggable",tabIndex:y=0}=null!=a?a:{},b=(null==s?void 0:s.id)===e,m=t.useContext(b?me:we),[x,w]=o.useNodeRef(),D=function(e,n){return t.useMemo(()=>e.reduce((e,{eventName:t,handler:r})=>(e[t]=e=>{r(e,n)},e),{}),[e,n])}(p,e),R=W(n);return t.useEffect(()=>(u[e]={id:e,node:x,data:R},()=>{delete u[e]}),[u,e]),{active:s,activeNodeRect:i,activatorEvent:l,attributes:t.useMemo(()=>({role:g,tabIndex:y,"aria-pressed":!(!b||g!==De)||void 0,"aria-roledescription":v,"aria-describedby":c.draggable}),[g,y,b,v,c.draggable]),droppableRects:f,isDragging:b,listeners:r?void 0:D,node:x,over:h,setNodeRef:w,transform:m}},exports.useDroppable=function({data:e,disabled:n=!1,id:r}){const{active:a,dispatch:s,over:i}=t.useContext(d),c=t.useRef(null),[u,f]=o.useNodeRef(),p=W(e);return o.useIsomorphicLayoutEffect(()=>(s({type:l.RegisterDroppable,element:{id:r,disabled:n,node:u,rect:c,data:p}}),()=>s({type:l.UnregisterDroppable,id:r})),[r]),t.useEffect(()=>{s({type:l.SetDroppableDisabled,id:r,disabled:n})},[n]),{active:a,rect:c,isOver:(null==i?void 0:i.id)===r,node:u,over:i,setNodeRef:f}},exports.useSensor=function(e,n){return t.useMemo(()=>({sensor:e,options:null!=n?n:{}}),[e,n])},exports.useSensors=function(...e){return t.useMemo(()=>[...e].filter(e=>null!=e),[...e])}; | ||
//# sourceMappingURL=core.cjs.production.min.js.map |
@@ -9,5 +9,5 @@ export { DndContext, DragOverlay, defaultAnnouncements, defaultDropAnimation, } from './components'; | ||
export type { Activator, Activators, PointerActivationConstraint, KeyboardCodes, KeyboardCoordinateGetter, KeyboardSensorOptions, KeyboardSensorProps, MouseSensorOptions, PointerEventHandlers, PointerSensorOptions, PointerSensorProps, Sensor, Sensors, SensorContext, SensorDescriptor, SensorHandler, SensorInstance, SensorOptions, SensorProps, SensorResponse, TouchSensorOptions, } from './sensors'; | ||
export type { Active, DndContextDescriptor, Over } from './store'; | ||
export type { DistanceMeasurement, DragEndEvent, DragMoveEvent, DragOverEvent, DragStartEvent, DragCancelEvent, LayoutRect, RectEntry, Translate, UniqueIdentifier, ViewRect, } from './types'; | ||
export type { Active, DndContextDescriptor, DraggableNode, DroppableContainers, DroppableContainer, Over, } from './store'; | ||
export type { DistanceMeasurement, DragEndEvent, DragMoveEvent, DragOverEvent, DragStartEvent, DragCancelEvent, LayoutRect, Translate, UniqueIdentifier, ViewRect, } from './types'; | ||
export { defaultCoordinates, getBoundingClientRect, getViewRect, getScrollableAncestors, closestCenter, closestCorners, rectIntersection, } from './utilities'; | ||
export type { CollisionDetection } from './utilities'; |
@@ -36,2 +36,3 @@ import type { MutableRefObject } from 'react'; | ||
export declare type DraggableNode = { | ||
id: UniqueIdentifier; | ||
node: MutableRefObject<HTMLElement | null>; | ||
@@ -38,0 +39,0 @@ data: DataRef; |
import type { Coordinates } from '@dnd-kit/utilities'; | ||
import type { UniqueIdentifier } from './other'; | ||
export type { Coordinates }; | ||
@@ -20,3 +19,2 @@ export declare type DistanceMeasurement = number | Coordinates | Pick<Coordinates, 'x'> | Pick<Coordinates, 'y'>; | ||
} | ||
export declare type RectEntry = [UniqueIdentifier, LayoutRect | ViewRect]; | ||
export interface ScrollCoordinates { | ||
@@ -23,0 +21,0 @@ initial: Coordinates; |
@@ -1,2 +0,2 @@ | ||
export type { Coordinates, ClientRect, DistanceMeasurement, LayoutRect, ViewRect, RectEntry, Translate, ScrollCoordinates, } from './coordinates'; | ||
export type { Coordinates, ClientRect, DistanceMeasurement, LayoutRect, ViewRect, Translate, ScrollCoordinates, } from './coordinates'; | ||
export { Direction } from './direction'; | ||
@@ -3,0 +3,0 @@ export type { DragStartEvent, DragCancelEvent, DragEndEvent, DragMoveEvent, DragOverEvent, } from './events'; |
@@ -1,2 +0,7 @@ | ||
import type { RectEntry, ViewRect, UniqueIdentifier } from '../../types'; | ||
export declare type CollisionDetection = (entries: RectEntry[], target: ViewRect) => UniqueIdentifier | null; | ||
import type { Active, DroppableContainer } from '../../store'; | ||
import type { UniqueIdentifier, ViewRect } from '../../types'; | ||
export declare type CollisionDetection = (args: { | ||
active: Active; | ||
collisionRect: ViewRect; | ||
droppableContainers: DroppableContainer[]; | ||
}) => UniqueIdentifier | null; |
@@ -6,3 +6,3 @@ export { closestCenter, closestCorners, rectIntersection } from './algorithms'; | ||
export { getOwnerDocument, getWindow } from './document'; | ||
export { getMinValueIndex, getMaxValueIndex, omit, noop } from './other'; | ||
export { omit, noop } from './other'; | ||
export { getScrollableAncestors, getScrollableElement, getScrollCoordinates, getScrollDirectionAndSpeed, getScrollElementRect, getScrollOffsets, getScrollPosition, isDocumentScrollingElement, } from './scroll'; |
@@ -1,3 +0,2 @@ | ||
export { getMinValueIndex, getMaxValueIndex } from './getValueIndex'; | ||
export { noop } from './noop'; | ||
export { omit } from './omit'; |
{ | ||
"name": "@dnd-kit/core", | ||
"version": "4.0.0-next-202162115243", | ||
"version": "4.0.0-next-2021621163226", | ||
"description": "dnd kit – a lightweight React library for building performant and accessible drag and drop experiences", | ||
@@ -35,3 +35,3 @@ "author": "Claudéric Demers", | ||
"@dnd-kit/accessibility": "^3.0.0", | ||
"@dnd-kit/utilities": "^2.1.0-next-202162115243" | ||
"@dnd-kit/utilities": "^2.1.0-next-2021621163226" | ||
}, | ||
@@ -38,0 +38,0 @@ "publishConfig": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
736720
5779
107