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AUzB,SAIdhB,GAA0BI,UAAUY,OAAO,mDAE/C,CAEJ,CAAE,MAAO0C,GAELC,QAAQC,IAAI,uBAChB,MACmC,IAA5BzC,EAAiBJ,QAGxBf,GAA0BI,UAAUY,OAAO,mDAE/C,GACD,IAAK,IAkCZQ,OAAOrB,iBAAiB,SAAS,SAAU0D,GAElCzE,GAA0BiB,SAASwD,EAAEC,SACrC7E,GAAkBoB,SAASwD,EAAEC,SAE1B1E,GAA0BgB,UAAUC,SAAS,mCACzCL,GAA0BI,UAAUC,SAAS,qDACjDC,GAGZ,IAEAN,GAA0BG,iBAAiB,YAAY,KACnD2B,YAAW,KAEF1C,GAA0BiB,SAASnB,SAAS6E,gBAC5C/D,GAA0BK,SAASnB,SAAS6E,gBAE7CzD,GACJ,GACD,EAAE,IAIT,MAAMA,EAAuB,KACzBhB,GAAqBiB,aAAa,WAAY,MAC9Cf,GAAmBe,aAAa,WAAY,MAC5CR,GAAoBQ,aAAa,WAAY,MAC7CjB,GAAqBiB,aAAa,cAAe,QACjDf,GAAmBe,aAAa,cAAe,QAC/CR,GAAoBQ,aAAa,cAAe,QAChDnB,GAA0BmB,aAAa,cAAe,QACtDX,GAAwBW,aAAa,cAAe,QACpDnB,GAA0BgB,UAAUY,OAAO,iCAC3CvB,GAA0BW,UAAUY,OAAO,yCAC3CtB,GAAyBU,UAAUY,OAAO,6BAC1ChB,GAA0BI,UAAUY,OAAO,oDAC3C/B,GAAkBmB,UAAUY,OAAO,6BACnCnB,GAAcc,eAAeP,UAAUY,OAAO,kBAAmB,iBACjEa,aAAa3B,GACbjB,EAAiB2B,QACjB3B,EAAiB+E,MAAM,C","sources":["webpack://wwwroot/./src/scripts/mobileNavSearchBox.js"],"sourcesContent":["// Get elements\r\nconst openNavSearchBox = document.querySelectorAll(\".adm-btn-nav-mobile\")[2];\r\nconst searchBoxContainerMobile = openNavSearchBox?.nextElementSibling;\r\nconst deleteTextBtnMobile = document.getElementById(\"delete-text-button-mobile\");\r\nconst searchInputMobile = document.getElementById(\"search-box-input-mobile\");\r\nconst mainDarkBackgroundMobile = searchBoxContainerMobile?.nextElementSibling;\r\nconst searchBoxContainerChild = searchBoxContainerMobile?.firstElementChild;\r\nconst mobileHeaderSearchForm = searchBoxContainerChild?.firstElementChild;\r\nconst mobileHeader = document.querySelector(\".adm-nav-header-mobile\");\r\nconst submitSearchMobile = document.querySelector(\"#submit-mobile-search\");\r\nconst typeaheadContainerMobile = mainDarkBackgroundMobile?.nextElementSibling;\r\nconst typeaheadScrollerMobile = typeaheadContainerMobile?.firstElementChild;\r\n\r\n// Display Search Box\r\nopenNavSearchBox?.addEventListener(\"click\", () => {\r\n if (searchBoxContainerMobile?.classList.contains('adm-div-search-mobile-display')) {\r\n closeMobileSearchBox();\r\n } else {\r\n searchInputMobile?.setAttribute(\"tabindex\", \"0\");\r\n submitSearchMobile?.setAttribute(\"tabindex\", \"0\");\r\n searchInputMobile?.setAttribute(\"aria-hidden\", \"false\");\r\n submitSearchMobile?.setAttribute(\"aria-hidden\", \"false\");\r\n searchBoxContainerMobile?.setAttribute(\"aria-hidden\", \"false\");\r\n mobileHeaderSearchForm?.setAttribute(\"aria-hidden\", \"false\");\r\n if (deleteTextBtnMobile?.style.display === \"block\") {\r\n deleteTextBtnMobile?.setAttribute(\"tabindex\", \"0\");\r\n deleteTextBtnMobile?.setAttribute(\"aria-hidden\", \"false\");\r\n }\r\n searchBoxContainerMobile?.classList.add('adm-div-search-mobile-display');\r\n mainDarkBackgroundMobile?.classList.add('adm-div-dark-background-mobile-active');\r\n searchBoxContainerChild?.classList.add('adm-div-searchbox-display');\r\n openNavSearchBox?.classList.add('adm-btn-nav-mobile-active');\r\n mobileHeader?.parentElement?.classList.add(\"scroll-listener\", \"mobile-header\");\r\n // setTimeout(() => {\r\n searchInputMobile?.focus();\r\n // }, 400);\r\n }\r\n});\r\n\r\n// Display delete button on user input\r\nsearchInputMobile?.addEventListener(\"input\", () => {\r\n if (searchInputMobile?.value === \"\" || searchInputMobile.value.trim().length === 0) {\r\n deleteTextBtnMobile.style.display = \"none\";\r\n deleteTextBtnMobile?.setAttribute(\"tabindex\", \"-1\");\r\n deleteTextBtnMobile?.setAttribute(\"aria-hidden\", \"true\");\r\n } else {\r\n deleteTextBtnMobile.style.display = \"block\";\r\n deleteTextBtnMobile?.setAttribute(\"tabindex\", \"0\");\r\n deleteTextBtnMobile?.setAttribute(\"aria-hidden\", \"false\");\r\n }\r\n});\r\n\r\n// Delete user input\r\ndeleteTextBtnMobile?.addEventListener(\"click\", () => {\r\n searchInputMobile.value = \"\";\r\n deleteTextBtnMobile.style.display = \"none\";\r\n deleteTextBtnMobile?.setAttribute(\"tabindex\", \"-1\");\r\n deleteTextBtnMobile?.setAttribute(\"aria-hidden\", \"true\");\r\n searchInputMobile?.focus();\r\n\r\n // Close typeahead\r\n typeaheadContainerMobile?.classList.remove(\"adm-div-search-mobile-typeahead-container-active\");\r\n});\r\n\r\n// Redirect user on search\r\nsubmitSearchMobile?.addEventListener('click', (event) => {\r\n event.preventDefault();\r\n let searchInputValue = searchInputMobile?.value;\r\n let searchPageUrl = searchInputMobile?.getAttribute(\"data-searchurl\");\r\n let encoded = encodeURIComponent(searchInputValue);\r\n window.location.href = searchPageUrl + \"?q=\" + encoded;\r\n})\r\n\r\n\r\n// ----------- TYPEAHEAD -------------\r\nlet typeaheadTimeoutMobile;\r\nlet typeaheadOldResultsMobile = [];\r\n\r\n// Listen to any user input\r\nsearchInputMobile?.addEventListener(\"input\", () => {\r\n const trigger = searchInputMobile.getAttribute(\"data-type-ahead-trigger\");\r\n\r\n // Set a timeout after user stop input\r\n clearTimeout(typeaheadTimeoutMobile);\r\n typeaheadTimeoutMobile = setTimeout(async () => {\r\n\r\n // Get relevant data\r\n let searchInputValue = encodeURIComponent(searchInputMobile?.value);\r\n\r\n // Set request destination\r\n let reqPath = window.location.origin + \"/FloatingSearchBlock/TypeaheadSearch?query=\" + searchInputValue;\r\n\r\n if (searchInputValue.length >= +trigger) {\r\n\r\n try {\r\n let response = await fetch(reqPath, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json;charset=utf-8'\r\n }\r\n });\r\n\r\n let searchResultsMobile = await response.json();\r\n\r\n if (searchResultsMobile.results[0]) {\r\n displaySearchResults(searchResultsMobile);\r\n \r\n } else {\r\n\r\n // Remove old results\r\n for (let oldResult of typeaheadOldResultsMobile) {\r\n oldResult.remove();\r\n }\r\n\r\n // Close typeahead\r\n typeaheadContainerMobile?.classList.remove(\"adm-div-search-mobile-typeahead-container-active\");\r\n\r\n }\r\n\r\n } catch (err) {\r\n // Error handling\r\n console.log('Something went wrong');\r\n }\r\n } else if (searchInputValue.length === 0) {\r\n\r\n // Close typeahead\r\n typeaheadContainerMobile?.classList.remove(\"adm-div-search-mobile-typeahead-container-active\");\r\n\r\n }\r\n }, 1000);\r\n});\r\n\r\nfunction displaySearchResults(searchResultsMobile) {\r\n // Display typeahead container\r\n typeaheadContainerMobile?.classList.add(\"adm-div-search-mobile-typeahead-container-active\");\r\n\r\n // Remove old results\r\n for (let oldResult of typeaheadOldResultsMobile) {\r\n oldResult.remove();\r\n }\r\n\r\n // Iterate through the results\r\n for (let result of searchResultsMobile.results) {\r\n const title = result.title || result.Title;\r\n const excerpt = result.excerpt || result.Excerpt;\r\n const link = result.pageUrl.linkUrl || result.pageUrl.LinkUrl;\r\n\r\n // Create an element for each result\r\n const resultBlock = document.createElement('div');\r\n resultBlock.className = \"adm-div-search-util-typeahead-block\";\r\n resultBlock.innerHTML = `\r\n \r\n

