dragselect
Advanced tools
Comparing version 2.5.2 to 2.5.3
@@ -0,1 +1,5 @@ | ||
# 2.5.3 | ||
- Fix a bug where `setSettings` would not work with dropZones. | ||
# 2.5.2 | ||
@@ -2,0 +6,0 @@ |
@@ -1,1 +0,1 @@ | ||
function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function n(e,n,s){return n&&t(e.prototype,n),s&&t(e,s),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct:function(e,t,n){var s=[null];s.push.apply(s,t);var r=new(Function.bind.apply(e,s));return n&&l(r,n.prototype),r},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,s)}function s(){return u(e,arguments,a(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),l(s,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function p(e){var t=c();return function(){var n,s=a(e);if(t){var r=a(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return S(this,n)}}function f(e,t,n){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var s=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(s){var r=Object.getOwnPropertyDescriptor(s,t);return r.get?r.get.call(n):r.value}},f(e,t,n||e)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],s=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);s=!0);}catch(e){r=!0,i=e}finally{try{s||null==a.return||a.return()}finally{if(r)throw i}}return n}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var y=function(e,t,n){var s=e.x,r=e.y,i=n.x,o=n.y;return{"+":{x:s+i,y:r+o},"-":{x:s-i,y:r-o},"*":{x:s*i,y:r*o},"/":{x:s/i,y:r/o}}[t]},D=function(e){return{x:e.left,y:e.top}},_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},I=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var s=new MutationObserver(n);e.forEach((function(e,t){s.observe(e,{childList:0!==t,attributes:!0})}));return{observer:s,callback:n,cleanup:function(){return K(s,n)}}},L=function(e,t){var n;return function(){for(var s=arguments.length,r=new Array(s),i=0;i<s;i++)r[i]=arguments[i];var o=function(){n=null,e.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,t)}},w=function(){var e,t,n,s;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(s=document.documentElement)||void 0===s?void 0:s.scrollLeft)||0}},P=function(e){return function e(t){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null===(n=t[s])||void 0===n?void 0:n.parentNode;return r?(t.push(r),e(t,++s)):t}([e])},C=function(e){return!e||e instanceof Document?w():{x:e.scrollLeft>=0?e.scrollLeft:w().x,y:e.scrollTop>=0?e.scrollTop:w().y}},A=function(e){var t=e.elementRect,n=e.containerRect,s=e.tolerance,r=void 0===s?{x:0,y:0}:s,i=[];return t.top-r.y<n.top&&i.push("top"),t.left-r.x<n.left&&i.push("left"),t.bottom+r.y>n.bottom&&i.push("bottom"),t.right+r.y>n.right&&i.push("right"),i},E=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var s=n.transform.trim().match(/matrix3d\((.*?)\)/);if(s&&s.length){var r,i=null===(r=s[1])||void 0===r?void 0:r.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},T=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return E(e);var n={x:0,y:0},s=t.trim().match(/translate[3dD]*?\(.*?\)/);if(s){var r,i=null===(r=s[0])||void 0===r?void 0:r.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:E(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var s=window.getComputedStyle(e);return{x:parseInt(s.left)||0,y:parseInt(s.top)||0}}return n}(e)},x=function(e){var t=e.computedStyle,n=e.node,s=t.position;n instanceof Document||("absolute"===s||"relative"===s||"fixed"===s)||(n.style.position="relative")},k=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},M=function(e,t,n,r){if(void 0===t)return n?s({},e,r):{};if(null===t)return s({},e,null);var i=!0,o=!1,a="string"==typeof r;a&&(i="string"==typeof t||t instanceof String),a&&!i&&(o=!0,k(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(i=!Number.isNaN(t)&&"number"==typeof t),l&&!i&&(o=!0,k(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(i="[object Object]"===Object.prototype.toString.call(t)),c&&!i&&(o=!0,k(e,"object"));var u="boolean"==typeof r;u&&(i="boolean"==typeof t),u&&!i&&(o=!0,k(e,"boolean"));var d=Array.isArray(r);d&&(i=Array.isArray(t)),d&&!i&&(o=!0,k(e,"array"));var h=o||n;return"dragKeys"===e&&i?s({},e,Object.assign(r,t)):"dragKeys"!==e||i?("dropZones"===e&&i&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?s({},e,t):h?s({},e,r):{}):h?s({},e,r):{}},V=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=e;if(n>0){var r=(e.right-e.left)*n,i=(e.bottom-e.top)*n;s={left:e.left+r,right:e.right-r,top:e.top+i,bottom:e.bottom-i}}return s.left<t.right&&s.right>t.left&&s.top<t.bottom&&s.bottom>t.top},N=function(e){var t=e.element,n=e.posDirection,s=e.containerRect,r=e.useTransform,i=T(t,r),o=y(i,"+",n);O(t,o,r);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,s=e.elementRect,r=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&O(t,{y:i.y+r.top-s.top,x:i.x},o),n.includes("left")&&O(t,{y:i.y,x:i.x+r.left-s.left},o),n.includes("bottom")&&O(t,{y:i.y+r.bottom-s.bottom,x:i.x},o),n.includes("right")&&O(t,{y:i.y,x:i.x+r.right-s.right},o)}({element:t,edges:A({elementRect:a,containerRect:s}),elementRect:a,containerRect:s,elementPos:o,useTransform:r})},K=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},O=function(e,t,n){if(n){var s=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(s.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:v(new Set(v(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"DS",void 0),s(this,"_observers",void 0),s(this,"_node",void 0),s(this,"_parentNodes",void 0),s(this,"_computedStyle",void 0),s(this,"_computedBorder",void 0),s(this,"_rect",void 0),s(this,"setArea",(function(e){r._node=e,x({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),s(this,"start",(function(){r._observers=I(r.parentNodes,L((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),s(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),s(this,"stop",(function(){r._observers.cleanup(),r.reset()})),s(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var s=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,r=e instanceof Document?s||document.body:e,i=t.includes("top")&&r.scrollTop>0,o=t.includes("bottom")&&r.scrollTop<r.scrollHeight,a=t.includes("left")&&r.scrollLeft>0,l=t.includes("right")&&r.scrollLeft<r.scrollWidth;i&&(r.scrollTop-=1*n),o&&(r.scrollTop+=1*n),a&&(r.scrollLeft-=1*n),l&&(r.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=i,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;return r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return n(t,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=P(this.HTMLNode)}}]),t}(),R=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevCursorPos",void 0),s(this,"_prevScrollPos",void 0),s(this,"_elements",[]),s(this,"_dragKeys",void 0),s(this,"_dragKeysFlat",[]),s(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(v(r._dragKeys.up),v(r._dragKeys.down),v(r._dragKeys.left),v(r._dragKeys.right))})),s(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,s=e.zoom,r=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*s:n*s;return i.left.includes(r)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(r)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(r)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(r)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return N({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),s(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),s(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),s(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),s(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=y(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return N({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),s(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=i,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return n(t,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?y(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?y(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),t}(),j=function(){function t(n){var r=this,i=n.DS,o=n.id,a=n.element,l=n.droppables;e(this,t),s(this,"id",void 0),s(this,"element",void 0),s(this,"_droppables",void 0),s(this,"_rect",void 0),s(this,"_observers",void 0),s(this,"_timeout",void 0),s(this,"_itemsDropped",[]),s(this,"_itemsInside",void 0),s(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),s(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),s(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=v(new Set([].concat(v(r._itemsDropped),v(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),s(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),s(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),s(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),s(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass)})),this._observers=I(this.parentNodes,L((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return V(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=P(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),t}(),B=function t(n){var r=this,o=n.DS;e(this,t),s(this,"_zoneByElement",new Map),s(this,"_zoneById",new Map),s(this,"_zonesByDroppable",new Map),s(this,"_zones",void 0),s(this,"setDropZones",(function(e){var t=e.dropZones;t&&(r._zones&&r._zones.forEach((function(e){return e.destroy()})),r._zones=t.map((function(e){return new j(i({DS:r.DS},e))})),r._zones.forEach((function(e){r._zoneByElement.set(e.element,e),r._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=r._zonesByDroppable.get(t);if(null==n||!n.length)return r._zonesByDroppable.set(t,[e]);r._zonesByDroppable.set(t,v(new Set([].concat(v(n),[e]))))}))})))})),s(this,"_handleDrop",(function(e){r._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),s(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,s=t.y,i=0,o=e.length;i<o;i++){var a=r._zoneByElement.get(e[i]);if(a&&V(a.rect,{left:n,right:n,top:s,bottom:s},Math.min(r.Settings.dropTargetThreshold,.5)))return a}})),s(this,"stop",(function(e){if(e.isDragging){var t=r.getTarget();r._handleDrop(t)}})),s(this,"getItemsDroppedById",(function(e){var t=r._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),s(this,"getItemsInsideById",(function(e,t){var n=r._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var s=n.itemsInside;return t&&n.handleItemsInsideClasses(),s})),s(this,"getTarget",(function(e){var t;if(null!==(t=r._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||r.DS.stores.PointerStore.currentVal.x,s=(null==e?void 0:e.y)||r.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,s);return r._getZoneByElementsFromPoint(i,{x:n,y:s})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",this.setDropZones),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)},F=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"isInteracting",void 0),s(this,"isDragging",void 0),s(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),s(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),s(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),s(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),s(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),s(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),s(this,"stop",(function(){r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(r.DS.Area.HTMLNode.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(r.DS.Area.HTMLNode.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),r.DS.Area.HTMLNode.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),s(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),s(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),s(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",this.init),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return n(t,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),t}(),W=function t(n){var r=this,i=n.DS;e(this,t),s(this,"subscribers",{}),s(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),s(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),s(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),s(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),s(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),s(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=i},U=function(t){o(i,d(Set));var r=p(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"_rects",void 0),s(h(n),"_timeout",void 0),s(h(n),"init",(function(){return Z(n.Settings.selectables).forEach((function(e){return n.add(e)}))})),s(h(n),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"_onClick",(function(e){return n.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),s(h(n),"_onPointer",(function(e){return n.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n.Settings=o.stores.SettingsStore.s,n.DS.subscribe("Interaction:init",n.init),n.DS.PubSub.subscribe("Settings:updated:selectables",(function(){n.clear(),n.init()})),n.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;n.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&x({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),f(a(i.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),f(a(i.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),i}(),X=function(t){o(i,d(Set));var r=p(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),f(a(i.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=f(a(i.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),i}(),Y=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevSelectedSet",void 0),s(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),s(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),s(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=[],c=[],u=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(i.rects);try{for(u.s();!(n=u.n()).done;){var d=g(n.value,2),h=d[0],S=d[1];o.isInside(h,S)&&(V(S,a.rect,r.Settings.selectionThreshold)?l.push(h):c.push(h))}}catch(e){u.e(e)}finally{u.f()}var p=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling;r.DS.continue||(l.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.multiSelectionToggle,r=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(r.has(t)?s&&r.delete(t):r.add(t),t.classList.add(i))}({element:t,force:e,multiSelectionToggle:p,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),c.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.SelectedSet,r=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=s.has(t),a=r.has(t);o&&!a?s.delete(t):!o&&a&&s.add(t),t.classList.remove(i)}({element:t,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})})))})),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return n(t,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,s=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(s):this._prevSelectedSet=new Set}}]),t}(),q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_rect",void 0),s(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 0, 255, 0.1)",s.style.border="1px solid rgba(0, 0, 255, 0.45)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),s(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,_(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),s(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),s(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,s=e.pointerPos,r={};return s.x>n.x-t.x?(r.left=n.x-t.x,r.width=s.x-n.x+t.x):(r.left=s.x,r.width=n.x-s.x-t.x),s.y>n.y-t.y?(r.top=n.y-t.y,r.height=s.y-n.y+t.y):(r.top=s.y,r.height=n.y-s.y-t.y),r}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=i,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),G=function(){function t(n){var r,i=this,o=n.DS;e(this,t),s(this,"_scrollInterval",void 0),s(this,"_rect",void 0),s(this,"currentEdges",[]),s(this,"start",(function(){return i.applyElements("append")})),s(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");i.HTMLNode[n](i.DS.Selector.HTMLNode),document[t][n](i.HTMLNode)})),s(this,"updatePos",(function(){i._rect=null;var e=i.DS.Area.rect,t=i.DS.Area.computedBorder,n=i.HTMLNode.style,s="".concat(e.top+t.top,"px"),r="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==s&&(n.top=s),n.left!==r&&(n.left=r),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),s(this,"stop",(function(e){i.stopAutoScroll(),e&&i.applyElements("remove")})),s(this,"startAutoScroll",(function(){i.currentEdges=[],i._scrollInterval=setInterval((function(){return i.handleAutoScroll()}),16)})),s(this,"handleAutoScroll",(function(){if(!i.DS.continue){var e=i.DS,t=e.stores.PointerStore,n=e.Area;i.currentEdges=A({elementRect:_(t.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&n.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}})),s(this,"stopAutoScroll",(function(){i.currentEdges=[],clearInterval(i._scrollInterval)})),s(this,"isInside",(function(e,t){return!(!i.DS.Area.HTMLNode.contains(e)||!i.DS.stores.ScrollStore.canScroll)||V(i.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;i.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),i.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){i.updatePos(),i.stopAutoScroll()}))}return n(t,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return V({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),$=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_currentValues",new Set),s(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),s(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),s(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),s(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),s(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),s(this,"reset",(function(){return r._currentValues.clear()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return n(t,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),t}(),J=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_isMouseInteraction",!1),s(this,"_initialValArea",void 0),s(this,"_currentValArea",void 0),s(this,"_lastValArea",void 0),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_lastVal",void 0),s(this,"_lastTouch",void 0),s(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),s(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),s(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),s(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),s(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return n(t,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}}]),t}(),Q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_canScroll",void 0),s(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"start",(function(){r._currentVal=r._initialVal=C(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"update",(function(){return r._currentVal=C(r.DS.stores.SettingsStore.s.area)})),s(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),s(this,"reset",(function(){r.stop(),r.start()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return n(t,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=C(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=y(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},s=y(y(t,"*",n),"-",t);return{x:t.x+s.x,y:t.y+s.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=C(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),t}(),ee=function t(n){var r=this,o=n.DS,a=n.settings;e(this,t),s(this,"_settings",{}),s(this,"s",{}),s(this,"update",(function(e){var t=e.settings,n=e.init;return r.DS.publish("Settings:updated:pre",i({settings:t},n?{init:n}:{}))})),s(this,"_update",(function(e){for(var t=function(e,t){return i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i({},M("area",e.area,t,document)),M("selectables",e.selectables,t,null)),M("autoScrollSpeed",e.autoScrollSpeed,t,5)),M("overflowTolerance",e.overflowTolerance,t,{x:25,y:25})),M("zoom",e.zoom,t,1)),M("customStyles",e.customStyles,t,!1)),M("multiSelectMode",e.multiSelectMode,t,!1)),M("multiSelectToggling",e.multiSelectToggling,t,!0)),M("multiSelectKeys",e.multiSelectKeys,t,["Control","Shift","Meta"])),M("selector",e.selector,t,null)),M("selectionThreshold",e.selectionThreshold,t,0)),M("draggability",e.draggability,t,!0)),M("immediateDrag",e.immediateDrag,t,!0)),M("keyboardDrag",e.keyboardDrag,t,!0)),M("dragKeys",e.dragKeys,t,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),M("keyboardDragSpeed",e.keyboardDragSpeed,t,10)),M("useTransform",e.useTransform,t,!0)),M("refreshMemoryRate",e.refreshMemoryRate,t,80)),M("dropZones",e.dropZones,t,[])),M("dropInsideThreshold",e.dropInsideThreshold,t,1)),M("dropTargetThreshold",e.dropTargetThreshold,t,0)),M("usePointerEvents",e.usePointerEvents,t,!1)),M("hoverClass",e.hoverClass,t,"ds-hover")),M("selectableClass",e.selectableClass,t,"ds-selectable")),M("selectedClass",e.selectedClass,t,"ds-selected")),M("selectorClass",e.selectorClass,t,"ds-selector")),M("selectorAreaClass",e.selectorAreaClass,t,"ds-selector-area")),M("droppedTargetClass",e.droppedTargetClass,t,"ds-dropped-target")),M("droppedInsideClass",e.droppedInsideClass,t,"ds-dropped-inside")),M("droppableClass",e.droppableClass,t,"ds-droppable")),M("dropZoneClass",e.dropZoneClass,t,"ds-dropzone")),M("dropZoneReadyClass",e.dropZoneReadyClass,t,"ds-dropzone-ready")),M("dropZoneTargetClass",e.dropZoneTargetClass,t,"ds-dropzone-target")),M("dropZoneInsideClass",e.dropZoneInsideClass,t,"ds-dropzone-inside"))}(e.settings,e.init),n=function(){var e,t=g(a[o],2),n=t[0],i=t[1];n in r._settings||Object.defineProperty(r.s,n,{get:function(){return r._settings[n]},set:function(e){return r.update({settings:s({},n,e)})}}),r._settings["".concat(n,":pre")]=r._settings[n],r._settings[n]=i;var l={settings:(e={},s(e,n,r._settings[n]),s(e,"".concat(n,":pre"),r._settings["".concat(n,":pre")]),e)};r.DS.publish("Settings:updated",l),r.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(t);o<a.length;o++)n()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})},te=function(){function t(n){var r=this;e(this,t),s(this,"continue",!1),s(this,"start",(function(){r.stopped=!1,r.Interaction.init()})),s(this,"break",(function(){return r.continue=!0})),s(this,"setSettings",(function(e){return r.stores.SettingsStore.update({settings:e})})),s(this,"getSelection",(function(){return r.SelectedSet.elements})),s(this,"getSelectables",(function(){return r.SelectableSet.elements})),s(this,"getInitialCursorPosition",(function(){return r.stores.PointerStore.initialVal})),s(this,"getCurrentCursorPosition",(function(){return r.stores.PointerStore.currentVal})),s(this,"getPreviousCursorPosition",(function(){return r.stores.PointerStore.lastVal})),s(this,"getInitialCursorPositionArea",(function(){return r.stores.PointerStore.initialValArea})),s(this,"getCurrentCursorPositionArea",(function(){return r.stores.PointerStore.currentValArea})),s(this,"getPreviousCursorPositionArea",(function(){return r.stores.PointerStore.lastValArea})),s(this,"isMultiSelect",(function(e){return r.stores.KeyStore.isMultiSelectKeyPressed(e)})),s(this,"isDragging",(function(){return r.Interaction.isDragging})),s(this,"getZoneByCoordinates",(function(e){var t;return null===(t=r.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),s(this,"getItemsDroppedByZoneId",(function(e){return r.DropZones.getItemsDroppedById(e)})),s(this,"getItemsInsideByZoneId",(function(e,t){return r.DropZones.getItemsInsideById(e,t)})),this.PubSub=new W({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ee({DS:this,settings:n}),this.stores.PointerStore=new J({DS:this}),this.stores.ScrollStore=new Q({DS:this}),this.stores.KeyStore=new $({DS:this}),this.Area=new H({DS:this}),this.Selector=new q({DS:this}),this.SelectorArea=new G({DS:this}),this.SelectableSet=new U({DS:this}),this.SelectedSet=new X({DS:this}),this.Selection=new Y({DS:this}),this.Drag=new R({DS:this}),this.DropZones=new B({DS:this}),this.Interaction=new F({DS:this}),function(e){for(var t=e.subscribe,n=e.publish,s=e.Interaction,r=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return i({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=g(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return t(e?"".concat(o,":").concat(e):o,(function(t){return a.forEach((function(o){return(!o.condition||o.condition(t))&&n(e?"".concat(e).concat(o.name):o.name,i(i({items:r.elements,isDragging:s.isDragging},t),o.extraData?o.extraData(t):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return r.continue=!1})),this.start()}return n(t,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(r){return t.SelectedSet.has(r)?t.removeSelection(e,n,s):t.addSelection(e,n,s)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var s=Z(e);return this.SelectableSet.addAll(s),t&&this.SelectedSet.addAll(s),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),t}();export default te; | ||
function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function n(e,n,s){return n&&t(e.prototype,n),s&&t(e,s),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct:function(e,t,n){var s=[null];s.push.apply(s,t);var r=new(Function.bind.apply(e,s));return n&&l(r,n.prototype),r},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,s)}function s(){return u(e,arguments,a(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),l(s,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function p(e){var t=c();return function(){var n,s=a(e);if(t){var r=a(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return S(this,n)}}function f(e,t,n){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var s=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(s){var r=Object.getOwnPropertyDescriptor(s,t);return r.get?r.get.call(n):r.value}},f(e,t,n||e)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],s=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);s=!0);}catch(e){r=!0,i=e}finally{try{s||null==a.return||a.return()}finally{if(r)throw i}}return n}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var y=function(e,t,n){var s=e.x,r=e.y,i=n.x,o=n.y;return{"+":{x:s+i,y:r+o},"-":{x:s-i,y:r-o},"*":{x:s*i,y:r*o},"/":{x:s/i,y:r/o}}[t]},D=function(e){return{x:e.left,y:e.top}},_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},I=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var s=new MutationObserver(n);e.forEach((function(e,t){s.observe(e,{childList:0!==t,attributes:!0})}));return{observer:s,callback:n,cleanup:function(){return K(s,n)}}},L=function(e,t){var n;return function(){for(var s=arguments.length,r=new Array(s),i=0;i<s;i++)r[i]=arguments[i];var o=function(){n=null,e.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,t)}},w=function(){var e,t,n,s;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(s=document.documentElement)||void 0===s?void 0:s.scrollLeft)||0}},P=function(e){return function e(t){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null===(n=t[s])||void 0===n?void 0:n.parentNode;return r?(t.push(r),e(t,++s)):t}([e])},C=function(e){return!e||e instanceof Document?w():{x:e.scrollLeft>=0?e.scrollLeft:w().x,y:e.scrollTop>=0?e.scrollTop:w().y}},A=function(e){var t=e.elementRect,n=e.containerRect,s=e.tolerance,r=void 0===s?{x:0,y:0}:s,i=[];return t.top-r.y<n.top&&i.push("top"),t.left-r.x<n.left&&i.push("left"),t.bottom+r.y>n.bottom&&i.push("bottom"),t.right+r.y>n.right&&i.push("right"),i},E=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var s=n.transform.trim().match(/matrix3d\((.*?)\)/);if(s&&s.length){var r,i=null===(r=s[1])||void 0===r?void 0:r.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},T=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return E(e);var n={x:0,y:0},s=t.trim().match(/translate[3dD]*?\(.*?\)/);if(s){var r,i=null===(r=s[0])||void 0===r?void 0:r.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:E(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var s=window.getComputedStyle(e);return{x:parseInt(s.left)||0,y:parseInt(s.top)||0}}return n}(e)},x=function(e){var t=e.computedStyle,n=e.node,s=t.position;n instanceof Document||("absolute"===s||"relative"===s||"fixed"===s)||(n.style.position="relative")},k=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},M=function(e,t,n,r){if(void 0===t)return n?s({},e,r):{};if(null===t)return s({},e,null);var i=!0,o=!1,a="string"==typeof r;a&&(i="string"==typeof t||t instanceof String),a&&!i&&(o=!0,k(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(i=!Number.isNaN(t)&&"number"==typeof t),l&&!i&&(o=!0,k(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(i="[object Object]"===Object.prototype.toString.call(t)),c&&!i&&(o=!0,k(e,"object"));var u="boolean"==typeof r;u&&(i="boolean"==typeof t),u&&!i&&(o=!0,k(e,"boolean"));var d=Array.isArray(r);d&&(i=Array.isArray(t)),d&&!i&&(o=!0,k(e,"array"));var h=o||n;return"dragKeys"===e&&i?s({},e,Object.assign(r,t)):"dragKeys"!==e||i?("dropZones"===e&&i&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?s({},e,t):h?s({},e,r):{}):h?s({},e,r):{}},V=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=e;if(n>0){var r=(e.right-e.left)*n,i=(e.bottom-e.top)*n;s={left:e.left+r,right:e.right-r,top:e.top+i,bottom:e.bottom-i}}return s.left<t.right&&s.right>t.left&&s.top<t.bottom&&s.bottom>t.top},N=function(e){var t=e.element,n=e.posDirection,s=e.containerRect,r=e.useTransform,i=T(t,r),o=y(i,"+",n);O(t,o,r);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,s=e.elementRect,r=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&O(t,{y:i.y+r.top-s.top,x:i.x},o),n.includes("left")&&O(t,{y:i.y,x:i.x+r.left-s.left},o),n.includes("bottom")&&O(t,{y:i.y+r.bottom-s.bottom,x:i.x},o),n.includes("right")&&O(t,{y:i.y,x:i.x+r.right-s.right},o)}({element:t,edges:A({elementRect:a,containerRect:s}),elementRect:a,containerRect:s,elementPos:o,useTransform:r})},K=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},O=function(e,t,n){if(n){var s=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(s.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:v(new Set(v(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"DS",void 0),s(this,"_observers",void 0),s(this,"_node",void 0),s(this,"_parentNodes",void 0),s(this,"_computedStyle",void 0),s(this,"_computedBorder",void 0),s(this,"_rect",void 0),s(this,"setArea",(function(e){r._node=e,x({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),s(this,"start",(function(){r._observers=I(r.parentNodes,L((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),s(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),s(this,"stop",(function(){r._observers.cleanup(),r.reset()})),s(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var s=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,r=e instanceof Document?s||document.body:e,i=t.includes("top")&&r.scrollTop>0,o=t.includes("bottom")&&r.scrollTop<r.scrollHeight,a=t.includes("left")&&r.scrollLeft>0,l=t.includes("right")&&r.scrollLeft<r.scrollWidth;i&&(r.scrollTop-=1*n),o&&(r.scrollTop+=1*n),a&&(r.scrollLeft-=1*n),l&&(r.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=i,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;return r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return n(t,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=P(this.HTMLNode)}}]),t}(),R=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevCursorPos",void 0),s(this,"_prevScrollPos",void 0),s(this,"_elements",[]),s(this,"_dragKeys",void 0),s(this,"_dragKeysFlat",[]),s(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(v(r._dragKeys.up),v(r._dragKeys.down),v(r._dragKeys.left),v(r._dragKeys.right))})),s(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,s=e.zoom,r=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*s:n*s;return i.left.includes(r)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(r)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(r)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(r)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return N({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),s(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),s(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),s(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),s(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=y(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return N({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),s(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=i,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return n(t,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?y(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?y(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),t}(),j=function(){function t(n){var r=this,i=n.DS,o=n.id,a=n.element,l=n.droppables;e(this,t),s(this,"id",void 0),s(this,"element",void 0),s(this,"_droppables",void 0),s(this,"_rect",void 0),s(this,"_observers",void 0),s(this,"_timeout",void 0),s(this,"_itemsDropped",[]),s(this,"_itemsInside",void 0),s(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),s(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),s(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=v(new Set([].concat(v(r._itemsDropped),v(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),s(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),s(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),s(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),s(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass)})),this._observers=I(this.parentNodes,L((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return V(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=P(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),t}(),B=function t(n){var r=this,o=n.DS;e(this,t),s(this,"_zoneByElement",new Map),s(this,"_zoneById",new Map),s(this,"_zonesByDroppable",new Map),s(this,"_zones",void 0),s(this,"setDropZones",(function(e){var t=e.dropZones;t&&(r._zones&&r._zones.forEach((function(e){return e.destroy()})),r._zones=t.map((function(e){return new j(i({DS:r.DS},e))})),r._zones.forEach((function(e){r._zoneByElement.set(e.element,e),r._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=r._zonesByDroppable.get(t);if(null==n||!n.length)return r._zonesByDroppable.set(t,[e]);r._zonesByDroppable.set(t,v(new Set([].concat(v(n),[e]))))}))})))})),s(this,"_handleDrop",(function(e){r._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),s(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,s=t.y,i=0,o=e.length;i<o;i++){var a=r._zoneByElement.get(e[i]);if(a&&V(a.rect,{left:n,right:n,top:s,bottom:s},Math.min(r.Settings.dropTargetThreshold,.5)))return a}})),s(this,"stop",(function(e){if(e.isDragging){var t=r.getTarget();r._handleDrop(t)}})),s(this,"getItemsDroppedById",(function(e){var t=r._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),s(this,"getItemsInsideById",(function(e,t){var n=r._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var s=n.itemsInside;return t&&n.handleItemsInsideClasses(),s})),s(this,"getTarget",(function(e){var t;if(null!==(t=r._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||r.DS.stores.PointerStore.currentVal.x,s=(null==e?void 0:e.y)||r.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,s);return r._getZoneByElementsFromPoint(i,{x:n,y:s})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return r.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)},F=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"isInteracting",void 0),s(this,"isDragging",void 0),s(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),s(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),s(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),s(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),s(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),s(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),s(this,"stop",(function(){r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(r.DS.Area.HTMLNode.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(r.DS.Area.HTMLNode.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),r.DS.Area.HTMLNode.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),s(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),s(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),s(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",this.init),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return n(t,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),t}(),W=function t(n){var r=this,i=n.DS;e(this,t),s(this,"subscribers",{}),s(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),s(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),s(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),s(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),s(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),s(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=i},U=function(t){o(i,d(Set));var r=p(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"_rects",void 0),s(h(n),"_timeout",void 0),s(h(n),"init",(function(){return Z(n.Settings.selectables).forEach((function(e){return n.add(e)}))})),s(h(n),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"_onClick",(function(e){return n.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),s(h(n),"_onPointer",(function(e){return n.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n.Settings=o.stores.SettingsStore.s,n.DS.subscribe("Interaction:init",n.init),n.DS.PubSub.subscribe("Settings:updated:selectables",(function(){n.clear(),n.init()})),n.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;n.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&x({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),f(a(i.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),f(a(i.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),i}(),X=function(t){o(i,d(Set));var r=p(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),f(a(i.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=f(a(i.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),i}(),Y=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevSelectedSet",void 0),s(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),s(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),s(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=[],c=[],u=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(i.rects);try{for(u.s();!(n=u.n()).done;){var d=g(n.value,2),h=d[0],S=d[1];o.isInside(h,S)&&(V(S,a.rect,r.Settings.selectionThreshold)?l.push(h):c.push(h))}}catch(e){u.e(e)}finally{u.f()}var p=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling;r.DS.continue||(l.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.multiSelectionToggle,r=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(r.has(t)?s&&r.delete(t):r.add(t),t.classList.add(i))}({element:t,force:e,multiSelectionToggle:p,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),c.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.SelectedSet,r=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=s.has(t),a=r.has(t);o&&!a?s.delete(t):!o&&a&&s.add(t),t.classList.remove(i)}({element:t,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})})))})),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return n(t,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,s=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(s):this._prevSelectedSet=new Set}}]),t}(),q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_rect",void 0),s(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 0, 255, 0.1)",s.style.border="1px solid rgba(0, 0, 255, 0.45)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),s(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,_(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),s(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),s(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,s=e.pointerPos,r={};return s.x>n.x-t.x?(r.left=n.x-t.x,r.width=s.x-n.x+t.x):(r.left=s.x,r.width=n.x-s.x-t.x),s.y>n.y-t.y?(r.top=n.y-t.y,r.height=s.y-n.y+t.y):(r.top=s.y,r.height=n.y-s.y-t.y),r}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=i,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),G=function(){function t(n){var r,i=this,o=n.DS;e(this,t),s(this,"_scrollInterval",void 0),s(this,"_rect",void 0),s(this,"currentEdges",[]),s(this,"start",(function(){return i.applyElements("append")})),s(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");i.HTMLNode[n](i.DS.Selector.HTMLNode),document[t][n](i.HTMLNode)})),s(this,"updatePos",(function(){i._rect=null;var e=i.DS.Area.rect,t=i.DS.Area.computedBorder,n=i.HTMLNode.style,s="".concat(e.top+t.top,"px"),r="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==s&&(n.top=s),n.left!==r&&(n.left=r),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),s(this,"stop",(function(e){i.stopAutoScroll(),e&&i.applyElements("remove")})),s(this,"startAutoScroll",(function(){i.currentEdges=[],i._scrollInterval=setInterval((function(){return i.handleAutoScroll()}),16)})),s(this,"handleAutoScroll",(function(){if(!i.DS.continue){var e=i.DS,t=e.stores.PointerStore,n=e.Area;i.currentEdges=A({elementRect:_(t.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&n.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}})),s(this,"stopAutoScroll",(function(){i.currentEdges=[],clearInterval(i._scrollInterval)})),s(this,"isInside",(function(e,t){return!(!i.DS.Area.HTMLNode.contains(e)||!i.DS.stores.ScrollStore.canScroll)||V(i.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;i.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),i.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){i.updatePos(),i.stopAutoScroll()}))}return n(t,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return V({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),$=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_currentValues",new Set),s(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),s(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),s(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),s(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),s(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),s(this,"reset",(function(){return r._currentValues.clear()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return n(t,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),t}(),J=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_isMouseInteraction",!1),s(this,"_initialValArea",void 0),s(this,"_currentValArea",void 0),s(this,"_lastValArea",void 0),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_lastVal",void 0),s(this,"_lastTouch",void 0),s(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),s(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),s(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),s(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),s(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return n(t,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}}]),t}(),Q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_canScroll",void 0),s(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"start",(function(){r._currentVal=r._initialVal=C(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"update",(function(){return r._currentVal=C(r.DS.stores.SettingsStore.s.area)})),s(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),s(this,"reset",(function(){r.stop(),r.start()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return n(t,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=C(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=y(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},s=y(y(t,"*",n),"-",t);return{x:t.x+s.x,y:t.y+s.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=C(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),t}(),ee=function t(n){var r=this,o=n.DS,a=n.settings;e(this,t),s(this,"_settings",{}),s(this,"s",{}),s(this,"update",(function(e){var t=e.settings,n=e.init;return r.DS.publish("Settings:updated:pre",i({settings:t},n?{init:n}:{}))})),s(this,"_update",(function(e){for(var t=function(e,t){return i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i({},M("area",e.area,t,document)),M("selectables",e.selectables,t,null)),M("autoScrollSpeed",e.autoScrollSpeed,t,5)),M("overflowTolerance",e.overflowTolerance,t,{x:25,y:25})),M("zoom",e.zoom,t,1)),M("customStyles",e.customStyles,t,!1)),M("multiSelectMode",e.multiSelectMode,t,!1)),M("multiSelectToggling",e.multiSelectToggling,t,!0)),M("multiSelectKeys",e.multiSelectKeys,t,["Control","Shift","Meta"])),M("selector",e.selector,t,null)),M("selectionThreshold",e.selectionThreshold,t,0)),M("draggability",e.draggability,t,!0)),M("immediateDrag",e.immediateDrag,t,!0)),M("keyboardDrag",e.keyboardDrag,t,!0)),M("dragKeys",e.dragKeys,t,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),M("keyboardDragSpeed",e.keyboardDragSpeed,t,10)),M("useTransform",e.useTransform,t,!0)),M("refreshMemoryRate",e.refreshMemoryRate,t,80)),M("dropZones",e.dropZones,t,[])),M("dropInsideThreshold",e.dropInsideThreshold,t,1)),M("dropTargetThreshold",e.dropTargetThreshold,t,0)),M("usePointerEvents",e.usePointerEvents,t,!1)),M("hoverClass",e.hoverClass,t,"ds-hover")),M("selectableClass",e.selectableClass,t,"ds-selectable")),M("selectedClass",e.selectedClass,t,"ds-selected")),M("selectorClass",e.selectorClass,t,"ds-selector")),M("selectorAreaClass",e.selectorAreaClass,t,"ds-selector-area")),M("droppedTargetClass",e.droppedTargetClass,t,"ds-dropped-target")),M("droppedInsideClass",e.droppedInsideClass,t,"ds-dropped-inside")),M("droppableClass",e.droppableClass,t,"ds-droppable")),M("dropZoneClass",e.dropZoneClass,t,"ds-dropzone")),M("dropZoneReadyClass",e.dropZoneReadyClass,t,"ds-dropzone-ready")),M("dropZoneTargetClass",e.dropZoneTargetClass,t,"ds-dropzone-target")),M("dropZoneInsideClass",e.dropZoneInsideClass,t,"ds-dropzone-inside"))}(e.settings,e.init),n=function(){var e,t=g(a[o],2),n=t[0],i=t[1];n in r._settings||Object.defineProperty(r.s,n,{get:function(){return r._settings[n]},set:function(e){return r.update({settings:s({},n,e)})}}),r._settings["".concat(n,":pre")]=r._settings[n],r._settings[n]=i;var l={settings:(e={},s(e,n,r._settings[n]),s(e,"".concat(n,":pre"),r._settings["".concat(n,":pre")]),e)};r.DS.publish("Settings:updated",l),r.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(t);o<a.length;o++)n()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})},te=function(){function t(n){var r=this;e(this,t),s(this,"continue",!1),s(this,"start",(function(){r.stopped=!1,r.Interaction.init()})),s(this,"break",(function(){return r.continue=!0})),s(this,"setSettings",(function(e){return r.stores.SettingsStore.update({settings:e})})),s(this,"getSelection",(function(){return r.SelectedSet.elements})),s(this,"getSelectables",(function(){return r.SelectableSet.elements})),s(this,"getInitialCursorPosition",(function(){return r.stores.PointerStore.initialVal})),s(this,"getCurrentCursorPosition",(function(){return r.stores.PointerStore.currentVal})),s(this,"getPreviousCursorPosition",(function(){return r.stores.PointerStore.lastVal})),s(this,"getInitialCursorPositionArea",(function(){return r.stores.PointerStore.initialValArea})),s(this,"getCurrentCursorPositionArea",(function(){return r.stores.PointerStore.currentValArea})),s(this,"getPreviousCursorPositionArea",(function(){return r.stores.PointerStore.lastValArea})),s(this,"isMultiSelect",(function(e){return r.stores.KeyStore.isMultiSelectKeyPressed(e)})),s(this,"isDragging",(function(){return r.Interaction.isDragging})),s(this,"getZoneByCoordinates",(function(e){var t;return null===(t=r.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),s(this,"getItemsDroppedByZoneId",(function(e){return r.DropZones.getItemsDroppedById(e)})),s(this,"getItemsInsideByZoneId",(function(e,t){return r.DropZones.getItemsInsideById(e,t)})),this.PubSub=new W({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ee({DS:this,settings:n}),this.stores.PointerStore=new J({DS:this}),this.stores.ScrollStore=new Q({DS:this}),this.stores.KeyStore=new $({DS:this}),this.Area=new H({DS:this}),this.Selector=new q({DS:this}),this.SelectorArea=new G({DS:this}),this.SelectableSet=new U({DS:this}),this.SelectedSet=new X({DS:this}),this.Selection=new Y({DS:this}),this.Drag=new R({DS:this}),this.DropZones=new B({DS:this}),this.Interaction=new F({DS:this}),function(e){for(var t=e.subscribe,n=e.publish,s=e.Interaction,r=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return i({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=g(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return t(e?"".concat(o,":").concat(e):o,(function(t){return a.forEach((function(o){return(!o.condition||o.condition(t))&&n(e?"".concat(e).concat(o.name):o.name,i(i({items:r.elements,isDragging:s.isDragging},t),o.extraData?o.extraData(t):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return r.continue=!1})),this.start()}return n(t,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(r){return t.SelectedSet.has(r)?t.removeSelection(e,n,s):t.addSelection(e,n,s)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var s=Z(e);return this.SelectableSet.addAll(s),t&&this.SelectedSet.addAll(s),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),t}();export default te; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DragSelect=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function n(e,n,s){return n&&t(e.prototype,n),s&&t(e,s),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct:function(e,t,n){var s=[null];s.push.apply(s,t);var r=new(Function.bind.apply(e,s));return n&&l(r,n.prototype),r},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,s)}function s(){return u(e,arguments,a(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),l(s,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function S(e){var t=c();return function(){var n,s=a(e);if(t){var r=a(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return p(this,n)}}function f(e,t,n){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var s=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(s){var r=Object.getOwnPropertyDescriptor(s,t);return r.get?r.get.call(n):r.value}},f(e,t,n||e)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],s=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);s=!0);}catch(e){r=!0,i=e}finally{try{s||null==a.return||a.return()}finally{if(r)throw i}}return n}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var y=function(e,t,n){var s=e.x,r=e.y,i=n.x,o=n.y;return{"+":{x:s+i,y:r+o},"-":{x:s-i,y:r-o},"*":{x:s*i,y:r*o},"/":{x:s/i,y:r/o}}[t]},D=function(e){return{x:e.left,y:e.top}},_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},I=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var s=new MutationObserver(n);e.forEach((function(e,t){s.observe(e,{childList:0!==t,attributes:!0})}));return{observer:s,callback:n,cleanup:function(){return K(s,n)}}},L=function(e,t){var n;return function(){for(var s=arguments.length,r=new Array(s),i=0;i<s;i++)r[i]=arguments[i];var o=function(){n=null,e.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,t)}},w=function(){var e,t,n,s;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(s=document.documentElement)||void 0===s?void 0:s.scrollLeft)||0}},P=function(e){return function e(t){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null===(n=t[s])||void 0===n?void 0:n.parentNode;return r?(t.push(r),e(t,++s)):t}([e])},C=function(e){return!e||e instanceof Document?w():{x:e.scrollLeft>=0?e.scrollLeft:w().x,y:e.scrollTop>=0?e.scrollTop:w().y}},A=function(e){var t=e.elementRect,n=e.containerRect,s=e.tolerance,r=void 0===s?{x:0,y:0}:s,i=[];return t.top-r.y<n.top&&i.push("top"),t.left-r.x<n.left&&i.push("left"),t.bottom+r.y>n.bottom&&i.push("bottom"),t.right+r.y>n.right&&i.push("right"),i},T=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var s=n.transform.trim().match(/matrix3d\((.*?)\)/);if(s&&s.length){var r,i=null===(r=s[1])||void 0===r?void 0:r.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},E=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return T(e);var n={x:0,y:0},s=t.trim().match(/translate[3dD]*?\(.*?\)/);if(s){var r,i=null===(r=s[0])||void 0===r?void 0:r.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:T(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var s=window.getComputedStyle(e);return{x:parseInt(s.left)||0,y:parseInt(s.top)||0}}return n}(e)},x=function(e){var t=e.computedStyle,n=e.node,s=t.position;n instanceof Document||("absolute"===s||"relative"===s||"fixed"===s)||(n.style.position="relative")},k=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},M=function(e,t,n,r){if(void 0===t)return n?s({},e,r):{};if(null===t)return s({},e,null);var i=!0,o=!1,a="string"==typeof r;a&&(i="string"==typeof t||t instanceof String),a&&!i&&(o=!0,k(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(i=!Number.isNaN(t)&&"number"==typeof t),l&&!i&&(o=!0,k(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(i="[object Object]"===Object.prototype.toString.call(t)),c&&!i&&(o=!0,k(e,"object"));var u="boolean"==typeof r;u&&(i="boolean"==typeof t),u&&!i&&(o=!0,k(e,"boolean"));var d=Array.isArray(r);d&&(i=Array.isArray(t)),d&&!i&&(o=!0,k(e,"array"));var h=o||n;return"dragKeys"===e&&i?s({},e,Object.assign(r,t)):"dragKeys"!==e||i?("dropZones"===e&&i&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?s({},e,t):h?s({},e,r):{}):h?s({},e,r):{}},V=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=e;if(n>0){var r=(e.right-e.left)*n,i=(e.bottom-e.top)*n;s={left:e.left+r,right:e.right-r,top:e.top+i,bottom:e.bottom-i}}return s.left<t.right&&s.right>t.left&&s.top<t.bottom&&s.bottom>t.top},N=function(e){var t=e.element,n=e.posDirection,s=e.containerRect,r=e.useTransform,i=E(t,r),o=y(i,"+",n);O(t,o,r);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,s=e.elementRect,r=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&O(t,{y:i.y+r.top-s.top,x:i.x},o),n.includes("left")&&O(t,{y:i.y,x:i.x+r.left-s.left},o),n.includes("bottom")&&O(t,{y:i.y+r.bottom-s.bottom,x:i.x},o),n.includes("right")&&O(t,{y:i.y,x:i.x+r.right-s.right},o)}({element:t,edges:A({elementRect:a,containerRect:s}),elementRect:a,containerRect:s,elementPos:o,useTransform:r})},K=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},O=function(e,t,n){if(n){var s=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(s.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:v(new Set(v(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"DS",void 0),s(this,"_observers",void 0),s(this,"_node",void 0),s(this,"_parentNodes",void 0),s(this,"_computedStyle",void 0),s(this,"_computedBorder",void 0),s(this,"_rect",void 0),s(this,"setArea",(function(e){r._node=e,x({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),s(this,"start",(function(){r._observers=I(r.parentNodes,L((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),s(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),s(this,"stop",(function(){r._observers.cleanup(),r.reset()})),s(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var s=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,r=e instanceof Document?s||document.body:e,i=t.includes("top")&&r.scrollTop>0,o=t.includes("bottom")&&r.scrollTop<r.scrollHeight,a=t.includes("left")&&r.scrollLeft>0,l=t.includes("right")&&r.scrollLeft<r.scrollWidth;i&&(r.scrollTop-=1*n),o&&(r.scrollTop+=1*n),a&&(r.scrollLeft-=1*n),l&&(r.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=i,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;return r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return n(t,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=P(this.HTMLNode)}}]),t}(),R=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevCursorPos",void 0),s(this,"_prevScrollPos",void 0),s(this,"_elements",[]),s(this,"_dragKeys",void 0),s(this,"_dragKeysFlat",[]),s(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(v(r._dragKeys.up),v(r._dragKeys.down),v(r._dragKeys.left),v(r._dragKeys.right))})),s(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,s=e.zoom,r=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*s:n*s;return i.left.includes(r)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(r)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(r)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(r)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return N({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),s(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),s(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),s(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),s(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=y(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return N({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),s(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=i,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return n(t,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?y(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?y(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),t}(),j=function(){function t(n){var r=this,i=n.DS,o=n.id,a=n.element,l=n.droppables;e(this,t),s(this,"id",void 0),s(this,"element",void 0),s(this,"_droppables",void 0),s(this,"_rect",void 0),s(this,"_observers",void 0),s(this,"_timeout",void 0),s(this,"_itemsDropped",[]),s(this,"_itemsInside",void 0),s(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),s(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),s(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=v(new Set([].concat(v(r._itemsDropped),v(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),s(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),s(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),s(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),s(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass)})),this._observers=I(this.parentNodes,L((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return V(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=P(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),t}(),B=function t(n){var r=this,o=n.DS;e(this,t),s(this,"_zoneByElement",new Map),s(this,"_zoneById",new Map),s(this,"_zonesByDroppable",new Map),s(this,"_zones",void 0),s(this,"setDropZones",(function(e){var t=e.dropZones;t&&(r._zones&&r._zones.forEach((function(e){return e.destroy()})),r._zones=t.map((function(e){return new j(i({DS:r.DS},e))})),r._zones.forEach((function(e){r._zoneByElement.set(e.element,e),r._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=r._zonesByDroppable.get(t);if(null==n||!n.length)return r._zonesByDroppable.set(t,[e]);r._zonesByDroppable.set(t,v(new Set([].concat(v(n),[e]))))}))})))})),s(this,"_handleDrop",(function(e){r._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),s(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,s=t.y,i=0,o=e.length;i<o;i++){var a=r._zoneByElement.get(e[i]);if(a&&V(a.rect,{left:n,right:n,top:s,bottom:s},Math.min(r.Settings.dropTargetThreshold,.5)))return a}})),s(this,"stop",(function(e){if(e.isDragging){var t=r.getTarget();r._handleDrop(t)}})),s(this,"getItemsDroppedById",(function(e){var t=r._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),s(this,"getItemsInsideById",(function(e,t){var n=r._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var s=n.itemsInside;return t&&n.handleItemsInsideClasses(),s})),s(this,"getTarget",(function(e){var t;if(null!==(t=r._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||r.DS.stores.PointerStore.currentVal.x,s=(null==e?void 0:e.y)||r.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,s);return r._getZoneByElementsFromPoint(i,{x:n,y:s})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",this.setDropZones),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)},F=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"isInteracting",void 0),s(this,"isDragging",void 0),s(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),s(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),s(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),s(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),s(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),s(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),s(this,"stop",(function(){r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(r.DS.Area.HTMLNode.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(r.DS.Area.HTMLNode.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),r.DS.Area.HTMLNode.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),s(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),s(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),s(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",this.init),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return n(t,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),t}(),W=function t(n){var r=this,i=n.DS;e(this,t),s(this,"subscribers",{}),s(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),s(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),s(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),s(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),s(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),s(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=i},U=function(t){o(i,t);var r=S(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"_rects",void 0),s(h(n),"_timeout",void 0),s(h(n),"init",(function(){return Z(n.Settings.selectables).forEach((function(e){return n.add(e)}))})),s(h(n),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"_onClick",(function(e){return n.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),s(h(n),"_onPointer",(function(e){return n.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n.Settings=o.stores.SettingsStore.s,n.DS.subscribe("Interaction:init",n.init),n.DS.PubSub.subscribe("Settings:updated:selectables",(function(){n.clear(),n.init()})),n.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;n.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&x({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),f(a(i.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),f(a(i.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),i}(d(Set)),X=function(t){o(i,t);var r=S(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),f(a(i.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=f(a(i.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),i}(d(Set)),Y=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevSelectedSet",void 0),s(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),s(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),s(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=[],c=[],u=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(i.rects);try{for(u.s();!(n=u.n()).done;){var d=g(n.value,2),h=d[0],p=d[1];o.isInside(h,p)&&(V(p,a.rect,r.Settings.selectionThreshold)?l.push(h):c.push(h))}}catch(e){u.e(e)}finally{u.f()}var S=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling;r.DS.continue||(l.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.multiSelectionToggle,r=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(r.has(t)?s&&r.delete(t):r.add(t),t.classList.add(i))}({element:t,force:e,multiSelectionToggle:S,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),c.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.SelectedSet,r=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=s.has(t),a=r.has(t);o&&!a?s.delete(t):!o&&a&&s.add(t),t.classList.remove(i)}({element:t,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})})))})),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return n(t,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,s=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(s):this._prevSelectedSet=new Set}}]),t}(),q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_rect",void 0),s(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 0, 255, 0.1)",s.style.border="1px solid rgba(0, 0, 255, 0.45)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),s(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,_(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),s(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),s(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,s=e.pointerPos,r={};return s.x>n.x-t.x?(r.left=n.x-t.x,r.width=s.x-n.x+t.x):(r.left=s.x,r.width=n.x-s.x-t.x),s.y>n.y-t.y?(r.top=n.y-t.y,r.height=s.y-n.y+t.y):(r.top=s.y,r.height=n.y-s.y-t.y),r}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=i,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),G=function(){function t(n){var r,i=this,o=n.DS;e(this,t),s(this,"_scrollInterval",void 0),s(this,"_rect",void 0),s(this,"currentEdges",[]),s(this,"start",(function(){return i.applyElements("append")})),s(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");i.HTMLNode[n](i.DS.Selector.HTMLNode),document[t][n](i.HTMLNode)})),s(this,"updatePos",(function(){i._rect=null;var e=i.DS.Area.rect,t=i.DS.Area.computedBorder,n=i.HTMLNode.style,s="".concat(e.top+t.top,"px"),r="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==s&&(n.top=s),n.left!==r&&(n.left=r),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),s(this,"stop",(function(e){i.stopAutoScroll(),e&&i.applyElements("remove")})),s(this,"startAutoScroll",(function(){i.currentEdges=[],i._scrollInterval=setInterval((function(){return i.handleAutoScroll()}),16)})),s(this,"handleAutoScroll",(function(){if(!i.DS.continue){var e=i.DS,t=e.stores.PointerStore,n=e.Area;i.currentEdges=A({elementRect:_(t.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&n.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}})),s(this,"stopAutoScroll",(function(){i.currentEdges=[],clearInterval(i._scrollInterval)})),s(this,"isInside",(function(e,t){return!(!i.DS.Area.HTMLNode.contains(e)||!i.DS.stores.ScrollStore.canScroll)||V(i.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;i.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),i.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){i.updatePos(),i.stopAutoScroll()}))}return n(t,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return V({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),$=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_currentValues",new Set),s(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),s(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),s(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),s(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),s(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),s(this,"reset",(function(){return r._currentValues.clear()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return n(t,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),t}(),J=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_isMouseInteraction",!1),s(this,"_initialValArea",void 0),s(this,"_currentValArea",void 0),s(this,"_lastValArea",void 0),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_lastVal",void 0),s(this,"_lastTouch",void 0),s(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),s(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),s(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),s(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),s(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return n(t,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}}]),t}(),Q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_canScroll",void 0),s(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"start",(function(){r._currentVal=r._initialVal=C(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"update",(function(){return r._currentVal=C(r.DS.stores.SettingsStore.s.area)})),s(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),s(this,"reset",(function(){r.stop(),r.start()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return n(t,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=C(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=y(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},s=y(y(t,"*",n),"-",t);return{x:t.x+s.x,y:t.y+s.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=C(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),t}(),ee=function t(n){var r=this,o=n.DS,a=n.settings;e(this,t),s(this,"_settings",{}),s(this,"s",{}),s(this,"update",(function(e){var t=e.settings,n=e.init;return r.DS.publish("Settings:updated:pre",i({settings:t},n?{init:n}:{}))})),s(this,"_update",(function(e){for(var t=function(e,t){return i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i({},M("area",e.area,t,document)),M("selectables",e.selectables,t,null)),M("autoScrollSpeed",e.autoScrollSpeed,t,5)),M("overflowTolerance",e.overflowTolerance,t,{x:25,y:25})),M("zoom",e.zoom,t,1)),M("customStyles",e.customStyles,t,!1)),M("multiSelectMode",e.multiSelectMode,t,!1)),M("multiSelectToggling",e.multiSelectToggling,t,!0)),M("multiSelectKeys",e.multiSelectKeys,t,["Control","Shift","Meta"])),M("selector",e.selector,t,null)),M("selectionThreshold",e.selectionThreshold,t,0)),M("draggability",e.draggability,t,!0)),M("immediateDrag",e.immediateDrag,t,!0)),M("keyboardDrag",e.keyboardDrag,t,!0)),M("dragKeys",e.dragKeys,t,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),M("keyboardDragSpeed",e.keyboardDragSpeed,t,10)),M("useTransform",e.useTransform,t,!0)),M("refreshMemoryRate",e.refreshMemoryRate,t,80)),M("dropZones",e.dropZones,t,[])),M("dropInsideThreshold",e.dropInsideThreshold,t,1)),M("dropTargetThreshold",e.dropTargetThreshold,t,0)),M("usePointerEvents",e.usePointerEvents,t,!1)),M("hoverClass",e.hoverClass,t,"ds-hover")),M("selectableClass",e.selectableClass,t,"ds-selectable")),M("selectedClass",e.selectedClass,t,"ds-selected")),M("selectorClass",e.selectorClass,t,"ds-selector")),M("selectorAreaClass",e.selectorAreaClass,t,"ds-selector-area")),M("droppedTargetClass",e.droppedTargetClass,t,"ds-dropped-target")),M("droppedInsideClass",e.droppedInsideClass,t,"ds-dropped-inside")),M("droppableClass",e.droppableClass,t,"ds-droppable")),M("dropZoneClass",e.dropZoneClass,t,"ds-dropzone")),M("dropZoneReadyClass",e.dropZoneReadyClass,t,"ds-dropzone-ready")),M("dropZoneTargetClass",e.dropZoneTargetClass,t,"ds-dropzone-target")),M("dropZoneInsideClass",e.dropZoneInsideClass,t,"ds-dropzone-inside"))}(e.settings,e.init),n=function(){var e,t=g(a[o],2),n=t[0],i=t[1];n in r._settings||Object.defineProperty(r.s,n,{get:function(){return r._settings[n]},set:function(e){return r.update({settings:s({},n,e)})}}),r._settings["".concat(n,":pre")]=r._settings[n],r._settings[n]=i;var l={settings:(e={},s(e,n,r._settings[n]),s(e,"".concat(n,":pre"),r._settings["".concat(n,":pre")]),e)};r.DS.publish("Settings:updated",l),r.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(t);o<a.length;o++)n()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})},te=function(){function t(n){var r=this;e(this,t),s(this,"continue",!1),s(this,"start",(function(){r.stopped=!1,r.Interaction.init()})),s(this,"break",(function(){return r.continue=!0})),s(this,"setSettings",(function(e){return r.stores.SettingsStore.update({settings:e})})),s(this,"getSelection",(function(){return r.SelectedSet.elements})),s(this,"getSelectables",(function(){return r.SelectableSet.elements})),s(this,"getInitialCursorPosition",(function(){return r.stores.PointerStore.initialVal})),s(this,"getCurrentCursorPosition",(function(){return r.stores.PointerStore.currentVal})),s(this,"getPreviousCursorPosition",(function(){return r.stores.PointerStore.lastVal})),s(this,"getInitialCursorPositionArea",(function(){return r.stores.PointerStore.initialValArea})),s(this,"getCurrentCursorPositionArea",(function(){return r.stores.PointerStore.currentValArea})),s(this,"getPreviousCursorPositionArea",(function(){return r.stores.PointerStore.lastValArea})),s(this,"isMultiSelect",(function(e){return r.stores.KeyStore.isMultiSelectKeyPressed(e)})),s(this,"isDragging",(function(){return r.Interaction.isDragging})),s(this,"getZoneByCoordinates",(function(e){var t;return null===(t=r.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),s(this,"getItemsDroppedByZoneId",(function(e){return r.DropZones.getItemsDroppedById(e)})),s(this,"getItemsInsideByZoneId",(function(e,t){return r.DropZones.getItemsInsideById(e,t)})),this.PubSub=new W({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ee({DS:this,settings:n}),this.stores.PointerStore=new J({DS:this}),this.stores.ScrollStore=new Q({DS:this}),this.stores.KeyStore=new $({DS:this}),this.Area=new H({DS:this}),this.Selector=new q({DS:this}),this.SelectorArea=new G({DS:this}),this.SelectableSet=new U({DS:this}),this.SelectedSet=new X({DS:this}),this.Selection=new Y({DS:this}),this.Drag=new R({DS:this}),this.DropZones=new B({DS:this}),this.Interaction=new F({DS:this}),function(e){for(var t=e.subscribe,n=e.publish,s=e.Interaction,r=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return i({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=g(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return t(e?"".concat(o,":").concat(e):o,(function(t){return a.forEach((function(o){return(!o.condition||o.condition(t))&&n(e?"".concat(e).concat(o.name):o.name,i(i({items:r.elements,isDragging:s.isDragging},t),o.extraData?o.extraData(t):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return r.continue=!1})),this.start()}return n(t,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(r){return t.SelectedSet.has(r)?t.removeSelection(e,n,s):t.addSelection(e,n,s)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var s=Z(e);return this.SelectableSet.addAll(s),t&&this.SelectedSet.addAll(s),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),t}();return te})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DragSelect=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function n(e,n,s){return n&&t(e.prototype,n),s&&t(e,s),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,t,n){return u=c()?Reflect.construct:function(e,t,n){var s=[null];s.push.apply(s,t);var r=new(Function.bind.apply(e,s));return n&&l(r,n.prototype),r},u.apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,s)}function s(){return u(e,arguments,a(this).constructor)}return s.prototype=Object.create(e.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),l(s,e)},d(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function S(e){var t=c();return function(){var n,s=a(e);if(t){var r=a(this).constructor;n=Reflect.construct(s,arguments,r)}else n=s.apply(this,arguments);return p(this,n)}}function f(e,t,n){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var s=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(s){var r=Object.getOwnPropertyDescriptor(s,t);return r.get?r.get.call(n):r.value}},f(e,t,n||e)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],s=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);s=!0);}catch(e){r=!0,i=e}finally{try{s||null==a.return||a.return()}finally{if(r)throw i}}return n}(e,t)||b(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||b(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}var y=function(e,t,n){var s=e.x,r=e.y,i=n.x,o=n.y;return{"+":{x:s+i,y:r+o},"-":{x:s-i,y:r-o},"*":{x:s*i,y:r*o},"/":{x:s/i,y:r/o}}[t]},D=function(e){return{x:e.left,y:e.top}},_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{left:e.x,top:e.y,right:e.x,bottom:e.y,width:t,height:t}},I=function(e,t){var n=t;window.addEventListener("resize",n),window.addEventListener("scroll",n);var s=new MutationObserver(n);e.forEach((function(e,t){s.observe(e,{childList:0!==t,attributes:!0})}));return{observer:s,callback:n,cleanup:function(){return K(s,n)}}},L=function(e,t){var n;return function(){for(var s=arguments.length,r=new Array(s),i=0;i<s;i++)r[i]=arguments[i];var o=function(){n=null,e.apply(void 0,r)};clearTimeout(n),n=setTimeout(o,t)}},w=function(){var e,t,n,s;return{y:(null===(e=document.body)||void 0===e?void 0:e.scrollTop)||(null===(t=document.documentElement)||void 0===t?void 0:t.scrollTop)||0,x:(null===(n=document.body)||void 0===n?void 0:n.scrollLeft)||(null===(s=document.documentElement)||void 0===s?void 0:s.scrollLeft)||0}},P=function(e){return function e(t){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=null===(n=t[s])||void 0===n?void 0:n.parentNode;return r?(t.push(r),e(t,++s)):t}([e])},C=function(e){return!e||e instanceof Document?w():{x:e.scrollLeft>=0?e.scrollLeft:w().x,y:e.scrollTop>=0?e.scrollTop:w().y}},A=function(e){var t=e.elementRect,n=e.containerRect,s=e.tolerance,r=void 0===s?{x:0,y:0}:s,i=[];return t.top-r.y<n.top&&i.push("top"),t.left-r.x<n.left&&i.push("left"),t.bottom+r.y>n.bottom&&i.push("bottom"),t.right+r.y>n.right&&i.push("right"),i},T=function(e){var t={x:0,y:0},n=window.getComputedStyle(e);if(!n.transform||"none"===n.transform)return t;if(n.transform.indexOf("3d")>=0){var s=n.transform.trim().match(/matrix3d\((.*?)\)/);if(s&&s.length){var r,i=null===(r=s[1])||void 0===r?void 0:r.split(",");t.x=parseInt(i[12])||0,t.y=parseInt(i[13])||0}return t}var o=n.transform.trim().match(/matrix\((.*?)\)/);if(o&&o.length){var a,l=null===(a=o[1])||void 0===a?void 0:a.split(",");t.x=parseInt(l[4])||0,t.y=parseInt(l[5])||0}return t},E=function(e,t){return t?function(e){var t=e.style.transform;if(!t||t.indexOf("translate")<0)return T(e);var n={x:0,y:0},s=t.trim().match(/translate[3dD]*?\(.*?\)/);if(s){var r,i=null===(r=s[0])||void 0===r?void 0:r.split("(");if(i){var o,a=null===(o=i[1])||void 0===o?void 0:o.split(",");n.x=parseInt(a[0])||0,n.y=parseInt(a[1])||0}}return n.x||n.x?n:T(e)}(e):function(e){var t=e.style,n={x:parseInt(t.left)||0,y:parseInt(t.top)||0};if(!n.x&&!n.x){var s=window.getComputedStyle(e);return{x:parseInt(s.left)||0,y:parseInt(s.top)||0}}return n}(e)},x=function(e){var t=e.computedStyle,n=e.node,s=t.position;n instanceof Document||("absolute"===s||"relative"===s||"fixed"===s)||(n.style.position="relative")},k=function(e,t,n){return console.warn('[DragSelect] TypeIssue: setting "'.concat(e,'" is not of type "').concat(t,'".'))},M=function(e,t,n,r){if(void 0===t)return n?s({},e,r):{};if(null===t)return s({},e,null);var i=!0,o=!1,a="string"==typeof r;a&&(i="string"==typeof t||t instanceof String),a&&!i&&(o=!0,k(e,"string"));var l=!Number.isNaN(r)&&"number"==typeof r;l&&(i=!Number.isNaN(t)&&"number"==typeof t),l&&!i&&(o=!0,k(e,"number"));var c="[object Object]"===Object.prototype.toString.call(r);c&&(i="[object Object]"===Object.prototype.toString.call(t)),c&&!i&&(o=!0,k(e,"object"));var u="boolean"==typeof r;u&&(i="boolean"==typeof t),u&&!i&&(o=!0,k(e,"boolean"));var d=Array.isArray(r);d&&(i=Array.isArray(t)),d&&!i&&(o=!0,k(e,"array"));var h=o||n;return"dragKeys"===e&&i?s({},e,Object.assign(r,t)):"dragKeys"!==e||i?("dropZones"===e&&i&&new Set(t.map((function(e){return e.id}))).size!==t.length&&console.warn('[DragSelect] UniqueConstraintsIssue: setting "dropZones" contains duplicate ids.'),i?s({},e,t):h?s({},e,r):{}):h?s({},e,r):{}},V=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=e;if(n>0){var r=(e.right-e.left)*n,i=(e.bottom-e.top)*n;s={left:e.left+r,right:e.right-r,top:e.top+i,bottom:e.bottom-i}}return s.left<t.right&&s.right>t.left&&s.top<t.bottom&&s.bottom>t.top},N=function(e){var t=e.element,n=e.posDirection,s=e.containerRect,r=e.useTransform,i=E(t,r),o=y(i,"+",n);O(t,o,r);var a=t.getBoundingClientRect();!function(e){var t=e.element,n=e.edges,s=e.elementRect,r=e.containerRect,i=e.elementPos,o=e.useTransform;n.includes("top")&&O(t,{y:i.y+r.top-s.top,x:i.x},o),n.includes("left")&&O(t,{y:i.y,x:i.x+r.left-s.left},o),n.includes("bottom")&&O(t,{y:i.y+r.bottom-s.bottom,x:i.x},o),n.includes("right")&&O(t,{y:i.y,x:i.x+r.right-s.right},o)}({element:t,edges:A({elementRect:a,containerRect:s}),elementRect:a,containerRect:s,elementPos:o,useTransform:r})},K=function(e,t){window.removeEventListener("resize",t),window.removeEventListener("scroll",t),e.disconnect()},O=function(e,t,n){if(n){var s=e.style.transform;e.style.transform="translate3d(".concat(t.x,"px,").concat(t.y,"px,1px) ").concat(s.replace(/translate.*?\)/g,""))}else e.style.left="".concat(t.x,"px"),e.style.top="".concat(t.y,"px");return e},Z=function(e){return e?!Array.isArray(e)&&(e instanceof HTMLElement||e instanceof SVGElement)?[e]:v(new Set(v(e))):[]},z=function(e,t){e.style.left="".concat(t.left,"px"),e.style.top="".concat(t.top,"px"),e.style.width="".concat(t.width,"px"),e.style.height="".concat(t.height,"px")},H=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"DS",void 0),s(this,"_observers",void 0),s(this,"_node",void 0),s(this,"_parentNodes",void 0),s(this,"_computedStyle",void 0),s(this,"_computedBorder",void 0),s(this,"_rect",void 0),s(this,"setArea",(function(e){r._node=e,x({computedStyle:r.computedStyle,node:r._node}),setTimeout((function(){r.DS.PubSub.publish("Area:modified:pre",{item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{item:r})}))})),s(this,"start",(function(){r._observers=I(r.parentNodes,L((function(e){r.DS.PubSub.publish("Area:modified:pre",{event:e,item:r}),r.reset(),r.DS.PubSub.publish("Area:modified",{event:e,item:r})}),60))})),s(this,"reset",(function(){r._computedStyle=void 0,r._rect=void 0,r._computedBorder=void 0,r._parentNodes=void 0})),s(this,"stop",(function(){r._observers.cleanup(),r.reset()})),s(this,"scroll",(function(e,t){var n={scroll_directions:e,scroll_multiplier:t};r.DS.PubSub.publish("Area:scroll:pre",n),function(e,t,n){if(t.length){var s=document&&document.documentElement&&document.documentElement.scrollTop&&document.documentElement,r=e instanceof Document?s||document.body:e,i=t.includes("top")&&r.scrollTop>0,o=t.includes("bottom")&&r.scrollTop<r.scrollHeight,a=t.includes("left")&&r.scrollLeft>0,l=t.includes("right")&&r.scrollLeft<r.scrollWidth;i&&(r.scrollTop-=1*n),o&&(r.scrollTop+=1*n),a&&(r.scrollLeft-=1*n),l&&(r.scrollLeft+=1*n)}}(r._node,e,t),r.DS.PubSub.publish("Area:scroll",n)})),this.DS=i,this.setArea(this.DS.stores.SettingsStore.s.area),this.DS.PubSub.subscribe("Settings:updated:area",(function(e){var t=e.settings;return r.setArea(t.area)})),this.DS.PubSub.subscribe("Interaction:init",this.start),this.DS.PubSub.subscribe("Interaction:end",this.reset)}return n(t,[{key:"HTMLNode",get:function(){return this._node}},{key:"computedBorder",get:function(){return this._computedBorder?this._computedBorder:{top:parseInt(this.computedStyle.borderTopWidth),bottom:parseInt(this.computedStyle.borderBottomWidth),left:parseInt(this.computedStyle.borderLeftWidth),right:parseInt(this.computedStyle.borderRightWidth)}}},{key:"computedStyle",get:function(){return this._computedStyle?this._computedStyle:this.HTMLNode instanceof Document?this._computedStyle=window.getComputedStyle(this.HTMLNode.body||this.HTMLNode.documentElement):this._computedStyle=window.getComputedStyle(this.HTMLNode)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=function(e,t){if(e instanceof Document)return{top:0,left:0,bottom:0,right:0,width:window.innerWidth,height:window.innerHeight};var n=e.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.bottom,right:n.right,width:(e.clientWidth||n.width)*t,height:(e.clientHeight||n.height)*t}}(this.HTMLNode,this.DS.stores.SettingsStore.s.zoom)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=P(this.HTMLNode)}}]),t}(),R=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevCursorPos",void 0),s(this,"_prevScrollPos",void 0),s(this,"_elements",[]),s(this,"_dragKeys",void 0),s(this,"_dragKeysFlat",[]),s(this,"assignDragkeys",(function(){r._dragKeys={up:r.DS.stores.SettingsStore.s.dragKeys.up.map((function(e){return e.toLowerCase()})),down:r.DS.stores.SettingsStore.s.dragKeys.down.map((function(e){return e.toLowerCase()})),left:r.DS.stores.SettingsStore.s.dragKeys.left.map((function(e){return e.toLowerCase()})),right:r.DS.stores.SettingsStore.s.dragKeys.right.map((function(e){return e.toLowerCase()}))},r._dragKeysFlat=[].concat(v(r._dragKeys.up),v(r._dragKeys.down),v(r._dragKeys.left),v(r._dragKeys.right))})),s(this,"keyboardDrag",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability&&!r.DS.continue){var s={event:t,isDragging:!0,isDraggingKeyboard:!0};r.DS.publish(["Interaction:start:pre","Interaction:start"],s),r._elements=r.DS.getSelection(),r.handleZIndex(!0);var i=function(e){var t=e.shiftKey,n=e.keyboardDragSpeed,s=e.zoom,r=e.key,i=e.dragKeys,o=e.scrollDiff,a=e.canScroll,l=e.scrollCallback,c={x:0,y:0},u=t?4*n*s:n*s;return i.left.includes(r)&&(c.x=o.x||-u,t||o.x||!a||l(["left"],n)),i.right.includes(r)&&(c.x=o.x||u,t||o.x||!a||l(["right"],n)),i.up.includes(r)&&(c.y=o.y||-u,t||o.y||!a||l(["top"],n)),i.down.includes(r)&&(c.y=o.y||u,t||o.y||!a||l(["bottom"],n)),c}({shiftKey:r.DS.stores.KeyStore.currentValues.includes("shift"),keyboardDragSpeed:r.DS.stores.SettingsStore.s.keyboardDragSpeed,zoom:r.DS.stores.SettingsStore.s.zoom,key:n,scrollCallback:r.DS.Area.scroll,scrollDiff:r._scrollDiff,canScroll:r.DS.stores.ScrollStore.canScroll,dragKeys:r._dragKeys});r._elements.forEach((function(e){return N({element:e,posDirection:i,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})})),r.DS.publish(["Interaction:update:pre","Interaction:update"],s)}})),s(this,"keyboardEnd",(function(e){var t=e.event,n=e.key.toLowerCase();if(r.DS.stores.SettingsStore.s.keyboardDrag&&r._dragKeysFlat.includes(n)&&r.DS.SelectedSet.size&&r.DS.stores.SettingsStore.s.draggability){var s={event:t,isDragging:r.DS.stores.SettingsStore.s.draggability,isDraggingKeyboard:!0};r.DS.publish(["Interaction:end:pre","Interaction:end"],s)}})),s(this,"start",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;t&&!n&&(r._prevCursorPos=null,r._prevScrollPos=null,r._elements=r.DS.getSelection(),r.handleZIndex(!0))})),s(this,"stop",(function(e){null!=e&&e.isKeyboard||(r._prevCursorPos=null,r._prevScrollPos=null,r.handleZIndex(!1),r._elements=[])})),s(this,"update",(function(e){var t=e.isDragging,n=e.isDraggingKeyboard;if(t&&r._elements.length&&!n&&!r.DS.continue){var s=y(r._cursorDiff,"+",r._scrollDiff);r._elements.forEach((function(e){return N({element:e,posDirection:s,containerRect:r.DS.SelectorArea.rect,useTransform:r.DS.stores.SettingsStore.s.useTransform})}))}})),s(this,"handleZIndex",(function(e){r._elements.forEach((function(t){return t.style.zIndex="".concat((parseInt(t.style.zIndex)||0)+e?9999:-9998)}))})),this.DS=i,this.DS.subscribe("Settings:updated:dragKeys",this.assignDragkeys),this.assignDragkeys(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("KeyStore:down",this.keyboardDrag),this.DS.subscribe("KeyStore:up",this.keyboardEnd)}return n(t,[{key:"_cursorDiff",get:function(){var e=this.DS.stores.PointerStore.currentVal,t=this._prevCursorPos?y(e,"-",this._prevCursorPos):{x:0,y:0};return this._prevCursorPos=e,t}},{key:"_scrollDiff",get:function(){var e=this.DS.stores.ScrollStore.currentVal,t=this._prevScrollPos?y(e,"-",this._prevScrollPos):{x:0,y:0};return this._prevScrollPos=e,t}}]),t}(),j=function(){function t(n){var r=this,i=n.DS,o=n.id,a=n.element,l=n.droppables;e(this,t),s(this,"id",void 0),s(this,"element",void 0),s(this,"_droppables",void 0),s(this,"_rect",void 0),s(this,"_observers",void 0),s(this,"_timeout",void 0),s(this,"_itemsDropped",[]),s(this,"_itemsInside",void 0),s(this,"setReadyClasses",(function(e){if(!r.isDestroyed){var t=r.droppables.filter((function(e){return r.DS.SelectedSet.has(e)}));t.length&&(t.forEach((function(t){t.classList[e]("".concat(r.Settings.droppableClass)),t.classList[e]("".concat(r.Settings.droppableClass,"-").concat(r.id))})),r.element.classList[e]("".concat(r.Settings.dropZoneReadyClass)))}})),s(this,"handleNoDrop",(function(){var e;r.isDestroyed||(r.DS.SelectedSet.forEach((function(e){e.classList.remove(r.Settings.droppedTargetClass),e.classList.remove("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),r._itemsDropped=r._itemsDropped.filter((function(e){return!r.DS.SelectedSet.has(e)})),null!==(e=r._itemsDropped)&&void 0!==e&&e.length||r.element.classList.remove("".concat(r.Settings.dropZoneTargetClass)))})),s(this,"handleDrop",(function(){var e,t,n;r.isDestroyed||(r._itemsDropped=v(new Set([].concat(v(r._itemsDropped),v(null===(e=r.droppables)||void 0===e?void 0:e.filter((function(e){return r.DS.SelectedSet.has(e)})))))),null===(t=r._itemsDropped)||void 0===t||t.forEach((function(e){e.classList.add("".concat(r.Settings.droppedTargetClass)),e.classList.add("".concat(r.Settings.droppedTargetClass,"-").concat(r.id))})),null!==(n=r._itemsDropped)&&void 0!==n&&n.length&&r.element.classList.add("".concat(r.Settings.dropZoneTargetClass)))})),s(this,"handleItemsInsideClasses",(function(){var e=!1;r.droppables.forEach((function(t){r.itemsInside.includes(t)?(t.classList.add("".concat(r.Settings.droppedInsideClass)),t.classList.add("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),e=!0):(t.classList.remove("".concat(r.Settings.droppedInsideClass,"-").concat(r.id)),t.className.includes("".concat(r.Settings.droppedInsideClass,"-"))||t.classList.remove("".concat(r.Settings.droppedInsideClass)))})),e?r.element.classList.add("".concat(r.Settings.dropZoneInsideClass)):r.element.classList.remove("".concat(r.Settings.dropZoneInsideClass))})),s(this,"start",(function(e){e.isDragging&&!r.isDestroyed&&r.setReadyClasses("add")})),s(this,"stop",(function(e){e.isDragging&&!r.isDestroyed&&(r.setReadyClasses("remove"),r.handleItemsInsideClasses())})),s(this,"toObject",(function(){return{id:r.id,element:r.element,droppables:r.droppables,itemsDropped:r.itemsDropped,itemsInside:r.itemsInside}})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.id=o,this.element=a,l&&(this.droppables=Z(l)),this.element.classList.add("".concat(this.Settings.dropZoneClass)),this.DS.subscribe("Settings:updated:dropZoneClass",(function(e){var t=e.settings;r.element.classList.remove(t["dropZoneClass:pre"]),r.element.classList.add(t.dropZoneClass)})),this._observers=I(this.parentNodes,L((function(){return r._rect=null}),this.Settings.refreshMemoryRate)),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{key:"destroy",value:function(){var e=this;this._observers.cleanup(),this.element.classList.remove("".concat(this.Settings.dropZoneClass)),this.element.classList.remove("".concat(this.Settings.dropZoneTargetClass)),this.element.classList.remove("".concat(this.Settings.dropZoneReadyClass)),this.droppables.forEach((function(t){t.classList.remove("".concat(e.Settings.droppedTargetClass)),t.classList.remove("".concat(e.Settings.droppedTargetClass,"-").concat(e.id)),t.classList.remove("".concat(e.Settings.droppableClass)),t.classList.remove("".concat(e.Settings.droppableClass,"-").concat(e.id))})),this.DS.unsubscribe("Interaction:start",this.start),this.DS.unsubscribe("Interaction:end",this.stop),this.element=null,this.droppables=null,this.id=null,this._itemsDropped=null,this._itemsInside=null,this.isDestroyed=!0}},{key:"rect",get:function(){return this.isDestroyed?null:this._rect?this._rect:this._rect=this.element.getBoundingClientRect()}},{key:"itemsDropped",get:function(){return this.isDestroyed?null:this._itemsDropped}},{key:"itemsInside",get:function(){var e=this;return this.isDestroyed?null:(this._itemsInside||(this._itemsInside=this.droppables.flatMap((function(t){return V(e.DS.SelectableSet.rects.get(t),e.rect,e.Settings.dropInsideThreshold)?[t]:[]})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._itemsInside=null}),this.Settings.refreshMemoryRate)),this._itemsInside)}},{key:"parentNodes",get:function(){return this._parentNodes?this._parentNodes:this._parentNodes=P(this.element)}},{key:"droppables",get:function(){return this._droppables?this._droppables:this.DS.SelectableSet.elements},set:function(e){this._droppables=e}}]),t}(),B=function t(n){var r=this,o=n.DS;e(this,t),s(this,"_zoneByElement",new Map),s(this,"_zoneById",new Map),s(this,"_zonesByDroppable",new Map),s(this,"_zones",void 0),s(this,"setDropZones",(function(e){var t=e.dropZones;t&&(r._zones&&r._zones.forEach((function(e){return e.destroy()})),r._zones=t.map((function(e){return new j(i({DS:r.DS},e))})),r._zones.forEach((function(e){r._zoneByElement.set(e.element,e),r._zoneById.set(e.id,e),e.droppables.forEach((function(t){var n=r._zonesByDroppable.get(t);if(null==n||!n.length)return r._zonesByDroppable.set(t,[e]);r._zonesByDroppable.set(t,v(new Set([].concat(v(n),[e]))))}))})))})),s(this,"_handleDrop",(function(e){r._zones.forEach((function(t){t!==e&&t.handleNoDrop()})),e&&e.handleDrop()})),s(this,"_getZoneByElementsFromPoint",(function(e,t){for(var n=t.x,s=t.y,i=0,o=e.length;i<o;i++){var a=r._zoneByElement.get(e[i]);if(a&&V(a.rect,{left:n,right:n,top:s,bottom:s},Math.min(r.Settings.dropTargetThreshold,.5)))return a}})),s(this,"stop",(function(e){if(e.isDragging){var t=r.getTarget();r._handleDrop(t)}})),s(this,"getItemsDroppedById",(function(e){var t=r._zoneById.get(e);return t?t.itemsDropped:console.warn("[DragSelect] No zone found (id: ".concat(e,")"))})),s(this,"getItemsInsideById",(function(e,t){var n=r._zoneById.get(e);if(!n)return console.warn("[DragSelect] No zone found (id: ".concat(e,")"));var s=n.itemsInside;return t&&n.handleItemsInsideClasses(),s})),s(this,"getTarget",(function(e){var t;if(null!==(t=r._zones)&&void 0!==t&&t.length){var n=(null==e?void 0:e.x)||r.DS.stores.PointerStore.currentVal.x,s=(null==e?void 0:e.y)||r.DS.stores.PointerStore.currentVal.y,i=document.elementsFromPoint(n,s);return r._getZoneByElementsFromPoint(i,{x:n,y:s})}})),this.DS=o,this.Settings=o.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:dropZones",(function(e){var t=e.settings;return r.setDropZones(t)})),this.setDropZones({dropZones:this.DS.stores.SettingsStore.s.dropZones}),this.DS.subscribe("Interaction:end",this.stop)},F=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"isInteracting",void 0),s(this,"isDragging",void 0),s(this,"init",(function(){return r.DS.publish("Interaction:init:pre",{})})),s(this,"_init",(function(){r.stop(),r.Settings.usePointerEvents?r.DS.Area.HTMLNode.addEventListener("pointerdown",r.start,{passive:!1}):r.DS.Area.HTMLNode.addEventListener("mousedown",r.start),r.DS.Area.HTMLNode.addEventListener("touchstart",r.start,{passive:!1}),r.DS.publish("Interaction:init",{})})),s(this,"start",(function(e){return r.DS.publish("Interaction:start:pre",{event:e,isDragging:r.isDragging})})),s(this,"_start",(function(e){"touchstart"===e.type&&e.preventDefault(),r._canInteract(e)&&(r.isInteracting=!0,r.isDragging=r.isDragEvent(e),r.DS.publish("Interaction:start",{event:e,isDragging:r.isDragging}),r.Settings.usePointerEvents?(document.addEventListener("pointerup",r.reset),document.addEventListener("pointercancel",r.reset)):document.addEventListener("mouseup",r.reset),document.addEventListener("touchend",r.reset))})),s(this,"isDragEvent",(function(e){var t=e.target.closest(".".concat(r.Settings.selectableClass));return!(!r.Settings.draggability||r.DS.stores.KeyStore.isMultiSelectKeyPressed(e)||!t)&&(r.Settings.immediateDrag&&(r.DS.SelectedSet.size?r.DS.SelectedSet.has(t)||(r.DS.SelectedSet.clear(),r.DS.SelectedSet.add(t)):r.DS.SelectedSet.add(t)),!!r.DS.SelectedSet.has(t))})),s(this,"onClick",(function(e){var t=e.event;if(r._canInteract(t)&&!(t.detail>0)){var n=r.DS,s=n.stores,i=s.PointerStore,o=s.KeyStore,a=n.SelectableSet,l=n.SelectedSet;i.start(t);var c=t.target;a.has(c)&&(o.isMultiSelectKeyPressed(t)||l.clear(),l.toggle(c),r.reset())}})),s(this,"stop",(function(){r.isInteracting=!1,r.isDragging=!1,r.Settings.usePointerEvents?(r.DS.Area.HTMLNode.removeEventListener("pointerdown",r.start,{passive:!1}),document.removeEventListener("pointerup",r.reset),document.removeEventListener("pointercancel",r.reset)):(r.DS.Area.HTMLNode.removeEventListener("mousedown",r.start),document.removeEventListener("mouseup",r.reset)),r.DS.Area.HTMLNode.removeEventListener("touchstart",r.start,{passive:!1}),document.removeEventListener("touchend",r.reset)})),s(this,"update",(function(e){var t=e.event,n=e.scroll_directions,s=e.scroll_multiplier;r.isInteracting&&r.DS.publish(["Interaction:update:pre","Interaction:update"],{event:t,scroll_directions:n,scroll_multiplier:s,isDragging:r.isDragging})})),s(this,"reset",(function(e){return r.DS.publish("Interaction:end:pre",{event:e,isDragging:r.isDragging})})),s(this,"_reset",(function(e){var t=r.isDragging;r.stop(),r.init(),r.DS.publish("Interaction:end",{event:e,isDragging:t})})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Settings:updated:area",this.init),this.DS.subscribe("PointerStore:updated",this.update),this.DS.subscribe("Selectable:click",this.onClick),this.DS.subscribe("Selectable:pointer",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:start:pre",(function(e){var t=e.event;return r._start(t)})),this.DS.subscribe("Interaction:init:pre",this._init),this.DS.subscribe("Interaction:end:pre",(function(e){var t=e.event;return r._reset(t)})),this.DS.subscribe("Area:scroll",this.update)}return n(t,[{key:"_canInteract",value:function(e){var t=0===e.clientX&&0===e.clientY&&0===e.detail&&e.target;return!(2===e.button||this.isInteracting||e.target&&!this.DS.SelectorArea.isInside(e.target)||!t&&!this.DS.SelectorArea.isClicked(e))}}]),t}(),W=function t(n){var r=this,i=n.DS;e(this,t),s(this,"subscribers",{}),s(this,"subscribe",(function(e,t){return Array.isArray(r.subscribers[e])||(r.subscribers[e]=[]),r.subscribers[e].push(t),r.subscribers[e].length-1})),s(this,"unsubscribe",(function(e,t,n){n>=0?r.subscribers[e].splice(n,1):t&&(r.subscribers[e]=r.subscribers[e].filter((function(e){return e!==t})))})),s(this,"publish",(function(e,t){Array.isArray(e)?e.forEach((function(e){return r._publish(e,t)})):r._publish(e,t)})),s(this,"_publish",(function(e,t){var n=r.subscribers[e];Array.isArray(n)&&(e.includes(":pre")?r._handlePrePublish(n,t):r._handlePublish(n,t))})),s(this,"_handlePublish",(function(e,t){for(var n=0,s=e.length;n<s;n++){if(r.DS.stopped)return;e[n](t)}})),s(this,"_handlePrePublish",(function(e,t){for(var n=e.length;n--;){if(r.DS.stopped)return;e[n](t)}})),this.DS=i},U=function(t){o(i,t);var r=S(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"_rects",void 0),s(h(n),"_timeout",void 0),s(h(n),"init",(function(){return Z(n.Settings.selectables).forEach((function(e){return n.add(e)}))})),s(h(n),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"_onClick",(function(e){return n.DS.publish(["Selectable:click:pre","Selectable:click"],{event:e})})),s(h(n),"_onPointer",(function(e){return n.DS.publish(["Selectable:pointer:pre","Selectable:pointer"],{event:e})})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n.Settings=o.stores.SettingsStore.s,n.DS.subscribe("Interaction:init",n.init),n.DS.PubSub.subscribe("Settings:updated:selectables",(function(){n.clear(),n.init()})),n.DS.subscribe("Settings:updated:selectableClass",(function(e){var t=e.settings;n.forEach((function(e){e.classList.remove(t["selectableClass:pre"]),e.classList.add(t.selectableClass)}))})),n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:added:pre",t),e.classList.add(this.Settings.selectableClass),e.addEventListener("click",this._onClick),this.Settings.usePointerEvents?e.addEventListener("pointerdown",this._onPointer,{passive:!1}):e.addEventListener("mousedown",this._onPointer),e.addEventListener("touchstart",this._onPointer,{passive:!1}),this.Settings.draggability&&!this.Settings.useTransform&&x({computedStyle:window.getComputedStyle(e),node:e}),this.DS.publish("Selectable:added",t),f(a(i.prototype),"add",this).call(this,e)}}},{key:"delete",value:function(e){if(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selectable:removed:pre",t),e.classList.remove(this.Settings.selectableClass),e.classList.remove(this.Settings.hoverClass),e.removeEventListener("click",this._onClick),this.Settings.usePointerEvents?e.removeEventListener("pointerdown",this._onPointer,{passive:!1}):e.removeEventListener("mousedown",this._onPointer),e.removeEventListener("touchstart",this._onPointer,{passive:!1}),this.DS.publish("Selectable:removed",t),f(a(i.prototype),"delete",this).call(this,e)}}},{key:"elements",get:function(){return Array.from(this.values())}},{key:"rects",get:function(){var e=this;return this._rects||(this._rects=new Map,this.forEach((function(t){return e._rects.set(t,t.getBoundingClientRect())})),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((function(){return e._rects=null}),this.Settings.refreshMemoryRate)),this._rects}}]),i}(d(Set)),X=function(t){o(i,t);var r=S(i);function i(t){var n,o=t.DS;return e(this,i),s(h(n=r.call(this)),"clear",(function(){return n.forEach((function(e){return n.delete(e)}))})),s(h(n),"addAll",(function(e){return e.forEach((function(e){return n.add(e)}))})),s(h(n),"deleteAll",(function(e){return e.forEach((function(e){return n.delete(e)}))})),n.DS=o,n}return n(i,[{key:"add",value:function(e){if(!f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};return this.DS.publish("Selected:added:pre",t),f(a(i.prototype),"add",this).call(this,e),e.classList.add(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)+1),this.DS.publish("Selected:added",t),this}}},{key:"delete",value:function(e){if(f(a(i.prototype),"has",this).call(this,e)){var t={items:this.elements,item:e};this.DS.publish("Selected:removed:pre",t);var n=f(a(i.prototype),"delete",this).call(this,e);return e.classList.remove(this.DS.stores.SettingsStore.s.selectedClass),e.style.zIndex="".concat((parseInt(e.style.zIndex)||0)-1),this.DS.publish("Selected:removed",t),n}}},{key:"toggle",value:function(e){return this.has(e)?this.delete(e):this.add(e),e}},{key:"elements",get:function(){return Array.from(this.values())}}]),i}(d(Set)),Y=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_prevSelectedSet",void 0),s(this,"start",(function(e){var t=e.event;e.isDragging||(r._storePrevious(t),r._handleInsideSelection(!0,t))})),s(this,"update",(function(e){e.isDragging||r.DS.continue||r._handleInsideSelection()})),s(this,"_handleInsideSelection",(function(e,t){var n,s=r.DS,i=s.SelectableSet,o=s.SelectorArea,a=s.Selector,l=[],c=[],u=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=b(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var s=0,r=function(){};return{s:r,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(i.rects);try{for(u.s();!(n=u.n()).done;){var d=g(n.value,2),h=d[0],p=d[1];o.isInside(h,p)&&(V(p,a.rect,r.Settings.selectionThreshold)?l.push(h):c.push(h))}}catch(e){u.e(e)}finally{u.f()}var S=r.DS.stores.KeyStore.isMultiSelectKeyPressed(t)&&r.Settings.multiSelectToggling;r.DS.continue||(l.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.multiSelectionToggle,r=e.SelectedSet,i=e.hoverClassName;t.classList.contains(i)&&!n||(r.has(t)?s&&r.delete(t):r.add(t),t.classList.add(i))}({element:t,force:e,multiSelectionToggle:S,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass})})),c.forEach((function(t){return function(e){var t=e.element,n=e.force,s=e.SelectedSet,r=e.PrevSelectedSet,i=e.hoverClassName;if(!t.classList.contains(i)&&!n)return!1;var o=s.has(t),a=r.has(t);o&&!a?s.delete(t):!o&&a&&s.add(t),t.classList.remove(i)}({element:t,force:e,SelectedSet:r.DS.SelectedSet,hoverClassName:r.Settings.hoverClass,PrevSelectedSet:r._prevSelectedSet})})))})),this.DS=i,this.Settings=this.DS.stores.SettingsStore.s,this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update)}return n(t,[{key:"_storePrevious",value:function(e){var t=this.DS,n=t.stores.KeyStore,s=t.SelectedSet;n.isMultiSelectKeyPressed(e)?this._prevSelectedSet=new Set(s):this._prevSelectedSet=new Set}}]),t}(),q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_rect",void 0),s(this,"attachSelector",(function(){var e,t,n,s;r.HTMLNode&&null!==(e=r.DS.SelectorArea)&&void 0!==e&&e.HTMLNode&&r.DS.SelectorArea.HTMLNode.removeChild(r.HTMLNode),r.HTMLNode=r.DS.stores.SettingsStore.s.selector||(n=r.DS.stores.SettingsStore.s.customStyles,(s=document.createElement("div")).style.position="absolute",n||(s.style.background="rgba(0, 0, 255, 0.1)",s.style.border="1px solid rgba(0, 0, 255, 0.45)",s.style.display="none",s.style.pointerEvents="none"),s),r.HTMLNode.classList.add(r.DS.stores.SettingsStore.s.selectorClass),r.HTMLNode&&null!==(t=r.DS.SelectorArea)&&void 0!==t&&t.HTMLNode&&r.DS.SelectorArea.HTMLNode.appendChild(r.HTMLNode)})),s(this,"start",(function(e){if(!e.isDragging){var t=r.DS.stores.PointerStore.initialValArea;z(r.HTMLNode,_(t,1)),r.HTMLNode.style.display="block",r._rect=null}})),s(this,"stop",(function(){r.HTMLNode.style.width="0",r.HTMLNode.style.height="0",r.HTMLNode.style.display="none"})),s(this,"update",(function(e){if(!e.isDragging&&!r.DS.continue){var t=r.DS.stores,n=t.ScrollStore,s=t.PointerStore,i=function(e){var t=e.scrollAmount,n=e.initialPointerPos,s=e.pointerPos,r={};return s.x>n.x-t.x?(r.left=n.x-t.x,r.width=s.x-n.x+t.x):(r.left=s.x,r.width=n.x-s.x-t.x),s.y>n.y-t.y?(r.top=n.y-t.y,r.height=s.y-n.y+t.y):(r.top=s.y,r.height=n.y-s.y-t.y),r}({scrollAmount:n.scrollAmount,initialPointerPos:s.initialValArea,pointerPos:s.currentValArea});z(r.HTMLNode,i),r._rect=null}})),this.DS=i,this.DS.subscribe("Settings:updated:selectorClass",(function(e){var t=e.settings;r.HTMLNode.classList.remove(t["selectorClass:pre"]),r.HTMLNode.classList.add(t.selectorClass)})),this.DS.subscribe("Settings:updated:selector",this.attachSelector),this.attachSelector(),this.DS.subscribe("Interaction:start",this.start),this.DS.subscribe("Interaction:update",this.update),this.DS.subscribe("Interaction:end",this.stop)}return n(t,[{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),G=function(){function t(n){var r,i=this,o=n.DS;e(this,t),s(this,"_scrollInterval",void 0),s(this,"_rect",void 0),s(this,"currentEdges",[]),s(this,"start",(function(){return i.applyElements("append")})),s(this,"applyElements",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"append",t=document.body?"body":"documentElement",n="".concat(e,"Child");i.HTMLNode[n](i.DS.Selector.HTMLNode),document[t][n](i.HTMLNode)})),s(this,"updatePos",(function(){i._rect=null;var e=i.DS.Area.rect,t=i.DS.Area.computedBorder,n=i.HTMLNode.style,s="".concat(e.top+t.top,"px"),r="".concat(e.left+t.left,"px"),o="".concat(e.width,"px"),a="".concat(e.height,"px");n.top!==s&&(n.top=s),n.left!==r&&(n.left=r),n.width!==o&&(n.width=o),n.height!==a&&(n.height=a)})),s(this,"stop",(function(e){i.stopAutoScroll(),e&&i.applyElements("remove")})),s(this,"startAutoScroll",(function(){i.currentEdges=[],i._scrollInterval=setInterval((function(){return i.handleAutoScroll()}),16)})),s(this,"handleAutoScroll",(function(){if(!i.DS.continue){var e=i.DS,t=e.stores.PointerStore,n=e.Area;i.currentEdges=A({elementRect:_(t.currentVal),containerRect:i.rect,tolerance:i.DS.stores.SettingsStore.s.overflowTolerance}),i.currentEdges.length&&n.scroll(i.currentEdges,i.DS.stores.SettingsStore.s.autoScrollSpeed)}})),s(this,"stopAutoScroll",(function(){i.currentEdges=[],clearInterval(i._scrollInterval)})),s(this,"isInside",(function(e,t){return!(!i.DS.Area.HTMLNode.contains(e)||!i.DS.stores.ScrollStore.canScroll)||V(i.rect,t||e.getBoundingClientRect())})),this.DS=o,this.HTMLNode=((r=document.createElement("div")).style.position="fixed",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="999999999999999999",r),this.DS.subscribe("Settings:updated:selectorAreaClass",(function(e){var t=e.settings;i.HTMLNode.classList.remove(t["selectorAreaClass:pre"]),i.HTMLNode.classList.add(t.selectorAreaClass)})),this.HTMLNode.classList.add(this.DS.stores.SettingsStore.s.selectorAreaClass),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Area:modified",this.updatePos),this.DS.subscribe("Interaction:init",this.start),this.DS.subscribe("Interaction:start",this.startAutoScroll),this.DS.subscribe("Interaction:end",(function(){i.updatePos(),i.stopAutoScroll()}))}return n(t,[{key:"isClicked",value:function(e){var t=this.DS.stores.PointerStore,n=e?t.getPointerPosition(e):t.initialVal;return V({left:n.x,top:n.y,right:n.x,bottom:n.y},this.rect)}},{key:"rect",get:function(){return this._rect?this._rect:this._rect=this.HTMLNode.getBoundingClientRect()}}]),t}(),$=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_currentValues",new Set),s(this,"_keyMapping",{control:"ctrlKey",shift:"shiftKey",meta:"metaKey"}),s(this,"init",(function(){document.addEventListener("keydown",r.keydown),document.addEventListener("keyup",r.keyup),window.addEventListener("blur",r.reset)})),s(this,"keydown",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:down:pre",{event:e,key:t}),r._currentValues.add(t),r.DS.publish("KeyStore:down",{event:e,key:t})})),s(this,"keyup",(function(e){var t=e.key.toLowerCase();r.DS.publish("KeyStore:up:pre",{event:e,key:t}),r._currentValues.delete(t),r.DS.publish("KeyStore:up",{event:e,key:t})})),s(this,"stop",(function(){document.removeEventListener("keydown",r.keydown),document.removeEventListener("keyup",r.reset),window.removeEventListener("blur",r.reset),r.reset()})),s(this,"reset",(function(){return r._currentValues.clear()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init)}return n(t,[{key:"isMultiSelectKeyPressed",value:function(e){var t=this;if(this.DS.stores.SettingsStore.s.multiSelectMode)return!0;var n=this.DS.stores.SettingsStore.s.multiSelectKeys.map((function(e){return e.toLocaleLowerCase()}));return!!this.currentValues.some((function(e){return n.includes(e.toLocaleLowerCase())}))||!(!e||!n.some((function(n){return e[t._keyMapping[n]]})))}},{key:"currentValues",get:function(){return Array.from(this._currentValues.values())}}]),t}(),J=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_isMouseInteraction",!1),s(this,"_initialValArea",void 0),s(this,"_currentValArea",void 0),s(this,"_lastValArea",void 0),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_lastVal",void 0),s(this,"_lastTouch",void 0),s(this,"init",(function(){r.Settings.usePointerEvents?document.addEventListener("pointermove",r.update,{passive:!1}):document.addEventListener("mousemove",r.update),document.addEventListener("touchmove",r.update,{passive:!1})})),s(this,"getPointerPosition",(function(e){return function(e){var t=e.event;return{x:t.clientX,y:t.clientY}}({event:r._normalizedEvent(e)})})),s(this,"update",(function(e){e&&(r.DS.publish("PointerStore:updated:pre",{event:e}),r.currentVal=r.getPointerPosition(e),r._isMouseInteraction&&r.DS.publish("PointerStore:updated",{event:e}))})),s(this,"stop",(function(){r.Settings.usePointerEvents?document.removeEventListener("pointermove",r.update,{passive:!1}):document.removeEventListener("mousemove",r.update),document.removeEventListener("touchmove",r.update,{passive:!1}),setTimeout((function(){return r._isMouseInteraction=!1}),100)})),s(this,"reset",(function(e){e&&(r.currentVal=r.lastVal=r.getPointerPosition(e),r.stop(),r.init())})),this.DS=i,this.Settings=i.stores.SettingsStore.s,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(e){var t=e.event;return r.start(t)})),this.DS.subscribe("Interaction:end",(function(e){var t=e.event;return r.reset(t)}))}return n(t,[{key:"start",value:function(e){e&&(this._isMouseInteraction=!0,this.currentVal=this.initialVal=this.getPointerPosition(e))}},{key:"_normalizedEvent",value:function(e){return"touches"in e&&"touchend"!==e.type&&(this._lastTouch=e),"touches"in e?this._lastTouch.touches[0]:e}},{key:"initialValArea",get:function(){return this._initialValArea?this._initialValArea:{x:0,y:0}}},{key:"currentValArea",get:function(){return this._currentValArea?this._currentValArea:{x:0,y:0}}},{key:"lastValArea",get:function(){return this._lastValArea?this._lastValArea:{x:0,y:0}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}},set:function(e){this._initialVal=e,this._initialValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}},{key:"currentVal",get:function(){return this._currentVal?this._currentVal:{x:0,y:0}},set:function(e){this._currentVal=e,this._currentValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}},{key:"lastVal",get:function(){return this._lastVal?this._lastVal:{x:0,y:0}},set:function(e){this._lastVal=e,this._lastValArea=e&&y(e,"-",y(D(this.DS.Area.rect),"+",D(this.DS.Area.computedBorder)))}}]),t}(),Q=function(){function t(n){var r=this,i=n.DS;e(this,t),s(this,"_initialVal",void 0),s(this,"_currentVal",void 0),s(this,"_canScroll",void 0),s(this,"init",(function(){return r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"start",(function(){r._currentVal=r._initialVal=C(r.DS.stores.SettingsStore.s.area),r.DS.stores.SettingsStore.s.area.addEventListener("scroll",r.update)})),s(this,"update",(function(){return r._currentVal=C(r.DS.stores.SettingsStore.s.area)})),s(this,"stop",(function(){r.DS.stores.SettingsStore.s.area.removeEventListener("scroll",r.update),r._initialVal={x:0,y:0},r._canScroll=null})),s(this,"reset",(function(){r.stop(),r.start()})),this.DS=i,this.DS.subscribe("Interaction:init",this.init),this.DS.subscribe("Interaction:start",(function(){return r.start()})),this.DS.subscribe("Interaction:end",(function(){return r.reset()}))}return n(t,[{key:"canScroll",get:function(){return"boolean"==typeof this._canScroll?this._canScroll:this._canScroll=(e=this.DS.stores.SettingsStore.s.area,!!((t=C(e)).x||t.y||(e instanceof Document?e.body?e.body.scrollTop=1:e.documentElement.scrollTop=1:e.scrollTop=1)));var e,t}},{key:"scrollAmount",get:function(){var e,t=y(this.currentVal,"-",this.initialVal),n={x:e=this.DS.stores.SettingsStore.s.zoom,y:e},s=y(y(t,"*",n),"-",t);return{x:t.x+s.x,y:t.y+s.y}}},{key:"initialVal",get:function(){return this._initialVal?this._initialVal:{x:0,y:0}}},{key:"currentVal",get:function(){return this._currentVal||(this._currentVal=C(this.DS.stores.SettingsStore.s.area)),this._currentVal}}]),t}(),ee=function t(n){var r=this,o=n.DS,a=n.settings;e(this,t),s(this,"_settings",{}),s(this,"s",{}),s(this,"update",(function(e){var t=e.settings,n=e.init;return r.DS.publish("Settings:updated:pre",i({settings:t},n?{init:n}:{}))})),s(this,"_update",(function(e){for(var t=function(e,t){return i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i(i({},M("area",e.area,t,document)),M("selectables",e.selectables,t,null)),M("autoScrollSpeed",e.autoScrollSpeed,t,5)),M("overflowTolerance",e.overflowTolerance,t,{x:25,y:25})),M("zoom",e.zoom,t,1)),M("customStyles",e.customStyles,t,!1)),M("multiSelectMode",e.multiSelectMode,t,!1)),M("multiSelectToggling",e.multiSelectToggling,t,!0)),M("multiSelectKeys",e.multiSelectKeys,t,["Control","Shift","Meta"])),M("selector",e.selector,t,null)),M("selectionThreshold",e.selectionThreshold,t,0)),M("draggability",e.draggability,t,!0)),M("immediateDrag",e.immediateDrag,t,!0)),M("keyboardDrag",e.keyboardDrag,t,!0)),M("dragKeys",e.dragKeys,t,{up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]})),M("keyboardDragSpeed",e.keyboardDragSpeed,t,10)),M("useTransform",e.useTransform,t,!0)),M("refreshMemoryRate",e.refreshMemoryRate,t,80)),M("dropZones",e.dropZones,t,[])),M("dropInsideThreshold",e.dropInsideThreshold,t,1)),M("dropTargetThreshold",e.dropTargetThreshold,t,0)),M("usePointerEvents",e.usePointerEvents,t,!1)),M("hoverClass",e.hoverClass,t,"ds-hover")),M("selectableClass",e.selectableClass,t,"ds-selectable")),M("selectedClass",e.selectedClass,t,"ds-selected")),M("selectorClass",e.selectorClass,t,"ds-selector")),M("selectorAreaClass",e.selectorAreaClass,t,"ds-selector-area")),M("droppedTargetClass",e.droppedTargetClass,t,"ds-dropped-target")),M("droppedInsideClass",e.droppedInsideClass,t,"ds-dropped-inside")),M("droppableClass",e.droppableClass,t,"ds-droppable")),M("dropZoneClass",e.dropZoneClass,t,"ds-dropzone")),M("dropZoneReadyClass",e.dropZoneReadyClass,t,"ds-dropzone-ready")),M("dropZoneTargetClass",e.dropZoneTargetClass,t,"ds-dropzone-target")),M("dropZoneInsideClass",e.dropZoneInsideClass,t,"ds-dropzone-inside"))}(e.settings,e.init),n=function(){var e,t=g(a[o],2),n=t[0],i=t[1];n in r._settings||Object.defineProperty(r.s,n,{get:function(){return r._settings[n]},set:function(e){return r.update({settings:s({},n,e)})}}),r._settings["".concat(n,":pre")]=r._settings[n],r._settings[n]=i;var l={settings:(e={},s(e,n,r._settings[n]),s(e,"".concat(n,":pre"),r._settings["".concat(n,":pre")]),e)};r.DS.publish("Settings:updated",l),r.DS.publish("Settings:updated:".concat(n),l)},o=0,a=Object.entries(t);o<a.length;o++)n()})),this.DS=o,this.DS.subscribe("Settings:updated:pre",this._update),this.update({settings:a,init:!0})},te=function(){function t(n){var r=this;e(this,t),s(this,"continue",!1),s(this,"start",(function(){r.stopped=!1,r.Interaction.init()})),s(this,"break",(function(){return r.continue=!0})),s(this,"setSettings",(function(e){return r.stores.SettingsStore.update({settings:e})})),s(this,"getSelection",(function(){return r.SelectedSet.elements})),s(this,"getSelectables",(function(){return r.SelectableSet.elements})),s(this,"getInitialCursorPosition",(function(){return r.stores.PointerStore.initialVal})),s(this,"getCurrentCursorPosition",(function(){return r.stores.PointerStore.currentVal})),s(this,"getPreviousCursorPosition",(function(){return r.stores.PointerStore.lastVal})),s(this,"getInitialCursorPositionArea",(function(){return r.stores.PointerStore.initialValArea})),s(this,"getCurrentCursorPositionArea",(function(){return r.stores.PointerStore.currentValArea})),s(this,"getPreviousCursorPositionArea",(function(){return r.stores.PointerStore.lastValArea})),s(this,"isMultiSelect",(function(e){return r.stores.KeyStore.isMultiSelectKeyPressed(e)})),s(this,"isDragging",(function(){return r.Interaction.isDragging})),s(this,"getZoneByCoordinates",(function(e){var t;return null===(t=r.DropZones.getTarget(e))||void 0===t?void 0:t.toObject()})),s(this,"getItemsDroppedByZoneId",(function(e){return r.DropZones.getItemsDroppedById(e)})),s(this,"getItemsInsideByZoneId",(function(e,t){return r.DropZones.getItemsInsideById(e,t)})),this.PubSub=new W({DS:this}),this.subscribe=this.PubSub.subscribe,this.unsubscribe=this.PubSub.unsubscribe,this.publish=this.PubSub.publish,this.stores={},this.stores.SettingsStore=new ee({DS:this,settings:n}),this.stores.PointerStore=new J({DS:this}),this.stores.ScrollStore=new Q({DS:this}),this.stores.KeyStore=new $({DS:this}),this.Area=new H({DS:this}),this.Selector=new q({DS:this}),this.SelectorArea=new G({DS:this}),this.SelectableSet=new U({DS:this}),this.SelectedSet=new X({DS:this}),this.Selection=new Y({DS:this}),this.Drag=new R({DS:this}),this.DropZones=new B({DS:this}),this.Interaction=new F({DS:this}),function(e){for(var t=e.subscribe,n=e.publish,s=e.Interaction,r=e.SelectedSet,o=e.DropZones,a={"Selected:added":[{name:"elementselect"}],"Selected:removed":[{name:"elementunselect"}],"Area:scroll":[{name:"autoscroll"}],"Interaction:start":[{name:"dragstart"}],"Interaction:update":[{name:"dragmove",condition:function(e){return e.event}}],"Interaction:end":[{name:"callback",extraData:function(){var e=o.getTarget();return i({},e?{dropTarget:e.toObject()}:{})}}]},l=function(){var e=g(u[c],2),o=e[0],a=e[1];["pre",!1].forEach((function(e){return t(e?"".concat(o,":").concat(e):o,(function(t){return a.forEach((function(o){return(!o.condition||o.condition(t))&&n(e?"".concat(e).concat(o.name):o.name,i(i({items:r.elements,isDragging:s.isDragging},t),o.extraData?o.extraData(t):{}))}))}))}))},c=0,u=Object.entries(a);c<u.length;c++)l()}({subscribe:this.subscribe,publish:this.publish,SelectedSet:this.SelectedSet,Interaction:this.Interaction,DropZones:this.DropZones}),this.subscribe("Interaction:end",(function(){return r.continue=!1})),this.start()}return n(t,[{key:"stop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&this.publish("callback",{items:this.getSelection()}),this.Interaction.stop(),this.Area.stop(),this.Drag.stop(),this.Selector.stop(),this.SelectorArea.stop(e),this.stores.KeyStore.stop(),this.stores.PointerStore.stop(),this.stores.ScrollStore.stop(),e&&this.SelectableSet.clear(),t&&this.SelectedSet.clear(),this.stopped=!0}},{key:"addSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.addAll(Z(e)),n||this.addSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"removeSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.SelectedSet.deleteAll(Z(e)),n&&this.removeSelectables(e),t&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"toggleSelection",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Z(e).forEach((function(r){return t.SelectedSet.has(r)?t.removeSelection(e,n,s):t.addSelection(e,n,s)})),n&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"setSelection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.clearSelection(),this.addSelection(e,t,n),this.getSelection()}},{key:"clearSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.SelectedSet.clear(),e&&this.PubSub.publish("callback",{items:this.getSelection()}),this.getSelection()}},{key:"addSelectables",value:function(e,t,n){var s=Z(e);return this.SelectableSet.addAll(s),t&&this.SelectedSet.addAll(s),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}},{key:"setSelectables",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)'),this.removeSelectables(e,t),this.addSelectables(e,n)}},{key:"removeSelectables",value:function(e,t,n){return this.SelectableSet.deleteAll(Z(e)),t&&this.removeSelection(e),n&&this.PubSub.publish("callback",{items:this.getSelection()}),e}}]),t}();return te})); |
@@ -1,2 +0,2 @@ | ||
declare function _default({ subscribe, publish, Interaction, SelectedSet, DropZones }: { | ||
declare function _default({ subscribe, publish, Interaction, SelectedSet, DropZones, }: { | ||
subscribe: DSSubscribe; | ||
@@ -3,0 +3,0 @@ publish: DSPublish; |
{ | ||
"name": "dragselect", | ||
"version": "2.5.2", | ||
"version": "2.5.3", | ||
"description": "easy javascript drag select & drop functionality for your projects", | ||
@@ -5,0 +5,0 @@ "main": "./dist/DragSelect.js", |
// @ts-check | ||
import '../types' | ||
import { removeModificationObservers } from './' | ||
import { removeModificationObservers } from '.' | ||
@@ -35,8 +35,5 @@ /** | ||
*/ | ||
const cleanup = () => removeModificationObservers( | ||
observer, | ||
callback, | ||
) | ||
const cleanup = () => removeModificationObservers(observer, callback) | ||
return { observer, callback, cleanup } | ||
} |
// @ts-check | ||
import '../types' | ||
import { getCurrentScroll } from './' | ||
import { getCurrentScroll } from '.' | ||
@@ -11,3 +11,3 @@ /** | ||
export default (area) => { | ||
let scroll = getCurrentScroll(area) | ||
const scroll = getCurrentScroll(area) | ||
if (scroll.x || scroll.y) return true | ||
@@ -17,3 +17,3 @@ | ||
if (area.body) return !!(area.body.scrollTop = 1) | ||
else return !!(area.documentElement.scrollTop = 1) | ||
return !!(area.documentElement.scrollTop = 1) | ||
} | ||
@@ -20,0 +20,0 @@ |
@@ -12,5 +12,4 @@ /** | ||
return traverse(toWatch, index) | ||
} else { | ||
return toWatch | ||
} | ||
return toWatch | ||
} | ||
@@ -17,0 +16,0 @@ |
@@ -25,11 +25,10 @@ // @ts-check | ||
return position | ||
} else { | ||
const match = computed.transform.trim().match(/matrix\((.*?)\)/) | ||
if (match && match.length) { | ||
const values = match[1]?.split(',') | ||
position.x = parseInt(values[4]) || 0 | ||
position.y = parseInt(values[5]) || 0 | ||
} | ||
return position | ||
} | ||
const match = computed.transform.trim().match(/matrix\((.*?)\)/) | ||
if (match && match.length) { | ||
const values = match[1]?.split(',') | ||
position.x = parseInt(values[4]) || 0 | ||
position.y = parseInt(values[5]) || 0 | ||
} | ||
return position | ||
} | ||
@@ -42,3 +41,3 @@ | ||
const getTranslatedPositions = (element) => { | ||
const transform = element.style.transform | ||
const { transform } = element.style | ||
@@ -73,3 +72,3 @@ if (!transform || transform.indexOf('translate') < 0) | ||
const getTopLeftPosition = (element) => { | ||
const style = element.style | ||
const { style } = element | ||
@@ -102,3 +101,3 @@ const position = { | ||
if (useTranslate) return getTranslatedPositions(element) | ||
else return getTopLeftPosition(element) | ||
return getTopLeftPosition(element) | ||
} |
@@ -11,3 +11,3 @@ // @ts-check | ||
export default ({ computedStyle, node }) => { | ||
const position = computedStyle.position | ||
const { position } = computedStyle | ||
const isPositioned = | ||
@@ -14,0 +14,0 @@ position === 'absolute' || position === 'relative' || position === 'fixed' |
@@ -54,3 +54,3 @@ // @ts-check | ||
// collision detected! | ||
else return false | ||
return false | ||
} |
@@ -27,3 +27,9 @@ // @ts-check | ||
*/ | ||
export default ({ subscribe, publish, Interaction, SelectedSet, DropZones }) => { | ||
export default ({ | ||
subscribe, | ||
publish, | ||
Interaction, | ||
SelectedSet, | ||
DropZones, | ||
}) => { | ||
const mapping = { | ||
@@ -34,8 +40,11 @@ 'Selected:added': [{ name: 'elementselect' }], | ||
'Interaction:start': [{ name: 'dragstart' }], // event, isDraggingKeyboard | ||
'Interaction:update': [ // event, isDraggingKeyboard | ||
'Interaction:update': [ | ||
// event, isDraggingKeyboard | ||
{ name: 'dragmove', condition: (data) => data.event }, | ||
], | ||
'Interaction:end': [ // event, isDraggingKeyboard | ||
], | ||
'Interaction:end': [ | ||
// event, isDraggingKeyboard | ||
{ | ||
name: 'callback', extraData: () => { | ||
name: 'callback', | ||
extraData: () => { | ||
const target = DropZones.getTarget() | ||
@@ -45,4 +54,4 @@ return { | ||
} | ||
} | ||
} | ||
}, | ||
}, | ||
], | ||
@@ -49,0 +58,0 @@ } |
// @ts-check | ||
import '../types.js' | ||
import '../types' | ||
import DragSelect from '../DragSelect' | ||
@@ -20,2 +20,3 @@ | ||
DS | ||
/** | ||
@@ -26,2 +27,3 @@ * @type {{cleanup:() => void}} | ||
_observers | ||
/** | ||
@@ -32,2 +34,3 @@ * @type {DSArea} | ||
_node | ||
/** | ||
@@ -38,2 +41,3 @@ * @type {DSArea[]} | ||
_parentNodes | ||
/** | ||
@@ -44,2 +48,3 @@ * @type {CSSStyleDeclaration} | ||
_computedStyle | ||
/** | ||
@@ -50,2 +55,3 @@ * @type {{top:number,bottom:number,left:number,right:number}} | ||
_computedBorder | ||
/** | ||
@@ -114,3 +120,3 @@ * @type {DSBoundingRect} | ||
////////////////////////////////////////////////////////////////////////////////////// | ||
/// /////////////////////////////////////////////////////////////////////////////////// | ||
// Scroll | ||
@@ -133,3 +139,3 @@ | ||
////////////////////////////////////////////////////////////////////////////////////// | ||
/// /////////////////////////////////////////////////////////////////////////////////// | ||
// Node Getters | ||
@@ -165,3 +171,3 @@ | ||
)) | ||
else return (this._computedStyle = window.getComputedStyle(this.HTMLNode)) | ||
return (this._computedStyle = window.getComputedStyle(this.HTMLNode)) | ||
} | ||
@@ -175,3 +181,6 @@ | ||
if (this._rect) return this._rect | ||
return (this._rect = getAreaRect(this.HTMLNode, this.DS.stores.SettingsStore.s.zoom)) | ||
return (this._rect = getAreaRect( | ||
this.HTMLNode, | ||
this.DS.stores.SettingsStore.s.zoom | ||
)) | ||
} | ||
@@ -178,0 +187,0 @@ |
@@ -13,2 +13,3 @@ // @ts-check | ||
_prevCursorPos | ||
/** | ||
@@ -19,2 +20,3 @@ * @type {Vect2} | ||
_prevScrollPos | ||
/** | ||
@@ -25,2 +27,3 @@ * @type {DSElements} | ||
_elements = [] | ||
/** | ||
@@ -31,2 +34,3 @@ * @type {DSDragKeys} | ||
_dragKeys | ||
/** | ||
@@ -58,6 +62,14 @@ * @type {string[]} | ||
this._dragKeys = { | ||
up: this.DS.stores.SettingsStore.s.dragKeys.up.map((k) => k.toLowerCase()), | ||
down: this.DS.stores.SettingsStore.s.dragKeys.down.map((k) => k.toLowerCase()), | ||
left: this.DS.stores.SettingsStore.s.dragKeys.left.map((k) => k.toLowerCase()), | ||
right: this.DS.stores.SettingsStore.s.dragKeys.right.map((k) => k.toLowerCase()), | ||
up: this.DS.stores.SettingsStore.s.dragKeys.up.map((k) => | ||
k.toLowerCase() | ||
), | ||
down: this.DS.stores.SettingsStore.s.dragKeys.down.map((k) => | ||
k.toLowerCase() | ||
), | ||
left: this.DS.stores.SettingsStore.s.dragKeys.left.map((k) => | ||
k.toLowerCase() | ||
), | ||
right: this.DS.stores.SettingsStore.s.dragKeys.right.map((k) => | ||
k.toLowerCase() | ||
), | ||
} | ||
@@ -64,0 +76,0 @@ this._dragKeysFlat = [ |
@@ -7,3 +7,3 @@ // @ts-check | ||
import { isCollision, toArray } from '../methods' | ||
import { isCollision } from '../methods' | ||
@@ -49,3 +49,5 @@ export default class DropZones { | ||
// @ts-ignore: @todo: update to typescript | ||
this.DS.subscribe('Settings:updated:dropZones', this.setDropZones) | ||
this.DS.subscribe('Settings:updated:dropZones', ({ settings }) => | ||
this.setDropZones(settings) | ||
) | ||
this.setDropZones({ | ||
@@ -52,0 +54,0 @@ dropZones: /** @type {DSDropZone[]} */ (this.DS.stores.SettingsStore.s |
@@ -8,2 +8,3 @@ // @ts-check | ||
isInteracting | ||
/** @type {boolean} */ | ||
@@ -34,5 +35,6 @@ isDragging | ||
init = () => this.DS.publish('Interaction:init:pre', {}) | ||
_init = () => { | ||
this.stop() | ||
// @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289) | ||
@@ -67,3 +69,3 @@ if (this.Settings.usePointerEvents) | ||
/** @type {DSElement} */ (event.target) | ||
)) || //fix outside elements issue | ||
)) || // fix outside elements issue | ||
(!isKeyboardClick && !this.DS.SelectorArea.isClicked(event)) // make sure the mouse click is inside the area | ||
@@ -84,2 +86,3 @@ ) | ||
}) | ||
_start = (event) => { | ||
@@ -154,4 +157,3 @@ if (event.type === 'touchstart') event.preventDefault() // Call preventDefault() to prevent double click issue, see https://github.com/ThibaultJanBeyer/DragSelect/pull/29 & https://developer.mozilla.org/vi/docs/Web/API/Touch_events/Supporting_both_TouchEvent_and_MouseEvent | ||
if (!KeyStore.isMultiSelectKeyPressed(event)) | ||
SelectedSet.clear() | ||
if (!KeyStore.isMultiSelectKeyPressed(event)) SelectedSet.clear() | ||
SelectedSet.toggle(node) | ||
@@ -201,4 +203,5 @@ | ||
}) | ||
_reset = (event) => { | ||
const isDragging = this.isDragging | ||
const { isDragging } = this | ||
this.stop() | ||
@@ -205,0 +208,0 @@ this.init() |
@@ -51,13 +51,11 @@ // @ts-check | ||
if (Array.isArray(eventName)) | ||
eventName.forEach(name => this._publish(name, data)) | ||
else | ||
this._publish(eventName, data) | ||
eventName.forEach((name) => this._publish(name, data)) | ||
else this._publish(eventName, data) | ||
} | ||
_publish = (eventName, data) => { | ||
const subscribers = this.subscribers[eventName] | ||
if (!Array.isArray(subscribers)) return | ||
if (eventName.includes(`:pre`)) | ||
this._handlePrePublish(subscribers, data) | ||
else | ||
this._handlePublish(subscribers, data) | ||
if (eventName.includes(`:pre`)) this._handlePrePublish(subscribers, data) | ||
else this._handlePublish(subscribers, data) | ||
} | ||
@@ -64,0 +62,0 @@ |
@@ -61,4 +61,6 @@ // @ts-check | ||
addAll = (elements) => elements.forEach((el) => this.add(el)) | ||
/** @param {DSElements} elements */ | ||
deleteAll = (elements) => elements.forEach((el) => this.delete(el)) | ||
/** @return {DSElements} */ | ||
@@ -65,0 +67,0 @@ get elements() { |
@@ -69,5 +69,6 @@ // @ts-check | ||
for(const [element, rect] of elRects) { | ||
for (const [element, rect] of elRects) { | ||
if (!SelectorArea.isInside(element, rect)) continue | ||
if (isCollision(rect, Selector.rect, this.Settings.selectionThreshold)) select.push(element) | ||
if (isCollision(rect, Selector.rect, this.Settings.selectionThreshold)) | ||
select.push(element) | ||
else unselect.push(element) | ||
@@ -77,3 +78,3 @@ } | ||
const multiSelectionToggle = | ||
(this.DS.stores.KeyStore.isMultiSelectKeyPressed(event)) && | ||
this.DS.stores.KeyStore.isMultiSelectKeyPressed(event) && | ||
this.Settings.multiSelectToggling | ||
@@ -80,0 +81,0 @@ |
// @ts-check | ||
import '../types.js' | ||
import '../types' | ||
import DragSelect from '../DragSelect' | ||
@@ -30,3 +30,3 @@ | ||
this.HTMLNode.classList.remove(settings['selectorClass:pre']) | ||
this.HTMLNode.classList.add(settings['selectorClass']) | ||
this.HTMLNode.classList.add(settings.selectorClass) | ||
}) | ||
@@ -41,3 +41,3 @@ // @ts-ignore: @todo: update to typescript | ||
} | ||
attachSelector = () => { | ||
@@ -44,0 +44,0 @@ if (this.HTMLNode && this.DS.SelectorArea?.HTMLNode) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
613414
12270