{"version":3,"file":"media-gallery-9dfe6104.js","sources":["../../../../src/scripts/modules/media-gallery.ts"],"sourcesContent":["import { Component } from '@verndale/core';\nimport Swiper, { Navigation, Keyboard } from 'swiper';\nimport 'swiper/css/bundle';\nimport figure from './figure';\nimport {\n disableBodyScroll,\n clearAllBodyScrollLocks,\n BodyScrollOptions\n} from 'body-scroll-lock';\nimport { FocusTrap, createFocusTrap } from 'focus-trap';\nimport { ExtendedWindowType } from '../helpers/global-types';\n\nclass MediaGallery extends Component {\n private gallerySwiper: Swiper | null = null;\n private galleryItems: HTMLElement[] | undefined;\n private resizeTimeout: NodeJS.Timeout | null | undefined;\n private galleryIndex: number | undefined;\n private galleryItemsLastIndex: number | undefined;\n private videoFigure: figure | undefined;\n private firstSlideFlag = true;\n private focusTrap: FocusTrap | undefined;\n\n constructor(el: HTMLElement) {\n super(el);\n this.videoFigure = new figure(this.dom.figureContainer as HTMLElement);\n this.gallerySwiper = null;\n this.initSwiper();\n this.handleResize();\n this.updateSwiper();\n this.setPreviewThumbnails();\n }\n\n setupDefaults() {\n this.dom = {\n el: this.el,\n swiper: this.el.querySelector(\n '.media-gallery__swiper-container'\n ),\n modal: this.el.querySelector('#media-gallery__modal'),\n modalImage: this.el.querySelector(\n '.media-gallery__modal-image'\n ),\n modalCaption: this.el.querySelector(\n '.media-gallery__modal-caption'\n ),\n nextArrow: this.el.querySelector('.swiper-button-next'),\n prevArrow: this.el.querySelector('.swiper-button-prev'),\n galleryItems: this.el.querySelectorAll('.gallery-item'),\n galleryVideoItems: this.el.querySelectorAll(\n '.media-gallery__video-item .figure__media-button'\n ),\n closeBtn: this.el.querySelector('.media-gallery__close'),\n imagePreviewRow: this.el.querySelector(\n '.media-gallery__image-preview-row'\n ),\n imagePreviews: this.el.querySelectorAll(\n '.media-gallery__image-preview'\n ),\n figureContainer: this.el.querySelector(\n '.figure__container--modal'\n ),\n swiperSlides: this.el.querySelectorAll('.swiper-slide')\n };\n\n this.setGalleryItems();\n }\n\n addListeners() {\n //Show modal on gallery-item click\n this.galleryItems?.forEach((item, index) => {\n item.addEventListener('click', () => {\n this.showItemInModal(item, index);\n });\n });\n\n // Close modal on close button click\n (this.dom.closeBtn as HTMLElement).addEventListener('click', () => {\n this.handleCloseModal();\n });\n\n // Close modal when pressing ESC key\n document.addEventListener('keydown', (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n this.handleCloseModal();\n }\n });\n\n // Close modal on overlay click\n if (this.dom.modal) {\n (this.dom.modal as HTMLElement).addEventListener(\n 'click',\n (event: MouseEvent) => {\n if (event.target === this.dom.modal) {\n this.handleCloseModal();\n }\n }\n );\n }\n\n //Close the modal when the user clicks on .media-gallery__modal-content\n const modalContent = this.el.querySelector(\n '.media-gallery__modal-content'\n ) as HTMLElement;\n modalContent?.addEventListener('click', () => {\n this.handleCloseModal();\n });\n\n // Image Preview Functionality\n (this.dom.imagePreviews as NodeListOf).forEach(\n (preview, index) => {\n this.handlePreviewImage(preview, index);\n }\n );\n\n // Handle next and prev arrow clicks\n (this.dom.nextArrow as HTMLButtonElement)?.addEventListener(\n 'click',\n this.handleNextArrowClick.bind(this)\n );\n\n (this.dom.prevArrow as HTMLButtonElement)?.addEventListener(\n 'click',\n this.handlePrevArrowClick.bind(this)\n );\n }\n\n initSwiper() {\n Swiper.use([Navigation, Keyboard]);\n this.setGalleryItems();\n let desktopOffSetWidth = 0;\n if (this.galleryItems) {\n if (this.galleryItems.length < 6) {\n desktopOffSetWidth = (this.dom.swiper as HTMLElement).offsetWidth * -1;\n }\n if (this.galleryItems.length == 6) {\n desktopOffSetWidth = -20;\n }\n\n if (this.galleryItems.length >= 7) {\n if (this.galleryItems.length % 2 == 0) {\n desktopOffSetWidth =\n ((this.galleryItems?.length - 4) / 2) *\n ((this.dom.swiper as HTMLElement).offsetWidth / 4) *\n -1 -\n this.galleryItems?.length * 4;\n } else {\n desktopOffSetWidth =\n ((this.galleryItems?.length - 3) / 2) *\n ((this.dom.swiper as HTMLElement).offsetWidth / 4) *\n -1 -\n this.galleryItems?.length * 4;\n }\n }\n }\n\n const slides = this.dom.swiperSlides as NodeListOf;\n\n const hideNotActiveSlides = () => {\n slides.forEach(slide => {\n const button = slide.querySelector('button') as HTMLButtonElement;\n\n if (slide.classList.contains('swiper-slide-visible')) {\n button.tabIndex = 0;\n } else {\n button.tabIndex = -1;\n }\n });\n };\n\n this.gallerySwiper = new Swiper(this.dom.swiper as HTMLElement, {\n slidesPerView: 1,\n spaceBetween: 8,\n roundLengths: true,\n navigation: {\n nextEl: this.dom.nextArrow as HTMLElement,\n prevEl: this.dom.prevArrow as HTMLElement\n },\n watchOverflow: true,\n breakpoints: {\n [768]: {\n slidesPerView: 4,\n slidesPerGroup: 1,\n spaceBetween: 32,\n grid: {\n rows: 2\n },\n slidesOffsetAfter: desktopOffSetWidth,\n watchSlidesProgress: true\n }\n },\n keyboard: {\n enabled: true,\n onlyInViewport: true\n },\n on: {\n afterInit: () => {\n setTimeout(() => {\n hideNotActiveSlides();\n }, 250);\n },\n slideChangeTransitionEnd: hideNotActiveSlides\n }\n });\n }\n\n updateSwiper() {\n if (this.gallerySwiper) {\n this.gallerySwiper.destroy?.();\n\n //then reinitialize the swiper gallery\n this.initSwiper();\n }\n if (window.innerWidth >= 768) {\n const nodeList = this.dom.galleryItems as NodeListOf;\n const firstElement = nodeList[0] as HTMLElement;\n const secondElement = nodeList[1] as HTMLElement;\n const secondElementWidth = secondElement.clientWidth;\n const firstElementDesiredWidth = secondElementWidth * 2 + 32;\n const sliderElementDesiredHeight = secondElementWidth * 2 + 40;\n const desiredSliderWidth = `${sliderElementDesiredHeight}px`;\n\n //Get the parent element of the firstElement\n const parentElement = firstElement.parentNode as HTMLElement;\n\n //Get slider element\n const sliderElement = parentElement.parentNode as HTMLElement;\n sliderElement.style.height = desiredSliderWidth;\n\n // change the parent node width to the FirstElementDesiredWidth\n const desiredWidth = `${firstElementDesiredWidth}px`;\n\n parentElement.style.width = desiredWidth;\n parentElement.style.height = desiredWidth;\n }\n }\n\n showItemInModal(item: HTMLElement, index: number) {\n // if the this.el contains the class experience-editor then return\n if (this.el.classList.contains('experience-editor')) {\n return;\n }\n const modal = this.dom.modal as HTMLElement;\n const modalImage = this.dom.modalImage as HTMLImageElement;\n const modalCaption = this.dom.modalCaption as HTMLElement;\n const videoModalBackdrop = modal.querySelector(\n '.video-modal__backdrop'\n ) as HTMLElement;\n this.galleryIndex = index;\n this.setGalleryItems();\n\n document.body.classList.add('media-gallery__modal-opened');\n\n if (this.galleryItems) {\n this.galleryItemsLastIndex = this.galleryItems.length - 1;\n }\n\n if (modal) {\n const options = {\n reserveScrollBarGap: true,\n allowTouchMove: (el: HTMLElement) => {\n return el.closest('.media-gallery__modal') !== null;\n }\n } as BodyScrollOptions;\n\n this.focusTrap = createFocusTrap(modal, {\n clickOutsideDeactivates: true,\n returnFocusOnDeactivate: true,\n onActivate() {\n disableBodyScroll(modal, options);\n },\n onDeactivate() {\n clearAllBodyScrollLocks();\n }\n });\n\n modal.classList.remove('media-gallery__modal-close');\n modal.classList.add('media-gallery__modal-open');\n\n this.focusTrap?.activate();\n\n const parent = item.closest(\n '.media-gallery__swiper-slide'\n ) as HTMLElement;\n\n const figure = parent.querySelector('.figure') as HTMLElement;\n\n if (figure) {\n // Is a video element\n modalImage.classList.add('media-gallery__modal-image--disabled');\n const trigger = figure;\n videoModalBackdrop?.classList.remove(\n 'media-gallery__modal-video--disabled'\n );\n this.setVideoModalData(trigger);\n } else {\n // Is an image element\n videoModalBackdrop?.classList.add(\n 'media-gallery__modal-video--disabled'\n );\n modalImage.classList.remove('media-gallery__modal-image--disabled');\n const image = parent.querySelector('img') as HTMLImageElement;\n modalImage.src = image.src;\n }\n\n const caption = parent.querySelector('.media-gallery__image-caption');\n\n modalCaption.textContent = caption?.textContent ?? null;\n (this.dom.nextArrow as HTMLElement).classList.remove(\n 'swiper-button-lock'\n );\n (this.dom.prevArrow as HTMLElement).classList.remove(\n 'swiper-button-lock'\n );\n\n if (index === 0) {\n (this.dom.prevArrow as HTMLElement).classList.add(\n 'swiper-button-disabled'\n );\n } else {\n (this.dom.prevArrow as HTMLElement).classList.remove(\n 'swiper-button-disabled'\n );\n }\n\n //set focus to modal, element .media-gallery__modal-image\n modalImage.focus();\n\n //add the class .arrow-over-modal to the next and prev buttons\n (this.dom.nextArrow as HTMLElement).classList.add('arrow-over-modal');\n (this.dom.prevArrow as HTMLElement).classList.add('arrow-over-modal');\n }\n\n if (\n (this.galleryIndex as number) === (this.galleryItemsLastIndex as number)\n ) {\n (this.dom.nextArrow as HTMLElement).classList.add(\n 'swiper-button-disabled'\n );\n } else {\n (this.dom.nextArrow as HTMLElement).classList.remove(\n 'swiper-button-disabled'\n );\n (this.dom.nextArrow as HTMLElement).removeAttribute('disabled');\n (this.dom.prevArrow as HTMLElement).removeAttribute('disabled');\n }\n\n (window as ExtendedWindowType).dataLayer.push({\n event: 'media_gallery',\n event_category: 'project profiles',\n event_action: 'media gallery open',\n event_label: '',\n event_attributes: {\n gallery_type: 'popover',\n thumbnail_count: index + 1\n }\n });\n }\n\n setVideoModalData(trigger: HTMLElement | null) {\n const videoId = trigger?.getAttribute('data-url');\n if (trigger) {\n const videoDataset = trigger?.dataset as DOMStringMap;\n videoDataset.videoPlayerPlay = videoDataset.videoPlayerPlay?.replace(\n '{videoName}',\n 'other'\n );\n }\n this.videoFigure?.handleReplaceId(videoId as string);\n }\n\n setGalleryItems() {\n const figureGalleryItems = Array.from(\n this.dom.swiperSlides as NodeListOf\n );\n\n this.galleryItems = figureGalleryItems;\n return this.galleryItems;\n }\n\n setNoActivePreview() {\n const activePreview = this.el.querySelector(\n '.media-gallery__image-preview.active'\n ) as HTMLElement;\n activePreview?.classList.remove('active');\n }\n\n setPreviewThumbnails() {\n this.setGalleryItems();\n\n const imagePreviewRow = this.dom.imagePreviewRow as HTMLElement;\n if (this.galleryItems) {\n this.galleryItems?.forEach((item, index) => {\n const div = document.createElement('div');\n const preview = document.createElement('img');\n div.classList.add('media-gallery__image-preview');\n div.setAttribute('data-index', index.toString());\n\n if (item.classList.contains('figure__media-button')) {\n // Is a video element\n const videoThumbnail =\n item?.previousElementSibling?.querySelector('img');\n preview.src = (videoThumbnail as HTMLImageElement).src;\n preview.alt = (videoThumbnail as HTMLImageElement).alt;\n preview.loading = 'lazy';\n preview.width = 65;\n preview.height = 65;\n div.classList.add('media-gallery__image-preview--video');\n preview.setAttribute('data-index', index.toString());\n } else {\n // Is an image element\n preview.src = (item as HTMLImageElement).querySelector('img')\n ?.src as string;\n preview.alt = (item as HTMLImageElement).querySelector('img')\n ?.alt as string;\n preview.loading = 'lazy';\n preview.width = 65;\n preview.height = 65;\n preview.setAttribute('data-index', index.toString());\n }\n\n if (index === 0) {\n //add the active class to the first preview\n div.classList.add('active');\n }\n\n div.appendChild(preview);\n imagePreviewRow.appendChild(div);\n });\n }\n\n this.galleryItems?.forEach((_item, index) => {\n const preview = imagePreviewRow.children[index] as HTMLElement;\n this.handlePreviewImage(preview, index);\n });\n }\n\n handleResize() {\n window.addEventListener('resize', () => {\n if (this.resizeTimeout) {\n clearTimeout(this.resizeTimeout);\n }\n\n this.resizeTimeout = setTimeout(() => {\n this.updateSwiper();\n }, 300);\n });\n }\n\n handlePreviewImage(preview: HTMLElement, index: number) {\n preview.addEventListener('click', () => {\n if (!preview.classList.contains('active')) {\n const activePreview = this.el.querySelector(\n '.media-gallery__image-preview.active'\n ) as HTMLElement;\n activePreview?.classList.remove('active');\n preview.classList.add('active');\n if (this.gallerySwiper) {\n this.gallerySwiper.slideTo(index);\n }\n }\n });\n }\n\n handleCloseModal() {\n this.focusTrap?.deactivate();\n this.pauseVideoInSlide(this.galleryIndex);\n this.setGalleryItems();\n if (this.galleryItems) {\n this.galleryItemsLastIndex = this.galleryItems.length - 1;\n }\n\n if (this.dom.modal) {\n (this.dom.modal as HTMLElement).classList.remove(\n 'media-gallery__modal-open'\n );\n (this.dom.modal as HTMLElement).classList.add(\n 'media-gallery__modal-close'\n );\n }\n\n this.gallerySwiper?.enable();\n this.updateSwiper();\n\n const imagePreviews = this.el.querySelectorAll(\n '.media-gallery__image-preview'\n );\n //remove the active class from all previews\n imagePreviews.forEach(preview => {\n preview.classList.remove('active');\n });\n //add the active class to the first preview\n const firstPreview = imagePreviews[0] as HTMLElement;\n firstPreview.classList.add('active');\n this.scrollToActivePreview();\n this.firstSlideFlag = true;\n\n // Remove the 'media-gallery__modal-opened' class from the body to enable scrolling\n document.body.classList.remove('media-gallery__modal-opened');\n\n //remove the class .arrow-over-modal to the next and prev buttons\n (this.dom.nextArrow as HTMLElement).classList.remove('arrow-over-modal');\n (this.dom.prevArrow as HTMLElement).classList.remove('arrow-over-modal');\n\n (window as ExtendedWindowType).dataLayer.push({\n event: 'media_gallery',\n event_category: 'project profiles',\n event_action: 'media gallery close',\n event_label: '',\n event_attributes: {\n gallery_type: 'popover',\n thumbnail_count: (this.galleryIndex as number) + 1\n }\n });\n }\n\n handleNextArrowClick() {\n const modal = this.dom.modal as HTMLElement;\n this.setGalleryItems();\n const currentSlideIndex = this.gallerySwiper?.activeIndex;\n\n if (modal.classList.contains('media-gallery__modal-open')) {\n if (this.gallerySwiper) {\n if (this.galleryItems) {\n const nextImage =\n this.galleryItems?.[(this.galleryIndex as number) + 1];\n if (nextImage) {\n // Pause the video in the current active slide\n this.pauseVideoInSlide(this.galleryIndex);\n\n this.showItemInModal(nextImage, (this.galleryIndex as number) + 1);\n this.gallerySwiper.disable();\n (this.dom.nextArrow as HTMLElement).classList.remove(\n 'swiper-button-lock'\n );\n (this.dom.prevArrow as HTMLElement).classList.remove(\n 'swiper-button-lock'\n );\n } else {\n this.handleCloseModal();\n }\n }\n }\n\n (window as ExtendedWindowType).dataLayer.push({\n event: 'media_gallery',\n event_category: 'project profiles',\n event_action: 'media gallery arrow click',\n event_label: 'next',\n event_attributes: {\n gallery_type: 'popover',\n thumbnail_count: (this.galleryIndex as number) + 1\n }\n });\n } else {\n //if is tablet and above\n if (window.innerWidth >= 768) {\n //if firstTimeFlag is true then set it to false\n if (this.firstSlideFlag) {\n this.firstSlideFlag = false;\n //swiper slide to next\n this.gallerySwiper?.slideNext();\n }\n }\n\n const imagePreviews = this.el.querySelectorAll(\n '.media-gallery__image-preview'\n );\n const nextIndex = (currentSlideIndex as number) + 1;\n imagePreviews.forEach(preview => {\n if (preview.getAttribute('data-index') === nextIndex?.toString()) {\n const activePreview = this.el.querySelector(\n '.media-gallery__image-preview.active'\n ) as HTMLElement;\n activePreview?.classList.remove('active');\n //add the active class to matched preview\n\n preview.classList.add('active');\n this.scrollToActivePreview();\n }\n });\n\n (window as ExtendedWindowType).dataLayer.push({\n event: 'media_gallery',\n event_category: 'project profiles',\n event_action: 'media gallery arrow click:next',\n event_label: '',\n event_attributes: {\n gallery_type: 'embedded',\n thumbnail_count: ''\n }\n });\n }\n }\n\n handlePrevArrowClick() {\n const modal = this.dom.modal as HTMLElement;\n this.setGalleryItems();\n\n if (modal.classList.contains('media-gallery__modal-open')) {\n if (this.gallerySwiper) {\n if (this.galleryItems) {\n const prevImage =\n this.galleryItems?.[(this.galleryIndex as number) - 1];\n if (prevImage) {\n // Pause the video in the current active slide\n this.pauseVideoInSlide(this.galleryIndex);\n\n this.showItemInModal(prevImage, (this.galleryIndex as number) - 1);\n this.gallerySwiper.disable();\n (this.dom.nextArrow as HTMLElement).classList.remove(\n 'swiper-button-lock'\n );\n (this.dom.prevArrow as HTMLElement).classList.remove(\n 'swiper-button-lock'\n );\n } else {\n this.handleCloseModal();\n }\n }\n }\n\n (window as ExtendedWindowType).dataLayer.push({\n event: 'media_gallery',\n event_category: 'project profiles',\n event_action: 'media gallery arrow click: previous',\n event_label: '',\n event_attributes: {\n gallery_type: 'popover',\n thumbnail_count: (this.galleryIndex as number) + 1\n }\n });\n } else {\n const imagePreviews = this.el.querySelectorAll(\n '.media-gallery__image-preview'\n );\n const currentSlideIndex = this.gallerySwiper?.activeIndex;\n const prevIndex = (currentSlideIndex as number) - 1;\n imagePreviews.forEach(preview => {\n if (preview.getAttribute('data-index') === prevIndex?.toString()) {\n const activePreview = this.el.querySelector(\n '.media-gallery__image-preview.active'\n ) as HTMLElement;\n\n activePreview?.classList.remove('active');\n\n //add the active class to matched preview\n preview.classList.add('active');\n this.scrollToActivePreview();\n this.firstSlideFlag = true;\n }\n });\n\n if (window.innerWidth >= 768) {\n if (currentSlideIndex === 2) {\n this.firstSlideFlag = true;\n this.gallerySwiper?.slidePrev();\n }\n }\n\n (window as ExtendedWindowType).dataLayer.push({\n event: 'media_gallery',\n event_category: 'project profiles',\n event_action: 'media gallery arrow click:previous',\n event_label: '',\n event_attributes: {\n gallery_type: 'embedded',\n thumbnail_count: ''\n }\n });\n }\n }\n\n scrollToActivePreview() {\n const activePreview = this.el.querySelector(\n '.media-gallery__image-preview.active'\n ) as HTMLElement;\n const previewRow = this.el.querySelector(\n '.media-gallery__image-preview-row'\n ) as HTMLElement;\n const activePreviewWidth = activePreview.clientWidth + 20;\n const activePreviewIndex = activePreview.getAttribute('data-index');\n const scrollAmount =\n activePreviewWidth * (parseInt(activePreviewIndex as string) || 0);\n\n previewRow.scrollTo({ left: scrollAmount, behavior: 'auto' });\n }\n\n pauseVideoInSlide(index: number | undefined) {\n const slide = this.galleryItems?.[index as number];\n const figure = slide?.querySelector('.figure') as HTMLElement;\n if (figure) {\n //it is a video\n //pause the video\n this.videoFigure?.handleExternalVideoPause();\n }\n }\n}\n\nexport default MediaGallery;\n"],"names":["MediaGallery","Component","el","__publicField","figure","_a","item","index","event","modalContent","preview","_b","_c","Swiper","Navigation","Keyboard","desktopOffSetWidth","_d","slides","hideNotActiveSlides","slide","button","nodeList","firstElement","secondElementWidth","firstElementDesiredWidth","desiredSliderWidth","parentElement","sliderElement","desiredWidth","modal","modalImage","modalCaption","videoModalBackdrop","options","createFocusTrap","disableBodyScroll","clearAllBodyScrollLocks","parent","trigger","image","caption","videoId","videoDataset","figureGalleryItems","activePreview","imagePreviewRow","div","videoThumbnail","_item","imagePreviews","currentSlideIndex","nextImage","nextIndex","prevImage","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