react-mosaic-ui 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +378 -0
  2. package/dist/index.cjs +7 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.ts +180 -0
  5. package/dist/index.js +7 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/styles.css +1 -0
  8. package/dist/tsconfig.tsbuildinfo +1 -0
  9. package/dist/types/entities/mosaic/index.d.ts +4 -0
  10. package/dist/types/entities/mosaic/index.d.ts.map +1 -0
  11. package/dist/types/entities/mosaic/ui/mosaic-root.d.ts +10 -0
  12. package/dist/types/entities/mosaic/ui/mosaic-root.d.ts.map +1 -0
  13. package/dist/types/entities/mosaic/ui/mosaic.d.ts +21 -0
  14. package/dist/types/entities/mosaic/ui/mosaic.d.ts.map +1 -0
  15. package/dist/types/entities/window/index.d.ts +3 -0
  16. package/dist/types/entities/window/index.d.ts.map +1 -0
  17. package/dist/types/entities/window/ui/mosaic-window.d.ts +24 -0
  18. package/dist/types/entities/window/ui/mosaic-window.d.ts.map +1 -0
  19. package/dist/types/features/drag-drop/index.d.ts +4 -0
  20. package/dist/types/features/drag-drop/index.d.ts.map +1 -0
  21. package/dist/types/features/drag-drop/lib/use-drag-source.d.ts +11 -0
  22. package/dist/types/features/drag-drop/lib/use-drag-source.d.ts.map +1 -0
  23. package/dist/types/features/drag-drop/ui/mosaic-drop-target.d.ts +9 -0
  24. package/dist/types/features/drag-drop/ui/mosaic-drop-target.d.ts.map +1 -0
  25. package/dist/types/features/resize/index.d.ts +3 -0
  26. package/dist/types/features/resize/index.d.ts.map +1 -0
  27. package/dist/types/features/resize/resize-isolation.test.d.ts +2 -0
  28. package/dist/types/features/resize/resize-isolation.test.d.ts.map +1 -0
  29. package/dist/types/features/resize/ui/split.d.ts +16 -0
  30. package/dist/types/features/resize/ui/split.d.ts.map +1 -0
  31. package/dist/types/index.d.ts +14 -0
  32. package/dist/types/index.d.ts.map +1 -0
  33. package/dist/types/shared/lib/bounding-box.d.ts +7 -0
  34. package/dist/types/shared/lib/bounding-box.d.ts.map +1 -0
  35. package/dist/types/shared/lib/context.d.ts +4 -0
  36. package/dist/types/shared/lib/context.d.ts.map +1 -0
  37. package/dist/types/shared/lib/index.d.ts +4 -0
  38. package/dist/types/shared/lib/index.d.ts.map +1 -0
  39. package/dist/types/shared/lib/mosaic-updates.d.ts +10 -0
  40. package/dist/types/shared/lib/mosaic-updates.d.ts.map +1 -0
  41. package/dist/types/shared/lib/mosaic-updates.test.d.ts +2 -0
  42. package/dist/types/shared/lib/mosaic-updates.test.d.ts.map +1 -0
  43. package/dist/types/shared/lib/mosaic-utilities.d.ts +13 -0
  44. package/dist/types/shared/lib/mosaic-utilities.d.ts.map +1 -0
  45. package/dist/types/shared/types/context.types.d.ts +23 -0
  46. package/dist/types/shared/types/context.types.d.ts.map +1 -0
  47. package/dist/types/shared/types/index.d.ts +4 -0
  48. package/dist/types/shared/types/index.d.ts.map +1 -0
  49. package/dist/types/shared/types/mosaic.types.d.ts +59 -0
  50. package/dist/types/shared/types/mosaic.types.d.ts.map +1 -0
  51. package/package.json +91 -0
