1(()=>{let e=e=>{if(!e.getAttribute(`data-autocomplete-url`))return;let t={input:e,currentIndex:-1,options:[],list:null,value:e.value,url:e.getAttribute(`data-autocomplete-url`),form:e.closest(`form`),parent:e.parentElement},n=()=>{t.list&&(t.list.removeAttribute(`aria-hidden`),t.list.setAttribute(`aria-expanded`,`true`))},r=()=>{t.list&&(t.currentIndex=-1,t.list.setAttribute(`aria-hidden`,`true`),t.list.setAttribute(`aria-expanded`,`false`),t.list.querySelectorAll(`li`).forEach(e=>{e.setAttribute(`aria-selected`,`false`)}))},i=()=>{t.currentIndex=-1,t.input.addEventListener(`keydown`,e=>{let n=t.list?.querySelectorAll(`li`)||[];if(n.length){if(e.key===`ArrowDown`)n[t.currentIndex]?.setAttribute(`aria-selected`,`false`),t.currentIndex=(t.currentIndex+1)%n.length,n[t.currentIndex].setAttribute(`aria-selected`,`true`),e.preventDefault();else if(e.key===`ArrowUp`)n[t.currentIndex]?.setAttribute(`aria-selected`,`false`),t.currentIndex=(t.currentIndex-1+n.length)%n.length,n[t.currentIndex].setAttribute(`aria-selected`,`true`),e.preventDefault();else if(e.key===`Enter`&&t.currentIndex>=0&&t.currentIndex<n.length){let i=n[t.currentIndex].querySelector(`a, button`);i instanceof HTMLElement?(i.click(),r()):(t.input.value=n[t.currentIndex].textContent||``,r()),e.preventDefault()}}})},a=()=>{if(!t.list)return;let e=t.list.getBoundingClientRect(),n=window.innerHeight-e.top;t.list.style.maxHeight=`${n-5}px`,t.list.style.overflowY=`auto`},o=()=>{t.list=document.createElement(`ul`),t.list.classList.add(`autocomplete-list`),t.list.setAttribute(`role`,`listbox`),t.list.setAttribute(`aria-expanded`,`false`),t.list.setAttribute(`aria-hidden`,`true`),t.list.setAttribute(`aria-label`,`Autocomplete suggestions`),t.list.setAttribute(`tabindex`,`-1`),window.addEventListener(`resize`,()=>{a()}),t.parent?.appendChild(t.list),a(),i()},s=()=>{t.parent?.classList.add(`autocomplete-loading`),t.input.setAttribute(`aria-busy`,`true`)},c=()=>{t.parent?.classList.remove(`autocomplete-loading`),t.input.setAttribute(`aria-busy`,`false`)},l=()=>{t.list||o(),t.list.innerHTML=``,t.options.forEach(e=>{let n=document.createElement(`li`);n.innerHTML=`<a class="block" href="${Drupal.checkPlain(e.url)}">${Drupal.checkPlain(e.value)}</a>`,n.setAttribute(`role`,`option`),n.setAttribute(`aria-selected`,`false`),t.list?.appendChild(n)}),n()},u=Drupal.debounce(e=>{if(e.target.value.length<3){t.options=[],l();return}s(),fetch(`${t.url}&q=${encodeURIComponent(e.target.value)}`).then(e=>{if(!e.ok)throw Error(`Network response was not ok`);return e.json()}).then(e=>{t.options=e,l()}).catch(e=>{r(),console.error(`Error fetching autocomplete data:`,e)}).finally(()=>{c()})},500,!1);t.input.addEventListener(`input`,e=>{u(e)}),t.input.addEventListener(`focus`,()=>{n()}),t.input.addEventListener(`blur`,()=>{setTimeout(r,100)})};Drupal.behaviors.hmSearchAutocomplete={attach(t){once(`search-autocomplete`,`.js-header-search input[name="search_term"]`,t).forEach(t=>{t instanceof HTMLInputElement&&e(t)}
1)}}})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.