${title}

\r\n

${excerpt}

\r\n
\r\n `;\r\n typeaheadScrollerMobile?.append(resultBlock);\r\n typeaheadOldResultsMobile?.push(resultBlock);\r\n }\r\n}\r\n\r\n\r\n// Close search box\r\nwindow.addEventListener('click', function (e) {\r\n if (\r\n !searchBoxContainerMobile?.contains(e.target) &&\r\n !openNavSearchBox?.contains(e.target)\r\n ) {\r\n if (searchBoxContainerMobile?.classList.contains('adm-div-search-mobile-display')\r\n && !typeaheadContainerMobile?.classList.contains(\"adm-div-search-mobile-typeahead-container-active\")) {\r\n closeMobileSearchBox();\r\n }\r\n }\r\n})\r\n\r\ntypeaheadContainerMobile?.addEventListener(\"focusout\", () => {\r\n setTimeout(() => {\r\n if (\r\n !searchBoxContainerMobile?.contains(document.activeElement) &&\r\n !typeaheadContainerMobile?.contains(document.activeElement)\r\n ) {\r\n closeMobileSearchBox();\r\n }\r\n }, 0);\r\n})\r\n\r\n// Functions\r\nconst closeMobileSearchBox = () => {\r\n deleteTextBtnMobile?.setAttribute(\"tabindex\", \"-1\");\r\n searchInputMobile?.setAttribute(\"tabindex\", \"-1\");\r\n submitSearchMobile?.setAttribute(\"tabindex\", \"-1\");\r\n deleteTextBtnMobile?.setAttribute(\"aria-hidden\", \"true\");\r\n searchInputMobile?.setAttribute(\"aria-hidden\", \"true\");\r\n submitSearchMobile?.setAttribute(\"aria-hidden\", \"true\");\r\n searchBoxContainerMobile?.setAttribute(\"aria-hidden\", \"true\");\r\n mobileHeaderSearchForm?.setAttribute(\"aria-hidden\", \"true\");\r\n searchBoxContainerMobile?.classList.remove('adm-div-search-mobile-display');\r\n mainDarkBackgroundMobile?.classList.remove('adm-div-dark-background-mobile-active');\r\n searchBoxContainerChild?.classList.remove('adm-div-searchbox-display');\r\n typeaheadContainerMobile?.classList.remove(\"adm-div-search-mobile-typeahead-container-active\");\r\n openNavSearchBox?.classList.remove(\"adm-btn-nav-mobile-active\");\r\n mobileHeader?.parentElement?.classList.remove(\"scroll-listener\", \"mobile-header\");\r\n clearTimeout(typeaheadTimeoutMobile);\r\n openNavSearchBox.focus();\r\n openNavSearchBox.blur();\r\n}"],"names":["openNavSearchBox","document","querySelectorAll","searchBoxContainerMobile","nextElementSibling","deleteTextBtnMobile","getElementById","searchInputMobile","mainDarkBackgroundMobile","searchBoxContainerChild","firstElementChild","mobileHeaderSearchForm","mobileHeader","querySelector","submitSearchMobile","typeaheadContainerMobile","typeaheadScrollerMobile","typeaheadTimeoutMobile","addEventListener","classList","contains","closeMobileSearchBox","setAttribute","style","display","add","parentElement","focus","value","trim","length","remove","event","preventDefault","searchInputValue","searchPageUrl","getAttribute","encoded","encodeURIComponent","window","location","href","typeaheadOldResultsMobile","trigger","clearTimeout","setTimeout","async","reqPath","origin","response","fetch","method","headers","searchResultsMobile","json","results","oldResult","result","title","Title","excerpt","Excerpt","link","pageUrl","linkUrl","LinkUrl","resultBlock","createElement","className","innerHTML","append","push","displaySearchResults","err","console","log","e","target","activeElement","blur"],"sourceRoot":""}