@capillaryjs/capillary-viz 1.0.0 → 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 Rt = (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) => Rt(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { Emitter as O, DerivedEmitter as R, BaseEmitter as ze, FetchState as k, combineFetchStates as At } from "@capillaryjs/capillary";
5
- import { Component as Te, Placeholder as ge, Button as ae, css as X, OptionGroup as Ot, readDeclarativeRegions as jt, OptionGroupHeaderEnd as Lt, OptionsBox as Dt, Checkbox as le, GroupBox as be } from "@capillaryjs/capillary-ui";
6
- function Ze([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 B {
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 B {
27
30
  c(this, "visibilityEmitters", /* @__PURE__ */ new Map());
28
31
  c(this, "releaseCategoryDefaults");
29
32
  c(this, "disposed", !1);
30
- Z(e, "Criterion options"), this.key = K(e.key, "Criterion key"), this.label = Re(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 O(
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: Pt }
33
- ), this.visibleCategoriesEmitter = new R(
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 B {
42
45
  }
43
46
  visibility(e) {
44
47
  this.assertActive();
45
- const r = K(e, "Category key");
48
+ const r = F(e, "Category key");
46
49
  let i = this.visibilityEmitters.get(r);
47
- return i == null && (i = new Kt(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 B {
67
70
  }
68
71
  }
69
72
  applyFirstSeenDefaults(e) {
70
- Qe(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 B {
78
81
  if (this.disposed) throw new Error(`Criterion "${this.key}" is disposed`);
79
82
  }
80
83
  }
81
- function oi(t) {
82
- Z(t, "Static criterion options");
83
- const e = Je(t.categories, `${t.label} categories`), r = new O(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 B({ ...t, categories$: r, ownedCategories: r });
89
+ return new H({ ...t, categories$: r, ownedCategories: r });
87
90
  }
88
- function ai(t) {
89
- if (Z(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 R(
96
+ const e = new j(
94
97
  [t.source$],
95
- ([r]) => Mt(r, t),
98
+ ([r]) => Zt(r, t),
96
99
  { purpose: `${t.key} derived categories` }
97
100
  );
98
- return new B({
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 Mt(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 = we(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 Mt(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 $e({
124
+ return Le({
122
125
  key: o,
123
126
  ...l,
124
127
  generated: !0,
125
- predicate: (u) => we(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($e({
133
+ s.push(Le({
131
134
  key: o,
132
135
  ...a,
133
136
  generated: !0,
134
- predicate: (l) => we(e.extractKeys(l)).length === 0
137
+ predicate: (l) => ze(e.extractKeys(l)).length === 0
135
138
  }, "Derived unmatched category"));
136
139
  }
137
- return Je(s, "Derived categories");
140
+ return ut(s, "Derived categories");
138
141
  }
139
- function li(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 R(
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 ci(t, e) {
153
- if (pe(t, "categoryCounts items$"), !(e instanceof B))
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 R(
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 ci(t, e) {
164
167
  { purpose: `${e.key} unfiltered category counts` }
165
168
  );
166
169
  }
167
- function Pt(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 Kt extends ze {
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 Kt extends ze {
199
202
  });
200
203
  }
201
204
  }
202
- function we(t) {
203
- const r = (t == null ? [] : typeof t == "string" ? [t] : [...t]).map((i) => K(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 Je(t, e) {
207
- return Qe(t, e), Object.freeze(t.map((r) => $e(r, e)));
209
+ function ut(t, e) {
210
+ return dt(t, e), Object.freeze(t.map((r) => Le(r, e)));
208
211
  }
209
- function $e(t, e) {
210
- Z(t, e);
212
+ function Le(t, e) {
213
+ ie(t, e);
211
214
  const r = {
212
215
  ...t,
213
- key: K(t.key, `${e} key`),
214
- label: Re(t.label, `${e} label`),
215
- colors: et(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 && K(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 Qe(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
- Z(i, e);
226
- const n = K(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), Re(i.label, `${e} label`), et(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 B))
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 et(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 Z(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 K(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 Re(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 ve(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 = tt({
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 ve(t, e, r = {}) {
283
286
  });
284
287
  return Object.freeze({ valid: n.length === 0, root: o, issues: Object.freeze(n) });
285
288
  }
286
- function It(t) {
287
- if (!(t instanceof B))
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 It(t) {
293
296
  allowResorting: t.allowResorting
294
297
  });
295
298
  }
296
- function M(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 M(t, e) {
303
306
  }
304
307
  return r;
305
308
  }
306
- class Bt {
309
+ class rr {
307
310
  constructor(e, r, i = {}) {
308
311
  c(this, "layout$");
309
312
  c(this, "selectedPath$");
@@ -314,15 +317,15 @@ class Bt {
314
317
  c(this, "selectedItemsEmitter");
315
318
  c(this, "releases", []);
316
319
  c(this, "disposed", !1);
317
- this.options = i, this.layoutEmitter = new Ft(e, r, i), this.layout$ = this.layoutEmitter, this.selectedPath$ = new O(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: _t
321
- }), this.selectedBlockEmitter = new R(
323
+ equals: sr
324
+ }), this.selectedBlockEmitter = new j(
322
325
  [this.layout$, this.selectedPath$],
323
- ([n, s]) => M(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 R(
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 Bt {
333
336
  }
334
337
  select(e, r) {
335
338
  this.assertActive();
336
- const i = rt(e);
337
- if (M(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 Bt {
350
353
  }
351
354
  reconcileSelection() {
352
355
  const e = this.selectedPath$.get();
353
- e == null || M(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 ui(t, e, r = {}) {
360
- return new Bt(t, e, r);
362
+ function Ci(t, e, r = {}) {
363
+ return new rr(t, e, r);
361
364
  }
362
- class Ft extends ze {
365
+ class ir extends Pe {
363
366
  constructor(r, i, n) {
364
- super(ve([], [], 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, Be(r, "Block selection items$"), Be(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 Ft extends ze {
391
394
  const i = this.splits$.get(), n = [
392
395
  this.items$,
393
396
  this.splits$,
394
- ...i.map(({ categories$: f }) => f)
395
- ], s = n.map((f) => f.getFetchState()), o = n.map((f) => f.getError()).filter(Ht);
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 = ve(
401
+ a = Re(
399
402
  this.items$.get(),
400
- i.map(It),
403
+ i.map(tr),
401
404
  this.options
402
405
  );
403
- } catch (f) {
404
- l = f, a = ve([], [], 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 : At(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 tt(t) {
419
+ function ht(t) {
417
420
  const {
418
421
  items: e,
419
422
  splits: r,
@@ -424,79 +427,79 @@ function tt(t) {
424
427
  parentCount: a,
425
428
  totalShare: l,
426
429
  readabilityThreshold: u,
427
- issues: h,
428
- rootLabel: f
429
- } = t, v = r[i], g = v != null && n.length > 0 && l < u, m = v == null || g ? [] : qt({
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: v,
437
+ criterion: k,
435
438
  totalShare: l,
436
439
  readabilityThreshold: u,
437
- issues: h,
438
- rootLabel: f
439
- }), p = a === 0 ? 0 : e.length / a;
440
+ issues: d,
441
+ rootLabel: h
442
+ }), f = a === 0 ? 0 : e.length / a;
440
443
  return Object.freeze({
441
- key: Ut(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) ?? f,
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,
450
- share: p,
453
+ share: f,
451
454
  totalShare: l,
452
455
  depth: n.length - 1,
453
456
  items: e,
454
- children: Object.freeze(m),
457
+ children: Object.freeze(y),
455
458
  childOrientation: n.length % 2 === 0 ? "horizontal" : "vertical",
456
- childrenSuppressed: g
459
+ childrenSuppressed: b
457
460
  });
458
461
  }
459
- function qt(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((f) => f.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: f }) => f))
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 = rt([...i, {
486
+ const d = ft([...i, {
484
487
  criterionKey: r.key,
485
488
  categoryKey: l.key
486
- }]), f = e.length === 0 ? 0 : u.length / e.length;
487
- return tt({
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 * f
498
+ totalShare: t.totalShare * h
496
499
  });
497
500
  });
498
501
  }
499
- function rt(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 rt(t) {
506
509
  return Object.freeze({ ...e });
507
510
  }));
508
511
  }
509
- function _t(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 Ut(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 Ht(t) {
521
+ function ar(t) {
519
522
  return t != null;
520
523
  }
521
- function Be(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 Fe = "data-cap-structural-styles";
526
- let Vt = 1;
527
- class it {
528
- constructor(e = `runtime-${Vt++}`) {
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 it {
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 : nt(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[${Fe}="${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(Fe, 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 it {
569
572
  this.cssFragments.clear();
570
573
  }
571
574
  }
572
- function Yt() {
573
- return new it();
575
+ function cr() {
576
+ return new mt();
574
577
  }
575
- const Wt = new it("");
576
- function Gt(t) {
578
+ const ur = new mt("");
579
+ function dr(t) {
577
580
  return t.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
578
581
  }
579
- function nt(t, e) {
582
+ function yt(t, e) {
580
583
  let r = "", i = 0;
581
584
  for (; i < t.length; ) {
582
- const n = Jt(t, i);
585
+ const n = fr(t, i);
583
586
  if (n < 0) return r + t.slice(i);
584
- const s = Qt(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}{${nt(a, e)}}` : `${Xt(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 Xt(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 = Zt(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 Zt(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 Zt(t) {
609
612
  }
610
613
  return e.push(t.slice(r).trim()), e.filter(Boolean);
611
614
  }
612
- function Jt(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 = st(t, r);
619
+ r = gt(t, r);
617
620
  else if (i === "/" && t[r + 1] === "*")
618
- r = ot(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 Qt(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 = st(t, i);
632
+ i = gt(t, i);
630
633
  else if (n === "/" && t[i + 1] === "*")
631
- i = ot(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 Qt(t, e) {
636
639
  }
637
640
  return -1;
638
641
  }
639
- function st(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 ot(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 er = /* @__PURE__ */ new WeakSet(), tr = /* @__PURE__ */ new WeakSet();
651
- class at {
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 at {
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 (nr(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 at {
667
670
  return this.disposed;
668
671
  }
669
672
  has(e) {
670
- return this.assertActive(), qe(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(), qe(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 at {
693
696
  for (const r of [...this.creationOrder].reverse()) {
694
697
  const i = this.instances.get(r);
695
698
  try {
696
- const n = sr(i);
699
+ const n = kr(i);
697
700
  n != null && n.call(i);
698
701
  } catch (n) {
699
702
  e.push(n);
@@ -707,25 +710,25 @@ class at {
707
710
  if (this.disposed) throw new Error("ServiceScope has been disposed");
708
711
  }
709
712
  }
710
- function rr(t = []) {
711
- return new at(t);
713
+ function br(t = []) {
714
+ return new wt(t);
712
715
  }
713
- function ir(t) {
714
- return t != null && (typeof t == "object" || typeof t == "function") && er.has(t);
716
+ function wr(t) {
717
+ return t != null && (typeof t == "object" || typeof t == "function") && yr.has(t);
715
718
  }
716
- function qe(t) {
717
- if (!ir(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 nr(t) {
720
- if (t == null || typeof t != "object" && typeof t != "function" || !tr.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 sr(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 se = Object.freeze({
731
+ const pe = Object.freeze({
729
732
  breadcrumbLabel: "Breadcrumb",
730
733
  checkboxOptionLabel: "Option",
731
734
  checkboxStateLabel: (t, e) => `${t}: ${e}`,
@@ -762,7 +765,7 @@ const se = Object.freeze({
762
765
  tabLineLabel: "Sections",
763
766
  tableFilterColumnLabel: (t) => `Filter ${t}`,
764
767
  tableSortColumnLabel: (t) => `Sort ${t}`,
765
- themeOptionJavaLabel: "Java",
768
+ themeOptionCapillaryLabel: "Capillary",
766
769
  themeOptionMinimalLabel: "Minimal",
767
770
  themeOptionShinyLabel: "Shiny",
768
771
  toolbarLabel: "Actions",
@@ -770,7 +773,7 @@ const se = Object.freeze({
770
773
  treeViewLoadError: "Unable to load tree items",
771
774
  treeViewLoading: "Loading tree items…"
772
775
  });
773
- class lt {
776
+ class vt {
774
777
  constructor(e, r) {
775
778
  c(this, "locale");
776
779
  c(this, "messages");
@@ -780,30 +783,30 @@ class lt {
780
783
  return this.messages[e];
781
784
  }
782
785
  }
783
- const or = new lt(
786
+ const Sr = new vt(
784
787
  void 0,
785
- se
788
+ pe
786
789
  );
787
- function ar(t) {
788
- if (t == null) return or;
790
+ function Er(t) {
791
+ if (t == null) return Sr;
789
792
  if (typeof t != "object" || Array.isArray(t))
790
793
  throw new TypeError("Capillary UI localization must be an object");
791
- const e = lr(t.locale), r = t.messages;
794
+ const e = $r(t.locale), r = t.messages;
792
795
  if (r != null && (typeof r != "object" || Array.isArray(r)))
793
796
  throw new TypeError("Capillary UI localization messages must be an object");
794
- const i = { ...se };
797
+ const i = { ...pe };
795
798
  if (r != null)
796
- for (const n of Object.keys(se)) {
799
+ for (const n of Object.keys(pe)) {
797
800
  const s = r[n];
798
801
  if (s === void 0) continue;
799
- const o = se[n];
802
+ const o = pe[n];
800
803
  if (typeof s != typeof o)
801
804
  throw new TypeError(`Capillary UI localization message "${n}" has the wrong type`);
802
805
  Object.assign(i, { [n]: s });
803
806
  }
804
- return new lt(e, Object.freeze(i));
807
+ return new vt(e, Object.freeze(i));
805
808
  }
806
- function lr(t) {
809
+ function $r(t) {
807
810
  if (typeof t != "string" || t.trim() === "")
808
811
  throw new TypeError("Capillary UI localization locale must be a non-empty BCP 47 language tag");
809
812
  try {
@@ -812,7 +815,7 @@ function lr(t) {
812
815
  throw new RangeError(`Invalid Capillary UI localization locale: ${t}`, { cause: e });
813
816
  }
814
817
  }
815
- const cr = /* @__PURE__ */ new Set([
818
+ const xr = /* @__PURE__ */ new Set([
816
819
  "annotation-xml",
817
820
  "color-profile",
818
821
  "font-face",
@@ -822,27 +825,28 @@ const cr = /* @__PURE__ */ new Set([
822
825
  "font-face-name",
823
826
  "missing-glyph"
824
827
  ]);
825
- class ct {
826
- constructor(e = {}, r = Yt()) {
828
+ class kt {
829
+ constructor(e = {}, r = cr()) {
827
830
  c(this, "styleRegistry");
828
831
  c(this, "services");
829
832
  c(this, "router");
830
833
  c(this, "localization");
834
+ c(this, "diagnosticScope");
831
835
  c(this, "routedRoots", /* @__PURE__ */ new WeakSet());
832
836
  if (e == null || typeof e != "object" || Array.isArray(e))
833
837
  throw new TypeError("CapillaryUiRuntime options must be an object");
834
838
  if (Object.hasOwn(e, "elementNames"))
835
839
  throw new TypeError("CapillaryUiRuntime no longer supports configurable element names");
836
- if (this.styleRegistry = r, this.localization = ar(e.localization), this.services = e.services ?? rr(), !(this.services instanceof at))
840
+ if (this.styleRegistry = r, this.diagnosticScope = e.diagnosticScope ?? Ht, this.localization = Er(e.localization), this.services = e.services ?? br(), !(this.services instanceof wt))
837
841
  throw new TypeError("Capillary UI services must be a ServiceScope");
838
842
  if (this.router = e.router ?? null, this.router != null && (typeof this.router != "object" || typeof this.router.openScope != "function" || typeof this.router.completeScope != "function"))
839
843
  throw new TypeError("Capillary UI router must be a BrowserRouter");
840
844
  }
841
845
  /** Resolve a fixed one-hyphen public host name for a built-in component. */
842
846
  resolveElementName(e) {
843
- ut(e, "Capillary UI component host name");
847
+ St(e, "Capillary UI component host name");
844
848
  const r = `cap-${e.replaceAll("-", "")}`;
845
- return ur(r), r;
849
+ return Cr(r), r;
846
850
  }
847
851
  resolveHostSelector(e, r) {
848
852
  if (typeof e != "string") throw new TypeError("Host selector must be a string");
@@ -853,7 +857,7 @@ class ct {
853
857
  return e.replaceAll("&", this.resolveElementName(r));
854
858
  }
855
859
  create(e, ...r) {
856
- const i = new e(...r);
860
+ const i = m.withScope(this.diagnosticScope, () => new e(...r));
857
861
  return i._setRuntime(this), i;
858
862
  }
859
863
  mount(e, r, i = null) {
@@ -876,16 +880,16 @@ class ct {
876
880
  return this.styleRegistry.injectAll(e);
877
881
  }
878
882
  }
879
- const _e = new ct({}, Wt);
880
- function ut(t, e) {
883
+ const Qe = new kt({}, ur);
884
+ function St(t, e) {
881
885
  if (typeof t != "string" || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(t))
882
886
  throw new TypeError(`${e} must be a lowercase kebab-case name`);
883
887
  }
884
- function ur(t) {
885
- if (ut(t, "Capillary UI element name"), !t.includes("-") || cr.has(t))
888
+ function Cr(t) {
889
+ if (St(t, "Capillary UI element name"), !t.includes("-") || xr.has(t))
886
890
  throw new TypeError(`Capillary UI element name must be a non-reserved name containing a hyphen: ${t}`);
887
891
  }
888
- const W = Symbol.for("@capillaryjs/capillary-ui.Fragment"), hr = /* @__PURE__ */ new WeakSet(), dr = /* @__PURE__ */ new Set([
892
+ const ee = Symbol.for("@capillaryjs/capillary-ui.Fragment"), Tr = /* @__PURE__ */ new WeakSet(), zr = /* @__PURE__ */ new Set([
889
893
  "allowFullScreen",
890
894
  "async",
891
895
  "autoFocus",
@@ -909,7 +913,7 @@ const W = Symbol.for("@capillaryjs/capillary-ui.Fragment"), hr = /* @__PURE__ */
909
913
  "required",
910
914
  "reversed",
911
915
  "selected"
912
- ]), pr = /* @__PURE__ */ new Set([
916
+ ]), Rr = /* @__PURE__ */ new Set([
913
917
  "checked",
914
918
  "defaultChecked",
915
919
  "defaultValue",
@@ -923,8 +927,12 @@ const W = Symbol.for("@capillaryjs/capillary-ui.Fragment"), hr = /* @__PURE__ */
923
927
  "selectedIndex",
924
928
  "tabIndex",
925
929
  "value"
926
- ]), Ue = "data-cap";
927
- 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) {
928
936
  const i = e ?? {};
929
937
  if (typeof i != "object" || Array.isArray(i))
930
938
  throw new TypeError("VNode props must be an object or null");
@@ -938,14 +946,14 @@ function ce(t, e = null, ...r) {
938
946
  key: s,
939
947
  props: {
940
948
  ...o,
941
- children: ht([n, r])
949
+ children: Et([n, r])
942
950
  }
943
951
  };
944
952
  }
945
- function fr(t, ...e) {
953
+ function Ar(t, ...e) {
946
954
  return t.reduce((r, i, n) => r + i + String(e[n] ?? ""), "");
947
955
  }
948
- const E = class E {
956
+ const x = class x {
949
957
  constructor(e = {}) {
950
958
  c(this, "props");
951
959
  c(this, "dom", null);
@@ -965,7 +973,7 @@ const E = class E {
965
973
  c(this, "renderReadSubscriptions", /* @__PURE__ */ new Map());
966
974
  c(this, "collectingRenderReads", null);
967
975
  /** @internal */
968
- c(this, "_runtime", _e);
976
+ c(this, "_runtime", Qe);
969
977
  /** @internal Route lineage inherited by nested routed components. */
970
978
  c(this, "_routeContext", null);
971
979
  /** JSX component for this instance's runtime-configured custom host. */
@@ -979,14 +987,14 @@ const E = class E {
979
987
  }
980
988
  static new(...e) {
981
989
  const r = new this(...e);
982
- if (!(r instanceof E))
990
+ if (!(r instanceof x))
983
991
  throw new TypeError("Component.new() requires a Component constructor");
984
992
  return r.mount();
985
993
  }
986
- static registerStyles(e = _e, r = /* @__PURE__ */ new Set()) {
994
+ static registerStyles(e = Qe, r = /* @__PURE__ */ new Set()) {
987
995
  if (r.has(this)) return;
988
996
  r.add(this);
989
- const i = this.hostName ?? null, n = Or(this);
997
+ const i = this.hostName ?? null, n = Wr(this);
990
998
  for (const s of n)
991
999
  Object.hasOwn(s, "css") && s.css && (i == null ? e.styleRegistry.registerCSS(s.css) : e.styleRegistry.registerHostCSS(
992
1000
  s.css,
@@ -997,6 +1005,24 @@ const E = class E {
997
1005
  for (const o of s.dependencies ?? [])
998
1006
  o.registerStyles(e, r);
999
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
+ }
1000
1026
  /** One-time setup hook. Constructors must not subscribe or render. */
1001
1027
  initialize() {
1002
1028
  }
@@ -1012,8 +1038,8 @@ const E = class E {
1012
1038
  class: s,
1013
1039
  className: o,
1014
1040
  ...a
1015
- } = e ?? {}, l = o ?? s, u = this.props.island === !0 ? jr(l, "island") : l;
1016
- 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), {
1017
1043
  ...a,
1018
1044
  ...u == null ? {} : { className: u },
1019
1045
  "data-cap-component": n,
@@ -1023,7 +1049,7 @@ const E = class E {
1023
1049
  /** @internal Assign an immutable application runtime before initialization or mounting. */
1024
1050
  _setRuntime(e) {
1025
1051
  var r;
1026
- if (!(e instanceof ct))
1052
+ if (!(e instanceof kt))
1027
1053
  throw new TypeError("Component runtime must be a CapillaryUiRuntime");
1028
1054
  if (e === this._runtime) return this;
1029
1055
  if (this.initialized || this.mounted || this._rendered != null)
@@ -1050,39 +1076,66 @@ const E = class E {
1050
1076
  if (this.destroyed) throw new Error("Cannot mount a destroyed component");
1051
1077
  this.validateIslandAncestry(this.props);
1052
1078
  let i = !1;
1053
- return this.initialized || (this.validateRequiredServices(), this.initialized = !0, this.initialize()), this.mounted || (this.mounted = !0, this.update(), i = !0), e != null && (Ar(e), Le(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;
1054
1080
  }
1055
1081
  attachTo(e) {
1056
1082
  return this.mount(e), this;
1057
1083
  }
1058
- update(e) {
1084
+ update(e, r = e instanceof Ge ? "dependency" : "explicit") {
1059
1085
  if (this.destroyed) return this;
1060
1086
  if (!this.mounted) return this.mount();
1061
1087
  if (this.updating)
1062
1088
  return this.updateRequested = !0, this;
1063
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;
1064
1098
  try {
1065
- do {
1066
- this.updateRequested = !1;
1067
- const r = /* @__PURE__ */ new Set();
1068
- this.collectingRenderReads = r;
1069
- let i;
1070
- try {
1071
- i = V(this.render());
1072
- } finally {
1073
- this.collectingRenderReads = null;
1074
- }
1075
- this._rendered = Ae(this._rendered, i, this), this.dom = yt(this._rendered), this.reconcileRenderReads(r), this.afterUpdate(this.dom);
1076
- } 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;
1077
1126
  } finally {
1078
- this.updating = !1;
1127
+ C = n, this.updating = !1;
1079
1128
  }
1080
1129
  return this;
1081
1130
  }
1082
1131
  setProps(e) {
1132
+ var r, i;
1083
1133
  if (e == null || typeof e != "object" || Array.isArray(e))
1084
1134
  throw new TypeError(`${this.constructor.name} props must be an object`);
1085
- 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;
1086
1139
  }
1087
1140
  afterMount(e) {
1088
1141
  }
@@ -1095,7 +1148,7 @@ const E = class E {
1095
1148
  if (this.watched.has(r)) continue;
1096
1149
  const i = r.subscribe(({ event: n }) => {
1097
1150
  this.mounted && !this.destroyed && this.update(n);
1098
- }, { emitCurrent: !1 });
1151
+ }, { emitCurrent: !1, diagnosticTarget: this });
1099
1152
  this.watched.set(r, i), this.onCleanup(() => {
1100
1153
  i(), this.watched.delete(r);
1101
1154
  });
@@ -1150,21 +1203,67 @@ const E = class E {
1150
1203
  listen(e, r, i, n) {
1151
1204
  if (e == null || typeof e.addEventListener != "function")
1152
1205
  throw new TypeError("listen target must be an EventTarget");
1153
- const s = i;
1154
- 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;
1155
1254
  }
1156
1255
  registerChild(e) {
1157
- if (!(e instanceof E))
1256
+ if (!(e instanceof x))
1158
1257
  throw new TypeError("registerChild requires a Component");
1159
- return this._childComponents.add(e), e;
1258
+ return this._childComponents.add(e), m.active && m.inspect(this), e;
1160
1259
  }
1161
1260
  destroy() {
1162
1261
  if (!this.destroyed) {
1163
- this.destroyed = !0, this.mounted = !1;
1262
+ this.destroyed = !0, this.mounted = !1, m.dispose(this);
1164
1263
  for (const e of [...this.cleanupFunctions]) e();
1165
1264
  this.cleanupFunctions.clear(), this.watched.clear();
1166
1265
  for (const e of this.renderReadSubscriptions.values()) e();
1167
- this.renderReadSubscriptions.clear(), this.collectingRenderReads = null, this._rendered && A(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();
1168
1267
  }
1169
1268
  }
1170
1269
  validateRequiredServices() {
@@ -1174,25 +1273,25 @@ const E = class E {
1174
1273
  throw new Error(`${e.name} requires unregistered service "${r.name}"`);
1175
1274
  }
1176
1275
  validateIslandAncestry(e) {
1177
- if (!Se(e)) return;
1276
+ if (!Oe(e)) return;
1178
1277
  if (this.hasIslandDescendant())
1179
1278
  throw new Error("An island component cannot contain another island");
1180
1279
  let r = this._parentComponent;
1181
1280
  for (; r != null; ) {
1182
- if (Se(r.props))
1281
+ if (Oe(r.props))
1183
1282
  throw new Error("An island component cannot be nested inside another island");
1184
1283
  r = r._parentComponent;
1185
1284
  }
1186
1285
  }
1187
1286
  hasIslandDescendant() {
1188
1287
  for (const e of this._childComponents)
1189
- if (Se(e.props) || e.hasIslandDescendant()) return !0;
1288
+ if (Oe(e.props) || e.hasIslandDescendant()) return !0;
1190
1289
  return !1;
1191
1290
  }
1192
1291
  onDestroy() {
1193
1292
  }
1194
1293
  trackRenderRead(e) {
1195
- if (vt(e, "Component.read"), this.collectingRenderReads == null)
1294
+ if (Mt(e, "Component.read"), this.collectingRenderReads == null)
1196
1295
  throw new Error("Component.read() and snapshot() may only be called during render()");
1197
1296
  this.collectingRenderReads.add(e);
1198
1297
  }
@@ -1203,13 +1302,13 @@ const E = class E {
1203
1302
  if (this.watched.has(r) || this.renderReadSubscriptions.has(r)) continue;
1204
1303
  const i = r.subscribe(({ event: n }) => {
1205
1304
  this.mounted && !this.destroyed && this.update(n);
1206
- }, { emitCurrent: !1 });
1305
+ }, { emitCurrent: !1, diagnosticTarget: this });
1207
1306
  this.renderReadSubscriptions.set(r, i);
1208
1307
  }
1209
1308
  }
1210
1309
  };
1211
- c(E, "dependencies", []), c(E, "requiredServices", []), /** Component `live()` bindings are opt-in; subclasses declare their allowlist. */
1212
- c(E, "liveProps", []), c(E, "css", fr`
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`
1213
1312
  .cap-fill-horizontal,
1214
1313
  .cap-fill-vertical {
1215
1314
  box-sizing: border-box;
@@ -1240,6 +1339,7 @@ c(E, "liveProps", []), c(E, "css", fr`
1240
1339
  align-items: stretch;
1241
1340
  min-inline-size: 0;
1242
1341
  min-block-size: 0;
1342
+ gap: calc(var(--_cap-island-flow, 0) * var(--island-gap, 0px));
1243
1343
  }
1244
1344
 
1245
1345
  .cap-layout-horizontal {
@@ -1261,11 +1361,55 @@ c(E, "liveProps", []), c(E, "css", fr`
1261
1361
  }
1262
1362
 
1263
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);
1264
1370
  overflow: auto;
1265
1371
  min-inline-size: 0;
1266
1372
  min-block-size: 0;
1267
1373
  }
1268
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
+
1269
1413
  .colored {
1270
1414
  --colored-base-bg:
1271
1415
  linear-gradient(
@@ -1283,10 +1427,12 @@ c(E, "liveProps", []), c(E, "css", fr`
1283
1427
 
1284
1428
  .app-footer.island,
1285
1429
  .island {
1430
+ --_cap-island-flow: 0;
1431
+ --_cap-island-separator-background: initial;
1286
1432
  box-sizing: border-box;
1287
1433
  min-width: 0;
1288
1434
  min-height: 0;
1289
- margin: var(--island-margin);
1435
+ margin: var(--_cap-island-margin, var(--island-margin));
1290
1436
  padding: var(--island-padding);
1291
1437
  background: var(--island-background);
1292
1438
  border: var(--island-border);
@@ -1296,26 +1442,28 @@ c(E, "liveProps", []), c(E, "css", fr`
1296
1442
 
1297
1443
  .cap-fill-horizontal.island,
1298
1444
  .cap-fill-horizontal .island {
1299
- max-width: calc(100% - (2 * var(--island-margin)));
1445
+ max-width: calc(100% - (2 * var(--_cap-island-margin, var(--island-margin))));
1300
1446
  overflow-x: auto;
1301
1447
  }
1302
1448
 
1303
1449
  .cap-fill-vertical.island,
1304
1450
  .cap-fill-vertical .island {
1305
- max-height: calc(100% - (2 * var(--island-margin)));
1451
+ max-height: calc(100% - (2 * var(--_cap-island-margin, var(--island-margin))));
1306
1452
  overflow-y: auto;
1307
1453
  }
1308
1454
 
1309
1455
  label[data-cap] {
1310
1456
  user-select: none;
1311
1457
  }
1312
- `), c(E, "hostName", null), /** Optional host-level data surface marker for parent composition. */
1313
- c(E, "dataSurface", null);
1314
- let $ = E;
1315
- function V(t) {
1316
- return Array.isArray(t) ? ce(W, null, t) : t == null || typeof t == "boolean" ? ce(W) : 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;
1317
1465
  }
1318
- function ht(t) {
1466
+ function Et(t) {
1319
1467
  const e = [], r = (i) => {
1320
1468
  if (Array.isArray(i))
1321
1469
  for (const n of i) r(n);
@@ -1323,7 +1471,7 @@ function ht(t) {
1323
1471
  };
1324
1472
  return r(t), e;
1325
1473
  }
1326
- function G(t, e) {
1474
+ function te(t, e) {
1327
1475
  if (typeof t == "string" || typeof t == "number")
1328
1476
  return {
1329
1477
  kind: "text",
@@ -1332,15 +1480,15 @@ function G(t, e) {
1332
1480
  node: document.createTextNode(String(t)),
1333
1481
  owner: e
1334
1482
  };
1335
- if (fe(t)) {
1483
+ if (Se(t)) {
1336
1484
  const s = document.createComment("cap-emitter-start"), o = document.createComment("cap-emitter-end"), a = t.get();
1337
1485
  if (Object.is(a, t))
1338
1486
  throw new TypeError("A Capillary UI emitter child cannot render itself");
1339
1487
  const l = document.createDocumentFragment();
1340
- l.append(s, o);
1341
- const u = G(V(a), e);
1342
- Le(l, u, o);
1343
- const h = {
1488
+ l.append(s, o), E(), E();
1489
+ const u = te(J(a), e);
1490
+ Fe(l, u, o);
1491
+ const d = {
1344
1492
  kind: "emitter",
1345
1493
  key: null,
1346
1494
  source: t,
@@ -1351,16 +1499,16 @@ function G(t, e) {
1351
1499
  },
1352
1500
  owner: e
1353
1501
  };
1354
- return h.unsubscribe = t.subscribe(({ value: f }) => {
1355
- if (Object.is(f, t))
1502
+ return d.unsubscribe = ke(t, d, e, "reactive child", (h) => {
1503
+ if (Object.is(h, t))
1356
1504
  throw new TypeError("A Capillary UI emitter child cannot render itself");
1357
- h.child = Ae(h.child, V(f), e);
1358
- }, { emitCurrent: !1 }), h;
1505
+ d.child = Ie(d.child, J(h), e);
1506
+ }), d;
1359
1507
  }
1360
- if (t instanceof $)
1508
+ if (t instanceof T)
1361
1509
  return t._setRuntime(e._runtime), t._setRouteContext(e._routeContextForChildren()), t._setParentComponent(e), t.mount(), e.registerChild(t), {
1362
1510
  kind: "component",
1363
- key: gt(t.props),
1511
+ key: Ot(t.props),
1364
1512
  type: t.constructor,
1365
1513
  instance: t,
1366
1514
  prebuilt: !0,
@@ -1368,10 +1516,10 @@ function G(t, e) {
1368
1516
  liveProps: /* @__PURE__ */ new Map(),
1369
1517
  owner: e
1370
1518
  };
1371
- if (!T(t))
1372
- throw new TypeError(`Invalid Capillary UI child: ${Ye(t)}`);
1519
+ if (!O(t))
1520
+ throw new TypeError(`Invalid Capillary UI child: ${st(t)}`);
1373
1521
  const { type: r, key: i = null, props: n } = t;
1374
- if (r === W) {
1522
+ if (r === ee) {
1375
1523
  const s = document.createComment("cap-fragment-start"), o = document.createComment("cap-fragment-end"), a = {
1376
1524
  kind: "fragment",
1377
1525
  key: i,
@@ -1381,7 +1529,7 @@ function G(t, e) {
1381
1529
  children: [],
1382
1530
  owner: e
1383
1531
  }, l = document.createDocumentFragment();
1384
- return l.append(s, o), a.children = ue(
1532
+ return l.append(s, o), E(), E(), a.children = ye(
1385
1533
  l,
1386
1534
  [],
1387
1535
  n.children,
@@ -1404,12 +1552,15 @@ function G(t, e) {
1404
1552
  children: [],
1405
1553
  owner: e
1406
1554
  };
1407
- return mt(o, n), o.children = ue(s, [], n.children, e), o;
1555
+ return zt(o, n), o.children = ye(s, [], n.children, e), o;
1408
1556
  }
1409
- if (wt(r)) {
1557
+ if (Lt(r)) {
1410
1558
  const s = n;
1411
- ft(r, s);
1412
- const o = He(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
+ );
1413
1564
  a._setRuntime(e._runtime), a._setRouteContext(e._routeContextForChildren()), a._setParentComponent(e);
1414
1565
  const l = {
1415
1566
  kind: "component",
@@ -1421,190 +1572,220 @@ function G(t, e) {
1421
1572
  liveProps: /* @__PURE__ */ new Map(),
1422
1573
  owner: e
1423
1574
  };
1424
- return pt(l, s), a.mount(), e.registerChild(a), l;
1575
+ return xt(l, s), a.mount(), e.registerChild(a), l;
1425
1576
  }
1426
1577
  if (typeof r == "function") {
1427
- const s = r, o = n, a = He(o), l = V(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 = {
1428
1586
  kind: "function",
1429
1587
  key: i,
1430
1588
  type: s,
1431
1589
  props: a,
1432
1590
  sourceProps: o,
1433
1591
  liveProps: /* @__PURE__ */ new Map(),
1434
- child: G(l, e),
1592
+ child: u,
1593
+ diagnosticSubject: l,
1435
1594
  owner: e
1436
1595
  };
1437
- return yr(u), u;
1596
+ return jr(d), d;
1438
1597
  }
1439
- throw new TypeError(`Unsupported vnode type: ${Ye(r)}`);
1598
+ throw new TypeError(`Unsupported vnode type: ${st(r)}`);
1440
1599
  }
1441
- function Ae(t, e, r) {
1442
- if (t == null) return G(e, r);
1443
- if (bt(t, e)) return dt(t, e, r);
1444
- const i = G(e, r), n = yt(t), s = (n == null ? void 0 : n.parentNode) ?? null;
1445
- return s && Le(s, i, n), A(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;
1446
1605
  }
1447
- function dt(t, e, r) {
1448
- 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 $ || T(e) && mr(t, e.props), t) : T(e) ? t.kind === "function" ? (gr(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(
1449
1608
  t.start.parentNode,
1450
1609
  t.children,
1451
1610
  e.props.children,
1452
1611
  r,
1453
1612
  t.end,
1454
1613
  t.start
1455
- ), t) : (mt(t, e.props), t.children = ue(
1614
+ ), t) : (zt(t, e.props), t.children = ye(
1456
1615
  t.node,
1457
1616
  t.children,
1458
1617
  e.props.children,
1459
1618
  r
1460
1619
  ), t) : t;
1461
1620
  }
1462
- function He(t) {
1621
+ function tt(t) {
1463
1622
  return Object.fromEntries(Object.entries(t).map(([e, r]) => [
1464
1623
  e,
1465
- N(r) ? r.emitter.get() : r
1624
+ q(r) ? r.emitter.get() : r
1466
1625
  ]));
1467
1626
  }
1468
- function pt(t, e) {
1469
- Oe(t.liveProps, e, (r, i) => {
1627
+ function xt(t, e) {
1628
+ _e(t.liveProps, e, t.instance, _(t.instance), (r, i) => {
1470
1629
  t.props = { ...t.props, [r]: i }, t.instance.setProps(t.props);
1471
- }), t.props = je(t.liveProps, e), t.instance.setProps(t.props);
1630
+ }), t.props = Be(t.liveProps, e), t.instance.setProps(t.props);
1472
1631
  }
1473
- function mr(t, e) {
1474
- ft(t.type, e), pt(t, e);
1632
+ function Or(t, e) {
1633
+ Ct(t.type, e), xt(t, e);
1475
1634
  }
1476
- function ft(t, e) {
1635
+ function Ct(t, e) {
1477
1636
  const r = Reflect.get(t, "liveProps");
1478
1637
  if (r == null) return;
1479
1638
  if (!Array.isArray(r) || r.some((n) => typeof n != "string"))
1480
1639
  throw new TypeError(`${t.name || "Component"}.liveProps must be an array`);
1481
1640
  const i = new Set(r);
1482
1641
  for (const [n, s] of Object.entries(e))
1483
- if (N(s) && !i.has(n))
1642
+ if (q(s) && !i.has(n))
1484
1643
  throw new TypeError(
1485
1644
  `${t.name || "Component"} prop "${n}" does not support live()`
1486
1645
  );
1487
1646
  }
1488
- function yr(t) {
1489
- Oe(t.liveProps, t.sourceProps, (e, r) => {
1490
- t.props = { ...t.props, [e]: r }, Ce(t);
1491
- }), t.props = je(t.liveProps, t.sourceProps);
1492
- }
1493
- function gr(t, e) {
1494
- t.sourceProps = e, Oe(t.liveProps, e, (r, i) => {
1495
- t.props = { ...t.props, [r]: i }, Ce(t);
1496
- }), t.props = je(t.liveProps, e), Ce(t);
1497
- }
1498
- function Ce(t) {
1499
- const e = V(t.type(t.props));
1500
- t.child = Ae(t.child, e, t.owner);
1501
- }
1502
- function Oe(t, e, r) {
1503
- for (const [i, n] of t) {
1504
- const s = e[i];
1505
- N(s) && s.emitter === n.source || (n.unsubscribe(), t.delete(i));
1506
- }
1507
- for (const [i, n] of Object.entries(e)) {
1508
- if (!N(n) || t.has(i)) continue;
1509
- const s = {
1510
- source: n.emitter,
1511
- 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(),
1512
1686
  unsubscribe: () => {
1513
1687
  }
1514
1688
  };
1515
- s.unsubscribe = n.emitter.subscribe(({ value: o }) => {
1516
- t.get(i) === s && (s.value = o, r(i, o));
1517
- }, { 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);
1518
1692
  }
1519
1693
  }
1520
- function je(t, e) {
1694
+ function Be(t, e) {
1521
1695
  return Object.fromEntries(Object.entries(e).map(([r, i]) => {
1522
1696
  var n;
1523
1697
  return [
1524
1698
  r,
1525
- 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
1526
1700
  ];
1527
1701
  }));
1528
1702
  }
1529
- function ue(t, e, r, i, n = null, s = null) {
1703
+ function ye(t, e, r, i, n = null, s = null) {
1530
1704
  if (t == null) throw new Error("Cannot patch a detached fragment range");
1531
- const o = ht(r), a = /* @__PURE__ */ new Map(), l = [];
1532
- for (const m of e)
1533
- m.key == null ? l.push(m) : a.has(m.key) || a.set(m.key, m);
1534
- const u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), f = [];
1535
- let v = 0;
1536
- for (const m of o) {
1537
- const p = H(m);
1538
- if (p != null) {
1539
- if (u.has(p)) throw new Error(`Duplicate sibling key: ${String(p)}`);
1540
- u.add(p);
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);
1712
+ if (f != null) {
1713
+ if (u.has(f)) throw new Error(`Duplicate sibling key: ${String(f)}`);
1714
+ u.add(f);
1541
1715
  }
1542
- const C = p == null ? l[v++] : a.get(p);
1543
- C && bt(C, m) ? (h.add(C), f.push(dt(C, m, i))) : f.push(G(m, i));
1544
- }
1545
- for (const m of e)
1546
- h.has(m) || A(m, !0);
1547
- let g = s ? s.nextSibling : t.firstChild;
1548
- for (const m of f)
1549
- for (const p of j(m))
1550
- p === g ? g = g.nextSibling : (t.insertBefore(p, g ?? n), g = p.nextSibling);
1551
- return f;
1552
- }
1553
- function mt(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) {
1554
1728
  const r = Object.fromEntries(Object.entries(e).filter(
1555
- ([s]) => s !== "children" && oe(s) !== Ue
1729
+ ([s]) => s !== "children" && X(s) !== et
1556
1730
  )), i = t.props, n = /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(r)]);
1557
1731
  for (const s of ["value", "checked"])
1558
1732
  if (Object.hasOwn(r, s) && Object.hasOwn(r, `bind:${s}`))
1559
1733
  throw new Error(`${s} and bind:${s} cannot be used together`);
1560
1734
  for (const s of n) {
1561
1735
  const o = i[s], a = r[s];
1562
- if (xr(s))
1563
- wr(t, s, a);
1736
+ if (Fr(s))
1737
+ Dr(t, s, a);
1564
1738
  else if (s === "ref")
1565
- o !== a && kr(t, a);
1566
- else if (Cr(s))
1567
- vr(t, s, a);
1568
- else if (N(a))
1569
- br(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);
1570
1744
  else {
1571
1745
  const l = t.liveProps.get(s);
1572
1746
  l && (l.unsubscribe(), t.liveProps.delete(s));
1573
1747
  const u = (l == null ? void 0 : l.value) ?? o;
1574
- Object.is(u, a) || P(t.node, s, u, a);
1748
+ Object.is(u, a) || B(t.node, s, u, a);
1575
1749
  }
1576
1750
  }
1577
- t.node.setAttribute(Ue, ""), t.props = { ...r };
1751
+ L(t.node, et, ""), t.props = { ...r };
1578
1752
  }
1579
- function br(t, e, r) {
1753
+ function Mr(t, e, r) {
1580
1754
  const i = t.liveProps.get(e);
1581
1755
  if ((i == null ? void 0 : i.source) === r.emitter) return;
1582
1756
  i == null || i.unsubscribe();
1583
1757
  const n = r.emitter.get();
1584
- P(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);
1585
1759
  const s = {
1586
1760
  source: r.emitter,
1587
1761
  value: n,
1588
1762
  unsubscribe: () => {
1589
1763
  }
1590
1764
  };
1591
- s.unsubscribe = r.emitter.subscribe(({ value: o }) => {
1765
+ s.unsubscribe = ke(r.emitter, s, t.owner, `${t.type}.${e}`, (o) => {
1592
1766
  const a = s.value;
1593
- s.value = o, Object.is(a, o) || P(t.node, e, a, o);
1594
- }, { 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);
1595
1769
  }
1596
- function wr(t, e, r) {
1770
+ function Dr(t, e, r) {
1597
1771
  const i = e.slice(5), n = t.nativeBindings.get(e);
1598
1772
  if (r == null) {
1599
- n && (n.unsubscribe(), t.node.removeEventListener(n.eventName, n.listener), t.nativeBindings.delete(e), P(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));
1600
1774
  return;
1601
1775
  }
1602
- if (zr(r, e), (n == null ? void 0 : n.source) === r) return;
1603
- n && (n.unsubscribe(), t.node.removeEventListener(n.eventName, n.listener)), Tr(t.node, i);
1604
- const s = Rr(t.node, i), o = r.get();
1605
- P(t.node, i, n == null ? void 0 : n.value, o);
1606
- const a = () => {
1607
- 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
+ );
1608
1789
  }, l = {
1609
1790
  source: r,
1610
1791
  value: o,
@@ -1613,101 +1794,187 @@ function wr(t, e, r) {
1613
1794
  unsubscribe: () => {
1614
1795
  }
1615
1796
  };
1616
- l.unsubscribe = r.subscribe(({ value: u }) => {
1617
- const h = l.value;
1618
- l.value = u, Object.is(h, u) || P(t.node, i, h, u);
1619
- }, { emitCurrent: !1 }), t.node.addEventListener(s, a), t.nativeBindings.set(e, l);
1620
- }
1621
- function vr(t, e, r) {
1622
- const i = e.slice(2).toLowerCase(), n = t.listeners.get(e);
1623
- 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")
1624
1805
  throw new TypeError(`${e} must be a function or null`);
1625
- if (typeof r == "function" && n !== r) {
1626
- const s = r;
1627
- 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);
1628
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
+ };
1629
1881
  }
1630
- function kr(t, e) {
1631
- if (xe(t.ref, null), e != null && typeof e != "function" && typeof e != "object")
1882
+ function _(t) {
1883
+ return t.diagnosticLabel;
1884
+ }
1885
+ function Nr(t, e) {
1886
+ if (De(t.ref, null), e != null && typeof e != "function" && typeof e != "object")
1632
1887
  throw new TypeError("ref must be a function, object, or null");
1633
- t.ref = e, xe(t.ref, t.node);
1888
+ t.ref = e, De(t.ref, t.node);
1634
1889
  }
1635
- function P(t, e, r, i) {
1890
+ function B(t, e, r, i) {
1636
1891
  if (e === "class" || e === "className") {
1637
- ke(t, "class", i);
1892
+ L(t, "class", i);
1638
1893
  return;
1639
1894
  }
1640
1895
  if (e === "for" || e === "htmlFor") {
1641
- ke(t, "for", i);
1896
+ L(t, "for", i);
1642
1897
  return;
1643
1898
  }
1644
1899
  if (e === "dataset") {
1645
- Sr(t, r, i);
1900
+ Kr(t, r, i);
1646
1901
  return;
1647
1902
  }
1648
1903
  if (e === "style") {
1649
- Er(t, r, i);
1904
+ Ir(t, r, i);
1650
1905
  return;
1651
1906
  }
1652
1907
  if (e === "dangerouslySetInnerHTML")
1653
1908
  throw new Error("dangerouslySetInnerHTML is not supported");
1654
- const n = $r(e);
1655
- if (dr.has(n)) {
1909
+ const n = _r(e);
1910
+ if (zr.has(n)) {
1656
1911
  const s = !!i;
1657
- n in t && Reflect.set(t, n, s), t.toggleAttribute(oe(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);
1658
1917
  return;
1659
1918
  }
1660
- if (pr.has(n) && n in t) {
1919
+ if (Rr.has(n) && n in t) {
1661
1920
  const s = i ?? (n === "value" ? "" : !1);
1662
- Object.is(Reflect.get(t, n), s) || Reflect.set(t, n, s), i == null && t.removeAttribute(oe(e));
1921
+ Object.is(Reflect.get(t, n), s) || (Reflect.set(t, n, s), E()), i == null && L(t, X(e), null);
1663
1922
  return;
1664
1923
  }
1665
- ke(t, oe(e), i);
1924
+ L(t, X(e), i);
1666
1925
  }
1667
- function Sr(t, e, r) {
1668
- 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");
1669
1928
  for (const s of /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)])) {
1670
1929
  const o = n[s];
1671
- 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());
1672
1931
  }
1673
1932
  }
1674
- function Er(t, e, r) {
1933
+ function Ir(t, e, r) {
1675
1934
  if (typeof r == "string") {
1676
- t.style.cssText = r;
1935
+ t.style.cssText !== r && (t.style.cssText = r, E());
1677
1936
  return;
1678
1937
  }
1679
- const i = typeof e == "string" ? {} : he(e, "style"), n = he(r, "style");
1680
- 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());
1681
1940
  for (const s of /* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)])) {
1682
1941
  const o = n[s];
1683
- 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();
1684
1950
  }
1685
1951
  }
1686
- function he(t, e) {
1952
+ function be(t, e) {
1687
1953
  if (t == null) return {};
1688
1954
  if (typeof t != "object" || Array.isArray(t))
1689
1955
  throw new TypeError(`${e} must be an object or null`);
1690
1956
  return t;
1691
1957
  }
1692
- function ke(t, e, r) {
1693
- 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());
1694
1961
  }
1695
- function $r(t) {
1962
+ function _r(t) {
1696
1963
  return t === "readonly" ? "readOnly" : t === "autofocus" ? "autoFocus" : t;
1697
1964
  }
1698
- function oe(t) {
1699
- 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) ? Ve(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()}`);
1700
1967
  }
1701
- function Ve(t) {
1968
+ function nt(t) {
1702
1969
  return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
1703
1970
  }
1704
- function xe(t, e) {
1971
+ function De(t, e) {
1705
1972
  t != null && (typeof t == "function" ? t(e) : t.current = e);
1706
1973
  }
1707
- function A(t, e) {
1974
+ function M(t, e) {
1708
1975
  if (t.kind === "emitter") {
1709
- if (t.unsubscribe(), A(t.child, !1), e)
1710
- for (const r of j(t)) r.remove();
1976
+ if (t.unsubscribe(), M(t.child, !1), e)
1977
+ for (const r of P(t)) le(r);
1711
1978
  return;
1712
1979
  }
1713
1980
  if (t.kind === "component") {
@@ -1717,11 +1984,11 @@ function A(t, e) {
1717
1984
  }
1718
1985
  if (t.kind === "function") {
1719
1986
  for (const r of t.liveProps.values()) r.unsubscribe();
1720
- t.liveProps.clear(), A(t.child, e);
1987
+ t.liveProps.clear(), t.diagnosticSubject && m.dispose(t.diagnosticSubject), M(t.child, e);
1721
1988
  return;
1722
1989
  }
1723
1990
  if (t.kind === "element") {
1724
- xe(t.ref, null);
1991
+ De(t.ref, null);
1725
1992
  for (const [r, i] of t.listeners)
1726
1993
  t.node.removeEventListener(r.slice(2).toLowerCase(), i);
1727
1994
  t.listeners.clear();
@@ -1730,149 +1997,153 @@ function A(t, e) {
1730
1997
  for (const r of t.nativeBindings.values())
1731
1998
  r.unsubscribe(), t.node.removeEventListener(r.eventName, r.listener);
1732
1999
  t.nativeBindings.clear();
1733
- for (const r of t.children) A(r, !1);
1734
- e && t.node.remove();
2000
+ for (const r of t.children) M(r, !1);
2001
+ e && le(t.node);
1735
2002
  return;
1736
2003
  }
1737
2004
  if (t.kind === "fragment") {
1738
- for (const r of t.children) A(r, !1);
2005
+ for (const r of t.children) M(r, !1);
1739
2006
  if (e)
1740
- for (const r of j(t)) r.remove();
2007
+ for (const r of P(t)) le(r);
1741
2008
  return;
1742
2009
  }
1743
- e && t.node.remove();
2010
+ e && le(t.node);
1744
2011
  }
1745
- function Le(t, e, r = null) {
2012
+ function le(t) {
2013
+ t.parentNode && (t.remove(), E());
2014
+ }
2015
+ function Fe(t, e, r = null) {
1746
2016
  if (e != null)
1747
- for (const i of j(e)) t.insertBefore(i, r);
2017
+ for (const i of P(e))
2018
+ i.parentNode === t && i.nextSibling === r || (t.insertBefore(i, r), E());
1748
2019
  }
1749
- function j(t) {
2020
+ function P(t) {
1750
2021
  if (t == null) return [];
1751
2022
  if (t.kind === "text" || t.kind === "element") return [t.node];
1752
- if (t.kind === "component") return j(t.instance._rendered);
1753
- if (t.kind === "function") return j(t.child);
2023
+ if (t.kind === "component") return P(t.instance._rendered);
2024
+ if (t.kind === "function") return P(t.child);
1754
2025
  const e = [];
1755
2026
  let r = t.start;
1756
2027
  for (; r && (e.push(r), r !== t.end); )
1757
2028
  r = r.nextSibling;
1758
2029
  return e;
1759
2030
  }
1760
- function yt(t) {
1761
- return j(t)[0] ?? null;
2031
+ function At(t) {
2032
+ return P(t)[0] ?? null;
1762
2033
  }
1763
- function H(t) {
1764
- return t instanceof $ ? gt(t.props) : T(t) ? t.key : null;
2034
+ function Z(t) {
2035
+ return t instanceof T ? Ot(t.props) : O(t) ? t.key : null;
1765
2036
  }
1766
- function gt(t) {
2037
+ function Ot(t) {
1767
2038
  const e = t.key;
1768
2039
  return typeof e == "string" || typeof e == "number" ? e : null;
1769
2040
  }
1770
- function bt(t, e) {
1771
- return t.kind === "text" ? typeof e == "string" || typeof e == "number" : t.kind === "emitter" ? fe(e) && t.source === e : t.kind === "component" ? e instanceof $ ? t.instance === e : T(e) && wt(e.type) && t.type === e.type && t.key === H(e) : t.kind === "function" ? T(e) && t.type === e.type && t.key === H(e) : t.kind === "fragment" ? T(e) && e.type === W && t.key === H(e) : T(e) && typeof e.type == "string" && t.type === e.type && t.key === H(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);
1772
2043
  }
1773
- function T(t) {
2044
+ function O(t) {
1774
2045
  return t != null && typeof t == "object" && Object.hasOwn(t, "type");
1775
2046
  }
1776
- function wt(t) {
1777
- return typeof t == "function" && (t === $ || t.prototype instanceof $);
2047
+ function Lt(t) {
2048
+ return typeof t == "function" && (t === T || t.prototype instanceof T);
1778
2049
  }
1779
- function Cr(t) {
2050
+ function Br(t) {
1780
2051
  return /^on[A-Z]/.test(t);
1781
2052
  }
1782
- function xr(t) {
2053
+ function Fr(t) {
1783
2054
  return t === "bind:value" || t === "bind:checked";
1784
2055
  }
1785
- function N(t) {
1786
- return t != null && typeof t == "object" && hr.has(t);
2056
+ function q(t) {
2057
+ return t != null && typeof t == "object" && Tr.has(t);
1787
2058
  }
1788
- function fe(t) {
2059
+ function Se(t) {
1789
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";
1790
2061
  }
1791
- function vt(t, e) {
1792
- 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`);
1793
2064
  }
1794
- function zr(t, e) {
1795
- if (vt(t, e), typeof Reflect.get(t, "set") != "function")
2065
+ function qr(t, e) {
2066
+ if (Mt(t, e), typeof Reflect.get(t, "set") != "function")
1796
2067
  throw new TypeError(`${e} requires a writable emitter`);
1797
2068
  }
1798
- function Tr(t, e) {
2069
+ function Ur(t, e) {
1799
2070
  const r = t.localName;
1800
2071
  if (!(e === "checked" ? r === "input" : r === "input" || r === "textarea" || r === "select")) throw new TypeError(`bind:${e} is not supported on ${r}`);
1801
2072
  }
1802
- function Rr(t, e) {
2073
+ function Hr(t, e) {
1803
2074
  return e === "value" && t.localName !== "select" ? "input" : "change";
1804
2075
  }
1805
- function Ar(t) {
2076
+ function Vr(t) {
1806
2077
  if (t == null || typeof t != "object" && typeof t != "function" || typeof Reflect.get(t, "insertBefore") != "function")
1807
2078
  throw new TypeError("Component parent must be a DOM ParentNode");
1808
2079
  }
1809
- function Ye(t) {
2080
+ function st(t) {
1810
2081
  try {
1811
2082
  return String(t);
1812
2083
  } catch {
1813
2084
  return Object.prototype.toString.call(t);
1814
2085
  }
1815
2086
  }
1816
- function Or(t) {
2087
+ function Wr(t) {
1817
2088
  const e = [];
1818
2089
  let r = t;
1819
- for (; r != null && typeof r == "function" && (e.unshift(r), r !== $); )
2090
+ for (; r != null && typeof r == "function" && (e.unshift(r), r !== T); )
1820
2091
  r = Object.getPrototypeOf(r);
1821
2092
  return e;
1822
2093
  }
1823
- function jr(...t) {
2094
+ function Yr(...t) {
1824
2095
  return [...new Set(t.flatMap((e) => typeof e == "string" ? e.split(/\s+/) : []).filter(Boolean))].join(" ");
1825
2096
  }
1826
- function Se(t) {
2097
+ function Oe(t) {
1827
2098
  if (t.island === !0) return !0;
1828
2099
  const e = t.className ?? t.class;
1829
2100
  return typeof e == "string" && e.split(/\s+/).includes("island");
1830
2101
  }
1831
- function d(t, e, r) {
2102
+ function p(t, e, r) {
1832
2103
  const i = e == null ? {} : { ...e };
1833
- return r !== void 0 && (i.key = r), ce(t, i);
2104
+ return r !== void 0 && (i.key = r), me(t, i);
1834
2105
  }
1835
- const y = d, Lr = [
2106
+ const g = p, Gr = [
1836
2107
  "var(--colored-dark)",
1837
2108
  "var(--colored-base)",
1838
2109
  "var(--colored-light)"
1839
2110
  ];
1840
- class _ extends Te {
2111
+ class Y extends Ne {
1841
2112
  render() {
1842
- var g;
2113
+ var b;
1843
2114
  const {
1844
2115
  model: e,
1845
2116
  label: r = "Block graph",
1846
2117
  description: i = "Area is proportional to item count.",
1847
2118
  emptyMessage: n = "No items are available."
1848
- } = this.props, s = this.snapshot(e.layout$), o = s.fetchState === k.Initial || s.fetchState === k.Loading, a = this.read(e.selectedPath$), l = s.value, u = M(l.root, a), h = l.root.children.length === 0 ? [l.root] : l.root.children, f = (g = h[0]) == null ? void 0 : g.key, v = this.Host;
1849
- return /* @__PURE__ */ y(
1850
- v,
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,
1851
2122
  {
1852
2123
  className: (this.props.className ?? this.props.class ?? "") || null,
1853
2124
  "aria-label": r,
1854
2125
  "aria-busy": o ? "true" : null,
1855
2126
  children: [
1856
- /* @__PURE__ */ y("header", { children: [
1857
- /* @__PURE__ */ y("cap-summary", { children: [
1858
- /* @__PURE__ */ d("h2", { children: r }),
1859
- /* @__PURE__ */ y("p", { children: [
2127
+ /* @__PURE__ */ g("header", { children: [
2128
+ /* @__PURE__ */ g("cap-summary", { children: [
2129
+ /* @__PURE__ */ p("h2", { children: r }),
2130
+ /* @__PURE__ */ g("p", { children: [
1860
2131
  i,
1861
2132
  " ",
1862
2133
  o ? null : `${l.root.count} items.`
1863
2134
  ] }),
1864
- o ? /* @__PURE__ */ d(ge, { width: 45 }) : /* @__PURE__ */ y("output", { children: [
1865
- /* @__PURE__ */ d("strong", { children: "Selection:" }),
2135
+ o ? /* @__PURE__ */ p(xe, { width: 45 }) : /* @__PURE__ */ g("output", { children: [
2136
+ /* @__PURE__ */ p("strong", { children: "Selection:" }),
1866
2137
  " ",
1867
- u == null ? "None" : u.path.length === 0 ? u.label : u.path.map((m, p) => {
1868
- var x;
1869
- const C = u.path.slice(0, p + 1);
1870
- return ((x = M(l.root, C)) == null ? void 0 : x.label) ?? m.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;
1871
2142
  }).join(" → ")
1872
2143
  ] })
1873
2144
  ] }),
1874
- /* @__PURE__ */ d(
1875
- ae,
2145
+ /* @__PURE__ */ p(
2146
+ he,
1876
2147
  {
1877
2148
  label: "Clear selection",
1878
2149
  disabled: o || a == null,
@@ -1880,27 +2151,27 @@ class _ extends Te {
1880
2151
  }
1881
2152
  )
1882
2153
  ] }),
1883
- s.fetchState === k.Error ? /* @__PURE__ */ d("p", { role: "alert", children: "The block graph could not be calculated." }) : o ? /* @__PURE__ */ y(W, { children: [
1884
- /* @__PURE__ */ d("p", { role: "status", "aria-live": "polite", children: "Loading block graph…" }),
1885
- /* @__PURE__ */ d("cap-blockskeleton", { "aria-hidden": "true", children: [0, 1, 2].map((m) => /* @__PURE__ */ d("cap-blockskeletoncolumn", { children: [0, 1].map((p) => /* @__PURE__ */ d(ge, { width: 100 }, p)) }, m)) })
1886
- ] }) : l.valid ? l.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(
1887
2158
  "cap-scroller",
1888
2159
  {
1889
2160
  tabIndex: 0,
1890
2161
  "aria-label": `Scrollable ${r}`,
1891
- children: /* @__PURE__ */ d(
2162
+ children: /* @__PURE__ */ p(
1892
2163
  "cap-blocks",
1893
2164
  {
1894
2165
  role: "tree",
1895
2166
  "aria-label": r,
1896
2167
  className: l.root.childOrientation,
1897
- onClick: (m) => {
1898
- m.target === m.currentTarget && e.clear();
2168
+ onClick: (y) => {
2169
+ y.target === y.currentTarget && e.clear();
1899
2170
  },
1900
- children: h.map((m) => this.renderBlock(
1901
- m,
2171
+ children: d.map((y) => this.renderBlock(
2172
+ y,
1902
2173
  a,
1903
- (u == null ? void 0 : u.key) ?? f ?? null
2174
+ (u == null ? void 0 : u.key) ?? h ?? null
1904
2175
  ))
1905
2176
  }
1906
2177
  )
@@ -1911,8 +2182,8 @@ class _ extends Te {
1911
2182
  );
1912
2183
  }
1913
2184
  renderBlock(e, r, i) {
1914
- const n = Dr(e.path, r), s = e.colors, o = Ze(s ?? Lr);
1915
- return /* @__PURE__ */ y(
2185
+ const n = Xr(e.path, r), s = e.colors, o = ct(s ?? Gr);
2186
+ return /* @__PURE__ */ g(
1916
2187
  "article",
1917
2188
  {
1918
2189
  role: "treeitem",
@@ -1934,17 +2205,17 @@ class _ extends Te {
1934
2205
  }
1935
2206
  },
1936
2207
  children: [
1937
- /* @__PURE__ */ y("cap-blocklabel", { children: [
1938
- /* @__PURE__ */ y("cap-blockname", { children: [
1939
- /* @__PURE__ */ y("small", { children: [
2208
+ /* @__PURE__ */ g("cap-blocklabel", { children: [
2209
+ /* @__PURE__ */ g("cap-blockname", { children: [
2210
+ /* @__PURE__ */ g("small", { children: [
1940
2211
  e.criterionLabel ?? "Items",
1941
2212
  ":"
1942
2213
  ] }),
1943
- /* @__PURE__ */ d("strong", { children: e.label })
2214
+ /* @__PURE__ */ p("strong", { children: e.label })
1944
2215
  ] }),
1945
- /* @__PURE__ */ d("data", { value: String(e.count), children: e.count })
2216
+ /* @__PURE__ */ p("data", { value: String(e.count), children: e.count })
1946
2217
  ] }),
1947
- e.children.length === 0 ? null : /* @__PURE__ */ d(
2218
+ e.children.length === 0 ? null : /* @__PURE__ */ p(
1948
2219
  "cap-blockgroup",
1949
2220
  {
1950
2221
  role: "group",
@@ -1963,9 +2234,9 @@ class _ extends Te {
1963
2234
  }
1964
2235
  renderPartitionError(e) {
1965
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.`;
1966
- return /* @__PURE__ */ y("div", { role: "alert", children: [
1967
- /* @__PURE__ */ d("strong", { children: "Invalid block partition" }),
1968
- /* @__PURE__ */ y("p", { children: [
2237
+ return /* @__PURE__ */ g("div", { role: "alert", children: [
2238
+ /* @__PURE__ */ p("strong", { children: "Invalid block partition" }),
2239
+ /* @__PURE__ */ g("p", { children: [
1969
2240
  i,
1970
2241
  " ",
1971
2242
  e.length,
@@ -1984,7 +2255,7 @@ class _ extends Te {
1984
2255
  e.preventDefault(), this.props.model.clear("block selection cleared by keyboard");
1985
2256
  return;
1986
2257
  }
1987
- const i = this.props.model.layout$.get().root, n = kt(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);
1988
2259
  let o;
1989
2260
  if (e.key === "ArrowDown") o = n[s + 1];
1990
2261
  else if (e.key === "ArrowUp") o = n[s - 1];
@@ -1992,7 +2263,7 @@ class _ extends Te {
1992
2263
  else if (e.key === "End") o = n.at(-1);
1993
2264
  else if (e.key === "ArrowRight") o = r.children[0] ?? n[s + 1];
1994
2265
  else if (e.key === "ArrowLeft")
1995
- o = r.path.length <= 1 ? n[s - 1] : M(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;
1996
2267
  else return;
1997
2268
  o != null && (e.preventDefault(), this.focusBlock(o.key));
1998
2269
  }
@@ -2006,7 +2277,7 @@ class _ extends Te {
2006
2277
  }
2007
2278
  }
2008
2279
  }
2009
- c(_, "liveProps", []), c(_, "hostName", "block-graph"), c(_, "dataSurface", "data"), c(_, "dependencies", [ae, ge]), c(_, "css", X`
2280
+ c(Y, "liveProps", []), c(Y, "hostName", "block-graph"), c(Y, "dataSurface", "data"), c(Y, "dependencies", [he, xe]), c(Y, "css", re`
2010
2281
  & {
2011
2282
  display: flex;
2012
2283
  min-width: 0;
@@ -2113,9 +2384,8 @@ c(_, "liveProps", []), c(_, "hostName", "block-graph"), c(_, "dataSurface", "dat
2113
2384
  inset-block-start: 0;
2114
2385
  inset-inline-start: 0;
2115
2386
  box-sizing: border-box;
2116
- display: grid;
2117
- grid-template-columns: minmax(0, 1fr) auto;
2118
- grid-template-areas: "label count";
2387
+ display: flex;
2388
+ flex-flow: row nowrap;
2119
2389
  align-items: center;
2120
2390
  gap: 0 0.35rem;
2121
2391
  width: 100%;
@@ -2139,9 +2409,9 @@ c(_, "liveProps", []), c(_, "hostName", "block-graph"), c(_, "dataSurface", "dat
2139
2409
  }
2140
2410
 
2141
2411
  & cap-blocklabel > cap-blockname {
2142
- grid-area: label;
2143
- display: grid;
2144
- grid-template-columns: auto minmax(0, 1fr);
2412
+ display: flex;
2413
+ flex: 1 1 auto;
2414
+ flex-flow: row nowrap;
2145
2415
  align-items: baseline;
2146
2416
  gap: 0.2rem;
2147
2417
  min-width: 0;
@@ -2150,6 +2420,7 @@ c(_, "liveProps", []), c(_, "hostName", "block-graph"), c(_, "dataSurface", "dat
2150
2420
  }
2151
2421
 
2152
2422
  & cap-blockname > small {
2423
+ flex: 0 1 auto;
2153
2424
  overflow: hidden;
2154
2425
  font-size: 0.68rem;
2155
2426
  opacity: 0.82;
@@ -2158,6 +2429,7 @@ c(_, "liveProps", []), c(_, "hostName", "block-graph"), c(_, "dataSurface", "dat
2158
2429
  }
2159
2430
 
2160
2431
  & cap-blockname > strong {
2432
+ flex: 1 1 auto;
2161
2433
  min-width: 0;
2162
2434
  overflow: hidden;
2163
2435
  text-overflow: ellipsis;
@@ -2165,7 +2437,7 @@ c(_, "liveProps", []), c(_, "hostName", "block-graph"), c(_, "dataSurface", "dat
2165
2437
  }
2166
2438
 
2167
2439
  & cap-blocklabel > data {
2168
- grid-area: count;
2440
+ flex: 0 0 auto;
2169
2441
  align-self: center;
2170
2442
  font-weight: 750;
2171
2443
  }
@@ -2196,16 +2468,16 @@ c(_, "liveProps", []), c(_, "hostName", "block-graph"), c(_, "dataSurface", "dat
2196
2468
  }
2197
2469
  }
2198
2470
  `);
2199
- function kt(t) {
2200
- return t.flatMap((e) => [e, ...kt(e.children)]);
2471
+ function Dt(t) {
2472
+ return t.flatMap((e) => [e, ...Dt(e.children)]);
2201
2473
  }
2202
- function Dr(t, e) {
2474
+ function Xr(t, e) {
2203
2475
  return e != null && t.length === e.length && t.every((r, i) => {
2204
2476
  var n, s;
2205
2477
  return r.criterionKey === ((n = e[i]) == null ? void 0 : n.criterionKey) && r.categoryKey === ((s = e[i]) == null ? void 0 : s.categoryKey);
2206
2478
  });
2207
2479
  }
2208
- class de extends Ot {
2480
+ class we extends Wt {
2209
2481
  constructor(r) {
2210
2482
  super(r);
2211
2483
  c(this, "contentId");
@@ -2217,10 +2489,10 @@ class de extends Ot {
2217
2489
  throw new Error(
2218
2490
  "CollapsibleOptionGroup trailing header content must use a direct OptionGroupHeaderEnd child"
2219
2491
  );
2220
- const { content: r, regions: i } = jt(
2492
+ const { content: r, regions: i } = Yt(
2221
2493
  "CollapsibleOptionGroup",
2222
2494
  this.props.children,
2223
- { headerEnd: Lt }
2495
+ { headerEnd: Gt }
2224
2496
  );
2225
2497
  return this.renderOptionGroup(r, i.headerEnd ?? null);
2226
2498
  }
@@ -2234,10 +2506,10 @@ class de extends Ot {
2234
2506
  disabled: a = !1,
2235
2507
  required: l = !1,
2236
2508
  busy: u = !1,
2237
- error: h = null
2509
+ error: d = null
2238
2510
  } = this.props;
2239
- return /* @__PURE__ */ y(n, { className: this.props.className ?? this.props.class ?? null, children: [
2240
- /* @__PURE__ */ y(
2511
+ return /* @__PURE__ */ g(n, { className: this.props.className ?? this.props.class ?? null, children: [
2512
+ /* @__PURE__ */ g(
2241
2513
  "fieldset",
2242
2514
  {
2243
2515
  id: this.groupId,
@@ -2245,11 +2517,11 @@ class de extends Ot {
2245
2517
  "aria-label": s == null ? o : null,
2246
2518
  "aria-required": l ? "true" : null,
2247
2519
  "aria-busy": u ? "true" : null,
2248
- "aria-invalid": h == null ? null : "true",
2249
- "aria-describedby": h == null ? null : this.errorId,
2520
+ "aria-invalid": d == null ? null : "true",
2521
+ "aria-describedby": d == null ? null : this.errorId,
2250
2522
  children: [
2251
- /* @__PURE__ */ y("legend", { children: [
2252
- /* @__PURE__ */ d(
2523
+ /* @__PURE__ */ g("legend", { children: [
2524
+ /* @__PURE__ */ p(
2253
2525
  "button",
2254
2526
  {
2255
2527
  type: "button",
@@ -2260,18 +2532,18 @@ class de extends Ot {
2260
2532
  children: this.collapsed ? "▸" : "▾"
2261
2533
  }
2262
2534
  ),
2263
- s != null ? /* @__PURE__ */ d("span", { children: s }) : null,
2535
+ s != null ? /* @__PURE__ */ p("span", { children: s }) : null,
2264
2536
  i
2265
2537
  ] }),
2266
- /* @__PURE__ */ d("div", { id: this.contentId, hidden: this.collapsed, children: r })
2538
+ /* @__PURE__ */ p("div", { id: this.contentId, hidden: this.collapsed, children: r })
2267
2539
  ]
2268
2540
  }
2269
2541
  ),
2270
- this.renderOptionGroupError(h)
2542
+ this.renderOptionGroupError(d)
2271
2543
  ] });
2272
2544
  }
2273
2545
  }
2274
- c(de, "hostName", "collapsible-option-group"), c(de, "css", X`
2546
+ c(we, "hostName", "collapsible-option-group"), c(we, "css", re`
2275
2547
  & > fieldset > legend > button.cap-collapse-toggle {
2276
2548
  display: inline-flex;
2277
2549
  align-items: center;
@@ -2306,11 +2578,11 @@ c(de, "hostName", "collapsible-option-group"), c(de, "css", X`
2306
2578
  display: none;
2307
2579
  }
2308
2580
  `);
2309
- const Mr = [
2581
+ const Zr = [
2310
2582
  ["☐", "hidden"],
2311
2583
  ["✓", "visible"]
2312
2584
  ];
2313
- class re extends Dt {
2585
+ class ce extends Xt {
2314
2586
  render() {
2315
2587
  const {
2316
2588
  criteria: e,
@@ -2319,38 +2591,38 @@ class re extends Dt {
2319
2591
  } = this.props, n = this.snapshot(this.props.items$), s = Array.isArray(n.value) ? n.value : [];
2320
2592
  return this.renderGroupBox(
2321
2593
  r,
2322
- /* @__PURE__ */ y("cap-categoryhidecontent", { children: [
2323
- /* @__PURE__ */ d("p", { children: i }),
2324
- n.fetchState === k.Error ? /* @__PURE__ */ d("p", { role: "alert", children: "Category counts are unavailable." }) : null,
2325
- /* @__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) => {
2326
2598
  const a = this.snapshot(o.categories$), l = Array.isArray(a.value) ? a.value : [];
2327
- return /* @__PURE__ */ y(
2328
- de,
2599
+ return /* @__PURE__ */ g(
2600
+ we,
2329
2601
  {
2330
2602
  label: o.label,
2331
2603
  children: [
2332
- a.fetchState === k.Error ? /* @__PURE__ */ y("p", { role: "alert", children: [
2604
+ a.fetchState === S.Error ? /* @__PURE__ */ g("p", { role: "alert", children: [
2333
2605
  o.label,
2334
2606
  " categories are unavailable."
2335
2607
  ] }) : null,
2336
- a.fetchState !== k.Ready ? /* @__PURE__ */ y("p", { role: "status", "aria-live": "polite", children: [
2608
+ a.fetchState !== S.Ready ? /* @__PURE__ */ g("p", { role: "status", "aria-live": "polite", children: [
2337
2609
  "Loading ",
2338
2610
  o.label,
2339
2611
  "…"
2340
2612
  ] }) : null,
2341
- /* @__PURE__ */ d("cap-categories", { children: l.map((u) => {
2342
- const h = Pr(s, u.predicate);
2343
- return /* @__PURE__ */ y(
2613
+ /* @__PURE__ */ p("cap-categories", { children: l.map((u) => {
2614
+ const d = Jr(s, u.predicate);
2615
+ return /* @__PURE__ */ g(
2344
2616
  "cap-categoryoption",
2345
2617
  {
2346
- style: { ...Ze(u.colors) },
2618
+ style: { ...ct(u.colors) },
2347
2619
  children: [
2348
- /* @__PURE__ */ d("cap-categoryswatch", { "aria-hidden": "true" }),
2349
- /* @__PURE__ */ d(
2350
- le,
2620
+ /* @__PURE__ */ p("cap-categoryswatch", { "aria-hidden": "true" }),
2621
+ /* @__PURE__ */ p(
2622
+ fe,
2351
2623
  {
2352
- symbols: Mr,
2353
- label: `${u.label} (${h})`,
2624
+ symbols: Zr,
2625
+ label: `${u.label} (${d})`,
2354
2626
  valueEmitter: o.visibility(u.key)
2355
2627
  }
2356
2628
  )
@@ -2368,7 +2640,7 @@ class re extends Dt {
2368
2640
  );
2369
2641
  }
2370
2642
  }
2371
- c(re, "liveProps", []), c(re, "hostName", "category-hide-panel"), c(re, "dependencies", [le, de]), c(re, "css", X`
2643
+ c(ce, "liveProps", []), c(ce, "hostName", "category-hide-panel"), c(ce, "dependencies", [fe, we]), c(ce, "css", re`
2372
2644
  & {
2373
2645
  flex: 0 0 auto;
2374
2646
  min-width: 0;
@@ -2376,8 +2648,9 @@ c(re, "liveProps", []), c(re, "hostName", "category-hide-panel"), c(re, "depende
2376
2648
  }
2377
2649
 
2378
2650
  & > cap-content > cap-categoryhidecontent {
2379
- display: grid;
2380
- align-content: start;
2651
+ display: flex;
2652
+ flex-flow: column nowrap;
2653
+ align-items: stretch;
2381
2654
  gap: var(--viz-space, 0.6rem);
2382
2655
  min-width: 0;
2383
2656
  }
@@ -2389,7 +2662,8 @@ c(re, "liveProps", []), c(re, "hostName", "category-hide-panel"), c(re, "depende
2389
2662
  }
2390
2663
 
2391
2664
  & > cap-content > cap-categoryhidecontent > cap-criteriongroups {
2392
- display: grid;
2665
+ display: flex;
2666
+ flex-flow: column nowrap;
2393
2667
  gap: 1em;
2394
2668
  min-width: 0;
2395
2669
  }
@@ -2443,168 +2717,168 @@ c(re, "liveProps", []), c(re, "hostName", "category-hide-panel"), c(re, "depende
2443
2717
  white-space: nowrap;
2444
2718
  }
2445
2719
  `);
2446
- function Pr(t, e) {
2720
+ function Jr(t, e) {
2447
2721
  let r = 0;
2448
2722
  for (const i of t)
2449
2723
  e(i) && (r += 1);
2450
2724
  return r;
2451
2725
  }
2452
- const St = 864e5, Kr = /^(\d{4})-(\d{2})-(\d{2})$/;
2453
- function S(t) {
2454
- const e = Kr.exec(t);
2726
+ const Pt = 864e5, Qr = /^(\d{4})-(\d{2})-(\d{2})$/;
2727
+ function $(t) {
2728
+ const e = Qr.exec(t);
2455
2729
  if (e == null) throw new TypeError(`Invalid civil date "${t}"; expected YYYY-MM-DD`);
2456
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);
2457
2731
  if (o.getUTCFullYear() !== r || o.getUTCMonth() !== i - 1 || o.getUTCDate() !== n)
2458
2732
  throw new TypeError(`Invalid civil date "${t}"`);
2459
- return Math.floor(s / St);
2733
+ return Math.floor(s / Pt);
2460
2734
  }
2461
- function I(t) {
2735
+ function U(t) {
2462
2736
  if (!Number.isInteger(t)) throw new TypeError("Civil day must be an integer");
2463
- return new Date(t * St).toISOString().slice(0, 10);
2737
+ return new Date(t * Pt).toISOString().slice(0, 10);
2464
2738
  }
2465
- function Nr(t, e) {
2739
+ function ei(t, e) {
2466
2740
  if (!Number.isInteger(e)) throw new TypeError("Civil date offset must be an integer");
2467
- return I(S(t) + e);
2741
+ return U($(t) + e);
2468
2742
  }
2469
- function Ir(t = /* @__PURE__ */ new Date()) {
2743
+ function ti(t = /* @__PURE__ */ new Date()) {
2470
2744
  if (!(t instanceof Date) || Number.isNaN(t.getTime()))
2471
2745
  throw new TypeError("todayCivilDate requires a valid Date");
2472
2746
  return `${String(t.getUTCFullYear()).padStart(4, "0")}-${String(
2473
2747
  t.getUTCMonth() + 1
2474
2748
  ).padStart(2, "0")}-${String(t.getUTCDate()).padStart(2, "0")}`;
2475
2749
  }
2476
- function Br(t, e) {
2477
- return S(t) - S(e);
2478
- }
2479
- function Fr(t, e = {}) {
2480
- var Pe, Ke, Ne, Ie;
2481
- Yr(t);
2482
- const r = We(e.width ?? 960, "Chart width"), i = We(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((b) => Object.keys(b.values)), u = e.today ?? Ir(), h = ((Pe = e.range) == null ? void 0 : Pe.minX) ?? Wr(l) ?? u, f = ((Ke = e.range) == null ? void 0 : Ke.maxX) ?? u, v = S(h), g = S(f);
2483
- if (v > g) throw new RangeError("Line graph minX must not be after maxX");
2484
- const m = Hr(t, v, g), p = e.stacked ?? !1, C = t.map((b) => ({
2485
- shape: b,
2486
- values: m.map((F) => $t(b, F))
2750
+ function ri(t, e) {
2751
+ return $(t) - $(e);
2752
+ }
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) => ({
2759
+ shape: w,
2760
+ values: y.map((V) => Kt(w, V))
2487
2761
  }));
2488
- let x = ((Ne = e.range) == null ? void 0 : Ne.minY) ?? 0, J = x;
2489
- const De = Array.from({ length: m.length }, () => 0), Ct = C.map(({ shape: b, values: F }) => {
2490
- const q = F.map((Q, D) => {
2491
- const ee = p ? De[D] : 0, te = ee + Q;
2492
- return p && (De[D] = te), x = Math.min(x, ee, te), J = Math.max(J, ee, te), { value: Q, baseValue: ee, displayValue: te };
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 };
2493
2767
  });
2494
- return { shape: b, entries: q };
2495
- }), xt = Math.max(1, J - x), L = J + xt * 0.05, me = ((Ie = e.range) == null ? void 0 : Ie.minY) ?? x, ye = Math.max(1, L - me), Me = Math.max(1, g - v), zt = Ct.map(({ shape: b, entries: F }) => ({
2496
- key: b.key,
2497
- label: b.label,
2498
- color: b.color,
2499
- ...b.colorKey === void 0 ? {} : { colorKey: b.colorKey },
2500
- shape: b,
2501
- points: Object.freeze(F.map((q, Q) => {
2502
- const D = m[Q];
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 }) => ({
2770
+ key: w.key,
2771
+ label: w.label,
2772
+ color: w.color,
2773
+ ...w.colorKey === void 0 ? {} : { colorKey: w.colorKey },
2774
+ shape: w,
2775
+ points: Object.freeze(V.map((W, se) => {
2776
+ const K = y[se];
2503
2777
  return Object.freeze({
2504
- date: I(D),
2505
- day: D,
2506
- ...q,
2507
- x: n + (D - v) / Me * o,
2508
- y: s + (L - q.displayValue) / ye * a,
2509
- baseY: s + (L - 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
2510
2784
  });
2511
2785
  }))
2512
2786
  }));
2513
2787
  return Object.freeze({
2514
- minDate: h,
2515
- maxDate: f,
2516
- minDay: v,
2517
- maxDay: g,
2518
- minY: me,
2519
- maxY: L,
2788
+ minDate: d,
2789
+ maxDate: h,
2790
+ minDay: k,
2791
+ maxDay: b,
2792
+ minY: Ee,
2793
+ maxY: N,
2520
2794
  width: r,
2521
2795
  height: i,
2522
2796
  plotLeft: n,
2523
2797
  plotTop: s,
2524
2798
  plotWidth: o,
2525
2799
  plotHeight: a,
2526
- stacked: p,
2527
- series: Object.freeze(zt),
2528
- dateMarks: Object.freeze(Vr(v, g, e.maxDateMarks ?? 8).map((b) => ({
2529
- date: I(b),
2530
- day: b,
2531
- x: n + (b - v) / Me * o
2800
+ stacked: f,
2801
+ series: Object.freeze(Bt),
2802
+ dateMarks: Object.freeze(li(k, b, e.maxDateMarks ?? 8).map((w) => ({
2803
+ date: U(w),
2804
+ day: w,
2805
+ x: n + (w - k) / Ue * o
2532
2806
  }))),
2533
- valueTicks: Object.freeze(Ur(me, L).map((b) => ({
2534
- value: b,
2535
- y: s + (L - b) / ye * a
2807
+ valueTicks: Object.freeze(oi(Ee, N).map((w) => ({
2808
+ value: w,
2809
+ y: s + (N - w) / $e * a
2536
2810
  })))
2537
2811
  });
2538
2812
  }
2539
- function qr(t, e) {
2540
- return $t(t, S(e));
2813
+ function ni(t, e) {
2814
+ return Kt(t, $(e));
2541
2815
  }
2542
- function Et(t, e) {
2816
+ function Nt(t, e) {
2543
2817
  const r = t[0];
2544
2818
  if (r == null) return "";
2545
- let i = `M ${w(r.x)} ${w(r.y)}`;
2819
+ let i = `M ${v(r.x)} ${v(r.y)}`;
2546
2820
  for (let n = 1; n < t.length; n += 1) {
2547
2821
  const s = t[n - 1], o = t[n];
2548
2822
  if (e) {
2549
2823
  const a = (s.x + o.x) / 2;
2550
- i += ` C ${w(a)} ${w(s.y)}, ${w(a)} ${w(o.y)}, ${w(o.x)} ${w(o.y)}`;
2824
+ i += ` C ${v(a)} ${v(s.y)}, ${v(a)} ${v(o.y)}, ${v(o.x)} ${v(o.y)}`;
2551
2825
  } else
2552
- i += ` H ${w(o.x)} V ${w(o.y)}`;
2826
+ i += ` H ${v(o.x)} V ${v(o.y)}`;
2553
2827
  }
2554
2828
  return i;
2555
2829
  }
2556
- function _r(t, e) {
2830
+ function si(t, e) {
2557
2831
  if (t.length === 0) return "";
2558
- const r = Et(t, e), i = [...t].reverse();
2832
+ const r = Nt(t, e), i = [...t].reverse();
2559
2833
  let n = "";
2560
2834
  for (let s = 0; s < i.length; s += 1) {
2561
2835
  const o = i[s];
2562
- if (s === 0) n += ` L ${w(o.x)} ${w(o.baseY)}`;
2836
+ if (s === 0) n += ` L ${v(o.x)} ${v(o.baseY)}`;
2563
2837
  else if (e) {
2564
2838
  const a = i[s - 1], l = (a.x + o.x) / 2;
2565
- n += ` C ${w(l)} ${w(a.baseY)}, ${w(l)} ${w(o.baseY)}, ${w(o.x)} ${w(o.baseY)}`;
2839
+ n += ` C ${v(l)} ${v(a.baseY)}, ${v(l)} ${v(o.baseY)}, ${v(o.x)} ${v(o.baseY)}`;
2566
2840
  } else
2567
- n += ` H ${w(o.x)} V ${w(o.baseY)}`;
2841
+ n += ` H ${v(o.x)} V ${v(o.baseY)}`;
2568
2842
  }
2569
2843
  return `${r}${n} Z`;
2570
2844
  }
2571
- function Ur(t, e, r = 6) {
2845
+ function oi(t, e, r = 6) {
2572
2846
  if (!Number.isFinite(t) || !Number.isFinite(e) || t > e)
2573
2847
  throw new RangeError("Tick range must contain finite ascending values");
2574
2848
  if (!Number.isInteger(r) || r < 2) throw new RangeError("Tick target must be at least two");
2575
- 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 = [];
2576
- for (let f = u; f <= e + l / 1e3; f += l)
2577
- h.push(Number(f.toFixed(10)));
2578
- 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;
2579
2853
  }
2580
- function Hr(t, e, r) {
2854
+ function ai(t, e, r) {
2581
2855
  const i = /* @__PURE__ */ new Set([e, r]);
2582
2856
  for (const n of t)
2583
2857
  for (const s of Object.keys(n.values)) {
2584
- const o = S(s);
2858
+ const o = $(s);
2585
2859
  o >= e && o <= r && i.add(o);
2586
2860
  }
2587
2861
  return [...i].sort((n, s) => n - s);
2588
2862
  }
2589
- function $t(t, e) {
2590
- const r = t.values[I(e)];
2863
+ function Kt(t, e) {
2864
+ const r = t.values[U(e)];
2591
2865
  if (r !== void 0) return r;
2592
2866
  if (t.carryForward !== !0) return 0;
2593
2867
  let i = Number.NEGATIVE_INFINITY, n = 0;
2594
2868
  for (const [s, o] of Object.entries(t.values)) {
2595
- const a = S(s);
2869
+ const a = $(s);
2596
2870
  a <= e && a > i && (i = a, n = o);
2597
2871
  }
2598
2872
  return n;
2599
2873
  }
2600
- function Vr(t, e, r) {
2874
+ function li(t, e, r) {
2601
2875
  if (!Number.isInteger(r) || r < 2)
2602
2876
  throw new RangeError("Maximum date marks must be at least two");
2603
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];
2604
2878
  for (let a = t + s; a < e; a += s) o.push(a);
2605
2879
  return e !== t && o.push(e), o;
2606
2880
  }
2607
- function Yr(t) {
2881
+ function ci(t) {
2608
2882
  if (!Array.isArray(t)) throw new TypeError("History shapes must be an array");
2609
2883
  const e = /* @__PURE__ */ new Set();
2610
2884
  for (const r of t) {
@@ -2616,23 +2890,23 @@ function Yr(t) {
2616
2890
  if (typeof r.color != "string" || r.color.trim() === "")
2617
2891
  throw new TypeError("History shape color must be a non-empty CSS value");
2618
2892
  for (const [i, n] of Object.entries(r.values))
2619
- 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");
2620
2894
  }
2621
2895
  }
2622
- function Wr(t) {
2623
- 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);
2624
2898
  }
2625
- function We(t, e) {
2899
+ function ot(t, e) {
2626
2900
  if (!Number.isFinite(t) || t <= 0) throw new RangeError(`${e} must be positive`);
2627
2901
  return t;
2628
2902
  }
2629
- function w(t) {
2903
+ function v(t) {
2630
2904
  return Number(t.toFixed(3)).toString();
2631
2905
  }
2632
- class Ee extends Te {
2906
+ class je extends Ne {
2633
2907
  constructor(r) {
2634
2908
  super(r);
2635
- c(this, "cursorDate$", new O(null, {
2909
+ c(this, "cursorDate$", new D(null, {
2636
2910
  owner: this,
2637
2911
  purpose: "line graph cursor date"
2638
2912
  }));
@@ -2648,30 +2922,30 @@ class Ee extends Te {
2648
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");
2649
2923
  }
2650
2924
  render() {
2651
- 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: p }) => p === k.Error) ? k.Error : [r, i, n, s].some(({ fetchState: p }) => p !== 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;
2652
2926
  let u = null;
2653
- if (this.currentModel = null, l === k.Ready)
2927
+ if (this.currentModel = null, l === S.Ready)
2654
2928
  try {
2655
- this.currentModel = Fr(r.value, {
2929
+ this.currentModel = ii(r.value, {
2656
2930
  stacked: i.value,
2657
2931
  range: s.value,
2658
2932
  width: Math.max(480, this.observedWidth),
2659
2933
  maxDateMarks: this.observedWidth < 640 ? 5 : 9
2660
2934
  });
2661
- } catch (p) {
2662
- u = p;
2935
+ } catch (f) {
2936
+ u = f;
2663
2937
  }
2664
- const h = this.currentModel, f = h == null ? null : o ?? h.maxDate, v = this.props.formatDate ?? ((p) => p), g = this.props.formatValue ?? ((p) => String(p)), m = this.Host;
2665
- return /* @__PURE__ */ y(
2666
- m,
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,
2667
2941
  {
2668
2942
  className: (this.props.className ?? this.props.class ?? "") || null,
2669
2943
  "aria-label": a,
2670
- "aria-busy": l !== k.Ready ? "true" : null,
2944
+ "aria-busy": l !== S.Ready ? "true" : null,
2671
2945
  children: [
2672
- /* @__PURE__ */ y("header", { children: [
2673
- /* @__PURE__ */ d("h2", { children: a }),
2674
- /* @__PURE__ */ y("p", { children: [
2946
+ /* @__PURE__ */ g("header", { children: [
2947
+ /* @__PURE__ */ p("h2", { children: a }),
2948
+ /* @__PURE__ */ g("p", { children: [
2675
2949
  i.value ? "Stacked area" : "Individual line",
2676
2950
  " chart;",
2677
2951
  " ",
@@ -2679,30 +2953,30 @@ class Ee extends Te {
2679
2953
  " rendering."
2680
2954
  ] })
2681
2955
  ] }),
2682
- 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(
2683
2957
  "cap-chart",
2684
2958
  {
2685
2959
  tabIndex: 0,
2686
2960
  role: "group",
2687
2961
  "aria-label": `${a}. Use Left and Right Arrow to move by day; hold Shift to move by week.`,
2688
- onPointerMove: (p) => this.pointerMove(p),
2689
- onKeyDown: (p) => this.cursorKeyDown(p),
2690
- ref: (p) => this.chartHost = p
2962
+ onPointerMove: (f) => this.pointerMove(f),
2963
+ onKeyDown: (f) => this.cursorKeyDown(f),
2964
+ ref: (f) => this.chartHost = f
2691
2965
  }
2692
2966
  ),
2693
- h == null || f == null ? null : /* @__PURE__ */ y("cap-readout", { children: [
2694
- /* @__PURE__ */ d("p", { "aria-live": "polite", children: /* @__PURE__ */ d("strong", { children: v(f) }) }),
2695
- /* @__PURE__ */ d("ul", { children: h.series.map(({ shape: p }) => /* @__PURE__ */ y("li", { children: [
2696
- /* @__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(
2697
2971
  "cap-swatch",
2698
2972
  {
2699
- style: { "--colored-base": p.color },
2973
+ style: { "--colored-base": f.color },
2700
2974
  "aria-hidden": "true"
2701
2975
  }
2702
2976
  ),
2703
- /* @__PURE__ */ d("span", { children: p.label }),
2704
- /* @__PURE__ */ d("strong", { children: g(qr(p, f)) })
2705
- ] }, p.key)) })
2977
+ /* @__PURE__ */ p("span", { children: f.label }),
2978
+ /* @__PURE__ */ p("strong", { children: b(ni(f, h)) })
2979
+ ] }, f.key)) })
2706
2980
  ] })
2707
2981
  ]
2708
2982
  }
@@ -2728,8 +3002,8 @@ class Ee extends Te {
2728
3002
  }), this.resizeObserver.observe(this.chartHost));
2729
3003
  }
2730
3004
  source(r, i) {
2731
- if (Gr(r)) return r;
2732
- const n = new O(r, { owner: this, purpose: i });
3005
+ if (di(r)) return r;
3006
+ const n = new D(r, { owner: this, purpose: i });
2733
3007
  return this.ownedSources.push(n), n;
2734
3008
  }
2735
3009
  pointerMove(r) {
@@ -2738,12 +3012,12 @@ class Ee extends Te {
2738
3012
  const s = n.getBoundingClientRect();
2739
3013
  if (s.width <= 0) return;
2740
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));
2741
- this.cursorDate$.set(I(l), "line graph pointer moved");
3015
+ this.cursorDate$.set(U(l), "line graph pointer moved");
2742
3016
  }
2743
3017
  cursorKeyDown(r) {
2744
3018
  const i = this.currentModel;
2745
3019
  if (i == null) return;
2746
- let n = S(this.cursorDate$.get() ?? i.maxDate);
3020
+ let n = $(this.cursorDate$.get() ?? i.maxDate);
2747
3021
  if (r.key === "ArrowLeft") n -= r.shiftKey ? 7 : 1;
2748
3022
  else if (r.key === "ArrowRight") n += r.shiftKey ? 7 : 1;
2749
3023
  else if (r.key === "Home") n = i.minDay;
@@ -2753,35 +3027,35 @@ class Ee extends Te {
2753
3027
  return;
2754
3028
  } else return;
2755
3029
  r.preventDefault();
2756
- const s = I(Math.max(i.minDay, Math.min(i.maxDay, n)));
3030
+ const s = U(Math.max(i.minDay, Math.min(i.maxDay, n)));
2757
3031
  this.cursorDate$.set(s, "line graph cursor moved by keyboard");
2758
3032
  }
2759
3033
  drawChart() {
2760
3034
  const r = this.chartHost, i = this.currentModel;
2761
3035
  if (r == null || i == null) return;
2762
- const n = this.smooth$.get(), s = z("svg");
3036
+ const n = this.smooth$.get(), s = A("svg");
2763
3037
  s.setAttribute("viewBox", `0 0 ${i.width} ${i.height}`), s.setAttribute("role", "img"), s.setAttribute("aria-label", this.props.label ?? "History chart");
2764
3038
  for (const a of i.valueTicks) {
2765
- const l = z("line");
2766
- l.classList.add("gridline"), U(l, {
3039
+ const l = A("line");
3040
+ l.classList.add("gridline"), G(l, {
2767
3041
  x1: i.plotLeft,
2768
3042
  x2: i.plotLeft + i.plotWidth,
2769
3043
  y1: a.y,
2770
3044
  y2: a.y
2771
3045
  }), s.append(l);
2772
- const u = z("text");
2773
- u.classList.add("axismark"), U(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);
2774
3048
  }
2775
3049
  for (const a of i.dateMarks) {
2776
- const l = z("line");
2777
- l.classList.add("gridline"), U(l, {
3050
+ const l = A("line");
3051
+ l.classList.add("gridline"), G(l, {
2778
3052
  x1: a.x,
2779
3053
  x2: a.x,
2780
3054
  y1: i.plotTop,
2781
3055
  y2: i.plotTop + i.plotHeight
2782
3056
  }), s.append(l);
2783
- const u = z("text");
2784
- u.classList.add("axismark"), U(u, {
3057
+ const u = A("text");
3058
+ u.classList.add("axismark"), G(u, {
2785
3059
  x: a.x,
2786
3060
  y: i.plotTop + i.plotHeight + 22,
2787
3061
  "text-anchor": "middle"
@@ -2789,16 +3063,16 @@ class Ee extends Te {
2789
3063
  }
2790
3064
  for (const a of i.series) {
2791
3065
  if (i.stacked) {
2792
- const u = z("path");
2793
- u.classList.add("seriesarea"), u.setAttribute("fill", a.color), u.setAttribute("d", _r(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);
2794
3068
  }
2795
- const l = z("path");
2796
- l.classList.add("seriesline"), l.setAttribute("stroke", a.color), l.setAttribute("d", Et(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);
2797
3071
  }
2798
3072
  const o = this.cursorDate$.get();
2799
3073
  if (o != null) {
2800
- const a = S(o), l = i.plotLeft + (a - i.minDay) / Math.max(1, i.maxDay - i.minDay) * i.plotWidth, u = z("line");
2801
- u.classList.add("cursor"), U(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, {
2802
3076
  x1: l,
2803
3077
  x2: l,
2804
3078
  y1: i.plotTop,
@@ -2808,7 +3082,7 @@ class Ee extends Te {
2808
3082
  r.replaceChildren(s);
2809
3083
  }
2810
3084
  }
2811
- c(Ee, "liveProps", []), c(Ee, "hostName", "line-graph"), c(Ee, "css", X`
3085
+ c(je, "liveProps", []), c(je, "hostName", "line-graph"), c(je, "css", re`
2812
3086
  & {
2813
3087
  display: flex;
2814
3088
  min-width: 0;
@@ -2909,18 +3183,18 @@ c(Ee, "liveProps", []), c(Ee, "hostName", "line-graph"), c(Ee, "css", X`
2909
3183
  }
2910
3184
  }
2911
3185
  `);
2912
- function Gr(t) {
3186
+ function di(t) {
2913
3187
  return t != null && (typeof t == "object" || typeof t == "function") && typeof Reflect.get(t, "get") == "function" && typeof Reflect.get(t, "subscribe") == "function";
2914
3188
  }
2915
- const Xr = "http://www.w3.org/2000/svg";
2916
- function z(t) {
2917
- return document.createElementNS(Xr, t);
3189
+ const pi = "http://www.w3.org/2000/svg";
3190
+ function A(t) {
3191
+ return document.createElementNS(pi, t);
2918
3192
  }
2919
- function U(t, e) {
3193
+ function G(t, e) {
2920
3194
  for (const [r, i] of Object.entries(e))
2921
3195
  t.setAttribute(r, String(i));
2922
3196
  }
2923
- class Zr {
3197
+ class hi {
2924
3198
  constructor(e, r = {}) {
2925
3199
  c(this, "criteria");
2926
3200
  c(this, "presets");
@@ -2933,29 +3207,29 @@ class Zr {
2933
3207
  c(this, "activeSplitsEmitter");
2934
3208
  c(this, "activeEmitters", /* @__PURE__ */ new Map());
2935
3209
  c(this, "disposed", !1);
2936
- if (!Array.isArray(e) || e.some((o) => !(o instanceof B)))
3210
+ if (!Array.isArray(e) || e.some((o) => !(o instanceof H)))
2937
3211
  throw new TypeError("Split criteria must contain GroupingCriterion instances");
2938
3212
  const i = new Map(
2939
3213
  e.map((o) => [o.key, o])
2940
3214
  );
2941
3215
  if (i.size !== e.length) throw new Error("Split criteria keys must be unique");
2942
- this.criteria = Object.freeze([...e]), this.byKey = i, this.presets = Qr(r.presets ?? [], i);
3216
+ this.criteria = Object.freeze([...e]), this.byKey = i, this.presets = mi(r.presets ?? [], i);
2943
3217
  const n = this.criteria.map(({ key: o }) => o), s = r.active ?? n;
2944
- Y(s, i, "Active split keys"), this.state$ = new O(ie(n, new Set(s)), {
3218
+ Q(s, i, "Active split keys"), this.state$ = new D(ue(n, new Set(s)), {
2945
3219
  owner: this,
2946
3220
  purpose: "split selection state",
2947
- equals: ei
2948
- }), this.orderEmitter = new R(
3221
+ equals: yi
3222
+ }), this.orderEmitter = new j(
2949
3223
  [this.state$],
2950
3224
  ([o]) => Object.freeze(
2951
- o.order.map((a) => Ge(i, a))
3225
+ o.order.map((a) => at(i, a))
2952
3226
  ),
2953
3227
  { owner: this, purpose: "ordered visualization criteria" }
2954
- ), this.order$ = this.orderEmitter, this.activeSplitsEmitter = new R(
3228
+ ), this.order$ = this.orderEmitter, this.activeSplitsEmitter = new j(
2955
3229
  [this.state$],
2956
- ([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))),
2957
3231
  { owner: this, purpose: "active ordered visualization splits" }
2958
- ), this.activeSplits$ = this.activeSplitsEmitter, this.activePreset$ = new O(null, {
3232
+ ), this.activeSplits$ = this.activeSplitsEmitter, this.activePreset$ = new D(null, {
2959
3233
  owner: this,
2960
3234
  purpose: "active visualization split preset"
2961
3235
  });
@@ -2964,7 +3238,7 @@ class Zr {
2964
3238
  this.assertActive();
2965
3239
  const r = this.requireKey(e);
2966
3240
  let i = this.activeEmitters.get(r);
2967
- return i == null && (i = new Jr(this, r), this.activeEmitters.set(r, i)), i;
3241
+ return i == null && (i = new fi(this, r), this.activeEmitters.set(r, i)), i;
2968
3242
  }
2969
3243
  isActive(e) {
2970
3244
  return this.state$.get().active.has(this.requireKey(e));
@@ -2973,7 +3247,7 @@ class Zr {
2973
3247
  this.assertActive();
2974
3248
  const i = this.requireKey(e), n = this.state$.get(), s = new Set(n.active);
2975
3249
  return s.has(i) ? s.delete(i) : s.add(i), this.activePreset$.set(null, "split selection customized"), this.state$.set(
2976
- ie(n.order, s),
3250
+ ue(n.order, s),
2977
3251
  r ?? `${i} split toggled`
2978
3252
  );
2979
3253
  }
@@ -2985,7 +3259,7 @@ class Zr {
2985
3259
  if (o === a) return !1;
2986
3260
  const l = [...s.order];
2987
3261
  return l.splice(o, 1), l.splice(a, 0, n), this.activePreset$.set(null, "split order customized"), this.state$.set(
2988
- ie(l, s.active),
3262
+ ue(l, s.active),
2989
3263
  i ?? `${n} split moved`
2990
3264
  );
2991
3265
  }
@@ -2999,14 +3273,14 @@ class Zr {
2999
3273
  );
3000
3274
  }
3001
3275
  setSplits(e, r, i) {
3002
- this.assertActive(), Y(e, this.byKey, "Active split keys");
3276
+ this.assertActive(), Q(e, this.byKey, "Active split keys");
3003
3277
  const n = new Set(e), s = r ?? this.state$.get().order.filter((a) => !n.has(a));
3004
- Y(s, this.byKey, "Inactive split keys");
3278
+ Q(s, this.byKey, "Inactive split keys");
3005
3279
  const o = [...e, ...s];
3006
3280
  if (new Set(o).size !== this.criteria.length || o.length !== this.criteria.length)
3007
3281
  throw new Error("Active and inactive split keys must cover every criterion exactly once");
3008
3282
  return this.activePreset$.set(null, "split selection replaced"), this.state$.set(
3009
- ie(o, n),
3283
+ ue(o, n),
3010
3284
  i ?? "split selection replaced"
3011
3285
  );
3012
3286
  }
@@ -3033,10 +3307,10 @@ class Zr {
3033
3307
  if (this.disposed) throw new Error("Split selection model is disposed");
3034
3308
  }
3035
3309
  }
3036
- function hi(t, e = {}) {
3037
- return new Zr(t, e);
3310
+ function Ti(t, e = {}) {
3311
+ return new hi(t, e);
3038
3312
  }
3039
- class Jr extends ze {
3313
+ class fi extends Pe {
3040
3314
  constructor(r, i) {
3041
3315
  super(r.isActive(i) ? "visible" : "hidden", {
3042
3316
  owner: r,
@@ -3068,7 +3342,7 @@ class Jr extends ze {
3068
3342
  });
3069
3343
  }
3070
3344
  }
3071
- function Qr(t, e) {
3345
+ function mi(t, e) {
3072
3346
  if (!Array.isArray(t)) throw new TypeError("Split presets must be an array");
3073
3347
  const r = /* @__PURE__ */ new Set();
3074
3348
  return Object.freeze(t.map((i) => {
@@ -3078,35 +3352,35 @@ function Qr(t, e) {
3078
3352
  throw new Error("Split preset keys must be non-empty and unique");
3079
3353
  if (typeof i.label != "string" || i.label.trim() === "")
3080
3354
  throw new TypeError("Split preset label must be a non-empty string");
3081
- r.add(i.key), Y(i.active, e, `${i.key} active keys`);
3355
+ r.add(i.key), Q(i.active, e, `${i.key} active keys`);
3082
3356
  const n = Object.freeze([...i.active]), s = i.inactive == null ? Object.freeze([...e.keys()].filter((o) => !n.includes(o))) : Object.freeze([...i.inactive]);
3083
- if (Y(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)
3084
3358
  throw new Error(`Split preset "${i.key}" must cover every criterion exactly once`);
3085
3359
  return Object.freeze({ ...i, active: n, inactive: s });
3086
3360
  }));
3087
3361
  }
3088
- function Y(t, e, r) {
3362
+ function Q(t, e, r) {
3089
3363
  if (!Array.isArray(t)) throw new TypeError(`${r} must be an array`);
3090
3364
  if (new Set(t).size !== t.length) throw new Error(`${r} must be unique`);
3091
3365
  for (const n of t)
3092
3366
  if (!e.has(n)) throw new Error(`${r} contains unknown criterion "${n}"`);
3093
3367
  }
3094
- function Ge(t, e) {
3368
+ function at(t, e) {
3095
3369
  const r = t.get(e);
3096
3370
  if (r == null) throw new Error(`Missing criterion "${e}"`);
3097
3371
  return r;
3098
3372
  }
3099
- function ie(t, e) {
3373
+ function ue(t, e) {
3100
3374
  return Object.freeze({ order: Object.freeze([...t]), active: new Set(e) });
3101
3375
  }
3102
- function ei(t, e) {
3376
+ function yi(t, e) {
3103
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));
3104
3378
  }
3105
- const ti = [
3379
+ const gi = [
3106
3380
  ["☐", "hidden"],
3107
3381
  ["✓", "visible"]
3108
3382
  ];
3109
- class ne extends Te {
3383
+ class de extends Ne {
3110
3384
  constructor() {
3111
3385
  super(...arguments);
3112
3386
  c(this, "draggingKey", null);
@@ -3127,9 +3401,9 @@ class ne extends Te {
3127
3401
  } = this.props, o = this.read(r.order$);
3128
3402
  this.read(r.activeSplits$);
3129
3403
  const a = this.read(r.activePreset$), l = this.Host;
3130
- return /* @__PURE__ */ y(l, { children: [
3131
- r.presets.length === 0 ? null : /* @__PURE__ */ d(be, { header: s, children: /* @__PURE__ */ d("cap-presets", { children: r.presets.map((u) => /* @__PURE__ */ d(
3132
- ae,
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,
3133
3407
  {
3134
3408
  label: u.label,
3135
3409
  pressed: a === u.key,
@@ -3139,39 +3413,39 @@ class ne extends Te {
3139
3413
  },
3140
3414
  u.key
3141
3415
  )) }) }),
3142
- /* @__PURE__ */ y(be, { header: i, children: [
3143
- /* @__PURE__ */ d("p", { children: n }),
3144
- /* @__PURE__ */ d("ol", { children: o.map((u) => /* @__PURE__ */ y(
3416
+ /* @__PURE__ */ g(Ce, { header: i, children: [
3417
+ /* @__PURE__ */ p("p", { children: n }),
3418
+ /* @__PURE__ */ p("ol", { children: o.map((u) => /* @__PURE__ */ g(
3145
3419
  "li",
3146
3420
  {
3147
3421
  className: this.draggingKey === u.key ? "dragging" : void 0,
3148
3422
  "data-split-key": u.key,
3149
- onPointerDown: (h) => this.startDragging(u.key, h),
3150
- onClick: (h) => this.suppressDraggedClick(h),
3423
+ onPointerDown: (d) => this.startDragging(u.key, d),
3424
+ onClick: (d) => this.suppressDraggedClick(d),
3151
3425
  children: [
3152
- /* @__PURE__ */ d(
3153
- le,
3426
+ /* @__PURE__ */ p(
3427
+ fe,
3154
3428
  {
3155
- symbols: ti,
3429
+ symbols: gi,
3156
3430
  label: u.label,
3157
3431
  valueEmitter: r.activeState(u.key)
3158
3432
  }
3159
3433
  ),
3160
- /* @__PURE__ */ d(
3434
+ /* @__PURE__ */ p(
3161
3435
  "cap-draghandle",
3162
3436
  {
3163
3437
  role: "button",
3164
3438
  tabIndex: 0,
3165
3439
  "aria-label": `Reorder ${u.label}`,
3166
3440
  title: "Drag to reorder; use Alt+Arrow keys from the keyboard",
3167
- onKeyDown: (h) => {
3168
- if (!h.altKey || h.key !== "ArrowUp" && h.key !== "ArrowDown")
3441
+ onKeyDown: (d) => {
3442
+ if (!d.altKey || d.key !== "ArrowUp" && d.key !== "ArrowDown")
3169
3443
  return;
3170
- h.preventDefault();
3171
- const f = h.key === "ArrowUp" ? -1 : 1;
3172
- if (r.moveBy(u.key, f, "split reordered by keyboard")) {
3173
- const v = r.order$.get().findIndex(({ key: g }) => g === u.key) + 1;
3174
- this.announce(`${u.label} moved to position ${v}`), 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));
3175
3449
  }
3176
3450
  }
3177
3451
  }
@@ -3180,16 +3454,16 @@ class ne extends Te {
3180
3454
  },
3181
3455
  u.key
3182
3456
  )) }),
3183
- /* @__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 })
3184
3458
  ] })
3185
3459
  ] });
3186
3460
  }
3187
3461
  pointerMove(r) {
3188
3462
  var a;
3189
3463
  if (this.draggingKey == null && this.pendingDrag != null) {
3190
- const { clientX: l, clientY: u, key: h } = this.pendingDrag;
3464
+ const { clientX: l, clientY: u, key: d } = this.pendingDrag;
3191
3465
  if (Math.hypot(r.clientX - l, r.clientY - u) < 4) return;
3192
- this.draggingKey = h, this.pendingDrag = null, this.update();
3466
+ this.draggingKey = d, this.pendingDrag = null, this.update();
3193
3467
  }
3194
3468
  if (this.draggingKey == null || typeof document.elementFromPoint != "function") return;
3195
3469
  const i = (a = document.elementFromPoint(r.clientX, r.clientY)) == null ? void 0 : a.closest("[data-split-key]");
@@ -3231,9 +3505,10 @@ class ne extends Te {
3231
3505
  }
3232
3506
  }
3233
3507
  }
3234
- c(ne, "liveProps", []), c(ne, "hostName", "split-selection-panel"), c(ne, "dependencies", [ae, le, be]), c(ne, "css", X`
3508
+ c(de, "liveProps", []), c(de, "hostName", "split-selection-panel"), c(de, "dependencies", [he, fe, Ce]), c(de, "css", re`
3235
3509
  & {
3236
- display: grid;
3510
+ display: flex;
3511
+ flex-flow: column nowrap;
3237
3512
  gap: var(--viz-space, 0.6rem);
3238
3513
  min-width: 0;
3239
3514
  user-select: none;
@@ -3261,10 +3536,10 @@ c(ne, "liveProps", []), c(ne, "hostName", "split-selection-panel"), c(ne, "depen
3261
3536
  }
3262
3537
 
3263
3538
  & > cap-groupbox > cap-content > cap-presets {
3264
- display: grid;
3539
+ display: flex;
3540
+ flex-flow: column nowrap;
3265
3541
  gap: 0.35rem;
3266
- align-content: stretch;
3267
- justify-content: stretch;
3542
+ align-items: stretch;
3268
3543
  }
3269
3544
 
3270
3545
  & > cap-groupbox > cap-content > cap-presets > cap-button {
@@ -3274,7 +3549,8 @@ c(ne, "liveProps", []), c(ne, "hostName", "split-selection-panel"), c(ne, "depen
3274
3549
  }
3275
3550
 
3276
3551
  & ol {
3277
- display: grid;
3552
+ display: flex;
3553
+ flex-flow: column nowrap;
3278
3554
  gap: .33rem;
3279
3555
  padding: 0;
3280
3556
  list-style: none;
@@ -3342,13 +3618,13 @@ c(ne, "liveProps", []), c(ne, "hostName", "split-selection-panel"), c(ne, "depen
3342
3618
  border: 0;
3343
3619
  }
3344
3620
  `);
3345
- class di {
3621
+ class zi {
3346
3622
  constructor(e) {
3347
3623
  c(this, "categories");
3348
3624
  c(this, "byKey");
3349
3625
  c(this, "deltas", /* @__PURE__ */ new Map());
3350
3626
  if (!Array.isArray(e)) throw new TypeError("Series categories must be an array");
3351
- const r = e.map((n) => ri(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]));
3352
3628
  if (i.size !== r.length) throw new Error("Series category keys must be unique");
3353
3629
  this.categories = Object.freeze(r), this.byKey = i;
3354
3630
  }
@@ -3359,7 +3635,7 @@ class di {
3359
3635
  return this.add(e, r, -1);
3360
3636
  }
3361
3637
  add(e, r, i) {
3362
- 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");
3363
3639
  if (!this.byKey.has(r))
3364
3640
  throw new Error(`Unknown series category "${r}"`);
3365
3641
  const n = this.deltas.get(r) ?? /* @__PURE__ */ new Map();
@@ -3367,7 +3643,7 @@ class di {
3367
3643
  }
3368
3644
  build() {
3369
3645
  const e = this.allDates();
3370
- return this.categories.map((r) => Xe(r, Object.fromEntries(e.map((i) => {
3646
+ return this.categories.map((r) => lt(r, Object.fromEntries(e.map((i) => {
3371
3647
  var n;
3372
3648
  return [
3373
3649
  i,
@@ -3378,21 +3654,21 @@ class di {
3378
3654
  buildCumulative() {
3379
3655
  const e = this.allDates();
3380
3656
  if (e.length === 0) return Object.freeze([]);
3381
- const r = [Nr(e[0], -1), ...e];
3657
+ const r = [ei(e[0], -1), ...e];
3382
3658
  return this.categories.map((i) => {
3383
3659
  var o;
3384
3660
  let n = 0;
3385
3661
  const s = { [r[0]]: 0 };
3386
3662
  for (const a of e)
3387
3663
  n += ((o = this.deltas.get(i.key)) == null ? void 0 : o.get(a)) ?? 0, s[a] = n;
3388
- return Xe(i, s, !0);
3664
+ return lt(i, s, !0);
3389
3665
  }).filter((i) => Object.values(i.values).some((n) => n !== 0));
3390
3666
  }
3391
3667
  allDates() {
3392
- return [...new Set([...this.deltas.values()].flatMap((e) => [...e.keys()]))].sort(Br);
3668
+ return [...new Set([...this.deltas.values()].flatMap((e) => [...e.keys()]))].sort(ri);
3393
3669
  }
3394
3670
  }
3395
- function ri(t) {
3671
+ function bi(t) {
3396
3672
  if (t == null || typeof t != "object")
3397
3673
  throw new TypeError("Series category must be an object");
3398
3674
  if (typeof t.key != "string" || t.key.trim() === "")
@@ -3405,7 +3681,7 @@ function ri(t) {
3405
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 };
3406
3682
  return Object.freeze(r);
3407
3683
  }
3408
- function Xe(t, e, r) {
3684
+ function lt(t, e, r) {
3409
3685
  return Object.freeze({
3410
3686
  ...t,
3411
3687
  values: Object.freeze(e),
@@ -3413,37 +3689,37 @@ function Xe(t, e, r) {
3413
3689
  });
3414
3690
  }
3415
3691
  export {
3416
- _ as BlockGraph,
3417
- Bt as BlockSelectionModel,
3418
- re as CategoryHidePanel,
3419
- de as CollapsibleOptionGroup,
3420
- B as GroupingCriterion,
3421
- Ee as LineGraph,
3422
- di as SeriesBuilder,
3423
- Zr as SplitSelectionModel,
3424
- ne as SplitSelectionPanel,
3425
- Nr as addCivilDays,
3426
- _r as areaPath,
3427
- ve as buildBlockLayout,
3428
- Ur as buildIntegerTicks,
3429
- Fr as buildLineChartModel,
3430
- Ze as categoryColorVariables,
3431
- ci as categoryCounts,
3432
- S as civilDateToDay,
3433
- Br as compareCivilDates,
3434
- ui as createBlockSelection,
3435
- hi as createSplitSelection,
3436
- It as criterionSnapshot,
3437
- I as dayToCivilDate,
3438
- Mt as deriveCategories,
3439
- ai as derivedCriterion,
3440
- li as filterByHidden,
3441
- M as findBlock,
3442
- kt as flattenBlocks,
3443
- Et as linePath,
3444
- Pt as setsEqual,
3445
- oi as staticCriterion,
3446
- Ir as todayCivilDate,
3447
- qr 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
3448
3724
  };
3449
3725
  //# sourceMappingURL=index.js.map