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AN,QAAAA,EAAAA,YAAAA,QAAAA,OAAAA,SAGAsB,EAAAA,SAAAA,CAAAA,EAAAA,KACA5B,EAAAA,GAAAA,KAAAA,SAAAA,GAAAA,QAEA,yCACAA,EAAAA,UAAAA,yCACA,IAGA,aACA,4CAEA,EACA6B,WACA,mEACAC,EAAAA,SAAAA,CAAAA,EAAAA,KACA,oCACA,4CACA,GAEA,EACAnB,gBAAAA,GACA,mCACA,IACAoB,EAAAA,eAAAA,CAAAC,SAAAA,WACAC,YAAAA,WACAV,OAAAA,SAAAA,KAAAA,CACA,QAEA,KCzF2T,I,WCOvTW,GAAY,OACd,EACA9C,EACAyB,GACA,EACA,KACA,KACA,MAIF,EAAeqB,EAAiB,O","sources":["webpack://vero/./src/sites/tax_fi/js/vue/components/ArticleTOC.vue?b502","webpack://vero/src/sites/tax_fi/js/vue/components/ArticleTOC.vue","webpack://vero/./src/sites/tax_fi/js/vue/components/ArticleTOC.vue?1005","webpack://vero/./src/sites/tax_fi/js/vue/components/ArticleTOC.vue"],"sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"article-toc-container\"},[_c('section',{staticClass:\"article-toc\"},[_c('header',[(_vm.hasHeading)?_c('h2',[_vm._v(_vm._s(_vm.$trans('/common/OnThisPage')))]):_c('p',[_vm._v(_vm._s(_vm.$trans('/common/OnThisPage')))])]),_c('ul',{staticClass:\"article-toc__list\"},_vm._l((_vm.headings),function(heading,index){return _c('li',{key:index,staticClass:\"article-toc__list-item\",class:{ active: _vm.activeHeading === heading.linkUrl }},[_c('a',{attrs:{\"href\":'#' + heading.linkUrl},on:{\"click\":function($event){$event.preventDefault();return _vm.scrollToHeading(heading.linkUrl)}}},[_c('span',{staticClass:\"article-toc__link-text\"},[_vm._v(_vm._s(heading.text))])])])}),0)])])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\r\n <div class=\"article-toc-container\">\r\n <section class=\"article-toc\">\r\n <header>\r\n <h2 v-if=\"hasHeading\">{{ $trans('/common/OnThisPage') }}</h2>\r\n <p v-else>{{ $trans('/common/OnThisPage') }}</p>\r\n </header>\r\n <ul class=\"article-toc__list\">\r\n <li\r\n v-for=\"(heading, index) in headings\"\r\n :key=\"index\"\r\n class=\"article-toc__list-item\"\r\n :class=\"{ active: activeHeading === heading.linkUrl }\"\r\n >\r\n <a :href=\"'#' + heading.linkUrl\" @click.prevent=\"scrollToHeading(heading.linkUrl)\">\r\n <span class=\"article-toc__link-text\">{{ heading.text }}</span>\r\n </a>\r\n </li>\r\n </ul>\r\n </section>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nexport default {\r\n name: 'ArticleTOC',\r\n props: {\r\n hasHeading: { type: Boolean, default: false }\r\n },\r\n data() {\r\n return {\r\n headings: [],\r\n activeHeading: '',\r\n additionalContents: ''\r\n };\r\n },\r\n mounted() {\r\n this.collectHeadings();\r\n window.addEventListener('scroll', this.onScroll);\r\n if (this.$route.hash) {\r\n this.scrollToHeading(decodeURIComponent(this.$route.hash.replace(/^#/, '')));\r\n }\r\n },\r\n beforeUnmount() {\r\n window.removeEventListener('scroll', this.onScroll);\r\n },\r\n methods: {\r\n collectHeadings() {\r\n // Collect all H2 elements on the page\r\n const mainContentH2 = 'div.main-body h2:not(.accordion h2):not([class*=\"-block\"] h2)';\r\n const topContentH2 = 'div.top-content-body h2:not(.accordion h2):not([class*=\"-block\"] h2)';\r\n const hierarchicalPageHeroElement = 'div.hierarchical-page-hero';\r\n const headingElements = document.querySelectorAll(mainContentH2 + ',' + topContentH2);\r\n this.additionalContents = document.querySelectorAll(\r\n hierarchicalPageHeroElement + ',' + topContentH2\r\n );\r\n this.headings = Array.from(headingElements).map((heading, index) => ({\r\n text: heading.textContent,\r\n linkUrl: heading.textContent.replace(/\\s+/g, '-')\r\n }));\r\n // Assign IDs to the H2 elements\r\n headingElements.forEach((heading, index) => {\r\n heading.id = this.headings[index].linkUrl;\r\n // Custom feature for hiding the h2 top-border in hierarchicalpage\r\n if (this.additionalContents.length > 0 && index == 0) {\r\n heading.className = 'hierarchicalcontentpage__no-top-border';\r\n }\r\n });\r\n // Set first heading active\r\n if (headingElements.length > 0) {\r\n this.activeHeading = this.headings[0].linkUrl;\r\n }\r\n },\r\n onScroll() {\r\n const sections = this.headings.map(heading => document.getElementById(heading.linkUrl));\r\n sections.forEach((section, index) => {\r\n if (150 > section.getBoundingClientRect().top) {\r\n this.activeHeading = this.headings[index].linkUrl;\r\n }\r\n });\r\n },\r\n scrollToHeading(id) {\r\n const headingElement = document.getElementById(id);\r\n if (headingElement) {\r\n headingElement.scrollIntoView({ behavior: 'smooth' });\r\n setTimeout(function () {\r\n window.location.hash = id;\r\n }, 100);\r\n }\r\n }\r\n }\r\n};\r\n</script>\r\n","import mod from \"-!../../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../../../../../node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./ArticleTOC.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!../../../../../../node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./ArticleTOC.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ArticleTOC.vue?vue&type=template&id=1724799a\"\nimport script from \"./ArticleTOC.vue?vue&type=script&lang=js\"\nexport * from \"./ArticleTOC.vue?vue&type=script&lang=js\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","_v","_s","$trans","_l","heading","index","key","class","active","activeHeading","linkUrl","attrs","on","$event","preventDefault","scrollToHeading","text","staticRenderFns","name","props","hasHeading","type","default","data","headings","additionalContents","mounted","window","beforeUnmount","methods","collectHeadings","hierarchicalPageHeroElement","headingElements","onScroll","sections","headingElement","behavior","setTimeout","component"],"sourceRoot":""}