vizor_panels 1.0.4 → 1.0.7

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,{H:()=>Ei});var i={},s="function"==typeof Map?new Map:null,n="swap",r="move",o="layoutStart",h="layoutEnd",a="layoutAbort",l="remove",_="hideStart",d="filter",c="sort",u="move",f="send",p="beforeSend",m="receive",g="beforeReceive",v="dragReleaseEnd",y="ontouchstart"in window,S=!!window.PointerEvent,w=!!window.navigator.msPointerEnabled;function b(){this._events={},this._queue=[],this._counter=0,this._clearOnEmit=!1}b.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},b.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},b.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},b.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,h=s.length;o<h;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},b.prototype.burst=function(){return this._events?(this._clearOnEmit=!0,this.emit.apply(this,arguments),this):this},b.prototype.countListeners=function(t){if(!this._events)return 0;var e=this._events[t];return e?e.length:0},b.prototype.destroy=function(){return this._events?(this._queue.length=this._counter=0,this._events=null,this):this};var D=S?"pointerout":w?"MSPointerOut":"";function A(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))}A.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))},A.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)},A.prototype._resetData=function(){window.clearTimeout(this._timeout),this._timeout=null,this._outEvent=null},A.prototype._onStart=function(t){"mouse"!==t.pointerType&&this._addBehaviour()},A.prototype._onOut=function(t){this._dragger._getTrackedTouch(t)&&(this._resetData(),this._outEvent=t,this._timeout=window.setTimeout(this._onTimeout,100))},A.prototype._onTimeout=function(){var t=this._outEvent;this._resetData(),this._dragger.isActive()&&this._dragger._onCancel(t)},A.prototype.destroy=function(){D&&(this._dragger.off("start",this._onStart),this._removeBehaviour())};var x=["","webkit","moz","ms","o","Webkit","Moz","MS","O"],E={};function T(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 k(){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 L=window.navigator.userAgent.toLowerCase(),R=L.indexOf("edge")>-1,I=L.indexOf("trident")>-1,C=L.indexOf("firefox")>-1,P=L.indexOf("android")>-1,M=!!k()&&{passive:!0},X="touchAction",Y=T(document.documentElement.style,X),q="auto";function O(t,e){this._element=t,this._emitter=new b,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||I)&&(S||w)&&(this._edgeHack=new A(this)),this.setCssProps(e),this._touchAction||this.setTouchAction(q),t.addEventListener("dragstart",O._preventDefault,!1),t.addEventListener(O._inputEvents.start,this._onStart,M)}O._pointerEvents={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},O._msPointerEvents={start:"MSPointerDown",move:"MSPointerMove",cancel:"MSPointerCancel",end:"MSPointerUp"},O._touchEvents={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},O._mouseEvents={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},O._inputEvents=y?O._touchEvents:S?O._pointerEvents:w?O._msPointerEvents:O._mouseEvents,O._emitter=new b,O._emitterEvents={start:"start",move:"move",end:"end",cancel:"cancel"},O._activeInstances=[],O._preventDefault=function(t){t.preventDefault&&!1!==t.cancelable&&t.preventDefault()},O._activateInstance=function(t){O._activeInstances.indexOf(t)>-1||(O._activeInstances.push(t),O._emitter.on(O._emitterEvents.move,t._onMove),O._emitter.on(O._emitterEvents.cancel,t._onCancel),O._emitter.on(O._emitterEvents.end,t._onEnd),1===O._activeInstances.length&&O._bindListeners())},O._deactivateInstance=function(t){var e=O._activeInstances.indexOf(t);-1!==e&&(O._activeInstances.splice(e,1),O._emitter.off(O._emitterEvents.move,t._onMove),O._emitter.off(O._emitterEvents.cancel,t._onCancel),O._emitter.off(O._emitterEvents.end,t._onEnd),O._activeInstances.length||O._unbindListeners())},O._bindListeners=function(){window.addEventListener(O._inputEvents.move,O._onMove,M),window.addEventListener(O._inputEvents.end,O._onEnd,M),O._inputEvents.cancel&&window.addEventListener(O._inputEvents.cancel,O._onCancel,M)},O._unbindListeners=function(){window.removeEventListener(O._inputEvents.move,O._onMove,M),window.removeEventListener(O._inputEvents.end,O._onEnd,M),O._inputEvents.cancel&&window.removeEventListener(O._inputEvents.cancel,O._onCancel,M)},O._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},O._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},O._onMove=function(t){O._emitter.emit(O._emitterEvents.move,t)},O._onCancel=function(t){O._emitter.emit(O._emitterEvents.cancel,t)},O._onEnd=function(t){O._emitter.emit(O._emitterEvents.end,t)},O.prototype._reset=function(){this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._isActive=!1,O._deactivateInstance(this)},O.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===O._emitterEvents.start?0:this.getDeltaTime(),isFirst:t===O._emitterEvents.start,isFinal:t===O._emitterEvents.end||t===O._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}},O.prototype._emit=function(t,e){this._emitter.emit(t,this._createEvent(t,e))},O.prototype._getTrackedTouch=function(t){return null===this._pointerId?null:O._getTouchById(t,this._pointerId)},O.prototype._onStart=function(t){if(!this._isDestroyed&&null===this._pointerId&&(this._pointerId=O._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(O._emitterEvents.start,t),this._isActive&&O._activateInstance(this)}},O.prototype._onMove=function(t){var e=this._getTrackedTouch(t);e&&(this._currentX=e.clientX,this._currentY=e.clientY,this._emit(O._emitterEvents.move,t))},O.prototype._onCancel=function(t){this._getTrackedTouch(t)&&(this._emit(O._emitterEvents.cancel,t),this._reset())},O.prototype._onEnd=function(t){this._getTrackedTouch(t)&&(this._emit(O._emitterEvents.end,t),this._reset())},O.prototype.isActive=function(){return this._isActive},O.prototype.setTouchAction=function(t){this._touchAction=t,Y&&(this._cssProps[Y]="",this._element.style[Y]=t),y&&(this._element.removeEventListener(O._touchEvents.start,O._preventDefault,!0),(this._element.style[Y]!==t||C&&P)&&this._element.addEventListener(O._touchEvents.start,O._preventDefault,!0))},O.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!==X?(i=T(n.style,e))&&(s[i]="",n.style[i]=t[e]):this.setTouchAction(t[e]))}},O.prototype.getDeltaX=function(){return this._currentX-this._startX},O.prototype.getDeltaY=function(){return this._currentY-this._startY},O.prototype.getDistance=function(){var t=this.getDeltaX(),e=this.getDeltaY();return Math.sqrt(t*t+e*e)},O.prototype.getDeltaTime=function(){return this._startTime?Date.now()-this._startTime:0},O.prototype.on=function(t,e){this._emitter.on(t,e)},O.prototype.off=function(t,e){this._emitter.off(t,e)},O.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(O._inputEvents.start,this._onStart,M),t.removeEventListener("dragstart",O._preventDefault,!1),t.removeEventListener(O._touchEvents.start,O._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 W(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={}}W.prototype._step=function(t){var e,i,s,n,r,o,h=this._lanes,a=this._stepQueue,l=this._stepCallbacks;for(this._nextStep=null,e=0;e<h.length;e++){for(n=h[e].queue,r=h[e].callbacks,o=h[e].indices,i=0;i<n.length;i++)(s=n[i])&&(a.push(s),l[s]=r[s],delete r[s],delete o[s]);n.length=0}for(e=0;e<a.length;e++)l[s=a[e]]&&l[s](t),delete l[s];a.length=0},W.prototype.add=function(t,e,i){this._lanes[t].add(e,i),this._nextStep||(this._nextStep=G(this._step))},W.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 N="layoutRead",F="layoutWrite",z="visibilityRead",V="visibilityWrite",j="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,ht=new W(3);function at(t){ht.remove(ot,N+t),ht.remove(2,F+t)}function lt(t){ht.remove(ot,z+t),ht.remove(2,V+t)}function _t(t){ht.remove(ot,j+t),ht.remove(2,Q+t)}function dt(t){ht.remove(ot,U+t),ht.remove(2,Z+t)}function ct(t){ht.remove(ot,J+t),ht.remove(2,$+t)}function ut(t,e){ht.add(1,K+t,e)}function ft(t){ht.remove(ot,tt+t),ht.remove(2,et+t)}function pt(t,e){ht.add(ot,st,t),ht.add(2,nt,e)}var mt="function";function gt(t){return typeof t===mt}var vt="function"==typeof WeakMap?new WeakMap:null;function yt(t,e){var i=vt&&vt.get(t);return i||(i=window.getComputedStyle(t,null),vt&&vt.set(t,i)),i.getPropertyValue(e)}function St(t,e){return parseFloat(yt(t,e))||0}var wt,bt=document.documentElement,Dt=document.body,At={value:0,offset:0};function xt(t){return t===window||t===bt||t===Dt?window:t}function Et(t){return t===window?t.pageXOffset:t.scrollLeft}function Tt(t){return t===window?t.pageYOffset:t.scrollTop}function kt(t){return t===window?bt.scrollWidth-bt.clientWidth:t.scrollWidth-t.clientWidth}function Lt(t){return t===window?bt.scrollHeight-bt.clientHeight:t.scrollHeight-t.clientHeight}function Rt(t,e){if(e=e||{},t===window)e.width=bt.clientWidth,e.height=bt.clientHeight,e.left=0,e.right=e.width,e.top=0,e.bottom=e.height;else{var i=t.getBoundingClientRect(),s=t.clientLeft||St(t,"border-left-width"),n=t.clientTop||St(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 It(t){return t._drag._getGrid()._settings.dragAutoScroll}function Ct(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 At.value=Math.min(s/2,t),At.offset=Math.max(0,i+2*At.value+s*e-s)/2,At}function Mt(){this.reset()}function Xt(){this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}function Yt(t,e){this.pool=[],this.createItem=t,this.releaseItem=e}function qt(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):Tt(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=It(e).speed;return gt(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=It(t).onStart;gt(e)&&e(t,this.element,this.direction)},Mt.prototype.onStop=function(){var t=this.item,e=It(t).onStop;gt(e)&&e(t,this.element,this.direction),t._drag&&t._drag.sort()},Xt.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},Xt.prototype.addRequest=function(t){1&t.direction?(this.removeRequest(this.requestX),this.requestX=t):(this.removeRequest(this.requestY),this.requestY=t),t.action=this},Xt.prototype.removeRequest=function(t){t&&(this.requestX===t?(this.requestX=null,t.action=null):this.requestY===t&&(this.requestY=null,t.action=null))},Xt.prototype.computeScrollValues=function(){this.scrollLeft=this.requestX?this.requestX.value:Et(this.element),this.scrollTop=this.requestY?this.requestY.value:Tt(this.element)},Xt.prototype.scroll=function(){var t=this.element;t&&(t.scrollTo?t.scrollTo(this.scrollLeft,this.scrollTop):(t.scrollLeft=this.scrollLeft,t.scrollTop=this.scrollTop))},Yt.prototype.pick=function(){return this.pool.pop()||this.createItem()},Yt.prototype.release=function(t){this.releaseItem(t),-1===this.pool.indexOf(t)&&this.pool.push(t)},Yt.prototype.reset=function(){this.pool.length=0};var Ot={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 Yt((function(){return new Mt}),(function(t){t.reset()})),this._actionPool=new Yt((function(){return new Xt}),(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 h=r.threshold-Math.max(0,r.distance);o=t/r.threshold*h}else o=t;var a=r.speed,l=o;return a===o?l:a<o?(l=a+e*(r.deltaTime/1e3),Math.min(o,l)):(l=a-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,h,a){return e.left=h-.5*i,e.top=a-.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,ht.remove(ot,st),ht.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 h=this._requests[e],a=h[t._id];a?a.element===i&&a.direction===s||a.reset():a=this._requestPool.pick(),a.item=t,a.element=i,a.direction=s,a.threshold=n,a.distance=r,a.maxValue=o,h[t._id]=a},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=It(t),n=gt(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 h=this._dragDirections[t._id],a=h[0],l=h[1];if(!a&&!l)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));for(var _=this._getItemHandleRect(t,s.handle,Ot),d=Ht,c=null,u=null,f=!0,p=!0,m=0,g=0,v=null,y=null,S=0,w=0,b=0,D=null,A=-1/0,x=0,E=0,T=null,k=0,L=0,R=null,I=-1/0,C=0,P=0,M=null,X=0,Y=0,q=0;q<n.length;q++)c=n[q],f=e&&a&&2!==c.axis,p=i&&l&&1!==c.axis,g=c.priority||0,(!f||g<A)&&(!p||g<I)||(u=xt(c.element||c),w=f?kt(u):-1,b=p?Lt(u):-1,(w||b)&&((m=qt(_,d=Rt(u,d)))<=0||(f&&g>=A&&w>0&&(g>A||m>E)&&(y=null,v=Pt("number"==typeof c.threshold?c.threshold:r,o,_.width,d.width),5===a?(S=d.right+v.offset-_.right)<=v.value&&Et(u)<w&&(y=5):9===a&&(S=_.left-(d.left-v.offset))<=v.value&&Et(u)>0&&(y=9),null!==y&&(D=u,A=g,x=v.value,E=m,T=y,k=S,L=w)),p&&g>=I&&b>0&&(g>I||m>P)&&(y=null,v=Pt("number"==typeof c.threshold?c.threshold:r,o,_.height,d.height),6===l?(S=d.bottom+v.offset-_.bottom)<=v.value&&Tt(u)<b&&(y=6):10===l&&(S=_.top-(d.top-v.offset))<=v.value&&Tt(u)>0&&(y=10),null!==y&&(R=u,I=g,C=v.value,P=m,M=y,X=S,Y=b)))));e&&(D?this._requestItemScroll(t,1,D,T,x,k,L):this._cancelItemScroll(t,1)),i&&(R?this._requestItemScroll(t,2,R,M,C,X,Y):this._cancelItemScroll(t,2))},Gt.prototype._updateScrollRequest=function(t){for(var e=t.item,i=It(e),s=gt(i.targets)?i.targets(e):i.targets,n=s&&s.length||0,r=i.threshold,o=i.safeZone,h=this._getItemHandleRect(e,i.handle,Ot),a=Ht,l=null,_=null,d=!1,c=null,u=null,f=null,p=null,m=null,g=0;g<n;g++)if((_=xt((l=s[g]).element||l))===t.element){if(d=!!(1&t.direction)){if(2===l.axis)continue}else if(1===l.axis)continue;if((p=d?kt(_):Lt(_))<=0)break;if(qt(h,a=Rt(_,a))<=0)break;if(c=Pt("number"==typeof l.threshold?l.threshold:r,o,d?h.width:h.height,d?a.width:a.height),(u=9===t.direction?h.left-(a.left-c.offset):5===t.direction?a.right+c.offset-h.right:10===t.direction?h.top-(a.top-c.offset):a.bottom+c.offset-h.bottom)>c.value)break;if(f=d?Et(_):Tt(_),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,h=this._items,a=this._requests[1],l=this._requests[2],_=0;_<h.length;_++)t=h[_],n=(s=this._requestOverlapCheck[t._id])>0&&this._tickTime-s>this._overlapCheckInterval,r=!0,(e=a[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++)Ct(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 Wt=window.Element.prototype,Bt=Wt.matches||Wt.matchesSelector||Wt.webkitMatchesSelector||Wt.mozMatchesSelector||Wt.msMatchesSelector||Wt.oMatchesSelector||function(){return!1};function Nt(t,e){return Bt.call(t,e)}function Ft(t,e){e&&(t.classList?t.classList.add(e):Nt(t,"."+e)||(t.className+=" "+e))}var zt=[];function Vt(t,e,i){var s="number"==typeof i?i:-1;s<0&&(s=t.length-s+1),t.splice.apply(t,zt.concat(s,0,e)),zt.length=0}function jt(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=jt(t,e),n=jt(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=jt(t,e),r=jt(t,i);n!==r&&(s=t[n],t[n]=t[r],t[r]=s)}}var Zt=T(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 he(t){for(var e=document,i=t||e;i&&i!==e&&"static"===yt(i,"position")&&!oe(i);)i=i.parentElement||e;return i}var ae={},le={},_e={};function de(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+=St(t,"border-left-width"),s.top+=St(t,"border-top-width")),s)}function ce(t,e,i){return _e.left=0,_e.top=0,t===e||i&&(t=he(t))===(e=he(e))||(de(t,ae),de(e,le),_e.left=le.left-ae.left,_e.top=le.top-ae.top),_e}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={},ge=/^matrix3d/,ve=/([^,]*,){4}/,ye=/([^,]*,){12}/,Se=/[^,]*,/;function we(t){me.x=0,me.y=0;var e=yt(t,ee);if(!e||"none"===e)return me;var i=ge.test(e),s=e.replace(i?ye:ve,""),n=s.replace(Se,"");return me.x=parseFloat(s)||0,me.y=parseFloat(n)||0,me}function be(t,e){e&&(t.classList?t.classList.remove(e):Nt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim()))}var De,Ae,xe,Ee,Te=/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1,ke=0,Le=!!k()&&{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=gt(s.dragStartPredicate)?s.dragStartPredicate:Re.defaultStartPredicate,this._startPredicateState=ke,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 O(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 Ie(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(!Te&&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={},Ae={},xe={},Ee=[],function(t,e){var i=t._drag,s=i._getGrid(),o=e&&"number"==typeof e.threshold?e.threshold:50,h=e&&e.action===n?n:r,a=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,h,a,l,_,d,c,u=null,f=e._settings.dragSort,p=-1;if(!0===f?(Ee[0]=e,n=Ee):gt(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(),a=Math.max(0,r._left),l=Math.max(0,r._top),_=Math.min(window.innerWidth,r._right),d=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")&&(h=o.getBoundingClientRect(),a=Math.max(a,h.left),l=Math.max(l,h.top),_=Math.min(_,h.right),d=Math.min(d,h.bottom)),"fixed"===yt(o,"position"))break;o=o.parentNode}a>=_||l>=d||(Ae.left=a,Ae.top=l,Ae.width=_-a,Ae.height=d-l,(s=qt(De,Ae))>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,g=-1,v=!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++)(_=l._items[c])._isActive&&_!==t&&(v=!0,Ae.width=_._width,Ae.height=_._height,Ae.left=_._left+_._marginLeft+f,Ae.top=_._top+_._marginTop+p,(d=qt(De,Ae))>m&&(g=c,m=d));return u&&m<o&&(g=v?g:0,m=o),m>=o?(xe.grid=l,xe.index=g,xe.action=u?a:h,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),_t(e),dt(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),be(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,Le)},Re.prototype._unbindScrollListeners=function(){var t,e=this._scrollers;for(t=0;t<e.length;t++)e[t].removeEventListener("scroll",this._onScroll,Le);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 h=Math.atan2(n,r),a=Math.atan2(this._sortX2-this._sortX1,this._sortY2-this._sortY1),l=Math.atan2(Math.sin(h-a),Math.cos(h-a));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,ht.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,h,a,l,_=this._item,d=this._getGrid()._settings;(t=gt(d.dragSortPredicate)?d.dragSortPredicate(_,this._dragMoveEvent):Re.defaultSortPredicate(_,d.dragSortPredicate))&&"number"==typeof t.index&&(a=t.action===n?n:r,l=(e=_.getGrid())!==(s=t.grid||e),i=e._items.indexOf(_),o=jt(s._items,t.index,l&&a===r?1:0),(l||o!==this._blockedSortIndex)&&(l?(this._blockedSortIndex=null,h=s._items[o],e._hasListeners(p)&&e._emit(p,{item:_,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),s._hasListeners(g)&&s._emit(g,{item:_,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),_._gridId=s._id,this._isMigrating=_._gridId!==this._gridId,e._items.splice(i,1),Vt(s._items,_,o),_._sortData=null,e._hasListeners(f)&&e._emit(f,{item:_,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),s._hasListeners(m)&&s._emit(m,{item:_,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),a===n&&h&&h.isActive()&&s._items.indexOf(h)>-1&&s.send(h,e,i,{appendTo:this._container||document.body,layoutSender:!1,layoutReceiver:!1}),e.layout(),s.layout()):i!==o&&(this._blockedSortIndex=i,(a===n?Ut:Qt)(e._items,i,o),e._hasListeners(u)&&e._emit(u,{item:_,fromIndex:i,toIndex:o,action:a}),e.layout())))}},Re.prototype._finishMigration=function(){var t,e,i=this._item,s=i._dragRelease,n=i._element,r=i._isActive,o=i.getGrid(),h=o._element,a=o._settings,l=a.dragContainer||h,_=this._getGrid()._settings,d=n.parentNode,c=r?_.itemVisibleClass:_.itemHiddenClass,u=r?a.itemVisibleClass:a.itemHiddenClass;this._isMigrating=!1,this.destroy(),_.itemClass!==a.itemClass&&(be(n,_.itemClass),Ft(n,a.itemClass)),c!==u&&(be(n,c),Ft(n,u)),l!==d&&(l.appendChild(n),e=ce(d,l,!0),(t=we(n)).x-=e.left,t.y-=e.top),i._refreshDimensions(),e=ce(l,h,!0),s._containerDiffX=e.left,s._containerDiffY=e.top,i._drag=a.dragEnabled?new Re(i):null,l!==d&&i._setTranslate(t.x,t.y),i._visibility.setStyles(r?a.visibleStyles:a.hiddenStyles),s.start()},Re.prototype._preStartCheck=function(t){this._startPredicateState===ke&&(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=ke)):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=ke,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,ht.add(ot,j+e,i),ht.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=he(r),h=we(e),a=e.getBoundingClientRect(),l=r!==n;if(this._container=r,this._containingBlock=o,this._clientX=a.left,this._clientY=a.top,this._left=this._gridX=h.x,this._top=this._gridY=h.y,this._scrollDiffX=this._scrollDiffY=0,this._moveDiffX=this._moveDiffY=0,this._resetHeuristics(this._gridX,this._gridY),l){var _=ce(o,n);this._containerDiffX=_.left,this._containerDiffY=_.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))),Ft(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,ht.add(ot,U+e,i),ht.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,ht.add(ot,J+e,i),ht.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?(_t(e._id),dt(e._id),ct(e._id),this._finishSort(),this._unbindScrollListeners(),r._containerDiffX=this._containerDiffX,r._containerDiffY=this._containerDiffY,this._reset(),be(i,n.itemDraggingClass),Re.autoScroller.removeItem(e),s._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():r.start()):this.stop()};var Ce=/^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/,Pe={};function Me(t){var e=Pe[t];return e||((e=t.replace(Ce,""))!==t&&(e=e[0].toLowerCase()+e.slice(1)),Pe[t]=e,e)}function Xe(t,e){for(var i in e)t.style[i]=e[i]}var Ye,qe,Oe=!(!Element||!gt(Element.prototype.animate)),He=!!(Element&&(Ye=Element.prototype.animate,qe=window.Symbol,Ye&&gt(qe)&&gt(qe.toString)&&qe(Ye).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 We(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 Ne(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 Fe(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(!Oe)return Xe(s,e),this._callback=gt(n.onFinish)?n.onFinish:null,void this._onFinish();var r,o,h,a=this._animation,l=this._props,_=this._values,d=n.duration||300,c=n.easing||"ease",u=!1;if(a&&(o=0,d===this._duration&&c===this._easing||(u=!0),!u)){for(r in e)if(++o,-1===(h=l.indexOf(r))||e[r]!==_[h]){u=!0;break}o!==l.length&&(u=!0)}if(u&&a.cancel(),this._callback=gt(n.onFinish)?n.onFinish:null,!a||u){for(r in l.length=_.length=0,e)l.push(r),_.push(e[r]);this._duration=d,this._easing=c,this._animation=s.animate([We(t,He),We(e,He)],{duration:d,easing:c}),this._animation.onfinish=this._onFinish,Xe(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 Ie(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()},Ne.prototype._updateDimensions=function(){this.isActive()&&Xe(this._element,{width:this._item._width+"px",height:this._item._height+"px"})},Ne.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 h,a,l,_=s+i._marginLeft,d=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=_,this._nextTransY=d,h=i._id,a=this._setupAnimation,l=this._startAnimation,ht.add(ot,tt+h,a),ht.add(2,et+h,l)}}else this.reset()},Ne.prototype._setupAnimation=function(){if(this.isActive()){var t=we(this._element);this._transX=t.x,this._transY=t.y}},Ne.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={},h={};o[Zt]=Be(e,i),h[Zt]=Be(s,n),t.start(o,h,{duration:r.layoutDuration,easing:r.layoutEasing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&(this._element.style[Zt]=Be(s,n),t.stop())}},Ne.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},Ne.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animation.isAnimating())return void this.reset();this._resetAfterLayout=!0}},Ne.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off(v,this._onReleaseEnd),e.off(o,this._onLayoutStart),e.off(p,this._onMigrate),e.off(_,this._onHide),i.on(v,this._onReleaseEnd),i.on(o,this._onLayoutStart),i.on(p,this._onMigrate),i.on(_,this._onHide),this._didMigrate=!0}},Ne.prototype._onHide=function(t){t.indexOf(this._item)>-1&&this.reset()},Ne.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=gt(s.dragPlaceholder.createElement)?s.dragPlaceholder.createElement(e):document.createElement("div"),this._element=t,n._element=t,this._className=s.itemPlaceholderClass||"",this._className&&Ft(t,this._className),Xe(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(v,this._onReleaseEnd),i.on(p,this._onMigrate),i.on(_,this._onHide),gt(s.dragPlaceholder.onCreate)&&s.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},Ne.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,ht.remove(2,it+t),r.stop(),r._element=null,s.off(v,this._onReleaseEnd),s.off(o,this._onLayoutStart),s.off(p,this._onMigrate),s.off(_,this._onHide),this._className&&(be(e,this._className),this._className=""),e.parentNode.removeChild(e),this._element=null,gt(n.dragPlaceholder.onRemove)&&n.dragPlaceholder.onRemove(i,e)}},Ne.prototype.isActive=function(){return!!this._element},Ne.prototype.getElement=function(){return this._element},Ne.prototype.updateDimensions=function(){var t,e;this.isActive()&&(t=this._item._id,e=this._updateDimensions,ht.add(2,it+t,e))},Ne.prototype.destroy=function(){this.reset(),this._animation.destroy(),this._item=this._animation=null},Fe.prototype.start=function(){if(!this._isDestroyed&&!this._isActive){var t=this._item,e=t.getGrid(),i=e._settings;this._isActive=!0,Ft(t._element,i.itemReleasingClass),i.dragRelease.useDragContainer||this._placeToGrid(),e._emit("dragReleaseStart",t),e._nextLayoutData||t._layout.start(!1)}},Fe.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(v,s)}},Fe.prototype.isJustReleased=function(){return this._isActive&&!1===this._isPositioningStarted},Fe.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Fe.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}},Fe.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,be(e._element,i))}};function ze(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 Ve(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}function je(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",Ft(i,e?n.itemVisibleClass:n.itemHiddenClass),this.setStyles(e?n.visibleStyles:n.hiddenStyles)}ze.prototype.start=function(t,e){if(!this._isDestroyed){var i,s,n,r=this._item,o=r._dragRelease,h=r.getGrid()._settings,a=this._isActive,l=o.isJustReleased(),_=l?h.dragRelease.duration:h.layoutDuration,d=l?h.dragRelease.easing:h.layoutEasing,c=!t&&!this._skipNextAnimation&&_>0;if(a&&(at(r._id),r._emitter.burst(this._queue,!0,r)),l&&(o._isPositioningStarted=!0),gt(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=d,this._animOptions.duration=_,this._isInterrupted=a,i=r._id,s=this._setupAnimation,n=this._startAnimation,ht.add(ot,N+i,s),ht.add(2,F+i,n)}},ze.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item;if(at(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()}be(s._element,s.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&s._emitter.burst(this._queue,!0,s)}},ze.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}},ze.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}},ze.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,be(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),t._emitter.burst(this._queue,!1,t)}},ze.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}},ze.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||Ft(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)},Ve.prototype.start=function(t,e,i){if(!this._isDestroyed){var s,n,r,o,h,a,l,_,d,c,u=this._item,v=u._element,y=u.isActive(),S=u.isVisible(),w=u.getGrid(),b=w._settings,D=t._settings,A=t._element,x=t._items,E=w._items.indexOf(u),T=i||document.body;if("number"==typeof e)s=jt(x,e,1);else{if(!(n=t.getItem(e)))return;s=x.indexOf(n)}(u.isPositioning()||this._isActive||u.isReleasing())&&(l=(a=we(v)).x,_=a.y),u.isPositioning()&&u._layout.stop(!0,l,_),this._isActive&&(l-=this._containerDiffX,_-=this._containerDiffY,this.stop(!0,l,_)),u.isReleasing()&&(l-=u._dragRelease._containerDiffX,_-=u._dragRelease._containerDiffY,u._dragRelease.stop(!0,l,_)),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(g)&&t._emit(g,{item:u,fromGrid:w,fromIndex:E,toGrid:t,toIndex:s}),b.itemClass!==D.itemClass&&(be(v,b.itemClass),Ft(v,D.itemClass)),(d=S?b.itemVisibleClass:b.itemHiddenClass)!==(c=S?D.itemVisibleClass:D.itemHiddenClass)&&(be(v,d),Ft(v,c)),w._items.splice(E,1),Vt(x,u,s),u._gridId=t._id,y?T!==(r=v.parentNode)&&(T.appendChild(v),o=ce(T,r,!0),a||(l=(a=we(v)).x,_=a.y),u._setTranslate(l+o.left,_+o.top)):A.appendChild(v),u._visibility.setStyles(S?D.visibleStyles:D.hiddenStyles),y&&(h=ce(T,A,!0)),u._refreshDimensions(),u._sortData=null,u._drag=D.dragEnabled?new Re(u):null,y?(this._isActive=!0,this._container=T,this._containerDiffX=h.left,this._containerDiffY=h.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})}},Ve.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}},Ve.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},je.prototype.show=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=gt(e)?e:null,r=i.getGrid()._settings;this._isShowing||this._isHidden?!this._isShowing||t?(this._isShowing||(i._emitter.burst(this._queue,!0,i),be(s,r.itemHiddenClass),Ft(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)}},je.prototype.hide=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=gt(e)?e:null,r=i.getGrid()._settings;this._isHiding||!this._isHidden?!this._isHiding||t?(this._isHiding||(i._emitter.burst(this._queue,!0,i),Ft(s,r.itemHiddenClass),be(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)}},je.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)}},je.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]},je.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(),be(e,i.itemVisibleClass),be(e,i.itemHiddenClass),e.style.display="",this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0}},je.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var s,n=this._item,r=this._animation,o=this._childElement,h=n.getGrid()._settings,a=t?h.visibleStyles:h.hiddenStyles,l=t?h.showDuration:h.hideDuration,_=t?h.showEasing:h.hideEasing,d=e||l<=0;if(a){if(lt(n._id),d)return Xe(o,a),r.stop(),void(i&&i());var c,u,f;r.isAnimating()&&(r._animation.onfinish=null),c=n._id,u=function(){s=Ie(o,a)},f=function(){r.start(s,a,{duration:l,easing:_,onFinish:i})},ht.add(ot,z+c,u),ht.add(2,V+c,f)}else i&&i()}},je.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._item._emitter.burst(this._queue,!1,this._item))},je.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)}},je.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 b,e.parentNode!==t._element&&t._element.appendChild(e),Ft(e,n.itemClass),"boolean"!=typeof i&&(i="none"!==yt(e,"display")),this._isActive=i,this._visibility=new je(this),this._layout=new ze(this),this._migrate=new Ve(this),this._drag=n.dragEnabled?new Re(this):null,this._dragRelease=new Fe(this),this._dragPlaceholder=new Ne(this)}function Je(t){var e,i,s,n,r,o=.001,h=.5;function a(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,h,l=t.items,_=t.slots,d=!!(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=a(r),o=a(o)),h=this.computeNextSlot(t,r,o,d,c),c?h.left+h.width>t.width&&(t.width=h.left+h.width):h.top+h.height>t.height&&(t.height=h.top+h.height),_[++this.slotIndex]=h.left,_[++this.slotIndex]=h.top,(u||f)&&this.slotSizes.push(h.width,h.height);if(u)for(i=0;i<_.length;i+=2)_[i]=t.width-(_[i]+this.slotSizes[i]);if(f)for(i=1;i<_.length;i+=2)_[i]=t.height-(_[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,a,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,_=0;_<u.length;_++)if((a=u[_])&&(r=this.getRect(a),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>h&&f.push(this.addRect(0,t.height,c.left,1/0)),c.left+c.width<t.width-h&&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>h&&f.push(this.addRect(t.width,0,1/0,c.top)),c.top+c.height<t.height-h&&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&&(_=0);_<u.length;_++)if(a=u[_])for(r=this.getRect(a),l=this.splitRect(r,c),d=0;d<l.length;d++)a=l[d],r=this.getRect(a),(n?r.left+o<t.width-o:r.top+o<t.height-o)&&f.push(a);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)>=h&&e.push(this.addRect(t.left,t.top,i,t.height)),(i=t.left+t.width-(n.left+n.width))>=h&&e.push(this.addRect(n.left+n.width,t.top,i,t.height)),(s=n.top-t.top)>=h&&e.push(this.addRect(t.left,t.top,t.width,s)),(s=t.top+t.height-(n.top+n.height))>=h&&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 _=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]};_.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,St(e,"margin-left")),this._marginRight=Math.max(0,St(e,"margin-right")),this._marginTop=Math.max(0,St(e,"margin-top")),this._marginBottom=Math.max(0,St(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(),be(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,h={id:e,items:i,slots:null,width:o?0:s,height:o?n:0,_grid:t,_settings:this._options};if(!i.length)return h.slots=[],this._finalizeLayout(h),void r(h);if(this._processor)return h.slots=window.Float32Array?new Float32Array(2*i.length):new Array(2*i.length),this._processor.computeLayout(h,h._settings),this._finalizeLayout(h),void r(h);var a,l,_,d=new Float32Array(4+2*i.length);for(d[0]=e,d[1]=h.width,d[2]=h.height,d[3]=h._settings,a=0,l=3;a<i.length;a++)_=i[a],d[++l]=_._width+_._marginLeft+_._marginRight,d[++l]=_._height+_._marginTop+_._marginBottom;return this._layoutQueue.push(e),this._layouts[e]=h,this._layoutCallbacks[e]=r,this._layoutWorkerData[e]=d,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){ht.add(ot,rt+t,e)}(i,o):(s=n=0,t()))};return function(h){if(!r){if(!(e<=0))return!0===h?(r=!0,s=n=0,o=void 0,void function(t){ht.remove(ot,rt+t)}(i)):void(s<=0?(s=e,o(0)):s=e);!0!==h&&t()}}}var ni="[object HTMLCollection]",ri="[object NodeList]";function oi(t){var e=Object.prototype.toString.call(t);return e===ni||e===ri}var hi="object",ai="[object Object]",li=Object.prototype.toString;function _i(t){return typeof t===hi&&li.call(t)===ai}function di(){}var ci,ui="number",fi="string",pi="instant",mi=0;function gi(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=vi({},t);e&&(i=vi(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}(gi.defaultOptions,e);s.visibleStyles=yi(s.visibleStyles),s.hiddenStyles=yi(s.hiddenStyles),gt(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 b,this._onLayoutDataReceived=this._onLayoutDataReceived.bind(this),i[this._id]=this,Ft(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++)Nt(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 vi(t,e){var i,s,n,r=Object.keys(e),o=r.length;for(n=0;n<o;n++)i=_i(e[s=r[n]]),_i(t[s])&&i?t[s]=vi(vi({},t[s]),e[s]):i?t[s]=vi({},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=T(n,e))&&(s[i]=t[e]);return s}function Si(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]}gi.Item=Ze,gi.ItemLayout=ze,gi.ItemVisibility=je,gi.ItemMigrate=Ve,gi.ItemDrag=Re,gi.ItemDragRelease=Fe,gi.ItemDragPlaceholder=Ne,gi.Emitter=b,gi.Animator=Ge,gi.Dragger=O,gi.Packer=ei,gi.AutoScroller=Gt,gi.defaultPacker=new ei(2),gi.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"},gi.prototype.on=function(t,e){return this._emitter.on(t,e),this},gi.prototype.off=function(t,e){return this._emitter.off(t,e),this},gi.prototype.getElement=function(){return this._element},gi.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},gi.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},gi.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},gi.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},gi.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},gi.prototype.layout=function(t,e){if(this._isDestroyed)return this;var i=this._nextLayoutData;i&&gt(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 h,a=this._width-this._borderLeft-this._borderRight,l=this._height-this._borderTop-this._borderBottom,_=this._settings.layout;return gt(_)?h=_(this,s,r,a,l,this._onLayoutDataReceived):(gi.defaultPacker.setOptions(_),h=gi.defaultPacker.createLayout(this,s,r,a,l,this._onLayoutDataReceived)),gt(h)&&this._nextLayoutData&&this._nextLayoutData.id===s&&(this._nextLayoutData.cancel=h),this},gi.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,h,a=e||{},l=a.layout?a.layout:void 0===a.layout,_=this._items,d=!1;for(h=0;h<s.length;h++)(r=s[h]).parentNode!==this._element&&(n=n||document.createDocumentFragment()).appendChild(r);for(n&&this._element.appendChild(n),h=0;h<s.length;h++)r=s[h],(o=s[h]=new Ze(this,r,a.active))._isActive&&(d=!0,o._layout._skipNextAnimation=!0);for(h=0;h<s.length;h++)(o=s[h])._refreshDimensions(),o._refreshSortData();return Vt(_,s,a.index),this._hasListeners("add")&&this._emit("add",s.slice(0)),d&&l&&this.layout(l===pi,gt(l)?l:void 0),s},gi.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,h=!1,a=this.getItems(),_=[],d=[];for(n=0;n<t.length;n++)(s=t[n])._isDestroyed||-1!==(i=this._items.indexOf(s))&&(s._isActive&&(h=!0),_.push(s),d.push(a.indexOf(s)),s._destroy(r.removeElements),this._items.splice(i,1));return this._hasListeners(l)&&this._emit(l,_.slice(0),d),h&&o&&this.layout(o===pi,gt(o)?o:void 0),_},gi.prototype.show=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!0,e),this},gi.prototype.hide=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!1,e),this},gi.prototype.filter=function(t,e){if(this._isDestroyed||!this._items.length)return this;var i,s,n=[],r=[],o=typeof t===fi,h=gt(t),a=e||{},l=!0===a.instant,_=a.syncWithLayout,c=a.layout?a.layout:void 0===a.layout,u=gt(a.onFinish)?a.onFinish:null,f=-1,p=di;if(u&&(p=function(){++f&&u(n.slice(0),r.slice(0))}),h||o)for(s=0;s<this._items.length;s++)i=this._items[s],(h?t(i):Nt(i._element,t))?n.push(i):r.push(i);return n.length?this.show(n,{instant:l,syncWithLayout:_,onFinish:p,layout:!1}):p(),r.length?this.hide(r,{instant:l,syncWithLayout:_,onFinish:p,layout:!1}):p(),(n.length||r.length)&&(this._hasListeners(d)&&this._emit(d,n.slice(0),r.slice(0)),c&&this.layout(c===pi,gt(c)?c:void 0)),this},gi.prototype.sort=function(){var t,e,i,s;function n(n,r){for(var o,h,a,l,_=0,d=0;d<t.length;d++)if(o=t[d][0],h=t[d][1],a=(n._sortData?n:n._refreshSortData())._sortData[o],l=(r._sortData?r:r._refreshSortData())._sortData[o],_="desc"===h||!h&&e?l<a?-1:l>a?1:0:a<l?-1:a>l?1:0)return _;return _||(s||(s=Si(i)),_=e?wi(s,r,n):wi(s,n,r)),_}function r(n,r){var o=e?-t(n,r):t(n,r);return o||(s||(s=Si(i)),o=e?wi(s,r,n):wi(s,n,r)),o}return function(o,h){if(this._isDestroyed||this._items.length<2)return this;var a=this._items,l=h||{},_=l.layout?l.layout:void 0===l.layout;if(e=!!l.descending,i=a.slice(0),s=null,gt(o))t=o,a.sort(r);else if(typeof o===fi)t=o.trim().split(" ").filter((function(t){return t})).map((function(t){return t.split(":")})),a.sort(n);else{if(!Array.isArray(o))throw t=e=i=s=null,new Error("Invalid comparer argument provided.");a.length=0,a.push.apply(a,o)}return this._hasListeners(c)&&this._emit(c,a.slice(0),i),_&&this.layout(_===pi,gt(_)?_:void 0),t=e=i=s=null,this}}(),gi.prototype.move=function(t,e,i){if(this._isDestroyed||this._items.length<2)return this;var s,o,h=this._items,a=i||{},l=a.layout?a.layout:void 0===a.layout,_=a.action===n,d=_?n:r,c=this.getItem(t),f=this.getItem(e);return c&&f&&c!==f&&(s=h.indexOf(c),o=h.indexOf(f),_?Ut(h,s,o):Qt(h,s,o),this._hasListeners(u)&&this._emit(u,{item:c,fromIndex:s,toIndex:o,action:d}),l&&this.layout(l===pi,gt(l)?l:void 0)),this},gi.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,h=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,gt(o)?o:void 0),h&&e.layout(h===pi,gt(h)?h:void 0)),this},gi.prototype.destroy=function(t){if(this._isDestroyed)return this;var e,s,n,r=this._element,o=this._items.slice(0),h=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,be(r,this._settings.containerClass),h)r.style[s]="";return this._emit("destroy"),this._emitter.destroy(),delete i[this._id],this._isDestroyed=!0,this},gi.prototype._emit=function(){this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments)},gi.prototype._hasListeners=function(t){return!this._isDestroyed&&this._emitter.countListeners(t)>0},gi.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},gi.prototype._updateBorders=function(t,e,i,s){var n=this._element;t&&(this._borderLeft=St(n,"border-left-width")),e&&(this._borderRight=St(n,"border-right-width")),i&&(this._borderTop=St(n,"border-top-width")),s&&(this._borderBottom=St(n,"border-bottom-width"))},gi.prototype._refreshDimensions=function(){this._updateBoundingRect(),this._updateBorders(1,1,1,1),this._boxSizing=yt(this._element,"box-sizing")},gi.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,_=this._nextLayoutData.onFinish,d=t.items.length,c=d;for(this._nextLayoutData=null,!this._isLayoutFinished&&this._hasListeners(a)&&this._emit(a,this._layout.items.slice(0)),this._layout=t,ci.length=0,n=0;n<d;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&&Xe(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=gt(l)?l:_;e||(r._isLayoutFinished=!0),gt(i)&&i(t.items.slice(0),e),!e&&r._hasListeners(h)&&r._emit(h,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}}}),gi.prototype._setItemsVisibility=function(t,e,i){var s,n,r=this,h=t.slice(0),a=i||{},l=!0===a.instant,d=a.onFinish,c=a.layout?a.layout:void 0===a.layout,u=h.length,f=e?"showStart":_,p=e?"showEnd":"hideEnd",m=e?"show":"hide",g=!1,v=[],y=[];if(u){for(n=0;n<h.length;n++)s=h[n],(e&&!s._isActive||!e&&s._isActive)&&(g=!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),g&&!1!==a.syncWithLayout?this.on(o,S):S(),g&&c&&this.layout(c===pi,gt(c)?c:void 0)}else gt(d)&&d(h);function S(){for(g&&!1!==a.syncWithLayout&&r.off(o,S),r._hasListeners(f)&&r._emit(f,h.slice(0)),n=0;n<h.length;n++)h[n]._gridId===r._id?h[n]._visibility[m](l,(function(t,e){t||v.push(e),--u<1&&(gt(d)&&d(v.slice(0)),r._hasListeners(p)&&r._emit(p,v.slice(0)))})):--u<1&&(gt(d)&&d(v.slice(0)),r._hasListeners(p)&&r._emit(p,v.slice(0)))}};const bi=gi;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 Ai(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,icon:n.icon||"https://cdn-icons-png.flaticon.com/512/732/732212.png",label_field:n.label_field||"id"},this.data=new Map,this.default_icon=this.config.icon,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 bi(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),this.gridContainer.addEventListener("click",(function(t){var e=t.target.closest(".vi-grid-item");e&&s.toggleSelect(e)}))},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}),console.log("selected"),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=t.id,i=this.gridContainer.querySelector('.vi-grid-item[data-id="'.concat(e,'"]'));i&&(this.toggleSelect(i),i.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),i.style.transition="box-shadow 0.4s ease",i.style.boxShadow="0 0 12px 3px rgba(0, 120, 255, 0.7)",setTimeout((function(){i.style.boxShadow="none"}),600),i.style.zIndex=10,setTimeout((function(){i.style.zIndex=""}),600))}}}],e&&Ai(t.prototype,e),i&&Ai(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),Ti=e.H;export{Ti as vi_Grid};
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,{H:()=>xi});var i={},s="function"==typeof Map?new Map:null,n="swap",r="move",o="layoutStart",h="layoutEnd",a="layoutAbort",l="remove",_="hideStart",d="filter",c="sort",u="move",f="send",p="beforeSend",m="receive",g="beforeReceive",v="dragReleaseEnd",y="ontouchstart"in window,S=!!window.PointerEvent,w=!!window.navigator.msPointerEnabled;function b(){this._events={},this._queue=[],this._counter=0,this._clearOnEmit=!1}b.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},b.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},b.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},b.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,h=s.length;o<h;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},b.prototype.burst=function(){return this._events?(this._clearOnEmit=!0,this.emit.apply(this,arguments),this):this},b.prototype.countListeners=function(t){if(!this._events)return 0;var e=this._events[t];return e?e.length:0},b.prototype.destroy=function(){return this._events?(this._queue.length=this._counter=0,this._events=null,this):this};var D=S?"pointerout":w?"MSPointerOut":"";function A(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))}A.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))},A.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)},A.prototype._resetData=function(){window.clearTimeout(this._timeout),this._timeout=null,this._outEvent=null},A.prototype._onStart=function(t){"mouse"!==t.pointerType&&this._addBehaviour()},A.prototype._onOut=function(t){this._dragger._getTrackedTouch(t)&&(this._resetData(),this._outEvent=t,this._timeout=window.setTimeout(this._onTimeout,100))},A.prototype._onTimeout=function(){var t=this._outEvent;this._resetData(),this._dragger.isActive()&&this._dragger._onCancel(t)},A.prototype.destroy=function(){D&&(this._dragger.off("start",this._onStart),this._removeBehaviour())};var E=["","webkit","moz","ms","o","Webkit","Moz","MS","O"],x={};function T(t,e){var i=x[e]||"";if(i)return i;for(var s=e[0].toUpperCase()+e.slice(1),n=0;n<E.length;){if((i=E[n]?E[n]+s:e)in t)return x[e]=i,i;++n}return""}function k(){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 L=window.navigator.userAgent.toLowerCase(),R=L.indexOf("edge")>-1,I=L.indexOf("trident")>-1,C=L.indexOf("firefox")>-1,P=L.indexOf("android")>-1,M=!!k()&&{passive:!0},X="touchAction",Y=T(document.documentElement.style,X),q="auto";function O(t,e){this._element=t,this._emitter=new b,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||I)&&(S||w)&&(this._edgeHack=new A(this)),this.setCssProps(e),this._touchAction||this.setTouchAction(q),t.addEventListener("dragstart",O._preventDefault,!1),t.addEventListener(O._inputEvents.start,this._onStart,M)}O._pointerEvents={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},O._msPointerEvents={start:"MSPointerDown",move:"MSPointerMove",cancel:"MSPointerCancel",end:"MSPointerUp"},O._touchEvents={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},O._mouseEvents={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},O._inputEvents=y?O._touchEvents:S?O._pointerEvents:w?O._msPointerEvents:O._mouseEvents,O._emitter=new b,O._emitterEvents={start:"start",move:"move",end:"end",cancel:"cancel"},O._activeInstances=[],O._preventDefault=function(t){t.preventDefault&&!1!==t.cancelable&&t.preventDefault()},O._activateInstance=function(t){O._activeInstances.indexOf(t)>-1||(O._activeInstances.push(t),O._emitter.on(O._emitterEvents.move,t._onMove),O._emitter.on(O._emitterEvents.cancel,t._onCancel),O._emitter.on(O._emitterEvents.end,t._onEnd),1===O._activeInstances.length&&O._bindListeners())},O._deactivateInstance=function(t){var e=O._activeInstances.indexOf(t);-1!==e&&(O._activeInstances.splice(e,1),O._emitter.off(O._emitterEvents.move,t._onMove),O._emitter.off(O._emitterEvents.cancel,t._onCancel),O._emitter.off(O._emitterEvents.end,t._onEnd),O._activeInstances.length||O._unbindListeners())},O._bindListeners=function(){window.addEventListener(O._inputEvents.move,O._onMove,M),window.addEventListener(O._inputEvents.end,O._onEnd,M),O._inputEvents.cancel&&window.addEventListener(O._inputEvents.cancel,O._onCancel,M)},O._unbindListeners=function(){window.removeEventListener(O._inputEvents.move,O._onMove,M),window.removeEventListener(O._inputEvents.end,O._onEnd,M),O._inputEvents.cancel&&window.removeEventListener(O._inputEvents.cancel,O._onCancel,M)},O._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},O._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},O._onMove=function(t){O._emitter.emit(O._emitterEvents.move,t)},O._onCancel=function(t){O._emitter.emit(O._emitterEvents.cancel,t)},O._onEnd=function(t){O._emitter.emit(O._emitterEvents.end,t)},O.prototype._reset=function(){this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._isActive=!1,O._deactivateInstance(this)},O.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===O._emitterEvents.start?0:this.getDeltaTime(),isFirst:t===O._emitterEvents.start,isFinal:t===O._emitterEvents.end||t===O._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}},O.prototype._emit=function(t,e){this._emitter.emit(t,this._createEvent(t,e))},O.prototype._getTrackedTouch=function(t){return null===this._pointerId?null:O._getTouchById(t,this._pointerId)},O.prototype._onStart=function(t){if(!this._isDestroyed&&null===this._pointerId&&(this._pointerId=O._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(O._emitterEvents.start,t),this._isActive&&O._activateInstance(this)}},O.prototype._onMove=function(t){var e=this._getTrackedTouch(t);e&&(this._currentX=e.clientX,this._currentY=e.clientY,this._emit(O._emitterEvents.move,t))},O.prototype._onCancel=function(t){this._getTrackedTouch(t)&&(this._emit(O._emitterEvents.cancel,t),this._reset())},O.prototype._onEnd=function(t){this._getTrackedTouch(t)&&(this._emit(O._emitterEvents.end,t),this._reset())},O.prototype.isActive=function(){return this._isActive},O.prototype.setTouchAction=function(t){this._touchAction=t,Y&&(this._cssProps[Y]="",this._element.style[Y]=t),y&&(this._element.removeEventListener(O._touchEvents.start,O._preventDefault,!0),(this._element.style[Y]!==t||C&&P)&&this._element.addEventListener(O._touchEvents.start,O._preventDefault,!0))},O.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!==X?(i=T(n.style,e))&&(s[i]="",n.style[i]=t[e]):this.setTouchAction(t[e]))}},O.prototype.getDeltaX=function(){return this._currentX-this._startX},O.prototype.getDeltaY=function(){return this._currentY-this._startY},O.prototype.getDistance=function(){var t=this.getDeltaX(),e=this.getDeltaY();return Math.sqrt(t*t+e*e)},O.prototype.getDeltaTime=function(){return this._startTime?Date.now()-this._startTime:0},O.prototype.on=function(t,e){this._emitter.on(t,e)},O.prototype.off=function(t,e){this._emitter.off(t,e)},O.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(O._inputEvents.start,this._onStart,M),t.removeEventListener("dragstart",O._preventDefault,!1),t.removeEventListener(O._touchEvents.start,O._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 W(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={}}W.prototype._step=function(t){var e,i,s,n,r,o,h=this._lanes,a=this._stepQueue,l=this._stepCallbacks;for(this._nextStep=null,e=0;e<h.length;e++){for(n=h[e].queue,r=h[e].callbacks,o=h[e].indices,i=0;i<n.length;i++)(s=n[i])&&(a.push(s),l[s]=r[s],delete r[s],delete o[s]);n.length=0}for(e=0;e<a.length;e++)l[s=a[e]]&&l[s](t),delete l[s];a.length=0},W.prototype.add=function(t,e,i){this._lanes[t].add(e,i),this._nextStep||(this._nextStep=G(this._step))},W.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 N="layoutRead",F="layoutWrite",z="visibilityRead",V="visibilityWrite",j="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,ht=new W(3);function at(t){ht.remove(ot,N+t),ht.remove(2,F+t)}function lt(t){ht.remove(ot,z+t),ht.remove(2,V+t)}function _t(t){ht.remove(ot,j+t),ht.remove(2,Q+t)}function dt(t){ht.remove(ot,U+t),ht.remove(2,Z+t)}function ct(t){ht.remove(ot,J+t),ht.remove(2,$+t)}function ut(t,e){ht.add(1,K+t,e)}function ft(t){ht.remove(ot,tt+t),ht.remove(2,et+t)}function pt(t,e){ht.add(ot,st,t),ht.add(2,nt,e)}var mt="function";function gt(t){return typeof t===mt}var vt="function"==typeof WeakMap?new WeakMap:null;function yt(t,e){var i=vt&&vt.get(t);return i||(i=window.getComputedStyle(t,null),vt&&vt.set(t,i)),i.getPropertyValue(e)}function St(t,e){return parseFloat(yt(t,e))||0}var wt,bt=document.documentElement,Dt=document.body,At={value:0,offset:0};function Et(t){return t===window||t===bt||t===Dt?window:t}function xt(t){return t===window?t.pageXOffset:t.scrollLeft}function Tt(t){return t===window?t.pageYOffset:t.scrollTop}function kt(t){return t===window?bt.scrollWidth-bt.clientWidth:t.scrollWidth-t.clientWidth}function Lt(t){return t===window?bt.scrollHeight-bt.clientHeight:t.scrollHeight-t.clientHeight}function Rt(t,e){if(e=e||{},t===window)e.width=bt.clientWidth,e.height=bt.clientHeight,e.left=0,e.right=e.width,e.top=0,e.bottom=e.height;else{var i=t.getBoundingClientRect(),s=t.clientLeft||St(t,"border-left-width"),n=t.clientTop||St(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 It(t){return t._drag._getGrid()._settings.dragAutoScroll}function Ct(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 At.value=Math.min(s/2,t),At.offset=Math.max(0,i+2*At.value+s*e-s)/2,At}function Mt(){this.reset()}function Xt(){this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}function Yt(t,e){this.pool=[],this.createItem=t,this.releaseItem=e}function qt(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?xt(this.element):Tt(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=It(e).speed;return gt(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=It(t).onStart;gt(e)&&e(t,this.element,this.direction)},Mt.prototype.onStop=function(){var t=this.item,e=It(t).onStop;gt(e)&&e(t,this.element,this.direction),t._drag&&t._drag.sort()},Xt.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},Xt.prototype.addRequest=function(t){1&t.direction?(this.removeRequest(this.requestX),this.requestX=t):(this.removeRequest(this.requestY),this.requestY=t),t.action=this},Xt.prototype.removeRequest=function(t){t&&(this.requestX===t?(this.requestX=null,t.action=null):this.requestY===t&&(this.requestY=null,t.action=null))},Xt.prototype.computeScrollValues=function(){this.scrollLeft=this.requestX?this.requestX.value:xt(this.element),this.scrollTop=this.requestY?this.requestY.value:Tt(this.element)},Xt.prototype.scroll=function(){var t=this.element;t&&(t.scrollTo?t.scrollTo(this.scrollLeft,this.scrollTop):(t.scrollLeft=this.scrollLeft,t.scrollTop=this.scrollTop))},Yt.prototype.pick=function(){return this.pool.pop()||this.createItem()},Yt.prototype.release=function(t){this.releaseItem(t),-1===this.pool.indexOf(t)&&this.pool.push(t)},Yt.prototype.reset=function(){this.pool.length=0};var Ot={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 Yt((function(){return new Mt}),(function(t){t.reset()})),this._actionPool=new Yt((function(){return new Xt}),(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 h=r.threshold-Math.max(0,r.distance);o=t/r.threshold*h}else o=t;var a=r.speed,l=o;return a===o?l:a<o?(l=a+e*(r.deltaTime/1e3),Math.min(o,l)):(l=a-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,h,a){return e.left=h-.5*i,e.top=a-.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,ht.remove(ot,st),ht.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 h=this._requests[e],a=h[t._id];a?a.element===i&&a.direction===s||a.reset():a=this._requestPool.pick(),a.item=t,a.element=i,a.direction=s,a.threshold=n,a.distance=r,a.maxValue=o,h[t._id]=a},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=It(t),n=gt(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 h=this._dragDirections[t._id],a=h[0],l=h[1];if(!a&&!l)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));for(var _=this._getItemHandleRect(t,s.handle,Ot),d=Ht,c=null,u=null,f=!0,p=!0,m=0,g=0,v=null,y=null,S=0,w=0,b=0,D=null,A=-1/0,E=0,x=0,T=null,k=0,L=0,R=null,I=-1/0,C=0,P=0,M=null,X=0,Y=0,q=0;q<n.length;q++)c=n[q],f=e&&a&&2!==c.axis,p=i&&l&&1!==c.axis,g=c.priority||0,(!f||g<A)&&(!p||g<I)||(u=Et(c.element||c),w=f?kt(u):-1,b=p?Lt(u):-1,(w||b)&&((m=qt(_,d=Rt(u,d)))<=0||(f&&g>=A&&w>0&&(g>A||m>x)&&(y=null,v=Pt("number"==typeof c.threshold?c.threshold:r,o,_.width,d.width),5===a?(S=d.right+v.offset-_.right)<=v.value&&xt(u)<w&&(y=5):9===a&&(S=_.left-(d.left-v.offset))<=v.value&&xt(u)>0&&(y=9),null!==y&&(D=u,A=g,E=v.value,x=m,T=y,k=S,L=w)),p&&g>=I&&b>0&&(g>I||m>P)&&(y=null,v=Pt("number"==typeof c.threshold?c.threshold:r,o,_.height,d.height),6===l?(S=d.bottom+v.offset-_.bottom)<=v.value&&Tt(u)<b&&(y=6):10===l&&(S=_.top-(d.top-v.offset))<=v.value&&Tt(u)>0&&(y=10),null!==y&&(R=u,I=g,C=v.value,P=m,M=y,X=S,Y=b)))));e&&(D?this._requestItemScroll(t,1,D,T,E,k,L):this._cancelItemScroll(t,1)),i&&(R?this._requestItemScroll(t,2,R,M,C,X,Y):this._cancelItemScroll(t,2))},Gt.prototype._updateScrollRequest=function(t){for(var e=t.item,i=It(e),s=gt(i.targets)?i.targets(e):i.targets,n=s&&s.length||0,r=i.threshold,o=i.safeZone,h=this._getItemHandleRect(e,i.handle,Ot),a=Ht,l=null,_=null,d=!1,c=null,u=null,f=null,p=null,m=null,g=0;g<n;g++)if((_=Et((l=s[g]).element||l))===t.element){if(d=!!(1&t.direction)){if(2===l.axis)continue}else if(1===l.axis)continue;if((p=d?kt(_):Lt(_))<=0)break;if(qt(h,a=Rt(_,a))<=0)break;if(c=Pt("number"==typeof l.threshold?l.threshold:r,o,d?h.width:h.height,d?a.width:a.height),(u=9===t.direction?h.left-(a.left-c.offset):5===t.direction?a.right+c.offset-h.right:10===t.direction?h.top-(a.top-c.offset):a.bottom+c.offset-h.bottom)>c.value)break;if(f=d?xt(_):Tt(_),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,h=this._items,a=this._requests[1],l=this._requests[2],_=0;_<h.length;_++)t=h[_],n=(s=this._requestOverlapCheck[t._id])>0&&this._tickTime-s>this._overlapCheckInterval,r=!0,(e=a[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++)Ct(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 Wt=window.Element.prototype,Bt=Wt.matches||Wt.matchesSelector||Wt.webkitMatchesSelector||Wt.mozMatchesSelector||Wt.msMatchesSelector||Wt.oMatchesSelector||function(){return!1};function Nt(t,e){return Bt.call(t,e)}function Ft(t,e){e&&(t.classList?t.classList.add(e):Nt(t,"."+e)||(t.className+=" "+e))}var zt=[];function Vt(t,e,i){var s="number"==typeof i?i:-1;s<0&&(s=t.length-s+1),t.splice.apply(t,zt.concat(s,0,e)),zt.length=0}function jt(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=jt(t,e),n=jt(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=jt(t,e),r=jt(t,i);n!==r&&(s=t[n],t[n]=t[r],t[r]=s)}}var Zt=T(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 he(t){for(var e=document,i=t||e;i&&i!==e&&"static"===yt(i,"position")&&!oe(i);)i=i.parentElement||e;return i}var ae={},le={},_e={};function de(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+=St(t,"border-left-width"),s.top+=St(t,"border-top-width")),s)}function ce(t,e,i){return _e.left=0,_e.top=0,t===e||i&&(t=he(t))===(e=he(e))||(de(t,ae),de(e,le),_e.left=le.left-ae.left,_e.top=le.top-ae.top),_e}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={},ge=/^matrix3d/,ve=/([^,]*,){4}/,ye=/([^,]*,){12}/,Se=/[^,]*,/;function we(t){me.x=0,me.y=0;var e=yt(t,ee);if(!e||"none"===e)return me;var i=ge.test(e),s=e.replace(i?ye:ve,""),n=s.replace(Se,"");return me.x=parseFloat(s)||0,me.y=parseFloat(n)||0,me}function be(t,e){e&&(t.classList?t.classList.remove(e):Nt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim()))}var De,Ae,Ee,xe,Te=/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1,ke=0,Le=!!k()&&{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=gt(s.dragStartPredicate)?s.dragStartPredicate:Re.defaultStartPredicate,this._startPredicateState=ke,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 O(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 Ie(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(!Te&&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={},Ae={},Ee={},xe=[],function(t,e){var i=t._drag,s=i._getGrid(),o=e&&"number"==typeof e.threshold?e.threshold:50,h=e&&e.action===n?n:r,a=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,h,a,l,_,d,c,u=null,f=e._settings.dragSort,p=-1;if(!0===f?(xe[0]=e,n=xe):gt(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(),a=Math.max(0,r._left),l=Math.max(0,r._top),_=Math.min(window.innerWidth,r._right),d=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")&&(h=o.getBoundingClientRect(),a=Math.max(a,h.left),l=Math.max(l,h.top),_=Math.min(_,h.right),d=Math.min(d,h.bottom)),"fixed"===yt(o,"position"))break;o=o.parentNode}a>=_||l>=d||(Ae.left=a,Ae.top=l,Ae.width=_-a,Ae.height=d-l,(s=qt(De,Ae))>i&&s>p&&(p=s,u=r))}return xe.length=0,u}(t,s,o);if(!l)return null;var _,d,c,u=t.getGrid()!==l,f=0,p=0,m=0,g=-1,v=!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++)(_=l._items[c])._isActive&&_!==t&&(v=!0,Ae.width=_._width,Ae.height=_._height,Ae.left=_._left+_._marginLeft+f,Ae.top=_._top+_._marginTop+p,(d=qt(De,Ae))>m&&(g=c,m=d));return u&&m<o&&(g=v?g:0,m=o),m>=o?(Ee.grid=l,Ee.index=g,Ee.action=u?a:h,Ee):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),_t(e),dt(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),be(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,Le)},Re.prototype._unbindScrollListeners=function(){var t,e=this._scrollers;for(t=0;t<e.length;t++)e[t].removeEventListener("scroll",this._onScroll,Le);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 h=Math.atan2(n,r),a=Math.atan2(this._sortX2-this._sortX1,this._sortY2-this._sortY1),l=Math.atan2(Math.sin(h-a),Math.cos(h-a));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,ht.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,h,a,l,_=this._item,d=this._getGrid()._settings;(t=gt(d.dragSortPredicate)?d.dragSortPredicate(_,this._dragMoveEvent):Re.defaultSortPredicate(_,d.dragSortPredicate))&&"number"==typeof t.index&&(a=t.action===n?n:r,l=(e=_.getGrid())!==(s=t.grid||e),i=e._items.indexOf(_),o=jt(s._items,t.index,l&&a===r?1:0),(l||o!==this._blockedSortIndex)&&(l?(this._blockedSortIndex=null,h=s._items[o],e._hasListeners(p)&&e._emit(p,{item:_,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),s._hasListeners(g)&&s._emit(g,{item:_,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),_._gridId=s._id,this._isMigrating=_._gridId!==this._gridId,e._items.splice(i,1),Vt(s._items,_,o),_._sortData=null,e._hasListeners(f)&&e._emit(f,{item:_,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),s._hasListeners(m)&&s._emit(m,{item:_,fromGrid:e,fromIndex:i,toGrid:s,toIndex:o}),a===n&&h&&h.isActive()&&s._items.indexOf(h)>-1&&s.send(h,e,i,{appendTo:this._container||document.body,layoutSender:!1,layoutReceiver:!1}),e.layout(),s.layout()):i!==o&&(this._blockedSortIndex=i,(a===n?Ut:Qt)(e._items,i,o),e._hasListeners(u)&&e._emit(u,{item:_,fromIndex:i,toIndex:o,action:a}),e.layout())))}},Re.prototype._finishMigration=function(){var t,e,i=this._item,s=i._dragRelease,n=i._element,r=i._isActive,o=i.getGrid(),h=o._element,a=o._settings,l=a.dragContainer||h,_=this._getGrid()._settings,d=n.parentNode,c=r?_.itemVisibleClass:_.itemHiddenClass,u=r?a.itemVisibleClass:a.itemHiddenClass;this._isMigrating=!1,this.destroy(),_.itemClass!==a.itemClass&&(be(n,_.itemClass),Ft(n,a.itemClass)),c!==u&&(be(n,c),Ft(n,u)),l!==d&&(l.appendChild(n),e=ce(d,l,!0),(t=we(n)).x-=e.left,t.y-=e.top),i._refreshDimensions(),e=ce(l,h,!0),s._containerDiffX=e.left,s._containerDiffY=e.top,i._drag=a.dragEnabled?new Re(i):null,l!==d&&i._setTranslate(t.x,t.y),i._visibility.setStyles(r?a.visibleStyles:a.hiddenStyles),s.start()},Re.prototype._preStartCheck=function(t){this._startPredicateState===ke&&(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=ke)):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=ke,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,ht.add(ot,j+e,i),ht.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=he(r),h=we(e),a=e.getBoundingClientRect(),l=r!==n;if(this._container=r,this._containingBlock=o,this._clientX=a.left,this._clientY=a.top,this._left=this._gridX=h.x,this._top=this._gridY=h.y,this._scrollDiffX=this._scrollDiffY=0,this._moveDiffX=this._moveDiffY=0,this._resetHeuristics(this._gridX,this._gridY),l){var _=ce(o,n);this._containerDiffX=_.left,this._containerDiffY=_.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))),Ft(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,ht.add(ot,U+e,i),ht.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,ht.add(ot,J+e,i),ht.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?(_t(e._id),dt(e._id),ct(e._id),this._finishSort(),this._unbindScrollListeners(),r._containerDiffX=this._containerDiffX,r._containerDiffY=this._containerDiffY,this._reset(),be(i,n.itemDraggingClass),Re.autoScroller.removeItem(e),s._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():r.start()):this.stop()};var Ce=/^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/,Pe={};function Me(t){var e=Pe[t];return e||((e=t.replace(Ce,""))!==t&&(e=e[0].toLowerCase()+e.slice(1)),Pe[t]=e,e)}function Xe(t,e){for(var i in e)t.style[i]=e[i]}var Ye,qe,Oe=!(!Element||!gt(Element.prototype.animate)),He=!!(Element&&(Ye=Element.prototype.animate,qe=window.Symbol,Ye&&gt(qe)&&gt(qe.toString)&&qe(Ye).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 We(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 Ne(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 Fe(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(!Oe)return Xe(s,e),this._callback=gt(n.onFinish)?n.onFinish:null,void this._onFinish();var r,o,h,a=this._animation,l=this._props,_=this._values,d=n.duration||300,c=n.easing||"ease",u=!1;if(a&&(o=0,d===this._duration&&c===this._easing||(u=!0),!u)){for(r in e)if(++o,-1===(h=l.indexOf(r))||e[r]!==_[h]){u=!0;break}o!==l.length&&(u=!0)}if(u&&a.cancel(),this._callback=gt(n.onFinish)?n.onFinish:null,!a||u){for(r in l.length=_.length=0,e)l.push(r),_.push(e[r]);this._duration=d,this._easing=c,this._animation=s.animate([We(t,He),We(e,He)],{duration:d,easing:c}),this._animation.onfinish=this._onFinish,Xe(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 Ie(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()},Ne.prototype._updateDimensions=function(){this.isActive()&&Xe(this._element,{width:this._item._width+"px",height:this._item._height+"px"})},Ne.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 h,a,l,_=s+i._marginLeft,d=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=_,this._nextTransY=d,h=i._id,a=this._setupAnimation,l=this._startAnimation,ht.add(ot,tt+h,a),ht.add(2,et+h,l)}}else this.reset()},Ne.prototype._setupAnimation=function(){if(this.isActive()){var t=we(this._element);this._transX=t.x,this._transY=t.y}},Ne.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={},h={};o[Zt]=Be(e,i),h[Zt]=Be(s,n),t.start(o,h,{duration:r.layoutDuration,easing:r.layoutEasing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&(this._element.style[Zt]=Be(s,n),t.stop())}},Ne.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},Ne.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animation.isAnimating())return void this.reset();this._resetAfterLayout=!0}},Ne.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off(v,this._onReleaseEnd),e.off(o,this._onLayoutStart),e.off(p,this._onMigrate),e.off(_,this._onHide),i.on(v,this._onReleaseEnd),i.on(o,this._onLayoutStart),i.on(p,this._onMigrate),i.on(_,this._onHide),this._didMigrate=!0}},Ne.prototype._onHide=function(t){t.indexOf(this._item)>-1&&this.reset()},Ne.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=gt(s.dragPlaceholder.createElement)?s.dragPlaceholder.createElement(e):document.createElement("div"),this._element=t,n._element=t,this._className=s.itemPlaceholderClass||"",this._className&&Ft(t,this._className),Xe(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(v,this._onReleaseEnd),i.on(p,this._onMigrate),i.on(_,this._onHide),gt(s.dragPlaceholder.onCreate)&&s.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},Ne.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,ht.remove(2,it+t),r.stop(),r._element=null,s.off(v,this._onReleaseEnd),s.off(o,this._onLayoutStart),s.off(p,this._onMigrate),s.off(_,this._onHide),this._className&&(be(e,this._className),this._className=""),e.parentNode.removeChild(e),this._element=null,gt(n.dragPlaceholder.onRemove)&&n.dragPlaceholder.onRemove(i,e)}},Ne.prototype.isActive=function(){return!!this._element},Ne.prototype.getElement=function(){return this._element},Ne.prototype.updateDimensions=function(){var t,e;this.isActive()&&(t=this._item._id,e=this._updateDimensions,ht.add(2,it+t,e))},Ne.prototype.destroy=function(){this.reset(),this._animation.destroy(),this._item=this._animation=null},Fe.prototype.start=function(){if(!this._isDestroyed&&!this._isActive){var t=this._item,e=t.getGrid(),i=e._settings;this._isActive=!0,Ft(t._element,i.itemReleasingClass),i.dragRelease.useDragContainer||this._placeToGrid(),e._emit("dragReleaseStart",t),e._nextLayoutData||t._layout.start(!1)}},Fe.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(v,s)}},Fe.prototype.isJustReleased=function(){return this._isActive&&!1===this._isPositioningStarted},Fe.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Fe.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}},Fe.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,be(e._element,i))}};function ze(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 Ve(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}function je(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",Ft(i,e?n.itemVisibleClass:n.itemHiddenClass),this.setStyles(e?n.visibleStyles:n.hiddenStyles)}ze.prototype.start=function(t,e){if(!this._isDestroyed){var i,s,n,r=this._item,o=r._dragRelease,h=r.getGrid()._settings,a=this._isActive,l=o.isJustReleased(),_=l?h.dragRelease.duration:h.layoutDuration,d=l?h.dragRelease.easing:h.layoutEasing,c=!t&&!this._skipNextAnimation&&_>0;if(a&&(at(r._id),r._emitter.burst(this._queue,!0,r)),l&&(o._isPositioningStarted=!0),gt(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=d,this._animOptions.duration=_,this._isInterrupted=a,i=r._id,s=this._setupAnimation,n=this._startAnimation,ht.add(ot,N+i,s),ht.add(2,F+i,n)}},ze.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var s=this._item;if(at(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()}be(s._element,s.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&s._emitter.burst(this._queue,!0,s)}},ze.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}},ze.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}},ze.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,be(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),t._emitter.burst(this._queue,!1,t)}},ze.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}},ze.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||Ft(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)},Ve.prototype.start=function(t,e,i){if(!this._isDestroyed){var s,n,r,o,h,a,l,_,d,c,u=this._item,v=u._element,y=u.isActive(),S=u.isVisible(),w=u.getGrid(),b=w._settings,D=t._settings,A=t._element,E=t._items,x=w._items.indexOf(u),T=i||document.body;if("number"==typeof e)s=jt(E,e,1);else{if(!(n=t.getItem(e)))return;s=E.indexOf(n)}(u.isPositioning()||this._isActive||u.isReleasing())&&(l=(a=we(v)).x,_=a.y),u.isPositioning()&&u._layout.stop(!0,l,_),this._isActive&&(l-=this._containerDiffX,_-=this._containerDiffY,this.stop(!0,l,_)),u.isReleasing()&&(l-=u._dragRelease._containerDiffX,_-=u._dragRelease._containerDiffY,u._dragRelease.stop(!0,l,_)),u._visibility.stop(!0),u._drag&&u._drag.destroy(),w._hasListeners(p)&&w._emit(p,{item:u,fromGrid:w,fromIndex:x,toGrid:t,toIndex:s}),t._hasListeners(g)&&t._emit(g,{item:u,fromGrid:w,fromIndex:x,toGrid:t,toIndex:s}),b.itemClass!==D.itemClass&&(be(v,b.itemClass),Ft(v,D.itemClass)),(d=S?b.itemVisibleClass:b.itemHiddenClass)!==(c=S?D.itemVisibleClass:D.itemHiddenClass)&&(be(v,d),Ft(v,c)),w._items.splice(x,1),Vt(E,u,s),u._gridId=t._id,y?T!==(r=v.parentNode)&&(T.appendChild(v),o=ce(T,r,!0),a||(l=(a=we(v)).x,_=a.y),u._setTranslate(l+o.left,_+o.top)):A.appendChild(v),u._visibility.setStyles(S?D.visibleStyles:D.hiddenStyles),y&&(h=ce(T,A,!0)),u._refreshDimensions(),u._sortData=null,u._drag=D.dragEnabled?new Re(u):null,y?(this._isActive=!0,this._container=T,this._containerDiffX=h.left,this._containerDiffY=h.top):(this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0),w._hasListeners(f)&&w._emit(f,{item:u,fromGrid:w,fromIndex:x,toGrid:t,toIndex:s}),t._hasListeners(m)&&t._emit(m,{item:u,fromGrid:w,fromIndex:x,toGrid:t,toIndex:s})}},Ve.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}},Ve.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},je.prototype.show=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=gt(e)?e:null,r=i.getGrid()._settings;this._isShowing||this._isHidden?!this._isShowing||t?(this._isShowing||(i._emitter.burst(this._queue,!0,i),be(s,r.itemHiddenClass),Ft(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)}},je.prototype.hide=function(t,e){if(!this._isDestroyed){var i=this._item,s=i._element,n=gt(e)?e:null,r=i.getGrid()._settings;this._isHiding||!this._isHidden?!this._isHiding||t?(this._isHiding||(i._emitter.burst(this._queue,!0,i),Ft(s,r.itemHiddenClass),be(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)}},je.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)}},je.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]},je.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(),be(e,i.itemVisibleClass),be(e,i.itemHiddenClass),e.style.display="",this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0}},je.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var s,n=this._item,r=this._animation,o=this._childElement,h=n.getGrid()._settings,a=t?h.visibleStyles:h.hiddenStyles,l=t?h.showDuration:h.hideDuration,_=t?h.showEasing:h.hideEasing,d=e||l<=0;if(a){if(lt(n._id),d)return Xe(o,a),r.stop(),void(i&&i());var c,u,f;r.isAnimating()&&(r._animation.onfinish=null),c=n._id,u=function(){s=Ie(o,a)},f=function(){r.start(s,a,{duration:l,easing:_,onFinish:i})},ht.add(ot,z+c,u),ht.add(2,V+c,f)}else i&&i()}},je.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._item._emitter.burst(this._queue,!1,this._item))},je.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)}},je.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 b,e.parentNode!==t._element&&t._element.appendChild(e),Ft(e,n.itemClass),"boolean"!=typeof i&&(i="none"!==yt(e,"display")),this._isActive=i,this._visibility=new je(this),this._layout=new ze(this),this._migrate=new Ve(this),this._drag=n.dragEnabled?new Re(this):null,this._dragRelease=new Fe(this),this._dragPlaceholder=new Ne(this)}function Je(t){var e,i,s,n,r,o=.001,h=.5;function a(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,h,l=t.items,_=t.slots,d=!!(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=a(r),o=a(o)),h=this.computeNextSlot(t,r,o,d,c),c?h.left+h.width>t.width&&(t.width=h.left+h.width):h.top+h.height>t.height&&(t.height=h.top+h.height),_[++this.slotIndex]=h.left,_[++this.slotIndex]=h.top,(u||f)&&this.slotSizes.push(h.width,h.height);if(u)for(i=0;i<_.length;i+=2)_[i]=t.width-(_[i]+this.slotSizes[i]);if(f)for(i=1;i<_.length;i+=2)_[i]=t.height-(_[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,a,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,_=0;_<u.length;_++)if((a=u[_])&&(r=this.getRect(a),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>h&&f.push(this.addRect(0,t.height,c.left,1/0)),c.left+c.width<t.width-h&&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>h&&f.push(this.addRect(t.width,0,1/0,c.top)),c.top+c.height<t.height-h&&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&&(_=0);_<u.length;_++)if(a=u[_])for(r=this.getRect(a),l=this.splitRect(r,c),d=0;d<l.length;d++)a=l[d],r=this.getRect(a),(n?r.left+o<t.width-o:r.top+o<t.height-o)&&f.push(a);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)>=h&&e.push(this.addRect(t.left,t.top,i,t.height)),(i=t.left+t.width-(n.left+n.width))>=h&&e.push(this.addRect(n.left+n.width,t.top,i,t.height)),(s=n.top-t.top)>=h&&e.push(this.addRect(t.left,t.top,t.width,s)),(s=t.top+t.height-(n.top+n.height))>=h&&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 _=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]};_.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,St(e,"margin-left")),this._marginRight=Math.max(0,St(e,"margin-right")),this._marginTop=Math.max(0,St(e,"margin-top")),this._marginBottom=Math.max(0,St(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(),be(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,h={id:e,items:i,slots:null,width:o?0:s,height:o?n:0,_grid:t,_settings:this._options};if(!i.length)return h.slots=[],this._finalizeLayout(h),void r(h);if(this._processor)return h.slots=window.Float32Array?new Float32Array(2*i.length):new Array(2*i.length),this._processor.computeLayout(h,h._settings),this._finalizeLayout(h),void r(h);var a,l,_,d=new Float32Array(4+2*i.length);for(d[0]=e,d[1]=h.width,d[2]=h.height,d[3]=h._settings,a=0,l=3;a<i.length;a++)_=i[a],d[++l]=_._width+_._marginLeft+_._marginRight,d[++l]=_._height+_._marginTop+_._marginBottom;return this._layoutQueue.push(e),this._layouts[e]=h,this._layoutCallbacks[e]=r,this._layoutWorkerData[e]=d,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){ht.add(ot,rt+t,e)}(i,o):(s=n=0,t()))};return function(h){if(!r){if(!(e<=0))return!0===h?(r=!0,s=n=0,o=void 0,void function(t){ht.remove(ot,rt+t)}(i)):void(s<=0?(s=e,o(0)):s=e);!0!==h&&t()}}}var ni="[object HTMLCollection]",ri="[object NodeList]";function oi(t){var e=Object.prototype.toString.call(t);return e===ni||e===ri}var hi="object",ai="[object Object]",li=Object.prototype.toString;function _i(t){return typeof t===hi&&li.call(t)===ai}function di(){}var ci,ui="number",fi="string",pi="instant",mi=0;function gi(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=vi({},t);e&&(i=vi(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}(gi.defaultOptions,e);s.visibleStyles=yi(s.visibleStyles),s.hiddenStyles=yi(s.hiddenStyles),gt(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 b,this._onLayoutDataReceived=this._onLayoutDataReceived.bind(this),i[this._id]=this,Ft(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++)Nt(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 vi(t,e){var i,s,n,r=Object.keys(e),o=r.length;for(n=0;n<o;n++)i=_i(e[s=r[n]]),_i(t[s])&&i?t[s]=vi(vi({},t[s]),e[s]):i?t[s]=vi({},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=T(n,e))&&(s[i]=t[e]);return s}function Si(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]}gi.Item=Ze,gi.ItemLayout=ze,gi.ItemVisibility=je,gi.ItemMigrate=Ve,gi.ItemDrag=Re,gi.ItemDragRelease=Fe,gi.ItemDragPlaceholder=Ne,gi.Emitter=b,gi.Animator=Ge,gi.Dragger=O,gi.Packer=ei,gi.AutoScroller=Gt,gi.defaultPacker=new ei(2),gi.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"},gi.prototype.on=function(t,e){return this._emitter.on(t,e),this},gi.prototype.off=function(t,e){return this._emitter.off(t,e),this},gi.prototype.getElement=function(){return this._element},gi.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},gi.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},gi.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},gi.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},gi.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},gi.prototype.layout=function(t,e){if(this._isDestroyed)return this;var i=this._nextLayoutData;i&&gt(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 h,a=this._width-this._borderLeft-this._borderRight,l=this._height-this._borderTop-this._borderBottom,_=this._settings.layout;return gt(_)?h=_(this,s,r,a,l,this._onLayoutDataReceived):(gi.defaultPacker.setOptions(_),h=gi.defaultPacker.createLayout(this,s,r,a,l,this._onLayoutDataReceived)),gt(h)&&this._nextLayoutData&&this._nextLayoutData.id===s&&(this._nextLayoutData.cancel=h),this},gi.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,h,a=e||{},l=a.layout?a.layout:void 0===a.layout,_=this._items,d=!1;for(h=0;h<s.length;h++)(r=s[h]).parentNode!==this._element&&(n=n||document.createDocumentFragment()).appendChild(r);for(n&&this._element.appendChild(n),h=0;h<s.length;h++)r=s[h],(o=s[h]=new Ze(this,r,a.active))._isActive&&(d=!0,o._layout._skipNextAnimation=!0);for(h=0;h<s.length;h++)(o=s[h])._refreshDimensions(),o._refreshSortData();return Vt(_,s,a.index),this._hasListeners("add")&&this._emit("add",s.slice(0)),d&&l&&this.layout(l===pi,gt(l)?l:void 0),s},gi.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,h=!1,a=this.getItems(),_=[],d=[];for(n=0;n<t.length;n++)(s=t[n])._isDestroyed||-1!==(i=this._items.indexOf(s))&&(s._isActive&&(h=!0),_.push(s),d.push(a.indexOf(s)),s._destroy(r.removeElements),this._items.splice(i,1));return this._hasListeners(l)&&this._emit(l,_.slice(0),d),h&&o&&this.layout(o===pi,gt(o)?o:void 0),_},gi.prototype.show=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!0,e),this},gi.prototype.hide=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!1,e),this},gi.prototype.filter=function(t,e){if(this._isDestroyed||!this._items.length)return this;var i,s,n=[],r=[],o=typeof t===fi,h=gt(t),a=e||{},l=!0===a.instant,_=a.syncWithLayout,c=a.layout?a.layout:void 0===a.layout,u=gt(a.onFinish)?a.onFinish:null,f=-1,p=di;if(u&&(p=function(){++f&&u(n.slice(0),r.slice(0))}),h||o)for(s=0;s<this._items.length;s++)i=this._items[s],(h?t(i):Nt(i._element,t))?n.push(i):r.push(i);return n.length?this.show(n,{instant:l,syncWithLayout:_,onFinish:p,layout:!1}):p(),r.length?this.hide(r,{instant:l,syncWithLayout:_,onFinish:p,layout:!1}):p(),(n.length||r.length)&&(this._hasListeners(d)&&this._emit(d,n.slice(0),r.slice(0)),c&&this.layout(c===pi,gt(c)?c:void 0)),this},gi.prototype.sort=function(){var t,e,i,s;function n(n,r){for(var o,h,a,l,_=0,d=0;d<t.length;d++)if(o=t[d][0],h=t[d][1],a=(n._sortData?n:n._refreshSortData())._sortData[o],l=(r._sortData?r:r._refreshSortData())._sortData[o],_="desc"===h||!h&&e?l<a?-1:l>a?1:0:a<l?-1:a>l?1:0)return _;return _||(s||(s=Si(i)),_=e?wi(s,r,n):wi(s,n,r)),_}function r(n,r){var o=e?-t(n,r):t(n,r);return o||(s||(s=Si(i)),o=e?wi(s,r,n):wi(s,n,r)),o}return function(o,h){if(this._isDestroyed||this._items.length<2)return this;var a=this._items,l=h||{},_=l.layout?l.layout:void 0===l.layout;if(e=!!l.descending,i=a.slice(0),s=null,gt(o))t=o,a.sort(r);else if(typeof o===fi)t=o.trim().split(" ").filter((function(t){return t})).map((function(t){return t.split(":")})),a.sort(n);else{if(!Array.isArray(o))throw t=e=i=s=null,new Error("Invalid comparer argument provided.");a.length=0,a.push.apply(a,o)}return this._hasListeners(c)&&this._emit(c,a.slice(0),i),_&&this.layout(_===pi,gt(_)?_:void 0),t=e=i=s=null,this}}(),gi.prototype.move=function(t,e,i){if(this._isDestroyed||this._items.length<2)return this;var s,o,h=this._items,a=i||{},l=a.layout?a.layout:void 0===a.layout,_=a.action===n,d=_?n:r,c=this.getItem(t),f=this.getItem(e);return c&&f&&c!==f&&(s=h.indexOf(c),o=h.indexOf(f),_?Ut(h,s,o):Qt(h,s,o),this._hasListeners(u)&&this._emit(u,{item:c,fromIndex:s,toIndex:o,action:d}),l&&this.layout(l===pi,gt(l)?l:void 0)),this},gi.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,h=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,gt(o)?o:void 0),h&&e.layout(h===pi,gt(h)?h:void 0)),this},gi.prototype.destroy=function(t){if(this._isDestroyed)return this;var e,s,n,r=this._element,o=this._items.slice(0),h=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,be(r,this._settings.containerClass),h)r.style[s]="";return this._emit("destroy"),this._emitter.destroy(),delete i[this._id],this._isDestroyed=!0,this},gi.prototype._emit=function(){this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments)},gi.prototype._hasListeners=function(t){return!this._isDestroyed&&this._emitter.countListeners(t)>0},gi.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},gi.prototype._updateBorders=function(t,e,i,s){var n=this._element;t&&(this._borderLeft=St(n,"border-left-width")),e&&(this._borderRight=St(n,"border-right-width")),i&&(this._borderTop=St(n,"border-top-width")),s&&(this._borderBottom=St(n,"border-bottom-width"))},gi.prototype._refreshDimensions=function(){this._updateBoundingRect(),this._updateBorders(1,1,1,1),this._boxSizing=yt(this._element,"box-sizing")},gi.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,_=this._nextLayoutData.onFinish,d=t.items.length,c=d;for(this._nextLayoutData=null,!this._isLayoutFinished&&this._hasListeners(a)&&this._emit(a,this._layout.items.slice(0)),this._layout=t,ci.length=0,n=0;n<d;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&&Xe(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=gt(l)?l:_;e||(r._isLayoutFinished=!0),gt(i)&&i(t.items.slice(0),e),!e&&r._hasListeners(h)&&r._emit(h,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}}}),gi.prototype._setItemsVisibility=function(t,e,i){var s,n,r=this,h=t.slice(0),a=i||{},l=!0===a.instant,d=a.onFinish,c=a.layout?a.layout:void 0===a.layout,u=h.length,f=e?"showStart":_,p=e?"showEnd":"hideEnd",m=e?"show":"hide",g=!1,v=[],y=[];if(u){for(n=0;n<h.length;n++)s=h[n],(e&&!s._isActive||!e&&s._isActive)&&(g=!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),g&&!1!==a.syncWithLayout?this.on(o,S):S(),g&&c&&this.layout(c===pi,gt(c)?c:void 0)}else gt(d)&&d(h);function S(){for(g&&!1!==a.syncWithLayout&&r.off(o,S),r._hasListeners(f)&&r._emit(f,h.slice(0)),n=0;n<h.length;n++)h[n]._gridId===r._id?h[n]._visibility[m](l,(function(t,e){t||v.push(e),--u<1&&(gt(d)&&d(v.slice(0)),r._hasListeners(p)&&r._emit(p,v.slice(0)))})):--u<1&&(gt(d)&&d(v.slice(0)),r._hasListeners(p)&&r._emit(p,v.slice(0)))}};const bi=gi;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 Ai(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,Ei(s.key),s)}}function Ei(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 xi=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.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 bi(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("grid_item_selected",{id:i,rowData:s,elem:t,selected:e})}},{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){}}],e&&Ai(t.prototype,e),i&&Ai(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),Ti=e.H;export{Ti as vi_Grid};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vizor_panels",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "description": "desciption of libname",
5
5
  "main": "dist/vizor_panels.min.js",
6
6
  "module": "dist/vizor_panels.min.js",