{"version":3,"file":"product-main-area.js","sources":["../../../../src/assets/scripts/product-main-area.entry.js"],"sourcesContent":["window.productMainJs = window.productMainJs || {\n isInitialized: false,\n resizeHandler: function () {\n const productMainArea = document.querySelector('.arjo-m-product-main-area');\n const productMainAreaContainer = productMainArea.querySelector('.arjo-m-product-main-area__container');\n if (!productMainAreaContainer) {\n return;\n }\n const header = productMainAreaContainer.querySelector('.arjo-m-product-main-area__header');\n const sectionLinks = productMainAreaContainer.querySelector('.arjo-m-product-main-area__section-links');\n const helpLinks = productMainAreaContainer.querySelector('.arjo-m-product-main-area__helps');\n const carouselContainer = productMainAreaContainer.querySelector('.arjo-m-product-main-area__carousel-container');\n const carousel = carouselContainer.querySelector('.arjo-o-carousel');\n const sections = productMainAreaContainer.querySelector('.arjo-m-product-main-area__sections');\n const productAddddToCart = productMainAreaContainer.querySelector('.arjo-m-eshop-product-add-to-cart');\n\n let pageHeaderBottom = 0;\n const pageHeader = document.querySelector('nav.arjo-o-header');\n if (pageHeader) {\n var pageHeaderRect = pageHeader.getBoundingClientRect();\n pageHeaderBottom = Math.max(0, Math.floor(pageHeaderRect.bottom));\n productMainArea.style.setProperty('--page-header-bottom', pageHeaderBottom + 'px');\n }\n\n if (carouselContainer && !carousel) {\n carouselContainer.style.paddingBottom = 0;\n }\n\n const sectionLinksHeight = sectionLinks?.getBoundingClientRect()?.height ?? 0;\n\n if (window.arjoJs.isDesktop()) {\n const mainAreaRect = productMainAreaContainer.getBoundingClientRect();\n const headerInner = header?.querySelector('.arjo-m-product-main-area__header-container');\n /* For tablet and desktop */\n const headerInnerHeight = headerInner?.getBoundingClientRect()?.height ?? 0;\n const helpLinksHeight = helpLinks?.getBoundingClientRect()?.height ?? 0;\n const carouselHeight = carousel?.getBoundingClientRect()?.height ?? 0;\n const productAddddToCartHeight = productAddddToCart?.getBoundingClientRect()?.height ?? 0;\n\n productMainArea.style.setProperty('--section-link-height', '0px');\n\n const leftHeight = headerInnerHeight + sectionLinksHeight + helpLinksHeight;\n\n const start = Math.max(0, mainAreaRect.y);\n const end = Math.max(0, window.innerHeight - mainAreaRect.bottom);\n const availableHeight = window.innerHeight - start - end;\n\n const stickyPosition = Math.min(0, availableHeight - leftHeight);\n\n header.style.position = 'sticky';\n header.style.top = pageHeaderBottom + stickyPosition + 'px';\n header.style.marginBottom = sectionLinksHeight + helpLinksHeight + productAddddToCartHeight + 'px';\n\n sectionLinks.style.position = 'sticky';\n sectionLinks.style.top = pageHeaderBottom + stickyPosition + headerInnerHeight + productAddddToCartHeight + 'px';\n sectionLinks.style.marginTop = headerInnerHeight + productAddddToCartHeight + 'px';\n sectionLinks.style.marginBottom = helpLinksHeight + 'px';\n\n if (productAddddToCart) {\n productAddddToCart.style.position = 'sticky';\n productAddddToCart.style.top = pageHeaderBottom + stickyPosition + headerInnerHeight + 'px';\n productAddddToCart.style.marginTop = headerInnerHeight + 'px';\n productAddddToCart.style.marginBottom = helpLinksHeight + sectionLinksHeight + 'px';\n }\n\n helpLinks.style.position = 'sticky';\n helpLinks.style.top = pageHeaderBottom + stickyPosition + headerInnerHeight + sectionLinksHeight + productAddddToCartHeight + 'px';\n helpLinks.style.marginTop = headerInnerHeight + sectionLinksHeight + productAddddToCartHeight + 'px';\n\n sections.style.marginTop = carouselHeight + 'px';\n sections.style.display = 'block';\n sectionLinks.style.opacity = 1;\n helpLinks.style.opacity = 1;\n productAddddToCart && (productAddddToCart.style.opacity = 1);\n } else {\n productMainArea.style.setProperty('--section-link-height', sectionLinksHeight + 'px');\n\n header.style.removeProperty('position');\n header.style.removeProperty('top');\n header.style.removeProperty('margin-top');\n header.style.removeProperty('margin-bottom');\n\n sectionLinks.style.removeProperty('position');\n sectionLinks.style.removeProperty('top');\n sectionLinks.style.removeProperty('margin-top');\n sectionLinks.style.removeProperty('margin-bottom');\n\n productAddddToCart?.style.removeProperty('position');\n productAddddToCart?.style.removeProperty('top');\n productAddddToCart?.style.removeProperty('margin-top');\n productAddddToCart?.style.removeProperty('margin-bottom');\n\n helpLinks.style.removeProperty('position');\n helpLinks.style.removeProperty('top');\n helpLinks.style.removeProperty('margin-top');\n helpLinks.style.removeProperty('margin-bottom');\n\n sections.style.removeProperty('margin-top');\n sections.style.removeProperty('display');\n\n productMainAreaContainer.style.removeProperty('grid-template-rows');\n\n sectionLinks.style.top = pageHeaderBottom + 'px';\n }\n },\n setupSectionLinks: function () {\n const productMainArea = document.querySelector('.arjo-m-product-main-area__container');\n var sectionLinks = document.querySelector('.arjo-m-product-main-area__section-links');\n if (!sectionLinks) {\n return;\n }\n\n var linkList = sectionLinks.querySelector('.arjo-m-product-main-area__section-links-container');\n if (!linkList) {\n return;\n }\n\n /* For mobile part */\n var sectionLinksHeader = sectionLinks.querySelector('.arjo-m-product-main-area__section-links-header');\n if (!sectionLinksHeader) {\n return;\n }\n\n var sectionLinksHeaderText = sectionLinksHeader.querySelector('.arjo-m-product-main-area__section-links-header-text');\n if (!sectionLinksHeaderText) {\n return;\n }\n\n var sectionLinksHeaderIcon = sectionLinksHeader.querySelector('.arjo-m-product-main-area__section-links-header .arjo-a-icon');\n if (!sectionLinksHeaderIcon) {\n return;\n }\n /* End for mobile part */\n\n var links = [...linkList.querySelectorAll('.arjo-a-link[data-arjo-section]')];\n links.forEach((link) => {\n if (link.hasAttribute('data-arjo-active')) {\n link.removeAttribute('data-arjo-active');\n link.closest('li').setAttribute('data-arjo-active', 'true');\n }\n link.addEventListener('click', (e) => {\n e.preventDefault();\n\n var href = link.getAttribute('data-arjo-section');\n if (!href || !href.startsWith('#')) {\n return;\n }\n\n var target = productMainArea.querySelector(href);\n if (!target) {\n return;\n }\n\n var sections = [...productMainArea.querySelectorAll('.arjo-m-product-main-area__section')];\n sections.forEach((section) => {\n section.style.display = 'none';\n });\n\n target.style.display = 'block';\n sectionLinksHeaderText.textContent = link.textContent;\n this.resizeHandler();\n\n linkList.removeAttribute('data-arjo-expand');\n sectionLinksHeaderIcon.removeAttribute('data-arjo-expand');\n\n links.forEach((l) => {\n l.closest('li').removeAttribute('data-arjo-active');\n });\n link.closest('li').setAttribute('data-arjo-active', 'true');\n\n const pageHeader = document.querySelector('nav.arjo-o-header');\n if (pageHeader?.classList.contains('sticky')) {\n document.querySelector('.arjo-m-product-main-area__sections').scrollIntoViewEx(0, [sectionLinksHeader]);\n }\n\n return false;\n });\n });\n\n if (links.length) {\n sectionLinksHeaderText.textContent = links[0].textContent;\n }\n\n sectionLinksHeader.addEventListener('click', () => {\n linkList.toggleAttribute('data-arjo-expand');\n sectionLinksHeaderIcon.toggleAttribute('data-arjo-expand');\n });\n\n document.addEventListener('click', function (e) {\n if (!sectionLinks.contains(e.target)) {\n linkList.removeAttribute('data-arjo-expand');\n sectionLinksHeaderIcon.removeAttribute('data-arjo-expand');\n }\n });\n },\n setupAnchorLinks: function () {\n const productMainArea = document.querySelector('.arjo-m-product-main-area__container');\n if (!productMainArea) {\n return;\n }\n\n var helps = productMainArea.querySelector('.arjo-m-product-main-area__helps');\n if (!helps) {\n return;\n }\n\n var anchorLinks = [...helps.querySelectorAll('.arjo-a-link-with-icon[data-arjo-tab]')];\n anchorLinks.forEach((anchorLink) => {\n anchorLink.addEventListener('click', (e) => {\n e.preventDefault();\n var tabName = anchorLink.getAttribute('data-arjo-tab');\n if (!tabName) {\n return;\n }\n\n var tab = document.querySelector('label[for=\"' + tabName + '\"]');\n if (!tab) {\n return;\n }\n\n tab.click();\n\n var tabContainer = tab.closest('.arjo-o-tab-container');\n if (tabContainer) {\n tabContainer.scrollIntoViewEx();\n } else {\n tab.scrollIntoViewEx();\n }\n\n return false;\n });\n });\n },\n init: function () {\n let _this = window.productMainJs;\n if (_this.isInitialized) {\n return;\n }\n _this.isInitialized = true;\n\n _this.setupSectionLinks();\n _this.setupAnchorLinks();\n\n addEventListener('resize', _this.resizeHandler);\n addEventListener('scroll', _this.resizeHandler);\n\n if ('ResizeObserver' in window) {\n // create an Observer instance\n const resizeObserver = new ResizeObserver((entries) => _this.resizeHandler());\n\n // start observing a DOM node\n resizeObserver.observe(document.body);\n\n const header = document.querySelector('nav.arjo-o-header');\n if (header) {\n resizeObserver.observe(header);\n }\n }\n\n _this.resizeHandler();\n },\n};\n\nwindow.productMainJs.init();\n"],"names":["_a","_b","_c","_d","_e","productMainArea","productMainAreaContainer","header","sectionLinks","helpLinks","carouselContainer","carousel","sections","productAddddToCart","pageHeaderBottom","pageHeader","pageHeaderRect","sectionLinksHeight","mainAreaRect","headerInner","headerInnerHeight","helpLinksHeight","carouselHeight","productAddddToCartHeight","leftHeight","start","end","availableHeight","stickyPosition","linkList","sectionLinksHeader","sectionLinksHeaderText","sectionLinksHeaderIcon","links","link","href","target","section","l","e","helps","anchorLinks","anchorLink","tabName","tab","tabContainer","_this","resizeObserver","entries"],"mappings":"AAAA,OAAO,cAAgB,OAAO,eAAiB,CAC7C,cAAe,GACf,cAAe,UAAY,CAF7B,IAAAA,EAAAC,EAAAC,EAAAC,EAAAC,EAGI,MAAMC,EAAkB,SAAS,cAAc,2BAA2B,EACpEC,EAA2BD,EAAgB,cAAc,sCAAsC,EACrG,GAAI,CAACC,EACH,OAEF,MAAMC,EAASD,EAAyB,cAAc,mCAAmC,EACnFE,EAAeF,EAAyB,cAAc,0CAA0C,EAChGG,EAAYH,EAAyB,cAAc,kCAAkC,EACrFI,EAAoBJ,EAAyB,cAAc,+CAA+C,EAC1GK,EAAWD,EAAkB,cAAc,kBAAkB,EAC7DE,EAAWN,EAAyB,cAAc,qCAAqC,EACvFO,EAAqBP,EAAyB,cAAc,mCAAmC,EAErG,IAAIQ,EAAmB,EACvB,MAAMC,EAAa,SAAS,cAAc,mBAAmB,EAC7D,GAAIA,EAAY,CACd,IAAIC,EAAiBD,EAAW,wBAChCD,EAAmB,KAAK,IAAI,EAAG,KAAK,MAAME,EAAe,MAAM,CAAC,EAChEX,EAAgB,MAAM,YAAY,uBAAwBS,EAAmB,IAAI,CAClF,CAEGJ,GAAqB,CAACC,IACxBD,EAAkB,MAAM,cAAgB,GAG1C,MAAMO,IAAqBjB,EAAAQ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