{"version":3,"sources":["webpack://VanillaScrollspy/webpack/universalModuleDefinition","webpack://VanillaScrollspy/webpack/bootstrap","webpack://VanillaScrollspy/./src/index.js","webpack://VanillaScrollspy/./index.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","r","value","n","__esModule","object","property","prototype","hasOwnProperty","p","s","fncAnimation","callback","setTimeout","requestAnimFrame","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","VanillaScrollspy","menu","speed","arguments","length","undefined","easing","_classCallCheck","this","_this","scrollTargetY","scrollY","document","documentElement","scrollTop","currentTime","time","Math","max","min","abs","easingEquations","easeOutSine","pos","sin","PI","easeInOutSine","cos","easeInOutQuint","pow","tick","t","scrollTo","currLink","refElement","links","querySelectorAll","scrollPos","querySelector","getAttribute","offsetTop","clientHeight","classList","add","remove","self","control","e","preventDefault","target","hash","scrollToY","addEventListener","_this2","animated","menuControl","default"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,iBAAAD,IAEAD,EAAA,iBAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,IACAC,EAAAD,EACAE,GAAA,EACAT,YAUA,OANAU,EAAAH,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAQ,GAAA,EAGAR,EAAAD,QA2CA,OAtCAM,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,GACAK,cAAA,EACAC,YAAA,EACA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AAAN,KAAAY,IAAON,EAAO,GAEhB,IAAON,KAAAY,IAAEN,EAAM,EAAM,GAAK,MAIxB,SAAPO,IAEJ,IAAMvC,GADNwB,GAAe,EAAI,IACKC,EAClBe,EAAIV,EAAgBZ,EAAKH,QAAQf,GAEnCA,EAAI,GACN3B,OAAOgC,iBAAiBkC,GACxBlE,OAAOoE,SAAS,EAAGrB,GAAYD,EAAgBC,GAAWoB,IAE1DnE,OAAOoE,SAAS,EAAGtB,GAIvBoB,yCAGA,IAAI9D,SACAiE,SACAC,SACEC,EAAQ3B,KAAKP,KAAKmC,iBAAiB,gBACnCC,EAAYzE,OAAO+C,SAAWC,SAASC,gBAAgBC,UAE7D,IAAK9C,EAAI,EAAGA,EAAImE,EAAM/B,OAAQpC,GAAK,EACjCiE,EAAWE,EAAMnE,IACjBkE,EAAatB,SAAS0B,cAAcL,EAASM,aAAa,UAG7CC,WAAaH,GACvBH,EAAWM,UAAYN,EAAWO,aAAgBJ,EAEnDJ,EAASS,UAAUC,IAAI,UAEvBV,EAASS,UAAUE,OAAO,6CAK9B,IAAMC,EAAOrC,KACb,SAASsC,EAAQC,GACfA,EAAEC,iBACF,IAAMC,EAASrC,SAAS0B,cAAc9B,KAAK0C,MAC3CL,EAAKM,UAAUF,EAAOT,WAGxB,IAAIxE,SAEEmE,EAAQ3B,KAAKP,KAAKmC,iBAAiB,gBAEzC,IAAKpE,EAAI,EAAGA,EAAImE,EAAM/B,OAAQpC,GAAK,EAC1BmE,EAAMnE,GACRoF,iBAAiB,QAASN,kCAG5B,IAAAO,EAAA7C,KACLA,KAAK8C,WACL1C,SAASwC,iBAAiB,SAAU,WAClCC,EAAKE,mCApFUvD,gCCZrBvC,EAAOD,QAAUM,EAAQ,GAAe0F","file":"vanillajs-scrollspy.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VanillaScrollspy\"] = factory();\n\telse\n\t\troot[\"VanillaScrollspy\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","const fncAnimation = (callback) => {\n  window.setTimeout(callback, 1000 / 60);\n  return callback;\n};\n\nwindow.requestAnimFrame = (() =>\n  window.requestAnimationFrame ||\n  window.webkitRequestAnimationFrame ||\n  window.mozRequestAnimationFrame ||\n  fncAnimation\n)();\n\nexport default class VanillaScrollspy {\n  constructor(menu, speed = 2000, easing = 'easeOutSine') {\n    this.menu = menu;\n    this.speed = speed;\n    this.easing = easing;\n  }\n  scrollToY(targetY = 0) {\n    const scrollTargetY = targetY;\n    const scrollY = window.scrollY || document.documentElement.scrollTop;\n    let currentTime = 0;\n    const time = Math.max(0.1, Math.min(Math.abs(scrollY - scrollTargetY) / this.speed, 0.8));\n\n    const easingEquations = {\n      easeOutSine(pos) {\n        return Math.sin(pos * (Math.PI / 2));\n      },\n      easeInOutSine(pos) {\n        return (-0.5 * (Math.cos(Math.PI * pos) - 1));\n      },\n      easeInOutQuint(pos) {\n        /* eslint-disable-next-line */\n        if ((pos /= 0.5) < 1) {\n          return 0.5 * (pos ** 5);\n        }\n        return 0.5 * (((pos - 2) ** 5) + 2);\n      },\n    };\n\n    const tick = () => {\n      currentTime += 1 / 60;\n      const p = currentTime / time;\n      const t = easingEquations[this.easing](p);\n\n      if (p < 1) {\n        window.requestAnimFrame(tick);\n        window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t));\n      } else {\n        window.scrollTo(0, scrollTargetY);\n      }\n    };\n\n    tick();\n  }\n  menuControl() {\n    let i;\n    let currLink;\n    let refElement;\n    const links = this.menu.querySelectorAll('a[href^=\"#\"]');\n    const scrollPos = window.scrollY || document.documentElement.scrollTop;\n\n    for (i = 0; i < links.length; i += 1) {\n      currLink = links[i];\n      refElement = document.querySelector(currLink.getAttribute('href'));\n\n      if (\n        refElement.offsetTop <= scrollPos &&\n        (refElement.offsetTop + refElement.clientHeight) > scrollPos\n      ) {\n        currLink.classList.add('active');\n      } else {\n        currLink.classList.remove('active');\n      }\n    }\n  }\n  animated() {\n    const self = this;\n    function control(e) {\n      e.preventDefault();\n      const target = document.querySelector(this.hash);\n      self.scrollToY(target.offsetTop);\n    }\n\n    let i;\n    let link;\n    const links = this.menu.querySelectorAll('a[href^=\"#\"]');\n\n    for (i = 0; i < links.length; i += 1) {\n      link = links[i];\n      link.addEventListener('click', control);\n    }\n  }\n  init() {\n    this.animated();\n    document.addEventListener('scroll', () => {\n      this.menuControl();\n    });\n  }\n}\n","module.exports = require('./src/index').default;\n"],"sourceRoot":""}