1import{Controller}from"@hotwired/stimulus";import{renderStreamMessage}from"@hotwired/turbo";export default class extends Controller{static values={csrfToken:String};static targets=["item","search"];connect(){this.element.querySelector(".dropdown-menu")?.addEventListener("click",e=>e.stopPropagation());const e=this.element.querySelector('[data-bs-toggle="dropdown"]');if(!e)return;this.observer=new MutationObserver(t=>{t.forEach(t=>{t.attributeName==="aria-expanded"&&e.getAttribute("aria-expanded")==="true"&&setTimeout(()=>this.searchTarget?.focus(),10)})}),this.observer.observe(e,{attributes:!0})}disconnect(){this.observer?.disconnect()}submitChange(e){e.preventDefault(),e.stopPropagation();const t=e.target.dataset.updateUrl;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":this.csrfTokenValue,Accept:"text/vnd.turbo-stream.html"},body:"{}"}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.text()}).then(renderStreamMessage).catch(e=>console.error("Turbo update failed:",e))}filter(e){const t=e.target.value.toLowerCase();this.itemTargets.forEach(e=>{const n=e.dataset.name||"";n.includes(t)?e.classList.remove("d-none"):e.classList.add("d-none")})}}
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.