@capillaryjs/capillary-viz 1.0.0-alpha.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,19 +1,22 @@
1
- var Tt = Object.defineProperty;
2
- var zt = (t, e, r) => e in t ? Tt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var c = (t, e, r) => zt(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { Emitter as A, DerivedEmitter as z, BaseEmitter as xe, FetchState as k, combineFetchStates as Rt } from "@capillaryjs/capillary";
5
- import { Component as Te, Button as oe, css as G, OptionGroup as At, readDeclarativeRegions as Ot, OptionGroupHeaderEnd as jt, OptionsBox as Lt, Checkbox as ae, GroupBox as ge } from "@capillaryjs/capillary-ui";
6
- function Xe([t, e, r]) {
1
+ var Ft = Object.defineProperty;
2
+ var qt = (t, e, r) => e in t ? Ft(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var c = (t, e, r) => qt(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { Emitter as D, DerivedEmitter as j, BaseEmitter as Pe, FetchState as S, combineFetchStates as Ut, defaultDiagnosticScope as Ht, Diagnostics as m, diagnosticInfo as Vt, EventBubble as Ge } from "@capillaryjs/capillary";
5
+ import { Component as Ne, Placeholder as xe, Button as he, css as re, OptionGroup as Wt, readDeclarativeRegions as Yt, OptionGroupHeaderEnd as Gt, OptionsBox as Xt, Checkbox as fe, GroupBox as Ce } from "@capillaryjs/capillary-ui";
6
+ function ct([t, e, r]) {
7
7
  return {
8
8
  "--c1": t,
9
9
  "--c2": e,
10
10
  "--c3": r,
11
- "--colored-dark": t,
12
- "--colored-base": e,
13
- "--colored-light": r
11
+ ...Te(t, "--colored-dark") ? {} : { "--colored-dark": t },
12
+ ...Te(e, "--colored-base") ? {} : { "--colored-base": e },
13
+ ...Te(r, "--colored-light") ? {} : { "--colored-light": r }
14
14
  };
15
15
  }
16
- class I {
16
+ function Te(t, e) {
17
+ return t.trim().replaceAll(" ", "") === `var(${e})`;
18
+ }
19
+ class H {
17
20
  constructor(e) {
18
21
  c(this, "key");
19
22
  c(this, "label");
@@ -27,10 +30,10 @@ class I {
27
30
  c(this, "visibilityEmitters", /* @__PURE__ */ new Map());
28
31
  c(this, "releaseCategoryDefaults");
29
32
  c(this, "disposed", !1);
30
- W(e, "Criterion options"), this.key = P(e.key, "Criterion key"), this.label = ze(e.label, "Criterion label"), pe(e.categories$, "Criterion categories$"), this.categories$ = e.categories$, this.allowResorting = e.allowResorting ?? !1, this.ownedCategories = e.ownedCategories, this.hidden$ = new A(
33
+ ie(e, "Criterion options"), this.key = F(e.key, "Criterion key"), this.label = Ke(e.label, "Criterion label"), ve(e.categories$, "Criterion categories$"), this.categories$ = e.categories$, this.allowResorting = e.allowResorting ?? !1, this.ownedCategories = e.ownedCategories, this.hidden$ = new D(
31
34
  new Set(e.initialHiddenKeys ?? []),
32
- { owner: this, purpose: `${this.key} hidden categories`, equals: Mt }
33
- ), this.visibleCategoriesEmitter = new z(
35
+ { owner: this, purpose: `${this.key} hidden categories`, equals: Jt }
36
+ ), this.visibleCategoriesEmitter = new j(
34
37
  [this.categories$, this.hidden$],
35
38
  ([r, i]) => Object.freeze(
36
39
  r.filter(({ key: n }) => !i.has(n))
@@ -42,9 +45,9 @@ class I {
42
45
  }
43
46
  visibility(e) {
44
47
  this.assertActive();
45
- const r = P(e, "Category key");
48
+ const r = F(e, "Category key");
46
49
  let i = this.visibilityEmitters.get(r);
47
- return i == null && (i = new Pt(this.hidden$, r, this), this.visibilityEmitters.set(r, i)), i;
50
+ return i == null && (i = new Qt(this.hidden$, r, this), this.visibilityEmitters.set(r, i)), i;
48
51
  }
49
52
  setAllVisible(e, r) {
50
53
  this.assertActive();
@@ -67,7 +70,7 @@ class I {
67
70
  }
68
71
  }
69
72
  applyFirstSeenDefaults(e) {
70
- Je(e, `${this.label} categories`);
73
+ dt(e, `${this.label} categories`);
71
74
  const r = new Set(this.hidden$.get());
72
75
  let i = !1;
73
76
  for (const n of e)
@@ -78,36 +81,36 @@ class I {
78
81
  if (this.disposed) throw new Error(`Criterion "${this.key}" is disposed`);
79
82
  }
80
83
  }
81
- function si(t) {
82
- W(t, "Static criterion options");
83
- const e = Ze(t.categories, `${t.label} categories`), r = new A(e, {
84
+ function Si(t) {
85
+ ie(t, "Static criterion options");
86
+ const e = ut(t.categories, `${t.label} categories`), r = new D(e, {
84
87
  purpose: `${t.key} static categories`
85
88
  });
86
- return new I({ ...t, categories$: r, ownedCategories: r });
89
+ return new H({ ...t, categories$: r, ownedCategories: r });
87
90
  }
88
- function oi(t) {
89
- if (W(t, "Derived criterion options"), pe(t.source$, "Derived criterion source$"), typeof t.extractKeys != "function")
91
+ function Ei(t) {
92
+ if (ie(t, "Derived criterion options"), ve(t.source$, "Derived criterion source$"), typeof t.extractKeys != "function")
90
93
  throw new TypeError("Derived criterion extractKeys must be a function");
91
94
  if (typeof t.describe != "function")
92
95
  throw new TypeError("Derived criterion describe must be a function");
93
- const e = new z(
96
+ const e = new j(
94
97
  [t.source$],
95
- ([r]) => Dt(r, t),
98
+ ([r]) => Zt(r, t),
96
99
  { purpose: `${t.key} derived categories` }
97
100
  );
98
- return new I({
101
+ return new H({
99
102
  ...t,
100
103
  allowResorting: t.allowResorting ?? !0,
101
104
  categories$: e,
102
105
  ownedCategories: e
103
106
  });
104
107
  }
105
- function Dt(t, e) {
108
+ function Zt(t, e) {
106
109
  if (!Array.isArray(t)) throw new TypeError("Derived category items must be an array");
107
110
  const r = /* @__PURE__ */ new Map();
108
111
  let i = 0;
109
112
  for (const o of t) {
110
- const a = be(e.extractKeys(o));
113
+ const a = ze(e.extractKeys(o));
111
114
  if (a.length === 0) {
112
115
  i += 1;
113
116
  continue;
@@ -118,41 +121,41 @@ function Dt(t, e) {
118
121
  n.sort(e.compare ?? ((o, a) => a.count - o.count || o.label.localeCompare(a.label) || o.key.localeCompare(a.key)));
119
122
  const s = n.map(({ key: o, count: a }) => {
120
123
  const l = e.describe(o, a);
121
- return Ee({
124
+ return Le({
122
125
  key: o,
123
126
  ...l,
124
127
  generated: !0,
125
- predicate: (u) => be(e.extractKeys(u)).includes(o)
128
+ predicate: (u) => ze(e.extractKeys(u)).includes(o)
126
129
  }, "Derived category");
127
130
  });
128
131
  if (i > 0 && e.unmatched != null) {
129
132
  const { key: o, ...a } = e.unmatched;
130
- s.push(Ee({
133
+ s.push(Le({
131
134
  key: o,
132
135
  ...a,
133
136
  generated: !0,
134
- predicate: (l) => be(e.extractKeys(l)).length === 0
137
+ predicate: (l) => ze(e.extractKeys(l)).length === 0
135
138
  }, "Derived unmatched category"));
136
139
  }
137
- return Ze(s, "Derived categories");
140
+ return ut(s, "Derived categories");
138
141
  }
139
- function ai(t, e) {
140
- pe(t, "filterByHidden items$"), Nt(e);
142
+ function $i(t, e) {
143
+ ve(t, "filterByHidden items$"), er(e);
141
144
  const r = [t];
142
145
  for (const i of e) r.push(i.categories$, i.hidden$);
143
- return new z(
146
+ return new j(
144
147
  r,
145
148
  (i) => i[0].filter((s) => !e.some((o, a) => {
146
149
  const l = i[a * 2 + 1], u = i[a * 2 + 2];
147
- return l.some((h) => u.has(h.key) && h.predicate(s));
150
+ return l.some((d) => u.has(d.key) && d.predicate(s));
148
151
  })),
149
152
  { purpose: "items filtered by hidden visualization categories" }
150
153
  );
151
154
  }
152
- function li(t, e) {
153
- if (pe(t, "categoryCounts items$"), !(e instanceof I))
155
+ function xi(t, e) {
156
+ if (ve(t, "categoryCounts items$"), !(e instanceof H))
154
157
  throw new TypeError("categoryCounts criterion must be a GroupingCriterion");
155
- return new z(
158
+ return new j(
156
159
  [t, e.categories$],
157
160
  (r) => {
158
161
  const i = r[0], n = r[1];
@@ -164,10 +167,10 @@ function li(t, e) {
164
167
  { purpose: `${e.key} unfiltered category counts` }
165
168
  );
166
169
  }
167
- function Mt(t, e) {
170
+ function Jt(t, e) {
168
171
  return t === e || t.size === e.size && [...t].every((r) => e.has(r));
169
172
  }
170
- class Pt extends xe {
173
+ class Qt extends Pe {
171
174
  constructor(r, i, n) {
172
175
  super(r.get().has(i) ? "hidden" : "visible", {
173
176
  owner: n,
@@ -199,76 +202,76 @@ class Pt extends xe {
199
202
  });
200
203
  }
201
204
  }
202
- function be(t) {
203
- const r = (t == null ? [] : typeof t == "string" ? [t] : [...t]).map((i) => P(i, "Extracted category key"));
205
+ function ze(t) {
206
+ const r = (t == null ? [] : typeof t == "string" ? [t] : [...t]).map((i) => F(i, "Extracted category key"));
204
207
  return [...new Set(r)];
205
208
  }
206
- function Ze(t, e) {
207
- return Je(t, e), Object.freeze(t.map((r) => Ee(r, e)));
209
+ function ut(t, e) {
210
+ return dt(t, e), Object.freeze(t.map((r) => Le(r, e)));
208
211
  }
209
- function Ee(t, e) {
210
- W(t, e);
212
+ function Le(t, e) {
213
+ ie(t, e);
211
214
  const r = {
212
215
  ...t,
213
- key: P(t.key, `${e} key`),
214
- label: ze(t.label, `${e} label`),
215
- colors: Qe(t.colors, `${e} colors`)
216
+ key: F(t.key, `${e} key`),
217
+ label: Ke(t.label, `${e} label`),
218
+ colors: pt(t.colors, `${e} colors`)
216
219
  };
217
220
  if (typeof t.predicate != "function")
218
221
  throw new TypeError(`${e} predicate must be a function`);
219
- return t.colorKey !== void 0 && P(t.colorKey, `${e} colorKey`), Object.freeze(r);
222
+ return t.colorKey !== void 0 && F(t.colorKey, `${e} colorKey`), Object.freeze(r);
220
223
  }
221
- function Je(t, e) {
224
+ function dt(t, e) {
222
225
  if (!Array.isArray(t)) throw new TypeError(`${e} must be an array`);
223
226
  const r = /* @__PURE__ */ new Set();
224
227
  for (const i of t) {
225
- W(i, e);
226
- const n = P(i.key, `${e} key`);
228
+ ie(i, e);
229
+ const n = F(i.key, `${e} key`);
227
230
  if (r.has(n)) throw new Error(`${e} contains duplicate key "${n}"`);
228
- if (r.add(n), ze(i.label, `${e} label`), Qe(i.colors, `${e} colors`), typeof i.predicate != "function")
231
+ if (r.add(n), Ke(i.label, `${e} label`), pt(i.colors, `${e} colors`), typeof i.predicate != "function")
229
232
  throw new TypeError(`${e} predicate must be a function`);
230
233
  }
231
234
  }
232
- function Nt(t) {
235
+ function er(t) {
233
236
  if (!Array.isArray(t)) throw new TypeError("Criteria must be an array");
234
237
  const e = /* @__PURE__ */ new Set();
235
238
  for (const r of t) {
236
- if (!(r instanceof I))
239
+ if (!(r instanceof H))
237
240
  throw new TypeError("Criteria must contain GroupingCriterion instances");
238
241
  if (e.has(r.key)) throw new Error(`Duplicate criterion key "${r.key}"`);
239
242
  e.add(r.key);
240
243
  }
241
244
  }
242
- function Qe(t, e) {
245
+ function pt(t, e) {
243
246
  if (!Array.isArray(t) || t.length !== 3 || t.some((r) => typeof r != "string" || r.trim() === ""))
244
247
  throw new TypeError(`${e} must contain three non-empty CSS color values`);
245
248
  return Object.freeze([...t]);
246
249
  }
247
- function pe(t, e) {
250
+ function ve(t, e) {
248
251
  if (t == null || typeof t != "object" && typeof t != "function" || typeof Reflect.get(t, "get") != "function" || typeof Reflect.get(t, "getFetchState") != "function" || typeof Reflect.get(t, "getError") != "function" || typeof Reflect.get(t, "subscribe") != "function")
249
252
  throw new TypeError(`${e} must be a readable emitter`);
250
253
  }
251
- function W(t, e) {
254
+ function ie(t, e) {
252
255
  if (t == null || typeof t != "object" || Array.isArray(t))
253
256
  throw new TypeError(`${e} must be an object`);
254
257
  }
255
- function P(t, e) {
258
+ function F(t, e) {
256
259
  if (typeof t != "string" || t.trim() === "")
257
260
  throw new TypeError(`${e} must be a non-empty string`);
258
261
  return t;
259
262
  }
260
- function ze(t, e) {
263
+ function Ke(t, e) {
261
264
  if (typeof t != "string" || t.trim() === "")
262
265
  throw new TypeError(`${e} must be a non-empty string`);
263
266
  return t;
264
267
  }
265
- function we(t, e, r = {}) {
268
+ function Re(t, e, r = {}) {
266
269
  if (!Array.isArray(t)) throw new TypeError("Block layout items must be an array");
267
270
  if (!Array.isArray(e)) throw new TypeError("Block layout splits must be an array");
268
271
  const i = r.readabilityThreshold ?? 0.02;
269
272
  if (!Number.isFinite(i) || i < 0 || i > 1)
270
273
  throw new RangeError("Block readability threshold must be between zero and one");
271
- const n = [], s = Object.freeze([...t]), o = et({
274
+ const n = [], s = Object.freeze([...t]), o = ht({
272
275
  items: s,
273
276
  splits: e,
274
277
  splitIndex: 0,
@@ -283,8 +286,8 @@ function we(t, e, r = {}) {
283
286
  });
284
287
  return Object.freeze({ valid: n.length === 0, root: o, issues: Object.freeze(n) });
285
288
  }
286
- function Kt(t) {
287
- if (!(t instanceof I))
289
+ function tr(t) {
290
+ if (!(t instanceof H))
288
291
  throw new TypeError("criterionSnapshot requires a GroupingCriterion");
289
292
  return Object.freeze({
290
293
  key: t.key,
@@ -293,7 +296,7 @@ function Kt(t) {
293
296
  allowResorting: t.allowResorting
294
297
  });
295
298
  }
296
- function D(t, e) {
299
+ function I(t, e) {
297
300
  if (e == null) return null;
298
301
  let r = t;
299
302
  for (const i of e) {
@@ -303,7 +306,7 @@ function D(t, e) {
303
306
  }
304
307
  return r;
305
308
  }
306
- class It {
309
+ class rr {
307
310
  constructor(e, r, i = {}) {
308
311
  c(this, "layout$");
309
312
  c(this, "selectedPath$");
@@ -314,15 +317,15 @@ class It {
314
317
  c(this, "selectedItemsEmitter");
315
318
  c(this, "releases", []);
316
319
  c(this, "disposed", !1);
317
- this.options = i, this.layoutEmitter = new Bt(e, r, i), this.layout$ = this.layoutEmitter, this.selectedPath$ = new A(null, {
320
+ this.options = i, this.layoutEmitter = new ir(e, r, i), this.layout$ = this.layoutEmitter, this.selectedPath$ = new D(null, {
318
321
  owner: this,
319
322
  purpose: "selected block path",
320
- equals: qt
321
- }), this.selectedBlockEmitter = new z(
323
+ equals: sr
324
+ }), this.selectedBlockEmitter = new j(
322
325
  [this.layout$, this.selectedPath$],
323
- ([n, s]) => D(n.root, s),
326
+ ([n, s]) => I(n.root, s),
324
327
  { owner: this, purpose: "selected block" }
325
- ), this.selectedBlock$ = this.selectedBlockEmitter, this.selectedItemsEmitter = new z(
328
+ ), this.selectedBlock$ = this.selectedBlockEmitter, this.selectedItemsEmitter = new j(
326
329
  [this.selectedBlock$],
327
330
  ([n]) => (n == null ? void 0 : n.items) ?? Object.freeze([]),
328
331
  { owner: this, purpose: "selected block items" }
@@ -333,8 +336,8 @@ class It {
333
336
  }
334
337
  select(e, r) {
335
338
  this.assertActive();
336
- const i = tt(e);
337
- if (D(this.layout$.get().root, i) == null)
339
+ const i = ft(e);
340
+ if (I(this.layout$.get().root, i) == null)
338
341
  throw new Error("Cannot select a path absent from the current block layout");
339
342
  return this.selectedPath$.set(i, r ?? "block selected");
340
343
  }
@@ -350,24 +353,24 @@ class It {
350
353
  }
351
354
  reconcileSelection() {
352
355
  const e = this.selectedPath$.get();
353
- e == null || D(this.layout$.get().root, e) != null || this.selectedPath$.set(null, "block selection no longer exists");
356
+ e == null || I(this.layout$.get().root, e) != null || this.selectedPath$.set(null, "block selection no longer exists");
354
357
  }
355
358
  assertActive() {
356
359
  if (this.disposed) throw new Error("Block selection model is disposed");
357
360
  }
358
361
  }
359
- function ci(t, e, r = {}) {
360
- return new It(t, e, r);
362
+ function Ci(t, e, r = {}) {
363
+ return new rr(t, e, r);
361
364
  }
362
- class Bt extends xe {
365
+ class ir extends Pe {
363
366
  constructor(r, i, n) {
364
- super(we([], [], n), {
367
+ super(Re([], [], n), {
365
368
  purpose: "reactive block layout",
366
- fetchState: k.Initial
369
+ fetchState: S.Initial
367
370
  });
368
371
  c(this, "releases", []);
369
372
  c(this, "categoryReleases", []);
370
- this.items$ = r, this.splits$ = i, this.options = n, Ie(r, "Block selection items$"), Ie(i, "Block selection splits$"), this.releases.push(
373
+ this.items$ = r, this.splits$ = i, this.options = n, Xe(r, "Block selection items$"), Xe(i, "Block selection splits$"), this.releases.push(
371
374
  r.subscribe(({ event: s }) => this.recompute(s), { emitCurrent: !1 }),
372
375
  i.subscribe(({ event: s }) => {
373
376
  this.subscribeCategories(), this.recompute(s);
@@ -391,29 +394,29 @@ class Bt extends xe {
391
394
  const i = this.splits$.get(), n = [
392
395
  this.items$,
393
396
  this.splits$,
394
- ...i.map(({ categories$: p }) => p)
395
- ], s = n.map((p) => p.getFetchState()), o = n.map((p) => p.getError()).filter(Ut);
397
+ ...i.map(({ categories$: h }) => h)
398
+ ], s = n.map((h) => h.getFetchState()), o = n.map((h) => h.getError()).filter(ar);
396
399
  let a, l = null;
397
400
  try {
398
- a = we(
401
+ a = Re(
399
402
  this.items$.get(),
400
- i.map(Kt),
403
+ i.map(tr),
401
404
  this.options
402
405
  );
403
- } catch (p) {
404
- l = p, a = we([], [], this.options);
406
+ } catch (h) {
407
+ l = h, a = Re([], [], this.options);
405
408
  }
406
- const u = l == null ? o : [...o, l], h = u.length > 0 ? k.Error : Rt(s);
409
+ const u = l == null ? o : [...o, l], d = u.length > 0 ? S.Error : Ut(s);
407
410
  this.setSnapshot({
408
411
  value: a,
409
- fetchState: h,
412
+ fetchState: d,
410
413
  error: u.length === 0 ? null : Object.freeze(u),
411
414
  parentEvent: r,
412
415
  cause: "block layout source changed"
413
416
  });
414
417
  }
415
418
  }
416
- function et(t) {
419
+ function ht(t) {
417
420
  const {
418
421
  items: e,
419
422
  splits: r,
@@ -424,26 +427,26 @@ function et(t) {
424
427
  parentCount: a,
425
428
  totalShare: l,
426
429
  readabilityThreshold: u,
427
- issues: h,
428
- rootLabel: p
429
- } = t, b = r[i], y = b != null && n.length > 0 && l < u, g = b == null || y ? [] : Ft({
430
+ issues: d,
431
+ rootLabel: h
432
+ } = t, k = r[i], b = k != null && n.length > 0 && l < u, y = k == null || b ? [] : nr({
430
433
  items: e,
431
434
  splits: r,
432
435
  splitIndex: i,
433
436
  path: n,
434
- criterion: b,
437
+ criterion: k,
435
438
  totalShare: l,
436
439
  readabilityThreshold: u,
437
- issues: h,
438
- rootLabel: p
440
+ issues: d,
441
+ rootLabel: h
439
442
  }), f = a === 0 ? 0 : e.length / a;
440
443
  return Object.freeze({
441
- key: _t(n),
444
+ key: or(n),
442
445
  path: n,
443
446
  criterionKey: (s == null ? void 0 : s.key) ?? null,
444
447
  criterionLabel: (s == null ? void 0 : s.label) ?? null,
445
448
  categoryKey: (o == null ? void 0 : o.key) ?? null,
446
- label: (o == null ? void 0 : o.label) ?? p,
449
+ label: (o == null ? void 0 : o.label) ?? h,
447
450
  colors: (o == null ? void 0 : o.colors) ?? null,
448
451
  colorKey: (o == null ? void 0 : o.colorKey) ?? null,
449
452
  count: e.length,
@@ -451,52 +454,52 @@ function et(t) {
451
454
  totalShare: l,
452
455
  depth: n.length - 1,
453
456
  items: e,
454
- children: Object.freeze(g),
457
+ children: Object.freeze(y),
455
458
  childOrientation: n.length % 2 === 0 ? "horizontal" : "vertical",
456
- childrenSuppressed: y
459
+ childrenSuppressed: b
457
460
  });
458
461
  }
459
- function Ft(t) {
462
+ function nr(t) {
460
463
  const { items: e, criterion: r, path: i, issues: n } = t, s = new Map(r.categories.map((l) => [l.key, {
461
464
  category: l,
462
465
  items: []
463
466
  }]));
464
467
  let o = !0;
465
468
  if (e.forEach((l, u) => {
466
- const h = r.categories.filter((p) => p.predicate(l));
467
- if (h.length !== 1) {
469
+ const d = r.categories.filter((h) => h.predicate(l));
470
+ if (d.length !== 1) {
468
471
  o = !1, n.push(Object.freeze({
469
- kind: h.length === 0 ? "unmatched" : "multiple-matches",
472
+ kind: d.length === 0 ? "unmatched" : "multiple-matches",
470
473
  criterionKey: r.key,
471
474
  criterionLabel: r.label,
472
475
  parentPath: i,
473
476
  item: l,
474
477
  itemIndex: u,
475
- matchedCategoryKeys: Object.freeze(h.map(({ key: p }) => p))
478
+ matchedCategoryKeys: Object.freeze(d.map(({ key: h }) => h))
476
479
  }));
477
480
  return;
478
481
  }
479
- s.get(h[0].key).items.push(l);
482
+ s.get(d[0].key).items.push(l);
480
483
  }), !o) return [];
481
484
  let a = [...s.values()].filter((l) => l.items.length > 0);
482
485
  return r.allowResorting && (a = a.sort((l, u) => u.items.length - l.items.length || l.category.label.localeCompare(u.category.label) || l.category.key.localeCompare(u.category.key))), a.map(({ category: l, items: u }) => {
483
- const h = tt([...i, {
486
+ const d = ft([...i, {
484
487
  criterionKey: r.key,
485
488
  categoryKey: l.key
486
- }]), p = e.length === 0 ? 0 : u.length / e.length;
487
- return et({
489
+ }]), h = e.length === 0 ? 0 : u.length / e.length;
490
+ return ht({
488
491
  ...t,
489
492
  items: Object.freeze(u),
490
493
  splitIndex: t.splitIndex + 1,
491
- path: h,
494
+ path: d,
492
495
  criterion: r,
493
496
  category: l,
494
497
  parentCount: e.length,
495
- totalShare: t.totalShare * p
498
+ totalShare: t.totalShare * h
496
499
  });
497
500
  });
498
501
  }
499
- function tt(t) {
502
+ function ft(t) {
500
503
  if (!Array.isArray(t)) throw new TypeError("Block path must be an array");
501
504
  return Object.freeze(t.map((e) => {
502
505
  if (e == null || typeof e != "object")
@@ -506,26 +509,26 @@ function tt(t) {
506
509
  return Object.freeze({ ...e });
507
510
  }));
508
511
  }
509
- function qt(t, e) {
512
+ function sr(t, e) {
510
513
  return t === e || t != null && e != null && t.length === e.length && t.every((r, i) => {
511
514
  const n = e[i];
512
515
  return r.criterionKey === (n == null ? void 0 : n.criterionKey) && r.categoryKey === n.categoryKey;
513
516
  });
514
517
  }
515
- function _t(t) {
518
+ function or(t) {
516
519
  return t.length === 0 ? "root" : t.map(({ criterionKey: e, categoryKey: r }) => `${encodeURIComponent(e)}=${encodeURIComponent(r)}`).join("/");
517
520
  }
518
- function Ut(t) {
521
+ function ar(t) {
519
522
  return t != null;
520
523
  }
521
- function Ie(t, e) {
524
+ function Xe(t, e) {
522
525
  if (t == null || typeof t != "object" && typeof t != "function" || typeof Reflect.get(t, "get") != "function" || typeof Reflect.get(t, "getFetchState") != "function" || typeof Reflect.get(t, "getError") != "function" || typeof Reflect.get(t, "subscribe") != "function")
523
526
  throw new TypeError(`${e} must be a readable emitter`);
524
527
  }
525
- const Be = "data-cap-structural-styles";
526
- let Ht = 1;
527
- class rt {
528
- constructor(e = `runtime-${Ht++}`) {
528
+ const Ze = "data-cap-structural-styles";
529
+ let lr = 1;
530
+ class mt {
531
+ constructor(e = `runtime-${lr++}`) {
529
532
  c(this, "id");
530
533
  c(this, "cssFragments", /* @__PURE__ */ new Map());
531
534
  if (typeof e != "string") throw new TypeError("StyleRegistry id must be a string");
@@ -552,16 +555,16 @@ class rt {
552
555
  }) : s.kind === "host" && s.hosts.add(r.trim()), this;
553
556
  }
554
557
  generateCSS() {
555
- return [...this.cssFragments.values()].map((e) => e.kind === "raw" ? e.css : it(e.css, [...e.hosts])).join(`
558
+ return [...this.cssFragments.values()].map((e) => e.kind === "raw" ? e.css : yt(e.css, [...e.hosts])).join(`
556
559
 
557
560
  `);
558
561
  }
559
562
  injectAll(e = globalThis.document) {
560
563
  if ((e == null ? void 0 : e.head) == null)
561
564
  throw new TypeError("StyleRegistry.injectAll requires a document with a head");
562
- const r = `style[${Be}="${Gt(this.id)}"]`;
565
+ const r = `style[${Ze}="${dr(this.id)}"]`;
563
566
  let i = e.head.querySelector(r);
564
- i == null && (i = e.createElement("style"), i.setAttribute(Be, this.id), e.head.prepend(i));
567
+ i == null && (i = e.createElement("style"), i.setAttribute(Ze, this.id), e.head.prepend(i));
565
568
  const n = this.generateCSS();
566
569
  return i.textContent !== n && (i.textContent = n), i;
567
570
  }
@@ -569,34 +572,34 @@ class rt {
569
572
  this.cssFragments.clear();
570
573
  }
571
574
  }
572
- function Vt() {
573
- return new rt();
575
+ function cr() {
576
+ return new mt();
574
577
  }
575
- const Yt = new rt("");
576
- function Gt(t) {
578
+ const ur = new mt("");
579
+ function dr(t) {
577
580
  return t.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
578
581
  }
579
- function it(t, e) {
582
+ function yt(t, e) {
580
583
  let r = "", i = 0;
581
584
  for (; i < t.length; ) {
582
- const n = Zt(t, i);
585
+ const n = fr(t, i);
583
586
  if (n < 0) return r + t.slice(i);
584
- const s = Jt(t, n);
587
+ const s = mr(t, n);
585
588
  if (s < 0) return r + t.slice(i);
586
589
  const o = t.slice(i, n), a = t.slice(n + 1, s), l = o.trim();
587
- r += l.startsWith("@") ? `${o}{${it(a, e)}}` : `${Wt(o, e)}{${a}}`, i = s + 1;
590
+ r += l.startsWith("@") ? `${o}{${yt(a, e)}}` : `${pr(o, e)}{${a}}`, i = s + 1;
588
591
  }
589
592
  return r;
590
593
  }
591
- function Wt(t, e) {
594
+ function pr(t, e) {
592
595
  var o, a, l;
593
596
  if (e.length === 1 || !t.includes("&"))
594
597
  return e.length === 1 ? t.replaceAll("&", e[0]) : t;
595
- const r = ((o = t.match(/^\s*/)) == null ? void 0 : o[0]) ?? "", i = ((a = t.match(/\s*$/)) == null ? void 0 : a[0]) ?? "", n = Xt(t.trim()), s = ((l = r.match(/(?:^|\n)([ \t]*)$/)) == null ? void 0 : l[1]) ?? "";
596
- return r + n.flatMap((u) => u.includes("&") ? e.map((h) => u.replaceAll("&", h)) : [u]).join(`,
598
+ const r = ((o = t.match(/^\s*/)) == null ? void 0 : o[0]) ?? "", i = ((a = t.match(/\s*$/)) == null ? void 0 : a[0]) ?? "", n = hr(t.trim()), s = ((l = r.match(/(?:^|\n)([ \t]*)$/)) == null ? void 0 : l[1]) ?? "";
599
+ return r + n.flatMap((u) => u.includes("&") ? e.map((d) => u.replaceAll("&", d)) : [u]).join(`,
597
600
  ${s}`) + i;
598
601
  }
599
- function Xt(t) {
602
+ function hr(t) {
600
603
  const e = [];
601
604
  let r = 0, i = 0, n = 0, s = null;
602
605
  for (let o = 0; o < t.length; o += 1) {
@@ -609,26 +612,26 @@ function Xt(t) {
609
612
  }
610
613
  return e.push(t.slice(r).trim()), e.filter(Boolean);
611
614
  }
612
- function Zt(t, e) {
615
+ function fr(t, e) {
613
616
  for (let r = e; r < t.length; r += 1) {
614
617
  const i = t[r];
615
618
  if (i === '"' || i === "'")
616
- r = nt(t, r);
619
+ r = gt(t, r);
617
620
  else if (i === "/" && t[r + 1] === "*")
618
- r = st(t, r);
621
+ r = bt(t, r);
619
622
  else if (i === "{")
620
623
  return r;
621
624
  }
622
625
  return -1;
623
626
  }
624
- function Jt(t, e) {
627
+ function mr(t, e) {
625
628
  let r = 1;
626
629
  for (let i = e + 1; i < t.length; i += 1) {
627
630
  const n = t[i];
628
631
  if (n === '"' || n === "'")
629
- i = nt(t, i);
632
+ i = gt(t, i);
630
633
  else if (n === "/" && t[i + 1] === "*")
631
- i = st(t, i);
634
+ i = bt(t, i);
632
635
  else if (n === "{")
633
636
  r += 1;
634
637
  else if (n === "}" && --r === 0)
@@ -636,19 +639,19 @@ function Jt(t, e) {
636
639
  }
637
640
  return -1;
638
641
  }
639
- function nt(t, e) {
642
+ function gt(t, e) {
640
643
  const r = t[e];
641
644
  for (let i = e + 1; i < t.length; i += 1)
642
645
  if (t[i] === "\\") i += 1;
643
646
  else if (t[i] === r) return i;
644
647
  return t.length;
645
648
  }
646
- function st(t, e) {
649
+ function bt(t, e) {
647
650
  const r = t.indexOf("*/", e + 2);
648
651
  return r < 0 ? t.length : r + 1;
649
652
  }
650
- const Qt = /* @__PURE__ */ new WeakSet(), er = /* @__PURE__ */ new WeakSet();
651
- class ot {
653
+ const yr = /* @__PURE__ */ new WeakSet(), gr = /* @__PURE__ */ new WeakSet();
654
+ class wt {
652
655
  constructor(e = []) {
653
656
  c(this, "providers", /* @__PURE__ */ new Map());
654
657
  c(this, "instances", /* @__PURE__ */ new Map());
@@ -658,7 +661,7 @@ class ot {
658
661
  if (!Array.isArray(e))
659
662
  throw new TypeError("ServiceScope providers must be an array");
660
663
  for (const r of e) {
661
- if (ir(r), this.providers.has(r.key))
664
+ if (vr(r), this.providers.has(r.key))
662
665
  throw new Error(`Service "${r.key.name}" is registered more than once`);
663
666
  this.providers.set(r.key, r);
664
667
  }
@@ -667,10 +670,10 @@ class ot {
667
670
  return this.disposed;
668
671
  }
669
672
  has(e) {
670
- return this.assertActive(), Fe(e), this.providers.has(e);
673
+ return this.assertActive(), Je(e), this.providers.has(e);
671
674
  }
672
675
  require(e) {
673
- if (this.assertActive(), Fe(e), this.instances.has(e)) return this.instances.get(e);
676
+ if (this.assertActive(), Je(e), this.instances.has(e)) return this.instances.get(e);
674
677
  const r = this.providers.get(e);
675
678
  if (r == null) throw new Error(`Service "${e.name}" is not registered`);
676
679
  const i = this.resolving.indexOf(e);
@@ -693,7 +696,7 @@ class ot {
693
696
  for (const r of [...this.creationOrder].reverse()) {
694
697
  const i = this.instances.get(r);
695
698
  try {
696
- const n = nr(i);
699
+ const n = kr(i);
697
700
  n != null && n.call(i);
698
701
  } catch (n) {
699
702
  e.push(n);
@@ -707,29 +710,26 @@ class ot {
707
710
  if (this.disposed) throw new Error("ServiceScope has been disposed");
708
711
  }
709
712
  }
710
- function tr(t = []) {
711
- return new ot(t);
713
+ function br(t = []) {
714
+ return new wt(t);
712
715
  }
713
- function rr(t) {
714
- return t != null && (typeof t == "object" || typeof t == "function") && Qt.has(t);
716
+ function wr(t) {
717
+ return t != null && (typeof t == "object" || typeof t == "function") && yr.has(t);
715
718
  }
716
- function Fe(t) {
717
- if (!rr(t)) throw new TypeError("Expected a service key created by defineService()");
719
+ function Je(t) {
720
+ if (!wr(t)) throw new TypeError("Expected a service key created by defineService()");
718
721
  }
719
- function ir(t) {
720
- if (t == null || typeof t != "object" && typeof t != "function" || !er.has(t))
722
+ function vr(t) {
723
+ if (t == null || typeof t != "object" && typeof t != "function" || !gr.has(t))
721
724
  throw new TypeError("Expected a service provider created by provideService()");
722
725
  }
723
- function nr(t) {
726
+ function kr(t) {
724
727
  if (t == null || typeof t != "object" && typeof t != "function") return null;
725
728
  const e = Reflect.get(t, "dispose");
726
729
  return typeof e == "function" ? e : null;
727
730
  }
728
- const ne = Object.freeze({
731
+ const pe = Object.freeze({
729
732
  breadcrumbLabel: "Breadcrumb",
730
- calendarGridLabel: "Choose a date",
731
- calendarNextMonthLabel: "Next month",
732
- calendarPreviousMonthLabel: "Previous month",
733
733
  checkboxOptionLabel: "Option",
734
734
  checkboxStateLabel: (t, e) => `${t}: ${e}`,
735
735
  colorOptionGrayLabel: "Gray",
@@ -744,10 +744,6 @@ const ne = Object.freeze({
744
744
  dataTableLoadError: "Unable to load rows",
745
745
  dataTableLoading: "Loading rows…",
746
746
  dataTableRetry: "Retry",
747
- datePickerDialogLabel: "Choose a date",
748
- datePickerOpenCalendarLabel: "Open calendar",
749
- dateTimePickerDateLabel: "Date",
750
- dateTimePickerTimeLabel: "Time",
751
747
  dialogCloseLabel: "Close",
752
748
  dropdownLoadError: "Unable to load options",
753
749
  dropdownPlaceholder: "Select…",
@@ -769,16 +765,15 @@ const ne = Object.freeze({
769
765
  tabLineLabel: "Sections",
770
766
  tableFilterColumnLabel: (t) => `Filter ${t}`,
771
767
  tableSortColumnLabel: (t) => `Sort ${t}`,
772
- themeOptionJavaLabel: "Java",
768
+ themeOptionCapillaryLabel: "Capillary",
773
769
  themeOptionMinimalLabel: "Minimal",
774
770
  themeOptionShinyLabel: "Shiny",
775
- timePickerPlaceholder: "Select time…",
776
771
  toolbarLabel: "Actions",
777
772
  treeViewEmpty: "No tree items",
778
773
  treeViewLoadError: "Unable to load tree items",
779
774
  treeViewLoading: "Loading tree items…"
780
775
  });
781
- class at {
776
+ class vt {
782
777
  constructor(e, r) {
783
778
  c(this, "locale");
784
779
  c(this, "messages");
@@ -788,30 +783,30 @@ class at {
788
783
  return this.messages[e];
789
784
  }
790
785
  }
791
- const sr = new at(
786
+ const Sr = new vt(
792
787
  void 0,
793
- ne
788
+ pe
794
789
  );
795
- function or(t) {
796
- if (t == null) return sr;
790
+ function Er(t) {
791
+ if (t == null) return Sr;
797
792
  if (typeof t != "object" || Array.isArray(t))
798
793
  throw new TypeError("Capillary UI localization must be an object");
799
- const e = ar(t.locale), r = t.messages;
794
+ const e = $r(t.locale), r = t.messages;
800
795
  if (r != null && (typeof r != "object" || Array.isArray(r)))
801
796
  throw new TypeError("Capillary UI localization messages must be an object");
802
- const i = { ...ne };
797
+ const i = { ...pe };
803
798
  if (r != null)
804
- for (const n of Object.keys(ne)) {
799
+ for (const n of Object.keys(pe)) {
805
800
  const s = r[n];
806
801
  if (s === void 0) continue;
807
- const o = ne[n];
802
+ const o = pe[n];
808
803
  if (typeof s != typeof o)
809
804
  throw new TypeError(`Capillary UI localization message "${n}" has the wrong type`);
810
805
  Object.assign(i, { [n]: s });
811
806
  }
812
- return new at(e, Object.freeze(i));
807
+ return new vt(e, Object.freeze(i));
813
808
  }
814
- function ar(t) {
809
+ function $r(t) {
815
810
  if (typeof t != "string" || t.trim() === "")
816
811
  throw new TypeError("Capillary UI localization locale must be a non-empty BCP 47 language tag");
817
812
  try {
@@ -820,7 +815,7 @@ function ar(t) {
820
815
  throw new RangeError(`Invalid Capillary UI localization locale: ${t}`, { cause: e });
821
816
  }
822
817
  }
823
- const lr = /* @__PURE__ */ new Set([
818
+ const xr = /* @__PURE__ */ new Set([
824
819
  "annotation-xml",
825
820
  "color-profile",
826
821
  "font-face",
@@ -830,27 +825,28 @@ const lr = /* @__PURE__ */ new Set([
830
825
  "font-face-name",
831
826
  "missing-glyph"
832
827
  ]);
833
- class lt {
834
- constructor(e = {}, r = Vt()) {
828
+ class kt {
829
+ constructor(e = {}, r = cr()) {
835
830
  c(this, "styleRegistry");
836
831
  c(this, "services");
837
832
  c(this, "router");
838
833
  c(this, "localization");
834
+ c(this, "diagnosticScope");
839
835
  c(this, "routedRoots", /* @__PURE__ */ new WeakSet());
840
836
  if (e == null || typeof e != "object" || Array.isArray(e))
841
837
  throw new TypeError("CapillaryUiRuntime options must be an object");
842
838
  if (Object.hasOwn(e, "elementNames"))
843
839
  throw new TypeError("CapillaryUiRuntime no longer supports configurable element names");
844
- if (this.styleRegistry = r, this.localization = or(e.localization), this.services = e.services ?? tr(), !(this.services instanceof ot))
840
+ if (this.styleRegistry = r, this.diagnosticScope = e.diagnosticScope ?? Ht, this.localization = Er(e.localization), this.services = e.services ?? br(), !(this.services instanceof wt))
845
841
  throw new TypeError("Capillary UI services must be a ServiceScope");
846
842
  if (this.router = e.router ?? null, this.router != null && (typeof this.router != "object" || typeof this.router.openScope != "function" || typeof this.router.completeScope != "function"))
847
843
  throw new TypeError("Capillary UI router must be a BrowserRouter");
848
844
  }
849
845
  /** Resolve a fixed one-hyphen public host name for a built-in component. */
850
846
  resolveElementName(e) {
851
- ct(e, "Capillary UI component host name");
847
+ St(e, "Capillary UI component host name");
852
848
  const r = `cap-${e.replaceAll("-", "")}`;
853
- return cr(r), r;
849
+ return Cr(r), r;
854
850
  }
855
851
  resolveHostSelector(e, r) {
856
852
  if (typeof e != "string") throw new TypeError("Host selector must be a string");
@@ -861,7 +857,7 @@ class lt {
861
857
  return e.replaceAll("&", this.resolveElementName(r));
862
858
  }
863
859
  create(e, ...r) {
864
- const i = new e(...r);
860
+ const i = m.withScope(this.diagnosticScope, () => new e(...r));
865
861
  return i._setRuntime(this), i;
866
862
  }
867
863
  mount(e, r, i = null) {
@@ -884,16 +880,16 @@ class lt {
884
880
  return this.styleRegistry.injectAll(e);
885
881
  }
886
882
  }
887
- const qe = new lt({}, Yt);
888
- function ct(t, e) {
883
+ const Qe = new kt({}, ur);
884
+ function St(t, e) {
889
885
  if (typeof t != "string" || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(t))
890
886
  throw new TypeError(`${e} must be a lowercase kebab-case name`);
891
887
  }
892
- function cr(t) {
893
- if (ct(t, "Capillary UI element name"), !t.includes("-") || lr.has(t))
888
+ function Cr(t) {
889
+ if (St(t, "Capillary UI element name"), !t.includes("-") || xr.has(t))
894
890
  throw new TypeError(`Capillary UI element name must be a non-reserved name containing a hyphen: ${t}`);
895
891
  }
896
- const le = Symbol.for("@capillaryjs/capillary-ui.Fragment"), ur = /* @__PURE__ */ new WeakSet(), hr = /* @__PURE__ */ new Set([
892
+ const ee = Symbol.for("@capillaryjs/capillary-ui.Fragment"), Tr = /* @__PURE__ */ new WeakSet(), zr = /* @__PURE__ */ new Set([
897
893
  "allowFullScreen",
898
894
  "async",
899
895
  "autoFocus",
@@ -917,7 +913,7 @@ const le = Symbol.for("@capillaryjs/capillary-ui.Fragment"), ur = /* @__PURE__ *
917
913
  "required",
918
914
  "reversed",
919
915
  "selected"
920
- ]), dr = /* @__PURE__ */ new Set([
916
+ ]), Rr = /* @__PURE__ */ new Set([
921
917
  "checked",
922
918
  "defaultChecked",
923
919
  "defaultValue",
@@ -931,8 +927,12 @@ const le = Symbol.for("@capillaryjs/capillary-ui.Fragment"), ur = /* @__PURE__ *
931
927
  "selectedIndex",
932
928
  "tabIndex",
933
929
  "value"
934
- ]), _e = "data-cap";
935
- function ce(t, e = null, ...r) {
930
+ ]), et = "data-cap";
931
+ let C = null;
932
+ function E() {
933
+ C && (C.count += 1);
934
+ }
935
+ function me(t, e = null, ...r) {
936
936
  const i = e ?? {};
937
937
  if (typeof i != "object" || Array.isArray(i))
938
938
  throw new TypeError("VNode props must be an object or null");
@@ -946,14 +946,14 @@ function ce(t, e = null, ...r) {
946
946
  key: s,
947
947
  props: {
948
948
  ...o,
949
- children: ut([n, r])
949
+ children: Et([n, r])
950
950
  }
951
951
  };
952
952
  }
953
- function pr(t, ...e) {
953
+ function Ar(t, ...e) {
954
954
  return t.reduce((r, i, n) => r + i + String(e[n] ?? ""), "");
955
955
  }
956
- const $ = class $ {
956
+ const x = class x {
957
957
  constructor(e = {}) {
958
958
  c(this, "props");
959
959
  c(this, "dom", null);
@@ -973,7 +973,7 @@ const $ = class $ {
973
973
  c(this, "renderReadSubscriptions", /* @__PURE__ */ new Map());
974
974
  c(this, "collectingRenderReads", null);
975
975
  /** @internal */
976
- c(this, "_runtime", qe);
976
+ c(this, "_runtime", Qe);
977
977
  /** @internal Route lineage inherited by nested routed components. */
978
978
  c(this, "_routeContext", null);
979
979
  /** JSX component for this instance's runtime-configured custom host. */
@@ -987,14 +987,14 @@ const $ = class $ {
987
987
  }
988
988
  static new(...e) {
989
989
  const r = new this(...e);
990
- if (!(r instanceof $))
990
+ if (!(r instanceof x))
991
991
  throw new TypeError("Component.new() requires a Component constructor");
992
992
  return r.mount();
993
993
  }
994
- static registerStyles(e = qe, r = /* @__PURE__ */ new Set()) {
994
+ static registerStyles(e = Qe, r = /* @__PURE__ */ new Set()) {
995
995
  if (r.has(this)) return;
996
996
  r.add(this);
997
- const i = this.hostName ?? null, n = Ar(this);
997
+ const i = this.hostName ?? null, n = Wr(this);
998
998
  for (const s of n)
999
999
  Object.hasOwn(s, "css") && s.css && (i == null ? e.styleRegistry.registerCSS(s.css) : e.styleRegistry.registerHostCSS(
1000
1000
  s.css,
@@ -1005,6 +1005,24 @@ const $ = class $ {
1005
1005
  for (const o of s.dependencies ?? [])
1006
1006
  o.registerStyles(e, r);
1007
1007
  }
1008
+ get diagnosticScope() {
1009
+ var e;
1010
+ return this.constructor.diagnosticScope ?? ((e = this._parentComponent) == null ? void 0 : e.diagnosticScope) ?? this._runtime.diagnosticScope;
1011
+ }
1012
+ /** Stable instance label, captured when this component is first observed. */
1013
+ get diagnosticLabel() {
1014
+ const e = this.constructor;
1015
+ return e.diagnosticLabel ?? e.hostName ?? e.name;
1016
+ }
1017
+ [Vt]() {
1018
+ return {
1019
+ kind: "component",
1020
+ label: _(this),
1021
+ scope: this.diagnosticScope,
1022
+ sources: [...this.watched.keys(), ...this.renderReadSubscriptions.keys()],
1023
+ targets: [...this._childComponents]
1024
+ };
1025
+ }
1008
1026
  /** One-time setup hook. Constructors must not subscribe or render. */
1009
1027
  initialize() {
1010
1028
  }
@@ -1013,24 +1031,25 @@ const $ = class $ {
1013
1031
  }
1014
1032
  /** Render this component's configured custom host element. */
1015
1033
  host(e = null, ...r) {
1016
- const n = this.constructor.hostName;
1034
+ const i = this.constructor, n = i.hostName;
1017
1035
  if (n == null)
1018
1036
  throw new Error(`${this.constructor.name} does not declare a custom host name`);
1019
1037
  const {
1020
1038
  class: s,
1021
1039
  className: o,
1022
1040
  ...a
1023
- } = e ?? {}, l = o ?? s, u = this.props.island === !0 ? Or(l, "island") : l;
1024
- return ce(this._runtime.resolveElementName(n), {
1041
+ } = e ?? {}, l = o ?? s, u = this.props.island === !0 ? Yr(l, "island") : l;
1042
+ return me(this._runtime.resolveElementName(n), {
1025
1043
  ...a,
1026
1044
  ...u == null ? {} : { className: u },
1027
- "data-cap-component": n
1045
+ "data-cap-component": n,
1046
+ ...i.dataSurface == null ? {} : { "data-cap-surface": i.dataSurface }
1028
1047
  }, ...r);
1029
1048
  }
1030
1049
  /** @internal Assign an immutable application runtime before initialization or mounting. */
1031
1050
  _setRuntime(e) {
1032
1051
  var r;
1033
- if (!(e instanceof lt))
1052
+ if (!(e instanceof kt))
1034
1053
  throw new TypeError("Component runtime must be a CapillaryUiRuntime");
1035
1054
  if (e === this._runtime) return this;
1036
1055
  if (this.initialized || this.mounted || this._rendered != null)
@@ -1057,39 +1076,66 @@ const $ = class $ {
1057
1076
  if (this.destroyed) throw new Error("Cannot mount a destroyed component");
1058
1077
  this.validateIslandAncestry(this.props);
1059
1078
  let i = !1;
1060
- return this.initialized || (this.validateRequiredServices(), this.initialized = !0, this.initialize()), this.mounted || (this.mounted = !0, this.update(), i = !0), e != null && (Rr(e), je(e, this._rendered, r)), i && this.afterMount(this.dom), this;
1079
+ return this.initialized || (this.validateRequiredServices(), this.initialized = !0, m.withScope(this.diagnosticScope, () => this.initialize())), this.mounted || (this.mounted = !0, this.update(), i = !0), e != null && (Vr(e), Fe(e, this._rendered, r)), i && this.afterMount(this.dom), this;
1061
1080
  }
1062
1081
  attachTo(e) {
1063
1082
  return this.mount(e), this;
1064
1083
  }
1065
- update(e) {
1084
+ update(e, r = e instanceof Ge ? "dependency" : "explicit") {
1066
1085
  if (this.destroyed) return this;
1067
1086
  if (!this.mounted) return this.mount();
1068
1087
  if (this.updating)
1069
1088
  return this.updateRequested = !0, this;
1070
1089
  this.updating = !0;
1090
+ const i = m.event(this, "consumer", {
1091
+ parent: e instanceof Ge ? e : m.currentEvent,
1092
+ cause: "component render",
1093
+ outcome: "started",
1094
+ consumer: { trigger: r }
1095
+ }), n = C, s = i ? { count: 0 } : null;
1096
+ let o = 0;
1097
+ C = s;
1071
1098
  try {
1072
- do {
1073
- this.updateRequested = !1;
1074
- const r = /* @__PURE__ */ new Set();
1075
- this.collectingRenderReads = r;
1076
- let i;
1077
- try {
1078
- i = H(this.render());
1079
- } finally {
1080
- this.collectingRenderReads = null;
1081
- }
1082
- this._rendered = Re(this._rendered, i, this), this.dom = mt(this._rendered), this.reconcileRenderReads(r), this.afterUpdate(this.dom);
1083
- } while (this.updateRequested && !this.destroyed);
1099
+ m.withEvent(i, () => {
1100
+ do {
1101
+ o += 1, this.updateRequested = !1;
1102
+ const a = /* @__PURE__ */ new Set();
1103
+ this.collectingRenderReads = a;
1104
+ let l;
1105
+ try {
1106
+ l = m.withScope(this.diagnosticScope, () => J(this.render()));
1107
+ } finally {
1108
+ this.collectingRenderReads = null;
1109
+ }
1110
+ this._rendered = Ie(this._rendered, l, this), this.dom = At(this._rendered), this.reconcileRenderReads(a), this.afterUpdate(this.dom);
1111
+ } while (this.updateRequested && !this.destroyed);
1112
+ }), i && m.event(this, "consumer", {
1113
+ parent: i,
1114
+ cause: "component rendered",
1115
+ outcome: "succeeded",
1116
+ consumer: { trigger: r, domWrites: s.count, renderPasses: o }
1117
+ });
1118
+ } catch (a) {
1119
+ throw i && m.event(this, "consumer", {
1120
+ parent: i,
1121
+ cause: "component render failed",
1122
+ outcome: "failed",
1123
+ error: a,
1124
+ consumer: { trigger: r, domWrites: s.count, renderPasses: o }
1125
+ }), a;
1084
1126
  } finally {
1085
- this.updating = !1;
1127
+ C = n, this.updating = !1;
1086
1128
  }
1087
1129
  return this;
1088
1130
  }
1089
1131
  setProps(e) {
1132
+ var r, i;
1090
1133
  if (e == null || typeof e != "object" || Array.isArray(e))
1091
1134
  throw new TypeError(`${this.constructor.name} props must be an object`);
1092
- return this.validateIslandAncestry(e), this.props = e, this.mounted && this.update(), this;
1135
+ return this.validateIslandAncestry(e), this.props = e, this.mounted && this.update(
1136
+ void 0,
1137
+ ((i = (r = m.currentEvent) == null ? void 0 : r.diagnostic) == null ? void 0 : i.node.kind) === "binding" ? "dependency" : "parent"
1138
+ ), this;
1093
1139
  }
1094
1140
  afterMount(e) {
1095
1141
  }
@@ -1102,7 +1148,7 @@ const $ = class $ {
1102
1148
  if (this.watched.has(r)) continue;
1103
1149
  const i = r.subscribe(({ event: n }) => {
1104
1150
  this.mounted && !this.destroyed && this.update(n);
1105
- }, { emitCurrent: !1 });
1151
+ }, { emitCurrent: !1, diagnosticTarget: this });
1106
1152
  this.watched.set(r, i), this.onCleanup(() => {
1107
1153
  i(), this.watched.delete(r);
1108
1154
  });
@@ -1157,21 +1203,67 @@ const $ = class $ {
1157
1203
  listen(e, r, i, n) {
1158
1204
  if (e == null || typeof e.addEventListener != "function")
1159
1205
  throw new TypeError("listen target must be an EventTarget");
1160
- const s = i;
1161
- return e.addEventListener(r, s, n), this.onCleanup(() => e.removeEventListener(r, s, n)), this;
1206
+ const s = {};
1207
+ m.configure(s, {
1208
+ kind: "interaction",
1209
+ label: `${_(this)}: ${r}`,
1210
+ scope: this.diagnosticScope
1211
+ });
1212
+ const o = (a) => ge(
1213
+ s,
1214
+ this.diagnosticScope,
1215
+ a,
1216
+ o,
1217
+ r,
1218
+ () => i(a)
1219
+ );
1220
+ return e.addEventListener(r, o, n), this.onCleanup(() => {
1221
+ e.removeEventListener(r, o, n), m.dispose(s);
1222
+ }), this;
1223
+ }
1224
+ /**
1225
+ * Like {@link listen}, but returns a function that detaches the listener.
1226
+ * Use for listeners that are only active some of the time — for example
1227
+ * an outside-click handler that exists only while a popup is open — so
1228
+ * they neither fire nor appear in the trace while inactive. The listener
1229
+ * runs through the same traced native-event coalescing as listen(), and
1230
+ * is removed on destroy if it is still attached.
1231
+ */
1232
+ listenWhile(e, r, i, n) {
1233
+ if (e == null || typeof e.addEventListener != "function")
1234
+ throw new TypeError("listen target must be an EventTarget");
1235
+ const s = {};
1236
+ m.configure(s, {
1237
+ kind: "interaction",
1238
+ label: `${_(this)}: ${r}`,
1239
+ scope: this.diagnosticScope
1240
+ });
1241
+ const o = (d) => ge(
1242
+ s,
1243
+ this.diagnosticScope,
1244
+ d,
1245
+ o,
1246
+ r,
1247
+ () => i(d)
1248
+ );
1249
+ let a = !1;
1250
+ const l = () => {
1251
+ a && (a = !1, e.removeEventListener(r, o, n), m.dispose(s));
1252
+ }, u = this.onCleanup(l);
1253
+ return this.destroyed || (a = !0, e.addEventListener(r, o, n)), u;
1162
1254
  }
1163
1255
  registerChild(e) {
1164
- if (!(e instanceof $))
1256
+ if (!(e instanceof x))
1165
1257
  throw new TypeError("registerChild requires a Component");
1166
- return this._childComponents.add(e), e;
1258
+ return this._childComponents.add(e), m.active && m.inspect(this), e;
1167
1259
  }
1168
1260
  destroy() {
1169
1261
  if (!this.destroyed) {
1170
- this.destroyed = !0, this.mounted = !1;
1262
+ this.destroyed = !0, this.mounted = !1, m.dispose(this);
1171
1263
  for (const e of [...this.cleanupFunctions]) e();
1172
1264
  this.cleanupFunctions.clear(), this.watched.clear();
1173
1265
  for (const e of this.renderReadSubscriptions.values()) e();
1174
- this.renderReadSubscriptions.clear(), this.collectingRenderReads = null, this._rendered && R(this._rendered, !0), this._rendered = null, this.dom = null, this._childComponents.clear(), this.onDestroy();
1266
+ this.renderReadSubscriptions.clear(), this.collectingRenderReads = null, this._rendered && M(this._rendered, !0), this._rendered = null, this.dom = null, this._childComponents.clear(), this.onDestroy();
1175
1267
  }
1176
1268
  }
1177
1269
  validateRequiredServices() {
@@ -1181,25 +1273,25 @@ const $ = class $ {
1181
1273
  throw new Error(`${e.name} requires unregistered service "${r.name}"`);
1182
1274
  }
1183
1275
  validateIslandAncestry(e) {
1184
- if (!ke(e)) return;
1276
+ if (!Oe(e)) return;
1185
1277
  if (this.hasIslandDescendant())
1186
1278
  throw new Error("An island component cannot contain another island");
1187
1279
  let r = this._parentComponent;
1188
1280
  for (; r != null; ) {
1189
- if (ke(r.props))
1281
+ if (Oe(r.props))
1190
1282
  throw new Error("An island component cannot be nested inside another island");
1191
1283
  r = r._parentComponent;
1192
1284
  }
1193
1285
  }
1194
1286
  hasIslandDescendant() {
1195
1287
  for (const e of this._childComponents)
1196
- if (ke(e.props) || e.hasIslandDescendant()) return !0;
1288
+ if (Oe(e.props) || e.hasIslandDescendant()) return !0;
1197
1289
  return !1;
1198
1290
  }
1199
1291
  onDestroy() {
1200
1292
  }
1201
1293
  trackRenderRead(e) {
1202
- if (wt(e, "Component.read"), this.collectingRenderReads == null)
1294
+ if (Mt(e, "Component.read"), this.collectingRenderReads == null)
1203
1295
  throw new Error("Component.read() and snapshot() may only be called during render()");
1204
1296
  this.collectingRenderReads.add(e);
1205
1297
  }
@@ -1210,13 +1302,13 @@ const $ = class $ {
1210
1302
  if (this.watched.has(r) || this.renderReadSubscriptions.has(r)) continue;
1211
1303
  const i = r.subscribe(({ event: n }) => {
1212
1304
  this.mounted && !this.destroyed && this.update(n);
1213
- }, { emitCurrent: !1 });
1305
+ }, { emitCurrent: !1, diagnosticTarget: this });
1214
1306
  this.renderReadSubscriptions.set(r, i);
1215
1307
  }
1216
1308
  }
1217
1309
  };
1218
- c($, "dependencies", []), c($, "requiredServices", []), /** Component `live()` bindings are opt-in; subclasses declare their allowlist. */
1219
- c($, "liveProps", []), c($, "css", pr`
1310
+ c(x, "dependencies", []), c(x, "requiredServices", []), /** Component `live()` bindings are opt-in; subclasses declare their allowlist. */
1311
+ c(x, "liveProps", []), c(x, "css", Ar`
1220
1312
  .cap-fill-horizontal,
1221
1313
  .cap-fill-vertical {
1222
1314
  box-sizing: border-box;
@@ -1247,6 +1339,7 @@ c($, "liveProps", []), c($, "css", pr`
1247
1339
  align-items: stretch;
1248
1340
  min-inline-size: 0;
1249
1341
  min-block-size: 0;
1342
+ gap: calc(var(--_cap-island-flow, 0) * var(--island-gap, 0px));
1250
1343
  }
1251
1344
 
1252
1345
  .cap-layout-horizontal {
@@ -1268,11 +1361,55 @@ c($, "liveProps", []), c($, "css", pr`
1268
1361
  }
1269
1362
 
1270
1363
  .cap-scroll {
1364
+ /* Move the clip into the surrounding gutter without moving the
1365
+ * content. The inherited allowance is owned by the parent layout,
1366
+ * so local gaps and nested scrollports do not add extra spacing. */
1367
+ --_cap-scroll-gutter: calc(var(--_cap-island-flow, 0) * var(--_cap-island-gutter, 0px));
1368
+ margin: calc(-1 * var(--_cap-scroll-gutter));
1369
+ padding: var(--_cap-scroll-gutter);
1271
1370
  overflow: auto;
1272
1371
  min-inline-size: 0;
1273
1372
  min-block-size: 0;
1274
1373
  }
1275
1374
 
1375
+ /* The mode crosses wrappers; each layout resolves its own public gap.
1376
+ * Only the first enabled scope contributes a perimeter inset. */
1377
+ .cap-island-layout {
1378
+ --_cap-island-flow: 1;
1379
+ --_cap-island-margin: 0px;
1380
+ --_cap-island-separator-background: transparent;
1381
+ box-sizing: border-box;
1382
+ padding: var(--_cap-island-outer-inset, var(--island-inset, 0px));
1383
+ gap: calc(var(--_cap-island-flow, 0) * var(--island-gap, 0px));
1384
+ }
1385
+
1386
+ .cap-island-layout > * {
1387
+ --_cap-island-outer-inset: 0px;
1388
+ }
1389
+
1390
+ .cap-layout-horizontal > *,
1391
+ .cap-layout-vertical > *,
1392
+ .cap-island-layout > * {
1393
+ --_cap-island-gutter: calc(var(--_cap-island-flow, 0) * var(--island-gap, 0px) / 2);
1394
+ }
1395
+
1396
+ .cap-island-layout.cap-scroll {
1397
+ padding: calc(var(--_cap-island-outer-inset, var(--island-inset, 0px))
1398
+ + var(--_cap-scroll-gutter));
1399
+ }
1400
+
1401
+ .cap-island-layout-off {
1402
+ --_cap-island-flow: 0;
1403
+ --_cap-island-margin: initial;
1404
+ --_cap-island-separator-background: initial;
1405
+ }
1406
+
1407
+ .cap-island-layout-off > *,
1408
+ .island > * {
1409
+ --_cap-island-outer-inset: initial;
1410
+ --_cap-island-gutter: 0px;
1411
+ }
1412
+
1276
1413
  .colored {
1277
1414
  --colored-base-bg:
1278
1415
  linear-gradient(
@@ -1290,10 +1427,12 @@ c($, "liveProps", []), c($, "css", pr`
1290
1427
 
1291
1428
  .app-footer.island,
1292
1429
  .island {
1430
+ --_cap-island-flow: 0;
1431
+ --_cap-island-separator-background: initial;
1293
1432
  box-sizing: border-box;
1294
1433
  min-width: 0;
1295
1434
  min-height: 0;
1296
- margin: var(--island-margin);
1435
+ margin: var(--_cap-island-margin, var(--island-margin));
1297
1436
  padding: var(--island-padding);
1298
1437
  background: var(--island-background);
1299
1438
  border: var(--island-border);
@@ -1303,25 +1442,28 @@ c($, "liveProps", []), c($, "css", pr`
1303
1442
 
1304
1443
  .cap-fill-horizontal.island,
1305
1444
  .cap-fill-horizontal .island {
1306
- max-width: calc(100% - (2 * var(--island-margin)));
1445
+ max-width: calc(100% - (2 * var(--_cap-island-margin, var(--island-margin))));
1307
1446
  overflow-x: auto;
1308
1447
  }
1309
1448
 
1310
1449
  .cap-fill-vertical.island,
1311
1450
  .cap-fill-vertical .island {
1312
- max-height: calc(100% - (2 * var(--island-margin)));
1451
+ max-height: calc(100% - (2 * var(--_cap-island-margin, var(--island-margin))));
1313
1452
  overflow-y: auto;
1314
1453
  }
1315
1454
 
1316
1455
  label[data-cap] {
1317
1456
  user-select: none;
1318
1457
  }
1319
- `), c($, "hostName", null);
1320
- let C = $;
1321
- function H(t) {
1322
- return Array.isArray(t) ? ce(le, null, t) : t == null || typeof t == "boolean" ? ce(le) : t;
1458
+ `), c(x, "hostName", null), /** Override for a diagnostic-tool subtree; ordinary components inherit their owner/runtime. */
1459
+ c(x, "diagnosticScope", null), /** Optional stable display name for bundled application components. Built-ins use their host name. */
1460
+ c(x, "diagnosticLabel", null), /** Optional host-level data surface marker for parent composition. */
1461
+ c(x, "dataSurface", null);
1462
+ let T = x;
1463
+ function J(t) {
1464
+ return Array.isArray(t) ? me(ee, null, t) : t == null || typeof t == "boolean" ? me(ee) : t;
1323
1465
  }
1324
- function ut(t) {
1466
+ function Et(t) {
1325
1467
  const e = [], r = (i) => {
1326
1468
  if (Array.isArray(i))
1327
1469
  for (const n of i) r(n);
@@ -1329,7 +1471,7 @@ function ut(t) {
1329
1471
  };
1330
1472
  return r(t), e;
1331
1473
  }
1332
- function Y(t, e) {
1474
+ function te(t, e) {
1333
1475
  if (typeof t == "string" || typeof t == "number")
1334
1476
  return {
1335
1477
  kind: "text",
@@ -1338,15 +1480,15 @@ function Y(t, e) {
1338
1480
  node: document.createTextNode(String(t)),
1339
1481
  owner: e
1340
1482
  };
1341
- if (fe(t)) {
1483
+ if (Se(t)) {
1342
1484
  const s = document.createComment("cap-emitter-start"), o = document.createComment("cap-emitter-end"), a = t.get();
1343
1485
  if (Object.is(a, t))
1344
1486
  throw new TypeError("A Capillary UI emitter child cannot render itself");
1345
1487
  const l = document.createDocumentFragment();
1346
- l.append(s, o);
1347
- const u = Y(H(a), e);
1348
- je(l, u, o);
1349
- const h = {
1488
+ l.append(s, o), E(), E();
1489
+ const u = te(J(a), e);
1490
+ Fe(l, u, o);
1491
+ const d = {
1350
1492
  kind: "emitter",
1351
1493
  key: null,
1352
1494
  source: t,
@@ -1357,16 +1499,16 @@ function Y(t, e) {
1357
1499
  },
1358
1500
  owner: e
1359
1501
  };
1360
- return h.unsubscribe = t.subscribe(({ value: p }) => {
1361
- if (Object.is(p, t))
1502
+ return d.unsubscribe = ke(t, d, e, "reactive child", (h) => {
1503
+ if (Object.is(h, t))
1362
1504
  throw new TypeError("A Capillary UI emitter child cannot render itself");
1363
- h.child = Re(h.child, H(p), e);
1364
- }, { emitCurrent: !1 }), h;
1505
+ d.child = Ie(d.child, J(h), e);
1506
+ }), d;
1365
1507
  }
1366
- if (t instanceof C)
1508
+ if (t instanceof T)
1367
1509
  return t._setRuntime(e._runtime), t._setRouteContext(e._routeContextForChildren()), t._setParentComponent(e), t.mount(), e.registerChild(t), {
1368
1510
  kind: "component",
1369
- key: yt(t.props),
1511
+ key: Ot(t.props),
1370
1512
  type: t.constructor,
1371
1513
  instance: t,
1372
1514
  prebuilt: !0,
@@ -1374,10 +1516,10 @@ function Y(t, e) {
1374
1516
  liveProps: /* @__PURE__ */ new Map(),
1375
1517
  owner: e
1376
1518
  };
1377
- if (!T(t))
1378
- throw new TypeError(`Invalid Capillary UI child: ${Ve(t)}`);
1519
+ if (!O(t))
1520
+ throw new TypeError(`Invalid Capillary UI child: ${st(t)}`);
1379
1521
  const { type: r, key: i = null, props: n } = t;
1380
- if (r === le) {
1522
+ if (r === ee) {
1381
1523
  const s = document.createComment("cap-fragment-start"), o = document.createComment("cap-fragment-end"), a = {
1382
1524
  kind: "fragment",
1383
1525
  key: i,
@@ -1387,7 +1529,7 @@ function Y(t, e) {
1387
1529
  children: [],
1388
1530
  owner: e
1389
1531
  }, l = document.createDocumentFragment();
1390
- return l.append(s, o), a.children = ue(
1532
+ return l.append(s, o), E(), E(), a.children = ye(
1391
1533
  l,
1392
1534
  [],
1393
1535
  n.children,
@@ -1410,12 +1552,15 @@ function Y(t, e) {
1410
1552
  children: [],
1411
1553
  owner: e
1412
1554
  };
1413
- return ft(o, n), o.children = ue(s, [], n.children, e), o;
1555
+ return zt(o, n), o.children = ye(s, [], n.children, e), o;
1414
1556
  }
1415
- if (bt(r)) {
1557
+ if (Lt(r)) {
1416
1558
  const s = n;
1417
- pt(r, s);
1418
- const o = Ue(s), a = new r(o);
1559
+ Ct(r, s);
1560
+ const o = tt(s), a = m.withScope(
1561
+ r.diagnosticScope ?? e.diagnosticScope,
1562
+ () => new r(o)
1563
+ );
1419
1564
  a._setRuntime(e._runtime), a._setRouteContext(e._routeContextForChildren()), a._setParentComponent(e);
1420
1565
  const l = {
1421
1566
  kind: "component",
@@ -1427,190 +1572,220 @@ function Y(t, e) {
1427
1572
  liveProps: /* @__PURE__ */ new Map(),
1428
1573
  owner: e
1429
1574
  };
1430
- return dt(l, s), a.mount(), e.registerChild(a), l;
1575
+ return xt(l, s), a.mount(), e.registerChild(a), l;
1431
1576
  }
1432
1577
  if (typeof r == "function") {
1433
- const s = r, o = n, a = Ue(o), l = H(s(a)), u = {
1578
+ const s = r, o = n, a = tt(o), l = s === Reflect.get(e, "Host") ? null : {};
1579
+ l && m.configure(l, {
1580
+ kind: "component",
1581
+ label: String(Reflect.get(s, "diagnosticLabel") ?? s.name ?? "Function component"),
1582
+ scope: e.diagnosticScope,
1583
+ sources: [e]
1584
+ });
1585
+ const u = Tt(l, () => te(J(s(a)), e)), d = {
1434
1586
  kind: "function",
1435
1587
  key: i,
1436
1588
  type: s,
1437
1589
  props: a,
1438
1590
  sourceProps: o,
1439
1591
  liveProps: /* @__PURE__ */ new Map(),
1440
- child: Y(l, e),
1592
+ child: u,
1593
+ diagnosticSubject: l,
1441
1594
  owner: e
1442
1595
  };
1443
- return mr(u), u;
1596
+ return jr(d), d;
1444
1597
  }
1445
- throw new TypeError(`Unsupported vnode type: ${Ve(r)}`);
1598
+ throw new TypeError(`Unsupported vnode type: ${st(r)}`);
1446
1599
  }
1447
- function Re(t, e, r) {
1448
- if (t == null) return Y(e, r);
1449
- if (gt(t, e)) return ht(t, e, r);
1450
- const i = Y(e, r), n = mt(t), s = (n == null ? void 0 : n.parentNode) ?? null;
1451
- return s && je(s, i, n), R(t, !0), i;
1600
+ function Ie(t, e, r) {
1601
+ if (t == null) return te(e, r);
1602
+ if (jt(t, e)) return $t(t, e, r);
1603
+ const i = te(e, r), n = At(t), s = (n == null ? void 0 : n.parentNode) ?? null;
1604
+ return s && Fe(s, i, n), M(t, !0), i;
1452
1605
  }
1453
- function ht(t, e, r) {
1454
- return t.kind === "text" ? (typeof e != "string" && typeof e != "number" || Object.is(t.value, e) || (t.value = e, t.node.data = String(e)), t) : t.kind === "emitter" ? (!fe(e) || t.source !== e, t) : t.kind === "component" ? (e instanceof C || T(e) && fr(t, e.props), t) : T(e) ? t.kind === "function" ? (yr(t, e.props), t) : t.kind === "fragment" ? (t.children = ue(
1606
+ function $t(t, e, r) {
1607
+ return t.kind === "text" ? (typeof e != "string" && typeof e != "number" || Object.is(t.value, e) || (t.value = e, t.node.data = String(e), E()), t) : t.kind === "emitter" ? (!Se(e) || t.source !== e, t) : t.kind === "component" ? (e instanceof T || O(e) && Or(t, e.props), t) : O(e) ? t.kind === "function" ? (Lr(t, e.props), t) : t.kind === "fragment" ? (t.children = ye(
1455
1608
  t.start.parentNode,
1456
1609
  t.children,
1457
1610
  e.props.children,
1458
1611
  r,
1459
1612
  t.end,
1460
1613
  t.start
1461
- ), t) : (ft(t, e.props), t.children = ue(
1614
+ ), t) : (zt(t, e.props), t.children = ye(
1462
1615
  t.node,
1463
1616
  t.children,
1464
1617
  e.props.children,
1465
1618
  r
1466
1619
  ), t) : t;
1467
1620
  }
1468
- function Ue(t) {
1621
+ function tt(t) {
1469
1622
  return Object.fromEntries(Object.entries(t).map(([e, r]) => [
1470
1623
  e,
1471
- N(r) ? r.emitter.get() : r
1624
+ q(r) ? r.emitter.get() : r
1472
1625
  ]));
1473
1626
  }
1474
- function dt(t, e) {
1475
- Ae(t.liveProps, e, (r, i) => {
1627
+ function xt(t, e) {
1628
+ _e(t.liveProps, e, t.instance, _(t.instance), (r, i) => {
1476
1629
  t.props = { ...t.props, [r]: i }, t.instance.setProps(t.props);
1477
- }), t.props = Oe(t.liveProps, e), t.instance.setProps(t.props);
1630
+ }), t.props = Be(t.liveProps, e), t.instance.setProps(t.props);
1478
1631
  }
1479
- function fr(t, e) {
1480
- pt(t.type, e), dt(t, e);
1632
+ function Or(t, e) {
1633
+ Ct(t.type, e), xt(t, e);
1481
1634
  }
1482
- function pt(t, e) {
1635
+ function Ct(t, e) {
1483
1636
  const r = Reflect.get(t, "liveProps");
1484
1637
  if (r == null) return;
1485
1638
  if (!Array.isArray(r) || r.some((n) => typeof n != "string"))
1486
1639
  throw new TypeError(`${t.name || "Component"}.liveProps must be an array`);
1487
1640
  const i = new Set(r);
1488
1641
  for (const [n, s] of Object.entries(e))
1489
- if (N(s) && !i.has(n))
1642
+ if (q(s) && !i.has(n))
1490
1643
  throw new TypeError(
1491
1644
  `${t.name || "Component"} prop "${n}" does not support live()`
1492
1645
  );
1493
1646
  }
1494
- function mr(t) {
1495
- Ae(t.liveProps, t.sourceProps, (e, r) => {
1496
- t.props = { ...t.props, [e]: r }, $e(t);
1497
- }), t.props = Oe(t.liveProps, t.sourceProps);
1498
- }
1499
- function yr(t, e) {
1500
- t.sourceProps = e, Ae(t.liveProps, e, (r, i) => {
1501
- t.props = { ...t.props, [r]: i }, $e(t);
1502
- }), t.props = Oe(t.liveProps, e), $e(t);
1503
- }
1504
- function $e(t) {
1505
- const e = H(t.type(t.props));
1506
- t.child = Re(t.child, e, t.owner);
1507
- }
1508
- function Ae(t, e, r) {
1509
- for (const [i, n] of t) {
1510
- const s = e[i];
1511
- N(s) && s.emitter === n.source || (n.unsubscribe(), t.delete(i));
1512
- }
1513
- for (const [i, n] of Object.entries(e)) {
1514
- if (!N(n) || t.has(i)) continue;
1515
- const s = {
1516
- source: n.emitter,
1517
- value: n.emitter.get(),
1647
+ function jr(t) {
1648
+ _e(t.liveProps, t.sourceProps, t.owner, t.type.diagnosticLabel ?? t.type.name, (e, r) => {
1649
+ t.props = { ...t.props, [e]: r }, Me(t, "dependency");
1650
+ }), t.props = Be(t.liveProps, t.sourceProps);
1651
+ }
1652
+ function Lr(t, e) {
1653
+ t.sourceProps = e, _e(t.liveProps, e, t.owner, t.type.diagnosticLabel ?? t.type.name, (r, i) => {
1654
+ t.props = { ...t.props, [r]: i }, Me(t, "dependency");
1655
+ }), t.props = Be(t.liveProps, e), Me(t);
1656
+ }
1657
+ function Me(t, e = "parent") {
1658
+ Tt(t.diagnosticSubject, () => {
1659
+ const r = J(t.type(t.props));
1660
+ t.child = Ie(t.child, r, t.owner);
1661
+ }, e);
1662
+ }
1663
+ function Tt(t, e, r = "parent") {
1664
+ if (!t) return e();
1665
+ const i = m.event(t, "consumer", { cause: "function component render", outcome: "started", consumer: { trigger: r } }), n = C, s = i ? { count: 0 } : null;
1666
+ C = s;
1667
+ try {
1668
+ const o = i ? m.withEvent(i, e) : e();
1669
+ return i && m.event(t, "consumer", { parent: i, cause: "function component rendered", outcome: "succeeded", consumer: { trigger: r, domWrites: s.count, renderPasses: 1 } }), o;
1670
+ } catch (o) {
1671
+ throw i && m.event(t, "consumer", { parent: i, cause: "function component failed", outcome: "failed", error: o, consumer: { trigger: r, domWrites: s.count, renderPasses: 1 } }), o;
1672
+ } finally {
1673
+ C = n;
1674
+ }
1675
+ }
1676
+ function _e(t, e, r, i, n) {
1677
+ for (const [s, o] of t) {
1678
+ const a = e[s];
1679
+ q(a) && a.emitter === o.source || (o.unsubscribe(), t.delete(s));
1680
+ }
1681
+ for (const [s, o] of Object.entries(e)) {
1682
+ if (!q(o) || t.has(s)) continue;
1683
+ const a = {
1684
+ source: o.emitter,
1685
+ value: o.emitter.get(),
1518
1686
  unsubscribe: () => {
1519
1687
  }
1520
1688
  };
1521
- s.unsubscribe = n.emitter.subscribe(({ value: o }) => {
1522
- t.get(i) === s && (s.value = o, r(i, o));
1523
- }, { emitCurrent: !1 }), t.set(i, s);
1689
+ a.unsubscribe = ke(o.emitter, a, r, `${i}.${s}`, (l) => {
1690
+ t.get(s) === a && (a.value = l, n(s, l));
1691
+ }), t.set(s, a);
1524
1692
  }
1525
1693
  }
1526
- function Oe(t, e) {
1694
+ function Be(t, e) {
1527
1695
  return Object.fromEntries(Object.entries(e).map(([r, i]) => {
1528
1696
  var n;
1529
1697
  return [
1530
1698
  r,
1531
- N(i) ? ((n = t.get(r)) == null ? void 0 : n.value) ?? i.emitter.get() : i
1699
+ q(i) ? ((n = t.get(r)) == null ? void 0 : n.value) ?? i.emitter.get() : i
1532
1700
  ];
1533
1701
  }));
1534
1702
  }
1535
- function ue(t, e, r, i, n = null, s = null) {
1703
+ function ye(t, e, r, i, n = null, s = null) {
1536
1704
  if (t == null) throw new Error("Cannot patch a detached fragment range");
1537
- const o = ut(r), a = /* @__PURE__ */ new Map(), l = [];
1538
- for (const g of e)
1539
- g.key == null ? l.push(g) : a.has(g.key) || a.set(g.key, g);
1540
- const u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), p = [];
1541
- let b = 0;
1542
- for (const g of o) {
1543
- const f = U(g);
1705
+ const o = Et(r), a = /* @__PURE__ */ new Map(), l = [];
1706
+ for (const y of e)
1707
+ y.key == null ? l.push(y) : a.has(y.key) || a.set(y.key, y);
1708
+ const u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), h = [];
1709
+ let k = 0;
1710
+ for (const y of o) {
1711
+ const f = Z(y);
1544
1712
  if (f != null) {
1545
1713
  if (u.has(f)) throw new Error(`Duplicate sibling key: ${String(f)}`);
1546
1714
  u.add(f);
1547
1715
  }
1548
- const E = f == null ? l[b++] : a.get(f);
1549
- E && gt(E, g) ? (h.add(E), p.push(ht(E, g, i))) : p.push(Y(g, i));
1550
- }
1551
- for (const g of e)
1552
- h.has(g) || R(g, !0);
1553
- let y = s ? s.nextSibling : t.firstChild;
1554
- for (const g of p)
1555
- for (const f of O(g))
1556
- f === y ? y = y.nextSibling : (t.insertBefore(f, y ?? n), y = f.nextSibling);
1557
- return p;
1558
- }
1559
- function ft(t, e) {
1716
+ const z = f == null ? l[k++] : a.get(f);
1717
+ z && jt(z, y) ? (d.add(z), h.push($t(z, y, i))) : h.push(te(y, i));
1718
+ }
1719
+ for (const y of e)
1720
+ d.has(y) || M(y, !0);
1721
+ let b = s ? s.nextSibling : t.firstChild;
1722
+ for (const y of h)
1723
+ for (const f of P(y))
1724
+ f === b ? b = b.nextSibling : (t.insertBefore(f, b ?? n), E(), b = f.nextSibling);
1725
+ return h;
1726
+ }
1727
+ function zt(t, e) {
1560
1728
  const r = Object.fromEntries(Object.entries(e).filter(
1561
- ([s]) => s !== "children" && se(s) !== _e
1729
+ ([s]) => s !== "children" && X(s) !== et
1562
1730
  )), i = t.props, n = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(r)]);
1563
1731
  for (const s of ["value", "checked"])
1564
1732
  if (Object.hasOwn(r, s) && Object.hasOwn(r, `bind:${s}`))
1565
1733
  throw new Error(`${s} and bind:${s} cannot be used together`);
1566
1734
  for (const s of n) {
1567
1735
  const o = i[s], a = r[s];
1568
- if (Cr(s))
1569
- br(t, s, a);
1736
+ if (Fr(s))
1737
+ Dr(t, s, a);
1570
1738
  else if (s === "ref")
1571
- o !== a && vr(t, a);
1572
- else if ($r(s))
1573
- wr(t, s, a);
1574
- else if (N(a))
1575
- gr(t, s, a);
1739
+ o !== a && Nr(t, a);
1740
+ else if (Br(s))
1741
+ Pr(t, s, a);
1742
+ else if (q(a))
1743
+ Mr(t, s, a);
1576
1744
  else {
1577
1745
  const l = t.liveProps.get(s);
1578
1746
  l && (l.unsubscribe(), t.liveProps.delete(s));
1579
1747
  const u = (l == null ? void 0 : l.value) ?? o;
1580
- Object.is(u, a) || M(t.node, s, u, a);
1748
+ Object.is(u, a) || B(t.node, s, u, a);
1581
1749
  }
1582
1750
  }
1583
- t.node.setAttribute(_e, ""), t.props = { ...r };
1751
+ L(t.node, et, ""), t.props = { ...r };
1584
1752
  }
1585
- function gr(t, e, r) {
1753
+ function Mr(t, e, r) {
1586
1754
  const i = t.liveProps.get(e);
1587
1755
  if ((i == null ? void 0 : i.source) === r.emitter) return;
1588
1756
  i == null || i.unsubscribe();
1589
1757
  const n = r.emitter.get();
1590
- M(t.node, e, (i == null ? void 0 : i.value) ?? t.props[e], n);
1758
+ B(t.node, e, (i == null ? void 0 : i.value) ?? t.props[e], n);
1591
1759
  const s = {
1592
1760
  source: r.emitter,
1593
1761
  value: n,
1594
1762
  unsubscribe: () => {
1595
1763
  }
1596
1764
  };
1597
- s.unsubscribe = r.emitter.subscribe(({ value: o }) => {
1765
+ s.unsubscribe = ke(r.emitter, s, t.owner, `${t.type}.${e}`, (o) => {
1598
1766
  const a = s.value;
1599
- s.value = o, Object.is(a, o) || M(t.node, e, a, o);
1600
- }, { emitCurrent: !1 }), t.liveProps.set(e, s);
1767
+ s.value = o, Object.is(a, o) || B(t.node, e, a, o);
1768
+ }), t.liveProps.set(e, s);
1601
1769
  }
1602
- function br(t, e, r) {
1770
+ function Dr(t, e, r) {
1603
1771
  const i = e.slice(5), n = t.nativeBindings.get(e);
1604
1772
  if (r == null) {
1605
- n && (n.unsubscribe(), t.node.removeEventListener(n.eventName, n.listener), t.nativeBindings.delete(e), M(t.node, i, n.value, void 0));
1773
+ n && (n.unsubscribe(), t.node.removeEventListener(n.eventName, n.listener), t.nativeBindings.delete(e), B(t.node, i, n.value, void 0));
1606
1774
  return;
1607
1775
  }
1608
- if (xr(r, e), (n == null ? void 0 : n.source) === r) return;
1609
- n && (n.unsubscribe(), t.node.removeEventListener(n.eventName, n.listener)), Tr(t.node, i);
1610
- const s = zr(t.node, i), o = r.get();
1611
- M(t.node, i, n == null ? void 0 : n.value, o);
1612
- const a = () => {
1613
- r.set(Reflect.get(t.node, i), `${e} changed`);
1776
+ if (qr(r, e), (n == null ? void 0 : n.source) === r) return;
1777
+ n && (n.unsubscribe(), t.node.removeEventListener(n.eventName, n.listener)), Ur(t.node, i);
1778
+ const s = Hr(t.node, i), o = r.get();
1779
+ B(t.node, i, n == null ? void 0 : n.value, o);
1780
+ const a = (u) => {
1781
+ ge(
1782
+ Rt(t, s),
1783
+ t.owner.diagnosticScope,
1784
+ u,
1785
+ a,
1786
+ `${e} changed`,
1787
+ () => r.set(Reflect.get(t.node, i), `${e} changed`)
1788
+ );
1614
1789
  }, l = {
1615
1790
  source: r,
1616
1791
  value: o,
@@ -1619,101 +1794,187 @@ function br(t, e, r) {
1619
1794
  unsubscribe: () => {
1620
1795
  }
1621
1796
  };
1622
- l.unsubscribe = r.subscribe(({ value: u }) => {
1623
- const h = l.value;
1624
- l.value = u, Object.is(h, u) || M(t.node, i, h, u);
1625
- }, { emitCurrent: !1 }), t.node.addEventListener(s, a), t.nativeBindings.set(e, l);
1626
- }
1627
- function wr(t, e, r) {
1628
- const i = e.slice(2).toLowerCase(), n = t.listeners.get(e);
1629
- if (n && n !== r && (t.node.removeEventListener(i, n), t.listeners.delete(e)), r != null && typeof r != "function")
1797
+ l.unsubscribe = ke(r, l, t.owner, `${t.type}.${e}`, (u) => {
1798
+ const d = l.value;
1799
+ l.value = u, Object.is(d, u) || B(t.node, i, d, u);
1800
+ }), t.node.addEventListener(s, a), t.nativeBindings.set(e, l);
1801
+ }
1802
+ function Pr(t, e, r) {
1803
+ const i = e.slice(2).toLowerCase(), n = t.listeners.get(e), s = n ? it.get(n) ?? n : null;
1804
+ if (n && s !== r && (t.node.removeEventListener(i, n), t.listeners.delete(e)), r != null && typeof r != "function")
1630
1805
  throw new TypeError(`${e} must be a function or null`);
1631
- if (typeof r == "function" && n !== r) {
1632
- const s = r;
1633
- t.node.addEventListener(i, s), t.listeners.set(e, s);
1806
+ if (typeof r == "function" && s !== r) {
1807
+ const o = (a) => ge(
1808
+ Rt(t, i),
1809
+ t.owner.diagnosticScope,
1810
+ a,
1811
+ o,
1812
+ i,
1813
+ () => r.call(t.node, a)
1814
+ );
1815
+ it.set(o, r), t.node.addEventListener(i, o), t.listeners.set(e, o);
1816
+ }
1817
+ }
1818
+ const rt = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), Ae = /* @__PURE__ */ new WeakMap();
1819
+ function ge(t, e, r, i, n, s) {
1820
+ return m.withScope(e, () => {
1821
+ if (!m.active) return s();
1822
+ let o = Ae.get(r);
1823
+ return (!o || o.listeners.has(i)) && (o = { event: m.event(t, "interaction", { cause: n, outcome: "started" }), listeners: /* @__PURE__ */ new Set() }, Ae.set(r, o), queueMicrotask(() => Ae.delete(r))), o.listeners.add(i), m.withEvent(o.event, s);
1824
+ });
1825
+ }
1826
+ function Rt(t, e) {
1827
+ var n;
1828
+ let r = rt.get(t);
1829
+ r || (r = /* @__PURE__ */ new Map(), rt.set(t, r));
1830
+ let i = r.get(e);
1831
+ if (!i) {
1832
+ i = {};
1833
+ const s = t.node.getAttribute("aria-label") ?? t.node.getAttribute("name") ?? ((n = t.node.textContent) == null ? void 0 : n.trim().slice(0, 80)) ?? "";
1834
+ m.configure(i, {
1835
+ kind: "interaction",
1836
+ label: `${_(t.owner)}: ${t.type} ${s} ${e}`.trim(),
1837
+ scope: t.owner.diagnosticScope
1838
+ }), r.set(e, i);
1634
1839
  }
1840
+ return i;
1841
+ }
1842
+ function ke(t, e, r, i, n) {
1843
+ m.configure(e, {
1844
+ kind: "binding",
1845
+ label: `${_(r)}: ${i}`,
1846
+ scope: r.diagnosticScope,
1847
+ sources: [t]
1848
+ });
1849
+ const s = t.subscribe(({ value: o, event: a }) => {
1850
+ const l = m.event(e, "consumer", {
1851
+ parent: a,
1852
+ cause: "binding update",
1853
+ value: o,
1854
+ outcome: "started",
1855
+ consumer: { trigger: "dependency" }
1856
+ }), u = C, d = l ? { count: 0 } : null;
1857
+ C = d;
1858
+ try {
1859
+ m.withEvent(l, () => n(o)), l && m.event(e, "consumer", {
1860
+ parent: l,
1861
+ cause: "binding updated",
1862
+ value: o,
1863
+ outcome: "succeeded",
1864
+ consumer: { trigger: "dependency", domWrites: d.count }
1865
+ });
1866
+ } catch (h) {
1867
+ throw l && m.event(e, "consumer", {
1868
+ parent: l,
1869
+ cause: "binding update failed",
1870
+ outcome: "failed",
1871
+ error: h,
1872
+ consumer: { trigger: "dependency", domWrites: d.count }
1873
+ }), h;
1874
+ } finally {
1875
+ C = u;
1876
+ }
1877
+ }, { emitCurrent: !1, diagnosticTarget: e });
1878
+ return () => {
1879
+ s(), m.dispose(e);
1880
+ };
1881
+ }
1882
+ function _(t) {
1883
+ return t.diagnosticLabel;
1635
1884
  }
1636
- function vr(t, e) {
1637
- if (Ce(t.ref, null), e != null && typeof e != "function" && typeof e != "object")
1885
+ function Nr(t, e) {
1886
+ if (De(t.ref, null), e != null && typeof e != "function" && typeof e != "object")
1638
1887
  throw new TypeError("ref must be a function, object, or null");
1639
- t.ref = e, Ce(t.ref, t.node);
1888
+ t.ref = e, De(t.ref, t.node);
1640
1889
  }
1641
- function M(t, e, r, i) {
1890
+ function B(t, e, r, i) {
1642
1891
  if (e === "class" || e === "className") {
1643
- ve(t, "class", i);
1892
+ L(t, "class", i);
1644
1893
  return;
1645
1894
  }
1646
1895
  if (e === "for" || e === "htmlFor") {
1647
- ve(t, "for", i);
1896
+ L(t, "for", i);
1648
1897
  return;
1649
1898
  }
1650
1899
  if (e === "dataset") {
1651
- kr(t, r, i);
1900
+ Kr(t, r, i);
1652
1901
  return;
1653
1902
  }
1654
1903
  if (e === "style") {
1655
- Sr(t, r, i);
1904
+ Ir(t, r, i);
1656
1905
  return;
1657
1906
  }
1658
1907
  if (e === "dangerouslySetInnerHTML")
1659
1908
  throw new Error("dangerouslySetInnerHTML is not supported");
1660
- const n = Er(e);
1661
- if (hr.has(n)) {
1909
+ const n = _r(e);
1910
+ if (zr.has(n)) {
1662
1911
  const s = !!i;
1663
- n in t && Reflect.set(t, n, s), t.toggleAttribute(se(e), s);
1912
+ n in t && Reflect.get(t, n) !== s && (Reflect.set(t, n, s), E()), L(t, X(e), s);
1913
+ return;
1914
+ }
1915
+ if (n === "value" && t.localName === "option") {
1916
+ L(t, X(e), i);
1664
1917
  return;
1665
1918
  }
1666
- if (dr.has(n) && n in t) {
1919
+ if (Rr.has(n) && n in t) {
1667
1920
  const s = i ?? (n === "value" ? "" : !1);
1668
- Object.is(Reflect.get(t, n), s) || Reflect.set(t, n, s), i == null && t.removeAttribute(se(e));
1921
+ Object.is(Reflect.get(t, n), s) || (Reflect.set(t, n, s), E()), i == null && L(t, X(e), null);
1669
1922
  return;
1670
1923
  }
1671
- ve(t, se(e), i);
1924
+ L(t, X(e), i);
1672
1925
  }
1673
- function kr(t, e, r) {
1674
- const i = he(e, "dataset"), n = he(r, "dataset");
1926
+ function Kr(t, e, r) {
1927
+ const i = be(e, "dataset"), n = be(r, "dataset");
1675
1928
  for (const s of /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)])) {
1676
1929
  const o = n[s];
1677
- o == null ? delete t.dataset[s] : t.dataset[s] = String(o);
1930
+ t.dataset[s] !== (o == null ? void 0 : String(o)) && (o == null ? delete t.dataset[s] : t.dataset[s] = String(o), E());
1678
1931
  }
1679
1932
  }
1680
- function Sr(t, e, r) {
1933
+ function Ir(t, e, r) {
1681
1934
  if (typeof r == "string") {
1682
- t.style.cssText = r;
1935
+ t.style.cssText !== r && (t.style.cssText = r, E());
1683
1936
  return;
1684
1937
  }
1685
- const i = typeof e == "string" ? {} : he(e, "style"), n = he(r, "style");
1686
- typeof e == "string" && (t.style.cssText = "");
1938
+ const i = typeof e == "string" ? {} : be(e, "style"), n = be(r, "style");
1939
+ typeof e == "string" && t.style.cssText !== "" && (t.style.cssText = "", E());
1687
1940
  for (const s of /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)])) {
1688
1941
  const o = n[s];
1689
- s.startsWith("--") ? o == null ? t.style.removeProperty(s) : t.style.setProperty(s, String(o)) : Reflect.set(t.style, s, o == null ? "" : String(o));
1942
+ if (s.startsWith("--")) {
1943
+ if (t.style.getPropertyValue(s) === (o == null ? "" : String(o))) continue;
1944
+ o == null ? t.style.removeProperty(s) : t.style.setProperty(s, String(o));
1945
+ } else {
1946
+ if (Reflect.get(t.style, s) === (o == null ? "" : String(o))) continue;
1947
+ Reflect.set(t.style, s, o == null ? "" : String(o));
1948
+ }
1949
+ E();
1690
1950
  }
1691
1951
  }
1692
- function he(t, e) {
1952
+ function be(t, e) {
1693
1953
  if (t == null) return {};
1694
1954
  if (typeof t != "object" || Array.isArray(t))
1695
1955
  throw new TypeError(`${e} must be an object or null`);
1696
1956
  return t;
1697
1957
  }
1698
- function ve(t, e, r) {
1699
- r == null || r === !1 ? t.removeAttribute(e) : r === !0 ? t.setAttribute(e, "") : t.setAttribute(e, String(r));
1958
+ function L(t, e, r) {
1959
+ const i = r == null || r === !1 ? null : r === !0 ? "" : String(r);
1960
+ t.getAttribute(e) !== i && (i === null ? t.removeAttribute(e) : t.setAttribute(e, i), E());
1700
1961
  }
1701
- function Er(t) {
1962
+ function _r(t) {
1702
1963
  return t === "readonly" ? "readOnly" : t === "autofocus" ? "autoFocus" : t;
1703
1964
  }
1704
- function se(t) {
1705
- return t === "className" ? "class" : t === "htmlFor" ? "for" : t === "minLength" ? "minlength" : t === "maxLength" ? "maxlength" : t === "autoComplete" ? "autocomplete" : t === "inputMode" ? "inputmode" : /^aria[A-Z]/.test(t) || /^data[A-Z]/.test(t) ? He(t) : t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
1965
+ function X(t) {
1966
+ return t === "className" ? "class" : t === "htmlFor" ? "for" : t === "minLength" ? "minlength" : t === "maxLength" ? "maxlength" : t === "autoComplete" ? "autocomplete" : t === "inputMode" ? "inputmode" : /^aria[A-Z]/.test(t) || /^data[A-Z]/.test(t) ? nt(t) : t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
1706
1967
  }
1707
- function He(t) {
1968
+ function nt(t) {
1708
1969
  return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
1709
1970
  }
1710
- function Ce(t, e) {
1971
+ function De(t, e) {
1711
1972
  t != null && (typeof t == "function" ? t(e) : t.current = e);
1712
1973
  }
1713
- function R(t, e) {
1974
+ function M(t, e) {
1714
1975
  if (t.kind === "emitter") {
1715
- if (t.unsubscribe(), R(t.child, !1), e)
1716
- for (const r of O(t)) r.remove();
1976
+ if (t.unsubscribe(), M(t.child, !1), e)
1977
+ for (const r of P(t)) le(r);
1717
1978
  return;
1718
1979
  }
1719
1980
  if (t.kind === "component") {
@@ -1723,11 +1984,11 @@ function R(t, e) {
1723
1984
  }
1724
1985
  if (t.kind === "function") {
1725
1986
  for (const r of t.liveProps.values()) r.unsubscribe();
1726
- t.liveProps.clear(), R(t.child, e);
1987
+ t.liveProps.clear(), t.diagnosticSubject && m.dispose(t.diagnosticSubject), M(t.child, e);
1727
1988
  return;
1728
1989
  }
1729
1990
  if (t.kind === "element") {
1730
- Ce(t.ref, null);
1991
+ De(t.ref, null);
1731
1992
  for (const [r, i] of t.listeners)
1732
1993
  t.node.removeEventListener(r.slice(2).toLowerCase(), i);
1733
1994
  t.listeners.clear();
@@ -1736,114 +1997,118 @@ function R(t, e) {
1736
1997
  for (const r of t.nativeBindings.values())
1737
1998
  r.unsubscribe(), t.node.removeEventListener(r.eventName, r.listener);
1738
1999
  t.nativeBindings.clear();
1739
- for (const r of t.children) R(r, !1);
1740
- e && t.node.remove();
2000
+ for (const r of t.children) M(r, !1);
2001
+ e && le(t.node);
1741
2002
  return;
1742
2003
  }
1743
2004
  if (t.kind === "fragment") {
1744
- for (const r of t.children) R(r, !1);
2005
+ for (const r of t.children) M(r, !1);
1745
2006
  if (e)
1746
- for (const r of O(t)) r.remove();
2007
+ for (const r of P(t)) le(r);
1747
2008
  return;
1748
2009
  }
1749
- e && t.node.remove();
2010
+ e && le(t.node);
2011
+ }
2012
+ function le(t) {
2013
+ t.parentNode && (t.remove(), E());
1750
2014
  }
1751
- function je(t, e, r = null) {
2015
+ function Fe(t, e, r = null) {
1752
2016
  if (e != null)
1753
- for (const i of O(e)) t.insertBefore(i, r);
2017
+ for (const i of P(e))
2018
+ i.parentNode === t && i.nextSibling === r || (t.insertBefore(i, r), E());
1754
2019
  }
1755
- function O(t) {
2020
+ function P(t) {
1756
2021
  if (t == null) return [];
1757
2022
  if (t.kind === "text" || t.kind === "element") return [t.node];
1758
- if (t.kind === "component") return O(t.instance._rendered);
1759
- if (t.kind === "function") return O(t.child);
2023
+ if (t.kind === "component") return P(t.instance._rendered);
2024
+ if (t.kind === "function") return P(t.child);
1760
2025
  const e = [];
1761
2026
  let r = t.start;
1762
2027
  for (; r && (e.push(r), r !== t.end); )
1763
2028
  r = r.nextSibling;
1764
2029
  return e;
1765
2030
  }
1766
- function mt(t) {
1767
- return O(t)[0] ?? null;
2031
+ function At(t) {
2032
+ return P(t)[0] ?? null;
1768
2033
  }
1769
- function U(t) {
1770
- return t instanceof C ? yt(t.props) : T(t) ? t.key : null;
2034
+ function Z(t) {
2035
+ return t instanceof T ? Ot(t.props) : O(t) ? t.key : null;
1771
2036
  }
1772
- function yt(t) {
2037
+ function Ot(t) {
1773
2038
  const e = t.key;
1774
2039
  return typeof e == "string" || typeof e == "number" ? e : null;
1775
2040
  }
1776
- function gt(t, e) {
1777
- return t.kind === "text" ? typeof e == "string" || typeof e == "number" : t.kind === "emitter" ? fe(e) && t.source === e : t.kind === "component" ? e instanceof C ? t.instance === e : T(e) && bt(e.type) && t.type === e.type && t.key === U(e) : t.kind === "function" ? T(e) && t.type === e.type && t.key === U(e) : t.kind === "fragment" ? T(e) && e.type === le && t.key === U(e) : T(e) && typeof e.type == "string" && t.type === e.type && t.key === U(e);
2041
+ function jt(t, e) {
2042
+ return t.kind === "text" ? typeof e == "string" || typeof e == "number" : t.kind === "emitter" ? Se(e) && t.source === e : t.kind === "component" ? e instanceof T ? t.instance === e : O(e) && Lt(e.type) && t.type === e.type && t.key === Z(e) : t.kind === "function" ? O(e) && t.type === e.type && t.key === Z(e) : t.kind === "fragment" ? O(e) && e.type === ee && t.key === Z(e) : O(e) && typeof e.type == "string" && t.type === e.type && t.key === Z(e);
1778
2043
  }
1779
- function T(t) {
2044
+ function O(t) {
1780
2045
  return t != null && typeof t == "object" && Object.hasOwn(t, "type");
1781
2046
  }
1782
- function bt(t) {
1783
- return typeof t == "function" && (t === C || t.prototype instanceof C);
2047
+ function Lt(t) {
2048
+ return typeof t == "function" && (t === T || t.prototype instanceof T);
1784
2049
  }
1785
- function $r(t) {
2050
+ function Br(t) {
1786
2051
  return /^on[A-Z]/.test(t);
1787
2052
  }
1788
- function Cr(t) {
2053
+ function Fr(t) {
1789
2054
  return t === "bind:value" || t === "bind:checked";
1790
2055
  }
1791
- function N(t) {
1792
- return t != null && typeof t == "object" && ur.has(t);
2056
+ function q(t) {
2057
+ return t != null && typeof t == "object" && Tr.has(t);
1793
2058
  }
1794
- function fe(t) {
2059
+ function Se(t) {
1795
2060
  return (typeof t != "object" || t == null) && typeof t != "function" ? !1 : typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "getFetchState") == "function" && typeof Reflect.get(t, "getError") == "function" && typeof Reflect.get(t, "subscribe") == "function";
1796
2061
  }
1797
- function wt(t, e) {
1798
- if (!fe(t)) throw new TypeError(`${e} requires a readable emitter`);
2062
+ function Mt(t, e) {
2063
+ if (!Se(t)) throw new TypeError(`${e} requires a readable emitter`);
1799
2064
  }
1800
- function xr(t, e) {
1801
- if (wt(t, e), typeof Reflect.get(t, "set") != "function")
2065
+ function qr(t, e) {
2066
+ if (Mt(t, e), typeof Reflect.get(t, "set") != "function")
1802
2067
  throw new TypeError(`${e} requires a writable emitter`);
1803
2068
  }
1804
- function Tr(t, e) {
2069
+ function Ur(t, e) {
1805
2070
  const r = t.localName;
1806
2071
  if (!(e === "checked" ? r === "input" : r === "input" || r === "textarea" || r === "select")) throw new TypeError(`bind:${e} is not supported on ${r}`);
1807
2072
  }
1808
- function zr(t, e) {
2073
+ function Hr(t, e) {
1809
2074
  return e === "value" && t.localName !== "select" ? "input" : "change";
1810
2075
  }
1811
- function Rr(t) {
2076
+ function Vr(t) {
1812
2077
  if (t == null || typeof t != "object" && typeof t != "function" || typeof Reflect.get(t, "insertBefore") != "function")
1813
2078
  throw new TypeError("Component parent must be a DOM ParentNode");
1814
2079
  }
1815
- function Ve(t) {
2080
+ function st(t) {
1816
2081
  try {
1817
2082
  return String(t);
1818
2083
  } catch {
1819
2084
  return Object.prototype.toString.call(t);
1820
2085
  }
1821
2086
  }
1822
- function Ar(t) {
2087
+ function Wr(t) {
1823
2088
  const e = [];
1824
2089
  let r = t;
1825
- for (; r != null && typeof r == "function" && (e.unshift(r), r !== C); )
2090
+ for (; r != null && typeof r == "function" && (e.unshift(r), r !== T); )
1826
2091
  r = Object.getPrototypeOf(r);
1827
2092
  return e;
1828
2093
  }
1829
- function Or(...t) {
2094
+ function Yr(...t) {
1830
2095
  return [...new Set(t.flatMap((e) => typeof e == "string" ? e.split(/\s+/) : []).filter(Boolean))].join(" ");
1831
2096
  }
1832
- function ke(t) {
2097
+ function Oe(t) {
1833
2098
  if (t.island === !0) return !0;
1834
2099
  const e = t.className ?? t.class;
1835
2100
  return typeof e == "string" && e.split(/\s+/).includes("island");
1836
2101
  }
1837
- function d(t, e, r) {
2102
+ function p(t, e, r) {
1838
2103
  const i = e == null ? {} : { ...e };
1839
- return r !== void 0 && (i.key = r), ce(t, i);
2104
+ return r !== void 0 && (i.key = r), me(t, i);
1840
2105
  }
1841
- const m = d, jr = [
2106
+ const g = p, Gr = [
1842
2107
  "var(--colored-dark)",
1843
2108
  "var(--colored-base)",
1844
2109
  "var(--colored-light)"
1845
2110
  ];
1846
- class ee extends Te {
2111
+ class Y extends Ne {
1847
2112
  render() {
1848
2113
  var b;
1849
2114
  const {
@@ -1851,72 +2116,74 @@ class ee extends Te {
1851
2116
  label: r = "Block graph",
1852
2117
  description: i = "Area is proportional to item count.",
1853
2118
  emptyMessage: n = "No items are available."
1854
- } = this.props, s = this.snapshot(e.layout$), o = this.read(e.selectedPath$), a = s.value, l = D(a.root, o), u = a.root.children.length === 0 ? [a.root] : a.root.children, h = (b = u[0]) == null ? void 0 : b.key, p = this.Host;
1855
- return /* @__PURE__ */ m(
1856
- p,
2119
+ } = this.props, s = this.snapshot(e.layout$), o = s.fetchState === S.Initial || s.fetchState === S.Loading, a = this.read(e.selectedPath$), l = s.value, u = I(l.root, a), d = l.root.children.length === 0 ? [l.root] : l.root.children, h = (b = d[0]) == null ? void 0 : b.key, k = this.Host;
2120
+ return /* @__PURE__ */ g(
2121
+ k,
1857
2122
  {
1858
2123
  className: (this.props.className ?? this.props.class ?? "") || null,
1859
2124
  "aria-label": r,
1860
- "aria-busy": s.fetchState !== k.Ready ? "true" : null,
2125
+ "aria-busy": o ? "true" : null,
1861
2126
  children: [
1862
- /* @__PURE__ */ m("header", { children: [
1863
- /* @__PURE__ */ m("cap-summary", { children: [
1864
- /* @__PURE__ */ d("h2", { children: r }),
1865
- /* @__PURE__ */ m("p", { children: [
2127
+ /* @__PURE__ */ g("header", { children: [
2128
+ /* @__PURE__ */ g("cap-summary", { children: [
2129
+ /* @__PURE__ */ p("h2", { children: r }),
2130
+ /* @__PURE__ */ g("p", { children: [
1866
2131
  i,
1867
2132
  " ",
1868
- a.root.count,
1869
- " items."
2133
+ o ? null : `${l.root.count} items.`
1870
2134
  ] }),
1871
- /* @__PURE__ */ m("output", { children: [
1872
- /* @__PURE__ */ d("strong", { children: "Selection:" }),
2135
+ o ? /* @__PURE__ */ p(xe, { width: 45 }) : /* @__PURE__ */ g("output", { children: [
2136
+ /* @__PURE__ */ p("strong", { children: "Selection:" }),
1873
2137
  " ",
1874
- l == null ? "None" : l.path.length === 0 ? l.label : l.path.map((y, g) => {
1875
- var E;
1876
- const f = l.path.slice(0, g + 1);
1877
- return ((E = D(a.root, f)) == null ? void 0 : E.label) ?? y.categoryKey;
2138
+ u == null ? "None" : u.path.length === 0 ? u.label : u.path.map((y, f) => {
2139
+ var R;
2140
+ const z = u.path.slice(0, f + 1);
2141
+ return ((R = I(l.root, z)) == null ? void 0 : R.label) ?? y.categoryKey;
1878
2142
  }).join(" → ")
1879
2143
  ] })
1880
2144
  ] }),
1881
- /* @__PURE__ */ d(
1882
- oe,
2145
+ /* @__PURE__ */ p(
2146
+ he,
1883
2147
  {
1884
2148
  label: "Clear selection",
1885
- disabled: o == null,
2149
+ disabled: o || a == null,
1886
2150
  onClick: () => e.clear()
1887
2151
  }
1888
2152
  )
1889
2153
  ] }),
1890
- s.fetchState === k.Error ? /* @__PURE__ */ d("p", { role: "alert", children: "The block graph could not be calculated." }) : s.fetchState !== k.Ready ? /* @__PURE__ */ d("p", { role: "status", "aria-live": "polite", children: "Loading block graph…" }) : a.valid ? a.root.count === 0 ? /* @__PURE__ */ d("p", { role: "status", children: n }) : /* @__PURE__ */ d(
2154
+ s.fetchState === S.Error ? /* @__PURE__ */ p("p", { role: "alert", children: "The block graph could not be calculated." }) : o ? /* @__PURE__ */ g(ee, { children: [
2155
+ /* @__PURE__ */ p("p", { role: "status", "aria-live": "polite", children: "Loading block graph…" }),
2156
+ /* @__PURE__ */ p("cap-blockskeleton", { "aria-hidden": "true", children: [0, 1, 2].map((y) => /* @__PURE__ */ p("cap-blockskeletoncolumn", { children: [0, 1].map((f) => /* @__PURE__ */ p(xe, { width: 100 }, f)) }, y)) })
2157
+ ] }) : l.valid ? l.root.count === 0 ? /* @__PURE__ */ p("p", { role: "status", children: n }) : /* @__PURE__ */ p(
1891
2158
  "cap-scroller",
1892
2159
  {
1893
2160
  tabIndex: 0,
1894
2161
  "aria-label": `Scrollable ${r}`,
1895
- children: /* @__PURE__ */ d(
2162
+ children: /* @__PURE__ */ p(
1896
2163
  "cap-blocks",
1897
2164
  {
1898
2165
  role: "tree",
1899
2166
  "aria-label": r,
1900
- className: a.root.childOrientation,
2167
+ className: l.root.childOrientation,
1901
2168
  onClick: (y) => {
1902
2169
  y.target === y.currentTarget && e.clear();
1903
2170
  },
1904
- children: u.map((y) => this.renderBlock(
2171
+ children: d.map((y) => this.renderBlock(
1905
2172
  y,
1906
- o,
1907
- (l == null ? void 0 : l.key) ?? h ?? null
2173
+ a,
2174
+ (u == null ? void 0 : u.key) ?? h ?? null
1908
2175
  ))
1909
2176
  }
1910
2177
  )
1911
2178
  }
1912
- ) : this.renderPartitionError(a.issues)
2179
+ ) : this.renderPartitionError(l.issues)
1913
2180
  ]
1914
2181
  }
1915
2182
  );
1916
2183
  }
1917
2184
  renderBlock(e, r, i) {
1918
- const n = Lr(e.path, r), s = e.colors, o = Xe(s ?? jr);
1919
- return /* @__PURE__ */ m(
2185
+ const n = Xr(e.path, r), s = e.colors, o = ct(s ?? Gr);
2186
+ return /* @__PURE__ */ g(
1920
2187
  "article",
1921
2188
  {
1922
2189
  role: "treeitem",
@@ -1938,17 +2205,17 @@ class ee extends Te {
1938
2205
  }
1939
2206
  },
1940
2207
  children: [
1941
- /* @__PURE__ */ m("cap-blocklabel", { children: [
1942
- /* @__PURE__ */ m("cap-blockname", { children: [
1943
- /* @__PURE__ */ m("small", { children: [
2208
+ /* @__PURE__ */ g("cap-blocklabel", { children: [
2209
+ /* @__PURE__ */ g("cap-blockname", { children: [
2210
+ /* @__PURE__ */ g("small", { children: [
1944
2211
  e.criterionLabel ?? "Items",
1945
2212
  ":"
1946
2213
  ] }),
1947
- /* @__PURE__ */ d("strong", { children: e.label })
2214
+ /* @__PURE__ */ p("strong", { children: e.label })
1948
2215
  ] }),
1949
- /* @__PURE__ */ d("data", { value: String(e.count), children: e.count })
2216
+ /* @__PURE__ */ p("data", { value: String(e.count), children: e.count })
1950
2217
  ] }),
1951
- e.children.length === 0 ? null : /* @__PURE__ */ d(
2218
+ e.children.length === 0 ? null : /* @__PURE__ */ p(
1952
2219
  "cap-blockgroup",
1953
2220
  {
1954
2221
  role: "group",
@@ -1967,9 +2234,9 @@ class ee extends Te {
1967
2234
  }
1968
2235
  renderPartitionError(e) {
1969
2236
  const r = e[0], i = r == null ? "The selected criteria do not form a complete partition." : r.kind === "unmatched" ? `${r.criterionLabel} has an item with no category.` : `${r.criterionLabel} has an item matching multiple categories.`;
1970
- return /* @__PURE__ */ m("div", { role: "alert", children: [
1971
- /* @__PURE__ */ d("strong", { children: "Invalid block partition" }),
1972
- /* @__PURE__ */ m("p", { children: [
2237
+ return /* @__PURE__ */ g("div", { role: "alert", children: [
2238
+ /* @__PURE__ */ p("strong", { children: "Invalid block partition" }),
2239
+ /* @__PURE__ */ g("p", { children: [
1973
2240
  i,
1974
2241
  " ",
1975
2242
  e.length,
@@ -1988,7 +2255,7 @@ class ee extends Te {
1988
2255
  e.preventDefault(), this.props.model.clear("block selection cleared by keyboard");
1989
2256
  return;
1990
2257
  }
1991
- const i = this.props.model.layout$.get().root, n = vt(i.children.length === 0 ? [i] : i.children), s = n.findIndex(({ key: a }) => a === r.key);
2258
+ const i = this.props.model.layout$.get().root, n = Dt(i.children.length === 0 ? [i] : i.children), s = n.findIndex(({ key: a }) => a === r.key);
1992
2259
  let o;
1993
2260
  if (e.key === "ArrowDown") o = n[s + 1];
1994
2261
  else if (e.key === "ArrowUp") o = n[s - 1];
@@ -1996,7 +2263,7 @@ class ee extends Te {
1996
2263
  else if (e.key === "End") o = n.at(-1);
1997
2264
  else if (e.key === "ArrowRight") o = r.children[0] ?? n[s + 1];
1998
2265
  else if (e.key === "ArrowLeft")
1999
- o = r.path.length <= 1 ? n[s - 1] : D(i, r.path.slice(0, -1)) ?? void 0;
2266
+ o = r.path.length <= 1 ? n[s - 1] : I(i, r.path.slice(0, -1)) ?? void 0;
2000
2267
  else return;
2001
2268
  o != null && (e.preventDefault(), this.focusBlock(o.key));
2002
2269
  }
@@ -2010,7 +2277,7 @@ class ee extends Te {
2010
2277
  }
2011
2278
  }
2012
2279
  }
2013
- c(ee, "liveProps", []), c(ee, "hostName", "block-graph"), c(ee, "dependencies", [oe]), c(ee, "css", G`
2280
+ c(Y, "liveProps", []), c(Y, "hostName", "block-graph"), c(Y, "dataSurface", "data"), c(Y, "dependencies", [he, xe]), c(Y, "css", re`
2014
2281
  & {
2015
2282
  display: flex;
2016
2283
  min-width: 0;
@@ -2047,6 +2314,33 @@ c(ee, "liveProps", []), c(ee, "hostName", "block-graph"), c(ee, "dependencies",
2047
2314
  overflow: auto;
2048
2315
  }
2049
2316
 
2317
+ & > cap-blockskeleton {
2318
+ display: flex;
2319
+ flex: 1;
2320
+ gap: var(--viz-space, 0.7rem);
2321
+ min-block-size: 24rem;
2322
+ }
2323
+
2324
+ & cap-blockskeletoncolumn {
2325
+ display: flex;
2326
+ flex: 1;
2327
+ flex-direction: column;
2328
+ gap: var(--viz-space, 0.7rem);
2329
+ }
2330
+
2331
+ & cap-blockskeletoncolumn:nth-child(2) {
2332
+ flex: 2;
2333
+ }
2334
+
2335
+ & cap-blockskeletoncolumn > cap-placeholder {
2336
+ flex: 1;
2337
+ block-size: auto;
2338
+ }
2339
+
2340
+ & cap-blockskeletoncolumn:nth-child(odd) > cap-placeholder:first-child {
2341
+ flex: 2;
2342
+ }
2343
+
2050
2344
  & cap-blocks,
2051
2345
  & cap-blockgroup {
2052
2346
  display: flex;
@@ -2090,9 +2384,8 @@ c(ee, "liveProps", []), c(ee, "hostName", "block-graph"), c(ee, "dependencies",
2090
2384
  inset-block-start: 0;
2091
2385
  inset-inline-start: 0;
2092
2386
  box-sizing: border-box;
2093
- display: grid;
2094
- grid-template-columns: minmax(0, 1fr) auto;
2095
- grid-template-areas: "label count";
2387
+ display: flex;
2388
+ flex-flow: row nowrap;
2096
2389
  align-items: center;
2097
2390
  gap: 0 0.35rem;
2098
2391
  width: 100%;
@@ -2116,9 +2409,9 @@ c(ee, "liveProps", []), c(ee, "hostName", "block-graph"), c(ee, "dependencies",
2116
2409
  }
2117
2410
 
2118
2411
  & cap-blocklabel > cap-blockname {
2119
- grid-area: label;
2120
- display: grid;
2121
- grid-template-columns: auto minmax(0, 1fr);
2412
+ display: flex;
2413
+ flex: 1 1 auto;
2414
+ flex-flow: row nowrap;
2122
2415
  align-items: baseline;
2123
2416
  gap: 0.2rem;
2124
2417
  min-width: 0;
@@ -2127,6 +2420,7 @@ c(ee, "liveProps", []), c(ee, "hostName", "block-graph"), c(ee, "dependencies",
2127
2420
  }
2128
2421
 
2129
2422
  & cap-blockname > small {
2423
+ flex: 0 1 auto;
2130
2424
  overflow: hidden;
2131
2425
  font-size: 0.68rem;
2132
2426
  opacity: 0.82;
@@ -2135,6 +2429,7 @@ c(ee, "liveProps", []), c(ee, "hostName", "block-graph"), c(ee, "dependencies",
2135
2429
  }
2136
2430
 
2137
2431
  & cap-blockname > strong {
2432
+ flex: 1 1 auto;
2138
2433
  min-width: 0;
2139
2434
  overflow: hidden;
2140
2435
  text-overflow: ellipsis;
@@ -2142,7 +2437,7 @@ c(ee, "liveProps", []), c(ee, "hostName", "block-graph"), c(ee, "dependencies",
2142
2437
  }
2143
2438
 
2144
2439
  & cap-blocklabel > data {
2145
- grid-area: count;
2440
+ flex: 0 0 auto;
2146
2441
  align-self: center;
2147
2442
  font-weight: 750;
2148
2443
  }
@@ -2173,16 +2468,16 @@ c(ee, "liveProps", []), c(ee, "hostName", "block-graph"), c(ee, "dependencies",
2173
2468
  }
2174
2469
  }
2175
2470
  `);
2176
- function vt(t) {
2177
- return t.flatMap((e) => [e, ...vt(e.children)]);
2471
+ function Dt(t) {
2472
+ return t.flatMap((e) => [e, ...Dt(e.children)]);
2178
2473
  }
2179
- function Lr(t, e) {
2474
+ function Xr(t, e) {
2180
2475
  return e != null && t.length === e.length && t.every((r, i) => {
2181
2476
  var n, s;
2182
2477
  return r.criterionKey === ((n = e[i]) == null ? void 0 : n.criterionKey) && r.categoryKey === ((s = e[i]) == null ? void 0 : s.categoryKey);
2183
2478
  });
2184
2479
  }
2185
- class de extends At {
2480
+ class we extends Wt {
2186
2481
  constructor(r) {
2187
2482
  super(r);
2188
2483
  c(this, "contentId");
@@ -2194,10 +2489,10 @@ class de extends At {
2194
2489
  throw new Error(
2195
2490
  "CollapsibleOptionGroup trailing header content must use a direct OptionGroupHeaderEnd child"
2196
2491
  );
2197
- const { content: r, regions: i } = Ot(
2492
+ const { content: r, regions: i } = Yt(
2198
2493
  "CollapsibleOptionGroup",
2199
2494
  this.props.children,
2200
- { headerEnd: jt }
2495
+ { headerEnd: Gt }
2201
2496
  );
2202
2497
  return this.renderOptionGroup(r, i.headerEnd ?? null);
2203
2498
  }
@@ -2211,10 +2506,10 @@ class de extends At {
2211
2506
  disabled: a = !1,
2212
2507
  required: l = !1,
2213
2508
  busy: u = !1,
2214
- error: h = null
2509
+ error: d = null
2215
2510
  } = this.props;
2216
- return /* @__PURE__ */ m(n, { className: this.props.className ?? this.props.class ?? null, children: [
2217
- /* @__PURE__ */ m(
2511
+ return /* @__PURE__ */ g(n, { className: this.props.className ?? this.props.class ?? null, children: [
2512
+ /* @__PURE__ */ g(
2218
2513
  "fieldset",
2219
2514
  {
2220
2515
  id: this.groupId,
@@ -2222,11 +2517,11 @@ class de extends At {
2222
2517
  "aria-label": s == null ? o : null,
2223
2518
  "aria-required": l ? "true" : null,
2224
2519
  "aria-busy": u ? "true" : null,
2225
- "aria-invalid": h == null ? null : "true",
2226
- "aria-describedby": h == null ? null : this.errorId,
2520
+ "aria-invalid": d == null ? null : "true",
2521
+ "aria-describedby": d == null ? null : this.errorId,
2227
2522
  children: [
2228
- /* @__PURE__ */ m("legend", { children: [
2229
- /* @__PURE__ */ d(
2523
+ /* @__PURE__ */ g("legend", { children: [
2524
+ /* @__PURE__ */ p(
2230
2525
  "button",
2231
2526
  {
2232
2527
  type: "button",
@@ -2237,18 +2532,18 @@ class de extends At {
2237
2532
  children: this.collapsed ? "▸" : "▾"
2238
2533
  }
2239
2534
  ),
2240
- s != null ? /* @__PURE__ */ d("span", { children: s }) : null,
2535
+ s != null ? /* @__PURE__ */ p("span", { children: s }) : null,
2241
2536
  i
2242
2537
  ] }),
2243
- /* @__PURE__ */ d("div", { id: this.contentId, hidden: this.collapsed, children: r })
2538
+ /* @__PURE__ */ p("div", { id: this.contentId, hidden: this.collapsed, children: r })
2244
2539
  ]
2245
2540
  }
2246
2541
  ),
2247
- this.renderOptionGroupError(h)
2542
+ this.renderOptionGroupError(d)
2248
2543
  ] });
2249
2544
  }
2250
2545
  }
2251
- c(de, "hostName", "collapsible-option-group"), c(de, "css", G`
2546
+ c(we, "hostName", "collapsible-option-group"), c(we, "css", re`
2252
2547
  & > fieldset > legend > button.cap-collapse-toggle {
2253
2548
  display: inline-flex;
2254
2549
  align-items: center;
@@ -2283,11 +2578,11 @@ c(de, "hostName", "collapsible-option-group"), c(de, "css", G`
2283
2578
  display: none;
2284
2579
  }
2285
2580
  `);
2286
- const Dr = [
2581
+ const Zr = [
2287
2582
  ["☐", "hidden"],
2288
2583
  ["✓", "visible"]
2289
2584
  ];
2290
- class te extends Lt {
2585
+ class ce extends Xt {
2291
2586
  render() {
2292
2587
  const {
2293
2588
  criteria: e,
@@ -2296,38 +2591,38 @@ class te extends Lt {
2296
2591
  } = this.props, n = this.snapshot(this.props.items$), s = Array.isArray(n.value) ? n.value : [];
2297
2592
  return this.renderGroupBox(
2298
2593
  r,
2299
- /* @__PURE__ */ m("cap-categoryhidecontent", { children: [
2300
- /* @__PURE__ */ d("p", { children: i }),
2301
- n.fetchState === k.Error ? /* @__PURE__ */ d("p", { role: "alert", children: "Category counts are unavailable." }) : null,
2302
- /* @__PURE__ */ d("cap-criteriongroups", { children: e.map((o) => {
2594
+ /* @__PURE__ */ g("cap-categoryhidecontent", { children: [
2595
+ /* @__PURE__ */ p("p", { children: i }),
2596
+ n.fetchState === S.Error ? /* @__PURE__ */ p("p", { role: "alert", children: "Category counts are unavailable." }) : null,
2597
+ /* @__PURE__ */ p("cap-criteriongroups", { children: e.map((o) => {
2303
2598
  const a = this.snapshot(o.categories$), l = Array.isArray(a.value) ? a.value : [];
2304
- return /* @__PURE__ */ m(
2305
- de,
2599
+ return /* @__PURE__ */ g(
2600
+ we,
2306
2601
  {
2307
2602
  label: o.label,
2308
2603
  children: [
2309
- a.fetchState === k.Error ? /* @__PURE__ */ m("p", { role: "alert", children: [
2604
+ a.fetchState === S.Error ? /* @__PURE__ */ g("p", { role: "alert", children: [
2310
2605
  o.label,
2311
2606
  " categories are unavailable."
2312
2607
  ] }) : null,
2313
- a.fetchState !== k.Ready ? /* @__PURE__ */ m("p", { role: "status", "aria-live": "polite", children: [
2608
+ a.fetchState !== S.Ready ? /* @__PURE__ */ g("p", { role: "status", "aria-live": "polite", children: [
2314
2609
  "Loading ",
2315
2610
  o.label,
2316
2611
  "…"
2317
2612
  ] }) : null,
2318
- /* @__PURE__ */ d("cap-categories", { children: l.map((u) => {
2319
- const h = Mr(s, u.predicate);
2320
- return /* @__PURE__ */ m(
2613
+ /* @__PURE__ */ p("cap-categories", { children: l.map((u) => {
2614
+ const d = Jr(s, u.predicate);
2615
+ return /* @__PURE__ */ g(
2321
2616
  "cap-categoryoption",
2322
2617
  {
2323
- style: { ...Xe(u.colors) },
2618
+ style: { ...ct(u.colors) },
2324
2619
  children: [
2325
- /* @__PURE__ */ d("cap-categoryswatch", { "aria-hidden": "true" }),
2326
- /* @__PURE__ */ d(
2327
- ae,
2620
+ /* @__PURE__ */ p("cap-categoryswatch", { "aria-hidden": "true" }),
2621
+ /* @__PURE__ */ p(
2622
+ fe,
2328
2623
  {
2329
- symbols: Dr,
2330
- label: `${u.label} (${h})`,
2624
+ symbols: Zr,
2625
+ label: `${u.label} (${d})`,
2331
2626
  valueEmitter: o.visibility(u.key)
2332
2627
  }
2333
2628
  )
@@ -2345,7 +2640,7 @@ class te extends Lt {
2345
2640
  );
2346
2641
  }
2347
2642
  }
2348
- c(te, "liveProps", []), c(te, "hostName", "category-hide-panel"), c(te, "dependencies", [ae, de]), c(te, "css", G`
2643
+ c(ce, "liveProps", []), c(ce, "hostName", "category-hide-panel"), c(ce, "dependencies", [fe, we]), c(ce, "css", re`
2349
2644
  & {
2350
2645
  flex: 0 0 auto;
2351
2646
  min-width: 0;
@@ -2353,8 +2648,9 @@ c(te, "liveProps", []), c(te, "hostName", "category-hide-panel"), c(te, "depende
2353
2648
  }
2354
2649
 
2355
2650
  & > cap-content > cap-categoryhidecontent {
2356
- display: grid;
2357
- align-content: start;
2651
+ display: flex;
2652
+ flex-flow: column nowrap;
2653
+ align-items: stretch;
2358
2654
  gap: var(--viz-space, 0.6rem);
2359
2655
  min-width: 0;
2360
2656
  }
@@ -2366,7 +2662,8 @@ c(te, "liveProps", []), c(te, "hostName", "category-hide-panel"), c(te, "depende
2366
2662
  }
2367
2663
 
2368
2664
  & > cap-content > cap-categoryhidecontent > cap-criteriongroups {
2369
- display: grid;
2665
+ display: flex;
2666
+ flex-flow: column nowrap;
2370
2667
  gap: 1em;
2371
2668
  min-width: 0;
2372
2669
  }
@@ -2391,7 +2688,7 @@ c(te, "liveProps", []), c(te, "hostName", "category-hide-panel"), c(te, "depende
2391
2688
  align-items: center;
2392
2689
  gap: 0.45rem;
2393
2690
  min-width: 0;
2394
- max-height: 1em;
2691
+
2395
2692
  }
2396
2693
 
2397
2694
  & cap-categoryswatch {
@@ -2420,80 +2717,80 @@ c(te, "liveProps", []), c(te, "hostName", "category-hide-panel"), c(te, "depende
2420
2717
  white-space: nowrap;
2421
2718
  }
2422
2719
  `);
2423
- function Mr(t, e) {
2720
+ function Jr(t, e) {
2424
2721
  let r = 0;
2425
2722
  for (const i of t)
2426
2723
  e(i) && (r += 1);
2427
2724
  return r;
2428
2725
  }
2429
- const kt = 864e5, Pr = /^(\d{4})-(\d{2})-(\d{2})$/;
2430
- function S(t) {
2431
- const e = Pr.exec(t);
2726
+ const Pt = 864e5, Qr = /^(\d{4})-(\d{2})-(\d{2})$/;
2727
+ function $(t) {
2728
+ const e = Qr.exec(t);
2432
2729
  if (e == null) throw new TypeError(`Invalid civil date "${t}"; expected YYYY-MM-DD`);
2433
2730
  const r = Number(e[1]), i = Number(e[2]), n = Number(e[3]), s = Date.UTC(r, i - 1, n), o = new Date(s);
2434
2731
  if (o.getUTCFullYear() !== r || o.getUTCMonth() !== i - 1 || o.getUTCDate() !== n)
2435
2732
  throw new TypeError(`Invalid civil date "${t}"`);
2436
- return Math.floor(s / kt);
2733
+ return Math.floor(s / Pt);
2437
2734
  }
2438
- function K(t) {
2735
+ function U(t) {
2439
2736
  if (!Number.isInteger(t)) throw new TypeError("Civil day must be an integer");
2440
- return new Date(t * kt).toISOString().slice(0, 10);
2737
+ return new Date(t * Pt).toISOString().slice(0, 10);
2441
2738
  }
2442
- function Nr(t, e) {
2739
+ function ei(t, e) {
2443
2740
  if (!Number.isInteger(e)) throw new TypeError("Civil date offset must be an integer");
2444
- return K(S(t) + e);
2741
+ return U($(t) + e);
2445
2742
  }
2446
- function Kr(t = /* @__PURE__ */ new Date()) {
2743
+ function ti(t = /* @__PURE__ */ new Date()) {
2447
2744
  if (!(t instanceof Date) || Number.isNaN(t.getTime()))
2448
2745
  throw new TypeError("todayCivilDate requires a valid Date");
2449
2746
  return `${String(t.getUTCFullYear()).padStart(4, "0")}-${String(
2450
2747
  t.getUTCMonth() + 1
2451
2748
  ).padStart(2, "0")}-${String(t.getUTCDate()).padStart(2, "0")}`;
2452
2749
  }
2453
- function Ir(t, e) {
2454
- return S(t) - S(e);
2750
+ function ri(t, e) {
2751
+ return $(t) - $(e);
2455
2752
  }
2456
- function Br(t, e = {}) {
2457
- var Me, Pe, Ne, Ke;
2458
- Vr(t);
2459
- const r = Ye(e.width ?? 960, "Chart width"), i = Ye(e.height ?? 420, "Chart height"), n = Math.min(72, r * 0.18), s = 24, o = Math.max(1, r - n - 24), a = Math.max(1, i - s - 58), l = t.flatMap((w) => Object.keys(w.values)), u = e.today ?? Kr(), h = ((Me = e.range) == null ? void 0 : Me.minX) ?? Yr(l) ?? u, p = ((Pe = e.range) == null ? void 0 : Pe.maxX) ?? u, b = S(h), y = S(p);
2460
- if (b > y) throw new RangeError("Line graph minX must not be after maxX");
2461
- const g = Ur(t, b, y), f = e.stacked ?? !1, E = t.map((w) => ({
2753
+ function ii(t, e = {}) {
2754
+ var He, Ve, We, Ye;
2755
+ ci(t);
2756
+ const r = ot(e.width ?? 960, "Chart width"), i = ot(e.height ?? 420, "Chart height"), n = Math.min(72, r * 0.18), s = 24, o = Math.max(1, r - n - 24), a = Math.max(1, i - s - 58), l = t.flatMap((w) => Object.keys(w.values)), u = e.today ?? ti(), d = ((He = e.range) == null ? void 0 : He.minX) ?? ui(l) ?? u, h = ((Ve = e.range) == null ? void 0 : Ve.maxX) ?? u, k = $(d), b = $(h);
2757
+ if (k > b) throw new RangeError("Line graph minX must not be after maxX");
2758
+ const y = ai(t, k, b), f = e.stacked ?? !1, z = t.map((w) => ({
2462
2759
  shape: w,
2463
- values: g.map((F) => Et(w, F))
2760
+ values: y.map((V) => Kt(w, V))
2464
2761
  }));
2465
- let B = ((Ne = e.range) == null ? void 0 : Ne.minY) ?? 0, X = B;
2466
- const Le = Array.from({ length: g.length }, () => 0), $t = E.map(({ shape: w, values: F }) => {
2467
- const q = F.map((Z, L) => {
2468
- const J = f ? Le[L] : 0, Q = J + Z;
2469
- return f && (Le[L] = Q), B = Math.min(B, J, Q), X = Math.max(X, J, Q), { value: Z, baseValue: J, displayValue: Q };
2762
+ let R = ((We = e.range) == null ? void 0 : We.minY) ?? 0, ne = R;
2763
+ const qe = Array.from({ length: y.length }, () => 0), It = z.map(({ shape: w, values: V }) => {
2764
+ const W = V.map((se, K) => {
2765
+ const oe = f ? qe[K] : 0, ae = oe + se;
2766
+ return f && (qe[K] = ae), R = Math.min(R, oe, ae), ne = Math.max(ne, oe, ae), { value: se, baseValue: oe, displayValue: ae };
2470
2767
  });
2471
- return { shape: w, entries: q };
2472
- }), Ct = Math.max(1, X - B), j = X + Ct * 0.05, me = ((Ke = e.range) == null ? void 0 : Ke.minY) ?? B, ye = Math.max(1, j - me), De = Math.max(1, y - b), xt = $t.map(({ shape: w, entries: F }) => ({
2768
+ return { shape: w, entries: W };
2769
+ }), _t = Math.max(1, ne - R), N = ne + _t * 0.05, Ee = ((Ye = e.range) == null ? void 0 : Ye.minY) ?? R, $e = Math.max(1, N - Ee), Ue = Math.max(1, b - k), Bt = It.map(({ shape: w, entries: V }) => ({
2473
2770
  key: w.key,
2474
2771
  label: w.label,
2475
2772
  color: w.color,
2476
2773
  ...w.colorKey === void 0 ? {} : { colorKey: w.colorKey },
2477
2774
  shape: w,
2478
- points: Object.freeze(F.map((q, Z) => {
2479
- const L = g[Z];
2775
+ points: Object.freeze(V.map((W, se) => {
2776
+ const K = y[se];
2480
2777
  return Object.freeze({
2481
- date: K(L),
2482
- day: L,
2483
- ...q,
2484
- x: n + (L - b) / De * o,
2485
- y: s + (j - q.displayValue) / ye * a,
2486
- baseY: s + (j - q.baseValue) / ye * a
2778
+ date: U(K),
2779
+ day: K,
2780
+ ...W,
2781
+ x: n + (K - k) / Ue * o,
2782
+ y: s + (N - W.displayValue) / $e * a,
2783
+ baseY: s + (N - W.baseValue) / $e * a
2487
2784
  });
2488
2785
  }))
2489
2786
  }));
2490
2787
  return Object.freeze({
2491
- minDate: h,
2492
- maxDate: p,
2493
- minDay: b,
2494
- maxDay: y,
2495
- minY: me,
2496
- maxY: j,
2788
+ minDate: d,
2789
+ maxDate: h,
2790
+ minDay: k,
2791
+ maxDay: b,
2792
+ minY: Ee,
2793
+ maxY: N,
2497
2794
  width: r,
2498
2795
  height: i,
2499
2796
  plotLeft: n,
@@ -2501,22 +2798,22 @@ function Br(t, e = {}) {
2501
2798
  plotWidth: o,
2502
2799
  plotHeight: a,
2503
2800
  stacked: f,
2504
- series: Object.freeze(xt),
2505
- dateMarks: Object.freeze(Hr(b, y, e.maxDateMarks ?? 8).map((w) => ({
2506
- date: K(w),
2801
+ series: Object.freeze(Bt),
2802
+ dateMarks: Object.freeze(li(k, b, e.maxDateMarks ?? 8).map((w) => ({
2803
+ date: U(w),
2507
2804
  day: w,
2508
- x: n + (w - b) / De * o
2805
+ x: n + (w - k) / Ue * o
2509
2806
  }))),
2510
- valueTicks: Object.freeze(_r(me, j).map((w) => ({
2807
+ valueTicks: Object.freeze(oi(Ee, N).map((w) => ({
2511
2808
  value: w,
2512
- y: s + (j - w) / ye * a
2809
+ y: s + (N - w) / $e * a
2513
2810
  })))
2514
2811
  });
2515
2812
  }
2516
- function Fr(t, e) {
2517
- return Et(t, S(e));
2813
+ function ni(t, e) {
2814
+ return Kt(t, $(e));
2518
2815
  }
2519
- function St(t, e) {
2816
+ function Nt(t, e) {
2520
2817
  const r = t[0];
2521
2818
  if (r == null) return "";
2522
2819
  let i = `M ${v(r.x)} ${v(r.y)}`;
@@ -2530,9 +2827,9 @@ function St(t, e) {
2530
2827
  }
2531
2828
  return i;
2532
2829
  }
2533
- function qr(t, e) {
2830
+ function si(t, e) {
2534
2831
  if (t.length === 0) return "";
2535
- const r = St(t, e), i = [...t].reverse();
2832
+ const r = Nt(t, e), i = [...t].reverse();
2536
2833
  let n = "";
2537
2834
  for (let s = 0; s < i.length; s += 1) {
2538
2835
  const o = i[s];
@@ -2545,43 +2842,43 @@ function qr(t, e) {
2545
2842
  }
2546
2843
  return `${r}${n} Z`;
2547
2844
  }
2548
- function _r(t, e, r = 6) {
2845
+ function oi(t, e, r = 6) {
2549
2846
  if (!Number.isFinite(t) || !Number.isFinite(e) || t > e)
2550
2847
  throw new RangeError("Tick range must contain finite ascending values");
2551
2848
  if (!Number.isInteger(r) || r < 2) throw new RangeError("Tick target must be at least two");
2552
- const n = Math.max(1, e - t) / (r - 1), s = 10 ** Math.floor(Math.log10(n)), o = n / s, a = o <= 1 ? 1 : o <= 2 ? 2 : o <= 5 ? 5 : 10, l = Math.max(1, a * s), u = Math.ceil(t / l) * l, h = [];
2553
- for (let p = u; p <= e + l / 1e3; p += l)
2554
- h.push(Number(p.toFixed(10)));
2555
- return h.length === 0 && h.push(Math.ceil(t)), h;
2849
+ const n = Math.max(1, e - t) / (r - 1), s = 10 ** Math.floor(Math.log10(n)), o = n / s, a = o <= 1 ? 1 : o <= 2 ? 2 : o <= 5 ? 5 : 10, l = Math.max(1, a * s), u = Math.ceil(t / l) * l, d = [];
2850
+ for (let h = u; h <= e + l / 1e3; h += l)
2851
+ d.push(Number(h.toFixed(10)));
2852
+ return d.length === 0 && d.push(Math.ceil(t)), d;
2556
2853
  }
2557
- function Ur(t, e, r) {
2854
+ function ai(t, e, r) {
2558
2855
  const i = /* @__PURE__ */ new Set([e, r]);
2559
2856
  for (const n of t)
2560
2857
  for (const s of Object.keys(n.values)) {
2561
- const o = S(s);
2858
+ const o = $(s);
2562
2859
  o >= e && o <= r && i.add(o);
2563
2860
  }
2564
2861
  return [...i].sort((n, s) => n - s);
2565
2862
  }
2566
- function Et(t, e) {
2567
- const r = t.values[K(e)];
2863
+ function Kt(t, e) {
2864
+ const r = t.values[U(e)];
2568
2865
  if (r !== void 0) return r;
2569
2866
  if (t.carryForward !== !0) return 0;
2570
2867
  let i = Number.NEGATIVE_INFINITY, n = 0;
2571
2868
  for (const [s, o] of Object.entries(t.values)) {
2572
- const a = S(s);
2869
+ const a = $(s);
2573
2870
  a <= e && a > i && (i = a, n = o);
2574
2871
  }
2575
2872
  return n;
2576
2873
  }
2577
- function Hr(t, e, r) {
2874
+ function li(t, e, r) {
2578
2875
  if (!Number.isInteger(r) || r < 2)
2579
2876
  throw new RangeError("Maximum date marks must be at least two");
2580
2877
  const i = Math.max(0, e - t), n = i <= 62 ? 7 : i <= 730 ? 30 : 365, s = Math.max(n, Math.ceil(Math.max(1, i) / (r - 1))), o = [t];
2581
2878
  for (let a = t + s; a < e; a += s) o.push(a);
2582
2879
  return e !== t && o.push(e), o;
2583
2880
  }
2584
- function Vr(t) {
2881
+ function ci(t) {
2585
2882
  if (!Array.isArray(t)) throw new TypeError("History shapes must be an array");
2586
2883
  const e = /* @__PURE__ */ new Set();
2587
2884
  for (const r of t) {
@@ -2593,23 +2890,23 @@ function Vr(t) {
2593
2890
  if (typeof r.color != "string" || r.color.trim() === "")
2594
2891
  throw new TypeError("History shape color must be a non-empty CSS value");
2595
2892
  for (const [i, n] of Object.entries(r.values))
2596
- if (S(i), !Number.isFinite(n)) throw new TypeError("History shape values must be finite");
2893
+ if ($(i), !Number.isFinite(n)) throw new TypeError("History shape values must be finite");
2597
2894
  }
2598
2895
  }
2599
- function Yr(t) {
2600
- return t.length === 0 ? void 0 : t.reduce((e, r) => S(e) <= S(r) ? e : r);
2896
+ function ui(t) {
2897
+ return t.length === 0 ? void 0 : t.reduce((e, r) => $(e) <= $(r) ? e : r);
2601
2898
  }
2602
- function Ye(t, e) {
2899
+ function ot(t, e) {
2603
2900
  if (!Number.isFinite(t) || t <= 0) throw new RangeError(`${e} must be positive`);
2604
2901
  return t;
2605
2902
  }
2606
2903
  function v(t) {
2607
2904
  return Number(t.toFixed(3)).toString();
2608
2905
  }
2609
- class Se extends Te {
2906
+ class je extends Ne {
2610
2907
  constructor(r) {
2611
2908
  super(r);
2612
- c(this, "cursorDate$", new A(null, {
2909
+ c(this, "cursorDate$", new D(null, {
2613
2910
  owner: this,
2614
2911
  purpose: "line graph cursor date"
2615
2912
  }));
@@ -2625,11 +2922,11 @@ class Se extends Te {
2625
2922
  this.shapes$ = this.source(r.shapes$, "line graph shapes"), this.stacked$ = this.source(r.stacked$, "line graph stacked state"), this.smooth$ = this.source(r.smooth$, "line graph smooth state"), this.range$ = this.source(r.range$, "line graph range");
2626
2923
  }
2627
2924
  render() {
2628
- const r = this.snapshot(this.shapes$), i = this.snapshot(this.stacked$), n = this.snapshot(this.smooth$), s = this.snapshot(this.range$), o = this.read(this.cursorDate$), a = this.props.label ?? "History chart", l = [r, i, n, s].some(({ fetchState: f }) => f === k.Error) ? k.Error : [r, i, n, s].some(({ fetchState: f }) => f !== k.Ready) ? k.Loading : k.Ready;
2925
+ const r = this.snapshot(this.shapes$), i = this.snapshot(this.stacked$), n = this.snapshot(this.smooth$), s = this.snapshot(this.range$), o = this.read(this.cursorDate$), a = this.props.label ?? "History chart", l = [r, i, n, s].some(({ fetchState: f }) => f === S.Error) ? S.Error : [r, i, n, s].some(({ fetchState: f }) => f !== S.Ready) ? S.Loading : S.Ready;
2629
2926
  let u = null;
2630
- if (this.currentModel = null, l === k.Ready)
2927
+ if (this.currentModel = null, l === S.Ready)
2631
2928
  try {
2632
- this.currentModel = Br(r.value, {
2929
+ this.currentModel = ii(r.value, {
2633
2930
  stacked: i.value,
2634
2931
  range: s.value,
2635
2932
  width: Math.max(480, this.observedWidth),
@@ -2638,17 +2935,17 @@ class Se extends Te {
2638
2935
  } catch (f) {
2639
2936
  u = f;
2640
2937
  }
2641
- const h = this.currentModel, p = h == null ? null : o ?? h.maxDate, b = this.props.formatDate ?? ((f) => f), y = this.props.formatValue ?? ((f) => String(f)), g = this.Host;
2642
- return /* @__PURE__ */ m(
2643
- g,
2938
+ const d = this.currentModel, h = d == null ? null : o ?? d.maxDate, k = this.props.formatDate ?? ((f) => f), b = this.props.formatValue ?? ((f) => String(f)), y = this.Host;
2939
+ return /* @__PURE__ */ g(
2940
+ y,
2644
2941
  {
2645
2942
  className: (this.props.className ?? this.props.class ?? "") || null,
2646
2943
  "aria-label": a,
2647
- "aria-busy": l !== k.Ready ? "true" : null,
2944
+ "aria-busy": l !== S.Ready ? "true" : null,
2648
2945
  children: [
2649
- /* @__PURE__ */ m("header", { children: [
2650
- /* @__PURE__ */ d("h2", { children: a }),
2651
- /* @__PURE__ */ m("p", { children: [
2946
+ /* @__PURE__ */ g("header", { children: [
2947
+ /* @__PURE__ */ p("h2", { children: a }),
2948
+ /* @__PURE__ */ g("p", { children: [
2652
2949
  i.value ? "Stacked area" : "Individual line",
2653
2950
  " chart;",
2654
2951
  " ",
@@ -2656,7 +2953,7 @@ class Se extends Te {
2656
2953
  " rendering."
2657
2954
  ] })
2658
2955
  ] }),
2659
- l === k.Error || u != null ? /* @__PURE__ */ d("p", { role: "alert", children: "The history chart could not be calculated." }) : l !== k.Ready ? /* @__PURE__ */ d("p", { role: "status", "aria-live": "polite", children: "Loading history chart…" }) : r.value.length === 0 ? /* @__PURE__ */ d("p", { role: "status", children: this.props.emptyMessage ?? "No history values are available." }) : /* @__PURE__ */ d(
2956
+ l === S.Error || u != null ? /* @__PURE__ */ p("p", { role: "alert", children: "The history chart could not be calculated." }) : l !== S.Ready ? /* @__PURE__ */ p("p", { role: "status", "aria-live": "polite", children: "Loading history chart…" }) : r.value.length === 0 ? /* @__PURE__ */ p("p", { role: "status", children: this.props.emptyMessage ?? "No history values are available." }) : /* @__PURE__ */ p(
2660
2957
  "cap-chart",
2661
2958
  {
2662
2959
  tabIndex: 0,
@@ -2667,18 +2964,18 @@ class Se extends Te {
2667
2964
  ref: (f) => this.chartHost = f
2668
2965
  }
2669
2966
  ),
2670
- h == null || p == null ? null : /* @__PURE__ */ m("cap-readout", { children: [
2671
- /* @__PURE__ */ d("p", { "aria-live": "polite", children: /* @__PURE__ */ d("strong", { children: b(p) }) }),
2672
- /* @__PURE__ */ d("ul", { children: h.series.map(({ shape: f }) => /* @__PURE__ */ m("li", { children: [
2673
- /* @__PURE__ */ d(
2967
+ d == null || h == null ? null : /* @__PURE__ */ g("cap-readout", { children: [
2968
+ /* @__PURE__ */ p("p", { "aria-live": "polite", children: /* @__PURE__ */ p("strong", { children: k(h) }) }),
2969
+ /* @__PURE__ */ p("ul", { children: d.series.map(({ shape: f }) => /* @__PURE__ */ g("li", { children: [
2970
+ /* @__PURE__ */ p(
2674
2971
  "cap-swatch",
2675
2972
  {
2676
2973
  style: { "--colored-base": f.color },
2677
2974
  "aria-hidden": "true"
2678
2975
  }
2679
2976
  ),
2680
- /* @__PURE__ */ d("span", { children: f.label }),
2681
- /* @__PURE__ */ d("strong", { children: y(Fr(f, p)) })
2977
+ /* @__PURE__ */ p("span", { children: f.label }),
2978
+ /* @__PURE__ */ p("strong", { children: b(ni(f, h)) })
2682
2979
  ] }, f.key)) })
2683
2980
  ] })
2684
2981
  ]
@@ -2705,8 +3002,8 @@ class Se extends Te {
2705
3002
  }), this.resizeObserver.observe(this.chartHost));
2706
3003
  }
2707
3004
  source(r, i) {
2708
- if (Gr(r)) return r;
2709
- const n = new A(r, { owner: this, purpose: i });
3005
+ if (di(r)) return r;
3006
+ const n = new D(r, { owner: this, purpose: i });
2710
3007
  return this.ownedSources.push(n), n;
2711
3008
  }
2712
3009
  pointerMove(r) {
@@ -2715,12 +3012,12 @@ class Se extends Te {
2715
3012
  const s = n.getBoundingClientRect();
2716
3013
  if (s.width <= 0) return;
2717
3014
  const o = (r.clientX - s.left) / s.width * i.width, a = Math.max(0, Math.min(1, (o - i.plotLeft) / i.plotWidth)), l = Math.round(i.minDay + a * (i.maxDay - i.minDay));
2718
- this.cursorDate$.set(K(l), "line graph pointer moved");
3015
+ this.cursorDate$.set(U(l), "line graph pointer moved");
2719
3016
  }
2720
3017
  cursorKeyDown(r) {
2721
3018
  const i = this.currentModel;
2722
3019
  if (i == null) return;
2723
- let n = S(this.cursorDate$.get() ?? i.maxDate);
3020
+ let n = $(this.cursorDate$.get() ?? i.maxDate);
2724
3021
  if (r.key === "ArrowLeft") n -= r.shiftKey ? 7 : 1;
2725
3022
  else if (r.key === "ArrowRight") n += r.shiftKey ? 7 : 1;
2726
3023
  else if (r.key === "Home") n = i.minDay;
@@ -2730,35 +3027,35 @@ class Se extends Te {
2730
3027
  return;
2731
3028
  } else return;
2732
3029
  r.preventDefault();
2733
- const s = K(Math.max(i.minDay, Math.min(i.maxDay, n)));
3030
+ const s = U(Math.max(i.minDay, Math.min(i.maxDay, n)));
2734
3031
  this.cursorDate$.set(s, "line graph cursor moved by keyboard");
2735
3032
  }
2736
3033
  drawChart() {
2737
3034
  const r = this.chartHost, i = this.currentModel;
2738
3035
  if (r == null || i == null) return;
2739
- const n = this.smooth$.get(), s = x("svg");
3036
+ const n = this.smooth$.get(), s = A("svg");
2740
3037
  s.setAttribute("viewBox", `0 0 ${i.width} ${i.height}`), s.setAttribute("role", "img"), s.setAttribute("aria-label", this.props.label ?? "History chart");
2741
3038
  for (const a of i.valueTicks) {
2742
- const l = x("line");
2743
- l.classList.add("gridline"), _(l, {
3039
+ const l = A("line");
3040
+ l.classList.add("gridline"), G(l, {
2744
3041
  x1: i.plotLeft,
2745
3042
  x2: i.plotLeft + i.plotWidth,
2746
3043
  y1: a.y,
2747
3044
  y2: a.y
2748
3045
  }), s.append(l);
2749
- const u = x("text");
2750
- u.classList.add("axismark"), _(u, { x: i.plotLeft - 8, y: a.y + 4, "text-anchor": "end" }), u.textContent = String(a.value), s.append(u);
3046
+ const u = A("text");
3047
+ u.classList.add("axismark"), G(u, { x: i.plotLeft - 8, y: a.y + 4, "text-anchor": "end" }), u.textContent = String(a.value), s.append(u);
2751
3048
  }
2752
3049
  for (const a of i.dateMarks) {
2753
- const l = x("line");
2754
- l.classList.add("gridline"), _(l, {
3050
+ const l = A("line");
3051
+ l.classList.add("gridline"), G(l, {
2755
3052
  x1: a.x,
2756
3053
  x2: a.x,
2757
3054
  y1: i.plotTop,
2758
3055
  y2: i.plotTop + i.plotHeight
2759
3056
  }), s.append(l);
2760
- const u = x("text");
2761
- u.classList.add("axismark"), _(u, {
3057
+ const u = A("text");
3058
+ u.classList.add("axismark"), G(u, {
2762
3059
  x: a.x,
2763
3060
  y: i.plotTop + i.plotHeight + 22,
2764
3061
  "text-anchor": "middle"
@@ -2766,16 +3063,16 @@ class Se extends Te {
2766
3063
  }
2767
3064
  for (const a of i.series) {
2768
3065
  if (i.stacked) {
2769
- const u = x("path");
2770
- u.classList.add("seriesarea"), u.setAttribute("fill", a.color), u.setAttribute("d", qr(a.points, n)), s.append(u);
3066
+ const u = A("path");
3067
+ u.classList.add("seriesarea"), u.setAttribute("fill", a.color), u.setAttribute("d", si(a.points, n)), s.append(u);
2771
3068
  }
2772
- const l = x("path");
2773
- l.classList.add("seriesline"), l.setAttribute("stroke", a.color), l.setAttribute("d", St(a.points, n)), s.append(l);
3069
+ const l = A("path");
3070
+ l.classList.add("seriesline"), l.setAttribute("stroke", a.color), l.setAttribute("d", Nt(a.points, n)), s.append(l);
2774
3071
  }
2775
3072
  const o = this.cursorDate$.get();
2776
3073
  if (o != null) {
2777
- const a = S(o), l = i.plotLeft + (a - i.minDay) / Math.max(1, i.maxDay - i.minDay) * i.plotWidth, u = x("line");
2778
- u.classList.add("cursor"), _(u, {
3074
+ const a = $(o), l = i.plotLeft + (a - i.minDay) / Math.max(1, i.maxDay - i.minDay) * i.plotWidth, u = A("line");
3075
+ u.classList.add("cursor"), G(u, {
2779
3076
  x1: l,
2780
3077
  x2: l,
2781
3078
  y1: i.plotTop,
@@ -2785,7 +3082,7 @@ class Se extends Te {
2785
3082
  r.replaceChildren(s);
2786
3083
  }
2787
3084
  }
2788
- c(Se, "liveProps", []), c(Se, "hostName", "line-graph"), c(Se, "css", G`
3085
+ c(je, "liveProps", []), c(je, "hostName", "line-graph"), c(je, "css", re`
2789
3086
  & {
2790
3087
  display: flex;
2791
3088
  min-width: 0;
@@ -2886,18 +3183,18 @@ c(Se, "liveProps", []), c(Se, "hostName", "line-graph"), c(Se, "css", G`
2886
3183
  }
2887
3184
  }
2888
3185
  `);
2889
- function Gr(t) {
3186
+ function di(t) {
2890
3187
  return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
2891
3188
  }
2892
- const Wr = "http://www.w3.org/2000/svg";
2893
- function x(t) {
2894
- return document.createElementNS(Wr, t);
3189
+ const pi = "http://www.w3.org/2000/svg";
3190
+ function A(t) {
3191
+ return document.createElementNS(pi, t);
2895
3192
  }
2896
- function _(t, e) {
3193
+ function G(t, e) {
2897
3194
  for (const [r, i] of Object.entries(e))
2898
3195
  t.setAttribute(r, String(i));
2899
3196
  }
2900
- class Xr {
3197
+ class hi {
2901
3198
  constructor(e, r = {}) {
2902
3199
  c(this, "criteria");
2903
3200
  c(this, "presets");
@@ -2910,29 +3207,29 @@ class Xr {
2910
3207
  c(this, "activeSplitsEmitter");
2911
3208
  c(this, "activeEmitters", /* @__PURE__ */ new Map());
2912
3209
  c(this, "disposed", !1);
2913
- if (!Array.isArray(e) || e.some((o) => !(o instanceof I)))
3210
+ if (!Array.isArray(e) || e.some((o) => !(o instanceof H)))
2914
3211
  throw new TypeError("Split criteria must contain GroupingCriterion instances");
2915
3212
  const i = new Map(
2916
3213
  e.map((o) => [o.key, o])
2917
3214
  );
2918
3215
  if (i.size !== e.length) throw new Error("Split criteria keys must be unique");
2919
- this.criteria = Object.freeze([...e]), this.byKey = i, this.presets = Jr(r.presets ?? [], i);
3216
+ this.criteria = Object.freeze([...e]), this.byKey = i, this.presets = mi(r.presets ?? [], i);
2920
3217
  const n = this.criteria.map(({ key: o }) => o), s = r.active ?? n;
2921
- V(s, i, "Active split keys"), this.state$ = new A(re(n, new Set(s)), {
3218
+ Q(s, i, "Active split keys"), this.state$ = new D(ue(n, new Set(s)), {
2922
3219
  owner: this,
2923
3220
  purpose: "split selection state",
2924
- equals: Qr
2925
- }), this.orderEmitter = new z(
3221
+ equals: yi
3222
+ }), this.orderEmitter = new j(
2926
3223
  [this.state$],
2927
3224
  ([o]) => Object.freeze(
2928
- o.order.map((a) => Ge(i, a))
3225
+ o.order.map((a) => at(i, a))
2929
3226
  ),
2930
3227
  { owner: this, purpose: "ordered visualization criteria" }
2931
- ), this.order$ = this.orderEmitter, this.activeSplitsEmitter = new z(
3228
+ ), this.order$ = this.orderEmitter, this.activeSplitsEmitter = new j(
2932
3229
  [this.state$],
2933
- ([o]) => Object.freeze(o.order.filter((a) => o.active.has(a)).map((a) => Ge(i, a))),
3230
+ ([o]) => Object.freeze(o.order.filter((a) => o.active.has(a)).map((a) => at(i, a))),
2934
3231
  { owner: this, purpose: "active ordered visualization splits" }
2935
- ), this.activeSplits$ = this.activeSplitsEmitter, this.activePreset$ = new A(null, {
3232
+ ), this.activeSplits$ = this.activeSplitsEmitter, this.activePreset$ = new D(null, {
2936
3233
  owner: this,
2937
3234
  purpose: "active visualization split preset"
2938
3235
  });
@@ -2941,7 +3238,7 @@ class Xr {
2941
3238
  this.assertActive();
2942
3239
  const r = this.requireKey(e);
2943
3240
  let i = this.activeEmitters.get(r);
2944
- return i == null && (i = new Zr(this, r), this.activeEmitters.set(r, i)), i;
3241
+ return i == null && (i = new fi(this, r), this.activeEmitters.set(r, i)), i;
2945
3242
  }
2946
3243
  isActive(e) {
2947
3244
  return this.state$.get().active.has(this.requireKey(e));
@@ -2950,7 +3247,7 @@ class Xr {
2950
3247
  this.assertActive();
2951
3248
  const i = this.requireKey(e), n = this.state$.get(), s = new Set(n.active);
2952
3249
  return s.has(i) ? s.delete(i) : s.add(i), this.activePreset$.set(null, "split selection customized"), this.state$.set(
2953
- re(n.order, s),
3250
+ ue(n.order, s),
2954
3251
  r ?? `${i} split toggled`
2955
3252
  );
2956
3253
  }
@@ -2962,7 +3259,7 @@ class Xr {
2962
3259
  if (o === a) return !1;
2963
3260
  const l = [...s.order];
2964
3261
  return l.splice(o, 1), l.splice(a, 0, n), this.activePreset$.set(null, "split order customized"), this.state$.set(
2965
- re(l, s.active),
3262
+ ue(l, s.active),
2966
3263
  i ?? `${n} split moved`
2967
3264
  );
2968
3265
  }
@@ -2976,14 +3273,14 @@ class Xr {
2976
3273
  );
2977
3274
  }
2978
3275
  setSplits(e, r, i) {
2979
- this.assertActive(), V(e, this.byKey, "Active split keys");
3276
+ this.assertActive(), Q(e, this.byKey, "Active split keys");
2980
3277
  const n = new Set(e), s = r ?? this.state$.get().order.filter((a) => !n.has(a));
2981
- V(s, this.byKey, "Inactive split keys");
3278
+ Q(s, this.byKey, "Inactive split keys");
2982
3279
  const o = [...e, ...s];
2983
3280
  if (new Set(o).size !== this.criteria.length || o.length !== this.criteria.length)
2984
3281
  throw new Error("Active and inactive split keys must cover every criterion exactly once");
2985
3282
  return this.activePreset$.set(null, "split selection replaced"), this.state$.set(
2986
- re(o, n),
3283
+ ue(o, n),
2987
3284
  i ?? "split selection replaced"
2988
3285
  );
2989
3286
  }
@@ -3010,10 +3307,10 @@ class Xr {
3010
3307
  if (this.disposed) throw new Error("Split selection model is disposed");
3011
3308
  }
3012
3309
  }
3013
- function ui(t, e = {}) {
3014
- return new Xr(t, e);
3310
+ function Ti(t, e = {}) {
3311
+ return new hi(t, e);
3015
3312
  }
3016
- class Zr extends xe {
3313
+ class fi extends Pe {
3017
3314
  constructor(r, i) {
3018
3315
  super(r.isActive(i) ? "visible" : "hidden", {
3019
3316
  owner: r,
@@ -3045,7 +3342,7 @@ class Zr extends xe {
3045
3342
  });
3046
3343
  }
3047
3344
  }
3048
- function Jr(t, e) {
3345
+ function mi(t, e) {
3049
3346
  if (!Array.isArray(t)) throw new TypeError("Split presets must be an array");
3050
3347
  const r = /* @__PURE__ */ new Set();
3051
3348
  return Object.freeze(t.map((i) => {
@@ -3055,35 +3352,35 @@ function Jr(t, e) {
3055
3352
  throw new Error("Split preset keys must be non-empty and unique");
3056
3353
  if (typeof i.label != "string" || i.label.trim() === "")
3057
3354
  throw new TypeError("Split preset label must be a non-empty string");
3058
- r.add(i.key), V(i.active, e, `${i.key} active keys`);
3355
+ r.add(i.key), Q(i.active, e, `${i.key} active keys`);
3059
3356
  const n = Object.freeze([...i.active]), s = i.inactive == null ? Object.freeze([...e.keys()].filter((o) => !n.includes(o))) : Object.freeze([...i.inactive]);
3060
- if (V(s, e, `${i.key} inactive keys`), (/* @__PURE__ */ new Set([...n, ...s])).size !== e.size || n.length + s.length !== e.size)
3357
+ if (Q(s, e, `${i.key} inactive keys`), (/* @__PURE__ */ new Set([...n, ...s])).size !== e.size || n.length + s.length !== e.size)
3061
3358
  throw new Error(`Split preset "${i.key}" must cover every criterion exactly once`);
3062
3359
  return Object.freeze({ ...i, active: n, inactive: s });
3063
3360
  }));
3064
3361
  }
3065
- function V(t, e, r) {
3362
+ function Q(t, e, r) {
3066
3363
  if (!Array.isArray(t)) throw new TypeError(`${r} must be an array`);
3067
3364
  if (new Set(t).size !== t.length) throw new Error(`${r} must be unique`);
3068
3365
  for (const n of t)
3069
3366
  if (!e.has(n)) throw new Error(`${r} contains unknown criterion "${n}"`);
3070
3367
  }
3071
- function Ge(t, e) {
3368
+ function at(t, e) {
3072
3369
  const r = t.get(e);
3073
3370
  if (r == null) throw new Error(`Missing criterion "${e}"`);
3074
3371
  return r;
3075
3372
  }
3076
- function re(t, e) {
3373
+ function ue(t, e) {
3077
3374
  return Object.freeze({ order: Object.freeze([...t]), active: new Set(e) });
3078
3375
  }
3079
- function Qr(t, e) {
3376
+ function yi(t, e) {
3080
3377
  return t.order.length === e.order.length && t.order.every((r, i) => r === e.order[i]) && t.active.size === e.active.size && [...t.active].every((r) => e.active.has(r));
3081
3378
  }
3082
- const ei = [
3379
+ const gi = [
3083
3380
  ["☐", "hidden"],
3084
3381
  ["✓", "visible"]
3085
3382
  ];
3086
- class ie extends Te {
3383
+ class de extends Ne {
3087
3384
  constructor() {
3088
3385
  super(...arguments);
3089
3386
  c(this, "draggingKey", null);
@@ -3104,9 +3401,9 @@ class ie extends Te {
3104
3401
  } = this.props, o = this.read(r.order$);
3105
3402
  this.read(r.activeSplits$);
3106
3403
  const a = this.read(r.activePreset$), l = this.Host;
3107
- return /* @__PURE__ */ m(l, { children: [
3108
- r.presets.length === 0 ? null : /* @__PURE__ */ d(ge, { header: s, children: /* @__PURE__ */ d("cap-presets", { children: r.presets.map((u) => /* @__PURE__ */ d(
3109
- oe,
3404
+ return /* @__PURE__ */ g(l, { children: [
3405
+ r.presets.length === 0 ? null : /* @__PURE__ */ p(Ce, { header: s, children: /* @__PURE__ */ p("cap-presets", { children: r.presets.map((u) => /* @__PURE__ */ p(
3406
+ he,
3110
3407
  {
3111
3408
  label: u.label,
3112
3409
  pressed: a === u.key,
@@ -3116,39 +3413,39 @@ class ie extends Te {
3116
3413
  },
3117
3414
  u.key
3118
3415
  )) }) }),
3119
- /* @__PURE__ */ m(ge, { header: i, children: [
3120
- /* @__PURE__ */ d("p", { children: n }),
3121
- /* @__PURE__ */ d("ol", { children: o.map((u) => /* @__PURE__ */ m(
3416
+ /* @__PURE__ */ g(Ce, { header: i, children: [
3417
+ /* @__PURE__ */ p("p", { children: n }),
3418
+ /* @__PURE__ */ p("ol", { children: o.map((u) => /* @__PURE__ */ g(
3122
3419
  "li",
3123
3420
  {
3124
3421
  className: this.draggingKey === u.key ? "dragging" : void 0,
3125
3422
  "data-split-key": u.key,
3126
- onPointerDown: (h) => this.startDragging(u.key, h),
3127
- onClick: (h) => this.suppressDraggedClick(h),
3423
+ onPointerDown: (d) => this.startDragging(u.key, d),
3424
+ onClick: (d) => this.suppressDraggedClick(d),
3128
3425
  children: [
3129
- /* @__PURE__ */ d(
3130
- ae,
3426
+ /* @__PURE__ */ p(
3427
+ fe,
3131
3428
  {
3132
- symbols: ei,
3429
+ symbols: gi,
3133
3430
  label: u.label,
3134
3431
  valueEmitter: r.activeState(u.key)
3135
3432
  }
3136
3433
  ),
3137
- /* @__PURE__ */ d(
3434
+ /* @__PURE__ */ p(
3138
3435
  "cap-draghandle",
3139
3436
  {
3140
3437
  role: "button",
3141
3438
  tabIndex: 0,
3142
3439
  "aria-label": `Reorder ${u.label}`,
3143
3440
  title: "Drag to reorder; use Alt+Arrow keys from the keyboard",
3144
- onKeyDown: (h) => {
3145
- if (!h.altKey || h.key !== "ArrowUp" && h.key !== "ArrowDown")
3441
+ onKeyDown: (d) => {
3442
+ if (!d.altKey || d.key !== "ArrowUp" && d.key !== "ArrowDown")
3146
3443
  return;
3147
- h.preventDefault();
3148
- const p = h.key === "ArrowUp" ? -1 : 1;
3149
- if (r.moveBy(u.key, p, "split reordered by keyboard")) {
3150
- const b = r.order$.get().findIndex(({ key: y }) => y === u.key) + 1;
3151
- this.announce(`${u.label} moved to position ${b}`), queueMicrotask(() => this.focusHandle(u.key));
3444
+ d.preventDefault();
3445
+ const h = d.key === "ArrowUp" ? -1 : 1;
3446
+ if (r.moveBy(u.key, h, "split reordered by keyboard")) {
3447
+ const k = r.order$.get().findIndex(({ key: b }) => b === u.key) + 1;
3448
+ this.announce(`${u.label} moved to position ${k}`), queueMicrotask(() => this.focusHandle(u.key));
3152
3449
  }
3153
3450
  }
3154
3451
  }
@@ -3157,16 +3454,16 @@ class ie extends Te {
3157
3454
  },
3158
3455
  u.key
3159
3456
  )) }),
3160
- /* @__PURE__ */ d("p", { role: "status", "aria-live": "polite", "aria-atomic": "true", children: this.announcement })
3457
+ /* @__PURE__ */ p("p", { role: "status", "aria-live": "polite", "aria-atomic": "true", children: this.announcement })
3161
3458
  ] })
3162
3459
  ] });
3163
3460
  }
3164
3461
  pointerMove(r) {
3165
3462
  var a;
3166
3463
  if (this.draggingKey == null && this.pendingDrag != null) {
3167
- const { clientX: l, clientY: u, key: h } = this.pendingDrag;
3464
+ const { clientX: l, clientY: u, key: d } = this.pendingDrag;
3168
3465
  if (Math.hypot(r.clientX - l, r.clientY - u) < 4) return;
3169
- this.draggingKey = h, this.pendingDrag = null, this.update();
3466
+ this.draggingKey = d, this.pendingDrag = null, this.update();
3170
3467
  }
3171
3468
  if (this.draggingKey == null || typeof document.elementFromPoint != "function") return;
3172
3469
  const i = (a = document.elementFromPoint(r.clientX, r.clientY)) == null ? void 0 : a.closest("[data-split-key]");
@@ -3208,9 +3505,10 @@ class ie extends Te {
3208
3505
  }
3209
3506
  }
3210
3507
  }
3211
- c(ie, "liveProps", []), c(ie, "hostName", "split-selection-panel"), c(ie, "dependencies", [oe, ae, ge]), c(ie, "css", G`
3508
+ c(de, "liveProps", []), c(de, "hostName", "split-selection-panel"), c(de, "dependencies", [he, fe, Ce]), c(de, "css", re`
3212
3509
  & {
3213
- display: grid;
3510
+ display: flex;
3511
+ flex-flow: column nowrap;
3214
3512
  gap: var(--viz-space, 0.6rem);
3215
3513
  min-width: 0;
3216
3514
  user-select: none;
@@ -3238,10 +3536,10 @@ c(ie, "liveProps", []), c(ie, "hostName", "split-selection-panel"), c(ie, "depen
3238
3536
  }
3239
3537
 
3240
3538
  & > cap-groupbox > cap-content > cap-presets {
3241
- display: grid;
3539
+ display: flex;
3540
+ flex-flow: column nowrap;
3242
3541
  gap: 0.35rem;
3243
- align-content: stretch;
3244
- justify-content: stretch;
3542
+ align-items: stretch;
3245
3543
  }
3246
3544
 
3247
3545
  & > cap-groupbox > cap-content > cap-presets > cap-button {
@@ -3251,8 +3549,9 @@ c(ie, "liveProps", []), c(ie, "hostName", "split-selection-panel"), c(ie, "depen
3251
3549
  }
3252
3550
 
3253
3551
  & ol {
3254
- display: grid;
3255
- gap: 0.25rem;
3552
+ display: flex;
3553
+ flex-flow: column nowrap;
3554
+ gap: .33rem;
3256
3555
  padding: 0;
3257
3556
  list-style: none;
3258
3557
  }
@@ -3264,7 +3563,7 @@ c(ie, "liveProps", []), c(ie, "hostName", "split-selection-panel"), c(ie, "depen
3264
3563
  justify-content: space-between;
3265
3564
  gap: 0.35rem;
3266
3565
  min-width: 0;
3267
- padding: 0 .35rem;
3566
+ padding: .15rem .35rem;
3268
3567
  border-radius: var(--ui-border-radius);
3269
3568
  box-shadow: var(--box-shadow);
3270
3569
  }
@@ -3319,13 +3618,13 @@ c(ie, "liveProps", []), c(ie, "hostName", "split-selection-panel"), c(ie, "depen
3319
3618
  border: 0;
3320
3619
  }
3321
3620
  `);
3322
- class hi {
3621
+ class zi {
3323
3622
  constructor(e) {
3324
3623
  c(this, "categories");
3325
3624
  c(this, "byKey");
3326
3625
  c(this, "deltas", /* @__PURE__ */ new Map());
3327
3626
  if (!Array.isArray(e)) throw new TypeError("Series categories must be an array");
3328
- const r = e.map((n) => ti(n)), i = new Map(r.map((n) => [n.key, n]));
3627
+ const r = e.map((n) => bi(n)), i = new Map(r.map((n) => [n.key, n]));
3329
3628
  if (i.size !== r.length) throw new Error("Series category keys must be unique");
3330
3629
  this.categories = Object.freeze(r), this.byKey = i;
3331
3630
  }
@@ -3336,7 +3635,7 @@ class hi {
3336
3635
  return this.add(e, r, -1);
3337
3636
  }
3338
3637
  add(e, r, i) {
3339
- if (S(e), !Number.isFinite(i)) throw new TypeError("Series delta must be finite");
3638
+ if ($(e), !Number.isFinite(i)) throw new TypeError("Series delta must be finite");
3340
3639
  if (!this.byKey.has(r))
3341
3640
  throw new Error(`Unknown series category "${r}"`);
3342
3641
  const n = this.deltas.get(r) ?? /* @__PURE__ */ new Map();
@@ -3344,7 +3643,7 @@ class hi {
3344
3643
  }
3345
3644
  build() {
3346
3645
  const e = this.allDates();
3347
- return this.categories.map((r) => We(r, Object.fromEntries(e.map((i) => {
3646
+ return this.categories.map((r) => lt(r, Object.fromEntries(e.map((i) => {
3348
3647
  var n;
3349
3648
  return [
3350
3649
  i,
@@ -3355,21 +3654,21 @@ class hi {
3355
3654
  buildCumulative() {
3356
3655
  const e = this.allDates();
3357
3656
  if (e.length === 0) return Object.freeze([]);
3358
- const r = [Nr(e[0], -1), ...e];
3657
+ const r = [ei(e[0], -1), ...e];
3359
3658
  return this.categories.map((i) => {
3360
3659
  var o;
3361
3660
  let n = 0;
3362
3661
  const s = { [r[0]]: 0 };
3363
3662
  for (const a of e)
3364
3663
  n += ((o = this.deltas.get(i.key)) == null ? void 0 : o.get(a)) ?? 0, s[a] = n;
3365
- return We(i, s, !0);
3664
+ return lt(i, s, !0);
3366
3665
  }).filter((i) => Object.values(i.values).some((n) => n !== 0));
3367
3666
  }
3368
3667
  allDates() {
3369
- return [...new Set([...this.deltas.values()].flatMap((e) => [...e.keys()]))].sort(Ir);
3668
+ return [...new Set([...this.deltas.values()].flatMap((e) => [...e.keys()]))].sort(ri);
3370
3669
  }
3371
3670
  }
3372
- function ti(t) {
3671
+ function bi(t) {
3373
3672
  if (t == null || typeof t != "object")
3374
3673
  throw new TypeError("Series category must be an object");
3375
3674
  if (typeof t.key != "string" || t.key.trim() === "")
@@ -3382,7 +3681,7 @@ function ti(t) {
3382
3681
  const r = t.colorKey === void 0 ? { key: t.key, label: t.label, color: e } : { key: t.key, label: t.label, color: e, colorKey: t.colorKey };
3383
3682
  return Object.freeze(r);
3384
3683
  }
3385
- function We(t, e, r) {
3684
+ function lt(t, e, r) {
3386
3685
  return Object.freeze({
3387
3686
  ...t,
3388
3687
  values: Object.freeze(e),
@@ -3390,37 +3689,37 @@ function We(t, e, r) {
3390
3689
  });
3391
3690
  }
3392
3691
  export {
3393
- ee as BlockGraph,
3394
- It as BlockSelectionModel,
3395
- te as CategoryHidePanel,
3396
- de as CollapsibleOptionGroup,
3397
- I as GroupingCriterion,
3398
- Se as LineGraph,
3399
- hi as SeriesBuilder,
3400
- Xr as SplitSelectionModel,
3401
- ie as SplitSelectionPanel,
3402
- Nr as addCivilDays,
3403
- qr as areaPath,
3404
- we as buildBlockLayout,
3405
- _r as buildIntegerTicks,
3406
- Br as buildLineChartModel,
3407
- Xe as categoryColorVariables,
3408
- li as categoryCounts,
3409
- S as civilDateToDay,
3410
- Ir as compareCivilDates,
3411
- ci as createBlockSelection,
3412
- ui as createSplitSelection,
3413
- Kt as criterionSnapshot,
3414
- K as dayToCivilDate,
3415
- Dt as deriveCategories,
3416
- oi as derivedCriterion,
3417
- ai as filterByHidden,
3418
- D as findBlock,
3419
- vt as flattenBlocks,
3420
- St as linePath,
3421
- Mt as setsEqual,
3422
- si as staticCriterion,
3423
- Kr as todayCivilDate,
3424
- Fr as valueAtDate
3692
+ Y as BlockGraph,
3693
+ rr as BlockSelectionModel,
3694
+ ce as CategoryHidePanel,
3695
+ we as CollapsibleOptionGroup,
3696
+ H as GroupingCriterion,
3697
+ je as LineGraph,
3698
+ zi as SeriesBuilder,
3699
+ hi as SplitSelectionModel,
3700
+ de as SplitSelectionPanel,
3701
+ ei as addCivilDays,
3702
+ si as areaPath,
3703
+ Re as buildBlockLayout,
3704
+ oi as buildIntegerTicks,
3705
+ ii as buildLineChartModel,
3706
+ ct as categoryColorVariables,
3707
+ xi as categoryCounts,
3708
+ $ as civilDateToDay,
3709
+ ri as compareCivilDates,
3710
+ Ci as createBlockSelection,
3711
+ Ti as createSplitSelection,
3712
+ tr as criterionSnapshot,
3713
+ U as dayToCivilDate,
3714
+ Zt as deriveCategories,
3715
+ Ei as derivedCriterion,
3716
+ $i as filterByHidden,
3717
+ I as findBlock,
3718
+ Dt as flattenBlocks,
3719
+ Nt as linePath,
3720
+ Jt as setsEqual,
3721
+ Si as staticCriterion,
3722
+ ti as todayCivilDate,
3723
+ ni as valueAtDate
3425
3724
  };
3426
3725
  //# sourceMappingURL=index.js.map