@@ -0,0 +1,180 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { MosaicKey as MosaicKey$1, TileRenderer as TileRenderer$1, MosaicNode as MosaicNode$1, ResizeOptions as ResizeOptions$1, CreateNode as CreateNode$1, MosaicPath as MosaicPath$1, MosaicDirection as MosaicDirection$1, MosaicDropTargetPosition as MosaicDropTargetPosition$1 } from '@/shared/types';
3
+ import * as react from 'react';
4
+ import { ReactNode } from 'react';
5
+
6
+ interface MosaicBaseProps<T extends MosaicKey$1> {
7
+ renderTile: TileRenderer$1<T>;
8
+ onChange?: (node: MosaicNode$1<T> | null) => void;
9
+ onRelease?: (node: MosaicNode$1<T> | null) => void;
10
+ className?: string;
11
+ resize?: ResizeOptions$1;
12
+ zeroStateView?: JSX.Element;
13
+ mosaicId?: string;
14
+ createNode?: CreateNode$1<T>;
15
+ }
16
+ interface MosaicControlledProps<T extends MosaicKey$1> extends MosaicBaseProps<T> {
17
+ value: MosaicNode$1<T> | null;
18
+ onChange: (node: MosaicNode$1<T> | null) => void;
19
+ }
20
+ interface MosaicUncontrolledProps<T extends MosaicKey$1> extends MosaicBaseProps<T> {
21
+ initialValue: MosaicNode$1<T> | null;
22
+ }
23
+ type MosaicProps<T extends MosaicKey$1> = MosaicControlledProps<T> | MosaicUncontrolledProps<T>;
24
+ declare const Mosaic: <T extends MosaicKey$1>(props: MosaicProps<T>) => react_jsx_runtime.JSX.Element;
25
+
26
+ interface MosaicWindowProps<T extends MosaicKey$1> {
27
+ title: string;
28
+ path: MosaicPath$1;
29
+ children: ReactNode;
30
+ createNode?: CreateNode$1<T>;
31
+ draggable?: boolean;
32
+ toolbarControls?: ReactNode;
33
+ additionalControls?: ReactNode;
34
+ renderToolbar?: (props: MosaicWindowToolbarProps<T>, defaultToolbar: ReactNode) => ReactNode;
35
+ onDragStart?: () => void;
36
+ onDragEnd?: (type: 'drop' | 'reset') => void;
37
+ className?: string;
38
+ }
39
+ interface MosaicWindowToolbarProps<T extends MosaicKey$1> {
40
+ title: string;
41
+ path: MosaicPath$1;
42
+ createNode?: CreateNode$1<T>;
43
+ toolbarControls?: ReactNode;
44
+ additionalControls?: ReactNode;
45
+ }
46
+ declare const MosaicWindow: <T extends MosaicKey$1>({ title, path, children, createNode, draggable, toolbarControls, additionalControls, renderToolbar, onDragStart, onDragEnd, className, }: MosaicWindowProps<T>) => react_jsx_runtime.JSX.Element;
47
+
48
+ interface SplitProps {
49
+ direction: MosaicDirection$1;
50
+ percentage: number;
51
+ onChange: (percentage: number) => void;
52
+ onRelease?: (percentage: number) => void;
53
+ boundingBox: {
54
+ top: number;
55
+ right: number;
56
+ bottom: number;
57
+ left: number;
58
+ };
59
+ minimumPaneSizePercentage?: number;
60
+ }
61
+ declare const Split: ({ direction, percentage, onChange, onRelease, boundingBox, minimumPaneSizePercentage, }: SplitProps) => react_jsx_runtime.JSX.Element;
62
+
63
+ interface MosaicDropTargetProps {
64
+ position: MosaicDropTargetPosition$1;
65
+ path: MosaicPath$1;
66
+ mosaicId: string;
67
+ }
68
+ declare const MosaicDropTarget: ({ position, path, mosaicId }: MosaicDropTargetProps) => react_jsx_runtime.JSX.Element;
69
+
70
+ type MosaicKey = string | number;
71
+ type MosaicDirection = 'row' | 'column';
72
+ type MosaicBranch = 'first' | 'second';
73
+ type MosaicPath = MosaicBranch[];
74
+ type MosaicNode<T extends MosaicKey = string> = MosaicParent<T> | T;
75
+ interface MosaicParent<T extends MosaicKey = string> {
76
+ direction: MosaicDirection;
77
+ first: MosaicNode<T>;
78
+ second: MosaicNode<T>;
79
+ splitPercentage?: number;
80
+ }
81
+ declare enum MosaicDropTargetPosition {
82
+ TOP = "TOP",
83
+ BOTTOM = "BOTTOM",
84
+ LEFT = "LEFT",
85
+ RIGHT = "RIGHT"
86
+ }
87
+ declare enum Corner {
88
+ TOP_LEFT = 1,
89
+ TOP_RIGHT = 2,
90
+ BOTTOM_LEFT = 3,
91
+ BOTTOM_RIGHT = 4
92
+ }
93
+ interface ResizeOptions {
94
+ minimumPaneSizePercentage?: number;
95
+ }
96
+ interface BoundingBox {
97
+ top: number;
98
+ right: number;
99
+ bottom: number;
100
+ left: number;
101
+ }
102
+ interface MosaicUpdate<T extends MosaicKey = string> {
103
+ path: MosaicPath;
104
+ spec: MosaicUpdateSpec<T>;
105
+ }
106
+ type MosaicUpdateSpec<T extends MosaicKey = string> = {
107
+ $set: MosaicNode<T>;
108
+ } | {
109
+ splitPercentage?: {
110
+ $set: number;
111
+ };
112
+ direction?: {
113
+ $set: MosaicDirection;
114
+ };
115
+ first?: MosaicUpdateSpec<T>;
116
+ second?: MosaicUpdateSpec<T>;
117
+ };
118
+ interface MosaicDragItem {
119
+ mosaicId: string;
120
+ path: MosaicPath;
121
+ }
122
+ interface MosaicDropData {
123
+ path: MosaicPath;
124
+ position: MosaicDropTargetPosition;
125
+ }
126
+ type TileRenderer<T extends MosaicKey = string> = (id: T, path: MosaicPath) => JSX.Element;
127
+ type CreateNode<T extends MosaicKey = string> = () => T | Promise<T>;
128
+
129
+ interface MosaicRootActions<T extends MosaicKey = string> {
130
+ expand: (path: MosaicPath, percentage?: number) => void;
131
+ remove: (path: MosaicPath) => void;
132
+ hide: (path: MosaicPath) => void;
133
+ replaceWith: (path: MosaicPath, node: MosaicNode<T>) => void;
134
+ updateTree: (updates: MosaicUpdate<T>[], suppressOnRelease?: boolean) => void;
135
+ getRoot: () => MosaicNode<T> | null;
136
+ }
137
+ interface MosaicContextValue<T extends MosaicKey = string> {
138
+ mosaicActions: MosaicRootActions<T>;
139
+ mosaicId: string;
140
+ }
141
+ interface MosaicWindowActions {
142
+ split: () => Promise<void>;
143
+ replaceWithNew: () => Promise<void>;
144
+ getPath: () => MosaicPath;
145
+ connectDragSource: (element: React.ReactElement) => React.ReactElement | null;
146
+ }
147
+ interface MosaicWindowContextValue {
148
+ mosaicWindowActions: MosaicWindowActions;
149
+ }
150
+
151
+ declare const isParent: <T extends MosaicKey>(node: MosaicNode<T> | null) => node is MosaicParent<T>;
152
+ declare const getLeaves: <T extends MosaicKey>(node: MosaicNode<T> | null) => T[];
153
+ declare const getNodeAtPath: <T extends MosaicKey>(node: MosaicNode<T>, path: MosaicPath) => MosaicNode<T> | null;
154
+ declare const getAndAssertNodeAtPathExists: <T extends MosaicKey>(node: MosaicNode<T>, path: MosaicPath) => MosaicNode<T>;
155
+ declare const createBalancedTreeFromLeaves: <T extends MosaicKey>(leaves: T[], startDirection?: MosaicDirection) => MosaicNode<T> | null;
156
+ declare const getPathToCorner: <T extends MosaicKey>(node: MosaicNode<T>, corner: Corner) => MosaicPath;
157
+ declare const getOtherDirection: (direction: MosaicDirection) => MosaicDirection;
158
+ declare const getOtherBranch: (branch: MosaicBranch) => MosaicBranch;
159
+ declare const countNodes: <T extends MosaicKey>(node: MosaicNode<T> | null) => number;
160
+ declare const getTreeDepth: <T extends MosaicKey>(node: MosaicNode<T> | null) => number;
161
+
162
+ declare const updateTree: <T extends MosaicKey>(root: MosaicNode<T> | null, updates: MosaicUpdate<T>[]) => MosaicNode<T> | null;
163
+ declare const createRemoveUpdate: <T extends MosaicKey>(root: MosaicNode<T> | null, path: MosaicPath) => MosaicUpdate<T>;
164
+ declare const createExpandUpdate: <T extends MosaicKey>(path: MosaicPath, percentage?: number) => MosaicUpdate<T>;
165
+ declare const createHideUpdate: <T extends MosaicKey>(path: MosaicPath) => MosaicUpdate<T>;
166
+ declare const createDragToUpdates: <T extends MosaicKey>(root: MosaicNode<T>, sourcePath: MosaicPath, destinationPath: MosaicPath, position: MosaicDropTargetPosition) => MosaicUpdate<T>[];
167
+ declare const createReplaceUpdate: <T extends MosaicKey>(path: MosaicPath, node: MosaicNode<T>) => MosaicUpdate<T>;
168
+ declare const createSplitUpdate: <T extends MosaicKey>(path: MosaicPath, newNode: T, direction?: "row" | "column") => MosaicUpdate<T>;
169
+
170
+ declare const createBoundingBox: (top: number, right: number, bottom: number, left: number) => BoundingBox;
171
+ declare const getWidth: (box: BoundingBox) => number;
172
+ declare const getHeight: (box: BoundingBox) => number;
173
+ declare const split: (box: BoundingBox, percentage: number, direction: "row" | "column") => [BoundingBox, BoundingBox];
174
+ declare const containsPoint: (box: BoundingBox, x: number, y: number) => boolean;
175
+
176
+ declare const MosaicContext: react.Context<MosaicContextValue<any>>;
177
+ declare const MosaicWindowContext: react.Context<MosaicWindowContextValue>;
178
+
179
+ export { Corner, Mosaic, MosaicContext, MosaicDropTarget, MosaicDropTargetPosition, MosaicWindow, MosaicWindowContext, Split, containsPoint, countNodes, createBalancedTreeFromLeaves, createBoundingBox, createDragToUpdates, createExpandUpdate, createHideUpdate, createRemoveUpdate, createReplaceUpdate, createSplitUpdate, getAndAssertNodeAtPathExists, getHeight, getLeaves, getNodeAtPath, getOtherBranch, getOtherDirection, getPathToCorner, getTreeDepth, getWidth, isParent, split, updateTree };
180
+ export type { BoundingBox, CreateNode, MosaicBranch, MosaicContextValue, MosaicControlledProps, MosaicDirection, MosaicDragItem, MosaicDropData, MosaicDropTargetProps, MosaicKey, MosaicNode, MosaicParent, MosaicPath, MosaicProps, MosaicRootActions, MosaicUncontrolledProps, MosaicUpdate, MosaicUpdateSpec, MosaicWindowActions, MosaicWindowContextValue, MosaicWindowProps, ResizeOptions, SplitProps, TileRenderer };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{createContext as n,memo as o,useEffect as i,useLayoutEffect as s,useState as a,useCallback as c,useMemo as u,isValidElement as d,cloneElement as l,useContext as h,useRef as g}from"react";var f,p;!function(e){e.TOP="TOP",e.BOTTOM="BOTTOM",e.LEFT="LEFT",e.RIGHT="RIGHT"}(f||(f={})),function(e){e[e.TOP_LEFT=1]="TOP_LEFT",e[e.TOP_RIGHT=2]="TOP_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT",e[e.BOTTOM_RIGHT=4]="BOTTOM_RIGHT"}(p||(p={}));const m=e=>null!==e&&"object"==typeof e&&"direction"in e&&"first"in e&&"second"in e,v=e=>null===e?[]:m(e)?[...v(e.first),...v(e.second)]:[e],y=(e,t)=>{if(0===t.length)return e;if(!m(e))return null;const[r,...n]=t;return r?y(e[r],n):null},b=(e,t)=>{const r=y(e,t);if(null===r)throw new Error(`Node at path ${t.join("/")} not found`);return r},O=(e,t="row")=>{if(0===e.length)return null;if(1===e.length)return e[0];const r=Math.floor(e.length/2),n=O(e.slice(0,r),T(t)),o=O(e.slice(r),T(t));return null===n||null===o?n??o:{direction:t,first:n,second:o,splitPercentage:50}},S=(e,t)=>{const r=[];let n=e;for(;m(n);){const e=t===p.TOP_LEFT||t===p.TOP_RIGHT,o=t===p.TOP_LEFT||t===p.BOTTOM_LEFT,i="column"===n.direction&&e||"row"===n.direction&&o?"first":"second";r.push(i),n=n[i]}return r},T=e=>"row"===e?"column":"row",D=e=>"first"===e?"second":"first",w=e=>null===e?0:m(e)?1+w(e.first)+w(e.second):1,E=e=>null===e?0:m(e)?1+Math.max(E(e.first),E(e.second)):1;var I=Symbol.for("immer-nothing"),_=Symbol.for("immer-draftable"),C=Symbol.for("immer-state"),N="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function P(e,...t){if("production"!==process.env.NODE_ENV){const r=N[e],n="function"==typeof r?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var x=Object.getPrototypeOf;function M(e){return!!e&&!!e[C]}function R(e){return!!e&&(k(e)||Array.isArray(e)||!!e[_]||!!e.constructor?.[_]||U(e)||$(e))}var j=Object.prototype.constructor.toString(),L=new WeakMap;function k(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);if(null===t||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if("function"!=typeof r)return!1;let n=L.get(r);return void 0===n&&(n=Function.toString.call(r),L.set(r,n)),n===j}function A(e,t,r=!0){if(0===H(e)){(r?Reflect.ownKeys(e):Object.keys(e)).forEach(r=>{t(r,e[r],e)})}else e.forEach((r,n)=>t(n,r,e))}function H(e){const t=e[C];return t?t.type_:Array.isArray(e)?1:U(e)?2:$(e)?3:0}function F(e,t){return 2===H(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function z(e,t,r){const n=H(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function U(e){return e instanceof Map}function $(e){return e instanceof Set}function B(e){return e.copy_||e.base_}function V(e,t){if(U(e))return new Map(e);if($(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=k(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[C];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const o=r[n],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(x(e),t)}{const t=x(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function W(e,t=!1){return Y(e)||M(e)||!R(e)||(H(e)>1&&Object.defineProperties(e,{set:G,add:G,clear:G,delete:G}),Object.freeze(e),t&&Object.values(e).forEach(e=>W(e,!0))),e}var G={value:function(){P(2)}};function Y(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var X,K={};function q(e){const t=K[e];return t||P(0,e),t}function J(){return X}function Q(e,t){t&&(q("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Z(e){ee(e),e.drafts_.forEach(re),e.drafts_=null}function ee(e){e===X&&(X=e.parent_)}function te(e){return X={drafts_:[],parent_:X,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function re(e){const t=e[C];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ne(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[C].modified_&&(Z(t),P(4)),R(e)&&(e=oe(t,e),t.parent_||se(t,e)),t.patches_&&q("Patches").generateReplacementPatches_(r[C].base_,e,t.patches_,t.inversePatches_)):e=oe(t,r,[]),Z(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==I?e:void 0}function oe(e,t,r){if(Y(t))return t;const n=e.immer_.shouldUseStrictIteration(),o=t[C];if(!o)return A(t,(n,i)=>ie(e,o,t,n,i,r),n),t;if(o.scope_!==e)return t;if(!o.modified_)return se(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let i=t,s=!1;3===o.type_&&(i=new Set(t),t.clear(),s=!0),A(i,(n,i)=>ie(e,o,t,n,i,r,s),n),se(e,t,!1),r&&e.patches_&&q("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function ie(e,t,r,n,o,i,s){if(null==o)return;if("object"!=typeof o&&!s)return;const a=Y(o);if(!a||s){if("production"!==process.env.NODE_ENV&&o===r&&P(5),M(o)){const s=oe(e,o,i&&t&&3!==t.type_&&!F(t.assigned_,n)?i.concat(n):void 0);if(z(r,n,s),!M(s))return;e.canAutoFreeze_=!1}else s&&r.add(o);if(R(o)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;if(t&&t.base_&&t.base_[n]===o&&a)return;oe(e,o),t&&t.scope_.parent_||"symbol"==typeof n||!(U(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))||se(e,o)}}}function se(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&W(t,r)}var ae={get(e,t){if(t===C)return e;const r=B(e);if(!F(r,t))return function(e,t,r){const n=de(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!R(n)?n:n===ue(e.base_,t)?(he(e),e.copy_[t]=ge(n,e)):n},has:(e,t)=>t in B(e),ownKeys:e=>Reflect.ownKeys(B(e)),set(e,t,r){const n=de(B(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=ue(B(e),t),s=n?.[C];if(s&&s.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(((o=r)===(i=n)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==r||F(e.base_,t)))return!0;he(e),le(e)}var o,i;return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==ue(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,he(e),le(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=B(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){P(11)},getPrototypeOf:e=>x(e.base_),setPrototypeOf(){P(12)}},ce={};function ue(e,t){const r=e[C];return(r?B(r):e)[t]}function de(e,t){if(!(t in e))return;let r=x(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=x(r)}}function le(e){e.modified_||(e.modified_=!0,e.parent_&&le(e.parent_))}function he(e){e.copy_||(e.copy_=V(e.base_,e.scope_.immer_.useStrictShallowCopy_))}A(ae,(e,t)=>{ce[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),ce.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&P(13),ce.set.call(this,e,t,void 0)},ce.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&P(14),ae.set.call(this,e[0],t,r,e[0])};function ge(e,t){const r=U(e)?q("MapSet").proxyMap_(e,t):$(e)?q("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:J(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=ae;r&&(o=[n],i=ce);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,a}(e,t);return(t?t.scope_:J()).drafts_.push(r),r}function fe(e){if(!R(e)||Y(e))return e;const t=e[C];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=V(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=V(e,!0);return A(r,(e,t)=>{z(r,e,fe(t))},n),t&&(t.finalized_=!1),r}var pe=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,r)=>{if("function"==typeof e&&"function"!=typeof t){const r=t;t=e;const n=this;return function(e=r,...o){return n.produce(e,e=>t.call(this,e,...o))}}let n;if("function"!=typeof t&&P(6),void 0!==r&&"function"!=typeof r&&P(7),R(e)){const o=te(this),i=ge(e,void 0);let s=!0;try{n=t(i),s=!1}finally{s?Z(o):ee(o)}return Q(o,r),ne(n,o)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===I&&(n=void 0),this.autoFreeze_&&W(n,!0),r){const t=[],o=[];q("Patches").generateReplacementPatches_(e,n,t,o),r(t,o)}return n}P(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,t=>e(t,...r));let r,n;return[this.produce(e,t,(e,t)=>{r=e,n=t}),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),"boolean"==typeof e?.useStrictIteration&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){R(e)||P(8),M(e)&&(e=function(e){M(e)||P(10,e);return fe(e)}(e));const t=te(this),r=ge(e,void 0);return r[C].isManual_=!0,ee(t),r}finishDraft(e,t){const r=e&&e[C];r&&r.isManual_||P(9);const{scope_:n}=r;return Q(n,t),ne(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=q("Patches").applyPatches_;return M(e)?n(e,t):this.produce(e,e=>n(e,t))}},me=pe.produce;const ve=(e,t)=>{if(null===e)return null;let r=e;for(const e of t)r=0===e.path.length&&"$set"in e.spec?e.spec.$set:me(r,t=>{ye(t,e.path,e.spec)});return r},ye=(e,t,r)=>{if(0===t.length){if("$set"in r)return;return void(m(e)&&(r.splitPercentage&&(e.splitPercentage=r.splitPercentage.$set),r.direction&&(e.direction=r.direction.$set),r.first&&ye(e.first,[],r.first),r.second&&ye(e.second,[],r.second)))}if(!m(e))return;const[n,...o]=t;n&&(0===o.length&&"$set"in r?e[n]=r.$set:ye(e[n],o,r))},be=(e,t)=>{if(null===e||0===t.length)throw new Error("Cannot remove root node");const r=t.slice(0,-1),n=t[t.length-1],o=D(n),i=b(e,r);if(!m(i))throw new Error("Parent is not a parent node");return{path:r,spec:{$set:i[o]}}},Oe=(e,t=70)=>{if(0===e.length)throw new Error("Cannot expand root node");return{path:e.slice(0,-1),spec:{splitPercentage:{$set:"first"===e[e.length-1]?t:100-t}}}},Se=e=>({path:e,spec:{$set:null}}),Te=(e,t,r,n)=>{const o=y(e,t);if(null===o)return[];const i=y(e,r);if(null===i)return[];if(JSON.stringify(t)===JSON.stringify(r))return[];const s=n===f.LEFT||n===f.RIGHT?"row":"column",a={direction:s,first:n===f.LEFT||n===f.TOP?o:i,second:n===f.LEFT||n===f.TOP?i:o,splitPercentage:50};if(t.length>r.length&&r.every((e,r)=>t[r]===e)){const e=t.slice(r.length),a=ve(i,[be(i,e)]);if(null===a)return[];const c={direction:s,first:n===f.LEFT||n===f.TOP?o:a,second:n===f.LEFT||n===f.TOP?a:o,splitPercentage:50};return[{path:r,spec:{$set:c}}]}const c=[];t.length>0&&c.push(be(e,t));let u=r;const d=t.slice(0,-1),l=r.slice(0,-1);if(d.length===l.length&&d.every((e,t)=>l[t]===e))u=d;else{if(d.length>0&&d.length<r.length&&d.every((e,t)=>r[t]===e)){t[d.length]===r[d.length]&&(u=[...d,...r.slice(d.length+1)])}}return c.push({path:u,spec:{$set:a}}),c},De=(e,t)=>({path:e,spec:{$set:t}}),we=(e,t,r="row")=>({path:e,spec:{$set:{direction:r,first:t,second:t,splitPercentage:50}}}),Ee=(e,t,r,n)=>({top:e,right:t,bottom:r,left:n}),Ie=e=>e.right-e.left,_e=e=>e.bottom-e.top,Ce=(e,t,r)=>{const n=Math.max(0,Math.min(100,t));if("row"===r){const t=e.left+Ie(e)*n/100;return[Ee(e.top,t,e.bottom,e.left),Ee(e.top,e.right,e.bottom,t)]}const o=e.top+_e(e)*n/100;return[Ee(e.top,e.right,o,e.left),Ee(o,e.right,e.bottom,e.left)]},Ne=(e,t,r)=>t>=e.left&&t<=e.right&&r>=e.top&&r<=e.bottom,Pe=n({mosaicActions:{expand:()=>{},remove:()=>{},hide:()=>{},replaceWith:()=>{},updateTree:()=>{},getRoot:()=>null},mosaicId:"default"}),xe=n({mosaicWindowActions:{split:async()=>{},replaceWithNew:async()=>{},getPath:()=>[],connectDragSource:e=>e}});function Me(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re,je={exports:{}};
2
+ /*!
3
+ Copyright (c) 2018 Jed Watson.
4
+ Licensed under the MIT License (MIT), see
5
+ http://jedwatson.github.io/classnames
6
+ */var Le,ke=(Re||(Re=1,Le=je,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var o=arguments[t];o&&(e=n(e,r(o)))}return e}function r(r){if("string"==typeof r||"number"==typeof r)return r;if("object"!=typeof r)return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var i in r)e.call(r,i)&&r[i]&&(o=n(o,i));return o}function n(e,t){return t?e?e+" "+t:e+t:e}Le.exports?(t.default=t,Le.exports=t):window.classNames=t}()),je.exports),Ae=Me(ke);const He=n({dragDropManager:void 0});function Fe(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var ze="function"==typeof Symbol&&Symbol.observable||"@@observable",Ue=function(){return Math.random().toString(36).substring(7).split("").join(".")},$e={INIT:"@@redux/INIT"+Ue(),REPLACE:"@@redux/REPLACE"+Ue()};function Be(e){if(void 0===e)return"undefined";if(null===e)return"null";var t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(function(e){return e instanceof Date||"function"==typeof e.toDateString&&"function"==typeof e.getDate&&"function"==typeof e.setDate}(e))return"date";if(function(e){return e instanceof Error||"string"==typeof e.message&&e.constructor&&"number"==typeof e.constructor.stackTraceLimit}(e))return"error";var r=function(e){return"function"==typeof e.constructor?e.constructor.name:null}(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")}function Ve(e){var t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Be(e)),t}function We(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error("production"===process.env.NODE_ENV?Fe(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error("production"===process.env.NODE_ENV?Fe(1):"Expected the enhancer to be a function. Instead, received: '"+Ve(r)+"'");return r(We)(e,t)}if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Fe(2):"Expected the root reducer to be a function. Instead, received: '"+Ve(e)+"'");var o=e,i=t,s=[],a=s,c=!1;function u(){a===s&&(a=s.slice())}function d(){if(c)throw new Error("production"===process.env.NODE_ENV?Fe(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function l(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Fe(4):"Expected the listener to be a function. Instead, received: '"+Ve(e)+"'");if(c)throw new Error("production"===process.env.NODE_ENV?Fe(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var t=!0;return u(),a.push(e),function(){if(t){if(c)throw new Error("production"===process.env.NODE_ENV?Fe(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");t=!1,u();var r=a.indexOf(e);a.splice(r,1),s=null}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error("production"===process.env.NODE_ENV?Fe(7):"Actions must be plain objects. Instead, the actual type was: '"+Ve(e)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(void 0===e.type)throw new Error("production"===process.env.NODE_ENV?Fe(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(c)throw new Error("production"===process.env.NODE_ENV?Fe(9):"Reducers may not dispatch actions.");try{c=!0,i=o(i,e)}finally{c=!1}for(var t=s=a,r=0;r<t.length;r++){(0,t[r])()}return e}return h({type:$e.INIT}),(n={dispatch:h,subscribe:l,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?Fe(10):"Expected the nextReducer to be a function. Instead, received: '"+Ve(e));o=e,h({type:$e.REPLACE})}})[ze]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error("production"===process.env.NODE_ENV?Fe(11):"Expected the observer to be an object. Instead, received: '"+Ve(e)+"'");function r(){e.next&&e.next(d())}return r(),{unsubscribe:t(r)}}})[ze]=function(){return this},e},n}function Ge(e,t,...r){if("undefined"!=typeof process&&"production"===process.env.NODE_ENV&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let n=0;e=new Error(t.replace(/%s/g,function(){return r[n++]})),e.name="Invariant Violation"}throw e.framesToPop=1,e}}function Ye(e){return"object"==typeof e}const Xe="dnd-core/INIT_COORDS",Ke="dnd-core/BEGIN_DRAG",qe="dnd-core/PUBLISH_DRAG_SOURCE",Je="dnd-core/HOVER",Qe="dnd-core/DROP",Ze="dnd-core/END_DRAG";function et(e,t){return{type:Xe,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const tt={type:Xe,payload:{clientOffset:null,sourceClientOffset:null}};function rt(e){return function(t=[],r={publishSource:!0}){const{publishSource:n=!0,clientOffset:o,getSourceClientOffset:i}=r,s=e.getMonitor(),a=e.getRegistry();e.dispatch(et(o)),function(e,t,r){Ge(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){Ge(r.getSource(e),"Expected sourceIds to be registered.")})}(t,s,a);const c=function(e,t){let r=null;for(let n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}(t,s);if(null==c)return void e.dispatch(tt);let u=null;if(o){if(!i)throw new Error("getSourceClientOffset must be defined");!function(e){Ge("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(i),u=i(c)}e.dispatch(et(o,u));const d=a.getSource(c).beginDrag(s,c);if(null==d)return;!function(e){Ge(Ye(e),"Item must be an object.")}(d),a.pinSource(c);const l=a.getSourceType(c);return{type:Ke,payload:{itemType:l,item:d,sourceId:c,clientOffset:o||null,sourceClientOffset:u||null,isSourcePublic:!!n}}}}function nt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ot(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){nt(e,t,r[t])})}return e}function it(e){return function(t={}){const r=e.getMonitor(),n=e.getRegistry();!function(e){Ge(e.isDragging(),"Cannot call drop while not dragging."),Ge(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(r);const o=function(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(r);o.forEach((o,i)=>{const s=function(e,t,r,n){const o=r.getTarget(e);let i=o?o.drop(n,e):void 0;(function(e){Ge(void 0===e||Ye(e),"Drop result must either be an object or undefined.")})(i),void 0===i&&(i=0===t?{}:n.getDropResult());return i}(o,i,n,r),a={type:Qe,payload:{dropResult:ot({},t,s)}};e.dispatch(a)})}}function st(e){return function(){const t=e.getMonitor(),r=e.getRegistry();!function(e){Ge(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const n=t.getSourceId();if(null!=n){r.getSource(n,!0).endDrag(t,n),r.unpinSource()}return{type:Ze}}}function at(e,t){return null===t?null===e:Array.isArray(e)?e.some(e=>e===t):e===t}function ct(e){return function(t,{clientOffset:r}={}){!function(e){Ge(Array.isArray(e),"Expected targetIds to be an array.")}(t);const n=t.slice(0),o=e.getMonitor(),i=e.getRegistry();return function(e,t,r){for(let n=e.length-1;n>=0;n--){const o=e[n];at(t.getTargetType(o),r)||e.splice(n,1)}}(n,i,o.getItemType()),function(e,t,r){Ge(t.isDragging(),"Cannot call hover while not dragging."),Ge(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const n=e[t];Ge(e.lastIndexOf(n)===t,"Expected targetIds to be unique in the passed array.");Ge(r.getTarget(n),"Expected targetIds to be registered.")}}(n,o,i),function(e,t,r){e.forEach(function(e){r.getTarget(e).hover(t,e)})}(n,o,i),{type:Je,payload:{targetIds:n,clientOffset:r||null}}}}function ut(e){return function(){if(e.getMonitor().isDragging())return{type:qe}}}class dt{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:t}=this.store;const r=function(e){return{beginDrag:rt(e),publishDragSource:ut(e),hover:ct(e),drop:it(e),endDrag:st(e)}}(this);return Object.keys(r).reduce((n,o)=>{const i=r[o];var s;return n[o]=(s=i,(...r)=>{const n=s.apply(e,r);void 0!==n&&t(n)}),n},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function lt(e,t){return{x:e.x-t.x,y:e.y-t.y}}const ht=[],gt=[];ht.__IS_NONE__=!0,gt.__IS_ALL__=!0;class ft{subscribeToStateChange(e,t={}){const{handlerIds:r}=t;Ge("function"==typeof e,"listener must be a function."),Ge(void 0===r||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let n=this.store.getState().stateId;return this.store.subscribe(()=>{const t=this.store.getState(),o=t.stateId;try{const i=o===n||o===n+1&&!function(e,t){return e!==ht&&(e===gt||void 0===t||(r=e,t.filter(e=>r.indexOf(e)>-1)).length>0);var r}(t.dirtyHandlerIds,r);i||e()}finally{n=o}})}subscribeToOffsetChange(e){Ge("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe(()=>{const r=this.store.getState().dragOffset;r!==t&&(t=r,e())})}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return Ge(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);if(Ge(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;return at(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);if(Ge(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;return this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;const{shallow:r}=t;if(!this.isDragging())return!1;const n=this.registry.getTargetType(e),o=this.getItemType();if(o&&!at(n,o))return!1;const i=this.getTargetIds();if(!i.length)return!1;const s=i.indexOf(e);return r?s===i.length-1:s>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:n}=e;return t&&r&&n?lt((i=n,{x:(o=t).x+i.x,y:o.y+i.y}),r):null;var o,i}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:r}=e;return t&&r?lt(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const pt="undefined"!=typeof global?global:self,mt=pt.MutationObserver||pt.WebKitMutationObserver;function vt(e){return function(){const t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}const yt="function"==typeof mt?function(e){let t=1;const r=new mt(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}:vt;class bt{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const Ot=new class{enqueueTask(e){const{queue:t,requestFlush:r}=this;t.length||(r(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,r=e.length-this.index;t<r;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=yt(this.flush),this.requestErrorThrow=vt(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},St=new class{create(e){const t=this.freeTasks,r=t.length?t.pop():new bt(this.onError,e=>t[t.length]=e);return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(Ot.registerPendingError);const Tt="dnd-core/ADD_SOURCE",Dt="dnd-core/ADD_TARGET",wt="dnd-core/REMOVE_SOURCE",Et="dnd-core/REMOVE_TARGET";function It(e,t){t&&Array.isArray(e)?e.forEach(e=>It(e,!1)):Ge("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var _t;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(_t||(_t={}));let Ct=0;function Nt(e){const t=(Ct++).toString();switch(e){case _t.SOURCE:return`S${t}`;case _t.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function Pt(e){switch(e[0]){case"S":return _t.SOURCE;case"T":return _t.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function xt(e,t){const r=e.entries();let n=!1;do{const{done:e,value:[,o]}=r.next();if(o===t)return!0;n=!!e}while(!n);return!1}class Mt{addSource(e,t){It(e),function(e){Ge("function"==typeof e.canDrag,"Expected canDrag to be a function."),Ge("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),Ge("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const r=this.addHandler(_t.SOURCE,e,t);return this.store.dispatch(function(e){return{type:Tt,payload:{sourceId:e}}}(r)),r}addTarget(e,t){It(e,!0),function(e){Ge("function"==typeof e.canDrop,"Expected canDrop to be a function."),Ge("function"==typeof e.hover,"Expected hover to be a function."),Ge("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const r=this.addHandler(_t.TARGET,e,t);return this.store.dispatch(function(e){return{type:Dt,payload:{targetId:e}}}(r)),r}containsHandler(e){return xt(this.dragSources,e)||xt(this.dropTargets,e)}getSource(e,t=!1){Ge(this.isSourceId(e),"Expected a valid source ID.");return t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return Ge(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return Ge(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return Ge(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return Pt(e)===_t.SOURCE}isTargetId(e){return Pt(e)===_t.TARGET}removeSource(e){var t;Ge(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:wt,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},Ot.enqueueTask(St.create(t))}removeTarget(e){Ge(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:Et,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);Ge(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){Ge(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){const n=Nt(e);return this.types.set(n,t),e===_t.SOURCE?this.dragSources.set(n,r):e===_t.TARGET&&this.dropTargets.set(n,r),n}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const Rt=(e,t)=>e===t;function jt(e=ht,t){switch(t.type){case Je:break;case Tt:case Dt:case Et:case wt:return ht;default:return gt}const{targetIds:r=[],prevTargetIds:n=[]}=t.payload,o=function(e,t){const r=new Map,n=e=>{r.set(e,r.has(e)?r.get(e)+1:1)};e.forEach(n),t.forEach(n);const o=[];return r.forEach((e,t)=>{1===e&&o.push(t)}),o}(r,n);if(!(o.length>0||!function(e,t,r=Rt){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}(r,n)))return ht;const i=n[n.length-1],s=r[r.length-1];return i!==s&&(i&&o.push(i),s&&o.push(s)),o}function Lt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const kt={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function At(e=kt,t){const{payload:r}=t;switch(t.type){case Xe:case Ke:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case Je:return n=e.clientOffset,o=r.clientOffset,!n&&!o||n&&o&&n.x===o.x&&n.y===o.y?e:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){Lt(e,t,r[t])})}return e}({},e,{clientOffset:r.clientOffset});case Ze:case Qe:return kt;default:return e}var n,o}function Ht(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ft(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){Ht(e,t,r[t])})}return e}const zt={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function Ut(e=zt,t){const{payload:r}=t;switch(t.type){case Ke:return Ft({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case qe:return Ft({},e,{isSourcePublic:!0});case Je:return Ft({},e,{targetIds:r.targetIds});case Et:return-1===e.targetIds.indexOf(r.targetId)?e:Ft({},e,{targetIds:(n=e.targetIds,o=r.targetId,n.filter(e=>e!==o))});case Qe:return Ft({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case Ze:return Ft({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var n,o}function $t(e=0,t){switch(t.type){case Tt:case Dt:return e+1;case wt:case Et:return e-1;default:return e}}function Bt(e=0){return e+1}function Vt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){Vt(e,t,r[t])})}return e}function Gt(e={},t){return{dirtyHandlerIds:jt(e.dirtyHandlerIds,{type:t.type,payload:Wt({},t.payload,{prevTargetIds:(r=e,n="dragOperation.targetIds",o=[],n.split(".").reduce((e,t)=>e&&e[t]?e[t]:o||null,r))})}),dragOffset:At(e.dragOffset,t),refCount:$t(e.refCount,t),dragOperation:Ut(e.dragOperation,t),stateId:Bt(e.stateId)};var r,n,o}function Yt(e,t=void 0,r={},n=!1){const o=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return We(Gt,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(n),i=new ft(o,new Mt(o)),s=new dt(o,i),a=e(s,t,r);return s.receiveBackend(a),s}function Xt(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}let Kt=0;const qt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var Jt,Qt,Zt=o(function(t){var{children:r}=t,n=Xt(t,["children"]);const[o,s]=function(e){if("manager"in e){return[{dragDropManager:e.manager},!1]}const t=function(e,t=er(),r,n){const o=t;o[qt]||(o[qt]={dragDropManager:Yt(e,t,r,n)});return o[qt]}(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}(n);return i(()=>{if(s){const e=er();return++Kt,()=>{0===--Kt&&(e[qt]=null)}}},[]),e(He.Provider,{value:o,children:r})});function er(){return"undefined"!=typeof global?global:window}var tr=(Qt||(Qt=1,Jt=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!==o--;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}),Jt),rr=Me(tr);const nr="undefined"!=typeof window?s:i;function or(e,t,r){const[n,o]=function(e,t,r){const[n,o]=a(()=>t(e)),i=c(()=>{const i=t(e);rr(n,i)||(o(i),r&&r())},[n,e,r]);return nr(i),[n,i]}(e,t,r);return nr(function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(o,{handlerIds:[t]})},[e,o]),n}function ir(e,t,r){return or(t,e||(()=>({})),()=>r.reconnect())}function sr(e,t){const r=[];return"function"!=typeof e&&r.push(e),u(()=>"function"==typeof e?e():e,r)}function ar(e){return u(()=>e.hooks.dragSource(),[e])}function cr(e){return u(()=>e.hooks.dragPreview(),[e])}let ur=!1,dr=!1;class lr{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){Ge(!ur,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ur=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{ur=!1}}isDragging(){if(!this.sourceId)return!1;Ge(!dr,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return dr=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{dr=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}let hr=!1;class gr{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;Ge(!hr,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return hr=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{hr=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}function fr(e,t,r,n){let o;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;const a=Object.prototype.hasOwnProperty.bind(t);for(let r=0;r<i.length;r++){const n=i[r];if(!a(n))return!1;const s=e[n],c=t[n];if(o=void 0,!1===o||void 0===o&&s!==c)return!1}return!0}function pr(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function mr(e){return(t=null,r=null)=>{if(!d(t)){const n=t;return e(n,r),n}const n=t;!function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(n);return function(e,t){const r=e.ref;return Ge("string"!=typeof r,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),l(e,r?{ref:e=>{yr(r,e),yr(t,e)}}:{ref:t})}(n,r?t=>e(t,r):e)}}function vr(e){const t={};return Object.keys(e).forEach(r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const e=mr(n);t[r]=()=>e}}),t}function yr(e,t){"function"==typeof e?e(t):e.current=t}class br{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();r&&this.disconnectDragPreview(),this.handlerId&&(t?r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!fr(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!fr(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=vr({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,pr(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,pr(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}class Or{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!fr(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=vr({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,pr(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function Sr(){const{dragDropManager:e}=h(He);return Ge(null!=e,"Expected drag drop context"),e}class Tr{beginDrag(){const e=this.spec,t=this.monitor;let r=null;return r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=r?r:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const r=this.spec,n=this.monitor,{isDragging:o}=r;return o?o(n):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,r=this.connector,{end:n}=e;n&&n(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}function Dr(e,t,r){const n=Sr(),o=function(e,t,r){const n=u(()=>new Tr(e,t,r),[t,r]);return i(()=>{n.spec=e},[e]),n}(e,t,r),s=function(e){return u(()=>{const t=e.type;return Ge(null!=t,"spec.type must be defined"),t},[e])}(e);nr(function(){if(null!=s){const[e,i]=function(e,t,r){const n=r.getRegistry(),o=n.addSource(e,t);return[o,()=>n.removeSource(o)]}(s,o,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),i}},[n,t,r,o,s])}function wr(e,t){const r=sr(e);Ge(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const n=function(){const e=Sr();return u(()=>new lr(e),[e])}(),o=function(e,t){const r=Sr(),n=u(()=>new br(r.getBackend()),[r]);return nr(()=>(n.dragSourceOptions=e||null,n.reconnect(),()=>n.disconnectDragSource()),[n,e]),nr(()=>(n.dragPreviewOptions=t||null,n.reconnect(),()=>n.disconnectDragPreview()),[n,t]),n}(r.options,r.previewOptions);return Dr(r,n,o),[ir(r.collect,n,o),ar(o),cr(o)]}function Er(e){return u(()=>e.hooks.dropTarget(),[e])}class Ir{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function _r(e,t,r){const n=Sr(),o=function(e,t){const r=u(()=>new Ir(e,t),[t]);return i(()=>{r.spec=e},[e]),r}(e,t),s=function(e){const{accept:t}=e;return u(()=>(Ge(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(e);nr(function(){const[e,i]=function(e,t,r){const n=r.getRegistry(),o=n.addTarget(e,t);return[o,()=>n.removeTarget(o)]}(s,o,n);return t.receiveHandlerId(e),r.receiveHandlerId(e),i},[n,t,o,r,s.map(e=>e.toString()).join("|")])}function Cr(e,t){const r=sr(e),n=function(){const e=Sr();return u(()=>new gr(e),[e])}(),o=function(e){const t=Sr(),r=u(()=>new Or(t.getBackend()),[t]);return nr(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}(r.options);return _r(r,n,o),[ir(r.collect,n,o),Er(o)]}function Nr(e){let t=null;return()=>(null==t&&(t=e()),t)}class Pr{enter(e){const t=this.entered.length;return this.entered=function(e,t){const r=new Set,n=e=>r.add(e);e.forEach(n),t.forEach(n);const o=[];return r.forEach(e=>o.push(e)),o}(this.entered.filter(t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e))),[e]),0===t&&this.entered.length>0}leave(e){const t=this.entered.length;var r,n;return this.entered=(r=this.entered.filter(this.isNodeInDocument),n=e,r.filter(e=>e!==n)),t>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class xr{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})})}loadDataTransfer(e){if(e){const t={};Object.keys(this.config.exposeProperties).forEach(r=>{const n=this.config.exposeProperties[r];null!=n&&(t[r]={value:n(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const Mr="__NATIVE_FILE__",Rr="__NATIVE_URL__",jr="__NATIVE_TEXT__",Lr="__NATIVE_HTML__";var kr=Object.freeze({__proto__:null,FILE:Mr,HTML:Lr,TEXT:jr,URL:Rr});function Ar(e,t,r){const n=t.reduce((t,r)=>t||e.getData(r),"");return null!=n?n:r}const Hr={[Mr]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Lr]:{exposeProperties:{html:(e,t)=>Ar(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[Rr]:{exposeProperties:{urls:(e,t)=>Ar(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[jr]:{exposeProperties:{text:(e,t)=>Ar(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function Fr(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Hr).filter(e=>{const r=Hr[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some(e=>t.indexOf(e)>-1)})[0]||null}const zr=Nr(()=>/firefox/i.test(navigator.userAgent)),Ur=Nr(()=>Boolean(window.safari));class $r{interpolate(e){const{xs:t,ys:r,c1s:n,c2s:o,c3s:i}=this;let s=t.length-1;if(e===t[s])return r[s];let a,c=0,u=i.length-1;for(;c<=u;){a=Math.floor(.5*(c+u));const n=t[a];if(n<e)c=a+1;else{if(!(n>e))return r[a];u=a-1}}s=Math.max(0,u);const d=e-t[s],l=d*d;return r[s]+n[s]*d+o[s]*l+i[s]*d*l}constructor(e,t){const{length:r}=e,n=[];for(let e=0;e<r;e++)n.push(e);n.sort((t,r)=>e[t]<e[r]?-1:1);const o=[],i=[];let s,a;for(let n=0;n<r-1;n++)s=e[n+1]-e[n],a=t[n+1]-t[n],o.push(s),i.push(a/s);const c=[i[0]];for(let e=0;e<o.length-1;e++){const t=i[e],r=i[e+1];if(t*r<=0)c.push(0);else{s=o[e];const n=o[e+1],i=s+n;c.push(3*i/((i+n)/t+(i+s)/r))}}c.push(i[i.length-1]);const u=[],d=[];let l;for(let e=0;e<c.length-1;e++){l=i[e];const t=c[e],r=1/o[e],n=t+c[e+1]-l-l;u.push((l-t-n)*r),d.push(n*r*r)}this.xs=e,this.ys=t,this.c1s=c,this.c2s=u,this.c3s=d}}function Br(e){const t=1===e.nodeType?e:e.parentElement;if(!t)return null;const{top:r,left:n}=t.getBoundingClientRect();return{x:n,y:r}}function Vr(e){return{x:e.clientX,y:e.clientY}}function Wr(e,t,r,n,o){const i="IMG"===(s=t).nodeName&&(zr()||!(null===(a=document.documentElement)||void 0===a?void 0:a.contains(s)));var s,a;const c=Br(i?e:t),u={x:r.x-c.x,y:r.y-c.y},{offsetWidth:d,offsetHeight:l}=e,{anchorX:h,anchorY:g}=n,{dragPreviewWidth:f,dragPreviewHeight:p}=function(e,t,r,n){let o=e?t.width:r,i=e?t.height:n;return Ur()&&e&&(i/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:i}}(i,t,d,l),{offsetX:m,offsetY:v}=o,y=0===v||v;return{x:0===m||m?m:new $r([0,.5,1],[u.x,u.x/d*f,u.x+f-d]).interpolate(h),y:y?v:(()=>{let e=new $r([0,.5,1],[u.y,u.y/l*p,u.y+p-l]).interpolate(g);return Ur()&&i&&(e+=(window.devicePixelRatio-1)*p),e})()}}let Gr=class{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var e;return(null===(e=this.globalContext)||void 0===e?void 0:e.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}};function Yr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){Yr(e,t,r[t])})}return e}class Kr{profile(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){const e=this.rootElement;var t;void 0!==e&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(t=this.window)||void 0===t||t.cancelAnimationFrame(this.asyncEndDragFrameId)))}connectDragPreview(e,t,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,r){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);const n=t=>this.handleDragStart(t,e),o=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",n),t.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",n),t.removeEventListener("selectstart",o),t.setAttribute("draggable","false")}}connectDropTarget(e,t){const r=t=>this.handleDragEnter(t,e),n=t=>this.handleDragOver(t,e),o=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",r),t.addEventListener("dragover",n),t.addEventListener("drop",o),()=>{t.removeEventListener("dragenter",r),t.removeEventListener("dragover",n),t.removeEventListener("drop",o)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return Xr({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return Xr({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(kr).some(t=>kr[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const r=Hr[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new xr(r);return n.loadDataTransfer(t),n}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e;this.mouseMoveTimeoutTimer=setTimeout(()=>{var e;return null===(e=this.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){var e;if(this.currentDragSourceNode=null,this.rootElement)null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0);return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{const t=this.sourceNodes.get(e);return t&&Br(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>Boolean(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{const e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;const{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;const r=Vr(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:r});const{dataTransfer:n}=e,o=Fr(n);if(this.monitor.isDragging()){if(n&&"function"==typeof n.setDragImage){const e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),o=this.sourcePreviewNodes.get(e)||t;if(o){const{anchorX:e,anchorY:i,offsetX:s,offsetY:a}=this.getCurrentSourcePreviewNodeOptions(),c=Wr(t,o,r,{anchorX:e,anchorY:i},{offsetX:s,offsetY:a});n.setDragImage(o,c.x,c.y)}}try{null==n||n.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);const{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(o)this.beginDragNativeItem(o);else{if(n&&!n.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{var t;(this.dragEnterTargetIds=[],this.isDraggingNativeItem())&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer));if(!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;const{dataTransfer:r}=e,n=Fr(r);n&&this.beginDragNativeItem(n,r)},this.handleTopDragEnter=e=>{const{dragEnterTargetIds:t}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:Vr(e)});t.some(e=>this.monitor.canDropOnTarget(e))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=e=>{var t;(this.dragOverTargetIds=[],this.isDraggingNativeItem())&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer))},this.handleTopDragOver=e=>{const{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));this.altKeyPressed=e.altKey,this.lastClientOffset=Vr(e),this.scheduleHover(t);(t||[]).some(e=>this.monitor.canDropOnTarget(e))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault();this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=e=>{var t;(this.dropTargetIds=[],this.isDraggingNativeItem())?(e.preventDefault(),null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):Fr(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:Vr(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{const t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new Gr(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new Pr(this.isNodeInDocument)}}const qr=function(e,t,r){return new Kr(e,t,r)};var Jr;!function(e){e.mouse="mouse",e.touch="touch",e.keyboard="keyboard"}(Jr||(Jr={}));class Qr{get delay(){var e;return null!==(e=this.args.delay)&&void 0!==e?e:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var e;return null!==(e=this.args.ignoreContextMenu)&&void 0!==e&&e}get enableHoverOutsideTarget(){var e;return null!==(e=this.args.enableHoverOutsideTarget)&&void 0!==e&&e}get enableKeyboardEvents(){var e;return null!==(e=this.args.enableKeyboardEvents)&&void 0!==e&&e}get enableMouseEvents(){var e;return null!==(e=this.args.enableMouseEvents)&&void 0!==e&&e}get enableTouchEvents(){var e;return null===(e=this.args.enableTouchEvents)||void 0===e||e}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var e,t,r,n;return null!==(n=null!==(r=null===(e=this.args)||void 0===e?void 0:e.delayTouchStart)&&void 0!==r?r:null===(t=this.args)||void 0===t?void 0:t.delay)&&void 0!==n?n:0}get delayMouseStart(){var e,t,r,n;return null!==(n=null!==(r=null===(e=this.args)||void 0===e?void 0:e.delayMouseStart)&&void 0!==r?r:null===(t=this.args)||void 0===t?void 0:t.delay)&&void 0!==n?n:0}get window(){return this.context&&this.context.window?this.context.window:"undefined"!=typeof window?window:void 0}get document(){var e;return(null===(e=this.context)||void 0===e?void 0:e.document)?this.context.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null===(e=this.args)||void 0===e?void 0:e.rootElement)||this.document}constructor(e,t){this.args=e,this.context=t}}const Zr=1,en=0;function tn(e){return void 0===e.button||e.button===en}function rn(e){return!!e.targetTouches}function nn(e,t){return rn(e)?function(e,t){return 1===e.targetTouches.length?nn(e.targetTouches[0]):t&&1===e.touches.length&&e.touches[0].target===t.target?nn(e.touches[0]):void 0}(e,t):{x:e.clientX,y:e.clientY}}const on=(()=>{let e=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get:()=>(e=!0,!0)}))}catch(e){}return e})(),sn={[Jr.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[Jr.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[Jr.keyboard]:{keydown:"keydown"}};class an{profile(){var e;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:(null===(e=this.dragOverTargetIds)||void 0===e?void 0:e.length)||0}}get document(){return this.options.document}setup(){const e=this.options.rootElement;e&&(Ge(!an.isSetUp,"Cannot have two Touch backends at the same time."),an.isSetUp=!0,this.addEventListener(e,"start",this.getTopMoveStartHandler()),this.addEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(e,"move",this.handleTopMove),this.addEventListener(e,"move",this.handleTopMoveCapture,!0),this.addEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(e,"keydown",this.handleCancelOnEscape,!0))}teardown(){const e=this.options.rootElement;e&&(an.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(e,"start",this.handleTopMoveStart),this.removeEventListener(e,"move",this.handleTopMoveCapture,!0),this.removeEventListener(e,"move",this.handleTopMove),this.removeEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(e,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(e,t,r,n=!1){const o=on?{capture:n,passive:!1}:n;this.listenerTypes.forEach(function(n){const i=sn[n][t];i&&e.addEventListener(i,r,o)})}removeEventListener(e,t,r,n=!1){const o=on?{capture:n,passive:!1}:n;this.listenerTypes.forEach(function(n){const i=sn[n][t];i&&e.removeEventListener(i,r,o)})}connectDragSource(e,t){const r=this.handleMoveStart.bind(this,e);return this.sourceNodes.set(e,t),this.addEventListener(t,"start",r),()=>{this.sourceNodes.delete(e),this.removeEventListener(t,"start",r)}}connectDragPreview(e,t,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDropTarget(e,t){const r=this.options.rootElement;if(!this.document||!r)return()=>{};const n=n=>{if(!this.document||!r||!this.monitor.isDragging())return;let o;switch(n.type){case sn.mouse.move:o={x:n.clientX,y:n.clientY};break;case sn.touch.move:var i,s;o={x:(null===(i=n.touches[0])||void 0===i?void 0:i.clientX)||0,y:(null===(s=n.touches[0])||void 0===s?void 0:s.clientY)||0}}const a=null!=o?this.document.elementFromPoint(o.x,o.y):void 0,c=a&&t.contains(a);return a===t||c?this.handleMove(n,e):void 0};return this.addEventListener(this.document.body,"move",n),this.targetNodes.set(e,t),()=>{this.document&&(this.targetNodes.delete(e),this.removeEventListener(this.document.body,"move",n))}}getTopMoveStartHandler(){return this.options.delayTouchStart||this.options.delayMouseStart?this.handleTopMoveStartDelay:this.handleTopMoveStart}installSourceNodeRemovalObserver(e){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=e,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{e&&!e.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),e&&e.parentElement&&this.draggedSourceNodeRemovalObserver.observe(e.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(e,t,r){this.getSourceClientOffset=e=>{const t=this.sourceNodes.get(e);return t&&function(e){const t=1===e.nodeType?e:e.parentElement;if(!t)return;const{top:r,left:n}=t.getBoundingClientRect();return{x:n,y:r}}(t)},this.handleTopMoveStartCapture=e=>{tn(e)&&(this.moveStartSourceIds=[])},this.handleMoveStart=e=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(e)},this.handleTopMoveStart=e=>{if(!tn(e))return;const t=nn(e);t&&(rn(e)&&(this.lastTargetTouchFallback=e.targetTouches[0]),this._mouseClientOffset=t),this.waitingForDelay=!1},this.handleTopMoveStartDelay=e=>{if(!tn(e))return;const t=e.type===sn.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,e),t),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(e,t)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(t)},this.handleTopMove=e=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:t,dragOverTargetIds:r}=this,n=this.options.enableHoverOutsideTarget,o=nn(e,this.lastTargetTouchFallback);if(!o)return;if(this._isScrolling||!this.monitor.isDragging()&&function(e,t,r,n,o){if(!o)return!1;const i=180*Math.atan2(n-t,r-e)/Math.PI+180;for(let e=0;e<o.length;++e){const t=o[e];if(t&&(null==t.start||i>=t.start)&&(null==t.end||i<=t.end))return!0}return!1}(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,o.x,o.y,this.options.scrollAngleRanges))return void(this._isScrolling=!0);var i,s,a,c;if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&t&&(i=this._mouseClientOffset.x||0,s=this._mouseClientOffset.y||0,a=o.x,c=o.y,Math.sqrt(Math.pow(Math.abs(a-i),2)+Math.pow(Math.abs(c-s),2))>(this.options.touchSlop?this.options.touchSlop:0))&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(t,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const u=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(u),this.actions.publishDragSource(),e.cancelable&&e.preventDefault();const d=(r||[]).map(e=>this.targetNodes.get(e)).filter(e=>!!e),l=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(o.x,o.y,d):this.document.elementsFromPoint(o.x,o.y),h=[];for(const e in l){if(!l.hasOwnProperty(e))continue;let t=l[e];for(null!=t&&h.push(t);t;)t=t.parentElement,t&&-1===h.indexOf(t)&&h.push(t)}const g=h.filter(e=>d.indexOf(e)>-1).map(e=>this._getDropTargetId(e)).filter(e=>!!e).filter((e,t,r)=>r.indexOf(e)===t);if(n)for(const e in this.targetNodes){const t=this.targetNodes.get(e);if(u&&t&&t.contains(u)&&-1===g.indexOf(e)){g.unshift(e);break}}g.reverse(),this.actions.hover(g,{clientOffset:o})},this._getDropTargetId=e=>{const t=this.targetNodes.keys();let r=t.next();for(;!1===r.done;){const n=r.value;if(e===this.targetNodes.get(n))return n;r=t.next()}},this.handleTopMoveEndCapture=e=>{this._isScrolling=!1,this.lastTargetTouchFallback=void 0,function(e){return void 0===e.buttons||0===(e.buttons&Zr)}(e)&&(this.monitor.isDragging()&&!this.monitor.didDrop()?(e.cancelable&&e.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()):this.moveStartSourceIds=void 0)},this.handleCancelOnEscape=e=>{"Escape"===e.key&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new Qr(r,t),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(Jr.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(Jr.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(Jr.keyboard)}}const cn=function(e,t={},r={}){return new an(e,t,r)},un=({position:t,path:r,mosaicId:n})=>{const{mosaicActions:o}=h(Pe),[{isOver:i,canDrop:s},a]=Cr({accept:"MosaicWindow",canDrop:e=>e.mosaicId===n,drop:e=>{const n=o.getRoot();if(!n)return;const i=Te(n,e.path,r,t);o.updateTree(i)},collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})}),c=i&&s;return e("div",{ref:a,className:"rm-mosaic-drop-target rm-absolute",style:{...dn(t),pointerEvents:s?"all":"none",opacity:c?1:0,backgroundColor:"rgba(59, 130, 246, 0.2)",border:"2px solid rgba(59, 130, 246, 0.6)",borderRadius:"4px",transition:"opacity 100ms ease-out"}})},dn=e=>{const t={zIndex:1e3};switch(e){case f.TOP:return{...t,top:0,left:0,right:0,height:"30%"};case f.BOTTOM:return{...t,bottom:0,left:0,right:0,height:"30%"};case f.LEFT:return{...t,top:0,bottom:0,left:0,width:"30%"};case f.RIGHT:return{...t,top:0,bottom:0,right:0,width:"30%"}}},ln=({direction:t,percentage:r,onChange:n,onRelease:o,boundingBox:i,minimumPaneSizePercentage:s=20})=>{const[u,d]=a(!1),l=g(null),h=c(e=>{e.preventDefault(),d(!0);const a=e.clientX,c=e.clientY,u=r,h=l.current?.parentElement;if(!h)return;const g=h.getBoundingClientRect(),f=i.right-i.left,p=i.bottom-i.top;let m=u;const v=e=>{let r;if("row"===t){const t=e.clientX-a,n=g.width*f/100;r=u+t/n*100}else{const t=e.clientY-c,n=g.height*p/100;r=u+t/n*100}r=Math.max(s,Math.min(100-s,r)),m=r,n(r)},y=()=>{d(!1),o?.(m),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",y)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",y)},[t,r,n,o,s,i]),f=c(e=>{if(1!==e.touches.length)return;const a=e.touches[0];d(!0);const c=a.clientX,u=a.clientY,h=r,g=l.current?.parentElement;if(!g)return;const f=g.getBoundingClientRect(),p=i.right-i.left,m=i.bottom-i.top;let v=h;const y=e=>{if(1!==e.touches.length)return;const r=e.touches[0];let o;if("row"===t){const e=r.clientX-c,t=f.width*p/100;o=h+e/t*100}else{const e=r.clientY-u,t=f.height*m/100;o=h+e/t*100}o=Math.max(s,Math.min(100-s,o)),v=o,n(o)},b=()=>{d(!1),o?.(v),document.removeEventListener("touchmove",y),document.removeEventListener("touchend",b)};document.addEventListener("touchmove",y),document.addEventListener("touchend",b)},[t,r,n,o,s,i]),p="row"===t,m=p?i.left+(i.right-i.left)*r/100:i.top+(i.bottom-i.top)*r/100;return e("div",{ref:l,className:Ae("rm-mosaic-split","rm-absolute rm-bg-mosaic-split rm-transition-colors",{"rm-cursor-col-resize":p,"rm-cursor-row-resize":!p,"rm-bg-mosaic-split-hover":u}),style:{...p?{top:`${i.top}%`,bottom:100-i.bottom+"%",left:m-.2+"%",width:"var(--rm-split-size, 4px)"}:{left:`${i.left}%`,right:100-i.right+"%",top:m-.2+"%",height:"var(--rm-split-size, 4px)"}},onMouseDown:h,onTouchStart:f})},hn=({root:t,renderTile:r,className:n,resize:o={minimumPaneSizePercentage:20}})=>{const{mosaicId:i}=h(Pe),s=u(()=>Ee(0,100,100,0),[]);return null===t?null:e("div",{className:n,style:{width:"100%",height:"100%",position:"relative"},children:e(gn,{node:t,path:[],boundingBox:s,renderTile:r,resize:o,mosaicId:i})})},gn=({node:n,path:o,boundingBox:i,renderTile:s,resize:a,mosaicId:u})=>{const{mosaicActions:d}=h(Pe),l=c(e=>{d.getRoot()&&d.updateTree([{path:o,spec:{splitPercentage:{$set:e}}}],!0)},[d,o]),g=c(e=>{d.getRoot()&&d.updateTree([{path:o,spec:{splitPercentage:{$set:e}}}])},[d,o]);if(!m(n))return t("div",{className:"rm-absolute rm-overflow-hidden",style:{top:`${i.top}%`,right:100-i.right+"%",bottom:100-i.bottom+"%",left:`${i.left}%`},children:[s(n,o),e(un,{position:f.TOP,path:o,mosaicId:u}),e(un,{position:f.BOTTOM,path:o,mosaicId:u}),e(un,{position:f.LEFT,path:o,mosaicId:u}),e(un,{position:f.RIGHT,path:o,mosaicId:u})]});const p=n.splitPercentage??50,[v,y]=Ce(i,p,n.direction);return t(r,{children:[e(gn,{node:n.first,path:[...o,"first"],boundingBox:v,renderTile:s,resize:a,mosaicId:u}),e(ln,{direction:n.direction,percentage:p,onChange:l,onRelease:g,boundingBox:i,...void 0!==a.minimumPaneSizePercentage&&{minimumPaneSizePercentage:a.minimumPaneSizePercentage}}),e(gn,{node:n.second,path:[...o,"second"],boundingBox:y,renderTile:s,resize:a,mosaicId:u})]})},fn=e=>"value"in e,pn=t=>{const{renderTile:r,onChange:n,onRelease:o,className:i="react-mosaic",zeroStateView:s,mosaicId:d="default-mosaic"}=t,[l,h]=a(fn(t)?t.value:t.initialValue),g=fn(t)?t.value:l,f=c(e=>{fn(t)||h(e),n?.(e)},[n,t]),p=c(e=>{o?.(e)},[o]),m=u(()=>({expand:(e,t)=>{if(null===g)return;const r=Oe(e,t),n=ve(g,[r]);f(n),p(n)},remove:e=>{if(null!==g)try{const t=be(g,e),r=ve(g,[t]);f(r),p(r)}catch(e){f(null),p(null)}},hide:e=>{if(null===g)return;const t=Se(e),r=ve(g,[t]);f(r)},replaceWith:(e,t)=>{if(null===g)return;const r=De(e,t),n=ve(g,[r]);f(n),p(n)},updateTree:(e,t=!1)=>{if(null===g)return;const r=ve(g,e);f(r),t||p(r)},getRoot:()=>g}),[g,f,p]),v=u(()=>({mosaicActions:m,mosaicId:d}),[m,d]),y="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0);return e(Zt,{backend:y?cn:qr,children:e(Pe.Provider,{value:v,children:e("div",{className:Ae(i,"rm-w-full rm-h-full rm-relative"),children:null===g?s??e("div",{className:"rm-flex rm-items-center rm-justify-center rm-w-full rm-h-full rm-text-gray-500",children:"Drop a window here"}):e(hn,{root:g,renderTile:r,className:"rm-w-full rm-h-full"})})})})},mn=({title:r,path:n,children:o,createNode:s,draggable:a=!0,toolbarControls:d,additionalControls:l,renderToolbar:f,onDragStart:p,onDragEnd:m,className:v})=>{const{mosaicActions:b,mosaicId:O}=h(Pe),S={...void 0!==p&&{onDragStart:p},...void 0!==m&&{onDragEnd:m}},{isDragging:T,drag:D}=((e,t,r)=>{const n=g(!1),[{isDragging:o},s,a]=wr({type:"MosaicWindow",item:{path:e,mosaicId:t},collect:e=>({isDragging:e.isDragging()})});return i(()=>{o&&!n.current?r?.onDragStart?.():!o&&n.current&&r?.onDragEnd?.("drop"),n.current=o},[o,r]),{isDragging:o,drag:s,preview:a}})(n,O,Object.keys(S).length>0?S:void 0),w=c(async()=>{if(!s)throw new Error("createNode is required for split operation");const e=await s(),t=b.getRoot();if(null===t)return;const r=y(t,n);r&&b.replaceWith(n,{direction:"row",first:r,second:e,splitPercentage:50})},[s,b,n]),E=c(async()=>{if(!s)throw new Error("createNode is required for replace operation");const e=await s();b.replaceWith(n,e)},[s,b,n]),I=c(()=>n,[n]),_=c(e=>a?D(e):e,[a,D]),C=u(()=>({split:w,replaceWithNew:E,getPath:I,connectDragSource:_}),[w,E,I,_]),N=u(()=>({mosaicWindowActions:C}),[C]),P={title:r,path:n,...void 0!==s&&{createNode:s},...void 0!==d&&{toolbarControls:d},...void 0!==l&&{additionalControls:l}},x=e(vn,{...P}),M=f?f(P,x):x;return e(xe.Provider,{value:N,children:t("div",{className:Ae("rm-mosaic-window","rm-flex rm-flex-col rm-h-full rm-bg-mosaic-window rm-rounded rm-shadow",{"rm-opacity-50":T},v),children:[M,e("div",{className:"rm-mosaic-window-body rm-flex-1 rm-overflow-auto rm-p-4",children:o})]})})},vn=({title:n,path:o,createNode:i,toolbarControls:s,additionalControls:c})=>{const{mosaicActions:u}=h(Pe),{mosaicWindowActions:d}=h(xe),[l,g]=a(!1),f=d.connectDragSource(e("div",{className:"rm-mosaic-window-title rm-font-medium rm-text-sm rm-cursor-move",children:n}));return t(r,{children:[t("div",{className:"rm-mosaic-window-toolbar rm-flex rm-items-center rm-justify-between rm-px-4 rm-py-2 rm-bg-mosaic-toolbar rm-border-b rm-border-mosaic-border rm-select-none",children:[f,t("div",{className:"rm-mosaic-window-controls rm-flex rm-gap-1 rm-items-center",children:[s,i&&t(r,{children:[e("button",{type:"button",className:"rm-mosaic-button rm-px-2 rm-py-1 rm-text-xs rm-rounded hover:rm-bg-gray-200 rm-transition",onClick:async()=>{try{await d.replaceWithNew()}catch(e){console.error("Replace failed:",e)}},title:"Replace",children:"↻"}),e("button",{type:"button",className:"rm-mosaic-button rm-px-2 rm-py-1 rm-text-xs rm-rounded hover:rm-bg-gray-200 rm-transition",onClick:async()=>{try{await d.split()}catch(e){console.error("Split failed:",e)}},title:"Split",children:"⊞"}),e("button",{type:"button",className:"rm-mosaic-button rm-px-2 rm-py-1 rm-text-xs rm-rounded hover:rm-bg-gray-200 rm-transition",onClick:()=>{u.expand(o)},title:"Expand",children:"⛶"})]}),e("button",{type:"button",className:"rm-mosaic-button rm-px-2 rm-py-1 rm-text-xs rm-rounded hover:rm-bg-red-200 rm-transition",onClick:()=>{u.remove(o)},title:"Close",children:"✕"}),c&&e("button",{type:"button",className:"rm-mosaic-button rm-px-2 rm-py-1 rm-text-xs rm-rounded hover:rm-bg-gray-200 rm-transition",onClick:()=>{g(!l)},title:"More",children:"⋯"})]})]}),l&&c&&e("div",{className:"rm-mosaic-additional-controls rm-bg-mosaic-toolbar rm-border-b rm-border-mosaic-border rm-px-4 rm-py-2",children:c})]})};export{p as Corner,pn as Mosaic,Pe as MosaicContext,un as MosaicDropTarget,f as MosaicDropTargetPosition,mn as MosaicWindow,xe as MosaicWindowContext,ln as Split,Ne as containsPoint,w as countNodes,O as createBalancedTreeFromLeaves,Ee as createBoundingBox,Te as createDragToUpdates,Oe as createExpandUpdate,Se as createHideUpdate,be as createRemoveUpdate,De as createReplaceUpdate,we as createSplitUpdate,b as getAndAssertNodeAtPathExists,_e as getHeight,v as getLeaves,y as getNodeAtPath,D as getOtherBranch,T as getOtherDirection,S as getPathToCorner,E as getTreeDepth,Ie as getWidth,m as isParent,Ce as split,ve as updateTree};
7
+ //# sourceMappingURL=index.js.map