vizor_panels 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see vizor_panels.min.js.LICENSE.txt */
2
- var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{Hx:()=>Ei,YO:()=>Pi,Qz:()=>Oi});var i={},s="function"==typeof Map?new Map:null,n="swap",r="move",o="layoutStart",a="layoutEnd",h="layoutAbort",l="remove",d="hideStart",_="filter",c="sort",u="move",f="send",p="beforeSend",m="receive",v="beforeReceive",g="dragReleaseEnd",y="ontouchstart"in window,b=!!window.PointerEvent,w=!!window.navigator.msPointerEnabled;function S(){this._events={},this._queue=[],this._counter=0,this._clearOnEmit=!1}S.prototype.on=function(t,e){if(!this._events||!t||!e)return this;var i=this._events[t];return i||(i=this._events[t]=[]),i.push(e),this},S.prototype.off=function(t,e){if(!this._events||!t||!e)return this;var i,s=this._events[t];if(!s||!s.length)return this;for(;-1!==(i=s.indexOf(e));)s.splice(i,1);return this},S.prototype.clear=function(t){if(!this._events||!t)return this;var e=this._events[t];return e&&(e.length=0,delete this._events[t]),this},S.prototype.emit=function(t){if(!this._events||!t)return this._clearOnEmit=!1,this;var e=this._events[t];if(!e||!e.length)return this._clearOnEmit=!1,this;var i,s=this._queue,n=s.length,r=arguments.length-1;r>3&&((i=[]).push.apply(i,arguments),i.shift()),s.push.apply(s,e),this._clearOnEmit&&(e.length=0,this._clearOnEmit=!1),++this._counter;for(var o=n,a=s.length;o<a;o++)if(0===r?s[o]():1===r?s[o](arguments[1]):2===r?s[o](arguments[1],arguments[2]):3===r?s[o](arguments[1],arguments[2],arguments[3]):s[o].apply(null,i),!this._events)return this;return--this._counter,this._counter||(s.length=0),this},S.prototype.burst=function(){return this._events?(this._clearOnEmit=!0,this.emit.apply(this,arguments),this):this},S.prototype.countListeners=function(t){if(!this._events)return 0;var e=this._events[t];return e?e.length:0},S.prototype.destroy=function(){return this._events?(this._queue.length=this._counter=0,this._events=null,this):this};var D=b?"pointerout":w?"MSPointerOut":"";function k(t){D&&(this._dragger=t,this._timeout=null,this._outEvent=null,this._isActive=!1,this._addBehaviour=this._addBehaviour.bind(this),this._removeBehaviour=this._removeBehaviour.bind(this),this._onTimeout=this._onTimeout.bind(this),this._resetData=this._resetData.bind(this),this._onStart=this._onStart.bind(this),this._onOut=this._onOut.bind(this),this._dragger.on("start",this._onStart))}k.prototype._addBehaviour=function(){this._isActive||(this._isActive=!0,this._dragger.on("move",this._resetData),this._dragger.on("cancel",this._removeBehaviour),this._dragger.on("end",this._removeBehaviour),window.addEventListener(D,this._onOut))},k.prototype._removeBehaviour=function(){this._isActive&&(this._dragger.off("move",this._resetData),this._dragger.off("cancel",this._removeBehaviour),this._dragger.off("end",this._removeBehaviour),window.removeEventListener(D,this._onOut),this._resetData(),this._isActive=!1)},k.prototype._resetData=function(){window.clearTimeout(this._timeout),this._timeout=null,this._outEvent=null},k.prototype._onStart=function(t){"mouse"!==t.pointerType&&this._addBehaviour()},k.prototype._onOut=function(t){this._dragger._getTrackedTouch(t)&&(this._resetData(),this._outEvent=t,this._timeout=window.setTimeout(this._onTimeout,100))},k.prototype._onTimeout=function(){var t=this._outEvent;this._resetData(),this._dragger.isActive()&&this._dragger._onCancel(t)},k.prototype.destroy=function(){D&&(this._dragger.off("start",this._onStart),this._removeBehaviour())};var x=["","webkit","moz","ms","o","Webkit","Moz","MS","O"],E={};function L(t,e){var i=E[e]||"";if(i)return i;for(var s=e[0].toUpperCase()+e.slice(1),n=0;n<x.length;){if((i=x[n]?x[n]+s:e)in t)return E[e]=i,i;++n}return""}function A(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}return t}var T=window.navigator.userAgent.toLowerCase(),R=T.indexOf("edge")>-1,C=T.indexOf("trident")>-1,I=T.indexOf("firefox")>-1,P=T.indexOf("android")>-1,M=!!A()&&{passive:!0},Y="touchAction",X=L(document.documentElement.style,Y),O="auto";function q(t,e){this._element=t,this._emitter=new S,this._isDestroyed=!1,this._cssProps={},this._touchAction="",this._isActive=!1,this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._onStart=this._onStart.bind(this),this._onMove=this._onMove.bind(this),this._onCancel=this._onCancel.bind(this),this._onEnd=this._onEnd.bind(this),this._edgeHack=null,(R||C)&&(b||w)&&(this._edgeHack=new k(this)),this.setCssProps(e),this._touchAction||this.setTouchAction(O),t.addEventListener("dragstart",q._preventDefault,!1),t.addEventListener(q._inputEvents.start,this._onStart,M)}q._pointerEvents={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},q._msPointerEvents={start:"MSPointerDown",move:"MSPointerMove",cancel:"MSPointerCancel",end:"MSPointerUp"},q._touchEvents={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},q._mouseEvents={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},q._inputEvents=y?q._touchEvents:b?q._pointerEvents:w?q._msPointerEvents:q._mouseEvents,q._emitter=new S,q._emitterEvents={start:"start",move:"move",end:"end",cancel:"cancel"},q._activeInstances=[],q._preventDefault=function(t){t.preventDefault&&!1!==t.cancelable&&t.preventDefault()},q._activateInstance=function(t){q._activeInstances.indexOf(t)>-1||(q._activeInstances.push(t),q._emitter.on(q._emitterEvents.move,t._onMove),q._emitter.on(q._emitterEvents.cancel,t._onCancel),q._emitter.on(q._emitterEvents.end,t._onEnd),1===q._activeInstances.length&&q._bindListeners())},q._deactivateInstance=function(t){var e=q._activeInstances.indexOf(t);-1!==e&&(q._activeInstances.splice(e,1),q._emitter.off(q._emitterEvents.move,t._onMove),q._emitter.off(q._emitterEvents.cancel,t._onCancel),q._emitter.off(q._emitterEvents.end,t._onEnd),q._activeInstances.length||q._unbindListeners())},q._bindListeners=function(){window.addEventListener(q._inputEvents.move,q._onMove,M),window.addEventListener(q._inputEvents.end,q._onEnd,M),q._inputEvents.cancel&&window.addEventListener(q._inputEvents.cancel,q._onCancel,M)},q._unbindListeners=function(){window.removeEventListener(q._inputEvents.move,q._onMove,M),window.removeEventListener(q._inputEvents.end,q._onEnd,M),q._inputEvents.cancel&&window.removeEventListener(q._inputEvents.cancel,q._onCancel,M)},q._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},q._getTouchById=function(t,e){if("number"==typeof t.pointerId)return t.pointerId===e?t:null;if(t.changedTouches){for(var i=0;i<t.changedTouches.length;i++)if(t.changedTouches[i].identifier===e)return t.changedTouches[i];return null}return t},q._onMove=function(t){q._emitter.emit(q._emitterEvents.move,t)},q._onCancel=function(t){q._emitter.emit(q._emitterEvents.cancel,t)},q._onEnd=function(t){q._emitter.emit(q._emitterEvents.end,t)},q.prototype._reset=function(){this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._isActive=!1,q._deactivateInstance(this)},q.prototype._createEvent=function(t,e){var i=this._getTrackedTouch(e);return{type:t,srcEvent:e,distance:this.getDistance(),deltaX:this.getDeltaX(),deltaY:this.getDeltaY(),deltaTime:t===q._emitterEvents.start?0:this.getDeltaTime(),isFirst:t===q._emitterEvents.start,isFinal:t===q._emitterEvents.end||t===q._emitterEvents.cancel,pointerType:e.pointerType||(e.touches?"touch":"mouse"),identifier:this._pointerId,screenX:i.screenX,screenY:i.screenY,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,target:i.target}},q.prototype._emit=function(t,e){this._emitter.emit(t,this._createEvent(t,e))},q.prototype._getTrackedTouch=function(t){return null===this._pointerId?null:q._getTouchById(t,this._pointerId)},q.prototype._onStart=function(t){if(!this._isDestroyed&&null===this._pointerId&&(this._pointerId=q._getEventPointerId(t),null!==this._pointerId)){var e=this._getTrackedTouch(t);this._startX=this._currentX=e.clientX,this._startY=this._currentY=e.clientY,this._startTime=Date.now(),this._isActive=!0,this._emit(q._emitterEvents.start,t),this._isActive&&q._activateInstance(this)}},q.prototype._onMove=function(t){var e=this._getTrackedTouch(t);e&&(this._currentX=e.clientX,this._currentY=e.clientY,this._emit(q._emitterEvents.move,t))},q.prototype._onCancel=function(t){this._getTrackedTouch(t)&&(this._emit(q._emitterEvents.cancel,t),this._reset())},q.prototype._onEnd=function(t){this._getTrackedTouch(t)&&(this._emit(q._emitterEvents.end,t),this._reset())},q.prototype.isActive=function(){return this._isActive},q.prototype.setTouchAction=function(t){this._touchAction=t,X&&(this._cssProps[X]="",this._element.style[X]=t),y&&(this._element.removeEventListener(q._touchEvents.start,q._preventDefault,!0),(this._element.style[X]!==t||I&&P)&&this._element.addEventListener(q._touchEvents.start,q._preventDefault,!0))},q.prototype.setCssProps=function(t){if(t){var e,i,s=this._cssProps,n=this._element;for(e in s)n.style[e]=s[e],delete s[e];for(e in t)t[e]&&(e!==Y?(i=L(n.style,e))&&(s[i]="",n.style[i]=t[e]):this.setTouchAction(t[e]))}},q.prototype.getDeltaX=function(){return this._currentX-this._startX},q.prototype.getDeltaY=function(){return this._currentY-this._startY},q.prototype.getDistance=function(){var t=this.getDeltaX(),e=this.getDeltaY();return Math.sqrt(t*t+e*e)},q.prototype.getDeltaTime=function(){return this._startTime?Date.now()-this._startTime:0},q.prototype.on=function(t,e){this._emitter.on(t,e)},q.prototype.off=function(t,e){this._emitter.off(t,e)},q.prototype.destroy=function(){if(!this._isDestroyed){var t=this._element;for(var e in this._edgeHack&&this._edgeHack.destroy(),this._reset(),this._emitter.destroy(),t.removeEventListener(q._inputEvents.start,this._onStart,M),t.removeEventListener("dragstart",q._preventDefault,!1),t.removeEventListener(q._touchEvents.start,q._preventDefault,!0),this._cssProps)t.style[e]=this._cssProps[e],delete this._cssProps[e];this._element=null,this._isDestroyed=!0}};var H=1e3/60,G=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return this.setTimeout((function(){t(Date.now())}),H)}).bind(window);function N(t){this._nextStep=null,this._lanes=[],this._stepQueue=[],this._stepCallbacks={},this._step=this._step.bind(this);for(var e=0;e<t;e++)this._lanes.push(new B)}function B(){this.queue=[],this.indices={},this.callbacks={}}N.prototype._step=function(t){var e,i,s,n,r,o,a=this._lanes,h=this._stepQueue,l=this._stepCallbacks;for(this._nextStep=null,e=0;e<a.length;e++){for(n=a[e].queue,r=a[e].callbacks,o=a[e].indices,i=0;i<n.length;i++)(s=n[i])&&(h.push(s),l[s]=r[s],delete r[s],delete o[s]);n.length=0}for(e=0;e<h.length;e++)l[s=h[e]]&&l[s](t),delete l[s];h.length=0},N.prototype.add=function(t,e,i){this._lanes[t].add(e,i),this._nextStep||(this._nextStep=G(this._step))},N.prototype.remove=function(t,e){this._lanes[t].remove(e)},B.prototype.add=function(t,e){var i=this.indices[t];void 0!==i&&(this.queue[i]=void 0),this.queue.push(t),this.callbacks[t]=e,this.indices[t]=this.queue.length-1},B.prototype.remove=function(t){var e=this.indices[t];void 0!==e&&(this.queue[e]=void 0,delete this.callbacks[t],delete this.indices[t])};var W="layoutRead",z="layoutWrite",F="visibilityRead",j="visibilityWrite",V="dragStartRead",Q="dragStartWrite",U="dragMoveRead",Z="dragMoveWrite",J="dragScrollRead",$="dragScrollWrite",K="dragSortRead",tt="placeholderLayoutRead",et="placeholderLayoutWrite",it="placeholderResizeWrite",st="autoScrollRead",nt="autoScrollWrite",rt="debounceRead",ot=0,at=new N(3);function ht(t){at.remove(ot,W+t),at.remove(2,z+t)}function lt(t){at.remove(ot,F+t),at.remove(2,j+t)}function dt(t){at.remove(ot,V+t),at.remove(2,Q+t)}function _t(t){at.remove(ot,U+t),at.remove(2,Z+t)}function ct(t){at.remove(ot,J+t),at.remove(2,$+t)}function ut(t,e){at.add(1,K+t,e)}function ft(t){at.remove(ot,tt+t),at.remove(2,et+t)}function pt(t,e){at.add(ot,st,t),at.add(2,nt,e)}var mt="function";function vt(t){return typeof t===mt}var gt="function"==typeof WeakMap?new WeakMap:null;function yt(t,e){var i=gt&&gt.get(t);return i||(i=window.getComputedStyle(t,null),gt&&gt.set(t,i)),i.getPropertyValue(e)}function bt(t,e){return parseFloat(yt(t,e))||0}var wt,St=document.documentElement,Dt=document.body,kt={value:0,offset:0};function xt(t){return t===window||t===St||t===Dt?window:t}function Et(t){return t===window?t.pageXOffset:t.scrollLeft}function Lt(t){return t===window?t.pageYOffset:t.scrollTop}function At(t){return t===window?St.scrollWidth-St.clientWidth:t.scrollWidth-t.clientWidth}function Tt(t){return t===window?St.scrollHeight-St.clientHeight:t.scrollHeight-t.clientHeight}function Rt(t,e){if(e=e||{},t===window)e.width=St.clientWidth,e.height=St.clientHeight,e.left=0,e.right=e.width,e.top=0,e.bottom=e.height;else{var i=t.getBoundingClientRect(),s=t.clientLeft||bt(t,"border-left-width"),n=t.clientTop||bt(t,"border-top-width");e.width=t.clientWidth,e.height=t.clientHeight,e.left=i.left+s,e.right=e.left+e.width,e.top=i.top+n,e.bottom=e.top+e.height}return e}function Ct(t){return t._drag._getGrid()._settings.dragAutoScroll}function It(t){if(t._drag&&t._isActive){var e=t._drag;e._scrollDiffX=e._scrollDiffY=0,t._setTranslate(e._left,e._top)}}function Pt(t,e,i,s){return kt.value=Math.min(s/2,t),kt.offset=Math.max(0,i+2*kt.value+s*e-s)/2,kt}function Mt(){this.reset()}function Yt(){this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}function Xt(t,e){this.pool=[],this.createItem=t,this.releaseItem=e}function Ot(t,e){var i=function(t,e){return function(t,e){return!(t.left+t.width<=e.left||e.left+e.width<=t.left||t.top+t.height<=e.top||e.top+e.height<=t.top)}(t,e)?(Math.min(t.left+t.width,e.left+e.width)-Math.max(t.left,e.left))*(Math.min(t.top+t.height,e.top+e.height)-Math.max(t.top,e.top)):0}(t,e);return i?i/(Math.min(t.width,e.width)*Math.min(t.height,e.height))*100:0}Mt.prototype.reset=function(){this.isActive&&this.onStop(),this.item=null,this.element=null,this.isActive=!1,this.isEnding=!1,this.direction=null,this.value=null,this.maxValue=0,this.threshold=0,this.distance=0,this.speed=0,this.duration=0,this.action=null},Mt.prototype.hasReachedEnd=function(){return 4&this.direction?this.value>=this.maxValue:this.value<=0},Mt.prototype.computeCurrentScrollValue=function(){return null===this.value?1&this.direction?Et(this.element):Lt(this.element):Math.max(0,Math.min(this.value,this.maxValue))},Mt.prototype.computeNextScrollValue=function(t){var e=this.speed*(t/1e3),i=4&this.direction?this.value+e:this.value-e;return Math.max(0,Math.min(i,this.maxValue))},Mt.prototype.computeSpeed=(wt={direction:null,threshold:0,distance:0,value:0,maxValue:0,deltaTime:0,duration:0,isEnding:!1},function(t){var e=this.item,i=Ct(e).speed;return vt(i)?(wt.direction=this.direction,wt.threshold=this.threshold,wt.distance=this.distance,wt.value=this.value,wt.maxValue=this.maxValue,wt.duration=this.duration,wt.speed=this.speed,wt.deltaTime=t,wt.isEnding=this.isEnding,i(e,this.element,wt)):i}),Mt.prototype.tick=function(t){return this.isActive||(this.isActive=!0,this.onStart()),this.value=this.computeCurrentScrollValue(),this.speed=this.computeSpeed(t),this.value=this.computeNextScrollValue(t),this.duration+=t,this.value},Mt.prototype.onStart=function(){var t=this.item,e=Ct(t).onStart;vt(e)&&e(t,this.element,this.direction)},Mt.prototype.onStop=function(){var t=this.item,e=Ct(t).onStop;vt(e)&&e(t,this.element,this.direction),t._drag&&t._drag.sort()},Yt.prototype.reset=function(){this.requestX&&(this.requestX.action=null),this.requestY&&(this.requestY.action=null),this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0},Yt.prototype.addRequest=function(t){1&t.direction?(this.removeRequest(this.requestX),this.requestX=t):(this.removeRequest(this.requestY),this.requestY=t),t.action=this},Yt.prototype.removeRequest=function(t){t&&(this.requestX===t?(this.requestX=null,t.action=null):this.requestY===t&&(this.requestY=null,t.action=null))},Yt.prototype.computeScrollValues=function(){this.scrollLeft=this.requestX?this.requestX.value:Et(this.element),this.scrollTop=this.requestY?this.requestY.value:Lt(this.element)},Yt.prototype.scroll=function(){var t=this.element;t&&(t.scrollTo?t.scrollTo(this.scrollLeft,this.scrollTop):(t.scrollLeft=this.scrollLeft,t.scrollTop=this.scrollTop))},Xt.prototype.pick=function(){return this.pool.pop()||this.createItem()},Xt.prototype.release=function(t){this.releaseItem(t),-1===this.pool.indexOf(t)&&this.pool.push(t)},Xt.prototype.reset=function(){this.pool.length=0};var qt={width:0,height:0,left:0,right:0,top:0,bottom:0},Ht={width:0,height:0,left:0,right:0,top:0,bottom:0};function Gt(){this._isDestroyed=!1,this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,this._items=[],this._actions=[],this._requests={},this._requests[1]={},this._requests[2]={},this._requestOverlapCheck={},this._dragPositions={},this._dragDirections={},this._overlapCheckInterval=150,this._requestPool=new Xt((function(){return new Mt}),(function(t){t.reset()})),this._actionPool=new Xt((function(){return new Yt}),(function(t){t.reset()})),this._readTick=this._readTick.bind(this),this._writeTick=this._writeTick.bind(this)}Gt.AXIS_X=1,Gt.AXIS_Y=2,Gt.FORWARD=4,Gt.BACKWARD=8,Gt.LEFT=9,Gt.RIGHT=5,Gt.UP=10,Gt.DOWN=6,Gt.smoothSpeed=function(t,e,i){return function(s,n,r){var o=0;if(!r.isEnding)if(r.threshold>0){var a=r.threshold-Math.max(0,r.distance);o=t/r.threshold*a}else o=t;var h=r.speed,l=o;return h===o?l:h<o?(l=h+e*(r.deltaTime/1e3),Math.min(o,l)):(l=h-i*(r.deltaTime/1e3),Math.max(o,l))}},Gt.pointerHandle=function(t){var e={left:0,top:0,width:0,height:0},i=t||1;return function(t,s,n,r,o,a,h){return e.left=a-.5*i,e.top=h-.5*i,e.width=i,e.height=i,e}},Gt.prototype._readTick=function(t){this._isDestroyed||(t&&this._tickTime?(this._tickDeltaTime=t-this._tickTime,this._tickTime=t,this._updateRequests(),this._updateActions()):(this._tickTime=t,this._tickDeltaTime=0))},Gt.prototype._writeTick=function(){this._isDestroyed||(this._applyActions(),pt(this._readTick,this._writeTick))},Gt.prototype._startTicking=function(){this._isTicking=!0,pt(this._readTick,this._writeTick)},Gt.prototype._stopTicking=function(){this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,at.remove(ot,st),at.remove(2,nt)},Gt.prototype._getItemHandleRect=function(t,e,i){var s=t._drag;if(e){var n=s._dragMoveEvent||s._dragStartEvent,r=e(t,s._clientX,s._clientY,t._width,t._height,n.clientX,n.clientY);i.left=r.left,i.top=r.top,i.width=r.width,i.height=r.height}else i.left=s._clientX,i.top=s._clientY,i.width=t._width,i.height=t._height;return i.right=i.left+i.width,i.bottom=i.top+i.height,i},Gt.prototype._requestItemScroll=function(t,e,i,s,n,r,o){var a=this._requests[e],h=a[t._id];h?h.element===i&&h.direction===s||h.reset():h=this._requestPool.pick(),h.item=t,h.element=i,h.direction=s,h.threshold=n,h.distance=r,h.maxValue=o,a[t._id]=h},Gt.prototype._cancelItemScroll=function(t,e){var i=this._requests[e],s=i[t._id];s&&(s.action&&s.action.removeRequest(s),this._requestPool.release(s),delete i[t._id])},Gt.prototype._checkItemOverlap=function(t,e,i){var s=Ct(t),n=vt(s.targets)?s.targets(t):s.targets,r=s.threshold,o=s.safeZone;if(!n||!n.length)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));var a=this._dragDirections[t._id],h=a[0],l=a[1];if(!h&&!l)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));for(var d=this._getItemHandleRect(t,s.handle,qt),_=Ht,c=null,u=null,f=!0,p=!0,m=0,v=0,g=null,y=null,b=0,w=0,S=0,D=null,k=-1/0,x=0,E=0,L=null,A=0,T=0,R=null,C=-1/0,I=0,P=0,M=null,Y=0,X=0,O=0;O<n.length;O++)c=n[O],f=e&&h&&2!==c.axis,p=i&&l&&1!==c.axis,v=c.priority||0,(!f||v<k)&&(!p||v<C)||(u=xt(c.element||c),w=f?At(u):-1,S=p?Tt(u):-1,(w||S)&&((m=Ot(d,_=Rt(u,_)))<=0||(f&&v>=k&&w>0&&(v>k||m>E)&&(y=null,g=Pt("number"==typeof c.threshold?c.threshold:r,o,d.width,_.width),5===h?(b=_.right+g.offset-d.right)<=g.value&&Et(u)<w&&(y=5):9===h&&(b=d.left-(_.left-g.offset))<=g.value&&Et(u)>0&&(y=9),null!==y&&(D=u,k=v,x=g.value,E=m,L=y,A=b,T=w)),p&&v>=C&&S>0&&(v>C||m>P)&&(y=null,g=Pt("number"==typeof c.threshold?c.threshold:r,o,d.height,_.height),6===l?(b=_.bottom+g.offset-d.bottom)<=g.value&&Lt(u)<S&&(y=6):10===l&&(b=d.top-(_.top-g.offset))<=g.value&&Lt(u)>0&&(y=10),null!==y&&(R=u,C=v,I=g.value,P=m,M=y,Y=b,X=S)))));e&&(D?this._requestItemScroll(t,1,D,L,x,A,T):this._cancelItemScroll(t,1)),i&&(R?this._requestItemScroll(t,2,R,M,I,Y,X):this._cancelItemScroll(t,2))},Gt.prototype._updateScrollRequest=function(t){for(var e=t.item,i=Ct(e),s=vt(i.targets)?i.targets(e):i.targets,n=s&&s.length||0,r=i.threshold,o=i.safeZone,a=this._getItemHandleRect(e,i.handle,qt),h=Ht,l=null,d=null,_=!1,c=null,u=null,f=null,p=null,m=null,v=0;v<n;v++)if((d=xt((l=s[v]).element||l))===t.element){if(_=!!(1&t.direction)){if(2===l.axis)continue}else if(1===l.axis)continue;if((p=_?At(d):Tt(d))<=0)break;if(Ot(a,h=Rt(d,h))<=0)break;if(c=Pt("number"==typeof l.threshold?l.threshold:r,o,_?a.width:a.height,_?h.width:h.height),(u=9===t.direction?a.left-(h.left-c.offset):5===t.direction?h.right+c.offset-a.right:10===t.direction?a.top-(h.top-c.offset):h.bottom+c.offset-a.bottom)>c.value)break;if(f=_?Et(d):Lt(d),m=4&t.direction?f>=p:f<=0)break;return t.maxValue=p,t.threshold=c.value,t.distance=u,t.isEnding=!1,!0}return!0===i.smoothStop&&t.speed>0?(null===m&&(m=t.hasReachedEnd()),t.isEnding=!m):t.isEnding=!1,t.isEnding},Gt.prototype._updateRequests=function(){for(var t,e,i,s,n,r,o,a=this._items,h=this._requests[1],l=this._requests[2],d=0;d<a.length;d++)t=a[d],n=(s=this._requestOverlapCheck[t._id])>0&&this._tickTime-s>this._overlapCheckInterval,r=!0,(e=h[t._id])&&e.isActive&&(r=!this._updateScrollRequest(e))&&(n=!0,this._cancelItemScroll(t,1)),o=!0,(i=l[t._id])&&i.isActive&&(o=!this._updateScrollRequest(i))&&(n=!0,this._cancelItemScroll(t,2)),n&&(this._requestOverlapCheck[t._id]=0,this._checkItemOverlap(t,r,o))},Gt.prototype._requestAction=function(t,e){for(var i=this._actions,s=1===e,n=null,r=0;r<i.length;r++){if(n=i[r],t.element===n.element){if(s?n.requestX:n.requestY)return void this._cancelItemScroll(t.item,e);break}n=null}n||(n=this._actionPool.pick()),n.element=t.element,n.addRequest(t),t.tick(this._tickDeltaTime),i.push(n)},Gt.prototype._updateActions=function(){var t,e,i,s,n=this._items,r=this._requests,o=this._actions;for(s=0;s<n.length;s++)t=n[s]._id,e=r[1][t],i=r[2][t],e&&this._requestAction(e,1),i&&this._requestAction(i,2);for(s=0;s<o.length;s++)o[s].computeScrollValues()},Gt.prototype._applyActions=function(){var t,e=this._actions,i=this._items;if(e.length){for(t=0;t<e.length;t++)e[t].scroll(),this._actionPool.release(e[t]);for(e.length=0,t=0;t<i.length;t++)(s=i[t])._drag&&s._drag._prepareScroll();var s;for(t=0;t<i.length;t++)It(i[t])}},Gt.prototype._updateDragDirection=function(t){var e=this._dragPositions[t._id],i=this._dragDirections[t._id],s=t._drag._left,n=t._drag._top;if(e.length){var r=e[0],o=e[1];i[0]=s>r?5:s<r?9:i[0]||0,i[1]=n>o?6:n<o?10:i[1]||0}e[0]=s,e[1]=n},Gt.prototype.addItem=function(t){this._isDestroyed||-1===this._items.indexOf(t)&&(this._items.push(t),this._requestOverlapCheck[t._id]=this._tickTime,this._dragDirections[t._id]=[0,0],this._dragPositions[t._id]=[],this._isTicking||this._startTicking())},Gt.prototype.updateItem=function(t){this._isDestroyed||this._dragDirections[t._id]&&(this._updateDragDirection(t),this._requestOverlapCheck[t._id]||(this._requestOverlapCheck[t._id]=this._tickTime))},Gt.prototype.removeItem=function(t){if(!this._isDestroyed){var e=this._items.indexOf(t);if(-1!==e){var i=t._id;this._requests[1][i]&&(this._cancelItemScroll(t,1),delete this._requests[1][i]),this._requests[2][i]&&(this._cancelItemScroll(t,2),delete this._requests[2][i]),delete this._requestOverlapCheck[i],delete this._dragPositions[i],delete this._dragDirections[i],this._items.splice(e,1),this._isTicking&&!this._items.length&&this._stopTicking()}}},Gt.prototype.isItemScrollingX=function(t){var e=this._requests[1][t._id];return!(!e||!e.isActive)},Gt.prototype.isItemScrollingY=function(t){var e=this._requests[2][t._id];return!(!e||!e.isActive)},Gt.prototype.isItemScrolling=function(t){return this.isItemScrollingX(t)||this.isItemScrollingY(t)},Gt.prototype.destroy=function(){if(!this._isDestroyed){for(var t=this._items.slice(0),e=0;e<t.length;e++)this.removeItem(t[e]);this._actions.length=0,this._requestPool.reset(),this._actionPool.reset(),this._isDestroyed=!0}};var Nt=window.Element.prototype,Bt=Nt.matches||Nt.matchesSelector||Nt.webkitMatchesSelector||Nt.mozMatchesSelector||Nt.msMatchesSelector||Nt.oMatchesSelector||function(){return!1};function Wt(t,e){return Bt.call(t,e)}function zt(t,e){e&&(t.classList?t.classList.add(e):Wt(t,"."+e)||(t.className+=" "+e))}var Ft=[];function jt(t,e,i){var s="number"==typeof i?i:-1;s<0&&(s=t.length-s+1),t.splice.apply(t,Ft.concat(s,0,e)),Ft.length=0}function Vt(t,e,i){var s=Math.max(0,t.length-1+(i||0));return e>s?s:e<0?Math.max(s+e+1,0):e}function Qt(t,e,i){if(!(t.length<2)){var s=Vt(t,e),n=Vt(t,i);s!==n&&t.splice(n,0,t.splice(s,1)[0])}}function Ut(t,e,i){if(!(t.length<2)){var s,n=Vt(t,e),r=Vt(t,i);n!==r&&(s=t[n],t[n]=t[r],t[r]=s)}}var Zt=L(document.documentElement.style,"transform")||"transform",Jt=/([A-Z])/g,$t=/^(webkit-|moz-|ms-|o-)/,Kt=/^(-m-s-)/;function te(t){var e=t.replace(Jt,"-$1").toLowerCase();return e=(e=e.replace($t,"-$1")).replace(Kt,"-ms-")}var ee=te(Zt),ie="none",se="inline",ne="none",re="display";function oe(t){var e=yt(t,ee);if(!e||e===ie)return!1;var i=yt(t,re);return i!==se&&i!==ne}function ae(t){for(var e=document,i=t||e;i&&i!==e&&"static"===yt(i,"position")&&!oe(i);)i=i.parentElement||e;return i}var he={},le={},de={};function _e(t,e){var i,s=e||{};return s.left=0,s.top=0,t===document?s:(s.left=window.pageXOffset||0,s.top=window.pageYOffset||0,t.self===window.self||(i=t.getBoundingClientRect(),s.left+=i.left,s.top+=i.top,s.left+=bt(t,"border-left-width"),s.top+=bt(t,"border-top-width")),s)}function ce(t,e,i){return de.left=0,de.top=0,t===e||i&&(t=ae(t))===(e=ae(e))||(_e(t,he),_e(e,le),de.left=le.left-he.left,de.top=le.top-he.top),de}function ue(t){return"auto"===t||"scroll"===t||"overlay"===t}function fe(t){return ue(yt(t,"overflow"))||ue(yt(t,"overflow-x"))||ue(yt(t,"overflow-y"))}function pe(t,e){for(e=e||[];t&&t!==document;)t.getRootNode&&t instanceof DocumentFragment?t=t.getRootNode().host:(fe(t)&&e.push(t),t=t.parentNode);return e.push(window),e}var me={},ve=/^matrix3d/,ge=/([^,]*,){4}/,ye=/([^,]*,){12}/,be=/[^,]*,/;function we(t){me.x=0,me.y=0;var e=yt(t,ee);if(!e||"none"===e)return me;var i=ve.test(e),s=e.replace(i?ye:ge,""),n=s.replace(be,"");return me.x=parseFloat(s)||0,me.y=parseFloat(n)||0,me}function Se(t,e){e&&(t.classList?t.classList.remove(e):Wt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim()))}var De,ke,xe,Ee,Le=/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1,Ae=0,Te=!!A()&&{passive:!0};function Re(t){var e=t._element,i=t.getGrid(),s=i._settings;this._item=t,this._gridId=i._id,this._isDestroyed=!1,this._isMigrating=!1,this._startPredicate=vt(s.dragStartPredicate)?s.dragStartPredicate:Re.defaultStartPredicate,this._startPredicateState=Ae,this._startPredicateResult=void 0,this._isSortNeeded=!1,this._sortTimer=void 0,this._blockedSortIndex=null,this._sortX1=0,this._sortX2=0,this._sortY1=0,this._sortY2=0,this._reset(),this._preStartCheck=this._preStartCheck.bind(this),this._preEndCheck=this._preEndCheck.bind(this),this._onScroll=this._onScroll.bind(this),this._prepareStart=this._prepareStart.bind(this),this._applyStart=this._applyStart.bind(this),this._prepareMove=this._prepareMove.bind(this),this._applyMove=this._applyMove.bind(this),this._prepareScroll=this._prepareScroll.bind(this),this._applyScroll=this._applyScroll.bind(this),this._handleSort=this._handleSort.bind(this),this._handleSortDelayed=this._handleSortDelayed.bind(this),this._handle=s.dragHandle&&e.querySelector(s.dragHandle)||e,this._dragger=new q(this._handle,s.dragCssProps),this._dragger.on("start",this._preStartCheck),this._dragger.on("move",this._preStartCheck),this._dragger.on("cancel",this._preEndCheck),this._dragger.on("end",this._preEndCheck)}function Ce(t,e){var i,s,n={};if(Array.isArray(e))for(s=0;s<e.length;s++)n[i=e[s]]=yt(t,te(i));else for(i in e)n[i]=yt(t,te(i));return n}Re.autoScroller=new Gt,Re.defaultStartPredicate=function(t,e,i){var s=t._drag;if(e.isFirst&&e.srcEvent.button)return!1;if(!Le&&e.isFirst&&!0===e.srcEvent.isTrusted&&!1===e.srcEvent.defaultPrevented&&!1===e.srcEvent.cancelable)return!1;if(!e.isFinal){var n=s._startPredicateData;if(!n){var r=i||s._getGrid()._settings.dragStartPredicate||{};s._startPredicateData=n={distance:Math.max(r.distance,0)||0,delay:Math.max(r.delay,0)||0}}return n.delay&&(n.event=e,n.delayTimer||(n.delayTimer=window.setTimeout((function(){n.delay=0,s._resolveStartPredicate(n.event)&&(s._forceResolveStartPredicate(n.event),s._resetStartPredicate())}),n.delay))),s._resolveStartPredicate(e)}s._finishStartPredicate(e)},Re.defaultSortPredicate=(De={},ke={},xe={},Ee=[],function(t,e){var i=t._drag,s=i._getGrid(),o=e&&"number"==typeof e.threshold?e.threshold:50,a=e&&e.action===n?n:r,h=e&&e.migrateAction===n?n:r;o=Math.min(Math.max(o,1),100),De.width=t._width,De.height=t._height,De.left=i._clientX,De.top=i._clientY;var l=function(t,e,i){var s,n,r,o,a,h,l,d,_,c,u=null,f=e._settings.dragSort,p=-1;if(!0===f?(Ee[0]=e,n=Ee):vt(f)&&(n=f.call(e,t)),!n||!Array.isArray(n)||!n.length)return u;for(c=0;c<n.length;c++)if(!(r=n[c])._isDestroyed){for(r._updateBoundingRect(),h=Math.max(0,r._left),l=Math.max(0,r._top),d=Math.min(window.innerWidth,r._right),_=Math.min(window.innerHeight,r._bottom),o=r._element.parentNode;o&&o!==document&&o!==document.documentElement&&o!==document.body;)if(o.getRootNode&&o instanceof DocumentFragment)o=o.getRootNode().host;else{if("visible"!==yt(o,"overflow")&&(a=o.getBoundingClientRect(),h=Math.max(h,a.left),l=Math.max(l,a.top),d=Math.min(d,a.right),_=Math.min(_,a.bottom)),"fixed"===yt(o,"position"))break;o=o.parentNode}h>=d||l>=_||(ke.left=h,ke.top=l,ke.width=d-h,ke.height=_-l,(s=Ot(De,ke))>i&&s>p&&(p=s,u=r))}return Ee.length=0,u}(t,s,o);if(!l)return null;var d,_,c,u=t.getGrid()!==l,f=0,p=0,m=0,v=-1,g=!1;for(l===s?(De.left=i._gridX+t._marginLeft,De.top=i._gridY+t._marginTop):(l._updateBorders(1,0,1,0),f=l._left+l._borderLeft,p=l._top+l._borderTop),c=0;c<l._items.length;c++)(d=l._items[c])._isActive&&d!==t&&(g=!0,ke.width=d._width,ke.height=d._height,ke.left=d._left+d._marginLeft+f,ke.top=d._top+d._marginTop+p,(_=Ot(De,ke))>m&&(v=c,m=_));return u&&m<o&&(v=g?v:0,m=o),m>=o?(xe.grid=l,xe.index=v,xe.action=u?h:a,xe):null}),Re.prototype.stop=function(){if(this._isActive)if(this._isMigrating)this._finishMigration();else{var t=this._item,e=t._id;if(Re.autoScroller.removeItem(t),dt(e),_t(e),ct(e),this._cancelSort(),this._isStarted){this._unbindScrollListeners();var i=t._element,s=this._getGrid(),n=s._settings.itemDraggingClass;i.parentNode!==s._element&&(s._element.appendChild(i),t._setTranslate(this._gridX,this._gridY),n&&i.clientWidth),Se(i,n)}this._reset()}},Re.prototype.sort=function(t){var e=this._item;this._isActive&&e._isActive&&this._dragMoveEvent&&(!0===t?this._handleSort():ut(e._id,this._handleSort))},Re.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._dragger.destroy(),Re.autoScroller.removeItem(this._item),this._isDestroyed=!0)},Re.prototype._getGrid=function(){return i[this._gridId]||null},Re.prototype._reset=function(){this._isActive=!1,this._isStarted=!1,this._container=null,this._containingBlock=null,this._dragStartEvent=null,this._dragMoveEvent=null,this._dragPrevMoveEvent=null,this._scrollEvent=null,this._scrollers=[],this._left=0,this._top=0,this._gridX=0,this._gridY=0,this._clientX=0,this._clientY=0,this._scrollDiffX=0,this._scrollDiffY=0,this._moveDiffX=0,this._moveDiffY=0,this._containerDiffX=0,this._containerDiffY=0},Re.prototype._bindScrollListeners=function(){var t,e,i=this._getGrid()._element,s=this._container,n=this._scrollers;if(n.length=0,pe(this._item._element.parentNode,n),s!==i)for(pe(i,t=[]),e=0;e<t.length;e++)n.indexOf(t[e])<0&&n.push(t[e]);for(e=0;e<n.length;e++)n[e].addEventListener("scroll",this._onScroll,Te)},Re.prototype._unbindScrollListeners=function(){var t,e=this._scrollers;for(t=0;t<e.length;t++)e[t].removeEventListener("scroll",this._onScroll,Te);e.length=0},Re.prototype._resolveStartPredicate=function(t){var e=this._startPredicateData;if(!(t.distance<e.distance||e.delay))return this._resetStartPredicate(),!0},Re.prototype._forceResolveStartPredicate=function(t){this._isDestroyed||1!==this._startPredicateState||(this._startPredicateState=2,this._onStart(t))},Re.prototype._finishStartPredicate=function(t){var e=this._item._element,i=Math.abs(t.deltaX)<2&&Math.abs(t.deltaY)<2&&t.deltaTime<200;this._resetStartPredicate(),i&&function(t){if("a"!==t.tagName.toLowerCase())return;var e=t.getAttribute("href");if(!e)return;var i=t.getAttribute("target");i&&"_self"!==i?window.open(e,i):window.location.href=e}(e)},Re.prototype._resetHeuristics=function(t,e){this._blockedSortIndex=null,this._sortX1=this._sortX2=t,this._sortY1=this._sortY2=e},Re.prototype._checkHeuristics=function(t,e){var i=this._getGrid()._settings.dragSortHeuristics,s=i.minDragDistance;if(s<=0)return this._blockedSortIndex=null,!0;var n=t-this._sortX2,r=e-this._sortY2,o=s>3&&i.minBounceBackAngle>0;if(o||(this._blockedSortIndex=null),Math.abs(n)>s||Math.abs(r)>s){if(o){var a=Math.atan2(n,r),h=Math.atan2(this._sortX2-this._sortX1,this._sortY2-this._sortY1),l=Math.atan2(Math.sin(a-h),Math.cos(a-h));Math.abs(l)>i.minBounceBackAngle&&(this._blockedSortIndex=null)}return this._sortX1=this._sortX2,this._sortY1=this._sortY2,this._sortX2=t,this._sortY2=e,!0}return!1},Re.prototype._resetStartPredicate=function(){var t=this._startPredicateData;t&&(t.delayTimer&&(t.delayTimer=window.clearTimeout(t.delayTimer)),this._startPredicateData=null)},Re.prototype._handleSort=function(){if(this._isActive){var t=this._getGrid()._settings;if(!t.dragSort||!t.dragAutoScroll.sortDuringScroll&&Re.autoScroller.isItemScrolling(this._item))return this._sortX1=this._sortX2=this._gridX,this._sortY1=this._sortY2=this._gridY,this._isSortNeeded=!0,void(void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)));var e=this._checkHeuristics(this._gridX,this._gridY);if(this._isSortNeeded||e){var i=t.dragSortHeuristics.sortInterval;i<=0||this._isSortNeeded?(this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),this._checkOverlap()):void 0===this._sortTimer&&(this._sortTimer=window.setTimeout(this._handleSortDelayed,i))}}},Re.prototype._handleSortDelayed=function(){this._isSortNeeded=!0,this._sortTimer=void 0,ut(this._item._id,this._handleSort)},Re.prototype._cancelSort=function(){var t;this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),t=this._item._id,at.remove(1,K+t)},Re.prototype._finishSort=function(){var t=this._getGrid()._settings.dragSort&&(this._isSortNeeded||void 0!==this._sortTimer);this._cancelSort(),t&&this._checkOverlap()},Re.prototype._checkOverlap=function(){if(this._isActive){var t,e,i,s,o,a,h,l,d=this._item,_=this._getGrid()._settings;(t=vt(_.dragSortPredicate)?_.dragSortPredicate(d,this._dragMoveEvent):Re.defaultSortPredicate(d,_.dragSortPredicate))&&"number"==typeof t.index&&(h=t.action===n?n:r,l=(e=d.getGrid())!==(s=t.grid||e),i=e._items.indexOf(d),o=Vt(s._items,t.index,l&&h===r?1:0),(l||o!==this._blockedSortIndex)&&(l?(this._blockedSortIndex=null,a=s._items[o],e._hasListeners(p)&&e._emit(p,{item:d,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),s._hasListeners(v)&&s._emit(v,{item:d,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),d._gridId=s._id,this._isMigrating=d._gridId!==this._gridId,e._items.splice(i,1),jt(s._items,d,o),d._sortData=null,e._hasListeners(f)&&e._emit(f,{item:d,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),s._hasListeners(m)&&s._emit(m,{item:d,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),h===n&&a&&a.isActive()&&s._items.indexOf(a)>-1&&s.send(a,e,i,{appendTo:this._container||document.body,layoutSender:!1,layoutReceiver:!1}),e.layout(),s.layout()):i!==o&&(this._blockedSortIndex=i,(h===n?Ut:Qt)(e._items,i,o),e._hasListeners(u)&&e._emit(u,{item:d,fromIndex:i,toIndex:o,action:h}),e.layout())))}},Re.prototype._finishMigration=function(){var t,e,i=this._item,s=i._dragRelease,n=i._element,r=i._isActive,o=i.getGrid(),a=o._element,h=o._settings,l=h.dragContainer||a,d=this._getGrid()._settings,_=n.parentNode,c=r?d.itemVisibleClass:d.itemHiddenClass,u=r?h.itemVisibleClass:h.itemHiddenClass;this._isMigrating=!1,this.destroy(),d.itemClass!==h.itemClass&&(Se(n,d.itemClass),zt(n,h.itemClass)),c!==u&&(Se(n,c),zt(n,u)),l!==_&&(l.appendChild(n),e=ce(_,l,!0),(t=we(n)).x-=e.left,t.y-=e.top),i._refreshDimensions(),e=ce(l,a,!0),s._containerDiffX=e.left,s._containerDiffY=e.top,i._drag=h.dragEnabled?new Re(i):null,l!==_&&i._setTranslate(t.x,t.y),i._visibility.setStyles(r?h.visibleStyles:h.hiddenStyles),s.start()},Re.prototype._preStartCheck=function(t){this._startPredicateState===Ae&&(this._startPredicateState=1),1===this._startPredicateState?(this._startPredicateResult=this._startPredicate(this._item,t),!0===this._startPredicateResult?(this._startPredicateState=2,this._onStart(t)):!1===this._startPredicateResult&&(this._resetStartPredicate(t),this._dragger._reset(),this._startPredicateState=Ae)):2===this._startPredicateState&&this._isActive&&this._onMove(t)},Re.prototype._preEndCheck=function(t){var e=2===this._startPredicateState;this._startPredicate(this._item,t),this._startPredicateState=Ae,e&&this._isActive&&(this._isStarted?this._onEnd(t):this.stop())},Re.prototype._onStart=function(t){var e,i,s,n=this._item;n._isActive&&(this._isActive=!0,this._dragStartEvent=t,Re.autoScroller.addItem(n),e=n._id,i=this._prepareStart,s=this._applyStart,at.add(ot,V+e,i),at.add(2,Q+e,s))},Re.prototype._prepareStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid(),s=i._settings,n=i._element,r=s.dragContainer||n,o=ae(r),a=we(e),h=e.getBoundingClientRect(),l=r!==n;if(this._container=r,this._containingBlock=o,this._clientX=h.left,this._clientY=h.top,this._left=this._gridX=a.x,this._top=this._gridY=a.y,this._scrollDiffX=this._scrollDiffY=0,this._moveDiffX=this._moveDiffY=0,this._resetHeuristics(this._gridX,this._gridY),l){var d=ce(o,n);this._containerDiffX=d.left,this._containerDiffY=d.top}}}},Re.prototype._applyStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=this._getGrid(),i=t._element,s=t._dragRelease,n=t._migrate,r=this._container!==e._element;t.isPositioning()&&t._layout.stop(!0,this._left,this._top),n._isActive&&(this._left-=n._containerDiffX,this._top-=n._containerDiffY,this._gridX-=n._containerDiffX,this._gridY-=n._containerDiffY,n.stop(!0,this._left,this._top)),t.isReleasing()&&s._reset(),e._settings.dragPlaceholder.enabled&&t._dragPlaceholder.create(),this._isStarted=!0,e._emit("dragInit",t,this._dragStartEvent),r&&(i.parentNode===this._container?(this._gridX-=this._containerDiffX,this._gridY-=this._containerDiffY):(this._left+=this._containerDiffX,this._top+=this._containerDiffY,this._container.appendChild(i),t._setTranslate(this._left,this._top))),zt(i,e._settings.itemDraggingClass),this._bindScrollListeners(),e._emit("dragStart",t,this._dragStartEvent)}}},Re.prototype._onMove=function(t){var e,i,s,n=this._item;n._isActive?(this._dragMoveEvent=t,e=n._id,i=this._prepareMove,s=this._applyMove,at.add(ot,U+e,i),at.add(2,Z+e,s),ut(n._id,this._handleSort)):this.stop()},Re.prototype._prepareMove=function(){if(this._isActive&&this._item._isActive){var t=this._getGrid()._settings.dragAxis,e=this._dragMoveEvent,i=this._dragPrevMoveEvent||this._dragStartEvent||e;if("y"!==t){var s=e.clientX-i.clientX;this._left=this._left-this._moveDiffX+s,this._gridX=this._gridX-this._moveDiffX+s,this._clientX=this._clientX-this._moveDiffX+s,this._moveDiffX=s}if("x"!==t){var n=e.clientY-i.clientY;this._top=this._top-this._moveDiffY+n,this._gridY=this._gridY-this._moveDiffY+n,this._clientY=this._clientY-this._moveDiffY+n,this._moveDiffY=n}this._dragPrevMoveEvent=e}},Re.prototype._applyMove=function(){if(this._isActive){var t=this._item;t._isActive&&(this._moveDiffX=this._moveDiffY=0,t._setTranslate(this._left,this._top),this._getGrid()._emit("dragMove",t,this._dragMoveEvent),Re.autoScroller.updateItem(t))}},Re.prototype._onScroll=function(t){var e,i,s,n=this._item;n._isActive?(this._scrollEvent=t,e=n._id,i=this._prepareScroll,s=this._applyScroll,at.add(ot,J+e,i),at.add(2,$+e,s),ut(n._id,this._handleSort)):this.stop()},Re.prototype._prepareScroll=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid()._element,s=e.getBoundingClientRect();if(this._container!==i){var n=ce(this._containingBlock,i);this._containerDiffX=n.left,this._containerDiffY=n.top}var r=this._clientX-this._moveDiffX-s.left;this._left=this._left-this._scrollDiffX+r,this._scrollDiffX=r;var o=this._clientY-this._moveDiffY-s.top;this._top=this._top-this._scrollDiffY+o,this._scrollDiffY=o,this._gridX=this._left-this._containerDiffX,this._gridY=this._top-this._containerDiffY}}},Re.prototype._applyScroll=function(){if(this._isActive){var t=this._item;t._isActive&&(this._scrollDiffX=this._scrollDiffY=0,t._setTranslate(this._left,this._top),this._getGrid()._emit("dragScroll",t,this._scrollEvent))}},Re.prototype._onEnd=function(t){var e=this._item,i=e._element,s=this._getGrid(),n=s._settings,r=e._dragRelease;e._isActive?(dt(e._id),_t(e._id),ct(e._id),this._finishSort(),this._unbindScrollListeners(),r._containerDiffX=this._containerDiffX,r._containerDiffY=this._containerDiffY,this._reset(),Se(i,n.itemDraggingClass),Re.autoScroller.removeItem(e),s._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():r.start()):this.stop()};var Ie=/^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/,Pe={};function Me(t){var e=Pe[t];return e||((e=t.replace(Ie,""))!==t&&(e=e[0].toLowerCase()+e.slice(1)),Pe[t]=e,e)}function Ye(t,e){for(var i in e)t.style[i]=e[i]}var Xe,Oe,qe=!(!Element||!vt(Element.prototype.animate)),He=!!(Element&&(Xe=Element.prototype.animate,Oe=window.Symbol,Xe&&vt(Oe)&&vt(Oe.toString)&&Oe(Xe).toString().indexOf("[native code]")>-1));function Ge(t){this._element=t,this._animation=null,this._duration=0,this._easing="",this._callback=null,this._props=[],this._values=[],this._isDestroyed=!1,this._onFinish=this._onFinish.bind(this)}function Ne(t,e){var i={};for(var s in t)i[e?s:Me(s)]=t[s];return i}function Be(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function We(t){this._item=t,this._animation=new Ge,this._element=null,this._className="",this._didMigrate=!1,this._resetAfterLayout=!1,this._left=0,this._top=0,this._transX=0,this._transY=0,this._nextTransX=0,this._nextTransY=0,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this),this._updateDimensions=this._updateDimensions.bind(this),this._onLayoutStart=this._onLayoutStart.bind(this),this._onLayoutEnd=this._onLayoutEnd.bind(this),this._onReleaseEnd=this._onReleaseEnd.bind(this),this._onMigrate=this._onMigrate.bind(this),this._onHide=this._onHide.bind(this)}function ze(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0}Ge.prototype.start=function(t,e,i){if(!this._isDestroyed){var s=this._element,n=i||{};if(!qe)return Ye(s,e),this._callback=vt(n.onFinish)?n.onFinish:null,void this._onFinish();var r,o,a,h=this._animation,l=this._props,d=this._values,_=n.duration||300,c=n.easing||"ease",u=!1;if(h&&(o=0,_===this._duration&&c===this._easing||(u=!0),!u)){for(r in e)if(++o,-1===(a=l.indexOf(r))||e[r]!==d[a]){u=!0;break}o!==l.length&&(u=!0)}if(u&&h.cancel(),this._callback=vt(n.onFinish)?n.onFinish:null,!h||u){for(r in l.length=d.length=0,e)l.push(r),d.push(e[r]);this._duration=_,this._easing=c,this._animation=s.animate([Ne(t,He),Ne(e,He)],{duration:_,easing:c}),this._animation.onfinish=this._onFinish,Ye(s,e)}}},Ge.prototype.stop=function(){!this._isDestroyed&&this._animation&&(this._animation.cancel(),this._animation=this._callback=null,this._props.length=this._values.length=0)},Ge.prototype.getCurrentStyles=function(){return Ce(element,currentProps)},Ge.prototype.isAnimating=function(){return!!this._animation},Ge.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._element=null,this._isDestroyed=!0)},Ge.prototype._onFinish=function(){var t=this._callback;this._animation=this._callback=null,this._props.length=this._values.length=0,t&&t()},We.prototype._updateDimensions=function(){this.isActive()&&Ye(this._element,{width:this._item._width+"px",height:this._item._height+"px"})},We.prototype._onLayoutStart=function(t,e){var i=this._item;if(-1!==t.indexOf(i)){var s=i._left,n=i._top,r=this._left,o=this._top;if(this._left=s,this._top=n,e||this._didMigrate||r!==s||o!==n){var a,h,l,d=s+i._marginLeft,_=n+i._marginTop,c=i.getGrid();if(!(!e&&c._settings.layoutDuration>0)||this._didMigrate)return ft(i._id),this._element.style[Zt]=Be(d,_),this._animation.stop(),void(this._didMigrate&&(c.getElement().appendChild(this._element),this._didMigrate=!1));this._nextTransX=d,this._nextTransY=_,a=i._id,h=this._setupAnimation,l=this._startAnimation,at.add(ot,tt+a,h),at.add(2,et+a,l)}}else this.reset()},We.prototype._setupAnimation=function(){if(this.isActive()){var t=we(this._element);this._transX=t.x,this._transY=t.y}},We.prototype._startAnimation=function(){if(this.isActive()){var t=this._animation,e=this._transX,i=this._transY,s=this._nextTransX,n=this._nextTransY;if(e!==s||i!==n){var r=this._item.getGrid()._settings,o={},a={};o[Zt]=Be(e,i),a[Zt]=Be(s,n),t.start(o,a,{duration:r.layoutDuration,easing:r.layoutEasing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&(this._element.style[Zt]=Be(s,n),t.stop())}},We.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},We.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animation.isAnimating())return void this.reset();this._resetAfterLayout=!0}},We.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off(g,this._onReleaseEnd),e.off(o,this._onLayoutStart),e.off(p,this._onMigrate),e.off(d,this._onHide),i.on(g,this._onReleaseEnd),i.on(o,this._onLayoutStart),i.on(p,this._onMigrate),i.on(d,this._onHide),this._didMigrate=!0}},We.prototype._onHide=function(t){t.indexOf(this._item)>-1&&this.reset()},We.prototype.create=function(){if(this.isActive())this._resetAfterLayout=!1;else{var t,e=this._item,i=e.getGrid(),s=i._settings,n=this._animation;this._left=e._left,this._top=e._top,t=vt(s.dragPlaceholder.createElement)?s.dragPlaceholder.createElement(e):document.createElement("div"),this._element=t,n._element=t,this._className=s.itemPlaceholderClass||"",this._className&&zt(t,this._className),Ye(t,{position:"absolute",left:"0px",top:"0px",width:e._width+"px",height:e._height+"px"}),t.style[Zt]=Be(e._left+e._marginLeft,e._top+e._marginTop),i.on(o,this._onLayoutStart),i.on(g,this._onReleaseEnd),i.on(p,this._onMigrate),i.on(d,this._onHide),vt(s.dragPlaceholder.onCreate)&&s.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},We.prototype.reset=function(){if(this.isActive()){var t,e=this._element,i=this._item,s=i.getGrid(),n=s._settings,r=this._animation;this._resetAfterLayout=!1,ft(i._id),t=i._id,at.remove(2,it+t),r.stop(),r._element=null,s.off(g,this._onReleaseEnd),s.off(o,this._onLayoutStart),s.off(p,this._onMigrate),s.off(d,this._onHide),this._className&&(Se(e,this._className),this._className=""),e.parentNode.removeChild(e),this._element=null,vt(n.dragPlaceholder.onRemove)&&n.dragPlaceholder.onRemove(i,e)}},We.prototype.isActive=function(){return!!this._element},We.prototype.getElement=function(){return this._element},We.prototype.updateDimensions=function(){var t,e;this.isActive()&&(t=this._item._id,e=this._updateDimensions,at.add(2,it+t,e))},We.prototype.destroy=function(){this.reset(),this._animation.destroy(),this._item=this._animation=null},ze.prototype.start=function(){if(!this._isDestroyed&&!this._isActive){var t=this._item,e=t.getGrid(),i=e._settings;this._isActive=!0,zt(t._element,i.itemReleasingClass),i.dragRelease.useDragContainer||this._placeToGrid(),e._emit("dragReleaseStart",t),e._nextLayoutData||t._layout.start(!1)}},ze.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item,n=s.getGrid();t||void 0!==e&&void 0!==i||(e=s._left,i=s._top);var r=this._placeToGrid(e,i);this._reset(r),t||n._emit(g,s)}},ze.prototype.isJustReleased=function(){return this._isActive&&!1===this._isPositioningStarted},ze.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},ze.prototype._placeToGrid=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=i.getGrid()._element,r=!1;if(s.parentNode!==n){if(void 0===t||void 0===e){var o=we(s);t=o.x-this._containerDiffX,e=o.y-this._containerDiffY}n.appendChild(s),i._setTranslate(t,e),r=!0}return this._containerDiffX=0,this._containerDiffY=0,r}},ze.prototype._reset=function(t){if(!this._isDestroyed){var e=this._item,i=e.getGrid()._settings.itemReleasingClass;this._isActive=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0,i&&(t&&e._element.clientWidth,Se(e._element,i))}};function Fe(t){var e=t._element,i=e.style;this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isInterrupted=!1,this._currentStyles={},this._targetStyles={},this._nextLeft=0,this._nextTop=0,this._offsetLeft=0,this._offsetTop=0,this._skipNextAnimation=!1,this._animOptions={onFinish:this._finish.bind(this),duration:0,easing:0},i.left="0px",i.top="0px",t._setTranslate(0,0),this._animation=new Ge(e),this._queue="layout-"+t._id,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this)}function je(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}function Ve(t){var e=t._isActive,i=t._element,s=i.children[0],n=t.getGrid()._settings;if(!s)throw new Error("No valid child element found within item element.");this._item=t,this._isDestroyed=!1,this._isHidden=!e,this._isHiding=!1,this._isShowing=!1,this._childElement=s,this._currentStyleProps=[],this._animation=new Ge(s),this._queue="visibility-"+t._id,this._finishShow=this._finishShow.bind(this),this._finishHide=this._finishHide.bind(this),i.style.display=e?"":"none",zt(i,e?n.itemVisibleClass:n.itemHiddenClass),this.setStyles(e?n.visibleStyles:n.hiddenStyles)}Fe.prototype.start=function(t,e){if(!this._isDestroyed){var i,s,n,r=this._item,o=r._dragRelease,a=r.getGrid()._settings,h=this._isActive,l=o.isJustReleased(),d=l?a.dragRelease.duration:a.layoutDuration,_=l?a.dragRelease.easing:a.layoutEasing,c=!t&&!this._skipNextAnimation&&d>0;if(h&&(ht(r._id),r._emitter.burst(this._queue,!0,r)),l&&(o._isPositioningStarted=!0),vt(e)&&r._emitter.on(this._queue,e),this._skipNextAnimation=!1,!c)return this._updateOffsets(),r._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._animation.isAnimating()&&(this._animation._animation.onfinish=null),this._isActive=!0,this._animOptions.easing=_,this._animOptions.duration=d,this._isInterrupted=h,i=r._id,s=this._setupAnimation,n=this._startAnimation,at.add(ot,W+i,s),at.add(2,z+i,n)}},Fe.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item;if(ht(s._id),this._animation.isAnimating()){if(void 0===e||void 0===i){var n=we(s._element);e=n.x,i=n.y}s._setTranslate(e,i),this._animation.stop()}Se(s._element,s.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&s._emitter.burst(this._queue,!0,s)}},Fe.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item._element.style;this.stop(!0,0,0),this._item._emitter.clear(this._queue),this._animation.destroy(),t[Zt]="",t.left="",t.top="",this._item=null,this._currentStyles=null,this._targetStyles=null,this._animOptions=null,this._isDestroyed=!0}},Fe.prototype._updateOffsets=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;this._offsetLeft=i._isActive?i._containerDiffX:e._isActive?e._containerDiffX:0,this._offsetTop=i._isActive?i._containerDiffY:e._isActive?e._containerDiffY:0,this._nextLeft=this._item._left+this._offsetLeft,this._nextTop=this._item._top+this._offsetTop}},Fe.prototype._finish=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;t._tX=this._nextLeft,t._tY=this._nextTop,this._isActive&&(this._isActive=!1,Se(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),t._emitter.burst(this._queue,!1,t)}},Fe.prototype._setupAnimation=function(){var t=this._item;if(void 0===t._tX||void 0===t._tY){var e=we(t._element);t._tX=e.x,t._tY=e.y}},Fe.prototype._startAnimation=function(){var t=this._item,e=t.getGrid()._settings,i=this._animOptions.duration<=0;this._updateOffsets();var s=Math.abs(t._left-(t._tX-this._offsetLeft)),n=Math.abs(t._top-(t._tY-this._offsetTop));if(i||s<2&&n<2)return(s||n||this._isInterrupted)&&t._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._isInterrupted||zt(t._element,e.itemPositioningClass),this._currentStyles[Zt]=Be(t._tX,t._tY),this._targetStyles[Zt]=Be(this._nextLeft,this._nextTop),t._tX=t._tY=void 0,this._animation.start(this._currentStyles,this._targetStyles,this._animOptions)},je.prototype.start=function(t,e,i){if(!this._isDestroyed){var s,n,r,o,a,h,l,d,_,c,u=this._item,g=u._element,y=u.isActive(),b=u.isVisible(),w=u.getGrid(),S=w._settings,D=t._settings,k=t._element,x=t._items,E=w._items.indexOf(u),L=i||document.body;if("number"==typeof e)s=Vt(x,e,1);else{if(!(n=t.getItem(e)))return;s=x.indexOf(n)}(u.isPositioning()||this._isActive||u.isReleasing())&&(l=(h=we(g)).x,d=h.y),u.isPositioning()&&u._layout.stop(!0,l,d),this._isActive&&(l-=this._containerDiffX,d-=this._containerDiffY,this.stop(!0,l,d)),u.isReleasing()&&(l-=u._dragRelease._containerDiffX,d-=u._dragRelease._containerDiffY,u._dragRelease.stop(!0,l,d)),u._visibility.stop(!0),u._drag&&u._drag.destroy(),w._hasListeners(p)&&w._emit(p,{item:u,fromGrid:w,fromIndex:E,toGrid:t,toIndex:s}),t._hasListeners(v)&&t._emit(v,{item:u,fromGrid:w,fromIndex:E,toGrid:t,toIndex:s}),S.itemClass!==D.itemClass&&(Se(g,S.itemClass),zt(g,D.itemClass)),(_=b?S.itemVisibleClass:S.itemHiddenClass)!==(c=b?D.itemVisibleClass:D.itemHiddenClass)&&(Se(g,_),zt(g,c)),w._items.splice(E,1),jt(x,u,s),u._gridId=t._id,y?L!==(r=g.parentNode)&&(L.appendChild(g),o=ce(L,r,!0),h||(l=(h=we(g)).x,d=h.y),u._setTranslate(l+o.left,d+o.top)):k.appendChild(g),u._visibility.setStyles(b?D.visibleStyles:D.hiddenStyles),y&&(a=ce(L,k,!0)),u._refreshDimensions(),u._sortData=null,u._drag=D.dragEnabled?new Re(u):null,y?(this._isActive=!0,this._container=L,this._containerDiffX=a.left,this._containerDiffY=a.top):(this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0),w._hasListeners(f)&&w._emit(f,{item:u,fromGrid:w,fromIndex:E,toGrid:t,toIndex:s}),t._hasListeners(m)&&t._emit(m,{item:u,fromGrid:w,fromIndex:E,toGrid:t,toIndex:s})}},je.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s,n=this._item,r=n._element,o=n.getGrid()._element;this._container!==o&&(void 0!==e&&void 0!==i||(t?(e=(s=we(r)).x-this._containerDiffX,i=s.y-this._containerDiffY):(e=n._left,i=n._top)),o.appendChild(r),n._setTranslate(e,i)),this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0}},je.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Ve.prototype.show=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=vt(e)?e:null,r=i.getGrid()._settings;this._isShowing||this._isHidden?!this._isShowing||t?(this._isShowing||(i._emitter.burst(this._queue,!0,i),Se(s,r.itemHiddenClass),zt(s,r.itemVisibleClass),this._isHiding||(s.style.display="")),n&&i._emitter.on(this._queue,n),this._isShowing=!0,this._isHiding=this._isHidden=!1,this._startAnimation(!0,t,this._finishShow)):n&&i._emitter.on(this._queue,n):n&&n(!1,i)}},Ve.prototype.hide=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=vt(e)?e:null,r=i.getGrid()._settings;this._isHiding||!this._isHidden?!this._isHiding||t?(this._isHiding||(i._emitter.burst(this._queue,!0,i),zt(s,r.itemHiddenClass),Se(s,r.itemVisibleClass)),n&&i._emitter.on(this._queue,n),this._isHidden=this._isHiding=!0,this._isShowing=!1,this._startAnimation(!1,t,this._finishHide)):n&&i._emitter.on(this._queue,n):n&&n(!1,i)}},Ve.prototype.stop=function(t){if(!this._isDestroyed&&(this._isHiding||this._isShowing)){var e=this._item;lt(e._id),this._animation.stop(),t&&e._emitter.burst(this._queue,!0,e)}},Ve.prototype.setStyles=function(t){var e=this._childElement,i=this._currentStyleProps;for(var s in this._removeCurrentStyles(),t)i.push(s),e.style[s]=t[s]},Ve.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item,e=t._element,i=t.getGrid()._settings;this.stop(!0),t._emitter.clear(this._queue),this._animation.destroy(),this._removeCurrentStyles(),Se(e,i.itemVisibleClass),Se(e,i.itemHiddenClass),e.style.display="",this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0}},Ve.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var s,n=this._item,r=this._animation,o=this._childElement,a=n.getGrid()._settings,h=t?a.visibleStyles:a.hiddenStyles,l=t?a.showDuration:a.hideDuration,d=t?a.showEasing:a.hideEasing,_=e||l<=0;if(h){if(lt(n._id),_)return Ye(o,h),r.stop(),void(i&&i());var c,u,f;r.isAnimating()&&(r._animation.onfinish=null),c=n._id,u=function(){s=Ce(o,h)},f=function(){r.start(s,h,{duration:l,easing:d,onFinish:i})},at.add(ot,F+c,u),at.add(2,j+c,f)}else i&&i()}},Ve.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._item._emitter.burst(this._queue,!1,this._item))},Ve.prototype._finishHide=function(){if(this._isHidden){var t=this._item;this._isHiding=!1,t._layout.stop(!0,0,0),t._element.style.display="none",t._emitter.burst(this._queue,!1,t)}},Ve.prototype._removeCurrentStyles=function(){for(var t=this._childElement,e=this._currentStyleProps,i=0;i<e.length;i++)t.style[e[i]]="";e.length=0};var Qe=0;function Ue(){return++Qe}function Ze(t,e,i){var n=t._settings;if(s){if(s.has(e))throw new Error("You can only create one Muuri Item per element!");s.set(e,this)}this._id=Ue(),this._gridId=t._id,this._element=e,this._isDestroyed=!1,this._left=0,this._top=0,this._width=0,this._height=0,this._marginLeft=0,this._marginRight=0,this._marginTop=0,this._marginBottom=0,this._tX=void 0,this._tY=void 0,this._sortData=null,this._emitter=new S,e.parentNode!==t._element&&t._element.appendChild(e),zt(e,n.itemClass),"boolean"!=typeof i&&(i="none"!==yt(e,"display")),this._isActive=i,this._visibility=new Ve(this),this._layout=new Fe(this),this._migrate=new je(this),this._drag=n.dragEnabled?new Re(this):null,this._dragRelease=new ze(this),this._dragPlaceholder=new We(this)}function Je(t){var e,i,s,n,r,o=.001,a=.5;function h(t){return((1e3*t+.5|0)/10|0)/100}function l(){this.currentRects=[],this.nextRects=[],this.rectTarget={},this.rectStore=[],this.slotSizes=[],this.rectId=0,this.slotIndex=-1,this.slotData={left:0,top:0,width:0,height:0},this.sortRectsLeftTop=this.sortRectsLeftTop.bind(this),this.sortRectsTopLeft=this.sortRectsTopLeft.bind(this)}if(l.prototype.computeLayout=function(t,e){var i,s,n,r,o,a,l=t.items,d=t.slots,_=!!(1&e),c=!!(2&e),u=!!(4&e),f=!!(8&e),p=!!(16&e),m="number"==typeof l[0];if(!l.length)return t;for(s=m?2:1,i=0;i<l.length;i+=s)m?(r=l[i],o=l[i+1]):(r=(n=l[i])._width+n._marginLeft+n._marginRight,o=n._height+n._marginTop+n._marginBottom),p&&(r=h(r),o=h(o)),a=this.computeNextSlot(t,r,o,_,c),c?a.left+a.width>t.width&&(t.width=a.left+a.width):a.top+a.height>t.height&&(t.height=a.top+a.height),d[++this.slotIndex]=a.left,d[++this.slotIndex]=a.top,(u||f)&&this.slotSizes.push(a.width,a.height);if(u)for(i=0;i<d.length;i+=2)d[i]=t.width-(d[i]+this.slotSizes[i]);if(f)for(i=1;i<d.length;i+=2)d[i]=t.height-(d[i]+this.slotSizes[i]);return this.slotSizes.length=0,this.currentRects.length=0,this.nextRects.length=0,this.rectStore.length=0,this.rectId=0,this.slotIndex=-1,t},l.prototype.computeNextSlot=function(t,e,i,s,n){var r,h,l,d,_,c=this.slotData,u=this.currentRects,f=this.nextRects,p=!1;for(f.length=0,c.left=null,c.top=null,c.width=e,c.height=i,d=0;d<u.length;d++)if((h=u[d])&&(r=this.getRect(h),c.width<=r.width+o&&c.height<=r.height+o)){c.left=r.left,c.top=r.top;break}if(null===c.left&&(n?(c.left=t.width,c.top=0):(c.left=0,c.top=t.height),s||(p=!0)),!n&&c.top+c.height>t.height+o&&(c.left>a&&f.push(this.addRect(0,t.height,c.left,1/0)),c.left+c.width<t.width-a&&f.push(this.addRect(c.left+c.width,t.height,t.width-c.left-c.width,1/0)),t.height=c.top+c.height),n&&c.left+c.width>t.width+o&&(c.top>a&&f.push(this.addRect(t.width,0,1/0,c.top)),c.top+c.height<t.height-a&&f.push(this.addRect(t.width,c.top+c.height,1/0,t.height-c.top-c.height)),t.width=c.left+c.width),!p)for(s&&(d=0);d<u.length;d++)if(h=u[d])for(r=this.getRect(h),l=this.splitRect(r,c),_=0;_<l.length;_++)h=l[_],r=this.getRect(h),(n?r.left+o<t.width-o:r.top+o<t.height-o)&&f.push(h);return f.length>1&&this.purgeRects(f).sort(n?this.sortRectsLeftTop:this.sortRectsTopLeft),this.currentRects=f,this.nextRects=u,c},l.prototype.addRect=function(t,e,i,s){var n=++this.rectId;return this.rectStore[n]=t||0,this.rectStore[++this.rectId]=e||0,this.rectStore[++this.rectId]=i||0,this.rectStore[++this.rectId]=s||0,n},l.prototype.getRect=function(t,e){return e||(e=this.rectTarget),e.left=this.rectStore[t]||0,e.top=this.rectStore[++t]||0,e.width=this.rectStore[++t]||0,e.height=this.rectStore[++t]||0,e},l.prototype.splitRect=(e=[],i=0,s=0,function(t,n){return e.length=0,t.left+t.width<=n.left+o||n.left+n.width<=t.left+o||t.top+t.height<=n.top+o||n.top+n.height<=t.top+o?(e.push(this.addRect(t.left,t.top,t.width,t.height)),e):((i=n.left-t.left)>=a&&e.push(this.addRect(t.left,t.top,i,t.height)),(i=t.left+t.width-(n.left+n.width))>=a&&e.push(this.addRect(n.left+n.width,t.top,i,t.height)),(s=n.top-t.top)>=a&&e.push(this.addRect(t.left,t.top,t.width,s)),(s=t.top+t.height-(n.top+n.height))>=a&&e.push(this.addRect(t.left,n.top+n.height,t.width,s)),e)}),l.prototype.isRectAWithinRectB=function(t,e){return t.left+o>=e.left&&t.top+o>=e.top&&t.left+t.width-o<=e.left+e.width&&t.top+t.height-o<=e.top+e.height},l.prototype.purgeRects=(n={},r={},function(t){for(var e,i=t.length;i--;)if(e=t.length,t[i])for(this.getRect(t[i],n);e--;)if(t[e]&&i!==e&&(this.getRect(t[e],r),this.isRectAWithinRectB(n,r))){t[i]=0;break}return t}),l.prototype.sortRectsTopLeft=function(){var t={},e={};return function(i,s){return this.getRect(i,t),this.getRect(s,e),t.top<e.top&&t.top+o<e.top?-1:t.top>e.top&&t.top-o>e.top?1:t.left<e.left&&t.left+o<e.left?-1:t.left>e.left&&t.left-o>e.left?1:0}}(),l.prototype.sortRectsLeftTop=function(){var t={},e={};return function(i,s){return this.getRect(i,t),this.getRect(s,e),t.left<e.left&&t.left+o<e.left?-1:t.left>e.left&&t.left-o<e.left?1:t.top<e.top&&t.top+o<e.top?-1:t.top>e.top&&t.top-o>e.top?1:0}}(),t){var d=new l;self.onmessage=function(t){var e=new Float32Array(t.data),i=e.subarray(4,e.length),s=new Float32Array(i.length),n=e[3],r={items:i,slots:s,width:e[1],height:e[2]};d.computeLayout(r,n),e[1]=r.width,e[2]=r.height,e.set(r.slots,4),postMessage(e.buffer,[e.buffer])}}return l}Ze.prototype.getGrid=function(){return i[this._gridId]},Ze.prototype.getElement=function(){return this._element},Ze.prototype.getWidth=function(){return this._width},Ze.prototype.getHeight=function(){return this._height},Ze.prototype.getMargin=function(){return{left:this._marginLeft,right:this._marginRight,top:this._marginTop,bottom:this._marginBottom}},Ze.prototype.getPosition=function(){return{left:this._left,top:this._top}},Ze.prototype.isActive=function(){return this._isActive},Ze.prototype.isVisible=function(){return!!this._visibility&&!this._visibility._isHidden},Ze.prototype.isShowing=function(){return!(!this._visibility||!this._visibility._isShowing)},Ze.prototype.isHiding=function(){return!(!this._visibility||!this._visibility._isHiding)},Ze.prototype.isPositioning=function(){return!(!this._layout||!this._layout._isActive)},Ze.prototype.isDragging=function(){return!(!this._drag||!this._drag._isActive)},Ze.prototype.isReleasing=function(){return!(!this._dragRelease||!this._dragRelease._isActive)},Ze.prototype.isDestroyed=function(){return this._isDestroyed},Ze.prototype._refreshDimensions=function(t){if(!(this._isDestroyed||!0!==t&&this._visibility._isHidden)){var e=this._element,i=this._dragPlaceholder,s=e.getBoundingClientRect();this._width=s.width,this._height=s.height,this._marginLeft=Math.max(0,bt(e,"margin-left")),this._marginRight=Math.max(0,bt(e,"margin-right")),this._marginTop=Math.max(0,bt(e,"margin-top")),this._marginBottom=Math.max(0,bt(e,"margin-bottom")),i&&i.updateDimensions()}},Ze.prototype._refreshSortData=function(){if(!this._isDestroyed){var t,e=this._sortData={},i=this.getGrid()._settings.sortData;for(t in i)e[t]=i[t](this,this._element)}},Ze.prototype._addToLayout=function(t,e){!0!==this._isActive&&(this._isActive=!0,this._left=t||0,this._top=e||0)},Ze.prototype._removeFromLayout=function(){!1!==this._isActive&&(this._isActive=!1,this._left=0,this._top=0)},Ze.prototype._canSkipLayout=function(t,e){return this._left===t&&this._top===e&&!this._migrate._isActive&&!this._layout._skipNextAnimation&&!this._dragRelease.isJustReleased()},Ze.prototype._setTranslate=function(t,e){return(this._tX!==t||this._tY!==e)&&(this._tX=t,this._tY=e,this._element.style[Zt]=Be(t,e),!0)},Ze.prototype._destroy=function(t){if(!this._isDestroyed){var e=this._element,i=this.getGrid()._settings;this._dragPlaceholder.destroy(),this._dragRelease.destroy(),this._migrate.destroy(),this._layout.destroy(),this._visibility.destroy(),this._drag&&this._drag.destroy(),this._emitter.destroy(),Se(e,i.itemClass),t&&e.parentNode.removeChild(e),s&&s.delete(e),this._isActive=!1,this._isDestroyed=!0}};var $e=Je(),Ke=null,ti=[];function ei(t,e){if(this._options=0,this._processor=null,this._layoutQueue=[],this._layouts={},this._layoutCallbacks={},this._layoutWorkers={},this._layoutWorkerData={},this._workers=[],this._onWorkerMessage=this._onWorkerMessage.bind(this),this.setOptions(e),(t="number"==typeof t?Math.max(0,t):0)&&window.Worker&&window.URL&&window.Blob)try{this._workers=function(t,e){var i=[];if(t>0){Ke||(Ke=URL.createObjectURL(new Blob(["("+Je.toString()+")(true)"],{type:"application/javascript"})));for(var s,n=0;n<t;n++)s=new Worker(Ke),e&&(s.onmessage=e),i.push(s),ti.push(s)}return i}(t,this._onWorkerMessage)}catch(t){this._processor=new $e}else this._processor=new $e}ei.prototype._sendToWorker=function(){if(this._layoutQueue.length&&this._workers.length){var t=this._layoutQueue.shift(),e=this._workers.pop(),i=this._layoutWorkerData[t];delete this._layoutWorkerData[t],this._layoutWorkers[t]=e,e.postMessage(i.buffer,[i.buffer])}},ei.prototype._onWorkerMessage=function(t){var e=new Float32Array(t.data),i=e[0],s=this._layouts[i],n=this._layoutCallbacks[i],r=this._layoutWorkers[i];s&&delete this._layouts[i],n&&delete this._layoutCallbacks[i],r&&delete this._layoutWorkers[i],s&&n&&(s.width=e[1],s.height=e[2],s.slots=e.subarray(4,e.length),this._finalizeLayout(s),n(s)),r&&(this._workers.push(r),this._sendToWorker())},ei.prototype._finalizeLayout=function(t){var e=t._grid,i=2&t._settings,s="border-box"===e._boxSizing;return delete t._grid,delete t._settings,t.styles={},i?t.styles.width=(s?t.width+e._borderLeft+e._borderRight:t.width)+"px":t.styles.height=(s?t.height+e._borderTop+e._borderBottom:t.height)+"px",t},ei.prototype.setOptions=function(t){var e,i,s,n,r;t&&(e="boolean"==typeof t.fillGaps?t.fillGaps?1:0:1&this._options,i="boolean"==typeof t.horizontal?t.horizontal?2:0:2&this._options,s="boolean"==typeof t.alignRight?t.alignRight?4:0:4&this._options,n="boolean"==typeof t.alignBottom?t.alignBottom?8:0:8&this._options,r="boolean"==typeof t.rounding?t.rounding?16:0:16&this._options,this._options=e|i|s|n|r)},ei.prototype.createLayout=function(t,e,i,s,n,r){if(this._layouts[e])throw new Error("A layout with the provided id is currently being processed.");var o=2&this._options,a={id:e,items:i,slots:null,width:o?0:s,height:o?n:0,_grid:t,_settings:this._options};if(!i.length)return a.slots=[],this._finalizeLayout(a),void r(a);if(this._processor)return a.slots=window.Float32Array?new Float32Array(2*i.length):new Array(2*i.length),this._processor.computeLayout(a,a._settings),this._finalizeLayout(a),void r(a);var h,l,d,_=new Float32Array(4+2*i.length);for(_[0]=e,_[1]=a.width,_[2]=a.height,_[3]=a._settings,h=0,l=3;h<i.length;h++)d=i[h],_[++l]=d._width+d._marginLeft+d._marginRight,_[++l]=d._height+d._marginTop+d._marginBottom;return this._layoutQueue.push(e),this._layouts[e]=a,this._layoutCallbacks[e]=r,this._layoutWorkerData[e]=_,this._sendToWorker(),this.cancelLayout.bind(this,e)},ei.prototype.cancelLayout=function(t){if(this._layouts[t]&&(delete this._layouts[t],delete this._layoutCallbacks[t],this._layoutWorkerData[t])){delete this._layoutWorkerData[t];var e=this._layoutQueue.indexOf(t);e>-1&&this._layoutQueue.splice(e,1)}},ei.prototype.destroy=function(){for(var t in this._layoutWorkers)this._workers.push(this._layoutWorkers[t]);!function(t){for(var e,i,s=0;s<t.length;s++)(e=t[s]).onmessage=null,e.onerror=null,e.onmessageerror=null,e.terminate(),(i=ti.indexOf(e))>-1&&ti.splice(i,1);Ke&&!ti.length&&(URL.revokeObjectURL(Ke),Ke=null)}(this._workers),this._workers.length=0,this._layoutQueue.length=0,this._layouts={},this._layoutCallbacks={},this._layoutWorkers={},this._layoutWorkerData={}};var ii=0;function si(t,e){var i=++ii,s=0,n=0,r=!1,o=function(e){r||(n&&(s-=e-n),n=e,s>0?function(t,e){at.add(ot,rt+t,e)}(i,o):(s=n=0,t()))};return function(a){if(!r){if(!(e<=0))return!0===a?(r=!0,s=n=0,o=void 0,void function(t){at.remove(ot,rt+t)}(i)):void(s<=0?(s=e,o(0)):s=e);!0!==a&&t()}}}var ni="[object HTMLCollection]",ri="[object NodeList]";function oi(t){var e=Object.prototype.toString.call(t);return e===ni||e===ri}var ai="object",hi="[object Object]",li=Object.prototype.toString;function di(t){return typeof t===ai&&li.call(t)===hi}function _i(){}var ci,ui="number",fi="string",pi="instant",mi=0;function vi(t,e){if(typeof t===fi&&(t=document.querySelector(t)),!(t.getRootNode?t.getRootNode({composed:!0})===document:document.body.contains(t))||t===document.documentElement)throw new Error("Container element must be an existing DOM element.");var s=function(t,e){var i=gi({},t);e&&(i=gi(i,e));e&&e.visibleStyles?i.visibleStyles=e.visibleStyles:t&&t.visibleStyles&&(i.visibleStyles=t.visibleStyles);e&&e.hiddenStyles?i.hiddenStyles=e.hiddenStyles:t&&t.hiddenStyles&&(i.hiddenStyles=t.hiddenStyles);return i}(vi.defaultOptions,e);s.visibleStyles=yi(s.visibleStyles),s.hiddenStyles=yi(s.hiddenStyles),vt(s.dragSort)||(s.dragSort=!!s.dragSort),this._id=Ue(),this._element=t,this._settings=s,this._isDestroyed=!1,this._items=[],this._layout={id:0,items:[],slots:[]},this._isLayoutFinished=!0,this._nextLayoutData=null,this._emitter=new S,this._onLayoutDataReceived=this._onLayoutDataReceived.bind(this),i[this._id]=this,zt(t,s.containerClass),function(t,e){typeof e!==ui&&(e=!0===e?0:-1);e>=0&&(t._resizeHandler=si((function(){t.refreshItems().layout()}),e),window.addEventListener("resize",t._resizeHandler))}(this,s.layoutOnResize),this.add(function(t,e){if("*"===e)return t.children;if(typeof e===fi){for(var i=[],s=t.children,n=0;n<s.length;n++)Wt(s[n],e)&&i.push(s[n]);return i}if(Array.isArray(e)||oi(e))return e;return[]}(t,s.items),{layout:!1}),s.layoutOnInit&&this.layout(!0)}function gi(t,e){var i,s,n,r=Object.keys(e),o=r.length;for(n=0;n<o;n++)i=di(e[s=r[n]]),di(t[s])&&i?t[s]=gi(gi({},t[s]),e[s]):i?t[s]=gi({},e[s]):Array.isArray(e[s])?t[s]=e[s].slice(0):t[s]=e[s];return t}function yi(t){var e,i,s={},n=document.documentElement.style;for(e in t)t[e]&&(i=L(n,e))&&(s[i]=t[e]);return s}function bi(t){for(var e={},i=0;i<t.length;i++)e[t[i]._id]=i;return e}function wi(t,e,i){return t[e._id]-t[i._id]}vi.Item=Ze,vi.ItemLayout=Fe,vi.ItemVisibility=Ve,vi.ItemMigrate=je,vi.ItemDrag=Re,vi.ItemDragRelease=ze,vi.ItemDragPlaceholder=We,vi.Emitter=S,vi.Animator=Ge,vi.Dragger=q,vi.Packer=ei,vi.AutoScroller=Gt,vi.defaultPacker=new ei(2),vi.defaultOptions={items:"*",showDuration:300,showEasing:"ease",hideDuration:300,hideEasing:"ease",visibleStyles:{opacity:"1",transform:"scale(1)"},hiddenStyles:{opacity:"0",transform:"scale(0.5)"},layout:{fillGaps:!1,horizontal:!1,alignRight:!1,alignBottom:!1,rounding:!1},layoutOnResize:150,layoutOnInit:!0,layoutDuration:300,layoutEasing:"ease",sortData:null,dragEnabled:!1,dragContainer:null,dragHandle:null,dragStartPredicate:{distance:0,delay:0},dragAxis:"xy",dragSort:!0,dragSortHeuristics:{sortInterval:100,minDragDistance:10,minBounceBackAngle:1},dragSortPredicate:{threshold:50,action:r,migrateAction:r},dragRelease:{duration:300,easing:"ease",useDragContainer:!0},dragCssProps:{touchAction:"none",userSelect:"none",userDrag:"none",tapHighlightColor:"rgba(0, 0, 0, 0)",touchCallout:"none",contentZooming:"none"},dragPlaceholder:{enabled:!1,createElement:null,onCreate:null,onRemove:null},dragAutoScroll:{targets:[],handle:null,threshold:50,safeZone:.2,speed:Gt.smoothSpeed(1e3,2e3,2500),sortDuringScroll:!0,smoothStop:!1,onStart:null,onStop:null},containerClass:"muuri",itemClass:"muuri-item",itemVisibleClass:"muuri-item-shown",itemHiddenClass:"muuri-item-hidden",itemPositioningClass:"muuri-item-positioning",itemDraggingClass:"muuri-item-dragging",itemReleasingClass:"muuri-item-releasing",itemPlaceholderClass:"muuri-item-placeholder"},vi.prototype.on=function(t,e){return this._emitter.on(t,e),this},vi.prototype.off=function(t,e){return this._emitter.off(t,e),this},vi.prototype.getElement=function(){return this._element},vi.prototype.getItem=function(t){if(this._isDestroyed||!t&&0!==t)return null;if(typeof t===ui)return this._items[t>-1?t:this._items.length+t]||null;if(t instanceof Ze)return t._gridId===this._id?t:null;if(s){var e=s.get(t);return e&&e._gridId===this._id?e:null}for(var i=0;i<this._items.length;i++)if(this._items[i]._element===t)return this._items[i];return null},vi.prototype.getItems=function(t){if(this._isDestroyed||void 0===t)return this._items.slice(0);var e,i,s=[];if(Array.isArray(t)||oi(t))for(e=0;e<t.length;e++)(i=this.getItem(t[e]))&&s.push(i);else(i=this.getItem(t))&&s.push(i);return s},vi.prototype.refreshItems=function(t,e){if(this._isDestroyed)return this;var i,s,n,r,o=t||this._items;if(!0===e)for(r=[],i=0;i<o.length;i++)(s=o[i]).isVisible()||s.isHiding()||((n=s.getElement().style).visibility="hidden",n.display="",r.push(n));for(i=0;i<o.length;i++)o[i]._refreshDimensions(e);if(!0===e){for(i=0;i<r.length;i++)(n=r[i]).visibility="",n.display="none";r.length=0}return this},vi.prototype.refreshSortData=function(t){if(this._isDestroyed)return this;for(var e=t||this._items,i=0;i<e.length;i++)e[i]._refreshSortData();return this},vi.prototype.synchronize=function(){if(this._isDestroyed)return this;var t,e,i=this._items;if(!i.length)return this;for(var s=0;s<i.length;s++)(e=i[s]._element).parentNode===this._element&&(t=t||document.createDocumentFragment()).appendChild(e);return t?(this._element.appendChild(t),this._emit("synchronize"),this):this},vi.prototype.layout=function(t,e){if(this._isDestroyed)return this;var i=this._nextLayoutData;i&&vt(i.cancel)&&i.cancel();var s=mi=mi%16777216+1;this._nextLayoutData={id:s,instant:t,onFinish:e,cancel:null};for(var n=this._items,r=[],o=0;o<n.length;o++)n[o]._isActive&&r.push(n[o]);this._refreshDimensions();var a,h=this._width-this._borderLeft-this._borderRight,l=this._height-this._borderTop-this._borderBottom,d=this._settings.layout;return vt(d)?a=d(this,s,r,h,l,this._onLayoutDataReceived):(vi.defaultPacker.setOptions(d),a=vi.defaultPacker.createLayout(this,s,r,h,l,this._onLayoutDataReceived)),vt(a)&&this._nextLayoutData&&this._nextLayoutData.id===s&&(this._nextLayoutData.cancel=a),this},vi.prototype.add=function(t,e){if(this._isDestroyed||!t)return[];var i,s=oi(i=t)?Array.prototype.slice.call(i):Array.prototype.concat(i);if(!s.length)return s;var n,r,o,a,h=e||{},l=h.layout?h.layout:void 0===h.layout,d=this._items,_=!1;for(a=0;a<s.length;a++)(r=s[a]).parentNode!==this._element&&(n=n||document.createDocumentFragment()).appendChild(r);for(n&&this._element.appendChild(n),a=0;a<s.length;a++)r=s[a],(o=s[a]=new Ze(this,r,h.active))._isActive&&(_=!0,o._layout._skipNextAnimation=!0);for(a=0;a<s.length;a++)(o=s[a])._refreshDimensions(),o._refreshSortData();return jt(d,s,h.index),this._hasListeners("add")&&this._emit("add",s.slice(0)),_&&l&&this.layout(l===pi,vt(l)?l:void 0),s},vi.prototype.remove=function(t,e){if(this._isDestroyed||!t.length)return[];var i,s,n,r=e||{},o=r.layout?r.layout:void 0===r.layout,a=!1,h=this.getItems(),d=[],_=[];for(n=0;n<t.length;n++)(s=t[n])._isDestroyed||-1!==(i=this._items.indexOf(s))&&(s._isActive&&(a=!0),d.push(s),_.push(h.indexOf(s)),s._destroy(r.removeElements),this._items.splice(i,1));return this._hasListeners(l)&&this._emit(l,d.slice(0),_),a&&o&&this.layout(o===pi,vt(o)?o:void 0),d},vi.prototype.show=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!0,e),this},vi.prototype.hide=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!1,e),this},vi.prototype.filter=function(t,e){if(this._isDestroyed||!this._items.length)return this;var i,s,n=[],r=[],o=typeof t===fi,a=vt(t),h=e||{},l=!0===h.instant,d=h.syncWithLayout,c=h.layout?h.layout:void 0===h.layout,u=vt(h.onFinish)?h.onFinish:null,f=-1,p=_i;if(u&&(p=function(){++f&&u(n.slice(0),r.slice(0))}),a||o)for(s=0;s<this._items.length;s++)i=this._items[s],(a?t(i):Wt(i._element,t))?n.push(i):r.push(i);return n.length?this.show(n,{instant:l,syncWithLayout:d,onFinish:p,layout:!1}):p(),r.length?this.hide(r,{instant:l,syncWithLayout:d,onFinish:p,layout:!1}):p(),(n.length||r.length)&&(this._hasListeners(_)&&this._emit(_,n.slice(0),r.slice(0)),c&&this.layout(c===pi,vt(c)?c:void 0)),this},vi.prototype.sort=function(){var t,e,i,s;function n(n,r){for(var o,a,h,l,d=0,_=0;_<t.length;_++)if(o=t[_][0],a=t[_][1],h=(n._sortData?n:n._refreshSortData())._sortData[o],l=(r._sortData?r:r._refreshSortData())._sortData[o],d="desc"===a||!a&&e?l<h?-1:l>h?1:0:h<l?-1:h>l?1:0)return d;return d||(s||(s=bi(i)),d=e?wi(s,r,n):wi(s,n,r)),d}function r(n,r){var o=e?-t(n,r):t(n,r);return o||(s||(s=bi(i)),o=e?wi(s,r,n):wi(s,n,r)),o}return function(o,a){if(this._isDestroyed||this._items.length<2)return this;var h=this._items,l=a||{},d=l.layout?l.layout:void 0===l.layout;if(e=!!l.descending,i=h.slice(0),s=null,vt(o))t=o,h.sort(r);else if(typeof o===fi)t=o.trim().split(" ").filter((function(t){return t})).map((function(t){return t.split(":")})),h.sort(n);else{if(!Array.isArray(o))throw t=e=i=s=null,new Error("Invalid comparer argument provided.");h.length=0,h.push.apply(h,o)}return this._hasListeners(c)&&this._emit(c,h.slice(0),i),d&&this.layout(d===pi,vt(d)?d:void 0),t=e=i=s=null,this}}(),vi.prototype.move=function(t,e,i){if(this._isDestroyed||this._items.length<2)return this;var s,o,a=this._items,h=i||{},l=h.layout?h.layout:void 0===h.layout,d=h.action===n,_=d?n:r,c=this.getItem(t),f=this.getItem(e);return c&&f&&c!==f&&(s=a.indexOf(c),o=a.indexOf(f),d?Ut(a,s,o):Qt(a,s,o),this._hasListeners(u)&&this._emit(u,{item:c,fromIndex:s,toIndex:o,action:_}),l&&this.layout(l===pi,vt(l)?l:void 0)),this},vi.prototype.send=function(t,e,i,s){if(this._isDestroyed||e._isDestroyed||this===e)return this;if(!(t=this.getItem(t)))return this;var n=s||{},r=n.appendTo||document.body,o=n.layoutSender?n.layoutSender:void 0===n.layoutSender,a=n.layoutReceiver?n.layoutReceiver:void 0===n.layoutReceiver;return t._migrate.start(e,i,r),t._migrate._isActive&&t._isActive&&(o&&this.layout(o===pi,vt(o)?o:void 0),a&&e.layout(a===pi,vt(a)?a:void 0)),this},vi.prototype.destroy=function(t){if(this._isDestroyed)return this;var e,s,n,r=this._element,o=this._items.slice(0),a=this._layout&&this._layout.styles||{};for((n=this)._resizeHandler&&(n._resizeHandler(!0),window.removeEventListener("resize",n._resizeHandler),n._resizeHandler=null),e=0;e<o.length;e++)o[e]._destroy(t);for(s in this._items.length=0,Se(r,this._settings.containerClass),a)r.style[s]="";return this._emit("destroy"),this._emitter.destroy(),delete i[this._id],this._isDestroyed=!0,this},vi.prototype._emit=function(){this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments)},vi.prototype._hasListeners=function(t){return!this._isDestroyed&&this._emitter.countListeners(t)>0},vi.prototype._updateBoundingRect=function(){var t=this._element.getBoundingClientRect();this._width=t.width,this._height=t.height,this._left=t.left,this._top=t.top,this._right=t.right,this._bottom=t.bottom},vi.prototype._updateBorders=function(t,e,i,s){var n=this._element;t&&(this._borderLeft=bt(n,"border-left-width")),e&&(this._borderRight=bt(n,"border-right-width")),i&&(this._borderTop=bt(n,"border-top-width")),s&&(this._borderBottom=bt(n,"border-bottom-width"))},vi.prototype._refreshDimensions=function(){this._updateBoundingRect(),this._updateBorders(1,1,1,1),this._boxSizing=yt(this._element,"box-sizing")},vi.prototype._onLayoutDataReceived=(ci=[],function(t){if(!this._isDestroyed&&this._nextLayoutData&&this._nextLayoutData.id===t.id){var e,i,s,n,r=this,l=this._nextLayoutData.instant,d=this._nextLayoutData.onFinish,_=t.items.length,c=_;for(this._nextLayoutData=null,!this._isLayoutFinished&&this._hasListeners(h)&&this._emit(h,this._layout.items.slice(0)),this._layout=t,ci.length=0,n=0;n<_;n++)(e=t.items[n])?(i=t.slots[2*n],s=t.slots[2*n+1],e._canSkipLayout(i,s)?--c:(e._left=i,e._top=s,e.isActive()&&!e.isDragging()?ci.push(e):--c)):--c;if(t.styles&&Ye(this._element,t.styles),!this._hasListeners(o)||(this._emit(o,t.items.slice(0),!0===l),this._layout.id===t.id)){var u=function(){if(!(--c>0)){var e=r._layout.id!==t.id,i=vt(l)?l:d;e||(r._isLayoutFinished=!0),vt(i)&&i(t.items.slice(0),e),!e&&r._hasListeners(a)&&r._emit(a,t.items.slice(0))}};if(!ci.length)return u(),this;for(this._isLayoutFinished=!1,n=0;n<ci.length&&this._layout.id===t.id;n++)ci[n]._layout.start(!0===l,u);return this._layout.id===t.id&&(ci.length=0),this}}}),vi.prototype._setItemsVisibility=function(t,e,i){var s,n,r=this,a=t.slice(0),h=i||{},l=!0===h.instant,_=h.onFinish,c=h.layout?h.layout:void 0===h.layout,u=a.length,f=e?"showStart":d,p=e?"showEnd":"hideEnd",m=e?"show":"hide",v=!1,g=[],y=[];if(u){for(n=0;n<a.length;n++)s=a[n],(e&&!s._isActive||!e&&s._isActive)&&(v=!0),s._layout._skipNextAnimation=!(!e||s._isActive),e&&s._visibility._isHidden&&y.push(s),e?s._addToLayout():s._removeFromLayout();y.length&&(this.refreshItems(y,!0),y.length=0),v&&!1!==h.syncWithLayout?this.on(o,b):b(),v&&c&&this.layout(c===pi,vt(c)?c:void 0)}else vt(_)&&_(a);function b(){for(v&&!1!==h.syncWithLayout&&r.off(o,b),r._hasListeners(f)&&r._emit(f,a.slice(0)),n=0;n<a.length;n++)a[n]._gridId===r._id?a[n]._visibility[m](l,(function(t,e){t||g.push(e),--u<1&&(vt(_)&&_(g.slice(0)),r._hasListeners(p)&&r._emit(p,g.slice(0)))})):--u<1&&(vt(_)&&_(g.slice(0)),r._hasListeners(p)&&r._emit(p,g.slice(0)))}};const Si=vi;function Di(t){return Di="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Di(t)}function ki(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,xi(s.key),s)}}function xi(t){var e=function(t,e){if("object"!=Di(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=Di(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Di(e)?e:e+""}var Ei=function(){return t=function t(e,i){var s=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.grid_id=e,this.collection=e,this.config={itemWidth:n.itemWidth||100,itemHeight:n.itemHeight||100,itemGap:n.itemGap||6,label_field:n.label_field||"id"},this.data=new Map,this.default_icon="https://cdn-icons-png.flaticon.com/512/732/732212.png",this.gridContainer=document.createElement("div"),this.gridContainer.className="vi-grid-container",i.contentContainer.appendChild(this.gridContainer),this.gridContainer.style.setProperty("--item-w",this.config.itemWidth+"px"),this.gridContainer.style.setProperty("--item-h",this.config.itemHeight+"px"),this.gridContainer.style.setProperty("--item-gap",this.config.itemGap+"px"),!document.getElementById("vi-grid-style")){var r=document.createElement("style");r.id="vi-grid-style",r.textContent="\n .vi-grid-container {\n position: relative;\n }\n\n .vi-grid-item {\n position: absolute;\n width: var(--item-w, 100px);\n height: var(--item-h, 100px);\n margin: var(--item-gap, 6px);\n cursor: pointer;\n }\n\n .vi-grid-item-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .vi-grid-icon {\n width: 60%;\n height: 60%;\n object-fit: contain;\n }\n\n .vi-grid-title {\n font-size: 12px;\n margin-top: 5px;\n text-align: center;\n user-select: none;\n }\n\n .vi-grid-item.selected {\n outline: 2px solid blue;\n }\n ",document.head.appendChild(r)}this.grid=new Si(this.gridContainer,{dragEnabled:!0,layout:{fillGaps:!0,horizontal:!1,alignRight:!1,alignBottom:!1},dragSort:!0,dragRelease:{duration:150,easing:"ease"},layoutDuration:150}),this.gridContainer.addEventListener("click",(function(t){var e=t.target.closest(".vi-grid-item");e&&s.toggleSelect(e)})),this.resizeObserver=new ResizeObserver((function(){s.grid.refreshItems(),s.grid.layout()})),this.resizeObserver.observe(i.contentContainer)},e=[{key:"addItem",value:function(t){var e=t.icon,i=t.title,s=t.data,n=document.createElement("div");n.className="vi-grid-item",n.dataset.id=s.id,n.innerHTML='\n <div class="vi-grid-item-content">\n <img src="'.concat(e,'" class="vi-grid-icon" />\n <div class="vi-grid-title">').concat(i,"</div>\n </div>\n "),this.gridContainer.appendChild(n),this.grid.add(n),this.data.set(s.id,s)}},{key:"add",value:function(t,e){this.addItem({icon:this.default_icon,title:e[this.config.label_field],data:e})}},{key:"removeItem",value:function(t){this.grid.getItem(t)&&this.grid.remove(t,{removeElements:!0})}},{key:"removeById",value:function(t){var e=this.gridContainer.querySelector('.vi-grid-item[data-id="'.concat(t,'"]'));return!!e&&(this.removeItem(e),this.data.delete(t),!0)}},{key:"removeSelected",value:function(){var t=this,e=this.gridContainer.querySelectorAll(".vi-grid-item.selected");return e.forEach((function(e){var i=e.dataset.id;t.removeItem(e),t.data.delete(i)})),e.length}},{key:"toggleSelect",value:function(t){this.gridContainer.querySelectorAll(".vi-grid-item.selected").forEach((function(t){return t.classList.remove("selected")}));var e=t.classList.toggle("selected"),i=t.dataset.id,s=this.data.get(i);this._onSelect&&this._onSelect({id:i,rowData:s,elem:t,selected:e}),this.event_bus&&this.event_bus.emit(this.collection,"selected",{id:i,object:s})}},{key:"setEventBus",value:function(t){this.event_bus=t}},{key:"update_record",value:function(t){t.collection;var e=t.record;this.data.set(e.id,e)}},{key:"add_or_update",value:function(t){var e=t.collection,i=t.record;this.data.has(i.id)?this.update_record({collection:e,record:i}):this.add(e,i)}},{key:"delete",value:function(t){t.collection;var e=t.record;this.removeById(e.id)}},{key:"set",value:function(t){var e=this,i=t.collection;t.result.data.forEach((function(t){e.add(i,t)}))}},{key:"focus",value:function(t){if(t&&t.id){var e=this.gridContainer.querySelector('.vi-grid-item[data-id="'.concat(t.id,'"]'));e&&(this.gridContainer.querySelectorAll(".vi-grid-item.selected").forEach((function(t){return t.classList.remove("selected")})),e.classList.add("selected"),e.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),this._onSelect&&this._onSelect({id:t.id,rowData:this.data.get(t.id),elem:e,selected:!0}))}}}],e&&ki(t.prototype,e),i&&ki(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Li(t){return Li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Li(t)}function Ai(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function Ti(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ai(Object(i),!0).forEach((function(e){Ri(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ai(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Ri(t,e,i){return(e=Ii(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ci(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,Ii(s.key),s)}}function Ii(t){var e=function(t,e){if("object"!=Li(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=Li(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Li(e)?e:e+""}var Pi=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.root=e.contentContainer||e,this.nodes=new Map,this.links=[],this.pendingLink=null,this.selectedLink=null,this.scale=1,this.offset={x:0,y:0},this._injectStyles(),this._build(),this._bindPanZoom(),this._bindGlobalLinkHandlers(),this._bindLinkDeletion(),this.drop_callback=null,this.setupDropArea()},e=[{key:"_build",value:function(){var t=this;this.root.innerHTML="",this.viewport=document.createElement("div"),this.viewport.className="vi-viewport",this.content=document.createElement("div"),this.content.className="vi-content",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.classList.add("vi-links"),this.viewport.append(this.content,this.svg),this.root.appendChild(this.viewport),this.viewport.addEventListener("contextmenu",(function(t){return t.preventDefault()})),new ResizeObserver((function(){return t._resize()})).observe(this.root),this._resize()}},{key:"_resize",value:function(){this.svg.setAttribute("width",this.viewport.clientWidth),this.svg.setAttribute("height",this.viewport.clientHeight),this._updateLinks()}},{key:"_injectStyles",value:function(){if(!document.getElementById("vi-style")){var t=document.createElement("style");t.id="vi-style",t.textContent="\n .vi-viewport {\n position: relative;\n width: 100%;\n height: 100%;\n background: #1e1e1e;\n overflow: hidden;\n user-select: none;\n }\n .vi-content,\n .vi-links {\n position: absolute;\n inset: 0;\n transform-origin: 0 0;\n }\n .vi-content { z-index: 1; }\n .vi-links { z-index: 2; pointer-events: none; }\n .vi-node {\n position: absolute;\n width: 120px;\n height: 60px;\n background: #2b2b2b;\n border: 1px solid #555;\n border-radius: 6px;\n color: #fff;\n cursor: grab;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n }\n .vi-title {\n text-align: center;\n font-size: 12px;\n padding-top: 2px;\n }\n .vi-icon {\n width: 24px;\n height: 24px;\n margin-bottom: 2px;\n }\n .vi-port {\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: #4da3ff;\n cursor: crosshair;\n }\n .vi-port.out { right: -5px; top: 50%; transform: translateY(-50%); }\n .vi-port.in { left: -5px; top: 50%; transform: translateY(-50%); }\n .vi-link {\n stroke: #4da3ff;\n stroke-width: 2.5;\n fill: none;\n pointer-events: stroke;\n cursor: pointer;\n }\n .vi-link.preview {\n stroke-dasharray: 4 4;\n pointer-events: none;\n }\n .vi-link.selected {\n stroke: #ff5252;\n stroke-width: 3.5;\n }\n ",document.head.appendChild(t)}}},{key:"addIcon",value:function(t){var e,i,s=t.id,n=t.x,r=t.y,o=t.label,a=t.icon,h=document.createElement("div");h.className="vi-node",h.style.left=n+"px",h.style.top=r+"px";var l=document.createElement("div");if(l.className="vi-icon",null!=a&&null!==(e=a.startsWith)&&void 0!==e&&e.call(a,"<svg"))l.innerHTML=a;else if(null!=a&&null!==(i=a.match)&&void 0!==i&&i.call(a,/\.(png|jpg|jpeg|svg)$/)){var d=document.createElement("img");d.src=a,d.style.width="100%",d.style.height="100%",d.style.objectFit="contain",l.appendChild(d)}else l.textContent=null!=a?a:"";var _=document.createElement("div");_.className="vi-title",_.textContent=null!=o?o:s;var c=document.createElement("div");c.className="vi-port in",c.dataset.nodeId=s;var u=document.createElement("div");u.className="vi-port out",h.append(l,_,c,u),this.content.appendChild(h),this.nodes.set(s,{id:s,node:h,x:n,y:r,inPort:c,outPort:u,label:o,icon:a}),this._makeDraggable(s),this._bindPorts(s)}},{key:"_makeDraggable",value:function(t){var e,i,s,n,r=this,o=this.nodes.get(t);o.node.addEventListener("pointerdown",(function(t){if(!t.target.classList.contains("vi-port")&&0===t.button){e=t.clientX,i=t.clientY,s=o.x,n=o.y;var a=function(t){o.x=s+(t.clientX-e)/r.scale,o.y=n+(t.clientY-i)/r.scale,o.node.style.left=o.x+"px",o.node.style.top=o.y+"px",r._updateLinks()};window.addEventListener("pointermove",a),window.addEventListener("pointerup",(function(){return window.removeEventListener("pointermove",a)}),{once:!0})}}))}},{key:"_bindPorts",value:function(t){var e=this;this.nodes.get(t).outPort.addEventListener("pointerdown",(function(i){i.stopPropagation(),e.pendingLink={from:t,preview:e._createPreviewPath()}}))}},{key:"_bindGlobalLinkHandlers",value:function(){var t=this;window.addEventListener("pointermove",(function(e){t.pendingLink&&t._updatePreview(e.clientX,e.clientY)})),window.addEventListener("pointerup",(function(e){if(t.pendingLink){var i=document.elementFromPoint(e.clientX,e.clientY),s=null==i?void 0:i.closest(".vi-port.in");if(s){var n=s.dataset.nodeId;n&&n!==t.pendingLink.from&&t._createLink(t.pendingLink.from,n)}t.pendingLink.preview.remove(),t.pendingLink=null}}))}},{key:"_createPreviewPath",value:function(){var t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.classList.add("vi-link","preview"),this.svg.appendChild(t),t}},{key:"_updatePreview",value:function(t,e){var i=this.viewport.getBoundingClientRect(),s=(t-i.left-this.offset.x)/this.scale,n=(e-i.top-this.offset.y)/this.scale,r=this.nodes.get(this.pendingLink.from),o=r.x+120,a=r.y+30,h=.5*Math.abs(s-o);this.pendingLink.preview.setAttribute("d","M ".concat(o," ").concat(a," C ").concat(o+h," ").concat(a,", ").concat(s-h," ").concat(n,", ").concat(s," ").concat(n))}},{key:"_createLink",value:function(t,e){var i=this,s=document.createElementNS("http://www.w3.org/2000/svg","path");s.classList.add("vi-link"),s.addEventListener("pointerdown",(function(t){t.stopPropagation(),i._selectLink(s)})),this.svg.appendChild(s),this.links.push({from:t,to:e,path:s}),this._updateLinks()}},{key:"_selectLink",value:function(t){this.selectedLink&&this.selectedLink.classList.remove("selected"),this.selectedLink=t,t.classList.add("selected")}},{key:"_updateLinks",value:function(){var t=this;this.links.forEach((function(e){var i=t.nodes.get(e.from),s=t.nodes.get(e.to),n=i.x+120,r=i.y+30,o=s.x,a=s.y+30,h=.5*Math.abs(o-n);e.path.setAttribute("d","M ".concat(n," ").concat(r," C ").concat(n+h," ").concat(r,", ").concat(o-h," ").concat(a,", ").concat(o," ").concat(a))}))}},{key:"_bindLinkDeletion",value:function(){var t=this;window.addEventListener("keydown",(function(e){if(t.selectedLink&&("Delete"===e.key||"Backspace"===e.key)){var i=t.links.findIndex((function(e){return e.path===t.selectedLink}));-1!==i&&(t.links[i].path.remove(),t.links.splice(i,1)),t.selectedLink=null}}))}},{key:"_bindPanZoom",value:function(){var t,e,i=this,s=!1;this.viewport.addEventListener("pointerdown",(function(i){2===i.button&&(s=!0,t=i.clientX,e=i.clientY,i.preventDefault())})),window.addEventListener("pointermove",(function(n){s&&(i.offset.x+=n.clientX-t,i.offset.y+=n.clientY-e,t=n.clientX,e=n.clientY,i._applyTransform())})),window.addEventListener("pointerup",(function(){return s=!1})),this.viewport.addEventListener("wheel",(function(t){t.preventDefault(),i.scale*=t.deltaY>0?.9:1.1,i._applyTransform()}),{passive:!1})}},{key:"_applyTransform",value:function(){var t="translate(".concat(this.offset.x,"px, ").concat(this.offset.y,"px) scale(").concat(this.scale,")");this.content.style.transform=t,this.svg.style.transform=t}},{key:"serialize",value:function(){return{scale:this.scale,offset:Ti({},this.offset),nodes:Array.from(this.nodes.values()).map((function(t){return{id:t.id,x:t.x,y:t.y,label:t.label,icon:t.icon}})),links:this.links.map((function(t){return{from:t.from,to:t.to}}))}}},{key:"deserialize",value:function(t){var e,i,s,n,r=this;this.scale=null!==(e=t.scale)&&void 0!==e?e:1,this.offset=null!==(i=t.offset)&&void 0!==i?i:{x:0,y:0},this._applyTransform(),this.nodes.forEach((function(t){return t.node.remove()})),this.links.forEach((function(t){return t.path.remove()})),this.nodes.clear(),this.links=[],(null!==(s=t.nodes)&&void 0!==s?s:[]).forEach((function(t){return r.addIcon({id:t.id,x:t.x,y:t.y,label:t.label,icon:t.icon})})),(null!==(n=t.links)&&void 0!==n?n:[]).forEach((function(t){return r._createLink(t.from,t.to)}))}},{key:"setupDropArea",value:function(){var t=this;this.viewport.addEventListener("dragover",(function(t){return t.preventDefault()})),this.viewport.addEventListener("drop",(function(e){e.preventDefault();var i=e.dataTransfer.getData("text/plain");if(i){var s;try{s=JSON.parse(i)}catch(t){s={id:i,label:i,icon:i}}if(s.id&&!t.nodes.has(s.id)){var n=t.viewport.getBoundingClientRect(),r=(e.clientX-n.left-t.offset.x)/t.scale,o=(e.clientY-n.top-t.offset.y)/t.scale;t.drop_callback?t.drop_callback(t,s,r,o):t.addIcon({id:s.id,x:r,y:o,label:s.label||s.id,icon:s.icon||null})}}}))}}],e&&Ci(t.prototype,e),i&&Ci(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Mi(t){return Mi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mi(t)}function Yi(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,Xi(s.key),s)}}function Xi(t){var e=function(t,e){if("object"!=Mi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=Mi(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Mi(e)?e:e+""}var Oi=function(){return t=function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e.contentContainer||e,this.options=i,this.container.innerHTML='\n <div id="drag-list"></div>\n '},e=[{key:"set",value:function(t){var e=this,i=(t.collection,t.result.data),s=this.container.querySelector("#drag-list");s.innerHTML="",i.forEach((function(t){var i=document.createElement("div");i.className="draggable-item",i.draggable=!0,i.innerHTML="\n ".concat(t[e.options.icon]?'<img src="'.concat(t[e.options.icon],'" style="width:16px;height:16px;margin-right:4px;" />'):"","\n <span>").concat(t[e.options.label],"</span>\n "),i.addEventListener("dragstart",(function(e){e.dataTransfer.setData("text/plain",JSON.stringify(t))})),s.appendChild(i)}))}},{key:"setStyle",value:function(t){var e=this;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])this.container.querySelectorAll(".draggable-item").forEach((function(i){return e._applyStyle(i,t)}));else{var i=this.container.querySelector("#drag-list");this._applyStyle(i,t)}}},{key:"_applyStyle",value:function(t,e){"string"==typeof e?t.style.cssText+=e:"object"===Mi(e)&&Object.assign(t.style,e)}}],e&&Yi(t.prototype,e),i&&Yi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),qi=e.Hx,Hi=e.YO,Gi=e.Qz;export{qi as vi_Grid,Hi as vi_IconPanel,Gi as vi_dragable_list};
2
+ var t={d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{Hx:()=>Ei,YO:()=>Pi,Qz:()=>Oi});var i={},s="function"==typeof Map?new Map:null,n="swap",r="move",o="layoutStart",a="layoutEnd",h="layoutAbort",l="remove",d="hideStart",_="filter",c="sort",u="move",f="send",p="beforeSend",m="receive",v="beforeReceive",g="dragReleaseEnd",y="ontouchstart"in window,b=!!window.PointerEvent,w=!!window.navigator.msPointerEnabled;function S(){this._events={},this._queue=[],this._counter=0,this._clearOnEmit=!1}S.prototype.on=function(t,e){if(!this._events||!t||!e)return this;var i=this._events[t];return i||(i=this._events[t]=[]),i.push(e),this},S.prototype.off=function(t,e){if(!this._events||!t||!e)return this;var i,s=this._events[t];if(!s||!s.length)return this;for(;-1!==(i=s.indexOf(e));)s.splice(i,1);return this},S.prototype.clear=function(t){if(!this._events||!t)return this;var e=this._events[t];return e&&(e.length=0,delete this._events[t]),this},S.prototype.emit=function(t){if(!this._events||!t)return this._clearOnEmit=!1,this;var e=this._events[t];if(!e||!e.length)return this._clearOnEmit=!1,this;var i,s=this._queue,n=s.length,r=arguments.length-1;r>3&&((i=[]).push.apply(i,arguments),i.shift()),s.push.apply(s,e),this._clearOnEmit&&(e.length=0,this._clearOnEmit=!1),++this._counter;for(var o=n,a=s.length;o<a;o++)if(0===r?s[o]():1===r?s[o](arguments[1]):2===r?s[o](arguments[1],arguments[2]):3===r?s[o](arguments[1],arguments[2],arguments[3]):s[o].apply(null,i),!this._events)return this;return--this._counter,this._counter||(s.length=0),this},S.prototype.burst=function(){return this._events?(this._clearOnEmit=!0,this.emit.apply(this,arguments),this):this},S.prototype.countListeners=function(t){if(!this._events)return 0;var e=this._events[t];return e?e.length:0},S.prototype.destroy=function(){return this._events?(this._queue.length=this._counter=0,this._events=null,this):this};var D=b?"pointerout":w?"MSPointerOut":"";function k(t){D&&(this._dragger=t,this._timeout=null,this._outEvent=null,this._isActive=!1,this._addBehaviour=this._addBehaviour.bind(this),this._removeBehaviour=this._removeBehaviour.bind(this),this._onTimeout=this._onTimeout.bind(this),this._resetData=this._resetData.bind(this),this._onStart=this._onStart.bind(this),this._onOut=this._onOut.bind(this),this._dragger.on("start",this._onStart))}k.prototype._addBehaviour=function(){this._isActive||(this._isActive=!0,this._dragger.on("move",this._resetData),this._dragger.on("cancel",this._removeBehaviour),this._dragger.on("end",this._removeBehaviour),window.addEventListener(D,this._onOut))},k.prototype._removeBehaviour=function(){this._isActive&&(this._dragger.off("move",this._resetData),this._dragger.off("cancel",this._removeBehaviour),this._dragger.off("end",this._removeBehaviour),window.removeEventListener(D,this._onOut),this._resetData(),this._isActive=!1)},k.prototype._resetData=function(){window.clearTimeout(this._timeout),this._timeout=null,this._outEvent=null},k.prototype._onStart=function(t){"mouse"!==t.pointerType&&this._addBehaviour()},k.prototype._onOut=function(t){this._dragger._getTrackedTouch(t)&&(this._resetData(),this._outEvent=t,this._timeout=window.setTimeout(this._onTimeout,100))},k.prototype._onTimeout=function(){var t=this._outEvent;this._resetData(),this._dragger.isActive()&&this._dragger._onCancel(t)},k.prototype.destroy=function(){D&&(this._dragger.off("start",this._onStart),this._removeBehaviour())};var x=["","webkit","moz","ms","o","Webkit","Moz","MS","O"],E={};function L(t,e){var i=E[e]||"";if(i)return i;for(var s=e[0].toUpperCase()+e.slice(1),n=0;n<x.length;){if((i=x[n]?x[n]+s:e)in t)return E[e]=i,i;++n}return""}function A(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}return t}var T=window.navigator.userAgent.toLowerCase(),R=T.indexOf("edge")>-1,C=T.indexOf("trident")>-1,I=T.indexOf("firefox")>-1,P=T.indexOf("android")>-1,M=!!A()&&{passive:!0},Y="touchAction",X=L(document.documentElement.style,Y),O="auto";function q(t,e){this._element=t,this._emitter=new S,this._isDestroyed=!1,this._cssProps={},this._touchAction="",this._isActive=!1,this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._onStart=this._onStart.bind(this),this._onMove=this._onMove.bind(this),this._onCancel=this._onCancel.bind(this),this._onEnd=this._onEnd.bind(this),this._edgeHack=null,(R||C)&&(b||w)&&(this._edgeHack=new k(this)),this.setCssProps(e),this._touchAction||this.setTouchAction(O),t.addEventListener("dragstart",q._preventDefault,!1),t.addEventListener(q._inputEvents.start,this._onStart,M)}q._pointerEvents={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},q._msPointerEvents={start:"MSPointerDown",move:"MSPointerMove",cancel:"MSPointerCancel",end:"MSPointerUp"},q._touchEvents={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},q._mouseEvents={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},q._inputEvents=y?q._touchEvents:b?q._pointerEvents:w?q._msPointerEvents:q._mouseEvents,q._emitter=new S,q._emitterEvents={start:"start",move:"move",end:"end",cancel:"cancel"},q._activeInstances=[],q._preventDefault=function(t){t.preventDefault&&!1!==t.cancelable&&t.preventDefault()},q._activateInstance=function(t){q._activeInstances.indexOf(t)>-1||(q._activeInstances.push(t),q._emitter.on(q._emitterEvents.move,t._onMove),q._emitter.on(q._emitterEvents.cancel,t._onCancel),q._emitter.on(q._emitterEvents.end,t._onEnd),1===q._activeInstances.length&&q._bindListeners())},q._deactivateInstance=function(t){var e=q._activeInstances.indexOf(t);-1!==e&&(q._activeInstances.splice(e,1),q._emitter.off(q._emitterEvents.move,t._onMove),q._emitter.off(q._emitterEvents.cancel,t._onCancel),q._emitter.off(q._emitterEvents.end,t._onEnd),q._activeInstances.length||q._unbindListeners())},q._bindListeners=function(){window.addEventListener(q._inputEvents.move,q._onMove,M),window.addEventListener(q._inputEvents.end,q._onEnd,M),q._inputEvents.cancel&&window.addEventListener(q._inputEvents.cancel,q._onCancel,M)},q._unbindListeners=function(){window.removeEventListener(q._inputEvents.move,q._onMove,M),window.removeEventListener(q._inputEvents.end,q._onEnd,M),q._inputEvents.cancel&&window.removeEventListener(q._inputEvents.cancel,q._onCancel,M)},q._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},q._getTouchById=function(t,e){if("number"==typeof t.pointerId)return t.pointerId===e?t:null;if(t.changedTouches){for(var i=0;i<t.changedTouches.length;i++)if(t.changedTouches[i].identifier===e)return t.changedTouches[i];return null}return t},q._onMove=function(t){q._emitter.emit(q._emitterEvents.move,t)},q._onCancel=function(t){q._emitter.emit(q._emitterEvents.cancel,t)},q._onEnd=function(t){q._emitter.emit(q._emitterEvents.end,t)},q.prototype._reset=function(){this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._isActive=!1,q._deactivateInstance(this)},q.prototype._createEvent=function(t,e){var i=this._getTrackedTouch(e);return{type:t,srcEvent:e,distance:this.getDistance(),deltaX:this.getDeltaX(),deltaY:this.getDeltaY(),deltaTime:t===q._emitterEvents.start?0:this.getDeltaTime(),isFirst:t===q._emitterEvents.start,isFinal:t===q._emitterEvents.end||t===q._emitterEvents.cancel,pointerType:e.pointerType||(e.touches?"touch":"mouse"),identifier:this._pointerId,screenX:i.screenX,screenY:i.screenY,clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,target:i.target}},q.prototype._emit=function(t,e){this._emitter.emit(t,this._createEvent(t,e))},q.prototype._getTrackedTouch=function(t){return null===this._pointerId?null:q._getTouchById(t,this._pointerId)},q.prototype._onStart=function(t){if(!this._isDestroyed&&null===this._pointerId&&(this._pointerId=q._getEventPointerId(t),null!==this._pointerId)){var e=this._getTrackedTouch(t);this._startX=this._currentX=e.clientX,this._startY=this._currentY=e.clientY,this._startTime=Date.now(),this._isActive=!0,this._emit(q._emitterEvents.start,t),this._isActive&&q._activateInstance(this)}},q.prototype._onMove=function(t){var e=this._getTrackedTouch(t);e&&(this._currentX=e.clientX,this._currentY=e.clientY,this._emit(q._emitterEvents.move,t))},q.prototype._onCancel=function(t){this._getTrackedTouch(t)&&(this._emit(q._emitterEvents.cancel,t),this._reset())},q.prototype._onEnd=function(t){this._getTrackedTouch(t)&&(this._emit(q._emitterEvents.end,t),this._reset())},q.prototype.isActive=function(){return this._isActive},q.prototype.setTouchAction=function(t){this._touchAction=t,X&&(this._cssProps[X]="",this._element.style[X]=t),y&&(this._element.removeEventListener(q._touchEvents.start,q._preventDefault,!0),(this._element.style[X]!==t||I&&P)&&this._element.addEventListener(q._touchEvents.start,q._preventDefault,!0))},q.prototype.setCssProps=function(t){if(t){var e,i,s=this._cssProps,n=this._element;for(e in s)n.style[e]=s[e],delete s[e];for(e in t)t[e]&&(e!==Y?(i=L(n.style,e))&&(s[i]="",n.style[i]=t[e]):this.setTouchAction(t[e]))}},q.prototype.getDeltaX=function(){return this._currentX-this._startX},q.prototype.getDeltaY=function(){return this._currentY-this._startY},q.prototype.getDistance=function(){var t=this.getDeltaX(),e=this.getDeltaY();return Math.sqrt(t*t+e*e)},q.prototype.getDeltaTime=function(){return this._startTime?Date.now()-this._startTime:0},q.prototype.on=function(t,e){this._emitter.on(t,e)},q.prototype.off=function(t,e){this._emitter.off(t,e)},q.prototype.destroy=function(){if(!this._isDestroyed){var t=this._element;for(var e in this._edgeHack&&this._edgeHack.destroy(),this._reset(),this._emitter.destroy(),t.removeEventListener(q._inputEvents.start,this._onStart,M),t.removeEventListener("dragstart",q._preventDefault,!1),t.removeEventListener(q._touchEvents.start,q._preventDefault,!0),this._cssProps)t.style[e]=this._cssProps[e],delete this._cssProps[e];this._element=null,this._isDestroyed=!0}};var H=1e3/60,G=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return this.setTimeout((function(){t(Date.now())}),H)}).bind(window);function N(t){this._nextStep=null,this._lanes=[],this._stepQueue=[],this._stepCallbacks={},this._step=this._step.bind(this);for(var e=0;e<t;e++)this._lanes.push(new B)}function B(){this.queue=[],this.indices={},this.callbacks={}}N.prototype._step=function(t){var e,i,s,n,r,o,a=this._lanes,h=this._stepQueue,l=this._stepCallbacks;for(this._nextStep=null,e=0;e<a.length;e++){for(n=a[e].queue,r=a[e].callbacks,o=a[e].indices,i=0;i<n.length;i++)(s=n[i])&&(h.push(s),l[s]=r[s],delete r[s],delete o[s]);n.length=0}for(e=0;e<h.length;e++)l[s=h[e]]&&l[s](t),delete l[s];h.length=0},N.prototype.add=function(t,e,i){this._lanes[t].add(e,i),this._nextStep||(this._nextStep=G(this._step))},N.prototype.remove=function(t,e){this._lanes[t].remove(e)},B.prototype.add=function(t,e){var i=this.indices[t];void 0!==i&&(this.queue[i]=void 0),this.queue.push(t),this.callbacks[t]=e,this.indices[t]=this.queue.length-1},B.prototype.remove=function(t){var e=this.indices[t];void 0!==e&&(this.queue[e]=void 0,delete this.callbacks[t],delete this.indices[t])};var W="layoutRead",z="layoutWrite",F="visibilityRead",j="visibilityWrite",V="dragStartRead",Q="dragStartWrite",U="dragMoveRead",Z="dragMoveWrite",J="dragScrollRead",$="dragScrollWrite",K="dragSortRead",tt="placeholderLayoutRead",et="placeholderLayoutWrite",it="placeholderResizeWrite",st="autoScrollRead",nt="autoScrollWrite",rt="debounceRead",ot=0,at=new N(3);function ht(t){at.remove(ot,W+t),at.remove(2,z+t)}function lt(t){at.remove(ot,F+t),at.remove(2,j+t)}function dt(t){at.remove(ot,V+t),at.remove(2,Q+t)}function _t(t){at.remove(ot,U+t),at.remove(2,Z+t)}function ct(t){at.remove(ot,J+t),at.remove(2,$+t)}function ut(t,e){at.add(1,K+t,e)}function ft(t){at.remove(ot,tt+t),at.remove(2,et+t)}function pt(t,e){at.add(ot,st,t),at.add(2,nt,e)}var mt="function";function vt(t){return typeof t===mt}var gt="function"==typeof WeakMap?new WeakMap:null;function yt(t,e){var i=gt&&gt.get(t);return i||(i=window.getComputedStyle(t,null),gt&&gt.set(t,i)),i.getPropertyValue(e)}function bt(t,e){return parseFloat(yt(t,e))||0}var wt,St=document.documentElement,Dt=document.body,kt={value:0,offset:0};function xt(t){return t===window||t===St||t===Dt?window:t}function Et(t){return t===window?t.pageXOffset:t.scrollLeft}function Lt(t){return t===window?t.pageYOffset:t.scrollTop}function At(t){return t===window?St.scrollWidth-St.clientWidth:t.scrollWidth-t.clientWidth}function Tt(t){return t===window?St.scrollHeight-St.clientHeight:t.scrollHeight-t.clientHeight}function Rt(t,e){if(e=e||{},t===window)e.width=St.clientWidth,e.height=St.clientHeight,e.left=0,e.right=e.width,e.top=0,e.bottom=e.height;else{var i=t.getBoundingClientRect(),s=t.clientLeft||bt(t,"border-left-width"),n=t.clientTop||bt(t,"border-top-width");e.width=t.clientWidth,e.height=t.clientHeight,e.left=i.left+s,e.right=e.left+e.width,e.top=i.top+n,e.bottom=e.top+e.height}return e}function Ct(t){return t._drag._getGrid()._settings.dragAutoScroll}function It(t){if(t._drag&&t._isActive){var e=t._drag;e._scrollDiffX=e._scrollDiffY=0,t._setTranslate(e._left,e._top)}}function Pt(t,e,i,s){return kt.value=Math.min(s/2,t),kt.offset=Math.max(0,i+2*kt.value+s*e-s)/2,kt}function Mt(){this.reset()}function Yt(){this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}function Xt(t,e){this.pool=[],this.createItem=t,this.releaseItem=e}function Ot(t,e){var i=function(t,e){return function(t,e){return!(t.left+t.width<=e.left||e.left+e.width<=t.left||t.top+t.height<=e.top||e.top+e.height<=t.top)}(t,e)?(Math.min(t.left+t.width,e.left+e.width)-Math.max(t.left,e.left))*(Math.min(t.top+t.height,e.top+e.height)-Math.max(t.top,e.top)):0}(t,e);return i?i/(Math.min(t.width,e.width)*Math.min(t.height,e.height))*100:0}Mt.prototype.reset=function(){this.isActive&&this.onStop(),this.item=null,this.element=null,this.isActive=!1,this.isEnding=!1,this.direction=null,this.value=null,this.maxValue=0,this.threshold=0,this.distance=0,this.speed=0,this.duration=0,this.action=null},Mt.prototype.hasReachedEnd=function(){return 4&this.direction?this.value>=this.maxValue:this.value<=0},Mt.prototype.computeCurrentScrollValue=function(){return null===this.value?1&this.direction?Et(this.element):Lt(this.element):Math.max(0,Math.min(this.value,this.maxValue))},Mt.prototype.computeNextScrollValue=function(t){var e=this.speed*(t/1e3),i=4&this.direction?this.value+e:this.value-e;return Math.max(0,Math.min(i,this.maxValue))},Mt.prototype.computeSpeed=(wt={direction:null,threshold:0,distance:0,value:0,maxValue:0,deltaTime:0,duration:0,isEnding:!1},function(t){var e=this.item,i=Ct(e).speed;return vt(i)?(wt.direction=this.direction,wt.threshold=this.threshold,wt.distance=this.distance,wt.value=this.value,wt.maxValue=this.maxValue,wt.duration=this.duration,wt.speed=this.speed,wt.deltaTime=t,wt.isEnding=this.isEnding,i(e,this.element,wt)):i}),Mt.prototype.tick=function(t){return this.isActive||(this.isActive=!0,this.onStart()),this.value=this.computeCurrentScrollValue(),this.speed=this.computeSpeed(t),this.value=this.computeNextScrollValue(t),this.duration+=t,this.value},Mt.prototype.onStart=function(){var t=this.item,e=Ct(t).onStart;vt(e)&&e(t,this.element,this.direction)},Mt.prototype.onStop=function(){var t=this.item,e=Ct(t).onStop;vt(e)&&e(t,this.element,this.direction),t._drag&&t._drag.sort()},Yt.prototype.reset=function(){this.requestX&&(this.requestX.action=null),this.requestY&&(this.requestY.action=null),this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0},Yt.prototype.addRequest=function(t){1&t.direction?(this.removeRequest(this.requestX),this.requestX=t):(this.removeRequest(this.requestY),this.requestY=t),t.action=this},Yt.prototype.removeRequest=function(t){t&&(this.requestX===t?(this.requestX=null,t.action=null):this.requestY===t&&(this.requestY=null,t.action=null))},Yt.prototype.computeScrollValues=function(){this.scrollLeft=this.requestX?this.requestX.value:Et(this.element),this.scrollTop=this.requestY?this.requestY.value:Lt(this.element)},Yt.prototype.scroll=function(){var t=this.element;t&&(t.scrollTo?t.scrollTo(this.scrollLeft,this.scrollTop):(t.scrollLeft=this.scrollLeft,t.scrollTop=this.scrollTop))},Xt.prototype.pick=function(){return this.pool.pop()||this.createItem()},Xt.prototype.release=function(t){this.releaseItem(t),-1===this.pool.indexOf(t)&&this.pool.push(t)},Xt.prototype.reset=function(){this.pool.length=0};var qt={width:0,height:0,left:0,right:0,top:0,bottom:0},Ht={width:0,height:0,left:0,right:0,top:0,bottom:0};function Gt(){this._isDestroyed=!1,this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,this._items=[],this._actions=[],this._requests={},this._requests[1]={},this._requests[2]={},this._requestOverlapCheck={},this._dragPositions={},this._dragDirections={},this._overlapCheckInterval=150,this._requestPool=new Xt((function(){return new Mt}),(function(t){t.reset()})),this._actionPool=new Xt((function(){return new Yt}),(function(t){t.reset()})),this._readTick=this._readTick.bind(this),this._writeTick=this._writeTick.bind(this)}Gt.AXIS_X=1,Gt.AXIS_Y=2,Gt.FORWARD=4,Gt.BACKWARD=8,Gt.LEFT=9,Gt.RIGHT=5,Gt.UP=10,Gt.DOWN=6,Gt.smoothSpeed=function(t,e,i){return function(s,n,r){var o=0;if(!r.isEnding)if(r.threshold>0){var a=r.threshold-Math.max(0,r.distance);o=t/r.threshold*a}else o=t;var h=r.speed,l=o;return h===o?l:h<o?(l=h+e*(r.deltaTime/1e3),Math.min(o,l)):(l=h-i*(r.deltaTime/1e3),Math.max(o,l))}},Gt.pointerHandle=function(t){var e={left:0,top:0,width:0,height:0},i=t||1;return function(t,s,n,r,o,a,h){return e.left=a-.5*i,e.top=h-.5*i,e.width=i,e.height=i,e}},Gt.prototype._readTick=function(t){this._isDestroyed||(t&&this._tickTime?(this._tickDeltaTime=t-this._tickTime,this._tickTime=t,this._updateRequests(),this._updateActions()):(this._tickTime=t,this._tickDeltaTime=0))},Gt.prototype._writeTick=function(){this._isDestroyed||(this._applyActions(),pt(this._readTick,this._writeTick))},Gt.prototype._startTicking=function(){this._isTicking=!0,pt(this._readTick,this._writeTick)},Gt.prototype._stopTicking=function(){this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,at.remove(ot,st),at.remove(2,nt)},Gt.prototype._getItemHandleRect=function(t,e,i){var s=t._drag;if(e){var n=s._dragMoveEvent||s._dragStartEvent,r=e(t,s._clientX,s._clientY,t._width,t._height,n.clientX,n.clientY);i.left=r.left,i.top=r.top,i.width=r.width,i.height=r.height}else i.left=s._clientX,i.top=s._clientY,i.width=t._width,i.height=t._height;return i.right=i.left+i.width,i.bottom=i.top+i.height,i},Gt.prototype._requestItemScroll=function(t,e,i,s,n,r,o){var a=this._requests[e],h=a[t._id];h?h.element===i&&h.direction===s||h.reset():h=this._requestPool.pick(),h.item=t,h.element=i,h.direction=s,h.threshold=n,h.distance=r,h.maxValue=o,a[t._id]=h},Gt.prototype._cancelItemScroll=function(t,e){var i=this._requests[e],s=i[t._id];s&&(s.action&&s.action.removeRequest(s),this._requestPool.release(s),delete i[t._id])},Gt.prototype._checkItemOverlap=function(t,e,i){var s=Ct(t),n=vt(s.targets)?s.targets(t):s.targets,r=s.threshold,o=s.safeZone;if(!n||!n.length)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));var a=this._dragDirections[t._id],h=a[0],l=a[1];if(!h&&!l)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));for(var d=this._getItemHandleRect(t,s.handle,qt),_=Ht,c=null,u=null,f=!0,p=!0,m=0,v=0,g=null,y=null,b=0,w=0,S=0,D=null,k=-1/0,x=0,E=0,L=null,A=0,T=0,R=null,C=-1/0,I=0,P=0,M=null,Y=0,X=0,O=0;O<n.length;O++)c=n[O],f=e&&h&&2!==c.axis,p=i&&l&&1!==c.axis,v=c.priority||0,(!f||v<k)&&(!p||v<C)||(u=xt(c.element||c),w=f?At(u):-1,S=p?Tt(u):-1,(w||S)&&((m=Ot(d,_=Rt(u,_)))<=0||(f&&v>=k&&w>0&&(v>k||m>E)&&(y=null,g=Pt("number"==typeof c.threshold?c.threshold:r,o,d.width,_.width),5===h?(b=_.right+g.offset-d.right)<=g.value&&Et(u)<w&&(y=5):9===h&&(b=d.left-(_.left-g.offset))<=g.value&&Et(u)>0&&(y=9),null!==y&&(D=u,k=v,x=g.value,E=m,L=y,A=b,T=w)),p&&v>=C&&S>0&&(v>C||m>P)&&(y=null,g=Pt("number"==typeof c.threshold?c.threshold:r,o,d.height,_.height),6===l?(b=_.bottom+g.offset-d.bottom)<=g.value&&Lt(u)<S&&(y=6):10===l&&(b=d.top-(_.top-g.offset))<=g.value&&Lt(u)>0&&(y=10),null!==y&&(R=u,C=v,I=g.value,P=m,M=y,Y=b,X=S)))));e&&(D?this._requestItemScroll(t,1,D,L,x,A,T):this._cancelItemScroll(t,1)),i&&(R?this._requestItemScroll(t,2,R,M,I,Y,X):this._cancelItemScroll(t,2))},Gt.prototype._updateScrollRequest=function(t){for(var e=t.item,i=Ct(e),s=vt(i.targets)?i.targets(e):i.targets,n=s&&s.length||0,r=i.threshold,o=i.safeZone,a=this._getItemHandleRect(e,i.handle,qt),h=Ht,l=null,d=null,_=!1,c=null,u=null,f=null,p=null,m=null,v=0;v<n;v++)if((d=xt((l=s[v]).element||l))===t.element){if(_=!!(1&t.direction)){if(2===l.axis)continue}else if(1===l.axis)continue;if((p=_?At(d):Tt(d))<=0)break;if(Ot(a,h=Rt(d,h))<=0)break;if(c=Pt("number"==typeof l.threshold?l.threshold:r,o,_?a.width:a.height,_?h.width:h.height),(u=9===t.direction?a.left-(h.left-c.offset):5===t.direction?h.right+c.offset-a.right:10===t.direction?a.top-(h.top-c.offset):h.bottom+c.offset-a.bottom)>c.value)break;if(f=_?Et(d):Lt(d),m=4&t.direction?f>=p:f<=0)break;return t.maxValue=p,t.threshold=c.value,t.distance=u,t.isEnding=!1,!0}return!0===i.smoothStop&&t.speed>0?(null===m&&(m=t.hasReachedEnd()),t.isEnding=!m):t.isEnding=!1,t.isEnding},Gt.prototype._updateRequests=function(){for(var t,e,i,s,n,r,o,a=this._items,h=this._requests[1],l=this._requests[2],d=0;d<a.length;d++)t=a[d],n=(s=this._requestOverlapCheck[t._id])>0&&this._tickTime-s>this._overlapCheckInterval,r=!0,(e=h[t._id])&&e.isActive&&(r=!this._updateScrollRequest(e))&&(n=!0,this._cancelItemScroll(t,1)),o=!0,(i=l[t._id])&&i.isActive&&(o=!this._updateScrollRequest(i))&&(n=!0,this._cancelItemScroll(t,2)),n&&(this._requestOverlapCheck[t._id]=0,this._checkItemOverlap(t,r,o))},Gt.prototype._requestAction=function(t,e){for(var i=this._actions,s=1===e,n=null,r=0;r<i.length;r++){if(n=i[r],t.element===n.element){if(s?n.requestX:n.requestY)return void this._cancelItemScroll(t.item,e);break}n=null}n||(n=this._actionPool.pick()),n.element=t.element,n.addRequest(t),t.tick(this._tickDeltaTime),i.push(n)},Gt.prototype._updateActions=function(){var t,e,i,s,n=this._items,r=this._requests,o=this._actions;for(s=0;s<n.length;s++)t=n[s]._id,e=r[1][t],i=r[2][t],e&&this._requestAction(e,1),i&&this._requestAction(i,2);for(s=0;s<o.length;s++)o[s].computeScrollValues()},Gt.prototype._applyActions=function(){var t,e=this._actions,i=this._items;if(e.length){for(t=0;t<e.length;t++)e[t].scroll(),this._actionPool.release(e[t]);for(e.length=0,t=0;t<i.length;t++)(s=i[t])._drag&&s._drag._prepareScroll();var s;for(t=0;t<i.length;t++)It(i[t])}},Gt.prototype._updateDragDirection=function(t){var e=this._dragPositions[t._id],i=this._dragDirections[t._id],s=t._drag._left,n=t._drag._top;if(e.length){var r=e[0],o=e[1];i[0]=s>r?5:s<r?9:i[0]||0,i[1]=n>o?6:n<o?10:i[1]||0}e[0]=s,e[1]=n},Gt.prototype.addItem=function(t){this._isDestroyed||-1===this._items.indexOf(t)&&(this._items.push(t),this._requestOverlapCheck[t._id]=this._tickTime,this._dragDirections[t._id]=[0,0],this._dragPositions[t._id]=[],this._isTicking||this._startTicking())},Gt.prototype.updateItem=function(t){this._isDestroyed||this._dragDirections[t._id]&&(this._updateDragDirection(t),this._requestOverlapCheck[t._id]||(this._requestOverlapCheck[t._id]=this._tickTime))},Gt.prototype.removeItem=function(t){if(!this._isDestroyed){var e=this._items.indexOf(t);if(-1!==e){var i=t._id;this._requests[1][i]&&(this._cancelItemScroll(t,1),delete this._requests[1][i]),this._requests[2][i]&&(this._cancelItemScroll(t,2),delete this._requests[2][i]),delete this._requestOverlapCheck[i],delete this._dragPositions[i],delete this._dragDirections[i],this._items.splice(e,1),this._isTicking&&!this._items.length&&this._stopTicking()}}},Gt.prototype.isItemScrollingX=function(t){var e=this._requests[1][t._id];return!(!e||!e.isActive)},Gt.prototype.isItemScrollingY=function(t){var e=this._requests[2][t._id];return!(!e||!e.isActive)},Gt.prototype.isItemScrolling=function(t){return this.isItemScrollingX(t)||this.isItemScrollingY(t)},Gt.prototype.destroy=function(){if(!this._isDestroyed){for(var t=this._items.slice(0),e=0;e<t.length;e++)this.removeItem(t[e]);this._actions.length=0,this._requestPool.reset(),this._actionPool.reset(),this._isDestroyed=!0}};var Nt=window.Element.prototype,Bt=Nt.matches||Nt.matchesSelector||Nt.webkitMatchesSelector||Nt.mozMatchesSelector||Nt.msMatchesSelector||Nt.oMatchesSelector||function(){return!1};function Wt(t,e){return Bt.call(t,e)}function zt(t,e){e&&(t.classList?t.classList.add(e):Wt(t,"."+e)||(t.className+=" "+e))}var Ft=[];function jt(t,e,i){var s="number"==typeof i?i:-1;s<0&&(s=t.length-s+1),t.splice.apply(t,Ft.concat(s,0,e)),Ft.length=0}function Vt(t,e,i){var s=Math.max(0,t.length-1+(i||0));return e>s?s:e<0?Math.max(s+e+1,0):e}function Qt(t,e,i){if(!(t.length<2)){var s=Vt(t,e),n=Vt(t,i);s!==n&&t.splice(n,0,t.splice(s,1)[0])}}function Ut(t,e,i){if(!(t.length<2)){var s,n=Vt(t,e),r=Vt(t,i);n!==r&&(s=t[n],t[n]=t[r],t[r]=s)}}var Zt=L(document.documentElement.style,"transform")||"transform",Jt=/([A-Z])/g,$t=/^(webkit-|moz-|ms-|o-)/,Kt=/^(-m-s-)/;function te(t){var e=t.replace(Jt,"-$1").toLowerCase();return e=(e=e.replace($t,"-$1")).replace(Kt,"-ms-")}var ee=te(Zt),ie="none",se="inline",ne="none",re="display";function oe(t){var e=yt(t,ee);if(!e||e===ie)return!1;var i=yt(t,re);return i!==se&&i!==ne}function ae(t){for(var e=document,i=t||e;i&&i!==e&&"static"===yt(i,"position")&&!oe(i);)i=i.parentElement||e;return i}var he={},le={},de={};function _e(t,e){var i,s=e||{};return s.left=0,s.top=0,t===document?s:(s.left=window.pageXOffset||0,s.top=window.pageYOffset||0,t.self===window.self||(i=t.getBoundingClientRect(),s.left+=i.left,s.top+=i.top,s.left+=bt(t,"border-left-width"),s.top+=bt(t,"border-top-width")),s)}function ce(t,e,i){return de.left=0,de.top=0,t===e||i&&(t=ae(t))===(e=ae(e))||(_e(t,he),_e(e,le),de.left=le.left-he.left,de.top=le.top-he.top),de}function ue(t){return"auto"===t||"scroll"===t||"overlay"===t}function fe(t){return ue(yt(t,"overflow"))||ue(yt(t,"overflow-x"))||ue(yt(t,"overflow-y"))}function pe(t,e){for(e=e||[];t&&t!==document;)t.getRootNode&&t instanceof DocumentFragment?t=t.getRootNode().host:(fe(t)&&e.push(t),t=t.parentNode);return e.push(window),e}var me={},ve=/^matrix3d/,ge=/([^,]*,){4}/,ye=/([^,]*,){12}/,be=/[^,]*,/;function we(t){me.x=0,me.y=0;var e=yt(t,ee);if(!e||"none"===e)return me;var i=ve.test(e),s=e.replace(i?ye:ge,""),n=s.replace(be,"");return me.x=parseFloat(s)||0,me.y=parseFloat(n)||0,me}function Se(t,e){e&&(t.classList?t.classList.remove(e):Wt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim()))}var De,ke,xe,Ee,Le=/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1,Ae=0,Te=!!A()&&{passive:!0};function Re(t){var e=t._element,i=t.getGrid(),s=i._settings;this._item=t,this._gridId=i._id,this._isDestroyed=!1,this._isMigrating=!1,this._startPredicate=vt(s.dragStartPredicate)?s.dragStartPredicate:Re.defaultStartPredicate,this._startPredicateState=Ae,this._startPredicateResult=void 0,this._isSortNeeded=!1,this._sortTimer=void 0,this._blockedSortIndex=null,this._sortX1=0,this._sortX2=0,this._sortY1=0,this._sortY2=0,this._reset(),this._preStartCheck=this._preStartCheck.bind(this),this._preEndCheck=this._preEndCheck.bind(this),this._onScroll=this._onScroll.bind(this),this._prepareStart=this._prepareStart.bind(this),this._applyStart=this._applyStart.bind(this),this._prepareMove=this._prepareMove.bind(this),this._applyMove=this._applyMove.bind(this),this._prepareScroll=this._prepareScroll.bind(this),this._applyScroll=this._applyScroll.bind(this),this._handleSort=this._handleSort.bind(this),this._handleSortDelayed=this._handleSortDelayed.bind(this),this._handle=s.dragHandle&&e.querySelector(s.dragHandle)||e,this._dragger=new q(this._handle,s.dragCssProps),this._dragger.on("start",this._preStartCheck),this._dragger.on("move",this._preStartCheck),this._dragger.on("cancel",this._preEndCheck),this._dragger.on("end",this._preEndCheck)}function Ce(t,e){var i,s,n={};if(Array.isArray(e))for(s=0;s<e.length;s++)n[i=e[s]]=yt(t,te(i));else for(i in e)n[i]=yt(t,te(i));return n}Re.autoScroller=new Gt,Re.defaultStartPredicate=function(t,e,i){var s=t._drag;if(e.isFirst&&e.srcEvent.button)return!1;if(!Le&&e.isFirst&&!0===e.srcEvent.isTrusted&&!1===e.srcEvent.defaultPrevented&&!1===e.srcEvent.cancelable)return!1;if(!e.isFinal){var n=s._startPredicateData;if(!n){var r=i||s._getGrid()._settings.dragStartPredicate||{};s._startPredicateData=n={distance:Math.max(r.distance,0)||0,delay:Math.max(r.delay,0)||0}}return n.delay&&(n.event=e,n.delayTimer||(n.delayTimer=window.setTimeout((function(){n.delay=0,s._resolveStartPredicate(n.event)&&(s._forceResolveStartPredicate(n.event),s._resetStartPredicate())}),n.delay))),s._resolveStartPredicate(e)}s._finishStartPredicate(e)},Re.defaultSortPredicate=(De={},ke={},xe={},Ee=[],function(t,e){var i=t._drag,s=i._getGrid(),o=e&&"number"==typeof e.threshold?e.threshold:50,a=e&&e.action===n?n:r,h=e&&e.migrateAction===n?n:r;o=Math.min(Math.max(o,1),100),De.width=t._width,De.height=t._height,De.left=i._clientX,De.top=i._clientY;var l=function(t,e,i){var s,n,r,o,a,h,l,d,_,c,u=null,f=e._settings.dragSort,p=-1;if(!0===f?(Ee[0]=e,n=Ee):vt(f)&&(n=f.call(e,t)),!n||!Array.isArray(n)||!n.length)return u;for(c=0;c<n.length;c++)if(!(r=n[c])._isDestroyed){for(r._updateBoundingRect(),h=Math.max(0,r._left),l=Math.max(0,r._top),d=Math.min(window.innerWidth,r._right),_=Math.min(window.innerHeight,r._bottom),o=r._element.parentNode;o&&o!==document&&o!==document.documentElement&&o!==document.body;)if(o.getRootNode&&o instanceof DocumentFragment)o=o.getRootNode().host;else{if("visible"!==yt(o,"overflow")&&(a=o.getBoundingClientRect(),h=Math.max(h,a.left),l=Math.max(l,a.top),d=Math.min(d,a.right),_=Math.min(_,a.bottom)),"fixed"===yt(o,"position"))break;o=o.parentNode}h>=d||l>=_||(ke.left=h,ke.top=l,ke.width=d-h,ke.height=_-l,(s=Ot(De,ke))>i&&s>p&&(p=s,u=r))}return Ee.length=0,u}(t,s,o);if(!l)return null;var d,_,c,u=t.getGrid()!==l,f=0,p=0,m=0,v=-1,g=!1;for(l===s?(De.left=i._gridX+t._marginLeft,De.top=i._gridY+t._marginTop):(l._updateBorders(1,0,1,0),f=l._left+l._borderLeft,p=l._top+l._borderTop),c=0;c<l._items.length;c++)(d=l._items[c])._isActive&&d!==t&&(g=!0,ke.width=d._width,ke.height=d._height,ke.left=d._left+d._marginLeft+f,ke.top=d._top+d._marginTop+p,(_=Ot(De,ke))>m&&(v=c,m=_));return u&&m<o&&(v=g?v:0,m=o),m>=o?(xe.grid=l,xe.index=v,xe.action=u?h:a,xe):null}),Re.prototype.stop=function(){if(this._isActive)if(this._isMigrating)this._finishMigration();else{var t=this._item,e=t._id;if(Re.autoScroller.removeItem(t),dt(e),_t(e),ct(e),this._cancelSort(),this._isStarted){this._unbindScrollListeners();var i=t._element,s=this._getGrid(),n=s._settings.itemDraggingClass;i.parentNode!==s._element&&(s._element.appendChild(i),t._setTranslate(this._gridX,this._gridY),n&&i.clientWidth),Se(i,n)}this._reset()}},Re.prototype.sort=function(t){var e=this._item;this._isActive&&e._isActive&&this._dragMoveEvent&&(!0===t?this._handleSort():ut(e._id,this._handleSort))},Re.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._dragger.destroy(),Re.autoScroller.removeItem(this._item),this._isDestroyed=!0)},Re.prototype._getGrid=function(){return i[this._gridId]||null},Re.prototype._reset=function(){this._isActive=!1,this._isStarted=!1,this._container=null,this._containingBlock=null,this._dragStartEvent=null,this._dragMoveEvent=null,this._dragPrevMoveEvent=null,this._scrollEvent=null,this._scrollers=[],this._left=0,this._top=0,this._gridX=0,this._gridY=0,this._clientX=0,this._clientY=0,this._scrollDiffX=0,this._scrollDiffY=0,this._moveDiffX=0,this._moveDiffY=0,this._containerDiffX=0,this._containerDiffY=0},Re.prototype._bindScrollListeners=function(){var t,e,i=this._getGrid()._element,s=this._container,n=this._scrollers;if(n.length=0,pe(this._item._element.parentNode,n),s!==i)for(pe(i,t=[]),e=0;e<t.length;e++)n.indexOf(t[e])<0&&n.push(t[e]);for(e=0;e<n.length;e++)n[e].addEventListener("scroll",this._onScroll,Te)},Re.prototype._unbindScrollListeners=function(){var t,e=this._scrollers;for(t=0;t<e.length;t++)e[t].removeEventListener("scroll",this._onScroll,Te);e.length=0},Re.prototype._resolveStartPredicate=function(t){var e=this._startPredicateData;if(!(t.distance<e.distance||e.delay))return this._resetStartPredicate(),!0},Re.prototype._forceResolveStartPredicate=function(t){this._isDestroyed||1!==this._startPredicateState||(this._startPredicateState=2,this._onStart(t))},Re.prototype._finishStartPredicate=function(t){var e=this._item._element,i=Math.abs(t.deltaX)<2&&Math.abs(t.deltaY)<2&&t.deltaTime<200;this._resetStartPredicate(),i&&function(t){if("a"!==t.tagName.toLowerCase())return;var e=t.getAttribute("href");if(!e)return;var i=t.getAttribute("target");i&&"_self"!==i?window.open(e,i):window.location.href=e}(e)},Re.prototype._resetHeuristics=function(t,e){this._blockedSortIndex=null,this._sortX1=this._sortX2=t,this._sortY1=this._sortY2=e},Re.prototype._checkHeuristics=function(t,e){var i=this._getGrid()._settings.dragSortHeuristics,s=i.minDragDistance;if(s<=0)return this._blockedSortIndex=null,!0;var n=t-this._sortX2,r=e-this._sortY2,o=s>3&&i.minBounceBackAngle>0;if(o||(this._blockedSortIndex=null),Math.abs(n)>s||Math.abs(r)>s){if(o){var a=Math.atan2(n,r),h=Math.atan2(this._sortX2-this._sortX1,this._sortY2-this._sortY1),l=Math.atan2(Math.sin(a-h),Math.cos(a-h));Math.abs(l)>i.minBounceBackAngle&&(this._blockedSortIndex=null)}return this._sortX1=this._sortX2,this._sortY1=this._sortY2,this._sortX2=t,this._sortY2=e,!0}return!1},Re.prototype._resetStartPredicate=function(){var t=this._startPredicateData;t&&(t.delayTimer&&(t.delayTimer=window.clearTimeout(t.delayTimer)),this._startPredicateData=null)},Re.prototype._handleSort=function(){if(this._isActive){var t=this._getGrid()._settings;if(!t.dragSort||!t.dragAutoScroll.sortDuringScroll&&Re.autoScroller.isItemScrolling(this._item))return this._sortX1=this._sortX2=this._gridX,this._sortY1=this._sortY2=this._gridY,this._isSortNeeded=!0,void(void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)));var e=this._checkHeuristics(this._gridX,this._gridY);if(this._isSortNeeded||e){var i=t.dragSortHeuristics.sortInterval;i<=0||this._isSortNeeded?(this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),this._checkOverlap()):void 0===this._sortTimer&&(this._sortTimer=window.setTimeout(this._handleSortDelayed,i))}}},Re.prototype._handleSortDelayed=function(){this._isSortNeeded=!0,this._sortTimer=void 0,ut(this._item._id,this._handleSort)},Re.prototype._cancelSort=function(){var t;this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),t=this._item._id,at.remove(1,K+t)},Re.prototype._finishSort=function(){var t=this._getGrid()._settings.dragSort&&(this._isSortNeeded||void 0!==this._sortTimer);this._cancelSort(),t&&this._checkOverlap()},Re.prototype._checkOverlap=function(){if(this._isActive){var t,e,i,s,o,a,h,l,d=this._item,_=this._getGrid()._settings;(t=vt(_.dragSortPredicate)?_.dragSortPredicate(d,this._dragMoveEvent):Re.defaultSortPredicate(d,_.dragSortPredicate))&&"number"==typeof t.index&&(h=t.action===n?n:r,l=(e=d.getGrid())!==(s=t.grid||e),i=e._items.indexOf(d),o=Vt(s._items,t.index,l&&h===r?1:0),(l||o!==this._blockedSortIndex)&&(l?(this._blockedSortIndex=null,a=s._items[o],e._hasListeners(p)&&e._emit(p,{item:d,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),s._hasListeners(v)&&s._emit(v,{item:d,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),d._gridId=s._id,this._isMigrating=d._gridId!==this._gridId,e._items.splice(i,1),jt(s._items,d,o),d._sortData=null,e._hasListeners(f)&&e._emit(f,{item:d,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),s._hasListeners(m)&&s._emit(m,{item:d,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),h===n&&a&&a.isActive()&&s._items.indexOf(a)>-1&&s.send(a,e,i,{appendTo:this._container||document.body,layoutSender:!1,layoutReceiver:!1}),e.layout(),s.layout()):i!==o&&(this._blockedSortIndex=i,(h===n?Ut:Qt)(e._items,i,o),e._hasListeners(u)&&e._emit(u,{item:d,fromIndex:i,toIndex:o,action:h}),e.layout())))}},Re.prototype._finishMigration=function(){var t,e,i=this._item,s=i._dragRelease,n=i._element,r=i._isActive,o=i.getGrid(),a=o._element,h=o._settings,l=h.dragContainer||a,d=this._getGrid()._settings,_=n.parentNode,c=r?d.itemVisibleClass:d.itemHiddenClass,u=r?h.itemVisibleClass:h.itemHiddenClass;this._isMigrating=!1,this.destroy(),d.itemClass!==h.itemClass&&(Se(n,d.itemClass),zt(n,h.itemClass)),c!==u&&(Se(n,c),zt(n,u)),l!==_&&(l.appendChild(n),e=ce(_,l,!0),(t=we(n)).x-=e.left,t.y-=e.top),i._refreshDimensions(),e=ce(l,a,!0),s._containerDiffX=e.left,s._containerDiffY=e.top,i._drag=h.dragEnabled?new Re(i):null,l!==_&&i._setTranslate(t.x,t.y),i._visibility.setStyles(r?h.visibleStyles:h.hiddenStyles),s.start()},Re.prototype._preStartCheck=function(t){this._startPredicateState===Ae&&(this._startPredicateState=1),1===this._startPredicateState?(this._startPredicateResult=this._startPredicate(this._item,t),!0===this._startPredicateResult?(this._startPredicateState=2,this._onStart(t)):!1===this._startPredicateResult&&(this._resetStartPredicate(t),this._dragger._reset(),this._startPredicateState=Ae)):2===this._startPredicateState&&this._isActive&&this._onMove(t)},Re.prototype._preEndCheck=function(t){var e=2===this._startPredicateState;this._startPredicate(this._item,t),this._startPredicateState=Ae,e&&this._isActive&&(this._isStarted?this._onEnd(t):this.stop())},Re.prototype._onStart=function(t){var e,i,s,n=this._item;n._isActive&&(this._isActive=!0,this._dragStartEvent=t,Re.autoScroller.addItem(n),e=n._id,i=this._prepareStart,s=this._applyStart,at.add(ot,V+e,i),at.add(2,Q+e,s))},Re.prototype._prepareStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid(),s=i._settings,n=i._element,r=s.dragContainer||n,o=ae(r),a=we(e),h=e.getBoundingClientRect(),l=r!==n;if(this._container=r,this._containingBlock=o,this._clientX=h.left,this._clientY=h.top,this._left=this._gridX=a.x,this._top=this._gridY=a.y,this._scrollDiffX=this._scrollDiffY=0,this._moveDiffX=this._moveDiffY=0,this._resetHeuristics(this._gridX,this._gridY),l){var d=ce(o,n);this._containerDiffX=d.left,this._containerDiffY=d.top}}}},Re.prototype._applyStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=this._getGrid(),i=t._element,s=t._dragRelease,n=t._migrate,r=this._container!==e._element;t.isPositioning()&&t._layout.stop(!0,this._left,this._top),n._isActive&&(this._left-=n._containerDiffX,this._top-=n._containerDiffY,this._gridX-=n._containerDiffX,this._gridY-=n._containerDiffY,n.stop(!0,this._left,this._top)),t.isReleasing()&&s._reset(),e._settings.dragPlaceholder.enabled&&t._dragPlaceholder.create(),this._isStarted=!0,e._emit("dragInit",t,this._dragStartEvent),r&&(i.parentNode===this._container?(this._gridX-=this._containerDiffX,this._gridY-=this._containerDiffY):(this._left+=this._containerDiffX,this._top+=this._containerDiffY,this._container.appendChild(i),t._setTranslate(this._left,this._top))),zt(i,e._settings.itemDraggingClass),this._bindScrollListeners(),e._emit("dragStart",t,this._dragStartEvent)}}},Re.prototype._onMove=function(t){var e,i,s,n=this._item;n._isActive?(this._dragMoveEvent=t,e=n._id,i=this._prepareMove,s=this._applyMove,at.add(ot,U+e,i),at.add(2,Z+e,s),ut(n._id,this._handleSort)):this.stop()},Re.prototype._prepareMove=function(){if(this._isActive&&this._item._isActive){var t=this._getGrid()._settings.dragAxis,e=this._dragMoveEvent,i=this._dragPrevMoveEvent||this._dragStartEvent||e;if("y"!==t){var s=e.clientX-i.clientX;this._left=this._left-this._moveDiffX+s,this._gridX=this._gridX-this._moveDiffX+s,this._clientX=this._clientX-this._moveDiffX+s,this._moveDiffX=s}if("x"!==t){var n=e.clientY-i.clientY;this._top=this._top-this._moveDiffY+n,this._gridY=this._gridY-this._moveDiffY+n,this._clientY=this._clientY-this._moveDiffY+n,this._moveDiffY=n}this._dragPrevMoveEvent=e}},Re.prototype._applyMove=function(){if(this._isActive){var t=this._item;t._isActive&&(this._moveDiffX=this._moveDiffY=0,t._setTranslate(this._left,this._top),this._getGrid()._emit("dragMove",t,this._dragMoveEvent),Re.autoScroller.updateItem(t))}},Re.prototype._onScroll=function(t){var e,i,s,n=this._item;n._isActive?(this._scrollEvent=t,e=n._id,i=this._prepareScroll,s=this._applyScroll,at.add(ot,J+e,i),at.add(2,$+e,s),ut(n._id,this._handleSort)):this.stop()},Re.prototype._prepareScroll=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid()._element,s=e.getBoundingClientRect();if(this._container!==i){var n=ce(this._containingBlock,i);this._containerDiffX=n.left,this._containerDiffY=n.top}var r=this._clientX-this._moveDiffX-s.left;this._left=this._left-this._scrollDiffX+r,this._scrollDiffX=r;var o=this._clientY-this._moveDiffY-s.top;this._top=this._top-this._scrollDiffY+o,this._scrollDiffY=o,this._gridX=this._left-this._containerDiffX,this._gridY=this._top-this._containerDiffY}}},Re.prototype._applyScroll=function(){if(this._isActive){var t=this._item;t._isActive&&(this._scrollDiffX=this._scrollDiffY=0,t._setTranslate(this._left,this._top),this._getGrid()._emit("dragScroll",t,this._scrollEvent))}},Re.prototype._onEnd=function(t){var e=this._item,i=e._element,s=this._getGrid(),n=s._settings,r=e._dragRelease;e._isActive?(dt(e._id),_t(e._id),ct(e._id),this._finishSort(),this._unbindScrollListeners(),r._containerDiffX=this._containerDiffX,r._containerDiffY=this._containerDiffY,this._reset(),Se(i,n.itemDraggingClass),Re.autoScroller.removeItem(e),s._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():r.start()):this.stop()};var Ie=/^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/,Pe={};function Me(t){var e=Pe[t];return e||((e=t.replace(Ie,""))!==t&&(e=e[0].toLowerCase()+e.slice(1)),Pe[t]=e,e)}function Ye(t,e){for(var i in e)t.style[i]=e[i]}var Xe,Oe,qe=!(!Element||!vt(Element.prototype.animate)),He=!!(Element&&(Xe=Element.prototype.animate,Oe=window.Symbol,Xe&&vt(Oe)&&vt(Oe.toString)&&Oe(Xe).toString().indexOf("[native code]")>-1));function Ge(t){this._element=t,this._animation=null,this._duration=0,this._easing="",this._callback=null,this._props=[],this._values=[],this._isDestroyed=!1,this._onFinish=this._onFinish.bind(this)}function Ne(t,e){var i={};for(var s in t)i[e?s:Me(s)]=t[s];return i}function Be(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function We(t){this._item=t,this._animation=new Ge,this._element=null,this._className="",this._didMigrate=!1,this._resetAfterLayout=!1,this._left=0,this._top=0,this._transX=0,this._transY=0,this._nextTransX=0,this._nextTransY=0,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this),this._updateDimensions=this._updateDimensions.bind(this),this._onLayoutStart=this._onLayoutStart.bind(this),this._onLayoutEnd=this._onLayoutEnd.bind(this),this._onReleaseEnd=this._onReleaseEnd.bind(this),this._onMigrate=this._onMigrate.bind(this),this._onHide=this._onHide.bind(this)}function ze(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0}Ge.prototype.start=function(t,e,i){if(!this._isDestroyed){var s=this._element,n=i||{};if(!qe)return Ye(s,e),this._callback=vt(n.onFinish)?n.onFinish:null,void this._onFinish();var r,o,a,h=this._animation,l=this._props,d=this._values,_=n.duration||300,c=n.easing||"ease",u=!1;if(h&&(o=0,_===this._duration&&c===this._easing||(u=!0),!u)){for(r in e)if(++o,-1===(a=l.indexOf(r))||e[r]!==d[a]){u=!0;break}o!==l.length&&(u=!0)}if(u&&h.cancel(),this._callback=vt(n.onFinish)?n.onFinish:null,!h||u){for(r in l.length=d.length=0,e)l.push(r),d.push(e[r]);this._duration=_,this._easing=c,this._animation=s.animate([Ne(t,He),Ne(e,He)],{duration:_,easing:c}),this._animation.onfinish=this._onFinish,Ye(s,e)}}},Ge.prototype.stop=function(){!this._isDestroyed&&this._animation&&(this._animation.cancel(),this._animation=this._callback=null,this._props.length=this._values.length=0)},Ge.prototype.getCurrentStyles=function(){return Ce(element,currentProps)},Ge.prototype.isAnimating=function(){return!!this._animation},Ge.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._element=null,this._isDestroyed=!0)},Ge.prototype._onFinish=function(){var t=this._callback;this._animation=this._callback=null,this._props.length=this._values.length=0,t&&t()},We.prototype._updateDimensions=function(){this.isActive()&&Ye(this._element,{width:this._item._width+"px",height:this._item._height+"px"})},We.prototype._onLayoutStart=function(t,e){var i=this._item;if(-1!==t.indexOf(i)){var s=i._left,n=i._top,r=this._left,o=this._top;if(this._left=s,this._top=n,e||this._didMigrate||r!==s||o!==n){var a,h,l,d=s+i._marginLeft,_=n+i._marginTop,c=i.getGrid();if(!(!e&&c._settings.layoutDuration>0)||this._didMigrate)return ft(i._id),this._element.style[Zt]=Be(d,_),this._animation.stop(),void(this._didMigrate&&(c.getElement().appendChild(this._element),this._didMigrate=!1));this._nextTransX=d,this._nextTransY=_,a=i._id,h=this._setupAnimation,l=this._startAnimation,at.add(ot,tt+a,h),at.add(2,et+a,l)}}else this.reset()},We.prototype._setupAnimation=function(){if(this.isActive()){var t=we(this._element);this._transX=t.x,this._transY=t.y}},We.prototype._startAnimation=function(){if(this.isActive()){var t=this._animation,e=this._transX,i=this._transY,s=this._nextTransX,n=this._nextTransY;if(e!==s||i!==n){var r=this._item.getGrid()._settings,o={},a={};o[Zt]=Be(e,i),a[Zt]=Be(s,n),t.start(o,a,{duration:r.layoutDuration,easing:r.layoutEasing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&(this._element.style[Zt]=Be(s,n),t.stop())}},We.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},We.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animation.isAnimating())return void this.reset();this._resetAfterLayout=!0}},We.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off(g,this._onReleaseEnd),e.off(o,this._onLayoutStart),e.off(p,this._onMigrate),e.off(d,this._onHide),i.on(g,this._onReleaseEnd),i.on(o,this._onLayoutStart),i.on(p,this._onMigrate),i.on(d,this._onHide),this._didMigrate=!0}},We.prototype._onHide=function(t){t.indexOf(this._item)>-1&&this.reset()},We.prototype.create=function(){if(this.isActive())this._resetAfterLayout=!1;else{var t,e=this._item,i=e.getGrid(),s=i._settings,n=this._animation;this._left=e._left,this._top=e._top,t=vt(s.dragPlaceholder.createElement)?s.dragPlaceholder.createElement(e):document.createElement("div"),this._element=t,n._element=t,this._className=s.itemPlaceholderClass||"",this._className&&zt(t,this._className),Ye(t,{position:"absolute",left:"0px",top:"0px",width:e._width+"px",height:e._height+"px"}),t.style[Zt]=Be(e._left+e._marginLeft,e._top+e._marginTop),i.on(o,this._onLayoutStart),i.on(g,this._onReleaseEnd),i.on(p,this._onMigrate),i.on(d,this._onHide),vt(s.dragPlaceholder.onCreate)&&s.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},We.prototype.reset=function(){if(this.isActive()){var t,e=this._element,i=this._item,s=i.getGrid(),n=s._settings,r=this._animation;this._resetAfterLayout=!1,ft(i._id),t=i._id,at.remove(2,it+t),r.stop(),r._element=null,s.off(g,this._onReleaseEnd),s.off(o,this._onLayoutStart),s.off(p,this._onMigrate),s.off(d,this._onHide),this._className&&(Se(e,this._className),this._className=""),e.parentNode.removeChild(e),this._element=null,vt(n.dragPlaceholder.onRemove)&&n.dragPlaceholder.onRemove(i,e)}},We.prototype.isActive=function(){return!!this._element},We.prototype.getElement=function(){return this._element},We.prototype.updateDimensions=function(){var t,e;this.isActive()&&(t=this._item._id,e=this._updateDimensions,at.add(2,it+t,e))},We.prototype.destroy=function(){this.reset(),this._animation.destroy(),this._item=this._animation=null},ze.prototype.start=function(){if(!this._isDestroyed&&!this._isActive){var t=this._item,e=t.getGrid(),i=e._settings;this._isActive=!0,zt(t._element,i.itemReleasingClass),i.dragRelease.useDragContainer||this._placeToGrid(),e._emit("dragReleaseStart",t),e._nextLayoutData||t._layout.start(!1)}},ze.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item,n=s.getGrid();t||void 0!==e&&void 0!==i||(e=s._left,i=s._top);var r=this._placeToGrid(e,i);this._reset(r),t||n._emit(g,s)}},ze.prototype.isJustReleased=function(){return this._isActive&&!1===this._isPositioningStarted},ze.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},ze.prototype._placeToGrid=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=i.getGrid()._element,r=!1;if(s.parentNode!==n){if(void 0===t||void 0===e){var o=we(s);t=o.x-this._containerDiffX,e=o.y-this._containerDiffY}n.appendChild(s),i._setTranslate(t,e),r=!0}return this._containerDiffX=0,this._containerDiffY=0,r}},ze.prototype._reset=function(t){if(!this._isDestroyed){var e=this._item,i=e.getGrid()._settings.itemReleasingClass;this._isActive=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0,i&&(t&&e._element.clientWidth,Se(e._element,i))}};function Fe(t){var e=t._element,i=e.style;this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isInterrupted=!1,this._currentStyles={},this._targetStyles={},this._nextLeft=0,this._nextTop=0,this._offsetLeft=0,this._offsetTop=0,this._skipNextAnimation=!1,this._animOptions={onFinish:this._finish.bind(this),duration:0,easing:0},i.left="0px",i.top="0px",t._setTranslate(0,0),this._animation=new Ge(e),this._queue="layout-"+t._id,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this)}function je(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}function Ve(t){var e=t._isActive,i=t._element,s=i.children[0],n=t.getGrid()._settings;if(!s)throw new Error("No valid child element found within item element.");this._item=t,this._isDestroyed=!1,this._isHidden=!e,this._isHiding=!1,this._isShowing=!1,this._childElement=s,this._currentStyleProps=[],this._animation=new Ge(s),this._queue="visibility-"+t._id,this._finishShow=this._finishShow.bind(this),this._finishHide=this._finishHide.bind(this),i.style.display=e?"":"none",zt(i,e?n.itemVisibleClass:n.itemHiddenClass),this.setStyles(e?n.visibleStyles:n.hiddenStyles)}Fe.prototype.start=function(t,e){if(!this._isDestroyed){var i,s,n,r=this._item,o=r._dragRelease,a=r.getGrid()._settings,h=this._isActive,l=o.isJustReleased(),d=l?a.dragRelease.duration:a.layoutDuration,_=l?a.dragRelease.easing:a.layoutEasing,c=!t&&!this._skipNextAnimation&&d>0;if(h&&(ht(r._id),r._emitter.burst(this._queue,!0,r)),l&&(o._isPositioningStarted=!0),vt(e)&&r._emitter.on(this._queue,e),this._skipNextAnimation=!1,!c)return this._updateOffsets(),r._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._animation.isAnimating()&&(this._animation._animation.onfinish=null),this._isActive=!0,this._animOptions.easing=_,this._animOptions.duration=d,this._isInterrupted=h,i=r._id,s=this._setupAnimation,n=this._startAnimation,at.add(ot,W+i,s),at.add(2,z+i,n)}},Fe.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item;if(ht(s._id),this._animation.isAnimating()){if(void 0===e||void 0===i){var n=we(s._element);e=n.x,i=n.y}s._setTranslate(e,i),this._animation.stop()}Se(s._element,s.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&s._emitter.burst(this._queue,!0,s)}},Fe.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item._element.style;this.stop(!0,0,0),this._item._emitter.clear(this._queue),this._animation.destroy(),t[Zt]="",t.left="",t.top="",this._item=null,this._currentStyles=null,this._targetStyles=null,this._animOptions=null,this._isDestroyed=!0}},Fe.prototype._updateOffsets=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;this._offsetLeft=i._isActive?i._containerDiffX:e._isActive?e._containerDiffX:0,this._offsetTop=i._isActive?i._containerDiffY:e._isActive?e._containerDiffY:0,this._nextLeft=this._item._left+this._offsetLeft,this._nextTop=this._item._top+this._offsetTop}},Fe.prototype._finish=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;t._tX=this._nextLeft,t._tY=this._nextTop,this._isActive&&(this._isActive=!1,Se(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),t._emitter.burst(this._queue,!1,t)}},Fe.prototype._setupAnimation=function(){var t=this._item;if(void 0===t._tX||void 0===t._tY){var e=we(t._element);t._tX=e.x,t._tY=e.y}},Fe.prototype._startAnimation=function(){var t=this._item,e=t.getGrid()._settings,i=this._animOptions.duration<=0;this._updateOffsets();var s=Math.abs(t._left-(t._tX-this._offsetLeft)),n=Math.abs(t._top-(t._tY-this._offsetTop));if(i||s<2&&n<2)return(s||n||this._isInterrupted)&&t._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._isInterrupted||zt(t._element,e.itemPositioningClass),this._currentStyles[Zt]=Be(t._tX,t._tY),this._targetStyles[Zt]=Be(this._nextLeft,this._nextTop),t._tX=t._tY=void 0,this._animation.start(this._currentStyles,this._targetStyles,this._animOptions)},je.prototype.start=function(t,e,i){if(!this._isDestroyed){var s,n,r,o,a,h,l,d,_,c,u=this._item,g=u._element,y=u.isActive(),b=u.isVisible(),w=u.getGrid(),S=w._settings,D=t._settings,k=t._element,x=t._items,E=w._items.indexOf(u),L=i||document.body;if("number"==typeof e)s=Vt(x,e,1);else{if(!(n=t.getItem(e)))return;s=x.indexOf(n)}(u.isPositioning()||this._isActive||u.isReleasing())&&(l=(h=we(g)).x,d=h.y),u.isPositioning()&&u._layout.stop(!0,l,d),this._isActive&&(l-=this._containerDiffX,d-=this._containerDiffY,this.stop(!0,l,d)),u.isReleasing()&&(l-=u._dragRelease._containerDiffX,d-=u._dragRelease._containerDiffY,u._dragRelease.stop(!0,l,d)),u._visibility.stop(!0),u._drag&&u._drag.destroy(),w._hasListeners(p)&&w._emit(p,{item:u,fromGrid:w,fromIndex:E,toGrid:t,toIndex:s}),t._hasListeners(v)&&t._emit(v,{item:u,fromGrid:w,fromIndex:E,toGrid:t,toIndex:s}),S.itemClass!==D.itemClass&&(Se(g,S.itemClass),zt(g,D.itemClass)),(_=b?S.itemVisibleClass:S.itemHiddenClass)!==(c=b?D.itemVisibleClass:D.itemHiddenClass)&&(Se(g,_),zt(g,c)),w._items.splice(E,1),jt(x,u,s),u._gridId=t._id,y?L!==(r=g.parentNode)&&(L.appendChild(g),o=ce(L,r,!0),h||(l=(h=we(g)).x,d=h.y),u._setTranslate(l+o.left,d+o.top)):k.appendChild(g),u._visibility.setStyles(b?D.visibleStyles:D.hiddenStyles),y&&(a=ce(L,k,!0)),u._refreshDimensions(),u._sortData=null,u._drag=D.dragEnabled?new Re(u):null,y?(this._isActive=!0,this._container=L,this._containerDiffX=a.left,this._containerDiffY=a.top):(this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0),w._hasListeners(f)&&w._emit(f,{item:u,fromGrid:w,fromIndex:E,toGrid:t,toIndex:s}),t._hasListeners(m)&&t._emit(m,{item:u,fromGrid:w,fromIndex:E,toGrid:t,toIndex:s})}},je.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s,n=this._item,r=n._element,o=n.getGrid()._element;this._container!==o&&(void 0!==e&&void 0!==i||(t?(e=(s=we(r)).x-this._containerDiffX,i=s.y-this._containerDiffY):(e=n._left,i=n._top)),o.appendChild(r),n._setTranslate(e,i)),this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0}},je.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Ve.prototype.show=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=vt(e)?e:null,r=i.getGrid()._settings;this._isShowing||this._isHidden?!this._isShowing||t?(this._isShowing||(i._emitter.burst(this._queue,!0,i),Se(s,r.itemHiddenClass),zt(s,r.itemVisibleClass),this._isHiding||(s.style.display="")),n&&i._emitter.on(this._queue,n),this._isShowing=!0,this._isHiding=this._isHidden=!1,this._startAnimation(!0,t,this._finishShow)):n&&i._emitter.on(this._queue,n):n&&n(!1,i)}},Ve.prototype.hide=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=vt(e)?e:null,r=i.getGrid()._settings;this._isHiding||!this._isHidden?!this._isHiding||t?(this._isHiding||(i._emitter.burst(this._queue,!0,i),zt(s,r.itemHiddenClass),Se(s,r.itemVisibleClass)),n&&i._emitter.on(this._queue,n),this._isHidden=this._isHiding=!0,this._isShowing=!1,this._startAnimation(!1,t,this._finishHide)):n&&i._emitter.on(this._queue,n):n&&n(!1,i)}},Ve.prototype.stop=function(t){if(!this._isDestroyed&&(this._isHiding||this._isShowing)){var e=this._item;lt(e._id),this._animation.stop(),t&&e._emitter.burst(this._queue,!0,e)}},Ve.prototype.setStyles=function(t){var e=this._childElement,i=this._currentStyleProps;for(var s in this._removeCurrentStyles(),t)i.push(s),e.style[s]=t[s]},Ve.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item,e=t._element,i=t.getGrid()._settings;this.stop(!0),t._emitter.clear(this._queue),this._animation.destroy(),this._removeCurrentStyles(),Se(e,i.itemVisibleClass),Se(e,i.itemHiddenClass),e.style.display="",this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0}},Ve.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var s,n=this._item,r=this._animation,o=this._childElement,a=n.getGrid()._settings,h=t?a.visibleStyles:a.hiddenStyles,l=t?a.showDuration:a.hideDuration,d=t?a.showEasing:a.hideEasing,_=e||l<=0;if(h){if(lt(n._id),_)return Ye(o,h),r.stop(),void(i&&i());var c,u,f;r.isAnimating()&&(r._animation.onfinish=null),c=n._id,u=function(){s=Ce(o,h)},f=function(){r.start(s,h,{duration:l,easing:d,onFinish:i})},at.add(ot,F+c,u),at.add(2,j+c,f)}else i&&i()}},Ve.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._item._emitter.burst(this._queue,!1,this._item))},Ve.prototype._finishHide=function(){if(this._isHidden){var t=this._item;this._isHiding=!1,t._layout.stop(!0,0,0),t._element.style.display="none",t._emitter.burst(this._queue,!1,t)}},Ve.prototype._removeCurrentStyles=function(){for(var t=this._childElement,e=this._currentStyleProps,i=0;i<e.length;i++)t.style[e[i]]="";e.length=0};var Qe=0;function Ue(){return++Qe}function Ze(t,e,i){var n=t._settings;if(s){if(s.has(e))throw new Error("You can only create one Muuri Item per element!");s.set(e,this)}this._id=Ue(),this._gridId=t._id,this._element=e,this._isDestroyed=!1,this._left=0,this._top=0,this._width=0,this._height=0,this._marginLeft=0,this._marginRight=0,this._marginTop=0,this._marginBottom=0,this._tX=void 0,this._tY=void 0,this._sortData=null,this._emitter=new S,e.parentNode!==t._element&&t._element.appendChild(e),zt(e,n.itemClass),"boolean"!=typeof i&&(i="none"!==yt(e,"display")),this._isActive=i,this._visibility=new Ve(this),this._layout=new Fe(this),this._migrate=new je(this),this._drag=n.dragEnabled?new Re(this):null,this._dragRelease=new ze(this),this._dragPlaceholder=new We(this)}function Je(t){var e,i,s,n,r,o=.001,a=.5;function h(t){return((1e3*t+.5|0)/10|0)/100}function l(){this.currentRects=[],this.nextRects=[],this.rectTarget={},this.rectStore=[],this.slotSizes=[],this.rectId=0,this.slotIndex=-1,this.slotData={left:0,top:0,width:0,height:0},this.sortRectsLeftTop=this.sortRectsLeftTop.bind(this),this.sortRectsTopLeft=this.sortRectsTopLeft.bind(this)}if(l.prototype.computeLayout=function(t,e){var i,s,n,r,o,a,l=t.items,d=t.slots,_=!!(1&e),c=!!(2&e),u=!!(4&e),f=!!(8&e),p=!!(16&e),m="number"==typeof l[0];if(!l.length)return t;for(s=m?2:1,i=0;i<l.length;i+=s)m?(r=l[i],o=l[i+1]):(r=(n=l[i])._width+n._marginLeft+n._marginRight,o=n._height+n._marginTop+n._marginBottom),p&&(r=h(r),o=h(o)),a=this.computeNextSlot(t,r,o,_,c),c?a.left+a.width>t.width&&(t.width=a.left+a.width):a.top+a.height>t.height&&(t.height=a.top+a.height),d[++this.slotIndex]=a.left,d[++this.slotIndex]=a.top,(u||f)&&this.slotSizes.push(a.width,a.height);if(u)for(i=0;i<d.length;i+=2)d[i]=t.width-(d[i]+this.slotSizes[i]);if(f)for(i=1;i<d.length;i+=2)d[i]=t.height-(d[i]+this.slotSizes[i]);return this.slotSizes.length=0,this.currentRects.length=0,this.nextRects.length=0,this.rectStore.length=0,this.rectId=0,this.slotIndex=-1,t},l.prototype.computeNextSlot=function(t,e,i,s,n){var r,h,l,d,_,c=this.slotData,u=this.currentRects,f=this.nextRects,p=!1;for(f.length=0,c.left=null,c.top=null,c.width=e,c.height=i,d=0;d<u.length;d++)if((h=u[d])&&(r=this.getRect(h),c.width<=r.width+o&&c.height<=r.height+o)){c.left=r.left,c.top=r.top;break}if(null===c.left&&(n?(c.left=t.width,c.top=0):(c.left=0,c.top=t.height),s||(p=!0)),!n&&c.top+c.height>t.height+o&&(c.left>a&&f.push(this.addRect(0,t.height,c.left,1/0)),c.left+c.width<t.width-a&&f.push(this.addRect(c.left+c.width,t.height,t.width-c.left-c.width,1/0)),t.height=c.top+c.height),n&&c.left+c.width>t.width+o&&(c.top>a&&f.push(this.addRect(t.width,0,1/0,c.top)),c.top+c.height<t.height-a&&f.push(this.addRect(t.width,c.top+c.height,1/0,t.height-c.top-c.height)),t.width=c.left+c.width),!p)for(s&&(d=0);d<u.length;d++)if(h=u[d])for(r=this.getRect(h),l=this.splitRect(r,c),_=0;_<l.length;_++)h=l[_],r=this.getRect(h),(n?r.left+o<t.width-o:r.top+o<t.height-o)&&f.push(h);return f.length>1&&this.purgeRects(f).sort(n?this.sortRectsLeftTop:this.sortRectsTopLeft),this.currentRects=f,this.nextRects=u,c},l.prototype.addRect=function(t,e,i,s){var n=++this.rectId;return this.rectStore[n]=t||0,this.rectStore[++this.rectId]=e||0,this.rectStore[++this.rectId]=i||0,this.rectStore[++this.rectId]=s||0,n},l.prototype.getRect=function(t,e){return e||(e=this.rectTarget),e.left=this.rectStore[t]||0,e.top=this.rectStore[++t]||0,e.width=this.rectStore[++t]||0,e.height=this.rectStore[++t]||0,e},l.prototype.splitRect=(e=[],i=0,s=0,function(t,n){return e.length=0,t.left+t.width<=n.left+o||n.left+n.width<=t.left+o||t.top+t.height<=n.top+o||n.top+n.height<=t.top+o?(e.push(this.addRect(t.left,t.top,t.width,t.height)),e):((i=n.left-t.left)>=a&&e.push(this.addRect(t.left,t.top,i,t.height)),(i=t.left+t.width-(n.left+n.width))>=a&&e.push(this.addRect(n.left+n.width,t.top,i,t.height)),(s=n.top-t.top)>=a&&e.push(this.addRect(t.left,t.top,t.width,s)),(s=t.top+t.height-(n.top+n.height))>=a&&e.push(this.addRect(t.left,n.top+n.height,t.width,s)),e)}),l.prototype.isRectAWithinRectB=function(t,e){return t.left+o>=e.left&&t.top+o>=e.top&&t.left+t.width-o<=e.left+e.width&&t.top+t.height-o<=e.top+e.height},l.prototype.purgeRects=(n={},r={},function(t){for(var e,i=t.length;i--;)if(e=t.length,t[i])for(this.getRect(t[i],n);e--;)if(t[e]&&i!==e&&(this.getRect(t[e],r),this.isRectAWithinRectB(n,r))){t[i]=0;break}return t}),l.prototype.sortRectsTopLeft=function(){var t={},e={};return function(i,s){return this.getRect(i,t),this.getRect(s,e),t.top<e.top&&t.top+o<e.top?-1:t.top>e.top&&t.top-o>e.top?1:t.left<e.left&&t.left+o<e.left?-1:t.left>e.left&&t.left-o>e.left?1:0}}(),l.prototype.sortRectsLeftTop=function(){var t={},e={};return function(i,s){return this.getRect(i,t),this.getRect(s,e),t.left<e.left&&t.left+o<e.left?-1:t.left>e.left&&t.left-o<e.left?1:t.top<e.top&&t.top+o<e.top?-1:t.top>e.top&&t.top-o>e.top?1:0}}(),t){var d=new l;self.onmessage=function(t){var e=new Float32Array(t.data),i=e.subarray(4,e.length),s=new Float32Array(i.length),n=e[3],r={items:i,slots:s,width:e[1],height:e[2]};d.computeLayout(r,n),e[1]=r.width,e[2]=r.height,e.set(r.slots,4),postMessage(e.buffer,[e.buffer])}}return l}Ze.prototype.getGrid=function(){return i[this._gridId]},Ze.prototype.getElement=function(){return this._element},Ze.prototype.getWidth=function(){return this._width},Ze.prototype.getHeight=function(){return this._height},Ze.prototype.getMargin=function(){return{left:this._marginLeft,right:this._marginRight,top:this._marginTop,bottom:this._marginBottom}},Ze.prototype.getPosition=function(){return{left:this._left,top:this._top}},Ze.prototype.isActive=function(){return this._isActive},Ze.prototype.isVisible=function(){return!!this._visibility&&!this._visibility._isHidden},Ze.prototype.isShowing=function(){return!(!this._visibility||!this._visibility._isShowing)},Ze.prototype.isHiding=function(){return!(!this._visibility||!this._visibility._isHiding)},Ze.prototype.isPositioning=function(){return!(!this._layout||!this._layout._isActive)},Ze.prototype.isDragging=function(){return!(!this._drag||!this._drag._isActive)},Ze.prototype.isReleasing=function(){return!(!this._dragRelease||!this._dragRelease._isActive)},Ze.prototype.isDestroyed=function(){return this._isDestroyed},Ze.prototype._refreshDimensions=function(t){if(!(this._isDestroyed||!0!==t&&this._visibility._isHidden)){var e=this._element,i=this._dragPlaceholder,s=e.getBoundingClientRect();this._width=s.width,this._height=s.height,this._marginLeft=Math.max(0,bt(e,"margin-left")),this._marginRight=Math.max(0,bt(e,"margin-right")),this._marginTop=Math.max(0,bt(e,"margin-top")),this._marginBottom=Math.max(0,bt(e,"margin-bottom")),i&&i.updateDimensions()}},Ze.prototype._refreshSortData=function(){if(!this._isDestroyed){var t,e=this._sortData={},i=this.getGrid()._settings.sortData;for(t in i)e[t]=i[t](this,this._element)}},Ze.prototype._addToLayout=function(t,e){!0!==this._isActive&&(this._isActive=!0,this._left=t||0,this._top=e||0)},Ze.prototype._removeFromLayout=function(){!1!==this._isActive&&(this._isActive=!1,this._left=0,this._top=0)},Ze.prototype._canSkipLayout=function(t,e){return this._left===t&&this._top===e&&!this._migrate._isActive&&!this._layout._skipNextAnimation&&!this._dragRelease.isJustReleased()},Ze.prototype._setTranslate=function(t,e){return(this._tX!==t||this._tY!==e)&&(this._tX=t,this._tY=e,this._element.style[Zt]=Be(t,e),!0)},Ze.prototype._destroy=function(t){if(!this._isDestroyed){var e=this._element,i=this.getGrid()._settings;this._dragPlaceholder.destroy(),this._dragRelease.destroy(),this._migrate.destroy(),this._layout.destroy(),this._visibility.destroy(),this._drag&&this._drag.destroy(),this._emitter.destroy(),Se(e,i.itemClass),t&&e.parentNode.removeChild(e),s&&s.delete(e),this._isActive=!1,this._isDestroyed=!0}};var $e=Je(),Ke=null,ti=[];function ei(t,e){if(this._options=0,this._processor=null,this._layoutQueue=[],this._layouts={},this._layoutCallbacks={},this._layoutWorkers={},this._layoutWorkerData={},this._workers=[],this._onWorkerMessage=this._onWorkerMessage.bind(this),this.setOptions(e),(t="number"==typeof t?Math.max(0,t):0)&&window.Worker&&window.URL&&window.Blob)try{this._workers=function(t,e){var i=[];if(t>0){Ke||(Ke=URL.createObjectURL(new Blob(["("+Je.toString()+")(true)"],{type:"application/javascript"})));for(var s,n=0;n<t;n++)s=new Worker(Ke),e&&(s.onmessage=e),i.push(s),ti.push(s)}return i}(t,this._onWorkerMessage)}catch(t){this._processor=new $e}else this._processor=new $e}ei.prototype._sendToWorker=function(){if(this._layoutQueue.length&&this._workers.length){var t=this._layoutQueue.shift(),e=this._workers.pop(),i=this._layoutWorkerData[t];delete this._layoutWorkerData[t],this._layoutWorkers[t]=e,e.postMessage(i.buffer,[i.buffer])}},ei.prototype._onWorkerMessage=function(t){var e=new Float32Array(t.data),i=e[0],s=this._layouts[i],n=this._layoutCallbacks[i],r=this._layoutWorkers[i];s&&delete this._layouts[i],n&&delete this._layoutCallbacks[i],r&&delete this._layoutWorkers[i],s&&n&&(s.width=e[1],s.height=e[2],s.slots=e.subarray(4,e.length),this._finalizeLayout(s),n(s)),r&&(this._workers.push(r),this._sendToWorker())},ei.prototype._finalizeLayout=function(t){var e=t._grid,i=2&t._settings,s="border-box"===e._boxSizing;return delete t._grid,delete t._settings,t.styles={},i?t.styles.width=(s?t.width+e._borderLeft+e._borderRight:t.width)+"px":t.styles.height=(s?t.height+e._borderTop+e._borderBottom:t.height)+"px",t},ei.prototype.setOptions=function(t){var e,i,s,n,r;t&&(e="boolean"==typeof t.fillGaps?t.fillGaps?1:0:1&this._options,i="boolean"==typeof t.horizontal?t.horizontal?2:0:2&this._options,s="boolean"==typeof t.alignRight?t.alignRight?4:0:4&this._options,n="boolean"==typeof t.alignBottom?t.alignBottom?8:0:8&this._options,r="boolean"==typeof t.rounding?t.rounding?16:0:16&this._options,this._options=e|i|s|n|r)},ei.prototype.createLayout=function(t,e,i,s,n,r){if(this._layouts[e])throw new Error("A layout with the provided id is currently being processed.");var o=2&this._options,a={id:e,items:i,slots:null,width:o?0:s,height:o?n:0,_grid:t,_settings:this._options};if(!i.length)return a.slots=[],this._finalizeLayout(a),void r(a);if(this._processor)return a.slots=window.Float32Array?new Float32Array(2*i.length):new Array(2*i.length),this._processor.computeLayout(a,a._settings),this._finalizeLayout(a),void r(a);var h,l,d,_=new Float32Array(4+2*i.length);for(_[0]=e,_[1]=a.width,_[2]=a.height,_[3]=a._settings,h=0,l=3;h<i.length;h++)d=i[h],_[++l]=d._width+d._marginLeft+d._marginRight,_[++l]=d._height+d._marginTop+d._marginBottom;return this._layoutQueue.push(e),this._layouts[e]=a,this._layoutCallbacks[e]=r,this._layoutWorkerData[e]=_,this._sendToWorker(),this.cancelLayout.bind(this,e)},ei.prototype.cancelLayout=function(t){if(this._layouts[t]&&(delete this._layouts[t],delete this._layoutCallbacks[t],this._layoutWorkerData[t])){delete this._layoutWorkerData[t];var e=this._layoutQueue.indexOf(t);e>-1&&this._layoutQueue.splice(e,1)}},ei.prototype.destroy=function(){for(var t in this._layoutWorkers)this._workers.push(this._layoutWorkers[t]);!function(t){for(var e,i,s=0;s<t.length;s++)(e=t[s]).onmessage=null,e.onerror=null,e.onmessageerror=null,e.terminate(),(i=ti.indexOf(e))>-1&&ti.splice(i,1);Ke&&!ti.length&&(URL.revokeObjectURL(Ke),Ke=null)}(this._workers),this._workers.length=0,this._layoutQueue.length=0,this._layouts={},this._layoutCallbacks={},this._layoutWorkers={},this._layoutWorkerData={}};var ii=0;function si(t,e){var i=++ii,s=0,n=0,r=!1,o=function(e){r||(n&&(s-=e-n),n=e,s>0?function(t,e){at.add(ot,rt+t,e)}(i,o):(s=n=0,t()))};return function(a){if(!r){if(!(e<=0))return!0===a?(r=!0,s=n=0,o=void 0,void function(t){at.remove(ot,rt+t)}(i)):void(s<=0?(s=e,o(0)):s=e);!0!==a&&t()}}}var ni="[object HTMLCollection]",ri="[object NodeList]";function oi(t){var e=Object.prototype.toString.call(t);return e===ni||e===ri}var ai="object",hi="[object Object]",li=Object.prototype.toString;function di(t){return typeof t===ai&&li.call(t)===hi}function _i(){}var ci,ui="number",fi="string",pi="instant",mi=0;function vi(t,e){if(typeof t===fi&&(t=document.querySelector(t)),!(t.getRootNode?t.getRootNode({composed:!0})===document:document.body.contains(t))||t===document.documentElement)throw new Error("Container element must be an existing DOM element.");var s=function(t,e){var i=gi({},t);e&&(i=gi(i,e));e&&e.visibleStyles?i.visibleStyles=e.visibleStyles:t&&t.visibleStyles&&(i.visibleStyles=t.visibleStyles);e&&e.hiddenStyles?i.hiddenStyles=e.hiddenStyles:t&&t.hiddenStyles&&(i.hiddenStyles=t.hiddenStyles);return i}(vi.defaultOptions,e);s.visibleStyles=yi(s.visibleStyles),s.hiddenStyles=yi(s.hiddenStyles),vt(s.dragSort)||(s.dragSort=!!s.dragSort),this._id=Ue(),this._element=t,this._settings=s,this._isDestroyed=!1,this._items=[],this._layout={id:0,items:[],slots:[]},this._isLayoutFinished=!0,this._nextLayoutData=null,this._emitter=new S,this._onLayoutDataReceived=this._onLayoutDataReceived.bind(this),i[this._id]=this,zt(t,s.containerClass),function(t,e){typeof e!==ui&&(e=!0===e?0:-1);e>=0&&(t._resizeHandler=si((function(){t.refreshItems().layout()}),e),window.addEventListener("resize",t._resizeHandler))}(this,s.layoutOnResize),this.add(function(t,e){if("*"===e)return t.children;if(typeof e===fi){for(var i=[],s=t.children,n=0;n<s.length;n++)Wt(s[n],e)&&i.push(s[n]);return i}if(Array.isArray(e)||oi(e))return e;return[]}(t,s.items),{layout:!1}),s.layoutOnInit&&this.layout(!0)}function gi(t,e){var i,s,n,r=Object.keys(e),o=r.length;for(n=0;n<o;n++)i=di(e[s=r[n]]),di(t[s])&&i?t[s]=gi(gi({},t[s]),e[s]):i?t[s]=gi({},e[s]):Array.isArray(e[s])?t[s]=e[s].slice(0):t[s]=e[s];return t}function yi(t){var e,i,s={},n=document.documentElement.style;for(e in t)t[e]&&(i=L(n,e))&&(s[i]=t[e]);return s}function bi(t){for(var e={},i=0;i<t.length;i++)e[t[i]._id]=i;return e}function wi(t,e,i){return t[e._id]-t[i._id]}vi.Item=Ze,vi.ItemLayout=Fe,vi.ItemVisibility=Ve,vi.ItemMigrate=je,vi.ItemDrag=Re,vi.ItemDragRelease=ze,vi.ItemDragPlaceholder=We,vi.Emitter=S,vi.Animator=Ge,vi.Dragger=q,vi.Packer=ei,vi.AutoScroller=Gt,vi.defaultPacker=new ei(2),vi.defaultOptions={items:"*",showDuration:300,showEasing:"ease",hideDuration:300,hideEasing:"ease",visibleStyles:{opacity:"1",transform:"scale(1)"},hiddenStyles:{opacity:"0",transform:"scale(0.5)"},layout:{fillGaps:!1,horizontal:!1,alignRight:!1,alignBottom:!1,rounding:!1},layoutOnResize:150,layoutOnInit:!0,layoutDuration:300,layoutEasing:"ease",sortData:null,dragEnabled:!1,dragContainer:null,dragHandle:null,dragStartPredicate:{distance:0,delay:0},dragAxis:"xy",dragSort:!0,dragSortHeuristics:{sortInterval:100,minDragDistance:10,minBounceBackAngle:1},dragSortPredicate:{threshold:50,action:r,migrateAction:r},dragRelease:{duration:300,easing:"ease",useDragContainer:!0},dragCssProps:{touchAction:"none",userSelect:"none",userDrag:"none",tapHighlightColor:"rgba(0, 0, 0, 0)",touchCallout:"none",contentZooming:"none"},dragPlaceholder:{enabled:!1,createElement:null,onCreate:null,onRemove:null},dragAutoScroll:{targets:[],handle:null,threshold:50,safeZone:.2,speed:Gt.smoothSpeed(1e3,2e3,2500),sortDuringScroll:!0,smoothStop:!1,onStart:null,onStop:null},containerClass:"muuri",itemClass:"muuri-item",itemVisibleClass:"muuri-item-shown",itemHiddenClass:"muuri-item-hidden",itemPositioningClass:"muuri-item-positioning",itemDraggingClass:"muuri-item-dragging",itemReleasingClass:"muuri-item-releasing",itemPlaceholderClass:"muuri-item-placeholder"},vi.prototype.on=function(t,e){return this._emitter.on(t,e),this},vi.prototype.off=function(t,e){return this._emitter.off(t,e),this},vi.prototype.getElement=function(){return this._element},vi.prototype.getItem=function(t){if(this._isDestroyed||!t&&0!==t)return null;if(typeof t===ui)return this._items[t>-1?t:this._items.length+t]||null;if(t instanceof Ze)return t._gridId===this._id?t:null;if(s){var e=s.get(t);return e&&e._gridId===this._id?e:null}for(var i=0;i<this._items.length;i++)if(this._items[i]._element===t)return this._items[i];return null},vi.prototype.getItems=function(t){if(this._isDestroyed||void 0===t)return this._items.slice(0);var e,i,s=[];if(Array.isArray(t)||oi(t))for(e=0;e<t.length;e++)(i=this.getItem(t[e]))&&s.push(i);else(i=this.getItem(t))&&s.push(i);return s},vi.prototype.refreshItems=function(t,e){if(this._isDestroyed)return this;var i,s,n,r,o=t||this._items;if(!0===e)for(r=[],i=0;i<o.length;i++)(s=o[i]).isVisible()||s.isHiding()||((n=s.getElement().style).visibility="hidden",n.display="",r.push(n));for(i=0;i<o.length;i++)o[i]._refreshDimensions(e);if(!0===e){for(i=0;i<r.length;i++)(n=r[i]).visibility="",n.display="none";r.length=0}return this},vi.prototype.refreshSortData=function(t){if(this._isDestroyed)return this;for(var e=t||this._items,i=0;i<e.length;i++)e[i]._refreshSortData();return this},vi.prototype.synchronize=function(){if(this._isDestroyed)return this;var t,e,i=this._items;if(!i.length)return this;for(var s=0;s<i.length;s++)(e=i[s]._element).parentNode===this._element&&(t=t||document.createDocumentFragment()).appendChild(e);return t?(this._element.appendChild(t),this._emit("synchronize"),this):this},vi.prototype.layout=function(t,e){if(this._isDestroyed)return this;var i=this._nextLayoutData;i&&vt(i.cancel)&&i.cancel();var s=mi=mi%16777216+1;this._nextLayoutData={id:s,instant:t,onFinish:e,cancel:null};for(var n=this._items,r=[],o=0;o<n.length;o++)n[o]._isActive&&r.push(n[o]);this._refreshDimensions();var a,h=this._width-this._borderLeft-this._borderRight,l=this._height-this._borderTop-this._borderBottom,d=this._settings.layout;return vt(d)?a=d(this,s,r,h,l,this._onLayoutDataReceived):(vi.defaultPacker.setOptions(d),a=vi.defaultPacker.createLayout(this,s,r,h,l,this._onLayoutDataReceived)),vt(a)&&this._nextLayoutData&&this._nextLayoutData.id===s&&(this._nextLayoutData.cancel=a),this},vi.prototype.add=function(t,e){if(this._isDestroyed||!t)return[];var i,s=oi(i=t)?Array.prototype.slice.call(i):Array.prototype.concat(i);if(!s.length)return s;var n,r,o,a,h=e||{},l=h.layout?h.layout:void 0===h.layout,d=this._items,_=!1;for(a=0;a<s.length;a++)(r=s[a]).parentNode!==this._element&&(n=n||document.createDocumentFragment()).appendChild(r);for(n&&this._element.appendChild(n),a=0;a<s.length;a++)r=s[a],(o=s[a]=new Ze(this,r,h.active))._isActive&&(_=!0,o._layout._skipNextAnimation=!0);for(a=0;a<s.length;a++)(o=s[a])._refreshDimensions(),o._refreshSortData();return jt(d,s,h.index),this._hasListeners("add")&&this._emit("add",s.slice(0)),_&&l&&this.layout(l===pi,vt(l)?l:void 0),s},vi.prototype.remove=function(t,e){if(this._isDestroyed||!t.length)return[];var i,s,n,r=e||{},o=r.layout?r.layout:void 0===r.layout,a=!1,h=this.getItems(),d=[],_=[];for(n=0;n<t.length;n++)(s=t[n])._isDestroyed||-1!==(i=this._items.indexOf(s))&&(s._isActive&&(a=!0),d.push(s),_.push(h.indexOf(s)),s._destroy(r.removeElements),this._items.splice(i,1));return this._hasListeners(l)&&this._emit(l,d.slice(0),_),a&&o&&this.layout(o===pi,vt(o)?o:void 0),d},vi.prototype.show=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!0,e),this},vi.prototype.hide=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!1,e),this},vi.prototype.filter=function(t,e){if(this._isDestroyed||!this._items.length)return this;var i,s,n=[],r=[],o=typeof t===fi,a=vt(t),h=e||{},l=!0===h.instant,d=h.syncWithLayout,c=h.layout?h.layout:void 0===h.layout,u=vt(h.onFinish)?h.onFinish:null,f=-1,p=_i;if(u&&(p=function(){++f&&u(n.slice(0),r.slice(0))}),a||o)for(s=0;s<this._items.length;s++)i=this._items[s],(a?t(i):Wt(i._element,t))?n.push(i):r.push(i);return n.length?this.show(n,{instant:l,syncWithLayout:d,onFinish:p,layout:!1}):p(),r.length?this.hide(r,{instant:l,syncWithLayout:d,onFinish:p,layout:!1}):p(),(n.length||r.length)&&(this._hasListeners(_)&&this._emit(_,n.slice(0),r.slice(0)),c&&this.layout(c===pi,vt(c)?c:void 0)),this},vi.prototype.sort=function(){var t,e,i,s;function n(n,r){for(var o,a,h,l,d=0,_=0;_<t.length;_++)if(o=t[_][0],a=t[_][1],h=(n._sortData?n:n._refreshSortData())._sortData[o],l=(r._sortData?r:r._refreshSortData())._sortData[o],d="desc"===a||!a&&e?l<h?-1:l>h?1:0:h<l?-1:h>l?1:0)return d;return d||(s||(s=bi(i)),d=e?wi(s,r,n):wi(s,n,r)),d}function r(n,r){var o=e?-t(n,r):t(n,r);return o||(s||(s=bi(i)),o=e?wi(s,r,n):wi(s,n,r)),o}return function(o,a){if(this._isDestroyed||this._items.length<2)return this;var h=this._items,l=a||{},d=l.layout?l.layout:void 0===l.layout;if(e=!!l.descending,i=h.slice(0),s=null,vt(o))t=o,h.sort(r);else if(typeof o===fi)t=o.trim().split(" ").filter((function(t){return t})).map((function(t){return t.split(":")})),h.sort(n);else{if(!Array.isArray(o))throw t=e=i=s=null,new Error("Invalid comparer argument provided.");h.length=0,h.push.apply(h,o)}return this._hasListeners(c)&&this._emit(c,h.slice(0),i),d&&this.layout(d===pi,vt(d)?d:void 0),t=e=i=s=null,this}}(),vi.prototype.move=function(t,e,i){if(this._isDestroyed||this._items.length<2)return this;var s,o,a=this._items,h=i||{},l=h.layout?h.layout:void 0===h.layout,d=h.action===n,_=d?n:r,c=this.getItem(t),f=this.getItem(e);return c&&f&&c!==f&&(s=a.indexOf(c),o=a.indexOf(f),d?Ut(a,s,o):Qt(a,s,o),this._hasListeners(u)&&this._emit(u,{item:c,fromIndex:s,toIndex:o,action:_}),l&&this.layout(l===pi,vt(l)?l:void 0)),this},vi.prototype.send=function(t,e,i,s){if(this._isDestroyed||e._isDestroyed||this===e)return this;if(!(t=this.getItem(t)))return this;var n=s||{},r=n.appendTo||document.body,o=n.layoutSender?n.layoutSender:void 0===n.layoutSender,a=n.layoutReceiver?n.layoutReceiver:void 0===n.layoutReceiver;return t._migrate.start(e,i,r),t._migrate._isActive&&t._isActive&&(o&&this.layout(o===pi,vt(o)?o:void 0),a&&e.layout(a===pi,vt(a)?a:void 0)),this},vi.prototype.destroy=function(t){if(this._isDestroyed)return this;var e,s,n,r=this._element,o=this._items.slice(0),a=this._layout&&this._layout.styles||{};for((n=this)._resizeHandler&&(n._resizeHandler(!0),window.removeEventListener("resize",n._resizeHandler),n._resizeHandler=null),e=0;e<o.length;e++)o[e]._destroy(t);for(s in this._items.length=0,Se(r,this._settings.containerClass),a)r.style[s]="";return this._emit("destroy"),this._emitter.destroy(),delete i[this._id],this._isDestroyed=!0,this},vi.prototype._emit=function(){this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments)},vi.prototype._hasListeners=function(t){return!this._isDestroyed&&this._emitter.countListeners(t)>0},vi.prototype._updateBoundingRect=function(){var t=this._element.getBoundingClientRect();this._width=t.width,this._height=t.height,this._left=t.left,this._top=t.top,this._right=t.right,this._bottom=t.bottom},vi.prototype._updateBorders=function(t,e,i,s){var n=this._element;t&&(this._borderLeft=bt(n,"border-left-width")),e&&(this._borderRight=bt(n,"border-right-width")),i&&(this._borderTop=bt(n,"border-top-width")),s&&(this._borderBottom=bt(n,"border-bottom-width"))},vi.prototype._refreshDimensions=function(){this._updateBoundingRect(),this._updateBorders(1,1,1,1),this._boxSizing=yt(this._element,"box-sizing")},vi.prototype._onLayoutDataReceived=(ci=[],function(t){if(!this._isDestroyed&&this._nextLayoutData&&this._nextLayoutData.id===t.id){var e,i,s,n,r=this,l=this._nextLayoutData.instant,d=this._nextLayoutData.onFinish,_=t.items.length,c=_;for(this._nextLayoutData=null,!this._isLayoutFinished&&this._hasListeners(h)&&this._emit(h,this._layout.items.slice(0)),this._layout=t,ci.length=0,n=0;n<_;n++)(e=t.items[n])?(i=t.slots[2*n],s=t.slots[2*n+1],e._canSkipLayout(i,s)?--c:(e._left=i,e._top=s,e.isActive()&&!e.isDragging()?ci.push(e):--c)):--c;if(t.styles&&Ye(this._element,t.styles),!this._hasListeners(o)||(this._emit(o,t.items.slice(0),!0===l),this._layout.id===t.id)){var u=function(){if(!(--c>0)){var e=r._layout.id!==t.id,i=vt(l)?l:d;e||(r._isLayoutFinished=!0),vt(i)&&i(t.items.slice(0),e),!e&&r._hasListeners(a)&&r._emit(a,t.items.slice(0))}};if(!ci.length)return u(),this;for(this._isLayoutFinished=!1,n=0;n<ci.length&&this._layout.id===t.id;n++)ci[n]._layout.start(!0===l,u);return this._layout.id===t.id&&(ci.length=0),this}}}),vi.prototype._setItemsVisibility=function(t,e,i){var s,n,r=this,a=t.slice(0),h=i||{},l=!0===h.instant,_=h.onFinish,c=h.layout?h.layout:void 0===h.layout,u=a.length,f=e?"showStart":d,p=e?"showEnd":"hideEnd",m=e?"show":"hide",v=!1,g=[],y=[];if(u){for(n=0;n<a.length;n++)s=a[n],(e&&!s._isActive||!e&&s._isActive)&&(v=!0),s._layout._skipNextAnimation=!(!e||s._isActive),e&&s._visibility._isHidden&&y.push(s),e?s._addToLayout():s._removeFromLayout();y.length&&(this.refreshItems(y,!0),y.length=0),v&&!1!==h.syncWithLayout?this.on(o,b):b(),v&&c&&this.layout(c===pi,vt(c)?c:void 0)}else vt(_)&&_(a);function b(){for(v&&!1!==h.syncWithLayout&&r.off(o,b),r._hasListeners(f)&&r._emit(f,a.slice(0)),n=0;n<a.length;n++)a[n]._gridId===r._id?a[n]._visibility[m](l,(function(t,e){t||g.push(e),--u<1&&(vt(_)&&_(g.slice(0)),r._hasListeners(p)&&r._emit(p,g.slice(0)))})):--u<1&&(vt(_)&&_(g.slice(0)),r._hasListeners(p)&&r._emit(p,g.slice(0)))}};const Si=vi;function Di(t){return Di="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Di(t)}function ki(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,xi(s.key),s)}}function xi(t){var e=function(t,e){if("object"!=Di(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=Di(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Di(e)?e:e+""}var Ei=function(){return t=function t(e,i){var s=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.grid_id=e,this.collection=e,this.config={itemWidth:n.itemWidth||100,itemHeight:n.itemHeight||100,itemGap:n.itemGap||6,label_field:n.label_field||"id"},this.data=new Map,this.default_icon="https://cdn-icons-png.flaticon.com/512/732/732212.png",this.gridContainer=document.createElement("div"),this.gridContainer.className="vi-grid-container",i.contentContainer.appendChild(this.gridContainer),this.gridContainer.style.setProperty("--item-w",this.config.itemWidth+"px"),this.gridContainer.style.setProperty("--item-h",this.config.itemHeight+"px"),this.gridContainer.style.setProperty("--item-gap",this.config.itemGap+"px"),!document.getElementById("vi-grid-style")){var r=document.createElement("style");r.id="vi-grid-style",r.textContent="\n .vi-grid-container {\n position: relative;\n }\n\n .vi-grid-item {\n position: absolute;\n width: var(--item-w, 100px);\n height: var(--item-h, 100px);\n margin: var(--item-gap, 6px);\n cursor: pointer;\n }\n\n .vi-grid-item-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .vi-grid-icon {\n width: 60%;\n height: 60%;\n object-fit: contain;\n }\n\n .vi-grid-title {\n font-size: 12px;\n margin-top: 5px;\n text-align: center;\n user-select: none;\n }\n\n .vi-grid-item.selected {\n outline: 2px solid blue;\n }\n ",document.head.appendChild(r)}this.grid=new Si(this.gridContainer,{dragEnabled:!0,layout:{fillGaps:!0,horizontal:!1,alignRight:!1,alignBottom:!1},dragSort:!0,dragRelease:{duration:150,easing:"ease"},layoutDuration:150}),this.gridContainer.addEventListener("click",(function(t){var e=t.target.closest(".vi-grid-item");e&&s.toggleSelect(e)})),this.resizeObserver=new ResizeObserver((function(){s.grid.refreshItems(),s.grid.layout()})),this.resizeObserver.observe(i.contentContainer)},e=[{key:"addItem",value:function(t){var e=t.icon,i=t.title,s=t.data,n=document.createElement("div");n.className="vi-grid-item",n.dataset.id=s.id,n.innerHTML='\n <div class="vi-grid-item-content">\n <img src="'.concat(e,'" class="vi-grid-icon" />\n <div class="vi-grid-title">').concat(i,"</div>\n </div>\n "),this.gridContainer.appendChild(n),this.grid.add(n),this.data.set(s.id,s)}},{key:"add",value:function(t,e){this.addItem({icon:this.default_icon,title:e[this.config.label_field],data:e})}},{key:"removeItem",value:function(t){this.grid.getItem(t)&&this.grid.remove(t,{removeElements:!0})}},{key:"removeById",value:function(t){var e=this.gridContainer.querySelector('.vi-grid-item[data-id="'.concat(t,'"]'));return!!e&&(this.removeItem(e),this.data.delete(t),!0)}},{key:"removeSelected",value:function(){var t=this,e=this.gridContainer.querySelectorAll(".vi-grid-item.selected");return e.forEach((function(e){var i=e.dataset.id;t.removeItem(e),t.data.delete(i)})),e.length}},{key:"toggleSelect",value:function(t){this.gridContainer.querySelectorAll(".vi-grid-item.selected").forEach((function(t){return t.classList.remove("selected")}));var e=t.classList.toggle("selected"),i=t.dataset.id,s=this.data.get(i);this._onSelect&&this._onSelect({id:i,rowData:s,elem:t,selected:e}),this.event_bus&&this.event_bus.emit(this.collection,"selected",{id:i,object:s})}},{key:"setEventBus",value:function(t){this.event_bus=t}},{key:"update_record",value:function(t){t.collection;var e=t.record;this.data.set(e.id,e)}},{key:"add_or_update",value:function(t){var e=t.collection,i=t.record;this.data.has(i.id)?this.update_record({collection:e,record:i}):this.add(e,i)}},{key:"delete",value:function(t){t.collection;var e=t.record;this.removeById(e.id)}},{key:"set",value:function(t){var e=this,i=t.collection;t.result.data.forEach((function(t){e.add(i,t)}))}},{key:"focus",value:function(t){if(t&&t.id){var e=this.gridContainer.querySelector('.vi-grid-item[data-id="'.concat(t.id,'"]'));e&&(this.gridContainer.querySelectorAll(".vi-grid-item.selected").forEach((function(t){return t.classList.remove("selected")})),e.classList.add("selected"),e.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),this._onSelect&&this._onSelect({id:t.id,rowData:this.data.get(t.id),elem:e,selected:!0}))}}}],e&&ki(t.prototype,e),i&&ki(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Li(t){return Li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Li(t)}function Ai(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,s)}return i}function Ti(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ai(Object(i),!0).forEach((function(e){Ri(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ai(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Ri(t,e,i){return(e=Ii(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ci(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,Ii(s.key),s)}}function Ii(t){var e=function(t,e){if("object"!=Li(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=Li(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Li(e)?e:e+""}var Pi=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.root=e.contentContainer||e,this.nodes=new Map,this.links=[],this.pendingLink=null,this.selectedLink=null,this.scale=1,this.offset={x:0,y:0},this._injectStyles(),this._build(),this._bindPanZoom(),this._bindGlobalLinkHandlers(),this._bindLinkDeletion(),this.drop_callback=null,this.setupDropArea()},e=[{key:"_build",value:function(){var t=this;this.root.innerHTML="",this.viewport=document.createElement("div"),this.viewport.className="vi-viewport",this.content=document.createElement("div"),this.content.className="vi-content",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.classList.add("vi-links"),this.viewport.append(this.content,this.svg),this.root.appendChild(this.viewport),this.viewport.addEventListener("contextmenu",(function(t){return t.preventDefault()})),new ResizeObserver((function(){return t._resize()})).observe(this.root),this._resize()}},{key:"_resize",value:function(){this.svg.setAttribute("width",this.viewport.clientWidth),this.svg.setAttribute("height",this.viewport.clientHeight),this._updateLinks()}},{key:"_injectStyles",value:function(){if(!document.getElementById("vi-style")){var t=document.createElement("style");t.id="vi-style",t.textContent="\n .vi-viewport {\n position: relative;\n width: 100%;\n height: 100%;\n background: #1e1e1e;\n overflow: hidden;\n user-select: none;\n }\n .vi-content,\n .vi-links {\n position: absolute;\n inset: 0;\n transform-origin: 0 0;\n }\n .vi-content { z-index: 1; }\n .vi-links { z-index: 2; pointer-events: none; }\n .vi-node {\n position: absolute;\n width: 120px;\n height: 60px;\n background: #2b2b2b;\n border: 1px solid #555;\n border-radius: 6px;\n color: #fff;\n cursor: grab;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n }\n .vi-title {\n text-align: center;\n font-size: 12px;\n padding-top: 2px;\n }\n .vi-icon {\n width: 24px;\n height: 24px;\n margin-bottom: 2px;\n }\n .vi-port {\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: #4da3ff;\n cursor: crosshair;\n }\n .vi-port.out { right: -5px; top: 50%; transform: translateY(-50%); }\n .vi-port.in { left: -5px; top: 50%; transform: translateY(-50%); }\n .vi-link {\n stroke: #4da3ff;\n stroke-width: 2.5;\n fill: none;\n pointer-events: stroke;\n cursor: pointer;\n }\n .vi-link.preview {\n stroke-dasharray: 4 4;\n pointer-events: none;\n }\n .vi-link.selected {\n stroke: #ff5252;\n stroke-width: 3.5;\n }\n ",document.head.appendChild(t)}}},{key:"addIcon",value:function(t){var e,i,s=t.id,n=t.x,r=t.y,o=t.label,a=t.icon,h=document.createElement("div");h.className="vi-node",h.style.left=n+"px",h.style.top=r+"px";var l=document.createElement("div");if(l.className="vi-icon",null!=a&&null!==(e=a.startsWith)&&void 0!==e&&e.call(a,"<svg"))l.innerHTML=a;else if(null!=a&&null!==(i=a.match)&&void 0!==i&&i.call(a,/\.(png|jpg|jpeg|svg)$/)){var d=document.createElement("img");d.src=a,d.style.width="100%",d.style.height="100%",d.style.objectFit="contain",l.appendChild(d)}else l.textContent=null!=a?a:"";var _=document.createElement("div");_.className="vi-title",_.textContent=null!=o?o:s;var c=document.createElement("div");c.className="vi-port in",c.dataset.nodeId=s;var u=document.createElement("div");u.className="vi-port out",h.append(l,_,c,u),this.content.appendChild(h),this.nodes.set(s,{id:s,node:h,x:n,y:r,inPort:c,outPort:u,label:o,icon:a}),this._makeDraggable(s),this._bindPorts(s)}},{key:"_makeDraggable",value:function(t){var e,i,s,n,r=this,o=this.nodes.get(t);o.node.addEventListener("pointerdown",(function(t){if(!t.target.classList.contains("vi-port")&&0===t.button){e=t.clientX,i=t.clientY,s=o.x,n=o.y;var a=function(t){o.x=s+(t.clientX-e)/r.scale,o.y=n+(t.clientY-i)/r.scale,o.node.style.left=o.x+"px",o.node.style.top=o.y+"px",r._updateLinks()};window.addEventListener("pointermove",a),window.addEventListener("pointerup",(function(){return window.removeEventListener("pointermove",a)}),{once:!0})}}))}},{key:"_bindPorts",value:function(t){var e=this;this.nodes.get(t).outPort.addEventListener("pointerdown",(function(i){i.stopPropagation(),e.pendingLink={from:t,preview:e._createPreviewPath()}}))}},{key:"_bindGlobalLinkHandlers",value:function(){var t=this;window.addEventListener("pointermove",(function(e){t.pendingLink&&t._updatePreview(e.clientX,e.clientY)})),window.addEventListener("pointerup",(function(e){if(t.pendingLink){var i=document.elementFromPoint(e.clientX,e.clientY),s=null==i?void 0:i.closest(".vi-port.in");if(s){var n=s.dataset.nodeId;n&&n!==t.pendingLink.from&&t._createLink(t.pendingLink.from,n)}t.pendingLink.preview.remove(),t.pendingLink=null}}))}},{key:"_createPreviewPath",value:function(){var t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.classList.add("vi-link","preview"),this.svg.appendChild(t),t}},{key:"_updatePreview",value:function(t,e){var i=this.viewport.getBoundingClientRect(),s=(t-i.left-this.offset.x)/this.scale,n=(e-i.top-this.offset.y)/this.scale,r=this.nodes.get(this.pendingLink.from),o=r.x+120,a=r.y+30,h=.5*Math.abs(s-o);this.pendingLink.preview.setAttribute("d","M ".concat(o," ").concat(a," C ").concat(o+h," ").concat(a,", ").concat(s-h," ").concat(n,", ").concat(s," ").concat(n))}},{key:"_createLink",value:function(t,e){var i=this,s=document.createElementNS("http://www.w3.org/2000/svg","path");s.classList.add("vi-link"),s.addEventListener("pointerdown",(function(t){t.stopPropagation(),i._selectLink(s)})),this.svg.appendChild(s),this.links.push({from:t,to:e,path:s}),this._updateLinks()}},{key:"_selectLink",value:function(t){this.selectedLink&&this.selectedLink.classList.remove("selected"),this.selectedLink=t,t.classList.add("selected")}},{key:"_updateLinks",value:function(){var t=this;this.links.forEach((function(e){var i=t.nodes.get(e.from),s=t.nodes.get(e.to),n=i.x+120,r=i.y+30,o=s.x,a=s.y+30,h=.5*Math.abs(o-n);e.path.setAttribute("d","M ".concat(n," ").concat(r," C ").concat(n+h," ").concat(r,", ").concat(o-h," ").concat(a,", ").concat(o," ").concat(a))}))}},{key:"_bindLinkDeletion",value:function(){var t=this;window.addEventListener("keydown",(function(e){if(t.selectedLink&&("Delete"===e.key||"Backspace"===e.key)){var i=t.links.findIndex((function(e){return e.path===t.selectedLink}));-1!==i&&(t.links[i].path.remove(),t.links.splice(i,1)),t.selectedLink=null}}))}},{key:"_bindPanZoom",value:function(){var t,e,i=this,s=!1;this.viewport.addEventListener("pointerdown",(function(i){2===i.button&&(s=!0,t=i.clientX,e=i.clientY,i.preventDefault())})),window.addEventListener("pointermove",(function(n){s&&(i.offset.x+=n.clientX-t,i.offset.y+=n.clientY-e,t=n.clientX,e=n.clientY,i._applyTransform())})),window.addEventListener("pointerup",(function(){return s=!1})),this.viewport.addEventListener("wheel",(function(t){t.preventDefault(),i.scale*=t.deltaY>0?.9:1.1,i._applyTransform()}),{passive:!1})}},{key:"_applyTransform",value:function(){var t="translate(".concat(this.offset.x,"px, ").concat(this.offset.y,"px) scale(").concat(this.scale,")");this.content.style.transform=t,this.svg.style.transform=t}},{key:"serialize",value:function(){return{scale:this.scale,offset:Ti({},this.offset),nodes:Array.from(this.nodes.values()).map((function(t){return{id:t.id,x:t.x,y:t.y,label:t.label,icon:t.icon}})),links:this.links.map((function(t){return{from:t.from,to:t.to}}))}}},{key:"deserialize",value:function(t){var e,i,s,n,r=this;this.scale=null!==(e=t.scale)&&void 0!==e?e:1,this.offset=null!==(i=t.offset)&&void 0!==i?i:{x:0,y:0},this._applyTransform(),this.nodes.forEach((function(t){return t.node.remove()})),this.links.forEach((function(t){return t.path.remove()})),this.nodes.clear(),this.links=[],(null!==(s=t.nodes)&&void 0!==s?s:[]).forEach((function(t){return r.addIcon({id:t.id,x:t.x,y:t.y,label:t.label,icon:t.icon})})),(null!==(n=t.links)&&void 0!==n?n:[]).forEach((function(t){return r._createLink(t.from,t.to)}))}},{key:"setupDropArea",value:function(){var t=this;this.viewport.addEventListener("dragover",(function(t){return t.preventDefault()})),this.viewport.addEventListener("drop",(function(e){e.preventDefault();var i=e.dataTransfer.getData("text/plain");if(i){var s;try{s=JSON.parse(i)}catch(t){s={id:i,label:i,icon:i}}if(s.id&&!t.nodes.has(s.id)){var n=t.viewport.getBoundingClientRect(),r=(e.clientX-n.left-t.offset.x)/t.scale,o=(e.clientY-n.top-t.offset.y)/t.scale;t.drop_callback?t.drop_callback(t,s,r,o):t.addIcon({id:s.id,x:r,y:o,label:s.label||s.id,icon:s.icon||null})}}}))}}],e&&Ci(t.prototype,e),i&&Ci(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Mi(t){return Mi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mi(t)}function Yi(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,Xi(s.key),s)}}function Xi(t){var e=function(t,e){if("object"!=Mi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var s=i.call(t,e||"default");if("object"!=Mi(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Mi(e)?e:e+""}var Oi=function(){return t=function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e.contentContainer||e,this.options=i,this.container.innerHTML='\n <div id="drag-list"></div>\n '},e=[{key:"set",value:function(t){var e=this,i=(t.collection,t.result.data),s=this.container.querySelector("#drag-list");s.innerHTML="",i.forEach((function(t){var i=document.createElement("div");i.className="draggable-item",i.draggable=!0,i.innerHTML="\n ".concat(t[e.options.icon]?'<img src="'.concat(t[e.options.icon],'" style="width:16px;height:16px;margin-right:4px;" />'):"","\n <span>").concat(t[e.options.label],"</span>\n "),i.addEventListener("dragstart",(function(e){e.dataTransfer.setData("text/plain",JSON.stringify(t))})),s.appendChild(i)}))}},{key:"setStyle",value:function(t){var e=this;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])this.container.querySelectorAll(".draggable-item").forEach((function(i){return e._applyStyle(i,t)}));else{var i=this.container.querySelector("#drag-list");this._applyStyle(i,t)}}},{key:"_applyStyle",value:function(t,e){if("string"==typeof e)t.style.cssText+=e;else if("object"===Mi(e)){Object.assign(t.style,e);var i=t.querySelector("span");i&&Object.assign(i.style,e)}}}],e&&Yi(t.prototype,e),i&&Yi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),qi=e.Hx,Hi=e.YO,Gi=e.Qz;export{qi as vi_Grid,Hi as vi_IconPanel,Gi as vi_dragable_list};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vizor_panels",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "desciption of libname",
5
5
  "main": "dist/vizor_panels.min.js",
6
6
  "module": "dist/vizor_panels.min.js",