@vscode/component-explorer 0.1.1-1 → 0.1.1-11

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.
Files changed (60) hide show
  1. package/README.md +104 -0
  2. package/dist/component-explorer.css +1 -0
  3. package/dist/components/Explorer.d.ts +9 -4
  4. package/dist/components/Explorer.d.ts.map +1 -1
  5. package/dist/components/ExplorerModel.d.ts +42 -3
  6. package/dist/components/ExplorerModel.d.ts.map +1 -1
  7. package/dist/components/FixturePreviewItem.d.ts +0 -1
  8. package/dist/components/FixturePreviewItem.d.ts.map +1 -1
  9. package/dist/components/FixtureScreenshotView.d.ts +12 -0
  10. package/dist/components/FixtureScreenshotView.d.ts.map +1 -0
  11. package/dist/components/PreviewArea.d.ts.map +1 -1
  12. package/dist/components/ReportComparisonRow.d.ts +16 -0
  13. package/dist/components/ReportComparisonRow.d.ts.map +1 -0
  14. package/dist/components/ScreenshotComparisonRow.d.ts +12 -0
  15. package/dist/components/ScreenshotComparisonRow.d.ts.map +1 -0
  16. package/dist/components/TitleBar.d.ts.map +1 -1
  17. package/dist/components/index.d.ts +6 -2
  18. package/dist/components/index.d.ts.map +1 -1
  19. package/dist/core/CliRuntime.d.ts +49 -0
  20. package/dist/core/CliRuntime.d.ts.map +1 -0
  21. package/dist/core/ErrorInfo.d.ts +29 -0
  22. package/dist/core/ErrorInfo.d.ts.map +1 -0
  23. package/dist/core/FixtureNode.d.ts +2 -1
  24. package/dist/core/FixtureNode.d.ts.map +1 -1
  25. package/dist/core/FixtureRegistry.d.ts +2 -1
  26. package/dist/core/FixtureRegistry.d.ts.map +1 -1
  27. package/dist/core/fixtureApi.d.ts +215 -0
  28. package/dist/core/fixtureApi.d.ts.map +1 -0
  29. package/dist/core/fixtureApiConsumer.d.ts +83 -0
  30. package/dist/core/fixtureApiConsumer.d.ts.map +1 -0
  31. package/dist/core/index.d.ts +7 -6
  32. package/dist/core/index.d.ts.map +1 -1
  33. package/dist/daemon/DaemonConfig.d.ts +19 -0
  34. package/dist/daemon/DaemonConfig.d.ts.map +1 -0
  35. package/dist/daemon/DaemonModel.d.ts +57 -0
  36. package/dist/daemon/DaemonModel.d.ts.map +1 -0
  37. package/dist/daemon/index.d.ts +5 -0
  38. package/dist/daemon/index.d.ts.map +1 -0
  39. package/dist/index.d.ts +8 -28
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +16 -24302
  42. package/dist/index.js.map +1 -1
  43. package/dist/lib/fixtureSizeCache.d.ts +1 -10
  44. package/dist/lib/fixtureSizeCache.d.ts.map +1 -1
  45. package/dist/report/ReportModel.d.ts +23 -0
  46. package/dist/report/ReportModel.d.ts.map +1 -0
  47. package/dist/report/ScreenshotReport.d.ts +25 -0
  48. package/dist/report/ScreenshotReport.d.ts.map +1 -0
  49. package/dist/report/index.d.ts +3 -0
  50. package/dist/report/index.d.ts.map +1 -0
  51. package/dist/viewer.d.ts +52 -0
  52. package/dist/viewer.d.ts.map +1 -0
  53. package/dist/viewer.js +3951 -0
  54. package/dist/viewer.js.map +1 -0
  55. package/package.json +11 -3
  56. package/dist/core/ComponentDefinition.d.ts +0 -70
  57. package/dist/core/ComponentDefinition.d.ts.map +0 -1
  58. package/dist/core/defineFixture.d.ts +0 -109
  59. package/dist/core/defineFixture.d.ts.map +0 -1
  60. package/dist/index.css +0 -1
