import{findActiveElement as t,isParentOf as e}from"../lib/shadow-dom-utils.js";class s{constructor(t,e,s){t.addController(this),this.host=t,this.selector=e,this.elements=[],this.callback=s}hostUpdate(){this.activeElement=t()}hostUpdated(){const t=this.elements;this.elements=Array.from(this.host.shadowRoot.querySelectorAll(this.selector));const s=t.filter((t=>!this.elements.includes(t)));if(s.length>0){const l=s.find((t=>t===this.activeElement||e(t,this.activeElement)));if(null!=l){const e=t.indexOf(l),s=Math.min(this.elements.length-1,e),i=s>-1?this.elements[s]:null;this.callback({removedElement:l,focusedElement:this.activeElement,index:e,suggestedElement:i})}}}}export{s as LostFocusController};
//# sourceMappingURL=lost-focus-controller.js.map
