🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@headless-primitives/context-menu

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@headless-primitives/context-menu - npm Package Compare versions

Comparing version
1.0.0
to
1.1.0
+256
-241
dist/index.js

@@ -1,2 +0,2 @@

var D = globalThis, G = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, bt = Symbol(), et = /* @__PURE__ */ new WeakMap(), Mt = class {
var D = globalThis, X = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, bt = Symbol(), et = /* @__PURE__ */ new WeakMap(), Mt = class {
constructor(t, s, i) {

@@ -8,3 +8,3 @@ if (this._$cssResult$ = !0, i !== bt) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");

let t = this.o, s = this.t;
if (G && t === void 0) {
if (X && t === void 0) {
let i = s !== void 0 && s.length === 1;

@@ -19,3 +19,3 @@ i && (t = et.get(s)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && et.set(s, t));

}, Rt = (e) => new Mt(typeof e == "string" ? e : e + "", void 0, bt), kt = (e, t) => {
if (G) e.adoptedStyleSheets = t.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
if (X) e.adoptedStyleSheets = t.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
else for (let s of t) {

@@ -25,7 +25,7 @@ let i = document.createElement("style"), r = D.litNonce;

}
}, st = G ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
}, st = X ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((t) => {
let s = "";
for (let i of t.cssRules) s += i.cssText;
return Rt(s);
})(e) : e, { is: Tt, defineProperty: Dt, getOwnPropertyDescriptor: Ht, getOwnPropertyNames: It, getOwnPropertySymbols: Lt, getPrototypeOf: Nt } = Object, z = globalThis, it = z.trustedTypes, zt = it ? it.emptyScript : "", jt = z.reactiveElementPolyfillSupport, x = (e, t) => e, V = {
})(e) : e, { is: Tt, defineProperty: Dt, getOwnPropertyDescriptor: Ht, getOwnPropertyNames: It, getOwnPropertySymbols: Nt, getPrototypeOf: Lt } = Object, z = globalThis, it = z.trustedTypes, zt = it ? it.emptyScript : "", jt = z.reactiveElementPolyfillSupport, x = (e, t) => e, V = {
toAttribute(e, t) {

@@ -71,4 +71,4 @@ switch (t) {

var b = class extends HTMLElement {
static addInitializer(t) {
this._$Ei(), (this.l ??= []).push(t);
static addInitializer(e) {
this._$Ei(), (this.l ??= []).push(e);
}

@@ -78,22 +78,22 @@ static get observedAttributes() {

}
static createProperty(t, s = rt) {
if (s.state && (s.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = !0), this.elementProperties.set(t, s), !s.noAccessor) {
let i = Symbol(), r = this.getPropertyDescriptor(t, i, s);
r !== void 0 && Dt(this.prototype, t, r);
static createProperty(e, t = rt) {
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
let s = Symbol(), i = this.getPropertyDescriptor(e, s, t);
i !== void 0 && Dt(this.prototype, e, i);
}
}
static getPropertyDescriptor(t, s, i) {
let { get: r, set: n } = Ht(this.prototype, t) ?? {
static getPropertyDescriptor(e, t, s) {
let { get: i, set: r } = Ht(this.prototype, e) ?? {
get() {
return this[s];
return this[t];
},
set(o) {
this[s] = o;
set(n) {
this[t] = n;
}
};
return {
get: r,
set(o) {
let h = r?.call(this);
n?.call(this, o), this.requestUpdate(t, h, i);
get: i,
set(n) {
let o = i?.call(this);
r?.call(this, n), this.requestUpdate(e, o, s);
},

@@ -104,9 +104,9 @@ configurable: !0,

}
static getPropertyOptions(t) {
return this.elementProperties.get(t) ?? rt;
static getPropertyOptions(e) {
return this.elementProperties.get(e) ?? rt;
}
static _$Ei() {
if (this.hasOwnProperty(x("elementProperties"))) return;
let t = Nt(this);
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
let e = Lt(this);
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
}

@@ -116,28 +116,28 @@ static finalize() {

if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(x("properties"))) {
let s = this.properties, i = [...It(s), ...Lt(s)];
for (let r of i) this.createProperty(r, s[r]);
let t = this.properties, s = [...It(t), ...Nt(t)];
for (let i of s) this.createProperty(i, t[i]);
}
let t = this[Symbol.metadata];
if (t !== null) {
let s = litPropertyMetadata.get(t);
if (s !== void 0) for (let [i, r] of s) this.elementProperties.set(i, r);
let e = this[Symbol.metadata];
if (e !== null) {
let t = litPropertyMetadata.get(e);
if (t !== void 0) for (let [s, i] of t) this.elementProperties.set(s, i);
}
this._$Eh = /* @__PURE__ */ new Map();
for (let [s, i] of this.elementProperties) {
let r = this._$Eu(s, i);
r !== void 0 && this._$Eh.set(r, s);
for (let [t, s] of this.elementProperties) {
let i = this._$Eu(t, s);
i !== void 0 && this._$Eh.set(i, t);
}
this.elementStyles = this.finalizeStyles(this.styles);
}
static finalizeStyles(t) {
let s = [];
if (Array.isArray(t)) {
let i = new Set(t.flat(1 / 0).reverse());
for (let r of i) s.unshift(st(r));
} else t !== void 0 && s.push(st(t));
return s;
static finalizeStyles(e) {
let t = [];
if (Array.isArray(e)) {
let s = new Set(e.flat(1 / 0).reverse());
for (let i of s) t.unshift(st(i));
} else e !== void 0 && t.push(st(e));
return t;
}
static _$Eu(t, s) {
let i = s.attribute;
return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.toLowerCase() : void 0;
static _$Eu(e, t) {
let s = t.attribute;
return s === !1 ? void 0 : typeof s == "string" ? s : typeof e == "string" ? e.toLowerCase() : void 0;
}

@@ -148,56 +148,56 @@ constructor() {

_$Ev() {
this._$ES = new Promise((t) => this.enableUpdating = t), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t) => t(this));
this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this));
}
addController(t) {
(this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.();
addController(e) {
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
}
removeController(t) {
this._$EO?.delete(t);
removeController(e) {
this._$EO?.delete(e);
}
_$E_() {
let t = /* @__PURE__ */ new Map(), s = this.constructor.elementProperties;
for (let i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
t.size > 0 && (this._$Ep = t);
let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
for (let s of t.keys()) this.hasOwnProperty(s) && (e.set(s, this[s]), delete this[s]);
e.size > 0 && (this._$Ep = e);
}
createRenderRoot() {
let t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
return kt(t, this.constructor.elementStyles), t;
let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
return kt(e, this.constructor.elementStyles), e;
}
connectedCallback() {
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((t) => t.hostConnected?.());
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
}
enableUpdating(t) {
enableUpdating(e) {
}
disconnectedCallback() {
this._$EO?.forEach((t) => t.hostDisconnected?.());
this._$EO?.forEach((e) => e.hostDisconnected?.());
}
attributeChangedCallback(t, s, i) {
this._$AK(t, i);
attributeChangedCallback(e, t, s) {
this._$AK(e, s);
}
_$ET(t, s) {
let i = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, i);
if (r !== void 0 && i.reflect === !0) {
let n = (i.converter?.toAttribute === void 0 ? V : i.converter).toAttribute(s, i.type);
this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null;
_$ET(e, t) {
let s = this.constructor.elementProperties.get(e), i = this.constructor._$Eu(e, s);
if (i !== void 0 && s.reflect === !0) {
let r = (s.converter?.toAttribute === void 0 ? V : s.converter).toAttribute(t, s.type);
this._$Em = e, r == null ? this.removeAttribute(i) : this.setAttribute(i, r), this._$Em = null;
}
}
_$AK(t, s) {
let i = this.constructor, r = i._$Eh.get(t);
if (r !== void 0 && this._$Em !== r) {
let n = i.getPropertyOptions(r), o = typeof n.converter == "function" ? { fromAttribute: n.converter } : n.converter?.fromAttribute === void 0 ? V : n.converter;
this._$Em = r;
let h = o.fromAttribute(s, n.type);
this[r] = h ?? this._$Ej?.get(r) ?? h, this._$Em = null;
_$AK(e, t) {
let s = this.constructor, i = s._$Eh.get(e);
if (i !== void 0 && this._$Em !== i) {
let r = s.getPropertyOptions(i), n = typeof r.converter == "function" ? { fromAttribute: r.converter } : r.converter?.fromAttribute === void 0 ? V : r.converter;
this._$Em = i;
let o = n.fromAttribute(t, r.type);
this[i] = o ?? this._$Ej?.get(i) ?? o, this._$Em = null;
}
}
requestUpdate(t, s, i, r = !1, n) {
if (t !== void 0) {
let o = this.constructor;
if (r === !1 && (n = this[t]), i ??= o.getPropertyOptions(t), !((i.hasChanged ?? At)(n, s) || i.useDefault && i.reflect && n === this._$Ej?.get(t) && !this.hasAttribute(o._$Eu(t, i)))) return;
this.C(t, s, i);
requestUpdate(e, t, s, i = !1, r) {
if (e !== void 0) {
let n = this.constructor;
if (i === !1 && (r = this[e]), s ??= n.getPropertyOptions(e), !((s.hasChanged ?? At)(r, t) || s.useDefault && s.reflect && r === this._$Ej?.get(e) && !this.hasAttribute(n._$Eu(e, s)))) return;
this.C(e, t, s);
}
this.isUpdatePending === !1 && (this._$ES = this._$EP());
}
C(t, s, { useDefault: i, reflect: r, wrapped: n }, o) {
i && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? s ?? this[t]), n !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), r === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
C(e, t, { useDefault: s, reflect: i, wrapped: r }, n) {
s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, n ?? t ?? this[e]), r !== !0 || n !== void 0) || (this._$AL.has(e) || (this.hasUpdated || s || (t = void 0), this._$AL.set(e, t)), i === !0 && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
}

@@ -208,7 +208,7 @@ async _$EP() {

await this._$ES;
} catch (s) {
Promise.reject(s);
} catch (t) {
Promise.reject(t);
}
let t = this.scheduleUpdate();
return t != null && await t, !this.isUpdatePending;
let e = this.scheduleUpdate();
return e != null && await e, !this.isUpdatePending;
}

@@ -222,23 +222,23 @@ scheduleUpdate() {

if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
for (let [r, n] of this._$Ep) this[r] = n;
for (let [i, r] of this._$Ep) this[i] = r;
this._$Ep = void 0;
}
let i = this.constructor.elementProperties;
if (i.size > 0) for (let [r, n] of i) {
let { wrapped: o } = n, h = this[r];
o !== !0 || this._$AL.has(r) || h === void 0 || this.C(r, void 0, n, h);
let s = this.constructor.elementProperties;
if (s.size > 0) for (let [i, r] of s) {
let { wrapped: n } = r, o = this[i];
n !== !0 || this._$AL.has(i) || o === void 0 || this.C(i, void 0, r, o);
}
}
let t = !1, s = this._$AL;
let e = !1, t = this._$AL;
try {
t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach((i) => i.hostUpdate?.()), this.update(s)) : this._$EM();
} catch (i) {
throw t = !1, this._$EM(), i;
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((s) => s.hostUpdate?.()), this.update(t)) : this._$EM();
} catch (s) {
throw e = !1, this._$EM(), s;
}
t && this._$AE(s);
e && this._$AE(t);
}
willUpdate(t) {
willUpdate(e) {
}
_$AE(t) {
this._$EO?.forEach((s) => s.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
_$AE(e) {
this._$EO?.forEach((t) => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
}

@@ -254,30 +254,30 @@ _$EM() {

}
shouldUpdate(t) {
shouldUpdate(e) {
return !0;
}
update(t) {
this._$Eq &&= this._$Eq.forEach((s) => this._$ET(s, this[s])), this._$EM();
update(e) {
this._$Eq &&= this._$Eq.forEach((t) => this._$ET(t, this[t])), this._$EM();
}
updated(t) {
updated(e) {
}
firstUpdated(t) {
firstUpdated(e) {
}
};
b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[x("elementProperties")] = /* @__PURE__ */ new Map(), b[x("finalized")] = /* @__PURE__ */ new Map(), jt?.({ ReactiveElement: b }), (z.reactiveElementVersions ??= []).push("2.1.2");
var X = globalThis, nt = (e) => e, I = X.trustedTypes, ot = I ? I.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, Et = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, St = "?" + $, Bt = `<${St}>`, y = document, M = () => y.createComment(""), R = (e) => e === null || typeof e != "object" && typeof e != "function", Y = Array.isArray, qt = (e) => Y(e) || typeof e?.[Symbol.iterator] == "function", K = `[
\f\r]`, C = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ht = /-->/g, at = />/g, g = RegExp(`>|${K}(?:([^\\s"'>=/]+)(${K}*=${K}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`, "g"), lt = /'/g, ct = /"/g, wt = /^(?:script|style|textarea|title)$/i, A = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), dt = /* @__PURE__ */ new WeakMap(), v = y.createTreeWalker(y, 129);
function Ct(e, t) {
if (!Y(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
var Y = globalThis, nt = (e) => e, I = Y.trustedTypes, ot = I ? I.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, Et = "$lit$", m = `lit$${Math.random().toFixed(9).slice(2)}$`, St = "?" + m, Bt = `<${St}>`, y = document, M = () => y.createComment(""), R = (e) => e === null || typeof e != "object" && typeof e != "function", G = Array.isArray, qt = (e) => G(e) || typeof e?.[Symbol.iterator] == "function", F = `[
\f\r]`, w = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, at = /-->/g, lt = />/g, g = RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`, "g"), ht = /'/g, ct = /"/g, Ct = /^(?:script|style|textarea|title)$/i, A = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), dt = /* @__PURE__ */ new WeakMap(), v = y.createTreeWalker(y, 129);
function wt(e, t) {
if (!G(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
return ot === void 0 ? t : ot.createHTML(t);
}
var Kt = (e, t) => {
let s = e.length - 1, i = [], r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = C;
for (let h = 0; h < s; h++) {
let a = e[h], k, u, l = -1, f = 0;
for (; f < a.length && (o.lastIndex = f, u = o.exec(a), u !== null); ) f = o.lastIndex, o === C ? u[1] === "!--" ? o = ht : u[1] === void 0 ? u[2] === void 0 ? u[3] !== void 0 && (o = g) : (wt.test(u[2]) && (r = RegExp("</" + u[2], "g")), o = g) : o = at : o === g ? u[0] === ">" ? (o = r ?? C, l = -1) : u[1] === void 0 ? l = -2 : (l = o.lastIndex - u[2].length, k = u[1], o = u[3] === void 0 ? g : u[3] === '"' ? ct : lt) : o === ct || o === lt ? o = g : o === ht || o === at ? o = C : (o = g, r = void 0);
let m = o === g && e[h + 1].startsWith("/>") ? " " : "";
n += o === C ? a + Bt : l >= 0 ? (i.push(k), a.slice(0, l) + Et + a.slice(l) + $ + m) : a + $ + (l === -2 ? h : m);
var Ft = (e, t) => {
let s = e.length - 1, i = [], r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = w;
for (let a = 0; a < s; a++) {
let l = e[a], k, p, h = -1, f = 0;
for (; f < l.length && (o.lastIndex = f, p = o.exec(l), p !== null); ) f = o.lastIndex, o === w ? p[1] === "!--" ? o = at : p[1] === void 0 ? p[2] === void 0 ? p[3] !== void 0 && (o = g) : (Ct.test(p[2]) && (r = RegExp("</" + p[2], "g")), o = g) : o = lt : o === g ? p[0] === ">" ? (o = r ?? w, h = -1) : p[1] === void 0 ? h = -2 : (h = o.lastIndex - p[2].length, k = p[1], o = p[3] === void 0 ? g : p[3] === '"' ? ct : ht) : o === ct || o === ht ? o = g : o === at || o === lt ? o = w : (o = g, r = void 0);
let $ = o === g && e[a + 1].startsWith("/>") ? " " : "";
n += o === w ? l + Bt : h >= 0 ? (i.push(k), l.slice(0, h) + Et + l.slice(h) + m + $) : l + m + (h === -2 ? a : $);
}
return [Ct(e, n + (e[s] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
return [wt(e, n + (e[s] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
}, W = class Pt {

@@ -287,34 +287,34 @@ constructor({ strings: t, _$litType$: s }, i) {

this.parts = [];
let n = 0, o = 0, h = t.length - 1, a = this.parts, [k, u] = Kt(t, s);
let n = 0, o = 0, a = t.length - 1, l = this.parts, [k, p] = Ft(t, s);
if (this.el = Pt.createElement(k, i), v.currentNode = this.el.content, s === 2 || s === 3) {
let l = this.el.content.firstChild;
l.replaceWith(...l.childNodes);
let h = this.el.content.firstChild;
h.replaceWith(...h.childNodes);
}
for (; (r = v.nextNode()) !== null && a.length < h; ) {
for (; (r = v.nextNode()) !== null && l.length < a; ) {
if (r.nodeType === 1) {
if (r.hasAttributes()) for (let l of r.getAttributeNames()) if (l.endsWith(Et)) {
let f = u[o++], m = r.getAttribute(l).split($), T = /([.?@])?(.*)/.exec(f);
a.push({
if (r.hasAttributes()) for (let h of r.getAttributeNames()) if (h.endsWith(Et)) {
let f = p[o++], $ = r.getAttribute(h).split(m), T = /([.?@])?(.*)/.exec(f);
l.push({
type: 1,
index: n,
name: T[2],
strings: m,
ctor: T[1] === "." ? Vt : T[1] === "?" ? Wt : T[1] === "@" ? Gt : j
}), r.removeAttribute(l);
} else l.startsWith($) && (a.push({
strings: $,
ctor: T[1] === "." ? Vt : T[1] === "?" ? Wt : T[1] === "@" ? Xt : j
}), r.removeAttribute(h);
} else h.startsWith(m) && (l.push({
type: 6,
index: n
}), r.removeAttribute(l));
if (wt.test(r.tagName)) {
let l = r.textContent.split($), f = l.length - 1;
}), r.removeAttribute(h));
if (Ct.test(r.tagName)) {
let h = r.textContent.split(m), f = h.length - 1;
if (f > 0) {
r.textContent = I ? I.emptyScript : "";
for (let m = 0; m < f; m++) r.append(l[m], M()), v.nextNode(), a.push({
for (let $ = 0; $ < f; $++) r.append(h[$], M()), v.nextNode(), l.push({
type: 2,
index: ++n
});
r.append(l[f], M());
r.append(h[f], M());
}
}
} else if (r.nodeType === 8) if (r.data === St) a.push({
} else if (r.nodeType === 8) if (r.data === St) l.push({
type: 2,

@@ -324,7 +324,7 @@ index: n

else {
let l = -1;
for (; (l = r.data.indexOf($, l + 1)) !== -1; ) a.push({
let h = -1;
for (; (h = r.data.indexOf(m, h + 1)) !== -1; ) l.push({
type: 7,
index: n
}), l += $.length - 1;
}), h += m.length - 1;
}

@@ -344,3 +344,3 @@ n++;

}
var Ft = class {
var Kt = class {
constructor(e, t) {

@@ -358,9 +358,9 @@ this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;

v.currentNode = i;
let r = v.nextNode(), n = 0, o = 0, h = s[0];
for (; h !== void 0; ) {
if (n === h.index) {
let a;
h.type === 2 ? a = new J(r, r.nextSibling, this, e) : h.type === 1 ? a = new h.ctor(r, h.name, h.strings, this, e) : h.type === 6 && (a = new Xt(r, this, e)), this._$AV.push(a), h = s[++o];
let r = v.nextNode(), n = 0, o = 0, a = s[0];
for (; a !== void 0; ) {
if (n === a.index) {
let l;
a.type === 2 ? l = new J(r, r.nextSibling, this, e) : a.type === 1 ? l = new a.ctor(r, a.name, a.strings, this, e) : a.type === 6 && (l = new Yt(r, this, e)), this._$AV.push(l), a = s[++o];
}
n !== h?.index && (r = v.nextNode(), n++);
n !== a?.index && (r = v.nextNode(), n++);
}

@@ -403,6 +403,6 @@ return v.currentNode = y, i;

$(t) {
let { values: s, _$litType$: i } = t, r = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = W.createElement(Ct(i.h, i.h[0]), this.options)), i);
let { values: s, _$litType$: i } = t, r = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = W.createElement(wt(i.h, i.h[0]), this.options)), i);
if (this._$AH?._$AD === r) this._$AH.p(s);
else {
let n = new Ft(r, this), o = n.u(this.options);
let n = new Kt(r, this), o = n.u(this.options);
n.p(s), this.T(o), this._$AH = n;

@@ -416,3 +416,3 @@ }

k(t) {
Y(this._$AH) || (this._$AH = [], this._$AR());
G(this._$AH) || (this._$AH = [], this._$AR());
let s = this._$AH, i, r = 0;

@@ -445,4 +445,4 @@ for (let n of t) r === s.length ? s.push(i = new xt(this.O(M()), this.O(M()), this, this.options)) : i = s[r], i._$AI(n), r++;

else {
let o = e, h, a;
for (e = r[0], h = 0; h < r.length - 1; h++) a = E(this, o[s + h], t, h), a === A && (a = this._$AH[h]), n ||= !R(a) || a !== this._$AH[h], a === c ? e = c : e !== c && (e += (a ?? "") + r[h + 1]), this._$AH[h] = a;
let o = e, a, l;
for (e = r[0], a = 0; a < r.length - 1; a++) l = E(this, o[s + a], t, a), l === A && (l = this._$AH[a]), n ||= !R(l) || l !== this._$AH[a], l === c ? e = c : e !== c && (e += (l ?? "") + r[a + 1]), this._$AH[a] = l;
}

@@ -468,3 +468,3 @@ n && !i && this.j(e);

}
}, Gt = class extends j {
}, Xt = class extends j {
constructor(e, t, s, i, r) {

@@ -481,3 +481,3 @@ super(e, t, s, i, r), this.type = 5;

}
}, Xt = class {
}, Yt = class {
constructor(e, t, s) {

@@ -492,4 +492,4 @@ this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;

}
}, Yt = X.litHtmlPolyfillSupport;
Yt?.(W, J), (X.litHtmlVersions ??= []).push("3.3.2");
}, Gt = Y.litHtmlPolyfillSupport;
Gt?.(W, J), (Y.litHtmlVersions ??= []).push("3.3.2");
var Jt = (e, t, s) => {

@@ -532,11 +532,11 @@ let i = s?.renderBefore ?? t, r = i._$litPart$;

}
var F, te = new Uint8Array(16);
var K, te = new Uint8Array(16);
function ee() {
if (!F) {
if (!K) {
if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
F = crypto.getRandomValues.bind(crypto);
K = crypto.getRandomValues.bind(crypto);
}
return F(te);
return K(te);
}
var ut = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
var pt = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
function se(e, t, s) {

@@ -549,3 +549,3 @@ e ||= {};

function ie(e, t, s) {
return ut.randomUUID && !t && !e ? ut.randomUUID() : se(e, t);
return pt.randomUUID && !t && !e ? pt.randomUUID() : se(e, t);
}

@@ -572,4 +572,14 @@ function re(e = "hp") {

}
_abortController = null;
get signal() {
return (!this._abortController || this._abortController.signal.aborted) && (this._abortController = new AbortController()), this._abortController.signal;
}
connectedCallback() {
super.connectedCallback(), (!this._abortController || this._abortController.signal.aborted) && (this._abortController = new AbortController());
}
disconnectedCallback() {
super.disconnectedCallback(), this._abortController?.abort(), this._abortController = null;
}
};
function w(e) {
function C(e) {
return function(t) {

@@ -579,2 +589,10 @@ typeof window < "u" && (customElements.get(e) || customElements.define(e, t));

}
function ne(e) {
let t = [], s = e.parentElement;
for (; s; ) {
let { overflow: i, overflowY: r, overflowX: n } = getComputedStyle(s);
/auto|scroll|overlay/.test(i + r + n) && t.push(s), s = s.parentElement;
}
return t.push(window), t;
}
/**

@@ -585,4 +603,4 @@ * @license

*/
const H = globalThis, Q = H.ShadowRoot && (H.ShadyCSS === void 0 || H.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ot = Symbol(), pt = /* @__PURE__ */ new WeakMap();
let ne = class {
const H = globalThis, Q = H.ShadowRoot && (H.ShadyCSS === void 0 || H.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ot = Symbol(), ut = /* @__PURE__ */ new WeakMap();
let oe = class {
constructor(t, s, i) {

@@ -597,3 +615,3 @@ if (this._$cssResult$ = !0, i !== Ot) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");

const i = s !== void 0 && s.length === 1;
i && (t = pt.get(s)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && pt.set(s, t));
i && (t = ut.get(s)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && ut.set(s, t));
}

@@ -606,3 +624,3 @@ return t;

};
const oe = (e) => new ne(typeof e == "string" ? e : e + "", void 0, Ot), he = (e, t) => {
const ae = (e) => new oe(typeof e == "string" ? e : e + "", void 0, Ot), le = (e, t) => {
if (Q) e.adoptedStyleSheets = t.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);

@@ -616,3 +634,3 @@ else for (const s of t) {

for (const i of t.cssRules) s += i.cssText;
return oe(s);
return ae(s);
})(e) : e;

@@ -624,6 +642,6 @@ /**

*/
const { is: ae, defineProperty: le, getOwnPropertyDescriptor: ce, getOwnPropertyNames: de, getOwnPropertySymbols: ue, getPrototypeOf: pe } = Object, B = globalThis, ft = B.trustedTypes, _e = ft ? ft.emptyScript : "", fe = B.reactiveElementPolyfillSupport, U = (e, t) => e, L = { toAttribute(e, t) {
const { is: he, defineProperty: ce, getOwnPropertyDescriptor: de, getOwnPropertyNames: pe, getOwnPropertySymbols: ue, getPrototypeOf: _e } = Object, B = globalThis, ft = B.trustedTypes, fe = ft ? ft.emptyScript : "", $e = B.reactiveElementPolyfillSupport, U = (e, t) => e, N = { toAttribute(e, t) {
switch (t) {
case Boolean:
e = e ? _e : null;
e = e ? fe : null;
break;

@@ -653,3 +671,3 @@ case Object:

return s;
} }, tt = (e, t) => !ae(e, t), mt = { attribute: !0, type: String, converter: L, reflect: !1, useDefault: !1, hasChanged: tt };
} }, tt = (e, t) => !he(e, t), $t = { attribute: !0, type: String, converter: N, reflect: !1, useDefault: !1, hasChanged: tt };
Symbol.metadata ??= Symbol("metadata"), B.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();

@@ -663,10 +681,10 @@ class P extends HTMLElement {

}
static createProperty(t, s = mt) {
static createProperty(t, s = $t) {
if (s.state && (s.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = !0), this.elementProperties.set(t, s), !s.noAccessor) {
const i = Symbol(), r = this.getPropertyDescriptor(t, i, s);
r !== void 0 && le(this.prototype, t, r);
r !== void 0 && ce(this.prototype, t, r);
}
}
static getPropertyDescriptor(t, s, i) {
const { get: r, set: n } = ce(this.prototype, t) ?? { get() {
const { get: r, set: n } = de(this.prototype, t) ?? { get() {
return this[s];

@@ -677,12 +695,12 @@ }, set(o) {

return { get: r, set(o) {
const h = r?.call(this);
n?.call(this, o), this.requestUpdate(t, h, i);
const a = r?.call(this);
n?.call(this, o), this.requestUpdate(t, a, i);
}, configurable: !0, enumerable: !0 };
}
static getPropertyOptions(t) {
return this.elementProperties.get(t) ?? mt;
return this.elementProperties.get(t) ?? $t;
}
static _$Ei() {
if (this.hasOwnProperty(U("elementProperties"))) return;
const t = pe(this);
const t = _e(this);
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);

@@ -693,3 +711,3 @@ }

if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(U("properties"))) {
const s = this.properties, i = [...de(s), ...ue(s)];
const s = this.properties, i = [...pe(s), ...ue(s)];
for (const r of i) this.createProperty(r, s[r]);

@@ -740,3 +758,3 @@ }

const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
return he(t, this.constructor.elementStyles), t;
return le(t, this.constructor.elementStyles), t;
}

@@ -757,3 +775,3 @@ connectedCallback() {

if (r !== void 0 && i.reflect === !0) {
const n = (i.converter?.toAttribute !== void 0 ? i.converter : L).toAttribute(s, i.type);
const n = (i.converter?.toAttribute !== void 0 ? i.converter : N).toAttribute(s, i.type);
this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null;

@@ -765,6 +783,6 @@ }

if (r !== void 0 && this._$Em !== r) {
const n = i.getPropertyOptions(r), o = typeof n.converter == "function" ? { fromAttribute: n.converter } : n.converter?.fromAttribute !== void 0 ? n.converter : L;
const n = i.getPropertyOptions(r), o = typeof n.converter == "function" ? { fromAttribute: n.converter } : n.converter?.fromAttribute !== void 0 ? n.converter : N;
this._$Em = r;
const h = o.fromAttribute(s, n.type);
this[r] = h ?? this._$Ej?.get(r) ?? h, this._$Em = null;
const a = o.fromAttribute(s, n.type);
this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
}

@@ -805,4 +823,4 @@ }

if (i.size > 0) for (const [r, n] of i) {
const { wrapped: o } = n, h = this[r];
o !== !0 || this._$AL.has(r) || h === void 0 || this.C(r, void 0, n, h);
const { wrapped: o } = n, a = this[r];
o !== !0 || this._$AL.has(r) || a === void 0 || this.C(r, void 0, n, a);
}

@@ -844,3 +862,3 @@ }

}
P.elementStyles = [], P.shadowRootOptions = { mode: "open" }, P[U("elementProperties")] = /* @__PURE__ */ new Map(), P[U("finalized")] = /* @__PURE__ */ new Map(), fe?.({ ReactiveElement: P }), (B.reactiveElementVersions ??= []).push("2.1.2");
P.elementStyles = [], P.shadowRootOptions = { mode: "open" }, P[U("elementProperties")] = /* @__PURE__ */ new Map(), P[U("finalized")] = /* @__PURE__ */ new Map(), $e?.({ ReactiveElement: P }), (B.reactiveElementVersions ??= []).push("2.1.2");
/**

@@ -851,3 +869,3 @@ * @license

*/
const me = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: tt }, $e = (e = me, t, s) => {
const me = { attribute: !0, type: String, converter: N, reflect: !1, hasChanged: tt }, ge = (e = me, t, s) => {
const { kind: i, metadata: r } = s;

@@ -857,7 +875,7 @@ let n = globalThis.litPropertyMetadata.get(r);

const { name: o } = s;
return { set(h) {
const a = t.get.call(this);
t.set.call(this, h), this.requestUpdate(o, a, e, !0, h);
}, init(h) {
return h !== void 0 && this.C(o, void 0, e, h), h;
return { set(a) {
const l = t.get.call(this);
t.set.call(this, a), this.requestUpdate(o, l, e, !0, a);
}, init(a) {
return a !== void 0 && this.C(o, void 0, e, a), a;
} };

@@ -867,5 +885,5 @@ }

const { name: o } = s;
return function(h) {
const a = this[o];
t.call(this, h), this.requestUpdate(o, a, e, !0, h);
return function(a) {
const l = this[o];
t.call(this, a), this.requestUpdate(o, l, e, !0, a);
};

@@ -876,3 +894,3 @@ }

function q(e) {
return (t, s) => typeof s == "object" ? $e(e, t, s) : ((i, r, n) => {
return (t, s) => typeof s == "object" ? ge(e, t, s) : ((i, r, n) => {
const o = r.hasOwnProperty(n);

@@ -882,9 +900,10 @@ return r.constructor.createProperty(n, i), o ? Object.getOwnPropertyDescriptor(r, n) : void 0;

}
var Ut = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, ve = (e, t, s) => t in e ? Ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, _ = (e, t, s, i) => {
for (var r = i > 1 ? void 0 : i ? ge(t, s) : t, n = e.length - 1, o; n >= 0; n--)
var Ut = Object.defineProperty, ve = Object.getOwnPropertyDescriptor, ye = (e, t, s) => t in e ? Ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, _ = (e, t, s, i) => {
for (var r = i > 1 ? void 0 : i ? ve(t, s) : t, n = e.length - 1, o; n >= 0; n--)
(o = e[n]) && (r = (i ? o(t, s, r) : o(r)) || r);
return i && r && Ut(t, s, r), r;
}, ye = (e, t, s) => ve(e, t + "", s);
let p = class extends S {
}, be = (e, t, s) => ye(e, t + "", s);
let u = class extends S {
_open = !1;
_prevOpen = !1;
_trigger = null;

@@ -896,2 +915,3 @@ _content = null;

_cursorY = 0;
_openController = null;
_previousFocus = null;

@@ -910,3 +930,3 @@ _scrollParents = [];

disconnectedCallback() {
super.disconnectedCallback(), this._removeGlobalListeners(), p._currentOpen === this && (p._currentOpen = null);
super.disconnectedCallback(), this._removeGlobalListeners(), u._currentOpen === this && (u._currentOpen = null);
}

@@ -933,3 +953,3 @@ _setupRefs() {

_onContextMenu = (e) => {
this.disabled || (e.preventDefault(), e.stopPropagation(), this._cursorX = e.clientX, this._cursorY = e.clientY, this._previousFocus = document.activeElement, p._currentOpen && p._currentOpen !== this && p._currentOpen.close(), this.openMenu("first"));
this.disabled || (e.preventDefault(), e.stopPropagation(), this._cursorX = e.clientX, this._cursorY = e.clientY, this._previousFocus = document.activeElement, u._currentOpen && u._currentOpen !== this && u._currentOpen.close(), this.openMenu("first"));
};

@@ -940,3 +960,3 @@ _onTriggerKeyDown = (e) => {

const t = document.activeElement || this._trigger, s = t.getBoundingClientRect();
this._cursorX = s.left + s.width / 2, this._cursorY = s.top + s.height / 2, this._previousFocus = t, p._currentOpen && p._currentOpen !== this && p._currentOpen.close(), this.openMenu("first");
this._cursorX = s.left + s.width / 2, this._cursorY = s.top + s.height / 2, this._previousFocus = t, u._currentOpen && u._currentOpen !== this && u._currentOpen.close(), this.openMenu("first");
}

@@ -1020,34 +1040,29 @@ };

if (this._open) {
p._currentOpen = this, this._setupRoving();
const e = this._items.findIndex((t) => !t.disabled);
if (e >= 0 && this._setActiveIndex(e), this._computePosition(), document.addEventListener("click", this._onClickOutside), document.addEventListener("contextmenu", this._onClickOutside), document.addEventListener("keydown", this._onGlobalKeydown), this._trigger) {
this._scrollParents = this._getScrollParents(this._trigger);
for (const t of this._scrollParents)
t.addEventListener("scroll", this._onScrollOrResize, {
u._currentOpen = this, this._setupRoving();
const e = this._items.findIndex((s) => !s.disabled);
e >= 0 && this._setActiveIndex(e), this._computePosition(), this._openController?.abort(), this._openController = new AbortController();
const t = this._openController.signal;
if (document.addEventListener("click", this._onClickOutside, { signal: t }), document.addEventListener("contextmenu", this._onClickOutside, { signal: t }), document.addEventListener("keydown", this._onGlobalKeydown, { signal: t }), this._trigger) {
this._scrollParents = ne(this._trigger);
for (const s of this._scrollParents)
s.addEventListener("scroll", this._onScrollOrResize, {
signal: t,
passive: !0
});
}
window.addEventListener("resize", this._onScrollOrResize, { passive: !0 }), this.emit("open");
window.addEventListener("resize", this._onScrollOrResize, {
signal: t,
passive: !0
}), this._prevOpen || this.emit("open");
} else
p._currentOpen === this && (p._currentOpen = null), this._removeGlobalListeners(), this.emit("close");
u._currentOpen === this && (u._currentOpen = null), this._removeGlobalListeners(), this._prevOpen && this.emit("close");
this._prevOpen = this._open;
}
_getScrollParents(e) {
const t = [];
let s = e.parentElement;
for (; s; ) {
const { overflow: i, overflowY: r, overflowX: n } = getComputedStyle(s);
/auto|scroll|overlay/.test(i + r + n) && t.push(s), s = s.parentElement;
}
return t.push(window), t;
}
_removeGlobalListeners() {
document.removeEventListener("click", this._onClickOutside), document.removeEventListener("contextmenu", this._onClickOutside), document.removeEventListener("keydown", this._onGlobalKeydown);
for (const e of this._scrollParents)
e.removeEventListener("scroll", this._onScrollOrResize);
this._scrollParents = [], window.removeEventListener("resize", this._onScrollOrResize);
this._openController?.abort(), this._openController = null, this._scrollParents = [];
}
_onClickOutside = (e) => {
if (!this._open || !this._content) return;
if (!this._open) return;
const t = e.target;
this._content.contains(t) || this.close();
this.contains(t) || this.close();
};

@@ -1071,13 +1086,13 @@ _onGlobalKeydown = (e) => {

};
ye(p, "_currentOpen", null);
be(u, "_currentOpen", null);
_([
q({ type: Boolean, reflect: !0 })
], p.prototype, "disabled", 2);
], u.prototype, "disabled", 2);
_([
q({ type: Boolean, reflect: !0 })
], p.prototype, "open", 1);
p = _([
w("hp-context-menu")
], p);
let $t = class extends S {
], u.prototype, "open", 1);
u = _([
C("hp-context-menu")
], u);
let mt = class extends S {
connectedCallback() {

@@ -1087,5 +1102,5 @@ super.connectedCallback(), this.setAttribute("data-hp-component", "context-menu-trigger");

};
$t = _([
w("hp-context-menu-trigger")
], $t);
mt = _([
C("hp-context-menu-trigger")
], mt);
let gt = class extends S {

@@ -1097,5 +1112,5 @@ connectedCallback() {

gt = _([
w("hp-context-menu-content")
C("hp-context-menu-content")
], gt);
let N = class extends S {
let L = class extends S {
value = "";

@@ -1109,9 +1124,9 @@ disabled = !1;

q({ type: String, reflect: !0 })
], N.prototype, "value", 2);
], L.prototype, "value", 2);
_([
q({ type: Boolean, reflect: !0 })
], N.prototype, "disabled", 2);
N = _([
w("hp-context-menu-item")
], N);
], L.prototype, "disabled", 2);
L = _([
C("hp-context-menu-item")
], L);
let vt = class extends S {

@@ -1123,3 +1138,3 @@ connectedCallback() {

vt = _([
w("hp-context-menu-separator")
C("hp-context-menu-separator")
], vt);

@@ -1132,11 +1147,11 @@ let yt = class extends S {

yt = _([
w("hp-context-menu-label")
C("hp-context-menu-label")
], yt);
export {
p as HeadlessContextMenu,
u as HeadlessContextMenu,
gt as HeadlessContextMenuContent,
N as HeadlessContextMenuItem,
L as HeadlessContextMenuItem,
yt as HeadlessContextMenuLabel,
vt as HeadlessContextMenuSeparator,
$t as HeadlessContextMenuTrigger
mt as HeadlessContextMenuTrigger
};

@@ -1,15 +0,15 @@

(function(h,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(h=typeof globalThis<"u"?globalThis:h||self,m(h.HeadlessPrimitivesContextMenu={}))})(this,function(h){"use strict";var m=globalThis,q=m.ShadowRoot&&(m.ShadyCSS===void 0||m.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,tt=Symbol(),et=new WeakMap,wt=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==tt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(q&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=et.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&et.set(e,t))}return t}toString(){return this.cssText}},Pt=s=>new wt(typeof s=="string"?s:s+"",void 0,tt),xt=(s,t)=>{if(q)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),n=m.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=e.cssText,s.appendChild(i)}},st=q?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return Pt(e)})(s):s,{is:Mt,defineProperty:Ot,getOwnPropertyDescriptor:Ut,getOwnPropertyNames:Ht,getOwnPropertySymbols:Rt,getPrototypeOf:kt}=Object,k=globalThis,it=k.trustedTypes,Tt=it?it.emptyScript:"",It=k.reactiveElementPolyfillSupport,P=(s,t)=>s,K={toAttribute(s,t){switch(t){case Boolean:s=s?Tt:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},nt=(s,t)=>!Mt(s,t),rt={attribute:!0,type:String,converter:K,reflect:!1,useDefault:!1,hasChanged:nt};Symbol.metadata??=Symbol("metadata"),k.litPropertyMetadata??=new WeakMap;var A=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=rt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),n=this.getPropertyDescriptor(t,i,e);n!==void 0&&Ot(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){let{get:n,set:r}=Ut(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get:n,set(o){let a=n?.call(this);r?.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??rt}static _$Ei(){if(this.hasOwnProperty(P("elementProperties")))return;let t=kt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(P("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(P("properties"))){let e=this.properties,i=[...Ht(e),...Rt(e)];for(let n of i)this.createProperty(n,e[n])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,n]of e)this.elementProperties.set(i,n)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let n=this._$Eu(e,i);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let n of i)e.unshift(st(n))}else t!==void 0&&e.push(st(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(n!==void 0&&i.reflect===!0){let r=(i.converter?.toAttribute===void 0?K:i.converter).toAttribute(e,i.type);this._$Em=t,r==null?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){let i=this.constructor,n=i._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let r=i.getPropertyOptions(n),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute===void 0?K:r.converter;this._$Em=n;let a=o.fromAttribute(e,r.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(t,e,i,n=!1,r){if(t!==void 0){let o=this.constructor;if(n===!1&&(r=this[t]),i??=o.getPropertyOptions(t),!((i.hasChanged??nt)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:n,wrapped:r},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),r!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),n===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[n,r]of this._$Ep)this[n]=r;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[n,r]of i){let{wrapped:o}=r,a=this[n];o!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,r,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[P("elementProperties")]=new Map,A[P("finalized")]=new Map,It?.({ReactiveElement:A}),(k.reactiveElementVersions??=[]).push("2.1.2");var F=globalThis,ot=s=>s,T=F.trustedTypes,at=T?T.createPolicy("lit-html",{createHTML:s=>s}):void 0,ht="$lit$",$=`lit$${Math.random().toFixed(9).slice(2)}$`,lt="?"+$,Dt=`<${lt}>`,v=document,x=()=>v.createComment(""),M=s=>s===null||typeof s!="object"&&typeof s!="function",V=Array.isArray,Lt=s=>V(s)||typeof s?.[Symbol.iterator]=="function",W=`[
\f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ct=/-->/g,dt=/>/g,y=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),ut=/'/g,pt=/"/g,_t=/^(?:script|style|textarea|title)$/i,E=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ft=new WeakMap,b=v.createTreeWalker(v,129);function mt(s,t){if(!V(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return at===void 0?t:at.createHTML(t)}var Nt=(s,t)=>{let e=s.length-1,i=[],n,r=t===2?"<svg>":t===3?"<math>":"",o=O;for(let a=0;a<e;a++){let l=s[a],j,p,c=-1,f=0;for(;f<l.length&&(o.lastIndex=f,p=o.exec(l),p!==null);)f=o.lastIndex,o===O?p[1]==="!--"?o=ct:p[1]===void 0?p[2]===void 0?p[3]!==void 0&&(o=y):(_t.test(p[2])&&(n=RegExp("</"+p[2],"g")),o=y):o=dt:o===y?p[0]===">"?(o=n??O,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,j=p[1],o=p[3]===void 0?y:p[3]==='"'?pt:ut):o===pt||o===ut?o=y:o===ct||o===dt?o=O:(o=y,n=void 0);let g=o===y&&s[a+1].startsWith("/>")?" ":"";r+=o===O?l+Dt:c>=0?(i.push(j),l.slice(0,c)+ht+l.slice(c)+$+g):l+$+(c===-2?a:g)}return[mt(s,r+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},G=class Ct{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0,a=t.length-1,l=this.parts,[j,p]=Nt(t,e);if(this.el=Ct.createElement(j,i),b.currentNode=this.el.content,e===2||e===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(n=b.nextNode())!==null&&l.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let c of n.getAttributeNames())if(c.endsWith(ht)){let f=p[o++],g=n.getAttribute(c).split($),B=/([.?@])?(.*)/.exec(f);l.push({type:1,index:r,name:B[2],strings:g,ctor:B[1]==="."?jt:B[1]==="?"?Bt:B[1]==="@"?qt:I}),n.removeAttribute(c)}else c.startsWith($)&&(l.push({type:6,index:r}),n.removeAttribute(c));if(_t.test(n.tagName)){let c=n.textContent.split($),f=c.length-1;if(f>0){n.textContent=T?T.emptyScript:"";for(let g=0;g<f;g++)n.append(c[g],x()),b.nextNode(),l.push({type:2,index:++r});n.append(c[f],x())}}}else if(n.nodeType===8)if(n.data===lt)l.push({type:2,index:r});else{let c=-1;for(;(c=n.data.indexOf($,c+1))!==-1;)l.push({type:7,index:r}),c+=$.length-1}r++}}static createElement(t,e){let i=v.createElement("template");return i.innerHTML=t,i}};function C(s,t,e=s,i){if(t===E)return t;let n=i===void 0?e._$Cl:e._$Co?.[i],r=M(t)?void 0:t._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),r===void 0?n=void 0:(n=new r(s),n._$AT(s,e,i)),i===void 0?e._$Cl=n:(e._$Co??=[])[i]=n),n!==void 0&&(t=C(s,n._$AS(s,t.values),n,i)),t}var zt=class{constructor(s,t){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){let{el:{content:t},parts:e}=this._$AD,i=(s?.creationScope??v).importNode(t,!0);b.currentNode=i;let n=b.nextNode(),r=0,o=0,a=e[0];for(;a!==void 0;){if(r===a.index){let l;a.type===2?l=new X(n,n.nextSibling,this,s):a.type===1?l=new a.ctor(n,a.name,a.strings,this,s):a.type===6&&(l=new Kt(n,this,s)),this._$AV.push(l),a=e[++o]}r!==a?.index&&(n=b.nextNode(),r++)}return b.currentNode=v,i}p(s){let t=0;for(let e of this._$AV)e!==void 0&&(e.strings===void 0?e._$AI(s[t]):(e._$AI(s,e,t),t+=e.strings.length-2)),t++}},X=class St{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,n){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=C(this,t,e),M(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==E&&this._(t):t._$litType$===void 0?t.nodeType===void 0?Lt(t)?this.k(t):this._(t):this.T(t):this.$(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(v.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:i}=t,n=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=G.createElement(mt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(e);else{let r=new zt(n,this),o=r.u(this.options);r.p(e),this.T(o),this._$AH=r}}_$AC(t){let e=ft.get(t.strings);return e===void 0&&ft.set(t.strings,e=new G(t)),e}k(t){V(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,n=0;for(let r of t)n===e.length?e.push(i=new St(this.O(x()),this.O(x()),this,this.options)):i=e[n],i._$AI(r),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let i=ot(t).nextSibling;ot(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},I=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(s,t,e,i,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=s,this.name=t,this._$AM=i,this.options=n,e.length>2||e[0]!==""||e[1]!==""?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=d}_$AI(s,t=this,e,i){let n=this.strings,r=!1;if(n===void 0)s=C(this,s,t,0),r=!M(s)||s!==this._$AH&&s!==E,r&&(this._$AH=s);else{let o=s,a,l;for(s=n[0],a=0;a<n.length-1;a++)l=C(this,o[e+a],t,a),l===E&&(l=this._$AH[a]),r||=!M(l)||l!==this._$AH[a],l===d?s=d:s!==d&&(s+=(l??"")+n[a+1]),this._$AH[a]=l}r&&!i&&this.j(s)}j(s){s===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,s??"")}},jt=class extends I{constructor(){super(...arguments),this.type=3}j(s){this.element[this.name]=s===d?void 0:s}},Bt=class extends I{constructor(){super(...arguments),this.type=4}j(s){this.element.toggleAttribute(this.name,!!s&&s!==d)}},qt=class extends I{constructor(s,t,e,i,n){super(s,t,e,i,n),this.type=5}_$AI(s,t=this){if((s=C(this,s,t,0)??d)===E)return;let e=this._$AH,i=s===d&&e!==d||s.capture!==e.capture||s.once!==e.once||s.passive!==e.passive,n=s!==d&&(e===d||i);i&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,s),this._$AH=s}handleEvent(s){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,s):this._$AH.handleEvent(s)}},Kt=class{constructor(s,t,e){this.element=s,this.type=6,this._$AN=void 0,this._$AM=t,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(s){C(this,s)}},Ft=F.litHtmlPolyfillSupport;Ft?.(G,X),(F.litHtmlVersions??=[]).push("3.3.2");var Vt=(s,t,e)=>{let i=e?.renderBefore??t,n=i._$litPart$;if(n===void 0){let r=e?.renderBefore??null;i._$litPart$=n=new X(t.insertBefore(x(),r),r,void 0,e??{})}return n._$AI(s),n},Y=globalThis,U=class extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let s=super.createRenderRoot();return this.renderOptions.renderBefore??=s.firstChild,s}update(s){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(s),this._$Do=Vt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return E}};U._$litElement$=!0,U.finalized=!0,Y.litElementHydrateSupport?.({LitElement:U});var Wt=Y.litElementPolyfillSupport;Wt?.({LitElement:U}),(Y.litElementVersions??=[]).push("4.2.2");var u=[];for(let s=0;s<256;++s)u.push((s+256).toString(16).slice(1));function Gt(s,t=0){return(u[s[t+0]]+u[s[t+1]]+u[s[t+2]]+u[s[t+3]]+"-"+u[s[t+4]]+u[s[t+5]]+"-"+u[s[t+6]]+u[s[t+7]]+"-"+u[s[t+8]]+u[s[t+9]]+"-"+u[s[t+10]]+u[s[t+11]]+u[s[t+12]]+u[s[t+13]]+u[s[t+14]]+u[s[t+15]]).toLowerCase()}var J,Xt=new Uint8Array(16);function Yt(){if(!J){if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");J=crypto.getRandomValues.bind(crypto)}return J(Xt)}var $t={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Jt(s,t,e){s||={};let i=s.random??s.rng?.()??Yt();if(i.length<16)throw Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Gt(i)}function Zt(s,t,e){return $t.randomUUID&&!t&&!s?$t.randomUUID():Jt(s,t)}function Qt(s="hp"){return`${s}-${Zt()}`}var S=class extends U{createRenderRoot(){return this}emit(s,t){let e=new CustomEvent(`hp-${s}`,{detail:t,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(e),e}_hpId=Qt();get hpId(){return this._hpId}};function w(s){return function(t){typeof window<"u"&&(customElements.get(s)||customElements.define(s,t))}}/**
(function(l,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(l=typeof globalThis<"u"?globalThis:l||self,m(l.HeadlessPrimitivesContextMenu={}))})(this,function(l){"use strict";var m=globalThis,q=m.ShadowRoot&&(m.ShadyCSS===void 0||m.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,tt=Symbol(),et=new WeakMap,wt=class{constructor(t,s,i){if(this._$cssResult$=!0,i!==tt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o,s=this.t;if(q&&t===void 0){let i=s!==void 0&&s.length===1;i&&(t=et.get(s)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&et.set(s,t))}return t}toString(){return this.cssText}},xt=e=>new wt(typeof e=="string"?e:e+"",void 0,tt),Pt=(e,t)=>{if(q)e.adoptedStyleSheets=t.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of t){let i=document.createElement("style"),n=m.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=s.cssText,e.appendChild(i)}},st=q?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let s="";for(let i of t.cssRules)s+=i.cssText;return xt(s)})(e):e,{is:Mt,defineProperty:Ot,getOwnPropertyDescriptor:Ut,getOwnPropertyNames:Ht,getOwnPropertySymbols:Rt,getPrototypeOf:kt}=Object,k=globalThis,it=k.trustedTypes,Tt=it?it.emptyScript:"",It=k.reactiveElementPolyfillSupport,x=(e,t)=>e,F={toAttribute(e,t){switch(t){case Boolean:e=e?Tt:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=e!==null;break;case Number:s=e===null?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch{s=null}}return s}},nt=(e,t)=>!Mt(e,t),rt={attribute:!0,type:String,converter:F,reflect:!1,useDefault:!1,hasChanged:nt};Symbol.metadata??=Symbol("metadata"),k.litPropertyMetadata??=new WeakMap;var A=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=rt){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&Ot(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){let{get:i,set:n}=Ut(this.prototype,e)??{get(){return this[t]},set(r){this[t]=r}};return{get:i,set(r){let o=i?.call(this);n?.call(this,r),this.requestUpdate(e,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??rt}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;let e=kt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){let t=this.properties,s=[...Ht(t),...Rt(t)];for(let i of s)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(let[t,s]of this.elementProperties){let i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let s=new Set(e.flat(1/0).reverse());for(let i of s)t.unshift(st(i))}else e!==void 0&&t.push(st(e));return t}static _$Eu(e,t){let s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Pt(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){let s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){let n=(s.converter?.toAttribute===void 0?F:s.converter).toAttribute(t,s.type);this._$Em=e,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){let s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let n=s.getPropertyOptions(i),r=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute===void 0?F:n.converter;this._$Em=i;let o=r.fromAttribute(t,n.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){if(e!==void 0){let r=this.constructor;if(i===!1&&(n=this[e]),s??=r.getPropertyOptions(e),!((s.hasChanged??nt)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:n},r){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),n!==!0||r!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let s=this.constructor.elementProperties;if(s.size>0)for(let[i,n]of s){let{wrapped:r}=n,o=this[i];r!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,n,o)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(t)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[x("elementProperties")]=new Map,A[x("finalized")]=new Map,It?.({ReactiveElement:A}),(k.reactiveElementVersions??=[]).push("2.1.2");var K=globalThis,ot=e=>e,T=K.trustedTypes,at=T?T.createPolicy("lit-html",{createHTML:e=>e}):void 0,lt="$lit$",$=`lit$${Math.random().toFixed(9).slice(2)}$`,ht="?"+$,Dt=`<${ht}>`,y=document,P=()=>y.createComment(""),M=e=>e===null||typeof e!="object"&&typeof e!="function",V=Array.isArray,Lt=e=>V(e)||typeof e?.[Symbol.iterator]=="function",W=`[
\f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ct=/-->/g,dt=/>/g,v=RegExp(`>|${W}(?:([^\\s"'>=/]+)(${W}*=${W}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),ut=/'/g,pt=/"/g,_t=/^(?:script|style|textarea|title)$/i,E=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),ft=new WeakMap,b=y.createTreeWalker(y,129);function mt(e,t){if(!V(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return at===void 0?t:at.createHTML(t)}var Nt=(e,t)=>{let s=e.length-1,i=[],n,r=t===2?"<svg>":t===3?"<math>":"",o=O;for(let a=0;a<s;a++){let h=e[a],z,p,c=-1,f=0;for(;f<h.length&&(o.lastIndex=f,p=o.exec(h),p!==null);)f=o.lastIndex,o===O?p[1]==="!--"?o=ct:p[1]===void 0?p[2]===void 0?p[3]!==void 0&&(o=v):(_t.test(p[2])&&(n=RegExp("</"+p[2],"g")),o=v):o=dt:o===v?p[0]===">"?(o=n??O,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,z=p[1],o=p[3]===void 0?v:p[3]==='"'?pt:ut):o===pt||o===ut?o=v:o===ct||o===dt?o=O:(o=v,n=void 0);let g=o===v&&e[a+1].startsWith("/>")?" ":"";r+=o===O?h+Dt:c>=0?(i.push(z),h.slice(0,c)+lt+h.slice(c)+$+g):h+$+(c===-2?a:g)}return[mt(e,r+(e[s]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},X=class Ct{constructor({strings:t,_$litType$:s},i){let n;this.parts=[];let r=0,o=0,a=t.length-1,h=this.parts,[z,p]=Nt(t,s);if(this.el=Ct.createElement(z,i),b.currentNode=this.el.content,s===2||s===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(n=b.nextNode())!==null&&h.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let c of n.getAttributeNames())if(c.endsWith(lt)){let f=p[o++],g=n.getAttribute(c).split($),B=/([.?@])?(.*)/.exec(f);h.push({type:1,index:r,name:B[2],strings:g,ctor:B[1]==="."?zt:B[1]==="?"?Bt:B[1]==="@"?qt:I}),n.removeAttribute(c)}else c.startsWith($)&&(h.push({type:6,index:r}),n.removeAttribute(c));if(_t.test(n.tagName)){let c=n.textContent.split($),f=c.length-1;if(f>0){n.textContent=T?T.emptyScript:"";for(let g=0;g<f;g++)n.append(c[g],P()),b.nextNode(),h.push({type:2,index:++r});n.append(c[f],P())}}}else if(n.nodeType===8)if(n.data===ht)h.push({type:2,index:r});else{let c=-1;for(;(c=n.data.indexOf($,c+1))!==-1;)h.push({type:7,index:r}),c+=$.length-1}r++}}static createElement(t,s){let i=y.createElement("template");return i.innerHTML=t,i}};function C(e,t,s=e,i){if(t===E)return t;let n=i===void 0?s._$Cl:s._$Co?.[i],r=M(t)?void 0:t._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),r===void 0?n=void 0:(n=new r(e),n._$AT(e,s,i)),i===void 0?s._$Cl=n:(s._$Co??=[])[i]=n),n!==void 0&&(t=C(e,n._$AS(e,t.values),n,i)),t}var jt=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??y).importNode(t,!0);b.currentNode=i;let n=b.nextNode(),r=0,o=0,a=s[0];for(;a!==void 0;){if(r===a.index){let h;a.type===2?h=new Y(n,n.nextSibling,this,e):a.type===1?h=new a.ctor(n,a.name,a.strings,this,e):a.type===6&&(h=new Ft(n,this,e)),this._$AV.push(h),a=s[++o]}r!==a?.index&&(n=b.nextNode(),r++)}return b.currentNode=y,i}p(e){let t=0;for(let s of this._$AV)s!==void 0&&(s.strings===void 0?s._$AI(e[t]):(s._$AI(e,s,t),t+=s.strings.length-2)),t++}},Y=class St{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,s,i,n){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=i,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,s=this._$AM;return s!==void 0&&t?.nodeType===11&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=C(this,t,s),M(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==E&&this._(t):t._$litType$===void 0?t.nodeType===void 0?Lt(t)?this.k(t):this._(t):this.T(t):this.$(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(y.createTextNode(t)),this._$AH=t}$(t){let{values:s,_$litType$:i}=t,n=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=X.createElement(mt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(s);else{let r=new jt(n,this),o=r.u(this.options);r.p(s),this.T(o),this._$AH=r}}_$AC(t){let s=ft.get(t.strings);return s===void 0&&ft.set(t.strings,s=new X(t)),s}k(t){V(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,i,n=0;for(let r of t)n===s.length?s.push(i=new St(this.O(P()),this.O(P()),this,this.options)):i=s[n],i._$AI(r),n++;n<s.length&&(this._$AR(i&&i._$AB.nextSibling,n),s.length=n)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t!==this._$AB;){let i=ot(t).nextSibling;ot(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},I=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=d,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(e,t=this,s,i){let n=this.strings,r=!1;if(n===void 0)e=C(this,e,t,0),r=!M(e)||e!==this._$AH&&e!==E,r&&(this._$AH=e);else{let o=e,a,h;for(e=n[0],a=0;a<n.length-1;a++)h=C(this,o[s+a],t,a),h===E&&(h=this._$AH[a]),r||=!M(h)||h!==this._$AH[a],h===d?e=d:e!==d&&(e+=(h??"")+n[a+1]),this._$AH[a]=h}r&&!i&&this.j(e)}j(e){e===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},zt=class extends I{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===d?void 0:e}},Bt=class extends I{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==d)}},qt=class extends I{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=C(this,e,t,0)??d)===E)return;let s=this._$AH,i=e===d&&s!==d||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ft=class{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){C(this,e)}},Kt=K.litHtmlPolyfillSupport;Kt?.(X,Y),(K.litHtmlVersions??=[]).push("3.3.2");var Vt=(e,t,s)=>{let i=s?.renderBefore??t,n=i._$litPart$;if(n===void 0){let r=s?.renderBefore??null;i._$litPart$=n=new Y(t.insertBefore(P(),r),r,void 0,s??{})}return n._$AI(e),n},G=globalThis,U=class extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Vt(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return E}};U._$litElement$=!0,U.finalized=!0,G.litElementHydrateSupport?.({LitElement:U});var Wt=G.litElementPolyfillSupport;Wt?.({LitElement:U}),(G.litElementVersions??=[]).push("4.2.2");var u=[];for(let e=0;e<256;++e)u.push((e+256).toString(16).slice(1));function Xt(e,t=0){return(u[e[t+0]]+u[e[t+1]]+u[e[t+2]]+u[e[t+3]]+"-"+u[e[t+4]]+u[e[t+5]]+"-"+u[e[t+6]]+u[e[t+7]]+"-"+u[e[t+8]]+u[e[t+9]]+"-"+u[e[t+10]]+u[e[t+11]]+u[e[t+12]]+u[e[t+13]]+u[e[t+14]]+u[e[t+15]]).toLowerCase()}var J,Yt=new Uint8Array(16);function Gt(){if(!J){if(typeof crypto>"u"||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");J=crypto.getRandomValues.bind(crypto)}return J(Yt)}var $t={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Jt(e,t,s){e||={};let i=e.random??e.rng?.()??Gt();if(i.length<16)throw Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Xt(i)}function Zt(e,t,s){return $t.randomUUID&&!t&&!e?$t.randomUUID():Jt(e,t)}function Qt(e="hp"){return`${e}-${Zt()}`}var S=class extends U{createRenderRoot(){return this}emit(e,t){let s=new CustomEvent(`hp-${e}`,{detail:t,bubbles:!0,composed:!0,cancelable:!0});return this.dispatchEvent(s),s}_hpId=Qt();get hpId(){return this._hpId}_abortController=null;get signal(){return(!this._abortController||this._abortController.signal.aborted)&&(this._abortController=new AbortController),this._abortController.signal}connectedCallback(){super.connectedCallback(),(!this._abortController||this._abortController.signal.aborted)&&(this._abortController=new AbortController)}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort(),this._abortController=null}};function w(e){return function(t){typeof window<"u"&&(customElements.get(e)||customElements.define(e,t))}}function te(e){let t=[],s=e.parentElement;for(;s;){let{overflow:i,overflowY:n,overflowX:r}=getComputedStyle(s);/auto|scroll|overlay/.test(i+n+r)&&t.push(s),s=s.parentElement}return t.push(window),t}/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const D=globalThis,Z=D.ShadowRoot&&(D.ShadyCSS===void 0||D.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,gt=Symbol(),vt=new WeakMap;let te=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==gt)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(Z&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=vt.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&vt.set(e,t))}return t}toString(){return this.cssText}};const ee=s=>new te(typeof s=="string"?s:s+"",void 0,gt),se=(s,t)=>{if(Z)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const i=document.createElement("style"),n=D.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=e.cssText,s.appendChild(i)}},yt=Z?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return ee(e)})(s):s;/**
*/const D=globalThis,Z=D.ShadowRoot&&(D.ShadyCSS===void 0||D.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,gt=Symbol(),yt=new WeakMap;let ee=class{constructor(t,s,i){if(this._$cssResult$=!0,i!==gt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o;const s=this.t;if(Z&&t===void 0){const i=s!==void 0&&s.length===1;i&&(t=yt.get(s)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&yt.set(s,t))}return t}toString(){return this.cssText}};const se=e=>new ee(typeof e=="string"?e:e+"",void 0,gt),ie=(e,t)=>{if(Z)e.adoptedStyleSheets=t.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(const s of t){const i=document.createElement("style"),n=D.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=s.cssText,e.appendChild(i)}},vt=Z?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let s="";for(const i of t.cssRules)s+=i.cssText;return se(s)})(e):e;/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const{is:ie,defineProperty:ne,getOwnPropertyDescriptor:re,getOwnPropertyNames:oe,getOwnPropertySymbols:ae,getPrototypeOf:he}=Object,L=globalThis,bt=L.trustedTypes,le=bt?bt.emptyScript:"",ce=L.reactiveElementPolyfillSupport,H=(s,t)=>s,N={toAttribute(s,t){switch(t){case Boolean:s=s?le:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Q=(s,t)=>!ie(s,t),At={attribute:!0,type:String,converter:N,reflect:!1,useDefault:!1,hasChanged:Q};Symbol.metadata??=Symbol("metadata"),L.litPropertyMetadata??=new WeakMap;class R extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=At){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,e);n!==void 0&&ne(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){const{get:n,set:r}=re(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get:n,set(o){const a=n?.call(this);r?.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??At}static _$Ei(){if(this.hasOwnProperty(H("elementProperties")))return;const t=he(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(H("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(H("properties"))){const e=this.properties,i=[...oe(e),...ae(e)];for(const n of i)this.createProperty(n,e[n])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,n]of e)this.elementProperties.set(i,n)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const n=this._$Eu(e,i);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const n of i)e.unshift(yt(n))}else t!==void 0&&e.push(yt(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return se(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(n!==void 0&&i.reflect===!0){const r=(i.converter?.toAttribute!==void 0?i.converter:N).toAttribute(e,i.type);this._$Em=t,r==null?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){const i=this.constructor,n=i._$Eh.get(t);if(n!==void 0&&this._$Em!==n){const r=i.getPropertyOptions(n),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:N;this._$Em=n;const a=o.fromAttribute(e,r.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(t,e,i,n=!1,r){if(t!==void 0){const o=this.constructor;if(n===!1&&(r=this[t]),i??=o.getPropertyOptions(t),!((i.hasChanged??Q)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:n,wrapped:r},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),r!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),n===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[n,r]of this._$Ep)this[n]=r;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,r]of i){const{wrapped:o}=r,a=this[n];o!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,r,a)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}}R.elementStyles=[],R.shadowRootOptions={mode:"open"},R[H("elementProperties")]=new Map,R[H("finalized")]=new Map,ce?.({ReactiveElement:R}),(L.reactiveElementVersions??=[]).push("2.1.2");/**
*/const{is:ne,defineProperty:re,getOwnPropertyDescriptor:oe,getOwnPropertyNames:ae,getOwnPropertySymbols:le,getPrototypeOf:he}=Object,L=globalThis,bt=L.trustedTypes,ce=bt?bt.emptyScript:"",de=L.reactiveElementPolyfillSupport,H=(e,t)=>e,N={toAttribute(e,t){switch(t){case Boolean:e=e?ce:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=e!==null;break;case Number:s=e===null?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch{s=null}}return s}},Q=(e,t)=>!ne(e,t),At={attribute:!0,type:String,converter:N,reflect:!1,useDefault:!1,hasChanged:Q};Symbol.metadata??=Symbol("metadata"),L.litPropertyMetadata??=new WeakMap;class R extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=At){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,s);n!==void 0&&re(this.prototype,t,n)}}static getPropertyDescriptor(t,s,i){const{get:n,set:r}=oe(this.prototype,t)??{get(){return this[s]},set(o){this[s]=o}};return{get:n,set(o){const a=n?.call(this);r?.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??At}static _$Ei(){if(this.hasOwnProperty(H("elementProperties")))return;const t=he(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(H("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(H("properties"))){const s=this.properties,i=[...ae(s),...le(s)];for(const n of i)this.createProperty(n,s[n])}const t=this[Symbol.metadata];if(t!==null){const s=litPropertyMetadata.get(t);if(s!==void 0)for(const[i,n]of s)this.elementProperties.set(i,n)}this._$Eh=new Map;for(const[s,i]of this.elementProperties){const n=this._$Eu(s,i);n!==void 0&&this._$Eh.set(n,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const s=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const n of i)s.unshift(vt(n))}else t!==void 0&&s.push(vt(t));return s}static _$Eu(t,s){const i=s.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ie(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(n!==void 0&&i.reflect===!0){const r=(i.converter?.toAttribute!==void 0?i.converter:N).toAttribute(s,i.type);this._$Em=t,r==null?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,s){const i=this.constructor,n=i._$Eh.get(t);if(n!==void 0&&this._$Em!==n){const r=i.getPropertyOptions(n),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:N;this._$Em=n;const a=o.fromAttribute(s,r.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(t,s,i,n=!1,r){if(t!==void 0){const o=this.constructor;if(n===!1&&(r=this[t]),i??=o.getPropertyOptions(t),!((i.hasChanged??Q)(r,s)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,s,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:n,wrapped:r},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??s??this[t]),r!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),n===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[n,r]of this._$Ep)this[n]=r;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[n,r]of i){const{wrapped:o}=r,a=this[n];o!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,r,a)}}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(s)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(s=>this._$ET(s,this[s])),this._$EM()}updated(t){}firstUpdated(t){}}R.elementStyles=[],R.shadowRootOptions={mode:"open"},R[H("elementProperties")]=new Map,R[H("finalized")]=new Map,de?.({ReactiveElement:R}),(L.reactiveElementVersions??=[]).push("2.1.2");/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const de={attribute:!0,type:String,converter:N,reflect:!1,hasChanged:Q},ue=(s=de,t,e)=>{const{kind:i,metadata:n}=e;let r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),i==="setter"&&((s=Object.create(s)).wrapped=!0),r.set(e.name,s),i==="accessor"){const{name:o}=e;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,l,s,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,s,a),a}}}if(i==="setter"){const{name:o}=e;return function(a){const l=this[o];t.call(this,a),this.requestUpdate(o,l,s,!0,a)}}throw Error("Unsupported decorator location: "+i)};function z(s){return(t,e)=>typeof e=="object"?ue(s,t,e):((i,n,r)=>{const o=n.hasOwnProperty(r);return n.constructor.createProperty(r,i),o?Object.getOwnPropertyDescriptor(n,r):void 0})(s,t,e)}var Et=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,_e=(s,t,e)=>t in s?Et(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,_=(s,t,e,i)=>{for(var n=i>1?void 0:i?pe(t,e):t,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(t,e,n):o(n))||n);return i&&n&&Et(t,e,n),n},fe=(s,t,e)=>_e(s,t+"",e);h.HeadlessContextMenu=class extends S{_open=!1;_trigger=null;_content=null;_items=[];_activeIndex=-1;_cursorX=0;_cursorY=0;_previousFocus=null;_scrollParents=[];disabled=!1;get open(){return this._open}set open(t){this._open=!!t,this._sync()}connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu"),this._setupRefs(),this._bind(),this._sync(),requestAnimationFrame(()=>this._sync())}disconnectedCallback(){super.disconnectedCallback(),this._removeGlobalListeners(),h.HeadlessContextMenu._currentOpen===this&&(h.HeadlessContextMenu._currentOpen=null)}_setupRefs(){this._trigger=this.querySelector("hp-context-menu-trigger"),this._content=this.querySelector("hp-context-menu-content"),this._items=Array.from(this.querySelectorAll("hp-context-menu-item"))}_bind(){this._trigger&&(this._trigger.addEventListener("contextmenu",this._onContextMenu),this._trigger.addEventListener("keydown",this._onTriggerKeyDown)),this._content&&this._content.addEventListener("keydown",this._onMenuKeyDown);for(const t of this._items)t.addEventListener("click",this._onItemClick)}_setupRoving(){if(!this._content)return;this._items.filter(e=>!e.disabled).forEach((e,i)=>{e.setAttribute("tabindex",i===0?"0":"-1")})}_computePosition(){if(!this._content)return;const t=this.getBoundingClientRect(),e=this._cursorX-t.left,i=this._cursorY-t.top;this._content.style.left=`${e}px`,this._content.style.top=`${i}px`}_onContextMenu=t=>{this.disabled||(t.preventDefault(),t.stopPropagation(),this._cursorX=t.clientX,this._cursorY=t.clientY,this._previousFocus=document.activeElement,h.HeadlessContextMenu._currentOpen&&h.HeadlessContextMenu._currentOpen!==this&&h.HeadlessContextMenu._currentOpen.close(),this.openMenu("first"))};_onTriggerKeyDown=t=>{if(!this.disabled&&(t.key==="F10"&&t.shiftKey||t.key==="ContextMenu")){t.preventDefault();const e=document.activeElement||this._trigger,i=e.getBoundingClientRect();this._cursorX=i.left+i.width/2,this._cursorY=i.top+i.height/2,this._previousFocus=e,h.HeadlessContextMenu._currentOpen&&h.HeadlessContextMenu._currentOpen!==this&&h.HeadlessContextMenu._currentOpen.close(),this.openMenu("first")}};_onMenuKeyDown=t=>{if(!this.open)return;const e=this._items[this._activeIndex];switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),this._moveActive(1);break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),this._moveActive(-1);break;case"Home":t.preventDefault(),this._moveToEdge("first");break;case"End":t.preventDefault(),this._moveToEdge("last");break;case"Enter":case" ":t.preventDefault(),e&&!e.disabled&&this._activateItem(e);break;case"Escape":t.preventDefault(),this.close();break;case"Tab":this.close();break}};_onItemClick=t=>{const e=t.currentTarget;e.disabled||this._activateItem(e)};_activateItem(t){const e={value:t.value,label:t.textContent?.trim()||null,item:t};this.emit("select",e),this.close()}_emitHighlight(){const t=this._items[this._activeIndex]||null,e={value:t?t.value:null,label:t&&t.textContent?.trim()||null,item:t};this.emit("highlight",e)}_moveActive(t){const e=this._items.filter(a=>!a.disabled);if(e.length===0)return;const i=this._items[this._activeIndex];let n=e.indexOf(i);n===-1&&(n=0);const r=(n+t+e.length)%e.length,o=e[r];this._setActiveIndex(this._items.indexOf(o))}_moveToEdge(t){const e=this._items.filter(n=>!n.disabled);if(e.length===0)return;const i=t==="first"?e[0]:e[e.length-1];this._setActiveIndex(this._items.indexOf(i))}_setActiveIndex(t){if(!this._content||t<0||t>=this._items.length)return;this._activeIndex=t;const e=this._items[t];e&&(e.id||(e.id=`hp-context-menu-item-${e.hpId}`),this._content.setAttribute("aria-activedescendant",e.id),e.scrollIntoView({block:"nearest"}),this._emitHighlight())}_sync(){this._setupRefs(),this._trigger&&this._trigger.setAttribute("data-state",this._open?"open":"closed"),this._content&&(this._content.setAttribute("role","menu"),this._content.setAttribute("data-state",this._open?"open":"closed"),this._content.setAttribute("aria-hidden",this._open?"false":"true"),this._content.id||(this._content.id=`hp-context-menu-content-${this.hpId}`));for(const t of this._items)t.setAttribute("role","menuitem"),t.setAttribute("aria-disabled",String(t.disabled));if(this._open){h.HeadlessContextMenu._currentOpen=this,this._setupRoving();const t=this._items.findIndex(e=>!e.disabled);if(t>=0&&this._setActiveIndex(t),this._computePosition(),document.addEventListener("click",this._onClickOutside),document.addEventListener("contextmenu",this._onClickOutside),document.addEventListener("keydown",this._onGlobalKeydown),this._trigger){this._scrollParents=this._getScrollParents(this._trigger);for(const e of this._scrollParents)e.addEventListener("scroll",this._onScrollOrResize,{passive:!0})}window.addEventListener("resize",this._onScrollOrResize,{passive:!0}),this.emit("open")}else h.HeadlessContextMenu._currentOpen===this&&(h.HeadlessContextMenu._currentOpen=null),this._removeGlobalListeners(),this.emit("close")}_getScrollParents(t){const e=[];let i=t.parentElement;for(;i;){const{overflow:n,overflowY:r,overflowX:o}=getComputedStyle(i);/auto|scroll|overlay/.test(n+r+o)&&e.push(i),i=i.parentElement}return e.push(window),e}_removeGlobalListeners(){document.removeEventListener("click",this._onClickOutside),document.removeEventListener("contextmenu",this._onClickOutside),document.removeEventListener("keydown",this._onGlobalKeydown);for(const t of this._scrollParents)t.removeEventListener("scroll",this._onScrollOrResize);this._scrollParents=[],window.removeEventListener("resize",this._onScrollOrResize)}_onClickOutside=t=>{if(!this._open||!this._content)return;const e=t.target;this._content.contains(e)||this.close()};_onGlobalKeydown=t=>{t.key==="Escape"&&this._open&&(t.preventDefault(),this.close())};_onScrollOrResize=()=>{this._open&&this.close()};openMenu(t){this.disabled||(this.open=!0,t&&this._moveToEdge(t))}close(){this.open=!1,this._previousFocus&&typeof this._previousFocus.focus=="function"&&(this._previousFocus.focus(),this._previousFocus=null)}toggle(){this.open=!this.open}},fe(h.HeadlessContextMenu,"_currentOpen",null),_([z({type:Boolean,reflect:!0})],h.HeadlessContextMenu.prototype,"disabled",2),_([z({type:Boolean,reflect:!0})],h.HeadlessContextMenu.prototype,"open",1),h.HeadlessContextMenu=_([w("hp-context-menu")],h.HeadlessContextMenu),h.HeadlessContextMenuTrigger=class extends S{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-trigger")}},h.HeadlessContextMenuTrigger=_([w("hp-context-menu-trigger")],h.HeadlessContextMenuTrigger),h.HeadlessContextMenuContent=class extends S{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-content"),this.id||(this.id=`hp-context-menu-content-${this.hpId}`)}},h.HeadlessContextMenuContent=_([w("hp-context-menu-content")],h.HeadlessContextMenuContent),h.HeadlessContextMenuItem=class extends S{value="";disabled=!1;connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-item"),this.id||(this.id=`hp-context-menu-item-${this.hpId}`),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1")}},_([z({type:String,reflect:!0})],h.HeadlessContextMenuItem.prototype,"value",2),_([z({type:Boolean,reflect:!0})],h.HeadlessContextMenuItem.prototype,"disabled",2),h.HeadlessContextMenuItem=_([w("hp-context-menu-item")],h.HeadlessContextMenuItem),h.HeadlessContextMenuSeparator=class extends S{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-separator"),this.setAttribute("role","separator")}},h.HeadlessContextMenuSeparator=_([w("hp-context-menu-separator")],h.HeadlessContextMenuSeparator),h.HeadlessContextMenuLabel=class extends S{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-label"),this.setAttribute("role","presentation")}},h.HeadlessContextMenuLabel=_([w("hp-context-menu-label")],h.HeadlessContextMenuLabel),Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
*/const ue={attribute:!0,type:String,converter:N,reflect:!1,hasChanged:Q},pe=(e=ue,t,s)=>{const{kind:i,metadata:n}=s;let r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),i==="setter"&&((e=Object.create(e)).wrapped=!0),r.set(s.name,e),i==="accessor"){const{name:o}=s;return{set(a){const h=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,h,e,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,e,a),a}}}if(i==="setter"){const{name:o}=s;return function(a){const h=this[o];t.call(this,a),this.requestUpdate(o,h,e,!0,a)}}throw Error("Unsupported decorator location: "+i)};function j(e){return(t,s)=>typeof s=="object"?pe(e,t,s):((i,n,r)=>{const o=n.hasOwnProperty(r);return n.constructor.createProperty(r,i),o?Object.getOwnPropertyDescriptor(n,r):void 0})(e,t,s)}var Et=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,fe=(e,t,s)=>t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,_=(e,t,s,i)=>{for(var n=i>1?void 0:i?_e(t,s):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(n=(i?o(t,s,n):o(n))||n);return i&&n&&Et(t,s,n),n},me=(e,t,s)=>fe(e,t+"",s);l.HeadlessContextMenu=class extends S{_open=!1;_prevOpen=!1;_trigger=null;_content=null;_items=[];_activeIndex=-1;_cursorX=0;_cursorY=0;_openController=null;_previousFocus=null;_scrollParents=[];disabled=!1;get open(){return this._open}set open(t){this._open=!!t,this._sync()}connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu"),this._setupRefs(),this._bind(),this._sync(),requestAnimationFrame(()=>this._sync())}disconnectedCallback(){super.disconnectedCallback(),this._removeGlobalListeners(),l.HeadlessContextMenu._currentOpen===this&&(l.HeadlessContextMenu._currentOpen=null)}_setupRefs(){this._trigger=this.querySelector("hp-context-menu-trigger"),this._content=this.querySelector("hp-context-menu-content"),this._items=Array.from(this.querySelectorAll("hp-context-menu-item"))}_bind(){this._trigger&&(this._trigger.addEventListener("contextmenu",this._onContextMenu),this._trigger.addEventListener("keydown",this._onTriggerKeyDown)),this._content&&this._content.addEventListener("keydown",this._onMenuKeyDown);for(const t of this._items)t.addEventListener("click",this._onItemClick)}_setupRoving(){if(!this._content)return;this._items.filter(s=>!s.disabled).forEach((s,i)=>{s.setAttribute("tabindex",i===0?"0":"-1")})}_computePosition(){if(!this._content)return;const t=this.getBoundingClientRect(),s=this._cursorX-t.left,i=this._cursorY-t.top;this._content.style.left=`${s}px`,this._content.style.top=`${i}px`}_onContextMenu=t=>{this.disabled||(t.preventDefault(),t.stopPropagation(),this._cursorX=t.clientX,this._cursorY=t.clientY,this._previousFocus=document.activeElement,l.HeadlessContextMenu._currentOpen&&l.HeadlessContextMenu._currentOpen!==this&&l.HeadlessContextMenu._currentOpen.close(),this.openMenu("first"))};_onTriggerKeyDown=t=>{if(!this.disabled&&(t.key==="F10"&&t.shiftKey||t.key==="ContextMenu")){t.preventDefault();const s=document.activeElement||this._trigger,i=s.getBoundingClientRect();this._cursorX=i.left+i.width/2,this._cursorY=i.top+i.height/2,this._previousFocus=s,l.HeadlessContextMenu._currentOpen&&l.HeadlessContextMenu._currentOpen!==this&&l.HeadlessContextMenu._currentOpen.close(),this.openMenu("first")}};_onMenuKeyDown=t=>{if(!this.open)return;const s=this._items[this._activeIndex];switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),this._moveActive(1);break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),this._moveActive(-1);break;case"Home":t.preventDefault(),this._moveToEdge("first");break;case"End":t.preventDefault(),this._moveToEdge("last");break;case"Enter":case" ":t.preventDefault(),s&&!s.disabled&&this._activateItem(s);break;case"Escape":t.preventDefault(),this.close();break;case"Tab":this.close();break}};_onItemClick=t=>{const s=t.currentTarget;s.disabled||this._activateItem(s)};_activateItem(t){const s={value:t.value,label:t.textContent?.trim()||null,item:t};this.emit("select",s),this.close()}_emitHighlight(){const t=this._items[this._activeIndex]||null,s={value:t?t.value:null,label:t&&t.textContent?.trim()||null,item:t};this.emit("highlight",s)}_moveActive(t){const s=this._items.filter(a=>!a.disabled);if(s.length===0)return;const i=this._items[this._activeIndex];let n=s.indexOf(i);n===-1&&(n=0);const r=(n+t+s.length)%s.length,o=s[r];this._setActiveIndex(this._items.indexOf(o))}_moveToEdge(t){const s=this._items.filter(n=>!n.disabled);if(s.length===0)return;const i=t==="first"?s[0]:s[s.length-1];this._setActiveIndex(this._items.indexOf(i))}_setActiveIndex(t){if(!this._content||t<0||t>=this._items.length)return;this._activeIndex=t;const s=this._items[t];s&&(s.id||(s.id=`hp-context-menu-item-${s.hpId}`),this._content.setAttribute("aria-activedescendant",s.id),s.scrollIntoView({block:"nearest"}),this._emitHighlight())}_sync(){this._setupRefs(),this._trigger&&this._trigger.setAttribute("data-state",this._open?"open":"closed"),this._content&&(this._content.setAttribute("role","menu"),this._content.setAttribute("data-state",this._open?"open":"closed"),this._content.setAttribute("aria-hidden",this._open?"false":"true"),this._content.id||(this._content.id=`hp-context-menu-content-${this.hpId}`));for(const t of this._items)t.setAttribute("role","menuitem"),t.setAttribute("aria-disabled",String(t.disabled));if(this._open){l.HeadlessContextMenu._currentOpen=this,this._setupRoving();const t=this._items.findIndex(i=>!i.disabled);t>=0&&this._setActiveIndex(t),this._computePosition(),this._openController?.abort(),this._openController=new AbortController;const s=this._openController.signal;if(document.addEventListener("click",this._onClickOutside,{signal:s}),document.addEventListener("contextmenu",this._onClickOutside,{signal:s}),document.addEventListener("keydown",this._onGlobalKeydown,{signal:s}),this._trigger){this._scrollParents=te(this._trigger);for(const i of this._scrollParents)i.addEventListener("scroll",this._onScrollOrResize,{signal:s,passive:!0})}window.addEventListener("resize",this._onScrollOrResize,{signal:s,passive:!0}),this._prevOpen||this.emit("open")}else l.HeadlessContextMenu._currentOpen===this&&(l.HeadlessContextMenu._currentOpen=null),this._removeGlobalListeners(),this._prevOpen&&this.emit("close");this._prevOpen=this._open}_removeGlobalListeners(){this._openController?.abort(),this._openController=null,this._scrollParents=[]}_onClickOutside=t=>{if(!this._open)return;const s=t.target;this.contains(s)||this.close()};_onGlobalKeydown=t=>{t.key==="Escape"&&this._open&&(t.preventDefault(),this.close())};_onScrollOrResize=()=>{this._open&&this.close()};openMenu(t){this.disabled||(this.open=!0,t&&this._moveToEdge(t))}close(){this.open=!1,this._previousFocus&&typeof this._previousFocus.focus=="function"&&(this._previousFocus.focus(),this._previousFocus=null)}toggle(){this.open=!this.open}},me(l.HeadlessContextMenu,"_currentOpen",null),_([j({type:Boolean,reflect:!0})],l.HeadlessContextMenu.prototype,"disabled",2),_([j({type:Boolean,reflect:!0})],l.HeadlessContextMenu.prototype,"open",1),l.HeadlessContextMenu=_([w("hp-context-menu")],l.HeadlessContextMenu),l.HeadlessContextMenuTrigger=class extends S{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-trigger")}},l.HeadlessContextMenuTrigger=_([w("hp-context-menu-trigger")],l.HeadlessContextMenuTrigger),l.HeadlessContextMenuContent=class extends S{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-content"),this.id||(this.id=`hp-context-menu-content-${this.hpId}`)}},l.HeadlessContextMenuContent=_([w("hp-context-menu-content")],l.HeadlessContextMenuContent),l.HeadlessContextMenuItem=class extends S{value="";disabled=!1;connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-item"),this.id||(this.id=`hp-context-menu-item-${this.hpId}`),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1")}},_([j({type:String,reflect:!0})],l.HeadlessContextMenuItem.prototype,"value",2),_([j({type:Boolean,reflect:!0})],l.HeadlessContextMenuItem.prototype,"disabled",2),l.HeadlessContextMenuItem=_([w("hp-context-menu-item")],l.HeadlessContextMenuItem),l.HeadlessContextMenuSeparator=class extends S{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-separator"),this.setAttribute("role","separator")}},l.HeadlessContextMenuSeparator=_([w("hp-context-menu-separator")],l.HeadlessContextMenuSeparator),l.HeadlessContextMenuLabel=class extends S{connectedCallback(){super.connectedCallback(),this.setAttribute("data-hp-component","context-menu-label"),this.setAttribute("role","presentation")}},l.HeadlessContextMenuLabel=_([w("hp-context-menu-label")],l.HeadlessContextMenuLabel),Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
{
"name": "@headless-primitives/context-menu",
"version": "1.0.0",
"version": "1.1.0",
"description": "Headless context menu primitive (right-click triggered action menu)",

@@ -41,3 +41,3 @@ "keywords": [

"lit": "^3.3.2",
"@headless-primitives/utils": "1.0.0"
"@headless-primitives/utils": "1.1.0"
},

@@ -44,0 +44,0 @@ "devDependencies": {