PageSourceSearch

https://www.analytikashop.gr/vendor/glightbox/js/glightbox.i46igb6ke6.js

js analytikashop.gr collected 2026-10-10 00:37:34 UTC 109,391 bytes, 3,655 lines download raw bytes

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

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.