/**! * Sortable 1.15.2 * @author RubaXa * @author owenm * @license MIT */function De(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function J(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function Ge(t,e){if(t==null)return{};var n=$e(t,e),o,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}function Je(t){return Ve(t)||Ze(t)||tn(t)||en()}function Ve(t){if(Array.isArray(t))return ne(t)}function Ze(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function tn(t,e){if(t){if(typeof t=="string")return ne(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ne(t,e)}}function ne(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n"&&(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(n){return!1}return!1}}function on(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function z(t,e,n,o){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&jt(t,e):jt(t,e))||o&&t===n)return t;if(t===n)break}while(t=on(t))}return null}var xe=/\s+/g;function x(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(xe," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(xe," ")}}function f(t,e,n){var o=t&&t.style;if(o){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=n+(typeof n=="string"?"":"px")}}function ut(t,e){var n="";if(typeof t=="string")n=t;else do{var o=f(t,"transform");o&&o!=="none"&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function Oe(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i=r:a=i<=r,!a)return o;if(o===V())break;o=it(o,!1)}return!1}function vt(t,e,n,o){for(var i=0,r=0,a=t.children;r2&&arguments[2]!==void 0?arguments[2]:{},o=n.evt,i=Ge(n,dn);xt.pluginEvent.bind(p)(t,e,J({dragEl:c,parentEl:M,ghostEl:v,rootEl:C,nextEl:dt,lastDownEl:Ht,cloneEl:O,cloneHidden:rt,dragStarted:Mt,putSortable:P,activeSortable:p.active,originalEvent:o,oldIndex:bt,oldDraggableIndex:At,newIndex:j,newDraggableIndex:at,hideGhostForTarget:He,unhideGhostForTarget:Le,cloneNowHidden:function(){rt=!0},cloneNowShown:function(){rt=!1},dispatchSortableEvent:function(r){X({sortable:e,name:r,originalEvent:o})}},i))};function X(t){Ot(J({putSortable:P,cloneEl:O,targetEl:c,rootEl:C,oldIndex:bt,oldDraggableIndex:At,newIndex:j,newDraggableIndex:at},t))}var c,M,v,C,dt,Ht,O,rt,bt,j,At,at,Lt,P,yt=!1,Kt=!1,Wt=[],ht,q,se,ce,Re,Xe,Mt,wt,Nt,It=!1,zt=!1,Ut,R,ue=[],de=!1,qt=[],Qt=typeof document<"u",$t=Se,Ye=St||et?"cssFloat":"float",hn=Qt&&!Ce&&!Se&&"draggable"in document.createElement("div"),Be=function(){if(Qt){if(et)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Fe=function(t,e){var n=f(t),o=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=vt(t,0,e),r=vt(t,1,e),a=i&&f(i),s=r&&f(r),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+S(i).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+S(r).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&a.float&&a.float!=="none"){var d=a.float==="left"?"left":"right";return r&&(s.clear==="both"||s.clear===d)?"vertical":"horizontal"}return i&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||l>=o&&n[Ye]==="none"||r&&n[Ye]==="none"&&l+u>o)?"vertical":"horizontal"},fn=function(t,e,n){var o=n?t.left:t.top,i=n?t.right:t.bottom,r=n?t.width:t.height,a=n?e.left:e.top,s=n?e.right:e.bottom,l=n?e.width:e.height;return o===a||i===s||o+r/2===a+l/2},pn=function(t,e){var n;return Wt.some(function(o){var i=o[k].options.emptyInsertThreshold;if(!(!i||oe(o))){var r=S(o),a=t>=r.left-i&&t<=r.right+i,s=e>=r.top-i&&e<=r.bottom+i;if(a&&s)return n=o}}),n},je=function(t){function e(i,r){return function(a,s,l,u){var d=a.options.group.name&&s.options.group.name&&a.options.group.name===s.options.group.name;if(i==null&&(r||d))return!0;if(i==null||i===!1)return!1;if(r&&i==="clone")return i;if(typeof i=="function")return e(i(a,s,l,u),r)(a,s,l,u);var h=(r?a:s).options.group.name;return i===!0||typeof i=="string"&&i===h||i.join&&i.indexOf(h)>-1}}var n={},o=t.group;(!o||Ft(o)!="object")&&(o={name:o}),n.name=o.name,n.checkPull=e(o.pull,!0),n.checkPut=e(o.put),n.revertClone=o.revertClone,t.group=n},He=function(){!Be&&v&&f(v,"display","none")},Le=function(){!Be&&v&&f(v,"display","")};Qt&&!Ce&&document.addEventListener("click",function(t){if(Kt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Kt=!1,!1},!0);var ft=function(t){if(c){t=t.touches?t.touches[0]:t;var e=pn(t.clientX,t.clientY);if(e){var n={};for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[k]._onDragOver(n)}}},gn=function(t){c&&c.parentNode[k]._isOutsideThisEl(t.target)};function p(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=W({},e),t[k]=this;var n={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 Fe(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(r,a){r.setData("Text",a.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:p.supportPointer!==!1&&"PointerEvent"in window&&!Ct,emptyInsertThreshold:5};xt.initializePlugins(this,t,n);for(var o in n)!(o in e)&&(e[o]=n[o]);je(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:hn,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?w(t,"pointerdown",this._onTapStart):(w(t,"mousedown",this._onTapStart),w(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(w(t,"dragover",this),w(t,"dragenter",this)),Wt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),W(this,sn())}p.prototype={constructor:p,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(wt=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,c):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,o=this.options,i=o.preventOnFilter,r=t.type,a=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,s=(a||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,u=o.filter;if(_n(n),!c&&!(/mousedown|pointerdown/.test(r)&&t.button!==0||o.disabled)&&!l.isContentEditable&&!(!this.nativeDraggable&&Ct&&s&&s.tagName.toUpperCase()==="SELECT")&&(s=z(s,o.draggable,n,!1),!(s&&s.animated)&&Ht!==s)){if(bt=A(s),At=A(s,o.draggable),typeof u=="function"){if(u.call(this,t,s,this)){X({sortable:e,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Y("filter",e,{evt:t}),i&&t.cancelable&&t.preventDefault();return}}else if(u&&(u=u.split(",").some(function(d){if(d=z(l,d.trim(),n,!1),d)return X({sortable:e,rootEl:d,name:"filter",targetEl:s,fromEl:n,toEl:n}),Y("filter",e,{evt:t}),!0}),u)){i&&t.cancelable&&t.preventDefault();return}o.handle&&!z(l,o.handle,n,!1)||this._prepareDragStart(t,a,s)}}},_prepareDragStart:function(t,e,n){var o=this,i=o.el,r=o.options,a=i.ownerDocument,s;if(n&&!c&&n.parentNode===i){var l=S(n);if(C=i,c=n,M=c.parentNode,dt=c.nextSibling,Ht=n,Lt=r.group,p.dragged=c,ht={target:c,clientX:(e||t).clientX,clientY:(e||t).clientY},Re=ht.clientX-l.left,Xe=ht.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,c.style["will-change"]="all",s=function(){if(Y("delayEnded",o,{evt:t}),p.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!_e&&o.nativeDraggable&&(c.draggable=!0),o._triggerDragStart(t,e),X({sortable:o,name:"choose",originalEvent:t}),x(c,r.chosenClass,!0)},r.ignore.split(",").forEach(function(u){Oe(c,u.trim(),he)}),w(a,"dragover",ft),w(a,"mousemove",ft),w(a,"touchmove",ft),w(a,"mouseup",o._onDrop),w(a,"touchend",o._onDrop),w(a,"touchcancel",o._onDrop),_e&&this.nativeDraggable&&(this.options.touchStartThreshold=4,c.draggable=!0),Y("delayStart",this,{evt:t}),r.delay&&(!r.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(St||et))){if(p.eventCanceled){this._onDrop();return}w(a,"mouseup",o._disableDelayedDrag),w(a,"touchend",o._disableDelayedDrag),w(a,"touchcancel",o._disableDelayedDrag),w(a,"mousemove",o._delayedDragTouchMoveHandler),w(a,"touchmove",o._delayedDragTouchMoveHandler),r.supportPointer&&w(a,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(s,r.delay)}else s()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){c&&he(c),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;b(t,"mouseup",this._disableDelayedDrag),b(t,"touchend",this._disableDelayedDrag),b(t,"touchcancel",this._disableDelayedDrag),b(t,"mousemove",this._delayedDragTouchMoveHandler),b(t,"touchmove",this._delayedDragTouchMoveHandler),b(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?w(document,"pointermove",this._onTouchMove):e?w(document,"touchmove",this._onTouchMove):w(document,"mousemove",this._onTouchMove):(w(c,"dragend",this),w(C,"dragstart",this._onDragStart));try{document.selection?Jt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(n){}},_dragStarted:function(t,e){if(yt=!1,C&&c){Y("dragStarted",this,{evt:e}),this.nativeDraggable&&w(document,"dragover",gn);var n=this.options;!t&&x(c,n.dragClass,!1),x(c,n.ghostClass,!0),p.active=this,t&&this._appendGhost(),X({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(q){this._lastX=q.clientX,this._lastY=q.clientY,He();for(var t=document.elementFromPoint(q.clientX,q.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(q.clientX,q.clientY),t!==e);)e=t;if(c.parentNode[k]._isOutsideThisEl(t),e)do{if(e[k]){var n=void 0;if(n=e[k]._onDragOver({clientX:q.clientX,clientY:q.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Le()}},_onTouchMove:function(t){if(ht){var e=this.options,n=e.fallbackTolerance,o=e.fallbackOffset,i=t.touches?t.touches[0]:t,r=v&&ut(v,!0),a=v&&r&&r.a,s=v&&r&&r.d,l=$t&&R&&Me(R),u=(i.clientX-ht.clientX+o.x)/(a||1)+(l?l[0]-ue[0]:0)/(a||1),d=(i.clientY-ht.clientY+o.y)/(s||1)+(l?l[1]-ue[1]:0)/(s||1);if(!p.active&&!yt){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))=0&&(X({rootEl:M,name:"add",toEl:M,fromEl:C,originalEvent:t}),X({sortable:this,name:"remove",toEl:M,originalEvent:t}),X({rootEl:M,name:"sort",toEl:M,fromEl:C,originalEvent:t}),X({sortable:this,name:"sort",toEl:M,originalEvent:t})),P&&P.save()):j!==bt&&j>=0&&(X({sortable:this,name:"update",toEl:M,originalEvent:t}),X({sortable:this,name:"sort",toEl:M,originalEvent:t})),p.active&&((j==null||j===-1)&&(j=bt,at=At),X({sortable:this,name:"end",toEl:M,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){Y("nulling",this),C=c=M=v=dt=O=Ht=rt=ht=q=Mt=j=at=bt=At=wt=Nt=P=Lt=p.dragged=p.ghost=p.clone=p.active=null,qt.forEach(function(t){t.checked=!0}),qt.length=se=ce=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":c&&(this._onDragOver(t),vn(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,o=0,i=n.length,r=this.options;oi.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}function wn(t,e,n,o,i,r,a,s){var l=o?t.clientY:t.clientX,u=o?n.height:n.width,d=o?n.top:n.left,h=o?n.bottom:n.right,D=!1;if(!a){if(s&&Utd+u*r/2:lh-Ut)return-Nt}else if(l>d+u*(1-i)/2&&lh-u*r/2)?l>d+u/2?1:-1:0}function En(t){return A(c)1&&(m.forEach(function(a){i.addAnimationState({target:a,rect:B?S(a):r}),ae(a),a.fromRect=r,n.removeAnimationState(a)}),B=!1,On(!this.options.removeCloneOnHide,o))},dragOverCompleted:function(e){var n=e.sortable,o=e.isOwner,i=e.insertion,r=e.activeSortable,a=e.parentEl,s=e.putSortable,l=this.options;if(i){if(o&&r._hideClone(),Xt=!1,l.animation&&m.length>1&&(B||!o&&!r.options.sort&&!s)){var u=S(_,!1,!0,!0);m.forEach(function(h){h!==_&&(Pe(h,u),a.appendChild(h))}),B=!0}if(!o)if(B||ee(),m.length>1){var d=te;r._showClone(n),r.options.animation&&!te&&d&&H.forEach(function(h){r.addAnimationState({target:h,rect:Yt}),h.fromRect=Yt,h.thisAnimationDuration=null})}else r._showClone(n)}},dragOverAnimationCapture:function(e){var n=e.dragRect,o=e.isOwner,i=e.activeSortable;if(m.forEach(function(a){a.thisAnimationDuration=null}),i.options.animation&&!o&&i.multiDrag.isMultiDrag){Yt=W({},n);var r=ut(_,!0);Yt.top-=r.f,Yt.left-=r.e}},dragOverAnimationComplete:function(){B&&(B=!1,ee())},drop:function(e){var n=e.originalEvent,o=e.rootEl,i=e.parentEl,r=e.sortable,a=e.dispatchSortableEvent,s=e.oldIndex,l=e.putSortable,u=l||this.sortable;if(n){var d=this.options,h=i.children;if(!Et)if(d.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),x(_,d.selectedClass,!~m.indexOf(_)),~m.indexOf(_))m.splice(m.indexOf(_),1),Rt=null,Ot({sortable:r,rootEl:o,name:"deselect",targetEl:_,originalEvent:n});else{if(m.push(_),Ot({sortable:r,rootEl:o,name:"select",targetEl:_,originalEvent:n}),n.shiftKey&&Rt&&r.el.contains(Rt)){var D=A(Rt),g=A(_);if(~D&&~g&&D!==g){var T,y;for(g>D?(y=D,T=g):(y=g,T=D+1);y1){var L=S(_),I=A(_,":not(."+this.options.selectedClass+")");if(!Xt&&d.animation&&(_.thisAnimationDuration=null),u.captureAnimationState(),!Xt&&(d.animation&&(_.fromRect=L,m.forEach(function(E){if(E.thisAnimationDuration=null,E!==_){var $=B?S(E):L;E.fromRect=$,u.addAnimationState({target:E,rect:$})}})),ee(),m.forEach(function(E){h[I]?i.insertBefore(E,h[I]):i.appendChild(E),I++}),s===A(_))){var K=!1;m.forEach(function(E){if(E.sortableIndex!==A(E)){K=!0;return}}),K&&(a("update"),a("sort"))}m.forEach(function(E){ae(E)}),u.animateAll()}Q=u}(o===i||l&&l.lastPutMode!=="clone")&&H.forEach(function(E){E.parentNode&&E.parentNode.removeChild(E)})}},nullingGlobal:function(){this.isMultiDrag=Et=!1,H.length=0},destroyGlobal:function(){this._deselectMultiDrag(),b(document,"pointerup",this._deselectMultiDrag),b(document,"mouseup",this._deselectMultiDrag),b(document,"touchend",this._deselectMultiDrag),b(document,"keydown",this._checkKeyDown),b(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!(typeof Et<"u"&&Et)&&Q===this.sortable&&!(e&&z(e.target,this.options.draggable,this.sortable.el,!1))&&!(e&&e.button!==0))for(;m.length;){var n=m[0];x(n,this.options.selectedClass,!1),m.shift(),Ot({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:n,originalEvent:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},W(t,{pluginName:"multiDrag",utils:{select:function(e){var n=e.parentNode[k];!n||!n.options.multiDrag||~m.indexOf(e)||(Q&&Q!==n&&(Q.multiDrag._deselectMultiDrag(),Q=n),x(e,n.options.selectedClass,!0),m.push(e))},deselect:function(e){var n=e.parentNode[k],o=m.indexOf(e);!n||!n.options.multiDrag||!~o||(x(e,n.options.selectedClass,!1),m.splice(o,1))}},eventProperties:function(){var e=this,n=[],o=[];return m.forEach(function(i){n.push({multiDragElement:i,index:i.sortableIndex});var r;B&&i!==_?r=-1:B?r=A(i,":not(."+e.options.selectedClass+")"):r=A(i),o.push({multiDragElement:i,index:r})}),{items:Je(m),clones:[].concat(H),oldIndicies:n,newIndicies:o}},optionListeners:{multiDragKey:function(e){return e=e.toLowerCase(),e==="ctrl"?e="Control":e.length>1&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}function On(t,e){m.forEach(function(n,o){var i=e.children[n.sortableIndex+(t?Number(o):0)];i?e.insertBefore(n,i):e.appendChild(n)})}function ze(t,e){H.forEach(function(n,o){var i=e.children[n.sortableIndex+(t?Number(o):0)];i?e.insertBefore(n,i):e.appendChild(n)})}function ee(){m.forEach(function(t){t!==_&&t.parentNode&&t.parentNode.removeChild(t)})}p.mount(new Sn),p.mount(we,ye);export{xn as MultiDrag,p as Sortable,Cn as Swap,p as default};