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B,KAAKC,UAAUwB,SAAW,IAAMzB,KAAK0B,mBAAkB,GACvD1B,KAAKC,UAAU0B,SAAW,IAAM3B,KAAKG,aAAc,CACrD,CAEAuB,kBAAkBZ,GAChBd,KAAKc,KAAOA,EACZd,KAAKC,UAAY,KACjBD,KAAKE,WAAY,EACjBF,KAAKG,aAAc,EACnBH,KAAKY,MAAMU,OAAStB,KAAKY,MAAMC,SAAW,EAC5C,CAEAoB,gCACQ,IAAejC,MACrBA,KAAKU,QAAUV,KAAKS,cAAc,WAClCT,KAAKgC,QAAUhC,KAAKS,cAAc,mCAClCT,KAAKU,QAAQwB,iBAAiB,QAASlC,KAAKI,QAAQ+B,KAAKnC,MAC3D,EAGFoC,eAAeC,OAAO,iBAAkBzC,EAAe,CAAE0C,QAAS,W","sources":["webpack://easternstandard/./node_modules/@alexspirgel/children-loaded/src/index.js","webpack://easternstandard/webpack/bootstrap","webpack://easternstandard/webpack/runtime/compat get default export","webpack://easternstandard/webpack/runtime/define property getters","webpack://easternstandard/webpack/runtime/hasOwnProperty shorthand","webpack://easternstandard/./custom-blocks/flexible/accordion-item/scripts/src/script.js"],"sourcesContent":["module.exports = (function () {\n\n\t// Initialize a weak map to hold promises.\n\tconst childrenLoadedPromises = new WeakMap();\n\n\t/**\n\t * Checks to see if children elements are loaded.\n\t * @param {object} element - Element to look for children within.\n\t * @return {boolean} Whether the children elements are loaded or not.\n\t */\n\n\tconst childrenLoadedSynchronous = (element) => {\n\n\t\t// Document ready states reference: https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState\n\t\tif (document.readyState === 'interactive' || document.readyState === 'complete') {\n\t\t\t// Children elements are assumed to be loaded.\n\t\t\treturn true;\n\t\t}\n\n\t\t// While the element exists.\n\t\twhile (element) {\n\t\t\t// If the next sibling element exists.\n\t\t\tif (element.nextSibling) {\n\t\t\t\t// The original passed element and its children have been loaded.\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t// Set the element to the parent element.\n\t\t\telement = element.parentNode;\n\t\t}\n\n\t\t// If code execution gets here, it's assumed children elements are not loaded.\n\t\treturn false;\n\n\t};\n\n\t/**\n\t * An asynchronous wrapper for the childrenLoadedSynchronous function.\n\t * @param {object} element - Element to look for children within.\n\t * @param {boolean} [forceNewPromise=false] - Option to invalidate existing promises.\n\t * @return {*} True if children are loaded, otherwise a promise.\n\t */\n\n\tconst childrenLoaded = (element, forceNewPromise = false) => {\n\n\t\t// If children are loaded immediately.\n\t\tif (childrenLoadedSynchronous(element)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// If an existing promise for the passed element does not exist yet or if a new promise is being forced.\n\t\telse if (!childrenLoadedPromises.get(element) || forceNewPromise) {\n\t\t\t// Create a new promise.\n\t\t\tconst childrenLoadedPromise = new Promise((resolve) => {\n\t\t\t\t// Create a new mutation observer.\n\t\t\t\tconst observer = new MutationObserver(() => {\n\t\t\t\t\t// When children are loaded.\n\t\t\t\t\tif (childrenLoadedSynchronous(element)) {\n\t\t\t\t\t\t// Disconnect the mutation observer.\n\t\t\t\t\t\tobserver.disconnect();\n\t\t\t\t\t\t// Resolve the promise.\n\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t// Watch for child element updates.\n\t\t\t\tobserver.observe(element, {\n\t\t\t\t\tchildList: true\n\t\t\t\t});\n\t\t\t});\n\t\t\t// Set the promise weak map entry for the passed element.\n\t\t\tchildrenLoadedPromises.set(element, childrenLoadedPromise);\n\t\t}\n\n\t\t// Return the promise for the passed element.\n\t\t// Multiple asynchronous calls of childrenLoaded for the same element should return the same promise.\n\t\treturn childrenLoadedPromises.get(element);\n\n\t};\n\n\t// Attach the synchronous function to the export for optional use.\n\tchildrenLoaded.synchronous = childrenLoadedSynchronous;\n\t// Add shorthand alias for synchronous.\n\tchildrenLoaded.sync = childrenLoaded.synchronous;\n\t// Return the asynchronous function as the export.\n\treturn childrenLoaded;\n\n})();","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (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 = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import childrenLoaded from \"@alexspirgel/children-loaded\";\n\nclass AccordionItem extends HTMLDetailsElement {\n constructor() {\n super();\n this.animation = null;\n this.isClosing = false;\n this.isExpanding = false;\n }\n\n onClick(e) {\n e.preventDefault();\n const parent = this.parentElement;\n const openedElement = parent.querySelector('.block-accordion__item[open] summary');\n\n if (openedElement && openedElement !== this.summary) {\n openedElement.click();\n }\n\n this.style.overflow = 'hidden';\n if (this.isClosing || !this.open) {\n this.openDetails();\n } else if (this.isExpanding || this.open) {\n this.shrink();\n }\n }\n\n shrink() {\n this.isClosing = true;\n const startHeight = `${this.scrollHeight}px`;\n const endHeight = `${this.summary.scrollHeight}px`;\n\n if (this.animation) {\n this.animation.cancel();\n }\n\n this.animation = this.animate({\n height: [startHeight, endHeight]\n }, {\n duration: 300,\n easing: 'ease-out'\n });\n\n this.animation.onfinish = () => this.onAnimationFinish(false);\n this.animation.oncancel = () => this.isClosing = false;\n }\n\n openDetails() {\n this.style.height = `${this.offsetHeight}px`;\n this.open = true;\n window.requestAnimationFrame(() => this.expand());\n }\n\n expand() {\n this.isExpanding = true;\n const startHeight = `${this.offsetHeight}px`;\n const endHeight = `${this.summary.offsetHeight + this.content.offsetHeight}px`;\n\n if (this.animation) {\n this.animation.cancel();\n }\n\n this.animation = this.animate({\n height: [startHeight, endHeight]\n }, {\n duration: 300,\n easing: 'ease-out'\n });\n\n this.animation.onfinish = () => this.onAnimationFinish(true);\n this.animation.oncancel = () => this.isExpanding = false;\n }\n\n onAnimationFinish(open) {\n this.open = open;\n this.animation = null;\n this.isClosing = false;\n this.isExpanding = false;\n this.style.height = this.style.overflow = '';\n }\n\n async connectedCallback() {\n await childrenLoaded(this);\n this.summary = this.querySelector('summary');\n this.content = this.querySelector('.block-accordion__item__content');\n this.summary.addEventListener('click', this.onClick.bind(this));\n }\n}\n\ncustomElements.define('accordion-item', AccordionItem, { extends: 'details' });"],"names":["module","exports","childrenLoadedPromises","WeakMap","childrenLoadedSynchronous","element","document","readyState","nextSibling","parentNode","childrenLoaded","forceNewPromise","get","childrenLoadedPromise","Promise","resolve","observer","MutationObserver","disconnect","observe","childList","set","sync","synchronous","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","call","AccordionItem","HTMLDetailsElement","constructor","super","this","animation","isClosing","isExpanding","onClick","e","preventDefault","openedElement","parentElement","querySelector","summary","click","style","overflow","open","openDetails","shrink","startHeight","scrollHeight","endHeight","cancel","animate","height","duration","easing","onfinish","onAnimationFinish","oncancel","offsetHeight","window","requestAnimationFrame","expand","content","async","addEventListener","bind","customElements","define","extends"],"sourceRoot":""}