/*!
 * Custom elements for Nanopore-Digital Web applications
 */
import{g as t,j as s}from"./index-BM3Om9WE.js";function h(t){const s=t.getRootNode();return s.host?s.host.innerText:t.innerText}class i{host;slotNames=[];constructor(s,...h){this.slotNames=h;const i=s.componentWillLoad;s.componentWillLoad=()=>{this.host=t(s),i&&i.call(s)};const o=s.connectedCallback;s.connectedCallback=()=>{this.host=t(s),this.hostConnected(),o&&o.call(s)};const e=s.disconnectedCallback;s.disconnectedCallback=()=>{this.hostDisconnected(),this.host=void 0,e&&e.call(s)}}hasDefaultSlot(){if(!this.host)return!1;let t;return t=this.host.shadowRoot?[...this.host.childNodes]:!this.host.classList.contains("hydrated")&&this.host.__childNodes?[...this.host?.__childNodes??[]]:[...this.host.childNodes],t.some((t=>!(t.nodeType!==Node.TEXT_NODE||!t.textContent.trim())||t.nodeType===Node.ELEMENT_NODE&&!t.hasAttribute("slot")))}hasNamedSlot(t){return!!this.host&&!!this.host.querySelector(`[slot="${t}"]`)}has(t){return"[default]"===t?this.hasDefaultSlot():this.hasNamedSlot(t)}hostConnected(){(this.host.shadowRoot??this.host).addEventListener("slotchange",this.handleSlotChange)}hostDisconnected(){this.host&&(this.host.shadowRoot??this.host).removeEventListener("slotchange",this.handleSlotChange)}handleSlotChange=t=>{const h=t.target;(this.slotNames.includes("[default]")&&!h.name||h.name&&this.slotNames.includes(h.name))&&s(this.host)}}export{i as H,h as g}