/******/ (() => { // webpackBootstrap
var __webpack_exports__ = {};
/*!********************************!*\
  !*** ./assets/new_lightbox.js ***!
  \********************************/
(function ($, window, document, undefined) {
  // ==============================================================================================
  $.fn._init = $.fn.init;

  $.fn.init = function (selector, context, root) {
    if (typeof selector === 'string') {
      return new $.fn._init(selector, context, root).data('selector', selector);
    } else {
      return new $.fn._init(selector, context, root);
    }
  };

  $.fn.lightbox = function () {
    var nastavenia = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
    var settings = {
      lightbox_id: false,
      update: false,
      zIndex: 9000,
      popis: false,
      popis_separator: false,
      open_cursor: 'pointer',
      download_image: false
    };

    if (nastavenia) {
      settings = $.extend(settings, nastavenia);
    }

    var lightbox_selector = this.data('selector');
    var Lightbox = {
      obal_update: false,
      obal_selector: lightbox_selector,
      obal_id: 'pd-lightbox',
      settings: settings,
      obal: null,
      obrazky: null,
      isDragged: false,
      currentIndex: 0,
      sX: 0,
      nX: 0,
      disX: 0,
      tX: 0,
      sirka: 0,
      pocet: 0,
      zsX: 0,
      zsY: 0,
      znX: 0,
      znY: 0,
      zdisX: 0,
      zdisY: 0,
      ztX: 0,
      ztY: 0,
      isZoomed: false,
      isZoomActive: false,
      zoom_scale: 1,
      isPinched: false,
      pX1: 0,
      pX2: 0,
      pY1: 0,
      pY2: 0,
      rozX: 0,
      rozY: 0,
      pinchStartDistance: 0,
      pinchMoveDistance: 0,
      pinchEndDistance: 0,
      pinchDotX: 0,
      pinchDotY: 0,
      timeDoubleTapStart: new Date().getTime(),
      timeDoubleTapEnd: false,
      isOneTap: false,
      isDoubleTap: false,
      isDisappear: false,
      zoomBod: {},
      init: function init(prvky) {
        Lightbox.obrazky = prvky;
        Lightbox.pocet = Lightbox.obrazky.length;
        Lightbox.obal = $('#' + Lightbox.obal_id);

        if ($('[data-pd-lightbox="' + Lightbox.obal_selector + '"]').length > 0) {
          Lightbox.obal_update = true;
          Lightbox.aktualizuj_obsah();
          Lightbox.vytvor_udalosti();
        } else {
          Lightbox.obal_update = false;
          Lightbox.skontroluj_obal_id();
          Lightbox.vytvor_obal(Lightbox.obal_id);
          Lightbox.obal = $('#' + Lightbox.obal_id);
          Lightbox.vytvor_obsah();
          Lightbox.vytvor_udalosti();
        }
      },
      skontroluj_obal_id: function skontroluj_obal_id() {
        var el = $('#' + Lightbox.obal_id);

        if (el.length > 0) {
          var i = 1;

          while (el.length > 0) {
            var nove_id = Lightbox.obal_id + '-' + i;
            el = $('#' + nove_id);
            i++;
          }

          Lightbox.obal_id = nove_id;
        }
      },
      aktualizuj_obsah: function aktualizuj_obsah() {
        if (Lightbox.obal_selector) {
          var prvok = $('[data-pd-lightbox="' + Lightbox.obal_selector + '"]');

          if (prvok.length > 0) {
            Lightbox.obal_id = prvok.attr('id');
            Lightbox.obal = $('#' + Lightbox.obal_id);
            Lightbox.vytvor_obsah(prvok);
          }
        }
      },
      vytvor_obal: function vytvor_obal(name_id) {
        var download_image_button = '';

        if (Lightbox.settings.download_image !== false) {
          download_image_button = '<div class="lightbox-button download-image"><a href="#"><i style="color:white;" class="bi bi-download"></i></a></div>';
        }

        var obal_template = "\n                    <div id=\"".concat(name_id, "\" data-pd-lightbox=\"").concat(Lightbox.obal_selector, "\" class=\"slider-obal\">\n                        <div class=\"poradie\"><span class=\"poradie-text\"></span></div>\n                        <div class=\"buttons-obal\">") + download_image_button + "<div class=\"lightbox-button zoom-plus\"><i class=\"bi bi-plus-lg\"></i></div>\n                            <div class=\"lightbox-button zoom-minus\"><i class=\"bi bi-dash-lg\"></i></div>\n                            <div class=\"lightbox-button zoom-reset\"><i class=\"bi bi-fullscreen\"></i></div>\n                            <div class=\"lightbox-button skoncit\"><i class=\"bi bi-x-lg\"></i></div>\n                        </div>\n                        <i class=\"left bi bi-arrow-left-circle\"></i>\n                        <i class=\"right bi bi-arrow-right-circle\"></i>\n                        <div class=\"pd-slider\"></div>\n                    </div>\n                ";
        $('body').append(obal_template);
        Lightbox.obal = $('#' + Lightbox.obal_id);
        $('#' + Lightbox.obal_id).css({
          display: 'none',
          position: 'fixed',
          width: '100vw',
          height: '100vh',
          top: '0px',
          left: '0px',
          backgroundColor: 'rgba(0,0,0,0.8)',
          overflow: 'hidden',
          zIndex: Lightbox.settings.zIndex
        });
        $('#' + Lightbox.obal_id + ' .pd-slider').css({
          position: 'relative',
          top: '0px',
          left: '0px',
          height: '100%',
          display: 'flex',
          zIndex: Lightbox.settings.zIndex + 2,
          cursor: 'grab',
          touchAction: 'none'
        });
        $('#' + Lightbox.obal_id + ' i[class*=arrow-left]').css({
          position: 'absolute',
          top: '50%',
          left: '25px',
          transform: 'translateY(-50%)',
          display: 'inline-block',
          color: 'white',
          fontSize: '75px',
          fontWeight: 'lighter',
          cursor: 'pointer',
          userSelect: 'none',
          textShadow: '0px 0px 15px rgba(0,0,0,1)',
          zIndex: Lightbox.settings.zIndex + 3
        });
        $('#' + Lightbox.obal_id + ' i[class*=arrow-right]').css({
          position: 'absolute',
          top: '50%',
          right: '25px',
          transform: 'translateY(-50%)',
          display: 'inline-block',
          color: 'white',
          fontSize: '75px',
          fontWeight: 'lighter',
          cursor: 'pointer',
          userSelect: 'none',
          textShadow: '0px 0px 15px rgba(0,0,0,1)',
          zIndex: Lightbox.settings.zIndex + 3
        });
        Lightbox.resize_css();
      },
      resize_css: function resize_css() {
        if ($('#' + Lightbox.obal_id).width() <= 300) {
          $('#' + Lightbox.obal_id + ' .buttons-obal').css({
            position: 'absolute',
            top: '0px',
            right: '50%',
            transform: 'translateX(50%)',
            height: '40px',
            width: '150px',
            display: 'flex',
            justifyContent: 'space-between',
            alignItems: 'center',

            /*border: '2px solid white',*/
            borderRadius: '7px',

            /*backgroundColor: 'rgba(0,0,0,0.5)',*/
            zIndex: Lightbox.settings.zIndex + 4
          });
          $('#' + Lightbox.obal_id + ' .lightbox-button').css({
            /*padding: '5px',*/

            /*margin: '0px 5px',*/
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
            fontSize: '15px',
            width: '30px',
            height: '30px',

            /*border: '4px solid white',*/
            borderRadius: '50%',
            color: 'white',
            boxShadow: '0px 0px 15px 0px black',
            textShadow: '0px 0px 15px black',
            userSelect: 'none',
            cursor: 'pointer',
            backgroundColor: 'rgba(0,0,0,0.5)',
            zIndex: Lightbox.settings.zIndex + 4
          });
          $('#' + Lightbox.obal_id + ' .lightbox-button i').css({
            margin: '0px'
          });
          $('#' + Lightbox.obal_id + ' .poradie').css({
            position: 'absolute',
            top: '40px',
            left: '50%',
            padding: '0px 10px',
            transform: 'translateX(-50%)',
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
            height: '30px',

            /*border: '4px solid white',
            borderRadius: '7px',*/
            boxShadow: '0px 0px 15px 0px black',
            textShadow: '0px 0px 15px black',
            backgroundColor: 'rgba(0,0,0,0.5)',
            userSelect: 'none',
            cursor: 'default',
            zIndex: Lightbox.settings.zIndex + 4
          });
          $('#' + Lightbox.obal_id + ' .poradie .poradie-text').css({
            fontSize: '15px',

            /*border: '4px solid white',*/
            color: 'white',
            userSelect: 'none',
            cursor: 'default'
          });
        } else if ($('#' + Lightbox.obal_id).width() <= 570) {
          $('#' + Lightbox.obal_id + ' .buttons-obal').css({
            position: 'absolute',
            top: '0px',
            right: '25px',
            transform: 'translateX(0%)',
            height: '40px',
            width: '150px',
            display: 'flex',
            justifyContent: 'space-between',
            alignItems: 'center',

            /*border: '2px solid white',*/
            borderRadius: '7px',

            /*backgroundColor: 'rgba(0,0,0,0.5)',*/
            zIndex: Lightbox.settings.zIndex + 4
          });
          $('#' + Lightbox.obal_id + ' .lightbox-button').css({
            /*padding: '7px',*/
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
            fontSize: '15px',
            width: '30px',
            height: '30px',

            /*border: '4px solid white',*/
            borderRadius: '50%',
            color: 'white',
            boxShadow: '0px 0px 15px 0px black',
            textShadow: '0px 0px 15px black',
            userSelect: 'none',
            cursor: 'pointer',
            backgroundColor: 'rgba(0,0,0,0.5)',
            zIndex: Lightbox.settings.zIndex + 4
          });
          $('#' + Lightbox.obal_id + ' .lightbox-button i').css({
            margin: '0px'
          });
          $('#' + Lightbox.obal_id + ' .poradie').css({
            position: 'absolute',
            top: '5px',
            left: '25px',
            padding: '0px 10px',
            transform: 'translateX(0%)',
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
            height: '30px',

            /*border: '4px solid white',*/
            borderRadius: '7px',
            boxShadow: '0px 0px 15px 0px black',
            textShadow: '0px 0px 15px black',
            backgroundColor: 'rgba(0,0,0,0.5)',
            userSelect: 'none',
            cursor: 'default',
            zIndex: Lightbox.settings.zIndex + 4
          });
          $('#' + Lightbox.obal_id + ' .poradie .poradie-text').css({
            fontSize: '15px',

            /*border: '4px solid white',*/
            color: 'white',
            userSelect: 'none',
            cursor: 'default'
          });
        } else if ($('#' + Lightbox.obal_id).width() > 570) {
          $('#' + Lightbox.obal_id + ' .buttons-obal').css({
            position: 'absolute',
            top: '0px',
            right: '50px',
            transform: 'translateX(0%)',
            height: '60px',
            width: '345px',
            display: 'flex',
            justifyContent: 'space-between',
            alignItems: 'center',

            /*border: '2px solid white',*/
            borderRadius: '7px',

            /*backgroundColor: 'rgba(0,0,0,0.5)',*/
            zIndex: Lightbox.settings.zIndex + 4
          });
          $('#' + Lightbox.obal_id + ' .lightbox-button').css({
            /*padding: '7px',*/
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
            fontSize: '30px',
            width: '60px',
            height: '60px',

            /*border: '4px solid white',*/
            borderRadius: '50%',
            color: 'white',
            boxShadow: '0px 0px 15px 0px black',
            textShadow: '0px 0px 15px black',
            userSelect: 'none',
            cursor: 'pointer',
            backgroundColor: 'rgba(0,0,0,0.5)',
            zIndex: Lightbox.settings.zIndex + 4
          });
          $('#' + Lightbox.obal_id + ' .lightbox-button i').css({
            margin: '0px'
          });
          $('#' + Lightbox.obal_id + ' .poradie').css({
            position: 'absolute',
            top: '0px',
            left: '50px',
            padding: '0px 10px',
            transform: 'translateX(0%)',
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
            height: '60px',

            /*border: '4px solid white',*/
            borderRadius: '7px',
            boxShadow: '0px 0px 15px 0px black',
            textShadow: '0px 0px 15px black',
            backgroundColor: 'rgba(0,0,0,0.5)',
            userSelect: 'none',
            cursor: 'default',
            zIndex: Lightbox.settings.zIndex + 4
          });
          $('#' + Lightbox.obal_id + ' .poradie .poradie-text').css({
            fontSize: '30px',

            /*border: '4px solid white',*/
            color: 'white',
            userSelect: 'none',
            cursor: 'default'
          });
        }

        if ($('#' + Lightbox.obal_id).width() > 370) {
          $('#' + Lightbox.obal_id + ' i[class*=arrow-left]').css({
            fontSize: '75px',
            left: '25px'
          });
          $('#' + Lightbox.obal_id + ' i[class*=arrow-right]').css({
            fontSize: '75px',
            right: '25px'
          });
        } else if ($('#' + Lightbox.obal_id).width() <= 370) {
          $('#' + Lightbox.obal_id + ' i[class*=arrow-left]').css({
            fontSize: '35px',
            left: '0px'
          });
          $('#' + Lightbox.obal_id + ' i[class*=arrow-right]').css({
            fontSize: '35px',
            right: '0px'
          });
        }

        if ($('#' + Lightbox.obal_id).width() > 250) {
          $('#' + Lightbox.obal_id + ' .popis-nadpis').css({
            fontSize: '25px',
            color: 'white',
            userSelect: 'none',
            textShadow: '0px 0px 15px rgba(0,0,0,1)'
          });
          $('#' + Lightbox.obal_id + ' .popis-text').css({
            fontSize: '16px',
            color: 'white',
            userSelect: 'none',
            textShadow: '0px 0px 15px rgba(0,0,0,1)'
          });
        } else if ($('#' + Lightbox.obal_id).width() <= 250) {
          $('#' + Lightbox.obal_id + ' .popis-nadpis').css({
            fontSize: '18px',
            color: 'white',
            userSelect: 'none',
            textShadow: '0px 0px 15px rgba(0,0,0,1)'
          });
          $('#' + Lightbox.obal_id + ' .popis-text').css({
            fontSize: '14px',
            color: 'white',
            userSelect: 'none',
            textShadow: '0px 0px 15px rgba(0,0,0,1)'
          });
        }
      },
      get_attr_data: function get_attr_data(text, separator) {
        var pole = text.split(separator);
        pole.map(function (prvok) {
          if (prvok) {
            return prvok;
          }
        });
        return pole;
      },
      vytvor_obsah: function vytvor_obsah() {
        var prvok_obal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

        if (prvok_obal !== null) {
          prvok_obal.find('.pd-slider').empty();
        }

        Lightbox.obrazky.each(function (index, el) {
          if ($(el).is('img')) {
            $(el).css({
              cursor: Lightbox.settings.open_cursor
            });
          }

          $(el).on('click', function (e) {
            Lightbox.currentIndex = Lightbox.obrazky.index($(this));
            Lightbox.showLightbox();
          });
          var adresa = $(el).attr('src');

          if (!adresa) {
            adresa = $(el).attr('href');
          }

          var slide = $("\n                        <div class=\"slide\">\n                            <img src=\"".concat(adresa, "\" alt=\"Obrazok\">\n                        </div>\n                    "));
          $('#' + Lightbox.obal_id + ' .pd-slider').append(slide);

          if (Lightbox.settings.popis !== false && Lightbox.settings.popis_separator !== false) {
            var popis = $('<div class="popis-obal"></div>');
            var retazec = $(el).attr(Lightbox.settings.popis);
            var udaje = Lightbox.get_attr_data(retazec, Lightbox.settings.popis_separator);

            for (var i = 0; i < udaje.length; i++) {
              if (Lightbox.settings.popis == 'spd') {
                var polozka = '<a href="' + udaje[3] + '"><span class="aucDetailFlScr bi bi-link">' + udaje[1] + ' <i style="font-weight: normal;">(' + udaje[0] + ')</i>    &nbsp;&nbsp;' + udaje[2] + '</span></a>';
                popis.append(polozka);
                break;
              } else {
                if (i == 0) {
                  var polozka = "<div class=\"popis-nadpis\">".concat(udaje[i], "</div>");
                } else {
                  var polozka = "<div class=\"popis-text\">".concat(udaje[i], "</div>");
                }
              }

              popis.append(polozka);
            }

            slide.append(popis);
          }
        });
        Lightbox.pocet = $('#' + Lightbox.obal_id + ' .pd-slider .slide').length;
        $('#' + Lightbox.obal_id + ' .pd-slider .slide').css({
          position: 'relative',
          height: '100%',
          flex: '0 0 100%',
          display: 'flex',
          flexDirection: 'column',
          justifyContent: 'center',
          alignItems: 'center',
          userSelect: 'none',
          zIndex: Lightbox.settings.zIndex + 3
        });
        $('#' + Lightbox.obal_id + ' .pd-slider .slide img').css({
          position: 'relative',
          display: 'inline-block',
          maxWidth: '100%',
          maxHeight: '100%',
          height: 'auto',
          width: 'auto'
        });
        $('#' + Lightbox.obal_id + ' .popis-obal').css({
          position: 'absolute',
          bottom: '50px',
          left: '0px',
          width: '100%',
          height: '100px',
          display: 'flex',
          flexDirection: 'column',
          justifyContent: 'center',
          alignItems: 'center',
          padding: '7px 0px',
          background: 'linear-gradient(to right, transparent 30%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.5) 60%, transparent 70%)',
          zIndex: Lightbox.settings.zIndex + 4
        });
        $('#' + Lightbox.obal_id + ' .popis-nadpis').css({
          fontSize: '25px',
          color: 'white',
          userSelect: 'none',
          textShadow: '0px 0px 3px rgba(0,0,0,1)'
        });
        $('#' + Lightbox.obal_id + ' .popis-text').css({
          fontSize: '16px',
          color: 'white',
          userSelect: 'none',
          textShadow: '0px 0px 3px rgba(0,0,0,1)'
        });
      },
      vytvor_udalosti: function vytvor_udalosti() {
        $(window).on('resize', function (e) {
          if ($('#' + Lightbox.obal_id).css('display') != 'none') {
            Lightbox.resize_css();
            Lightbox.sirka = $('#' + Lightbox.obal_id).find('.slide').eq(0).width();
            Lightbox.pocet = $('#' + Lightbox.obal_id + ' .pd-slider .slide').length;
            Lightbox.disX = 0; //Lightbox.isDisappear = !Lightbox.isDisappear;

            Lightbox.setPositionByIndex(false);
          }
        }); //$('#' + Lightbox.obal_id).off('keydown');

        $(document).on('keydown', function (e) {
          if ($('#' + Lightbox.obal_id).css('display') != 'none') {
            if (e.keyCode == 37 && Lightbox.isZoomed === true) {
              Lightbox.ztX += 15;
              Lightbox.applyZoomTransform(Lightbox.getCurrentImage());
              console.log('Keydown-Arrow-left -> isZoomed: ' + Lightbox.isZoomed);
            } else if (e.keyCode == 39 && Lightbox.isZoomed === true) {
              Lightbox.ztX -= 15;
              Lightbox.applyZoomTransform(Lightbox.getCurrentImage());
            } else if (e.keyCode == 38 && Lightbox.isZoomed === true) {
              Lightbox.ztY += 15;
              Lightbox.applyZoomTransform(Lightbox.getCurrentImage());
            } else if (e.keyCode == 40 && Lightbox.isZoomed === true) {
              Lightbox.ztY -= 15;
              Lightbox.applyZoomTransform(Lightbox.getCurrentImage());
            } else if (e.keyCode == 107) {
              // tlacitko +
              //alert('Plus');
              $('#' + Lightbox.obal_id).find('.zoom-plus').trigger('click');
            } else if (e.keyCode == 109) {
              // tlacitko -
              //alert('Minus');
              $('#' + Lightbox.obal_id).find('.zoom-minus').trigger('click');
            }
          }
        }); //$('#' + Lightbox.obal_id).off('keyup');

        $(document).on('keyup', function (e) {
          if ($('#' + Lightbox.obal_id).css('display') != 'none') {
            if (e.keyCode == 27) {
              // tlacitko esc
              Lightbox.hideLightbox();
            } else if (e.keyCode == 37 && Lightbox.isZoomed === false) {
              // sipka vlavo
              console.log('Keyup-Arrow-left -> isZoomed: ' + Lightbox.isZoomed);
              Lightbox.moveRight();
            } else if (e.keyCode == 39 && Lightbox.isZoomed === false) {
              // sipka vpravo
              Lightbox.moveLeft();
            } else if (e.keyCode == 96) {
              // tlacitko nula
              Lightbox.centerCurrentImage();
              Lightbox.showLeftRight();
            }
          }
        }); //$(document).off('wheel', '#' + Lightbox.obal_id + ' .pd-slider .slide img');
        //if (Lightbox.obal_update === false) {

        $(document).on('wheel', '#' + Lightbox.obal_id + ' .slide img', function (e) {
          //e.preventDefault();
          //e.stopImmediatePropagation();
          //if ($('#' + Lightbox.obal_id).css('display') != 'none') {
          Lightbox.isZoomed = true;
          Lightbox.hideLeftRight();
          var image = Lightbox.getCurrentImage();
          var suradnice = image.get(0).getBoundingClientRect();
          var sur_x = (e.clientX - suradnice.left) / Lightbox.zoom_scale;
          var sur_y = (e.clientY - suradnice.top) / Lightbox.zoom_scale;
          var delta = e.originalEvent.deltaY;

          if (delta < 0) {
            Lightbox.zoom_scale += 0.2;
          } else {
            Lightbox.zoom_scale -= 0.2;
          }

          var m = delta < 0 ? 0.2 : -1 * 0.2;
          Lightbox.ztX += -sur_x * m + image.outerWidth() * m / 2;
          Lightbox.ztY += -sur_y * m + image.outerHeight() * m / 2;

          if (Lightbox.zoom_scale <= 1) {
            Lightbox.centerCurrentImage();
            Lightbox.showLeftRight();
            return false;
          }

          Lightbox.applyZoomTransform(image);
          image.css({
            transform: "scale(".concat(Lightbox.zoom_scale, ")")
          });
          Lightbox.zoomBod = {
            x: e.clientX,
            y: e.clientY
          };
          console.log('Wheel -> isZoomed: ' + Lightbox.isZoomed);
          Lightbox.isZoomed = true;
          return false; //}
        }); //}

        $('#' + Lightbox.obal_id + ' .skoncit').on('click', function (e) {
          Lightbox.hideLightbox();
        });
        $('#' + Lightbox.obal_id + ' .pd-slider').on('dragstart', function (e) {
          e.preventDefault();
          e.stopPropagation();
          return false;
        });
        /*$(document).on('mousedown touchstart', '[id*="pd-lightbox"]', Lightbox.touchStart);
        $(document).on('mousemove touchmove', '[id*="pd-lightbox"]', Lightbox.touchMove);
        $(document).on('mouseup mouseleave touchend', '[id*="pd-lightbox"]', Lightbox.touchEnd);
         $(document).on('mousedown touchstart', '[id*="pd-lightbox"]', Lightbox.touchZoomStart);
        $(document).on('mousemove touchmove', '[id*="pd-lightbox"]', Lightbox.touchZoomMove);
        $(document).on('mouseup mouseleave touchend', '[id*="pd-lightbox"]', Lightbox.touchZoomEnd);*/

        /*$('#' + Lightbox.obal_id + ' .slide').on('mousedown touchstart', Lightbox.touchStart);
        $('#' + Lightbox.obal_id + ' .slide').on('mousemove touchmove', Lightbox.touchMove);
        $('#' + Lightbox.obal_id + ' .slide').on('mouseup mouseleave touchend', Lightbox.touchEnd);
         $('#' + Lightbox.obal_id + ' .slide').on('mousedown touchstart', Lightbox.touchZoomStart);
        $('#' + Lightbox.obal_id + ' .slide').on('mousemove touchmove', Lightbox.touchZoomMove);
        $('#' + Lightbox.obal_id + ' .slide').on('mouseup mouseleave touchend', Lightbox.touchZoomEnd);*/

        $('#' + Lightbox.obal_id + ' .slide').each(function (index, el) {
          $(el).on('mousedown', Lightbox.touchStart(index));
          $(el).on('mousemove', Lightbox.touchMove);
          $(el).on('mouseup', Lightbox.touchEnd);
          $(el).on('mouseleave', Lightbox.touchEnd);
          $(el).on('touchstart', Lightbox.touchStart(index));
          $(el).on('touchmove', Lightbox.touchMove);
          $(el).on('touchend', Lightbox.touchEnd);
          /*$(el).on('mousedown', Lightbox.touchZoomStart);
          $(el).on('mousemove', Lightbox.touchZoomMove);
          $(el).on('mouseup', Lightbox.touchZoomEnd);
          $(el).on('mouseleave', Lightbox.touchZoomEnd);
          $(el).on('touchstart', Lightbox.touchZoomStart);
          $(el).on('touchmove', Lightbox.touchZoomMove);
          $(el).on('touchend', Lightbox.touchZoomEnd);*/
        });
        $('#' + Lightbox.obal_id + ' .left').on('click', function (e) {
          Lightbox.moveRight();
        });
        $('#' + Lightbox.obal_id + ' .right').on('click', function (e) {
          Lightbox.moveLeft();
        }); // Zooming

        $('#' + Lightbox.obal_id + ' .zoom-plus').on('click', function (e) {
          //Lightbox.touchZooming(e, -1, Lightbox.zoomBod);
          //alert('Zoom-plus');
          var obrazok = $('#' + Lightbox.obal_id + ' .slide').eq(Lightbox.currentIndex).find('img'); //console.log(obrazok);

          Lightbox.zoom_scale += 0.2;
          obrazok.css({
            transform: 'scale(' + Lightbox.zoom_scale + ')'
          });
          Lightbox.hideLeftRight();
          Lightbox.isZoomed = true;
        });
        $('#' + Lightbox.obal_id + ' .zoom-minus').on('click', function (e) {
          //Lightbox.touchZooming(e, 1, Lightbox.zoomBod);
          var obrazok = $('#' + Lightbox.obal_id + ' .slide').eq(Lightbox.currentIndex).find('img'); //console.log(obrazok);

          if (Lightbox.zoom_scale > 1) {
            Lightbox.zoom_scale -= 0.2;
            Lightbox.isZoomed = true;

            if (Lightbox.zoom_scale <= 1) {
              Lightbox.zoom_scale = 1;
              Lightbox.isZoomed = false;
              Lightbox.showLeftRight();
              Lightbox.centerCurrentImage();
            }
          } else {
            Lightbox.zoom_scale = 1;
            Lightbox.isZoomed = false;
          }

          obrazok.css({
            transform: 'scale(' + Lightbox.zoom_scale + ')'
          });
        });
        $('#' + Lightbox.obal_id + ' .zoom-reset').on('click', function (e) {
          Lightbox.isZoomed = false;
          Lightbox.isZoomActive = false;
          Lightbox.showLeftRight();
          Lightbox.centerCurrentImage();
        });
      },
      getPositionX: function getPositionX(e) {
        return e.type.includes('mouse') ? e.clientX : e.touches[0].clientX;
      },
      getPositionY: function getPositionY(e) {
        return e.type.includes('mouse') ? e.clientY : e.touches[0].clientY;
      },
      applyTransform: function applyTransform(obj) {
        obj.css({
          transition: 'initial',
          left: Lightbox.tX + 'px'
        });
      },
      touchZooming: function touchZooming(e, delta, bod) {
        //Lightbox.isZoomed = true;
        //Lightbox.hideLeftRight();
        var obrazok = Lightbox.getCurrentImage();
        var suradnice = obrazok.get(0).getBoundingClientRect(); //alert('Bod: ' + bod.x + ', ' + bod.y + ' Left: ' + suradnice.left + ', Top: ' + suradnice.top);

        if (!(bod.x >= suradnice.left && bod.x <= suradnice.right && bod.y >= suradnice.top && bod.y <= suradnice.bottom)) {
          return false;
        }

        var sur_x = (bod.x - suradnice.left) / Lightbox.zoom_scale;
        var sur_y = (bod.y - suradnice.top) / Lightbox.zoom_scale; //var delta = e.originalEvent.deltaY;

        if (delta < 0) {
          Lightbox.zoom_scale += 0.05;
        } else {
          Lightbox.zoom_scale -= 0.05;
        }

        var m = delta < 0 ? 0.05 : -1 * 0.05;
        Lightbox.ztX += -sur_x * m + obrazok.outerWidth() * m / 2;
        Lightbox.ztY += -sur_y * m + obrazok.outerHeight() * m / 2;

        if (Lightbox.zoom_scale <= 1) {
          Lightbox.centerCurrentImage();
          Lightbox.isPinched = false;
          Lightbox.showLeftRight();
        }

        Lightbox.applyZoomTransform(obrazok);
        obrazok.css({
          transform: "scale(".concat(Lightbox.zoom_scale, ")")
        });
      },
      applyZoomTransform: function applyZoomTransform(obj) {
        obj.css({
          top: Lightbox.ztY + 'px',
          left: Lightbox.ztX + 'px'
        });
      },
      showLightbox: function showLightbox() {
        Lightbox.isDisappear = false;
        var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
        var scrollTop = window.pageYOffset || document.documentElement.scrollTop;

        window.onscroll = function () {
          window.scrollTo(scrollLeft, scrollTop);
        };

        $('#' + Lightbox.obal_id).fadeIn();
        Lightbox.disX = 0;
        Lightbox.setPositionByIndex(false);
      },
      hideLightbox: function hideLightbox() {
        window.onscroll = function () {};

        Lightbox.centerCurrentImage();
        $('#' + Lightbox.obal_id).fadeOut();
      },
      getCurrentImage: function getCurrentImage() {
        var obrazok = $('#' + Lightbox.obal_id + ' .slide').eq(Lightbox.currentIndex).find('img');
        return obrazok;
      },
      centerCurrentImage: function centerCurrentImage() {
        var obrazok = Lightbox.getCurrentImage();
        Lightbox.ztX = 0;
        Lightbox.ztY = 0;
        Lightbox.isZoomed = false;
        Lightbox.isZoomActive = false;
        Lightbox.applyZoomTransform(obrazok);
        Lightbox.zoom_scale = 1;
        obrazok.css({
          transform: "scale(".concat(Lightbox.zoom_scale, ")")
        });
      },
      showLeftRight: function showLeftRight() {
        if (Lightbox.currentIndex == 0 || Lightbox.isZoomed === true) {
          $('#' + Lightbox.obal_id + ' .left').css({
            display: 'none'
          });
        } else {
          $('#' + Lightbox.obal_id + ' .left').css({
            display: 'inline-block'
          });
        }

        if (Lightbox.currentIndex == Lightbox.pocet - 1 || Lightbox.isZoomed === true) {
          $('#' + Lightbox.obal_id + ' .right').css({
            display: 'none'
          });
        } else {
          $('#' + Lightbox.obal_id + ' .right').css({
            display: 'inline-block'
          });
        }

        Lightbox.showPopis();
        Lightbox.isDisappear = false;
      },
      hideLeftRight: function hideLeftRight() {
        $('#' + Lightbox.obal_id + ' .left').css({
          display: 'none'
        });
        $('#' + Lightbox.obal_id + ' .right').css({
          display: 'none'
        });
        Lightbox.hidePopis();
        Lightbox.isDisappear = true;
      },
      showPopis: function showPopis() {
        $('#' + Lightbox.obal_id + ' .popis-obal').css({
          display: 'flex'
        });
      },
      hidePopis: function hidePopis() {
        $('#' + Lightbox.obal_id + ' .popis-obal').css({
          display: 'none'
        });
      },
      setPositionByIndex: function setPositionByIndex() {
        var animation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
        Lightbox.pocet = $('#' + Lightbox.obal_id + ' .pd-slider .slide').length;

        if (Math.abs(Lightbox.disX) > 4) {
          if (Lightbox.disX > 0 && Lightbox.currentIndex > 0) {
            Lightbox.currentIndex--;
          } else if (Lightbox.disX < 0 && Lightbox.currentIndex < Lightbox.pocet - 1) {
            Lightbox.currentIndex++;
          }
        }

        if (Lightbox.isDisappear === false) {
          Lightbox.showLeftRight();
        } else {
          Lightbox.hideLeftRight();
        }

        Lightbox.nastavPoradie();
        Lightbox.tX = -1 * (Lightbox.currentIndex * $('#' + Lightbox.obal_id + ' .slide').eq(0).width());

        if (animation === true) {
          $('#' + Lightbox.obal_id + ' .pd-slider').css({
            transition: 'left 0.5s ease-out 0s',
            left: Lightbox.tX + 'px'
          });
        } else {
          Lightbox.applyTransform($('#' + Lightbox.obal_id + ' .pd-slider'));
        }

        Lightbox.disX = 0; // Vytvorenie odkazu stiahnut obrazok download_image

        if (Lightbox.settings.download_image === true) {
          var current_download_image = Lightbox.getCurrentImage();
          var current_download_image_src = current_download_image.attr('src');
          var current_download_image_pole = current_download_image_src.split('/');
          var current_download_image_name = current_download_image_pole[current_download_image_pole.length - 1]; //alert(current_download_image_name);

          $('#' + Lightbox.obal_id).find('.buttons-obal .download-image > a').attr('href', '/sk/stiahnut-original?file=' + current_download_image_name);
        }
      },
      moveLeft: function moveLeft() {
        Lightbox.disX = -5;
        Lightbox.setPositionByIndex();
      },
      moveRight: function moveRight() {
        Lightbox.disX = 5;
        Lightbox.setPositionByIndex();
      },
      nastavPoradie: function nastavPoradie() {
        var poradie_text = Lightbox.currentIndex + 1 + ' / ' + Lightbox.pocet;
        $('#' + Lightbox.obal_id + ' .poradie .poradie-text').text(poradie_text);
      },
      touchStart: function touchStart(index) {
        return function (e) {
          Lightbox.currentIndex = index;

          if (e.touches && e.touches.length > 1) {
            Lightbox.isPinched = true;
            Lightbox.isZoomed = true;
            Lightbox.isDisappear = true;
            Lightbox.isDragged = false;
            Lightbox.isZoomActive = false;
            Lightbox.hideLeftRight();
            Lightbox.pX1 = e.touches[0].clientX;
            Lightbox.pX2 = e.touches[1].clientX;
            Lightbox.pY1 = e.touches[0].clientY;
            Lightbox.pY2 = e.touches[1].clientY;
            /*if (pX2 < pX1) {
                var temp = pX1;
                pX1 = pX2;
                pX2 = temp;
            }
            if (pY2 < pY1) {
                var temp = pY1;
                pY1 = pY2;
                pY2 = temp;
            }*/

            Lightbox.rozX = Lightbox.pX2 - Lightbox.pX1;
            Lightbox.rozY = Lightbox.pY2 - Lightbox.pY1;
            Lightbox.pinchStartDistance = Math.hypot(Lightbox.rozX, Lightbox.rozY);
          } else {
            /*if (Lightbox.isDoubleTap === false) {
                Lightbox.isDoubleTap = setTimeout(function () {
                    Lightbox.isOneTap = true;
                    Lightbox.isDoubleTap = false;
                }, 300);
            }
            else {
                alert('Je to dvojklik.');
                clearTimeout(Lightbox.isDoubleTap);
                Lightbox.isDoubleTap = false;
                Lightbox.isOneTap = false;
            }*/
            if (Lightbox.isDragged === false && Lightbox.isZoomed === false && Lightbox.isZoomActive === false) {
              //Lightbox.currentIndex = $('#' + Lightbox.obal_id + ' .slide').index($(this));
              Lightbox.isDragged = true;
              $('#' + Lightbox.obal_id + ' .pd-slider').css({
                cursor: 'grabbing'
              });
              Lightbox.sX = Lightbox.getPositionX(e);
            } else if (Lightbox.isDragged === false && Lightbox.isZoomed === true && Lightbox.isZoomActive === false) {
              //Lightbox.isZoomed = true;
              Lightbox.isDragged = false;
              Lightbox.isZoomActive = true;
              Lightbox.zsX = Lightbox.getPositionX(e);
              Lightbox.zsY = Lightbox.getPositionY(e);
              $('#' + Lightbox.obal_id + ' .pd-slider').css({
                cursor: 'grabbing'
              });
            }
          }
        };
      },
      touchMove: function touchMove(e) {
        if (e.touches && e.touches.length > 1) {
          if (Lightbox.isPinched === true) {
            Lightbox.pX1 = e.touches[0].clientX;
            Lightbox.pX2 = e.touches[1].clientX;
            Lightbox.pY1 = e.touches[0].clientY;
            Lightbox.pY2 = e.touches[1].clientY;
            Lightbox.rozX = Lightbox.pX2 - Lightbox.pX1;
            Lightbox.rozY = Lightbox.pY2 - Lightbox.pY1;
            Lightbox.pinchMoveDistance = Math.hypot(Lightbox.rozX, Lightbox.rozY);
            var rozdiel = Lightbox.pinchMoveDistance - Lightbox.pinchStartDistance;
            var x = Lightbox.pX1 + Lightbox.rozX / 2;
            var y = Lightbox.pY1 + Lightbox.rozY / 2;
            var bod = {
              x: x,
              y: y
            };

            if (Math.abs(rozdiel) > 2) {
              Lightbox.touchZooming(e, -1 * rozdiel, bod);
            }

            Lightbox.pinchStartDistance = Lightbox.pinchMoveDistance;
          }
        } else {
          if (Lightbox.isDragged === true && Lightbox.isZoomed === false && Lightbox.isZoomActive === false) {
            Lightbox.nX = Lightbox.getPositionX(e);
            Lightbox.disX = Lightbox.nX - Lightbox.sX;
            Lightbox.tX += Lightbox.disX * 0.7;
            Lightbox.applyTransform($('#' + Lightbox.obal_id + ' .pd-slider'));
            Lightbox.sX = Lightbox.nX;
          } else if (Lightbox.isDragged === false && Lightbox.isZoomed === true && Lightbox.isZoomActive === true) {
            Lightbox.znX = Lightbox.getPositionX(e);
            Lightbox.znY = Lightbox.getPositionY(e);
            Lightbox.zdisX = Lightbox.znX - Lightbox.zsX;
            Lightbox.zdisY = Lightbox.znY - Lightbox.zsY;
            Lightbox.ztX += Lightbox.zdisX * 1;
            Lightbox.ztY += Lightbox.zdisY * 1;
            Lightbox.applyZoomTransform($('#' + Lightbox.obal_id + ' .slide').eq(Lightbox.currentIndex).find('img'));
            Lightbox.zsX = Lightbox.znX;
            Lightbox.zsY = Lightbox.znY;
          }
        }
      },
      touchEnd: function touchEnd(e) {
        if (Lightbox.isPinched === true) {
          //(e.touches && e.touches.length > 1) {
          if (Lightbox.isPinched === true) {
            Lightbox.isPinched = false;

            if (Lightbox.zoom_scale == 1) {
              Lightbox.showLeftRight();
              Lightbox.isZoomed = false;
            } else {
              Lightbox.isZoomed = true;
            }
          }
        } else {
          if (Lightbox.isDragged === true && Lightbox.disX == 0) {
            e.preventDefault();

            if (Lightbox.isDoubleTap === false) {
              Lightbox.isDoubleTap = setTimeout(function () {
                //alert('One tap !');

                /*if ( ($('#' + Lightbox.obal_id).find('.left').css('display') != 'none') || ($('#' + Lightbox.obal_id).find('.right').css('display') != 'none') ) {
                    //alert('Je block !');
                    //Lightbox.appearLeftRight();
                    Lightbox.isDisappear = false;
                }
                else {
                    Lightbox.isDisappear = true;
                }*/
                if (Lightbox.isDisappear === true) {
                  //Lightbox.appearLeftRight();
                  Lightbox.showLeftRight();
                } else {
                  //Lightbox.disappearLeftRight();
                  Lightbox.hideLeftRight();
                } //Lightbox.isDragged = false;
                //Lightbox.isZoomed = false;


                clearTimeout(Lightbox.isDoubleTap);
                Lightbox.isDoubleTap = false;
              }, 150);
            } else {
              clearTimeout(Lightbox.isDoubleTap); //alert('Dvojklik ! ' + Lightbox.disX);

              Lightbox.zoom_scale = 2;
              $('#' + Lightbox.obal_id).find('.zoom-plus').trigger('click');
              Lightbox.isDoubleTap = false;
              Lightbox.isDragged = false;
              $('#' + Lightbox.obal_id + ' .pd-slider').css({
                cursor: 'grab'
              });
            }
          } else if (Lightbox.isZoomed === true) {
            e.preventDefault();

            if (Lightbox.isDoubleTap === false) {
              Lightbox.isDoubleTap = setTimeout(function () {
                /*if ( ($('#' + Lightbox.obal_id).find('.left').css('display') == 'none') && ($('#' + Lightbox.obal_id).find('.right').css('display') == 'none') ) {
                    alert('Jeden klik !');
                    //Lightbox.appearLeftRight();
                }*/

                /*if (Lightbox.isDisappear === true) {
                    Lightbox.appearLeftRight();
                }
                else {
                    Lightbox.disappearLeftRight();
                }*/
                clearTimeout(Lightbox.isDoubleTap);
                Lightbox.isDoubleTap = false;
              }, 300);
            } else {
              clearTimeout(Lightbox.isDoubleTap); //alert('Dvojklik ! ' + Lightbox.disX);

              $('#' + Lightbox.obal_id).find('.zoom-reset').trigger('click');
              Lightbox.isDoubleTap = false;
              Lightbox.isDragged = false;
              $('#' + Lightbox.obal_id + ' .pd-slider').css({
                cursor: 'grab'
              });
            }
          } // =================================================


          if (Lightbox.isDragged === true && Lightbox.isZoomed === false && Lightbox.isZoomActive === false) {
            //e.preventDefault();
            Lightbox.isDragged = false;
            $('#' + Lightbox.obal_id + ' .pd-slider').css({
              cursor: 'grab'
            });
            Lightbox.setPositionByIndex();
            Lightbox.disX = 0;
          } else if (Lightbox.isZoomed === true && Lightbox.isZoomActive === true && Lightbox.isDragged === false) {
            //e.preventDefault();
            Lightbox.isZoomActive = false;
            Lightbox.zdisX = 0;
            Lightbox.zdisY = 0;
            $('#' + Lightbox.obal_id + ' .pd-slider').css({
              cursor: 'grab'
            });
          } // ===================================================

        }
      },
      disappearLeftRight: function disappearLeftRight() {
        /*var left = $('#' + Lightbox.obal_id).find('.left');
        var left_distance = left.css('left');
        left.data('distance', left_distance);
        var right = $('#' + Lightbox.obal_id).find('.right');
        var right_distance = right.css('right');
        right.data('distance', right_distance);
         if (left.css('display') != 'none') {
            left.animate({left: '-100px'}, 150, function () {
                left.css({display: 'none', left: left_distance});
            });
        }
        if (right.css('display') != 'none') {
            right.animate({right: '-100px'}, 150, function () {
                right.css({display: 'none', right: right_distance});
            });
        }*/
        $('#' + Lightbox.obal_id + ' .left').css({
          display: 'none'
        });
        $('#' + Lightbox.obal_id + ' .right').css({
          display: 'none'
        });
        Lightbox.isDisappear = true;
      },
      appearLeftRight: function appearLeftRight() {
        /*var left = $('#' + Lightbox.obal_id).find('.left');
        var left_distance = left.data('distance');
        var right = $('#' + Lightbox.obal_id).find('.right');
        var right_distance = right.data('distance');
         if (left.css('display') == 'none') {
            left.css({display: 'inline-block', left: '-100px'});
            left.animate({left: left_distance + 'px'}, 150);
        }
        if (right.css('display') == 'none') {
            right.css({display: 'inline-block', right: '-100px'});
            right.animate({right: right_distance + 'px'}, 150);
        } */
        if (Lightbox.currentIndex == 0 || Lightbox.isZoomed === true) {
          $('#' + Lightbox.obal_id + ' .left').css({
            display: 'none'
          });
        } else {
          $('#' + Lightbox.obal_id + ' .left').css({
            display: 'inline-block'
          });
        }

        if (Lightbox.currentIndex == Lightbox.pocet - 1 || Lightbox.isZoomed === true) {
          $('#' + Lightbox.obal_id + ' .right').css({
            display: 'none'
          });
        } else {
          $('#' + Lightbox.obal_id + ' .right').css({
            display: 'inline-block'
          });
        }

        Lightbox.isDisappear = false;
      }
      /*touchZoomStart(e) {
          if (Lightbox.isZoomActive === false && Lightbox.isZoomed === true && Lightbox.isDragged === false) {
              Lightbox.isZoomed = true;
              Lightbox.isDragged = false;
              Lightbox.isZoomActive = true;
              Lightbox.zsX = Lightbox.getPositionX(e);
              Lightbox.zsY = Lightbox.getPositionY(e);
           }
      },
      touchZoomMove(e) {
          if (Lightbox.isZoomActive === true && Lightbox.isZoomed === true && Lightbox.isDragged === false) {
              Lightbox.znX = Lightbox.getPositionX(e);
              Lightbox.znY = Lightbox.getPositionY(e);
              Lightbox.zdisX = Lightbox.znX - Lightbox.zsX;
              Lightbox.zdisY = Lightbox.znY - Lightbox.zsY;
              Lightbox.ztX += Lightbox.zdisX * 1;
              Lightbox.ztY += Lightbox.zdisY * 1;
              Lightbox.applyZoomTransform($('#' + Lightbox.obal_id + ' .slide').eq(Lightbox.currentIndex).find('img'));
              Lightbox.zsX = Lightbox.znX;
              Lightbox.zsY = Lightbox.znY;
          }
      },
      touchZoomEnd(e) {
          if (Lightbox.isZoomed === true && Lightbox.isDragged === false) {
              //Lightbox.isZoomed = false;
              Lightbox.isZoomActive = false;
          }
      }*/

    };
    Lightbox.init(this);
    return this.each(function (index, el) {});
  };
})(jQuery, window, document);
/******/ })()
;