1// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/lightgallery.es5.js 2 3/*! 4 * lightgallery | 2.8.3 | March 1st 2025 5 * http://www.lightgalleryjs.com/ 6 * Copyright (c) 2020 Sachin Neravath; 7 * @license GPLv3 8 */ 9var __assign=function(){__assign=Object.assign||function __assign(t){for(var e,i=1,s=arguments.length;i<s;i++){e=arguments[i];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};return __assign.apply(this,arguments)};function __spreadArrays(){for(var t=0,e=0,i=arguments.length;e<i;e++)t+=arguments[e].length;var s=Array(t),r=0;for(e=0;e<i;e++)for(var n=arguments[e],l=0,o=n.length;l<o;l++,r++)s[r]=n[l];return s}var t={afterAppendSlide:"lgAfterAppendSlide",init:"lgInit",hasVideo:"lgHasVideo",containerResize:"lgContainerResize",updateSlides:"lgUpdateSlides",afterAppendSubHtml:"lgAfterAppendSubHtml",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",beforeSlide:"lgBeforeSlide",afterSlide:"lgAfterSlide",posterClick:"lgPosterClick",dragStart:"lgDragStart",dragMove:"lgDragMove",dragEnd:"lgDragEnd",beforeNextSlide:"lgBeforeNextSlide",beforePrevSlide:"lgBeforePrevSlide",beforeClose:"lgBeforeClose",afterClose:"lgAfterClose",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical",autoplay:"lgAutoplay",autoplayStart:"lgAutoplayStart",autoplayStop:"lgAutoplayStop"};var e={mode:"lg-slide",easing:"ease",speed:400,licenseKey:"0000-0000-000-0000",height:"100%",width:"100%",addClass:"",startClass:"lg-start-zoom",backdropDuration:300,container:"",startAnimationDuration:400,zoomFromOrigin:true,hideBarsDelay:0,showBarsAfter:1e4,slideDelay:0,supportLegacyBrowser:true,allowMediaOverlap:false,videoMaxSize:"1280-720",loadYouTubePoster:true,defaultCaptionHeight:0,ariaLabelledby:"",ariaDescribedby:"",resetScrollPosition:true,hideScrollbar:false,closable:true,swipeToClose:true,closeOnTap:true,showCloseIcon:true,showMaximizeIcon:false,loop:true,escKey:true,keyPress:true,trapFocus:true,controls:true,slideEndAnimation:true,hideControlOnEnd:false,mousewheel:false,getCaptionFromTitleOrAlt:true,appendSubHtmlTo:".lg-sub-html",subHtmlSelectorRelative:false,preload:2,numberOfSlideItemsInDom:10,selector:"",selectWithin:"",nextHtml:"",prevHtml:"",index:0,iframeWidth:"100%",iframeHeight:"100%",iframeMaxWidth:"100%",iframeMaxHeight:"100%",download:true,counter:true,appendCounterTo:".lg-toolbar",swipeThreshold:50,enableSwipe:true,enableDrag:true,dynamic:false,dynamicEl:[],extraProps:[],exThumbImage:"",isMobile:void 0,mobileSettings:{controls:false,showCloseIcon:false,download:false},plugins:[],strings:{closeGallery:"Close gallery",toggleMaximize:"Toggle maximize",previousSlide:"Previous slide",nextSlide:"Next slide",download:"Download",playVideo:"Play video",mediaLoadingFailed:"Oops... Failed to load content..."}};function initLgPolyfills(){(function(){if(typeof window.CustomEvent==="function")return false;function CustomEvent(t,e){e=e||{bubbles:false,cancelable:false,detail:null};var i=document.createEvent("CustomEvent");i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail);return i}window.CustomEvent=CustomEvent})();(function(){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector)})()}var i=function(){function lgQuery(t){this.cssVenderPrefixes=["TransitionDuration","TransitionTimingFunction","Transform","Transition"];this.selector=this._getSelector(t);this.firstElement=this._getFirstEl();return this}lgQuery.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=Math.random()*16|0,i=t=="x"?e:e&3|8;return i.toString(16)}))};lgQuery.prototype._getSelector=function(t,e){e===void 0&&(e=document);if(typeof t!=="string")return t;e=e||document;var i=t.substring(0,1);return i==="#"?e.querySelector(t):e.querySelectorAll(t)};lgQuery.prototype._each=function(t){if(!this.selector)return this;this.selector.length!==void 0?[].forEach.call(this.selector,t):t(this.selector,0);return this};
9lgQuery.prototype._setCssVendorPrefix=function(t,e,i){var s=e.replace(/-([a-z])/gi,(function(t,e){return e.toUpperCase()}));if(this.cssVenderPrefixes.indexOf(s)!==-1){t.style[s.charAt(0).toLowerCase()+s.slice(1)]=i;t.style["webkit"+s]=i;t.style["moz"+s]=i;t.style["ms"+s]=i;t.style["o"+s]=i}else t.style[s]=i};lgQuery.prototype._getFirstEl=function(){return this.selector&&this.selector.length!==void 0?this.selector[0]:this.selector};lgQuery.prototype.isEventMatched=function(t,e){var i=e.split(".");return t.split(".").filter((function(t){return t})).every((function(t){return i.indexOf(t)!==-1}))};lgQuery.prototype.attr=function(t,e){if(e===void 0)return this.firstElement?this.firstElement.getAttribute(t):"";this._each((function(i){i.setAttribute(t,e)}));return this};lgQuery.prototype.find=function(t){return $LG(this._getSelector(t,this.selector))};lgQuery.prototype.first=function(){return this.selector&&this.selector.length!==void 0?$LG(this.selector[0]):$LG(this.selector)};lgQuery.prototype.eq=function(t){return $LG(this.selector[t])};lgQuery.prototype.parent=function(){return $LG(this.selector.parentElement)};lgQuery.prototype.get=function(){return this._getFirstEl()};lgQuery.prototype.removeAttr=function(t){var e=t.split(" ");this._each((function(t){e.forEach((function(e){return t.removeAttribute(e)}))}));return this};lgQuery.prototype.wrap=function(t){if(!this.firstElement)return this;var e=document.createElement("div");e.className=t;this.firstElement.parentNode.insertBefore(e,this.firstElement);this.firstElement.parentNode.removeChild(this.firstElement);e.appendChild(this.firstElement);return this};lgQuery.prototype.addClass=function(t){t===void 0&&(t="");this._each((function(e){t.split(" ").forEach((function(t){t&&e.classList.add(t)}))}));return this};lgQuery.prototype.removeClass=function(t){this._each((function(e){t.split(" ").forEach((function(t){t&&e.classList.remove(t)}))}));return this};lgQuery.prototype.hasClass=function(t){return!!this.firstElement&&this.firstElement.classList.contains(t)};lgQuery.prototype.hasAttribute=function(t){return!!this.firstElement&&this.firstElement.hasAttribute(t)};lgQuery.prototype.toggleClass=function(t){if(!this.firstElement)return this;this.hasClass(t)?this.removeClass(t):this.addClass(t);return this};lgQuery.prototype.css=function(t,e){var i=this;this._each((function(s){i._setCssVendorPrefix(s,t,e)}));return this};lgQuery.prototype.on=function(t,e){var i=this;if(!this.selector)return this;t.split(" ").forEach((function(t){Array.isArray(lgQuery.eventListeners[t])||(lgQuery.eventListeners[t]=[]);lgQuery.eventListeners[t].push(e);i.selector.addEventListener(t.split(".")[0],e)}));return this};lgQuery.prototype.once=function(t,e){var i=this;this.on(t,(function(){i.off(t);e(t)}));return this};lgQuery.prototype.off=function(t){var e=this;if(!this.selector)return this;Object.keys(lgQuery.eventListeners).forEach((function(i){if(e.isEventMatched(t,i)){lgQuery.eventListeners[i].forEac
9h((function(t){e.selector.removeEventListener(i.split(".")[0],t)}));lgQuery.eventListeners[i]=[]}}));return this};lgQuery.prototype.trigger=function(t,e){if(!this.firstElement)return this;var i=new CustomEvent(t.split(".")[0],{detail:e||null});this.firstElement.dispatchEvent(i);return this};lgQuery.prototype.load=function(t){var e=this;fetch(t).then((function(t){return t.text()})).then((function(t){e.selector.innerHTML=t}));return this};lgQuery.prototype.html=function(t){if(t===void 0)return this.firstElement?this.firstElement.innerHTML:"";this._each((function(e){e.innerHTML=t}));return this};lgQuery.prototype.append=function(t){this._each((function(e){typeof t==="string"?e.insertAdjacentHTML("beforeend",t):e.appendChild(t)}));return this};lgQuery.prototype.prepend=function(t){this._each((function(e){typeof t==="string"?e.insertAdjacentHTML("afterbegin",t):t instanceof HTMLElement&&e.insertBefore(t.cloneNode(true),e.firstChild)}));return this};lgQuery.prototype.remove=function(){this._each((function(t){t.parentNode.removeChild(t)}));return this};lgQuery.prototype.empty=function(){this._each((function(t){t.innerHTML=""}));return this};lgQuery.prototype.scrollTop=function(t){if(t!==void 0){document.body.scrollTop=t;document.documentElement.scrollTop=t;return this}return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0};lgQuery.prototype.scrollLeft=function(t){if(t!==void 0){document.body.scrollLeft=t;document.documentElement.scrollLeft=t;return this}return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0};lgQuery.prototype.offset=function(){if(!this.firstElement)return{left:0,top:0};var t=this.firstElement.getBoundingClientRect();var e=$LG("body").style().marginLeft;return{left:t.left-parseFloat(e)+this.scrollLeft(),top:t.top+this.scrollTop()}};lgQuery.prototype.style=function(){return this.firstElement?this.firstElement.currentStyle||window.getComputedStyle(this.firstElement):{}};lgQuery.prototype.width=function(){var t=this.style();return this.firstElement.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)};lgQuery.prototype.height=function(){var t=this.style();return this.firstElement.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)};lgQuery.eventListeners={};return lgQuery}();function $LG(t){initLgPolyfills();return new i(t)}var s=["src","sources","subHtml","subHtmlUrl","html","video","poster","slideName","responsive","srcset","sizes","iframe","downloadUrl","download","width","facebookShareUrl","tweetText","iframeTitle","twitterShareUrl","pinterestShareUrl","pinterestText","fbHtml","disqusIdentifier","disqusUrl"];function convertToData(t){if(t==="href")return"src";t=t.replace("data-","");t=t.charAt(0).toLowerCase()+t.slice(1);t=t.replace(/-([a-z])/g,(function(t){return t[1].toUpperCase()}));return t}var r={ 10/** 11 * Fetches HTML content from a given URL and inserts it into a specified element. 12 * 13 * @param url - The URL to fetch the HTML content from. 14 * @param element - The DOM element (jQuery object) to insert the HTML content into. 15 * @param insertMethod - The method to insert the HTML ('append' or 'replace'). 16 */ 17fetchCaptionFromUrl:function(t,e,i){fetch(t).then((function(t){return t.text()})).then((function(t){if(i==="append"){var s='<div class="lg-sub-html">'+t+"</div>";e.append(s)}else e.html(t)}))},getSize:function(t,e,i,s){i===void 0&&(i=0);var r=$LG(t);var n=r.attr("data-lg-size")||s;if(n){var l=n.split(",");if(l[1]){var o=window.innerWidth;for(var a=0;a<l.length;a++){var g=l[a];var d=parseInt(g.split("-")[2],10);if(d>o){n=g;break}a===l.length-1&&(n=g)}}var h=n.split("-");var u=parseInt(h[0],10);var c=parseInt(h[1],10);var m=e.width();var p=e.height()-i;var f=Math.min(m,u);var y=Math.min(p,c);var v=Math.min(f/u,y/c);return{width:u*v,height:c*v}}}, 18/** 19 * @desc Get transform value based on the imageSize. Used for ZoomFromOrigin option 20 * @param {jQuery Element} 21 * @returns {String} Transform CSS string 22 */ 23getTransform:function(t,e,i,s,r){if(r){var n=$LG(t).find("img").first();if(n.get()){var l=e.get().getBoundingClientRect();var o=l.width;var a=e.height()-(i+s);var g=n.width();var d=n.height();var h=n.style();var u=(o-g)/2-n.offset().left+(parseFloat(h.paddingLeft)||0)+(parseFloat(h.borderLeft)||0)+$LG(window).scrollLeft()+l.left;var c=(a-d)/2-n.offset().top+(parseFloat(h.paddingTop)||0)+(parseFloat(h.borderTop)||0)+$LG(window).scrollTop()+i;var m=g/r.width;var p=d/r.height;var f="translate3d("+(u*=-1)+"px, "+(c*=-1)+"px, 0) scale3d("+m+", "+p+", 1)";return f}}}
23,getIframeMarkup:function(t,e,i,s,r,n){var l=n?'title="'+n+'"':"";return'<div class="lg-media-cont lg-has-iframe" style="width:'+t+"; max-width:"+i+"; height: "+e+"; max-height:"+s+'">\n <iframe class="lg-object" frameborder="0" '+l+' src="'+r+'" allowfullscreen="true"></iframe>\n </div>'},getImgMarkup:function(t,e,i,s,r,n){var l=s?'srcset="'+s+'"':"";var o=r?'sizes="'+r+'"':"";var a="<img "+i+" "+l+" "+o+' class="lg-object lg-image" data-index="'+t+'" src="'+e+'" />';var g="";if(n){var d=typeof n==="string"?JSON.parse(n):n;g=d.map((function(t){var e="";Object.keys(t).forEach((function(i){e+=" "+i+'="'+t[i]+'"'}));return"<source "+e+"></source>"}))}return""+g+a},getResponsiveSrc:function(t){var e=[];var i=[];var s="";for(var r=0;r<t.length;r++){var n=t[r].split(" ");n[0]===""&&n.splice(0,1);i.push(n[0]);e.push(n[1])}var l=window.innerWidth;for(var o=0;o<e.length;o++)if(parseInt(e[o],10)>l){s=i[o];break}return s},isImageLoaded:function(t){return!!t&&(!!t.complete&&t.naturalWidth!==0)},getVideoPosterMarkup:function(t,e,i,s,r){var n="";n=r&&r.youtube?"lg-has-youtube":r&&r.vimeo?"lg-has-vimeo":"lg-has-html5";var l=e;typeof e!=="string"&&(l=e.outerHTML);return'<div class="lg-video-cont '+n+'" style="'+i+'">\n <div class="lg-video-play-button">
23\n <svg\n viewBox="0 0 20 20"\n preserveAspectRatio="xMidYMid"\n focusable="false"\n aria-labelledby="'+s+'"\n role="img"\n class="lg-video-play-icon"\n >\n <title>'+s+'</title>\n <polygon class="lg-video-play-icon-inner" points="1,0 20,10 1,20"></polygon>\n </svg>\n <svg class="lg-video-play-icon-bg" viewBox="0 0 50 50" focusable="false">\n <circle cx="50%" cy="50%" r="20"></circle></svg>\n <svg class="lg-video-play-icon-circle" viewBox="0 0 50 50" focusable="false">\n <circle cx="50%" cy="50%" r="20"></circle>\n </svg>\n </div>\n '+l+'\n <img class="lg-object lg-video-poster" src="'+t+'" />\n </div>'},getFocusableElements:function(t){var e=t.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');var i=[].filter.call(e,(function(t){var e=window.getComputedStyle(t);return e.display!=="none"&&e.visibility!=="hidden"}));return i}, 24/** 25 * @desc Create dynamic elements array from gallery items when dynamic option is false 26 * It helps to avoid frequent DOM interaction 27 * and avoid multiple checks for dynamic elments 28 * 29 * @returns {Array} dynamicEl 30 */ 31getDynamicOptions:function(t,e,i,r){var n=[];var l=__spreadArrays(s,e);[].forEach.call(t,(function(t){var e={};for(var s=0;s<t.attributes.length;s++){var o=t.attributes[s];if(o.specified){var a=convertToData(o.name);var g="";l.indexOf(a)>-1&&(g=a);g&&(e[g]=o.value)}}var d=$LG(t);var h=d.find("img").first().attr("alt");var u=d.attr("title");var c=r?d.attr(r):d.find("img").first().attr("src");e.thumb=c;i&&!e.subHtml&&(e.subHtml=u||h||"");e.alt=h||u||"";n.push(e)}));return n},isMobile:function(){return/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)}, 32/** 33 * @desc Check the given src is video 34 * @param {String} src 35 * @return {Object} video type 36 * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] } 37 * 38 * @todo - this information can be moved to dynamicEl to avoid frequent calls 39 */ 40isVideo:function(t,e,i){if(t){var s=t.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);var r=t.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)(.*)?/i);var n=t.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);return s?{youtube:s}:r?{vimeo:r}:n?{wistia:n}:void 0}if(e)return{html5:true};console.error("lightGallery :- data-src is not provided on slide item "+(i+1)+". Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/")}};var n=0;var l=function(){function LightGallery(t,e){this.lgOpened=false;this.index=0;this.plugins=[];this.lGalleryOn=false;this.lgBusy=false;this.currentItemsInDom=[];this.prevScrollTop=0;this.bodyPaddingRight=0;this.isDummyImageRemoved=false;this.dragOrSwipeEnabled=false;this.mediaContainerPosition={top:0,bottom:0};if(!t)return this;n++;this.lgId=n;this.el=t;this.LGel=$LG(t);this.generateSettings(e);this.buildModules();if(this.settings.dynamic&&this.settings.dynamicEl!==void 0&&!Array.isArray(this.settings.dynamicEl))throw"When using dynamic mode, you must also define dynamicEl as an Array.";this.galleryItems=this.getItems();this.normalizeSettings();this.init();this.validateLicense();return this}LightGallery.prototype.generateSettings=function(t){this.settings=__assign(__assign({},e),t);if(this.settings.isMobile&&typeof this.settings.isMobile==="function"?this.settings.isMobile():r.isMobile()){var i=__assign(__assign({},this.settings.mobileSettings),this.settings.mobileSettings);this.settings=__assign(__assign({},this.settings),i)}};LightGallery.prototype.normalizeSettings=function(){this.settings.slideEndAnimation&&(this.settings.hideControlOnEnd=false);
40this.settings.closable||(this.settings.swipeToClose=false);this.zoomFromOrigin=this.settings.zoomFromOrigin;this.settings.dynamic&&(this.zoomFromOrigin=false);if(this.settings.container){var t=this.settings.container;if(typeof t==="function")this.settings.container=t();else if(typeof t==="string"){var e=document.querySelector(t);this.settings.container=e!==null&&e!==void 0?e:document.body}}else this.settings.container=document.body;this.settings.preload=Math.min(this.settings.preload,this.galleryItems.length)};LightGallery.prototype.init=function(){var e=this;this.addSlideVideoInfo(this.galleryItems);this.buildStructure();this.LGel.trigger(t.init,{instance:this});this.settings.keyPress&&this.keyPress();setTimeout((function(){e.enableDrag();e.enableSwipe();e.triggerPosterClick()}),50);this.arrow();this.settings.mousewheel&&this.mousewheel();this.settings.dynamic||this.openGalleryOnItemClick()};LightGallery.prototype.openGalleryOnItemClick=function(){var t=this;var _loop_1=function(s){var r=e.items[s];var n=$LG(r);var l=i.generateUUID();n.attr("data-lg-id",l).on("click.lgcustom-item-"+l,(function(e){e.preventDefault();var i=t.settings.index||s;t.openGallery(i,r)}))};var e=this;for(var s=0;s<this.items.length;s++)_loop_1(s)};LightGallery.prototype.buildModules=function(){var t=this;this.settings.plugins.forEach((function(e){t.plugins.push(new e(t,$LG))}))};LightGallery.prototype.validateLicense=function(){this.settings.licenseKey?this.settings.licenseKey==="0000-0000-000-0000"&&console.warn("lightGallery: "+this.settings.licenseKey+" license key is not valid for production use"):console.error("Please provide a valid license key")};LightGallery.prototype.getSlideItem=function(t){return $LG(this.getSlideItemId(t))};LightGallery.prototype.getSlideItemId=function(t){return"#lg-item-"+this.lgId+"-"+t};LightGallery.prototype.getIdName=function(t){return t+"-"+this.lgId};LightGallery.prototype.getElementById=function(t){return $LG("#"+this.getIdName(t))};LightGallery.prototype.manageSingleSlideClassName=function(){this.galleryItems.length<2?this.outer.addClass("lg-single-item"):this.outer.removeClass("lg-single-item")};LightGallery.prototype.buildStructure=function(){var t=this;var e=this.$container&&this.$container.get();if(!e){var i="";var s="";this.settings.controls&&(i='<button type="button" id="'+this.getIdName("lg-prev")+'" aria-label="'+this.settings.strings.previousSlide+'" class="lg-prev lg-icon"> '+this.settings.prevHtml+' </button>\n <button type="button" id="'+this.getIdName("lg-next")+'" aria-label="'+this.settings.strings.nextSlide+'" class="lg-next lg-icon"> '+this.settings.nextHtml+" </button>");this.settings.appendSubHtmlTo!==".lg-item"&&(s='<div class="lg-sub-html" role="status" aria-live="polite"></div>');var r="";this.settings.allowMediaOverlap&&(r+="lg-media-overlap ");var n=this.settings.ariaLabelledby?'aria-labelledby="'+this.settings.ariaLabelledby+'"':"";var l=this.settings.ariaDescribedby?'aria-describedby="'+this.settings.ariaDescribedby+'"':"";var o="lg-container "+this.settings.addClass+" "+(document.body!==this.settings.container?"lg-inline":"");var a=this.settings.closable&&this.settings.showCloseIcon?'<button type="button" aria-label="'+this.settings.strings.closeGallery+'" id="'+this.getIdName("lg-close")+'" class="lg-close lg-icon"></button>':"";var g=this.settings.showMaximizeIcon?'<button type="button" aria-label="'+this.settings.strings.toggleMaximize+'" id="'+this.getIdName("lg-maximize")+'" class="lg-maximize lg-icon"></button>':"";var d='\n <div class="'+o+'" id="'+this.getIdName("lg-container")+'" tabindex="-1" aria-modal="true" '+n+" "+l+' role="dialog"\n >\n <div id="'+this.getIdName("lg-backdrop")+'" class="lg-backdrop"></div>\n\n <div id="'+this.getIdName("lg-outer")+'" class="lg-outer lg-use-css3 lg-css3 lg-hide-items '+r+' ">\n\n <div id="'+this.getIdName("lg-content")+'" class="lg-content">\n <div id="'+this.getIdName("lg-inner")+'" class="lg-inner">\n </div>\n '+i+'\n </div>\n <div id="'+this.getIdName("lg-toolbar")+'" class="lg-toolbar lg-group">\n '+g+"\n "+a+"\n </div>\n "+(this.settings.appendSubHtmlTo===".lg-outer"?s:"")+'\n <div id="'+this.getIdName("lg-components")+'" class="lg-components">\n '+(this.settings.appendSubHtmlTo===".lg-sub-html"?s:"")+"\n </div>\n </div>\n </div>\n ";$LG(this.settings.container).append(d);document.body!==this.settings.container&&$LG(this.settings.container).css("position","relative");this.outer=this.getElementById("lg-outer");this.$lgComponents=this.getElementById("lg-components");this.$backdrop=this.getElementById("lg-backdrop");this.$container=this.getElementById("lg-container");this.$inner=this.getElementById("lg-inner");this.$content=this.getElementById("lg-content");this.$toolbar=this.getElementById("lg-toolbar");this.$backdrop.css("transition-duration",this.settings.backdropDuration+"ms");var h=this.settings.mode+" ";this.manageSingleSlideClassName();this.settings.enableDrag&&(h+="lg-grab ");this.outer.addClass(h);this.$inner.css("transition-timing-function",this.settings.easing);this.$inner.css("transition-duration",this.settings.speed+"ms");this.settings.download&&this.$toolbar.append('<a id="'+this.getIdName("lg-download")+'" target="_blank" rel="noopener" aria-label="'+this.settings.strings.download+'" download class="lg-download lg-icon"></a>');this.counter();$LG(window).on("resize.lg.global"+this.lgId+" orientationchange.lg.global"+this.lgId,(function(){t.refreshOnResize()}));this.hideBars();this.manageCloseGallery();this.toggleMaximize();this.initModules()}};LightGallery.prototype.refreshOnResize=function(){if(this.lgOpened){var e=this.galleryItems[this.index];var i=e.__slideVideoInfo;this.mediaContainerPosition=this.getMediaContainerPosition();var s=this.mediaContainerPosition,n=s.top,l=s.bottom;this.currentImageSize=r.getSize(this.items[this.index],this.outer,n+l,i&&this.settings.videoMaxSize);i&&this.resizeVideoSlide(this.index,this.currentImageSize);if(this.zoomFromOrigin&&!this.isDummyImageRemoved){var o=this.getDummyImgStyles(this.currentImageSize);this.outer.find(".lg-current .lg-dummy-img").first().attr("style",o)}this.LGel.trigger(t.containerResize)}};LightGallery.prototype.resizeVideoSlide=function(t,e){var i=this.getVideoContStyle(e);var s=this.getSlideItem(t);s.find(".lg-video-cont").attr("style",i)}; 41/** 42 * Update slides dynamically. 43 * Add, edit or delete slides dynamically when lightGallery is opened. 44 * Modify the current gallery items and pass it via updateSlides method 45 * @note 46 * - Do not mutate existing lightGallery items directly. 47 * - Always pass new list of gallery items 48 * - You need to take care of thumbnails outside the gallery if any 49 * - user this method only if you want to update slides when the gallery is opened. Otherwise, use `refresh()` method. 50 * @param items Gallery items 51 * @param index After the update operation, which slide gallery should navigate to 52 * @category lGPublicMethods 53 * @example 54 * const plugin = lightGallery(); 55 * 56 * // Adding slides dynamically 57 * let galleryItems = [ 58 * // Access existing lightGallery items 59 * // galleryItems are automatically generated internally from the gallery HTML markup 60 * // or directly from galleryItems when dynamic gallery is used 61 * ...plugin.galleryItems, 62 * ...[ 63 * { 64 * src: 'img/img-1.png', 65 * thumb: 'img/thumb1.png', 66 * }, 67 * ], 68 * ]; 69 * plugin.updateSlides( 70 * galleryItems, 71 * plugin.index, 72 * ); 73 * 74 * 75 * // Remove slides dynamically 76 * galleryItems = JSON.parse( 77 * JSON.stringify(updateSlideInstance.galleryItems), 78 * ); 79 * galleryItems.shift(); 80 * updateSlideInstance.updateSlides(galleryItems, 1); 81 * @see <a href="/demos/update-slides/">Demo</a> 82 */LightGallery.prototype.updateSlides=function(e,i){this.index>e.length-1&&(this.index=e.length-1);e.length===1&&(this.index=0);if(e.length){var s=this.galleryItems[i].src;this.galleryItems=e;this.updateControls();this.$inner.empty();this.currentItemsInDom=[];var r=0;this.galleryItems.some((function(t,e){if(t.src===s){r=e;return true}return false}));this.currentItemsInDom=this.organizeSlideItems(r,-1);this.loadContent(r,true);
82this.getSlideItem(r).addClass("lg-current");this.index=r;this.updateCurrentCounter(r);this.LGel.trigger(t.updateSlides)}else this.closeGallery()};LightGallery.prototype.getItems=function(){this.items=[];if(this.settings.dynamic)return this.settings.dynamicEl||[];if(this.settings.selector==="this")this.items.push(this.el);else if(this.settings.selector)if(typeof this.settings.selector==="string")if(this.settings.selectWithin){var t=$LG(this.settings.selectWithin);this.items=t.find(this.settings.selector).get()}else this.items=this.el.querySelectorAll(this.settings.selector);else this.items=this.settings.selector;else this.items=this.el.children;return r.getDynamicOptions(this.items,this.settings.extraProps,this.settings.getCaptionFromTitleOrAlt,this.settings.exThumbImage)};LightGallery.prototype.shouldHideScrollbar=function(){return this.settings.hideScrollbar&&document.body===this.settings.container};LightGallery.prototype.hideScrollbar=function(){if(this.shouldHideScrollbar()){this.bodyPaddingRight=parseFloat($LG("body").style().paddingRight);var t=document.documentElement.getBoundingClientRect();var e=window.innerWidth-t.width;$LG(document.body).css("padding-right",e+this.bodyPaddingRight+"px");$LG(document.body).addClass("lg-overlay-open")}};LightGallery.prototype.resetScrollBar=function(){if(this.shouldHideScrollbar()){$LG(document.body).css("padding-right",this.bodyPaddingRight+"px");$LG(document.body).removeClass("lg-overlay-open")}}; 83/** 84 * Open lightGallery. 85 * Open gallery with specific slide by passing index of the slide as parameter. 86 * @category lGPublicMethods 87 * @param {Number} index - index of the slide 88 * @param {HTMLElement} element - Which image lightGallery should zoom from 89 * 90 * @example 91 * const $dynamicGallery = document.getElementById('dynamic-gallery-demo'); 92 * const dynamicGallery = lightGallery($dynamicGallery, { 93 * dynamic: true, 94 * dynamicEl: [ 95 * { 96 * src: 'img/1.jpg', 97 * thumb: 'img/thumb-1.jpg', 98 * subHtml: '<h4>Image 1 title</h4><p>Image 1 descriptions.</p>', 99 * }, 100 * ... 101 * ], 102 * }); 103 * $dynamicGallery.addEventListener('click', function () { 104 * // Starts with third item.(Optional). 105 * // This is useful if you want use dynamic mode with 106 * // custom thumbnails (thumbnails outside gallery), 107 * dynamicGallery.openGallery(2); 108 * }); 109 * 110 */LightGallery.prototype.openGallery=function(e,i){var s=this;e===void 0&&(e=this.settings.index);if(!this.lgOpened){this.lgOpened=true;this.outer.removeClass("lg-hide-items");this.hideScrollbar();this.$container.addClass("lg-show");var n=this.getItemsToBeInsertedToDom(e,e);this.currentItemsInDom=n;var l="";n.forEach((function(t){l=l+'<div id="'+t+'" class="lg-item"></div>'}));this.$inner.append(l);this.addHtml(e);var o="";this.mediaContainerPosition=this.getMediaContainerPosition();var a=this.mediaContainerPosition,g=a.top,d=a.bottom;this.settings.allowMediaOverlap||this.setMediaContainerPosition(g,d);var h=this.galleryItems[e].__slideVideoInfo;if(this.zoomFromOrigin&&i){this.currentImageSize=r.getSize(i,this.outer,g+d,h&&this.settings.videoMaxSize);o=r.getTransform(i,this.outer,g,d,this.currentImageSize)}if(!this.zoomFromOrigin||!o){this.outer.addClass(this.settings.startClass);this.getSlideItem(e).removeClass("lg-complete")}var u=this.settings.zoomFromOrigin?100:this.settings.backdropDuration;setTimeout((function(){s.outer.addClass("lg-components-open")}),u);this.index=e;this.LGel.trigger(t.beforeOpen);this.getSlideItem(e).addClass("lg-current");this.lGalleryOn=false;this.prevScrollTop=$LG(window).scrollTop();setTimeout((function(){if(s.zoomFromOrigin&&o){var i=s.getSlideItem(e);i.css("transform",o);setTimeout((function(){i.addClass("lg-start-progress lg-start-end-progress").css("transition-duration",s.settings.startAnimationDuration+"ms");s.outer.addClass("lg-zoom-from-image")}));setTimeout((function(){i.css("transform","translate3d(0, 0, 0)")}),100)}setTimeout((function(){s.$backdrop.addClass("in");s.$container.addClass("lg-show-in")}),10);setTimeout((function(){s.settings.trapFocus&&document.body===s.settings.container&&s.trapFocus()}),s.settings.backdropDuration+50);s.zoomFromOrigin&&o||setTimeout((function(){s.outer.addClass("lg-visible")}),s.settings.backdropDuration);s.slide(e,false,false,false);s.LGel.trigger(t.afterOpen)}
110));document.body===this.settings.container&&$LG("html").addClass("lg-on")}};LightGallery.prototype.getMediaContainerPosition=function(){if(this.settings.allowMediaOverlap)return{top:0,bottom:0};var t=this.$toolbar.get().clientHeight||0;var e=this.outer.find(".lg-components .lg-sub-html").get();var i=this.settings.defaultCaptionHeight||e&&e.clientHeight||0;var s=this.outer.find(".lg-thumb-outer").get();var r=s?s.clientHeight:0;var n=r+i;return{top:t,bottom:n}};LightGallery.prototype.setMediaContainerPosition=function(t,e){t===void 0&&(t=0);e===void 0&&(e=0);this.$content.css("top",t+"px").css("bottom",e+"px")};LightGallery.prototype.hideBars=function(){var t=this;setTimeout((function(){t.outer.removeClass("lg-hide-items");if(t.settings.hideBarsDelay>0){t.outer.on("mousemove.lg click.lg touchstart.lg",(function(){t.outer.removeClass("lg-hide-items");clearTimeout(t.hideBarTimeout);t.hideBarTimeout=setTimeout((function(){t.outer.addClass("lg-hide-items")}),t.settings.hideBarsDelay)}));t.outer.trigger("mousemove.lg")}}),this.settings.showBarsAfter)};LightGallery.prototype.initPictureFill=function(t){if(this.settings.supportLegacyBrowser)try{picturefill({elements:[t.get()]})}catch(t){console.warn("lightGallery :- If you want srcset or picture tag to be supported for older browser please include picturefil javascript library in your document.")}};LightGallery.prototype.counter=function(){if(this.settings.counter){var t='<div class="lg-counter" role="status" aria-live="polite">\n <span id="'+this.getIdName("lg-counter-current")+'" class="lg-counter-current">'+(this.index+1)+' </span> /\n <span id="'+this.getIdName("lg-counter-all")+'" class="lg-counter-all">'+this.galleryItems.length+" </span></div>";this.outer.find(this.settings.appendCounterTo).append(t)}}; 111/** 112 * @desc add sub-html into the slide 113 * @param {Number} index - index of the slide 114 */LightGallery.prototype.addHtml=function(e){var i;var s;this.galleryItems[e].subHtmlUrl?s=this.galleryItems[e].subHtmlUrl:i=this.galleryItems[e].subHtml;if(!s)if(i){var n=i.substring(0,1);n!=="."&&n!=="#"||(i=this.settings.subHtmlSelectorRelative&&!this.settings.dynamic?$LG(this.items).eq(e).find(i).first().html():$LG(i).first().html())}else i="";if(this.settings.appendSubHtmlTo!==".lg-item")s?r.fetchCaptionFromUrl(s,this.outer.find(".lg-sub-html"),"replace"):this.outer.find(".lg-sub-html").html(i);else{var l=$LG(this.getSlideItemId(e));s?r.fetchCaptionFromUrl(s,l,"append"):l.append('<div class="lg-sub-html">'+i+"</div>")}typeof i!=="undefined"&&i!==null&&(i===""?this.outer.find(this.settings.appendSubHtmlTo).addClass("lg-empty-html"):this.outer.find(this.settings.appendSubHtmlTo).removeClass("lg-empty-html"));this.LGel.trigger(t.afterAppendSubHtml,{index:e})}; 115/** 116 * @desc Preload slides 117 * @param {Number} index - index of the slide 118 * @todo preload not working for the first slide, Also, should work for the first and last slide as well 119 */LightGallery.prototype.preload=function(t){for(var e=1;e<=this.settings.preload;e++){if(e>=this.galleryItems.length-t)break;this.loadContent(t+e,false)}for(var i=1;i<=this.settings.preload;i++){if(t-i<0)break;this.loadContent(t-i,false)}};LightGallery.prototype.getDummyImgStyles=function(t){return t?"width:"+t.width+"px;\n margin-left: -"+t.width/2+"px;\n margin-top: -"+t.height/2+"px;\n height:"+t.height+"px":""};LightGallery.prototype.getVideoContStyle=function(t){return t?"width:"+t.width+"px;\n height:"+t.height+"px":""};LightGallery.prototype.getDummyImageContent=function(t,e,i){var s;this.settings.dynamic||(s=$LG(this.items).eq(e));if(s){var r=void 0;r=this.settings.exThumbImage?s.attr(this.settings.exThumbImage):s.find("img").first().attr("src");if(!r)return"";var n=this.getDummyImgStyles(this.currentImageSize);var l=document.createElement("img");l.alt=i||"";l.src=r;l.className="lg-dummy-img";l.style.cssText=n;t.addClass("lg-first-slide");this.outer.addClass("lg-first-slide-loading");return l}return""};
119LightGallery.prototype.setImgMarkup=function(t,e,i){var s=this.galleryItems[i];var n=s.alt,l=s.srcset,o=s.sizes,a=s.sources;var g="";var d=n?'alt="'+n+'"':"";g=this.isFirstSlideWithZoomAnimation()?this.getDummyImageContent(e,i,d):r.getImgMarkup(i,t,d,l,o,a);var h=document.createElement("picture");h.className="lg-img-wrap";$LG(h).append(g);e.prepend(h)};LightGallery.prototype.onSlideObjectLoad=function(t,e,i,s){var n=t.find(".lg-object").first();if(r.isImageLoaded(n.get())||e)i();else{n.on("load.lg error.lg",(function(){i&&i()}));n.on("error.lg",(function(){s&&s()}))}}; 120/** 121 * 122 * @param $el Current slide item 123 * @param index 124 * @param delay Delay is 0 except first time 125 * @param speed Speed is same as delay, except it is 0 if gallery is opened via hash plugin 126 * @param isFirstSlide 127 */LightGallery.prototype.onLgObjectLoad=function(t,e,i,s,r,n){var l=this;this.onSlideObjectLoad(t,n,(function(){l.triggerSlideItemLoad(t,e,i,s,r)}),(function(){t.addClass("lg-complete lg-complete_");t.html('<span class="lg-error-msg">'+l.settings.strings.mediaLoadingFailed+"</span>")}))};LightGallery.prototype.triggerSlideItemLoad=function(e,i,s,r,n){var l=this;var o=this.galleryItems[i];var a=n&&this.getSlideType(o)==="video"&&!o.poster?r:0;setTimeout((function(){e.addClass("lg-complete lg-complete_");l.LGel.trigger(t.slideItemLoad,{index:i,delay:s||0,isFirstSlide:n})}),a)};LightGallery.prototype.isFirstSlideWithZoomAnimation=function(){return!!(!this.lGalleryOn&&this.zoomFromOrigin&&this.currentImageSize)};LightGallery.prototype.addSlideVideoInfo=function(t){var e=this;t.forEach((function(t,i){t.__slideVideoInfo=r.isVideo(t.src,!!t.video,i);t.__slideVideoInfo&&e.settings.loadYouTubePoster&&!t.poster&&t.__slideVideoInfo.youtube&&(t.poster="//img.youtube.com/vi/"+t.__slideVideoInfo.youtube[1]+"/maxresdefault.jpg")}))}; 128/** 129 * Load slide content into slide. 130 * This is used to load content into slides that is not visible too 131 * @param {Number} index - index of the slide. 132 * @param {Boolean} rec - if true call loadcontent() function again. 133 */LightGallery.prototype.loadContent=function(e,i){var s=this;var n=this.galleryItems[e];var l=$LG(this.getSlideItemId(e));var o=n.poster,a=n.srcset,g=n.sizes,d=n.sources;var h=n.src;var u=n.video;var c=u&&typeof u==="string"?JSON.parse(u):u;if(n.responsive){var m=n.responsive.split(",");h=r.getResponsiveSrc(m)||h}var p=n.__slideVideoInfo;var f="";var y=!!n.iframe;var v=!this.lGalleryOn;var b=0;v&&(b=this.zoomFromOrigin&&this.currentImageSize?this.settings.startAnimationDuration+10:this.settings.backdropDuration+10);if(!l.hasClass("lg-loaded")){if(p){var C=this.mediaContainerPosition,I=C.top,L=C.bottom;var S=r.getSize(this.items[e],this.outer,I+L,p&&this.settings.videoMaxSize);f=this.getVideoContStyle(S)}if(y){var G=r.getIframeMarkup(this.settings.iframeWidth,this.settings.iframeHeight,this.settings.iframeMaxWidth,this.settings.iframeMaxHeight,h,n.iframeTitle);l.prepend(G)}else if(o){var x="";var w=v&&this.zoomFromOrigin&&this.currentImageSize;w&&(x=this.getDummyImageContent(l,e,""));G=r.getVideoPosterMarkup(o,x||"",f,this.settings.strings.playVideo,p);l.prepend(G)}else if(p){G='<div class="lg-video-cont " style="'+f+'"></div>';l.prepend(G)}else{this.setImgMarkup(h,l,e);if(a||d){var T=l.find(".lg-object");this.initPictureFill(T)}}(o||p)&&this.LGel.trigger(t.hasVideo,{index:e,src:h,html5Video:c,hasPoster:!!o});this.LGel.trigger(t.afterAppendSlide,{index:e});this.lGalleryOn&&this.settings.appendSubHtmlTo===".lg-item"&&this.addHtml(e)}var E=0;b&&!$LG(document.body).hasClass("lg-from-hash")&&(E=b);if(this.isFirstSlideWithZoomAnimation()){setTimeout((function(){l.removeClass("lg-start-end-progress lg-start-progress").removeAttr("style")}),this.settings.startAnimationDuration+100);l.hasClass("lg-loaded")||setTimeout((function(){if(s.getSlideType(n)==="image"){var t=n.alt;var i=t?'alt="'+t+'"':"";l.find(".lg-img-wrap").append(r.getImgMarkup(e,h,i,a,g,n.sources));if(a||d){var u=l.find(".lg-object");s.initPictureFill(u)}}if(s.getSlideType(n)==="image"||s.getSlideType(n)==="video"&&o){s.onLgObjectLoad(l,e,b,E,true,false);s.onSlideObjectLoad(l,!!(p&&p.html5&&!o),(function(){s.loadContentOnFirstSlideLoad(e,l,E)}),(function(){s.loadContentOnFirstSlideLoad(e,l,E)}))}}),this.settings.startAnimationDuration+100)}l.addClass("lg-loaded");this.isFirstSlideWithZoomAnimation()&&(this.getSlideType(n)!=="video"||o)||this.onLgObjectLoad(l,e,b,E,v,!!(p&&p.html5&&!o));this.zoomFromOrigin&&this.currentImageSize||!l.hasClass("lg-complete_")||this.lGalleryOn||setTimeout((function(){l.addClass("lg-complete")}
133),this.settings.backdropDuration);this.lGalleryOn=true;i===true&&(l.hasClass("lg-complete_")?this.preload(e):l.find(".lg-object").first().on("load.lg error.lg",(function(){s.preload(e)})))}; 134/** 135 * @desc Remove dummy image content and load next slides 136 * Called only for the first time if zoomFromOrigin animation is enabled 137 * @param index 138 * @param $currentSlide 139 * @param speed 140 */LightGallery.prototype.loadContentOnFirstSlideLoad=function(t,e,i){var s=this;setTimeout((function(){e.find(".lg-dummy-img").remove();e.removeClass("lg-first-slide");s.outer.removeClass("lg-first-slide-loading");s.isDummyImageRemoved=true;s.preload(t)}),i+300)};LightGallery.prototype.getItemsToBeInsertedToDom=function(t,e,i){var s=this;i===void 0&&(i=0);var r=[];var n=Math.max(i,3);n=Math.min(n,this.galleryItems.length);var l="lg-item-"+this.lgId+"-"+e;if(this.galleryItems.length<=3){this.galleryItems.forEach((function(t,e){r.push("lg-item-"+s.lgId+"-"+e)}));return r}if(t<(this.galleryItems.length-1)/2){for(var o=t;o>t-n/2&&o>=0;o--)r.push("lg-item-"+this.lgId+"-"+o);var a=r.length;for(o=0;o<n-a;o++)r.push("lg-item-"+this.lgId+"-"+(t+o+1))}else{for(o=t;o<=this.galleryItems.length-1&&o<t+n/2;o++)r.push("lg-item-"+this.lgId+"-"+o);a=r.length;for(o=0;o<n-a;o++)r.push("lg-item-"+this.lgId+"-"+(t-o-1))}this.settings.loop&&(t===this.galleryItems.length-1?r.push("lg-item-"+this.lgId+"-0"):t===0&&r.push("lg-item-"+this.lgId+"-"+(this.galleryItems.length-1)));r.indexOf(l)===-1&&r.push("lg-item-"+this.lgId+"-"+e);return r};LightGallery.prototype.organizeSlideItems=function(t,e){var i=this;var s=this.getItemsToBeInsertedToDom(t,e,this.settings.numberOfSlideItemsInDom);s.forEach((function(t){i.currentItemsInDom.indexOf(t)===-1&&i.$inner.append('<div id="'+t+'" class="lg-item"></div>')}));this.currentItemsInDom.forEach((function(t){s.indexOf(t)===-1&&$LG("#"+t).remove()}));return s};LightGallery.prototype.getPreviousSlideIndex=function(){var t=0;try{var e=this.outer.find(".lg-current").first().attr("id");t=parseInt(e.split("-")[3])||0}catch(e){t=0}return t};LightGallery.prototype.setDownloadValue=function(t){if(this.settings.download){var e=this.galleryItems[t];var i=e.downloadUrl===false||e.downloadUrl==="false";if(i)this.outer.addClass("lg-hide-download");else{var s=this.getElementById("lg-download");this.outer.removeClass("lg-hide-download");s.attr("href",e.downloadUrl||e.src);e.download&&s.attr("download",e.download)}}};LightGallery.prototype.makeSlideAnimation=function(t,e,i){var s=this;this.lGalleryOn&&i.addClass("lg-slide-progress");setTimeout((function(){s.outer.addClass("lg-no-trans");s.outer.find(".lg-item").removeClass("lg-prev-slide lg-next-slide");if(t==="prev"){e.addClass("lg-prev-slide");i.addClass("lg-next-slide")}else{e.addClass("lg-next-slide");i.addClass("lg-prev-slide")}setTimeout((function(){s.outer.find(".lg-item").removeClass("lg-current");e.addClass("lg-current");s.outer.removeClass("lg-no-trans")}),50)}),this.lGalleryOn?this.settings.slideDelay:0)}; 141/** 142 * Goto a specific slide. 143 * @param {Number} index - index of the slide 144 * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag 145 * @param {Boolean} fromThumb - true if slide function called via thumbnail click 146 * @param {String} direction - Direction of the slide(next/prev) 147 * @category lGPublicMethods 148 * @example 149 * const plugin = lightGallery(); 150 * // to go to 3rd slide 151 * plugin.slide(2); 152 * 153 */LightGallery.prototype.slide=function(e,i,s,n){var l=this;var o=this.getPreviousSlideIndex();this.currentItemsInDom=this.organizeSlideItems(e,o);if(!this.lGalleryOn||o!==e){var a=this.galleryItems.length;if(!this.lgBusy){this.settings.counter&&this.updateCurrentCounter(e);var g=this.getSlideItem(e);var d=this.getSlideItem(o);var h=this.galleryItems[e];var u=h.__slideVideoInfo;this.outer.attr("data-lg-slide-type",this.getSlideType(h));this.setDownloadValue(e);if(u){var c=this.mediaContainerPosition,m=c.top,p=c.bottom;var f=r.getSize(this.items[e],this.outer,m+p,u&&this.settings.videoMaxSize);this.resizeVideoSlide(e,f)}this.LGel.trigger(t.beforeSlide,{prevIndex:o,index:e,fromTouch:!!i,fromThumb:!!s});this.lgBusy=true;clearTimeout(this.hideBarTimeout);this.arrowDisable(e);n||(e<o?n="prev":e>o&&(n="next"));if(i){this.outer.find(".lg-item").removeClass("lg-prev-slide lg-current lg-next-slide");var y=void 0;var v=void 0;if(a>2){y=e-1;v=e+1;if(e===0&&o===a-1){v=0;y=a-1}else if(e===a-1&&o===0){v=0;y=a-1}}else{y=0;v=1}
153n==="prev"?this.getSlideItem(v).addClass("lg-next-slide"):this.getSlideItem(y).addClass("lg-prev-slide");g.addClass("lg-current")}else this.makeSlideAnimation(n,g,d);this.lGalleryOn?setTimeout((function(){l.loadContent(e,true);l.settings.appendSubHtmlTo!==".lg-item"&&l.addHtml(e)}),this.settings.speed+50+(i?0:this.settings.slideDelay)):this.loadContent(e,true);setTimeout((function(){l.lgBusy=false;d.removeClass("lg-slide-progress");l.LGel.trigger(t.afterSlide,{prevIndex:o,index:e,fromTouch:i,fromThumb:s})}),(this.lGalleryOn?this.settings.speed+100:100)+(i?0:this.settings.slideDelay))}this.index=e}};LightGallery.prototype.updateCurrentCounter=function(t){this.getElementById("lg-counter-current").html(t+1+"")};LightGallery.prototype.updateCounterTotal=function(){this.getElementById("lg-counter-all").html(this.galleryItems.length+"")};LightGallery.prototype.getSlideType=function(t){return t.__slideVideoInfo?"video":t.iframe?"iframe":"image"};LightGallery.prototype.touchMove=function(t,e,i){var s=e.pageX-t.pageX;var r=e.pageY-t.pageY;var n=false;if(this.swipeDirection)n=true;else if(Math.abs(s)>15){this.swipeDirection="horizontal";n=true}else if(Math.abs(r)>15){this.swipeDirection="vertical";n=true}if(n){var l=this.getSlideItem(this.index);if(this.swipeDirection==="horizontal"){i===null||i===void 0?void 0:i.preventDefault();this.outer.addClass("lg-dragging");this.setTranslate(l,s,0);var o=l.get().offsetWidth;var a=o*15/100;var g=a-Math.abs(s*10/100);this.setTranslate(this.outer.find(".lg-prev-slide").first(),-o+s-g,0);this.setTranslate(this.outer.find(".lg-next-slide").first(),o+s+g,0)}else if(this.swipeDirection==="vertical"&&this.settings.swipeToClose){i===null||i===void 0?void 0:i.preventDefault();this.$container.addClass("lg-dragging-vertical");var d=1-Math.abs(r)/window.innerHeight;this.$backdrop.css("opacity",d);var h=1-Math.abs(r)/(window.innerWidth*2);this.setTranslate(l,0,r,h,h);Math.abs(r)>100&&this.outer.addClass("lg-hide-items").removeClass("lg-components-open")}}};LightGallery.prototype.touchEnd=function(e,i,s){var r=this;var n;this.settings.mode!=="lg-slide"&&this.outer.addClass("lg-slide");setTimeout((function(){r.$container.removeClass("lg-dragging-vertical");r.outer.removeClass("lg-dragging lg-hide-items").addClass("lg-components-open");var l=true;if(r.swipeDirection==="horizontal"){n=e.pageX-i.pageX;var o=Math.abs(e.pageX-i.pageX);if(n<0&&o>r.settings.swipeThreshold){r.goToNextSlide(true);l=false}else if(n>0&&o>r.settings.swipeThreshold){r.goToPrevSlide(true);l=false}}else if(r.swipeDirection==="vertical"){n=Math.abs(e.pageY-i.pageY);if(r.settings.closable&&r.settings.swipeToClose&&n>100){r.closeGallery();return}r.$backdrop.css("opacity",1)}r.outer.find(".lg-item").removeAttr("style");if(l&&Math.abs(e.pageX-i.pageX)<5){var a=$LG(s.target);r.isPosterElement(a)&&r.LGel.trigger(t.posterClick)}r.swipeDirection=void 0}));setTimeout((function(){r.outer.hasClass("lg-dragging")||r.settings.mode==="lg-slide"||r.outer.removeClass("lg-slide")}),this.settings.speed+100)};LightGallery.prototype.enableSwipe=function(){var e=this;var i={};var s={};var r=false;var n=false;if(this.settings.enableSwipe){this.$inner.on("touchstart.lg",(function(t){e.dragOrSwipeEnabled=true;var s=e.getSlideItem(e.index);if(($LG(t.target).hasClass("lg-item")||s.get().contains(t.target))&&!e.outer.hasClass("lg-zoomed")&&!e.lgBusy&&t.touches.length===1){n=true;e.touchAction="swipe";e.manageSwipeClass();i={pageX:t.touches[0].pageX,pageY:t.touches[0].pageY}}}));this.$inner.on("touchmove.lg",(function(t){if(n&&e.touchAction==="swipe"&&t.touches.length===1){s={pageX:t.touches[0].pageX,pageY:t.touches[0].pageY};e.touchMove(i,s,t);r=true}}));this.$inner.on("touchend.lg",(function(l){if(e.touchAction==="swipe"){if(r){r=false;e.touchEnd(s,i,l)}else if(n){var o=$LG(l.target);e.isPosterElement(o)&&e.LGel.trigger(t.posterClick)}e.touchAction=void 0;n=false}}))}};LightGallery.prototype.enableDrag=function(){var e=this;var i={};var s={};var r=false;var n=false;if(this.settings.enableDrag){this.outer.on("mousedown.lg",(function(s){e.dragOrSwipeEnabled=true;var n=e.getSlideItem(e.index);if(($LG(s.target).hasClass("lg-item")||n.get().contains(s.target))&&!e.outer.hasClass("lg-zoomed")&&!e.lgBusy){s.preventDefault();if(!e.lgBusy){e.manageSwipeClass();i={pageX:s.pageX,pageY:s.pageY};r=true;e.outer.get().scrollLeft+=1;e.outer.get().scrollLeft-=1;e.outer.removeClass("lg-grab").addClass("lg-grabbing");e.LGel.trigger(t.dragStart)}}}));$LG(window).on("mousemove.lg.global"+this.lgId,(function(l){if(r&&e.lgOpened){n=true;s={pageX:l.pageX,pageY:l.pageY};e.touchMove(i,s);e.LGel.trigger(t.dragMove)}}));$LG(window).on("mouseup.lg.global"+this.lgId,(function(l){if(e.lgOpened){var o=$LG(l.target);if(n){n=false;e.touchEnd(s,i,l);
153e.LGel.trigger(t.dragEnd)}else e.isPosterElement(o)&&e.LGel.trigger(t.posterClick);if(r){r=false;e.outer.removeClass("lg-grabbing").addClass("lg-grab")}}}))}};LightGallery.prototype.triggerPosterClick=function(){var e=this;this.$inner.on("click.lg",(function(i){!e.dragOrSwipeEnabled&&e.isPosterElement($LG(i.target))&&e.LGel.trigger(t.posterClick)}))};LightGallery.prototype.manageSwipeClass=function(){var t=this.index+1;var e=this.index-1;this.settings.loop&&this.galleryItems.length>2&&(this.index===0?e=this.galleryItems.length-1:this.index===this.galleryItems.length-1&&(t=0));this.outer.find(".lg-item").removeClass("lg-next-slide lg-prev-slide");e>-1&&this.getSlideItem(e).addClass("lg-prev-slide");this.getSlideItem(t).addClass("lg-next-slide")}; 154/** 155 * Go to next slide 156 * @param {Boolean} fromTouch - true if slide function called via touch event 157 * @category lGPublicMethods 158 * @example 159 * const plugin = lightGallery(); 160 * plugin.goToNextSlide(); 161 * @see <a href="/demos/methods/">Demo</a> 162 */LightGallery.prototype.goToNextSlide=function(e){var i=this;var s=this.settings.loop;e&&this.galleryItems.length<3&&(s=false);if(!this.lgBusy)if(this.index+1<this.galleryItems.length){this.index++;this.LGel.trigger(t.beforeNextSlide,{index:this.index});this.slide(this.index,!!e,false,"next")}else if(s){this.index=0;this.LGel.trigger(t.beforeNextSlide,{index:this.index});this.slide(this.index,!!e,false,"next")}else if(this.settings.slideEndAnimation&&!e){this.outer.addClass("lg-right-end");setTimeout((function(){i.outer.removeClass("lg-right-end")}),400)}}; 163/** 164 * Go to previous slides 165 * @param {Boolean} fromTouch - true if slide function called via touch event 166 * @category lGPublicMethods 167 * @example 168 * const plugin = lightGallery({}); 169 * plugin.goToPrevSlide(); 170 * @see <a href="/demos/methods/">Demo</a> 171 * 172 */LightGallery.prototype.goToPrevSlide=function(e){var i=this;var s=this.settings.loop;e&&this.galleryItems.length<3&&(s=false);if(!this.lgBusy)if(this.index>0){this.index--;this.LGel.trigger(t.beforePrevSlide,{index:this.index,fromTouch:e});this.slide(this.index,!!e,false,"prev")}else if(s){this.index=this.galleryItems.length-1;this.LGel.trigger(t.beforePrevSlide,{index:this.index,fromTouch:e});this.slide(this.index,!!e,false,"prev")}else if(this.settings.slideEndAnimation&&!e){this.outer.addClass("lg-left-end");setTimeout((function(){i.outer.removeClass("lg-left-end")}),400)}};LightGallery.prototype.keyPress=function(){var t=this;$LG(window).on("keydown.lg.global"+this.lgId,(function(e){if(t.lgOpened&&t.settings.escKey===true&&e.keyCode===27){e.preventDefault();t.settings.allowMediaOverlap&&t.outer.hasClass("lg-can-toggle")&&t.outer.hasClass("lg-components-open")?t.outer.removeClass("lg-components-open"):t.closeGallery()}if(t.lgOpened&&t.galleryItems.length>1){if(e.keyCode===37){e.preventDefault();t.goToPrevSlide()}if(e.keyCode===39){e.preventDefault();t.goToNextSlide()}}}))};LightGallery.prototype.arrow=function(){var t=this;this.getElementById("lg-prev").on("click.lg",(function(){t.goToPrevSlide()}));this.getElementById("lg-next").on("click.lg",(function(){t.goToNextSlide()}))};LightGallery.prototype.arrowDisable=function(t){if(!this.settings.loop&&this.settings.hideControlOnEnd){var e=this.getElementById("lg-prev");var i=this.getElementById("lg-next");t+1===this.galleryItems.length?i.attr("disabled","disabled").addClass("disabled"):i.removeAttr("disabled").removeClass("disabled");t===0?e.attr("disabled","disabled").addClass("disabled"):e.removeAttr("disabled").removeClass("disabled")}};LightGallery.prototype.setTranslate=function(t,e,i,s,r){s===void 0&&(s=1);r===void 0&&(r=1);t.css("transform","translate3d("+e+"px, "+i+"px, 0px) scale3d("+s+", "+r+", 1)")};LightGallery.prototype.mousewheel=function(){var t=this;var e=0;this.outer.on("wheel.lg",(function(i){if(i.deltaY&&!(t.galleryItems.length<2)){i.preventDefault();var s=(new Date).getTime();if(!(s-e<1e3)){e=s;i.deltaY>0?t.goToNextSlide():i.deltaY<0&&t.goToPrevSlide()}}}))};LightGallery.prototype.isSlideElement=function(t){return t.hasClass("lg-outer")||t.hasClass("lg-item")||t.hasClass("lg-img-wrap")||t.hasClass("lg-img-rotate")};LightGallery.prototype.isPosterElement=function(t){var e=this.getSlideItem(this.index).find(".lg-video-play-button").get();return t.hasClass("lg-video-poster")||t.hasClass("lg-video-play-button")||e&&e.contains(t.get())};LightGallery.prototype.toggleMaximize=function(){var t=this;this.getElementById("lg-maximize").on("click.lg",(function(){t.$container.toggleClass("lg-inline");t.refreshOnResize()}))};LightGallery.prototype.invalidateItems=function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];var i=$LG(e);i.off("click.lgcustom-item-"+i.attr("data-lg-id"))}};LightGallery.prototype.trapFocus=function(){var t=this;this.$container.get().focus({preventScroll:true});$LG(window).on("keydown.lg.global"+this.lgId,(function(e){if(t.lgOpened){var i=e.key==="Tab"||e.keyCode===9;if(i){var s=r.getFocusableElements(t.$container.get());var n=s[0];var l=s[s.length-1];if(e.shiftKey){if(document.activeElement===n){l.focus();e.preventDefault()}}else if(document.activeElement===l){n.focus();e.preventDefault()}}}}))};LightGallery.prototype.manageCloseGallery=function(){var t=this;if(this.settings.closable){var e=false;this.getElementById("lg-close").on("click.lg",(function(){t.closeGallery()}));if(this.settings.closeOnTap){this.outer.on("mousedown.lg",(function(i){var s=$LG(i.target);e=!!t.isSlideElement(s)}));this.outer.on("mousemove.lg",(function(){e=false}));this.outer.on("mouseup.lg",(function(i){var s=$LG(i.target);t.isSlideElement(s)&&e&&(t.outer.hasClass("lg-dragging")||t.closeGallery())}))}}};LightGallery.prototype.closeGallery=function(e){var i=this;if(!this.lgOpened||!this.settings.closable&&!e)return 0;this.LGel.trigger(t.beforeClose);this.settings.resetScrollPosition&&!this.settings.hideScrollbar&&$LG(window).scrollTop(this.prevScrollTop);var s=this.items[this.index];var n;if(this.zoomFromOrigin&&s){var l=this.mediaContainerPosition,o=l.top,a=l.bottom;var g=this.galleryItems[this.index],d=g.__slideVideoInfo,h=g.poster;var u=r.getSize(s,this.outer,o+a,d&&h&&this.settings.videoMaxSize);n=r.getTransform(s,this.outer,o,a,u)}if(this.zoomFromOrigin&&n){this.outer.addClass("lg-closing lg-zoom-from-image");
172this.getSlideItem(this.index).addClass("lg-start-end-progress").css("transition-duration",this.settings.startAnimationDuration+"ms").css("transform",n)}else{this.outer.addClass("lg-hide-items");this.outer.removeClass("lg-zoom-from-image")}this.destroyModules();this.lGalleryOn=false;this.isDummyImageRemoved=false;this.zoomFromOrigin=this.settings.zoomFromOrigin;clearTimeout(this.hideBarTimeout);this.hideBarTimeout=false;$LG("html").removeClass("lg-on");this.outer.removeClass("lg-visible lg-components-open");this.$backdrop.removeClass("in").css("opacity",0);var c=this.zoomFromOrigin&&n?Math.max(this.settings.startAnimationDuration,this.settings.backdropDuration):this.settings.backdropDuration;this.$container.removeClass("lg-show-in");setTimeout((function(){i.zoomFromOrigin&&n&&i.outer.removeClass("lg-zoom-from-image");i.$container.removeClass("lg-show");i.resetScrollBar();i.$backdrop.removeAttr("style").css("transition-duration",i.settings.backdropDuration+"ms");i.outer.removeClass("lg-closing "+i.settings.startClass);i.getSlideItem(i.index).removeClass("lg-start-end-progress");i.$inner.empty();i.lgOpened&&i.LGel.trigger(t.afterClose,{instance:i});i.$container.get()&&i.$container.get().blur();i.lgOpened=false}),c+100);return c+100};LightGallery.prototype.initModules=function(){this.plugins.forEach((function(t){try{t.init()}catch(t){console.warn("lightGallery:- make sure lightGallery module is properly initiated")}}))};LightGallery.prototype.destroyModules=function(t){this.plugins.forEach((function(e){try{t?e.destroy():e.closeGallery&&e.closeGallery()}catch(t){console.warn("lightGallery:- make sure lightGallery module is properly destroyed")}}))};LightGallery.prototype.refresh=function(e){this.settings.dynamic||this.invalidateItems();this.galleryItems=e||this.getItems();this.updateControls();this.openGalleryOnItemClick();this.LGel.trigger(t.updateSlides)};LightGallery.prototype.updateControls=function(){this.addSlideVideoInfo(this.galleryItems);this.updateCounterTotal();this.manageSingleSlideClassName()};LightGallery.prototype.destroyGallery=function(){this.destroyModules(true);this.settings.dynamic||this.invalidateItems();$LG(window).off(".lg.global"+this.lgId);this.LGel.off(".lg");this.$container.remove()};LightGallery.prototype.destroy=function(){var t=this.closeGallery(true);t?setTimeout(this.destroyGallery.bind(this),t):this.destroyGallery();return t};return LightGallery}();function lightGallery(t,e){return new l(t,e)}export{lightGallery as default}; 173
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.