(function(global, factory) { typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.oembed = {})); })(this, function(exports2) { "use strict"; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ var _a; const t$2 = globalThis, e$3 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$3 = Symbol(), o$4 = /* @__PURE__ */ new WeakMap(); let n$3 = class n { constructor(t2, e2, o2) { if (this._$cssResult$ = true, o2 !== s$3) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); this.cssText = t2, this.t = e2; } get styleSheet() { let t2 = this.o; const s2 = this.t; if (e$3 && void 0 === t2) { const e2 = void 0 !== s2 && 1 === s2.length; e2 && (t2 = o$4.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$4.set(s2, t2)); } return t2; } toString() { return this.cssText; } }; const r$4 = (t2) => new n$3("string" == typeof t2 ? t2 : t2 + "", void 0, s$3), S$2 = (s2, o2) => { if (e$3) s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet); else for (const e2 of o2) { const o3 = document.createElement("style"), n2 = t$2.litNonce; void 0 !== n2 && o3.setAttribute("nonce", n2), o3.textContent = e2.cssText, s2.appendChild(o3); } }, c$3 = e$3 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => { let e2 = ""; for (const s2 of t3.cssRules) e2 += s2.cssText; return r$4(e2); })(t2) : t2; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const { is: i$1, defineProperty: e$2, getOwnPropertyDescriptor: r$3, getOwnPropertyNames: h$2, getOwnPropertySymbols: o$3, getPrototypeOf: n$2 } = Object, a$2 = globalThis, c$2 = a$2.trustedTypes, l$2 = c$2 ? c$2.emptyScript : "", p$2 = a$2.reactiveElementPolyfillSupport, d$2 = (t2, s2) => t2, u$2 = { toAttribute(t2, s2) { switch (s2) { case Boolean: t2 = t2 ? l$2 : null; break; case Object: case Array: t2 = null == t2 ? t2 : JSON.stringify(t2); } return t2; }, fromAttribute(t2, s2) { let i2 = t2; switch (s2) { case Boolean: i2 = null !== t2; break; case Number: i2 = null === t2 ? null : Number(t2); break; case Object: case Array: try { i2 = JSON.parse(t2); } catch (t3) { i2 = null; } } return i2; } }, f$2 = (t2, s2) => !i$1(t2, s2), y$2 = { attribute: true, type: String, converter: u$2, reflect: false, hasChanged: f$2 }; Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a$2.litPropertyMetadata ?? (a$2.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); let b$1 = class b extends HTMLElement { static addInitializer(t2) { this._$Ei(), (this.l ?? (this.l = [])).push(t2); } static get observedAttributes() { return this.finalize(), this._$Eh && [...this._$Eh.keys()]; } static createProperty(t2, s2 = y$2) { if (s2.state && (s2.attribute = false), this._$Ei(), this.elementProperties.set(t2, s2), !s2.noAccessor) { const i2 = Symbol(), r2 = this.getPropertyDescriptor(t2, i2, s2); void 0 !== r2 && e$2(this.prototype, t2, r2); } } static getPropertyDescriptor(t2, s2, i2) { const { get: e2, set: h2 } = r$3(this.prototype, t2) ?? { get() { return this[s2]; }, set(t3) { this[s2] = t3; } }; return { get() { return e2 == null ? void 0 : e2.call(this); }, set(s3) { const r2 = e2 == null ? void 0 : e2.call(this); h2.call(this, s3), this.requestUpdate(t2, r2, i2); }, configurable: true, enumerable: true }; } static getPropertyOptions(t2) { return this.elementProperties.get(t2) ?? y$2; } static _$Ei() { if (this.hasOwnProperty(d$2("elementProperties"))) return; const t2 = n$2(this); t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties); } static finalize() { if (this.hasOwnProperty(d$2("finalized"))) return; if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$2("properties"))) { const t3 = this.properties, s2 = [...h$2(t3), ...o$3(t3)]; for (const i2 of s2) this.createProperty(i2, t3[i2]); } const t2 = this[Symbol.metadata]; if (null !== t2) { const s2 = litPropertyMetadata.get(t2); if (void 0 !== s2) for (const [t3, i2] of s2) this.elementProperties.set(t3, i2); } this._$Eh = /* @__PURE__ */ new Map(); for (const [t3, s2] of this.elementProperties) { const i2 = this._$Eu(t3, s2); void 0 !== i2 && this._$Eh.set(i2, t3); } this.elementStyles = this.finalizeStyles(this.styles); } static finalizeStyles(s2) { const i2 = []; if (Array.isArray(s2)) { const e2 = new Set(s2.flat(1 / 0).reverse()); for (const s3 of e2) i2.unshift(c$3(s3)); } else void 0 !== s2 && i2.push(c$3(s2)); return i2; } static _$Eu(t2, s2) { const i2 = s2.attribute; return false === i2 ? void 0 : "string" == typeof i2 ? i2 : "string" == typeof t2 ? t2.toLowerCase() : void 0; } constructor() { super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev(); } _$Ev() { var _a2; this._$Eg = new Promise((t2) => this.enableUpdating = t2), this._$AL = /* @__PURE__ */ new Map(), this._$ES(), this.requestUpdate(), (_a2 = this.constructor.l) == null ? void 0 : _a2.forEach((t2) => t2(this)); } addController(t2) { var _a2; (this._$E_ ?? (this._$E_ = /* @__PURE__ */ new Set())).add(t2), void 0 !== this.renderRoot && this.isConnected && ((_a2 = t2.hostConnected) == null ? void 0 : _a2.call(t2)); } removeController(t2) { var _a2; (_a2 = this._$E_) == null ? void 0 : _a2.delete(t2); } _$ES() { const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties; for (const i2 of s2.keys()) this.hasOwnProperty(i2) && (t2.set(i2, this[i2]), delete this[i2]); t2.size > 0 && (this._$Ep = t2); } createRenderRoot() { const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); return S$2(t2, this.constructor.elementStyles), t2; } connectedCallback() { var _a2; this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t2) => { var _a3; return (_a3 = t2.hostConnected) == null ? void 0 : _a3.call(t2); }); } enableUpdating(t2) { } disconnectedCallback() { var _a2; (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t2) => { var _a3; return (_a3 = t2.hostDisconnected) == null ? void 0 : _a3.call(t2); }); } attributeChangedCallback(t2, s2, i2) { this._$AK(t2, i2); } _$EO(t2, s2) { var _a2; const i2 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i2); if (void 0 !== e2 && true === i2.reflect) { const r2 = (void 0 !== ((_a2 = i2.converter) == null ? void 0 : _a2.toAttribute) ? i2.converter : u$2).toAttribute(s2, i2.type); this._$Em = t2, null == r2 ? this.removeAttribute(e2) : this.setAttribute(e2, r2), this._$Em = null; } } _$AK(t2, s2) { var _a2; const i2 = this.constructor, e2 = i2._$Eh.get(t2); if (void 0 !== e2 && this._$Em !== e2) { const t3 = i2.getPropertyOptions(e2), r2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== ((_a2 = t3.converter) == null ? void 0 : _a2.fromAttribute) ? t3.converter : u$2; this._$Em = e2, this[e2] = r2.fromAttribute(s2, t3.type), this._$Em = null; } } requestUpdate(t2, s2, i2, e2 = false, r2) { if (void 0 !== t2) { if (i2 ?? (i2 = this.constructor.getPropertyOptions(t2)), !(i2.hasChanged ?? f$2)(e2 ? r2 : this[t2], s2)) return; this.C(t2, s2, i2); } false === this.isUpdatePending && (this._$Eg = this._$EP()); } C(t2, s2, i2) { this._$AL.has(t2) || this._$AL.set(t2, s2), true === i2.reflect && this._$Em !== t2 && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t2); } async _$EP() { this.isUpdatePending = true; try { await this._$Eg; } catch (t3) { Promise.reject(t3); } const t2 = this.scheduleUpdate(); return null != t2 && await t2, !this.isUpdatePending; } scheduleUpdate() { return this.performUpdate(); } performUpdate() { var _a2; if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) { for (const [t4, s3] of this._$Ep) this[t4] = s3; this._$Ep = void 0; } const t3 = this.constructor.elementProperties; if (t3.size > 0) for (const [s3, i2] of t3) true !== i2.wrapped || this._$AL.has(s3) || void 0 === this[s3] || this.C(s3, this[s3], i2); } let t2 = false; const s2 = this._$AL; try { t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t3) => { var _a3; return (_a3 = t3.hostUpdate) == null ? void 0 : _a3.call(t3); }), this.update(s2)) : this._$ET(); } catch (s3) { throw t2 = false, this._$ET(), s3; } t2 && this._$AE(s2); } willUpdate(t2) { } _$AE(t2) { var _a2; (_a2 = this._$E_) == null ? void 0 : _a2.forEach((t3) => { var _a3; return (_a3 = t3.hostUpdated) == null ? void 0 : _a3.call(t3); }), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2); } _$ET() { this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false; } get updateComplete() { return this.getUpdateComplete(); } getUpdateComplete() { return this._$Eg; } shouldUpdate(t2) { return true; } update(t2) { this._$Ej && (this._$Ej = this._$Ej.forEach((t3) => this._$EO(t3, this[t3]))), this._$ET(); } updated(t2) { } firstUpdated(t2) { } }; b$1.elementStyles = [], b$1.shadowRootOptions = { mode: "open" }, b$1[d$2("elementProperties")] = /* @__PURE__ */ new Map(), b$1[d$2("finalized")] = /* @__PURE__ */ new Map(), p$2 == null ? void 0 : p$2({ ReactiveElement: b$1 }), (a$2.reactiveElementVersions ?? (a$2.reactiveElementVersions = [])).push("2.0.2"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t$1 = globalThis, i = t$1.trustedTypes, s$2 = i ? i.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$1 = "$lit$", h$1 = `lit$${(Math.random() + "").slice(9)}$`, o$2 = "?" + h$1, n$1 = `<${o$2}>`, r$2 = document, l$1 = () => r$2.createComment(""), c$1 = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a$1 = Array.isArray, u$1 = (t2) => a$1(t2) || "function" == typeof (t2 == null ? void 0 : t2[Symbol.iterator]), d$1 = "[ \n\f\r]", f$1 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v$1 = /-->/g, _ = />/g, m = RegExp(`>|${d$1}(?:([^\\s"'>=/]+)(${d$1}*=${d$1}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`, "g"), p$1 = /'/g, g$1 = /"/g, $$1 = /^(?:script|style|textarea|title)$/i, y$1 = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), x$1 = y$1(1), w$1 = Symbol.for("lit-noChange"), T$1 = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), E$1 = r$2.createTreeWalker(r$2, 129); function C(t2, i2) { if (!Array.isArray(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array"); return void 0 !== s$2 ? s$2.createHTML(i2) : i2; } const P = (t2, i2) => { const s2 = t2.length - 1, o2 = []; let r2, l2 = 2 === i2 ? "" : "", c2 = f$1; for (let i3 = 0; i3 < s2; i3++) { const s3 = t2[i3]; let a2, u2, d2 = -1, y2 = 0; for (; y2 < s3.length && (c2.lastIndex = y2, u2 = c2.exec(s3), null !== u2); ) y2 = c2.lastIndex, c2 === f$1 ? "!--" === u2[1] ? c2 = v$1 : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($$1.test(u2[2]) && (r2 = RegExp("" === u2[0] ? (c2 = r2 ?? f$1, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g$1 : p$1) : c2 === g$1 || c2 === p$1 ? c2 = m : c2 === v$1 || c2 === _ ? c2 = f$1 : (c2 = m, r2 = void 0); const x2 = c2 === m && t2[i3 + 1].startsWith("/>") ? " " : ""; l2 += c2 === f$1 ? s3 + n$1 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$1 + s3.slice(d2) + h$1 + x2) : s3 + h$1 + (-2 === d2 ? i3 : x2); } return [C(t2, l2 + (t2[s2] || "") + (2 === i2 ? "" : "")), o2]; }; class V { constructor({ strings: t2, _$litType$: s2 }, n2) { let r2; this.parts = []; let c2 = 0, a2 = 0; const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = P(t2, s2); if (this.el = V.createElement(f2, n2), E$1.currentNode = this.el.content, 2 === s2) { const t3 = this.el.content.firstChild; t3.replaceWith(...t3.childNodes); } for (; null !== (r2 = E$1.nextNode()) && d2.length < u2; ) { if (1 === r2.nodeType) { if (r2.hasAttributes()) for (const t3 of r2.getAttributeNames()) if (t3.endsWith(e$1)) { const i2 = v2[a2++], s3 = r2.getAttribute(t3).split(h$1), e2 = /([.?@])?(.*)/.exec(i2); d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? k : "?" === e2[1] ? H : "@" === e2[1] ? I$1 : R }), r2.removeAttribute(t3); } else t3.startsWith(h$1) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3)); if ($$1.test(r2.tagName)) { const t3 = r2.textContent.split(h$1), s3 = t3.length - 1; if (s3 > 0) { r2.textContent = i ? i.emptyScript : ""; for (let i2 = 0; i2 < s3; i2++) r2.append(t3[i2], l$1()), E$1.nextNode(), d2.push({ type: 2, index: ++c2 }); r2.append(t3[s3], l$1()); } } } else if (8 === r2.nodeType) if (r2.data === o$2) d2.push({ type: 2, index: c2 }); else { let t3 = -1; for (; -1 !== (t3 = r2.data.indexOf(h$1, t3 + 1)); ) d2.push({ type: 7, index: c2 }), t3 += h$1.length - 1; } c2++; } } static createElement(t2, i2) { const s2 = r$2.createElement("template"); return s2.innerHTML = t2, s2; } } function N(t2, i2, s2 = t2, e2) { var _a2, _b; if (i2 === w$1) return i2; let h2 = void 0 !== e2 ? (_a2 = s2._$Co) == null ? void 0 : _a2[e2] : s2._$Cl; const o2 = c$1(i2) ? void 0 : i2._$litDirective$; return (h2 == null ? void 0 : h2.constructor) !== o2 && ((_b = h2 == null ? void 0 : h2._$AO) == null ? void 0 : _b.call(h2, false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ?? (s2._$Co = []))[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i2 = N(t2, h2._$AS(t2, i2.values), h2, e2)), i2; } let S$1 = class S { constructor(t2, i2) { this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i2; } get parentNode() { return this._$AM.parentNode; } get _$AU() { return this._$AM._$AU; } u(t2) { const { el: { content: i2 }, parts: s2 } = this._$AD, e2 = ((t2 == null ? void 0 : t2.creationScope) ?? r$2).importNode(i2, true); E$1.currentNode = e2; let h2 = E$1.nextNode(), o2 = 0, n2 = 0, l2 = s2[0]; for (; void 0 !== l2; ) { if (o2 === l2.index) { let i3; 2 === l2.type ? i3 = new M$1(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i3 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i3 = new L(h2, this, t2)), this._$AV.push(i3), l2 = s2[++n2]; } o2 !== (l2 == null ? void 0 : l2.index) && (h2 = E$1.nextNode(), o2++); } return E$1.currentNode = r$2, e2; } p(t2) { let i2 = 0; for (const s2 of this._$AV) void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i2), i2 += s2.strings.length - 2) : s2._$AI(t2[i2])), i2++; } }; let M$1 = class M2 { get _$AU() { var _a2; return ((_a2 = this._$AM) == null ? void 0 : _a2._$AU) ?? this._$Cv; } constructor(t2, i2, s2, e2) { this.type = 2, this._$AH = T$1, this._$AN = void 0, this._$AA = t2, this._$AB = i2, this._$AM = s2, this.options = e2, this._$Cv = (e2 == null ? void 0 : e2.isConnected) ?? true; } get parentNode() { let t2 = this._$AA.parentNode; const i2 = this._$AM; return void 0 !== i2 && 11 === (t2 == null ? void 0 : t2.nodeType) && (t2 = i2.parentNode), t2; } get startNode() { return this._$AA; } get endNode() { return this._$AB; } _$AI(t2, i2 = this) { t2 = N(this, t2, i2), c$1(t2) ? t2 === T$1 || null == t2 || "" === t2 ? (this._$AH !== T$1 && this._$AR(), this._$AH = T$1) : t2 !== this._$AH && t2 !== w$1 && this._(t2) : void 0 !== t2._$litType$ ? this.g(t2) : void 0 !== t2.nodeType ? this.$(t2) : u$1(t2) ? this.T(t2) : this._(t2); } k(t2) { return this._$AA.parentNode.insertBefore(t2, this._$AB); } $(t2) { this._$AH !== t2 && (this._$AR(), this._$AH = this.k(t2)); } _(t2) { this._$AH !== T$1 && c$1(this._$AH) ? this._$AA.nextSibling.data = t2 : this.$(r$2.createTextNode(t2)), this._$AH = t2; } g(t2) { var _a2; const { values: i2, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = V.createElement(C(s2.h, s2.h[0]), this.options)), s2); if (((_a2 = this._$AH) == null ? void 0 : _a2._$AD) === e2) this._$AH.p(i2); else { const t3 = new S$1(e2, this), s3 = t3.u(this.options); t3.p(i2), this.$(s3), this._$AH = t3; } } _$AC(t2) { let i2 = A.get(t2.strings); return void 0 === i2 && A.set(t2.strings, i2 = new V(t2)), i2; } T(t2) { a$1(this._$AH) || (this._$AH = [], this._$AR()); const i2 = this._$AH; let s2, e2 = 0; for (const h2 of t2) e2 === i2.length ? i2.push(s2 = new M2(this.k(l$1()), this.k(l$1()), this, this.options)) : s2 = i2[e2], s2._$AI(h2), e2++; e2 < i2.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i2.length = e2); } _$AR(t2 = this._$AA.nextSibling, i2) { var _a2; for ((_a2 = this._$AP) == null ? void 0 : _a2.call(this, false, true, i2); t2 && t2 !== this._$AB; ) { const i3 = t2.nextSibling; t2.remove(), t2 = i3; } } setConnected(t2) { var _a2; void 0 === this._$AM && (this._$Cv = t2, (_a2 = this._$AP) == null ? void 0 : _a2.call(this, t2)); } }; class R { get tagName() { return this.element.tagName; } get _$AU() { return this._$AM._$AU; } constructor(t2, i2, s2, e2, h2) { this.type = 1, this._$AH = T$1, this._$AN = void 0, this.element = t2, this.name = i2, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = T$1; } _$AI(t2, i2 = this, s2, e2) { const h2 = this.strings; let o2 = false; if (void 0 === h2) t2 = N(this, t2, i2, 0), o2 = !c$1(t2) || t2 !== this._$AH && t2 !== w$1, o2 && (this._$AH = t2); else { const e3 = t2; let n2, r2; for (t2 = h2[0], n2 = 0; n2 < h2.length - 1; n2++) r2 = N(this, e3[s2 + n2], i2, n2), r2 === w$1 && (r2 = this._$AH[n2]), o2 || (o2 = !c$1(r2) || r2 !== this._$AH[n2]), r2 === T$1 ? t2 = T$1 : t2 !== T$1 && (t2 += (r2 ?? "") + h2[n2 + 1]), this._$AH[n2] = r2; } o2 && !e2 && this.O(t2); } O(t2) { t2 === T$1 ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? ""); } } class k extends R { constructor() { super(...arguments), this.type = 3; } O(t2) { this.element[this.name] = t2 === T$1 ? void 0 : t2; } } class H extends R { constructor() { super(...arguments), this.type = 4; } O(t2) { this.element.toggleAttribute(this.name, !!t2 && t2 !== T$1); } } let I$1 = class I extends R { constructor(t2, i2, s2, e2, h2) { super(t2, i2, s2, e2, h2), this.type = 5; } _$AI(t2, i2 = this) { if ((t2 = N(this, t2, i2, 0) ?? T$1) === w$1) return; const s2 = this._$AH, e2 = t2 === T$1 && s2 !== T$1 || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== T$1 && (s2 === T$1 || e2); e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2; } handleEvent(t2) { var _a2; "function" == typeof this._$AH ? this._$AH.call(((_a2 = this.options) == null ? void 0 : _a2.host) ?? this.element, t2) : this._$AH.handleEvent(t2); } }; class L { constructor(t2, i2, s2) { this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i2, this.options = s2; } get _$AU() { return this._$AM._$AU; } _$AI(t2) { N(this, t2); } } const Z = t$1.litHtmlPolyfillSupport; Z == null ? void 0 : Z(V, M$1), (t$1.litHtmlVersions ?? (t$1.litHtmlVersions = [])).push("3.1.0"); const j = (t2, i2, s2) => { const e2 = (s2 == null ? void 0 : s2.renderBefore) ?? i2; let h2 = e2._$litPart$; if (void 0 === h2) { const t3 = (s2 == null ? void 0 : s2.renderBefore) ?? null; e2._$litPart$ = h2 = new M$1(i2.insertBefore(l$1(), t3), t3, void 0, s2 ?? {}); } return h2._$AI(t2), h2; }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ let s$1 = class s extends b$1 { constructor() { super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; } createRenderRoot() { var _a2; const t2 = super.createRenderRoot(); return (_a2 = this.renderOptions).renderBefore ?? (_a2.renderBefore = t2.firstChild), t2; } update(t2) { const i2 = this.render(); this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = j(i2, this.renderRoot, this.renderOptions); } connectedCallback() { var _a2; super.connectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(true); } disconnectedCallback() { var _a2; super.disconnectedCallback(), (_a2 = this._$Do) == null ? void 0 : _a2.setConnected(false); } render() { return w$1; } }; s$1._$litElement$ = true, s$1["finalized"] = true, (_a = globalThis.litElementHydrateSupport) == null ? void 0 : _a.call(globalThis, { LitElement: s$1 }); const r$1 = globalThis.litElementPolyfillSupport; r$1 == null ? void 0 : r$1({ LitElement: s$1 }); (globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.2"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t = (t2) => (e2, o2) => { void 0 !== o2 ? o2.addInitializer(() => { customElements.define(t2, e2); }) : customElements.define(t2, e2); }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const o$1 = { attribute: true, type: String, converter: u$2, reflect: false, hasChanged: f$2 }, r = (t2 = o$1, e2, r2) => { const { kind: n2, metadata: i2 } = r2; let s2 = globalThis.litPropertyMetadata.get(i2); if (void 0 === s2 && globalThis.litPropertyMetadata.set(i2, s2 = /* @__PURE__ */ new Map()), s2.set(r2.name, t2), "accessor" === n2) { const { name: o2 } = r2; return { set(r3) { const n3 = e2.get.call(this); e2.set.call(this, r3), this.requestUpdate(o2, n3, t2); }, init(e3) { return void 0 !== e3 && this.C(o2, void 0, t2), e3; } }; } if ("setter" === n2) { const { name: o2 } = r2; return function(r3) { const n3 = this[o2]; e2.call(this, r3), this.requestUpdate(o2, n3, t2); }; } throw Error("Unsupported decorator location: " + n2); }; function n(t2) { return (e2, o2) => "object" == typeof o2 ? r(t2, e2, o2) : ((t3, e3, o3) => { const r2 = e3.hasOwnProperty(o3); return e3.constructor.createProperty(o3, r2 ? { ...t3, wrapped: true } : t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0; })(t2, e2, o2); } /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const o = (o2) => o2 ?? T$1; const S = (t2) => { try { return !!new URL(t2); } catch { return false; } }, a = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:youtube(?:-nocookie)?.com|youtu.be)(?:\/watch\?v)?[=/]([a-zA-Z0-9_-]{11})(?:\\?|=|&|$)/, d = (t2) => { var o2; return t2 ? ((o2 = t2.match(a)) == null ? void 0 : o2[1]) ?? "" : ""; }, u = (t2) => `https://www.youtube.com/embed/${t2}`, l = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?(?:(?:dailymotion\.com(?:\/embed)?\/video)|dai\.ly)\/([a-zA-Z0-9]+)(?:_[\w_-]+)?(?:\?playlist=[a-zA-Z0-9]+)?$/, p = (t2) => { var o2; return ((o2 = t2.match(l)) == null ? void 0 : o2[1]) ?? ""; }, y = (t2) => `https://www.dailymotion.com/embed/video/${t2}`, w = /^(?:(?:https?):)?(?:\/\/)?(?:embed\.|open\.)(?:spotify\.com\/)(?:(album|track|playlist)\/|\?uri=spotify:track:)([-\w]{22})(?:\?si=[_-\w]{22})?$/, f = /spotify:(?:(album|track|playlist):|\?uri=spotify:track:)([-\w]{22})/, b = (t2) => { const [, o2, r2] = t2.match(w) || t2.match(f) || []; return [r2, o2]; }, h = (t2, o2) => `https://open.spotify.com/embed/${o2}/${t2}`, U = /(?:(?:https?):)?(?:\/\/)?(?:www\.|player\.)?vimeo\.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^/]*)\/videos\/|video\/|)(\d+)(?:|\/\?)/, g = (t2) => { var o2; return ((o2 = t2.match(U)) == null ? void 0 : o2[1]) ?? ""; }, z = (t2) => `https://player.vimeo.com/video/${t2}`, I = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?edpuzzle.com[=/]media\/([-\w]+)/, F = (t2) => { var o2; return t2 ? ((o2 = t2.match(I)) == null ? void 0 : o2[1]) ?? "" : ""; }, E = (t2) => `https://edpuzzle.com/embed/media/${t2}`, v = /^(?:(?:https?):)?(?:\/\/)?(?:www|fast|support\.)?(?:wistia.com|wi.st)[=/](?:medias|embed)\/([-\w]+)/, s = (t2) => { var o2; return t2 ? ((o2 = t2.match(v)) == null ? void 0 : o2[1]) ?? "" : ""; }, T = (t2) => `https://fast.wistia.net/embed/iframe/${t2}`, $ = /^(?:(?:https?):)?(?:\/\/)?(?:www\.)?loom.com[=/]share\/([-\w]+)/, c = (t2) => { var o2; return t2 ? ((o2 = t2.match($)) == null ? void 0 : o2[1]) ?? "" : ""; }, M = (t2) => `https://www.loom.com/embed/${t2}`; var e = /* @__PURE__ */ ((t2) => (t2.YouTube = "YouTube", t2.Spotify = "Spotify", t2.Vimeo = "Vimeo", t2.DailyMotion = "DailyMotion", t2.EdPuzzle = "EdPuzzle", t2.Loom = "Loom", t2.Wistia = "Wistia", t2))(e || {}); const x = (t2) => { if (t2) { if (t2.match(/dailymotion/)) return e.DailyMotion; if (t2.match(/spotify/)) return e.Spotify; if (t2.match(/vimeo/)) return e.Vimeo; if (t2.match(/youtu\.?be/)) return e.YouTube; if (t2.match(/edpuzzle.com/)) return e.EdPuzzle; if (s(t2)) return e.Wistia; if (c(t2)) return e.Loom; } }; ({ [e.DailyMotion]: p, [e.Spotify]: b, [e.Vimeo]: g, [e.YouTube]: d, [e.EdPuzzle]: F, [e.Loom]: c, [e.Wistia]: s }); ({ [e.DailyMotion]: y, [e.Spotify]: h, [e.Vimeo]: z, [e.YouTube]: u, [e.EdPuzzle]: E, [e.Loom]: M, [e.Wistia]: T }); var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--) if (decorator = decorators[i2]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; exports2.OEmbedElement = class OEmbedElement extends s$1 { constructor() { super(...arguments); this.width = "560"; this.height = "315"; this.frameborder = "0"; this.allowfullscreen = "true"; } instanceStyle() { const { widthWithUnits, heightWithUnits } = this.getDefaultDimensions( this.provider ); return x$1` `; } render() { this.provider = x(this.url); if (!this.url || this.url == "") { return x$1``; } let embedResult; switch (this.provider) { case e.YouTube: embedResult = this.renderYouTube(); break; case e.Spotify: embedResult = this.renderSpotify(); break; case e.Vimeo: embedResult = this.renderVimeo(); break; case e.DailyMotion: embedResult = this.renderDailyMotion(); break; case e.EdPuzzle: embedResult = this.renderEdPuzzle(); break; case e.Wistia: embedResult = this.renderWistia(); break; case e.Loom: embedResult = this.renderLoom(); break; default: if (S(this.url)) { embedResult = this.renderIframe(); } else { embedResult = x$1`No provider found for ${this.url}`; } break; } return x$1`${this.instanceStyle()}${embedResult}`; } renderSpotify() { const url = h( ...b(this.url) ); return x$1` `; } getDefaultDimensions(provider) { switch (provider) { case e.Vimeo: return this.calculateDefaultDimensions({ defaults: exports2.OEmbedElement.vimeoDefaultDimensions }); case e.DailyMotion: return this.calculateDefaultDimensions(); case e.EdPuzzle: return this.calculateDefaultDimensions({ defaults: exports2.OEmbedElement.edPuzzleDefaultDimensions }); case e.Wistia: return this.calculateDefaultDimensions({ defaults: exports2.OEmbedElement.wistiaDefaultDimensions }); case e.Loom: return this.calculateDefaultDimensions({ defaults: exports2.OEmbedElement.loomDefaultDimensions }); case e.Spotify: return this.calculateDefaultDimensions({ defaults: exports2.OEmbedElement.spotifyDefaultDimensions }); default: return this.calculateDefaultDimensions(); } } calculateDefaultDimensions({ defaults } = { defaults: void 0 }) { const width = this.getAttribute("width") || (defaults == null ? void 0 : defaults.width) || this.width; const widthWithUnits = width.match(/(px|%)/) ? width : `${width}px`; const height = this.getAttribute("height") || (defaults == null ? void 0 : defaults.height) || this.height; const heightWithUnits = height.match(/(px|%)/) ? height : `${height}px`; return { width, widthWithUnits, height, heightWithUnits }; } renderDailyMotion() { const dailyMotionId = p(this.url); if (!dailyMotionId) { return x$1`Could not find dailyMotionId in ${dailyMotionId}`; } const url = y(dailyMotionId); const { width, height } = this.getDefaultDimensions(this.provider); return x$1` `; } renderVimeo() { const vimeoId = g(this.url); if (!vimeoId) { return x$1`Could not find vimeoId in ${vimeoId}`; } const url = z(vimeoId); const { width, height } = this.getDefaultDimensions(this.provider); return x$1` `; } renderYouTube() { const youtubeId = d(this.url); const youtubeUrl = u(youtubeId); if (!youtubeId) { return x$1``; } return x$1` `; } renderIframe() { const { width, height } = this.getDefaultDimensions(this.provider); return x$1` `; } renderEdPuzzle() { if (!this.url) { return x$1`No url found for embed`; } const embedId = F(this.url); if (!embedId) { return x$1`No ID found for ${this.url}`; } const embedUrl = E(embedId); const { width, height } = this.getDefaultDimensions(this.provider); return x$1` `; } renderWistia() { if (!this.url) { return x$1`No url found for embed`; } const embedId = s(this.url); if (!embedId) { return x$1`No ID found for ${this.url}`; } const embedUrl = T(embedId); const { width, height } = this.getDefaultDimensions(this.provider); return x$1` `; } renderLoom() { if (!this.url) { return x$1`No url found for embed`; } const embedId = c(this.url); if (!embedId) { return x$1`No ID found for ${this.url}`; } const embedUrl = M(embedId); const { width, height } = this.getDefaultDimensions(this.provider); return x$1` `; } }; exports2.OEmbedElement.spotifyDefaultDimensions = { // width: "470", // widthWithUnits: "470px", height: "352", heightWithUnits: "352px" }; exports2.OEmbedElement.vimeoDefaultDimensions = { width: "640", widthWithUnits: "640px", height: "268", heightWithUnits: "268" }; exports2.OEmbedElement.edPuzzleDefaultDimensions = { width: "470", widthWithUnits: "470px", height: "404", heightWithUnits: "404px" }; exports2.OEmbedElement.wistiaDefaultDimensions = { width: "470", widthWithUnits: "470px", height: "404", heightWithUnits: "404px" }; exports2.OEmbedElement.loomDefaultDimensions = { width: "470", widthWithUnits: "470px", height: "404", heightWithUnits: "404px" }; __decorateClass([ n({ type: String }) ], exports2.OEmbedElement.prototype, "url", 2); __decorateClass([ n({ type: String }) ], exports2.OEmbedElement.prototype, "width", 2); __decorateClass([ n({ type: String }) ], exports2.OEmbedElement.prototype, "height", 2); __decorateClass([ n({ type: String }) ], exports2.OEmbedElement.prototype, "frameborder", 2); __decorateClass([ n({ type: String }) ], exports2.OEmbedElement.prototype, "allowfullscreen", 2); exports2.OEmbedElement = __decorateClass([ t("o-embed") ], exports2.OEmbedElement); Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" }); });