{"version":3,"sources":["webpack:///./src/feature/bookmark-nav/bookmark-nav.js","webpack:///./node_modules/core-js/modules/es.object.get-prototype-of.js","webpack:///./node_modules/core-js/modules/es.object.set-prototype-of.js","webpack:///./node_modules/core-js/modules/es.string.anchor.js","webpack:///./node_modules/core-js/internals/create-html.js","webpack:///./node_modules/core-js/internals/forced-string-html-method.js"],"names":["BookmarkNav","element","el","anchor","initDomCache","init","this","setEventListeners","handleHighlight","dom","list","children","forEach","addEventListener","e","controller","checked","target","contains","firstElementChild","window","location","href","setTimeout","toggleClasses","selected","showSelectionOnMobile","innerText","anchors","Array","from","document","querySelectorAll","bookmarkNavItems","anchorOffsets","push","offsetTop","currentScroll","pageYOffset","anchorOffsetsHigherThanScroll","filter","anchorOffset","length","currentAnchorPosition","currentAnchorItem","clicked","currentClass","item","classList","remove","add","text","string","BaseFeature","$","fails","toObject","nativeGetPrototypeOf","CORRECT_PROTOTYPE_GETTER","stat","forced","sham","getPrototypeOf","it","setPrototypeOf","createHTML","proto","forcedStringHTMLMethod","name","requireObjectCoercible","quot","module","exports","tag","attribute","value","S","String","p1","replace","METHOD_NAME","test","toLowerCase","split"],"mappings":"69BAEMA,E,YACL,WAAYC,GAAS,a,4FAAA,UACpB,wBAAMA,KAEDC,GAAKD,EACV,EAAKE,OAAS,KAEd,EAAKC,eACL,EAAKC,OAPe,E,8RAWpBC,KAAKC,oBACLD,KAAKE,oB,0CAGc,WACnBF,KAAKG,IAAIC,KAAKC,SAASC,SAAQ,SAACX,GAC/BA,EAAQY,iBAAiB,SAAS,SAACC,GAClC,EAAKL,IAAIM,WAAWC,SAAU,EAC1BF,EAAEG,OAAOC,SAASJ,EAAEG,OAAOE,oBAE9BC,OAAOC,SAASC,KAAOrB,EAAQkB,kBAAkBG,KACjDC,YAAW,WACV,EAAKC,cAAcvB,GAAS,KAC1B,MAEHsB,YAAW,WACV,EAAKC,cAAcvB,GAAS,KAC1B,WAINK,KAAKG,IAAIgB,SAASZ,iBAAiB,SAAS,W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oBCZjC,EAAQ,EAKhBT,CAAE,CAAErC,OAAQ,SAAU0C,MAAM,GAAQ,CAClCK,eALmB,EAAQ,O,iCCA7B,IAAIV,EAAI,EAAQ,GACZW,EAAa,EAAQ,KAKzBX,EAAE,CAAErC,OAAQ,SAAUiD,OAAO,EAAMN,OAJN,EAAQ,IAIMO,CAAuB,WAAa,CAC7EhE,OAAQ,SAAgBiE,GACtB,OAAOH,EAAW3D,KAAM,IAAK,OAAQ8D,O,oBCTzC,IAAIC,EAAyB,EAAQ,IAEjCC,EAAO,KAIXC,EAAOC,QAAU,SAAUpB,EAAQqB,EAAKC,EAAWC,GACjD,IAAIC,EAAIC,OAAOR,EAAuBjB,IAClC0B,EAAK,IAAML,EAEf,MADkB,KAAdC,IAAkBI,GAAM,IAAMJ,EAAY,KAAOG,OAAOF,GAAOI,QAAQT,EAAM,UAAY,KACtFQ,EAAK,IAAMF,EAAI,KAAOH,EAAM,M,oBCVrC,IAAIlB,EAAQ,EAAQ,GAIpBgB,EAAOC,QAAU,SAAUQ,GACzB,OAAOzB,GAAM,WACX,IAAI0B,EAAO,GAAGD,GAAa,KAC3B,OAAOC,IAASA,EAAKC,eAAiBD,EAAKE,MAAM,KAAKzC,OAAS","file":"2-52530d93.pkg.js","sourcesContent":["import BaseFeature from '../../foundation/base/base';\r\n\r\nclass BookmarkNav extends BaseFeature {\r\n\tconstructor(element) {\r\n\t\tsuper(element);\r\n\r\n\t\tthis.el = element;\r\n\t\tthis.anchor = null;\r\n\r\n\t\tthis.initDomCache();\r\n\t\tthis.init();\r\n\t}\r\n\r\n\tinit() {\r\n\t\tthis.setEventListeners();\r\n\t\tthis.handleHighlight();\r\n\t}\r\n\r\n\tsetEventListeners() {\r\n\t\tthis.dom.list.children.forEach((element) => {\r\n\t\t\telement.addEventListener('click', (e) => {\r\n\t\t\t\tthis.dom.controller.checked = false;\r\n\t\t\t\tif (e.target.contains(e.target.firstElementChild)) {\r\n\t\t\t\t\t// If an li element is clicked\r\n\t\t\t\t\twindow.location.href = element.firstElementChild.href;\r\n\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\tthis.toggleClasses(element, true);\r\n\t\t\t\t\t}, 200);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\tthis.toggleClasses(element, true);\r\n\t\t\t\t\t}, 200);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\t\tthis.dom.selected.addEventListener('click', () => {\r\n\t\t\tthis.showSelectionOnMobile(this.dom.selected.firstElementChild.innerText, true);\r\n\t\t});\r\n\t}\r\n\r\n\thandleHighlight() {\r\n\t\tconst anchors = Array.from(document.querySelectorAll('[data-id=\"anchor\"]'));\r\n\t\tthis.bookmarkNavItems = Array.from(this.dom.list.children);\r\n\t\tconst anchorOffsets = [];\r\n\t\tanchors.forEach((anchor) => {\r\n\t\t\tanchorOffsets.push(anchor.offsetTop);\r\n\t\t});\r\n\r\n\t\tdocument.addEventListener('scroll', () => {\r\n\t\t\tconst currentScroll = window.pageYOffset;\r\n\t\t\t// eslint-disable-next-line max-len\r\n\t\t\tconst anchorOffsetsHigherThanScroll = anchorOffsets.filter(anchorOffset => ((anchorOffset > currentScroll) ? anchorOffset : false));\r\n\t\t\tif (anchorOffsetsHigherThanScroll.length >= 0) {\r\n\t\t\t\t// eslint-disable-next-line max-len\r\n\t\t\t\tconst currentAnchorPosition = (anchorOffsets.length - 1) - anchorOffsetsHigherThanScroll.length;\r\n\t\t\t\tif (currentAnchorPosition >= 0) {\r\n\t\t\t\t\tthis.currentAnchorItem = this.bookmarkNavItems[currentAnchorPosition];\r\n\t\t\t\t\tthis.toggleClasses(this.currentAnchorItem);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\ttoggleClasses(currentAnchorItem, clicked = false) {\r\n\t\tconst currentClass = 'o-bookmark-nav__list-item--current';\r\n\t\tthis.bookmarkNavItems.forEach((item) => {\r\n\t\t\tif (item !== currentAnchorItem) {\r\n\t\t\t\titem.classList.remove(currentClass);\r\n\t\t\t} else {\r\n\t\t\t\tcurrentAnchorItem.classList.add(currentClass);\r\n\t\t\t\tthis.showSelectionOnMobile(currentAnchorItem.firstElementChild.text, clicked);\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tshowSelectionOnMobile(string, clicked) {\r\n\t\tif (!clicked) {\r\n\t\t\tthis.dom.selected.firstElementChild.innerText = string;\r\n\t\t} else {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.dom.selected.firstElementChild.innerText = string;\r\n\t\t\t}, 200);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport default BookmarkNav;\r\n","var $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar toObject = require('../internals/to-object');\nvar nativeGetPrototypeOf = require('../internals/object-get-prototype-of');\nvar CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });\n\n// `Object.getPrototypeOf` method\n// https://tc39.github.io/ecma262/#sec-object.getprototypeof\n$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {\n getPrototypeOf: function getPrototypeOf(it) {\n return nativeGetPrototypeOf(toObject(it));\n }\n});\n\n","var $ = require('../internals/export');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\n\n// `Object.setPrototypeOf` method\n// https://tc39.github.io/ecma262/#sec-object.setprototypeof\n$({ target: 'Object', stat: true }, {\n setPrototypeOf: setPrototypeOf\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar createHTML = require('../internals/create-html');\nvar forcedStringHTMLMethod = require('../internals/forced-string-html-method');\n\n// `String.prototype.anchor` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.anchor\n$({ target: 'String', proto: true, forced: forcedStringHTMLMethod('anchor') }, {\n anchor: function anchor(name) {\n return createHTML(this, 'a', 'name', name);\n }\n});\n","var requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar quot = /\"/g;\n\n// B.2.3.2.1 CreateHTML(string, tag, attribute, value)\n// https://tc39.github.io/ecma262/#sec-createhtml\nmodule.exports = function (string, tag, attribute, value) {\n var S = String(requireObjectCoercible(string));\n var p1 = '<' + tag;\n if (attribute !== '') p1 += ' ' + attribute + '=\"' + String(value).replace(quot, '"') + '\"';\n return p1 + '>' + S + '';\n};\n","var fails = require('../internals/fails');\n\n// check the existence of a method, lowercase\n// of a tag and escaping quotes in arguments\nmodule.exports = function (METHOD_NAME) {\n return fails(function () {\n var test = ''[METHOD_NAME]('\"');\n return test !== test.toLowerCase() || test.split('\"').length > 3;\n });\n};\n"],"sourceRoot":""}