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 6.0.0-next-202241914636 to 6.0.0-next-20224191800

dist/components/Accessibility/components/index.d.ts

84

CHANGELOG.md
# @dnd-kit/core
## 6.0.0-next-202241914636
## 6.0.0-next-20224191800
### Major Changes
- [#746](https://github.com/clauderic/dnd-kit/pull/746) [`4173087`](https://github.com/clauderic/dnd-kit/commit/417308704454c50f88ab305ab450a99bde5034b0) Thanks [@clauderic](https://github.com/clauderic)! - #### Regrouping accessibility-related props
Accessibility-related props have been regrouped under the `accessibility` prop of `<DndContext>`:
```diff
<DndContext
- announcements={customAnnouncements}
- screenReaderInstructions={customScreenReaderInstructions}
+ accessibility={{
+ announcements: customAnnouncements,
+ screenReaderInstructions: customScreenReaderInstructions,
+ }}
```
This is a breaking change that will allow easier addition of new accessibility-related features without overloading the props namespace of `<DndContext>`.
#### Accessibility-related DOM nodes are no longer portaled by default
The DOM nodes for the screen reader instructions and announcements are no longer portaled into the `document.body` element by default.
This change is motivated by the fact that screen readers do not always announce ARIA live regions that are rendered on the `document.body`. Common examples of this include when rendering a `<DndContext>` within a `<dialog>` element or an element that has `role="dialog"`, only ARIA live regions rendered within the dialog will be announced.
Consumers can now opt to render announcements in the portal container of their choice using the `container` property of the `accessibility` prop:
```diff
<DndContext
+ accessibility={{
+ container: document.body,
+ }}
```
- [#733](https://github.com/clauderic/dnd-kit/pull/733) [`035021a`](https://github.com/clauderic/dnd-kit/commit/035021aac51161e2bf9715f087a6dd1b46647bfc) Thanks [@clauderic](https://github.com/clauderic)! - The `<DragOverlay>` component's drop animation has been refactored, which fixes a number of bugs with the existing implementation and introduces new functionality.

@@ -172,2 +203,49 @@

- [#748](https://github.com/clauderic/dnd-kit/pull/748) [`59ca82b`](https://github.com/clauderic/dnd-kit/commit/59ca82b9f228f34c7731ece87aef5d9633608b57) Thanks [@clauderic](https://github.com/clauderic)! - #### Introducing activator node refs
Introducing the concept of activator node refs for `useDraggable` and `useSortable`. This allows @dnd-kit to handle common use-cases such as restoring focus on the activator node after dragging via the keyboard or only allowing the activator node to instantiate the keyboard sensor.
Consumers of `useDraggable` and `useSortable` may now optionally set the activator node ref on the element that receives listeners:
```diff
import {useDraggable} from '@dnd-kit/core';
function Draggable(props) {
const {
listeners,
setNodeRef,
+ setActivatorNodeRef,
} = useDraggable({id: props.id});
return (
<div ref={setNodeRef}>
Draggable element
<button
{...listeners}
+ ref={setActivatorNodeRef}
>
:: Drag Handle
</button>
</div>
)
}
```
It's common for the activator element (the element that receives the sensor listeners) to differ from the draggable node. When this happens, @dnd-kit has no reliable way to get a reference to the activator node after dragging ends, as the original `event.target` that instantiated the sensor may no longer be mounted in the DOM or associated with the draggable node that was previously active.
#### Automatically restoring focus
Focus management is now automatically handled by @dnd-kit. When the activator event is a Keyboard event, @dnd-kit will now attempt to automatically restore focus back to the first focusable node of the activator node or draggable node.
If no activator node is specified via the `setActivatorNodeRef` setter function of `useDraggble` and `useSortable`, @dnd-kit will automatically restore focus on the first focusable node of the draggable node set via the `setNodeRef` setter function of `useDraggable` and `useSortable`.
If you were previously managing focus manually and would like to opt-out of automatic focus management, use the newly introduced `restoreFocus` property of the `accessibility` prop of `<DndContext>`:
```diff
<DndContext
accessibility={{
+ restoreFocus: false
}}
```
- [#741](https://github.com/clauderic/dnd-kit/pull/741) [`40707ce`](https://github.com/clauderic/dnd-kit/commit/40707ce6f388957203d6df4ccbeef460450ffd7d) Thanks [@clauderic](https://github.com/clauderic)! - The auto scroller now keeps track of the drag direction to infer scroll intent. By default, auto-scrolling will now be disabled for a given direction if dragging in that direction hasn't occurred yet. This prevents accidental auto-scrolling when picking up a draggable item that is near the scroll boundary threshold.

@@ -249,4 +327,4 @@

- Updated dependencies [[`035021a`](https://github.com/clauderic/dnd-kit/commit/035021aac51161e2bf9715f087a6dd1b46647bfc)]:
- @dnd-kit/utilities@3.2.0-next-202241914636
- Updated dependencies [[`59ca82b`](https://github.com/clauderic/dnd-kit/commit/59ca82b9f228f34c7731ece87aef5d9633608b57), [`035021a`](https://github.com/clauderic/dnd-kit/commit/035021aac51161e2bf9715f087a6dd1b46647bfc)]:
- @dnd-kit/utilities@3.2.0-next-20224191800

@@ -253,0 +331,0 @@ ## 5.0.3

9

dist/components/Accessibility/Accessibility.d.ts

@@ -1,10 +0,11 @@

import React from 'react';
/// <reference types="react" />
import type { UniqueIdentifier } from '../../types';
import type { Announcements, ScreenReaderInstructions } from './types';
import type { UniqueIdentifier } from '../../types';
interface Props {
announcements?: Announcements;
screenReaderInstructions: ScreenReaderInstructions;
container?: Element;
screenReaderInstructions?: ScreenReaderInstructions;
hiddenTextDescribedById: UniqueIdentifier;
}
export declare function Accessibility({ announcements, hiddenTextDescribedById, screenReaderInstructions, }: Props): React.ReactPortal | null;
export declare function Accessibility({ announcements, container, hiddenTextDescribedById, screenReaderInstructions, }: Props): JSX.Element | null;
export {};
import type { Announcements, ScreenReaderInstructions } from './types';
export declare const screenReaderInstructions: ScreenReaderInstructions;
export declare const defaultScreenReaderInstructions: ScreenReaderInstructions;
export declare const defaultAnnouncements: Announcements;
export { Accessibility } from './Accessibility';
export { defaultAnnouncements, screenReaderInstructions } from './defaults';
export { RestoreFocus } from './components';
export { defaultAnnouncements, defaultScreenReaderInstructions, } from './defaults';
export type { Announcements, ScreenReaderInstructions } from './types';

@@ -12,4 +12,9 @@ import React from 'react';

id?: string;
accessibility?: {
announcements?: Announcements;
container?: Element;
restoreFocus?: boolean;
screenReaderInstructions?: ScreenReaderInstructions;
};
autoScroll?: boolean | AutoScrollOptions;
announcements?: Announcements;
cancelDrop?: CancelDrop;

@@ -20,3 +25,2 @@ children?: React.ReactNode;

modifiers?: Modifiers;
screenReaderInstructions?: ScreenReaderInstructions;
sensors?: SensorDescriptor<any>[];

@@ -23,0 +27,0 @@ onDragStart?(event: DragStartEvent): void;

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

export { defaultAnnouncements } from './Accessibility';
export { defaultAnnouncements, defaultScreenReaderInstructions, } from './Accessibility';
export type { Announcements, ScreenReaderInstructions } from './Accessibility';

@@ -3,0 +3,0 @@ export { DndContext } from './DndContext';

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

@@ -33,3 +33,4 @@ /// <reference types="react" />

setNodeRef: (element: HTMLElement | null) => void;
setActivatorNodeRef: (element: HTMLElement | null) => void;
transform: Transform | null;
};

@@ -1,3 +0,3 @@

import type { SensorDescriptor, SensorHandler } from '../../sensors';
import type { SensorActivatorFunction, SensorDescriptor } from '../../sensors';
import type { SyntheticListener, SyntheticListeners } from './useSyntheticListeners';
export declare function useCombineActivators(sensors: SensorDescriptor<any>[], getSyntheticHandler: (handler: SensorHandler, sensor: SensorDescriptor<any>) => SyntheticListener['handler']): SyntheticListeners;
export declare function useCombineActivators(sensors: SensorDescriptor<any>[], getSyntheticHandler: (handler: SensorActivatorFunction<any>, sensor: SensorDescriptor<any>) => SyntheticListener['handler']): SyntheticListeners;

@@ -1,3 +0,3 @@

export { DndContext, DragOverlay, DragOverlayProps, defaultAnnouncements, defaultDropAnimation, defaultDropAnimationSideEffects, } from './components';
export type { Announcements, CancelDrop, DndContextProps, DropAnimation, DropAnimationFunction, DropAnimationFunctionArguments, DropAnimationKeyframeResolver, DropAnimationSideEffects, DraggableMeasuring, MeasuringConfiguration, ScreenReaderInstructions, } from './components';
export { DndContext, DragOverlay, defaultAnnouncements, defaultScreenReaderInstructions, defaultDropAnimation, defaultDropAnimationSideEffects, } from './components';
export type { Announcements, CancelDrop, DndContextProps, DragOverlayProps, DropAnimation, DropAnimationFunction, DropAnimationFunctionArguments, DropAnimationKeyframeResolver, DropAnimationSideEffects, DraggableMeasuring, MeasuringConfiguration, ScreenReaderInstructions, } from './components';
export { AutoScrollActivator, MeasuringFrequency, MeasuringStrategy, TraversalOrder, useDraggable, useDndContext, useDndMonitor, useDroppable, } from './hooks';

@@ -4,0 +4,0 @@ export type { AutoScrollOptions, DndMonitorArguments, DraggableAttributes, DraggableSyntheticListeners, DroppableMeasuring, UseDndContextReturnValue, UseDraggableArguments, UseDroppableArguments, } from './hooks';

@@ -11,2 +11,2 @@ export { useSensor } from './useSensor';

export type { KeyboardCoordinateGetter, KeyboardSensorOptions, KeyboardSensorProps, KeyboardCodes, } from './keyboard';
export type { Activator, Activators, Response as SensorResponse, Sensor, Sensors, SensorDescriptor, SensorContext, SensorHandler, SensorInstance, SensorOptions, SensorProps, } from './types';
export type { Activator, Activators, Response as SensorResponse, Sensor, Sensors, SensorActivatorFunction, SensorDescriptor, SensorContext, SensorHandler, SensorInstance, SensorOptions, SensorProps, } from './types';

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

import type { SensorInstance, SensorProps, SensorOptions } from '../types';
import type { Activators, SensorInstance, SensorProps, SensorOptions } from '../types';
import { KeyboardCoordinateGetter, KeyboardCodes } from './types';

@@ -26,6 +26,3 @@ export interface KeyboardSensorOptions extends SensorOptions {

private detach;
static activators: {
eventName: "onKeyDown";
handler: (event: React.KeyboardEvent, { keyboardCodes, onActivation, }: KeyboardSensorOptions) => boolean;
}[];
static activators: Activators<KeyboardSensorOptions>;
}

@@ -39,5 +39,8 @@ import type { MutableRefObject } from 'react';

};
export declare type SensorActivatorFunction<T> = (event: any, options: T, context: {
active: DraggableNode;
}) => boolean | undefined;
export declare type Activator<T> = {
eventName: SyntheticEventName;
handler(event: React.SyntheticEvent, options: T): boolean | undefined;
handler: SensorActivatorFunction<T>;
};

@@ -44,0 +47,0 @@ export declare type Activators<T> = Activator<T>[];

@@ -44,2 +44,3 @@ import type { MutableRefObject } from 'react';

node: MutableRefObject<HTMLElement | null>;
activatorNode: MutableRefObject<HTMLElement | null>;
data: DataRef;

@@ -46,0 +47,0 @@ };

{
"name": "@dnd-kit/core",
"version": "6.0.0-next-202241914636",
"version": "6.0.0-next-20224191800",
"description": "dnd kit – a lightweight React library for building performant and accessible drag and drop experiences",

@@ -35,3 +35,3 @@ "author": "Claudéric Demers",

"@dnd-kit/accessibility": "^3.0.0",
"@dnd-kit/utilities": "^3.2.0-next-202241914636"
"@dnd-kit/utilities": "^3.2.0-next-20224191800"
},

@@ -38,0 +38,0 @@ "publishConfig": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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