{"version":3,"sources":["../../node_modules/js-tools/viewport.js","plugins/prevent-scroll.js","header.js"],"names":["Viewport","breakpoints","this","mediaQuery","breakpoint","type","size","matchMedia","window","matches","customMediaQuery","customMatchMedia","customMatches","resize","callback","windowResizing","addEventListener","clearTimeout","setTimeout","preventScroll","active","on","htmlEl","document","querySelector","bodyScrollTop","body","scrollTop","htmlScrollTop","currentPosition","style","position","currentOverflow","overflowY","currentWidth","width","top","off","classList","add","parseInt","remove","Header","_this","viewport","AndrewMartin","outerWrapper","notice","headerMarker","header","headerTop","headerNavContainer","headerBackground","headerNav","headerNavList","headerNavItems","headerNavItem","querySelectorAll","headerNavButton","headerNavToggle","heights","init","watchNavClick","watchBackgroundClick","watchPageScroll","watchNavToggle","watchPageResize","addClearHeader","forEach","item","parentNode","e","preventDefault","target","dataset","url","open","isNavItemActive","deactivateNavItem","activateNavItem","activeNavItem","deactivateNav","activateNav","bind","checkPageScroll","toggleNav","setNavheight","resetNavheight","addListener","isNavActive","contains","clientHeight","atTop","deactivateFixed","activateFixed","offset","getComputedStyle","getPropertyValue","getBoundingClientRect","removeClearHeader","height","pageYOffset","el","search","isSearchActive","deactivateSearch","navActivation","setAttribute","resizedFromNav","navDeactivation","innerHeight","mobile","navItemActivation","navItem","button","navItemDeactivation","removeAttribute","timeout","small","large","navIsLink","calculateNavToggleTop","positionNavToggle","toggleBounds","toggleTop"],"mappings":"AAAA,SAAAA,SAAAC,GAGAC,KAAAD,YAAAA,EAGAC,KAAAC,WAAA,SAAAC,GACA,MAAA,IAAAF,KAAAD,YAAAG,GAAAC,KAAA,KAAAH,KAAAD,YAAAG,GAAAE,KAAA,KACA,EAGAJ,KAAAK,WAAA,SAAAH,GACA,OAAAI,OAAAD,WAAAL,KAAAC,WAAAC,GACA,EAGAF,KAAAO,QAAA,SAAAL,GACA,OAAAI,OAAAD,WAAAL,KAAAC,WAAAC,IAAAK,OACA,EAGAP,KAAAQ,iBAAA,SAAAN,GACA,OAAAA,CACA,EAGAF,KAA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A7B,MAAAM,IAAA,MAEAO,EAAAU,UAAAf,UAAAG,OAAA,wBACA,mBAAA3B,GACAA,GAEA,EAAAuG,EAAA,GACA,EAAAA,EAAA,GACA,EAAAA,EAAA,GACA,EAEAnH,KAAAuH,sBAAA,WACA,IAAAE,EAAAhF,EAAAgB,gBAAAuC,wBACAvD,EAAAiF,UAAAD,EAAAvF,IAAAuF,EAAAvB,OAAA,EAAA,IACA,EAEAlG,KAAAwH,kBAAA,WACA/E,EAAAgB,gBAAA7B,MAAAM,IAAAO,EAAAiF,SACA,CACA,CAEA/E,aAAAI,OAAA,IAAAP,OAEAG,aAAAI,OAAAY","file":"../../javascript/header.js","sourcesContent":["function Viewport(breakpoints) {\n\n    // Get the breakpoint config\n    this.breakpoints = breakpoints;\n\n    // Constuct the breakpoint for the media query\n    this.mediaQuery = function(breakpoint) {\n        return '(' + this.breakpoints[breakpoint].type + ': ' + this.breakpoints[breakpoint].size + 'px)';\n    }\n\n    // Check if the media query matches\n    this.matchMedia = function(breakpoint) {\n        return window.matchMedia(this.mediaQuery(breakpoint));\n    }\n\n    // Check if the media query matches\n    this.matches = function(breakpoint) {\n        return window.matchMedia(this.mediaQuery(breakpoint)).matches;\n    }\n\n    // Construct the custom media query\n    this.customMediaQuery = function(breakpoint) {\n        return breakpoint;\n    }\n\n    // Check if the custom media query matches\n    this.customMatchMedia = function(breakpoint) {\n        return window.matchMedia(this.customMediaQuery(breakpoint));\n    }\n\n    // Check if the custom media query matches\n    this.customMatches = function(breakpoint) {\n        return window.matchMedia(this.customMediaQuery(breakpoint)).matches;\n    }\n\n    // Watch for viewport resize\n    this.resize = function(callback) {\n        var windowResizing;\n\n        window.addEventListener('resize', function() {\n            clearTimeout(windowResizing);\n            windowResizing = setTimeout(function() {\n                if (typeof callback == 'function') {\n                    callback();\n                }\n            }, 100);\n        });\n    }\n}\n","var preventScroll = {\n    active: false,\n    on: function() {\n        var htmlEl = document.querySelector('html');\n        var body = document.body;\n\n        // Determine the `scrollTop` to use. Some browsers require checking the\n        // `body`, others use `html`.\n        var bodyScrollTop = body.scrollTop;\n        var htmlScrollTop = htmlEl.scrollTop;\n        var scrollTop = bodyScrollTop ? bodyScrollTop : htmlScrollTop;\n\n        // Store the current value of the htmlEl's styles – we're about to override\n        // them.\n        this.currentPosition = htmlEl.style.position;\n        this.currentOverflow = htmlEl.style.overflowY;\n        this.currentWidth = htmlEl.style.width;\n\n        // Fixing the position of the `htmlEl` prevents the page from scrolling\n        // at all.\n        htmlEl.style.position = 'fixed';\n        // Setting `overflowY` to `scroll` ensures that any scrollbars that are\n        // around stick around. Otherwise, there would be a \"jump\" when the page\n        // becomes unscrollable as the bar would vanish.\n        htmlEl.style.overflowY = 'scroll';\n        // This makes sure that the page doesn't collapse (usually your CSS will\n        // prevent this, but it's best to be safe)\n        htmlEl.style.width = '100%';\n        // Scoot down the `htmlEl` to be in the same place that the user had\n        // scrolled to.\n        htmlEl.style.top = (0 - scrollTop) + 'px';\n\n        // Set active state\n        this.active = true;\n    },\n\n    off: function() {\n        var htmlEl = document.querySelector('html');\n        var body = document.body;\n\n        // Reset `htmlEl` to the original styles.\n        htmlEl.style.position = this.currentPosition;\n        htmlEl.style.overflowY = this.currentOverflow;\n        htmlEl.style.width = this.currentWidth;\n\n        // Retrieve our original scrollTop from the htmlEl's top\n\n        htmlEl.classList.add('no-smooth-scroll');\n\n        var scrollTop = -parseInt(htmlEl.style.top);\n        // Return us to the original scroll position. Once again, we set this on\n        // both the `body` and the `htmlEl` to be safe.\n        htmlEl.scrollTop = scrollTop;\n        body.scrollTop = scrollTop;\n\n        htmlEl.classList.remove('no-smooth-scroll');\n\n        // Unset active state\n        this.active = false;\n    }\n}\n","function Viewport(breakpoints) {\n\n    // Get the breakpoint config\n    this.breakpoints = breakpoints;\n\n    // Constuct the breakpoint for the media query\n    this.mediaQuery = function(breakpoint) {\n        return '(' + this.breakpoints[breakpoint].type + ': ' + this.breakpoints[breakpoint].size + 'px)';\n    }\n\n    // Check if the media query matches\n    this.matchMedia = function(breakpoint) {\n        return window.matchMedia(this.mediaQuery(breakpoint));\n    }\n\n    // Check if the media query matches\n    this.matches = function(breakpoint) {\n        return window.matchMedia(this.mediaQuery(breakpoint)).matches;\n    }\n\n    // Construct the custom media query\n    this.customMediaQuery = function(breakpoint) {\n        return breakpoint;\n    }\n\n    // Check if the custom media query matches\n    this.customMatchMedia = function(breakpoint) {\n        return window.matchMedia(this.customMediaQuery(breakpoint));\n    }\n\n    // Check if the custom media query matches\n    this.customMatches = function(breakpoint) {\n        return window.matchMedia(this.customMediaQuery(breakpoint)).matches;\n    }\n\n    // Watch for viewport resize\n    this.resize = function(callback) {\n        var windowResizing;\n\n        window.addEventListener('resize', function() {\n            clearTimeout(windowResizing);\n            windowResizing = setTimeout(function() {\n                if (typeof callback == 'function') {\n                    callback();\n                }\n            }, 100);\n        });\n    }\n}\n\nvar preventScroll = {\n    active: false,\n    on: function() {\n        var htmlEl = document.querySelector('html');\n        var body = document.body;\n\n        // Determine the `scrollTop` to use. Some browsers require checking the\n        // `body`, others use `html`.\n        var bodyScrollTop = body.scrollTop;\n        var htmlScrollTop = htmlEl.scrollTop;\n        var scrollTop = bodyScrollTop ? bodyScrollTop : htmlScrollTop;\n\n        // Store the current value of the htmlEl's styles – we're about to override\n        // them.\n        this.currentPosition = htmlEl.style.position;\n        this.currentOverflow = htmlEl.style.overflowY;\n        this.currentWidth = htmlEl.style.width;\n\n        // Fixing the position of the `htmlEl` prevents the page from scrolling\n        // at all.\n        htmlEl.style.position = 'fixed';\n        // Setting `overflowY` to `scroll` ensures that any scrollbars that are\n        // around stick around. Otherwise, there would be a \"jump\" when the page\n        // becomes unscrollable as the bar would vanish.\n        htmlEl.style.overflowY = 'scroll';\n        // This makes sure that the page doesn't collapse (usually your CSS will\n        // prevent this, but it's best to be safe)\n        htmlEl.style.width = '100%';\n        // Scoot down the `htmlEl` to be in the same place that the user had\n        // scrolled to.\n        htmlEl.style.top = (0 - scrollTop) + 'px';\n\n        // Set active state\n        this.active = true;\n    },\n\n    off: function() {\n        var htmlEl = document.querySelector('html');\n        var body = document.body;\n\n        // Reset `htmlEl` to the original styles.\n        htmlEl.style.position = this.currentPosition;\n        htmlEl.style.overflowY = this.currentOverflow;\n        htmlEl.style.width = this.currentWidth;\n\n        // Retrieve our original scrollTop from the htmlEl's top\n\n        htmlEl.classList.add('no-smooth-scroll');\n\n        var scrollTop = -parseInt(htmlEl.style.top);\n        // Return us to the original scroll position. Once again, we set this on\n        // both the `body` and the `htmlEl` to be safe.\n        htmlEl.scrollTop = scrollTop;\n        body.scrollTop = scrollTop;\n\n        htmlEl.classList.remove('no-smooth-scroll');\n\n        // Unset active state\n        this.active = false;\n    }\n}\n\n\nfunction Header() {\n    \n    let viewport = new Viewport(AndrewMartin.breakpoints);\n\n    this.outerWrapper = document.querySelector('.outer-wrapper');\n    this.notice = document.querySelector('.js-notice');\n    this.headerMarker = document.querySelector('.js-header-marker');\n    this.header = document.querySelector('.js-header');\n    this.headerTop = document.querySelector('.js-header__top');\n    this.headerNavContainer = document.querySelector('.js-header__nav');\n    this.headerBackground = document.querySelector('.js-header-background');\n    this.headerNav = document.querySelector('.js-header-nav');\n    this.headerNavList = document.querySelector('.js-nav-list');\n    this.headerNavItems = document.querySelector('.js-header-nav__items');\n    this.headerNavItem = document.querySelectorAll('.js-header-nav__item');\n    this.headerNavButton = document.querySelectorAll('.js-header-nav__button');\n    this.headerNavToggle = document.querySelector('.js-header-nav__toggle');\n\n    this.heights = {};\n\n    this.init = () => {\n        if (!this.header) {\n            return;\n        }\n        this.watchNavClick();\n        this.watchBackgroundClick();\n        this.watchPageScroll();\n        this.watchNavToggle();\n        this.watchPageResize();\n        this.addClearHeader();\n    }\n\n    // Watch the navigation for click events\n    this.watchNavClick = () => {\n        this.headerNavButton.forEach((headerNavButton) => {\n            let item = headerNavButton.parentNode;\n\n            headerNavButton.addEventListener('click', (e) => {\n                e.preventDefault();\n                if (e.target.parentNode.dataset.url) {\n                    window.open(e.target.parentNode.dataset.url, '_self');\n                    return;\n                };\n                if (viewport.matches('nav')) {\n                    if (this.isNavItemActive(item)) {\n                        this.deactivateNavItem(true);\n                    } else {\n                        this.activateNavItem(item, true);\n                    }\n                } else {\n                    if (this.activeNavItem()) {\n                        if (this.isNavItemActive(item)) {\n                            this.deactivateNavItem();\n                            this.deactivateNav();\n                        } else {\n                            this.deactivateNavItem();\n                            this.activateNavItem(item);\n                            this.activateNav();\n                        }\n                    } else {\n                        this.activateNavItem(item);\n                        this.activateNav();\n                    }\n                }\n            });\n        });\n    }\n\n    // Watch the background for click events\n    this.watchBackgroundClick = () => {\n        this.headerBackground.addEventListener('click', this.deactivateNav.bind(this));\n    }\n\n    // Watch the page for scroll events\n    this.watchPageScroll = () => {\n        this.checkPageScroll();\n        document.addEventListener('scroll', this.checkPageScroll.bind(this));\n    }\n\n    // Watch the navigation toggle for click events\n    this.watchNavToggle = () => {\n        this.headerNavToggle.addEventListener('click', this.toggleNav.bind(this));\n    }\n\n    // Watch the page for resize events\n    this.watchPageResize = () => {\n        viewport.resize(() => {\n            if (viewport.matches('nav')) {\n                this.setNavheight();\n            } else {\n                this.resetNavheight();\n            }\n        })\n\n        viewport.matchMedia('nav').addListener((e) => {\n            if (!e.matches) {\n                if (this.isNavActive()) {\n                    this.deactivateNav(true);\n                }\n            }\n        });\n    }\n\n    // Check how far the page has scrolled to determine whether or not to show the clear header (desktop only)\n    this.checkPageScroll = () => {\n\n        if (!this.header.classList.contains('header--fixed')) {\n            if (this.header.clientHeight != 0) {\n                this.heights.header = this.header.clientHeight;\n            }\n            if (this.headerTop.clientHeight != 0) {\n                this.heights.headerTop = this.headerTop.clientHeight;\n            }\n            if (this.headerNavContainer.clientHeight != 0) {\n                this.heights.headerNavContainer = this.headerNavContainer.clientHeight;\n            }\n        }\n\n        if (this.atTop()) {\n            this.deactivateFixed();\n        } else {\n            this.activateFixed();\n        }\n    }\n\n    // Is the page scrolled to the top\n    this.atTop = () => {\n        var offset = parseInt(window.getComputedStyle(this.outerWrapper, null).getPropertyValue('padding-top'));\n        if (viewport.matches('nav')) {\n            return this.headerMarker.getBoundingClientRect().top >= offset;\n        } else {\n            if (this.headerMarker.clientHeight == this.heights.headerNavContainer) {\n                return this.headerMarker.getBoundingClientRect().top >= offset;\n            } else {\n                return this.headerMarker.getBoundingClientRect().top + this.heights.headerTop >= offset;\n            }\n        }\n    }\n\n    // Activate the fixed header\n    this.activateFixed = () => {\n        this.header.classList.add('header--fixed');\n        this.headerNavList.classList.add('header-nav__list--fixed');\n\n        this.removeClearHeader();\n    }\n\n    // Deactivate the fixed header\n    this.deactivateFixed = () => {\n        this.header.classList.remove('header--fixed');\n        this.headerNavList.classList.remove('header-nav__list--fixed');\n        this.headerMarker.classList.remove('header-marker__height--active');\n        this.addClearHeader();\n\n        if (!viewport.matches('nav')) {\n            this.headerMarker.style.top = this.heights.headerTop + 'px';\n            this.headerMarker.style.height = this.heights.headerNavContainer + 'px';\n        } else {\n            this.headerMarker.style.top = 0;\n            this.headerMarker.style.height = this.heights.headerTop + 'px';\n        }\n    }\n\n    this.addClearHeader = function() {\n        if (!this.header.classList.contains('header--plain')) {\n            if (window.pageYOffset == 0 && !document.querySelector('.header--clear')) {\n                this.header.classList.add('header--clear');\n            }\n        }\n    }\n\n     // Remove the 'clear' styles from the header\n     this.removeClearHeader = function() {\n        if (!this.header.classList.contains('header--plain')) {\n            this.header.classList.remove('header--clear');\n        }\n    }\n\n    // Is the nav active?\n    this.isNavActive = () => {\n        return this.headerNav.classList.contains('header-nav--active-a');\n    }\n\n    // Is the nav item active?\n    this.isNavItemActive = (el) => {\n        return el.classList.contains('header-nav__item--active-a');\n    }\n\n    // Toggle the nav\n    this.toggleNav = () => {\n        if (this.isNavActive()) {\n            this.deactivateNav();\n        } else {\n            if (AndrewMartin.search.isSearchActive()) {\n                AndrewMartin.search.deactivateSearch();\n            }\n            this.activateNav();\n        }\n    }\n\n    // Activate the nav\n    this.activateNav = () => {\n        this.navActivation(() => {\n            if (viewport.matches('nav')) {\n                this.headerNavToggle.setAttribute('aria-expanded', true);\n                this.setNavheight();\n                if (!preventScroll.active) {\n                    preventScroll.on();\n                }\n            }\n        });\n    }\n\n    // Deactivate the nav\n    this.deactivateNav = (resizedFromNav) => {\n        this.navDeactivation(() => {\n            if (viewport.matches('nav') || resizedFromNav) {\n                this.headerNavToggle.setAttribute('aria-expanded', false);\n                this.resetNavheight();\n                this.deactivateNavItem(true);\n                preventScroll.off();\n            }\n        });\n    }\n\n    // Set the bottom of the nav and background to site flush with the bottom bar\n    this.setNavheight = () => {\n        this.headerNavItems.style.height = window.innerHeight + 'px';\n    }\n\n    // Reset the bottom styles of the nav and background\n    this.resetNavheight = () => {\n        this.headerNavItems.style.height = null;\n    }\n\n    // Get the active nav item\n    this.activeNavItem = () => {\n        return document.querySelector('.header-nav__item--active-a');\n    }\n\n    // Activate the nav item\n    this.activateNavItem = (el, mobile) => {\n        this.navItemActivation(el, () => {\n            if (mobile) {\n                this.headerNavItems.dataset.navItem = el.dataset.navItem;\n                // this.headerNavItems.scrollTop = 0;\n            }\n        });\n\n        let button = el.querySelector('.js-header-nav__button');\n\n        if (button) {\n            button.setAttribute('aria-expanded', false);\n        }\n    }\n\n    // Deactivate the nav item\n    this.deactivateNavItem = (mobile) => {\n        let el = this.activeNavItem();\n\n        if (el) {\n            this.navItemDeactivation(el, () => {\n                if (mobile) {\n                    this.headerNavItems.removeAttribute('data-nav-item');\n                }\n            });\n\n            let button = el.querySelector('.js-header-nav__button');\n\n            if (button) {\n                button.setAttribute('aria-expanded', true);\n            }\n        }\n    }\n\n    this.navItemActivation = (el, callback) => {\n        this.header.classList.add('header__nav-item--active');\n        el.classList.add('header-nav__item--active-a');\n        if (typeof callback === 'function') {\n            callback();\n        }\n\n        let timeout = {\n            small: [1, 1, 300],\n            large: [0, 0, 0]\n        }\n\n        timeout = viewport.matches('nav') ? timeout.small : timeout.large;\n\n        setTimeout(() => {\n            setTimeout(() => {\n                el.classList.add('header-nav__item--active-b');\n                setTimeout(() => {\n                    if (el.dataset.navIsLink) {\n                        this.headerNav.setAttribute('data-is-single', true);\n                    } else {\n                        this.headerNav.removeAttribute('data-is-single');\n                    }\n                    el.classList.add('header-nav__item--active-c');\n                }, timeout[2]);\n            }, timeout[1]);\n        }, timeout[0]);\n    }\n\n    this.navItemDeactivation = (el, callback) => {\n        this.header.classList.remove('header__nav-item--active');\n        el.classList.remove('header-nav__item--active-c');\n\n        let timeout = {\n            small: [1, 300, 1],\n            large: [0, 0, 0]\n        }\n\n        timeout = viewport.matches('nav') ? timeout.small : timeout.large;\n\n        setTimeout(() => {\n            el.classList.remove('header-nav__item--active-b');\n            setTimeout(() => {\n                setTimeout(() => {\n                    if (typeof callback === 'function') {\n                        callback();\n                    }\n                    el.classList.remove('header-nav__item--active-a');\n                }, timeout[2]);\n            }, timeout[1]);\n        }, timeout[0]);\n    }\n\n    this.navActivation = (callback) => {\n        if (viewport.matches('nav')) {\n            this.calculateNavToggleTop();\n            this.positionNavToggle();\n        }\n        this.headerNav.classList.add('header-nav--active-a');\n        if (typeof callback === 'function') {\n            callback();\n        }\n\n        let timeout = {\n            small: [1, 1, 300],\n            large: [0, 0, 0]\n        }\n\n        timeout = viewport.matches('nav') ? timeout.small : timeout.large;\n\n        setTimeout(() => {\n\n            setTimeout(() => {\n                this.headerNav.classList.add('header-nav--active-b');\n\n                setTimeout(() => {\n                    if (viewport.matches('nav')) {\n                        this.headerNavToggle.style.top = null;\n                    }\n                    this.headerNav.classList.add('header-nav--active-c');\n\n                    // Set 'a' again - this is needed if moving from one item to another directly\n                    this.headerNav.classList.add('header-nav--active-a');\n                }, timeout[2]);\n            }, timeout[1]);\n        }, timeout[0]);\n    }\n\n    this.navDeactivation = (callback) => {\n        if (viewport.matches('nav')) {\n            this.positionNavToggle();\n        }\n        this.headerNav.classList.remove('header-nav--active-c');\n\n        let timeout = {\n            small: [1, 300, 300],\n            large: [0, 0, 0]\n        }\n\n        timeout = viewport.matches('nav') ? timeout.small : timeout.large;\n\n        setTimeout(() => {\n            this.headerNav.classList.remove('header-nav--active-b');\n            setTimeout(() => {\n                setTimeout(() => {\n                    if (viewport.matches('nav')) {\n                        this.headerNavToggle.style.top = null;\n                    }\n                    this.headerNav.classList.remove('header-nav--active-a');\n                    if (typeof callback === 'function') {\n                        callback();\n                    }\n                }, timeout[2]);\n            }, timeout[1]);\n        }, timeout[0]);\n    }\n\n    this.calculateNavToggleTop = () => {\n        let toggleBounds = this.headerNavToggle.getBoundingClientRect();\n        this.toggleTop = (toggleBounds.top + (toggleBounds.height / 2)) + 'px';\n    }\n\n    this.positionNavToggle = () => {\n        this.headerNavToggle.style.top = this.toggleTop;\n    }\n}\n\nAndrewMartin.header = new Header();\n\nAndrewMartin.header.init();\n"],"sourceRoot":"../../../../resources/javascript"}