(function framework7ComponentLoader(a,e){void 0===e&&(e=!0);document;var c=window,y=a.$,t=(a.Template7,a.utils),f=(a.device,a.support),r=(a.Class,a.Modal,a.ConstructorMethods,a.ModalMethods,{destroy:function(a){var e=y(a).closest(".page");e.length&&e[0].f7LazyDestroy&&e[0].f7LazyDestroy()},create:function(a){var t=this,e=y(a).closest(".page").eq(0),r=e.find(".lazy");if(0!==r.length||e.hasClass("lazy")){var n=t.params.lazy.placeholder;!1!==n&&r.each(function(a,e){y(e).attr("data-src")&&!y(e).attr("src")&&y(e).attr("src",n)});var o=[],s=!1;if(t.params.lazy.observer&&f.intersectionObserver){var l=e[0].f7LazyObserver;return l||(l=new c.IntersectionObserver(function(a,e){a.forEach(function(a){if(a.isIntersecting){if(t.params.lazy.sequential&&s)return void(o.indexOf(a.target)<0&&o.push(a.target));s=!0,t.lazy.loadImage(a.target,i),e.unobserve(a.target)}})},{root:e[0]})),r.each(function(a,e){e.f7LazyObserverAdded||(e.f7LazyObserverAdded=!0,l.observe(e))}),void(e[0].f7LazyDestroy||(e[0].f7LazyDestroy=function(){l.disconnect(),delete e[0].f7LazyDestroy,delete e[0].f7LazyObserver}))}e[0].f7LazyDestroy||(e[0].f7LazyDestroy=function(){e[0].f7LazyAttached=!1,delete e[0].f7LazyAttached,e.off("lazy",d),e.off("scroll",d,!0),e.find(".tab").off("tab:mounted tab:show",d),t.off("resize",d)}),e[0].f7LazyAttached||(e[0].f7LazyAttached=!0,e.on("lazy",d),e.on("scroll",d,!0),e.find(".tab").on("tab:mounted tab:show",d),t.on("resize",d)),d()}function i(a){0<=o.indexOf(a)&&o.splice(o.indexOf(a),1),s=!1,t.params.lazy.sequential&&0<o.length&&(s=!0,t.lazy.loadImage(o[0],i))}function d(){t.lazy.load(e,function(a){t.params.lazy.sequential&&s?o.indexOf(a)<0&&o.push(a):(s=!0,t.lazy.loadImage(a,i))})}},isInViewport:function(a){var e=this,t=a.getBoundingClientRect(),r=e.params.lazy.threshold||0;return t.top>=0-r&&t.left>=0-r&&t.top<=e.height+r&&t.left<=e.width+r},loadImage:function(a,e){var t=this,r=y(a),n=r.attr("data-background"),o=n||r.attr("data-src");if(o){var s=new c.Image;s.onload=function(){r.removeClass("lazy").addClass("lazy-loaded"),n?r.css("background-image","url("+o+")"):r.attr("src",o),e&&e(a),r.trigger("lazy:loaded"),t.emit("lazyLoaded",r[0])},s.onerror=function(){r.removeClass("lazy").addClass("lazy-loaded"),n?r.css("background-image","url("+(t.params.lazy.placeholder||"")+")"):r.attr("src",t.params.lazy.placeholder||""),e&&e(a),r.trigger("lazy:error"),t.emit("lazyError",r[0])},s.src=o,r.removeAttr("data-src").removeAttr("data-background"),r.trigger("lazy:load"),t.emit("lazyLoad",r[0])}},load:function(a,t){var r=this,e=y(a);e.hasClass("page")||(e=e.parents(".page").eq(0)),0!==e.length&&e.find(".lazy").each(function(a,e){0<y(e).parents(".tab:not(.tab-active)").length||r.lazy.isInViewport(e)&&(t?t(e):r.lazy.loadImage(e))})}}),n={name:"lazy",params:{lazy:{placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEXCwsK592mkAAAACklEQVQI12NgAAAAAgAB4iG8MwAAAABJRU5ErkJggg==",threshold:0,sequential:!0,observer:!0}},create:function(){var a=this;t.extend(a,{lazy:{create:r.create.bind(a),destroy:r.destroy.bind(a),loadImage:r.loadImage.bind(a),load:r.load.bind(a),isInViewport:r.isInViewport.bind(a)}})},on:{pageInit:function(a){(0<a.$el.find(".lazy").length||a.$el.hasClass("lazy"))&&this.lazy.create(a.$el)},pageAfterIn:function(a){this.params.lazy.observer&&f.intersectionObserver||(0<a.$el.find(".lazy").length||a.$el.hasClass("lazy"))&&this.lazy.create(a.$el)},pageBeforeRemove:function(a){(0<a.$el.find(".lazy").length||a.$el.hasClass("lazy"))&&this.lazy.destroy(a.$el)},tabMounted:function(a){var e=y(a);(0<e.find(".lazy").length||e.hasClass("lazy"))&&this.lazy.create(e)},tabBeforeRemove:function(a){if(!this.params.lazy.observer||!f.intersectionObserver){var e=y(a);(0<e.find(".lazy").length||e.hasClass("lazy"))&&this.lazy.destroy(e)}}}};if(e){if(a.prototype.modules&&a.prototype.modules[n.name])return;a.use(n),a.instance&&(a.instance.useModuleParams(n,a.instance.params),a.instance.useModule(n))}return n}(Framework7, typeof Framework7AutoInstallComponent === 'undefined' ? undefined : Framework7AutoInstallComponent))
