react-mosaic-ui 1.0.1 → 2.0.0
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.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/entities/mosaic/ui/mosaic-root.d.ts.map +1 -1
- package/dist/types/entities/mosaic/ui/mosaic.d.ts.map +1 -1
- package/dist/types/entities/window/ui/mosaic-window.d.ts +3 -2
- package/dist/types/entities/window/ui/mosaic-window.d.ts.map +1 -1
- package/dist/types/features/drag-drop/index.d.ts +1 -0
- package/dist/types/features/drag-drop/index.d.ts.map +1 -1
- package/dist/types/features/drag-drop/ui/mosaic-drop-target.d.ts +2 -1
- package/dist/types/features/drag-drop/ui/mosaic-drop-target.d.ts.map +1 -1
- package/dist/types/features/drag-drop/ui/root-drop-targets.d.ts +2 -0
- package/dist/types/features/drag-drop/ui/root-drop-targets.d.ts.map +1 -0
- package/dist/types/shared/lib/bounding-box.test.d.ts +2 -0
- package/dist/types/shared/lib/bounding-box.test.d.ts.map +1 -0
- package/dist/types/shared/lib/context.d.ts.map +1 -1
- package/dist/types/shared/lib/index.d.ts +1 -1
- package/dist/types/shared/lib/index.d.ts.map +1 -1
- package/dist/types/shared/lib/mosaic-utilities.d.ts +1 -0
- package/dist/types/shared/lib/mosaic-utilities.d.ts.map +1 -1
- package/dist/types/shared/lib/mosaic-utilities.test.d.ts +2 -0
- package/dist/types/shared/lib/mosaic-utilities.test.d.ts.map +1 -0
- package/dist/types/shared/types/context.types.d.ts +0 -1
- package/dist/types/shared/types/context.types.d.ts.map +1 -1
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var e,t,r=require("react/jsx-runtime"),n=require("react");exports.MosaicDropTargetPosition=void 0,(e=exports.MosaicDropTargetPosition||(exports.MosaicDropTargetPosition={})).TOP="TOP",e.BOTTOM="BOTTOM",e.LEFT="LEFT",e.RIGHT="RIGHT",exports.Corner=void 0,(t=exports.Corner||(exports.Corner={}))[t.TOP_LEFT=1]="TOP_LEFT",t[t.TOP_RIGHT=2]="TOP_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT",t[t.BOTTOM_RIGHT=4]="BOTTOM_RIGHT";const o=e=>null!==e&&"object"==typeof e&&"direction"in e&&"first"in e&&"second"in e,i=e=>null===e?[]:o(e)?[...i(e.first),...i(e.second)]:[e],s=(e,t)=>{if(0===t.length)return e;if(!o(e))return null;const[r,...n]=t;return r?s(e[r],n):null},a=(e,t)=>{const r=s(e,t);if(null===r)throw new Error(`Node at path ${t.join("/")} not found`);return r},c=(e,t="row")=>{if(0===e.length)return null;if(1===e.length)return e[0];const r=Math.floor(e.length/2),n=c(e.slice(0,r),u(t)),o=c(e.slice(r),u(t));return null===n||null===o?n??o:{direction:t,first:n,second:o,splitPercentage:50}},u=e=>"row"===e?"column":"row",d=e=>"first"===e?"second":"first",l=e=>null===e?0:o(e)?1+l(e.first)+l(e.second):1,h=e=>null===e?0:o(e)?1+Math.max(h(e.first),h(e.second)):1;var g=Symbol.for("immer-nothing"),p=Symbol.for("immer-draftable"),f=Symbol.for("immer-state"),m="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 v(e,...t){if("production"!==process.env.NODE_ENV){const r=m[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 y=Object.getPrototypeOf;function b(e){return!!e&&!!e[f]}function T(e){return!!e&&(S(e)||Array.isArray(e)||!!e[p]||!!e.constructor?.[p]||C(e)||P(e))}var O=Object.prototype.constructor.toString(),D=new WeakMap;function S(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=D.get(r);return void 0===n&&(n=Function.toString.call(r),D.set(r,n)),n===O}function w(e,t,r=!0){if(0===E(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 E(e){const t=e[f];return t?t.type_:Array.isArray(e)?1:C(e)?2:P(e)?3:0}function I(e,t){return 2===E(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function x(e,t,r){const n=E(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function C(e){return e instanceof Map}function P(e){return e instanceof Set}function _(e){return e.copy_||e.base_}function N(e,t){if(C(e))return new Map(e);if(P(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=S(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[f];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(y(e),t)}{const t=y(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function M(e,t=!1){return j(e)||b(e)||!T(e)||(E(e)>1&&Object.defineProperties(e,{set:R,add:R,clear:R,delete:R}),Object.freeze(e),t&&Object.values(e).forEach(e=>M(e,!0))),e}var R={value:function(){v(2)}};function j(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var L,k={};function A(e){const t=k[e];return t||v(0,e),t}function H(){return L}function F(e,t){t&&(A("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function z(e){U(e),e.drafts_.forEach($),e.drafts_=null}function U(e){e===L&&(L=e.parent_)}function B(e){return L={drafts_:[],parent_:L,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function $(e){const t=e[f];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function V(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[f].modified_&&(z(t),v(4)),T(e)&&(e=W(t,e),t.parent_||Y(t,e)),t.patches_&&A("Patches").generateReplacementPatches_(r[f].base_,e,t.patches_,t.inversePatches_)):e=W(t,r,[]),z(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==g?e:void 0}function W(e,t,r){if(j(t))return t;const n=e.immer_.shouldUseStrictIteration(),o=t[f];if(!o)return w(t,(n,i)=>G(e,o,t,n,i,r),n),t;if(o.scope_!==e)return t;if(!o.modified_)return Y(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),w(i,(n,i)=>G(e,o,t,n,i,r,s),n),Y(e,t,!1),r&&e.patches_&&A("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function G(e,t,r,n,o,i,s){if(null==o)return;if("object"!=typeof o&&!s)return;const a=j(o);if(!a||s){if("production"!==process.env.NODE_ENV&&o===r&&v(5),b(o)){const s=W(e,o,i&&t&&3!==t.type_&&!I(t.assigned_,n)?i.concat(n):void 0);if(x(r,n,s),!b(s))return;e.canAutoFreeze_=!1}else s&&r.add(o);if(T(o)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;if(t&&t.base_&&t.base_[n]===o&&a)return;W(e,o),t&&t.scope_.parent_||"symbol"==typeof n||!(C(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))||Y(e,o)}}}function Y(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&M(t,r)}var X={get(e,t){if(t===f)return e;const r=_(e);if(!I(r,t))return function(e,t,r){const n=J(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_||!T(n)?n:n===K(e.base_,t)?(Z(e),e.copy_[t]=ee(n,e)):n},has:(e,t)=>t in _(e),ownKeys:e=>Reflect.ownKeys(_(e)),set(e,t,r){const n=J(_(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=K(_(e),t),s=n?.[f];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||I(e.base_,t)))return!0;Z(e),Q(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!==K(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Z(e),Q(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=_(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){v(11)},getPrototypeOf:e=>y(e.base_),setPrototypeOf(){v(12)}},q={};function K(e,t){const r=e[f];return(r?_(r):e)[t]}function J(e,t){if(!(t in e))return;let r=y(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=y(r)}}function Q(e){e.modified_||(e.modified_=!0,e.parent_&&Q(e.parent_))}function Z(e){e.copy_||(e.copy_=N(e.base_,e.scope_.immer_.useStrictShallowCopy_))}w(X,(e,t)=>{q[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),q.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&v(13),q.set.call(this,e,t,void 0)},q.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&v(14),X.set.call(this,e[0],t,r,e[0])};function ee(e,t){const r=C(e)?A("MapSet").proxyMap_(e,t):P(e)?A("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:H(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=X;r&&(o=[n],i=q);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,a}(e,t);return(t?t.scope_:H()).drafts_.push(r),r}function te(e){if(!T(e)||j(e))return e;const t=e[f];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=N(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=N(e,!0);return w(r,(e,t)=>{x(r,e,te(t))},n),t&&(t.finalized_=!1),r}var re=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&&v(6),void 0!==r&&"function"!=typeof r&&v(7),T(e)){const o=B(this),i=ee(e,void 0);let s=!0;try{n=t(i),s=!1}finally{s?z(o):U(o)}return F(o,r),V(n,o)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===g&&(n=void 0),this.autoFreeze_&&M(n,!0),r){const t=[],o=[];A("Patches").generateReplacementPatches_(e,n,t,o),r(t,o)}return n}v(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){T(e)||v(8),b(e)&&(e=function(e){b(e)||v(10,e);return te(e)}(e));const t=B(this),r=ee(e,void 0);return r[f].isManual_=!0,U(t),r}finishDraft(e,t){const r=e&&e[f];r&&r.isManual_||v(9);const{scope_:n}=r;return F(n,t),V(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=A("Patches").applyPatches_;return b(e)?n(e,t):this.produce(e,e=>n(e,t))}},ne=re.produce;const oe=(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:ne(r,t=>{ie(t,e.path,e.spec)});return r},ie=(e,t,r)=>{if(0===t.length){if("$set"in r)return;return void(o(e)&&(r.splitPercentage&&(e.splitPercentage=r.splitPercentage.$set),r.direction&&(e.direction=r.direction.$set),r.first&&ie(e.first,[],r.first),r.second&&ie(e.second,[],r.second)))}if(!o(e))return;const[n,...i]=t;n&&(0===i.length&&"$set"in r?e[n]=r.$set:ie(e[n],i,r))},se=(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],i=d(n),s=a(e,r);if(!o(s))throw new Error("Parent is not a parent node");return{path:r,spec:{$set:s[i]}}},ae=(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}}}},ce=e=>({path:e,spec:{$set:null}}),ue=(e,t,r,n)=>{const o=s(e,t);if(null===o)return[];const i=s(e,r);if(null===i)return[];if(JSON.stringify(t)===JSON.stringify(r))return[];const a=n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.RIGHT?"row":"column",c={direction:a,first:n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.TOP?o:i,second:n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.TOP?i:o,splitPercentage:50};if(t.length>r.length&&r.every((e,r)=>t[r]===e)){const e=t.slice(r.length),s=oe(i,[se(i,e)]);if(null===s)return[];const c={direction:a,first:n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.TOP?o:s,second:n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.TOP?s:o,splitPercentage:50};return[{path:r,spec:{$set:c}}]}const u=[];t.length>0&&u.push(se(e,t));let d=r;const l=t.slice(0,-1),h=r.slice(0,-1);if(l.length===h.length&&l.every((e,t)=>h[t]===e))d=l;else{if(l.length>0&&l.length<r.length&&l.every((e,t)=>r[t]===e)){t[l.length]===r[l.length]&&(d=[...l,...r.slice(l.length+1)])}}return u.push({path:d,spec:{$set:c}}),u},de=(e,t)=>({path:e,spec:{$set:t}}),le=(e,t,r,n)=>({top:e,right:t,bottom:r,left:n}),he=e=>e.right-e.left,ge=e=>e.bottom-e.top,pe=(e,t,r)=>{const n=Math.max(0,Math.min(100,t));if("row"===r){const t=e.left+he(e)*n/100;return[le(e.top,t,e.bottom,e.left),le(e.top,e.right,e.bottom,t)]}const o=e.top+ge(e)*n/100;return[le(e.top,e.right,o,e.left),le(o,e.right,e.bottom,e.left)]},fe=n.createContext({mosaicActions:{expand:()=>{},remove:()=>{},hide:()=>{},replaceWith:()=>{},updateTree:()=>{},getRoot:()=>null},mosaicId:"default"}),me=n.createContext({mosaicWindowActions:{split:async()=>{},replaceWithNew:async()=>{},getPath:()=>[],connectDragSource:e=>e}});function ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ye,be={exports:{}};
|
|
1
|
+
"use strict";var e,t,r=require("react/jsx-runtime"),n=require("react");exports.MosaicDropTargetPosition=void 0,(e=exports.MosaicDropTargetPosition||(exports.MosaicDropTargetPosition={})).TOP="TOP",e.BOTTOM="BOTTOM",e.LEFT="LEFT",e.RIGHT="RIGHT",exports.Corner=void 0,(t=exports.Corner||(exports.Corner={}))[t.TOP_LEFT=1]="TOP_LEFT",t[t.TOP_RIGHT=2]="TOP_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT",t[t.BOTTOM_RIGHT=4]="BOTTOM_RIGHT";const o=e=>null!==e&&"object"==typeof e&&"direction"in e&&"first"in e&&"second"in e,i=e=>null===e?[]:o(e)?[...i(e.first),...i(e.second)]:[e],s=(e,t)=>{if(0===t.length)return e;if(!o(e))return null;const[r,...n]=t;return r?s(e[r],n):null},a=(e,t)=>{const r=s(e,t);if(null===r)throw new Error(`Node at path ${t.join("/")} not found`);return r},c=(e,t="row")=>{if(0===e.length)return null;if(1===e.length)return e[0];const r=Math.floor(e.length/2),n=c(e.slice(0,r),u(t)),o=c(e.slice(r),u(t));return null===n||null===o?n??o:{direction:t,first:n,second:o,splitPercentage:50}},u=e=>"row"===e?"column":"row",d=e=>"first"===e?"second":"first",l=e=>null===e?0:o(e)?1+l(e.first)+l(e.second):1,h=e=>null===e?0:o(e)?1+Math.max(h(e.first),h(e.second)):1,g=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0};var p=Symbol.for("immer-nothing"),f=Symbol.for("immer-draftable"),m=Symbol.for("immer-state"),v="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 y(e,...t){if("production"!==process.env.NODE_ENV){const r=v[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 b=Object.getPrototypeOf;function T(e){return!!e&&!!e[m]}function O(e){return!!e&&(w(e)||Array.isArray(e)||!!e[f]||!!e.constructor?.[f]||P(e)||N(e))}var D=Object.prototype.constructor.toString(),S=new WeakMap;function w(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=S.get(r);return void 0===n&&(n=Function.toString.call(r),S.set(r,n)),n===D}function E(e,t,r=!0){if(0===I(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 I(e){const t=e[m];return t?t.type_:Array.isArray(e)?1:P(e)?2:N(e)?3:0}function x(e,t){return 2===I(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function C(e,t,r){const n=I(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function P(e){return e instanceof Map}function N(e){return e instanceof Set}function _(e){return e.copy_||e.base_}function M(e,t){if(P(e))return new Map(e);if(N(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=w(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[m];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(b(e),t)}{const t=b(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function R(e,t=!1){return L(e)||T(e)||!O(e)||(I(e)>1&&Object.defineProperties(e,{set:j,add:j,clear:j,delete:j}),Object.freeze(e),t&&Object.values(e).forEach(e=>R(e,!0))),e}var j={value:function(){y(2)}};function L(e){return null===e||"object"!=typeof e||Object.isFrozen(e)}var k,A={};function H(e){const t=A[e];return t||y(0,e),t}function F(){return k}function z(e,t){t&&(H("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function U(e){B(e),e.drafts_.forEach(V),e.drafts_=null}function B(e){e===k&&(k=e.parent_)}function $(e){return k={drafts_:[],parent_:k,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function V(e){const t=e[m];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function W(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[m].modified_&&(U(t),y(4)),O(e)&&(e=G(t,e),t.parent_||X(t,e)),t.patches_&&H("Patches").generateReplacementPatches_(r[m].base_,e,t.patches_,t.inversePatches_)):e=G(t,r,[]),U(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==p?e:void 0}function G(e,t,r){if(L(t))return t;const n=e.immer_.shouldUseStrictIteration(),o=t[m];if(!o)return E(t,(n,i)=>Y(e,o,t,n,i,r),n),t;if(o.scope_!==e)return t;if(!o.modified_)return X(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),E(i,(n,i)=>Y(e,o,t,n,i,r,s),n),X(e,t,!1),r&&e.patches_&&H("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function Y(e,t,r,n,o,i,s){if(null==o)return;if("object"!=typeof o&&!s)return;const a=L(o);if(!a||s){if("production"!==process.env.NODE_ENV&&o===r&&y(5),T(o)){const s=G(e,o,i&&t&&3!==t.type_&&!x(t.assigned_,n)?i.concat(n):void 0);if(C(r,n,s),!T(s))return;e.canAutoFreeze_=!1}else s&&r.add(o);if(O(o)&&!a){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;if(t&&t.base_&&t.base_[n]===o&&a)return;G(e,o),t&&t.scope_.parent_||"symbol"==typeof n||!(P(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))||X(e,o)}}}function X(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&R(t,r)}var q={get(e,t){if(t===m)return e;const r=_(e);if(!x(r,t))return function(e,t,r){const n=Q(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_||!O(n)?n:n===J(e.base_,t)?(ee(e),e.copy_[t]=te(n,e)):n},has:(e,t)=>t in _(e),ownKeys:e=>Reflect.ownKeys(_(e)),set(e,t,r){const n=Q(_(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=J(_(e),t),s=n?.[m];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||x(e.base_,t)))return!0;ee(e),Z(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!==J(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ee(e),Z(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=_(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty(){y(11)},getPrototypeOf:e=>b(e.base_),setPrototypeOf(){y(12)}},K={};function J(e,t){const r=e[m];return(r?_(r):e)[t]}function Q(e,t){if(!(t in e))return;let r=b(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=b(r)}}function Z(e){e.modified_||(e.modified_=!0,e.parent_&&Z(e.parent_))}function ee(e){e.copy_||(e.copy_=M(e.base_,e.scope_.immer_.useStrictShallowCopy_))}E(q,(e,t)=>{K[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),K.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&y(13),K.set.call(this,e,t,void 0)},K.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&y(14),q.set.call(this,e[0],t,r,e[0])};function te(e,t){const r=P(e)?H("MapSet").proxyMap_(e,t):N(e)?H("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:F(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,i=q;r&&(o=[n],i=K);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,a}(e,t);return(t?t.scope_:F()).drafts_.push(r),r}function re(e){if(!O(e)||L(e))return e;const t=e[m];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=M(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=M(e,!0);return E(r,(e,t)=>{C(r,e,re(t))},n),t&&(t.finalized_=!1),r}var ne=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&&y(6),void 0!==r&&"function"!=typeof r&&y(7),O(e)){const o=$(this),i=te(e,void 0);let s=!0;try{n=t(i),s=!1}finally{s?U(o):B(o)}return z(o,r),W(n,o)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===p&&(n=void 0),this.autoFreeze_&&R(n,!0),r){const t=[],o=[];H("Patches").generateReplacementPatches_(e,n,t,o),r(t,o)}return n}y(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){O(e)||y(8),T(e)&&(e=function(e){T(e)||y(10,e);return re(e)}(e));const t=$(this),r=te(e,void 0);return r[m].isManual_=!0,B(t),r}finishDraft(e,t){const r=e&&e[m];r&&r.isManual_||y(9);const{scope_:n}=r;return z(n,t),W(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=H("Patches").applyPatches_;return T(e)?n(e,t):this.produce(e,e=>n(e,t))}},oe=ne.produce;const ie=(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:oe(r,t=>{se(t,e.path,e.spec)});return r},se=(e,t,r)=>{if(0===t.length){if("$set"in r)return;return void(o(e)&&(r.splitPercentage&&(e.splitPercentage=r.splitPercentage.$set),r.direction&&(e.direction=r.direction.$set),r.first&&se(e.first,[],r.first),r.second&&se(e.second,[],r.second)))}if(!o(e))return;const[n,...i]=t;n&&(0===i.length&&"$set"in r?e[n]=r.$set:se(e[n],i,r))},ae=(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],i=d(n),s=a(e,r);if(!o(s))throw new Error("Parent is not a parent node");return{path:r,spec:{$set:s[i]}}},ce=(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}}}},ue=e=>({path:e,spec:{$set:null}}),de=(e,t,r,n)=>{const o=s(e,t);if(null===o)return[];const i=s(e,r);if(null===i)return[];if(JSON.stringify(t)===JSON.stringify(r))return[];const a=n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.RIGHT?"row":"column",c={direction:a,first:n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.TOP?o:i,second:n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.TOP?i:o,splitPercentage:50};if(t.length>r.length&&r.every((e,r)=>t[r]===e)){const e=t.slice(r.length),s=ie(i,[ae(i,e)]);if(null===s)return[];const c={direction:a,first:n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.TOP?o:s,second:n===exports.MosaicDropTargetPosition.LEFT||n===exports.MosaicDropTargetPosition.TOP?s:o,splitPercentage:50};return[{path:r,spec:{$set:c}}]}const u=[];t.length>0&&u.push(ae(e,t));let d=r;const l=t.slice(0,-1),h=r.slice(0,-1);if(l.length===h.length&&l.every((e,t)=>h[t]===e))d=l;else{if(l.length>0&&l.length<r.length&&l.every((e,t)=>r[t]===e)){t[l.length]===r[l.length]&&(d=[...l,...r.slice(l.length+1)])}}return u.push({path:d,spec:{$set:c}}),u},le=(e,t)=>({path:e,spec:{$set:t}}),he=(e,t,r,n)=>({top:e,right:t,bottom:r,left:n}),ge=e=>e.right-e.left,pe=e=>e.bottom-e.top,fe=(e,t,r)=>{const n=Math.max(0,Math.min(100,t));if("row"===r){const t=e.left+ge(e)*n/100;return[he(e.top,t,e.bottom,e.left),he(e.top,e.right,e.bottom,t)]}const o=e.top+pe(e)*n/100;return[he(e.top,e.right,o,e.left),he(o,e.right,e.bottom,e.left)]},me=n.createContext({mosaicActions:{expand:()=>{},remove:()=>{},hide:()=>{},replaceWith:()=>{},updateTree:()=>{},getRoot:()=>null},mosaicId:"default"}),ve=n.createContext({mosaicWindowActions:{split:async()=>{},replaceWithNew:async()=>{},getPath:()=>[]}});function ye(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var be,Te={exports:{}};
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
|
-
*/var Te,Oe=(ye||(ye=1,Te=be,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}Te.exports?(t.default=t,Te.exports=t):window.classNames=t}()),be.exports),De=ve(Oe);const Se=n.createContext({dragDropManager:void 0});function we(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 Ee="function"==typeof Symbol&&Symbol.observable||"@@observable",Ie=function(){return Math.random().toString(36).substring(7).split("").join(".")},xe={INIT:"@@redux/INIT"+Ie(),REPLACE:"@@redux/REPLACE"+Ie()};function Ce(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 Pe(e){var t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Ce(e)),t}function _e(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?we(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?we(1):"Expected the enhancer to be a function. Instead, received: '"+Pe(r)+"'");return r(_e)(e,t)}if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?we(2):"Expected the root reducer to be a function. Instead, received: '"+Pe(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?we(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?we(4):"Expected the listener to be a function. Instead, received: '"+Pe(e)+"'");if(c)throw new Error("production"===process.env.NODE_ENV?we(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?we(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?we(7):"Actions must be plain objects. Instead, the actual type was: '"+Pe(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?we(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?we(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:xe.INIT}),(n={dispatch:h,subscribe:l,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?we(10):"Expected the nextReducer to be a function. Instead, received: '"+Pe(e));o=e,h({type:xe.REPLACE})}})[Ee]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error("production"===process.env.NODE_ENV?we(11):"Expected the observer to be an object. Instead, received: '"+Pe(e)+"'");function r(){e.next&&e.next(d())}return r(),{unsubscribe:t(r)}}})[Ee]=function(){return this},e},n}function Ne(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 Me(e){return"object"==typeof e}const Re="dnd-core/INIT_COORDS",je="dnd-core/BEGIN_DRAG",Le="dnd-core/PUBLISH_DRAG_SOURCE",ke="dnd-core/HOVER",Ae="dnd-core/DROP",He="dnd-core/END_DRAG";function Fe(e,t){return{type:Re,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const ze={type:Re,payload:{clientOffset:null,sourceClientOffset:null}};function Ue(e){return function(t=[],r={publishSource:!0}){const{publishSource:n=!0,clientOffset:o,getSourceClientOffset:i}=r,s=e.getMonitor(),a=e.getRegistry();e.dispatch(Fe(o)),function(e,t,r){Ne(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){Ne(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(ze);let u=null;if(o){if(!i)throw new Error("getSourceClientOffset must be defined");!function(e){Ne("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(i),u=i(c)}e.dispatch(Fe(o,u));const d=a.getSource(c).beginDrag(s,c);if(null==d)return;!function(e){Ne(Me(e),"Item must be an object.")}(d),a.pinSource(c);const l=a.getSourceType(c);return{type:je,payload:{itemType:l,item:d,sourceId:c,clientOffset:o||null,sourceClientOffset:u||null,isSourcePublic:!!n}}}}function Be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $e(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){Be(e,t,r[t])})}return e}function Ve(e){return function(t={}){const r=e.getMonitor(),n=e.getRegistry();!function(e){Ne(e.isDragging(),"Cannot call drop while not dragging."),Ne(!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){Ne(void 0===e||Me(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:Ae,payload:{dropResult:$e({},t,s)}};e.dispatch(a)})}}function We(e){return function(){const t=e.getMonitor(),r=e.getRegistry();!function(e){Ne(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:He}}}function Ge(e,t){return null===t?null===e:Array.isArray(e)?e.some(e=>e===t):e===t}function Ye(e){return function(t,{clientOffset:r}={}){!function(e){Ne(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];Ge(t.getTargetType(o),r)||e.splice(n,1)}}(n,i,o.getItemType()),function(e,t,r){Ne(t.isDragging(),"Cannot call hover while not dragging."),Ne(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const n=e[t];Ne(e.lastIndexOf(n)===t,"Expected targetIds to be unique in the passed array.");Ne(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:ke,payload:{targetIds:n,clientOffset:r||null}}}}function Xe(e){return function(){if(e.getMonitor().isDragging())return{type:Le}}}class qe{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:Ue(e),publishDragSource:Xe(e),hover:Ye(e),drop:Ve(e),endDrag:We(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 Ke(e,t){return{x:e.x-t.x,y:e.y-t.y}}const Je=[],Qe=[];Je.__IS_NONE__=!0,Qe.__IS_ALL__=!0;class Ze{subscribeToStateChange(e,t={}){const{handlerIds:r}=t;Ne("function"==typeof e,"listener must be a function."),Ne(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!==Je&&(e===Qe||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){Ne("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 Ne(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(Ne(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;return Ge(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(Ne(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&&!Ge(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?Ke((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?Ke(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const et="undefined"!=typeof global?global:self,tt=et.MutationObserver||et.WebKitMutationObserver;function rt(e){return function(){const t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}const nt="function"==typeof tt?function(e){let t=1;const r=new tt(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}:rt;class ot{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 it=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=nt(this.flush),this.requestErrorThrow=rt(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},st=new class{create(e){const t=this.freeTasks,r=t.length?t.pop():new ot(this.onError,e=>t[t.length]=e);return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(it.registerPendingError);const at="dnd-core/ADD_SOURCE",ct="dnd-core/ADD_TARGET",ut="dnd-core/REMOVE_SOURCE",dt="dnd-core/REMOVE_TARGET";function lt(e,t){t&&Array.isArray(e)?e.forEach(e=>lt(e,!1)):Ne("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 ht;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(ht||(ht={}));let gt=0;function pt(e){const t=(gt++).toString();switch(e){case ht.SOURCE:return`S${t}`;case ht.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function ft(e){switch(e[0]){case"S":return ht.SOURCE;case"T":return ht.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function mt(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 vt{addSource(e,t){lt(e),function(e){Ne("function"==typeof e.canDrag,"Expected canDrag to be a function."),Ne("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),Ne("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const r=this.addHandler(ht.SOURCE,e,t);return this.store.dispatch(function(e){return{type:at,payload:{sourceId:e}}}(r)),r}addTarget(e,t){lt(e,!0),function(e){Ne("function"==typeof e.canDrop,"Expected canDrop to be a function."),Ne("function"==typeof e.hover,"Expected hover to be a function."),Ne("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const r=this.addHandler(ht.TARGET,e,t);return this.store.dispatch(function(e){return{type:ct,payload:{targetId:e}}}(r)),r}containsHandler(e){return mt(this.dragSources,e)||mt(this.dropTargets,e)}getSource(e,t=!1){Ne(this.isSourceId(e),"Expected a valid source ID.");return t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return Ne(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return Ne(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return Ne(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return ft(e)===ht.SOURCE}isTargetId(e){return ft(e)===ht.TARGET}removeSource(e){var t;Ne(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:ut,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},it.enqueueTask(st.create(t))}removeTarget(e){Ne(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:dt,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);Ne(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){Ne(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){const n=pt(e);return this.types.set(n,t),e===ht.SOURCE?this.dragSources.set(n,r):e===ht.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 yt=(e,t)=>e===t;function bt(e=Je,t){switch(t.type){case ke:break;case at:case ct:case dt:case ut:return Je;default:return Qe}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=yt){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 Je;const i=n[n.length-1],s=r[r.length-1];return i!==s&&(i&&o.push(i),s&&o.push(s)),o}function Tt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ot={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Dt(e=Ot,t){const{payload:r}=t;switch(t.type){case Re:case je:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case ke: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){Tt(e,t,r[t])})}return e}({},e,{clientOffset:r.clientOffset});case He:case Ae:return Ot;default:return e}var n,o}function St(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){St(e,t,r[t])})}return e}const Et={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function It(e=Et,t){const{payload:r}=t;switch(t.type){case je:return wt({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Le:return wt({},e,{isSourcePublic:!0});case ke:return wt({},e,{targetIds:r.targetIds});case dt:return-1===e.targetIds.indexOf(r.targetId)?e:wt({},e,{targetIds:(n=e.targetIds,o=r.targetId,n.filter(e=>e!==o))});case Ae:return wt({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case He:return wt({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var n,o}function xt(e=0,t){switch(t.type){case at:case ct:return e+1;case ut:case dt:return e-1;default:return e}}function Ct(e=0){return e+1}function Pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _t(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){Pt(e,t,r[t])})}return e}function Nt(e={},t){return{dirtyHandlerIds:bt(e.dirtyHandlerIds,{type:t.type,payload:_t({},t.payload,{prevTargetIds:(r=e,n="dragOperation.targetIds",o=[],n.split(".").reduce((e,t)=>e&&e[t]?e[t]:o||null,r))})}),dragOffset:Dt(e.dragOffset,t),refCount:xt(e.refCount,t),dragOperation:It(e.dragOperation,t),stateId:Ct(e.stateId)};var r,n,o}function Mt(e,t=void 0,r={},n=!1){const o=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return _e(Nt,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(n),i=new Ze(o,new vt(o)),s=new qe(o,i),a=e(s,t,r);return s.receiveBackend(a),s}function Rt(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 jt=0;const Lt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var kt,At,Ht=n.memo(function(e){var{children:t}=e,o=Rt(e,["children"]);const[i,s]=function(e){if("manager"in e){return[{dragDropManager:e.manager},!1]}const t=function(e,t=Ft(),r,n){const o=t;o[Lt]||(o[Lt]={dragDropManager:Mt(e,t,r,n)});return o[Lt]}(e.backend,e.context,e.options,e.debugMode),r=!e.context;return[t,r]}(o);return n.useEffect(()=>{if(s){const e=Ft();return++jt,()=>{0===--jt&&(e[Lt]=null)}}},[]),r.jsx(Se.Provider,{value:i,children:t})});function Ft(){return"undefined"!=typeof global?global:window}var zt=(At||(At=1,kt=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}),kt),Ut=ve(zt);const Bt="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function $t(e,t,r){const[o,i]=function(e,t,r){const[o,i]=n.useState(()=>t(e)),s=n.useCallback(()=>{const n=t(e);Ut(o,n)||(i(n),r&&r())},[o,e,r]);return Bt(s),[o,s]}(e,t,r);return Bt(function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(i,{handlerIds:[t]})},[e,i]),o}function Vt(e,t,r){return $t(t,e||(()=>({})),()=>r.reconnect())}function Wt(e,t){const r=[];return"function"!=typeof e&&r.push(e),n.useMemo(()=>"function"==typeof e?e():e,r)}function Gt(e){return n.useMemo(()=>e.hooks.dragSource(),[e])}function Yt(e){return n.useMemo(()=>e.hooks.dragPreview(),[e])}let Xt=!1,qt=!1;class Kt{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){Ne(!Xt,"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 Xt=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Xt=!1}}isDragging(){if(!this.sourceId)return!1;Ne(!qt,"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 qt=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{qt=!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 Jt=!1;class Qt{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;Ne(!Jt,"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 Jt=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Jt=!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 Zt(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 er(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function tr(e){return(t=null,r=null)=>{if(!n.isValidElement(t)){const n=t;return e(n,r),n}const o=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.`)}(o);return function(e,t){const r=e.ref;return Ne("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"),r?n.cloneElement(e,{ref:e=>{nr(r,e),nr(t,e)}}):n.cloneElement(e,{ref:t})}(o,r?t=>e(t,r):e)}}function rr(e){const t={};return Object.keys(e).forEach(r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const e=tr(n);t[r]=()=>e}}),t}function nr(e,t){"function"==typeof e?e(t):e.current=t}class or{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!Zt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Zt(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=rr({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,er(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,er(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 ir{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!Zt(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=rr({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,er(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}=n.useContext(Se);return Ne(null!=e,"Expected drag drop context"),e}class ar{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 cr(e,t,r){const o=sr(),i=function(e,t,r){const o=n.useMemo(()=>new ar(e,t,r),[t,r]);return n.useEffect(()=>{o.spec=e},[e]),o}(e,t,r),s=function(e){return n.useMemo(()=>{const t=e.type;return Ne(null!=t,"spec.type must be defined"),t},[e])}(e);Bt(function(){if(null!=s){const[e,n]=function(e,t,r){const n=r.getRegistry(),o=n.addSource(e,t);return[o,()=>n.removeSource(o)]}(s,i,o);return t.receiveHandlerId(e),r.receiveHandlerId(e),n}},[o,t,r,i,s])}function ur(e,t){const r=Wt(e);Ne(!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 o=function(){const e=sr();return n.useMemo(()=>new Kt(e),[e])}(),i=function(e,t){const r=sr(),o=n.useMemo(()=>new or(r.getBackend()),[r]);return Bt(()=>(o.dragSourceOptions=e||null,o.reconnect(),()=>o.disconnectDragSource()),[o,e]),Bt(()=>(o.dragPreviewOptions=t||null,o.reconnect(),()=>o.disconnectDragPreview()),[o,t]),o}(r.options,r.previewOptions);return cr(r,o,i),[Vt(r.collect,o,i),Gt(i),Yt(i)]}function dr(e){return n.useMemo(()=>e.hooks.dropTarget(),[e])}class lr{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 hr(e,t,r){const o=sr(),i=function(e,t){const r=n.useMemo(()=>new lr(e,t),[t]);return n.useEffect(()=>{r.spec=e},[e]),r}(e,t),s=function(e){const{accept:t}=e;return n.useMemo(()=>(Ne(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(e);Bt(function(){const[e,n]=function(e,t,r){const n=r.getRegistry(),o=n.addTarget(e,t);return[o,()=>n.removeTarget(o)]}(s,i,o);return t.receiveHandlerId(e),r.receiveHandlerId(e),n},[o,t,i,r,s.map(e=>e.toString()).join("|")])}function gr(e,t){const r=Wt(e),o=function(){const e=sr();return n.useMemo(()=>new Qt(e),[e])}(),i=function(e){const t=sr(),r=n.useMemo(()=>new ir(t.getBackend()),[t]);return Bt(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}(r.options);return hr(r,o,i),[Vt(r.collect,o,i),dr(i)]}function pr(e){let t=null;return()=>(null==t&&(t=e()),t)}class fr{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 mr{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 vr="__NATIVE_FILE__",yr="__NATIVE_URL__",br="__NATIVE_TEXT__",Tr="__NATIVE_HTML__";var Or=Object.freeze({__proto__:null,FILE:vr,HTML:Tr,TEXT:br,URL:yr});function Dr(e,t,r){const n=t.reduce((t,r)=>t||e.getData(r),"");return null!=n?n:r}const Sr={[vr]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Tr]:{exposeProperties:{html:(e,t)=>Dr(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[yr]:{exposeProperties:{urls:(e,t)=>Dr(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[br]:{exposeProperties:{text:(e,t)=>Dr(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function wr(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Sr).filter(e=>{const r=Sr[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some(e=>t.indexOf(e)>-1)})[0]||null}const Er=pr(()=>/firefox/i.test(navigator.userAgent)),Ir=pr(()=>Boolean(window.safari));class xr{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 Cr(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 Pr(e){return{x:e.clientX,y:e.clientY}}function _r(e,t,r,n,o){const i="IMG"===(s=t).nodeName&&(Er()||!(null===(a=document.documentElement)||void 0===a?void 0:a.contains(s)));var s,a;const c=Cr(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:p,dragPreviewHeight:f}=function(e,t,r,n){let o=e?t.width:r,i=e?t.height:n;return Ir()&&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 xr([0,.5,1],[u.x,u.x/d*p,u.x+p-d]).interpolate(h),y:y?v:(()=>{let e=new xr([0,.5,1],[u.y,u.y/l*f,u.y+f-l]).interpolate(g);return Ir()&&i&&(e+=(window.devicePixelRatio-1)*f),e})()}}let Nr=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 Mr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rr(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){Mr(e,t,r[t])})}return e}class jr{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 Rr({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return Rr({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(Or).some(t=>Or[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const r=Sr[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new mr(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&&Cr(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=Pr(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=wr(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=_r(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=wr(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:Pr(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=Pr(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)):wr(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:Pr(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 Nr(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new fr(this.isNodeInDocument)}}const Lr=function(e,t,r){return new jr(e,t,r)};var kr;!function(e){e.mouse="mouse",e.touch="touch",e.keyboard="keyboard"}(kr||(kr={}));class Ar{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 Hr=1,Fr=0;function zr(e){return void 0===e.button||e.button===Fr}function Ur(e){return!!e.targetTouches}function Br(e,t){return Ur(e)?function(e,t){return 1===e.targetTouches.length?Br(e.targetTouches[0]):t&&1===e.touches.length&&e.touches[0].target===t.target?Br(e.touches[0]):void 0}(e,t):{x:e.clientX,y:e.clientY}}const $r=(()=>{let e=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get:()=>(e=!0,!0)}))}catch(e){}return e})(),Vr={[kr.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[kr.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[kr.keyboard]:{keydown:"keydown"}};class Wr{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&&(Ne(!Wr.isSetUp,"Cannot have two Touch backends at the same time."),Wr.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&&(Wr.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=$r?{capture:n,passive:!1}:n;this.listenerTypes.forEach(function(n){const i=Vr[n][t];i&&e.addEventListener(i,r,o)})}removeEventListener(e,t,r,n=!1){const o=$r?{capture:n,passive:!1}:n;this.listenerTypes.forEach(function(n){const i=Vr[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 Vr.mouse.move:o={x:n.clientX,y:n.clientY};break;case Vr.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=>{zr(e)&&(this.moveStartSourceIds=[])},this.handleMoveStart=e=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(e)},this.handleTopMoveStart=e=>{if(!zr(e))return;const t=Br(e);t&&(Ur(e)&&(this.lastTargetTouchFallback=e.targetTouches[0]),this._mouseClientOffset=t),this.waitingForDelay=!1},this.handleTopMoveStartDelay=e=>{if(!zr(e))return;const t=e.type===Vr.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=Br(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&Hr)}(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 Ar(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(kr.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(kr.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(kr.keyboard)}}const Gr=function(e,t={},r={}){return new Wr(e,t,r)},Yr=({position:e,path:t,mosaicId:o})=>{const{mosaicActions:i}=n.useContext(fe),[{isOver:s,canDrop:a},c]=gr({accept:"MosaicWindow",canDrop:e=>e.mosaicId===o,drop:r=>{const n=i.getRoot();if(!n)return;const o=ue(n,r.path,t,e);i.updateTree(o)},collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})}),u=s&&a;return r.jsx("div",{ref:c,className:"rm-mosaic-drop-target rm-absolute",style:{...Xr(e),pointerEvents:a?"all":"none",opacity:u?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"}})},Xr=e=>{const t={zIndex:1e3};switch(e){case exports.MosaicDropTargetPosition.TOP:return{...t,top:0,left:0,right:0,height:"30%"};case exports.MosaicDropTargetPosition.BOTTOM:return{...t,bottom:0,left:0,right:0,height:"30%"};case exports.MosaicDropTargetPosition.LEFT:return{...t,top:0,bottom:0,left:0,width:"30%"};case exports.MosaicDropTargetPosition.RIGHT:return{...t,top:0,bottom:0,right:0,width:"30%"}}},qr=({direction:e,percentage:t,onChange:o,onRelease:i,boundingBox:s,minimumPaneSizePercentage:a=20})=>{const[c,u]=n.useState(!1),d=n.useRef(null),l=n.useCallback(r=>{r.preventDefault(),u(!0);const n=r.clientX,c=r.clientY,l=t,h=d.current?.parentElement;if(!h)return;const g=h.getBoundingClientRect(),p=s.right-s.left,f=s.bottom-s.top;let m=l;const v=t=>{let r;if("row"===e){const e=t.clientX-n,o=g.width*p/100;r=l+e/o*100}else{const e=t.clientY-c,n=g.height*f/100;r=l+e/n*100}r=Math.max(a,Math.min(100-a,r)),m=r,o(r)},y=()=>{u(!1),i?.(m),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",y)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",y)},[e,t,o,i,a,s]),h=n.useCallback(r=>{if(1!==r.touches.length)return;const n=r.touches[0];u(!0);const c=n.clientX,l=n.clientY,h=t,g=d.current?.parentElement;if(!g)return;const p=g.getBoundingClientRect(),f=s.right-s.left,m=s.bottom-s.top;let v=h;const y=t=>{if(1!==t.touches.length)return;const r=t.touches[0];let n;if("row"===e){const e=r.clientX-c,t=p.width*f/100;n=h+e/t*100}else{const e=r.clientY-l,t=p.height*m/100;n=h+e/t*100}n=Math.max(a,Math.min(100-a,n)),v=n,o(n)},b=()=>{u(!1),i?.(v),document.removeEventListener("touchmove",y),document.removeEventListener("touchend",b)};document.addEventListener("touchmove",y),document.addEventListener("touchend",b)},[e,t,o,i,a,s]),g="row"===e,p=g?s.left+(s.right-s.left)*t/100:s.top+(s.bottom-s.top)*t/100;return r.jsx("div",{ref:d,className:De("rm-mosaic-split","rm-absolute rm-bg-mosaic-split rm-transition-colors",{"rm-cursor-col-resize":g,"rm-cursor-row-resize":!g,"rm-bg-mosaic-split-hover":c}),style:{...g?{top:`${s.top}%`,bottom:100-s.bottom+"%",left:p-.2+"%",width:"var(--rm-split-size, 4px)"}:{left:`${s.left}%`,right:100-s.right+"%",top:p-.2+"%",height:"var(--rm-split-size, 4px)"}},onMouseDown:l,onTouchStart:h})},Kr=({root:e,renderTile:t,className:o,resize:i={minimumPaneSizePercentage:20}})=>{const{mosaicId:s}=n.useContext(fe),a=n.useMemo(()=>le(0,100,100,0),[]);return null===e?null:r.jsx("div",{className:o,style:{width:"100%",height:"100%",position:"relative"},children:r.jsx(Jr,{node:e,path:[],boundingBox:a,renderTile:t,resize:i,mosaicId:s})})},Jr=({node:e,path:t,boundingBox:i,renderTile:s,resize:a,mosaicId:c})=>{const{mosaicActions:u}=n.useContext(fe),d=n.useCallback(e=>{u.getRoot()&&u.updateTree([{path:t,spec:{splitPercentage:{$set:e}}}],!0)},[u,t]),l=n.useCallback(e=>{u.getRoot()&&u.updateTree([{path:t,spec:{splitPercentage:{$set:e}}}])},[u,t]);if(!o(e))return r.jsxs("div",{className:"rm-absolute rm-overflow-hidden",style:{top:`${i.top}%`,right:100-i.right+"%",bottom:100-i.bottom+"%",left:`${i.left}%`},children:[s(e,t),r.jsx(Yr,{position:exports.MosaicDropTargetPosition.TOP,path:t,mosaicId:c}),r.jsx(Yr,{position:exports.MosaicDropTargetPosition.BOTTOM,path:t,mosaicId:c}),r.jsx(Yr,{position:exports.MosaicDropTargetPosition.LEFT,path:t,mosaicId:c}),r.jsx(Yr,{position:exports.MosaicDropTargetPosition.RIGHT,path:t,mosaicId:c})]});const h=e.splitPercentage??50,[g,p]=pe(i,h,e.direction);return r.jsxs(r.Fragment,{children:[r.jsx(Jr,{node:e.first,path:[...t,"first"],boundingBox:g,renderTile:s,resize:a,mosaicId:c}),r.jsx(qr,{direction:e.direction,percentage:h,onChange:d,onRelease:l,boundingBox:i,...void 0!==a.minimumPaneSizePercentage&&{minimumPaneSizePercentage:a.minimumPaneSizePercentage}}),r.jsx(Jr,{node:e.second,path:[...t,"second"],boundingBox:p,renderTile:s,resize:a,mosaicId:c})]})},Qr=e=>"value"in e,Zr=({title:e,path:t,createNode:o,toolbarControls:i,additionalControls:s})=>{const{mosaicActions:a}=n.useContext(fe),{mosaicWindowActions:c}=n.useContext(me),[u,d]=n.useState(!1),l=c.connectDragSource(r.jsx("div",{className:"rm-mosaic-window-title rm-font-medium rm-text-sm rm-cursor-move",children:e}));return r.jsxs(r.Fragment,{children:[r.jsxs("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:[l,r.jsxs("div",{className:"rm-mosaic-window-controls rm-flex rm-gap-1 rm-items-center",children:[i,o&&r.jsxs(r.Fragment,{children:[r.jsx("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 c.replaceWithNew()}catch(e){console.error("Replace failed:",e)}},title:"Replace",children:"↻"}),r.jsx("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 c.split()}catch(e){console.error("Split failed:",e)}},title:"Split",children:"⊞"}),r.jsx("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:()=>{a.expand(t)},title:"Expand",children:"⛶"})]}),r.jsx("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:()=>{a.remove(t)},title:"Close",children:"✕"}),s&&r.jsx("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:()=>{d(!u)},title:"More",children:"⋯"})]})]}),u&&s&&r.jsx("div",{className:"rm-mosaic-additional-controls rm-bg-mosaic-toolbar rm-border-b rm-border-mosaic-border rm-px-4 rm-py-2",children:s})]})};exports.Mosaic=e=>{const{renderTile:t,onChange:o,onRelease:i,className:s="react-mosaic",zeroStateView:a,mosaicId:c="default-mosaic"}=e,[u,d]=n.useState(Qr(e)?e.value:e.initialValue),l=Qr(e)?e.value:u,h=n.useCallback(t=>{Qr(e)||d(t),o?.(t)},[o,e]),g=n.useCallback(e=>{i?.(e)},[i]),p=n.useMemo(()=>({expand:(e,t)=>{if(null===l)return;const r=ae(e,t),n=oe(l,[r]);h(n),g(n)},remove:e=>{if(null!==l)try{const t=se(l,e),r=oe(l,[t]);h(r),g(r)}catch(e){h(null),g(null)}},hide:e=>{if(null===l)return;const t=ce(e),r=oe(l,[t]);h(r)},replaceWith:(e,t)=>{if(null===l)return;const r=de(e,t),n=oe(l,[r]);h(n),g(n)},updateTree:(e,t=!1)=>{if(null===l)return;const r=oe(l,e);h(r),t||g(r)},getRoot:()=>l}),[l,h,g]),f=n.useMemo(()=>({mosaicActions:p,mosaicId:c}),[p,c]),m="undefined"!=typeof window&&("ontouchstart"in window||navigator.maxTouchPoints>0)?Gr:Lr;return r.jsx(Ht,{backend:m,children:r.jsx(fe.Provider,{value:f,children:r.jsx("div",{className:De(s,"rm-w-full rm-h-full rm-relative"),children:null===l?a??r.jsx("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"}):r.jsx(Kr,{root:l,renderTile:t,className:"rm-w-full rm-h-full"})})})})},exports.MosaicContext=fe,exports.MosaicDropTarget=Yr,exports.MosaicWindow=({title:e,path:t,children:o,createNode:i,draggable:a=!0,toolbarControls:c,additionalControls:u,renderToolbar:d,onDragStart:l,onDragEnd:h,className:g})=>{const{mosaicActions:p,mosaicId:f}=n.useContext(fe),m={...void 0!==l&&{onDragStart:l},...void 0!==h&&{onDragEnd:h}},{isDragging:v,drag:y}=((e,t,r)=>{const o=n.useRef(!1),[{isDragging:i},s,a]=ur({type:"MosaicWindow",item:{path:e,mosaicId:t},collect:e=>({isDragging:e.isDragging()})});return n.useEffect(()=>{i&&!o.current?r?.onDragStart?.():!i&&o.current&&r?.onDragEnd?.("drop"),o.current=i},[i,r]),{isDragging:i,drag:s,preview:a}})(t,f,Object.keys(m).length>0?m:void 0),b=n.useCallback(async()=>{if(!i)throw new Error("createNode is required for split operation");const e=await i(),r=p.getRoot();if(null===r)return;const n=s(r,t);n&&p.replaceWith(t,{direction:"row",first:n,second:e,splitPercentage:50})},[i,p,t]),T=n.useCallback(async()=>{if(!i)throw new Error("createNode is required for replace operation");const e=await i();p.replaceWith(t,e)},[i,p,t]),O=n.useCallback(()=>t,[t]),D=n.useCallback(e=>a?y(e):e,[a,y]),S=n.useMemo(()=>({split:b,replaceWithNew:T,getPath:O,connectDragSource:D}),[b,T,O,D]),w=n.useMemo(()=>({mosaicWindowActions:S}),[S]),E={title:e,path:t,...void 0!==i&&{createNode:i},...void 0!==c&&{toolbarControls:c},...void 0!==u&&{additionalControls:u}},I=r.jsx(Zr,{...E}),x=d?d(E,I):I;return r.jsx(me.Provider,{value:w,children:r.jsxs("div",{className:De("rm-mosaic-window","rm-flex rm-flex-col rm-h-full rm-bg-mosaic-window rm-rounded rm-shadow",{"rm-opacity-50":v},g),children:[x,r.jsx("div",{className:"rm-mosaic-window-body rm-flex-1 rm-overflow-auto rm-p-4",children:o})]})})},exports.MosaicWindowContext=me,exports.Split=qr,exports.containsPoint=(e,t,r)=>t>=e.left&&t<=e.right&&r>=e.top&&r<=e.bottom,exports.countNodes=l,exports.createBalancedTreeFromLeaves=c,exports.createBoundingBox=le,exports.createDragToUpdates=ue,exports.createExpandUpdate=ae,exports.createHideUpdate=ce,exports.createRemoveUpdate=se,exports.createReplaceUpdate=de,exports.createSplitUpdate=(e,t,r="row")=>({path:e,spec:{$set:{direction:r,first:t,second:t,splitPercentage:50}}}),exports.getAndAssertNodeAtPathExists=a,exports.getHeight=ge,exports.getLeaves=i,exports.getNodeAtPath=s,exports.getOtherBranch=d,exports.getOtherDirection=u,exports.getPathToCorner=(e,t)=>{const r=[];let n=e;for(;o(n);){const e=t===exports.Corner.TOP_LEFT||t===exports.Corner.TOP_RIGHT,o=t===exports.Corner.TOP_LEFT||t===exports.Corner.BOTTOM_LEFT,i="column"===n.direction&&e||"row"===n.direction&&o?"first":"second";r.push(i),n=n[i]}return r},exports.getTreeDepth=h,exports.getWidth=he,exports.isParent=o,exports.split=pe,exports.updateTree=oe;
|
|
6
|
+
*/var Oe,De=(be||(be=1,Oe=Te,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}Oe.exports?(t.default=t,Oe.exports=t):window.classNames=t}()),Te.exports),Se=ye(De);function we(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 Ee="function"==typeof Symbol&&Symbol.observable||"@@observable",Ie=function(){return Math.random().toString(36).substring(7).split("").join(".")},xe={INIT:"@@redux/INIT"+Ie(),REPLACE:"@@redux/REPLACE"+Ie()};function Ce(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 Pe(e){var t=typeof e;return"production"!==process.env.NODE_ENV&&(t=Ce(e)),t}function Ne(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?we(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?we(1):"Expected the enhancer to be a function. Instead, received: '"+Pe(r)+"'");return r(Ne)(e,t)}if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?we(2):"Expected the root reducer to be a function. Instead, received: '"+Pe(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?we(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?we(4):"Expected the listener to be a function. Instead, received: '"+Pe(e)+"'");if(c)throw new Error("production"===process.env.NODE_ENV?we(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?we(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?we(7):"Actions must be plain objects. Instead, the actual type was: '"+Pe(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?we(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?we(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:xe.INIT}),(n={dispatch:h,subscribe:l,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw new Error("production"===process.env.NODE_ENV?we(10):"Expected the nextReducer to be a function. Instead, received: '"+Pe(e));o=e,h({type:xe.REPLACE})}})[Ee]=function(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error("production"===process.env.NODE_ENV?we(11):"Expected the observer to be an object. Instead, received: '"+Pe(e)+"'");function r(){e.next&&e.next(d())}return r(),{unsubscribe:t(r)}}})[Ee]=function(){return this},e},n}function _e(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 Me(e){return"object"==typeof e}const Re="dnd-core/INIT_COORDS",je="dnd-core/BEGIN_DRAG",Le="dnd-core/PUBLISH_DRAG_SOURCE",ke="dnd-core/HOVER",Ae="dnd-core/DROP",He="dnd-core/END_DRAG";function Fe(e,t){return{type:Re,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const ze={type:Re,payload:{clientOffset:null,sourceClientOffset:null}};function Ue(e){return function(t=[],r={publishSource:!0}){const{publishSource:n=!0,clientOffset:o,getSourceClientOffset:i}=r,s=e.getMonitor(),a=e.getRegistry();e.dispatch(Fe(o)),function(e,t,r){_e(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){_e(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(ze);let u=null;if(o){if(!i)throw new Error("getSourceClientOffset must be defined");!function(e){_e("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(i),u=i(c)}e.dispatch(Fe(o,u));const d=a.getSource(c).beginDrag(s,c);if(null==d)return;!function(e){_e(Me(e),"Item must be an object.")}(d),a.pinSource(c);const l=a.getSourceType(c);return{type:je,payload:{itemType:l,item:d,sourceId:c,clientOffset:o||null,sourceClientOffset:u||null,isSourcePublic:!!n}}}}function Be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $e(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){Be(e,t,r[t])})}return e}function Ve(e){return function(t={}){const r=e.getMonitor(),n=e.getRegistry();!function(e){_e(e.isDragging(),"Cannot call drop while not dragging."),_e(!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){_e(void 0===e||Me(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:Ae,payload:{dropResult:$e({},t,s)}};e.dispatch(a)})}}function We(e){return function(){const t=e.getMonitor(),r=e.getRegistry();!function(e){_e(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:He}}}function Ge(e,t){return null===t?null===e:Array.isArray(e)?e.some(e=>e===t):e===t}function Ye(e){return function(t,{clientOffset:r}={}){!function(e){_e(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];Ge(t.getTargetType(o),r)||e.splice(n,1)}}(n,i,o.getItemType()),function(e,t,r){_e(t.isDragging(),"Cannot call hover while not dragging."),_e(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const n=e[t];_e(e.lastIndexOf(n)===t,"Expected targetIds to be unique in the passed array.");_e(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:ke,payload:{targetIds:n,clientOffset:r||null}}}}function Xe(e){return function(){if(e.getMonitor().isDragging())return{type:Le}}}class qe{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:Ue(e),publishDragSource:Xe(e),hover:Ye(e),drop:Ve(e),endDrag:We(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 Ke(e,t){return{x:e.x-t.x,y:e.y-t.y}}const Je=[],Qe=[];Je.__IS_NONE__=!0,Qe.__IS_ALL__=!0;class Ze{subscribeToStateChange(e,t={}){const{handlerIds:r}=t;_e("function"==typeof e,"listener must be a function."),_e(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!==Je&&(e===Qe||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){_e("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 _e(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(_e(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;return Ge(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(_e(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&&!Ge(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?Ke((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?Ke(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const et="undefined"!=typeof global?global:self,tt=et.MutationObserver||et.WebKitMutationObserver;function rt(e){return function(){const t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}const nt="function"==typeof tt?function(e){let t=1;const r=new tt(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}:rt;class ot{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 it=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=nt(this.flush),this.requestErrorThrow=rt(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},st=new class{create(e){const t=this.freeTasks,r=t.length?t.pop():new ot(this.onError,e=>t[t.length]=e);return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(it.registerPendingError);const at="dnd-core/ADD_SOURCE",ct="dnd-core/ADD_TARGET",ut="dnd-core/REMOVE_SOURCE",dt="dnd-core/REMOVE_TARGET";function lt(e,t){t&&Array.isArray(e)?e.forEach(e=>lt(e,!1)):_e("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 ht;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(ht||(ht={}));let gt=0;function pt(e){const t=(gt++).toString();switch(e){case ht.SOURCE:return`S${t}`;case ht.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function ft(e){switch(e[0]){case"S":return ht.SOURCE;case"T":return ht.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function mt(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 vt{addSource(e,t){lt(e),function(e){_e("function"==typeof e.canDrag,"Expected canDrag to be a function."),_e("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),_e("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const r=this.addHandler(ht.SOURCE,e,t);return this.store.dispatch(function(e){return{type:at,payload:{sourceId:e}}}(r)),r}addTarget(e,t){lt(e,!0),function(e){_e("function"==typeof e.canDrop,"Expected canDrop to be a function."),_e("function"==typeof e.hover,"Expected hover to be a function."),_e("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const r=this.addHandler(ht.TARGET,e,t);return this.store.dispatch(function(e){return{type:ct,payload:{targetId:e}}}(r)),r}containsHandler(e){return mt(this.dragSources,e)||mt(this.dropTargets,e)}getSource(e,t=!1){_e(this.isSourceId(e),"Expected a valid source ID.");return t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return _e(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return _e(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return _e(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return ft(e)===ht.SOURCE}isTargetId(e){return ft(e)===ht.TARGET}removeSource(e){var t;_e(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:ut,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},it.enqueueTask(st.create(t))}removeTarget(e){_e(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:dt,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);_e(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){_e(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){const n=pt(e);return this.types.set(n,t),e===ht.SOURCE?this.dragSources.set(n,r):e===ht.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 yt=(e,t)=>e===t;function bt(e=Je,t){switch(t.type){case ke:break;case at:case ct:case dt:case ut:return Je;default:return Qe}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=yt){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 Je;const i=n[n.length-1],s=r[r.length-1];return i!==s&&(i&&o.push(i),s&&o.push(s)),o}function Tt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ot={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function Dt(e=Ot,t){const{payload:r}=t;switch(t.type){case Re:case je:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case ke: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){Tt(e,t,r[t])})}return e}({},e,{clientOffset:r.clientOffset});case He:case Ae:return Ot;default:return e}var n,o}function St(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){St(e,t,r[t])})}return e}const Et={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function It(e=Et,t){const{payload:r}=t;switch(t.type){case je:return wt({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case Le:return wt({},e,{isSourcePublic:!0});case ke:return wt({},e,{targetIds:r.targetIds});case dt:return-1===e.targetIds.indexOf(r.targetId)?e:wt({},e,{targetIds:(n=e.targetIds,o=r.targetId,n.filter(e=>e!==o))});case Ae:return wt({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case He:return wt({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var n,o}function xt(e=0,t){switch(t.type){case at:case ct:return e+1;case ut:case dt:return e-1;default:return e}}function Ct(e=0){return e+1}function Pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nt(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){Pt(e,t,r[t])})}return e}function _t(e={},t){return{dirtyHandlerIds:bt(e.dirtyHandlerIds,{type:t.type,payload:Nt({},t.payload,{prevTargetIds:(r=e,n="dragOperation.targetIds",o=[],n.split(".").reduce((e,t)=>e&&e[t]?e[t]:o||null,r))})}),dragOffset:Dt(e.dragOffset,t),refCount:xt(e.refCount,t),dragOperation:It(e.dragOperation,t),stateId:Ct(e.stateId)};var r,n,o}function Mt(e,t=void 0,r={},n=!1){const o=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return Ne(_t,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(n),i=new Ze(o,new vt(o)),s=new qe(o,i),a=e(s,t,r);return s.receiveBackend(a),s}const Rt=n.createContext({dragDropManager:void 0});var jt,Lt;var kt=(Lt||(Lt=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),At=ye(kt);const Ht="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Ft(e,t,r){const[o,i]=function(e,t,r){const[o,i]=n.useState(()=>t(e)),s=n.useCallback(()=>{const n=t(e);At(o,n)||(i(n),r&&r())},[o,e,r]);return Ht(s),[o,s]}(e,t,r);return Ht(function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(i,{handlerIds:[t]})},[e,i]),o}function zt(e,t,r){return Ft(t,e||(()=>({})),()=>r.reconnect())}function Ut(e,t){const r=[...t||[]];return null==t&&"function"!=typeof e&&r.push(e),n.useMemo(()=>"function"==typeof e?e():e,r)}function Bt(e){return n.useMemo(()=>e.hooks.dragSource(),[e])}function $t(e){return n.useMemo(()=>e.hooks.dragPreview(),[e])}let Vt=!1,Wt=!1;class Gt{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){_e(!Vt,"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 Vt=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Vt=!1}}isDragging(){if(!this.sourceId)return!1;_e(!Wt,"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 Wt=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Wt=!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 Yt=!1;class Xt{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;_e(!Yt,"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 Yt=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Yt=!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 qt(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 Kt(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function Jt(e){return(t=null,r=null)=>{if(!n.isValidElement(t)){const n=t;return e(n,r),n}const o=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.`)}(o);return function(e,t){const r=e.ref;return _e("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"),r?n.cloneElement(e,{ref:e=>{Zt(r,e),Zt(t,e)}}):n.cloneElement(e,{ref:t})}(o,r?t=>e(t,r):e)}}function Qt(e){const t={};return Object.keys(e).forEach(r=>{const n=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{const e=Jt(n);t[r]=()=>e}}),t}function Zt(e,t){"function"==typeof e?e(t):e.current=t}class er{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!qt(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!qt(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=Qt({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,Kt(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,Kt(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 tr{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!qt(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=Qt({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,Kt(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 rr(){const{dragDropManager:e}=n.useContext(Rt);return _e(null!=e,"Expected drag drop context"),e}class nr{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 or(e,t,r){const o=rr(),i=function(e,t,r){const o=n.useMemo(()=>new nr(e,t,r),[t,r]);return n.useEffect(()=>{o.spec=e},[e]),o}(e,t,r),s=function(e){return n.useMemo(()=>{const t=e.type;return _e(null!=t,"spec.type must be defined"),t},[e])}(e);Ht(function(){if(null!=s){const[e,n]=function(e,t,r){const n=r.getRegistry(),o=n.addSource(e,t);return[o,()=>n.removeSource(o)]}(s,i,o);return t.receiveHandlerId(e),r.receiveHandlerId(e),n}},[o,t,r,i,s])}function ir(e,t){const r=Ut(e,t);_e(!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 o=function(){const e=rr();return n.useMemo(()=>new Gt(e),[e])}(),i=function(e,t){const r=rr(),o=n.useMemo(()=>new er(r.getBackend()),[r]);return Ht(()=>(o.dragSourceOptions=e||null,o.reconnect(),()=>o.disconnectDragSource()),[o,e]),Ht(()=>(o.dragPreviewOptions=t||null,o.reconnect(),()=>o.disconnectDragPreview()),[o,t]),o}(r.options,r.previewOptions);return or(r,o,i),[zt(r.collect,o,i),Bt(i),$t(i)]}function sr(e){return n.useMemo(()=>e.hooks.dropTarget(),[e])}class ar{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 cr(e,t,r){const o=rr(),i=function(e,t){const r=n.useMemo(()=>new ar(e,t),[t]);return n.useEffect(()=>{r.spec=e},[e]),r}(e,t),s=function(e){const{accept:t}=e;return n.useMemo(()=>(_e(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(e);Ht(function(){const[e,n]=function(e,t,r){const n=r.getRegistry(),o=n.addTarget(e,t);return[o,()=>n.removeTarget(o)]}(s,i,o);return t.receiveHandlerId(e),r.receiveHandlerId(e),n},[o,t,i,r,s.map(e=>e.toString()).join("|")])}function ur(e,t){const r=Ut(e,t),o=function(){const e=rr();return n.useMemo(()=>new Xt(e),[e])}(),i=function(e){const t=rr(),r=n.useMemo(()=>new tr(t.getBackend()),[t]);return Ht(()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget()),[e]),r}(r.options);return cr(r,o,i),[zt(r.collect,o,i),sr(i)]}function dr(e){let t=null;return()=>(null==t&&(t=e()),t)}class lr{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 hr{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 gr="__NATIVE_FILE__",pr="__NATIVE_URL__",fr="__NATIVE_TEXT__",mr="__NATIVE_HTML__";var vr=Object.freeze({__proto__:null,FILE:gr,HTML:mr,TEXT:fr,URL:pr});function yr(e,t,r){const n=t.reduce((t,r)=>t||e.getData(r),"");return null!=n?n:r}const br={[gr]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[mr]:{exposeProperties:{html:(e,t)=>yr(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[pr]:{exposeProperties:{urls:(e,t)=>yr(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[fr]:{exposeProperties:{text:(e,t)=>yr(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function Tr(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(br).filter(e=>{const r=br[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some(e=>t.indexOf(e)>-1)})[0]||null}const Or=dr(()=>/firefox/i.test(navigator.userAgent)),Dr=dr(()=>Boolean(window.safari));class Sr{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 wr(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 Er(e){return{x:e.clientX,y:e.clientY}}function Ir(e,t,r,n,o){const i="IMG"===(s=t).nodeName&&(Or()||!(null===(a=document.documentElement)||void 0===a?void 0:a.contains(s)));var s,a;const c=wr(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:p,dragPreviewHeight:f}=function(e,t,r,n){let o=e?t.width:r,i=e?t.height:n;return Dr()&&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 Sr([0,.5,1],[u.x,u.x/d*p,u.x+p-d]).interpolate(h),y:y?v:(()=>{let e=new Sr([0,.5,1],[u.y,u.y/l*f,u.y+f-l]).interpolate(g);return Dr()&&i&&(e+=(window.devicePixelRatio-1)*f),e})()}}let xr=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 Cr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Pr(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){Cr(e,t,r[t])})}return e}class Nr{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 Pr({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return Pr({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(vr).some(t=>vr[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const r=br[e];if(!r)throw new Error(`native type ${e} has no configuration`);const n=new hr(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&&wr(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=Er(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=Tr(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=Ir(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=Tr(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:Er(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=Er(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)):Tr(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:Er(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 xr(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new lr(this.isNodeInDocument)}}const _r=function(e,t,r){return new Nr(e,t,r)};var Mr;!function(e){e.mouse="mouse",e.touch="touch",e.keyboard="keyboard"}(Mr||(Mr={}));class Rr{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 jr=1,Lr=0;function kr(e){return void 0===e.button||e.button===Lr}function Ar(e){return!!e.targetTouches}function Hr(e,t){return Ar(e)?function(e,t){return 1===e.targetTouches.length?Hr(e.targetTouches[0]):t&&1===e.touches.length&&e.touches[0].target===t.target?Hr(e.touches[0]):void 0}(e,t):{x:e.clientX,y:e.clientY}}const Fr=(()=>{let e=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get:()=>(e=!0,!0)}))}catch(e){}return e})(),zr={[Mr.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[Mr.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[Mr.keyboard]:{keydown:"keydown"}};class Ur{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&&(_e(!Ur.isSetUp,"Cannot have two Touch backends at the same time."),Ur.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&&(Ur.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=Fr?{capture:n,passive:!1}:n;this.listenerTypes.forEach(function(n){const i=zr[n][t];i&&e.addEventListener(i,r,o)})}removeEventListener(e,t,r,n=!1){const o=Fr?{capture:n,passive:!1}:n;this.listenerTypes.forEach(function(n){const i=zr[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 zr.mouse.move:o={x:n.clientX,y:n.clientY};break;case zr.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=>{kr(e)&&(this.moveStartSourceIds=[])},this.handleMoveStart=e=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(e)},this.handleTopMoveStart=e=>{if(!kr(e))return;const t=Hr(e);t&&(Ar(e)&&(this.lastTargetTouchFallback=e.targetTouches[0]),this._mouseClientOffset=t),this.waitingForDelay=!1},this.handleTopMoveStartDelay=e=>{if(!kr(e))return;const t=e.type===zr.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=Hr(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&jr)}(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 Rr(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(Mr.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(Mr.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(Mr.keyboard)}}const Br=function(e,t={},r={}){return new Ur(e,t,r)},$r=n.memo(({position:e,path:t,mosaicId:o})=>{const{mosaicActions:i}=n.useContext(me),[{isOver:s},a]=ur(()=>({accept:"MosaicWindow",canDrop:e=>e.mosaicId===o,drop:r=>{const n=i.getRoot();if(!n)return;const o=de(n,r.path,t,e);i.updateTree(o)},collect:e=>({isOver:e.isOver()&&e.canDrop()})}),[o,i,t,e]);return r.jsx("div",{ref:a,onDragOver:e=>e.preventDefault(),onDrop:e=>e.preventDefault(),className:"rm-mosaic-drop-target rm-absolute",style:{...Vr(e,s),opacity:s?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"}})}),Vr=(e,t)=>{const r=t?"50%":"25%",n={zIndex:1e3};switch(e){case exports.MosaicDropTargetPosition.TOP:return{...n,top:0,left:0,right:0,height:r};case exports.MosaicDropTargetPosition.BOTTOM:return{...n,bottom:0,left:0,right:0,height:r};case exports.MosaicDropTargetPosition.LEFT:return{...n,top:0,bottom:0,left:0,width:r};case exports.MosaicDropTargetPosition.RIGHT:return{...n,top:0,bottom:0,right:0,width:r}}},Wr=()=>{const{mosaicId:e}=n.useContext(me);return r.jsxs("div",{className:"rm-root-drop-targets rm-absolute",style:{inset:0,zIndex:990,pointerEvents:"none"},children:[r.jsx($r,{position:exports.MosaicDropTargetPosition.TOP,path:[],mosaicId:e}),r.jsx($r,{position:exports.MosaicDropTargetPosition.BOTTOM,path:[],mosaicId:e}),r.jsx($r,{position:exports.MosaicDropTargetPosition.LEFT,path:[],mosaicId:e}),r.jsx($r,{position:exports.MosaicDropTargetPosition.RIGHT,path:[],mosaicId:e})]})},Gr=({direction:e,percentage:t,onChange:o,onRelease:i,boundingBox:s,minimumPaneSizePercentage:a=20})=>{const[c,u]=n.useState(!1),d=n.useRef(null),l=n.useCallback(r=>{r.preventDefault(),u(!0);const n=r.clientX,c=r.clientY,l=t,h=d.current?.parentElement;if(!h)return;const g=h.getBoundingClientRect(),p=s.right-s.left,f=s.bottom-s.top;let m=l;const v=t=>{let r;if("row"===e){const e=t.clientX-n,o=g.width*p/100;r=l+e/o*100}else{const e=t.clientY-c,n=g.height*f/100;r=l+e/n*100}r=Math.max(a,Math.min(100-a,r)),m=r,o(r)},y=()=>{u(!1),i?.(m),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",y)};document.addEventListener("mousemove",v),document.addEventListener("mouseup",y)},[e,t,o,i,a,s]),h=n.useCallback(r=>{if(1!==r.touches.length)return;const n=r.touches[0];u(!0);const c=n.clientX,l=n.clientY,h=t,g=d.current?.parentElement;if(!g)return;const p=g.getBoundingClientRect(),f=s.right-s.left,m=s.bottom-s.top;let v=h;const y=t=>{if(1!==t.touches.length)return;const r=t.touches[0];let n;if("row"===e){const e=r.clientX-c,t=p.width*f/100;n=h+e/t*100}else{const e=r.clientY-l,t=p.height*m/100;n=h+e/t*100}n=Math.max(a,Math.min(100-a,n)),v=n,o(n)},b=()=>{u(!1),i?.(v),document.removeEventListener("touchmove",y),document.removeEventListener("touchend",b)};document.addEventListener("touchmove",y),document.addEventListener("touchend",b)},[e,t,o,i,a,s]),g="row"===e,p=g?s.left+(s.right-s.left)*t/100:s.top+(s.bottom-s.top)*t/100;return r.jsx("div",{ref:d,className:Se("rm-mosaic-split","rm-absolute rm-bg-mosaic-split rm-transition-colors",{"rm-cursor-col-resize":g,"rm-cursor-row-resize":!g,"rm-bg-mosaic-split-hover":c}),style:{...g?{top:`${s.top}%`,bottom:100-s.bottom+"%",left:p-.2+"%",width:"var(--rm-split-size, 4px)"}:{left:`${s.left}%`,right:100-s.right+"%",top:p-.2+"%",height:"var(--rm-split-size, 4px)"}},onMouseDown:l,onTouchStart:h})},Yr=({root:e,renderTile:t,className:o,resize:i={minimumPaneSizePercentage:20}})=>{const{mosaicId:s}=n.useContext(me),a=n.useMemo(()=>he(0,100,100,0),[]);return null===e?null:r.jsxs("div",{className:o,style:{width:"100%",height:"100%",position:"relative"},children:[r.jsx(Xr,{node:e,path:[],boundingBox:a,renderTile:t,resize:i,mosaicId:s}),r.jsx(Wr,{})]})},Xr=({node:e,path:t,boundingBox:i,renderTile:s,resize:a,mosaicId:c})=>{const{mosaicActions:u}=n.useContext(me),d=n.useCallback(e=>{u.getRoot()&&u.updateTree([{path:t,spec:{splitPercentage:{$set:e}}}],!0)},[u,t]),l=n.useCallback(e=>{u.getRoot()&&u.updateTree([{path:t,spec:{splitPercentage:{$set:e}}}])},[u,t]);if(!o(e))return r.jsxs("div",{className:"rm-absolute rm-overflow-hidden",style:{top:`${i.top}%`,right:100-i.right+"%",bottom:100-i.bottom+"%",left:`${i.left}%`},children:[s(e,t),r.jsx($r,{position:exports.MosaicDropTargetPosition.TOP,path:t,mosaicId:c}),r.jsx($r,{position:exports.MosaicDropTargetPosition.BOTTOM,path:t,mosaicId:c}),r.jsx($r,{position:exports.MosaicDropTargetPosition.LEFT,path:t,mosaicId:c}),r.jsx($r,{position:exports.MosaicDropTargetPosition.RIGHT,path:t,mosaicId:c})]});const h=e.splitPercentage??50,[g,p]=fe(i,h,e.direction);return r.jsxs(r.Fragment,{children:[r.jsx(Xr,{node:e.first,path:[...t,"first"],boundingBox:g,renderTile:s,resize:a,mosaicId:c}),r.jsx(Gr,{direction:e.direction,percentage:h,onChange:d,onRelease:l,boundingBox:i,...void 0!==a.minimumPaneSizePercentage&&{minimumPaneSizePercentage:a.minimumPaneSizePercentage}}),r.jsx(Xr,{node:e.second,path:[...t,"second"],boundingBox:p,renderTile:s,resize:a,mosaicId:c})]})},qr=n.memo(({title:e,path:t,children:o,createNode:i,toolbarControls:a,additionalControls:c,renderToolbar:u,onDragStart:d,onDragEnd:l,className:h})=>{const{mosaicActions:g}=n.useContext(me),p=n.useRef(t);p.current=t;const f=n.useRef(i);f.current=i;const m=n.useMemo(()=>({split:async()=>{const e=f.current;if(!e)throw new Error("createNode is required for split operation");const t=await e(),r=g.getRoot();if(null===r)return;const n=p.current,o=s(r,n);o&&g.replaceWith(n,{direction:"row",first:o,second:t,splitPercentage:50})},replaceWithNew:async()=>{const e=f.current;if(!e)throw new Error("createNode is required for replace operation");const t=await e();g.replaceWith(p.current,t)},getPath:()=>p.current}),[g]),v=n.useMemo(()=>({mosaicWindowActions:m}),[m]),y={title:e,path:t,...void 0!==i&&{createNode:i},...void 0!==a&&{toolbarControls:a},...void 0!==c&&{additionalControls:c}},b=r.jsx(Kr,{...y,...void 0!==d&&{onDragStart:d},...void 0!==l&&{onDragEnd:l}}),T=u?u(y,b):b;return r.jsx(ve.Provider,{value:v,children:r.jsxs("div",{className:Se("rm-mosaic-window","rm-flex rm-flex-col rm-h-full rm-bg-mosaic-window rm-rounded rm-shadow",h),children:[T,r.jsx("div",{className:"rm-mosaic-window-body rm-flex-1 rm-overflow-auto rm-p-4",children:o})]})})},(e,t)=>{if(!g(e.path,t.path))return!1;const r=new Set(["path","onDragStart","onDragEnd"]),n=new Set([...Object.keys(e),...Object.keys(t)]);for(const o of n)if(!r.has(o)&&e[o]!==t[o])return!1;return!0}),Kr=n.memo(({title:e,path:t,createNode:o,toolbarControls:i,additionalControls:s,onDragStart:a,onDragEnd:c})=>{const{mosaicActions:u,mosaicId:d}=n.useContext(me),{mosaicWindowActions:l}=n.useContext(ve),[h,g]=n.useState(!1),p=n.useRef(t);p.current=t;const f=n.useRef(a);f.current=a;const m=n.useRef(c);m.current=c;const[,v]=ir(()=>({type:"MosaicWindow",item:()=>(f.current&&setTimeout(f.current,0),{path:p.current,mosaicId:d}),end:(e,t)=>{t.didDrop()?m.current?.("drop"):m.current?.("reset")}}),[d]);return r.jsxs(r.Fragment,{children:[r.jsxs("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:[r.jsx("div",{ref:v,className:"rm-mosaic-window-title rm-font-medium rm-text-sm rm-cursor-move",children:e}),r.jsxs("div",{className:"rm-mosaic-window-controls rm-flex rm-gap-1 rm-items-center",children:[i,o&&r.jsxs(r.Fragment,{children:[r.jsx("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 l.replaceWithNew()}catch(e){console.error("Replace failed:",e)}},title:"Replace",children:"↻"}),r.jsx("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 l.split()}catch(e){console.error("Split failed:",e)}},title:"Split",children:"⊞"}),r.jsx("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(t)},title:"Expand",children:"⛶"})]}),r.jsx("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(t)},title:"Close",children:"✕"}),s&&r.jsx("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(!h)},title:"More",children:"⋯"})]})]}),h&&s&&r.jsx("div",{className:"rm-mosaic-additional-controls rm-bg-mosaic-toolbar rm-border-b rm-border-mosaic-border rm-px-4 rm-py-2",children:s})]})},(e,t)=>{if(!g(e.path,t.path))return!1;const r=new Set(["path","onDragStart","onDragEnd"]),n=new Set([...Object.keys(e),...Object.keys(t)]);for(const o of n)if(!r.has(o)&&e[o]!==t[o])return!1;return!0});exports.Mosaic=e=>{const{renderTile:t,onChange:o,onRelease:i,className:s="react-mosaic",zeroStateView:a,mosaicId:c="default-mosaic"}=e,u=(e=>"value"in e)(e),d=n.useRef(u);d.current=u;const[l,h]=n.useState(u?e.value:e.initialValue),g=u?e.value:l,p=n.useRef(o);p.current=o;const f=n.useRef(i);f.current=i;const m=n.useRef(g);m.current=g;const v=n.useMemo(()=>({expand:(e,t)=>{const r=m.current;if(null===r)return;const n=ce(e,t),o=ie(r,[n]);d.current||h(o),p.current?.(o),f.current?.(o)},remove:e=>{const t=m.current;if(null!==t)try{const r=ae(t,e),n=ie(t,[r]);d.current||h(n),p.current?.(n),f.current?.(n)}catch(e){d.current||h(null),p.current?.(null),f.current?.(null)}},hide:e=>{const t=m.current;if(null===t)return;const r=ue(e),n=ie(t,[r]);d.current||h(n),p.current?.(n)},replaceWith:(e,t)=>{const r=m.current;if(null===r)return;const n=le(e,t),o=ie(r,[n]);d.current||h(o),p.current?.(o),f.current?.(o)},updateTree:(e,t=!1)=>{const r=m.current;if(null===r)return;const n=ie(r,e);d.current||h(n),p.current?.(n),t||f.current?.(n)},getRoot:()=>m.current}),[]),y=n.useMemo(()=>({mosaicActions:v,mosaicId:c}),[v,c]),b=n.useRef(null);b.current||(b.current=Mt("undefined"==typeof window?_r:"ontouchstart"in window&&window.matchMedia("(pointer: coarse)").matches&&!window.matchMedia("(pointer: fine)").matches?Br:_r));const T=n.useMemo(()=>({dragDropManager:b.current}),[]),O=n.useRef(null);return n.useEffect(()=>{const e=b.current.getMonitor();return e.subscribeToStateChange(()=>{const t=e.isDragging();setTimeout(()=>{O.current?.classList.toggle("rm-dragging",t)},0)})},[]),r.jsx(Rt.Provider,{value:T,children:r.jsx(me.Provider,{value:y,children:r.jsx("div",{ref:O,className:Se(s,"rm-w-full rm-h-full rm-relative"),onDragOver:e=>e.preventDefault(),onDrop:e=>e.preventDefault(),children:null===g?a??r.jsx("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"}):r.jsx(Yr,{root:g,renderTile:t,className:"rm-w-full rm-h-full"})})})})},exports.MosaicContext=me,exports.MosaicDropTarget=$r,exports.MosaicWindow=qr,exports.MosaicWindowContext=ve,exports.Split=Gr,exports.containsPoint=(e,t,r)=>t>=e.left&&t<=e.right&&r>=e.top&&r<=e.bottom,exports.countNodes=l,exports.createBalancedTreeFromLeaves=c,exports.createBoundingBox=he,exports.createDragToUpdates=de,exports.createExpandUpdate=ce,exports.createHideUpdate=ue,exports.createRemoveUpdate=ae,exports.createReplaceUpdate=le,exports.createSplitUpdate=(e,t,r="row")=>({path:e,spec:{$set:{direction:r,first:t,second:t,splitPercentage:50}}}),exports.getAndAssertNodeAtPathExists=a,exports.getHeight=pe,exports.getLeaves=i,exports.getNodeAtPath=s,exports.getOtherBranch=d,exports.getOtherDirection=u,exports.getPathToCorner=(e,t)=>{const r=[];let n=e;for(;o(n);){const e=t===exports.Corner.TOP_LEFT||t===exports.Corner.TOP_RIGHT,o=t===exports.Corner.TOP_LEFT||t===exports.Corner.BOTTOM_LEFT,i="column"===n.direction&&e||"row"===n.direction&&o?"first":"second";r.push(i),n=n[i]}return r},exports.getTreeDepth=h,exports.getWidth=ge,exports.isParent=o,exports.split=fe,exports.updateTree=ie;
|
|
7
7
|
//# sourceMappingURL=index.cjs.map
|