PageSourceSearch

https://archons.org/wp-content/plugins/flickr-sync-plugin//assets/…?ver=8330481dbc135a31428bb963061dcc2b

js archons.org collected 2026-09-24 22:01:21 UTC 112,691 bytes, 3,091 lines download raw bytes

vendor: 112,691 bytes, lines 1-3091
1(function (global, factory) {
2  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3  typeof define === 'function' && define.amd ? define(factory) :
4  (global = global || self, global.GLightbox = factory());
5}(this, (function () { 'use strict';
6
7  function _toPrimitive(t, r) {
8    if ("object" != typeof t || !t) return t;
9    var e = t[Symbol.toPrimitive];
10    if (void 0 !== e) {
11      var i = e.call(t, r || "default");
12      if ("object" != typeof i) return i;
13      throw new TypeError("@@toPrimitive must return a primitive value.");
14    }
15    return ("string" === r ? String : Number)(t);
16  }
17  function _toPropertyKey(t) {
18    var i = _toPrimitive(t, "string");
19    return "symbol" == typeof i ? i : i + "";
20  }
21  function _typeof(o) {
22    "@babel/helpers - typeof";
23
24    return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
25      return typeof o;
26    } : function (o) {
27      return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
28    }, _typeof(o);
29  }
30  function _classCallCheck(instance, Constructor) {
31    if (!(instance instanceof Constructor)) {
32      throw new TypeError("Cannot call a class as a function");
33    }
34  }
35  function _defineProperties(target, props) {
36    for (var i = 0; i < props.length; i++) {
37      var descriptor = props[i];
38      descriptor.enumerable = descriptor.enumerable || false;
39      descriptor.configurable = true;
40      if ("value" in descriptor) descriptor.writable = true;
41      Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
42    }
43  }
44  function _createClass(Constructor, protoProps, staticProps) {
45    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
46    if (staticProps) _defineProperties(Constructor, staticProps);
47    Object.defineProperty(Constructor, "prototype", {
48      writable: false
49    });
50    return Constructor;
51  }
52
53  var uid = Date.now();
54  function extend() {
55    var extended = {};
56    var deep = true;
57    var i = 0;
58    var length = arguments.length;
59    if (Object.prototype.toString.call(arguments[0]) === '[object Boolean]') {
60      deep = arguments[0];
61      i++;
62    }
63    var merge = function merge(obj) {
64      for (var prop in obj) {
65        if (Object.prototype.hasOwnProperty.call(obj, prop)) {
66          if (deep && Object.prototype.toString.call(obj[prop]) === '[object Object]') {
67            extended[prop] = extend(true, extended[prop], obj[prop]);
68          } else {
69            extended[prop] = obj[prop];
70          }
71        }
72      }
73    };
74    for (; i < length; i++) {
75      var obj = arguments[i];
76      merge(obj);
77    }
78    return extended;
79  }
80  function each(collection, callback) {
81    if (isNode(collection) || collection === window || collection === document) {
82      collection = [collection];
83    }
84    if (!isArrayLike(collection) && !isObject(collection)) {
85      collection = [collection];
86    }
87    if (size(collection) == 0) {
88      return;
89    }
90    if (isArrayLike(collection) && !isObject(collection)) {
91      var l = collection.length,
92        i = 0;
93      for (; i < l; i++) {
94        if (callback.call(collection[i], collection[i], i, collection) === false) {
95          break;
96        }
97      }
98    } else if (isObject(collection)) {
99      for (var key in collection) {
100        if (has(collection, key)) {
101          if (callback.call(collection[key], collection[key], key, collection) === false) {
102            break;
103          }
104        }
105      }
106    }
107  }
108  function getNodeEvents(node) {
109    var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
110    var fn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
111    var cache = node[uid] = node[uid] || [];
112    var data = {
113      all: cache,
114      evt: null,
115      found: null
116    };
117    if (name && fn && size(cache) > 0) {
118      each(cache, function (cl, i) {
119        if (cl.eventName == name && cl.fn.toString() == fn.toString()) {
120          data.found = true;
121          data.evt = i;
122          return false;
123        }
124      });
125    }
126    return data;
127  }
128  function addEvent(eventName) {
129    var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
130      onElement = _ref.onElement,
131      withCallback = _ref.withCallback,
132      _ref$avoidDuplicate = _ref.avoidDuplicate,
133      avoidDuplicate = _ref$avoidDuplicate === void 0 ? true : _ref$avoidDuplicate,
134      _ref$once = _ref.once,
135      once = _ref$once === void 0 ? false : _ref$once,
136      _ref$useCapture = _ref.useCapture,
137      useCapture = _ref$useCapture === void 0 ? false : _ref$useCapture;
138    var thisArg = arguments.length > 2 ? arguments[2] : undefined;
139    var element = onElement || [];
140    if (isString(element)) {
141      element = document.querySelectorAll(element);
142    }
143    function handler(event) {
144      if (isFunction(withCallback)) {
145        withCallback.call(thisArg, event, this);
146      }
147      if (once) {
148        handler.destroy();
149      }
150    }
151    handler.destroy = function () {
152      each(element, function (el) {
153        var events = getNodeEvents(el, eventName, handler);
154        if (events.found) {
155          events.all.splice(events.evt, 1);
156        }
157        if (el.removeEventListener) {
158          el.removeEventListener(eventName, handler, useCapture);
159        }
160      });
161    };
162    each(element, function (el) {
163      var events = getNodeEvents(el, eventName, handler);
164      if (el.addEventListener && avoidDuplicate && !events.found || !avoidDuplicate) {
165        el.addEventListener(eventName, handler, useCapture);
166        events.all.push({
167          eventName: eventName,
168          fn: handler
169        });
170      }
171    });
172    return handler;
173  }
174  function addClass(node, name) {
175    each(name.split(' '), function (cl) {
176      return node.classList.add(cl);
177    });
178  }
179  function removeClass(node, name) {
180    each(name.split(' '), function (cl) {
181      return node.classList.remove(cl);
182    });
183  }
184  function hasClass(node, name) {
185    return node.classList.contains(name);
186  }
187  function closest(elem, selector) {
188    while (elem !== document.body) {
189      elem = elem.parentElement;
190      if (!elem) {
191        return false;
192      }
193      var matches = typeof elem.matches == 'function' ? elem.matches(selector) : elem.msMatchesSelector(selector);
194      if (matches) {
195        return elem;
196      }
197    }
198  }
199  function animateElement(element) {
200    var animation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
201    var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
202    if (!element || animation === '') {
203      return false;
204    }
205    if (animation === 'none') {
206      if (isFunction(callback)) {
207        callback();
208      }
209      return false;
210    }
211    var animationEnd = whichAnimationEvent();
212    var animationNames = animation.split(' ');
213    each(animationNames, function (name) {
214      addClass(element, 'g' + name);
215    });
216    addEvent(animationEnd, {
217      onElement: element,
218      avoidDuplicate: false,
219      once: true,
220      withCallback: function withCallback(event, target) {
221        each(animationNames, function (name) {
222          removeClass(target, 'g' + name);
223        });
224        if (isFunction(callback)) {
225          callback();
226        }
227      }
228    });
229  }
230  function cssTransform(node) {
231    var translate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
232    if (translate === '') {
233      node.style.webkitTransform = '';
234      node.style.MozTransform = '';
235      node.style.msTransform = '';
236      node.style.OTransform = '';
237      node.style.transform = '';
238      return false;
239    }
240    node.style.webkitTransform = translate;
241    node.style.MozTransform = translate;
242    node.style.msTransform = translate;
243    node.style.OTransform = translate;
244    node.style.transform = translate;
245  }
246  function show(element) {
247    element.style.display = 'block';
248  }
249  function hide(element) {
250    element.style.display = 'none';
251  }
252  function createHTML(htmlStr) {
253    var frag = document.createDocumentFragment(),
254      temp = document.createElement('div');
255    temp.innerHTML = htmlStr;
256    while (temp.firstChild) {
257      frag.appendChild(temp.firstChild);
258    }
259    return frag;
260  }
261  function windowSize() {
262    return {
263      width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
264      height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
265    };
266  }
267  function whichAnimationEvent() {
268    var t,
269      el = document.createElement('fakeelement');
270    var animations = {
271      animation: 'animationend',
272      OAnimation: 'oAnimationEnd',
273      MozAnimation: 'animationend',
274      WebkitAnimation: 'webkitAnimationEnd'
275    };
276    for (t in animations) {
277      if (el.style[t] !== undefined) {
278        return animations[t];
279      }
280    }
281  }
282  function whichTransitionEvent() {
283    var t,
284      el = document.createElement('fakeelement');
285    var transitions = {
286      transition: 'transitionend',
287      OTransition: 'oTransitionEnd',
288      MozTransition: 'transitionend',
289      WebkitTransition: 'webkitTransitionEnd'
290    };
291    for (t in transitions) {
292      if (el.style[t] !== undefined) {
293        return transitions[t];
294      }
295    }
296  }
297  function createIframe(config) {
298    var url = config.url,
299      allow = config.allow,
300      callback = config.callback,
301      appendTo = config.appendTo;
302    var iframe = document.createElement('iframe');
303    iframe.className = 'vimeo-video gvideo';
304    iframe.src = url;
305    iframe.style.width = '100%';
306    iframe.style.height = '100%';
307    if (allow) {
308      iframe.setAttribute('allow', allow);
309    }
310    iframe.onload = function () {
311      iframe.onload = null;
312      addClass(iframe, 'node-ready');
313      if (isFunction(callback)) {
314        callback();
315      }
316    };
317    if (appendTo) {
318      appendTo.appendChild(iframe);
319    }
320    return iframe;
321  }
322  function waitUntil(check, onComplete, delay, timeout) {
323    if (check()) {
324      onComplete();
325      return;
326    }
327    if (!delay) {
328      delay = 100;
329    }
330    var timeoutPointer;
331    var intervalPointer = setInterval(function () {
332      if (!check()) {
333        return;
334      }
335      clearInterval(intervalPointer);
336      if (timeoutPointer) {
337        clearTimeout(timeoutPointer);
338      }
339      onComplete();
340    }, delay);
341    if (timeout) {
342      timeoutPointer = setTimeout(function () {
343        clearInterval(intervalPointer);
344      }, timeout);
345    }
346  }
347  function injectAssets(url, waitFor, callback) {
348    if (isNil(url)) {
349      console.error('Inject assets error');
350      return;
351    }
352    if (isFunction(waitFor)) {
353      callback = waitFor;
354      waitFor = false;
355    }
356    if (isString(waitFor) && waitFor in window) {
357      if (isFunction(callback)) {
358        callback();
359      }
360      return;
361    }
362    var found;
363    if (url.indexOf('.css') !== -1) {
364      found = document.querySelectorAll('link[href="' + url + '"]');
365      if (found && found.length > 0) {
366        if (isFunction(callback)) {
367          callback();
368        }
369        return;
370      }
371      var head = document.getElementsByTagName('head')[0];
372      var headStyles = head.querySelectorAll('link[rel="stylesheet"]');
373      var link = document.createElement('link');
374      link.rel = 'stylesheet';
375      link.type = 'text/css';
376      link.href = url;
377      link.media = 'all';
378      if (headStyles) {
379        head.insertBefore(link, headStyles[0]);
380      } else {
381        head.appendChild(link);
382      }
383      if (isFunction(callback)) {
384        callback();
385      }
386      return;
387    }
388    found = document.querySelectorAll('script[src="' + url + '"]');
389    if (found && found.length > 0) {
390      if (isFunction(callback)) {
391        if (isString(waitFor)) {
392          waitUntil(function () {
393            return typeof window[waitFor] !== 'undefined';
394          }, function () {
395            callback();
396          });
397          return false;
398        }
399        callback();
400      }
401      return;
402    }
403    var script = document.createElement('script');
404    script.type = 'text/javascript';
405    script.src = url;
406    script.onload = function () {
407      if (isFunction(callback)) {
408        if (isString(waitFor)) {
409          waitUntil(function () {
410            return typeof window[waitFor] !== 'undefined';
411          }, function () {
412            callback();
413          });
414          return false;
415        }
416        callback();
417      }
418    };
419    document.body.appendChild(script);
420  }
421  function isMobile() {
422    return 'navigator' in window && window.navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i);
423  }
424  function isTouch() {
425    return isMobile() !== null || document.createTouch !== undefined || 'ontouchstart' in window || 'onmsgesturechange' in window || navigator.msMaxTouchPoints;
426  }
427  function isFunction(f) {
428    return typeof f === 'function';
429  }
430  function isString(s) {
431    return typeof s === 'string';
432  }
433  function isNode(el) {
434    return !!(el && el.nodeType && el.nodeType == 1);
435  }
436  function isArray(ar) {
437    return Array.isArray(ar);
438  }
439  function isArrayLike(ar) {
440    return ar && ar.length && isFinite(ar.length);
441  }
442  function isObject(o) {
443    var type = _typeof(o);
444    return type === 'object' && o != null && !isFunction(o) && !isArray(o);
445  }
446  function isNil(o) {
447    return o == null;
448  }
449  function has(obj, key) {
450    return obj !== null && hasOwnProperty.call(obj, key);
451  }
452  function size(o) {
453    if (isObject(o)) {
454      if (o.keys) {
455        return o.keys().length;
456      }
457      var l = 0;
458      for (var k in o) {
459        if (has(o, k)) {
460          l++;
461        }
462      }
463      return l;
464    } else {
465      return o.length;
466    }
467  }
468  function isNumber(n) {
469    return !isNaN(parseFloat(n)) && isFinite(n);
470  }
471
472  function getNextFocusElement() {
473    var current = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
474    var btns = document.querySelectorAll('.gbtn[data-taborder]:not(.disabled)');
475    if (!btns.length) {
476      return false;
477    }
478    if (btns.length == 1) {
479      return btns[0];
480    }
481    if (typeof current == 'string') {
482      current = parseInt(current);
483    }
484    var orders = [];
485    each(btns, function (btn) {
486      orders.push(btn.getAttribute('data-taborder'));
487    });
488    var highestOrder = Math.max.apply(Math, orders.map(function (order) {
489      return parseInt(order);
490    }));
491    var newIndex = current < 0 ? 1 : current + 1;
492    if (newIndex > highestOrder) {
493      newIndex = '1';
494    }
495    var nextOrders = orders.filter(function (el) {
496      return el >= parseInt(newIndex);
497    });
498    var nextFocus = nextOrders.sort()[0];
499    return document.querySelector(".gbtn[data-taborder=\"".concat(nextFocus, "\"]"));
500  }
501  function keyboardNavigation(instance) {
502    if (instance.events.hasOwnProperty('keyboard')) {
503      return false;
504    }
505    instance.events['keyboard'] = addEvent('keydown', {
506      onElement: window,
507      withCallback: function withCallback(event, target) {
508        event = event || window.event;
509        var key = event.keyCode;
510        if (key == 9) {
511          var focusedButton = document.querySelector('.gbtn.focused');
512          if (!focusedButton) {
513            var activeElement = document.activeElement && document.activeElement.nodeName ? document.activeElement.nodeName.toLocaleLowerCase() : false;
514            if (activeElement == 'input' || activeElement == 'textarea' || activeElement == 'button') {
515              return;
516            }
517          }
518          event.preventDefault();
519          var btns = document.querySelectorAll('.gbtn[data-taborder]');
520          if (!btns || btns.length <= 0) {
521            return;
522          }
523          if (!focusedButton) {
524            var first = getNextFocusElement();
525            if (first) {
526              first.focus();
527              addClass(first, 'focused');
528            }
529            return;
530          }
531          var currentFocusOrder = focusedButton.getAttribute('data-taborder');
532          var nextFocus = getNextFocusElement(currentFocusOrder);
533          removeClass(focusedButton, 'focused');
534          if (nextFocus) {
535            nextFocus.focus();
536            addClass(nextFocus, 'focused');
537          }
538        }
539        if (key == 39) {
540          instance.nextSlide();
541        }
542        if (key == 37) {
543          instance.prevSlide();
544        }
545        if (key == 27) {
546          instance.close();
547        }
548      }
549    });
550  }
551
552  var ZoomImages = function () {
553    function ZoomImages(el, slide) {
554      var _this = this;
555      var onclose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
556      _classCallCheck(this, ZoomImages);
557      this.img = el;
558      this.slide = slide;
559      this.onclose = onclose;
560      if (this.img.setZoomEvents) {
561        return false;
562      }
563      this.active = false;
564      this.zoomedIn = false;
565      this.dragging = false;
566      this.currentX = null;
567      this.currentY = null;
568      this.initialX = null;
569      this.initialY = null;
570      this.xOffset = 0;
571      this.yOffset = 0;
572      this.img.addEventListener('mousedown', function (e) {
573        return _this.dragStart(e);
574      }, false);
575      this.img.addEventListener('mouseup', function (e) {
576        return _this.dragEnd(e);
577      }, false);
578      this.img.addEventListener('mousemove', function (e) {
579        return _this.drag(e);
580      }, false);
581      this.img.addEventListener('click', function (e) {
582        if (_this.slide.classList.contains('dragging-nav')) {
583          _this.zoomOut();
584          return false;
585        }
586        if (!_this.zoomedIn) {
587          return _this.zoomIn();
588        }
589        if (_this.zoomedIn && !_this.dragging) {
590          _this.zoomOut();
591        }
592      }, false);
593      this.img.setZoomEvents = true;
594    }
595    return _createClass(ZoomImages, [{
596      key: "zoomIn",
597      value: function zoomIn() {
598        var winWidth = this.widowWidth();
599        if (this.zoomedIn || winWidth <= 768) {
600          return;
601        }
602        var img = this.img;
603        img.setAttribute('data-style', img.getAttribute('style'));
604        img.style.maxWidth = img.naturalWidth + 'px';
605        img.style.maxHeight = img.naturalHeight + 'px';
606        if (img.naturalWidth > winWidth) {
607          var centerX = winWidth / 2 - img.naturalWidth / 2;
608          this.setTranslate(this.img.parentNode, centerX, 0);
609        }
610        this.slide.classList.add('zoomed');
611        this.zoomedIn = true;
612      }
613    }, {
614      key: "zoomOut",
615      value: function zoomOut() {
616        this.img.parentNode.setAttribute('style', '');
617        this.img.setAttribute('style', this.img.getAttribute('data-style'));
618        this.slide.classList.remove('zoomed');
619        this.zoomedIn = false;
620        this.currentX = null;
621        this.currentY = null;
622        this.initialX = null;
623        this.initialY = null;
624        this.xOffset = 0;
625        this.yOffset = 0;
626        if (this.onclose && typeof this.onclose == 'function') {
627          this.onclose();
628        }
629      }
630    }, {
631      key: "dragStart",
632      value: function dragStart(e) {
633        e.preventDefault();
634        if (!this.zoomedIn) {
635          this.active = false;
636          return;
637        }
638        if (e.type === 'touchstart') {
639          this.initialX = e.touches[0].clientX - this.xOffset;
640          this.initialY = e.touches[0].clientY - this.yOffset;
641        } else {
642          this.initialX = e.clientX - this.xOffset;
643          this.initialY = e.clientY - this.yOffset;
644        }
645        if (e.target === this.img) {
646          this.active = true;
647          this.img.classList.add('dragging');
648        }
649      }
650    }, {
651      key: "dragEnd",
652      value: function dragEnd(e) {
653        var _this2 = this;
654        e.preventDefault();
655        this.initialX = this.currentX;
656        this.initialY = this.currentY;
657        this.active = false;
658        setTimeout(function () {
659          _this2.dragging = false;
660          _this2.img.isDragging = false;
661          _this2.img.classList.remove('dragging');
662        }, 100);
663      }
664    }, {
665      key: "drag",
666      value: function drag(e) {
667        if (this.active) {
668          e.preventDefault();
669          if (e.type === 'touchmove') {
670            this.currentX = e.touches[0].clientX - this.initialX;
671            this.currentY = e.touches[0].clientY - this.initialY;
672          } else {
673            this.currentX = e.clientX - this.initialX;
674            this.currentY = e.clientY - this.initialY;
675          }
676          this.xOffset = this.currentX;
677          this.yOffset = this.currentY;
678          this.img.isDragging = true;
679          this.dragging = true;
680          this.setTranslate(this.img, this.currentX, this.currentY);
681        }
682      }
683    }, {
684      key: "onMove",
685      value: function onMove(e) {
686        if (!this.zoomedIn) {
687          return;
688        }
689        var xOffset = e.clientX - this.img.naturalWidth / 2;
690        var yOffset = e.clientY - this.img.naturalHeight / 2;
691        this.setTranslate(this.img, xOffset, yOffset);
692      }
693    }, {
694      key: "setTranslate",
695      value: function setTranslate(node, xPos, yPos) {
696        node.style.transform = 'translate3d(' + xPos + 'px, ' + yPos + 'px, 0)';
697      }
698    }, {
699      key: "widowWidth",
700      value: function widowWidth() {
701        return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
702      }
703    }]);
704  }();
705
706  var DragSlides = function () {
707    function DragSlides() {
708      var _this = this;
709      var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
710      _classCallCheck(this, DragSlides);
711      var dragEl = config.dragEl,
712        _config$toleranceX = config.toleranceX,
713        toleranceX = _config$toleranceX === void 0 ? 40 : _config$toleranceX,
714        _config$toleranceY = config.toleranceY,
715        toleranceY = _config$toleranceY === void 0 ? 65 : _config$toleranceY,
716        _config$slide = config.slide,
717        slide = _config$slide === void 0 ? null : _config$slide,
718        _config$instance = config.instance,
719        instance = _config$instance === void 0 ? null : _config$instance;
720      this.el = dragEl;
721      this.active = false;
722      this.dragging = false;
723      this.currentX = null;
724      this.currentY = null;
725      this.initialX = null;
726      this.initialY = null;
727      this.xOffset = 0;
728      this.yOffset = 0;
729      this.direction = null;
730      this.lastDirection = null;
731      this.toleranceX = toleranceX;
732      this.toleranceY = toleranceY;
733      this.toleranceReached = false;
734      this.dragContainer = this.el;
735      this.slide = slide;
736      this.instance = instance;
737      this.el.addEventListener('mousedown', function (e) {
738        return _this.dragStart(e);
739      }, false);
740      this.el.addEventListener('mouseup', function (e) {
741        return _this.dragEnd(e);
742      }, false);
743      this.el.addEventListener('mousemove', function (e) {
744        return _this.drag(e);
745      }, false);
746    }
747    return _createClass(DragSlides, [{
748      key: "dragStart",
749      value: function dragStart(e) {
750        if (this.slide.classList.contains('zoomed')) {
751          this.active = false;
752          return;
753        }
754        if (e.type === 'touchstart') {
755          this.initialX = e.touches[0].clientX - this.xOffset;
756          this.initialY = e.touches[0].clientY - this.yOffset;
757        } else {
758          this.initialX = e.clientX - this.xOffset;
759          this.initialY = e.clientY - this.yOffset;
760        }
761        var clicked = e.target.nodeName.toLowerCase();
762        var exludeClicks = ['input', 'select', 'textarea', 'button', 'a'];
763        if (e.target.classList.contains('nodrag') || closest(e.target, '.nodrag') || exludeClicks.indexOf(clicked) !== -1) {
764          this.active = false;
765          return;
766        }
767        e.preventDefault();
768        if (e.target === this.el || clicked !== 'img' && closest(e.target, '.gslide-inline')) {
769          this.active = true;
770          this.el.classList.add('dragging');
771          this.dragContainer = closest(e.target, '.ginner-container');
772        }
773      }
774    }, {
775      key: "dragEnd",
776      value: function dragEnd(e) {
777        var _this2 = this;
778        e && e.preventDefault();
779        this.initialX = 0;
780        this.initialY = 0;
781        this.currentX = null;
782        this.currentY = null;
783        this.initialX = null;
784        this.initialY = null;
785        this.xOffset = 0;
786        this.yOffset = 0;
787        this.active = false;
788        if (this.doSlideChange) {
789          this.instance.preventOutsideClick = true;
790          this.doSlideChange == 'right' && this.instance.prevSlide();
791          this.doSlideChange == 'left' && this.instance.nextSlide();
792        }
793        if (this.doSlideClose) {
794          this.instance.close();
795        }
796        if (!this.toleranceReached) {
797          this.setTranslate(this.dragContainer, 0, 0, true);
798        }
799        setTimeout(function () {
800          _this2.instance.preventOutsideClick = false;
801          _this2.toleranceReached = false;
802          _this2.lastDirection = null;
803          _this2.dragging = false;
804          _this2.el.isDragging = false;
805          _this2.el.classList.remove('dragging');
806          _this2.slide.classList.remove('dragging-nav');
807          _this2.dragContainer.style.transform = '';
808          _this2.dragContainer.style.transition = '';
809        }, 100);
810      }
811    }, {
812      key: "drag",
813      value: function drag(e) {
814        if (this.active) {
815          e.preventDefault();
816          this.slide.classList.add('dragging-nav');
817          if (e.type === 'touchmove') {
818            this.currentX = e.touches[0].clientX - this.initialX;
819            this.currentY = e.touches[0].clientY - this.initialY;
820          } else {
821            this.currentX = e.clientX - this.initialX;
822            this.currentY = e.clientY - this.initialY;
823          }
824          this.xOffset = this.currentX;
825          this.yOffset = this.currentY;
826          this.el.isDragging = true;
827          this.dragging = true;
828          this.doSlideChange = false;
829          this.doSlideClose = false;
830          var currentXInt = Math.abs(this.currentX);
831          var currentYInt = Math.abs(this.currentY);
832          if (currentXInt > 0 && currentXInt >= Math.abs(this.currentY) && (!this.lastDirection || this.lastDirection == 'x')) {
833            this.yOffset = 0;
834            this.lastDirection = 'x';
835            this.setTranslate(this.dragContainer, this.currentX, 0);
836            var doChange = this.shouldChange();
837            if (!this.instance.settings.dragAutoSnap && doChange) {
838              this.doSlideChange = doChange;
839            }
840            if (this.instance.settings.dragAutoSnap && doChange) {
841              this.instance.preventOutsideClick = true;
842              this.toleranceReached = true;
843              this.active = false;
844              this.instance.preventOutsideClick = true;
845              this.dragEnd(null);
846              doChange == 'right' && this.instance.prevSlide();
847              doChange == 'left' && this.instance.nextSlide();
848              return;
849            }
850          }
851          if (this.toleranceY > 0 && currentYInt > 0 && currentYInt >= currentXInt && (!this.lastDirection || this.lastDirection == 'y')) {
852            this.xOffset = 0;
853            this.lastDirection = 'y';
854            this.setTranslate(this.dragContainer, 0, this.currentY);
855            var doClose = this.shouldClose();
856            if (!this.instance.settings.dragAutoSnap && doClose) {
857              this.doSlideClose = true;
858            }
859            if (this.instance.settings.dragAutoSnap && doClose) {
860              this.instance.close();
861            }
862            return;
863          }
864        }
865      }
866    }, {
867      key: "shouldChange",
868      value: function shouldChange() {
869        var doChange = false;
870        var currentXInt = Math.abs(this.currentX);
871        if (currentXInt >= this.toleranceX) {
872          var dragDir = this.currentX > 0 ? 'right' : 'left';
873          if (dragDir == 'left' && this.slide !== this.slide.parentNode.lastChild || dragDir == 'right' && this.slide !== this.slide.parentNode.firstChild) {
874            doChange = dragDir;
875          }
876        }
877        return doChange;
878      }
879    }, {
880      key: "shouldClose",
881      value: function shouldClose() {
882        var doClose = false;
883        var currentYInt = Math.abs(this.currentY);
884        if (currentYInt >= this.toleranceY) {
885          doClose = true;
886        }
887        return doClose;
888      }
889    }, {
890      key: "setTranslate",
891      value: function setTranslate(node, xPos, yPos) {
892        var animated = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
893        if (animated) {
894          node.style.transition = 'all .2s ease';
895        } else {
896          node.style.transition = '';
897        }
898        node.style.transform = "translate3d(".concat(xPos, "px, ").concat(yPos, "px, 0)");
899      }
900    }]);
901  }();
902
903  function slideImage(slide, data, index, callback) {
904    var slideMedia = slide.querySelector('.gslide-media');
905    var img = new Image();
906    var titleID = 'gSlideTitle_' + index;
907    var textID = 'gSlideDesc_' + index;
908    img.addEventListener('load', function () {
909      if (isFunction(callback)) {
910        callback();
911      }
912    }, false);
913    img.src = data.href;
914    if (data.sizes != '' && data.srcset != '') {
915      img.sizes = data.sizes;
916      img.srcset = data.srcset;
917    }
918    img.alt = '';
919    if (!isNil(data.alt) && data.alt !== '') {
920      img.alt = data.alt;
921    }
922    if (data.title !== '') {
923      img.setAttribute('aria-labelledby', titleID);
924    }
925    if (data.description !== '') {
926      img.setAttribute('aria-describedby', textID);
927    }
928    if (data.hasOwnProperty('_hasCustomWidth') && data._hasCustomWidth) {
929      img.style.width = data.width;
930    }
931    if (data.hasOwnProperty('_hasCustomHeight') && data._hasCustomHeight) {
932      img.style.height = data.height;
933    }
934    slideMedia.insertBefore(img, slideMedia.firstChild);
935    return;
936  }
937
938  function slideVideo(slide, data, index, callback) {
939    var _this = this;
940    var slideContainer = slide.querySelector('.ginner-container');
941    var videoID = 'gvideo' + index;
942    var slideMedia = slide.querySelector('.gslide-media');
943    var videoPlayers = this.getAllPlayers();
944    addClass(slideContainer, 'gvideo-container');
945    slideMedia.insertBefore(createHTML('<div class="gvideo-wrapper"></div>'), slideMedia.firstChild);
946    var videoWrapper = slide.querySelector('.gvideo-wrapper');
947    injectAssets(this.settings.plyr.css, 'Plyr');
948    var url = data.href;
949    var provider = data === null || data === void 0 ? void 0 : data.videoProvider;
950    var customPlaceholder = false;
951    slideMedia.style.maxWidth = data.width;
952    injectAssets(this.settings.plyr.js, 'Plyr', function () {
953      if (!provider && url.match(/vimeo\.com\/([0-9]*)/)) {
954        provider = 'vimeo';
955      }
956      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\-_]+)/))) {
957        provider = 'youtube';
958      }
959      if (provider === 'local' || !provider) {
960        provider = 'local';
961        var html = '<video id="' + videoID + '" ';
962        html += "style=\"background:#000; max-width: ".concat(data.width, ";\" ");
963        html += 'preload="metadata" ';
964        html += 'x-webkit-airplay="allow" ';
965        html += 'playsinline ';
966        html += 'controls ';
967        html += 'class="gvideo-local">';
968        html += "<source src=\"".concat(url, "\">");
969        html += '</video>';
970        customPlaceholder = createHTML(html);
971      }
972      var placeholder = customPlaceholder ? customPlaceholder : createHTML("<div id=\"".concat(videoID, "\" data-plyr-provider=\"").concat(provider, "\" data-plyr-embed-id=\"").concat(url, "\"></div>"));
973      addClass(videoWrapper, "".concat(provider, "-video gvideo"));
974      videoWrapper.appendChild(placeholder);
975      videoWrapper.setAttribute('data-id', videoID);
976      videoWrapper.setAttribute('data-index', index);
977      var playerConfig = has(_this.settings.plyr, 'config') ? _this.settings.plyr.config : {};
978      var player = new Plyr('#' + videoID, playerConfig);
979      player.on('ready', function (event) {
980        videoPlayers[videoID] = event.detail.plyr;
981        if (isFunction(callback)) {
982          callback();
983        }
984      });
985      waitUntil(function () {
986        return slide.querySelector('iframe') && slide.querySelector('iframe').dataset.ready == 'true';
987      }, function () {
988        _this.resize(slide);
989      });
990      player.on('enterfullscreen', handleMediaFullScreen);
991      player.on('exitfullscreen', handleMediaFullScreen);
992    });
993  }
994  function handleMediaFullScreen(event) {
995    var media = closest(event.target, '.gslide-media');
996    if (event.type === 'enterfullscreen') {
997      addClass(media, 'fullscreen');
998    }
999    if (event.type === 'exitfullscreen') {
1000      removeClass(media, 'fullscreen');
1001    }
1002  }
1003
1004  function slideInline(slide, data, index, callback) {
1005    var _this = this;
1006    var slideMedia = slide.querySelector('.gslide-media');
1007    var hash = has(data, 'href') && data.href ? data.href.split('#').pop().trim() : false;
1008    var content = has(data, 'content') && data.content ? data.content : false;
1009    var innerContent;
1010    if (content) {
1011      if (isString(content)) {
1012        innerContent = createHTML("<div class=\"ginlined-content\">".concat(content, "</div>"));
1013      }
1014      if (isNode(content)) {
1015        if (content.style.display == 'none') {
1016          content.style.display = 'block';
1017        }
1018        var container = document.createElement('div');
1019        container.className = 'ginlined-content';
1020        container.appendChild(content);
1021        innerContent = container;
1022      }
1023    }
1024    if (hash) {
1025      var div = document.getElementById(hash);
1026      if (!div) {
1027        return false;
1028      }
1029      var cloned = div.cloneNode(true);
1030      cloned.style.height = data.height;
1031      cloned.style.maxWidth = data.width;
1032      addClass(cloned, 'ginlined-content');
1033      innerContent = cloned;
1034    }
1035    if (!innerContent) {
1036      console.error('Unable to append inline slide content', data);
1037      return false;
1038    }
1039    slideMedia.style.height = data.height;
1040    slideMedia.style.width = data.width;
1041    slideMedia.appendChild(innerContent);
1042    this.events['inlineclose' + hash] = addEvent('click', {
1043      onElement: slideMedia.querySelectorAll('.gtrigger-close'),
1044      withCallback: function withCallback(e) {
1045        e.preventDefault();
1046        _this.close();
1047      }
1048    });
1049    if (isFunction(callback)) {
1050      callback();
1051    }
1052    return;
1053  }
1054
1055  function slideIframe(slide, data, index, callback) {
1056    var slideMedia = slide.querySelector('.gslide-media');
1057    var iframe = createIframe({
1058      url: data.href,
1059      callback: callback
1060    });
1061    slideMedia.parentNode.style.maxWidth = data.width;
1062    slideMedia.parentNode.style.height = data.height;
1063    slideMedia.appendChild(iframe);
1064    return;
1065  }
1066
1067  var SlideConfigParser = function () {
1068    function SlideConfigParser() {
1069      var slideParamas = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1070      _classCallCheck(this, SlideConfigParser);
1071      this.defaults = {
1072        href: '',
1073        sizes: '',
1074        srcset: '',
1075        title: '',
1076        type: '',
1077        videoProvider: '',
1078        description: '',
1079        alt: '',
1080        descPosition: 'bottom',
1081        effect: '',
1082        width: '',
1083        height: '',
1084        content: false,
1085        zoomable: true,
1086        draggable: true
1087      };
1088      if (isObject(slideParamas)) {
1089        this.defaults = extend(this.defaults, slideParamas);
1090      }
1091    }
1092    return _createClass(SlideConfigParser, [{
1093      key: "sourceType",
1094      value: function sourceType(url) {
1095        var origin = url;
1096        url = url.toLowerCase();
1097        if (url.match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/) !== null) {
1098          return 'image';
1099        }
1100        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\-_]+)/)) {
1101          return 'video';
1102        }
1103        if (url.match(/vimeo\.com\/([0-9]*)/)) {
1104          return 'video';
1105        }
1106        if (url.match(/\.(mp4|ogg|webm|mov)/) !== null) {
1107          return 'video';
1108        }
1109        if (url.match(/\.(mp3|wav|wma|aac|ogg)/) !== null) {
1110          return 'audio';
1111        }
1112        if (url.indexOf('#') > -1) {
1113          var hash = origin.split('#').pop();
1114          if (hash.trim() !== '') {
1115            return 'inline';
1116          }
1117        }
1118        if (url.indexOf('goajax=true') > -1) {
1119          return 'ajax';
1120        }
1121        return 'external';
1122      }
1123    }, {
1124      key: "parseConfig",
1125      value: function parseConfig(element, settings) {
1126        var _this = this;
1127        var data = extend({
1128          descPosition: settings.descPosition
1129        }, this.defaults);
1130        if (isObject(element) && !isNode(element)) {
1131          if (!has(element, 'type')) {
1132            if (has(element, 'content') && element.content) {
1133              element.type = 'inline';
1134            } else if (has(element, 'href')) {
1135              element.type = this.sourceType(element.href);
1136            }
1137          }
1138          var objectData = extend(data, element);
1139          this.setSize(objectData, settings);
1140          return objectData;
1141        }
1142        var url = '';
1143        var config = element.getAttribute('data-glightbox');
1144        var nodeType = element.nodeName.toLowerCase();
1145        if (nodeType === 'a') {
1146          url = element.href;
1147        }
1148        if (nodeType === 'img') {
1149          url = element.src;
1150          data.alt = element.alt;
1151        }
1152        data.href = url;
1153        each(data, function (val, key) {
1154          if (has(settings, key) && key !== 'width') {
1155            data[key] = settings[key];
1156          }
1157          var nodeData = element.dataset[key];
1158          if (!isNil(nodeData)) {
1159            data[key] = _this.sanitizeValue(nodeData);
1160          }
1161        });
1162        if (data.content) {
1163          data.type = 'inline';
1164        }
1165        if (!data.type && url) {
1166          data.type = this.sourceType(url);
1167        }
1168        if (!isNil(config)) {
1169          var cleanKeys = [];
1170          each(data, function (v, k) {
1171            cleanKeys.push(';\\s?' + k);
1172          });
1173          cleanKeys = cleanKeys.join('\\s?:|');
1174          if (config.trim() !== '') {
1175            each(data, function (val, key) {
1176              var str = config;
1177              var match = 's?' + key + 's?:s?(.*?)(' + cleanKeys + 's?:|$)';
1178              var regex = new RegExp(match);
1179              var matches = str.match(regex);
1180              if (matches && matches.length && matches[1]) {
1181                var value = matches[1].trim().replace(/;\s*$/, '');
1182                data[key] = _this.sanitizeValue(value);
1183              }
1184            });
1185          }
1186        } else {
1187          if (!data.title && nodeType == 'a') {
1188            var title = element.title;
1189            if (!isNil(title) && title !== '') {
1190              data.title = title;
1191            }
1192          }
1193          if (!data.title && nodeType == 'img') {
1194            var alt = element.alt;
1195            if (!isNil(alt) && alt !== '') {
1196              data.title = alt;
1197            }
1198          }
1199        }
1200        if (data.description && data.description.substring(0, 1) === '.') {
1201          var description;
1202          try {
1203            description = document.querySelector(data.description).innerHTML;
1204          } catch (error) {
1205            if (!(error instanceof DOMException)) {
1206              throw error;
1207            }
1208          }
1209          if (description) {
1210            data.description = description;
1211          }
1212        }
1213        if (!data.description) {
1214          var nodeDesc = element.querySelector('.glightbox-desc');
1215          if (nodeDesc) {
1216            data.description = nodeDesc.innerHTML;
1217          }
1218        }
1219        this.setSize(data, settings, element);
1220        this.slideConfig = data;
1221        return data;
1222      }
1223    }, {
1224      key: "setSize",
1225      value: function setSize(data, settings) {
1226        var element = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1227        var defaultWith = data.type == 'video' ? this.checkSize(settings.videosWidth) : this.checkSize(settings.width);
1228        var defaultHeight = this.checkSize(settings.height);
1229        data.width = has(data, 'width') && data.width !== '' ? this.checkSize(data.width) : defaultWith;
1230        data.height = has(data, 'height') && data.height !== '' ? this.checkSize(data.height) : defaultHeight;
1231        if (element && data.type == 'image') {
1232          data._hasCustomWidth = element.dataset.width ? true : false;
1233          data._hasCustomHeight = element.dataset.height ? true : false;
1234        }
1235        return data;
1236      }
1237    }, {
1238      key: "checkSize",
1239      value: function checkSize(size) {
1240        return isNumber(size) ? "".concat(size, "px") : size;
1241      }
1242    }, {
1243      key: "sanitizeValue",
1244      value: function sanitizeValue(val) {
1245        if (val !== 'true' && val !== 'false') {
1246          return val;
1247        }
1248        return val === 'true';
1249      }
1250    }]);
1251  }();
1252
1253  var Slide = function () {
1254    function Slide(el, instance, index) {
1255      _classCallCheck(this, Slide);
1256      this.element = el;
1257      this.instance = instance;
1258      this.index = index;
1259    }
1260    return _createClass(Slide, [{
1261      key: "setContent",
1262      value: function setContent() {
1263        var _this = this;
1264        var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1265        var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1266        if (hasClass(slide, 'loaded')) {
1267          return false;
1268        }
1269        var settings = this.instance.settings;
1270        var slideConfig = this.slideConfig;
1271        var isMobileDevice = isMobile();
1272        if (isFunction(settings.beforeSlideLoad)) {
1273          settings.beforeSlideLoad({
1274            index: this.index,
1275            slide: slide,
1276            player: false
1277          });
1278        }
1279        var type = slideConfig.type;
1280        var position = slideConfig.descPosition;
1281        var slideMedia = slide.querySelector('.gslide-media');
1282        var slideTitle = slide.querySelector('.gslide-title');
1283        var slideText = slide.querySelector('.gslide-desc');
1284        var slideDesc = slide.querySelector('.gdesc-inner');
1285        var finalCallback = callback;
1286        var titleID = 'gSlideTitle_' + this.index;
1287        var textID = 'gSlideDesc_' + this.index;
1288        if (isFunction(settings.afterSlideLoad)) {
1289          finalCallback = function finalCallback() {
1290            if (isFunction(callback)) {
1291              callback();
1292            }
1293            settings.afterSlideLoad({
1294              index: _this.index,
1295              slide: slide,
1296              player: _this.instance.getSlidePlayerInstance(_this.index)
1297            });
1298          };
1299        }
1300        if (slideConfig.title == '' && slideConfig.description == '') {
1301          if (slideDesc) {
1302            slideDesc.parentNode.parentNode.removeChild(slideDesc.parentNode);
1303          }
1304        } else {
1305          if (slideTitle && slideConfig.title !== '') {
1306            slideTitle.id = titleID;
1307            slideTitle.innerHTML = slideConfig.title;
1308          } else {
1309            slideTitle.parentNode.removeChild(slideTitle);
1310          }
1311          if (slideText && slideConfig.description !== '') {
1312            slideText.id = textID;
1313            if (isMobileDevice && settings.moreLength > 0) {
1314              slideConfig.smallDescription = this.slideShortDesc(slideConfig.description, settings.moreLength, settings.moreText);
1315              slideText.innerHTML = slideConfig.smallDescription;
1316              this.descriptionEvents(slideText, slideConfig);
1317            } else {
1318              slideText.innerHTML = slideConfig.description;
1319            }
1320          } else {
1321            slideText.parentNode.removeChild(slideText);
1322          }
1323          addClass(slideMedia.parentNode, "desc-".concat(position));
1324          addClass(slideDesc.parentNode, "description-".concat(position));
1325        }
1326        addClass(slideMedia, "gslide-".concat(type));
1327        addClass(slide, 'loaded');
1328        if (type === 'video') {
1329          slideVideo.apply(this.instance, [slide, slideConfig, this.index, finalCallback]);
1330          return;
1331        }
1332        if (type === 'external') {
1333          slideIframe.apply(this, [slide, slideConfig, this.index, finalCallback]);
1334          return;
1335        }
1336        if (type === 'inline') {
1337          slideInline.apply(this.instance, [slide, slideConfig, this.index, finalCallback]);
1338          if (slideConfig.draggable) {
1339            new DragSlides({
1340              dragEl: slide.querySelector('.gslide-inline'),
1341              toleranceX: settings.dragToleranceX,
1342              toleranceY: settings.dragToleranceY,
1343              slide: slide,
1344              instance: this.instance
1345            });
1346          }
1347          return;
1348        }
1349        if (type === 'image') {
1350          slideImage(slide, slideConfig, this.index, function () {
1351            var img = slide.querySelector('img');
1352            if (slideConfig.draggable) {
1353              new DragSlides({
1354                dragEl: img,
1355                toleranceX: settings.dragToleranceX,
1356                toleranceY: settings.dragToleranceY,
1357                slide: slide,
1358                instance: _this.instance
1359              });
1360            }
1361            if (slideConfig.zoomable && img.naturalWidth > img.offsetWidth) {
1362              addClass(img, 'zoomable');
1363              new ZoomImages(img, slide, function () {
1364                _this.instance.resize();
1365              });
1366            }
1367            if (isFunction(finalCallback)) {
1368              finalCallback();
1369            }
1370          });
1371          return;
1372        }
1373        if (isFunction(finalCallback)) {
1374          finalCallback();
1375        }
1376      }
1377    }, {
1378      key: "slideShortDesc",
1379      value: function slideShortDesc(string) {
1380        var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
1381        var wordBoundary = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1382        var div = document.createElement('div');
1383        div.innerHTML = string;
1384        var cleanedString = div.innerText;
1385        var useWordBoundary = wordBoundary;
1386        string = cleanedString.trim();
1387        if (string.length <= n) {
1388          return string;
1389        }
1390        var subString = string.substr(0, n - 1);
1391        if (!useWordBoundary) {
1392          return subString;
1393        }
1394        div = null;
1395        return subString + '... <a href="#" class="desc-more">' + wordBoundary + '</a>';
1396      }
1397    }, {
1398      key: "descriptionEvents",
1399      value: function descriptionEvents(desc, data) {
1400        var _this2 = this;
1401        var moreLink = desc.querySelector('.desc-more');
1402        if (!moreLink) {
1403          return false;
1404        }
1405        addEvent('click', {
1406          onElement: moreLink,
1407          withCallback: function withCallback(event, target) {
1408            event.preventDefault();
1409            var body = document.body;
1410            var desc = closest(target, '.gslide-desc');
1411            if (!desc) {
1412              return false;
1413            }
1414            desc.innerHTML = data.description;
1415            addClass(body, 'gdesc-open');
1416            var shortEvent = addEvent('click', {
1417              onElement: [body, closest(desc, '.gslide-description')],
1418              withCallback: function withCallback(event, target) {
1419                if (event.target.nodeName.toLowerCase() !== 'a') {
1420                  removeClass(body, 'gdesc-open');
1421                  addClass(body, 'gdesc-closed');
1422                  desc.innerHTML = data.smallDescription;
1423                  _this2.descriptionEvents(desc, data);
1424                  setTimeout(function () {
1425                    removeClass(body, 'gdesc-closed');
1426                  }, 400);
1427                  shortEvent.destroy();
1428                }
1429              }
1430            });
1431          }
1432        });
1433      }
1434    }, {
1435      key: "create",
1436      value: function create() {
1437        return createHTML(this.instance.settings.slideHTML);
1438      }
1439    }, {
1440      key: "getConfig",
1441      value: function getConfig() {
1442        if (!isNode(this.element) && !this.element.hasOwnProperty('draggable')) {
1443          this.element.draggable = this.instance.settings.draggable;
1444        }
1445        var parser = new SlideConfigParser(this.instance.settings.slideExtraAttributes);
1446        this.slideConfig = parser.parseConfig(this.element, this.instance.settings);
1447        return this.slideConfig;
1448      }
1449    }]);
1450  }();
1451
1452  function getLen(v) {
1453    return Math.sqrt(v.x * v.x + v.y * v.y);
1454  }
1455  function dot(v1, v2) {
1456    return v1.x * v2.x + v1.y * v2.y;
1457  }
1458  function getAngle(v1, v2) {
1459    var mr = getLen(v1) * getLen(v2);
1460    if (mr === 0) {
1461      return 0;
1462    }
1463    var r = dot(v1, v2) / mr;
1464    if (r > 1) {
1465      r = 1;
1466    }
1467    return Math.acos(r);
1468  }
1469  function cross(v1, v2) {
1470    return v1.x * v2.y - v2.x * v1.y;
1471  }
1472  function getRotateAngle(v1, v2) {
1473    var angle = getAngle(v1, v2);
1474    if (cross(v1, v2) > 0) {
1475      angle *= -1;
1476    }
1477    return angle * 180 / Math.PI;
1478  }
1479  var EventsHandlerAdmin = function () {
1480    function EventsHandlerAdmin(el) {
1481      _classCallCheck(this, EventsHandlerAdmin);
1482      this.handlers = [];
1483      this.el = el;
1484    }
1485    return _createClass(EventsHandlerAdmin, [{
1486      key: "add",
1487      value: function add(handler) {
1488        this.handlers.push(handler);
1489      }
1490    }, {
1491      key: "del",
1492      value: function del(handler) {
1493        if (!handler) {
1494          this.handlers = [];
1495        }
1496        for (var i = this.handlers.length; i >= 0; i--) {
1497          if (this.handlers[i] === handler) {
1498            this.handlers.splice(i, 1);
1499          }
1500        }
1501      }
1502    }, {
1503      key: "dispatch",
1504      value: function dispatch() {
1505        for (var i = 0, len = this.handlers.length; i < len; i++) {
1506          var handler = this.handlers[i];
1507          if (typeof handler === 'function') {
1508            handler.apply(this.el, arguments);
1509          }
1510        }
1511      }
1512    }]);
1513  }();
1514  function wrapFunc(el, handler) {
1515    var EventshandlerAdmin = new EventsHandlerAdmin(el);
1516    EventshandlerAdmin.add(handler);
1517    return EventshandlerAdmin;
1518  }
1519  var TouchEvents = function () {
1520    function TouchEvents(el, option) {
1521      _classCallCheck(this, TouchEvents);
1522      this.element = typeof el == 'string' ? document.querySelector(el) : el;
1523      this.start = this.start.bind(this);
1524      this.move = this.move.bind(this);
1525      this.end = this.end.bind(this);
1526      this.cancel = this.cancel.bind(this);
1527      this.element.addEventListener('touchstart', this.start, false);
1528      this.element.addEventListener('touchmove', this.move, false);
1529      this.element.addEventListener('touchend', this.end, false);
1530      this.element.addEventListener('touchcancel', this.cancel, false);
1531      this.preV = {
1532        x: null,
1533        y: null
1534      };
1535      this.pinchStartLen = null;
1536      this.zoom = 1;
1537      this.isDoubleTap = false;
1538      var noop = function noop() {};
1539      this.rotate = wrapFunc(this.element, option.rotate || noop);
1540      this.touchStart = wrapFunc(this.element, option.touchStart || noop);
1541      this.multipointStart = wrapFunc(this.element, option.multipointStart || noop);
1542      this.multipointEnd = wrapFunc(this.element, option.multipointEnd || noop);
1543      this.pinch = wrapFunc(this.element, option.pinch || noop);
1544      this.swipe = wrapFunc(this.element, option.swipe || noop);
1545      this.tap = wrapFunc(this.element, option.tap || noop);
1546      this.doubleTap = wrapFunc(this.element, option.doubleTap || noop);
1547      this.longTap = wrapFunc(this.element, option.longTap || noop);
1548      this.singleTap = wrapFunc(this.element, option.singleTap || noop);
1549      this.pressMove = wrapFunc(this.element, option.pressMove || noop);
1550      this.twoFingerPressMove = wrapFunc(this.element, option.twoFingerPressMove || noop);
1551      this.touchMove = wrapFunc(this.element, option.touchMove || noop);
1552      this.touchEnd = wrapFunc(this.element, option.touchEnd || noop);
1553      this.touchCancel = wrapFunc(this.element, option.touchCancel || noop);
1554      this.translateContainer = this.element;
1555      this._cancelAllHandler = this.cancelAll.bind(this);
1556      window.addEventListener('scroll', this._cancelAllHandler);
1557      this.delta = null;
1558      this.last = null;
1559      this.now = null;
1560      this.tapTimeout = null;
1561      this.singleTapTimeout = null;
1562      this.longTapTimeout = null;
1563      this.swipeTimeout = null;
1564      this.x1 = this.x2 = this.y1 = this.y2 = null;
1565      this.preTapPosition = {
1566        x: null,
1567        y: null
1568      };
1569    }
1570    return _createClass(TouchEvents, [{
1571      key: "start",
1572      value: function start(evt) {
1573        if (!evt.touches) {
1574          return;
1575        }
1576        var ignoreDragFor = ['a', 'button', 'input'];
1577        if (evt.target && evt.target.nodeName && ignoreDragFor.indexOf(evt.target.nodeName.toLowerCase()) >= 0) {
1578          console.log('ignore drag for this touched element', evt.target.nodeName.toLowerCase());
1579          return;
1580        }
1581        this.now = Date.now();
1582        this.x1 = evt.touches[0].pageX;
1583        this.y1 = evt.touches[0].pageY;
1584        this.delta = this.now - (this.last || this.now);
1585        this.touchStart.dispatch(evt, this.element);
1586        if (this.preTapPosition.x !== null) {
1587          this.isDoubleTap = this.delta > 0 && this.delta <= 250 && Math.abs(this.preTapPosition.x - this.x1) < 30 && Math.abs(this.preTapPosition.y - this.y1) < 30;
1588          if (this.isDoubleTap) {
1589            clearTimeout(this.singleTapTimeout);
1590          }
1591        }
1592        this.preTapPosition.x = this.x1;
1593        this.preTapPosition.y = this.y1;
1594        this.last = this.now;
1595        var preV = this.preV,
1596          len = evt.touches.length;
1597        if (len > 1) {
1598          this._cancelLongTap();
1599          this._cancelSingleTap();
1600          var v = {
1601            x: evt.touches[1].pageX - this.x1,
1602            y: evt.touches[1].pageY - this.y1
1603          };
1604          preV.x = v.x;
1605          preV.y = v.y;
1606          this.pinchStartLen = getLen(preV);
1607          this.multipointStart.dispatch(evt, this.element);
1608        }
1609        this._preventTap = false;
1610        this.longTapTimeout = setTimeout(function () {
1611          this.longTap.dispatch(evt, this.element);
1612          this._preventTap = true;
1613        }.bind(this), 750);
1614      }
1615    }, {
1616      key: "move",
1617      value: function move(evt) {
1618        if (!evt.touches) {
1619          return;
1620        }
1621        var preV = this.preV,
1622          len = evt.touches.length,
1623          currentX = evt.touches[0].pageX,
1624          currentY = evt.touches[0].pageY;
1625        this.isDoubleTap = false;
1626        if (len > 1) {
1627          var sCurrentX = evt.touches[1].pageX,
1628            sCurrentY = evt.touches[1].pageY;
1629          var v = {
1630            x: evt.touches[1].pageX - currentX,
1631            y: evt.touches[1].pageY - currentY
1632          };
1633          if (preV.x !== null) {
1634            if (this.pinchStartLen > 0) {
1635              evt.zoom = getLen(v) / this.pinchStartLen;
1636              this.pinch.dispatch(evt, this.element);
1637            }
1638            evt.angle = getRotateAngle(v, preV);
1639            this.rotate.dispatch(evt, this.element);
1640          }
1641          preV.x = v.x;
1642          preV.y = v.y;
1643          if (this.x2 !== null && this.sx2 !== null) {
1644            evt.deltaX = (currentX - this.x2 + sCurrentX - this.sx2) / 2;
1645            evt.deltaY = (currentY - this.y2 + sCurrentY - this.sy2) / 2;
1646          } else {
1647            evt.deltaX = 0;
1648            evt.deltaY = 0;
1649          }
1650          this.twoFingerPressMove.dispatch(evt, this.element);
1651          this.sx2 = sCurrentX;
1652          this.sy2 = sCurrentY;
1653        } else {
1654          if (this.x2 !== null) {
1655            evt.deltaX = currentX - this.x2;
1656            evt.deltaY = currentY - this.y2;
1657            var movedX = Math.abs(this.x1 - this.x2),
1658              movedY = Math.abs(this.y1 - this.y2);
1659            if (movedX > 10 || movedY > 10) {
1660              this._preventTap = true;
1661            }
1662          } else {
1663            evt.deltaX = 0;
1664            evt.deltaY = 0;
1665          }
1666          this.pressMove.dispatch(evt, this.element);
1667        }
1668        this.touchMove.dispatch(evt, this.element);
1669        this._cancelLongTap();
1670        this.x2 = currentX;
1671        this.y2 = currentY;
1672        if (len > 1) {
1673          evt.preventDefault();
1674        }
1675      }
1676    }, {
1677      key: "end",
1678      value: function end(evt) {
1679        if (!evt.changedTouches) {
1680          return;
1681        }
1682        this._cancelLongTap();
1683        var self = this;
1684        if (evt.touches.length < 2) {
1685          this.multipointEnd.dispatch(evt, this.element);
1686          this.sx2 = this.sy2 = null;
1687        }
1688        if (this.x2 && Math.abs(this.x1 - this.x2) > 30 || this.y2 && Math.abs(this.y1 - this.y2) > 30) {
1689          evt.direction = this._swipeDirection(this.x1, this.x2, this.y1, this.y2);
1690          this.swipeTimeout = setTimeout(function () {
1691            self.swipe.dispatch(evt, self.element);
1692          }, 0);
1693        } else {
1694          this.tapTimeout = setTimeout(function () {
1695            if (!self._preventTap) {
1696              self.tap.dispatch(evt, self.element);
1697            }
1698            if (self.isDoubleTap) {
1699              self.doubleTap.dispatch(evt, self.element);
1700              self.isDoubleTap = false;
1701            }
1702          }, 0);
1703          if (!self.isDoubleTap) {
1704            self.singleTapTimeout = setTimeout(function () {
1705              self.singleTap.dispatch(evt, self.element);
1706            }, 250);
1707          }
1708        }
1709        this.touchEnd.dispatch(evt, this.element);
1710        this.preV.x = 0;
1711        this.preV.y = 0;
1712        this.zoom = 1;
1713        this.pinchStartLen = null;
1714        this.x1 = this.x2 = this.y1 = this.y2 = null;
1715      }
1716    }, {
1717      key: "cancelAll",
1718      value: function cancelAll() {
1719        this._preventTap = true;
1720        clearTimeout(this.singleTapTimeout);
1721        clearTimeout(this.tapTimeout);
1722        clearTimeout(this.longTapTimeout);
1723        clearTimeout(this.swipeTimeout);
1724      }
1725    }, {
1726      key: "cancel",
1727      value: function cancel(evt) {
1728        this.cancelAll();
1729        this.touchCancel.dispatch(evt, this.element);
1730      }
1731    }, {
1732      key: "_cancelLongTap",
1733      value: function _cancelLongTap() {
1734        clearTimeout(this.longTapTimeout);
1735      }
1736    }, {
1737      key: "_cancelSingleTap",
1738      value: function _cancelSingleTap() {
1739        clearTimeout(this.singleTapTimeout);
1740      }
1741    }, {
1742      key: "_swipeDirection",
1743      value: function _swipeDirection(x1, x2, y1, y2) {
1744        return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ? x1 - x2 > 0 ? 'Left' : 'Right' : y1 - y2 > 0 ? 'Up' : 'Down';
1745      }
1746    }, {
1747      key: "on",
1748      value: function on(evt, handler) {
1749        if (this[evt]) {
1750          this[evt].add(handler);
1751        }
1752      }
1753    }, {
1754      key: "off",
1755      value: function off(evt, handler) {
1756        if (this[evt]) {
1757          this[evt].del(handler);
1758        }
1759      }
1760    }, {
1761      key: "destroy",
1762      value: function destroy() {
1763        if (this.singleTapTimeout) {
1764          clearTimeout(this.singleTapTimeout);
1765        }
1766        if (this.tapTimeout) {
1767          clearTimeout(this.tapTimeout);
1768        }
1769        if (this.longTapTimeout) {
1770          clearTimeout(this.longTapTimeout);
1771        }
1772        if (this.swipeTimeout) {
1773          clearTimeout(this.swipeTimeout);
1774        }
1775        this.element.removeEventListener('touchstart', this.start);
1776        this.element.removeEventListener('touchmove', this.move);
1777        this.element.removeEventListener('touchend', this.end);
1778        this.element.removeEventListener('touchcancel', this.cancel);
1779        this.rotate.del();
1780        this.touchStart.del();
1781        this.multipointStart.del();
1782        this.multipointEnd.del();
1783        this.pinch.del();
1784        this.swipe.del();
1785        this.tap.del();
1786        this.doubleTap.del();
1787        this.longTap.del();
1788        this.singleTap.del();
1789        this.pressMove.del();
1790        this.twoFingerPressMove.del();
1791        this.touchMove.del();
1792        this.touchEnd.del();
1793        this.touchCancel.del();
1794        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;
1795        window.removeEventListener('scroll', this._cancelAllHandler);
1796        return null;
1797      }
1798    }]);
1799  }();
1800
1801  function resetSlideMove(slide) {
1802    var transitionEnd = whichTransitionEvent();
1803    var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
1804    var media = hasClass(slide, 'gslide-media') ? slide : slide.querySelector('.gslide-media');
1805    var container = closest(media, '.ginner-container');
1806    var desc = slide.querySelector('.gslide-description');
1807    if (windowWidth > 769) {
1808      media = container;
1809    }
1810    addClass(media, 'greset');
1811    cssTransform(media, 'translate3d(0, 0, 0)');
1812    addEvent(transitionEnd, {
1813      onElement: media,
1814      once: true,
1815      withCallback: function withCallback(event, target) {
1816        removeClass(media, 'greset');
1817      }
1818    });
1819    media.style.opacity = '';
1820    if (desc) {
1821      desc.style.opacity = '';
1822    }
1823  }
1824  function touchNavigation(instance) {
1825    if (instance.events.hasOwnProperty('touch')) {
1826      return false;
1827    }
1828    var winSize = windowSize();
1829    var winWidth = winSize.width;
1830    var winHeight = winSize.height;
1831    var process = false;
1832    var currentSlide = null;
1833    var media = null;
1834    var mediaImage = null;
1835    var doingMove = false;
1836    var initScale = 1;
1837    var maxScale = 4.5;
1838    var currentScale = 1;
1839    var doingZoom = false;
1840    var imageZoomed = false;
1841    var zoomedPosX = null;
1842    var zoomedPosY = null;
1843    var lastZoomedPosX = null;
1844    var lastZoomedPosY = null;
1845    var hDistance;
1846    var vDistance;
1847    var hDistancePercent = 0;
1848    var vDistancePercent = 0;
1849    var vSwipe = false;
1850    var hSwipe = false;
1851    var startCoords = {};
1852    var endCoords = {};
1853    var xDown = 0;
1854    var yDown = 0;
1855    var isInlined;
1856    var sliderWrapper = document.getElementById('glightbox-slider');
1857    var overlay = document.querySelector('.goverlay');
1858    var touchInstance = new TouchEvents(sliderWrapper, {
1859      touchStart: function touchStart(e) {
1860        process = true;
1861        if (hasClass(e.targetTouches[0].target, 'ginner-container') || closest(e.targetTouches[0].target, '.gslide-desc') || e.targetTouches[0].target.nodeName.toLowerCase() == 'a') {
1862          process = false;
1863        }
1864        if (closest(e.targetTouches[0].target, '.gslide-inline') && !hasClass(e.targetTouches[0].target.parentNode, 'gslide-inline')) {
1865          process = false;
1866        }
1867        if (process) {
1868          endCoords = e.targetTouches[0];
1869          startCoords.pageX = e.targetTouches[0].pageX;
1870          startCoords.pageY = e.targetTouches[0].pageY;
1871          xDown = e.targetTouches[0].clientX;
1872          yDown = e.targetTouches[0].clientY;
1873          currentSlide = instance.activeSlide;
1874          media = currentSlide.querySelector('.gslide-media');
1875          isInlined = currentSlide.querySelector('.gslide-inline');
1876          mediaImage = null;
1877          if (hasClass(media, 'gslide-image')) {
1878            mediaImage = media.querySelector('img');
1879          }
1880          var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
1881          if (windowWidth > 769) {
1882            media = currentSlide.querySelector('.ginner-container');
1883          }
1884          removeClass(overlay, 'greset');
1885          if (e.pageX > 20 && e.pageX < window.innerWidth - 20) {
1886            return;
1887          }
1888          e.preventDefault();
1889        }
1890      },
1891      touchMove: function touchMove(e) {
1892        if (!process) {
1893          return;
1894        }
1895        endCoords = e.targetTouches[0];
1896        if (doingZoom || imageZoomed) {
1897          return;
1898        }
1899        if (isInlined && isInlined.offsetHeight > winHeight) {
1900          var moved = startCoords.pageX - endCoords.pageX;
1901          if (Math.abs(moved) <= 13) {
1902            return false;
1903          }
1904        }
1905        doingMove = true;
1906        var xUp = e.targetTouches[0].clientX;
1907        var yUp = e.targetTouches[0].clientY;
1908        var xDiff = xDown - xUp;
1909        var yDiff = yDown - yUp;
1910        if (Math.abs(xDiff) > Math.abs(yDiff)) {
1911          vSwipe = false;
1912          hSwipe = true;
1913        } else {
1914          hSwipe = false;
1915          vSwipe = true;
1916        }
1917        hDistance = endCoords.pageX - startCoords.pageX;
1918        hDistancePercent = hDistance * 100 / winWidth;
1919        vDistance = endCoords.pageY - startCoords.pageY;
1920        vDistancePercent = vDistance * 100 / winHeight;
1921        var opacity;
1922        if (vSwipe && mediaImage) {
1923          opacity = 1 - Math.abs(vDistance) / winHeight;
1924          overlay.style.opacity = opacity;
1925          if (instance.settings.touchFollowAxis) {
1926            hDistancePercent = 0;
1927          }
1928        }
1929        if (hSwipe) {
1930          opacity = 1 - Math.abs(hDistance) / winWidth;
1931          media.style.opacity = opacity;
1932          if (instance.settings.touchFollowAxis) {
1933            vDistancePercent = 0;
1934          }
1935        }
1936        if (!mediaImage) {
1937          return cssTransform(media, "translate3d(".concat(hDistancePercent, "%, 0, 0)"));
1938        }
1939        cssTransform(media, "translate3d(".concat(hDistancePercent, "%, ").concat(vDistancePercent, "%, 0)"));
1940      },
1941      touchEnd: function touchEnd() {
1942        if (!process) {
1943          return;
1944        }
1945        doingMove = false;
1946        if (imageZoomed || doingZoom) {
1947          lastZoomedPosX = zoomedPosX;
1948          lastZoomedPosY = zoomedPosY;
1949          return;
1950        }
1951        var v = Math.abs(parseInt(vDistancePercent));
1952        var h = Math.abs(parseInt(hDistancePercent));
1953        if (v > 29 && mediaImage) {
1954          instance.close();
1955          return;
1956        }
1957        if (v < 29 && h < 25) {
1958          addClass(overlay, 'greset');
1959          overlay.style.opacity = 1;
1960          return resetSlideMove(media);
1961        }
1962      },
1963      multipointEnd: function multipointEnd() {
1964        setTimeout(function () {
1965          doingZoom = false;
1966        }, 50);
1967      },
1968      multipointStart: function multipointStart() {
1969        doingZoom = true;
1970        initScale = currentScale ? currentScale : 1;
1971      },
1972      pinch: function pinch(evt) {
1973        if (!mediaImage || doingMove) {
1974          return false;
1975        }
1976        doingZoom = true;
1977        mediaImage.scaleX = mediaImage.scaleY = initScale * evt.zoom;
1978        var scale = initScale * evt.zoom;
1979        imageZoomed = true;
1980        if (scale <= 1) {
1981          imageZoomed = false;
1982          scale = 1;
1983          lastZoomedPosY = null;
1984          lastZoomedPosX = null;
1985          zoomedPosX = null;
1986          zoomedPosY = null;
1987          mediaImage.setAttribute('style', '');
1988          return;
1989        }
1990        if (scale > maxScale) {
1991          scale = maxScale;
1992        }
1993        mediaImage.style.transform = "scale3d(".concat(scale, ", ").concat(scale, ", 1)");
1994        currentScale = scale;
1995      },
1996      pressMove: function pressMove(e) {
1997        if (imageZoomed && !doingZoom) {
1998          var mhDistance = endCoords.pageX - startCoords.pageX;
1999          var mvDistance = endCoords.pageY - startCoords.pageY;
2000          if (lastZoomedPosX) {
2001            mhDistance = mhDistance + lastZoomedPosX;
2002          }
2003          if (lastZoomedPosY) {
2004            mvDistance = mvDistance + lastZoomedPosY;
2005          }
2006          zoomedPosX = mhDistance;
2007          zoomedPosY = mvDistance;
2008          var style = "translate3d(".concat(mhDistance, "px, ").concat(mvDistance, "px, 0)");
2009          if (currentScale) {
2010            style += " scale3d(".concat(currentScale, ", ").concat(currentScale, ", 1)");
2011          }
2012          cssTransform(mediaImage, style);
2013        }
2014      },
2015      swipe: function swipe(evt) {
2016        if (imageZoomed) {
2017          return;
2018        }
2019        if (doingZoom) {
2020          doingZoom = false;
2021          return;
2022        }
2023        if (evt.direction == 'Left') {
2024          if (instance.index == instance.elements.length - 1) {
2025            return resetSlideMove(media);
2026          }
2027          instance.nextSlide();
2028        }
2029        if (evt.direction == 'Right') {
2030          if (instance.index == 0) {
2031            return resetSlideMove(media);
2032          }
2033          instance.prevSlide();
2034        }
2035      }
2036    });
2037    instance.events['touch'] = touchInstance;
2038  }
2039
2040  var _version = '3.3.0';
2041  var isMobile$1 = isMobile();
2042  var isTouch$1 = isTouch();
2043  var html = document.getElementsByTagName('html')[0];
2044  var defaults = {
2045    selector: '.glightbox',
2046    elements: null,
2047    skin: 'clean',
2048    theme: 'clean',
2049    closeButton: true,
2050    startAt: null,
2051    autoplayVideos: true,
2052    autofocusVideos: true,
2053    descPosition: 'bottom',
2054    width: '900px',
2055    height: '506px',
2056    videosWidth: '960px',
2057    beforeSlideChange: null,
2058    afterSlideChange: null,
2059    beforeSlideLoad: null,
2060    afterSlideLoad: null,
2061    slideInserted: null,
2062    slideRemoved: null,
2063    slideExtraAttributes: null,
2064    onOpen: null,
2065    onClose: null,
2066    loop: false,
2067    zoomable: true,
2068    draggable: true,
2069    dragAutoSnap: false,
2070    dragToleranceX: 40,
2071    dragToleranceY: 65,
2072    preload: true,
2073    oneSlidePerOpen: false,
2074    touchNavigation: true,
2075    touchFollowAxis: true,
2076    keyboardNavigation: true,
2077    closeOnOutsideClick: true,
2078    plugins: false,
2079    plyr: {
2080      css: 'https://cdn.plyr.io/3.6.12/plyr.css',
2081      js: 'https://cdn.plyr.io/3.6.12/plyr.js',
2082      config: {
2083        ratio: '16:9',
2084        fullscreen: {
2085          enabled: true,
2086          iosNative: true
2087        },
2088        youtube: {
2089          noCookie: true,
2090          rel: 0,
2091          showinfo: 0,
2092          iv_load_policy: 3
2093        },
2094        vimeo: {
2095          byline: false,
2096          portrait: false,
2097          title: false,
2098          transparent: false
2099        }
2100      }
2101    },
2102    openEffect: 'zoom',
2103    closeEffect: 'zoom',
2104    slideEffect: 'slide',
2105    moreText: 'See more',
2106    moreLength: 60,
2107    cssEfects: {
2108      fade: {
2109        "in": 'fadeIn',
2110        out: 'fadeOut'
2111      },
2112      zoom: {
2113        "in": 'zoomIn',
2114        out: 'zoomOut'
2115      },
2116      slide: {
2117        "in": 'slideInRight',
2118        out: 'slideOutLeft'
2119      },
2120      slideBack: {
2121        "in": 'slideInLeft',
2122        out: 'slideOutRight'
2123      },
2124      none: {
2125        "in": 'none',
2126        out: 'none'
2127      }
2128    },
2129    svg: {
2130      close: '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"><g><g><path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306C514.019,27.23,514.019,14.135,505.943,6.058z"/></g></g><g><g><path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/></g></g></svg>',
2131      next: '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"> <g><path d="M360.731,229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1,0s-5.3,13.8,0,19.1l215.5,215.5l-215.5,215.5c-5.3,5.3-5.3,13.8,0,19.1c2.6,2.6,6.1,4,9.5,4c3.4,0,6.9-1.3,9.5-4l225.1-225.1C365.931,242.875,365.931,234.275,360.731,229.075z"/></g></svg>',
2132      prev: '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"><g><path d="M145.188,238.575l215.5-215.5c5.3-5.3,5.3-13.8,0-19.1s-13.8-5.3-19.1,0l-225.1,225.1c-5.3,5.3-5.3,13.8,0,19.1l225.1,225c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4c5.3-5.3,5.3-13.8,0-19.1L145.188,238.575z"/></g></svg>'
2133    }
2134  };
2135  defaults.slideHTML = "<div class=\"gslide\">\n    <div class=\"gslide-inner-content\">\n        <div class=\"ginner-container\">\n            <div class=\"gslide-media\">\n            </div>\n            <div class=\"gslide-description\">\n                <div class=\"gdesc-inner\">\n                    <h4 class=\"gslide-title\"></h4>\n                    <div class=\"gslide-desc\"></div>\n                </div>\n            </div>\n        </div>\n    </div>\n</div>";
2136  defaults.lightboxHTML = "<div id=\"glightbox-body\" class=\"glightbox-container\" tabindex=\"-1\" role=\"dialog\" aria-hidden=\"false\">\n    <div class=\"gloader visible\"></div>\n    <div class=\"goverlay\"></div>\n    <div class=\"gcontainer\">\n    <div id=\"glightbox-slider\" class=\"gslider\"></div>\n    <button class=\"gclose gbtn\" aria-label=\"Close\" data-taborder=\"3\">{closeSVG}</button>\n    <button class=\"gprev gbtn\" aria-label=\"Previous\" data-taborder=\"2\">{prevSVG}</button>\n    <button class=\"gnext gbtn\" aria-label=\"Next\" data-taborder=\"1\">{nextSVG}</button>\n</div>\n</div>";
2137  var GlightboxInit = function () {
2138    function GlightboxInit() {
2139      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2140      _classCallCheck(this, GlightboxInit);
2141      this.customOptions = options;
2142      this.settings = extend(defaults, options);
2143      this.effectsClasses = this.getAnimationClasses();
2144      this.videoPlayers = {};
2145      this.apiEvents = [];
2146      this.fullElementsList = false;
2147    }
2148    return _createClass(GlightboxInit, [{
2149      key: "init",
2150      value: function init() {
2151        var _this = this;
2152        var selector = this.getSelector();
2153        if (selector) {
2154          this.baseEvents = addEvent('click', {
2155            onElement: selector,
2156            withCallback: function withCallback(e, target) {
2157              e.preventDefault();
2158              _this.open(target);
2159            }
2160          });
2161        }
2162        this.elements = this.getElements();
2163      }
2164    }, {
2165      key: "open",
2166      value: function open() {
2167        var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2168        var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2169        if (this.elements.length === 0) {
2170          return false;
2171        }
2172        this.activeSlide = null;
2173        this.prevActiveSlideIndex = null;
2174        this.prevActiveSlide = null;
2175        var index = isNumber(startAt) ? startAt : this.settings.startAt;
2176        if (isNode(element)) {
2177          var gallery = element.getAttribute('data-gallery');
2178          if (gallery) {
2179            this.fullElementsList = this.elements;
2180            this.elements = this.getGalleryElements(this.elements, gallery);
2181          }
2182          if (isNil(index)) {
2183            index = this.getElementIndex(element);
2184            if (index < 0) {
2185              index = 0;
2186            }
2187          }
2188        }
2189        if (!isNumber(index)) {
2190          index = 0;
2191        }
2192        this.build();
2193        animateElement(this.overlay, this.settings.openEffect === 'none' ? 'none' : this.settings.cssEfects.fade["in"]);
2194        var body = document.body;
2195        var scrollBar = window.innerWidth - document.documentElement.clientWidth;
2196        if (scrollBar > 0) {
2197          var styleSheet = document.createElement('style');
2198          styleSheet.type = 'text/css';
2199          styleSheet.className = 'gcss-styles';
2200          styleSheet.innerText = ".gscrollbar-fixer {margin-right: ".concat(scrollBar, "px}");
2201          document.head.appendChild(styleSheet);
2202          addClass(body, 'gscrollbar-fixer');
2203        }
2204        addClass(body, 'glightbox-open');
2205        addClass(html, 'glightbox-open');
2206        if (isMobile$1) {
2207          addClass(document.body, 'glightbox-mobile');
2208          this.settings.slideEffect = 'slide';
2209        }
2210        this.showSlide(index, true);
2211        if (this.elements.length === 1) {
2212          addClass(this.prevButton, 'glightbox-button-hidden');
2213          addClass(this.nextButton, 'glightbox-button-hidden');
2214        } else {
2215          removeClass(this.prevButton, 'glightbox-button-hidden');
2216          removeClass(this.nextButton, 'glightbox-button-hidden');
2217        }
2218        this.lightboxOpen = true;
2219        this.trigger('open');
2220        if (isFunction(this.settings.onOpen)) {
2221          this.settings.onOpen();
2222        }
2223        if (isTouch$1 && this.settings.touchNavigation) {
2224          touchNavigation(this);
2225        }
2226        if (this.settings.keyboardNavigation) {
2227          keyboardNavigation(this);
2228        }
2229      }
2230    }, {
2231      key: "openAt",
2232      value: function openAt() {
2233        var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2234        this.open(null, index);
2235      }
2236    }, {
2237      key: "showSlide",
2238      value: function showSlide() {
2239        var _this2 = this;
2240        var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2241        var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2242        show(this.loader);
2243        this.index = parseInt(index);
2244        var current = this.slidesContainer.querySelector('.current');
2245        if (current) {
2246          removeClass(current, 'current');
2247        }
2248        this.slideAnimateOut();
2249        var slideNode = this.slidesContainer.querySelectorAll('.gslide')[index];
2250        if (hasClass(slideNode, 'loaded')) {
2251          this.slideAnimateIn(slideNode, first);
2252          hide(this.loader);
2253        } else {
2254          show(this.loader);
2255          var slide = this.elements[index];
2256          var slideData = {
2257            index: this.index,
2258            slide: slideNode,
2259            slideNode: slideNode,
2260            slideConfig: slide.slideConfig,
2261            slideIndex: this.index,
2262            trigger: slide.node,
2263            player: null
2264          };
2265          this.trigger('slide_before_load', slideData);
2266          slide.instance.setContent(slideNode, function () {
2267            hide(_this2.loader);
2268            _this2.resize();
2269            _this2.slideAnimateIn(slideNode, first);
2270            _this2.trigger('slide_after_load', slideData);
2271          });
2272        }
2273        this.slideDescription = slideNode.querySelector('.gslide-description');
2274        this.slideDescriptionContained = this.slideDescription && hasClass(this.slideDescription.parentNode, 'gslide-media');
2275        if (this.settings.preload) {
2276          this.preloadSlide(index + 1);
2277          this.preloadSlide(index - 1);
2278        }
2279        this.updateNavigationClasses();
2280        this.activeSlide = slideNode;
2281      }
2282    }, {
2283      key: "preloadSlide",
2284      value: function preloadSlide(index) {
2285        var _this3 = this;
2286        if (index < 0 || index > this.elements.length - 1) {
2287          return false;
2288        }
2289        if (isNil(this.elements[index])) {
2290          return false;
2291        }
2292        var slideNode = this.slidesContainer.querySelectorAll('.gslide')[index];
2293        if (hasClass(slideNode, 'loaded')) {
2294          return false;
2295        }
2296        var slide = this.elements[index];
2297        var type = slide.type;
2298        var slideData = {
2299          index: index,
2300          slide: slideNode,
2301          slideNode: slideNode,
2302          slideConfig: slide.slideConfig,
2303          slideIndex: index,
2304          trigger: slide.node,
2305          player: null
2306        };
2307        this.trigger('slide_before_load', slideData);
2308        if (type === 'video' || type === 'external') {
2309          setTimeout(function () {
2310            slide.instance.setContent(slideNode, function () {
2311              _this3.trigger('slide_after_load', slideData);
2312            });
2313          }, 200);
2314        } else {
2315          slide.instance.setContent(slideNode, function () {
2316            _this3.trigger('slide_after_load', slideData);
2317          });
2318        }
2319      }
2320    }, {
2321      key: "prevSlide",
2322      value: function prevSlide() {
2323        this.goToSlide(this.index - 1);
2324      }
2325    }, {
2326      key: "nextSlide",
2327      value: function nextSlide() {
2328        this.goToSlide(this.index + 1);
2329      }
2330    }, {
2331      key: "goToSlide",
2332      value: function goToSlide() {
2333        var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2334        this.prevActiveSlide = this.activeSlide;
2335        this.prevActiveSlideIndex = this.index;
2336        if (!this.loop() && (index < 0 || index > this.elements.length - 1)) {
2337          return false;
2338        }
2339        if (index < 0) {
2340          index = this.elements.length - 1;
2341        } else if (index >= this.elements.length) {
2342          index = 0;
2343        }
2344        this.showSlide(index);
2345      }
2346    }, {
2347      key: "insertSlide",
2348      value: function insertSlide() {
2349        var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2350        var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
2351        if (index < 0) {
2352          index = this.elements.length;
2353        }
2354        var slide = new Slide(config, this, index);
2355        var data = slide.getConfig();
2356        var slideInfo = extend({}, data);
2357        var newSlide = slide.create();
2358        var totalSlides = this.elements.length - 1;
2359        slideInfo.index = index;
2360        slideInfo.node = false;
2361        slideInfo.instance = slide;
2362        slideInfo.slideConfig = data;
2363        this.elements.splice(index, 0, slideInfo);
2364        var addedSlideNode = null;
2365        var addedSlidePlayer = null;
2366        if (this.slidesContainer) {
2367          if (index > totalSlides) {
2368            this.slidesContainer.appendChild(newSlide);
2369          } else {
2370            var existingSlide = this.slidesContainer.querySelectorAll('.gslide')[index];
2371            this.slidesContainer.insertBefore(newSlide, existingSlide);
2372          }
2373          if (this.settings.preload && this.index == 0 && index == 0 || this.index - 1 == index || this.index + 1 == index) {
2374            this.preloadSlide(index);
2375          }
2376          if (this.index === 0 && index === 0) {
2377            this.index = 1;
2378          }
2379          this.updateNavigationClasses();
2380          addedSlideNode = this.slidesContainer.querySelectorAll('.gslide')[index];
2381          addedSlidePlayer = this.getSlidePlayerInstance(index);
2382          slideInfo.slideNode = addedSlideNode;
2383        }
2384        this.trigger('slide_inserted', {
2385          index: index,
2386          slide: addedSlideNode,
2387          slideNode: addedSlideNode,
2388          slideConfig: data,
2389          slideIndex: index,
2390          trigger: null,
2391          player: addedSlidePlayer
2392        });
2393        if (isFunction(this.settings.slideInserted)) {
2394          this.settings.slideInserted({
2395            index: index,
2396            slide: addedSlideNode,
2397            player: addedSlidePlayer
2398          });
2399        }
2400      }
2401    }, {
2402      key: "removeSlide",
2403      value: function removeSlide() {
2404        var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
2405        if (index < 0 || index > this.elements.length - 1) {
2406          return false;
2407        }
2408        var slide = this.slidesContainer && this.slidesContainer.querySelectorAll('.gslide')[index];
2409        if (slide) {
2410          if (this.getActiveSlideIndex() == index) {
2411            if (index == this.elements.length - 1) {
2412              this.prevSlide();
2413            } else {
2414              this.nextSlide();
2415            }
2416          }
2417          slide.parentNode.removeChild(slide);
2418        }
2419        this.elements.splice(index, 1);
2420        this.trigger('slide_removed', index);
2421        if (isFunction(this.settings.slideRemoved)) {
2422          this.settings.slideRemoved(index);
2423        }
2424      }
2425    }, {
2426      key: "slideAnimateIn",
2427      value: function slideAnimateIn(slide, first) {
2428        var _this4 = this;
2429        var slideMedia = slide.querySelector('.gslide-media');
2430        var slideDesc = slide.querySelector('.gslide-description');
2431        var prevData = {
2432          index: this.prevActiveSlideIndex,
2433          slide: this.prevActiveSlide,
2434          slideNode: this.prevActiveSlide,
2435          slideIndex: this.prevActiveSlide,
2436          slideConfig: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig,
2437          trigger: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node,
2438          player: this.getSlidePlayerInstance(this.prevActiveSlideIndex)
2439        };
2440        var nextData = {
2441          index: this.index,
2442          slide: this.activeSlide,
2443          slideNode: this.activeSlide,
2444          slideConfig: this.elements[this.index].slideConfig,
2445          slideIndex: this.index,
2446          trigger: this.elements[this.index].node,
2447          player: this.getSlidePlayerInstance(this.index)
2448        };
2449        if (slideMedia.offsetWidth > 0 && slideDesc) {
2450          hide(slideDesc);
2451          slideDesc.style.display = '';
2452        }
2453        removeClass(slide, this.effectsClasses);
2454        if (first) {
2455          animateElement(slide, this.settings.cssEfects[this.settings.openEffect]["in"], function () {
2456            if (_this4.settings.autoplayVideos) {
2457              _this4.slidePlayerPlay(slide);
2458            }
2459            _this4.trigger('slide_changed', {
2460              prev: prevData,
2461              current: nextData
2462            });
2463            if (isFunction(_this4.settings.afterSlideChange)) {
2464              _this4.settings.afterSlideChange.apply(_this4, [prevData, nextData]);
2465            }
2466          });
2467        } else {
2468          var effectName = this.settings.slideEffect;
2469          var animIn = effectName !== 'none' ? this.settings.cssEfects[effectName]["in"] : effectName;
2470          if (this.prevActiveSlideIndex > this.index) {
2471            if (this.settings.slideEffect == 'slide') {
2472              animIn = this.settings.cssEfects.slideBack["in"];
2473            }
2474          }
2475          animateElement(slide, animIn, function () {
2476            if (_this4.settings.autoplayVideos) {
2477              _this4.slidePlayerPlay(slide);
2478            }
2479            _this4.trigger('slide_changed', {
2480              prev: prevData,
2481              current: nextData
2482            });
2483            if (isFunction(_this4.settings.afterSlideChange)) {
2484              _this4.settings.afterSlideChange.apply(_this4, [prevData, nextData]);
2485            }
2486          });
2487        }
2488        setTimeout(function () {
2489          _this4.resize(slide);
2490        }, 100);
2491        addClass(slide, 'current');
2492      }
2493    }, {
2494      key: "slideAnimateOut",
2495      value: function slideAnimateOut() {
2496        if (!this.prevActiveSlide) {
2497          return false;
2498        }
2499        var prevSlide = this.prevActiveSlide;
2500        removeClass(prevSlide, this.effectsClasses);
2501        addClass(prevSlide, 'prev');
2502        var animation = this.settings.slideEffect;
2503        var animOut = animation !== 'none' ? this.settings.cssEfects[animation].out : animation;
2504        this.slidePlayerPause(prevSlide);
2505        this.trigger('slide_before_change', {
2506          prev: {
2507            index: this.prevActiveSlideIndex,
2508            slide: this.prevActiveSlide,
2509            slideNode: this.prevActiveSlide,
2510            slideIndex: this.prevActiveSlideIndex,
2511            slideConfig: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].slideConfig,
2512            trigger: isNil(this.prevActiveSlideIndex) ? null : this.elements[this.prevActiveSlideIndex].node,
2513            player: this.getSlidePlayerInstance(this.prevActiveSlideIndex)
2514          },
2515          current: {
2516            index: this.index,
2517            slide: this.activeSlide,
2518            slideNode: this.activeSlide,
2519            slideIndex: this.index,
2520            slideConfig: this.elements[this.index].slideConfig,
2521            trigger: this.elements[this.index].node,
2522            player: this.getSlidePlayerInstance(this.index)
2523          }
2524        });
2525        if (isFunction(this.settings.beforeSlideChange)) {
2526          this.settings.beforeSlideChange.apply(this, [{
2527            index: this.prevActiveSlideIndex,
2528            slide: this.prevActiveSlide,
2529            player: this.getSlidePlayerInstance(this.prevActiveSlideIndex)
2530          }, {
2531            index: this.index,
2532            slide: this.activeSlide,
2533            player: this.getSlidePlayerInstance(this.index)
2534          }]);
2535        }
2536        if (this.prevActiveSlideIndex > this.index && this.settings.slideEffect == 'slide') {
2537          animOut = this.settings.cssEfects.slideBack.out;
2538        }
2539        animateElement(prevSlide, animOut, function () {
2540          var container = prevSlide.querySelector('.ginner-container');
2541          var media = prevSlide.querySelector('.gslide-media');
2542          var desc = prevSlide.querySelector('.gslide-description');
2543          container.style.transform = '';
2544          media.style.transform = '';
2545          removeClass(media, 'greset');
2546          media.style.opacity = '';
2547          if (desc) {
2548            desc.style.opacity = '';
2549          }
2550          removeClass(prevSlide, 'prev');
2551        });
2552      }
2553    }, {
2554      key: "getAllPlayers",
2555      value: function getAllPlayers() {
2556        return this.videoPlayers;
2557      }
2558    }, {
2559      key: "getSlidePlayerInstance",
2560      value: function getSlidePlayerInstance(index) {
2561        var id = 'gvideo' + index;
2562        var videoPlayers = this.getAllPlayers();
2563        if (has(videoPlayers, id) && videoPlayers[id]) {
2564          return videoPlayers[id];
2565        }
2566        return false;
2567      }
2568    }, {
2569      key: "stopSlideVideo",
2570      value: function stopSlideVideo(slide) {
2571        if (isNode(slide)) {
2572          var node = slide.querySelector('.gvideo-wrapper');
2573          if (node) {
2574            slide = node.getAttribute('data-index');
2575          }
2576        }
2577        console.log('stopSlideVideo is deprecated, use slidePlayerPause');
2578        var player = this.getSlidePlayerInstance(slide);
2579        if (player && player.playing) {
2580          player.pause();
2581        }
2582      }
2583    }, {
2584      key: "slidePlayerPause",
2585      value: function slidePlayerPause(slide) {
2586        if (isNode(slide)) {
2587          var node = slide.querySelector('.gvideo-wrapper');
2588          if (node) {
2589            slide = node.getAttribute('data-index');
2590          }
2591        }
2592        var player = this.getSlidePlayerInstance(slide);
2593        if (player && player.playing) {
2594          player.pause();
2595        }
2596      }
2597    }, {
2598      key: "playSlideVideo",
2599      value: function playSlideVideo(slide) {
2600        if (isNode(slide)) {
2601          var node = slide.querySelector('.gvideo-wrapper');
2602          if (node) {
2603            slide = node.getAttribute('data-index');
2604          }
2605        }
2606        console.log('playSlideVideo is deprecated, use slidePlayerPlay');
2607        var player = this.getSlidePlayerInstance(slide);
2608        if (player && !player.playing) {
2609          player.play();
2610        }
2611      }
2612    }, {
2613      key: "slidePlayerPlay",
2614      value: function slidePlayerPlay(slide) {
2615        var _this$settings$plyr$c;
2616        if (isMobile$1 && !((_this$settings$plyr$c = this.settings.plyr.config) !== null && _this$settings$plyr$c !== void 0 && _this$settings$plyr$c.muted)) {
2617          return;
2618        }
2619        if (isNode(slide)) {
2620          var node = slide.querySelector('.gvideo-wrapper');
2621          if (node) {
2622            slide = node.getAttribute('data-index');
2623          }
2624        }
2625        var player = this.getSlidePlayerInstance(slide);
2626        if (player && !player.playing) {
2627          player.play();
2628          if (this.settings.autofocusVideos) {
2629            player.elements.container.focus();
2630          }
2631        }
2632      }
2633    }, {
2634      key: "setElements",
2635      value: function setElements(elements) {
2636        var _this5 = this;
2637        this.settings.elements = false;
2638        var newElements = [];
2639        if (elements && elements.length) {
2640          each(elements, function (el, i) {
2641            var slide = new Slide(el, _this5, i);
2642            var data = slide.getConfig();
2643            var slideInfo = extend({}, data);
2644            slideInfo.slideConfig = data;
2645            slideInfo.instance = slide;
2646            slideInfo.index = i;
2647            newElements.push(slideInfo);
2648          });
2649        }
2650        this.elements = newElements;
2651        if (this.lightboxOpen) {
2652          this.slidesContainer.innerHTML = '';
2653          if (this.elements.length) {
2654            each(this.elements, function () {
2655              var slide = createHTML(_this5.settings.slideHTML);
2656              _this5.slidesContainer.appendChild(slide);
2657            });
2658            this.showSlide(0, true);
2659          }
2660        }
2661      }
2662    }, {
2663      key: "getElementIndex",
2664      value: function getElementIndex(node) {
2665        var index = false;
2666        each(this.elements, function (el, i) {
2667          if (has(el, 'node') && el.node == node) {
2668            index = i;
2669            return true;
2670          }
2671        });
2672        return index;
2673      }
2674    }, {
2675      key: "getElements",
2676      value: function getElements() {
2677        var _this6 = this;
2678        var list = [];
2679        this.elements = this.elements ? this.elements : [];
2680        if (!isNil(this.settings.elements) && isArray(this.settings.elements) && this.settings.elements.length) {
2681          each(this.settings.elements, function (el, i) {
2682            var slide = new Slide(el, _this6, i);
2683            var elData = slide.getConfig();
2684            var slideInfo = extend({}, elData);
2685            slideInfo.node = false;
2686            slideInfo.index = i;
2687            slideInfo.instance = slide;
2688            slideInfo.slideConfig = elData;
2689            list.push(slideInfo);
2690          });
2691        }
2692        var nodes = false;
2693        var selector = this.getSelector();
2694        if (selector) {
2695          nodes = document.querySelectorAll(this.getSelector());
2696        }
2697        if (!nodes) {
2698          return list;
2699        }
2700        each(nodes, function (el, i) {
2701          var slide = new Slide(el, _this6, i);
2702          var elData = slide.getConfig();
2703          var slideInfo = extend({}, elData);
2704          slideInfo.node = el;
2705          slideInfo.index = i;
2706          slideInfo.instance = slide;
2707          slideInfo.slideConfig = elData;
2708          slideInfo.gallery = el.getAttribute('data-gallery');
2709          list.push(slideInfo);
2710        });
2711        return list;
2712      }
2713    }, {
2714      key: "getGalleryElements",
2715      value: function getGalleryElements(list, gallery) {
2716        return list.filter(function (el) {
2717          return el.gallery == gallery;
2718        });
2719      }
2720    }, {
2721      key: "getSelector",
2722      value: function getSelector() {
2723        if (this.settings.elements) {
2724          return false;
2725        }
2726        if (this.settings.selector && this.settings.selector.substring(0, 5) == 'data-') {
2727          return "*[".concat(this.settings.selector, "]");
2728        }
2729        return this.settings.selector;
2730      }
2731    }, {
2732      key: "getActiveSlide",
2733      value: function getActiveSlide() {
2734        return this.slidesContainer.querySelectorAll('.gslide')[this.index];
2735      }
2736    }, {
2737      key: "getActiveSlideIndex",
2738      value: function getActiveSlideIndex() {
2739        return this.index;
2740      }
2741    }, {
2742      key: "getAnimationClasses",
2743      value: function getAnimationClasses() {
2744        var effects = [];
2745        for (var key in this.settings.cssEfects) {
2746          if (this.settings.cssEfects.hasOwnProperty(key)) {
2747            var effect = this.settings.cssEfects[key];
2748            effects.push("g".concat(effect["in"]));
2749            effects.push("g".concat(effect.out));
2750          }
2751        }
2752        return effects.join(' ');
2753      }
2754    }, {
2755      key: "build",
2756      value: function build() {
2757        var _this7 = this;
2758        if (this.built) {
2759          return false;
2760        }
2761        var children = document.body.childNodes;
2762        var bodyChildElms = [];
2763        each(children, function (el) {
2764          if (el.parentNode == document.body && el.nodeName.charAt(0) !== '#' && el.hasAttribute && !el.hasAttribute('aria-hidden')) {
2765            bodyChildElms.push(el);
2766            el.setAttribute('aria-hidden', 'true');
2767          }
2768        });
2769        var nextSVG = has(this.settings.svg, 'next') ? this.settings.svg.next : '';
2770        var prevSVG = has(this.settings.svg, 'prev') ? this.settings.svg.prev : '';
2771        var closeSVG = has(this.settings.svg, 'close') ? this.settings.svg.close : '';
2772        var lightboxHTML = this.settings.lightboxHTML;
2773        lightboxHTML = lightboxHTML.replace(/{nextSVG}/g, nextSVG);
2774        lightboxHTML = lightboxHTML.replace(/{prevSVG}/g, prevSVG);
2775        lightboxHTML = lightboxHTML.replace(/{closeSVG}/g, closeSVG);
2776        lightboxHTML = createHTML(lightboxHTML);
2777        document.body.appendChild(lightboxHTML);
2778        var modal = document.getElementById('glightbox-body');
2779        this.modal = modal;
2780        var closeButton = modal.querySelector('.gclose');
2781        this.prevButton = modal.querySelector('.gprev');
2782        this.nextButton = modal.querySelector('.gnext');
2783        this.overlay = modal.querySelector('.goverlay');
2784        this.loader = modal.querySelector('.gloader');
2785        this.slidesContainer = document.getElementById('glightbox-slider');
2786        this.bodyHiddenChildElms = bodyChildElms;
2787        this.events = {};
2788        addClass(this.modal, 'glightbox-' + this.settings.skin);
2789        if (this.settings.closeButton && closeButton) {
2790          this.events['close'] = addEvent('click', {
2791            onElement: closeButton,
2792            withCallback: function withCallback(e, target) {
2793              e.preventDefault();
2794              _this7.close();
2795            }
2796          });
2797        }
2798        if (closeButton && !this.settings.closeButton) {
2799          closeButton.parentNode.removeChild(closeButton);
2800        }
2801        if (this.nextButton) {
2802          this.events['next'] = addEvent('click', {
2803            onElement: this.nextButton,
2804            withCallback: function withCallback(e, target) {
2805              e.preventDefault();
2806              _this7.nextSlide();
2807            }
2808          });
2809        }
2810        if (this.prevButton) {
2811          this.events['prev'] = addEvent('click', {
2812            onElement: this.prevButton,
2813            withCallback: function withCallback(e, target) {
2814              e.preventDefault();
2815              _this7.prevSlide();
2816            }
2817          });
2818        }
2819        if (this.settings.closeOnOutsideClick) {
2820          this.events['outClose'] = addEvent('click', {
2821            onElement: modal,
2822            withCallback: function withCallback(e, target) {
2823              if (!_this7.preventOutsideClick && !hasClass(document.body, 'glightbox-mobile') && !closest(e.target, '.ginner-container')) {
2824                if (!closest(e.target, '.gbtn') && !hasClass(e.target, 'gnext') && !hasClass(e.target, 'gprev')) {
2825                  _this7.close();
2826                }
2827              }
2828            }
2829          });
2830        }
2831        each(this.elements, function (slide, i) {
2832          _this7.slidesContainer.appendChild(slide.instance.create());
2833          slide.slideNode = _this7.slidesContainer.querySelectorAll('.gslide')[i];
2834        });
2835        if (isTouch$1) {
2836          addClass(document.body, 'glightbox-touch');
2837        }
2838        this.events['resize'] = addEvent('resize', {
2839          onElement: window,
2840          withCallback: function withCallback() {
2841            _this7.resize();
2842          }
2843        });
2844        this.built = true;
2845      }
2846    }, {
2847      key: "resize",
2848      value: function resize() {
2849        var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2850        slide = !slide ? this.activeSlide : slide;
2851        if (!slide || hasClass(slide, 'zoomed')) {
2852          return;
2853        }
2854        var winSize = windowSize();
2855        var video = slide.querySelector('.gvideo-wrapper');
2856        var image = slide.querySelector('.gslide-image');
2857        var description = this.slideDescription;
2858        var winWidth = winSize.width;
2859        var winHeight = winSize.height;
2860        if (winWidth <= 768) {
2861          addClass(document.body, 'glightbox-mobile');
2862        } else {
2863          removeClass(document.body, 'glightbox-mobile');
2864        }
2865        if (!video && !image) {
2866          return;
2867        }
2868        var descriptionResize = false;
2869        if (description && (hasClass(description, 'description-bottom') || hasClass(description, 'description-top')) && !hasClass(description, 'gabsolute')) {
2870          descriptionResize = true;
2871        }
2872        if (image) {
2873          if (winWidth <= 768) {
2874            var imgNode = image.querySelector('img');
2875          } else if (descriptionResize) {
2876            var _slideTriggerNode$get;
2877            var descHeight = description.offsetHeight;
2878            var _imgNode = image.querySelector('img');
2879            var slideTriggerNode = this.elements[this.index].node;
2880            var maxHeightValue = (_slideTriggerNode$get = slideTriggerNode.getAttribute('data-height')) !== null && _slideTriggerNode$get !== void 0 ? _slideTriggerNode$get : '100vh';
2881            _imgNode.setAttribute('style', "max-height: calc(".concat(maxHeightValue, " - ").concat(descHeight, "px)"));
2882            description.setAttribute('style', "max-width: ".concat(_imgNode.offsetWidth, "px;"));
2883          }
2884        }
2885        if (video) {
2886          var ratio = has(this.settings.plyr.config, 'ratio') ? this.settings.plyr.config.ratio : '';
2887          if (!ratio) {
2888            var containerWidth = video.clientWidth;
2889            var containerHeight = video.clientHeight;
2890            var divisor = containerWidth / containerHeight;
2891            ratio = "".concat(containerWidth / divisor, ":").concat(containerHeight / divisor);
2892          }
2893          var videoRatio = ratio.split(':');
2894          var videoWidth = this.settings.videosWidth;
2895          var maxWidth = this.settings.videosWidth;
2896          if (isNumber(videoWidth) || videoWidth.indexOf('px') !== -1) {
2897            maxWidth = parseInt(videoWidth);
2898          } else {
2899            if (videoWidth.indexOf('vw') !== -1) {
2900              maxWidth = winWidth * parseInt(videoWidth) / 100;
2901            } else if (videoWidth.indexOf('vh') !== -1) {
2902              maxWidth = winHeight * parseInt(videoWidth) / 100;
2903            } else if (videoWidth.indexOf('%') !== -1) {
2904              maxWidth = winWidth * parseInt(videoWidth) / 100;
2905            } else {
2906              maxWidth = parseInt(video.clientWidth);
2907            }
2908          }
2909          var maxHeight = maxWidth / (parseInt(videoRatio[0]) / parseInt(videoRatio[1]));
2910          maxHeight = Math.floor(maxHeight);
2911          if (descriptionResize) {
2912            winHeight = winHeight - description.offsetHeight;
2913          }
2914          if (maxWidth > winWidth || maxHeight > winHeight || winHeight < maxHeight && winWidth > maxWidth) {
2915            var vwidth = video.offsetWidth;
2916            var vheight = video.offsetHeight;
2917            var _ratio = winHeight / vheight;
2918            var vsize = {
2919              width: vwidth * _ratio,
2920              height: vheight * _ratio
2921            };
2922            video.parentNode.setAttribute('style', "max-width: ".concat(vsize.width, "px"));
2923            if (descriptionResize) {
2924              description.setAttribute('style', "max-width: ".concat(vsize.width, "px;"));
2925            }
2926          } else {
2927            video.parentNode.style.maxWidth = "".concat(videoWidth);
2928            if (descriptionResize) {
2929              description.setAttribute('style', "max-width: ".concat(videoWidth, ";"));
2930            }
2931          }
2932        }
2933      }
2934    }, {
2935      key: "reload",
2936      value: function reload() {
2937        this.init();
2938      }
2939    }, {
2940      key: "updateNavigationClasses",
2941      value: function updateNavigationClasses() {
2942        var loop = this.loop();
2943        removeClass(this.nextButton, 'disabled');
2944        removeClass(this.prevButton, 'disabled');
2945        if (this.index == 0 && this.elements.length - 1 == 0) {
2946          addClass(this.prevButton, 'disabled');
2947          addClass(this.nextButton, 'disabled');
2948        } else if (this.index === 0 && !loop) {
2949          addClass(this.prevButton, 'disabled');
2950        } else if (this.index === this.elements.length - 1 && !loop) {
2951          addClass(this.nextButton, 'disabled');
2952        }
2953      }
2954    }, {
2955      key: "loop",
2956      value: function loop() {
2957        var loop = has(this.settings, 'loopAtEnd') ? this.settings.loopAtEnd : null;
2958        loop = has(this.settings, 'loop') ? this.settings.loop : loop;
2959        return loop;
2960      }
2961    }, {
2962      key: "close",
2963      value: function close() {
2964        var _this8 = this;
2965        if (!this.lightboxOpen) {
2966          if (this.events) {
2967            for (var key in this.events) {
2968              if (this.events.hasOwnProperty(key)) {
2969                this.events[key].destroy();
2970              }
2971            }
2972            this.events = null;
2973          }
2974          return false;
2975        }
2976        if (this.closing) {
2977          return false;
2978        }
2979        this.closing = true;
2980        this.slidePlayerPause(this.activeSlide);
2981        if (this.fullElementsList) {
2982          this.elements = this.fullElementsList;
2983        }
2984        if (this.bodyHiddenChildElms.length) {
2985          each(this.bodyHiddenChildElms, function (el) {
2986            el.removeAttribute('aria-hidden');
2987          });
2988        }
2989        addClass(this.modal, 'glightbox-closing');
2990        animateElement(this.overlay, this.settings.openEffect == 'none' ? 'none' : this.settings.cssEfects.fade.out);
2991        animateElement(this.activeSlide, this.settings.cssEfects[this.settings.closeEffect].out, function () {
2992          _this8.activeSlide = null;
2993          _this8.prevActiveSlideIndex = null;
2994          _this8.prevActiveSlide = null;
2995          _this8.built = false;
2996          if (_this8.events) {
2997            for (var _key in _this8.events) {
2998              if (_this8.events.hasOwnProperty(_key)) {
2999                _this8.events[_key].destroy();
3000              }
3001            }
3002            _this8.events = null;
3003          }
3004          var body = document.body;
3005          removeClass(html, 'glightbox-open');
3006          removeClass(body, 'glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer');
3007          _this8.modal.parentNode.removeChild(_this8.modal);
3008          _this8.trigger('close');
3009          if (isFunction(_this8.settings.onClose)) {
3010            _this8.settings.onClose();
3011          }
3012          var styles = document.querySelector('.gcss-styles');
3013          if (styles) {
3014            styles.parentNode.removeChild(styles);
3015          }
3016          _this8.lightboxOpen = false;
3017          _this8.closing = null;
3018        });
3019      }
3020    }, {
3021      key: "destroy",
3022      value: function destroy() {
3023        this.close();
3024        this.clearAllEvents();
3025        if (this.baseEvents) {
3026          this.baseEvents.destroy();
3027        }
3028      }
3029    }, {
3030      key: "on",
3031      value: function on(evt, callback) {
3032        var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3033        if (!evt || !isFunction(callback)) {
3034          throw new TypeError('Event name and callback must be defined');
3035        }
3036        this.apiEvents.push({
3037          evt: evt,
3038          once: once,
3039          callback: callback
3040        });
3041      }
3042    }, {
3043      key: "once",
3044      value: function once(evt, callback) {
3045        this.on(evt, callback, true);
3046      }
3047    }, {
3048      key: "trigger",
3049      value: function trigger(eventName) {
3050        var _this9 = this;
3051        var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
3052        var onceTriggered = [];
3053        each(this.apiEvents, function (event, i) {
3054          var evt = event.evt,
3055            once = event.once,
3056            callback = event.callback;
3057          if (evt == eventName) {
3058            callback(data);
3059            if (once) {
3060              onceTriggered.push(i);
3061            }
3062          }
3063        });
3064        if (onceTriggered.length) {
3065          each(onceTriggered, function (i) {
3066            return _this9.apiEvents.splice(i, 1);
3067          });
3068        }
3069      }
3070    }, {
3071      key: "clearAllEvents",
3072      value: function clearAllEvents() {
3073        this.apiEvents.splice(0, this.apiEvents.length);
3074      }
3075    }, {
3076      key: "version",
3077      value: function version() {
3078        return _version;
3079      }
3080    }]);
3081  }();
3082  function glightbox () {
3083    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3084    var instance = new GlightboxInit(options);
3085    instance.init();
3086    return instance;
3087  }
3088
3089  return glightbox;
3090
3091})));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.