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,OAAO,IAAI;IAC5BA,OAAO,CAACC,gBAAgB,CAAC,OAAO,EAAE,UAAUC,KAAK,EAAE;MAC/C,MAAMQ,GAAG,GAAG,IAAIC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAACC,IAAI,CAAC;MACzCJ,GAAG,CAACK,YAAY,CAACC,GAAG,CAAC,SAAS,EAAEhB,OAAO,CAACiB,YAAY,CAAC,YAAY,CAAC,CAAC;MACnEL,MAAM,CAACC,QAAQ,CAACC,IAAI,GAAGJ,GAAG;IAC9B,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAEDjB,QAAQ,CAACQ,gBAAgB,CAAC,kBAAkB,EAAE,MAAM;EAChDV,UAAU,CAAC,CAAC;EACZiB,SAAS,CAAC,CAAC;AACf,CAAC,CAAC,C","sources":["webpack://wp-hotel-booking/./assets/js/frontend/sort-by.js"],"sourcesContent":["const roomSortBy = () => {\n const sortByWrapper = document.querySelector('.sort-by-wrapper');\n\n if (!sortByWrapper) {\n return;\n }\n\n const toggle = sortByWrapper.querySelector('.toggle');\n const list = sortByWrapper.querySelector('ul');\n const listOptions = list.querySelectorAll('li');\n\n [...listOptions].map(element => {\n element.addEventListener('click', function (event) {\n [...listOptions].map(element2 => {\n element2.classList.remove('active');\n });\n\n element.classList.add('active');\n toggle.innerHTML = element.innerHTML;\n });\n });\n}\n\nconst hotelRoom = () => {\n const sortByWrapper = document.querySelector('.sort-by-wrapper');\n\n if (!sortByWrapper) {\n return;\n }\n\n const formSearch = document.querySelector('#hb-form-search-page');\n\n if (formSearch) {\n return;\n }\n\n const list = sortByWrapper.querySelector('ul');\n const listOptions = list.querySelectorAll('li');\n\n [...listOptions].map(element => {\n element.addEventListener('click', function (event) {\n const url = new URL(window.location.href);\n url.searchParams.set('sort_by', element.getAttribute('data-value'));\n window.location.href = url;\n });\n });\n}\n\ndocument.addEventListener('DOMContentLoaded', () => {\n roomSortBy();\n hotelRoom();\n});\n"],"names":["roomSortBy","sortByWrapper","document","querySelector","toggle","list","listOptions","querySelectorAll","map","element","addEventListener","event","element2","classList","remove","add","innerHTML","hotelRoom","formSearch","url","URL","window","location","href","searchParams","set","getAttribute"],"sourceRoot":""}