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S9E,KAAK8D,GAAI,CAC1B/C,MAAO,WACHgE,EAAMC,eACV,GAER,CACJ,CAEAJ,WAAAA,CAAYtB,GACRtD,KAAKoE,aAAgBd,EAAOtD,KAAKkE,eAAiBlE,KAAKmE,aACpDnE,KAAKoE,YAAcpE,KAAKmE,eAAcnE,KAAKoE,YAAcpE,KAAKmE,aACrE,CAEAa,aAAAA,GACIhF,KAAK8D,GAAGC,UAAUkB,IAAI,iBAC1B,CAEAJ,UAAAA,CAAWrF,GACPQ,KAAKiE,MAAMzE,GAAGkF,UAAW,EACzB1E,KAAKiE,MAAMzE,GAAGgF,IAAIT,UAAUkB,IAAI,eAChCjF,KAAK4E,aAAY,EACrB,EAKG,SAASM,EAAWC,GACvBA,EAASb,SAASc,IAEQ,IAAlBA,EAAKnE,UACL,IAAI2C,EAAcwB,EACtB,GAER,C","sources":["webpack://National Motor Museum Trust/../src/throttle.js","webpack://National Motor Museum Trust/../src/index.js","webpack://National Motor Museum Trust/./wwwroot/app/src/js/global.js","webpack://National Motor Museum Trust/./wwwroot/app/src/modules/section-scroll-reveal/section-scroll-reveal.js"],"sourcesContent":["const DEFAULT_THROTTLE_INTERVAL = 100\n\n/**\n * Throttles method execution to prevent some performance bottlenecks\n * @param {Function} fn method to throttle\n * @param {Number} interval milliseconds for the method to be delayed\n */\nfunction throttle(fn, interval = DEFAULT_THROTTLE_INTERVAL) {\n let inThrottle\n let lastFunc\n let lastRan\n\n return function() {\n if (inThrottle === true) {\n clearTimeout(lastFunc)\n lastFunc = setTimeout(function() {\n if (Date.now() - lastRan >= interval) {\n fn.apply(this, arguments)\n lastRan = Date.now()\n }\n }, interval - (Date.now() - lastRan))\n } else {\n fn.apply(this, arguments)\n lastRan = Date.now()\n inThrottle = true\n }\n }\n}\n\nexport default throttle\n","import noop from './noop'\nimport throttle from './throttle'\n\n/**\n * Constructor for element that should be hunted\n * @constructor Hunted\n * @param {Node} element\n * @param {Object} config\n */\nclass Hunted {\n constructor(element, config) {\n this.element = element\n\n // instantiate element as not visible\n this.visible = false\n\n // extend properties from config or fallback to prototype values\n for (var prop in config) {\n if (Object.hasOwnProperty.call(config, prop)) {\n this[prop] = config[prop]\n }\n }\n\n // replace options with dataset if present\n if (typeof element.dataset !== 'undefined') {\n if (typeof element.dataset.huntPersist !== 'undefined') {\n try {\n this.persist = JSON.parse(element.dataset.huntPersist)\n } catch (e) {}\n }\n if (typeof element.dataset.huntOffset !== 'undefined') {\n try {\n this.offset = JSON.parse(element.dataset.huntOffset)\n } catch (e) {}\n }\n }\n }\n}\n\n// protoype values\nHunted.prototype.offset = 0\nHunted.prototype.persist = false\nHunted.prototype.enter = noop\nHunted.prototype.leave = noop\n\n/**\n * Creates and initializes observer\n * @constructor Hunt\n * @param {Node|NodeList|Array} target\n * @param {Object} options\n */\nclass Hunt {\n constructor(target, options) {\n // sanity check for first argument\n const isValidTarget =\n (target && target.nodeType === 1) || typeof target.length === 'number'\n if (!isValidTarget) {\n throw new TypeError(\n 'hunt: observer first argument should be a node or a list of nodes'\n )\n }\n // sanity check for second argument\n if (typeof options !== 'object') {\n throw new TypeError('hunt: observer second argument should be an object')\n }\n\n // turn target to array\n if (target.nodeType === 1) {\n this.__huntedElements__ = [new Hunted(target, options)]\n } else {\n const targetArray = [].slice.call(target)\n this.__huntedElements__ = targetArray.map((t) => new Hunted(t, options))\n }\n\n // hoist viewport metrics\n this.__viewportHeight__ = window.innerHeight\n\n // connect observer and pass in throttle interval\n this.__connect__(options.throttleInterval)\n }\n\n /**\n * Assign throttled actions and add listeners\n * @param {Number} throttleInterval\n * @method __connect__\n * @memberof Hunt\n */\n __connect__(throttleInterval) {\n // throttle actions\n this.__throttledHuntElements__ = throttle(\n this.__huntElements__.bind(this),\n throttleInterval\n )\n this.__throttledUpdateMetrics__ = throttle(\n this.__updateMetrics__.bind(this),\n throttleInterval\n )\n\n // add listeners\n window.addEventListener('scroll', this.__throttledHuntElements__)\n window.addEventListener('resize', this.__throttledUpdateMetrics__)\n\n // run first check\n this.__huntElements__()\n }\n\n /**\n * Checks if hunted elements are visible and apply callbacks\n * @method __huntElements__\n * @memberof Hunt\n */\n __huntElements__() {\n let position = this.__huntedElements__.length\n\n while (position) {\n --position\n const hunted = this.__huntedElements__[position]\n const rect = hunted.element.getBoundingClientRect()\n const isOnViewport =\n rect.top - hunted.offset < this.__viewportHeight__ &&\n rect.top >= -(rect.height + hunted.offset)\n\n /*\n * trigger (enter) event if element comes from a non visible state and the scrolled\n * viewport has reached the visible range of the element without exceeding it\n */\n if (hunted.visible === false && isOnViewport === true) {\n hunted.enter.call(null, hunted.element)\n hunted.visible = true\n // when the leave callback method is not set and hunting should not persist remove element\n if (hunted.leave === noop && hunted.persist !== true) {\n this.__huntedElements__.splice(position, 1)\n\n // end observer activity when there are no more elements\n if (this.__huntedElements__.length === 0) {\n this.disconnect()\n }\n }\n }\n\n /*\n * trigger (leave) event if element comes from a visible state\n * and it's out of the visible range its bottom or top limit\n */\n if (hunted.visible === true && isOnViewport === false) {\n hunted.leave.call(null, hunted.element)\n hunted.visible = false\n // when hunting should not persist remove element\n if (hunted.persist !== true) {\n this.__huntedElements__.splice(position, 1)\n\n // end observer activity when there are no more elements\n if (this.__huntedElements__.length === 0) {\n this.disconnect()\n }\n }\n }\n }\n }\n\n /**\n * Update viewport tracked height and runs a check\n * @method __updateMetrics__\n * @memberof Hunt\n */\n __updateMetrics__() {\n this.__viewportHeight__ = window.innerHeight\n this.__huntElements__()\n }\n\n /**\n * Remove listeners and stops observing elements\n * @method disconnect\n * @memberof Hunt\n */\n disconnect() {\n // remove listeners\n window.removeEventListener('scroll', this.__throttledHuntElements__)\n window.removeEventListener('resize', this.__throttledUpdateMetrics__)\n }\n\n /**\n * __huntElements__ public alias\n * @method trigger\n * @memberof Hunt\n */\n trigger() {\n this.__huntElements__()\n }\n}\n\nexport default Hunt\n","// ***********************************\r\n// ***** global site variables *****\r\n// ***********************************\r\n\r\nconst detectReducedMotionPref = window.matchMedia('(prefers-reduced-motion: reduce)');\r\n\r\nexport const siteSettings = {\r\n reducedMotionPref: detectReducedMotionPref.matches\r\n}\r\n\r\nexport const viewport = {\r\n vw: 0,\r\n vh: 0,\r\n setVw: (val) => {\r\n viewport.vw = val;\r\n },\r\n setVh: (val) => {\r\n viewport.vh = val;\r\n }\r\n}\r\n\r\nexport const mainNavigation = {\r\n mobileActive: false,\r\n setMobileActive: (mode) => {\r\n mainNavigation.mobileActive = mode;\r\n },\r\n desktopActive: false,\r\n setDesktopActive: (mode) => {\r\n mainNavigation.desktopActive = mode;\r\n }\r\n};\r\n\r\nexport const headerSearch = {\r\n active: false,\r\n setActive: (mode) => {\r\n headerSearch.active = mode;\r\n }\r\n};","// *************************************************\r\n// ************* Section Scroll Reveal *************\r\n// *************************************************\r\n\r\nimport hunt from 'huntjs';\r\nimport { siteSettings } from '../../js/global';\r\n\r\nimport './section-scroll-reveal.scss';\r\n\r\nclass ScrollSection {\r\n\r\n constructor(el) {\r\n if(siteSettings.reducedMotionPref) {\r\n el.classList.remove('section-scroll-reveal');\r\n } else {\r\n this.el = el;\r\n this.items = [];\r\n this.delayIncrement = 250;\r\n this.negIncrement = 0 - this.delayIncrement;\r\n this.revealDelay = this.negIncrement;\r\n // get reveal-items in this section\r\n let find = this.el.querySelectorAll('.section--scroll-reveal--item');\r\n find.forEach((r,i) => {\r\n this.items[i] = {\r\n obj: r,\r\n revealTimeout: null,\r\n revealed: false\r\n }\r\n // watch with hunt\r\n let huntConfig = {\r\n enter: () => {\r\n if(!this.items[i].revealed && !this.items[i].revealTimeout) {\r\n this.updateDelay(true);\r\n this.items[i].revealTimeout = setTimeout(() => {\r\n this.itemReveal(i);\r\n }, this.revealDelay);\r\n }\r\n }\r\n };\r\n this.items[i].hunt = new hunt(r, huntConfig);\r\n });\r\n // add hunt to this section\r\n let _this = this;\r\n this.hunt = new hunt(this.el, {\r\n enter: function () {\r\n _this.sectionReveal();\r\n }\r\n });\r\n }\r\n }\r\n \r\n updateDelay(mode) {\r\n this.revealDelay += (mode ? this.delayIncrement : this.negIncrement); // half second gaps between reveals\r\n if(this.revealDelay < this.negIncrement) this.revealDelay = this.negIncrement;\r\n }\r\n\r\n sectionReveal() {\r\n this.el.classList.add('section-reveal');\r\n }\r\n\r\n itemReveal(i) {\r\n this.items[i].revealed = true;\r\n this.items[i].obj.classList.add('item-reveal');\r\n this.updateDelay(false);\r\n }\r\n\r\n}\r\n\r\n// export the default function to create\r\nexport function createFrom(wrappers) {\r\n wrappers.forEach((node) => {\r\n // if node is an element\r\n if (node.nodeType === 1) {\r\n new ScrollSection(node);\r\n }\r\n });\r\n}"],"names":["e","n","t","i","s","o","clearTimeout","setTimeout","Date","now","apply","this","arguments","element","visible","Object","hasOwnProperty","call","dataset","huntPersist","persist","JSON","parse","huntOffset","offset","prototype","enter","leave","nodeType","length","TypeError","__huntedElements__","slice","map","__viewportHeight__","window","innerHeight","__connect__","throttleInterval","__throttledHuntElements__","__huntElements__","bind","__throttledUpdateMetrics__","__updateMetrics__","addEventListener","getBoundingClientRect","top","height","splice","disconnect","removeEventListener","trigger","siteSettings","reducedMotionPref","matchMedia","matches","viewport","vw","vh","setVw","val","setVh","mainNavigation","mobileActive","setMobileActive","mode","desktopActive","setDesktopActive","headerSearch","active","setActive","ScrollSection","constructor","el","classList","remove","items","delayIncrement","negIncrement","revealDelay","querySelectorAll","forEach","r","obj","revealTimeout","revealed","huntConfig","updateDelay","itemReveal","hunt","_this","sectionReveal","add","createFrom","wrappers","node"],"sourceRoot":""}