forked from SortableJS/Sortable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSortable.min.js
2 lines (2 loc) · 40.3 KB
/
Sortable.min.js
1
2
/*! Sortable 1.15.0 - MIT | git://github.com/SortableJS/Sortable.git */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Sortable=e()}(this,function(){"use strict";function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o,n=arguments[e];for(o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function t(t){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(t)}const w=t(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),E=t(/Edge/i),c=t(/firefox/i),d=t(/safari/i)&&!t(/chrome/i)&&!t(/android/i);var e=t(/iP(ad|od|hone)/i),o=t(/chrome/i)&&t(/android/i);const n={capture:!1,passive:!1};function u(t,e,o){t.addEventListener(e,o,!w&&n)}function r(t,e,o){t.removeEventListener(e,o,!w&&n)}function l(t,e){if(e&&(">"===e[0]&&(e=e.substring(1)),t))try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(t){return}}function x(t,e,o,n){if(t){o=o||document;do{if(null!=e&&(">"!==e[0]||t.parentNode===o)&&l(t,e)||n&&t===o)return t}while(t!==o&&(t=(i=t).host&&i!==document&&i.host.nodeType?i.host:i.parentNode))}var i;return null}const i=/\s+/g;function M(t,e,o){var n;t&&e&&(t.classList?t.classList[o?"add":"remove"](e):(n=(" "+t.className+" ").replace(i," ").replace(" "+e+" "," "),t.className=(n+(o?" "+e:"")).replace(i," ")))}function N(t,e,o){let n=t&&t.style;if(n){if(void 0===o)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(o=t.currentStyle),void 0===e?o:o[e];e in n||-1!==e.indexOf("webkit")||(e="-webkit-"+e),n[e]=o+("string"==typeof o?"":"px")}}function f(t,e){let o="";if("string"==typeof t)o=t;else do{var n=N(t,"transform");n&&"none"!==n&&(o=n+" "+o)}while(!e&&(t=t.parentNode));const i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(o)}function h(n,i,r){if(n){let t=n.getElementsByTagName(i),e=0,o=t.length;if(r)for(;e<o;e++)r(t[e],e);return t}return[]}function p(){var t=document.scrollingElement;return t||document.documentElement}function A(l,s,c,d,u){if(l.getBoundingClientRect||l===window){let t,e,o,n,i,r,a;if(a=l!==window&&l.parentNode&&l!==p()?(t=l.getBoundingClientRect(),e=t.top,o=t.left,n=t.bottom,i=t.right,r=t.height,t.width):(e=0,o=0,n=window.innerHeight,i=window.innerWidth,r=window.innerHeight,window.innerWidth),(s||c)&&l!==window&&(u=u||l.parentNode,!w))do{if(u&&u.getBoundingClientRect&&("none"!==N(u,"transform")||c&&"static"!==N(u,"position"))){var h=u.getBoundingClientRect();e-=h.top+parseInt(N(u,"border-top-width")),o-=h.left+parseInt(N(u,"border-left-width")),n=e+t.height,i=o+t.width;break}}while(u=u.parentNode);return d&&l!==window&&(d=(s=f(u||l))&&s.a,l=s&&s.d,s&&(e/=l,o/=d,a/=d,r/=l,n=e+r,i=o+a)),{top:e,left:o,bottom:n,right:i,width:a,height:r}}}function I(t,e,o){let n=s(t,!0),i=A(t)[e];for(;n;){let t=A(n)[o],e;if(e="top"===o||"left"===o?t<=i:i<=t,!e)return n;if(n===p())break;n=s(n,!1)}return!1}function O(t,e,o,n){let i=0,r=0,a=t.children;for(;r<a.length;){if("none"!==a[r].style.display&&a[r]!==It.ghost&&(n||a[r]!==It.dragged)&&x(a[r],o.draggable,t,!1)){if(i===e)return a[r];i++}r++}return null}function P(t,e){let o=t.lastElementChild;for(;o&&(o===It.ghost||"none"===N(o,"display")||e&&!l(o,e));)o=o.previousElementSibling;return o||null}function k(t,e){let o=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)"TEMPLATE"===t.nodeName.toUpperCase()||t===It.clone||e&&!l(t,e)||o++;return o}function g(t){let e=0,o=0,n=p();if(t)do{var i=f(t),r=i.a,i=i.d;e+=t.scrollLeft*r,o+=t.scrollTop*i}while(t!==n&&(t=t.parentNode));return[e,o]}function s(t,e){if(!t||!t.getBoundingClientRect)return p();let o=t,n=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var i=N(o);if(o.clientWidth<o.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!o.getBoundingClientRect||o===document.body)return p();if(n||e)return o;n=!0}}}while(o=o.parentNode);return p()}function m(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}let v;function b(e,o){return function(){var t;v||(1===(t=arguments).length?e.call(this,t[0]):e.apply(this,t),v=setTimeout(function(){v=void 0},o))}}function R(t,e,o){t.scrollLeft+=e,t.scrollTop+=o}function y(t){let e=window.Polymer,o=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):o?o(t).clone(!0)[0]:t.cloneNode(!0)}function D(t,e){N(t,"position","absolute"),N(t,"top",e.top),N(t,"left",e.left),N(t,"width",e.width),N(t,"height",e.height)}function _(t){N(t,"position",""),N(t,"top",""),N(t,"left",""),N(t,"width",""),N(t,"height","")}const X="Sortable"+(new Date).getTime();function S(){let n=[],e;return{captureAnimationState(){if(n=[],this.options.animation){let t=[].slice.call(this.el.children);t.forEach(e=>{if("none"!==N(e,"display")&&e!==It.ghost){n.push({target:e,rect:A(e)});let t={...n[n.length-1].rect};var o;!e.thisAnimationDuration||(o=f(e,!0))&&(t.top-=o.f,t.left-=o.e),e.fromRect=t}})}},addAnimationState(t){n.push(t)},removeAnimationState(t){n.splice(function(t,e){for(var o in t)if(t.hasOwnProperty(o))for(var n in e)if(e.hasOwnProperty(n)&&e[n]===t[o][n])return Number(o);return-1}(n,{target:t}),1)},animateAll(t){if(!this.options.animation)return clearTimeout(e),void("function"==typeof t&&t());let h=!1,p=0;n.forEach(t=>{let e=0,o=t.target,n=o.fromRect,i=A(o),r=o.prevFromRect,a=o.prevToRect,l=t.rect,s=f(o,!0);var c,d,u;s&&(i.top-=s.f,i.left-=s.e),o.toRect=i,o.thisAnimationDuration&&m(r,i)&&!m(n,i)&&(l.top-i.top)/(l.left-i.left)==(n.top-i.top)/(n.left-i.left)&&(e=(c=l,d=r,u=a,t=this.options,Math.sqrt(Math.pow(d.top-c.top,2)+Math.pow(d.left-c.left,2))/Math.sqrt(Math.pow(d.top-u.top,2)+Math.pow(d.left-u.left,2))*t.animation)),m(i,n)||(o.prevFromRect=n,o.prevToRect=i,e=e||this.options.animation,this.animate(o,l,i,e)),e&&(h=!0,p=Math.max(p,e),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout(function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null},e),o.thisAnimationDuration=e)}),clearTimeout(e),h?e=setTimeout(function(){"function"==typeof t&&t()},p):"function"==typeof t&&t(),n=[]},animate(t,e,o,n){var i,r;n&&(N(t,"transition",""),N(t,"transform",""),i=(r=f(this.el))&&r.a,r=r&&r.d,i=(e.left-o.left)/(i||1),r=(e.top-o.top)/(r||1),t.animatingX=!!i,t.animatingY=!!r,N(t,"transform","translate3d("+i+"px,"+r+"px,0)"),this.forRepaintDummy=t.offsetWidth,N(t,"transition","transform "+n+"ms"+(this.options.easing?" "+this.options.easing:"")),N(t,"transform","translate3d(0,0,0)"),"number"==typeof t.animated&&clearTimeout(t.animated),t.animated=setTimeout(function(){N(t,"transition",""),N(t,"transform",""),t.animated=!1,t.animatingX=!1,t.animatingY=!1},n))}}}let C=[];const T={initializeByDefault:!0};var Y={mount(e){for(var t in T)!T.hasOwnProperty(t)||t in e||(e[t]=T[t]);C.forEach(t=>{if(t.pluginName===e.pluginName)throw`Sortable: Cannot mount plugin ${e.pluginName} more than once`}),C.push(e)},pluginEvent(e,o,n){this.eventCanceled=!1,n.cancel=()=>{this.eventCanceled=!0};const i=e+"Global";C.forEach(t=>{o[t.pluginName]&&(o[t.pluginName][i]&&o[t.pluginName][i]({sortable:o,...n}),o.options[t.pluginName]&&o[t.pluginName][e]&&o[t.pluginName][e]({sortable:o,...n}))})},initializePlugins(n,i,r,t){for(var e in C.forEach(e=>{var o=e.pluginName;if(n.options[o]||e.initializeByDefault){let t=new e(n,i,n.options);t.sortable=n,t.options=n.options,n[o]=t,a(r,t.defaults)}}),n.options){var o;n.options.hasOwnProperty(e)&&(void 0!==(o=this.modifyOption(n,e,n.options[e]))&&(n.options[e]=o))}},getEventProperties(e,o){let n={};return C.forEach(t=>{"function"==typeof t.eventProperties&&a(n,t.eventProperties.call(o[t.pluginName],e))}),n},modifyOption(e,o,n){let i;return C.forEach(t=>{e[t.pluginName]&&t.optionListeners&&"function"==typeof t.optionListeners[o]&&(i=t.optionListeners[o].call(e[t.pluginName],n))}),i}};function B({sortable:n,rootEl:i,name:r,targetEl:a,cloneEl:l,toEl:s,fromEl:c,oldIndex:d,newIndex:u,oldDraggableIndex:h,newDraggableIndex:p,originalEvent:f,putSortable:g,extraEventProperties:m}){if(n=n||i&&i[X]){let t,e=n.options,o="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||w||E?(t=document.createEvent("Event"),t.initEvent(r,!0,!0)):t=new CustomEvent(r,{bubbles:!0,cancelable:!0}),t.to=s||i,t.from=c||i,t.item=a||i,t.clone=l,t.oldIndex=d,t.newIndex=u,t.oldDraggableIndex=h,t.newDraggableIndex=p,t.originalEvent=f,t.pullMode=g?g.lastPutMode:void 0;var v,b={...m,...Y.getEventProperties(r,n)};for(v in b)t[v]=b[v];i&&i.dispatchEvent(t),e[o]&&e[o].call(n,t)}}let F=function(t,e,{evt:o,...n}={}){Y.pluginEvent.bind(It)(t,e,{dragEl:L,parentEl:K,ghostEl:W,rootEl:z,nextEl:G,lastDownEl:$,cloneEl:U,cloneHidden:j,dragStarted:dt,putSortable:tt,activeSortable:It.active,originalEvent:o,oldIndex:q,oldDraggableIndex:Z,newIndex:V,newDraggableIndex:Q,hideGhostForTarget:xt,unhideGhostForTarget:Mt,cloneNowHidden(){j=!0},cloneNowShown(){j=!1},dispatchSortableEvent(t){H({sortable:e,name:t,originalEvent:o})},...n})};function H(t){B({putSortable:tt,cloneEl:U,targetEl:L,rootEl:z,oldIndex:q,oldDraggableIndex:Z,newIndex:V,newDraggableIndex:Q,...t})}let L,K,W,z,G,$,U,j,q,V,Z,Q,J,tt,et=!1,ot=!1,nt=[],it,rt,at,lt,st,ct,dt,ut,ht,pt=!1,ft=!1,gt,mt,vt=[],bt=!1,wt=[];const Et="undefined"!=typeof document,yt=e,Dt=E||w?"cssFloat":"float",_t=Et&&!o&&!e&&"draggable"in document.createElement("div"),St=function(){if(Et){if(w)return!1;let t=document.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}}(),Ct=function(t,e){let o=N(t),n=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),i=O(t,0,e),r=O(t,1,e),a=i&&N(i),l=r&&N(r),s=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+A(i).width,c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+A(r).width;if("flex"===o.display)return"column"===o.flexDirection||"column-reverse"===o.flexDirection?"vertical":"horizontal";if("grid"===o.display)return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&a.float&&"none"!==a.float){e="left"===a.float?"left":"right";return!r||"both"!==l.clear&&l.clear!==e?"horizontal":"vertical"}return i&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||n<=s&&"none"===o[Dt]||r&&"none"===o[Dt]&&n<s+c)?"vertical":"horizontal"},Tt=function(t){function l(r,a){return function(t,e,o,n){var i=t.options.group.name&&e.options.group.name&&t.options.group.name===e.options.group.name;if(null==r&&(a||i))return!0;if(null==r||!1===r)return!1;if(a&&"clone"===r)return r;if("function"==typeof r)return l(r(t,e,o,n),a)(t,e,o,n);e=(a?t:e).options.group.name;return!0===r||"string"==typeof r&&r===e||r.join&&-1<r.indexOf(e)}}let e={},o=t.group;o&&"object"==typeof o||(o={name:o}),e.name=o.name,e.checkPull=l(o.pull,!0),e.checkPut=l(o.put),e.revertClone=o.revertClone,t.group=e},xt=function(){!St&&W&&N(W,"display","none")},Mt=function(){!St&&W&&N(W,"display","")};Et&&!o&&document.addEventListener("click",function(t){if(ot)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ot=!1},!0);let Nt=function(o){if(L){let e=function(i,r){let a;return nt.some(t=>{var e=t[X].options.emptyInsertThreshold;if(e&&!P(t)){var o=A(t),n=i>=o.left-e&&i<=o.right+e,e=r>=o.top-e&&r<=o.bottom+e;return n&&e?a=t:void 0}}),a}((o=o.touches?o.touches[0]:o).clientX,o.clientY);if(e){let t={};for(var n in o)o.hasOwnProperty(n)&&(t[n]=o[n]);t.target=t.rootEl=e,t.preventDefault=void 0,t.stopPropagation=void 0,e[X]._onDragOver(t)}}},At=function(t){L&&L?.parentNode?.[X]._isOutsideThisEl(t.target)};function It(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw`Sortable: \`el\` must be an HTMLElement, not ${{}.toString.call(t)}`;this.el=t,this.options=e=a({},e),t[X]=this;var o,n,i={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Ct(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==It.supportPointer&&"PointerEvent"in window&&!d,emptyInsertThreshold:5};for(o in Y.initializePlugins(this,t,i),i)o in e||(e[o]=i[o]);for(n in Tt(e),this)"_"===n.charAt(0)&&"function"==typeof this[n]&&(this[n]=this[n].bind(this));this.nativeDraggable=!e.forceFallback&&_t,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?u(t,"pointerdown",this._onTapStart):(u(t,"mousedown",this._onTapStart),u(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(u(t,"dragover",this),u(t,"dragenter",this)),nt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),a(this,S())}function Ot(t,e,o,n,i,r,a,l){let s,c=t[X],d=c.options.onMove,u;return!window.CustomEvent||w||E?(s=document.createEvent("Event"),s.initEvent("move",!0,!0)):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=o,s.draggedRect=n,s.related=i||e,s.relatedRect=r||A(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),d&&(u=d.call(c,s,a)),u}function Pt(t){t.draggable=!1}function kt(){bt=!1}function Rt(t){return setTimeout(t,0)}function Xt(t){return clearTimeout(t)}It.prototype={constructor:It,_isOutsideThisEl:function(t){this.el.contains(t)||t===this.el||(ut=null)},_getDirection:function(t,e){return"function"==typeof this.options.direction?this.options.direction.call(this,t,e,L):this.options.direction},_onTapStart:function(c){if(c.cancelable){let e=this,o=this.el,t=this.options,n=t.preventOnFilter,i=c.type,r=c.touches&&c.touches[0]||c.pointerType&&"touch"===c.pointerType&&c,a=(r||c).target,l=c.target.shadowRoot&&(c.path&&c.path[0]||c.composedPath&&c.composedPath()[0])||a,s=t.filter;if(!function(t){wt.length=0;let e=t.getElementsByTagName("input"),o=e.length;for(;o--;){var n=e[o];n.checked&&wt.push(n)}}(o),!L&&!(/mousedown|pointerdown/.test(i)&&0!==c.button||t.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!d||!a||"SELECT"!==a.tagName.toUpperCase())&&(a=x(a,t.draggable,o,!1),!(a&&a.animated||$===a))){if(q=k(a),Z=k(a,t.draggable),"function"==typeof s){if(s.call(this,c,a,this))return H({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:o,fromEl:o}),F("filter",e,{evt:c}),void(n&&c.cancelable&&c.preventDefault())}else if(s&&(s=s.split(",").some(function(t){if(t=x(l,t.trim(),o,!1))return H({sortable:e,rootEl:t,name:"filter",targetEl:a,fromEl:o,toEl:o}),F("filter",e,{evt:c}),!0}),s))return void(n&&c.cancelable&&c.preventDefault());t.handle&&!x(l,t.handle,o,!1)||this._prepareDragStart(c,r,a)}}},_prepareDragStart:function(t,e,o){let n=this,i=n.el,r=n.options,a=i.ownerDocument,l;var s;o&&!L&&o.parentNode===i&&(s=A(o),z=i,L=o,K=L.parentNode,G=L.nextSibling,$=o,J=r.group,It.dragged=L,it={target:L,clientX:(e||t).clientX,clientY:(e||t).clientY},st=it.clientX-s.left,ct=it.clientY-s.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,L.style["will-change"]="all",l=function(){F("delayEnded",n,{evt:t}),It.eventCanceled?n._onDrop():(n._disableDelayedDragEvents(),!c&&n.nativeDraggable&&(L.draggable=!0),n._triggerDragStart(t,e),H({sortable:n,name:"choose",originalEvent:t}),M(L,r.chosenClass,!0))},r.ignore.split(",").forEach(function(t){h(L,t.trim(),Pt)}),u(a,"dragover",Nt),u(a,"mousemove",Nt),u(a,"touchmove",Nt),u(a,"mouseup",n._onDrop),u(a,"touchend",n._onDrop),u(a,"touchcancel",n._onDrop),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,L.draggable=!0),F("delayStart",this,{evt:t}),!r.delay||r.delayOnTouchOnly&&!e||this.nativeDraggable&&(E||w)?l():It.eventCanceled?this._onDrop():(u(a,"mouseup",n._disableDelayedDrag),u(a,"touchend",n._disableDelayedDrag),u(a,"touchcancel",n._disableDelayedDrag),u(a,"mousemove",n._delayedDragTouchMoveHandler),u(a,"touchmove",n._delayedDragTouchMoveHandler),r.supportPointer&&u(a,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(l,r.delay)))},_delayedDragTouchMoveHandler:function(t){t=t.touches?t.touches[0]:t;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){L&&Pt(L),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;r(t,"mouseup",this._disableDelayedDrag),r(t,"touchend",this._disableDelayedDrag),r(t,"touchcancel",this._disableDelayedDrag),r(t,"mousemove",this._delayedDragTouchMoveHandler),r(t,"touchmove",this._delayedDragTouchMoveHandler),r(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||"touch"==t.pointerType&&t,!this.nativeDraggable||e?this.options.supportPointer?u(document,"pointermove",this._onTouchMove):u(document,e?"touchmove":"mousemove",this._onTouchMove):(u(L,"dragend",this),u(z,"dragstart",this._onDragStart));try{document.selection?Rt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(t){}},_dragStarted:function(t,e){var o;et=!1,z&&L?(F("dragStarted",this,{evt:e}),this.nativeDraggable&&u(document,"dragover",At),o=this.options,t||M(L,o.dragClass,!1),M(L,o.ghostClass,!0),It.active=this,t&&this._appendGhost(),H({sortable:this,name:"start",originalEvent:e})):this._nulling()},_emulateDragOver:function(){if(rt){this._lastX=rt.clientX,this._lastY=rt.clientY,xt();let t=document.elementFromPoint(rt.clientX,rt.clientY),e=t;for(;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(rt.clientX,rt.clientY),t!==e);)e=t;if(L?.parentNode?.[X]._isOutsideThisEl(t),e)do{if(e[X])if(e[X]._onDragOver({clientX:rt.clientX,clientY:rt.clientY,target:t,rootEl:e})&&!this.options.dragoverBubble)break}while(t=e,e=e.parentNode);Mt()}},_onTouchMove:function(d){if(it){let t=this.options,e=t.fallbackTolerance,o=t.fallbackOffset,n=d.touches?d.touches[0]:d,i=W&&f(W,!0),r=W&&i&&i.a,a=W&&i&&i.d,l=yt&&mt&&g(mt),s=(n.clientX-it.clientX+o.x)/(r||1)+(l?l[0]-vt[0]:0)/(r||1),c=(n.clientY-it.clientY+o.y)/(a||1)+(l?l[1]-vt[1]:0)/(a||1);if(!It.active&&!et){if(e&&Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))<e)return;this._onDragStart(d,!0)}var u;W&&(i?(i.e+=s-(at||0),i.f+=c-(lt||0)):i={a:1,b:0,c:0,d:1,e:s,f:c},u=`matrix(${i.a},${i.b},${i.c},${i.d},${i.e},${i.f})`,N(W,"webkitTransform",u),N(W,"mozTransform",u),N(W,"msTransform",u),N(W,"transform",u),N(W.parentElement,"cursor",t.cursorType),at=s,lt=c,rt=n),d.cancelable&&d.preventDefault()}},_appendGhost:function(){if(!W){let t=this.options.fallbackOnBody?document.body:z,e=A(L,!0,yt,!0,t),o=this.options;if(yt){for(mt=t;"static"===N(mt,"position")&&"none"===N(mt,"transform")&&mt!==document;)mt=mt.parentNode;mt!==document.body&&mt!==document.documentElement?(mt===document&&(mt=p()),e.top+=mt.scrollTop,e.left+=mt.scrollLeft):mt=p(),vt=g(mt)}W=L.cloneNode(!0),M(W,o.ghostClass,!1),M(W,o.fallbackClass,!0),M(W,o.dragClass,!0),N(W,"transition",""),N(W,"transform",""),N(W,"box-sizing","border-box"),N(W,"margin",0),N(W,"top",e.top),N(W,"left",e.left),N(W,"width",e.width),N(W,"height",e.height),N(W,"opacity","0"),N(W,"position",yt?"absolute":"fixed"),N(W,"zIndex","100000"),N(W,"pointerEvents","none"),N(W.parentElement,"cursor",o.cursorType),It.ghost=W,t.appendChild(W),N(W,"transform-origin",st/parseInt(W.style.width)*100+"% "+ct/parseInt(W.style.height)*100+"%")}},_onDragStart:function(t,e){let o=this,n=t.dataTransfer,i=o.options;F("dragStart",this,{evt:t}),It.eventCanceled?this._onDrop():(F("setupClone",this),It.eventCanceled||(U=y(L),U.removeAttribute("id"),U.draggable=!1,U.style["will-change"]="",this._hideClone(),M(U,this.options.chosenClass,!1),It.clone=U),o.cloneId=Rt(function(){F("clone",o),It.eventCanceled||(o.options.removeCloneOnHide||z.insertBefore(U,L),o._hideClone(),H({sortable:o,name:"clone"}))}),e||M(L,i.dragClass,!0),e?(ot=!0,o._loopId=setInterval(o._emulateDragOver,50)):(r(document,"mouseup",o._onDrop),r(document,"touchend",o._onDrop),r(document,"touchcancel",o._onDrop),n&&(n.effectAllowed="move",i.setData&&i.setData.call(o,n,L)),u(document,"drop",o),N(L,"transform","translateZ(0)")),et=!0,o._dragStartId=Rt(o._dragStarted.bind(o,e,t)),u(document,"selectstart",o),dt=!0,d&&N(document.body,"user-select","none"))},_onDragOver:function(d){let u=this.el,h=d.target,p,f,o,g=this.options,t=g.group,e=It.active,n=J===t,i=g.sort,r=tt||e,m,a=this,l=!1;if(!bt){if(void 0!==d.preventDefault&&d.cancelable&&d.preventDefault(),h=x(h,g.draggable,u,!0),s("dragOver"),It.eventCanceled)return l;if(L.contains(d.target)||h.animated&&h.animatingX&&h.animatingY||a._ignoreWhileAnimating===h)return C(!1);if(ot=!1,e&&!g.disabled&&(n?i||(o=K!==z):tt===this||(this.lastPutMode=J.checkPull(this,e,L,d))&&t.checkPut(this,e,L,d))){if(m="vertical"===this._getDirection(d,h),p=A(L),s("dragOverValid"),It.eventCanceled)return l;if(o)return K=z,S(),this._hideClone(),s("revert"),It.eventCanceled||(G?z.insertBefore(L,G):z.appendChild(L)),C(!0);var v=P(u,g.draggable);if(!v||function(t,e,o){o=A(P(o.el,o.options.draggable));return e?t.clientX>o.right+10||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+10}(d,m,this)&&!v.animated){if(v===L)return C(!1);if(v&&u===d.target&&(h=v),h&&(f=A(h)),!1!==Ot(z,u,L,p,h,f,d,!!h))return S(),v&&v.nextSibling?u.insertBefore(L,v.nextSibling):u.appendChild(L),K=u,T(),C(!0)}else if(v&&function(t,e,o){o=A(O(o.el,0,o.options,!0));return e?t.clientX<o.left-10||t.clientY<o.top&&t.clientX<o.right:t.clientY<o.top-10||t.clientY<o.bottom&&t.clientX<o.left}(d,m,this)){var b=O(u,0,g,!0);if(b===L)return C(!1);if(h=b,f=A(h),!1!==Ot(z,u,L,p,h,f,d,!1))return S(),u.insertBefore(L,b),K=u,T(),C(!0)}else if(h.parentNode===u){f=A(h);let e,t,o=L.parentNode!==u,n=(w=L.animated&&L.toRect||p,E=h.animated&&h.toRect||f,y=m,D=y?w.left:w.top,_=y?w.right:w.bottom,v=y?w.width:w.height,b=y?E.left:E.top,w=y?E.right:E.bottom,E=y?E.width:E.height,!(D===b||_===w||D+v/2===b+E/2)),i=m?"top":"left",r=I(h,"top","top")||I(L,"top","top"),a=r?r.scrollTop:void 0;ut!==h&&(t=f[i],pt=!1,ft=!n&&g.invertSwap||o);let l;if(0!==(e=function(t,e,o,n,i,r,a,l){let s=n?t.clientY:t.clientX,c=n?o.height:o.width,d=n?o.top:o.left,u=n?o.bottom:o.right,h=!1;if(!a)if(l&><c*i){if(!pt&&(1===ht?d+c*r/2<s:s<u-c*r/2)&&(pt=!0),pt)h=!0;else if(1===ht?s<d+gt:s>u-gt)return-ht}else if(d+c*(1-i)/2<s&&s<u-c*(1-i)/2)return function(t){return k(L)<k(t)?1:-1}(e);if(h=h||a,h&&(s<d+c*r/2||u-c*r/2<s))return d+c/2<s?1:-1;return 0}(d,h,f,m,n?1:g.swapThreshold,null==g.invertedSwapThreshold?g.swapThreshold:g.invertedSwapThreshold,ft,ut===h))){let t=k(L);for(;t-=e,l=K.children[t],l&&("none"===N(l,"display")||l===W););}if(0===e||l===h)return C(!1);ut=h,ht=e;let s=h.nextElementSibling,c=!1;c=1===e;E=Ot(z,u,L,p,h,f,d,c);if(!1!==E)return 1!==E&&-1!==E||(c=1===E),bt=!0,setTimeout(kt,30),S(),c&&!s?u.appendChild(L):h.parentNode.insertBefore(L,c?s:h),r&&R(r,0,a-r.scrollTop),K=L.parentNode,void 0===t||ft||(gt=Math.abs(t-A(h)[i])),T(),C(!0)}if(u.contains(L))return C(!1)}var w,E,y,D,_;return!1}function s(t,e){F(t,a,{evt:d,isOwner:n,axis:m?"vertical":"horizontal",revert:o,dragRect:p,targetRect:f,canSort:i,fromSortable:r,target:h,completed:C,onMove(t,e){return Ot(z,u,L,p,t,A(t),d,e)},changed:T,...e})}function S(){s("dragOverAnimationCapture"),a.captureAnimationState(),a!==r&&r.captureAnimationState()}function C(t){return s("dragOverCompleted",{insertion:t}),t&&(n?e._hideClone():e._showClone(a),a!==r&&(M(L,(tt||e).options.ghostClass,!1),M(L,g.ghostClass,!0)),tt!==a&&a!==It.active?tt=a:a===It.active&&tt&&(tt=null),r===a&&(a._ignoreWhileAnimating=h),a.animateAll(function(){s("dragOverAnimationComplete"),a._ignoreWhileAnimating=null}),a!==r&&(r.animateAll(),r._ignoreWhileAnimating=null)),(h===L&&!L.animated||h===u&&!h.animated)&&(ut=null),g.dragoverBubble||d.rootEl||h===document||(L.parentNode[X]._isOutsideThisEl(d.target),t||Nt(d)),!g.dragoverBubble&&d.stopPropagation&&d.stopPropagation(),l=!0}function T(){V=k(L),Q=k(L,g.draggable),H({sortable:a,name:"change",toEl:u,newIndex:V,newDraggableIndex:Q,originalEvent:d})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){r(document,"mousemove",this._onTouchMove),r(document,"touchmove",this._onTouchMove),r(document,"pointermove",this._onTouchMove),r(document,"dragover",Nt),r(document,"mousemove",Nt),r(document,"touchmove",Nt)},_offUpEvents:function(){var t=this.el.ownerDocument;r(t,"mouseup",this._onDrop),r(t,"touchend",this._onDrop),r(t,"pointerup",this._onDrop),r(t,"touchcancel",this._onDrop),r(document,"selectstart",this)},_onDrop:function(t){var e=this.el,o=this.options;V=k(L),Q=k(L,o.draggable),F("drop",this,{evt:t}),K=L&&L.parentNode,V=k(L),Q=k(L,o.draggable),It.eventCanceled||(et=!1,ft=!1,pt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Xt(this.cloneId),Xt(this._dragStartId),this.nativeDraggable&&(r(document,"drop",this),r(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),d&&N(document.body,"user-select",""),N(L,"transform",""),t&&(dt&&(t.cancelable&&t.preventDefault(),o.dropBubble||t.stopPropagation()),W&&W.parentNode&&W.parentNode.removeChild(W),(z===K||tt&&"clone"!==tt.lastPutMode)&&U&&U.parentNode&&U.parentNode.removeChild(U),L&&(this.nativeDraggable&&r(L,"dragend",this),Pt(L),L.style["will-change"]="",dt&&!et&&M(L,(tt||this).options.ghostClass,!1),M(L,this.options.chosenClass,!1),H({sortable:this,name:"unchoose",toEl:K,newIndex:null,newDraggableIndex:null,originalEvent:t}),z!==K?(0<=V&&(H({rootEl:K,name:"add",toEl:K,fromEl:z,originalEvent:t}),H({sortable:this,name:"remove",toEl:K,originalEvent:t}),H({rootEl:K,name:"sort",toEl:K,fromEl:z,originalEvent:t}),H({sortable:this,name:"sort",toEl:K,originalEvent:t})),tt&&tt.save()):V!==q&&0<=V&&(H({sortable:this,name:"update",toEl:K,originalEvent:t}),H({sortable:this,name:"sort",toEl:K,originalEvent:t})),It.active&&(null!=V&&-1!==V||(V=q,Q=Z),H({sortable:this,name:"end",toEl:K,originalEvent:t}),this.save())))),this._nulling()},_nulling:function(){F("nulling",this),z=L=K=W=G=U=$=j=it=rt=dt=V=Q=q=Z=ut=ht=tt=J=It.dragged=It.ghost=It.clone=It.active=null,wt.forEach(function(t){t.checked=!0}),wt.length=at=lt=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":L&&(this._onDragOver(t),function(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move");t.cancelable&&t.preventDefault()}(t));break;case"selectstart":t.preventDefault()}},toArray:function(){let t=[],e,o=this.el.children,n=0,i=o.length,r=this.options;for(;n<i;n++)e=o[n],x(e,r.draggable,this.el,!1)&&t.push(e.getAttribute(r.dataIdAttr)||function(t){let e=t.tagName+t.className+t.src+t.href+t.textContent,o=e.length,n=0;for(;o--;)n+=e.charCodeAt(o);return n.toString(36)}(e));return t},sort:function(t,e){let o={},n=this.el;this.toArray().forEach(function(t,e){e=n.children[e];x(e,this.options.draggable,n,!1)&&(o[t]=e)},this),e&&this.captureAnimationState(),t.forEach(function(t){o[t]&&(n.removeChild(o[t]),n.appendChild(o[t]))}),e&&this.animateAll()},save:function(){let t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return x(t,e||this.options.draggable,this.el,!1)},option:function(t,e){let o=this.options;if(void 0===e)return o[t];var n=Y.modifyOption(this,t,e);o[t]=void 0!==n?n:e,"group"===t&&Tt(o)},destroy:function(){F("destroy",this);let t=this.el;t[X]=null,r(t,"mousedown",this._onTapStart),r(t,"touchstart",this._onTapStart),r(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(r(t,"dragover",this),r(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),nt.splice(nt.indexOf(this.el),1),this.el=t=null},_hideClone:function(){j||(F("hideClone",this),It.eventCanceled||(N(U,"display","none"),this.options.removeCloneOnHide&&U.parentNode&&U.parentNode.removeChild(U),j=!0))},_showClone:function(t){"clone"===t.lastPutMode?j&&(F("showClone",this),It.eventCanceled||(L.parentNode!=z||this.options.group.revertClone?G?z.insertBefore(U,G):z.appendChild(U):z.insertBefore(U,L),this.options.group.revertClone&&this.animate(L,U),N(U,"display",""),j=!1)):this._hideClone()}},Et&&u(document,"touchmove",function(t){(It.active||et)&&t.cancelable&&t.preventDefault()}),It.utils={on:u,off:r,css:N,find:h,is:function(t,e){return!!x(t,e,t,!1)},extend:function(t,e){if(t&&e)for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);return t},throttle:b,closest:x,toggleClass:M,clone:y,index:k,nextTick:Rt,cancelNextTick:Xt,detectDirection:Ct,getChild:O},It.get=function(t){return t[X]},It.mount=function(...t){(t=t[0].constructor===Array?t[0]:t).forEach(t=>{if(!t.prototype||!t.prototype.constructor)throw`Sortable: Mounted plugin must be a constructor function, not ${{}.toString.call(t)}`;t.utils&&(It.utils={...It.utils,...t.utils}),Y.mount(t)})},It.create=function(t,e){return new It(t,e)};let Yt=[],Bt,Ft,Ht=!(It.version="1.15.0"),Lt,Kt,Wt,zt;function Gt(){Yt.forEach(function(t){clearInterval(t.pid)}),Yt=[]}function $t(){clearInterval(zt)}const Ut=b(function(w,t,e,E){if(t.scroll){const _=(w.touches?w.touches[0]:w).clientX,S=(w.touches?w.touches[0]:w).clientY,C=t.scrollSensitivity,T=t.scrollSpeed,x=p();let g=!1,m;Ft!==e&&(Ft=e,Gt(),Bt=t.scroll,m=t.scrollFn,!0===Bt&&(Bt=s(e,!0)));let v=0,b=Bt;do{let t=b,e=A(t),o=e.top,n=e.bottom,i=e.left,r=e.right,a=e.width,l=e.height,s,c,d=t.scrollWidth,u=t.scrollHeight,h=N(t),p=t.scrollLeft,f=t.scrollTop;c=t===x?(s=a<d&&("auto"===h.overflowX||"scroll"===h.overflowX||"visible"===h.overflowX),l<u&&("auto"===h.overflowY||"scroll"===h.overflowY||"visible"===h.overflowY)):(s=a<d&&("auto"===h.overflowX||"scroll"===h.overflowX),l<u&&("auto"===h.overflowY||"scroll"===h.overflowY));var y=s&&(Math.abs(r-_)<=C&&p+a<d)-(Math.abs(i-_)<=C&&!!p),D=c&&(Math.abs(n-S)<=C&&f+l<u)-(Math.abs(o-S)<=C&&!!f);if(!Yt[v])for(let t=0;t<=v;t++)Yt[t]||(Yt[t]={});Yt[v].vx==y&&Yt[v].vy==D&&Yt[v].el===t||(Yt[v].el=t,Yt[v].vx=y,Yt[v].vy=D,clearInterval(Yt[v].pid),0==y&&0==D||(g=!0,Yt[v].pid=setInterval(function(){E&&0===this.layer&&It.active._onTouchMove(Wt);var t=Yt[this.layer].vy?Yt[this.layer].vy*T:0,e=Yt[this.layer].vx?Yt[this.layer].vx*T:0;"function"==typeof m&&"continue"!==m.call(It.dragged.parentNode[X],e,t,w,Wt,Yt[this.layer].el)||R(Yt[this.layer].el,e,t)}.bind({layer:v}),24))),v++}while(t.bubbleScroll&&b!==x&&(b=s(b,!1)));Ht=g}},30);o=function({originalEvent:e,putSortable:o,dragEl:n,activeSortable:i,dispatchSortableEvent:r,hideGhostForTarget:a,unhideGhostForTarget:l}){if(e){let t=o||i;a();e=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,e=document.elementFromPoint(e.clientX,e.clientY);l(),t&&!t.el.contains(e)&&(r("spill"),this.onSpill({dragEl:n,putSortable:o}))}};function jt(){}function qt(){}jt.prototype={startIndex:null,dragStart({oldDraggableIndex:t}){this.startIndex=t},onSpill({dragEl:t,putSortable:e}){this.sortable.captureAnimationState(),e&&e.captureAnimationState();var o=O(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(t,o):this.sortable.el.appendChild(t),this.sortable.animateAll(),e&&e.animateAll()},drop:o},a(jt,{pluginName:"revertOnSpill"}),qt.prototype={onSpill({dragEl:t,putSortable:e}){const o=e||this.sortable;o.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),o.animateAll()},drop:o},a(qt,{pluginName:"removeOnSpill"});let Vt;let Zt=[],Qt=[],Jt,te,ee=!1,oe=!1,ne=!1,ie,re,ae;function le(o,n){Qt.forEach((t,e)=>{e=n.children[t.sortableIndex+(o?Number(e):0)];e?n.insertBefore(t,e):n.appendChild(t)})}function se(){Zt.forEach(t=>{t!==ie&&t.parentNode&&t.parentNode.removeChild(t)})}return It.mount(new function(){function t(){for(var t in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this))}return t.prototype={dragStarted({originalEvent:t}){this.sortable.nativeDraggable?u(document,"dragover",this._handleAutoScroll):this.options.supportPointer?u(document,"pointermove",this._handleFallbackAutoScroll):t.touches?u(document,"touchmove",this._handleFallbackAutoScroll):u(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted({originalEvent:t}){this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop(){this.sortable.nativeDraggable?r(document,"dragover",this._handleAutoScroll):(r(document,"pointermove",this._handleFallbackAutoScroll),r(document,"touchmove",this._handleFallbackAutoScroll),r(document,"mousemove",this._handleFallbackAutoScroll)),$t(),Gt(),clearTimeout(v),v=void 0},nulling(){Wt=Ft=Bt=Ht=zt=Lt=Kt=null,Yt.length=0},_handleFallbackAutoScroll(t){this._handleAutoScroll(t,!0)},_handleAutoScroll(o,n){const i=(o.touches?o.touches[0]:o).clientX,r=(o.touches?o.touches[0]:o).clientY,t=document.elementFromPoint(i,r);if(Wt=o,n||this.options.forceAutoScrollFallback||E||w||d){Ut(o,this.options,t,n);let e=s(t,!0);!Ht||zt&&i===Lt&&r===Kt||(zt&&$t(),zt=setInterval(()=>{var t=s(document.elementFromPoint(i,r),!0);t!==e&&(e=t,Gt()),Ut(o,this.options,t,n)},10),Lt=i,Kt=r)}else this.options.bubbleScroll&&s(t,!0)!==p()?Ut(o,this.options,s(t,!1),!1):Gt()}},a(t,{pluginName:"scroll",initializeByDefault:!0})}),It.mount(qt,jt),It.mount(new function(){function t(){this.defaults={swapClass:"sortable-swap-highlight"}}return t.prototype={dragStart({dragEl:t}){Vt=t},dragOverValid({completed:t,target:e,onMove:o,activeSortable:n,changed:i,cancel:r}){var a;n.options.swap&&(a=this.sortable.el,n=this.options,e&&e!==a&&(a=Vt,Vt=!1!==o(e)?(M(e,n.swapClass,!0),e):null,a&&a!==Vt&&M(a,n.swapClass,!1)),i(),t(!0),r())},drop({activeSortable:t,putSortable:e,dragEl:o}){let n=e||this.sortable;var i=this.options;Vt&&M(Vt,i.swapClass,!1),Vt&&(i.swap||e&&e.options.swap)&&o!==Vt&&(n.captureAnimationState(),n!==t&&t.captureAnimationState(),function(t,e){let o=t.parentNode,n=e.parentNode,i,r;o&&n&&!o.isEqualNode(e)&&!n.isEqualNode(t)&&(i=k(t),r=k(e),o.isEqualNode(n)&&i<r&&r++,o.insertBefore(e,o.children[i]),n.insertBefore(t,n.children[r]))}(o,Vt),n.animateAll(),n!==t&&t.animateAll())},nulling(){Vt=null}},a(t,{pluginName:"swap",eventProperties(){return{swapItem:Vt}}})}),It.mount(new function(){function t(n){for(var t in this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this));n.options.avoidImplicitDeselect||(n.options.supportPointer?u(document,"pointerup",this._deselectMultiDrag):(u(document,"mouseup",this._deselectMultiDrag),u(document,"touchend",this._deselectMultiDrag))),u(document,"keydown",this._checkKeyDown),u(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,avoidImplicitDeselect:!1,setData(t,e){let o="";Zt.length&&te===n?Zt.forEach((t,e)=>{o+=(e?", ":"")+t.textContent}):o=e.textContent,t.setData("Text",o)}}}return t.prototype={multiDragKeyDown:!1,isMultiDrag:!1,delayStartGlobal({dragEl:t}){ie=t},delayEnded(){this.isMultiDrag=~Zt.indexOf(ie)},setupClone({sortable:t,cancel:e}){if(this.isMultiDrag){for(let t=0;t<Zt.length;t++)Qt.push(y(Zt[t])),Qt[t].sortableIndex=Zt[t].sortableIndex,Qt[t].draggable=!1,Qt[t].style["will-change"]="",M(Qt[t],this.options.selectedClass,!1),Zt[t]===ie&&M(Qt[t],this.options.chosenClass,!1);t._hideClone(),e()}},clone({sortable:t,rootEl:e,dispatchSortableEvent:o,cancel:n}){this.isMultiDrag&&(this.options.removeCloneOnHide||Zt.length&&te===t&&(le(!0,e),o("clone"),n()))},showClone({cloneNowShown:t,rootEl:e,cancel:o}){this.isMultiDrag&&(le(!1,e),Qt.forEach(t=>{N(t,"display","")}),t(),ae=!1,o())},hideClone({cloneNowHidden:t,cancel:e}){this.isMultiDrag&&(Qt.forEach(t=>{N(t,"display","none"),this.options.removeCloneOnHide&&t.parentNode&&t.parentNode.removeChild(t)}),t(),ae=!0,e())},dragStartGlobal({}){!this.isMultiDrag&&te&&te.multiDrag._deselectMultiDrag(),Zt.forEach(t=>{t.sortableIndex=k(t)}),Zt=Zt.sort(function(t,e){return t.sortableIndex-e.sortableIndex}),ne=!0},dragStarted({sortable:t}){if(this.isMultiDrag){if(this.options.sort&&(t.captureAnimationState(),this.options.animation)){Zt.forEach(t=>{t!==ie&&N(t,"position","absolute")});let e=A(ie,!1,!0,!0);Zt.forEach(t=>{t!==ie&&D(t,e)}),oe=!0,ee=!0}t.animateAll(()=>{oe=!1,ee=!1,this.options.animation&&Zt.forEach(t=>{_(t)}),this.options.sort&&se()})}},dragOver({target:t,completed:e,cancel:o}){oe&&~Zt.indexOf(t)&&(e(!1),o())},revert({fromSortable:e,rootEl:t,sortable:o,dragRect:n}){var i,r;1<Zt.length&&(Zt.forEach(t=>{o.addAnimationState({target:t,rect:oe?A(t):n}),_(t),t.fromRect=n,e.removeAnimationState(t)}),oe=!1,i=!this.options.removeCloneOnHide,r=t,Zt.forEach((t,e)=>{e=r.children[t.sortableIndex+(i?Number(e):0)];e?r.insertBefore(t,e):r.appendChild(t)}))},dragOverCompleted({sortable:t,isOwner:e,insertion:o,activeSortable:n,parentEl:i,putSortable:r}){var a=this.options;if(o){if(e&&n._hideClone(),ee=!1,a.animation&&1<Zt.length&&(oe||!e&&!n.options.sort&&!r)){let e=A(ie,!1,!0,!0);Zt.forEach(t=>{t!==ie&&(D(t,e),i.appendChild(t))}),oe=!0}e||(oe||se(),1<Zt.length?(e=ae,n._showClone(t),n.options.animation&&!ae&&e&&Qt.forEach(t=>{n.addAnimationState({target:t,rect:re}),t.fromRect=re,t.thisAnimationDuration=null})):n._showClone(t))}},dragOverAnimationCapture({dragRect:t,isOwner:e,activeSortable:o}){Zt.forEach(t=>{t.thisAnimationDuration=null}),o.options.animation&&!e&&o.multiDrag.isMultiDrag&&(re=a({},t),t=f(ie,!0),re.top-=t.f,re.left-=t.e)},dragOverAnimationComplete(){oe&&(oe=!1,se())},drop({originalEvent:o,rootEl:r,parentEl:a,sortable:l,dispatchSortableEvent:t,oldIndex:s,putSortable:e}){let c=e||this.sortable;if(o){let n=this.options,i=a.children;if(!ne)if(n.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),M(ie,n.selectedClass,!~Zt.indexOf(ie)),~Zt.indexOf(ie))Zt.splice(Zt.indexOf(ie),1),Jt=null,B({sortable:l,rootEl:r,name:"deselect",targetEl:ie,originalEvent:o});else{if(Zt.push(ie),B({sortable:l,rootEl:r,name:"select",targetEl:ie,originalEvent:o}),o.shiftKey&&Jt&&l.el.contains(Jt)){var d=k(Jt),u=k(ie);if(~d&&~u&&d!==u){let t,e;for(t=d<u?(e=d,u):(e=u,d+1);e<t;e++)~Zt.indexOf(i[e])||(M(i[e],n.selectedClass,!0),Zt.push(i[e]));B({sortable:l,rootEl:r,name:"select",targetEl:i[i.length-1],originalEvent:o})}}else Jt=ie;te=c}if(ne&&this.isMultiDrag){if(oe=!1,(a[X].options.sort||a!==r)&&1<Zt.length){let o=A(ie),e=k(ie,":not(."+this.options.selectedClass+")");if(!ee&&n.animation&&(ie.thisAnimationDuration=null),c.captureAnimationState(),!ee&&(n.animation&&(ie.fromRect=o,Zt.forEach(t=>{var e;t.thisAnimationDuration=null,t!==ie&&(e=oe?A(t):o,t.fromRect=e,c.addAnimationState({target:t,rect:e}))})),se(),Zt.forEach(t=>{i[e]?a.insertBefore(t,i[e]):a.appendChild(t),e++}),s===k(ie))){let e=!1;Zt.forEach(t=>{t.sortableIndex!==k(t)&&(e=!0)}),e&&t("update")}Zt.forEach(t=>{_(t)}),c.animateAll()}te=c}(r===a||e&&"clone"!==e.lastPutMode)&&Qt.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)})}},nullingGlobal(){this.isMultiDrag=ne=!1,Qt.length=0},destroyGlobal(){this._deselectMultiDrag(),r(document,"pointerup",this._deselectMultiDrag),r(document,"mouseup",this._deselectMultiDrag),r(document,"touchend",this._deselectMultiDrag),r(document,"keydown",this._checkKeyDown),r(document,"keyup",this._checkKeyUp)},_deselectMultiDrag(t){if(!(void 0!==ne&&ne||te!==this.sortable||t&&x(t.target,this.options.draggable,this.sortable.el,!1)||t&&0!==t.button)){for(;Zt.length;)M(Zt[0],this.options.selectedClass,!1),Zt.shift();B({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:Zt[0],originalEvent:t})}},_checkKeyDown(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},a(t,{pluginName:"multiDrag",utils:{select(t){var e=t.parentNode[X];e&&e.options.multiDrag&&!~Zt.indexOf(t)&&(te&&te!==e&&(te.multiDrag._deselectMultiDrag(),te=e),M(t,e.options.selectedClass,!0),Zt.push(t))},deselect(t){var e=t.parentNode[X],o=Zt.indexOf(t);e&&e.options.multiDrag&&~o&&(M(t,e.options.selectedClass,!1),Zt.splice(o,1))}},eventProperties(){const o=[],n=[];return Zt.forEach(t=>{o.push({multiDragElement:t,index:t.sortableIndex});let e;e=oe&&t!==ie?-1:oe?k(t,":not(."+this.options.selectedClass+")"):k(t),n.push({multiDragElement:t,index:e})}),{items:[...Zt],clones:[...Qt],oldIndicies:o,newIndicies:n}},optionListeners:{multiDragKey(t){return"ctrl"===(t=t.toLowerCase())?t="Control":1<t.length&&(t=t.charAt(0).toUpperCase()+t.substr(1)),t}}})}),It});