{"version":3,"sources":["webpack:///./LeLab.Web/src/js/header-new.entry.js"],"names":["HeaderSubNav","constructor","header","subNav","this","html","document","querySelector","body","navItem","navLink","clickOutsideHandler","clickOutside","bind","toggleHandler","toggle","openHandler","open","closeHandler","close","addEventListener","e","contains","target","isDesktop","classList","stopPropagation","closeAllSubNav","showOverlay","add","hideOverlay","remove","destroy","removeEventListener","PageComponent","node","overlay","button","banner","menu","subNavRegistry","windowWidth","window","innerWidth","toggleMenuHandler","toggleMenu","overlayClickHandler","overlayClick","bannerAnimationEndHandler","bannerAnimationEnd","resizeHandler","resize","querySelectorAll","push","scrollHandler","forEach","x","closeMenu","isMenuOpen","openMenu","isMobile","style","setProperty","title","dataset","labelClose","labelMenu","matchMedia","matches","buttonClickHandler"],"mappings":"4FAAA,kBAmIA,MAAMA,EACFC,YAAYC,EAAQC,GAChBC,KAAKF,OAASA,EACdE,KAAKD,OAASA,EACdC,KAAKC,KAAOC,SAASC,cAAc,QACnCH,KAAKI,KAAOF,SAASC,cAAc,QACnCH,KAAKK,QAAUL,KAAKD,OAAOI,cAAc,iBACzCH,KAAKM,QAAUN,KAAKD,OAAOI,cAAc,sBAEzCH,KAAKO,oBAAsBP,KAAKQ,aAAaC,KAAKT,MAClDA,KAAKU,cAAgBV,KAAKW,OAAOF,KAAKT,MACtCA,KAAKY,YAAcZ,KAAKa,KAAKJ,KAAKT,MAClCA,KAAKc,aAAed,KAAKe,MAAMN,KAAKT,MAEpCA,KAAKC,KAAKe,iBAAiB,QAAShB,KAAKO,qBACzCP,KAAKM,QAAQU,iBAAiB,QAAShB,KAAKU,eAC5CV,KAAKK,QAAQW,iBAAiB,UAAWhB,KAAKY,aAC9CZ,KAAKK,QAAQW,iBAAiB,WAAYhB,KAAKc,cAGnDN,aAAaS,IACJjB,KAAKK,QAAQa,SAASD,EAAEE,SAAWnB,KAAKF,OAAOsB,aAChDpB,KAAKe,QAIbJ,OAAOM,GACCjB,KAAKD,OAAOsB,UAAUH,SAAS,gCAC/B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AKgC,QAAQX,UAAUI,IAAI,yBAG/BC,cACI1B,KAAKgC,QAAQX,UAAUM,OAAO,yBAGlC6B,WACI,OAAQxD,KAAKoB,YAGjBA,YACI,OAAOkB,OAAOyB,WAAW,sBAAsBC,QAGnDnB,qBACI7C,KAAKkC,OAAOb,UAAUM,OAAO,8BAGjCC,UACI5B,KAAKoC,eAAee,QAASC,GAAMA,EAAExB,WAErC5B,KAAKI,KAAKiB,UAAUM,OAAO,kBAAmB,YAC9C3B,KAAKiC,OAAOJ,oBAAoB,QAAS7B,KAAKiE,oBAC9CjE,KAAKgC,QAAQH,oBAAoB,QAAS7B,KAAK0C,qBAC/C1C,KAAKkC,OAAOL,oBAAoB,eAAgB7B,KAAK4C,2BACrDN,OAAOT,oBAAoB,SAAU7B,KAAK8C,sBAEnC9C,KAAKF,cACLE,KAAKgC,eACLhC,KAAKiC,cACLjC,KAAKkC,cACLlC,KAAKmC,YACLnC,KAAKoC,sBACLpC,KAAKqC,mBAELrC,KAAKiE,0BACLjE,KAAK0C,2BACL1C,KAAK4C,iCACL5C,KAAK8C,mB","file":"header-new.js","sourcesContent":["import { PageComponent } from \"barba\";\r\n\r\nclass Header {\r\n constructor({ node }) {\r\n this.header = node;\r\n this.body = document.querySelector(\"body\");\r\n this.overlay = node.querySelector(\".header__overlay\");\r\n this.button = node.querySelector(\".header-button\");\r\n this.banner = node.querySelector(\".header-banner\");\r\n this.menu = node.querySelector(\".nav-mobile\");\r\n this.subNavRegistry = [];\r\n this.windowWidth = window.innerWidth;\r\n\r\n this.toggleMenuHandler = this.toggleMenu.bind(this);\r\n this.overlayClickHandler = this.overlayClick.bind(this);\r\n this.bannerAnimationEndHandler = this.bannerAnimationEnd.bind(this);\r\n this.resizeHandler = this.resize.bind(this);\r\n\r\n for (let subNav of node.querySelectorAll(\"[data-has-subnav]\")) {\r\n this.subNavRegistry.push(new HeaderSubNav(this, subNav));\r\n }\r\n\r\n this.button.addEventListener(\"click\", this.toggleMenuHandler);\r\n this.overlay.addEventListener(\"click\", this.overlayClickHandler);\r\n this.banner.addEventListener(\"animationend\", this.bannerAnimationEndHandler);\r\n window.addEventListener(\"resize\", this.resizeHandler);\r\n window.addEventListener(\"scroll\", this.scrollHandler);\r\n }\r\n\r\n closeAllSubNav() {\r\n this.subNavRegistry.forEach((x) => x.close());\r\n }\r\n\r\n resize() {\r\n if (this.windowWidth === window.innerWidth) {\r\n return;\r\n }\r\n this.windowWidth = window.innerWidth;\r\n this.closeAllSubNav();\r\n this.closeMenu();\r\n this.hideOverlay();\r\n }\r\n\r\n toggleMenu() {\r\n if (this.isMenuOpen()) {\r\n this.closeMenu();\r\n return;\r\n }\r\n this.openMenu();\r\n }\r\n\r\n openMenu() {\r\n if (!this.isMobile()) {\r\n return;\r\n }\r\n\r\n this.body.classList.add(\"overflow-hidden\", \"h-screen\");\r\n\r\n this.header.style.setProperty(\"--header-offset-y\", \"0px\");\r\n\r\n this.button.classList.add(\"header-button--open\");\r\n this.menu.classList.add(\"nav-mobile--open\");\r\n\r\n this.button.title = this.button.dataset.labelClose;\r\n }\r\n\r\n closeMenu() {\r\n if (!this.isMobile()) {\r\n return;\r\n }\r\n\r\n this.body.classList.remove(\"overflow-hidden\", \"h-screen\");\r\n\r\n this.button.classList.remove(\"header-button--open\");\r\n this.menu.classList.remove(\"nav-mobile--open\");\r\n\r\n this.button.title = this.button.dataset.labelMenu;\r\n }\r\n\r\n isMenuOpen() {\r\n return this.menu.classList.contains(\"nav-mobile--open\");\r\n }\r\n\r\n overlayClick() {\r\n this.isDesktop() ? this.closeAllSubNav() : null;\r\n }\r\n\r\n showOverlay() {\r\n this.overlay.classList.add(\"header__overlay--show\");\r\n }\r\n\r\n hideOverlay() {\r\n this.overlay.classList.remove(\"header__overlay--show\");\r\n }\r\n\r\n isMobile() {\r\n return !this.isDesktop();\r\n }\r\n\r\n isDesktop() {\r\n return window.matchMedia(\"(min-width: 992px)\").matches;\r\n }\r\n\r\n bannerAnimationEnd() {\r\n this.banner.classList.remove(\"header-banner--translate-y\");\r\n }\r\n\r\n destroy() {\r\n this.subNavRegistry.forEach((x) => x.destroy());\r\n\r\n this.body.classList.remove(\"overflow-hidden\", \"h-screen\");\r\n this.button.removeEventListener(\"click\", this.buttonClickHandler);\r\n this.overlay.removeEventListener(\"click\", this.overlayClickHandler);\r\n this.banner.removeEventListener(\"animationend\", this.bannerAnimationEndHandler);\r\n window.removeEventListener(\"resize\", this.resizeHandler);\r\n\r\n delete this.header;\r\n delete this.overlay;\r\n delete this.button;\r\n delete this.banner;\r\n delete this.menu;\r\n delete this.subNavRegistry;\r\n delete this.windowWidth;\r\n\r\n delete this.buttonClickHandler;\r\n delete this.overlayClickHandler;\r\n delete this.bannerAnimationEndHandler;\r\n delete this.resizeHandler;\r\n }\r\n}\r\n\r\nclass HeaderSubNav {\r\n constructor(header, subNav) {\r\n this.header = header;\r\n this.subNav = subNav;\r\n this.html = document.querySelector(\"html\");\r\n this.body = document.querySelector(\"body\");\r\n this.navItem = this.subNav.querySelector(\"[data-subnav]\");\r\n this.navLink = this.subNav.querySelector(\"[data-subnav-open]\");\r\n\r\n this.clickOutsideHandler = this.clickOutside.bind(this);\r\n this.toggleHandler = this.toggle.bind(this);\r\n this.openHandler = this.open.bind(this);\r\n this.closeHandler = this.close.bind(this);\r\n\r\n this.html.addEventListener(\"click\", this.clickOutsideHandler);\r\n this.navLink.addEventListener(\"click\", this.toggleHandler);\r\n this.navItem.addEventListener(\"focusin\", this.openHandler);\r\n this.navItem.addEventListener(\"focusout\", this.closeHandler);\r\n }\r\n\r\n clickOutside(e) {\r\n if (!this.navItem.contains(e.target) && this.header.isDesktop()) {\r\n this.close();\r\n }\r\n }\r\n\r\n toggle(e) {\r\n if (this.subNav.classList.contains(\"nav-desktop__main-item--open\")) {\r\n this.close();\r\n return;\r\n }\r\n this.open();\r\n // Prevent execution of \"clickOutside\" method\r\n e.stopPropagation();\r\n }\r\n\r\n open() {\r\n if (this.header.isDesktop()) {\r\n this.header.closeAllSubNav();\r\n this.header.showOverlay();\r\n }\r\n this.body.classList.add(\"overflow-hidden\", \"h-screen\");\r\n this.subNav.classList.add(\"nav-desktop__main-item--open\");\r\n this.navLink.classList.add(\"nav-item-first-level--open\");\r\n }\r\n\r\n close() {\r\n if (this.header.isDesktop()) {\r\n this.header.hideOverlay();\r\n }\r\n this.body.classList.remove(\"overflow-hidden\", \"h-screen\");\r\n this.subNav.classList.remove(\"nav-desktop__main-item--open\");\r\n this.navLink.classList.remove(\"nav-item-first-level--open\");\r\n }\r\n\r\n destroy() {\r\n this.body.classList.remove(\"overflow-hidden\", \"h-screen\");\r\n this.html.removeEventListener(\"click\", this.clickOutsideHandler);\r\n this.navLink.removeEventListener(\"click\", this.toggleHandler);\r\n this.navItem.removeEventListener(\"focusin\", this.openHandler);\r\n this.navItem.removeEventListener(\"focusout\", this.closeHandler);\r\n\r\n delete this.clickOutsideHandler;\r\n delete this.toggleHandler;\r\n delete this.openHandler;\r\n delete this.closeHandler;\r\n\r\n delete this.header;\r\n delete this.subNav;\r\n delete this.html;\r\n delete this.navItem;\r\n delete this.navLink;\r\n }\r\n}\r\n\r\nnew PageComponent(\".header\", Header);\r\n"],"sourceRoot":""}