@mcgill-wsg/mcgill-ds
Version:
McGill Design System - a set of components and styles to adhere to McGill University standards.
978 lines (966 loc) • 34.6 kB
JavaScript
// ../node_modules/@lit/reactive-element/css-tag.js
var e = globalThis, t = e.ShadowRoot && (e.ShadyCSS === void 0 || e.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, n = Symbol(), r = /* @__PURE__ */ new WeakMap(), i = class {
constructor(e, t, r) {
if (this._$cssResult$ = !0, r !== n) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
this.cssText = e, this.t = t;
}
get styleSheet() {
let e = this.o, n = this.t;
if (t && e === void 0) {
let t = n !== void 0 && n.length === 1;
t && (e = r.get(n)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), t && r.set(n, e));
}
return e;
}
toString() {
return this.cssText;
}
}, a = (e) => new i(typeof e == "string" ? e : e + "", void 0, n), o = (e, ...t) => new i(e.length === 1 ? e[0] : t.reduce((t, n, r) => t + ((e) => {
if (!0 === e._$cssResult$) return e.cssText;
if (typeof e == "number") return e;
throw Error("Value passed to 'css' function must be a 'css' function result: " + e + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
})(n) + e[r + 1], e[0]), e, n), s = (n, r) => {
if (t) n.adoptedStyleSheets = r.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
else for (let t of r) {
let r = document.createElement("style"), i = e.litNonce;
i !== void 0 && r.setAttribute("nonce", i), r.textContent = t.cssText, n.appendChild(r);
}
}, c = t ? (e) => e : (e) => e instanceof CSSStyleSheet ? ((e) => {
let t = "";
for (let n of e.cssRules) t += n.cssText;
return a(t);
})(e) : e, { is: l, defineProperty: u, getOwnPropertyDescriptor: d, getOwnPropertyNames: ee, getOwnPropertySymbols: te, getPrototypeOf: ne } = Object, f = globalThis, re = f.trustedTypes, ie = re ? re.emptyScript : "", ae = f.reactiveElementPolyfillSupport, p = (e, t) => e, m = {
toAttribute(e, t) {
switch (t) {
case Boolean:
e = e ? ie : null;
break;
case Object:
case Array: e = e == null ? e : JSON.stringify(e);
}
return e;
},
fromAttribute(e, t) {
let n = e;
switch (t) {
case Boolean:
n = e !== null;
break;
case Number:
n = e === null ? null : Number(e);
break;
case Object:
case Array: try {
n = JSON.parse(e);
} catch {
n = null;
}
}
return n;
}
}, oe = (e, t) => !l(e, t), se = {
attribute: !0,
type: String,
converter: m,
reflect: !1,
useDefault: !1,
hasChanged: oe
};
Symbol.metadata ??= Symbol("metadata"), f.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
var h = 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 = se) {
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 n = Symbol(), r = this.getPropertyDescriptor(e, n, t);
r !== void 0 && u(this.prototype, e, r);
}
}
static getPropertyDescriptor(e, t, n) {
let { get: r, set: i } = d(this.prototype, e) ?? {
get() {
return this[t];
},
set(e) {
this[t] = e;
}
};
return {
get: r,
set(t) {
let a = r?.call(this);
i?.call(this, t), this.requestUpdate(e, a, n);
},
configurable: !0,
enumerable: !0
};
}
static getPropertyOptions(e) {
return this.elementProperties.get(e) ?? se;
}
static _$Ei() {
if (this.hasOwnProperty(p("elementProperties"))) return;
let e = ne(this);
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
}
static finalize() {
if (this.hasOwnProperty(p("finalized"))) return;
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(p("properties"))) {
let e = this.properties, t = [...ee(e), ...te(e)];
for (let n of t) this.createProperty(n, e[n]);
}
let e = this[Symbol.metadata];
if (e !== null) {
let t = litPropertyMetadata.get(e);
if (t !== void 0) for (let [e, n] of t) this.elementProperties.set(e, n);
}
this._$Eh = /* @__PURE__ */ new Map();
for (let [e, t] of this.elementProperties) {
let n = this._$Eu(e, t);
n !== void 0 && this._$Eh.set(n, e);
}
this.elementStyles = this.finalizeStyles(this.styles);
}
static finalizeStyles(e) {
let t = [];
if (Array.isArray(e)) {
let n = new Set(e.flat(1 / 0).reverse());
for (let e of n) t.unshift(c(e));
} else e !== void 0 && t.push(c(e));
return t;
}
static _$Eu(e, t) {
let n = t.attribute;
return !1 === n ? void 0 : typeof n == "string" ? n : 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 = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this));
}
addController(e) {
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
}
removeController(e) {
this._$EO?.delete(e);
}
_$E_() {
let e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
for (let n of t.keys()) this.hasOwnProperty(n) && (e.set(n, this[n]), delete this[n]);
e.size > 0 && (this._$Ep = e);
}
createRenderRoot() {
let e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
return s(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, n) {
this._$AK(e, n);
}
_$ET(e, t) {
let n = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, n);
if (r !== void 0 && !0 === n.reflect) {
let i = (n.converter?.toAttribute === void 0 ? m : n.converter).toAttribute(t, n.type);
this._$Em = e, i == null ? this.removeAttribute(r) : this.setAttribute(r, i), this._$Em = null;
}
}
_$AK(e, t) {
let n = this.constructor, r = n._$Eh.get(e);
if (r !== void 0 && this._$Em !== r) {
let e = n.getPropertyOptions(r), i = typeof e.converter == "function" ? { fromAttribute: e.converter } : e.converter?.fromAttribute === void 0 ? m : e.converter;
this._$Em = r;
let a = i.fromAttribute(t, e.type);
this[r] = a ?? this._$Ej?.get(r) ?? a, this._$Em = null;
}
}
requestUpdate(e, t, n, r = !1, i) {
if (e !== void 0) {
let a = this.constructor;
if (!1 === r && (i = this[e]), n ??= a.getPropertyOptions(e), !((n.hasChanged ?? oe)(i, t) || n.useDefault && n.reflect && i === this._$Ej?.get(e) && !this.hasAttribute(a._$Eu(e, n)))) return;
this.C(e, t, n);
}
!1 === this.isUpdatePending && (this._$ES = this._$EP());
}
C(e, t, { useDefault: n, reflect: r, wrapped: i }, a) {
n && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, a ?? t ?? this[e]), !0 !== i || a !== void 0) || (this._$AL.has(e) || (this.hasUpdated || n || (t = void 0), this._$AL.set(e, t)), !0 === r && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
}
async _$EP() {
this.isUpdatePending = !0;
try {
await this._$ES;
} catch (e) {
Promise.reject(e);
}
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 [e, t] of this._$Ep) this[e] = t;
this._$Ep = void 0;
}
let e = this.constructor.elementProperties;
if (e.size > 0) for (let [t, n] of e) {
let { wrapped: e } = n, r = this[t];
!0 !== e || this._$AL.has(t) || r === void 0 || this.C(t, void 0, n, r);
}
}
let e = !1, t = this._$AL;
try {
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((e) => e.hostUpdate?.()), this.update(t)) : this._$EM();
} catch (t) {
throw e = !1, this._$EM(), t;
}
e && this._$AE(t);
}
willUpdate(e) {}
_$AE(e) {
this._$EO?.forEach((e) => e.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
}
_$EM() {
this._$AL = /* @__PURE__ */ 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((e) => this._$ET(e, this[e])), this._$EM();
}
updated(e) {}
firstUpdated(e) {}
};
h.elementStyles = [], h.shadowRootOptions = { mode: "open" }, h[p("elementProperties")] = /* @__PURE__ */ new Map(), h[p("finalized")] = /* @__PURE__ */ new Map(), ae?.({ ReactiveElement: h }), (f.reactiveElementVersions ??= []).push("2.1.2");
// ../node_modules/lit-html/lit-html.js
var g = globalThis, _ = (e) => e, v = g.trustedTypes, y = v ? v.createPolicy("lit-html", { createHTML: (e) => e }) : void 0, b = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, S = "?" + x, ce = `<${S}>`, C = document, w = () => C.createComment(""), T = (e) => e === null || typeof e != "object" && typeof e != "function", E = Array.isArray, D = (e) => E(e) || typeof e?.[Symbol.iterator] == "function", O = "[ \n\f\r]", k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, A = /-->/g, j = />/g, M = RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), le = /'/g, ue = /"/g, de = /^(?:script|style|textarea|title)$/i, N = ((e) => (t, ...n) => ({
_$litType$: e,
strings: t,
values: n
}))(1), P = Symbol.for("lit-noChange"), F = Symbol.for("lit-nothing"), fe = /* @__PURE__ */ new WeakMap(), I = C.createTreeWalker(C, 129);
function L(e, t) {
if (!E(e) || !e.hasOwnProperty("raw")) throw Error("invalid template strings array");
return y === void 0 ? t : y.createHTML(t);
}
var R = (e, t) => {
let n = e.length - 1, r = [], i, a = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = k;
for (let t = 0; t < n; t++) {
let n = e[t], s, c, l = -1, u = 0;
for (; u < n.length && (o.lastIndex = u, c = o.exec(n), c !== null);) u = o.lastIndex, o === k ? c[1] === "!--" ? o = A : c[1] === void 0 ? c[2] === void 0 ? c[3] !== void 0 && (o = M) : (de.test(c[2]) && (i = RegExp("</" + c[2], "g")), o = M) : o = j : o === M ? c[0] === ">" ? (o = i ?? k, l = -1) : c[1] === void 0 ? l = -2 : (l = o.lastIndex - c[2].length, s = c[1], o = c[3] === void 0 ? M : c[3] === "\"" ? ue : le) : o === ue || o === le ? o = M : o === A || o === j ? o = k : (o = M, i = void 0);
let d = o === M && e[t + 1].startsWith("/>") ? " " : "";
a += o === k ? n + ce : l >= 0 ? (r.push(s), n.slice(0, l) + b + n.slice(l) + x + d) : n + x + (l === -2 ? t : d);
}
return [L(e, a + (e[n] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), r];
}, z = class e {
constructor({ strings: t, _$litType$: n }, r) {
let i;
this.parts = [];
let a = 0, o = 0, s = t.length - 1, c = this.parts, [l, u] = R(t, n);
if (this.el = e.createElement(l, r), I.currentNode = this.el.content, n === 2 || n === 3) {
let e = this.el.content.firstChild;
e.replaceWith(...e.childNodes);
}
for (; (i = I.nextNode()) !== null && c.length < s;) {
if (i.nodeType === 1) {
if (i.hasAttributes()) for (let e of i.getAttributeNames()) if (e.endsWith(b)) {
let t = u[o++], n = i.getAttribute(e).split(x), r = /([.?@])?(.*)/.exec(t);
c.push({
type: 1,
index: a,
name: r[2],
strings: n,
ctor: r[1] === "." ? W : r[1] === "?" ? pe : r[1] === "@" ? me : U
}), i.removeAttribute(e);
} else e.startsWith(x) && (c.push({
type: 6,
index: a
}), i.removeAttribute(e));
if (de.test(i.tagName)) {
let e = i.textContent.split(x), t = e.length - 1;
if (t > 0) {
i.textContent = v ? v.emptyScript : "";
for (let n = 0; n < t; n++) i.append(e[n], w()), I.nextNode(), c.push({
type: 2,
index: ++a
});
i.append(e[t], w());
}
}
} else if (i.nodeType === 8) {
if (i.data === S) c.push({
type: 2,
index: a
});
else {
let e = -1;
for (; (e = i.data.indexOf(x, e + 1)) !== -1;) c.push({
type: 7,
index: a
}), e += x.length - 1;
}
}
a++;
}
}
static createElement(e, t) {
let n = C.createElement("template");
return n.innerHTML = e, n;
}
};
function B(e, t, n = e, r) {
if (t === P) return t;
let i = r === void 0 ? n._$Cl : n._$Co?.[r], a = T(t) ? void 0 : t._$litDirective$;
return i?.constructor !== a && (i?._$AO?.(!1), a === void 0 ? i = void 0 : (i = new a(e), i._$AT(e, n, r)), r === void 0 ? n._$Cl = i : (n._$Co ??= [])[r] = i), i !== void 0 && (t = B(e, i._$AS(e, t.values), i, r)), t;
}
var V = 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: n } = this._$AD, r = (e?.creationScope ?? C).importNode(t, !0);
I.currentNode = r;
let i = I.nextNode(), a = 0, o = 0, s = n[0];
for (; s !== void 0;) {
if (a === s.index) {
let t;
s.type === 2 ? t = new H(i, i.nextSibling, this, e) : s.type === 1 ? t = new s.ctor(i, s.name, s.strings, this, e) : s.type === 6 && (t = new he(i, this, e)), this._$AV.push(t), s = n[++o];
}
a !== s?.index && (i = I.nextNode(), a++);
}
return I.currentNode = C, r;
}
p(e) {
let t = 0;
for (let n of this._$AV) n !== void 0 && (n.strings === void 0 ? n._$AI(e[t]) : (n._$AI(e, n, t), t += n.strings.length - 2)), t++;
}
}, H = class e {
get _$AU() {
return this._$AM?._$AU ?? this._$Cv;
}
constructor(e, t, n, r) {
this.type = 2, this._$AH = F, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = n, this.options = r, this._$Cv = r?.isConnected ?? !0;
}
get parentNode() {
let e = this._$AA.parentNode, t = this._$AM;
return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
}
get startNode() {
return this._$AA;
}
get endNode() {
return this._$AB;
}
_$AI(e, t = this) {
e = B(this, e, t), T(e) ? e === F || e == null || e === "" ? (this._$AH !== F && this._$AR(), this._$AH = F) : e !== this._$AH && e !== P && this._(e) : e._$litType$ === void 0 ? e.nodeType === void 0 ? D(e) ? this.k(e) : this._(e) : this.T(e) : this.$(e);
}
O(e) {
return this._$AA.parentNode.insertBefore(e, this._$AB);
}
T(e) {
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
}
_(e) {
this._$AH !== F && T(this._$AH) ? this._$AA.nextSibling.data = e : this.T(C.createTextNode(e)), this._$AH = e;
}
$(e) {
let { values: t, _$litType$: n } = e, r = typeof n == "number" ? this._$AC(e) : (n.el === void 0 && (n.el = z.createElement(L(n.h, n.h[0]), this.options)), n);
if (this._$AH?._$AD === r) this._$AH.p(t);
else {
let e = new V(r, this), n = e.u(this.options);
e.p(t), this.T(n), this._$AH = e;
}
}
_$AC(e) {
let t = fe.get(e.strings);
return t === void 0 && fe.set(e.strings, t = new z(e)), t;
}
k(t) {
E(this._$AH) || (this._$AH = [], this._$AR());
let n = this._$AH, r, i = 0;
for (let a of t) i === n.length ? n.push(r = new e(this.O(w()), this.O(w()), this, this.options)) : r = n[i], r._$AI(a), i++;
i < n.length && (this._$AR(r && r._$AB.nextSibling, i), n.length = i);
}
_$AR(e = this._$AA.nextSibling, t) {
for (this._$AP?.(!1, !0, t); e !== this._$AB;) {
let t = _(e).nextSibling;
_(e).remove(), e = t;
}
}
setConnected(e) {
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
}
}, U = class {
get tagName() {
return this.element.tagName;
}
get _$AU() {
return this._$AM._$AU;
}
constructor(e, t, n, r, i) {
this.type = 1, this._$AH = F, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = i, n.length > 2 || n[0] !== "" || n[1] !== "" ? (this._$AH = Array(n.length - 1).fill(/* @__PURE__ */ new String()), this.strings = n) : this._$AH = F;
}
_$AI(e, t = this, n, r) {
let i = this.strings, a = !1;
if (i === void 0) e = B(this, e, t, 0), a = !T(e) || e !== this._$AH && e !== P, a && (this._$AH = e);
else {
let r = e, o, s;
for (e = i[0], o = 0; o < i.length - 1; o++) s = B(this, r[n + o], t, o), s === P && (s = this._$AH[o]), a ||= !T(s) || s !== this._$AH[o], s === F ? e = F : e !== F && (e += (s ?? "") + i[o + 1]), this._$AH[o] = s;
}
a && !r && this.j(e);
}
j(e) {
e === F ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
}
}, W = class extends U {
constructor() {
super(...arguments), this.type = 3;
}
j(e) {
this.element[this.name] = e === F ? void 0 : e;
}
}, pe = class extends U {
constructor() {
super(...arguments), this.type = 4;
}
j(e) {
this.element.toggleAttribute(this.name, !!e && e !== F);
}
}, me = class extends U {
constructor(e, t, n, r, i) {
super(e, t, n, r, i), this.type = 5;
}
_$AI(e, t = this) {
if ((e = B(this, e, t, 0) ?? F) === P) return;
let n = this._$AH, r = e === F && n !== F || e.capture !== n.capture || e.once !== n.once || e.passive !== n.passive, i = e !== F && (n === F || r);
r && this.element.removeEventListener(this.name, this, n), i && 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);
}
}, he = class {
constructor(e, t, n) {
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = n;
}
get _$AU() {
return this._$AM._$AU;
}
_$AI(e) {
B(this, e);
}
}, ge = {
M: b,
P: x,
A: S,
C: 1,
L: R,
R: V,
D,
V: B,
I: H,
H: U,
N: pe,
U: me,
B: W,
F: he
}, _e = g.litHtmlPolyfillSupport;
_e?.(z, H), (g.litHtmlVersions ??= []).push("3.3.3");
var ve = (e, t, n) => {
let r = n?.renderBefore ?? t, i = r._$litPart$;
if (i === void 0) {
let e = n?.renderBefore ?? null;
r._$litPart$ = i = new H(t.insertBefore(w(), e), e, void 0, n ?? {});
}
return i._$AI(e), i;
}, G = globalThis, K = class extends h {
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 = ve(t, this.renderRoot, this.renderOptions);
}
connectedCallback() {
super.connectedCallback(), this._$Do?.setConnected(!0);
}
disconnectedCallback() {
super.disconnectedCallback(), this._$Do?.setConnected(!1);
}
render() {
return P;
}
};
K._$litElement$ = !0, K.finalized = !0, G.litElementHydrateSupport?.({ LitElement: K });
var ye = G.litElementPolyfillSupport;
ye?.({ LitElement: K }), (G.litElementVersions ??= []).push("4.2.2");
// ../node_modules/lit-html/directive-helpers.js
var { I: be } = ge, xe = (e) => e.strings === void 0, Se = {
ATTRIBUTE: 1,
CHILD: 2,
PROPERTY: 3,
BOOLEAN_ATTRIBUTE: 4,
EVENT: 5,
ELEMENT: 6
}, Ce = (e) => (...t) => ({
_$litDirective$: e,
values: t
}), we = class {
constructor(e) {}
get _$AU() {
return this._$AM._$AU;
}
_$AT(e, t, n) {
this._$Ct = e, this._$AM = t, this._$Ci = n;
}
_$AS(e, t) {
return this.update(e, t);
}
update(e, t) {
return this.render(...t);
}
}, q = (e, t) => {
let n = e._$AN;
if (n === void 0) return !1;
for (let e of n) e._$AO?.(t, !1), q(e, t);
return !0;
}, J = (e) => {
let t, n;
do {
if ((t = e._$AM) === void 0) break;
n = t._$AN, n.delete(e), e = t;
} while (n?.size === 0);
}, Te = (e) => {
for (let t; t = e._$AM; e = t) {
let n = t._$AN;
if (n === void 0) t._$AN = n = /* @__PURE__ */ new Set();
else if (n.has(e)) break;
n.add(e), Oe(t);
}
};
function Ee(e) {
this._$AN === void 0 ? this._$AM = e : (J(this), this._$AM = e, Te(this));
}
function De(e, t = !1, n = 0) {
let r = this._$AH, i = this._$AN;
if (i !== void 0 && i.size !== 0) {
if (t) {
if (Array.isArray(r)) for (let e = n; e < r.length; e++) q(r[e], !1), J(r[e]);
else r != null && (q(r, !1), J(r));
} else q(this, e);
}
}
var Oe = (e) => {
e.type == Se.CHILD && (e._$AP ??= De, e._$AQ ??= Ee);
}, ke = class extends we {
constructor() {
super(...arguments), this._$AN = void 0;
}
_$AT(e, t, n) {
super._$AT(e, t, n), Te(this), this.isConnected = e._$AU;
}
_$AO(e, t = !0) {
e !== this.isConnected && (this.isConnected = e, e ? this.reconnected?.() : this.disconnected?.()), t && (q(this, e), J(this));
}
setValue(e) {
if (xe(this._$Ct)) this._$Ct._$AI(e, this);
else {
let t = [...this._$Ct._$AH];
t[this._$Ci] = e, this._$Ct._$AI(t, this, 0);
}
}
disconnected() {}
reconnected() {}
}, Ae = () => new je(), je = class {}, Y = /* @__PURE__ */ new WeakMap(), Me = Ce(class extends ke {
render(e) {
return F;
}
update(e, [t]) {
let n = t !== this.G;
return n && this.rt(void 0), (n || this.lt !== this.ct) && (this.G = t, this.ht = e.options?.host, this.rt(this.ct = e.element)), F;
}
rt(e) {
if (this.G !== void 0) {
if (this.isConnected || (e = void 0), typeof this.G == "function") {
let t = this.ht ?? globalThis, n = Y.get(t);
n === void 0 && (n = /* @__PURE__ */ new WeakMap(), Y.set(t, n)), n.get(this.G) !== void 0 && this.G.call(this.ht, void 0), n.set(this.G, e), e !== void 0 && this.G.call(this.ht, e);
} else this.G.value = e;
}
}
get lt() {
return typeof this.G == "function" ? Y.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
}
disconnected() {
this.lt === this.ct && this.rt(void 0);
}
reconnected() {
this.rt(this.ct);
}
}), Ne = (e) => e ?? F, X = class extends K {
static properties = {
name: { type: String },
context: { type: String },
label: { type: String },
onState: {
type: Boolean,
reflect: !0
}
};
constructor() {
super(), this.onState = !1, this.context = void 0, this.name = void 0, this.label = void 0;
}
connectedCallback() {
super.connectedCallback(), this._addListeners();
}
render() {
return this._defaultMarkup();
}
_toggleEvent(e) {
let t = new CustomEvent(e, {
detail: { context: this.context },
composed: !0,
bubbles: !0
});
this.dispatchEvent(t);
}
_toggleActions = {
off: "offEvent",
on: "onEvent"
};
_addListeners() {
let e = this;
this.context && (window.addEventListener(e._toggleActions.on, function(t) {
t.detail.context == e.context && (e.onState = !0);
}), window.addEventListener(e._toggleActions.off, function(t) {
t.detail.context == e.context && (e.onState = !1);
}));
}
_handleClickType() {
return this.context ? this._handleClick() : this._simpleHandleClick();
}
_simpleHandleClick() {
this.onState = this.onState != 1;
}
_handleClick() {
let e = this._toggleActions.on;
this.onState && (e = this._toggleActions.off), this._toggleEvent(e);
}
_defaultMarkup() {
return N`<button part="toggle-button" aria-label=${Ne(this.label)} @click=${this._handleClickType}>
${this.name}
<slot></slot>
${this.onState ? N`<slot name="on-markup"></slot>` : N`<slot name="off-markup"></slot>`}
</button>`;
}
firstUpdated() {
let e = new CustomEvent("childready", {
bubbles: !0,
composed: !0
});
this.dispatchEvent(e);
}
}, Pe = class extends X {
_defaultMarkup() {
if (this.onState) return N`<div><slot></slot></div>`;
}
}, Fe = class extends X {
static styles = o`
div {
transition: opacity 0.3s;
}
.fade-in {
opacity: 100%;
}
.fade-out {
opacity: 0%;
}
`;
_defaultMarkup() {
let e = "fade-in";
return this.onState || (e = "fade-out"), N`<div class="${e}"><slot></slot></div>`;
}
}, Ie = class extends X {
static properties = {
...X.properties,
iconSet: { type: String }
};
constructor() {
super(), this.iconSet = "ionicons";
}
_defaultMarkup() {
let e;
return this.iconSet == "ionicons" ? e = N`<ion-icon name="close-outline">close</ion-icon>` : this.iconSet == "lucide" && (e = N`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>`), N`
<button part="close-button" aria-label="Close" @click=${this._handleClick}>
${e}
</button>
`;
}
}, Z = class extends X {
static properties = {
...X.properties,
settingsMenu: { type: Boolean }
};
constructor() {
super(), this.settingsMenu = void 0;
}
_defaultMarkup() {
return N`
<button part="menu-button" aria-label="Menu" @click=${this._handleClickType}>
${this.onState ? N`<ion-icon name="close-outline">close</ion-icon>` : N`<ion-icon name=${this.settingsMenu ? "options-outline" : "menu-outline"}>menu</ion-icon>`}
</button>
`;
}
}, Le = class extends X {
_defaultMarkup() {
return N`
<div part="scrim-layer"
@click=${this._handleClickType}>
<!-- NB: Nothing goes here, the scrim shouldn't have children elements. -->
</div>
`;
}
}, Q = class extends X {
static properties = {
...X.properties,
mq: { type: String },
dynamic: { type: Boolean },
_size: { type: Object },
_matching: { type: Boolean }
};
constructor() {
super(), this.dynamic = void 0, this.debug = void 0, this.mq = void 0;
}
connectedCallback() {
super.connectedCallback(), this.doSizeCheck();
}
doSizeCheck = () => {
this.mq && (this._size = window.matchMedia(this.mq), this._size.matches ? (this.onState = !0, this._matching = !0) : (this.onState = !1, this._matching = !1), this.dynamic && (this._size.onchange = (e) => {
e.matches ? (this.onState = !0, this._matching = !0) : (this.onState = !1, this._matching = !1);
}));
};
render() {
let e;
if (this.debug && (e = N`<span
>meta info: viewport width: ${this._size}, onState: ${this.onState}, mq:
${this.mq}</span
>`), this.onState) return e = N`${e} <slot></slot>`, e;
}
}, Re = class extends Q {
static properties = {
...Q.properties,
withButton: { type: Boolean },
settingsMenu: { type: Boolean }
};
constructor() {
super(), this.withButton = void 0, this.settingsMenu = void 0;
}
render() {
let e;
return this.withButton && !this._matching && (e = N`
<mds-toggle-menu exportparts="menu-button" @click=${this._handleClickType}
?settingsMenu=${this.settingsMenu}
?onState=${this.onState}
></mds-toggle-menu>
`), N`<slot name="menu-label"></slot> ${e} ${this.onState ? N`<span part="slotted-content"><slot></slot></span>` : N`<span part="hidden-slotted-content"><slot></slot></span>`} `;
}
}, $ = class extends Z {
_defaultMarkup() {
return N`
<button part="menu-button" aria-label="Close" @click=${this._handleClickType}>
${this.onState ? N`<ion-icon name="close-outline">close</ion-icon>` : N`<ion-icon name="options-outline">settings</ion-icon>`}
</button>
`;
}
}, ze = function() {
customElements.define("mds-toggle", X), customElements.define("mds-toggle-view", Pe), customElements.define("mds-toggle-view-fade", Fe), customElements.define("mds-toggle-close", Ie), customElements.define("mds-toggle-menu", Z), customElements.define("mds-toggle-settings", $), customElements.define("mds-toggle-scrim", Le), customElements.define("mds-mobile-toggle", Q), customElements.define("mds-menu", Re);
}, Be = class extends X {
_handleClick(e) {
e.type == "close" && e.target == this.dialogRef.value && (this.onState = !1, this._toggleEvent(this._toggleActions.off));
let t = e.target;
(t?.tagName == "DIALOG" || t?.tagName == "MDS-TOGGLE-CLOSE") && this.dialogRef.value.close();
}
dialogRef = Ae();
updated() {
this.onState && this.dialogRef.value.showModal();
}
_defaultMarkup() {
return N`
<dialog part="dialog-element"
${Me(this.dialogRef)}
@click=${this._handleClick}
@close=${this._handleClick}
>
<div part="dialog-body">
<slot></slot>
<mds-toggle-close part="dialog-close"></mds-toggle-close>
</div>
</dialog>
`;
}
static styles = o`
dialog {
margin-top: 10rem;
/* NB! 0 padding means any child content clicked will pass event.target.tagName !== DIALOG, so clicking child content (except mds-toggle-close) will NOT close the dialog. This allows the background part of a modal dialog to be clicked to close. */
padding: 0;
border: none;
width: var(--dialog-width, 90%);
overflow: visible;
&::backdrop {
animation: wc-backdrop-filter-blur var(--dialog-animation-time) ease-out forwards;
}
}
/* Regrettably non-FF browsers require keyframes scoped to same shadow root. */
@keyframes wc-backdrop-filter-blur {
from {
backdrop-filter: blur(0);
}
to {
background: rgba(0 0 0 / 80%);
backdrop-filter: blur(2px);
}
}
/* Holds dialog contents. */
[part="dialog-body"] {
padding: 1rem;
}
/* Absolutely position mds-toggle-close component to the top-right of the dialog. */
mds-toggle-close[part="dialog-close"] {
position: absolute;
top: 0;
right: 0;
}
/* Theme the actual close button part. */
mds-toggle-close::part(close-button) {
border: none;
border-radius: var(--mds-border-radius);
font-size: 1.5rem;
padding-top: 0.45rem;
background: inherit;
color: var(--mds-color-gray-900);
}
/* Highlight the close button part on hover/focus. */
mds-toggle-close::part(close-button):hover,
mds-toggle-close::part(close-button):focus {
color: var(--mds-color-black);
cursor: pointer;
}
/* Support for dark-mode: e.g. mds-dialog.mds-dark: */
:host(.mds-dark) mds-toggle-close::part(close-button) {
color: var(--mds-color-gray-300);
background: inherit;
}
:host(.mds-dark) mds-toggle-close::part(close-button):hover,
:host(.mds-dark) mds-toggle-close::part(close-button):focus {
color: var(--mds-color-white);
}
`;
}, Ve = function() {
customElements.define("mds-dialog", Be);
}, He = class extends K {
static properties = {
openStatus: {
type: Boolean,
reflect: !0
},
sectionTitle: { type: String }
};
constructor() {
super(), this.openStatus = !1, this.sectionTitle = "";
}
handleClick() {
this.openStatus = !this.openStatus;
}
render() {
let e = N`<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M1.5 3C1.22386 3 1 3.22386 1 3.5C1 3.77614 1.22386 4 1.5 4H13.5C13.7761 4 14 3.77614 14 3.5C14 3.22386 13.7761 3 13.5 3H1.5ZM1 7.5C1 7.22386 1.22386 7 1.5 7H13.5C13.7761 7 14 7.22386 14 7.5C14 7.77614 13.7761 8 13.5 8H1.5C1.22386 8 1 7.77614 1 7.5ZM1 11.5C1 11.2239 1.22386 11 1.5 11H13.5C13.7761 11 14 11.2239 14 11.5C14 11.7761 13.7761 12 13.5 12H1.5C1.22386 12 1 11.7761 1 11.5Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>`, t = N`<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M12.8536 2.85355C13.0488 2.65829 13.0488 2.34171 12.8536 2.14645C12.6583 1.95118 12.3417 1.95118 12.1464 2.14645L7.5 6.79289L2.85355 2.14645C2.65829 1.95118 2.34171 1.95118 2.14645 2.14645C1.95118 2.34171 1.95118 2.65829 2.14645 2.85355L6.79289 7.5L2.14645 12.1464C1.95118 12.3417 1.95118 12.6583 2.14645 12.8536C2.34171 13.0488 2.65829 13.0488 2.85355 12.8536L7.5 8.20711L12.1464 12.8536C12.3417 13.0488 12.6583 13.0488 12.8536 12.8536C13.0488 12.6583 13.0488 12.3417 12.8536 12.1464L8.20711 7.5L12.8536 2.85355Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>`, n = "open", r = e;
return this.openStatus && (n = "close", r = t), N`
<section>
<button @click=${this.handleClick}>
<span class="sr-only"> ${n} </span>
${r}
</button>
<div class="drawer-contents">
${this.sectionTitle ? N`<h3>${this.sectionTitle}</h3>` : ""}
<slot></slot>
</div>
</section>
`;
}
static styles = o`
/* Main containing element for drawer. */
:host {
display: flex;
position: relative;
background: white;
/* Should be full height of screen.*/
height: 100vh;
/* Set some basic styling variables for parts of the drawer.*/
--button-width: 2rem;
/* Drawer width is relative to button width; allows for space proportionate to button width while also taking up most of the viewport width. */
--drawer-width: calc(100vw - 4 * var(--button-width));
/* Basic padding for contents. */
--drawer-padding: 0.5rem;
}
/* Open/close button for drawer. */
button {
position: absolute;
top: 0;
/* Button positioned with reference to it's own width.*/
right: 0;
width: var(--button-width);
height: var(--button-width);
padding: 0;
margin: 0;
background: white;
border: none;
}
/* Defines 'root' of drawer and the element that 'opens'.*/
section {
/* Margin-left initially set to negative drawer-width, so 'closed'. */
margin-left: calc(-1 * var(--drawer-width));
/* Use transition for animation on open/shut states. */
transition: margin-left var(--animation-duration-fast);
}
/* When open, reset margin-left. */
:host([openstatus]) section {
margin-left: 0;
}
/* Holds main contents of drawer.*/
.drawer-contents {
padding: var(--drawer-padding);
/* Width required to avoid reflow. */
width: calc(var(--drawer-width) - 2 * var(--drawer-padding));
}
`;
}, Ue = function() {
customElements.define("mds-drawer", He);
};
Ve(), Ue(), ze();
export { He as DrawerElement, Re as MDSMenu, Be as MdsDialog, Q as MobileToggle, X as Toggle, Ie as ToggleClose, Z as ToggleMenu, Le as ToggleScrim, $ as ToggleSettings, Pe as ToggleView, Fe as ToggleViewFade, Ve as defineDialog, Ue as defineDrawer, ze as defineToggleComponents };