vizor_panels 1.9.5 → 1.9.6

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 n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{_Z:()=>wn,Hx:()=>Di,YO:()=>Oi,_D:()=>En,Qz:()=>ji});var i={},n="function"==typeof Map?new Map:null,s="swap",o="move",r="layoutStart",a="layoutEnd",l="layoutAbort",h="remove",d="hideStart",c="filter",u="sort",f="move",_="send",p="beforeSend",v="receive",m="beforeReceive",g="dragReleaseEnd",y="ontouchstart"in window,b=!!window.PointerEvent,w=!!window.navigator.msPointerEnabled;function S(){this._events={},this._queue=[],this._counter=0,this._clearOnEmit=!1}S.prototype.on=function(t,e){if(!this._events||!t||!e)return this;var i=this._events[t];return i||(i=this._events[t]=[]),i.push(e),this},S.prototype.off=function(t,e){if(!this._events||!t||!e)return this;var i,n=this._events[t];if(!n||!n.length)return this;for(;-1!==(i=n.indexOf(e));)n.splice(i,1);return this},S.prototype.clear=function(t){if(!this._events||!t)return this;var e=this._events[t];return e&&(e.length=0,delete this._events[t]),this},S.prototype.emit=function(t){if(!this._events||!t)return this._clearOnEmit=!1,this;var e=this._events[t];if(!e||!e.length)return this._clearOnEmit=!1,this;var i,n=this._queue,s=n.length,o=arguments.length-1;o>3&&((i=[]).push.apply(i,arguments),i.shift()),n.push.apply(n,e),this._clearOnEmit&&(e.length=0,this._clearOnEmit=!1),++this._counter;for(var r=s,a=n.length;r<a;r++)if(0===o?n[r]():1===o?n[r](arguments[1]):2===o?n[r](arguments[1],arguments[2]):3===o?n[r](arguments[1],arguments[2],arguments[3]):n[r].apply(null,i),!this._events)return this;return--this._counter,this._counter||(n.length=0),this},S.prototype.burst=function(){return this._events?(this._clearOnEmit=!0,this.emit.apply(this,arguments),this):this},S.prototype.countListeners=function(t){if(!this._events)return 0;var e=this._events[t];return e?e.length:0},S.prototype.destroy=function(){return this._events?(this._queue.length=this._counter=0,this._events=null,this):this};var k=b?"pointerout":w?"MSPointerOut":"";function x(t){k&&(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))}x.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(k,this._onOut))},x.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(k,this._onOut),this._resetData(),this._isActive=!1)},x.prototype._resetData=function(){window.clearTimeout(this._timeout),this._timeout=null,this._outEvent=null},x.prototype._onStart=function(t){"mouse"!==t.pointerType&&this._addBehaviour()},x.prototype._onOut=function(t){this._dragger._getTrackedTouch(t)&&(this._resetData(),this._outEvent=t,this._timeout=window.setTimeout(this._onTimeout,100))},x.prototype._onTimeout=function(){var t=this._outEvent;this._resetData(),this._dragger.isActive()&&this._dragger._onCancel(t)},x.prototype.destroy=function(){k&&(this._dragger.off("start",this._onStart),this._removeBehaviour())};var E=["","webkit","moz","ms","o","Webkit","Moz","MS","O"],D={};function L(t,e){var i=D[e]||"";if(i)return i;for(var n=e[0].toUpperCase()+e.slice(1),s=0;s<E.length;){if((i=E[s]?E[s]+n:e)in t)return D[e]=i,i;++s}return""}function C(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}return t}var T=window.navigator.userAgent.toLowerCase(),A=T.indexOf("edge")>-1,I=T.indexOf("trident")>-1,P=T.indexOf("firefox")>-1,R=T.indexOf("android")>-1,M=!!C()&&{passive:!0},O="touchAction",Y=L(document.documentElement.style,O),X="auto";function N(t,e){this._element=t,this._emitter=new S,this._isDestroyed=!1,this._cssProps={},this._touchAction="",this._isActive=!1,this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._onStart=this._onStart.bind(this),this._onMove=this._onMove.bind(this),this._onCancel=this._onCancel.bind(this),this._onEnd=this._onEnd.bind(this),this._edgeHack=null,(A||I)&&(b||w)&&(this._edgeHack=new x(this)),this.setCssProps(e),this._touchAction||this.setTouchAction(X),t.addEventListener("dragstart",N._preventDefault,!1),t.addEventListener(N._inputEvents.start,this._onStart,M)}N._pointerEvents={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},N._msPointerEvents={start:"MSPointerDown",move:"MSPointerMove",cancel:"MSPointerCancel",end:"MSPointerUp"},N._touchEvents={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},N._mouseEvents={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},N._inputEvents=y?N._touchEvents:b?N._pointerEvents:w?N._msPointerEvents:N._mouseEvents,N._emitter=new S,N._emitterEvents={start:"start",move:"move",end:"end",cancel:"cancel"},N._activeInstances=[],N._preventDefault=function(t){t.preventDefault&&!1!==t.cancelable&&t.preventDefault()},N._activateInstance=function(t){N._activeInstances.indexOf(t)>-1||(N._activeInstances.push(t),N._emitter.on(N._emitterEvents.move,t._onMove),N._emitter.on(N._emitterEvents.cancel,t._onCancel),N._emitter.on(N._emitterEvents.end,t._onEnd),1===N._activeInstances.length&&N._bindListeners())},N._deactivateInstance=function(t){var e=N._activeInstances.indexOf(t);-1!==e&&(N._activeInstances.splice(e,1),N._emitter.off(N._emitterEvents.move,t._onMove),N._emitter.off(N._emitterEvents.cancel,t._onCancel),N._emitter.off(N._emitterEvents.end,t._onEnd),N._activeInstances.length||N._unbindListeners())},N._bindListeners=function(){window.addEventListener(N._inputEvents.move,N._onMove,M),window.addEventListener(N._inputEvents.end,N._onEnd,M),N._inputEvents.cancel&&window.addEventListener(N._inputEvents.cancel,N._onCancel,M)},N._unbindListeners=function(){window.removeEventListener(N._inputEvents.move,N._onMove,M),window.removeEventListener(N._inputEvents.end,N._onEnd,M),N._inputEvents.cancel&&window.removeEventListener(N._inputEvents.cancel,N._onCancel,M)},N._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},N._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},N._onMove=function(t){N._emitter.emit(N._emitterEvents.move,t)},N._onCancel=function(t){N._emitter.emit(N._emitterEvents.cancel,t)},N._onEnd=function(t){N._emitter.emit(N._emitterEvents.end,t)},N.prototype._reset=function(){this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._isActive=!1,N._deactivateInstance(this)},N.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===N._emitterEvents.start?0:this.getDeltaTime(),isFirst:t===N._emitterEvents.start,isFinal:t===N._emitterEvents.end||t===N._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}},N.prototype._emit=function(t,e){this._emitter.emit(t,this._createEvent(t,e))},N.prototype._getTrackedTouch=function(t){return null===this._pointerId?null:N._getTouchById(t,this._pointerId)},N.prototype._onStart=function(t){if(!this._isDestroyed&&null===this._pointerId&&(this._pointerId=N._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(N._emitterEvents.start,t),this._isActive&&N._activateInstance(this)}},N.prototype._onMove=function(t){var e=this._getTrackedTouch(t);e&&(this._currentX=e.clientX,this._currentY=e.clientY,this._emit(N._emitterEvents.move,t))},N.prototype._onCancel=function(t){this._getTrackedTouch(t)&&(this._emit(N._emitterEvents.cancel,t),this._reset())},N.prototype._onEnd=function(t){this._getTrackedTouch(t)&&(this._emit(N._emitterEvents.end,t),this._reset())},N.prototype.isActive=function(){return this._isActive},N.prototype.setTouchAction=function(t){this._touchAction=t,Y&&(this._cssProps[Y]="",this._element.style[Y]=t),y&&(this._element.removeEventListener(N._touchEvents.start,N._preventDefault,!0),(this._element.style[Y]!==t||P&&R)&&this._element.addEventListener(N._touchEvents.start,N._preventDefault,!0))},N.prototype.setCssProps=function(t){if(t){var e,i,n=this._cssProps,s=this._element;for(e in n)s.style[e]=n[e],delete n[e];for(e in t)t[e]&&(e!==O?(i=L(s.style,e))&&(n[i]="",s.style[i]=t[e]):this.setTouchAction(t[e]))}},N.prototype.getDeltaX=function(){return this._currentX-this._startX},N.prototype.getDeltaY=function(){return this._currentY-this._startY},N.prototype.getDistance=function(){var t=this.getDeltaX(),e=this.getDeltaY();return Math.sqrt(t*t+e*e)},N.prototype.getDeltaTime=function(){return this._startTime?Date.now()-this._startTime:0},N.prototype.on=function(t,e){this._emitter.on(t,e)},N.prototype.off=function(t,e){this._emitter.off(t,e)},N.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(N._inputEvents.start,this._onStart,M),t.removeEventListener("dragstart",N._preventDefault,!1),t.removeEventListener(N._touchEvents.start,N._preventDefault,!0),this._cssProps)t.style[e]=this._cssProps[e],delete this._cssProps[e];this._element=null,this._isDestroyed=!0}};var j=1e3/60,q=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return this.setTimeout((function(){t(Date.now())}),j)}).bind(window);function H(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 G)}function G(){this.queue=[],this.indices={},this.callbacks={}}H.prototype._step=function(t){var e,i,n,s,o,r,a=this._lanes,l=this._stepQueue,h=this._stepCallbacks;for(this._nextStep=null,e=0;e<a.length;e++){for(s=a[e].queue,o=a[e].callbacks,r=a[e].indices,i=0;i<s.length;i++)(n=s[i])&&(l.push(n),h[n]=o[n],delete o[n],delete r[n]);s.length=0}for(e=0;e<l.length;e++)h[n=l[e]]&&h[n](t),delete h[n];l.length=0},H.prototype.add=function(t,e,i){this._lanes[t].add(e,i),this._nextStep||(this._nextStep=q(this._step))},H.prototype.remove=function(t,e){this._lanes[t].remove(e)},G.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},G.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 z="layoutRead",B="layoutWrite",V="visibilityRead",W="visibilityWrite",F="dragStartRead",U="dragStartWrite",Q="dragMoveRead",Z="dragMoveWrite",J="dragScrollRead",$="dragScrollWrite",K="dragSortRead",tt="placeholderLayoutRead",et="placeholderLayoutWrite",it="placeholderResizeWrite",nt="autoScrollRead",st="autoScrollWrite",ot="debounceRead",rt=0,at=new H(3);function lt(t){at.remove(rt,z+t),at.remove(2,B+t)}function ht(t){at.remove(rt,V+t),at.remove(2,W+t)}function dt(t){at.remove(rt,F+t),at.remove(2,U+t)}function ct(t){at.remove(rt,Q+t),at.remove(2,Z+t)}function ut(t){at.remove(rt,J+t),at.remove(2,$+t)}function ft(t,e){at.add(1,K+t,e)}function _t(t){at.remove(rt,tt+t),at.remove(2,et+t)}function pt(t,e){at.add(rt,nt,t),at.add(2,st,e)}var vt="function";function mt(t){return typeof t===vt}var gt="function"==typeof WeakMap?new WeakMap:null;function yt(t,e){var i=gt&&gt.get(t);return i||(i=window.getComputedStyle(t,null),gt&&gt.set(t,i)),i.getPropertyValue(e)}function bt(t,e){return parseFloat(yt(t,e))||0}var wt,St=document.documentElement,kt=document.body,xt={value:0,offset:0};function Et(t){return t===window||t===St||t===kt?window:t}function Dt(t){return t===window?t.pageXOffset:t.scrollLeft}function Lt(t){return t===window?t.pageYOffset:t.scrollTop}function Ct(t){return t===window?St.scrollWidth-St.clientWidth:t.scrollWidth-t.clientWidth}function Tt(t){return t===window?St.scrollHeight-St.clientHeight:t.scrollHeight-t.clientHeight}function At(t,e){if(e=e||{},t===window)e.width=St.clientWidth,e.height=St.clientHeight,e.left=0,e.right=e.width,e.top=0,e.bottom=e.height;else{var i=t.getBoundingClientRect(),n=t.clientLeft||bt(t,"border-left-width"),s=t.clientTop||bt(t,"border-top-width");e.width=t.clientWidth,e.height=t.clientHeight,e.left=i.left+n,e.right=e.left+e.width,e.top=i.top+s,e.bottom=e.top+e.height}return e}function It(t){return t._drag._getGrid()._settings.dragAutoScroll}function Pt(t){if(t._drag&&t._isActive){var e=t._drag;e._scrollDiffX=e._scrollDiffY=0,t._setTranslate(e._left,e._top)}}function Rt(t,e,i,n){return xt.value=Math.min(n/2,t),xt.offset=Math.max(0,i+2*xt.value+n*e-n)/2,xt}function Mt(){this.reset()}function Ot(){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 Xt(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?Dt(this.element):Lt(this.element):Math.max(0,Math.min(this.value,this.maxValue))},Mt.prototype.computeNextScrollValue=function(t){var e=this.speed*(t/1e3),i=4&this.direction?this.value+e:this.value-e;return Math.max(0,Math.min(i,this.maxValue))},Mt.prototype.computeSpeed=(wt={direction:null,threshold:0,distance:0,value:0,maxValue:0,deltaTime:0,duration:0,isEnding:!1},function(t){var e=this.item,i=It(e).speed;return mt(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;mt(e)&&e(t,this.element,this.direction)},Mt.prototype.onStop=function(){var t=this.item,e=It(t).onStop;mt(e)&&e(t,this.element,this.direction),t._drag&&t._drag.sort()},Ot.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},Ot.prototype.addRequest=function(t){1&t.direction?(this.removeRequest(this.requestX),this.requestX=t):(this.removeRequest(this.requestY),this.requestY=t),t.action=this},Ot.prototype.removeRequest=function(t){t&&(this.requestX===t?(this.requestX=null,t.action=null):this.requestY===t&&(this.requestY=null,t.action=null))},Ot.prototype.computeScrollValues=function(){this.scrollLeft=this.requestX?this.requestX.value:Dt(this.element),this.scrollTop=this.requestY?this.requestY.value:Lt(this.element)},Ot.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 Nt={width:0,height:0,left:0,right:0,top:0,bottom:0},jt={width:0,height:0,left:0,right:0,top:0,bottom:0};function qt(){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 Ot}),(function(t){t.reset()})),this._readTick=this._readTick.bind(this),this._writeTick=this._writeTick.bind(this)}qt.AXIS_X=1,qt.AXIS_Y=2,qt.FORWARD=4,qt.BACKWARD=8,qt.LEFT=9,qt.RIGHT=5,qt.UP=10,qt.DOWN=6,qt.smoothSpeed=function(t,e,i){return function(n,s,o){var r=0;if(!o.isEnding)if(o.threshold>0){var a=o.threshold-Math.max(0,o.distance);r=t/o.threshold*a}else r=t;var l=o.speed,h=r;return l===r?h:l<r?(h=l+e*(o.deltaTime/1e3),Math.min(r,h)):(h=l-i*(o.deltaTime/1e3),Math.max(r,h))}},qt.pointerHandle=function(t){var e={left:0,top:0,width:0,height:0},i=t||1;return function(t,n,s,o,r,a,l){return e.left=a-.5*i,e.top=l-.5*i,e.width=i,e.height=i,e}},qt.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))},qt.prototype._writeTick=function(){this._isDestroyed||(this._applyActions(),pt(this._readTick,this._writeTick))},qt.prototype._startTicking=function(){this._isTicking=!0,pt(this._readTick,this._writeTick)},qt.prototype._stopTicking=function(){this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,at.remove(rt,nt),at.remove(2,st)},qt.prototype._getItemHandleRect=function(t,e,i){var n=t._drag;if(e){var s=n._dragMoveEvent||n._dragStartEvent,o=e(t,n._clientX,n._clientY,t._width,t._height,s.clientX,s.clientY);i.left=o.left,i.top=o.top,i.width=o.width,i.height=o.height}else i.left=n._clientX,i.top=n._clientY,i.width=t._width,i.height=t._height;return i.right=i.left+i.width,i.bottom=i.top+i.height,i},qt.prototype._requestItemScroll=function(t,e,i,n,s,o,r){var a=this._requests[e],l=a[t._id];l?l.element===i&&l.direction===n||l.reset():l=this._requestPool.pick(),l.item=t,l.element=i,l.direction=n,l.threshold=s,l.distance=o,l.maxValue=r,a[t._id]=l},qt.prototype._cancelItemScroll=function(t,e){var i=this._requests[e],n=i[t._id];n&&(n.action&&n.action.removeRequest(n),this._requestPool.release(n),delete i[t._id])},qt.prototype._checkItemOverlap=function(t,e,i){var n=It(t),s=mt(n.targets)?n.targets(t):n.targets,o=n.threshold,r=n.safeZone;if(!s||!s.length)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));var a=this._dragDirections[t._id],l=a[0],h=a[1];if(!l&&!h)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));for(var d=this._getItemHandleRect(t,n.handle,Nt),c=jt,u=null,f=null,_=!0,p=!0,v=0,m=0,g=null,y=null,b=0,w=0,S=0,k=null,x=-1/0,E=0,D=0,L=null,C=0,T=0,A=null,I=-1/0,P=0,R=0,M=null,O=0,Y=0,X=0;X<s.length;X++)u=s[X],_=e&&l&&2!==u.axis,p=i&&h&&1!==u.axis,m=u.priority||0,(!_||m<x)&&(!p||m<I)||(f=Et(u.element||u),w=_?Ct(f):-1,S=p?Tt(f):-1,(w||S)&&((v=Xt(d,c=At(f,c)))<=0||(_&&m>=x&&w>0&&(m>x||v>D)&&(y=null,g=Rt("number"==typeof u.threshold?u.threshold:o,r,d.width,c.width),5===l?(b=c.right+g.offset-d.right)<=g.value&&Dt(f)<w&&(y=5):9===l&&(b=d.left-(c.left-g.offset))<=g.value&&Dt(f)>0&&(y=9),null!==y&&(k=f,x=m,E=g.value,D=v,L=y,C=b,T=w)),p&&m>=I&&S>0&&(m>I||v>R)&&(y=null,g=Rt("number"==typeof u.threshold?u.threshold:o,r,d.height,c.height),6===h?(b=c.bottom+g.offset-d.bottom)<=g.value&&Lt(f)<S&&(y=6):10===h&&(b=d.top-(c.top-g.offset))<=g.value&&Lt(f)>0&&(y=10),null!==y&&(A=f,I=m,P=g.value,R=v,M=y,O=b,Y=S)))));e&&(k?this._requestItemScroll(t,1,k,L,E,C,T):this._cancelItemScroll(t,1)),i&&(A?this._requestItemScroll(t,2,A,M,P,O,Y):this._cancelItemScroll(t,2))},qt.prototype._updateScrollRequest=function(t){for(var e=t.item,i=It(e),n=mt(i.targets)?i.targets(e):i.targets,s=n&&n.length||0,o=i.threshold,r=i.safeZone,a=this._getItemHandleRect(e,i.handle,Nt),l=jt,h=null,d=null,c=!1,u=null,f=null,_=null,p=null,v=null,m=0;m<s;m++)if((d=Et((h=n[m]).element||h))===t.element){if(c=!!(1&t.direction)){if(2===h.axis)continue}else if(1===h.axis)continue;if((p=c?Ct(d):Tt(d))<=0)break;if(Xt(a,l=At(d,l))<=0)break;if(u=Rt("number"==typeof h.threshold?h.threshold:o,r,c?a.width:a.height,c?l.width:l.height),(f=9===t.direction?a.left-(l.left-u.offset):5===t.direction?l.right+u.offset-a.right:10===t.direction?a.top-(l.top-u.offset):l.bottom+u.offset-a.bottom)>u.value)break;if(_=c?Dt(d):Lt(d),v=4&t.direction?_>=p:_<=0)break;return t.maxValue=p,t.threshold=u.value,t.distance=f,t.isEnding=!1,!0}return!0===i.smoothStop&&t.speed>0?(null===v&&(v=t.hasReachedEnd()),t.isEnding=!v):t.isEnding=!1,t.isEnding},qt.prototype._updateRequests=function(){for(var t,e,i,n,s,o,r,a=this._items,l=this._requests[1],h=this._requests[2],d=0;d<a.length;d++)t=a[d],s=(n=this._requestOverlapCheck[t._id])>0&&this._tickTime-n>this._overlapCheckInterval,o=!0,(e=l[t._id])&&e.isActive&&(o=!this._updateScrollRequest(e))&&(s=!0,this._cancelItemScroll(t,1)),r=!0,(i=h[t._id])&&i.isActive&&(r=!this._updateScrollRequest(i))&&(s=!0,this._cancelItemScroll(t,2)),s&&(this._requestOverlapCheck[t._id]=0,this._checkItemOverlap(t,o,r))},qt.prototype._requestAction=function(t,e){for(var i=this._actions,n=1===e,s=null,o=0;o<i.length;o++){if(s=i[o],t.element===s.element){if(n?s.requestX:s.requestY)return void this._cancelItemScroll(t.item,e);break}s=null}s||(s=this._actionPool.pick()),s.element=t.element,s.addRequest(t),t.tick(this._tickDeltaTime),i.push(s)},qt.prototype._updateActions=function(){var t,e,i,n,s=this._items,o=this._requests,r=this._actions;for(n=0;n<s.length;n++)t=s[n]._id,e=o[1][t],i=o[2][t],e&&this._requestAction(e,1),i&&this._requestAction(i,2);for(n=0;n<r.length;n++)r[n].computeScrollValues()},qt.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++)(n=i[t])._drag&&n._drag._prepareScroll();var n;for(t=0;t<i.length;t++)Pt(i[t])}},qt.prototype._updateDragDirection=function(t){var e=this._dragPositions[t._id],i=this._dragDirections[t._id],n=t._drag._left,s=t._drag._top;if(e.length){var o=e[0],r=e[1];i[0]=n>o?5:n<o?9:i[0]||0,i[1]=s>r?6:s<r?10:i[1]||0}e[0]=n,e[1]=s},qt.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())},qt.prototype.updateItem=function(t){this._isDestroyed||this._dragDirections[t._id]&&(this._updateDragDirection(t),this._requestOverlapCheck[t._id]||(this._requestOverlapCheck[t._id]=this._tickTime))},qt.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()}}},qt.prototype.isItemScrollingX=function(t){var e=this._requests[1][t._id];return!(!e||!e.isActive)},qt.prototype.isItemScrollingY=function(t){var e=this._requests[2][t._id];return!(!e||!e.isActive)},qt.prototype.isItemScrolling=function(t){return this.isItemScrollingX(t)||this.isItemScrollingY(t)},qt.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 Ht=window.Element.prototype,Gt=Ht.matches||Ht.matchesSelector||Ht.webkitMatchesSelector||Ht.mozMatchesSelector||Ht.msMatchesSelector||Ht.oMatchesSelector||function(){return!1};function zt(t,e){return Gt.call(t,e)}function Bt(t,e){e&&(t.classList?t.classList.add(e):zt(t,"."+e)||(t.className+=" "+e))}var Vt=[];function Wt(t,e,i){var n="number"==typeof i?i:-1;n<0&&(n=t.length-n+1),t.splice.apply(t,Vt.concat(n,0,e)),Vt.length=0}function Ft(t,e,i){var n=Math.max(0,t.length-1+(i||0));return e>n?n:e<0?Math.max(n+e+1,0):e}function Ut(t,e,i){if(!(t.length<2)){var n=Ft(t,e),s=Ft(t,i);n!==s&&t.splice(s,0,t.splice(n,1)[0])}}function Qt(t,e,i){if(!(t.length<2)){var n,s=Ft(t,e),o=Ft(t,i);s!==o&&(n=t[s],t[s]=t[o],t[o]=n)}}var Zt=L(document.documentElement.style,"transform")||"transform",Jt=/([A-Z])/g,$t=/^(webkit-|moz-|ms-|o-)/,Kt=/^(-m-s-)/;function te(t){var e=t.replace(Jt,"-$1").toLowerCase();return e=(e=e.replace($t,"-$1")).replace(Kt,"-ms-")}var ee=te(Zt),ie="none",ne="inline",se="none",oe="display";function re(t){var e=yt(t,ee);if(!e||e===ie)return!1;var i=yt(t,oe);return i!==ne&&i!==se}function ae(t){for(var e=document,i=t||e;i&&i!==e&&"static"===yt(i,"position")&&!re(i);)i=i.parentElement||e;return i}var le={},he={},de={};function ce(t,e){var i,n=e||{};return n.left=0,n.top=0,t===document?n:(n.left=window.pageXOffset||0,n.top=window.pageYOffset||0,t.self===window.self||(i=t.getBoundingClientRect(),n.left+=i.left,n.top+=i.top,n.left+=bt(t,"border-left-width"),n.top+=bt(t,"border-top-width")),n)}function ue(t,e,i){return de.left=0,de.top=0,t===e||i&&(t=ae(t))===(e=ae(e))||(ce(t,le),ce(e,he),de.left=he.left-le.left,de.top=he.top-le.top),de}function fe(t){return"auto"===t||"scroll"===t||"overlay"===t}function _e(t){return fe(yt(t,"overflow"))||fe(yt(t,"overflow-x"))||fe(yt(t,"overflow-y"))}function pe(t,e){for(e=e||[];t&&t!==document;)t.getRootNode&&t instanceof DocumentFragment?t=t.getRootNode().host:(_e(t)&&e.push(t),t=t.parentNode);return e.push(window),e}var ve={},me=/^matrix3d/,ge=/([^,]*,){4}/,ye=/([^,]*,){12}/,be=/[^,]*,/;function we(t){ve.x=0,ve.y=0;var e=yt(t,ee);if(!e||"none"===e)return ve;var i=me.test(e),n=e.replace(i?ye:ge,""),s=n.replace(be,"");return ve.x=parseFloat(n)||0,ve.y=parseFloat(s)||0,ve}function Se(t,e){e&&(t.classList?t.classList.remove(e):zt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim()))}var ke,xe,Ee,De,Le=/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1,Ce=0,Te=!!C()&&{passive:!0};function Ae(t){var e=t._element,i=t.getGrid(),n=i._settings;this._item=t,this._gridId=i._id,this._isDestroyed=!1,this._isMigrating=!1,this._startPredicate=mt(n.dragStartPredicate)?n.dragStartPredicate:Ae.defaultStartPredicate,this._startPredicateState=Ce,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=n.dragHandle&&e.querySelector(n.dragHandle)||e,this._dragger=new N(this._handle,n.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,n,s={};if(Array.isArray(e))for(n=0;n<e.length;n++)s[i=e[n]]=yt(t,te(i));else for(i in e)s[i]=yt(t,te(i));return s}Ae.autoScroller=new qt,Ae.defaultStartPredicate=function(t,e,i){var n=t._drag;if(e.isFirst&&e.srcEvent.button)return!1;if(!Le&&e.isFirst&&!0===e.srcEvent.isTrusted&&!1===e.srcEvent.defaultPrevented&&!1===e.srcEvent.cancelable)return!1;if(!e.isFinal){var s=n._startPredicateData;if(!s){var o=i||n._getGrid()._settings.dragStartPredicate||{};n._startPredicateData=s={distance:Math.max(o.distance,0)||0,delay:Math.max(o.delay,0)||0}}return s.delay&&(s.event=e,s.delayTimer||(s.delayTimer=window.setTimeout((function(){s.delay=0,n._resolveStartPredicate(s.event)&&(n._forceResolveStartPredicate(s.event),n._resetStartPredicate())}),s.delay))),n._resolveStartPredicate(e)}n._finishStartPredicate(e)},Ae.defaultSortPredicate=(ke={},xe={},Ee={},De=[],function(t,e){var i=t._drag,n=i._getGrid(),r=e&&"number"==typeof e.threshold?e.threshold:50,a=e&&e.action===s?s:o,l=e&&e.migrateAction===s?s:o;r=Math.min(Math.max(r,1),100),ke.width=t._width,ke.height=t._height,ke.left=i._clientX,ke.top=i._clientY;var h=function(t,e,i){var n,s,o,r,a,l,h,d,c,u,f=null,_=e._settings.dragSort,p=-1;if(!0===_?(De[0]=e,s=De):mt(_)&&(s=_.call(e,t)),!s||!Array.isArray(s)||!s.length)return f;for(u=0;u<s.length;u++)if(!(o=s[u])._isDestroyed){for(o._updateBoundingRect(),l=Math.max(0,o._left),h=Math.max(0,o._top),d=Math.min(window.innerWidth,o._right),c=Math.min(window.innerHeight,o._bottom),r=o._element.parentNode;r&&r!==document&&r!==document.documentElement&&r!==document.body;)if(r.getRootNode&&r instanceof DocumentFragment)r=r.getRootNode().host;else{if("visible"!==yt(r,"overflow")&&(a=r.getBoundingClientRect(),l=Math.max(l,a.left),h=Math.max(h,a.top),d=Math.min(d,a.right),c=Math.min(c,a.bottom)),"fixed"===yt(r,"position"))break;r=r.parentNode}l>=d||h>=c||(xe.left=l,xe.top=h,xe.width=d-l,xe.height=c-h,(n=Xt(ke,xe))>i&&n>p&&(p=n,f=o))}return De.length=0,f}(t,n,r);if(!h)return null;var d,c,u,f=t.getGrid()!==h,_=0,p=0,v=0,m=-1,g=!1;for(h===n?(ke.left=i._gridX+t._marginLeft,ke.top=i._gridY+t._marginTop):(h._updateBorders(1,0,1,0),_=h._left+h._borderLeft,p=h._top+h._borderTop),u=0;u<h._items.length;u++)(d=h._items[u])._isActive&&d!==t&&(g=!0,xe.width=d._width,xe.height=d._height,xe.left=d._left+d._marginLeft+_,xe.top=d._top+d._marginTop+p,(c=Xt(ke,xe))>v&&(m=u,v=c));return f&&v<r&&(m=g?m:0,v=r),v>=r?(Ee.grid=h,Ee.index=m,Ee.action=f?l:a,Ee):null}),Ae.prototype.stop=function(){if(this._isActive)if(this._isMigrating)this._finishMigration();else{var t=this._item,e=t._id;if(Ae.autoScroller.removeItem(t),dt(e),ct(e),ut(e),this._cancelSort(),this._isStarted){this._unbindScrollListeners();var i=t._element,n=this._getGrid(),s=n._settings.itemDraggingClass;i.parentNode!==n._element&&(n._element.appendChild(i),t._setTranslate(this._gridX,this._gridY),s&&i.clientWidth),Se(i,s)}this._reset()}},Ae.prototype.sort=function(t){var e=this._item;this._isActive&&e._isActive&&this._dragMoveEvent&&(!0===t?this._handleSort():ft(e._id,this._handleSort))},Ae.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._dragger.destroy(),Ae.autoScroller.removeItem(this._item),this._isDestroyed=!0)},Ae.prototype._getGrid=function(){return i[this._gridId]||null},Ae.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},Ae.prototype._bindScrollListeners=function(){var t,e,i=this._getGrid()._element,n=this._container,s=this._scrollers;if(s.length=0,pe(this._item._element.parentNode,s),n!==i)for(pe(i,t=[]),e=0;e<t.length;e++)s.indexOf(t[e])<0&&s.push(t[e]);for(e=0;e<s.length;e++)s[e].addEventListener("scroll",this._onScroll,Te)},Ae.prototype._unbindScrollListeners=function(){var t,e=this._scrollers;for(t=0;t<e.length;t++)e[t].removeEventListener("scroll",this._onScroll,Te);e.length=0},Ae.prototype._resolveStartPredicate=function(t){var e=this._startPredicateData;if(!(t.distance<e.distance||e.delay))return this._resetStartPredicate(),!0},Ae.prototype._forceResolveStartPredicate=function(t){this._isDestroyed||1!==this._startPredicateState||(this._startPredicateState=2,this._onStart(t))},Ae.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)},Ae.prototype._resetHeuristics=function(t,e){this._blockedSortIndex=null,this._sortX1=this._sortX2=t,this._sortY1=this._sortY2=e},Ae.prototype._checkHeuristics=function(t,e){var i=this._getGrid()._settings.dragSortHeuristics,n=i.minDragDistance;if(n<=0)return this._blockedSortIndex=null,!0;var s=t-this._sortX2,o=e-this._sortY2,r=n>3&&i.minBounceBackAngle>0;if(r||(this._blockedSortIndex=null),Math.abs(s)>n||Math.abs(o)>n){if(r){var a=Math.atan2(s,o),l=Math.atan2(this._sortX2-this._sortX1,this._sortY2-this._sortY1),h=Math.atan2(Math.sin(a-l),Math.cos(a-l));Math.abs(h)>i.minBounceBackAngle&&(this._blockedSortIndex=null)}return this._sortX1=this._sortX2,this._sortY1=this._sortY2,this._sortX2=t,this._sortY2=e,!0}return!1},Ae.prototype._resetStartPredicate=function(){var t=this._startPredicateData;t&&(t.delayTimer&&(t.delayTimer=window.clearTimeout(t.delayTimer)),this._startPredicateData=null)},Ae.prototype._handleSort=function(){if(this._isActive){var t=this._getGrid()._settings;if(!t.dragSort||!t.dragAutoScroll.sortDuringScroll&&Ae.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))}}},Ae.prototype._handleSortDelayed=function(){this._isSortNeeded=!0,this._sortTimer=void 0,ft(this._item._id,this._handleSort)},Ae.prototype._cancelSort=function(){var t;this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),t=this._item._id,at.remove(1,K+t)},Ae.prototype._finishSort=function(){var t=this._getGrid()._settings.dragSort&&(this._isSortNeeded||void 0!==this._sortTimer);this._cancelSort(),t&&this._checkOverlap()},Ae.prototype._checkOverlap=function(){if(this._isActive){var t,e,i,n,r,a,l,h,d=this._item,c=this._getGrid()._settings;(t=mt(c.dragSortPredicate)?c.dragSortPredicate(d,this._dragMoveEvent):Ae.defaultSortPredicate(d,c.dragSortPredicate))&&"number"==typeof t.index&&(l=t.action===s?s:o,h=(e=d.getGrid())!==(n=t.grid||e),i=e._items.indexOf(d),r=Ft(n._items,t.index,h&&l===o?1:0),(h||r!==this._blockedSortIndex)&&(h?(this._blockedSortIndex=null,a=n._items[r],e._hasListeners(p)&&e._emit(p,{item:d,fromGrid:e,fromIndex:i,toGrid:n,toIndex:r}),n._hasListeners(m)&&n._emit(m,{item:d,fromGrid:e,fromIndex:i,toGrid:n,toIndex:r}),d._gridId=n._id,this._isMigrating=d._gridId!==this._gridId,e._items.splice(i,1),Wt(n._items,d,r),d._sortData=null,e._hasListeners(_)&&e._emit(_,{item:d,fromGrid:e,fromIndex:i,toGrid:n,toIndex:r}),n._hasListeners(v)&&n._emit(v,{item:d,fromGrid:e,fromIndex:i,toGrid:n,toIndex:r}),l===s&&a&&a.isActive()&&n._items.indexOf(a)>-1&&n.send(a,e,i,{appendTo:this._container||document.body,layoutSender:!1,layoutReceiver:!1}),e.layout(),n.layout()):i!==r&&(this._blockedSortIndex=i,(l===s?Qt:Ut)(e._items,i,r),e._hasListeners(f)&&e._emit(f,{item:d,fromIndex:i,toIndex:r,action:l}),e.layout())))}},Ae.prototype._finishMigration=function(){var t,e,i=this._item,n=i._dragRelease,s=i._element,o=i._isActive,r=i.getGrid(),a=r._element,l=r._settings,h=l.dragContainer||a,d=this._getGrid()._settings,c=s.parentNode,u=o?d.itemVisibleClass:d.itemHiddenClass,f=o?l.itemVisibleClass:l.itemHiddenClass;this._isMigrating=!1,this.destroy(),d.itemClass!==l.itemClass&&(Se(s,d.itemClass),Bt(s,l.itemClass)),u!==f&&(Se(s,u),Bt(s,f)),h!==c&&(h.appendChild(s),e=ue(c,h,!0),(t=we(s)).x-=e.left,t.y-=e.top),i._refreshDimensions(),e=ue(h,a,!0),n._containerDiffX=e.left,n._containerDiffY=e.top,i._drag=l.dragEnabled?new Ae(i):null,h!==c&&i._setTranslate(t.x,t.y),i._visibility.setStyles(o?l.visibleStyles:l.hiddenStyles),n.start()},Ae.prototype._preStartCheck=function(t){this._startPredicateState===Ce&&(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=Ce)):2===this._startPredicateState&&this._isActive&&this._onMove(t)},Ae.prototype._preEndCheck=function(t){var e=2===this._startPredicateState;this._startPredicate(this._item,t),this._startPredicateState=Ce,e&&this._isActive&&(this._isStarted?this._onEnd(t):this.stop())},Ae.prototype._onStart=function(t){var e,i,n,s=this._item;s._isActive&&(this._isActive=!0,this._dragStartEvent=t,Ae.autoScroller.addItem(s),e=s._id,i=this._prepareStart,n=this._applyStart,at.add(rt,F+e,i),at.add(2,U+e,n))},Ae.prototype._prepareStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid(),n=i._settings,s=i._element,o=n.dragContainer||s,r=ae(o),a=we(e),l=e.getBoundingClientRect(),h=o!==s;if(this._container=o,this._containingBlock=r,this._clientX=l.left,this._clientY=l.top,this._left=this._gridX=a.x,this._top=this._gridY=a.y,this._scrollDiffX=this._scrollDiffY=0,this._moveDiffX=this._moveDiffY=0,this._resetHeuristics(this._gridX,this._gridY),h){var d=ue(r,s);this._containerDiffX=d.left,this._containerDiffY=d.top}}}},Ae.prototype._applyStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=this._getGrid(),i=t._element,n=t._dragRelease,s=t._migrate,o=this._container!==e._element;t.isPositioning()&&t._layout.stop(!0,this._left,this._top),s._isActive&&(this._left-=s._containerDiffX,this._top-=s._containerDiffY,this._gridX-=s._containerDiffX,this._gridY-=s._containerDiffY,s.stop(!0,this._left,this._top)),t.isReleasing()&&n._reset(),e._settings.dragPlaceholder.enabled&&t._dragPlaceholder.create(),this._isStarted=!0,e._emit("dragInit",t,this._dragStartEvent),o&&(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))),Bt(i,e._settings.itemDraggingClass),this._bindScrollListeners(),e._emit("dragStart",t,this._dragStartEvent)}}},Ae.prototype._onMove=function(t){var e,i,n,s=this._item;s._isActive?(this._dragMoveEvent=t,e=s._id,i=this._prepareMove,n=this._applyMove,at.add(rt,Q+e,i),at.add(2,Z+e,n),ft(s._id,this._handleSort)):this.stop()},Ae.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 n=e.clientX-i.clientX;this._left=this._left-this._moveDiffX+n,this._gridX=this._gridX-this._moveDiffX+n,this._clientX=this._clientX-this._moveDiffX+n,this._moveDiffX=n}if("x"!==t){var s=e.clientY-i.clientY;this._top=this._top-this._moveDiffY+s,this._gridY=this._gridY-this._moveDiffY+s,this._clientY=this._clientY-this._moveDiffY+s,this._moveDiffY=s}this._dragPrevMoveEvent=e}},Ae.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),Ae.autoScroller.updateItem(t))}},Ae.prototype._onScroll=function(t){var e,i,n,s=this._item;s._isActive?(this._scrollEvent=t,e=s._id,i=this._prepareScroll,n=this._applyScroll,at.add(rt,J+e,i),at.add(2,$+e,n),ft(s._id,this._handleSort)):this.stop()},Ae.prototype._prepareScroll=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid()._element,n=e.getBoundingClientRect();if(this._container!==i){var s=ue(this._containingBlock,i);this._containerDiffX=s.left,this._containerDiffY=s.top}var o=this._clientX-this._moveDiffX-n.left;this._left=this._left-this._scrollDiffX+o,this._scrollDiffX=o;var r=this._clientY-this._moveDiffY-n.top;this._top=this._top-this._scrollDiffY+r,this._scrollDiffY=r,this._gridX=this._left-this._containerDiffX,this._gridY=this._top-this._containerDiffY}}},Ae.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))}},Ae.prototype._onEnd=function(t){var e=this._item,i=e._element,n=this._getGrid(),s=n._settings,o=e._dragRelease;e._isActive?(dt(e._id),ct(e._id),ut(e._id),this._finishSort(),this._unbindScrollListeners(),o._containerDiffX=this._containerDiffX,o._containerDiffY=this._containerDiffY,this._reset(),Se(i,s.itemDraggingClass),Ae.autoScroller.removeItem(e),n._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():o.start()):this.stop()};var Pe=/^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/,Re={};function Me(t){var e=Re[t];return e||((e=t.replace(Pe,""))!==t&&(e=e[0].toLowerCase()+e.slice(1)),Re[t]=e,e)}function Oe(t,e){for(var i in e)t.style[i]=e[i]}var Ye,Xe,Ne=!(!Element||!mt(Element.prototype.animate)),je=!!(Element&&(Ye=Element.prototype.animate,Xe=window.Symbol,Ye&&mt(Xe)&&mt(Xe.toString)&&Xe(Ye).toString().indexOf("[native code]")>-1));function qe(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 He(t,e){var i={};for(var n in t)i[e?n:Me(n)]=t[n];return i}function Ge(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function ze(t){this._item=t,this._animation=new qe,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 Be(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0}qe.prototype.start=function(t,e,i){if(!this._isDestroyed){var n=this._element,s=i||{};if(!Ne)return Oe(n,e),this._callback=mt(s.onFinish)?s.onFinish:null,void this._onFinish();var o,r,a,l=this._animation,h=this._props,d=this._values,c=s.duration||300,u=s.easing||"ease",f=!1;if(l&&(r=0,c===this._duration&&u===this._easing||(f=!0),!f)){for(o in e)if(++r,-1===(a=h.indexOf(o))||e[o]!==d[a]){f=!0;break}r!==h.length&&(f=!0)}if(f&&l.cancel(),this._callback=mt(s.onFinish)?s.onFinish:null,!l||f){for(o in h.length=d.length=0,e)h.push(o),d.push(e[o]);this._duration=c,this._easing=u,this._animation=n.animate([He(t,je),He(e,je)],{duration:c,easing:u}),this._animation.onfinish=this._onFinish,Oe(n,e)}}},qe.prototype.stop=function(){!this._isDestroyed&&this._animation&&(this._animation.cancel(),this._animation=this._callback=null,this._props.length=this._values.length=0)},qe.prototype.getCurrentStyles=function(){return Ie(element,currentProps)},qe.prototype.isAnimating=function(){return!!this._animation},qe.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._element=null,this._isDestroyed=!0)},qe.prototype._onFinish=function(){var t=this._callback;this._animation=this._callback=null,this._props.length=this._values.length=0,t&&t()},ze.prototype._updateDimensions=function(){this.isActive()&&Oe(this._element,{width:this._item._width+"px",height:this._item._height+"px"})},ze.prototype._onLayoutStart=function(t,e){var i=this._item;if(-1!==t.indexOf(i)){var n=i._left,s=i._top,o=this._left,r=this._top;if(this._left=n,this._top=s,e||this._didMigrate||o!==n||r!==s){var a,l,h,d=n+i._marginLeft,c=s+i._marginTop,u=i.getGrid();if(!(!e&&u._settings.layoutDuration>0)||this._didMigrate)return _t(i._id),this._element.style[Zt]=Ge(d,c),this._animation.stop(),void(this._didMigrate&&(u.getElement().appendChild(this._element),this._didMigrate=!1));this._nextTransX=d,this._nextTransY=c,a=i._id,l=this._setupAnimation,h=this._startAnimation,at.add(rt,tt+a,l),at.add(2,et+a,h)}}else this.reset()},ze.prototype._setupAnimation=function(){if(this.isActive()){var t=we(this._element);this._transX=t.x,this._transY=t.y}},ze.prototype._startAnimation=function(){if(this.isActive()){var t=this._animation,e=this._transX,i=this._transY,n=this._nextTransX,s=this._nextTransY;if(e!==n||i!==s){var o=this._item.getGrid()._settings,r={},a={};r[Zt]=Ge(e,i),a[Zt]=Ge(n,s),t.start(r,a,{duration:o.layoutDuration,easing:o.layoutEasing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&(this._element.style[Zt]=Ge(n,s),t.stop())}},ze.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},ze.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animation.isAnimating())return void this.reset();this._resetAfterLayout=!0}},ze.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off(g,this._onReleaseEnd),e.off(r,this._onLayoutStart),e.off(p,this._onMigrate),e.off(d,this._onHide),i.on(g,this._onReleaseEnd),i.on(r,this._onLayoutStart),i.on(p,this._onMigrate),i.on(d,this._onHide),this._didMigrate=!0}},ze.prototype._onHide=function(t){t.indexOf(this._item)>-1&&this.reset()},ze.prototype.create=function(){if(this.isActive())this._resetAfterLayout=!1;else{var t,e=this._item,i=e.getGrid(),n=i._settings,s=this._animation;this._left=e._left,this._top=e._top,t=mt(n.dragPlaceholder.createElement)?n.dragPlaceholder.createElement(e):document.createElement("div"),this._element=t,s._element=t,this._className=n.itemPlaceholderClass||"",this._className&&Bt(t,this._className),Oe(t,{position:"absolute",left:"0px",top:"0px",width:e._width+"px",height:e._height+"px"}),t.style[Zt]=Ge(e._left+e._marginLeft,e._top+e._marginTop),i.on(r,this._onLayoutStart),i.on(g,this._onReleaseEnd),i.on(p,this._onMigrate),i.on(d,this._onHide),mt(n.dragPlaceholder.onCreate)&&n.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},ze.prototype.reset=function(){if(this.isActive()){var t,e=this._element,i=this._item,n=i.getGrid(),s=n._settings,o=this._animation;this._resetAfterLayout=!1,_t(i._id),t=i._id,at.remove(2,it+t),o.stop(),o._element=null,n.off(g,this._onReleaseEnd),n.off(r,this._onLayoutStart),n.off(p,this._onMigrate),n.off(d,this._onHide),this._className&&(Se(e,this._className),this._className=""),e.parentNode.removeChild(e),this._element=null,mt(s.dragPlaceholder.onRemove)&&s.dragPlaceholder.onRemove(i,e)}},ze.prototype.isActive=function(){return!!this._element},ze.prototype.getElement=function(){return this._element},ze.prototype.updateDimensions=function(){var t,e;this.isActive()&&(t=this._item._id,e=this._updateDimensions,at.add(2,it+t,e))},ze.prototype.destroy=function(){this.reset(),this._animation.destroy(),this._item=this._animation=null},Be.prototype.start=function(){if(!this._isDestroyed&&!this._isActive){var t=this._item,e=t.getGrid(),i=e._settings;this._isActive=!0,Bt(t._element,i.itemReleasingClass),i.dragRelease.useDragContainer||this._placeToGrid(),e._emit("dragReleaseStart",t),e._nextLayoutData||t._layout.start(!1)}},Be.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var n=this._item,s=n.getGrid();t||void 0!==e&&void 0!==i||(e=n._left,i=n._top);var o=this._placeToGrid(e,i);this._reset(o),t||s._emit(g,n)}},Be.prototype.isJustReleased=function(){return this._isActive&&!1===this._isPositioningStarted},Be.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Be.prototype._placeToGrid=function(t,e){if(!this._isDestroyed){var i=this._item,n=i._element,s=i.getGrid()._element,o=!1;if(n.parentNode!==s){if(void 0===t||void 0===e){var r=we(n);t=r.x-this._containerDiffX,e=r.y-this._containerDiffY}s.appendChild(n),i._setTranslate(t,e),o=!0}return this._containerDiffX=0,this._containerDiffY=0,o}},Be.prototype._reset=function(t){if(!this._isDestroyed){var e=this._item,i=e.getGrid()._settings.itemReleasingClass;this._isActive=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0,i&&(t&&e._element.clientWidth,Se(e._element,i))}};function Ve(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 qe(e),this._queue="layout-"+t._id,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this)}function We(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}function Fe(t){var e=t._isActive,i=t._element,n=i.children[0],s=t.getGrid()._settings;if(!n)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=n,this._currentStyleProps=[],this._animation=new qe(n),this._queue="visibility-"+t._id,this._finishShow=this._finishShow.bind(this),this._finishHide=this._finishHide.bind(this),i.style.display=e?"":"none",Bt(i,e?s.itemVisibleClass:s.itemHiddenClass),this.setStyles(e?s.visibleStyles:s.hiddenStyles)}Ve.prototype.start=function(t,e){if(!this._isDestroyed){var i,n,s,o=this._item,r=o._dragRelease,a=o.getGrid()._settings,l=this._isActive,h=r.isJustReleased(),d=h?a.dragRelease.duration:a.layoutDuration,c=h?a.dragRelease.easing:a.layoutEasing,u=!t&&!this._skipNextAnimation&&d>0;if(l&&(lt(o._id),o._emitter.burst(this._queue,!0,o)),h&&(r._isPositioningStarted=!0),mt(e)&&o._emitter.on(this._queue,e),this._skipNextAnimation=!1,!u)return this._updateOffsets(),o._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=c,this._animOptions.duration=d,this._isInterrupted=l,i=o._id,n=this._setupAnimation,s=this._startAnimation,at.add(rt,z+i,n),at.add(2,B+i,s)}},Ve.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var n=this._item;if(lt(n._id),this._animation.isAnimating()){if(void 0===e||void 0===i){var s=we(n._element);e=s.x,i=s.y}n._setTranslate(e,i),this._animation.stop()}Se(n._element,n.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&n._emitter.burst(this._queue,!0,n)}},Ve.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}},Ve.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}},Ve.prototype._finish=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;t._tX=this._nextLeft,t._tY=this._nextTop,this._isActive&&(this._isActive=!1,Se(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),t._emitter.burst(this._queue,!1,t)}},Ve.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}},Ve.prototype._startAnimation=function(){var t=this._item,e=t.getGrid()._settings,i=this._animOptions.duration<=0;this._updateOffsets();var n=Math.abs(t._left-(t._tX-this._offsetLeft)),s=Math.abs(t._top-(t._tY-this._offsetTop));if(i||n<2&&s<2)return(n||s||this._isInterrupted)&&t._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._isInterrupted||Bt(t._element,e.itemPositioningClass),this._currentStyles[Zt]=Ge(t._tX,t._tY),this._targetStyles[Zt]=Ge(this._nextLeft,this._nextTop),t._tX=t._tY=void 0,this._animation.start(this._currentStyles,this._targetStyles,this._animOptions)},We.prototype.start=function(t,e,i){if(!this._isDestroyed){var n,s,o,r,a,l,h,d,c,u,f=this._item,g=f._element,y=f.isActive(),b=f.isVisible(),w=f.getGrid(),S=w._settings,k=t._settings,x=t._element,E=t._items,D=w._items.indexOf(f),L=i||document.body;if("number"==typeof e)n=Ft(E,e,1);else{if(!(s=t.getItem(e)))return;n=E.indexOf(s)}(f.isPositioning()||this._isActive||f.isReleasing())&&(h=(l=we(g)).x,d=l.y),f.isPositioning()&&f._layout.stop(!0,h,d),this._isActive&&(h-=this._containerDiffX,d-=this._containerDiffY,this.stop(!0,h,d)),f.isReleasing()&&(h-=f._dragRelease._containerDiffX,d-=f._dragRelease._containerDiffY,f._dragRelease.stop(!0,h,d)),f._visibility.stop(!0),f._drag&&f._drag.destroy(),w._hasListeners(p)&&w._emit(p,{item:f,fromGrid:w,fromIndex:D,toGrid:t,toIndex:n}),t._hasListeners(m)&&t._emit(m,{item:f,fromGrid:w,fromIndex:D,toGrid:t,toIndex:n}),S.itemClass!==k.itemClass&&(Se(g,S.itemClass),Bt(g,k.itemClass)),(c=b?S.itemVisibleClass:S.itemHiddenClass)!==(u=b?k.itemVisibleClass:k.itemHiddenClass)&&(Se(g,c),Bt(g,u)),w._items.splice(D,1),Wt(E,f,n),f._gridId=t._id,y?L!==(o=g.parentNode)&&(L.appendChild(g),r=ue(L,o,!0),l||(h=(l=we(g)).x,d=l.y),f._setTranslate(h+r.left,d+r.top)):x.appendChild(g),f._visibility.setStyles(b?k.visibleStyles:k.hiddenStyles),y&&(a=ue(L,x,!0)),f._refreshDimensions(),f._sortData=null,f._drag=k.dragEnabled?new Ae(f):null,y?(this._isActive=!0,this._container=L,this._containerDiffX=a.left,this._containerDiffY=a.top):(this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0),w._hasListeners(_)&&w._emit(_,{item:f,fromGrid:w,fromIndex:D,toGrid:t,toIndex:n}),t._hasListeners(v)&&t._emit(v,{item:f,fromGrid:w,fromIndex:D,toGrid:t,toIndex:n})}},We.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var n,s=this._item,o=s._element,r=s.getGrid()._element;this._container!==r&&(void 0!==e&&void 0!==i||(t?(e=(n=we(o)).x-this._containerDiffX,i=n.y-this._containerDiffY):(e=s._left,i=s._top)),r.appendChild(o),s._setTranslate(e,i)),this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0}},We.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Fe.prototype.show=function(t,e){if(!this._isDestroyed){var i=this._item,n=i._element,s=mt(e)?e:null,o=i.getGrid()._settings;this._isShowing||this._isHidden?!this._isShowing||t?(this._isShowing||(i._emitter.burst(this._queue,!0,i),Se(n,o.itemHiddenClass),Bt(n,o.itemVisibleClass),this._isHiding||(n.style.display="")),s&&i._emitter.on(this._queue,s),this._isShowing=!0,this._isHiding=this._isHidden=!1,this._startAnimation(!0,t,this._finishShow)):s&&i._emitter.on(this._queue,s):s&&s(!1,i)}},Fe.prototype.hide=function(t,e){if(!this._isDestroyed){var i=this._item,n=i._element,s=mt(e)?e:null,o=i.getGrid()._settings;this._isHiding||!this._isHidden?!this._isHiding||t?(this._isHiding||(i._emitter.burst(this._queue,!0,i),Bt(n,o.itemHiddenClass),Se(n,o.itemVisibleClass)),s&&i._emitter.on(this._queue,s),this._isHidden=this._isHiding=!0,this._isShowing=!1,this._startAnimation(!1,t,this._finishHide)):s&&i._emitter.on(this._queue,s):s&&s(!1,i)}},Fe.prototype.stop=function(t){if(!this._isDestroyed&&(this._isHiding||this._isShowing)){var e=this._item;ht(e._id),this._animation.stop(),t&&e._emitter.burst(this._queue,!0,e)}},Fe.prototype.setStyles=function(t){var e=this._childElement,i=this._currentStyleProps;for(var n in this._removeCurrentStyles(),t)i.push(n),e.style[n]=t[n]},Fe.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item,e=t._element,i=t.getGrid()._settings;this.stop(!0),t._emitter.clear(this._queue),this._animation.destroy(),this._removeCurrentStyles(),Se(e,i.itemVisibleClass),Se(e,i.itemHiddenClass),e.style.display="",this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0}},Fe.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var n,s=this._item,o=this._animation,r=this._childElement,a=s.getGrid()._settings,l=t?a.visibleStyles:a.hiddenStyles,h=t?a.showDuration:a.hideDuration,d=t?a.showEasing:a.hideEasing,c=e||h<=0;if(l){if(ht(s._id),c)return Oe(r,l),o.stop(),void(i&&i());var u,f,_;o.isAnimating()&&(o._animation.onfinish=null),u=s._id,f=function(){n=Ie(r,l)},_=function(){o.start(n,l,{duration:h,easing:d,onFinish:i})},at.add(rt,V+u,f),at.add(2,W+u,_)}else i&&i()}},Fe.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._item._emitter.burst(this._queue,!1,this._item))},Fe.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)}},Fe.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 Ue=0;function Qe(){return++Ue}function Ze(t,e,i){var s=t._settings;if(n){if(n.has(e))throw new Error("You can only create one Muuri Item per element!");n.set(e,this)}this._id=Qe(),this._gridId=t._id,this._element=e,this._isDestroyed=!1,this._left=0,this._top=0,this._width=0,this._height=0,this._marginLeft=0,this._marginRight=0,this._marginTop=0,this._marginBottom=0,this._tX=void 0,this._tY=void 0,this._sortData=null,this._emitter=new S,e.parentNode!==t._element&&t._element.appendChild(e),Bt(e,s.itemClass),"boolean"!=typeof i&&(i="none"!==yt(e,"display")),this._isActive=i,this._visibility=new Fe(this),this._layout=new Ve(this),this._migrate=new We(this),this._drag=s.dragEnabled?new Ae(this):null,this._dragRelease=new Be(this),this._dragPlaceholder=new ze(this)}function Je(t){var e,i,n,s,o,r=.001,a=.5;function l(t){return((1e3*t+.5|0)/10|0)/100}function h(){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(h.prototype.computeLayout=function(t,e){var i,n,s,o,r,a,h=t.items,d=t.slots,c=!!(1&e),u=!!(2&e),f=!!(4&e),_=!!(8&e),p=!!(16&e),v="number"==typeof h[0];if(!h.length)return t;for(n=v?2:1,i=0;i<h.length;i+=n)v?(o=h[i],r=h[i+1]):(o=(s=h[i])._width+s._marginLeft+s._marginRight,r=s._height+s._marginTop+s._marginBottom),p&&(o=l(o),r=l(r)),a=this.computeNextSlot(t,o,r,c,u),u?a.left+a.width>t.width&&(t.width=a.left+a.width):a.top+a.height>t.height&&(t.height=a.top+a.height),d[++this.slotIndex]=a.left,d[++this.slotIndex]=a.top,(f||_)&&this.slotSizes.push(a.width,a.height);if(f)for(i=0;i<d.length;i+=2)d[i]=t.width-(d[i]+this.slotSizes[i]);if(_)for(i=1;i<d.length;i+=2)d[i]=t.height-(d[i]+this.slotSizes[i]);return this.slotSizes.length=0,this.currentRects.length=0,this.nextRects.length=0,this.rectStore.length=0,this.rectId=0,this.slotIndex=-1,t},h.prototype.computeNextSlot=function(t,e,i,n,s){var o,l,h,d,c,u=this.slotData,f=this.currentRects,_=this.nextRects,p=!1;for(_.length=0,u.left=null,u.top=null,u.width=e,u.height=i,d=0;d<f.length;d++)if((l=f[d])&&(o=this.getRect(l),u.width<=o.width+r&&u.height<=o.height+r)){u.left=o.left,u.top=o.top;break}if(null===u.left&&(s?(u.left=t.width,u.top=0):(u.left=0,u.top=t.height),n||(p=!0)),!s&&u.top+u.height>t.height+r&&(u.left>a&&_.push(this.addRect(0,t.height,u.left,1/0)),u.left+u.width<t.width-a&&_.push(this.addRect(u.left+u.width,t.height,t.width-u.left-u.width,1/0)),t.height=u.top+u.height),s&&u.left+u.width>t.width+r&&(u.top>a&&_.push(this.addRect(t.width,0,1/0,u.top)),u.top+u.height<t.height-a&&_.push(this.addRect(t.width,u.top+u.height,1/0,t.height-u.top-u.height)),t.width=u.left+u.width),!p)for(n&&(d=0);d<f.length;d++)if(l=f[d])for(o=this.getRect(l),h=this.splitRect(o,u),c=0;c<h.length;c++)l=h[c],o=this.getRect(l),(s?o.left+r<t.width-r:o.top+r<t.height-r)&&_.push(l);return _.length>1&&this.purgeRects(_).sort(s?this.sortRectsLeftTop:this.sortRectsTopLeft),this.currentRects=_,this.nextRects=f,u},h.prototype.addRect=function(t,e,i,n){var s=++this.rectId;return this.rectStore[s]=t||0,this.rectStore[++this.rectId]=e||0,this.rectStore[++this.rectId]=i||0,this.rectStore[++this.rectId]=n||0,s},h.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},h.prototype.splitRect=(e=[],i=0,n=0,function(t,s){return e.length=0,t.left+t.width<=s.left+r||s.left+s.width<=t.left+r||t.top+t.height<=s.top+r||s.top+s.height<=t.top+r?(e.push(this.addRect(t.left,t.top,t.width,t.height)),e):((i=s.left-t.left)>=a&&e.push(this.addRect(t.left,t.top,i,t.height)),(i=t.left+t.width-(s.left+s.width))>=a&&e.push(this.addRect(s.left+s.width,t.top,i,t.height)),(n=s.top-t.top)>=a&&e.push(this.addRect(t.left,t.top,t.width,n)),(n=t.top+t.height-(s.top+s.height))>=a&&e.push(this.addRect(t.left,s.top+s.height,t.width,n)),e)}),h.prototype.isRectAWithinRectB=function(t,e){return t.left+r>=e.left&&t.top+r>=e.top&&t.left+t.width-r<=e.left+e.width&&t.top+t.height-r<=e.top+e.height},h.prototype.purgeRects=(s={},o={},function(t){for(var e,i=t.length;i--;)if(e=t.length,t[i])for(this.getRect(t[i],s);e--;)if(t[e]&&i!==e&&(this.getRect(t[e],o),this.isRectAWithinRectB(s,o))){t[i]=0;break}return t}),h.prototype.sortRectsTopLeft=function(){var t={},e={};return function(i,n){return this.getRect(i,t),this.getRect(n,e),t.top<e.top&&t.top+r<e.top?-1:t.top>e.top&&t.top-r>e.top?1:t.left<e.left&&t.left+r<e.left?-1:t.left>e.left&&t.left-r>e.left?1:0}}(),h.prototype.sortRectsLeftTop=function(){var t={},e={};return function(i,n){return this.getRect(i,t),this.getRect(n,e),t.left<e.left&&t.left+r<e.left?-1:t.left>e.left&&t.left-r<e.left?1:t.top<e.top&&t.top+r<e.top?-1:t.top>e.top&&t.top-r>e.top?1:0}}(),t){var d=new h;self.onmessage=function(t){var e=new Float32Array(t.data),i=e.subarray(4,e.length),n=new Float32Array(i.length),s=e[3],o={items:i,slots:n,width:e[1],height:e[2]};d.computeLayout(o,s),e[1]=o.width,e[2]=o.height,e.set(o.slots,4),postMessage(e.buffer,[e.buffer])}}return h}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,n=e.getBoundingClientRect();this._width=n.width,this._height=n.height,this._marginLeft=Math.max(0,bt(e,"margin-left")),this._marginRight=Math.max(0,bt(e,"margin-right")),this._marginTop=Math.max(0,bt(e,"margin-top")),this._marginBottom=Math.max(0,bt(e,"margin-bottom")),i&&i.updateDimensions()}},Ze.prototype._refreshSortData=function(){if(!this._isDestroyed){var t,e=this._sortData={},i=this.getGrid()._settings.sortData;for(t in i)e[t]=i[t](this,this._element)}},Ze.prototype._addToLayout=function(t,e){!0!==this._isActive&&(this._isActive=!0,this._left=t||0,this._top=e||0)},Ze.prototype._removeFromLayout=function(){!1!==this._isActive&&(this._isActive=!1,this._left=0,this._top=0)},Ze.prototype._canSkipLayout=function(t,e){return this._left===t&&this._top===e&&!this._migrate._isActive&&!this._layout._skipNextAnimation&&!this._dragRelease.isJustReleased()},Ze.prototype._setTranslate=function(t,e){return(this._tX!==t||this._tY!==e)&&(this._tX=t,this._tY=e,this._element.style[Zt]=Ge(t,e),!0)},Ze.prototype._destroy=function(t){if(!this._isDestroyed){var e=this._element,i=this.getGrid()._settings;this._dragPlaceholder.destroy(),this._dragRelease.destroy(),this._migrate.destroy(),this._layout.destroy(),this._visibility.destroy(),this._drag&&this._drag.destroy(),this._emitter.destroy(),Se(e,i.itemClass),t&&e.parentNode.removeChild(e),n&&n.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 n,s=0;s<t;s++)n=new Worker(Ke),e&&(n.onmessage=e),i.push(n),ti.push(n)}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],n=this._layouts[i],s=this._layoutCallbacks[i],o=this._layoutWorkers[i];n&&delete this._layouts[i],s&&delete this._layoutCallbacks[i],o&&delete this._layoutWorkers[i],n&&s&&(n.width=e[1],n.height=e[2],n.slots=e.subarray(4,e.length),this._finalizeLayout(n),s(n)),o&&(this._workers.push(o),this._sendToWorker())},ei.prototype._finalizeLayout=function(t){var e=t._grid,i=2&t._settings,n="border-box"===e._boxSizing;return delete t._grid,delete t._settings,t.styles={},i?t.styles.width=(n?t.width+e._borderLeft+e._borderRight:t.width)+"px":t.styles.height=(n?t.height+e._borderTop+e._borderBottom:t.height)+"px",t},ei.prototype.setOptions=function(t){var e,i,n,s,o;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,n="boolean"==typeof t.alignRight?t.alignRight?4:0:4&this._options,s="boolean"==typeof t.alignBottom?t.alignBottom?8:0:8&this._options,o="boolean"==typeof t.rounding?t.rounding?16:0:16&this._options,this._options=e|i|n|s|o)},ei.prototype.createLayout=function(t,e,i,n,s,o){if(this._layouts[e])throw new Error("A layout with the provided id is currently being processed.");var r=2&this._options,a={id:e,items:i,slots:null,width:r?0:n,height:r?s:0,_grid:t,_settings:this._options};if(!i.length)return a.slots=[],this._finalizeLayout(a),void o(a);if(this._processor)return a.slots=window.Float32Array?new Float32Array(2*i.length):new Array(2*i.length),this._processor.computeLayout(a,a._settings),this._finalizeLayout(a),void o(a);var l,h,d,c=new Float32Array(4+2*i.length);for(c[0]=e,c[1]=a.width,c[2]=a.height,c[3]=a._settings,l=0,h=3;l<i.length;l++)d=i[l],c[++h]=d._width+d._marginLeft+d._marginRight,c[++h]=d._height+d._marginTop+d._marginBottom;return this._layoutQueue.push(e),this._layouts[e]=a,this._layoutCallbacks[e]=o,this._layoutWorkerData[e]=c,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,n=0;n<t.length;n++)(e=t[n]).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 ni(t,e){var i=++ii,n=0,s=0,o=!1,r=function(e){o||(s&&(n-=e-s),s=e,n>0?function(t,e){at.add(rt,ot+t,e)}(i,r):(n=s=0,t()))};return function(a){if(!o){if(!(e<=0))return!0===a?(o=!0,n=s=0,r=void 0,void function(t){at.remove(rt,ot+t)}(i)):void(n<=0?(n=e,r(0)):n=e);!0!==a&&t()}}}var si="[object HTMLCollection]",oi="[object NodeList]";function ri(t){var e=Object.prototype.toString.call(t);return e===si||e===oi}var ai="object",li="[object Object]",hi=Object.prototype.toString;function di(t){return typeof t===ai&&hi.call(t)===li}function ci(){}var ui,fi="number",_i="string",pi="instant",vi=0;function mi(t,e){if(typeof t===_i&&(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 n=function(t,e){var i=gi({},t);e&&(i=gi(i,e));e&&e.visibleStyles?i.visibleStyles=e.visibleStyles:t&&t.visibleStyles&&(i.visibleStyles=t.visibleStyles);e&&e.hiddenStyles?i.hiddenStyles=e.hiddenStyles:t&&t.hiddenStyles&&(i.hiddenStyles=t.hiddenStyles);return i}(mi.defaultOptions,e);n.visibleStyles=yi(n.visibleStyles),n.hiddenStyles=yi(n.hiddenStyles),mt(n.dragSort)||(n.dragSort=!!n.dragSort),this._id=Qe(),this._element=t,this._settings=n,this._isDestroyed=!1,this._items=[],this._layout={id:0,items:[],slots:[]},this._isLayoutFinished=!0,this._nextLayoutData=null,this._emitter=new S,this._onLayoutDataReceived=this._onLayoutDataReceived.bind(this),i[this._id]=this,Bt(t,n.containerClass),function(t,e){typeof e!==fi&&(e=!0===e?0:-1);e>=0&&(t._resizeHandler=ni((function(){t.refreshItems().layout()}),e),window.addEventListener("resize",t._resizeHandler))}(this,n.layoutOnResize),this.add(function(t,e){if("*"===e)return t.children;if(typeof e===_i){for(var i=[],n=t.children,s=0;s<n.length;s++)zt(n[s],e)&&i.push(n[s]);return i}if(Array.isArray(e)||ri(e))return e;return[]}(t,n.items),{layout:!1}),n.layoutOnInit&&this.layout(!0)}function gi(t,e){var i,n,s,o=Object.keys(e),r=o.length;for(s=0;s<r;s++)i=di(e[n=o[s]]),di(t[n])&&i?t[n]=gi(gi({},t[n]),e[n]):i?t[n]=gi({},e[n]):Array.isArray(e[n])?t[n]=e[n].slice(0):t[n]=e[n];return t}function yi(t){var e,i,n={},s=document.documentElement.style;for(e in t)t[e]&&(i=L(s,e))&&(n[i]=t[e]);return n}function bi(t){for(var e={},i=0;i<t.length;i++)e[t[i]._id]=i;return e}function wi(t,e,i){return t[e._id]-t[i._id]}mi.Item=Ze,mi.ItemLayout=Ve,mi.ItemVisibility=Fe,mi.ItemMigrate=We,mi.ItemDrag=Ae,mi.ItemDragRelease=Be,mi.ItemDragPlaceholder=ze,mi.Emitter=S,mi.Animator=qe,mi.Dragger=N,mi.Packer=ei,mi.AutoScroller=qt,mi.defaultPacker=new ei(2),mi.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:o,migrateAction:o},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:qt.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"},mi.prototype.on=function(t,e){return this._emitter.on(t,e),this},mi.prototype.off=function(t,e){return this._emitter.off(t,e),this},mi.prototype.getElement=function(){return this._element},mi.prototype.getItem=function(t){if(this._isDestroyed||!t&&0!==t)return null;if(typeof t===fi)return this._items[t>-1?t:this._items.length+t]||null;if(t instanceof Ze)return t._gridId===this._id?t:null;if(n){var e=n.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},mi.prototype.getItems=function(t){if(this._isDestroyed||void 0===t)return this._items.slice(0);var e,i,n=[];if(Array.isArray(t)||ri(t))for(e=0;e<t.length;e++)(i=this.getItem(t[e]))&&n.push(i);else(i=this.getItem(t))&&n.push(i);return n},mi.prototype.refreshItems=function(t,e){if(this._isDestroyed)return this;var i,n,s,o,r=t||this._items;if(!0===e)for(o=[],i=0;i<r.length;i++)(n=r[i]).isVisible()||n.isHiding()||((s=n.getElement().style).visibility="hidden",s.display="",o.push(s));for(i=0;i<r.length;i++)r[i]._refreshDimensions(e);if(!0===e){for(i=0;i<o.length;i++)(s=o[i]).visibility="",s.display="none";o.length=0}return this},mi.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},mi.prototype.synchronize=function(){if(this._isDestroyed)return this;var t,e,i=this._items;if(!i.length)return this;for(var n=0;n<i.length;n++)(e=i[n]._element).parentNode===this._element&&(t=t||document.createDocumentFragment()).appendChild(e);return t?(this._element.appendChild(t),this._emit("synchronize"),this):this},mi.prototype.layout=function(t,e){if(this._isDestroyed)return this;var i=this._nextLayoutData;i&&mt(i.cancel)&&i.cancel();var n=vi=vi%16777216+1;this._nextLayoutData={id:n,instant:t,onFinish:e,cancel:null};for(var s=this._items,o=[],r=0;r<s.length;r++)s[r]._isActive&&o.push(s[r]);this._refreshDimensions();var a,l=this._width-this._borderLeft-this._borderRight,h=this._height-this._borderTop-this._borderBottom,d=this._settings.layout;return mt(d)?a=d(this,n,o,l,h,this._onLayoutDataReceived):(mi.defaultPacker.setOptions(d),a=mi.defaultPacker.createLayout(this,n,o,l,h,this._onLayoutDataReceived)),mt(a)&&this._nextLayoutData&&this._nextLayoutData.id===n&&(this._nextLayoutData.cancel=a),this},mi.prototype.add=function(t,e){if(this._isDestroyed||!t)return[];var i,n=ri(i=t)?Array.prototype.slice.call(i):Array.prototype.concat(i);if(!n.length)return n;var s,o,r,a,l=e||{},h=l.layout?l.layout:void 0===l.layout,d=this._items,c=!1;for(a=0;a<n.length;a++)(o=n[a]).parentNode!==this._element&&(s=s||document.createDocumentFragment()).appendChild(o);for(s&&this._element.appendChild(s),a=0;a<n.length;a++)o=n[a],(r=n[a]=new Ze(this,o,l.active))._isActive&&(c=!0,r._layout._skipNextAnimation=!0);for(a=0;a<n.length;a++)(r=n[a])._refreshDimensions(),r._refreshSortData();return Wt(d,n,l.index),this._hasListeners("add")&&this._emit("add",n.slice(0)),c&&h&&this.layout(h===pi,mt(h)?h:void 0),n},mi.prototype.remove=function(t,e){if(this._isDestroyed||!t.length)return[];var i,n,s,o=e||{},r=o.layout?o.layout:void 0===o.layout,a=!1,l=this.getItems(),d=[],c=[];for(s=0;s<t.length;s++)(n=t[s])._isDestroyed||-1!==(i=this._items.indexOf(n))&&(n._isActive&&(a=!0),d.push(n),c.push(l.indexOf(n)),n._destroy(o.removeElements),this._items.splice(i,1));return this._hasListeners(h)&&this._emit(h,d.slice(0),c),a&&r&&this.layout(r===pi,mt(r)?r:void 0),d},mi.prototype.show=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!0,e),this},mi.prototype.hide=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!1,e),this},mi.prototype.filter=function(t,e){if(this._isDestroyed||!this._items.length)return this;var i,n,s=[],o=[],r=typeof t===_i,a=mt(t),l=e||{},h=!0===l.instant,d=l.syncWithLayout,u=l.layout?l.layout:void 0===l.layout,f=mt(l.onFinish)?l.onFinish:null,_=-1,p=ci;if(f&&(p=function(){++_&&f(s.slice(0),o.slice(0))}),a||r)for(n=0;n<this._items.length;n++)i=this._items[n],(a?t(i):zt(i._element,t))?s.push(i):o.push(i);return s.length?this.show(s,{instant:h,syncWithLayout:d,onFinish:p,layout:!1}):p(),o.length?this.hide(o,{instant:h,syncWithLayout:d,onFinish:p,layout:!1}):p(),(s.length||o.length)&&(this._hasListeners(c)&&this._emit(c,s.slice(0),o.slice(0)),u&&this.layout(u===pi,mt(u)?u:void 0)),this},mi.prototype.sort=function(){var t,e,i,n;function s(s,o){for(var r,a,l,h,d=0,c=0;c<t.length;c++)if(r=t[c][0],a=t[c][1],l=(s._sortData?s:s._refreshSortData())._sortData[r],h=(o._sortData?o:o._refreshSortData())._sortData[r],d="desc"===a||!a&&e?h<l?-1:h>l?1:0:l<h?-1:l>h?1:0)return d;return d||(n||(n=bi(i)),d=e?wi(n,o,s):wi(n,s,o)),d}function o(s,o){var r=e?-t(s,o):t(s,o);return r||(n||(n=bi(i)),r=e?wi(n,o,s):wi(n,s,o)),r}return function(r,a){if(this._isDestroyed||this._items.length<2)return this;var l=this._items,h=a||{},d=h.layout?h.layout:void 0===h.layout;if(e=!!h.descending,i=l.slice(0),n=null,mt(r))t=r,l.sort(o);else if(typeof r===_i)t=r.trim().split(" ").filter((function(t){return t})).map((function(t){return t.split(":")})),l.sort(s);else{if(!Array.isArray(r))throw t=e=i=n=null,new Error("Invalid comparer argument provided.");l.length=0,l.push.apply(l,r)}return this._hasListeners(u)&&this._emit(u,l.slice(0),i),d&&this.layout(d===pi,mt(d)?d:void 0),t=e=i=n=null,this}}(),mi.prototype.move=function(t,e,i){if(this._isDestroyed||this._items.length<2)return this;var n,r,a=this._items,l=i||{},h=l.layout?l.layout:void 0===l.layout,d=l.action===s,c=d?s:o,u=this.getItem(t),_=this.getItem(e);return u&&_&&u!==_&&(n=a.indexOf(u),r=a.indexOf(_),d?Qt(a,n,r):Ut(a,n,r),this._hasListeners(f)&&this._emit(f,{item:u,fromIndex:n,toIndex:r,action:c}),h&&this.layout(h===pi,mt(h)?h:void 0)),this},mi.prototype.send=function(t,e,i,n){if(this._isDestroyed||e._isDestroyed||this===e)return this;if(!(t=this.getItem(t)))return this;var s=n||{},o=s.appendTo||document.body,r=s.layoutSender?s.layoutSender:void 0===s.layoutSender,a=s.layoutReceiver?s.layoutReceiver:void 0===s.layoutReceiver;return t._migrate.start(e,i,o),t._migrate._isActive&&t._isActive&&(r&&this.layout(r===pi,mt(r)?r:void 0),a&&e.layout(a===pi,mt(a)?a:void 0)),this},mi.prototype.destroy=function(t){if(this._isDestroyed)return this;var e,n,s,o=this._element,r=this._items.slice(0),a=this._layout&&this._layout.styles||{};for((s=this)._resizeHandler&&(s._resizeHandler(!0),window.removeEventListener("resize",s._resizeHandler),s._resizeHandler=null),e=0;e<r.length;e++)r[e]._destroy(t);for(n in this._items.length=0,Se(o,this._settings.containerClass),a)o.style[n]="";return this._emit("destroy"),this._emitter.destroy(),delete i[this._id],this._isDestroyed=!0,this},mi.prototype._emit=function(){this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments)},mi.prototype._hasListeners=function(t){return!this._isDestroyed&&this._emitter.countListeners(t)>0},mi.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},mi.prototype._updateBorders=function(t,e,i,n){var s=this._element;t&&(this._borderLeft=bt(s,"border-left-width")),e&&(this._borderRight=bt(s,"border-right-width")),i&&(this._borderTop=bt(s,"border-top-width")),n&&(this._borderBottom=bt(s,"border-bottom-width"))},mi.prototype._refreshDimensions=function(){this._updateBoundingRect(),this._updateBorders(1,1,1,1),this._boxSizing=yt(this._element,"box-sizing")},mi.prototype._onLayoutDataReceived=(ui=[],function(t){if(!this._isDestroyed&&this._nextLayoutData&&this._nextLayoutData.id===t.id){var e,i,n,s,o=this,h=this._nextLayoutData.instant,d=this._nextLayoutData.onFinish,c=t.items.length,u=c;for(this._nextLayoutData=null,!this._isLayoutFinished&&this._hasListeners(l)&&this._emit(l,this._layout.items.slice(0)),this._layout=t,ui.length=0,s=0;s<c;s++)(e=t.items[s])?(i=t.slots[2*s],n=t.slots[2*s+1],e._canSkipLayout(i,n)?--u:(e._left=i,e._top=n,e.isActive()&&!e.isDragging()?ui.push(e):--u)):--u;if(t.styles&&Oe(this._element,t.styles),!this._hasListeners(r)||(this._emit(r,t.items.slice(0),!0===h),this._layout.id===t.id)){var f=function(){if(!(--u>0)){var e=o._layout.id!==t.id,i=mt(h)?h:d;e||(o._isLayoutFinished=!0),mt(i)&&i(t.items.slice(0),e),!e&&o._hasListeners(a)&&o._emit(a,t.items.slice(0))}};if(!ui.length)return f(),this;for(this._isLayoutFinished=!1,s=0;s<ui.length&&this._layout.id===t.id;s++)ui[s]._layout.start(!0===h,f);return this._layout.id===t.id&&(ui.length=0),this}}}),mi.prototype._setItemsVisibility=function(t,e,i){var n,s,o=this,a=t.slice(0),l=i||{},h=!0===l.instant,c=l.onFinish,u=l.layout?l.layout:void 0===l.layout,f=a.length,_=e?"showStart":d,p=e?"showEnd":"hideEnd",v=e?"show":"hide",m=!1,g=[],y=[];if(f){for(s=0;s<a.length;s++)n=a[s],(e&&!n._isActive||!e&&n._isActive)&&(m=!0),n._layout._skipNextAnimation=!(!e||n._isActive),e&&n._visibility._isHidden&&y.push(n),e?n._addToLayout():n._removeFromLayout();y.length&&(this.refreshItems(y,!0),y.length=0),m&&!1!==l.syncWithLayout?this.on(r,b):b(),m&&u&&this.layout(u===pi,mt(u)?u:void 0)}else mt(c)&&c(a);function b(){for(m&&!1!==l.syncWithLayout&&o.off(r,b),o._hasListeners(_)&&o._emit(_,a.slice(0)),s=0;s<a.length;s++)a[s]._gridId===o._id?a[s]._visibility[v](h,(function(t,e){t||g.push(e),--f<1&&(mt(c)&&c(g.slice(0)),o._hasListeners(p)&&o._emit(p,g.slice(0)))})):--f<1&&(mt(c)&&c(g.slice(0)),o._hasListeners(p)&&o._emit(p,g.slice(0)))}};const Si=mi;function ki(t){return ki="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},ki(t)}function xi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ei(n.key),n)}}function Ei(t){var e=function(t,e){if("object"!=ki(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ki(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ki(e)?e:e+""}var Di=function(){return t=function t(e,i){var n=this,s=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:s.itemWidth||100,itemHeight:s.itemHeight||100,itemGap:s.itemGap||6,label_field:s.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 o=document.createElement("style");o.id="vi-grid-style",o.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(o)}this.grid=new Si(this.gridContainer,{dragEnabled:!0,layout:{fillGaps:!0,horizontal:!1,alignRight:!1,alignBottom:!1},dragSort:!0,dragRelease:{duration:150,easing:"ease"},layoutDuration:150}),this.gridContainer.addEventListener("click",(function(t){var e=t.target.closest(".vi-grid-item");e&&n.toggleSelect(e)})),this.resizeObserver=new ResizeObserver((function(){n.grid.refreshItems(),n.grid.layout()})),this.resizeObserver.observe(i.contentContainer)},e=[{key:"addItem",value:function(t){var e=t.icon,i=t.title,n=t.data,s=document.createElement("div");s.className="vi-grid-item",s.dataset.id=n.id,s.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(s),this.grid.add(s),this.data.set(n.id,n)}},{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,n=this.data.get(i);this._onSelect&&this._onSelect({id:i,rowData:n,elem:t,selected:e}),this.event_bus&&this.event_bus.emit(this.collection,"selected",{id:i,object:n})}},{key:"setEventBus",value:function(t){this.event_bus=t}},{key:"update_record",value:function(t){t.collection;var e=t.record;this.data.set(e.id,e)}},{key:"add_or_update",value:function(t){var e=t.collection,i=t.record;this.data.has(i.id)?this.update_record({collection:e,record:i}):this.add(e,i)}},{key:"delete",value:function(t){t.collection;var e=t.record;this.removeById(e.id)}},{key:"set",value:function(t){var e=this,i=t.collection;t.result.data.forEach((function(t){e.add(i,t)}))}},{key:"focus",value:function(t){if(t&&t.id){var e=this.gridContainer.querySelector('.vi-grid-item[data-id="'.concat(t.id,'"]'));e&&(this.gridContainer.querySelectorAll(".vi-grid-item.selected").forEach((function(t){return t.classList.remove("selected")})),e.classList.add("selected"),e.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),this._onSelect&&this._onSelect({id:t.id,rowData:this.data.get(t.id),elem:e,selected:!0}))}}}],e&&xi(t.prototype,e),i&&xi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Li(t){return Li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Li(t)}function Ci(t){return function(t){if(Array.isArray(t))return Ti(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ti(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ti(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ti(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Ai(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Ii(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ai(Object(i),!0).forEach((function(e){Pi(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ai(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Pi(t,e,i){return(e=Mi(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ri(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Mi(n.key),n)}}function Mi(t){var e=function(t,e){if("object"!=Li(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Li(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Li(e)?e:e+""}var Oi=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.root=e.contentContainer||e,this.nodes=new Map,this.links=[],this.pendingLink=null,this.selectedLink=null,this.scale=1,this.offset={x:0,y:0},this.drop_callback=null,this._injectStyles(),this._build(),this._bindPanZoom(),this._bindGlobalLinkHandlers(),this._bindLinkDeletion(),this.setupDropArea(),this.selectedNodeId=null},e=[{key:"_build",value:function(){var t=this;this.root.innerHTML="",this.viewport=document.createElement("div"),this.viewport.className="vi-viewport",this.content=document.createElement("div"),this.content.className="vi-content",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.classList.add("vi-links"),this.svg.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.viewport.append(this.content,this.svg),this.root.appendChild(this.viewport),this.viewport.addEventListener("contextmenu",(function(t){return t.preventDefault()})),new ResizeObserver((function(){return t._resize()})).observe(this.root),this._resize(),this.viewport.addEventListener("pointerdown",(function(e){e.target===t.viewport&&(t._clearNodeSelection(),t.selectedLink&&(t.selectedLink.classList.remove("selected"),t.selectedLink=null))}))}},{key:"_resizeOLD",value:function(){var t=this.root.getBoundingClientRect();this.viewport.style.width=t.width+"px",this.viewport.style.height=t.height+"px";var e=1e4;this.svg.setAttribute("width",e),this.svg.setAttribute("height",e),this.svg.setAttribute("viewBox","0 0 ".concat(e," ").concat(e)),this._updateLinks()}},{key:"_resize",value:function(){var t=1e4;this.svg.setAttribute("width",t),this.svg.setAttribute("height",t),this.svg.setAttribute("viewBox","0 0 ".concat(t," ").concat(t)),this._updateLinks()}},{key:"_injectStyles",value:function(){if(!document.getElementById("vi-style")){var t=document.createElement("style");t.id="vi-style",t.textContent="\n .vi-viewport {\n position: relative;\n width: 100%;\n height: 100%;\n background: #686b9b;\n overflow: hidden;\n user-select: none;\n }\n \n .vi-content {\n position: absolute;\n inset: 0;\n z-index: 1;\n transform-origin: 0 0;\n }\n \n .vi-links {\n position: absolute;\n inset: 0;\n z-index: 2;\n pointer-events: none;\n transform-origin: 0 0;\n }\n \n .vi-node {\n position: absolute;\n width: 120px;\n height: 60px;\n background: #2b2b2b;\n border: 1px solid #555;\n border-radius: 6px;\n color: #fff;\n cursor: grab;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n }\n \n .vi-title {\n font-size: 12px;\n text-align: center;\n }\n \n .vi-icon {\n width: 24px;\n height: 24px;\n }\n \n .vi-port {\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: #4da3ff;\n cursor: crosshair;\n }\n \n .vi-port.out { right: -5px; top: 50%; transform: translateY(-50%); }\n .vi-port.in { left: -5px; top: 50%; transform: translateY(-50%); }\n \n .vi-link {\n stroke: #4da3ff;\n stroke-width: 2.5;\n fill: none;\n pointer-events: stroke;\n cursor: pointer;\n }\n \n .vi-link.preview {\n stroke-dasharray: 4 4;\n pointer-events: none;\n }\n \n .vi-link.selected {\n stroke: #ff5252;\n stroke-width: 3.5;\n }\n\n .vi-node.selected {\n outline: 2px solid #4da3ff;\n box-shadow: 0 0 0 2px #4da3ff55;\n }\n\n\n\n\n\n ",document.head.appendChild(t)}}},{key:"addIcon",value:function(t){var e=this,i=t.id,n=t.x,s=t.y,o=t.label,r=t.icon,a=document.createElement("div");a.className="vi-node",a.style.left=n+"px",a.style.top=s+"px";var l=document.createElement("div");l.className="vi-icon",l.textContent=null!=r?r:"";var h=document.createElement("div");h.className="vi-title",h.textContent=null!=o?o:i;var d=document.createElement("div");d.className="vi-port in",d.dataset.nodeId=i;var c=document.createElement("div");c.className="vi-port out",a.append(l,h,d,c),this.content.appendChild(a),this.nodes.set(i,{id:i,node:a,x:n,y:s,inPort:d,outPort:c,label:o,icon:r}),this._makeDraggable(i),this._bindPorts(i),a.addEventListener("pointerdown",(function(t){0===t.button&&(t.target.classList.contains("vi-port")||(t.stopPropagation(),e._selectNode(i)))}))}},{key:"_selectNode",value:function(t){this.selectedLink&&(this.selectedLink.classList.remove("selected"),this.selectedLink=null),this.selectedNodeId&&this.nodes.has(this.selectedNodeId)&&this.nodes.get(this.selectedNodeId).node.classList.remove("selected"),this.selectedNodeId=t,this.nodes.get(t).node.classList.add("selected")}},{key:"_clearNodeSelection",value:function(){if(this.selectedNodeId){var t=this.nodes.get(this.selectedNodeId);t&&t.node.classList.remove("selected"),this.selectedNodeId=null}}},{key:"_makeDraggable",value:function(t){var e,i,n,s,o=this,r=this.nodes.get(t);r.node.addEventListener("pointerdown",(function(t){if(!t.target.classList.contains("vi-port")&&0===t.button){e=t.clientX,i=t.clientY,n=r.x,s=r.y;var a=function(t){r.x=n+(t.clientX-e)/o.scale,r.y=s+(t.clientY-i)/o.scale,r.node.style.left=r.x+"px",r.node.style.top=r.y+"px",o._updateLinks()};window.addEventListener("pointermove",a),window.addEventListener("pointerup",(function(){return window.removeEventListener("pointermove",a)}),{once:!0})}}))}},{key:"_bindPorts",value:function(t){var e=this;this.nodes.get(t).outPort.addEventListener("pointerdown",(function(i){i.stopPropagation(),e.pendingLink={from:t,preview:e._createPreviewPath()}}))}},{key:"_bindGlobalLinkHandlers",value:function(){var t=this;window.addEventListener("pointermove",(function(e){t.pendingLink&&t._updatePreview(e.clientX,e.clientY)})),window.addEventListener("pointerup",(function(e){if(t.pendingLink){var i=document.elementFromPoint(e.clientX,e.clientY),n=null==i?void 0:i.closest(".vi-port.in");if(n){var s=n.dataset.nodeId;s&&s!==t.pendingLink.from&&t._createLink(t.pendingLink.from,s)}t.pendingLink.preview.remove(),t.pendingLink=null}}))}},{key:"_createPreviewPath",value:function(){var t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.classList.add("vi-link","preview"),this.svg.appendChild(t),t}},{key:"_updatePreview",value:function(t,e){var i=this.viewport.getBoundingClientRect(),n=(t-i.left-this.offset.x)/this.scale,s=(e-i.top-this.offset.y)/this.scale,o=this.nodes.get(this.pendingLink.from),r=o.x+120,a=o.y+30,l=.5*Math.abs(n-r);this.pendingLink.preview.setAttribute("d","M ".concat(r," ").concat(a," C ").concat(r+l," ").concat(a,", ").concat(n-l," ").concat(s,", ").concat(n," ").concat(s))}},{key:"_createLink",value:function(t,e){var i=this,n=document.createElementNS("http://www.w3.org/2000/svg","path");n.classList.add("vi-link"),n.addEventListener("pointerdown",(function(t){t.stopPropagation(),i._selectLink(n)})),this.svg.appendChild(n),this.links.push({from:t,to:e,path:n}),this._updateLinks()}},{key:"_selectLink",value:function(t){this.selectedNodeId&&this.nodes.has(this.selectedNodeId)&&(this.nodes.get(this.selectedNodeId).node.classList.remove("selected"),this.selectedNodeId=null),this.selectedLink&&this.selectedLink.classList.remove("selected"),this.selectedLink=t,t.classList.add("selected")}},{key:"_updateLinks",value:function(){var t=this;this.links.forEach((function(e){var i=t.nodes.get(e.from),n=t.nodes.get(e.to),s=i.x+120,o=i.y+30,r=n.x,a=n.y+30,l=.5*Math.abs(r-s);e.path.setAttribute("d","M ".concat(s," ").concat(o," C ").concat(s+l," ").concat(o,", ").concat(r-l," ").concat(a,", ").concat(r," ").concat(a))}))}},{key:"_bindLinkDeletion",value:function(){var t=this;window.addEventListener("keydown",(function(e){if("Delete"===e.key||"Backspace"===e.key){if(t.selectedNodeId)return t.removeNode(t.selectedNodeId),t.delete_callback&&t.delete_callback(t.selectedNodeId),void(t.selectedNodeId=null);if(t.selectedLink){var i=t.links.findIndex((function(e){return e.path===t.selectedLink}));-1!==i&&(t.links[i].path.remove(),t.links.splice(i,1)),t.selectedLink=null}}}))}},{key:"_bindPanZoom",value:function(){var t,e,i=this,n=!1;this.viewport.addEventListener("pointerdown",(function(i){2===i.button&&(n=!0,t=i.clientX,e=i.clientY,i.preventDefault())})),window.addEventListener("pointermove",(function(s){n&&(i.offset.x+=s.clientX-t,i.offset.y+=s.clientY-e,t=s.clientX,e=s.clientY,i._applyTransform())})),window.addEventListener("pointerup",(function(){return n=!1})),this.viewport.addEventListener("wheel",(function(t){t.preventDefault(),i.scale*=t.deltaY>0?.9:1.1,i._applyTransform()}),{passive:!1})}},{key:"_applyTransform",value:function(){var t="translate(".concat(this.offset.x,"px, ").concat(this.offset.y,"px) scale(").concat(this.scale,")");this.content.style.transform=t,this.svg.style.transform=t}},{key:"serialize",value:function(){return{scale:this.scale,offset:Ii({},this.offset),nodes:Ci(this.nodes.values()).map((function(t){return{id:t.id,x:t.x,y:t.y,label:t.label,icon:t.icon}})),links:this.links.map((function(t){return{from:t.from,to:t.to}}))}}},{key:"deserialize",value:function(t){var e,i,n,s,o=this;this.scale=null!==(e=t.scale)&&void 0!==e?e:1,this.offset=null!==(i=t.offset)&&void 0!==i?i:{x:0,y:0},this._applyTransform(),this.nodes.forEach((function(t){return t.node.remove()})),this.links.forEach((function(t){return t.path.remove()})),this.nodes.clear(),this.links=[],(null!==(n=t.nodes)&&void 0!==n?n:[]).forEach((function(t){return o.addIcon(t)})),(null!==(s=t.links)&&void 0!==s?s:[]).forEach((function(t){return o._createLink(t.from,t.to)}))}},{key:"set",value:function(t){var e=t.result.data[0];this.deserialize(e.object)}},{key:"setupDropArea",value:function(){var t=this;this.viewport.addEventListener("dragover",(function(t){return t.preventDefault()})),this.viewport.addEventListener("drop",(function(e){var i;e.preventDefault();try{i=JSON.parse(e.dataTransfer.getData("text/plain"))}catch(t){return}if(i.id&&!t.nodes.has(i.id)){var n=t.viewport.getBoundingClientRect(),s=(e.clientX-n.left-t.offset.x)/t.scale,o=(e.clientY-n.top-t.offset.y)/t.scale;t.drop_callback?t.drop_callback(t,i,s,o):t.addIcon(Ii(Ii({},i),{},{x:s,y:o}))}}))}},{key:"getNodeIds",value:function(){return Ci(this.nodes.keys())}},{key:"removeNode",value:function(t){var e=this,i=this.nodes.get(t);i&&(this.links=this.links.filter((function(i){return i.from!==t&&i.to!==t||(e.selectedLink===i.path&&(e.selectedLink=null),i.path.remove(),!1)})),i.node.remove(),this.nodes.delete(t),this._updateLinks())}}],e&&Ri(t.prototype,e),i&&Ri(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Yi(t){return Yi="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},Yi(t)}function Xi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ni(n.key),n)}}function Ni(t){var e=function(t,e){if("object"!=Yi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Yi(e)?e:e+""}var ji=function(){return t=function t(e){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e.contentContainer||e,this.options=n,this.collection=this.options.collection||"no_collection",this.selectedItem=null,this.items=[],this.container.innerHTML='\n <input type="text" id="drag-list-search" placeholder="Search..." style="\n width: 100%;\n box-sizing: border-box;\n padding: 4px 8px;\n margin-bottom: 4px;\n "/>\n <div id="drag-list" style="\n width: 100%;\n height: calc(100% - 32px);\n overflow: auto;\n display: flex;\n flex-direction: column;\n gap: 4px;\n "></div>\n ';var s=this.container.querySelector("#drag-list-search");s.addEventListener("input",(function(){return i._filterItems(s.value)}))},e=[{key:"addVOD",value:function(t){this.vod=t}},{key:"set",value:function(t){var e=this,i=t.result.data,n=this.container.querySelector("#drag-list");n.innerHTML="",this.items=[],i.forEach((function(t){var i=document.createElement("div");if(i.className="draggable-item",i.draggable=!0,i.style.display="flex",i.style.alignItems="center",i.style.padding="4px 8px",i.style.border="1px solid #555",i.style.borderRadius="4px",i.style.cursor="grab",i.style.userSelect="none",e.vod)i.innerHTML=e.vod(t);else{var s=t[e.options.icon]?'<img src="'.concat(t[e.options.icon],'" style="width:16px;height:16px;margin-right:6px;" />'):"";i.innerHTML="".concat(s,"<span>").concat(t[e.options.label],"</span>")}i.addEventListener("dragstart",(function(i){var n={path:"".concat(e.collection,":").concat(t.id),collection:e.collection,id:t.id,node:t};i.dataTransfer.setData("application/json",JSON.stringify(n)),i.dataTransfer.setData("text/plain",n.path)})),i.addEventListener("click",(function(t){e.selectedItem&&e.selectedItem.classList.remove("selected"),e.selectedItem=i,i.classList.add("selected")})),n.appendChild(i),e.items.push({node:t,el:i})}));var s=document.createElement("style");s.id="drag-list-styles",s.innerHTML="\n .draggable-item.selected {\n background-color: #4da3ff33;\n border-color: #4da3ff;\n }\n ",document.getElementById("drag-list-styles")||document.head.appendChild(s)}},{key:"_filterItems",value:function(t){var e=t.toLowerCase();this.items.forEach((function(t){var i=t.node,n=t.el,s=JSON.stringify(i).toLowerCase();n.style.display=s.includes(e)?"flex":"none"}))}},{key:"setStyle",value:function(t){var e=this;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])this.items.forEach((function(i){var n=i.el;return e._applyStyle(n,t)}));else{var i=this.container.querySelector("#drag-list");this._applyStyle(i,t)}}},{key:"removeByIds",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Array.isArray(e)&&0!==e.length){var i=new Set(e);this.items=this.items.filter((function(e){var n=e.node,s=e.el;return!i.has(n.id)||(t.selectedItem===s&&(t.selectedItem=null),s.remove(),!1)}))}}},{key:"hideByIds",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Array.isArray(e)&&0!==e.length){var i=e.map((function(t){return"string"==typeof t&&t.includes(":")?t.split(":").pop():t})),n=new Set(i);this.items.forEach((function(e){var i=e.node,s=e.el;n.has(i.id)&&(t.selectedItem===s&&(s.classList.remove("selected"),t.selectedItem=null),s.style.display="none")}))}}},{key:"showAll",value:function(){this.items.forEach((function(t){t.el.style.display="flex"}))}},{key:"_applyStyle",value:function(t,e){if("string"==typeof e)t.style.cssText+=e;else if("object"===Yi(e)){Object.assign(t.style,e);var i=t.querySelector("span");i&&Object.assign(i.style,e)}}},{key:"getSelected",value:function(){if(!this.selectedItem)return null;var t=this.selectedItem.querySelector("span");return t?t.textContent:null}}],e&&Xi(t.prototype,e),i&&Xi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function qi(t){return qi="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},qi(t)}function Hi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,zi(n.key),n)}}function Gi(t,e,i){return e&&Hi(t.prototype,e),i&&Hi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function zi(t){var e=function(t,e){if("object"!=qi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=qi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qi(e)?e:e+""}var Bi=Gi((function t(e,i,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.from=e,this.to=i,this.verb=n})),Vi={Conductor:{},Tractocamión:{arrastra:["Caja Seca","Tolva Presurizada","Tolva Volteo","Góndola","Cortina","Plataforma"],puedeTener:["Dolly"],manejado_por:["Conductor"]},Tortón:{transporta:["Carga"]},Rabón:{transporta:["Carga"]},Trailer:{conectaCon:["Dolly"],transporta:["Carga"]},"Caja Seca":{arrastra:["Dolly"],transporta:["Carga"]},"Tolva Presurizada":{arrastra:["Dolly"],transporta:["Carga"]},"Tolva Volteo":{arrastra:["Dolly"],transporta:["Carga"]},Góndola:{arrastra:["Dolly"],transporta:["Carga"]},Dolly:{arrastra:["Caja Seca","Tolva Presurizada","Tolva Volteo","Góndola","Cortina","Plataforma"]},Cortina:{arrastra:["Dolly"],transporta:["Carga"]},Plataforma:{arrastra:["Dolly"],transporta:["Carga"]},Viaje:{tiene_conductor:["Conductor"],tiene_unidad:["Tractocamión","Tortón"],tiene_origen:["Lugar"],tiene_destino:["Lugar"],tiene_estado:["estado_de_viaje"],transporta:["Carga"]},Lugar:{inicioDe:["Viaje"],finDe:["Viaje"]},Carga:{cargadaEn:["Trailer","Caja Seca","Tolva Presurizada","Tolva Volteo","Góndola","Cortina","Plataforma"]},División:{contiene:["División"]},Estatus:{se_divide_en:["Estatus"]},Alerta:{tiene_subtipo:["Alerta"]},Contrato:{tiene_subtipo:["Contrato"]},Producto:{tiene_subtipo:["Producto"]},Evento:{tiene_subtipo:["Evento"]},Proyecto:{tiene_sub_proyecto:["Proyecto"],tiene_responsable:["Person"],tiene_status:["Estatus"],tiene_cliente:["Cliente"],tiene_proveedor:["Proveedor"],tiene_lugar:["Lugar"],tiene_contrato:["Contrato"]}};function Wi(t){return Wi="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},Wi(t)}function Fi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,o,r,a=[],l=!0,h=!1;try{if(o=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=o.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,s=t}finally{try{if(!l&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(h)throw s}}return a}}(t,e)||Qi(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ui(t){return function(t){if(Array.isArray(t))return Zi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Qi(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qi(t,e){if(t){if("string"==typeof t)return Zi(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zi(t,e):void 0}}function Zi(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Ji(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$i(n.key),n)}}function $i(t){var e=function(t,e){if("object"!=Wi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Wi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wi(e)?e:e+""}var Ki=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=e,this.entities=new Map,this.relationships=new Map,this.delete_callback=null},e=[{key:"addEntity",value:function(t,e,i){this.entities.set(t.id,t),this.view.addNode(t,e,i)}},{key:"removeEntityOLD",value:function(t){this.entities.has(t)&&(this.entities.delete(t),this.view.removeNode(t))}},{key:"removeEntity",value:function(t){var e=this;this.entities.has(t)&&(Ui(this.relationships.entries()).filter((function(e){var i=Fi(e,2),n=(i[0],i[1]);return n.from===t||n.to===t})).map((function(t){return Fi(t,1)[0]})).forEach((function(t){return e.removeRelationship(t)})),this.entities.delete(t),this.view.removeNode(t))}},{key:"removeRelationshipOLD",value:function(t){this.view.removeEdge(t)}},{key:"removeRelationship",value:function(t){var e,i,n=this.relationships.get(t);if(n){var s=this.entities.get(n.from),o=this.entities.get(n.to);s&&(s.topoVersion=(null!==(e=s.topoVersion)&&void 0!==e?e:0)+1),o&&(o.topoVersion=(null!==(i=o.topoVersion)&&void 0!==i?i:0)+1);var r=this.view.nodes.get(n.from);r&&(r.dataset.topoVersion=s.topoVersion);var a=this.view.nodes.get(n.to);a&&(a.dataset.topoVersion=o.topoVersion),this.relationships.delete(t),this.view.removeEdge(t)}}},{key:"deleteSelection",value:function(){var t=this.view.getSelection();console.log("a borrar",t),t.type&&("node"===t.type&&(this.removeEntity(t.id),!this.delete_callback||this.delete_callback(t.id)),"edge"===t.type&&this.removeRelationship(t.id))}},{key:"canRelate",value:function(t,e,i){var n,s=this.entities.get(t),o=this.entities.get(i);return!(!s||!o)&&(null===(n=Vi[s.type])||void 0===n||null===(n=n[e])||void 0===n?void 0:n.includes(o.type))}},{key:"onSelect",value:function(t,e,i){"node"===t&&console.log("Controller: node selected",e),"edge"===t&&console.log("Controller: edge selected",e)}},{key:"addRelationship",value:function(t,e,i){var n,s;if(this.canRelate(t,e,i)){var o="".concat(t,"-").concat(e,"-").concat(i);if(!this.relationships.has(o)){var r=new Bi(t,i,e);this.relationships.set(o,r);var a=this.entities.get(t),l=this.entities.get(i);a&&(a.topoVersion=(null!==(n=a.topoVersion)&&void 0!==n?n:0)+1),l&&(l.topoVersion=(null!==(s=l.topoVersion)&&void 0!==s?s:0)+1);var h=this.view.nodes.get(t);h&&(h.dataset.topoVersion=a.topoVersion);var d=this.view.nodes.get(i);d&&(d.dataset.topoVersion=l.topoVersion),this.view.addEdge({id:o,rel:r})}}else console.log("Invalid relationship: ".concat(t," ").concat(e," ").concat(i))}},{key:"getModel",value:function(){return this.view.toModel()}},{key:"clear",value:function(){this.view.clear(),this.entities.clear(),this.relationships.clear()}}],e&&Ji(t.prototype,e),i&&Ji(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function tn(t){return tn="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},tn(t)}function en(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,o,r,a=[],l=!0,h=!1;try{if(o=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=o.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,s=t}finally{try{if(!l&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(h)throw s}}return a}}(t,e)||sn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nn(t){return function(t){if(Array.isArray(t))return on(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||sn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sn(t,e){if(t){if("string"==typeof t)return on(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?on(t,e):void 0}}function on(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function rn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function an(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hn(n.key),n)}}function ln(t,e,i){return(e=hn(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function hn(t){var e=function(t,e){if("object"!=tn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=tn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tn(e)?e:e+""}var dn=function(){return t=function t(e){var i,n,s,o=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),ln(this,"_closeVerbMenu",(function(){var t;null===(t=o.verbMenu)||void 0===t||t.remove(),o.verbMenu=null})),ln(this,"_onTempKey",(function(t){"Escape"===t.key&&(o.onEdgeCreateCancel(),o._cancelEdgeCreation())})),ln(this,"_onTempMove",(function(t){if(o.edgeCreation){var e=o.container.getBoundingClientRect(),i=(t.clientX-e.left-o.pan.x)/o.scale,n=(t.clientY-e.top-o.pan.y)/o.scale;o._updateTempEdge(i,n)}})),ln(this,"_closeLayoutMenu",(function(){var t;null===(t=o.layoutMenu)||void 0===t||t.remove(),o.layoutMenu=null})),this.container=e,this.nodes=new Map,this.edges=[],this.onSelect=null!==(i=r.onSelect)&&void 0!==i?i:function(){},this.onDelete=null!==(n=r.onDelete)&&void 0!==n?n:function(){},this.onEdgeCreate=null!==(s=r.onEdgeCreate)&&void 0!==s?s:function(){},this._injectStyles(),this._build(),this._resizeScheduled=!1,this._resizeObserver=new ResizeObserver((function(){o._resizeScheduled||(o._resizeScheduled=!0,requestAnimationFrame((function(){o._resizeScheduled=!1,o._resizeSVG()})))})),this._resizeObserver.observe(this.container),this.selected={type:null,id:null},this.container.addEventListener("pointerdown",(function(){o._clearSelection()})),this.container.addEventListener("keydown",(function(t){"Delete"!==t.key&&"Backspace"!==t.key||(t.preventDefault(),o.onDelete())})),this.container.addEventListener("contextmenu",(function(t){if(!t.target.closest(".node")&&!t.target.closest(".edge-group")){t.preventDefault();var e=o.container.getBoundingClientRect(),i=t.clientX-e.left,n=t.clientY-e.top,s=o.screenToGraph(i,n),r=s.x,a=s.y;o._openLayoutMenu(r,a)}})),this.scale=1,this.pan={x:0,y:0},this._enableZoom(),this._enablePan()},e=[{key:"screenToGraph",value:function(t,e){return{x:(t-this.pan.x)/this.scale,y:(e-this.pan.y)/this.scale}}},{key:"_applyTransform",value:function(){this.viewport.style.transform="translate(".concat(this.pan.x,"px, ").concat(this.pan.y,"px) scale(").concat(this.scale,")")}},{key:"_resizeSVG",value:function(){var t=this.container.getBoundingClientRect();this.viewport.style.width=t.width+"px",this.viewport.style.height=t.height+"px",this.svg.setAttribute("width",t.width),this.svg.setAttribute("height",t.height),this.svg.setAttribute("viewBox","0 0 ".concat(t.width," ").concat(t.height))}},{key:"_enableZoom",value:function(){var t=this;this.container.addEventListener("wheel",(function(e){e.preventDefault();var i=t.container.getBoundingClientRect(),n=e.clientX-i.left,s=e.clientY-i.top,o=t.scale,r=e.deltaY<0?1.1:.9;t.scale=Math.min(Math.max(t.scale*r,.2),3);var a=t.scale/o;t.pan.x=n-a*(n-t.pan.x),t.pan.y=s-a*(s-t.pan.y),t._applyTransform()}),{passive:!1})}},{key:"_enablePan",value:function(){var t,e,i,n,s=this;this.container.addEventListener("pointerdown",(function(o){if(!o.target.closest(".node")&&!o.target.closest(".edge-group")){t=o.clientX,e=o.clientY,i=s.pan.x,n=s.pan.y,s.container.setPointerCapture(o.pointerId);var r=function(o){s.pan.x=i+(o.clientX-t),s.pan.y=n+(o.clientY-e),s._applyTransform()},a=function(){window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",a)};window.addEventListener("pointermove",r),window.addEventListener("pointerup",a,{once:!0})}}))}},{key:"_build",value:function(){this.viewport=document.createElement("div"),this.viewport.className="graph-viewport",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.classList.add("edges"),this.layer=document.createElement("div"),this.layer.className="nodes",this.viewport.append(this.svg,this.layer),this.container.append(this.viewport),this.scale=1,this.container.tabIndex=0,this.container.style.outline="none",this.container.style.position="relative"}},{key:"_clearSelection",value:function(){var t=this;if("node"===this.selected.type){var e=this.nodes.get(this.selected.id);null==e||e.classList.remove("selected")}if("edge"===this.selected.type){var i=this.edges.find((function(e){return e.id===t.selected.id}));null==i||i.g.classList.remove("selected")}null!==this.selected.type&&this.onSelect({type:null,id:null,data:null}),this.selected.type=null,this.selected.id=null}},{key:"_selectNode",value:function(t){this._clearSelection();var e=this.nodes.get(t);e&&(e.classList.add("selected"),this.selected={type:"node",id:t},this.onSelect({type:"node",id:t,data:{id:t}}))}},{key:"_selectEdge",value:function(t){this._clearSelection();var e=this.edges.find((function(e){return e.id===t}));e&&(e.g.classList.add("selected"),this.selected={type:"edge",id:t},this.onSelect({type:"edge",id:t,data:e.rel}))}},{key:"addNode",value:function(t,e,i){var n,s=this,o=document.createElement("div");o.className="node";var r=null!==(n=t.label)&&void 0!==n?n:t.id;o.innerHTML="".concat(this._icon(t.type)," ").concat(r),o.dataset.type=t.type,o.dataset.label=r,o.dataset.collection=t.collection,o.topoVersion=t.topoVersion,o._pos={x:e,y:i},o.style.left=e+"px",o.style.top=i+"px",o.addEventListener("pointerdown",(function(e){e.stopPropagation(),s._selectNode(t.id)})),o.addEventListener("contextmenu",(function(e){e.preventDefault(),e.stopPropagation(),s._openVerbMenu(t.id)})),o.addEventListener("pointerup",(function(e){s.edgeCreation&&(e.stopPropagation(),s._finishEdgeCreation(t.id))})),this.layer.appendChild(o),this.nodes.set(t.id,o),this._makeDraggable(o)}},{key:"_openVerbMenu",value:function(t){var e=this;console.log("verb",t);var i=this.nodes.get(t);if(i){var n=i.dataset.type,s=Vi[n];if(s){var o=i._pos.x+i.offsetWidth,r=i._pos.y,a=document.createElement("div");a.className="verb-menu",a.style.left=o+8+"px",a.style.top=r+"px",Object.keys(s).forEach((function(i){var n=document.createElement("div");n.textContent=i,n.addEventListener("pointerdown",(function(n){n.stopPropagation(),e._closeVerbMenu(),e._startEdgeCreation(t,i)})),a.appendChild(n)})),this._closeVerbMenu(),this.verbMenu=a,this.viewport.appendChild(a),setTimeout((function(){document.addEventListener("pointerdown",e._closeVerbMenu,{once:!0})}))}}}},{key:"_finishEdgeCreation",value:function(t){var e,i,n,s;if(this.edgeCreation){var o=this.edgeCreation,r=o.fromId,a=o.verb,l=null===(e=this.nodes.get(r))||void 0===e?void 0:e.dataset.type,h=null===(i=this.nodes.get(t))||void 0===i?void 0:i.dataset.type;(null!==(n=null===(s=Vi[l])||void 0===s?void 0:s[a])&&void 0!==n?n:[]).includes(h)?(this.onEdgeCreateComplete({fromId:r,verb:a,toId:t}),this._cancelEdgeCreation()):this._cancelEdgeCreation()}}},{key:"_startEdgeCreation",value:function(t,e){this.edgeCreation={fromId:t,verb:e},this.onEdgeCreateStart({fromId:t,verb:e}),this._createTempEdge(t),window.addEventListener("pointermove",this._onTempMove),window.addEventListener("keydown",this._onTempKey)}},{key:"_cancelEdgeCreation",value:function(){var t;this.edgeCreation=null,null===(t=this.tempEdge)||void 0===t||t.remove(),this.tempEdge=null,window.removeEventListener("pointermove",this._onTempMove),window.removeEventListener("keydown",this._onTempKey)}},{key:"onEdgeCreateStart",value:function(t){var e=t.fromId,i=t.verb;this.pending={fromId:e,verb:i}}},{key:"onEdgeCreateComplete",value:function(t){var e=t.toId,i=this.pending,n=i.fromId,s=i.verb;this.onEdgeCreate({fromId:n,verb:s,toId:e}),this.pending=null}},{key:"onEdgeCreateCancel",value:function(){this.pending=null}},{key:"_intersectRect",value:function(t,e,i){var n=e.x-t.x,s=e.y-t.y,o=i.w/2,r=i.h/2,a=e.x-i.cx,l=e.y-i.cy,h=1/0;if(0!==n){var d=(n>0?-o-a:o-a)/n;h=Math.min(h,d)}if(0!==s){var c=(s>0?-r-l:r-l)/s;h=Math.min(h,c)}return{x:e.x+n*h,y:e.y+s*h}}},{key:"_createTempEdge",value:function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","path");e.classList.add("edge-temp"),this.svg.appendChild(e),this.tempEdge=e}},{key:"_updateTempEdge",value:function(t,e){var i=this.nodes.get(this.edgeCreation.fromId),n={x:i._pos.x+i.offsetWidth/2,y:i._pos.y+i.offsetHeight/2},s="M ".concat(n.x," ").concat(n.y," L ").concat(t," ").concat(e);this.tempEdge.setAttribute("d",s)}},{key:"addEdge",value:function(t){var e=this,i=t.id,n=t.rel;if(!this.edges.some((function(t){return t.id===i}))){var s=document.createElementNS("http://www.w3.org/2000/svg","g");s.classList.add("edge-group");var o=document.createElementNS("http://www.w3.org/2000/svg","path");o.classList.add("edge-hit");var r=document.createElementNS("http://www.w3.org/2000/svg","path");r.classList.add("edge");var a=document.createElementNS("http://www.w3.org/2000/svg","text");a.classList.add("edge-label"),a.textContent=n.verb;var l=document.createElementNS("http://www.w3.org/2000/svg","text");l.classList.add("edge-arrow"),l.textContent="→",s.append(o,r,a,l),this.svg.appendChild(s),o.addEventListener("pointerdown",(function(t){t.stopPropagation(),e._selectEdge(i)})),this.edges.push({id:i,rel:n,g:s,path:r,hit:o,label:a,arrow:l}),this._updateEdges()}}},{key:"removeEdge",value:function(t){var e=this.edges.findIndex((function(e){return e.id===t}));if(-1!==e){var i=this.edges[e];"edge"===this.selected.type&&this.selected.id===t&&this._clearSelection(),i.g.remove(),this.edges.splice(e,1)}}},{key:"removeNode",value:function(t){var e=this,i=this.nodes.get(t);i&&(this.edges.filter((function(e){return e.rel.from===t||e.rel.to===t})).map((function(t){return t.id})).forEach((function(t){return e.removeEdge(t)})),"node"===this.selected.type&&this.selected.id===t&&this._clearSelection(),i.remove(),this.nodes.delete(t))}},{key:"getSelection",value:function(){return function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?rn(Object(i),!0).forEach((function(e){ln(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):rn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},this.selected)}},{key:"_updateEdges",value:function(){var t=this;this.edges.forEach((function(e){var i=t.nodes.get(e.rel.from),n=t.nodes.get(e.rel.to);if(i&&n){var s={x:i._pos.x+i.offsetWidth/2,y:i._pos.y+i.offsetHeight/2},o={x:n._pos.x+n.offsetWidth/2,y:n._pos.y+n.offsetHeight/2},r=.5*Math.abs(o.x-s.x),a="\n M ".concat(s.x," ").concat(s.y,"\n C ").concat(s.x+r," ").concat(s.y,",\n ").concat(o.x-r," ").concat(o.y,",\n ").concat(o.x," ").concat(o.y,"\n ");e.path.setAttribute("d",a),e.hit.setAttribute("d",a);var l=(s.x+o.x)/2,h=(s.y+o.y)/2;e.label.setAttribute("x",l),e.label.setAttribute("y",h-6);var d=s.x+.6*(o.x-s.x),c=s.y+.6*(o.y-s.y);e.arrow.setAttribute("x",d),e.arrow.setAttribute("y",c+4)}}))}},{key:"_makeDraggable",value:function(t){var e,i,n,s,o=this;t.addEventListener("pointerdown",(function(r){e=r.clientX,i=r.clientY,n=t._pos.x,s=t._pos.y;var a=function(r){var a=(r.clientX-e)/o.scale,l=(r.clientY-i)/o.scale;t._pos.x=n+a,t._pos.y=s+l,t.style.left=t._pos.x+"px",t.style.top=t._pos.y+"px",o._updateEdges()};window.addEventListener("pointermove",a),window.addEventListener("pointerup",(function(){return window.removeEventListener("pointermove",a)}),{once:!0})}))}},{key:"_icon",value:function(t){var e,i;return null!==(e=(i={Tractocamión:"<i class='fa-solid fa-truck-moving'></i>",Tortón:"<i class='fa-solid fa-truck'></i>","Caja Seca":"<i class='fa-solid fa-box'></i>","Tolva Presurizada":"<i class='fa-solid fa-industry'></i>","Tolva Volteo":"<i class='fa-solid fa-dumpster'></i>",Góndola:"<i class='fa-solid fa-truck'></i>",Dolly:"<i class='fa-solid fa-link'></i>",Cortina:"<i class='fa-solid fa-shuttle-van'></i>",Plataforma:"<i class='fa-solid fa-trailer'></i>",Automóvil:"<i class='fa-solid fa-car'></i>",Viaje:"<i class='fa fa-globe'></i>",Conductor:"<i class='fa-solid fa-user-tie'></i>",Lugar:"<i class='fa-solid fa-map-marker-alt'></i>",Depósito:"<i class='fa-solid fa-warehouse'></i>",Terminal:"<i class='fa-solid fa-building'></i>"},ln(ln(ln(ln(ln(ln(ln(ln(ln(ln(i,"Viaje","<i class='fa-solid fa-route'></i>"),"Ruta","<i class='fa-solid fa-road'></i>"),"Carga","<i class='fa-solid fa-boxes-stacked'></i>"),"Pedido","<i class='fa-solid fa-clipboard-list'></i>"),"Fuel","<i class='fa-solid fa-gas-pump'></i>"),"Estatus","<i class='fa fa-stethoscope'></i>"),"Person","<i class='fa-solid fa-user'></i>"),"División","<i class='fa fa-sitemap'></i>"),"estado_de_viaje","<i class='fa fa-map-marker'></i>"),"Alerta","<i class='fa fa-exclamation-triangle'></i>"),ln(ln(ln(ln(ln(i,"Producto","<i class='fa fa-archive'></i>"),"Contrato","<i class='fa fa-file-text'></i>"),"Evento","<i class='fa fa-calendar'></i>"),"Cliente","<i class='fa fa-building'></i>"),"Proyecto","<i class='fa fa-building'></i>"))[t])&&void 0!==e?e:"<i class='fa-solid fa-route'></i>"}},{key:"_injectStyles",value:function(){if(!document.getElementById("graph-style")){var t=document.createElement("style");t.id="graph-style",t.textContent="\n .nodes {\n position: absolute;\n inset: 0;\n pointer-events: none;\n }\n\n .node {\n position: absolute;\n background: #2b2b2b;\n color: white;\n border: 1px solid #555;\n border-radius: 6px;\n padding: 6px 10px;\n cursor: grab;\n user-select: none;\n pointer-events: auto;\n }\n\n svg.edges {\n position: absolute;\n inset: 0;\n pointer-events: auto;\n }\n\n svg.edges {\n overflow: visible; /* 👈 REQUIRED */\n }\n\n .edge-group {\n pointer-events: all;\n cursor: pointer;\n }\n\n .edge {\n fill: none;\n stroke: #4da3ff;\n stroke-width: 2.5;\n }\n\n .edge {\n pointer-events: stroke;\n cursor: pointer;\n }\n\n .edge-hit {\n fill: none;\n stroke: transparent;\n stroke-width: 14; /* 👈 BIG hit area */\n cursor: pointer;\n }\n\n .edge-group.selected .edge {\n stroke: #ff5252;\n stroke-width: 3.5;\n }\n\n .edge-label {\n fill: red;\n font-size: 12px;\n pointer-events: none;\n text-anchor: middle;\n user-select: none;\n }\n\n\n .node.selected {\n outline: 2px solid #ff5252;\n outline-offset: 2px;\n }\n\n \n .edge {\n fill: none;\n stroke: #4da3ff;\n stroke-width: 2.5;\n pointer-events: none;\n }\n\n .edge-hit {\n fill: none;\n stroke: transparent;\n stroke-width: 14;\n cursor: pointer;\n }\n\n .edge-hit {\n pointer-events: stroke;\n }\n\n .edge-group.selected .edge {\n stroke: #ff5252;\n stroke-width: 3.5;\n }\n\n .edge-group.selected marker path {\n fill: #ff5252;\n }\n\n .graph-viewport {\n position: absolute;\n inset: 0;\n overflow: visible;\n transform-origin: 0 0;\n \n }\n\n .graph-viewport {\n cursor: grab;\n }\n\n \n \n\n .graph-viewport:active {\n cursor: grabbing;\n }\n\n .verb-menu {\n position: absolute;\n background: #1e1e1e;\n border: 1px solid #555;\n border-radius: 6px;\n padding: 4px;\n z-index: 9;\n color: white; \n }\n\n .verb-menu > div {\n padding: 6px 12px;\n cursor: pointer;\n }\n\n .verb-menu > div:hover {\n background: #333;\n }\n\n .edge-temp {\n fill: none;\n stroke: #aaa;\n stroke-dasharray: 4 4;\n stroke-width: 2;\n pointer-events: none;\n }\n\n .edge {\n stroke: #4da3ff;\n color: #4da3ff;\n }\n\n .edge-group.selected .edge {\n stroke: #ff5252;\n color: #ff5252;\n }\n\n .edge-arrow {\n fill: #4da3ff;\n font-size: 14px;\n font-weight: bold;\n pointer-events: none;\n text-anchor: middle;\n user-select: none;\n }\n\n .edge-group.selected .edge-arrow {\n fill: #ff5252;\n }\n\n .vi-toolbox-button {\n z-index: 9000; /* above graph */\n pointer-events: auto; /* needed for clicks */\n }\n\n\n .layout-menu {\n position: absolute;\n background: #1e1e1e;\n border: 1px solid #555;\n border-radius: 8px;\n padding: 6px 0;\n color: white;\n z-index: 10;\n min-width: 210px;\n }\n\n .layout-item {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 8px 14px;\n cursor: pointer;\n white-space: nowrap;\n }\n\n .layout-item:hover {\n background: #333;\n }\n\n .layout-icon {\n width: 20px;\n text-align: center;\n color: #4da3ff;\n font-size: 14px;\n }\n\n .layout-label {\n flex: 1;\n }\n\n\n\n\n\n\n ",document.head.appendChild(t)}}},{key:"serialize",value:function(){return{viewport:{pan:this.pan,scale:this.scale},nodes:nn(this.nodes.entries()).map((function(t){var e=en(t,2),i=e[0],n=e[1];return{id:i,type:n.dataset.type,label:n.dataset.label,topoVersion:n.dataset.topoVersion,x:n._pos.x,y:n._pos.y}})),edges:this.edges.map((function(t){return{id:t.id,from:t.rel.from,to:t.rel.to,verb:t.rel.verb}}))}}},{key:"clear",value:function(){var t,e;null===(t=this._cancelEdgeCreation)||void 0===t||t.call(this),this._clearSelection(),this.edges.forEach((function(t){return t.g.remove()})),this.edges.length=0,this.nodes.forEach((function(t){return t.remove()})),this.nodes.clear(),null===(e=this._closeVerbMenu)||void 0===e||e.call(this),this.pan={x:0,y:0},this.scale=1,this._applyTransform(),this.tempEdge&&(this.tempEdge.remove(),this.tempEdge=null),this.selected={type:null,id:null},this.pending=null,this.edgeCreation=null}},{key:"deserialize",value:function(t){var e=this;this.clear(),t.nodes.forEach((function(t){return e.addNode({id:t.id,type:t.type,label:t.label},t.x,t.y)})),t.edges.forEach((function(t){return e.addEdge({id:t.id,rel:{from:t.from,to:t.to,verb:t.verb}})})),t.viewport&&(this.pan=t.viewport.pan,this.scale=t.viewport.scale,this._applyTransform())}},{key:"toModel",value:function(){return{entities:nn(this.nodes.entries()).map((function(t){var e=en(t,2),i=e[0],n=e[1];return{id:i,type:n.dataset.type,label:n.dataset.label}})),relationships:this.edges.map((function(t){return{from:t.rel.from,to:t.rel.to,verb:t.rel.verb}}))}}},{key:"getNodeIds",value:function(){return Array.from(this.nodes.keys())}},{key:"_setNodePosition",value:function(t,e,i){t._pos.x=e,t._pos.y=i,t.style.left=e+"px",t.style.top=i+"px"}},{key:"autoLayoutTree",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.startX,n=void 0===i?100:i,s=e.startY,o=void 0===s?100:s,r=e.levelGap,a=void 0===r?140:r,l=e.nodeGap,h=void 0===l?100:l,d={},c={};this.nodes.forEach((function(t,e){d[e]=[],c[e]=0})),this.edges.forEach((function(t){d[t.rel.from].push(t.rel.to),c[t.rel.to]++}));var u=Object.keys(c).filter((function(t){return 0===c[t]})),f=n,_=new Set;u.forEach((function(e){for(var i=[{id:e,level:0}],n={},s=function(){var e,s=i.shift(),r=s.id,l=s.level;if(_.has(r))return 1;_.add(r),null!==(e=n[l])&&void 0!==e||(n[l]=0);var c=o+l*a,u=f+n[l]*h,p=t.nodes.get(r);p&&t._setNodePosition(p,u,c),n[l]++,d[r].forEach((function(t){return i.push({id:t,level:l+1})}))};i.length;)s();f+=300})),this._updateEdges()}},{key:"autoLayoutHorizontalTree",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.startX,n=void 0===i?80:i,s=e.startY,o=void 0===s?80:s,r=e.columnGap,a=void 0===r?220:r,l=e.rowGap,h=void 0===l?80:l,d={},c={};this.nodes.forEach((function(t,e){d[e]=[],c[e]=0})),this.edges.forEach((function(t){d[t.rel.from].push(t.rel.to),c[t.rel.to]++}));var u=Object.keys(c).filter((function(t){return 0===c[t]})),f=o,_=new Set,p=function(e,i){if(_.has(e))return f;_.add(e);var s=f,o=d[e];o.forEach((function(t){f=p(t,i+1)+h})),0===o.length&&(f+=h);var r=f-h,l=o.length>0?(s+r)/2:s,c=n+i*a,u=t.nodes.get(e);return u&&t._setNodePosition(u,c,l),l};u.forEach((function(t){p(t,0),f+=2*h})),this._updateEdges()}},{key:"autoLayoutFlow",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.startX,n=void 0===i?100:i,s=e.startY,o=void 0===s?200:s,r=e.gap,a=void 0===r?160:r,l=new Set,h=n,d=function(e){if(!l.has(e)){l.add(e);var i=t.nodes.get(e);i&&t._setNodePosition(i,h,o),h+=a,t.edges.filter((function(t){return t.rel.from===e})).forEach((function(t){return d(t.rel.to)}))}};this.getNodeIds().forEach(d),this._updateEdges()}},{key:"autoLayoutGrid",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.cols,n=void 0===i?5:i,s=e.startX,o=void 0===s?100:s,r=e.startY,a=void 0===r?100:r,l=e.gapX,h=void 0===l?160:l,d=e.gapY,c=void 0===d?120:d,u=0;this.nodes.forEach((function(e){var i=u%n,s=Math.floor(u/n),r=o+i*h,l=a+s*c;t._setNodePosition(e,r,l),u++})),this._updateEdges()}},{key:"autoLayoutRadial",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.centerX,n=void 0===i?400:i,s=e.centerY,o=void 0===s?300:s,r=e.radius,a=void 0===r?200:r,l=this.getNodeIds(),h=2*Math.PI/l.length;l.forEach((function(e,i){var s=t.nodes.get(e);if(s){var r=i*h,l=n+Math.cos(r)*a,d=o+Math.sin(r)*a;t._setNodePosition(s,l,d)}})),this._updateEdges()}},{key:"_openLayoutMenu",value:function(t,e){var i=this;this._closeLayoutMenu();var n=this.container.getBoundingClientRect(),s=this._layoutIcons(),o=document.createElement("div");o.className="layout-menu",o.style.left=t-n.left+"px",o.style.top=e-n.top+"px",[{label:"Tree (Vertical)",icon:s.treeVertical,action:function(){return i.autoLayoutTree()}},{label:"Tree (Horizontal)",icon:s.treeHorizontal,action:function(){return i.autoLayoutHorizontalTree()}},{label:"Flow",icon:s.flow,action:function(){return i.autoLayoutFlow()}},{label:"Grid",icon:s.grid,action:function(){return i.autoLayoutGrid()}},{label:"Radial",icon:s.radial,action:function(){return i.autoLayoutRadial()}}].forEach((function(t){var e=t.label,n=t.icon,s=t.action,r=document.createElement("div");r.className="layout-item",r.innerHTML='\n <span class="layout-icon">'.concat(n,'</span>\n <span class="layout-label">').concat(e,"</span>\n "),r.addEventListener("pointerdown",(function(t){t.stopPropagation(),i._closeLayoutMenu(),s()})),o.appendChild(r)})),this.layoutMenu=o,this.viewport.appendChild(o),setTimeout((function(){document.addEventListener("pointerdown",i._closeLayoutMenu,{once:!0})}))}},{key:"_layoutIcons",value:function(){return{treeVertical:"<i class='fa-solid fa-sitemap'></i>",treeHorizontal:"<i class='fa-solid fa-diagram-project'></i>",flow:"<i class='fa-solid fa-arrow-right-long'></i>",grid:"<i class='fa-solid fa-table-cells'></i>",radial:"<i class='fa-solid fa-circle-nodes'></i>"}}}],e&&an(t.prototype,e),i&&an(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function cn(t){return cn="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},cn(t)}function un(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_n(n.key),n)}}function fn(t,e,i){return e&&un(t.prototype,e),i&&un(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function _n(t){var e=function(t,e){if("object"!=cn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=cn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cn(e)?e:e+""}var pn=fn((function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e,this.type=i,this.data=n}));function vn(t){return vn="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},vn(t)}function mn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,o,r,a=[],l=!0,h=!1;try{if(o=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=o.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,s=t}finally{try{if(!l&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(h)throw s}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return gn(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?gn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function yn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,bn(n.key),n)}}function bn(t){var e=function(t,e){if("object"!=vn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=vn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vn(e)?e:e+""}var wn=function(){return t=function t(e,i){var n,s=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("GraphEditor: container required");this.options=i,this.onSelect=null!==(n=i.onSelect)&&void 0!==n?n:function(){};var o=document.createElement("div");o.style.position="relative",o.style.width="100%",o.style.height="100%",e.contentContainer.appendChild(o),this.container=o,this.view=new dn(this.container,{onSelect:this._handleSelection.bind(this),onDelete:function(){s.controller.deleteSelection(),s._markDirty("delete")},onEdgeCreate:function(t){var e=t.fromId,i=t.verb,n=t.toId;s.controller.addRelationship(e,i,n),s._markDirty("edge create")}}),this.controller=new Ki(this.view),this._setupDropArea()},e=[{key:"_markDirty",value:function(){this.isDirty||(this.isDirty=!0,window.isDirty=!0)}},{key:"_clearDirty",value:function(){this.isDirty=!1,window.isDirty=!1}},{key:"_handleSelection",value:function(t){var e=t.type,i=t.id,n=t.data;this.controller.onSelect(e,i,n),this.onSelect({type:e,id:i,data:n})}},{key:"clear",value:function(){this.controller.clear()}},{key:"_setupDropArea",value:function(){var t=this;this.container.addEventListener("dragover",(function(t){return t.preventDefault()})),this.container.addEventListener("drop",(function(e){var i,n,s;e.preventDefault();var o=null,r=e.dataTransfer.getData("application/json");if(r)try{o=JSON.parse(r)}catch(t){}if(!o){var a=e.dataTransfer.getData("text/plain");if(!a)return;if(a.includes(":")){var l=mn(a.split(":"),2);o={collection:l[0],id:l[1],path:a}}else try{o=JSON.parse(a)}catch(t){o={id:a}}}if(null!==(i=o)&&void 0!==i&&i.id){var h=null!==(n=o.path)&&void 0!==n?n:o.id;if(!t.controller.entities.has(h)){var d=t.container.getBoundingClientRect(),c=e.clientX-d.left,u=e.clientY-d.top,f=t.view.screenToGraph(c,u),_=f.x,p=f.y,v={id:h,collection:o.collection,sourceId:o.id,raw:o,topoVersion:0};null===(s=t.drop_callback)||void 0===s||s.call(t,t,v,_,p),t._markDirty("drop node")}}}))}},{key:"relate",value:function(t,e,i){this.controller.addRelationship(t,e,i),this._markDirty("add relationship")}},{key:"getNodeIds",value:function(){return this.view.getNodeIds()}},{key:"getNodeIdsByType",value:function(t){var e=this;return this.view.getNodeIds().filter((function(i){var n;return(null===(n=e.view.nodes.get(i))||void 0===n?void 0:n.dataset.type)===t}))}},{key:"serialize",value:function(){return{version:1,graph:this.view.serialize()}}},{key:"deserialize",value:function(t){var e=this;1!==t.version&&(t=this._migrate(t)),t.graph&&(this.view.deserialize(t.graph),t.graph.nodes.forEach((function(t){var i=new pn(t.id,t.type,t.label);e.controller.entities.set(t.id,i)})),t.graph.edges.forEach((function(t){e.controller.addRelationship(t.from,t.verb,t.to)})),this._clearDirty())}},{key:"set",value:function(t){var e=t.result.data[0];this.controller.clear(),e&&e.object&&this.deserialize(e.object)}},{key:"getAdjacentNodes",value:function(t){var e=this;if(!this.controller.entities.has(t))return[];var i=new Map;return this.controller.relationships.forEach((function(e){if(e.from===t){var n=e.to;i.has(n)||i.set(n,[]),i.get(n).push(e.verb)}else if(e.to===t){var s=e.from;i.has(s)||i.set(s,[]),i.get(s).push(e.verb)}})),Array.from(i.entries()).map((function(t){var i=mn(t,2),n=i[0],s=i[1];return{nodeId:n,entity:e.controller.entities.get(n),verbs:s}}))}},{key:"_migrate",value:function(t){return t}},{key:"isModified",value:function(){return this.isDirty}}],e&&yn(t.prototype,e),i&&yn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Sn(t){return Sn="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},Sn(t)}function kn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xn(n.key),n)}}function xn(t){var e=function(t,e){if("object"!=Sn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Sn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sn(e)?e:e+""}var En=function(){return t=function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=i,this.type=this.options.type||"Unnamed",this.html=this.options.html||this.getDefaultTML(),e.insertHtmlContent(this.html),this.root=e.contentContainer,this.card=this.root.querySelector(".node-card"),this.options.multidrag?this.setMultiListeners():this.setListeners()},e=[{key:"setMultiListeners",value:function(){var t=this;this.card.querySelectorAll(".status-icon").forEach((function(e){e.tabIndex=0,e.addEventListener("dragstart",(function(i){var n=e.dataset.status,s={id:"".concat(t.type,":").concat(Date.now()),type:t.type,status:n};i.dataTransfer.setData("application/json",JSON.stringify(s)),i.dataTransfer.effectAllowed="copy";var o=document.createElement("div");o.textContent=e.textContent,Object.assign(o.style,{width:"40px",height:"40px",borderRadius:"8px",background:"#22c55e",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"22px",position:"absolute",top:"-1000px",left:"-1000px"}),document.body.appendChild(o),i.dataTransfer.setDragImage(o,20,20),setTimeout((function(){return o.remove()}),0)}))}))}},{key:"setListeners",value:function(){var t=this;this.card.addEventListener("dragstart",(function(e){var i=t.card.querySelector(".node-name"),n=(null==i?void 0:i.value)||"Unnamed",s={id:"".concat(t.type,":").concat(Date.now()),type:t.type,label:n};e.dataTransfer.setData("application/json",JSON.stringify(s)),e.dataTransfer.effectAllowed="copy";var o=document.createElement("div");o.textContent=n[0].toUpperCase(),Object.assign(o.style,{width:"40px",height:"40px",borderRadius:"50%",background:"#3b82f6",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",fontSize:"18px",position:"absolute",top:"-1000px",left:"-1000px"}),document.body.appendChild(o),e.dataTransfer.setDragImage(o,20,20),setTimeout((function(){return o.remove()}),0)}))}},{key:"clearCard",value:function(){var t=this.card.querySelector(".node-name");t&&(t.value="")}},{key:"getDefaultTML",value:function(){return'\n <div style="\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n ">\n <div class="node-card" style="\n border: 1px solid #ccc;\n border-radius: 8px;\n padding: 16px;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n box-shadow: 0 2px 6px rgba(0,0,0,0.1);\n cursor: grab;\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 10px;\n " draggable="true">\n <label style="font-weight: bold;">Name:</label>\n <input type="text" class="node-name" placeholder="Enter name" style="\n padding: 8px;\n border: 1px solid #ccc;\n border-radius: 4px;\n font-size: 14px;\n width: 100%;\n box-sizing: border-box;\n "/>\n </div>\n </div>\n '}}],e&&kn(t.prototype,e),i&&kn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),Dn=e._Z,Ln=e.Hx,Cn=e.YO,Tn=e._D,An=e.Qz;export{Dn as vi_GraphEditor,Ln as vi_Grid,Cn as vi_IconPanel,Tn as vi_dragable_card,An as vi_dragable_list};
2
+ var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{_Z:()=>wn,Hx:()=>Di,YO:()=>Oi,_D:()=>En,Qz:()=>ji});var i={},n="function"==typeof Map?new Map:null,s="swap",o="move",r="layoutStart",a="layoutEnd",l="layoutAbort",h="remove",d="hideStart",c="filter",u="sort",f="move",_="send",p="beforeSend",v="receive",m="beforeReceive",g="dragReleaseEnd",y="ontouchstart"in window,b=!!window.PointerEvent,w=!!window.navigator.msPointerEnabled;function S(){this._events={},this._queue=[],this._counter=0,this._clearOnEmit=!1}S.prototype.on=function(t,e){if(!this._events||!t||!e)return this;var i=this._events[t];return i||(i=this._events[t]=[]),i.push(e),this},S.prototype.off=function(t,e){if(!this._events||!t||!e)return this;var i,n=this._events[t];if(!n||!n.length)return this;for(;-1!==(i=n.indexOf(e));)n.splice(i,1);return this},S.prototype.clear=function(t){if(!this._events||!t)return this;var e=this._events[t];return e&&(e.length=0,delete this._events[t]),this},S.prototype.emit=function(t){if(!this._events||!t)return this._clearOnEmit=!1,this;var e=this._events[t];if(!e||!e.length)return this._clearOnEmit=!1,this;var i,n=this._queue,s=n.length,o=arguments.length-1;o>3&&((i=[]).push.apply(i,arguments),i.shift()),n.push.apply(n,e),this._clearOnEmit&&(e.length=0,this._clearOnEmit=!1),++this._counter;for(var r=s,a=n.length;r<a;r++)if(0===o?n[r]():1===o?n[r](arguments[1]):2===o?n[r](arguments[1],arguments[2]):3===o?n[r](arguments[1],arguments[2],arguments[3]):n[r].apply(null,i),!this._events)return this;return--this._counter,this._counter||(n.length=0),this},S.prototype.burst=function(){return this._events?(this._clearOnEmit=!0,this.emit.apply(this,arguments),this):this},S.prototype.countListeners=function(t){if(!this._events)return 0;var e=this._events[t];return e?e.length:0},S.prototype.destroy=function(){return this._events?(this._queue.length=this._counter=0,this._events=null,this):this};var k=b?"pointerout":w?"MSPointerOut":"";function x(t){k&&(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))}x.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(k,this._onOut))},x.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(k,this._onOut),this._resetData(),this._isActive=!1)},x.prototype._resetData=function(){window.clearTimeout(this._timeout),this._timeout=null,this._outEvent=null},x.prototype._onStart=function(t){"mouse"!==t.pointerType&&this._addBehaviour()},x.prototype._onOut=function(t){this._dragger._getTrackedTouch(t)&&(this._resetData(),this._outEvent=t,this._timeout=window.setTimeout(this._onTimeout,100))},x.prototype._onTimeout=function(){var t=this._outEvent;this._resetData(),this._dragger.isActive()&&this._dragger._onCancel(t)},x.prototype.destroy=function(){k&&(this._dragger.off("start",this._onStart),this._removeBehaviour())};var E=["","webkit","moz","ms","o","Webkit","Moz","MS","O"],D={};function L(t,e){var i=D[e]||"";if(i)return i;for(var n=e[0].toUpperCase()+e.slice(1),s=0;s<E.length;){if((i=E[s]?E[s]+n:e)in t)return D[e]=i,i;++s}return""}function T(){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 C=window.navigator.userAgent.toLowerCase(),A=C.indexOf("edge")>-1,I=C.indexOf("trident")>-1,P=C.indexOf("firefox")>-1,R=C.indexOf("android")>-1,M=!!T()&&{passive:!0},O="touchAction",Y=L(document.documentElement.style,O),X="auto";function N(t,e){this._element=t,this._emitter=new S,this._isDestroyed=!1,this._cssProps={},this._touchAction="",this._isActive=!1,this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._onStart=this._onStart.bind(this),this._onMove=this._onMove.bind(this),this._onCancel=this._onCancel.bind(this),this._onEnd=this._onEnd.bind(this),this._edgeHack=null,(A||I)&&(b||w)&&(this._edgeHack=new x(this)),this.setCssProps(e),this._touchAction||this.setTouchAction(X),t.addEventListener("dragstart",N._preventDefault,!1),t.addEventListener(N._inputEvents.start,this._onStart,M)}N._pointerEvents={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},N._msPointerEvents={start:"MSPointerDown",move:"MSPointerMove",cancel:"MSPointerCancel",end:"MSPointerUp"},N._touchEvents={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},N._mouseEvents={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},N._inputEvents=y?N._touchEvents:b?N._pointerEvents:w?N._msPointerEvents:N._mouseEvents,N._emitter=new S,N._emitterEvents={start:"start",move:"move",end:"end",cancel:"cancel"},N._activeInstances=[],N._preventDefault=function(t){t.preventDefault&&!1!==t.cancelable&&t.preventDefault()},N._activateInstance=function(t){N._activeInstances.indexOf(t)>-1||(N._activeInstances.push(t),N._emitter.on(N._emitterEvents.move,t._onMove),N._emitter.on(N._emitterEvents.cancel,t._onCancel),N._emitter.on(N._emitterEvents.end,t._onEnd),1===N._activeInstances.length&&N._bindListeners())},N._deactivateInstance=function(t){var e=N._activeInstances.indexOf(t);-1!==e&&(N._activeInstances.splice(e,1),N._emitter.off(N._emitterEvents.move,t._onMove),N._emitter.off(N._emitterEvents.cancel,t._onCancel),N._emitter.off(N._emitterEvents.end,t._onEnd),N._activeInstances.length||N._unbindListeners())},N._bindListeners=function(){window.addEventListener(N._inputEvents.move,N._onMove,M),window.addEventListener(N._inputEvents.end,N._onEnd,M),N._inputEvents.cancel&&window.addEventListener(N._inputEvents.cancel,N._onCancel,M)},N._unbindListeners=function(){window.removeEventListener(N._inputEvents.move,N._onMove,M),window.removeEventListener(N._inputEvents.end,N._onEnd,M),N._inputEvents.cancel&&window.removeEventListener(N._inputEvents.cancel,N._onCancel,M)},N._getEventPointerId=function(t){return"number"==typeof t.pointerId?t.pointerId:t.changedTouches?t.changedTouches[0]?t.changedTouches[0].identifier:null:1},N._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},N._onMove=function(t){N._emitter.emit(N._emitterEvents.move,t)},N._onCancel=function(t){N._emitter.emit(N._emitterEvents.cancel,t)},N._onEnd=function(t){N._emitter.emit(N._emitterEvents.end,t)},N.prototype._reset=function(){this._pointerId=null,this._startTime=0,this._startX=0,this._startY=0,this._currentX=0,this._currentY=0,this._isActive=!1,N._deactivateInstance(this)},N.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===N._emitterEvents.start?0:this.getDeltaTime(),isFirst:t===N._emitterEvents.start,isFinal:t===N._emitterEvents.end||t===N._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}},N.prototype._emit=function(t,e){this._emitter.emit(t,this._createEvent(t,e))},N.prototype._getTrackedTouch=function(t){return null===this._pointerId?null:N._getTouchById(t,this._pointerId)},N.prototype._onStart=function(t){if(!this._isDestroyed&&null===this._pointerId&&(this._pointerId=N._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(N._emitterEvents.start,t),this._isActive&&N._activateInstance(this)}},N.prototype._onMove=function(t){var e=this._getTrackedTouch(t);e&&(this._currentX=e.clientX,this._currentY=e.clientY,this._emit(N._emitterEvents.move,t))},N.prototype._onCancel=function(t){this._getTrackedTouch(t)&&(this._emit(N._emitterEvents.cancel,t),this._reset())},N.prototype._onEnd=function(t){this._getTrackedTouch(t)&&(this._emit(N._emitterEvents.end,t),this._reset())},N.prototype.isActive=function(){return this._isActive},N.prototype.setTouchAction=function(t){this._touchAction=t,Y&&(this._cssProps[Y]="",this._element.style[Y]=t),y&&(this._element.removeEventListener(N._touchEvents.start,N._preventDefault,!0),(this._element.style[Y]!==t||P&&R)&&this._element.addEventListener(N._touchEvents.start,N._preventDefault,!0))},N.prototype.setCssProps=function(t){if(t){var e,i,n=this._cssProps,s=this._element;for(e in n)s.style[e]=n[e],delete n[e];for(e in t)t[e]&&(e!==O?(i=L(s.style,e))&&(n[i]="",s.style[i]=t[e]):this.setTouchAction(t[e]))}},N.prototype.getDeltaX=function(){return this._currentX-this._startX},N.prototype.getDeltaY=function(){return this._currentY-this._startY},N.prototype.getDistance=function(){var t=this.getDeltaX(),e=this.getDeltaY();return Math.sqrt(t*t+e*e)},N.prototype.getDeltaTime=function(){return this._startTime?Date.now()-this._startTime:0},N.prototype.on=function(t,e){this._emitter.on(t,e)},N.prototype.off=function(t,e){this._emitter.off(t,e)},N.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(N._inputEvents.start,this._onStart,M),t.removeEventListener("dragstart",N._preventDefault,!1),t.removeEventListener(N._touchEvents.start,N._preventDefault,!0),this._cssProps)t.style[e]=this._cssProps[e],delete this._cssProps[e];this._element=null,this._isDestroyed=!0}};var j=1e3/60,q=(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return this.setTimeout((function(){t(Date.now())}),j)}).bind(window);function H(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 G)}function G(){this.queue=[],this.indices={},this.callbacks={}}H.prototype._step=function(t){var e,i,n,s,o,r,a=this._lanes,l=this._stepQueue,h=this._stepCallbacks;for(this._nextStep=null,e=0;e<a.length;e++){for(s=a[e].queue,o=a[e].callbacks,r=a[e].indices,i=0;i<s.length;i++)(n=s[i])&&(l.push(n),h[n]=o[n],delete o[n],delete r[n]);s.length=0}for(e=0;e<l.length;e++)h[n=l[e]]&&h[n](t),delete h[n];l.length=0},H.prototype.add=function(t,e,i){this._lanes[t].add(e,i),this._nextStep||(this._nextStep=q(this._step))},H.prototype.remove=function(t,e){this._lanes[t].remove(e)},G.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},G.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 z="layoutRead",B="layoutWrite",V="visibilityRead",W="visibilityWrite",F="dragStartRead",U="dragStartWrite",Q="dragMoveRead",Z="dragMoveWrite",J="dragScrollRead",$="dragScrollWrite",K="dragSortRead",tt="placeholderLayoutRead",et="placeholderLayoutWrite",it="placeholderResizeWrite",nt="autoScrollRead",st="autoScrollWrite",ot="debounceRead",rt=0,at=new H(3);function lt(t){at.remove(rt,z+t),at.remove(2,B+t)}function ht(t){at.remove(rt,V+t),at.remove(2,W+t)}function dt(t){at.remove(rt,F+t),at.remove(2,U+t)}function ct(t){at.remove(rt,Q+t),at.remove(2,Z+t)}function ut(t){at.remove(rt,J+t),at.remove(2,$+t)}function ft(t,e){at.add(1,K+t,e)}function _t(t){at.remove(rt,tt+t),at.remove(2,et+t)}function pt(t,e){at.add(rt,nt,t),at.add(2,st,e)}var vt="function";function mt(t){return typeof t===vt}var gt="function"==typeof WeakMap?new WeakMap:null;function yt(t,e){var i=gt&&gt.get(t);return i||(i=window.getComputedStyle(t,null),gt&&gt.set(t,i)),i.getPropertyValue(e)}function bt(t,e){return parseFloat(yt(t,e))||0}var wt,St=document.documentElement,kt=document.body,xt={value:0,offset:0};function Et(t){return t===window||t===St||t===kt?window:t}function Dt(t){return t===window?t.pageXOffset:t.scrollLeft}function Lt(t){return t===window?t.pageYOffset:t.scrollTop}function Tt(t){return t===window?St.scrollWidth-St.clientWidth:t.scrollWidth-t.clientWidth}function Ct(t){return t===window?St.scrollHeight-St.clientHeight:t.scrollHeight-t.clientHeight}function At(t,e){if(e=e||{},t===window)e.width=St.clientWidth,e.height=St.clientHeight,e.left=0,e.right=e.width,e.top=0,e.bottom=e.height;else{var i=t.getBoundingClientRect(),n=t.clientLeft||bt(t,"border-left-width"),s=t.clientTop||bt(t,"border-top-width");e.width=t.clientWidth,e.height=t.clientHeight,e.left=i.left+n,e.right=e.left+e.width,e.top=i.top+s,e.bottom=e.top+e.height}return e}function It(t){return t._drag._getGrid()._settings.dragAutoScroll}function Pt(t){if(t._drag&&t._isActive){var e=t._drag;e._scrollDiffX=e._scrollDiffY=0,t._setTranslate(e._left,e._top)}}function Rt(t,e,i,n){return xt.value=Math.min(n/2,t),xt.offset=Math.max(0,i+2*xt.value+n*e-n)/2,xt}function Mt(){this.reset()}function Ot(){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 Xt(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?Dt(this.element):Lt(this.element):Math.max(0,Math.min(this.value,this.maxValue))},Mt.prototype.computeNextScrollValue=function(t){var e=this.speed*(t/1e3),i=4&this.direction?this.value+e:this.value-e;return Math.max(0,Math.min(i,this.maxValue))},Mt.prototype.computeSpeed=(wt={direction:null,threshold:0,distance:0,value:0,maxValue:0,deltaTime:0,duration:0,isEnding:!1},function(t){var e=this.item,i=It(e).speed;return mt(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;mt(e)&&e(t,this.element,this.direction)},Mt.prototype.onStop=function(){var t=this.item,e=It(t).onStop;mt(e)&&e(t,this.element,this.direction),t._drag&&t._drag.sort()},Ot.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},Ot.prototype.addRequest=function(t){1&t.direction?(this.removeRequest(this.requestX),this.requestX=t):(this.removeRequest(this.requestY),this.requestY=t),t.action=this},Ot.prototype.removeRequest=function(t){t&&(this.requestX===t?(this.requestX=null,t.action=null):this.requestY===t&&(this.requestY=null,t.action=null))},Ot.prototype.computeScrollValues=function(){this.scrollLeft=this.requestX?this.requestX.value:Dt(this.element),this.scrollTop=this.requestY?this.requestY.value:Lt(this.element)},Ot.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 Nt={width:0,height:0,left:0,right:0,top:0,bottom:0},jt={width:0,height:0,left:0,right:0,top:0,bottom:0};function qt(){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 Ot}),(function(t){t.reset()})),this._readTick=this._readTick.bind(this),this._writeTick=this._writeTick.bind(this)}qt.AXIS_X=1,qt.AXIS_Y=2,qt.FORWARD=4,qt.BACKWARD=8,qt.LEFT=9,qt.RIGHT=5,qt.UP=10,qt.DOWN=6,qt.smoothSpeed=function(t,e,i){return function(n,s,o){var r=0;if(!o.isEnding)if(o.threshold>0){var a=o.threshold-Math.max(0,o.distance);r=t/o.threshold*a}else r=t;var l=o.speed,h=r;return l===r?h:l<r?(h=l+e*(o.deltaTime/1e3),Math.min(r,h)):(h=l-i*(o.deltaTime/1e3),Math.max(r,h))}},qt.pointerHandle=function(t){var e={left:0,top:0,width:0,height:0},i=t||1;return function(t,n,s,o,r,a,l){return e.left=a-.5*i,e.top=l-.5*i,e.width=i,e.height=i,e}},qt.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))},qt.prototype._writeTick=function(){this._isDestroyed||(this._applyActions(),pt(this._readTick,this._writeTick))},qt.prototype._startTicking=function(){this._isTicking=!0,pt(this._readTick,this._writeTick)},qt.prototype._stopTicking=function(){this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,at.remove(rt,nt),at.remove(2,st)},qt.prototype._getItemHandleRect=function(t,e,i){var n=t._drag;if(e){var s=n._dragMoveEvent||n._dragStartEvent,o=e(t,n._clientX,n._clientY,t._width,t._height,s.clientX,s.clientY);i.left=o.left,i.top=o.top,i.width=o.width,i.height=o.height}else i.left=n._clientX,i.top=n._clientY,i.width=t._width,i.height=t._height;return i.right=i.left+i.width,i.bottom=i.top+i.height,i},qt.prototype._requestItemScroll=function(t,e,i,n,s,o,r){var a=this._requests[e],l=a[t._id];l?l.element===i&&l.direction===n||l.reset():l=this._requestPool.pick(),l.item=t,l.element=i,l.direction=n,l.threshold=s,l.distance=o,l.maxValue=r,a[t._id]=l},qt.prototype._cancelItemScroll=function(t,e){var i=this._requests[e],n=i[t._id];n&&(n.action&&n.action.removeRequest(n),this._requestPool.release(n),delete i[t._id])},qt.prototype._checkItemOverlap=function(t,e,i){var n=It(t),s=mt(n.targets)?n.targets(t):n.targets,o=n.threshold,r=n.safeZone;if(!s||!s.length)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));var a=this._dragDirections[t._id],l=a[0],h=a[1];if(!l&&!h)return e&&this._cancelItemScroll(t,1),void(i&&this._cancelItemScroll(t,2));for(var d=this._getItemHandleRect(t,n.handle,Nt),c=jt,u=null,f=null,_=!0,p=!0,v=0,m=0,g=null,y=null,b=0,w=0,S=0,k=null,x=-1/0,E=0,D=0,L=null,T=0,C=0,A=null,I=-1/0,P=0,R=0,M=null,O=0,Y=0,X=0;X<s.length;X++)u=s[X],_=e&&l&&2!==u.axis,p=i&&h&&1!==u.axis,m=u.priority||0,(!_||m<x)&&(!p||m<I)||(f=Et(u.element||u),w=_?Tt(f):-1,S=p?Ct(f):-1,(w||S)&&((v=Xt(d,c=At(f,c)))<=0||(_&&m>=x&&w>0&&(m>x||v>D)&&(y=null,g=Rt("number"==typeof u.threshold?u.threshold:o,r,d.width,c.width),5===l?(b=c.right+g.offset-d.right)<=g.value&&Dt(f)<w&&(y=5):9===l&&(b=d.left-(c.left-g.offset))<=g.value&&Dt(f)>0&&(y=9),null!==y&&(k=f,x=m,E=g.value,D=v,L=y,T=b,C=w)),p&&m>=I&&S>0&&(m>I||v>R)&&(y=null,g=Rt("number"==typeof u.threshold?u.threshold:o,r,d.height,c.height),6===h?(b=c.bottom+g.offset-d.bottom)<=g.value&&Lt(f)<S&&(y=6):10===h&&(b=d.top-(c.top-g.offset))<=g.value&&Lt(f)>0&&(y=10),null!==y&&(A=f,I=m,P=g.value,R=v,M=y,O=b,Y=S)))));e&&(k?this._requestItemScroll(t,1,k,L,E,T,C):this._cancelItemScroll(t,1)),i&&(A?this._requestItemScroll(t,2,A,M,P,O,Y):this._cancelItemScroll(t,2))},qt.prototype._updateScrollRequest=function(t){for(var e=t.item,i=It(e),n=mt(i.targets)?i.targets(e):i.targets,s=n&&n.length||0,o=i.threshold,r=i.safeZone,a=this._getItemHandleRect(e,i.handle,Nt),l=jt,h=null,d=null,c=!1,u=null,f=null,_=null,p=null,v=null,m=0;m<s;m++)if((d=Et((h=n[m]).element||h))===t.element){if(c=!!(1&t.direction)){if(2===h.axis)continue}else if(1===h.axis)continue;if((p=c?Tt(d):Ct(d))<=0)break;if(Xt(a,l=At(d,l))<=0)break;if(u=Rt("number"==typeof h.threshold?h.threshold:o,r,c?a.width:a.height,c?l.width:l.height),(f=9===t.direction?a.left-(l.left-u.offset):5===t.direction?l.right+u.offset-a.right:10===t.direction?a.top-(l.top-u.offset):l.bottom+u.offset-a.bottom)>u.value)break;if(_=c?Dt(d):Lt(d),v=4&t.direction?_>=p:_<=0)break;return t.maxValue=p,t.threshold=u.value,t.distance=f,t.isEnding=!1,!0}return!0===i.smoothStop&&t.speed>0?(null===v&&(v=t.hasReachedEnd()),t.isEnding=!v):t.isEnding=!1,t.isEnding},qt.prototype._updateRequests=function(){for(var t,e,i,n,s,o,r,a=this._items,l=this._requests[1],h=this._requests[2],d=0;d<a.length;d++)t=a[d],s=(n=this._requestOverlapCheck[t._id])>0&&this._tickTime-n>this._overlapCheckInterval,o=!0,(e=l[t._id])&&e.isActive&&(o=!this._updateScrollRequest(e))&&(s=!0,this._cancelItemScroll(t,1)),r=!0,(i=h[t._id])&&i.isActive&&(r=!this._updateScrollRequest(i))&&(s=!0,this._cancelItemScroll(t,2)),s&&(this._requestOverlapCheck[t._id]=0,this._checkItemOverlap(t,o,r))},qt.prototype._requestAction=function(t,e){for(var i=this._actions,n=1===e,s=null,o=0;o<i.length;o++){if(s=i[o],t.element===s.element){if(n?s.requestX:s.requestY)return void this._cancelItemScroll(t.item,e);break}s=null}s||(s=this._actionPool.pick()),s.element=t.element,s.addRequest(t),t.tick(this._tickDeltaTime),i.push(s)},qt.prototype._updateActions=function(){var t,e,i,n,s=this._items,o=this._requests,r=this._actions;for(n=0;n<s.length;n++)t=s[n]._id,e=o[1][t],i=o[2][t],e&&this._requestAction(e,1),i&&this._requestAction(i,2);for(n=0;n<r.length;n++)r[n].computeScrollValues()},qt.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++)(n=i[t])._drag&&n._drag._prepareScroll();var n;for(t=0;t<i.length;t++)Pt(i[t])}},qt.prototype._updateDragDirection=function(t){var e=this._dragPositions[t._id],i=this._dragDirections[t._id],n=t._drag._left,s=t._drag._top;if(e.length){var o=e[0],r=e[1];i[0]=n>o?5:n<o?9:i[0]||0,i[1]=s>r?6:s<r?10:i[1]||0}e[0]=n,e[1]=s},qt.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())},qt.prototype.updateItem=function(t){this._isDestroyed||this._dragDirections[t._id]&&(this._updateDragDirection(t),this._requestOverlapCheck[t._id]||(this._requestOverlapCheck[t._id]=this._tickTime))},qt.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()}}},qt.prototype.isItemScrollingX=function(t){var e=this._requests[1][t._id];return!(!e||!e.isActive)},qt.prototype.isItemScrollingY=function(t){var e=this._requests[2][t._id];return!(!e||!e.isActive)},qt.prototype.isItemScrolling=function(t){return this.isItemScrollingX(t)||this.isItemScrollingY(t)},qt.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 Ht=window.Element.prototype,Gt=Ht.matches||Ht.matchesSelector||Ht.webkitMatchesSelector||Ht.mozMatchesSelector||Ht.msMatchesSelector||Ht.oMatchesSelector||function(){return!1};function zt(t,e){return Gt.call(t,e)}function Bt(t,e){e&&(t.classList?t.classList.add(e):zt(t,"."+e)||(t.className+=" "+e))}var Vt=[];function Wt(t,e,i){var n="number"==typeof i?i:-1;n<0&&(n=t.length-n+1),t.splice.apply(t,Vt.concat(n,0,e)),Vt.length=0}function Ft(t,e,i){var n=Math.max(0,t.length-1+(i||0));return e>n?n:e<0?Math.max(n+e+1,0):e}function Ut(t,e,i){if(!(t.length<2)){var n=Ft(t,e),s=Ft(t,i);n!==s&&t.splice(s,0,t.splice(n,1)[0])}}function Qt(t,e,i){if(!(t.length<2)){var n,s=Ft(t,e),o=Ft(t,i);s!==o&&(n=t[s],t[s]=t[o],t[o]=n)}}var Zt=L(document.documentElement.style,"transform")||"transform",Jt=/([A-Z])/g,$t=/^(webkit-|moz-|ms-|o-)/,Kt=/^(-m-s-)/;function te(t){var e=t.replace(Jt,"-$1").toLowerCase();return e=(e=e.replace($t,"-$1")).replace(Kt,"-ms-")}var ee=te(Zt),ie="none",ne="inline",se="none",oe="display";function re(t){var e=yt(t,ee);if(!e||e===ie)return!1;var i=yt(t,oe);return i!==ne&&i!==se}function ae(t){for(var e=document,i=t||e;i&&i!==e&&"static"===yt(i,"position")&&!re(i);)i=i.parentElement||e;return i}var le={},he={},de={};function ce(t,e){var i,n=e||{};return n.left=0,n.top=0,t===document?n:(n.left=window.pageXOffset||0,n.top=window.pageYOffset||0,t.self===window.self||(i=t.getBoundingClientRect(),n.left+=i.left,n.top+=i.top,n.left+=bt(t,"border-left-width"),n.top+=bt(t,"border-top-width")),n)}function ue(t,e,i){return de.left=0,de.top=0,t===e||i&&(t=ae(t))===(e=ae(e))||(ce(t,le),ce(e,he),de.left=he.left-le.left,de.top=he.top-le.top),de}function fe(t){return"auto"===t||"scroll"===t||"overlay"===t}function _e(t){return fe(yt(t,"overflow"))||fe(yt(t,"overflow-x"))||fe(yt(t,"overflow-y"))}function pe(t,e){for(e=e||[];t&&t!==document;)t.getRootNode&&t instanceof DocumentFragment?t=t.getRootNode().host:(_e(t)&&e.push(t),t=t.parentNode);return e.push(window),e}var ve={},me=/^matrix3d/,ge=/([^,]*,){4}/,ye=/([^,]*,){12}/,be=/[^,]*,/;function we(t){ve.x=0,ve.y=0;var e=yt(t,ee);if(!e||"none"===e)return ve;var i=me.test(e),n=e.replace(i?ye:ge,""),s=n.replace(be,"");return ve.x=parseFloat(n)||0,ve.y=parseFloat(s)||0,ve}function Se(t,e){e&&(t.classList?t.classList.remove(e):zt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim()))}var ke,xe,Ee,De,Le=/^(iPad|iPhone|iPod)/.test(window.navigator.platform)||/^Mac/.test(window.navigator.platform)&&window.navigator.maxTouchPoints>1,Te=0,Ce=!!T()&&{passive:!0};function Ae(t){var e=t._element,i=t.getGrid(),n=i._settings;this._item=t,this._gridId=i._id,this._isDestroyed=!1,this._isMigrating=!1,this._startPredicate=mt(n.dragStartPredicate)?n.dragStartPredicate:Ae.defaultStartPredicate,this._startPredicateState=Te,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=n.dragHandle&&e.querySelector(n.dragHandle)||e,this._dragger=new N(this._handle,n.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,n,s={};if(Array.isArray(e))for(n=0;n<e.length;n++)s[i=e[n]]=yt(t,te(i));else for(i in e)s[i]=yt(t,te(i));return s}Ae.autoScroller=new qt,Ae.defaultStartPredicate=function(t,e,i){var n=t._drag;if(e.isFirst&&e.srcEvent.button)return!1;if(!Le&&e.isFirst&&!0===e.srcEvent.isTrusted&&!1===e.srcEvent.defaultPrevented&&!1===e.srcEvent.cancelable)return!1;if(!e.isFinal){var s=n._startPredicateData;if(!s){var o=i||n._getGrid()._settings.dragStartPredicate||{};n._startPredicateData=s={distance:Math.max(o.distance,0)||0,delay:Math.max(o.delay,0)||0}}return s.delay&&(s.event=e,s.delayTimer||(s.delayTimer=window.setTimeout((function(){s.delay=0,n._resolveStartPredicate(s.event)&&(n._forceResolveStartPredicate(s.event),n._resetStartPredicate())}),s.delay))),n._resolveStartPredicate(e)}n._finishStartPredicate(e)},Ae.defaultSortPredicate=(ke={},xe={},Ee={},De=[],function(t,e){var i=t._drag,n=i._getGrid(),r=e&&"number"==typeof e.threshold?e.threshold:50,a=e&&e.action===s?s:o,l=e&&e.migrateAction===s?s:o;r=Math.min(Math.max(r,1),100),ke.width=t._width,ke.height=t._height,ke.left=i._clientX,ke.top=i._clientY;var h=function(t,e,i){var n,s,o,r,a,l,h,d,c,u,f=null,_=e._settings.dragSort,p=-1;if(!0===_?(De[0]=e,s=De):mt(_)&&(s=_.call(e,t)),!s||!Array.isArray(s)||!s.length)return f;for(u=0;u<s.length;u++)if(!(o=s[u])._isDestroyed){for(o._updateBoundingRect(),l=Math.max(0,o._left),h=Math.max(0,o._top),d=Math.min(window.innerWidth,o._right),c=Math.min(window.innerHeight,o._bottom),r=o._element.parentNode;r&&r!==document&&r!==document.documentElement&&r!==document.body;)if(r.getRootNode&&r instanceof DocumentFragment)r=r.getRootNode().host;else{if("visible"!==yt(r,"overflow")&&(a=r.getBoundingClientRect(),l=Math.max(l,a.left),h=Math.max(h,a.top),d=Math.min(d,a.right),c=Math.min(c,a.bottom)),"fixed"===yt(r,"position"))break;r=r.parentNode}l>=d||h>=c||(xe.left=l,xe.top=h,xe.width=d-l,xe.height=c-h,(n=Xt(ke,xe))>i&&n>p&&(p=n,f=o))}return De.length=0,f}(t,n,r);if(!h)return null;var d,c,u,f=t.getGrid()!==h,_=0,p=0,v=0,m=-1,g=!1;for(h===n?(ke.left=i._gridX+t._marginLeft,ke.top=i._gridY+t._marginTop):(h._updateBorders(1,0,1,0),_=h._left+h._borderLeft,p=h._top+h._borderTop),u=0;u<h._items.length;u++)(d=h._items[u])._isActive&&d!==t&&(g=!0,xe.width=d._width,xe.height=d._height,xe.left=d._left+d._marginLeft+_,xe.top=d._top+d._marginTop+p,(c=Xt(ke,xe))>v&&(m=u,v=c));return f&&v<r&&(m=g?m:0,v=r),v>=r?(Ee.grid=h,Ee.index=m,Ee.action=f?l:a,Ee):null}),Ae.prototype.stop=function(){if(this._isActive)if(this._isMigrating)this._finishMigration();else{var t=this._item,e=t._id;if(Ae.autoScroller.removeItem(t),dt(e),ct(e),ut(e),this._cancelSort(),this._isStarted){this._unbindScrollListeners();var i=t._element,n=this._getGrid(),s=n._settings.itemDraggingClass;i.parentNode!==n._element&&(n._element.appendChild(i),t._setTranslate(this._gridX,this._gridY),s&&i.clientWidth),Se(i,s)}this._reset()}},Ae.prototype.sort=function(t){var e=this._item;this._isActive&&e._isActive&&this._dragMoveEvent&&(!0===t?this._handleSort():ft(e._id,this._handleSort))},Ae.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._dragger.destroy(),Ae.autoScroller.removeItem(this._item),this._isDestroyed=!0)},Ae.prototype._getGrid=function(){return i[this._gridId]||null},Ae.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},Ae.prototype._bindScrollListeners=function(){var t,e,i=this._getGrid()._element,n=this._container,s=this._scrollers;if(s.length=0,pe(this._item._element.parentNode,s),n!==i)for(pe(i,t=[]),e=0;e<t.length;e++)s.indexOf(t[e])<0&&s.push(t[e]);for(e=0;e<s.length;e++)s[e].addEventListener("scroll",this._onScroll,Ce)},Ae.prototype._unbindScrollListeners=function(){var t,e=this._scrollers;for(t=0;t<e.length;t++)e[t].removeEventListener("scroll",this._onScroll,Ce);e.length=0},Ae.prototype._resolveStartPredicate=function(t){var e=this._startPredicateData;if(!(t.distance<e.distance||e.delay))return this._resetStartPredicate(),!0},Ae.prototype._forceResolveStartPredicate=function(t){this._isDestroyed||1!==this._startPredicateState||(this._startPredicateState=2,this._onStart(t))},Ae.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)},Ae.prototype._resetHeuristics=function(t,e){this._blockedSortIndex=null,this._sortX1=this._sortX2=t,this._sortY1=this._sortY2=e},Ae.prototype._checkHeuristics=function(t,e){var i=this._getGrid()._settings.dragSortHeuristics,n=i.minDragDistance;if(n<=0)return this._blockedSortIndex=null,!0;var s=t-this._sortX2,o=e-this._sortY2,r=n>3&&i.minBounceBackAngle>0;if(r||(this._blockedSortIndex=null),Math.abs(s)>n||Math.abs(o)>n){if(r){var a=Math.atan2(s,o),l=Math.atan2(this._sortX2-this._sortX1,this._sortY2-this._sortY1),h=Math.atan2(Math.sin(a-l),Math.cos(a-l));Math.abs(h)>i.minBounceBackAngle&&(this._blockedSortIndex=null)}return this._sortX1=this._sortX2,this._sortY1=this._sortY2,this._sortX2=t,this._sortY2=e,!0}return!1},Ae.prototype._resetStartPredicate=function(){var t=this._startPredicateData;t&&(t.delayTimer&&(t.delayTimer=window.clearTimeout(t.delayTimer)),this._startPredicateData=null)},Ae.prototype._handleSort=function(){if(this._isActive){var t=this._getGrid()._settings;if(!t.dragSort||!t.dragAutoScroll.sortDuringScroll&&Ae.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))}}},Ae.prototype._handleSortDelayed=function(){this._isSortNeeded=!0,this._sortTimer=void 0,ft(this._item._id,this._handleSort)},Ae.prototype._cancelSort=function(){var t;this._isSortNeeded=!1,void 0!==this._sortTimer&&(this._sortTimer=window.clearTimeout(this._sortTimer)),t=this._item._id,at.remove(1,K+t)},Ae.prototype._finishSort=function(){var t=this._getGrid()._settings.dragSort&&(this._isSortNeeded||void 0!==this._sortTimer);this._cancelSort(),t&&this._checkOverlap()},Ae.prototype._checkOverlap=function(){if(this._isActive){var t,e,i,n,r,a,l,h,d=this._item,c=this._getGrid()._settings;(t=mt(c.dragSortPredicate)?c.dragSortPredicate(d,this._dragMoveEvent):Ae.defaultSortPredicate(d,c.dragSortPredicate))&&"number"==typeof t.index&&(l=t.action===s?s:o,h=(e=d.getGrid())!==(n=t.grid||e),i=e._items.indexOf(d),r=Ft(n._items,t.index,h&&l===o?1:0),(h||r!==this._blockedSortIndex)&&(h?(this._blockedSortIndex=null,a=n._items[r],e._hasListeners(p)&&e._emit(p,{item:d,fromGrid:e,fromIndex:i,toGrid:n,toIndex:r}),n._hasListeners(m)&&n._emit(m,{item:d,fromGrid:e,fromIndex:i,toGrid:n,toIndex:r}),d._gridId=n._id,this._isMigrating=d._gridId!==this._gridId,e._items.splice(i,1),Wt(n._items,d,r),d._sortData=null,e._hasListeners(_)&&e._emit(_,{item:d,fromGrid:e,fromIndex:i,toGrid:n,toIndex:r}),n._hasListeners(v)&&n._emit(v,{item:d,fromGrid:e,fromIndex:i,toGrid:n,toIndex:r}),l===s&&a&&a.isActive()&&n._items.indexOf(a)>-1&&n.send(a,e,i,{appendTo:this._container||document.body,layoutSender:!1,layoutReceiver:!1}),e.layout(),n.layout()):i!==r&&(this._blockedSortIndex=i,(l===s?Qt:Ut)(e._items,i,r),e._hasListeners(f)&&e._emit(f,{item:d,fromIndex:i,toIndex:r,action:l}),e.layout())))}},Ae.prototype._finishMigration=function(){var t,e,i=this._item,n=i._dragRelease,s=i._element,o=i._isActive,r=i.getGrid(),a=r._element,l=r._settings,h=l.dragContainer||a,d=this._getGrid()._settings,c=s.parentNode,u=o?d.itemVisibleClass:d.itemHiddenClass,f=o?l.itemVisibleClass:l.itemHiddenClass;this._isMigrating=!1,this.destroy(),d.itemClass!==l.itemClass&&(Se(s,d.itemClass),Bt(s,l.itemClass)),u!==f&&(Se(s,u),Bt(s,f)),h!==c&&(h.appendChild(s),e=ue(c,h,!0),(t=we(s)).x-=e.left,t.y-=e.top),i._refreshDimensions(),e=ue(h,a,!0),n._containerDiffX=e.left,n._containerDiffY=e.top,i._drag=l.dragEnabled?new Ae(i):null,h!==c&&i._setTranslate(t.x,t.y),i._visibility.setStyles(o?l.visibleStyles:l.hiddenStyles),n.start()},Ae.prototype._preStartCheck=function(t){this._startPredicateState===Te&&(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=Te)):2===this._startPredicateState&&this._isActive&&this._onMove(t)},Ae.prototype._preEndCheck=function(t){var e=2===this._startPredicateState;this._startPredicate(this._item,t),this._startPredicateState=Te,e&&this._isActive&&(this._isStarted?this._onEnd(t):this.stop())},Ae.prototype._onStart=function(t){var e,i,n,s=this._item;s._isActive&&(this._isActive=!0,this._dragStartEvent=t,Ae.autoScroller.addItem(s),e=s._id,i=this._prepareStart,n=this._applyStart,at.add(rt,F+e,i),at.add(2,U+e,n))},Ae.prototype._prepareStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid(),n=i._settings,s=i._element,o=n.dragContainer||s,r=ae(o),a=we(e),l=e.getBoundingClientRect(),h=o!==s;if(this._container=o,this._containingBlock=r,this._clientX=l.left,this._clientY=l.top,this._left=this._gridX=a.x,this._top=this._gridY=a.y,this._scrollDiffX=this._scrollDiffY=0,this._moveDiffX=this._moveDiffY=0,this._resetHeuristics(this._gridX,this._gridY),h){var d=ue(r,s);this._containerDiffX=d.left,this._containerDiffY=d.top}}}},Ae.prototype._applyStart=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=this._getGrid(),i=t._element,n=t._dragRelease,s=t._migrate,o=this._container!==e._element;t.isPositioning()&&t._layout.stop(!0,this._left,this._top),s._isActive&&(this._left-=s._containerDiffX,this._top-=s._containerDiffY,this._gridX-=s._containerDiffX,this._gridY-=s._containerDiffY,s.stop(!0,this._left,this._top)),t.isReleasing()&&n._reset(),e._settings.dragPlaceholder.enabled&&t._dragPlaceholder.create(),this._isStarted=!0,e._emit("dragInit",t,this._dragStartEvent),o&&(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))),Bt(i,e._settings.itemDraggingClass),this._bindScrollListeners(),e._emit("dragStart",t,this._dragStartEvent)}}},Ae.prototype._onMove=function(t){var e,i,n,s=this._item;s._isActive?(this._dragMoveEvent=t,e=s._id,i=this._prepareMove,n=this._applyMove,at.add(rt,Q+e,i),at.add(2,Z+e,n),ft(s._id,this._handleSort)):this.stop()},Ae.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 n=e.clientX-i.clientX;this._left=this._left-this._moveDiffX+n,this._gridX=this._gridX-this._moveDiffX+n,this._clientX=this._clientX-this._moveDiffX+n,this._moveDiffX=n}if("x"!==t){var s=e.clientY-i.clientY;this._top=this._top-this._moveDiffY+s,this._gridY=this._gridY-this._moveDiffY+s,this._clientY=this._clientY-this._moveDiffY+s,this._moveDiffY=s}this._dragPrevMoveEvent=e}},Ae.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),Ae.autoScroller.updateItem(t))}},Ae.prototype._onScroll=function(t){var e,i,n,s=this._item;s._isActive?(this._scrollEvent=t,e=s._id,i=this._prepareScroll,n=this._applyScroll,at.add(rt,J+e,i),at.add(2,$+e,n),ft(s._id,this._handleSort)):this.stop()},Ae.prototype._prepareScroll=function(){if(this._isActive){var t=this._item;if(t._isActive){var e=t._element,i=this._getGrid()._element,n=e.getBoundingClientRect();if(this._container!==i){var s=ue(this._containingBlock,i);this._containerDiffX=s.left,this._containerDiffY=s.top}var o=this._clientX-this._moveDiffX-n.left;this._left=this._left-this._scrollDiffX+o,this._scrollDiffX=o;var r=this._clientY-this._moveDiffY-n.top;this._top=this._top-this._scrollDiffY+r,this._scrollDiffY=r,this._gridX=this._left-this._containerDiffX,this._gridY=this._top-this._containerDiffY}}},Ae.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))}},Ae.prototype._onEnd=function(t){var e=this._item,i=e._element,n=this._getGrid(),s=n._settings,o=e._dragRelease;e._isActive?(dt(e._id),ct(e._id),ut(e._id),this._finishSort(),this._unbindScrollListeners(),o._containerDiffX=this._containerDiffX,o._containerDiffY=this._containerDiffY,this._reset(),Se(i,s.itemDraggingClass),Ae.autoScroller.removeItem(e),n._emit("dragEnd",e,t),this._isMigrating?this._finishMigration():o.start()):this.stop()};var Pe=/^(webkit|moz|ms|o|Webkit|Moz|MS|O)(?=[A-Z])/,Re={};function Me(t){var e=Re[t];return e||((e=t.replace(Pe,""))!==t&&(e=e[0].toLowerCase()+e.slice(1)),Re[t]=e,e)}function Oe(t,e){for(var i in e)t.style[i]=e[i]}var Ye,Xe,Ne=!(!Element||!mt(Element.prototype.animate)),je=!!(Element&&(Ye=Element.prototype.animate,Xe=window.Symbol,Ye&&mt(Xe)&&mt(Xe.toString)&&Xe(Ye).toString().indexOf("[native code]")>-1));function qe(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 He(t,e){var i={};for(var n in t)i[e?n:Me(n)]=t[n];return i}function Ge(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function ze(t){this._item=t,this._animation=new qe,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 Be(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0}qe.prototype.start=function(t,e,i){if(!this._isDestroyed){var n=this._element,s=i||{};if(!Ne)return Oe(n,e),this._callback=mt(s.onFinish)?s.onFinish:null,void this._onFinish();var o,r,a,l=this._animation,h=this._props,d=this._values,c=s.duration||300,u=s.easing||"ease",f=!1;if(l&&(r=0,c===this._duration&&u===this._easing||(f=!0),!f)){for(o in e)if(++r,-1===(a=h.indexOf(o))||e[o]!==d[a]){f=!0;break}r!==h.length&&(f=!0)}if(f&&l.cancel(),this._callback=mt(s.onFinish)?s.onFinish:null,!l||f){for(o in h.length=d.length=0,e)h.push(o),d.push(e[o]);this._duration=c,this._easing=u,this._animation=n.animate([He(t,je),He(e,je)],{duration:c,easing:u}),this._animation.onfinish=this._onFinish,Oe(n,e)}}},qe.prototype.stop=function(){!this._isDestroyed&&this._animation&&(this._animation.cancel(),this._animation=this._callback=null,this._props.length=this._values.length=0)},qe.prototype.getCurrentStyles=function(){return Ie(element,currentProps)},qe.prototype.isAnimating=function(){return!!this._animation},qe.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._element=null,this._isDestroyed=!0)},qe.prototype._onFinish=function(){var t=this._callback;this._animation=this._callback=null,this._props.length=this._values.length=0,t&&t()},ze.prototype._updateDimensions=function(){this.isActive()&&Oe(this._element,{width:this._item._width+"px",height:this._item._height+"px"})},ze.prototype._onLayoutStart=function(t,e){var i=this._item;if(-1!==t.indexOf(i)){var n=i._left,s=i._top,o=this._left,r=this._top;if(this._left=n,this._top=s,e||this._didMigrate||o!==n||r!==s){var a,l,h,d=n+i._marginLeft,c=s+i._marginTop,u=i.getGrid();if(!(!e&&u._settings.layoutDuration>0)||this._didMigrate)return _t(i._id),this._element.style[Zt]=Ge(d,c),this._animation.stop(),void(this._didMigrate&&(u.getElement().appendChild(this._element),this._didMigrate=!1));this._nextTransX=d,this._nextTransY=c,a=i._id,l=this._setupAnimation,h=this._startAnimation,at.add(rt,tt+a,l),at.add(2,et+a,h)}}else this.reset()},ze.prototype._setupAnimation=function(){if(this.isActive()){var t=we(this._element);this._transX=t.x,this._transY=t.y}},ze.prototype._startAnimation=function(){if(this.isActive()){var t=this._animation,e=this._transX,i=this._transY,n=this._nextTransX,s=this._nextTransY;if(e!==n||i!==s){var o=this._item.getGrid()._settings,r={},a={};r[Zt]=Ge(e,i),a[Zt]=Ge(n,s),t.start(r,a,{duration:o.layoutDuration,easing:o.layoutEasing,onFinish:this._onLayoutEnd})}else t.isAnimating()&&(this._element.style[Zt]=Ge(n,s),t.stop())}},ze.prototype._onLayoutEnd=function(){this._resetAfterLayout&&this.reset()},ze.prototype._onReleaseEnd=function(t){if(t._id===this._item._id){if(!this._animation.isAnimating())return void this.reset();this._resetAfterLayout=!0}},ze.prototype._onMigrate=function(t){if(t.item===this._item){var e=this._item.getGrid(),i=t.toGrid;e.off(g,this._onReleaseEnd),e.off(r,this._onLayoutStart),e.off(p,this._onMigrate),e.off(d,this._onHide),i.on(g,this._onReleaseEnd),i.on(r,this._onLayoutStart),i.on(p,this._onMigrate),i.on(d,this._onHide),this._didMigrate=!0}},ze.prototype._onHide=function(t){t.indexOf(this._item)>-1&&this.reset()},ze.prototype.create=function(){if(this.isActive())this._resetAfterLayout=!1;else{var t,e=this._item,i=e.getGrid(),n=i._settings,s=this._animation;this._left=e._left,this._top=e._top,t=mt(n.dragPlaceholder.createElement)?n.dragPlaceholder.createElement(e):document.createElement("div"),this._element=t,s._element=t,this._className=n.itemPlaceholderClass||"",this._className&&Bt(t,this._className),Oe(t,{position:"absolute",left:"0px",top:"0px",width:e._width+"px",height:e._height+"px"}),t.style[Zt]=Ge(e._left+e._marginLeft,e._top+e._marginTop),i.on(r,this._onLayoutStart),i.on(g,this._onReleaseEnd),i.on(p,this._onMigrate),i.on(d,this._onHide),mt(n.dragPlaceholder.onCreate)&&n.dragPlaceholder.onCreate(e,t),i.getElement().appendChild(t)}},ze.prototype.reset=function(){if(this.isActive()){var t,e=this._element,i=this._item,n=i.getGrid(),s=n._settings,o=this._animation;this._resetAfterLayout=!1,_t(i._id),t=i._id,at.remove(2,it+t),o.stop(),o._element=null,n.off(g,this._onReleaseEnd),n.off(r,this._onLayoutStart),n.off(p,this._onMigrate),n.off(d,this._onHide),this._className&&(Se(e,this._className),this._className=""),e.parentNode.removeChild(e),this._element=null,mt(s.dragPlaceholder.onRemove)&&s.dragPlaceholder.onRemove(i,e)}},ze.prototype.isActive=function(){return!!this._element},ze.prototype.getElement=function(){return this._element},ze.prototype.updateDimensions=function(){var t,e;this.isActive()&&(t=this._item._id,e=this._updateDimensions,at.add(2,it+t,e))},ze.prototype.destroy=function(){this.reset(),this._animation.destroy(),this._item=this._animation=null},Be.prototype.start=function(){if(!this._isDestroyed&&!this._isActive){var t=this._item,e=t.getGrid(),i=e._settings;this._isActive=!0,Bt(t._element,i.itemReleasingClass),i.dragRelease.useDragContainer||this._placeToGrid(),e._emit("dragReleaseStart",t),e._nextLayoutData||t._layout.start(!1)}},Be.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var n=this._item,s=n.getGrid();t||void 0!==e&&void 0!==i||(e=n._left,i=n._top);var o=this._placeToGrid(e,i);this._reset(o),t||s._emit(g,n)}},Be.prototype.isJustReleased=function(){return this._isActive&&!1===this._isPositioningStarted},Be.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Be.prototype._placeToGrid=function(t,e){if(!this._isDestroyed){var i=this._item,n=i._element,s=i.getGrid()._element,o=!1;if(n.parentNode!==s){if(void 0===t||void 0===e){var r=we(n);t=r.x-this._containerDiffX,e=r.y-this._containerDiffY}s.appendChild(n),i._setTranslate(t,e),o=!0}return this._containerDiffX=0,this._containerDiffY=0,o}},Be.prototype._reset=function(t){if(!this._isDestroyed){var e=this._item,i=e.getGrid()._settings.itemReleasingClass;this._isActive=!1,this._isPositioningStarted=!1,this._containerDiffX=0,this._containerDiffY=0,i&&(t&&e._element.clientWidth,Se(e._element,i))}};function Ve(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 qe(e),this._queue="layout-"+t._id,this._setupAnimation=this._setupAnimation.bind(this),this._startAnimation=this._startAnimation.bind(this)}function We(t){this._item=t,this._isActive=!1,this._isDestroyed=!1,this._container=!1,this._containerDiffX=0,this._containerDiffY=0}function Fe(t){var e=t._isActive,i=t._element,n=i.children[0],s=t.getGrid()._settings;if(!n)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=n,this._currentStyleProps=[],this._animation=new qe(n),this._queue="visibility-"+t._id,this._finishShow=this._finishShow.bind(this),this._finishHide=this._finishHide.bind(this),i.style.display=e?"":"none",Bt(i,e?s.itemVisibleClass:s.itemHiddenClass),this.setStyles(e?s.visibleStyles:s.hiddenStyles)}Ve.prototype.start=function(t,e){if(!this._isDestroyed){var i,n,s,o=this._item,r=o._dragRelease,a=o.getGrid()._settings,l=this._isActive,h=r.isJustReleased(),d=h?a.dragRelease.duration:a.layoutDuration,c=h?a.dragRelease.easing:a.layoutEasing,u=!t&&!this._skipNextAnimation&&d>0;if(l&&(lt(o._id),o._emitter.burst(this._queue,!0,o)),h&&(r._isPositioningStarted=!0),mt(e)&&o._emitter.on(this._queue,e),this._skipNextAnimation=!1,!u)return this._updateOffsets(),o._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=c,this._animOptions.duration=d,this._isInterrupted=l,i=o._id,n=this._setupAnimation,s=this._startAnimation,at.add(rt,z+i,n),at.add(2,B+i,s)}},Ve.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var n=this._item;if(lt(n._id),this._animation.isAnimating()){if(void 0===e||void 0===i){var s=we(n._element);e=s.x,i=s.y}n._setTranslate(e,i),this._animation.stop()}Se(n._element,n.getGrid()._settings.itemPositioningClass),this._isActive=!1,t&&n._emitter.burst(this._queue,!0,n)}},Ve.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}},Ve.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}},Ve.prototype._finish=function(){if(!this._isDestroyed){var t=this._item,e=t._migrate,i=t._dragRelease;t._tX=this._nextLeft,t._tY=this._nextTop,this._isActive&&(this._isActive=!1,Se(t._element,t.getGrid()._settings.itemPositioningClass)),i._isActive&&i.stop(),e._isActive&&e.stop(),t._emitter.burst(this._queue,!1,t)}},Ve.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}},Ve.prototype._startAnimation=function(){var t=this._item,e=t.getGrid()._settings,i=this._animOptions.duration<=0;this._updateOffsets();var n=Math.abs(t._left-(t._tX-this._offsetLeft)),s=Math.abs(t._top-(t._tY-this._offsetTop));if(i||n<2&&s<2)return(n||s||this._isInterrupted)&&t._setTranslate(this._nextLeft,this._nextTop),this._animation.stop(),void this._finish();this._isInterrupted||Bt(t._element,e.itemPositioningClass),this._currentStyles[Zt]=Ge(t._tX,t._tY),this._targetStyles[Zt]=Ge(this._nextLeft,this._nextTop),t._tX=t._tY=void 0,this._animation.start(this._currentStyles,this._targetStyles,this._animOptions)},We.prototype.start=function(t,e,i){if(!this._isDestroyed){var n,s,o,r,a,l,h,d,c,u,f=this._item,g=f._element,y=f.isActive(),b=f.isVisible(),w=f.getGrid(),S=w._settings,k=t._settings,x=t._element,E=t._items,D=w._items.indexOf(f),L=i||document.body;if("number"==typeof e)n=Ft(E,e,1);else{if(!(s=t.getItem(e)))return;n=E.indexOf(s)}(f.isPositioning()||this._isActive||f.isReleasing())&&(h=(l=we(g)).x,d=l.y),f.isPositioning()&&f._layout.stop(!0,h,d),this._isActive&&(h-=this._containerDiffX,d-=this._containerDiffY,this.stop(!0,h,d)),f.isReleasing()&&(h-=f._dragRelease._containerDiffX,d-=f._dragRelease._containerDiffY,f._dragRelease.stop(!0,h,d)),f._visibility.stop(!0),f._drag&&f._drag.destroy(),w._hasListeners(p)&&w._emit(p,{item:f,fromGrid:w,fromIndex:D,toGrid:t,toIndex:n}),t._hasListeners(m)&&t._emit(m,{item:f,fromGrid:w,fromIndex:D,toGrid:t,toIndex:n}),S.itemClass!==k.itemClass&&(Se(g,S.itemClass),Bt(g,k.itemClass)),(c=b?S.itemVisibleClass:S.itemHiddenClass)!==(u=b?k.itemVisibleClass:k.itemHiddenClass)&&(Se(g,c),Bt(g,u)),w._items.splice(D,1),Wt(E,f,n),f._gridId=t._id,y?L!==(o=g.parentNode)&&(L.appendChild(g),r=ue(L,o,!0),l||(h=(l=we(g)).x,d=l.y),f._setTranslate(h+r.left,d+r.top)):x.appendChild(g),f._visibility.setStyles(b?k.visibleStyles:k.hiddenStyles),y&&(a=ue(L,x,!0)),f._refreshDimensions(),f._sortData=null,f._drag=k.dragEnabled?new Ae(f):null,y?(this._isActive=!0,this._container=L,this._containerDiffX=a.left,this._containerDiffY=a.top):(this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0),w._hasListeners(_)&&w._emit(_,{item:f,fromGrid:w,fromIndex:D,toGrid:t,toIndex:n}),t._hasListeners(v)&&t._emit(v,{item:f,fromGrid:w,fromIndex:D,toGrid:t,toIndex:n})}},We.prototype.stop=function(t,e,i){if(!this._isDestroyed&&this._isActive){var n,s=this._item,o=s._element,r=s.getGrid()._element;this._container!==r&&(void 0!==e&&void 0!==i||(t?(e=(n=we(o)).x-this._containerDiffX,i=n.y-this._containerDiffY):(e=s._left,i=s._top)),r.appendChild(o),s._setTranslate(e,i)),this._isActive=!1,this._container=null,this._containerDiffX=0,this._containerDiffY=0}},We.prototype.destroy=function(){this._isDestroyed||(this.stop(!0),this._item=null,this._isDestroyed=!0)},Fe.prototype.show=function(t,e){if(!this._isDestroyed){var i=this._item,n=i._element,s=mt(e)?e:null,o=i.getGrid()._settings;this._isShowing||this._isHidden?!this._isShowing||t?(this._isShowing||(i._emitter.burst(this._queue,!0,i),Se(n,o.itemHiddenClass),Bt(n,o.itemVisibleClass),this._isHiding||(n.style.display="")),s&&i._emitter.on(this._queue,s),this._isShowing=!0,this._isHiding=this._isHidden=!1,this._startAnimation(!0,t,this._finishShow)):s&&i._emitter.on(this._queue,s):s&&s(!1,i)}},Fe.prototype.hide=function(t,e){if(!this._isDestroyed){var i=this._item,n=i._element,s=mt(e)?e:null,o=i.getGrid()._settings;this._isHiding||!this._isHidden?!this._isHiding||t?(this._isHiding||(i._emitter.burst(this._queue,!0,i),Bt(n,o.itemHiddenClass),Se(n,o.itemVisibleClass)),s&&i._emitter.on(this._queue,s),this._isHidden=this._isHiding=!0,this._isShowing=!1,this._startAnimation(!1,t,this._finishHide)):s&&i._emitter.on(this._queue,s):s&&s(!1,i)}},Fe.prototype.stop=function(t){if(!this._isDestroyed&&(this._isHiding||this._isShowing)){var e=this._item;ht(e._id),this._animation.stop(),t&&e._emitter.burst(this._queue,!0,e)}},Fe.prototype.setStyles=function(t){var e=this._childElement,i=this._currentStyleProps;for(var n in this._removeCurrentStyles(),t)i.push(n),e.style[n]=t[n]},Fe.prototype.destroy=function(){if(!this._isDestroyed){var t=this._item,e=t._element,i=t.getGrid()._settings;this.stop(!0),t._emitter.clear(this._queue),this._animation.destroy(),this._removeCurrentStyles(),Se(e,i.itemVisibleClass),Se(e,i.itemHiddenClass),e.style.display="",this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0}},Fe.prototype._startAnimation=function(t,e,i){if(!this._isDestroyed){var n,s=this._item,o=this._animation,r=this._childElement,a=s.getGrid()._settings,l=t?a.visibleStyles:a.hiddenStyles,h=t?a.showDuration:a.hideDuration,d=t?a.showEasing:a.hideEasing,c=e||h<=0;if(l){if(ht(s._id),c)return Oe(r,l),o.stop(),void(i&&i());var u,f,_;o.isAnimating()&&(o._animation.onfinish=null),u=s._id,f=function(){n=Ie(r,l)},_=function(){o.start(n,l,{duration:h,easing:d,onFinish:i})},at.add(rt,V+u,f),at.add(2,W+u,_)}else i&&i()}},Fe.prototype._finishShow=function(){this._isHidden||(this._isShowing=!1,this._item._emitter.burst(this._queue,!1,this._item))},Fe.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)}},Fe.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 Ue=0;function Qe(){return++Ue}function Ze(t,e,i){var s=t._settings;if(n){if(n.has(e))throw new Error("You can only create one Muuri Item per element!");n.set(e,this)}this._id=Qe(),this._gridId=t._id,this._element=e,this._isDestroyed=!1,this._left=0,this._top=0,this._width=0,this._height=0,this._marginLeft=0,this._marginRight=0,this._marginTop=0,this._marginBottom=0,this._tX=void 0,this._tY=void 0,this._sortData=null,this._emitter=new S,e.parentNode!==t._element&&t._element.appendChild(e),Bt(e,s.itemClass),"boolean"!=typeof i&&(i="none"!==yt(e,"display")),this._isActive=i,this._visibility=new Fe(this),this._layout=new Ve(this),this._migrate=new We(this),this._drag=s.dragEnabled?new Ae(this):null,this._dragRelease=new Be(this),this._dragPlaceholder=new ze(this)}function Je(t){var e,i,n,s,o,r=.001,a=.5;function l(t){return((1e3*t+.5|0)/10|0)/100}function h(){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(h.prototype.computeLayout=function(t,e){var i,n,s,o,r,a,h=t.items,d=t.slots,c=!!(1&e),u=!!(2&e),f=!!(4&e),_=!!(8&e),p=!!(16&e),v="number"==typeof h[0];if(!h.length)return t;for(n=v?2:1,i=0;i<h.length;i+=n)v?(o=h[i],r=h[i+1]):(o=(s=h[i])._width+s._marginLeft+s._marginRight,r=s._height+s._marginTop+s._marginBottom),p&&(o=l(o),r=l(r)),a=this.computeNextSlot(t,o,r,c,u),u?a.left+a.width>t.width&&(t.width=a.left+a.width):a.top+a.height>t.height&&(t.height=a.top+a.height),d[++this.slotIndex]=a.left,d[++this.slotIndex]=a.top,(f||_)&&this.slotSizes.push(a.width,a.height);if(f)for(i=0;i<d.length;i+=2)d[i]=t.width-(d[i]+this.slotSizes[i]);if(_)for(i=1;i<d.length;i+=2)d[i]=t.height-(d[i]+this.slotSizes[i]);return this.slotSizes.length=0,this.currentRects.length=0,this.nextRects.length=0,this.rectStore.length=0,this.rectId=0,this.slotIndex=-1,t},h.prototype.computeNextSlot=function(t,e,i,n,s){var o,l,h,d,c,u=this.slotData,f=this.currentRects,_=this.nextRects,p=!1;for(_.length=0,u.left=null,u.top=null,u.width=e,u.height=i,d=0;d<f.length;d++)if((l=f[d])&&(o=this.getRect(l),u.width<=o.width+r&&u.height<=o.height+r)){u.left=o.left,u.top=o.top;break}if(null===u.left&&(s?(u.left=t.width,u.top=0):(u.left=0,u.top=t.height),n||(p=!0)),!s&&u.top+u.height>t.height+r&&(u.left>a&&_.push(this.addRect(0,t.height,u.left,1/0)),u.left+u.width<t.width-a&&_.push(this.addRect(u.left+u.width,t.height,t.width-u.left-u.width,1/0)),t.height=u.top+u.height),s&&u.left+u.width>t.width+r&&(u.top>a&&_.push(this.addRect(t.width,0,1/0,u.top)),u.top+u.height<t.height-a&&_.push(this.addRect(t.width,u.top+u.height,1/0,t.height-u.top-u.height)),t.width=u.left+u.width),!p)for(n&&(d=0);d<f.length;d++)if(l=f[d])for(o=this.getRect(l),h=this.splitRect(o,u),c=0;c<h.length;c++)l=h[c],o=this.getRect(l),(s?o.left+r<t.width-r:o.top+r<t.height-r)&&_.push(l);return _.length>1&&this.purgeRects(_).sort(s?this.sortRectsLeftTop:this.sortRectsTopLeft),this.currentRects=_,this.nextRects=f,u},h.prototype.addRect=function(t,e,i,n){var s=++this.rectId;return this.rectStore[s]=t||0,this.rectStore[++this.rectId]=e||0,this.rectStore[++this.rectId]=i||0,this.rectStore[++this.rectId]=n||0,s},h.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},h.prototype.splitRect=(e=[],i=0,n=0,function(t,s){return e.length=0,t.left+t.width<=s.left+r||s.left+s.width<=t.left+r||t.top+t.height<=s.top+r||s.top+s.height<=t.top+r?(e.push(this.addRect(t.left,t.top,t.width,t.height)),e):((i=s.left-t.left)>=a&&e.push(this.addRect(t.left,t.top,i,t.height)),(i=t.left+t.width-(s.left+s.width))>=a&&e.push(this.addRect(s.left+s.width,t.top,i,t.height)),(n=s.top-t.top)>=a&&e.push(this.addRect(t.left,t.top,t.width,n)),(n=t.top+t.height-(s.top+s.height))>=a&&e.push(this.addRect(t.left,s.top+s.height,t.width,n)),e)}),h.prototype.isRectAWithinRectB=function(t,e){return t.left+r>=e.left&&t.top+r>=e.top&&t.left+t.width-r<=e.left+e.width&&t.top+t.height-r<=e.top+e.height},h.prototype.purgeRects=(s={},o={},function(t){for(var e,i=t.length;i--;)if(e=t.length,t[i])for(this.getRect(t[i],s);e--;)if(t[e]&&i!==e&&(this.getRect(t[e],o),this.isRectAWithinRectB(s,o))){t[i]=0;break}return t}),h.prototype.sortRectsTopLeft=function(){var t={},e={};return function(i,n){return this.getRect(i,t),this.getRect(n,e),t.top<e.top&&t.top+r<e.top?-1:t.top>e.top&&t.top-r>e.top?1:t.left<e.left&&t.left+r<e.left?-1:t.left>e.left&&t.left-r>e.left?1:0}}(),h.prototype.sortRectsLeftTop=function(){var t={},e={};return function(i,n){return this.getRect(i,t),this.getRect(n,e),t.left<e.left&&t.left+r<e.left?-1:t.left>e.left&&t.left-r<e.left?1:t.top<e.top&&t.top+r<e.top?-1:t.top>e.top&&t.top-r>e.top?1:0}}(),t){var d=new h;self.onmessage=function(t){var e=new Float32Array(t.data),i=e.subarray(4,e.length),n=new Float32Array(i.length),s=e[3],o={items:i,slots:n,width:e[1],height:e[2]};d.computeLayout(o,s),e[1]=o.width,e[2]=o.height,e.set(o.slots,4),postMessage(e.buffer,[e.buffer])}}return h}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,n=e.getBoundingClientRect();this._width=n.width,this._height=n.height,this._marginLeft=Math.max(0,bt(e,"margin-left")),this._marginRight=Math.max(0,bt(e,"margin-right")),this._marginTop=Math.max(0,bt(e,"margin-top")),this._marginBottom=Math.max(0,bt(e,"margin-bottom")),i&&i.updateDimensions()}},Ze.prototype._refreshSortData=function(){if(!this._isDestroyed){var t,e=this._sortData={},i=this.getGrid()._settings.sortData;for(t in i)e[t]=i[t](this,this._element)}},Ze.prototype._addToLayout=function(t,e){!0!==this._isActive&&(this._isActive=!0,this._left=t||0,this._top=e||0)},Ze.prototype._removeFromLayout=function(){!1!==this._isActive&&(this._isActive=!1,this._left=0,this._top=0)},Ze.prototype._canSkipLayout=function(t,e){return this._left===t&&this._top===e&&!this._migrate._isActive&&!this._layout._skipNextAnimation&&!this._dragRelease.isJustReleased()},Ze.prototype._setTranslate=function(t,e){return(this._tX!==t||this._tY!==e)&&(this._tX=t,this._tY=e,this._element.style[Zt]=Ge(t,e),!0)},Ze.prototype._destroy=function(t){if(!this._isDestroyed){var e=this._element,i=this.getGrid()._settings;this._dragPlaceholder.destroy(),this._dragRelease.destroy(),this._migrate.destroy(),this._layout.destroy(),this._visibility.destroy(),this._drag&&this._drag.destroy(),this._emitter.destroy(),Se(e,i.itemClass),t&&e.parentNode.removeChild(e),n&&n.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 n,s=0;s<t;s++)n=new Worker(Ke),e&&(n.onmessage=e),i.push(n),ti.push(n)}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],n=this._layouts[i],s=this._layoutCallbacks[i],o=this._layoutWorkers[i];n&&delete this._layouts[i],s&&delete this._layoutCallbacks[i],o&&delete this._layoutWorkers[i],n&&s&&(n.width=e[1],n.height=e[2],n.slots=e.subarray(4,e.length),this._finalizeLayout(n),s(n)),o&&(this._workers.push(o),this._sendToWorker())},ei.prototype._finalizeLayout=function(t){var e=t._grid,i=2&t._settings,n="border-box"===e._boxSizing;return delete t._grid,delete t._settings,t.styles={},i?t.styles.width=(n?t.width+e._borderLeft+e._borderRight:t.width)+"px":t.styles.height=(n?t.height+e._borderTop+e._borderBottom:t.height)+"px",t},ei.prototype.setOptions=function(t){var e,i,n,s,o;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,n="boolean"==typeof t.alignRight?t.alignRight?4:0:4&this._options,s="boolean"==typeof t.alignBottom?t.alignBottom?8:0:8&this._options,o="boolean"==typeof t.rounding?t.rounding?16:0:16&this._options,this._options=e|i|n|s|o)},ei.prototype.createLayout=function(t,e,i,n,s,o){if(this._layouts[e])throw new Error("A layout with the provided id is currently being processed.");var r=2&this._options,a={id:e,items:i,slots:null,width:r?0:n,height:r?s:0,_grid:t,_settings:this._options};if(!i.length)return a.slots=[],this._finalizeLayout(a),void o(a);if(this._processor)return a.slots=window.Float32Array?new Float32Array(2*i.length):new Array(2*i.length),this._processor.computeLayout(a,a._settings),this._finalizeLayout(a),void o(a);var l,h,d,c=new Float32Array(4+2*i.length);for(c[0]=e,c[1]=a.width,c[2]=a.height,c[3]=a._settings,l=0,h=3;l<i.length;l++)d=i[l],c[++h]=d._width+d._marginLeft+d._marginRight,c[++h]=d._height+d._marginTop+d._marginBottom;return this._layoutQueue.push(e),this._layouts[e]=a,this._layoutCallbacks[e]=o,this._layoutWorkerData[e]=c,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,n=0;n<t.length;n++)(e=t[n]).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 ni(t,e){var i=++ii,n=0,s=0,o=!1,r=function(e){o||(s&&(n-=e-s),s=e,n>0?function(t,e){at.add(rt,ot+t,e)}(i,r):(n=s=0,t()))};return function(a){if(!o){if(!(e<=0))return!0===a?(o=!0,n=s=0,r=void 0,void function(t){at.remove(rt,ot+t)}(i)):void(n<=0?(n=e,r(0)):n=e);!0!==a&&t()}}}var si="[object HTMLCollection]",oi="[object NodeList]";function ri(t){var e=Object.prototype.toString.call(t);return e===si||e===oi}var ai="object",li="[object Object]",hi=Object.prototype.toString;function di(t){return typeof t===ai&&hi.call(t)===li}function ci(){}var ui,fi="number",_i="string",pi="instant",vi=0;function mi(t,e){if(typeof t===_i&&(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 n=function(t,e){var i=gi({},t);e&&(i=gi(i,e));e&&e.visibleStyles?i.visibleStyles=e.visibleStyles:t&&t.visibleStyles&&(i.visibleStyles=t.visibleStyles);e&&e.hiddenStyles?i.hiddenStyles=e.hiddenStyles:t&&t.hiddenStyles&&(i.hiddenStyles=t.hiddenStyles);return i}(mi.defaultOptions,e);n.visibleStyles=yi(n.visibleStyles),n.hiddenStyles=yi(n.hiddenStyles),mt(n.dragSort)||(n.dragSort=!!n.dragSort),this._id=Qe(),this._element=t,this._settings=n,this._isDestroyed=!1,this._items=[],this._layout={id:0,items:[],slots:[]},this._isLayoutFinished=!0,this._nextLayoutData=null,this._emitter=new S,this._onLayoutDataReceived=this._onLayoutDataReceived.bind(this),i[this._id]=this,Bt(t,n.containerClass),function(t,e){typeof e!==fi&&(e=!0===e?0:-1);e>=0&&(t._resizeHandler=ni((function(){t.refreshItems().layout()}),e),window.addEventListener("resize",t._resizeHandler))}(this,n.layoutOnResize),this.add(function(t,e){if("*"===e)return t.children;if(typeof e===_i){for(var i=[],n=t.children,s=0;s<n.length;s++)zt(n[s],e)&&i.push(n[s]);return i}if(Array.isArray(e)||ri(e))return e;return[]}(t,n.items),{layout:!1}),n.layoutOnInit&&this.layout(!0)}function gi(t,e){var i,n,s,o=Object.keys(e),r=o.length;for(s=0;s<r;s++)i=di(e[n=o[s]]),di(t[n])&&i?t[n]=gi(gi({},t[n]),e[n]):i?t[n]=gi({},e[n]):Array.isArray(e[n])?t[n]=e[n].slice(0):t[n]=e[n];return t}function yi(t){var e,i,n={},s=document.documentElement.style;for(e in t)t[e]&&(i=L(s,e))&&(n[i]=t[e]);return n}function bi(t){for(var e={},i=0;i<t.length;i++)e[t[i]._id]=i;return e}function wi(t,e,i){return t[e._id]-t[i._id]}mi.Item=Ze,mi.ItemLayout=Ve,mi.ItemVisibility=Fe,mi.ItemMigrate=We,mi.ItemDrag=Ae,mi.ItemDragRelease=Be,mi.ItemDragPlaceholder=ze,mi.Emitter=S,mi.Animator=qe,mi.Dragger=N,mi.Packer=ei,mi.AutoScroller=qt,mi.defaultPacker=new ei(2),mi.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:o,migrateAction:o},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:qt.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"},mi.prototype.on=function(t,e){return this._emitter.on(t,e),this},mi.prototype.off=function(t,e){return this._emitter.off(t,e),this},mi.prototype.getElement=function(){return this._element},mi.prototype.getItem=function(t){if(this._isDestroyed||!t&&0!==t)return null;if(typeof t===fi)return this._items[t>-1?t:this._items.length+t]||null;if(t instanceof Ze)return t._gridId===this._id?t:null;if(n){var e=n.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},mi.prototype.getItems=function(t){if(this._isDestroyed||void 0===t)return this._items.slice(0);var e,i,n=[];if(Array.isArray(t)||ri(t))for(e=0;e<t.length;e++)(i=this.getItem(t[e]))&&n.push(i);else(i=this.getItem(t))&&n.push(i);return n},mi.prototype.refreshItems=function(t,e){if(this._isDestroyed)return this;var i,n,s,o,r=t||this._items;if(!0===e)for(o=[],i=0;i<r.length;i++)(n=r[i]).isVisible()||n.isHiding()||((s=n.getElement().style).visibility="hidden",s.display="",o.push(s));for(i=0;i<r.length;i++)r[i]._refreshDimensions(e);if(!0===e){for(i=0;i<o.length;i++)(s=o[i]).visibility="",s.display="none";o.length=0}return this},mi.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},mi.prototype.synchronize=function(){if(this._isDestroyed)return this;var t,e,i=this._items;if(!i.length)return this;for(var n=0;n<i.length;n++)(e=i[n]._element).parentNode===this._element&&(t=t||document.createDocumentFragment()).appendChild(e);return t?(this._element.appendChild(t),this._emit("synchronize"),this):this},mi.prototype.layout=function(t,e){if(this._isDestroyed)return this;var i=this._nextLayoutData;i&&mt(i.cancel)&&i.cancel();var n=vi=vi%16777216+1;this._nextLayoutData={id:n,instant:t,onFinish:e,cancel:null};for(var s=this._items,o=[],r=0;r<s.length;r++)s[r]._isActive&&o.push(s[r]);this._refreshDimensions();var a,l=this._width-this._borderLeft-this._borderRight,h=this._height-this._borderTop-this._borderBottom,d=this._settings.layout;return mt(d)?a=d(this,n,o,l,h,this._onLayoutDataReceived):(mi.defaultPacker.setOptions(d),a=mi.defaultPacker.createLayout(this,n,o,l,h,this._onLayoutDataReceived)),mt(a)&&this._nextLayoutData&&this._nextLayoutData.id===n&&(this._nextLayoutData.cancel=a),this},mi.prototype.add=function(t,e){if(this._isDestroyed||!t)return[];var i,n=ri(i=t)?Array.prototype.slice.call(i):Array.prototype.concat(i);if(!n.length)return n;var s,o,r,a,l=e||{},h=l.layout?l.layout:void 0===l.layout,d=this._items,c=!1;for(a=0;a<n.length;a++)(o=n[a]).parentNode!==this._element&&(s=s||document.createDocumentFragment()).appendChild(o);for(s&&this._element.appendChild(s),a=0;a<n.length;a++)o=n[a],(r=n[a]=new Ze(this,o,l.active))._isActive&&(c=!0,r._layout._skipNextAnimation=!0);for(a=0;a<n.length;a++)(r=n[a])._refreshDimensions(),r._refreshSortData();return Wt(d,n,l.index),this._hasListeners("add")&&this._emit("add",n.slice(0)),c&&h&&this.layout(h===pi,mt(h)?h:void 0),n},mi.prototype.remove=function(t,e){if(this._isDestroyed||!t.length)return[];var i,n,s,o=e||{},r=o.layout?o.layout:void 0===o.layout,a=!1,l=this.getItems(),d=[],c=[];for(s=0;s<t.length;s++)(n=t[s])._isDestroyed||-1!==(i=this._items.indexOf(n))&&(n._isActive&&(a=!0),d.push(n),c.push(l.indexOf(n)),n._destroy(o.removeElements),this._items.splice(i,1));return this._hasListeners(h)&&this._emit(h,d.slice(0),c),a&&r&&this.layout(r===pi,mt(r)?r:void 0),d},mi.prototype.show=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!0,e),this},mi.prototype.hide=function(t,e){return!this._isDestroyed&&t.length&&this._setItemsVisibility(t,!1,e),this},mi.prototype.filter=function(t,e){if(this._isDestroyed||!this._items.length)return this;var i,n,s=[],o=[],r=typeof t===_i,a=mt(t),l=e||{},h=!0===l.instant,d=l.syncWithLayout,u=l.layout?l.layout:void 0===l.layout,f=mt(l.onFinish)?l.onFinish:null,_=-1,p=ci;if(f&&(p=function(){++_&&f(s.slice(0),o.slice(0))}),a||r)for(n=0;n<this._items.length;n++)i=this._items[n],(a?t(i):zt(i._element,t))?s.push(i):o.push(i);return s.length?this.show(s,{instant:h,syncWithLayout:d,onFinish:p,layout:!1}):p(),o.length?this.hide(o,{instant:h,syncWithLayout:d,onFinish:p,layout:!1}):p(),(s.length||o.length)&&(this._hasListeners(c)&&this._emit(c,s.slice(0),o.slice(0)),u&&this.layout(u===pi,mt(u)?u:void 0)),this},mi.prototype.sort=function(){var t,e,i,n;function s(s,o){for(var r,a,l,h,d=0,c=0;c<t.length;c++)if(r=t[c][0],a=t[c][1],l=(s._sortData?s:s._refreshSortData())._sortData[r],h=(o._sortData?o:o._refreshSortData())._sortData[r],d="desc"===a||!a&&e?h<l?-1:h>l?1:0:l<h?-1:l>h?1:0)return d;return d||(n||(n=bi(i)),d=e?wi(n,o,s):wi(n,s,o)),d}function o(s,o){var r=e?-t(s,o):t(s,o);return r||(n||(n=bi(i)),r=e?wi(n,o,s):wi(n,s,o)),r}return function(r,a){if(this._isDestroyed||this._items.length<2)return this;var l=this._items,h=a||{},d=h.layout?h.layout:void 0===h.layout;if(e=!!h.descending,i=l.slice(0),n=null,mt(r))t=r,l.sort(o);else if(typeof r===_i)t=r.trim().split(" ").filter((function(t){return t})).map((function(t){return t.split(":")})),l.sort(s);else{if(!Array.isArray(r))throw t=e=i=n=null,new Error("Invalid comparer argument provided.");l.length=0,l.push.apply(l,r)}return this._hasListeners(u)&&this._emit(u,l.slice(0),i),d&&this.layout(d===pi,mt(d)?d:void 0),t=e=i=n=null,this}}(),mi.prototype.move=function(t,e,i){if(this._isDestroyed||this._items.length<2)return this;var n,r,a=this._items,l=i||{},h=l.layout?l.layout:void 0===l.layout,d=l.action===s,c=d?s:o,u=this.getItem(t),_=this.getItem(e);return u&&_&&u!==_&&(n=a.indexOf(u),r=a.indexOf(_),d?Qt(a,n,r):Ut(a,n,r),this._hasListeners(f)&&this._emit(f,{item:u,fromIndex:n,toIndex:r,action:c}),h&&this.layout(h===pi,mt(h)?h:void 0)),this},mi.prototype.send=function(t,e,i,n){if(this._isDestroyed||e._isDestroyed||this===e)return this;if(!(t=this.getItem(t)))return this;var s=n||{},o=s.appendTo||document.body,r=s.layoutSender?s.layoutSender:void 0===s.layoutSender,a=s.layoutReceiver?s.layoutReceiver:void 0===s.layoutReceiver;return t._migrate.start(e,i,o),t._migrate._isActive&&t._isActive&&(r&&this.layout(r===pi,mt(r)?r:void 0),a&&e.layout(a===pi,mt(a)?a:void 0)),this},mi.prototype.destroy=function(t){if(this._isDestroyed)return this;var e,n,s,o=this._element,r=this._items.slice(0),a=this._layout&&this._layout.styles||{};for((s=this)._resizeHandler&&(s._resizeHandler(!0),window.removeEventListener("resize",s._resizeHandler),s._resizeHandler=null),e=0;e<r.length;e++)r[e]._destroy(t);for(n in this._items.length=0,Se(o,this._settings.containerClass),a)o.style[n]="";return this._emit("destroy"),this._emitter.destroy(),delete i[this._id],this._isDestroyed=!0,this},mi.prototype._emit=function(){this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments)},mi.prototype._hasListeners=function(t){return!this._isDestroyed&&this._emitter.countListeners(t)>0},mi.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},mi.prototype._updateBorders=function(t,e,i,n){var s=this._element;t&&(this._borderLeft=bt(s,"border-left-width")),e&&(this._borderRight=bt(s,"border-right-width")),i&&(this._borderTop=bt(s,"border-top-width")),n&&(this._borderBottom=bt(s,"border-bottom-width"))},mi.prototype._refreshDimensions=function(){this._updateBoundingRect(),this._updateBorders(1,1,1,1),this._boxSizing=yt(this._element,"box-sizing")},mi.prototype._onLayoutDataReceived=(ui=[],function(t){if(!this._isDestroyed&&this._nextLayoutData&&this._nextLayoutData.id===t.id){var e,i,n,s,o=this,h=this._nextLayoutData.instant,d=this._nextLayoutData.onFinish,c=t.items.length,u=c;for(this._nextLayoutData=null,!this._isLayoutFinished&&this._hasListeners(l)&&this._emit(l,this._layout.items.slice(0)),this._layout=t,ui.length=0,s=0;s<c;s++)(e=t.items[s])?(i=t.slots[2*s],n=t.slots[2*s+1],e._canSkipLayout(i,n)?--u:(e._left=i,e._top=n,e.isActive()&&!e.isDragging()?ui.push(e):--u)):--u;if(t.styles&&Oe(this._element,t.styles),!this._hasListeners(r)||(this._emit(r,t.items.slice(0),!0===h),this._layout.id===t.id)){var f=function(){if(!(--u>0)){var e=o._layout.id!==t.id,i=mt(h)?h:d;e||(o._isLayoutFinished=!0),mt(i)&&i(t.items.slice(0),e),!e&&o._hasListeners(a)&&o._emit(a,t.items.slice(0))}};if(!ui.length)return f(),this;for(this._isLayoutFinished=!1,s=0;s<ui.length&&this._layout.id===t.id;s++)ui[s]._layout.start(!0===h,f);return this._layout.id===t.id&&(ui.length=0),this}}}),mi.prototype._setItemsVisibility=function(t,e,i){var n,s,o=this,a=t.slice(0),l=i||{},h=!0===l.instant,c=l.onFinish,u=l.layout?l.layout:void 0===l.layout,f=a.length,_=e?"showStart":d,p=e?"showEnd":"hideEnd",v=e?"show":"hide",m=!1,g=[],y=[];if(f){for(s=0;s<a.length;s++)n=a[s],(e&&!n._isActive||!e&&n._isActive)&&(m=!0),n._layout._skipNextAnimation=!(!e||n._isActive),e&&n._visibility._isHidden&&y.push(n),e?n._addToLayout():n._removeFromLayout();y.length&&(this.refreshItems(y,!0),y.length=0),m&&!1!==l.syncWithLayout?this.on(r,b):b(),m&&u&&this.layout(u===pi,mt(u)?u:void 0)}else mt(c)&&c(a);function b(){for(m&&!1!==l.syncWithLayout&&o.off(r,b),o._hasListeners(_)&&o._emit(_,a.slice(0)),s=0;s<a.length;s++)a[s]._gridId===o._id?a[s]._visibility[v](h,(function(t,e){t||g.push(e),--f<1&&(mt(c)&&c(g.slice(0)),o._hasListeners(p)&&o._emit(p,g.slice(0)))})):--f<1&&(mt(c)&&c(g.slice(0)),o._hasListeners(p)&&o._emit(p,g.slice(0)))}};const Si=mi;function ki(t){return ki="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},ki(t)}function xi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ei(n.key),n)}}function Ei(t){var e=function(t,e){if("object"!=ki(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ki(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ki(e)?e:e+""}var Di=function(){return t=function t(e,i){var n=this,s=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:s.itemWidth||100,itemHeight:s.itemHeight||100,itemGap:s.itemGap||6,label_field:s.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 o=document.createElement("style");o.id="vi-grid-style",o.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(o)}this.grid=new Si(this.gridContainer,{dragEnabled:!0,layout:{fillGaps:!0,horizontal:!1,alignRight:!1,alignBottom:!1},dragSort:!0,dragRelease:{duration:150,easing:"ease"},layoutDuration:150}),this.gridContainer.addEventListener("click",(function(t){var e=t.target.closest(".vi-grid-item");e&&n.toggleSelect(e)})),this.resizeObserver=new ResizeObserver((function(){n.grid.refreshItems(),n.grid.layout()})),this.resizeObserver.observe(i.contentContainer)},e=[{key:"addItem",value:function(t){var e=t.icon,i=t.title,n=t.data,s=document.createElement("div");s.className="vi-grid-item",s.dataset.id=n.id,s.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(s),this.grid.add(s),this.data.set(n.id,n)}},{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,n=this.data.get(i);this._onSelect&&this._onSelect({id:i,rowData:n,elem:t,selected:e}),this.event_bus&&this.event_bus.emit(this.collection,"selected",{id:i,object:n})}},{key:"setEventBus",value:function(t){this.event_bus=t}},{key:"update_record",value:function(t){t.collection;var e=t.record;this.data.set(e.id,e)}},{key:"add_or_update",value:function(t){var e=t.collection,i=t.record;this.data.has(i.id)?this.update_record({collection:e,record:i}):this.add(e,i)}},{key:"delete",value:function(t){t.collection;var e=t.record;this.removeById(e.id)}},{key:"set",value:function(t){var e=this,i=t.collection;t.result.data.forEach((function(t){e.add(i,t)}))}},{key:"focus",value:function(t){if(t&&t.id){var e=this.gridContainer.querySelector('.vi-grid-item[data-id="'.concat(t.id,'"]'));e&&(this.gridContainer.querySelectorAll(".vi-grid-item.selected").forEach((function(t){return t.classList.remove("selected")})),e.classList.add("selected"),e.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),this._onSelect&&this._onSelect({id:t.id,rowData:this.data.get(t.id),elem:e,selected:!0}))}}}],e&&xi(t.prototype,e),i&&xi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Li(t){return Li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Li(t)}function Ti(t){return function(t){if(Array.isArray(t))return Ci(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ci(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ci(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ci(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Ai(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Ii(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ai(Object(i),!0).forEach((function(e){Pi(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ai(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Pi(t,e,i){return(e=Mi(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ri(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Mi(n.key),n)}}function Mi(t){var e=function(t,e){if("object"!=Li(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Li(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Li(e)?e:e+""}var Oi=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.root=e.contentContainer||e,this.nodes=new Map,this.links=[],this.pendingLink=null,this.selectedLink=null,this.scale=1,this.offset={x:0,y:0},this.drop_callback=null,this._injectStyles(),this._build(),this._bindPanZoom(),this._bindGlobalLinkHandlers(),this._bindLinkDeletion(),this.setupDropArea(),this.selectedNodeId=null},e=[{key:"_build",value:function(){var t=this;this.root.innerHTML="",this.viewport=document.createElement("div"),this.viewport.className="vi-viewport",this.content=document.createElement("div"),this.content.className="vi-content",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.classList.add("vi-links"),this.svg.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.viewport.append(this.content,this.svg),this.root.appendChild(this.viewport),this.viewport.addEventListener("contextmenu",(function(t){return t.preventDefault()})),new ResizeObserver((function(){return t._resize()})).observe(this.root),this._resize(),this.viewport.addEventListener("pointerdown",(function(e){e.target===t.viewport&&(t._clearNodeSelection(),t.selectedLink&&(t.selectedLink.classList.remove("selected"),t.selectedLink=null))}))}},{key:"_resizeOLD",value:function(){var t=this.root.getBoundingClientRect();this.viewport.style.width=t.width+"px",this.viewport.style.height=t.height+"px";var e=1e4;this.svg.setAttribute("width",e),this.svg.setAttribute("height",e),this.svg.setAttribute("viewBox","0 0 ".concat(e," ").concat(e)),this._updateLinks()}},{key:"_resize",value:function(){var t=1e4;this.svg.setAttribute("width",t),this.svg.setAttribute("height",t),this.svg.setAttribute("viewBox","0 0 ".concat(t," ").concat(t)),this._updateLinks()}},{key:"_injectStyles",value:function(){if(!document.getElementById("vi-style")){var t=document.createElement("style");t.id="vi-style",t.textContent="\n .vi-viewport {\n position: relative;\n width: 100%;\n height: 100%;\n background: #686b9b;\n overflow: hidden;\n user-select: none;\n }\n \n .vi-content {\n position: absolute;\n inset: 0;\n z-index: 1;\n transform-origin: 0 0;\n }\n \n .vi-links {\n position: absolute;\n inset: 0;\n z-index: 2;\n pointer-events: none;\n transform-origin: 0 0;\n }\n \n .vi-node {\n position: absolute;\n width: 120px;\n height: 60px;\n background: #2b2b2b;\n border: 1px solid #555;\n border-radius: 6px;\n color: #fff;\n cursor: grab;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n }\n \n .vi-title {\n font-size: 12px;\n text-align: center;\n }\n \n .vi-icon {\n width: 24px;\n height: 24px;\n }\n \n .vi-port {\n position: absolute;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: #4da3ff;\n cursor: crosshair;\n }\n \n .vi-port.out { right: -5px; top: 50%; transform: translateY(-50%); }\n .vi-port.in { left: -5px; top: 50%; transform: translateY(-50%); }\n \n .vi-link {\n stroke: #4da3ff;\n stroke-width: 2.5;\n fill: none;\n pointer-events: stroke;\n cursor: pointer;\n }\n \n .vi-link.preview {\n stroke-dasharray: 4 4;\n pointer-events: none;\n }\n \n .vi-link.selected {\n stroke: #ff5252;\n stroke-width: 3.5;\n }\n\n .vi-node.selected {\n outline: 2px solid #4da3ff;\n box-shadow: 0 0 0 2px #4da3ff55;\n }\n\n\n\n\n\n ",document.head.appendChild(t)}}},{key:"addIcon",value:function(t){var e=this,i=t.id,n=t.x,s=t.y,o=t.label,r=t.icon,a=document.createElement("div");a.className="vi-node",a.style.left=n+"px",a.style.top=s+"px";var l=document.createElement("div");l.className="vi-icon",l.textContent=null!=r?r:"";var h=document.createElement("div");h.className="vi-title",h.textContent=null!=o?o:i;var d=document.createElement("div");d.className="vi-port in",d.dataset.nodeId=i;var c=document.createElement("div");c.className="vi-port out",a.append(l,h,d,c),this.content.appendChild(a),this.nodes.set(i,{id:i,node:a,x:n,y:s,inPort:d,outPort:c,label:o,icon:r}),this._makeDraggable(i),this._bindPorts(i),a.addEventListener("pointerdown",(function(t){0===t.button&&(t.target.classList.contains("vi-port")||(t.stopPropagation(),e._selectNode(i)))}))}},{key:"_selectNode",value:function(t){this.selectedLink&&(this.selectedLink.classList.remove("selected"),this.selectedLink=null),this.selectedNodeId&&this.nodes.has(this.selectedNodeId)&&this.nodes.get(this.selectedNodeId).node.classList.remove("selected"),this.selectedNodeId=t,this.nodes.get(t).node.classList.add("selected")}},{key:"_clearNodeSelection",value:function(){if(this.selectedNodeId){var t=this.nodes.get(this.selectedNodeId);t&&t.node.classList.remove("selected"),this.selectedNodeId=null}}},{key:"_makeDraggable",value:function(t){var e,i,n,s,o=this,r=this.nodes.get(t);r.node.addEventListener("pointerdown",(function(t){if(!t.target.classList.contains("vi-port")&&0===t.button){e=t.clientX,i=t.clientY,n=r.x,s=r.y;var a=function(t){r.x=n+(t.clientX-e)/o.scale,r.y=s+(t.clientY-i)/o.scale,r.node.style.left=r.x+"px",r.node.style.top=r.y+"px",o._updateLinks()};window.addEventListener("pointermove",a),window.addEventListener("pointerup",(function(){return window.removeEventListener("pointermove",a)}),{once:!0})}}))}},{key:"_bindPorts",value:function(t){var e=this;this.nodes.get(t).outPort.addEventListener("pointerdown",(function(i){i.stopPropagation(),e.pendingLink={from:t,preview:e._createPreviewPath()}}))}},{key:"_bindGlobalLinkHandlers",value:function(){var t=this;window.addEventListener("pointermove",(function(e){t.pendingLink&&t._updatePreview(e.clientX,e.clientY)})),window.addEventListener("pointerup",(function(e){if(t.pendingLink){var i=document.elementFromPoint(e.clientX,e.clientY),n=null==i?void 0:i.closest(".vi-port.in");if(n){var s=n.dataset.nodeId;s&&s!==t.pendingLink.from&&t._createLink(t.pendingLink.from,s)}t.pendingLink.preview.remove(),t.pendingLink=null}}))}},{key:"_createPreviewPath",value:function(){var t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.classList.add("vi-link","preview"),this.svg.appendChild(t),t}},{key:"_updatePreview",value:function(t,e){var i=this.viewport.getBoundingClientRect(),n=(t-i.left-this.offset.x)/this.scale,s=(e-i.top-this.offset.y)/this.scale,o=this.nodes.get(this.pendingLink.from),r=o.x+120,a=o.y+30,l=.5*Math.abs(n-r);this.pendingLink.preview.setAttribute("d","M ".concat(r," ").concat(a," C ").concat(r+l," ").concat(a,", ").concat(n-l," ").concat(s,", ").concat(n," ").concat(s))}},{key:"_createLink",value:function(t,e){var i=this,n=document.createElementNS("http://www.w3.org/2000/svg","path");n.classList.add("vi-link"),n.addEventListener("pointerdown",(function(t){t.stopPropagation(),i._selectLink(n)})),this.svg.appendChild(n),this.links.push({from:t,to:e,path:n}),this._updateLinks()}},{key:"_selectLink",value:function(t){this.selectedNodeId&&this.nodes.has(this.selectedNodeId)&&(this.nodes.get(this.selectedNodeId).node.classList.remove("selected"),this.selectedNodeId=null),this.selectedLink&&this.selectedLink.classList.remove("selected"),this.selectedLink=t,t.classList.add("selected")}},{key:"_updateLinks",value:function(){var t=this;this.links.forEach((function(e){var i=t.nodes.get(e.from),n=t.nodes.get(e.to),s=i.x+120,o=i.y+30,r=n.x,a=n.y+30,l=.5*Math.abs(r-s);e.path.setAttribute("d","M ".concat(s," ").concat(o," C ").concat(s+l," ").concat(o,", ").concat(r-l," ").concat(a,", ").concat(r," ").concat(a))}))}},{key:"_bindLinkDeletion",value:function(){var t=this;window.addEventListener("keydown",(function(e){if("Delete"===e.key||"Backspace"===e.key){if(t.selectedNodeId)return t.removeNode(t.selectedNodeId),t.delete_callback&&t.delete_callback(t.selectedNodeId),void(t.selectedNodeId=null);if(t.selectedLink){var i=t.links.findIndex((function(e){return e.path===t.selectedLink}));-1!==i&&(t.links[i].path.remove(),t.links.splice(i,1)),t.selectedLink=null}}}))}},{key:"_bindPanZoom",value:function(){var t,e,i=this,n=!1;this.viewport.addEventListener("pointerdown",(function(i){2===i.button&&(n=!0,t=i.clientX,e=i.clientY,i.preventDefault())})),window.addEventListener("pointermove",(function(s){n&&(i.offset.x+=s.clientX-t,i.offset.y+=s.clientY-e,t=s.clientX,e=s.clientY,i._applyTransform())})),window.addEventListener("pointerup",(function(){return n=!1})),this.viewport.addEventListener("wheel",(function(t){t.preventDefault(),i.scale*=t.deltaY>0?.9:1.1,i._applyTransform()}),{passive:!1})}},{key:"_applyTransform",value:function(){var t="translate(".concat(this.offset.x,"px, ").concat(this.offset.y,"px) scale(").concat(this.scale,")");this.content.style.transform=t,this.svg.style.transform=t}},{key:"serialize",value:function(){return{scale:this.scale,offset:Ii({},this.offset),nodes:Ti(this.nodes.values()).map((function(t){return{id:t.id,x:t.x,y:t.y,label:t.label,icon:t.icon}})),links:this.links.map((function(t){return{from:t.from,to:t.to}}))}}},{key:"deserialize",value:function(t){var e,i,n,s,o=this;this.scale=null!==(e=t.scale)&&void 0!==e?e:1,this.offset=null!==(i=t.offset)&&void 0!==i?i:{x:0,y:0},this._applyTransform(),this.nodes.forEach((function(t){return t.node.remove()})),this.links.forEach((function(t){return t.path.remove()})),this.nodes.clear(),this.links=[],(null!==(n=t.nodes)&&void 0!==n?n:[]).forEach((function(t){return o.addIcon(t)})),(null!==(s=t.links)&&void 0!==s?s:[]).forEach((function(t){return o._createLink(t.from,t.to)}))}},{key:"set",value:function(t){var e=t.result.data[0];this.deserialize(e.object)}},{key:"setupDropArea",value:function(){var t=this;this.viewport.addEventListener("dragover",(function(t){return t.preventDefault()})),this.viewport.addEventListener("drop",(function(e){var i;e.preventDefault();try{i=JSON.parse(e.dataTransfer.getData("text/plain"))}catch(t){return}if(i.id&&!t.nodes.has(i.id)){var n=t.viewport.getBoundingClientRect(),s=(e.clientX-n.left-t.offset.x)/t.scale,o=(e.clientY-n.top-t.offset.y)/t.scale;t.drop_callback?t.drop_callback(t,i,s,o):t.addIcon(Ii(Ii({},i),{},{x:s,y:o}))}}))}},{key:"getNodeIds",value:function(){return Ti(this.nodes.keys())}},{key:"removeNode",value:function(t){var e=this,i=this.nodes.get(t);i&&(this.links=this.links.filter((function(i){return i.from!==t&&i.to!==t||(e.selectedLink===i.path&&(e.selectedLink=null),i.path.remove(),!1)})),i.node.remove(),this.nodes.delete(t),this._updateLinks())}}],e&&Ri(t.prototype,e),i&&Ri(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Yi(t){return Yi="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},Yi(t)}function Xi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ni(n.key),n)}}function Ni(t){var e=function(t,e){if("object"!=Yi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Yi(e)?e:e+""}var ji=function(){return t=function t(e){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e.contentContainer||e,this.options=n,this.collection=this.options.collection||"no_collection",this.selectedItem=null,this.items=[],this.container.innerHTML='\n <input type="text" id="drag-list-search" placeholder="Search..." style="\n width: 100%;\n box-sizing: border-box;\n padding: 4px 8px;\n margin-bottom: 4px;\n "/>\n <div id="drag-list" style="\n width: 100%;\n height: calc(100% - 32px);\n overflow: auto;\n display: flex;\n flex-direction: column;\n gap: 4px;\n "></div>\n ';var s=this.container.querySelector("#drag-list-search");s.addEventListener("input",(function(){return i._filterItems(s.value)}))},e=[{key:"addVOD",value:function(t){this.vod=t}},{key:"set",value:function(t){var e=this,i=t.result.data,n=this.container.querySelector("#drag-list");n.innerHTML="",this.items=[],i.forEach((function(t){var i=document.createElement("div");if(i.className="draggable-item",i.draggable=!0,i.style.display="flex",i.style.alignItems="center",i.style.padding="4px 8px",i.style.border="1px solid #555",i.style.borderRadius="4px",i.style.cursor="grab",i.style.userSelect="none",e.vod)i.innerHTML=e.vod(t);else{var s=t[e.options.icon]?'<img src="'.concat(t[e.options.icon],'" style="width:16px;height:16px;margin-right:6px;" />'):"";i.innerHTML="".concat(s,"<span>").concat(t[e.options.label],"</span>")}i.addEventListener("dragstart",(function(i){var n={path:"".concat(e.collection,":").concat(t.id),collection:e.collection,id:t.id,node:t};i.dataTransfer.setData("application/json",JSON.stringify(n)),i.dataTransfer.setData("text/plain",n.path)})),i.addEventListener("click",(function(t){e.selectedItem&&e.selectedItem.classList.remove("selected"),e.selectedItem=i,i.classList.add("selected")})),n.appendChild(i),e.items.push({node:t,el:i})}));var s=document.createElement("style");s.id="drag-list-styles",s.innerHTML="\n .draggable-item.selected {\n background-color: #4da3ff33;\n border-color: #4da3ff;\n }\n ",document.getElementById("drag-list-styles")||document.head.appendChild(s)}},{key:"_filterItems",value:function(t){var e=t.toLowerCase();this.items.forEach((function(t){var i=t.node,n=t.el,s=JSON.stringify(i).toLowerCase();n.style.display=s.includes(e)?"flex":"none"}))}},{key:"setStyle",value:function(t){var e=this;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])this.items.forEach((function(i){var n=i.el;return e._applyStyle(n,t)}));else{var i=this.container.querySelector("#drag-list");this._applyStyle(i,t)}}},{key:"removeByIds",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Array.isArray(e)&&0!==e.length){var i=new Set(e);this.items=this.items.filter((function(e){var n=e.node,s=e.el;return!i.has(n.id)||(t.selectedItem===s&&(t.selectedItem=null),s.remove(),!1)}))}}},{key:"hideByIds",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(Array.isArray(e)&&0!==e.length){var i=e.map((function(t){return"string"==typeof t&&t.includes(":")?t.split(":").pop():t})),n=new Set(i);this.items.forEach((function(e){var i=e.node,s=e.el;n.has(i.id)&&(t.selectedItem===s&&(s.classList.remove("selected"),t.selectedItem=null),s.style.display="none")}))}}},{key:"showAll",value:function(){this.items.forEach((function(t){t.el.style.display="flex"}))}},{key:"_applyStyle",value:function(t,e){if("string"==typeof e)t.style.cssText+=e;else if("object"===Yi(e)){Object.assign(t.style,e);var i=t.querySelector("span");i&&Object.assign(i.style,e)}}},{key:"getSelected",value:function(){if(!this.selectedItem)return null;var t=this.selectedItem.querySelector("span");return t?t.textContent:null}}],e&&Xi(t.prototype,e),i&&Xi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function qi(t){return qi="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},qi(t)}function Hi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,zi(n.key),n)}}function Gi(t,e,i){return e&&Hi(t.prototype,e),i&&Hi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function zi(t){var e=function(t,e){if("object"!=qi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=qi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==qi(e)?e:e+""}var Bi=Gi((function t(e,i,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.from=e,this.to=i,this.verb=n})),Vi={Conductor:{},Tractocamión:{arrastra:["Caja Seca","Tolva Presurizada","Tolva Volteo","Góndola","Cortina","Plataforma"],puedeTener:["Dolly"],manejado_por:["Conductor"]},Tortón:{transporta:["Carga"]},Rabón:{transporta:["Carga"]},Trailer:{conectaCon:["Dolly"],transporta:["Carga"]},"Caja Seca":{arrastra:["Dolly"],transporta:["Carga"]},"Tolva Presurizada":{arrastra:["Dolly"],transporta:["Carga"]},"Tolva Volteo":{arrastra:["Dolly"],transporta:["Carga"]},Góndola:{arrastra:["Dolly"],transporta:["Carga"]},Dolly:{arrastra:["Caja Seca","Tolva Presurizada","Tolva Volteo","Góndola","Cortina","Plataforma"]},Cortina:{arrastra:["Dolly"],transporta:["Carga"]},Plataforma:{arrastra:["Dolly"],transporta:["Carga"]},Viaje:{tiene_conductor:["Conductor"],tiene_unidad:["Tractocamión","Tortón"],tiene_origen:["Lugar"],tiene_destino:["Lugar"],tiene_estado:["estado_de_viaje"],transporta:["Carga"]},Lugar:{inicioDe:["Viaje"],finDe:["Viaje"]},Carga:{cargadaEn:["Trailer","Caja Seca","Tolva Presurizada","Tolva Volteo","Góndola","Cortina","Plataforma"]},División:{contiene:["División"]},Estatus:{se_divide_en:["Estatus"]},Alerta:{tiene_subtipo:["Alerta"]},Contrato:{tiene_subtipo:["Contrato"]},Producto:{tiene_subtipo:["Producto"]},Evento:{tiene_subtipo:["Evento"]},Proyecto:{tiene_sub_proyecto:["Proyecto"],tiene_responsable:["Person"],tiene_status:["Estatus"],tiene_cliente:["Cliente"],tiene_proveedor:["Proveedor"],tiene_lugar:["Lugar"],tiene_contrato:["Contrato"]}};function Wi(t){return Wi="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},Wi(t)}function Fi(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,o,r,a=[],l=!0,h=!1;try{if(o=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=o.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,s=t}finally{try{if(!l&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(h)throw s}}return a}}(t,e)||Qi(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ui(t){return function(t){if(Array.isArray(t))return Zi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Qi(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qi(t,e){if(t){if("string"==typeof t)return Zi(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zi(t,e):void 0}}function Zi(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Ji(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$i(n.key),n)}}function $i(t){var e=function(t,e){if("object"!=Wi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Wi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Wi(e)?e:e+""}var Ki=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=e,this.entities=new Map,this.relationships=new Map,this.delete_callback=null},e=[{key:"addEntity",value:function(t,e,i){this.entities.set(t.id,t),this.view.addNode(t,e,i)}},{key:"removeEntityOLD",value:function(t){this.entities.has(t)&&(this.entities.delete(t),this.view.removeNode(t))}},{key:"removeEntity",value:function(t){var e=this;this.entities.has(t)&&(Ui(this.relationships.entries()).filter((function(e){var i=Fi(e,2),n=(i[0],i[1]);return n.from===t||n.to===t})).map((function(t){return Fi(t,1)[0]})).forEach((function(t){return e.removeRelationship(t)})),this.entities.delete(t),this.view.removeNode(t))}},{key:"removeRelationshipOLD",value:function(t){this.view.removeEdge(t)}},{key:"removeRelationship",value:function(t){var e,i,n=this.relationships.get(t);if(n){var s=this.entities.get(n.from),o=this.entities.get(n.to);s&&(s.topoVersion=(null!==(e=s.topoVersion)&&void 0!==e?e:0)+1),o&&(o.topoVersion=(null!==(i=o.topoVersion)&&void 0!==i?i:0)+1);var r=this.view.nodes.get(n.from);r&&(r.dataset.topoVersion=s.topoVersion);var a=this.view.nodes.get(n.to);a&&(a.dataset.topoVersion=o.topoVersion),this.relationships.delete(t),this.view.removeEdge(t)}}},{key:"deleteSelection",value:function(){var t=this.view.getSelection();console.log("a borrar",t),t.type&&("node"===t.type&&(this.removeEntity(t.id),!this.delete_callback||this.delete_callback(t.id)),"edge"===t.type&&this.removeRelationship(t.id))}},{key:"canRelate",value:function(t,e,i){var n,s=this.entities.get(t),o=this.entities.get(i);return!(!s||!o)&&(null===(n=Vi[s.type])||void 0===n||null===(n=n[e])||void 0===n?void 0:n.includes(o.type))}},{key:"onSelect",value:function(t,e,i){"node"===t&&console.log("Controller: node selected",e),"edge"===t&&console.log("Controller: edge selected",e)}},{key:"addRelationship",value:function(t,e,i){var n,s;if(this.canRelate(t,e,i)){var o="".concat(t,"-").concat(e,"-").concat(i);if(!this.relationships.has(o)){var r=new Bi(t,i,e);this.relationships.set(o,r);var a=this.entities.get(t),l=this.entities.get(i);a&&(a.topoVersion=(null!==(n=a.topoVersion)&&void 0!==n?n:0)+1),l&&(l.topoVersion=(null!==(s=l.topoVersion)&&void 0!==s?s:0)+1);var h=this.view.nodes.get(t);h&&(h.dataset.topoVersion=a.topoVersion);var d=this.view.nodes.get(i);d&&(d.dataset.topoVersion=l.topoVersion),this.view.addEdge({id:o,rel:r})}}else console.log("Invalid relationship: ".concat(t," ").concat(e," ").concat(i))}},{key:"getModel",value:function(){return this.view.toModel()}},{key:"clear",value:function(){this.view.clear(),this.entities.clear(),this.relationships.clear()}}],e&&Ji(t.prototype,e),i&&Ji(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function tn(t){return tn="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},tn(t)}function en(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,o,r,a=[],l=!0,h=!1;try{if(o=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=o.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,s=t}finally{try{if(!l&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(h)throw s}}return a}}(t,e)||sn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nn(t){return function(t){if(Array.isArray(t))return on(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||sn(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sn(t,e){if(t){if("string"==typeof t)return on(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?on(t,e):void 0}}function on(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function rn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function an(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hn(n.key),n)}}function ln(t,e,i){return(e=hn(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function hn(t){var e=function(t,e){if("object"!=tn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=tn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==tn(e)?e:e+""}var dn=function(){return t=function t(e){var i,n,s,o=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),ln(this,"_closeVerbMenu",(function(){var t;null===(t=o.verbMenu)||void 0===t||t.remove(),o.verbMenu=null})),ln(this,"_onTempKey",(function(t){"Escape"===t.key&&(o.onEdgeCreateCancel(),o._cancelEdgeCreation())})),ln(this,"_onTempMove",(function(t){if(o.edgeCreation){var e=o.container.getBoundingClientRect(),i=(t.clientX-e.left-o.pan.x)/o.scale,n=(t.clientY-e.top-o.pan.y)/o.scale;o._updateTempEdge(i,n)}})),ln(this,"_closeLayoutMenu",(function(){var t;null===(t=o.layoutMenu)||void 0===t||t.remove(),o.layoutMenu=null})),this.container=e,this.nodes=new Map,this.edges=[],this.onSelect=null!==(i=r.onSelect)&&void 0!==i?i:function(){},this.onDelete=null!==(n=r.onDelete)&&void 0!==n?n:function(){},this.onEdgeCreate=null!==(s=r.onEdgeCreate)&&void 0!==s?s:function(){},this._injectStyles(),this._build(),this._resizeScheduled=!1,this._resizeObserver=new ResizeObserver((function(){o._resizeScheduled||(o._resizeScheduled=!0,requestAnimationFrame((function(){o._resizeScheduled=!1,o._resizeSVG()})))})),this._resizeObserver.observe(this.container),this.selected={type:null,id:null},this.container.addEventListener("pointerdown",(function(){o._clearSelection()})),this.container.addEventListener("keydown",(function(t){"Delete"!==t.key&&"Backspace"!==t.key||(t.preventDefault(),o.onDelete())})),this.container.addEventListener("contextmenu",(function(t){if(!t.target.closest(".node")&&!t.target.closest(".edge-group")){t.preventDefault();var e=o.container.getBoundingClientRect(),i=t.clientX-e.left,n=t.clientY-e.top,s=o.screenToGraph(i,n),r=s.x,a=s.y;o._openLayoutMenu(r,a)}})),this.scale=1,this.pan={x:0,y:0},this._enableZoom(),this._enablePan()},e=[{key:"screenToGraph",value:function(t,e){return{x:(t-this.pan.x)/this.scale,y:(e-this.pan.y)/this.scale}}},{key:"_applyTransform",value:function(){this.viewport.style.transform="translate(".concat(this.pan.x,"px, ").concat(this.pan.y,"px) scale(").concat(this.scale,")")}},{key:"_resizeSVG",value:function(){var t=this.container.getBoundingClientRect();this.viewport.style.width=t.width+"px",this.viewport.style.height=t.height+"px",this.svg.setAttribute("width",t.width),this.svg.setAttribute("height",t.height),this.svg.setAttribute("viewBox","0 0 ".concat(t.width," ").concat(t.height))}},{key:"_enableZoom",value:function(){var t=this;this.container.addEventListener("wheel",(function(e){e.preventDefault();var i=t.container.getBoundingClientRect(),n=e.clientX-i.left,s=e.clientY-i.top,o=t.scale,r=e.deltaY<0?1.1:.9;t.scale=Math.min(Math.max(t.scale*r,.2),3);var a=t.scale/o;t.pan.x=n-a*(n-t.pan.x),t.pan.y=s-a*(s-t.pan.y),t._applyTransform()}),{passive:!1})}},{key:"_enablePan",value:function(){var t,e,i,n,s=this;this.container.addEventListener("pointerdown",(function(o){if(!o.target.closest(".node")&&!o.target.closest(".edge-group")){t=o.clientX,e=o.clientY,i=s.pan.x,n=s.pan.y,s.container.setPointerCapture(o.pointerId);var r=function(o){s.pan.x=i+(o.clientX-t),s.pan.y=n+(o.clientY-e),s._applyTransform()},a=function(){window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",a)};window.addEventListener("pointermove",r),window.addEventListener("pointerup",a,{once:!0})}}))}},{key:"_build",value:function(){this.viewport=document.createElement("div"),this.viewport.className="graph-viewport",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.classList.add("edges"),this.layer=document.createElement("div"),this.layer.className="nodes",this.viewport.append(this.svg,this.layer),this.container.append(this.viewport),this.scale=1,this.container.tabIndex=0,this.container.style.outline="none",this.container.style.position="relative"}},{key:"_clearSelection",value:function(){var t=this;if("node"===this.selected.type){var e=this.nodes.get(this.selected.id);null==e||e.classList.remove("selected")}if("edge"===this.selected.type){var i=this.edges.find((function(e){return e.id===t.selected.id}));null==i||i.g.classList.remove("selected")}null!==this.selected.type&&this.onSelect({type:null,id:null,data:null}),this.selected.type=null,this.selected.id=null}},{key:"_selectNode",value:function(t){this._clearSelection();var e=this.nodes.get(t);e&&(e.classList.add("selected"),this.selected={type:"node",id:t},this.onSelect({type:"node",id:t,data:{id:t}}))}},{key:"_selectEdge",value:function(t){this._clearSelection();var e=this.edges.find((function(e){return e.id===t}));e&&(e.g.classList.add("selected"),this.selected={type:"edge",id:t},this.onSelect({type:"edge",id:t,data:e.rel}))}},{key:"addNode",value:function(t,e,i){var n,s=this,o=document.createElement("div");o.className="node";var r=null!==(n=t.label)&&void 0!==n?n:t.id;o.innerHTML="".concat(this._icon(t.type)," ").concat(r),o.dataset.type=t.type,o.dataset.label=r,o.dataset.collection=t.collection,o.topoVersion=t.topoVersion,o._pos={x:e,y:i},o.style.left=e+"px",o.style.top=i+"px",o.addEventListener("pointerdown",(function(e){e.stopPropagation(),s._selectNode(t.id)})),o.addEventListener("contextmenu",(function(e){e.preventDefault(),e.stopPropagation(),s._openVerbMenu(t.id)})),o.addEventListener("pointerup",(function(e){s.edgeCreation&&(e.stopPropagation(),s._finishEdgeCreation(t.id))})),this.layer.appendChild(o),this.nodes.set(t.id,o),this._makeDraggable(o)}},{key:"_openVerbMenu",value:function(t){var e=this;console.log("verb",t);var i=this.nodes.get(t);if(i){var n=i.dataset.type,s=Vi[n];if(s){var o=i._pos.x+i.offsetWidth,r=i._pos.y,a=document.createElement("div");a.className="verb-menu",a.style.left=o+8+"px",a.style.top=r+"px",Object.keys(s).forEach((function(i){var n=document.createElement("div");n.textContent=i,n.addEventListener("pointerdown",(function(n){n.stopPropagation(),e._closeVerbMenu(),e._startEdgeCreation(t,i)})),a.appendChild(n)})),this._closeVerbMenu(),this.verbMenu=a,this.viewport.appendChild(a),setTimeout((function(){document.addEventListener("pointerdown",e._closeVerbMenu,{once:!0})}))}}}},{key:"_finishEdgeCreation",value:function(t){var e,i,n,s;if(this.edgeCreation){var o=this.edgeCreation,r=o.fromId,a=o.verb,l=null===(e=this.nodes.get(r))||void 0===e?void 0:e.dataset.type,h=null===(i=this.nodes.get(t))||void 0===i?void 0:i.dataset.type;(null!==(n=null===(s=Vi[l])||void 0===s?void 0:s[a])&&void 0!==n?n:[]).includes(h)?(this.onEdgeCreateComplete({fromId:r,verb:a,toId:t}),this._cancelEdgeCreation()):this._cancelEdgeCreation()}}},{key:"_startEdgeCreation",value:function(t,e){this.edgeCreation={fromId:t,verb:e},this.onEdgeCreateStart({fromId:t,verb:e}),this._createTempEdge(t),window.addEventListener("pointermove",this._onTempMove),window.addEventListener("keydown",this._onTempKey)}},{key:"_cancelEdgeCreation",value:function(){var t;this.edgeCreation=null,null===(t=this.tempEdge)||void 0===t||t.remove(),this.tempEdge=null,window.removeEventListener("pointermove",this._onTempMove),window.removeEventListener("keydown",this._onTempKey)}},{key:"onEdgeCreateStart",value:function(t){var e=t.fromId,i=t.verb;this.pending={fromId:e,verb:i}}},{key:"onEdgeCreateComplete",value:function(t){var e=t.toId,i=this.pending,n=i.fromId,s=i.verb;this.onEdgeCreate({fromId:n,verb:s,toId:e}),this.pending=null}},{key:"onEdgeCreateCancel",value:function(){this.pending=null}},{key:"_intersectRect",value:function(t,e,i){var n=e.x-t.x,s=e.y-t.y,o=i.w/2,r=i.h/2,a=e.x-i.cx,l=e.y-i.cy,h=1/0;if(0!==n){var d=(n>0?-o-a:o-a)/n;h=Math.min(h,d)}if(0!==s){var c=(s>0?-r-l:r-l)/s;h=Math.min(h,c)}return{x:e.x+n*h,y:e.y+s*h}}},{key:"_createTempEdge",value:function(t){var e=document.createElementNS("http://www.w3.org/2000/svg","path");e.classList.add("edge-temp"),this.svg.appendChild(e),this.tempEdge=e}},{key:"_updateTempEdge",value:function(t,e){var i=this.nodes.get(this.edgeCreation.fromId),n={x:i._pos.x+i.offsetWidth/2,y:i._pos.y+i.offsetHeight/2},s="M ".concat(n.x," ").concat(n.y," L ").concat(t," ").concat(e);this.tempEdge.setAttribute("d",s)}},{key:"addEdge",value:function(t){var e=this,i=t.id,n=t.rel;if(!this.edges.some((function(t){return t.id===i}))){var s=document.createElementNS("http://www.w3.org/2000/svg","g");s.classList.add("edge-group");var o=document.createElementNS("http://www.w3.org/2000/svg","path");o.classList.add("edge-hit");var r=document.createElementNS("http://www.w3.org/2000/svg","path");r.classList.add("edge");var a=document.createElementNS("http://www.w3.org/2000/svg","text");a.classList.add("edge-label"),a.textContent=n.verb;var l=document.createElementNS("http://www.w3.org/2000/svg","text");l.classList.add("edge-arrow"),l.textContent="→",s.append(o,r,a,l),this.svg.appendChild(s),o.addEventListener("pointerdown",(function(t){t.stopPropagation(),e._selectEdge(i)})),this.edges.push({id:i,rel:n,g:s,path:r,hit:o,label:a,arrow:l}),this._updateEdges()}}},{key:"removeEdge",value:function(t){var e=this.edges.findIndex((function(e){return e.id===t}));if(-1!==e){var i=this.edges[e];"edge"===this.selected.type&&this.selected.id===t&&this._clearSelection(),i.g.remove(),this.edges.splice(e,1)}}},{key:"removeNode",value:function(t){var e=this,i=this.nodes.get(t);i&&(this.edges.filter((function(e){return e.rel.from===t||e.rel.to===t})).map((function(t){return t.id})).forEach((function(t){return e.removeEdge(t)})),"node"===this.selected.type&&this.selected.id===t&&this._clearSelection(),i.remove(),this.nodes.delete(t))}},{key:"getSelection",value:function(){return function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?rn(Object(i),!0).forEach((function(e){ln(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):rn(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},this.selected)}},{key:"_updateEdges",value:function(){var t=this;this.edges.forEach((function(e){var i=t.nodes.get(e.rel.from),n=t.nodes.get(e.rel.to);if(i&&n){var s={x:i._pos.x+i.offsetWidth/2,y:i._pos.y+i.offsetHeight/2},o={x:n._pos.x+n.offsetWidth/2,y:n._pos.y+n.offsetHeight/2},r=.5*Math.abs(o.x-s.x),a="\n M ".concat(s.x," ").concat(s.y,"\n C ").concat(s.x+r," ").concat(s.y,",\n ").concat(o.x-r," ").concat(o.y,",\n ").concat(o.x," ").concat(o.y,"\n ");e.path.setAttribute("d",a),e.hit.setAttribute("d",a);var l=(s.x+o.x)/2,h=(s.y+o.y)/2;e.label.setAttribute("x",l),e.label.setAttribute("y",h-6);var d=s.x+.6*(o.x-s.x),c=s.y+.6*(o.y-s.y);e.arrow.setAttribute("x",d),e.arrow.setAttribute("y",c+4)}}))}},{key:"_makeDraggable",value:function(t){var e,i,n,s,o=this;t.addEventListener("pointerdown",(function(r){e=r.clientX,i=r.clientY,n=t._pos.x,s=t._pos.y;var a=function(r){var a=(r.clientX-e)/o.scale,l=(r.clientY-i)/o.scale;t._pos.x=n+a,t._pos.y=s+l,t.style.left=t._pos.x+"px",t.style.top=t._pos.y+"px",o._updateEdges()};window.addEventListener("pointermove",a),window.addEventListener("pointerup",(function(){return window.removeEventListener("pointermove",a)}),{once:!0})}))}},{key:"_icon",value:function(t){var e,i;return null!==(e=(i={Tractocamión:"<i class='fa-solid fa-truck-moving'></i>",Tortón:"<i class='fa-solid fa-truck'></i>","Caja Seca":"<i class='fa-solid fa-box'></i>","Tolva Presurizada":"<i class='fa-solid fa-industry'></i>","Tolva Volteo":"<i class='fa-solid fa-dumpster'></i>",Góndola:"<i class='fa-solid fa-truck'></i>",Dolly:"<i class='fa-solid fa-link'></i>",Cortina:"<i class='fa-solid fa-shuttle-van'></i>",Plataforma:"<i class='fa-solid fa-trailer'></i>",Automóvil:"<i class='fa-solid fa-car'></i>",Viaje:"<i class='fa fa-globe'></i>",Conductor:"<i class='fa-solid fa-user-tie'></i>",Lugar:"<i class='fa-solid fa-map-marker-alt'></i>",Depósito:"<i class='fa-solid fa-warehouse'></i>",Terminal:"<i class='fa-solid fa-building'></i>"},ln(ln(ln(ln(ln(ln(ln(ln(ln(ln(i,"Viaje","<i class='fa-solid fa-route'></i>"),"Ruta","<i class='fa-solid fa-road'></i>"),"Carga","<i class='fa-solid fa-boxes-stacked'></i>"),"Pedido","<i class='fa-solid fa-clipboard-list'></i>"),"Fuel","<i class='fa-solid fa-gas-pump'></i>"),"Estatus","<i class='fa fa-stethoscope'></i>"),"Person","<i class='fa-solid fa-user'></i>"),"División","<i class='fa fa-sitemap'></i>"),"estado_de_viaje","<i class='fa fa-map-marker'></i>"),"Alerta","<i class='fa fa-exclamation-triangle'></i>"),ln(ln(ln(ln(ln(i,"Producto","<i class='fa fa-archive'></i>"),"Contrato","<i class='fa fa-file-text'></i>"),"Evento","<i class='fa fa-calendar'></i>"),"Cliente","<i class='fa fa-building'></i>"),"Proyecto","<i class='fa fa-building'></i>"))[t])&&void 0!==e?e:"<i class='fa-solid fa-route'></i>"}},{key:"_injectStyles",value:function(){if(!document.getElementById("graph-style")){var t=document.createElement("style");t.id="graph-style",t.textContent="\n .nodes {\n position: absolute;\n inset: 0;\n pointer-events: none;\n }\n\n .node {\n position: absolute;\n background: #2b2b2b;\n color: white;\n border: 1px solid #555;\n border-radius: 6px;\n padding: 6px 10px;\n cursor: grab;\n user-select: none;\n pointer-events: auto;\n }\n\n svg.edges {\n position: absolute;\n inset: 0;\n pointer-events: auto;\n }\n\n svg.edges {\n overflow: visible; /* 👈 REQUIRED */\n }\n\n .edge-group {\n pointer-events: all;\n cursor: pointer;\n }\n\n .edge {\n fill: none;\n stroke: #4da3ff;\n stroke-width: 2.5;\n }\n\n .edge {\n pointer-events: stroke;\n cursor: pointer;\n }\n\n .edge-hit {\n fill: none;\n stroke: transparent;\n stroke-width: 14; /* 👈 BIG hit area */\n cursor: pointer;\n }\n\n .edge-group.selected .edge {\n stroke: #ff5252;\n stroke-width: 3.5;\n }\n\n .edge-label {\n fill: red;\n font-size: 12px;\n pointer-events: none;\n text-anchor: middle;\n user-select: none;\n }\n\n\n .node.selected {\n outline: 2px solid #ff5252;\n outline-offset: 2px;\n }\n\n \n .edge {\n fill: none;\n stroke: #4da3ff;\n stroke-width: 2.5;\n pointer-events: none;\n }\n\n .edge-hit {\n fill: none;\n stroke: transparent;\n stroke-width: 14;\n cursor: pointer;\n }\n\n .edge-hit {\n pointer-events: stroke;\n }\n\n .edge-group.selected .edge {\n stroke: #ff5252;\n stroke-width: 3.5;\n }\n\n .edge-group.selected marker path {\n fill: #ff5252;\n }\n\n .graph-viewport {\n position: absolute;\n inset: 0;\n overflow: visible;\n transform-origin: 0 0;\n \n }\n\n .graph-viewport {\n cursor: grab;\n }\n\n \n \n\n .graph-viewport:active {\n cursor: grabbing;\n }\n\n .verb-menu {\n position: absolute;\n background: #1e1e1e;\n border: 1px solid #555;\n border-radius: 6px;\n padding: 4px;\n z-index: 9;\n color: white; \n }\n\n .verb-menu > div {\n padding: 6px 12px;\n cursor: pointer;\n }\n\n .verb-menu > div:hover {\n background: #333;\n }\n\n .edge-temp {\n fill: none;\n stroke: #aaa;\n stroke-dasharray: 4 4;\n stroke-width: 2;\n pointer-events: none;\n }\n\n .edge {\n stroke: #4da3ff;\n color: #4da3ff;\n }\n\n .edge-group.selected .edge {\n stroke: #ff5252;\n color: #ff5252;\n }\n\n .edge-arrow {\n fill: #4da3ff;\n font-size: 14px;\n font-weight: bold;\n pointer-events: none;\n text-anchor: middle;\n user-select: none;\n }\n\n .edge-group.selected .edge-arrow {\n fill: #ff5252;\n }\n\n .vi-toolbox-button {\n z-index: 9000; /* above graph */\n pointer-events: auto; /* needed for clicks */\n }\n\n\n .layout-menu {\n position: absolute;\n background: #1e1e1e;\n border: 1px solid #555;\n border-radius: 8px;\n padding: 6px 0;\n color: white;\n z-index: 10;\n min-width: 210px;\n }\n\n .layout-item {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 8px 14px;\n cursor: pointer;\n white-space: nowrap;\n }\n\n .layout-item:hover {\n background: #333;\n }\n\n .layout-icon {\n width: 20px;\n text-align: center;\n color: #4da3ff;\n font-size: 14px;\n }\n\n .layout-label {\n flex: 1;\n }\n\n\n\n\n\n\n ",document.head.appendChild(t)}}},{key:"serialize",value:function(){return{viewport:{pan:this.pan,scale:this.scale},nodes:nn(this.nodes.entries()).map((function(t){var e=en(t,2),i=e[0],n=e[1];return{id:i,type:n.dataset.type,label:n.dataset.label,topoVersion:n.dataset.topoVersion,x:n._pos.x,y:n._pos.y}})),edges:this.edges.map((function(t){return{id:t.id,from:t.rel.from,to:t.rel.to,verb:t.rel.verb}}))}}},{key:"clear",value:function(){var t,e;null===(t=this._cancelEdgeCreation)||void 0===t||t.call(this),this._clearSelection(),this.edges.forEach((function(t){return t.g.remove()})),this.edges.length=0,this.nodes.forEach((function(t){return t.remove()})),this.nodes.clear(),null===(e=this._closeVerbMenu)||void 0===e||e.call(this),this.pan={x:0,y:0},this.scale=1,this._applyTransform(),this.tempEdge&&(this.tempEdge.remove(),this.tempEdge=null),this.selected={type:null,id:null},this.pending=null,this.edgeCreation=null}},{key:"deserialize",value:function(t){var e=this;this.clear(),t.nodes.forEach((function(t){return e.addNode({id:t.id,type:t.type,label:t.label},t.x,t.y)})),t.edges.forEach((function(t){return e.addEdge({id:t.id,rel:{from:t.from,to:t.to,verb:t.verb}})})),t.viewport&&(this.pan=t.viewport.pan,this.scale=t.viewport.scale,this._applyTransform())}},{key:"toModel",value:function(){return{entities:nn(this.nodes.entries()).map((function(t){var e=en(t,2),i=e[0],n=e[1];return{id:i,type:n.dataset.type,label:n.dataset.label}})),relationships:this.edges.map((function(t){return{from:t.rel.from,to:t.rel.to,verb:t.rel.verb}}))}}},{key:"getNodeIds",value:function(){return Array.from(this.nodes.keys())}},{key:"_setNodePosition",value:function(t,e,i){t._pos.x=e,t._pos.y=i,t.style.left=e+"px",t.style.top=i+"px"}},{key:"autoLayoutTree",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.startX,n=void 0===i?100:i,s=e.startY,o=void 0===s?100:s,r=e.levelGap,a=void 0===r?140:r,l=e.nodeGap,h=void 0===l?100:l,d={},c={};this.nodes.forEach((function(t,e){d[e]=[],c[e]=0})),this.edges.forEach((function(t){d[t.rel.from].push(t.rel.to),c[t.rel.to]++}));var u=Object.keys(c).filter((function(t){return 0===c[t]})),f=n,_=new Set;u.forEach((function(e){for(var i=[{id:e,level:0}],n={},s=function(){var e,s=i.shift(),r=s.id,l=s.level;if(_.has(r))return 1;_.add(r),null!==(e=n[l])&&void 0!==e||(n[l]=0);var c=o+l*a,u=f+n[l]*h,p=t.nodes.get(r);p&&t._setNodePosition(p,u,c),n[l]++,d[r].forEach((function(t){return i.push({id:t,level:l+1})}))};i.length;)s();f+=300})),this._updateEdges()}},{key:"autoLayoutHorizontalTree",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.startX,n=void 0===i?80:i,s=e.startY,o=void 0===s?80:s,r=e.columnGap,a=void 0===r?220:r,l=e.rowGap,h=void 0===l?80:l,d={},c={};this.nodes.forEach((function(t,e){d[e]=[],c[e]=0})),this.edges.forEach((function(t){d[t.rel.from].push(t.rel.to),c[t.rel.to]++}));var u=Object.keys(c).filter((function(t){return 0===c[t]})),f=o,_=new Set,p=function(e,i){if(_.has(e))return f;_.add(e);var s=f,o=d[e];o.forEach((function(t){f=p(t,i+1)+h})),0===o.length&&(f+=h);var r=f-h,l=o.length>0?(s+r)/2:s,c=n+i*a,u=t.nodes.get(e);return u&&t._setNodePosition(u,c,l),l};u.forEach((function(t){p(t,0),f+=2*h})),this._updateEdges()}},{key:"autoLayoutFlow",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.startX,n=void 0===i?100:i,s=e.startY,o=void 0===s?200:s,r=e.gap,a=void 0===r?160:r,l=new Set,h=n,d=function(e){if(!l.has(e)){l.add(e);var i=t.nodes.get(e);i&&t._setNodePosition(i,h,o),h+=a,t.edges.filter((function(t){return t.rel.from===e})).forEach((function(t){return d(t.rel.to)}))}};this.getNodeIds().forEach(d),this._updateEdges()}},{key:"autoLayoutGrid",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.cols,n=void 0===i?5:i,s=e.startX,o=void 0===s?100:s,r=e.startY,a=void 0===r?100:r,l=e.gapX,h=void 0===l?160:l,d=e.gapY,c=void 0===d?120:d,u=0;this.nodes.forEach((function(e){var i=u%n,s=Math.floor(u/n),r=o+i*h,l=a+s*c;t._setNodePosition(e,r,l),u++})),this._updateEdges()}},{key:"autoLayoutRadial",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.centerX,n=void 0===i?400:i,s=e.centerY,o=void 0===s?300:s,r=e.radius,a=void 0===r?200:r,l=this.getNodeIds(),h=2*Math.PI/l.length;l.forEach((function(e,i){var s=t.nodes.get(e);if(s){var r=i*h,l=n+Math.cos(r)*a,d=o+Math.sin(r)*a;t._setNodePosition(s,l,d)}})),this._updateEdges()}},{key:"_openLayoutMenu",value:function(t,e){var i=this;this._closeLayoutMenu();var n=this.container.getBoundingClientRect(),s=this._layoutIcons(),o=document.createElement("div");o.className="layout-menu",o.style.left=t-n.left+"px",o.style.top=e-n.top+"px",[{label:"Tree (Vertical)",icon:s.treeVertical,action:function(){return i.autoLayoutTree()}},{label:"Tree (Horizontal)",icon:s.treeHorizontal,action:function(){return i.autoLayoutHorizontalTree()}},{label:"Flow",icon:s.flow,action:function(){return i.autoLayoutFlow()}},{label:"Grid",icon:s.grid,action:function(){return i.autoLayoutGrid()}},{label:"Radial",icon:s.radial,action:function(){return i.autoLayoutRadial()}}].forEach((function(t){var e=t.label,n=t.icon,s=t.action,r=document.createElement("div");r.className="layout-item",r.innerHTML='\n <span class="layout-icon">'.concat(n,'</span>\n <span class="layout-label">').concat(e,"</span>\n "),r.addEventListener("pointerdown",(function(t){t.stopPropagation(),i._closeLayoutMenu(),s()})),o.appendChild(r)})),this.layoutMenu=o,this.viewport.appendChild(o),setTimeout((function(){document.addEventListener("pointerdown",i._closeLayoutMenu,{once:!0})}))}},{key:"_layoutIcons",value:function(){return{treeVertical:"<i class='fa-solid fa-sitemap'></i>",treeHorizontal:"<i class='fa-solid fa-diagram-project'></i>",flow:"<i class='fa-solid fa-arrow-right-long'></i>",grid:"<i class='fa-solid fa-table-cells'></i>",radial:"<i class='fa-solid fa-circle-nodes'></i>"}}}],e&&an(t.prototype,e),i&&an(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function cn(t){return cn="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},cn(t)}function un(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_n(n.key),n)}}function fn(t,e,i){return e&&un(t.prototype,e),i&&un(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function _n(t){var e=function(t,e){if("object"!=cn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=cn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==cn(e)?e:e+""}var pn=fn((function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e,this.type=i,this.data=n}));function vn(t){return vn="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},vn(t)}function mn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,o,r,a=[],l=!0,h=!1;try{if(o=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=o.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,s=t}finally{try{if(!l&&null!=i.return&&(r=i.return(),Object(r)!==r))return}finally{if(h)throw s}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return gn(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?gn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function gn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function yn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,bn(n.key),n)}}function bn(t){var e=function(t,e){if("object"!=vn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=vn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vn(e)?e:e+""}var wn=function(){return t=function t(e,i){var n,s=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("GraphEditor: container required");this.options=i,this.dirtyId="graph-editor-".concat(crypto.randomUUID()),this.onSelect=null!==(n=i.onSelect)&&void 0!==n?n:function(){};var o=document.createElement("div");o.style.position="relative",o.style.width="100%",o.style.height="100%",e.contentContainer.appendChild(o),this.container=o,this.view=new dn(this.container,{onSelect:this._handleSelection.bind(this),onDelete:function(){s.controller.deleteSelection(),s._markDirty("delete")},onEdgeCreate:function(t){var e=t.fromId,i=t.verb,n=t.toId;s.controller.addRelationship(e,i,n),s._markDirty("edge create")}}),this.controller=new Ki(this.view),this._setupDropArea()},e=[{key:"_markDirty",value:function(){var t;this.isDirty||(this.isDirty=!0,null===(t=window.__DIRTY_REGISTRY__)||void 0===t||t.set(this.dirtyId))}},{key:"_clearDirty",value:function(){var t;this.isDirty=!1,null===(t=window.__DIRTY_REGISTRY__)||void 0===t||t.clear(this.dirtyId)}},{key:"_handleSelection",value:function(t){var e=t.type,i=t.id,n=t.data;this.controller.onSelect(e,i,n),this.onSelect({type:e,id:i,data:n})}},{key:"clear",value:function(){this.controller.clear()}},{key:"_setupDropArea",value:function(){var t=this;this.container.addEventListener("dragover",(function(t){return t.preventDefault()})),this.container.addEventListener("drop",(function(e){var i,n,s;e.preventDefault();var o=null,r=e.dataTransfer.getData("application/json");if(r)try{o=JSON.parse(r)}catch(t){}if(!o){var a=e.dataTransfer.getData("text/plain");if(!a)return;if(a.includes(":")){var l=mn(a.split(":"),2);o={collection:l[0],id:l[1],path:a}}else try{o=JSON.parse(a)}catch(t){o={id:a}}}if(null!==(i=o)&&void 0!==i&&i.id){var h=null!==(n=o.path)&&void 0!==n?n:o.id;if(!t.controller.entities.has(h)){var d=t.container.getBoundingClientRect(),c=e.clientX-d.left,u=e.clientY-d.top,f=t.view.screenToGraph(c,u),_=f.x,p=f.y,v={id:h,collection:o.collection,sourceId:o.id,raw:o,topoVersion:0};null===(s=t.drop_callback)||void 0===s||s.call(t,t,v,_,p),t._markDirty("drop node")}}}))}},{key:"relate",value:function(t,e,i){this.controller.addRelationship(t,e,i),this._markDirty("add relationship")}},{key:"getNodeIds",value:function(){return this.view.getNodeIds()}},{key:"getNodeIdsByType",value:function(t){var e=this;return this.view.getNodeIds().filter((function(i){var n;return(null===(n=e.view.nodes.get(i))||void 0===n?void 0:n.dataset.type)===t}))}},{key:"serialize",value:function(){return{version:1,graph:this.view.serialize()}}},{key:"deserialize",value:function(t){var e=this;1!==t.version&&(t=this._migrate(t)),t.graph&&(this.view.deserialize(t.graph),t.graph.nodes.forEach((function(t){var i=new pn(t.id,t.type,t.label);e.controller.entities.set(t.id,i)})),t.graph.edges.forEach((function(t){e.controller.addRelationship(t.from,t.verb,t.to)})),this._clearDirty())}},{key:"set",value:function(t){var e=t.result.data[0];this.controller.clear(),e&&e.object&&this.deserialize(e.object)}},{key:"getAdjacentNodes",value:function(t){var e=this;if(!this.controller.entities.has(t))return[];var i=new Map;return this.controller.relationships.forEach((function(e){if(e.from===t){var n=e.to;i.has(n)||i.set(n,[]),i.get(n).push(e.verb)}else if(e.to===t){var s=e.from;i.has(s)||i.set(s,[]),i.get(s).push(e.verb)}})),Array.from(i.entries()).map((function(t){var i=mn(t,2),n=i[0],s=i[1];return{nodeId:n,entity:e.controller.entities.get(n),verbs:s}}))}},{key:"_migrate",value:function(t){return t}},{key:"isModified",value:function(){return this.isDirty}}],e&&yn(t.prototype,e),i&&yn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Sn(t){return Sn="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},Sn(t)}function kn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xn(n.key),n)}}function xn(t){var e=function(t,e){if("object"!=Sn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Sn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Sn(e)?e:e+""}var En=function(){return t=function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=i,this.type=this.options.type||"Unnamed",this.html=this.options.html||this.getDefaultTML(),e.insertHtmlContent(this.html),this.root=e.contentContainer,this.card=this.root.querySelector(".node-card"),this.options.multidrag?this.setMultiListeners():this.setListeners()},e=[{key:"setMultiListeners",value:function(){var t=this;this.card.querySelectorAll(".status-icon").forEach((function(e){e.tabIndex=0,e.addEventListener("dragstart",(function(i){var n=e.dataset.status,s={id:"".concat(t.type,":").concat(Date.now()),type:t.type,status:n};i.dataTransfer.setData("application/json",JSON.stringify(s)),i.dataTransfer.effectAllowed="copy";var o=document.createElement("div");o.textContent=e.textContent,Object.assign(o.style,{width:"40px",height:"40px",borderRadius:"8px",background:"#22c55e",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"22px",position:"absolute",top:"-1000px",left:"-1000px"}),document.body.appendChild(o),i.dataTransfer.setDragImage(o,20,20),setTimeout((function(){return o.remove()}),0)}))}))}},{key:"setListeners",value:function(){var t=this;this.card.addEventListener("dragstart",(function(e){var i=t.card.querySelector(".node-name"),n=(null==i?void 0:i.value)||"Unnamed",s={id:"".concat(t.type,":").concat(Date.now()),type:t.type,label:n};e.dataTransfer.setData("application/json",JSON.stringify(s)),e.dataTransfer.effectAllowed="copy";var o=document.createElement("div");o.textContent=n[0].toUpperCase(),Object.assign(o.style,{width:"40px",height:"40px",borderRadius:"50%",background:"#3b82f6",color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",fontSize:"18px",position:"absolute",top:"-1000px",left:"-1000px"}),document.body.appendChild(o),e.dataTransfer.setDragImage(o,20,20),setTimeout((function(){return o.remove()}),0)}))}},{key:"clearCard",value:function(){var t=this.card.querySelector(".node-name");t&&(t.value="")}},{key:"getDefaultTML",value:function(){return'\n <div style="\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n ">\n <div class="node-card" style="\n border: 1px solid #ccc;\n border-radius: 8px;\n padding: 16px;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n box-shadow: 0 2px 6px rgba(0,0,0,0.1);\n cursor: grab;\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 10px;\n " draggable="true">\n <label style="font-weight: bold;">Name:</label>\n <input type="text" class="node-name" placeholder="Enter name" style="\n padding: 8px;\n border: 1px solid #ccc;\n border-radius: 4px;\n font-size: 14px;\n width: 100%;\n box-sizing: border-box;\n "/>\n </div>\n </div>\n '}}],e&&kn(t.prototype,e),i&&kn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),Dn=e._Z,Ln=e.Hx,Tn=e.YO,Cn=e._D,An=e.Qz;export{Dn as vi_GraphEditor,Ln as vi_Grid,Tn as vi_IconPanel,Cn as vi_dragable_card,An as vi_dragable_list};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vizor_panels",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "desciption of libname",
5
5
  "main": "dist/vizor_panels.min.js",
6
6
  "module": "dist/vizor_panels.min.js",