0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00
penpot/frontend/vendor/react-dnd/react-dnd.bundle.min.js
2019-08-08 16:27:26 +02:00

1 line
No EOL
58 KiB
JavaScript

!function(e){"use strict";var t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};t.setTimeout,t.clearTimeout;var r,n=t.performance||{},i=(n.now||n.mozNow||n.msNow||n.oNow||n.webkitNow,function(e,t,r,n,i,o,a,u){if(void 0===t)throw new Error("invariant requires an error message argument");if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[r,n,i,o,a,u],l=0;(c=new Error(t.replace(/%s/g,function(){return s[l++]}))).name="Invariant Violation"}throw c.framesToPop=1,c}}),o="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,a=function(e,t,r,n){var i=r?r.call(n,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var o=Object.keys(e),a=Object.keys(t);if(o.length!==a.length)return!1;for(var u=Object.prototype.hasOwnProperty.bind(t),c=0;c<o.length;c++){var s=o[c];if(!u(s))return!1;var l=e[s],f=t[s];if(!1===(i=r?r.call(n,l,f,s):void 0)||void 0===i&&l!==f)return!1}return!0};function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function s(t,r,n){var i=c(function(t,r,n){var i=u(e.useState(function(){return r(t)}),2),c=i[0],s=i[1],l=e.useCallback(function(){var e=r(t);a(c,e)||(s(e),n&&n())},[c,t,n]);return o(l,[]),[c,l]}(t,r,n),2),s=i[0],l=i[1];return o(function(){var e=t.getHandlerId();if(null!=e)return t.subscribeToStateChange(l,{handlerIds:[e]})},[t,l]),s}!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(r||(r={}));var l=function(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof module?module:Function("return this")()),f=function(){return Math.random().toString(36).substring(7).split("").join(".")},d={INIT:"@@redux/INIT"+f(),REPLACE:"@@redux/REPLACE"+f(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+f()}};function g(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(g)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var i=e,o=t,a=[],u=a,c=!1;function s(){u===a&&(u=a.slice())}function f(){if(c)throw new Error("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 o}function h(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)throw new Error("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-reference/store#subscribe(listener) for more details.");var t=!0;return s(),u.push(e),function(){if(t){if(c)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,s();var r=u.indexOf(e);u.splice(r,1)}}}function p(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("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,o=i(o,e)}finally{c=!1}for(var t=a=u,r=0;r<t.length;r++){(0,t[r])()}return e}return p({type:d.INIT}),(n={dispatch:p,subscribe:h,getState:f,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");i=e,p({type:d.REPLACE})}})[l]=function(){var e,t=h;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function r(){e.next&&e.next(f())}return r(),{unsubscribe:t(r)}}})[l]=function(){return this},e},n}function h(){}"string"==typeof h.name&&"isCrushed"!==h.name&&function(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}('You are currently using minified code outside of NODE_ENV === "production". This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) to ensure you have the correct code for your production build.');var p="dnd-core/INIT_COORDS",v="dnd-core/BEGIN_DRAG",y="dnd-core/PUBLISH_DRAG_SOURCE",b="dnd-core/HOVER",m="dnd-core/DROP",w="dnd-core/END_DRAG";function O(e,t){return{type:p,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}function D(e){return(D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e){return"object"===D(e)}var T={type:p,payload:{clientOffset:null,sourceClientOffset:null}};function I(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{publishSource:!0},n=r.publishSource,i=void 0===n||n,o=r.clientOffset,a=r.getSourceClientOffset,u=e.getMonitor(),c=e.getRegistry();e.dispatch(O(o)),E(t,u,c);var s=P(t,u);if(null!==s){var l=null;o&&(k(a),l=a(s)),e.dispatch(O(o,l));var f=c.getSource(s),d=f.beginDrag(u,s);C(d),c.pinSource(s);var g=c.getSourceType(s);return{type:v,payload:{itemType:g,item:d,sourceId:s,clientOffset:o||null,sourceClientOffset:l||null,isSourcePublic:!!i}}}e.dispatch(T)}}function E(e,t,r){i(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){i(r.getSource(e),"Expected sourceIds to be registered.")})}function k(e){i("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}function C(e){i(S(e),"Item must be an object.")}function P(e,t){for(var r=null,n=e.length-1;n>=0;n--)if(t.canDragSource(e[n])){r=e[n];break}return r}function N(e){return function(){if(e.getMonitor().isDragging())return{type:y}}}function R(e,t){return null===t?null===e:Array.isArray(e)?e.some(function(e){return e===t}):e===t}function x(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.clientOffset;j(t);var i=t.slice(0),o=e.getMonitor(),a=e.getRegistry();M(i,o,a);var u=o.getItemType();return A(i,a,u),L(i,o,a),{type:b,payload:{targetIds:i,clientOffset:n||null}}}}function j(e){i(Array.isArray(e),"Expected targetIds to be an array.")}function M(e,t,r){i(t.isDragging(),"Cannot call hover while not dragging."),i(!t.didDrop(),"Cannot call hover after drop.");for(var n=0;n<e.length;n++){var o=e[n];i(e.lastIndexOf(o)===n,"Expected targetIds to be unique in the passed array.");var a=r.getTarget(o);i(a,"Expected targetIds to be registered.")}}function A(e,t,r){for(var n=e.length-1;n>=0;n--){var i=e[n];R(t.getTargetType(i),r)||e.splice(n,1)}}function L(e,t,r){e.forEach(function(e){r.getTarget(e).hover(t,e)})}function _(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function H(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(r,!0).forEach(function(t){U(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function U(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.getMonitor(),n=e.getRegistry();B(r);var i=G(r);i.forEach(function(i,o){var a=Y(i,o,n,r),u={type:m,payload:{dropResult:H({},t,{},a)}};e.dispatch(u)})}}function B(e){i(e.isDragging(),"Cannot call drop while not dragging."),i(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function Y(e,t,r,n){var o=r.getTarget(e),a=o?o.drop(n,e):void 0;return function(e){i(void 0===e||S(e),"Drop result must either be an object or undefined.")}(a),void 0===a&&(a=0===t?{}:n.getDropResult()),a}function G(e){var t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function X(e){return function(){var t=e.getMonitor(),r=e.getRegistry();!function(e){i(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);var n=t.getSourceId();return r.getSource(n,!0).endDrag(t,n),r.unpinSource(),{type:w}}}var W=function(e,t){return e===t};function V(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function K(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var q={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function z(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q,n=arguments.length>1?arguments[1]:void 0,i=n.payload;switch(n.type){case p:case v:return{initialSourceClientOffset:i.sourceClientOffset,initialClientOffset:i.clientOffset,clientOffset:i.clientOffset};case b:return e=r.clientOffset,t=i.clientOffset,!e&&!t||e&&t&&e.x===t.x&&e.y===t.y?r:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(r,!0).forEach(function(t){K(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},r,{clientOffset:i.clientOffset});case w:case m:return q;default:return r}}var J="dnd-core/ADD_SOURCE",Q="dnd-core/ADD_TARGET",Z="dnd-core/REMOVE_SOURCE",$="dnd-core/REMOVE_TARGET";function ee(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function te(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ee(r,!0).forEach(function(t){re(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ee(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ne={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function ie(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ne,n=arguments.length>1?arguments[1]:void 0,i=n.payload;switch(n.type){case v:return te({},r,{itemType:i.itemType,item:i.item,sourceId:i.sourceId,isSourcePublic:i.isSourcePublic,dropResult:null,didDrop:!1});case y:return te({},r,{isSourcePublic:!0});case b:return te({},r,{targetIds:i.targetIds});case $:return-1===r.targetIds.indexOf(i.targetId)?r:te({},r,{targetIds:(e=r.targetIds,t=i.targetId,e.filter(function(e){return e!==t}))});case m:return te({},r,{dropResult:i.dropResult,didDrop:!0,targetIds:[]});case w:return te({},r,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return r}}function oe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;switch((arguments.length>1?arguments[1]:void 0).type){case J:case Q:return e+1;case Z:case $:return e-1;default:return e}}var ae=[],ue=[];function ce(e,t){return e!==ae&&(e===ue||void 0===t||(r=e,t.filter(function(e){return r.indexOf(e)>-1})).length>0);var r}function se(){var e=arguments.length>1?arguments[1]:void 0;switch(e.type){case b:break;case J:case Q:case $:case Z:return ae;case v:case y:case w:case m:default:return ue}var t=e.payload,r=t.targetIds,n=void 0===r?[]:r,i=t.prevTargetIds,o=void 0===i?[]:i,a=function(e,t){var r=new Map,n=function(e){return r.set(e,r.has(e)?r.get(e)+1:1)};e.forEach(n),t.forEach(n);var i=[];return r.forEach(function(e,t){1===e&&i.push(t)}),i}(n,o);if(!(a.length>0||!function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:W;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(!r(e[n],t[n]))return!1;return!0}(n,o)))return ae;var u=o[o.length-1],c=n[n.length-1];return u!==c&&(u&&a.push(u),c&&a.push(c)),a}function le(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)+1}function fe(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function de(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fe(r,!0).forEach(function(t){ge(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fe(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ge(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function he(){var e,t,r,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;return{dirtyHandlerIds:se(n.dirtyHandlerIds,{type:i.type,payload:de({},i.payload,{prevTargetIds:(e=n,t="dragOperation.targetIds",r=[],t.split(".").reduce(function(e,t){return e&&e[t]?e[t]:r||null},e))})}),dragOffset:z(n.dragOffset,i),refCount:oe(n.refCount,i),dragOperation:ie(n.dragOperation,i),stateId:le(n.stateId)}}function pe(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}ae.__IS_NONE__=!0,ue.__IS_ALL__=!0;var ye=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store=t,this.registry=r}var t,r,n;return t=e,(r=[{key:"subscribeToStateChange",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{handlerIds:void 0},n=r.handlerIds;i("function"==typeof e,"listener must be a function."),i(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");var o=this.store.getState().stateId,a=function(){var r=t.store.getState(),i=r.stateId;try{i===o||i===o+1&&!ce(r.dirtyHandlerIds,n)||e()}finally{o=i}};return this.store.subscribe(a)}},{key:"subscribeToOffsetChange",value:function(e){var t=this;i("function"==typeof e,"listener must be a function.");var r=this.store.getState().dragOffset;return this.store.subscribe(function(){var n=t.store.getState().dragOffset;n!==r&&(r=n,e())})}},{key:"canDragSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e);return i(t,"Expected to find a valid source."),!this.isDragging()&&t.canDrag(this,e)}},{key:"canDropOnTarget",value:function(e){if(!e)return!1;var t=this.registry.getTarget(e);return i(t,"Expected to find a valid target."),!(!this.isDragging()||this.didDrop())&&(R(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e))}},{key:"isDragging",value:function(){return Boolean(this.getItemType())}},{key:"isDraggingSource",value:function(e){if(!e)return!1;var t=this.registry.getSource(e,!0);return i(t,"Expected to find a valid source."),!(!this.isDragging()||!this.isSourcePublic())&&(this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e))}},{key:"isOverTarget",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shallow:!1};if(!e)return!1;var r=t.shallow;if(!this.isDragging())return!1;var n=this.registry.getTargetType(e),i=this.getItemType();if(i&&!R(n,i))return!1;var o=this.getTargetIds();if(!o.length)return!1;var a=o.indexOf(e);return r?a===o.length-1:a>-1}},{key:"getItemType",value:function(){return this.store.getState().dragOperation.itemType}},{key:"getItem",value:function(){return this.store.getState().dragOperation.item}},{key:"getSourceId",value:function(){return this.store.getState().dragOperation.sourceId}},{key:"getTargetIds",value:function(){return this.store.getState().dragOperation.targetIds}},{key:"getDropResult",value:function(){return this.store.getState().dragOperation.dropResult}},{key:"didDrop",value:function(){return this.store.getState().dragOperation.didDrop}},{key:"isSourcePublic",value:function(){return this.store.getState().dragOperation.isSourcePublic}},{key:"getInitialClientOffset",value:function(){return this.store.getState().dragOffset.initialClientOffset}},{key:"getInitialSourceClientOffset",value:function(){return this.store.getState().dragOffset.initialSourceClientOffset}},{key:"getClientOffset",value:function(){return this.store.getState().dragOffset.clientOffset}},{key:"getSourceClientOffset",value:function(){return e=this.store.getState().dragOffset,n=e.clientOffset,i=e.initialClientOffset,o=e.initialSourceClientOffset,n&&i&&o?pe((r=o,{x:(t=n).x+r.x,y:t.y+r.y}),i):null;var e,t,r,n,i,o}},{key:"getDifferenceFromInitialOffset",value:function(){return e=this.store.getState().dragOffset,t=e.clientOffset,r=e.initialClientOffset,t&&r?pe(t,r):null;var e,t,r}}])&&ve(t.prototype,r),n&&ve(t,n),e}(),be="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},me=we;function we(e){De.length||Oe(),De[De.length]=e}var Oe,De=[],Se=0,Te=1024;function Ie(){for(;Se<De.length;){var e=Se;if(Se+=1,De[e].call(),Se>Te){for(var t=0,r=De.length-Se;t<r;t++)De[t]=De[t+Se];De.length-=Se,Se=0}}De.length=0,Se=0}var Ee,ke,Ce,Pe=void 0!==be?be:self,Ne=Pe.MutationObserver||Pe.WebKitMutationObserver;function Re(e){return function(){var t=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(t),clearInterval(r),e()}}}"function"==typeof Ne?(Ee=1,ke=new Ne(Ie),Ce=document.createTextNode(""),ke.observe(Ce,{characterData:!0}),Oe=function(){Ee=-Ee,Ce.data=Ee}):Oe=Re(Ie),we.requestFlush=Oe,we.makeRequestCallFromTimer=Re;var xe=[],je=[],Me=me.makeRequestCallFromTimer(function(){if(je.length)throw je.shift()});var Ae=Le;function Le(e){var t;(t=xe.length?xe.pop():new _e).task=e,me(t)}function _e(){this.task=null}_e.prototype.call=function(){try{this.task.call()}catch(e){Le.onerror?Le.onerror(e):(je.push(e),Me())}finally{this.task=null,xe[xe.length]=this}};var He=0;function Ue(e){return(Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Fe(e,t){t&&Array.isArray(e)?e.forEach(function(e){return Fe(e,!1)}):i("string"==typeof e||"symbol"===Ue(e),t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}function Be(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ye(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ge(e){var t=(He++).toString();switch(e){case r.SOURCE:return"S".concat(t);case r.TARGET:return"T".concat(t);default:throw new Error("Unknown Handler Role: ".concat(e))}}function Xe(e){switch(e[0]){case"S":return r.SOURCE;case"T":return r.TARGET;default:i(!1,"Cannot parse handler ID: ".concat(e))}}function We(e,t){var r=e.entries(),n=!1;do{var i=r.next(),o=i.done;if(Ye(i.value,2)[1]===t)return!0;n=o}while(!n);return!1}var Ve=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}var t,n,o;return t=e,(n=[{key:"addSource",value:function(e,t){Fe(e),function(e){i("function"==typeof e.canDrag,"Expected canDrag to be a function."),i("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),i("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);var n=this.addHandler(r.SOURCE,e,t);return this.store.dispatch(function(e){return{type:J,payload:{sourceId:e}}}(n)),n}},{key:"addTarget",value:function(e,t){Fe(e,!0),function(e){i("function"==typeof e.canDrop,"Expected canDrop to be a function."),i("function"==typeof e.hover,"Expected hover to be a function."),i("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);var n=this.addHandler(r.TARGET,e,t);return this.store.dispatch(function(e){return{type:Q,payload:{targetId:e}}}(n)),n}},{key:"containsHandler",value:function(e){return We(this.dragSources,e)||We(this.dropTargets,e)}},{key:"getSource",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];i(this.isSourceId(e),"Expected a valid source ID.");var r=t&&e===this.pinnedSourceId,n=r?this.pinnedSource:this.dragSources.get(e);return n}},{key:"getTarget",value:function(e){return i(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}},{key:"getSourceType",value:function(e){return i(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}},{key:"getTargetType",value:function(e){return i(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}},{key:"isSourceId",value:function(e){return Xe(e)===r.SOURCE}},{key:"isTargetId",value:function(e){return Xe(e)===r.TARGET}},{key:"removeSource",value:function(e){var t=this;i(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:Z,payload:{sourceId:e}}}(e)),Ae(function(){t.dragSources.delete(e),t.types.delete(e)})}},{key:"removeTarget",value:function(e){i(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:$,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}},{key:"pinSource",value:function(e){var t=this.getSource(e);i(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}},{key:"unpinSource",value:function(){i(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}},{key:"addHandler",value:function(e,t,n){var i=Ge(e);return this.types.set(i,t),e===r.SOURCE?this.dragSources.set(i,n):e===r.TARGET&&this.dropTargets.set(i,n),i}}])&&Be(t.prototype,n),o&&Be(t,o),e}();function Ke(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var qe=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.isSetUp=!1,this.handleRefCountChange=function(){var e=t.store.getState().refCount>0;t.backend&&(e&&!t.isSetUp?(t.backend.setup(),t.isSetUp=!0):!e&&t.isSetUp&&(t.backend.teardown(),t.isSetUp=!1))};var n=function(e){var t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return g(he,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(r);this.store=n,this.monitor=new ye(n,new Ve(n)),n.subscribe(this.handleRefCountChange)}var t,r,n;return t=e,(r=[{key:"receiveBackend",value:function(e){this.backend=e}},{key:"getMonitor",value:function(){return this.monitor}},{key:"getBackend",value:function(){return this.backend}},{key:"getRegistry",value:function(){return this.monitor.registry}},{key:"getActions",value:function(){var e=this,t=this.store.dispatch;var r=function(e){return{beginDrag:I(e),publishDragSource:N(e),hover:x(e),drop:F(e),endDrag:X(e)}}(this);return Object.keys(r).reduce(function(n,i){var o,a=r[i];return n[i]=(o=a,function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var a=o.apply(e,n);void 0!==a&&t(a)}),n},{})}},{key:"dispatch",value:function(e){this.store.dispatch(e)}}])&&Ke(t.prototype,r),n&&Ke(t,n),e}();function ze(e,t,r,n){var i=new qe(n),o=e(i,t,r);return i.receiveBackend(o),i}var Je=e.createContext({dragDropManager:void 0});function Qe(){var t=e.useContext(Je).dragDropManager;return i(null!=t,"Expected drag drop context"),t}function Ze(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var $e=!1,et=!1,tt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sourceId=null,this.internalMonitor=t.getMonitor()}var t,r,n;return t=e,(r=[{key:"receiveHandlerId",value:function(e){this.sourceId=e}},{key:"getHandlerId",value:function(){return this.sourceId}},{key:"canDrag",value:function(){i(!$e,"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 $e=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{$e=!1}}},{key:"isDragging",value:function(){if(!this.sourceId)return!1;i(!et,"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 et=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{et=!1}}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"isDraggingSource",value:function(e){return this.internalMonitor.isDraggingSource(e)}},{key:"isOverTarget",value:function(e,t){return this.internalMonitor.isOverTarget(e,t)}},{key:"getTargetIds",value:function(){return this.internalMonitor.getTargetIds()}},{key:"isSourcePublic",value:function(){return this.internalMonitor.isSourcePublic()}},{key:"getSourceId",value:function(){return this.internalMonitor.getSourceId()}},{key:"subscribeToOffsetChange",value:function(e){return this.internalMonitor.subscribeToOffsetChange(e)}},{key:"canDragSource",value:function(e){return this.internalMonitor.canDragSource(e)}},{key:"canDropOnTarget",value:function(e){return this.internalMonitor.canDropOnTarget(e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&Ze(t.prototype,r),n&&Ze(t,n),e}();function rt(e,t){"function"==typeof e?e(t):e.current=t}function nt(t,r){var n=t.ref;return i("string"!=typeof n,"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://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute"),n?e.cloneElement(t,{ref:function(e){rt(n,e),rt(r,e)}}):e.cloneElement(t,{ref:r})}function it(e){if("string"!=typeof e.type){var 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 ".concat(t," into a <div>, or turn it into a ")+"drag source or a drop target itself.")}}function ot(t){var r={};return Object.keys(t).forEach(function(n){var i=t[n];if(n.endsWith("Ref"))r[n]=t[n];else{var o=function(t){return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e.isValidElement(r)){var i=r;return t(i,n),i}var o=r;it(o);var a=n?function(e){return t(e,n)}:t;return nt(o,a)}}(i);r[n]=function(){return o}}}),r}function at(e){return(at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ut(e){return null!==e&&"object"===at(e)&&e.hasOwnProperty("current")}function ct(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var st=function(){function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.hooks=ot({dragSource:function(e,t){r.clearDragSource(),r.dragSourceOptions=t||null,ut(e)?r.dragSourceRef=e:r.dragSourceNode=e,r.reconnectDragSource()},dragPreview:function(e,t){r.clearDragPreview(),r.dragPreviewOptions=t||null,ut(e)?r.dragPreviewRef=e:r.dragPreviewNode=e,r.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=t}var t,r,n;return t=e,(r=[{key:"receiveHandlerId",value:function(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}},{key:"reconnect",value:function(){this.reconnectDragSource(),this.reconnectDragPreview()}},{key:"reconnectDragSource",value:function(){var e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();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)):this.lastConnectedDragSource=e)}},{key:"reconnectDragPreview",value:function(){var e=this.dragPreview,t=this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();this.handlerId?this.dragPreview&&t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=e,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.disconnectDragPreview(),this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,e,this.dragPreviewOptions)):this.disconnectDragPreview()}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didConnectedDragSourceChange",value:function(){return this.lastConnectedDragSource!==this.dragSource}},{key:"didConnectedDragPreviewChange",value:function(){return this.lastConnectedDragPreview!==this.dragPreview}},{key:"didDragSourceOptionsChange",value:function(){return!a(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}},{key:"didDragPreviewOptionsChange",value:function(){return!a(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}},{key:"disconnectDragSource",value:function(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}},{key:"disconnectDragPreview",value:function(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}},{key:"clearDragSource",value:function(){this.dragSourceNode=null,this.dragSourceRef=null}},{key:"clearDragPreview",value:function(){this.dragPreviewNode=null,this.dragPreviewRef=null}},{key:"connectTarget",get:function(){return this.dragSource}},{key:"dragSourceOptions",get:function(){return this.dragSourceOptionsInternal},set:function(e){this.dragSourceOptionsInternal=e}},{key:"dragPreviewOptions",get:function(){return this.dragPreviewOptionsInternal},set:function(e){this.dragPreviewOptionsInternal=e}},{key:"dragSource",get:function(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}},{key:"dragPreview",get:function(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}}])&&ct(t.prototype,r),n&&ct(t,n),e}();function lt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function ft(e){return(ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function dt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function gt(t){var r=e.useRef(t);r.current=t,i(null!=t.item,"item must be defined"),i(null!=t.item.type,"item type must be defined");var n,a=dt((n=Qe(),[e.useMemo(function(){return new tt(n)},[n]),e.useMemo(function(){return new st(n.getBackend())},[n])]),2),u=a[0],c=a[1];!function(t,r,n){var a=Qe(),u=e.useMemo(function(){return{beginDrag:function(){var e=t.current,n=e.begin,o=e.item;if(n){var a=n(r);return i(null==a||"object"===ft(a),"dragSpec.begin() must either return an object, undefined, or null"),a||o||{}}return o||{}},canDrag:function(){return"boolean"==typeof t.current.canDrag?t.current.canDrag:"function"!=typeof t.current.canDrag||t.current.canDrag(r)},isDragging:function(e,n){var i=t.current.isDragging;return i?i(r):n===e.getSourceId()},endDrag:function(){var e=t.current.end;e&&e(r.getItem(),r),n.reconnect()}}},[]);o(function(){var e=lt(function(e,t,r){var n=r.getRegistry(),i=n.addSource(e,t);return[i,function(){return n.removeSource(i)}]}(t.current.item.type,u,a),2),i=e[0],o=e[1];return r.receiveHandlerId(i),n.receiveHandlerId(i),o},[])}(r,u,c);var l=s(u,r.current.collect||function(){return{}},function(){return c.reconnect()}),f=e.useMemo(function(){return c.hooks.dragSource()},[c]),d=e.useMemo(function(){return c.hooks.dragPreview()},[c]);return o(function(){c.dragSourceOptions=r.current.options||null,c.reconnect()},[c]),o(function(){c.dragPreviewOptions=r.current.previewOptions||null,c.reconnect()},[c]),[l,f,d]}function ht(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var pt=function(){function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.hooks=ot({dropTarget:function(e,t){r.clearDropTarget(),r.dropTargetOptions=t,ut(e)?r.dropTargetRef=e:r.dropTargetNode=e,r.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}var t,r,n;return t=e,(r=[{key:"reconnect",value:function(){var e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();var 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)}},{key:"receiveHandlerId",value:function(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}},{key:"didHandlerIdChange",value:function(){return this.lastConnectedHandlerId!==this.handlerId}},{key:"didDropTargetChange",value:function(){return this.lastConnectedDropTarget!==this.dropTarget}},{key:"didOptionsChange",value:function(){return!a(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}},{key:"disconnectDropTarget",value:function(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}},{key:"clearDropTarget",value:function(){this.dropTargetRef=null,this.dropTargetNode=null}},{key:"connectTarget",get:function(){return this.dropTarget}},{key:"dropTargetOptions",get:function(){return this.dropTargetOptionsInternal},set:function(e){this.dropTargetOptionsInternal=e}},{key:"dropTarget",get:function(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}}])&&ht(t.prototype,r),n&&ht(t,n),e}();function vt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var yt=!1,bt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.targetId=null,this.internalMonitor=t.getMonitor()}var t,r,n;return t=e,(r=[{key:"receiveHandlerId",value:function(e){this.targetId=e}},{key:"getHandlerId",value:function(){return this.targetId}},{key:"subscribeToStateChange",value:function(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}},{key:"canDrop",value:function(){if(!this.targetId)return!1;i(!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}}},{key:"isOver",value:function(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}},{key:"getItemType",value:function(){return this.internalMonitor.getItemType()}},{key:"getItem",value:function(){return this.internalMonitor.getItem()}},{key:"getDropResult",value:function(){return this.internalMonitor.getDropResult()}},{key:"didDrop",value:function(){return this.internalMonitor.didDrop()}},{key:"getInitialClientOffset",value:function(){return this.internalMonitor.getInitialClientOffset()}},{key:"getInitialSourceClientOffset",value:function(){return this.internalMonitor.getInitialSourceClientOffset()}},{key:"getSourceClientOffset",value:function(){return this.internalMonitor.getSourceClientOffset()}},{key:"getClientOffset",value:function(){return this.internalMonitor.getClientOffset()}},{key:"getDifferenceFromInitialOffset",value:function(){return this.internalMonitor.getDifferenceFromInitialOffset()}}])&&vt(t.prototype,r),n&&vt(t,n),e}();function mt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function wt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Ot(t){var r=e.useRef(t);r.current=t,i(null!=t.accept,"accept must be defined");var n,a=wt((n=Qe(),[e.useMemo(function(){return new bt(n)},[n]),e.useMemo(function(){return new pt(n.getBackend())},[n])]),2),u=a[0],c=a[1];!function(t,r,n){var i=Qe(),a=e.useMemo(function(){return{canDrop:function(){var e=t.current.canDrop;return!e||e(r.getItem(),r)},hover:function(){var e=t.current.hover;e&&e(r.getItem(),r)},drop:function(){var e=t.current.drop;if(e)return e(r.getItem(),r)}}},[r]);o(function(){var e=mt(function(e,t,r){var n=r.getRegistry(),i=n.addTarget(e,t);return[i,function(){return n.removeTarget(i)}]}(t.current.accept,a,i),2),o=e[0],u=e[1];return r.receiveHandlerId(o),n.receiveHandlerId(o),u},[r,n])}(r,u,c);var l=s(u,r.current.collect||function(){return{}},function(){return c.reconnect()}),f=e.useMemo(function(){return c.hooks.dropTarget()},[c]);return o(function(){c.dropTargetOptions=t.options||null,c.reconnect()},[t.options]),[l,f]}function Dt(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var St=e.memo(function(r){var n=r.children,i=Dt(r,["children"]),o="manager"in i?{dragDropManager:i.manager}:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0!==t?t:window,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=r;o[Tt]||(o[Tt]=function(e,t,r,n){return{dragDropManager:ze(e,t,r,n)}}(e,r,n,i));return o[Tt]}(i.backend,i.context,i.options,i.debugMode);return e.createElement(Je.Provider,{value:o},n)}),Tt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");function It(e){var t=null;return function(){return null==t&&(t=e()),t}}function Et(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.memo(function(e){var t=e.connect,r=e.src;if("undefined"!=typeof Image){var n=new Image;n.src=r,n.onload=function(){return t(n)}}return null}).displayName="DragPreviewImage";var kt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.entered=[],this.isNodeInDocument=t}var t,r,n;return t=e,(r=[{key:"enter",value:function(e){var t=this,r=this.entered.length;return this.entered=function(e,t){var r=new Set,n=function(e){return r.add(e)};e.forEach(n),t.forEach(n);var i=[];return r.forEach(function(e){return i.push(e)}),i}(this.entered.filter(function(r){return t.isNodeInDocument(r)&&(!r.contains||r.contains(e))}),[e]),0===r&&this.entered.length>0}},{key:"leave",value:function(e){var t,r,n=this.entered.length;return this.entered=(t=this.entered.filter(this.isNodeInDocument),r=e,t.filter(function(e){return e!==r})),n>0&&0===this.entered.length}},{key:"reset",value:function(){this.entered=[]}}])&&Et(t.prototype,r),n&&Et(t,n),e}(),Ct=It(function(){return/firefox/i.test(navigator.userAgent)}),Pt=It(function(){return Boolean(window.safari)});function Nt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Rt=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);for(var n=t.length,i=[],o=0;o<n;o++)i.push(o);i.sort(function(e,r){return t[e]<t[r]?-1:1});for(var a,u,c=[],s=[],l=0;l<n-1;l++)a=t[l+1]-t[l],u=r[l+1]-r[l],c.push(a),s.push(u/a);for(var f=[s[0]],d=0;d<c.length-1;d++){var g=s[d],h=s[d+1];if(g*h<=0)f.push(0);else{a=c[d];var p=c[d+1],v=a+p;f.push(3*v/((v+p)/g+(v+a)/h))}}f.push(s[s.length-1]);for(var y,b=[],m=[],w=0;w<f.length-1;w++){y=s[w];var O=f[w],D=1/c[w],S=O+f[w+1]-y-y;b.push((y-O-S)*D),m.push(S*D*D)}this.xs=t,this.ys=r,this.c1s=f,this.c2s=b,this.c3s=m}var t,r,n;return t=e,(r=[{key:"interpolate",value:function(e){var t=this.xs,r=this.ys,n=this.c1s,i=this.c2s,o=this.c3s,a=t.length-1;if(e===t[a])return r[a];for(var u,c=0,s=o.length-1;c<=s;){var l=t[u=Math.floor(.5*(c+s))];if(l<e)c=u+1;else{if(!(l>e))return r[u];s=u-1}}var f=e-t[a=Math.max(0,s)],d=f*f;return r[a]+n[a]*f+i[a]*d+o[a]*f*d}}])&&Nt(t.prototype,r),n&&Nt(t,n),e}(),xt=1;function jt(e){var t=e.nodeType===xt?e:e.parentElement;if(!t)return null;var r=t.getBoundingClientRect(),n=r.top;return{x:r.left,y:n}}function Mt(e){return{x:e.clientX,y:e.clientY}}function At(e,t,r,n,i){var o,a=function(e){return"IMG"===e.nodeName&&(Ct()||!document.documentElement.contains(e))}(t),u=jt(a?e:t),c={x:r.x-u.x,y:r.y-u.y},s=e.offsetWidth,l=e.offsetHeight,f=n.anchorX,d=n.anchorY,g=function(e,t,r,n){var i=e?t.width:r,o=e?t.height:n;return Pt()&&e&&(o/=window.devicePixelRatio,i/=window.devicePixelRatio),{dragPreviewWidth:i,dragPreviewHeight:o}}(a,t,s,l),h=g.dragPreviewWidth,p=g.dragPreviewHeight,v=i.offsetX,y=i.offsetY,b=0===y||y;return{x:0===v||v?v:new Rt([0,.5,1],[c.x,c.x/s*h,c.x+h-s]).interpolate(f),y:b?y:(o=new Rt([0,.5,1],[c.y,c.y/l*p,c.y+p-l]).interpolate(d),Pt()&&a&&(o+=(window.devicePixelRatio-1)*p),o)}}var Lt,_t="__NATIVE_FILE__",Ht="__NATIVE_URL__",Ut="__NATIVE_TEXT__",Ft=Object.freeze({FILE:_t,URL:Ht,TEXT:Ut});function Bt(e,t,r){var n=t.reduce(function(t,r){return t||e.getData(r)},"");return null!=n?n:r}function Yt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Gt=(Yt(Lt={},_t,{exposeProperties:{files:function(e){return Array.prototype.slice.call(e.files)},items:function(e){return e.items}},matchesTypes:["Files"]}),Yt(Lt,Ht,{exposeProperties:{urls:function(e,t){return Bt(e,t,"").split("\n")}},matchesTypes:["Url","text/uri-list"]}),Yt(Lt,Ut,{exposeProperties:{text:function(e,t){return Bt(e,t,"")}},matchesTypes:["Text","text/plain"]}),Lt);function Xt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Wt=function(){function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.config=t,this.item={},Object.keys(this.config.exposeProperties).forEach(function(e){Object.defineProperty(r.item,e,{configurable:!0,enumerable:!0,get:function(){return console.warn("Browser doesn't allow reading \"".concat(e,'" until the drop event.')),null}})})}var t,r,n;return t=e,(r=[{key:"mutateItemByReadingDataTransfer",value:function(e){var t=this,r={};e&&Object.keys(this.config.exposeProperties).forEach(function(n){r[n]={value:t.config.exposeProperties[n](e,t.config.matchesTypes)}}),Object.defineProperties(this.item,r)}},{key:"canDrag",value:function(){return!0}},{key:"beginDrag",value:function(){return this.item}},{key:"isDragging",value:function(e,t){return t===e.getSourceId()}},{key:"endDrag",value:function(){}}])&&Xt(t.prototype,r),n&&Xt(t,n),e}();function Vt(e){if(!e)return null;var t=Array.prototype.slice.call(e.types||[]);return Object.keys(Gt).filter(function(e){return Gt[e].matchesTypes.some(function(e){return t.indexOf(e)>-1})})[0]||null}function Kt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var qt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.globalContext=t}var t,r,n;return t=e,(r=[{key:"window",get:function(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}},{key:"document",get:function(){if(this.window)return this.window.document}}])&&Kt(t.prototype,r),n&&Kt(t,n),e}();function zt(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r}function Jt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zt(r,!0).forEach(function(t){Qt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zt(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Qt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var $t=function(){function e(t,r){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),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.getSourceClientOffset=function(e){return jt(n.sourceNodes.get(e))},this.endDragNativeItem=function(){n.isDraggingNativeItem()&&(n.actions.endDrag(),n.registry.removeSource(n.currentNativeHandle),n.currentNativeHandle=null,n.currentNativeSource=null)},this.isNodeInDocument=function(e){return n.document&&n.document.body&&document.body.contains(e)},this.endDragIfSourceWasRemovedFromDOM=function(){var e=n.currentDragSourceNode;n.isNodeInDocument(e)||n.clearCurrentDragSourceNode()&&n.actions.endDrag()},this.handleTopDragStartCapture=function(){n.clearCurrentDragSourceNode(),n.dragStartSourceIds=[]},this.handleTopDragStart=function(e){if(!e.defaultPrevented){var t=n.dragStartSourceIds;n.dragStartSourceIds=null;var r=Mt(e);n.monitor.isDragging()&&n.actions.endDrag(),n.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:n.getSourceClientOffset,clientOffset:r});var i=e.dataTransfer,o=Vt(i);if(n.monitor.isDragging()){if(i&&"function"==typeof i.setDragImage){var a=n.monitor.getSourceId(),u=n.sourceNodes.get(a),c=n.sourcePreviewNodes.get(a)||u;if(c){var s=n.getCurrentSourcePreviewNodeOptions(),l=At(u,c,r,{anchorX:s.anchorX,anchorY:s.anchorY},{offsetX:s.offsetX,offsetY:s.offsetY});i.setDragImage(c,l.x,l.y)}}try{i.setData("application/json",{})}catch(e){}n.setCurrentDragSourceNode(e.target),n.getCurrentSourcePreviewNodeOptions().captureDraggingState?n.actions.publishDragSource():setTimeout(function(){return n.actions.publishDragSource()},0)}else if(o)n.beginDragNativeItem(o);else{if(i&&!i.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}}},this.handleTopDragEndCapture=function(){n.clearCurrentDragSourceNode()&&n.actions.endDrag()},this.handleTopDragEnterCapture=function(e){if(n.dragEnterTargetIds=[],n.enterLeaveCounter.enter(e.target)&&!n.monitor.isDragging()){var t=Vt(e.dataTransfer);t&&n.beginDragNativeItem(t)}},this.handleTopDragEnter=function(e){var t=n.dragEnterTargetIds;(n.dragEnterTargetIds=[],n.monitor.isDragging())&&(n.altKeyPressed=e.altKey,Ct()||n.actions.hover(t,{clientOffset:Mt(e)}),t.some(function(e){return n.monitor.canDropOnTarget(e)})&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=n.getCurrentDropEffect())))},this.handleTopDragOverCapture=function(){n.dragOverTargetIds=[]},this.handleTopDragOver=function(e){var t=n.dragOverTargetIds;if(n.dragOverTargetIds=[],!n.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));n.altKeyPressed=e.altKey,n.actions.hover(t||[],{clientOffset:Mt(e)}),(t||[]).some(function(e){return n.monitor.canDropOnTarget(e)})?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=n.getCurrentDropEffect())):n.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=function(e){n.isDraggingNativeItem()&&e.preventDefault(),n.enterLeaveCounter.leave(e.target)&&n.isDraggingNativeItem()&&n.endDragNativeItem()},this.handleTopDropCapture=function(e){n.dropTargetIds=[],e.preventDefault(),n.isDraggingNativeItem()&&n.currentNativeSource.mutateItemByReadingDataTransfer(e.dataTransfer),n.enterLeaveCounter.reset()},this.handleTopDrop=function(e){var t=n.dropTargetIds;n.dropTargetIds=[],n.actions.hover(t,{clientOffset:Mt(e)}),n.actions.drop({dropEffect:n.getCurrentDropEffect()}),n.isDraggingNativeItem()?n.endDragNativeItem():n.endDragIfSourceWasRemovedFromDOM()},this.handleSelectStart=function(e){var 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 qt(r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new kt(this.isNodeInDocument)}var t,r,n;return t=e,(r=[{key:"setup",value:function(){if(void 0!==this.window){if(this.window.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");this.window.__isReactDndBackendSetUp=!0,this.addEventListeners(this.window)}}},{key:"teardown",value:function(){void 0!==this.window&&(this.window.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.window),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&this.window.cancelAnimationFrame(this.asyncEndDragFrameId))}},{key:"connectDragPreview",value:function(e,t,r){var n=this;return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),function(){n.sourcePreviewNodes.delete(e),n.sourcePreviewNodeOptions.delete(e)}}},{key:"connectDragSource",value:function(e,t,r){var n=this;this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);var i=function(t){return n.handleDragStart(t,e)},o=function(e){return n.handleSelectStart(e)};return t.setAttribute("draggable","true"),t.addEventListener("dragstart",i),t.addEventListener("selectstart",o),function(){n.sourceNodes.delete(e),n.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",i),t.removeEventListener("selectstart",o),t.setAttribute("draggable","false")}}},{key:"connectDropTarget",value:function(e,t){var r=this,n=function(t){return r.handleDragEnter(t,e)},i=function(t){return r.handleDragOver(t,e)},o=function(t){return r.handleDrop(t,e)};return t.addEventListener("dragenter",n),t.addEventListener("dragover",i),t.addEventListener("drop",o),function(){t.removeEventListener("dragenter",n),t.removeEventListener("dragover",i),t.removeEventListener("drop",o)}}},{key:"addEventListeners",value:function(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))}},{key:"removeEventListeners",value:function(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))}},{key:"getCurrentSourceNodeOptions",value:function(){var e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return Jt({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}},{key:"getCurrentDropEffect",value:function(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}},{key:"getCurrentSourcePreviewNodeOptions",value:function(){var e=this.monitor.getSourceId();return Jt({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}},{key:"isDraggingNativeItem",value:function(){var e=this.monitor.getItemType();return Object.keys(Ft).some(function(t){return Ft[t]===e})}},{key:"beginDragNativeItem",value:function(e){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e){return new Wt(Gt[e])}(e),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}},{key:"setCurrentDragSourceNode",value:function(e){var t=this;this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e;this.mouseMoveTimeoutTimer=setTimeout(function(){return t.window&&t.window.addEventListener("mousemove",t.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}},{key:"clearCurrentDragSourceNode",value:function(){return!!this.currentDragSourceNode&&(this.currentDragSourceNode=null,this.window&&(this.window.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.window.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)),this.mouseMoveTimeoutTimer=null,!0)}},{key:"handleDragStart",value:function(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}},{key:"handleDragEnter",value:function(e,t){this.dragEnterTargetIds.unshift(t)}},{key:"handleDragOver",value:function(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}},{key:"handleDrop",value:function(e,t){this.dropTargetIds.unshift(t)}},{key:"window",get:function(){return this.options.window}},{key:"document",get:function(){return this.options.document}}])&&Zt(t.prototype,r),n&&Zt(t,n),e}(),er=function(e,t){return new $t(e,t)};if("undefined"!=typeof self)tr(self);else if(void 0!==t)tr(t);else{if("undefined"==typeof window)throw new Error("unsupported execution environment");tr(window)}function tr(e){e.ReactDnd={useDrag:gt,useDrop:Ot,DndProvider:St,HTML5Backend:er}}}(React);