{"version":3,"file":"sort-dropdown.js","sources":["../../../../src/assets/scripts/sort-dropdown.entry.js"],"sourcesContent":["window.arjoSortDropdownModule =\n window.arjoSortDropdownModule ||\n (() => {\n const state = {\n isInitialized: false,\n elements: {},\n };\n\n const setUp = () => {\n const sortDropdowns = [...document.querySelectorAll('.arjo-m-sort-dropdown')];\n sortDropdowns.forEach((element) => {\n const dropdownId = element.dataset.sortDropdownId;\n if (!dropdownId) return;\n state.elements[dropdownId] = (() => {\n const innerState = {\n currentValue: element.querySelector('select').value,\n };\n const changeHandler = (e) => {\n const newValue = e.target.value;\n innerState.currentValue = newValue;\n const customEvent = new CustomEvent(`sortDropdown:${dropdownId}`, {\n detail: {\n selectedValue: newValue,\n },\n });\n\n window.dispatchEvent(customEvent);\n };\n element.addEventListener('change', changeHandler);\n return {\n get currentValue() {\n return innerState.currentValue;\n },\n };\n })();\n });\n };\n\n const init = () => {\n if (state.isInitialized) return;\n setUp();\n state.isInitialized = true;\n };\n\n const getElement = (id) => {\n return state.elements[id];\n };\n\n return { init, getElement };\n })();\n\nwindow.addEventListener('load', window.arjoSortDropdownModule.init.bind(window.arjoSortDropdownModule));\n"],"names":["state","setUp","element","dropdownId","innerState","changeHandler","e","newValue","customEvent","id"],"mappings":"AAAA,OAAO,uBACL,OAAO,yBACN,IAAM,CACL,MAAMA,EAAQ,CACZ,cAAe,GACf,SAAU,CAAE,CAClB,EAEUC,EAAQ,IAAM,CACI,CAAC,GAAG,SAAS,iBAAiB,uBAAuB,CAAC,EAC9D,QAASC,GAAY,CACjC,MAAMC,EAAaD,EAAQ,QAAQ,eAC9BC,IACLH,EAAM,SAASG,CAAU,GAAK,IAAM,CAClC,MAAMC,EAAa,CACjB,aAAcF,EAAQ,cAAc,QAAQ,EAAE,KAC1D,EACgBG,EAAiBC,GAAM,CAC3B,MAAMC,EAAWD,EAAE,OAAO,MAC1BF,EAAW,aAAeG,EAC1B,MAAMC,EAAc,IAAI,YAAY,gBAAgBL,CAAU,GAAI,CAChE,OAAQ,CACN,cAAeI,CAChB,CACf,CAAa,EAED,OAAO,cAAcC,CAAW,CAC5C,EACU,OAAAN,EAAQ,iBAAiB,SAAUG,CAAa,EACzC,CACL,IAAI,cAAe,CACjB,OAAOD,EAAW,YACnB,CACb,CACA,KACA,CAAO,CACP,EAYI,MAAO,CAAE,KAVI,IAAM,CACbJ,EAAM,gBACVC,IACAD,EAAM,cAAgB,GAC5B,EAMmB,WAJKS,GACXT,EAAM,SAASS,CAAE,EAI9B,KAEA,OAAO,iBAAiB,OAAQ,OAAO,uBAAuB,KAAK,KAAK,OAAO,sBAAsB,CAAC"}