{
  "version": 3,
  "sources": ["/cdn/shop/t/4/assets/sticky-atc-bar-minimalist.js?mvary=mobile"],
  "sourcesContent": ["if (!customElements.get('sticky-atc-bar-minimalist')) {\n  customElements.define(\n    'sticky-atc-bar-minimalist',\n    class StickyAtcBarMinimalist extends HTMLElement {\n      constructor() {\n        super();\n\n        this.classes = {\n          isOpen: 'sticky-atc-bar--show',\n        };\n\n        this.submitEl.addEventListener('click', this.onClick.bind(this));\n      }\n\n      get submitEl() {\n        return (this._submitEl = this._submitEl || this.querySelector('[type=\"submit\"]'));\n      }\n\n      connectedCallback() {\n        this.productFormActions = document.querySelector('.main-product-form');\n        this.mainProductInfo = document.querySelector('product-info');\n\n        this.init();\n\n        this.cartErrorUnsubscriber = FoxTheme.pubsub.subscribe(FoxTheme.pubsub.PUB_SUB_EVENTS.cartError, () => {\n          this.resetButtonLoading();\n          this.scrollToTop(this.productFormActions);\n        });\n\n        this.cartUpdateUnsubscriber = FoxTheme.pubsub.subscribe(FoxTheme.pubsub.PUB_SUB_EVENTS.cartUpdate, () => {\n          this.resetButtonLoading();\n        });\n      }\n\n      disconnectedCallback() {\n        if (this.cartErrorUnsubscriber) {\n          this.cartErrorUnsubscriber();\n        }\n\n        if (this.cartUpdateUnsubscriber) {\n          this.cartUpdateUnsubscriber();\n        }\n      }\n\n      init() {\n        if (!this.productFormActions) {\n          this.classList.remove(this.classes.isOpen);\n          return;\n        }\n\n        const rootMargin = `${this.productFormActions.offsetHeight}px 0px 0px 0px`;\n        this.observer = new IntersectionObserver(\n          (entries) => {\n            entries.forEach((entry) => {\n              const isAboveViewport = !entry.isIntersecting && entry.boundingClientRect.top < 0;\n              this.classList.toggle(this.classes.isOpen, isAboveViewport);\n            });\n          },\n          { threshold: 1, rootMargin }\n        );\n        this.observer.observe(this.productFormActions);\n        this.syncWithMainProductForm();\n      }\n\n      onClick() {\n        this.submitEl.setAttribute('aria-disabled', 'true');\n        this.submitEl.classList.add('btn--loading');\n      }\n\n      resetButtonLoading() {\n        this.submitEl.removeAttribute('aria-disabled');\n        this.submitEl.classList.remove('btn--loading');\n      }\n\n      scrollToTop(target, offset = 200) {\n        const scrollIntoView = (selector, offset) => {\n          window.scrollTo({\n            behavior: 'smooth',\n            top: selector.getBoundingClientRect().top - document.body.getBoundingClientRect().top - offset,\n          });\n        };\n\n        scrollIntoView(target, offset);\n      }\n\n      updateButton(disable = true, text, modifyClass = true) {\n        const addButton = this.querySelector('[name=\"add\"]');\n        if (!addButton) return;\n\n        const addButtonText = addButton.querySelector('span');\n        if (disable) {\n          addButton.setAttribute('disabled', 'disabled');\n          if (text) addButtonText.textContent = text;\n        } else {\n          addButton.removeAttribute('disabled');\n          addButtonText.textContent = FoxTheme.variantStrings.addToCartShort;\n        }\n      }\n\n      updatePrice(variant) {\n        const classes = {\n          onSale: 'f-price--on-sale',\n          soldOut: 'f-price--sold-out',\n        };\n        const selectors = {\n          priceWrapper: '.f-price',\n          salePrice: '.f-price-item--sale',\n          compareAtPrice: ['.f-price-item--regular'],\n          unitPriceWrapper: '.f-price__unit-wrapper',\n        };\n        const moneyFormat = FoxTheme.settings.moneyFormat;\n        const { priceWrapper, salePrice, unitPriceWrapper, compareAtPrice } = FoxTheme.utils.queryDomNodes(\n          selectors,\n          this\n        );\n        const unitPrice = unitPriceWrapper.querySelector('.f-price__unit');\n\n        const { compare_at_price, price, unit_price_measurement } = variant;\n\n        // On sale.\n        if (compare_at_price && compare_at_price > price) {\n          priceWrapper.classList.add(classes.onSale);\n        } else {\n          priceWrapper.classList.remove(classes.onSale);\n        }\n\n        // Sold out.\n        if (!variant.available) {\n          priceWrapper.classList.add(classes.soldOut);\n        } else {\n          priceWrapper.classList.remove(classes.soldOut);\n        }\n\n        if (salePrice) salePrice.innerHTML = FoxTheme.Currency.formatMoney(price, moneyFormat);\n\n        if (compareAtPrice && compareAtPrice.length && compare_at_price > price) {\n          compareAtPrice.forEach(\n            (item) => (item.innerHTML = `<s>${FoxTheme.Currency.formatMoney(compare_at_price, moneyFormat)}</s>`)\n          );\n        } else {\n          compareAtPrice.forEach((item) => (item.innerHTML = FoxTheme.Currency.formatMoney(price, moneyFormat)));\n        }\n\n        if (unit_price_measurement && unitPrice) {\n          unitPriceWrapper.classList.remove('hidden');\n          const unitPriceContent = `<span>${FoxTheme.Currency.formatMoney(\n            variant.unit_price,\n            moneyFormat\n          )}</span>/<span data-unit-price-base-unit>${this._getBaseUnit()}</span>`;\n          unitPrice.innerHTML = unitPriceContent;\n        } else {\n          unitPriceWrapper.classList.add('hidden');\n        }\n      }\n\n      syncWithMainProductForm() {\n        FoxTheme.pubsub.subscribe(FoxTheme.pubsub.PUB_SUB_EVENTS.variantChange, (event) => {\n          const isMainProduct = event.data.sectionId === this.mainProductInfo.dataset.section;\n          if (!isMainProduct) return;\n          const variant = event.data.variant;\n          this.updatePrice(variant);\n          this.updateButton(true, '', false);\n          if (!variant) {\n            this.updateButton(true, '', true);\n          } else {\n            this.updateButton(!variant.available, FoxTheme.variantStrings.soldOut);\n          }\n        });\n      }\n    }\n  );\n}\n"],
  "mappings": "AAAK,eAAe,IAAI,2BAA2B,GACjD,eAAe,OACb,4BACA,cAAqC,WAAY,CAC/C,aAAc,CACZ,MAAM,EAEN,KAAK,QAAU,CACb,OAAQ,sBACV,EAEA,KAAK,SAAS,iBAAiB,QAAS,KAAK,QAAQ,KAAK,IAAI,CAAC,CACjE,CAEA,IAAI,UAAW,CACb,OAAQ,KAAK,UAAY,KAAK,WAAa,KAAK,cAAc,iBAAiB,CACjF,CAEA,mBAAoB,CAClB,KAAK,mBAAqB,SAAS,cAAc,oBAAoB,EACrE,KAAK,gBAAkB,SAAS,cAAc,cAAc,EAE5D,KAAK,KAAK,EAEV,KAAK,sBAAwB,SAAS,OAAO,UAAU,SAAS,OAAO,eAAe,UAAW,IAAM,CACrG,KAAK,mBAAmB,EACxB,KAAK,YAAY,KAAK,kBAAkB,CAC1C,CAAC,EAED,KAAK,uBAAyB,SAAS,OAAO,UAAU,SAAS,OAAO,eAAe,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