{"version":3,"sources":["webpack:///./Scripts/tabs.js"],"names":["__webpack_require__","r","__webpack_exports__","_utils__WEBPACK_IMPORTED_MODULE_0__","element","Tab","next","activeTab","activeContent","nextContent","containerHeight","equalContents","nextHeight","self","this","heightData","getAttribute","tabsContentContainer","supportTransitions","tabs","getClosest","triggerEnd","style","height","classList","remove","isAnimating","triggerShow","setTimeout","offsetWidth","emulateTransitionEnd","customEvent","call","triggerHide","float","left","scrollHeight","add","offsetHeight","contains","nextClass","getActiveTab","activeTabs","slice","getElementsByClassName","length","getActiveContent","document","querySelector","show","setAttribute","addEventListener","e","preventDefault","currentTarget","parentNode","Tabs","elements","querySelectorAll","i"],"mappings":"0FAAAA,EAAAC,EAAAC,GAAA,IAAAC,EAAAH,EAAA,GAEeE,EAAA,iBAAAE,GAsId,IArIA,IAAIC,EAAM,SAAUD,GACnB,IAGIE,EAAMC,EAAWC,EAAeC,EAAaC,EAAiBC,EAAeC,EAH7EC,EAAOC,KACPC,EAAaX,EAAQY,aAAa,eAGlCC,GAFSC,sBAEc,GACvBC,EAAOC,qBAAWhB,EAAS,aAG3BiB,EAAa,WAChBJ,EAAqBK,MAAMC,OAAS,GACpCN,EAAqBO,UAAUC,OAAO,cACtCN,EAAKO,aAAc,GAGhBC,EAAc,WACbV,EACCN,EACHU,IAEAO,WAAW,WACVX,EAAqBK,MAAMC,OAASX,EAAa,KACjDK,EAAqBY,YACrBC,+BAAqBb,EAAsBI,IACzC,IAGJF,EAAKO,aAAc,EAEpBK,cAAYC,KAAK1B,EAAM,MAAO,QAASC,IAGpC0B,EAAc,WACbhB,IACHT,EAAcc,MAAMY,MAAQC,KAC5B1B,EAAYa,MAAMY,MAAQC,KAC1BzB,EAAkBF,EAAc4B,cAGjC3B,EAAYe,UAAUa,IAAI,UAC1BN,cAAYC,KAAK1B,EAAM,MAAO,OAAQC,GAEtCC,EAAcgB,UAAUC,OAAO,UAC/BM,cAAYC,KAAKzB,EAAW,MAAO,SAAUD,GAEzCW,IACHL,E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IZ4C,EAAWrD,EAAQsD,iBAAiB,uBAC/BC,EAAI,EAAGA,EAAIF,EAASZ,OAAQc,IACpC,IAAItD,EAAIoD,EAASE","file":"9.js","sourcesContent":["import { getClosest, supportTransitions, emulateTransitionEnd, customEvent } from './utils';\n\nexport default element => {\n\tvar Tab = function (element) {\n\t\tvar self = this;\n\t\tvar heightData = element.getAttribute('data-height');\n\t\tvar height = supportTransitions ? (heightData === 'true') : false;\n\t\tvar next, activeTab, activeContent, nextContent, containerHeight, equalContents, nextHeight;\n\t\tvar tabsContentContainer = false;\n\t\tvar tabs = getClosest(element, '.nav-tabs');\n\n\t\t// triggers\n\t\tvar triggerEnd = function () {\n\t\t\ttabsContentContainer.style.height = '';\n\t\t\ttabsContentContainer.classList.remove('collapsing');\n\t\t\ttabs.isAnimating = false;\n\t\t};\n\n\t\tvar triggerShow = function () {\n\t\t\tif (tabsContentContainer) { // height animation\n\t\t\t\tif (equalContents) {\n\t\t\t\t\ttriggerEnd();\n\t\t\t\t} else {\n\t\t\t\t\tsetTimeout(function () { // enables height animation\n\t\t\t\t\t\ttabsContentContainer.style.height = nextHeight + 'px'; // height animation\n\t\t\t\t\t\ttabsContentContainer.offsetWidth;\n\t\t\t\t\t\temulateTransitionEnd(tabsContentContainer, triggerEnd);\n\t\t\t\t\t}, 50);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttabs.isAnimating = false;\n\t\t\t}\n\t\t\tcustomEvent.call(next, 'tab', 'shown', activeTab);\n\t\t};\n\n\t\tvar triggerHide = function () {\n\t\t\tif (tabsContentContainer) {\n\t\t\t\tactiveContent.style.float = left;\n\t\t\t\tnextContent.style.float = left;\n\t\t\t\tcontainerHeight = activeContent.scrollHeight;\n\t\t\t}\n\n\t\t\tnextContent.classList.add('active');\n\t\t\tcustomEvent.call(next, 'tab', 'show', activeTab);\n\n\t\t\tactiveContent.classList.remove('active');\n\t\t\tcustomEvent.call(activeTab, 'tab', 'hidden', next);\n\n\t\t\tif (tabsContentContainer) {\n\t\t\t\tnextHeight = nextContent.scrollHeight;\n\t\t\t\tequalContents = nextHeight === containerHeight;\n\n\t\t\t\ttabsContentContainer.classList.add('collapsing');\n\t\t\t\ttabsContentContainer.style.height = containerHeight + 'px'; // height animation\n\t\t\t\ttabsContentContainer.offsetHeight;\n\t\t\t\tactiveContent.style.float = '';\n\t\t\t\tnextContent.style.float = '';\n\t\t\t}\n\n\t\t\tif (nextContent.classList.contains('fade')) {\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\tnextClass.classList.add('show');\n\t\t\t\t\temulateTransitionEnd(nextContent, triggerShow);\n\t\t\t\t}, 20);\n\t\t\t} else {\n\t\t\t\ttriggerShow();\n\t\t\t}\n\t\t};\n\n\t\t// invalidate\n\t\tif (!tabs) return;\n\n\t\t// set default animation state\n\t\ttabs.isAnimating = false;\n\n\t\tvar getActiveTab = function () {\n\t\t\tvar activeTab;\n\t\t\tvar activeTabs = [].slice.call(tabs.getElementsByClassName('active'));\n\n\t\t\tif (activeTabs.length === 1) {\n\t\t\t\tactiveTab = activeTabs[0];\n\t\t\t} else if (activeTabs.length > 1) {\n\t\t\t\tactiveTab = activeTabs[activeTabs.length - 1];\n\t\t\t}\n\n\t\t\treturn activeTab;\n\t\t};\n\n\t\tvar getActiveContent = function () {\n\t\t\treturn document.querySelector(getActiveTab().getAttribute('href'));\n\t\t};\n\n\t\tvar clickHandler = function (e) {\n\t\t\te.preventDefault();\n\n\t\t\tnext = e.currentTarget;\n\t\t\t!tabs.isAnimating && !next.classList.contains('active') && self.show();\n\t\t};\n\n\t\t// public method\n\t\tthis.show = function () { // the tab we clicked is now the next tab\n\t\t\tnext = next || element;\n\t\t\tnextContent = document.querySelector(next.getAttribute('href'));\n\t\t\tactiveTab = getActiveTab();\n\t\t\tactiveContent = getActiveContent();\n\n\t\t\ttabs.isAnimating = true;\n\t\t\tactiveTab.classList.remove('active');\n\t\t\tactiveTab.setAttribute('aria-selected', 'false');\n\t\t\tnext.classList.add('active');\n\t\t\tnext.setAttribute('aria-selected', 'true');\n\n\t\t\tcustomEvent.call(activeTab, 'tab', 'hide', next);\n\n\t\t\tif (activeContent.classList.contains('fade')) {\n\t\t\t\tactiveContent.classList.remove('show');\n\t\t\t\temulateTransitionEnd(activeContent, triggerHide);\n\t\t\t} else {\n\t\t\t\ttriggerHide();\n\t\t\t}\n\t\t};\n\n\t\t// init\n\t\tif (!('Tabs' in element)) { // prevent adding event handlers twice\n\t\t\telement.addEventListener('click', clickHandler, false);\n\t\t}\n\n\t\tif (self.height) {\n\t\t\ttabsContentContainer = getActiveContent().parentNode;\n\t\t}\n\n\t\telement.Tabs = self;\n\t};\n\n\t// Initialize Tab\n\tvar elements = element.querySelectorAll('[data-toggle=\"tab\"]');\n\tfor (var i = 0; i < elements.length; i++) {\n\t\tnew Tab(elements[i]);\n\t}\n};\n"],"sourceRoot":""}