{
  "version": 3,
  "sources": ["/cdn/shop/t/133/assets/pdp.js?nocache=1793468094195"],
  "sourcesContent": ["class StickyBuyButton extends HTMLElement {\n  constructor() {\n    super();\n\n    this.activeClass = \"wt-product__sticky-buy--show\";\n  }\n\n  connectedCallback() {\n    this.initialize();\n  }\n\n  initialize() {\n    const addToCartModule = document.querySelector(\".wt-product__add-to-cart\");\n    const btn = this.querySelector(\"button\");\n\n    // Lenoites (granskning F24): p\u00E5 mobil r\u00E4knas inte produktnamnet, s\u00E5 raden syns direkt n\u00E4r k\u00F6pknappen ligger under vecket.\n    const mobil = window.matchMedia(\"(max-width: 749px)\").matches;\n    const forObserver = document.querySelectorAll(\n      mobil ? \".wt-product__add-to-cart, .wt-footer\" : \".wt-product__add-to-cart, .wt-footer, .wt-product__name\",\n    );\n\n    let intersected = [];\n\n    btn.addEventListener(\"click\", (e) => {\n      e.preventDefault();\n      addToCartModule.scrollIntoView({\n        behavior: \"smooth\",\n        block: \"center\",\n      });\n    });\n\n    const observer = new IntersectionObserver((entries) => {\n      entries.forEach(({ isIntersecting, target }) => {\n        isIntersecting\n          ? intersected.push(target)\n          : (intersected = intersected.filter((item) => item !== target));\n      });\n\n      if (intersected.length) {\n        this.classList.remove(this.activeClass);\n      } else {\n        this.classList.add(this.activeClass);\n      }\n    });\n\n    forObserver.forEach((item) => {\n      observer.observe(item);\n    });\n  }\n}\n\ncustomElements.define(\"sticky-buy-button\", StickyBuyButton);\n\nif (!customElements.get(\"gallery-fashion\")) {\n  customElements.define(\n    \"gallery-fashion\",\n    class GalleryFashion extends HTMLElement {\n      constructor() {\n        super();\n        this.section = this.closest(\"section\");\n        this.logoBanner = this;\n      }\n\n      connectedCallback() {\n        this.init();\n      }\n\n      disconnectedCallback() {\n        this.removeEventsWhenDesignMode();\n      }\n\n      addEventsWhenDesignMode() {\n        if (Shopify.designMode) {\n          document.addEventListener(\n            \"shopify:section:load\",\n            this.reinitAfterDelay,\n          );\n          document.addEventListener(\n            \"shopify:section:unload\",\n            this.reinitAfterDelay,\n          );\n        }\n      }\n\n      removeEventsWhenDesignMode() {\n        if (Shopify.designMode) {\n          document.removeEventListener(\n            \"shopify:section:load\",\n            this.reinitAfterDelay,\n          );\n          document.removeEventListener(\n            \"shopify:section:unload\",\n            this.reinitAfterDelay,\n          );\n        }\n      }\n\n      reinitAfterDelay() {\n        setTimeout(() => this.reinit(), 0);\n      }\n\n      isFirstSection() {\n        const sectionWrapper = document.querySelector(\"#root\");\n        const firstSection = sectionWrapper.querySelector(\"section\");\n        this.section = this.closest(\"section\");\n        const currentSection = this.section;\n\n        return firstSection === currentSection;\n      }\n\n      handleResize() {\n        this.setTopMargin();\n        this.positioningProductInfo();\n      }\n\n      observeHeader() {\n        const header = document.querySelector(\".wt-header\");\n        const activeTransparentClass = \"wt-header--fashion-transparent\";\n\n        const observer = new IntersectionObserver(\n          (entries) => {\n            entries.forEach((entry) => {\n              if (!entry.isIntersecting) {\n                header.classList.remove(activeTransparentClass);\n              } else {\n                header.classList.add(activeTransparentClass);\n              }\n            });\n          },\n          { root: null, threshold: 0.05 },\n        );\n\n        observer.observe(this.querySelector(\".wt-product__gallery\"));\n      }\n\n      calculateOffset() {\n        const header = document.querySelector(\"header\");\n        const headerHeight = header.offsetHeight;\n        const offset =\n          this.isTransparentHeaderEnabled() && this.isFirstSection()\n            ? headerHeight\n            : 0;\n\n        return offset;\n      }\n\n      setTopMargin() {\n        const offset = this.calculateOffset();\n        if (offset) {\n          this.section.style.marginTop = `-${offset}px`;\n        } else {\n          this.section.style.marginTop = 0;\n        }\n      }\n\n      isTransparentHeaderEnabled() {\n        const header = document.querySelector(\".wt-header\");\n        return (\n          header.dataset.transparent &&\n          header.classList.contains(\"wt-header--v3\")\n        );\n      }\n\n      renderProgressBar() {\n        const thumbsGallery = this.querySelector(\"[data-thumbs]\");\n        const progressBarElement = document.createElement(\"div\");\n        progressBarElement.classList.add(\"gallery-fashion__progress-bar\");\n        const progressBarIndicatorElement = document.createElement(\"div\");\n        progressBarIndicatorElement.classList.add(\n          \"gallery-fashion__progress-bar-indicator\",\n        );\n        progressBarElement.appendChild(progressBarIndicatorElement);\n        thumbsGallery.appendChild(progressBarElement);\n\n        function updateProgressBar() {\n          const images = this.querySelector(\"gallery-section\");\n          const progressBar = progressBarIndicatorElement;\n\n          const scrolled = window.scrollY;\n          const maxHeight = images.clientHeight - window.innerHeight;\n          const scrollPercentage = (scrolled / maxHeight) * 100;\n\n          const progressBarHeight = progressBarElement.clientHeight;\n          const progressHeight = progressBar.clientHeight;\n          const maxProgressTop = progressBarHeight - progressHeight;\n          const progressTop = Math.min(\n            (scrollPercentage / 100) * maxProgressTop,\n            maxProgressTop,\n          );\n\n          progressBar.style.top = `${progressTop}px`;\n\n          if (progressTop === maxProgressTop) {\n            thumbsGallery.classList.add(\"finished\");\n          } else {\n            thumbsGallery.classList.remove(\"finished\");\n          }\n        }\n\n        window.addEventListener(\"scroll\", updateProgressBar.bind(this));\n\n        function handleThumbsClick(event) {\n          if (event.target.className === \"wt-product__img\") {\n            const thumbnails = Array.from(\n              event.currentTarget.querySelectorAll(\"img\"),\n            );\n            const index = thumbnails.indexOf(event.target);\n\n            const fullImage = this.querySelectorAll(\n              \".wt-masonry__wrapper .wt-product__img, .wt-masonry__wrapper .wt-product__thumbnail-video\",\n            )[index];\n\n            fullImage.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n          }\n        }\n\n        thumbsGallery.addEventListener(\"click\", handleThumbsClick.bind(this));\n      }\n\n      positioningProductInfo() {\n        const productInfo = this.querySelector(\".wt-product__main\");\n        const mediaDesktop = window.matchMedia(\"(min-width: 1200px)\");\n\n        if (mediaDesktop.matches) {\n          productInfo.style.top = `${Math.max((window.innerHeight - productInfo.offsetHeight) / 2, 0)}px`;\n        }\n\n        const resizeObserver = new ResizeObserver((entries) => {\n          for (let entry of entries) {\n            if (mediaDesktop.matches) {\n              productInfo.style.top = `${Math.max((window.innerHeight - productInfo.offsetHeight) / 2, 0)}px`;\n            }\n          }\n        });\n\n        const observedElement = productInfo;\n        resizeObserver.observe(observedElement);\n      }\n\n      attachEvents() {\n        window.addEventListener(\"resize\", this.handleResize.bind(this));\n      }\n\n      init() {\n        this.reinitAfterDelay = this.reinitAfterDelay.bind(this);\n        if (this.isTransparentHeaderEnabled()) {\n          const stickyHeaderThreshold = document.querySelector(\n            \".sticky-header__threshold\",\n          );\n          const isHeaderSticky =\n            document.body.classList.contains(\"page-header-sticky\");\n          if (isHeaderSticky) {\n            stickyHeaderThreshold.style.height = `${this.querySelector(\".swiper-wrapper--masonry\").offsetHeight}px`;\n          }\n          this.setTopMargin();\n          this.observeHeader();\n          this.attachEvents();\n        }\n\n        this.renderProgressBar();\n        this.positioningProductInfo();\n        this.addEventsWhenDesignMode();\n      }\n\n      reinit() {\n        if (this.isTransparentHeaderEnabled()) {\n          const stickyHeaderThreshold = document.querySelector(\n            \".sticky-header__threshold\",\n          );\n          const isHeaderSticky =\n            document.body.classList.contains(\"page-header-sticky\");\n          if (isHeaderSticky) {\n            stickyHeaderThreshold.style.height = `${this.querySelector(\".swiper-wrapper--masonry\").offsetHeight}px`;\n          }\n          this.setTopMargin();\n          this.observeHeader();\n        }\n        this.positioningProductInfo();\n      }\n    },\n  );\n}\n"],
  "mappings": "AAAA,MAAM,wBAAwB,WAAY,CACxC,aAAc,CACZ,MAAM,EAEN,KAAK,YAAc,8BACrB,CAEA,mBAAoB,CAClB,KAAK,WAAW,CAClB,CAEA,YAAa,CACX,MAAM,gBAAkB,SAAS,cAAc,0BAA0B,EACnE,IAAM,KAAK,cAAc,QAAQ,EAGjC,MAAQ,OAAO,WAAW,oBAAoB,EAAE,QAChD,YAAc,SAAS,iBAC3B,MAAQ,uCAAyC,yDACnD,EAEA,IAAI,YAAc,CAAC,EAEnB,IAAI,iBAAiB,QAAU,GAAM,CACnC,EAAE,eAAe,EACjB,gBAAgB,eAAe,CAC7B,SAAU,SACV,MAAO,QACT,CAAC,CACH,CAAC,EAED,MAAM,SAAW,IAAI,qBA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