smooth-dnd
Advanced tools
Comparing version 0.9.2 to 0.9.3
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).SmoothDnD={})}(this,function(e){"use strict";var l,t,r="smooth-dnd-container-instance",g="smooth-dnd-draggable-wrapper",o="animated",m="__smooth_dnd_draggable_translation_value",c="__smooth_dnd_draggable_visibility_value",C="smooth-dnd-ghost",s="smooth-dnd-container",d="smooth-dnd-extra-size-for-insertion",v="smooth-dnd-stretcher-element",h="smooth-dnd-stretcher-instance",u="smooth-dnd-disable-touch-action",f="smooth-dnd-no-user-select",i="smooth-dnd-prevent-auto-scroll-class",b="smooth-dnd-drop-preview-default-class",y="smooth-dnd-drop-preview-inner-class",x="smooth-dnd-drop-preview-constant-class",E="smooth-dnd-drop-preview-flex-container-class",n=Object.freeze({containerInstance:r,defaultGroupName:"@@smooth-dnd-default-group@@",wrapperClass:g,defaultGrabHandleClass:"smooth-dnd-default-grap-handle",animationClass:o,translationValue:m,visibilityValue:c,ghostClass:C,containerClass:s,extraSizeForInsertion:d,stretcherElementClass:v,stretcherElementInstance:h,isDraggableDetached:"smoth-dnd-is-draggable-detached",disbaleTouchActions:u,noUserSelectClass:f,preventAutoScrollClass:i,dropPlaceholderDefaultClass:b,dropPlaceholderInnerClass:y,dropPlaceholderWrapperClass:x,dropPlaceholderFlexContainerClass:E}),S={groupName:void 0,behaviour:"move",orientation:"vertical",getChildPayload:void 0,animationDuration:250,autoScrollEnabled:!0,shouldAcceptDrop:void 0,shouldAnimateDrop:void 0};function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}(t=l||(l={})).x="x",t.y="y",t.xy="xy";var w=function(e,t,n){return"x"===n?{left:Math.max(e.left,t.left),top:e.top,right:Math.min(e.right,t.right),bottom:e.bottom}:{left:e.left,top:Math.max(e.top,t.top),right:e.right,bottom:Math.min(e.bottom,t.bottom)}},R=function(e){var t=e.getBoundingClientRect(),n={left:t.left,right:t.right,top:t.top,bottom:t.bottom};if(I(e,"x")&&!B(e,"x")){var o=n.right-n.left;n.right=n.right+e.scrollWidth-o}if(I(e,"y")&&!B(e,"y")){var r=n.bottom-n.top;n.bottom=n.bottom+e.scrollHeight-r}return n},O=function(e){var t=global.getComputedStyle(e),n=t.overflow;if("auto"===n||"scroll"===n)return l.xy;var o=t["overflow-x"],r="auto"===o||"scroll"===o,i=t["overflow-y"],a="auto"===i||"scroll"===i;return r&&a?l.xy:r?l.x:a?l.y:null},A=function(e,t){var n=global.getComputedStyle(e),o=n.overflow,r=n["overflow-".concat(t)];return"auto"===o||"scroll"===o||("auto"===r||"scroll"===r)},B=function(e,t){var n=global.getComputedStyle(e),o=n.overflow,r=n["overflow-".concat(t)];return"auto"===o||"scroll"===o||"hidden"===o||("auto"===r||"scroll"===r||"hidden"===r)},I=function(e,t){return"x"===t?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight},z=function(e,t){var n=e,o=t||R(e);for(n=e.parentElement;n;)I(n,"x")&&B(n,"x")&&(o=w(o,n.getBoundingClientRect(),"x")),I(n,"y")&&B(n,"y")&&(o=w(o,n.getBoundingClientRect(),"y")),n=n.parentElement;return o},P=function(e,n){for(var o=e;o;){if(o[r]){var t=function(){var t=o[r];if(n.some(function(e){return e===t}))return{v:t}}();if("object"===a(t))return t.v}o=o.parentElement}return null},T=function(e,t){for(var n=e;n;){if(n.matches(t))return n;n=n.parentElement}return null},L=function(e,t){return-1<e.className.split(" ").map(function(e){return e}).indexOf(t)},N=function(e,t){if(e){var n=e.className.split(" ").filter(function(e){return e});-1===n.indexOf(t)&&(n.unshift(t),e.className=n.join(" "))}},M=function(e,t){if(e){var n=e.className.split(" ").filter(function(e){return e&&e!==t});e.className=n.join(" ")}},j=function(e,t){return e.removeChild(e.children[t])},V=function(e,t,n){n>=e.children.length?e.appendChild(t):e.insertBefore(t,e.children[n])},H=function(){global.getSelection?global.getSelection().empty?global.getSelection().empty():global.getSelection().removeAllRanges&&global.getSelection().removeAllRanges():global.document.selection&&global.document.selection.empty()},F=function(e){if(e){var t=global.getComputedStyle(e);if(t)return t.cursor}return null};function X(e){return!(e.bottom<=e.top||e.right<=e.left)}function Y(e){var s=e.element,u=e.draggables;return function(e,t){var n=e,o=n.removedIndex,r=n.addedIndex,i=n.droppedElement,a=null;if(null!==o&&(a=j(s,o),u.splice(o,1)),null!==r){var l=global.document.createElement("div");l.className="".concat(g),l.appendChild(a&&a.firstElementChild?a.firstElementChild:i),V(s,l,r),r>=u.length?u.push(l):u.splice(r,0,l)}t&&t(e)}}var _=Object.freeze({domDropHandler:Y,reactDropHandler:function(){return{handler:function(){return function(e,t){t&&t(e)}}}}}),k={size:"offsetWidth",distanceToParent:"offsetLeft",translate:"transform",begin:"left",end:"right",dragPosition:"x",scrollSize:"scrollWidth",offsetSize:"offsetWidth",scrollValue:"scrollLeft",scale:"scaleX",setSize:"width",setters:{translate:function(e){return"translate3d(".concat(e,"px, 0, 0)")}}},W={size:"offsetHeight",distanceToParent:"offsetTop",translate:"transform",begin:"top",end:"bottom",dragPosition:"y",scrollSize:"scrollHeight",offsetSize:"offsetHeight",scrollValue:"scrollTop",scale:"scaleY",setSize:"height",setters:{translate:function(e){return"translate3d(0,".concat(e,"px, 0)")}}};function q(o,s,e){o[d]=0;var r,i=(r="horizontal"===s?k:W,{get:function(e,t){return e[r[t]||t]},set:function(e,t,n){e[r[t]]=r.setters[t]?r.setters[t](n):n}}),u={translation:0};function t(){var e,t;n(o),t=(e=o).getBoundingClientRect(),u.scaleX=e.offsetWidth?(t.right-t.left)/e.offsetWidth:1,u.scaleY=e.offsetHeight?(t.bottom-t.top)/e.offsetHeight:1}function n(e){u.rect=R(e);var t=z(e,u.rect);X(t)&&(u.lastVisibleRect=u.visibleRect),u.visibleRect=t}function a(e){var t=e;if(t.tagName){var n=t.getBoundingClientRect();return"vertical"===s?n.bottom-n.top:n.right-n.left}return i.get(e,"size")*i.get(u,"scale")}function l(e){return i.get(e,"dragPosition")}return global.addEventListener("resize",function(){n(o)}),setTimeout(function(){t()},10),{getSize:a,getContainerRectangles:function(){return{rect:u.rect,visibleRect:u.visibleRect,lastVisibleRect:u.lastVisibleRect}},getBeginEndOfDOMRect:function(e){return{begin:i.get(e,"begin"),end:i.get(e,"end")}},getBeginEndOfContainer:function(){return{begin:i.get(u.rect,"begin")+u.translation,end:i.get(u.rect,"end")+u.translation}},getBeginEndOfContainerVisibleRect:function(){return{begin:i.get(u.visibleRect,"begin")+u.translation,end:i.get(u.visibleRect,"end")+u.translation}},getBeginEnd:function(e){var t,n=(t=e,(i.get(t,"distanceToParent")+(t[m]||0))*i.get(u,"scale")+(i.get(u.rect,"begin")+u.translation)-i.get(o,"scrollValue"));return{begin:n,end:n+a(e)*i.get(u,"scale")}},getAxisValue:l,setTranslation:function(e,t){t?i.set(e.style,"translate",t):e.style.removeProperty("transform"),e[m]=t},getTranslation:function(e){return e[m]},setVisibility:function(e,t){void 0!==e[c]&&e[c]===t||(t?e.style.removeProperty("visibility"):e.style.visibility="hidden",e[c]=t)},isVisible:function(e){return void 0===e[c]||e[c]},isInVisibleRect:function(e,t){var n=u.visibleRect,o=n.left,r=n.top,i=n.right,a=n.bottom;a-r<2&&(a=r+30);var l=u.rect;return"vertical"===s?e>l.left&&e<l.right&&r<t&&t<a:o<e&&e<i&&t>l.top&&t<l.bottom},setSize:function(e,t){i.set(e,"setSize",t)},getTopLeftOfElementBegin:function(e){var t=0;return{top:"horizontal"===s?(t=e,u.rect.top):(t=u.rect.left,e),left:t}},getScrollSize:function(e){return i.get(e,"scrollSize")},getScrollValue:function(e){return i.get(e,"scrollValue")},setScrollValue:function(e,t){return i.set(e,"scrollValue",t)},invalidate:t,invalidateRects:function(){n(o)},getPosition:function(e){return l(e)},setBegin:function(e,t){i.set(e,"begin",t)}}}function G(e,t,n){var o,r,i,a=n.left,l=n.right,s=n.top,u=n.bottom,c=e.x,d=e.y;if(c<a||l<c||d<s||u<d)return null;i="x"===t?(o=a,r=l,c):(o=s,r=u,d);var f=r-o,g=400<f?100:f/4;return r-i<g?{direction:"end",speedFactor:(g-(r-i))/g}:i-o<g?{direction:"begin",speedFactor:(g-(i-o))/g}:null}var U=function(l){var s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"y",n=!1,u=null,c=null,d=null,f=null;return{animate:function(e,t){d=e,f=t,(n=!0)&&function a(){null===u&&(u=requestAnimationFrame(function(e){null===c&&(c=e);var t=e-c;c=e;var n,o,r,i=t/1e3*f;o=s,r=i="begin"===d?0-i:i,(n=l)&&(n!==window?"x"===o?n.scrollLeft+=r:n.scrollTop+=r:"x"===o?n.scrollBy(r,0):n.scrollBy(0,r)),u=null,a()}))}()},stop:function(){n&&(cancelAnimationFrame(u),n=!1,u=c=null)}}};function J(e){return function(){return z(e,e.getBoundingClientRect())}}var K,Q,Z,$=function(e){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1500,a=e.reduce(function(e,t){var n=function(e){for(var t=[],n=e.element;n;){var o=O(n);if(o&&!L(n,i)){var r={};switch(o){case l.xy:r.x={animator:U(n,"x")},r.y={animator:U(n,"y")};break;case l.x:r.x={animator:U(n,"x")};break;case l.y:r.y={animator:U(n,"y")}}t.push({axisAnimations:r,getRect:J(n),scrollerElement:n})}n=n.parentElement}return t}(t).filter(function(t){return!e.find(function(e){return e.scrollerElement===t.scrollerElement})});return[].concat(D(e),D(n))},[]);return function(e){var t,o,n=e.draggableInfo;if(e.reset)a.forEach(function(e){e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop()});else if(n){t=a,o=n.mousePosition,t.forEach(function(e){var t=e.axisAnimations,n=(0,e.getRect)();t.x&&(t.x.scrollParams=G(o,"x",n),e.cachedRect=n),t.y&&(t.y.scrollParams=G(o,"y",n),e.cachedRect=n)}),a.forEach(function(e){var t=e.axisAnimations,n=t.x,o=t.y;if(n)if(n.scrollParams){var r=n.scrollParams,i=r.direction,a=r.speedFactor;n.animator.animate(i,a*c)}else n.animator.stop();if(o)if(o.scrollParams){var l=o.scrollParams,s=l.direction,u=l.speedFactor;o.animator.animate(s,u*c)}else o.animator.stop()});var r=a.filter(function(e){return e.cachedRect});if(r.length&&1<r.length){var i=function(e,t){for(var n=document.elementFromPoint(t.x,t.y);n;){var o=e.find(function(e){return e.scrollerElement===n});if(o)return o;n=n.parentElement}return null}(r,n.mousePosition);i&&r.forEach(function(e){e!==i&&(e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop())})}}}},ee="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(K=ee.Node||ee.Element)&&K.prototype&&!K.prototype.matches&&(K.prototype.matches=K.prototype.matchesSelector||K.prototype.mozMatchesSelector||K.prototype.msMatchesSelector||K.prototype.oMatchesSelector||K.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n}),(Q=ee.Node||ee.Element)&&Q.prototype&&null==Q.prototype.firstElementChild&&Object.defineProperty(Q.prototype,"firstElementChild",{get:function(){for(var e,t=this.childNodes,n=0;e=t[n++];)if(1===e.nodeType)return e;return null}}),Array.prototype.some||(Array.prototype.some=function(e){if(null==this)throw new TypeError("Array.prototype.some called on null or undefined");if("function"!=typeof e)throw new TypeError;for(var t=Object(this),n=t.length>>>0,o=2<=arguments.length?arguments[1]:void 0,r=0;r<n;r++)if(r in t&&e.call(o,t[r],r,t))return!0;return!1});var te={overflow:"hidden",display:"block"},ne={height:"100%",display:"table-cell","vertical-align":"top"},oe=(p(Z={},".".concat(s),{position:"relative","min-height":"30px","min-width":"30px"}),p(Z,".".concat(s,".horizontal"),{display:"table"}),p(Z,".".concat(s,".horizontal > .").concat(v),{display:"inline-block"}),p(Z,".".concat(s,".horizontal > .").concat(g),ne),p(Z,".".concat(s,".vertical > .").concat(g),te),p(Z,".".concat(g),{"box-sizing":"border-box"}),p(Z,".".concat(g,".horizontal"),ne),p(Z,".".concat(g,".vertical"),te),p(Z,".".concat(g,".animated"),{transition:"transform ease"}),p(Z,".".concat(C,".animated"),{transition:"all ease-in-out"}),p(Z,".".concat(C," *"),{"pointer-events":"none"}),p(Z,".".concat(u," *"),{"touch-actions":"none","-ms-touch-actions":"none"}),p(Z,".".concat(f),{"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}),p(Z,".".concat(y),{flex:"1"}),p(Z,".".concat(s,".horizontal > .").concat(x),{height:"100%",overflow:"hidden",display:"table-cell","vertical-align":"top"}),p(Z,".".concat(s,".vertical > .").concat(x),{overflow:"hidden",display:"block",width:"100%"}),p(Z,".".concat(E),{width:"100%",height:"100%",display:"flex","justify-content":"stretch","align-items":"stretch"}),p(Z,".".concat(b),{"background-color":"rgba(150, 150, 150, 0.1)",border:"1px solid #ccc"}),Z);function re(o){return Object.keys(o).reduce(function(e,t){var n=o[t];return"object"===a(n)?"".concat(e).concat(t,"{").concat(re(n),"}"):"".concat(e).concat(t,":").concat(n,";")},"")}function ie(e){if(e&&"undefined"!=typeof window){var t=global.document.head||global.document.getElementsByTagName("head")[0],n=global.document.createElement("style"),o=re({"body *":{cursor:"".concat(e," !important")}});return n.type="text/css",n.styleSheet?n.styleSheet.cssText=o:n.appendChild(global.document.createTextNode(o)),t.appendChild(n),n}return null}var ae,le,se=["mousedown","touchstart"],ue=["mousemove","touchmove"],ce=["mouseup","touchend"],de=null,fe=null,ge=null,pe=null,me=[],ve=!1,he=null,be=null,ye=null,xe=null,Ee=(ae=null,le=!1,{start:function(){le||(le=!0,function e(){ae=requestAnimationFrame(function(){de.forEach(function(e){return e.layout.invalidateRects()}),setTimeout(function(){null!==ae&&e()},50)})}())},stop:function(){null!==ae&&(cancelAnimationFrame(ae),ae=null),le=!1}}),Ce="undefined"!=typeof window&&!!(global.navigator.userAgent.match(/Android/i)||global.navigator.userAgent.match(/webOS/i)||global.navigator.userAgent.match(/iPhone/i)||global.navigator.userAgent.match(/iPad/i)||global.navigator.userAgent.match(/iPod/i)||global.navigator.userAgent.match(/BlackBerry/i)||global.navigator.userAgent.match(/Windows Phone/i));function Se(){"undefined"!=typeof window&&se.forEach(function(e){global.document.addEventListener(e,Re,{passive:!1})})}function De(){return pe&&pe.ghostParent?pe.ghostParent:fe&&fe.parentElement||global.document.body}var we=function(){var r,i,o,a=null,l=1,s=5;function u(e){var t=Ae(e),n=t.clientX,o=t.clientY;if(i)(Math.abs(r.clientX-n)>s||Math.abs(r.clientY-o)>s)&&f();else if(Math.abs(r.clientX-n)>l||Math.abs(r.clientY-o)>l)return g()}function c(){f()}function d(){f()}function f(){clearTimeout(a),ue.forEach(function(e){return global.document.removeEventListener(e,u)},{passive:!1}),ce.forEach(function(e){return global.document.removeEventListener(e,c)},{passive:!1}),global.document.removeEventListener("drag",d,{passive:!1})}function g(){clearTimeout(a),f(),o()}return function(e,t,n){r=Ae(e),o=n,(i="number"==typeof t?t:Ce?200:0)&&(a=setTimeout(g,i)),ue.forEach(function(e){return global.document.addEventListener(e,u)},{passive:!1}),ce.forEach(function(e){return global.document.addEventListener(e,c)},{passive:!1}),global.document.addEventListener("drag",d,{passive:!1})}}();function Re(e){var t=Ae(e);if(!ve&&(void 0===t.button||0===t.button)&&(fe=T(t.target,"."+g))){var n=T(fe,"."+s),o=me.filter(function(e){return e.element===n})[0],r=o.getOptions().dragHandleSelector,i=o.getOptions().nonDragAreaSelector,a=!0;if(r&&!T(t.target,r)&&(a=!1),i&&T(t.target,i)&&(a=!1),a){N(global.document.body,u),N(global.document.body,f);global.document.addEventListener("mouseup",function e(){M(global.document.body,u),M(global.document.body,f),global.document.removeEventListener("mouseup",e)})}a&&we(t,o.getOptions().dragBeginDelay,function(){H(),Pe(t,F(e.target)),ue.forEach(function(e){global.document.addEventListener(e,Ne,{passive:!1})}),ce.forEach(function(e){global.document.addEventListener(e,Oe,{passive:!1})})})}}function Oe(){var e;ue.forEach(function(e){global.document.removeEventListener(e,Ne,{passive:!1})}),ce.forEach(function(e){global.document.removeEventListener(e,Oe,{passive:!1})}),be({reset:!0}),xe&&((e=xe)&&"undefined"!=typeof window&&(global.document.head||global.document.getElementsByTagName("head")[0]).removeChild(e),xe=null),pe&&(Ee.stop(),function(e){function i(){M(ge.ghost,"animated"),ge.ghost.style.transitionDuration=null,De().removeChild(ge.ghost),e()}function t(e,t,n){var o=e.top,r=e.left;N(ge.ghost,"animated"),n&&N(ge.ghost.firstElementChild,n),ge.topLeft.x=r,ge.topLeft.y=o,Le(t),setTimeout(function(){i()},t+20)}function n(e,t){N(ge.ghost,"animated"),Le(e,.9,!0),setTimeout(function(){t()},e)}if(pe.targetElement){var o=me.filter(function(e){return e.element===pe.targetElement})[0];!(m=o.getOptions()).shouldAnimateDrop||m.shouldAnimateDrop(pe.container.getOptions(),pe.payload)?t(o.getDragResult().shadowBeginEnd.rect,Math.max(150,o.getOptions().animationDuration/2),o.getOptions().dropClass):i()}else{var r=me.filter(function(e){return e===pe.container})[0];if(r){var a=r.getOptions(),l=a.behaviour,s=a.removeOnDropOut;if("move"===l&&!s&&r.getDragResult()){var u=r.layout.getContainerRectangles();if(!X(u.visibleRect)&&X(u.lastVisibleRect))t({top:u.lastVisibleRect.top,left:u.lastVisibleRect.left},r.getOptions().animationDuration,r.getOptions().dropClass);else{var c=r.getDragResult(),d=c.removedIndex,f=c.elementSize,g=r.layout;r.getTranslateCalculator({dragResult:{removedIndex:d,addedIndex:d,elementSize:f,pos:void 0,shadowBeginEnd:void 0}});var p=0<d?g.getBeginEnd(r.draggables[d-1]).end:g.getBeginEndOfContainer().begin;t(g.getTopLeftOfElementBegin(p),r.getOptions().animationDuration,r.getOptions().dropClass)}}else n(r.getOptions().animationDuration,i)}else n(S.animationDuration,i)}var m}(function(){ze(ve=!1);for(var e=de||[],t=e.shift();void 0!==t;)t.handleDrop(pe),t=e.shift();he=ye=pe=ge=fe=de=null}))}function Ae(e){return e.touches?e.touches[0]:e}function Be(e){var t=e,r=null;return function(o){null===r&&(r=requestAnimationFrame(function(){var n=!1;t.forEach(function(e){var t=e.handleDrag(o);n=!!t.containerBoxChanged||!1,t.containerBoxChanged=!1}),be({draggableInfo:o}),n&&(n=!1,setTimeout(function(){me.forEach(function(e){e.layout.invalidateRects(),e.onTranslated()})},10)),r=null}))}}function Ie(e,t){return e.getOptions().autoScrollEnabled?$(t,e.getScrollMaxSpeed()):function(e){return null}}function ze(o){me.forEach(function(e){var t=o?e.getOptions().onDragStart:e.getOptions().onDragEnd;if(t){var n={isSource:e===pe.container,payload:pe.payload};e.isDragRelevant(pe.container,pe.payload)?n.willAcceptDrop=!0:n.willAcceptDrop=!1,t(n)}})}function Pe(e,t){if(null!==fe){ve=!0;var n=me.filter(function(e){return fe.parentElement===e.element})[0];n.setDraggables(),ye=n.getOptions().lockAxis?n.getOptions().lockAxis.toLowerCase():null,h=fe,b=me.filter(function(e){return h.parentElement===e.element})[0],y=b.draggables.indexOf(h),x=b.getOptions().getGhostParent,E=h.getBoundingClientRect(),pe={container:b,element:h,size:{offsetHeight:E.bottom-E.top,offsetWidth:E.right-E.left},elementIndex:y,payload:b.getOptions().getChildPayload?b.getOptions().getChildPayload(y):void 0,targetElement:null,position:{x:0,y:0},groupName:b.getOptions().groupName,ghostParent:x?x():null,invalidateShadow:null,mousePosition:null,relevantContainers:null},o=fe,r={x:e.clientX,y:e.clientY},i=pe.container,a=t,l=r.x,s=r.y,u=o.getBoundingClientRect(),c=u.left,d=u.top,f=u.right,g=u.bottom,p=c+(f-c)/2,m=d+(g-d)/2,(v=o.cloneNode(!0)).style.zIndex="1000",v.style.boxSizing="border-box",v.style.position="fixed",v.style.top="0px",v.style.left="0px",v.style.transform="translate3d(".concat(c,"px, ").concat(d,"px, 0)"),v.style.width=f-c+"px",v.style.height=g-d+"px",v.style.overflow="visible",v.style.transition=null,v.style.removeProperty("transition"),v.style.pointerEvents="none",v.style.userSelect="none",i.getOptions().dragClass?setTimeout(function(){N(v.firstElementChild,i.getOptions().dragClass);var e=global.getComputedStyle(v.firstElementChild).cursor;xe=ie(e)}):xe=ie(a),N(v,i.getOptions().orientation||"vertical"),N(v,C),ge={ghost:v,centerDelta:{x:p-l,y:m-s},positionDelta:{left:c-l,top:d-s},topLeft:{x:c,y:d}},pe.position={x:e.clientX+ge.centerDelta.x,y:e.clientY+ge.centerDelta.y},pe.mousePosition={x:e.clientX,y:e.clientY},de=me.filter(function(e){return e.isDragRelevant(n,pe.payload)}),pe.relevantContainers=de,he=Be(de),be&&be({reset:!0,draggableInfo:void 0}),be=Ie(n,de),de.forEach(function(e){return e.prepareDrag(e,de)}),ze(!0),he(pe),De().appendChild(ge.ghost),Ee.start()}var o,r,i,a,l,s,u,c,d,f,g,p,m,v,h,b,y,x,E}var Te=null;function Le(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],o=ge,r=o.ghost,i=o.topLeft,a=i.x,l=i.y,s="translate3d(".concat(a.toFixed(),"px,").concat(l.toFixed(),"px, 0)");if(1!==t&&(s="".concat(s," scale(").concat(t,")")),0<e)return ge.ghost.style.transitionDuration=e+"ms",void requestAnimationFrame(function(){r.style.transform=s,Te=null,n&&(r.style.opacity="0")});null===Te&&(Te=requestAnimationFrame(function(){r.style.transform=s,Te=null,n&&(r.style.opacity="0")}))}function Ne(e){e.preventDefault();var t=Ae(e);if(pe){var n=pe.container.getOptions();if("contain"===n.behaviour){var o=pe.container.layout.getBeginEndOfContainerVisibleRect();if("vertical"===n.orientation){var r=o.begin-pe.size.offsetHeight/2,i=o.end-pe.size.offsetHeight/2,a=Math.max(r,Math.min(i,t.clientY+ge.positionDelta.top));ge.topLeft.y=a,pe.position.y=Math.max(o.begin+1,Math.min(o.end-1,t.clientY+ge.centerDelta.y)),pe.mousePosition.y=Math.max(o.begin+1,Math.min(o.end-1,t.clientY))}else{var l=o.begin-pe.size.offsetWidth/2,s=o.end-pe.size.offsetWidth/2,u=Math.max(l,Math.min(s,t.clientX+ge.positionDelta.left));ge.topLeft.x=u,pe.position.x=Math.max(o.begin+1,Math.min(o.end-1,t.clientX+ge.centerDelta.x)),pe.mousePosition.x=Math.max(o.begin+1,Math.min(o.end-1,t.clientX))}}else ye?"y"===ye?(ge.topLeft.y=t.clientY+ge.positionDelta.top,pe.position.y=t.clientY+ge.centerDelta.y,pe.mousePosition.y=t.clientY):"x"===ye&&(ge.topLeft.x=t.clientX+ge.positionDelta.left,pe.position.x=t.clientX+ge.centerDelta.x,pe.mousePosition.x=t.clientX):(ge.topLeft.x=t.clientX+ge.positionDelta.left,ge.topLeft.y=t.clientY+ge.positionDelta.top,pe.position.x=t.clientX+ge.centerDelta.x,pe.position.y=t.clientY+ge.centerDelta.y,pe.mousePosition.x=t.clientX,pe.mousePosition.y=t.clientY);Le(),he(pe)}else Pe(t,F(e.target))}!function(){if("undefined"!=typeof window){var e=global.document.head||global.document.getElementsByTagName("head")[0],t=global.document.createElement("style");t.id="smooth-dnd-style-definitions";var n=re(oe);t.type="text/css",t.styleSheet?t.styleSheet.cssText=n:t.appendChild(global.document.createTextNode(n)),e.appendChild(t)}}();var Me=(Se(),{register:function(e){var t;t=e,me.push(t),ve&&pe&&t.isDragRelevant(pe.container,pe.payload)&&(de.push(t),t.prepareDrag(t,de),be&&be({reset:!0,draggableInfo:void 0}),be=Ie(t,de),he=Be(de),t.handleDrag(pe))},unregister:function(e){!function(e){if(me.splice(me.indexOf(e),1),ve&&pe){pe.container===e&&e.fireRemoveElement(),pe.targetElement===e.element&&(pe.targetElement=null);var t=de.indexOf(e);-1<t&&(de.splice(t,1),be&&be({reset:!0,draggableInfo:void 0}),be=Ie(e,de),he=Be(de))}}(e)}});function je(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:S.animationDuration;t?(N(e,o),e.style.transitionDuration=n+"ms"):(M(e,o),e.style.removeProperty("transition-duration"))}function Ve(n){var o=[];return Array.prototype.forEach.call(n.children,function(e){if(e.nodeType===Node.ELEMENT_NODE){var t=e;L(e,g)||(t=function(e){if(st.wrapChild){var t=global.document.createElement("div");return t.className="".concat(g),e.parentElement.insertBefore(t,e),t.appendChild(e),t}return e}(e)),t[m]=0,o.push(t)}else n.removeChild(e)}),o}function He(e){var g=e.layout;return function(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return function e(t,n,o,r){var i=4<arguments.length&&void 0!==arguments[4]&&arguments[4];if(r<o)return o;if(o===r){var a=g.getBeginEnd(t[o]),l=a.begin,s=a.end;return l<n&&n<=s?i?n<(s+l)/2?o:o+1:o:null}var u=Math.floor((r+o)/2),c=g.getBeginEnd(t[u]),d=c.begin,f=c.end;return n<d?e(t,n,o,u-1,i):f<n?e(t,n,u+1,r,i):i?n<(f+d)/2?u:u+1:u}(e,t,0,e.length-1,n)}}function Fe(e){var t,n,o,r,i=e.element,a=e.draggables,l=e.layout,s=e.options,u=(n=(t={element:i,draggables:a,layout:l,options:s}).element,o=t.draggables,r=t.layout,function(){o.forEach(function(e){je(e,!1),r.setTranslation(e,0),r.setVisibility(e,!0)}),n[h]&&(n[h].parentNode.removeChild(n[h]),n[h]=null)}),c=(st.dropHandler||Y)({element:i,draggables:a,layout:l,options:s});return function(e,t){var n=t.addedIndex,o=t.removedIndex,r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(u(),e.targetElement||s.removeOnDropOut||r){var i={removedIndex:o,addedIndex:null!==n?null!==o&&o<n?n-1:n:null,payload:e.payload};c(i,s.onDrop)}}}function Xe(e,t){var n=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:S;return Object.assign({},S,e)}(t),o=Ve(e);return N(e,"".concat(s," ").concat(n.orientation)),{element:e,draggables:o,options:n,layout:q(e,n.orientation,n.animationDuration)}}function Ye(e){var o=e.element,r=e.options,i=null;return function(e){var t=e.draggableInfo,n=i;return null==i&&t.container.element===o&&"copy"!==r.behaviour&&(n=i=t.elementIndex),{removedIndex:n}}}function _e(e){var n=e.draggables,o=e.layout;return function(e){var t=e.dragResult;null!==t.removedIndex&&o.setVisibility(n[t.removedIndex],!1)}}function ke(e){var r=e.element,i=e.layout;return function(e){var t=e.draggableInfo,n=(e.dragResult,document.elementFromPoint(t.position.x,t.position.y));if(n){var o=P(n,t.relevantContainers);if(o&&o.element===r)return{pos:i.getPosition(t.position)}}return{pos:null}}}function We(e){var n=e.layout,o=null;return function(e){var t=e.draggableInfo;return null===e.dragResult.pos?o=null:{elementSize:o=o||n.getSize(t.size)}}}function qe(e){var o=e.element;return function(e){var t=e.draggableInfo,n=e.dragResult;!function(e,t){var n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];t&&n?e.targetElement=t:e.targetElement===t&&(e.targetElement=null)}(t,o,!!n.pos)}}function Ge(){return function(e){return null!==e.dragResult.pos?{addedIndex:0}:{addedIndex:null}}}function Ue(e){e.draggables;var r=e.layout,i=null;return function(e){var t=e.dragResult.addedIndex;if(t===i)return null;i=t;var n=r.getBeginEndOfContainer(),o=n.begin;n.end;return{shadowBeginEnd:{rect:r.getTopLeftOfElementBegin(o)}}}}function Je(e){var f=e.layout,g=e.element,p=e.options,m=null;return function(e){var t=e.dragResult,n=t.elementSize,o=t.shadowBeginEnd,r=t.addedIndex,i=t.dropPlaceholderContainer;if(p.dropPlaceholder){var a="boolean"==typeof p.dropPlaceholder?{}:p.dropPlaceholder,l=a.animationDuration,s=a.className,u=a.showOnTop;if(null===r)return i&&null!==m&&g.removeChild(i),m=null,{dropPlaceholderContainer:void 0};if(!i){var c=document.createElement("div"),d=document.createElement("div");d.className=E,c.className="".concat(y," ").concat(s||b),(i=document.createElement("div")).className="".concat(x),i.style.position="absolute",void 0!==l&&(i.style.transition="all ".concat(l,"ms ease")),i.appendChild(d),d.appendChild(c),f.setSize(i.style,n+"px"),i.style.pointerEvents="none",u?g.appendChild(i):g.insertBefore(i,g.firstElementChild)}return m!==r&&o.dropArea&&f.setBegin(i.style,o.dropArea.begin-f.getBeginEndOfContainer().begin+"px"),m=r,{dropPlaceholderContainer:i}}return null}}function Ke(e){var o=tt(e);return function(e){var t=e.draggableInfo,n=e.dragResult;return t.invalidateShadow?o({draggableInfo:t,dragResult:n}):null}}function Qe(e){var t,i,a,o=(i=(t=e).draggables,a=He({layout:t.layout}),function(e){var t=e.dragResult,n=t.shadowBeginEnd,o=t.pos;if(n)return n.begin+n.beginAdjustment<=o&&n.end>=o?null:o<n.begin+n.beginAdjustment?a(i,o):o>n.end?a(i,o)+1:i.length;var r=a(i,o,!0);return null!==r?r:i.length});return function(e){var t=e.dragResult,n=null;return null!==t.pos&&null===(n=o({dragResult:t}))&&(n=t.addedIndex),{addedIndex:n}}}function Ze(){var r=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.shadowBeginEnd;n!==r&&null!==r&&o&&(o.beginAdjustment=0),r=n}}function $e(e){var c=e.element,d=e.draggables,f=e.layout,g=e.options,p=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=t.elementSize;if(null===o)if(null!==n){if(!p){var i=f.getBeginEndOfContainer();i.end=i.begin+f.getSize(c);var a=f.getScrollSize(c)>f.getSize(c)?i.begin+f.getScrollSize(c)-f.getScrollValue(c):i.end,l=0<d.length?f.getBeginEnd(d[d.length-1]).end-d[d.length-1][m]:i.begin;if(a<l+r){(p=global.document.createElement("div")).className=v+" "+g.orientation;var s=0<d.length?r+l-a:r;return f.setSize(p.style,"".concat(s,"px")),c.appendChild(p),c[h]=p,{containerBoxChanged:!0}}}}else if(p){f.setTranslation(p,0);var u=p;return p=null,c.removeChild(u),{containerBoxChanged:!(c[h]=null)}}}}function et(e){var s=e.draggables,u=e.layout,c=null,d=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=t.elementSize;if(n!==c||o!==d){for(var i=0;i<s.length;i++)if(i!==o){var a=s[i],l=0;null!==o&&o<i&&(l-=r),null!==n&&n<=i&&(l+=r),u.setTranslation(a,l)}return{addedIndex:c=n,removedIndex:d=o}}}}function tt(e){var E=e.draggables,C=e.layout,S=null;return function(e){var t=e.draggableInfo,n=e.dragResult,o=n.addedIndex,r=n.removedIndex,i=n.elementSize,a=n.pos,l=n.shadowBeginEnd;if(null===a)return{shadowBeginEnd:S=null};if(null===o||!t.invalidateShadow&&o===S)return null;var s=o-1,u=0,c=0,d=0,f=null,g=null;if(s===r&&s--,-1<s){var p=C.getSize(E[s]);if(g=C.getBeginEnd(E[s]),i<p){var m=(p-i)/2;u=g.end-m}else u=g.end;c=g.end}else g={end:C.getBeginEndOfContainer().begin},c=C.getBeginEndOfContainer().begin;var v=1e4,h=o;if(h===r&&h++,h<E.length){var b=C.getSize(E[h]);if(f=C.getBeginEnd(E[h]),i<b){var y=(b-i)/2;v=f.begin+y}else v=f.begin;d=f.begin}else f={begin:C.getContainerRectangles().rect.end},d=C.getContainerRectangles().rect.end-C.getContainerRectangles().rect.begin;var x=g&&f?C.getTopLeftOfElementBegin(g.end):null;return S=o,{shadowBeginEnd:{dropArea:{begin:c,end:d},begin:u,end:v,rect:x,beginAdjustment:l?l.beginAdjustment:0}}}}function nt(){var a=null;return function(e){var t=e.dragResult,n=t.pos,o=t.addedIndex,r=t.shadowBeginEnd;if(null!==n){if(null!=o&&null===a){if(n<r.begin){var i=n-r.begin-5;r.beginAdjustment=i}a=o}}else a=null}}function ot(e){var n=e.options,o=!1;return function(e){var t=!!e.dragResult.pos;if(t!==o){if(!(o=t))return n.onDragLeave&&n.onDragLeave(),{dragLeft:!0};n.onDragEnter&&n.onDragEnter()}}}function rt(e){var s=e.options,u=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,r=e.draggableInfo,i=r.payload,a=r.element;if(s.onDropReady&&null!==n&&u!==n){var l=u=n;null!==o&&o<n&&l--,s.onDropReady({addedIndex:l,removedIndex:o,payload:i,element:a?a.firstElementChild:void 0})}}}function it(e){return"drop-zone"===e.options.behaviour?at(e)(Ye,_e,ke,We,qe,Ge,Ue,ot,rt):at(e)(Ye,_e,ke,We,qe,Ke,Qe,Ze,$e,et,tt,Je,nt,ot,rt)}function at(i){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var o=t.map(function(e){return e(i)}),r=null;return function(n){return r=o.reduce(function(e,t){return Object.assign(e,t({draggableInfo:n,dragResult:e}))},r||{addedIndex:null,removedIndex:null,elementSize:null,pos:null,shadowBeginEnd:null})}}}function lt(f){return function(e){var t,o,r,n=null,i=null,a=Xe(f,e),l=it(a),s=Fe(a),u=function(t,n){var o=[];function e(){o&&(o.forEach(function(e){return e.removeEventListener("scroll",n)}),global.removeEventListener("scroll",n))}return function(){for(var e=t;e;)(A(e,"x")||A(e,"y"))&&o.push(e),e=e.parentElement}(),{dispose:function(){e(),o=null},start:function(){o&&(o.forEach(function(e){return e.addEventListener("scroll",n)}),global.addEventListener("scroll",n))},stop:e}}(f,function(){a.layout.invalidateRects(),c()});function c(){null!==i&&(i.invalidateShadow=!0,n=l(i),i.invalidateShadow=!1)}function d(e,t){for(var n=Ve(t),o=0;o<n.length;o++)e[o]=n[o];for(var r=0;r<e.length-n.length;r++)e.pop()}return{element:f,draggables:a.draggables,isDragRelevant:(t=a,o=t.element,r=t.options,function(e,t){if(r.shouldAcceptDrop)return r.shouldAcceptDrop(e.getOptions(),t);var n=e.getOptions();return"copy"!==r.behaviour&&T(o,"."+g)!==e.element&&(e.element===o||!(!n.groupName||n.groupName!==r.groupName))}),layout:a.layout,dispose:function(e){var t;u.dispose(),t=e.element,st.wrapChild&&Array.prototype.forEach.call(t.children,function(e){e.nodeType===Node.ELEMENT_NODE&&L(e,g)&&(t.insertBefore(e.firstElementChild,e),t.removeChild(e))})},prepareDrag:function(e,t){var n=e.element,o=a.draggables,r=e.getOptions();d(o,n),e.layout.invalidateRects(),o.forEach(function(e){return je(e,!0,r.animationDuration)}),u.start()},handleDrag:function(e){return(n=l(i=e))&&n.dragLeft&&"drop-zone"!==a.options.behaviour&&(n.dragLeft=!1,setTimeout(function(){n&&et(a)({dragResult:n})},20)),n},handleDrop:function(e){u.stop(),n&&n.dropPlaceholderContainer&&f.removeChild(n.dropPlaceholderContainer),i=null,l=it(a),s(e,n),n=null},fireRemoveElement:function(){s(i,Object.assign({},n,{addedIndex:null}),!0),n=null},getDragResult:function(){return n},getTranslateCalculator:function(e){return et(a)(e)},onTranslated:function(){c()},getOptions:function(){return a.options},setDraggables:function(){d(a.draggables,f)},getScrollMaxSpeed:function(){return st.maxScrollSpeed}}}}var st=function(e,t){var n=lt(e)(t);return e[r]=n,Me.register(n),{dispose:function(){Me.unregister(n),n.dispose(n)}}};st.wrapChild=!0;e.smoothDnD=st,e.constants=n,e.dropHandlers=_,e.default=function e(t,n){return console.warn('default export is deprecated. please use named export "smoothDnD"'),void 0!==e.dropHandler&&(st.dropHandler=e.dropHandler),void 0!==e.wrapChild&&(st.wrapChild=e.wrapChild),st(t,n)},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).SmoothDnD={})}(this,function(e){"use strict";var l,t,i="smooth-dnd-container-instance",g="smooth-dnd-draggable-wrapper",o="animated",p="__smooth_dnd_draggable_translation_value",c="__smooth_dnd_draggable_visibility_value",E="smooth-dnd-ghost",s="smooth-dnd-container",d="smooth-dnd-extra-size-for-insertion",v="smooth-dnd-stretcher-element",h="smooth-dnd-stretcher-instance",u="smooth-dnd-disable-touch-action",f="smooth-dnd-no-user-select",r="smooth-dnd-prevent-auto-scroll-class",y="smooth-dnd-drop-preview-default-class",b="smooth-dnd-drop-preview-inner-class",w="smooth-dnd-drop-preview-constant-class",x="smooth-dnd-drop-preview-flex-container-class",n=Object.freeze({containerInstance:i,defaultGroupName:"@@smooth-dnd-default-group@@",wrapperClass:g,defaultGrabHandleClass:"smooth-dnd-default-grap-handle",animationClass:o,translationValue:p,visibilityValue:c,ghostClass:E,containerClass:s,extraSizeForInsertion:d,stretcherElementClass:v,stretcherElementInstance:h,isDraggableDetached:"smoth-dnd-is-draggable-detached",disbaleTouchActions:u,noUserSelectClass:f,preventAutoScrollClass:r,dropPlaceholderDefaultClass:y,dropPlaceholderInnerClass:b,dropPlaceholderWrapperClass:w,dropPlaceholderFlexContainerClass:x}),C={groupName:void 0,behaviour:"move",orientation:"vertical",getChildPayload:void 0,animationDuration:250,autoScrollEnabled:!0,shouldAcceptDrop:void 0,shouldAnimateDrop:void 0};function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}(t=l||(l={})).x="x",t.y="y",t.xy="xy";var D=function(e,t,n){return"x"===n?{left:Math.max(e.left,t.left),top:e.top,right:Math.min(e.right,t.right),bottom:e.bottom}:{left:e.left,top:Math.max(e.top,t.top),right:e.right,bottom:Math.min(e.bottom,t.bottom)}},R=function(e){var t=e.getBoundingClientRect(),n={left:t.left,right:t.right,top:t.top,bottom:t.bottom};if(I(e,"x")&&!B(e,"x")){var o=n.right-n.left;n.right=n.right+e.scrollWidth-o}if(I(e,"y")&&!B(e,"y")){var i=n.bottom-n.top;n.bottom=n.bottom+e.scrollHeight-i}return n},O=function(e){var t=window.getComputedStyle(e),n=t.overflow;if("auto"===n||"scroll"===n)return l.xy;var o=t["overflow-x"],i="auto"===o||"scroll"===o,r=t["overflow-y"],a="auto"===r||"scroll"===r;return i&&a?l.xy:i?l.x:a?l.y:null},A=function(e,t){var n=window.getComputedStyle(e),o=n.overflow,i=n["overflow-".concat(t)];return"auto"===o||"scroll"===o||("auto"===i||"scroll"===i)},B=function(e,t){var n=window.getComputedStyle(e),o=n.overflow,i=n["overflow-".concat(t)];return"auto"===o||"scroll"===o||"hidden"===o||("auto"===i||"scroll"===i||"hidden"===i)},I=function(e,t){return"x"===t?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight},z=function(e,t){var n=e,o=t||R(e);for(n=e.parentElement;n;)I(n,"x")&&B(n,"x")&&(o=D(o,n.getBoundingClientRect(),"x")),I(n,"y")&&B(n,"y")&&(o=D(o,n.getBoundingClientRect(),"y")),n=n.parentElement;return o},P=function(e,n){for(var o=e;o;){if(o[i]){var t=function(){var t=o[i];if(n.some(function(e){return e===t}))return{v:t}}();if("object"===a(t))return t.v}o=o.parentElement}return null},T=function(e,t){for(var n=e;n;){if(n.matches(t))return n;n=n.parentElement}return null},L=function(e,t){return-1<e.className.split(" ").map(function(e){return e}).indexOf(t)},N=function(e,t){if(e){var n=e.className.split(" ").filter(function(e){return e});-1===n.indexOf(t)&&(n.unshift(t),e.className=n.join(" "))}},M=function(e,t){if(e){var n=e.className.split(" ").filter(function(e){return e&&e!==t});e.className=n.join(" ")}},j=function(e,t){return e.removeChild(e.children[t])},V=function(e,t,n){n>=e.children.length?e.appendChild(t):e.insertBefore(t,e.children[n])},H=function(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():window.document.selection&&window.document.selection.empty()},F=function(e){if(e){var t=window.getComputedStyle(e);if(t)return t.cursor}return null};function X(e){return!(e.bottom<=e.top||e.right<=e.left)}function Y(e){var s=e.element,u=e.draggables;return function(e,t){var n=e,o=n.removedIndex,i=n.addedIndex,r=n.droppedElement,a=null;if(null!==o&&(a=j(s,o),u.splice(o,1)),null!==i){var l=window.document.createElement("div");l.className="".concat(g),l.appendChild(a&&a.firstElementChild?a.firstElementChild:r),V(s,l,i),i>=u.length?u.push(l):u.splice(i,0,l)}t&&t(e)}}var _=Object.freeze({domDropHandler:Y,reactDropHandler:function(){return{handler:function(){return function(e,t){t&&t(e)}}}}}),k={size:"offsetWidth",distanceToParent:"offsetLeft",translate:"transform",begin:"left",end:"right",dragPosition:"x",scrollSize:"scrollWidth",offsetSize:"offsetWidth",scrollValue:"scrollLeft",scale:"scaleX",setSize:"width",setters:{translate:function(e){return"translate3d(".concat(e,"px, 0, 0)")}}},W={size:"offsetHeight",distanceToParent:"offsetTop",translate:"transform",begin:"top",end:"bottom",dragPosition:"y",scrollSize:"scrollHeight",offsetSize:"offsetHeight",scrollValue:"scrollTop",scale:"scaleY",setSize:"height",setters:{translate:function(e){return"translate3d(0,".concat(e,"px, 0)")}}};function q(o,s,e){o[d]=0;var i,r=(i="horizontal"===s?k:W,{get:function(e,t){return e[i[t]||t]},set:function(e,t,n){e[i[t]]=i.setters[t]?i.setters[t](n):n}}),u={translation:0};function t(){var e,t;n(o),t=(e=o).getBoundingClientRect(),u.scaleX=e.offsetWidth?(t.right-t.left)/e.offsetWidth:1,u.scaleY=e.offsetHeight?(t.bottom-t.top)/e.offsetHeight:1}function n(e){u.rect=R(e);var t=z(e,u.rect);X(t)&&(u.lastVisibleRect=u.visibleRect),u.visibleRect=t}function a(e){var t=e;if(t.tagName){var n=t.getBoundingClientRect();return"vertical"===s?n.bottom-n.top:n.right-n.left}return r.get(e,"size")*r.get(u,"scale")}function l(e){return r.get(e,"dragPosition")}return window.addEventListener("resize",function(){n(o)}),setTimeout(function(){t()},10),{getSize:a,getContainerRectangles:function(){return{rect:u.rect,visibleRect:u.visibleRect,lastVisibleRect:u.lastVisibleRect}},getBeginEndOfDOMRect:function(e){return{begin:r.get(e,"begin"),end:r.get(e,"end")}},getBeginEndOfContainer:function(){return{begin:r.get(u.rect,"begin")+u.translation,end:r.get(u.rect,"end")+u.translation}},getBeginEndOfContainerVisibleRect:function(){return{begin:r.get(u.visibleRect,"begin")+u.translation,end:r.get(u.visibleRect,"end")+u.translation}},getBeginEnd:function(e){var t,n=(t=e,(r.get(t,"distanceToParent")+(t[p]||0))*r.get(u,"scale")+(r.get(u.rect,"begin")+u.translation)-r.get(o,"scrollValue"));return{begin:n,end:n+a(e)*r.get(u,"scale")}},getAxisValue:l,setTranslation:function(e,t){t?r.set(e.style,"translate",t):e.style.removeProperty("transform"),e[p]=t},getTranslation:function(e){return e[p]},setVisibility:function(e,t){void 0!==e[c]&&e[c]===t||(t?e.style.removeProperty("visibility"):e.style.visibility="hidden",e[c]=t)},isVisible:function(e){return void 0===e[c]||e[c]},isInVisibleRect:function(e,t){var n=u.visibleRect,o=n.left,i=n.top,r=n.right,a=n.bottom;a-i<2&&(a=i+30);var l=u.rect;return"vertical"===s?e>l.left&&e<l.right&&i<t&&t<a:o<e&&e<r&&t>l.top&&t<l.bottom},setSize:function(e,t){r.set(e,"setSize",t)},getTopLeftOfElementBegin:function(e){var t=0;return{top:"horizontal"===s?(t=e,u.rect.top):(t=u.rect.left,e),left:t}},getScrollSize:function(e){return r.get(e,"scrollSize")},getScrollValue:function(e){return r.get(e,"scrollValue")},setScrollValue:function(e,t){return r.set(e,"scrollValue",t)},invalidate:t,invalidateRects:function(){n(o)},getPosition:function(e){return l(e)},setBegin:function(e,t){r.set(e,"begin",t)}}}function G(e,t,n){var o,i,r,a=n.left,l=n.right,s=n.top,u=n.bottom,c=e.x,d=e.y;if(c<a||l<c||d<s||u<d)return null;r="x"===t?(o=a,i=l,c):(o=s,i=u,d);var f=i-o,g=400<f?100:f/4;return i-r<g?{direction:"end",speedFactor:(g-(i-r))/g}:r-o<g?{direction:"begin",speedFactor:(g-(r-o))/g}:null}var U=function(l){var s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"y",n=!1,u=null,c=null,d=null,f=null;return{animate:function(e,t){d=e,f=t,(n=!0)&&function a(){null===u&&(u=requestAnimationFrame(function(e){null===c&&(c=e);var t=e-c;c=e;var n,o,i,r=t/1e3*f;o=s,i=r="begin"===d?0-r:r,(n=l)&&(n!==window?"x"===o?n.scrollLeft+=i:n.scrollTop+=i:"x"===o?n.scrollBy(i,0):n.scrollBy(0,i)),u=null,a()}))}()},stop:function(){n&&(cancelAnimationFrame(u),n=!1,u=c=null)}}};function J(e){return function(){return z(e,e.getBoundingClientRect())}}var K,Q,Z,$=function(e){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1500,a=e.reduce(function(e,t){var n=function(e){for(var t=[],n=e.element;n;){var o=O(n);if(o&&!L(n,r)){var i={};switch(o){case l.xy:i.x={animator:U(n,"x")},i.y={animator:U(n,"y")};break;case l.x:i.x={animator:U(n,"x")};break;case l.y:i.y={animator:U(n,"y")}}t.push({axisAnimations:i,getRect:J(n),scrollerElement:n})}n=n.parentElement}return t}(t).filter(function(t){return!e.find(function(e){return e.scrollerElement===t.scrollerElement})});return[].concat(S(e),S(n))},[]);return function(e){var t,o,n=e.draggableInfo;if(e.reset)a.forEach(function(e){e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop()});else if(n){t=a,o=n.mousePosition,t.forEach(function(e){var t=e.axisAnimations,n=(0,e.getRect)();t.x&&(t.x.scrollParams=G(o,"x",n),e.cachedRect=n),t.y&&(t.y.scrollParams=G(o,"y",n),e.cachedRect=n)}),a.forEach(function(e){var t=e.axisAnimations,n=t.x,o=t.y;if(n)if(n.scrollParams){var i=n.scrollParams,r=i.direction,a=i.speedFactor;n.animator.animate(r,a*c)}else n.animator.stop();if(o)if(o.scrollParams){var l=o.scrollParams,s=l.direction,u=l.speedFactor;o.animator.animate(s,u*c)}else o.animator.stop()});var i=a.filter(function(e){return e.cachedRect});if(i.length&&1<i.length){var r=function(e,t){for(var n=document.elementFromPoint(t.x,t.y);n;){var o=e.find(function(e){return e.scrollerElement===n});if(o)return o;n=n.parentElement}return null}(i,n.mousePosition);r&&i.forEach(function(e){e!==r&&(e.axisAnimations.x&&e.axisAnimations.x.animator.stop(),e.axisAnimations.y&&e.axisAnimations.y.animator.stop())})}}}};void 0!==("undefined"==typeof window?"undefined":a(window))&&((K=Node||Element)&&K.prototype&&!K.prototype.matches&&(K.prototype.matches=K.prototype.matchesSelector||K.prototype.mozMatchesSelector||K.prototype.msMatchesSelector||K.prototype.oMatchesSelector||K.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;0<=--n&&t.item(n)!==this;);return-1<n}),(Q=Node||Element)&&Q.prototype&&null==Q.prototype.firstElementChild&&Object.defineProperty(Q.prototype,"firstElementChild",{get:function(){for(var e,t=this.childNodes,n=0;e=t[n++];)if(1===e.nodeType)return e;return null}}),Array.prototype.some||(Array.prototype.some=function(e){if(null==this)throw new TypeError("Array.prototype.some called on null or undefined");if("function"!=typeof e)throw new TypeError;for(var t=Object(this),n=t.length>>>0,o=2<=arguments.length?arguments[1]:void 0,i=0;i<n;i++)if(i in t&&e.call(o,t[i],i,t))return!0;return!1}));var ee={overflow:"hidden",display:"block"},te={height:"100%",display:"table-cell","vertical-align":"top"},ne=(m(Z={},".".concat(s),{position:"relative","min-height":"30px","min-width":"30px"}),m(Z,".".concat(s,".horizontal"),{display:"table"}),m(Z,".".concat(s,".horizontal > .").concat(v),{display:"inline-block"}),m(Z,".".concat(s,".horizontal > .").concat(g),te),m(Z,".".concat(s,".vertical > .").concat(g),ee),m(Z,".".concat(g),{"box-sizing":"border-box"}),m(Z,".".concat(g,".horizontal"),te),m(Z,".".concat(g,".vertical"),ee),m(Z,".".concat(g,".animated"),{transition:"transform ease"}),m(Z,".".concat(E,".animated"),{transition:"all ease-in-out"}),m(Z,".".concat(E," *"),{"pointer-events":"none"}),m(Z,".".concat(u," *"),{"touch-actions":"none","-ms-touch-actions":"none"}),m(Z,".".concat(f),{"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}),m(Z,".".concat(b),{flex:"1"}),m(Z,".".concat(s,".horizontal > .").concat(w),{height:"100%",overflow:"hidden",display:"table-cell","vertical-align":"top"}),m(Z,".".concat(s,".vertical > .").concat(w),{overflow:"hidden",display:"block",width:"100%"}),m(Z,".".concat(x),{width:"100%",height:"100%",display:"flex","justify-content":"stretch","align-items":"stretch"}),m(Z,".".concat(y),{"background-color":"rgba(150, 150, 150, 0.1)",border:"1px solid #ccc"}),Z);function oe(o){return Object.keys(o).reduce(function(e,t){var n=o[t];return"object"===a(n)?"".concat(e).concat(t,"{").concat(oe(n),"}"):"".concat(e).concat(t,":").concat(n,";")},"")}function ie(e){if(e&&"undefined"!=typeof window){var t=window.document.head||window.document.getElementsByTagName("head")[0],n=window.document.createElement("style"),o=oe({"body *":{cursor:"".concat(e," !important")}});return n.type="text/css",n.styleSheet?n.styleSheet.cssText=o:n.appendChild(window.document.createTextNode(o)),t.appendChild(n),n}return null}var re,ae,le=["mousedown","touchstart"],se=["mousemove","touchmove"],ue=["mouseup","touchend"],ce=null,de=null,fe=null,ge=null,me=[],pe=!1,ve=null,he=null,ye=null,be=null,we=(re=null,ae=!1,{start:function(){ae||(ae=!0,function e(){re=requestAnimationFrame(function(){ce.forEach(function(e){return e.layout.invalidateRects()}),setTimeout(function(){null!==re&&e()},50)})}())},stop:function(){null!==re&&(cancelAnimationFrame(re),re=null),ae=!1}}),xe="undefined"!=typeof window&&!!(window.navigator.userAgent.match(/Android/i)||window.navigator.userAgent.match(/webOS/i)||window.navigator.userAgent.match(/iPhone/i)||window.navigator.userAgent.match(/iPad/i)||window.navigator.userAgent.match(/iPod/i)||window.navigator.userAgent.match(/BlackBerry/i)||window.navigator.userAgent.match(/Windows Phone/i));function Ee(){"undefined"!=typeof window&&le.forEach(function(e){window.document.addEventListener(e,De,{passive:!1})})}function Ce(){return ge&&ge.ghostParent?ge.ghostParent:de&&de.parentElement||window.document.body}var Se=function(){var i,r,o,a=null,l=1,s=5;function u(e){var t=Oe(e),n=t.clientX,o=t.clientY;if(r)(Math.abs(i.clientX-n)>s||Math.abs(i.clientY-o)>s)&&f();else if(Math.abs(i.clientX-n)>l||Math.abs(i.clientY-o)>l)return g()}function c(){f()}function d(){f()}function f(){clearTimeout(a),se.forEach(function(e){return window.document.removeEventListener(e,u)},{passive:!1}),ue.forEach(function(e){return window.document.removeEventListener(e,c)},{passive:!1}),window.document.removeEventListener("drag",d,{passive:!1})}function g(){clearTimeout(a),f(),o()}return function(e,t,n){i=Oe(e),o=n,(r="number"==typeof t?t:xe?200:0)&&(a=setTimeout(g,r)),se.forEach(function(e){return window.document.addEventListener(e,u)},{passive:!1}),ue.forEach(function(e){return window.document.addEventListener(e,c)},{passive:!1}),window.document.addEventListener("drag",d,{passive:!1})}}();function De(e){var t=Oe(e);if(!pe&&(void 0===t.button||0===t.button)&&(de=T(t.target,"."+g))){var n=T(de,"."+s),o=me.filter(function(e){return e.element===n})[0],i=o.getOptions().dragHandleSelector,r=o.getOptions().nonDragAreaSelector,a=!0;if(i&&!T(t.target,i)&&(a=!1),r&&T(t.target,r)&&(a=!1),a){N(window.document.body,u),N(window.document.body,f);window.document.addEventListener("mouseup",function e(){M(window.document.body,u),M(window.document.body,f),window.document.removeEventListener("mouseup",e)})}a&&Se(t,o.getOptions().dragBeginDelay,function(){H(),ze(t,F(e.target)),se.forEach(function(e){window.document.addEventListener(e,Le,{passive:!1})}),ue.forEach(function(e){window.document.addEventListener(e,Re,{passive:!1})})})}}function Re(){var e;se.forEach(function(e){window.document.removeEventListener(e,Le,{passive:!1})}),ue.forEach(function(e){window.document.removeEventListener(e,Re,{passive:!1})}),he({reset:!0}),be&&((e=be)&&"undefined"!=typeof window&&(window.document.head||window.document.getElementsByTagName("head")[0]).removeChild(e),be=null),ge&&(we.stop(),function(e){function r(){M(fe.ghost,"animated"),fe.ghost.style.transitionDuration=null,Ce().removeChild(fe.ghost),e()}function t(e,t,n){var o=e.top,i=e.left;N(fe.ghost,"animated"),n&&N(fe.ghost.firstElementChild,n),fe.topLeft.x=i,fe.topLeft.y=o,Te(t),setTimeout(function(){r()},t+20)}function n(e,t){N(fe.ghost,"animated"),Te(e,.9,!0),setTimeout(function(){t()},e)}if(ge.targetElement){var o=me.filter(function(e){return e.element===ge.targetElement})[0];!(p=o.getOptions()).shouldAnimateDrop||p.shouldAnimateDrop(ge.container.getOptions(),ge.payload)?t(o.getDragResult().shadowBeginEnd.rect,Math.max(150,o.getOptions().animationDuration/2),o.getOptions().dropClass):r()}else{var i=me.filter(function(e){return e===ge.container})[0];if(i){var a=i.getOptions(),l=a.behaviour,s=a.removeOnDropOut;if("move"===l&&!s&&i.getDragResult()){var u=i.layout.getContainerRectangles();if(!X(u.visibleRect)&&X(u.lastVisibleRect))t({top:u.lastVisibleRect.top,left:u.lastVisibleRect.left},i.getOptions().animationDuration,i.getOptions().dropClass);else{var c=i.getDragResult(),d=c.removedIndex,f=c.elementSize,g=i.layout;i.getTranslateCalculator({dragResult:{removedIndex:d,addedIndex:d,elementSize:f,pos:void 0,shadowBeginEnd:void 0}});var m=0<d?g.getBeginEnd(i.draggables[d-1]).end:g.getBeginEndOfContainer().begin;t(g.getTopLeftOfElementBegin(m),i.getOptions().animationDuration,i.getOptions().dropClass)}}else n(i.getOptions().animationDuration,r)}else n(C.animationDuration,r)}var p}(function(){Ie(pe=!1);for(var e=ce||[],t=e.shift();void 0!==t;)t.handleDrop(ge),t=e.shift();ve=ye=ge=fe=de=ce=null}))}function Oe(e){return e.touches?e.touches[0]:e}function Ae(e){var t=e,i=null;return function(o){null===i&&(i=requestAnimationFrame(function(){var n=!1;t.forEach(function(e){var t=e.handleDrag(o);n=!!t.containerBoxChanged||!1,t.containerBoxChanged=!1}),he({draggableInfo:o}),n&&(n=!1,setTimeout(function(){me.forEach(function(e){e.layout.invalidateRects(),e.onTranslated()})},10)),i=null}))}}function Be(e,t){return e.getOptions().autoScrollEnabled?$(t,e.getScrollMaxSpeed()):function(e){return null}}function Ie(o){me.forEach(function(e){var t=o?e.getOptions().onDragStart:e.getOptions().onDragEnd;if(t){var n={isSource:e===ge.container,payload:ge.payload};e.isDragRelevant(ge.container,ge.payload)?n.willAcceptDrop=!0:n.willAcceptDrop=!1,t(n)}})}function ze(e,t){if(null!==de){pe=!0;var n=me.filter(function(e){return de.parentElement===e.element})[0];n.setDraggables(),ye=n.getOptions().lockAxis?n.getOptions().lockAxis.toLowerCase():null,h=de,y=me.filter(function(e){return h.parentElement===e.element})[0],b=y.draggables.indexOf(h),w=y.getOptions().getGhostParent,x=h.getBoundingClientRect(),ge={container:y,element:h,size:{offsetHeight:x.bottom-x.top,offsetWidth:x.right-x.left},elementIndex:b,payload:y.getOptions().getChildPayload?y.getOptions().getChildPayload(b):void 0,targetElement:null,position:{x:0,y:0},groupName:y.getOptions().groupName,ghostParent:w?w():null,invalidateShadow:null,mousePosition:null,relevantContainers:null},o=de,i={x:e.clientX,y:e.clientY},r=ge.container,a=t,l=i.x,s=i.y,u=o.getBoundingClientRect(),c=u.left,d=u.top,f=u.right,g=u.bottom,m=c+(f-c)/2,p=d+(g-d)/2,(v=o.cloneNode(!0)).style.zIndex="1000",v.style.boxSizing="border-box",v.style.position="fixed",v.style.top="0px",v.style.left="0px",v.style.transform="translate3d(".concat(c,"px, ").concat(d,"px, 0)"),v.style.width=f-c+"px",v.style.height=g-d+"px",v.style.overflow="visible",v.style.transition=null,v.style.removeProperty("transition"),v.style.pointerEvents="none",v.style.userSelect="none",r.getOptions().dragClass?setTimeout(function(){N(v.firstElementChild,r.getOptions().dragClass);var e=window.getComputedStyle(v.firstElementChild).cursor;be=ie(e)}):be=ie(a),N(v,r.getOptions().orientation||"vertical"),N(v,E),fe={ghost:v,centerDelta:{x:m-l,y:p-s},positionDelta:{left:c-l,top:d-s},topLeft:{x:c,y:d}},ge.position={x:e.clientX+fe.centerDelta.x,y:e.clientY+fe.centerDelta.y},ge.mousePosition={x:e.clientX,y:e.clientY},ce=me.filter(function(e){return e.isDragRelevant(n,ge.payload)}),ge.relevantContainers=ce,ve=Ae(ce),he&&he({reset:!0,draggableInfo:void 0}),he=Be(n,ce),ce.forEach(function(e){return e.prepareDrag(e,ce)}),Ie(!0),ve(ge),Ce().appendChild(fe.ghost),we.start()}var o,i,r,a,l,s,u,c,d,f,g,m,p,v,h,y,b,w,x}var Pe=null;function Te(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],o=fe,i=o.ghost,r=o.topLeft,a=r.x,l=r.y,s="translate3d(".concat(a.toFixed(),"px,").concat(l.toFixed(),"px, 0)");if(1!==t&&(s="".concat(s," scale(").concat(t,")")),0<e)return fe.ghost.style.transitionDuration=e+"ms",void requestAnimationFrame(function(){i.style.transform=s,Pe=null,n&&(i.style.opacity="0")});null===Pe&&(Pe=requestAnimationFrame(function(){i.style.transform=s,Pe=null,n&&(i.style.opacity="0")}))}function Le(e){e.preventDefault();var t=Oe(e);if(ge){var n=ge.container.getOptions();if("contain"===n.behaviour){var o=ge.container.layout.getBeginEndOfContainerVisibleRect();if("vertical"===n.orientation){var i=o.begin-ge.size.offsetHeight/2,r=o.end-ge.size.offsetHeight/2,a=Math.max(i,Math.min(r,t.clientY+fe.positionDelta.top));fe.topLeft.y=a,ge.position.y=Math.max(o.begin+1,Math.min(o.end-1,t.clientY+fe.centerDelta.y)),ge.mousePosition.y=Math.max(o.begin+1,Math.min(o.end-1,t.clientY))}else{var l=o.begin-ge.size.offsetWidth/2,s=o.end-ge.size.offsetWidth/2,u=Math.max(l,Math.min(s,t.clientX+fe.positionDelta.left));fe.topLeft.x=u,ge.position.x=Math.max(o.begin+1,Math.min(o.end-1,t.clientX+fe.centerDelta.x)),ge.mousePosition.x=Math.max(o.begin+1,Math.min(o.end-1,t.clientX))}}else ye?"y"===ye?(fe.topLeft.y=t.clientY+fe.positionDelta.top,ge.position.y=t.clientY+fe.centerDelta.y,ge.mousePosition.y=t.clientY):"x"===ye&&(fe.topLeft.x=t.clientX+fe.positionDelta.left,ge.position.x=t.clientX+fe.centerDelta.x,ge.mousePosition.x=t.clientX):(fe.topLeft.x=t.clientX+fe.positionDelta.left,fe.topLeft.y=t.clientY+fe.positionDelta.top,ge.position.x=t.clientX+fe.centerDelta.x,ge.position.y=t.clientY+fe.centerDelta.y,ge.mousePosition.x=t.clientX,ge.mousePosition.y=t.clientY);Te(),ve(ge)}else ze(t,F(e.target))}void 0!==("undefined"==typeof window?"undefined":a(window))&&function(){if("undefined"!=typeof window){var e=window.document.head||window.document.getElementsByTagName("head")[0],t=window.document.createElement("style");t.id="smooth-dnd-style-definitions";var n=oe(ne);t.type="text/css",t.styleSheet?t.styleSheet.cssText=n:t.appendChild(window.document.createTextNode(n)),e.appendChild(t)}}();var Ne=(Ee(),{register:function(e){var t;t=e,me.push(t),pe&&ge&&t.isDragRelevant(ge.container,ge.payload)&&(ce.push(t),t.prepareDrag(t,ce),he&&he({reset:!0,draggableInfo:void 0}),he=Be(t,ce),ve=Ae(ce),t.handleDrag(ge))},unregister:function(e){!function(e){if(me.splice(me.indexOf(e),1),pe&&ge){ge.container===e&&e.fireRemoveElement(),ge.targetElement===e.element&&(ge.targetElement=null);var t=ce.indexOf(e);-1<t&&(ce.splice(t,1),he&&he({reset:!0,draggableInfo:void 0}),he=Be(e,ce),ve=Ae(ce))}}(e)}});function Me(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:C.animationDuration;t?(N(e,o),e.style.transitionDuration=n+"ms"):(M(e,o),e.style.removeProperty("transition-duration"))}function je(n){var o=[];return Array.prototype.forEach.call(n.children,function(e){if(e.nodeType===Node.ELEMENT_NODE){var t=e;L(e,g)||(t=function(e){if(lt.wrapChild){var t=window.document.createElement("div");return t.className="".concat(g),e.parentElement.insertBefore(t,e),t.appendChild(e),t}return e}(e)),t[p]=0,o.push(t)}else n.removeChild(e)}),o}function Ve(e){var g=e.layout;return function(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return function e(t,n,o,i){var r=4<arguments.length&&void 0!==arguments[4]&&arguments[4];if(i<o)return o;if(o===i){var a=g.getBeginEnd(t[o]),l=a.begin,s=a.end;return l<n&&n<=s?r?n<(s+l)/2?o:o+1:o:null}var u=Math.floor((i+o)/2),c=g.getBeginEnd(t[u]),d=c.begin,f=c.end;return n<d?e(t,n,o,u-1,r):f<n?e(t,n,u+1,i,r):r?n<(f+d)/2?u:u+1:u}(e,t,0,e.length-1,n)}}function He(e){var t,n,o,i,r=e.element,a=e.draggables,l=e.layout,s=e.options,u=(n=(t={element:r,draggables:a,layout:l,options:s}).element,o=t.draggables,i=t.layout,function(){o.forEach(function(e){Me(e,!1),i.setTranslation(e,0),i.setVisibility(e,!0)}),n[h]&&(n[h].parentNode.removeChild(n[h]),n[h]=null)}),c=(lt.dropHandler||Y)({element:r,draggables:a,layout:l,options:s});return function(e,t){var n=t.addedIndex,o=t.removedIndex,i=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(u(),e.targetElement||s.removeOnDropOut||i){var r={removedIndex:o,addedIndex:null!==n?null!==o&&o<n?n-1:n:null,payload:e.payload};c(r,s.onDrop)}}}function Fe(e,t){var n=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:C;return Object.assign({},C,e)}(t),o=je(e);return N(e,"".concat(s," ").concat(n.orientation)),{element:e,draggables:o,options:n,layout:q(e,n.orientation,n.animationDuration)}}function Xe(e){var o=e.element,i=e.options,r=null;return function(e){var t=e.draggableInfo,n=r;return null==r&&t.container.element===o&&"copy"!==i.behaviour&&(n=r=t.elementIndex),{removedIndex:n}}}function Ye(e){var n=e.draggables,o=e.layout;return function(e){var t=e.dragResult;null!==t.removedIndex&&o.setVisibility(n[t.removedIndex],!1)}}function _e(e){var i=e.element,r=e.layout;return function(e){var t=e.draggableInfo,n=(e.dragResult,document.elementFromPoint(t.position.x,t.position.y));if(n){var o=P(n,t.relevantContainers);if(o&&o.element===i)return{pos:r.getPosition(t.position)}}return{pos:null}}}function ke(e){var n=e.layout,o=null;return function(e){var t=e.draggableInfo;return null===e.dragResult.pos?o=null:{elementSize:o=o||n.getSize(t.size)}}}function We(e){var o=e.element;return function(e){var t=e.draggableInfo,n=e.dragResult;!function(e,t){var n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];t&&n?e.targetElement=t:e.targetElement===t&&(e.targetElement=null)}(t,o,!!n.pos)}}function qe(){return function(e){return null!==e.dragResult.pos?{addedIndex:0}:{addedIndex:null}}}function Ge(e){e.draggables;var i=e.layout,r=null;return function(e){var t=e.dragResult.addedIndex;if(t===r)return null;r=t;var n=i.getBeginEndOfContainer(),o=n.begin;n.end;return{shadowBeginEnd:{rect:i.getTopLeftOfElementBegin(o)}}}}function Ue(e){var f=e.layout,g=e.element,m=e.options,p=null;return function(e){var t=e.dragResult,n=t.elementSize,o=t.shadowBeginEnd,i=t.addedIndex,r=t.dropPlaceholderContainer;if(m.dropPlaceholder){var a="boolean"==typeof m.dropPlaceholder?{}:m.dropPlaceholder,l=a.animationDuration,s=a.className,u=a.showOnTop;if(null===i)return r&&null!==p&&g.removeChild(r),p=null,{dropPlaceholderContainer:void 0};if(!r){var c=document.createElement("div"),d=document.createElement("div");d.className=x,c.className="".concat(b," ").concat(s||y),(r=document.createElement("div")).className="".concat(w),r.style.position="absolute",void 0!==l&&(r.style.transition="all ".concat(l,"ms ease")),r.appendChild(d),d.appendChild(c),f.setSize(r.style,n+"px"),r.style.pointerEvents="none",u?g.appendChild(r):g.insertBefore(r,g.firstElementChild)}return p!==i&&o.dropArea&&f.setBegin(r.style,o.dropArea.begin-f.getBeginEndOfContainer().begin+"px"),p=i,{dropPlaceholderContainer:r}}return null}}function Je(e){var o=et(e);return function(e){var t=e.draggableInfo,n=e.dragResult;return t.invalidateShadow?o({draggableInfo:t,dragResult:n}):null}}function Ke(e){var t,r,a,o=(r=(t=e).draggables,a=Ve({layout:t.layout}),function(e){var t=e.dragResult,n=t.shadowBeginEnd,o=t.pos;if(n)return n.begin+n.beginAdjustment<=o&&n.end>=o?null:o<n.begin+n.beginAdjustment?a(r,o):o>n.end?a(r,o)+1:r.length;var i=a(r,o,!0);return null!==i?i:r.length});return function(e){var t=e.dragResult,n=null;return null!==t.pos&&null===(n=o({dragResult:t}))&&(n=t.addedIndex),{addedIndex:n}}}function Qe(){var i=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.shadowBeginEnd;n!==i&&null!==i&&o&&(o.beginAdjustment=0),i=n}}function Ze(e){var c=e.element,d=e.draggables,f=e.layout,g=e.options,m=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,i=t.elementSize;if(null===o)if(null!==n){if(!m){var r=f.getBeginEndOfContainer();r.end=r.begin+f.getSize(c);var a=f.getScrollSize(c)>f.getSize(c)?r.begin+f.getScrollSize(c)-f.getScrollValue(c):r.end,l=0<d.length?f.getBeginEnd(d[d.length-1]).end-d[d.length-1][p]:r.begin;if(a<l+i){(m=window.document.createElement("div")).className=v+" "+g.orientation;var s=0<d.length?i+l-a:i;return f.setSize(m.style,"".concat(s,"px")),c.appendChild(m),c[h]=m,{containerBoxChanged:!0}}}}else if(m){f.setTranslation(m,0);var u=m;return m=null,c.removeChild(u),{containerBoxChanged:!(c[h]=null)}}}}function $e(e){var s=e.draggables,u=e.layout,c=null,d=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,i=t.elementSize;if(n!==c||o!==d){for(var r=0;r<s.length;r++)if(r!==o){var a=s[r],l=0;null!==o&&o<r&&(l-=i),null!==n&&n<=r&&(l+=i),u.setTranslation(a,l)}return{addedIndex:c=n,removedIndex:d=o}}}}function et(e){var x=e.draggables,E=e.layout,C=null;return function(e){var t=e.draggableInfo,n=e.dragResult,o=n.addedIndex,i=n.removedIndex,r=n.elementSize,a=n.pos,l=n.shadowBeginEnd;if(null===a)return{shadowBeginEnd:C=null};if(null===o||!t.invalidateShadow&&o===C)return null;var s=o-1,u=0,c=0,d=0,f=null,g=null;if(s===i&&s--,-1<s){var m=E.getSize(x[s]);if(g=E.getBeginEnd(x[s]),r<m){var p=(m-r)/2;u=g.end-p}else u=g.end;c=g.end}else g={end:E.getBeginEndOfContainer().begin},c=E.getBeginEndOfContainer().begin;var v=1e4,h=o;if(h===i&&h++,h<x.length){var y=E.getSize(x[h]);if(f=E.getBeginEnd(x[h]),r<y){var b=(y-r)/2;v=f.begin+b}else v=f.begin;d=f.begin}else f={begin:E.getContainerRectangles().rect.end},d=E.getContainerRectangles().rect.end-E.getContainerRectangles().rect.begin;var w=g&&f?E.getTopLeftOfElementBegin(g.end):null;return C=o,{shadowBeginEnd:{dropArea:{begin:c,end:d},begin:u,end:v,rect:w,beginAdjustment:l?l.beginAdjustment:0}}}}function tt(){var a=null;return function(e){var t=e.dragResult,n=t.pos,o=t.addedIndex,i=t.shadowBeginEnd;if(null!==n){if(null!=o&&null===a){if(n<i.begin){var r=n-i.begin-5;i.beginAdjustment=r}a=o}}else a=null}}function nt(e){var n=e.options,o=!1;return function(e){var t=!!e.dragResult.pos;if(t!==o){if(!(o=t))return n.onDragLeave&&n.onDragLeave(),{dragLeft:!0};n.onDragEnter&&n.onDragEnter()}}}function ot(e){var s=e.options,u=null;return function(e){var t=e.dragResult,n=t.addedIndex,o=t.removedIndex,i=e.draggableInfo,r=i.payload,a=i.element;if(s.onDropReady&&null!==n&&u!==n){var l=u=n;null!==o&&o<n&&l--,s.onDropReady({addedIndex:l,removedIndex:o,payload:r,element:a?a.firstElementChild:void 0})}}}function it(e){return"drop-zone"===e.options.behaviour?rt(e)(Xe,Ye,_e,ke,We,qe,Ge,nt,ot):rt(e)(Xe,Ye,_e,ke,We,Je,Ke,Qe,Ze,$e,et,Ue,tt,nt,ot)}function rt(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var o=t.map(function(e){return e(r)}),i=null;return function(n){return i=o.reduce(function(e,t){return Object.assign(e,t({draggableInfo:n,dragResult:e}))},i||{addedIndex:null,removedIndex:null,elementSize:null,pos:null,shadowBeginEnd:null})}}}function at(f){return function(e){var t,o,i,n=null,r=null,a=Fe(f,e),l=it(a),s=He(a),u=function(t,n){var o=[];function e(){o&&(o.forEach(function(e){return e.removeEventListener("scroll",n)}),window.removeEventListener("scroll",n))}return function(){for(var e=t;e;)(A(e,"x")||A(e,"y"))&&o.push(e),e=e.parentElement}(),{dispose:function(){e(),o=null},start:function(){o&&(o.forEach(function(e){return e.addEventListener("scroll",n)}),window.addEventListener("scroll",n))},stop:e}}(f,function(){a.layout.invalidateRects(),c()});function c(){null!==r&&(r.invalidateShadow=!0,n=l(r),r.invalidateShadow=!1)}function d(e,t){for(var n=je(t),o=0;o<n.length;o++)e[o]=n[o];for(var i=0;i<e.length-n.length;i++)e.pop()}return{element:f,draggables:a.draggables,isDragRelevant:(t=a,o=t.element,i=t.options,function(e,t){if(i.shouldAcceptDrop)return i.shouldAcceptDrop(e.getOptions(),t);var n=e.getOptions();return"copy"!==i.behaviour&&T(o,"."+g)!==e.element&&(e.element===o||!(!n.groupName||n.groupName!==i.groupName))}),layout:a.layout,dispose:function(e){var t;u.dispose(),t=e.element,lt.wrapChild&&Array.prototype.forEach.call(t.children,function(e){e.nodeType===Node.ELEMENT_NODE&&L(e,g)&&(t.insertBefore(e.firstElementChild,e),t.removeChild(e))})},prepareDrag:function(e,t){var n=e.element,o=a.draggables,i=e.getOptions();d(o,n),e.layout.invalidateRects(),o.forEach(function(e){return Me(e,!0,i.animationDuration)}),u.start()},handleDrag:function(e){return(n=l(r=e))&&n.dragLeft&&"drop-zone"!==a.options.behaviour&&(n.dragLeft=!1,setTimeout(function(){n&&$e(a)({dragResult:n})},20)),n},handleDrop:function(e){u.stop(),n&&n.dropPlaceholderContainer&&f.removeChild(n.dropPlaceholderContainer),r=null,l=it(a),s(e,n),n=null},fireRemoveElement:function(){s(r,Object.assign({},n,{addedIndex:null}),!0),n=null},getDragResult:function(){return n},getTranslateCalculator:function(e){return $e(a)(e)},onTranslated:function(){c()},getOptions:function(){return a.options},setDraggables:function(){d(a.draggables,f)},getScrollMaxSpeed:function(){return lt.maxScrollSpeed}}}}var lt=function(e,t){var n=at(e)(t);return e[i]=n,Ne.register(n),{dispose:function(){Ne.unregister(n),n.dispose(n)}}};lt.wrapChild=!0;e.smoothDnD=lt,e.constants=n,e.dropHandlers=_,e.default=function e(t,n){return console.warn('default export is deprecated. please use named export "smoothDnD"'),void 0!==e.dropHandler&&(lt.dropHandler=e.dropHandler),void 0!==e.wrapChild&&(lt.wrapChild=e.wrapChild),lt(t,n)},Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -1,1 +0,1 @@ | ||
declare var global: any; | ||
declare function applyPolyfills(): void; |
@@ -37,4 +37,4 @@ import { Rect, ScrollAxis, IContainer } from './interfaces'; | ||
export declare const clearSelection: () => void; | ||
export declare const getElementCursor: (element: Element | null) => any; | ||
export declare const getElementCursor: (element: Element | null) => string | null; | ||
export declare const getDistanceToParent: (parent: HTMLElement, child: HTMLElement) => number | null; | ||
export declare function isVisible(rect: Rect): boolean; |
{ | ||
"name": "smooth-dnd", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "Drag and Drop library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
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
58701