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