cc-viewer 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1289 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __decorateClass = (decorators, target, key, kind) => {
6
+ var result = void 0 ;
7
+ for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8
+ if (decorator = decorators[i4])
9
+ result = (decorator(target, key, result) ) || result;
10
+ if (result) __defProp(target, key, result);
11
+ return result;
12
+ };
13
+
14
+ // node_modules/@lit/reactive-element/css-tag.js
15
+ var t = globalThis;
16
+ var e = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
17
+ var s = Symbol();
18
+ var o = /* @__PURE__ */ new WeakMap();
19
+ var n = class {
20
+ constructor(t3, e6, o4) {
21
+ if (this._$cssResult$ = true, o4 !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
22
+ this.cssText = t3, this.t = e6;
23
+ }
24
+ get styleSheet() {
25
+ let t3 = this.o;
26
+ const s2 = this.t;
27
+ if (e && void 0 === t3) {
28
+ const e6 = void 0 !== s2 && 1 === s2.length;
29
+ e6 && (t3 = o.get(s2)), void 0 === t3 && ((this.o = t3 = new CSSStyleSheet()).replaceSync(this.cssText), e6 && o.set(s2, t3));
30
+ }
31
+ return t3;
32
+ }
33
+ toString() {
34
+ return this.cssText;
35
+ }
36
+ };
37
+ var r = (t3) => new n("string" == typeof t3 ? t3 : t3 + "", void 0, s);
38
+ var i = (t3, ...e6) => {
39
+ const o4 = 1 === t3.length ? t3[0] : e6.reduce((e7, s2, o5) => e7 + ((t4) => {
40
+ if (true === t4._$cssResult$) return t4.cssText;
41
+ if ("number" == typeof t4) return t4;
42
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t4 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
43
+ })(s2) + t3[o5 + 1], t3[0]);
44
+ return new n(o4, t3, s);
45
+ };
46
+ var S = (s2, o4) => {
47
+ if (e) s2.adoptedStyleSheets = o4.map((t3) => t3 instanceof CSSStyleSheet ? t3 : t3.styleSheet);
48
+ else for (const e6 of o4) {
49
+ const o5 = document.createElement("style"), n5 = t.litNonce;
50
+ void 0 !== n5 && o5.setAttribute("nonce", n5), o5.textContent = e6.cssText, s2.appendChild(o5);
51
+ }
52
+ };
53
+ var c = e ? (t3) => t3 : (t3) => t3 instanceof CSSStyleSheet ? ((t4) => {
54
+ let e6 = "";
55
+ for (const s2 of t4.cssRules) e6 += s2.cssText;
56
+ return r(e6);
57
+ })(t3) : t3;
58
+
59
+ // node_modules/@lit/reactive-element/reactive-element.js
60
+ var { is: i2, defineProperty: e2, getOwnPropertyDescriptor: r2, getOwnPropertyNames: h, getOwnPropertySymbols: o2, getPrototypeOf: n2 } = Object;
61
+ var a = globalThis;
62
+ var c2 = a.trustedTypes;
63
+ var l = c2 ? c2.emptyScript : "";
64
+ var p = a.reactiveElementPolyfillSupport;
65
+ var d = (t3, s2) => t3;
66
+ var u = { toAttribute(t3, s2) {
67
+ switch (s2) {
68
+ case Boolean:
69
+ t3 = t3 ? l : null;
70
+ break;
71
+ case Object:
72
+ case Array:
73
+ t3 = null == t3 ? t3 : JSON.stringify(t3);
74
+ }
75
+ return t3;
76
+ }, fromAttribute(t3, s2) {
77
+ let i4 = t3;
78
+ switch (s2) {
79
+ case Boolean:
80
+ i4 = null !== t3;
81
+ break;
82
+ case Number:
83
+ i4 = null === t3 ? null : Number(t3);
84
+ break;
85
+ case Object:
86
+ case Array:
87
+ try {
88
+ i4 = JSON.parse(t3);
89
+ } catch (t4) {
90
+ i4 = null;
91
+ }
92
+ }
93
+ return i4;
94
+ } };
95
+ var f = (t3, s2) => !i2(t3, s2);
96
+ var y = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
97
+ Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
98
+ var b = class extends HTMLElement {
99
+ static addInitializer(t3) {
100
+ this._$Ei(), (this.l ??= []).push(t3);
101
+ }
102
+ static get observedAttributes() {
103
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
104
+ }
105
+ static createProperty(t3, s2 = y) {
106
+ if (s2.state && (s2.attribute = false), this._$Ei(), this.elementProperties.set(t3, s2), !s2.noAccessor) {
107
+ const i4 = Symbol(), r6 = this.getPropertyDescriptor(t3, i4, s2);
108
+ void 0 !== r6 && e2(this.prototype, t3, r6);
109
+ }
110
+ }
111
+ static getPropertyDescriptor(t3, s2, i4) {
112
+ const { get: e6, set: h4 } = r2(this.prototype, t3) ?? { get() {
113
+ return this[s2];
114
+ }, set(t4) {
115
+ this[s2] = t4;
116
+ } };
117
+ return { get() {
118
+ return e6?.call(this);
119
+ }, set(s3) {
120
+ const r6 = e6?.call(this);
121
+ h4.call(this, s3), this.requestUpdate(t3, r6, i4);
122
+ }, configurable: true, enumerable: true };
123
+ }
124
+ static getPropertyOptions(t3) {
125
+ return this.elementProperties.get(t3) ?? y;
126
+ }
127
+ static _$Ei() {
128
+ if (this.hasOwnProperty(d("elementProperties"))) return;
129
+ const t3 = n2(this);
130
+ t3.finalize(), void 0 !== t3.l && (this.l = [...t3.l]), this.elementProperties = new Map(t3.elementProperties);
131
+ }
132
+ static finalize() {
133
+ if (this.hasOwnProperty(d("finalized"))) return;
134
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
135
+ const t4 = this.properties, s2 = [...h(t4), ...o2(t4)];
136
+ for (const i4 of s2) this.createProperty(i4, t4[i4]);
137
+ }
138
+ const t3 = this[Symbol.metadata];
139
+ if (null !== t3) {
140
+ const s2 = litPropertyMetadata.get(t3);
141
+ if (void 0 !== s2) for (const [t4, i4] of s2) this.elementProperties.set(t4, i4);
142
+ }
143
+ this._$Eh = /* @__PURE__ */ new Map();
144
+ for (const [t4, s2] of this.elementProperties) {
145
+ const i4 = this._$Eu(t4, s2);
146
+ void 0 !== i4 && this._$Eh.set(i4, t4);
147
+ }
148
+ this.elementStyles = this.finalizeStyles(this.styles);
149
+ }
150
+ static finalizeStyles(s2) {
151
+ const i4 = [];
152
+ if (Array.isArray(s2)) {
153
+ const e6 = new Set(s2.flat(1 / 0).reverse());
154
+ for (const s3 of e6) i4.unshift(c(s3));
155
+ } else void 0 !== s2 && i4.push(c(s2));
156
+ return i4;
157
+ }
158
+ static _$Eu(t3, s2) {
159
+ const i4 = s2.attribute;
160
+ return false === i4 ? void 0 : "string" == typeof i4 ? i4 : "string" == typeof t3 ? t3.toLowerCase() : void 0;
161
+ }
162
+ constructor() {
163
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
164
+ }
165
+ _$Ev() {
166
+ this._$ES = new Promise((t3) => this.enableUpdating = t3), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t3) => t3(this));
167
+ }
168
+ addController(t3) {
169
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t3), void 0 !== this.renderRoot && this.isConnected && t3.hostConnected?.();
170
+ }
171
+ removeController(t3) {
172
+ this._$EO?.delete(t3);
173
+ }
174
+ _$E_() {
175
+ const t3 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
176
+ for (const i4 of s2.keys()) this.hasOwnProperty(i4) && (t3.set(i4, this[i4]), delete this[i4]);
177
+ t3.size > 0 && (this._$Ep = t3);
178
+ }
179
+ createRenderRoot() {
180
+ const t3 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
181
+ return S(t3, this.constructor.elementStyles), t3;
182
+ }
183
+ connectedCallback() {
184
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach((t3) => t3.hostConnected?.());
185
+ }
186
+ enableUpdating(t3) {
187
+ }
188
+ disconnectedCallback() {
189
+ this._$EO?.forEach((t3) => t3.hostDisconnected?.());
190
+ }
191
+ attributeChangedCallback(t3, s2, i4) {
192
+ this._$AK(t3, i4);
193
+ }
194
+ _$EC(t3, s2) {
195
+ const i4 = this.constructor.elementProperties.get(t3), e6 = this.constructor._$Eu(t3, i4);
196
+ if (void 0 !== e6 && true === i4.reflect) {
197
+ const r6 = (void 0 !== i4.converter?.toAttribute ? i4.converter : u).toAttribute(s2, i4.type);
198
+ this._$Em = t3, null == r6 ? this.removeAttribute(e6) : this.setAttribute(e6, r6), this._$Em = null;
199
+ }
200
+ }
201
+ _$AK(t3, s2) {
202
+ const i4 = this.constructor, e6 = i4._$Eh.get(t3);
203
+ if (void 0 !== e6 && this._$Em !== e6) {
204
+ const t4 = i4.getPropertyOptions(e6), r6 = "function" == typeof t4.converter ? { fromAttribute: t4.converter } : void 0 !== t4.converter?.fromAttribute ? t4.converter : u;
205
+ this._$Em = e6, this[e6] = r6.fromAttribute(s2, t4.type), this._$Em = null;
206
+ }
207
+ }
208
+ requestUpdate(t3, s2, i4) {
209
+ if (void 0 !== t3) {
210
+ if (i4 ??= this.constructor.getPropertyOptions(t3), !(i4.hasChanged ?? f)(this[t3], s2)) return;
211
+ this.P(t3, s2, i4);
212
+ }
213
+ false === this.isUpdatePending && (this._$ES = this._$ET());
214
+ }
215
+ P(t3, s2, i4) {
216
+ this._$AL.has(t3) || this._$AL.set(t3, s2), true === i4.reflect && this._$Em !== t3 && (this._$Ej ??= /* @__PURE__ */ new Set()).add(t3);
217
+ }
218
+ async _$ET() {
219
+ this.isUpdatePending = true;
220
+ try {
221
+ await this._$ES;
222
+ } catch (t4) {
223
+ Promise.reject(t4);
224
+ }
225
+ const t3 = this.scheduleUpdate();
226
+ return null != t3 && await t3, !this.isUpdatePending;
227
+ }
228
+ scheduleUpdate() {
229
+ return this.performUpdate();
230
+ }
231
+ performUpdate() {
232
+ if (!this.isUpdatePending) return;
233
+ if (!this.hasUpdated) {
234
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
235
+ for (const [t5, s3] of this._$Ep) this[t5] = s3;
236
+ this._$Ep = void 0;
237
+ }
238
+ const t4 = this.constructor.elementProperties;
239
+ if (t4.size > 0) for (const [s3, i4] of t4) true !== i4.wrapped || this._$AL.has(s3) || void 0 === this[s3] || this.P(s3, this[s3], i4);
240
+ }
241
+ let t3 = false;
242
+ const s2 = this._$AL;
243
+ try {
244
+ t3 = this.shouldUpdate(s2), t3 ? (this.willUpdate(s2), this._$EO?.forEach((t4) => t4.hostUpdate?.()), this.update(s2)) : this._$EU();
245
+ } catch (s3) {
246
+ throw t3 = false, this._$EU(), s3;
247
+ }
248
+ t3 && this._$AE(s2);
249
+ }
250
+ willUpdate(t3) {
251
+ }
252
+ _$AE(t3) {
253
+ this._$EO?.forEach((t4) => t4.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t3)), this.updated(t3);
254
+ }
255
+ _$EU() {
256
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
257
+ }
258
+ get updateComplete() {
259
+ return this.getUpdateComplete();
260
+ }
261
+ getUpdateComplete() {
262
+ return this._$ES;
263
+ }
264
+ shouldUpdate(t3) {
265
+ return true;
266
+ }
267
+ update(t3) {
268
+ this._$Ej &&= this._$Ej.forEach((t4) => this._$EC(t4, this[t4])), this._$EU();
269
+ }
270
+ updated(t3) {
271
+ }
272
+ firstUpdated(t3) {
273
+ }
274
+ };
275
+ b.elementStyles = [], b.shadowRootOptions = { mode: "open" }, b[d("elementProperties")] = /* @__PURE__ */ new Map(), b[d("finalized")] = /* @__PURE__ */ new Map(), p?.({ ReactiveElement: b }), (a.reactiveElementVersions ??= []).push("2.0.4");
276
+
277
+ // node_modules/lit-html/lit-html.js
278
+ var n3 = globalThis;
279
+ var c3 = n3.trustedTypes;
280
+ var h2 = c3 ? c3.createPolicy("lit-html", { createHTML: (t3) => t3 }) : void 0;
281
+ var f2 = "$lit$";
282
+ var v = `lit$${Math.random().toFixed(9).slice(2)}$`;
283
+ var m = "?" + v;
284
+ var _ = `<${m}>`;
285
+ var w = document;
286
+ var lt = () => w.createComment("");
287
+ var st = (t3) => null === t3 || "object" != typeof t3 && "function" != typeof t3;
288
+ var g = Array.isArray;
289
+ var $ = (t3) => g(t3) || "function" == typeof t3?.[Symbol.iterator];
290
+ var x = "[ \n\f\r]";
291
+ var T = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
292
+ var E = /-->/g;
293
+ var k = />/g;
294
+ var O = RegExp(`>|${x}(?:([^\\s"'>=/]+)(${x}*=${x}*(?:[^
295
+ \f\r"'\`<>=]|("|')|))|$)`, "g");
296
+ var S2 = /'/g;
297
+ var j = /"/g;
298
+ var M = /^(?:script|style|textarea|title)$/i;
299
+ var P = (t3) => (i4, ...s2) => ({ _$litType$: t3, strings: i4, values: s2 });
300
+ var ke = P(1);
301
+ var R = Symbol.for("lit-noChange");
302
+ var D = Symbol.for("lit-nothing");
303
+ var V = /* @__PURE__ */ new WeakMap();
304
+ var I = w.createTreeWalker(w, 129);
305
+ function N(t3, i4) {
306
+ if (!g(t3) || !t3.hasOwnProperty("raw")) throw Error("invalid template strings array");
307
+ return void 0 !== h2 ? h2.createHTML(i4) : i4;
308
+ }
309
+ var U = (t3, i4) => {
310
+ const s2 = t3.length - 1, e6 = [];
311
+ let h4, o4 = 2 === i4 ? "<svg>" : 3 === i4 ? "<math>" : "", n5 = T;
312
+ for (let i5 = 0; i5 < s2; i5++) {
313
+ const s3 = t3[i5];
314
+ let r6, l2, c4 = -1, a2 = 0;
315
+ for (; a2 < s3.length && (n5.lastIndex = a2, l2 = n5.exec(s3), null !== l2); ) a2 = n5.lastIndex, n5 === T ? "!--" === l2[1] ? n5 = E : void 0 !== l2[1] ? n5 = k : void 0 !== l2[2] ? (M.test(l2[2]) && (h4 = RegExp("</" + l2[2], "g")), n5 = O) : void 0 !== l2[3] && (n5 = O) : n5 === O ? ">" === l2[0] ? (n5 = h4 ?? T, c4 = -1) : void 0 === l2[1] ? c4 = -2 : (c4 = n5.lastIndex - l2[2].length, r6 = l2[1], n5 = void 0 === l2[3] ? O : '"' === l2[3] ? j : S2) : n5 === j || n5 === S2 ? n5 = O : n5 === E || n5 === k ? n5 = T : (n5 = O, h4 = void 0);
316
+ const u2 = n5 === O && t3[i5 + 1].startsWith("/>") ? " " : "";
317
+ o4 += n5 === T ? s3 + _ : c4 >= 0 ? (e6.push(r6), s3.slice(0, c4) + f2 + s3.slice(c4) + v + u2) : s3 + v + (-2 === c4 ? i5 : u2);
318
+ }
319
+ return [N(t3, o4 + (t3[s2] || "<?>") + (2 === i4 ? "</svg>" : 3 === i4 ? "</math>" : "")), e6];
320
+ };
321
+ var B = class _B {
322
+ constructor({ strings: t3, _$litType$: i4 }, s2) {
323
+ let e6;
324
+ this.parts = [];
325
+ let h4 = 0, o4 = 0;
326
+ const n5 = t3.length - 1, r6 = this.parts, [l2, a2] = U(t3, i4);
327
+ if (this.el = _B.createElement(l2, s2), I.currentNode = this.el.content, 2 === i4 || 3 === i4) {
328
+ const t4 = this.el.content.firstChild;
329
+ t4.replaceWith(...t4.childNodes);
330
+ }
331
+ for (; null !== (e6 = I.nextNode()) && r6.length < n5; ) {
332
+ if (1 === e6.nodeType) {
333
+ if (e6.hasAttributes()) for (const t4 of e6.getAttributeNames()) if (t4.endsWith(f2)) {
334
+ const i5 = a2[o4++], s3 = e6.getAttribute(t4).split(v), n6 = /([.?@])?(.*)/.exec(i5);
335
+ r6.push({ type: 1, index: h4, name: n6[2], strings: s3, ctor: "." === n6[1] ? Y : "?" === n6[1] ? Z : "@" === n6[1] ? q : G }), e6.removeAttribute(t4);
336
+ } else t4.startsWith(v) && (r6.push({ type: 6, index: h4 }), e6.removeAttribute(t4));
337
+ if (M.test(e6.tagName)) {
338
+ const t4 = e6.textContent.split(v), i5 = t4.length - 1;
339
+ if (i5 > 0) {
340
+ e6.textContent = c3 ? c3.emptyScript : "";
341
+ for (let s3 = 0; s3 < i5; s3++) e6.append(t4[s3], lt()), I.nextNode(), r6.push({ type: 2, index: ++h4 });
342
+ e6.append(t4[i5], lt());
343
+ }
344
+ }
345
+ } else if (8 === e6.nodeType) if (e6.data === m) r6.push({ type: 2, index: h4 });
346
+ else {
347
+ let t4 = -1;
348
+ for (; -1 !== (t4 = e6.data.indexOf(v, t4 + 1)); ) r6.push({ type: 7, index: h4 }), t4 += v.length - 1;
349
+ }
350
+ h4++;
351
+ }
352
+ }
353
+ static createElement(t3, i4) {
354
+ const s2 = w.createElement("template");
355
+ return s2.innerHTML = t3, s2;
356
+ }
357
+ };
358
+ function z(t3, i4, s2 = t3, e6) {
359
+ if (i4 === R) return i4;
360
+ let h4 = void 0 !== e6 ? s2.o?.[e6] : s2.l;
361
+ const o4 = st(i4) ? void 0 : i4._$litDirective$;
362
+ return h4?.constructor !== o4 && (h4?._$AO?.(false), void 0 === o4 ? h4 = void 0 : (h4 = new o4(t3), h4._$AT(t3, s2, e6)), void 0 !== e6 ? (s2.o ??= [])[e6] = h4 : s2.l = h4), void 0 !== h4 && (i4 = z(t3, h4._$AS(t3, i4.values), h4, e6)), i4;
363
+ }
364
+ var F = class {
365
+ constructor(t3, i4) {
366
+ this._$AV = [], this._$AN = void 0, this._$AD = t3, this._$AM = i4;
367
+ }
368
+ get parentNode() {
369
+ return this._$AM.parentNode;
370
+ }
371
+ get _$AU() {
372
+ return this._$AM._$AU;
373
+ }
374
+ u(t3) {
375
+ const { el: { content: i4 }, parts: s2 } = this._$AD, e6 = (t3?.creationScope ?? w).importNode(i4, true);
376
+ I.currentNode = e6;
377
+ let h4 = I.nextNode(), o4 = 0, n5 = 0, r6 = s2[0];
378
+ for (; void 0 !== r6; ) {
379
+ if (o4 === r6.index) {
380
+ let i5;
381
+ 2 === r6.type ? i5 = new et(h4, h4.nextSibling, this, t3) : 1 === r6.type ? i5 = new r6.ctor(h4, r6.name, r6.strings, this, t3) : 6 === r6.type && (i5 = new K(h4, this, t3)), this._$AV.push(i5), r6 = s2[++n5];
382
+ }
383
+ o4 !== r6?.index && (h4 = I.nextNode(), o4++);
384
+ }
385
+ return I.currentNode = w, e6;
386
+ }
387
+ p(t3) {
388
+ let i4 = 0;
389
+ for (const s2 of this._$AV) void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t3, s2, i4), i4 += s2.strings.length - 2) : s2._$AI(t3[i4])), i4++;
390
+ }
391
+ };
392
+ var et = class _et {
393
+ get _$AU() {
394
+ return this._$AM?._$AU ?? this.v;
395
+ }
396
+ constructor(t3, i4, s2, e6) {
397
+ this.type = 2, this._$AH = D, this._$AN = void 0, this._$AA = t3, this._$AB = i4, this._$AM = s2, this.options = e6, this.v = e6?.isConnected ?? true;
398
+ }
399
+ get parentNode() {
400
+ let t3 = this._$AA.parentNode;
401
+ const i4 = this._$AM;
402
+ return void 0 !== i4 && 11 === t3?.nodeType && (t3 = i4.parentNode), t3;
403
+ }
404
+ get startNode() {
405
+ return this._$AA;
406
+ }
407
+ get endNode() {
408
+ return this._$AB;
409
+ }
410
+ _$AI(t3, i4 = this) {
411
+ t3 = z(this, t3, i4), st(t3) ? t3 === D || null == t3 || "" === t3 ? (this._$AH !== D && this._$AR(), this._$AH = D) : t3 !== this._$AH && t3 !== R && this._(t3) : void 0 !== t3._$litType$ ? this.$(t3) : void 0 !== t3.nodeType ? this.T(t3) : $(t3) ? this.k(t3) : this._(t3);
412
+ }
413
+ O(t3) {
414
+ return this._$AA.parentNode.insertBefore(t3, this._$AB);
415
+ }
416
+ T(t3) {
417
+ this._$AH !== t3 && (this._$AR(), this._$AH = this.O(t3));
418
+ }
419
+ _(t3) {
420
+ this._$AH !== D && st(this._$AH) ? this._$AA.nextSibling.data = t3 : this.T(w.createTextNode(t3)), this._$AH = t3;
421
+ }
422
+ $(t3) {
423
+ const { values: i4, _$litType$: s2 } = t3, e6 = "number" == typeof s2 ? this._$AC(t3) : (void 0 === s2.el && (s2.el = B.createElement(N(s2.h, s2.h[0]), this.options)), s2);
424
+ if (this._$AH?._$AD === e6) this._$AH.p(i4);
425
+ else {
426
+ const t4 = new F(e6, this), s3 = t4.u(this.options);
427
+ t4.p(i4), this.T(s3), this._$AH = t4;
428
+ }
429
+ }
430
+ _$AC(t3) {
431
+ let i4 = V.get(t3.strings);
432
+ return void 0 === i4 && V.set(t3.strings, i4 = new B(t3)), i4;
433
+ }
434
+ k(t3) {
435
+ g(this._$AH) || (this._$AH = [], this._$AR());
436
+ const i4 = this._$AH;
437
+ let s2, e6 = 0;
438
+ for (const h4 of t3) e6 === i4.length ? i4.push(s2 = new _et(this.O(lt()), this.O(lt()), this, this.options)) : s2 = i4[e6], s2._$AI(h4), e6++;
439
+ e6 < i4.length && (this._$AR(s2 && s2._$AB.nextSibling, e6), i4.length = e6);
440
+ }
441
+ _$AR(t3 = this._$AA.nextSibling, i4) {
442
+ for (this._$AP?.(false, true, i4); t3 && t3 !== this._$AB; ) {
443
+ const i5 = t3.nextSibling;
444
+ t3.remove(), t3 = i5;
445
+ }
446
+ }
447
+ setConnected(t3) {
448
+ void 0 === this._$AM && (this.v = t3, this._$AP?.(t3));
449
+ }
450
+ };
451
+ var G = class {
452
+ get tagName() {
453
+ return this.element.tagName;
454
+ }
455
+ get _$AU() {
456
+ return this._$AM._$AU;
457
+ }
458
+ constructor(t3, i4, s2, e6, h4) {
459
+ this.type = 1, this._$AH = D, this._$AN = void 0, this.element = t3, this.name = i4, this._$AM = e6, this.options = h4, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = D;
460
+ }
461
+ _$AI(t3, i4 = this, s2, e6) {
462
+ const h4 = this.strings;
463
+ let o4 = false;
464
+ if (void 0 === h4) t3 = z(this, t3, i4, 0), o4 = !st(t3) || t3 !== this._$AH && t3 !== R, o4 && (this._$AH = t3);
465
+ else {
466
+ const e7 = t3;
467
+ let n5, r6;
468
+ for (t3 = h4[0], n5 = 0; n5 < h4.length - 1; n5++) r6 = z(this, e7[s2 + n5], i4, n5), r6 === R && (r6 = this._$AH[n5]), o4 ||= !st(r6) || r6 !== this._$AH[n5], r6 === D ? t3 = D : t3 !== D && (t3 += (r6 ?? "") + h4[n5 + 1]), this._$AH[n5] = r6;
469
+ }
470
+ o4 && !e6 && this.j(t3);
471
+ }
472
+ j(t3) {
473
+ t3 === D ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t3 ?? "");
474
+ }
475
+ };
476
+ var Y = class extends G {
477
+ constructor() {
478
+ super(...arguments), this.type = 3;
479
+ }
480
+ j(t3) {
481
+ this.element[this.name] = t3 === D ? void 0 : t3;
482
+ }
483
+ };
484
+ var Z = class extends G {
485
+ constructor() {
486
+ super(...arguments), this.type = 4;
487
+ }
488
+ j(t3) {
489
+ this.element.toggleAttribute(this.name, !!t3 && t3 !== D);
490
+ }
491
+ };
492
+ var q = class extends G {
493
+ constructor(t3, i4, s2, e6, h4) {
494
+ super(t3, i4, s2, e6, h4), this.type = 5;
495
+ }
496
+ _$AI(t3, i4 = this) {
497
+ if ((t3 = z(this, t3, i4, 0) ?? D) === R) return;
498
+ const s2 = this._$AH, e6 = t3 === D && s2 !== D || t3.capture !== s2.capture || t3.once !== s2.once || t3.passive !== s2.passive, h4 = t3 !== D && (s2 === D || e6);
499
+ e6 && this.element.removeEventListener(this.name, this, s2), h4 && this.element.addEventListener(this.name, this, t3), this._$AH = t3;
500
+ }
501
+ handleEvent(t3) {
502
+ "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t3) : this._$AH.handleEvent(t3);
503
+ }
504
+ };
505
+ var K = class {
506
+ constructor(t3, i4, s2) {
507
+ this.element = t3, this.type = 6, this._$AN = void 0, this._$AM = i4, this.options = s2;
508
+ }
509
+ get _$AU() {
510
+ return this._$AM._$AU;
511
+ }
512
+ _$AI(t3) {
513
+ z(this, t3);
514
+ }
515
+ };
516
+ var Re = n3.litHtmlPolyfillSupport;
517
+ Re?.(B, et), (n3.litHtmlVersions ??= []).push("3.2.0");
518
+ var Q = (t3, i4, s2) => {
519
+ const e6 = s2?.renderBefore ?? i4;
520
+ let h4 = e6._$litPart$;
521
+ if (void 0 === h4) {
522
+ const t4 = s2?.renderBefore ?? null;
523
+ e6._$litPart$ = h4 = new et(i4.insertBefore(lt(), t4), t4, void 0, s2 ?? {});
524
+ }
525
+ return h4._$AI(t3), h4;
526
+ };
527
+
528
+ // node_modules/lit-element/lit-element.js
529
+ var h3 = class extends b {
530
+ constructor() {
531
+ super(...arguments), this.renderOptions = { host: this }, this.o = void 0;
532
+ }
533
+ createRenderRoot() {
534
+ const t3 = super.createRenderRoot();
535
+ return this.renderOptions.renderBefore ??= t3.firstChild, t3;
536
+ }
537
+ update(t3) {
538
+ const e6 = this.render();
539
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t3), this.o = Q(e6, this.renderRoot, this.renderOptions);
540
+ }
541
+ connectedCallback() {
542
+ super.connectedCallback(), this.o?.setConnected(true);
543
+ }
544
+ disconnectedCallback() {
545
+ super.disconnectedCallback(), this.o?.setConnected(false);
546
+ }
547
+ render() {
548
+ return R;
549
+ }
550
+ };
551
+ h3._$litElement$ = true, h3["finalized"] = true, globalThis.litElementHydrateSupport?.({ LitElement: h3 });
552
+ var f3 = globalThis.litElementPolyfillSupport;
553
+ f3?.({ LitElement: h3 });
554
+ (globalThis.litElementVersions ??= []).push("4.1.0");
555
+
556
+ // node_modules/@lit/reactive-element/decorators/property.js
557
+ var o3 = { attribute: true, type: String, converter: u, reflect: false, hasChanged: f };
558
+ var r3 = (t3 = o3, e6, r6) => {
559
+ const { kind: n5, metadata: i4 } = r6;
560
+ let s2 = globalThis.litPropertyMetadata.get(i4);
561
+ if (void 0 === s2 && globalThis.litPropertyMetadata.set(i4, s2 = /* @__PURE__ */ new Map()), s2.set(r6.name, t3), "accessor" === n5) {
562
+ const { name: o4 } = r6;
563
+ return { set(r7) {
564
+ const n6 = e6.get.call(this);
565
+ e6.set.call(this, r7), this.requestUpdate(o4, n6, t3);
566
+ }, init(e7) {
567
+ return void 0 !== e7 && this.P(o4, void 0, t3), e7;
568
+ } };
569
+ }
570
+ if ("setter" === n5) {
571
+ const { name: o4 } = r6;
572
+ return function(r7) {
573
+ const n6 = this[o4];
574
+ e6.call(this, r7), this.requestUpdate(o4, n6, t3);
575
+ };
576
+ }
577
+ throw Error("Unsupported decorator location: " + n5);
578
+ };
579
+ function n4(t3) {
580
+ return (e6, o4) => "object" == typeof o4 ? r3(t3, e6, o4) : ((t4, e7, o5) => {
581
+ const r6 = e7.hasOwnProperty(o5);
582
+ return e7.constructor.createProperty(o5, r6 ? { ...t4, wrapped: true } : t4), r6 ? Object.getOwnPropertyDescriptor(e7, o5) : void 0;
583
+ })(t3, e6, o4);
584
+ }
585
+
586
+ // node_modules/@lit/reactive-element/decorators/state.js
587
+ function r4(r6) {
588
+ return n4({ ...r6, state: true, attribute: false });
589
+ }
590
+
591
+ // node_modules/@lit/reactive-element/decorators/base.js
592
+ var e3 = (e6, t3, c4) => (c4.configurable = true, c4.enumerable = true, Reflect.decorate && "object" != typeof t3 && Object.defineProperty(e6, t3, c4), c4);
593
+
594
+ // node_modules/@lit/reactive-element/decorators/query-all.js
595
+ var e4;
596
+ function r5(r6) {
597
+ return (n5, o4) => e3(n5, o4, { get() {
598
+ return (this.renderRoot ?? (e4 ??= document.createDocumentFragment())).querySelectorAll(r6);
599
+ } });
600
+ }
601
+
602
+ // node_modules/lit-html/directive.js
603
+ var t2 = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 };
604
+ var e5 = (t3) => (...e6) => ({ _$litDirective$: t3, values: e6 });
605
+ var i3 = class {
606
+ constructor(t3) {
607
+ }
608
+ get _$AU() {
609
+ return this._$AM._$AU;
610
+ }
611
+ _$AT(t3, e6, i4) {
612
+ this.t = t3, this._$AM = e6, this.i = i4;
613
+ }
614
+ _$AS(t3, e6) {
615
+ return this.update(t3, e6);
616
+ }
617
+ update(t3, e6) {
618
+ return this.render(...e6);
619
+ }
620
+ };
621
+
622
+ // node_modules/lit-html/directives/class-map.js
623
+ var Rt = e5(class extends i3 {
624
+ constructor(s2) {
625
+ if (super(s2), s2.type !== t2.ATTRIBUTE || "class" !== s2.name || s2.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
626
+ }
627
+ render(t3) {
628
+ return " " + Object.keys(t3).filter((s2) => t3[s2]).join(" ") + " ";
629
+ }
630
+ update(t3, [s2]) {
631
+ if (void 0 === this.st) {
632
+ this.st = /* @__PURE__ */ new Set(), void 0 !== t3.strings && (this.nt = new Set(t3.strings.join(" ").split(/\s/).filter((t4) => "" !== t4)));
633
+ for (const t4 in s2) s2[t4] && !this.nt?.has(t4) && this.st.add(t4);
634
+ return this.render(s2);
635
+ }
636
+ const i4 = t3.element.classList;
637
+ for (const t4 of this.st) t4 in s2 || (i4.remove(t4), this.st.delete(t4));
638
+ for (const t4 in s2) {
639
+ const r6 = !!s2[t4];
640
+ r6 === this.st.has(t4) || this.nt?.has(t4) || (r6 ? (i4.add(t4), this.st.add(t4)) : (i4.remove(t4), this.st.delete(t4)));
641
+ }
642
+ return R;
643
+ }
644
+ });
645
+
646
+ // node_modules/lit-html/directives/map.js
647
+ function* oo(o4, f4) {
648
+ if (void 0 !== o4) {
649
+ let i4 = 0;
650
+ for (const t3 of o4) yield f4(t3, i4++);
651
+ }
652
+ }
653
+
654
+ // node_modules/lit-html/directives/when.js
655
+ function nn(n5, r6, t3) {
656
+ return n5 ? r6(n5) : t3?.(n5);
657
+ }
658
+
659
+ // src/utils.ts
660
+ function isRegex(value) {
661
+ return value instanceof RegExp;
662
+ }
663
+ function getType(value) {
664
+ return value === null ? "null" /* Null */ : Array.isArray(value) ? "array" /* Array */ : value.constructor.name.toLowerCase();
665
+ }
666
+ function isPrimitive(value) {
667
+ return value !== Object(value);
668
+ }
669
+ function generateNodePreview(node, { nodeCount = 3, maxLength = 15 } = {}) {
670
+ const isArray = Array.isArray(node);
671
+ const objectNodes = Object.keys(node);
672
+ const keys = objectNodes.slice(0, nodeCount);
673
+ const preview = [];
674
+ const getNodePreview = (nodeValue) => {
675
+ const nodeType = getType(nodeValue);
676
+ switch (nodeType) {
677
+ case "object" /* Object */:
678
+ return Object.keys(nodeValue).length === 0 ? "{ }" : "{ ... }";
679
+ case "array" /* Array */:
680
+ return nodeValue.length === 0 ? "[ ]" : "[ ... ]";
681
+ case "string" /* String */:
682
+ return `"${nodeValue.substring(0, maxLength)}${nodeValue.length > maxLength ? "..." : ""}"`;
683
+ default:
684
+ return String(nodeValue);
685
+ }
686
+ };
687
+ const childPreviews = [];
688
+ for (const key of keys) {
689
+ const nodePreview = [];
690
+ const nodeValue = node[key];
691
+ if (!isArray) nodePreview.push(`${key}: `);
692
+ nodePreview.push(getNodePreview(nodeValue));
693
+ childPreviews.push(nodePreview.join(""));
694
+ }
695
+ if (objectNodes.length > nodeCount) {
696
+ childPreviews.push("...");
697
+ }
698
+ preview.push(childPreviews.join(", "));
699
+ const previewText = preview.join("");
700
+ return isArray ? `[ ${previewText} ]` : `{ ${previewText} }`;
701
+ }
702
+ function* deepTraverse(obj) {
703
+ const stack = [[obj, "", []]];
704
+ while (stack.length) {
705
+ const [node, path, parents] = stack.shift();
706
+ if (path) {
707
+ yield [node, path, parents];
708
+ }
709
+ if (!isPrimitive(node)) {
710
+ for (const [key, value] of Object.entries(node)) {
711
+ stack.push([value, `${path}${path ? "." : ""}${key}`, [...parents, path]]);
712
+ }
713
+ }
714
+ }
715
+ }
716
+ function checkGlob(str, glob) {
717
+ const strParts = str.split(".");
718
+ const globaParts = glob.split(".");
719
+ const isStar = (s2) => s2 === "*";
720
+ const isGlobStar = (s2) => s2 === "**";
721
+ let strIndex = 0;
722
+ let globIndex = 0;
723
+ while (strIndex < strParts.length) {
724
+ const globPart = globaParts[globIndex];
725
+ const strPart = strParts[strIndex];
726
+ if (globPart === strPart || isStar(globPart)) {
727
+ globIndex++;
728
+ strIndex++;
729
+ } else if (isGlobStar(globPart)) {
730
+ globIndex++;
731
+ strIndex = strParts.length - (globaParts.length - globIndex);
732
+ } else {
733
+ return false;
734
+ }
735
+ }
736
+ return globIndex === globaParts.length;
737
+ }
738
+ var JSONConverter = {
739
+ fromAttribute: (value) => {
740
+ return value && value.trim() ? JSON.parse(value) : void 0;
741
+ },
742
+ toAttribute: (value) => {
743
+ return JSON.stringify(value);
744
+ }
745
+ };
746
+ var isDefined = (value) => value !== void 0;
747
+ var isMatchingPath = (path, criteria) => isRegex(criteria) ? !!path.match(criteria) : checkGlob(path, criteria);
748
+ var getValueByPath = (json, path) => path.split(".").reduce((acc, key) => acc[key], json);
749
+
750
+ // src/stateChange.ts
751
+ var toggleNode = (path, expanded) => (state) => ({
752
+ expanded: {
753
+ ...state.expanded,
754
+ [path]: isDefined(expanded) ? !!expanded : !state.expanded[path]
755
+ }
756
+ });
757
+ var expand = (regexOrGlob, isExpanded) => (_state, el) => {
758
+ const expanded = {};
759
+ if (regexOrGlob) {
760
+ for (const [, path, parents] of deepTraverse(el.data)) {
761
+ if (isMatchingPath(path, regexOrGlob)) {
762
+ expanded[path] = isExpanded;
763
+ parents.forEach((p2) => expanded[p2] = isExpanded);
764
+ }
765
+ }
766
+ }
767
+ return { expanded };
768
+ };
769
+ var filter = (regexOrGlob) => (_state, el) => {
770
+ const filtered = {};
771
+ if (regexOrGlob) {
772
+ for (const [, path, parents] of deepTraverse(el.data)) {
773
+ if (isMatchingPath(path, regexOrGlob)) {
774
+ filtered[path] = false;
775
+ parents.forEach((p2) => filtered[p2] = false);
776
+ } else {
777
+ filtered[path] = true;
778
+ }
779
+ }
780
+ }
781
+ return { filtered };
782
+ };
783
+ var resetFilter = () => () => ({ filtered: {} });
784
+ var highlight = (path) => () => ({
785
+ highlight: path
786
+ });
787
+
788
+ // src/JsonViewer.styles.ts
789
+ var JsonViewer_styles_default = i`
790
+ :where(:host) {
791
+ --background-color: #2a2f3a;
792
+ --color: #f8f8f2;
793
+ --string-color: #a3eea0;
794
+ --number-color: #d19a66;
795
+ --boolean-color: #4ba7ef;
796
+ --null-color: #df9cf3;
797
+ --property-color: #6fb3d2;
798
+ --preview-color: rgba(222, 175, 143, 0.9);
799
+ --highlight-color: #c92a2a;
800
+ --outline-color: #e0e4e5;
801
+ --outline-width: 1px;
802
+ --outline-style: dotted;
803
+
804
+ --font-family: Nimbus Mono PS, Courier New, monospace;
805
+ --font-size: 1rem;
806
+ --line-height: 1.2rem;
807
+
808
+ --indent-size: 0.5rem;
809
+ --indentguide-size: 1px;
810
+ --indentguide-style: solid;
811
+ --indentguide-color: #495057;
812
+ --indentguide-color-active: #ced4da;
813
+ --indentguide: var(--indentguide-size) var(--indentguide-style) var(--indentguide-color);
814
+ --indentguide-active: var(--indentguide-size) var(--indentguide-style) var(--indentguide-color-active);
815
+ }
816
+
817
+ :host {
818
+ display: block;
819
+ background-color: var(--background-color);
820
+ color: var(--color);
821
+ font-family: var(--font-family);
822
+ font-size: var(--font-size);
823
+ line-height: var(--line-height);
824
+ }
825
+
826
+ :focus {
827
+ outline-color: var(--outline-color);
828
+ outline-width: var(--outline-width);
829
+ outline-style: var(--outline-style);
830
+ }
831
+
832
+ .preview {
833
+ color: var(--preview-color);
834
+ }
835
+
836
+ .null {
837
+ color: var(--null-color);
838
+ }
839
+
840
+ .key {
841
+ color: var(--property-color);
842
+ display: inline-flex;
843
+ align-items: flex-start;
844
+ padding-left: var(--line-height);
845
+ }
846
+
847
+ .collapsable::before {
848
+ display: inline-flex;
849
+ font-size: 0.8em;
850
+ content: '▶';
851
+ width: var(--line-height);
852
+ height: var(--line-height);
853
+ align-items: center;
854
+ justify-content: center;
855
+
856
+ transition: transform 195ms ease-out;
857
+ transform: rotate(90deg);
858
+
859
+ color: inherit;
860
+ }
861
+
862
+ .collapsable {
863
+ cursor: pointer;
864
+ user-select: none;
865
+ padding-left: 0;
866
+ }
867
+
868
+ .collapsable--collapsed::before {
869
+ transform: rotate(0);
870
+ }
871
+
872
+ .string {
873
+ color: var(--string-color);
874
+ }
875
+
876
+ .number {
877
+ color: var(--number-color);
878
+ }
879
+
880
+ .boolean {
881
+ color: var(--boolean-color);
882
+ }
883
+
884
+ ul {
885
+ padding: 0;
886
+ clear: both;
887
+ }
888
+
889
+ ul,
890
+ li {
891
+ list-style: none;
892
+ position: relative;
893
+ }
894
+
895
+ li ul > li {
896
+ position: relative;
897
+ margin-left: calc(var(--indent-size) + var(--line-height));
898
+ padding-left: 0px;
899
+ }
900
+
901
+ ul ul::before {
902
+ content: '';
903
+ border-left: var(--indentguide);
904
+ position: absolute;
905
+ left: calc(var(--line-height) / 2 - var(--indentguide-size));
906
+ top: 0.2rem;
907
+ bottom: 0.2rem;
908
+ }
909
+
910
+ ul ul:hover::before {
911
+ border-left: var(--indentguide-active);
912
+ }
913
+
914
+ mark {
915
+ background-color: var(--highlight-color);
916
+ }
917
+ `;
918
+
919
+ // src/JsonViewer.ts
920
+ var JsonViewer = class extends h3 {
921
+ constructor() {
922
+ super();
923
+ this.state = {
924
+ expanded: {},
925
+ filtered: {},
926
+ highlight: null
927
+ };
928
+ this.lastFocusedItem = null;
929
+ this.#handlePropertyClick = (path) => (e6) => {
930
+ e6.preventDefault();
931
+ this.setState(toggleNode(path));
932
+ };
933
+ this.#handleFocusIn = (event) => {
934
+ const target = event.target;
935
+ if (event.target === this) {
936
+ this.#focusItem(this.lastFocusedItem || this.nodeElements[0]);
937
+ }
938
+ if (target.matches('[role="treeitem"]')) {
939
+ if (this.lastFocusedItem) {
940
+ this.lastFocusedItem.tabIndex = -1;
941
+ }
942
+ this.lastFocusedItem = target;
943
+ this.tabIndex = -1;
944
+ target.tabIndex = 0;
945
+ }
946
+ };
947
+ this.#handleFocusOut = (event) => {
948
+ const relatedTarget = event.relatedTarget;
949
+ if (!relatedTarget || !this.contains(relatedTarget)) {
950
+ this.tabIndex = 0;
951
+ }
952
+ };
953
+ this.addEventListener("focusin", this.#handleFocusIn);
954
+ this.addEventListener("focusout", this.#handleFocusOut);
955
+ }
956
+ static {
957
+ this.styles = [JsonViewer_styles_default];
958
+ }
959
+ static customRenderer(value, _path) {
960
+ return JSON.stringify(value);
961
+ }
962
+ async setState(stateFn) {
963
+ const currentState = this.state;
964
+ this.state = {
965
+ ...currentState,
966
+ ...stateFn(currentState, this)
967
+ };
968
+ }
969
+ connectedCallback() {
970
+ if (!this.hasAttribute("data") && !isDefined(this.data)) {
971
+ this.setAttribute("data", this.innerText);
972
+ }
973
+ this.setAttribute("role", "node");
974
+ this.setAttribute("tabindex", "0");
975
+ super.connectedCallback();
976
+ }
977
+ #handlePropertyClick;
978
+ #handleFocusIn;
979
+ #handleFocusOut;
980
+ #handleKeyDown(event) {
981
+ if (!["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft", "Home", "End"].includes(event.key)) {
982
+ return;
983
+ }
984
+ const nodes = [...this.nodeElements];
985
+ const isLtr = this.matches(":dir(ltr)");
986
+ const isRtl = this.matches(":dir(rtl)");
987
+ if (nodes.length > 0) {
988
+ event.preventDefault();
989
+ const activeItemIndex = nodes.findIndex((item) => item.matches(":focus"));
990
+ const activeItem = nodes[activeItemIndex];
991
+ const isExpanded = this.state.expanded[activeItem.dataset.path];
992
+ const isLeaf = isPrimitive(getValueByPath(this.data, activeItem.dataset.path));
993
+ const focusItemAt = (index) => {
994
+ const item = nodes[Math.max(Math.min(index, nodes.length - 1), 0)];
995
+ this.#focusItem(item);
996
+ };
997
+ const toggleExpand = (expanded) => {
998
+ this.setState(toggleNode(activeItem.dataset.path, expanded));
999
+ };
1000
+ if (event.key === "ArrowDown") {
1001
+ focusItemAt(activeItemIndex + 1);
1002
+ } else if (event.key === "ArrowUp") {
1003
+ focusItemAt(activeItemIndex - 1);
1004
+ } else if (isLtr && event.key === "ArrowRight" || isRtl && event.key === "ArrowLeft") {
1005
+ if (!activeItem || isExpanded || isLeaf) {
1006
+ focusItemAt(activeItemIndex + 1);
1007
+ } else {
1008
+ toggleExpand(true);
1009
+ }
1010
+ } else if (isLtr && event.key === "ArrowLeft" || isRtl && event.key === "ArrowRight") {
1011
+ if (!activeItem || !isExpanded || isLeaf) {
1012
+ focusItemAt(activeItemIndex - 1);
1013
+ } else {
1014
+ toggleExpand(false);
1015
+ }
1016
+ } else if (event.key === "Home") {
1017
+ focusItemAt(0);
1018
+ } else if (event.key === "End") {
1019
+ focusItemAt(nodes.length - 1);
1020
+ }
1021
+ }
1022
+ }
1023
+ #focusItem(item) {
1024
+ item.focus();
1025
+ }
1026
+ expand(glob) {
1027
+ this.setState(expand(glob, true));
1028
+ }
1029
+ expandAll() {
1030
+ this.setState(expand("**", true));
1031
+ }
1032
+ collapseAll() {
1033
+ this.setState(expand("**", false));
1034
+ }
1035
+ collapse(glob) {
1036
+ this.setState(expand(glob, false));
1037
+ }
1038
+ *search(criteria) {
1039
+ for (const [node, path] of deepTraverse(this.data)) {
1040
+ if (isPrimitive(node) && String(node).match(criteria)) {
1041
+ this.expand(path);
1042
+ this.updateComplete.then(() => {
1043
+ const node2 = this.shadowRoot.querySelector(`[data-path="${path}"]`);
1044
+ node2.scrollIntoView({
1045
+ behavior: "smooth",
1046
+ inline: "center",
1047
+ block: "center"
1048
+ });
1049
+ node2.focus();
1050
+ });
1051
+ this.setState(highlight(path));
1052
+ yield {
1053
+ value: node,
1054
+ path
1055
+ };
1056
+ }
1057
+ }
1058
+ this.setState(highlight(null));
1059
+ }
1060
+ filter(criteria) {
1061
+ this.setState(filter(criteria));
1062
+ }
1063
+ resetFilter() {
1064
+ this.setState(resetFilter());
1065
+ }
1066
+ renderObject(node, path) {
1067
+ return ke`
1068
+ <ul part="object" role="group">
1069
+ ${oo(Object.entries(node), ([key, nodeData]) => {
1070
+ const nodePath = path ? `${path}.${key}` : key;
1071
+ const isPrimitiveNode = isPrimitive(nodeData);
1072
+ const isExpanded = this.state.expanded[nodePath];
1073
+ const isFiltered = this.state.filtered[nodePath];
1074
+ return isFiltered ? D : ke`
1075
+ <li
1076
+ part="property"
1077
+ role="treeitem"
1078
+ data-path="${nodePath}"
1079
+ aria-expanded="${isExpanded ? "true" : "false"}"
1080
+ tabindex="-1"
1081
+ .hidden="${this.state.filtered[nodePath]}"
1082
+ aria-hidden="${this.state.filtered[nodePath]}"
1083
+ >
1084
+ <span
1085
+ part="key"
1086
+ class="${Rt({
1087
+ key,
1088
+ collapsable: !isPrimitiveNode,
1089
+ ["collapsable--collapsed"]: !this.state.expanded[nodePath]
1090
+ })}"
1091
+ @click="${!isPrimitiveNode ? this.#handlePropertyClick(nodePath) : null}"
1092
+ >
1093
+ ${key}:
1094
+ ${nn(!isPrimitiveNode && !isExpanded, () => this.renderNodePreview(nodeData))}
1095
+ </span>
1096
+
1097
+ ${nn(isPrimitiveNode || isExpanded, () => this.renderValue(nodeData, nodePath))}
1098
+ </li>
1099
+ `;
1100
+ })}
1101
+ </ul>
1102
+ `;
1103
+ }
1104
+ renderValue(value, path = "") {
1105
+ if (isPrimitive(value)) {
1106
+ return this.renderPrimitive(value, path);
1107
+ }
1108
+ return this.renderObject(value, path);
1109
+ }
1110
+ renderNodePreview(node) {
1111
+ return ke`<span part="preview" class="preview"> ${generateNodePreview(node)} </span>`;
1112
+ }
1113
+ renderPrimitive(node, path) {
1114
+ const highlight2 = this.state.highlight;
1115
+ const nodeType = getType(node);
1116
+ const renderedValue = this.constructor.customRenderer(node, path);
1117
+ const primitiveNode = ke`
1118
+ <span part="primitive primitive-${nodeType}" class="${getType(node)}"> ${renderedValue} </span>
1119
+ `;
1120
+ return path === highlight2 ? ke`<mark part="highlight">${primitiveNode}</mark>` : primitiveNode;
1121
+ }
1122
+ render() {
1123
+ const data = this.data;
1124
+ return ke`
1125
+ <div
1126
+ part="base"
1127
+ @keydown=${this.#handleKeyDown}
1128
+ @focusin="${this.#handleFocusIn}"
1129
+ @focusout="${this.#handleFocusOut}"
1130
+ >
1131
+ ${nn(isDefined(data), () => this.renderValue(data))}
1132
+ </div>
1133
+ `;
1134
+ }
1135
+ };
1136
+ __decorateClass([
1137
+ n4({ converter: JSONConverter, type: Object })
1138
+ ], JsonViewer.prototype, "data");
1139
+ __decorateClass([
1140
+ r4()
1141
+ ], JsonViewer.prototype, "state");
1142
+ __decorateClass([
1143
+ r4()
1144
+ ], JsonViewer.prototype, "lastFocusedItem");
1145
+ __decorateClass([
1146
+ r5('[role="treeitem"]')
1147
+ ], JsonViewer.prototype, "nodeElements");
1148
+
1149
+ // src/index.ts
1150
+ customElements.define("json-viewer", JsonViewer);
1151
+ /*! Bundled license information:
1152
+
1153
+ @lit/reactive-element/css-tag.js:
1154
+ (**
1155
+ * @license
1156
+ * Copyright 2019 Google LLC
1157
+ * SPDX-License-Identifier: BSD-3-Clause
1158
+ *)
1159
+
1160
+ @lit/reactive-element/reactive-element.js:
1161
+ (**
1162
+ * @license
1163
+ * Copyright 2017 Google LLC
1164
+ * SPDX-License-Identifier: BSD-3-Clause
1165
+ *)
1166
+
1167
+ lit-html/lit-html.js:
1168
+ (**
1169
+ * @license
1170
+ * Copyright 2017 Google LLC
1171
+ * SPDX-License-Identifier: BSD-3-Clause
1172
+ *)
1173
+
1174
+ lit-element/lit-element.js:
1175
+ (**
1176
+ * @license
1177
+ * Copyright 2017 Google LLC
1178
+ * SPDX-License-Identifier: BSD-3-Clause
1179
+ *)
1180
+
1181
+ lit-html/is-server.js:
1182
+ (**
1183
+ * @license
1184
+ * Copyright 2022 Google LLC
1185
+ * SPDX-License-Identifier: BSD-3-Clause
1186
+ *)
1187
+
1188
+ @lit/reactive-element/decorators/custom-element.js:
1189
+ (**
1190
+ * @license
1191
+ * Copyright 2017 Google LLC
1192
+ * SPDX-License-Identifier: BSD-3-Clause
1193
+ *)
1194
+
1195
+ @lit/reactive-element/decorators/property.js:
1196
+ (**
1197
+ * @license
1198
+ * Copyright 2017 Google LLC
1199
+ * SPDX-License-Identifier: BSD-3-Clause
1200
+ *)
1201
+
1202
+ @lit/reactive-element/decorators/state.js:
1203
+ (**
1204
+ * @license
1205
+ * Copyright 2017 Google LLC
1206
+ * SPDX-License-Identifier: BSD-3-Clause
1207
+ *)
1208
+
1209
+ @lit/reactive-element/decorators/event-options.js:
1210
+ (**
1211
+ * @license
1212
+ * Copyright 2017 Google LLC
1213
+ * SPDX-License-Identifier: BSD-3-Clause
1214
+ *)
1215
+
1216
+ @lit/reactive-element/decorators/base.js:
1217
+ (**
1218
+ * @license
1219
+ * Copyright 2017 Google LLC
1220
+ * SPDX-License-Identifier: BSD-3-Clause
1221
+ *)
1222
+
1223
+ @lit/reactive-element/decorators/query.js:
1224
+ (**
1225
+ * @license
1226
+ * Copyright 2017 Google LLC
1227
+ * SPDX-License-Identifier: BSD-3-Clause
1228
+ *)
1229
+
1230
+ @lit/reactive-element/decorators/query-all.js:
1231
+ (**
1232
+ * @license
1233
+ * Copyright 2017 Google LLC
1234
+ * SPDX-License-Identifier: BSD-3-Clause
1235
+ *)
1236
+
1237
+ @lit/reactive-element/decorators/query-async.js:
1238
+ (**
1239
+ * @license
1240
+ * Copyright 2017 Google LLC
1241
+ * SPDX-License-Identifier: BSD-3-Clause
1242
+ *)
1243
+
1244
+ @lit/reactive-element/decorators/query-assigned-elements.js:
1245
+ (**
1246
+ * @license
1247
+ * Copyright 2021 Google LLC
1248
+ * SPDX-License-Identifier: BSD-3-Clause
1249
+ *)
1250
+
1251
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
1252
+ (**
1253
+ * @license
1254
+ * Copyright 2017 Google LLC
1255
+ * SPDX-License-Identifier: BSD-3-Clause
1256
+ *)
1257
+
1258
+ lit-html/directive.js:
1259
+ (**
1260
+ * @license
1261
+ * Copyright 2017 Google LLC
1262
+ * SPDX-License-Identifier: BSD-3-Clause
1263
+ *)
1264
+
1265
+ lit-html/directives/class-map.js:
1266
+ (**
1267
+ * @license
1268
+ * Copyright 2018 Google LLC
1269
+ * SPDX-License-Identifier: BSD-3-Clause
1270
+ *)
1271
+
1272
+ lit-html/directives/map.js:
1273
+ (**
1274
+ * @license
1275
+ * Copyright 2021 Google LLC
1276
+ * SPDX-License-Identifier: BSD-3-Clause
1277
+ *)
1278
+
1279
+ lit-html/directives/when.js:
1280
+ (**
1281
+ * @license
1282
+ * Copyright 2021 Google LLC
1283
+ * SPDX-License-Identifier: BSD-3-Clause
1284
+ *)
1285
+ */
1286
+
1287
+ })();
1288
+ //# sourceMappingURL=json-viewer.bundle.js.map
1289
+ //# sourceMappingURL=json-viewer.bundle.js.map