{
  "version": 3,
  "sources": ["/cdn/shop/t/444/assets/tabs.js?cachebuster=iY0wVVS993zT"],
  "sourcesContent": ["if (!customElements.get('tabbed-content')) {\n  class Tabs extends HTMLElement {\n    constructor() {\n      super();\n      this.tabList = this.querySelector('[role=\"tablist\"]');\n      this.activeTab = this.tabList.querySelector('[aria-selected=\"true\"]');\n      this.isVerticalTablist = this.tabList.getAttribute('aria-orientation') === 'vertical';\n      this.tabs = this.querySelectorAll('[role=\"tab\"]');\n      this.panels = this.querySelectorAll('[role=\"tabpanel\"]');\n\n      // If no tab is active by default, activate the first tab.\n      if (!this.activeTab) {\n        this.activeTab = this.tabs[0];\n        this.activateTab(this.activeTab);\n      }\n\n      this.addListeners();\n    }\n\n    addListeners() {\n      this.tabList.addEventListener('click', this.handleClick.bind(this));\n      this.tabList.addEventListener('keydown', this.handleKeydown.bind(this));\n    }\n\n    /**\n     * Handles 'click' events on the tablist.\n     * @param {object} evt - Event object.\n     */\n    handleClick(evt) {\n      if (!evt.target.matches('[role=\"tab\"]') || evt.target === this.activeTab) return;\n      this.activateTab(evt.target);\n    }\n\n    /**\n     * Handles 'keydown' events on the tablist.\n     * @param {object} evt - Event object.\n     */\n    handleKeydown(evt) {\n      switch (evt.key) {\n        case 'ArrowLeft':\n        case 'ArrowRight':\n          evt.preventDefault();\n          if (!this.isVerticalTablist) {\n            this.switchTabOnKeyPress(evt.key);\n          }\n          break;\n\n        case 'ArrowUp':\n        case 'ArrowDown':\n          evt.preventDefault();\n          if (this.isVerticalTablist) {\n            this.switchTabOnKeyPress(evt.key);\n          }\n          break;\n\n        // Activate the first tab.\n        case 'Home':\n          evt.preventDefault();\n          this.activateTab(this.tabs[0]);\n          break;\n\n        // Activate the last tab.\n        case 'End':\n          evt.preventDefault();\n          this.activateTab(this.tabs[this.tabs.length - 1]);\n          break;\n      }\n    }\n\n    /**\n     * Activates the next or previous tab according to the key pressed.\n     * @param {string} key - Key pressed.\n     */\n    switchTabOnKeyPress(key) {\n      if (key === 'ArrowRight' || key === 'ArrowDown') {\n        // If active tab is the last tab.\n        if (this.activeTab === this.tabs[this.tabs.length - 1]) {\n          // Activate first tab.\n          this.activateTab(this.tabs[0]);\n        } else {\n          // Activate next tab.\n          this.activateTab(this.activeTab.nextElementSibling);\n        }\n      } else if (key === 'ArrowLeft' || key === 'ArrowUp') {\n        // If active tab is the first tab.\n        if (this.activeTab === this.tabs[0]) {\n          this.activateTab(this.tabs[this.tabs.length - 1]);\n        } else {\n          // Activate the previous tab.\n          this.activateTab(this.activeTab.previousElementSibling);\n        }\n      }\n    }\n\n    /**\n     * Activates a tab.\n     * @param {Element} tab - Tab element (button).\n     */\n    activateTab(tab) {\n      this.deactivateActiveTab();\n\n      Tabs.setTabState(tab, true);\n      tab.removeAttribute('tabindex');\n      this.activeTab = tab;\n\n      if (document.activeElement.matches('.tablist__tab')) {\n        tab.focus();\n      }\n    }\n\n    /**\n     * Deactivates the currently active tab.\n     */\n    deactivateActiveTab() {\n      Tabs.setTabState(this.activeTab, false);\n      this.activeTab.setAttribute('tabindex', '-1');\n      this.activeTab = null;\n    }\n\n    /**\n     * Sets the active state of a tab and associated content panel.\n     * @param {Element} tab - Tab element (button).\n     * @param {boolean} active - Set the tab as active.\n     */\n    static setTabState(tab, active) {\n      tab.setAttribute('aria-selected', active);\n\n      const panelId = tab.getAttribute('aria-controls');\n      document.getElementById(panelId).hidden = !active;\n    }\n  }\n\n  customElements.define('tabbed-content', Tabs);\n}\n"],
  "mappings": "AAAA,GAAI,CAAC,eAAe,IAAI,gBAAgB,EAAG,CACzC,MAAM,aAAa,WAAY,CAC7B,aAAc,CACZ,MAAM,EACN,KAAK,QAAU,KAAK,cAAc,kBAAkB,EACpD,KAAK,UAAY,KAAK,QAAQ,cAAc,wBAAwB,EACpE,KAAK,kBAAoB,KAAK,QAAQ,aAAa,kBAAkB,IAAM,WAC3E,KAAK,KAAO,KAAK,iBAAiB,cAAc,EAChD,KAAK,OAAS,KAAK,iBAAiB,mBAAmB,EAG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