You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

muuri

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

muuri - npm Package Compare versions

Comparing version

to
0.5.2

/*!
* Muuri v0.5.1
* Muuri v0.5.2
* https://github.com/haltu/muuri

@@ -25,6 +25,6 @@ * Copyright (c) 2015, Haltu Oy

/*!
* muuriLayout v0.5.1
* muuriLayout v0.5.2
* Copyright (c) 2016 Niklas Rämö <inramo@gmail.com>
* Released under the MIT license
*/
!function(t,e){var i;if("object"==typeof module&&module.exports){try{i=require("hammerjs")}catch(t){}module.exports=e("Muuri",i)}else"function"==typeof define&&define.amd?define(["hammerjs"],function(t){return e("Muuri",t)}):t.Muuri=e("Muuri",t.Hammer)}("undefined"!=typeof window?window:this,function(t,e,i){"use strict";function n(t,e){var i,r,o,s=this;if(ot||(ot=document.body,It=G()),t=s._element=typeof t===at?nt.querySelector(t):t,!ot.contains(t))throw new et("Container element must be an existing DOM element");typeof(i=s._settings=W(n.defaultOptions,e)).dragSort!==st&&(i.dragSort=!!i.dragSort),mt[s._id=++Dt]=s,s._isDestroyed=!1,s._layout=null,s._emitter=new n.Emitter,s._itemShowHandler=F("show",i),s._itemHideHandler=F("hide",i),A(t,i.containerClass),s._items=[],typeof(r=i.items)===at?H(s._element.children).forEach(function(t){("*"===r||wt(t,r))&&s._items.push(new n.Item(s,t))}):(K.isArray(r)||p(r))&&(s._items=H(r).map(function(t){return new n.Item(s,t)})),(o=!0===(o=i.layoutOnResize)?0:typeof o===lt?o:-1)>=0&&$.addEventListener("resize",s._resizeHandler=y(function(){s.refreshItems().layout()},o)),i.layoutOnInit&&s.layout(!0)}function r(t,e){var i,r=this,o=t._settings;r._id=++Dt,yt[r._id]=r,r._isDestroyed=!1,e.parentNode!==t._element&&t._element.appendChild(e),A(e,o.itemClass),A(e,(i="none"===D(e,"display"))?o.itemHiddenClass:o.itemVisibleClass),r._gridId=t._id,r._element=e,r._child=e.children[0],r._animate=new n.ItemAnimate(r,e),r._animateChild=new n.ItemAnimate(r,r._child),r._isActive=!i,r._isPositioning=!1,r._isHidden=i,r._isHiding=!1,r._isShowing=!1,r._visibilityQueue=[],r._layoutQueue=[],r._left=0,r._top=0,C(e,{left:"0",top:"0",transform:I(0,0),display:i?"none":"block"}),r._refreshDimensions()._refreshSortData(),i?t._itemHideHandler.start(r,!0):t._itemShowHandler.start(r,!0),r._migrate=new n.ItemMigrate(r),r._release=new n.ItemRelease(r),r._drag=o.dragEnabled?new n.ItemDrag(r):null}function o(){this._events={},this._isDestroyed=!1}function s(t,e){var i=this;i._item=t,i._element=e,i._animation=null,i._propsTo=null,i._isDestroyed=!1}function a(t){var e=this;e._itemId=t._id,e._isDestroyed=!1,e.isActive=!1,e.container=!1,e.containerDiffX=0,e.containerDiffY=0}function l(t){var e=this;e._itemId=t._id,e._isDestroyed=!1,e.isActive=!1,e.isPositioningStarted=!1,e.containerDiffX=0,e.containerDiffY=0}function d(i){if(!e)throw new et("["+t+"] required dependency Hammer is not defined.");var n,r,o=this,s=i._element,a=i.getGrid(),l=a._settings,f=typeof l.dragStartPredicate===st?l.dragStartPredicate:d.defaultStartPredicate,u=ct;o._itemId=i._id,o._gridId=a._id,o._hammer=n=new e.Manager(s),o._isDestroyed=!1,o._isMigrating=!1,o._data={},o._resolveStartPredicate=function(t){o._isDestroyed||u!==_t||(u=pt,o.onStart(t))},o._scrollListener=function(t){o.onScroll(t)},o._checkSortOverlap=y(function(){o._data.isActive&&o.checkOverlap()},l.dragSortInterval),o._sortPredicate=typeof l.dragSortPredicate===st?l.dragSortPredicate:d.defaultSortPredicate,o.reset(),n.add(new e.Pan({event:"drag",pointers:1,threshold:0,direction:e.DIRECTION_ALL})),n.add(new e.Press({event:"draginit",pointers:1,threshold:1e3,time:0})),_(l.dragHammerSettings)&&n.set(l.dragHammerSettings),n.on("draginit dragstart dragmove",function(t){u===ct&&(u=_t),u===_t?!0===(r=f(o.getItem(),t))?(u=pt,o.onStart(t)):!1===r&&(u=gt):u===pt&&o._data.isActive&&o.onMove(t)}).on("dragend dragcancel draginitup",function(t){var e=u===pt;f(o.getItem(),t),u=ct,e&&o._data.isActive&&o.onEnd(t)}),s.addEventListener("dragstart",j,!1)}function f(t,e,i){var n=t.length,r=tt.max(0,i?n:n-1);return e>r?r:e<0?tt.max(r+e+1,0):e}function u(t,e,i){if(!(t.length<2)){var n,r=f(t,e),o=f(t,i);r!==o&&(n=t[r],t[r]=t[o],t[o]=n)}}function h(t,e,i){if(!(t.length<2)){var n=f(t,e),r=f(t,i);n!==r&&t.splice(r,0,t.splice(n,1)[0])}}function c(t){var e,i=[],n=t.length;if(n)for(i[0]=t[0],e=1;e<n;e++)i.indexOf(t[e])<0&&i.push(t[e]);return i}function _(t){return"object"==typeof t&&"[object Object]"===J.prototype.toString.call(t)}function p(t){var e=J.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e}function g(t,e){return J.keys(e).forEach(function(i){var n=_(e[i]);_(t[i])&&n?(t[i]=g({},t[i]),t[i]=g(t[i],e[i])):t[i]=n?g({},e[i]):K.isArray(e[i])?e[i].concat():e[i]}),t}function m(t,e,i){var n=typeof i===lt?i:-1;t.splice.apply(t,[n<0?t.length-n+1:n,0].concat(e))}function y(t,e){var n;return e>0?function(r){n!==i&&(n=$.clearTimeout(n),"finish"===r&&t()),"cancel"!==r&&"finish"!==r&&(n=$.setTimeout(function(){n=i,t()},e))}:function(e){"cancel"!==e&&t()}}function v(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function D(t,e){return $.getComputedStyle(t,null).getPropertyValue("transform"===e?St.styleName||e:e)}function w(t,e){return parseFloat(D(t,e))||0}function S(t,e){return parseFloat((D(t,"transform")||"").replace("matrix(","").split(",")["x"===e?4:5])||0}function I(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function b(t,e){var i,n={},r=J.keys(e);for(i=0;i<r.length;i++)n[r[i]]=D(t,v(r[i]));return n}function C(t,e){var i,n=J.keys(e);for(i=0;i<n.length;i++)t.style["transform"===n[i]&&St?St.propName:n[i]]=e[n[i]]}function A(t,e){t.classList?t.classList.add(e):wt(t,"."+e)||(t.className+=" "+e)}function x(t,e){t.classList?t.classList.remove(e):wt(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim())}function H(t){return[].slice.call(t)}function E(t,e,i){if(t===e)return{left:0,top:0};i&&(t=L(t,!0),e=L(e,!0));var n=R(t,!0),r=R(e,!0);return{left:r.left-n.left,top:r.top-n.top}}function R(t,e){var i,n={left:0,top:0};return t===nt?n:(n.left=$.pageXOffset||0,n.top=$.pageYOffset||0,t.self===$.self?n:(i=t.getBoundingClientRect(),n.left+=i.left,n.top+=i.top,e&&(n.left+=w(t,"border-left-width"),n.top+=w(t,"border-top-width")),n))}function L(t,e){for(var i=(e?t:t.parentElement)||nt;i&&i!==nt&&"static"===D(i,"position")&&!X(i);)i=i.parentElement||nt;return i}function P(t){var e=[],i=/(auto|scroll)/,n=t.parentNode;if(It){if("fixed"===D(t,"position"))return e;for(;n&&n!==nt&&n!==rt;)i.test(D(n,"overflow")+D(n,"overflow-y")+D(n,"overflow-x"))&&e.push(n),n="fixed"===D(n,"position")?null:n.parentNode;null!==n&&e.push($)}else{for(;n&&n!==nt;)"fixed"!==D(t,"position")||X(n)?(i.test(D(n,"overflow")+D(n,"overflow-y")+D(n,"overflow-x"))&&e.push(n),t=n,n=n.parentNode):n=n.parentNode;e[e.length-1]===rt?e[e.length-1]=$:e.push($)}return e}function G(){if(!St)return!0;var t=[0,1].map(function(t,e){return t=nt.createElement("div"),C(t,{position:e?"fixed":"absolute",display:"block",visibility:"hidden",left:e?"0px":"1px",transform:"none"}),t}),e=ot.appendChild(t[0]),i=e.appendChild(t[1]),n=i.getBoundingClientRect().left;C(e,{transform:"scale(1)"});var r=n===i.getBoundingClientRect().left;return ot.removeChild(e),r}function X(t){var e=D(t,"transform"),i=D(t,"display");return"none"!==e&&"inline"!==i&&"none"!==i}function Y(t,e){return Z.doRectsOverlap(t,e)?(tt.min(t.left+t.width,e.left+e.width)-tt.max(t.left,e.left))*(tt.min(t.top+t.height,e.top+e.height)-tt.max(t.top,e.top))/(tt.min(t.width,e.width)*tt.min(t.height,e.height))*100:0}function O(t){var e,i={};for(e=0;e<t.length;e++)i[t[e]._id]=e;return i}function k(t,e,i,n){var r=n[t._id],o=n[e._id];return i?o-r:r-o}function M(t,e,i,n){var r,o,s,a,l,d=0;for(l=0;l<n.length;l++)if(r=n[l][0],o=n[l][1],s=(t._sortData?t:t._refreshSortData())._sortData[r],a=(e._sortData?e:e._refreshSortData())._sortData[r],0!==(d="desc"===o||!o&&i?a<s?-1:a>s?1:0:s<a?-1:s>a?1:0))return d;return d}function N(t,e){var i,n,r,o=[],s=t.concat();for(r=0;r<e.length;r++)i=e[r],(n=s.indexOf(i))>-1&&(o.push(i),s.splice(n,1));return t.splice.apply(t,[0,t.length].concat(o).concat(s)),t}function T(t,e,i){return i.width&&i.height&&t>=i.left&&t<i.left+i.width&&e>=i.top&&e<i.top+i.height}function z(t,e,n,r){var o,s,a=t.getItems(n),l=r||{},d=!0===l.instant,f=l.onFinish,u=l.layout?l.layout:l.layout===i,h=a.length,c="show"===e,_=c?Ct:xt,p=c?At:Ht,g=!1,m=[],y=[];if(h){for(t._emit(_,a.concat()),s=0;s<a.length;s++)o=a[s],(c&&!o._isActive||!c&&o._isActive)&&(g=!0),c&&!o._isActive&&(o._skipNextLayoutAnimation=!0),c&&o._isHidden&&y.push(o),o["_"+e](d,function(e,i){e||m.push(i),--h<1&&(typeof f===st&&f(m.concat()),t._emit(p,m.concat()))});y.length&&t.refreshItems(y),g&&u&&t.layout("instant"===u,typeof u===st?u:i)}else typeof f===st&&f(a);return t}function F(t,e){var i,n="show"===t,r=parseInt(n?e.showDuration:e.hideDuration)||0,o=(n?e.showEasing:e.hideEasing)||"ease",s=n?e.visibleStyles:e.hiddenStyles,a=r>0;return s=_(s)?s:null,{start:function(t,e,n){s?(dt.cancel(ft,t._id),!a||e?(t._animateChild.isAnimating()?t._animateChild.stop(s):C(t._child,s),n&&n()):dt.add(ft,t._id,function(){i=b(t._child,s)},function(){t._animateChild.start(i,s,{duration:r,easing:o,onFinish:n})})):n&&n()},stop:function(t,e){dt.cancel(ft,t._id),t._animateChild.stop(e)}}}function B(t,e,i,n){var r,o,s,a=null,l=e._settings.dragSort,d=!0===l?[e]:l.call(e,t),f=-1;if(!K.isArray(d))return a;for(s=0;s<d.length;s++)(o=d[s])._isDestroyed||(o._refreshDimensions(),(r=Y(i,{width:o._width,height:o._height,left:o._left,top:o._top}))>n&&r>f&&(f=r,a=o));return a}function V(t,e,i){var n,r=t.splice(0,t.length);for(n=0;n<r.length;n++)r[n](e,i)}function Q(t,e){var i;return"inactive"===e?!t.isActive():"hidden"===e?!t.isVisible():(i="is"+e.charAt(0).toUpperCase()+e.slice(1),typeof t[i]===st&&t[i]())}function j(t){t.preventDefault&&t.preventDefault()}function W(t,e){var i=g({},t);return i=e?g(i,e):i,i.visibleStyles=(e||{}).visibleStyles||(t||{}).visibleStyles,i.hiddenStyles=(e||{}).hiddenStyles||(t||{}).hiddenStyles,i}function q(t,e){var i,n=t._drag._startPredicateData;if(!(e.distance<n.distance||n.delay))return i=n.handleElement.getBoundingClientRect(),U(t),T(e.srcEvent.pageX,e.srcEvent.pageY,{width:i.width,height:i.height,left:i.left+($.pageXOffset||0),top:i.top+($.pageYOffset||0)})}function U(t){var e=t._drag._startPredicateData;e&&(e.delayTimer&&(e.delayTimer=$.clearTimeout(e.delayTimer)),t._drag._startPredicateData=null)}function Z(t,e,i,n){var r,o,s,a,l,d,f,u=!!n.fillGaps,h=!!n.horizontal,c=!!n.alignRight,_=!!n.alignBottom,p=!!n.rounding,g={slots:{},width:h?0:p?tt.round(e):e,height:h?p?tt.round(i):i:0,setWidth:h,setHeight:!h},m=[];if(!t.length)return g;for(f=0;f<t.length;f++)l=(a=t[f])._width+a._margin.left+a._margin.right,d=a._height+a._margin.top+a._margin.bottom,p&&(l=tt.round(l),d=tt.round(d)),s=(o=Z.getSlot(g,m,l,d,!h,u))[0],m=o[1],h?g.width=tt.max(g.width,s.left+s.width):g.height=tt.max(g.height,s.top+s.height),g.slots[a._id]=s;if(c||_)for(r=J.keys(g.slots),f=0;f<r.length;f++)s=g.slots[r[f]],c&&(s.left=g.width-(s.left+s.width)),_&&(s.top=g.height-(s.top+s.height));return g}var $=window,J=$.Object,K=$.Array,tt=$.Math,et=$.Error,it=$.Element,nt=$.document,rt=nt.documentElement,ot=nt.body,st="function",at="string",lt="number",dt=function(){function t(){var a,l=+n._maxRafBatchSize||100,d=r.splice(0,tt.min(l,r.length)),f={};for(e=null,a=0;a<d.length;a++)f[d[a]]=o[d[a]],o[d[a]]=i;for(a=0;a<d.length;a++)f[d[a]][0]();for(a=0;a<d.length;a++)f[d[a]][1]();!e&&r.length&&(e=s(t))}var e=null,r=[],o={},s=($.requestAnimationFrame||$.webkitRequestAnimationFrame||$.mozRequestAnimationFrame||$.msRequestAnimationFrame||function(t){return $.setTimeout(t,16)}).bind($);return{add:function(i,n,a,l){var d=r.indexOf(i+n);d>-1&&r.splice(d,1),i===ut||i===ht?r.unshift(i+n):r.push(i+n),o[i+n]=[a,l],!e&&(e=s(t))},cancel:function(t,e){var n=r.indexOf(t+e);n>-1&&(r.splice(n,1),o[t+e]=i)}}}(),ft="visibility",ut="move",ht="scroll",ct=0,_t=1,pt=2,gt=3,mt={},yt={},vt=function(){},Dt=0,wt=function(){var t=it.prototype,e=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector;return function(t,i){return e.call(t,i)}}(),St=function(t){var e,n,r,o=t.charAt(0).toUpperCase()+t.slice(1),s=["","Webkit","Moz","O","ms"];for(r=0;r<s.length;r++)if(e=s[r],n=e?e+o:t,rt.style[n]!==i)return e=e.toLowerCase(),{prefix:e,propName:n,styleName:e?"-"+e+"-"+t:t};return null}("transform"),It=ot?G():null,bt="layoutEnd",Ct="showStart",At="showEnd",xt="hideStart",Ht="hideEnd";return n.Item=r,n.ItemDrag=d,n.ItemRelease=l,n.ItemMigrate=a,n.ItemAnimate=s,n.Layout=function(t,e){var i=this,n=t._settings.layout;e=e.concat(),t._refreshDimensions();var r=t._width-t._border.left-t._border.right,o=t._height-t._border.top-t._border.bottom,s=typeof n===st?n(e,r,o):Z(e,r,o,_(n)?n:{});i.slots=s.slots,i.setWidth=s.setWidth||!1,i.setHeight=s.setHeight||!1,i.width=s.width,i.height=s.height},n.Emitter=o,n.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:!0},layoutOnResize:100,layoutOnInit:!0,layoutDuration:300,layoutEasing:"ease",sortData:null,dragEnabled:!1,dragContainer:null,dragStartPredicate:{distance:0,delay:0,handle:!1},dragAxis:null,dragSort:!0,dragSortInterval:100,dragSortPredicate:{threshold:50,action:"move"},dragReleaseDuration:300,dragReleaseEasing:"ease",dragHammerSettings:{touchAction:"none"},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"},n._maxRafBatchSize=100,n.prototype.on=function(t,e){var i=this;return i._isDestroyed||i._emitter.on(t,e),i},n.prototype.once=function(t,e){var i=this;return i._isDestroyed||i._emitter.once(t,e),i},n.prototype.off=function(t,e){var i=this;return i._isDestroyed||i._emitter.off(t,e),i},n.prototype.getElement=function(){return this._element},n.prototype.getItems=function(t,e){var i=this;if(i._isDestroyed)return[];var n,r,o=0===t||t&&typeof t!==at,s=o?p(t)?H(t):[].concat(t):null,a=o?e:t,l=[];if((a=typeof a===at?a:null)||s){for(s=s||i._items,r=0;r<s.length;r++)!(n=o?i._getItem(s[r]):s[r])||a&&!Q(n,a)||l.push(n);return l}return l.concat(i._items)},n.prototype.refreshItems=function(t){var e=this;if(e._isDestroyed)return e;var i,n=e.getItems(t||"active");for(i=0;i<n.length;i++)n[i]._refreshDimensions();return e},n.prototype.refreshSortData=function(t){var e=this;if(e._isDestroyed)return e;var i,n=e.getItems(t);for(i=0;i<n.length;i++)n[i]._refreshSortData();return e},n.prototype.synchronize=function(){var t=this;if(t._isDestroyed)return t;var e,i,n,r=t._element,o=t._items;if(o.length){for(n=0;n<o.length;n++)(i=o[n]._element).parentNode===r&&(e=e||nt.createDocumentFragment()).appendChild(i);e&&r.appendChild(e)}return t._emit("synchronize"),t},n.prototype.layout=function(t,e){function i(){--_<=0&&(typeof f===st&&f(r._layout!==c,h.concat()),r._layout===c&&r._emit(bt,h.concat()))}var r=this;if(r._isDestroyed)return r;var o,s,a,l,d,f=typeof t===st?t:e,u=!0===t,h=r.getItems("active"),c=r._layout=new n.Layout(r,h),_=h.length;if((c.setWidth||c.setHeight)&&(s={},o="border-box"===D(r._element,"box-sizing"),c.setHeight&&(typeof c.height===lt?s.height=(o?c.height+r._border.top+r._border.bottom:c.height)+"px":s.height=c.height),c.setWidth&&(typeof c.width===lt?s.width=(o?c.width+r._border.left+r._border.right:c.width)+"px":s.width=c.width),C(r._element,s)),r._emit("layoutStart",h.concat()),!h.length)return i(),r;for(d=0;d<h.length;d++)a=h[d],l=c.slots[a._id],a._left=l.left,a._top=l.top,a.isDragging()?i():a._layout(u,i);return r},n.prototype.add=function(t,e){var r=this;if(r._isDestroyed)return[];var o=[].concat(t),s=[];if(!o.length)return s;var a,l,d,f=e||{},u=f.layout?f.layout:f.layout===i,h=r._items,c=!1;for(d=0;d<h.length;d++)if((a=o.indexOf(h[d]._element))>-1&&(o.splice(a,1),!o.length))return s;for(d=0;d<o.length;d++)l=new n.Item(r,o[d]),s.push(l),l._isActive&&(c=!0,l._skipNextLayoutAnimation=!0);return m(h,s,f.index),r._emit("add",s.concat()),c&&u&&r.layout("instant"===u,typeof u===st?u:i),s},n.prototype.remove=function(t,e){var n=this;if(n._isDestroyed)return n;var r,o,s=e||{},a=s.layout?s.layout:s.layout===i,l=!1,d=n.getItems(t);for(o=0;o<d.length;o++)(r=d[o])._isActive&&(l=!0),r._destroy(s.removeElements);return n._emit("remove",d.concat()),l&&a&&n.layout("instant"===a,typeof a===st?a:i),d},n.prototype.show=function(t,e){return this._isDestroyed?this:z(this,"show",t,e)},n.prototype.hide=function(t,e){return this._isDestroyed?this:z(this,"hide",t,e)},n.prototype.filter=function(t,e){var n=this;if(n._isDestroyed||!n._items.length)return n;var r,o,s=n._items,a=typeof t,l=a===at,d=a===st,f=e||{},u=!0===f.instant,h=f.layout?f.layout:f.layout===i,c=typeof f.onFinish===st?f.onFinish:null,_=[],p=[],g=-1,m=c?function(){++g&&c(_.concat(),p.concat())}:vt;if(d||l)for(o=0;o<s.length;o++)r=s[o],(d?t(r):wt(r._element,t))?_.push(r):p.push(r);return _.length?n.show(_,{instant:u,onFinish:m,layout:!1}):m(),p.length?n.hide(p,{instant:u,onFinish:m,layout:!1}):m(),(_.length||p.length)&&(n._emit("filter",_.concat(),p.concat()),h&&n.layout("instant"===h,typeof h===st?h:i)),n},n.prototype.sort=function(t,e){var n=this;if(n._isDestroyed||n._items.length<2)return n;var r,o=n._items,s=e||{},a=!!s.descending,l=s.layout?s.layout:s.layout===i,d=o.concat();if(typeof t===st)o.sort(function(e,i){var n=t(e,i);return(a&&0!==n?-n:n)||k(e,i,a,r||(r=O(d)))});else if(typeof t===at)t=t.trim().split(" ").map(function(t){return t.split(":")}),o.sort(function(e,i){return M(e,i,a,t)||k(e,i,a,r||(r=O(d)))});else{if(!K.isArray(t))return n;N(o,t),a&&o.reverse()}return n._emit("sort",o.concat(),d),l&&n.layout("instant"===l,typeof l===st?l:i),n},n.prototype.move=function(t,e,n){var r=this;if(r._isDestroyed||r._items.length<2)return r;var o,s,a=r._items,l=n||{},d=l.layout?l.layout:l.layout===i,f="swap"===l.action,c=f?"swap":"move",_=r._getItem(t),p=r._getItem(e);return _&&p&&_!==p&&(o=a.indexOf(_),s=a.indexOf(p),(f?u:h)(a,o,s),r._emit("move",{item:_,fromIndex:o,toIndex:s,action:c}),d&&r.layout("instant"===d,typeof d===st?d:i)),r},n.prototype.send=function(t,e,n,r){var o=this;if(o._isDestroyed||e._isDestroyed||o===e||!(t=o._getItem(t)))return o;var s=e,a=r||{},l=a.appendTo||ot,d=a.layoutSender?a.layoutSender:a.layoutSender===i,f=a.layoutReceiver?a.layoutReceiver:a.layoutReceiver===i;return t._migrate.start(s,n,l),t._migrate.isActive&&t.isActive()&&(d&&o.layout("instant"===d,typeof d===st?d:i),f&&s.layout("instant"===f,typeof f===st?f:i)),o},n.prototype.destroy=function(t){var e=this;if(e._isDestroyed)return e;var n,r=e._element,o=e._items.concat();for(e._resizeHandler&&$.removeEventListener("resize",e._resizeHandler),n=0;n<o.length;n++)o[n]._destroy(t);return x(r,e._settings.containerClass),C(r,{height:""}),e._emit("destroy"),e._emitter.destroy(),mt[e._id]=i,e._isDestroyed=!0,e},n.prototype._getItem=function(t){var e,i=this,n=i._items;if(i._isDestroyed||!t)return n[0]||null;if(typeof t===lt)return n[t>-1?t:n.length+t]||null;if(t instanceof r)return t._gridId===i._id?t:null;for(e=0;e<n.length;e++)if(n[e]._element===t)return n[e];return null},n.prototype._emit=function(){var t=this;return t._isDestroyed||t._emitter.emit.apply(t._emitter,arguments),t},n.prototype._refreshDimensions=function(){var t,e=this,i=e._element,n=i.getBoundingClientRect(),r=["left","right","top","bottom"];for(e._width=n.width,e._height=n.height,e._left=n.left,e._top=n.top,e._border={},t=0;t<r.length;t++)e._border[r[t]]=w(i,"border-"+r[t]+"-width");return e},r.prototype.getGrid=function(){return mt[this._gridId]},r.prototype.getElement=function(){return this._element},r.prototype.getWidth=function(){return this._width},r.prototype.getHeight=function(){return this._height},r.prototype.getMargin=function(){return{left:this._margin.left,right:this._margin.right,top:this._margin.top,bottom:this._margin.bottom}},r.prototype.getPosition=function(){return{left:this._left,top:this._top}},r.prototype.isActive=function(){return this._isActive},r.prototype.isVisible=function(){return!this._isHidden},r.prototype.isShowing=function(){return this._isShowing},r.prototype.isHiding=function(){return this._isHiding},r.prototype.isPositioning=function(){return this._isPositioning},r.prototype.isDragging=function(){return!!this._drag&&this._drag._data.isActive},r.prototype.isReleasing=function(){return this._release.isActive},r.prototype.isDestroyed=function(){return this._isDestroyed},r.prototype._refreshDimensions=function(){var t=this;if(t._isDestroyed||t._isHidden)return t;var e,i,n=t._element,r=n.getBoundingClientRect(),o=["left","right","top","bottom"],s=t._margin=t._margin||{};for(t._width=r.width,t._height=r.height,i=0;i<4;i++)e=w(n,"margin-"+o[i]),s[o[i]]=e>0?e:0;return t},r.prototype._refreshSortData=function(){var t=this;if(t._isDestroyed)return t;var e={},i=t.getGrid()._settings.sortData;return i&&J.keys(i).forEach(function(n){e[n]=i[n](t,t._element)}),t._sortData=e,t},r.prototype._layout=function(t,e){var i=this;if(i._isDestroyed)return i;var n,r,o,s,a,l,d=i._element,f=i._isPositioning,u=i._migrate,h=i._release,c=h.isActive&&!1===h.isPositioningStarted,_=i.getGrid()._settings,p=c?_.dragReleaseDuration:_.layoutDuration,g=c?_.dragReleaseEasing:_.layoutEasing,m=!t&&!i._skipNextLayoutAnimation&&p>0;return f&&V(i._layoutQueue,!0,i),c&&(h.isPositioningStarted=!0),typeof e===st&&i._layoutQueue.push(e),r=h.isActive?h.containerDiffX:u.isActive?u.containerDiffX:0,o=h.isActive?h.containerDiffY:u.isActive?u.containerDiffY:0,l={transform:I(i._left+r,i._top+o)},m?(i._isPositioning=!0,dt.add("layout",i._id,function(){s=S(d,"x")-r,a=S(d,"y")-o},function(){if(i._left===s&&i._top===a)return f&&i._stopLayout(!1,l),i._isPositioning=!1,i._finishLayout();!f&&A(d,_.itemPositioningClass),i._animate.start({transform:I(s+r,a+o)},l,{duration:p,easing:g,onFinish:function(){i._finishLayout()}})}),i):(f&&dt.cancel("layout",i._id),n=i._animate.isAnimating(),i._stopLayout(!1,l),!n&&C(d,l),i._skipNextLayoutAnimation=!1,i._finishLayout())},r.prototype._finishLayout=function(){var t=this;return t._isDestroyed?t:(t._isPositioning&&(t._isPositioning=!1,x(t._element,t.getGrid()._settings.itemPositioningClass)),t._release.isActive&&t._release.stop(),t._migrate.isActive&&t._migrate.stop(),V(t._layoutQueue,!1,t),t)},r.prototype._stopLayout=function(t,e){var i=this;return i._isDestroyed||!i._isPositioning?i:(dt.cancel("layout",i._id),i._animate.stop(e),x(i._element,i.getGrid()._settings.itemPositioningClass),i._isPositioning=!1,t&&V(i._layoutQueue,!0,i),i)},r.prototype._show=function(t,e){var i=this;if(i._isDestroyed)return i;var n=i._element,r=i._visibilityQueue,o=typeof e===st?e:null,s=i.getGrid(),a=s._settings;return i._isShowing||i._isHidden?i._isShowing&&!t?(o&&r.push(o),i):(i._isShowing||(V(r,!0,i),x(n,a.itemHiddenClass),A(n,a.itemVisibleClass),!i._isHiding&&C(n,{display:"block"})),o&&r.push(o),i._isActive=i._isShowing=!0,i._isHiding=i._isHidden=!1,t?(s._itemShowHandler.stop(i,a.visibleStyles),i._isShowing=!1,V(r,!1,i)):s._itemShowHandler.start(i,t,function(){i._isHidden||(i._isShowing=!1,V(r,!1,i))}),i):(o&&o(!1,i),i)},r.prototype._hide=function(t,e){var i=this;if(i._isDestroyed)return i;var n=i._element,r=i._visibilityQueue,o=typeof e===st?e:null,s=i.getGrid(),a=s._settings;return!i._isHiding&&i._isHidden?(o&&o(!1,i),i):i._isHiding&&!t?(o&&r.push(o),i):(i._isHiding||(V(r,!0,i),A(n,a.itemHiddenClass),x(n,a.itemVisibleClass)),o&&r.push(o),i._isHidden=i._isHiding=!0,i._isActive=i._isShowing=!1,t?(s._itemHideHandler.stop(i,a.hiddenStyles),i._isHiding=!1,i._stopLayout(!0,{transform:I(0,0)}),C(n,{display:"none"}),V(r,!1,i)):s._itemHideHandler.start(i,t,function(){i._isHidden&&(i._isHiding=!1,i._stopLayout(!0,{transform:I(0,0)}),C(n,{display:"none"}),V(r,!1,i))}),i)},r.prototype._destroy=function(t){var e=this;if(e._isDestroyed)return e;var n=e._element,r=e.getGrid(),o=r._settings,s=r._items.indexOf(e);return e._release.destroy(),e._migrate.destroy(),e._stopLayout(!0,{}),r._itemShowHandler.stop(e,{}),r._itemHideHandler.stop(e,{}),e._drag&&e._drag.destroy(),e._animate.destroy(),e._animateChild.destroy(),V(e._visibilityQueue,!0,e),n.removeAttribute("style"),e._child.removeAttribute("style"),x(n,o.itemPositioningClass),x(n,o.itemDraggingClass),x(n,o.itemReleasingClass),x(n,o.itemClass),x(n,o.itemVisibleClass),x(n,o.itemHiddenClass),s>-1&&r._items.splice(s,1),t&&n.parentNode.removeChild(n),yt[e._id]=i,e._isActive=e._isPositioning=e._isHiding=e._isShowing=!1,e._isDestroyed=e._isHidden=!0,e},o.prototype.on=function(t,e){var i=this;if(i._isDestroyed)return i;var n=i._events[t]||[];return n.push(e),i._events[t]=n,i},o.prototype.once=function(t,e){var i=this;return this.on(t,function n(){i.off(t,n),e.apply(null,arguments)})},o.prototype.off=function(t,e){var i=this;if(i._isDestroyed)return i;for(var n=i._events[t]||[],r=n.length;r--;)e===n[r]&&n.splice(r,1);return i},o.prototype.emit=function(t,e,i,n){var r=this;if(r._isDestroyed)return r;var o,s=r._events[t]||[],a=s.length,l=arguments.length-1;if(a)for(s=s.concat(),o=0;o<a;o++)0===l?s[o]():1===l?s[o](e):2===l?s[o](e,i):s[o](e,i,n);return r},o.prototype.destroy=function(){var t=this;if(t._isDestroyed)return t;var e,i=J.keys(t._events);for(e=0;e<i.length;e++)t._events[i[e]]=null;return t._isDestroyed=!0,t},s.prototype.start=function(t,e,i){var n=this;if(!n._isDestroyed){var r=i||{},o=typeof r.onFinish===st?r.onFinish:null;if(n._animation){if(!J.keys(e).some(function(t){return e[t]!==n._propsTo[t]}))return void(n._animation.onfinish=function(){n._animation=n._propsTo=null,o&&o()});n._animation.cancel()}n._propsTo=e,n._animation=n._element.animate([t,e],{duration:r.duration||300,easing:r.easing||"ease"}),n._animation.onfinish=function(){n._animation=n._propsTo=null,o&&o()},C(n._element,e)}},s.prototype.stop=function(t){var e=this;!e._isDestroyed&&e._animation&&(C(e._element,t||b(e._element,e._propsTo)),e._animation.cancel(),e._animation=e._propsTo=null)},s.prototype.isAnimating=function(){return!!this._animation},s.prototype.destroy=function(){var t=this;t._isDestroyed||(t.stop(),t._item=t._element=null,t._isDestroyed=!0)},a.prototype.destroy=function(){var t=this;return t._isDestroyed||(t.stop(!0),t._isDestroyed=!0),t},a.prototype.getItem=function(){return yt[this._itemId]||null},a.prototype.start=function(t,e,r){var o=this;if(o._isDestroyed)return o;var s,a,l,d,u,h=o.getItem(),c=h._element,_=h.isVisible(),p=h.getGrid(),g=p._settings,y=t._settings,v=t._element,D=p._items.indexOf(h),w=typeof e===lt?e:t._items.indexOf(t._getItem(e)),b=r||ot;return null===w?o:(w=f(t._items,w,!0),(h.isPositioning()||o.isActive||h.isReleasing())&&(d=S(c,"x"),u=S(c,"y")),h.isPositioning()&&h._stopLayout(!0,{transform:I(d,u)}),o.isActive&&(d-=o.containerDiffX,u-=o.containerDiffY,o.stop(!0,{transform:I(d,u)})),h.isReleasing()&&(d-=h._release.containerDiffX,u-=h._release.containerDiffY,h._release.stop(!0,{transform:I(d,u)})),p._itemShowHandler.stop(h),p._itemHideHandler.stop(h),h._drag&&h._drag.destroy(),h._animate.destroy(),h._animateChild.destroy(),V(h._visibilityQueue,!0,h),p._emit("beforeSend",{item:h,fromGrid:p,fromIndex:D,toGrid:t,toIndex:w}),t._emit("beforeReceive",{item:h,fromGrid:p,fromIndex:D,toGrid:t,toIndex:w}),x(c,g.itemClass),x(c,g.itemVisibleClass),x(c,g.itemHiddenClass),A(c,y.itemClass),A(c,_?y.itemVisibleClass:y.itemHiddenClass),p._items.splice(D,1),m(t._items,h,w),h._gridId=t._id,h._animate=new n.ItemAnimate(h,c),h._animateChild=new n.ItemAnimate(h,h._child),s=c.parentNode,b!==s&&(b.appendChild(c),a=E(b,s,!0),d===i&&(d=S(c,"x"),u=S(c,"y")),C(c,{transform:I(d+a.left,u+a.top)})),h._child.removeAttribute("style"),_?t._itemShowHandler.start(h,!0):t._itemHideHandler.start(h,!0),C(c,{display:_?"block":"hidden"}),l=E(b,v,!0),h._refreshDimensions()._refreshSortData(),h._drag=y.dragEnabled?new n.ItemDrag(h):null,o.isActive=!0,o.container=b,o.containerDiffX=l.left,o.containerDiffY=l.top,p._emit("send",{item:h,fromGrid:p,fromIndex:D,toGrid:t,toIndex:w}),t._emit("receive",{item:h,fromGrid:p,fromIndex:D,toGrid:t,toIndex:w}),o)},a.prototype.stop=function(t,e){var i=this;if(i._isDestroyed||!i.isActive)return i;var n=i.getItem(),r=n._element,o=n.getGrid()._element;return i.container!==o&&(e||(e={transform:I(t?S(r,"x")-i.containerDiffX:n._left,t?S(r,"y")-i.containerDiffY:n._top)}),o.appendChild(r),C(r,e)),i.isActive=!1,i.container=null,i.containerDiffX=0,i.containerDiffY=0,i},l.prototype.destroy=function(){var t=this;return t._isDestroyed||(t.stop(!0),t._isDestroyed=!0),t},l.prototype.getItem=function(){return yt[this._itemId]||null},l.prototype.reset=function(){var t=this;if(t._isDestroyed)return t;var e=t.getItem();return t.isActive=!1,t.isPositioningStarted=!1,t.containerDiffX=0,t.containerDiffY=0,x(e._element,e.getGrid()._settings.itemReleasingClass),t},l.prototype.start=function(){var t=this;if(t._isDestroyed||t.isActive)return t;var e=t.getItem(),i=e.getGrid();return t.isActive=!0,A(e._element,i._settings.itemReleasingClass),i._emit("dragReleaseStart",e),e._layout(!1),t},l.prototype.stop=function(t,e){var i=this;if(i._isDestroyed||!i.isActive)return i;var n=i.getItem(),r=n._element,o=n.getGrid(),s=o._element,a=i.containerDiffX,l=i.containerDiffY;return i.reset(),r.parentNode!==s&&(e||(e={transform:I(t?S(r,"x")-a:n._left,t?S(r,"y")-l:n._top)}),s.appendChild(r),C(r,e)),t||o._emit("dragReleaseEnd",n),i},d.defaultStartPredicate=function(t,e,i){var n,r,o,s,a=t._element,l=t._drag._startPredicateData;if(l||(n=_(n=i||t._drag.getGrid()._settings.dragStartPredicate)?n:{},l=t._drag._startPredicateData={distance:tt.abs(n.distance)||0,delay:tt.max(n.delay,0)||0,handle:"string"==typeof n.handle&&n.handle}),e.isFinal)return r="a"===a.tagName.toLowerCase(),o=a.getAttribute("href"),s=a.getAttribute("target"),U(t),void(r&&o&&tt.abs(e.deltaX)<2&&tt.abs(e.deltaY)<2&&e.deltaTime<200&&(s&&"_self"!==s?$.open(o,s):$.location.href=o));if(!l.handleElement)if(l.handle){for(l.handleElement=e.srcEvent.target;l.handleElement&&!wt(l.handleElement,l.handle);)l.handleElement=l.handleElement!==a?l.handleElement.parentElement:null;if(!l.handleElement)return!1}else l.handleElement=a;return l.delay&&(l.event=e,l.delayTimer||(l.delayTimer=$.setTimeout(function(){l.delay=0,q(t,l.event)&&(t._drag._resolveStartPredicate(l.event),U(t))},l.delay))),q(t,e)},d.defaultSortPredicate=function(t){var e,i,n,r,o,s=t._drag,a=s._data,l=s.getGrid(),d=l._settings.dragSortPredicate||{},f=d.threshold||50,u=d.action||"move",h={width:t._width,height:t._height,left:a.elementClientX,top:a.elementClientY},c=B(t,l,h,f),_=0,p=0,g=-1;if(!c)return!1;for(c===l?(h.left=a.gridX+t._margin.left,h.top=a.gridY+t._margin.top):(_=c._left+c._border.left,p=c._top+c._border.top),o=0;o<c._items.length;o++)(n=c._items[o])._isActive&&n!==t&&(i=!0,(r=Y(h,{width:n._width,height:n._height,left:n._left+n._margin.left+_,top:n._top+n._margin.top+p}))>g&&(e=o,g=r));return g<f&&t.getGrid()!==c&&(e=i?-1:0,g=1/0),g>=f&&{grid:c,index:e,action:u}},d.prototype.destroy=function(){var t=this;return t._isDestroyed||(t.stop(),t._hammer.destroy(),t.getItem()._element.removeEventListener("dragstart",j,!1),t._isDestroyed=!0),t},d.prototype.getItem=function(){return yt[this._itemId]||null},d.prototype.getGrid=function(){return mt[this._gridId]||null},d.prototype.reset=function(){var t=this,e=t._data;return e.isActive=!1,e.container=null,e.containingBlock=null,e.startEvent=null,e.currentEvent=null,e.scrollers=[],e.left=0,e.top=0,e.gridX=0,e.gridY=0,e.elementClientX=0,e.elementClientY=0,e.containerDiffX=0,e.containerDiffY=0,t},d.prototype.bindScrollListeners=function(){var t,e=this,i=e.getGrid()._element,n=e._data.container,r=P(e.getItem()._element);for(n!==i&&(r=c(r.concat(i).concat(P(i)))),t=0;t<r.length;t++)r[t].addEventListener("scroll",e._scrollListener);return e._data.scrollers=r,e},d.prototype.unbindScrollListeners=function(){var t,e=this,i=e._data,n=i.scrollers;for(t=0;t<n.length;t++)n[t].removeEventListener("scroll",e._scrollListener);return i.scrollers=[],e},d.prototype.checkOverlap=function(){var t,e,i,n,r,o,s=this,a=s.getItem(),l=s._sortPredicate(a,s._data.currentEvent);return _(l)&&typeof l.index===lt?(t=a.getGrid(),i=l.grid||t,o=t!==i,e=t._items.indexOf(a),n=f(t._items,l.index,o),r="swap"===l.action?"swap":"move",o?(t._emit("beforeSend",{item:a,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),i._emit("beforeReceive",{item:a,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),a._gridId=i._id,s._isMigrating=a._gridId!==s._gridId,t._items.splice(e,1),m(i._items,a,n),a._sortData=null,t._emit("send",{item:a,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),i._emit("receive",{item:a,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),t.layout(),i.layout()):e!==n&&(("swap"===r?u:h)(t._items,e,n),t._emit("move",{item:a,fromIndex:e,toIndex:n,action:r}),t.layout()),s):s},d.prototype.finishMigration=function(){var t,e,i,r=this,o=r.getItem(),s=o._release,a=o._element,l=o.getGrid(),d=l._element,f=l._settings,u=f.dragContainer||d,h=r.getGrid()._settings,c=a.parentNode;return r._isMigrating=!1,r.destroy(),o._animate.destroy(),o._animateChild.destroy(),x(a,h.itemClass),x(a,h.itemVisibleClass),x(a,h.itemHiddenClass),A(a,f.itemClass),A(a,f.itemVisibleClass),o._animate=new n.ItemAnimate(o,a),o._animateChild=new n.ItemAnimate(o,o._child),u!==c&&(u.appendChild(a),i=E(c,u,!0),t=S(a,"x")-i.left,e=S(a,"y")-i.top),o._refreshDimensions()._refreshSortData(),i=E(u,d,!0),s.containerDiffX=i.left,s.containerDiffY=i.top,o._drag=f.dragEnabled?new n.ItemDrag(o):null,u!==c&&C(a,{transform:I(t,e)}),o._child.removeAttribute("style"),l._itemShowHandler.start(o,!0),s.start(),r},d.prototype.cancelRafLoop=function(){var t=this.getItem()._id;return dt.cancel(ht,t),dt.cancel(ut,t),this},d.prototype.stop=function(){var t=this,e=t._data,i=t.getItem()._element,n=t.getGrid();return e.isActive?t._isMigrating?t.finishMigration(e.currentEvent):(t.cancelRafLoop(),t.unbindScrollListeners(),t._checkSortOverlap("cancel"),i.parentNode!==n._element&&(n._element.appendChild(i),C(i,{transform:I(e.gridX,e.gridY)})),x(i,n._settings.itemDraggingClass),t.reset(),t):t},d.prototype.onStart=function(t){var e=this,i=e.getItem();if(!i._isActive)return e;var n=i._element,r=e.getGrid(),o=r._settings,s=e._data,a=i._release,l=i._migrate,d=r._element,f=o.dragContainer||d,u=L(f,!0),h=f!==d?E(u,d):0,c=S(n,"x"),_=S(n,"y"),p=n.getBoundingClientRect();return i.isPositioning()&&i._stopLayout(!0,{transform:I(c,_)}),l.isActive&&(c-=l.containerDiffX,_-=l.containerDiffY,l.stop(!0,{transform:I(c,_)})),i.isReleasing()&&a.reset(),s.isActive=!0,s.startEvent=s.currentEvent=t,s.container=f,s.containingBlock=u,s.elementClientX=p.left,s.elementClientY=p.top,s.left=s.gridX=c,s.top=s.gridY=_,r._emit("dragInit",i,t),f!==d&&(s.containerDiffX=h.left,s.containerDiffY=h.top,n.parentNode===f?(s.gridX=c-s.containerDiffX,s.gridY=_-s.containerDiffY):(s.left=c+s.containerDiffX,s.top=_+s.containerDiffY,f.appendChild(n),C(n,{transform:I(s.left,s.top)}))),A(n,o.itemDraggingClass),e.bindScrollListeners(),r._emit("dragStart",i,t),e},d.prototype.onMove=function(t){var e=this,i=e.getItem();if(!i._isActive)return e.stop();var n=i._element,r=e.getGrid(),o=r._settings,s=e._data,a=o.dragAxis,l=t.deltaX-s.currentEvent.deltaX,d=t.deltaY-s.currentEvent.deltaY;return dt.add(ut,i._id,function(){s.currentEvent=t,"y"!==a&&(s.left+=l,s.gridX+=l,s.elementClientX+=l),"x"!==a&&(s.top+=d,s.gridY+=d,s.elementClientY+=d),o.dragSort&&e._checkSortOverlap()},function(){C(n,{transform:I(s.left,s.top)}),r._emit("dragMove",i,t)}),e},d.prototype.onScroll=function(t){var e,i,n,r,o=this,s=o.getItem(),a=s._element,l=o.getGrid(),d=l._settings,f=d.dragAxis,u=o._data,h=l._element;return dt.add(ht,s._id,function(){e=a.getBoundingClientRect(),i=u.elementClientX-e.left,n=u.elementClientY-e.top,u.container!==h&&(r=E(u.containingBlock,h),u.containerDiffX=r.left,u.containerDiffY=r.top),"y"!==f&&(u.left+=i,u.gridX=u.left-u.containerDiffX),"x"!==f&&(u.top+=n,u.gridY=u.top-u.containerDiffY),d.dragSort&&o._checkSortOverlap()},function(){C(a,{transform:I(u.left,u.top)}),l._emit("dragScroll",s,t)}),o},d.prototype.onEnd=function(t){var e=this,i=e.getItem(),n=i._element,r=e.getGrid(),o=r._settings,s=e._data,a=i._release;return i._isActive?(e.cancelRafLoop(),o.dragSort&&e._checkSortOverlap("finish"),e.unbindScrollListeners(),a.containerDiffX=s.containerDiffX,a.containerDiffY=s.containerDiffY,e.reset(),x(n,o.itemDraggingClass),r._emit("dragEnd",i,t),e._isMigrating?e.finishMigration():a.start(),e):e.stop()},Z.getSlot=function(t,e,i,n,r,o){var s,a,l,d,f,u=[],h={left:null,top:null,width:i,height:n};for(d=0;d<e.length;d++)if(s=e[d],h.width<=s.width+.001&&h.height<=s.height+.001){h.left=s.left,h.top=s.top;break}for(null===h.left&&(h.left=r?0:t.width,h.top=r?t.height:0,o||(l=!0)),r&&h.top+h.height>t.height&&(h.left>0&&u.push({left:0,top:t.height,width:h.left,height:1/0}),h.left+h.width<t.width&&u.push({left:h.left+h.width,top:t.height,width:t.width-h.left-h.width,height:1/0}),t.height=h.top+h.height),!r&&h.left+h.width>t.width&&(h.top>0&&u.push({left:t.width,top:0,width:1/0,height:h.top}),h.top+h.height<t.height&&u.push({left:t.width,top:h.top+h.height,width:1/0,height:t.height-h.top-h.height}),t.width=h.left+h.width),d=o?0:l?e.length:d;d<e.length;d++)for(a=Z.splitRect(e[d],h),f=0;f<a.length;f++)(s=a[f]).width>.49&&s.height>.49&&(r&&s.top<t.height||!r&&s.left<t.width)&&u.push(s);return u.length&&(u=Z.purgeRects(u).sort(r?Z.sortRectsTopLeft:Z.sortRectsLeftTop)),[h,u]},Z.splitRect=function(t,e){var i=[];return Z.doRectsOverlap(t,e)?(t.left<e.left&&i.push({left:t.left,top:t.top,width:e.left-t.left,height:t.height}),t.left+t.width>e.left+e.width&&i.push({left:e.left+e.width,top:t.top,width:t.left+t.width-(e.left+e.width),height:t.height}),t.top<e.top&&i.push({left:t.left,top:t.top,width:t.width,height:e.top-t.top}),t.top+t.height>e.top+e.height&&i.push({left:t.left,top:e.top+e.height,width:t.width,height:t.top+t.height-(e.top+e.height)}),i):[{left:t.left,top:t.top,width:t.width,height:t.height}]},Z.doRectsOverlap=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)},Z.isRectWithinRect=function(t,e){return t.left>=e.left&&t.top>=e.top&&t.left+t.width<=e.left+e.width&&t.top+t.height<=e.top+e.height},Z.purgeRects=function(t){for(var e,i,n,r=t.length;r--;)for(i=t[r],e=t.length;e--;)if(n=t[e],r!==e&&Z.isRectWithinRect(i,n)){t.splice(r,1);break}return t},Z.sortRectsTopLeft=function(t,e){return t.top-e.top||t.left-e.left},Z.sortRectsLeftTop=function(t,e){return t.left-e.left||t.top-e.top},n});
!function(t,e){var i;if("object"==typeof module&&module.exports){try{i=require("hammerjs")}catch(t){}module.exports=e("Muuri",i)}else"function"==typeof define&&define.amd?define(["hammerjs"],function(t){return e("Muuri",t)}):t.Muuri=e("Muuri",t.Hammer)}("undefined"!=typeof window?window:this,function(t,e,i){"use strict";function n(t,e){var i,r,s,o=this;if(J||(J=document.body,gt=P()),t=o._element=typeof t===tt?Z.querySelector(t):t,!J.contains(t))throw new q("Container element must be an existing DOM element");typeof(i=o._settings=function(t,e){var i=p({},t);return i=e?p(i,e):i,i.visibleStyles=(e||{}).visibleStyles||(t||{}).visibleStyles,i.hiddenStyles=(e||{}).hiddenStyles||(t||{}).hiddenStyles,i}(n.defaultOptions,e)).dragSort!==K&&(i.dragSort=!!i.dragSort),ft[o._id=++ct]=o,o._isDestroyed=!1,o._layout=null,o._emitter=new n.Emitter,o._itemShowHandler=M("show",i),o._itemHideHandler=M("hide",i),b(t,i.containerClass),o._items=[],typeof(r=i.items)===tt?x(o._element.children).forEach(function(t){("*"===r||_t(t,r))&&o._items.push(new n.Item(o,t))}):(j.isArray(r)||_(r))&&(o._items=x(r).map(function(t){return new n.Item(o,t)})),(s=!0===(s=i.layoutOnResize)?0:typeof s===et?s:-1)>=0&&V.addEventListener("resize",o._resizeHandler=m(function(){o.refreshItems().layout()},s)),i.layoutOnInit&&o.layout(!0)}function r(t,e){var i,r=t._settings;this._id=++ct,ut[this._id]=this,this._isDestroyed=!1,e.parentNode!==t._element&&t._element.appendChild(e),b(e,r.itemClass),b(e,(i="none"===v(e,"display"))?r.itemHiddenClass:r.itemVisibleClass),this._gridId=t._id,this._element=e,this._child=e.children[0],this._animate=new n.ItemAnimate(this,e),this._animateChild=new n.ItemAnimate(this,this._child),this._isActive=!i,this._isPositioning=!1,this._isHidden=i,this._isHiding=!1,this._isShowing=!1,this._visibilityQueue=[],this._layoutQueue=[],this._left=0,this._top=0,C(e,{left:"0",top:"0",transform:S(0,0),display:i?"none":"block"}),this._refreshDimensions()._refreshSortData(),i?t._itemHideHandler.start(this,!0):t._itemShowHandler.start(this,!0),this._migrate=new n.ItemMigrate(this),this._release=new n.ItemRelease(this),this._drag=r.dragEnabled?new n.ItemDrag(this):null}function s(){this._events={},this._isDestroyed=!1}function o(t,e){this._item=t,this._element=e,this._animation=null,this._propsTo=null,this._isDestroyed=!1}function a(t){this._itemId=t._id,this._isDestroyed=!1,this.isActive=!1,this.container=!1,this.containerDiffX=0,this.containerDiffY=0}function h(t){this._itemId=t._id,this._isDestroyed=!1,this.isActive=!1,this.isPositioningStarted=!1,this.containerDiffX=0,this.containerDiffY=0}function l(i){if(!e)throw new q("["+t+"] required dependency Hammer is not defined.");var n,r,s=this,o=i._element,a=i.getGrid(),h=a._settings,d=typeof h.dragStartPredicate===K?h.dragStartPredicate:l.defaultStartPredicate,f=at;s._itemId=i._id,s._gridId=a._id,s._hammer=n=new e.Manager(o),s._isDestroyed=!1,s._isMigrating=!1,s._data={},s._resolveStartPredicate=function(t){s._isDestroyed||f!==ht||(f=lt,s.onStart(t))},s._scrollListener=function(t){s.onScroll(t)},s._checkSortOverlap=m(function(){s._data.isActive&&s.checkOverlap()},h.dragSortInterval),s._sortPredicate=typeof h.dragSortPredicate===K?h.dragSortPredicate:l.defaultSortPredicate,s.reset(),n.add(new e.Pan({event:"drag",pointers:1,threshold:0,direction:e.DIRECTION_ALL})),n.add(new e.Press({event:"draginit",pointers:1,threshold:1e3,time:0})),c(h.dragHammerSettings)&&n.set(h.dragHammerSettings),n.on("draginit dragstart dragmove",function(t){f===at&&(f=ht),f===ht?!0===(r=d(s.getItem(),t))?(f=lt,s.onStart(t)):!1===r&&(f=dt):f===lt&&s._data.isActive&&s.onMove(t)}).on("dragend dragcancel draginitup",function(t){var e=f===lt;d(s.getItem(),t),f=at,e&&s._data.isActive&&s.onEnd(t)}),o.addEventListener("dragstart",T,!1)}function d(t,e,i){var n=t.length,r=W.max(0,i?n:n-1);return e>r?r:e<0?W.max(r+e+1,0):e}function f(t,e,i){if(!(t.length<2)){var n,r=d(t,e),s=d(t,i);r!==s&&(n=t[r],t[r]=t[s],t[s]=n)}}function u(t,e,i){if(!(t.length<2)){var n=d(t,e),r=d(t,i);n!==r&&t.splice(r,0,t.splice(n,1)[0])}}function c(t){return"object"==typeof t&&"[object Object]"===Q.prototype.toString.call(t)}function _(t){var e=Q.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e}function p(t,e){return Q.keys(e).forEach(function(i){var n=c(e[i]);c(t[i])&&n?(t[i]=p({},t[i]),t[i]=p(t[i],e[i])):t[i]=n?p({},e[i]):j.isArray(e[i])?e[i].concat():e[i]}),t}function g(t,e,i){var n=typeof i===et?i:-1;t.splice.apply(t,[n<0?t.length-n+1:n,0].concat(e))}function m(t,e){var n;return e>0?function(r){n!==i&&(n=V.clearTimeout(n),"finish"===r&&t()),"cancel"!==r&&"finish"!==r&&(n=V.setTimeout(function(){n=i,t()},e))}:function(e){"cancel"!==e&&t()}}function y(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function v(t,e){return V.getComputedStyle(t,null).getPropertyValue("transform"===e?pt.styleName||e:e)}function D(t,e){return parseFloat(v(t,e))||0}function w(t,e){return parseFloat((v(t,"transform")||"").replace("matrix(","").split(",")["x"===e?4:5])||0}function S(t,e){return"translateX("+t+"px) translateY("+e+"px)"}function I(t,e){var i,n={},r=Q.keys(e);for(i=0;i<r.length;i++)n[r[i]]=v(t,y(r[i]));return n}function C(t,e){var i,n=Q.keys(e);for(i=0;i<n.length;i++)t.style["transform"===n[i]&&pt?pt.propName:n[i]]=e[n[i]]}function b(t,e){t.classList?t.classList.add(e):_t(t,"."+e)||(t.className+=" "+e)}function A(t,e){t.classList?t.classList.remove(e):_t(t,"."+e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim())}function x(t){return[].slice.call(t)}function H(t,e,i){if(t===e)return{left:0,top:0};i&&(t=R(t,!0),e=R(e,!0));var n=E(t,!0),r=E(e,!0);return{left:r.left-n.left,top:r.top-n.top}}function E(t,e){var i,n={left:0,top:0};return t===Z?n:(n.left=V.pageXOffset||0,n.top=V.pageYOffset||0,t.self===V.self?n:(i=t.getBoundingClientRect(),n.left+=i.left,n.top+=i.top,e&&(n.left+=D(t,"border-left-width"),n.top+=D(t,"border-top-width")),n))}function R(t,e){for(var i=(e?t:t.parentElement)||Z;i&&i!==Z&&"static"===v(i,"position")&&!G(i);)i=i.parentElement||Z;return i}function L(t){var e=[],i=/(auto|scroll)/,n=t.parentNode;if(gt){if("fixed"===v(t,"position"))return e;for(;n&&n!==Z&&n!==$;)i.test(v(n,"overflow")+v(n,"overflow-y")+v(n,"overflow-x"))&&e.push(n),n="fixed"===v(n,"position")?null:n.parentNode;null!==n&&e.push(V)}else{for(;n&&n!==Z;)"fixed"!==v(t,"position")||G(n)?(i.test(v(n,"overflow")+v(n,"overflow-y")+v(n,"overflow-x"))&&e.push(n),t=n,n=n.parentNode):n=n.parentNode;e[e.length-1]===$?e[e.length-1]=V:e.push(V)}return e}function P(){if(!pt)return!0;var t=[0,1].map(function(t,e){return t=Z.createElement("div"),C(t,{position:e?"fixed":"absolute",display:"block",visibility:"hidden",left:e?"0px":"1px",transform:"none"}),t}),e=J.appendChild(t[0]),i=e.appendChild(t[1]),n=i.getBoundingClientRect().left;C(e,{transform:"scale(1)"});var r=n===i.getBoundingClientRect().left;return J.removeChild(e),r}function G(t){var e=v(t,"transform"),i=v(t,"display");return"none"!==e&&"inline"!==i&&"none"!==i}function X(t,e){if(!B.doRectsOverlap(t,e))return 0;return(W.min(t.left+t.width,e.left+e.width)-W.max(t.left,e.left))*(W.min(t.top+t.height,e.top+e.height)-W.max(t.top,e.top))/(W.min(t.width,e.width)*W.min(t.height,e.height))*100}function Y(t){var e,i={};for(e=0;e<t.length;e++)i[t[e]._id]=e;return i}function O(t,e,i,n){var r=n[t._id],s=n[e._id];return i?s-r:r-s}function k(t,e,n,r){var s,o,a=t.getItems(n),h=r||{},l=!0===h.instant,d=h.onFinish,f=h.layout?h.layout:h.layout===i,u=a.length,c="show"===e,_=c?yt:Dt,p=c?vt:wt,g=!1,m=[],y=[];if(u){for(t._emit(_,a.concat()),o=0;o<a.length;o++)s=a[o],(c&&!s._isActive||!c&&s._isActive)&&(g=!0),c&&!s._isActive&&(s._skipNextLayoutAnimation=!0),c&&s._isHidden&&y.push(s),s["_"+e](l,function(e,i){e||m.push(i),--u<1&&(typeof d===K&&d(m.concat()),t._emit(p,m.concat()))});y.length&&t.refreshItems(y),g&&f&&t.layout("instant"===f,typeof f===K?f:i)}else typeof d===K&&d(a);return t}function M(t,e){var i,n="show"===t,r=parseInt(n?e.showDuration:e.hideDuration)||0,s=(n?e.showEasing:e.hideEasing)||"ease",o=n?e.visibleStyles:e.hiddenStyles,a=r>0;return o=c(o)?o:null,{start:function(t,e,n){o?(it.cancel(rt,t._id),!a||e?(t._animateChild.isAnimating()?t._animateChild.stop(o):C(t._child,o),n&&n()):it.add(rt,t._id,function(){i=I(t._child,o)},function(){t._animateChild.start(i,o,{duration:r,easing:s,onFinish:n})})):n&&n()},stop:function(t,e){it.cancel(rt,t._id),t._animateChild.stop(e)}}}function N(t,e,i){var n,r=t.splice(0,t.length);for(n=0;n<r.length;n++)r[n](e,i)}function T(t){t.preventDefault&&t.preventDefault()}function z(t,e){var i,n=t._drag._startPredicateData;if(!(e.distance<n.distance||n.delay))return i=n.handleElement.getBoundingClientRect(),F(t),function(t,e,i){return i.width&&i.height&&t>=i.left&&t<i.left+i.width&&e>=i.top&&e<i.top+i.height}(e.srcEvent.pageX,e.srcEvent.pageY,{width:i.width,height:i.height,left:i.left+(V.pageXOffset||0),top:i.top+(V.pageYOffset||0)})}function F(t){var e=t._drag._startPredicateData;e&&(e.delayTimer&&(e.delayTimer=V.clearTimeout(e.delayTimer)),t._drag._startPredicateData=null)}function B(t,e,i,n){var r,s,o,a,h,l,d,f=!!n.fillGaps,u=!!n.horizontal,c=!!n.alignRight,_=!!n.alignBottom,p=!!n.rounding,g={slots:{},width:u?0:p?W.round(e):e,height:u?p?W.round(i):i:0,setWidth:u,setHeight:!u},m=[];if(!t.length)return g;for(d=0;d<t.length;d++)h=(a=t[d])._width+a._margin.left+a._margin.right,l=a._height+a._margin.top+a._margin.bottom,p&&(h=W.round(h),l=W.round(l)),o=(s=B.getSlot(g,m,h,l,!u,f))[0],m=s[1],u?g.width=W.max(g.width,o.left+o.width):g.height=W.max(g.height,o.top+o.height),g.slots[a._id]=o;if(c||_)for(r=Q.keys(g.slots),d=0;d<r.length;d++)o=g.slots[r[d]],c&&(o.left=g.width-(o.left+o.width)),_&&(o.top=g.height-(o.top+o.height));return g}var V=window,Q=V.Object,j=V.Array,W=V.Math,q=V.Error,U=V.Element,Z=V.document,$=Z.documentElement,J=Z.body,K="function",tt="string",et="number",it=function(){function t(){var a,h=+n._maxRafBatchSize||100,l=r.splice(0,W.min(h,r.length)),d={};for(e=null,a=0;a<l.length;a++)d[l[a]]=s[l[a]],s[l[a]]=i;for(a=0;a<l.length;a++)d[l[a]][0]();for(a=0;a<l.length;a++)d[l[a]][1]();!e&&r.length&&(e=o(t))}var e=null,r=[],s={},o=(V.requestAnimationFrame||V.webkitRequestAnimationFrame||V.mozRequestAnimationFrame||V.msRequestAnimationFrame||function(t){return V.setTimeout(t,16)}).bind(V);return{add:function(i,n,a,h){var l=r.indexOf(i+n);l>-1&&r.splice(l,1),i===st||i===ot?r.unshift(i+n):r.push(i+n),s[i+n]=[a,h],!e&&(e=o(t))},cancel:function(t,e){var n=r.indexOf(t+e);n>-1&&(r.splice(n,1),s[t+e]=i)}}}(),nt="layout",rt="visibility",st="move",ot="scroll",at=0,ht=1,lt=2,dt=3,ft={},ut={},ct=0,_t=function(){var t=U.prototype,e=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector;return function(t,i){return e.call(t,i)}}(),pt=function(t){var e,n,r,s=t.charAt(0).toUpperCase()+t.slice(1),o=["","Webkit","Moz","O","ms"];for(r=0;r<o.length;r++)if(e=o[r],n=e?e+s:t,$.style[n]!==i)return e=e.toLowerCase(),{prefix:e,propName:n,styleName:e?"-"+e+"-"+t:t};return null}("transform"),gt=J?P():null,mt="layoutEnd",yt="showStart",vt="showEnd",Dt="hideStart",wt="hideEnd",St="beforeSend",It="beforeReceive";return n.Item=r,n.ItemDrag=l,n.ItemRelease=h,n.ItemMigrate=a,n.ItemAnimate=o,n.Layout=function(t,e){var i=t._settings.layout;e=e.concat(),t._refreshDimensions();var n=t._width-t._border.left-t._border.right,r=t._height-t._border.top-t._border.bottom,s=typeof i===K?i(e,n,r):B(e,n,r,c(i)?i:{});this.slots=s.slots,this.setWidth=s.setWidth||!1,this.setHeight=s.setHeight||!1,this.width=s.width,this.height=s.height},n.Emitter=s,n.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:!0},layoutOnResize:100,layoutOnInit:!0,layoutDuration:300,layoutEasing:"ease",sortData:null,dragEnabled:!1,dragContainer:null,dragStartPredicate:{distance:0,delay:0,handle:!1},dragAxis:null,dragSort:!0,dragSortInterval:100,dragSortPredicate:{threshold:50,action:"move"},dragReleaseDuration:300,dragReleaseEasing:"ease",dragHammerSettings:{touchAction:"none"},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"},n._maxRafBatchSize=100,n.prototype.on=function(t,e){return this._isDestroyed||this._emitter.on(t,e),this},n.prototype.once=function(t,e){return this._isDestroyed||this._emitter.once(t,e),this},n.prototype.off=function(t,e){return this._isDestroyed||this._emitter.off(t,e),this},n.prototype.getElement=function(){return this._element},n.prototype.getItems=function(t,e){if(this._isDestroyed)return[];var i,n,r=0===t||t&&typeof t!==tt,s=r?_(t)?x(t):[].concat(t):null,o=r?e:t,a=[];if((o=typeof o===tt?o:null)||s){for(s=s||this._items,n=0;n<s.length;n++)!(i=r?this._getItem(s[n]):s[n])||o&&!function(t,e){var i;return"inactive"===e?!t.isActive():"hidden"===e?!t.isVisible():(i="is"+e.charAt(0).toUpperCase()+e.slice(1),typeof t[i]===K&&t[i]())}(i,o)||a.push(i);return a}return a.concat(this._items)},n.prototype.refreshItems=function(t){if(this._isDestroyed)return this;var e,i=this.getItems(t||"active");for(e=0;e<i.length;e++)i[e]._refreshDimensions();return this},n.prototype.refreshSortData=function(t){if(this._isDestroyed)return this;var e,i=this.getItems(t);for(e=0;e<i.length;e++)i[e]._refreshSortData();return this},n.prototype.synchronize=function(){if(this._isDestroyed)return this;var t,e,i,n=this._element,r=this._items;if(r.length){for(i=0;i<r.length;i++)(e=r[i]._element).parentNode===n&&(t=t||Z.createDocumentFragment()).appendChild(e);t&&n.appendChild(t)}return this._emit("synchronize"),this},n.prototype.layout=function(t,e){function i(){--_<=0&&(typeof d===K&&d(r._layout!==c,u.concat()),r._layout===c&&r._emit(mt,u.concat()))}var r=this;if(r._isDestroyed)return r;var s,o,a,h,l,d=typeof t===K?t:e,f=!0===t,u=r.getItems("active"),c=r._layout=new n.Layout(r,u),_=u.length;if((c.setWidth||c.setHeight)&&(o={},s="border-box"===v(r._element,"box-sizing"),c.setHeight&&(typeof c.height===et?o.height=(s?c.height+r._border.top+r._border.bottom:c.height)+"px":o.height=c.height),c.setWidth&&(typeof c.width===et?o.width=(s?c.width+r._border.left+r._border.right:c.width)+"px":o.width=c.width),C(r._element,o)),r._emit("layoutStart",u.concat()),!u.length)return i(),r;for(l=0;l<u.length;l++)a=u[l],h=c.slots[a._id],a._left=h.left,a._top=h.top,a.isDragging()?i():a._layout(f,i);return r},n.prototype.add=function(t,e){if(this._isDestroyed)return[];var r=_(t)?x(t):[].concat(t),s=[];if(!r.length)return s;var o,a,h,l=e||{},d=l.layout?l.layout:l.layout===i,f=this._items,u=!1;for(h=0;h<f.length;h++)if((o=r.indexOf(f[h]._element))>-1&&(r.splice(o,1),!r.length))return s;for(h=0;h<r.length;h++)a=new n.Item(this,r[h]),s.push(a),a._isActive&&(u=!0,a._skipNextLayoutAnimation=!0);return g(f,s,l.index),this._emit("add",s.concat()),u&&d&&this.layout("instant"===d,typeof d===K?d:i),s},n.prototype.remove=function(t,e){if(this._isDestroyed)return this;var n,r,s=e||{},o=s.layout?s.layout:s.layout===i,a=!1,h=this.getItems(t);for(r=0;r<h.length;r++)(n=h[r])._isActive&&(a=!0),n._destroy(s.removeElements);return this._emit("remove",h.concat()),a&&o&&this.layout("instant"===o,typeof o===K?o:i),h},n.prototype.show=function(t,e){return this._isDestroyed?this:k(this,"show",t,e)},n.prototype.hide=function(t,e){return this._isDestroyed?this:k(this,"hide",t,e)},n.prototype.filter=function(t,e){if(this._isDestroyed||!this._items.length)return this;var n,r,s=this._items,o=typeof t,a=o===K,h=e||{},l=!0===h.instant,d=h.layout?h.layout:h.layout===i,f=typeof h.onFinish===K?h.onFinish:null,u=[],c=[],_=-1,p=f?function(){++_&&f(u.concat(),c.concat())}:function(){};if(a||o===tt)for(r=0;r<s.length;r++)n=s[r],(a?t(n):_t(n._element,t))?u.push(n):c.push(n);return u.length?this.show(u,{instant:l,onFinish:p,layout:!1}):p(),c.length?this.hide(c,{instant:l,onFinish:p,layout:!1}):p(),(u.length||c.length)&&(this._emit("filter",u.concat(),c.concat()),d&&this.layout("instant"===d,typeof d===K?d:i)),this},n.prototype.sort=function(t,e){if(this._isDestroyed||this._items.length<2)return this;var n,r=this._items,s=e||{},o=!!s.descending,a=s.layout?s.layout:s.layout===i,h=r.concat();if(typeof t===K)r.sort(function(e,i){var r=t(e,i);return(o&&0!==r?-r:r)||O(e,i,o,n||(n=Y(h)))});else if(typeof t===tt)t=t.trim().split(" ").map(function(t){return t.split(":")}),r.sort(function(e,i){return function(t,e,i,n){var r,s,o,a,h,l=0;for(h=0;h<n.length;h++)if(r=n[h][0],s=n[h][1],o=(t._sortData?t:t._refreshSortData())._sortData[r],a=(e._sortData?e:e._refreshSortData())._sortData[r],0!=(l="desc"===s||!s&&i?a<o?-1:a>o?1:0:o<a?-1:o>a?1:0))return l;return l}(e,i,o,t)||O(e,i,o,n||(n=Y(h)))});else{if(!j.isArray(t))return this;!function(t,e){var i,n,r,s=[],o=t.concat();for(r=0;r<e.length;r++)i=e[r],(n=o.indexOf(i))>-1&&(s.push(i),o.splice(n,1));t.splice.apply(t,[0,t.length].concat(s).concat(o))}(r,t),o&&r.reverse()}return this._emit("sort",r.concat(),h),a&&this.layout("instant"===a,typeof a===K?a:i),this},n.prototype.move=function(t,e,n){if(this._isDestroyed||this._items.length<2)return this;var r,s,o=this._items,a=n||{},h=a.layout?a.layout:a.layout===i,l="swap"===a.action,d=l?"swap":"move",c=this._getItem(t),_=this._getItem(e);return c&&_&&c!==_&&(r=o.indexOf(c),s=o.indexOf(_),(l?f:u)(o,r,s),this._emit("move",{item:c,fromIndex:r,toIndex:s,action:d}),h&&this.layout("instant"===h,typeof h===K?h:i)),this},n.prototype.send=function(t,e,n,r){if(this._isDestroyed||e._isDestroyed||this===e||!(t=this._getItem(t)))return this;var s=e,o=r||{},a=o.appendTo||J,h=o.layoutSender?o.layoutSender:o.layoutSender===i,l=o.layoutReceiver?o.layoutReceiver:o.layoutReceiver===i;return t._migrate.start(s,n,a),t._migrate.isActive&&t.isActive()&&(h&&this.layout("instant"===h,typeof h===K?h:i),l&&s.layout("instant"===l,typeof l===K?l:i)),this},n.prototype.destroy=function(t){if(this._isDestroyed)return this;var e,n=this._element,r=this._items.concat();for(this._resizeHandler&&V.removeEventListener("resize",this._resizeHandler),e=0;e<r.length;e++)r[e]._destroy(t);return A(n,this._settings.containerClass),C(n,{height:""}),this._emit("destroy"),this._emitter.destroy(),ft[this._id]=i,this._isDestroyed=!0,this},n.prototype._getItem=function(t){var e,i=this._items;if(this._isDestroyed||!t)return i[0]||null;if(typeof t===et)return i[t>-1?t:i.length+t]||null;if(t instanceof r)return t._gridId===this._id?t:null;for(e=0;e<i.length;e++)if(i[e]._element===t)return i[e];return null},n.prototype._emit=function(){return this._isDestroyed||this._emitter.emit.apply(this._emitter,arguments),this},n.prototype._refreshDimensions=function(){var t,e=this._element,i=e.getBoundingClientRect(),n=["left","right","top","bottom"];for(this._width=i.width,this._height=i.height,this._left=i.left,this._top=i.top,this._border={},t=0;t<n.length;t++)this._border[n[t]]=D(e,"border-"+n[t]+"-width");return this},r.prototype.getGrid=function(){return ft[this._gridId]},r.prototype.getElement=function(){return this._element},r.prototype.getWidth=function(){return this._width},r.prototype.getHeight=function(){return this._height},r.prototype.getMargin=function(){return{left:this._margin.left,right:this._margin.right,top:this._margin.top,bottom:this._margin.bottom}},r.prototype.getPosition=function(){return{left:this._left,top:this._top}},r.prototype.isActive=function(){return this._isActive},r.prototype.isVisible=function(){return!this._isHidden},r.prototype.isShowing=function(){return this._isShowing},r.prototype.isHiding=function(){return this._isHiding},r.prototype.isPositioning=function(){return this._isPositioning},r.prototype.isDragging=function(){return!!this._drag&&this._drag._data.isActive},r.prototype.isReleasing=function(){return this._release.isActive},r.prototype.isDestroyed=function(){return this._isDestroyed},r.prototype._refreshDimensions=function(){if(this._isDestroyed||this._isHidden)return this;var t,e,i=this._element,n=i.getBoundingClientRect(),r=["left","right","top","bottom"],s=this._margin=this._margin||{};for(this._width=n.width,this._height=n.height,e=0;e<4;e++)t=D(i,"margin-"+r[e]),s[r[e]]=t>0?t:0;return this},r.prototype._refreshSortData=function(){var t=this;if(t._isDestroyed)return t;var e={},i=t.getGrid()._settings.sortData;return i&&Q.keys(i).forEach(function(n){e[n]=i[n](t,t._element)}),t._sortData=e,t},r.prototype._layout=function(t,e){var i=this;if(i._isDestroyed)return i;var n,r,s,o,a,h,l=i._element,d=i._isPositioning,f=i._migrate,u=i._release,c=u.isActive&&!1===u.isPositioningStarted,_=i.getGrid()._settings,p=c?_.dragReleaseDuration:_.layoutDuration,g=c?_.dragReleaseEasing:_.layoutEasing,m=!t&&!i._skipNextLayoutAnimation&&p>0;return d&&N(i._layoutQueue,!0,i),c&&(u.isPositioningStarted=!0),typeof e===K&&i._layoutQueue.push(e),r=u.isActive?u.containerDiffX:f.isActive?f.containerDiffX:0,s=u.isActive?u.containerDiffY:f.isActive?f.containerDiffY:0,h={transform:S(i._left+r,i._top+s)},m?(i._isPositioning=!0,it.add(nt,i._id,function(){o=w(l,"x")-r,a=w(l,"y")-s},function(){if(i._left===o&&i._top===a)return d&&i._stopLayout(!1,h),i._isPositioning=!1,i._finishLayout();!d&&b(l,_.itemPositioningClass),i._animate.start({transform:S(o+r,a+s)},h,{duration:p,easing:g,onFinish:function(){i._finishLayout()}})}),i):(d&&it.cancel(nt,i._id),n=i._animate.isAnimating(),i._stopLayout(!1,h),!n&&C(l,h),i._skipNextLayoutAnimation=!1,i._finishLayout())},r.prototype._finishLayout=function(){return this._isDestroyed?this:(this._isPositioning&&(this._isPositioning=!1,A(this._element,this.getGrid()._settings.itemPositioningClass)),this._release.isActive&&this._release.stop(),this._migrate.isActive&&this._migrate.stop(),N(this._layoutQueue,!1,this),this)},r.prototype._stopLayout=function(t,e){return this._isDestroyed||!this._isPositioning?this:(it.cancel(nt,this._id),this._animate.stop(e),A(this._element,this.getGrid()._settings.itemPositioningClass),this._isPositioning=!1,t&&N(this._layoutQueue,!0,this),this)},r.prototype._show=function(t,e){var i=this;if(i._isDestroyed)return i;var n=i._element,r=i._visibilityQueue,s=typeof e===K?e:null,o=i.getGrid(),a=o._settings;return i._isShowing||i._isHidden?i._isShowing&&!t?(s&&r.push(s),i):(i._isShowing||(N(r,!0,i),A(n,a.itemHiddenClass),b(n,a.itemVisibleClass),!i._isHiding&&C(n,{display:"block"})),s&&r.push(s),i._isActive=i._isShowing=!0,i._isHiding=i._isHidden=!1,t?(o._itemShowHandler.stop(i,a.visibleStyles),i._isShowing=!1,N(r,!1,i)):o._itemShowHandler.start(i,t,function(){i._isHidden||(i._isShowing=!1,N(r,!1,i))}),i):(s&&s(!1,i),i)},r.prototype._hide=function(t,e){var i=this;if(i._isDestroyed)return i;var n=i._element,r=i._visibilityQueue,s=typeof e===K?e:null,o=i.getGrid(),a=o._settings;return!i._isHiding&&i._isHidden?(s&&s(!1,i),i):i._isHiding&&!t?(s&&r.push(s),i):(i._isHiding||(N(r,!0,i),b(n,a.itemHiddenClass),A(n,a.itemVisibleClass)),s&&r.push(s),i._isHidden=i._isHiding=!0,i._isActive=i._isShowing=!1,t?(o._itemHideHandler.stop(i,a.hiddenStyles),i._isHiding=!1,i._stopLayout(!0,{transform:S(0,0)}),C(n,{display:"none"}),N(r,!1,i)):o._itemHideHandler.start(i,t,function(){i._isHidden&&(i._isHiding=!1,i._stopLayout(!0,{transform:S(0,0)}),C(n,{display:"none"}),N(r,!1,i))}),i)},r.prototype._destroy=function(t){if(this._isDestroyed)return this;var e=this._element,n=this.getGrid(),r=n._settings,s=n._items.indexOf(this);return this._release.destroy(),this._migrate.destroy(),this._stopLayout(!0,{}),n._itemShowHandler.stop(this,{}),n._itemHideHandler.stop(this,{}),this._drag&&this._drag.destroy(),this._animate.destroy(),this._animateChild.destroy(),N(this._visibilityQueue,!0,this),e.removeAttribute("style"),this._child.removeAttribute("style"),A(e,r.itemPositioningClass),A(e,r.itemDraggingClass),A(e,r.itemReleasingClass),A(e,r.itemClass),A(e,r.itemVisibleClass),A(e,r.itemHiddenClass),s>-1&&n._items.splice(s,1),t&&e.parentNode.removeChild(e),ut[this._id]=i,this._isActive=this._isPositioning=this._isHiding=this._isShowing=!1,this._isDestroyed=this._isHidden=!0,this},s.prototype.on=function(t,e){if(this._isDestroyed)return this;var i=this._events[t]||[];return i.push(e),this._events[t]=i,this},s.prototype.once=function(t,e){var i=this;return this.on(t,function n(){i.off(t,n),e.apply(null,arguments)})},s.prototype.off=function(t,e){if(this._isDestroyed)return this;for(var i=this._events[t]||[],n=i.length;n--;)e===i[n]&&i.splice(n,1);return this},s.prototype.emit=function(t,e,i,n){if(this._isDestroyed)return this;var r,s=this._events[t]||[],o=s.length,a=arguments.length-1;if(o)for(s=s.concat(),r=0;r<o;r++)0===a?s[r]():1===a?s[r](e):2===a?s[r](e,i):s[r](e,i,n);return this},s.prototype.destroy=function(){if(this._isDestroyed)return this;var t,e=Q.keys(this._events);for(t=0;t<e.length;t++)this._events[e[t]]=null;return this._isDestroyed=!0,this},o.prototype.start=function(t,e,i){var n=this;if(!n._isDestroyed){var r=i||{},s=typeof r.onFinish===K?r.onFinish:null;if(n._animation){if(!Q.keys(e).some(function(t){return e[t]!==n._propsTo[t]}))return void(n._animation.onfinish=function(){n._animation=n._propsTo=null,s&&s()});n._animation.cancel()}n._propsTo=e,n._animation=n._element.animate([t,e],{duration:r.duration||300,easing:r.easing||"ease"}),n._animation.onfinish=function(){n._animation=n._propsTo=null,s&&s()},C(n._element,e)}},o.prototype.stop=function(t){!this._isDestroyed&&this._animation&&(C(this._element,t||I(this._element,this._propsTo)),this._animation.cancel(),this._animation=this._propsTo=null)},o.prototype.isAnimating=function(){return!!this._animation},o.prototype.destroy=function(){this._isDestroyed||(this.stop(),this._item=this._element=null,this._isDestroyed=!0)},a.prototype.destroy=function(){return this._isDestroyed||(this.stop(!0),this._isDestroyed=!0),this},a.prototype.getItem=function(){return ut[this._itemId]||null},a.prototype.start=function(t,e,r){if(this._isDestroyed)return this;var s,o,a,h,l,f=this.getItem(),u=f._element,c=f.isVisible(),_=f.getGrid(),p=_._settings,m=t._settings,y=t._element,v=_._items.indexOf(f),D=typeof e===et?e:t._items.indexOf(t._getItem(e)),I=r||J;return null===D?this:(D=d(t._items,D,!0),(f.isPositioning()||this.isActive||f.isReleasing())&&(h=w(u,"x"),l=w(u,"y")),f.isPositioning()&&f._stopLayout(!0,{transform:S(h,l)}),this.isActive&&(h-=this.containerDiffX,l-=this.containerDiffY,this.stop(!0,{transform:S(h,l)})),f.isReleasing()&&(h-=f._release.containerDiffX,l-=f._release.containerDiffY,f._release.stop(!0,{transform:S(h,l)})),_._itemShowHandler.stop(f),_._itemHideHandler.stop(f),f._drag&&f._drag.destroy(),f._animate.destroy(),f._animateChild.destroy(),N(f._visibilityQueue,!0,f),_._emit(St,{item:f,fromGrid:_,fromIndex:v,toGrid:t,toIndex:D}),t._emit(It,{item:f,fromGrid:_,fromIndex:v,toGrid:t,toIndex:D}),A(u,p.itemClass),A(u,p.itemVisibleClass),A(u,p.itemHiddenClass),b(u,m.itemClass),b(u,c?m.itemVisibleClass:m.itemHiddenClass),_._items.splice(v,1),g(t._items,f,D),f._gridId=t._id,f._animate=new n.ItemAnimate(f,u),f._animateChild=new n.ItemAnimate(f,f._child),s=u.parentNode,I!==s&&(I.appendChild(u),o=H(I,s,!0),h===i&&(h=w(u,"x"),l=w(u,"y")),C(u,{transform:S(h+o.left,l+o.top)})),f._child.removeAttribute("style"),c?t._itemShowHandler.start(f,!0):t._itemHideHandler.start(f,!0),C(u,{display:c?"block":"hidden"}),a=H(I,y,!0),f._refreshDimensions()._refreshSortData(),f._drag=m.dragEnabled?new n.ItemDrag(f):null,this.isActive=!0,this.container=I,this.containerDiffX=a.left,this.containerDiffY=a.top,_._emit("send",{item:f,fromGrid:_,fromIndex:v,toGrid:t,toIndex:D}),t._emit("receive",{item:f,fromGrid:_,fromIndex:v,toGrid:t,toIndex:D}),this)},a.prototype.stop=function(t,e){if(this._isDestroyed||!this.isActive)return this;var i=this.getItem(),n=i._element,r=i.getGrid()._element;return this.container!==r&&(e||(e={transform:S(t?w(n,"x")-this.containerDiffX:i._left,t?w(n,"y")-this.containerDiffY:i._top)}),r.appendChild(n),C(n,e)),this.isActive=!1,this.container=null,this.containerDiffX=0,this.containerDiffY=0,this},h.prototype.destroy=function(){return this._isDestroyed||(this.stop(!0),this._isDestroyed=!0),this},h.prototype.getItem=function(){return ut[this._itemId]||null},h.prototype.reset=function(){if(this._isDestroyed)return this;var t=this.getItem();return this.isActive=!1,this.isPositioningStarted=!1,this.containerDiffX=0,this.containerDiffY=0,A(t._element,t.getGrid()._settings.itemReleasingClass),this},h.prototype.start=function(){if(this._isDestroyed||this.isActive)return this;var t=this.getItem(),e=t.getGrid();return this.isActive=!0,b(t._element,e._settings.itemReleasingClass),e._emit("dragReleaseStart",t),t._layout(!1),this},h.prototype.stop=function(t,e){if(this._isDestroyed||!this.isActive)return this;var i=this.getItem(),n=i._element,r=i.getGrid(),s=r._element,o=this.containerDiffX,a=this.containerDiffY;return this.reset(),n.parentNode!==s&&(e||(e={transform:S(t?w(n,"x")-o:i._left,t?w(n,"y")-a:i._top)}),s.appendChild(n),C(n,e)),t||r._emit("dragReleaseEnd",i),this},l.defaultStartPredicate=function(t,e,i){var n,r,s,o,a=t._element,h=t._drag._startPredicateData;if(h||(n=c(n=i||t._drag.getGrid()._settings.dragStartPredicate)?n:{},h=t._drag._startPredicateData={distance:W.abs(n.distance)||0,delay:W.max(n.delay,0)||0,handle:"string"==typeof n.handle&&n.handle}),e.isFinal)return r="a"===a.tagName.toLowerCase(),s=a.getAttribute("href"),o=a.getAttribute("target"),F(t),void(r&&s&&W.abs(e.deltaX)<2&&W.abs(e.deltaY)<2&&e.deltaTime<200&&(o&&"_self"!==o?V.open(s,o):V.location.href=s));if(!h.handleElement)if(h.handle){for(h.handleElement=e.srcEvent.target;h.handleElement&&!_t(h.handleElement,h.handle);)h.handleElement=h.handleElement!==a?h.handleElement.parentElement:null;if(!h.handleElement)return!1}else h.handleElement=a;return h.delay&&(h.event=e,h.delayTimer||(h.delayTimer=V.setTimeout(function(){h.delay=0,z(t,h.event)&&(t._drag._resolveStartPredicate(h.event),F(t))},h.delay))),z(t,e)},l.defaultSortPredicate=function(t){var e,i,n,r,s,o=t._drag,a=o._data,h=o.getGrid(),l=h._settings.dragSortPredicate||{},d=l.threshold||50,f=l.action||"move",u={width:t._width,height:t._height,left:a.elementClientX,top:a.elementClientY},c=function(t,e,i,n){var r,s,o,a=null,h=e._settings.dragSort,l=!0===h?[e]:h.call(e,t),d=-1;if(!j.isArray(l))return a;for(o=0;o<l.length;o++)(s=l[o])._isDestroyed||(s._refreshDimensions(),(r=X(i,{width:s._width,height:s._height,left:s._left,top:s._top}))>n&&r>d&&(d=r,a=s));return a}(t,h,u,d),_=0,p=0,g=-1;if(!c)return!1;for(c===h?(u.left=a.gridX+t._margin.left,u.top=a.gridY+t._margin.top):(_=c._left+c._border.left,p=c._top+c._border.top),s=0;s<c._items.length;s++)(n=c._items[s])._isActive&&n!==t&&(i=!0,(r=X(u,{width:n._width,height:n._height,left:n._left+n._margin.left+_,top:n._top+n._margin.top+p}))>g&&(e=s,g=r));return g<d&&t.getGrid()!==c&&(e=i?-1:0,g=1/0),g>=d&&{grid:c,index:e,action:f}},l.prototype.destroy=function(){return this._isDestroyed||(this.stop(),this._hammer.destroy(),this.getItem()._element.removeEventListener("dragstart",T,!1),this._isDestroyed=!0),this},l.prototype.getItem=function(){return ut[this._itemId]||null},l.prototype.getGrid=function(){return ft[this._gridId]||null},l.prototype.reset=function(){var t=this._data;return t.isActive=!1,t.container=null,t.containingBlock=null,t.startEvent=null,t.currentEvent=null,t.scrollers=[],t.left=0,t.top=0,t.gridX=0,t.gridY=0,t.elementClientX=0,t.elementClientY=0,t.containerDiffX=0,t.containerDiffY=0,this},l.prototype.bindScrollListeners=function(){var t,e=this.getGrid()._element,i=this._data.container,n=L(this.getItem()._element);for(i!==e&&(n=function(t){var e,i=[],n=t.length;if(n)for(i[0]=t[0],e=1;e<n;e++)i.indexOf(t[e])<0&&i.push(t[e]);return i}(n.concat(e).concat(L(e)))),t=0;t<n.length;t++)n[t].addEventListener("scroll",this._scrollListener);return this._data.scrollers=n,this},l.prototype.unbindScrollListeners=function(){var t,e=this._data,i=e.scrollers;for(t=0;t<i.length;t++)i[t].removeEventListener("scroll",this._scrollListener);return e.scrollers=[],this},l.prototype.checkOverlap=function(){var t,e,i,n,r,s,o=this.getItem(),a=this._sortPredicate(o,this._data.currentEvent);return c(a)&&typeof a.index===et?(t=o.getGrid(),i=a.grid||t,s=t!==i,e=t._items.indexOf(o),n=d(t._items,a.index,s),r="swap"===a.action?"swap":"move",s?(t._emit(St,{item:o,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),i._emit(It,{item:o,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),o._gridId=i._id,this._isMigrating=o._gridId!==this._gridId,t._items.splice(e,1),g(i._items,o,n),o._sortData=null,t._emit("send",{item:o,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),i._emit("receive",{item:o,fromGrid:t,fromIndex:e,toGrid:i,toIndex:n}),t.layout(),i.layout()):e!==n&&(("swap"===r?f:u)(t._items,e,n),t._emit("move",{item:o,fromIndex:e,toIndex:n,action:r}),t.layout()),this):this},l.prototype.finishMigration=function(){var t,e,i,r=this.getItem(),s=r._release,o=r._element,a=r.getGrid(),h=a._element,l=a._settings,d=l.dragContainer||h,f=this.getGrid()._settings,u=o.parentNode;return this._isMigrating=!1,this.destroy(),r._animate.destroy(),r._animateChild.destroy(),A(o,f.itemClass),A(o,f.itemVisibleClass),A(o,f.itemHiddenClass),b(o,l.itemClass),b(o,l.itemVisibleClass),r._animate=new n.ItemAnimate(r,o),r._animateChild=new n.ItemAnimate(r,r._child),d!==u&&(d.appendChild(o),i=H(u,d,!0),t=w(o,"x")-i.left,e=w(o,"y")-i.top),r._refreshDimensions()._refreshSortData(),i=H(d,h,!0),s.containerDiffX=i.left,s.containerDiffY=i.top,r._drag=l.dragEnabled?new n.ItemDrag(r):null,d!==u&&C(o,{transform:S(t,e)}),r._child.removeAttribute("style"),a._itemShowHandler.start(r,!0),s.start(),this},l.prototype.cancelRafLoop=function(){var t=this.getItem()._id;return it.cancel(ot,t),it.cancel(st,t),this},l.prototype.stop=function(){var t=this._data,e=this.getItem()._element,i=this.getGrid();return t.isActive?this._isMigrating?this.finishMigration(t.currentEvent):(this.cancelRafLoop(),this.unbindScrollListeners(),this._checkSortOverlap("cancel"),e.parentNode!==i._element&&(i._element.appendChild(e),C(e,{transform:S(t.gridX,t.gridY)})),A(e,i._settings.itemDraggingClass),this.reset(),this):this},l.prototype.onStart=function(t){var e=this.getItem();if(!e._isActive)return this;var i=e._element,n=this.getGrid(),r=n._settings,s=this._data,o=e._release,a=e._migrate,h=n._element,l=r.dragContainer||h,d=R(l,!0),f=l!==h?H(d,h):0,u=w(i,"x"),c=w(i,"y"),_=i.getBoundingClientRect();return e.isPositioning()&&e._stopLayout(!0,{transform:S(u,c)}),a.isActive&&(u-=a.containerDiffX,c-=a.containerDiffY,a.stop(!0,{transform:S(u,c)})),e.isReleasing()&&o.reset(),s.isActive=!0,s.startEvent=s.currentEvent=t,s.container=l,s.containingBlock=d,s.elementClientX=_.left,s.elementClientY=_.top,s.left=s.gridX=u,s.top=s.gridY=c,n._emit("dragInit",e,t),l!==h&&(s.containerDiffX=f.left,s.containerDiffY=f.top,i.parentNode===l?(s.gridX=u-s.containerDiffX,s.gridY=c-s.containerDiffY):(s.left=u+s.containerDiffX,s.top=c+s.containerDiffY,l.appendChild(i),C(i,{transform:S(s.left,s.top)}))),b(i,r.itemDraggingClass),this.bindScrollListeners(),n._emit("dragStart",e,t),this},l.prototype.onMove=function(t){var e=this,i=e.getItem();if(!i._isActive)return e.stop();var n=i._element,r=e.getGrid(),s=r._settings,o=e._data,a=s.dragAxis,h=t.deltaX-o.currentEvent.deltaX,l=t.deltaY-o.currentEvent.deltaY;return it.add(st,i._id,function(){o.currentEvent=t,"y"!==a&&(o.left+=h,o.gridX+=h,o.elementClientX+=h),"x"!==a&&(o.top+=l,o.gridY+=l,o.elementClientY+=l),s.dragSort&&e._checkSortOverlap()},function(){C(n,{transform:S(o.left,o.top)}),r._emit("dragMove",i,t)}),e},l.prototype.onScroll=function(t){var e,i,n,r,s=this,o=s.getItem(),a=o._element,h=s.getGrid(),l=h._settings,d=l.dragAxis,f=s._data,u=h._element;return it.add(ot,o._id,function(){e=a.getBoundingClientRect(),i=f.elementClientX-e.left,n=f.elementClientY-e.top,f.container!==u&&(r=H(f.containingBlock,u),f.containerDiffX=r.left,f.containerDiffY=r.top),"y"!==d&&(f.left+=i,f.gridX=f.left-f.containerDiffX),"x"!==d&&(f.top+=n,f.gridY=f.top-f.containerDiffY),l.dragSort&&s._checkSortOverlap()},function(){C(a,{transform:S(f.left,f.top)}),h._emit("dragScroll",o,t)}),s},l.prototype.onEnd=function(t){var e=this.getItem(),i=e._element,n=this.getGrid(),r=n._settings,s=this._data,o=e._release;return e._isActive?(this.cancelRafLoop(),r.dragSort&&this._checkSortOverlap("finish"),this.unbindScrollListeners(),o.containerDiffX=s.containerDiffX,o.containerDiffY=s.containerDiffY,this.reset(),A(i,r.itemDraggingClass),n._emit("dragEnd",e,t),this._isMigrating?this.finishMigration():o.start(),this):this.stop()},B.getSlot=function(t,e,i,n,r,s){var o,a,h,l,d,f=[],u={left:null,top:null,width:i,height:n};for(l=0;l<e.length;l++)if(o=e[l],u.width<=o.width+.001&&u.height<=o.height+.001){u.left=o.left,u.top=o.top;break}for(null===u.left&&(u.left=r?0:t.width,u.top=r?t.height:0,s||(h=!0)),r&&u.top+u.height>t.height&&(u.left>0&&f.push({left:0,top:t.height,width:u.left,height:1/0}),u.left+u.width<t.width&&f.push({left:u.left+u.width,top:t.height,width:t.width-u.left-u.width,height:1/0}),t.height=u.top+u.height),!r&&u.left+u.width>t.width&&(u.top>0&&f.push({left:t.width,top:0,width:1/0,height:u.top}),u.top+u.height<t.height&&f.push({left:t.width,top:u.top+u.height,width:1/0,height:t.height-u.top-u.height}),t.width=u.left+u.width),l=s?0:h?e.length:l;l<e.length;l++)for(a=B.splitRect(e[l],u),d=0;d<a.length;d++)(o=a[d]).width>.49&&o.height>.49&&(r&&o.top<t.height||!r&&o.left<t.width)&&f.push(o);return f.length&&(f=B.purgeRects(f).sort(r?B.sortRectsTopLeft:B.sortRectsLeftTop)),[u,f]},B.splitRect=function(t,e){var i=[];return B.doRectsOverlap(t,e)?(t.left<e.left&&i.push({left:t.left,top:t.top,width:e.left-t.left,height:t.height}),t.left+t.width>e.left+e.width&&i.push({left:e.left+e.width,top:t.top,width:t.left+t.width-(e.left+e.width),height:t.height}),t.top<e.top&&i.push({left:t.left,top:t.top,width:t.width,height:e.top-t.top}),t.top+t.height>e.top+e.height&&i.push({left:t.left,top:e.top+e.height,width:t.width,height:t.top+t.height-(e.top+e.height)}),i):[{left:t.left,top:t.top,width:t.width,height:t.height}]},B.doRectsOverlap=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)},B.isRectWithinRect=function(t,e){return t.left>=e.left&&t.top>=e.top&&t.left+t.width<=e.left+e.width&&t.top+t.height<=e.top+e.height},B.purgeRects=function(t){for(var e,i,n,r=t.length;r--;)for(i=t[r],e=t.length;e--;)if(n=t[e],r!==e&&B.isRectWithinRect(i,n)){t.splice(r,1);break}return t},B.sortRectsTopLeft=function(t,e){return t.top-e.top||t.left-e.left},B.sortRectsLeftTop=function(t,e){return t.left-e.left||t.top-e.top},n});
{
"name": "muuri",
"version": "0.5.1",
"version": "0.5.2",
"description": "Responsive, sortable, filterable and draggable grid layouts.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display