From 776a7cbbc3b3460bcc017e0896fd97b71c165cfa Mon Sep 17 00:00:00 2001 From: biati-digital Date: Tue, 26 Mar 2024 21:03:43 -0600 Subject: [PATCH] Updated version number --- dist/js/glightbox.js | 2695 +++++++++++++++++++------------------- dist/js/glightbox.min.js | 2 +- package.json | 4 +- src/js/glightbox.js | 4 +- 4 files changed, 1349 insertions(+), 1356 deletions(-) diff --git a/dist/js/glightbox.js b/dist/js/glightbox.js index 4ee3ad7..fb0cf41 100644 --- a/dist/js/glightbox.js +++ b/dist/js/glightbox.js @@ -4,14 +4,28 @@ (global = global || self, global.GLightbox = factory()); }(this, (function () { 'use strict'; - function _typeof(obj) { + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : i + ""; + } + function _typeof(o) { "@babel/helpers - typeof"; - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { - return typeof obj; - } : function (obj) { - return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }, _typeof(obj); + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { @@ -35,20 +49,6 @@ }); return Constructor; } - function _toPrimitive(input, hint) { - if (typeof input !== "object" || input === null) return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== undefined) { - var res = prim.call(input, hint || "default"); - if (typeof res !== "object") return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return (hint === "string" ? String : Number)(input); - } - function _toPropertyKey(arg) { - var key = _toPrimitive(arg, "string"); - return typeof key === "symbol" ? key : String(key); - } var uid = Date.now(); function extend() { @@ -549,1501 +549,1495 @@ }); } - function getLen(v) { - return Math.sqrt(v.x * v.x + v.y * v.y); - } - function dot(v1, v2) { - return v1.x * v2.x + v1.y * v2.y; - } - function getAngle(v1, v2) { - var mr = getLen(v1) * getLen(v2); - if (mr === 0) { - return 0; - } - var r = dot(v1, v2) / mr; - if (r > 1) { - r = 1; - } - return Math.acos(r); - } - function cross(v1, v2) { - return v1.x * v2.y - v2.x * v1.y; - } - function getRotateAngle(v1, v2) { - var angle = getAngle(v1, v2); - if (cross(v1, v2) > 0) { - angle *= -1; - } - return angle * 180 / Math.PI; - } - var EventsHandlerAdmin = function () { - function EventsHandlerAdmin(el) { - _classCallCheck(this, EventsHandlerAdmin); - this.handlers = []; - this.el = el; - } - _createClass(EventsHandlerAdmin, [{ - key: "add", - value: function add(handler) { - this.handlers.push(handler); + var ZoomImages = function () { + function ZoomImages(el, slide) { + var _this = this; + var onclose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + _classCallCheck(this, ZoomImages); + this.img = el; + this.slide = slide; + this.onclose = onclose; + if (this.img.setZoomEvents) { + return false; } - }, { - key: "del", - value: function del(handler) { - if (!handler) { - this.handlers = []; + this.active = false; + this.zoomedIn = false; + this.dragging = false; + this.currentX = null; + this.currentY = null; + this.initialX = null; + this.initialY = null; + this.xOffset = 0; + this.yOffset = 0; + this.img.addEventListener('mousedown', function (e) { + return _this.dragStart(e); + }, false); + this.img.addEventListener('mouseup', function (e) { + return _this.dragEnd(e); + }, false); + this.img.addEventListener('mousemove', function (e) { + return _this.drag(e); + }, false); + this.img.addEventListener('click', function (e) { + if (_this.slide.classList.contains('dragging-nav')) { + _this.zoomOut(); + return false; } - for (var i = this.handlers.length; i >= 0; i--) { - if (this.handlers[i] === handler) { - this.handlers.splice(i, 1); - } + if (!_this.zoomedIn) { + return _this.zoomIn(); } - } - }, { - key: "dispatch", - value: function dispatch() { - for (var i = 0, len = this.handlers.length; i < len; i++) { - var handler = this.handlers[i]; - if (typeof handler === 'function') { - handler.apply(this.el, arguments); - } + if (_this.zoomedIn && !_this.dragging) { + _this.zoomOut(); } - } - }]); - return EventsHandlerAdmin; - }(); - function wrapFunc(el, handler) { - var EventshandlerAdmin = new EventsHandlerAdmin(el); - EventshandlerAdmin.add(handler); - return EventshandlerAdmin; - } - var TouchEvents = function () { - function TouchEvents(el, option) { - _classCallCheck(this, TouchEvents); - this.element = typeof el == 'string' ? document.querySelector(el) : el; - this.start = this.start.bind(this); - this.move = this.move.bind(this); - this.end = this.end.bind(this); - this.cancel = this.cancel.bind(this); - this.element.addEventListener('touchstart', this.start, false); - this.element.addEventListener('touchmove', this.move, false); - this.element.addEventListener('touchend', this.end, false); - this.element.addEventListener('touchcancel', this.cancel, false); - this.preV = { - x: null, - y: null - }; - this.pinchStartLen = null; - this.zoom = 1; - this.isDoubleTap = false; - var noop = function noop() {}; - this.rotate = wrapFunc(this.element, option.rotate || noop); - this.touchStart = wrapFunc(this.element, option.touchStart || noop); - this.multipointStart = wrapFunc(this.element, option.multipointStart || noop); - this.multipointEnd = wrapFunc(this.element, option.multipointEnd || noop); - this.pinch = wrapFunc(this.element, option.pinch || noop); - this.swipe = wrapFunc(this.element, option.swipe || noop); - this.tap = wrapFunc(this.element, option.tap || noop); - this.doubleTap = wrapFunc(this.element, option.doubleTap || noop); - this.longTap = wrapFunc(this.element, option.longTap || noop); - this.singleTap = wrapFunc(this.element, option.singleTap || noop); - this.pressMove = wrapFunc(this.element, option.pressMove || noop); - this.twoFingerPressMove = wrapFunc(this.element, option.twoFingerPressMove || noop); - this.touchMove = wrapFunc(this.element, option.touchMove || noop); - this.touchEnd = wrapFunc(this.element, option.touchEnd || noop); - this.touchCancel = wrapFunc(this.element, option.touchCancel || noop); - this.translateContainer = this.element; - this._cancelAllHandler = this.cancelAll.bind(this); - window.addEventListener('scroll', this._cancelAllHandler); - this.delta = null; - this.last = null; - this.now = null; - this.tapTimeout = null; - this.singleTapTimeout = null; - this.longTapTimeout = null; - this.swipeTimeout = null; - this.x1 = this.x2 = this.y1 = this.y2 = null; - this.preTapPosition = { - x: null, - y: null - }; + }, false); + this.img.setZoomEvents = true; } - _createClass(TouchEvents, [{ - key: "start", - value: function start(evt) { - if (!evt.touches) { - return; - } - var ignoreDragFor = ['a', 'button', 'input']; - if (evt.target && evt.target.nodeName && ignoreDragFor.indexOf(evt.target.nodeName.toLowerCase()) >= 0) { - console.log('ignore drag for this touched element', evt.target.nodeName.toLowerCase()); + return _createClass(ZoomImages, [{ + key: "zoomIn", + value: function zoomIn() { + var winWidth = this.widowWidth(); + if (this.zoomedIn || winWidth <= 768) { return; } - this.now = Date.now(); - this.x1 = evt.touches[0].pageX; - this.y1 = evt.touches[0].pageY; - this.delta = this.now - (this.last || this.now); - this.touchStart.dispatch(evt, this.element); - if (this.preTapPosition.x !== null) { - this.isDoubleTap = this.delta > 0 && this.delta <= 250 && Math.abs(this.preTapPosition.x - this.x1) < 30 && Math.abs(this.preTapPosition.y - this.y1) < 30; - if (this.isDoubleTap) { - clearTimeout(this.singleTapTimeout); - } + var img = this.img; + img.setAttribute('data-style', img.getAttribute('style')); + img.style.maxWidth = img.naturalWidth + 'px'; + img.style.maxHeight = img.naturalHeight + 'px'; + if (img.naturalWidth > winWidth) { + var centerX = winWidth / 2 - img.naturalWidth / 2; + this.setTranslate(this.img.parentNode, centerX, 0); } - this.preTapPosition.x = this.x1; - this.preTapPosition.y = this.y1; - this.last = this.now; - var preV = this.preV, - len = evt.touches.length; - if (len > 1) { - this._cancelLongTap(); - this._cancelSingleTap(); - var v = { - x: evt.touches[1].pageX - this.x1, - y: evt.touches[1].pageY - this.y1 - }; - preV.x = v.x; - preV.y = v.y; - this.pinchStartLen = getLen(preV); - this.multipointStart.dispatch(evt, this.element); + this.slide.classList.add('zoomed'); + this.zoomedIn = true; + } + }, { + key: "zoomOut", + value: function zoomOut() { + this.img.parentNode.setAttribute('style', ''); + this.img.setAttribute('style', this.img.getAttribute('data-style')); + this.slide.classList.remove('zoomed'); + this.zoomedIn = false; + this.currentX = null; + this.currentY = null; + this.initialX = null; + this.initialY = null; + this.xOffset = 0; + this.yOffset = 0; + if (this.onclose && typeof this.onclose == 'function') { + this.onclose(); } - this._preventTap = false; - this.longTapTimeout = setTimeout(function () { - this.longTap.dispatch(evt, this.element); - this._preventTap = true; - }.bind(this), 750); } }, { - key: "move", - value: function move(evt) { - if (!evt.touches) { + key: "dragStart", + value: function dragStart(e) { + e.preventDefault(); + if (!this.zoomedIn) { + this.active = false; return; } - var preV = this.preV, - len = evt.touches.length, - currentX = evt.touches[0].pageX, - currentY = evt.touches[0].pageY; - this.isDoubleTap = false; - if (len > 1) { - var sCurrentX = evt.touches[1].pageX, - sCurrentY = evt.touches[1].pageY; - var v = { - x: evt.touches[1].pageX - currentX, - y: evt.touches[1].pageY - currentY - }; - if (preV.x !== null) { - if (this.pinchStartLen > 0) { - evt.zoom = getLen(v) / this.pinchStartLen; - this.pinch.dispatch(evt, this.element); - } - evt.angle = getRotateAngle(v, preV); - this.rotate.dispatch(evt, this.element); - } - preV.x = v.x; - preV.y = v.y; - if (this.x2 !== null && this.sx2 !== null) { - evt.deltaX = (currentX - this.x2 + sCurrentX - this.sx2) / 2; - evt.deltaY = (currentY - this.y2 + sCurrentY - this.sy2) / 2; - } else { - evt.deltaX = 0; - evt.deltaY = 0; - } - this.twoFingerPressMove.dispatch(evt, this.element); - this.sx2 = sCurrentX; - this.sy2 = sCurrentY; + if (e.type === 'touchstart') { + this.initialX = e.touches[0].clientX - this.xOffset; + this.initialY = e.touches[0].clientY - this.yOffset; } else { - if (this.x2 !== null) { - evt.deltaX = currentX - this.x2; - evt.deltaY = currentY - this.y2; - var movedX = Math.abs(this.x1 - this.x2), - movedY = Math.abs(this.y1 - this.y2); - if (movedX > 10 || movedY > 10) { - this._preventTap = true; - } - } else { - evt.deltaX = 0; - evt.deltaY = 0; - } - this.pressMove.dispatch(evt, this.element); - } - this.touchMove.dispatch(evt, this.element); - this._cancelLongTap(); - this.x2 = currentX; - this.y2 = currentY; - if (len > 1) { - evt.preventDefault(); - } - } - }, { - key: "end", - value: function end(evt) { - if (!evt.changedTouches) { - return; - } - this._cancelLongTap(); - var self = this; - if (evt.touches.length < 2) { - this.multipointEnd.dispatch(evt, this.element); - this.sx2 = this.sy2 = null; + this.initialX = e.clientX - this.xOffset; + this.initialY = e.clientY - this.yOffset; } - if (this.x2 && Math.abs(this.x1 - this.x2) > 30 || this.y2 && Math.abs(this.y1 - this.y2) > 30) { - evt.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2); - this.swipeTimeout = setTimeout(function () { - self.swipe.dispatch(evt, self.element); - }, 0); - } else { - this.tapTimeout = setTimeout(function () { - if (!self._preventTap) { - self.tap.dispatch(evt, self.element); - } - if (self.isDoubleTap) { - self.doubleTap.dispatch(evt, self.element); - self.isDoubleTap = false; - } - }, 0); - if (!self.isDoubleTap) { - self.singleTapTimeout = setTimeout(function () { - self.singleTap.dispatch(evt, self.element); - }, 250); - } + if (e.target === this.img) { + this.active = true; + this.img.classList.add('dragging'); } - this.touchEnd.dispatch(evt, this.element); - this.preV.x = 0; - this.preV.y = 0; - this.zoom = 1; - this.pinchStartLen = null; - this.x1 = this.x2 = this.y1 = this.y2 = null; } }, { - key: "cancelAll", - value: function cancelAll() { - this._preventTap = true; - clearTimeout(this.singleTapTimeout); - clearTimeout(this.tapTimeout); - clearTimeout(this.longTapTimeout); - clearTimeout(this.swipeTimeout); + key: "dragEnd", + value: function dragEnd(e) { + var _this2 = this; + e.preventDefault(); + this.initialX = this.currentX; + this.initialY = this.currentY; + this.active = false; + setTimeout(function () { + _this2.dragging = false; + _this2.img.isDragging = false; + _this2.img.classList.remove('dragging'); + }, 100); } }, { - key: "cancel", - value: function cancel(evt) { - this.cancelAll(); - this.touchCancel.dispatch(evt, this.element); + key: "drag", + value: function drag(e) { + if (this.active) { + e.preventDefault(); + if (e.type === 'touchmove') { + this.currentX = e.touches[0].clientX - this.initialX; + this.currentY = e.touches[0].clientY - this.initialY; + } else { + this.currentX = e.clientX - this.initialX; + this.currentY = e.clientY - this.initialY; + } + this.xOffset = this.currentX; + this.yOffset = this.currentY; + this.img.isDragging = true; + this.dragging = true; + this.setTranslate(this.img, this.currentX, this.currentY); + } } }, { - key: "_cancelLongTap", - value: function _cancelLongTap() { - clearTimeout(this.longTapTimeout); + key: "onMove", + value: function onMove(e) { + if (!this.zoomedIn) { + return; + } + var xOffset = e.clientX - this.img.naturalWidth / 2; + var yOffset = e.clientY - this.img.naturalHeight / 2; + this.setTranslate(this.img, xOffset, yOffset); } }, { - key: "_cancelSingleTap", - value: function _cancelSingleTap() { - clearTimeout(this.singleTapTimeout); + key: "setTranslate", + value: function setTranslate(node, xPos, yPos) { + node.style.transform = 'translate3d(' + xPos + 'px, ' + yPos + 'px, 0)'; } }, { - key: "_swipeDirection", - value: function _swipeDirection(x1, x2, y1, y2) { - return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? x1 - x2 > 0 ? 'Left' : 'Right' : y1 - y2 > 0 ? 'Up' : 'Down'; + key: "widowWidth", + value: function widowWidth() { + return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; } - }, { - key: "on", - value: function on(evt, handler) { - if (this[evt]) { - this[evt].add(handler); + }]); + }(); + + var DragSlides = function () { + function DragSlides() { + var _this = this; + var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + _classCallCheck(this, DragSlides); + var dragEl = config.dragEl, + _config$toleranceX = config.toleranceX, + toleranceX = _config$toleranceX === void 0 ? 40 : _config$toleranceX, + _config$toleranceY = config.toleranceY, + toleranceY = _config$toleranceY === void 0 ? 65 : _config$toleranceY, + _config$slide = config.slide, + slide = _config$slide === void 0 ? null : _config$slide, + _config$instance = config.instance, + instance = _config$instance === void 0 ? null : _config$instance; + this.el = dragEl; + this.active = false; + this.dragging = false; + this.currentX = null; + this.currentY = null; + this.initialX = null; + this.initialY = null; + this.xOffset = 0; + this.yOffset = 0; + this.direction = null; + this.lastDirection = null; + this.toleranceX = toleranceX; + this.toleranceY = toleranceY; + this.toleranceReached = false; + this.dragContainer = this.el; + this.slide = slide; + this.instance = instance; + this.el.addEventListener('mousedown', function (e) { + return _this.dragStart(e); + }, false); + this.el.addEventListener('mouseup', function (e) { + return _this.dragEnd(e); + }, false); + this.el.addEventListener('mousemove', function (e) { + return _this.drag(e); + }, false); + } + return _createClass(DragSlides, [{ + key: "dragStart", + value: function dragStart(e) { + if (this.slide.classList.contains('zoomed')) { + this.active = false; + return; } - } - }, { - key: "off", - value: function off(evt, handler) { - if (this[evt]) { - this[evt].del(handler); + if (e.type === 'touchstart') { + this.initialX = e.touches[0].clientX - this.xOffset; + this.initialY = e.touches[0].clientY - this.yOffset; + } else { + this.initialX = e.clientX - this.xOffset; + this.initialY = e.clientY - this.yOffset; + } + var clicked = e.target.nodeName.toLowerCase(); + var exludeClicks = ['input', 'select', 'textarea', 'button', 'a']; + if (e.target.classList.contains('nodrag') || closest(e.target, '.nodrag') || exludeClicks.indexOf(clicked) !== -1) { + this.active = false; + return; + } + e.preventDefault(); + if (e.target === this.el || clicked !== 'img' && closest(e.target, '.gslide-inline')) { + this.active = true; + this.el.classList.add('dragging'); + this.dragContainer = closest(e.target, '.ginner-container'); } } }, { - key: "destroy", - value: function destroy() { - if (this.singleTapTimeout) { - clearTimeout(this.singleTapTimeout); - } - if (this.tapTimeout) { - clearTimeout(this.tapTimeout); + key: "dragEnd", + value: function dragEnd(e) { + var _this2 = this; + e && e.preventDefault(); + this.initialX = 0; + this.initialY = 0; + this.currentX = null; + this.currentY = null; + this.initialX = null; + this.initialY = null; + this.xOffset = 0; + this.yOffset = 0; + this.active = false; + if (this.doSlideChange) { + this.instance.preventOutsideClick = true; + this.doSlideChange == 'right' && this.instance.prevSlide(); + this.doSlideChange == 'left' && this.instance.nextSlide(); } - if (this.longTapTimeout) { - clearTimeout(this.longTapTimeout); + if (this.doSlideClose) { + this.instance.close(); } - if (this.swipeTimeout) { - clearTimeout(this.swipeTimeout); + if (!this.toleranceReached) { + this.setTranslate(this.dragContainer, 0, 0, true); } - this.element.removeEventListener('touchstart', this.start); - this.element.removeEventListener('touchmove', this.move); - this.element.removeEventListener('touchend', this.end); - this.element.removeEventListener('touchcancel', this.cancel); - this.rotate.del(); - this.touchStart.del(); - this.multipointStart.del(); - this.multipointEnd.del(); - this.pinch.del(); - this.swipe.del(); - this.tap.del(); - this.doubleTap.del(); - this.longTap.del(); - this.singleTap.del(); - this.pressMove.del(); - this.twoFingerPressMove.del(); - this.touchMove.del(); - this.touchEnd.del(); - this.touchCancel.del(); - this.preV = this.pinchStartLen = this.zoom = this.isDoubleTap = this.delta = this.last = this.now = this.tapTimeout = this.singleTapTimeout = this.longTapTimeout = this.swipeTimeout = this.x1 = this.x2 = this.y1 = this.y2 = this.preTapPosition = this.rotate = this.touchStart = this.multipointStart = this.multipointEnd = this.pinch = this.swipe = this.tap = this.doubleTap = this.longTap = this.singleTap = this.pressMove = this.touchMove = this.touchEnd = this.touchCancel = this.twoFingerPressMove = null; - window.removeEventListener('scroll', this._cancelAllHandler); - return null; - } - }]); - return TouchEvents; - }(); - - function resetSlideMove(slide) { - var transitionEnd = whichTransitionEvent(); - var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; - var media = hasClass(slide, 'gslide-media') ? slide : slide.querySelector('.gslide-media'); - var container = closest(media, '.ginner-container'); - var desc = slide.querySelector('.gslide-description'); - if (windowWidth > 769) { - media = container; - } - addClass(media, 'greset'); - cssTransform(media, 'translate3d(0, 0, 0)'); - addEvent(transitionEnd, { - onElement: media, - once: true, - withCallback: function withCallback(event, target) { - removeClass(media, 'greset'); + setTimeout(function () { + _this2.instance.preventOutsideClick = false; + _this2.toleranceReached = false; + _this2.lastDirection = null; + _this2.dragging = false; + _this2.el.isDragging = false; + _this2.el.classList.remove('dragging'); + _this2.slide.classList.remove('dragging-nav'); + _this2.dragContainer.style.transform = ''; + _this2.dragContainer.style.transition = ''; + }, 100); } - }); - media.style.opacity = ''; - if (desc) { - desc.style.opacity = ''; - } - } - function touchNavigation(instance) { - if (instance.events.hasOwnProperty('touch')) { - return false; - } - var winSize = windowSize(); - var winWidth = winSize.width; - var winHeight = winSize.height; - var process = false; - var currentSlide = null; - var media = null; - var mediaImage = null; - var doingMove = false; - var initScale = 1; - var maxScale = 4.5; - var currentScale = 1; - var doingZoom = false; - var imageZoomed = false; - var zoomedPosX = null; - var zoomedPosY = null; - var lastZoomedPosX = null; - var lastZoomedPosY = null; - var hDistance; - var vDistance; - var hDistancePercent = 0; - var vDistancePercent = 0; - var vSwipe = false; - var hSwipe = false; - var startCoords = {}; - var endCoords = {}; - var xDown = 0; - var yDown = 0; - var isInlined; - var sliderWrapper = document.getElementById('glightbox-slider'); - var overlay = document.querySelector('.goverlay'); - var touchInstance = new TouchEvents(sliderWrapper, { - touchStart: function touchStart(e) { - process = true; - if (hasClass(e.targetTouches[0].target, 'ginner-container') || closest(e.targetTouches[0].target, '.gslide-desc') || e.targetTouches[0].target.nodeName.toLowerCase() == 'a') { - process = false; - } - if (closest(e.targetTouches[0].target, '.gslide-inline') && !hasClass(e.targetTouches[0].target.parentNode, 'gslide-inline')) { - process = false; - } - if (process) { - endCoords = e.targetTouches[0]; - startCoords.pageX = e.targetTouches[0].pageX; - startCoords.pageY = e.targetTouches[0].pageY; - xDown = e.targetTouches[0].clientX; - yDown = e.targetTouches[0].clientY; - currentSlide = instance.activeSlide; - media = currentSlide.querySelector('.gslide-media'); - isInlined = currentSlide.querySelector('.gslide-inline'); - mediaImage = null; - if (hasClass(media, 'gslide-image')) { - mediaImage = media.querySelector('img'); - } - var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; - if (windowWidth > 769) { - media = currentSlide.querySelector('.ginner-container'); - } - removeClass(overlay, 'greset'); - if (e.pageX > 20 && e.pageX < window.innerWidth - 20) { - return; - } + }, { + key: "drag", + value: function drag(e) { + if (this.active) { e.preventDefault(); - } - }, - touchMove: function touchMove(e) { - if (!process) { - return; - } - endCoords = e.targetTouches[0]; - if (doingZoom || imageZoomed) { - return; - } - if (isInlined && isInlined.offsetHeight > winHeight) { - var moved = startCoords.pageX - endCoords.pageX; - if (Math.abs(moved) <= 13) { - return false; + this.slide.classList.add('dragging-nav'); + if (e.type === 'touchmove') { + this.currentX = e.touches[0].clientX - this.initialX; + this.currentY = e.touches[0].clientY - this.initialY; + } else { + this.currentX = e.clientX - this.initialX; + this.currentY = e.clientY - this.initialY; } - } - doingMove = true; - var xUp = e.targetTouches[0].clientX; - var yUp = e.targetTouches[0].clientY; - var xDiff = xDown - xUp; - var yDiff = yDown - yUp; - if (Math.abs(xDiff) > Math.abs(yDiff)) { - vSwipe = false; - hSwipe = true; - } else { - hSwipe = false; - vSwipe = true; - } - hDistance = endCoords.pageX - startCoords.pageX; - hDistancePercent = hDistance * 100 / winWidth; - vDistance = endCoords.pageY - startCoords.pageY; - vDistancePercent = vDistance * 100 / winHeight; - var opacity; - if (vSwipe && mediaImage) { - opacity = 1 - Math.abs(vDistance) / winHeight; - overlay.style.opacity = opacity; - if (instance.settings.touchFollowAxis) { - hDistancePercent = 0; + this.xOffset = this.currentX; + this.yOffset = this.currentY; + this.el.isDragging = true; + this.dragging = true; + this.doSlideChange = false; + this.doSlideClose = false; + var currentXInt = Math.abs(this.currentX); + var currentYInt = Math.abs(this.currentY); + if (currentXInt > 0 && currentXInt >= Math.abs(this.currentY) && (!this.lastDirection || this.lastDirection == 'x')) { + this.yOffset = 0; + this.lastDirection = 'x'; + this.setTranslate(this.dragContainer, this.currentX, 0); + var doChange = this.shouldChange(); + if (!this.instance.settings.dragAutoSnap && doChange) { + this.doSlideChange = doChange; + } + if (this.instance.settings.dragAutoSnap && doChange) { + this.instance.preventOutsideClick = true; + this.toleranceReached = true; + this.active = false; + this.instance.preventOutsideClick = true; + this.dragEnd(null); + doChange == 'right' && this.instance.prevSlide(); + doChange == 'left' && this.instance.nextSlide(); + return; + } } - } - if (hSwipe) { - opacity = 1 - Math.abs(hDistance) / winWidth; - media.style.opacity = opacity; - if (instance.settings.touchFollowAxis) { - vDistancePercent = 0; + if (this.toleranceY > 0 && currentYInt > 0 && currentYInt >= currentXInt && (!this.lastDirection || this.lastDirection == 'y')) { + this.xOffset = 0; + this.lastDirection = 'y'; + this.setTranslate(this.dragContainer, 0, this.currentY); + var doClose = this.shouldClose(); + if (!this.instance.settings.dragAutoSnap && doClose) { + this.doSlideClose = true; + } + if (this.instance.settings.dragAutoSnap && doClose) { + this.instance.close(); + } + return; } } - if (!mediaImage) { - return cssTransform(media, "translate3d(".concat(hDistancePercent, "%, 0, 0)")); - } - cssTransform(media, "translate3d(".concat(hDistancePercent, "%, ").concat(vDistancePercent, "%, 0)")); - }, - touchEnd: function touchEnd() { - if (!process) { - return; - } - doingMove = false; - if (imageZoomed || doingZoom) { - lastZoomedPosX = zoomedPosX; - lastZoomedPosY = zoomedPosY; - return; - } - var v = Math.abs(parseInt(vDistancePercent)); - var h = Math.abs(parseInt(hDistancePercent)); - if (v > 29 && mediaImage) { - instance.close(); - return; - } - if (v < 29 && h < 25) { - addClass(overlay, 'greset'); - overlay.style.opacity = 1; - return resetSlideMove(media); - } - }, - multipointEnd: function multipointEnd() { - setTimeout(function () { - doingZoom = false; - }, 50); - }, - multipointStart: function multipointStart() { - doingZoom = true; - initScale = currentScale ? currentScale : 1; - }, - pinch: function pinch(evt) { - if (!mediaImage || doingMove) { - return false; - } - doingZoom = true; - mediaImage.scaleX = mediaImage.scaleY = initScale * evt.zoom; - var scale = initScale * evt.zoom; - imageZoomed = true; - if (scale <= 1) { - imageZoomed = false; - scale = 1; - lastZoomedPosY = null; - lastZoomedPosX = null; - zoomedPosX = null; - zoomedPosY = null; - mediaImage.setAttribute('style', ''); - return; - } - if (scale > maxScale) { - scale = maxScale; - } - mediaImage.style.transform = "scale3d(".concat(scale, ", ").concat(scale, ", 1)"); - currentScale = scale; - }, - pressMove: function pressMove(e) { - if (imageZoomed && !doingZoom) { - var mhDistance = endCoords.pageX - startCoords.pageX; - var mvDistance = endCoords.pageY - startCoords.pageY; - if (lastZoomedPosX) { - mhDistance = mhDistance + lastZoomedPosX; - } - if (lastZoomedPosY) { - mvDistance = mvDistance + lastZoomedPosY; - } - zoomedPosX = mhDistance; - zoomedPosY = mvDistance; - var style = "translate3d(".concat(mhDistance, "px, ").concat(mvDistance, "px, 0)"); - if (currentScale) { - style += " scale3d(".concat(currentScale, ", ").concat(currentScale, ", 1)"); + } + }, { + key: "shouldChange", + value: function shouldChange() { + var doChange = false; + var currentXInt = Math.abs(this.currentX); + if (currentXInt >= this.toleranceX) { + var dragDir = this.currentX > 0 ? 'right' : 'left'; + if (dragDir == 'left' && this.slide !== this.slide.parentNode.lastChild || dragDir == 'right' && this.slide !== this.slide.parentNode.firstChild) { + doChange = dragDir; } - cssTransform(mediaImage, style); } - }, - swipe: function swipe(evt) { - if (imageZoomed) { - return; + return doChange; + } + }, { + key: "shouldClose", + value: function shouldClose() { + var doClose = false; + var currentYInt = Math.abs(this.currentY); + if (currentYInt >= this.toleranceY) { + doClose = true; } - if (doingZoom) { - doingZoom = false; - return; + return doClose; + } + }, { + key: "setTranslate", + value: function setTranslate(node, xPos, yPos) { + var animated = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + if (animated) { + node.style.transition = 'all .2s ease'; + } else { + node.style.transition = ''; } - if (evt.direction == 'Left') { - if (instance.index == instance.elements.length - 1) { - return resetSlideMove(media); - } - instance.nextSlide(); + node.style.transform = "translate3d(".concat(xPos, "px, ").concat(yPos, "px, 0)"); + } + }]); + }(); + + function slideImage(slide, data, index, callback) { + var slideMedia = slide.querySelector('.gslide-media'); + var img = new Image(); + var titleID = 'gSlideTitle_' + index; + var textID = 'gSlideDesc_' + index; + img.addEventListener('load', function () { + if (isFunction(callback)) { + callback(); + } + }, false); + img.src = data.href; + if (data.sizes != '' && data.srcset != '') { + img.sizes = data.sizes; + img.srcset = data.srcset; + } + img.alt = ''; + if (!isNil(data.alt) && data.alt !== '') { + img.alt = data.alt; + } + if (data.title !== '') { + img.setAttribute('aria-labelledby', titleID); + } + if (data.description !== '') { + img.setAttribute('aria-describedby', textID); + } + if (data.hasOwnProperty('_hasCustomWidth') && data._hasCustomWidth) { + img.style.width = data.width; + } + if (data.hasOwnProperty('_hasCustomHeight') && data._hasCustomHeight) { + img.style.height = data.height; + } + slideMedia.insertBefore(img, slideMedia.firstChild); + return; + } + + function slideVideo(slide, data, index, callback) { + var _this = this; + var slideContainer = slide.querySelector('.ginner-container'); + var videoID = 'gvideo' + index; + var slideMedia = slide.querySelector('.gslide-media'); + var videoPlayers = this.getAllPlayers(); + addClass(slideContainer, 'gvideo-container'); + slideMedia.insertBefore(createHTML('
'), slideMedia.firstChild); + var videoWrapper = slide.querySelector('.gvideo-wrapper'); + injectAssets(this.settings.plyr.css, 'Plyr'); + var url = data.href; + var provider = data === null || data === void 0 ? void 0 : data.videoProvider; + var customPlaceholder = false; + slideMedia.style.maxWidth = data.width; + injectAssets(this.settings.plyr.js, 'Plyr', function () { + if (!provider && url.match(/vimeo\.com\/([0-9]*)/)) { + provider = 'vimeo'; + } + if (!provider && (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/))) { + provider = 'youtube'; + } + if (provider === 'local' || !provider) { + provider = 'local'; + var html = ''; + customPlaceholder = createHTML(html); + } + var placeholder = customPlaceholder ? customPlaceholder : createHTML("
")); + addClass(videoWrapper, "".concat(provider, "-video gvideo")); + videoWrapper.appendChild(placeholder); + videoWrapper.setAttribute('data-id', videoID); + videoWrapper.setAttribute('data-index', index); + var playerConfig = has(_this.settings.plyr, 'config') ? _this.settings.plyr.config : {}; + var player = new Plyr('#' + videoID, playerConfig); + player.on('ready', function (event) { + videoPlayers[videoID] = event.detail.plyr; + if (isFunction(callback)) { + callback(); } - if (evt.direction == 'Right') { - if (instance.index == 0) { - return resetSlideMove(media); - } - instance.prevSlide(); + }); + waitUntil(function () { + return slide.querySelector('iframe') && slide.querySelector('iframe').dataset.ready == 'true'; + }, function () { + _this.resize(slide); + }); + player.on('enterfullscreen', handleMediaFullScreen); + player.on('exitfullscreen', handleMediaFullScreen); + }); + } + function handleMediaFullScreen(event) { + var media = closest(event.target, '.gslide-media'); + if (event.type === 'enterfullscreen') { + addClass(media, 'fullscreen'); + } + if (event.type === 'exitfullscreen') { + removeClass(media, 'fullscreen'); + } + } + + function slideInline(slide, data, index, callback) { + var _this = this; + var slideMedia = slide.querySelector('.gslide-media'); + var hash = has(data, 'href') && data.href ? data.href.split('#').pop().trim() : false; + var content = has(data, 'content') && data.content ? data.content : false; + var innerContent; + if (content) { + if (isString(content)) { + innerContent = createHTML("
".concat(content, "
")); + } + if (isNode(content)) { + if (content.style.display == 'none') { + content.style.display = 'block'; } + var container = document.createElement('div'); + container.className = 'ginlined-content'; + container.appendChild(content); + innerContent = container; + } + } + if (hash) { + var div = document.getElementById(hash); + if (!div) { + return false; + } + var cloned = div.cloneNode(true); + cloned.style.height = data.height; + cloned.style.maxWidth = data.width; + addClass(cloned, 'ginlined-content'); + innerContent = cloned; + } + if (!innerContent) { + console.error('Unable to append inline slide content', data); + return false; + } + slideMedia.style.height = data.height; + slideMedia.style.width = data.width; + slideMedia.appendChild(innerContent); + this.events['inlineclose' + hash] = addEvent('click', { + onElement: slideMedia.querySelectorAll('.gtrigger-close'), + withCallback: function withCallback(e) { + e.preventDefault(); + _this.close(); } }); - instance.events['touch'] = touchInstance; + if (isFunction(callback)) { + callback(); + } + return; } - var ZoomImages = function () { - function ZoomImages(el, slide) { - var _this = this; - var onclose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - _classCallCheck(this, ZoomImages); - this.img = el; - this.slide = slide; - this.onclose = onclose; - if (this.img.setZoomEvents) { - return false; + function slideIframe(slide, data, index, callback) { + var slideMedia = slide.querySelector('.gslide-media'); + var iframe = createIframe({ + url: data.href, + callback: callback + }); + slideMedia.parentNode.style.maxWidth = data.width; + slideMedia.parentNode.style.height = data.height; + slideMedia.appendChild(iframe); + return; + } + + var SlideConfigParser = function () { + function SlideConfigParser() { + var slideParamas = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + _classCallCheck(this, SlideConfigParser); + this.defaults = { + href: '', + sizes: '', + srcset: '', + title: '', + type: '', + videoProvider: '', + description: '', + alt: '', + descPosition: 'bottom', + effect: '', + width: '', + height: '', + content: false, + zoomable: true, + draggable: true + }; + if (isObject(slideParamas)) { + this.defaults = extend(this.defaults, slideParamas); } - this.active = false; - this.zoomedIn = false; - this.dragging = false; - this.currentX = null; - this.currentY = null; - this.initialX = null; - this.initialY = null; - this.xOffset = 0; - this.yOffset = 0; - this.img.addEventListener('mousedown', function (e) { - return _this.dragStart(e); - }, false); - this.img.addEventListener('mouseup', function (e) { - return _this.dragEnd(e); - }, false); - this.img.addEventListener('mousemove', function (e) { - return _this.drag(e); - }, false); - this.img.addEventListener('click', function (e) { - if (_this.slide.classList.contains('dragging-nav')) { - _this.zoomOut(); - return false; + } + return _createClass(SlideConfigParser, [{ + key: "sourceType", + value: function sourceType(url) { + var origin = url; + url = url.toLowerCase(); + if (url.match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/) !== null) { + return 'image'; } - if (!_this.zoomedIn) { - return _this.zoomIn(); + if (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/)) { + return 'video'; } - if (_this.zoomedIn && !_this.dragging) { - _this.zoomOut(); + if (url.match(/vimeo\.com\/([0-9]*)/)) { + return 'video'; } - }, false); - this.img.setZoomEvents = true; - } - _createClass(ZoomImages, [{ - key: "zoomIn", - value: function zoomIn() { - var winWidth = this.widowWidth(); - if (this.zoomedIn || winWidth <= 768) { - return; + if (url.match(/\.(mp4|ogg|webm|mov)/) !== null) { + return 'video'; } - var img = this.img; - img.setAttribute('data-style', img.getAttribute('style')); - img.style.maxWidth = img.naturalWidth + 'px'; - img.style.maxHeight = img.naturalHeight + 'px'; - if (img.naturalWidth > winWidth) { - var centerX = winWidth / 2 - img.naturalWidth / 2; - this.setTranslate(this.img.parentNode, centerX, 0); + if (url.match(/\.(mp3|wav|wma|aac|ogg)/) !== null) { + return 'audio'; + } + if (url.indexOf('#') > -1) { + var hash = origin.split('#').pop(); + if (hash.trim() !== '') { + return 'inline'; + } + } + if (url.indexOf('goajax=true') > -1) { + return 'ajax'; } - this.slide.classList.add('zoomed'); - this.zoomedIn = true; + return 'external'; } }, { - key: "zoomOut", - value: function zoomOut() { - this.img.parentNode.setAttribute('style', ''); - this.img.setAttribute('style', this.img.getAttribute('data-style')); - this.slide.classList.remove('zoomed'); - this.zoomedIn = false; - this.currentX = null; - this.currentY = null; - this.initialX = null; - this.initialY = null; - this.xOffset = 0; - this.yOffset = 0; - if (this.onclose && typeof this.onclose == 'function') { - this.onclose(); + key: "parseConfig", + value: function parseConfig(element, settings) { + var _this = this; + var data = extend({ + descPosition: settings.descPosition + }, this.defaults); + if (isObject(element) && !isNode(element)) { + if (!has(element, 'type')) { + if (has(element, 'content') && element.content) { + element.type = 'inline'; + } else if (has(element, 'href')) { + element.type = this.sourceType(element.href); + } + } + var objectData = extend(data, element); + this.setSize(objectData, settings); + return objectData; } - } - }, { - key: "dragStart", - value: function dragStart(e) { - e.preventDefault(); - if (!this.zoomedIn) { - this.active = false; - return; + var url = ''; + var config = element.getAttribute('data-glightbox'); + var nodeType = element.nodeName.toLowerCase(); + if (nodeType === 'a') { + url = element.href; } - if (e.type === 'touchstart') { - this.initialX = e.touches[0].clientX - this.xOffset; - this.initialY = e.touches[0].clientY - this.yOffset; + if (nodeType === 'img') { + url = element.src; + data.alt = element.alt; + } + data.href = url; + each(data, function (val, key) { + if (has(settings, key) && key !== 'width') { + data[key] = settings[key]; + } + var nodeData = element.dataset[key]; + if (!isNil(nodeData)) { + data[key] = _this.sanitizeValue(nodeData); + } + }); + if (data.content) { + data.type = 'inline'; + } + if (!data.type && url) { + data.type = this.sourceType(url); + } + if (!isNil(config)) { + var cleanKeys = []; + each(data, function (v, k) { + cleanKeys.push(';\\s?' + k); + }); + cleanKeys = cleanKeys.join('\\s?:|'); + if (config.trim() !== '') { + each(data, function (val, key) { + var str = config; + var match = 's?' + key + 's?:s?(.*?)(' + cleanKeys + 's?:|$)'; + var regex = new RegExp(match); + var matches = str.match(regex); + if (matches && matches.length && matches[1]) { + var value = matches[1].trim().replace(/;\s*$/, ''); + data[key] = _this.sanitizeValue(value); + } + }); + } } else { - this.initialX = e.clientX - this.xOffset; - this.initialY = e.clientY - this.yOffset; + if (!data.title && nodeType == 'a') { + var title = element.title; + if (!isNil(title) && title !== '') { + data.title = title; + } + } + if (!data.title && nodeType == 'img') { + var alt = element.alt; + if (!isNil(alt) && alt !== '') { + data.title = alt; + } + } } - if (e.target === this.img) { - this.active = true; - this.img.classList.add('dragging'); + if (data.description && data.description.substring(0, 1) === '.') { + var description; + try { + description = document.querySelector(data.description).innerHTML; + } catch (error) { + if (!(error instanceof DOMException)) { + throw error; + } + } + if (description) { + data.description = description; + } } - } - }, { - key: "dragEnd", - value: function dragEnd(e) { - var _this2 = this; - e.preventDefault(); - this.initialX = this.currentX; - this.initialY = this.currentY; - this.active = false; - setTimeout(function () { - _this2.dragging = false; - _this2.img.isDragging = false; - _this2.img.classList.remove('dragging'); - }, 100); - } - }, { - key: "drag", - value: function drag(e) { - if (this.active) { - e.preventDefault(); - if (e.type === 'touchmove') { - this.currentX = e.touches[0].clientX - this.initialX; - this.currentY = e.touches[0].clientY - this.initialY; - } else { - this.currentX = e.clientX - this.initialX; - this.currentY = e.clientY - this.initialY; + if (!data.description) { + var nodeDesc = element.querySelector('.glightbox-desc'); + if (nodeDesc) { + data.description = nodeDesc.innerHTML; } - this.xOffset = this.currentX; - this.yOffset = this.currentY; - this.img.isDragging = true; - this.dragging = true; - this.setTranslate(this.img, this.currentX, this.currentY); } + this.setSize(data, settings, element); + this.slideConfig = data; + return data; } }, { - key: "onMove", - value: function onMove(e) { - if (!this.zoomedIn) { - return; + key: "setSize", + value: function setSize(data, settings) { + var element = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var defaultWith = data.type == 'video' ? this.checkSize(settings.videosWidth) : this.checkSize(settings.width); + var defaultHeight = this.checkSize(settings.height); + data.width = has(data, 'width') && data.width !== '' ? this.checkSize(data.width) : defaultWith; + data.height = has(data, 'height') && data.height !== '' ? this.checkSize(data.height) : defaultHeight; + if (element && data.type == 'image') { + data._hasCustomWidth = element.dataset.width ? true : false; + data._hasCustomHeight = element.dataset.height ? true : false; } - var xOffset = e.clientX - this.img.naturalWidth / 2; - var yOffset = e.clientY - this.img.naturalHeight / 2; - this.setTranslate(this.img, xOffset, yOffset); + return data; } }, { - key: "setTranslate", - value: function setTranslate(node, xPos, yPos) { - node.style.transform = 'translate3d(' + xPos + 'px, ' + yPos + 'px, 0)'; + key: "checkSize", + value: function checkSize(size) { + return isNumber(size) ? "".concat(size, "px") : size; } }, { - key: "widowWidth", - value: function widowWidth() { - return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + key: "sanitizeValue", + value: function sanitizeValue(val) { + if (val !== 'true' && val !== 'false') { + return val; + } + return val === 'true'; } }]); - return ZoomImages; }(); - var DragSlides = function () { - function DragSlides() { - var _this = this; - var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - _classCallCheck(this, DragSlides); - var dragEl = config.dragEl, - _config$toleranceX = config.toleranceX, - toleranceX = _config$toleranceX === void 0 ? 40 : _config$toleranceX, - _config$toleranceY = config.toleranceY, - toleranceY = _config$toleranceY === void 0 ? 65 : _config$toleranceY, - _config$slide = config.slide, - slide = _config$slide === void 0 ? null : _config$slide, - _config$instance = config.instance, - instance = _config$instance === void 0 ? null : _config$instance; - this.el = dragEl; - this.active = false; - this.dragging = false; - this.currentX = null; - this.currentY = null; - this.initialX = null; - this.initialY = null; - this.xOffset = 0; - this.yOffset = 0; - this.direction = null; - this.lastDirection = null; - this.toleranceX = toleranceX; - this.toleranceY = toleranceY; - this.toleranceReached = false; - this.dragContainer = this.el; - this.slide = slide; + var Slide = function () { + function Slide(el, instance, index) { + _classCallCheck(this, Slide); + this.element = el; this.instance = instance; - this.el.addEventListener('mousedown', function (e) { - return _this.dragStart(e); - }, false); - this.el.addEventListener('mouseup', function (e) { - return _this.dragEnd(e); - }, false); - this.el.addEventListener('mousemove', function (e) { - return _this.drag(e); - }, false); + this.index = index; } - _createClass(DragSlides, [{ - key: "dragStart", - value: function dragStart(e) { - if (this.slide.classList.contains('zoomed')) { - this.active = false; - return; + return _createClass(Slide, [{ + key: "setContent", + value: function setContent() { + var _this = this; + var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + if (hasClass(slide, 'loaded')) { + return false; + } + var settings = this.instance.settings; + var slideConfig = this.slideConfig; + var isMobileDevice = isMobile(); + if (isFunction(settings.beforeSlideLoad)) { + settings.beforeSlideLoad({ + index: this.index, + slide: slide, + player: false + }); + } + var type = slideConfig.type; + var position = slideConfig.descPosition; + var slideMedia = slide.querySelector('.gslide-media'); + var slideTitle = slide.querySelector('.gslide-title'); + var slideText = slide.querySelector('.gslide-desc'); + var slideDesc = slide.querySelector('.gdesc-inner'); + var finalCallback = callback; + var titleID = 'gSlideTitle_' + this.index; + var textID = 'gSlideDesc_' + this.index; + if (isFunction(settings.afterSlideLoad)) { + finalCallback = function finalCallback() { + if (isFunction(callback)) { + callback(); + } + settings.afterSlideLoad({ + index: _this.index, + slide: slide, + player: _this.instance.getSlidePlayerInstance(_this.index) + }); + }; } - if (e.type === 'touchstart') { - this.initialX = e.touches[0].clientX - this.xOffset; - this.initialY = e.touches[0].clientY - this.yOffset; + if (slideConfig.title == '' && slideConfig.description == '') { + if (slideDesc) { + slideDesc.parentNode.parentNode.removeChild(slideDesc.parentNode); + } } else { - this.initialX = e.clientX - this.xOffset; - this.initialY = e.clientY - this.yOffset; + if (slideTitle && slideConfig.title !== '') { + slideTitle.id = titleID; + slideTitle.innerHTML = slideConfig.title; + } else { + slideTitle.parentNode.removeChild(slideTitle); + } + if (slideText && slideConfig.description !== '') { + slideText.id = textID; + if (isMobileDevice && settings.moreLength > 0) { + slideConfig.smallDescription = this.slideShortDesc(slideConfig.description, settings.moreLength, settings.moreText); + slideText.innerHTML = slideConfig.smallDescription; + this.descriptionEvents(slideText, slideConfig); + } else { + slideText.innerHTML = slideConfig.description; + } + } else { + slideText.parentNode.removeChild(slideText); + } + addClass(slideMedia.parentNode, "desc-".concat(position)); + addClass(slideDesc.parentNode, "description-".concat(position)); } - var clicked = e.target.nodeName.toLowerCase(); - var exludeClicks = ['input', 'select', 'textarea', 'button', 'a']; - if (e.target.classList.contains('nodrag') || closest(e.target, '.nodrag') || exludeClicks.indexOf(clicked) !== -1) { - this.active = false; + addClass(slideMedia, "gslide-".concat(type)); + addClass(slide, 'loaded'); + if (type === 'video') { + slideVideo.apply(this.instance, [slide, slideConfig, this.index, finalCallback]); return; } - e.preventDefault(); - if (e.target === this.el || clicked !== 'img' && closest(e.target, '.gslide-inline')) { - this.active = true; - this.el.classList.add('dragging'); - this.dragContainer = closest(e.target, '.ginner-container'); - } - } - }, { - key: "dragEnd", - value: function dragEnd(e) { - var _this2 = this; - e && e.preventDefault(); - this.initialX = 0; - this.initialY = 0; - this.currentX = null; - this.currentY = null; - this.initialX = null; - this.initialY = null; - this.xOffset = 0; - this.yOffset = 0; - this.active = false; - if (this.doSlideChange) { - this.instance.preventOutsideClick = true; - this.doSlideChange == 'right' && this.instance.prevSlide(); - this.doSlideChange == 'left' && this.instance.nextSlide(); - } - if (this.doSlideClose) { - this.instance.close(); - } - if (!this.toleranceReached) { - this.setTranslate(this.dragContainer, 0, 0, true); + if (type === 'external') { + slideIframe.apply(this, [slide, slideConfig, this.index, finalCallback]); + return; } - setTimeout(function () { - _this2.instance.preventOutsideClick = false; - _this2.toleranceReached = false; - _this2.lastDirection = null; - _this2.dragging = false; - _this2.el.isDragging = false; - _this2.el.classList.remove('dragging'); - _this2.slide.classList.remove('dragging-nav'); - _this2.dragContainer.style.transform = ''; - _this2.dragContainer.style.transition = ''; - }, 100); - } - }, { - key: "drag", - value: function drag(e) { - if (this.active) { - e.preventDefault(); - this.slide.classList.add('dragging-nav'); - if (e.type === 'touchmove') { - this.currentX = e.touches[0].clientX - this.initialX; - this.currentY = e.touches[0].clientY - this.initialY; - } else { - this.currentX = e.clientX - this.initialX; - this.currentY = e.clientY - this.initialY; + if (type === 'inline') { + slideInline.apply(this.instance, [slide, slideConfig, this.index, finalCallback]); + if (slideConfig.draggable) { + new DragSlides({ + dragEl: slide.querySelector('.gslide-inline'), + toleranceX: settings.dragToleranceX, + toleranceY: settings.dragToleranceY, + slide: slide, + instance: this.instance + }); } - this.xOffset = this.currentX; - this.yOffset = this.currentY; - this.el.isDragging = true; - this.dragging = true; - this.doSlideChange = false; - this.doSlideClose = false; - var currentXInt = Math.abs(this.currentX); - var currentYInt = Math.abs(this.currentY); - if (currentXInt > 0 && currentXInt >= Math.abs(this.currentY) && (!this.lastDirection || this.lastDirection == 'x')) { - this.yOffset = 0; - this.lastDirection = 'x'; - this.setTranslate(this.dragContainer, this.currentX, 0); - var doChange = this.shouldChange(); - if (!this.instance.settings.dragAutoSnap && doChange) { - this.doSlideChange = doChange; - } - if (this.instance.settings.dragAutoSnap && doChange) { - this.instance.preventOutsideClick = true; - this.toleranceReached = true; - this.active = false; - this.instance.preventOutsideClick = true; - this.dragEnd(null); - doChange == 'right' && this.instance.prevSlide(); - doChange == 'left' && this.instance.nextSlide(); - return; + return; + } + if (type === 'image') { + slideImage(slide, slideConfig, this.index, function () { + var img = slide.querySelector('img'); + if (slideConfig.draggable) { + new DragSlides({ + dragEl: img, + toleranceX: settings.dragToleranceX, + toleranceY: settings.dragToleranceY, + slide: slide, + instance: _this.instance + }); } - } - if (this.toleranceY > 0 && currentYInt > 0 && currentYInt >= currentXInt && (!this.lastDirection || this.lastDirection == 'y')) { - this.xOffset = 0; - this.lastDirection = 'y'; - this.setTranslate(this.dragContainer, 0, this.currentY); - var doClose = this.shouldClose(); - if (!this.instance.settings.dragAutoSnap && doClose) { - this.doSlideClose = true; + if (slideConfig.zoomable && img.naturalWidth > img.offsetWidth) { + addClass(img, 'zoomable'); + new ZoomImages(img, slide, function () { + _this.instance.resize(); + }); } - if (this.instance.settings.dragAutoSnap && doClose) { - this.instance.close(); + if (isFunction(finalCallback)) { + finalCallback(); } - return; - } + }); + return; + } + if (isFunction(finalCallback)) { + finalCallback(); } } }, { - key: "shouldChange", - value: function shouldChange() { - var doChange = false; - var currentXInt = Math.abs(this.currentX); - if (currentXInt >= this.toleranceX) { - var dragDir = this.currentX > 0 ? 'right' : 'left'; - if (dragDir == 'left' && this.slide !== this.slide.parentNode.lastChild || dragDir == 'right' && this.slide !== this.slide.parentNode.firstChild) { - doChange = dragDir; - } + key: "slideShortDesc", + value: function slideShortDesc(string) { + var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50; + var wordBoundary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var div = document.createElement('div'); + div.innerHTML = string; + var cleanedString = div.innerText; + var useWordBoundary = wordBoundary; + string = cleanedString.trim(); + if (string.length <= n) { + return string; } - return doChange; + var subString = string.substr(0, n - 1); + if (!useWordBoundary) { + return subString; + } + div = null; + return subString + '... ' + wordBoundary + ''; } }, { - key: "shouldClose", - value: function shouldClose() { - var doClose = false; - var currentYInt = Math.abs(this.currentY); - if (currentYInt >= this.toleranceY) { - doClose = true; + key: "descriptionEvents", + value: function descriptionEvents(desc, data) { + var _this2 = this; + var moreLink = desc.querySelector('.desc-more'); + if (!moreLink) { + return false; } - return doClose; + addEvent('click', { + onElement: moreLink, + withCallback: function withCallback(event, target) { + event.preventDefault(); + var body = document.body; + var desc = closest(target, '.gslide-desc'); + if (!desc) { + return false; + } + desc.innerHTML = data.description; + addClass(body, 'gdesc-open'); + var shortEvent = addEvent('click', { + onElement: [body, closest(desc, '.gslide-description')], + withCallback: function withCallback(event, target) { + if (event.target.nodeName.toLowerCase() !== 'a') { + removeClass(body, 'gdesc-open'); + addClass(body, 'gdesc-closed'); + desc.innerHTML = data.smallDescription; + _this2.descriptionEvents(desc, data); + setTimeout(function () { + removeClass(body, 'gdesc-closed'); + }, 400); + shortEvent.destroy(); + } + } + }); + } + }); + } + }, { + key: "create", + value: function create() { + return createHTML(this.instance.settings.slideHTML); } }, { - key: "setTranslate", - value: function setTranslate(node, xPos, yPos) { - var animated = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - if (animated) { - node.style.transition = 'all .2s ease'; - } else { - node.style.transition = ''; + key: "getConfig", + value: function getConfig() { + if (!isNode(this.element) && !this.element.hasOwnProperty('draggable')) { + this.element.draggable = this.instance.settings.draggable; } - node.style.transform = "translate3d(".concat(xPos, "px, ").concat(yPos, "px, 0)"); + var parser = new SlideConfigParser(this.instance.settings.slideExtraAttributes); + this.slideConfig = parser.parseConfig(this.element, this.instance.settings); + return this.slideConfig; } }]); - return DragSlides; }(); - function slideImage(slide, data, index, callback) { - var slideMedia = slide.querySelector('.gslide-media'); - var img = new Image(); - var titleID = 'gSlideTitle_' + index; - var textID = 'gSlideDesc_' + index; - img.addEventListener('load', function () { - if (isFunction(callback)) { - callback(); - } - }, false); - img.src = data.href; - if (data.sizes != '' && data.srcset != '') { - img.sizes = data.sizes; - img.srcset = data.srcset; - } - img.alt = ''; - if (!isNil(data.alt) && data.alt !== '') { - img.alt = data.alt; - } - if (data.title !== '') { - img.setAttribute('aria-labelledby', titleID); - } - if (data.description !== '') { - img.setAttribute('aria-describedby', textID); - } - if (data.hasOwnProperty('_hasCustomWidth') && data._hasCustomWidth) { - img.style.width = data.width; - } - if (data.hasOwnProperty('_hasCustomHeight') && data._hasCustomHeight) { - img.style.height = data.height; - } - slideMedia.insertBefore(img, slideMedia.firstChild); - return; + function getLen(v) { + return Math.sqrt(v.x * v.x + v.y * v.y); } - - function slideVideo(slide, data, index, callback) { - var _this = this; - var slideContainer = slide.querySelector('.ginner-container'); - var videoID = 'gvideo' + index; - var slideMedia = slide.querySelector('.gslide-media'); - var videoPlayers = this.getAllPlayers(); - addClass(slideContainer, 'gvideo-container'); - slideMedia.insertBefore(createHTML('
'), slideMedia.firstChild); - var videoWrapper = slide.querySelector('.gvideo-wrapper'); - injectAssets(this.settings.plyr.css, 'Plyr'); - var url = data.href; - var provider = data === null || data === void 0 ? void 0 : data.videoProvider; - var customPlaceholder = false; - slideMedia.style.maxWidth = data.width; - injectAssets(this.settings.plyr.js, 'Plyr', function () { - if (!provider && url.match(/vimeo\.com\/([0-9]*)/)) { - provider = 'vimeo'; - } - if (!provider && (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/))) { - provider = 'youtube'; - } - if (provider === 'local' || !provider) { - provider = 'local'; - var html = ''; - customPlaceholder = createHTML(html); - } - var placeholder = customPlaceholder ? customPlaceholder : createHTML("
")); - addClass(videoWrapper, "".concat(provider, "-video gvideo")); - videoWrapper.appendChild(placeholder); - videoWrapper.setAttribute('data-id', videoID); - videoWrapper.setAttribute('data-index', index); - var playerConfig = has(_this.settings.plyr, 'config') ? _this.settings.plyr.config : {}; - var player = new Plyr('#' + videoID, playerConfig); - player.on('ready', function (event) { - videoPlayers[videoID] = event.detail.plyr; - if (isFunction(callback)) { - callback(); - } - }); - waitUntil(function () { - return slide.querySelector('iframe') && slide.querySelector('iframe').dataset.ready == 'true'; - }, function () { - _this.resize(slide); - }); - player.on('enterfullscreen', handleMediaFullScreen); - player.on('exitfullscreen', handleMediaFullScreen); - }); + function dot(v1, v2) { + return v1.x * v2.x + v1.y * v2.y; } - function handleMediaFullScreen(event) { - var media = closest(event.target, '.gslide-media'); - if (event.type === 'enterfullscreen') { - addClass(media, 'fullscreen'); + function getAngle(v1, v2) { + var mr = getLen(v1) * getLen(v2); + if (mr === 0) { + return 0; } - if (event.type === 'exitfullscreen') { - removeClass(media, 'fullscreen'); + var r = dot(v1, v2) / mr; + if (r > 1) { + r = 1; } + return Math.acos(r); } - - function slideInline(slide, data, index, callback) { - var _this = this; - var slideMedia = slide.querySelector('.gslide-media'); - var hash = has(data, 'href') && data.href ? data.href.split('#').pop().trim() : false; - var content = has(data, 'content') && data.content ? data.content : false; - var innerContent; - if (content) { - if (isString(content)) { - innerContent = createHTML("
".concat(content, "
")); - } - if (isNode(content)) { - if (content.style.display == 'none') { - content.style.display = 'block'; - } - var container = document.createElement('div'); - container.className = 'ginlined-content'; - container.appendChild(content); - innerContent = container; - } - } - if (hash) { - var div = document.getElementById(hash); - if (!div) { - return false; - } - var cloned = div.cloneNode(true); - cloned.style.height = data.height; - cloned.style.maxWidth = data.width; - addClass(cloned, 'ginlined-content'); - innerContent = cloned; - } - if (!innerContent) { - console.error('Unable to append inline slide content', data); - return false; - } - slideMedia.style.height = data.height; - slideMedia.style.width = data.width; - slideMedia.appendChild(innerContent); - this.events['inlineclose' + hash] = addEvent('click', { - onElement: slideMedia.querySelectorAll('.gtrigger-close'), - withCallback: function withCallback(e) { - e.preventDefault(); - _this.close(); - } - }); - if (isFunction(callback)) { - callback(); - } - return; + function cross(v1, v2) { + return v1.x * v2.y - v2.x * v1.y; } - - function slideIframe(slide, data, index, callback) { - var slideMedia = slide.querySelector('.gslide-media'); - var iframe = createIframe({ - url: data.href, - callback: callback - }); - slideMedia.parentNode.style.maxWidth = data.width; - slideMedia.parentNode.style.height = data.height; - slideMedia.appendChild(iframe); - return; + function getRotateAngle(v1, v2) { + var angle = getAngle(v1, v2); + if (cross(v1, v2) > 0) { + angle *= -1; + } + return angle * 180 / Math.PI; } - - var SlideConfigParser = function () { - function SlideConfigParser() { - var slideParamas = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - _classCallCheck(this, SlideConfigParser); - this.defaults = { - href: '', - sizes: '', - srcset: '', - title: '', - type: '', - videoProvider: '', - description: '', - alt: '', - descPosition: 'bottom', - effect: '', - width: '', - height: '', - content: false, - zoomable: true, - draggable: true - }; - if (isObject(slideParamas)) { - this.defaults = extend(this.defaults, slideParamas); - } + var EventsHandlerAdmin = function () { + function EventsHandlerAdmin(el) { + _classCallCheck(this, EventsHandlerAdmin); + this.handlers = []; + this.el = el; } - _createClass(SlideConfigParser, [{ - key: "sourceType", - value: function sourceType(url) { - var origin = url; - url = url.toLowerCase(); - if (url.match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/) !== null) { - return 'image'; - } - if (url.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/) || url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/) || url.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/)) { - return 'video'; - } - if (url.match(/vimeo\.com\/([0-9]*)/)) { - return 'video'; - } - if (url.match(/\.(mp4|ogg|webm|mov)/) !== null) { - return 'video'; - } - if (url.match(/\.(mp3|wav|wma|aac|ogg)/) !== null) { - return 'audio'; - } - if (url.indexOf('#') > -1) { - var hash = origin.split('#').pop(); - if (hash.trim() !== '') { - return 'inline'; - } + return _createClass(EventsHandlerAdmin, [{ + key: "add", + value: function add(handler) { + this.handlers.push(handler); + } + }, { + key: "del", + value: function del(handler) { + if (!handler) { + this.handlers = []; } - if (url.indexOf('goajax=true') > -1) { - return 'ajax'; + for (var i = this.handlers.length; i >= 0; i--) { + if (this.handlers[i] === handler) { + this.handlers.splice(i, 1); + } } - return 'external'; } }, { - key: "parseConfig", - value: function parseConfig(element, settings) { - var _this = this; - var data = extend({ - descPosition: settings.descPosition - }, this.defaults); - if (isObject(element) && !isNode(element)) { - if (!has(element, 'type')) { - if (has(element, 'content') && element.content) { - element.type = 'inline'; - } else if (has(element, 'href')) { - element.type = this.sourceType(element.href); - } + key: "dispatch", + value: function dispatch() { + for (var i = 0, len = this.handlers.length; i < len; i++) { + var handler = this.handlers[i]; + if (typeof handler === 'function') { + handler.apply(this.el, arguments); } - var objectData = extend(data, element); - this.setSize(objectData, settings); - return objectData; } - var url = ''; - var config = element.getAttribute('data-glightbox'); - var nodeType = element.nodeName.toLowerCase(); - if (nodeType === 'a') { - url = element.href; + } + }]); + }(); + function wrapFunc(el, handler) { + var EventshandlerAdmin = new EventsHandlerAdmin(el); + EventshandlerAdmin.add(handler); + return EventshandlerAdmin; + } + var TouchEvents = function () { + function TouchEvents(el, option) { + _classCallCheck(this, TouchEvents); + this.element = typeof el == 'string' ? document.querySelector(el) : el; + this.start = this.start.bind(this); + this.move = this.move.bind(this); + this.end = this.end.bind(this); + this.cancel = this.cancel.bind(this); + this.element.addEventListener('touchstart', this.start, false); + this.element.addEventListener('touchmove', this.move, false); + this.element.addEventListener('touchend', this.end, false); + this.element.addEventListener('touchcancel', this.cancel, false); + this.preV = { + x: null, + y: null + }; + this.pinchStartLen = null; + this.zoom = 1; + this.isDoubleTap = false; + var noop = function noop() {}; + this.rotate = wrapFunc(this.element, option.rotate || noop); + this.touchStart = wrapFunc(this.element, option.touchStart || noop); + this.multipointStart = wrapFunc(this.element, option.multipointStart || noop); + this.multipointEnd = wrapFunc(this.element, option.multipointEnd || noop); + this.pinch = wrapFunc(this.element, option.pinch || noop); + this.swipe = wrapFunc(this.element, option.swipe || noop); + this.tap = wrapFunc(this.element, option.tap || noop); + this.doubleTap = wrapFunc(this.element, option.doubleTap || noop); + this.longTap = wrapFunc(this.element, option.longTap || noop); + this.singleTap = wrapFunc(this.element, option.singleTap || noop); + this.pressMove = wrapFunc(this.element, option.pressMove || noop); + this.twoFingerPressMove = wrapFunc(this.element, option.twoFingerPressMove || noop); + this.touchMove = wrapFunc(this.element, option.touchMove || noop); + this.touchEnd = wrapFunc(this.element, option.touchEnd || noop); + this.touchCancel = wrapFunc(this.element, option.touchCancel || noop); + this.translateContainer = this.element; + this._cancelAllHandler = this.cancelAll.bind(this); + window.addEventListener('scroll', this._cancelAllHandler); + this.delta = null; + this.last = null; + this.now = null; + this.tapTimeout = null; + this.singleTapTimeout = null; + this.longTapTimeout = null; + this.swipeTimeout = null; + this.x1 = this.x2 = this.y1 = this.y2 = null; + this.preTapPosition = { + x: null, + y: null + }; + } + return _createClass(TouchEvents, [{ + key: "start", + value: function start(evt) { + if (!evt.touches) { + return; } - if (nodeType === 'img') { - url = element.src; - data.alt = element.alt; + var ignoreDragFor = ['a', 'button', 'input']; + if (evt.target && evt.target.nodeName && ignoreDragFor.indexOf(evt.target.nodeName.toLowerCase()) >= 0) { + console.log('ignore drag for this touched element', evt.target.nodeName.toLowerCase()); + return; } - data.href = url; - each(data, function (val, key) { - if (has(settings, key) && key !== 'width') { - data[key] = settings[key]; - } - var nodeData = element.dataset[key]; - if (!isNil(nodeData)) { - data[key] = _this.sanitizeValue(nodeData); + this.now = Date.now(); + this.x1 = evt.touches[0].pageX; + this.y1 = evt.touches[0].pageY; + this.delta = this.now - (this.last || this.now); + this.touchStart.dispatch(evt, this.element); + if (this.preTapPosition.x !== null) { + this.isDoubleTap = this.delta > 0 && this.delta <= 250 && Math.abs(this.preTapPosition.x - this.x1) < 30 && Math.abs(this.preTapPosition.y - this.y1) < 30; + if (this.isDoubleTap) { + clearTimeout(this.singleTapTimeout); } - }); - if (data.content) { - data.type = 'inline'; } - if (!data.type && url) { - data.type = this.sourceType(url); + this.preTapPosition.x = this.x1; + this.preTapPosition.y = this.y1; + this.last = this.now; + var preV = this.preV, + len = evt.touches.length; + if (len > 1) { + this._cancelLongTap(); + this._cancelSingleTap(); + var v = { + x: evt.touches[1].pageX - this.x1, + y: evt.touches[1].pageY - this.y1 + }; + preV.x = v.x; + preV.y = v.y; + this.pinchStartLen = getLen(preV); + this.multipointStart.dispatch(evt, this.element); } - if (!isNil(config)) { - var cleanKeys = []; - each(data, function (v, k) { - cleanKeys.push(';\\s?' + k); - }); - cleanKeys = cleanKeys.join('\\s?:|'); - if (config.trim() !== '') { - each(data, function (val, key) { - var str = config; - var match = 's?' + key + 's?:s?(.*?)(' + cleanKeys + 's?:|$)'; - var regex = new RegExp(match); - var matches = str.match(regex); - if (matches && matches.length && matches[1]) { - var value = matches[1].trim().replace(/;\s*$/, ''); - data[key] = _this.sanitizeValue(value); - } - }); - } - } else { - if (!data.title && nodeType == 'a') { - var title = element.title; - if (!isNil(title) && title !== '') { - data.title = title; + this._preventTap = false; + this.longTapTimeout = setTimeout(function () { + this.longTap.dispatch(evt, this.element); + this._preventTap = true; + }.bind(this), 750); + } + }, { + key: "move", + value: function move(evt) { + if (!evt.touches) { + return; + } + var preV = this.preV, + len = evt.touches.length, + currentX = evt.touches[0].pageX, + currentY = evt.touches[0].pageY; + this.isDoubleTap = false; + if (len > 1) { + var sCurrentX = evt.touches[1].pageX, + sCurrentY = evt.touches[1].pageY; + var v = { + x: evt.touches[1].pageX - currentX, + y: evt.touches[1].pageY - currentY + }; + if (preV.x !== null) { + if (this.pinchStartLen > 0) { + evt.zoom = getLen(v) / this.pinchStartLen; + this.pinch.dispatch(evt, this.element); } + evt.angle = getRotateAngle(v, preV); + this.rotate.dispatch(evt, this.element); } - if (!data.title && nodeType == 'img') { - var alt = element.alt; - if (!isNil(alt) && alt !== '') { - data.title = alt; - } + preV.x = v.x; + preV.y = v.y; + if (this.x2 !== null && this.sx2 !== null) { + evt.deltaX = (currentX - this.x2 + sCurrentX - this.sx2) / 2; + evt.deltaY = (currentY - this.y2 + sCurrentY - this.sy2) / 2; + } else { + evt.deltaX = 0; + evt.deltaY = 0; } - } - if (data.description && data.description.substring(0, 1) === '.') { - var description; - try { - description = document.querySelector(data.description).innerHTML; - } catch (error) { - if (!(error instanceof DOMException)) { - throw error; + this.twoFingerPressMove.dispatch(evt, this.element); + this.sx2 = sCurrentX; + this.sy2 = sCurrentY; + } else { + if (this.x2 !== null) { + evt.deltaX = currentX - this.x2; + evt.deltaY = currentY - this.y2; + var movedX = Math.abs(this.x1 - this.x2), + movedY = Math.abs(this.y1 - this.y2); + if (movedX > 10 || movedY > 10) { + this._preventTap = true; } + } else { + evt.deltaX = 0; + evt.deltaY = 0; } - if (description) { - data.description = description; - } + this.pressMove.dispatch(evt, this.element); + } + this.touchMove.dispatch(evt, this.element); + this._cancelLongTap(); + this.x2 = currentX; + this.y2 = currentY; + if (len > 1) { + evt.preventDefault(); + } + } + }, { + key: "end", + value: function end(evt) { + if (!evt.changedTouches) { + return; + } + this._cancelLongTap(); + var self = this; + if (evt.touches.length < 2) { + this.multipointEnd.dispatch(evt, this.element); + this.sx2 = this.sy2 = null; } - if (!data.description) { - var nodeDesc = element.querySelector('.glightbox-desc'); - if (nodeDesc) { - data.description = nodeDesc.innerHTML; + if (this.x2 && Math.abs(this.x1 - this.x2) > 30 || this.y2 && Math.abs(this.y1 - this.y2) > 30) { + evt.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2); + this.swipeTimeout = setTimeout(function () { + self.swipe.dispatch(evt, self.element); + }, 0); + } else { + this.tapTimeout = setTimeout(function () { + if (!self._preventTap) { + self.tap.dispatch(evt, self.element); + } + if (self.isDoubleTap) { + self.doubleTap.dispatch(evt, self.element); + self.isDoubleTap = false; + } + }, 0); + if (!self.isDoubleTap) { + self.singleTapTimeout = setTimeout(function () { + self.singleTap.dispatch(evt, self.element); + }, 250); } } - this.setSize(data, settings, element); - this.slideConfig = data; - return data; + this.touchEnd.dispatch(evt, this.element); + this.preV.x = 0; + this.preV.y = 0; + this.zoom = 1; + this.pinchStartLen = null; + this.x1 = this.x2 = this.y1 = this.y2 = null; } }, { - key: "setSize", - value: function setSize(data, settings) { - var element = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - var defaultWith = data.type == 'video' ? this.checkSize(settings.videosWidth) : this.checkSize(settings.width); - var defaultHeight = this.checkSize(settings.height); - data.width = has(data, 'width') && data.width !== '' ? this.checkSize(data.width) : defaultWith; - data.height = has(data, 'height') && data.height !== '' ? this.checkSize(data.height) : defaultHeight; - if (element && data.type == 'image') { - data._hasCustomWidth = element.dataset.width ? true : false; - data._hasCustomHeight = element.dataset.height ? true : false; + key: "cancelAll", + value: function cancelAll() { + this._preventTap = true; + clearTimeout(this.singleTapTimeout); + clearTimeout(this.tapTimeout); + clearTimeout(this.longTapTimeout); + clearTimeout(this.swipeTimeout); + } + }, { + key: "cancel", + value: function cancel(evt) { + this.cancelAll(); + this.touchCancel.dispatch(evt, this.element); + } + }, { + key: "_cancelLongTap", + value: function _cancelLongTap() { + clearTimeout(this.longTapTimeout); + } + }, { + key: "_cancelSingleTap", + value: function _cancelSingleTap() { + clearTimeout(this.singleTapTimeout); + } + }, { + key: "_swipeDirection", + value: function _swipeDirection(x1, x2, y1, y2) { + return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? x1 - x2 > 0 ? 'Left' : 'Right' : y1 - y2 > 0 ? 'Up' : 'Down'; + } + }, { + key: "on", + value: function on(evt, handler) { + if (this[evt]) { + this[evt].add(handler); } - return data; } }, { - key: "checkSize", - value: function checkSize(size) { - return isNumber(size) ? "".concat(size, "px") : size; + key: "off", + value: function off(evt, handler) { + if (this[evt]) { + this[evt].del(handler); + } } }, { - key: "sanitizeValue", - value: function sanitizeValue(val) { - if (val !== 'true' && val !== 'false') { - return val; + key: "destroy", + value: function destroy() { + if (this.singleTapTimeout) { + clearTimeout(this.singleTapTimeout); } - return val === 'true'; + if (this.tapTimeout) { + clearTimeout(this.tapTimeout); + } + if (this.longTapTimeout) { + clearTimeout(this.longTapTimeout); + } + if (this.swipeTimeout) { + clearTimeout(this.swipeTimeout); + } + this.element.removeEventListener('touchstart', this.start); + this.element.removeEventListener('touchmove', this.move); + this.element.removeEventListener('touchend', this.end); + this.element.removeEventListener('touchcancel', this.cancel); + this.rotate.del(); + this.touchStart.del(); + this.multipointStart.del(); + this.multipointEnd.del(); + this.pinch.del(); + this.swipe.del(); + this.tap.del(); + this.doubleTap.del(); + this.longTap.del(); + this.singleTap.del(); + this.pressMove.del(); + this.twoFingerPressMove.del(); + this.touchMove.del(); + this.touchEnd.del(); + this.touchCancel.del(); + this.preV = this.pinchStartLen = this.zoom = this.isDoubleTap = this.delta = this.last = this.now = this.tapTimeout = this.singleTapTimeout = this.longTapTimeout = this.swipeTimeout = this.x1 = this.x2 = this.y1 = this.y2 = this.preTapPosition = this.rotate = this.touchStart = this.multipointStart = this.multipointEnd = this.pinch = this.swipe = this.tap = this.doubleTap = this.longTap = this.singleTap = this.pressMove = this.touchMove = this.touchEnd = this.touchCancel = this.twoFingerPressMove = null; + window.removeEventListener('scroll', this._cancelAllHandler); + return null; } }]); - return SlideConfigParser; }(); - var Slide = function () { - function Slide(el, instance, index) { - _classCallCheck(this, Slide); - this.element = el; - this.instance = instance; - this.index = index; + function resetSlideMove(slide) { + var transitionEnd = whichTransitionEvent(); + var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + var media = hasClass(slide, 'gslide-media') ? slide : slide.querySelector('.gslide-media'); + var container = closest(media, '.ginner-container'); + var desc = slide.querySelector('.gslide-description'); + if (windowWidth > 769) { + media = container; } - _createClass(Slide, [{ - key: "setContent", - value: function setContent() { - var _this = this; - var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - if (hasClass(slide, 'loaded')) { - return false; + addClass(media, 'greset'); + cssTransform(media, 'translate3d(0, 0, 0)'); + addEvent(transitionEnd, { + onElement: media, + once: true, + withCallback: function withCallback(event, target) { + removeClass(media, 'greset'); + } + }); + media.style.opacity = ''; + if (desc) { + desc.style.opacity = ''; + } + } + function touchNavigation(instance) { + if (instance.events.hasOwnProperty('touch')) { + return false; + } + var winSize = windowSize(); + var winWidth = winSize.width; + var winHeight = winSize.height; + var process = false; + var currentSlide = null; + var media = null; + var mediaImage = null; + var doingMove = false; + var initScale = 1; + var maxScale = 4.5; + var currentScale = 1; + var doingZoom = false; + var imageZoomed = false; + var zoomedPosX = null; + var zoomedPosY = null; + var lastZoomedPosX = null; + var lastZoomedPosY = null; + var hDistance; + var vDistance; + var hDistancePercent = 0; + var vDistancePercent = 0; + var vSwipe = false; + var hSwipe = false; + var startCoords = {}; + var endCoords = {}; + var xDown = 0; + var yDown = 0; + var isInlined; + var sliderWrapper = document.getElementById('glightbox-slider'); + var overlay = document.querySelector('.goverlay'); + var touchInstance = new TouchEvents(sliderWrapper, { + touchStart: function touchStart(e) { + process = true; + if (hasClass(e.targetTouches[0].target, 'ginner-container') || closest(e.targetTouches[0].target, '.gslide-desc') || e.targetTouches[0].target.nodeName.toLowerCase() == 'a') { + process = false; } - var settings = this.instance.settings; - var slideConfig = this.slideConfig; - var isMobileDevice = isMobile(); - if (isFunction(settings.beforeSlideLoad)) { - settings.beforeSlideLoad({ - index: this.index, - slide: slide, - player: false - }); + if (closest(e.targetTouches[0].target, '.gslide-inline') && !hasClass(e.targetTouches[0].target.parentNode, 'gslide-inline')) { + process = false; } - var type = slideConfig.type; - var position = slideConfig.descPosition; - var slideMedia = slide.querySelector('.gslide-media'); - var slideTitle = slide.querySelector('.gslide-title'); - var slideText = slide.querySelector('.gslide-desc'); - var slideDesc = slide.querySelector('.gdesc-inner'); - var finalCallback = callback; - var titleID = 'gSlideTitle_' + this.index; - var textID = 'gSlideDesc_' + this.index; - if (isFunction(settings.afterSlideLoad)) { - finalCallback = function finalCallback() { - if (isFunction(callback)) { - callback(); - } - settings.afterSlideLoad({ - index: _this.index, - slide: slide, - player: _this.instance.getSlidePlayerInstance(_this.index) - }); - }; + if (process) { + endCoords = e.targetTouches[0]; + startCoords.pageX = e.targetTouches[0].pageX; + startCoords.pageY = e.targetTouches[0].pageY; + xDown = e.targetTouches[0].clientX; + yDown = e.targetTouches[0].clientY; + currentSlide = instance.activeSlide; + media = currentSlide.querySelector('.gslide-media'); + isInlined = currentSlide.querySelector('.gslide-inline'); + mediaImage = null; + if (hasClass(media, 'gslide-image')) { + mediaImage = media.querySelector('img'); + } + var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + if (windowWidth > 769) { + media = currentSlide.querySelector('.ginner-container'); + } + removeClass(overlay, 'greset'); + if (e.pageX > 20 && e.pageX < window.innerWidth - 20) { + return; + } + e.preventDefault(); + } + }, + touchMove: function touchMove(e) { + if (!process) { + return; } - if (slideConfig.title == '' && slideConfig.description == '') { - if (slideDesc) { - slideDesc.parentNode.parentNode.removeChild(slideDesc.parentNode); + endCoords = e.targetTouches[0]; + if (doingZoom || imageZoomed) { + return; + } + if (isInlined && isInlined.offsetHeight > winHeight) { + var moved = startCoords.pageX - endCoords.pageX; + if (Math.abs(moved) <= 13) { + return false; } + } + doingMove = true; + var xUp = e.targetTouches[0].clientX; + var yUp = e.targetTouches[0].clientY; + var xDiff = xDown - xUp; + var yDiff = yDown - yUp; + if (Math.abs(xDiff) > Math.abs(yDiff)) { + vSwipe = false; + hSwipe = true; } else { - if (slideTitle && slideConfig.title !== '') { - slideTitle.id = titleID; - slideTitle.innerHTML = slideConfig.title; - } else { - slideTitle.parentNode.removeChild(slideTitle); + hSwipe = false; + vSwipe = true; + } + hDistance = endCoords.pageX - startCoords.pageX; + hDistancePercent = hDistance * 100 / winWidth; + vDistance = endCoords.pageY - startCoords.pageY; + vDistancePercent = vDistance * 100 / winHeight; + var opacity; + if (vSwipe && mediaImage) { + opacity = 1 - Math.abs(vDistance) / winHeight; + overlay.style.opacity = opacity; + if (instance.settings.touchFollowAxis) { + hDistancePercent = 0; } - if (slideText && slideConfig.description !== '') { - slideText.id = textID; - if (isMobileDevice && settings.moreLength > 0) { - slideConfig.smallDescription = this.slideShortDesc(slideConfig.description, settings.moreLength, settings.moreText); - slideText.innerHTML = slideConfig.smallDescription; - this.descriptionEvents(slideText, slideConfig); - } else { - slideText.innerHTML = slideConfig.description; - } - } else { - slideText.parentNode.removeChild(slideText); + } + if (hSwipe) { + opacity = 1 - Math.abs(hDistance) / winWidth; + media.style.opacity = opacity; + if (instance.settings.touchFollowAxis) { + vDistancePercent = 0; } - addClass(slideMedia.parentNode, "desc-".concat(position)); - addClass(slideDesc.parentNode, "description-".concat(position)); } - addClass(slideMedia, "gslide-".concat(type)); - addClass(slide, 'loaded'); - if (type === 'video') { - slideVideo.apply(this.instance, [slide, slideConfig, this.index, finalCallback]); + if (!mediaImage) { + return cssTransform(media, "translate3d(".concat(hDistancePercent, "%, 0, 0)")); + } + cssTransform(media, "translate3d(".concat(hDistancePercent, "%, ").concat(vDistancePercent, "%, 0)")); + }, + touchEnd: function touchEnd() { + if (!process) { return; } - if (type === 'external') { - slideIframe.apply(this, [slide, slideConfig, this.index, finalCallback]); + doingMove = false; + if (imageZoomed || doingZoom) { + lastZoomedPosX = zoomedPosX; + lastZoomedPosY = zoomedPosY; return; } - if (type === 'inline') { - slideInline.apply(this.instance, [slide, slideConfig, this.index, finalCallback]); - if (slideConfig.draggable) { - new DragSlides({ - dragEl: slide.querySelector('.gslide-inline'), - toleranceX: settings.dragToleranceX, - toleranceY: settings.dragToleranceY, - slide: slide, - instance: this.instance - }); - } + var v = Math.abs(parseInt(vDistancePercent)); + var h = Math.abs(parseInt(hDistancePercent)); + if (v > 29 && mediaImage) { + instance.close(); return; } - if (type === 'image') { - slideImage(slide, slideConfig, this.index, function () { - var img = slide.querySelector('img'); - if (slideConfig.draggable) { - new DragSlides({ - dragEl: img, - toleranceX: settings.dragToleranceX, - toleranceY: settings.dragToleranceY, - slide: slide, - instance: _this.instance - }); - } - if (slideConfig.zoomable && img.naturalWidth > img.offsetWidth) { - addClass(img, 'zoomable'); - new ZoomImages(img, slide, function () { - _this.instance.resize(); - }); - } - if (isFunction(finalCallback)) { - finalCallback(); - } - }); + if (v < 29 && h < 25) { + addClass(overlay, 'greset'); + overlay.style.opacity = 1; + return resetSlideMove(media); + } + }, + multipointEnd: function multipointEnd() { + setTimeout(function () { + doingZoom = false; + }, 50); + }, + multipointStart: function multipointStart() { + doingZoom = true; + initScale = currentScale ? currentScale : 1; + }, + pinch: function pinch(evt) { + if (!mediaImage || doingMove) { + return false; + } + doingZoom = true; + mediaImage.scaleX = mediaImage.scaleY = initScale * evt.zoom; + var scale = initScale * evt.zoom; + imageZoomed = true; + if (scale <= 1) { + imageZoomed = false; + scale = 1; + lastZoomedPosY = null; + lastZoomedPosX = null; + zoomedPosX = null; + zoomedPosY = null; + mediaImage.setAttribute('style', ''); return; } - if (isFunction(finalCallback)) { - finalCallback(); + if (scale > maxScale) { + scale = maxScale; } - } - }, { - key: "slideShortDesc", - value: function slideShortDesc(string) { - var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50; - var wordBoundary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var div = document.createElement('div'); - div.innerHTML = string; - var cleanedString = div.innerText; - var useWordBoundary = wordBoundary; - string = cleanedString.trim(); - if (string.length <= n) { - return string; + mediaImage.style.transform = "scale3d(".concat(scale, ", ").concat(scale, ", 1)"); + currentScale = scale; + }, + pressMove: function pressMove(e) { + if (imageZoomed && !doingZoom) { + var mhDistance = endCoords.pageX - startCoords.pageX; + var mvDistance = endCoords.pageY - startCoords.pageY; + if (lastZoomedPosX) { + mhDistance = mhDistance + lastZoomedPosX; + } + if (lastZoomedPosY) { + mvDistance = mvDistance + lastZoomedPosY; + } + zoomedPosX = mhDistance; + zoomedPosY = mvDistance; + var style = "translate3d(".concat(mhDistance, "px, ").concat(mvDistance, "px, 0)"); + if (currentScale) { + style += " scale3d(".concat(currentScale, ", ").concat(currentScale, ", 1)"); + } + cssTransform(mediaImage, style); } - var subString = string.substr(0, n - 1); - if (!useWordBoundary) { - return subString; + }, + swipe: function swipe(evt) { + if (imageZoomed) { + return; } - div = null; - return subString + '... ' + wordBoundary + ''; - } - }, { - key: "descriptionEvents", - value: function descriptionEvents(desc, data) { - var _this2 = this; - var moreLink = desc.querySelector('.desc-more'); - if (!moreLink) { - return false; + if (doingZoom) { + doingZoom = false; + return; } - addEvent('click', { - onElement: moreLink, - withCallback: function withCallback(event, target) { - event.preventDefault(); - var body = document.body; - var desc = closest(target, '.gslide-desc'); - if (!desc) { - return false; - } - desc.innerHTML = data.description; - addClass(body, 'gdesc-open'); - var shortEvent = addEvent('click', { - onElement: [body, closest(desc, '.gslide-description')], - withCallback: function withCallback(event, target) { - if (event.target.nodeName.toLowerCase() !== 'a') { - removeClass(body, 'gdesc-open'); - addClass(body, 'gdesc-closed'); - desc.innerHTML = data.smallDescription; - _this2.descriptionEvents(desc, data); - setTimeout(function () { - removeClass(body, 'gdesc-closed'); - }, 400); - shortEvent.destroy(); - } - } - }); + if (evt.direction == 'Left') { + if (instance.index == instance.elements.length - 1) { + return resetSlideMove(media); } - }); - } - }, { - key: "create", - value: function create() { - return createHTML(this.instance.settings.slideHTML); - } - }, { - key: "getConfig", - value: function getConfig() { - if (!isNode(this.element) && !this.element.hasOwnProperty('draggable')) { - this.element.draggable = this.instance.settings.draggable; + instance.nextSlide(); + } + if (evt.direction == 'Right') { + if (instance.index == 0) { + return resetSlideMove(media); + } + instance.prevSlide(); } - var parser = new SlideConfigParser(this.instance.settings.slideExtraAttributes); - this.slideConfig = parser.parseConfig(this.element, this.instance.settings); - return this.slideConfig; } - }]); - return Slide; - }(); + }); + instance.events['touch'] = touchInstance; + } - var _version = '3.2.0'; + var _version = '3.3.0'; var isMobile$1 = isMobile(); var isTouch$1 = isTouch(); var html = document.getElementsByTagName('html')[0]; @@ -2151,7 +2145,7 @@ this.apiEvents = []; this.fullElementsList = false; } - _createClass(GlightboxInit, [{ + return _createClass(GlightboxInit, [{ key: "init", value: function init() { var _this = this; @@ -3084,7 +3078,6 @@ return _version; } }]); - return GlightboxInit; }(); function glightbox () { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; diff --git a/dist/js/glightbox.min.js b/dist/js/glightbox.min.js index 1d95bec..5c54b29 100644 --- a/dist/js/glightbox.min.js +++ b/dist/js/glightbox.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).GLightbox=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=e[s]=e[s]||[],l={all:n,evt:null,found:null};return t&&i&&P(n)>0&&o(n,(function(e,n){if(e.eventName==t&&e.fn.toString()==i.toString())return l.found=!0,l.evt=n,!1})),l}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.onElement,n=t.withCallback,s=t.avoidDuplicate,l=void 0===s||s,a=t.once,h=void 0!==a&&a,d=t.useCapture,c=void 0!==d&&d,u=arguments.length>2?arguments[2]:void 0,g=i||[];function v(e){T(n)&&n.call(u,e,this),h&&v.destroy()}return C(g)&&(g=document.querySelectorAll(g)),v.destroy=function(){o(g,(function(t){var i=r(t,e,v);i.found&&i.all.splice(i.evt,1),t.removeEventListener&&t.removeEventListener(e,v,c)}))},o(g,(function(t){var i=r(t,e,v);(t.addEventListener&&l&&!i.found||!l)&&(t.addEventListener(e,v,c),i.all.push({eventName:e,fn:v}))})),v}function h(e,t){o(t.split(" "),(function(t){return e.classList.add(t)}))}function d(e,t){o(t.split(" "),(function(t){return e.classList.remove(t)}))}function c(e,t){return e.classList.contains(t)}function u(e,t){for(;e!==document.body;){if(!(e=e.parentElement))return!1;if("function"==typeof e.matches?e.matches(t):e.msMatchesSelector(t))return e}}function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||""===t)return!1;if("none"===t)return T(i)&&i(),!1;var n=x(),s=t.split(" ");o(s,(function(t){h(e,"g"+t)})),a(n,{onElement:e,avoidDuplicate:!1,once:!0,withCallback:function(e,t){o(s,(function(e){d(t,"g"+e)})),T(i)&&i()}})}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(""===t)return e.style.webkitTransform="",e.style.MozTransform="",e.style.msTransform="",e.style.OTransform="",e.style.transform="",!1;e.style.webkitTransform=t,e.style.MozTransform=t,e.style.msTransform=t,e.style.OTransform=t,e.style.transform=t}function f(e){e.style.display="block"}function p(e){e.style.display="none"}function m(e){var t=document.createDocumentFragment(),i=document.createElement("div");for(i.innerHTML=e;i.firstChild;)t.appendChild(i.firstChild);return t}function y(){return{width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}}function x(){var e,t=document.createElement("fakeelement"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}function b(e,t,i,n){if(e())t();else{var s;i||(i=100);var l=setInterval((function(){e()&&(clearInterval(l),s&&clearTimeout(s),t())}),i);n&&(s=setTimeout((function(){clearInterval(l)}),n))}}function S(e,t,i){if(I(e))console.error("Inject assets error");else if(T(t)&&(i=t,t=!1),C(t)&&t in window)T(i)&&i();else{var n;if(-1!==e.indexOf(".css")){if((n=document.querySelectorAll('link[href="'+e+'"]'))&&n.length>0)return void(T(i)&&i());var s=document.getElementsByTagName("head")[0],l=s.querySelectorAll('link[rel="stylesheet"]'),o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",o.href=e,o.media="all",l?s.insertBefore(o,l[0]):s.appendChild(o),void(T(i)&&i())}if((n=document.querySelectorAll('script[src="'+e+'"]'))&&n.length>0){if(T(i)){if(C(t))return b((function(){return void 0!==window[t]}),(function(){i()})),!1;i()}}else{var r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=function(){if(T(i)){if(C(t))return b((function(){return void 0!==window[t]}),(function(){i()})),!1;i()}},document.body.appendChild(r)}}}function w(){return"navigator"in window&&window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i)}function T(e){return"function"==typeof e}function C(e){return"string"==typeof e}function k(e){return!(!e||!e.nodeType||1!=e.nodeType)}function E(e){return Array.isArray(e)}function A(e){return e&&e.length&&isFinite(e.length)}function L(t){return"object"===e(t)&&null!=t&&!T(t)&&!E(t)}function I(e){return null==e}function O(e,t){return null!==e&&hasOwnProperty.call(e,t)}function P(e){if(L(e)){if(e.keys)return e.keys().length;var t=0;for(var i in e)O(e,i)&&t++;return t}return e.length}function M(e){return!isNaN(parseFloat(e))&&isFinite(e)}function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=document.querySelectorAll(".gbtn[data-taborder]:not(.disabled)");if(!t.length)return!1;if(1==t.length)return t[0];"string"==typeof e&&(e=parseInt(e));var i=[];o(t,(function(e){i.push(e.getAttribute("data-taborder"))}));var n=Math.max.apply(Math,i.map((function(e){return parseInt(e)}))),s=e<0?1:e+1;s>n&&(s="1");var l=i.filter((function(e){return e>=parseInt(s)})),r=l.sort()[0];return document.querySelector('.gbtn[data-taborder="'.concat(r,'"]'))}function X(e){if(e.events.hasOwnProperty("keyboard"))return!1;e.events.keyboard=a("keydown",{onElement:window,withCallback:function(t,i){var n=(t=t||window.event).keyCode;if(9==n){var s=document.querySelector(".gbtn.focused");if(!s){var l=!(!document.activeElement||!document.activeElement.nodeName)&&document.activeElement.nodeName.toLocaleLowerCase();if("input"==l||"textarea"==l||"button"==l)return}t.preventDefault();var o=document.querySelectorAll(".gbtn[data-taborder]");if(!o||o.length<=0)return;if(!s){var r=z();return void(r&&(r.focus(),h(r,"focused")))}var a=z(s.getAttribute("data-taborder"));d(s,"focused"),a&&(a.focus(),h(a,"focused"))}39==n&&e.nextSlide(),37==n&&e.prevSlide(),27==n&&e.close()}})}function Y(e){return Math.sqrt(e.x*e.x+e.y*e.y)}function q(e,t){var i=function(e,t){var i=Y(e)*Y(t);if(0===i)return 0;var n=function(e,t){return e.x*t.x+e.y*t.y}(e,t)/i;return n>1&&(n=1),Math.acos(n)}(e,t);return function(e,t){return e.x*t.y-t.x*e.y}(e,t)>0&&(i*=-1),180*i/Math.PI}var N=function(){function e(i){t(this,e),this.handlers=[],this.el=i}return n(e,[{key:"add",value:function(e){this.handlers.push(e)}},{key:"del",value:function(e){e||(this.handlers=[]);for(var t=this.handlers.length;t>=0;t--)this.handlers[t]===e&&this.handlers.splice(t,1)}},{key:"dispatch",value:function(){for(var e=0,t=this.handlers.length;e=0)console.log("ignore drag for this touched element",e.target.nodeName.toLowerCase());else{this.now=Date.now(),this.x1=e.touches[0].pageX,this.y1=e.touches[0].pageY,this.delta=this.now-(this.last||this.now),this.touchStart.dispatch(e,this.element),null!==this.preTapPosition.x&&(this.isDoubleTap=this.delta>0&&this.delta<=250&&Math.abs(this.preTapPosition.x-this.x1)<30&&Math.abs(this.preTapPosition.y-this.y1)<30,this.isDoubleTap&&clearTimeout(this.singleTapTimeout)),this.preTapPosition.x=this.x1,this.preTapPosition.y=this.y1,this.last=this.now;var t=this.preV;if(e.touches.length>1){this._cancelLongTap(),this._cancelSingleTap();var i={x:e.touches[1].pageX-this.x1,y:e.touches[1].pageY-this.y1};t.x=i.x,t.y=i.y,this.pinchStartLen=Y(t),this.multipointStart.dispatch(e,this.element)}this._preventTap=!1,this.longTapTimeout=setTimeout(function(){this.longTap.dispatch(e,this.element),this._preventTap=!0}.bind(this),750)}}}},{key:"move",value:function(e){if(e.touches){var t=this.preV,i=e.touches.length,n=e.touches[0].pageX,s=e.touches[0].pageY;if(this.isDoubleTap=!1,i>1){var l=e.touches[1].pageX,o=e.touches[1].pageY,r={x:e.touches[1].pageX-n,y:e.touches[1].pageY-s};null!==t.x&&(this.pinchStartLen>0&&(e.zoom=Y(r)/this.pinchStartLen,this.pinch.dispatch(e,this.element)),e.angle=q(r,t),this.rotate.dispatch(e,this.element)),t.x=r.x,t.y=r.y,null!==this.x2&&null!==this.sx2?(e.deltaX=(n-this.x2+l-this.sx2)/2,e.deltaY=(s-this.y2+o-this.sy2)/2):(e.deltaX=0,e.deltaY=0),this.twoFingerPressMove.dispatch(e,this.element),this.sx2=l,this.sy2=o}else{if(null!==this.x2){e.deltaX=n-this.x2,e.deltaY=s-this.y2;var a=Math.abs(this.x1-this.x2),h=Math.abs(this.y1-this.y2);(a>10||h>10)&&(this._preventTap=!0)}else e.deltaX=0,e.deltaY=0;this.pressMove.dispatch(e,this.element)}this.touchMove.dispatch(e,this.element),this._cancelLongTap(),this.x2=n,this.y2=s,i>1&&e.preventDefault()}}},{key:"end",value:function(e){if(e.changedTouches){this._cancelLongTap();var t=this;e.touches.length<2&&(this.multipointEnd.dispatch(e,this.element),this.sx2=this.sy2=null),this.x2&&Math.abs(this.x1-this.x2)>30||this.y2&&Math.abs(this.y1-this.y2)>30?(e.direction=this._swipeDirection(this.x1,this.x2,this.y1,this.y2),this.swipeTimeout=setTimeout((function(){t.swipe.dispatch(e,t.element)}),0)):(this.tapTimeout=setTimeout((function(){t._preventTap||t.tap.dispatch(e,t.element),t.isDoubleTap&&(t.doubleTap.dispatch(e,t.element),t.isDoubleTap=!1)}),0),t.isDoubleTap||(t.singleTapTimeout=setTimeout((function(){t.singleTap.dispatch(e,t.element)}),250))),this.touchEnd.dispatch(e,this.element),this.preV.x=0,this.preV.y=0,this.zoom=1,this.pinchStartLen=null,this.x1=this.x2=this.y1=this.y2=null}}},{key:"cancelAll",value:function(){this._preventTap=!0,clearTimeout(this.singleTapTimeout),clearTimeout(this.tapTimeout),clearTimeout(this.longTapTimeout),clearTimeout(this.swipeTimeout)}},{key:"cancel",value:function(e){this.cancelAll(),this.touchCancel.dispatch(e,this.element)}},{key:"_cancelLongTap",value:function(){clearTimeout(this.longTapTimeout)}},{key:"_cancelSingleTap",value:function(){clearTimeout(this.singleTapTimeout)}},{key:"_swipeDirection",value:function(e,t,i,n){return Math.abs(e-t)>=Math.abs(i-n)?e-t>0?"Left":"Right":i-n>0?"Up":"Down"}},{key:"on",value:function(e,t){this[e]&&this[e].add(t)}},{key:"off",value:function(e,t){this[e]&&this[e].del(t)}},{key:"destroy",value:function(){return this.singleTapTimeout&&clearTimeout(this.singleTapTimeout),this.tapTimeout&&clearTimeout(this.tapTimeout),this.longTapTimeout&&clearTimeout(this.longTapTimeout),this.swipeTimeout&&clearTimeout(this.swipeTimeout),this.element.removeEventListener("touchstart",this.start),this.element.removeEventListener("touchmove",this.move),this.element.removeEventListener("touchend",this.end),this.element.removeEventListener("touchcancel",this.cancel),this.rotate.del(),this.touchStart.del(),this.multipointStart.del(),this.multipointEnd.del(),this.pinch.del(),this.swipe.del(),this.tap.del(),this.doubleTap.del(),this.longTap.del(),this.singleTap.del(),this.pressMove.del(),this.twoFingerPressMove.del(),this.touchMove.del(),this.touchEnd.del(),this.touchCancel.del(),this.preV=this.pinchStartLen=this.zoom=this.isDoubleTap=this.delta=this.last=this.now=this.tapTimeout=this.singleTapTimeout=this.longTapTimeout=this.swipeTimeout=this.x1=this.x2=this.y1=this.y2=this.preTapPosition=this.rotate=this.touchStart=this.multipointStart=this.multipointEnd=this.pinch=this.swipe=this.tap=this.doubleTap=this.longTap=this.singleTap=this.pressMove=this.touchMove=this.touchEnd=this.touchCancel=this.twoFingerPressMove=null,window.removeEventListener("scroll",this._cancelAllHandler),null}}]),e}();function W(e){var t=function(){var e,t=document.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}(),i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=c(e,"gslide-media")?e:e.querySelector(".gslide-media"),s=u(n,".ginner-container"),l=e.querySelector(".gslide-description");i>769&&(n=s),h(n,"greset"),v(n,"translate3d(0, 0, 0)"),a(t,{onElement:n,once:!0,withCallback:function(e,t){d(n,"greset")}}),n.style.opacity="",l&&(l.style.opacity="")}function B(e){if(e.events.hasOwnProperty("touch"))return!1;var t,i,n,s=y(),l=s.width,o=s.height,r=!1,a=null,g=null,f=null,p=!1,m=1,x=1,b=!1,S=!1,w=null,T=null,C=null,k=null,E=0,A=0,L=!1,I=!1,O={},P={},M=0,z=0,X=document.getElementById("glightbox-slider"),Y=document.querySelector(".goverlay"),q=new _(X,{touchStart:function(t){if(r=!0,(c(t.targetTouches[0].target,"ginner-container")||u(t.targetTouches[0].target,".gslide-desc")||"a"==t.targetTouches[0].target.nodeName.toLowerCase())&&(r=!1),u(t.targetTouches[0].target,".gslide-inline")&&!c(t.targetTouches[0].target.parentNode,"gslide-inline")&&(r=!1),r){if(P=t.targetTouches[0],O.pageX=t.targetTouches[0].pageX,O.pageY=t.targetTouches[0].pageY,M=t.targetTouches[0].clientX,z=t.targetTouches[0].clientY,a=e.activeSlide,g=a.querySelector(".gslide-media"),n=a.querySelector(".gslide-inline"),f=null,c(g,"gslide-image")&&(f=g.querySelector("img")),(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)>769&&(g=a.querySelector(".ginner-container")),d(Y,"greset"),t.pageX>20&&t.pageXo){var a=O.pageX-P.pageX;if(Math.abs(a)<=13)return!1}p=!0;var h,d=s.targetTouches[0].clientX,c=s.targetTouches[0].clientY,u=M-d,m=z-c;if(Math.abs(u)>Math.abs(m)?(L=!1,I=!0):(I=!1,L=!0),t=P.pageX-O.pageX,E=100*t/l,i=P.pageY-O.pageY,A=100*i/o,L&&f&&(h=1-Math.abs(i)/o,Y.style.opacity=h,e.settings.touchFollowAxis&&(E=0)),I&&(h=1-Math.abs(t)/l,g.style.opacity=h,e.settings.touchFollowAxis&&(A=0)),!f)return v(g,"translate3d(".concat(E,"%, 0, 0)"));v(g,"translate3d(".concat(E,"%, ").concat(A,"%, 0)"))}},touchEnd:function(){if(r){if(p=!1,S||b)return C=w,void(k=T);var t=Math.abs(parseInt(A)),i=Math.abs(parseInt(E));if(!(t>29&&f))return t<29&&i<25?(h(Y,"greset"),Y.style.opacity=1,W(g)):void 0;e.close()}},multipointEnd:function(){setTimeout((function(){b=!1}),50)},multipointStart:function(){b=!0,m=x||1},pinch:function(e){if(!f||p)return!1;b=!0,f.scaleX=f.scaleY=m*e.zoom;var t=m*e.zoom;if(S=!0,t<=1)return S=!1,t=1,k=null,C=null,w=null,T=null,void f.setAttribute("style","");t>4.5&&(t=4.5),f.style.transform="scale3d(".concat(t,", ").concat(t,", 1)"),x=t},pressMove:function(e){if(S&&!b){var t=P.pageX-O.pageX,i=P.pageY-O.pageY;C&&(t+=C),k&&(i+=k),w=t,T=i;var n="translate3d(".concat(t,"px, ").concat(i,"px, 0)");x&&(n+=" scale3d(".concat(x,", ").concat(x,", 1)")),v(f,n)}},swipe:function(t){if(!S)if(b)b=!1;else{if("Left"==t.direction){if(e.index==e.elements.length-1)return W(g);e.nextSlide()}if("Right"==t.direction){if(0==e.index)return W(g);e.prevSlide()}}}});e.events.touch=q}var H=function(){function e(i,n){var s=this,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(t(this,e),this.img=i,this.slide=n,this.onclose=l,this.img.setZoomEvents)return!1;this.active=!1,this.zoomedIn=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.img.addEventListener("mousedown",(function(e){return s.dragStart(e)}),!1),this.img.addEventListener("mouseup",(function(e){return s.dragEnd(e)}),!1),this.img.addEventListener("mousemove",(function(e){return s.drag(e)}),!1),this.img.addEventListener("click",(function(e){return s.slide.classList.contains("dragging-nav")?(s.zoomOut(),!1):s.zoomedIn?void(s.zoomedIn&&!s.dragging&&s.zoomOut()):s.zoomIn()}),!1),this.img.setZoomEvents=!0}return n(e,[{key:"zoomIn",value:function(){var e=this.widowWidth();if(!(this.zoomedIn||e<=768)){var t=this.img;if(t.setAttribute("data-style",t.getAttribute("style")),t.style.maxWidth=t.naturalWidth+"px",t.style.maxHeight=t.naturalHeight+"px",t.naturalWidth>e){var i=e/2-t.naturalWidth/2;this.setTranslate(this.img.parentNode,i,0)}this.slide.classList.add("zoomed"),this.zoomedIn=!0}}},{key:"zoomOut",value:function(){this.img.parentNode.setAttribute("style",""),this.img.setAttribute("style",this.img.getAttribute("data-style")),this.slide.classList.remove("zoomed"),this.zoomedIn=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.onclose&&"function"==typeof this.onclose&&this.onclose()}},{key:"dragStart",value:function(e){e.preventDefault(),this.zoomedIn?("touchstart"===e.type?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset),e.target===this.img&&(this.active=!0,this.img.classList.add("dragging"))):this.active=!1}},{key:"dragEnd",value:function(e){var t=this;e.preventDefault(),this.initialX=this.currentX,this.initialY=this.currentY,this.active=!1,setTimeout((function(){t.dragging=!1,t.img.isDragging=!1,t.img.classList.remove("dragging")}),100)}},{key:"drag",value:function(e){this.active&&(e.preventDefault(),"touchmove"===e.type?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.img.isDragging=!0,this.dragging=!0,this.setTranslate(this.img,this.currentX,this.currentY))}},{key:"onMove",value:function(e){if(this.zoomedIn){var t=e.clientX-this.img.naturalWidth/2,i=e.clientY-this.img.naturalHeight/2;this.setTranslate(this.img,t,i)}}},{key:"setTranslate",value:function(e,t,i){e.style.transform="translate3d("+t+"px, "+i+"px, 0)"}},{key:"widowWidth",value:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}}]),e}(),j=function(){function e(){var i=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e);var s=n.dragEl,l=n.toleranceX,o=void 0===l?40:l,r=n.toleranceY,a=void 0===r?65:r,h=n.slide,d=void 0===h?null:h,c=n.instance,u=void 0===c?null:c;this.el=s,this.active=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.direction=null,this.lastDirection=null,this.toleranceX=o,this.toleranceY=a,this.toleranceReached=!1,this.dragContainer=this.el,this.slide=d,this.instance=u,this.el.addEventListener("mousedown",(function(e){return i.dragStart(e)}),!1),this.el.addEventListener("mouseup",(function(e){return i.dragEnd(e)}),!1),this.el.addEventListener("mousemove",(function(e){return i.drag(e)}),!1)}return n(e,[{key:"dragStart",value:function(e){if(this.slide.classList.contains("zoomed"))this.active=!1;else{"touchstart"===e.type?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset);var t=e.target.nodeName.toLowerCase();e.target.classList.contains("nodrag")||u(e.target,".nodrag")||-1!==["input","select","textarea","button","a"].indexOf(t)?this.active=!1:(e.preventDefault(),(e.target===this.el||"img"!==t&&u(e.target,".gslide-inline"))&&(this.active=!0,this.el.classList.add("dragging"),this.dragContainer=u(e.target,".ginner-container")))}}},{key:"dragEnd",value:function(e){var t=this;e&&e.preventDefault(),this.initialX=0,this.initialY=0,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.active=!1,this.doSlideChange&&(this.instance.preventOutsideClick=!0,"right"==this.doSlideChange&&this.instance.prevSlide(),"left"==this.doSlideChange&&this.instance.nextSlide()),this.doSlideClose&&this.instance.close(),this.toleranceReached||this.setTranslate(this.dragContainer,0,0,!0),setTimeout((function(){t.instance.preventOutsideClick=!1,t.toleranceReached=!1,t.lastDirection=null,t.dragging=!1,t.el.isDragging=!1,t.el.classList.remove("dragging"),t.slide.classList.remove("dragging-nav"),t.dragContainer.style.transform="",t.dragContainer.style.transition=""}),100)}},{key:"drag",value:function(e){if(this.active){e.preventDefault(),this.slide.classList.add("dragging-nav"),"touchmove"===e.type?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.el.isDragging=!0,this.dragging=!0,this.doSlideChange=!1,this.doSlideClose=!1;var t=Math.abs(this.currentX),i=Math.abs(this.currentY);if(t>0&&t>=Math.abs(this.currentY)&&(!this.lastDirection||"x"==this.lastDirection)){this.yOffset=0,this.lastDirection="x",this.setTranslate(this.dragContainer,this.currentX,0);var n=this.shouldChange();if(!this.instance.settings.dragAutoSnap&&n&&(this.doSlideChange=n),this.instance.settings.dragAutoSnap&&n)return this.instance.preventOutsideClick=!0,this.toleranceReached=!0,this.active=!1,this.instance.preventOutsideClick=!0,this.dragEnd(null),"right"==n&&this.instance.prevSlide(),void("left"==n&&this.instance.nextSlide())}if(this.toleranceY>0&&i>0&&i>=t&&(!this.lastDirection||"y"==this.lastDirection)){this.xOffset=0,this.lastDirection="y",this.setTranslate(this.dragContainer,0,this.currentY);var s=this.shouldClose();return!this.instance.settings.dragAutoSnap&&s&&(this.doSlideClose=!0),void(this.instance.settings.dragAutoSnap&&s&&this.instance.close())}}}},{key:"shouldChange",value:function(){var e=!1;if(Math.abs(this.currentX)>=this.toleranceX){var t=this.currentX>0?"right":"left";("left"==t&&this.slide!==this.slide.parentNode.lastChild||"right"==t&&this.slide!==this.slide.parentNode.firstChild)&&(e=t)}return e}},{key:"shouldClose",value:function(){var e=!1;return Math.abs(this.currentY)>=this.toleranceY&&(e=!0),e}},{key:"setTranslate",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.style.transition=n?"all .2s ease":"",e.style.transform="translate3d(".concat(t,"px, ").concat(i,"px, 0)")}}]),e}();function V(e,t,i,n){var s=e.querySelector(".gslide-media"),l=new Image,o="gSlideTitle_"+i,r="gSlideDesc_"+i;l.addEventListener("load",(function(){T(n)&&n()}),!1),l.src=t.href,""!=t.sizes&&""!=t.srcset&&(l.sizes=t.sizes,l.srcset=t.srcset),l.alt="",I(t.alt)||""===t.alt||(l.alt=t.alt),""!==t.title&&l.setAttribute("aria-labelledby",o),""!==t.description&&l.setAttribute("aria-describedby",r),t.hasOwnProperty("_hasCustomWidth")&&t._hasCustomWidth&&(l.style.width=t.width),t.hasOwnProperty("_hasCustomHeight")&&t._hasCustomHeight&&(l.style.height=t.height),s.insertBefore(l,s.firstChild)}function F(e,t,i,n){var s=this,l=e.querySelector(".ginner-container"),o="gvideo"+i,r=e.querySelector(".gslide-media"),a=this.getAllPlayers();h(l,"gvideo-container"),r.insertBefore(m('
'),r.firstChild);var d=e.querySelector(".gvideo-wrapper");S(this.settings.plyr.css,"Plyr");var c=t.href,u=null==t?void 0:t.videoProvider,g=!1;r.style.maxWidth=t.width,S(this.settings.plyr.js,"Plyr",(function(){if(!u&&c.match(/vimeo\.com\/([0-9]*)/)&&(u="vimeo"),!u&&(c.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||c.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||c.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||c.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/))&&(u="youtube"),"local"===u||!u){u="local";var l='")}var r=g||m('
'));h(d,"".concat(u,"-video gvideo")),d.appendChild(r),d.setAttribute("data-id",o),d.setAttribute("data-index",i);var v=O(s.settings.plyr,"config")?s.settings.plyr.config:{},f=new Plyr("#"+o,v);f.on("ready",(function(e){a[o]=e.detail.plyr,T(n)&&n()})),b((function(){return e.querySelector("iframe")&&"true"==e.querySelector("iframe").dataset.ready}),(function(){s.resize(e)})),f.on("enterfullscreen",R),f.on("exitfullscreen",R)}))}function R(e){var t=u(e.target,".gslide-media");"enterfullscreen"===e.type&&h(t,"fullscreen"),"exitfullscreen"===e.type&&d(t,"fullscreen")}function G(e,t,i,n){var s,l=this,o=e.querySelector(".gslide-media"),r=!(!O(t,"href")||!t.href)&&t.href.split("#").pop().trim(),d=!(!O(t,"content")||!t.content)&&t.content;if(d&&(C(d)&&(s=m('
'.concat(d,"
"))),k(d))){"none"==d.style.display&&(d.style.display="block");var c=document.createElement("div");c.className="ginlined-content",c.appendChild(d),s=c}if(r){var u=document.getElementById(r);if(!u)return!1;var g=u.cloneNode(!0);g.style.height=t.height,g.style.maxWidth=t.width,h(g,"ginlined-content"),s=g}if(!s)return console.error("Unable to append inline slide content",t),!1;o.style.height=t.height,o.style.width=t.width,o.appendChild(s),this.events["inlineclose"+r]=a("click",{onElement:o.querySelectorAll(".gtrigger-close"),withCallback:function(e){e.preventDefault(),l.close()}}),T(n)&&n()}function Z(e,t,i,n){var s=e.querySelector(".gslide-media"),l=function(e){var t=e.url,i=e.allow,n=e.callback,s=e.appendTo,l=document.createElement("iframe");return l.className="vimeo-video gvideo",l.src=t,l.style.width="100%",l.style.height="100%",i&&l.setAttribute("allow",i),l.onload=function(){l.onload=null,h(l,"node-ready"),T(n)&&n()},s&&s.appendChild(l),l}({url:t.href,callback:n});s.parentNode.style.maxWidth=t.width,s.parentNode.style.height=t.height,s.appendChild(l)}var U=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),this.defaults={href:"",sizes:"",srcset:"",title:"",type:"",videoProvider:"",description:"",alt:"",descPosition:"bottom",effect:"",width:"",height:"",content:!1,zoomable:!0,draggable:!0},L(i)&&(this.defaults=l(this.defaults,i))}return n(e,[{key:"sourceType",value:function(e){var t=e;if(null!==(e=e.toLowerCase()).match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/))return"image";if(e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/))return"video";if(e.match(/vimeo\.com\/([0-9]*)/))return"video";if(null!==e.match(/\.(mp4|ogg|webm|mov)/))return"video";if(null!==e.match(/\.(mp3|wav|wma|aac|ogg)/))return"audio";if(e.indexOf("#")>-1&&""!==t.split("#").pop().trim())return"inline";return e.indexOf("goajax=true")>-1?"ajax":"external"}},{key:"parseConfig",value:function(e,t){var i=this,n=l({descPosition:t.descPosition},this.defaults);if(L(e)&&!k(e)){O(e,"type")||(O(e,"content")&&e.content?e.type="inline":O(e,"href")&&(e.type=this.sourceType(e.href)));var s=l(n,e);return this.setSize(s,t),s}var r="",a=e.getAttribute("data-glightbox"),h=e.nodeName.toLowerCase();if("a"===h&&(r=e.href),"img"===h&&(r=e.src,n.alt=e.alt),n.href=r,o(n,(function(s,l){O(t,l)&&"width"!==l&&(n[l]=t[l]);var o=e.dataset[l];I(o)||(n[l]=i.sanitizeValue(o))})),n.content&&(n.type="inline"),!n.type&&r&&(n.type=this.sourceType(r)),I(a)){if(!n.title&&"a"==h){var d=e.title;I(d)||""===d||(n.title=d)}if(!n.title&&"img"==h){var c=e.alt;I(c)||""===c||(n.title=c)}}else{var u=[];o(n,(function(e,t){u.push(";\\s?"+t)})),u=u.join("\\s?:|"),""!==a.trim()&&o(n,(function(e,t){var s=a,l=new RegExp("s?"+t+"s?:s?(.*?)("+u+"s?:|$)"),o=s.match(l);if(o&&o.length&&o[1]){var r=o[1].trim().replace(/;\s*$/,"");n[t]=i.sanitizeValue(r)}}))}if(n.description&&"."===n.description.substring(0,1)){var g;try{g=document.querySelector(n.description).innerHTML}catch(e){if(!(e instanceof DOMException))throw e}g&&(n.description=g)}if(!n.description){var v=e.querySelector(".glightbox-desc");v&&(n.description=v.innerHTML)}return this.setSize(n,t,e),this.slideConfig=n,n}},{key:"setSize",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n="video"==e.type?this.checkSize(t.videosWidth):this.checkSize(t.width),s=this.checkSize(t.height);return e.width=O(e,"width")&&""!==e.width?this.checkSize(e.width):n,e.height=O(e,"height")&&""!==e.height?this.checkSize(e.height):s,i&&"image"==e.type&&(e._hasCustomWidth=!!i.dataset.width,e._hasCustomHeight=!!i.dataset.height),e}},{key:"checkSize",value:function(e){return M(e)?"".concat(e,"px"):e}},{key:"sanitizeValue",value:function(e){return"true"!==e&&"false"!==e?e:"true"===e}}]),e}(),$=function(){function e(i,n,s){t(this,e),this.element=i,this.instance=n,this.index=s}return n(e,[{key:"setContent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(c(t,"loaded"))return!1;var n=this.instance.settings,s=this.slideConfig,l=w();T(n.beforeSlideLoad)&&n.beforeSlideLoad({index:this.index,slide:t,player:!1});var o=s.type,r=s.descPosition,a=t.querySelector(".gslide-media"),d=t.querySelector(".gslide-title"),u=t.querySelector(".gslide-desc"),g=t.querySelector(".gdesc-inner"),v=i,f="gSlideTitle_"+this.index,p="gSlideDesc_"+this.index;if(T(n.afterSlideLoad)&&(v=function(){T(i)&&i(),n.afterSlideLoad({index:e.index,slide:t,player:e.instance.getSlidePlayerInstance(e.index)})}),""==s.title&&""==s.description?g&&g.parentNode.parentNode.removeChild(g.parentNode):(d&&""!==s.title?(d.id=f,d.innerHTML=s.title):d.parentNode.removeChild(d),u&&""!==s.description?(u.id=p,l&&n.moreLength>0?(s.smallDescription=this.slideShortDesc(s.description,n.moreLength,n.moreText),u.innerHTML=s.smallDescription,this.descriptionEvents(u,s)):u.innerHTML=s.description):u.parentNode.removeChild(u),h(a.parentNode,"desc-".concat(r)),h(g.parentNode,"description-".concat(r))),h(a,"gslide-".concat(o)),h(t,"loaded"),"video"!==o){if("external"!==o)return"inline"===o?(G.apply(this.instance,[t,s,this.index,v]),void(s.draggable&&new j({dragEl:t.querySelector(".gslide-inline"),toleranceX:n.dragToleranceX,toleranceY:n.dragToleranceY,slide:t,instance:this.instance}))):void("image"!==o?T(v)&&v():V(t,s,this.index,(function(){var i=t.querySelector("img");s.draggable&&new j({dragEl:i,toleranceX:n.dragToleranceX,toleranceY:n.dragToleranceY,slide:t,instance:e.instance}),s.zoomable&&i.naturalWidth>i.offsetWidth&&(h(i,"zoomable"),new H(i,t,(function(){e.instance.resize()}))),T(v)&&v()})));Z.apply(this,[t,s,this.index,v])}else F.apply(this.instance,[t,s,this.index,v])}},{key:"slideShortDesc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("div");n.innerHTML=e;var s=n.innerText,l=i;if((e=s.trim()).length<=t)return e;var o=e.substr(0,t-1);return l?(n=null,o+'... '+i+""):o}},{key:"descriptionEvents",value:function(e,t){var i=this,n=e.querySelector(".desc-more");if(!n)return!1;a("click",{onElement:n,withCallback:function(e,n){e.preventDefault();var s=document.body,l=u(n,".gslide-desc");if(!l)return!1;l.innerHTML=t.description,h(s,"gdesc-open");var o=a("click",{onElement:[s,u(l,".gslide-description")],withCallback:function(e,n){"a"!==e.target.nodeName.toLowerCase()&&(d(s,"gdesc-open"),h(s,"gdesc-closed"),l.innerHTML=t.smallDescription,i.descriptionEvents(l,t),setTimeout((function(){d(s,"gdesc-closed")}),400),o.destroy())}})}})}},{key:"create",value:function(){return m(this.instance.settings.slideHTML)}},{key:"getConfig",value:function(){k(this.element)||this.element.hasOwnProperty("draggable")||(this.element.draggable=this.instance.settings.draggable);var e=new U(this.instance.settings.slideExtraAttributes);return this.slideConfig=e.parseConfig(this.element,this.instance.settings),this.slideConfig}}]),e}(),J=w(),K=null!==w()||void 0!==document.createTouch||"ontouchstart"in window||"onmsgesturechange"in window||navigator.msMaxTouchPoints,Q=document.getElementsByTagName("html")[0],ee={selector:".glightbox",elements:null,skin:"clean",theme:"clean",closeButton:!0,startAt:null,autoplayVideos:!0,autofocusVideos:!0,descPosition:"bottom",width:"900px",height:"506px",videosWidth:"960px",beforeSlideChange:null,afterSlideChange:null,beforeSlideLoad:null,afterSlideLoad:null,slideInserted:null,slideRemoved:null,slideExtraAttributes:null,onOpen:null,onClose:null,loop:!1,zoomable:!0,draggable:!0,dragAutoSnap:!1,dragToleranceX:40,dragToleranceY:65,preload:!0,oneSlidePerOpen:!1,touchNavigation:!0,touchFollowAxis:!0,keyboardNavigation:!0,closeOnOutsideClick:!0,plugins:!1,plyr:{css:"https://cdn.plyr.io/3.6.12/plyr.css",js:"https://cdn.plyr.io/3.6.12/plyr.js",config:{ratio:"16:9",fullscreen:{enabled:!0,iosNative:!0},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3},vimeo:{byline:!1,portrait:!1,title:!1,transparent:!1}}},openEffect:"zoom",closeEffect:"zoom",slideEffect:"slide",moreText:"See more",moreLength:60,cssEfects:{fade:{in:"fadeIn",out:"fadeOut"},zoom:{in:"zoomIn",out:"zoomOut"},slide:{in:"slideInRight",out:"slideOutLeft"},slideBack:{in:"slideInLeft",out:"slideOutRight"},none:{in:"none",out:"none"}},svg:{close:'',next:' ',prev:''},slideHTML:'
\n
\n
\n
\n
\n
\n
\n

\n
\n
\n
\n
\n
\n
',lightboxHTML:''},te=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t(this,e),this.customOptions=i,this.settings=l(ee,i),this.effectsClasses=this.getAnimationClasses(),this.videoPlayers={},this.apiEvents=[],this.fullElementsList=!1}return n(e,[{key:"init",value:function(){var e=this,t=this.getSelector();t&&(this.baseEvents=a("click",{onElement:t,withCallback:function(t,i){t.preventDefault(),e.open(i)}})),this.elements=this.getElements()}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(0===this.elements.length)return!1;this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null;var i=M(t)?t:this.settings.startAt;if(k(e)){var n=e.getAttribute("data-gallery");n&&(this.fullElementsList=this.elements,this.elements=this.getGalleryElements(this.elements,n)),I(i)&&(i=this.getElementIndex(e))<0&&(i=0)}M(i)||(i=0),this.build(),g(this.overlay,"none"===this.settings.openEffect?"none":this.settings.cssEfects.fade.in);var s=document.body,l=window.innerWidth-document.documentElement.clientWidth;if(l>0){var o=document.createElement("style");o.type="text/css",o.className="gcss-styles",o.innerText=".gscrollbar-fixer {margin-right: ".concat(l,"px}"),document.head.appendChild(o),h(s,"gscrollbar-fixer")}h(s,"glightbox-open"),h(Q,"glightbox-open"),J&&(h(document.body,"glightbox-mobile"),this.settings.slideEffect="slide"),this.showSlide(i,!0),1===this.elements.length?(h(this.prevButton,"glightbox-button-hidden"),h(this.nextButton,"glightbox-button-hidden")):(d(this.prevButton,"glightbox-button-hidden"),d(this.nextButton,"glightbox-button-hidden")),this.lightboxOpen=!0,this.trigger("open"),T(this.settings.onOpen)&&this.settings.onOpen(),K&&this.settings.touchNavigation&&B(this),this.settings.keyboardNavigation&&X(this)}},{key:"openAt",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.open(null,e)}},{key:"showSlide",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];f(this.loader),this.index=parseInt(t);var n=this.slidesContainer.querySelector(".current");n&&d(n,"current"),this.slideAnimateOut();var s=this.slidesContainer.querySelectorAll(".gslide")[t];if(c(s,"loaded"))this.slideAnimateIn(s,i),p(this.loader);else{f(this.loader);var l=this.elements[t],o={index:this.index,slide:s,slideNode:s,slideConfig:l.slideConfig,slideIndex:this.index,trigger:l.node,player:null};this.trigger("slide_before_load",o),l.instance.setContent(s,(function(){p(e.loader),e.resize(),e.slideAnimateIn(s,i),e.trigger("slide_after_load",o)}))}this.slideDescription=s.querySelector(".gslide-description"),this.slideDescriptionContained=this.slideDescription&&c(this.slideDescription.parentNode,"gslide-media"),this.settings.preload&&(this.preloadSlide(t+1),this.preloadSlide(t-1)),this.updateNavigationClasses(),this.activeSlide=s}},{key:"preloadSlide",value:function(e){var t=this;if(e<0||e>this.elements.length-1)return!1;if(I(this.elements[e]))return!1;var i=this.slidesContainer.querySelectorAll(".gslide")[e];if(c(i,"loaded"))return!1;var n=this.elements[e],s=n.type,l={index:e,slide:i,slideNode:i,slideConfig:n.slideConfig,slideIndex:e,trigger:n.node,player:null};this.trigger("slide_before_load",l),"video"===s||"external"===s?setTimeout((function(){n.instance.setContent(i,(function(){t.trigger("slide_after_load",l)}))}),200):n.instance.setContent(i,(function(){t.trigger("slide_after_load",l)}))}},{key:"prevSlide",value:function(){this.goToSlide(this.index-1)}},{key:"nextSlide",value:function(){this.goToSlide(this.index+1)}},{key:"goToSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.prevActiveSlide=this.activeSlide,this.prevActiveSlideIndex=this.index,!this.loop()&&(e<0||e>this.elements.length-1))return!1;e<0?e=this.elements.length-1:e>=this.elements.length&&(e=0),this.showSlide(e)}},{key:"insertSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;t<0&&(t=this.elements.length);var i=new $(e,this,t),n=i.getConfig(),s=l({},n),o=i.create(),r=this.elements.length-1;s.index=t,s.node=!1,s.instance=i,s.slideConfig=n,this.elements.splice(t,0,s);var a=null,h=null;if(this.slidesContainer){if(t>r)this.slidesContainer.appendChild(o);else{var d=this.slidesContainer.querySelectorAll(".gslide")[t];this.slidesContainer.insertBefore(o,d)}(this.settings.preload&&0==this.index&&0==t||this.index-1==t||this.index+1==t)&&this.preloadSlide(t),0===this.index&&0===t&&(this.index=1),this.updateNavigationClasses(),a=this.slidesContainer.querySelectorAll(".gslide")[t],h=this.getSlidePlayerInstance(t),s.slideNode=a}this.trigger("slide_inserted",{index:t,slide:a,slideNode:a,slideConfig:n,slideIndex:t,trigger:null,player:h}),T(this.settings.slideInserted)&&this.settings.slideInserted({index:t,slide:a,player:h})}},{key:"removeSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(e<0||e>this.elements.length-1)return!1;var t=this.slidesContainer&&this.slidesContainer.querySelectorAll(".gslide")[e];t&&(this.getActiveSlideIndex()==e&&(e==this.elements.length-1?this.prevSlide():this.nextSlide()),t.parentNode.removeChild(t)),this.elements.splice(e,1),this.trigger("slide_removed",e),T(this.settings.slideRemoved)&&this.settings.slideRemoved(e)}},{key:"slideAnimateIn",value:function(e,t){var i=this,n=e.querySelector(".gslide-media"),s=e.querySelector(".gslide-description"),l={index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlide,slideConfig:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},o={index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideConfig:this.elements[this.index].slideConfig,slideIndex:this.index,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)};if(n.offsetWidth>0&&s&&(p(s),s.style.display=""),d(e,this.effectsClasses),t)g(e,this.settings.cssEfects[this.settings.openEffect].in,(function(){i.settings.autoplayVideos&&i.slidePlayerPlay(e),i.trigger("slide_changed",{prev:l,current:o}),T(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,o])}));else{var r=this.settings.slideEffect,a="none"!==r?this.settings.cssEfects[r].in:r;this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(a=this.settings.cssEfects.slideBack.in),g(e,a,(function(){i.settings.autoplayVideos&&i.slidePlayerPlay(e),i.trigger("slide_changed",{prev:l,current:o}),T(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,o])}))}setTimeout((function(){i.resize(e)}),100),h(e,"current")}},{key:"slideAnimateOut",value:function(){if(!this.prevActiveSlide)return!1;var e=this.prevActiveSlide;d(e,this.effectsClasses),h(e,"prev");var t=this.settings.slideEffect,i="none"!==t?this.settings.cssEfects[t].out:t;this.slidePlayerPause(e),this.trigger("slide_before_change",{prev:{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlideIndex,slideConfig:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:I(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},current:{index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideIndex:this.index,slideConfig:this.elements[this.index].slideConfig,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)}}),T(this.settings.beforeSlideChange)&&this.settings.beforeSlideChange.apply(this,[{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},{index:this.index,slide:this.activeSlide,player:this.getSlidePlayerInstance(this.index)}]),this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(i=this.settings.cssEfects.slideBack.out),g(e,i,(function(){var t=e.querySelector(".ginner-container"),i=e.querySelector(".gslide-media"),n=e.querySelector(".gslide-description");t.style.transform="",i.style.transform="",d(i,"greset"),i.style.opacity="",n&&(n.style.opacity=""),d(e,"prev")}))}},{key:"getAllPlayers",value:function(){return this.videoPlayers}},{key:"getSlidePlayerInstance",value:function(e){var t="gvideo"+e,i=this.getAllPlayers();return!(!O(i,t)||!i[t])&&i[t]}},{key:"stopSlideVideo",value:function(e){if(k(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}console.log("stopSlideVideo is deprecated, use slidePlayerPause");var i=this.getSlidePlayerInstance(e);i&&i.playing&&i.pause()}},{key:"slidePlayerPause",value:function(e){if(k(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}var i=this.getSlidePlayerInstance(e);i&&i.playing&&i.pause()}},{key:"playSlideVideo",value:function(e){if(k(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}console.log("playSlideVideo is deprecated, use slidePlayerPlay");var i=this.getSlidePlayerInstance(e);i&&!i.playing&&i.play()}},{key:"slidePlayerPlay",value:function(e){var t;if(!J||null!==(t=this.settings.plyr.config)&&void 0!==t&&t.muted){if(k(e)){var i=e.querySelector(".gvideo-wrapper");i&&(e=i.getAttribute("data-index"))}var n=this.getSlidePlayerInstance(e);n&&!n.playing&&(n.play(),this.settings.autofocusVideos&&n.elements.container.focus())}}},{key:"setElements",value:function(e){var t=this;this.settings.elements=!1;var i=[];e&&e.length&&o(e,(function(e,n){var s=new $(e,t,n),o=s.getConfig(),r=l({},o);r.slideConfig=o,r.instance=s,r.index=n,i.push(r)})),this.elements=i,this.lightboxOpen&&(this.slidesContainer.innerHTML="",this.elements.length&&(o(this.elements,(function(){var e=m(t.settings.slideHTML);t.slidesContainer.appendChild(e)})),this.showSlide(0,!0)))}},{key:"getElementIndex",value:function(e){var t=!1;return o(this.elements,(function(i,n){if(O(i,"node")&&i.node==e)return t=n,!0})),t}},{key:"getElements",value:function(){var e=this,t=[];this.elements=this.elements?this.elements:[],!I(this.settings.elements)&&E(this.settings.elements)&&this.settings.elements.length&&o(this.settings.elements,(function(i,n){var s=new $(i,e,n),o=s.getConfig(),r=l({},o);r.node=!1,r.index=n,r.instance=s,r.slideConfig=o,t.push(r)}));var i=!1;return this.getSelector()&&(i=document.querySelectorAll(this.getSelector())),i?(o(i,(function(i,n){var s=new $(i,e,n),o=s.getConfig(),r=l({},o);r.node=i,r.index=n,r.instance=s,r.slideConfig=o,r.gallery=i.getAttribute("data-gallery"),t.push(r)})),t):t}},{key:"getGalleryElements",value:function(e,t){return e.filter((function(e){return e.gallery==t}))}},{key:"getSelector",value:function(){return!this.settings.elements&&(this.settings.selector&&"data-"==this.settings.selector.substring(0,5)?"*[".concat(this.settings.selector,"]"):this.settings.selector)}},{key:"getActiveSlide",value:function(){return this.slidesContainer.querySelectorAll(".gslide")[this.index]}},{key:"getActiveSlideIndex",value:function(){return this.index}},{key:"getAnimationClasses",value:function(){var e=[];for(var t in this.settings.cssEfects)if(this.settings.cssEfects.hasOwnProperty(t)){var i=this.settings.cssEfects[t];e.push("g".concat(i.in)),e.push("g".concat(i.out))}return e.join(" ")}},{key:"build",value:function(){var e=this;if(this.built)return!1;var t=document.body.childNodes,i=[];o(t,(function(e){e.parentNode==document.body&&"#"!==e.nodeName.charAt(0)&&e.hasAttribute&&!e.hasAttribute("aria-hidden")&&(i.push(e),e.setAttribute("aria-hidden","true"))}));var n=O(this.settings.svg,"next")?this.settings.svg.next:"",s=O(this.settings.svg,"prev")?this.settings.svg.prev:"",l=O(this.settings.svg,"close")?this.settings.svg.close:"",r=this.settings.lightboxHTML;r=m(r=(r=(r=r.replace(/{nextSVG}/g,n)).replace(/{prevSVG}/g,s)).replace(/{closeSVG}/g,l)),document.body.appendChild(r);var d=document.getElementById("glightbox-body");this.modal=d;var g=d.querySelector(".gclose");this.prevButton=d.querySelector(".gprev"),this.nextButton=d.querySelector(".gnext"),this.overlay=d.querySelector(".goverlay"),this.loader=d.querySelector(".gloader"),this.slidesContainer=document.getElementById("glightbox-slider"),this.bodyHiddenChildElms=i,this.events={},h(this.modal,"glightbox-"+this.settings.skin),this.settings.closeButton&&g&&(this.events.close=a("click",{onElement:g,withCallback:function(t,i){t.preventDefault(),e.close()}})),g&&!this.settings.closeButton&&g.parentNode.removeChild(g),this.nextButton&&(this.events.next=a("click",{onElement:this.nextButton,withCallback:function(t,i){t.preventDefault(),e.nextSlide()}})),this.prevButton&&(this.events.prev=a("click",{onElement:this.prevButton,withCallback:function(t,i){t.preventDefault(),e.prevSlide()}})),this.settings.closeOnOutsideClick&&(this.events.outClose=a("click",{onElement:d,withCallback:function(t,i){e.preventOutsideClick||c(document.body,"glightbox-mobile")||u(t.target,".ginner-container")||u(t.target,".gbtn")||c(t.target,"gnext")||c(t.target,"gprev")||e.close()}})),o(this.elements,(function(t,i){e.slidesContainer.appendChild(t.instance.create()),t.slideNode=e.slidesContainer.querySelectorAll(".gslide")[i]})),K&&h(document.body,"glightbox-touch"),this.events.resize=a("resize",{onElement:window,withCallback:function(){e.resize()}}),this.built=!0}},{key:"resize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if((e=e||this.activeSlide)&&!c(e,"zoomed")){var t=y(),i=e.querySelector(".gvideo-wrapper"),n=e.querySelector(".gslide-image"),s=this.slideDescription,l=t.width,o=t.height;if(l<=768?h(document.body,"glightbox-mobile"):d(document.body,"glightbox-mobile"),i||n){var r=!1;if(s&&(c(s,"description-bottom")||c(s,"description-top"))&&!c(s,"gabsolute")&&(r=!0),n)if(l<=768)n.querySelector("img");else if(r){var a=s.offsetHeight,u=n.querySelector("img");u.setAttribute("style","max-height: calc(100vh - ".concat(a,"px)")),s.setAttribute("style","max-width: ".concat(u.offsetWidth,"px;"))}if(i){var g=O(this.settings.plyr.config,"ratio")?this.settings.plyr.config.ratio:"";if(!g){var v=i.clientWidth,f=i.clientHeight,p=v/f;g="".concat(v/p,":").concat(f/p)}var m=g.split(":"),x=this.settings.videosWidth,b=this.settings.videosWidth,S=(b=M(x)||-1!==x.indexOf("px")?parseInt(x):-1!==x.indexOf("vw")?l*parseInt(x)/100:-1!==x.indexOf("vh")?o*parseInt(x)/100:-1!==x.indexOf("%")?l*parseInt(x)/100:parseInt(i.clientWidth))/(parseInt(m[0])/parseInt(m[1]));if(S=Math.floor(S),r&&(o-=s.offsetHeight),b>l||S>o||ob){var w=i.offsetWidth,T=i.offsetHeight,C=o/T,k={width:w*C,height:T*C};i.parentNode.setAttribute("style","max-width: ".concat(k.width,"px")),r&&s.setAttribute("style","max-width: ".concat(k.width,"px;"))}else i.parentNode.style.maxWidth="".concat(x),r&&s.setAttribute("style","max-width: ".concat(x,";"))}}}}},{key:"reload",value:function(){this.init()}},{key:"updateNavigationClasses",value:function(){var e=this.loop();d(this.nextButton,"disabled"),d(this.prevButton,"disabled"),0==this.index&&this.elements.length-1==0?(h(this.prevButton,"disabled"),h(this.nextButton,"disabled")):0!==this.index||e?this.index!==this.elements.length-1||e||h(this.nextButton,"disabled"):h(this.prevButton,"disabled")}},{key:"loop",value:function(){var e=O(this.settings,"loopAtEnd")?this.settings.loopAtEnd:null;return e=O(this.settings,"loop")?this.settings.loop:e,e}},{key:"close",value:function(){var e=this;if(!this.lightboxOpen){if(this.events){for(var t in this.events)this.events.hasOwnProperty(t)&&this.events[t].destroy();this.events=null}return!1}if(this.closing)return!1;this.closing=!0,this.slidePlayerPause(this.activeSlide),this.fullElementsList&&(this.elements=this.fullElementsList),this.bodyHiddenChildElms.length&&o(this.bodyHiddenChildElms,(function(e){e.removeAttribute("aria-hidden")})),h(this.modal,"glightbox-closing"),g(this.overlay,"none"==this.settings.openEffect?"none":this.settings.cssEfects.fade.out),g(this.activeSlide,this.settings.cssEfects[this.settings.closeEffect].out,(function(){if(e.activeSlide=null,e.prevActiveSlideIndex=null,e.prevActiveSlide=null,e.built=!1,e.events){for(var t in e.events)e.events.hasOwnProperty(t)&&e.events[t].destroy();e.events=null}var i=document.body;d(Q,"glightbox-open"),d(i,"glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer"),e.modal.parentNode.removeChild(e.modal),e.trigger("close"),T(e.settings.onClose)&&e.settings.onClose();var n=document.querySelector(".gcss-styles");n&&n.parentNode.removeChild(n),e.lightboxOpen=!1,e.closing=null}))}},{key:"destroy",value:function(){this.close(),this.clearAllEvents(),this.baseEvents&&this.baseEvents.destroy()}},{key:"on",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||!T(t))throw new TypeError("Event name and callback must be defined");this.apiEvents.push({evt:e,once:i,callback:t})}},{key:"once",value:function(e,t){this.on(e,t,!0)}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=[];o(this.apiEvents,(function(t,s){var l=t.evt,o=t.once,r=t.callback;l==e&&(r(i),o&&n.push(s))})),n.length&&o(n,(function(e){return t.apiEvents.splice(e,1)}))}},{key:"clearAllEvents",value:function(){this.apiEvents.splice(0,this.apiEvents.length)}},{key:"version",value:function(){return"3.2.0"}}]),e}();return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new te(e);return t.init(),t}})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).GLightbox=t()}(this,(function(){"use strict";function e(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(t,i){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=e[l]=e[l]||[],s={all:n,evt:null,found:null};return t&&i&&M(n)>0&&r(n,(function(e,n){if(e.eventName==t&&e.fn.toString()==i.toString())return s.found=!0,s.evt=n,!1})),s}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.onElement,n=t.withCallback,s=t.avoidDuplicate,l=void 0===s||s,o=t.once,h=void 0!==o&&o,d=t.useCapture,c=void 0!==d&&d,u=arguments.length>2?arguments[2]:void 0,g=i||[];function v(e){C(n)&&n.call(u,e,this),h&&v.destroy()}return k(g)&&(g=document.querySelectorAll(g)),v.destroy=function(){r(g,(function(t){var i=a(t,e,v);i.found&&i.all.splice(i.evt,1),t.removeEventListener&&t.removeEventListener(e,v,c)}))},r(g,(function(t){var i=a(t,e,v);(t.addEventListener&&l&&!i.found||!l)&&(t.addEventListener(e,v,c),i.all.push({eventName:e,fn:v}))})),v}function d(e,t){r(t.split(" "),(function(t){return e.classList.add(t)}))}function c(e,t){r(t.split(" "),(function(t){return e.classList.remove(t)}))}function u(e,t){return e.classList.contains(t)}function g(e,t){for(;e!==document.body;){if(!(e=e.parentElement))return!1;if("function"==typeof e.matches?e.matches(t):e.msMatchesSelector(t))return e}}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||""===t)return!1;if("none"===t)return C(i)&&i(),!1;var n=b(),s=t.split(" ");r(s,(function(t){d(e,"g"+t)})),h(n,{onElement:e,avoidDuplicate:!1,once:!0,withCallback:function(e,t){r(s,(function(e){c(t,"g"+e)})),C(i)&&i()}})}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(""===t)return e.style.webkitTransform="",e.style.MozTransform="",e.style.msTransform="",e.style.OTransform="",e.style.transform="",!1;e.style.webkitTransform=t,e.style.MozTransform=t,e.style.msTransform=t,e.style.OTransform=t,e.style.transform=t}function p(e){e.style.display="block"}function m(e){e.style.display="none"}function y(e){var t=document.createDocumentFragment(),i=document.createElement("div");for(i.innerHTML=e;i.firstChild;)t.appendChild(i.firstChild);return t}function x(){return{width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}}function b(){var e,t=document.createElement("fakeelement"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}function S(e,t,i,n){if(e())t();else{var s;i||(i=100);var l=setInterval((function(){e()&&(clearInterval(l),s&&clearTimeout(s),t())}),i);n&&(s=setTimeout((function(){clearInterval(l)}),n))}}function w(e,t,i){if(O(e))console.error("Inject assets error");else if(C(t)&&(i=t,t=!1),k(t)&&t in window)C(i)&&i();else{var n;if(-1!==e.indexOf(".css")){if((n=document.querySelectorAll('link[href="'+e+'"]'))&&n.length>0)return void(C(i)&&i());var s=document.getElementsByTagName("head")[0],l=s.querySelectorAll('link[rel="stylesheet"]'),o=document.createElement("link");return o.rel="stylesheet",o.type="text/css",o.href=e,o.media="all",l?s.insertBefore(o,l[0]):s.appendChild(o),void(C(i)&&i())}if((n=document.querySelectorAll('script[src="'+e+'"]'))&&n.length>0){if(C(i)){if(k(t))return S((function(){return void 0!==window[t]}),(function(){i()})),!1;i()}}else{var r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=function(){if(C(i)){if(k(t))return S((function(){return void 0!==window[t]}),(function(){i()})),!1;i()}},document.body.appendChild(r)}}}function T(){return"navigator"in window&&window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i)}function C(e){return"function"==typeof e}function k(e){return"string"==typeof e}function E(e){return!(!e||!e.nodeType||1!=e.nodeType)}function A(e){return Array.isArray(e)}function L(e){return e&&e.length&&isFinite(e.length)}function I(e){return"object"===t(e)&&null!=e&&!C(e)&&!A(e)}function O(e){return null==e}function P(e,t){return null!==e&&hasOwnProperty.call(e,t)}function M(e){if(I(e)){if(e.keys)return e.keys().length;var t=0;for(var i in e)P(e,i)&&t++;return t}return e.length}function z(e){return!isNaN(parseFloat(e))&&isFinite(e)}function X(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=document.querySelectorAll(".gbtn[data-taborder]:not(.disabled)");if(!t.length)return!1;if(1==t.length)return t[0];"string"==typeof e&&(e=parseInt(e));var i=[];r(t,(function(e){i.push(e.getAttribute("data-taborder"))}));var n=Math.max.apply(Math,i.map((function(e){return parseInt(e)}))),s=e<0?1:e+1;s>n&&(s="1");var l=i.filter((function(e){return e>=parseInt(s)})),o=l.sort()[0];return document.querySelector('.gbtn[data-taborder="'.concat(o,'"]'))}function Y(e){if(e.events.hasOwnProperty("keyboard"))return!1;e.events.keyboard=h("keydown",{onElement:window,withCallback:function(t,i){var n=(t=t||window.event).keyCode;if(9==n){var s=document.querySelector(".gbtn.focused");if(!s){var l=!(!document.activeElement||!document.activeElement.nodeName)&&document.activeElement.nodeName.toLocaleLowerCase();if("input"==l||"textarea"==l||"button"==l)return}t.preventDefault();var o=document.querySelectorAll(".gbtn[data-taborder]");if(!o||o.length<=0)return;if(!s){var r=X();return void(r&&(r.focus(),d(r,"focused")))}var a=X(s.getAttribute("data-taborder"));c(s,"focused"),a&&(a.focus(),d(a,"focused"))}39==n&&e.nextSlide(),37==n&&e.prevSlide(),27==n&&e.close()}})}var q=s((function e(t,n){var s=this,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(i(this,e),this.img=t,this.slide=n,this.onclose=l,this.img.setZoomEvents)return!1;this.active=!1,this.zoomedIn=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.img.addEventListener("mousedown",(function(e){return s.dragStart(e)}),!1),this.img.addEventListener("mouseup",(function(e){return s.dragEnd(e)}),!1),this.img.addEventListener("mousemove",(function(e){return s.drag(e)}),!1),this.img.addEventListener("click",(function(e){return s.slide.classList.contains("dragging-nav")?(s.zoomOut(),!1):s.zoomedIn?void(s.zoomedIn&&!s.dragging&&s.zoomOut()):s.zoomIn()}),!1),this.img.setZoomEvents=!0}),[{key:"zoomIn",value:function(){var e=this.widowWidth();if(!(this.zoomedIn||e<=768)){var t=this.img;if(t.setAttribute("data-style",t.getAttribute("style")),t.style.maxWidth=t.naturalWidth+"px",t.style.maxHeight=t.naturalHeight+"px",t.naturalWidth>e){var i=e/2-t.naturalWidth/2;this.setTranslate(this.img.parentNode,i,0)}this.slide.classList.add("zoomed"),this.zoomedIn=!0}}},{key:"zoomOut",value:function(){this.img.parentNode.setAttribute("style",""),this.img.setAttribute("style",this.img.getAttribute("data-style")),this.slide.classList.remove("zoomed"),this.zoomedIn=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.onclose&&"function"==typeof this.onclose&&this.onclose()}},{key:"dragStart",value:function(e){e.preventDefault(),this.zoomedIn?("touchstart"===e.type?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset),e.target===this.img&&(this.active=!0,this.img.classList.add("dragging"))):this.active=!1}},{key:"dragEnd",value:function(e){var t=this;e.preventDefault(),this.initialX=this.currentX,this.initialY=this.currentY,this.active=!1,setTimeout((function(){t.dragging=!1,t.img.isDragging=!1,t.img.classList.remove("dragging")}),100)}},{key:"drag",value:function(e){this.active&&(e.preventDefault(),"touchmove"===e.type?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.img.isDragging=!0,this.dragging=!0,this.setTranslate(this.img,this.currentX,this.currentY))}},{key:"onMove",value:function(e){if(this.zoomedIn){var t=e.clientX-this.img.naturalWidth/2,i=e.clientY-this.img.naturalHeight/2;this.setTranslate(this.img,t,i)}}},{key:"setTranslate",value:function(e,t,i){e.style.transform="translate3d("+t+"px, "+i+"px, 0)"}},{key:"widowWidth",value:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}}]),N=s((function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var s=n.dragEl,l=n.toleranceX,o=void 0===l?40:l,r=n.toleranceY,a=void 0===r?65:r,h=n.slide,d=void 0===h?null:h,c=n.instance,u=void 0===c?null:c;this.el=s,this.active=!1,this.dragging=!1,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.direction=null,this.lastDirection=null,this.toleranceX=o,this.toleranceY=a,this.toleranceReached=!1,this.dragContainer=this.el,this.slide=d,this.instance=u,this.el.addEventListener("mousedown",(function(e){return t.dragStart(e)}),!1),this.el.addEventListener("mouseup",(function(e){return t.dragEnd(e)}),!1),this.el.addEventListener("mousemove",(function(e){return t.drag(e)}),!1)}),[{key:"dragStart",value:function(e){if(this.slide.classList.contains("zoomed"))this.active=!1;else{"touchstart"===e.type?(this.initialX=e.touches[0].clientX-this.xOffset,this.initialY=e.touches[0].clientY-this.yOffset):(this.initialX=e.clientX-this.xOffset,this.initialY=e.clientY-this.yOffset);var t=e.target.nodeName.toLowerCase();e.target.classList.contains("nodrag")||g(e.target,".nodrag")||-1!==["input","select","textarea","button","a"].indexOf(t)?this.active=!1:(e.preventDefault(),(e.target===this.el||"img"!==t&&g(e.target,".gslide-inline"))&&(this.active=!0,this.el.classList.add("dragging"),this.dragContainer=g(e.target,".ginner-container")))}}},{key:"dragEnd",value:function(e){var t=this;e&&e.preventDefault(),this.initialX=0,this.initialY=0,this.currentX=null,this.currentY=null,this.initialX=null,this.initialY=null,this.xOffset=0,this.yOffset=0,this.active=!1,this.doSlideChange&&(this.instance.preventOutsideClick=!0,"right"==this.doSlideChange&&this.instance.prevSlide(),"left"==this.doSlideChange&&this.instance.nextSlide()),this.doSlideClose&&this.instance.close(),this.toleranceReached||this.setTranslate(this.dragContainer,0,0,!0),setTimeout((function(){t.instance.preventOutsideClick=!1,t.toleranceReached=!1,t.lastDirection=null,t.dragging=!1,t.el.isDragging=!1,t.el.classList.remove("dragging"),t.slide.classList.remove("dragging-nav"),t.dragContainer.style.transform="",t.dragContainer.style.transition=""}),100)}},{key:"drag",value:function(e){if(this.active){e.preventDefault(),this.slide.classList.add("dragging-nav"),"touchmove"===e.type?(this.currentX=e.touches[0].clientX-this.initialX,this.currentY=e.touches[0].clientY-this.initialY):(this.currentX=e.clientX-this.initialX,this.currentY=e.clientY-this.initialY),this.xOffset=this.currentX,this.yOffset=this.currentY,this.el.isDragging=!0,this.dragging=!0,this.doSlideChange=!1,this.doSlideClose=!1;var t=Math.abs(this.currentX),i=Math.abs(this.currentY);if(t>0&&t>=Math.abs(this.currentY)&&(!this.lastDirection||"x"==this.lastDirection)){this.yOffset=0,this.lastDirection="x",this.setTranslate(this.dragContainer,this.currentX,0);var n=this.shouldChange();if(!this.instance.settings.dragAutoSnap&&n&&(this.doSlideChange=n),this.instance.settings.dragAutoSnap&&n)return this.instance.preventOutsideClick=!0,this.toleranceReached=!0,this.active=!1,this.instance.preventOutsideClick=!0,this.dragEnd(null),"right"==n&&this.instance.prevSlide(),void("left"==n&&this.instance.nextSlide())}if(this.toleranceY>0&&i>0&&i>=t&&(!this.lastDirection||"y"==this.lastDirection)){this.xOffset=0,this.lastDirection="y",this.setTranslate(this.dragContainer,0,this.currentY);var s=this.shouldClose();return!this.instance.settings.dragAutoSnap&&s&&(this.doSlideClose=!0),void(this.instance.settings.dragAutoSnap&&s&&this.instance.close())}}}},{key:"shouldChange",value:function(){var e=!1;if(Math.abs(this.currentX)>=this.toleranceX){var t=this.currentX>0?"right":"left";("left"==t&&this.slide!==this.slide.parentNode.lastChild||"right"==t&&this.slide!==this.slide.parentNode.firstChild)&&(e=t)}return e}},{key:"shouldClose",value:function(){var e=!1;return Math.abs(this.currentY)>=this.toleranceY&&(e=!0),e}},{key:"setTranslate",value:function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.style.transition=n?"all .2s ease":"",e.style.transform="translate3d(".concat(t,"px, ").concat(i,"px, 0)")}}]);function D(e,t,i,n){var s=e.querySelector(".gslide-media"),l=new Image,o="gSlideTitle_"+i,r="gSlideDesc_"+i;l.addEventListener("load",(function(){C(n)&&n()}),!1),l.src=t.href,""!=t.sizes&&""!=t.srcset&&(l.sizes=t.sizes,l.srcset=t.srcset),l.alt="",O(t.alt)||""===t.alt||(l.alt=t.alt),""!==t.title&&l.setAttribute("aria-labelledby",o),""!==t.description&&l.setAttribute("aria-describedby",r),t.hasOwnProperty("_hasCustomWidth")&&t._hasCustomWidth&&(l.style.width=t.width),t.hasOwnProperty("_hasCustomHeight")&&t._hasCustomHeight&&(l.style.height=t.height),s.insertBefore(l,s.firstChild)}function _(e,t,i,n){var s=this,l=e.querySelector(".ginner-container"),o="gvideo"+i,r=e.querySelector(".gslide-media"),a=this.getAllPlayers();d(l,"gvideo-container"),r.insertBefore(y('
'),r.firstChild);var h=e.querySelector(".gvideo-wrapper");w(this.settings.plyr.css,"Plyr");var c=t.href,u=null==t?void 0:t.videoProvider,g=!1;r.style.maxWidth=t.width,w(this.settings.plyr.js,"Plyr",(function(){if(!u&&c.match(/vimeo\.com\/([0-9]*)/)&&(u="vimeo"),!u&&(c.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||c.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||c.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||c.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/))&&(u="youtube"),"local"===u||!u){u="local";var l='")}var r=g||y('
'));d(h,"".concat(u,"-video gvideo")),h.appendChild(r),h.setAttribute("data-id",o),h.setAttribute("data-index",i);var v=P(s.settings.plyr,"config")?s.settings.plyr.config:{},f=new Plyr("#"+o,v);f.on("ready",(function(e){a[o]=e.detail.plyr,C(n)&&n()})),S((function(){return e.querySelector("iframe")&&"true"==e.querySelector("iframe").dataset.ready}),(function(){s.resize(e)})),f.on("enterfullscreen",W),f.on("exitfullscreen",W)}))}function W(e){var t=g(e.target,".gslide-media");"enterfullscreen"===e.type&&d(t,"fullscreen"),"exitfullscreen"===e.type&&c(t,"fullscreen")}function B(e,t,i,n){var s,l=this,o=e.querySelector(".gslide-media"),r=!(!P(t,"href")||!t.href)&&t.href.split("#").pop().trim(),a=!(!P(t,"content")||!t.content)&&t.content;if(a&&(k(a)&&(s=y('
'.concat(a,"
"))),E(a))){"none"==a.style.display&&(a.style.display="block");var c=document.createElement("div");c.className="ginlined-content",c.appendChild(a),s=c}if(r){var u=document.getElementById(r);if(!u)return!1;var g=u.cloneNode(!0);g.style.height=t.height,g.style.maxWidth=t.width,d(g,"ginlined-content"),s=g}if(!s)return console.error("Unable to append inline slide content",t),!1;o.style.height=t.height,o.style.width=t.width,o.appendChild(s),this.events["inlineclose"+r]=h("click",{onElement:o.querySelectorAll(".gtrigger-close"),withCallback:function(e){e.preventDefault(),l.close()}}),C(n)&&n()}function H(e,t,i,n){var s=e.querySelector(".gslide-media"),l=function(e){var t=e.url,i=e.allow,n=e.callback,s=e.appendTo,l=document.createElement("iframe");return l.className="vimeo-video gvideo",l.src=t,l.style.width="100%",l.style.height="100%",i&&l.setAttribute("allow",i),l.onload=function(){l.onload=null,d(l,"node-ready"),C(n)&&n()},s&&s.appendChild(l),l}({url:t.href,callback:n});s.parentNode.style.maxWidth=t.width,s.parentNode.style.height=t.height,s.appendChild(l)}var j=s((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.defaults={href:"",sizes:"",srcset:"",title:"",type:"",videoProvider:"",description:"",alt:"",descPosition:"bottom",effect:"",width:"",height:"",content:!1,zoomable:!0,draggable:!0},I(t)&&(this.defaults=o(this.defaults,t))}),[{key:"sourceType",value:function(e){var t=e;return null!==(e=e.toLowerCase()).match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/)?"image":e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/)||e.match(/vimeo\.com\/([0-9]*)/)||null!==e.match(/\.(mp4|ogg|webm|mov)/)?"video":null!==e.match(/\.(mp3|wav|wma|aac|ogg)/)?"audio":e.indexOf("#")>-1&&""!==t.split("#").pop().trim()?"inline":e.indexOf("goajax=true")>-1?"ajax":"external"}},{key:"parseConfig",value:function(e,t){var i=this,n=o({descPosition:t.descPosition},this.defaults);if(I(e)&&!E(e)){P(e,"type")||(P(e,"content")&&e.content?e.type="inline":P(e,"href")&&(e.type=this.sourceType(e.href)));var s=o(n,e);return this.setSize(s,t),s}var l="",a=e.getAttribute("data-glightbox"),h=e.nodeName.toLowerCase();if("a"===h&&(l=e.href),"img"===h&&(l=e.src,n.alt=e.alt),n.href=l,r(n,(function(s,l){P(t,l)&&"width"!==l&&(n[l]=t[l]);var o=e.dataset[l];O(o)||(n[l]=i.sanitizeValue(o))})),n.content&&(n.type="inline"),!n.type&&l&&(n.type=this.sourceType(l)),O(a)){if(!n.title&&"a"==h){var d=e.title;O(d)||""===d||(n.title=d)}if(!n.title&&"img"==h){var c=e.alt;O(c)||""===c||(n.title=c)}}else{var u=[];r(n,(function(e,t){u.push(";\\s?"+t)})),u=u.join("\\s?:|"),""!==a.trim()&&r(n,(function(e,t){var s=a,l=new RegExp("s?"+t+"s?:s?(.*?)("+u+"s?:|$)"),o=s.match(l);if(o&&o.length&&o[1]){var r=o[1].trim().replace(/;\s*$/,"");n[t]=i.sanitizeValue(r)}}))}if(n.description&&"."===n.description.substring(0,1)){var g;try{g=document.querySelector(n.description).innerHTML}catch(e){if(!(e instanceof DOMException))throw e}g&&(n.description=g)}if(!n.description){var v=e.querySelector(".glightbox-desc");v&&(n.description=v.innerHTML)}return this.setSize(n,t,e),this.slideConfig=n,n}},{key:"setSize",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n="video"==e.type?this.checkSize(t.videosWidth):this.checkSize(t.width),s=this.checkSize(t.height);return e.width=P(e,"width")&&""!==e.width?this.checkSize(e.width):n,e.height=P(e,"height")&&""!==e.height?this.checkSize(e.height):s,i&&"image"==e.type&&(e._hasCustomWidth=!!i.dataset.width,e._hasCustomHeight=!!i.dataset.height),e}},{key:"checkSize",value:function(e){return z(e)?"".concat(e,"px"):e}},{key:"sanitizeValue",value:function(e){return"true"!==e&&"false"!==e?e:"true"===e}}]),V=s((function e(t,n,s){i(this,e),this.element=t,this.instance=n,this.index=s}),[{key:"setContent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(u(t,"loaded"))return!1;var n=this.instance.settings,s=this.slideConfig,l=T();C(n.beforeSlideLoad)&&n.beforeSlideLoad({index:this.index,slide:t,player:!1});var o=s.type,r=s.descPosition,a=t.querySelector(".gslide-media"),h=t.querySelector(".gslide-title"),c=t.querySelector(".gslide-desc"),g=t.querySelector(".gdesc-inner"),v=i,f="gSlideTitle_"+this.index,p="gSlideDesc_"+this.index;if(C(n.afterSlideLoad)&&(v=function(){C(i)&&i(),n.afterSlideLoad({index:e.index,slide:t,player:e.instance.getSlidePlayerInstance(e.index)})}),""==s.title&&""==s.description?g&&g.parentNode.parentNode.removeChild(g.parentNode):(h&&""!==s.title?(h.id=f,h.innerHTML=s.title):h.parentNode.removeChild(h),c&&""!==s.description?(c.id=p,l&&n.moreLength>0?(s.smallDescription=this.slideShortDesc(s.description,n.moreLength,n.moreText),c.innerHTML=s.smallDescription,this.descriptionEvents(c,s)):c.innerHTML=s.description):c.parentNode.removeChild(c),d(a.parentNode,"desc-".concat(r)),d(g.parentNode,"description-".concat(r))),d(a,"gslide-".concat(o)),d(t,"loaded"),"video"!==o){if("external"!==o)return"inline"===o?(B.apply(this.instance,[t,s,this.index,v]),void(s.draggable&&new N({dragEl:t.querySelector(".gslide-inline"),toleranceX:n.dragToleranceX,toleranceY:n.dragToleranceY,slide:t,instance:this.instance}))):void("image"!==o?C(v)&&v():D(t,s,this.index,(function(){var i=t.querySelector("img");s.draggable&&new N({dragEl:i,toleranceX:n.dragToleranceX,toleranceY:n.dragToleranceY,slide:t,instance:e.instance}),s.zoomable&&i.naturalWidth>i.offsetWidth&&(d(i,"zoomable"),new q(i,t,(function(){e.instance.resize()}))),C(v)&&v()})));H.apply(this,[t,s,this.index,v])}else _.apply(this.instance,[t,s,this.index,v])}},{key:"slideShortDesc",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("div");n.innerHTML=e;var s=n.innerText,l=i;if((e=s.trim()).length<=t)return e;var o=e.substr(0,t-1);return l?(n=null,o+'... '+i+""):o}},{key:"descriptionEvents",value:function(e,t){var i=this,n=e.querySelector(".desc-more");if(!n)return!1;h("click",{onElement:n,withCallback:function(e,n){e.preventDefault();var s=document.body,l=g(n,".gslide-desc");if(!l)return!1;l.innerHTML=t.description,d(s,"gdesc-open");var o=h("click",{onElement:[s,g(l,".gslide-description")],withCallback:function(e,n){"a"!==e.target.nodeName.toLowerCase()&&(c(s,"gdesc-open"),d(s,"gdesc-closed"),l.innerHTML=t.smallDescription,i.descriptionEvents(l,t),setTimeout((function(){c(s,"gdesc-closed")}),400),o.destroy())}})}})}},{key:"create",value:function(){return y(this.instance.settings.slideHTML)}},{key:"getConfig",value:function(){E(this.element)||this.element.hasOwnProperty("draggable")||(this.element.draggable=this.instance.settings.draggable);var e=new j(this.instance.settings.slideExtraAttributes);return this.slideConfig=e.parseConfig(this.element,this.instance.settings),this.slideConfig}}]);function F(e){return Math.sqrt(e.x*e.x+e.y*e.y)}function R(e,t){var i=function(e,t){var i=F(e)*F(t);if(0===i)return 0;var n=function(e,t){return e.x*t.x+e.y*t.y}(e,t)/i;return n>1&&(n=1),Math.acos(n)}(e,t);return function(e,t){return e.x*t.y-t.x*e.y}(e,t)>0&&(i*=-1),180*i/Math.PI}var G=s((function e(t){i(this,e),this.handlers=[],this.el=t}),[{key:"add",value:function(e){this.handlers.push(e)}},{key:"del",value:function(e){e||(this.handlers=[]);for(var t=this.handlers.length;t>=0;t--)this.handlers[t]===e&&this.handlers.splice(t,1)}},{key:"dispatch",value:function(){for(var e=0,t=this.handlers.length;e=0)console.log("ignore drag for this touched element",e.target.nodeName.toLowerCase());else{this.now=Date.now(),this.x1=e.touches[0].pageX,this.y1=e.touches[0].pageY,this.delta=this.now-(this.last||this.now),this.touchStart.dispatch(e,this.element),null!==this.preTapPosition.x&&(this.isDoubleTap=this.delta>0&&this.delta<=250&&Math.abs(this.preTapPosition.x-this.x1)<30&&Math.abs(this.preTapPosition.y-this.y1)<30,this.isDoubleTap&&clearTimeout(this.singleTapTimeout)),this.preTapPosition.x=this.x1,this.preTapPosition.y=this.y1,this.last=this.now;var t=this.preV;if(e.touches.length>1){this._cancelLongTap(),this._cancelSingleTap();var i={x:e.touches[1].pageX-this.x1,y:e.touches[1].pageY-this.y1};t.x=i.x,t.y=i.y,this.pinchStartLen=F(t),this.multipointStart.dispatch(e,this.element)}this._preventTap=!1,this.longTapTimeout=setTimeout(function(){this.longTap.dispatch(e,this.element),this._preventTap=!0}.bind(this),750)}}},{key:"move",value:function(e){if(e.touches){var t=this.preV,i=e.touches.length,n=e.touches[0].pageX,s=e.touches[0].pageY;if(this.isDoubleTap=!1,i>1){var l=e.touches[1].pageX,o=e.touches[1].pageY,r={x:e.touches[1].pageX-n,y:e.touches[1].pageY-s};null!==t.x&&(this.pinchStartLen>0&&(e.zoom=F(r)/this.pinchStartLen,this.pinch.dispatch(e,this.element)),e.angle=R(r,t),this.rotate.dispatch(e,this.element)),t.x=r.x,t.y=r.y,null!==this.x2&&null!==this.sx2?(e.deltaX=(n-this.x2+l-this.sx2)/2,e.deltaY=(s-this.y2+o-this.sy2)/2):(e.deltaX=0,e.deltaY=0),this.twoFingerPressMove.dispatch(e,this.element),this.sx2=l,this.sy2=o}else{if(null!==this.x2){e.deltaX=n-this.x2,e.deltaY=s-this.y2;var a=Math.abs(this.x1-this.x2),h=Math.abs(this.y1-this.y2);(a>10||h>10)&&(this._preventTap=!0)}else e.deltaX=0,e.deltaY=0;this.pressMove.dispatch(e,this.element)}this.touchMove.dispatch(e,this.element),this._cancelLongTap(),this.x2=n,this.y2=s,i>1&&e.preventDefault()}}},{key:"end",value:function(e){if(e.changedTouches){this._cancelLongTap();var t=this;e.touches.length<2&&(this.multipointEnd.dispatch(e,this.element),this.sx2=this.sy2=null),this.x2&&Math.abs(this.x1-this.x2)>30||this.y2&&Math.abs(this.y1-this.y2)>30?(e.direction=this._swipeDirection(this.x1,this.x2,this.y1,this.y2),this.swipeTimeout=setTimeout((function(){t.swipe.dispatch(e,t.element)}),0)):(this.tapTimeout=setTimeout((function(){t._preventTap||t.tap.dispatch(e,t.element),t.isDoubleTap&&(t.doubleTap.dispatch(e,t.element),t.isDoubleTap=!1)}),0),t.isDoubleTap||(t.singleTapTimeout=setTimeout((function(){t.singleTap.dispatch(e,t.element)}),250))),this.touchEnd.dispatch(e,this.element),this.preV.x=0,this.preV.y=0,this.zoom=1,this.pinchStartLen=null,this.x1=this.x2=this.y1=this.y2=null}}},{key:"cancelAll",value:function(){this._preventTap=!0,clearTimeout(this.singleTapTimeout),clearTimeout(this.tapTimeout),clearTimeout(this.longTapTimeout),clearTimeout(this.swipeTimeout)}},{key:"cancel",value:function(e){this.cancelAll(),this.touchCancel.dispatch(e,this.element)}},{key:"_cancelLongTap",value:function(){clearTimeout(this.longTapTimeout)}},{key:"_cancelSingleTap",value:function(){clearTimeout(this.singleTapTimeout)}},{key:"_swipeDirection",value:function(e,t,i,n){return Math.abs(e-t)>=Math.abs(i-n)?e-t>0?"Left":"Right":i-n>0?"Up":"Down"}},{key:"on",value:function(e,t){this[e]&&this[e].add(t)}},{key:"off",value:function(e,t){this[e]&&this[e].del(t)}},{key:"destroy",value:function(){return this.singleTapTimeout&&clearTimeout(this.singleTapTimeout),this.tapTimeout&&clearTimeout(this.tapTimeout),this.longTapTimeout&&clearTimeout(this.longTapTimeout),this.swipeTimeout&&clearTimeout(this.swipeTimeout),this.element.removeEventListener("touchstart",this.start),this.element.removeEventListener("touchmove",this.move),this.element.removeEventListener("touchend",this.end),this.element.removeEventListener("touchcancel",this.cancel),this.rotate.del(),this.touchStart.del(),this.multipointStart.del(),this.multipointEnd.del(),this.pinch.del(),this.swipe.del(),this.tap.del(),this.doubleTap.del(),this.longTap.del(),this.singleTap.del(),this.pressMove.del(),this.twoFingerPressMove.del(),this.touchMove.del(),this.touchEnd.del(),this.touchCancel.del(),this.preV=this.pinchStartLen=this.zoom=this.isDoubleTap=this.delta=this.last=this.now=this.tapTimeout=this.singleTapTimeout=this.longTapTimeout=this.swipeTimeout=this.x1=this.x2=this.y1=this.y2=this.preTapPosition=this.rotate=this.touchStart=this.multipointStart=this.multipointEnd=this.pinch=this.swipe=this.tap=this.doubleTap=this.longTap=this.singleTap=this.pressMove=this.touchMove=this.touchEnd=this.touchCancel=this.twoFingerPressMove=null,window.removeEventListener("scroll",this._cancelAllHandler),null}}]);function $(e){var t=function(){var e,t=document.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}(),i=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=u(e,"gslide-media")?e:e.querySelector(".gslide-media"),s=g(n,".ginner-container"),l=e.querySelector(".gslide-description");i>769&&(n=s),d(n,"greset"),f(n,"translate3d(0, 0, 0)"),h(t,{onElement:n,once:!0,withCallback:function(e,t){c(n,"greset")}}),n.style.opacity="",l&&(l.style.opacity="")}function J(e){if(e.events.hasOwnProperty("touch"))return!1;var t,i,n,s=x(),l=s.width,o=s.height,r=!1,a=null,h=null,v=null,p=!1,m=1,y=1,b=!1,S=!1,w=null,T=null,C=null,k=null,E=0,A=0,L=!1,I=!1,O={},P={},M=0,z=0,X=document.getElementById("glightbox-slider"),Y=document.querySelector(".goverlay"),q=new U(X,{touchStart:function(t){if(r=!0,(u(t.targetTouches[0].target,"ginner-container")||g(t.targetTouches[0].target,".gslide-desc")||"a"==t.targetTouches[0].target.nodeName.toLowerCase())&&(r=!1),g(t.targetTouches[0].target,".gslide-inline")&&!u(t.targetTouches[0].target.parentNode,"gslide-inline")&&(r=!1),r){if(P=t.targetTouches[0],O.pageX=t.targetTouches[0].pageX,O.pageY=t.targetTouches[0].pageY,M=t.targetTouches[0].clientX,z=t.targetTouches[0].clientY,a=e.activeSlide,h=a.querySelector(".gslide-media"),n=a.querySelector(".gslide-inline"),v=null,u(h,"gslide-image")&&(v=h.querySelector("img")),(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)>769&&(h=a.querySelector(".ginner-container")),c(Y,"greset"),t.pageX>20&&t.pageXo){var a=O.pageX-P.pageX;if(Math.abs(a)<=13)return!1}p=!0;var d,c=s.targetTouches[0].clientX,u=s.targetTouches[0].clientY,g=M-c,m=z-u;if(Math.abs(g)>Math.abs(m)?(L=!1,I=!0):(I=!1,L=!0),t=P.pageX-O.pageX,E=100*t/l,i=P.pageY-O.pageY,A=100*i/o,L&&v&&(d=1-Math.abs(i)/o,Y.style.opacity=d,e.settings.touchFollowAxis&&(E=0)),I&&(d=1-Math.abs(t)/l,h.style.opacity=d,e.settings.touchFollowAxis&&(A=0)),!v)return f(h,"translate3d(".concat(E,"%, 0, 0)"));f(h,"translate3d(".concat(E,"%, ").concat(A,"%, 0)"))}},touchEnd:function(){if(r){if(p=!1,S||b)return C=w,void(k=T);var t=Math.abs(parseInt(A)),i=Math.abs(parseInt(E));if(!(t>29&&v))return t<29&&i<25?(d(Y,"greset"),Y.style.opacity=1,$(h)):void 0;e.close()}},multipointEnd:function(){setTimeout((function(){b=!1}),50)},multipointStart:function(){b=!0,m=y||1},pinch:function(e){if(!v||p)return!1;b=!0,v.scaleX=v.scaleY=m*e.zoom;var t=m*e.zoom;if(S=!0,t<=1)return S=!1,t=1,k=null,C=null,w=null,T=null,void v.setAttribute("style","");t>4.5&&(t=4.5),v.style.transform="scale3d(".concat(t,", ").concat(t,", 1)"),y=t},pressMove:function(e){if(S&&!b){var t=P.pageX-O.pageX,i=P.pageY-O.pageY;C&&(t+=C),k&&(i+=k),w=t,T=i;var n="translate3d(".concat(t,"px, ").concat(i,"px, 0)");y&&(n+=" scale3d(".concat(y,", ").concat(y,", 1)")),f(v,n)}},swipe:function(t){if(!S)if(b)b=!1;else{if("Left"==t.direction){if(e.index==e.elements.length-1)return $(h);e.nextSlide()}if("Right"==t.direction){if(0==e.index)return $(h);e.prevSlide()}}}});e.events.touch=q}var K=T(),Q=null!==T()||void 0!==document.createTouch||"ontouchstart"in window||"onmsgesturechange"in window||navigator.msMaxTouchPoints,ee=document.getElementsByTagName("html")[0],te={selector:".glightbox",elements:null,skin:"clean",theme:"clean",closeButton:!0,startAt:null,autoplayVideos:!0,autofocusVideos:!0,descPosition:"bottom",width:"900px",height:"506px",videosWidth:"960px",beforeSlideChange:null,afterSlideChange:null,beforeSlideLoad:null,afterSlideLoad:null,slideInserted:null,slideRemoved:null,slideExtraAttributes:null,onOpen:null,onClose:null,loop:!1,zoomable:!0,draggable:!0,dragAutoSnap:!1,dragToleranceX:40,dragToleranceY:65,preload:!0,oneSlidePerOpen:!1,touchNavigation:!0,touchFollowAxis:!0,keyboardNavigation:!0,closeOnOutsideClick:!0,plugins:!1,plyr:{css:"https://cdn.plyr.io/3.6.12/plyr.css",js:"https://cdn.plyr.io/3.6.12/plyr.js",config:{ratio:"16:9",fullscreen:{enabled:!0,iosNative:!0},youtube:{noCookie:!0,rel:0,showinfo:0,iv_load_policy:3},vimeo:{byline:!1,portrait:!1,title:!1,transparent:!1}}},openEffect:"zoom",closeEffect:"zoom",slideEffect:"slide",moreText:"See more",moreLength:60,cssEfects:{fade:{in:"fadeIn",out:"fadeOut"},zoom:{in:"zoomIn",out:"zoomOut"},slide:{in:"slideInRight",out:"slideOutLeft"},slideBack:{in:"slideInLeft",out:"slideOutRight"},none:{in:"none",out:"none"}},svg:{close:'',next:' ',prev:''},slideHTML:'
\n
\n
\n
\n
\n
\n
\n

\n
\n
\n
\n
\n
\n
',lightboxHTML:''},ie=s((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.customOptions=t,this.settings=o(te,t),this.effectsClasses=this.getAnimationClasses(),this.videoPlayers={},this.apiEvents=[],this.fullElementsList=!1}),[{key:"init",value:function(){var e=this,t=this.getSelector();t&&(this.baseEvents=h("click",{onElement:t,withCallback:function(t,i){t.preventDefault(),e.open(i)}})),this.elements=this.getElements()}},{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(0===this.elements.length)return!1;this.activeSlide=null,this.prevActiveSlideIndex=null,this.prevActiveSlide=null;var i=z(t)?t:this.settings.startAt;if(E(e)){var n=e.getAttribute("data-gallery");n&&(this.fullElementsList=this.elements,this.elements=this.getGalleryElements(this.elements,n)),O(i)&&(i=this.getElementIndex(e))<0&&(i=0)}z(i)||(i=0),this.build(),v(this.overlay,"none"===this.settings.openEffect?"none":this.settings.cssEfects.fade.in);var s=document.body,l=window.innerWidth-document.documentElement.clientWidth;if(l>0){var o=document.createElement("style");o.type="text/css",o.className="gcss-styles",o.innerText=".gscrollbar-fixer {margin-right: ".concat(l,"px}"),document.head.appendChild(o),d(s,"gscrollbar-fixer")}d(s,"glightbox-open"),d(ee,"glightbox-open"),K&&(d(document.body,"glightbox-mobile"),this.settings.slideEffect="slide"),this.showSlide(i,!0),1===this.elements.length?(d(this.prevButton,"glightbox-button-hidden"),d(this.nextButton,"glightbox-button-hidden")):(c(this.prevButton,"glightbox-button-hidden"),c(this.nextButton,"glightbox-button-hidden")),this.lightboxOpen=!0,this.trigger("open"),C(this.settings.onOpen)&&this.settings.onOpen(),Q&&this.settings.touchNavigation&&J(this),this.settings.keyboardNavigation&&Y(this)}},{key:"openAt",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.open(null,e)}},{key:"showSlide",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];p(this.loader),this.index=parseInt(t);var n=this.slidesContainer.querySelector(".current");n&&c(n,"current"),this.slideAnimateOut();var s=this.slidesContainer.querySelectorAll(".gslide")[t];if(u(s,"loaded"))this.slideAnimateIn(s,i),m(this.loader);else{p(this.loader);var l=this.elements[t],o={index:this.index,slide:s,slideNode:s,slideConfig:l.slideConfig,slideIndex:this.index,trigger:l.node,player:null};this.trigger("slide_before_load",o),l.instance.setContent(s,(function(){m(e.loader),e.resize(),e.slideAnimateIn(s,i),e.trigger("slide_after_load",o)}))}this.slideDescription=s.querySelector(".gslide-description"),this.slideDescriptionContained=this.slideDescription&&u(this.slideDescription.parentNode,"gslide-media"),this.settings.preload&&(this.preloadSlide(t+1),this.preloadSlide(t-1)),this.updateNavigationClasses(),this.activeSlide=s}},{key:"preloadSlide",value:function(e){var t=this;if(e<0||e>this.elements.length-1)return!1;if(O(this.elements[e]))return!1;var i=this.slidesContainer.querySelectorAll(".gslide")[e];if(u(i,"loaded"))return!1;var n=this.elements[e],s=n.type,l={index:e,slide:i,slideNode:i,slideConfig:n.slideConfig,slideIndex:e,trigger:n.node,player:null};this.trigger("slide_before_load",l),"video"===s||"external"===s?setTimeout((function(){n.instance.setContent(i,(function(){t.trigger("slide_after_load",l)}))}),200):n.instance.setContent(i,(function(){t.trigger("slide_after_load",l)}))}},{key:"prevSlide",value:function(){this.goToSlide(this.index-1)}},{key:"nextSlide",value:function(){this.goToSlide(this.index+1)}},{key:"goToSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.prevActiveSlide=this.activeSlide,this.prevActiveSlideIndex=this.index,!this.loop()&&(e<0||e>this.elements.length-1))return!1;e<0?e=this.elements.length-1:e>=this.elements.length&&(e=0),this.showSlide(e)}},{key:"insertSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;t<0&&(t=this.elements.length);var i=new V(e,this,t),n=i.getConfig(),s=o({},n),l=i.create(),r=this.elements.length-1;s.index=t,s.node=!1,s.instance=i,s.slideConfig=n,this.elements.splice(t,0,s);var a=null,h=null;if(this.slidesContainer){if(t>r)this.slidesContainer.appendChild(l);else{var d=this.slidesContainer.querySelectorAll(".gslide")[t];this.slidesContainer.insertBefore(l,d)}(this.settings.preload&&0==this.index&&0==t||this.index-1==t||this.index+1==t)&&this.preloadSlide(t),0===this.index&&0===t&&(this.index=1),this.updateNavigationClasses(),a=this.slidesContainer.querySelectorAll(".gslide")[t],h=this.getSlidePlayerInstance(t),s.slideNode=a}this.trigger("slide_inserted",{index:t,slide:a,slideNode:a,slideConfig:n,slideIndex:t,trigger:null,player:h}),C(this.settings.slideInserted)&&this.settings.slideInserted({index:t,slide:a,player:h})}},{key:"removeSlide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(e<0||e>this.elements.length-1)return!1;var t=this.slidesContainer&&this.slidesContainer.querySelectorAll(".gslide")[e];t&&(this.getActiveSlideIndex()==e&&(e==this.elements.length-1?this.prevSlide():this.nextSlide()),t.parentNode.removeChild(t)),this.elements.splice(e,1),this.trigger("slide_removed",e),C(this.settings.slideRemoved)&&this.settings.slideRemoved(e)}},{key:"slideAnimateIn",value:function(e,t){var i=this,n=e.querySelector(".gslide-media"),s=e.querySelector(".gslide-description"),l={index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlide,slideConfig:O(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:O(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},o={index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideConfig:this.elements[this.index].slideConfig,slideIndex:this.index,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)};if(n.offsetWidth>0&&s&&(m(s),s.style.display=""),c(e,this.effectsClasses),t)v(e,this.settings.cssEfects[this.settings.openEffect].in,(function(){i.settings.autoplayVideos&&i.slidePlayerPlay(e),i.trigger("slide_changed",{prev:l,current:o}),C(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,o])}));else{var r=this.settings.slideEffect,a="none"!==r?this.settings.cssEfects[r].in:r;this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(a=this.settings.cssEfects.slideBack.in),v(e,a,(function(){i.settings.autoplayVideos&&i.slidePlayerPlay(e),i.trigger("slide_changed",{prev:l,current:o}),C(i.settings.afterSlideChange)&&i.settings.afterSlideChange.apply(i,[l,o])}))}setTimeout((function(){i.resize(e)}),100),d(e,"current")}},{key:"slideAnimateOut",value:function(){if(!this.prevActiveSlide)return!1;var e=this.prevActiveSlide;c(e,this.effectsClasses),d(e,"prev");var t=this.settings.slideEffect,i="none"!==t?this.settings.cssEfects[t].out:t;this.slidePlayerPause(e),this.trigger("slide_before_change",{prev:{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,slideNode:this.prevActiveSlide,slideIndex:this.prevActiveSlideIndex,slideConfig:O(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].slideConfig,trigger:O(this.prevActiveSlideIndex)?null:this.elements[this.prevActiveSlideIndex].node,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},current:{index:this.index,slide:this.activeSlide,slideNode:this.activeSlide,slideIndex:this.index,slideConfig:this.elements[this.index].slideConfig,trigger:this.elements[this.index].node,player:this.getSlidePlayerInstance(this.index)}}),C(this.settings.beforeSlideChange)&&this.settings.beforeSlideChange.apply(this,[{index:this.prevActiveSlideIndex,slide:this.prevActiveSlide,player:this.getSlidePlayerInstance(this.prevActiveSlideIndex)},{index:this.index,slide:this.activeSlide,player:this.getSlidePlayerInstance(this.index)}]),this.prevActiveSlideIndex>this.index&&"slide"==this.settings.slideEffect&&(i=this.settings.cssEfects.slideBack.out),v(e,i,(function(){var t=e.querySelector(".ginner-container"),i=e.querySelector(".gslide-media"),n=e.querySelector(".gslide-description");t.style.transform="",i.style.transform="",c(i,"greset"),i.style.opacity="",n&&(n.style.opacity=""),c(e,"prev")}))}},{key:"getAllPlayers",value:function(){return this.videoPlayers}},{key:"getSlidePlayerInstance",value:function(e){var t="gvideo"+e,i=this.getAllPlayers();return!(!P(i,t)||!i[t])&&i[t]}},{key:"stopSlideVideo",value:function(e){if(E(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}console.log("stopSlideVideo is deprecated, use slidePlayerPause");var i=this.getSlidePlayerInstance(e);i&&i.playing&&i.pause()}},{key:"slidePlayerPause",value:function(e){if(E(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}var i=this.getSlidePlayerInstance(e);i&&i.playing&&i.pause()}},{key:"playSlideVideo",value:function(e){if(E(e)){var t=e.querySelector(".gvideo-wrapper");t&&(e=t.getAttribute("data-index"))}console.log("playSlideVideo is deprecated, use slidePlayerPlay");var i=this.getSlidePlayerInstance(e);i&&!i.playing&&i.play()}},{key:"slidePlayerPlay",value:function(e){var t;if(!K||null!==(t=this.settings.plyr.config)&&void 0!==t&&t.muted){if(E(e)){var i=e.querySelector(".gvideo-wrapper");i&&(e=i.getAttribute("data-index"))}var n=this.getSlidePlayerInstance(e);n&&!n.playing&&(n.play(),this.settings.autofocusVideos&&n.elements.container.focus())}}},{key:"setElements",value:function(e){var t=this;this.settings.elements=!1;var i=[];e&&e.length&&r(e,(function(e,n){var s=new V(e,t,n),l=s.getConfig(),r=o({},l);r.slideConfig=l,r.instance=s,r.index=n,i.push(r)})),this.elements=i,this.lightboxOpen&&(this.slidesContainer.innerHTML="",this.elements.length&&(r(this.elements,(function(){var e=y(t.settings.slideHTML);t.slidesContainer.appendChild(e)})),this.showSlide(0,!0)))}},{key:"getElementIndex",value:function(e){var t=!1;return r(this.elements,(function(i,n){if(P(i,"node")&&i.node==e)return t=n,!0})),t}},{key:"getElements",value:function(){var e=this,t=[];this.elements=this.elements?this.elements:[],!O(this.settings.elements)&&A(this.settings.elements)&&this.settings.elements.length&&r(this.settings.elements,(function(i,n){var s=new V(i,e,n),l=s.getConfig(),r=o({},l);r.node=!1,r.index=n,r.instance=s,r.slideConfig=l,t.push(r)}));var i=!1;return this.getSelector()&&(i=document.querySelectorAll(this.getSelector())),i?(r(i,(function(i,n){var s=new V(i,e,n),l=s.getConfig(),r=o({},l);r.node=i,r.index=n,r.instance=s,r.slideConfig=l,r.gallery=i.getAttribute("data-gallery"),t.push(r)})),t):t}},{key:"getGalleryElements",value:function(e,t){return e.filter((function(e){return e.gallery==t}))}},{key:"getSelector",value:function(){return!this.settings.elements&&(this.settings.selector&&"data-"==this.settings.selector.substring(0,5)?"*[".concat(this.settings.selector,"]"):this.settings.selector)}},{key:"getActiveSlide",value:function(){return this.slidesContainer.querySelectorAll(".gslide")[this.index]}},{key:"getActiveSlideIndex",value:function(){return this.index}},{key:"getAnimationClasses",value:function(){var e=[];for(var t in this.settings.cssEfects)if(this.settings.cssEfects.hasOwnProperty(t)){var i=this.settings.cssEfects[t];e.push("g".concat(i.in)),e.push("g".concat(i.out))}return e.join(" ")}},{key:"build",value:function(){var e=this;if(this.built)return!1;var t=document.body.childNodes,i=[];r(t,(function(e){e.parentNode==document.body&&"#"!==e.nodeName.charAt(0)&&e.hasAttribute&&!e.hasAttribute("aria-hidden")&&(i.push(e),e.setAttribute("aria-hidden","true"))}));var n=P(this.settings.svg,"next")?this.settings.svg.next:"",s=P(this.settings.svg,"prev")?this.settings.svg.prev:"",l=P(this.settings.svg,"close")?this.settings.svg.close:"",o=this.settings.lightboxHTML;o=y(o=(o=(o=o.replace(/{nextSVG}/g,n)).replace(/{prevSVG}/g,s)).replace(/{closeSVG}/g,l)),document.body.appendChild(o);var a=document.getElementById("glightbox-body");this.modal=a;var c=a.querySelector(".gclose");this.prevButton=a.querySelector(".gprev"),this.nextButton=a.querySelector(".gnext"),this.overlay=a.querySelector(".goverlay"),this.loader=a.querySelector(".gloader"),this.slidesContainer=document.getElementById("glightbox-slider"),this.bodyHiddenChildElms=i,this.events={},d(this.modal,"glightbox-"+this.settings.skin),this.settings.closeButton&&c&&(this.events.close=h("click",{onElement:c,withCallback:function(t,i){t.preventDefault(),e.close()}})),c&&!this.settings.closeButton&&c.parentNode.removeChild(c),this.nextButton&&(this.events.next=h("click",{onElement:this.nextButton,withCallback:function(t,i){t.preventDefault(),e.nextSlide()}})),this.prevButton&&(this.events.prev=h("click",{onElement:this.prevButton,withCallback:function(t,i){t.preventDefault(),e.prevSlide()}})),this.settings.closeOnOutsideClick&&(this.events.outClose=h("click",{onElement:a,withCallback:function(t,i){e.preventOutsideClick||u(document.body,"glightbox-mobile")||g(t.target,".ginner-container")||g(t.target,".gbtn")||u(t.target,"gnext")||u(t.target,"gprev")||e.close()}})),r(this.elements,(function(t,i){e.slidesContainer.appendChild(t.instance.create()),t.slideNode=e.slidesContainer.querySelectorAll(".gslide")[i]})),Q&&d(document.body,"glightbox-touch"),this.events.resize=h("resize",{onElement:window,withCallback:function(){e.resize()}}),this.built=!0}},{key:"resize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if((e=e||this.activeSlide)&&!u(e,"zoomed")){var t=x(),i=e.querySelector(".gvideo-wrapper"),n=e.querySelector(".gslide-image"),s=this.slideDescription,l=t.width,o=t.height;if(l<=768?d(document.body,"glightbox-mobile"):c(document.body,"glightbox-mobile"),i||n){var r=!1;if(s&&(u(s,"description-bottom")||u(s,"description-top"))&&!u(s,"gabsolute")&&(r=!0),n)if(l<=768)n.querySelector("img");else if(r){var a,h=s.offsetHeight,g=n.querySelector("img"),v=this.elements[this.index].node,f=null!==(a=v.getAttribute("data-height"))&&void 0!==a?a:"100vh";g.setAttribute("style","max-height: calc(".concat(f," - ").concat(h,"px)")),s.setAttribute("style","max-width: ".concat(g.offsetWidth,"px;"))}if(i){var p=P(this.settings.plyr.config,"ratio")?this.settings.plyr.config.ratio:"";if(!p){var m=i.clientWidth,y=i.clientHeight,b=m/y;p="".concat(m/b,":").concat(y/b)}var S=p.split(":"),w=this.settings.videosWidth,T=this.settings.videosWidth,C=(T=z(w)||-1!==w.indexOf("px")?parseInt(w):-1!==w.indexOf("vw")?l*parseInt(w)/100:-1!==w.indexOf("vh")?o*parseInt(w)/100:-1!==w.indexOf("%")?l*parseInt(w)/100:parseInt(i.clientWidth))/(parseInt(S[0])/parseInt(S[1]));if(C=Math.floor(C),r&&(o-=s.offsetHeight),T>l||C>o||oT){var k=i.offsetWidth,E=i.offsetHeight,A=o/E,L={width:k*A,height:E*A};i.parentNode.setAttribute("style","max-width: ".concat(L.width,"px")),r&&s.setAttribute("style","max-width: ".concat(L.width,"px;"))}else i.parentNode.style.maxWidth="".concat(w),r&&s.setAttribute("style","max-width: ".concat(w,";"))}}}}},{key:"reload",value:function(){this.init()}},{key:"updateNavigationClasses",value:function(){var e=this.loop();c(this.nextButton,"disabled"),c(this.prevButton,"disabled"),0==this.index&&this.elements.length-1==0?(d(this.prevButton,"disabled"),d(this.nextButton,"disabled")):0!==this.index||e?this.index!==this.elements.length-1||e||d(this.nextButton,"disabled"):d(this.prevButton,"disabled")}},{key:"loop",value:function(){var e=P(this.settings,"loopAtEnd")?this.settings.loopAtEnd:null;return e=P(this.settings,"loop")?this.settings.loop:e,e}},{key:"close",value:function(){var e=this;if(!this.lightboxOpen){if(this.events){for(var t in this.events)this.events.hasOwnProperty(t)&&this.events[t].destroy();this.events=null}return!1}if(this.closing)return!1;this.closing=!0,this.slidePlayerPause(this.activeSlide),this.fullElementsList&&(this.elements=this.fullElementsList),this.bodyHiddenChildElms.length&&r(this.bodyHiddenChildElms,(function(e){e.removeAttribute("aria-hidden")})),d(this.modal,"glightbox-closing"),v(this.overlay,"none"==this.settings.openEffect?"none":this.settings.cssEfects.fade.out),v(this.activeSlide,this.settings.cssEfects[this.settings.closeEffect].out,(function(){if(e.activeSlide=null,e.prevActiveSlideIndex=null,e.prevActiveSlide=null,e.built=!1,e.events){for(var t in e.events)e.events.hasOwnProperty(t)&&e.events[t].destroy();e.events=null}var i=document.body;c(ee,"glightbox-open"),c(i,"glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer"),e.modal.parentNode.removeChild(e.modal),e.trigger("close"),C(e.settings.onClose)&&e.settings.onClose();var n=document.querySelector(".gcss-styles");n&&n.parentNode.removeChild(n),e.lightboxOpen=!1,e.closing=null}))}},{key:"destroy",value:function(){this.close(),this.clearAllEvents(),this.baseEvents&&this.baseEvents.destroy()}},{key:"on",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e||!C(t))throw new TypeError("Event name and callback must be defined");this.apiEvents.push({evt:e,once:i,callback:t})}},{key:"once",value:function(e,t){this.on(e,t,!0)}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=[];r(this.apiEvents,(function(t,s){var l=t.evt,o=t.once,r=t.callback;l==e&&(r(i),o&&n.push(s))})),n.length&&r(n,(function(e){return t.apiEvents.splice(e,1)}))}},{key:"clearAllEvents",value:function(){this.apiEvents.splice(0,this.apiEvents.length)}},{key:"version",value:function(){return"3.3.0"}}]);return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new ie(e);return t.init(),t}})); \ No newline at end of file diff --git a/package.json b/package.json index bc03d29..ff46114 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "glightbox", - "version": "3.2.0", + "version": "3.3.0", "description": "Pure Javascript lightbox", "main": "dist/js/glightbox.min.js", "scripts": { @@ -51,4 +51,4 @@ "uninstall": "0.0.0" }, "dependencies": {} -} +} \ No newline at end of file diff --git a/src/js/glightbox.js b/src/js/glightbox.js index 410928f..b680f68 100644 --- a/src/js/glightbox.js +++ b/src/js/glightbox.js @@ -6,11 +6,11 @@ */ import keyboardNavigation from './core/keyboard-navigation.js'; -import touchNavigation from './core/touch-navigation.js'; import Slide from './core/slide.js'; +import touchNavigation from './core/touch-navigation.js'; import * as _ from './utils/helpers.js'; -const version = '3.2.0'; +const version = '3.3.0'; const isMobile = _.isMobile(); const isTouch = _.isTouch(); const html = document.getElementsByTagName('html')[0];