Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dnd-kit/core

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dnd-kit/core - npm Package Compare versions

Comparing version 5.1.0-next-2022212212756 to 5.1.0-next-202221523720

19

CHANGELOG.md
# @dnd-kit/core
## 5.1.0-next-2022212212756
## 5.1.0-next-202221523720
### Minor Changes
- [#656](https://github.com/clauderic/dnd-kit/pull/656) [`c1b3b5a`](https://github.com/clauderic/dnd-kit/commit/c1b3b5a0be5759b707e22c4e1b1236aaa82773a2) Thanks [@clauderic](https://github.com/clauderic)! - Fixed an issue with collision detection using stale rects. The `droppableRects` property has been added to the `CollisionDetection` interface.
All built-in collision detection algorithms have been updated to get the rect for a given droppable container from `droppableRects` rather than from the `rect.current` ref:
```diff
- const rect = droppableContainers.get(id).rect.current;
+ const rect = droppableRects.get(id);
```
The `rect.current` ref stored on DroppableContainers can be stale if measuring is scheduled but has not completed yet. Collision detection algorithms should use the `droppableRects` map instead to get the latest, most up-to-date measurement of a droppable container in order to avoid computing collisions against stale rects.
This is not a breaking change. Hoever, if you've forked any of the built-in collision detection algorithms or you've authored custom ones, we highly recommend you update your use-cases to avoid possibly computing collisions against stale rects.
## 5.0.3
### Patch Changes
- [#650](https://github.com/clauderic/dnd-kit/pull/650) [`2439aae`](https://github.com/clauderic/dnd-kit/commit/2439aaea86fad793f0da75e2319e174a27142658) Thanks [@clauderic](https://github.com/clauderic)! - - Fixed React warning in development when unmounting a component that uses the `useDraggable` hook by ensuring that the `ResizeObserver` is disconnected in a cleanup effect.

@@ -8,0 +25,0 @@

2

dist/core.cjs.production.min.js

@@ -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"),i=require("@dnd-kit/accessibility");const a={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 "},s={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(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={}));class d extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:e})=>!e)}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const u={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:{},droppableRects:new Map,droppableContainers:new d,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:c},scrollableAncestors:[],scrollableAncestorRects:[],measureDroppableContainers:c,windowRect:null,measuringScheduled:!1},h={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:c,draggableNodes:{},over:null,measureDroppableContainers:c},p=t.createContext(h),g=t.createContext(u);function v(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new d}}}function f(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,o=new d(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case l.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new d(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case l.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new d(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}const b=t.createContext({type:null,event:null});function m({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:i}){const a=t.useContext(b),s=t.useRef(a);t.useEffect(()=>{if(a!==s.current){const{type:t,event:c}=a;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==i||i(c);break;case l.DragEnd:null==o||o(c)}s.current=a}},[a,e,n,r,o,i])}function y({announcements:e=s,hiddenTextDescribedById:a,screenReaderInstructions:l}){const{announce:c,announcement:d}=i.useAnnouncement(),u=o.useUniqueId("DndLiveRegion"),[h,p]=t.useState(!1);return t.useEffect(()=>{p(!0)},[]),m(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])),h?r.createPortal(n.createElement(n.Fragment,null,n.createElement(i.HiddenText,{id:a,value:l.draggable}),n.createElement(i.LiveRegion,{id:u,announcement:d})),document.body):null}const x=Object.freeze({x:0,y:0});function w(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function C(e,t){const n=o.getEventCoordinates(e);return n?`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`:"0 0"}function D({data:{value:e}},{data:{value:t}}){return e-t}function R({data:{value:e}},{data:{value:t}}){return t-e}function E({left:e,top:t,height:n,width:r}){return[{x:e,y:t},{x:e+r,y:t},{x:e,y:t+n},{x:e+r,y:t+n}]}function S(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function M(e,t=e.left,n=e.top){return{x:t+.5*e.width,y:n+.5*e.height}}function N(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height);if(r<o&&n<i){const a=(o-r)*(i-n);return Number((a/(t.width*t.height+e.width*e.height-a)).toFixed(4))}return 0}const A=({collisionRect:e,droppableContainers:t})=>{const n=[];for(const r of t){const{id:t,rect:{current:o}}=r;if(o){const i=N(o,e);i>0&&n.push({id:t,data:{droppableContainer:r,value:i}})}}return n.sort(R)};function L(e,t){const{top:n,left:r,bottom:o,right:i}=t;return n<=e.y&&e.y<=o&&r<=e.x&&e.x<=i}function O(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}),{...t})}}const T=O(1),k={ignoreTransform:!1};function K(e,t=k){let n=e.getBoundingClientRect();if(t.ignoreTransform){const{getComputedStyle:t}=o.getWindow(e),{transform:r,transformOrigin:i}=t(e);r&&(n=function(e,t,n){let r,o,i,a,s;if(t.startsWith("matrix3d("))r=t.slice(9,-1).split(/, /),o=+r[0],i=+r[5],a=+r[12],s=+r[13];else{if(!t.startsWith("matrix("))return e;r=t.slice(7,-1).split(/, /),o=+r[0],i=+r[3],a=+r[4],s=+r[5]}const l=e.left-a-(1-o)*parseFloat(n),c=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,r,i))}const{top:r,left:i,width:a,height:s,bottom:l,right:c}=n;return{top:r,left:i,width:a,height:s,bottom:l,right:c}}function B(e){return K(e,{ignoreTransform:!0})}function I(e){const t=[];return e?function n(r){if(!r)return t;if(o.isDocument(r)&&null!=r.scrollingElement&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!o.isHTMLElement(r)||o.isSVGElement(r))return t;if(t.includes(r))return t;const{getComputedStyle:i}=o.getWindow(r),a=i(r);return r!==e&&function(e,t=o.getWindow(e).getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return null!=["overflow","overflowX","overflowY"].find(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(r,a)&&t.push(r),function(e,t=o.getWindow(e).getComputedStyle(e)){return"fixed"===t.position}(r,a)?t:n(r.parentNode)}(e):t}function W(e){return o.canUseDOM&&e?o.isWindow(e)?e:o.isNode(e)?o.isDocument(e)||e===o.getOwnerDocument(e).scrollingElement?window:o.isHTMLElement(e)?e:null:null:null}function z(e){return o.isWindow(e)?e.scrollX:e.scrollLeft}function P(e){return o.isWindow(e)?e.scrollY:e.scrollTop}function U(e){return{x:z(e),y:P(e)}}var F;function q(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"}(F||(F={}));const j={x:.2,y:.2};function H(e,t,{top:n,left:r,right:i,bottom:a},s=10,l=j){const{clientHeight:c,clientWidth:d}=e,u=(h=e,o.canUseDOM&&h&&h===document.scrollingElement?{top:0,left:0,right:d,bottom:c,width:d,height:c}:t);var h;const{isTop:p,isBottom:g,isLeft:v,isRight:f}=q(e),b={x:0,y:0},m={x:0,y:0},y=u.height*l.y,x=u.width*l.x;return!p&&n<=u.top+y?(b.y=F.Backward,m.y=s*Math.abs((u.top+y-n)/y)):!g&&a>=u.bottom-y&&(b.y=F.Forward,m.y=s*Math.abs((u.bottom-y-a)/y)),!f&&i>=u.right-x?(b.x=F.Forward,m.x=s*Math.abs((u.right-x-i)/x)):!v&&r<=u.left+x&&(b.x=F.Backward,m.x=s*Math.abs((u.left+x-r)/x)),{direction:b,speed:m}}function $(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 V(e){return e.reduce((e,t)=>o.add(e,U(t)),x)}const X=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+z(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+P(t),0)}]];class Y{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=I(t),r=V(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of X)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n);return this.rect[i]+(r[e]-t)},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}var _,G,J;(_=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[_.Pointer=0]="Pointer",_[_.DraggableRect=1]="DraggableRect",(G=exports.TraversalOrder||(exports.TraversalOrder={}))[G.TreeOrder=0]="TreeOrder",G[G.ReversedTreeOrder=1]="ReversedTreeOrder",(J=exports.MeasuringStrategy||(exports.MeasuringStrategy={}))[J.Always=0]="Always",J[J.BeforeDragging=1]="BeforeDragging",J[J.WhileDragging=2]="WhileDragging",(exports.MeasuringFrequency||(exports.MeasuringFrequency={})).Optimized="optimized";const Q=new Map,Z={measure:B,strategy:exports.MeasuringStrategy.WhileDragging,frequency:exports.MeasuringFrequency.Optimized};function ee({onResize:e,disabled:n}){const r=t.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:t}=window;return new t(e)},[n,e]);return t.useEffect(()=>()=>null==r?void 0:r.disconnect(),[r]),r}const te=[],ne=ie(B),re=ae(B);function oe(e,n,r){const i=t.useRef(e);return o.useLazyMemo(t=>e?r||!t&&e||e!==i.current?o.isHTMLElement(e)&&null==e.parentNode?null:new Y(n(e),e):null!=t?t:null:null,[e,r,n])}function ie(e){return(t,n)=>oe(t,e,n)}function ae(e){const n=[];return function(r,i){const a=t.useRef(r);return o.useLazyMemo(t=>r.length?i||!t&&r.length||r!==a.current?r.map(t=>new Y(e(t),t)):null!=t?t:n:n,[r,i])}}function se(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return o.isHTMLElement(t)?t:e}class le{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function ce(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 de,ue;function he(e){e.preventDefault()}function pe(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(de||(de={})),(ue=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",ue.Down="ArrowDown",ue.Right="ArrowRight",ue.Left="ArrowLeft",ue.Up="ArrowUp",ue.Esc="Escape",ue.Enter="Enter";const ge={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},ve=(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 fe{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.coordinates=x,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new le(o.getOwnerDocument(t)),this.windowListeners=new le(o.getWindow(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(de.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const n=B(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(o.isKeyboardEvent(e)){const{coordinates:t}=this,{active:n,context:r,options:i}=this.props,{keyboardCodes:a=ge,coordinateGetter:s=ve,scrollBehavior:l="smooth"}=i,{code:c}=e;if(a.end.includes(c))return void this.handleEnd(e);if(a.cancel.includes(c))return void this.handleCancel(e);const d=s(e,{active:n,context:r.current,currentCoordinates:t});if(d){const n={x:0,y:0},{scrollableAncestors:i}=r.current;for(const r of i){const i=e.code,a=o.subtract(d,t),{isTop:s,isRight:c,isLeft:u,isBottom:h,maxScroll:p,minScroll:g}=q(r),v=$(r),f={x:Math.min(i===exports.KeyboardCode.Right?v.right-v.width/2:v.right,Math.max(i===exports.KeyboardCode.Right?v.left:v.left+v.width/2,d.x)),y:Math.min(i===exports.KeyboardCode.Down?v.bottom-v.height/2:v.bottom,Math.max(i===exports.KeyboardCode.Down?v.top:v.top+v.height/2,d.y))},b=i===exports.KeyboardCode.Right&&!c||i===exports.KeyboardCode.Left&&!u,m=i===exports.KeyboardCode.Down&&!h||i===exports.KeyboardCode.Up&&!s;if(b&&f.x!==d.x){if(i===exports.KeyboardCode.Right&&r.scrollLeft+a.x<=p.x||i===exports.KeyboardCode.Left&&r.scrollLeft+a.x>=g.x)return void r.scrollBy({left:a.x,behavior:l});n.x=i===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-g.x,r.scrollBy({left:-n.x,behavior:l});break}if(m&&f.y!==d.y){if(i===exports.KeyboardCode.Down&&r.scrollTop+a.y<=p.y||i===exports.KeyboardCode.Up&&r.scrollTop+a.y>=g.y)return void r.scrollBy({top:a.y,behavior:l});n.y=i===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-g.y,r.scrollBy({top:-n.y,behavior:l});break}}this.handleMove(e,o.add(d,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 be(e){return Boolean(e&&"distance"in e)}function me(e){return Boolean(e&&"delay"in e)}fe.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=ge,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}];class ye{constructor(e,t,n=function(e){const{EventTarget:t}=o.getWindow(e);return e instanceof t?e:o.getOwnerDocument(e)}(e.event.target)){var r;this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:a}=i;this.props=e,this.events=t,this.document=o.getOwnerDocument(a),this.documentListeners=new le(this.document),this.listeners=new le(n),this.windowListeners=new le(o.getWindow(a)),this.initialCoordinates=null!=(r=o.getEventCoordinates(i))?r:x,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.DragStart,he),this.windowListeners.add(de.VisibilityChange,this.handleCancel),this.windowListeners.add(de.ContextMenu,he),this.documentListeners.add(de.Keydown,this.handleKeydown),t){if(be(t))return;if(me(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(de.Click,pe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(de.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!r)return;const l=null!=(t=o.getEventCoordinates(e))?t:x,c=o.subtract(r,l);if(!n&&s){if(me(s))return ce(c,s.tolerance)?this.handleCancel():void 0;if(be(s))return null!=s.tolerance&&ce(c,s.tolerance)?this.handleCancel():ce(c,s.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),a(l)}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()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const xe={move:{name:"pointermove"},end:{name:"pointerup"}};class we extends ye{constructor(e){const{event:t}=e,n=o.getOwnerDocument(t.target);super(e,xe,n)}}we.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const Ce={move:{name:"mousemove"},end:{name:"mouseup"}};var De;!function(e){e[e.RightClick=2]="RightClick"}(De||(De={}));class Re extends ye{constructor(e){super(e,Ce,o.getOwnerDocument(e.event.target))}}Re.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==De.RightClick&&(null==t||t({event:e}),!0)}];const Ee={move:{name:"touchmove"},end:{name:"touchend"}};class Se extends ye{constructor(e){super(e,Ee)}static setup(){return window.addEventListener(Ee.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ee.move.name,e)};function e(){}}}function Me(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}Se.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}];const Ne=[{sensor:we,options:{}},{sensor:fe,options:{}}],Ae={current:{}},Le=t.createContext({...x,scaleX:1,scaleY:1}),Oe=t.memo((function({id:e,autoScroll:i=!0,announcements:s,children:c,sensors:d=Ne,collisionDetection:u=A,measuring:h,modifiers:m,screenReaderInstructions:w=a,...C}){var D,R,E,M,N,L,O;const k=t.useReducer(f,void 0,v),[z,P]=k,[F,q]=t.useState(()=>({type:null,event:null})),[j,$]=t.useState(!1),{draggable:{active:X,nodes:_,translate:G},droppable:{containers:J}}=z,ie=X?_[X]:null,ae=t.useRef({initial:null,translated:null}),le=t.useMemo(()=>{var e;return null!=X?{id:X,data:null!=(e=null==ie?void 0:ie.data)?e:Ae,rect:ae}:null},[X,ie]),ce=t.useRef(null),[de,ue]=t.useState(null),[he,pe]=t.useState(null),ge=o.useLatestValue(C,Object.values(C)),ve=o.useUniqueId("DndDescribedBy",e),fe=t.useMemo(()=>J.getEnabled(),[J]),{droppableRects:be,measureDroppableContainers:me,measuringScheduled:ye}=function(e,{dragging:n,dependencies:r,config:i}){const[a,s]=t.useState(null),l=null!=a,{frequency:c,measure:d,strategy:u}={...Z,...i},h=t.useRef(e),p=t.useCallback((e=[])=>s(t=>t?t.concat(e):e),[]),g=t.useRef(null),v=function(){switch(u){case exports.MeasuringStrategy.Always:return!1;case exports.MeasuringStrategy.BeforeDragging:return n;default:return!n}}(),f=o.useLazyMemo(t=>{if(v&&!n)return Q;const r=a;if(!t||t===Q||h.current!==e||null!=r){const t=new Map;for(let n of e){if(!n)continue;if(r&&r.length>0&&!r.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new Y(d(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t},[e,a,n,v,d]);return t.useEffect(()=>{h.current=e},[e]),t.useEffect(()=>{v||requestAnimationFrame(()=>p())},[n,v]),t.useEffect(()=>{l&&s(null)},[l]),t.useEffect(()=>{v||"number"!=typeof c||null!==g.current||(g.current=setTimeout(()=>{p(),g.current=null},c))},[c,v,p,...r]),{droppableRects:f,measureDroppableContainers:p,measuringScheduled:l}}(fe,{dragging:j,dependencies:[G.x,G.y],config:null==h?void 0:h.droppable}),xe=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])}(_,X),we=he?o.getEventCoordinates(he):null,Ce=oe(xe,null!=(D=null==h||null==(R=h.draggable)?void 0:R.measure)?D:B),De=ne(xe?xe.parentElement:null),Re=t.useRef({active:null,activeNode:xe,collisionRect:null,collisions:null,droppableRects:be,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ee=J.getNodeFor(null==(E=Re.current.over)?void 0:E.id),Se=function({measure:e=K}){const[n,r]=t.useState(null),i=ee({onResize:t.useCallback(t=>{for(const{target:n}of t)if(o.isHTMLElement(n)){r(t=>{const r=e(n);return t?{...t,width:r.width,height:r.height}:r});break}},[e])}),a=t.useCallback(t=>{const n=se(t);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?e(n):null)},[e,i]),[s,l]=o.useNodeRef(a);return t.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}({measure:null==h||null==(M=h.dragOverlay)?void 0:M.measure}),Oe=null!=(N=Se.nodeRef.current)?N:xe,Te=null!=(L=Se.rect)?L:Ce,ke=t.useRef(null),Ke=Te===Ce?(Ie=ke.current,(Be=Ce)&&Ie?{x:Be.left-Ie.left,y:Be.top-Ie.top}:x):x;var Be,Ie;const We=t.useMemo(()=>ze?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(ze):null,[ze=Oe?Oe.ownerDocument.defaultView:null]);var ze;const Pe=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:I(e):te,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(X?null!=Ee?Ee:Oe:null),Ue=re(Pe),Fe=Me(m,{transform:{x:G.x-Ke.x,y:G.y-Ke.y,scaleX:1,scaleY:1},activatorEvent:he,active:le,activeNodeRect:Ce,containerNodeRect:De,draggingNodeRect:Te,over:Re.current.over,overlayNodeRect:Se.rect,scrollableAncestors:Pe,scrollableAncestorRects:Ue,windowRect:We}),qe=we?o.add(we,G):null,je=function(e){const[n,r]=t.useState(null),i=t.useRef(e),a=t.useCallback(e=>{const t=W(e.target);t&&r(e=>e?(e.set(t,U(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=i.current;if(e!==t){n(t);const o=e.map(e=>{const t=W(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,U(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),i.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=W(e);null==t||t.removeEventListener("scroll",a)})}},[a,e]),t.useMemo(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>o.add(e,t),x):V(e):x,[e,n])}(Pe),He=o.add(Fe,je),$e=Te?T(Te,Fe):null,Ve=le&&$e?u({active:le,collisionRect:$e,droppableContainers:fe,pointerCoordinates:qe}):null,Xe=S(Ve,"id"),[Ye,_e]=t.useState(null),Ge=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Fe,null!=(O=null==Ye?void 0:Ye.rect)?O:null,Ce),Je=t.useCallback((e,{sensor:t,options:n})=>{if(!ce.current)return;const o=_[ce.current];if(!o)return;const i=new t({active:ce.current,activeNode:o,event:e.nativeEvent,options:n,context:Re,onStart(e){const t=ce.current;if(!t)return;const n=_[t];if(!n)return;const{onDragStart:o}=ge.current,i={active:{id:t,data:n.data,rect:ae}};r.unstable_batchedUpdates(()=>{P({type:l.DragStart,initialCoordinates:e,active:t}),q({type:l.DragStart,event:i})}),null==o||o(i)},onMove(e){P({type:l.DragMove,coordinates:e})},onEnd:a(l.DragEnd),onCancel:a(l.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:i}=Re.current;let a=null;if(t&&i){const{cancelDrop:r}=ge.current;a={active:t,collisions:n,delta:i,over:o},e===l.DragEnd&&"function"==typeof r&&await Promise.resolve(r(a))&&(e=l.DragCancel)}ce.current=null,r.unstable_batchedUpdates(()=>{if(P({type:e}),_e(null),$(!1),ue(null),pe(null),a&&q({type:e,event:a}),a){const{onDragCancel:t,onDragEnd:n}=ge.current,r=e===l.DragEnd?n:t;null==r||r(a)}})}}r.unstable_batchedUpdates(()=>{ue(i),pe(e.nativeEvent)})},[_]),Qe=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])}(d,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==ce.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},ce.current=r,Je(n,t))},[Je]));!function(e){t.useEffect(()=>{if(!o.canUseDOM)return;const t=e.map(({sensor:e})=>null==e.setup?void 0:e.setup());return()=>{for(const e of t)null==e||e()}},e.map(({sensor:e})=>e))}(d),t.useEffect(()=>{null!=X&&$(!0)},[X]),t.useEffect(()=>{le||(ke.current=null),le&&Ce&&!ke.current&&(ke.current=Ce)},[Ce,le]),t.useEffect(()=>{const{onDragMove:e}=ge.current,{active:t,collisions:n,over:r}=Re.current;if(!t)return;const o={active:t,collisions:n,delta:{x:He.x,y:He.y},over:r};q({type:l.DragMove,event:o}),null==e||e(o)},[He.x,He.y]),t.useEffect(()=>{const{active:e,collisions:t,droppableContainers:n,scrollAdjustedTranslate:o}=Re.current;if(!e||!ce.current||!o)return;const{onDragOver:i}=ge.current,a=n.get(Xe),s=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,c={active:e,collisions:t,delta:{x:o.x,y:o.y},over:s};r.unstable_batchedUpdates(()=>{_e(s),q({type:l.DragOver,event:c}),null==i||i(c)})},[Xe]),o.useIsomorphicLayoutEffect(()=>{Re.current={active:le,activeNode:xe,collisionRect:$e,collisions:Ve,droppableRects:be,draggableNodes:_,draggingNode:Oe,draggingNodeRect:Te,droppableContainers:J,over:Ye,scrollableAncestors:Pe,scrollAdjustedTranslate:He},ae.current={initial:Te,translated:$e}},[le,xe,Ve,$e,_,Oe,Te,be,J,Ye,Pe,He]),function({acceleration:e,activator:n=exports.AutoScrollActivator.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:s=5,order:l=exports.TraversalOrder.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,threshold:h}){const[p,g]=o.useInterval(),v=t.useRef({x:1,y:1}),f=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 i}return null},[n,i,c]),b=t.useRef(x),m=t.useRef(null),y=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?[...d].reverse():d,[l,d]);t.useEffect(()=>{if(a&&d.length&&f){for(const t of w){if(!1===(null==r?void 0:r(t)))continue;const n=d.indexOf(t),o=u[n];if(!o)continue;const{direction:i,speed:a}=H(t,o,f,e,h);if(a.x>0||a.y>0)return g(),m.current=t,p(y,s),v.current=a,void(b.current=i)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,y,r,g,a,s,JSON.stringify(f),p,d,w,u,JSON.stringify(h)])}({...function(){const e=!(!1===(null==de?void 0:de.autoScrollEnabled)||("object"==typeof i?!1===i.enabled:!1===i));return"object"==typeof i?{...i,enabled:e}:{enabled:e}}(),draggingRect:$e,pointerCoordinates:qe,scrollableAncestors:Pe,scrollableAncestorRects:Ue});const Ze=t.useMemo(()=>({active:le,activeNode:xe,activeNodeRect:Ce,activatorEvent:he,collisions:Ve,containerNodeRect:De,dragOverlay:Se,draggableNodes:_,droppableContainers:J,droppableRects:be,over:Ye,measureDroppableContainers:me,scrollableAncestors:Pe,scrollableAncestorRects:Ue,measuringScheduled:ye,windowRect:We}),[le,xe,Ce,he,Ve,De,Se,_,J,be,Ye,me,Pe,Ue,ye,We]),et=t.useMemo(()=>({activatorEvent:he,activators:Qe,active:le,activeNodeRect:Ce,ariaDescribedById:{draggable:ve},dispatch:P,draggableNodes:_,over:Ye,measureDroppableContainers:me}),[he,Qe,le,Ce,P,ve,_,Ye,me]);return n.createElement(b.Provider,{value:F},n.createElement(p.Provider,{value:et},n.createElement(g.Provider,{value:Ze},n.createElement(Le.Provider,{value:Ge},c))),n.createElement(y,{announcements:s,hiddenTextDescribedById:ve,screenReaderInstructions:w}))})),Te=t.createContext(null),ke="button";function Ke(){return t.useContext(g)}const Be={timeout:25},Ie={duration:250,easing:"ease",dragSourceOpacity:0},We={x:0,y:0,scaleX:1,scaleY:1},ze=e=>o.isKeyboardEvent(e)?"transform 250ms ease":void 0,Pe=n.memo(({adjustScale:e=!1,children:r,dropAnimation:i=Ie,style:a,transition:s=ze,modifiers:l,wrapperElement:c="div",className:d,zIndex:u=999})=>{var g,v;const{active:f,activeNodeRect:b,containerNodeRect:m,draggableNodes:y,activatorEvent:x,over:w,dragOverlay:D,scrollableAncestors:R,scrollableAncestorRects:E,windowRect:S}=Ke(),M=t.useContext(Le),N=Me(l,{activatorEvent:x,active:f,activeNodeRect:b,containerNodeRect:m,draggingNodeRect:D.rect,over:w,overlayNodeRect:D.rect,scrollableAncestors:R,scrollableAncestorRects:E,transform:M,windowRect:S}),A=null!==f,L=e?N:{...N,scaleX:1,scaleY:1},O=o.useLazyMemo(e=>A?e||(b?{...b}:null):null,[A,b]),T=O?{position:"fixed",width:O.width,height:O.height,top:O.top,left:O.left,zIndex:u,transform:o.CSS.Transform.toString(L),touchAction:"none",transformOrigin:e&&x?C(x,O):void 0,transition:"function"==typeof s?s(x):s,...a}:void 0,k=A?{style:T,children:r,className:d,transform:L}:void 0,K=t.useRef(k),I=null!=k?k:K.current,{children:W,...z}=null!=I?I:{},P=t.useRef(null!=(g=null==f?void 0:f.id)?g:null),U=function({animate:e,adjustScale:n,activeId:r,draggableNodes:i,duration:a,dragSourceOpacity:s,easing:l,node:c,transform:d}){const[u,h]=t.useState(!1);return o.useIsomorphicLayoutEffect(()=>{var t;if(!(e&&r&&l&&a))return void(e&&h(!0));const u=null==(t=i[r])?void 0:t.node.current;if(d&&c&&u&&null!==u.parentNode){const e=se(c);if(e){const t=e.getBoundingClientRect(),r=B(u),i={x:t.left-r.left,y:t.top-r.top};if(Math.abs(i.x)||Math.abs(i.y)){const e=o.CSS.Transform.toString({x:d.x-i.x,y:d.y-i.y,scaleX:n?r.width*d.scaleX/t.width:1,scaleY:n?r.height*d.scaleY/t.height:1}),p=u.style.opacity;return null!=s&&(u.style.opacity=""+s),void(c.animate([{transform:o.CSS.Transform.toString(d)},{transform:e}],{easing:l,duration:a}).onfinish=()=>{c.style.display="none",h(!0),u&&null!=s&&(u.style.opacity=p)})}}}h(!0)},[e,r,n,i,a,l,s,c,d]),o.useIsomorphicLayoutEffect(()=>{u&&h(!1)},[u]),u}({animate:Boolean(i&&P.current&&!f),adjustScale:e,activeId:P.current,draggableNodes:y,duration:null==i?void 0:i.duration,easing:null==i?void 0:i.easing,dragSourceOpacity:null==i?void 0:i.dragSourceOpacity,node:D.nodeRef.current,transform:null==(v=K.current)?void 0:v.transform}),F=Boolean(W&&(r||i&&!U));return t.useEffect(()=>{var e;(null==f?void 0:f.id)!==P.current&&(P.current=null!=(e=null==f?void 0:f.id)?e:null),f&&K.current!==k&&(K.current=k)},[f,k]),t.useEffect(()=>{U&&(K.current=void 0)},[U]),F?n.createElement(p.Provider,{value:h},n.createElement(Le.Provider,{value:We},n.createElement(c,{...z,ref:D.setRef},W))):null});exports.DndContext=Oe,exports.DragOverlay=Pe,exports.KeyboardSensor=fe,exports.MouseSensor=Re,exports.PointerSensor=we,exports.TouchSensor=Se,exports.applyModifiers=Me,exports.closestCenter=({collisionRect:e,droppableContainers:t})=>{const n=M(e,e.left,e.top),r=[];for(const e of t){const{id:t,rect:{current:o}}=e;if(o){const i=w(M(o),n);r.push({id:t,data:{droppableContainer:e,value:i}})}}return r.sort(D)},exports.closestCorners=({collisionRect:e,droppableContainers:t})=>{const n=E(e),r=[];for(const e of t){const{id:t,rect:{current:o}}=e;if(o){const i=E(o),a=n.reduce((e,t,n)=>e+w(i[n],t),0),s=Number((a/4).toFixed(4));r.push({id:t,data:{droppableContainer:e,value:s}})}}return r.sort(D)},exports.defaultAnnouncements=s,exports.defaultCoordinates=x,exports.defaultDropAnimation=Ie,exports.getClientRect=K,exports.getFirstCollision=S,exports.getScrollableAncestors=I,exports.pointerWithin=({droppableContainers:e,pointerCoordinates:t})=>{if(!t)return[];const n=[];for(const r of e){const{id:e,rect:{current:o}}=r;if(o&&L(t,o)){const i=E(o).reduce((e,n)=>e+w(t,n),0),a=Number((i/4).toFixed(4));n.push({id:e,data:{droppableContainer:r,value:a}})}}return n.sort(D)},exports.rectIntersection=A,exports.useDndContext=Ke,exports.useDndMonitor=m,exports.useDraggable=function({id:e,data:n,disabled:r=!1,attributes:i}){const a=o.useUniqueId("Droppable"),{activators:s,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:h,over:g}=t.useContext(p),{role:v=ke,roleDescription:f="draggable",tabIndex:b=0}=null!=i?i:{},m=(null==c?void 0:c.id)===e,y=t.useContext(m?Le:Te),[x,w]=o.useNodeRef(),C=function(e,n){return t.useMemo(()=>e.reduce((e,{eventName:t,handler:r})=>(e[t]=e=>{r(e,n)},e),{}),[e,n])}(s,e),D=o.useLatestValue(n);return o.useIsomorphicLayoutEffect(()=>(h[e]={id:e,key:a,node:x,data:D},()=>{const t=h[e];t&&t.key===a&&delete h[e]}),[h,e]),{active:c,activatorEvent:l,activeNodeRect:d,attributes:t.useMemo(()=>({role:v,tabIndex:b,"aria-pressed":!(!m||v!==ke)||void 0,"aria-roledescription":f,"aria-describedby":u.draggable}),[v,b,m,f,u.draggable]),isDragging:m,listeners:r?void 0:C,node:x,over:g,setNodeRef:w,transform:y}},exports.useDroppable=function({data:e,disabled:n=!1,id:r,resizeObserverConfig:i}){const a=o.useUniqueId("Droppable"),{active:s,dispatch:c,over:d,measureDroppableContainers:u}=t.useContext(p),h=t.useRef(!1),g=t.useRef(null),v=t.useRef(null),{disabled:f,updateMeasurementsFor:b,timeout:m}={...Be,...i},y=o.useLatestValue(null!=b?b:r),x=ee({onResize:t.useCallback(()=>{h.current?(null!=v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{u("string"==typeof y.current?[y.current]:y.current),v.current=null},m)):h.current=!0},[m]),disabled:f||!s}),w=t.useCallback((e,t)=>{x&&(t&&(x.unobserve(t),h.current=!1),e&&x.observe(e))},[x]),[C,D]=o.useNodeRef(w),R=o.useLatestValue(e);return t.useEffect(()=>{x&&C.current&&(x.disconnect(),h.current=!1,x.observe(C.current))},[C,x]),o.useIsomorphicLayoutEffect(()=>(c({type:l.RegisterDroppable,element:{id:r,key:a,disabled:n,node:C,rect:g,data:R}}),()=>c({type:l.UnregisterDroppable,key:a,id:r})),[r]),t.useEffect(()=>{c({type:l.SetDroppableDisabled,id:r,key:a,disabled:n})},[n]),{active:s,rect:g,isOver:(null==d?void 0:d.id)===r,node:C,over:d,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"),i=require("@dnd-kit/accessibility");const a={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 "},s={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(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={}));class d extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:e})=>!e)}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const u={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:{},droppableRects:new Map,droppableContainers:new d,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:c},scrollableAncestors:[],scrollableAncestorRects:[],measureDroppableContainers:c,windowRect:null,measuringScheduled:!1},p={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:c,draggableNodes:{},over:null,measureDroppableContainers:c},h=t.createContext(p),g=t.createContext(u);function v(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new d}}}function f(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,o=new d(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case l.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new d(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case l.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new d(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}const b=t.createContext({type:null,event:null});function m({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:i}){const a=t.useContext(b),s=t.useRef(a);t.useEffect(()=>{if(a!==s.current){const{type:t,event:c}=a;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==i||i(c);break;case l.DragEnd:null==o||o(c)}s.current=a}},[a,e,n,r,o,i])}function y({announcements:e=s,hiddenTextDescribedById:a,screenReaderInstructions:l}){const{announce:c,announcement:d}=i.useAnnouncement(),u=o.useUniqueId("DndLiveRegion"),[p,h]=t.useState(!1);return t.useEffect(()=>{h(!0)},[]),m(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])),p?r.createPortal(n.createElement(n.Fragment,null,n.createElement(i.HiddenText,{id:a,value:l.draggable}),n.createElement(i.LiveRegion,{id:u,announcement:d})),document.body):null}const x=Object.freeze({x:0,y:0});function w(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function C(e,t){const n=o.getEventCoordinates(e);return n?`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`:"0 0"}function D({data:{value:e}},{data:{value:t}}){return e-t}function R({data:{value:e}},{data:{value:t}}){return t-e}function E({left:e,top:t,height:n,width:r}){return[{x:e,y:t},{x:e+r,y:t},{x:e,y:t+n},{x:e+r,y:t+n}]}function S(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function M(e,t=e.left,n=e.top){return{x:t+.5*e.width,y:n+.5*e.height}}function N(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height);if(r<o&&n<i){const a=(o-r)*(i-n);return Number((a/(t.width*t.height+e.width*e.height-a)).toFixed(4))}return 0}const A=({collisionRect:e,droppableRects:t,droppableContainers:n})=>{const r=[];for(const o of n){const{id:n}=o,i=t.get(n);if(i){const t=N(i,e);t>0&&r.push({id:n,data:{droppableContainer:o,value:t}})}}return r.sort(R)};function L(e,t){const{top:n,left:r,bottom:o,right:i}=t;return n<=e.y&&e.y<=o&&r<=e.x&&e.x<=i}function O(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}),{...t})}}const T=O(1),k={ignoreTransform:!1};function K(e,t=k){let n=e.getBoundingClientRect();if(t.ignoreTransform){const{getComputedStyle:t}=o.getWindow(e),{transform:r,transformOrigin:i}=t(e);r&&(n=function(e,t,n){let r,o,i,a,s;if(t.startsWith("matrix3d("))r=t.slice(9,-1).split(/, /),o=+r[0],i=+r[5],a=+r[12],s=+r[13];else{if(!t.startsWith("matrix("))return e;r=t.slice(7,-1).split(/, /),o=+r[0],i=+r[3],a=+r[4],s=+r[5]}const l=e.left-a-(1-o)*parseFloat(n),c=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:l+d,bottom:c+u,left:l}}(n,r,i))}const{top:r,left:i,width:a,height:s,bottom:l,right:c}=n;return{top:r,left:i,width:a,height:s,bottom:l,right:c}}function B(e){return K(e,{ignoreTransform:!0})}function I(e){const t=[];return e?function n(r){if(!r)return t;if(o.isDocument(r)&&null!=r.scrollingElement&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!o.isHTMLElement(r)||o.isSVGElement(r))return t;if(t.includes(r))return t;const{getComputedStyle:i}=o.getWindow(r),a=i(r);return r!==e&&function(e,t=o.getWindow(e).getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return null!=["overflow","overflowX","overflowY"].find(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(r,a)&&t.push(r),function(e,t=o.getWindow(e).getComputedStyle(e)){return"fixed"===t.position}(r,a)?t:n(r.parentNode)}(e):t}function W(e){return o.canUseDOM&&e?o.isWindow(e)?e:o.isNode(e)?o.isDocument(e)||e===o.getOwnerDocument(e).scrollingElement?window:o.isHTMLElement(e)?e:null:null:null}function z(e){return o.isWindow(e)?e.scrollX:e.scrollLeft}function P(e){return o.isWindow(e)?e.scrollY:e.scrollTop}function U(e){return{x:z(e),y:P(e)}}var F;function q(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"}(F||(F={}));const j={x:.2,y:.2};function H(e,t,{top:n,left:r,right:i,bottom:a},s=10,l=j){const{clientHeight:c,clientWidth:d}=e,u=(p=e,o.canUseDOM&&p&&p===document.scrollingElement?{top:0,left:0,right:d,bottom:c,width:d,height:c}:t);var p;const{isTop:h,isBottom:g,isLeft:v,isRight:f}=q(e),b={x:0,y:0},m={x:0,y:0},y=u.height*l.y,x=u.width*l.x;return!h&&n<=u.top+y?(b.y=F.Backward,m.y=s*Math.abs((u.top+y-n)/y)):!g&&a>=u.bottom-y&&(b.y=F.Forward,m.y=s*Math.abs((u.bottom-y-a)/y)),!f&&i>=u.right-x?(b.x=F.Forward,m.x=s*Math.abs((u.right-x-i)/x)):!v&&r<=u.left+x&&(b.x=F.Backward,m.x=s*Math.abs((u.left+x-r)/x)),{direction:b,speed:m}}function $(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 V(e){return e.reduce((e,t)=>o.add(e,U(t)),x)}const X=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+z(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+P(t),0)}]];class Y{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=I(t),r=V(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of X)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n);return this.rect[i]+(r[e]-t)},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}var _,G,J;(_=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[_.Pointer=0]="Pointer",_[_.DraggableRect=1]="DraggableRect",(G=exports.TraversalOrder||(exports.TraversalOrder={}))[G.TreeOrder=0]="TreeOrder",G[G.ReversedTreeOrder=1]="ReversedTreeOrder",(J=exports.MeasuringStrategy||(exports.MeasuringStrategy={}))[J.Always=0]="Always",J[J.BeforeDragging=1]="BeforeDragging",J[J.WhileDragging=2]="WhileDragging",(exports.MeasuringFrequency||(exports.MeasuringFrequency={})).Optimized="optimized";const Q=new Map,Z={measure:B,strategy:exports.MeasuringStrategy.WhileDragging,frequency:exports.MeasuringFrequency.Optimized};function ee({onResize:e,disabled:n}){const r=t.useMemo(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:t}=window;return new t(e)},[n,e]);return t.useEffect(()=>()=>null==r?void 0:r.disconnect(),[r]),r}const te=[],ne=ie(B),re=ae(B);function oe(e,n,r){const i=t.useRef(e);return o.useLazyMemo(t=>e?r||!t&&e||e!==i.current?o.isHTMLElement(e)&&null==e.parentNode?null:new Y(n(e),e):null!=t?t:null:null,[e,r,n])}function ie(e){return(t,n)=>oe(t,e,n)}function ae(e){const n=[];return function(r,i){const a=t.useRef(r);return o.useLazyMemo(t=>r.length?i||!t&&r.length||r!==a.current?r.map(t=>new Y(e(t),t)):null!=t?t:n:n,[r,i])}}function se(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return o.isHTMLElement(t)?t:e}class le{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function ce(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 de,ue;function pe(e){e.preventDefault()}function he(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(de||(de={})),(ue=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",ue.Down="ArrowDown",ue.Right="ArrowRight",ue.Left="ArrowLeft",ue.Up="ArrowUp",ue.Esc="Escape",ue.Enter="Enter";const ge={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},ve=(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 fe{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.coordinates=x,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new le(o.getOwnerDocument(t)),this.windowListeners=new le(o.getWindow(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(de.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const n=B(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(o.isKeyboardEvent(e)){const{coordinates:t}=this,{active:n,context:r,options:i}=this.props,{keyboardCodes:a=ge,coordinateGetter:s=ve,scrollBehavior:l="smooth"}=i,{code:c}=e;if(a.end.includes(c))return void this.handleEnd(e);if(a.cancel.includes(c))return void this.handleCancel(e);const d=s(e,{active:n,context:r.current,currentCoordinates:t});if(d){const n={x:0,y:0},{scrollableAncestors:i}=r.current;for(const r of i){const i=e.code,a=o.subtract(d,t),{isTop:s,isRight:c,isLeft:u,isBottom:p,maxScroll:h,minScroll:g}=q(r),v=$(r),f={x:Math.min(i===exports.KeyboardCode.Right?v.right-v.width/2:v.right,Math.max(i===exports.KeyboardCode.Right?v.left:v.left+v.width/2,d.x)),y:Math.min(i===exports.KeyboardCode.Down?v.bottom-v.height/2:v.bottom,Math.max(i===exports.KeyboardCode.Down?v.top:v.top+v.height/2,d.y))},b=i===exports.KeyboardCode.Right&&!c||i===exports.KeyboardCode.Left&&!u,m=i===exports.KeyboardCode.Down&&!p||i===exports.KeyboardCode.Up&&!s;if(b&&f.x!==d.x){if(i===exports.KeyboardCode.Right&&r.scrollLeft+a.x<=h.x||i===exports.KeyboardCode.Left&&r.scrollLeft+a.x>=g.x)return void r.scrollBy({left:a.x,behavior:l});n.x=i===exports.KeyboardCode.Right?r.scrollLeft-h.x:r.scrollLeft-g.x,r.scrollBy({left:-n.x,behavior:l});break}if(m&&f.y!==d.y){if(i===exports.KeyboardCode.Down&&r.scrollTop+a.y<=h.y||i===exports.KeyboardCode.Up&&r.scrollTop+a.y>=g.y)return void r.scrollBy({top:a.y,behavior:l});n.y=i===exports.KeyboardCode.Down?r.scrollTop-h.y:r.scrollTop-g.y,r.scrollBy({top:-n.y,behavior:l});break}}this.handleMove(e,o.add(d,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 be(e){return Boolean(e&&"distance"in e)}function me(e){return Boolean(e&&"delay"in e)}fe.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=ge,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}];class ye{constructor(e,t,n=function(e){const{EventTarget:t}=o.getWindow(e);return e instanceof t?e:o.getOwnerDocument(e)}(e.event.target)){var r;this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:i}=e,{target:a}=i;this.props=e,this.events=t,this.document=o.getOwnerDocument(a),this.documentListeners=new le(this.document),this.listeners=new le(n),this.windowListeners=new le(o.getWindow(a)),this.initialCoordinates=null!=(r=o.getEventCoordinates(i))?r:x,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(de.Resize,this.handleCancel),this.windowListeners.add(de.DragStart,pe),this.windowListeners.add(de.VisibilityChange,this.handleCancel),this.windowListeners.add(de.ContextMenu,pe),this.documentListeners.add(de.Keydown,this.handleKeydown),t){if(be(t))return;if(me(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(de.Click,he,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(de.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!r)return;const l=null!=(t=o.getEventCoordinates(e))?t:x,c=o.subtract(r,l);if(!n&&s){if(me(s))return ce(c,s.tolerance)?this.handleCancel():void 0;if(be(s))return null!=s.tolerance&&ce(c,s.tolerance)?this.handleCancel():ce(c,s.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),a(l)}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()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const xe={move:{name:"pointermove"},end:{name:"pointerup"}};class we extends ye{constructor(e){const{event:t}=e,n=o.getOwnerDocument(t.target);super(e,xe,n)}}we.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const Ce={move:{name:"mousemove"},end:{name:"mouseup"}};var De;!function(e){e[e.RightClick=2]="RightClick"}(De||(De={}));class Re extends ye{constructor(e){super(e,Ce,o.getOwnerDocument(e.event.target))}}Re.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==De.RightClick&&(null==t||t({event:e}),!0)}];const Ee={move:{name:"touchmove"},end:{name:"touchend"}};class Se extends ye{constructor(e){super(e,Ee)}static setup(){return window.addEventListener(Ee.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ee.move.name,e)};function e(){}}}function Me(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}Se.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}];const Ne=[{sensor:we,options:{}},{sensor:fe,options:{}}],Ae={current:{}},Le=t.createContext({...x,scaleX:1,scaleY:1}),Oe=t.memo((function({id:e,autoScroll:i=!0,announcements:s,children:c,sensors:d=Ne,collisionDetection:u=A,measuring:p,modifiers:m,screenReaderInstructions:w=a,...C}){var D,R,E,M,N,L,O;const k=t.useReducer(f,void 0,v),[z,P]=k,[F,q]=t.useState(()=>({type:null,event:null})),[j,$]=t.useState(!1),{draggable:{active:X,nodes:_,translate:G},droppable:{containers:J}}=z,ie=X?_[X]:null,ae=t.useRef({initial:null,translated:null}),le=t.useMemo(()=>{var e;return null!=X?{id:X,data:null!=(e=null==ie?void 0:ie.data)?e:Ae,rect:ae}:null},[X,ie]),ce=t.useRef(null),[de,ue]=t.useState(null),[pe,he]=t.useState(null),ge=o.useLatestValue(C,Object.values(C)),ve=o.useUniqueId("DndDescribedBy",e),fe=t.useMemo(()=>J.getEnabled(),[J]),{droppableRects:be,measureDroppableContainers:me,measuringScheduled:ye}=function(e,{dragging:n,dependencies:r,config:i}){const[a,s]=t.useState(null),l=null!=a,{frequency:c,measure:d,strategy:u}={...Z,...i},p=t.useRef(e),h=t.useCallback((e=[])=>s(t=>t?t.concat(e):e),[]),g=t.useRef(null),v=function(){switch(u){case exports.MeasuringStrategy.Always:return!1;case exports.MeasuringStrategy.BeforeDragging:return n;default:return!n}}(),f=o.useLazyMemo(t=>{if(v&&!n)return Q;const r=a;if(!t||t===Q||p.current!==e||null!=r){const t=new Map;for(let n of e){if(!n)continue;if(r&&r.length>0&&!r.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,o=e?new Y(d(e),e):null;n.rect.current=o,o&&t.set(n.id,o)}return t}return t},[e,a,n,v,d]);return t.useEffect(()=>{p.current=e},[e]),t.useEffect(()=>{v||requestAnimationFrame(()=>h())},[n,v]),t.useEffect(()=>{l&&s(null)},[l]),t.useEffect(()=>{v||"number"!=typeof c||null!==g.current||(g.current=setTimeout(()=>{h(),g.current=null},c))},[c,v,h,...r]),{droppableRects:f,measureDroppableContainers:h,measuringScheduled:l}}(fe,{dragging:j,dependencies:[G.x,G.y],config:null==p?void 0:p.droppable}),xe=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])}(_,X),we=pe?o.getEventCoordinates(pe):null,Ce=oe(xe,null!=(D=null==p||null==(R=p.draggable)?void 0:R.measure)?D:B),De=ne(xe?xe.parentElement:null),Re=t.useRef({active:null,activeNode:xe,collisionRect:null,collisions:null,droppableRects:be,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ee=J.getNodeFor(null==(E=Re.current.over)?void 0:E.id),Se=function({measure:e=K}){const[n,r]=t.useState(null),i=ee({onResize:t.useCallback(t=>{for(const{target:n}of t)if(o.isHTMLElement(n)){r(t=>{const r=e(n);return t?{...t,width:r.width,height:r.height}:r});break}},[e])}),a=t.useCallback(t=>{const n=se(t);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?e(n):null)},[e,i]),[s,l]=o.useNodeRef(a);return t.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}({measure:null==p||null==(M=p.dragOverlay)?void 0:M.measure}),Oe=null!=(N=Se.nodeRef.current)?N:xe,Te=null!=(L=Se.rect)?L:Ce,ke=t.useRef(null),Ke=Te===Ce?(Ie=ke.current,(Be=Ce)&&Ie?{x:Be.left-Ie.left,y:Be.top-Ie.top}:x):x;var Be,Ie;const We=t.useMemo(()=>ze?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(ze):null,[ze=Oe?Oe.ownerDocument.defaultView:null]);var ze;const Pe=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:I(e):te,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(X?null!=Ee?Ee:Oe:null),Ue=re(Pe),Fe=Me(m,{transform:{x:G.x-Ke.x,y:G.y-Ke.y,scaleX:1,scaleY:1},activatorEvent:pe,active:le,activeNodeRect:Ce,containerNodeRect:De,draggingNodeRect:Te,over:Re.current.over,overlayNodeRect:Se.rect,scrollableAncestors:Pe,scrollableAncestorRects:Ue,windowRect:We}),qe=we?o.add(we,G):null,je=function(e){const[n,r]=t.useState(null),i=t.useRef(e),a=t.useCallback(e=>{const t=W(e.target);t&&r(e=>e?(e.set(t,U(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=i.current;if(e!==t){n(t);const o=e.map(e=>{const t=W(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,U(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),i.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=W(e);null==t||t.removeEventListener("scroll",a)})}},[a,e]),t.useMemo(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>o.add(e,t),x):V(e):x,[e,n])}(Pe),He=o.add(Fe,je),$e=Te?T(Te,Fe):null,Ve=le&&$e?u({active:le,collisionRect:$e,droppableRects:be,droppableContainers:fe,pointerCoordinates:qe}):null,Xe=S(Ve,"id"),[Ye,_e]=t.useState(null),Ge=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Fe,null!=(O=null==Ye?void 0:Ye.rect)?O:null,Ce),Je=t.useCallback((e,{sensor:t,options:n})=>{if(!ce.current)return;const o=_[ce.current];if(!o)return;const i=new t({active:ce.current,activeNode:o,event:e.nativeEvent,options:n,context:Re,onStart(e){const t=ce.current;if(!t)return;const n=_[t];if(!n)return;const{onDragStart:o}=ge.current,i={active:{id:t,data:n.data,rect:ae}};r.unstable_batchedUpdates(()=>{P({type:l.DragStart,initialCoordinates:e,active:t}),q({type:l.DragStart,event:i})}),null==o||o(i)},onMove(e){P({type:l.DragMove,coordinates:e})},onEnd:a(l.DragEnd),onCancel:a(l.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:i}=Re.current;let a=null;if(t&&i){const{cancelDrop:r}=ge.current;a={active:t,collisions:n,delta:i,over:o},e===l.DragEnd&&"function"==typeof r&&await Promise.resolve(r(a))&&(e=l.DragCancel)}ce.current=null,r.unstable_batchedUpdates(()=>{if(P({type:e}),_e(null),$(!1),ue(null),he(null),a&&q({type:e,event:a}),a){const{onDragCancel:t,onDragEnd:n}=ge.current,r=e===l.DragEnd?n:t;null==r||r(a)}})}}r.unstable_batchedUpdates(()=>{ue(i),he(e.nativeEvent)})},[_]),Qe=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])}(d,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==ce.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},ce.current=r,Je(n,t))},[Je]));!function(e){t.useEffect(()=>{if(!o.canUseDOM)return;const t=e.map(({sensor:e})=>null==e.setup?void 0:e.setup());return()=>{for(const e of t)null==e||e()}},e.map(({sensor:e})=>e))}(d),t.useEffect(()=>{null!=X&&$(!0)},[X]),t.useEffect(()=>{le||(ke.current=null),le&&Ce&&!ke.current&&(ke.current=Ce)},[Ce,le]),t.useEffect(()=>{const{onDragMove:e}=ge.current,{active:t,collisions:n,over:r}=Re.current;if(!t)return;const o={active:t,collisions:n,delta:{x:He.x,y:He.y},over:r};q({type:l.DragMove,event:o}),null==e||e(o)},[He.x,He.y]),t.useEffect(()=>{const{active:e,collisions:t,droppableContainers:n,scrollAdjustedTranslate:o}=Re.current;if(!e||!ce.current||!o)return;const{onDragOver:i}=ge.current,a=n.get(Xe),s=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,c={active:e,collisions:t,delta:{x:o.x,y:o.y},over:s};r.unstable_batchedUpdates(()=>{_e(s),q({type:l.DragOver,event:c}),null==i||i(c)})},[Xe]),o.useIsomorphicLayoutEffect(()=>{Re.current={active:le,activeNode:xe,collisionRect:$e,collisions:Ve,droppableRects:be,draggableNodes:_,draggingNode:Oe,draggingNodeRect:Te,droppableContainers:J,over:Ye,scrollableAncestors:Pe,scrollAdjustedTranslate:He},ae.current={initial:Te,translated:$e}},[le,xe,Ve,$e,_,Oe,Te,be,J,Ye,Pe,He]),function({acceleration:e,activator:n=exports.AutoScrollActivator.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:s=5,order:l=exports.TraversalOrder.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,threshold:p}){const[h,g]=o.useInterval(),v=t.useRef({x:1,y:1}),f=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 i}return null},[n,i,c]),b=t.useRef(x),m=t.useRef(null),y=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?[...d].reverse():d,[l,d]);t.useEffect(()=>{if(a&&d.length&&f){for(const t of w){if(!1===(null==r?void 0:r(t)))continue;const n=d.indexOf(t),o=u[n];if(!o)continue;const{direction:i,speed:a}=H(t,o,f,e,p);if(a.x>0||a.y>0)return g(),m.current=t,h(y,s),v.current=a,void(b.current=i)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,y,r,g,a,s,JSON.stringify(f),h,d,w,u,JSON.stringify(p)])}({...function(){const e=!(!1===(null==de?void 0:de.autoScrollEnabled)||("object"==typeof i?!1===i.enabled:!1===i));return"object"==typeof i?{...i,enabled:e}:{enabled:e}}(),draggingRect:$e,pointerCoordinates:qe,scrollableAncestors:Pe,scrollableAncestorRects:Ue});const Ze=t.useMemo(()=>({active:le,activeNode:xe,activeNodeRect:Ce,activatorEvent:pe,collisions:Ve,containerNodeRect:De,dragOverlay:Se,draggableNodes:_,droppableContainers:J,droppableRects:be,over:Ye,measureDroppableContainers:me,scrollableAncestors:Pe,scrollableAncestorRects:Ue,measuringScheduled:ye,windowRect:We}),[le,xe,Ce,pe,Ve,De,Se,_,J,be,Ye,me,Pe,Ue,ye,We]),et=t.useMemo(()=>({activatorEvent:pe,activators:Qe,active:le,activeNodeRect:Ce,ariaDescribedById:{draggable:ve},dispatch:P,draggableNodes:_,over:Ye,measureDroppableContainers:me}),[pe,Qe,le,Ce,P,ve,_,Ye,me]);return n.createElement(b.Provider,{value:F},n.createElement(h.Provider,{value:et},n.createElement(g.Provider,{value:Ze},n.createElement(Le.Provider,{value:Ge},c))),n.createElement(y,{announcements:s,hiddenTextDescribedById:ve,screenReaderInstructions:w}))})),Te=t.createContext(null),ke="button";function Ke(){return t.useContext(g)}const Be={timeout:25},Ie={duration:250,easing:"ease",dragSourceOpacity:0},We={x:0,y:0,scaleX:1,scaleY:1},ze=e=>o.isKeyboardEvent(e)?"transform 250ms ease":void 0,Pe=n.memo(({adjustScale:e=!1,children:r,dropAnimation:i=Ie,style:a,transition:s=ze,modifiers:l,wrapperElement:c="div",className:d,zIndex:u=999})=>{var g,v;const{active:f,activeNodeRect:b,containerNodeRect:m,draggableNodes:y,activatorEvent:x,over:w,dragOverlay:D,scrollableAncestors:R,scrollableAncestorRects:E,windowRect:S}=Ke(),M=t.useContext(Le),N=Me(l,{activatorEvent:x,active:f,activeNodeRect:b,containerNodeRect:m,draggingNodeRect:D.rect,over:w,overlayNodeRect:D.rect,scrollableAncestors:R,scrollableAncestorRects:E,transform:M,windowRect:S}),A=null!==f,L=e?N:{...N,scaleX:1,scaleY:1},O=o.useLazyMemo(e=>A?e||(b?{...b}:null):null,[A,b]),T=O?{position:"fixed",width:O.width,height:O.height,top:O.top,left:O.left,zIndex:u,transform:o.CSS.Transform.toString(L),touchAction:"none",transformOrigin:e&&x?C(x,O):void 0,transition:"function"==typeof s?s(x):s,...a}:void 0,k=A?{style:T,children:r,className:d,transform:L}:void 0,K=t.useRef(k),I=null!=k?k:K.current,{children:W,...z}=null!=I?I:{},P=t.useRef(null!=(g=null==f?void 0:f.id)?g:null),U=function({animate:e,adjustScale:n,activeId:r,draggableNodes:i,duration:a,dragSourceOpacity:s,easing:l,node:c,transform:d}){const[u,p]=t.useState(!1);return o.useIsomorphicLayoutEffect(()=>{var t;if(!(e&&r&&l&&a))return void(e&&p(!0));const u=null==(t=i[r])?void 0:t.node.current;if(d&&c&&u&&null!==u.parentNode){const e=se(c);if(e){const t=e.getBoundingClientRect(),r=B(u),i={x:t.left-r.left,y:t.top-r.top};if(Math.abs(i.x)||Math.abs(i.y)){const e=o.CSS.Transform.toString({x:d.x-i.x,y:d.y-i.y,scaleX:n?r.width*d.scaleX/t.width:1,scaleY:n?r.height*d.scaleY/t.height:1}),h=u.style.opacity;return null!=s&&(u.style.opacity=""+s),void(c.animate([{transform:o.CSS.Transform.toString(d)},{transform:e}],{easing:l,duration:a}).onfinish=()=>{c.style.display="none",p(!0),u&&null!=s&&(u.style.opacity=h)})}}}p(!0)},[e,r,n,i,a,l,s,c,d]),o.useIsomorphicLayoutEffect(()=>{u&&p(!1)},[u]),u}({animate:Boolean(i&&P.current&&!f),adjustScale:e,activeId:P.current,draggableNodes:y,duration:null==i?void 0:i.duration,easing:null==i?void 0:i.easing,dragSourceOpacity:null==i?void 0:i.dragSourceOpacity,node:D.nodeRef.current,transform:null==(v=K.current)?void 0:v.transform}),F=Boolean(W&&(r||i&&!U));return t.useEffect(()=>{var e;(null==f?void 0:f.id)!==P.current&&(P.current=null!=(e=null==f?void 0:f.id)?e:null),f&&K.current!==k&&(K.current=k)},[f,k]),t.useEffect(()=>{U&&(K.current=void 0)},[U]),F?n.createElement(h.Provider,{value:p},n.createElement(Le.Provider,{value:We},n.createElement(c,{...z,ref:D.setRef},W))):null});exports.DndContext=Oe,exports.DragOverlay=Pe,exports.KeyboardSensor=fe,exports.MouseSensor=Re,exports.PointerSensor=we,exports.TouchSensor=Se,exports.applyModifiers=Me,exports.closestCenter=({collisionRect:e,droppableRects:t,droppableContainers:n})=>{const r=M(e,e.left,e.top),o=[];for(const e of n){const{id:n}=e,i=t.get(n);if(i){const t=w(M(i),r);o.push({id:n,data:{droppableContainer:e,value:t}})}}return o.sort(D)},exports.closestCorners=({collisionRect:e,droppableRects:t,droppableContainers:n})=>{const r=E(e),o=[];for(const e of n){const{id:n}=e,i=t.get(n);if(i){const t=E(i),a=r.reduce((e,n,r)=>e+w(t[r],n),0),s=Number((a/4).toFixed(4));o.push({id:n,data:{droppableContainer:e,value:s}})}}return o.sort(D)},exports.defaultAnnouncements=s,exports.defaultCoordinates=x,exports.defaultDropAnimation=Ie,exports.getClientRect=K,exports.getFirstCollision=S,exports.getScrollableAncestors=I,exports.pointerWithin=({droppableContainers:e,droppableRects:t,pointerCoordinates:n})=>{if(!n)return[];const r=[];for(const o of e){const{id:e}=o,i=t.get(e);if(i&&L(n,i)){const t=E(i).reduce((e,t)=>e+w(n,t),0),a=Number((t/4).toFixed(4));r.push({id:e,data:{droppableContainer:o,value:a}})}}return r.sort(D)},exports.rectIntersection=A,exports.useDndContext=Ke,exports.useDndMonitor=m,exports.useDraggable=function({id:e,data:n,disabled:r=!1,attributes:i}){const a=o.useUniqueId("Droppable"),{activators:s,activatorEvent:l,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:p,over:g}=t.useContext(h),{role:v=ke,roleDescription:f="draggable",tabIndex:b=0}=null!=i?i:{},m=(null==c?void 0:c.id)===e,y=t.useContext(m?Le:Te),[x,w]=o.useNodeRef(),C=function(e,n){return t.useMemo(()=>e.reduce((e,{eventName:t,handler:r})=>(e[t]=e=>{r(e,n)},e),{}),[e,n])}(s,e),D=o.useLatestValue(n);return o.useIsomorphicLayoutEffect(()=>(p[e]={id:e,key:a,node:x,data:D},()=>{const t=p[e];t&&t.key===a&&delete p[e]}),[p,e]),{active:c,activatorEvent:l,activeNodeRect:d,attributes:t.useMemo(()=>({role:v,tabIndex:b,"aria-pressed":!(!m||v!==ke)||void 0,"aria-roledescription":f,"aria-describedby":u.draggable}),[v,b,m,f,u.draggable]),isDragging:m,listeners:r?void 0:C,node:x,over:g,setNodeRef:w,transform:y}},exports.useDroppable=function({data:e,disabled:n=!1,id:r,resizeObserverConfig:i}){const a=o.useUniqueId("Droppable"),{active:s,dispatch:c,over:d,measureDroppableContainers:u}=t.useContext(h),p=t.useRef(!1),g=t.useRef(null),v=t.useRef(null),{disabled:f,updateMeasurementsFor:b,timeout:m}={...Be,...i},y=o.useLatestValue(null!=b?b:r),x=ee({onResize:t.useCallback(()=>{p.current?(null!=v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{u("string"==typeof y.current?[y.current]:y.current),v.current=null},m)):p.current=!0},[m]),disabled:f||!s}),w=t.useCallback((e,t)=>{x&&(t&&(x.unobserve(t),p.current=!1),e&&x.observe(e))},[x]),[C,D]=o.useNodeRef(w),R=o.useLatestValue(e);return t.useEffect(()=>{x&&C.current&&(x.disconnect(),p.current=!1,x.observe(C.current))},[C,x]),o.useIsomorphicLayoutEffect(()=>(c({type:l.RegisterDroppable,element:{id:r,key:a,disabled:n,node:C,rect:g,data:R}}),()=>c({type:l.UnregisterDroppable,key:a,id:r})),[r]),t.useEffect(()=>{c({type:l.SetDroppableDisabled,id:r,key:a,disabled:n})},[n]),{active:s,rect:g,isOver:(null==d?void 0:d.id)===r,node:C,over:d,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])};
//# sourceMappingURL=core.cjs.production.min.js.map

@@ -1,2 +0,2 @@

import type { Active, Data, DroppableContainer } from '../../store';
import type { Active, Data, DroppableContainer, RectMap } from '../../store';
import type { Coordinates, ClientRect, UniqueIdentifier } from '../../types';

@@ -17,4 +17,5 @@ export interface Collision {

collisionRect: ClientRect;
droppableRects: RectMap;
droppableContainers: DroppableContainer[];
pointerCoordinates: Coordinates | null;
}) => Collision[];
{
"name": "@dnd-kit/core",
"version": "5.1.0-next-2022212212756",
"version": "5.1.0-next-202221523720",
"description": "dnd kit – a lightweight React library for building performant and accessible drag and drop experiences",

@@ -5,0 +5,0 @@ "author": "Claudéric Demers",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc