{
  "version": 3,
  "sources": ["/cdn/shop/t/4/assets/header.js?cb=1795031951731"],
  "sourcesContent": ["import { Component } from '@theme/component';\nimport { onDocumentLoaded, changeMetaThemeColor, setHeaderMenuStyle } from '@theme/utilities';\nimport {\n  getScrollTop,\n  getScrollEventTarget,\n  getIntersectionRoot,\n  scrollContainerMediaQuery,\n} from '@theme/scroll-container';\n\n/**\n * @typedef {Object} HeaderComponentRefs\n * @property {HTMLDivElement} headerDrawerContainer - The header drawer container element\n * @property {HTMLElement} headerMenu - The header menu element\n * @property {HTMLElement} headerRowTop - The header top row element\n */\n\n/**\n * @typedef {CustomEvent<{ minimumReached: boolean }>} OverflowMinimumEvent\n */\n\n/**\n * A custom element that manages the site header.\n *\n * @extends {Component<HeaderComponentRefs>}\n */\n\nclass HeaderComponent extends Component {\n  requiredRefs = ['headerDrawerContainer', 'headerMenu', 'headerRowTop'];\n\n  /**\n   * Width of window when header drawer was hidden\n   * @type {number | null}\n   */\n  #menuDrawerHiddenWidth = null;\n\n  /**\n   * An intersection observer for monitoring sticky header position\n   * @type {IntersectionObserver | null}\n   */\n  #intersectionObserver = null;\n\n  /** @type {EventTarget | null} */\n  #scrollContainer = null;\n\n  /**\n   * Whether the header has been scrolled offscreen, when sticky behavior is 'scroll-up'\n   * @type {boolean}\n   */\n  #offscreen = false;\n\n  /**\n   * The last recorded scrollTop of the document, when sticky behavior is 'scroll-up\n   * @type {number}\n   */\n  #lastScrollTop = 0;\n\n  /**\n   * A timeout to allow for hiding animation, when sticky behavior is 'scroll-up'\n   * @type {number | null}\n   */\n  #timeout = null;\n\n  /**\n   * RAF ID for scroll handler throttling\n   * @type {number | null}\n   */\n  #scrollRafId = null;\n\n  /**\n   * Keeps the global `--header-height` custom property up to date,\n   * which other theme components can then consume\n   */\n  #resizeObserver = new ResizeObserver(([entry]) => {\n    if (!entry || !entry.borderBoxSize[0]) return;\n\n    // The initial height is calculated using the .offsetHeight property, which returns an integer.\n    // We round to the nearest integer to avoid unnecessaary reflows.\n    const roundedHeaderHeight = Math.round(entry.borderBoxSize[0].blockSize);\n    document.body.style.setProperty('--header-height', `${roundedHeaderHeight}px`);\n\n    // Check if the menu drawer should be hidden in favor of the header menu\n    if (this.#menuDrawerHiddenWidth && window.innerWidth > this.#menuDrawerHiddenWidth) {\n      this.#updateMenuVisibility(false);\n    }\n  });\n\n  /**\n   * Observes the header while scrolling the viewport to track when its actively sticky\n   * @param {Boolean} alwaysSticky - Determines if we need to observe when the header is offscreen\n   */\n  #observeStickyPosition = (alwaysSticky = true) => {\n    if (this.#intersectionObserver) return;\n\n    const config = {\n      threshold: alwaysSticky ? 1 : 0,\n      root: getIntersectionRoot(),\n    };\n\n    this.#intersectionObserver = new IntersectionObserver(([entry]) => {\n      if (!entry) return;\n\n      const { isIntersecting } = entry;\n\n      if (alwaysSticky) {\n        this.dataset.stickyState = isIntersecting ? 'inactive' : 'active';\n        if (this.dataset.themeColor) changeMetaThemeColor(this.dataset.themeColor);\n      } else {\n        this.#offscreen = !isIntersecting || this.dataset.stickyState === 'active';\n      }\n    }, config);\n\n    this.#intersectionObserver.observe(this);\n  };\n\n  /**\n   * Handles the overflow minimum event from the header menu\n   * @param {OverflowMinimumEvent} event\n   */\n  #handleOverflowMinimum = (event) => {\n    this.#updateMenuVisibility(event.detail.minimumReached);\n  };\n\n  /**\n   * Updates the visibility of the menu and drawer\n   * @param {boolean} hideMenu - Whether to hide the menu and show the drawer\n   */\n  #updateMenuVisibility(hideMenu) {\n    if (hideMenu) {\n      this.#menuDrawerHiddenWidth = window.innerWidth;\n    } else {\n      this.#menuDrawerHiddenWidth = null;\n      // The drawer squeeze can trigger minimum-reached at desktop widths where\n      // it normally wouldn't. Once the menu hides, the overflow-list is\n      // display:none and can't measure to clear it. Resetting it here so\n      // setHeaderMenuStyle() sees a clean state.\n      const overflowList = this.querySelector('overflow-list');\n      if (overflowList) overflowList.removeAttribute('minimum-reached');\n    }\n    setHeaderMenuStyle();\n  }\n\n  /**\n   * Rebinds the scroll listener and IntersectionObserver when the viewport\n   * crosses the squeeze breakpoint (990px). The scroll container switches\n   * between `.page-wrapper` (desktop) and `document.scrollingElement` (mobile),\n   * so cached bindings from initialization become stale after a resize.\n   */\n  #handleBreakpointChange = () => {\n    const stickyMode = this.getAttribute('sticky');\n    if (!stickyMode) return;\n\n    // Rebind scroll listener\n    if (this.#scrollContainer) {\n      this.#scrollContainer.removeEventListener('scroll', this.#handleWindowScroll);\n      this.#scrollContainer = getScrollEventTarget();\n      this.#scrollContainer.addEventListener('scroll', this.#handleWindowScroll);\n    }\n\n    // Recreate IntersectionObserver with the new root\n    this.#intersectionObserver?.disconnect();\n    this.#intersectionObserver = null;\n    this.#observeStickyPosition(stickyMode === 'always');\n  };\n\n  #handleWindowScroll = () => {\n    if (this.#scrollRafId !== null) return;\n\n    this.#scrollRafId = requestAnimationFrame(() => {\n      this.#scrollRafId = null;\n      this.#updateScrollState();\n    });\n  };\n\n  #updateScrollState = () => {\n    const stickyMode = this.getAttribute('sticky');\n    if (!this.#offscreen && stickyMode !== 'always') return;\n\n    const scrollTop = getScrollTop();\n    const headerTop = this.getBoundingClientRect().top;\n    const isScrollingUp = scrollTop < this.#lastScrollTop;\n    const isAtTop = headerTop >= 0;\n\n    if (this.#timeout) {\n      clearTimeout(this.#timeout);\n      this.#timeout = null;\n    }\n\n    if (stickyMode === 'always') {\n      if (isAtTop) {\n        this.dataset.scrollDirection = 'none';\n      } else if (isScrollingUp) {\n        this.dataset.scrollDirection = 'up';\n      } else {\n        this.dataset.scrollDirection = 'down';\n      }\n\n      this.#lastScrollTop = scrollTop;\n      return;\n    }\n\n    if (isScrollingUp) {\n      if (isAtTop) {\n        // reset sticky state when header is scrolled up to natural position\n        this.#offscreen = false;\n        this.dataset.stickyState = 'inactive';\n        this.dataset.scrollDirection = 'none';\n      } else {\n        // show sticky header when scrolling up\n        this.dataset.stickyState = 'active';\n        this.dataset.scrollDirection = 'up';\n      }\n    } else if (this.dataset.stickyState === 'active') {\n      this.dataset.scrollDirection = 'none';\n\n      this.dataset.stickyState = 'idle';\n    } else {\n      this.dataset.scrollDirection = 'none';\n      this.dataset.stickyState = 'idle';\n    }\n\n    this.#lastScrollTop = scrollTop;\n  };\n\n  connectedCallback() {\n    super.connectedCallback();\n    this.#resizeObserver.observe(this);\n    this.addEventListener('overflowMinimum', this.#handleOverflowMinimum);\n\n    const stickyMode = this.getAttribute('sticky');\n    if (stickyMode) {\n      this.#observeStickyPosition(stickyMode === 'always');\n\n      if (stickyMode === 'scroll-up' || stickyMode === 'always') {\n        this.#scrollContainer = getScrollEventTarget();\n        this.#scrollContainer.addEventListener('scroll', this.#handleWindowScroll);\n      }\n\n      scrollContainerMediaQuery.addEventListener('change', this.#handleBreakpointChange);\n    }\n  }\n\n  disconnectedCallback() {\n    super.disconnectedCallback();\n    this.#resizeObserver.disconnect();\n    this.#intersectionObserver?.disconnect();\n    this.removeEventListener('overflowMinimum', this.#handleOverflowMinimum);\n    scrollContainerMediaQuery.removeEventListener('change', this.#handleBreakpointChange);\n    this.#scrollContainer?.removeEventListener('scroll', this.#handleWindowScroll);\n    this.#scrollContainer = null;\n    if (this.#scrollRafId !== null) {\n      cancelAnimationFrame(this.#scrollRafId);\n      this.#scrollRafId = null;\n    }\n    document.body.style.setProperty('--header-height', '0px');\n  }\n}\n\nif (!customElements.get('header-component')) {\n  customElements.define('header-component', HeaderComponent);\n}\n\n// Anchor the shopify-account dialog to the bottom of the account button itself.\ndocument.addEventListener(\n  'open',\n  (event) => {\n    const { target } = event;\n    if (!(target instanceof HTMLElement) || !target.matches('shopify-account')) return;\n\n    const bottom = Math.max(0, Math.round(target.getBoundingClientRect().bottom));\n    target.style.setProperty('--account-dialog-top', `${bottom}px`);\n  },\n  true\n);\n\nonDocumentLoaded(() => {\n  const header = document.querySelector('header-component');\n  const headerGroup = document.querySelector('#header-group');\n\n  // Note: Initial header heights are set via inline script in theme.liquid\n  // This ResizeObserver handles dynamic updates after page load\n\n  // Update header group height on resize of any child\n  if (headerGroup) {\n    const resizeObserver = new ResizeObserver((entries) => {\n      const headerGroupHeight = entries.reduce((totalHeight, entry) => {\n        if (\n          entry.target !== header ||\n          (header.hasAttribute('transparent') && header.parentElement?.nextElementSibling)\n        ) {\n          return totalHeight + (entry.borderBoxSize[0]?.blockSize ?? 0);\n        }\n        return totalHeight;\n      }, 0);\n      // The initial height is calculated using the .offsetHeight property, which returns an integer.\n      // We round to the nearest integer to avoid unnecessaary reflows.\n      const roundedHeaderGroupHeight = Math.round(headerGroupHeight);\n      document.body.style.setProperty('--header-group-height', `${roundedHeaderGroupHeight}px`);\n    });\n\n    if (header instanceof HTMLElement) {\n      resizeObserver.observe(header);\n    }\n\n    // Observe all children of the header group\n    const children = headerGroup.children;\n    for (let i = 0; i < children.length; i++) {\n      const element = children[i];\n      if (element instanceof HTMLElement) {\n        resizeObserver.observe(element);\n      }\n    }\n\n    // Also observe the header group itself for child changes\n    const mutationObserver = new MutationObserver((mutations) => {\n      for (const mutation of mutations) {\n        if (mutation.type === 'childList') {\n          // Re-observe all children when the list changes\n          const children = headerGroup.children;\n          for (let i = 0; i < children.length; i++) {\n            const element = children[i];\n            if (element instanceof HTMLElement) {\n              resizeObserver.observe(element);\n            }\n          }\n        }\n      }\n    });\n\n    mutationObserver.observe(headerGroup, { childList: true });\n  }\n});\n"],
  "mappings": "AAAA,OAAS,cAAiB,mBAC1B,OAAS,iBAAkB,qBAAsB,uBAA0B,mBAC3E,OACE,aACA,qBACA,oBACA,8BACK,0BAmBP,MAAM,wBAAwB,SAAU,CACtC,aAAe,CAAC,wBAAyB,aAAc,cAAc,EAMrE,uBAAyB,KAMzB,sBAAwB,KAGxB,iBAAmB,KAMnB,WAAa,GAMb,eAAiB,EAMjB,SAAW,KAMX,aAAe,KAMf,gBAAkB,IAAI,eAAe,CAAC,CAAC,KAAK,IAAM,CAChD,GAAI,CAAC,OAAS,CAAC,MAAM,cAAc,CAAC,EAAG,OAIvC,MAAM,oBAAsB,KAAK,MAAM,MAAM,cAA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