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,EAAKsI,YACzCJ,EAAMK,OAASvI,EAAKuI,QAEpBL,EAAME,UAAUH,GAAM,GAAO,GAGxBC,CACT,C","sources":["webpack://endrun/./app/components/photo_slideshow_component.js","webpack://endrun/./app/javascript/app/util/events.js"],"sourcesContent":["/*\n * TMP PHOTO SLIDESHOW\n * Original repo: https://github.com/themarshallproject/tmp-photo-slideshow\n */\n\n// packages\nimport defaults from 'underscore/modules/defaults.js';\nimport Hammer from 'hammerjs';\n\n// local\nimport { createEvent } from '$app/util/events.js';\n\nexport default class TMPSlideshow {\n constructor(config) {\n // Set default values for undefined options\n const configWithDefaults = defaults(config, {\n sizeByWindowHeight: true, // If true, photos will take up full screen height if they fit\n mobileMaxWidth: 579, // Width at which to trigger mobile full-bleed style, -1 indicates no max width\n startingSlide: 0, // Index of slide to initiate slideshow on\n captionType: 'each', // TK\n });\n\n /** @type {HTMLElement} */\n this.el = config.el;\n this.config = configWithDefaults;\n this.init();\n }\n\n init() {\n this.containerElement = this.el;\n\n if (this.config.slideData) {\n this.buildSlideMarkup();\n }\n\n this.slideshowContent =\n this.containerElement.querySelector('.slideshow-content');\n this.slideWrapper = this.containerElement.querySelector('.slide-wrapper');\n this.wrapperOffset = 0;\n this.slides = this.containerElement.querySelectorAll('.slide');\n this.captionWrapper = this.containerElement.querySelector(\n '.slide-caption-wrapper'\n );\n this.captions = this.containerElement.querySelectorAll('.slide-caption');\n this.navBtns = this.containerElement.querySelectorAll('.slideshow-btn');\n this.slideProgress =\n this.containerElement.querySelectorAll('.slide-progress');\n\n this.sliderManager = new Hammer.Manager(this.slideshowContent);\n\n this.buildProgressIcon();\n this.sizeSlideshow();\n this.goToSlide(this.config.startingSlide);\n this.initEvents();\n }\n\n buildSlideMarkup() {\n const slideMarkup = [];\n const captionMarkup = [];\n\n this.config.slideData.forEach((slide, i) => {\n let thisSrcset = '';\n let thisByline = '';\n\n if (slide.srcset) {\n thisSrcset = `srcset=\"${slide.srcset}\"`;\n }\n\n if (slide.byline) {\n thisByline = `
`;\n }\n\n slideMarkup.push(`\n \n `);\n\n captionMarkup.push(`\n \n `);\n });\n\n const fullHTML = `\n \n `;\n\n this.containerElement.innerHTML = fullHTML;\n }\n\n buildProgressIcon() {\n const iconHTML = [];\n\n for (var i = 0; i < this.slides.length; i++) {\n iconHTML.push('');\n }\n\n this.slideProgress.forEach((element) => {\n element.innerHTML = iconHTML.join('');\n });\n }\n\n sizeSlideshow() {\n // Save window size values\n this.windowWidth = window.innerWidth;\n this.windowHeight = window.innerHeight;\n\n // Get overall width of slides\n const allSlides = this.slides;\n const allSlideImgs = Array.from(\n this.containerElement.querySelectorAll('img')\n );\n const captionElement = this.containerElement.querySelector(\n '.slide-caption-wrapper'\n );\n const captionBounds = captionElement.getBoundingClientRect();\n const captionComputedStyle = window.getComputedStyle(captionElement);\n const captionHeight =\n captionBounds.height +\n parseFloat(captionComputedStyle.marginTop) +\n parseFloat(captionComputedStyle.marginBottom);\n\n const maxWidth = Math.max(...allSlideImgs.map((img) => img.clientWidth));\n const maxHeight = Math.max(...allSlideImgs.map((img) => img.clientHeight));\n\n const sizingInfo = this.getSizingInfo(maxWidth, maxHeight, captionHeight);\n\n // If we want to size the slideshow to fit full height\n if (sizingInfo.measureBy === 'height') {\n allSlides.forEach((slide) => {\n slide.style.height = `${sizingInfo.slideHeight}px`;\n });\n this.slideshowContent.style.height = `${sizingInfo.slideHeight}px`;\n this.slideWrapper.style.left = `${sizingInfo.slideLeft}px`;\n\n let totalWidth = 0;\n\n allSlides.forEach((slide) => {\n slide.style.width = `${sizingInfo.slideWidth}px`;\n slide.style.left = `${totalWidth}px`;\n\n const slideBounds = slide.getBoundingClientRect();\n const slideComputedStyle = window.getComputedStyle(slide);\n\n totalWidth +=\n slideBounds.width +\n parseFloat(slideComputedStyle.marginLeft) +\n parseFloat(slideComputedStyle.marginRight);\n });\n } else {\n // Otherwise, use given CSS values for slide size\n allSlides.forEach((slide) => {\n slide.style.height = null;\n });\n\n this.slideshowContent.style.height = `${sizingInfo.slideHeight}px`;\n this.slideWrapper.style.left = `${sizingInfo.slideLeft}px`;\n\n let totalWidth = 0;\n\n allSlides.forEach((slide) => {\n slide.style.width = null;\n slide.style.left = `${totalWidth}px`;\n\n const slideBounds = slide.getBoundingClientRect();\n const slideComputedStyle = window.getComputedStyle(slide);\n\n totalWidth +=\n slideBounds.width +\n parseFloat(slideComputedStyle.marginLeft) +\n parseFloat(slideComputedStyle.marginRight);\n });\n }\n\n // Set caption width and nav button width so everything aligns\n this.containerElement.querySelector(\n '.slide-caption-wrapper'\n ).style.width = `${sizingInfo.slideWidth}px`;\n\n if (sizingInfo.slideLeft > 0) {\n this.containerElement.querySelector(\n '.slide-caption-btn'\n ).style.width = `${sizingInfo.slideLeft}px`;\n }\n }\n\n getSizingInfo(slideWidth, slideHeight, captionHeight) {\n const windowHeight = this.windowHeight;\n const windowWidth = this.windowWidth;\n const slideshowPadding = 150;\n const windowRatio =\n (windowWidth - slideshowPadding) /\n (windowHeight - slideshowPadding - captionHeight);\n const slideRatio = slideWidth / slideHeight;\n\n if (\n !this.config.sizeByWindowHeight ||\n windowRatio <= slideRatio ||\n windowWidth <= this.config.mobileMaxWidth\n ) {\n return {\n measureBy: 'width',\n slideHeight: slideHeight,\n slideWidth: slideWidth,\n slideLeft: (windowWidth - slideWidth) / 2,\n };\n } else {\n const computedHeight = windowHeight - slideshowPadding - captionHeight;\n const computedWidth = slideRatio * computedHeight;\n\n return {\n measureBy: 'height',\n slideHeight: computedHeight,\n slideWidth: computedWidth,\n slideLeft: (windowWidth - computedWidth) / 2,\n };\n }\n }\n\n initEvents() {\n window.addEventListener('tmp_resize', () => {\n this.resize();\n });\n\n const sizeSlideshow = this.sizeSlideshow.bind(this);\n\n this.containerElement.querySelectorAll('img').forEach((img) => {\n img.addEventListener(\n 'load',\n () => {\n sizeSlideshow();\n },\n { once: true }\n );\n });\n\n this.navBtns.forEach((btn) => {\n btn.addEventListener('click', (e) => {\n e.preventDefault();\n\n const thisBtn = e.currentTarget;\n const activeIndex = this.activeSlideIndex;\n let newIndex;\n\n if (thisBtn.getAttribute('data-dir') === 'prev') {\n newIndex = activeIndex - 1;\n } else if (thisBtn.classList.contains('btn-replay')) {\n newIndex = 0;\n } else {\n newIndex = activeIndex + 1;\n }\n\n // Protect against exceeding range\n if (newIndex < 0 || newIndex > this.slides.length - 1) {\n return;\n }\n\n this.goToSlide(newIndex);\n });\n });\n\n // Track hover position to set cursor\n this.slideshowContent.addEventListener('mousemove', (e) => {\n const mouseX = e.clientX;\n\n if (mouseX < this.windowWidth / 2 && this.activeSlideIndex > 0) {\n this.slideshowContent.classList.add('slideshow-cursor-prev');\n this.slideshowContent.classList.remove(\n 'slideshow-cursor-next',\n 'slideshow-cursor-hide',\n 'slideshow-cursor-replay'\n );\n } else if (this.activeSlideIndex == this.slides.length - 1) {\n this.slideshowContent.classList.add('slideshow-cursor-replay');\n this.slideshowContent.classList.remove(\n 'slideshow-cursor-next',\n 'slideshow-cursor-hide',\n 'slideshow-cursor-prev'\n );\n } else {\n this.slideshowContent.classList.add('slideshow-cursor-next');\n this.slideshowContent.classList.remove(\n 'slideshow-cursor-prev',\n 'slideshow-cursor-hide',\n 'slideshow-cursor-replay'\n );\n }\n });\n\n // Use Hammer.js to handle events, tap\n this.sliderManager.add(new Hammer.Tap());\n\n this.sliderManager.on('tap', (e) => {\n const activeIndex = this.activeSlideIndex;\n let newIndex;\n\n if (e.center.x < this.windowWidth / 2 && activeIndex > 0) {\n newIndex = activeIndex - 1;\n } else if (activeIndex == this.slides.length - 1) {\n newIndex = 0;\n } else {\n newIndex = activeIndex + 1;\n }\n\n // Protect against exceeding range\n if (newIndex < 0 || newIndex > this.slides.length - 1) {\n return;\n }\n\n this.goToSlide(newIndex);\n\n const simulatedEvent = createEvent('mousemove');\n simulatedEvent.clientX = e.center.x;\n simulatedEvent.clientY = e.center.y;\n this.slideshowContent.dispatchEvent(simulatedEvent);\n });\n\n // Add pan events to allow swipe/drag\n this.sliderManager.add(new Hammer.Pan({ threshold: 0, pointers: 0 }));\n\n // Drag along with pan movement\n this.sliderManager.on('panleft panright', (e) => {\n const currentOffset = this.wrapperOffset;\n this.slideWrapper.style.transform = `translateX(${\n currentOffset + e.deltaX\n }px)`;\n });\n\n // Snap to correct slide after pan ends\n this.sliderManager.on('panend', (e) => {\n let activeSlideIndex = this.activeSlideIndex;\n const sliderSensitivity =\n 0.2 * this.containerElement.getBoundingClientRect().width;\n\n // Checking the velocity helps us handle super-quick motions like flicking\n if (e.velocityX > 1) {\n this.goToSlide(activeSlideIndex - 1);\n } else if (e.velocityX < -1) {\n this.goToSlide(activeSlideIndex + 1);\n } else {\n // We use our own check for sensitivity here instead of Hammer's threshold\n // because we still want the slide to track the mouse's movement, but we want\n // to provide a minimum distance it has to travel before advancing slides.\n if (e.deltaX <= -sliderSensitivity) {\n this.goToSlide(activeSlideIndex + 1);\n } else if (e.deltaX > sliderSensitivity) {\n this.goToSlide(activeSlideIndex - 1);\n } else {\n this.goToSlide(activeSlideIndex);\n }\n }\n });\n }\n\n goToSlide(inputSlideIndex) {\n let slideIndex = inputSlideIndex;\n // Prevent from moving to nonexistent slides\n if (inputSlideIndex < 0) {\n slideIndex = 0;\n } else if (inputSlideIndex > this.slides.length - 1) {\n slideIndex = this.slides.length - 1;\n }\n\n // go to slide\n const activeSlide = this.setActiveSlide(slideIndex);\n this.activeSlideIndex = slideIndex;\n\n // Move slide wrapper to display active slide\n const slideOffset = activeSlide.style.left;\n this.slideWrapper.classList.add('is-animating');\n this.slideWrapper.style.transform = `translateX(-${slideOffset})`;\n this.wrapperOffset = -1 * +slideOffset.replace('px', '');\n\n clearTimeout(this.animationTimer);\n\n this.animationTimer = setTimeout(() => {\n this.slideWrapper.classList.remove('is-animating');\n }, 700);\n }\n\n setActiveSlide(slideIndex) {\n // set active slide\n this.slideWrapper\n .querySelectorAll('.slide-active, .slide-prev, .slide-next')\n .forEach((slide) => {\n slide.classList.remove('slide-active', 'slide-prev', 'slide-next');\n });\n\n const activeSlide = this.slides[slideIndex];\n activeSlide.classList.add('slide-active');\n\n const progressIconActiveElements = this.captionWrapper.querySelectorAll(\n '.progress-icon-active'\n );\n\n progressIconActiveElements.forEach((element) => {\n element.classList.remove('progress-icon-active');\n });\n\n this.slideProgress.forEach((element) => {\n const progressIconElements = element.querySelectorAll('.progress-icon');\n const progressIconElement = progressIconElements[slideIndex];\n progressIconElement.classList.add('progress-icon-active');\n });\n\n if (slideIndex > 0) {\n this.slides[slideIndex - 1].classList.add('slide-prev');\n }\n\n if (slideIndex < this.slides.length - 1) {\n this.slides[slideIndex + 1].classList.add('slide-next');\n }\n\n if (this.config.captionType === 'each') {\n // Set active caption\n this.captionWrapper\n .querySelectorAll('.slide-caption-active')\n .forEach((caption) => {\n caption.classList.remove('slide-caption-active');\n });\n\n const activeCaption = this.captions[slideIndex];\n activeCaption.classList.add('slide-caption-active');\n }\n\n // Set button states\n const btnHide = this.containerElement.querySelector('.btn-hide');\n\n if (btnHide) {\n btnHide.classList.remove('btn-hide');\n }\n\n const btnReplay = this.containerElement.querySelector('.btn-replay');\n\n if (btnReplay) {\n btnReplay.classList.remove('btn-replay');\n }\n // Hide nav button if it's at start of the slideshow\n if (slideIndex === 0) {\n this.containerElement\n .querySelector('.btn-prev')\n .classList.add('btn-hide');\n } else if (slideIndex == this.slides.length - 1) {\n // Change next button to replay icon\n this.containerElement\n .querySelector('.btn-next')\n .classList.add('btn-replay');\n }\n\n return activeSlide;\n }\n\n resize() {\n this.sizeSlideshow();\n // After resizing, reset slidewrapper viewport in case image position has shifted\n this.goToSlide(this.activeSlideIndex);\n }\n}\n","/**\n * A constant to track whether custom events are supported.\n *\n * @private\n * @type {boolean}\n */\nconst supportsCustomEvent = typeof window.CustomEvent === 'function';\n\n/**\n * A wrapper around CustomEvent (for modern browers) and document.createEvent\n * (for older browsers). Can be removed in favor of CustomEvent when we drop\n * support for IE11.\n *\n * @template T\n * @param {string} type The type of event to create.\n * @param {CustomEventInit