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KAAKQ,eAAeoB,YAAcD,EAE9B3B,KAAKG,gBACPH,KAAKG,eAAe0B,gBAAgB,OAEvC,G,sCAED,SAAyBb,GACvB,GAAKhB,KAAKG,eAAe2B,aAAa,QAAtC,CACA,IAAMC,EAAoB,CAAC/B,KAAKK,eAAe2B,eAAxB,SAA0ChC,KAAKM,iBAChE2B,EAAeF,EAAkB,GACjCG,EAAcH,EAAkBA,EAAkBI,OAAS,GAEnD,WAAVnB,EAAEC,IACJjB,KAAKG,eAAe0B,gBAAgB,QACjB,QAAVb,EAAEC,KACXjB,KAAKoC,SAASpB,EAAGiB,EAAcC,EARoB,CAUtD,G,sBAED,SAASlB,EAAGiB,EAAcC,GACpBlB,EAAEqB,UAAYlB,SAASmB,gBAAkBL,GAC3CjB,EAAEuB,iBACFL,EAAYM,SACFxB,EAAEqB,UAAYlB,SAASmB,gBAAkBJ,IACnDlB,EAAEuB,iBACFN,EAAaO,QAEhB,G,+BAED,SAAkBxB,IACXhB,KAAKG,eAAesC,SAASzB,EAAE0B,SAAW1C,KAAKG,eAAe2B,aAAa,SAC9E9B,KAAKG,eAAe0B,gBAAgB,OAEvC,M,gFAhFG5B,G,OAmFNkB,SAASZ,iBAAiB,yBAAyBM,SAAQ,SAAA8B,GAC1D,IAAI1C,EAAc0C,EAClB,I","sources":["webpack://octopus.public.web/webpack/universalModuleDefinition","webpack://octopus.public.web/./Assets/js/pricingSelect.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, () => {\nreturn ","class PricingSelect {\n constructor(pricingSelect) {\n this.pricingSelect = pricingSelect;\n this.detailsElement = pricingSelect.querySelector('[data-pricing-select-details]');\n this.summaryElement = pricingSelect.querySelector('[data-pricing-select-summary]');\n this.optionElements = pricingSelect.querySelectorAll('[data-pricing-select-option]');\n this.displayedValue = pricingSelect.querySelector('[data-pricing-select-price]');\n\n this.addListeners();\n this.initializeDefault();\n }\n\n initializeDefault() {\n const firstOption = this.optionElements[0];\n if (firstOption) {\n this.handleOptionClick(firstOption);\n }\n }\n\n addListeners() {\n this.optionElements.forEach(option => {\n option.addEventListener('click', () => this.handleOptionClick(option));\n option.addEventListener('keydown', (e) => {\n if (e.key === 'Enter') {\n this.handleOptionClick(option);\n }\n });\n });\n\n if (this.detailsElement) {\n this.detailsElement.addEventListener('keydown', (e) => this.handleKeyboardNavigation(e));\n }\n\n document.addEventListener('click', (e) => this.checkClickOutside(e));\n }\n\n handleOptionClick(optionElement) {\n this.optionElements.forEach(option => {\n option.classList.remove('is-selected');\n });\n\n optionElement.classList.add('is-selected');\n\n const selectedLabel = optionElement.getAttribute('data-pricing-select-option-label');\n const selectedValue = optionElement.getAttribute('data-pricing-select-option');\n this.summaryElement.textContent = selectedLabel;\n this.displayedValue.textContent = selectedValue;\n\n if (this.detailsElement) {\n this.detailsElement.removeAttribute('open');\n }\n }\n\n handleKeyboardNavigation(e) {\n if (!this.detailsElement.hasAttribute('open')) return;\n const focusableElements = [this.summaryElement.parentElement, ...this.optionElements];\n const firstElement = focusableElements[0];\n const lastElement = focusableElements[focusableElements.length - 1];\n\n if (e.key === 'Escape') {\n this.detailsElement.removeAttribute('open');\n } else if (e.key === 'Tab') {\n this.tabFocus(e, firstElement, lastElement);\n }\n }\n\n tabFocus(e, firstElement, lastElement) {\n if (e.shiftKey && document.activeElement === firstElement) {\n e.preventDefault();\n lastElement.focus();\n } else if (!e.shiftKey && document.activeElement === lastElement) {\n e.preventDefault();\n firstElement.focus();\n }\n }\n\n checkClickOutside(e) {\n if (!this.detailsElement.contains(e.target) && this.detailsElement.hasAttribute('open')) {\n this.detailsElement.removeAttribute('open');\n }\n }\n}\n\ndocument.querySelectorAll('[data-pricing-select]').forEach(element => {\n\tnew PricingSelect(element);\n});"],"names":["root","factory","exports","module","define","amd","a","i","this","PricingSelect","pricingSelect","detailsElement","querySelector","summaryElement","optionElements","querySelectorAll","displayedValue","addListeners","initializeDefault","firstOption","handleOptionClick","forEach","option","addEventListener","e","key","handleKeyboardNavigation","document","checkClickOutside","optionElement","classList","remove","add","selectedLabel","getAttribute","selectedValue","textContent","removeAttribute","hasAttribute","focusableElements","parentElement","firstElement","lastElement","length","tabFocus","shiftKey","activeElement","preventDefault","focus","contains","target","element"],"sourceRoot":""}