'),g.$el.trigger("hasVideo.lg",[t,o,d])):g.$slide.eq(t).prepend('');if(g.$el.trigger("onAferAppendSlide.lg",[t]),l=g.$slide.eq(t).find(".lg-object"),r&&l.attr("sizes",r),a){l.attr("srcset",a);try{picturefill({elements:[l[0]]})}catch(e){console.warn("lightGallery :- If you want srcset to be supported for older browser please include picturefil version 2 javascript library in your document.")}}".lg-sub-html"!==this.s.appendSubHtmlTo&&g.addHtml(t),g.$slide.eq(t).addClass("lg-loaded")}g.$slide.eq(t).find(".lg-object").on("load.lg error.lg",function(){var s=0;i&&!e("body").hasClass("lg-from-hash")&&(s=i),setTimeout(function(){g.$slide.eq(t).addClass("lg-complete"),g.$el.trigger("onSlideItemLoad.lg",[t,i||0])},s)}),m&&m.html5&&!h&&g.$slide.eq(t).addClass("lg-complete"),!0===s&&(g.$slide.eq(t).hasClass("lg-complete")?g.preload(t):g.$slide.eq(t).find(".lg-object").on("load.lg error.lg",function(){g.preload(t)}))},s.prototype.slide=function(t,s,i,l){var o=this.$outer.find(".lg-current").index(),n=this;if(!n.lGalleryOn||o!==t){var a=this.$slide.length,r=n.lGalleryOn?this.s.speed:0;if(!n.lgBusy){var d,g,h;if(this.s.download)(d=n.s.dynamic?!1!==n.s.dynamicEl[t].downloadUrl&&(n.s.dynamicEl[t].downloadUrl||n.s.dynamicEl[t].src):"false"!==n.$items.eq(t).attr("data-download-url")&&(n.$items.eq(t).attr("data-download-url")||n.$items.eq(t).attr("href")||n.$items.eq(t).attr("data-src")))?(e("#lg-download").attr("href",d),n.$outer.removeClass("lg-hide-download")):n.$outer.addClass("lg-hide-download");if(this.$el.trigger("onBeforeSlide.lg",[o,t,s,i]),n.lgBusy=!0,clearTimeout(n.hideBartimeout),".lg-sub-html"===this.s.appendSubHtmlTo&&setTimeout(function(){n.addHtml(t)},r),this.arrowDisable(t),l||(to&&(l="next")),s)this.$slide.removeClass("lg-prev-slide lg-current lg-next-slide"),a>2?(g=t-1,h=t+1,0===t&&o===a-1?(h=0,g=a-1):t===a-1&&0===o&&(h=0,g=a-1)):(g=0,h=1),"prev"===l?n.$slide.eq(h).addClass("lg-next-slide"):n.$slide.eq(g).addClass("lg-prev-slide"),n.$slide.eq(t).addClass("lg-current");else n.$outer.addClass("lg-no-trans"),this.$slide.removeClass("lg-prev-slide lg-next-slide"),"prev"===l?(this.$slide.eq(t).addClass("lg-prev-slide"),this.$slide.eq(o).addClass("lg-next-slide")):(this.$slide.eq(t).addClass("lg-next-slide"),this.$slide.eq(o).addClass("lg-prev-slide")),setTimeout(function(){n.$slide.removeClass("lg-current"),n.$slide.eq(t).addClass("lg-current"),n.$outer.removeClass("lg-no-trans")},50);n.lGalleryOn?(setTimeout(function(){n.loadContent(t,!0,0)},this.s.speed+50),setTimeout(function(){n.lgBusy=!1,n.$el.trigger("onAfterSlide.lg",[o,t,s,i])},this.s.speed)):(n.loadContent(t,!0,n.s.backdropDuration),n.lgBusy=!1,n.$el.trigger("onAfterSlide.lg",[o,t,s,i])),n.lGalleryOn=!0,this.s.counter&&e("#lg-counter-current").text(t+1)}n.index=t}},s.prototype.goToNextSlide=function(e){var t=this,s=t.s.loop;e&&t.$slide.length<3&&(s=!1),t.lgBusy||(t.index+10?(t.index--,t.$el.trigger("onBeforePrevSlide.lg",[t.index,e]),t.slide(t.index,e,!1,"prev")):s?(t.index=t.$items.length-1,t.$el.trigger("onBeforePrevSlide.lg",[t.index,e]),t.slide(t.index,e,!1,"prev")):t.s.slideEndAnimatoin&&!e&&(t.$outer.addClass("lg-left-end"),setTimeout(function(){t.$outer.removeClass("lg-left-end")},400)))},s.prototype.keyPress=function(){var t=this;this.$items.length>1&&e(window).on("keyup.lg",function(e){t.$items.length>1&&(37===e.keyCode&&(e.preventDefault(),t.goToPrevSlide()),39===e.keyCode&&(e.preventDefault(),t.goToNextSlide()))}),e(window).on("keydown.lg",function(e){!0===t.s.escKey&&27===e.keyCode&&(e.preventDefault(),t.$outer.hasClass("lg-thumb-open")?t.$outer.removeClass("lg-thumb-open"):t.destroy())})},s.prototype.arrow=function(){var e=this;this.$outer.find(".lg-prev").on("click.lg",function(){e.goToPrevSlide()}),this.$outer.find(".lg-next").on("click.lg",function(){e.goToNextSlide()})},s.prototype.arrowDisable=function(e){!this.s.loop&&this.s.hideControlOnEnd&&(e+10?this.$outer.find(".lg-prev").removeAttr("disabled").removeClass("disabled"):this.$outer.find(".lg-prev").attr("disabled","disabled").addClass("disabled"))},s.prototype.setTranslate=function(e,t,s){this.s.useLeft?e.css("left",t):e.css({transform:"translate3d("+t+"px, "+s+"px, 0px)"})},s.prototype.touchMove=function(t,s){var i=s-t;Math.abs(i)>15&&(this.$outer.addClass("lg-dragging"),this.setTranslate(this.$slide.eq(this.index),i,0),this.setTranslate(e(".lg-prev-slide"),-this.$slide.eq(this.index).width()+i,0),this.setTranslate(e(".lg-next-slide"),this.$slide.eq(this.index).width()+i,0))},s.prototype.touchEnd=function(e){var t=this;"lg-slide"!==t.s.mode&&t.$outer.addClass("lg-slide"),this.$slide.not(".lg-current, .lg-prev-slide, .lg-next-slide").css("opacity","0"),setTimeout(function(){t.$outer.removeClass("lg-dragging"),e<0&&Math.abs(e)>t.s.swipeThreshold?t.goToNextSlide(!0):e>0&&Math.abs(e)>t.s.swipeThreshold?t.goToPrevSlide(!0):Math.abs(e)<5&&t.$el.trigger("onSlideClick.lg"),t.$slide.removeAttr("style")}),setTimeout(function(){t.$outer.hasClass("lg-dragging")||"lg-slide"===t.s.mode||t.$outer.removeClass("lg-slide")},t.s.speed+100)},s.prototype.enableSwipe=function(){var e=this,t=0,s=0,i=!1;e.s.enableSwipe&&e.doCss()&&(e.$slide.on("touchstart.lg",function(s){e.$outer.hasClass("lg-zoomed")||e.lgBusy||(s.preventDefault(),e.manageSwipeClass(),t=s.originalEvent.targetTouches[0].pageX)}),e.$slide.on("touchmove.lg",function(l){e.$outer.hasClass("lg-zoomed")||(l.preventDefault(),s=l.originalEvent.targetTouches[0].pageX,e.touchMove(t,s),i=!0)}),e.$slide.on("touchend.lg",function(){e.$outer.hasClass("lg-zoomed")||(i?(i=!1,e.touchEnd(s-t)):e.$el.trigger("onSlideClick.lg"))}))},s.prototype.enableDrag=function(){var t=this,s=0,i=0,l=!1,o=!1;t.s.enableDrag&&t.doCss()&&(t.$slide.on("mousedown.lg",function(i){t.$outer.hasClass("lg-zoomed")||t.lgBusy||e(i.target).text().trim()||(i.preventDefault(),t.manageSwipeClass(),s=i.pageX,l=!0,t.$outer.scrollLeft+=1,t.$outer.scrollLeft-=1,t.$outer.removeClass("lg-grab").addClass("lg-grabbing"),t.$el.trigger("onDragstart.lg"))}),e(window).on("mousemove.lg",function(e){l&&(o=!0,i=e.pageX,t.touchMove(s,i),t.$el.trigger("onDragmove.lg"))}),e(window).on("mouseup.lg",function(n){o?(o=!1,t.touchEnd(i-s),t.$el.trigger("onDragend.lg")):(e(n.target).hasClass("lg-object")||e(n.target).hasClass("lg-video-play"))&&t.$el.trigger("onSlideClick.lg"),l&&(l=!1,t.$outer.removeClass("lg-grabbing").addClass("lg-grab"))}))},s.prototype.manageSwipeClass=function(){var e=this.index+1,t=this.index-1;this.s.loop&&this.$slide.length>2&&(0===this.index?t=this.$slide.length-1:this.index===this.$slide.length-1&&(e=0)),this.$slide.removeClass("lg-next-slide lg-prev-slide"),t>-1&&this.$slide.eq(t).addClass("lg-prev-slide"),this.$slide.eq(e).addClass("lg-next-slide")},s.prototype.mousewheel=function(){var e=this;e.$outer.on("mousewheel.lg",function(t){t.deltaY&&(t.deltaY>0?e.goToPrevSlide():e.goToNextSlide(),t.preventDefault())})},s.prototype.closeGallery=function(){var t=this,s=!1;this.$outer.find(".lg-close").on("click.lg",function(){t.destroy()}),t.s.closable&&(t.$outer.on("mousedown.lg",function(t){s=!!(e(t.target).is(".lg-outer")||e(t.target).is(".lg-item ")||e(t.target).is(".lg-img-wrap"))}),t.$outer.on("mousemove.lg",function(){s=!1}),t.$outer.on("mouseup.lg",function(i){(e(i.target).is(".lg-outer")||e(i.target).is(".lg-item ")||e(i.target).is(".lg-img-wrap")&&s)&&(t.$outer.hasClass("lg-dragging")||t.destroy())}))},s.prototype.destroy=function(t){var s=this;t||(s.$el.trigger("onBeforeClose.lg"),e(window).scrollTop(s.prevScrollTop)),t&&(s.s.dynamic||this.$items.off("click.lg click.lgcustom"),e.removeData(s.el,"lightGallery")),this.$el.off(".lg.tm"),e.each(e.fn.lightGallery.modules,function(e){s.modules[e]&&s.modules[e].destroy()}),this.lGalleryOn=!1,clearTimeout(s.hideBartimeout),this.hideBartimeout=!1,e(window).off(".lg"),e("body").removeClass("lg-on lg-from-hash"),s.$outer&&s.$outer.removeClass("lg-visible"),e(".lg-backdrop").removeClass("in"),setTimeout(function(){s.$outer&&s.$outer.remove(),e(".lg-backdrop").remove(),t||s.$el.trigger("onCloseAfter.lg")},s.s.backdropDuration+50)},e.fn.lightGallery=function(t){return this.each(function(){if(e.data(this,"lightGallery"))try{e(this).data("lightGallery").init()}catch(e){console.error("lightGallery has not been initiated properly")}else e.data(this,"lightGallery",new s(this,t))})},e.fn.lightGallery.modules={}}()});