{"version":3,"file":"search-BxpgNZBC.js","sources":["../../Client/js/search.js"],"sourcesContent":["/**\n * @param {{ formElemID: string }} state\n */\nexport function initSearch({ formElemID }) {\n const formEl = document.querySelector(`#${formElemID}`);\n if (!(formEl instanceof HTMLFormElement)) {\n console.warn(`Cannot find form #${formElemID}`);\n return;\n }\n\n /**\n * @type {HTMLInputElement[]}\n */\n const facetEls = [...formEl.querySelectorAll(`[facet-field]`)];\n for (const facetEl of facetEls) {\n facetEl.addEventListener(\"click\", (e) => {\n if (!(e.target instanceof HTMLInputElement)) {\n return;\n }\n\n const value = e.target.value;\n\n if (e.target.hasAttribute(\"facet-field-mobile\")) {\n /**\n * @type {HTMLInputElement}\n */\n const el = document.querySelector(\n `[value=\"${value}\"]:not([facet-field-mobile])`,\n );\n if (el instanceof HTMLInputElement) {\n /** disable unused field to prevent double field submission */\n el.disabled = true;\n }\n } else {\n /**\n * @type {HTMLInputElement}\n */\n const el = document.querySelector(\n `[value=${value}][facet-field-mobile]`,\n );\n if (el instanceof HTMLInputElement) {\n /** disable unused field to prevent double field submission */\n el.disabled = true;\n }\n }\n });\n }\n}\n"],"names":["initSearch","formElemID","formEl","facetEls","facetEl","e","value","el"],"mappings":"AAGO,SAASA,EAAW,CAAE,WAAAC,GAAc,CACzC,MAAMC,EAAS,SAAS,cAAc,IAAID,CAAU,EAAE,EACtD,GAAI,EAAEC,aAAkB,iBAAkB,CACxC,QAAQ,KAAK,qBAAqBD,CAAU,EAAE,EAC9C,MACJ,CAKE,MAAME,EAAW,CAAC,GAAGD,EAAO,iBAAiB,eAAe,CAAC,EAC7D,UAAWE,KAAWD,EACpBC,EAAQ,iBAAiB,QAAUC,GAAM,CACvC,GAAI,EAAEA,EAAE,kBAAkB,kBACxB,OAGF,MAAMC,EAAQD,EAAE,OAAO,MAEvB,GAAIA,EAAE,OAAO,aAAa,oBAAoB,EAAG,CAI/C,MAAME,EAAK,SAAS,cAClB,WAAWD,CAAK,8BACjB,EACGC,aAAc,mBAEhBA,EAAG,SAAW,GAExB,KAAa,CAIL,MAAMA,EAAK,SAAS,cAClB,UAAUD,CAAK,uBAChB,EACGC,aAAc,mBAEhBA,EAAG,SAAW,GAExB,CACA,CAAK,CAEL"}