function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}(function(){function e(){}function o(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function t(e){return function(){return this[e].apply(this,arguments)}}var n=e.prototype,i=this,r=i.EventEmitter;n.getListeners=function(e){var t,n,i=this._getEvents();if("object"==_typeof(e))for(n in t={},i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n]);else t=i[e]||(i[e]=[]);return t},n.flattenListeners=function(e){for(var t=[],n=0;e.length>n;n+=1)t.push(e[n].listener);return t},n.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&((t={})[e]=n),t||n},n.addListener=function(e,t){var n,i=this.getListenersAsObject(e),r="object"==_typeof(t);for(n in i)i.hasOwnProperty(n)&&-1===o(i[n],t)&&i[n].push(r?t:{listener:t,once:!1});return this},n.on=t("addListener"),n.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},n.once=t("addOnceListener"),n.defineEvent=function(e){return this.getListeners(e),this},n.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},n.removeListener=function(e,t){var n,i,r=this.getListenersAsObject(e);for(i in r)r.hasOwnProperty(i)&&(-1!==(n=o(r[i],t))&&r[i].splice(n,1));return this},n.off=t("removeListener"),n.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},n.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},n.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=_typeof(t)||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o:s).call(this,i,r);return this},n.removeEvent=function(e){var t,n=_typeof(e),i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},n.removeAllListeners=t("removeEvent"),n.emitEvent=function(e,t){var n,i,r,o=this.getListenersAsObject(e);for(r in o)if(o.hasOwnProperty(r))for(i=o[r].length;i--;)!0===(n=o[r][i]).once&&this.removeListener(e,n.listener),n.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},n.trigger=t("emitEvent"),n.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},n.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},n._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},n._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return i.EventEmitter=r,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(n){function i(e){var t=n.event;return t.target=t.target||t.srcElement||e,t}var e=document.documentElement,t=function(){},r=(e.addEventListener?t=function(e,t,n){e.addEventListener(t,n,!1)}:e.attachEvent&&(t=function(t,e,n){t[e+n]=n.handleEvent?function(){var e=i(t);n.handleEvent.call(n,e)}:function(){var e=i(t);n.call(t,e)},t.attachEvent("on"+e,t[e+n])}),function(){}),e=(e.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:e.detachEvent&&(r=function(t,n,i){t.detachEvent("on"+n,t[n+i]);try{delete t[n+i]}catch(e){t[n+i]=void 0}}),{bind:t,unbind:r});"function"==typeof define&&define.amd?define("eventie/eventie",e):n.eventie=e}(this),function(n,i){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(e,t){return i(n,e,t)}):"object"==("undefined"==typeof exports?"undefined":_typeof(exports))?module.exports=i(n,require("wolfy87-eventemitter"),require("eventie")):n.imagesLoaded=i(n,n.EventEmitter,n.eventie)}(window,function(e,t,n){function r(e,t){for(var n in t)e[n]=t[n];return e}function o(e){var t=[];if("[object Array]"===a.call(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;n<i;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=r({},this.options),"function"==typeof t?n=t:r(this.options,t),n&&this.on("always",n),this.getImages(),c&&(this.jqDeferred=new c.Deferred);var i=this;setTimeout(function(){i.check()})}function i(e){this.img=e}function f(e){this.src=e,d[e]=this}var c=e.jQuery,u=e.console,h=void 0!==u,a=Object.prototype.toString,d=((s.prototype=new t).options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;e<t;e++){var n=this.elements[e],i=("IMG"===n.nodeName&&this.addImage(n),n.nodeType);if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;o<s;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){e=new i(e);this.images.push(e)},s.prototype.check=function(){function e(e,t){return n.options.debug&&h&&u.log("confirm",e,t),n.progress(e),++i===r&&n.complete(),!0}var n=this,i=0,r=this.images.length;if(this.hasAnyBroken=!1,r)for(var t=0;t<r;t++){var o=this.images[t];o.on("confirm",e),o.check()}else this.complete()},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done",n=(this.isComplete=!0,this);setTimeout(function(){var e;n.emit(t,n),n.emit("always",n),n.jqDeferred&&(e=n.hasAnyBroken?"reject":"resolve",n.jqDeferred[e](n))})},c&&(c.fn.imagesLoaded=function(e,t){return new s(this,e,t).jqDeferred.promise(c(this))}),(i.prototype=new t).check=function(){var n,e=d[this.img.src]||new f(this.img.src);e.isConfirmed?this.confirm(e.isLoaded,"cached was confirmed"):this.img.complete&&void 0!==this.img.naturalWidth?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(n=this,e.on("confirm",function(e,t){return n.confirm(e.isLoaded,t),!0}),e.check())},i.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)},{});return(f.prototype=new t).check=function(){var e;this.isChecked||(e=new Image,n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0)},f.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},f.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},f.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},f.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},f.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});