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 3.0.4 to 3.1.0

6

CHANGELOG.md
# @dnd-kit/core
## 3.1.0
### Minor Changes
- [`d39ab11`](https://github.com/clauderic/dnd-kit/commit/d39ab1112f9be78d467b2dfe488a7ea931d93767) [#316](https://github.com/clauderic/dnd-kit/pull/316) Thanks [@lsit](https://github.com/lsit)! - Added ability to optionally return screen reader announcements `onDragMove`.
## 3.0.4

@@ -4,0 +10,0 @@

1

dist/components/Accessibility/types.d.ts
import type { UniqueIdentifier } from '../../types';
export interface Announcements {
onDragStart(id: UniqueIdentifier): string | undefined;
onDragMove?(id: UniqueIdentifier, overId: UniqueIdentifier | undefined): string | undefined;
onDragOver(id: UniqueIdentifier, overId: UniqueIdentifier | undefined): string | undefined;

@@ -5,0 +6,0 @@ onDragEnd(id: UniqueIdentifier, overId: UniqueIdentifier | undefined): string | undefined;

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"),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){if(function(e){var t;return(null==(t=window)?void 0:t.TouchEvent)&&e instanceof TouchEvent}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){var t;return(null==(t=window)?void 0:t.MouseEvent)&&e instanceof MouseEvent||e.type.includes("mouse")}(e)?{x:e.clientX,y:e.clientY}:{x:0,y:0}}function y(e,t){if(e instanceof KeyboardEvent)return"0 0";const n=v(e);return`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`}function b(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+.5*e.width,y:n+.5*e.height}}function m(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 x=m(1);function w(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 D(e){return o.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function R(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var C;function E(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"}(C||(C={}));const M={x:.2,y:.2};function S(e,t,{top:n,left:r,right:a,bottom:s},i=10,l=M){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}=E(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=C.Backward,b.y=i*Math.abs((d.top+m-n)/m)):!h&&s>=d.bottom-m&&(y.y=C.Forward,b.y=i*Math.abs((d.bottom-m-s)/m)),!v&&a>=d.right-x?(y.x=C.Forward,b.x=i*Math.abs((d.right-x-a)/x)):!g&&r<=d.left+x&&(y.x=C.Backward,b.x=i*Math.abs((d.left+x-r)/x)),{direction:y,speed:b}}function L(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 N(e){return e.reduce((e,t)=>o.add(e,R(t)),h)}function T(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}=T(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 K(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=T(e),a=N(w(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 O(e){return"top"in e}function B(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 I=(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 k(e){return e instanceof HTMLElement?e.ownerDocument:document}function P(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}}}function j(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 q=t.createContext({type:null,event:null});function H({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:a}){const s=t.useContext(q),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 z({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)},[]),H(t.useMemo(()=>({onDragStart({active:t}){c(e.onDragStart(t.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 W,F,U;function X(e){const n=t.useRef(e);return o.useIsomorphicLayoutEffect(()=>{n.current!==e&&(n.current=e)},[e]),n}(W=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[W.Pointer=0]="Pointer",W[W.DraggableRect=1]="DraggableRect",(F=exports.TraversalOrder||(exports.TraversalOrder={}))[F.TreeOrder=0]="TreeOrder",F[F.ReversedTreeOrder=1]="ReversedTreeOrder",(U=exports.LayoutMeasuringStrategy||(exports.LayoutMeasuringStrategy={}))[U.Always=0]="Always",U[U.BeforeDragging=1]="BeforeDragging",U[U.WhileDragging=2]="WhileDragging",(exports.LayoutMeasuringFrequency||(exports.LayoutMeasuringFrequency={})).Optimized="optimized";const Y=new Map,$={strategy:exports.LayoutMeasuringStrategy.WhileDragging,frequency:exports.LayoutMeasuringFrequency.Optimized},V=[],G=Q(A),J=Z(A),_=Q(K);function Q(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 Z(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 ee{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 te(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 ne;(ne=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",ne.Down="ArrowDown",ne.Right="ArrowRight",ne.Left="ArrowLeft",ne.Up="ArrowUp",ne.Esc="Escape",ne.Enter="Enter";const re={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},oe=(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 ae{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=h;const{event:{target:t}}=e;this.props=e,this.listeners=new ee(k(t)),this.windowListeners=new ee(function(e){var t;return null!=(t=k(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=re,coordinateGetter:i=oe,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}=E(r),g=L(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 se(e){return Boolean(e&&"distance"in e)}function ie(e){return Boolean(e&&"delay"in e)}var le;ae.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=re,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"}(le||(le={}));class ce{constructor(e,t,n=function(e){return e instanceof HTMLElement?e:k(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=k(r.target),this.listeners=new ee(n),this.initialCoordinates=v(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(le.Keydown,this.handleKeydown),t){if(se(t))return;if(ie(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(le.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=v(e),l=o.subtract(n,i);if(!t&&s){if(ie(s))return te(l,s.tolerance)?this.handleCancel():void 0;if(se(s))return te(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 ue={move:{name:"pointermove"},end:{name:"pointerup"}};class de extends ce{constructor(e){const{event:t}=e,n=k(t.target);super(e,ue,n)}}de.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const fe={move:{name:"mousemove"},end:{name:"mouseup"}};var pe;!function(e){e[e.RightClick=2]="RightClick"}(pe||(pe={}));class he extends ce{constructor(e){super(e,fe,k(e.event.target))}}he.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==pe.RightClick&&(null==t||t({event:e}),!0)}];const ge={move:{name:"touchmove"},end:{name:"touchend"}};class ve extends ce{constructor(e){super(e,ge)}}function ye(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}ve.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:de,options:{}},{sensor:ae,options:{}}],me={current:{}},xe=t.createContext({...h,scaleX:1,scaleY:1}),we=t.memo((function({id:e,autoScroll:r=!0,announcements:a,children:i,sensors:c=be,collisionDetection:u=I,layoutMeasuring:d,modifiers:f,screenReaderInstructions:g=s,...y}){var b,m,C;const E=t.useReducer(j,void 0,P),[M,L]=E,[A,K]=t.useState(()=>({type:null,event:null})),{draggable:{active:O,nodes:B,translate:k},droppable:{containers:H}}=M,W=O?B[O]:null,F=t.useRef({initial:null,translated:null}),U=t.useMemo(()=>{var e;return null!=O?{id:O,data:null!=(e=null==W?void 0:W.data)?e:me,rect:F}:null},[O,W]),X=t.useRef(null),[Q,Z]=t.useState(null),[ee,te]=t.useState(null),ne=t.useRef(y),re=o.useUniqueId("DndDescribedBy",e),{layoutRectMap:oe,recomputeLayouts:ae,willRecomputeLayouts:se}=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 Y;if(!t||t===Y||d.current!==e||s){for(let t of Object.values(e))t&&(t.rect.current=t.node.current?T(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}}(H,{dragging:null!=O,dependencies:[k.x,k.y],config:d}),ie=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])}(B,O),le=ee?v(ee):null,ce=_(ie),ue=G(ie),de=t.useRef(null),fe=(he=de.current,(pe=ce)&&he?{x:pe.left-he.left,y:pe.top-he.top}:h);var pe,he;const ge=t.useRef({active:null,activeNode:ie,collisionRect:null,droppableRects:oe,draggableNodes:B,draggingNodeRect:null,droppableContainers:H,over:null,scrollableAncestors:[],scrollAdjustedTransalte:null,translatedRect:null}),ve=function(e,t){var n,r;return e&&null!=(n=null==(r=t[e])?void 0:r.node.current)?n:null}(null!=(b=null==(m=ge.current.over)?void 0:m.id)?b:null,H),we=G(ie?ie.ownerDocument.defaultView:null),De=G(ie?ie.parentElement:null),Re=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:w(e):V,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(O?null!=ve?ve:ie:null),Ce=J(Re),[Ee,Me]=o.useNodeRef(),Se=G(O?Ee.current:null,se),Le=null!=Se?Se:ue,Ne=ye(f,{transform:{x:k.x-fe.x,y:k.y-fe.y,scaleX:1,scaleY:1},active:U,over:ge.current.over,activeNodeRect:ue,draggingNodeRect:Le,containerNodeRect:De,overlayNodeRect:Se,scrollableAncestors:Re,scrollableAncestorRects:Ce,windowRect:we}),Te=le?o.add(le,k):null,Ae=function(e){const[n,r]=t.useState(null),a=t.useRef(e),s=t.useCallback(e=>{const t=D(e.target);t&&r(e=>e?(e.set(t,R(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=a.current;if(e!==t){n(t);const o=e.map(e=>{const t=D(e);return t?(t.addEventListener("scroll",s,{passive:!0}),[t,R(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=D(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):N(e):h,[e,n])}(Re),Ke=o.add(Ne,Ae),Oe=ce?x(ce,Ne):null,Be=Oe?x(Oe,Ae):null,Ie=function(e,t){var n;return e&&null!=(n=t[e])?n:null}(U&&Be?u(Array.from(oe.entries()),Be):null,H),ke=t.useMemo(()=>Ie&&Ie.rect.current?{id:Ie.id,rect:Ie.rect.current,data:Ie.data,disabled:Ie.disabled}:null,[Ie]),Pe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Ne,null!=(C=null==Ie?void 0:Ie.rect.current)?C:null,ce),je=t.useCallback((e,{sensor:t,options:n})=>{if(!X.current)return;const r=B[X.current];if(!r)return;const o=new t({active:X.current,activeNode:r,event:e.nativeEvent,options:n,context:ge,onStart(e){const t=X.current;if(!t)return;const n=B[t];if(!n)return;const{onDragStart:r}=ne.current,o={active:{id:t,data:n.data,rect:F}};L({type:l.DragStart,initialCoordinates:e,active:t}),K({type:l.DragStart,event:o}),null==r||r(o)},onMove(e){L({type:l.DragMove,coordinates:e})},onEnd:a(l.DragEnd),onCancel:a(l.DragCancel)});function a(e){return async function(){const{active:t,over:n,scrollAdjustedTransalte:r}=ge.current;let o=null;if(t&&r){const{cancelDrop:a}=ne.current;o={active:t,delta:r,over:n},e===l.DragEnd&&"function"==typeof a&&await Promise.resolve(a(o))&&(e=l.DragCancel)}if(X.current=null,L({type:e}),Z(null),te(null),o){const{onDragCancel:t,onDragEnd:n}=ne.current,r=e===l.DragEnd?n:t;K({type:e,event:o}),null==r||r(o)}}}Z(o),te(e.nativeEvent)},[L,B]),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])}(c,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==X.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},X.current=r,je(n,t))},[je]));o.useIsomorphicLayoutEffect(()=>{ne.current=y},Object.values(y)),t.useEffect(()=>{U||(de.current=null),U&&ce&&!de.current&&(de.current=ce)},[ce,U]),t.useEffect(()=>{const{onDragMove:e}=ne.current,{active:t,over:n}=ge.current;if(!t)return;const r={active:t,delta:{x:Ke.x,y:Ke.y},over:n};K({type:l.DragMove,event:r}),null==e||e(r)},[Ke.x,Ke.y]),t.useEffect(()=>{const{active:e,scrollAdjustedTransalte:t}=ge.current;if(!e||!X.current||!t)return;const{onDragOver:n}=ne.current,r={active:e,delta:{x:t.x,y:t.y},over:ke};K({type:l.DragOver,event:r}),null==n||n(r)},[null==ke?void 0:ke.id]),o.useIsomorphicLayoutEffect(()=>{ge.current={active:U,activeNode:ie,collisionRect:Be,droppableRects:oe,draggableNodes:B,draggingNodeRect:Le,droppableContainers:H,over:ke,scrollableAncestors:Re,scrollAdjustedTransalte:Ke,translatedRect:Oe},F.current={initial:Le,translated:Oe}},[U,ie,Be,B,Le,oe,H,ke,Re,Ke,Oe]),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}=S(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==Q?void 0:Q.autoScrollEnabled)||("object"==typeof r?!1===r.enabled:!1===r));return"object"==typeof r?{...r,enabled:e}:{enabled:e}}(),draggingRect:Oe,pointerCoordinates:Te,scrollableAncestors:Re,scrollableAncestorRects:Ce});const He=t.useMemo(()=>({active:U,activeNode:ie,activeNodeRect:ce,activeNodeClientRect:ue,activatorEvent:ee,activators:qe,ariaDescribedById:{draggable:re},overlayNode:{nodeRef:Ee,rect:Se,setRef:Me},containerNodeRect:De,dispatch:L,draggableNodes:B,droppableContainers:H,droppableRects:oe,over:ke,recomputeLayouts:ae,scrollableAncestors:Re,scrollableAncestorRects:Ce,willRecomputeLayouts:se,windowRect:we}),[U,ie,ue,ce,ee,qe,De,Se,Ee,L,B,re,H,oe,ke,ae,Re,Ce,Me,se,we]);return n.createElement(q.Provider,{value:A},n.createElement(p.Provider,{value:He},n.createElement(xe.Provider,{value:Pe},i)),n.createElement(z,{announcements:a,hiddenTextDescribedById:re,screenReaderInstructions:g}))})),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:v,containerNodeRect:b,draggableNodes:m,activatorEvent:x,over:w,overlayNode:D,scrollableAncestors:R,scrollableAncestorRects:C,windowRect:E}=Ce(),M=t.useContext(xe),S=ye(l,{active:h,activeNodeRect:v,draggingNodeRect:D.rect,containerNodeRect:b,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,T=null!=L?L:S,A=e?T:{...T,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(A),touchAction:"none",transformOrigin:e&&x?y(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:A}: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),H=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=c.children.length>1?c:c.children[0];if(e){const r=e.getBoundingClientRect(),a=K(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}),z=Boolean(P&&(r||a&&!H));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(()=>{H&&(I.current=void 0)},[H]),z?n.createElement(c,{...j,ref:D.setRef},P):null});exports.DndContext=we,exports.DragOverlay=Se,exports.KeyboardSensor=ae,exports.MouseSensor=he,exports.PointerSensor=de,exports.TouchSensor=ve,exports.applyModifiers=ye,exports.closestCenter=(e,t)=>{const n=b(t,t.left,t.top),r=e.map(([e,t])=>g(b(t),n)),o=c(r);return e[o]?e[o][0]:null},exports.closestCorners=(e,t)=>{const n=B(t,t.left,t.top),r=e.map(([e,t])=>{const r=B(t,O(t)?t.left:void 0,O(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=w,exports.getViewRect=K,exports.rectIntersection=I,exports.useDndContext=Ce,exports.useDndMonitor=H,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=X(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=X(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(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){if(function(e){var t;return(null==(t=window)?void 0:t.TouchEvent)&&e instanceof TouchEvent}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){var t;return(null==(t=window)?void 0:t.MouseEvent)&&e instanceof MouseEvent||e.type.includes("mouse")}(e)?{x:e.clientX,y:e.clientY}:{x:0,y:0}}function y(e,t){if(e instanceof KeyboardEvent)return"0 0";const n=v(e);return`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`}function b(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+.5*e.width,y:n+.5*e.height}}function m(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 x=m(1);function w(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 D(e){return o.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function R(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var C;function E(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"}(C||(C={}));const M={x:.2,y:.2};function S(e,t,{top:n,left:r,right:a,bottom:s},i=10,l=M){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}=E(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=C.Backward,b.y=i*Math.abs((d.top+m-n)/m)):!h&&s>=d.bottom-m&&(y.y=C.Forward,b.y=i*Math.abs((d.bottom-m-s)/m)),!v&&a>=d.right-x?(y.x=C.Forward,b.x=i*Math.abs((d.right-x-a)/x)):!g&&r<=d.left+x&&(y.x=C.Backward,b.x=i*Math.abs((d.left+x-r)/x)),{direction:y,speed:b}}function L(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 N(e){return e.reduce((e,t)=>o.add(e,R(t)),h)}function T(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}=T(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 K(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=T(e),a=N(w(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 O(e){return"top"in e}function B(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 I=(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 k(e){return e instanceof HTMLElement?e.ownerDocument:document}function P(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}}}function j(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 q=t.createContext({type:null,event:null});function H({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:a}){const s=t.useContext(q),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 z({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)},[]),H(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 W,F,U;function X(e){const n=t.useRef(e);return o.useIsomorphicLayoutEffect(()=>{n.current!==e&&(n.current=e)},[e]),n}(W=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[W.Pointer=0]="Pointer",W[W.DraggableRect=1]="DraggableRect",(F=exports.TraversalOrder||(exports.TraversalOrder={}))[F.TreeOrder=0]="TreeOrder",F[F.ReversedTreeOrder=1]="ReversedTreeOrder",(U=exports.LayoutMeasuringStrategy||(exports.LayoutMeasuringStrategy={}))[U.Always=0]="Always",U[U.BeforeDragging=1]="BeforeDragging",U[U.WhileDragging=2]="WhileDragging",(exports.LayoutMeasuringFrequency||(exports.LayoutMeasuringFrequency={})).Optimized="optimized";const Y=new Map,$={strategy:exports.LayoutMeasuringStrategy.WhileDragging,frequency:exports.LayoutMeasuringFrequency.Optimized},V=[],G=Q(A),J=Z(A),_=Q(K);function Q(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 Z(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 ee{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 te(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 ne;(ne=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",ne.Down="ArrowDown",ne.Right="ArrowRight",ne.Left="ArrowLeft",ne.Up="ArrowUp",ne.Esc="Escape",ne.Enter="Enter";const re={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},oe=(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 ae{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=h;const{event:{target:t}}=e;this.props=e,this.listeners=new ee(k(t)),this.windowListeners=new ee(function(e){var t;return null!=(t=k(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=re,coordinateGetter:i=oe,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}=E(r),g=L(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 se(e){return Boolean(e&&"distance"in e)}function ie(e){return Boolean(e&&"delay"in e)}var le;ae.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=re,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"}(le||(le={}));class ce{constructor(e,t,n=function(e){return e instanceof HTMLElement?e:k(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=k(r.target),this.listeners=new ee(n),this.initialCoordinates=v(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(le.Keydown,this.handleKeydown),t){if(se(t))return;if(ie(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(le.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=v(e),l=o.subtract(n,i);if(!t&&s){if(ie(s))return te(l,s.tolerance)?this.handleCancel():void 0;if(se(s))return te(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 ue={move:{name:"pointermove"},end:{name:"pointerup"}};class de extends ce{constructor(e){const{event:t}=e,n=k(t.target);super(e,ue,n)}}de.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const fe={move:{name:"mousemove"},end:{name:"mouseup"}};var pe;!function(e){e[e.RightClick=2]="RightClick"}(pe||(pe={}));class he extends ce{constructor(e){super(e,fe,k(e.event.target))}}he.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==pe.RightClick&&(null==t||t({event:e}),!0)}];const ge={move:{name:"touchmove"},end:{name:"touchend"}};class ve extends ce{constructor(e){super(e,ge)}}function ye(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}ve.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:de,options:{}},{sensor:ae,options:{}}],me={current:{}},xe=t.createContext({...h,scaleX:1,scaleY:1}),we=t.memo((function({id:e,autoScroll:r=!0,announcements:a,children:i,sensors:c=be,collisionDetection:u=I,layoutMeasuring:d,modifiers:f,screenReaderInstructions:g=s,...y}){var b,m,C;const E=t.useReducer(j,void 0,P),[M,L]=E,[A,K]=t.useState(()=>({type:null,event:null})),{draggable:{active:O,nodes:B,translate:k},droppable:{containers:H}}=M,W=O?B[O]:null,F=t.useRef({initial:null,translated:null}),U=t.useMemo(()=>{var e;return null!=O?{id:O,data:null!=(e=null==W?void 0:W.data)?e:me,rect:F}:null},[O,W]),X=t.useRef(null),[Q,Z]=t.useState(null),[ee,te]=t.useState(null),ne=t.useRef(y),re=o.useUniqueId("DndDescribedBy",e),{layoutRectMap:oe,recomputeLayouts:ae,willRecomputeLayouts:se}=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 Y;if(!t||t===Y||d.current!==e||s){for(let t of Object.values(e))t&&(t.rect.current=t.node.current?T(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}}(H,{dragging:null!=O,dependencies:[k.x,k.y],config:d}),ie=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])}(B,O),le=ee?v(ee):null,ce=_(ie),ue=G(ie),de=t.useRef(null),fe=(he=de.current,(pe=ce)&&he?{x:pe.left-he.left,y:pe.top-he.top}:h);var pe,he;const ge=t.useRef({active:null,activeNode:ie,collisionRect:null,droppableRects:oe,draggableNodes:B,draggingNodeRect:null,droppableContainers:H,over:null,scrollableAncestors:[],scrollAdjustedTransalte:null,translatedRect:null}),ve=function(e,t){var n,r;return e&&null!=(n=null==(r=t[e])?void 0:r.node.current)?n:null}(null!=(b=null==(m=ge.current.over)?void 0:m.id)?b:null,H),we=G(ie?ie.ownerDocument.defaultView:null),De=G(ie?ie.parentElement:null),Re=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:w(e):V,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(O?null!=ve?ve:ie:null),Ce=J(Re),[Ee,Me]=o.useNodeRef(),Se=G(O?Ee.current:null,se),Le=null!=Se?Se:ue,Ne=ye(f,{transform:{x:k.x-fe.x,y:k.y-fe.y,scaleX:1,scaleY:1},active:U,over:ge.current.over,activeNodeRect:ue,draggingNodeRect:Le,containerNodeRect:De,overlayNodeRect:Se,scrollableAncestors:Re,scrollableAncestorRects:Ce,windowRect:we}),Te=le?o.add(le,k):null,Ae=function(e){const[n,r]=t.useState(null),a=t.useRef(e),s=t.useCallback(e=>{const t=D(e.target);t&&r(e=>e?(e.set(t,R(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=a.current;if(e!==t){n(t);const o=e.map(e=>{const t=D(e);return t?(t.addEventListener("scroll",s,{passive:!0}),[t,R(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=D(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):N(e):h,[e,n])}(Re),Ke=o.add(Ne,Ae),Oe=ce?x(ce,Ne):null,Be=Oe?x(Oe,Ae):null,Ie=function(e,t){var n;return e&&null!=(n=t[e])?n:null}(U&&Be?u(Array.from(oe.entries()),Be):null,H),ke=t.useMemo(()=>Ie&&Ie.rect.current?{id:Ie.id,rect:Ie.rect.current,data:Ie.data,disabled:Ie.disabled}:null,[Ie]),Pe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Ne,null!=(C=null==Ie?void 0:Ie.rect.current)?C:null,ce),je=t.useCallback((e,{sensor:t,options:n})=>{if(!X.current)return;const r=B[X.current];if(!r)return;const o=new t({active:X.current,activeNode:r,event:e.nativeEvent,options:n,context:ge,onStart(e){const t=X.current;if(!t)return;const n=B[t];if(!n)return;const{onDragStart:r}=ne.current,o={active:{id:t,data:n.data,rect:F}};L({type:l.DragStart,initialCoordinates:e,active:t}),K({type:l.DragStart,event:o}),null==r||r(o)},onMove(e){L({type:l.DragMove,coordinates:e})},onEnd:a(l.DragEnd),onCancel:a(l.DragCancel)});function a(e){return async function(){const{active:t,over:n,scrollAdjustedTransalte:r}=ge.current;let o=null;if(t&&r){const{cancelDrop:a}=ne.current;o={active:t,delta:r,over:n},e===l.DragEnd&&"function"==typeof a&&await Promise.resolve(a(o))&&(e=l.DragCancel)}if(X.current=null,L({type:e}),Z(null),te(null),o){const{onDragCancel:t,onDragEnd:n}=ne.current,r=e===l.DragEnd?n:t;K({type:e,event:o}),null==r||r(o)}}}Z(o),te(e.nativeEvent)},[L,B]),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])}(c,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==X.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},X.current=r,je(n,t))},[je]));o.useIsomorphicLayoutEffect(()=>{ne.current=y},Object.values(y)),t.useEffect(()=>{U||(de.current=null),U&&ce&&!de.current&&(de.current=ce)},[ce,U]),t.useEffect(()=>{const{onDragMove:e}=ne.current,{active:t,over:n}=ge.current;if(!t)return;const r={active:t,delta:{x:Ke.x,y:Ke.y},over:n};K({type:l.DragMove,event:r}),null==e||e(r)},[Ke.x,Ke.y]),t.useEffect(()=>{const{active:e,scrollAdjustedTransalte:t}=ge.current;if(!e||!X.current||!t)return;const{onDragOver:n}=ne.current,r={active:e,delta:{x:t.x,y:t.y},over:ke};K({type:l.DragOver,event:r}),null==n||n(r)},[null==ke?void 0:ke.id]),o.useIsomorphicLayoutEffect(()=>{ge.current={active:U,activeNode:ie,collisionRect:Be,droppableRects:oe,draggableNodes:B,draggingNodeRect:Le,droppableContainers:H,over:ke,scrollableAncestors:Re,scrollAdjustedTransalte:Ke,translatedRect:Oe},F.current={initial:Le,translated:Oe}},[U,ie,Be,B,Le,oe,H,ke,Re,Ke,Oe]),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}=S(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==Q?void 0:Q.autoScrollEnabled)||("object"==typeof r?!1===r.enabled:!1===r));return"object"==typeof r?{...r,enabled:e}:{enabled:e}}(),draggingRect:Oe,pointerCoordinates:Te,scrollableAncestors:Re,scrollableAncestorRects:Ce});const He=t.useMemo(()=>({active:U,activeNode:ie,activeNodeRect:ce,activeNodeClientRect:ue,activatorEvent:ee,activators:qe,ariaDescribedById:{draggable:re},overlayNode:{nodeRef:Ee,rect:Se,setRef:Me},containerNodeRect:De,dispatch:L,draggableNodes:B,droppableContainers:H,droppableRects:oe,over:ke,recomputeLayouts:ae,scrollableAncestors:Re,scrollableAncestorRects:Ce,willRecomputeLayouts:se,windowRect:we}),[U,ie,ue,ce,ee,qe,De,Se,Ee,L,B,re,H,oe,ke,ae,Re,Ce,Me,se,we]);return n.createElement(q.Provider,{value:A},n.createElement(p.Provider,{value:He},n.createElement(xe.Provider,{value:Pe},i)),n.createElement(z,{announcements:a,hiddenTextDescribedById:re,screenReaderInstructions:g}))})),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:v,containerNodeRect:b,draggableNodes:m,activatorEvent:x,over:w,overlayNode:D,scrollableAncestors:R,scrollableAncestorRects:C,windowRect:E}=Ce(),M=t.useContext(xe),S=ye(l,{active:h,activeNodeRect:v,draggingNodeRect:D.rect,containerNodeRect:b,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,T=null!=L?L:S,A=e?T:{...T,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(A),touchAction:"none",transformOrigin:e&&x?y(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:A}: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),H=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=c.children.length>1?c:c.children[0];if(e){const r=e.getBoundingClientRect(),a=K(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}),z=Boolean(P&&(r||a&&!H));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(()=>{H&&(I.current=void 0)},[H]),z?n.createElement(c,{...j,ref:D.setRef},P):null});exports.DndContext=we,exports.DragOverlay=Se,exports.KeyboardSensor=ae,exports.MouseSensor=he,exports.PointerSensor=de,exports.TouchSensor=ve,exports.applyModifiers=ye,exports.closestCenter=(e,t)=>{const n=b(t,t.left,t.top),r=e.map(([e,t])=>g(b(t),n)),o=c(r);return e[o]?e[o][0]:null},exports.closestCorners=(e,t)=>{const n=B(t,t.left,t.top),r=e.map(([e,t])=>{const r=B(t,O(t)?t.left:void 0,O(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=w,exports.getViewRect=K,exports.rectIntersection=I,exports.useDndContext=Ce,exports.useDndMonitor=H,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=X(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=X(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])};
//# sourceMappingURL=core.cjs.production.min.js.map

@@ -10,4 +10,4 @@ export { DndContext, DragOverlay, defaultAnnouncements, defaultDropAnimation, } from './components';

export type { Active, DndContextDescriptor, Over } from './store';
export type { DistanceMeasurement, DragEndEvent, DragMoveEvent, DragOverEvent, DragStartEvent, LayoutRect, RectEntry, Translate, UniqueIdentifier, ViewRect, } from './types';
export type { DistanceMeasurement, DragEndEvent, DragMoveEvent, DragOverEvent, DragStartEvent, DragCancelEvent, LayoutRect, RectEntry, Translate, UniqueIdentifier, ViewRect, } from './types';
export { defaultCoordinates, getBoundingClientRect, getViewRect, getScrollableAncestors, closestCenter, closestCorners, rectIntersection, } from './utilities';
export type { CollisionDetection } from './utilities';
{
"name": "@dnd-kit/core",
"version": "3.0.4",
"version": "3.1.0",
"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