PageSourceSearch

https://www.thionvilletourisme.fr/app/dist/pays-thionvillois/addon…ine-input-dropdown-component.c7e89a83ab.mjs

js thionvilletourisme.fr collected 2026-09-25 02:40:16 UTC 3,385 bytes, 1 lines download raw bytes

1import a from"woody_library_woody_component";import{fetchPopularSearches as r}from"woody_addon_search_data_controller";import o from"fuse.js";class l extends a{#h={popular_searches_limit:5};#t;#l;#i;#e;#s=0;#a;#n=!1;#r=!1;constructor(){super()}async init(t){if(super.init(t),this.config=Object.assign(this.#h,this.config),this.#t=this.querySelector("[data-woody-search-popular-list]"),!this.#t)throw new Error("SearchEngineInputDropdownComponent - init - popular list is missed");this.#t.addEventListener("click",s=>{this.onListItem(s.target)}),this.#t.addEventListener("keyup",s=>{(s.key==="Enter"||s.key===" ")&&this.onListItem(s.target)});const e=this.querySelector("[data-woody-search-popular-list-item-skeleton]");if(!e)throw new Error("SearchEngineInputDropdownComponent - init - popular list skeleton is missed");this.#l=e.outerHTML,e.remove(),this.classList.add("popular-search-loading"),this.#i=await r(),this.classList.remove("popular-search-loading"),this.#o(this.#i),this.#a=new o(this.#i,{threshold:.3}),this.#n=!0,this.#r!==!1&&this.update(this.#r)}onListItem(t){t.hasAttribute("data-woody-search-popular-list-item-label")||(t=t.querySelector("[data-woody-search-popular-list-item-label]")),t&&(this.update(t.innerHTML),this.submit(t.innerHTML))}open(){this.classList.add("active"),this.setFocusable(!0)}close(){this.classList.remove("active"),this.setFocusable(!1)}isOpened(){return this.classList.contains("active")}setFocusable(t){this.setAttribute("tabindex",t?"0":"-1"),this.setAttribute("aria-hidden",t?"false":"true"),this.querySelectorAll("a, button, input, textarea, select, [tabindex]").forEach(i=>{t?i.dataset.originalTabindex&&(i.setAttribute("tabindex",i.dataset.originalTabindex),delete i.dataset.originalTabindex):(i.hasAttribute("tabindex")&&(i.dataset.originalTabindex=i.getAttribute("tabindex")),i.setAttribute("tabindex","-1"))}),this.setAttribute("aria-hidden",t?"false":"true")}selectUp(){this.#s!=1&&(this.#s--,this.updateSelection())}selectDown(){this.#s!=this.#e.length&&(this.#s++,this.updateSelection())}update(t){if(!this.#n){this.#r=t;return}if(t&&t!==""&&this.#a){const e=this.#a.search(t);this.#o(e.map(s=>s.item))}else this.#o(this.#i)}#o(t){this.#e=t.slice(0,this.config.popular_searches_limit+1),this.#c(),!this.#e||this.#e.length==0?(this.classList.contains("has-popular-searches")&&this.classList.remove("has-popular-searches"),this.classList.add("no-popular-searches")):(this.classList.contains("no-popular-searches")&&this.classList.remove("no-popular-searches"),this.classList.add("has-popular-searches"))}#c(){let t="";this.#e?.length>0&&this.#e.forEach(e=>{t+=this.#l.replaceAll('data-woody-search-popular-list-item-skeleton=""',"").replaceAll("data-woody-search-popular-list-item-skeleton","").replaceAll("is-hidden","").replaceAll("{% label %}",e)}),this.#t.innerHTML=t}submit(t){this.dispatchEvent(new CustomEvent("submit",{detail:{value:t}}))}updateSelection(){const t=this.#t.querySelectorAll(".selected");t&&t.forEach(s=>{s.classList.remove("selected")});const e=this.#t.querySelector("[data-woody-search-popular-list-item]:nth-child("+this.#s+") > [data-woody-search-popular-list-item-label]");if(!e){console.warn("SearchEngineInputDropdownComponent - no item found at position : "+this.#s);return}e.classList.add("selected"),this.dispatchEvent(new CustomEvent("select",{detail:{value:e.innerHTML}}))}}export{l as default};

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.