!function(e){"use strict";function t(e){var t=e.container instanceof Node?e.container:document.querySelector(e.container);if(!t)return!1;var n=e.item instanceof NodeList?e.item:t.querySelectorAll(e.item);return n&&0!==n.length?(e.containerLoaded&&"string"==typeof e.containerLoaded||(e.containerLoaded=!1),e.containerLoaded&&"string"==typeof e.itemLoaded||(e.itemLoaded=!1),o||e.skipWindowOnLoad?void i(t,n,e):void i(t,n,e)):!1}function i(e,t,i){i.containerLoaded?e.classList.add(i.containerLoaded):/loaded/.test(e.className)||e.classList.add(e.className.split(" ")[0]+"--loaded"),o=!0;var a="number"==typeof i.gutter&&isFinite(i.gutter)&&Math.floor(i.gutter)===i.gutter?i.gutter:0,d=i.done;e.style.width="";var r=Array.prototype.forEach,s=e.getBoundingClientRect().width,l=t[0].getBoundingClientRect().width+a,c=Math.max(Math.floor((s-a)/l),1),u=0;s=l*c+a+"px",e.style.width=s,e.style.position="relative";for(var f=[],m=[],p=0;c>p;++p)m.push(p*l+a),f.push(a);r.call(t,function(e){var t=f.slice(0).sort(function(e,t){return e-t}).shift();t=f.indexOf(t);var o=m[t],d=f[t];return e.style.position="absolute",e.style.webkitBackfaceVisibility=e.style.backfaceVisibility="hidden",i.itemLoaded?e.classList.add(i.itemLoaded):/loaded/.test(e.className)||e.classList.add(e.className.split(" ")[0]+"--loaded"),!i.animate&&n&&(e.style.top=d+"px",e.style.left=o+"px"),f[t]+=e.getBoundingClientRect().height+a,u+=1,i.animate?i.animate(e,o,d,u):void 0});var y=f.slice(0).sort(function(e,t){return e-t}).pop();e.style.height=y+"px","function"==typeof d&&d(t)}var n,o;!function(){var e,t=document.createElement("a").style;void 0!==t[e="webkitTransform"]&&(n=e),void 0!==t[e="msTransform"]&&(n=e),void 0!==t[e="transform"]&&(n=e)}(),"function"==typeof define&&define.amd?define(function(){return t}):"undefined"!=typeof module&&module.exports?module.exports=t:e.minigrid=t}(this);