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getters","webpack://welocalize-theme/webpack/runtime/hasOwnProperty shorthand","webpack://welocalize-theme/webpack/runtime/make namespace object","webpack://welocalize-theme/./block-editor/blocks/panels/view-script.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import angleRight from '../../../assets/svg/angle-right.svg';\nconst plusIcon = true; // Set to false to use angle right icon\nconst titleIcon = plusIcon ? '' : angleRight;\nconst titleIconClass = plusIcon ? 'panels__plus-icon' : '';\n\nclass Panel {\n\tconstructor(node) {\n\t\tthis.node = node;\n\t\tthis.openedClass = 'panels__panel--opened';\n\t\tthis.opened = this.node.classList.contains(this.openedClass);\n\t\tthis.title = this.node.querySelector('.panels__title');\n\t\tthis.content = this.node.querySelector('.panels__content');\n\n\t\t// Find the panel image block (hidden) inside this panel.\n\t\tthis.panelImage = this.node.querySelector('.panel__image');\n\t\tthis.panelImageUrl = this.panelImage\n\t\t\t? this.panelImage.dataset.panelImage\n\t\t\t: null;\n\n\t\t// Save instance on the node for sibling access.\n\t\tthis.node.panelInstance = this;\n\n\t\tif (this.title) {\n\t\t\tthis.title.insertAdjacentHTML(\n\t\t\t\t'beforeend',\n\t\t\t\t`${titleIcon}`\n\t\t\t);\n\t\t\tthis.title.addEventListener('click', () => this.toggle());\n\t\t}\n\t}\n\n\t// Utility: Update the main image in the right column.\n\tupdateMainImage() {\n\t\tconst mainImage = document.querySelector('.panels__image');\n\t\tif (mainImage) {\n\t\t\tmainImage.src = this.panelImageUrl ? this.panelImageUrl : \"\";\n\t\t}\n\t}\n\n\topen() {\n\t\tthis.node.classList.add(this.openedClass);\n\t\tthis.opened = true;\n\t\tthis.title.setAttribute('aria-expanded', 'true');\n\n\t\t// Update main image.\n\t\tthis.updateMainImage();\n\n\t\t// Animate the opening of the panel content.\n\t\tthis.content.style.display = 'flow-root';\n\t\tthis.content.style.position = 'absolute';\n\t\tlet height = this.content.offsetHeight;\n\t\tthis.content.style.position = '';\n\t\tthis.content.style.height = '0px';\n\t\tthis.content.style.overflow = 'hidden';\n\n\t\tlet transitionend = (e) => {\n\t\t\tif (e.propertyName === 'height') {\n\t\t\t\tthis.content.removeAttribute('style');\n\t\t\t\tthis.content.removeEventListener('transitionend', transitionend);\n\t\t\t}\n\t\t};\n\n\t\tthis.content.addEventListener('transitionend', transitionend);\n\t\tthis.content.style.transitionProperty = 'height, opacity';\n\t\tthis.content.style.transitionDuration = '300ms';\n\t\tthis.content.style.transitionTimingFunction = 'ease-out, linear';\n\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tthis.content.style.height = `${height}px`;\n\t\t\t\tthis.content.style.opacity = 1;\n\t\t\t});\n\t\t});\n\t}\n\n\tclose() {\n\t\tthis.node.classList.remove(this.openedClass);\n\t\tthis.opened = false;\n\t\tthis.title.setAttribute('aria-expanded', 'false');\n\t\tthis.content.style.display = 'block';\n\t\tthis.content.style.overflow = 'hidden';\n\t\tthis.content.style.height = `${this.content.offsetHeight}px`;\n\t\tthis.content.style.transitionProperty = 'height, opacity';\n\t\tthis.content.style.transitionDuration = '300ms';\n\t\tthis.content.style.transitionTimingFunction = 'ease-out, linear';\n\n\t\tlet transitionend = (e) => {\n\t\t\tif (e.propertyName === 'height') {\n\t\t\t\tthis.content.removeAttribute('style');\n\t\t\t\tthis.content.removeEventListener('transitionend', transitionend);\n\t\t\t\tconst openPanels = document.querySelectorAll('.panels__panel--opened');\n\t\t\t\tif (openPanels.length === 0) {\n\t\t\t\t\tconst mainImage = document.querySelector('.panels__image');\n\t\t\t\t\tif (mainImage) {\n\t\t\t\t\t\tmainImage.src = \"\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tthis.content.addEventListener('transitionend', transitionend);\n\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tthis.content.style.height = '0';\n\t\t\t\tthis.content.style.opacity = 0;\n\t\t\t});\n\t\t});\n\t}\n\n\ttoggle() {\n\t\tconst panelsContainer = this.node.closest('.panels');\n\t\t// Read the allowMultiple attribute from the parent container.\n\t\tconst allowMultiple = panelsContainer.getAttribute('data-allow-multiple') === 'true';\n\n\t\tif (!this.opened) {\n\t\t\tif (!allowMultiple) {\n\t\t\t\tconst siblingPanels = panelsContainer.querySelectorAll('.panels__panel');\n\t\t\t\tsiblingPanels.forEach((panelNode) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tpanelNode !== this.node &&\n\t\t\t\t\t\tpanelNode.classList.contains(this.openedClass)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif (panelNode.panelInstance) {\n\t\t\t\t\t\t\tpanelNode.panelInstance.close();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.open();\n\t\t} else {\n\t\t\tthis.close();\n\t\t}\n\t}\n}\n\nclass Panels {\n\tconstructor(node) {\n\t\tthis.node = node;\n\t\tthis.node.classList.add('panels--interactive');\n\t\tthis.panels = Array.from(this.node.querySelectorAll('.panels__panel')).map(\n\t\t\t(node) => new Panel(node)\n\t\t);\n\t\tconst allowMultiple = this.node.getAttribute('data-allow-multiple') === 'true';\n\n\t\tif (!allowMultiple) {\n\t\t\tconst openPanels = this.panels.filter(panel => panel.opened);\n\t\t\tif (openPanels.length === 0 && this.panels.length > 0) {\n\t\t\t\tthis.panels[0].open();\n\t\t\t} else if (openPanels.length > 1) {\n\t\t\t\topenPanels.slice(1).forEach(panel => panel.close());\n\t\t\t}\n\t\t} else {\n\t\t\tconst openPanels = this.panels.filter(panel => panel.opened);\n\t\t\tif (openPanels.length > 0) {\n\t\t\t\topenPanels[0].updateMainImage();\n\t\t\t}\n\t\t}\n\t}\n}\n\nPanels.instances = Array.from(document.querySelectorAll('.panels')).map(\n\t(p) => new Panels(p)\n);\n\nexport default Panels;\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Panel","constructor","node","this","openedClass","opened","classList","contains","title","querySelector","content","panelImage","panelImageUrl","dataset","panelInstance","insertAdjacentHTML","addEventListener","toggle","updateMainImage","mainImage","document","src","open","add","setAttribute","style","display","position","height","offsetHeight","overflow","transitionend","e","propertyName","removeAttribute","removeEventListener","transitionProperty","transitionDuration","transitionTimingFunction","requestAnimationFrame","opacity","close","remove","querySelectorAll","length","panelsContainer","closest","allowMultiple","getAttribute","forEach","panelNode","Panels","panels","Array","from","map","openPanels","filter","panel","slice","instances","p"],"sourceRoot":""}