1/** 2 * @license 3 * Copyright 2019 Google LLC 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6const T = globalThis, z = T.ShadowRoot && (T.ShadyCSS === void 0 || T.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, L = Symbol(), D = /* @__PURE__ */ new WeakMap(); 7let X = class { 8 constructor(t, e, s) { 9 if (this._$cssResult$ = !0, s !== L) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); 10 this.cssText = t, this.t = e; 11 } 12 get styleSheet() { 13 let t = this.o; 14 const e = this.t; 15 if (z && t === void 0) { 16 const s = e !== void 0 && e.length === 1; 17 s && (t = D.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && D.set(e, t)); 18 } 19 return t; 20 } 21 toString() { 22 return this.cssText; 23 } 24}; 25const nt = (i) => new X(typeof i == "string" ? i : i + "", void 0, L), ot = (i, ...t) => { 26 const e = i.length === 1 ? i[0] : t.reduce(((s, r, n) => s + ((o) => { 27 if (o._$cssResult$ === !0) return o.cssText; 28 if (typeof o == "number") return o; 29 throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); 30 })(r) + i[n + 1]), i[0]); 31 return new X(e, i, L); 32}, at = (i, t) => { 33 if (z) i.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet)); 34 else for (const e of t) { 35 const s = document.createElement("style"), r = T.litNonce; 36 r !== void 0 && s.setAttribute("nonce", r), s.textContent = e.cssText, i.appendChild(s); 37 } 38}, W = z ? (i) => i : (i) => i instanceof CSSStyleSheet ? ((t) => { 39 let e = ""; 40 for (const s of t.cssRules) e += s.cssText; 41 return nt(e); 42})(i) : i; 43/** 44 * @license 45 * Copyright 2017 Google LLC 46 * SPDX-License-Identifier: BSD-3-Clause 47 */ 48const { is: lt, defineProperty: ht, getOwnPropertyDescriptor: ct, getOwnPropertyNames: dt, getOwnPropertySymbols: pt, getPrototypeOf: ut } = Object, N = globalThis, V = N.trustedTypes, ft = V ? V.emptyScript : "", mt = N.reactiveElementPolyfillSupport, w = (i, t) => i, M = { toAttribute(i, t) { 49 switch (t) { 50 case Boolean: 51 i = i ? ft : null; 52 break; 53 case Object: 54 case Array: 55 i = i == null ? i : JSON.stringify(i); 56 } 57 return i; 58}, fromAttribute(i, t) { 59 let e = i; 60 switch (t) { 61 case Boolean: 62 e = i !== null; 63 break; 64 case Number: 65 e = i === null ? null : Number(i); 66 break; 67 case Object: 68 case Array: 69 try { 70 e = JSON.parse(i); 71 } catch { 72 e = null; 73 } 74 } 75 return e; 76} }, Y = (i, t) => !lt(i, t), q = { attribute: !0, type: String, converter: M, reflect: !1, useDefault: !1, hasChanged: Y }; 77Symbol.metadata ??= Symbol("metadata"), N.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap(); 78let A = class extends HTMLElement { 79 static addInitializer(t) { 80 this._$Ei(), (this.l ??= []).push(t); 81 } 82 static get observedAttributes() { 83 return this.finalize(), this._$Eh && [...this._$Eh.keys()]; 84 } 85 static createProperty(t, e = q) { 86 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) { 87 const s = Symbol(), r = this.getPropertyDescriptor(t, s, e); 88 r !== void 0 && ht(this.prototype, t, r); 89 } 90 } 91 static getPropertyDescriptor(t, e, s) { 92 const { get: r, set: n } = ct(this.prototype, t) ?? { get() { 93 return this[e]; 94 }, set(o) { 95 this[e] = o; 96 } }; 97 return { get: r, set(o) { 98 const l = r?.call(this); 99 n?.call(this, o), this.requestUpdate(t, l, s); 100 }, configurable: !0, enumerable: !0 }; 101 } 102 static getPropertyOptions(t) { 103 return this.elementProperties.get(t) ?? q; 104 } 105 static _$Ei() { 106 if (this.hasOwnProperty(w("elementProperties"))) return; 107 const t = ut(this); 108 t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties); 109 } 110 static finalize() { 111 if (this.hasOwnProperty(w("finalized"))) return; 112 if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(w("properties"))) { 113 const e = this.properties, s = [...dt(e), ...pt(e)]; 114 for (const r of s) this.createProperty(r, e[r]); 115 } 116 const t = this[Symbol.metadata]; 117 if (t !== null) { 118 const e = litPropertyMetadata.get(t); 119 if (e !== void 0) for (const [s, r] of e) this.elementProperties.set(s, r); 120 } 121 this._$Eh = /* @__PURE__ */ new Map(); 122 for (const [e, s] of this.elementProperties) { 123 const r = this._$Eu(e, s); 124 r !== void 0 && this._$Eh.set(r, e); 125 } 126 this.elementStyles = this.finalizeStyles(this.styles); 127 } 128 static finalizeStyles(t) { 129 const e = []; 130 if (Array.isArray(t)) { 131 const s = new Set(t.flat(1 / 0).reverse()); 132 for (const r of s) e.unshift(W(r)); 133 } else t !== void 0 && e.push(W(t)); 134 return e; 135 } 136 static _$Eu(t, e) { 137 const s = e.attribute; 138 return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0; 139 } 140 constructor() { 141 super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev(); 142 } 143 _$Ev() { 144 this._$ES = new Promise(((t) => this.enableUpdating = t)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t) => t(this))); 145 } 146 addController(t) { 147 (this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.(); 148 } 149 removeController(t) { 150 this._$EO?.delete(t); 151 } 152 _$E_() { 153 const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties; 154 for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]); 155 t.size > 0 && (this._$Ep = t); 156 } 157 createRenderRoot() { 158 const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); 159 return at(t, this.constructor.elementStyles), t; 160 } 161 connectedCallback() { 162 this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((t) => t.hostConnected?.())); 163 } 164 enableUpdating(t) { 165 } 166 disconnectedCallback() { 167 this._$EO?.forEach(((t) => t.hostDisconnected?.())); 168 } 169 attributeChangedCallback(t, e, s) { 170 this._$AK(t, s); 171 } 172 _$ET(t, e) { 173 const s = this.constructor.elementProperties.get(t), r = this.constructor._$Eu(t, s); 174 if (r !== void 0 && s.reflect === !0) { 175 const n = (s.converter?.toAttribute !== void 0 ? s.converter : M).toAttribute(e, s.type); 176 this._$Em = t, n == null ? this.removeAttribute(r) : this.setAttribute(r, n), this._$Em = null; 177 } 178 } 179 _$AK(t, e) { 180 const s = this.constructor, r = s._$Eh.get(t); 181 if (r !== void 0 && this._$Em !== r) { 182 const n = s.getPropertyOptions(r), o = typeof n.converter == "function" ? { fromAttribute: n.converter } : n.converter?.fromAttribute !== void 0 ? n.converter : M; 183 this._$Em = r; 184 const l = o.fromAttribute(e, n.type); 185 this[r] = l ?? this._$Ej?.get(r) ?? l, this._$Em = null; 186 } 187 } 188 requestUpdate(t, e, s) { 189 if (t !== void 0) { 190 const r = this.constructor, n = this[t]; 191 if (s ??= r.getPropertyOptions(t), !((s.hasChanged ?? Y)(n, e) || s.useDefault && s.reflect && n === this._$Ej?.get(t) && !this.hasAttribute(r._$Eu(t, s)))) return; 192 this.C(t, e, s); 193 } 194 this.isUpdatePending === !1 && (this._$ES = this._$EP()); 195 } 196 C(t, e, { useDefault: s, reflect: r, wrapped: n }, o) { 197 s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), n !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || s || (e = void 0), this._$AL.set(t, e)), r === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t)); 198 } 199 async _$EP() { 200 this.isUpdatePending = !0; 201 try { 202 await this._$ES; 203 } catch (e) { 204 Promise.reject(e); 205 } 206 const t = this.scheduleUpdate(); 207 return t != null && await t, !this.isUpdatePending; 208 } 209 scheduleUpdate() { 210 return this.performUpdate(); 211 } 212 performUpdate() { 213 if (!this.isUpdatePending) return; 214 if (!this.hasUpdated) { 215 if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { 216 for (const [r, n] of this._$Ep) this[r] = n; 217 this._$Ep = void 0; 218 } 219 const s = this.constructor.elementProperties; 220 if (s.size > 0) for (const [r, n] of s) { 221 const { wrapped: o } = n, l = this[r]; 222 o !== !0 || this._$AL.has(r) || l === void 0 || this.C(r, void 0, n, l); 223 } 224 } 225 let t = !1; 226 const e = this._$AL; 227 try { 228 t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach(((s) => s.hostUpdate?.())), this.update(e)) : this._$EM(); 229 } catch (s) { 230 throw t = !1, this._$EM(), s; 231 } 232 t && this._$AE(e); 233 } 234 willUpdate(t) { 235 } 236 _$AE(t) { 237 this._$EO?.forEach(((e) => e.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t); 238 } 239 _$EM() { 240 this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1; 241 } 242 get updateComplete() { 243 return this.getUpdateComplete(); 244 } 245 getUpdateComplete() { 246 return this._$ES; 247 } 248 shouldUpdate(t) { 249 return !0; 250 } 251 update(t) { 252 this._$Eq &&= this._$Eq.forEach(((e) => this._$ET(e, this[e]))), this._$EM(); 253 } 254 updated(t) { 255 } 256 firstUpdated(t) { 257 } 258}; 259A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, A[w("elementProperties")] = /* @__PURE__ */ new Map(), A[w("finalized")] = /* @__PURE__ */ new Map(), mt?.({ ReactiveElement: A }), (N.reactiveElementVersions ??= []).push("2.1.1"); 260/** 261 * @license 262 * Copyright 2017 Google LLC 263 * SPDX-License-Identifier: BSD-3-Clause 264 */ 265const j = globalThis, x = j.trustedTypes, J = x ? x.createPolicy("lit-html", { createHTML: (i) => i }) : void 0, tt = "$lit$", g = `lit$${Math.random().toFixed(9).slice(2)}$`, et = "?" + g, gt = `<${et}>`, _ = document, C = () => _.createComment(""), P = (i) => i === null || typeof i != "object" && typeof i != "function", I = Array.isArray, $t = (i) => I(i) || typeof i?.[Symbol.iterator] == "function", R = `[ 266\f\r]`, E = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, K = /-->/g, Z = />/g, $ = RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ 267\f\r"'\`<>=]|("|')|))|$)`, "g"), F = /'/g, G = /"/g, st = /^(?:script|style|textarea|title)$/i, yt = (i) => (t, ...e) => ({ _$litType$: i, strings: t, values: e }
vendor: 4,500 bytes, lines 267-364
267), u = yt(1), v = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), Q = /* @__PURE__ */ new WeakMap(), y = _.createTreeWalker(_, 129); 268function it(i, t) { 269 if (!I(i) || !i.hasOwnProperty("raw")) throw Error("invalid template strings array"); 270 return J !== void 0 ? J.createHTML(t) : t; 271} 272const _t = (i, t) => { 273 const e = i.length - 1, s = []; 274 let r, n = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = E; 275 for (let l = 0; l < e; l++) { 276 const a = i[l]; 277 let c, p, h = -1, f = 0; 278 for (; f < a.length && (o.lastIndex = f, p = o.exec(a), p !== null); ) f = o.lastIndex, o === E ? p[1] === "!--" ? o = K : p[1] !== void 0 ? o = Z : p[2] !== void 0 ? (st.test(p[2]) && (r = RegExp("</" + p[2], "g")), o = $) : p[3] !== void 0 && (o = $) : o === $ ? p[0] === ">" ? (o = r ?? E, h = -1) : p[1] === void 0 ? h = -2 : (h = o.lastIndex - p[2].length, c = p[1], o = p[3] === void 0 ? $ : p[3] === '"' ? G : F) : o === G || o === F ? o = $ : o === K || o === Z ? o = E : (o = $, r = void 0); 279 const m = o === $ && i[l + 1].startsWith("/>") ? " " : ""; 280 n += o === E ? a + gt : h >= 0 ? (s.push(c), a.slice(0, h) + tt + a.slice(h) + g + m) : a + g + (h === -2 ? l : m); 281 } 282 return [it(i, n + (i[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s]; 283}; 284class U { 285 constructor({ strings: t, _$litType$: e }, s) { 286 let r; 287 this.parts = []; 288 let n = 0, o = 0; 289 const l = t.length - 1, a = this.parts, [c, p] = _t(t, e); 290 if (this.el = U.createElement(c, s), y.currentNode = this.el.content, e === 2 || e === 3) { 291 const h = this.el.content.firstChild; 292 h.replaceWith(...h.childNodes); 293 } 294 for (; (r = y.nextNode()) !== null && a.length < l; ) { 295 if (r.nodeType === 1) { 296 if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(tt)) { 297 const f = p[o++], m = r.getAttribute(h).split(g), O = /([.?@])?(.*)/.exec(f); 298 a.push({ type: 1, index: n, name: O[2], strings: m, ctor: O[1] === "." ? bt : O[1] === "?" ? vt : O[1] === "@" ? St : k }), r.removeAttribute(h); 299 } else h.startsWith(g) && (a.push({ type: 6, index: n }), r.removeAttribute(h)); 300 if (st.test(r.tagName)) { 301 const h = r.textContent.split(g), f = h.length - 1; 302 if (f > 0) { 303 r.textContent = x ? x.emptyScript : ""; 304 for (let m = 0; m < f; m++) r.append(h[m], C()), y.nextNode(), a.push({ type: 2, index: ++n }); 305 r.append(h[f], C()); 306 } 307 } 308 } else if (r.nodeType === 8) if (r.data === et) a.push({ type: 2, index: n }); 309 else { 310 let h = -1; 311 for (; (h = r.data.indexOf(g, h + 1)) !== -1; ) a.push({ type: 7, index: n }), h += g.length - 1; 312 } 313 n++; 314 } 315 } 316 static createElement(t, e) { 317 const s = _.createElement("template"); 318 return s.innerHTML = t, s; 319 } 320} 321function S(i, t, e = i, s) { 322 if (t === v) return t; 323 let r = s !== void 0 ? e._$Co?.[s] : e._$Cl; 324 const n = P(t) ? void 0 : t._$litDirective$; 325 return r?.constructor !== n && (r?._$AO?.(!1), n === void 0 ? r = void 0 : (r = new n(i), r._$AT(i, e, s)), s !== void 0 ? (e._$Co ??= [])[s] = r : e._$Cl = r), r !== void 0 && (t = S(i, r._$AS(i, t.values), r, s)), t; 326} 327class At { 328 constructor(t, e) { 329 this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e; 330 } 331 get parentNode() { 332 return this._$AM.parentNode; 333 } 334 get _$AU() { 335 return this._$AM._$AU; 336 } 337 u(t) { 338 const { el: { content: e }, parts: s } = this._$AD, r = (t?.creationScope ?? _).importNode(e, !0); 339 y.currentNode = r; 340 let n = y.nextNode(), o = 0, l = 0, a = s[0]; 341 for (; a !== void 0; ) { 342 if (o === a.index) { 343 let c; 344 a.type === 2 ? c = new H(n, n.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(n, a.name, a.strings, this, t) : a.type === 6 && (c = new Et(n, this, t)), this._$AV.push(c), a = s[++l]; 345 } 346 o !== a?.index && (n = y.nextNode(), o++); 347 } 348 return y.currentNode = _, r; 349 } 350 p(t) { 351 let e = 0; 352 for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++; 353 } 354} 355class H { 356 get _$AU() { 357 return this._$AM?._$AU ?? this._$Cv; 358 } 359 constructor(t, e, s, r) { 360 this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = r, this._$Cv = r?.isConnected ?? !0; 361 } 362 get parentNode() { 363 let t = this._$AA.parentNode; 364 const e = this._$AM;
365 return e !== void 0 && t?.nodeType === 11 && (t = e.parentNode), t; 366 } 367 get startNode() { 368 return this._$AA; 369 } 370 get endNode() { 371 return this._$AB; 372 } 373 _$AI(t, e = this) { 374 t = S(this, t, e), P(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== v && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : $t(t) ? this.k(t) : this._(t); 375 } 376 O(t) { 377 return this._$AA.parentNode.insertBefore(t, this._$AB); 378 } 379 T(t) { 380 this._$AH !== t && (this._$AR(), this._$AH = this.O(t)); 381 } 382 _(t) { 383 this._$AH !== d && P(this._$AH) ? this._$AA.nextSibling.data = t : this.T(_.createTextNode(t)), this._$AH = t; 384 } 385 $(t) { 386 const { values: e, _$litType$: s } = t, r = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = U.createElement(it(s.h, s.h[0]), this.options)), s); 387 if (this._$AH?._$AD === r) this._$AH.p(e); 388 else { 389 const n = new At(r, this), o = n.u(this.options); 390 n.p(e), this.T(o), this._$AH = n; 391 } 392 } 393 _$AC(t) { 394 let e = Q.get(t.strings); 395 return e === void 0 && Q.set(t.strings, e = new U(t)), e; 396 } 397 k(t) { 398 I(this._$AH) || (this._$AH = [], this._$AR()); 399 const e = this._$AH; 400 let s, r = 0; 401 for (const n of t) r === e.length ? e.push(s = new H(this.O(C()), this.O(C()), this, this.options)) : s = e[r], s._$AI(n), r++; 402 r < e.length && (this._$AR(s && s._$AB.nextSibling, r), e.length = r); 403 } 404 _$AR(t = this._$AA.nextSibling, e) { 405 for (this._$AP?.(!1, !0, e); t !== this._$AB; ) { 406 const s = t.nextSibling; 407 t.remove(), t = s; 408 } 409 } 410 setConnected(t) { 411 this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t)); 412 } 413} 414class k { 415 get tagName() { 416 return this.element.tagName; 417 } 418 get _$AU() { 419 return this._$AM._$AU; 420 } 421 constructor(t, e, s, r, n) { 422 this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = e, this._$AM = r, 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; 423 } 424 _$AI(t, e = this, s, r) { 425 const n = this.strings; 426 let o = !1; 427 if (n === void 0) t = S(this, t, e, 0), o = !P(t) || t !== this._$AH && t !== v, o && (this._$AH = t); 428 else { 429 const l = t; 430 let a, c; 431 for (t = n[0], a = 0; a < n.length - 1; a++) c = S(this, l[s + a], e, a), c === v && (c = this._$AH[a]), o ||= !P
431(c) || c !== this._$AH[a], c === d ? t = d : t !== d && (t += (c ?? "") + n[a + 1]), this._$AH[a] = c; 432 } 433 o && !r && this.j(t); 434 } 435 j(t) { 436 t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? ""); 437 } 438} 439class bt extends k { 440 constructor() { 441 super(...arguments), this.type = 3; 442 } 443 j(t) { 444 this.element[this.name] = t === d ? void 0 : t; 445 } 446} 447class vt extends k { 448 constructor() { 449 super(...arguments), this.type = 4; 450 } 451 j(t) { 452 this.element.toggleAttribute(this.name, !!t && t !== d); 453 } 454} 455class St extends k { 456 constructor(t, e, s, r, n) { 457 super(t, e, s, r, n), this.type = 5; 458 } 459 _$AI(t, e = this) { 460 if ((t = S(this, t, e, 0) ?? d) === v) return; 461 const s = this._$AH, r = t === d && s !== d || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, n = t !== d && (s === d || r); 462 r && this.element.removeEventListener(this.name, this, s), n && this.element.addEventListener(this.name, this, t), this._$AH = t; 463 } 464 handleEvent(t) { 465 typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t); 466 } 467} 468class Et { 469 constructor(t, e, s) { 470 this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s; 471 } 472 get _$AU() { 473 return this._$AM._$AU; 474 } 475 _$AI(t) { 476 S(this, t); 477 } 478} 479const wt = j.litHtmlPolyfillSupport; 480wt?.(U, H), (j.litHtmlVersions ??= []).push("3.3.1"); 481const Ct = (i, t, e) => { 482 const s = e?.renderBefore ?? t; 483 let r = s._$litPart$; 484 if (r === void 0) { 485 const n = e?.renderBefore ?? null; 486 s._$litPart$ = r = new H(t.insertBefore(C(), n), n, void 0, e ?? {}); 487 } 488 return r._$AI(i), r; 489}; 490/** 491 * @license 492 * Copyright 2017 Google LLC 493 * SPDX-License-Identifier: BSD-3-Clause 494 */ 495const B = globalThis; 496class b extends A { 497 constructor() { 498 super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; 499 } 500 createRenderRoot() { 501 const t = super.createRenderRoot(); 502 return this.renderOptions.renderBefore ??= t.firstChild, t; 503 } 504 update(t) { 505 const e = this.render(); 506 this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Ct(e, this.renderRoot, this.renderOptions); 507 } 508 connectedCallback() { 509 super.connectedCallback(), this._$Do?.setConnected(!0); 510 } 511 disconnectedCallback() { 512 super.disconnectedCallback(), this._$Do?.setConnected(!1); 513 } 514 render() { 515 return v; 516 } 517} 518b._$litElement$ = !0, b.finalized = !0, B.litElementHydrateSupport?.({ LitElement: b }); 519const Pt = B.litElementPolyfillSupport; 520Pt?.({ LitElement: b }); 521(B.litElementVersions ??= []).push("4.2.1"); 522function Ut(i) { 523 let t = []; 524 return Array.isArray(i?.items) ? t = i.items : Array.isArray(i?.results) ? t = i.results : Array.isArray(i?.data) ? t = i.data : Array.isArray(i?.hits) ? t = i.hits : Array.isArray(i?.hits?.hits) && (t = i.hits.hits.map((e) => e._source || e.fields || e)), t.map(Ht).filter(Boolean); 525} 526function Ht(i) { 527 if (!i) return null; 528 const t = i.href || i.uri || i.url || i.path || "", e = i.title || i.name || i.headline || "", s = i.description || i.summary || i.deck || "", r = i.image || i.image_url || i.primaryImage || i.teaseImage || (typeof i.images?.[0] == "string" ? i.images[0] : i.images?.[0]?.src) || ""; 529 return !t || !e ? null : { href: t, title: e, description: s, image: r }; 530} 531class rt extends b { 532 static properties = { 533 src: { type: String, reflect: !0 }, 534 limit: { type: Number, reflect: !0 }, 535 items: { type: Array, attribute: !1 }, 536 loading: { type: Boolean, attribute: !1 }, 537 error: { type: String, attribute: !1 } 538 }; 539 constructor() { 540 super(), this.limit = 24, this.items = [], this.loading = !1, this.error = ""; 541 } 542 connectedCallback() { 543 super.connectedCallback(), this.load(); 544 } 545 async load() { 546 if (this.src) { 547 this.loading = !0, this.error = ""; 548 try { 549 const e = await (await fetch(this.src)).json(), s = Ut(e).slice(0, this.limit); 550 this.items = s, this.dispatchEvent(new CustomEvent( 551 "results", 552 { detail: { items: s }, bubbles: !0 } 553 )); 554 } catch (t) { 555 this.error = "Unable to load results.", this.dispatchEvent(new CustomEvent( 556 "results-error", 557 { detail: t, bubbles: !0 } 558 )); 559 } finally { 560 this.loading = !1; 561 } 562 } 563 } 564 /** Headless: no shadow DOM rendering */ 565 createRenderRoot() { 566 return this; 567 } 568} 569customElements.define("search-results-provider", rt); 570class Ot extends b { 571 static properties = { 572 src: { type: String, reflect: !0 },
573 // search_url.url 574 label: { type: String, reflect: !0 }, 575 // optional heading 576 exclude: { type: String, reflect: !0 }, 577 limit: { type: Number, reflect: !0 }, 578 items: { type: Array }, 579 loading: { type: Boolean, state: !0 }, 580 error: { type: String, state: !0 }, 581 imageWidth: { type: Number, attribute: "image-width", reflect: !0 }, 582 imageHeight: { type: Number, attribute: "image-height", reflect: !0 } 583 }; 584 static styles = ot` 585 :host { display: block; } 586 .center-column { 587 width: 100%; 588 margin: 2rem auto; 589 } 590 .heading { 591 font-family: var(--heading-font-family, sans-serif); 592 font-size: 1.125rem; 593 font-weight: 700; 594 margin: 1rem 0; 595 text-align: left; 596 } 597 .results { 598 list-style: none; 599 margin: 0; 600 padding: 0; 601 display: flex; 602 flex-direction: column; 603 gap: 1.25rem; 604 } 605 .result { 606 display: grid; 607 grid-template-columns: 1fr 360px; /* text | image */ 608 gap: 1rem; 609 align-items: start; 610 } 611 .badges { 612 display: flex; 613 align-items: center; 614 gap: .5rem; 615 margin-top: .375rem; /* sits just under the description */ 616 } 617 .badge { display: inline-block; } 618 /* SPONSORED */ 619 .badge--sponsored { 620 background-color: #fff5ba; 621 border-bottom: none !important; 622 color: #000B27; 623 font-size: 0.625rem; 624 letter-spacing: 0.07em; 625 padding: 2px 3px 2px 4px; 626 text-transform: uppercase; 627 } 628 /* SPOTLIGHT */ 629 .badge--spotlight { 630 border-bottom: 1px dotted #565454; 631 border-bottom-style: dotted; 632 color: #263238; 633 font-size: 0.6875rem; 634 font-weight: 400; 635 letter-spacing: 0.02em; 636 padding-bottom: 0.0625rem; 637 text-transform: uppercase; 638 } 639 .result-text h3 { 640 margin: 0 0 .375rem; 641 line-height: 1.18; 642 font-family: var(--heading-font-family, sans-serif); 643 font-size: 1.125rem; 644 } 645 .result-text h3 a { 646 color: inherit; 647 text-decoration: none; 648 } 649 .caption { 650 color: var(--color-gray-7, #444); 651 font-family: var(--heading-font-family, sans-serif); 652 font-size: .9375rem; 653 line-height: 1.35; 654 margin: 0; 655 } 656 .aspect-16x9 { 657 position: relative; 658 width: 100%; 659 aspect-ratio: 16 / 9; 660 overflow: hidden; 661 background: var(--color-gray-1, #f7f5f4); 662 } 663 .aspect-16x9 img { 664 width: 100%; 665 height: 100%; 666 object-fit: cover; 667 display: block; 668 } 669 .thumb-link { text-decoration: none; color: inherit; } 670 671 .loader { 672 width: 48px; height: 48px; border-radius: 50%; 673 border: 4px solid var(--color-gray-2, #eee); 674 border-top-color: var(--color-primary, #000); 675 animation: spin 1s linear infinite; 676 margin: 1.5rem auto; 677 } 678 @keyframes spin { to { transform: rotate(360deg) } } 679 680 .empty { 681 color: var(--color-gray-6, #666); 682 font-family: var(--heading-font-family, sans-serif); 683 text-align: center; 684 padding: 1rem 0; 685 } 686 687 @media (max-width: 900px) { 688 .result { grid-template-columns: 1fr; } 689 } 690 `; 691 constructor() { 692 super(), this.items = [], this.loading = !1, this.error = "", this.limit = 24, this.imageWidth = 640, this.imageHeight = 360, this._controller = null; 693 } 694 connectedCallback() { 695 super.connectedCallback(), this.load(); 696 } 697 disconnectedCallback() { 698 this._controller?.abort(), super.disconnectedCallback(); 699 } 700 willUpdate(t) { 701 (t.has("src") || t.has("limit")) && this.load(); 702 } 703 async load() { 704 if (this.src) { 705 this.loading = !0, this.error = "", this._controller?.abort(), this._controller = new AbortController(); 706 try { 707 const t = await fetch(this.src, { signal: this._controller.signal }); 708 if (!t.ok) throw new Error(`${t.status} ${t.statusText}`); 709 const e = await t.json(), s = Math.max(1, Math.min(Number(this.limit) || 24, 200)); 710 this.items = Tt(e).slice(0, s), this.dispatchEvent(new CustomEvent("load-success", { 711 detail: { count: this.items.length }, 712 bubbles: !0, 713 composed: !0 714 })); 715 } catch (t) { 716 if (t?.name === "AbortError") return; 717 console.error("[SearchList]", t), this.error = "Unable to load results.", this.dispatchEvent(new CustomEvent("load-error", { 718 detail: { message: String(t?.message || t) },
719 bubbles: !0, 720 composed: !0 721 })); 722 } finally { 723 this.loading = !1; 724 } 725 } 726 } 727 /* eslint-disable max-len */ 728 render() { 729 const t = (s, r) => { 730 const n = (l) => String(l || "").trim().toLowerCase(); 731 return (s?.tags ?? []).map( 732 (l) => n(typeof l == "string" ? l : l?.name || l?.slug || l?.label) 733 ).includes(n(r)); 734 }, e = (this.items || []).filter((s) => !this.exclude || !String(s.href || "").includes(this.exclude)); 735 return u` 736 <div class="center-column" aria-busy="${this.loading}"> 737 ${this.label ? u`<div class="heading">${this.label}</div>` : ""} 738 ${this.loading ? u`<div class="loader" aria-label="Loading"></div>` : ""} 739 ${!this.loading && !e.length && !this.error ? u` 740 <div class="empty">No matching stories yet.</div> 741 ` : ""} 742 ${this.error ? u`<div class="empty">${this.error}</div>` : ""} 743 ${e.length ? u` 744 <ul class="results"> 745 ${e.map((s) => u` 746 <li class="result"> 747 <div class="result-text"> 748 <h3><a href="${s.href}">${s.title}</a></h3> 749 ${s.description ? u`<p class="caption">${s.description}</p>` : ""} 750 ${t(s, "sponsored") || t(s, "spotlight") ? u` 751 <div class="badges"> 752 ${t(s, "sponsored") ? u` 753 <span class="badge badge--sponsored" aria-label="Sponsored">Sponsored</span> 754 ` : ""} 755 ${t(s, "spotlight") ? u` 756 <span class="badge badge--spotlight" aria-label="Spotlight">Spotlight</span> 757 ` : ""} 758 </div> 759 ` : ""} 760 </div> 761 ${s.image ? u` 762 <a class="thumb-link" href="${s.href}" aria-label="${s.title}"> 763 <div 764 class="aspect-16x9" 765 style="aspect-ratio: ${this.imageWidth} / ${this.imageHeight}" 766 > 767 <img 768 src="${Nt(s.image, this.imageWidth, this.imageHeight)}" 769 width="${this.imageWidth}" 770 height="${this.imageHeight}" 771 alt="${s.title}" 772 loading="lazy" 773 decoding="async" 774 referrerpolicy="no-referrer" 775 > 776 </div> 777 </a> 778 ` : ""} 779 </li> 780 `)} 781 </ul> 782 ` : ""} 783 </div> 784 `; 785 } 786} 787function Tt(i) { 788 let t = []; 789 return Array.isArray(i?.items) ? t = i.items : Array.isArray(i?.results) ? t = i.results : Array.isArray(i?.data) ? t = i.data : Array.isArray(i?.hits) ? t = i.hits : Array.isArray(i?.hits?.hits) && (t = i.hits.hits.map((e) => e._source || e.fields || e)), t.map(xt).filter(Boolean); 790} 791function xt(i) { 792 if (!i) return null; 793 const t = i.href || i.uri || i.url || i.path || "", e = i.title || i.name || i.headline || "", s = i.description || i.summary || i.deck || "", r = i.image || i.image_url || i.primaryImage || i.teaseImage || (typeof i.images?.[0] == "string" ? i.images[0] : i.images?.[0]?.src) || "", n = i.tags || i.tag_list || i.labels || i.categories || i.topics || []; 794 return !t || !e ? null : { href: t, title: e, description: s, image: r, tags: n }; 795} 796function Nt(i, t = 640, e = 360) { 797 if (!i) return ""; 798 if (!/^https?:\/\//i.test(String(i))) return String(i); 799 try { 800 const s = new URL(i, window.location.origin); 801 return s.searchParams.set("w", String(t)), s.searchParams.set("h", String(e)), s.searchParams.set("f", "jpg"), s.toString(); 802 } catch { 803 const s = String(i).replace(/([?&])(w|h|f)=[^&]*/g, "").replace(/[?&]$/, ""), r = s.includes("?") ? "&" : "?"; 804 return `${s}${r}w=${t}&h=${e}&f=jpg`; 805 } 806} 807function kt() { 808 const i = globalThis?.customElements; 809 if (!i) return; 810 const t = { 811 "search-results-provider": rt, 812 "search-list": Ot 813 }; 814 for (const [e, s] of Object.entries(t)) 815 i.get(e) || i.define(e, s); 816} 817typeof window < "u" && globalThis.customElements && kt(); 818export { 819 kt as defineAll 820};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.