balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

lightbox.adc17e3be937246718ee.bundle.js (32886B)


      1 /*! elementor - v3.4.4 - 13-09-2021 */
      2 (self["webpackChunkelementor"] = self["webpackChunkelementor"] || []).push([["lightbox"],{
      3 
      4 /***/ "../assets/dev/js/frontend/utils/lightbox/lightbox.js":
      5 /*!************************************************************!*\
      6   !*** ../assets/dev/js/frontend/utils/lightbox/lightbox.js ***!
      7   \************************************************************/
      8 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
      9 
     10 "use strict";
     11 
     12 
     13 var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
     14 
     15 var _screenfull = _interopRequireDefault(__webpack_require__(/*! ./screenfull */ "../assets/dev/js/frontend/utils/lightbox/screenfull.js"));
     16 
     17 module.exports = elementorModules.ViewModule.extend({
     18   oldAspectRatio: null,
     19   oldAnimation: null,
     20   swiper: null,
     21   player: null,
     22   getDefaultSettings: function () {
     23     return {
     24       classes: {
     25         aspectRatio: 'elementor-aspect-ratio-%s',
     26         item: 'elementor-lightbox-item',
     27         image: 'elementor-lightbox-image',
     28         videoContainer: 'elementor-video-container',
     29         videoWrapper: 'elementor-fit-aspect-ratio',
     30         playButton: 'elementor-custom-embed-play',
     31         playButtonIcon: 'fa',
     32         playing: 'elementor-playing',
     33         hidden: 'elementor-hidden',
     34         invisible: 'elementor-invisible',
     35         preventClose: 'elementor-lightbox-prevent-close',
     36         slideshow: {
     37           container: 'swiper-container',
     38           slidesWrapper: 'swiper-wrapper',
     39           prevButton: 'elementor-swiper-button elementor-swiper-button-prev',
     40           nextButton: 'elementor-swiper-button elementor-swiper-button-next',
     41           prevButtonIcon: 'eicon-chevron-left',
     42           nextButtonIcon: 'eicon-chevron-right',
     43           slide: 'swiper-slide',
     44           header: 'elementor-slideshow__header',
     45           footer: 'elementor-slideshow__footer',
     46           title: 'elementor-slideshow__title',
     47           description: 'elementor-slideshow__description',
     48           counter: 'elementor-slideshow__counter',
     49           iconExpand: 'eicon-frame-expand',
     50           iconShrink: 'eicon-frame-minimize',
     51           iconZoomIn: 'eicon-zoom-in-bold',
     52           iconZoomOut: 'eicon-zoom-out-bold',
     53           iconShare: 'eicon-share-arrow',
     54           shareMenu: 'elementor-slideshow__share-menu',
     55           shareLinks: 'elementor-slideshow__share-links',
     56           hideUiVisibility: 'elementor-slideshow--ui-hidden',
     57           shareMode: 'elementor-slideshow--share-mode',
     58           fullscreenMode: 'elementor-slideshow--fullscreen-mode',
     59           zoomMode: 'elementor-slideshow--zoom-mode'
     60         }
     61       },
     62       selectors: {
     63         image: '.elementor-lightbox-image',
     64         links: 'a, [data-elementor-lightbox]',
     65         slideshow: {
     66           activeSlide: '.swiper-slide-active',
     67           prevSlide: '.swiper-slide-prev',
     68           nextSlide: '.swiper-slide-next'
     69         }
     70       },
     71       modalOptions: {
     72         id: 'elementor-lightbox',
     73         entranceAnimation: 'zoomIn',
     74         videoAspectRatio: 169,
     75         position: {
     76           enable: false
     77         }
     78       }
     79     };
     80   },
     81   getModal: function () {
     82     if (!module.exports.modal) {
     83       this.initModal();
     84     }
     85 
     86     return module.exports.modal;
     87   },
     88   initModal: function () {
     89     const modal = module.exports.modal = elementorFrontend.getDialogsManager().createWidget('lightbox', {
     90       className: 'elementor-lightbox',
     91       closeButton: true,
     92       closeButtonOptions: {
     93         iconClass: 'eicon-close',
     94         attributes: {
     95           tabindex: 0,
     96           role: 'button',
     97           'aria-label': elementorFrontend.config.i18n.close + ' (Esc)'
     98         }
     99       },
    100       selectors: {
    101         preventClose: '.' + this.getSettings('classes.preventClose')
    102       },
    103       hide: {
    104         onClick: true
    105       }
    106     });
    107     modal.on('hide', function () {
    108       modal.setMessage('');
    109     });
    110   },
    111   showModal: function (options) {
    112     if (options.url && !options.url.startsWith('http')) {
    113       return;
    114     }
    115 
    116     this.elements.$closeButton = this.getModal().getElements('closeButton');
    117     this.$buttons = this.elements.$closeButton;
    118     this.focusedButton = null;
    119     const self = this,
    120           defaultOptions = self.getDefaultSettings().modalOptions;
    121     self.id = options.id;
    122     self.setSettings('modalOptions', jQuery.extend(defaultOptions, options.modalOptions));
    123     const modal = self.getModal();
    124     modal.setID(self.getSettings('modalOptions.id'));
    125 
    126     modal.onShow = function () {
    127       DialogsManager.getWidgetType('lightbox').prototype.onShow.apply(modal, arguments);
    128       self.setEntranceAnimation();
    129     };
    130 
    131     modal.onHide = function () {
    132       DialogsManager.getWidgetType('lightbox').prototype.onHide.apply(modal, arguments);
    133       modal.getElements('message').removeClass('animated');
    134 
    135       if (_screenfull.default.isFullscreen) {
    136         self.deactivateFullscreen();
    137       }
    138 
    139       self.unbindHotKeys();
    140     };
    141 
    142     switch (options.type) {
    143       case 'video':
    144         self.setVideoContent(options);
    145         break;
    146 
    147       case 'image':
    148         const slides = [{
    149           image: options.url,
    150           index: 0,
    151           title: options.title,
    152           description: options.description
    153         }];
    154         options.slideshow = {
    155           slides,
    156           swiper: {
    157             loop: false,
    158             pagination: false
    159           }
    160         };
    161 
    162       case 'slideshow':
    163         self.setSlideshowContent(options.slideshow);
    164         break;
    165 
    166       default:
    167         self.setHTMLContent(options.html);
    168     }
    169 
    170     modal.show();
    171   },
    172   createLightbox: function (element) {
    173     let lightboxData = {};
    174 
    175     if (element.dataset.elementorLightbox) {
    176       lightboxData = JSON.parse(element.dataset.elementorLightbox);
    177     }
    178 
    179     if (lightboxData.type && 'slideshow' !== lightboxData.type) {
    180       this.showModal(lightboxData);
    181       return;
    182     }
    183 
    184     if (!element.dataset.elementorLightboxSlideshow) {
    185       const slideshowID = 'single-img';
    186       this.showModal({
    187         type: 'image',
    188         id: slideshowID,
    189         url: element.href,
    190         title: element.dataset.elementorLightboxTitle,
    191         description: element.dataset.elementorLightboxDescription,
    192         modalOptions: {
    193           id: 'elementor-lightbox-slideshow-' + slideshowID
    194         }
    195       });
    196       return;
    197     }
    198 
    199     const initialSlideURL = element.dataset.elementorLightboxVideo || element.href;
    200     this.openSlideshow(element.dataset.elementorLightboxSlideshow, initialSlideURL);
    201   },
    202   setHTMLContent: function (html) {
    203     if (window.elementorCommon) {
    204       elementorCommon.helpers.hardDeprecated('elementorFrontend.utils.lightbox.setHTMLContent', '3.1.4');
    205     }
    206 
    207     this.getModal().setMessage(html);
    208   },
    209   setVideoContent: function (options) {
    210     const $ = jQuery,
    211           classes = this.getSettings('classes'),
    212           $videoContainer = $('<div>', {
    213       class: `${classes.videoContainer} ${classes.preventClose}`
    214     }),
    215           $videoWrapper = $('<div>', {
    216       class: classes.videoWrapper
    217     }),
    218           modal = this.getModal();
    219     let $videoElement;
    220 
    221     if ('hosted' === options.videoType) {
    222       const videoParams = $.extend({
    223         src: options.url,
    224         autoplay: ''
    225       }, options.videoParams);
    226       $videoElement = $('<video>', videoParams);
    227     } else {
    228       let apiProvider = elementorFrontend.utils.baseVideoLoader;
    229 
    230       if (-1 !== options.url.indexOf('vimeo.com')) {
    231         apiProvider = elementorFrontend.utils.vimeo;
    232       } else if (options.url.match(/^(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com)/)) {
    233         apiProvider = elementorFrontend.utils.youtube;
    234       }
    235 
    236       $videoElement = $('<iframe>', {
    237         src: apiProvider.getAutoplayURL(options.url),
    238         allowfullscreen: 1
    239       });
    240     }
    241 
    242     $videoContainer.append($videoWrapper);
    243     $videoWrapper.append($videoElement);
    244     modal.setMessage($videoContainer);
    245     this.setVideoAspectRatio();
    246     const onHideMethod = modal.onHide;
    247 
    248     modal.onHide = function () {
    249       onHideMethod();
    250       this.$buttons = jQuery();
    251       this.focusedButton = null;
    252       modal.getElements('message').removeClass('elementor-fit-aspect-ratio');
    253     };
    254   },
    255   getShareLinks: function () {
    256     const {
    257       i18n
    258     } = elementorFrontend.config,
    259           socialNetworks = {
    260       facebook: i18n.shareOnFacebook,
    261       twitter: i18n.shareOnTwitter,
    262       pinterest: i18n.pinIt
    263     },
    264           $ = jQuery,
    265           classes = this.getSettings('classes'),
    266           selectors = this.getSettings('selectors'),
    267           $linkList = $('<div>', {
    268       class: classes.slideshow.shareLinks
    269     }),
    270           $activeSlide = this.getSlide('active'),
    271           $image = $activeSlide.find(selectors.image),
    272           videoUrl = $activeSlide.data('elementor-slideshow-video');
    273     let itemUrl;
    274 
    275     if (videoUrl) {
    276       itemUrl = videoUrl;
    277     } else {
    278       itemUrl = $image.attr('src');
    279     }
    280 
    281     $.each(socialNetworks, (key, networkLabel) => {
    282       const $link = $('<a>', {
    283         href: this.createShareLink(key, itemUrl),
    284         target: '_blank'
    285       }).text(networkLabel);
    286       $link.prepend($('<i>', {
    287         class: 'eicon-' + key
    288       }));
    289       $linkList.append($link);
    290     });
    291 
    292     if (!videoUrl) {
    293       $linkList.append($('<a>', {
    294         href: itemUrl,
    295         download: ''
    296       }).text(i18n.downloadImage).prepend($('<i>', {
    297         class: 'eicon-download-bold',
    298         'aria-label': i18n.download
    299       })));
    300     }
    301 
    302     return $linkList;
    303   },
    304   createShareLink: function (networkName, itemUrl) {
    305     const options = {};
    306 
    307     if ('pinterest' === networkName) {
    308       options.image = encodeURIComponent(itemUrl);
    309     } else {
    310       const hash = elementorFrontend.utils.urlActions.createActionHash('lightbox', {
    311         id: this.id,
    312         url: itemUrl
    313       });
    314       options.url = encodeURIComponent(location.href.replace(/#.*/, '')) + hash;
    315     }
    316 
    317     return ShareLink.getNetworkLink(networkName, options);
    318   },
    319   getSlideshowHeader: function () {
    320     const {
    321       i18n
    322     } = elementorFrontend.config,
    323           $ = jQuery,
    324           showCounter = 'yes' === elementorFrontend.getKitSettings('lightbox_enable_counter'),
    325           showFullscreen = 'yes' === elementorFrontend.getKitSettings('lightbox_enable_fullscreen'),
    326           showZoom = 'yes' === elementorFrontend.getKitSettings('lightbox_enable_zoom'),
    327           showShare = 'yes' === elementorFrontend.getKitSettings('lightbox_enable_share'),
    328           classes = this.getSettings('classes'),
    329           slideshowClasses = classes.slideshow,
    330           elements = this.elements;
    331 
    332     if (!(showCounter || showFullscreen || showZoom || showShare)) {
    333       return;
    334     }
    335 
    336     elements.$header = $('<header>', {
    337       class: slideshowClasses.header + ' ' + classes.preventClose
    338     });
    339 
    340     if (showShare) {
    341       elements.$iconShare = $('<i>', {
    342         class: slideshowClasses.iconShare,
    343         role: 'button',
    344         'aria-label': i18n.share,
    345         'aria-expanded': false
    346       }).append($('<span>'));
    347       const $shareLinks = $('<div>');
    348       $shareLinks.on('click', e => {
    349         e.stopPropagation();
    350       });
    351       elements.$shareMenu = $('<div>', {
    352         class: slideshowClasses.shareMenu
    353       }).append($shareLinks);
    354       elements.$iconShare.add(elements.$shareMenu).on('click', this.toggleShareMenu);
    355       elements.$header.append(elements.$iconShare, elements.$shareMenu);
    356       this.$buttons = this.$buttons.add(elements.$iconShare);
    357     }
    358 
    359     if (showZoom) {
    360       elements.$iconZoom = $('<i>', {
    361         class: slideshowClasses.iconZoomIn,
    362         role: 'switch',
    363         'aria-checked': false,
    364         'aria-label': i18n.zoom
    365       });
    366       elements.$iconZoom.on('click', this.toggleZoomMode);
    367       elements.$header.append(elements.$iconZoom);
    368       this.$buttons = this.$buttons.add(elements.$iconZoom);
    369     }
    370 
    371     if (showFullscreen) {
    372       elements.$iconExpand = $('<i>', {
    373         class: slideshowClasses.iconExpand,
    374         role: 'switch',
    375         'aria-checked': false,
    376         'aria-label': i18n.fullscreen
    377       }).append($('<span>'), $('<span>'));
    378       elements.$iconExpand.on('click', this.toggleFullscreen);
    379       elements.$header.append(elements.$iconExpand);
    380       this.$buttons = this.$buttons.add(elements.$iconExpand);
    381     }
    382 
    383     if (showCounter) {
    384       elements.$counter = $('<span>', {
    385         class: slideshowClasses.counter
    386       });
    387       elements.$header.append(elements.$counter);
    388     }
    389 
    390     return elements.$header;
    391   },
    392   toggleFullscreen: function () {
    393     if (_screenfull.default.isFullscreen) {
    394       this.deactivateFullscreen();
    395     } else if (_screenfull.default.isEnabled) {
    396       this.activateFullscreen();
    397     }
    398   },
    399   toggleZoomMode: function () {
    400     if (1 !== this.swiper.zoom.scale) {
    401       this.deactivateZoom();
    402     } else {
    403       this.activateZoom();
    404     }
    405   },
    406   toggleShareMenu: function () {
    407     if (this.shareMode) {
    408       this.deactivateShareMode();
    409     } else {
    410       this.elements.$shareMenu.html(this.getShareLinks());
    411       this.activateShareMode();
    412     }
    413   },
    414   activateShareMode: function () {
    415     const classes = this.getSettings('classes');
    416     this.elements.$container.addClass(classes.slideshow.shareMode);
    417     this.elements.$iconShare.attr('aria-expanded', true); // Prevent swiper interactions while in share mode
    418 
    419     this.swiper.detachEvents(); // Temporarily replace tabbable buttons with share-menu items
    420 
    421     this.$originalButtons = this.$buttons;
    422     this.$buttons = this.elements.$iconShare.add(this.elements.$shareMenu.find('a'));
    423     this.shareMode = true;
    424   },
    425   deactivateShareMode: function () {
    426     const classes = this.getSettings('classes');
    427     this.elements.$container.removeClass(classes.slideshow.shareMode);
    428     this.elements.$iconShare.attr('aria-expanded', false);
    429     this.swiper.attachEvents();
    430     this.$buttons = this.$originalButtons;
    431     this.shareMode = false;
    432   },
    433   activateFullscreen: function () {
    434     const classes = this.getSettings('classes');
    435 
    436     _screenfull.default.request(this.elements.$container.parents('.dialog-widget')[0]);
    437 
    438     this.elements.$iconExpand.removeClass(classes.slideshow.iconExpand).addClass(classes.slideshow.iconShrink).attr('aria-checked', 'true');
    439     this.elements.$container.addClass(classes.slideshow.fullscreenMode);
    440   },
    441   deactivateFullscreen: function () {
    442     const classes = this.getSettings('classes');
    443 
    444     _screenfull.default.exit();
    445 
    446     this.elements.$iconExpand.removeClass(classes.slideshow.iconShrink).addClass(classes.slideshow.iconExpand).attr('aria-checked', 'false');
    447     this.elements.$container.removeClass(classes.slideshow.fullscreenMode);
    448   },
    449   activateZoom: function () {
    450     const swiper = this.swiper,
    451           elements = this.elements,
    452           classes = this.getSettings('classes');
    453     swiper.zoom.in();
    454     swiper.allowSlideNext = false;
    455     swiper.allowSlidePrev = false;
    456     swiper.allowTouchMove = false;
    457     elements.$container.addClass(classes.slideshow.zoomMode);
    458     elements.$iconZoom.removeClass(classes.slideshow.iconZoomIn).addClass(classes.slideshow.iconZoomOut);
    459   },
    460   deactivateZoom: function () {
    461     const swiper = this.swiper,
    462           elements = this.elements,
    463           classes = this.getSettings('classes');
    464     swiper.zoom.out();
    465     swiper.allowSlideNext = true;
    466     swiper.allowSlidePrev = true;
    467     swiper.allowTouchMove = true;
    468     elements.$container.removeClass(classes.slideshow.zoomMode);
    469     elements.$iconZoom.removeClass(classes.slideshow.iconZoomOut).addClass(classes.slideshow.iconZoomIn);
    470   },
    471   getSlideshowFooter: function () {
    472     const $ = jQuery,
    473           classes = this.getSettings('classes'),
    474           $footer = $('<footer>', {
    475       class: classes.slideshow.footer + ' ' + classes.preventClose
    476     }),
    477           $title = $('<div>', {
    478       class: classes.slideshow.title
    479     }),
    480           $description = $('<div>', {
    481       class: classes.slideshow.description
    482     });
    483     $footer.append($title, $description);
    484     return $footer;
    485   },
    486   setSlideshowContent: function (options) {
    487     const {
    488       i18n
    489     } = elementorFrontend.config,
    490           $ = jQuery,
    491           isSingleSlide = 1 === options.slides.length,
    492           hasTitle = '' !== elementorFrontend.getKitSettings('lightbox_title_src'),
    493           hasDescription = '' !== elementorFrontend.getKitSettings('lightbox_description_src'),
    494           showFooter = hasTitle || hasDescription,
    495           classes = this.getSettings('classes'),
    496           slideshowClasses = classes.slideshow,
    497           $container = $('<div>', {
    498       class: slideshowClasses.container
    499     }),
    500           $slidesWrapper = $('<div>', {
    501       class: slideshowClasses.slidesWrapper
    502     });
    503     let $prevButton, $nextButton;
    504     options.slides.forEach(slide => {
    505       let slideClass = slideshowClasses.slide + ' ' + classes.item;
    506 
    507       if (slide.video) {
    508         slideClass += ' ' + classes.video;
    509       }
    510 
    511       const $slide = $('<div>', {
    512         class: slideClass
    513       });
    514 
    515       if (slide.video) {
    516         $slide.attr('data-elementor-slideshow-video', slide.video);
    517         const $playIcon = $('<div>', {
    518           class: classes.playButton
    519         }).html($('<i>', {
    520           class: classes.playButtonIcon,
    521           'aria-label': i18n.playVideo
    522         }));
    523         $slide.append($playIcon);
    524       } else {
    525         const $zoomContainer = $('<div>', {
    526           class: 'swiper-zoom-container'
    527         }),
    528               $slidePlaceholder = $('<div class="swiper-lazy-preloader"></div>'),
    529               imageAttributes = {
    530           'data-src': slide.image,
    531           class: classes.image + ' ' + classes.preventClose + ' swiper-lazy'
    532         };
    533 
    534         if (slide.title) {
    535           imageAttributes['data-title'] = slide.title;
    536           imageAttributes.alt = slide.title;
    537         }
    538 
    539         if (slide.description) {
    540           imageAttributes['data-description'] = slide.description;
    541           imageAttributes.alt += ' - ' + slide.description;
    542         }
    543 
    544         const $slideImage = $('<img>', imageAttributes);
    545         $zoomContainer.append([$slideImage, $slidePlaceholder]);
    546         $slide.append($zoomContainer);
    547       }
    548 
    549       $slidesWrapper.append($slide);
    550     });
    551     this.elements.$container = $container;
    552     this.elements.$header = this.getSlideshowHeader();
    553     $container.prepend(this.elements.$header).append($slidesWrapper);
    554 
    555     if (!isSingleSlide) {
    556       $prevButton = $('<div>', {
    557         class: slideshowClasses.prevButton + ' ' + classes.preventClose,
    558         'aria-label': i18n.previous
    559       }).html($('<i>', {
    560         class: slideshowClasses.prevButtonIcon
    561       }));
    562       $nextButton = $('<div>', {
    563         class: slideshowClasses.nextButton + ' ' + classes.preventClose,
    564         'aria-label': i18n.next
    565       }).html($('<i>', {
    566         class: slideshowClasses.nextButtonIcon
    567       }));
    568       $container.append($nextButton, $prevButton);
    569       this.$buttons = this.$buttons.add($nextButton).add($prevButton);
    570     }
    571 
    572     if (showFooter) {
    573       this.elements.$footer = this.getSlideshowFooter();
    574       $container.append(this.elements.$footer);
    575     }
    576 
    577     this.setSettings('hideUiTimeout', '');
    578     $container.on('click mousemove keypress', this.showLightboxUi);
    579     const modal = this.getModal();
    580     modal.setMessage($container);
    581     const onShowMethod = modal.onShow;
    582 
    583     modal.onShow = async () => {
    584       onShowMethod();
    585       const swiperOptions = {
    586         pagination: {
    587           el: '.' + slideshowClasses.counter,
    588           type: 'fraction'
    589         },
    590         on: {
    591           slideChangeTransitionEnd: this.onSlideChange
    592         },
    593         lazy: {
    594           loadPrevNext: true
    595         },
    596         zoom: true,
    597         spaceBetween: 100,
    598         grabCursor: true,
    599         runCallbacksOnInit: false,
    600         loop: true,
    601         keyboard: true,
    602         handleElementorBreakpoints: true
    603       };
    604 
    605       if (!isSingleSlide) {
    606         swiperOptions.navigation = {
    607           prevEl: $prevButton,
    608           nextEl: $nextButton
    609         };
    610       }
    611 
    612       if (options.swiper) {
    613         $.extend(swiperOptions, options.swiper);
    614       }
    615 
    616       const Swiper = elementorFrontend.utils.swiper;
    617       this.swiper = await new Swiper($container, swiperOptions); // Expose the swiper instance in the frontend
    618 
    619       $container.data('swiper', this.swiper);
    620       this.setVideoAspectRatio();
    621       this.playSlideVideo();
    622 
    623       if (showFooter) {
    624         this.updateFooterText();
    625       }
    626 
    627       this.bindHotKeys();
    628       this.makeButtonsAccessible();
    629     };
    630   },
    631   makeButtonsAccessible: function () {
    632     this.$buttons.attr('tabindex', 0).on('keypress', event => {
    633       const ENTER_KEY = 13,
    634             SPACE_KEY = 32;
    635 
    636       if (ENTER_KEY === event.which || SPACE_KEY === event.which) {
    637         jQuery(event.currentTarget).trigger('click');
    638       }
    639     });
    640   },
    641   showLightboxUi: function () {
    642     const slideshowClasses = this.getSettings('classes').slideshow;
    643     this.elements.$container.removeClass(slideshowClasses.hideUiVisibility);
    644     clearTimeout(this.getSettings('hideUiTimeout'));
    645     this.setSettings('hideUiTimeout', setTimeout(() => {
    646       if (!this.shareMode) {
    647         this.elements.$container.addClass(slideshowClasses.hideUiVisibility);
    648       }
    649     }, 3500));
    650   },
    651   bindHotKeys: function () {
    652     this.getModal().getElements('window').on('keydown', this.activeKeyDown);
    653   },
    654   unbindHotKeys: function () {
    655     this.getModal().getElements('window').off('keydown', this.activeKeyDown);
    656   },
    657   activeKeyDown: function (event) {
    658     this.showLightboxUi();
    659     const TAB_KEY = 9;
    660 
    661     if (event.which === TAB_KEY) {
    662       const $buttons = this.$buttons;
    663       let focusedButton,
    664           isFirst = false,
    665           isLast = false;
    666       $buttons.each(index => {
    667         const item = $buttons[index];
    668 
    669         if (jQuery(item).is(':focus')) {
    670           focusedButton = item;
    671           isFirst = 0 === index;
    672           isLast = $buttons.length - 1 === index;
    673           return false;
    674         }
    675       });
    676 
    677       if (event.shiftKey) {
    678         if (isFirst) {
    679           event.preventDefault();
    680           $buttons.last().trigger('focus');
    681         }
    682       } else if (isLast || !focusedButton) {
    683         event.preventDefault();
    684         $buttons.first().trigger('focus');
    685       }
    686     }
    687   },
    688   setVideoAspectRatio: function (aspectRatio) {
    689     aspectRatio = aspectRatio || this.getSettings('modalOptions.videoAspectRatio');
    690     const $widgetContent = this.getModal().getElements('widgetContent'),
    691           oldAspectRatio = this.oldAspectRatio,
    692           aspectRatioClass = this.getSettings('classes.aspectRatio');
    693     this.oldAspectRatio = aspectRatio;
    694 
    695     if (oldAspectRatio) {
    696       $widgetContent.removeClass(aspectRatioClass.replace('%s', oldAspectRatio));
    697     }
    698 
    699     if (aspectRatio) {
    700       $widgetContent.addClass(aspectRatioClass.replace('%s', aspectRatio));
    701     }
    702   },
    703   getSlide: function (slideState) {
    704     return jQuery(this.swiper.slides).filter(this.getSettings('selectors.slideshow.' + slideState + 'Slide'));
    705   },
    706   updateFooterText: function () {
    707     if (!this.elements.$footer) {
    708       return;
    709     }
    710 
    711     const classes = this.getSettings('classes'),
    712           $activeSlide = this.getSlide('active'),
    713           $image = $activeSlide.find('.elementor-lightbox-image'),
    714           titleText = $image.data('title'),
    715           descriptionText = $image.data('description'),
    716           $title = this.elements.$footer.find('.' + classes.slideshow.title),
    717           $description = this.elements.$footer.find('.' + classes.slideshow.description);
    718     $title.text(titleText || '');
    719     $description.text(descriptionText || '');
    720   },
    721   playSlideVideo: function () {
    722     const $activeSlide = this.getSlide('active'),
    723           videoURL = $activeSlide.data('elementor-slideshow-video');
    724 
    725     if (!videoURL) {
    726       return;
    727     }
    728 
    729     const classes = this.getSettings('classes'),
    730           $videoContainer = jQuery('<div>', {
    731       class: classes.videoContainer + ' ' + classes.invisible
    732     }),
    733           $videoWrapper = jQuery('<div>', {
    734       class: classes.videoWrapper
    735     }),
    736           $playIcon = $activeSlide.children('.' + classes.playButton);
    737     let videoType, apiProvider;
    738     $videoContainer.append($videoWrapper);
    739     $activeSlide.append($videoContainer);
    740 
    741     if (-1 !== videoURL.indexOf('vimeo.com')) {
    742       videoType = 'vimeo';
    743       apiProvider = elementorFrontend.utils.vimeo;
    744     } else if (videoURL.match(/^(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com)/)) {
    745       videoType = 'youtube';
    746       apiProvider = elementorFrontend.utils.youtube;
    747     }
    748 
    749     const videoID = apiProvider.getVideoIDFromURL(videoURL);
    750     apiProvider.onApiReady(apiObject => {
    751       if ('youtube' === videoType) {
    752         this.prepareYTVideo(apiObject, videoID, $videoContainer, $videoWrapper, $playIcon);
    753       } else if ('vimeo' === videoType) {
    754         this.prepareVimeoVideo(apiObject, videoID, $videoContainer, $videoWrapper, $playIcon);
    755       }
    756     });
    757     $playIcon.addClass(classes.playing).removeClass(classes.hidden);
    758   },
    759   prepareYTVideo: function (YT, videoID, $videoContainer, $videoWrapper, $playIcon) {
    760     const classes = this.getSettings('classes'),
    761           $videoPlaceholderElement = jQuery('<div>');
    762     let startStateCode = YT.PlayerState.PLAYING;
    763     $videoWrapper.append($videoPlaceholderElement); // Since version 67, Chrome doesn't fire the `PLAYING` state at start time
    764 
    765     if (window.chrome) {
    766       startStateCode = YT.PlayerState.UNSTARTED;
    767     }
    768 
    769     $videoContainer.addClass('elementor-loading' + ' ' + classes.invisible);
    770     this.player = new YT.Player($videoPlaceholderElement[0], {
    771       videoId: videoID,
    772       events: {
    773         onReady: () => {
    774           $playIcon.addClass(classes.hidden);
    775           $videoContainer.removeClass(classes.invisible);
    776           this.player.playVideo();
    777         },
    778         onStateChange: event => {
    779           if (event.data === startStateCode) {
    780             $videoContainer.removeClass('elementor-loading' + ' ' + classes.invisible);
    781           }
    782         }
    783       },
    784       playerVars: {
    785         controls: 0,
    786         rel: 0
    787       }
    788     });
    789   },
    790   prepareVimeoVideo: function (Vimeo, videoId, $videoContainer, $videoWrapper, $playIcon) {
    791     const classes = this.getSettings('classes'),
    792           vimeoOptions = {
    793       id: videoId,
    794       autoplay: true,
    795       transparent: false,
    796       playsinline: false
    797     };
    798     this.player = new Vimeo.Player($videoWrapper, vimeoOptions);
    799     this.player.ready().then(() => {
    800       $playIcon.addClass(classes.hidden);
    801       $videoContainer.removeClass(classes.invisible);
    802     });
    803   },
    804   setEntranceAnimation: function (animation) {
    805     animation = animation || elementorFrontend.getCurrentDeviceSetting(this.getSettings('modalOptions'), 'entranceAnimation');
    806     const $widgetMessage = this.getModal().getElements('message');
    807 
    808     if (this.oldAnimation) {
    809       $widgetMessage.removeClass(this.oldAnimation);
    810     }
    811 
    812     this.oldAnimation = animation;
    813 
    814     if (animation) {
    815       $widgetMessage.addClass('animated ' + animation);
    816     }
    817   },
    818   openSlideshow: function (slideshowID, initialSlideURL) {
    819     const $allSlideshowLinks = jQuery(this.getSettings('selectors.links')).filter((index, element) => {
    820       const $element = jQuery(element);
    821       return slideshowID === element.dataset.elementorLightboxSlideshow && !$element.parent('.swiper-slide-duplicate').length && !$element.parents('.slick-cloned').length;
    822     });
    823     const slides = [];
    824     let initialSlideIndex = 0;
    825     $allSlideshowLinks.each(function () {
    826       const slideVideo = this.dataset.elementorLightboxVideo;
    827       let slideIndex = this.dataset.elementorLightboxIndex;
    828 
    829       if (undefined === slideIndex) {
    830         slideIndex = $allSlideshowLinks.index(this);
    831       }
    832 
    833       if (initialSlideURL === this.href || slideVideo && initialSlideURL === slideVideo) {
    834         initialSlideIndex = slideIndex;
    835       }
    836 
    837       const slideData = {
    838         image: this.href,
    839         index: slideIndex,
    840         title: this.dataset.elementorLightboxTitle,
    841         description: this.dataset.elementorLightboxDescription
    842       };
    843 
    844       if (slideVideo) {
    845         slideData.video = slideVideo;
    846       }
    847 
    848       slides.push(slideData);
    849     });
    850     slides.sort((a, b) => a.index - b.index);
    851     this.showModal({
    852       type: 'slideshow',
    853       id: slideshowID,
    854       modalOptions: {
    855         id: 'elementor-lightbox-slideshow-' + slideshowID
    856       },
    857       slideshow: {
    858         slides: slides,
    859         swiper: {
    860           initialSlide: +initialSlideIndex
    861         }
    862       }
    863     });
    864   },
    865   onSlideChange: function () {
    866     this.getSlide('prev').add(this.getSlide('next')).add(this.getSlide('active')).find('.' + this.getSettings('classes.videoWrapper')).remove();
    867     this.playSlideVideo();
    868     this.updateFooterText();
    869   }
    870 });
    871 
    872 /***/ }),
    873 
    874 /***/ "../assets/dev/js/frontend/utils/lightbox/screenfull.js":
    875 /*!**************************************************************!*\
    876   !*** ../assets/dev/js/frontend/utils/lightbox/screenfull.js ***!
    877   \**************************************************************/
    878 /***/ ((module) => {
    879 
    880 "use strict";
    881 
    882 
    883 (function () {
    884   'use strict';
    885 
    886   var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};
    887   var isCommonjs =  true && module.exports;
    888 
    889   var fn = function () {
    890     var val;
    891     var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'], // New WebKit
    892     ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'], // Old WebKit
    893     ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
    894     var i = 0;
    895     var l = fnMap.length;
    896     var ret = {};
    897 
    898     for (; i < l; i++) {
    899       val = fnMap[i];
    900 
    901       if (val && val[1] in document) {
    902         var valLength = val.length;
    903 
    904         for (i = 0; i < valLength; i++) {
    905           ret[fnMap[0][i]] = val[i];
    906         }
    907 
    908         return ret;
    909       }
    910     }
    911 
    912     return false;
    913   }();
    914 
    915   var eventNameMap = {
    916     change: fn.fullscreenchange,
    917     error: fn.fullscreenerror
    918   };
    919   var screenfull = {
    920     request: function (element) {
    921       return new Promise(function (resolve, reject) {
    922         var onFullScreenEntered = function () {
    923           this.off('change', onFullScreenEntered);
    924           resolve();
    925         }.bind(this);
    926 
    927         this.on('change', onFullScreenEntered);
    928         element = element || document.documentElement;
    929         Promise.resolve(element[fn.requestFullscreen]()).catch(reject);
    930       }.bind(this));
    931     },
    932     exit: function () {
    933       return new Promise(function (resolve, reject) {
    934         if (!this.isFullscreen) {
    935           resolve();
    936           return;
    937         }
    938 
    939         var onFullScreenExit = function () {
    940           this.off('change', onFullScreenExit);
    941           resolve();
    942         }.bind(this);
    943 
    944         this.on('change', onFullScreenExit);
    945         Promise.resolve(document[fn.exitFullscreen]()).catch(reject);
    946       }.bind(this));
    947     },
    948     toggle: function (element) {
    949       return this.isFullscreen ? this.exit() : this.request(element);
    950     },
    951     onchange: function (callback) {
    952       this.on('change', callback);
    953     },
    954     onerror: function (callback) {
    955       this.on('error', callback);
    956     },
    957     on: function (event, callback) {
    958       var eventName = eventNameMap[event];
    959 
    960       if (eventName) {
    961         document.addEventListener(eventName, callback, false);
    962       }
    963     },
    964     off: function (event, callback) {
    965       var eventName = eventNameMap[event];
    966 
    967       if (eventName) {
    968         document.removeEventListener(eventName, callback, false);
    969       }
    970     },
    971     raw: fn
    972   };
    973 
    974   if (!fn) {
    975     if (isCommonjs) {
    976       module.exports = {
    977         isEnabled: false
    978       };
    979     } else {
    980       window.screenfull = {
    981         isEnabled: false
    982       };
    983     }
    984 
    985     return;
    986   }
    987 
    988   Object.defineProperties(screenfull, {
    989     isFullscreen: {
    990       get: function () {
    991         return Boolean(document[fn.fullscreenElement]);
    992       }
    993     },
    994     element: {
    995       enumerable: true,
    996       get: function () {
    997         return document[fn.fullscreenElement];
    998       }
    999     },
   1000     isEnabled: {
   1001       enumerable: true,
   1002       get: function () {
   1003         // Coerce to boolean in case of old WebKit
   1004         return Boolean(document[fn.fullscreenEnabled]);
   1005       }
   1006     }
   1007   });
   1008 
   1009   if (isCommonjs) {
   1010     module.exports = screenfull;
   1011   } else {
   1012     window.screenfull = screenfull;
   1013   }
   1014 })();
   1015 
   1016 /***/ })
   1017 
   1018 }]);
   1019 //# sourceMappingURL=lightbox.adc17e3be937246718ee.bundle.js.map