var _ = (s) => { throw TypeError(s); }; var L = (s, i, t) => i.has(s) || _("Cannot " + t); var d = (s, i, t) => (L(s, i, "read from private field"), t ? t.call(s) : i.get(s)), n = (s, i, t) => i.has(s) ? _("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, t), a = (s, i, t, e) => (L(s, i, "write to private field"), e ? e.call(s, t) : i.set(s, t), t), u = (s, i, t) => (L(s, i, "access private method"), t); const S = "script[xslt-onload]", b = "xslt-template", w = "xslt-transformed", y = "filter-list", p = "filter-list-list", k = "filter-list-item", A = "filter-list-input", g = "filter-list-searchable", M = "scroll-button", F = "tool-tip"; var l, f, x; class $ { constructor() { n(this, f); n(this, l); a(this, l, /* @__PURE__ */ new Map()); } setup() { let i = htmx.findAll(S); for (let t of i) u(this, f, x).call(this, t); } hookupHTMX() { htmx.on("htmx:load", (i) => { this.setup(); }); } } l = new WeakMap(), f = new WeakSet(), x = function(i) { if (i.getAttribute(w) === "true" || !i.hasAttribute(b)) return; let t = "#" + i.getAttribute(b), e = d(this, l).get(t); if (!e) { let c = htmx.find(t); if (c) { let v = c.innerHTML ? new DOMParser().parseFromString(c.innerHTML, "application/xml") : c.contentDocument; e = new XSLTProcessor(), e.importStylesheet(v), d(this, l).set(t, e); } else throw new Error("Unknown XSLT template: " + t); } let r = new DOMParser().parseFromString(i.innerHTML, "application/xml"), T = e.transformToFragment(r, document), E = new XMLSerializer().serializeToString(T); i.outerHTML = E; }; var o, h, m; class I extends HTMLElement { constructor() { super(); n(this, h); n(this, o, !1); this._items = [], this._url = "", this._filterstart = !1, this._placeholder = "Liste filtern...", this.render(); } static get observedAttributes() { return ["data-url"]; } set items(t) { Array.isArray(t) && (this._items = t, this.render()); } get items() { return this._items; } connectedCallback() { this._url = this.getAttribute("data-url") || "./", this._filterstart = this.getAttribute("data-filterstart") === "true", this._placeholder = this.getAttribute("data-placeholder") || "Liste filtern...", this._filterstart && a(this, o, !0), this.addEventListener("input", this.onInput.bind(this)), this.addEventListener("keydown", this.onEnter.bind(this)), this.addEventListener("focusin", this.onGainFocus.bind(this)), this.addEventListener("focusout", this.onLoseFocus.bind(this)); } attributeChangedCallback(t, e, r) { t === "data-url" && e !== r && (this._url = r, this.render()), t === "data-filterstart" && e !== r && (this._filterstart = r === "true", this.render()), t === "data-placeholder" && e !== r && (this._placeholder = r, this.render()); } onInput(t) { t.target && t.target.tagName.toLowerCase() === "input" && (this._filter = t.target.value, this.renderList()); } onGainFocus(t) { t.target && t.target.tagName.toLowerCase() === "input" && (a(this, o, !1), this.renderList()); } onLoseFocus(t) { let e = this.querySelector("input"); if (t.target && t.target === e) { if (relatedElement = t.relatedTarget, relatedElement && this.contains(relatedElement)) return; e.value = "", this._filter = "", this._filterstart && a(this, o, !0), this.renderList(); } } onEnter(t) { if (t.target && t.target.tagName.toLowerCase() === "input" && t.key === "Enter") { t.preventDefault(); const e = this.querySelector("a"); e && e.click(); } } mark() { if (typeof Mark != "function") return; let t = this.querySelector("#" + p); if (!t) return; let e = new Mark(t.querySelectorAll("." + g)); this._filter && e.mark(this._filter, { separateWordSearch: !0 }); } // INFO: allows for setting a custom HREF of the list item // The function takes the item as parameter fn(item) and should return a string. setHREFFunc(t) { this.getHREF = t, this.render(); } // INFO: allows for setting a custom link text of the list item // The function takes the item as parameter fn(item) and should return a string or // an HTML template literal. setLinkTextFunc(t) { this.getLinkText = t, this.render(); } // INFO: allows for setting the text that will be filtered for. // The function takes the item as parameter fn(item) and should return a string. setSearchTextFunc(t) { this.getSearchText = t, this.render(); } getHREF(t) { if (t) { if (!t.id) return ""; } else return ""; return t.id; } getSearchText(t) { if (t) { if (!t.name) return ""; } else return ""; return t.name; } getLinkText(t) { let e = this.getSearchText(t); return e === "" ? "" : `${e}`; } renderList() { let t = this.querySelector("#" + p); t && (t.outerHTML = this.List()), this.mark(); } render() { this.innerHTML = `