{"version":3,"sources":["initializeHomepage.js"],"names":["win","$","fp","home","init","let","initialLoad","addClass","jqUpdateSize","height","window","announcementHeight","length","outerHeight","extraHeight","css","removeClass","setTimeout","video","videoButton","videoButtonIcon","controlAnnouncements","resize","document","getElementById","querySelector","addEventListener","paused","play","setAttribute","classList","replace","textContent","pause","setBgImage","imgInfo","slideshowPhotoEl","pixelDensity","devicePixelRatio","screenSize","width","innerWidth","filteredImages","filter","img","assetSize","randomBackgroundImage","Math","floor","random","style","backgroundImage","imagePath","altText"],"mappings":"AAAA,CAAA,SAAAA,EAAAC,GACA,aACAC,EAAAF,EAAAE,GAAA,KAAA,IAAAF,EAAAE,GAAAF,EAAAE,GAAA,GACAA,EAAAC,KAAA,KAAA,IAAAD,EAAAC,KAAAD,EAAAC,KAAA,GAEAD,EAAAC,KAuEA,CACAC,KAAA,WACAC,IAAAC,EAAA,CAAA,EACAL,EAAA,gBAAA,EAAAM,SAAA,UAAA,EAEA,SAAAC,IACA,IAAAC,EAAAR,EAAAS,MAAA,EAAAD,OAAA,EACAE,EAAAV,EAAA,iBAAA,EAAAW,OAAAX,EAAA,iBAAA,EAAAY,YAAA,EAAA,EACAC,EAAA,SAAAb,EAAA,kBAAA,EAAAc,IAAA,OAAA,EACA,EACAd,EAAA,UAAA,EAAAY,YAAA,EAAAZ,EAAA,SAAA,EAAAY,YAAA,EAEAZ,EAAA,oBAAA,EAAAc,IAAA,SAAAN,EAAAE,EAAAG,CAAA,EAEAR,IACAL,EAAA,MAAA,EAAAe,YAAA,oBAAA,EACAV,EAAA,CAAA,EACAW,WAAA,IAAAhB,EAAA,MAAA,EAAAM,SAAA,UAAA,EAAA,GAAA,EAEA,CAdA,IAxDAW,EACAC,EACAC,EACAC,EAqEAb,EAAA,EACAP,EAAAS,MAAA,EAAAY,OAAAd,CAAA,EAzEAU,EAAAK,SAAAC,eAAA,UAAA,EACAL,EAAAI,SAAAC,eAAA,kBAAA,EACAJ,EAAAD,EAAAA,EAAAM,cAAA,MAAA,EAAA,KACAJ,EAAAE,SAAAC,eAAA,6BAAA,EAEAN,GAAAC,GAAAE,GAIAF,EAAAO,iBAAA,QAAA,WACAR,EAAAS,QAMAT,EAAAU,KAAA,EACAT,EAAAU,aAAA,aAAA,aAAA,EACAT,EAAAU,UAAAC,QAAA,YAAA,YAAA,EACAV,EAAAW,YAAA,kBARAd,EAAAe,MAAA,EACAd,EAAAU,aAAA,aAAA,YAAA,EACAT,EAAAU,UAAAC,QAAA,aAAA,WAAA,EACAV,EAAAW,YAAA,eAOA,CAAA,CAwDA,EAEAE,WApDA,SAAAC,EAAA,IAEA,MAAAC,EAAAb,SAAAE,cAAA,4BAAA,EAGA,GAAAW,EAAA,CA9CAC,EAAA3B,OAAA4B,kBAAA,EAgDA,MAAAC,EA7CA,OAFAC,EAAA9B,OAAA+B,WAAAJ,GAEA,SACA,MAAAG,EAAA,QACA,KAAAA,EAAA,SACA,KAAAA,EAAA,QACA,SARA,IAkDAE,EAAAP,EAAAQ,OAAA,GAAAC,EAAAC,YAAAN,CAAA,EACAG,EAAA9B,SAGAkC,EAAAJ,EADAK,KAAAC,MAAAD,KAAAE,OAAA,EAAAP,EAAA9B,MAAA,GAIAwB,EAAAc,MAAAC,wBAAAL,EAAAM,cAGAN,EAAAO,UACAjB,EAAAP,aAAA,aAAAiB,EAAAO,OAAA,EACAjB,EAAAP,aAAA,OAAA,KAAA,GAfA,CAiBA,CA+BA,CAEA,EAAAnB,OAAAT,CAAA","file":"homepage-0bfe5d3ea1.js","sourcesContent":["(function (win, $) {\n    'use strict';\n    var fp = (win.fp = typeof win.fp !== 'undefined' ? win.fp : {}),\n        home = (fp.home = typeof fp.home !== 'undefined' ? fp.home : {});\n\n    fp.home = (function () {\n\n        // =========================================\n        // Get screen size\n        // =========================================\n        const getScreenSize = function () {\n            const pixelDensity = window.devicePixelRatio || 1;\n            const width = window.innerWidth * pixelDensity;\n\n            if (width >= 2400) return 'xlarge';\n            if (width >= 1400) return 'large';\n            if (width >= 1000) return 'medium';\n            if (width >= 600) return 'small';\n            return 'xsmall';\n        };\n\n        // =========================================\n        // Set video controls\n        // =========================================\n        var setupVideoControls = function () {\n            var video = document.getElementById('bg-video');\n            var videoButton = document.getElementById('video-pause-play');\n            var videoButtonIcon = videoButton ? videoButton.querySelector('span') : null; // Fixed here;\n            var controlAnnouncements = document.getElementById('video-control-announcements');\n\n            if (!video || !videoButton || !controlAnnouncements) {\n                return;\n            }\n\n            videoButton.addEventListener('click', function () {\n                if (!video.paused) {\n                    video.pause();\n                    videoButton.setAttribute('aria-label', 'Play video');\n                    videoButtonIcon.classList.replace('icon-pause', 'icon-play');\n                    controlAnnouncements.textContent = 'Video paused';\n                } else {\n                    video.play();\n                    videoButton.setAttribute('aria-label', 'Pause video');\n                    videoButtonIcon.classList.replace('icon-play', 'icon-pause');\n                    controlAnnouncements.textContent = 'Video playing';\n                }\n            });\n        };\n\n        // =========================================\n        // Set background image\n        // =========================================\n        const setBgImage = function (imgInfo = []) {\n            // Select only .slideshow.slideshow-photo\n            const slideshowPhotoEl = document.querySelector('.slideshow.slideshow-photo');\n\n            // Exit if .slideshow.slideshow-photo is not available\n            if (!slideshowPhotoEl) return;\n\n            const screenSize = getScreenSize();\n            const filteredImages = imgInfo.filter((img) => img.assetSize === screenSize);\n            if (!filteredImages.length) return;\n\n            const randomNumber = Math.floor(Math.random() * filteredImages.length);\n            const randomBackgroundImage = filteredImages[randomNumber];\n\n            // Set the background image\n            slideshowPhotoEl.style.backgroundImage = `url('${randomBackgroundImage.imagePath}')`;\n\n            // Set accessibility attributes\n            if (randomBackgroundImage.altText) {\n                slideshowPhotoEl.setAttribute('aria-label', randomBackgroundImage.altText);\n                slideshowPhotoEl.setAttribute('role', 'img');\n            }\n        };\n\n        return {\n            init: function () {\n                let initialLoad = true;\n                $('.homepage-link').addClass('selected');\n\n                const jqUpdateSize = function () {\n                    const height = $(window).height();\n                    const announcementHeight = $('.message-banner').length ? $('.message-banner').outerHeight() : 0;\n                    const extraHeight = $('#width-detection').css('float') === 'left'\n                        ? 0\n                        : $('#utility').outerHeight() + $('#header').outerHeight();\n\n                    $('.slideshow-wrapper').css('height', height - announcementHeight - extraHeight);\n\n                    if (initialLoad) {\n                        $('body').removeClass('fade-home-contents');\n                        initialLoad = false;\n                        setTimeout(() => $('body').addClass('hero-set'), 1000);\n                    }\n                };\n\n                jqUpdateSize();\n                $(window).resize(jqUpdateSize);\n\n                // Initialize video controls\n                setupVideoControls();\n            },\n\n            setBgImage: setBgImage\n        };\n    })();\n})(window, $);"]}