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,UAAUa,IAAI,aACtB5E,KAAK8D,GAAGe,MAAMC,UAAa,GAAE9E,KAAKiE,yCAAyC,GAC5EjE,KAAKkE,YACZ,EAKG,SAASa,EAAWC,GACvBA,EAASC,SAASC,IAEQ,IAAlBA,EAAKjE,UACL,IAAI2C,EAAOsB,EACf,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/js/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};","import hunt from 'huntjs';\r\n\r\nimport { siteSettings } from './global';\r\n\r\nclass Reveal {\r\n\r\n constructor(el) {\r\n if(siteSettings.reducedMotionPref) {\r\n el.classList.remove('reveal');\r\n } else {\r\n this.el = el;\r\n this.revealType = 'reveal-clip-from-center';\r\n this.revealDelay = 0;\r\n // look for data attributes to override defaults\r\n let rType = this.el.dataset.revealType;\r\n if(typeof rType != undefined) this.revealType = rType;\r\n let rDelay = this.el.dataset.revealDelay;\r\n if(typeof rDelay != undefined) this.revealDelay = parseInt(rDelay);\r\n // add hunt to see when element enters viewport\r\n let _this = this;\r\n this.hunt = new hunt(this.el, {\r\n enter: function () {\r\n _this.reveal();\r\n }\r\n });\r\n }\r\n }\r\n\r\n reveal() {\r\n this.el.onanimationend = (e) => {\r\n if(e.target == this.el) {\r\n this.el.classList.add('revealed');\r\n this.el.classList.remove('revealing');\r\n this.el.style.animation = 'none';\r\n this.el.onanimationend = null;\r\n }\r\n };\r\n setTimeout(() => {\r\n this.el.classList.add('revealing');\r\n this.el.style.animation = `${this.revealType} 500ms 1 forwards ease-in-out`;\r\n }, this.revealDelay);\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 Reveal(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","Reveal","constructor","el","classList","remove","revealType","revealDelay","rType","undefined","rDelay","parseInt","_this","hunt","reveal","onanimationend","target","add","style","animation","createFrom","wrappers","forEach","node"],"sourceRoot":""}