New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@eox/itemfilter

Package Overview
Dependencies
Maintainers
5
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eox/itemfilter - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

2351

dist/eox-itemfilter.js

@@ -1,55 +0,706 @@

var he = Object.defineProperty;
var ue = (s, e, t) => e in s ? he(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
var b = (s, e, t) => (ue(s, typeof e != "symbol" ? e + "" : e, t), t);
function L(s) {
return Array.isArray ? Array.isArray(s) : se(s) === "[object Array]";
var ae = Object.defineProperty;
var ue = (n, t, e) => t in n ? ae(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
var w = (n, t, e) => (ue(n, typeof t != "symbol" ? t + "" : t, e), e);
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const et = window, bt = et.ShadowRoot && (et.ShadyCSS === void 0 || et.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Jt = Symbol(), Lt = /* @__PURE__ */ new WeakMap();
let de = class {
constructor(t, e, s) {
if (this._$cssResult$ = !0, s !== Jt)
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
this.cssText = t, this.t = e;
}
get styleSheet() {
let t = this.o;
const e = this.t;
if (bt && t === void 0) {
const s = e !== void 0 && e.length === 1;
s && (t = Lt.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && Lt.set(e, t));
}
return t;
}
toString() {
return this.cssText;
}
};
const fe = (n) => new de(typeof n == "string" ? n : n + "", void 0, Jt), pe = (n, t) => {
bt ? n.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
const s = document.createElement("style"), i = et.litNonce;
i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, n.appendChild(s);
});
}, Nt = bt ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((t) => {
let e = "";
for (const s of t.cssRules)
e += s.cssText;
return fe(e);
})(n) : n;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var ct;
const st = window, Ot = st.trustedTypes, ge = Ot ? Ot.emptyScript : "", Tt = st.reactiveElementPolyfillSupport, mt = { toAttribute(n, t) {
switch (t) {
case Boolean:
n = n ? ge : null;
break;
case Object:
case Array:
n = n == null ? n : JSON.stringify(n);
}
return n;
}, fromAttribute(n, t) {
let e = n;
switch (t) {
case Boolean:
e = n !== null;
break;
case Number:
e = n === null ? null : Number(n);
break;
case Object:
case Array:
try {
e = JSON.parse(n);
} catch {
e = null;
}
}
return e;
} }, Qt = (n, t) => t !== n && (t == t || n == n), ht = { attribute: !0, type: String, converter: mt, reflect: !1, hasChanged: Qt };
let F = class extends HTMLElement {
constructor() {
super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this.u();
}
static addInitializer(t) {
var e;
this.finalize(), ((e = this.h) !== null && e !== void 0 ? e : this.h = []).push(t);
}
static get observedAttributes() {
this.finalize();
const t = [];
return this.elementProperties.forEach((e, s) => {
const i = this._$Ep(s, e);
i !== void 0 && (this._$Ev.set(i, s), t.push(i));
}), t;
}
static createProperty(t, e = ht) {
if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) {
const s = typeof t == "symbol" ? Symbol() : "__" + t, i = this.getPropertyDescriptor(t, s, e);
i !== void 0 && Object.defineProperty(this.prototype, t, i);
}
}
static getPropertyDescriptor(t, e, s) {
return { get() {
return this[e];
}, set(i) {
const r = this[t];
this[e] = i, this.requestUpdate(t, r, s);
}, configurable: !0, enumerable: !0 };
}
static getPropertyOptions(t) {
return this.elementProperties.get(t) || ht;
}
static finalize() {
if (this.hasOwnProperty("finalized"))
return !1;
this.finalized = !0;
const t = Object.getPrototypeOf(this);
if (t.finalize(), t.h !== void 0 && (this.h = [...t.h]), this.elementProperties = new Map(t.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
const e = this.properties, s = [...Object.getOwnPropertyNames(e), ...Object.getOwnPropertySymbols(e)];
for (const i of s)
this.createProperty(i, e[i]);
}
return this.elementStyles = this.finalizeStyles(this.styles), !0;
}
static finalizeStyles(t) {
const e = [];
if (Array.isArray(t)) {
const s = new Set(t.flat(1 / 0).reverse());
for (const i of s)
e.unshift(Nt(i));
} else
t !== void 0 && e.push(Nt(t));
return e;
}
static _$Ep(t, e) {
const s = e.attribute;
return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
}
u() {
var t;
this._$E_ = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$Eg(), this.requestUpdate(), (t = this.constructor.h) === null || t === void 0 || t.forEach((e) => e(this));
}
addController(t) {
var e, s;
((e = this._$ES) !== null && e !== void 0 ? e : this._$ES = []).push(t), this.renderRoot !== void 0 && this.isConnected && ((s = t.hostConnected) === null || s === void 0 || s.call(t));
}
removeController(t) {
var e;
(e = this._$ES) === null || e === void 0 || e.splice(this._$ES.indexOf(t) >>> 0, 1);
}
_$Eg() {
this.constructor.elementProperties.forEach((t, e) => {
this.hasOwnProperty(e) && (this._$Ei.set(e, this[e]), delete this[e]);
});
}
createRenderRoot() {
var t;
const e = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions);
return pe(e, this.constructor.elementStyles), e;
}
connectedCallback() {
var t;
this.renderRoot === void 0 && (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
var s;
return (s = e.hostConnected) === null || s === void 0 ? void 0 : s.call(e);
});
}
enableUpdating(t) {
}
disconnectedCallback() {
var t;
(t = this._$ES) === null || t === void 0 || t.forEach((e) => {
var s;
return (s = e.hostDisconnected) === null || s === void 0 ? void 0 : s.call(e);
});
}
attributeChangedCallback(t, e, s) {
this._$AK(t, s);
}
_$EO(t, e, s = ht) {
var i;
const r = this.constructor._$Ep(t, s);
if (r !== void 0 && s.reflect === !0) {
const o = (((i = s.converter) === null || i === void 0 ? void 0 : i.toAttribute) !== void 0 ? s.converter : mt).toAttribute(e, s.type);
this._$El = t, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$El = null;
}
}
_$AK(t, e) {
var s;
const i = this.constructor, r = i._$Ev.get(t);
if (r !== void 0 && this._$El !== r) {
const o = i.getPropertyOptions(r), c = typeof o.converter == "function" ? { fromAttribute: o.converter } : ((s = o.converter) === null || s === void 0 ? void 0 : s.fromAttribute) !== void 0 ? o.converter : mt;
this._$El = r, this[r] = c.fromAttribute(e, o.type), this._$El = null;
}
}
requestUpdate(t, e, s) {
let i = !0;
t !== void 0 && (((s = s || this.constructor.getPropertyOptions(t)).hasChanged || Qt)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), s.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, s))) : i = !1), !this.isUpdatePending && i && (this._$E_ = this._$Ej());
}
async _$Ej() {
this.isUpdatePending = !0;
try {
await this._$E_;
} catch (e) {
Promise.reject(e);
}
const t = this.scheduleUpdate();
return t != null && await t, !this.isUpdatePending;
}
scheduleUpdate() {
return this.performUpdate();
}
performUpdate() {
var t;
if (!this.isUpdatePending)
return;
this.hasUpdated, this._$Ei && (this._$Ei.forEach((i, r) => this[r] = i), this._$Ei = void 0);
let e = !1;
const s = this._$AL;
try {
e = this.shouldUpdate(s), e ? (this.willUpdate(s), (t = this._$ES) === null || t === void 0 || t.forEach((i) => {
var r;
return (r = i.hostUpdate) === null || r === void 0 ? void 0 : r.call(i);
}), this.update(s)) : this._$Ek();
} catch (i) {
throw e = !1, this._$Ek(), i;
}
e && this._$AE(s);
}
willUpdate(t) {
}
_$AE(t) {
var e;
(e = this._$ES) === null || e === void 0 || e.forEach((s) => {
var i;
return (i = s.hostUpdated) === null || i === void 0 ? void 0 : i.call(s);
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
}
_$Ek() {
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
}
get updateComplete() {
return this.getUpdateComplete();
}
getUpdateComplete() {
return this._$E_;
}
shouldUpdate(t) {
return !0;
}
update(t) {
this._$EC !== void 0 && (this._$EC.forEach((e, s) => this._$EO(s, this[s], e)), this._$EC = void 0), this._$Ek();
}
updated(t) {
}
firstUpdated(t) {
}
};
F.finalized = !0, F.elementProperties = /* @__PURE__ */ new Map(), F.elementStyles = [], F.shadowRootOptions = { mode: "open" }, Tt == null || Tt({ ReactiveElement: F }), ((ct = st.reactiveElementVersions) !== null && ct !== void 0 ? ct : st.reactiveElementVersions = []).push("1.6.1");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var at;
const it = window, z = it.trustedTypes, kt = z ? z.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, _t = "$lit$", M = `lit$${(Math.random() + "").slice(9)}$`, Xt = "?" + M, me = `<${Xt}>`, T = document, G = () => T.createComment(""), J = (n) => n === null || typeof n != "object" && typeof n != "function", Zt = Array.isArray, _e = (n) => Zt(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", ut = `[
\f\r]`, K = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Pt = /-->/g, Ht = />/g, L = RegExp(`>|${ut}(?:([^\\s"'>=/]+)(${ut}*=${ut}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`, "g"), Ut = /'/g, jt = /"/g, qt = /^(?:script|style|textarea|title)$/i, $e = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), j = $e(1), k = Symbol.for("lit-noChange"), m = Symbol.for("lit-nothing"), Ft = /* @__PURE__ */ new WeakMap(), O = T.createTreeWalker(T, 129, null, !1), ve = (n, t) => {
const e = n.length - 1, s = [];
let i, r = t === 2 ? "<svg>" : "", o = K;
for (let l = 0; l < e; l++) {
const h = n[l];
let u, a, d = -1, p = 0;
for (; p < h.length && (o.lastIndex = p, a = o.exec(h), a !== null); )
p = o.lastIndex, o === K ? a[1] === "!--" ? o = Pt : a[1] !== void 0 ? o = Ht : a[2] !== void 0 ? (qt.test(a[2]) && (i = RegExp("</" + a[2], "g")), o = L) : a[3] !== void 0 && (o = L) : o === L ? a[0] === ">" ? (o = i ?? K, d = -1) : a[1] === void 0 ? d = -2 : (d = o.lastIndex - a[2].length, u = a[1], o = a[3] === void 0 ? L : a[3] === '"' ? jt : Ut) : o === jt || o === Ut ? o = L : o === Pt || o === Ht ? o = K : (o = L, i = void 0);
const g = o === L && n[l + 1].startsWith("/>") ? " " : "";
r += o === K ? h + me : d >= 0 ? (s.push(u), h.slice(0, d) + _t + h.slice(d) + M + g) : h + M + (d === -2 ? (s.push(void 0), l) : g);
}
const c = r + (n[e] || "<?>") + (t === 2 ? "</svg>" : "");
if (!Array.isArray(n) || !n.hasOwnProperty("raw"))
throw Error("invalid template strings array");
return [kt !== void 0 ? kt.createHTML(c) : c, s];
};
class Q {
constructor({ strings: t, _$litType$: e }, s) {
let i;
this.parts = [];
let r = 0, o = 0;
const c = t.length - 1, l = this.parts, [h, u] = ve(t, e);
if (this.el = Q.createElement(h, s), O.currentNode = this.el.content, e === 2) {
const a = this.el.content, d = a.firstChild;
d.remove(), a.append(...d.childNodes);
}
for (; (i = O.nextNode()) !== null && l.length < c; ) {
if (i.nodeType === 1) {
if (i.hasAttributes()) {
const a = [];
for (const d of i.getAttributeNames())
if (d.endsWith(_t) || d.startsWith(M)) {
const p = u[o++];
if (a.push(d), p !== void 0) {
const g = i.getAttribute(p.toLowerCase() + _t).split(M), _ = /([.?@])?(.*)/.exec(p);
l.push({ type: 1, index: r, name: _[2], strings: g, ctor: _[1] === "." ? Ae : _[1] === "?" ? xe : _[1] === "@" ? Se : rt });
} else
l.push({ type: 6, index: r });
}
for (const d of a)
i.removeAttribute(d);
}
if (qt.test(i.tagName)) {
const a = i.textContent.split(M), d = a.length - 1;
if (d > 0) {
i.textContent = z ? z.emptyScript : "";
for (let p = 0; p < d; p++)
i.append(a[p], G()), O.nextNode(), l.push({ type: 2, index: ++r });
i.append(a[d], G());
}
}
} else if (i.nodeType === 8)
if (i.data === Xt)
l.push({ type: 2, index: r });
else {
let a = -1;
for (; (a = i.data.indexOf(M, a + 1)) !== -1; )
l.push({ type: 7, index: r }), a += M.length - 1;
}
r++;
}
}
static createElement(t, e) {
const s = T.createElement("template");
return s.innerHTML = t, s;
}
}
const fe = 1 / 0;
function de(s) {
if (typeof s == "string")
return s;
let e = s + "";
return e == "0" && 1 / s == -fe ? "-0" : e;
function D(n, t, e = n, s) {
var i, r, o, c;
if (t === k)
return t;
let l = s !== void 0 ? (i = e._$Co) === null || i === void 0 ? void 0 : i[s] : e._$Cl;
const h = J(t) ? void 0 : t._$litDirective$;
return (l == null ? void 0 : l.constructor) !== h && ((r = l == null ? void 0 : l._$AO) === null || r === void 0 || r.call(l, !1), h === void 0 ? l = void 0 : (l = new h(n), l._$AT(n, e, s)), s !== void 0 ? ((o = (c = e)._$Co) !== null && o !== void 0 ? o : c._$Co = [])[s] = l : e._$Cl = l), l !== void 0 && (t = D(n, l._$AS(n, t.values), l, s)), t;
}
function ge(s) {
return s == null ? "" : de(s);
class ye {
constructor(t, e) {
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
}
get parentNode() {
return this._$AM.parentNode;
}
get _$AU() {
return this._$AM._$AU;
}
u(t) {
var e;
const { el: { content: s }, parts: i } = this._$AD, r = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : T).importNode(s, !0);
O.currentNode = r;
let o = O.nextNode(), c = 0, l = 0, h = i[0];
for (; h !== void 0; ) {
if (c === h.index) {
let u;
h.type === 2 ? u = new X(o, o.nextSibling, this, t) : h.type === 1 ? u = new h.ctor(o, h.name, h.strings, this, t) : h.type === 6 && (u = new be(o, this, t)), this._$AV.push(u), h = i[++l];
}
c !== (h == null ? void 0 : h.index) && (o = O.nextNode(), c++);
}
return O.currentNode = T, r;
}
v(t) {
let e = 0;
for (const s of this._$AV)
s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
}
}
function w(s) {
return typeof s == "string";
class X {
constructor(t, e, s, i) {
var r;
this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cp = (r = i == null ? void 0 : i.isConnected) === null || r === void 0 || r;
}
get _$AU() {
var t, e;
return (e = (t = this._$AM) === null || t === void 0 ? void 0 : t._$AU) !== null && e !== void 0 ? e : this._$Cp;
}
get parentNode() {
let t = this._$AA.parentNode;
const e = this._$AM;
return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
}
get startNode() {
return this._$AA;
}
get endNode() {
return this._$AB;
}
_$AI(t, e = this) {
t = D(this, t, e), J(t) ? t === m || t == null || t === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : t !== this._$AH && t !== k && this._(t) : t._$litType$ !== void 0 ? this.g(t) : t.nodeType !== void 0 ? this.$(t) : _e(t) ? this.T(t) : this._(t);
}
k(t) {
return this._$AA.parentNode.insertBefore(t, this._$AB);
}
$(t) {
this._$AH !== t && (this._$AR(), this._$AH = this.k(t));
}
_(t) {
this._$AH !== m && J(this._$AH) ? this._$AA.nextSibling.data = t : this.$(T.createTextNode(t)), this._$AH = t;
}
g(t) {
var e;
const { values: s, _$litType$: i } = t, r = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = Q.createElement(i.h, this.options)), i);
if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === r)
this._$AH.v(s);
else {
const o = new ye(r, this), c = o.u(this.options);
o.v(s), this.$(c), this._$AH = o;
}
}
_$AC(t) {
let e = Ft.get(t.strings);
return e === void 0 && Ft.set(t.strings, e = new Q(t)), e;
}
T(t) {
Zt(this._$AH) || (this._$AH = [], this._$AR());
const e = this._$AH;
let s, i = 0;
for (const r of t)
i === e.length ? e.push(s = new X(this.k(G()), this.k(G()), this, this.options)) : s = e[i], s._$AI(r), i++;
i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
}
_$AR(t = this._$AA.nextSibling, e) {
var s;
for ((s = this._$AP) === null || s === void 0 || s.call(this, !1, !0, e); t && t !== this._$AB; ) {
const i = t.nextSibling;
t.remove(), t = i;
}
}
setConnected(t) {
var e;
this._$AM === void 0 && (this._$Cp = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
}
}
function ee(s) {
return typeof s == "number";
class rt {
constructor(t, e, s, i, r) {
this.type = 1, this._$AH = m, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = r, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = m;
}
get tagName() {
return this.element.tagName;
}
get _$AU() {
return this._$AM._$AU;
}
_$AI(t, e = this, s, i) {
const r = this.strings;
let o = !1;
if (r === void 0)
t = D(this, t, e, 0), o = !J(t) || t !== this._$AH && t !== k, o && (this._$AH = t);
else {
const c = t;
let l, h;
for (t = r[0], l = 0; l < r.length - 1; l++)
h = D(this, c[s + l], e, l), h === k && (h = this._$AH[l]), o || (o = !J(h) || h !== this._$AH[l]), h === m ? t = m : t !== m && (t += (h ?? "") + r[l + 1]), this._$AH[l] = h;
}
o && !i && this.j(t);
}
j(t) {
t === m ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
}
}
function pe(s) {
return s === !0 || s === !1 || me(s) && se(s) == "[object Boolean]";
class Ae extends rt {
constructor() {
super(...arguments), this.type = 3;
}
j(t) {
this.element[this.name] = t === m ? void 0 : t;
}
}
function te(s) {
return typeof s == "object";
const Ee = z ? z.emptyScript : "";
class xe extends rt {
constructor() {
super(...arguments), this.type = 4;
}
j(t) {
t && t !== m ? this.element.setAttribute(this.name, Ee) : this.element.removeAttribute(this.name);
}
}
function me(s) {
return te(s) && s !== null;
class Se extends rt {
constructor(t, e, s, i, r) {
super(t, e, s, i, r), this.type = 5;
}
_$AI(t, e = this) {
var s;
if ((t = (s = D(this, t, e, 0)) !== null && s !== void 0 ? s : m) === k)
return;
const i = this._$AH, r = t === m && i !== m || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, o = t !== m && (i === m || r);
r && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
}
handleEvent(t) {
var e, s;
typeof this._$AH == "function" ? this._$AH.call((s = (e = this.options) === null || e === void 0 ? void 0 : e.host) !== null && s !== void 0 ? s : this.element, t) : this._$AH.handleEvent(t);
}
}
function y(s) {
return s != null;
class be {
constructor(t, e, s) {
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
}
get _$AU() {
return this._$AM._$AU;
}
_$AI(t) {
D(this, t);
}
}
function P(s) {
return !s.trim().length;
const zt = it.litHtmlPolyfillSupport;
zt == null || zt(Q, X), ((at = it.litHtmlVersions) !== null && at !== void 0 ? at : it.litHtmlVersions = []).push("2.7.4");
const we = (n, t, e) => {
var s, i;
const r = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : t;
let o = r._$litPart$;
if (o === void 0) {
const c = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : null;
r._$litPart$ = o = new X(t.insertBefore(G(), c), c, void 0, e ?? {});
}
return o._$AI(n), o;
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var dt, ft;
class Y extends F {
constructor() {
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
}
createRenderRoot() {
var t, e;
const s = super.createRenderRoot();
return (t = (e = this.renderOptions).renderBefore) !== null && t !== void 0 || (e.renderBefore = s.firstChild), s;
}
update(t) {
const e = this.render();
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = we(e, this.renderRoot, this.renderOptions);
}
connectedCallback() {
var t;
super.connectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!0);
}
disconnectedCallback() {
var t;
super.disconnectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!1);
}
render() {
return k;
}
}
function se(s) {
return s == null ? s === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(s);
Y.finalized = !0, Y._$litElement$ = !0, (dt = globalThis.litElementHydrateSupport) === null || dt === void 0 || dt.call(globalThis, { LitElement: Y });
const Dt = globalThis.litElementPolyfillSupport;
Dt == null || Dt({ LitElement: Y });
((ft = globalThis.litElementVersions) !== null && ft !== void 0 ? ft : globalThis.litElementVersions = []).push("3.3.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const Me = (n) => (t) => typeof t == "function" ? ((e, s) => (customElements.define(e, s), s))(n, t) : ((e, s) => {
const { kind: i, elements: r } = s;
return { kind: i, elements: r, finisher(o) {
customElements.define(e, o);
} };
})(n, t);
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const Ce = (n, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) {
e.createProperty(t.key, n);
} } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
}, finisher(e) {
e.createProperty(t.key, n);
} };
function wt(n) {
return (t, e) => e !== void 0 ? ((s, i, r) => {
i.constructor.createProperty(r, s);
})(n, t, e) : Ce(n, t);
}
const ye = "Incorrect 'index' type", xe = (s) => `Invalid value for key ${s}`, Me = (s) => `Pattern length exceeds max of ${s}.`, Ee = (s) => `Missing ${s} property in key`, we = (s) => `Property 'weight' in key '${s}' must be a positive integer`, G = Object.prototype.hasOwnProperty;
class Se {
constructor(e) {
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function Mt(n) {
return wt({ ...n, state: !0 });
}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var pt;
((pt = window.HTMLSlotElement) === null || pt === void 0 ? void 0 : pt.prototype.assignedElements) != null;
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function* V(n, t) {
if (n !== void 0) {
let e = 0;
for (const s of n)
yield t(s, e++);
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const Ie = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, Re = (n) => (...t) => ({ _$litDirective$: n, values: t });
class Le {
constructor(t) {
}
get _$AU() {
return this._$AM._$AU;
}
_$AT(t, e, s) {
this._$Ct = t, this._$AM = e, this._$Ci = s;
}
_$AS(t, e) {
return this.update(t, e);
}
update(t, e) {
return this.render(...e);
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class $t extends Le {
constructor(t) {
if (super(t), this.et = m, t.type !== Ie.CHILD)
throw Error(this.constructor.directiveName + "() can only be used in child bindings");
}
render(t) {
if (t === m || t == null)
return this.ft = void 0, this.et = t;
if (t === k)
return t;
if (typeof t != "string")
throw Error(this.constructor.directiveName + "() called with a non-string value");
if (t === this.et)
return this.ft;
this.et = t;
const e = [t];
return e.raw = e, this.ft = { _$litType$: this.constructor.resultType, strings: e, values: [] };
}
}
$t.directiveName = "unsafeHTML", $t.resultType = 1;
const Bt = Re($t);
function x(n) {
return Array.isArray ? Array.isArray(n) : se(n) === "[object Array]";
}
const Ne = 1 / 0;
function Oe(n) {
if (typeof n == "string")
return n;
let t = n + "";
return t == "0" && 1 / n == -Ne ? "-0" : t;
}
function Te(n) {
return n == null ? "" : Oe(n);
}
function A(n) {
return typeof n == "string";
}
function te(n) {
return typeof n == "number";
}
function ke(n) {
return n === !0 || n === !1 || Pe(n) && se(n) == "[object Boolean]";
}
function ee(n) {
return typeof n == "object";
}
function Pe(n) {
return ee(n) && n !== null;
}
function $(n) {
return n != null;
}
function gt(n) {
return !n.trim().length;
}
function se(n) {
return n == null ? n === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(n);
}
const He = "Incorrect 'index' type", Ue = (n) => `Invalid value for key ${n}`, je = (n) => `Pattern length exceeds max of ${n}.`, Fe = (n) => `Missing ${n} property in key`, ze = (n) => `Property 'weight' in key '${n}' must be a positive integer`, Wt = Object.prototype.hasOwnProperty;
class De {
constructor(t) {
this._keys = [], this._keyMap = {};
let t = 0;
e.forEach((r) => {
let i = ie(r);
t += i.weight, this._keys.push(i), this._keyMap[i.id] = i, t += i.weight;
}), this._keys.forEach((r) => {
r.weight /= t;
let e = 0;
t.forEach((s) => {
let i = ie(s);
e += i.weight, this._keys.push(i), this._keyMap[i.id] = i, e += i.weight;
}), this._keys.forEach((s) => {
s.weight /= e;
});
}
get(e) {
return this._keyMap[e];
get(t) {
return this._keyMap[t];
}

@@ -63,46 +714,46 @@ keys() {

}
function ie(s) {
let e = null, t = null, r = null, i = 1, c = null;
if (w(s) || L(s))
r = s, e = Q(s), t = B(s);
function ie(n) {
let t = null, e = null, s = null, i = 1, r = null;
if (A(n) || x(n))
s = n, t = Kt(n), e = vt(n);
else {
if (!G.call(s, "name"))
throw new Error(Ee("name"));
const n = s.name;
if (r = n, G.call(s, "weight") && (i = s.weight, i <= 0))
throw new Error(we(n));
e = Q(n), t = B(n), c = s.getFn;
if (!Wt.call(n, "name"))
throw new Error(Fe("name"));
const o = n.name;
if (s = o, Wt.call(n, "weight") && (i = n.weight, i <= 0))
throw new Error(ze(o));
t = Kt(o), e = vt(o), r = n.getFn;
}
return { path: e, id: t, weight: i, src: r, getFn: c };
return { path: t, id: e, weight: i, src: s, getFn: r };
}
function Q(s) {
return L(s) ? s : s.split(".");
function Kt(n) {
return x(n) ? n : n.split(".");
}
function B(s) {
return L(s) ? s.join(".") : s;
function vt(n) {
return x(n) ? n.join(".") : n;
}
function Le(s, e) {
let t = [], r = !1;
const i = (c, n, o) => {
if (y(c))
if (!n[o])
t.push(c);
function Be(n, t) {
let e = [], s = !1;
const i = (r, o, c) => {
if ($(r))
if (!o[c])
e.push(r);
else {
let l = n[o];
const a = c[l];
if (!y(a))
let l = o[c];
const h = r[l];
if (!$(h))
return;
if (o === n.length - 1 && (w(a) || ee(a) || pe(a)))
t.push(ge(a));
else if (L(a)) {
r = !0;
for (let h = 0, u = a.length; h < u; h += 1)
i(a[h], n, o + 1);
if (c === o.length - 1 && (A(h) || te(h) || ke(h)))
e.push(Te(h));
else if (x(h)) {
s = !0;
for (let u = 0, a = h.length; u < a; u += 1)
i(h[u], o, c + 1);
} else
n.length && i(a, n, o + 1);
o.length && i(h, o, c + 1);
}
};
return i(s, w(e) ? e.split(".") : e, 0), r ? t : t[0];
return i(n, A(t) ? t.split(".") : t, 0), s ? e : e[0];
}
const Ae = {
const We = {
// Whether the matches should be included in the result set. When `true`, each record in the result

@@ -117,3 +768,3 @@ // set will include the indices of the matched characters.

minMatchCharLength: 1
}, Ie = {
}, Ke = {
// When `true`, the algorithm continues searching to the end of the input even if a perfect

@@ -129,4 +780,4 @@ // match is found before the end of the same input.

// Default sort function: sort by ascending score, ascending index
sortFn: (s, e) => s.score === e.score ? s.idx < e.idx ? -1 : 1 : s.score < e.score ? -1 : 1
}, be = {
sortFn: (n, t) => n.score === t.score ? n.idx < t.idx ? -1 : 1 : n.score < t.score ? -1 : 1
}, Ve = {
// Approximately where in the text is the pattern expected to be found?

@@ -143,3 +794,3 @@ location: 0,

distance: 100
}, _e = {
}, Ye = {
// When `true`, it enables the use of unix-like search commands

@@ -149,3 +800,3 @@ useExtendedSearch: !1,

// The default will search nested paths *ie foo.bar.baz*
getFn: Le,
getFn: Be,
// When `true`, search will ignore `location` and `distance`, so it won't matter

@@ -162,62 +813,62 @@ // where in the string the pattern appears.

};
var d = {
...Ie,
...Ae,
...be,
..._e
var f = {
...Ke,
...We,
...Ve,
...Ye
};
const Re = /[^ ]+/g;
function ve(s = 1, e = 3) {
const t = /* @__PURE__ */ new Map(), r = Math.pow(10, e);
const Ge = /[^ ]+/g;
function Je(n = 1, t = 3) {
const e = /* @__PURE__ */ new Map(), s = Math.pow(10, t);
return {
get(i) {
const c = i.match(Re).length;
if (t.has(c))
return t.get(c);
const n = 1 / Math.pow(c, 0.5 * s), o = parseFloat(Math.round(n * r) / r);
return t.set(c, o), o;
const r = i.match(Ge).length;
if (e.has(r))
return e.get(r);
const o = 1 / Math.pow(r, 0.5 * n), c = parseFloat(Math.round(o * s) / s);
return e.set(r, c), c;
},
clear() {
t.clear();
e.clear();
}
};
}
class V {
class Ct {
constructor({
getFn: e = d.getFn,
fieldNormWeight: t = d.fieldNormWeight
getFn: t = f.getFn,
fieldNormWeight: e = f.fieldNormWeight
} = {}) {
this.norm = ve(t, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
this.norm = Je(e, 3), this.getFn = t, this.isCreated = !1, this.setIndexRecords();
}
setSources(e = []) {
this.docs = e;
setSources(t = []) {
this.docs = t;
}
setIndexRecords(e = []) {
this.records = e;
setIndexRecords(t = []) {
this.records = t;
}
setKeys(e = []) {
this.keys = e, this._keysMap = {}, e.forEach((t, r) => {
this._keysMap[t.id] = r;
setKeys(t = []) {
this.keys = t, this._keysMap = {}, t.forEach((e, s) => {
this._keysMap[e.id] = s;
});
}
create() {
this.isCreated || !this.docs.length || (this.isCreated = !0, w(this.docs[0]) ? this.docs.forEach((e, t) => {
this._addString(e, t);
}) : this.docs.forEach((e, t) => {
this._addObject(e, t);
this.isCreated || !this.docs.length || (this.isCreated = !0, A(this.docs[0]) ? this.docs.forEach((t, e) => {
this._addString(t, e);
}) : this.docs.forEach((t, e) => {
this._addObject(t, e);
}), this.norm.clear());
}
// Adds a doc to the end of the index
add(e) {
const t = this.size();
w(e) ? this._addString(e, t) : this._addObject(e, t);
add(t) {
const e = this.size();
A(t) ? this._addString(t, e) : this._addObject(t, e);
}
// Removes the doc at the specified index of the index
removeAt(e) {
this.records.splice(e, 1);
for (let t = e, r = this.size(); t < r; t += 1)
this.records[t].i -= 1;
removeAt(t) {
this.records.splice(t, 1);
for (let e = t, s = this.size(); e < s; e += 1)
this.records[e].i -= 1;
}
getValueForItemAtKeyId(e, t) {
return e[this._keysMap[t]];
getValueForItemAtKeyId(t, e) {
return t[this._keysMap[e]];
}

@@ -227,48 +878,48 @@ size() {

}
_addString(e, t) {
if (!y(e) || P(e))
_addString(t, e) {
if (!$(t) || gt(t))
return;
let r = {
v: e,
i: t,
n: this.norm.get(e)
let s = {
v: t,
i: e,
n: this.norm.get(t)
};
this.records.push(r);
this.records.push(s);
}
_addObject(e, t) {
let r = { i: t, $: {} };
this.keys.forEach((i, c) => {
let n = i.getFn ? i.getFn(e) : this.getFn(e, i.path);
if (y(n)) {
if (L(n)) {
let o = [];
const l = [{ nestedArrIndex: -1, value: n }];
_addObject(t, e) {
let s = { i: e, $: {} };
this.keys.forEach((i, r) => {
let o = i.getFn ? i.getFn(t) : this.getFn(t, i.path);
if ($(o)) {
if (x(o)) {
let c = [];
const l = [{ nestedArrIndex: -1, value: o }];
for (; l.length; ) {
const { nestedArrIndex: a, value: h } = l.pop();
if (y(h))
if (w(h) && !P(h)) {
let u = {
v: h,
i: a,
n: this.norm.get(h)
const { nestedArrIndex: h, value: u } = l.pop();
if ($(u))
if (A(u) && !gt(u)) {
let a = {
v: u,
i: h,
n: this.norm.get(u)
};
o.push(u);
c.push(a);
} else
L(h) && h.forEach((u, f) => {
x(u) && u.forEach((a, d) => {
l.push({
nestedArrIndex: f,
value: u
nestedArrIndex: d,
value: a
});
});
}
r.$[c] = o;
} else if (w(n) && !P(n)) {
let o = {
v: n,
n: this.norm.get(n)
s.$[r] = c;
} else if (A(o) && !gt(o)) {
let c = {
v: o,
n: this.norm.get(o)
};
r.$[c] = o;
s.$[r] = c;
}
}
}), this.records.push(r);
}), this.records.push(s);
}

@@ -282,206 +933,206 @@ toJSON() {

}
function re(s, e, { getFn: t = d.getFn, fieldNormWeight: r = d.fieldNormWeight } = {}) {
const i = new V({ getFn: t, fieldNormWeight: r });
return i.setKeys(s.map(ie)), i.setSources(e), i.create(), i;
function ne(n, t, { getFn: e = f.getFn, fieldNormWeight: s = f.fieldNormWeight } = {}) {
const i = new Ct({ getFn: e, fieldNormWeight: s });
return i.setKeys(n.map(ie)), i.setSources(t), i.create(), i;
}
function Te(s, { getFn: e = d.getFn, fieldNormWeight: t = d.fieldNormWeight } = {}) {
const { keys: r, records: i } = s, c = new V({ getFn: e, fieldNormWeight: t });
return c.setKeys(r), c.setIndexRecords(i), c;
function Qe(n, { getFn: t = f.getFn, fieldNormWeight: e = f.fieldNormWeight } = {}) {
const { keys: s, records: i } = n, r = new Ct({ getFn: t, fieldNormWeight: e });
return r.setKeys(s), r.setIndexRecords(i), r;
}
function C(s, {
errors: e = 0,
currentLocation: t = 0,
expectedLocation: r = 0,
distance: i = d.distance,
ignoreLocation: c = d.ignoreLocation
function tt(n, {
errors: t = 0,
currentLocation: e = 0,
expectedLocation: s = 0,
distance: i = f.distance,
ignoreLocation: r = f.ignoreLocation
} = {}) {
const n = e / s.length;
if (c)
return n;
const o = Math.abs(r - t);
return i ? n + o / i : o ? 1 : n;
const o = t / n.length;
if (r)
return o;
const c = Math.abs(s - e);
return i ? o + c / i : c ? 1 : o;
}
function ke(s = [], e = d.minMatchCharLength) {
let t = [], r = -1, i = -1, c = 0;
for (let n = s.length; c < n; c += 1) {
let o = s[c];
o && r === -1 ? r = c : !o && r !== -1 && (i = c - 1, i - r + 1 >= e && t.push([r, i]), r = -1);
function Xe(n = [], t = f.minMatchCharLength) {
let e = [], s = -1, i = -1, r = 0;
for (let o = n.length; r < o; r += 1) {
let c = n[r];
c && s === -1 ? s = r : !c && s !== -1 && (i = r - 1, i - s + 1 >= t && e.push([s, i]), s = -1);
}
return s[c - 1] && c - r >= e && t.push([r, c - 1]), t;
return n[r - 1] && r - s >= t && e.push([s, r - 1]), e;
}
const v = 32;
function $e(s, e, t, {
location: r = d.location,
distance: i = d.distance,
threshold: c = d.threshold,
findAllMatches: n = d.findAllMatches,
minMatchCharLength: o = d.minMatchCharLength,
includeMatches: l = d.includeMatches,
ignoreLocation: a = d.ignoreLocation
const N = 32;
function Ze(n, t, e, {
location: s = f.location,
distance: i = f.distance,
threshold: r = f.threshold,
findAllMatches: o = f.findAllMatches,
minMatchCharLength: c = f.minMatchCharLength,
includeMatches: l = f.includeMatches,
ignoreLocation: h = f.ignoreLocation
} = {}) {
if (e.length > v)
throw new Error(Me(v));
const h = e.length, u = s.length, f = Math.max(0, Math.min(r, u));
let g = c, p = f;
const m = o > 1 || l, E = m ? Array(u) : [];
let S;
for (; (S = s.indexOf(e, p)) > -1; ) {
let x = C(e, {
currentLocation: S,
expectedLocation: f,
if (t.length > N)
throw new Error(je(N));
const u = t.length, a = n.length, d = Math.max(0, Math.min(s, a));
let p = r, g = d;
const _ = c > 1 || l, I = _ ? Array(a) : [];
let E;
for (; (E = n.indexOf(t, g)) > -1; ) {
let v = tt(t, {
currentLocation: E,
expectedLocation: d,
distance: i,
ignoreLocation: a
ignoreLocation: h
});
if (g = Math.min(x, g), p = S + h, m) {
let A = 0;
for (; A < h; )
E[S + A] = 1, A += 1;
if (p = Math.min(v, p), g = E + u, _) {
let S = 0;
for (; S < u; )
I[E + S] = 1, S += 1;
}
}
p = -1;
let T = [], R = 1, N = h + u;
const ae = 1 << h - 1;
for (let x = 0; x < h; x += 1) {
let A = 0, I = N;
for (; A < I; )
C(e, {
errors: x,
currentLocation: f + I,
expectedLocation: f,
g = -1;
let H = [], R = 1, Z = u + a;
const he = 1 << u - 1;
for (let v = 0; v < u; v += 1) {
let S = 0, b = Z;
for (; S < b; )
tt(t, {
errors: v,
currentLocation: d + b,
expectedLocation: d,
distance: i,
ignoreLocation: a
}) <= g ? A = I : N = I, I = Math.floor((N - A) / 2 + A);
N = I;
let U = Math.max(1, f - I + 1), H = n ? u : Math.min(f + I, u) + h, k = Array(H + 2);
k[H + 1] = (1 << x) - 1;
for (let M = H; M >= U; M -= 1) {
let O = M - 1, Y = t[s.charAt(O)];
if (m && (E[O] = +!!Y), k[M] = (k[M + 1] << 1 | 1) & Y, x && (k[M] |= (T[M + 1] | T[M]) << 1 | 1 | T[M + 1]), k[M] & ae && (R = C(e, {
errors: x,
currentLocation: O,
expectedLocation: f,
ignoreLocation: h
}) <= p ? S = b : Z = b, b = Math.floor((Z - S) / 2 + S);
Z = b;
let It = Math.max(1, d - b + 1), lt = o ? a : Math.min(d + b, a) + u, U = Array(lt + 2);
U[lt + 1] = (1 << v) - 1;
for (let y = lt; y >= It; y -= 1) {
let q = y - 1, Rt = e[n.charAt(q)];
if (_ && (I[q] = +!!Rt), U[y] = (U[y + 1] << 1 | 1) & Rt, v && (U[y] |= (H[y + 1] | H[y]) << 1 | 1 | H[y + 1]), U[y] & he && (R = tt(t, {
errors: v,
currentLocation: q,
expectedLocation: d,
distance: i,
ignoreLocation: a
}), R <= g)) {
if (g = R, p = O, p <= f)
ignoreLocation: h
}), R <= p)) {
if (p = R, g = q, g <= d)
break;
U = Math.max(1, 2 * f - p);
It = Math.max(1, 2 * d - g);
}
}
if (C(e, {
errors: x + 1,
currentLocation: f,
expectedLocation: f,
if (tt(t, {
errors: v + 1,
currentLocation: d,
expectedLocation: d,
distance: i,
ignoreLocation: a
}) > g)
ignoreLocation: h
}) > p)
break;
T = k;
H = U;
}
const j = {
isMatch: p >= 0,
const ot = {
isMatch: g >= 0,
// Count exact matches (those with a score of 0) to be "almost" exact
score: Math.max(1e-3, R)
};
if (m) {
const x = ke(E, o);
x.length ? l && (j.indices = x) : j.isMatch = !1;
if (_) {
const v = Xe(I, c);
v.length ? l && (ot.indices = v) : ot.isMatch = !1;
}
return j;
return ot;
}
function Ne(s) {
let e = {};
for (let t = 0, r = s.length; t < r; t += 1) {
const i = s.charAt(t);
e[i] = (e[i] || 0) | 1 << r - t - 1;
function qe(n) {
let t = {};
for (let e = 0, s = n.length; e < s; e += 1) {
const i = n.charAt(e);
t[i] = (t[i] || 0) | 1 << s - e - 1;
}
return e;
return t;
}
class ne {
constructor(e, {
location: t = d.location,
threshold: r = d.threshold,
distance: i = d.distance,
includeMatches: c = d.includeMatches,
findAllMatches: n = d.findAllMatches,
minMatchCharLength: o = d.minMatchCharLength,
isCaseSensitive: l = d.isCaseSensitive,
ignoreLocation: a = d.ignoreLocation
class re {
constructor(t, {
location: e = f.location,
threshold: s = f.threshold,
distance: i = f.distance,
includeMatches: r = f.includeMatches,
findAllMatches: o = f.findAllMatches,
minMatchCharLength: c = f.minMatchCharLength,
isCaseSensitive: l = f.isCaseSensitive,
ignoreLocation: h = f.ignoreLocation
} = {}) {
if (this.options = {
location: t,
threshold: r,
location: e,
threshold: s,
distance: i,
includeMatches: c,
findAllMatches: n,
minMatchCharLength: o,
includeMatches: r,
findAllMatches: o,
minMatchCharLength: c,
isCaseSensitive: l,
ignoreLocation: a
}, this.pattern = l ? e : e.toLowerCase(), this.chunks = [], !this.pattern.length)
ignoreLocation: h
}, this.pattern = l ? t : t.toLowerCase(), this.chunks = [], !this.pattern.length)
return;
const h = (f, g) => {
const u = (d, p) => {
this.chunks.push({
pattern: f,
alphabet: Ne(f),
startIndex: g
pattern: d,
alphabet: qe(d),
startIndex: p
});
}, u = this.pattern.length;
if (u > v) {
let f = 0;
const g = u % v, p = u - g;
for (; f < p; )
h(this.pattern.substr(f, v), f), f += v;
if (g) {
const m = u - v;
h(this.pattern.substr(m), m);
}, a = this.pattern.length;
if (a > N) {
let d = 0;
const p = a % N, g = a - p;
for (; d < g; )
u(this.pattern.substr(d, N), d), d += N;
if (p) {
const _ = a - N;
u(this.pattern.substr(_), _);
}
} else
h(this.pattern, 0);
u(this.pattern, 0);
}
searchIn(e) {
const { isCaseSensitive: t, includeMatches: r } = this.options;
if (t || (e = e.toLowerCase()), this.pattern === e) {
let p = {
searchIn(t) {
const { isCaseSensitive: e, includeMatches: s } = this.options;
if (e || (t = t.toLowerCase()), this.pattern === t) {
let g = {
isMatch: !0,
score: 0
};
return r && (p.indices = [[0, e.length - 1]]), p;
return s && (g.indices = [[0, t.length - 1]]), g;
}
const {
location: i,
distance: c,
threshold: n,
findAllMatches: o,
distance: r,
threshold: o,
findAllMatches: c,
minMatchCharLength: l,
ignoreLocation: a
ignoreLocation: h
} = this.options;
let h = [], u = 0, f = !1;
this.chunks.forEach(({ pattern: p, alphabet: m, startIndex: E }) => {
const { isMatch: S, score: T, indices: R } = $e(e, p, m, {
location: i + E,
distance: c,
threshold: n,
findAllMatches: o,
let u = [], a = 0, d = !1;
this.chunks.forEach(({ pattern: g, alphabet: _, startIndex: I }) => {
const { isMatch: E, score: H, indices: R } = Ze(t, g, _, {
location: i + I,
distance: r,
threshold: o,
findAllMatches: c,
minMatchCharLength: l,
includeMatches: r,
ignoreLocation: a
includeMatches: s,
ignoreLocation: h
});
S && (f = !0), u += T, S && R && (h = [...h, ...R]);
E && (d = !0), a += H, E && R && (u = [...u, ...R]);
});
let g = {
isMatch: f,
score: f ? u / this.chunks.length : 1
let p = {
isMatch: d,
score: d ? a / this.chunks.length : 1
};
return f && r && (g.indices = h), g;
return d && s && (p.indices = u), p;
}
}
class _ {
constructor(e) {
this.pattern = e;
class C {
constructor(t) {
this.pattern = t;
}
static isMultiMatch(e) {
return X(e, this.multiRegex);
static isMultiMatch(t) {
return Vt(t, this.multiRegex);
}
static isSingleMatch(e) {
return X(e, this.singleRegex);
static isSingleMatch(t) {
return Vt(t, this.singleRegex);
}

@@ -491,9 +1142,9 @@ search() {

}
function X(s, e) {
const t = s.match(e);
return t ? t[1] : null;
function Vt(n, t) {
const e = n.match(t);
return e ? e[1] : null;
}
class Oe extends _ {
constructor(e) {
super(e);
class ts extends C {
constructor(t) {
super(t);
}

@@ -509,7 +1160,7 @@ static get type() {

}
search(e) {
const t = e === this.pattern;
search(t) {
const e = t === this.pattern;
return {
isMatch: t,
score: t ? 0 : 1,
isMatch: e,
score: e ? 0 : 1,
indices: [0, this.pattern.length - 1]

@@ -519,5 +1170,5 @@ };

}
class Ce extends _ {
constructor(e) {
super(e);
class es extends C {
constructor(t) {
super(t);
}

@@ -533,14 +1184,14 @@ static get type() {

}
search(e) {
const r = e.indexOf(this.pattern) === -1;
search(t) {
const s = t.indexOf(this.pattern) === -1;
return {
isMatch: r,
score: r ? 0 : 1,
indices: [0, e.length - 1]
isMatch: s,
score: s ? 0 : 1,
indices: [0, t.length - 1]
};
}
}
class Fe extends _ {
constructor(e) {
super(e);
class ss extends C {
constructor(t) {
super(t);
}

@@ -556,7 +1207,7 @@ static get type() {

}
search(e) {
const t = e.startsWith(this.pattern);
search(t) {
const e = t.startsWith(this.pattern);
return {
isMatch: t,
score: t ? 0 : 1,
isMatch: e,
score: e ? 0 : 1,
indices: [0, this.pattern.length - 1]

@@ -566,5 +1217,5 @@ };

}
class je extends _ {
constructor(e) {
super(e);
class is extends C {
constructor(t) {
super(t);
}

@@ -580,14 +1231,14 @@ static get type() {

}
search(e) {
const t = !e.startsWith(this.pattern);
search(t) {
const e = !t.startsWith(this.pattern);
return {
isMatch: t,
score: t ? 0 : 1,
indices: [0, e.length - 1]
isMatch: e,
score: e ? 0 : 1,
indices: [0, t.length - 1]
};
}
}
class He extends _ {
constructor(e) {
super(e);
class ns extends C {
constructor(t) {
super(t);
}

@@ -603,14 +1254,14 @@ static get type() {

}
search(e) {
const t = e.endsWith(this.pattern);
search(t) {
const e = t.endsWith(this.pattern);
return {
isMatch: t,
score: t ? 0 : 1,
indices: [e.length - this.pattern.length, e.length - 1]
isMatch: e,
score: e ? 0 : 1,
indices: [t.length - this.pattern.length, t.length - 1]
};
}
}
class Pe extends _ {
constructor(e) {
super(e);
class rs extends C {
constructor(t) {
super(t);
}

@@ -626,31 +1277,31 @@ static get type() {

}
search(e) {
const t = !e.endsWith(this.pattern);
search(t) {
const e = !t.endsWith(this.pattern);
return {
isMatch: t,
score: t ? 0 : 1,
indices: [0, e.length - 1]
isMatch: e,
score: e ? 0 : 1,
indices: [0, t.length - 1]
};
}
}
class ce extends _ {
constructor(e, {
location: t = d.location,
threshold: r = d.threshold,
distance: i = d.distance,
includeMatches: c = d.includeMatches,
findAllMatches: n = d.findAllMatches,
minMatchCharLength: o = d.minMatchCharLength,
isCaseSensitive: l = d.isCaseSensitive,
ignoreLocation: a = d.ignoreLocation
class oe extends C {
constructor(t, {
location: e = f.location,
threshold: s = f.threshold,
distance: i = f.distance,
includeMatches: r = f.includeMatches,
findAllMatches: o = f.findAllMatches,
minMatchCharLength: c = f.minMatchCharLength,
isCaseSensitive: l = f.isCaseSensitive,
ignoreLocation: h = f.ignoreLocation
} = {}) {
super(e), this._bitapSearch = new ne(e, {
location: t,
threshold: r,
super(t), this._bitapSearch = new re(t, {
location: e,
threshold: s,
distance: i,
includeMatches: c,
findAllMatches: n,
minMatchCharLength: o,
includeMatches: r,
findAllMatches: o,
minMatchCharLength: c,
isCaseSensitive: l,
ignoreLocation: a
ignoreLocation: h
});

@@ -667,9 +1318,9 @@ }

}
search(e) {
return this._bitapSearch.searchIn(e);
search(t) {
return this._bitapSearch.searchIn(t);
}
}
class oe extends _ {
constructor(e) {
super(e);
class le extends C {
constructor(t) {
super(t);
}

@@ -685,11 +1336,11 @@ static get type() {

}
search(e) {
let t = 0, r;
const i = [], c = this.pattern.length;
for (; (r = e.indexOf(this.pattern, t)) > -1; )
t = r + c, i.push([r, t - 1]);
const n = !!i.length;
search(t) {
let e = 0, s;
const i = [], r = this.pattern.length;
for (; (s = t.indexOf(this.pattern, e)) > -1; )
e = s + r, i.push([s, e - 1]);
const o = !!i.length;
return {
isMatch: n,
score: n ? 0 : 1,
isMatch: o,
score: o ? 0 : 1,
indices: i

@@ -699,29 +1350,29 @@ };

}
const K = [
Oe,
oe,
Fe,
je,
Pe,
He,
Ce,
ce
], J = K.length, Be = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, Ke = "|";
function We(s, e = {}) {
return s.split(Ke).map((t) => {
let r = t.trim().split(Be).filter((c) => c && !!c.trim()), i = [];
for (let c = 0, n = r.length; c < n; c += 1) {
const o = r[c];
let l = !1, a = -1;
for (; !l && ++a < J; ) {
const h = K[a];
let u = h.isMultiMatch(o);
u && (i.push(new h(u, e)), l = !0);
const yt = [
ts,
le,
ss,
is,
rs,
ns,
es,
oe
], Yt = yt.length, os = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, ls = "|";
function cs(n, t = {}) {
return n.split(ls).map((e) => {
let s = e.trim().split(os).filter((r) => r && !!r.trim()), i = [];
for (let r = 0, o = s.length; r < o; r += 1) {
const c = s[r];
let l = !1, h = -1;
for (; !l && ++h < Yt; ) {
const u = yt[h];
let a = u.isMultiMatch(c);
a && (i.push(new u(a, t)), l = !0);
}
if (!l)
for (a = -1; ++a < J; ) {
const h = K[a];
let u = h.isSingleMatch(o);
if (u) {
i.push(new h(u, e));
for (h = -1; ++h < Yt; ) {
const u = yt[h];
let a = u.isSingleMatch(c);
if (a) {
i.push(new u(a, t));
break;

@@ -734,31 +1385,31 @@ }

}
const De = /* @__PURE__ */ new Set([ce.type, oe.type]);
class ze {
constructor(e, {
isCaseSensitive: t = d.isCaseSensitive,
includeMatches: r = d.includeMatches,
minMatchCharLength: i = d.minMatchCharLength,
ignoreLocation: c = d.ignoreLocation,
findAllMatches: n = d.findAllMatches,
location: o = d.location,
threshold: l = d.threshold,
distance: a = d.distance
const hs = /* @__PURE__ */ new Set([oe.type, le.type]);
class as {
constructor(t, {
isCaseSensitive: e = f.isCaseSensitive,
includeMatches: s = f.includeMatches,
minMatchCharLength: i = f.minMatchCharLength,
ignoreLocation: r = f.ignoreLocation,
findAllMatches: o = f.findAllMatches,
location: c = f.location,
threshold: l = f.threshold,
distance: h = f.distance
} = {}) {
this.query = null, this.options = {
isCaseSensitive: t,
includeMatches: r,
isCaseSensitive: e,
includeMatches: s,
minMatchCharLength: i,
findAllMatches: n,
ignoreLocation: c,
location: o,
findAllMatches: o,
ignoreLocation: r,
location: c,
threshold: l,
distance: a
}, this.pattern = t ? e : e.toLowerCase(), this.query = We(this.pattern, this.options);
distance: h
}, this.pattern = e ? t : t.toLowerCase(), this.query = cs(this.pattern, this.options);
}
static condition(e, t) {
return t.useExtendedSearch;
static condition(t, e) {
return e.useExtendedSearch;
}
searchIn(e) {
const t = this.query;
if (!t)
searchIn(t) {
const e = this.query;
if (!e)
return {

@@ -768,26 +1419,26 @@ isMatch: !1,

};
const { includeMatches: r, isCaseSensitive: i } = this.options;
e = i ? e : e.toLowerCase();
let c = 0, n = [], o = 0;
for (let l = 0, a = t.length; l < a; l += 1) {
const h = t[l];
n.length = 0, c = 0;
for (let u = 0, f = h.length; u < f; u += 1) {
const g = h[u], { isMatch: p, indices: m, score: E } = g.search(e);
if (p) {
if (c += 1, o += E, r) {
const S = g.constructor.type;
De.has(S) ? n = [...n, ...m] : n.push(m);
const { includeMatches: s, isCaseSensitive: i } = this.options;
t = i ? t : t.toLowerCase();
let r = 0, o = [], c = 0;
for (let l = 0, h = e.length; l < h; l += 1) {
const u = e[l];
o.length = 0, r = 0;
for (let a = 0, d = u.length; a < d; a += 1) {
const p = u[a], { isMatch: g, indices: _, score: I } = p.search(t);
if (g) {
if (r += 1, c += I, s) {
const E = p.constructor.type;
hs.has(E) ? o = [...o, ..._] : o.push(_);
}
} else {
o = 0, c = 0, n.length = 0;
c = 0, r = 0, o.length = 0;
break;
}
}
if (c) {
let u = {
if (r) {
let a = {
isMatch: !0,
score: o / c
score: c / r
};
return r && (u.indices = n), u;
return s && (a.indices = o), a;
}

@@ -801,105 +1452,105 @@ }

}
const W = [];
function qe(...s) {
W.push(...s);
const At = [];
function us(...n) {
At.push(...n);
}
function D(s, e) {
for (let t = 0, r = W.length; t < r; t += 1) {
let i = W[t];
if (i.condition(s, e))
return new i(s, e);
function Et(n, t) {
for (let e = 0, s = At.length; e < s; e += 1) {
let i = At[e];
if (i.condition(n, t))
return new i(n, t);
}
return new ne(s, e);
return new re(n, t);
}
const F = {
const nt = {
AND: "$and",
OR: "$or"
}, z = {
}, xt = {
PATH: "$path",
PATTERN: "$val"
}, q = (s) => !!(s[F.AND] || s[F.OR]), Ve = (s) => !!s[z.PATH], Ue = (s) => !L(s) && te(s) && !q(s), Z = (s) => ({
[F.AND]: Object.keys(s).map((e) => ({
[e]: s[e]
}, St = (n) => !!(n[nt.AND] || n[nt.OR]), ds = (n) => !!n[xt.PATH], fs = (n) => !x(n) && ee(n) && !St(n), Gt = (n) => ({
[nt.AND]: Object.keys(n).map((t) => ({
[t]: n[t]
}))
});
function le(s, e, { auto: t = !0 } = {}) {
const r = (i) => {
let c = Object.keys(i);
const n = Ve(i);
if (!n && c.length > 1 && !q(i))
return r(Z(i));
if (Ue(i)) {
const l = n ? i[z.PATH] : c[0], a = n ? i[z.PATTERN] : i[l];
if (!w(a))
throw new Error(xe(l));
const h = {
keyId: B(l),
pattern: a
function ce(n, t, { auto: e = !0 } = {}) {
const s = (i) => {
let r = Object.keys(i);
const o = ds(i);
if (!o && r.length > 1 && !St(i))
return s(Gt(i));
if (fs(i)) {
const l = o ? i[xt.PATH] : r[0], h = o ? i[xt.PATTERN] : i[l];
if (!A(h))
throw new Error(Ue(l));
const u = {
keyId: vt(l),
pattern: h
};
return t && (h.searcher = D(a, e)), h;
return e && (u.searcher = Et(h, t)), u;
}
let o = {
let c = {
children: [],
operator: c[0]
operator: r[0]
};
return c.forEach((l) => {
const a = i[l];
L(a) && a.forEach((h) => {
o.children.push(r(h));
return r.forEach((l) => {
const h = i[l];
x(h) && h.forEach((u) => {
c.children.push(s(u));
});
}), o;
}), c;
};
return q(s) || (s = Z(s)), r(s);
return St(n) || (n = Gt(n)), s(n);
}
function Ye(s, { ignoreFieldNorm: e = d.ignoreFieldNorm }) {
s.forEach((t) => {
let r = 1;
t.matches.forEach(({ key: i, norm: c, score: n }) => {
const o = i ? i.weight : null;
r *= Math.pow(
n === 0 && o ? Number.EPSILON : n,
(o || 1) * (e ? 1 : c)
function ps(n, { ignoreFieldNorm: t = f.ignoreFieldNorm }) {
n.forEach((e) => {
let s = 1;
e.matches.forEach(({ key: i, norm: r, score: o }) => {
const c = i ? i.weight : null;
s *= Math.pow(
o === 0 && c ? Number.EPSILON : o,
(c || 1) * (t ? 1 : r)
);
}), t.score = r;
}), e.score = s;
});
}
function Ge(s, e) {
const t = s.matches;
e.matches = [], y(t) && t.forEach((r) => {
if (!y(r.indices) || !r.indices.length)
function gs(n, t) {
const e = n.matches;
t.matches = [], $(e) && e.forEach((s) => {
if (!$(s.indices) || !s.indices.length)
return;
const { indices: i, value: c } = r;
let n = {
const { indices: i, value: r } = s;
let o = {
indices: i,
value: c
value: r
};
r.key && (n.key = r.key.src), r.idx > -1 && (n.refIndex = r.idx), e.matches.push(n);
s.key && (o.key = s.key.src), s.idx > -1 && (o.refIndex = s.idx), t.matches.push(o);
});
}
function Qe(s, e) {
e.score = s.score;
function ms(n, t) {
t.score = n.score;
}
function Xe(s, e, {
includeMatches: t = d.includeMatches,
includeScore: r = d.includeScore
function _s(n, t, {
includeMatches: e = f.includeMatches,
includeScore: s = f.includeScore
} = {}) {
const i = [];
return t && i.push(Ge), r && i.push(Qe), s.map((c) => {
const { idx: n } = c, o = {
item: e[n],
refIndex: n
return e && i.push(gs), s && i.push(ms), n.map((r) => {
const { idx: o } = r, c = {
item: t[o],
refIndex: o
};
return i.length && i.forEach((l) => {
l(c, o);
}), o;
l(r, c);
}), c;
});
}
class $ {
constructor(e, t = {}, r) {
this.options = { ...d, ...t }, this.options.useExtendedSearch, this._keyStore = new Se(this.options.keys), this.setCollection(e, r);
class B {
constructor(t, e = {}, s) {
this.options = { ...f, ...e }, this.options.useExtendedSearch, this._keyStore = new De(this.options.keys), this.setCollection(t, s);
}
setCollection(e, t) {
if (this._docs = e, t && !(t instanceof V))
throw new Error(ye);
this._myIndex = t || re(this.options.keys, this._docs, {
setCollection(t, e) {
if (this._docs = t, e && !(e instanceof Ct))
throw new Error(He);
this._myIndex = e || ne(this.options.keys, this._docs, {
getFn: this.options.getFn,

@@ -909,15 +1560,15 @@ fieldNormWeight: this.options.fieldNormWeight

}
add(e) {
y(e) && (this._docs.push(e), this._myIndex.add(e));
add(t) {
$(t) && (this._docs.push(t), this._myIndex.add(t));
}
remove(e = () => !1) {
const t = [];
for (let r = 0, i = this._docs.length; r < i; r += 1) {
const c = this._docs[r];
e(c, r) && (this.removeAt(r), r -= 1, i -= 1, t.push(c));
remove(t = () => !1) {
const e = [];
for (let s = 0, i = this._docs.length; s < i; s += 1) {
const r = this._docs[s];
t(r, s) && (this.removeAt(s), s -= 1, i -= 1, e.push(r));
}
return t;
return e;
}
removeAt(e) {
this._docs.splice(e, 1), this._myIndex.removeAt(e);
removeAt(t) {
this._docs.splice(t, 1), this._myIndex.removeAt(t);
}

@@ -927,106 +1578,106 @@ getIndex() {

}
search(e, { limit: t = -1 } = {}) {
search(t, { limit: e = -1 } = {}) {
const {
includeMatches: r,
includeMatches: s,
includeScore: i,
shouldSort: c,
sortFn: n,
ignoreFieldNorm: o
shouldSort: r,
sortFn: o,
ignoreFieldNorm: c
} = this.options;
let l = w(e) ? w(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e);
return Ye(l, { ignoreFieldNorm: o }), c && l.sort(n), ee(t) && t > -1 && (l = l.slice(0, t)), Xe(l, this._docs, {
includeMatches: r,
let l = A(t) ? A(this._docs[0]) ? this._searchStringList(t) : this._searchObjectList(t) : this._searchLogical(t);
return ps(l, { ignoreFieldNorm: c }), r && l.sort(o), te(e) && e > -1 && (l = l.slice(0, e)), _s(l, this._docs, {
includeMatches: s,
includeScore: i
});
}
_searchStringList(e) {
const t = D(e, this.options), { records: r } = this._myIndex, i = [];
return r.forEach(({ v: c, i: n, n: o }) => {
if (!y(c))
_searchStringList(t) {
const e = Et(t, this.options), { records: s } = this._myIndex, i = [];
return s.forEach(({ v: r, i: o, n: c }) => {
if (!$(r))
return;
const { isMatch: l, score: a, indices: h } = t.searchIn(c);
const { isMatch: l, score: h, indices: u } = e.searchIn(r);
l && i.push({
item: c,
idx: n,
matches: [{ score: a, value: c, norm: o, indices: h }]
item: r,
idx: o,
matches: [{ score: h, value: r, norm: c, indices: u }]
});
}), i;
}
_searchLogical(e) {
const t = le(e, this.options), r = (o, l, a) => {
if (!o.children) {
const { keyId: u, searcher: f } = o, g = this._findMatches({
key: this._keyStore.get(u),
value: this._myIndex.getValueForItemAtKeyId(l, u),
searcher: f
_searchLogical(t) {
const e = ce(t, this.options), s = (c, l, h) => {
if (!c.children) {
const { keyId: a, searcher: d } = c, p = this._findMatches({
key: this._keyStore.get(a),
value: this._myIndex.getValueForItemAtKeyId(l, a),
searcher: d
});
return g && g.length ? [
return p && p.length ? [
{
idx: a,
idx: h,
item: l,
matches: g
matches: p
}
] : [];
}
const h = [];
for (let u = 0, f = o.children.length; u < f; u += 1) {
const g = o.children[u], p = r(g, l, a);
if (p.length)
h.push(...p);
else if (o.operator === F.AND)
const u = [];
for (let a = 0, d = c.children.length; a < d; a += 1) {
const p = c.children[a], g = s(p, l, h);
if (g.length)
u.push(...g);
else if (c.operator === nt.AND)
return [];
}
return h;
}, i = this._myIndex.records, c = {}, n = [];
return i.forEach(({ $: o, i: l }) => {
if (y(o)) {
let a = r(t, o, l);
a.length && (c[l] || (c[l] = { idx: l, item: o, matches: [] }, n.push(c[l])), a.forEach(({ matches: h }) => {
c[l].matches.push(...h);
return u;
}, i = this._myIndex.records, r = {}, o = [];
return i.forEach(({ $: c, i: l }) => {
if ($(c)) {
let h = s(e, c, l);
h.length && (r[l] || (r[l] = { idx: l, item: c, matches: [] }, o.push(r[l])), h.forEach(({ matches: u }) => {
r[l].matches.push(...u);
}));
}
}), n;
}), o;
}
_searchObjectList(e) {
const t = D(e, this.options), { keys: r, records: i } = this._myIndex, c = [];
return i.forEach(({ $: n, i: o }) => {
if (!y(n))
_searchObjectList(t) {
const e = Et(t, this.options), { keys: s, records: i } = this._myIndex, r = [];
return i.forEach(({ $: o, i: c }) => {
if (!$(o))
return;
let l = [];
r.forEach((a, h) => {
s.forEach((h, u) => {
l.push(
...this._findMatches({
key: a,
value: n[h],
searcher: t
key: h,
value: o[u],
searcher: e
})
);
}), l.length && c.push({
idx: o,
item: n,
}), l.length && r.push({
idx: c,
item: o,
matches: l
});
}), c;
}), r;
}
_findMatches({ key: e, value: t, searcher: r }) {
if (!y(t))
_findMatches({ key: t, value: e, searcher: s }) {
if (!$(e))
return [];
let i = [];
if (L(t))
t.forEach(({ v: c, i: n, n: o }) => {
if (!y(c))
if (x(e))
e.forEach(({ v: r, i: o, n: c }) => {
if (!$(r))
return;
const { isMatch: l, score: a, indices: h } = r.searchIn(c);
const { isMatch: l, score: h, indices: u } = s.searchIn(r);
l && i.push({
score: a,
key: e,
value: c,
idx: n,
norm: o,
indices: h
score: h,
key: t,
value: r,
idx: o,
norm: c,
indices: u
});
});
else {
const { v: c, n } = t, { isMatch: o, score: l, indices: a } = r.searchIn(c);
o && i.push({ score: l, key: e, value: c, norm: n, indices: a });
const { v: r, n: o } = e, { isMatch: c, score: l, indices: h } = s.searchIn(r);
c && i.push({ score: l, key: t, value: r, norm: o, indices: h });
}

@@ -1036,10 +1687,38 @@ return i;

}
$.version = "6.6.2";
$.createIndex = re;
$.parseIndex = Te;
$.config = d;
$.parseQuery = le;
qe(ze);
const Je = `
<style>
B.version = "6.6.2";
B.createIndex = ne;
B.parseIndex = Qe;
B.config = f;
B.parseQuery = ce;
us(as);
const $s = (n, t = "highlight") => {
const e = (i, r, o) => {
const c = r.split(".");
let l;
for (l = 0; l < c.length - 1; l++)
i = i[c[l]];
i[c[l]] = o;
}, s = (i, r = []) => {
let o = "", c = 0;
return r.forEach((l) => {
const h = l[1] + 1;
o += [
i.substring(c, l[0]),
`<mark class="${t}">`,
i.substring(l[0], h),
"</mark>"
].join(""), c = h;
}), o += i.substring(c), o;
};
return n.filter(({ matches: i }) => i && i.length).map(({ item: i, matches: r }) => {
const o = { ...i };
return r.forEach((c) => {
c.key === "name" && e(
o,
c.key,
s(c.value, c.indices)
);
}), o;
});
}, vs = `
:host {

@@ -1051,3 +1730,5 @@ display: flex;

}
*, *:before, *:after {
*,
*:before,
*:after {
box-sizing: inherit;

@@ -1057,2 +1738,3 @@ }

height: 100%;
width: 100%;
max-width: 100%;

@@ -1117,13 +1799,12 @@ display: flex;

details,
input[type=checkbox],
input[type=radio] {
input[type="checkbox"],
input[type="radio"] {
cursor: pointer;
}
input[type=checkbox],
input[type=radio] {
input[type="checkbox"],
input[type="radio"] {
margin: 0;
margin-right: 0.5rem;
}
input[type=text] {
display: none;
input[type="text"] {
width: 100%;

@@ -1159,224 +1840,70 @@ margin-bottom: 0.5rem;

}
</style>
<form>
<section>
<input type="text" placeholder="Search" />
</section>
<section>
<slot name="filterstitle"></slot>
<ul id="filters"></ul>
</section>
<section id="section-results">
<div>
<slot name="resultstitle"></slot>
</div>
<div id="container-results" class="scroll">
<ul id="results"></ul>
</div>
</section>
</form>
`, Ze = `
<li>
<label>
<input type="checkbox" />
<span class="title">FILTERITEMTITLE</span>
</label>
</li>
`, et = `
<details id="details-filter">
<summary>
<small>
<strong class="title">
FILTERTITLE
</strong>
</small>
<div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>chevron-down</title><path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z" /></svg>
</div>
</summary>
<ul></ul>
</details>
`, tt = `
<li>
<label>
<input type="radio" name="result" />
<span class="title">RESULTTITLE</span>
</label>
</li>
`, st = `
<details id="details-results" open>
<summary>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>chevron-down</title><path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z" /></svg>
<strong class="title">
SUMMARYTITLE
</strong>
<span style="margin-left: 0.25rem">(<span class="count"></span>)</span>
</summary>
<ul></ul>
</details>
`, it = (s, e = "highlight") => {
const t = (i, c, n) => {
const o = c.split(".");
let l;
for (l = 0; l < o.length - 1; l++)
i = i[o[l]];
i[o[l]] = n;
}, r = (i, c = []) => {
let n = "", o = 0;
return c.forEach((l) => {
const a = l[1] + 1;
n += [
i.substring(o, l[0]),
`<mark class="${e}">`,
i.substring(l[0], a),
"</mark>"
].join(""), o = a;
}), n += i.substring(o), n;
};
return s.filter(({ matches: i }) => i && i.length).map(({ item: i, matches: c }) => {
const n = { ...i };
return c.forEach((o) => {
o.key === "name" && t(
n,
o.key,
r(o.value, o.indices)
);
}), n;
});
`;
var ys = Object.defineProperty, As = Object.getOwnPropertyDescriptor, W = (n, t, e, s) => {
for (var i = s > 1 ? void 0 : s ? As(t, e) : t, r = n.length - 1, o; r >= 0; r--)
(o = n[r]) && (i = (s ? o(t, e, i) : o(i)) || i);
return s && i && ys(t, e, i), i;
};
class rt extends HTMLElement {
let P = class extends Y {
constructor() {
super();
b(this, "shadowRoot");
/**
* Apply JSON items to itemfilter.
* @param json
*/
b(this, "apply");
b(this, "items");
b(this, "fuse");
// TODO proper typing
b(this, "filters");
b(this, "aggregateBy");
b(this, "config");
this.filters = {}, this.shadowRoot = this.attachShadow({ mode: "open" });
const t = document.createElement("template");
t.innerHTML = Je, this.shadowRoot.appendChild(t.content.cloneNode(!0)), this.apply = (n) => {
this.config.enableSearch && (this.shadowRoot.querySelector("input[type=text").style.display = "block"), this.items = n, this.fuse = new $(this.items, {
super(...arguments);
w(this, "_fuse");
w(this, "_resultAggregation", []);
w(this, "_items", []);
w(this, "_results", []);
w(this, "_filters", {});
w(this, "config", {
filterProperties: ["themes"],
aggregateResults: "themes",
fuseConfig: {},
enableSearch: !0,
enableHighlighting: !1,
onSelect: () => {
},
matchAllWhenEmpty: !0,
exclusiveFilters: !1
});
w(this, "apply", (t) => {
this._items = t, this._fuse = new B(this._items, {
minMatchCharLength: 1,
includeMatches: !0,
// Search in same fields as specified by filter properties, plus name
// @ts-ignore
keys: ["name", ...this.config.filterProperties],
useExtendedSearch: !0,
...this.config.fuseConfig
}), this.config.filterProperties.forEach((o) => {
const l = [
...new Set(
this.items.reduce((f, g) => f.concat(g[o]), [])
)
].sort(), a = this.shadowRoot.querySelector("ul#filters"), h = document.createElement("template");
h.innerHTML = et;
const u = h.content.cloneNode(!0);
u.querySelector(".title").innerHTML = o, u.querySelector("details").setAttribute("data-filter", o), a.appendChild(u), l.forEach((f) => {
const g = document.createElement("template");
g.innerHTML = Ze;
const p = g.content.cloneNode(!0), m = p.querySelector("input[type='checkbox']");
m.setAttribute("data-filter-key", o), m.setAttribute("name", "filter"), this.config.exclusiveFilters === !0 && (m.type = "radio"), m.setAttribute("data-filter-value", f), p.querySelector("span.title").innerHTML = f, this.shadowRoot.querySelector(`details[data-filter='${o}']`).appendChild(p);
}), this.config.aggregateResults === o && (this.aggregateBy = l);
}), r(), this.config.matchAllWhenEmpty !== !1 && i(this.items);
};
const r = () => {
const n = this.shadowRoot.querySelectorAll(
`input[type="${this.config.exclusiveFilters === !0 ? "radio" : "checkbox"}"]`
), o = (l) => {
n.forEach((a) => {
var f, g;
const h = a.getAttribute("data-filter-key"), u = a.getAttribute("data-filter-value");
if (a.checked)
this.filters[h] || (this.filters[h] = []), this.filters[h].includes(u) || this.filters[h].push(u);
else {
if (l === a) {
if (!this.filters[h])
return;
this.filters[h].splice(
// @ts-ignore
this.filters[h].indexOf(u),
1
);
} else
this.config.exclusiveFilters === !0 && // @ts-ignore
this.filters[h] && // @ts-ignore
this.filters[h].includes(u) && ((f = this.filters[h]) == null || f.splice(
// @ts-ignore
this.filters[h].indexOf(u),
1
));
((g = this.filters[h]) == null ? void 0 : g.length) === 0 && delete this.filters[h];
}
});
};
n.forEach((l) => {
l.addEventListener("click", (a) => {
o(a.target), this.config.matchAllWhenEmpty !== !1 && Object.keys(this.filters).length === 0 ? i(this.items) : c(
// @ts-ignore
this.shadowRoot.querySelector("input[type='text']").value
);
});
});
}, i = (n) => {
const o = this.shadowRoot.querySelector("ul#results");
if (o.innerHTML = "", this.config.aggregateResults) {
const l = document.createElement("template");
l.innerHTML = st, this.aggregateBy.forEach((a) => {
if (
// @ts-ignore
!n.find(
(u) => Array.isArray(u[this.config.aggregateResults]) ? u[this.config.aggregateResults].includes(a) : u[this.config.aggregateResults] === a
)
)
return;
const h = l.content.cloneNode(!0);
h.querySelector("summary .title").innerHTML = a, h.querySelector("details").setAttribute("data-aggregate", a), o.appendChild(h);
});
}
n.forEach((l) => {
const a = document.createElement("template");
a.innerHTML = tt;
const h = a.content.cloneNode(!0);
h.querySelector(".title").innerHTML = l.name;
let u;
if (this.aggregateBy) {
const f = l[this.config.aggregateResults];
Array.isArray(f) ? f.forEach((g) => {
u = this.shadowRoot.querySelector(
`details[data-aggregate=${g}]`
);
}) : u = this.shadowRoot.querySelector(
`details[data-aggregate=${f}]`
);
} else
u = o;
h.querySelector("input").addEventListener("click", () => {
this.config.onSelect && this.config.onSelect(l);
}), u.appendChild(h);
}), this.config.aggregateResults && this.shadowRoot.querySelectorAll("#results details").forEach((a) => {
a.querySelector("summary .count").innerHTML = a.querySelectorAll("li").length;
});
}, c = (n, o = this.filters) => {
const l = Object.entries(o).reduce(
(u, [f, g]) => {
const p = (m) => {
const E = {};
E[f] = `=${m}`, u.push(E);
};
return Array.isArray(g) ? g.forEach((m) => p(m)) : p(g), u;
},
[]
), a = this.fuse.search({
...n.length && Object.keys(l).length ? {
}), this.config.filterProperties.forEach((e) => {
const s = {};
this._items.forEach((i) => {
Array.isArray(i[e]) ? i[e].forEach((r) => {
s[r] = void 0;
}) : s[i[e]] = void 0;
}), this._filters[e] = s;
}), this.config.matchAllWhenEmpty !== !1 && (this._results = this._items, this.requestUpdate()), this.config.aggregateResults && (this._resultAggregation = [
...new Set(
this._items.reduce((e, s) => e.concat(s[this.config.aggregateResults]), [])
)
].sort());
});
}
search(t = "", e = this._filters) {
const s = Object.entries(e).reduce(
(r, [o, c]) => {
const l = (h) => {
const u = {};
u[o] = `=${h}`, r.push(u);
};
return Object.entries(c).filter(([h, u]) => u).forEach(([h, u]) => l(h)), r;
},
[]
);
let i;
if (!t.length && !s.length && this.config.matchAllWhenEmpty !== !1)
i = this._items;
else {
const r = {
...t.length && s.length ? {
$and: [
{ name: n },
{ name: t },
{
$or: l
$or: s
}

@@ -1386,23 +1913,181 @@ ]

$or: [
{ name: n },
{ name: t },
{
$or: l
$or: s
}
]
}
}), h = this.config.enableHighlighting ? it(a) : (
// @ts-ignore
a.map((u) => u.item)
);
i(h);
};
this.shadowRoot.querySelector("input[type='text']").addEventListener("input", (n) => {
const o = n.target.value;
!o && this.config.matchAllWhenEmpty !== !1 ? i(this.items) : c(o);
}, o = this._fuse.search(r);
i = this.config.enableHighlighting ? $s(o) : o.map((c) => c.item);
}
this._results = i, this.requestUpdate();
}
aggregateResults(t, e) {
return t.filter((s) => {
const i = s[this.config.aggregateResults];
return Array.isArray(i) ? i.includes(e) : i === e;
});
}
}
customElements.define("eox-itemfilter", rt);
toggleFilter(t, e) {
this.config.exclusiveFilters === !0 && Object.keys(this._filters).forEach((s) => {
Object.keys(this._filters[s]).forEach((i) => {
this._filters[s][i] = !1;
});
}), this._filters[t][e] = !this._filters[t][e], console.log(this._filters), this.search();
}
render() {
return j`
<style>
${vs}
</style>
<form>
<section>
<input
type="text"
placeholder="Search"
style="display:${this.config.enableSearch ? "block" : "none"}"
@input="${(t) => this.search(t.target.value)}"
/>
</section>
<section>
<slot name="filterstitle"></slot>
<ul id="filters">
${V(
this.config.filterProperties,
(t) => j`
<details id="details-filter">
<summary>
<small>
<strong class="title"> ${t} </strong>
</small>
<div>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
>
<title>chevron-down</title>
<path
d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"
/>
</svg>
</div>
</summary>
<ul>
${// @ts-ignore
this._filters[t] ? V(
// @ts-ignore
Object.keys(this._filters[t]).sort(),
(e) => j`
<li>
<label>
<input
name="selection"
type="${this.config.exclusiveFilters === !0 ? "radio" : "checkbox"}"
checked="${// @ts-ignore
this._filters[t][e] || m}"
@click=${() => this.toggleFilter(t, e)}
/>
<span class="title">${e}</span>
</label>
</li>
`
) : null}
</ul>
</details>
`
)}
</ul>
</section>
<section id="section-results">
<div>
<slot name="resultstitle"></slot>
</div>
<div id="container-results" class="scroll">
<ul id="results">
${this.config.aggregateResults ? V(
this._resultAggregation.filter(
(t) => this.aggregateResults(
this._results,
t
).length
),
(t) => j`<details
id="details-results"
open
>
<summary>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
>
<title>chevron-down</title>
<path
d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"
/>
</svg>
<strong class="title"> ${t} </strong>
<span style="margin-left: 0.25rem"
>(${this.aggregateResults(
this._results,
t
).length})</span
>
</summary>
<ul>
${V(
this.aggregateResults(
this._results,
t
),
// @ts-ignore
(e) => j`
<li>
<label>
<input
type="radio"
name="result"
@click=${() => this.config.onSelect(e)}
/>
<span class="title"
>${// @ts-ignore
Bt(e.name)}</span
>
</label>
</li>
`
)}
</ul>
</details>`
) : V(
this._results,
// @ts-ignore
(t) => j`<li>${Bt(t.name)}</li>`
)}
</ul>
</div>
</section>
</form>
`;
}
};
W([
Mt()
], P.prototype, "_items", 2);
W([
Mt()
], P.prototype, "_results", 2);
W([
Mt()
], P.prototype, "_filters", 2);
W([
wt({ attribute: !1 })
], P.prototype, "config", 2);
W([
wt()
], P.prototype, "apply", 2);
P = W([
Me("eox-itemfilter")
], P);
export {
rt as EOxItemFilter
P as EOxItemFilter
};
{
"name": "@eox/itemfilter",
"version": "0.1.0",
"version": "0.2.0",
"type": "module",

@@ -28,4 +28,5 @@ "devDependencies": {

"dependencies": {
"fuse.js": "^6.6.2"
"fuse.js": "^6.6.2",
"lit": "^2.7.4"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc