UNPKG

caroline-vue-draggable-plus

Version:

Universal Drag-and-Drop Component Supporting both Vue 3 and Vue 2

7 lines (6 loc) 43.1 kB
"use strict";var nn=Object.defineProperty;var Ne=Object.getOwnPropertySymbols;var yt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable;var bt=(t,e,n)=>e in t?nn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fe=(t,e)=>{for(var n in e||(e={}))yt.call(e,n)&&bt(t,n,e[n]);if(Ne)for(var n of Ne(e))wt.call(e,n)&&bt(t,n,e[n]);return t};var $e=(t,e)=>{var n={};for(var o in t)yt.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&Ne)for(var o of Ne(t))e.indexOf(o)<0&&wt.call(t,o)&&(n[o]=t[o]);return n};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("vue"),Bt="[vue-draggable-plus]: ";function on(t){console.warn(Bt+t)}function rn(t){console.error(Bt+t)}function Et(t,e,n){return n>=0&&n<t.length&&t.splice(n,0,t.splice(e,1)[0]),t}function an(t){return t.replace(/-(\w)/g,(e,n)=>n?n.toUpperCase():"")}function ln(t){return Object.keys(t).reduce((e,n)=>(typeof t[n]!="undefined"&&(e[an(n)]=t[n]),e),{})}function Dt(t,e){return Array.isArray(t)&&t.splice(e,1),t}function St(t,e,n){return Array.isArray(t)&&t.splice(e,0,n),t}function sn(t){return typeof t=="undefined"}function un(t){return typeof t=="string"}function _t(t,e,n){const o=t.children[n];t.insertBefore(e,o)}function qe(t){t.parentNode&&t.parentNode.removeChild(t)}function cn(t,e=document){var o;let n=null;return typeof(e==null?void 0:e.querySelector)=="function"?n=(o=e==null?void 0:e.querySelector)==null?void 0:o.call(e,t):n=document.querySelector(t),n||on(`Element not found: ${t}`),n}function fn(t,e,n=null){return function(...o){return t.apply(n,o),e.apply(n,o)}}function dn(t,e){const n=fe({},t);return Object.keys(e).forEach(o=>{n[o]?n[o]=fn(t[o],e[o]):n[o]=e[o]}),n}function hn(t){return t instanceof HTMLElement}function Tt(t,e){Object.keys(t).forEach(n=>{e(n,t[n])})}function pn(t){return t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97)}const gn=Object.assign;/**! * Sortable 1.15.6 * @author RubaXa <trash@rubaxa.org> * @author owenm <owen23355@gmail.com> * @license MIT */function Ct(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function ne(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ct(Object(n),!0).forEach(function(o){mn(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function Ye(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ye=function(e){return typeof e}:Ye=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(t)}function mn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ie(){return ie=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ie.apply(this,arguments)}function vn(t,e){if(t==null)return{};var n={},o=Object.keys(t),r,i;for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&(n[r]=t[r]);return n}function bn(t,e){if(t==null)return{};var n=vn(t,e),o,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)o=i[r],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var yn="1.15.6";function re(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var ae=re(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),xe=re(/Edge/i),Ot=re(/firefox/i),Te=re(/safari/i)&&!re(/chrome/i)&&!re(/android/i),ft=re(/iP(ad|od|hone)/i),kt=re(/chrome/i)&&re(/android/i),Ht={capture:!1,passive:!1};function E(t,e,n){t.addEventListener(e,n,!ae&&Ht)}function w(t,e,n){t.removeEventListener(e,n,!ae&&Ht)}function We(t,e){if(e){if(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(n){return!1}return!1}}function Lt(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Q(t,e,n,o){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&We(t,e):We(t,e))||o&&t===n)return t;if(t===n)break}while(t=Lt(t))}return null}var It=/\s+/g;function $(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(It," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(It," ")}}function h(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 ye(t,e){var n="";if(typeof t=="string")n=t;else do{var o=h(t,"transform");o&&o!=="none"&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(n)}function Wt(t,e,n){if(t){var o=t.getElementsByTagName(e),r=0,i=o.length;if(n)for(;r<i;r++)n(o[r],r);return o}return[]}function te(){var t=document.scrollingElement;return t||document.documentElement}function M(t,e,n,o,r){if(!(!t.getBoundingClientRect&&t!==window)){var i,a,l,s,u,d,f;if(t!==window&&t.parentNode&&t!==te()?(i=t.getBoundingClientRect(),a=i.top,l=i.left,s=i.bottom,u=i.right,d=i.height,f=i.width):(a=0,l=0,s=window.innerHeight,u=window.innerWidth,d=window.innerHeight,f=window.innerWidth),(e||n)&&t!==window&&(r=r||t.parentNode,!ae))do if(r&&r.getBoundingClientRect&&(h(r,"transform")!=="none"||n&&h(r,"position")!=="static")){var m=r.getBoundingClientRect();a-=m.top+parseInt(h(r,"border-top-width")),l-=m.left+parseInt(h(r,"border-left-width")),s=a+i.height,u=l+i.width;break}while(r=r.parentNode);if(o&&t!==window){var y=ye(r||t),b=y&&y.a,D=y&&y.d;y&&(a/=D,l/=b,f/=b,d/=D,s=a+d,u=l+f)}return{top:a,left:l,bottom:s,right:u,width:f,height:d}}}function At(t,e,n){for(var o=ce(t,!0),r=M(t)[e];o;){var i=M(o)[n],a=void 0;if(a=r>=i,!a)return o;if(o===te())break;o=ce(o,!1)}return!1}function we(t,e,n,o){for(var r=0,i=0,a=t.children;i<a.length;){if(a[i].style.display!=="none"&&a[i]!==p.ghost&&(o||a[i]!==p.dragged)&&Q(a[i],n.draggable,t,!1)){if(r===e)return a[i];r++}i++}return null}function dt(t,e){for(var n=t.lastElementChild;n&&(n===p.ghost||h(n,"display")==="none"||e&&!We(n,e));)n=n.previousElementSibling;return n||null}function J(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==p.clone&&(!e||We(t,e))&&n++;return n}function xt(t){var e=0,n=0,o=te();if(t)do{var r=ye(t),i=r.a,a=r.d;e+=t.scrollLeft*i,n+=t.scrollTop*a}while(t!==o&&(t=t.parentNode));return[e,n]}function wn(t,e){for(var n in t)if(t.hasOwnProperty(n)){for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n)}return-1}function ce(t,e){if(!t||!t.getBoundingClientRect)return te();var n=t,o=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var r=h(n);if(n.clientWidth<n.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return te();if(o||e)return n;o=!0}}while(n=n.parentNode);return te()}function En(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Ke(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)}var Ce;function Gt(t,e){return function(){if(!Ce){var n=arguments,o=this;n.length===1?t.call(o,n[0]):t.apply(o,n),Ce=setTimeout(function(){Ce=void 0},e)}}}function Dn(){clearTimeout(Ce),Ce=void 0}function jt(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function zt(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}function Ut(t,e,n){var o={};return Array.from(t.children).forEach(function(r){var i,a,l,s;if(!(!Q(r,e.draggable,t,!1)||r.animated||r===n)){var u=M(r);o.left=Math.min((i=o.left)!==null&&i!==void 0?i:1/0,u.left),o.top=Math.min((a=o.top)!==null&&a!==void 0?a:1/0,u.top),o.right=Math.max((l=o.right)!==null&&l!==void 0?l:-1/0,u.right),o.bottom=Math.max((s=o.bottom)!==null&&s!==void 0?s:-1/0,u.bottom)}}),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var V="Sortable"+new Date().getTime();function Sn(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var o=[].slice.call(this.el.children);o.forEach(function(r){if(!(h(r,"display")==="none"||r===p.ghost)){t.push({target:r,rect:M(r)});var i=ne({},t[t.length-1].rect);if(r.thisAnimationDuration){var a=ye(r,!0);a&&(i.top-=a.f,i.left-=a.e)}r.fromRect=i}})}},addAnimationState:function(o){t.push(o)},removeAnimationState:function(o){t.splice(wn(t,{target:o}),1)},animateAll:function(o){var r=this;if(!this.options.animation){clearTimeout(e),typeof o=="function"&&o();return}var i=!1,a=0;t.forEach(function(l){var s=0,u=l.target,d=u.fromRect,f=M(u),m=u.prevFromRect,y=u.prevToRect,b=l.rect,D=ye(u,!0);D&&(f.top-=D.f,f.left-=D.e),u.toRect=f,u.thisAnimationDuration&&Ke(m,f)&&!Ke(d,f)&&(b.top-f.top)/(b.left-f.left)===(d.top-f.top)/(d.left-f.left)&&(s=Tn(b,m,y,r.options)),Ke(f,d)||(u.prevFromRect=d,u.prevToRect=f,s||(s=r.options.animation),r.animate(u,b,f,s)),s&&(i=!0,a=Math.max(a,s),clearTimeout(u.animationResetTimer),u.animationResetTimer=setTimeout(function(){u.animationTime=0,u.prevFromRect=null,u.fromRect=null,u.prevToRect=null,u.thisAnimationDuration=null},s),u.thisAnimationDuration=s)}),clearTimeout(e),i?e=setTimeout(function(){typeof o=="function"&&o()},a):typeof o=="function"&&o(),t=[]},animate:function(o,r,i,a){if(a){h(o,"transition",""),h(o,"transform","");var l=ye(this.el),s=l&&l.a,u=l&&l.d,d=(r.left-i.left)/(s||1),f=(r.top-i.top)/(u||1);o.animatingX=!!d,o.animatingY=!!f,h(o,"transform","translate3d("+d+"px,"+f+"px,0)"),this.forRepaintDummy=_n(o),h(o,"transition","transform "+a+"ms"+(this.options.easing?" "+this.options.easing:"")),h(o,"transform","translate3d(0,0,0)"),typeof o.animated=="number"&&clearTimeout(o.animated),o.animated=setTimeout(function(){h(o,"transition",""),h(o,"transform",""),o.animated=!1,o.animatingX=!1,o.animatingY=!1},a)}}}}function _n(t){return t.offsetWidth}function Tn(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}var ge=[],Je={initializeByDefault:!0},Pe={mount:function(e){for(var n in Je)Je.hasOwnProperty(n)&&!(n in e)&&(e[n]=Je[n]);ge.forEach(function(o){if(o.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),ge.push(e)},pluginEvent:function(e,n,o){var r=this;this.eventCanceled=!1,o.cancel=function(){r.eventCanceled=!0};var i=e+"Global";ge.forEach(function(a){n[a.pluginName]&&(n[a.pluginName][i]&&n[a.pluginName][i](ne({sortable:n},o)),n.options[a.pluginName]&&n[a.pluginName][e]&&n[a.pluginName][e](ne({sortable:n},o)))})},initializePlugins:function(e,n,o,r){ge.forEach(function(l){var s=l.pluginName;if(!(!e.options[s]&&!l.initializeByDefault)){var u=new l(e,n,e.options);u.sortable=e,u.options=e.options,e[s]=u,ie(o,u.defaults)}});for(var i in e.options)if(e.options.hasOwnProperty(i)){var a=this.modifyOption(e,i,e.options[i]);typeof a!="undefined"&&(e.options[i]=a)}},getEventProperties:function(e,n){var o={};return ge.forEach(function(r){typeof r.eventProperties=="function"&&ie(o,r.eventProperties.call(n[r.pluginName],e))}),o},modifyOption:function(e,n,o){var r;return ge.forEach(function(i){e[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[n]=="function"&&(r=i.optionListeners[n].call(e[i.pluginName],o))}),r}};function Cn(t){var e=t.sortable,n=t.rootEl,o=t.name,r=t.targetEl,i=t.cloneEl,a=t.toEl,l=t.fromEl,s=t.oldIndex,u=t.newIndex,d=t.oldDraggableIndex,f=t.newDraggableIndex,m=t.originalEvent,y=t.putSortable,b=t.extraEventProperties;if(e=e||n&&n[V],!!e){var D,W=e.options,j="on"+o.charAt(0).toUpperCase()+o.substr(1);window.CustomEvent&&!ae&&!xe?D=new CustomEvent(o,{bubbles:!0,cancelable:!0}):(D=document.createEvent("Event"),D.initEvent(o,!0,!0)),D.to=a||n,D.from=l||n,D.item=r||n,D.clone=i,D.oldIndex=s,D.newIndex=u,D.oldDraggableIndex=d,D.newDraggableIndex=f,D.originalEvent=m,D.pullMode=y?y.lastPutMode:void 0;var X=ne(ne({},b),Pe.getEventProperties(o,e));for(var z in X)D[z]=X[z];n&&n.dispatchEvent(D),W[j]&&W[j].call(e,D)}}var On=["evt"],U=function(e,n){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=o.evt,i=bn(o,On);Pe.pluginEvent.bind(p)(e,n,ne({dragEl:c,parentEl:I,ghostEl:g,rootEl:C,nextEl:pe,lastDownEl:Be,cloneEl:O,cloneHidden:ue,dragStarted:De,putSortable:B,activeSortable:p.active,originalEvent:r,oldIndex:be,oldDraggableIndex:Oe,newIndex:q,newDraggableIndex:se,hideGhostForTarget:Kt,unhideGhostForTarget:Jt,cloneNowHidden:function(){ue=!0},cloneNowShown:function(){ue=!1},dispatchSortableEvent:function(l){G({sortable:n,name:l,originalEvent:r})}},i))};function G(t){Cn(ne({putSortable:B,cloneEl:O,targetEl:c,rootEl:C,oldIndex:be,oldDraggableIndex:Oe,newIndex:q,newDraggableIndex:se},t))}var c,I,g,C,pe,Be,O,ue,be,q,Oe,se,Me,B,ve=!1,Ge=!1,je=[],de,Z,Ze,Qe,Pt,Nt,De,me,Ie,Ae=!1,Fe=!1,ke,L,et=[],at=!1,ze=[],Ve=typeof document!="undefined",Re=ft,Mt=xe||ae?"cssFloat":"float",In=Ve&&!kt&&!ft&&"draggable"in document.createElement("div"),Vt=function(){if(Ve){if(ae)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),$t=function(e,n){var o=h(e),r=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),i=we(e,0,n),a=we(e,1,n),l=i&&h(i),s=a&&h(a),u=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+M(i).width,d=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+M(a).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&l.float&&l.float!=="none"){var f=l.float==="left"?"left":"right";return a&&(s.clear==="both"||s.clear===f)?"vertical":"horizontal"}return i&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||u>=r&&o[Mt]==="none"||a&&o[Mt]==="none"&&u+d>r)?"vertical":"horizontal"},An=function(e,n,o){var r=o?e.left:e.top,i=o?e.right:e.bottom,a=o?e.width:e.height,l=o?n.left:n.top,s=o?n.right:n.bottom,u=o?n.width:n.height;return r===l||i===s||r+a/2===l+u/2},xn=function(e,n){var o;return je.some(function(r){var i=r[V].options.emptyInsertThreshold;if(!(!i||dt(r))){var a=M(r),l=e>=a.left-i&&e<=a.right+i,s=n>=a.top-i&&n<=a.bottom+i;if(l&&s)return o=r}}),o},qt=function(e){function n(i,a){return function(l,s,u,d){var f=l.options.group.name&&s.options.group.name&&l.options.group.name===s.options.group.name;if(i==null&&(a||f))return!0;if(i==null||i===!1)return!1;if(a&&i==="clone")return i;if(typeof i=="function")return n(i(l,s,u,d),a)(l,s,u,d);var m=(a?l:s).options.group.name;return i===!0||typeof i=="string"&&i===m||i.join&&i.indexOf(m)>-1}}var o={},r=e.group;(!r||Ye(r)!="object")&&(r={name:r}),o.name=r.name,o.checkPull=n(r.pull,!0),o.checkPut=n(r.put),o.revertClone=r.revertClone,e.group=o},Kt=function(){!Vt&&g&&h(g,"display","none")},Jt=function(){!Vt&&g&&h(g,"display","")};Ve&&!kt&&document.addEventListener("click",function(t){if(Ge)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Ge=!1,!1},!0);var he=function(e){if(c){e=e.touches?e.touches[0]:e;var n=xn(e.clientX,e.clientY);if(n){var o={};for(var r in e)e.hasOwnProperty(r)&&(o[r]=e[r]);o.target=o.rootEl=n,o.preventDefault=void 0,o.stopPropagation=void 0,n[V]._onDragOver(o)}}},Pn=function(e){c&&c.parentNode[V]._isOutsideThisEl(e.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=ie({},e),t[V]=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 $t(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(a,l){a.setData("Text",l.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&&(!Te||ft),emptyInsertThreshold:5};Pe.initializePlugins(this,t,n);for(var o in n)!(o in e)&&(e[o]=n[o]);qt(e);for(var r in this)r.charAt(0)==="_"&&typeof this[r]=="function"&&(this[r]=this[r].bind(this));this.nativeDraggable=e.forceFallback?!1:In,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?E(t,"pointerdown",this._onTapStart):(E(t,"mousedown",this._onTapStart),E(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(E(t,"dragover",this),E(t,"dragenter",this)),je.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ie(this,Sn())}p.prototype={constructor:p,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(me=null)},_getDirection:function(e,n){return typeof this.options.direction=="function"?this.options.direction.call(this,e,n,c):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,r=this.options,i=r.preventOnFilter,a=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,s=(l||e).target,u=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,d=r.filter;if(kn(o),!c&&!(/mousedown|pointerdown/.test(a)&&e.button!==0||r.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&Te&&s&&s.tagName.toUpperCase()==="SELECT")&&(s=Q(s,r.draggable,o,!1),!(s&&s.animated)&&Be!==s)){if(be=J(s),Oe=J(s,r.draggable),typeof d=="function"){if(d.call(this,e,s,this)){G({sortable:n,rootEl:u,name:"filter",targetEl:s,toEl:o,fromEl:o}),U("filter",n,{evt:e}),i&&e.preventDefault();return}}else if(d&&(d=d.split(",").some(function(f){if(f=Q(u,f.trim(),o,!1),f)return G({sortable:n,rootEl:f,name:"filter",targetEl:s,fromEl:o,toEl:o}),U("filter",n,{evt:e}),!0}),d)){i&&e.preventDefault();return}r.handle&&!Q(u,r.handle,o,!1)||this._prepareDragStart(e,l,s)}}},_prepareDragStart:function(e,n,o){var r=this,i=r.el,a=r.options,l=i.ownerDocument,s;if(o&&!c&&o.parentNode===i){var u=M(o);if(C=i,c=o,I=c.parentNode,pe=c.nextSibling,Be=o,Me=a.group,p.dragged=c,de={target:c,clientX:(n||e).clientX,clientY:(n||e).clientY},Pt=de.clientX-u.left,Nt=de.clientY-u.top,this._lastX=(n||e).clientX,this._lastY=(n||e).clientY,c.style["will-change"]="all",s=function(){if(U("delayEnded",r,{evt:e}),p.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!Ot&&r.nativeDraggable&&(c.draggable=!0),r._triggerDragStart(e,n),G({sortable:r,name:"choose",originalEvent:e}),$(c,a.chosenClass,!0)},a.ignore.split(",").forEach(function(d){Wt(c,d.trim(),tt)}),E(l,"dragover",he),E(l,"mousemove",he),E(l,"touchmove",he),a.supportPointer?(E(l,"pointerup",r._onDrop),!this.nativeDraggable&&E(l,"pointercancel",r._onDrop)):(E(l,"mouseup",r._onDrop),E(l,"touchend",r._onDrop),E(l,"touchcancel",r._onDrop)),Ot&&this.nativeDraggable&&(this.options.touchStartThreshold=4,c.draggable=!0),U("delayStart",this,{evt:e}),a.delay&&(!a.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(xe||ae))){if(p.eventCanceled){this._onDrop();return}a.supportPointer?(E(l,"pointerup",r._disableDelayedDrag),E(l,"pointercancel",r._disableDelayedDrag)):(E(l,"mouseup",r._disableDelayedDrag),E(l,"touchend",r._disableDelayedDrag),E(l,"touchcancel",r._disableDelayedDrag)),E(l,"mousemove",r._delayedDragTouchMoveHandler),E(l,"touchmove",r._delayedDragTouchMoveHandler),a.supportPointer&&E(l,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(s,a.delay)}else s()}},_delayedDragTouchMoveHandler:function(e){var n=e.touches?e.touches[0]:e;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){c&&tt(c),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;w(e,"mouseup",this._disableDelayedDrag),w(e,"touchend",this._disableDelayedDrag),w(e,"touchcancel",this._disableDelayedDrag),w(e,"pointerup",this._disableDelayedDrag),w(e,"pointercancel",this._disableDelayedDrag),w(e,"mousemove",this._delayedDragTouchMoveHandler),w(e,"touchmove",this._delayedDragTouchMoveHandler),w(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||e.pointerType=="touch"&&e,!this.nativeDraggable||n?this.options.supportPointer?E(document,"pointermove",this._onTouchMove):n?E(document,"touchmove",this._onTouchMove):E(document,"mousemove",this._onTouchMove):(E(c,"dragend",this),E(C,"dragstart",this._onDragStart));try{document.selection?He(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(o){}},_dragStarted:function(e,n){if(ve=!1,C&&c){U("dragStarted",this,{evt:n}),this.nativeDraggable&&E(document,"dragover",Pn);var o=this.options;!e&&$(c,o.dragClass,!1),$(c,o.ghostClass,!0),p.active=this,e&&this._appendGhost(),G({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Z){this._lastX=Z.clientX,this._lastY=Z.clientY,Kt();for(var e=document.elementFromPoint(Z.clientX,Z.clientY),n=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Z.clientX,Z.clientY),e!==n);)n=e;if(c.parentNode[V]._isOutsideThisEl(e),n)do{if(n[V]){var o=void 0;if(o=n[V]._onDragOver({clientX:Z.clientX,clientY:Z.clientY,target:e,rootEl:n}),o&&!this.options.dragoverBubble)break}e=n}while(n=Lt(n));Jt()}},_onTouchMove:function(e){if(de){var n=this.options,o=n.fallbackTolerance,r=n.fallbackOffset,i=e.touches?e.touches[0]:e,a=g&&ye(g,!0),l=g&&a&&a.a,s=g&&a&&a.d,u=Re&&L&&xt(L),d=(i.clientX-de.clientX+r.x)/(l||1)+(u?u[0]-et[0]:0)/(l||1),f=(i.clientY-de.clientY+r.y)/(s||1)+(u?u[1]-et[1]:0)/(s||1);if(!p.active&&!ve){if(o&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(g){a?(a.e+=d-(Ze||0),a.f+=f-(Qe||0)):a={a:1,b:0,c:0,d:1,e:d,f};var m="matrix(".concat(a.a,",").concat(a.b,",").concat(a.c,",").concat(a.d,",").concat(a.e,",").concat(a.f,")");h(g,"webkitTransform",m),h(g,"mozTransform",m),h(g,"msTransform",m),h(g,"transform",m),Ze=d,Qe=f,Z=i}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!g){var e=this.options.fallbackOnBody?document.body:C,n=M(c,!0,Re,!0,e),o=this.options;if(Re){for(L=e;h(L,"position")==="static"&&h(L,"transform")==="none"&&L!==document;)L=L.parentNode;L!==document.body&&L!==document.documentElement?(L===document&&(L=te()),n.top+=L.scrollTop,n.left+=L.scrollLeft):L=te(),et=xt(L)}g=c.cloneNode(!0),$(g,o.ghostClass,!1),$(g,o.fallbackClass,!0),$(g,o.dragClass,!0),h(g,"transition",""),h(g,"transform",""),h(g,"box-sizing","border-box"),h(g,"margin",0),h(g,"top",n.top),h(g,"left",n.left),h(g,"width",n.width),h(g,"height",n.height),h(g,"opacity","0.8"),h(g,"position",Re?"absolute":"fixed"),h(g,"zIndex","100000"),h(g,"pointerEvents","none"),p.ghost=g,e.appendChild(g),h(g,"transform-origin",Pt/parseInt(g.style.width)*100+"% "+Nt/parseInt(g.style.height)*100+"%")}},_onDragStart:function(e,n){var o=this,r=e.dataTransfer,i=o.options;if(U("dragStart",this,{evt:e}),p.eventCanceled){this._onDrop();return}U("setupClone",this),p.eventCanceled||(O=zt(c),O.removeAttribute("id"),O.draggable=!1,O.style["will-change"]="",this._hideClone(),$(O,this.options.chosenClass,!1),p.clone=O),o.cloneId=He(function(){U("clone",o),!p.eventCanceled&&(o.options.removeCloneOnHide||C.insertBefore(O,c),o._hideClone(),G({sortable:o,name:"clone"}))}),!n&&$(c,i.dragClass,!0),n?(Ge=!0,o._loopId=setInterval(o._emulateDragOver,50)):(w(document,"mouseup",o._onDrop),w(document,"touchend",o._onDrop),w(document,"touchcancel",o._onDrop),r&&(r.effectAllowed="move",i.setData&&i.setData.call(o,r,c)),E(document,"drop",o),h(c,"transform","translateZ(0)")),ve=!0,o._dragStartId=He(o._dragStarted.bind(o,n,e)),E(document,"selectstart",o),De=!0,window.getSelection().removeAllRanges(),Te&&h(document.body,"user-select","none")},_onDragOver:function(e){var n=this.el,o=e.target,r,i,a,l=this.options,s=l.group,u=p.active,d=Me===s,f=l.sort,m=B||u,y,b=this,D=!1;if(at)return;function W(ee,Ee){U(ee,b,ne({evt:e,isOwner:d,axis:y?"vertical":"horizontal",revert:a,dragRect:r,targetRect:i,canSort:f,fromSortable:m,target:o,completed:X,onMove:function(vt,tn){return Xe(C,n,c,r,vt,M(vt),e,tn)},changed:z},Ee))}function j(){W("dragOverAnimationCapture"),b.captureAnimationState(),b!==m&&m.captureAnimationState()}function X(ee){return W("dragOverCompleted",{insertion:ee}),ee&&(d?u._hideClone():u._showClone(b),b!==m&&($(c,B?B.options.ghostClass:u.options.ghostClass,!1),$(c,l.ghostClass,!0)),B!==b&&b!==p.active?B=b:b===p.active&&B&&(B=null),m===b&&(b._ignoreWhileAnimating=o),b.animateAll(function(){W("dragOverAnimationComplete"),b._ignoreWhileAnimating=null}),b!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(o===c&&!c.animated||o===n&&!o.animated)&&(me=null),!l.dragoverBubble&&!e.rootEl&&o!==document&&(c.parentNode[V]._isOutsideThisEl(e.target),!ee&&he(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),D=!0}function z(){q=J(c),se=J(c,l.draggable),G({sortable:b,name:"change",toEl:n,newIndex:q,newDraggableIndex:se,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),o=Q(o,l.draggable,n,!0),W("dragOver"),p.eventCanceled)return D;if(c.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||b._ignoreWhileAnimating===o)return X(!1);if(Ge=!1,u&&!l.disabled&&(d?f||(a=I!==C):B===this||(this.lastPutMode=Me.checkPull(this,u,c,e))&&s.checkPut(this,u,c,e))){if(y=this._getDirection(e,o)==="vertical",r=M(c),W("dragOverValid"),p.eventCanceled)return D;if(a)return I=C,j(),this._hideClone(),W("revert"),p.eventCanceled||(pe?C.insertBefore(c,pe):C.appendChild(c)),X(!0);var k=dt(n,l.draggable);if(!k||Rn(e,y,this)&&!k.animated){if(k===c)return X(!1);if(k&&n===e.target&&(o=k),o&&(i=M(o)),Xe(C,n,c,r,o,i,e,!!o)!==!1)return j(),k&&k.nextSibling?n.insertBefore(c,k.nextSibling):n.appendChild(c),I=n,z(),X(!0)}else if(k&&Fn(e,y,this)){var Y=we(n,0,l,!0);if(Y===c)return X(!1);if(o=Y,i=M(o),Xe(C,n,c,r,o,i,e,!1)!==!1)return j(),n.insertBefore(c,Y),I=n,z(),X(!0)}else if(o.parentNode===n){i=M(o);var K=0,oe,le=c.parentNode!==n,H=!An(c.animated&&c.toRect||r,o.animated&&o.toRect||i,y),v=y?"top":"left",_=At(o,"top","top")||At(c,"top","top"),x=_?_.scrollTop:void 0;me!==o&&(oe=i[v],Ae=!1,Fe=!H&&l.invertSwap||le),K=Xn(e,o,i,y,H?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,Fe,me===o);var A;if(K!==0){var T=J(c);do T-=K,A=I.children[T];while(A&&(h(A,"display")==="none"||A===g))}if(K===0||A===o)return X(!1);me=o,Ie=K;var P=o.nextElementSibling,F=!1;F=K===1;var R=Xe(C,n,c,r,o,i,e,F);if(R!==!1)return(R===1||R===-1)&&(F=R===1),at=!0,setTimeout(Mn,30),j(),F&&!P?n.appendChild(c):o.parentNode.insertBefore(c,F?P:o),_&&jt(_,0,x-_.scrollTop),I=c.parentNode,oe!==void 0&&!Fe&&(ke=Math.abs(oe-M(o)[v])),z(),X(!0)}if(n.contains(c))return X(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){w(document,"mousemove",this._onTouchMove),w(document,"touchmove",this._onTouchMove),w(document,"pointermove",this._onTouchMove),w(document,"dragover",he),w(document,"mousemove",he),w(document,"touchmove",he)},_offUpEvents:function(){var e=this.el.ownerDocument;w(e,"mouseup",this._onDrop),w(e,"touchend",this._onDrop),w(e,"pointerup",this._onDrop),w(e,"pointercancel",this._onDrop),w(e,"touchcancel",this._onDrop),w(document,"selectstart",this)},_onDrop:function(e){var n=this.el,o=this.options;if(q=J(c),se=J(c,o.draggable),U("drop",this,{evt:e}),I=c&&c.parentNode,q=J(c),se=J(c,o.draggable),p.eventCanceled){this._nulling();return}ve=!1,Fe=!1,Ae=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),lt(this.cloneId),lt(this._dragStartId),this.nativeDraggable&&(w(document,"drop",this),w(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Te&&h(document.body,"user-select",""),h(c,"transform",""),e&&(De&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),g&&g.parentNode&&g.parentNode.removeChild(g),(C===I||B&&B.lastPutMode!=="clone")&&O&&O.parentNode&&O.parentNode.removeChild(O),c&&(this.nativeDraggable&&w(c,"dragend",this),tt(c),c.style["will-change"]="",De&&!ve&&$(c,B?B.options.ghostClass:this.options.ghostClass,!1),$(c,this.options.chosenClass,!1),G({sortable:this,name:"unchoose",toEl:I,newIndex:null,newDraggableIndex:null,originalEvent:e}),C!==I?(q>=0&&(G({rootEl:I,name:"add",toEl:I,fromEl:C,originalEvent:e}),G({sortable:this,name:"remove",toEl:I,originalEvent:e}),G({rootEl:I,name:"sort",toEl:I,fromEl:C,originalEvent:e}),G({sortable:this,name:"sort",toEl:I,originalEvent:e})),B&&B.save()):q!==be&&q>=0&&(G({sortable:this,name:"update",toEl:I,originalEvent:e}),G({sortable:this,name:"sort",toEl:I,originalEvent:e})),p.active&&((q==null||q===-1)&&(q=be,se=Oe),G({sortable:this,name:"end",toEl:I,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){U("nulling",this),C=c=I=g=pe=O=Be=ue=de=Z=De=q=se=be=Oe=me=Ie=B=Me=p.dragged=p.ghost=p.clone=p.active=null,ze.forEach(function(e){e.checked=!0}),ze.length=Ze=Qe=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":c&&(this._onDragOver(e),Nn(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],n,o=this.el.children,r=0,i=o.length,a=this.options;r<i;r++)n=o[r],Q(n,a.draggable,this.el,!1)&&e.push(n.getAttribute(a.dataIdAttr)||Bn(n));return e},sort:function(e,n){var o={},r=this.el;this.toArray().forEach(function(i,a){var l=r.children[a];Q(l,this.options.draggable,r,!1)&&(o[i]=l)},this),n&&this.captureAnimationState(),e.forEach(function(i){o[i]&&(r.removeChild(o[i]),r.appendChild(o[i]))}),n&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,n){return Q(e,n||this.options.draggable,this.el,!1)},option:function(e,n){var o=this.options;if(n===void 0)return o[e];var r=Pe.modifyOption(this,e,n);typeof r!="undefined"?o[e]=r:o[e]=n,e==="group"&&qt(o)},destroy:function(){U("destroy",this);var e=this.el;e[V]=null,w(e,"mousedown",this._onTapStart),w(e,"touchstart",this._onTapStart),w(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(w(e,"dragover",this),w(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),je.splice(je.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!ue){if(U("hideClone",this),p.eventCanceled)return;h(O,"display","none"),this.options.removeCloneOnHide&&O.parentNode&&O.parentNode.removeChild(O),ue=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(ue){if(U("showClone",this),p.eventCanceled)return;c.parentNode==C&&!this.options.group.revertClone?C.insertBefore(O,c):pe?C.insertBefore(O,pe):C.appendChild(O),this.options.group.revertClone&&this.animate(c,O),h(O,"display",""),ue=!1}}};function Nn(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function Xe(t,e,n,o,r,i,a,l){var s,u=t[V],d=u.options.onMove,f;return window.CustomEvent&&!ae&&!xe?s=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(s=document.createEvent("Event"),s.initEvent("move",!0,!0)),s.to=e,s.from=t,s.dragged=n,s.draggedRect=o,s.related=r||e,s.relatedRect=i||M(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),d&&(f=d.call(u,s,a)),f}function tt(t){t.draggable=!1}function Mn(){at=!1}function Fn(t,e,n){var o=M(we(n.el,0,n.options,!0)),r=Ut(n.el,n.options,g),i=10;return e?t.clientX<r.left-i||t.clientY<o.top&&t.clientX<o.right:t.clientY<r.top-i||t.clientY<o.bottom&&t.clientX<o.left}function Rn(t,e,n){var o=M(dt(n.el,n.options.draggable)),r=Ut(n.el,n.options,g),i=10;return e?t.clientX>r.right+i||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>r.bottom+i||t.clientX>o.right&&t.clientY>o.top}function Xn(t,e,n,o,r,i,a,l){var s=o?t.clientY:t.clientX,u=o?n.height:n.width,d=o?n.top:n.left,f=o?n.bottom:n.right,m=!1;if(!a){if(l&&ke<u*r){if(!Ae&&(Ie===1?s>d+u*i/2:s<f-u*i/2)&&(Ae=!0),Ae)m=!0;else if(Ie===1?s<d+ke:s>f-ke)return-Ie}else if(s>d+u*(1-r)/2&&s<f-u*(1-r)/2)return Yn(e)}return m=m||a,m&&(s<d+u*i/2||s>f-u*i/2)?s>d+u/2?1:-1:0}function Yn(t){return J(c)<J(t)?1:-1}function Bn(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function kn(t){ze.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var o=e[n];o.checked&&ze.push(o)}}function He(t){return setTimeout(t,0)}function lt(t){return clearTimeout(t)}Ve&&E(document,"touchmove",function(t){(p.active||ve)&&t.cancelable&&t.preventDefault()});p.utils={on:E,off:w,css:h,find:Wt,is:function(e,n){return!!Q(e,n,e,!1)},extend:En,throttle:Gt,closest:Q,toggleClass:$,clone:zt,index:J,nextTick:He,cancelNextTick:lt,detectDirection:$t,getChild:we,expando:V};p.get=function(t){return t[V]};p.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach(function(o){if(!o.prototype||!o.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));o.utils&&(p.utils=ne(ne({},p.utils),o.utils)),Pe.mount(o)})};p.create=function(t,e){return new p(t,e)};p.version=yn;var N=[],Se,st,ut=!1,nt,ot,Ue,_e;function Hn(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(n){var o=n.originalEvent;this.sortable.nativeDraggable?E(document,"dragover",this._handleAutoScroll):this.options.supportPointer?E(document,"pointermove",this._handleFallbackAutoScroll):o.touches?E(document,"touchmove",this._handleFallbackAutoScroll):E(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var o=n.originalEvent;!this.options.dragOverBubble&&!o.rootEl&&this._handleAutoScroll(o)},drop:function(){this.sortable.nativeDraggable?w(document,"dragover",this._handleAutoScroll):(w(document,"pointermove",this._handleFallbackAutoScroll),w(document,"touchmove",this._handleFallbackAutoScroll),w(document,"mousemove",this._handleFallbackAutoScroll)),Ft(),Le(),Dn()},nulling:function(){Ue=st=Se=ut=_e=nt=ot=null,N.length=0},_handleFallbackAutoScroll:function(n){this._handleAutoScroll(n,!0)},_handleAutoScroll:function(n,o){var r=this,i=(n.touches?n.touches[0]:n).clientX,a=(n.touches?n.touches[0]:n).clientY,l=document.elementFromPoint(i,a);if(Ue=n,o||this.options.forceAutoScrollFallback||xe||ae||Te){rt(n,this.options,l,o);var s=ce(l,!0);ut&&(!_e||i!==nt||a!==ot)&&(_e&&Ft(),_e=setInterval(function(){var u=ce(document.elementFromPoint(i,a),!0);u!==s&&(s=u,Le()),rt(n,r.options,u,o)},10),nt=i,ot=a)}else{if(!this.options.bubbleScroll||ce(l,!0)===te()){Le();return}rt(n,this.options,ce(l,!1),!1)}}},ie(t,{pluginName:"scroll",initializeByDefault:!0})}function Le(){N.forEach(function(t){clearInterval(t.pid)}),N=[]}function Ft(){clearInterval(_e)}var rt=Gt(function(t,e,n,o){if(e.scroll){var r=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,l=e.scrollSpeed,s=te(),u=!1,d;st!==n&&(st=n,Le(),Se=e.scroll,d=e.scrollFn,Se===!0&&(Se=ce(n,!0)));var f=0,m=Se;do{var y=m,b=M(y),D=b.top,W=b.bottom,j=b.left,X=b.right,z=b.width,k=b.height,Y=void 0,K=void 0,oe=y.scrollWidth,le=y.scrollHeight,H=h(y),v=y.scrollLeft,_=y.scrollTop;y===s?(Y=z<oe&&(H.overflowX==="auto"||H.overflowX==="scroll"||H.overflowX==="visible"),K=k<le&&(H.overflowY==="auto"||H.overflowY==="scroll"||H.overflowY==="visible")):(Y=z<oe&&(H.overflowX==="auto"||H.overflowX==="scroll"),K=k<le&&(H.overflowY==="auto"||H.overflowY==="scroll"));var x=Y&&(Math.abs(X-r)<=a&&v+z<oe)-(Math.abs(j-r)<=a&&!!v),A=K&&(Math.abs(W-i)<=a&&_+k<le)-(Math.abs(D-i)<=a&&!!_);if(!N[f])for(var T=0;T<=f;T++)N[T]||(N[T]={});(N[f].vx!=x||N[f].vy!=A||N[f].el!==y)&&(N[f].el=y,N[f].vx=x,N[f].vy=A,clearInterval(N[f].pid),(x!=0||A!=0)&&(u=!0,N[f].pid=setInterval(function(){o&&this.layer===0&&p.active._onTouchMove(Ue);var P=N[this.layer].vy?N[this.layer].vy*l:0,F=N[this.layer].vx?N[this.layer].vx*l:0;typeof d=="function"&&d.call(p.dragged.parentNode[V],F,P,t,Ue,N[this.layer].el)!=="continue"||jt(N[this.layer].el,F,P)}.bind({layer:f}),24))),f++}while(e.bubbleScroll&&m!==s&&(m=ce(m,!1)));ut=u}},30),Zt=function(e){var n=e.originalEvent,o=e.putSortable,r=e.dragEl,i=e.activeSortable,a=e.dispatchSortableEvent,l=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(n){var u=o||i;l();var d=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:n,f=document.elementFromPoint(d.clientX,d.clientY);s(),u&&!u.el.contains(f)&&(a("spill"),this.onSpill({dragEl:r,putSortable:o}))}};function ht(){}ht.prototype={startIndex:null,dragStart:function(e){var n=e.oldDraggableIndex;this.startIndex=n},onSpill:function(e){var n=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var r=we(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(n,r):this.sortable.el.appendChild(n),this.sortable.animateAll(),o&&o.animateAll()},drop:Zt};ie(ht,{pluginName:"revertOnSpill"});function pt(){}pt.prototype={onSpill:function(e){var n=e.dragEl,o=e.putSortable,r=o||this.sortable;r.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),r.animateAll()},drop:Zt};ie(pt,{pluginName:"removeOnSpill"});p.mount(new Hn);p.mount(pt,ht);function Ln(t){return t==null?t:JSON.parse(JSON.stringify(t))}function Wn(t){S.getCurrentInstance()&&S.onUnmounted(t)}function Gn(t){S.getCurrentInstance()?S.onMounted(t):S.nextTick(t)}let Qt=null,en=null;function Rt(t=null,e=null){Qt=t,en=e}function jn(){return{data:Qt,clonedData:en}}const Xt=Symbol("cloneElement");function gt(...t){var le,H;const e=(le=S.getCurrentInstance())==null?void 0:le.proxy;let n=null;const o=t[0];let[,r,i]=t;Array.isArray(S.unref(r))||(i=r,r=null);let a=null;const{immediate:l=!0,clone:s=Ln,forceFallback:u,fallbackOnBody:d,customUpdate:f}=(H=S.unref(i))!=null?H:{};function m(v){var R;const{from:_,oldIndex:x,item:A}=v,T=Array.from(_.childNodes);n=u&&!d?T.slice(0,-1):T;const P=S.unref((R=S.unref(r))==null?void 0:R[x]),F=s(P);Rt(P,F),A[Xt]=F}function y(v){const _=v.item[Xt];if(!sn(_)){if(qe(v.item),S.isRef(r)){const x=[...S.unref(r)];r.value=St(x,v.newDraggableIndex,_);return}St(S.unref(r),v.newDraggableIndex,_)}}function b(v){const{from:_,item:x,oldIndex:A,oldDraggableIndex:T,pullMode:P,clone:F}=v;if(_t(_,x,A),P==="clone"){qe(F);return}if(S.isRef(r)){const R=[...S.unref(r)];r.value=Dt(R,T);return}Dt(S.unref(r),T)}function D(v){if(f){f(v);return}const{from:_,item:x,oldIndex:A,oldDraggableIndex:T,newDraggableIndex:P}=v;if(qe(x),_t(_,x,A),S.isRef(r)){const F=[...S.unref(r)];r.value=Et(F,T,P);return}Et(S.unref(r),T,P)}function W(v){const{newIndex:_,oldIndex:x,from:A,to:T}=v;let P=null;const F=_===x&&A===T;try{if(F){let R=null;n==null||n.some((ee,Ee)=>{if(R&&(n==null?void 0:n.length)!==T.childNodes.length)return A.insertBefore(R,ee.nextSibling),!0;const mt=T.childNodes[Ee];R=T==null?void 0:T.replaceChild(ee,mt)})}}catch(R){P=R}finally{n=null}S.nextTick(()=>{if(Rt(),P)throw P})}const j={onUpdate:D,onStart:m,onAdd:y,onRemove:b,onEnd:W};function X(v){const _=S.unref(o);return v||(v=un(_)?cn(_,e==null?void 0:e.$el):_),v&&!hn(v)&&(v=v.$el),v||rn("Root element not found"),v}function z(){var A;const T=(A=S.unref(i))!=null?A:{},{immediate:v,clone:_}=T,x=$e(T,["immediate","clone"]);return Tt(x,(P,F)=>{pn(P)&&(x[P]=(R,...ee)=>{const Ee=jn();return gn(R,Ee),F(R,...ee)})}),dn(r===null?{}:j,x)}const k=v=>{v=X(v),a&&Y.destroy(),a=new p(v,z())};S.watch(()=>i,()=>{a&&Tt(z(),(v,_)=>{a==null||a.option(v,_)})},{deep:!0});const Y={option:(v,_)=>a==null?void 0:a.option(v,_),destroy:()=>{a==null||a.destroy(),a=null},save:()=>a==null?void 0:a.save(),toArray:()=>a==null?void 0:a.toArray(),closest:(...v)=>a==null?void 0:a.closest(...v)},K=()=>Y==null?void 0:Y.option("disabled",!0),oe=()=>Y==null?void 0:Y.option("disabled",!1);return Gn(()=>{l&&k()}),Wn(Y.destroy),fe({start:k,pause:K,resume:oe},Y)}const ct=["update","start","add","remove","choose","unchoose","end","sort","filter","clone","move","change"],zn=["clone","animation","ghostClass","group","sort","disabled","store","handle","draggable","swapThreshold","invertSwap","invertedSwapThreshold","removeCloneOnHide","direction","chosenClass","dragClass","ignore","filter","preventOnFilter","easing","setData","dropBubble","dragoverBubble","dataIdAttr","delay","delayOnTouchOnly","touchStartThreshold","forceFallback","fallbackClass","fallbackOnBody","fallbackTolerance","fallbackOffset","supportPointer","emptyInsertThreshold","scroll","forceAutoScrollFallback","scrollSensitivity","scrollSpeed","bubbleScroll","modelValue","tag","target","customUpdate",...ct.map(t=>`on${t.replace(/^\S/,e=>e.toUpperCase())}`)],Un=S.defineComponent({name:"VueDraggable",model:{prop:"modelValue",event:"update:modelValue"},props:zn,emits:["update:modelValue",...ct],setup(t,{slots:e,emit:n,expose:o,attrs:r}){const i=ct.reduce((d,f)=>{const m=`on${f.replace(/^\S/,y=>y.toUpperCase())}`;return d[m]=(...y)=>n(f,...y),d},{}),a=S.computed(()=>{const y=S.toRefs(t),{modelValue:d}=y,f=$e(y,["modelValue"]),m=Object.entries(f).reduce((b,[D,W])=>{const j=S.unref(W);return j!==void 0&&(b[D]=j),b},{});return fe(fe({},i),ln(fe(fe({},r),m)))}),l=S.computed({get:()=>t.modelValue,set:d=>n("update:modelValue",d)}),s=S.ref(),u=S.reactive(gt(t.target||s,l,a));return o(u),()=>{var d;return S.h(t.tag||"div",{ref:s},(d=e==null?void 0:e.default)==null?void 0:d.call(e,u))}}}),Yt={mounted:"mounted",unmounted:"unmounted"},it=new WeakMap,Vn={[Yt.mounted](t,e){const n=S.isProxy(e.value)?[e.value]:e.value,[o,r]=n,i=gt(t,o,r);it.set(t,i.destroy)},[Yt.unmounted](t){var e;(e=it.get(t))==null||e(),it.delete(t)}};exports.VueDraggable=Un;exports.useDraggable=gt;exports.vDraggable=Vn;