{"version":3,"sources":["../assets/scripts/smooth-scroll.js"],"names":["root","factory","define","amd","exports","module","SmoothScroll","global","window","this","defaults","ignore","header","topOnEmptyHash","speed","speedAsDuration","durationMax","durationMin","clip","offset","easing","customEasing","updateURL","popstate","emitEvents","supports","document","Element","prototype","extend","merged","Array","forEach","call","arguments","obj","key","hasOwnProperty","reduceMotion","settings","matchMedia","matches","getHeight","elem","parseInt","getComputedStyle","height","escapeCharacters","id","charAt","substr","codeUnit","string","String","length","index","result","firstCodeUnit","charCodeAt","InvalidCharacterError","toString","easingPattern","time","pattern","getDocumentHeight","Math","max","body","scrollHeight","documentElement","offsetHeight","clientHeight","getEndLocation","anchor","headerHeight","location","offsetParent","offsetTop","min","innerHeight","getHeaderHeight","getSpeed","distance","abs","setHistory","options","history","replaceState","state","hash","pageYOffset","smoothScroll","JSON","stringify","title","href","isNum","pushState","adjustFocus","endLocation","focus","activeElement","setAttribute","style","outline","scrollTo","emitEvent","type","toggle","CustomEvent","event","bubbles","detail","dispatchEvent","selector","fixedHeader","eventTimeout","animationInterval","cancelScroll","noEvent","cancelAnimationFrame","animateScroll","_settings","Object","anchorElem","tagName","startLocation","querySelector","start","percentage","position","documentHeight","timeLapsed","stopAnimateScroll","currentLocation","loopAnimateScroll","timestamp","floor","requestAnimationFrame","clickHandler","button","metaKey","ctrlKey","target","closest","toLowerCase","hostname","pathname","test","preventDefault","popstateHandler","destroy","removeEventListener","init","addEventListener"],"mappings":"CAQA,SAAAA,EAAAC,GACA,kBAAAC,SAAAA,OAAAC,IACAD,UAAA,WACA,MAAAD,GAAAD,KAEA,gBAAAI,SACAC,OAAAD,QAAAH,EAAAD,GAEAA,EAAAM,aAAAL,EAAAD,IAEA,mBAAAO,QAAAA,OAAA,mBAAAC,QAAAA,OAAAC,KAAA,SAAAD,GAEA,YAMA,IAAAE,IAGAC,OAAA,uBACAC,OAAA,KACAC,gBAAA,EAGAC,MAAA,IACAC,iBAAA,EACAC,YAAA,KACAC,YAAA,KACAC,MAA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CAOA,GAAAkC,GAAAa,QAAAE,MAAAf,MACAA,IAAA,IAAAA,KACAA,EAAA/C,SAAAqG,cAAAhF,EAAAuC,QAAAE,MAAAf,WAKAkB,EAAA8B,cAAAhD,EAAA,MACAnD,WAAA,KAoEA,OA5DAqE,GAAA4D,QAAA,WAGAhH,IAGAb,SAAA8H,oBAAA,QAAAb,GAAA,GACAnI,EAAAgJ,oBAAA,WAAAF,GAAA,GAGA3D,EAAA2B,eAGA/E,EAAA,KACAkC,EAAA,KACAmC,EAAA,KACAO,EAAA,KACAC,EAAA,KACAC,EAAA,OAQA1B,EAAA8D,KAAA,SAAApE,GAGA,IAAA5D,IAAA,KAAA,gGAGAkE,GAAA4D,UAGAhH,EAAAV,EAAAnB,EAAA2E,OACA8B,EAAA5E,EAAA3B,OAAAc,SAAAqG,cAAAxF,EAAA3B,QAAA,KAGAc,SAAAgI,iBAAA,QAAAf,GAAA,GAGApG,EAAAjB,WAAAiB,EAAAhB,UACAf,EAAAkJ,iBAAA,WAAAJ,GAAA,IAUA3D,EAAA8D,KAAApE,GAOAM,EAIA,OAAArF","file":"smooth-scroll.js","sourcesContent":["/*!\n * smooth-scroll v15.2.0\n * Animate scrolling to anchor links\n * (c) 2019 Chris Ferdinandi\n * MIT License\n * http://github.com/cferdinandi/smooth-scroll\n */\n\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define([], (function () {\n return factory(root);\n }));\n } else if (typeof exports === 'object') {\n module.exports = factory(root);\n } else {\n root.SmoothScroll = factory(root);\n }\n})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, (function (window) {\n\n 'use strict';\n\n //\n // Default settings\n //\n\n var defaults = {\n\n // Selectors\n ignore: '[data-scroll-ignore]',\n header: null,\n topOnEmptyHash: true,\n\n // Speed & Duration\n speed: 1000,\n speedAsDuration: false,\n durationMax: null,\n durationMin: null,\n clip: true,\n offset: 0,\n\n // Easing\n easing: 'linear',\n customEasing: null,\n\n // History\n updateURL: true,\n popstate: true,\n\n // Custom Events\n emitEvents: true\n\n };\n\n\n //\n // Utility Methods\n //\n\n /**\n * Check if browser supports required methods\n * @return {Boolean} Returns true if all required methods are supported\n */\n var supports = function () {\n return (\n 'querySelector' in document &&\n 'addEventListener' in window &&\n 'requestAnimationFrame' in window &&\n 'closest' in window.Element.prototype\n );\n };\n\n /**\n * Merge two or more objects together.\n * @param {Object} objects The objects to merge together\n * @returns {Object} Merged values of defaults and options\n */\n var extend = function () {\n var merged = {};\n Array.prototype.forEach.call(arguments, (function (obj) {\n for (var key in obj) {\n if (!obj.hasOwnProperty(key)) return;\n merged[key] = obj[key];\n }\n }));\n return merged;\n };\n\n /**\n * Check to see if user prefers reduced motion\n * @param {Object} settings Script settings\n */\n var reduceMotion = function (settings) {\n if ('matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches) {\n return true;\n }\n return false;\n };\n\n /**\n * Get the height of an element.\n * @param {Node} elem The element to get the height of\n * @return {Number} The element's height in pixels\n */\n var getHeight = function (elem) {\n return parseInt(window.getComputedStyle(elem).height, 10);\n };\n\n /**\n * Escape special characters for use with querySelector\n * @author Mathias Bynens\n * @link https://github.com/mathiasbynens/CSS.escape\n * @param {String} id The anchor ID to escape\n */\n var escapeCharacters = function (id) {\n\n // Remove leading hash\n if (id.charAt(0) === '#') {\n id = id.substr(1);\n }\n\n var string = String(id);\n var length = string.length;\n var index = -1;\n var codeUnit;\n var result = '';\n var firstCodeUnit = string.charCodeAt(0);\n while (++index < length) {\n codeUnit = string.charCodeAt(index);\n // Note: there’s no need to special-case astral symbols, surrogate\n // pairs, or lone surrogates.\n\n // If the character is NULL (U+0000), then throw an\n // `InvalidCharacterError` exception and terminate these steps.\n if (codeUnit === 0x0000) {\n throw new InvalidCharacterError(\n 'Invalid character: the input contains U+0000.'\n );\n }\n\n if (\n // If the character is in the range [\\1-\\1F] (U+0001 to U+001F) or is\n // U+007F, […]\n (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||\n // If the character is the first character and is in the range [0-9]\n // (U+0030 to U+0039), […]\n (index === 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||\n // If the character is the second character and is in the range [0-9]\n // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]\n (\n index === 1 &&\n codeUnit >= 0x0030 && codeUnit <= 0x0039 &&\n firstCodeUnit === 0x002D\n )\n ) {\n // http://dev.w3.org/csswg/cssom/#escape-a-character-as-code-point\n result += '\\\\' + codeUnit.toString(16) + ' ';\n continue;\n }\n\n // If the character is not handled by one of the above rules and is\n // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or\n // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to\n // U+005A), or [a-z] (U+0061 to U+007A), […]\n if (\n codeUnit >= 0x0080 ||\n codeUnit === 0x002D ||\n codeUnit === 0x005F ||\n codeUnit >= 0x0030 && codeUnit <= 0x0039 ||\n codeUnit >= 0x0041 && codeUnit <= 0x005A ||\n codeUnit >= 0x0061 && codeUnit <= 0x007A\n ) {\n // the character itself\n result += string.charAt(index);\n continue;\n }\n\n // Otherwise, the escaped character.\n // http://dev.w3.org/csswg/cssom/#escape-a-character\n result += '\\\\' + string.charAt(index);\n\n }\n\n // Return sanitized hash\n return '#' + result;\n\n };\n\n /**\n * Calculate the easing pattern\n * @link https://gist.github.com/gre/1650294\n * @param {String} type Easing pattern\n * @param {Number} time Time animation should take to complete\n * @returns {Number}\n */\n var easingPattern = function (settings, time) {\n var pattern;\n\n // Default Easing Patterns\n if (settings.easing === 'easeInQuad') pattern = time * time; // accelerating from zero velocity\n if (settings.easing === 'easeOutQuad') pattern = time * (2 - time); // decelerating to zero velocity\n if (settings.easing === 'easeInOutQuad') pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration\n if (settings.easing === 'easeInCubic') pattern = time * time * time; // accelerating from zero velocity\n if (settings.easing === 'easeOutCubic') pattern = (--time) * time * time + 1; // decelerating to zero velocity\n if (settings.easing === 'easeInOutCubic') pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration\n if (settings.easing === 'easeInQuart') pattern = time * time * time * time; // accelerating from zero velocity\n if (settings.easing === 'easeOutQuart') pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity\n if (settings.easing === 'easeInOutQuart') pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration\n if (settings.easing === 'easeInQuint') pattern = time * time * time * time * time; // accelerating from zero velocity\n if (settings.easing === 'easeOutQuint') pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity\n if (settings.easing === 'easeInOutQuint') pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration\n\n // Custom Easing Patterns\n if (!!settings.customEasing) pattern = settings.customEasing(time);\n\n return pattern || time; // no easing, no acceleration\n };\n\n /**\n * Determine the document's height\n * @returns {Number}\n */\n var getDocumentHeight = function () {\n return Math.max(\n document.body.scrollHeight, document.documentElement.scrollHeight,\n document.body.offsetHeight, document.documentElement.offsetHeight,\n document.body.clientHeight, document.documentElement.clientHeight\n );\n };\n\n /**\n * Calculate how far to scroll\n * Clip support added by robjtede - https://github.com/cferdinandi/smooth-scroll/issues/405\n * @param {Element} anchor The anchor element to scroll to\n * @param {Number} headerHeight Height of a fixed header, if any\n * @param {Number} offset Number of pixels by which to offset scroll\n * @param {Boolean} clip If true, adjust scroll distance to prevent abrupt stops near the bottom of the page\n * @returns {Number}\n */\n var getEndLocation = function (anchor, headerHeight, offset, clip) {\n var location = 0;\n if (anchor.offsetParent) {\n do {\n location += anchor.offsetTop;\n anchor = anchor.offsetParent;\n } while (anchor);\n }\n location = Math.max(location - headerHeight - offset, 0);\n if (clip) {\n location = Math.min(location, getDocumentHeight() - window.innerHeight);\n }\n return location;\n };\n\n /**\n * Get the height of the fixed header\n * @param {Node} header The header\n * @return {Number} The height of the header\n */\n var getHeaderHeight = function (header) {\n return !header ? 0 : (getHeight(header) + header.offsetTop);\n };\n\n /**\n * Calculate the speed to use for the animation\n * @param {Number} distance The distance to travel\n * @param {Object} settings The plugin settings\n * @return {Number} How fast to animate\n */\n var getSpeed = function (distance, settings) {\n var speed = settings.speedAsDuration ? settings.speed : Math.abs(distance / 1000 * settings.speed);\n if (settings.durationMax && speed > settings.durationMax) return settings.durationMax;\n if (settings.durationMin && speed < settings.durationMin) return settings.durationMin;\n return parseInt(speed, 10);\n };\n\n var setHistory = function (options) {\n\n // Make sure this should run\n if (!history.replaceState || !options.updateURL || history.state) return;\n\n // Get the hash to use\n var hash = window.location.hash;\n hash = hash ? hash : window.pageYOffset;\n\n // Set a default history\n history.replaceState({\n smoothScroll: JSON.stringify(options),\n anchor: hash ? hash : window.pageYOffset\n },\n document.title,\n hash ? hash : window.location.href\n );\n\n };\n\n /**\n * Update the URL\n * @param {Node} anchor The anchor that was scrolled to\n * @param {Boolean} isNum If true, anchor is a number\n * @param {Object} options Settings for Smooth Scroll\n */\n var updateURL = function (anchor, isNum, options) {\n\n // Bail if the anchor is a number\n if (isNum) return;\n\n // Verify that pushState is supported and the updateURL option is enabled\n if (!history.pushState || !options.updateURL) return;\n\n // Update URL\n history.pushState({\n smoothScroll: JSON.stringify(options),\n anchor: anchor.id\n },\n document.title,\n anchor === document.documentElement ? '#top' : '#' + anchor.id\n );\n\n };\n\n /**\n * Bring the anchored element into focus\n * @param {Node} anchor The anchor element\n * @param {Number} endLocation The end location to scroll to\n * @param {Boolean} isNum If true, scroll is to a position rather than an element\n */\n var adjustFocus = function (anchor, endLocation, isNum) {\n\n // Is scrolling to top of page, blur\n if (anchor === 0) {\n document.body.focus();\n }\n\n // Don't run if scrolling to a number on the page\n if (isNum) return;\n\n // Otherwise, bring anchor element into focus\n anchor.focus();\n if (document.activeElement !== anchor) {\n anchor.setAttribute('tabindex', '-1');\n anchor.focus();\n anchor.style.outline = 'none';\n }\n window.scrollTo(0, endLocation);\n\n };\n\n /**\n * Emit a custom event\n * @param {String} type The event type\n * @param {Object} options The settings object\n * @param {Node} anchor The anchor element\n * @param {Node} toggle The toggle element\n */\n var emitEvent = function (type, options, anchor, toggle) {\n if (!options.emitEvents || typeof window.CustomEvent !== 'function') return;\n var event = new CustomEvent(type, {\n bubbles: true,\n detail: {\n anchor: anchor,\n toggle: toggle\n }\n });\n document.dispatchEvent(event);\n };\n\n\n //\n // SmoothScroll Constructor\n //\n\n var SmoothScroll = function (selector, options) {\n\n //\n // Variables\n //\n\n var smoothScroll = {}; // Object for public APIs\n var settings, anchor, toggle, fixedHeader, eventTimeout, animationInterval;\n\n\n //\n // Methods\n //\n\n /**\n * Cancel a scroll-in-progress\n */\n smoothScroll.cancelScroll = function (noEvent) {\n cancelAnimationFrame(animationInterval);\n animationInterval = null;\n if (noEvent) return;\n emitEvent('scrollCancel', settings);\n };\n\n /**\n * Start/stop the scrolling animation\n * @param {Node|Number} anchor The element or position to scroll to\n * @param {Element} toggle The element that toggled the scroll event\n * @param {Object} options\n */\n smoothScroll.animateScroll = function (anchor, toggle, options) {\n\n // Cancel any in progress scrolls\n smoothScroll.cancelScroll();\n\n // Local settings\n var _settings = extend(settings || defaults, options || {}); // Merge user options with defaults\n\n // Selectors and variables\n var isNum = Object.prototype.toString.call(anchor) === '[object Number]' ? true : false;\n var anchorElem = isNum || !anchor.tagName ? null : anchor;\n if (!isNum && !anchorElem) return;\n var startLocation = window.pageYOffset; // Current location on the page\n if (_settings.header && !fixedHeader) {\n // Get the fixed header if not already set\n fixedHeader = document.querySelector(_settings.header);\n }\n var headerHeight = getHeaderHeight(fixedHeader);\n var endLocation = isNum ? anchor : getEndLocation(anchorElem, headerHeight, parseInt((typeof _settings.offset === 'function' ? _settings.offset(anchor, toggle) : _settings.offset), 10), _settings.clip); // Location to scroll to\n var distance = endLocation - startLocation; // distance to travel\n var documentHeight = getDocumentHeight();\n var timeLapsed = 0;\n var speed = getSpeed(distance, _settings);\n var start, percentage, position;\n\n /**\n * Stop the scroll animation when it reaches its target (or the bottom/top of page)\n * @param {Number} position Current position on the page\n * @param {Number} endLocation Scroll to location\n * @param {Number} animationInterval How much to scroll on this loop\n */\n var stopAnimateScroll = function (position, endLocation) {\n\n // Get the current location\n var currentLocation = window.pageYOffset;\n\n // Check if the end location has been reached yet (or we've hit the end of the document)\n if (position == endLocation || currentLocation == endLocation || ((startLocation < endLocation && window.innerHeight + currentLocation) >= documentHeight)) {\n\n // Clear the animation timer\n smoothScroll.cancelScroll(true);\n\n // Bring the anchored element into focus\n adjustFocus(anchor, endLocation, isNum);\n\n // Emit a custom event\n emitEvent('scrollStop', _settings, anchor, toggle);\n\n // Reset start\n start = null;\n animationInterval = null;\n\n return true;\n\n }\n };\n\n /**\n * Loop scrolling animation\n */\n var loopAnimateScroll = function (timestamp) {\n if (!start) {\n start = timestamp;\n }\n timeLapsed += timestamp - start;\n percentage = speed === 0 ? 0 : (timeLapsed / speed);\n percentage = (percentage > 1) ? 1 : percentage;\n position = startLocation + (distance * easingPattern(_settings, percentage));\n window.scrollTo(0, Math.floor(position));\n if (!stopAnimateScroll(position, endLocation)) {\n animationInterval = window.requestAnimationFrame(loopAnimateScroll);\n start = timestamp;\n }\n };\n\n /**\n * Reset position to fix weird iOS bug\n * @link https://github.com/cferdinandi/smooth-scroll/issues/45\n */\n if (window.pageYOffset === 0) {\n window.scrollTo(0, 0);\n }\n\n // Update the URL\n updateURL(anchor, isNum, _settings);\n\n // Emit a custom event\n emitEvent('scrollStart', _settings, anchor, toggle);\n\n // Start scrolling animation\n smoothScroll.cancelScroll(true);\n window.requestAnimationFrame(loopAnimateScroll);\n\n };\n\n /**\n * If smooth scroll element clicked, animate scroll\n */\n var clickHandler = function (event) {\n\n // Don't run if the user prefers reduced motion\n if (reduceMotion(settings)) return;\n\n // Don't run if right-click or command/control + click\n if (event.button !== 0 || event.metaKey || event.ctrlKey) return;\n\n // Check if event.target has closest() method\n // By @totegi - https://github.com/cferdinandi/smooth-scroll/pull/401/\n if (!('closest' in event.target)) return;\n\n // Check if a smooth scroll link was clicked\n toggle = event.target.closest(selector);\n if (!toggle || toggle.tagName.toLowerCase() !== 'a' || event.target.closest(settings.ignore)) return;\n\n // Only run if link is an anchor and points to the current page\n if (toggle.hostname !== window.location.hostname || toggle.pathname !== window.location.pathname || !/#/.test(toggle.href)) return;\n\n // Get an escaped version of the hash\n var hash = escapeCharacters(toggle.hash);\n\n // Get the anchored element\n var anchor = settings.topOnEmptyHash && hash === '#' ? document.documentElement : document.querySelector(hash);\n anchor = !anchor && hash === '#top' ? document.documentElement : anchor;\n\n // If anchored element exists, scroll to it\n if (!anchor) return;\n event.preventDefault();\n setHistory(settings);\n smoothScroll.animateScroll(anchor, toggle);\n\n };\n\n /**\n * Animate scroll on popstate events\n */\n var popstateHandler = function (event) {\n\n // Stop if history.state doesn't exist (ex. if clicking on a broken anchor link).\n // fixes `Cannot read property 'smoothScroll' of null` error getting thrown.\n if (history.state === null) return;\n\n // Only run if state is a popstate record for this instantiation\n if (!history.state.smoothScroll || history.state.smoothScroll !== JSON.stringify(settings)) return;\n\n // Only run if state includes an anchor\n\n // if (!history.state.anchor && history.state.anchor !== 0) return;\n\n // Get the anchor\n var anchor = history.state.anchor;\n if (anchor && anchor !== 0) {\n anchor = document.querySelector(escapeCharacters(history.state.anchor));\n if (!anchor) return;\n }\n\n // Animate scroll to anchor link\n smoothScroll.animateScroll(anchor, null, {\n updateURL: false\n });\n\n };\n\n /**\n * Destroy the current initialization.\n */\n smoothScroll.destroy = function () {\n\n // If plugin isn't already initialized, stop\n if (!settings) return;\n\n // Remove event listeners\n document.removeEventListener('click', clickHandler, false);\n window.removeEventListener('popstate', popstateHandler, false);\n\n // Cancel any scrolls-in-progress\n smoothScroll.cancelScroll();\n\n // Reset variables\n settings = null;\n anchor = null;\n toggle = null;\n fixedHeader = null;\n eventTimeout = null;\n animationInterval = null;\n\n };\n\n /**\n * Initialize Smooth Scroll\n * @param {Object} options User settings\n */\n smoothScroll.init = function (options) {\n\n // feature test\n if (!supports()) throw 'Smooth Scroll: This browser does not support the required JavaScript methods and browser APIs.';\n\n // Destroy any existing initializations\n smoothScroll.destroy();\n\n // Selectors and variables\n settings = extend(defaults, options || {}); // Merge user options with defaults\n fixedHeader = settings.header ? document.querySelector(settings.header) : null; // Get the fixed header\n\n // When a toggle is clicked, run the click handler\n document.addEventListener('click', clickHandler, false);\n\n // If updateURL and popState are enabled, listen for pop events\n if (settings.updateURL && settings.popstate) {\n window.addEventListener('popstate', popstateHandler, false);\n }\n\n };\n\n\n //\n // Initialize plugin\n //\n\n smoothScroll.init(options);\n\n\n //\n // Public APIs\n //\n\n return smoothScroll;\n\n };\n\n return SmoothScroll;\n\n}));\n"],"sourceRoot":"assets/scripts/"}