package/dist/viewer.js ADDED
@@ -0,0 +1,3951 @@
1
+ var St = Object.defineProperty;
2
+ var wt = (s, e, t) => e in s ? St(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var l = (s, e, t) => wt(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { fixtureGroupBrand as ke, fixtureVariantsBrand as Ve, singleFixtureBrand as Ne } from "./index.js";
5
+ import { defineFixture as Hs, defineFixtureGroup as Ls, defineFixtureVariants as Us } from "./index.js";
6
+ import { createRoot as It } from "react-dom/client";
7
+ import { createContext as Je, useReducer as Ot, useState as Rt, useContext as Tt, useEffect as De, createElement as kt } from "react";
8
+ import { jsx as a, jsxs as f, Fragment as ye } from "react/jsx-runtime";
9
+ import { unstable_batchedUpdates as Ze } from "react-dom";
10
+ function xe(s) {
11
+ return typeof s == "object" && s !== null && Ne in s && s[Ne] === !0 && "_options" in s && typeof s._options == "object";
12
+ }
13
+ function Ce(s) {
14
+ return typeof s == "object" && s !== null && ke in s && s[ke] === !0 && "_entries" in s && typeof s._entries == "object";
15
+ }
16
+ function Se(s) {
17
+ return typeof s == "object" && s !== null && Ve in s && s[Ve] === !0 && "_variants" in s && typeof s._variants == "object";
18
+ }
19
+ function Ns(s) {
20
+ return xe(s) ? { success: !0, data: s } : Ce(s) ? { success: !0, data: s } : Se(s) ? { success: !0, data: s } : { success: !1, error: "Value is not a valid fixture export (missing brand symbol or _options/_entries/_variants)" };
21
+ }
22
+ function Ds(s) {
23
+ return xe(s) ? { success: !0, data: s } : { success: !1, error: "Value is not a SingleFixtureExport" };
24
+ }
25
+ function Ms(s) {
26
+ return Ce(s) ? { success: !0, data: s } : { success: !1, error: "Value is not a FixtureGroupExport" };
27
+ }
28
+ function Fs(s) {
29
+ return Se(s) ? { success: !0, data: s } : { success: !1, error: "Value is not a FixtureVariantsExport" };
30
+ }
31
+ function Me(s, e, t) {
32
+ const n = s._options;
33
+ return {
34
+ id: e,
35
+ name: t,
36
+ description: n.description,
37
+ isolation: n.isolation ?? "shadow-dom",
38
+ displayMode: n.displayMode ?? { type: "component" },
39
+ styles: n.styles,
40
+ background: n.background ?? "light",
41
+ properties: n.properties ?? [],
42
+ render: n.render
43
+ };
44
+ }
45
+ function Es(s) {
46
+ return typeof s == "object" && s !== null && "render" in s && typeof s.render == "function" && "id" in s && "name" in s;
47
+ }
48
+ const Vt = {
49
+ mobile: { width: 390, height: 844 },
50
+ tablet: { width: 768, height: 1024 },
51
+ desktop: { width: 1440, height: 900 }
52
+ };
53
+ function Nt(s) {
54
+ return typeof s == "string" ? { name: s, ...Vt[s] } : s;
55
+ }
56
+ function Dt(s) {
57
+ const e = {};
58
+ for (const t of s)
59
+ e[t.name] = t.defaultValue;
60
+ return e;
61
+ }
62
+ function le(s) {
63
+ const e = {
64
+ id: "",
65
+ name: "Components",
66
+ type: "folder",
67
+ children: []
68
+ };
69
+ for (const [t, n] of s) {
70
+ const r = Mt(t);
71
+ Xe(e, [r], n);
72
+ }
73
+ return e;
74
+ }
75
+ function Mt(s) {
76
+ return (s.split("/").pop() ?? s).replace(/\.fixture\.(tsx?|jsx?)$/, "");
77
+ }
78
+ function Xe(s, e, t) {
79
+ var n;
80
+ if (xe(t)) {
81
+ const r = e.join("/"), i = e[e.length - 1], o = {
82
+ id: r,
83
+ name: i,
84
+ type: "component",
85
+ component: Me(t, r, i)
86
+ };
87
+ s.children || (s.children = []), s.children.push(o);
88
+ } else if (Ce(t)) {
89
+ const r = e[e.length - 1], i = e.join("/");
90
+ let o = (n = s.children) == null ? void 0 : n.find(
91
+ (d) => d.type === "folder" && d.name === r
92
+ );
93
+ o || (o = {
94
+ id: i,
95
+ name: r,
96
+ type: "folder",
97
+ children: []
98
+ }, s.children || (s.children = []), s.children.push(o));
99
+ for (const [d, c] of Object.entries(t._entries))
100
+ Xe(o, [...e, d], c);
101
+ } else if (Se(t)) {
102
+ const r = e[e.length - 1], o = {
103
+ id: e.join("/"),
104
+ name: r,
105
+ type: "variants",
106
+ children: []
107
+ };
108
+ s.children || (s.children = []), s.children.push(o);
109
+ for (const [d, c] of Object.entries(t._variants)) {
110
+ const m = [...e, d].join("/"), _ = {
111
+ id: m,
112
+ name: d,
113
+ type: "component",
114
+ component: Me(c, m, d)
115
+ };
116
+ o.children.push(_);
117
+ }
118
+ }
119
+ }
120
+ function Fe(s, e) {
121
+ if (e.length === 0)
122
+ return s;
123
+ let t = s;
124
+ for (const n of e) {
125
+ if (!t || !t.children)
126
+ return;
127
+ t = t.children.find((r) => r.name === n);
128
+ }
129
+ return t;
130
+ }
131
+ function Ft(s) {
132
+ if (s.type === "component" && s.component)
133
+ return [s.component];
134
+ const e = [];
135
+ for (const t of s.children ?? [])
136
+ e.push(...Ft(t));
137
+ return e;
138
+ }
139
+ let j;
140
+ function Qe(s) {
141
+ j ? j instanceof Ee ? j.loggers.push(s) : j = new Ee([j, s]) : j = s;
142
+ }
143
+ function b() {
144
+ return j;
145
+ }
146
+ let he;
147
+ function Et(s) {
148
+ he = s;
149
+ }
150
+ function At(s) {
151
+ he && he(s);
152
+ }
153
+ class Ee {
154
+ constructor(e) {
155
+ this.loggers = e;
156
+ }
157
+ handleObservableCreated(e, t) {
158
+ for (const n of this.loggers)
159
+ n.handleObservableCreated(e, t);
160
+ }
161
+ handleOnListenerCountChanged(e, t) {
162
+ for (const n of this.loggers)
163
+ n.handleOnListenerCountChanged(e, t);
164
+ }
165
+ handleObservableUpdated(e, t) {
166
+ for (const n of this.loggers)
167
+ n.handleObservableUpdated(e, t);
168
+ }
169
+ handleAutorunCreated(e, t) {
170
+ for (const n of this.loggers)
171
+ n.handleAutorunCreated(e, t);
172
+ }
173
+ handleAutorunDisposed(e) {
174
+ for (const t of this.loggers)
175
+ t.handleAutorunDisposed(e);
176
+ }
177
+ handleAutorunDependencyChanged(e, t, n) {
178
+ for (const r of this.loggers)
179
+ r.handleAutorunDependencyChanged(e, t, n);
180
+ }
181
+ handleAutorunStarted(e) {
182
+ for (const t of this.loggers)
183
+ t.handleAutorunStarted(e);
184
+ }
185
+ handleAutorunFinished(e) {
186
+ for (const t of this.loggers)
187
+ t.handleAutorunFinished(e);
188
+ }
189
+ handleDerivedDependencyChanged(e, t, n) {
190
+ for (const r of this.loggers)
191
+ r.handleDerivedDependencyChanged(e, t, n);
192
+ }
193
+ handleDerivedCleared(e) {
194
+ for (const t of this.loggers)
195
+ t.handleDerivedCleared(e);
196
+ }
197
+ handleBeginTransaction(e) {
198
+ for (const t of this.loggers)
199
+ t.handleBeginTransaction(e);
200
+ }
201
+ handleEndTransaction(e) {
202
+ for (const t of this.loggers)
203
+ t.handleEndTransaction(e);
204
+ }
205
+ }
206
+ var T;
207
+ (function(s) {
208
+ let e = !1;
209
+ function t() {
210
+ e = !0;
211
+ }
212
+ s.enable = t;
213
+ function n() {
214
+ return r(1);
215
+ }
216
+ s.ofCaller = n;
217
+ function r(i) {
218
+ if (!e)
219
+ return;
220
+ const o = Error, d = o.stackTraceLimit;
221
+ o.stackTraceLimit = 3;
222
+ const c = new Error().stack;
223
+ return o.stackTraceLimit = d, we.fromStack(c, i + 1);
224
+ }
225
+ s.ofNthCaller = r;
226
+ })(T || (T = {}));
227
+ class we {
228
+ static fromStack(e, t) {
229
+ const n = e.split(`
230
+ `), r = Bt(n[t + 1]);
231
+ if (r)
232
+ return new we(r.fileName, r.line, r.column, r.id);
233
+ }
234
+ constructor(e, t, n, r) {
235
+ this.fileName = e, this.line = t, this.column = n, this.id = r;
236
+ }
237
+ }
238
+ function Bt(s) {
239
+ if (!s)
240
+ return;
241
+ const e = s.match(/\((.*):(\d+):(\d+)\)/);
242
+ if (e)
243
+ return {
244
+ fileName: e[1],
245
+ line: parseInt(e[2]),
246
+ column: parseInt(e[3]),
247
+ id: s
248
+ };
249
+ const t = s.match(/at ([^\(\)]*):(\d+):(\d+)/);
250
+ if (t)
251
+ return {
252
+ fileName: t[1],
253
+ line: parseInt(t[2]),
254
+ column: parseInt(t[3]),
255
+ id: s
256
+ };
257
+ }
258
+ class B {
259
+ constructor(e, t, n) {
260
+ this.owner = e, this.debugNameSource = t, this.referenceFn = n;
261
+ }
262
+ getDebugName(e) {
263
+ return zt(e, this);
264
+ }
265
+ }
266
+ const Ae = /* @__PURE__ */ new Map(), ue = /* @__PURE__ */ new WeakMap();
267
+ function zt(s, e) {
268
+ const t = ue.get(s);
269
+ if (t)
270
+ return t;
271
+ const n = $t(s, e);
272
+ if (n) {
273
+ let r = Ae.get(n) ?? 0;
274
+ r++, Ae.set(n, r);
275
+ const i = r === 1 ? n : `${n}#${r}`;
276
+ return ue.set(s, i), i;
277
+ }
278
+ }
279
+ function $t(s, e) {
280
+ const t = ue.get(s);
281
+ if (t)
282
+ return t;
283
+ const n = e.owner ? Lt(e.owner) + "." : "";
284
+ let r;
285
+ const i = e.debugNameSource;
286
+ if (i !== void 0)
287
+ if (typeof i == "function") {
288
+ if (r = i(), r !== void 0)
289
+ return n + r;
290
+ } else
291
+ return n + i;
292
+ const o = e.referenceFn;
293
+ if (o !== void 0 && (r = Ie(o), r !== void 0))
294
+ return n + r;
295
+ if (e.owner !== void 0) {
296
+ const d = Ht(e.owner, s);
297
+ if (d !== void 0)
298
+ return n + d;
299
+ }
300
+ }
301
+ function Ht(s, e) {
302
+ for (const t in s)
303
+ if (s[t] === e)
304
+ return t;
305
+ }
306
+ const Be = /* @__PURE__ */ new Map(), ze = /* @__PURE__ */ new WeakMap();
307
+ function Lt(s) {
308
+ const e = ze.get(s);
309
+ if (e)
310
+ return e;
311
+ const t = Ye(s) ?? "Object";
312
+ let n = Be.get(t) ?? 0;
313
+ n++, Be.set(t, n);
314
+ const r = n === 1 ? t : `${t}#${n}`;
315
+ return ze.set(s, r), r;
316
+ }
317
+ function Ye(s) {
318
+ const e = s.constructor;
319
+ if (e)
320
+ return e.name === "Object" ? void 0 : e.name;
321
+ }
322
+ function Ie(s) {
323
+ const e = s.toString(), n = /\/\*\*\s*@description\s*([^*]*)\*\//.exec(e), r = n ? n[1] : void 0;
324
+ return r == null ? void 0 : r.trim();
325
+ }
326
+ let fe;
327
+ function Ut(s) {
328
+ fe = s;
329
+ }
330
+ let et;
331
+ function jt(s) {
332
+ et = s;
333
+ }
334
+ let tt;
335
+ function Pt(s) {
336
+ tt = s;
337
+ }
338
+ let nt;
339
+ function Gt(s) {
340
+ nt = s;
341
+ }
342
+ class Wt {
343
+ get TChange() {
344
+ return null;
345
+ }
346
+ reportChanges() {
347
+ this.get();
348
+ }
349
+ /** @sealed */
350
+ read(e) {
351
+ return e ? e.readObservable(this) : this.get();
352
+ }
353
+ map(e, t, n = T.ofCaller()) {
354
+ const r = t === void 0 ? void 0 : e, i = t === void 0 ? e : t;
355
+ return fe({
356
+ owner: r,
357
+ debugName: () => {
358
+ const o = Ie(i);
359
+ if (o !== void 0)
360
+ return o;
361
+ const c = /^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(i.toString());
362
+ if (c)
363
+ return `${this.debugName}.${c[2]}`;
364
+ if (!r)
365
+ return `${this.debugName} (mapped)`;
366
+ },
367
+ debugReferenceFn: i
368
+ }, (o) => i(this.read(o), o), n);
369
+ }
370
+ /**
371
+ * @sealed
372
+ * Converts an observable of an observable value into a direct observable of the value.
373
+ */
374
+ flatten() {
375
+ return fe({
376
+ owner: void 0,
377
+ debugName: () => `${this.debugName} (flattened)`
378
+ }, (e) => this.read(e).read(e));
379
+ }
380
+ recomputeInitiallyAndOnChange(e, t) {
381
+ return e.add(et(this, t)), this;
382
+ }
383
+ /**
384
+ * Ensures that this observable is observed. This keeps the cache alive.
385
+ * However, in case of deriveds, it does not force eager evaluation (only when the value is read/get).
386
+ * Use `recomputeInitiallyAndOnChange` for eager evaluation.
387
+ */
388
+ keepObserved(e) {
389
+ return e.add(tt(this)), this;
390
+ }
391
+ get debugValue() {
392
+ return this.get();
393
+ }
394
+ debugGetDependencyGraph() {
395
+ return nt(this);
396
+ }
397
+ }
398
+ class Oe extends Wt {
399
+ constructor(e) {
400
+ var t;
401
+ super(), this._observers = /* @__PURE__ */ new Set(), (t = b()) == null || t.handleObservableCreated(this, e);
402
+ }
403
+ addObserver(e) {
404
+ var n;
405
+ const t = this._observers.size;
406
+ this._observers.add(e), t === 0 && this.onFirstObserverAdded(), t !== this._observers.size && ((n = b()) == null || n.handleOnListenerCountChanged(this, this._observers.size));
407
+ }
408
+ removeObserver(e) {
409
+ var n;
410
+ const t = this._observers.delete(e);
411
+ t && this._observers.size === 0 && this.onLastObserverRemoved(), t && ((n = b()) == null || n.handleOnListenerCountChanged(this, this._observers.size));
412
+ }
413
+ onFirstObserverAdded() {
414
+ }
415
+ onLastObserverRemoved() {
416
+ }
417
+ log() {
418
+ var t;
419
+ const e = !!b();
420
+ return At(this), e || (t = b()) == null || t.handleObservableCreated(this, T.ofCaller()), this;
421
+ }
422
+ debugGetObservers() {
423
+ return this._observers;
424
+ }
425
+ }
426
+ function st(s) {
427
+ return {
428
+ dispose: s
429
+ };
430
+ }
431
+ class O extends Error {
432
+ constructor(e) {
433
+ super(e || "An unexpected bug occurred."), Object.setPrototypeOf(this, O.prototype);
434
+ }
435
+ }
436
+ function se(s) {
437
+ throw s;
438
+ }
439
+ function pe(s) {
440
+ console.error("Unexpected error:", s);
441
+ }
442
+ const Q = (s, e) => s === e;
443
+ function ee(s) {
444
+ return s != null;
445
+ }
446
+ class Y {
447
+ constructor() {
448
+ this.disposables = [], this._isDisposed = !1;
449
+ }
450
+ get isDisposed() {
451
+ return this._isDisposed;
452
+ }
453
+ dispose() {
454
+ this.clear(), this._isDisposed = !0;
455
+ }
456
+ add(e) {
457
+ return e && this.disposables.push(e), e;
458
+ }
459
+ remove(e) {
460
+ if (!e)
461
+ return e;
462
+ const t = this.disposables.indexOf(e);
463
+ return t !== -1 && this.disposables.splice(t, 1), e;
464
+ }
465
+ clear() {
466
+ for (const e of this.disposables)
467
+ e.dispose();
468
+ this.disposables = [];
469
+ }
470
+ leakItems() {
471
+ this.disposables = [];
472
+ }
473
+ }
474
+ function qt(s) {
475
+ switch (s) {
476
+ case 0:
477
+ return "initial";
478
+ case 1:
479
+ return "dependenciesMightHaveChanged";
480
+ case 2:
481
+ return "stale";
482
+ case 3:
483
+ return "upToDate";
484
+ default:
485
+ return "<unknown>";
486
+ }
487
+ }
488
+ class w extends Oe {
489
+ get debugName() {
490
+ return this._debugNameData.getDebugName(this) ?? "(anonymous)";
491
+ }
492
+ constructor(e, t, n, r = void 0, i, o) {
493
+ var d;
494
+ super(o), this._debugNameData = e, this._computeFn = t, this._changeTracker = n, this._handleLastObserverRemoved = r, this._equalityComparator = i, this._state = 0, this._value = void 0, this._updateCount = 0, this._dependencies = /* @__PURE__ */ new Set(), this._dependenciesToBeRemoved = /* @__PURE__ */ new Set(), this._changeSummary = void 0, this._isUpdating = !1, this._isComputing = !1, this._didReportChange = !1, this._isInBeforeUpdate = !1, this._isReaderValid = !1, this._store = void 0, this._delayedStore = void 0, this._removedObserverToCallEndUpdateOn = null, this._changeSummary = (d = this._changeTracker) == null ? void 0 : d.createChangeSummary(void 0);
495
+ }
496
+ onLastObserverRemoved() {
497
+ var e, t;
498
+ this._state = 0, this._value = void 0, (e = b()) == null || e.handleDerivedCleared(this);
499
+ for (const n of this._dependencies)
500
+ n.removeObserver(this);
501
+ this._dependencies.clear(), this._store !== void 0 && (this._store.dispose(), this._store = void 0), this._delayedStore !== void 0 && (this._delayedStore.dispose(), this._delayedStore = void 0), (t = this._handleLastObserverRemoved) == null || t.call(this);
502
+ }
503
+ get() {
504
+ var t, n;
505
+ if (this._isComputing, this._observers.size === 0) {
506
+ let r;
507
+ try {
508
+ this._isReaderValid = !0;
509
+ let i;
510
+ this._changeTracker && (i = this._changeTracker.createChangeSummary(void 0), (n = (t = this._changeTracker).beforeUpdate) == null || n.call(t, this, i)), r = this._computeFn(this, i);
511
+ } finally {
512
+ this._isReaderValid = !1;
513
+ }
514
+ return this.onLastObserverRemoved(), r;
515
+ } else {
516
+ do {
517
+ if (this._state === 1) {
518
+ for (const r of this._dependencies)
519
+ if (r.reportChanges(), this._state === 2)
520
+ break;
521
+ }
522
+ this._state === 1 && (this._state = 3), this._state !== 3 && this._recompute();
523
+ } while (this._state !== 3);
524
+ return this._value;
525
+ }
526
+ }
527
+ _recompute() {
528
+ var n, r, i, o;
529
+ let e = !1;
530
+ this._isComputing = !0, this._didReportChange = !1;
531
+ const t = this._dependenciesToBeRemoved;
532
+ this._dependenciesToBeRemoved = this._dependencies, this._dependencies = t;
533
+ try {
534
+ const d = this._changeSummary;
535
+ this._isReaderValid = !0, this._changeTracker && (this._isInBeforeUpdate = !0, (r = (n = this._changeTracker).beforeUpdate) == null || r.call(n, this, d), this._isInBeforeUpdate = !1, this._changeSummary = (i = this._changeTracker) == null ? void 0 : i.createChangeSummary(d));
536
+ const c = this._state !== 0, h = this._value;
537
+ this._state = 3;
538
+ const m = this._delayedStore;
539
+ m !== void 0 && (this._delayedStore = void 0);
540
+ try {
541
+ this._store !== void 0 && (this._store.dispose(), this._store = void 0), this._value = this._computeFn(this, d);
542
+ } finally {
543
+ this._isReaderValid = !1;
544
+ for (const _ of this._dependenciesToBeRemoved)
545
+ _.removeObserver(this);
546
+ this._dependenciesToBeRemoved.clear(), m !== void 0 && m.dispose();
547
+ }
548
+ e = this._didReportChange || c && !this._equalityComparator(h, this._value), (o = b()) == null || o.handleObservableUpdated(this, {
549
+ oldValue: h,
550
+ newValue: this._value,
551
+ change: void 0,
552
+ didChange: e,
553
+ hadValue: c
554
+ });
555
+ } catch (d) {
556
+ se(d);
557
+ }
558
+ if (this._isComputing = !1, !this._didReportChange && e)
559
+ for (const d of this._observers)
560
+ d.handleChange(this, void 0);
561
+ else
562
+ this._didReportChange = !1;
563
+ }
564
+ toString() {
565
+ return `LazyDerived<${this.debugName}>`;
566
+ }
567
+ // IObserver Implementation
568
+ beginUpdate(e) {
569
+ if (this._isUpdating)
570
+ throw new O("Cyclic deriveds are not supported yet!");
571
+ this._updateCount++, this._isUpdating = !0;
572
+ try {
573
+ const t = this._updateCount === 1;
574
+ if (this._state === 3 && (this._state = 1, !t))
575
+ for (const n of this._observers)
576
+ n.handlePossibleChange(this);
577
+ if (t)
578
+ for (const n of this._observers)
579
+ n.beginUpdate(this);
580
+ } finally {
581
+ this._isUpdating = !1;
582
+ }
583
+ }
584
+ endUpdate(e) {
585
+ if (this._updateCount--, this._updateCount === 0) {
586
+ const t = [...this._observers];
587
+ for (const n of t)
588
+ n.endUpdate(this);
589
+ if (this._removedObserverToCallEndUpdateOn) {
590
+ const n = [...this._removedObserverToCallEndUpdateOn];
591
+ this._removedObserverToCallEndUpdateOn = null;
592
+ for (const r of n)
593
+ r.endUpdate(this);
594
+ }
595
+ }
596
+ }
597
+ handlePossibleChange(e) {
598
+ if (this._state === 3 && this._dependencies.has(e) && !this._dependenciesToBeRemoved.has(e)) {
599
+ this._state = 1;
600
+ for (const t of this._observers)
601
+ t.handlePossibleChange(this);
602
+ }
603
+ }
604
+ handleChange(e, t) {
605
+ var n;
606
+ if (this._dependencies.has(e) && !this._dependenciesToBeRemoved.has(e) || this._isInBeforeUpdate) {
607
+ (n = b()) == null || n.handleDerivedDependencyChanged(this, e, t);
608
+ let r = !1;
609
+ try {
610
+ r = this._changeTracker ? this._changeTracker.handleChange({
611
+ changedObservable: e,
612
+ change: t,
613
+ didChange: (o) => o === e
614
+ }, this._changeSummary) : !0;
615
+ } catch (o) {
616
+ se(o);
617
+ }
618
+ const i = this._state === 3;
619
+ if (r && (this._state === 1 || i) && (this._state = 2, i))
620
+ for (const o of this._observers)
621
+ o.handlePossibleChange(this);
622
+ }
623
+ }
624
+ // IReader Implementation
625
+ _ensureReaderValid() {
626
+ if (!this._isReaderValid)
627
+ throw new O("The reader object cannot be used outside its compute function!");
628
+ }
629
+ readObservable(e) {
630
+ this._ensureReaderValid(), e.addObserver(this);
631
+ const t = e.get();
632
+ return this._dependencies.add(e), this._dependenciesToBeRemoved.delete(e), t;
633
+ }
634
+ reportChange(e) {
635
+ this._ensureReaderValid(), this._didReportChange = !0;
636
+ for (const t of this._observers)
637
+ t.handleChange(this, e);
638
+ }
639
+ get store() {
640
+ return this._ensureReaderValid(), this._store === void 0 && (this._store = new Y()), this._store;
641
+ }
642
+ get delayedStore() {
643
+ return this._ensureReaderValid(), this._delayedStore === void 0 && (this._delayedStore = new Y()), this._delayedStore;
644
+ }
645
+ addObserver(e) {
646
+ const t = !this._observers.has(e) && this._updateCount > 0;
647
+ super.addObserver(e), t && (this._removedObserverToCallEndUpdateOn && this._removedObserverToCallEndUpdateOn.has(e) ? this._removedObserverToCallEndUpdateOn.delete(e) : e.beginUpdate(this));
648
+ }
649
+ removeObserver(e) {
650
+ this._observers.has(e) && this._updateCount > 0 && (this._removedObserverToCallEndUpdateOn || (this._removedObserverToCallEndUpdateOn = /* @__PURE__ */ new Set()), this._removedObserverToCallEndUpdateOn.add(e)), super.removeObserver(e);
651
+ }
652
+ debugGetState() {
653
+ return {
654
+ state: this._state,
655
+ stateStr: qt(this._state),
656
+ updateCount: this._updateCount,
657
+ isComputing: this._isComputing,
658
+ dependencies: this._dependencies,
659
+ value: this._value
660
+ };
661
+ }
662
+ debugSetValue(e) {
663
+ this._value = e;
664
+ }
665
+ debugRecompute() {
666
+ this._isComputing ? this._state = 2 : this._recompute();
667
+ }
668
+ setValue(e, t, n) {
669
+ this._value = e;
670
+ const r = this._observers;
671
+ t.updateObserver(this, this);
672
+ for (const i of r)
673
+ i.handleChange(this, n);
674
+ }
675
+ }
676
+ function F(s, e, t = T.ofCaller()) {
677
+ return e !== void 0 ? new w(new B(s, void 0, e), e, void 0, void 0, Q, t) : new w(new B(void 0, void 0, s), s, void 0, void 0, Q, t);
678
+ }
679
+ function Kt(s, e, t = T.ofCaller()) {
680
+ return new w(new B(s.owner, s.debugName, s.debugReferenceFn), e, void 0, s.onLastObserverRemoved, s.equalsFn ?? Q, t);
681
+ }
682
+ Ut(Kt);
683
+ function Jt(s, e, t = T.ofCaller()) {
684
+ let n, r;
685
+ n = s, r = void 0;
686
+ let i;
687
+ return new w(new B(r, void 0, n), (o) => {
688
+ i ? i.clear() : i = new Y();
689
+ const d = n(o);
690
+ return d && i.add(d), d;
691
+ }, void 0, () => {
692
+ i && (i.dispose(), i = void 0);
693
+ }, Q, t);
694
+ }
695
+ function Zt(s) {
696
+ switch (s) {
697
+ case 1:
698
+ return "dependenciesMightHaveChanged";
699
+ case 2:
700
+ return "stale";
701
+ case 3:
702
+ return "upToDate";
703
+ default:
704
+ return "<unknown>";
705
+ }
706
+ }
707
+ class re {
708
+ get debugName() {
709
+ return this._debugNameData.getDebugName(this) ?? "(anonymous)";
710
+ }
711
+ constructor(e, t, n, r) {
712
+ var i, o;
713
+ this._debugNameData = e, this._runFn = t, this._changeTracker = n, this._state = 2, this._updateCount = 0, this._disposed = !1, this._dependencies = /* @__PURE__ */ new Set(), this._dependenciesToBeRemoved = /* @__PURE__ */ new Set(), this._isRunning = !1, this._store = void 0, this._delayedStore = void 0, this._changeSummary = (i = this._changeTracker) == null ? void 0 : i.createChangeSummary(void 0), (o = b()) == null || o.handleAutorunCreated(this, r), this._run();
714
+ }
715
+ dispose() {
716
+ var e;
717
+ if (!this._disposed) {
718
+ this._disposed = !0;
719
+ for (const t of this._dependencies)
720
+ t.removeObserver(this);
721
+ this._dependencies.clear(), this._store !== void 0 && this._store.dispose(), this._delayedStore !== void 0 && this._delayedStore.dispose(), (e = b()) == null || e.handleAutorunDisposed(this);
722
+ }
723
+ }
724
+ _run() {
725
+ var t, n, r, i;
726
+ const e = this._dependenciesToBeRemoved;
727
+ this._dependenciesToBeRemoved = this._dependencies, this._dependencies = e, this._state = 3;
728
+ try {
729
+ if (!this._disposed) {
730
+ (t = b()) == null || t.handleAutorunStarted(this);
731
+ const o = this._changeSummary, d = this._delayedStore;
732
+ d !== void 0 && (this._delayedStore = void 0);
733
+ try {
734
+ this._isRunning = !0, this._changeTracker && ((r = (n = this._changeTracker).beforeUpdate) == null || r.call(n, this, o), this._changeSummary = this._changeTracker.createChangeSummary(o)), this._store !== void 0 && (this._store.dispose(), this._store = void 0), this._runFn(this, o);
735
+ } catch (c) {
736
+ se(c);
737
+ } finally {
738
+ this._isRunning = !1, d !== void 0 && d.dispose();
739
+ }
740
+ }
741
+ } finally {
742
+ this._disposed || (i = b()) == null || i.handleAutorunFinished(this);
743
+ for (const o of this._dependenciesToBeRemoved)
744
+ o.removeObserver(this);
745
+ this._dependenciesToBeRemoved.clear();
746
+ }
747
+ }
748
+ toString() {
749
+ return `Autorun<${this.debugName}>`;
750
+ }
751
+ // IObserver implementation
752
+ beginUpdate(e) {
753
+ this._state === 3 && (this._state = 1), this._updateCount++;
754
+ }
755
+ endUpdate(e) {
756
+ try {
757
+ if (this._updateCount === 1)
758
+ do {
759
+ if (this._state === 1) {
760
+ this._state = 3;
761
+ for (const t of this._dependencies)
762
+ if (t.reportChanges(), this._state === 2)
763
+ break;
764
+ }
765
+ this._state !== 3 && this._run();
766
+ } while (this._state !== 3);
767
+ } finally {
768
+ this._updateCount--;
769
+ }
770
+ }
771
+ handlePossibleChange(e) {
772
+ this._state === 3 && this._isDependency(e) && (this._state = 1);
773
+ }
774
+ handleChange(e, t) {
775
+ var n;
776
+ if (this._isDependency(e)) {
777
+ (n = b()) == null || n.handleAutorunDependencyChanged(this, e, t);
778
+ try {
779
+ (this._changeTracker ? this._changeTracker.handleChange({
780
+ changedObservable: e,
781
+ change: t,
782
+ didChange: (i) => i === e
783
+ }, this._changeSummary) : !0) && (this._state = 2);
784
+ } catch (r) {
785
+ se(r);
786
+ }
787
+ }
788
+ }
789
+ _isDependency(e) {
790
+ return this._dependencies.has(e) && !this._dependenciesToBeRemoved.has(e);
791
+ }
792
+ // IReader implementation
793
+ _ensureNoRunning() {
794
+ if (!this._isRunning)
795
+ throw new O("The reader object cannot be used outside its compute function!");
796
+ }
797
+ readObservable(e) {
798
+ if (this._ensureNoRunning(), this._disposed)
799
+ return e.get();
800
+ e.addObserver(this);
801
+ const t = e.get();
802
+ return this._dependencies.add(e), this._dependenciesToBeRemoved.delete(e), t;
803
+ }
804
+ get store() {
805
+ if (this._ensureNoRunning(), this._disposed)
806
+ throw new O("Cannot access store after dispose");
807
+ return this._store === void 0 && (this._store = new Y()), this._store;
808
+ }
809
+ get delayedStore() {
810
+ if (this._ensureNoRunning(), this._disposed)
811
+ throw new O("Cannot access store after dispose");
812
+ return this._delayedStore === void 0 && (this._delayedStore = new Y()), this._delayedStore;
813
+ }
814
+ debugGetState() {
815
+ return {
816
+ isRunning: this._isRunning,
817
+ updateCount: this._updateCount,
818
+ dependencies: this._dependencies,
819
+ state: this._state,
820
+ stateStr: Zt(this._state)
821
+ };
822
+ }
823
+ debugRerun() {
824
+ this._isRunning ? this._state = 2 : this._run();
825
+ }
826
+ }
827
+ function rt(s, e = T.ofCaller()) {
828
+ return new re(new B(void 0, void 0, s), s, void 0, e);
829
+ }
830
+ function $e(s) {
831
+ const e = new Error("BugIndicatingErrorRecovery: " + s);
832
+ pe(e), console.error("recovered from an error that indicates a bug", e);
833
+ }
834
+ function it(s, e) {
835
+ const t = new ot(s, e);
836
+ try {
837
+ s(t);
838
+ } finally {
839
+ t.finish();
840
+ }
841
+ }
842
+ function Xt(s, e, t) {
843
+ s ? e(s) : it(e, t);
844
+ }
845
+ class ot {
846
+ constructor(e, t) {
847
+ var n;
848
+ this._fn = e, this._getDebugName = t, this._updatingObservers = [], (n = b()) == null || n.handleBeginTransaction(this);
849
+ }
850
+ getDebugName() {
851
+ return this._getDebugName ? this._getDebugName() : Ie(this._fn);
852
+ }
853
+ updateObserver(e, t) {
854
+ if (!this._updatingObservers) {
855
+ $e("Transaction already finished!"), it((n) => {
856
+ n.updateObserver(e, t);
857
+ });
858
+ return;
859
+ }
860
+ this._updatingObservers.push({ observer: e, observable: t }), e.beginUpdate(t);
861
+ }
862
+ finish() {
863
+ var t;
864
+ const e = this._updatingObservers;
865
+ if (!e) {
866
+ $e("transaction.finish() has already been called!");
867
+ return;
868
+ }
869
+ for (let n = 0; n < e.length; n++) {
870
+ const { observer: r, observable: i } = e[n];
871
+ r.endUpdate(i);
872
+ }
873
+ this._updatingObservers = null, (t = b()) == null || t.handleEndTransaction(this);
874
+ }
875
+ debugGetUpdatingObservers() {
876
+ return this._updatingObservers;
877
+ }
878
+ }
879
+ function x(s, e, t = T.ofCaller()) {
880
+ let n;
881
+ return typeof s == "string" ? n = new B(void 0, s, void 0) : n = new B(s, void 0, void 0), new ie(n, e, Q, t);
882
+ }
883
+ class ie extends Oe {
884
+ get debugName() {
885
+ return this._debugNameData.getDebugName(this) ?? "ObservableValue";
886
+ }
887
+ constructor(e, t, n, r) {
888
+ var i;
889
+ super(r), this._debugNameData = e, this._equalityComparator = n, this._value = t, (i = b()) == null || i.handleObservableUpdated(this, { hadValue: !1, newValue: t, change: void 0, didChange: !0, oldValue: void 0 });
890
+ }
891
+ get() {
892
+ return this._value;
893
+ }
894
+ set(e, t, n) {
895
+ var i;
896
+ if (n === void 0 && this._equalityComparator(this._value, e))
897
+ return;
898
+ let r;
899
+ t || (t = r = new ot(() => {
900
+ }, () => `Setting ${this.debugName}`));
901
+ try {
902
+ const o = this._value;
903
+ this._setValue(e), (i = b()) == null || i.handleObservableUpdated(this, { oldValue: o, newValue: e, change: n, didChange: !0, hadValue: !0 });
904
+ for (const d of this._observers)
905
+ t.updateObserver(d, this), d.handleChange(this, n);
906
+ } finally {
907
+ r && r.finish();
908
+ }
909
+ }
910
+ toString() {
911
+ return `${this.debugName}: ${this._value}`;
912
+ }
913
+ _setValue(e) {
914
+ this._value = e;
915
+ }
916
+ debugGetState() {
917
+ return {
918
+ value: this._value
919
+ };
920
+ }
921
+ debugSetValue(e) {
922
+ this._value = e;
923
+ }
924
+ }
925
+ function He(...s) {
926
+ let e, t, n, r;
927
+ return s.length === 2 ? [t, n] = s : [e, t, n, r] = s, new A(new B(e, void 0, n), t, n, () => A.globalTransaction, Q, r ?? T.ofCaller());
928
+ }
929
+ class A extends Oe {
930
+ constructor(e, t, n, r, i, o) {
931
+ super(o), this._debugNameData = e, this.event = t, this._getValue = n, this._getTransaction = r, this._equalityComparator = i, this._hasValue = !1, this.handleEvent = (d) => {
932
+ var g;
933
+ const c = this._getValue(d), h = this._value, m = !this._hasValue || !this._equalityComparator(h, c);
934
+ let _ = !1;
935
+ m && (this._value = c, this._hasValue && (_ = !0, Xt(this._getTransaction(), (v) => {
936
+ var E;
937
+ (E = b()) == null || E.handleObservableUpdated(this, { oldValue: h, newValue: c, change: void 0, didChange: m, hadValue: this._hasValue });
938
+ for (const V of this._observers)
939
+ v.updateObserver(V, this), V.handleChange(this, void 0);
940
+ }, () => {
941
+ const v = this.getDebugName();
942
+ return "Event fired" + (v ? `: ${v}` : "");
943
+ })), this._hasValue = !0), _ || (g = b()) == null || g.handleObservableUpdated(this, { oldValue: h, newValue: c, change: void 0, didChange: m, hadValue: this._hasValue });
944
+ };
945
+ }
946
+ getDebugName() {
947
+ return this._debugNameData.getDebugName(this);
948
+ }
949
+ get debugName() {
950
+ const e = this.getDebugName();
951
+ return "From Event" + (e ? `: ${e}` : "");
952
+ }
953
+ onFirstObserverAdded() {
954
+ this._subscription = this.event(this.handleEvent);
955
+ }
956
+ onLastObserverRemoved() {
957
+ this._subscription.dispose(), this._subscription = void 0, this._hasValue = !1, this._value = void 0;
958
+ }
959
+ get() {
960
+ return this._subscription ? (this._hasValue || this.handleEvent(void 0), this._value) : this._getValue(void 0);
961
+ }
962
+ debugSetValue(e) {
963
+ this._value = e;
964
+ }
965
+ debugGetState() {
966
+ return { value: this._value, hasValue: this._hasValue };
967
+ }
968
+ }
969
+ (function(s) {
970
+ s.Observer = A;
971
+ function e(t, n) {
972
+ let r = !1;
973
+ A.globalTransaction === void 0 && (A.globalTransaction = t, r = !0);
974
+ try {
975
+ n();
976
+ } finally {
977
+ r && (A.globalTransaction = void 0);
978
+ }
979
+ }
980
+ s.batchEventsGlobally = e;
981
+ })(He || (He = {}));
982
+ function Qt(s) {
983
+ const e = new at(!1, void 0);
984
+ return s.addObserver(e), st(() => {
985
+ s.removeObserver(e);
986
+ });
987
+ }
988
+ Pt(Qt);
989
+ function Yt(s, e) {
990
+ const t = new at(!0, e);
991
+ s.addObserver(t);
992
+ try {
993
+ t.beginUpdate(s);
994
+ } finally {
995
+ t.endUpdate(s);
996
+ }
997
+ return st(() => {
998
+ s.removeObserver(t);
999
+ });
1000
+ }
1001
+ jt(Yt);
1002
+ class at {
1003
+ constructor(e, t) {
1004
+ this._forceRecompute = e, this._handleValue = t, this._counter = 0;
1005
+ }
1006
+ beginUpdate(e) {
1007
+ this._counter++;
1008
+ }
1009
+ endUpdate(e) {
1010
+ this._counter === 1 && this._forceRecompute && (this._handleValue ? this._handleValue(e.get()) : e.reportChanges()), this._counter--;
1011
+ }
1012
+ handlePossibleChange(e) {
1013
+ }
1014
+ handleChange(e, t) {
1015
+ }
1016
+ }
1017
+ let ne;
1018
+ function en(s) {
1019
+ ne || (ne = new tn(), Qe(ne)), ne.addFilteredObj(s);
1020
+ }
1021
+ class tn {
1022
+ constructor() {
1023
+ this.indentation = 0, this.changedObservablesSets = /* @__PURE__ */ new WeakMap();
1024
+ }
1025
+ addFilteredObj(e) {
1026
+ this._filteredObjects || (this._filteredObjects = /* @__PURE__ */ new Set()), this._filteredObjects.add(e);
1027
+ }
1028
+ _isIncluded(e) {
1029
+ var t;
1030
+ return ((t = this._filteredObjects) == null ? void 0 : t.has(e)) ?? !0;
1031
+ }
1032
+ textToConsoleArgs(e) {
1033
+ return nn([
1034
+ G(on("| ", this.indentation)),
1035
+ e
1036
+ ]);
1037
+ }
1038
+ formatInfo(e) {
1039
+ return e.hadValue ? e.didChange ? [
1040
+ G(" "),
1041
+ I(M(e.oldValue, 70), {
1042
+ color: "red",
1043
+ strikeThrough: !0
1044
+ }),
1045
+ G(" "),
1046
+ I(M(e.newValue, 60), {
1047
+ color: "green"
1048
+ })
1049
+ ] : [G(" (unchanged)")] : [
1050
+ G(" "),
1051
+ I(M(e.newValue, 60), {
1052
+ color: "green"
1053
+ }),
1054
+ G(" (initial)")
1055
+ ];
1056
+ }
1057
+ handleObservableCreated(e) {
1058
+ if (e instanceof w) {
1059
+ const t = e;
1060
+ this.changedObservablesSets.set(t, /* @__PURE__ */ new Set());
1061
+ }
1062
+ }
1063
+ handleOnListenerCountChanged(e, t) {
1064
+ }
1065
+ handleObservableUpdated(e, t) {
1066
+ if (this._isIncluded(e)) {
1067
+ if (e instanceof w) {
1068
+ this._handleDerivedRecomputed(e, t);
1069
+ return;
1070
+ }
1071
+ console.log(...this.textToConsoleArgs([
1072
+ W("observable value changed"),
1073
+ I(e.debugName, { color: "BlueViolet" }),
1074
+ ...this.formatInfo(t)
1075
+ ]));
1076
+ }
1077
+ }
1078
+ formatChanges(e) {
1079
+ if (e.size !== 0)
1080
+ return I(" (changed deps: " + [...e].map((t) => t.debugName).join(", ") + ")", { color: "gray" });
1081
+ }
1082
+ handleDerivedDependencyChanged(e, t, n) {
1083
+ var r;
1084
+ this._isIncluded(e) && ((r = this.changedObservablesSets.get(e)) == null || r.add(t));
1085
+ }
1086
+ _handleDerivedRecomputed(e, t) {
1087
+ if (!this._isIncluded(e))
1088
+ return;
1089
+ const n = this.changedObservablesSets.get(e);
1090
+ n && (console.log(...this.textToConsoleArgs([
1091
+ W("derived recomputed"),
1092
+ I(e.debugName, { color: "BlueViolet" }),
1093
+ ...this.formatInfo(t),
1094
+ this.formatChanges(n),
1095
+ { data: [{ fn: e._debugNameData.referenceFn ?? e._computeFn }] }
1096
+ ])), n.clear());
1097
+ }
1098
+ handleDerivedCleared(e) {
1099
+ this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1100
+ W("derived cleared"),
1101
+ I(e.debugName, { color: "BlueViolet" })
1102
+ ]));
1103
+ }
1104
+ handleFromEventObservableTriggered(e, t) {
1105
+ this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1106
+ W("observable from event triggered"),
1107
+ I(e.debugName, { color: "BlueViolet" }),
1108
+ ...this.formatInfo(t),
1109
+ { data: [{ fn: e._getValue }] }
1110
+ ]));
1111
+ }
1112
+ handleAutorunCreated(e) {
1113
+ this._isIncluded(e) && this.changedObservablesSets.set(e, /* @__PURE__ */ new Set());
1114
+ }
1115
+ handleAutorunDisposed(e) {
1116
+ }
1117
+ handleAutorunDependencyChanged(e, t, n) {
1118
+ this._isIncluded(e) && this.changedObservablesSets.get(e).add(t);
1119
+ }
1120
+ handleAutorunStarted(e) {
1121
+ const t = this.changedObservablesSets.get(e);
1122
+ t && (this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1123
+ W("autorun"),
1124
+ I(e.debugName, { color: "BlueViolet" }),
1125
+ this.formatChanges(t),
1126
+ { data: [{ fn: e._debugNameData.referenceFn ?? e._runFn }] }
1127
+ ])), t.clear(), this.indentation++);
1128
+ }
1129
+ handleAutorunFinished(e) {
1130
+ this.indentation--;
1131
+ }
1132
+ handleBeginTransaction(e) {
1133
+ let t = e.getDebugName();
1134
+ t === void 0 && (t = ""), this._isIncluded(e) && console.log(...this.textToConsoleArgs([
1135
+ W("transaction"),
1136
+ I(t, { color: "BlueViolet" }),
1137
+ { data: [{ fn: e._fn }] }
1138
+ ])), this.indentation++;
1139
+ }
1140
+ handleEndTransaction() {
1141
+ this.indentation--;
1142
+ }
1143
+ }
1144
+ function nn(s) {
1145
+ const e = new Array(), t = [];
1146
+ let n = "";
1147
+ function r(o) {
1148
+ if ("length" in o)
1149
+ for (const d of o)
1150
+ d && r(d);
1151
+ else "text" in o ? (n += `%c${o.text}`, e.push(o.style), o.data && t.push(...o.data)) : "data" in o && t.push(...o.data);
1152
+ }
1153
+ r(s);
1154
+ const i = [n, ...e];
1155
+ return i.push(...t), i;
1156
+ }
1157
+ function G(s) {
1158
+ return I(s, { color: "black" });
1159
+ }
1160
+ function W(s) {
1161
+ return I(an(`${s}: `, 10), { color: "black", bold: !0 });
1162
+ }
1163
+ function I(s, e = {
1164
+ color: "black"
1165
+ }) {
1166
+ function t(r) {
1167
+ return Object.entries(r).reduce((i, [o, d]) => `${i}${o}:${d};`, "");
1168
+ }
1169
+ const n = {
1170
+ color: e.color
1171
+ };
1172
+ return e.strikeThrough && (n["text-decoration"] = "line-through"), e.bold && (n["font-weight"] = "bold"), {
1173
+ text: s,
1174
+ style: t(n)
1175
+ };
1176
+ }
1177
+ function M(s, e) {
1178
+ switch (typeof s) {
1179
+ case "number":
1180
+ return "" + s;
1181
+ case "string":
1182
+ return s.length + 2 <= e ? `"${s}"` : `"${s.substr(0, e - 7)}"+...`;
1183
+ case "boolean":
1184
+ return s ? "true" : "false";
1185
+ case "undefined":
1186
+ return "undefined";
1187
+ case "object":
1188
+ return s === null ? "null" : Array.isArray(s) ? sn(s, e) : rn(s, e);
1189
+ case "symbol":
1190
+ return s.toString();
1191
+ case "function":
1192
+ return `[[Function${s.name ? " " + s.name : ""}]]`;
1193
+ default:
1194
+ return "" + s;
1195
+ }
1196
+ }
1197
+ function sn(s, e) {
1198
+ let t = "[ ", n = !0;
1199
+ for (const r of s) {
1200
+ if (n || (t += ", "), t.length - 5 > e) {
1201
+ t += "...";
1202
+ break;
1203
+ }
1204
+ n = !1, t += `${M(r, e - t.length)}`;
1205
+ }
1206
+ return t += " ]", t;
1207
+ }
1208
+ function rn(s, e) {
1209
+ if (typeof s.toString == "function" && s.toString !== Object.prototype.toString) {
1210
+ const i = s.toString();
1211
+ return i.length <= e ? i : i.substring(0, e - 3) + "...";
1212
+ }
1213
+ const t = Ye(s);
1214
+ let n = t ? t + "(" : "{ ", r = !0;
1215
+ for (const [i, o] of Object.entries(s)) {
1216
+ if (r || (n += ", "), n.length - 5 > e) {
1217
+ n += "...";
1218
+ break;
1219
+ }
1220
+ r = !1, n += `${i}: ${M(o, e - n.length)}`;
1221
+ }
1222
+ return n += t ? ")" : " }", n;
1223
+ }
1224
+ function on(s, e) {
1225
+ let t = "";
1226
+ for (let n = 1; n <= e; n++)
1227
+ t += s;
1228
+ return t;
1229
+ }
1230
+ function an(s, e) {
1231
+ for (; s.length < e; )
1232
+ s += " ";
1233
+ return s;
1234
+ }
1235
+ class oe {
1236
+ static createHost(e, t) {
1237
+ return new oe(e, t);
1238
+ }
1239
+ static createClient(e, t) {
1240
+ return new oe(e, t);
1241
+ }
1242
+ constructor(e, t) {
1243
+ this._channelFactory = e, this._getHandler = t, this._channel = this._channelFactory({
1244
+ handleNotification: (i) => {
1245
+ const o = i, d = this._getHandler().notifications[o[0]];
1246
+ if (!d)
1247
+ throw new Error(`Unknown notification "${o[0]}"!`);
1248
+ d(...o[1]);
1249
+ },
1250
+ handleRequest: (i) => {
1251
+ const o = i;
1252
+ try {
1253
+ return { type: "result", value: this._getHandler().requests[o[0]](...o[1]) };
1254
+ } catch (d) {
1255
+ return { type: "error", value: d };
1256
+ }
1257
+ }
1258
+ });
1259
+ const n = new Proxy({}, {
1260
+ get: (i, o) => async (...d) => {
1261
+ const c = await this._channel.sendRequest([o, d]);
1262
+ if (c.type === "error")
1263
+ throw c.value;
1264
+ return c.value;
1265
+ }
1266
+ }), r = new Proxy({}, {
1267
+ get: (i, o) => (...d) => {
1268
+ this._channel.sendNotification([o, d]);
1269
+ }
1270
+ });
1271
+ this.api = { notifications: r, requests: n };
1272
+ }
1273
+ }
1274
+ function dn(s, e) {
1275
+ const t = globalThis;
1276
+ let n = [], r;
1277
+ const { channel: i, handler: o } = cn({
1278
+ sendNotification: (c) => {
1279
+ r ? r.sendNotification(c) : n.push(c);
1280
+ }
1281
+ });
1282
+ let d;
1283
+ return (t.$$debugValueEditor_debugChannels ?? (t.$$debugValueEditor_debugChannels = {}))[s] = (c) => {
1284
+ d = e(), r = c;
1285
+ for (const h of n)
1286
+ c.sendNotification(h);
1287
+ return n = [], o;
1288
+ }, oe.createClient(i, () => {
1289
+ if (!d)
1290
+ throw new Error("Not supported");
1291
+ return d;
1292
+ });
1293
+ }
1294
+ function cn(s) {
1295
+ let e;
1296
+ return {
1297
+ channel: (n) => (e = n, {
1298
+ sendNotification: (r) => {
1299
+ s.sendNotification(r);
1300
+ },
1301
+ sendRequest: (r) => {
1302
+ throw new Error("not supported");
1303
+ }
1304
+ }),
1305
+ handler: {
1306
+ handleRequest: (n) => n.type === "notification" ? e == null ? void 0 : e.handleNotification(n.data) : e == null ? void 0 : e.handleRequest(n.data)
1307
+ }
1308
+ };
1309
+ }
1310
+ class ln {
1311
+ constructor() {
1312
+ this._timeout = void 0;
1313
+ }
1314
+ throttle(e, t) {
1315
+ this._timeout === void 0 && (this._timeout = setTimeout(() => {
1316
+ this._timeout = void 0, e();
1317
+ }, t));
1318
+ }
1319
+ dispose() {
1320
+ this._timeout !== void 0 && clearTimeout(this._timeout);
1321
+ }
1322
+ }
1323
+ function dt(s, e) {
1324
+ for (const t in e)
1325
+ s[t] && typeof s[t] == "object" && e[t] && typeof e[t] == "object" ? dt(s[t], e[t]) : s[t] = e[t];
1326
+ }
1327
+ function ct(s, e) {
1328
+ for (const t in e)
1329
+ e[t] === null ? delete s[t] : s[t] && typeof s[t] == "object" && e[t] && typeof e[t] == "object" ? ct(s[t], e[t]) : s[t] = e[t];
1330
+ }
1331
+ class P {
1332
+ static getInstance() {
1333
+ return P._instance === void 0 && (P._instance = new P()), P._instance;
1334
+ }
1335
+ getTransactionState() {
1336
+ const e = [], t = [...this._activeTransactions];
1337
+ if (t.length === 0)
1338
+ return;
1339
+ const n = t.flatMap((i) => i.debugGetUpdatingObservers() ?? []).map((i) => i.observer), r = /* @__PURE__ */ new Set();
1340
+ for (; n.length > 0; ) {
1341
+ const i = n.shift();
1342
+ if (r.has(i))
1343
+ continue;
1344
+ r.add(i);
1345
+ const o = this._getInfo(i, (d) => {
1346
+ r.has(d) || n.push(d);
1347
+ });
1348
+ o && e.push(o);
1349
+ }
1350
+ return { names: t.map((i) => i.getDebugName() ?? "tx"), affected: e };
1351
+ }
1352
+ _getObservableInfo(e) {
1353
+ const t = this._instanceInfos.get(e);
1354
+ if (!t) {
1355
+ pe(new O("No info found"));
1356
+ return;
1357
+ }
1358
+ return t;
1359
+ }
1360
+ _getAutorunInfo(e) {
1361
+ const t = this._instanceInfos.get(e);
1362
+ if (!t) {
1363
+ pe(new O("No info found"));
1364
+ return;
1365
+ }
1366
+ return t;
1367
+ }
1368
+ _getInfo(e, t) {
1369
+ if (e instanceof w) {
1370
+ const n = [...e.debugGetObservers()];
1371
+ for (const c of n)
1372
+ t(c);
1373
+ const r = this._getObservableInfo(e);
1374
+ if (!r)
1375
+ return;
1376
+ const i = e.debugGetState(), o = { name: e.debugName, instanceId: r.instanceId, updateCount: i.updateCount }, d = [...r.changedObservables].map((c) => {
1377
+ var h;
1378
+ return (h = this._instanceInfos.get(c)) == null ? void 0 : h.instanceId;
1379
+ }).filter(ee);
1380
+ if (i.isComputing)
1381
+ return { ...o, type: "observable/derived", state: "updating", changedDependencies: d, initialComputation: !1 };
1382
+ switch (i.state) {
1383
+ case 0:
1384
+ return { ...o, type: "observable/derived", state: "noValue" };
1385
+ case 3:
1386
+ return { ...o, type: "observable/derived", state: "upToDate" };
1387
+ case 2:
1388
+ return { ...o, type: "observable/derived", state: "stale", changedDependencies: d };
1389
+ case 1:
1390
+ return { ...o, type: "observable/derived", state: "possiblyStale" };
1391
+ }
1392
+ } else if (e instanceof re) {
1393
+ const n = this._getAutorunInfo(e);
1394
+ if (!n)
1395
+ return;
1396
+ const r = { name: e.debugName, instanceId: n.instanceId, updateCount: n.updateCount }, i = [...n.changedObservables].map((o) => this._instanceInfos.get(o).instanceId);
1397
+ if (e.debugGetState().isRunning)
1398
+ return { ...r, type: "autorun", state: "updating", changedDependencies: i };
1399
+ switch (e.debugGetState().state) {
1400
+ case 3:
1401
+ return { ...r, type: "autorun", state: "upToDate" };
1402
+ case 2:
1403
+ return { ...r, type: "autorun", state: "stale", changedDependencies: i };
1404
+ case 1:
1405
+ return { ...r, type: "autorun", state: "possiblyStale" };
1406
+ }
1407
+ }
1408
+ }
1409
+ _formatObservable(e) {
1410
+ const t = this._getObservableInfo(e);
1411
+ if (t)
1412
+ return { name: e.debugName, instanceId: t.instanceId };
1413
+ }
1414
+ _formatObserver(e) {
1415
+ var n;
1416
+ if (e instanceof w)
1417
+ return { name: e.toString(), instanceId: (n = this._getObservableInfo(e)) == null ? void 0 : n.instanceId };
1418
+ const t = this._getAutorunInfo(e);
1419
+ if (t)
1420
+ return { name: e.toString(), instanceId: t.instanceId };
1421
+ }
1422
+ constructor() {
1423
+ this._declarationId = 0, this._instanceId = 0, this._declarations = /* @__PURE__ */ new Map(), this._instanceInfos = /* @__PURE__ */ new WeakMap(), this._aliveInstances = /* @__PURE__ */ new Map(), this._activeTransactions = /* @__PURE__ */ new Set(), this._channel = dn("observableDevTools", () => ({
1424
+ notifications: {
1425
+ setDeclarationIdFilter: (e) => {
1426
+ },
1427
+ logObservableValue: (e) => {
1428
+ console.log("logObservableValue", e);
1429
+ },
1430
+ flushUpdates: () => {
1431
+ this._flushUpdates();
1432
+ },
1433
+ resetUpdates: () => {
1434
+ this._pendingChanges = null, this._channel.api.notifications.handleChange(this._fullState, !0);
1435
+ }
1436
+ },
1437
+ requests: {
1438
+ getDeclarations: () => {
1439
+ const e = {};
1440
+ for (const t of this._declarations.values())
1441
+ e[t.id] = t;
1442
+ return { decls: e };
1443
+ },
1444
+ getSummarizedInstances: () => null,
1445
+ getObservableValueInfo: (e) => ({
1446
+ observers: [...this._aliveInstances.get(e).debugGetObservers()].map((n) => this._formatObserver(n)).filter(ee)
1447
+ }),
1448
+ getDerivedInfo: (e) => {
1449
+ const t = this._aliveInstances.get(e);
1450
+ return {
1451
+ dependencies: [...t.debugGetState().dependencies].map((n) => this._formatObservable(n)).filter(ee),
1452
+ observers: [...t.debugGetObservers()].map((n) => this._formatObserver(n)).filter(ee)
1453
+ };
1454
+ },
1455
+ getAutorunInfo: (e) => ({
1456
+ dependencies: [...this._aliveInstances.get(e).debugGetState().dependencies].map((n) => this._formatObservable(n)).filter(ee)
1457
+ }),
1458
+ getTransactionState: () => this.getTransactionState(),
1459
+ setValue: (e, t) => {
1460
+ const n = this._aliveInstances.get(e);
1461
+ if (n instanceof w)
1462
+ n.debugSetValue(t);
1463
+ else if (n instanceof ie)
1464
+ n.debugSetValue(t);
1465
+ else if (n instanceof A)
1466
+ n.debugSetValue(t);
1467
+ else
1468
+ throw new O("Observable is not supported");
1469
+ const r = [...n.debugGetObservers()];
1470
+ for (const i of r)
1471
+ i.beginUpdate(n);
1472
+ for (const i of r)
1473
+ i.handleChange(n, void 0);
1474
+ for (const i of r)
1475
+ i.endUpdate(n);
1476
+ },
1477
+ getValue: (e) => {
1478
+ const t = this._aliveInstances.get(e);
1479
+ if (t instanceof w)
1480
+ return M(t.debugGetState().value, 200);
1481
+ if (t instanceof ie)
1482
+ return M(t.debugGetState().value, 200);
1483
+ },
1484
+ logValue: (e) => {
1485
+ const t = this._aliveInstances.get(e);
1486
+ if (t && "get" in t)
1487
+ console.log("Logged Value:", t.get());
1488
+ else
1489
+ throw new O("Observable is not supported");
1490
+ },
1491
+ rerun: (e) => {
1492
+ const t = this._aliveInstances.get(e);
1493
+ if (t instanceof w)
1494
+ t.debugRecompute();
1495
+ else if (t instanceof re)
1496
+ t.debugRerun();
1497
+ else
1498
+ throw new O("Observable is not supported");
1499
+ }
1500
+ }
1501
+ })), this._pendingChanges = null, this._changeThrottler = new ln(), this._fullState = {}, this._flushUpdates = () => {
1502
+ this._pendingChanges !== null && (this._channel.api.notifications.handleChange(this._pendingChanges, !1), this._pendingChanges = null);
1503
+ }, T.enable();
1504
+ }
1505
+ _handleChange(e) {
1506
+ ct(this._fullState, e), this._pendingChanges === null ? this._pendingChanges = e : dt(this._pendingChanges, e), this._changeThrottler.throttle(this._flushUpdates, 10);
1507
+ }
1508
+ _getDeclarationId(e, t) {
1509
+ if (!t)
1510
+ return -1;
1511
+ let n = this._declarations.get(t.id);
1512
+ return n === void 0 && (n = {
1513
+ id: this._declarationId++,
1514
+ type: e,
1515
+ url: t.fileName,
1516
+ line: t.line,
1517
+ column: t.column
1518
+ }, this._declarations.set(t.id, n), this._handleChange({ decls: { [n.id]: n } })), n.id;
1519
+ }
1520
+ handleObservableCreated(e, t) {
1521
+ const r = {
1522
+ declarationId: this._getDeclarationId("observable/value", t),
1523
+ instanceId: this._instanceId++,
1524
+ listenerCount: 0,
1525
+ lastValue: void 0,
1526
+ updateCount: 0,
1527
+ changedObservables: /* @__PURE__ */ new Set()
1528
+ };
1529
+ this._instanceInfos.set(e, r);
1530
+ }
1531
+ handleOnListenerCountChanged(e, t) {
1532
+ const n = this._getObservableInfo(e);
1533
+ if (n) {
1534
+ if (n.listenerCount === 0 && t > 0) {
1535
+ const r = e instanceof w ? "observable/derived" : "observable/value";
1536
+ this._aliveInstances.set(n.instanceId, e), this._handleChange({
1537
+ instances: {
1538
+ [n.instanceId]: {
1539
+ instanceId: n.instanceId,
1540
+ declarationId: n.declarationId,
1541
+ formattedValue: n.lastValue,
1542
+ type: r,
1543
+ name: e.debugName
1544
+ }
1545
+ }
1546
+ });
1547
+ } else n.listenerCount > 0 && t === 0 && (this._handleChange({
1548
+ instances: { [n.instanceId]: null }
1549
+ }), this._aliveInstances.delete(n.instanceId));
1550
+ n.listenerCount = t;
1551
+ }
1552
+ }
1553
+ handleObservableUpdated(e, t) {
1554
+ if (e instanceof w) {
1555
+ this._handleDerivedRecomputed(e, t);
1556
+ return;
1557
+ }
1558
+ const n = this._getObservableInfo(e);
1559
+ n && t.didChange && (n.lastValue = M(t.newValue, 30), n.listenerCount > 0 && this._handleChange({
1560
+ instances: { [n.instanceId]: { formattedValue: n.lastValue } }
1561
+ }));
1562
+ }
1563
+ handleAutorunCreated(e, t) {
1564
+ const r = {
1565
+ declarationId: this._getDeclarationId("autorun", t),
1566
+ instanceId: this._instanceId++,
1567
+ updateCount: 0,
1568
+ changedObservables: /* @__PURE__ */ new Set()
1569
+ };
1570
+ this._instanceInfos.set(e, r), this._aliveInstances.set(r.instanceId, e), r && this._handleChange({
1571
+ instances: {
1572
+ [r.instanceId]: {
1573
+ instanceId: r.instanceId,
1574
+ declarationId: r.declarationId,
1575
+ runCount: 0,
1576
+ type: "autorun",
1577
+ name: e.debugName
1578
+ }
1579
+ }
1580
+ });
1581
+ }
1582
+ handleAutorunDisposed(e) {
1583
+ const t = this._getAutorunInfo(e);
1584
+ t && (this._handleChange({
1585
+ instances: { [t.instanceId]: null }
1586
+ }), this._instanceInfos.delete(e), this._aliveInstances.delete(t.instanceId));
1587
+ }
1588
+ handleAutorunDependencyChanged(e, t, n) {
1589
+ const r = this._getAutorunInfo(e);
1590
+ r && r.changedObservables.add(t);
1591
+ }
1592
+ handleAutorunStarted(e) {
1593
+ }
1594
+ handleAutorunFinished(e) {
1595
+ const t = this._getAutorunInfo(e);
1596
+ t && (t.changedObservables.clear(), t.updateCount++, this._handleChange({
1597
+ instances: { [t.instanceId]: { runCount: t.updateCount } }
1598
+ }));
1599
+ }
1600
+ handleDerivedDependencyChanged(e, t, n) {
1601
+ const r = this._getObservableInfo(e);
1602
+ r && r.changedObservables.add(t);
1603
+ }
1604
+ _handleDerivedRecomputed(e, t) {
1605
+ const n = this._getObservableInfo(e);
1606
+ if (!n)
1607
+ return;
1608
+ const r = M(t.newValue, 30);
1609
+ n.updateCount++, n.changedObservables.clear(), n.lastValue = r, n.listenerCount > 0 && this._handleChange({
1610
+ instances: { [n.instanceId]: { formattedValue: r, recomputationCount: n.updateCount } }
1611
+ });
1612
+ }
1613
+ handleDerivedCleared(e) {
1614
+ const t = this._getObservableInfo(e);
1615
+ t && (t.lastValue = void 0, t.changedObservables.clear(), t.listenerCount > 0 && this._handleChange({
1616
+ instances: {
1617
+ [t.instanceId]: {
1618
+ formattedValue: void 0
1619
+ }
1620
+ }
1621
+ }));
1622
+ }
1623
+ handleBeginTransaction(e) {
1624
+ this._activeTransactions.add(e);
1625
+ }
1626
+ handleEndTransaction(e) {
1627
+ this._activeTransactions.delete(e);
1628
+ }
1629
+ }
1630
+ P._instance = void 0;
1631
+ function hn(s, e) {
1632
+ const t = (e == null ? void 0 : e.debugNamePostProcessor) ?? ((i) => i), n = R.from(s, t);
1633
+ return n ? lt(n, 0, /* @__PURE__ */ new Set()).trim() : "";
1634
+ }
1635
+ function lt(s, e, t) {
1636
+ const n = " ".repeat(e), r = [];
1637
+ if (t.has(s.sourceObj))
1638
+ return r.push(`${n}* ${s.type} ${s.name} (already listed)`), r.join(`
1639
+ `);
1640
+ if (t.add(s.sourceObj), r.push(`${n}* ${s.type} ${s.name}:`), r.push(`${n} value: ${M(s.value, 50)}`), r.push(`${n} state: ${s.state}`), s.dependencies.length > 0) {
1641
+ r.push(`${n} dependencies:`);
1642
+ for (const o of s.dependencies)
1643
+ r.push(lt(o, e + 1, t));
1644
+ }
1645
+ return r.join(`
1646
+ `);
1647
+ }
1648
+ class R {
1649
+ static from(e, t) {
1650
+ if (e instanceof re) {
1651
+ const n = e.debugGetState();
1652
+ return new R(e, t(e.debugName), "autorun", void 0, n.stateStr, Array.from(n.dependencies).map((r) => R.from(r, t) || R.unknown(r)));
1653
+ } else if (e instanceof w) {
1654
+ const n = e.debugGetState();
1655
+ return new R(e, t(e.debugName), "derived", n.value, n.stateStr, Array.from(n.dependencies).map((r) => R.from(r, t) || R.unknown(r)));
1656
+ } else if (e instanceof ie) {
1657
+ const n = e.debugGetState();
1658
+ return new R(e, t(e.debugName), "observableValue", n.value, "upToDate", []);
1659
+ } else if (e instanceof A) {
1660
+ const n = e.debugGetState();
1661
+ return new R(e, t(e.debugName), "fromEvent", n.value, n.hasValue ? "upToDate" : "initial", []);
1662
+ }
1663
+ }
1664
+ static unknown(e) {
1665
+ return new R(e, "(unknown)", "unknown", void 0, "unknown", []);
1666
+ }
1667
+ constructor(e, t, n, r, i, o) {
1668
+ this.sourceObj = e, this.name = t, this.type = n, this.value = r, this.state = i, this.dependencies = o;
1669
+ }
1670
+ }
1671
+ Gt(hn);
1672
+ Et(en);
1673
+ Qe(P.getInstance());
1674
+ class un {
1675
+ constructor() {
1676
+ l(this, "_fixtures", x(this, /* @__PURE__ */ new Map()));
1677
+ /** Observable root of the fixture tree */
1678
+ l(this, "root", F(this, (e) => {
1679
+ const t = this._fixtures.read(e);
1680
+ return le(t);
1681
+ }));
1682
+ }
1683
+ /**
1684
+ * Registers a fixture file.
1685
+ * @param path The file path (e.g., 'components/Button.fixture.tsx')
1686
+ * @param fixtureExport The exported fixture object
1687
+ */
1688
+ register(e, t) {
1689
+ const n = new Map(this._fixtures.get());
1690
+ n.set(e, t), this._fixtures.set(n, void 0);
1691
+ }
1692
+ /**
1693
+ * Unregisters a fixture file.
1694
+ * @param path The file path to remove
1695
+ */
1696
+ unregister(e) {
1697
+ const t = new Map(this._fixtures.get());
1698
+ t.delete(e) && this._fixtures.set(t, void 0);
1699
+ }
1700
+ /**
1701
+ * Clears all registered fixtures.
1702
+ */
1703
+ clear() {
1704
+ this._fixtures.set(/* @__PURE__ */ new Map(), void 0);
1705
+ }
1706
+ /**
1707
+ * Gets a node by path.
1708
+ */
1709
+ getNode(e, t) {
1710
+ const n = this.root.read(e);
1711
+ return Fe(n, t);
1712
+ }
1713
+ /**
1714
+ * Gets a component by path (non-reactive, for use in preview iframe).
1715
+ * @param path Array of path segments (e.g., ['Button', 'Primary'])
1716
+ */
1717
+ getComponentByPath(e) {
1718
+ const t = this._fixtures.get(), n = le(t), r = Fe(n, e);
1719
+ return r == null ? void 0 : r.component;
1720
+ }
1721
+ }
1722
+ class As {
1723
+ constructor(e, t) {
1724
+ l(this, "sessionId", Math.random().toString(36).slice(2));
1725
+ l(this, "_updateVersion", 0);
1726
+ l(this, "_root");
1727
+ l(this, "_fixtureModules");
1728
+ l(this, "_currentDisposable");
1729
+ l(this, "_currentContainer");
1730
+ this._containerElement = e, this._fixtureModules = t, this._root = this._buildRegistry(), this._installGlobalApi();
1731
+ const n = this._flattenFixtures(this._root).length;
1732
+ console.log("[cli] CLI entry initialized, sessionId:", this.sessionId, "version:", this._updateVersion, "fixtures:", n);
1733
+ }
1734
+ get updateVersion() {
1735
+ return this._updateVersion;
1736
+ }
1737
+ updateFixtures(e) {
1738
+ this._fixtureModules = e, this._root = this._buildRegistry(), this._updateVersion++;
1739
+ const t = this._flattenFixtures(this._root).length;
1740
+ console.log("[cli] Registry rebuilt, version:", this._updateVersion, "fixtures:", t);
1741
+ }
1742
+ bumpVersion() {
1743
+ this._updateVersion++, console.log("[cli] Version bumped:", this._updateVersion);
1744
+ }
1745
+ listFixtures() {
1746
+ return this._flattenFixtures(this._root);
1747
+ }
1748
+ async renderFixture(e) {
1749
+ const t = this._findFixtureNode(this._root, e);
1750
+ if (!t || !t.component)
1751
+ throw new Error("Fixture not found: " + e);
1752
+ this._currentDisposable && (this._currentDisposable.dispose(), this._currentDisposable = void 0), this._currentContainer && (this._currentContainer.remove(), this._currentContainer = void 0);
1753
+ const n = document.createElement("div");
1754
+ n.style.display = "inline-block", this._containerElement.appendChild(n), this._currentContainer = n;
1755
+ const r = t.component, i = Dt(r.properties);
1756
+ let o = n;
1757
+ if (r.isolation === "shadow-dom") {
1758
+ const g = n.attachShadow({ mode: "open" });
1759
+ o = document.createElement("div"), g.appendChild(o);
1760
+ }
1761
+ const d = [], c = console.error, h = console.warn;
1762
+ console.error = (...g) => {
1763
+ d.push({ kind: "console", level: "error", message: g.map(String).join(" ") }), c.apply(console, g);
1764
+ }, console.warn = (...g) => {
1765
+ d.push({ kind: "console", level: "warn", message: g.map(String).join(" ") }), h.apply(console, g);
1766
+ };
1767
+ const m = (g) => {
1768
+ var v;
1769
+ d.push({ kind: "exception", message: g.message, stack: (v = g.error) == null ? void 0 : v.stack });
1770
+ }, _ = (g) => {
1771
+ const v = g.reason, E = v instanceof Error ? v.message : String(v), V = v instanceof Error ? v.stack : void 0;
1772
+ d.push({ kind: "exception", message: E, stack: V });
1773
+ };
1774
+ window.addEventListener("error", m), window.addEventListener("unhandledrejection", _);
1775
+ try {
1776
+ const g = r.render(o, i);
1777
+ this._currentDisposable = g && typeof g == "object" && "dispose" in g ? g : void 0;
1778
+ } catch (g) {
1779
+ const v = g instanceof Error ? g : new Error(String(g));
1780
+ d.push({ kind: "exception", message: v.message, stack: v.stack });
1781
+ } finally {
1782
+ console.error = c, console.warn = h;
1783
+ }
1784
+ return await new Promise((g) => requestAnimationFrame(() => requestAnimationFrame(() => g()))), window.removeEventListener("error", m), window.removeEventListener("unhandledrejection", _), { errors: d };
1785
+ }
1786
+ _buildRegistry() {
1787
+ const e = /* @__PURE__ */ new Map();
1788
+ for (const [t, n] of Object.entries(this._fixtureModules)) {
1789
+ const r = n.default;
1790
+ r && typeof r == "object" && e.set(t, r);
1791
+ }
1792
+ return le(e);
1793
+ }
1794
+ _flattenFixtures(e, t = []) {
1795
+ var r;
1796
+ const n = [];
1797
+ e.type === "component" && n.push({ fixtureId: e.id, fixtureName: e.name, groupPath: t, background: ((r = e.component) == null ? void 0 : r.background) ?? "light" });
1798
+ for (const i of e.children ?? []) {
1799
+ const o = e.id ? [...t, e.name] : t;
1800
+ n.push(...this._flattenFixtures(i, o));
1801
+ }
1802
+ return n;
1803
+ }
1804
+ _findFixtureNode(e, t) {
1805
+ if (e.id === t) return e;
1806
+ for (const n of e.children ?? []) {
1807
+ const r = this._findFixtureNode(n, t);
1808
+ if (r) return r;
1809
+ }
1810
+ }
1811
+ _installGlobalApi() {
1812
+ window.__componentExplorerCli__ = {
1813
+ sessionId: this.sessionId,
1814
+ get updateVersion() {
1815
+ return 0;
1816
+ },
1817
+ listFixtures: () => this.listFixtures(),
1818
+ renderFixture: (e) => this.renderFixture(e)
1819
+ }, Object.defineProperty(window.__componentExplorerCli__, "updateVersion", {
1820
+ get: () => this._updateVersion
1821
+ });
1822
+ }
1823
+ }
1824
+ class fn {
1825
+ constructor(e) {
1826
+ this._run = e, this._changes = [], this._map = /* @__PURE__ */ new Map(), this._updateCounter = 0;
1827
+ }
1828
+ addDependency(e, t) {
1829
+ return this._map.set(e, t), e.addObserver(this), {
1830
+ dispose: () => {
1831
+ this._map.delete(e), e.removeObserver(this);
1832
+ }
1833
+ };
1834
+ }
1835
+ beginUpdate(e) {
1836
+ this._updateCounter++, this._changes.push(this._map.get(e));
1837
+ }
1838
+ endUpdate(e) {
1839
+ if (this._updateCounter--, this._updateCounter === 0 && this._changes.length > 0) {
1840
+ const t = this._changes;
1841
+ this._changes = [], this._run(t);
1842
+ }
1843
+ }
1844
+ handlePossibleChange(e) {
1845
+ this._changes.push(this._map.get(e));
1846
+ }
1847
+ handleChange(e, t) {
1848
+ }
1849
+ }
1850
+ function u() {
1851
+ return ge.instance;
1852
+ }
1853
+ function pn() {
1854
+ return me.instance;
1855
+ }
1856
+ function gn() {
1857
+ return ve.instance;
1858
+ }
1859
+ u.const = pn;
1860
+ u.obs = gn;
1861
+ class ge {
1862
+ create(e) {
1863
+ const t = F((n) => e(n));
1864
+ return { read: (n) => t };
1865
+ }
1866
+ }
1867
+ ge.instance = new ge();
1868
+ class me {
1869
+ create(e) {
1870
+ const t = F((n) => e(n));
1871
+ return { read: (n) => t.read(n) };
1872
+ }
1873
+ }
1874
+ me.instance = new me();
1875
+ class ve {
1876
+ create(e) {
1877
+ const t = F((n) => {
1878
+ const r = e(n);
1879
+ return mn(r) ? r.read(n) : r;
1880
+ });
1881
+ return { read: (n) => t };
1882
+ }
1883
+ }
1884
+ ve.instance = new ve();
1885
+ function mn(s) {
1886
+ return typeof s == "object" && s !== null && "read" in s;
1887
+ }
1888
+ function Z(s, e) {
1889
+ return Object.fromEntries(Object.entries(s).map(([t, n]) => [t, e(n, t)]));
1890
+ }
1891
+ const de = Symbol("ViewModelContext");
1892
+ class vn {
1893
+ constructor(e) {
1894
+ this._store = new Y(), this.props = e;
1895
+ }
1896
+ dispose() {
1897
+ this._store.dispose();
1898
+ }
1899
+ }
1900
+ function _n(s) {
1901
+ return s[de] || (s[de] = Je(void 0)), s[de];
1902
+ }
1903
+ function z(s = {}) {
1904
+ var e;
1905
+ return e = class extends vn {
1906
+ }, e._props = s, e;
1907
+ }
1908
+ let _e = 0;
1909
+ const bn = new fn((s) => {
1910
+ for (const e of s)
1911
+ e.rendered = !1;
1912
+ if (_e > 0) {
1913
+ const e = s.find((t) => t.isRendering);
1914
+ e.itemsToRender = s;
1915
+ } else
1916
+ Ze(() => {
1917
+ for (const e of s)
1918
+ e.rendered || e.forceUpdate();
1919
+ });
1920
+ });
1921
+ let yn = 0;
1922
+ class xn {
1923
+ constructor(e, t) {
1924
+ this.debugName = e, this.renderFactory = t, this._obsProps = void 0, this.forceUpdate = void 0, this._render = void 0, this._disposable = void 0, this.contextValues = /* @__PURE__ */ new Map(), this.cleanupEffect = () => () => {
1925
+ var n;
1926
+ (n = this._disposable) == null || n.dispose();
1927
+ }, this.itemsToRender = [], this.handleAfterRender = () => {
1928
+ Ze(() => {
1929
+ for (const n of this.itemsToRender)
1930
+ n.rendered || n.forceUpdate();
1931
+ }), this.itemsToRender = [];
1932
+ }, this.rendering = void 0, this.isRendering = !1, this.rendered = !1;
1933
+ }
1934
+ toString() {
1935
+ return this.debugName;
1936
+ }
1937
+ updateProps(e) {
1938
+ this._obsProps ? this._obsProps.set(e, void 0) : (this._obsProps = x(this, e), this._render = this.renderFactory(this._obsProps, () => this.contextValues), this.rendering = F(this, this._render), this._disposable = bn.addDependency(this.rendering, this));
1939
+ }
1940
+ }
1941
+ function Re(s, e, t) {
1942
+ const n = (o) => o + 1, r = () => new xn(s + ++yn, e), i = function(o) {
1943
+ const d = Ot(n, 0)[1], c = Rt(r)[0];
1944
+ for (const h of t ?? [])
1945
+ c.contextValues.set(h, Tt(h));
1946
+ if (De(c.cleanupEffect, []), De(c.handleAfterRender), c.isRendering)
1947
+ throw new Error("Component is already rendering");
1948
+ c.isRendering = !0, _e++;
1949
+ try {
1950
+ c.forceUpdate = d, c.updateProps(o);
1951
+ const h = c.rendering.get();
1952
+ return c.rendered = !0, h;
1953
+ } finally {
1954
+ c.isRendering = !1, _e--;
1955
+ }
1956
+ };
1957
+ return i.displayName = s, i;
1958
+ }
1959
+ Re("ObsView", (s) => (e) => s.read(e).children(e));
1960
+ function k(s, e) {
1961
+ return Re("view", (t) => {
1962
+ const n = Z(s, (r, i) => r.create((o) => t.read(o)[i], void 0));
1963
+ return (r) => {
1964
+ const i = Z(n, (o) => o.read(r));
1965
+ return e(r, i);
1966
+ };
1967
+ });
1968
+ }
1969
+ function Cn(s) {
1970
+ const e = [];
1971
+ for (const t of Object.values(s)) {
1972
+ const n = t._requiredContext;
1973
+ n && !e.includes(n) && e.push(n);
1974
+ }
1975
+ return e;
1976
+ }
1977
+ function $(s, e, t) {
1978
+ const n = typeof e == "function" ? {} : e, r = typeof e == "function" ? e : t, i = "_props" in s ? s._props : {}, o = Cn({ ...i, ...n }), d = _n(s), c = [...o, d];
1979
+ return Re("viewWithModel", (h, m) => {
1980
+ const _ = m(), g = _.get(d), v = "_props" in s ? Z(s._props, (S, H) => S.create((L) => h.read(L)[H], _.get(S._requiredContext))) : {}, E = g ? { read: () => g, dispose: () => {
1981
+ } } : Jt((S) => {
1982
+ const H = Z(v, (L) => L.read(S));
1983
+ return new s(H);
1984
+ }), V = Z(n, (S, H) => S.create((L) => h.read(L)[H], _.get(S._requiredContext)));
1985
+ return (S) => {
1986
+ const H = E.read(S), L = Z(V, (Ct) => Ct.read(S));
1987
+ return r(S, H, L);
1988
+ };
1989
+ }, c.length > 0 ? c : void 0);
1990
+ }
1991
+ k({ value: u.obs() }, (s, e) => e.value.read(s));
1992
+ Je(null);
1993
+ function ht(s) {
1994
+ var e;
1995
+ return {
1996
+ id: s.id,
1997
+ name: s.name,
1998
+ type: s.type,
1999
+ children: (e = s.children) == null ? void 0 : e.map(ht),
2000
+ component: s.component
2001
+ };
2002
+ }
2003
+ function te(s, e) {
2004
+ const {
2005
+ storageKey: t,
2006
+ defaultValue: n,
2007
+ serialize: r = JSON.stringify,
2008
+ deserialize: i = JSON.parse
2009
+ } = e;
2010
+ let o = n;
2011
+ try {
2012
+ const h = localStorage.getItem(t);
2013
+ h !== null && (o = i(h));
2014
+ } catch {
2015
+ }
2016
+ const d = x(s, o), c = d.set.bind(d);
2017
+ return d.set = (h, m) => {
2018
+ try {
2019
+ localStorage.setItem(t, r(h));
2020
+ } catch {
2021
+ }
2022
+ c(h, m);
2023
+ }, d;
2024
+ }
2025
+ class Sn extends z({
2026
+ registry: u.const(),
2027
+ daemonModel: u.const(),
2028
+ reportModel: u.const()
2029
+ }) {
2030
+ constructor() {
2031
+ super(...arguments);
2032
+ l(this, "leftSidebarVisible", te(this, {
2033
+ storageKey: "component-explorer:leftSidebarVisible",
2034
+ defaultValue: !0
2035
+ }));
2036
+ l(this, "rightSidebarVisible", te(this, {
2037
+ storageKey: "component-explorer:rightSidebarVisible",
2038
+ defaultValue: !1
2039
+ }));
2040
+ l(this, "isDarkTheme", te(this, {
2041
+ storageKey: "component-explorer:isDarkTheme",
2042
+ defaultValue: !0
2043
+ }));
2044
+ l(this, "selectedNodeId", te(this, {
2045
+ storageKey: "component-explorer:selectedNodeId",
2046
+ defaultValue: void 0
2047
+ }));
2048
+ l(this, "expandedNodeIds", x(this, /* @__PURE__ */ new Set([""])));
2049
+ l(this, "viewMode", te(this, {
2050
+ storageKey: "component-explorer:viewMode",
2051
+ defaultValue: "session"
2052
+ }));
2053
+ /** The explorer's tree derived from the registry or report */
2054
+ l(this, "tree", F(this, (t) => {
2055
+ const n = this.props.reportModel;
2056
+ if (n)
2057
+ return n.buildTree(t);
2058
+ const r = this.props.registry.root.read(t);
2059
+ return ht(r);
2060
+ }));
2061
+ l(this, "selectedNode", F(this, (t) => {
2062
+ const n = this.selectedNodeId.read(t);
2063
+ if (n === void 0) return;
2064
+ const r = this.tree.read(t);
2065
+ return r.id === n ? r : this._findNode(r.children ?? [], n);
2066
+ }));
2067
+ /** List of preview rows to render based on current selection and view mode */
2068
+ l(this, "selectedFixtures", F(this, (t) => {
2069
+ const n = this.selectedNode.read(t);
2070
+ return n ? this.isReportMode ? (this.props.reportModel.state.read(t), this._collectReportRows(n, n.name)) : this.viewMode.read(t) === "diff" && this.daemonAvailable ? this._collectDiffRows(n, n.name) : this._collectPreviewRows(n, n.name) : [];
2071
+ }));
2072
+ l(this, "setViewMode", (t) => {
2073
+ this.viewMode.set(t, void 0);
2074
+ });
2075
+ l(this, "navigateToSession", (t) => {
2076
+ const n = this.props.daemonModel;
2077
+ if (!n) return;
2078
+ const r = n.getSessionExplorerUrl(t);
2079
+ r && (window.location.href = r);
2080
+ });
2081
+ l(this, "toggleLeftSidebar", () => {
2082
+ this.leftSidebarVisible.set(!this.leftSidebarVisible.get(), void 0);
2083
+ });
2084
+ l(this, "toggleRightSidebar", () => {
2085
+ this.rightSidebarVisible.set(!this.rightSidebarVisible.get(), void 0);
2086
+ });
2087
+ l(this, "toggleTheme", () => {
2088
+ this.isDarkTheme.set(!this.isDarkTheme.get(), void 0);
2089
+ });
2090
+ l(this, "selectNode", (t) => {
2091
+ this.selectedNodeId.set(t, void 0);
2092
+ });
2093
+ l(this, "toggleNodeExpanded", (t) => {
2094
+ const n = this.expandedNodeIds.get(), r = new Set(n);
2095
+ r.has(t) ? r.delete(t) : r.add(t), this.expandedNodeIds.set(r, void 0);
2096
+ });
2097
+ }
2098
+ get daemonAvailable() {
2099
+ return this.props.daemonModel !== void 0;
2100
+ }
2101
+ get daemon() {
2102
+ return this.props.daemonModel;
2103
+ }
2104
+ get reportModel() {
2105
+ return this.props.reportModel;
2106
+ }
2107
+ get isReportMode() {
2108
+ return this.props.reportModel !== void 0;
2109
+ }
2110
+ isNodeExpanded(t, n) {
2111
+ return this.expandedNodeIds.read(n).has(t);
2112
+ }
2113
+ _findNode(t, n) {
2114
+ for (const r of t) {
2115
+ if (r.id === n) return r;
2116
+ if (r.children) {
2117
+ const i = this._findNode(r.children, n);
2118
+ if (i) return i;
2119
+ }
2120
+ }
2121
+ }
2122
+ _collectPreviewRows(t, n) {
2123
+ if (t.type === "component" && t.component)
2124
+ return [{
2125
+ type: "single",
2126
+ fixture: {
2127
+ id: t.id,
2128
+ name: t.name,
2129
+ path: n,
2130
+ component: t.component
2131
+ }
2132
+ }];
2133
+ if (t.type === "variants") {
2134
+ const i = [];
2135
+ for (const o of t.children ?? [])
2136
+ o.type === "component" && o.component && i.push({
2137
+ id: o.id,
2138
+ name: o.name,
2139
+ path: `${n} / ${o.name}`,
2140
+ component: o.component
2141
+ });
2142
+ return i.length > 0 ? [{
2143
+ type: "variants",
2144
+ id: t.id,
2145
+ name: t.name,
2146
+ path: n,
2147
+ fixtures: i
2148
+ }] : [];
2149
+ }
2150
+ const r = [];
2151
+ for (const i of t.children ?? []) {
2152
+ const o = n ? `${n} / ${i.name}` : i.name;
2153
+ r.push(...this._collectPreviewRows(i, o));
2154
+ }
2155
+ return r;
2156
+ }
2157
+ /**
2158
+ * In diff mode: fixtures become screenshot comparison items showing current vs baseline.
2159
+ * Variants become comparison groups.
2160
+ */
2161
+ _collectDiffRows(t, n) {
2162
+ if (t.type === "component")
2163
+ return [{
2164
+ type: "screenshot-comparison",
2165
+ id: t.id,
2166
+ name: t.name,
2167
+ path: n,
2168
+ items: [{
2169
+ fixtureId: t.id,
2170
+ name: t.name,
2171
+ path: n
2172
+ }]
2173
+ }];
2174
+ if (t.type === "variants") {
2175
+ const i = [];
2176
+ for (const o of t.children ?? [])
2177
+ o.type === "component" && i.push({
2178
+ fixtureId: o.id,
2179
+ name: o.name,
2180
+ path: `${n} / ${o.name}`
2181
+ });
2182
+ return i.length > 0 ? [{
2183
+ type: "screenshot-comparison",
2184
+ id: t.id,
2185
+ name: t.name,
2186
+ path: n,
2187
+ items: i
2188
+ }] : [];
2189
+ }
2190
+ const r = [];
2191
+ for (const i of t.children ?? []) {
2192
+ const o = n ? `${n} / ${i.name}` : i.name;
2193
+ r.push(...this._collectDiffRows(i, o));
2194
+ }
2195
+ return r;
2196
+ }
2197
+ _collectReportRows(t, n) {
2198
+ const r = this.props.reportModel.state.get();
2199
+ if (r.status !== "ready") return [];
2200
+ const i = r.report.fixtures;
2201
+ if (t.type === "component") {
2202
+ const d = i[t.id];
2203
+ return d ? [{
2204
+ type: "report-comparison",
2205
+ id: t.id,
2206
+ name: t.name,
2207
+ path: n,
2208
+ items: [{
2209
+ fixtureId: t.id,
2210
+ name: t.name,
2211
+ path: n,
2212
+ entry: d
2213
+ }]
2214
+ }] : [];
2215
+ }
2216
+ const o = [];
2217
+ for (const d of t.children ?? []) {
2218
+ const c = n ? `${n} / ${d.name}` : d.name;
2219
+ o.push(...this._collectReportRows(d, c));
2220
+ }
2221
+ return o;
2222
+ }
2223
+ }
2224
+ const p = {
2225
+ container: {
2226
+ display: "flex",
2227
+ flexDirection: "row",
2228
+ height: "100%",
2229
+ width: "100%",
2230
+ fontFamily: "var(--vscode-font-family)",
2231
+ fontSize: "var(--vscode-font-size)",
2232
+ color: "var(--vscode-foreground)",
2233
+ backgroundColor: "var(--vscode-editor-background)"
2234
+ },
2235
+ centerArea: {
2236
+ display: "flex",
2237
+ flexDirection: "column",
2238
+ flex: 1,
2239
+ overflow: "hidden"
2240
+ },
2241
+ titleBar: {
2242
+ display: "flex",
2243
+ alignItems: "center",
2244
+ justifyContent: "space-between",
2245
+ height: "35px",
2246
+ minHeight: "35px",
2247
+ padding: "0 10px",
2248
+ backgroundColor: "var(--vscode-titleBar-activeBackground)",
2249
+ color: "var(--vscode-titleBar-activeForeground)",
2250
+ borderBottom: "1px solid var(--vscode-titleBar-border, var(--vscode-panel-border))"
2251
+ },
2252
+ titleBarSection: {
2253
+ display: "flex",
2254
+ alignItems: "center",
2255
+ gap: "2px"
2256
+ },
2257
+ titleBarCenter: {
2258
+ display: "flex",
2259
+ alignItems: "center",
2260
+ gap: "4px",
2261
+ fontSize: "13px",
2262
+ fontWeight: 400
2263
+ },
2264
+ titleBarButton: {
2265
+ display: "flex",
2266
+ alignItems: "center",
2267
+ justifyContent: "center",
2268
+ width: "28px",
2269
+ height: "28px",
2270
+ border: "none",
2271
+ background: "transparent",
2272
+ color: "var(--vscode-titleBar-activeForeground)",
2273
+ cursor: "pointer",
2274
+ borderRadius: "4px"
2275
+ },
2276
+ titleBarButtonHover: {
2277
+ backgroundColor: "var(--vscode-toolbar-hoverBackground)"
2278
+ },
2279
+ titleBarButtonActive: {
2280
+ backgroundColor: "var(--vscode-toolbar-activeBackground)",
2281
+ color: "var(--vscode-focusBorder)"
2282
+ },
2283
+ sidebar: {
2284
+ display: "flex",
2285
+ flexDirection: "column",
2286
+ width: "260px",
2287
+ minWidth: "200px",
2288
+ backgroundColor: "var(--vscode-sideBar-background)",
2289
+ borderRight: "1px solid var(--vscode-titleBar-border, var(--vscode-panel-border))"
2290
+ },
2291
+ sidebarRight: {
2292
+ borderRight: "none",
2293
+ borderLeft: "1px solid var(--vscode-titleBar-border, var(--vscode-panel-border))"
2294
+ },
2295
+ sidebarHeader: {
2296
+ display: "flex",
2297
+ alignItems: "center",
2298
+ height: "35px",
2299
+ minHeight: "35px",
2300
+ padding: "0 12px",
2301
+ fontSize: "11px",
2302
+ fontWeight: 700,
2303
+ textTransform: "uppercase",
2304
+ letterSpacing: "0.04em",
2305
+ color: "var(--vscode-titleBar-activeForeground)",
2306
+ backgroundColor: "var(--vscode-titleBar-activeBackground)",
2307
+ borderBottom: "1px solid var(--vscode-titleBar-border, var(--vscode-panel-border))"
2308
+ },
2309
+ sidebarContent: {
2310
+ flex: 1,
2311
+ overflow: "auto",
2312
+ padding: "4px 0"
2313
+ },
2314
+ treeItem: {
2315
+ display: "flex",
2316
+ alignItems: "center",
2317
+ height: "22px",
2318
+ paddingRight: "8px",
2319
+ cursor: "pointer",
2320
+ userSelect: "none"
2321
+ },
2322
+ treeItemSelected: {
2323
+ backgroundColor: "var(--vscode-list-activeSelectionBackground)",
2324
+ color: "var(--vscode-list-activeSelectionForeground)"
2325
+ },
2326
+ treeItemHover: {
2327
+ backgroundColor: "var(--vscode-list-hoverBackground)"
2328
+ },
2329
+ treeItemChevron: {
2330
+ display: "flex",
2331
+ alignItems: "center",
2332
+ justifyContent: "center",
2333
+ width: "16px",
2334
+ height: "16px",
2335
+ color: "var(--vscode-foreground)",
2336
+ opacity: 0.8,
2337
+ cursor: "pointer"
2338
+ },
2339
+ treeItemChevronPlaceholder: {
2340
+ width: "16px"
2341
+ },
2342
+ treeItemIcon: {
2343
+ display: "flex",
2344
+ alignItems: "center",
2345
+ justifyContent: "center",
2346
+ width: "16px",
2347
+ height: "16px",
2348
+ marginRight: "4px"
2349
+ },
2350
+ treeItemLabel: {
2351
+ flex: 1,
2352
+ overflow: "hidden",
2353
+ textOverflow: "ellipsis",
2354
+ whiteSpace: "nowrap",
2355
+ fontSize: "13px"
2356
+ },
2357
+ treeItemCount: {
2358
+ marginLeft: "8px",
2359
+ fontSize: "11px",
2360
+ color: "var(--vscode-descriptionForeground)"
2361
+ },
2362
+ mainContent: {
2363
+ flex: 1,
2364
+ display: "flex",
2365
+ alignItems: "center",
2366
+ justifyContent: "center",
2367
+ backgroundColor: "var(--vscode-editor-background)",
2368
+ color: "var(--vscode-descriptionForeground)",
2369
+ fontSize: "14px"
2370
+ },
2371
+ propertiesPanel: {
2372
+ padding: "12px"
2373
+ },
2374
+ propertyRow: {
2375
+ marginBottom: "12px"
2376
+ },
2377
+ propertyLabel: {
2378
+ fontSize: "12px",
2379
+ color: "var(--vscode-foreground)",
2380
+ marginBottom: "4px"
2381
+ },
2382
+ propertyDescription: {
2383
+ fontSize: "11px",
2384
+ color: "var(--vscode-descriptionForeground)",
2385
+ marginTop: "2px"
2386
+ },
2387
+ propertyInput: {
2388
+ width: "100%",
2389
+ height: "26px",
2390
+ padding: "0 8px",
2391
+ fontSize: "13px",
2392
+ color: "var(--vscode-input-foreground)",
2393
+ backgroundColor: "var(--vscode-input-background)",
2394
+ border: "1px solid var(--vscode-input-border, transparent)",
2395
+ borderRadius: "2px",
2396
+ outline: "none",
2397
+ boxSizing: "border-box"
2398
+ },
2399
+ propertySelect: {
2400
+ width: "100%",
2401
+ height: "26px",
2402
+ padding: "0 8px",
2403
+ fontSize: "13px",
2404
+ color: "var(--vscode-dropdown-foreground)",
2405
+ backgroundColor: "var(--vscode-dropdown-background)",
2406
+ border: "1px solid var(--vscode-dropdown-border)",
2407
+ borderRadius: "2px",
2408
+ outline: "none",
2409
+ boxSizing: "border-box",
2410
+ cursor: "pointer"
2411
+ }
2412
+ };
2413
+ function Te(...s) {
2414
+ return Object.assign({}, ...s.filter(Boolean));
2415
+ }
2416
+ class wn extends z({
2417
+ active: u()
2418
+ }) {
2419
+ constructor() {
2420
+ super(...arguments);
2421
+ l(this, "isHovered", x(this, !1));
2422
+ l(this, "setHovered", (t) => {
2423
+ this.isHovered.set(t, void 0);
2424
+ });
2425
+ }
2426
+ get active() {
2427
+ return this.props.active;
2428
+ }
2429
+ }
2430
+ const ce = $(
2431
+ wn,
2432
+ {
2433
+ onClick: u.const(),
2434
+ title: u.const(),
2435
+ children: u.const()
2436
+ },
2437
+ (s, e, t) => {
2438
+ const n = e.isHovered.read(s), r = e.active.read(s), i = Te(
2439
+ p.titleBarButton,
2440
+ n && !r && p.titleBarButtonHover,
2441
+ r && p.titleBarButtonActive
2442
+ );
2443
+ return /* @__PURE__ */ a(
2444
+ "button",
2445
+ {
2446
+ style: i,
2447
+ onClick: t.onClick,
2448
+ title: t.title,
2449
+ onMouseEnter: () => e.setHovered(!0),
2450
+ onMouseLeave: () => e.setHovered(!1),
2451
+ children: t.children
2452
+ }
2453
+ );
2454
+ }
2455
+ ), In = ({ style: s }) => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", style: s, children: /* @__PURE__ */ a("path", { d: "M5.7 13.7L5 13l4.6-4.6L5 3.7l.7-.7 5.3 5.4-5.3 5.3z" }) }), On = ({ style: s }) => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", style: s, children: /* @__PURE__ */ a("path", { d: "M11 5.5L6 10.5L5.3 9.8L9.6 5.5L5.3 1.2L6 0.5L11 5.5z", transform: "rotate(90 8 5.5)" }) }), Rn = ({ style: s }) => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", style: s, children: /* @__PURE__ */ a("path", { d: "M14.5 2H9l-.35.15-.65.64-.65-.64L7 2H1.5l-.5.5v10l.5.5H7l.35-.15.65-.64.65.64.35.15h5.5l.5-.5v-10l-.5-.5zm-7 10H2V3h5v.86L5.85 5l1.15 1.14V10l-1.15-1.14L7 7.72V12zm6 0H8V7.72l1.15 1.14L8 10V6.14L9.15 5 8 3.86V3h5v9z" }) }), Tn = ({ style: s }) => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", style: s, children: /* @__PURE__ */ a("path", { d: "M14.5 3H7.71l-.85-.85L6.5 2h-5l-.5.5v11l.5.5h13l.5-.5v-10l-.5-.5zm-.5 10H2V6h12v7zm0-8H2V3h4.29l.85.85.36.15H14v1z" }) }), kn = () => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ a("path", { d: "M2 2v12h12V2H2zm11 11H6V3h7v10zM3 3h2v10H3V3z" }) }), Vn = () => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ a("path", { d: "M2 2v12h12V2H2zm6 11V3h5v10H8zM3 3h4v10H3V3z" }) }), Nn = () => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ a("path", { d: "M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z" }) }), Dn = () => /* @__PURE__ */ a("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ a("path", { d: "M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z" }) }), Mn = k(
2456
+ { model: u.const() },
2457
+ (s, e) => {
2458
+ var d, c;
2459
+ const t = e.model, n = t.viewMode.read(s), r = ((d = t.daemon) == null ? void 0 : d.sessions.read(s)) ?? [], i = (c = t.daemon) == null ? void 0 : c.sessionName, o = r.filter((h) => h.name !== i);
2460
+ return /* @__PURE__ */ f("div", { style: X.container, children: [
2461
+ /* @__PURE__ */ f("div", { style: X.segmentedControl, children: [
2462
+ /* @__PURE__ */ a(Le, { label: "Live", mode: "session", active: n === "session", onClick: () => t.setViewMode("session") }),
2463
+ /* @__PURE__ */ a(Le, { label: "Diff", mode: "diff", active: n === "diff", onClick: () => t.setViewMode("diff") })
2464
+ ] }),
2465
+ o.length > 0 && /* @__PURE__ */ a("div", { style: X.sessionLinks, children: o.map((h) => /* @__PURE__ */ f(
2466
+ "button",
2467
+ {
2468
+ style: X.sessionLink,
2469
+ onClick: () => t.navigateToSession(h.name),
2470
+ title: `Switch to ${h.name} session`,
2471
+ children: [
2472
+ "→ ",
2473
+ h.name
2474
+ ]
2475
+ },
2476
+ h.name
2477
+ )) })
2478
+ ] });
2479
+ }
2480
+ );
2481
+ function Le({ label: s, mode: e, active: t, onClick: n }) {
2482
+ return /* @__PURE__ */ a(
2483
+ "button",
2484
+ {
2485
+ style: t ? X.segmentActive : X.segment,
2486
+ onClick: n,
2487
+ children: s
2488
+ }
2489
+ );
2490
+ }
2491
+ const Fn = k(
2492
+ {
2493
+ model: u.const()
2494
+ },
2495
+ (s, e) => {
2496
+ const t = e.model, n = t.leftSidebarVisible.read(s), r = t.rightSidebarVisible.read(s), i = t.isDarkTheme.read(s), o = t.selectedNode.read(s);
2497
+ return /* @__PURE__ */ f("div", { style: p.titleBar, children: [
2498
+ /* @__PURE__ */ a("div", { style: p.titleBarSection, children: /* @__PURE__ */ a(
2499
+ ce,
2500
+ {
2501
+ active: n,
2502
+ onClick: t.toggleLeftSidebar,
2503
+ title: "Toggle left sidebar",
2504
+ children: /* @__PURE__ */ a(kn, {})
2505
+ }
2506
+ ) }),
2507
+ /* @__PURE__ */ f("div", { style: p.titleBarCenter, children: [
2508
+ t.isReportMode ? /* @__PURE__ */ a("span", { style: { fontSize: 12, color: "var(--vscode-descriptionForeground)" }, children: "Screenshot Report" }) : t.daemonAvailable ? /* @__PURE__ */ a(Mn, { model: t }) : null,
2509
+ o ? /* @__PURE__ */ f(ye, { children: [
2510
+ /* @__PURE__ */ a("span", { style: { color: "var(--vscode-textLink-foreground)" }, children: "<" }),
2511
+ /* @__PURE__ */ a("span", { children: o.name }),
2512
+ /* @__PURE__ */ a("span", { style: { color: "var(--vscode-textLink-foreground)" }, children: "/>" })
2513
+ ] }) : /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: "No component selected" })
2514
+ ] }),
2515
+ /* @__PURE__ */ f("div", { style: p.titleBarSection, children: [
2516
+ /* @__PURE__ */ a(
2517
+ ce,
2518
+ {
2519
+ active: !1,
2520
+ onClick: t.toggleTheme,
2521
+ title: i ? "Switch to light theme" : "Switch to dark theme",
2522
+ children: i ? /* @__PURE__ */ a(Nn, {}) : /* @__PURE__ */ a(Dn, {})
2523
+ }
2524
+ ),
2525
+ /* @__PURE__ */ a(
2526
+ ce,
2527
+ {
2528
+ active: r,
2529
+ onClick: t.toggleRightSidebar,
2530
+ title: "Toggle right sidebar",
2531
+ children: /* @__PURE__ */ a(Vn, {})
2532
+ }
2533
+ )
2534
+ ] })
2535
+ ] });
2536
+ }
2537
+ ), X = {
2538
+ container: {
2539
+ display: "flex",
2540
+ alignItems: "center",
2541
+ gap: 8,
2542
+ marginRight: 12
2543
+ },
2544
+ segmentedControl: {
2545
+ display: "flex",
2546
+ borderRadius: 4,
2547
+ overflow: "hidden",
2548
+ border: "1px solid var(--vscode-panel-border)"
2549
+ },
2550
+ segment: {
2551
+ padding: "2px 10px",
2552
+ fontSize: 11,
2553
+ fontWeight: 500,
2554
+ border: "none",
2555
+ background: "transparent",
2556
+ color: "var(--vscode-descriptionForeground)",
2557
+ cursor: "pointer"
2558
+ },
2559
+ segmentActive: {
2560
+ padding: "2px 10px",
2561
+ fontSize: 11,
2562
+ fontWeight: 500,
2563
+ border: "none",
2564
+ background: "var(--vscode-button-background)",
2565
+ color: "var(--vscode-button-foreground)",
2566
+ cursor: "pointer"
2567
+ },
2568
+ sessionLinks: {
2569
+ display: "flex",
2570
+ gap: 4
2571
+ },
2572
+ sessionLink: {
2573
+ padding: "2px 8px",
2574
+ fontSize: 11,
2575
+ border: "1px solid var(--vscode-panel-border)",
2576
+ borderRadius: 4,
2577
+ background: "transparent",
2578
+ color: "var(--vscode-textLink-foreground)",
2579
+ cursor: "pointer"
2580
+ }
2581
+ }, ut = k(
2582
+ {
2583
+ model: u.const(),
2584
+ nodes: u.const(),
2585
+ depth: u.const()
2586
+ },
2587
+ (s, e) => /* @__PURE__ */ a(ye, { children: e.nodes.map((t) => /* @__PURE__ */ a(An, { model: e.model, node: t, depth: e.depth }, t.id)) })
2588
+ );
2589
+ class En extends z({
2590
+ model: u.const(),
2591
+ node: u.const(),
2592
+ depth: u.const()
2593
+ }) {
2594
+ constructor() {
2595
+ super(...arguments);
2596
+ l(this, "isHovered", x(this, !1));
2597
+ l(this, "setHovered", (t) => {
2598
+ this.isHovered.set(t, void 0);
2599
+ });
2600
+ l(this, "handleClick", () => {
2601
+ this.props.model.selectNode(this.props.node.id);
2602
+ });
2603
+ l(this, "handleDoubleClick", () => {
2604
+ this._hasChildren && this.props.model.toggleNodeExpanded(this.props.node.id);
2605
+ });
2606
+ l(this, "handleChevronClick", (t) => {
2607
+ t.stopPropagation(), this.props.model.toggleNodeExpanded(this.props.node.id);
2608
+ });
2609
+ }
2610
+ // Expose props for render function
2611
+ get explorerModel() {
2612
+ return this.props.model;
2613
+ }
2614
+ get treeNode() {
2615
+ return this.props.node;
2616
+ }
2617
+ get treeDepth() {
2618
+ return this.props.depth;
2619
+ }
2620
+ get _hasChildren() {
2621
+ return !!(this.props.node.children && this.props.node.children.length > 0);
2622
+ }
2623
+ }
2624
+ const An = $(En, {}, (s, e) => {
2625
+ const t = e.explorerModel, n = e.treeNode, r = e.treeDepth, i = !!(n.children && n.children.length > 0), o = i ? t.isNodeExpanded(n.id, s) : !1, c = t.selectedNodeId.read(s) === n.id, h = e.isHovered.read(s), m = Te(
2626
+ p.treeItem,
2627
+ { paddingLeft: `${8 + r * 12}px` },
2628
+ c && p.treeItemSelected,
2629
+ !c && h && p.treeItemHover
2630
+ );
2631
+ return /* @__PURE__ */ f(ye, { children: [
2632
+ /* @__PURE__ */ f(
2633
+ "div",
2634
+ {
2635
+ style: m,
2636
+ onClick: e.handleClick,
2637
+ onDoubleClick: e.handleDoubleClick,
2638
+ onMouseEnter: () => e.setHovered(!0),
2639
+ onMouseLeave: () => e.setHovered(!1),
2640
+ children: [
2641
+ i ? /* @__PURE__ */ a("div", { style: p.treeItemChevron, onClick: e.handleChevronClick, children: o ? /* @__PURE__ */ a(On, {}) : /* @__PURE__ */ a(In, {}) }) : /* @__PURE__ */ a("div", { style: p.treeItemChevronPlaceholder }),
2642
+ /* @__PURE__ */ a("div", { style: p.treeItemIcon, children: n.type === "folder" ? /* @__PURE__ */ a(Tn, { style: { color: "var(--vscode-symbolIcon-folderForeground)" } }) : /* @__PURE__ */ a(Rn, { style: { color: "#deb45b" } }) }),
2643
+ /* @__PURE__ */ a("span", { style: p.treeItemLabel, children: n.name }),
2644
+ i && /* @__PURE__ */ a("span", { style: p.treeItemCount, children: n.children.length })
2645
+ ]
2646
+ }
2647
+ ),
2648
+ i && o && /* @__PURE__ */ a(ut, { model: t, nodes: n.children, depth: r + 1 })
2649
+ ] });
2650
+ }), Bn = k(
2651
+ {
2652
+ model: u.const()
2653
+ },
2654
+ (s, e) => {
2655
+ const t = e.model.tree.read(s);
2656
+ return /* @__PURE__ */ f("div", { style: p.sidebar, children: [
2657
+ /* @__PURE__ */ a("div", { style: p.sidebarHeader, children: "Explorer" }),
2658
+ /* @__PURE__ */ a("div", { style: p.sidebarContent, children: /* @__PURE__ */ a(ut, { model: e.model, nodes: [t], depth: 0 }) })
2659
+ ] });
2660
+ }
2661
+ );
2662
+ class zn extends z({}) {
2663
+ constructor() {
2664
+ super(...arguments);
2665
+ l(this, "checked", x(this, !1));
2666
+ l(this, "toggle", () => {
2667
+ this.checked.set(!this.checked.get(), void 0);
2668
+ });
2669
+ }
2670
+ }
2671
+ const $n = $(zn, {}, (s, e) => {
2672
+ const t = e.checked.read(s), n = {
2673
+ position: "relative",
2674
+ width: "36px",
2675
+ height: "18px",
2676
+ backgroundColor: t ? "var(--vscode-button-background)" : "var(--vscode-input-background)",
2677
+ borderRadius: "9px",
2678
+ cursor: "pointer",
2679
+ transition: "background-color 0.2s",
2680
+ border: "1px solid var(--vscode-input-border, transparent)"
2681
+ }, r = {
2682
+ position: "absolute",
2683
+ top: "2px",
2684
+ left: t ? "18px" : "2px",
2685
+ width: "12px",
2686
+ height: "12px",
2687
+ backgroundColor: "var(--vscode-foreground)",
2688
+ borderRadius: "50%",
2689
+ transition: "left 0.2s"
2690
+ };
2691
+ return /* @__PURE__ */ a("div", { style: n, onClick: e.toggle, children: /* @__PURE__ */ a("div", { style: r }) });
2692
+ }), Hn = k(
2693
+ {
2694
+ node: u.const()
2695
+ },
2696
+ (s, e) => e.node.type !== "component" ? /* @__PURE__ */ a("div", { style: { padding: "12px", color: "var(--vscode-descriptionForeground)", fontSize: "12px" }, children: "Select a component (not a folder) to view its properties" }) : /* @__PURE__ */ f("div", { style: p.propertiesPanel, children: [
2697
+ /* @__PURE__ */ f("div", { style: p.propertyRow, children: [
2698
+ /* @__PURE__ */ f("div", { style: p.propertyLabel, children: [
2699
+ "children",
2700
+ /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: " : string" })
2701
+ ] }),
2702
+ /* @__PURE__ */ a(
2703
+ "input",
2704
+ {
2705
+ type: "text",
2706
+ style: p.propertyInput,
2707
+ defaultValue: "Click me",
2708
+ placeholder: "Enter text..."
2709
+ }
2710
+ ),
2711
+ /* @__PURE__ */ a("div", { style: p.propertyDescription, children: "Button text content" })
2712
+ ] }),
2713
+ /* @__PURE__ */ f("div", { style: p.propertyRow, children: [
2714
+ /* @__PURE__ */ f("div", { style: p.propertyLabel, children: [
2715
+ "variant",
2716
+ /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: " : select" })
2717
+ ] }),
2718
+ /* @__PURE__ */ f("select", { style: p.propertySelect, defaultValue: "default", children: [
2719
+ /* @__PURE__ */ a("option", { value: "default", children: "default" }),
2720
+ /* @__PURE__ */ a("option", { value: "primary", children: "primary" }),
2721
+ /* @__PURE__ */ a("option", { value: "secondary", children: "secondary" }),
2722
+ /* @__PURE__ */ a("option", { value: "destructive", children: "destructive" })
2723
+ ] }),
2724
+ /* @__PURE__ */ a("div", { style: p.propertyDescription, children: "Visual style variant" })
2725
+ ] }),
2726
+ /* @__PURE__ */ f("div", { style: p.propertyRow, children: [
2727
+ /* @__PURE__ */ f("div", { style: p.propertyLabel, children: [
2728
+ "size",
2729
+ /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: " : select" })
2730
+ ] }),
2731
+ /* @__PURE__ */ f("select", { style: p.propertySelect, defaultValue: "default", children: [
2732
+ /* @__PURE__ */ a("option", { value: "sm", children: "sm" }),
2733
+ /* @__PURE__ */ a("option", { value: "default", children: "default" }),
2734
+ /* @__PURE__ */ a("option", { value: "lg", children: "lg" })
2735
+ ] }),
2736
+ /* @__PURE__ */ a("div", { style: p.propertyDescription, children: "Button size" })
2737
+ ] }),
2738
+ /* @__PURE__ */ f("div", { style: p.propertyRow, children: [
2739
+ /* @__PURE__ */ f("div", { style: p.propertyLabel, children: [
2740
+ "disabled",
2741
+ /* @__PURE__ */ a("span", { style: { color: "var(--vscode-descriptionForeground)" }, children: " : boolean" })
2742
+ ] }),
2743
+ /* @__PURE__ */ a($n, {}),
2744
+ /* @__PURE__ */ a("div", { style: p.propertyDescription, children: "Disable the button" })
2745
+ ] })
2746
+ ] })
2747
+ ), Ln = k(
2748
+ {
2749
+ selectedNode: u.const()
2750
+ },
2751
+ (s, e) => /* @__PURE__ */ f("div", { style: Te(p.sidebar, p.sidebarRight), children: [
2752
+ /* @__PURE__ */ f("div", { style: p.sidebarHeader, children: [
2753
+ /* @__PURE__ */ a("span", { style: { marginRight: "6px", color: "var(--vscode-textLink-foreground)" }, children: "</>" }),
2754
+ "Props"
2755
+ ] }),
2756
+ /* @__PURE__ */ a("div", { style: p.sidebarContent, children: e.selectedNode ? /* @__PURE__ */ a(Hn, { node: e.selectedNode }) : /* @__PURE__ */ a("div", { style: { padding: "12px", color: "var(--vscode-descriptionForeground)", fontSize: "12px" }, children: "Select a component to view its properties" }) })
2757
+ ] })
2758
+ );
2759
+ class Un extends z({
2760
+ fixture: u.const(),
2761
+ compact: u.const()
2762
+ }) {
2763
+ constructor() {
2764
+ super(...arguments);
2765
+ l(this, "_containerRef", null);
2766
+ l(this, "_shadowRoot", null);
2767
+ l(this, "_renderContainer", null);
2768
+ l(this, "_disposable", null);
2769
+ l(this, "_resizeObserver", null);
2770
+ l(this, "measuredWidth", x(this, void 0));
2771
+ l(this, "measuredHeight", x(this, void 0));
2772
+ l(this, "setContainerRef", (t) => {
2773
+ if (t === this._containerRef || (this._cleanup(), this._containerRef = t, !t)) return;
2774
+ const n = this.fixture.component;
2775
+ n.isolation === "shadow-dom" ? this._renderInShadowDom(t, n) : this._renderDirect(t, n);
2776
+ const r = this._renderContainer ?? t;
2777
+ this._resizeObserver = new ResizeObserver((i) => {
2778
+ for (const o of i) {
2779
+ const { width: d, height: c } = o.contentRect;
2780
+ c > 0 && (this.measuredWidth.set(Math.round(d), void 0), this.measuredHeight.set(Math.round(c), void 0));
2781
+ }
2782
+ }), this._resizeObserver.observe(r);
2783
+ });
2784
+ }
2785
+ get fixture() {
2786
+ return this.props.fixture;
2787
+ }
2788
+ get compact() {
2789
+ return this.props.compact ?? !1;
2790
+ }
2791
+ _renderInShadowDom(t, n) {
2792
+ if (t.shadowRoot) {
2793
+ for (this._shadowRoot = t.shadowRoot; this._shadowRoot.firstChild; )
2794
+ this._shadowRoot.removeChild(this._shadowRoot.firstChild);
2795
+ this._shadowRoot.adoptedStyleSheets = [];
2796
+ } else
2797
+ this._shadowRoot = t.attachShadow({ mode: "open" });
2798
+ if (n.styles)
2799
+ for (const o of n.styles)
2800
+ if (o.type === "css") {
2801
+ const d = document.createElement("style");
2802
+ d.textContent = o.content, this._shadowRoot.appendChild(d);
2803
+ } else if (o.type === "url") {
2804
+ const d = document.createElement("link");
2805
+ d.rel = "stylesheet", d.href = o.href, this._shadowRoot.appendChild(d);
2806
+ } else o.type === "adopted" && (this._shadowRoot.adoptedStyleSheets = [
2807
+ ...this._shadowRoot.adoptedStyleSheets,
2808
+ o.sheet
2809
+ ]);
2810
+ const r = document.createElement("div");
2811
+ r.style.display = "inline-block", this._renderContainer = r, this._shadowRoot.appendChild(r);
2812
+ const i = this._getDefaultProps(n);
2813
+ this._disposable = n.render(r, i);
2814
+ }
2815
+ _renderDirect(t, n) {
2816
+ this._renderContainer = t;
2817
+ const r = this._getDefaultProps(n);
2818
+ this._disposable = n.render(t, r);
2819
+ }
2820
+ _getDefaultProps(t) {
2821
+ const n = {};
2822
+ for (const r of t.properties)
2823
+ n[r.name] = r.defaultValue;
2824
+ return n;
2825
+ }
2826
+ _cleanup() {
2827
+ var t;
2828
+ this._disposable && (typeof this._disposable == "function" ? this._disposable() : typeof this._disposable.dispose == "function" && this._disposable.dispose()), this._disposable = null, (t = this._resizeObserver) == null || t.disconnect(), this._resizeObserver = null, this._shadowRoot = null, this._renderContainer = null;
2829
+ }
2830
+ dispose() {
2831
+ this._cleanup();
2832
+ }
2833
+ }
2834
+ const ft = $(
2835
+ Un,
2836
+ {},
2837
+ (s, e) => {
2838
+ const t = e.fixture, n = t.component, r = n.displayMode, i = e.measuredWidth.read(s), o = e.measuredHeight.read(s), d = e.compact;
2839
+ let c;
2840
+ if (r.type === "page") {
2841
+ const g = r.viewports[0], v = Nt(g);
2842
+ c = {
2843
+ width: v.width,
2844
+ height: v.height,
2845
+ overflow: "auto"
2846
+ };
2847
+ } else
2848
+ c = {
2849
+ display: "inline-block"
2850
+ };
2851
+ const h = i && o ? `${i} × ${o}` : "", m = d ? K.wrapperCompact : K.wrapper, _ = d ? K.nameCompact : K.name;
2852
+ return /* @__PURE__ */ f("div", { style: m, children: [
2853
+ /* @__PURE__ */ f("div", { style: K.labelRow, children: [
2854
+ /* @__PURE__ */ a("span", { style: _, children: t.name }),
2855
+ !d && h && /* @__PURE__ */ a("span", { style: K.dimensions, children: h })
2856
+ ] }),
2857
+ /* @__PURE__ */ a("div", { style: Wn(n.background), children: /* @__PURE__ */ a("div", { ref: e.setContainerRef, style: c }) })
2858
+ ] });
2859
+ }
2860
+ ), q = 8;
2861
+ function pt(s, e) {
2862
+ return `
2863
+ linear-gradient(45deg, ${e} 25%, transparent 25%),
2864
+ linear-gradient(-45deg, ${e} 25%, transparent 25%),
2865
+ linear-gradient(45deg, transparent 75%, ${e} 75%),
2866
+ linear-gradient(-45deg, transparent 75%, ${e} 75%)
2867
+ `;
2868
+ }
2869
+ const jn = {
2870
+ backgroundColor: "#ffffff",
2871
+ backgroundImage: pt("#ffffff", "#e5e5e5")
2872
+ }, Pn = {
2873
+ backgroundColor: "#1e1e1e",
2874
+ backgroundImage: pt("#1e1e1e", "#2d2d2d")
2875
+ }, Gn = {
2876
+ display: "inline-block",
2877
+ padding: "12px",
2878
+ borderRadius: "4px",
2879
+ backgroundSize: `${q * 2}px ${q * 2}px`,
2880
+ backgroundPosition: `0 0, 0 ${q}px, ${q}px -${q}px, -${q}px 0`,
2881
+ boxShadow: "0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08)"
2882
+ };
2883
+ function Wn(s) {
2884
+ const e = s === "dark" ? Pn : jn;
2885
+ return {
2886
+ ...Gn,
2887
+ backgroundColor: e.backgroundColor,
2888
+ backgroundImage: e.backgroundImage
2889
+ };
2890
+ }
2891
+ const K = {
2892
+ wrapper: {
2893
+ marginBottom: "32px"
2894
+ },
2895
+ wrapperCompact: {
2896
+ marginBottom: "0"
2897
+ },
2898
+ labelRow: {
2899
+ display: "flex",
2900
+ alignItems: "baseline",
2901
+ gap: "8px",
2902
+ marginBottom: "8px"
2903
+ },
2904
+ name: {
2905
+ fontSize: "12px",
2906
+ fontWeight: 500,
2907
+ color: "var(--vscode-foreground)"
2908
+ },
2909
+ nameCompact: {
2910
+ fontSize: "11px",
2911
+ fontWeight: 500,
2912
+ color: "var(--vscode-descriptionForeground)"
2913
+ },
2914
+ dimensions: {
2915
+ fontSize: "11px",
2916
+ color: "var(--vscode-descriptionForeground)",
2917
+ fontFamily: "var(--vscode-editor-font-family, monospace)"
2918
+ }
2919
+ };
2920
+ class qn extends z({
2921
+ fixtureId: u.const(),
2922
+ sessionName: u.const(),
2923
+ daemon: u.const()
2924
+ }) {
2925
+ constructor(t) {
2926
+ super(t);
2927
+ l(this, "screenshot", x(this, { status: "idle" }));
2928
+ l(this, "_fetchVersion", 0);
2929
+ this._store.add(rt((n) => {
2930
+ this.props.daemon.sourceTreeIds.read(n).get(this.props.sessionName) && this._fetchScreenshot();
2931
+ }));
2932
+ }
2933
+ get fixtureId() {
2934
+ return this.props.fixtureId;
2935
+ }
2936
+ async _fetchScreenshot() {
2937
+ const t = ++this._fetchVersion;
2938
+ this.screenshot.set({ status: "loading" }, void 0);
2939
+ try {
2940
+ const n = await this.props.daemon.getScreenshot(this.props.sessionName, this.props.fixtureId);
2941
+ t === this._fetchVersion && this.screenshot.set({ status: "ready", data: n }, void 0);
2942
+ } catch (n) {
2943
+ t === this._fetchVersion && this.screenshot.set({ status: "error", message: String(n) }, void 0);
2944
+ }
2945
+ }
2946
+ }
2947
+ const Ue = $(
2948
+ qn,
2949
+ {},
2950
+ (s, e) => {
2951
+ const t = e.screenshot.read(s);
2952
+ if (t.status === "idle" || t.status === "loading")
2953
+ return /* @__PURE__ */ a("div", { style: U.placeholder, children: /* @__PURE__ */ a("div", { style: U.shimmer }) });
2954
+ if (t.status === "error")
2955
+ return /* @__PURE__ */ a("div", { style: U.error, children: /* @__PURE__ */ a("span", { style: U.errorText, children: "Screenshot failed" }) });
2956
+ const { data: n } = t;
2957
+ return n.image ? /* @__PURE__ */ a(
2958
+ "img",
2959
+ {
2960
+ src: `data:image/png;base64,${n.image}`,
2961
+ style: U.image,
2962
+ alt: `Screenshot of ${e.fixtureId}`
2963
+ }
2964
+ ) : /* @__PURE__ */ a("div", { style: U.placeholder, children: /* @__PURE__ */ a("span", { style: U.hashText, children: n.hash.slice(0, 12) }) });
2965
+ }
2966
+ ), U = {
2967
+ placeholder: {
2968
+ minHeight: 80,
2969
+ display: "flex",
2970
+ alignItems: "center",
2971
+ justifyContent: "center",
2972
+ backgroundColor: "var(--vscode-editor-background)",
2973
+ border: "1px solid var(--vscode-panel-border)",
2974
+ borderRadius: 4,
2975
+ overflow: "hidden"
2976
+ },
2977
+ shimmer: {
2978
+ width: "100%",
2979
+ height: 80,
2980
+ background: "linear-gradient(90deg, var(--vscode-editor-background) 25%, var(--vscode-list-hoverBackground) 50%, var(--vscode-editor-background) 75%)",
2981
+ backgroundSize: "200% 100%",
2982
+ animation: "shimmer 1.5s infinite"
2983
+ },
2984
+ error: {
2985
+ minHeight: 80,
2986
+ display: "flex",
2987
+ alignItems: "center",
2988
+ justifyContent: "center",
2989
+ backgroundColor: "var(--vscode-inputValidation-errorBackground)",
2990
+ border: "1px solid var(--vscode-inputValidation-errorBorder)",
2991
+ borderRadius: 4
2992
+ },
2993
+ errorText: {
2994
+ fontSize: 12,
2995
+ color: "var(--vscode-errorForeground)"
2996
+ },
2997
+ hashText: {
2998
+ fontSize: 11,
2999
+ color: "var(--vscode-descriptionForeground)",
3000
+ fontFamily: "var(--vscode-editor-font-family, monospace)"
3001
+ },
3002
+ image: {
3003
+ maxWidth: "100%",
3004
+ display: "block",
3005
+ borderRadius: 4,
3006
+ border: "1px solid var(--vscode-panel-border)"
3007
+ }
3008
+ };
3009
+ class Kn extends z({
3010
+ fixtureId: u.const(),
3011
+ daemon: u.const(),
3012
+ baselineSession: u.const(),
3013
+ currentSession: u.const()
3014
+ }) {
3015
+ constructor(t) {
3016
+ super(t);
3017
+ l(this, "comparisonStatus", x(this, { status: "loading" }));
3018
+ this._store.add(rt((n) => {
3019
+ const r = this.props.daemon.sourceTreeIds.read(n), i = r.get(this.props.baselineSession), o = r.get(this.props.currentSession);
3020
+ i && o && this._fetchComparison();
3021
+ }));
3022
+ }
3023
+ get fixtureId() {
3024
+ return this.props.fixtureId;
3025
+ }
3026
+ get daemon() {
3027
+ return this.props.daemon;
3028
+ }
3029
+ get baselineSession() {
3030
+ return this.props.baselineSession;
3031
+ }
3032
+ get currentSession() {
3033
+ return this.props.currentSession;
3034
+ }
3035
+ async _fetchComparison() {
3036
+ this.comparisonStatus.set({ status: "loading" }, void 0);
3037
+ try {
3038
+ const t = await this.props.daemon.compare(
3039
+ this.props.fixtureId,
3040
+ this.props.baselineSession,
3041
+ this.props.currentSession
3042
+ );
3043
+ this.comparisonStatus.set({ status: "ready", match: t.match }, void 0);
3044
+ } catch (t) {
3045
+ this.comparisonStatus.set({ status: "error", message: String(t) }, void 0);
3046
+ }
3047
+ }
3048
+ }
3049
+ const Jn = $(
3050
+ Kn,
3051
+ {},
3052
+ (s, e) => {
3053
+ const t = e.comparisonStatus.read(s), n = t.status === "loading" ? /* @__PURE__ */ a("span", { style: C.badgeLoading, children: "comparing..." }) : t.status === "error" ? /* @__PURE__ */ a("span", { style: C.badgeError, children: "error" }) : t.match ? /* @__PURE__ */ a("span", { style: C.badgeMatch, children: "✓ match" }) : /* @__PURE__ */ a("span", { style: C.badgeChanged, children: "● changed" });
3054
+ return /* @__PURE__ */ f("div", { style: C.fixtureRow, children: [
3055
+ /* @__PURE__ */ f("div", { style: C.fixtureLabel, children: [
3056
+ /* @__PURE__ */ a("span", { style: C.fixtureName, children: e.fixtureId }),
3057
+ n
3058
+ ] }),
3059
+ /* @__PURE__ */ f("div", { style: C.sideBySide, children: [
3060
+ /* @__PURE__ */ f("div", { style: C.screenshotColumn, children: [
3061
+ /* @__PURE__ */ a("span", { style: C.columnLabel, children: "Current" }),
3062
+ /* @__PURE__ */ a(
3063
+ Ue,
3064
+ {
3065
+ fixtureId: e.fixtureId,
3066
+ sessionName: e.currentSession,
3067
+ daemon: e.daemon
3068
+ }
3069
+ )
3070
+ ] }),
3071
+ /* @__PURE__ */ f("div", { style: C.screenshotColumn, children: [
3072
+ /* @__PURE__ */ a("span", { style: C.columnLabel, children: "Baseline" }),
3073
+ /* @__PURE__ */ a(
3074
+ Ue,
3075
+ {
3076
+ fixtureId: e.fixtureId,
3077
+ sessionName: e.baselineSession,
3078
+ daemon: e.daemon
3079
+ }
3080
+ )
3081
+ ] })
3082
+ ] })
3083
+ ] });
3084
+ }
3085
+ ), Zn = k(
3086
+ {
3087
+ name: u.const(),
3088
+ path: u.const(),
3089
+ items: u.const(),
3090
+ daemon: u.const(),
3091
+ baselineSession: u.const(),
3092
+ currentSession: u.const()
3093
+ },
3094
+ (s, e) => /* @__PURE__ */ f("div", { children: [
3095
+ /* @__PURE__ */ a("div", { style: C.groupHeader, children: /* @__PURE__ */ a("span", { style: C.groupTitle, children: e.path }) }),
3096
+ /* @__PURE__ */ a("div", { style: C.groupContent, children: e.items.map((t) => /* @__PURE__ */ a(
3097
+ Jn,
3098
+ {
3099
+ fixtureId: t.fixtureId,
3100
+ daemon: e.daemon,
3101
+ baselineSession: e.baselineSession,
3102
+ currentSession: e.currentSession
3103
+ },
3104
+ t.fixtureId
3105
+ )) })
3106
+ ] })
3107
+ ), C = {
3108
+ groupHeader: {
3109
+ marginBottom: 12
3110
+ },
3111
+ groupTitle: {
3112
+ fontSize: 13,
3113
+ fontWeight: 500,
3114
+ color: "var(--vscode-foreground)"
3115
+ },
3116
+ groupContent: {
3117
+ display: "flex",
3118
+ flexDirection: "column",
3119
+ gap: 24
3120
+ },
3121
+ fixtureRow: {
3122
+ display: "flex",
3123
+ flexDirection: "column",
3124
+ gap: 8
3125
+ },
3126
+ fixtureLabel: {
3127
+ display: "flex",
3128
+ alignItems: "center",
3129
+ gap: 8
3130
+ },
3131
+ fixtureName: {
3132
+ fontSize: 12,
3133
+ fontWeight: 500,
3134
+ color: "var(--vscode-foreground)"
3135
+ },
3136
+ sideBySide: {
3137
+ display: "flex",
3138
+ flexDirection: "row",
3139
+ gap: 16
3140
+ },
3141
+ screenshotColumn: {
3142
+ flex: 1,
3143
+ display: "flex",
3144
+ flexDirection: "column",
3145
+ gap: 4,
3146
+ minWidth: 0
3147
+ },
3148
+ columnLabel: {
3149
+ fontSize: 11,
3150
+ fontWeight: 500,
3151
+ color: "var(--vscode-descriptionForeground)",
3152
+ textTransform: "uppercase",
3153
+ letterSpacing: "0.05em"
3154
+ },
3155
+ badgeMatch: {
3156
+ fontSize: 11,
3157
+ color: "var(--vscode-testing-iconPassed)",
3158
+ fontWeight: 500
3159
+ },
3160
+ badgeChanged: {
3161
+ fontSize: 11,
3162
+ color: "var(--vscode-testing-iconFailed)",
3163
+ fontWeight: 500
3164
+ },
3165
+ badgeLoading: {
3166
+ fontSize: 11,
3167
+ color: "var(--vscode-descriptionForeground)",
3168
+ fontStyle: "italic"
3169
+ },
3170
+ badgeError: {
3171
+ fontSize: 11,
3172
+ color: "var(--vscode-errorForeground)",
3173
+ fontWeight: 500
3174
+ }
3175
+ }, J = 8;
3176
+ function gt(s, e) {
3177
+ return `
3178
+ linear-gradient(45deg, ${e} 25%, transparent 25%),
3179
+ linear-gradient(-45deg, ${e} 25%, transparent 25%),
3180
+ linear-gradient(45deg, transparent 75%, ${e} 75%),
3181
+ linear-gradient(-45deg, transparent 75%, ${e} 75%)
3182
+ `;
3183
+ }
3184
+ const Xn = {
3185
+ backgroundColor: "#ffffff",
3186
+ backgroundImage: gt("#ffffff", "#e5e5e5")
3187
+ }, Qn = {
3188
+ backgroundColor: "#1e1e1e",
3189
+ backgroundImage: gt("#1e1e1e", "#2d2d2d")
3190
+ }, Yn = {
3191
+ display: "inline-block",
3192
+ padding: "12px",
3193
+ borderRadius: "4px",
3194
+ backgroundSize: `${J * 2}px ${J * 2}px`,
3195
+ backgroundPosition: `0 0, 0 ${J}px, ${J}px -${J}px, -${J}px 0`,
3196
+ boxShadow: "0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08)"
3197
+ };
3198
+ function es(s) {
3199
+ const e = s === "dark" ? Qn : Xn;
3200
+ return {
3201
+ ...Yn,
3202
+ backgroundColor: e.backgroundColor,
3203
+ backgroundImage: e.backgroundImage
3204
+ };
3205
+ }
3206
+ function je({ src: s, alt: e, background: t }) {
3207
+ return /* @__PURE__ */ a("div", { style: es(t), children: /* @__PURE__ */ a("img", { src: s, alt: e, style: y.image }) });
3208
+ }
3209
+ const ts = k(
3210
+ {
3211
+ item: u.const(),
3212
+ reportModel: u.const()
3213
+ },
3214
+ (s, e) => {
3215
+ const { item: t, reportModel: n } = e, { entry: r } = t, i = r.background ?? "light", o = r.status === "unchanged" ? /* @__PURE__ */ a("span", { style: y.badgeMatch, children: "✓ match" }) : r.status === "changed" ? /* @__PURE__ */ a("span", { style: y.badgeChanged, children: "● changed" }) : /* @__PURE__ */ a("span", { style: y.badgeAdded, children: "+ added" }), d = r.baselineScreenshot || r.currentScreenshot;
3216
+ return /* @__PURE__ */ f("div", { style: y.fixtureRow, children: [
3217
+ /* @__PURE__ */ f("div", { style: y.fixtureLabel, children: [
3218
+ /* @__PURE__ */ a("span", { style: y.fixtureName, children: t.fixtureId }),
3219
+ o
3220
+ ] }),
3221
+ d && /* @__PURE__ */ f("div", { style: y.sideBySide, children: [
3222
+ r.baselineScreenshot && /* @__PURE__ */ f("div", { style: y.screenshotColumn, children: [
3223
+ /* @__PURE__ */ a("span", { style: y.columnLabel, children: "Baseline" }),
3224
+ /* @__PURE__ */ a(
3225
+ je,
3226
+ {
3227
+ src: n.resolveScreenshotUrl(r.baselineScreenshot),
3228
+ alt: `Baseline screenshot of ${t.fixtureId}`,
3229
+ background: i
3230
+ }
3231
+ )
3232
+ ] }),
3233
+ r.currentScreenshot && /* @__PURE__ */ f("div", { style: y.screenshotColumn, children: [
3234
+ /* @__PURE__ */ a("span", { style: y.columnLabel, children: "Current" }),
3235
+ /* @__PURE__ */ a(
3236
+ je,
3237
+ {
3238
+ src: n.resolveScreenshotUrl(r.currentScreenshot),
3239
+ alt: `Current screenshot of ${t.fixtureId}`,
3240
+ background: i
3241
+ }
3242
+ )
3243
+ ] })
3244
+ ] }),
3245
+ !d && r.status === "unchanged" && /* @__PURE__ */ a("div", { style: y.hashRow, children: /* @__PURE__ */ f("span", { style: y.hashText, children: [
3246
+ "hash: ",
3247
+ r.targetHash
3248
+ ] }) })
3249
+ ] });
3250
+ }
3251
+ ), ns = k(
3252
+ {
3253
+ name: u.const(),
3254
+ path: u.const(),
3255
+ items: u.const(),
3256
+ reportModel: u.const()
3257
+ },
3258
+ (s, e) => /* @__PURE__ */ f("div", { children: [
3259
+ /* @__PURE__ */ a("div", { style: y.groupHeader, children: /* @__PURE__ */ a("span", { style: y.groupTitle, children: e.path }) }),
3260
+ /* @__PURE__ */ a("div", { style: y.groupContent, children: e.items.map((t) => /* @__PURE__ */ a(
3261
+ ts,
3262
+ {
3263
+ item: t,
3264
+ reportModel: e.reportModel
3265
+ },
3266
+ t.fixtureId
3267
+ )) })
3268
+ ] })
3269
+ ), y = {
3270
+ groupHeader: {
3271
+ marginBottom: 12
3272
+ },
3273
+ groupTitle: {
3274
+ fontSize: 13,
3275
+ fontWeight: 500,
3276
+ color: "var(--vscode-foreground)"
3277
+ },
3278
+ groupContent: {
3279
+ display: "flex",
3280
+ flexDirection: "column",
3281
+ gap: 24
3282
+ },
3283
+ fixtureRow: {
3284
+ display: "flex",
3285
+ flexDirection: "column",
3286
+ gap: 8
3287
+ },
3288
+ fixtureLabel: {
3289
+ display: "flex",
3290
+ alignItems: "center",
3291
+ gap: 8
3292
+ },
3293
+ fixtureName: {
3294
+ fontSize: 12,
3295
+ fontWeight: 500,
3296
+ color: "var(--vscode-foreground)"
3297
+ },
3298
+ sideBySide: {
3299
+ display: "flex",
3300
+ flexDirection: "row",
3301
+ gap: 16
3302
+ },
3303
+ screenshotColumn: {
3304
+ display: "flex",
3305
+ flexDirection: "column",
3306
+ gap: 4
3307
+ },
3308
+ columnLabel: {
3309
+ fontSize: 11,
3310
+ fontWeight: 500,
3311
+ color: "var(--vscode-descriptionForeground)",
3312
+ textTransform: "uppercase",
3313
+ letterSpacing: "0.05em"
3314
+ },
3315
+ image: {
3316
+ display: "block"
3317
+ },
3318
+ hashRow: {
3319
+ padding: "8px 0"
3320
+ },
3321
+ hashText: {
3322
+ fontSize: 11,
3323
+ color: "var(--vscode-descriptionForeground)",
3324
+ fontFamily: "monospace"
3325
+ },
3326
+ badgeMatch: {
3327
+ fontSize: 11,
3328
+ color: "var(--vscode-testing-iconPassed)",
3329
+ fontWeight: 500
3330
+ },
3331
+ badgeChanged: {
3332
+ fontSize: 11,
3333
+ color: "var(--vscode-testing-iconFailed)",
3334
+ fontWeight: 500
3335
+ },
3336
+ badgeAdded: {
3337
+ fontSize: 11,
3338
+ color: "var(--vscode-testing-iconQueued)",
3339
+ fontWeight: 500
3340
+ }
3341
+ }, mt = "component-explorer:fixtureHeights", Pe = 500;
3342
+ let D = null;
3343
+ function vt() {
3344
+ if (D !== null) return D;
3345
+ try {
3346
+ const s = localStorage.getItem(mt);
3347
+ if (s)
3348
+ return D = JSON.parse(s), D;
3349
+ } catch {
3350
+ }
3351
+ return D = {}, D;
3352
+ }
3353
+ function ss() {
3354
+ if (D !== null)
3355
+ try {
3356
+ const s = Object.entries(D);
3357
+ s.length > Pe && (D = Object.fromEntries(s.slice(-Pe))), localStorage.setItem(mt, JSON.stringify(D));
3358
+ } catch {
3359
+ }
3360
+ }
3361
+ function rs(s, e) {
3362
+ const t = vt();
3363
+ t[s] = e, ss();
3364
+ }
3365
+ function is() {
3366
+ return new Map(Object.entries(vt()));
3367
+ }
3368
+ const os = 280, as = 32, ae = 32, Ge = 400, _t = "component-explorer:scrollAnchors", We = 100;
3369
+ function bt() {
3370
+ try {
3371
+ const s = localStorage.getItem(_t);
3372
+ if (s) return JSON.parse(s);
3373
+ } catch {
3374
+ }
3375
+ return {};
3376
+ }
3377
+ function ds(s, e) {
3378
+ try {
3379
+ const t = bt();
3380
+ t[s] = e;
3381
+ const n = Object.entries(t), r = n.length > We ? Object.fromEntries(n.slice(-We)) : t;
3382
+ localStorage.setItem(_t, JSON.stringify(r));
3383
+ } catch {
3384
+ }
3385
+ }
3386
+ function cs(s) {
3387
+ return bt()[s];
3388
+ }
3389
+ function yt(s) {
3390
+ return s.type === "single" ? s.fixture.id : s.id;
3391
+ }
3392
+ function ls(s, e) {
3393
+ const t = new Array(s.length);
3394
+ let n = ae;
3395
+ for (let r = 0; r < s.length; r++) {
3396
+ const i = e.get(yt(s[r])) ?? os;
3397
+ t[r] = { top: n, height: i }, n += i + as;
3398
+ }
3399
+ return t;
3400
+ }
3401
+ function hs(s) {
3402
+ if (s.length === 0) return 0;
3403
+ const e = s[s.length - 1];
3404
+ return e.top + e.height + ae;
3405
+ }
3406
+ function xt(s, e) {
3407
+ let t = 0, n = s.length;
3408
+ for (; t < n; ) {
3409
+ const r = t + n >> 1;
3410
+ s[r].top + s[r].height < e ? t = r + 1 : n = r;
3411
+ }
3412
+ return t;
3413
+ }
3414
+ function us(s, e, t) {
3415
+ if (s.length === 0) return { start: 0, end: 0 };
3416
+ const n = xt(s, e - Ge);
3417
+ let r = n;
3418
+ const i = e + t + Ge;
3419
+ for (; r < s.length && s[r].top < i; )
3420
+ r++;
3421
+ return { start: n, end: r };
3422
+ }
3423
+ function qe(s, e) {
3424
+ if (s.length === 0) return;
3425
+ const t = xt(s, e), n = Math.min(t, s.length - 1);
3426
+ return {
3427
+ rowIndex: n,
3428
+ offsetFromViewport: s[n].top - e
3429
+ };
3430
+ }
3431
+ function Ke(s, e) {
3432
+ return e.rowIndex >= s.length ? 0 : s[e.rowIndex].top - e.offsetFromViewport;
3433
+ }
3434
+ class fs extends z({
3435
+ model: u.const()
3436
+ }) {
3437
+ constructor() {
3438
+ super(...arguments);
3439
+ l(this, "_rowHeights", x(this, is()));
3440
+ l(this, "_scrollTop", x(this, 0));
3441
+ l(this, "_viewportHeight", x(this, 0));
3442
+ l(this, "_scrollContainerRef", null);
3443
+ l(this, "_resizeObserver", null);
3444
+ l(this, "_viewportResizeObserver", null);
3445
+ l(this, "_currentNodeId");
3446
+ l(this, "_scrollSaveTimeout", null);
3447
+ l(this, "_suppressScrollHandler", !1);
3448
+ l(this, "layout", F(this, (t) => {
3449
+ const n = this.explorerModel.selectedFixtures.read(t), r = this._rowHeights.read(t);
3450
+ return ls(n, r);
3451
+ }));
3452
+ l(this, "visibleRowRange", F(this, (t) => {
3453
+ const n = this.layout.read(t), r = this._scrollTop.read(t), i = this._viewportHeight.read(t);
3454
+ return us(n, r, i);
3455
+ }));
3456
+ l(this, "setScrollContainerRef", (t) => {
3457
+ var n;
3458
+ this._scrollContainerRef && this._scrollContainerRef.removeEventListener("scroll", this._handleScroll), (n = this._viewportResizeObserver) == null || n.disconnect(), this._scrollContainerRef = t, t && (t.addEventListener("scroll", this._handleScroll, { passive: !0 }), this._viewportHeight.set(t.clientHeight, void 0), this._viewportResizeObserver = new ResizeObserver(([r]) => {
3459
+ this._viewportHeight.set(Math.round(r.contentRect.height), void 0);
3460
+ }), this._viewportResizeObserver.observe(t), this._restoreScrollPosition());
3461
+ });
3462
+ l(this, "_handleScroll", () => {
3463
+ this._scrollContainerRef && (this._scrollTop.set(this._scrollContainerRef.scrollTop, void 0), !(this._suppressScrollHandler || !this._currentNodeId) && (this._scrollSaveTimeout && clearTimeout(this._scrollSaveTimeout), this._scrollSaveTimeout = setTimeout(() => {
3464
+ if (!this._currentNodeId) return;
3465
+ const t = this.layout.get(), n = qe(t, this._scrollTop.get());
3466
+ n && ds(this._currentNodeId, n);
3467
+ }, 150)));
3468
+ });
3469
+ l(this, "observeRowElement", (t, n) => {
3470
+ t && (this._resizeObserver || (this._resizeObserver = new ResizeObserver((r) => {
3471
+ const i = this._rowHeights.get();
3472
+ let o;
3473
+ for (const d of r) {
3474
+ const c = d.target.getAttribute("data-row-id");
3475
+ if (!c) continue;
3476
+ const h = Math.round(d.contentRect.height);
3477
+ h > 0 && i.get(c) !== h && (o || (o = new Map(i)), o.set(c, h), rs(c, h));
3478
+ }
3479
+ if (o) {
3480
+ const d = this.layout.get(), c = qe(d, this._scrollTop.get());
3481
+ if (this._rowHeights.set(o, void 0), c && this._scrollContainerRef) {
3482
+ const h = this.layout.get(), m = Ke(h, c);
3483
+ this._suppressScrollHandler = !0, this._scrollContainerRef.scrollTop = m, this._scrollTop.set(m, void 0), requestAnimationFrame(() => {
3484
+ this._suppressScrollHandler = !1;
3485
+ });
3486
+ }
3487
+ }
3488
+ })), t.setAttribute("data-row-id", n), this._resizeObserver.observe(t));
3489
+ });
3490
+ }
3491
+ get explorerModel() {
3492
+ return this.props.model;
3493
+ }
3494
+ updateForSelection(t) {
3495
+ this._currentNodeId !== t && (this._currentNodeId = t, this._restoreScrollPosition());
3496
+ }
3497
+ _restoreScrollPosition() {
3498
+ if (!this._scrollContainerRef || !this._currentNodeId) return;
3499
+ const t = cs(this._currentNodeId);
3500
+ if (!t) return;
3501
+ const n = this.layout.get(), r = Ke(n, t);
3502
+ this._suppressScrollHandler = !0, this._scrollContainerRef.scrollTop = r, this._scrollTop.set(r, void 0), requestAnimationFrame(() => {
3503
+ this._suppressScrollHandler = !1;
3504
+ });
3505
+ }
3506
+ dispose() {
3507
+ var t, n;
3508
+ (t = this._resizeObserver) == null || t.disconnect(), (n = this._viewportResizeObserver) == null || n.disconnect(), this._scrollContainerRef && this._scrollContainerRef.removeEventListener("scroll", this._handleScroll), this._scrollSaveTimeout && clearTimeout(this._scrollSaveTimeout);
3509
+ }
3510
+ }
3511
+ const ps = $(
3512
+ fs,
3513
+ {},
3514
+ (s, e) => {
3515
+ const t = e.explorerModel.selectedFixtures.read(s), n = e.explorerModel.selectedNodeId.read(s), r = e.layout.read(s), { start: i, end: o } = e.visibleRowRange.read(s);
3516
+ if (e.updateForSelection(n), t.length === 0) {
3517
+ const c = e.explorerModel.reportModel;
3518
+ if (c) {
3519
+ const h = c.state.read(s);
3520
+ if (h.status === "loading")
3521
+ return /* @__PURE__ */ a("div", { style: N.emptyState, children: /* @__PURE__ */ a("span", { style: N.emptyText, children: "Loading report..." }) });
3522
+ if (h.status === "error")
3523
+ return /* @__PURE__ */ a("div", { style: N.emptyState, children: /* @__PURE__ */ f("span", { style: { ...N.emptyText, color: "var(--vscode-errorForeground)" }, children: [
3524
+ "Failed to load report: ",
3525
+ h.message
3526
+ ] }) });
3527
+ }
3528
+ return /* @__PURE__ */ a("div", { style: N.emptyState, children: /* @__PURE__ */ a("span", { style: N.emptyText, children: "Select a component or folder to preview" }) });
3529
+ }
3530
+ const d = hs(r);
3531
+ return /* @__PURE__ */ a("div", { ref: e.setScrollContainerRef, style: N.scrollContainer, children: /* @__PURE__ */ a("div", { style: { position: "relative", height: d }, children: t.slice(i, o).map((c, h) => {
3532
+ const m = i + h, { top: _ } = r[m], g = yt(c);
3533
+ return /* @__PURE__ */ a(
3534
+ "div",
3535
+ {
3536
+ ref: (v) => e.observeRowElement(v, g),
3537
+ style: { position: "absolute", top: _, left: ae, right: ae },
3538
+ children: c.type === "single" ? /* @__PURE__ */ a(ft, { fixture: c.fixture, compact: !1 }) : c.type === "variants" ? /* @__PURE__ */ a(gs, { row: c }) : c.type === "screenshot-comparison" && e.explorerModel.daemon ? /* @__PURE__ */ a(
3539
+ Zn,
3540
+ {
3541
+ name: c.name,
3542
+ path: c.path,
3543
+ items: c.items,
3544
+ daemon: e.explorerModel.daemon,
3545
+ baselineSession: "baseline",
3546
+ currentSession: "current"
3547
+ }
3548
+ ) : c.type === "report-comparison" && e.explorerModel.reportModel ? /* @__PURE__ */ a(
3549
+ ns,
3550
+ {
3551
+ name: c.name,
3552
+ path: c.path,
3553
+ items: c.items,
3554
+ reportModel: e.explorerModel.reportModel
3555
+ }
3556
+ ) : null
3557
+ },
3558
+ g
3559
+ );
3560
+ }) }) });
3561
+ }
3562
+ ), gs = k(
3563
+ { row: u.const() },
3564
+ (s, e) => {
3565
+ const t = e.row;
3566
+ return /* @__PURE__ */ f("div", { children: [
3567
+ /* @__PURE__ */ a("div", { style: N.variantsHeader, children: /* @__PURE__ */ a("span", { style: N.variantsTitle, children: t.path }) }),
3568
+ /* @__PURE__ */ a("div", { style: N.variantsContent, children: t.fixtures.map((n) => /* @__PURE__ */ a(ft, { fixture: n, compact: !0 }, n.id)) })
3569
+ ] });
3570
+ }
3571
+ ), N = {
3572
+ scrollContainer: {
3573
+ flex: 1,
3574
+ overflow: "auto",
3575
+ backgroundColor: "var(--vscode-editor-background)"
3576
+ },
3577
+ emptyState: {
3578
+ flex: 1,
3579
+ display: "flex",
3580
+ alignItems: "center",
3581
+ justifyContent: "center",
3582
+ backgroundColor: "var(--vscode-editor-background)"
3583
+ },
3584
+ emptyText: {
3585
+ color: "var(--vscode-descriptionForeground)",
3586
+ fontSize: "14px"
3587
+ },
3588
+ variantsHeader: {
3589
+ marginBottom: "12px"
3590
+ },
3591
+ variantsTitle: {
3592
+ fontSize: "13px",
3593
+ fontWeight: 500,
3594
+ color: "var(--vscode-foreground)"
3595
+ },
3596
+ variantsContent: {
3597
+ display: "flex",
3598
+ flexDirection: "row",
3599
+ flexWrap: "wrap",
3600
+ gap: "16px"
3601
+ }
3602
+ }, ms = $(
3603
+ Sn,
3604
+ { daemonModel: u.const(), reportModel: u.const() },
3605
+ (s, e) => {
3606
+ const t = e.leftSidebarVisible.read(s), n = e.rightSidebarVisible.read(s), r = e.isDarkTheme.read(s), i = e.selectedNode.read(s);
3607
+ return /* @__PURE__ */ f("div", { className: r ? "vscode-theme default-dark-plus" : "vscode-theme default-light-plus", style: p.container, children: [
3608
+ t && /* @__PURE__ */ a(Bn, { model: e }),
3609
+ /* @__PURE__ */ f("div", { style: p.centerArea, children: [
3610
+ /* @__PURE__ */ a(Fn, { model: e }),
3611
+ /* @__PURE__ */ a(ps, { model: e })
3612
+ ] }),
3613
+ n && /* @__PURE__ */ a(Ln, { selectedNode: i })
3614
+ ] });
3615
+ }
3616
+ );
3617
+ var vs = class be {
3618
+ constructor(e) {
3619
+ this.iterator = e;
3620
+ }
3621
+ static fromIterable(e) {
3622
+ return new be(e[Symbol.asyncIterator]());
3623
+ }
3624
+ static fromFn(e) {
3625
+ return new be(e());
3626
+ }
3627
+ [Symbol.asyncIterator]() {
3628
+ return this.iterator;
3629
+ }
3630
+ }, _s = class extends Error {
3631
+ constructor(s, e, t) {
3632
+ super(t), this.statusCode = s, this.method = e, this.name = "ApiError";
3633
+ }
3634
+ }, bs = class {
3635
+ constructor(s) {
3636
+ l(this, "methods", this._createProxy(""));
3637
+ this._request = s;
3638
+ }
3639
+ _createProxy(s) {
3640
+ return new Proxy(() => {
3641
+ }, {
3642
+ apply: async (e, t, n) => await this._request(s, n[0]),
3643
+ get: (e, t) => this._createProxy(`${s}${s ? "/" : ""}${t}`)
3644
+ });
3645
+ }
3646
+ };
3647
+ function ys(s, e) {
3648
+ return new bs(async (t, n) => {
3649
+ var d;
3650
+ const r = await fetch(`${s}/${t}`, {
3651
+ method: "POST",
3652
+ headers: {
3653
+ "Content-Type": "application/json",
3654
+ ...(d = e == null ? void 0 : e.getHeaders) == null ? void 0 : d.call(e)
3655
+ },
3656
+ body: JSON.stringify(n)
3657
+ });
3658
+ if (r.status !== 200) {
3659
+ const c = await r.json().catch(() => null);
3660
+ let h;
3661
+ throw c && typeof c == "object" && "errorMessage" in c ? h = `${c.errorMessage}` : h = `Error calling API method ${t}: ${JSON.stringify(c)} (Status: ${r.status}, Status Text: ${r.statusText})`, new _s(r.status, t, h);
3662
+ }
3663
+ const i = r.headers.get("Content-Type");
3664
+ return i != null && i.startsWith("application/jsonl") ? vs.fromFn(async function* () {
3665
+ var g;
3666
+ const c = (g = r.body) == null ? void 0 : g.getReader();
3667
+ if (!c)
3668
+ return;
3669
+ let h = "";
3670
+ const m = new TextDecoder("utf-8");
3671
+ for (; ; ) {
3672
+ const { done: v, value: E } = await c.read();
3673
+ if (v)
3674
+ break;
3675
+ h += m.decode(E, { stream: !0 });
3676
+ let V;
3677
+ for (; (V = h.indexOf(`
3678
+ `)) >= 0; ) {
3679
+ const S = h.slice(0, V).trim();
3680
+ h = h.slice(V + 1), S.length > 0 && (yield JSON.parse(S));
3681
+ }
3682
+ }
3683
+ const _ = h.trim();
3684
+ _.length > 0 && (yield JSON.parse(_));
3685
+ }) : await r.json();
3686
+ });
3687
+ }
3688
+ class xs {
3689
+ constructor(e) {
3690
+ l(this, "_sourceTreeIds", x(this, /* @__PURE__ */ new Map()));
3691
+ l(this, "_sessions", x(this, []));
3692
+ l(this, "_screenshotCache", /* @__PURE__ */ new Map());
3693
+ l(this, "_client");
3694
+ l(this, "_eventStreamAbort", null);
3695
+ l(this, "sessionName");
3696
+ /** Observable map of sessionName → current sourceTreeId */
3697
+ l(this, "sourceTreeIds", this._sourceTreeIds);
3698
+ /** Observable list of sessions from the daemon */
3699
+ l(this, "sessions", this._sessions);
3700
+ this.config = e, this.sessionName = e.sessionName, this._client = ys("/__explorer/daemon-api");
3701
+ }
3702
+ /**
3703
+ * Initializes the model: fetches initial session info and starts listening to events.
3704
+ * Call this once after construction.
3705
+ */
3706
+ async initialize() {
3707
+ await this._fetchSessionInfos(), this._startEventStream();
3708
+ }
3709
+ /**
3710
+ * Get a screenshot for a fixture in a session, using cache when available.
3711
+ * Cache is keyed on sessionName + fixtureId and invalidated when sourceTreeId changes.
3712
+ */
3713
+ async getScreenshot(e, t) {
3714
+ const n = this._sourceTreeIds.get().get(e);
3715
+ if (!n)
3716
+ throw new Error(`No sourceTreeId known for session '${e}'`);
3717
+ const r = `${e}:${t}`, i = this._screenshotCache.get(r);
3718
+ if (i && i.sourceTreeId === n)
3719
+ return i.data;
3720
+ const o = await this._client.methods.screenshots.take({
3721
+ fixtureId: t,
3722
+ sessionName: e,
3723
+ sourceTreeId: n,
3724
+ includeImage: !0
3725
+ });
3726
+ return this._screenshotCache.set(r, { sourceTreeId: n, data: o }), o;
3727
+ }
3728
+ /**
3729
+ * Compare a fixture across two sessions. Returns match status and hashes (no images).
3730
+ */
3731
+ async compare(e, t, n) {
3732
+ const r = this._sourceTreeIds.get().get(t), i = this._sourceTreeIds.get().get(n);
3733
+ if (!r || !i)
3734
+ throw new Error("Missing sourceTreeId for sessions");
3735
+ return this._client.methods.screenshots.compare({
3736
+ fixtureId: e,
3737
+ baselineSessionName: t,
3738
+ baselineSourceTreeId: r,
3739
+ currentSessionName: n,
3740
+ currentSourceTreeId: i,
3741
+ includeImages: !1
3742
+ });
3743
+ }
3744
+ /**
3745
+ * List fixtures from a session.
3746
+ */
3747
+ async listFixtures(e) {
3748
+ const t = this._sourceTreeIds.get().get(e);
3749
+ if (!t)
3750
+ throw new Error(`No sourceTreeId known for session '${e}'`);
3751
+ return this._client.methods.fixtures.list({ sessionName: e, sourceTreeId: t });
3752
+ }
3753
+ /**
3754
+ * Get the explorer URL for a different session (for session switching via full navigation).
3755
+ */
3756
+ getSessionExplorerUrl(e) {
3757
+ const t = this._sessions.get().find((n) => n.name === e);
3758
+ if (t)
3759
+ return t.serverUrl + "/___explorer";
3760
+ }
3761
+ dispose() {
3762
+ var e;
3763
+ (e = this._eventStreamAbort) == null || e.abort(), this._eventStreamAbort = null;
3764
+ }
3765
+ // ---------------------------------------------------------------------------
3766
+ // Private
3767
+ // ---------------------------------------------------------------------------
3768
+ async _fetchSessionInfos() {
3769
+ const e = await this._client.methods.sessions(), t = /* @__PURE__ */ new Map(), n = [];
3770
+ for (const r of e)
3771
+ t.set(r.name, r.sourceTreeId), n.push({ name: r.name, serverUrl: r.serverUrl });
3772
+ this._sourceTreeIds.set(t, void 0), this._sessions.set(n, void 0);
3773
+ }
3774
+ async _startEventStream() {
3775
+ this._eventStreamAbort = new AbortController();
3776
+ const e = this._eventStreamAbort.signal;
3777
+ try {
3778
+ const t = await this._client.methods.events();
3779
+ for await (const n of t) {
3780
+ if (e.aborted) break;
3781
+ this._handleEvent(n);
3782
+ }
3783
+ } catch (t) {
3784
+ e.aborted || (console.error("[DaemonModel] Event stream error:", t), setTimeout(() => {
3785
+ e.aborted || this._startEventStream();
3786
+ }, 2e3));
3787
+ }
3788
+ }
3789
+ _handleEvent(e) {
3790
+ if (e.type === "source-change") {
3791
+ const t = new Map(this._sourceTreeIds.get());
3792
+ t.set(e.sessionName, e.sourceTreeId), this._sourceTreeIds.set(t, void 0);
3793
+ for (const n of this._screenshotCache.keys())
3794
+ n.startsWith(`${e.sessionName}:`) && this._screenshotCache.delete(n);
3795
+ }
3796
+ }
3797
+ }
3798
+ function Cs() {
3799
+ return window.__EXPLORER_DAEMON__;
3800
+ }
3801
+ class Ss {
3802
+ constructor(e) {
3803
+ l(this, "state", x(this, { status: "loading" }));
3804
+ l(this, "_baseUrl");
3805
+ this.reportUrl = e;
3806
+ const t = e.lastIndexOf("/");
3807
+ this._baseUrl = t >= 0 ? e.slice(0, t + 1) : "", this._fetch();
3808
+ }
3809
+ resolveScreenshotUrl(e) {
3810
+ return this._baseUrl + e;
3811
+ }
3812
+ buildTree(e) {
3813
+ const t = this.state.read(e);
3814
+ return t.status !== "ready" ? { id: "", name: "Report", type: "folder", children: [] } : ws(t.report.fixtures);
3815
+ }
3816
+ async _fetch() {
3817
+ this.state.set({ status: "loading" }, void 0);
3818
+ try {
3819
+ const e = await fetch(this.reportUrl);
3820
+ if (!e.ok)
3821
+ throw new Error(`HTTP ${e.status}: ${e.statusText}`);
3822
+ const t = await e.json();
3823
+ this.state.set({ status: "ready", report: t }, void 0);
3824
+ } catch (e) {
3825
+ this.state.set({ status: "error", message: String(e) }, void 0);
3826
+ }
3827
+ }
3828
+ }
3829
+ function ws(s) {
3830
+ const e = { id: "", name: "Components", type: "folder", children: [] };
3831
+ for (const [t, n] of Object.entries(s)) {
3832
+ const r = t.split("/");
3833
+ let i = e;
3834
+ for (let o = 0; o < r.length; o++) {
3835
+ const d = r[o], c = o === r.length - 1, h = r.slice(0, o + 1).join("/");
3836
+ if (c)
3837
+ i.children.push({
3838
+ id: h,
3839
+ name: d,
3840
+ type: "component",
3841
+ reportEntry: n
3842
+ });
3843
+ else {
3844
+ let m = i.children.find((_) => _.type === "folder" && _.name === d);
3845
+ m || (m = { id: h, name: d, type: "folder", children: [] }, i.children.push(m)), i = m;
3846
+ }
3847
+ }
3848
+ }
3849
+ return e;
3850
+ }
3851
+ class Bs {
3852
+ constructor(e, t) {
3853
+ l(this, "_root");
3854
+ l(this, "_registry", new un());
3855
+ l(this, "_daemonModel");
3856
+ l(this, "_reportModel");
3857
+ this._populateRegistry(t), this._reportModel = this._initializeReportModel(), this._daemonModel = this._reportModel ? void 0 : this._initializeDaemonModel(), this._root = It(e), this._root.render(kt(ms, {
3858
+ registry: this._registry,
3859
+ daemonModel: this._daemonModel,
3860
+ reportModel: this._reportModel
3861
+ }));
3862
+ }
3863
+ _initializeReportModel() {
3864
+ const t = new URLSearchParams(location.search).get("report");
3865
+ if (t)
3866
+ return new Ss(t);
3867
+ }
3868
+ _initializeDaemonModel() {
3869
+ const e = Cs();
3870
+ if (!e)
3871
+ return;
3872
+ const t = new xs(e);
3873
+ return t.initialize().catch((n) => {
3874
+ console.error("[ExplorerApp] Failed to initialize DaemonModel:", n);
3875
+ }), t;
3876
+ }
3877
+ _populateRegistry(e) {
3878
+ this._registry.clear();
3879
+ for (const [t, n] of Object.entries(e)) {
3880
+ const r = n.default;
3881
+ r && typeof r == "object" && this._registry.register(t, r);
3882
+ }
3883
+ }
3884
+ /**
3885
+ * Updates the fixtures. The UI will update automatically since the registry is observable.
3886
+ */
3887
+ updateFixtures(e) {
3888
+ this._populateRegistry(e);
3889
+ }
3890
+ /**
3891
+ * No-op for ExplorerApp (only meaningful for CliRuntime).
3892
+ * Present so the plugin's HMR wiring can call it polymorphically.
3893
+ */
3894
+ bumpVersion() {
3895
+ }
3896
+ /**
3897
+ * Unmounts the explorer and cleans up resources.
3898
+ */
3899
+ dispose() {
3900
+ var e;
3901
+ (e = this._daemonModel) == null || e.dispose(), this._root.unmount();
3902
+ }
3903
+ }
3904
+ export {
3905
+ On as ChevronDownIcon,
3906
+ In as ChevronRightIcon,
3907
+ As as CliRuntime,
3908
+ Rn as ComponentIcon,
3909
+ xs as DaemonModel,
3910
+ ms as Explorer,
3911
+ Bs as ExplorerApp,
3912
+ Sn as ExplorerModel,
3913
+ un as FixtureRegistry,
3914
+ Tn as FolderIcon,
3915
+ Bn as LeftSidebar,
3916
+ Dn as MoonIcon,
3917
+ kn as PanelLeftIcon,
3918
+ Vn as PanelRightIcon,
3919
+ Ss as ReportModel,
3920
+ Ln as RightSidebar,
3921
+ Nn as SunIcon,
3922
+ Fn as TitleBar,
3923
+ ce as TitleBarButton,
3924
+ An as TreeItem,
3925
+ ut as TreeView,
3926
+ Vt as VIEWPORT_SIZES,
3927
+ Ft as collectComponents,
3928
+ Me as createComponentDefinition,
3929
+ le as createFixtureTree,
3930
+ Hs as defineFixture,
3931
+ Ls as defineFixtureGroup,
3932
+ Us as defineFixtureVariants,
3933
+ Fe as findNodeByPath,
3934
+ ke as fixtureGroupBrand,
3935
+ Ve as fixtureVariantsBrand,
3936
+ Dt as getDefaultPropertyValues,
3937
+ Es as isComponentDefinition,
3938
+ Ce as isFixtureGroup,
3939
+ Se as isFixtureVariants,
3940
+ xe as isSingleFixture,
3941
+ Te as mergeStyles,
3942
+ Ns as parseFixtureExport,
3943
+ Ms as parseFixtureGroup,
3944
+ Fs as parseFixtureVariants,
3945
+ Ds as parseSingleFixture,
3946
+ Nt as resolveViewport,
3947
+ Ne as singleFixtureBrand,
3948
+ p as styles,
3949
+ ht as toExplorerTree
3950
+ };
3951
+ //# sourceMappingURL=viewer.js.map