define(["exports","../browser.js"],function(_exports,_browser){function LazyLoader(options){this.options=options}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_browser=babelHelpers.interopRequireDefault(_browser),LazyLoader.prototype.createObserver=function(){var observerOptions={},options=this.options,loadedCount=0,callback=options.callback;_browser.default.edge||(observerOptions.rootMargin="50%");var observerId="obs"+Date.now(),self=this,observer=new IntersectionObserver(function(entries){for(var j=0,length2=entries.length;j<length2;j++){var target,entry=entries[j],isIntersecting=entry.isIntersecting;null==isIntersecting&&(isIntersecting=0<entry.intersectionRatio),isIntersecting&&(target=entry.target,observer.unobserve(target),target[observerId]||(target[observerId]=1,callback(target),++loadedCount>=self.elementCount&&self.destroyObserver()))}},observerOptions);this.observer=observer},LazyLoader.prototype.addElements=function(elements){var observer=this.observer;observer||(this.createObserver(),observer=this.observer),this.elementCount=(this.elementCount||0)+elements.length;for(var i=0,length=elements.length;i<length;i++)observer.observe(elements[i])},LazyLoader.prototype.destroyObserver=function(elements){var observer=this.observer;observer&&(observer.disconnect(),this.observer=null)},LazyLoader.prototype.destroy=function(elements){this.destroyObserver(),this.options=null},LazyLoader.lazyChildren=function(elem,callback){!function(elements,callback){elements.length&&new LazyLoader({callback:callback}).addElements(elements)}(elem.getElementsByClassName("lazy"),callback)},_exports.default=LazyLoader});