Current File : /pages/54/47/d0016649/home/htdocs/cd24/wp-content/themes/en-vision/lib/js/packery-pkgd.min.js
/*!
 * Envision
 * 
 * @version 3.7.0
 * 
 * @author Wptation
 * @link http://envision.wptation.com/
 * @license ThemeForest Split Licence
 * @copyright 2019
 */

(function(t){"use strict";function i(t){return RegExp("(^|\\s+)"+t+"(\\s+|$)")}function e(t,e){(n(t,e)?s:o)(t,e)}var n,o,s;s="classList"in document.documentElement?(n=function(t,e){return t.classList.contains(e)},o=function(t,e){t.classList.add(e)},function(t,e){t.classList.remove(e)}):(n=function(t,e){return i(e).test(t.className)},o=function(t,e){n(t,e)||(t.className=t.className+" "+e)},function(t,e){t.className=t.className.replace(i(e)," ")});var r={hasClass:n,addClass:o,removeClass:s,toggleClass:e,has:n,add:o,remove:s,toggle:e};"function"==typeof define&&define.amd?define(r):t.classie=r})(window),function(n){"use strict";var t=document.documentElement,e=function(){};t.addEventListener?e=function(t,e,i){t.addEventListener(e,i,!1)}:t.attachEvent&&(e=function(e,t,i){e[t+i]=i.handleEvent?function(){var t=n.event;t.target=t.target||t.srcElement,i.handleEvent.call(i,t)}:function(){var t=n.event;t.target=t.target||t.srcElement,i.call(e,t)},e.attachEvent("on"+t,e[t+i])});var i=function(){};t.removeEventListener?i=function(t,e,i){t.removeEventListener(e,i,!1)}:t.detachEvent&&(i=function(e,i,n){e.detachEvent("on"+i,e[i+n]);try{delete e[i+n]}catch(t){e[i+n]=void 0}});var o={bind:e,unbind:i};"function"==typeof define&&define.amd?define(o):n.eventie=o}(this),function(e){"use strict";function o(t){"function"==typeof t&&(o.isReady?t():r.push(t))}function i(t){var e="readystatechange"===t.type&&"complete"!==s.readyState;if(!o.isReady&&!e){o.isReady=!0;for(var i=0,n=r.length;i<n;i++){(0,r[i])()}}}function t(t){return t.bind(s,"DOMContentLoaded",i),t.bind(s,"readystatechange",i),t.bind(e,"load",i),o}var s=e.document,r=[];o.isReady=!1,"function"==typeof define&&define.amd?define(["eventie"],t):e.docReady=t(e.eventie)}(this),function(t){"use strict";function e(){}function s(t,e){if(n)return e.indexOf(t);for(var i=e.length;i--;)if(e[i]===t)return i;return-1}var i=e.prototype,n=!!Array.prototype.indexOf;i._getEvents=function(){return this._events||(this._events={})},i.getListeners=function(t){var e,i,n=this._getEvents();if("object"==typeof t)for(i in e={},n)n.hasOwnProperty(i)&&t.test(i)&&(e[i]=n[i]);else e=n[t]||(n[t]=[]);return e},i.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&((e={})[t]=i),e||i},i.addListener=function(t,e){var i,n=this.getListenersAsObject(t);for(i in n)n.hasOwnProperty(i)&&-1===s(e,n[i])&&n[i].push(e);return this},i.on=i.addListener,i.defineEvent=function(t){return this.getListeners(t),this},i.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},i.removeListener=function(t,e){var i,n,o=this.getListenersAsObject(t);for(n in o)o.hasOwnProperty(n)&&(-1!==(i=s(e,o[n]))&&o[n].splice(i,1));return this},i.off=i.removeListener,i.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},i.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},i.manipulateListeners=function(t,e,i){var n,o,s=t?this.removeListener:this.addListener,r=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(n=i.length;n--;)s.call(this,e,i[n]);else for(n in e)e.hasOwnProperty(n)&&(o=e[n])&&("function"==typeof o?s.call(this,n,o):r.call(this,n,o));return this},i.removeEvent=function(t){var e,i=typeof t,n=this._getEvents();if("string"==i)delete n[t];else if("object"==i)for(e in n)n.hasOwnProperty(e)&&t.test(e)&&delete n[e];else delete this._events;return this},i.emitEvent=function(t,e){var i,n,o=this.getListenersAsObject(t);for(n in o)if(o.hasOwnProperty(n))for(i=o[n].length;i--;)!0===(e?o[n][i].apply(null,e):o[n][i]())&&this.removeListener(t,o[n][i]);return this},i.trigger=i.emitEvent,i.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},"function"==typeof define&&define.amd?define(function(){return e}):t.EventEmitter=e}(this),function(t){"use strict";function e(t){if(t){if("string"==typeof s[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e,i=0,n=o.length;i<n;i++)if(e=o[i]+t,"string"==typeof s[e])return e}}var o="Webkit Moz ms Ms O".split(" "),s=document.documentElement.style;"function"==typeof define&&define.amd?define(function(){return e}):t.getStyleProperty=e}(window),function(t){"use strict";function E(t){var e=parseFloat(t);return-1===t.indexOf("%")&&!isNaN(e)&&e}function e(t){var v,x=t("boxSizing");return function(){if(x){var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style[x]="border-box";var e=document.body||document.documentElement;e.appendChild(t);var i=w(t);v=200===E(i.width),e.removeChild(t)}}(),function(t){if("object"==typeof t&&t.nodeType){var e=w(t);if("none"===e.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0,i=S.length;e<i;e++){t[S[e]]=0}return t}();var i={};i.width=t.offsetWidth,i.height=t.offsetHeight;for(var n=i.isBorderBox=!(!x||!e[x]||"border-box"!==e[x]),o=0,s=S.length;o<s;o++){var r=S[o],a=e[r],h=parseFloat(a);i[r]=isNaN(h)?0:h}var p=i.paddingLeft+i.paddingRight,c=i.paddingTop+i.paddingBottom,u=i.marginLeft+i.marginRight,l=i.marginTop+i.marginBottom,d=i.borderLeftWidth+i.borderRightWidth,f=i.borderTopWidth+i.borderBottomWidth,m=n&&v,y=E(e.width);!1!==y&&(i.width=y+(m?0:p+d));var g=E(e.height);return!1!==g&&(i.height=g+(m?0:c+f)),i.innerWidth=i.width-(p+d),i.innerHeight=i.height-(c+f),i.outerWidth=i.width+u,i.outerHeight=i.height+l,i}}}var i=document.defaultView,w=i&&i.getComputedStyle?function(t){return i.getComputedStyle(t,null)}:function(t){return t.currentStyle},S=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define(["get-style-property"],e):t.getSize=e(t.getStyleProperty)}(window),function(t){"use strict";function e(){}function i(p){if(p){var c="undefined"==typeof console?e:function(t){console.error(t)};p.bridget=function(t,e){(function(t){t.prototype.option||(t.prototype.option=function(t){p.isPlainObject(t)&&(this.options=p.extend(!0,this.options,t))})})(e),function(a,h){p.fn[a]=function(e){if("string"!=typeof e)return this.each(function(){var t=p.data(this,a);t?(t.option(e),t._init()):(t=new h(this,e),p.data(this,a,t))});for(var t=u.call(arguments,1),i=0,n=this.length;i<n;i++){var o=this[i],s=p.data(o,a);if(s)if(p.isFunction(s[e])&&"_"!==e.charAt(0)){var r=s[e].apply(s,t);if(void 0!==r)return r}else c("no such method '"+e+"' for "+a+" instance");else c("cannot call methods on "+a+" prior to initialization; attempted to call '"+e+"'")}return this}}(t,e)}}}var u=Array.prototype.slice;"function"==typeof define&&define.amd?define(["jquery"],i):i(t.jQuery)}(window),function(t,o){"use strict";function i(t,e){return t[n](e)}function s(t){t.parentNode||document.createDocumentFragment().appendChild(t)}var e,n=function(){if(o.matchesSelector)return"matchesSelector";for(var t=["webkit","moz","ms","o"],e=0,i=t.length;e<i;e++){var n=t[e]+"MatchesSelector";if(o[n])return n}}();if(n){var r=i(document.createElement("div"),"div");e=r?i:function(t,e){return s(t),i(t,e)}}else e=function(t,e){s(t);for(var i=t.parentNode.querySelectorAll(e),n=0,o=i.length;n<o;n++)if(i[n]===t)return!0;return!1};"function"==typeof define&&define.amd?define(function(){return e}):window.matchesSelector=e}(0,Element.prototype),function(){"use strict";function a(t){for(var e in a.defaults)this[e]=a.defaults[e];for(e in t)this[e]=t[e]}((window.Packery=function(){}).Rect=a).defaults={x:0,y:0,width:0,height:0},a.prototype.contains=function(t){var e=t.width||0,i=t.height||0;return this.x<=t.x&&this.y<=t.y&&this.x+this.width>=t.x+e&&this.y+this.height>=t.y+i},a.prototype.overlaps=function(t){var e=this.x+this.width,i=this.y+this.height,n=t.x+t.width,o=t.y+t.height;return n>this.x&&e>t.x&&o>this.y&&i>t.y},a.prototype.getMaximalFreeRects=function(t){if(!this.overlaps(t))return!1;var e,i=[],n=this.x+this.width,o=this.y+this.height,s=t.x+t.width,r=t.y+t.height;return this.y<t.y&&(e=new a({x:this.x,y:this.y,width:this.width,height:t.y-this.y}),i.push(e)),s<n&&(e=new a({x:s,y:this.y,width:n-s,height:this.height}),i.push(e)),r<o&&(e=new a({x:this.x,y:r,width:this.width,height:o-r}),i.push(e)),this.x<t.x&&(e=new a({x:this.x,y:this.y,width:t.x-this.x,height:this.height}),i.push(e)),i},a.prototype.canFit=function(t){return this.width>=t.width&&this.height>=t.height}}(),function(){"use strict";function r(t,e){this.width=t||0,this.height=e||0,this.reset()}var t=window.Packery,e=t.Rect;r.prototype.reset=function(){this.spaces=[],this.newSpaces=[];var t=new e({x:0,y:0,width:this.width,height:this.height});this.spaces.push(t)},r.prototype.pack=function(t){for(var e=0,i=this.spaces.length;e<i;e++){var n=this.spaces[e];if(n.canFit(t)){this.placeInSpace(t,n);break}}},r.prototype.placeInSpace=function(t,e){t.x=e.x,t.y=e.y,this.placed(t)},r.prototype.placed=function(t){for(var e=[],i=0,n=this.spaces.length;i<n;i++){var o=this.spaces[i],s=o.getMaximalFreeRects(t);s?e.push.apply(e,s):e.push(o)}this.spaces=e,r.mergeRects(this.spaces),this.spaces.sort(r.spaceSorterTopLeft)},r.mergeRects=function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e];if(n){var o=t.slice(0);o.splice(e,1);for(var s=0,r=0,a=o.length;r<a;r++){var h=o[r],p=r<e?0:1;n.contains(h)&&(t.splice(r+p-s,1),s++)}}}return t},r.spaceSorterTopLeft=function(t,e){return t.y-e.y||t.x-e.x},r.spaceSorterLeftTop=function(t,e){return t.x-e.x||t.y-e.y},t.Packer=r}(),function(t){"use strict";function e(t,e){this.element=t,this.packery=e,this.position={x:0,y:0},this.rect=new n,this.placeRect=new n,this.element.style.position="absolute"}var i=t.Packery,n=i.Rect,o=t.getSize,s=t.getStyleProperty,r=t.EventEmitter,a=document.defaultView,h=a&&a.getComputedStyle?function(t){return a.getComputedStyle(t,null)}:function(t){return t.currentStyle},p=s("transition"),c=s("transform"),u=p&&c,l=!!s("perspective"),d={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[p],f={WebkitTransform:"-webkit-transform",MozTransform:"-moz-transform",OTransform:"-o-transform",transform:"transform"}[c];(function(t,e){for(var i in e)t[i]=e[i]})(e.prototype,r.prototype),e.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},e.prototype.getSize=function(){this.size=o(this.element)},e.prototype.css=function(t){var e=this.element.style;for(var i in t)e[i]=t[i]},e.prototype.getPosition=function(){var t=h(this.element),e=parseInt(t.left,10),i=parseInt(t.top,10);e=isNaN(e)?0:e,i=isNaN(i)?0:i;var n=this.packery.elementSize;e-=n.paddingLeft,i-=n.paddingTop,this.position.x=e,this.position.y=i};var m=l?function(t,e){return"translate3d( "+t+"px, "+e+"px, 0)"}:function(t,e){return"translate( "+t+"px, "+e+"px)"};e.prototype._transitionTo=function(t,e){this.getPosition();var i=this.position.x,n=this.position.y,o=parseInt(t,10),s=parseInt(e,10),r=o===this.position.x&&s===this.position.y;if(this.setPosition(t,e),!r||this.isTransitioning){var a=t-i,h=e-n,p={};p[f]=m(a,h),this.transition(p,this.layoutPosition)}else this.layoutPosition()},e.prototype.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},e.prototype.moveTo=u?e.prototype._transitionTo:e.prototype.goTo,e.prototype.setPosition=function(t,e){this.position.x=parseInt(t,10),this.position.y=parseInt(e,10)},e.prototype.layoutPosition=function(){var t=this.packery.elementSize;this.css({left:this.position.x+t.paddingLeft+"px",top:this.position.y+t.paddingTop+"px"}),this.emitEvent("layout",[this])},e.prototype._nonTransition=function(t,e){this.css(t),e&&e.call(this)},e.prototype._transition=function(t,e){this.transitionStyle=t;var i=[];for(var n in t)i.push(n);var o={};o[p+"Property"]=i.join(","),o[p+"Duration"]=this.packery.options.transitionDuration,this.element.addEventListener(d,this,!1),e&&this.on("transitionEnd",function(t){return e.call(t),!0}),this.css(o),this.css(t),this.isTransitioning=!0},e.prototype.transition=e.prototype[p?"_transition":"_nonTransition"],e.prototype.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},e.prototype.onotransitionend=function(t){this.ontransitionend(t)},e.prototype.ontransitionend=function(t){if(t.target===this.element){this.onTransitionEnd&&(this.onTransitionEnd(),delete this.onTransitionEnd),this.removeTransitionStyles();var e={};for(var i in this.transitionStyle)e[i]="";this.css(e),this.element.removeEventListener(d,this,!1),delete this.transitionStyle,this.isTransitioning=!1,this.emitEvent("transitionEnd",[this])}},e.prototype.removeTransitionStyles=function(){var t={};t[p+"Property"]="",t[p+"Duration"]="",this.css(t)},e.prototype.remove=function(){var t={opacity:0};t[f]="scale(0.001)",this.transition(t,this.removeElem)},e.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.emitEvent("remove",[this])},e.prototype.reveal=p?function(){var t={opacity:0};t[f]="scale(0.001)",this.css(t);this.element.offsetHeight;var e={opacity:1};e[f]="scale(1)",this.transition(e)}:function(){},e.prototype.destroy=function(){this.css({position:"",left:"",top:""})},e.prototype.dragStart=function(){this.getPosition(),this.removeTransitionStyles(),this.isTransitioning&&c&&(this.element.style[c]="none"),this.getSize(),this.isPlacing=!0,this.needsPositioning=!1,this.positionPlaceRect(this.position.x,this.position.y),this.isTransitioning=!1,this.didDrag=!1},e.prototype.dragMove=function(t,e){this.didDrag=!0;var i=this.packery.elementSize;t-=i.paddingLeft,e-=i.paddingTop,this.positionPlaceRect(t,e)},e.prototype.dragStop=function(){this.getPosition();var t=this.position.x!==this.placeRect.x,e=this.position.y!==this.placeRect.y;this.needsPositioning=t||e,this.didDrag=!1},e.prototype.positionPlaceRect=function(t,e,i){this.placeRect.x=this.getPlaceRectCoord(t,!0),this.placeRect.y=this.getPlaceRectCoord(e,!1,i)},e.prototype.getPlaceRectCoord=function(t,e,i){var n,o=e?"Width":"Height",s=this.size["outer"+o],r=this.packery[e?"columnWidth":"rowHeight"],a=this.packery.elementSize["inner"+o];if(e||(a=Math.max(a,this.packery.maxY),this.packery.rowHeight||(a-=this.packery.gutter)),r){r+=this.packery.gutter,a+=e?this.packery.gutter:0,t=Math.round(t/r);var h=Math[e?"floor":"ceil"](a/r);n=h-=Math.ceil(s/r)}else n=a-s;return t=i?t:Math.min(t,n),t*=r||1,Math.max(0,t)},e.prototype.copyPlaceRectPosition=function(){this.rect.x=this.placeRect.x,this.rect.y=this.placeRect.y},i.Item=e}(window),function(t){"use strict";function n(t,e){for(var i in e)t[i]=e[i];return t}function p(t){var e=[];if("number"==typeof t.length)for(var i=0,n=t.length;i<n;i++)e.push(t[i]);else e.push(t);return e}function a(t,e){if(t&&g(t)){this.element=t,this.options=n({},this.options),n(this.options,e);var i=++x;this.element.packeryGUID=i,(E[i]=this)._create(),this.options.isInitLayout&&this.layout()}else m&&m.error("bad Packery element: "+t)}var e=t.Packery,o=e.Rect,s=e.Packer,h=e.Item,c=t.classie,i=t.docReady,r=t.EventEmitter,u=t.eventie,l=t.getSize,d=t.matchesSelector,f=t.document,m=t.console,y=t.jQuery,g="object"==typeof HTMLElement?function(t){return t instanceof HTMLElement}:function(t){return t&&"object"==typeof t&&1===t.nodeType&&"string"==typeof t.nodeName},v=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var i=0,n=t.length;i<n;i++)if(t[i]===e)return i;return-1},x=0,E={};n(a.prototype,r.prototype),a.prototype.options={containerStyle:{position:"relative"},isInitLayout:!0,isResizeBound:!0,transitionDuration:"0.4s"},a.prototype._create=function(){this.packer=new s,this.reloadItems(),this.stampedElements=[],this.stamp(this.options.stamped);var t=this.options.containerStyle;n(this.element.style,t),this.options.isResizeBound&&this.bindResize();var i=this;this.handleDraggabilly={dragStart:function(t){i.itemDragStart(t.element)},dragMove:function(t){i.itemDragMove(t.element,t.position.x,t.position.y)},dragEnd:function(t){i.itemDragEnd(t.element)}},this.handleUIDraggable={start:function(t){i.itemDragStart(t.currentTarget)},drag:function(t,e){i.itemDragMove(t.currentTarget,e.position.left,e.position.top)},stop:function(t){i.itemDragEnd(t.currentTarget)}}},a.prototype.reloadItems=function(){this.items=this._getItems(this.element.children)},a.prototype._getItems=function(t){for(var e=this._filterFindItemElements(t),i=[],n=0,o=e.length;n<o;n++){var s=e[n],r=new h(s,this);i.push(r)}return i},a.prototype._filterFindItemElements=function(t){t=p(t);var e=this.options.itemSelector;if(!e)return t;for(var i=[],n=0,o=t.length;n<o;n++){var s=t[n];d(s,e)&&i.push(s);for(var r=s.querySelectorAll(e),a=0,h=r.length;a<h;a++)i.push(r[a])}return i},a.prototype.getItemElements=function(){for(var t=[],e=0,i=this.items.length;e<i;e++)t.push(this.items[e].element);return t},a.prototype._init=a.prototype.layout=function(){this._prelayout();var t=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,t),this._isLayoutInited=!0},a.prototype._prelayout=function(){this.elementSize=l(this.element),this._getMeasurements(),this.packer.width=this.elementSize.innerWidth+this.gutter,this.packer.height=Number.POSITIVE_INFINITY,this.packer.reset(),this.maxY=0,this.placeStampedElements()},a.prototype._getMeasurements=function(){this._getMeasurement("columnWidth","width"),this._getMeasurement("rowHeight","height"),this._getMeasurement("gutter","width")},a.prototype._getMeasurement=function(t,e){var i,n=this.options[t];n?("string"==typeof n?i=this.element.querySelector(n):g(n)&&(i=n),this[t]=i?l(i)[e]:n):this[t]=0},a.prototype.layoutItems=function(t,e){var i=this._getLayoutItems(t);if(i&&i.length){this._itemsOn(i,"layout",function(){this.emitEvent("layoutComplete",[this,i])});for(var n=0,o=i.length;n<o;n++){var s=i[n];this._packItem(s),this._layoutItem(s,e)}}else this.emitEvent("layoutComplete",[this,[]]);var r=this.elementSize,a=this.maxY-this.gutter;r.isBorderBox&&(a+=r.paddingBottom+r.paddingTop+r.borderTopWidth+r.borderBottomWidth),a=Math.max(a,0),this.element.style.height=a+"px"},a.prototype._getLayoutItems=function(t){for(var e=[],i=0,n=t.length;i<n;i++){var o=t[i];o.isIgnored||e.push(o)}return e},a.prototype._packItem=function(t){this._setRectSize(t.element,t.rect),this.packer.pack(t.rect),this._setMaxY(t.rect)},a.prototype._setMaxY=function(t){this.maxY=Math.max(t.y+t.height,this.maxY)},a.prototype._setRectSize=function(t,e){var i=l(t),n=i.outerWidth,o=i.outerHeight,s=this.columnWidth+this.gutter,r=this.rowHeight+this.gutter;n=this.columnWidth?Math.ceil(n/s)*s:n+this.gutter,o=this.rowHeight?Math.ceil(o/r)*r:o+this.gutter,e.width=Math.min(n,this.packer.width),e.height=o},a.prototype._layoutItem=function(t,e){var i=t.rect;e?t.goTo(i.x,i.y):t.moveTo(i.x,i.y)},a.prototype._itemsOn=function(t,e,i){function n(){return++o===s&&i.call(r),!0}for(var o=0,s=t.length,r=this,a=0,h=t.length;a<h;a++){t[a].on(e,n)}},a.prototype.stamp=function(t){if(t){"string"==typeof t&&(t=this.element.querySelectorAll(t)),t=p(t),this.stampedElements.push.apply(this.stampedElements,t);for(var e=0,i=t.length;e<i;e++){var n=t[e];this.ignore(n)}}},a.prototype.unstamp=function(t){if(t)for(var e=0,i=(t=p(t)).length;e<i;e++){var n=t[e],o=v(this.stampedElements,n);-1!==o&&this.stampedElements.splice(o,1),this.unignore(n)}},a.prototype.placeStampedElements=function(){if(this.stampedElements&&this.stampedElements.length){this._getBounds();for(var t=0,e=this.stampedElements.length;t<e;t++){var i=this.stampedElements[t];this.placeStamp(i)}}},a.prototype._getBounds=function(){var t=this.element.getBoundingClientRect();this._boundingLeft=t.left+this.elementSize.paddingLeft,this._boundingTop=t.top+this.elementSize.paddingTop},a.prototype.placeStamp=function(t){var e,i=this.getItem(t);e=i&&i.isPlacing?i.placeRect:this._getElementOffsetRect(t),this._setRectSize(t,e),this.packer.placed(e),this._setMaxY(e)},a.prototype._getElementOffsetRect=function(t){var e=t.getBoundingClientRect(),i=new o({x:e.left-this._boundingLeft,y:e.top-this._boundingTop});return i.x-=this.elementSize.borderLeftWidth,i.y-=this.elementSize.borderTopWidth,i},a.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},a.prototype.bindResize=function(){this.isResizeBound||(u.bind(t,"resize",this),this.isResizeBound=!0)},a.prototype.unbindResize=function(){u.unbind(t,"resize",this),this.isResizeBound=!1},a.prototype.onresize=function(){this.resizeTimeout&&clearTimeout(this.resizeTimeout);var t=this;this.resizeTimeout=setTimeout(function(){t.resize()},100)},a.prototype.resize=function(){var t=l(this.element);this.elementSize&&t&&t.innerWidth===this.elementSize.innerWidth||(this.layout(),delete this.resizeTimeout)},a.prototype.addItems=function(t){var e=this._getItems(t);if(e.length)return this.items.push.apply(this.items,e),e},a.prototype.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},a.prototype.prepended=function(t){var e=this._getItems(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._prelayout(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},a.prototype.reveal=function(t){if(t&&t.length)for(var e=0,i=t.length;e<i;e++){t[e].reveal()}},a.prototype.getItem=function(t){for(var e=0,i=this.items.length;e<i;e++){var n=this.items[e];if(n.element===t)return n}},a.prototype.getItems=function(t){if(t&&t.length){for(var e=[],i=0,n=t.length;i<n;i++){var o=t[i],s=this.getItem(o);s&&e.push(s)}return e}},a.prototype.remove=function(t){t=p(t);var e=this.getItems(t);this._itemsOn(e,"remove",function(){this.emitEvent("removeComplete",[this,e])});for(var i=0,n=e.length;i<n;i++){var o=e[i];o.remove();var s=v(this.items,o);this.items.splice(s,1)}},a.prototype.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},a.prototype.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},a.prototype.sortItemsByPosition=function(){this.items.sort(function(t,e){return t.position.y-e.position.y||t.position.x-e.position.x})},a.prototype.fit=function(t,e,i){function n(){2===++r&&s.emitEvent("fitComplete",[s,o])}var o=this.getItem(t);if(o){this._getMeasurements(),this.stamp(o.element),o.getSize(),o.isPlacing=!0,e=void 0===e?o.rect.x:e,i=void 0===i?o.rect.y:i,o.positionPlaceRect(e,i,!0);var s=this,r=0;o.on("layout",function(){return n(),!0}),this.on("layoutComplete",function(){return n(),!0}),o.moveTo(o.placeRect.x,o.placeRect.y),this.layout(),this.unstamp(o.element),this.sortItemsByPosition(),o.isPlacing=!1,o.copyPlaceRectPosition()}},a.prototype.itemDragStart=function(t){this.stamp(t);var e=this.getItem(t);e&&e.dragStart()},a.prototype.itemDragMove=function(t,e,i){var n=this.getItem(t);n&&n.dragMove(e,i);var o=this;this.clearDragTimeout(),this.dragTimeout=setTimeout(function(){o.layout(),delete o.dragTimeout},40)},a.prototype.clearDragTimeout=function(){this.dragTimeout&&clearTimeout(this.dragTimeout)},a.prototype.itemDragEnd=function(t){function e(){return++r!==s||(n&&(c.remove(n.element,"is-positioning-post-drag"),n.isPlacing=!1,n.copyPlaceRectPosition()),a.unstamp(t),a.sortItemsByPosition(),n&&o&&a.emitEvent("dragItemPositioned",[a,n])),!0}var i,n=this.getItem(t);if(n&&(i=n.didDrag,n.dragStop()),n&&(i||n.needsPositioning)){c.add(n.element,"is-positioning-post-drag");var o=n.needsPositioning,s=o?2:1,r=0,a=this;o?(n.on("layout",e),n.moveTo(n.placeRect.x,n.placeRect.y)):n&&n.copyPlaceRectPosition(),this.clearDragTimeout(),this.on("layoutComplete",e),this.layout()}else this.unstamp(t)},a.prototype.bindDraggabillyEvents=function(t){t.on("dragStart",this.handleDraggabilly.dragStart),t.on("dragMove",this.handleDraggabilly.dragMove),t.on("dragEnd",this.handleDraggabilly.dragEnd)},a.prototype.bindUIDraggableEvents=function(t){t.on("dragstart",this.handleUIDraggable.start).on("drag",this.handleUIDraggable.drag).on("dragstop",this.handleUIDraggable.stop)},a.prototype.destroy=function(){this.element.style.position="",this.element.style.height="",delete this.element.packeryGUID;for(var t=0,e=this.items.length;t<e;t++){this.items[t].destroy()}this.unbindResize()},a.data=function(t){var e=t.packeryGUID;return e&&E[e]},i(function(){for(var t=f.querySelectorAll(".js-packery"),e=0,i=t.length;e<i;e++){var n,o=t[e],s=o.getAttribute("data-packery-options");try{n=s&&JSON.parse(s)}catch(t){m&&m.error("Error parsing data-packery-options on "+o.nodeName.toLowerCase()+(o.id?"#"+o.id:"")+": "+t);continue}var r=new a(o,n);y&&y.data(o,"packery",r)}}),y&&y.bridget&&y.bridget("packery",a),a.Rect=o,a.Packer=s,a.Item=h,t.Packery=a}(window);