7 lines
25 KiB
JavaScript
7 lines
25 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0c84d3"],{"53fe":function(t,e,n){var o,i;
|
|
/**!
|
|
* Sortable
|
|
* @author RubaXa <trash@rubaxa.org>
|
|
* @author owenm <owen23355@gmail.com>
|
|
* @license MIT
|
|
*/(function(r){"use strict";o=r,i="function"===typeof o?o.call(e,n,e,t):o,void 0===i||(t.exports=i)})((function(){"use strict";if("undefined"===typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var t,e,n,o,i,r,a,l,s,c,h,d,u,f,p,v,g,m,b,w,_,y,D,T,S,C,E=[],x=!1,N=!1,M=!1,k=[],P=!1,X=!1,Y=[],A=/\s+/g,I="Sortable"+(new Date).getTime(),B=window,O=B.document,H=B.parseInt,R=B.setTimeout,L=B.jQuery||B.Zepto,W=B.Polymer,F={capture:!1,passive:!1},z=!!navigator.userAgent.match(/(?:Trident.*rv[ :]?11\.|msie|iemobile)/i),j=!!navigator.userAgent.match(/Edge/i),U=!!navigator.userAgent.match(/firefox/i),V=!(!navigator.userAgent.match(/safari/i)||navigator.userAgent.match(/chrome/i)||navigator.userAgent.match(/android/i)),q=!!navigator.userAgent.match(/iP(ad|od|hone)/i),G=q,J=j||z?"cssFloat":"float",K="draggable"in O.createElement("div"),Z=function(){if(z)return!1;var t=O.createElement("x");return t.style.cssText="pointer-events:auto","auto"===t.style.pointerEvents}(),Q=!1,$=!1,tt=Math.abs,et=Math.min,nt=Math.max,ot=[],it=function(t,e){var n=Nt(t),o=H(n.width)-H(n.paddingLeft)-H(n.paddingRight)-H(n.borderLeftWidth)-H(n.borderRightWidth),i=It(t,0,e),r=It(t,1,e),a=i&&Nt(i),l=r&&Nt(r),s=a&&H(a.marginLeft)+H(a.marginRight)+Kt(i).width,c=l&&H(l.marginLeft)+H(l.marginRight)+Kt(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&"none"!==a.float){var h="left"===a.float?"left":"right";return!r||"both"!==l.clear&&l.clear!==h?"horizontal":"vertical"}return i&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||s>=o&&"none"===n[J]||r&&"none"===n[J]&&s+c>o)?"vertical":"horizontal"},rt=function(t,e){for(var n=0;n<k.length;n++)if(!Bt(k[n])){var o=Kt(k[n]),i=k[n][I].options.emptyInsertThreshold,r=t>=o.left-i&&t<=o.right+i,a=e>=o.top-i&&e<=o.bottom+i;if(r&&a)return k[n]}},at=function(t,e,n,o,i){var r=Kt(n),a="vertical"===o?r.left:r.top,l="vertical"===o?r.right:r.bottom,s="vertical"===o?t:e;return a<s&&s<l},lt=function(e,n,o){var i=e===t&&C||Kt(e),r=n===t&&C||Kt(n),a="vertical"===o?i.left:i.top,l="vertical"===o?i.right:i.bottom,s="vertical"===o?i.width:i.height,c="vertical"===o?r.left:r.top,h="vertical"===o?r.right:r.bottom,d="vertical"===o?r.width:r.height;return a===c||l===h||a+s/2===c+d/2},st=function(t,e){if(!t||!t.getBoundingClientRect)return ct();var n=t,o=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=Nt(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n||!n.getBoundingClientRect||n===O.body)return ct();if(o||e)return n;o=!0}}}while(n=n.parentNode);return ct()},ct=function(){return z?O.documentElement:O.scrollingElement},ht=function(t,e,n){t.scrollLeft+=e,t.scrollTop+=n},dt=zt((function(t,e,n,o){if(e.scroll){var i=n?n[I]:window,r=e.scrollSensitivity,a=e.scrollSpeed,h=t.clientX,d=t.clientY,u=ct(),f=!1;s!==n&&(ut(),l=e.scroll,c=e.scrollFn,!0===l&&(l=st(n,!0),s=l));var p=0,v=l;do{var g,m,w,_,y,D,T,S,C,N=v,M=Kt(N),k=M.top,P=M.bottom,X=M.left,Y=M.right,A=M.width,B=M.height;if(g=N.scrollWidth,m=N.scrollHeight,w=Nt(N),S=N.scrollLeft,C=N.scrollTop,N===u?(D=A<g&&("auto"===w.overflowX||"scroll"===w.overflowX||"visible"===w.overflowX),T=B<m&&("auto"===w.overflowY||"scroll"===w.overflowY||"visible"===w.overflowY)):(D=A<g&&("auto"===w.overflowX||"scroll"===w.overflowX),T=B<m&&("auto"===w.overflowY||"scroll"===w.overflowY)),_=D&&(tt(Y-h)<=r&&S+A<g)-(tt(X-h)<=r&&!!S),y=T&&(tt(P-d)<=r&&C+B<m)-(tt(k-d)<=r&&!!C),!E[p])for(var O=0;O<=p;O++)E[O]||(E[O]={});E[p].vx==_&&E[p].vy==y&&E[p].el===N||(E[p].el=N,E[p].vx=_,E[p].vy=y,clearInterval(E[p].pid),!N||0==_&&0==y||(f=!0,E[p].pid=setInterval(function(){o&&0===this.layer&&(yt.active._emulateDragOver(!0),yt.active._onTouchMove(b,!0));var e=E[this.layer].vy?E[this.layer].vy*a:0,n=E[this.layer].vx?E[this.layer].vx*a:0;"function"===typeof c&&"continue"!==c.call(i,n,e,t,b,E[this.layer].el)||ht(E[this.layer].el,n,e)}.bind({layer:p}),24))),p++}while(e.bubbleScroll&&v!==u&&(v=st(v,!1)));x=f}}),30),ut=function(){E.forEach((function(t){clearInterval(t.pid)})),E=[]},ft=function(t){function e(t,n){return function(o,i,r,a){var l=o.options.group.name&&i.options.group.name&&o.options.group.name===i.options.group.name;if(null==t&&(n||l))return!0;if(null==t||!1===t)return!1;if(n&&"clone"===t)return t;if("function"===typeof t)return e(t(o,i,r,a),n)(o,i,r,a);var s=(n?o:i).options.group.name;return!0===t||"string"===typeof t&&t===s||t.join&&t.indexOf(s)>-1}}var n={},o=t.group;o&&"object"==typeof o||(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},pt=function(e){t&&t.parentNode&&t.parentNode[I]&&t.parentNode[I]._computeIsAligned(e)},vt=function(t,e){var n=e;while(!n[I])n=n.parentNode;return t===n},gt=function(t,e,n){var o=t.parentNode;while(o&&!o[I])o=o.parentNode;o&&o[I][n](Ut(e,{artificialBubble:!0}))},mt=function(){!Z&&n&&Nt(n,"display","none")},bt=function(){!Z&&n&&Nt(n,"display","")};O.addEventListener("click",(function(t){if(M)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),M=!1,!1}),!0);var wt,_t=function(e){if(e=e.touches?e.touches[0]:e,t){var n=rt(e.clientX,e.clientY);n&&n[I]._onDragOver({clientX:e.clientX,clientY:e.clientY,target:n,rootEl:n})}};function yt(t,e){if(!t||!t.nodeType||1!==t.nodeType)throw"Sortable: `el` must be HTMLElement, not "+{}.toString.call(t);this.el=t,this.options=e=Ut({},e),t[I]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0,draggable:/[uo]l/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return it(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,touchStartThreshold:H(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==yt.supportPointer&&("PointerEvent"in window||window.navigator&&"msPointerEnabled"in window.navigator),emptyInsertThreshold:5};for(var o in n)!(o in e)&&(e[o]=n[o]);for(var i in ft(e),this)"_"===i.charAt(0)&&"function"===typeof this[i]&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&K,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Ct(t,"pointerdown",this._onTapStart):(Ct(t,"mousedown",this._onTapStart),Ct(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Ct(t,"dragover",this),Ct(t,"dragenter",this)),k.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[])}function Dt(t,e,n,o){if(t){n=n||O;do{if(null!=e&&(">"===e[0]&&t.parentNode===n&&Ft(t,e.substring(1))||Ft(t,e))||o&&t===n)return t;if(t===n)break}while(t=Tt(t))}return null}function Tt(t){return t.host&&t!==O&&t.host.nodeType?t.host:t.parentNode}function St(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function Ct(t,e,n){t.addEventListener(e,n,F)}function Et(t,e,n){t.removeEventListener(e,n,F)}function xt(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(A," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(A," ")}}function Nt(t,e,n){var o=t&&t.style;if(o){if(void 0===n)return O.defaultView&&O.defaultView.getComputedStyle?n=O.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in o||-1!==e.indexOf("webkit")||(e="-webkit-"+e),o[e]=n+("string"===typeof n?"":"px")}}function Mt(t){var e="";do{var n=Nt(t,"transform");n&&"none"!==n&&(e=n+" "+e)}while(t=t.parentNode);return window.DOMMatrix?new DOMMatrix(e):window.WebKitCSSMatrix?new WebKitCSSMatrix(e):window.CSSMatrix?new CSSMatrix(e):void 0}function kt(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function Pt(t,e,n,i,r,a,l,s,c){t=t||e[I];var h,d=t.options,u="on"+n.charAt(0).toUpperCase()+n.substr(1);!window.CustomEvent||z||j?(h=O.createEvent("Event"),h.initEvent(n,!0,!0)):h=new CustomEvent(n,{bubbles:!0,cancelable:!0}),h.to=r||e,h.from=a||e,h.item=i||e,h.clone=o,h.oldIndex=l,h.newIndex=s,h.originalEvent=c,h.pullMode=f?f.lastPutMode:void 0,e&&e.dispatchEvent(h),d[u]&&d[u].call(t,h)}function Xt(t,e,n,o,i,r,a,l){var s,c,h=t[I],d=h.options.onMove;return!window.CustomEvent||z||j?(s=O.createEvent("Event"),s.initEvent("move",!0,!0)):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=e,s.from=t,s.dragged=n,s.draggedRect=o,s.related=i||e,s.relatedRect=r||Kt(e),s.willInsertAfter=l,s.originalEvent=a,t.dispatchEvent(s),d&&(c=d.call(h,s,a)),c}function Yt(t){t.draggable=!1}function At(){Q=!1}function It(e,o,i){var r=0,a=0,l=e.children;while(a<l.length){if("none"!==l[a].style.display&&l[a]!==n&&l[a]!==t&&Dt(l[a],i.draggable,e,!1)){if(r===o)return l[a];r++}a++}return null}function Bt(t){var e=t.lastElementChild;while(e&&(e===n||"none"===e.style.display))e=e.previousElementSibling;return e||null}function Ot(t,e,n){var o=Kt(Bt(n)),i="vertical"===e?t.clientY:t.clientX,r="vertical"===e?t.clientX:t.clientY,a="vertical"===e?o.bottom:o.right,l="vertical"===e?o.left:o.top,s="vertical"===e?o.right:o.bottom,c=10;return"vertical"===e?r>s+c||r<=s&&i>a&&r>=l:i>a&&r>l||i<=a&&r>s+c}function Ht(e,n,o,i,r,a,l){var s=Kt(n),c="vertical"===o?e.clientY:e.clientX,h="vertical"===o?s.height:s.width,d="vertical"===o?s.top:s.left,u="vertical"===o?s.bottom:s.right,f=Kt(t),p=!1;if(!a)if(l&&T<h*i)if(!P&&(1===y?c>d+h*r/2:c<u-h*r/2)&&(P=!0),P)p=!0;else{"vertical"===o?f.top:f.left,"vertical"===o?f.bottom:f.right;if(1===y?c<d+T:c>u-T)return-1*y}else if(c>d+h*(1-i)/2&&c<u-h*(1-i)/2)return Rt(n);return p=p||a,p&&(c<d+h*r/2||c>u-h*r/2)?c>d+h/2?1:-1:0}function Rt(e){var n=Wt(t),o=Wt(e);return n<o?1:-1}function Lt(t){var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;while(n--)o+=e.charCodeAt(n);return o.toString(36)}function Wt(t,e){var n=0;if(!t||!t.parentNode)return-1;while(t&&(t=t.previousElementSibling))"TEMPLATE"!==t.nodeName.toUpperCase()&&t!==o&&n++;return n}function Ft(t,e){if(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 zt(t,e){return function(){if(!wt){var n=arguments,o=this;wt=R((function(){1===n.length?t.call(o,n[0]):t.apply(o,n),wt=void 0}),e)}}}function jt(){clearTimeout(wt),wt=void 0}function Ut(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Vt(t){return W&&W.dom?W.dom(t).cloneNode(!0):L?L(t).clone(!0)[0]:t.cloneNode(!0)}function qt(t){ot.length=0;var e=t.getElementsByTagName("input"),n=e.length;while(n--){var o=e[n];o.checked&&ot.push(o)}}function Gt(t){return R(t,0)}function Jt(t){return clearTimeout(t)}function Kt(t,e,n,o){if(t.getBoundingClientRect||t===B){var i,r,a,l,s,c,h;if(t!==B&&t!==ct()?(i=t.getBoundingClientRect(),r=i.top,a=i.left,l=i.bottom,s=i.right,c=i.height,h=i.width):(r=0,a=0,l=window.innerHeight,s=window.innerWidth,c=window.innerHeight,h=window.innerWidth),o&&t!==B&&(n=n||t.parentNode,!z))do{if(n&&n.getBoundingClientRect&&"none"!==Nt(n,"transform")){var d=n.getBoundingClientRect();r-=d.top+H(Nt(n,"border-top-width")),a-=d.left+H(Nt(n,"border-left-width")),l=r+i.height,s=a+i.width;break}}while(n=n.parentNode);if(e&&t!==B){var u=Mt(n||t),f=u&&u.a,p=u&&u.d;u&&(r/=p,a/=f,h/=f,c/=p,l=r+c,s=a+h)}return{top:r,left:a,bottom:l,right:s,width:h,height:c}}}function Zt(t,e){var n=st(t,!0),o=Kt(t)[e];while(n){var i,r=Kt(n)[e];if(i="top"===e||"left"===e?o>=r:o<=r,!i)return n;if(n===ct())break;n=st(n,!1)}return!1}function Qt(t){var e=0,n=0,o=ct();if(t)do{var i=Mt(t),r=i.a,a=i.d;e+=t.scrollLeft*r,n+=t.scrollTop*a}while(t!==o&&(t=t.parentNode));return[e,n]}return Ct(O,"dragover",_t),Ct(O,"mousemove",_t),Ct(O,"touchmove",_t),yt.prototype={constructor:yt,_computeIsAligned:function(e){var o;if(n&&!Z?(mt(),o=O.elementFromPoint(e.clientX,e.clientY),bt()):o=e.target,o=Dt(o,this.options.draggable,this.el,!1),!$&&t&&t.parentNode===this.el){for(var i=this.el.children,r=0;r<i.length;r++)Dt(i[r],this.options.draggable,this.el,!1)&&i[r]!==o&&(i[r].sortableMouseAligned=at(e.clientX,e.clientY,i[r],this._getDirection(e,null),this.options));Dt(o,this.options.draggable,this.el,!0)||(_=null),$=!0,R((function(){$=!1}),30)}},_getDirection:function(e,n){return"function"===typeof this.options.direction?this.options.direction.call(this,e,n,t):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n,o=this,i=this.el,r=this.options,l=r.preventOnFilter,s=e.type,c=e.touches&&e.touches[0],h=(c||e).target,d=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||h,u=r.filter;if(qt(i),(!z||e.artificialBubble||vt(i,h))&&!t&&!(/mousedown|pointerdown/.test(s)&&0!==e.button||r.disabled)&&!d.isContentEditable)if(h=Dt(h,r.draggable,i,!1),h){if(a!==h){if(n=Wt(h,r.draggable),"function"===typeof u){if(u.call(this,e,h,this))return Pt(o,d,"filter",h,i,i,n),void(l&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(t){if(t=Dt(d,t.trim(),i,!1),t)return Pt(o,t,"filter",h,i,i,n),!0})),u))return void(l&&e.cancelable&&e.preventDefault());r.handle&&!Dt(d,r.handle,i,!1)||this._prepareDragStart(e,c,h,n)}}else z&>(i,e,"_onTapStart")}},_handleAutoScroll:function(e,n){if(t&&this.options.scroll){var o=e.clientX,i=e.clientY,r=O.elementFromPoint(o,i),a=this;if(n||j||z||V){dt(e,a.options,r,n);var l=st(r,!0);!x||p&&o===v&&i===g||(p&&clearInterval(p),p=setInterval((function(){if(t){var r=st(O.elementFromPoint(o,i),!0);r!==l&&(l=r,ut(),dt(e,a.options,l,n))}}),10),v=o,g=i)}else{if(!a.options.bubbleScroll||st(r,!0)===ct())return void ut();dt(e,a.options,st(r,!1),!1)}}},_prepareDragStart:function(n,o,l,s){var c,d=this,f=d.el,p=d.options,v=f.ownerDocument;l&&!t&&l.parentNode===f&&(i=f,t=l,e=t.parentNode,r=t.nextSibling,a=l,u=p.group,h=s,m={target:t,clientX:(o||n).clientX,clientY:(o||n).clientY},this._lastX=(o||n).clientX,this._lastY=(o||n).clientY,t.style["will-change"]="all",t.style.transition="",t.style.transform="",c=function(){d._disableDelayedDragEvents(),!U&&d.nativeDraggable&&(t.draggable=!0),d._triggerDragStart(n,o),Pt(d,i,"choose",t,i,i,h),xt(t,p.chosenClass,!0)},p.ignore.split(",").forEach((function(e){kt(t,e.trim(),Yt)})),p.supportPointer?Ct(v,"pointerup",d._onDrop):(Ct(v,"mouseup",d._onDrop),Ct(v,"touchend",d._onDrop),Ct(v,"touchcancel",d._onDrop)),U&&this.nativeDraggable&&(this.options.touchStartThreshold=4,t.draggable=!0),!p.delay||this.nativeDraggable&&(j||z)?c():(Ct(v,"mouseup",d._disableDelayedDrag),Ct(v,"touchend",d._disableDelayedDrag),Ct(v,"touchcancel",d._disableDelayedDrag),Ct(v,"mousemove",d._delayedDragTouchMoveHandler),Ct(v,"touchmove",d._delayedDragTouchMoveHandler),p.supportPointer&&Ct(v,"pointermove",d._delayedDragTouchMoveHandler),d._dragStartTimer=R(c,p.delay)))},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;nt(tt(e.clientX-this._lastX),tt(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){t&&Yt(t),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;Et(t,"mouseup",this._disableDelayedDrag),Et(t,"touchend",this._disableDelayedDrag),Et(t,"touchcancel",this._disableDelayedDrag),Et(t,"mousemove",this._delayedDragTouchMoveHandler),Et(t,"touchmove",this._delayedDragTouchMoveHandler),Et(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||("touch"==e.pointerType?e:null),!this.nativeDraggable||n?this.options.supportPointer?Ct(O,"pointermove",this._onTouchMove):Ct(O,n?"touchmove":"mousemove",this._onTouchMove):(Ct(t,"dragend",this),Ct(i,"dragstart",this._onDragStart));try{O.selection?Gt((function(){O.selection.empty()})):window.getSelection().removeAllRanges()}catch(o){}},_dragStarted:function(e,n){if(N=!1,i&&t){this.nativeDraggable&&(Ct(O,"dragover",this._handleAutoScroll),Ct(O,"dragover",pt));var o=this.options;!e&&xt(t,o.dragClass,!1),xt(t,o.ghostClass,!0),Nt(t,"transform",""),yt.active=this,e&&this._appendGhost(),Pt(this,i,"start",t,i,i,h,void 0,n)}else this._nulling()},_emulateDragOver:function(e){if(b){if(this._lastX===b.clientX&&this._lastY===b.clientY&&!e)return;this._lastX=b.clientX,this._lastY=b.clientY,mt();var n=O.elementFromPoint(b.clientX,b.clientY),o=n;while(n&&n.shadowRoot)n=n.shadowRoot.elementFromPoint(b.clientX,b.clientY),o=n;if(o)do{var i;if(o[I])if(i=o[I]._onDragOver({clientX:b.clientX,clientY:b.clientY,target:n,rootEl:o}),i&&!this.options.dragoverBubble)break;n=o}while(o=o.parentNode);t.parentNode[I]._computeIsAligned(b),bt()}},_onTouchMove:function(t,e){if(m){var o=this.options,i=o.fallbackTolerance,r=o.fallbackOffset,a=t.touches?t.touches[0]:t,l=n&&Mt(n),s=n&&l&&l.a,c=n&&l&&l.d,h=G&&S&&Qt(S),d=(a.clientX-m.clientX+r.x)/(s||1)+(h?h[0]-Y[0]:0)/(s||1),u=(a.clientY-m.clientY+r.y)/(c||1)+(h?h[1]-Y[1]:0)/(c||1),f=t.touches?"translate3d("+d+"px,"+u+"px,0)":"translate("+d+"px,"+u+"px)";if(!yt.active&&!N){if(i&&et(tt(a.clientX-this._lastX),tt(a.clientY-this._lastY))<i)return;this._onDragStart(t,!0)}!e&&this._handleAutoScroll(a,!0),w=!0,b=a,Nt(n,"webkitTransform",f),Nt(n,"mozTransform",f),Nt(n,"msTransform",f),Nt(n,"transform",f),t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!n){var e=this.options.fallbackOnBody?O.body:i,o=Kt(t,!0,e,!G),r=(Nt(t),this.options);if(G){S=e;while("static"===Nt(S,"position")&&"none"===Nt(S,"transform")&&S!==O)S=S.parentNode;if(S!==O){var a=Kt(S,!0);o.top-=a.top,o.left-=a.left}S!==O.body&&S!==O.documentElement?(S===O&&(S=ct()),o.top+=S.scrollTop,o.left+=S.scrollLeft):S=ct(),Y=Qt(S)}n=t.cloneNode(!0),xt(n,r.ghostClass,!1),xt(n,r.fallbackClass,!0),xt(n,r.dragClass,!0),Nt(n,"box-sizing","border-box"),Nt(n,"margin",0),Nt(n,"top",o.top),Nt(n,"left",o.left),Nt(n,"width",o.width),Nt(n,"height",o.height),Nt(n,"opacity","0.8"),Nt(n,"position",G?"absolute":"fixed"),Nt(n,"zIndex","100000"),Nt(n,"pointerEvents","none"),e.appendChild(n)}},_onDragStart:function(e,n){var r=this,a=e.dataTransfer,l=r.options;o=Vt(t),o.draggable=!1,o.style["will-change"]="",this._hideClone(),xt(o,r.options.chosenClass,!1),r._cloneId=Gt((function(){r.options.removeCloneOnHide||i.insertBefore(o,t),Pt(r,i,"clone",t)})),!n&&xt(t,l.dragClass,!0),n?(M=!0,r._loopId=setInterval(r._emulateDragOver,50)):(Et(O,"mouseup",r._onDrop),Et(O,"touchend",r._onDrop),Et(O,"touchcancel",r._onDrop),a&&(a.effectAllowed="move",l.setData&&l.setData.call(r,a,t)),Ct(O,"drop",r),Nt(t,"transform","translateZ(0)")),N=!0,r._dragStartId=Gt(r._dragStarted.bind(r,n,e)),Ct(O,"selectstart",r),V&&Nt(O.body,"user-select","none")},_onDragOver:function(n){var o,a,l,s=this.el,c=n.target,d=this.options,p=d.group,v=yt.active,g=u===p,m=d.sort,b=this;if(!Q&&(!z||n.rootEl||n.artificialBubble||vt(s,c))){if(void 0!==n.preventDefault&&n.cancelable&&n.preventDefault(),w=!0,c=Dt(c,d.draggable,s,!0),Dt(n.target,null,t,!0)||c.animated)return j(!1);if(c!==t&&(M=!1),v&&!d.disabled&&(g?m||(l=!i.contains(t)):f===this||(this.lastPutMode=u.checkPull(this,v,t,n))&&p.checkPut(this,v,t,n))){var S=this._getDirection(n,c);if(o=Kt(t),l)return this._hideClone(),e=i,r?i.insertBefore(t,r):i.appendChild(t),j(!0);var E=Bt(s);if(!E||Ot(n,S,s)&&!E.animated){if(E&&s===n.target&&(c=E),c&&(a=Kt(c)),g?v._hideClone():v._showClone(this),!1!==Xt(i,s,t,o,c,a,n,!!c))return s.appendChild(t),e=s,C=null,U(),j(!0)}else if(c&&c!==t&&c.parentNode===s){var x,N=0,k=c.sortableMouseAligned,Y=t.parentNode!==s,A="vertical"===S?"top":"left",B=Zt(c,"top")||Zt(t,"top"),H=B?B.scrollTop:void 0;if(_!==c&&(D=null,x=Kt(c)[A],P=!1),lt(t,c,S)&&k||Y||B||d.invertSwap||"insert"===D||"swap"===D?("swap"!==D&&(X=d.invertSwap||Y),N=Ht(n,c,S,d.swapThreshold,null==d.invertedSwapThreshold?d.swapThreshold:d.invertedSwapThreshold,X,_===c),D="swap"):(N=Rt(c),D="insert"),0===N)return j(!1);C=null,_=c,y=N,a=Kt(c);var L=c.nextElementSibling,W=!1;W=1===N;var F=Xt(i,s,t,o,c,a,n,W);if(!1!==F)return 1!==F&&-1!==F||(W=1===F),Q=!0,R(At,30),g?v._hideClone():v._showClone(this),W&&!L?s.appendChild(t):c.parentNode.insertBefore(t,W?L:c),B&&ht(B,0,H-B.scrollTop),e=t.parentNode,void 0===x||X||(T=tt(x-Kt(c)[A])),U(),j(!0)}if(s.contains(t))return j(!1)}return z&&!n.rootEl&>(s,n,"_onDragOver"),!1}function j(e){return e&&(g?v._hideClone():v._showClone(b),v&&(xt(t,f?f.options.ghostClass:v.options.ghostClass,!1),xt(t,d.ghostClass,!0)),f!==b&&b!==yt.active?f=b:b===yt.active&&(f=null),o&&b._animate(o,t),c&&a&&b._animate(a,c)),(c===t&&!t.animated||c===s&&!c.animated)&&(_=null),d.dragoverBubble||n.rootEl||c===O||(b._handleAutoScroll(n),t.parentNode[I]._computeIsAligned(n)),!d.dragoverBubble&&n.stopPropagation&&n.stopPropagation(),!0}function U(){Pt(b,i,"change",c,s,i,h,Wt(t,d.draggable),n)}},_animate:function(e,n){var o=this.options.animation;if(o){var i=Kt(n);if(n===t&&(C=i),1===e.nodeType&&(e=Kt(e)),e.left+e.width/2!==i.left+i.width/2||e.top+e.height/2!==i.top+i.height/2){var r=Mt(this.el),a=r&&r.a,l=r&&r.d;Nt(n,"transition","none"),Nt(n,"transform","translate3d("+(e.left-i.left)/(a||1)+"px,"+(e.top-i.top)/(l||1)+"px,0)"),n.offsetWidth,Nt(n,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),Nt(n,"transform","translate3d(0,0,0)")}"number"===typeof n.animated&&clearTimeout(n.animated),n.animated=R((function(){Nt(n,"transition",""),Nt(n,"transform",""),n.animated=!1}),o)}},_offUpEvents:function(){var t=this.el.ownerDocument;Et(O,"touchmove",this._onTouchMove),Et(O,"pointermove",this._onTouchMove),Et(t,"mouseup",this._onDrop),Et(t,"touchend",this._onDrop),Et(t,"pointerup",this._onDrop),Et(t,"touchcancel",this._onDrop),Et(O,"selectstart",this)},_onDrop:function(a){var l=this.el,s=this.options;N=!1,x=!1,X=!1,P=!1,clearInterval(this._loopId),clearInterval(p),ut(),jt(),clearTimeout(this._dragStartTimer),Jt(this._cloneId),Jt(this._dragStartId),Et(O,"mousemove",this._onTouchMove),this.nativeDraggable&&(Et(O,"drop",this),Et(l,"dragstart",this._onDragStart),Et(O,"dragover",this._handleAutoScroll),Et(O,"dragover",pt)),V&&Nt(O.body,"user-select",""),this._offUpEvents(),a&&(w&&(a.cancelable&&a.preventDefault(),!s.dropBubble&&a.stopPropagation()),n&&n.parentNode&&n.parentNode.removeChild(n),(i===e||f&&"clone"!==f.lastPutMode)&&o&&o.parentNode&&o.parentNode.removeChild(o),t&&(this.nativeDraggable&&Et(t,"dragend",this),Yt(t),t.style["will-change"]="",xt(t,f?f.options.ghostClass:this.options.ghostClass,!1),xt(t,this.options.chosenClass,!1),Pt(this,i,"unchoose",t,e,i,h,null,a),i!==e?(d=Wt(t,s.draggable),d>=0&&(Pt(null,e,"add",t,e,i,h,d,a),Pt(this,i,"remove",t,e,i,h,d,a),Pt(null,e,"sort",t,e,i,h,d,a),Pt(this,i,"sort",t,e,i,h,d,a)),f&&f.save()):t.nextSibling!==r&&(d=Wt(t,s.draggable),d>=0&&(Pt(this,i,"update",t,e,i,h,d,a),Pt(this,i,"sort",t,e,i,h,d,a))),yt.active&&(null!=d&&-1!==d||(d=h),Pt(this,i,"end",t,e,i,h,d,a),this.save()))),this._nulling()},_nulling:function(){i=t=e=n=r=o=a=l=s=E.length=p=v=g=m=b=w=d=h=_=y=C=f=u=yt.active=null,ot.forEach((function(t){t.checked=!0})),ot.length=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":t&&(this._onDragOver(e),St(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var t,e=[],n=this.el.children,o=0,i=n.length,r=this.options;o<i;o++)t=n[o],Dt(t,r.draggable,this.el,!1)&&e.push(t.getAttribute(r.dataIdAttr)||Lt(t));return e},sort:function(t){var e={},n=this.el;this.toArray().forEach((function(t,o){var i=n.children[o];Dt(i,this.options.draggable,n,!1)&&(e[t]=i)}),this),t.forEach((function(t){e[t]&&(n.removeChild(e[t]),n.appendChild(e[t]))}))},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return Dt(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(void 0===e)return n[t];n[t]=e,"group"===t&&ft(n)},destroy:function(){var t=this.el;t[I]=null,Et(t,"mousedown",this._onTapStart),Et(t,"touchstart",this._onTapStart),Et(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(Et(t,"dragover",this),Et(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(t){t.removeAttribute("draggable")})),this._onDrop(),k.splice(k.indexOf(this.el),1),this.el=t=null},_hideClone:function(){o.cloneHidden||(Nt(o,"display","none"),o.cloneHidden=!0,o.parentNode&&this.options.removeCloneOnHide&&o.parentNode.removeChild(o))},_showClone:function(e){"clone"===e.lastPutMode?o.cloneHidden&&(i.contains(t)&&!this.options.group.revertClone?i.insertBefore(o,t):r?i.insertBefore(o,r):i.appendChild(o),this.options.group.revertClone&&this._animate(t,o),Nt(o,"display",""),o.cloneHidden=!1):this._hideClone()}},Ct(O,"touchmove",(function(t){(yt.active||N)&&t.cancelable&&t.preventDefault()})),yt.utils={on:Ct,off:Et,css:Nt,find:kt,is:function(t,e){return!!Dt(t,e,t,!1)},extend:Ut,throttle:zt,closest:Dt,toggleClass:xt,clone:Vt,index:Wt,nextTick:Gt,cancelNextTick:Jt,detectDirection:it,getChild:It},yt.create=function(t,e){return new yt(t,e)},yt.version="1.8.4",yt}))}}]); |