{"version":3,"file":"main.min.js","sources":["../../../Frontend/js/utils/windowResize.js","../../../Frontend/js/utils/scroll.js","../../../Frontend/js/utils/onReady.js","../../../Frontend/js/utils/elementProperties.js","../../../Frontend/js/utils/scrollLock.js","../../../Frontend/js/components/nav.js","../../../Frontend/js/utils/stickyNavOnScroll.js","../../../Frontend/js/utils/lazyImage.js","../../../Frontend/js/utils/helpers.js","../../../Frontend/js/utils/scrollTo.js","../../../Frontend/js/components/video.js","../../../Frontend/js/main.js","../../../Frontend/js/components/eventticker.js"],"sourcesContent":["import settings from '../../settings.json';\n\nexport const breakpoints = settings.breakpoints;\nexport const breakpointKeys = Object.keys(breakpoints);\nexport let currentWindowWidth = window.innerWidth;\nexport let currentWindowHeight = window.innerHeight;\nexport let currentBreakpoint;\nexport let currentBreakpointIndex = 0;\nlet resizeTimer;\n\nconst resizeFunctions = [];\n\n/**\n * Get various window sizes - width, height etc.\n * This function is fired automatically upon page load. and run each time the window changes size.\n *\n */\nfunction getWindowSizes() {\n currentWindowWidth = window.innerWidth;\n currentWindowHeight = window.innerHeight;\n\n // Calculate which breakpoint is currently active, based on the screen width compared to the breakpoint definitions.\n\n let lastFoundWidth = 0;\n\n breakpointKeys.forEach((key, index) => {\n const width = breakpoints[key];\n if (currentWindowWidth >= width && width > lastFoundWidth) {\n lastFoundWidth = width;\n currentBreakpoint = key;\n currentBreakpointIndex = index;\n }\n });\n}\n\nfunction resizeHandler() {\n clearTimeout(resizeTimer);\n resizeTimer = setTimeout(() => {\n getWindowSizes();\n resizeFunctions.forEach(funcRef => funcRef());\n }, 100);\n}\n\nexport function onWindowResize(handler) {\n if (!currentBreakpoint) {\n initWindowResize();\n }\n\n resizeFunctions.push(handler);\n}\n\nexport function initWindowResize() { \n getWindowSizes();\n window.addEventListener('resize', resizeHandler);\n window.addEventListener('orientationchange', resizeHandler);\n}\n","export let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\n\nlet ticking = false;\nconst scrollFunctions = [];\n\nfunction animate() {\n scrollFunctions.forEach(funcRef => funcRef());\n\n ticking = false;\n}\n\nfunction requestTick() {\n if (!ticking) {\n requestAnimationFrame(animate);\n ticking = true;\n }\n}\n\nfunction scrollHandler() {\n scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\n requestTick();\n}\n/**\n * Adds a function to a function array, executed on a single scroll-event set on window.\n * This avoids the memory load and possible hickups of setting multiple eventlisteners for the same event.\n * Also this optimizes rendering by utilising the requestAnimationFrame for these scroll-events.\n * \n * @param {Function} handler - function to be called on scroll \n * @param {boolean} triggerNow - Should the function be called at once\n */\nexport function onScroll(handler, triggerNow = false) {\n // if first call: setup eventlistener on window\n !scrollFunctions.length ? initScroll() : null;\n\n // Trigger function\n triggerNow ? handler() : null;\n\n scrollFunctions.push(handler); \n}\n\nexport function initScroll() {\n window.addEventListener('scroll', scrollHandler);\n}\n","/**\n * Handler to trigger callbacks once the browser is ready for them.\n *\n * You can keep adding references using onReady() even after the page is loaded. In that case they will be\n * run at once.\n *\n * @example\n * import { onReady } from './utils/events/onReady';\n *\n * onReady(yourFunctionHere);\n *\n */\n\nlet functionReferences = [];\n\n// Set the initial readyState based on the browser's current state. If the script has been loaded\n// asynchronously, the DOM might be ready for us already, in which case there's no reason to delay\n// any further processing. The following will evaluate as true if the DOM is ready, or the page is\n// complete.\nlet readyState = document.readyState === 'interactive' || document.readyState === 'complete';\n\n// Defines whether or not the window.onReady event has been bound, so we won't do it twice. That\n// would just be stupid.\nlet readyEventBound = false;\n\n/**\n * Run the given array of callback functions.\n *\n * @private\n * @param {Array} funcArray\n */\nfunction runFunctionArray(funcArray) {\n funcArray.forEach(funcRef => funcRef());\n}\n\n/**\n * Empty the callback arrays\n *\n * @private\n */\nfunction emptyCallbackArrays() {\n // Keep iterating through the function references until there are none left.\n while (functionReferences.length) {\n // Set up a temporary array that mirrors the list of callbacks, and empty the real one.\n const tempArray = functionReferences.slice(0);\n functionReferences = [];\n\n // Run the callbacks. The callbacks themselves may set up more callbacks, which\n // is why we keep looping the array until we're done.\n runFunctionArray(tempArray);\n }\n\n // At this point we'll assume we're ready for anything!\n readyState = true;\n}\n\n/**\n * Make sure the \"ready\"-event is set.\n *\n * @private\n */\nfunction bindReadyEvent() {\n if (!readyEventBound) {\n if (document.readyState === 'loading') {\n // loading yet, wait for the event\n document.addEventListener('DOMContentLoaded', emptyCallbackArrays);\n } else {\n // DOM is ready!\n emptyCallbackArrays();\n }\n\n readyEventBound = true;\n }\n}\n\n/**\n * Register a function to run when the page is ready.\n *\n * @param {Function} functionReference - The function you want to run.\n */\nexport function onReady(functionReference) {\n if (typeof functionReference === 'function') {\n if (readyState) {\n functionReference();\n } else {\n bindReadyEvent();\n\n functionReferences.push(functionReference);\n }\n }\n}\n","/**\n * Utilities for checking properties and states of elements.\n */\n\n/**\n * Check if an element is empty.\n *\n * @param {Node} element - Check if this element is empty.\n * @param {boolean} [strict=true] - Set this to **false** to ignore nodes with whitespace.\n * @returns {boolean} **True** if the element is empty.\n */\nexport function elementIsEmpty(element, strict = true) {\n return strict ? !element.childNodes.length : !element.innerHTML.trim().length;\n}\n\n/**\n * Check if an element is hidden in the DOM with `display: none;`\n *\n * @param {HTMLElement} element - The element to check.\n * @returns {boolean} **True** if element is hidden, otherwise **false**.\n */\nexport function elementIsHidden(element) {\n return element.offsetParent === null;\n}\n\n/**\n * Check if an element is in the viewport\n * \n * @param {HTMLElement} elem - The element to check \n */\nexport function isVisible(elem) {\n return !!elem && !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);\n}\n\n/**\n * Find out whether or not the given argument is an element that would react somewhat normally to DOM-manipulations.\n *\n * @param {*} element - The element to check.\n * @returns {boolean} `true` if the given argument is an element (or document, or window), and `false` otherwise.\n */\nexport function isElement(element) {\n return element instanceof Element || element instanceof Document || element instanceof Window;\n}\n\n/**\n * Return the position of an element\n *\n * @param {Element|String} element - The HTML element to work with or its ID\n * @param {Element|String|Window} [relativeTo=window] - The HTML element to return the position relative to or its ID\n * @returns {{top: Number, left: Number}} An object with top and left positions in pixels\n *\n *\n * @example