@graphty/graphty-element 2.4.1 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/ai.js +3 -3
  2. package/dist/catalog.js +6 -6
  3. package/dist/chunks/{AiManager-DNJCoeTO.js → AiManager-CrbvKdEK.js} +5 -5
  4. package/dist/chunks/{DataSource-xL3Yn0Pa.js → DataSource-qU-nLhXN.js} +3 -3
  5. package/dist/chunks/{GraphSession-PFm2tJ_j.js → GraphSession-DuAhRgCd.js} +863 -856
  6. package/dist/chunks/{GraphtyLogger-kbOx2zq3.js → GraphtyLogger-DOTwCiMR.js} +1 -1
  7. package/dist/chunks/{VoiceInputAdapter-CDNKQgUK.js → VoiceInputAdapter-D4NrRL_1.js} +1 -1
  8. package/dist/chunks/{XRPivotCameraController-JdlLBcD7.js → XRPivotCameraController-Uqa47vmo.js} +2 -2
  9. package/dist/chunks/{algorithms-B87OPYw4.js → algorithms-D-ab-Auu.js} +2 -2
  10. package/dist/chunks/{capability-check-B2oYf_30.js → capability-check-Vw3IcqiE.js} +1 -1
  11. package/dist/chunks/detect-B4Qrw976.js +88 -0
  12. package/dist/chunks/{format-detection-BG6CMwPO.js → format-detection-r2IfNFXO.js} +1 -1
  13. package/dist/chunks/{index-6GDfNfwJ.js → index-J9MgLio9.js} +104 -83
  14. package/dist/chunks/{optionsFromZod-DHLLiX_8.js → optionsFromZod-B9RncoTX.js} +183 -178
  15. package/dist/chunks/{paletteRegistry-jg9uS7wo.js → paletteRegistry-Kt-6CeoN.js} +19 -13
  16. package/dist/chunks/{pluginRegistry-MaTIDh6l.js → pluginRegistry-Bs8bEkz9.js} +3 -2
  17. package/dist/chunks/{registry-DQeq4B2K.js → registry-BdGvyZou.js} +1 -1
  18. package/dist/chunks/{scales-BXHmwPXC.js → scales-CJCRwi2J.js} +4 -4
  19. package/dist/custom-elements.json +1 -1
  20. package/dist/extend.js +7 -7
  21. package/dist/graphty-catalog.json +4 -3
  22. package/dist/graphty.bundle.js +15837 -15793
  23. package/dist/graphty.js +6 -6
  24. package/dist/index.d.ts +1 -1
  25. package/dist/logging.js +2 -2
  26. package/dist/session.js +5 -5
  27. package/dist/src/Graph.d.ts +3 -3
  28. package/dist/src/catalog/formats.d.ts +5 -1
  29. package/dist/src/catalog/types.d.ts +13 -2
  30. package/dist/src/errors/codes.d.ts +7 -0
  31. package/dist/src/events.d.ts +35 -2
  32. package/dist/src/managers/EventManager.d.ts +4 -0
  33. package/dist/src/managers/LayoutManager.d.ts +7 -0
  34. package/dist/src/session/results/types.d.ts +26 -0
  35. package/dist/src/session/styles/StylesApi.d.ts +6 -5
  36. package/dist/src/session/styles/explain.d.ts +3 -3
  37. package/dist/src/session/types.d.ts +12 -1
  38. package/dist/webgpu.js +2 -2
  39. package/package.json +7 -7
  40. package/dist/chunks/detect-tuYQLJbT.js +0 -88
@@ -1,17 +1,17 @@
1
- import { INVALID_INDEX as G, GraphBuilder as Xs, remapArray as Js } from "@graphty/graph-format";
1
+ import { INVALID_INDEX as G, GraphBuilder as Js, remapArray as Zs } from "@graphty/graph-format";
2
2
  import { z as B } from "zod/v4";
3
- import { G as _, A as Zs, i as zt } from "./pluginRegistry-MaTIDh6l.js";
4
- import { g as eo, e as to, d as no } from "./NodeStyle-CtmA7dXi.js";
5
- import { E as so, P as it, n as at, g as oo, f as ro, e as io, F as ao } from "./paletteRegistry-jg9uS7wo.js";
6
- import { B as co, C as lo, t as me, g as et, a as as, l as cs, h as Ie, m as uo } from "./algorithms-B87OPYw4.js";
7
- import { q as ls, I as ho, J as xe, K as fo, M as mo, D as go, N as Zt, Q as en, k as po, j as bo, B as Lt, S as us, T as ke, U as Me, z as Ft, V as tt, W as vo, X as yo, Z as wo, _ as Oo, y as Eo, t as No, $ as So } from "./optionsFromZod-DHLLiX_8.js";
8
- import { S as ds, L as Ao, P as hs, p as be, k as Ut, d as Co, s as _o } from "./scales-BXHmwPXC.js";
9
- import { G as Io, a as To, L as Po } from "./GraphtyLogger-kbOx2zq3.js";
10
- import { l as fs } from "./types-C_c53VgR.js";
11
- import { f as $o } from "./sequential-Zym81qm7.js";
12
- import { i as tn } from "./interpolation-DY-PNpqX.js";
13
- import { a as ko } from "./registry-DQeq4B2K.js";
14
- const Mo = [
3
+ import { G as _, A as eo, i as jt } from "./pluginRegistry-Bs8bEkz9.js";
4
+ import { g as to, e as no, d as so } from "./NodeStyle-CtmA7dXi.js";
5
+ import { E as oo, P as it, n as at, g as ro, f as io, e as ao, F as co } from "./paletteRegistry-Kt-6CeoN.js";
6
+ import { B as lo, C as uo, t as me, g as et, a as as, l as cs, h as Ie, m as ho } from "./algorithms-D-ab-Auu.js";
7
+ import { q as ls, I as fo, J as xe, K as mo, M as go, D as po, N as Jt, Q as Zt, k as bo, j as vo, B as zt, S as us, T as ke, U as Me, V as yo, z as Lt, W as tt, X as wo, Z as Oo, _ as Eo, $ as No, t as ds, a0 as So, y as Ao, a1 as Co } from "./optionsFromZod-B9RncoTX.js";
8
+ import { S as hs, L as _o, P as fs, p as be, k as Ft, d as Io, s as To } from "./scales-CJCRwi2J.js";
9
+ import { G as Po, a as $o, L as ko } from "./GraphtyLogger-DOTwCiMR.js";
10
+ import { l as ms } from "./types-C_c53VgR.js";
11
+ import { f as Mo } from "./sequential-Zym81qm7.js";
12
+ import { i as en } from "./interpolation-DY-PNpqX.js";
13
+ import { a as Ro } from "./registry-BdGvyZou.js";
14
+ const Do = [
15
15
  "keep",
16
16
  "error",
17
17
  "first",
@@ -19,7 +19,7 @@ const Mo = [
19
19
  "sum",
20
20
  "min",
21
21
  "max"
22
- ], Ro = ["canonical", "keep"], Do = B.strictObject({
22
+ ], xo = ["canonical", "keep"], jo = B.strictObject({
23
23
  nodeIdPath: B.string().default("id"),
24
24
  // What to CALL a node, as distinct from how to address it. A result card naming the busiest
25
25
  // node, a legend row and a ranked list all want a name a reader recognises, and an id is only
@@ -51,7 +51,7 @@ const Mo = [
51
51
  // the store, so `statistics().repeatedEdgeCount` is structurally pinned at zero and there is
52
52
  // no number anywhere that disagrees with the load. Keeping them changes edge counts on any
53
53
  // multigraph, which is a change a consumer can see, measure and turn off with one word.
54
- repeatedEdges: B.enum(Mo).default("keep"),
54
+ repeatedEdges: B.enum(Do).default("keep"),
55
55
  // graph-format design 14.4 rule 10: the element default is "weight", which is what the io
56
56
  // importers write. DataManager reads this path first and falls back to the literal "value"
57
57
  // key, because "value" is what every weighted dataset, fixture and story in this repository
@@ -76,9 +76,9 @@ const Mo = [
76
76
  // node and "keep" does not. It is declared now because this is a strictObject: a config that
77
77
  // sets a key the schema has not declared is a parse ERROR, so the key has to exist here before
78
78
  // any config is allowed to carry it.
79
- idCoercion: B.enum(Ro).default("canonical")
80
- }), Vt = B.string().trim().min(1), ms = B.strictObject({
81
- algorithm: Vt,
79
+ idCoercion: B.enum(xo).default("canonical")
80
+ }), Ut = B.string().trim().min(1), gs = B.strictObject({
81
+ algorithm: Ut,
82
82
  params: B.record(B.string(), B.unknown()).optional(),
83
83
  style: B.union([
84
84
  B.boolean(),
@@ -86,8 +86,8 @@ const Mo = [
86
86
  ]).optional(),
87
87
  seed: B.number().optional(),
88
88
  as: B.string().min(1).optional()
89
- }), xo = B.union([Vt, ms]);
90
- function Yu(e) {
89
+ }), zo = B.union([Ut, gs]);
90
+ function Qu(e) {
91
91
  if (!Array.isArray(e))
92
92
  throw new _({
93
93
  code: "E_BAD_COMMAND",
@@ -96,7 +96,7 @@ function Yu(e) {
96
96
  details: { value: e }
97
97
  });
98
98
  return e.map((t, n) => {
99
- const s = typeof t == "object" && t !== null ? ms.safeParse(t) : Vt.safeParse(t);
99
+ const s = typeof t == "object" && t !== null ? gs.safeParse(t) : Ut.safeParse(t);
100
100
  if (!s.success) {
101
101
  const o = s.error.issues[0], r = o.path.length > 0 ? ` at "${o.path.join(".")}"` : "";
102
102
  throw new _({
@@ -109,27 +109,27 @@ function Yu(e) {
109
109
  return s.data;
110
110
  });
111
111
  }
112
- const jo = B.strictObject({
113
- algorithms: B.array(xo).optional(),
114
- knownFields: Do.prefault({}),
112
+ const Lo = B.strictObject({
113
+ algorithms: B.array(zo).optional(),
114
+ knownFields: jo.prefault({}),
115
115
  // graph-format design 14.4 rule 1: under "auto" the builder starts directed and unlocked so a
116
116
  // file header can set the direction while the builder is still empty; an explicit boolean
117
117
  // calls lockDirected(). Record-pushed data never changes the direction.
118
118
  directed: B.union([B.boolean(), B.literal("auto")]).default("auto")
119
- }), zo = Io.getLogger(["graphty", "acceleration"]);
120
- function Lo(e) {
121
- return Zs.find((t) => t === e.code);
119
+ }), Fo = Po.getLogger(["graphty", "acceleration"]);
120
+ function Uo(e) {
121
+ return eo.find((t) => t === e.code);
122
122
  }
123
- function Fo(e) {
123
+ function Vo(e) {
124
124
  return e instanceof Error && (e.name === "AbortError" || e.name === "TimeoutError");
125
125
  }
126
- function Uo(e) {
126
+ function Bo(e) {
127
127
  return e instanceof _ && e.code === "E_SOFTWARE_ONLY";
128
128
  }
129
- function Vo(e, t) {
129
+ function qo(e, t) {
130
130
  return e.policy === t.policy && e.state === t.state && e.backend === t.backend && e.vendor === t.vendor && e.architecture === t.architecture && e.device === t.device && e.reason === t.reason && e.code === t.code;
131
131
  }
132
- class Bo {
132
+ class Go {
133
133
  #i;
134
134
  #e = /* @__PURE__ */ new Set();
135
135
  #t;
@@ -164,7 +164,7 @@ class Bo {
164
164
  * @param options - The policy, the threshold, the registry and the recovery behaviour.
165
165
  */
166
166
  constructor(t = {}) {
167
- this.#i = t.registry ?? ko, this.#n = t.exactMaxNodes, this.#p = t.recoverOnDeviceLoss ?? !0, this.#b = t.maxRecoveryAttempts ?? 3, this.#o = t.whileRunning, this.#s = t.policy ?? ls, this.#m = t.minNodes ?? ho, this.#E = t.minNodes !== void 0, this.#d = this.#s === "off" ? "off" : "probing", this.#g = this.#D(), this.#C = Object.freeze({ acceleration: this.#g }), this.#t = this.#i.onChange(() => {
167
+ this.#i = t.registry ?? Ro, this.#n = t.exactMaxNodes, this.#p = t.recoverOnDeviceLoss ?? !0, this.#b = t.maxRecoveryAttempts ?? 3, this.#o = t.whileRunning, this.#s = t.policy ?? ls, this.#m = t.minNodes ?? fo, this.#E = t.minNodes !== void 0, this.#d = this.#s === "off" ? "off" : "probing", this.#g = this.#D(), this.#C = Object.freeze({ acceleration: this.#g }), this.#t = this.#i.onChange(() => {
168
168
  this.#F();
169
169
  });
170
170
  }
@@ -367,11 +367,11 @@ class Bo {
367
367
  reason: `the ${s.name} accelerator does not implement "${t.capability}"`
368
368
  };
369
369
  }
370
- const o = fo[t.capability];
370
+ const o = mo[t.capability];
371
371
  return o !== void 0 && !this.#E && !n && t.nodeCount < o ? {
372
372
  accelerated: !1,
373
- reason: `the graph has ${String(t.nodeCount)} nodes, below the ${String(o)} at which an accelerated "${t.capability}" was measured to beat the CPU path (${mo}); set ${xe} to override`
374
- } : { accelerated: !0, accelerator: s, precision: s.precision ?? go };
373
+ reason: `the graph has ${String(t.nodeCount)} nodes, below the ${String(o)} at which an accelerated "${t.capability}" was measured to beat the CPU path (${go}); set ${xe} to override`
374
+ } : { accelerated: !0, accelerator: s, precision: s.precision ?? po };
375
375
  }
376
376
  /**
377
377
  * Runs one piece of work on the accelerator when {@link plan} says it belongs there.
@@ -482,7 +482,7 @@ class Bo {
482
482
  source: "acceleration",
483
483
  details: { accelerator: o.name }
484
484
  });
485
- s = Lo(i) ?? s, n.push(`${o.name}: ${i.message}`);
485
+ s = Uo(i) ?? s, n.push(`${o.name}: ${i.message}`);
486
486
  }
487
487
  return this.#l = n.join("; "), this.#u = s, !1;
488
488
  }
@@ -502,7 +502,7 @@ class Bo {
502
502
  try {
503
503
  return { accelerator: await t({ exactMaxNodes: n, acceptSoftware: !1 }), software: !1 };
504
504
  } catch (s) {
505
- if (this.#s !== "required" || this.#a || !Uo(s))
505
+ if (this.#s !== "required" || this.#a || !Bo(s))
506
506
  throw s;
507
507
  }
508
508
  return { accelerator: await t({ exactMaxNodes: n, acceptSoftware: !0 }), software: !0 };
@@ -642,7 +642,7 @@ class Bo {
642
642
  * @returns The error to throw.
643
643
  */
644
644
  #U(t, n, s, o) {
645
- if (Fo(t))
645
+ if (Vo(t))
646
646
  return t;
647
647
  const r = _.wrap(t, {
648
648
  code: "E_INTERNAL",
@@ -727,13 +727,13 @@ class Bo {
727
727
  #c(t, n, s) {
728
728
  this.#d = t, this.#l = n, this.#u = s;
729
729
  const o = this.#D();
730
- if (!Vo(this.#g, o)) {
730
+ if (!qo(this.#g, o)) {
731
731
  this.#g = o, this.#C = Object.freeze({ acceleration: o });
732
732
  for (const r of [...this.#e])
733
733
  try {
734
734
  r(o);
735
735
  } catch (i) {
736
- zo.error(
736
+ Fo.error(
737
737
  "An acceleration status listener threw",
738
738
  i instanceof Error ? i : new Error(String(i)),
739
739
  { state: o.state }
@@ -750,30 +750,30 @@ class Bo {
750
750
  return this.#y !== void 0 && (t.backend = this.#y), this.#f !== void 0 && (this.#f.vendor !== "" && (t.vendor = this.#f.vendor), this.#f.architecture !== "" && (t.architecture = this.#f.architecture), this.#f.description !== "" && (t.device = this.#f.description)), this.#l !== void 0 && (t.reason = this.#l), this.#u !== void 0 && (t.code = this.#u), Object.freeze(t);
751
751
  }
752
752
  }
753
- function qo(e) {
753
+ function Wo(e) {
754
754
  return String(e);
755
755
  }
756
- function gs(e) {
756
+ function ps(e) {
757
757
  if (!/^\d+$/.test(e))
758
758
  return G;
759
759
  const t = Number(e);
760
760
  return Number.isSafeInteger(t) ? t : G;
761
761
  }
762
- const nn = "graphty.importPosition", Go = "graphty.edgeId", Wo = "graphty.pinned";
763
- class Yo {
762
+ const tn = "graphty.importPosition", Yo = "graphty.edgeId", Ho = "graphty.pinned";
763
+ class Ko {
764
764
  /**
765
765
  * Build the empty store: one builder, one position array, the two element columns.
766
766
  * @param options - the store's configuration and its three freeze callbacks
767
767
  */
768
768
  constructor(t) {
769
- this.positions = new so(), this.undirectedCache = /* @__PURE__ */ new WeakMap(), this.cache = null, this.cachedRevision = -1, this.revision = 0, this.edgeIdCounter = 0, this.pending = null, this.pendingPositions = null, this.publishing = !1, this.disposed = !1, this.seeded = 0, this.direction = { by: "unsettled", statedBy: null }, this.options = t, this.builder = new Xs({ directed: !0, addMissingNodes: !0 }), typeof t.directed == "boolean" && (this.direction = { by: "configuration", statedBy: null }, this.builder.setDirected(t.directed), this.builder.lockDirected()), this.seedColumn = this.builder.declareNodeColumn({
770
- name: nn,
769
+ this.positions = new oo(), this.undirectedCache = /* @__PURE__ */ new WeakMap(), this.cache = null, this.cachedRevision = -1, this.revision = 0, this.edgeIdCounter = 0, this.pending = null, this.pendingPositions = null, this.publishing = !1, this.disposed = !1, this.seeded = 0, this.direction = { by: "unsettled", statedBy: null }, this.options = t, this.builder = new Js({ directed: !0, addMissingNodes: !0 }), typeof t.directed == "boolean" && (this.direction = { by: "configuration", statedBy: null }, this.builder.setDirected(t.directed), this.builder.lockDirected()), this.seedColumn = this.builder.declareNodeColumn({
770
+ name: tn,
771
771
  dtype: "f32",
772
772
  components: it,
773
773
  role: "position",
774
774
  mutable: !1
775
775
  }), this.edgeIdColumn = this.builder.declareEdgeColumn({
776
- name: Go,
776
+ name: Yo,
777
777
  dtype: "u32",
778
778
  role: "id",
779
779
  unique: !0
@@ -930,7 +930,7 @@ class Yo {
930
930
  this.positions.view(n.nodeCount),
931
931
  { dtype: "f32", components: it, role: "position", mutable: !0 },
932
932
  { replaceRole: !0 }
933
- ), n.nodes.set(Wo, this.positions.pinnedView(n.nodeCount), {
933
+ ), n.nodes.set(Ho, this.positions.pinnedView(n.nodeCount), {
934
934
  dtype: "u8",
935
935
  mutable: !0
936
936
  }), this.pendingPositions = null;
@@ -1028,7 +1028,7 @@ class Yo {
1028
1028
  return this.getSnapshot(), this.seeded;
1029
1029
  }
1030
1030
  seedUnplaced(t) {
1031
- const n = t.nodes.requireTyped(nn, "f32"), { data: s } = n, o = this.options.positionScale();
1031
+ const n = t.nodes.requireTyped(tn, "f32"), { data: s } = n, o = this.options.positionScale();
1032
1032
  let r = 0;
1033
1033
  for (let i = 0; i < t.nodeCount; i++) {
1034
1034
  if (n.isSet(i) && r++, this.positions.isPlaced(i) || !n.isSet(i))
@@ -1039,7 +1039,7 @@ class Yo {
1039
1039
  this.seeded = r;
1040
1040
  }
1041
1041
  }
1042
- const Ho = 1024, Y = 1, se = 0;
1042
+ const Qo = 1024, Y = 1, se = 0;
1043
1043
  function ct(e, t) {
1044
1044
  if (!Number.isInteger(e) || e < 0)
1045
1045
  throw new RangeError(`ElementMask: ${t} must be a non-negative integer, found ${String(e)}`);
@@ -1054,7 +1054,7 @@ class te {
1054
1054
  * @param capacity - Rows to reserve before the first growth; a non-negative integer.
1055
1055
  * @throws A `RangeError` when `capacity` is not a non-negative integer.
1056
1056
  */
1057
- constructor(t, n = Ho) {
1057
+ constructor(t, n = Qo) {
1058
1058
  this.rows = 0, this.members = 0, this.revision = 0, this.cachedIds = null, this.cachedRevision = -1, this.cachedSpace = null, ct(n, "capacity"), this.readSpace = t, this.array = new Uint8Array(Math.max(1, n));
1059
1059
  }
1060
1060
  /**
@@ -1126,7 +1126,7 @@ class te {
1126
1126
  * @throws A `RangeError` when `count` is not a non-negative integer.
1127
1127
  */
1128
1128
  remap(t, n) {
1129
- ct(n, "count"), this.array = Js(this.array, t, n, se), this.rows = n, this.members = this.countMembers(), this.revision += 1;
1129
+ ct(n, "count"), this.array = Zs(this.array, t, n, se), this.rows = n, this.members = this.countMembers(), this.revision += 1;
1130
1130
  }
1131
1131
  /**
1132
1132
  * Whether one row is in the set.
@@ -1305,32 +1305,32 @@ class te {
1305
1305
  }
1306
1306
  }
1307
1307
  const wt = /^[a-z][a-z0-9_-]*$/;
1308
- function Hu(e) {
1308
+ function Xu(e) {
1309
1309
  return typeof e == "string" && wt.test(e);
1310
1310
  }
1311
- const Ko = ["queued", "running", "succeeded", "failed", "canceled"], Qo = Object.freeze(["succeeded", "failed", "canceled"]);
1312
- function Ku(e) {
1313
- return typeof e == "string" && Ko.includes(e);
1311
+ const Xo = ["queued", "running", "succeeded", "failed", "canceled"], Jo = Object.freeze(["succeeded", "failed", "canceled"]);
1312
+ function Ju(e) {
1313
+ return typeof e == "string" && Xo.includes(e);
1314
1314
  }
1315
1315
  function Ot(e) {
1316
- return Qo.includes(e);
1316
+ return Jo.includes(e);
1317
1317
  }
1318
- const Qu = ["queued", "start", "progress", "end"], Xu = ["append", "replace", "now"], Xo = 16777619, Jo = 2166136261, Zo = 2646966556, sn = 7, on = 36;
1319
- function rn(e, t) {
1318
+ const Zu = ["queued", "start", "progress", "end"], ed = ["append", "replace", "now"], Zo = 16777619, er = 2166136261, tr = 2646966556, nn = 7, sn = 36;
1319
+ function on(e, t) {
1320
1320
  let n = t >>> 0;
1321
1321
  for (let s = 0; s < e.length; s++)
1322
- n ^= e.charCodeAt(s), n = Math.imul(n, Xo) >>> 0;
1322
+ n ^= e.charCodeAt(s), n = Math.imul(n, Zo) >>> 0;
1323
1323
  return n >>> 0;
1324
1324
  }
1325
- function er(e) {
1326
- const t = rn(e, Jo).toString(on).padStart(sn, "0"), n = rn(e, Zo).toString(on).padStart(sn, "0");
1325
+ function nr(e) {
1326
+ const t = on(e, er).toString(sn).padStart(nn, "0"), n = on(e, tr).toString(sn).padStart(nn, "0");
1327
1327
  return `${t}${n}`;
1328
1328
  }
1329
- function tr(e) {
1329
+ function sr(e) {
1330
1330
  const t = Object.getPrototypeOf(e);
1331
1331
  return t === null || t === Object.prototype;
1332
1332
  }
1333
- function nr(e) {
1333
+ function or(e) {
1334
1334
  return Number.isNaN(e) ? "NaN" : e === 0 ? "0" : String(e);
1335
1335
  }
1336
1336
  function ie(e) {
@@ -1341,7 +1341,7 @@ function ie(e) {
1341
1341
  if (typeof e == "string")
1342
1342
  return JSON.stringify(e);
1343
1343
  if (typeof e == "number")
1344
- return nr(e);
1344
+ return or(e);
1345
1345
  if (typeof e == "boolean")
1346
1346
  return e ? "true" : "false";
1347
1347
  if (typeof e == "bigint")
@@ -1350,7 +1350,7 @@ function ie(e) {
1350
1350
  return `Date(${e.toISOString()})`;
1351
1351
  if (Array.isArray(e))
1352
1352
  return `[${e.map((t) => ie(t)).join(",")}]`;
1353
- if (typeof e == "object" && tr(e))
1353
+ if (typeof e == "object" && sr(e))
1354
1354
  return `{${Object.entries(e).filter(([, n]) => n !== void 0).sort(([n], [s]) => n < s ? -1 : 1).map(([n, s]) => `${JSON.stringify(n)}:${ie(s)}`).join(",")}}`;
1355
1355
  throw new _({
1356
1356
  code: "E_BAD_COMMAND",
@@ -1359,7 +1359,7 @@ function ie(e) {
1359
1359
  details: { type: typeof e }
1360
1360
  });
1361
1361
  }
1362
- function sr(e, t) {
1362
+ function rr(e, t) {
1363
1363
  const n = /* @__PURE__ */ new Map();
1364
1364
  for (const o of t)
1365
1365
  o.default !== void 0 && n.set(o.name, o.default);
@@ -1370,7 +1370,7 @@ function sr(e, t) {
1370
1370
  s[o] = n.get(o);
1371
1371
  return Object.freeze(s);
1372
1372
  }
1373
- function or(e) {
1373
+ function ir(e) {
1374
1374
  const t = e.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^[^a-z]+/, "").replace(/[-_]+$/, "");
1375
1375
  return t === "" ? "run" : t;
1376
1376
  }
@@ -1385,9 +1385,9 @@ function Et(e) {
1385
1385
  });
1386
1386
  }
1387
1387
  function Ge(e) {
1388
- return `${or(e.algorithm)}_${er(Et(e))}`;
1388
+ return `${ir(e.algorithm)}_${nr(Et(e))}`;
1389
1389
  }
1390
- function rr(e) {
1390
+ function ar(e) {
1391
1391
  if (!wt.test(e))
1392
1392
  throw new _({
1393
1393
  code: "E_BAD_COMMAND",
@@ -1397,30 +1397,30 @@ function rr(e) {
1397
1397
  });
1398
1398
  return e;
1399
1399
  }
1400
- const ir = 1e4, Nt = 16777619, ar = 461845907, cr = 3432918353, lr = 2166136261, ur = 2246822507, an = 8;
1401
- function dr(e, t) {
1400
+ const cr = 1e4, Nt = 16777619, lr = 461845907, ur = 3432918353, dr = 2166136261, hr = 2246822507, rn = 8;
1401
+ function fr(e, t) {
1402
1402
  const n = typeof e == "number" ? `#${e}` : `$${e}`;
1403
1403
  let s = t >>> 0;
1404
1404
  for (let o = 0; o < n.length; o++)
1405
1405
  s ^= n.charCodeAt(o), s = Math.imul(s, Nt) >>> 0;
1406
1406
  return s >>> 0;
1407
1407
  }
1408
- function cn(e, t) {
1408
+ function an(e, t) {
1409
1409
  let n = 0, s = 0;
1410
1410
  for (const o of e) {
1411
- const r = dr(o, t);
1411
+ const r = fr(o, t);
1412
1412
  n = (n ^ r) >>> 0, s = s + r >>> 0;
1413
1413
  }
1414
1414
  return { count: e.length, xor: n, sum: s };
1415
1415
  }
1416
- function ps(e, t) {
1417
- const n = cn(e, ar), s = cn(t, cr);
1418
- let o = lr, r = Nt;
1416
+ function bs(e, t) {
1417
+ const n = an(e, lr), s = an(t, ur);
1418
+ let o = dr, r = Nt;
1419
1419
  for (const i of [n.count, n.xor, n.sum, s.count, s.xor, s.sum])
1420
- o = Math.imul(o ^ i >>> 0, Nt) >>> 0, r = Math.imul(r ^ o + i, ur) >>> 0;
1421
- return o.toString(16).padStart(an, "0") + r.toString(16).padStart(an, "0");
1420
+ o = Math.imul(o ^ i >>> 0, Nt) >>> 0, r = Math.imul(r ^ o + i, hr) >>> 0;
1421
+ return o.toString(16).padStart(rn, "0") + r.toString(16).padStart(rn, "0");
1422
1422
  }
1423
- function Bt(e) {
1423
+ function Vt(e) {
1424
1424
  return {
1425
1425
  indexOf: (t) => e.ids.indexOf(t),
1426
1426
  idOf: (t) => e.ids.idOf(t)
@@ -1430,12 +1430,12 @@ function Ee(e) {
1430
1430
  const t = e.edges.byRole("id");
1431
1431
  return {
1432
1432
  indexOf: (n) => {
1433
- const s = gs(n);
1433
+ const s = ps(n);
1434
1434
  return s === G ? G : e.edgeIndexOf(s);
1435
1435
  },
1436
1436
  idOf: (n) => {
1437
1437
  const s = t !== null && t.isSet(n) ? t.value(n) : void 0;
1438
- return qo(typeof s == "number" ? s : G);
1438
+ return Wo(typeof s == "number" ? s : G);
1439
1439
  }
1440
1440
  };
1441
1441
  }
@@ -1447,7 +1447,7 @@ function lt(e, t) {
1447
1447
  details: { scope: e, needs: t }
1448
1448
  });
1449
1449
  }
1450
- function hr(e) {
1450
+ function mr(e) {
1451
1451
  return new _({
1452
1452
  code: "E_BAD_COMMAND",
1453
1453
  message: 'A scope is "visible", "graph", "selection", "largest-component", { set }, { where } or { nodes }.',
@@ -1455,21 +1455,21 @@ function hr(e) {
1455
1455
  details: { scope: e }
1456
1456
  });
1457
1457
  }
1458
- function ln(e) {
1458
+ function cn(e) {
1459
1459
  return typeof e == "object" && "where" in e;
1460
1460
  }
1461
- function fr(e) {
1461
+ function gr(e) {
1462
1462
  return typeof e == "string" ? e === "visible" || e === "graph" || e === "selection" || e === "largest-component" : typeof e != "object" || e === null ? !1 : "set" in e ? typeof e.set == "string" : "where" in e ? typeof e.where == "string" : "nodes" in e && Array.isArray(e.nodes);
1463
1463
  }
1464
1464
  function ut(e) {
1465
- if (!fr(e))
1466
- throw hr(e);
1465
+ if (!gr(e))
1466
+ throw mr(e);
1467
1467
  }
1468
- function mr(e) {
1468
+ function pr(e) {
1469
1469
  const t = e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
1470
1470
  return t === "" ? "set" : t;
1471
1471
  }
1472
- function gr(e) {
1472
+ function br(e) {
1473
1473
  const t = /* @__PURE__ */ new Map();
1474
1474
  let n = 0, s = null, o = "";
1475
1475
  const r = () => {
@@ -1479,7 +1479,7 @@ function gr(e) {
1479
1479
  const d = e.snapshot(), p = r();
1480
1480
  return (s === null || s.graph !== d || p !== o) && (o = p, s = {
1481
1481
  graph: d,
1482
- nodeSpace: Bt(d),
1482
+ nodeSpace: Vt(d),
1483
1483
  edgeSpace: Ee(d),
1484
1484
  nodes: /* @__PURE__ */ new Map(),
1485
1485
  resolved: /* @__PURE__ */ new Map()
@@ -1546,7 +1546,7 @@ function gr(e) {
1546
1546
  const { nodeSpace: $ } = O, A = new te(() => $, Math.max(1, O.graph.nodeCount));
1547
1547
  A.grow(O.graph.nodeCount);
1548
1548
  const S = l(d, A, /* @__PURE__ */ new Set()), j = { mask: A, edgeConstraint: S };
1549
- return ln(d) || O.nodes.set(p, j), j;
1549
+ return cn(d) || O.nodes.set(p, j), j;
1550
1550
  }, h = (d, p, O, T) => !d.mask.has(O) || !d.mask.has(T) ? !1 : d.edgeConstraint === null || d.edgeConstraint.has(p), y = (d, p) => {
1551
1551
  const { edgeSpace: O, graph: T } = p, $ = new te(() => O, Math.max(1, T.edgeCount));
1552
1552
  $.grow(T.edgeCount);
@@ -1561,9 +1561,9 @@ function gr(e) {
1561
1561
  const $ = g(d), A = y($, O), S = $.mask.ids(), j = A.ids(), f = {
1562
1562
  nodes: new Set(S),
1563
1563
  edges: new Set(j),
1564
- digest: ps(S, j)
1564
+ digest: bs(S, j)
1565
1565
  };
1566
- return ln(d) || O.resolved.set(p, f), f;
1566
+ return cn(d) || O.resolved.set(p, f), f;
1567
1567
  }, F = (d, p) => {
1568
1568
  const O = p.edgeList();
1569
1569
  let T = 0;
@@ -1616,7 +1616,7 @@ function gr(e) {
1616
1616
  },
1617
1617
  count(d, p = {}) {
1618
1618
  ut(d);
1619
- const O = p.sample ?? ir;
1619
+ const O = p.sample ?? cr;
1620
1620
  if (!Number.isInteger(O) || O <= 0)
1621
1621
  throw new _({
1622
1622
  code: "E_OPTION_RANGE",
@@ -1656,7 +1656,7 @@ function gr(e) {
1656
1656
  target: { kind: "scope", id: p.set },
1657
1657
  details: { scope: p, available: [...t.keys()] }
1658
1658
  });
1659
- const T = `set_${mr(O)}`;
1659
+ const T = `set_${pr(O)}`;
1660
1660
  let $ = T, A = 2;
1661
1661
  for (; t.has($); )
1662
1662
  $ = `${T}_${A}`, A += 1;
@@ -1687,7 +1687,7 @@ function gr(e) {
1687
1687
  }
1688
1688
  };
1689
1689
  }
1690
- const un = 1e3, pr = 5, bs = 256, br = 1, dn = 3, vr = "all", re = Object.freeze([]), ce = Object.freeze([]);
1690
+ const ln = 1e3, vr = 5, vs = 256, yr = 1, un = 3, wr = "all", re = Object.freeze([]), ce = Object.freeze([]);
1691
1691
  function Te(e, t) {
1692
1692
  return new _({
1693
1693
  code: "E_UNSUPPORTED",
@@ -1704,7 +1704,7 @@ function je(e) {
1704
1704
  details: { target: e }
1705
1705
  });
1706
1706
  }
1707
- function vs(e, t, n) {
1707
+ function ys(e, t, n) {
1708
1708
  return new _({
1709
1709
  code: "E_OPTION_RANGE",
1710
1710
  message: `A selection's ${e} is ${n}, not ${String(t)}.`,
@@ -1718,7 +1718,7 @@ function le(e, t) {
1718
1718
  s !== G && e.add(s);
1719
1719
  }
1720
1720
  }
1721
- function hn(e, t, n, s) {
1721
+ function dn(e, t, n, s) {
1722
1722
  if (t === void 0)
1723
1723
  return;
1724
1724
  if (e.scope === void 0)
@@ -1726,7 +1726,7 @@ function hn(e, t, n, s) {
1726
1726
  const o = e.scope.resolveNow(t), r = ee(e);
1727
1727
  le(r.nodes, o.nodes), le(r.edges, o.edges), n.intersect(r.nodes), s.intersect(r.edges);
1728
1728
  }
1729
- function yr(e) {
1729
+ function Or(e) {
1730
1730
  const t = /^([A-Za-z_][\w.]*):/.exec(e);
1731
1731
  if (t === null)
1732
1732
  return { text: e, mode: "substring" };
@@ -1737,13 +1737,13 @@ function ee(e) {
1737
1737
  const { graph: t, nodeSpace: n, edgeSpace: s } = e, o = new te(() => n, Math.max(1, t.nodeCount)), r = new te(() => s, Math.max(1, t.edgeCount));
1738
1738
  return o.grow(t.nodeCount), r.grow(t.edgeCount), { nodes: o, edges: r };
1739
1739
  }
1740
- function wr(e) {
1740
+ function Er(e) {
1741
1741
  return "neighborsOf" in e || "depth" in e || "direction" in e;
1742
1742
  }
1743
- function Or(e) {
1743
+ function Nr(e) {
1744
1744
  return "nodes" in e || "edges" in e;
1745
1745
  }
1746
- function Er(e, t, n) {
1746
+ function Sr(e, t, n) {
1747
1747
  const s = e.trim(), o = [e];
1748
1748
  s !== e && o.push(s), s !== "" && Number.isFinite(Number(s)) && o.push(Number(s));
1749
1749
  for (const r of o) {
@@ -1758,14 +1758,14 @@ function Er(e, t, n) {
1758
1758
  }
1759
1759
  return !1;
1760
1760
  }
1761
- function Nr(e) {
1761
+ function Ar(e) {
1762
1762
  if (e === void 0)
1763
- return br;
1764
- if (!Number.isInteger(e) || e < 1 || e > dn)
1765
- throw vs("depth", e, `a whole number of steps from 1 to ${String(dn)}`);
1763
+ return yr;
1764
+ if (!Number.isInteger(e) || e < 1 || e > un)
1765
+ throw ys("depth", e, `a whole number of steps from 1 to ${String(un)}`);
1766
1766
  return e;
1767
1767
  }
1768
- function Sr(e, t, n, s, o) {
1768
+ function Cr(e, t, n, s, o) {
1769
1769
  const r = o !== "in" || !t.directed, a = t.directed && o !== "out" ? t.reverse() : null;
1770
1770
  let c = n;
1771
1771
  for (let l = 0; l < s && c.length > 0; l++) {
@@ -1781,8 +1781,8 @@ function Sr(e, t, n, s, o) {
1781
1781
  c = g;
1782
1782
  }
1783
1783
  }
1784
- function Ar(e, t) {
1785
- const { nodes: n, edges: s } = ee(t), o = Nr(e.depth), r = [];
1784
+ function _r(e, t) {
1785
+ const { nodes: n, edges: s } = ee(t), o = Ar(e.depth), r = [];
1786
1786
  if (e.neighborsOf === void 0)
1787
1787
  for (let i = 0; i < t.selectedNodes.count; i++)
1788
1788
  t.selectedNodes.has(i) && n.add(i) && r.push(i);
@@ -1791,9 +1791,9 @@ function Ar(e, t) {
1791
1791
  const a = n.indexOf(i);
1792
1792
  a !== G && n.add(a) && r.push(a);
1793
1793
  }
1794
- return Sr(n, t.graph, r, o, e.direction ?? vr), { nodes: n, edges: s, unmatched: re, unresolvedPaths: ce };
1794
+ return Cr(n, t.graph, r, o, e.direction ?? wr), { nodes: n, edges: s, unmatched: re, unresolvedPaths: ce };
1795
1795
  }
1796
- function Cr(e, t, n) {
1796
+ function Ir(e, t, n) {
1797
1797
  const s = e.fields.find((o) => o.name === t);
1798
1798
  if (s === void 0 || s.kind === "graph")
1799
1799
  throw new _({
@@ -1804,14 +1804,14 @@ function Cr(e, t, n) {
1804
1804
  });
1805
1805
  return s.kind;
1806
1806
  }
1807
- function fn(e, t, n, s) {
1807
+ function hn(e, t, n, s) {
1808
1808
  const { results: o } = e;
1809
1809
  if (o === void 0)
1810
1810
  throw Te("a run's result", "a results registry");
1811
1811
  const { nodes: r, edges: i } = ee(e), a = o.get(t);
1812
1812
  if (a === void 0 || !o.has(t, n))
1813
1813
  return { nodes: r, edges: i, unmatched: re, unresolvedPaths: Object.freeze([o.path(t, n)]) };
1814
- const c = Cr(a, n, o.path(t, n));
1814
+ const c = Ir(a, n, o.path(t, n));
1815
1815
  for (const l of s(a))
1816
1816
  if (c === "edge") {
1817
1817
  const g = i.indexOf(String(l.id));
@@ -1822,14 +1822,14 @@ function fn(e, t, n, s) {
1822
1822
  }
1823
1823
  return { nodes: r, edges: i, unmatched: re, unresolvedPaths: ce };
1824
1824
  }
1825
- function ys(e, t) {
1825
+ function ws(e, t) {
1826
1826
  if (typeof e != "object" || e === null)
1827
1827
  throw je(e);
1828
1828
  if ("where" in e) {
1829
1829
  if (t.match === void 0)
1830
1830
  throw Te("a predicate", "a query engine");
1831
1831
  const { nodes: n, edges: s } = ee(t), o = t.match(e.where);
1832
- return le(n, o.nodes ?? []), le(s, o.edges ?? []), hn(t, e.scope, n, s), {
1832
+ return le(n, o.nodes ?? []), le(s, o.edges ?? []), dn(t, e.scope, n, s), {
1833
1833
  nodes: n,
1834
1834
  edges: s,
1835
1835
  unmatched: re,
@@ -1839,11 +1839,11 @@ function ys(e, t) {
1839
1839
  if ("text" in e) {
1840
1840
  if (e.mode === void 0 && e.text.startsWith("=")) {
1841
1841
  const r = e.text.slice(1);
1842
- return ys(e.scope === void 0 ? { where: r } : { where: r, scope: e.scope }, t);
1842
+ return ws(e.scope === void 0 ? { where: r } : { where: r, scope: e.scope }, t);
1843
1843
  }
1844
1844
  if (t.find === void 0)
1845
1845
  throw Te("a text search", "a search index");
1846
- const { nodes: n, edges: s } = ee(t), o = e.mode === void 0 ? yr(e.text) : { text: e.text, mode: e.mode };
1846
+ const { nodes: n, edges: s } = ee(t), o = e.mode === void 0 ? Or(e.text) : { text: e.text, mode: e.mode };
1847
1847
  for (const r of t.find(o.text, o.mode))
1848
1848
  if (r.kind === "edge") {
1849
1849
  const i = s.indexOf(String(r.id));
@@ -1852,12 +1852,12 @@ function ys(e, t) {
1852
1852
  const i = n.indexOf(r.id);
1853
1853
  i !== G && n.add(i);
1854
1854
  }
1855
- return hn(t, e.scope, n, s), { nodes: n, edges: s, unmatched: re, unresolvedPaths: ce };
1855
+ return dn(t, e.scope, n, s), { nodes: n, edges: s, unmatched: re, unresolvedPaths: ce };
1856
1856
  }
1857
1857
  if ("ids" in e) {
1858
1858
  const { nodes: n, edges: s } = ee(t), o = [];
1859
1859
  for (const r of e.ids)
1860
- Er(r, n, s) || o.push(r);
1860
+ Sr(r, n, s) || o.push(r);
1861
1861
  return { nodes: n, edges: s, unmatched: Object.freeze(o), unresolvedPaths: ce };
1862
1862
  }
1863
1863
  if ("scope" in e) {
@@ -1868,13 +1868,13 @@ function ys(e, t) {
1868
1868
  }
1869
1869
  if ("top" in e) {
1870
1870
  const { run: n, field: s, n: o } = e.top;
1871
- return fn(t, n, s, (r) => r.top(s, o).entries);
1871
+ return hn(t, n, s, (r) => r.top(s, o).entries);
1872
1872
  }
1873
1873
  if ("above" in e) {
1874
1874
  const { run: n, field: s, threshold: o } = e.above;
1875
1875
  if (!Number.isFinite(o))
1876
- throw vs("threshold", o, "a finite number");
1877
- return fn(
1876
+ throw ys("threshold", o, "a finite number");
1877
+ return hn(
1878
1878
  t,
1879
1879
  n,
1880
1880
  s,
@@ -1895,39 +1895,39 @@ function ys(e, t) {
1895
1895
  const { nodes: s, edges: o } = ee(t);
1896
1896
  return s.fill(), s.subtract(t.selectedNodes), o.fill(), o.subtract(t.selectedEdges), { nodes: s, edges: o, unmatched: re, unresolvedPaths: ce };
1897
1897
  }
1898
- if (wr(e))
1899
- return Ar(e, t);
1900
- if (Or(e)) {
1898
+ if (Er(e))
1899
+ return _r(e, t);
1900
+ if (Nr(e)) {
1901
1901
  const { nodes: n, edges: s } = ee(t);
1902
1902
  return le(n, e.nodes ?? []), le(s, e.edges ?? []), { nodes: n, edges: s, unmatched: re, unresolvedPaths: ce };
1903
1903
  }
1904
1904
  throw je(e);
1905
1905
  }
1906
- const ws = 5e3, mn = 1, _r = Object.freeze([]), Ir = Object.freeze([]), dt = Object.freeze(["replace", "add", "remove", "toggle", "intersect"]);
1907
- function gn(e) {
1908
- return { graph: e, nodeSpace: Bt(e), edgeSpace: Ee(e) };
1906
+ const Os = 5e3, fn = 1, Tr = Object.freeze([]), Pr = Object.freeze([]), dt = Object.freeze(["replace", "add", "remove", "toggle", "intersect"]);
1907
+ function mn(e) {
1908
+ return { graph: e, nodeSpace: Vt(e), edgeSpace: Ee(e) };
1909
1909
  }
1910
- function Tr(e, t) {
1910
+ function $r(e, t) {
1911
1911
  if (typeof t == "number" && Number.isFinite(t) ? e.numbers.push(t) : e.nonNumeric = !0, e.tooMany)
1912
1912
  return;
1913
1913
  const n = String(t), s = e.counts.get(n);
1914
- if (s === void 0 && e.counts.size >= bs) {
1914
+ if (s === void 0 && e.counts.size >= vs) {
1915
1915
  e.tooMany = !0, e.counts.clear();
1916
1916
  return;
1917
1917
  }
1918
1918
  e.counts.set(n, (s ?? 0) + 1);
1919
1919
  }
1920
- function Pr() {
1920
+ function kr() {
1921
1921
  return { numbers: [], counts: /* @__PURE__ */ new Map(), nonNumeric: !1, tooMany: !1 };
1922
1922
  }
1923
- function $r(e) {
1923
+ function Mr(e) {
1924
1924
  const t = [...e].map(([n, s]) => ({ value: n, count: s }));
1925
1925
  return t.sort((n, s) => s.count - n.count || n.value.localeCompare(s.value)), Object.freeze(t.map((n) => Object.freeze(n)));
1926
1926
  }
1927
- function kr(e, t) {
1927
+ function Rr(e, t) {
1928
1928
  return e > t ? "above" : e < t ? "below" : "equal";
1929
1929
  }
1930
- class Mr {
1930
+ class Dr {
1931
1931
  #i;
1932
1932
  #e;
1933
1933
  #t;
@@ -1950,7 +1950,7 @@ class Mr {
1950
1950
  constructor(t) {
1951
1951
  this.#i = t;
1952
1952
  const n = t.snapshot();
1953
- this.#n = gn(n), this.#e = new te(() => this.#n.nodeSpace, Math.max(1, n.nodeCount)), this.#t = new te(() => this.#n.edgeSpace, Math.max(1, n.edgeCount)), this.#e.grow(n.nodeCount), this.#t.grow(n.edgeCount);
1953
+ this.#n = mn(n), this.#e = new te(() => this.#n.nodeSpace, Math.max(1, n.nodeCount)), this.#t = new te(() => this.#n.edgeSpace, Math.max(1, n.edgeCount)), this.#e.grow(n.nodeCount), this.#t.grow(n.edgeCount);
1954
1954
  }
1955
1955
  /**
1956
1956
  * The selected node ids, frozen and identity-stable.
@@ -2069,8 +2069,8 @@ class Mr {
2069
2069
  * `E_OPTION_RANGE` when one of the target's options is outside the permitted range.
2070
2070
  */
2071
2071
  applyNow(t, n = "replace", s = "api") {
2072
- this.#o(), Dr(n);
2073
- const o = this.#m(), r = ys(t, this.#s()), i = this.#d();
2072
+ this.#o(), jr(n);
2073
+ const o = this.#m(), r = ws(t, this.#s()), i = this.#d();
2074
2074
  return n === "replace" && (this.#e.clear(), this.#t.clear()), n === "replace" || n === "add" ? (this.#e.union(r.nodes), this.#t.union(r.edges)) : n === "remove" ? (this.#e.subtract(r.nodes), this.#t.subtract(r.edges)) : n === "toggle" ? (this.#e.symmetricDifference(r.nodes), this.#t.symmetricDifference(r.edges)) : (this.#e.intersect(r.nodes), this.#t.intersect(r.edges)), this.#b = this.#E(o), this.#l(i, r.unmatched, r.unresolvedPaths, s);
2075
2075
  }
2076
2076
  /**
@@ -2080,7 +2080,7 @@ class Mr {
2080
2080
  clear() {
2081
2081
  this.#o();
2082
2082
  const t = this.#d();
2083
- return this.#e.clear(), this.#t.clear(), this.#b = !1, this.#l(t, _r, Ir, "api");
2083
+ return this.#e.clear(), this.#t.clear(), this.#b = !1, this.#l(t, Tr, Pr, "api");
2084
2084
  }
2085
2085
  /**
2086
2086
  * Keep this selection under a name, as a saved scope over its nodes.
@@ -2140,7 +2140,7 @@ class Mr {
2140
2140
  */
2141
2141
  #o() {
2142
2142
  const t = this.#i.snapshot();
2143
- t !== this.#n.graph && (this.#n = gn(t)), this.#p = !1, this.#e.count !== t.nodeCount && this.#e.grow(t.nodeCount), this.#t.count !== t.edgeCount && this.#t.grow(t.edgeCount);
2143
+ t !== this.#n.graph && (this.#n = mn(t)), this.#p = !1, this.#e.count !== t.nodeCount && this.#e.grow(t.nodeCount), this.#t.count !== t.edgeCount && this.#t.grow(t.edgeCount);
2144
2144
  }
2145
2145
  /**
2146
2146
  * What a target resolution reads.
@@ -2166,7 +2166,7 @@ class Mr {
2166
2166
  * @throws A `GraphtyError` coded `E_OPTION_RANGE` when the session's cap is not one.
2167
2167
  */
2168
2168
  #m() {
2169
- const t = this.#i.cap?.() ?? ws;
2169
+ const t = this.#i.cap?.() ?? Os;
2170
2170
  if (!Number.isInteger(t) || t < 0)
2171
2171
  throw new _({
2172
2172
  code: "E_OPTION_RANGE",
@@ -2216,11 +2216,11 @@ class Mr {
2216
2216
  #l(t, n, s, o) {
2217
2217
  const r = [], i = [], { nodeSpace: a, edgeSpace: c } = this.#n;
2218
2218
  for (let g = 0; g < this.#e.count; g++) {
2219
- const h = g < t.nodes.length && t.nodes[g] === mn, y = this.#e.has(g);
2219
+ const h = g < t.nodes.length && t.nodes[g] === fn, y = this.#e.has(g);
2220
2220
  y && !h ? r.push(a.idOf(g)) : h && !y && i.push(a.idOf(g));
2221
2221
  }
2222
2222
  for (let g = 0; g < this.#t.count; g++) {
2223
- const h = g < t.edges.length && t.edges[g] === mn, y = this.#t.has(g);
2223
+ const h = g < t.edges.length && t.edges[g] === fn, y = this.#t.has(g);
2224
2224
  y && !h ? r.push(c.idOf(g)) : h && !y && i.push(c.idOf(g));
2225
2225
  }
2226
2226
  const l = Object.freeze({
@@ -2257,7 +2257,7 @@ class Mr {
2257
2257
  if (g == null)
2258
2258
  continue;
2259
2259
  let h = s.get(l);
2260
- h === void 0 && (h = Pr(), s.set(l, h)), Tr(h, g);
2260
+ h === void 0 && (h = kr(), s.set(l, h)), $r(h, g);
2261
2261
  }
2262
2262
  }
2263
2263
  const o = /* @__PURE__ */ new Set();
@@ -2265,7 +2265,7 @@ class Mr {
2265
2265
  !c.nonNumeric && c.numbers.length > 0 && o.add(a);
2266
2266
  const r = this.#y(t, o), i = [];
2267
2267
  for (const [a, c] of s)
2268
- i.push(Object.freeze(Rr(a, c, r.get(a))));
2268
+ i.push(Object.freeze(xr(a, c, r.get(a))));
2269
2269
  return Object.freeze(i);
2270
2270
  }
2271
2271
  /**
@@ -2292,11 +2292,11 @@ class Mr {
2292
2292
  return s;
2293
2293
  }
2294
2294
  }
2295
- function Rr(e, t, n) {
2295
+ function xr(e, t, n) {
2296
2296
  const s = { path: `data.${e}`, plainName: e };
2297
2297
  if (t.nonNumeric || t.numbers.length === 0)
2298
- return t.tooMany ? s : { ...s, distribution: $r(t.counts) };
2299
- const o = Zt(en(t.numbers)), r = Zt(en(n ?? t.numbers));
2298
+ return t.tooMany ? s : { ...s, distribution: Mr(t.counts) };
2299
+ const o = Jt(Zt(t.numbers)), r = Jt(Zt(n ?? t.numbers));
2300
2300
  return {
2301
2301
  ...s,
2302
2302
  mean: o.mean,
@@ -2304,10 +2304,10 @@ function Rr(e, t, n) {
2304
2304
  min: o.min,
2305
2305
  max: o.max,
2306
2306
  graphMean: r.mean,
2307
- direction: kr(o.mean, r.mean)
2307
+ direction: Rr(o.mean, r.mean)
2308
2308
  };
2309
2309
  }
2310
- function Dr(e) {
2310
+ function jr(e) {
2311
2311
  if (!dt.includes(e))
2312
2312
  throw new _({
2313
2313
  code: "E_BAD_COMMAND",
@@ -2316,10 +2316,10 @@ function Dr(e) {
2316
2316
  details: { op: e, available: dt }
2317
2317
  });
2318
2318
  }
2319
- function xr(e) {
2320
- return new Mr(e);
2319
+ function zr(e) {
2320
+ return new Dr(e);
2321
2321
  }
2322
- const Ju = Object.freeze({
2322
+ const td = Object.freeze({
2323
2323
  /** Above this node count the element draws less visual detail. A shipped default, not measured. */
2324
2324
  largeGraphThreshold: 1e4,
2325
2325
  /**
@@ -2328,7 +2328,7 @@ const Ju = Object.freeze({
2328
2328
  */
2329
2329
  renderCeiling: 5e4,
2330
2330
  /** The most elements one selection will hold before it refuses to grow. A shipped default, not measured. */
2331
- selectionCap: ws,
2331
+ selectionCap: Os,
2332
2332
  /**
2333
2333
  * The most edges the element will hold. Enforced: a load past it fails with `E_TOO_LARGE`.
2334
2334
  * Measured once (see the file comment), on one machine; not this machine's figure.
@@ -2341,7 +2341,7 @@ const Ju = Object.freeze({
2341
2341
  */
2342
2342
  approximateAboveNodes: 2e3
2343
2343
  });
2344
- function jr(e) {
2344
+ function Lr(e) {
2345
2345
  const t = /* @__PURE__ */ new Map();
2346
2346
  for (const n of e) {
2347
2347
  const s = t.get(n.algorithm);
@@ -2349,8 +2349,8 @@ function jr(e) {
2349
2349
  }
2350
2350
  return t;
2351
2351
  }
2352
- function zr(e) {
2353
- const t = jr(e.runs());
2352
+ function Fr(e) {
2353
+ const t = Lr(e.runs());
2354
2354
  return Object.freeze(
2355
2355
  e.algorithms().map((n) => {
2356
2356
  const s = e.estimate(n.key), o = t.get(n.key) ?? [];
@@ -2375,7 +2375,7 @@ function Ne(e) {
2375
2375
  let t = null;
2376
2376
  return (n) => n.length === 0 ? e : (t?.from !== n && (t = { from: n, list: Object.freeze([...e, ...n]) }), t.list);
2377
2377
  }
2378
- const Lr = Ne(co), Fr = Ne(lo), Ur = Ne(ao), Vr = Ne(Ao), Br = Ne(Po), qr = Ne(hs), We = Object.freeze({
2378
+ const Ur = Ne(lo), Vr = Ne(uo), Br = Ne(co), qr = Ne(_o), Gr = Ne(ko), Wr = Ne(fs), We = Object.freeze({
2379
2379
  /**
2380
2380
  * Every algorithm that can be run: the element's own, plus whatever was registered.
2381
2381
  *
@@ -2387,41 +2387,41 @@ const Lr = Ne(co), Fr = Ne(lo), Ur = Ne(ao), Vr = Ne(Ao), Br = Ne(Po), qr = Ne(h
2387
2387
  * summary, a reading, and the styling derived from a result's shape.
2388
2388
  * @returns the algorithm descriptors, the element's own first
2389
2389
  */
2390
- algorithms: () => Lr(bo()),
2390
+ algorithms: () => Ur(vo()),
2391
2391
  /**
2392
2392
  * Every camera view the viewer can be put in: the element's own five, plus whatever was
2393
2393
  * registered.
2394
2394
  * @returns the camera descriptors, the element's own first
2395
2395
  */
2396
- cameras: () => Fr(po()),
2396
+ cameras: () => Vr(bo()),
2397
2397
  /**
2398
2398
  * Every file format the element can read, plus whatever was registered.
2399
2399
  * @returns the format descriptors, the element's own first
2400
2400
  */
2401
- formats: () => Ur(io()),
2401
+ formats: () => Br(ao()),
2402
2402
  /**
2403
2403
  * Every layout a graph can be arranged with: the element's own, plus whatever was registered.
2404
2404
  * @returns the layout descriptors, the element's own first
2405
2405
  */
2406
- layouts: () => Vr(ro()),
2406
+ layouts: () => qr(io()),
2407
2407
  /**
2408
2408
  * Every destination log records can be delivered to, plus whatever was registered.
2409
2409
  * @returns the log destination descriptors, the element's own first
2410
2410
  */
2411
- logSinks: () => Br(To()),
2411
+ logSinks: () => Gr($o()),
2412
2412
  /**
2413
2413
  * Every colour palette a layer can paint with: the element's own seventeen, plus whatever was
2414
2414
  * registered.
2415
2415
  * @returns the palette descriptors, the element's own first
2416
2416
  */
2417
- palettes: () => qr(oo()),
2417
+ palettes: () => Wr(ro()),
2418
2418
  /**
2419
2419
  * Every scale the element ships. Static, because a scale is internal and nothing registers one.
2420
2420
  * @returns the scale descriptors
2421
2421
  */
2422
- scales: () => ds
2422
+ scales: () => hs
2423
2423
  });
2424
- function Gr(e) {
2424
+ function Yr(e) {
2425
2425
  return Object.freeze({
2426
2426
  ...We,
2427
2427
  /**
@@ -2429,29 +2429,29 @@ function Gr(e) {
2429
2429
  * whether it has been run.
2430
2430
  * @returns one entry per algorithm, in catalogue order
2431
2431
  */
2432
- metrics: () => zr(e)
2432
+ metrics: () => Fr(e)
2433
2433
  });
2434
2434
  }
2435
- const Wr = Object.freeze({
2435
+ const Hr = Object.freeze({
2436
2436
  linearElementsPerSecond: 1e6,
2437
2437
  iterativeElementsPerSecond: 3e6,
2438
2438
  heavyPairsPerSecond: 5e6,
2439
2439
  cubicOperationsPerSecond: 2e7
2440
- }), ht = 10, pn = 100, bn = "maxIterations", Yr = 1 / 60, Ye = 2 ** 32 - 1, vn = 8, Hr = 1024;
2440
+ }), ht = 10, gn = 100, pn = "maxIterations", Kr = 1 / 60, Ye = 2 ** 32 - 1, bn = 8, Qr = 1024;
2441
2441
  function ge(e) {
2442
2442
  return typeof e == "number" && Number.isFinite(e) && e >= 0;
2443
2443
  }
2444
2444
  function J(e) {
2445
2445
  return Number.isFinite(e) ? String(Math.round(e)).replace(/\B(?=(\d{3})+(?!\d))/g, ",") : "unknown";
2446
2446
  }
2447
- function Kr(e, t) {
2448
- const n = t?.[bn];
2447
+ function Xr(e, t) {
2448
+ const n = t?.[pn];
2449
2449
  if (typeof n == "number" && Number.isFinite(n) && n > 0)
2450
2450
  return n;
2451
- const o = e?.options.find((r) => r.name === bn)?.default;
2451
+ const o = e?.options.find((r) => r.name === pn)?.default;
2452
2452
  return typeof o == "number" && Number.isFinite(o) && o > 0 ? o : void 0;
2453
2453
  }
2454
- function Qr(e, t, n) {
2454
+ function Jr(e, t, n) {
2455
2455
  const { requires: s } = e;
2456
2456
  if (s !== void 0) {
2457
2457
  if (s.directed === !0 && t.directedness === "undirected")
@@ -2466,7 +2466,7 @@ function Qr(e, t, n) {
2466
2466
  return "Needs hardware acceleration, and no accelerator is attached.";
2467
2467
  }
2468
2468
  }
2469
- function yn(e, t, n, s) {
2469
+ function vn(e, t, n, s) {
2470
2470
  switch (e) {
2471
2471
  case "instant":
2472
2472
  return t + n;
@@ -2484,7 +2484,7 @@ function yn(e, t, n, s) {
2484
2484
  }
2485
2485
  }
2486
2486
  }
2487
- const Os = {
2487
+ const Es = {
2488
2488
  /* One BFS per source, so n(n + m), where betweenness' class term is n * m. Measured 20M to 57M
2489
2489
  n(n + m) per second across random (m = 1.2n to 50n), scale-free, grid, path, tree, star and
2490
2490
  clique-ring graphs of 400 to 1,600 nodes, and 15.5M on the sparsest in a loaded vitest
@@ -2525,7 +2525,7 @@ const Os = {
2525
2525
  seconds: (e, t, n, s) => (e + t) * (Math.log2(Math.max(2, e + t)) / 6.5 + s / 35) / n.iterativeElementsPerSecond
2526
2526
  }
2527
2527
  };
2528
- function Xr(e, t) {
2528
+ function Zr(e, t) {
2529
2529
  switch (e) {
2530
2530
  case "instant":
2531
2531
  return t.linearElementsPerSecond;
@@ -2543,7 +2543,7 @@ function Xr(e, t) {
2543
2543
  }
2544
2544
  }
2545
2545
  }
2546
- function Jr(e, t) {
2546
+ function ei(e, t) {
2547
2547
  switch (e) {
2548
2548
  case "instant":
2549
2549
  return "n + m";
@@ -2573,7 +2573,7 @@ function ft(e, t, n, s) {
2573
2573
  };
2574
2574
  return Object.freeze(s ? o : { ...o, reason: n });
2575
2575
  }
2576
- function Zr(e, t, n, s, o) {
2576
+ function ti(e, t, n, s, o) {
2577
2577
  if (!ge(e.seconds) || !ge(e.nodes) || !ge(e.edges))
2578
2578
  return;
2579
2579
  const r = t(e.nodes, e.edges, e.iterations ?? s);
@@ -2601,7 +2601,7 @@ function Re(e) {
2601
2601
  "The graph's size is not known yet, so nothing can be estimated.",
2602
2602
  !0
2603
2603
  );
2604
- const g = Qr(t, n, e.acceleratorAvailable ?? !1), h = `n=${J(c)} m=${J(l)}`;
2604
+ const g = Jr(t, n, e.acceleratorAvailable ?? !1), h = `n=${J(c)} m=${J(l)}`;
2605
2605
  if (g !== void 0)
2606
2606
  return Object.freeze({
2607
2607
  seconds: Number.POSITIVE_INFINITY,
@@ -2620,7 +2620,7 @@ function Re(e) {
2620
2620
  `${h}; this algorithm's running time cannot be bounded before it runs.`,
2621
2621
  !0
2622
2622
  );
2623
- const y = Kr(t, e.params), P = y ?? pn, F = e.sample === void 0 || c === 0 ? 1 : Math.min(1, Math.max(0, e.sample / c)), U = Lt(t.key)?.costUnits, w = U?.(c, l), N = w !== void 0 && ge(w) ? w : void 0, d = a === "iterative" && y === void 0 && N === void 0, p = (N ?? yn(a, c, l, P)) * F, O = N !== void 0 && U !== void 0 ? (I, C) => U(I, C) : (I, C, v) => yn(a, I, C, v), T = r?.get(e.algorithm), A = (T === void 0 ? void 0 : Zr(T, O, p, P, o?.machine)) ?? ei(
2623
+ const y = Xr(t, e.params), P = y ?? gn, F = e.sample === void 0 || c === 0 ? 1 : Math.min(1, Math.max(0, e.sample / c)), U = zt(t.key)?.costUnits, w = U?.(c, l), N = w !== void 0 && ge(w) ? w : void 0, d = a === "iterative" && y === void 0 && N === void 0, p = (N ?? vn(a, c, l, P)) * F, O = N !== void 0 && U !== void 0 ? (I, C) => U(I, C) : (I, C, v) => vn(a, I, C, v), T = r?.get(e.algorithm), A = (T === void 0 ? void 0 : ti(T, O, p, P, o?.machine)) ?? ni(
2624
2624
  t,
2625
2625
  a,
2626
2626
  c,
@@ -2632,20 +2632,20 @@ function Re(e) {
2632
2632
  N !== void 0
2633
2633
  ), S = d && A.confidence !== "modelled" ? "modelled" : A.confidence, j = Number.isFinite(A.seconds) && A.seconds >= 0 ? A.seconds : Number.POSITIVE_INFINITY, f = [
2634
2634
  h,
2635
- N === void 0 ? Os[t.key]?.term(P) ?? Jr(a, P) : "the algorithm's own work units"
2635
+ N === void 0 ? Es[t.key]?.term(P) ?? ei(a, P) : "the algorithm's own work units"
2636
2636
  ];
2637
- return e.sample !== void 0 && f.push(`sampled at ${J(e.sample)} of ${J(c)} nodes`), s !== void 0 && s.exact === !1 && f.push("sizes scaled from the whole graph rather than counted"), d && f.push(`no iteration bound is declared, so ${J(pn)} is assumed`), f.push(A.provenance), Object.freeze({
2637
+ return e.sample !== void 0 && f.push(`sampled at ${J(e.sample)} of ${J(c)} nodes`), s !== void 0 && s.exact === !1 && f.push("sizes scaled from the whole graph rather than counted"), d && f.push(`no iteration bound is declared, so ${J(gn)} is assumed`), f.push(A.provenance), Object.freeze({
2638
2638
  seconds: j,
2639
2639
  confidence: S,
2640
2640
  costClass: a,
2641
- blocksFrame: !i && j > Yr,
2641
+ blocksFrame: !i && j > Kr,
2642
2642
  cancellable: i,
2643
2643
  available: !0,
2644
2644
  basis: f.join("; ")
2645
2645
  });
2646
2646
  }
2647
- function ei(e, t, n, s, o, r, i, a, c) {
2648
- const l = c ? void 0 : Lt(e.key)?.cost ?? e.cost;
2647
+ function ni(e, t, n, s, o, r, i, a, c) {
2648
+ const l = c ? void 0 : zt(e.key)?.cost ?? e.cost;
2649
2649
  if (l !== void 0) {
2650
2650
  const U = l(n, s);
2651
2651
  if (ge(U))
@@ -2655,14 +2655,14 @@ function ei(e, t, n, s, o, r, i, a, c) {
2655
2655
  provenance: "the algorithm's own declared cost model"
2656
2656
  };
2657
2657
  }
2658
- const g = a !== void 0 && a.basis === "probe", h = a?.rates ?? Wr, y = Xr(t, h);
2658
+ const g = a !== void 0 && a.basis === "probe", h = a?.rates ?? Hr, y = Zr(t, h);
2659
2659
  if (!Number.isFinite(y) || y <= 0)
2660
2660
  return {
2661
2661
  seconds: Number.POSITIVE_INFINITY,
2662
2662
  confidence: "unknown",
2663
2663
  provenance: "no throughput is known for this cost class"
2664
2664
  };
2665
- const P = Os[e.key], F = P === void 0 || c ? o / y : P.seconds(n, s, h, r) * i;
2665
+ const P = Es[e.key], F = P === void 0 || c ? o / y : P.seconds(n, s, h, r) * i;
2666
2666
  return g ? {
2667
2667
  seconds: F,
2668
2668
  confidence: "calibrated",
@@ -2673,33 +2673,33 @@ function ei(e, t, n, s, o, r, i, a, c) {
2673
2673
  provenance: a === void 0 ? "built-in rates; this device has not been calibrated" : `built-in rates; the calibration of ${a.at} could not measure this device`
2674
2674
  };
2675
2675
  }
2676
- const ti = 30, ni = 512 * 1024 * 1024, Es = Object.freeze({
2677
- exactComputationSeconds: ti,
2678
- runColumnBudgetBytes: ni
2676
+ const si = 30, oi = 512 * 1024 * 1024, Ns = Object.freeze({
2677
+ exactComputationSeconds: si,
2678
+ runColumnBudgetBytes: oi
2679
2679
  });
2680
- function si(e, t, n) {
2680
+ function ri(e, t, n) {
2681
2681
  let s = 0;
2682
2682
  for (const o of e.fields)
2683
2683
  switch (o.kind) {
2684
2684
  case "node":
2685
- s += t * vn;
2685
+ s += t * bn;
2686
2686
  break;
2687
2687
  case "edge":
2688
- s += n * vn;
2688
+ s += n * bn;
2689
2689
  break;
2690
2690
  case "graph":
2691
- s += Hr;
2691
+ s += Qr;
2692
2692
  break;
2693
2693
  }
2694
2694
  return s;
2695
2695
  }
2696
- function oi(e, t) {
2696
+ function ii(e, t) {
2697
2697
  if (e > Ye)
2698
2698
  return { kind: "nodes", count: e };
2699
2699
  if (t > Ye)
2700
2700
  return { kind: "edges", count: t };
2701
2701
  }
2702
- function ri(e, t, n) {
2702
+ function ai(e, t, n) {
2703
2703
  const { largestSize: s } = t.components;
2704
2704
  if (t.components.count <= 1 || s <= 0 || t.nodeCount <= 0)
2705
2705
  return [];
@@ -2715,7 +2715,7 @@ function ri(e, t, n) {
2715
2715
  })
2716
2716
  ]);
2717
2717
  }
2718
- function ii(e, t) {
2718
+ function ci(e, t) {
2719
2719
  const { statistics: n } = e, s = n.nodeCount;
2720
2720
  if (s <= 0)
2721
2721
  return;
@@ -2733,13 +2733,13 @@ function ii(e, t) {
2733
2733
  }
2734
2734
  return { nodes: i, edges: Math.round(i * o) };
2735
2735
  }
2736
- function ai(e, t = {}) {
2737
- const n = t.limits ?? Es, s = n.exactComputationSeconds, { descriptor: o, statistics: r } = e, i = e.scope?.nodes ?? r.nodeCount, a = e.scope?.edges ?? r.edgeCount;
2736
+ function li(e, t = {}) {
2737
+ const n = t.limits ?? Ns, s = n.exactComputationSeconds, { descriptor: o, statistics: r } = e, i = e.scope?.nodes ?? r.nodeCount, a = e.scope?.edges ?? r.edgeCount;
2738
2738
  if (t.exact === !0 && (t.sample ?? e.sample) !== void 0)
2739
2739
  return he("E_BAD_COMMAND", "A run cannot be both exact and sampled.", {
2740
2740
  fields: ["exact", "sample"]
2741
2741
  });
2742
- if (o === void 0 && fs(e.algorithm))
2742
+ if (o === void 0 && ms(e.algorithm))
2743
2743
  return he(
2744
2744
  "E_UNSUPPORTED",
2745
2745
  `The "${e.algorithm}" algorithm is not implemented. The name is deprecated and will be removed at the next major release unless it is implemented first.`,
@@ -2749,14 +2749,14 @@ function ai(e, t = {}) {
2749
2749
  return he("E_UNKNOWN_ALGORITHM", `No algorithm is registered under "${e.algorithm}".`, {
2750
2750
  algorithm: e.algorithm
2751
2751
  });
2752
- const c = oi(i, a);
2752
+ const c = ii(i, a);
2753
2753
  if (c !== void 0)
2754
2754
  return he(
2755
2755
  "E_TOO_LARGE",
2756
2756
  `This graph has ${J(c.count)} ${c.kind}, past the ${J(Ye)} a result column can hold. No scope or sample changes that.`,
2757
2757
  { limit: Ye, count: c.count, of: c.kind, graph: { nodes: i, edges: a } }
2758
2758
  );
2759
- const l = si(o, i, a);
2759
+ const l = ri(o, i, a);
2760
2760
  if (l > n.runColumnBudgetBytes)
2761
2761
  return he(
2762
2762
  "E_OUT_OF_MEMORY",
@@ -2772,7 +2772,7 @@ function ai(e, t = {}) {
2772
2772
  if (h === void 0 && g.seconds <= s)
2773
2773
  return { kind: "exact", estimate: g };
2774
2774
  const { approximable: y } = o;
2775
- return y !== void 0 && t.exact !== !0 ? ci(
2775
+ return y !== void 0 && t.exact !== !0 ? ui(
2776
2776
  e,
2777
2777
  g,
2778
2778
  y,
@@ -2790,12 +2790,12 @@ function ai(e, t = {}) {
2790
2790
  graph: { nodes: i, edges: a },
2791
2791
  approximable: y !== void 0,
2792
2792
  exactRequested: t.exact === !0,
2793
- scopes: ri(e, r, s),
2794
- fitsUpTo: ii(e, s)
2793
+ scopes: ai(e, r, s),
2794
+ fitsUpTo: ci(e, s)
2795
2795
  }
2796
2796
  );
2797
2797
  }
2798
- function ci(e, t, n, s, o) {
2798
+ function ui(e, t, n, s, o) {
2799
2799
  const r = Re({ ...e, sample: s }), i = e.scope?.nodes ?? e.statistics.nodeCount, a = [
2800
2800
  `Sampled rather than exact: ${n.plainName} over ${J(s)} of ${J(i)} nodes.`
2801
2801
  ];
@@ -2820,7 +2820,7 @@ function he(e, t, n) {
2820
2820
  error: new _({ code: e, message: t, source: "run", details: n })
2821
2821
  };
2822
2822
  }
2823
- function li(e) {
2823
+ function di(e) {
2824
2824
  if (e == null)
2825
2825
  return null;
2826
2826
  switch (typeof e) {
@@ -2834,22 +2834,22 @@ function li(e) {
2834
2834
  return "mixed";
2835
2835
  }
2836
2836
  }
2837
- function ui(e, t) {
2838
- const n = li(t);
2839
- n !== null && (e.present++, e.types.add(n), typeof t == "number" && (e.min = Math.min(e.min, t), e.max = Math.max(e.max, t)), e.samples.length < pr && e.samples.push(t), e.unique !== null && (e.unique.add(t), e.unique.size > bs && (e.unique = null)));
2837
+ function hi(e, t) {
2838
+ const n = di(t);
2839
+ n !== null && (e.present++, e.types.add(n), typeof t == "number" && (e.min = Math.min(e.min, t), e.max = Math.max(e.max, t)), e.samples.length < vr && e.samples.push(t), e.unique !== null && (e.unique.add(t), e.unique.size > vs && (e.unique = null)));
2840
2840
  }
2841
- function di(e) {
2841
+ function fi(e) {
2842
2842
  if (e.size === 1) {
2843
2843
  const [t] = e;
2844
2844
  return t;
2845
2845
  }
2846
2846
  return e.size === 2 && e.has("integer") && e.has("number") ? "number" : "mixed";
2847
2847
  }
2848
- function hi(e, t) {
2848
+ function mi(e, t) {
2849
2849
  return e.unique === null || t === 0 ? !1 : e.unique.size <= Math.max(2, Math.sqrt(t));
2850
2850
  }
2851
- function wn(e, t, n, s) {
2852
- const o = di(n.types), r = o === "number" || o === "integer", i = o === "string" && hi(n, s) ? "category" : o;
2851
+ function yn(e, t, n, s) {
2852
+ const o = fi(n.types), r = o === "number" || o === "integer", i = o === "string" && mi(n, s) ? "category" : o;
2853
2853
  return Object.freeze({
2854
2854
  path: `data.${e}`,
2855
2855
  token: `[${e}]`,
@@ -2865,7 +2865,7 @@ function wn(e, t, n, s) {
2865
2865
  sampleValues: Object.freeze([...n.samples])
2866
2866
  });
2867
2867
  }
2868
- function On(e, t) {
2868
+ function wn(e, t) {
2869
2869
  const n = /* @__PURE__ */ new Map();
2870
2870
  for (let s = 0; s < e; s++) {
2871
2871
  const o = t(s);
@@ -2879,22 +2879,22 @@ function On(e, t) {
2879
2879
  min: Number.POSITIVE_INFINITY,
2880
2880
  max: Number.NEGATIVE_INFINITY,
2881
2881
  samples: []
2882
- }, n.set(r, i)), ui(i, o[r]);
2882
+ }, n.set(r, i)), hi(i, o[r]);
2883
2883
  }
2884
2884
  }
2885
2885
  return n;
2886
2886
  }
2887
- function fi(e, t) {
2887
+ function gi(e, t) {
2888
2888
  if (t === null)
2889
2889
  return Object.freeze([]);
2890
- const n = On(e.nodeCount, (r) => t.nodeAttributes(r, e.ids.idOf(r))), s = On(e.edgeCount, (r) => t.edgeAttributes(r)), o = [];
2890
+ const n = wn(e.nodeCount, (r) => t.nodeAttributes(r, e.ids.idOf(r))), s = wn(e.edgeCount, (r) => t.edgeAttributes(r)), o = [];
2891
2891
  for (const [r, i] of n)
2892
- o.push(wn(r, "node", i, e.nodeCount));
2892
+ o.push(yn(r, "node", i, e.nodeCount));
2893
2893
  for (const [r, i] of s)
2894
- o.push(wn(r, "edge", i, e.edgeCount));
2894
+ o.push(yn(r, "edge", i, e.edgeCount));
2895
2895
  return Object.freeze(o);
2896
2896
  }
2897
- function mi(e) {
2897
+ function pi(e) {
2898
2898
  const { nodeCount: t, rowPtr: n, colIdx: s } = e, o = new Int32Array(t).fill(-1);
2899
2899
  if (t === 0)
2900
2900
  return { labels: o, count: 0 };
@@ -2920,17 +2920,17 @@ function mi(e) {
2920
2920
  }
2921
2921
  return { labels: o, count: a };
2922
2922
  }
2923
- function gi(e, t, n) {
2923
+ function bi(e, t, n) {
2924
2924
  const s = new Uint32Array(n);
2925
2925
  for (const c of t)
2926
2926
  s[c]++;
2927
2927
  let o = 0, r = 0;
2928
2928
  for (const c of s)
2929
2929
  c > o && (o = c), c === 1 && r++;
2930
- const i = Array.from(s).sort((c, l) => l - c), a = i.length > un;
2930
+ const i = Array.from(s).sort((c, l) => l - c), a = i.length > ln;
2931
2931
  return {
2932
2932
  count: n,
2933
- sizes: Object.freeze(a ? i.slice(0, un) : i),
2933
+ sizes: Object.freeze(a ? i.slice(0, ln) : i),
2934
2934
  largestSize: o,
2935
2935
  isolatedCount: r,
2936
2936
  truncatedSizes: a,
@@ -2940,7 +2940,7 @@ function gi(e, t, n) {
2940
2940
  }
2941
2941
  };
2942
2942
  }
2943
- function pi(e) {
2943
+ function vi(e) {
2944
2944
  const { nodeCount: t, rowPtr: n, colIdx: s, directed: o } = e;
2945
2945
  let r = 0, i = 0;
2946
2946
  for (let a = 0; a < t; a++) {
@@ -2950,7 +2950,7 @@ function pi(e) {
2950
2950
  }
2951
2951
  return o ? r + i : r / 2 + i;
2952
2952
  }
2953
- function bi(e) {
2953
+ function yi(e) {
2954
2954
  if (e.length === 0)
2955
2955
  return { range: [0, 0], mean: 0 };
2956
2956
  let t = e[0], n = e[0], s = 0;
@@ -2958,7 +2958,7 @@ function bi(e) {
2958
2958
  o < t && (t = o), o > n && (n = o), s += o;
2959
2959
  return { range: [t, n], mean: s / e.length };
2960
2960
  }
2961
- function vi(e) {
2961
+ function wi(e) {
2962
2962
  const { weights: t } = e;
2963
2963
  if (t === null)
2964
2964
  return !1;
@@ -2967,33 +2967,33 @@ function vi(e) {
2967
2967
  return !0;
2968
2968
  return !1;
2969
2969
  }
2970
- function yi(e) {
2970
+ function Oi(e) {
2971
2971
  const { nodeCount: t, edgeCount: n, selfLoopCount: s, directed: o } = e;
2972
2972
  if (t < 2)
2973
2973
  return 0;
2974
2974
  const r = t * (t - 1), i = o ? r : r / 2;
2975
2975
  return Math.max(0, n - s) / i;
2976
2976
  }
2977
- function wi(e, t) {
2977
+ function Ei(e, t) {
2978
2978
  return t === "auto" && e.nodeCount === 0 && e.edgeCount === 0 ? "unknown" : e.directed ? "directed" : "undirected";
2979
2979
  }
2980
- function Oi(e, t, n) {
2981
- const { labels: s, count: o } = mi(e), r = bi(e.degree());
2980
+ function Ni(e, t, n) {
2981
+ const { labels: s, count: o } = pi(e), r = yi(e.degree());
2982
2982
  return Object.freeze({
2983
2983
  nodeCount: e.nodeCount,
2984
2984
  edgeCount: e.edgeCount,
2985
- density: yi(e),
2986
- directedness: wi(e, t),
2985
+ density: Oi(e),
2986
+ directedness: Ei(e, t),
2987
2987
  directednessSource: Object.freeze(n),
2988
- weighted: vi(e),
2988
+ weighted: wi(e),
2989
2989
  selfLoopCount: e.selfLoopCount,
2990
- repeatedEdgeCount: pi(e),
2990
+ repeatedEdgeCount: vi(e),
2991
2991
  degreeRange: Object.freeze(r.range),
2992
2992
  meanDegree: r.mean,
2993
- components: Object.freeze(gi(e, s, o))
2993
+ components: Object.freeze(bi(e, s, o))
2994
2994
  });
2995
2995
  }
2996
- function Ei(e) {
2996
+ function Si(e) {
2997
2997
  let t = 2166136261, n = 16777619;
2998
2998
  const s = (o) => {
2999
2999
  t = Math.imul(t ^ o >>> 0, 16777619) >>> 0, n = Math.imul(n ^ t + o, 2246822507) >>> 0;
@@ -3015,7 +3015,7 @@ function Ei(e) {
3015
3015
  s(e.colIdx[o]);
3016
3016
  return t.toString(16).padStart(8, "0") + n.toString(16).padStart(8, "0");
3017
3017
  }
3018
- class Ni {
3018
+ class Ai {
3019
3019
  /**
3020
3020
  * Build the data surface.
3021
3021
  * @param store - the store to read
@@ -3062,7 +3062,7 @@ class Ni {
3062
3062
  * @throws A `GraphtyError` with `E_DISPOSED` when the session has been disposed.
3063
3063
  */
3064
3064
  edge(t) {
3065
- const n = this.snapshot(), s = gs(t), o = s === G ? G : n.edgeIndexOf(s);
3065
+ const n = this.snapshot(), s = ps(t), o = s === G ? G : n.edgeIndexOf(s);
3066
3066
  if (o !== G)
3067
3067
  return Object.freeze({
3068
3068
  ...this.records?.edgeAttributes(o),
@@ -3086,7 +3086,7 @@ class Ni {
3086
3086
  */
3087
3087
  attributes() {
3088
3088
  const t = this.derivedFor(this.snapshot());
3089
- return t.attributes ??= fi(t.snapshot, this.records), t.attributes;
3089
+ return t.attributes ??= gi(t.snapshot, this.records), t.attributes;
3090
3090
  }
3091
3091
  /**
3092
3092
  * The graph's shape.
@@ -3095,7 +3095,7 @@ class Ni {
3095
3095
  */
3096
3096
  statistics() {
3097
3097
  const t = this.derivedFor(this.snapshot());
3098
- return t.statistics ??= Oi(t.snapshot, this.readConfig().directed, this.store.directionSettledBy), t.statistics;
3098
+ return t.statistics ??= Ni(t.snapshot, this.readConfig().directed, this.store.directionSettledBy), t.statistics;
3099
3099
  }
3100
3100
  /**
3101
3101
  * A stable identity for the graph's topology.
@@ -3104,7 +3104,7 @@ class Ni {
3104
3104
  */
3105
3105
  fingerprint() {
3106
3106
  const t = this.derivedFor(this.snapshot());
3107
- return t.fingerprint ??= Ei(t.snapshot), t.fingerprint;
3107
+ return t.fingerprint ??= Si(t.snapshot), t.fingerprint;
3108
3108
  }
3109
3109
  /**
3110
3110
  * Refuse every verb from here on, and let go of what was derived from the last snapshot.
@@ -3143,10 +3143,10 @@ class Ni {
3143
3143
  });
3144
3144
  }
3145
3145
  }
3146
- function Zu(e) {
3146
+ function nd(e) {
3147
3147
  return typeof e == "object" && e !== null && e.op === "algo.run";
3148
3148
  }
3149
- function Ns(e, t, n) {
3149
+ function Ss(e, t, n) {
3150
3150
  const s = e.statistics(), o = t.scope ?? e.defaultScope;
3151
3151
  let r;
3152
3152
  try {
@@ -3169,7 +3169,7 @@ function Ns(e, t, n) {
3169
3169
  }
3170
3170
  };
3171
3171
  }
3172
- function Ss(e, t) {
3172
+ function As(e, t) {
3173
3173
  return Object.freeze({
3174
3174
  seconds: Number.POSITIVE_INFINITY,
3175
3175
  confidence: "unknown",
@@ -3181,21 +3181,21 @@ function Ss(e, t) {
3181
3181
  basis: t
3182
3182
  });
3183
3183
  }
3184
- function qt(e, t) {
3185
- const n = e.algorithms().find((o) => o.key === t.algorithm), s = Ns(e, t, n);
3186
- return "unresolvableScope" in s ? Ss(n, s.unresolvableScope) : Re(s.input);
3184
+ function Bt(e, t) {
3185
+ const n = e.algorithms().find((o) => o.key === t.algorithm), s = Ss(e, t, n);
3186
+ return "unresolvableScope" in s ? As(n, s.unresolvableScope) : Re(s.input);
3187
3187
  }
3188
- function Si(e, t) {
3189
- const n = e.algorithms().find((i) => i.key === t.algorithm), s = Ns(e, t, n);
3188
+ function Ci(e, t) {
3189
+ const n = e.algorithms().find((i) => i.key === t.algorithm), s = Ss(e, t, n);
3190
3190
  if ("unresolvableScope" in s)
3191
3191
  return Object.freeze({
3192
3192
  ok: !1,
3193
3193
  blocked: Object.freeze({ code: "E_UNSUPPORTED", reason: s.unresolvableScope }),
3194
- cost: Ss(n, s.unresolvableScope),
3194
+ cost: As(n, s.unresolvableScope),
3195
3195
  effect: Object.freeze({ kind: "none" }),
3196
3196
  caveats: e.defaultCaveats
3197
3197
  });
3198
- const o = ai(s.input, {
3198
+ const o = li(s.input, {
3199
3199
  limits: e.limits,
3200
3200
  ...t.exact === void 0 ? {} : { exact: t.exact },
3201
3201
  ...t.sample === void 0 ? {} : { sample: t.sample }
@@ -3203,7 +3203,7 @@ function Si(e, t) {
3203
3203
  return o.kind === "refused" ? Object.freeze({
3204
3204
  ok: !1,
3205
3205
  blocked: Object.freeze({ code: o.error.code, reason: o.error.message }),
3206
- cost: qt(e, t),
3206
+ cost: Bt(e, t),
3207
3207
  effect: r,
3208
3208
  caveats: e.defaultCaveats
3209
3209
  }) : o.kind === "exact" ? Object.freeze({
@@ -3229,7 +3229,7 @@ function Si(e, t) {
3229
3229
  })
3230
3230
  });
3231
3231
  }
3232
- function Ai(e) {
3232
+ function _i(e) {
3233
3233
  const { elements: t } = e, n = (c, l) => us(c, ke(t, l)), s = (c, l) => {
3234
3234
  const g = e.snapshot(), h = l === "node" ? g.nodeCount : g.edgeCount, y = [];
3235
3235
  for (let P = 0; P < h; P++)
@@ -3255,14 +3255,14 @@ function Ai(e) {
3255
3255
  find: (c, l) => {
3256
3256
  const g = e.snapshot(), h = e.searchPaths();
3257
3257
  let y, P = h, F = !0;
3258
- const U = l === "attribute" ? Ci(c, h) : null;
3258
+ const U = l === "attribute" ? Ii(c, h) : null;
3259
3259
  if (U !== null) {
3260
3260
  const N = U.value.toLowerCase();
3261
3261
  y = (d) => d.toLowerCase() === N, F = U.path === "id", P = F ? [] : [U.path];
3262
3262
  } else if (l === "exact")
3263
3263
  y = (N) => N === c;
3264
3264
  else if (l === "regex") {
3265
- const N = _i(c);
3265
+ const N = Ti(c);
3266
3266
  y = (d) => N.test(d);
3267
3267
  } else {
3268
3268
  const N = c.toLowerCase();
@@ -3282,7 +3282,7 @@ function Ai(e) {
3282
3282
  }
3283
3283
  };
3284
3284
  }
3285
- function Ci(e, t) {
3285
+ function Ii(e, t) {
3286
3286
  const n = e.indexOf(":");
3287
3287
  if (n <= 0)
3288
3288
  return null;
@@ -3292,7 +3292,7 @@ function Ci(e, t) {
3292
3292
  const r = s.startsWith("data.") ? s : `data.${s}`;
3293
3293
  return t.includes(r) ? { path: r, value: o } : null;
3294
3294
  }
3295
- function _i(e) {
3295
+ function Ti(e) {
3296
3296
  try {
3297
3297
  return new RegExp(e);
3298
3298
  } catch (t) {
@@ -3309,7 +3309,7 @@ const He = Object.freeze({
3309
3309
  element: "1.10.0",
3310
3310
  algorithms: "1.4.0",
3311
3311
  layout: "1.3.0"
3312
- }), Ii = Object.freeze({
3312
+ }), Pi = Object.freeze({
3313
3313
  setProgress: () => {
3314
3314
  },
3315
3315
  setMessage: () => {
@@ -3317,7 +3317,7 @@ const He = Object.freeze({
3317
3317
  setPhase: () => {
3318
3318
  }
3319
3319
  });
3320
- class Ti {
3320
+ class $i {
3321
3321
  #i = 0;
3322
3322
  #e = [];
3323
3323
  #t = !1;
@@ -3367,7 +3367,7 @@ class Ti {
3367
3367
  const t = this.#e[0];
3368
3368
  t.started = !0;
3369
3369
  try {
3370
- await t.execute({ signal: t.controller.signal, progress: Ii, id: t.id });
3370
+ await t.execute({ signal: t.controller.signal, progress: Pi, id: t.id });
3371
3371
  } catch {
3372
3372
  }
3373
3373
  this.#e.shift();
@@ -3378,72 +3378,72 @@ class Ti {
3378
3378
  }
3379
3379
  }
3380
3380
  }
3381
- function Gt() {
3382
- return new Ti();
3381
+ function qt() {
3382
+ return new $i();
3383
3383
  }
3384
- const En = Object.freeze([]), Pi = Object.freeze([1, 3]), Wt = {
3384
+ const On = Object.freeze([]), ki = Object.freeze([1, 3]), Gt = {
3385
3385
  node: "node.color",
3386
3386
  edge: "edge.color"
3387
3387
  };
3388
- function $i(e, t) {
3388
+ function Mi(e, t) {
3389
3389
  const n = [];
3390
3390
  for (const s of ["node", "edge"])
3391
3391
  e.some((o) => o.name === t && o.kind === s) && n.push(s);
3392
3392
  return n;
3393
3393
  }
3394
- function As(e, t = !0) {
3394
+ function Cs(e, t = !0) {
3395
3395
  const { layer: n, primaryField: s } = Me(e.shape);
3396
3396
  if (n === "none" || s === null)
3397
- return En;
3398
- const o = $i(e.fields, s);
3397
+ return On;
3398
+ const o = Mi(e.fields, s);
3399
3399
  if (o.length === 0)
3400
- return En;
3401
- const r = n === "highlight" ? [Mi(e, s, o)] : o.map((c) => Cs(e, s, c)), i = Ri(e, s, r), a = ki(e, s, o, t);
3400
+ return On;
3401
+ const r = n === "highlight" ? [Di(e, s, o)] : o.map((c) => _s(e, s, c)), i = xi(e, s, r), a = Ri(e, s, o, t);
3402
3402
  return Object.freeze([...r, ...i === null ? [] : [i], ...a === null ? [] : [a]]);
3403
3403
  }
3404
- function ki(e, t, n, s) {
3404
+ function Ri(e, t, n, s) {
3405
3405
  const o = typeof s == "object" ? s.size : void 0;
3406
3406
  if (o === void 0 || o === !1 || e.shape !== "node-metric" || !n.includes("node"))
3407
3407
  return null;
3408
- const [r, i] = o === !0 ? Pi : o;
3408
+ const [r, i] = o === !0 ? ki : o;
3409
3409
  return {
3410
3410
  as: "encoding",
3411
3411
  channels: Object.freeze(["node.size"]),
3412
3412
  spec: { run: e.id, field: t, channel: "node.size", range: [r, i] }
3413
3413
  };
3414
3414
  }
3415
- function Mi(e, t, n) {
3415
+ function Di(e, t, n) {
3416
3416
  return {
3417
3417
  as: "highlight",
3418
- channels: Object.freeze(n.map((s) => Wt[s])),
3418
+ channels: Object.freeze(n.map((s) => Gt[s])),
3419
3419
  spec: { run: e.id, field: t }
3420
3420
  };
3421
3421
  }
3422
- function Cs(e, t, n) {
3423
- const s = Wt[n];
3422
+ function _s(e, t, n) {
3423
+ const s = Gt[n];
3424
3424
  return {
3425
3425
  as: "encoding",
3426
3426
  channels: Object.freeze([s]),
3427
3427
  spec: { run: e.id, field: t, channel: s }
3428
3428
  };
3429
3429
  }
3430
- function Ri(e, t, n) {
3431
- if (n.some((o) => o.channels.includes(Wt.node)))
3430
+ function xi(e, t, n) {
3431
+ if (n.some((o) => o.channels.includes(Gt.node)))
3432
3432
  return null;
3433
3433
  const s = e.fields.find(
3434
3434
  (o) => o.kind === "node" && o.type === "string" && o.name !== t
3435
3435
  );
3436
- return s === void 0 ? null : Cs(e, s.name, "node");
3436
+ return s === void 0 ? null : _s(e, s.name, "node");
3437
3437
  }
3438
- const Nn = Object.freeze({
3438
+ const En = Object.freeze({
3439
3439
  phase: "queued",
3440
3440
  determinate: !1,
3441
3441
  completed: 0,
3442
3442
  total: null,
3443
3443
  fraction: null,
3444
3444
  etaMs: null
3445
- }), Di = 100;
3446
- function Sn() {
3445
+ }), ji = 100;
3446
+ function Nn() {
3447
3447
  let e = () => {
3448
3448
  }, t = () => {
3449
3449
  };
@@ -3456,10 +3456,10 @@ function Sn() {
3456
3456
  function fe() {
3457
3457
  return performance.now();
3458
3458
  }
3459
- function xi(e) {
3459
+ function zi(e) {
3460
3460
  return e instanceof Error && (e.name === "AbortError" || e.name === "TimeoutError");
3461
3461
  }
3462
- function An(e, t) {
3462
+ function Sn(e, t) {
3463
3463
  if (e.aborted) {
3464
3464
  t.abort(e.reason);
3465
3465
  return;
@@ -3472,7 +3472,7 @@ function An(e, t) {
3472
3472
  { once: !0 }
3473
3473
  );
3474
3474
  }
3475
- function Cn(e, t) {
3475
+ function An(e, t) {
3476
3476
  const n = e?.reason;
3477
3477
  return n instanceof DOMException ? n : new DOMException(typeof n == "string" && n !== "" ? n : t, "AbortError");
3478
3478
  }
@@ -3483,7 +3483,7 @@ class Ke {
3483
3483
  * @param surroundings - What the run asks of the session holding it.
3484
3484
  */
3485
3485
  constructor(t, n) {
3486
- this.journalId = null, this.statusValue = "queued", this.progressValue = Nn, this.resultValue = void 0, this.summaryValue = void 0, this.errorValue = void 0, this.startedAtValue = null, this.startedAtMs = 0, this.durationValue = null, this.partialValue = !1, this.deferred = Sn(), this.ticket = null, this.executionController = null, this.timeBoxTimer = null, this.detachSignal = null, this.queueSink = null, this.settledFlag = !1, this.cancelReason = null, this.definition = t, this.surroundings = n, this.id = t.id, this.algorithm = t.algorithm, this.params = t.params, this.seed = t.seed, this.shape = t.shape, this.engine = t.engine, this.style = t.style, this.caveatsValue = t.caveats, this.fieldsValue = t.fields, this.scopeValue = n.resolveScope();
3486
+ this.journalId = null, this.statusValue = "queued", this.progressValue = En, this.resultValue = void 0, this.summaryValue = void 0, this.errorValue = void 0, this.startedAtValue = null, this.startedAtMs = 0, this.durationValue = null, this.partialValue = !1, this.deferred = Nn(), this.ticket = null, this.executionController = null, this.timeBoxTimer = null, this.detachSignal = null, this.queueSink = null, this.settledFlag = !1, this.cancelReason = null, this.definition = t, this.surroundings = n, this.id = t.id, this.algorithm = t.algorithm, this.params = t.params, this.seed = t.seed, this.shape = t.shape, this.engine = t.engine, this.style = t.style, this.caveatsValue = t.caveats, this.fieldsValue = t.fields, this.scopeValue = n.resolveScope();
3487
3487
  }
3488
3488
  // -- the facts ----------------------------------------------------------------------------
3489
3489
  /**
@@ -3646,7 +3646,7 @@ class Ke {
3646
3646
  return;
3647
3647
  const { signal: t } = this.definition;
3648
3648
  if (t !== void 0 && t.aborted) {
3649
- this.finishAsCanceled(Cn(t, `Run "${this.id}" was aborted before it started.`));
3649
+ this.finishAsCanceled(An(t, `Run "${this.id}" was aborted before it started.`));
3650
3650
  return;
3651
3651
  }
3652
3652
  this.attachCallerSignal(), this.surroundings.notify?.("queued"), this.ticket = this.surroundings.enqueue(async (n) => {
@@ -3693,7 +3693,7 @@ class Ke {
3693
3693
  * @returns The suggestions, empty when the result is read rather than painted.
3694
3694
  */
3695
3695
  suggestEncodings() {
3696
- return As(this, this.style);
3696
+ return Cs(this, this.style);
3697
3697
  }
3698
3698
  // -- execution ----------------------------------------------------------------------------
3699
3699
  /**
@@ -3705,9 +3705,9 @@ class Ke {
3705
3705
  return;
3706
3706
  this.queueSink = t.progress, this.statusValue = "running", this.startedAtValue = (/* @__PURE__ */ new Date()).toISOString(), this.startedAtMs = fe(), this.scopeValue = this.surroundings.resolveScope();
3707
3707
  const n = new AbortController();
3708
- this.executionController = n, An(t.signal, n);
3708
+ this.executionController = n, Sn(t.signal, n);
3709
3709
  const { signal: s } = this.definition;
3710
- s !== void 0 && An(s, n);
3710
+ s !== void 0 && Sn(s, n);
3711
3711
  const o = this.startTimeBox();
3712
3712
  this.surroundings.notify?.("start"), this.report({ phase: "running", completed: 0 });
3713
3713
  try {
@@ -3775,7 +3775,7 @@ class Ke {
3775
3775
  fail(t) {
3776
3776
  if (this.settledFlag)
3777
3777
  return;
3778
- if (xi(t)) {
3778
+ if (zi(t)) {
3779
3779
  this.finishAsCanceled(t);
3780
3780
  return;
3781
3781
  }
@@ -3826,7 +3826,7 @@ class Ke {
3826
3826
  * @param update - What changed.
3827
3827
  */
3828
3828
  report(t) {
3829
- const n = this.progressValue, s = t.phase ?? n.phase, o = t.completed ?? n.completed, r = t.total === void 0 ? n.total : t.total, i = r !== null, a = r === null ? null : ji(o, r), c = t.message ?? n.message, l = Object.freeze({
3829
+ const n = this.progressValue, s = t.phase ?? n.phase, o = t.completed ?? n.completed, r = t.total === void 0 ? n.total : t.total, i = r !== null, a = r === null ? null : Li(o, r), c = t.message ?? n.message, l = Object.freeze({
3830
3830
  phase: s,
3831
3831
  determinate: i,
3832
3832
  completed: o,
@@ -3844,7 +3844,7 @@ class Ke {
3844
3844
  */
3845
3845
  pushToQueue(t) {
3846
3846
  const n = this.queueSink;
3847
- n !== null && (n.setPhase(t.phase), t.message !== void 0 && n.setMessage(t.message), t.fraction !== null && n.setProgress(Math.round(t.fraction * Di)));
3847
+ n !== null && (n.setPhase(t.phase), t.message !== void 0 && n.setMessage(t.message), t.fraction !== null && n.setProgress(Math.round(t.fraction * ji)));
3848
3848
  }
3849
3849
  /**
3850
3850
  * How much longer the run has, projected from how long it has taken so far.
@@ -3881,7 +3881,7 @@ class Ke {
3881
3881
  cancelFromSignal(t) {
3882
3882
  if (!this.cancellable)
3883
3883
  return;
3884
- const n = Cn(t, `Run "${this.id}" was aborted.`);
3884
+ const n = An(t, `Run "${this.id}" was aborted.`);
3885
3885
  this.statusValue = "canceled", this.durationValue = this.startedAtMs === 0 ? null : Math.round(fe() - this.startedAtMs), this.settle(() => {
3886
3886
  this.deferred.reject(n);
3887
3887
  }), this.stopWork(n);
@@ -3902,13 +3902,13 @@ class Ke {
3902
3902
  }
3903
3903
  /** Put the run back the way it was before it ran, keeping its id and its definition. */
3904
3904
  resetForRerun() {
3905
- this.settledFlag = !1, this.cancelReason = null, this.deferred = Sn(), this.statusValue = "queued", this.progressValue = Nn, this.caveatsValue = this.definition.caveats, this.fieldsValue = this.definition.fields, this.resultValue = void 0, this.summaryValue = void 0, this.errorValue = void 0, this.startedAtValue = null, this.startedAtMs = 0, this.durationValue = null, this.partialValue = !1, this.ticket = null, this.executionController = null;
3905
+ this.settledFlag = !1, this.cancelReason = null, this.deferred = Nn(), this.statusValue = "queued", this.progressValue = En, this.caveatsValue = this.definition.caveats, this.fieldsValue = this.definition.fields, this.resultValue = void 0, this.summaryValue = void 0, this.errorValue = void 0, this.startedAtValue = null, this.startedAtMs = 0, this.durationValue = null, this.partialValue = !1, this.ticket = null, this.executionController = null;
3906
3906
  }
3907
3907
  }
3908
- function ji(e, t) {
3908
+ function Li(e, t) {
3909
3909
  return t <= 0 ? 1 : Math.min(1, Math.max(0, e / t));
3910
3910
  }
3911
- const zi = Object.freeze({
3911
+ const Fi = Object.freeze({
3912
3912
  exact: !0,
3913
3913
  seed: null,
3914
3914
  direction: "as-loaded",
@@ -3916,7 +3916,7 @@ const zi = Object.freeze({
3916
3916
  precision: "f64",
3917
3917
  method: "exact",
3918
3918
  notes: Object.freeze([])
3919
- }), Li = Object.freeze({
3919
+ }), Ui = Object.freeze({
3920
3920
  setProgress: () => {
3921
3921
  },
3922
3922
  setMessage: () => {
@@ -3924,20 +3924,20 @@ const zi = Object.freeze({
3924
3924
  setPhase: () => {
3925
3925
  }
3926
3926
  });
3927
- function Fi(e) {
3927
+ function Vi(e) {
3928
3928
  return e instanceof Error && (e.name === "AbortError" || e.name === "TimeoutError");
3929
3929
  }
3930
- function Ui(e) {
3930
+ function Bi(e) {
3931
3931
  return e === "visible" ? "visible" : e === "graph" ? "whole graph" : e === "selection" ? "selection" : e === "largest-component" ? "largest component" : "set" in e ? `set ${e.set}` : "where" in e ? e.where : `${e.nodes.length} nodes`;
3932
3932
  }
3933
- function Vi(e) {
3933
+ function qi(e) {
3934
3934
  return typeof e == "string" ? e : typeof e == "number" ? String(e) : typeof e == "boolean" ? e ? "on" : "off" : e === void 0 ? "default" : ie(e);
3935
3935
  }
3936
- function Bi(e, t) {
3937
- const n = Lt(e)?.version;
3936
+ function Gi(e, t) {
3937
+ const n = zt(e)?.version;
3938
3938
  return n === void 0 ? t : Object.freeze({ ...t, plugins: Object.freeze({ [e]: n }) });
3939
3939
  }
3940
- function qi(e, t, n) {
3940
+ function Wi(e, t, n) {
3941
3941
  if (t.values !== void 0 && t.values.length > 0 && typeof n == "string") {
3942
3942
  const s = t.values.map((o) => o.value);
3943
3943
  if (!s.includes(n))
@@ -3965,14 +3965,14 @@ function qi(e, t, n) {
3965
3965
  });
3966
3966
  }
3967
3967
  }
3968
- class Gi {
3968
+ class Yi {
3969
3969
  /**
3970
3970
  * Build the runs API.
3971
3971
  * @param options - The queue, the catalogue, the scope resolver and the thing that does the
3972
3972
  * work.
3973
3973
  */
3974
3974
  constructor(t) {
3975
- this.runs = /* @__PURE__ */ new Map(), this.identities = /* @__PURE__ */ new Map(), this.derivedIds = /* @__PURE__ */ new Set(), this.batches = /* @__PURE__ */ new Set(), this.disposed = !1, this.options = t, this.defaultScope = t.defaultScope ?? "visible", this.defaultCaveats = t.defaultCaveats ?? zi;
3975
+ this.runs = /* @__PURE__ */ new Map(), this.identities = /* @__PURE__ */ new Map(), this.derivedIds = /* @__PURE__ */ new Set(), this.batches = /* @__PURE__ */ new Set(), this.disposed = !1, this.options = t, this.defaultScope = t.defaultScope ?? "visible", this.defaultCaveats = t.defaultCaveats ?? Fi;
3976
3976
  }
3977
3977
  // -- starting -----------------------------------------------------------------------------
3978
3978
  /**
@@ -3994,12 +3994,12 @@ class Gi {
3994
3994
  this.checkParams(o, n);
3995
3995
  const r = s.scope ?? this.defaultScope, i = {
3996
3996
  algorithm: o.key,
3997
- params: sr(n, o.options),
3997
+ params: rr(n, o.options),
3998
3998
  scope: r,
3999
3999
  seed: s.seed ?? null,
4000
4000
  sample: s.sample ?? null,
4001
4001
  exact: s.exact ?? null
4002
- }, a = s.as, c = a === void 0, l = a === void 0 ? Ge(i) : rr(a), g = this.runs.get(l);
4002
+ }, a = s.as, c = a === void 0, l = a === void 0 ? Ge(i) : ar(a), g = this.runs.get(l);
4003
4003
  return g !== void 0 ? this.reuse(g, i) : this.create(l, i, o, r, s, c);
4004
4004
  }
4005
4005
  /**
@@ -4043,7 +4043,7 @@ class Gi {
4043
4043
  queuePosition: () => null,
4044
4044
  stale: () => null,
4045
4045
  resolveScope: () => this.options.resolveScope(this.defaultScope),
4046
- enqueue: (l) => _n(l, r),
4046
+ enqueue: (l) => Cn(l, r),
4047
4047
  notify: (l) => {
4048
4048
  this.announce(c, l);
4049
4049
  }
@@ -4146,7 +4146,7 @@ class Gi {
4146
4146
  style: r.style ?? !0,
4147
4147
  shape: s.shape,
4148
4148
  fields: s.fields,
4149
- engine: Bi(s.key, this.options.engine),
4149
+ engine: Gi(s.key, this.options.engine),
4150
4150
  caveats: Object.freeze({
4151
4151
  ...this.defaultCaveats,
4152
4152
  seed: n.seed,
@@ -4160,7 +4160,7 @@ class Gi {
4160
4160
  queuePosition: () => this.queuePositionOf(t),
4161
4161
  stale: () => this.staleOf(t),
4162
4162
  resolveScope: () => this.options.resolveScope(o),
4163
- enqueue: (h) => a === "now" ? _n(h, t) : this.enqueueOnQueue(t, h),
4163
+ enqueue: (h) => a === "now" ? Cn(h, t) : this.enqueueOnQueue(t, h),
4164
4164
  notify: (h) => {
4165
4165
  this.announce(g, h), h === "end" && this.options.styling?.completed(g);
4166
4166
  }
@@ -4291,7 +4291,7 @@ class Gi {
4291
4291
  for (const o of n)
4292
4292
  for (const r of /* @__PURE__ */ new Set([...Object.keys(t.params), ...Object.keys(o.params)]))
4293
4293
  ie(t.params[r]) !== ie(o.params[r]) && s.add(r);
4294
- return s.size === 0 ? Ui(t.scope.spec) : [...s].sort((o, r) => o < r ? -1 : 1).map((o) => `${o} ${Vi(t.params[o])}`).join(", ");
4294
+ return s.size === 0 ? Bi(t.scope.spec) : [...s].sort((o, r) => o < r ? -1 : 1).map((o) => `${o} ${qi(t.params[o])}`).join(", ");
4295
4295
  }
4296
4296
  // -- the catalogue ------------------------------------------------------------------------
4297
4297
  /**
@@ -4310,7 +4310,7 @@ class Gi {
4310
4310
  * element reserves but does not run, or `E_UNKNOWN_ALGORITHM` when nothing registers that key.
4311
4311
  */
4312
4312
  descriptorFor(t) {
4313
- if (fs(t))
4313
+ if (ms(t))
4314
4314
  throw new _({
4315
4315
  code: "E_UNSUPPORTED",
4316
4316
  message: `The "${t}" algorithm is not implemented. The name is deprecated and will be removed at the next major release unless it is implemented first.`,
@@ -4353,7 +4353,7 @@ class Gi {
4353
4353
  available: t.options.map((i) => i.name)
4354
4354
  }
4355
4355
  });
4356
- qi(t.key, r, o);
4356
+ Wi(t.key, r, o);
4357
4357
  }
4358
4358
  }
4359
4359
  // -- batches ------------------------------------------------------------------------------
@@ -4429,7 +4429,7 @@ class Gi {
4429
4429
  try {
4430
4430
  return await o, { index: s, runId: o.id, ok: !0 };
4431
4431
  } catch (i) {
4432
- return { index: s, runId: o.id, ok: !1, reason: Wi(i) };
4432
+ return { index: s, runId: o.id, ok: !1, reason: Hi(i) };
4433
4433
  } finally {
4434
4434
  t.removeEventListener("abort", r);
4435
4435
  }
@@ -4464,31 +4464,31 @@ class Gi {
4464
4464
  });
4465
4465
  }
4466
4466
  }
4467
- function Wi(e) {
4468
- return Fi(e) ? "The batch was canceled." : e instanceof Error ? e.message : String(e);
4467
+ function Hi(e) {
4468
+ return Vi(e) ? "The batch was canceled." : e instanceof Error ? e.message : String(e);
4469
4469
  }
4470
- function _n(e, t) {
4470
+ function Cn(e, t) {
4471
4471
  const n = new AbortController();
4472
- return e({ signal: n.signal, progress: Li, id: `beside:${t}` }), {
4472
+ return e({ signal: n.signal, progress: Ui, id: `beside:${t}` }), {
4473
4473
  cancel: () => {
4474
4474
  n.abort(new DOMException(`Run "${t}" was canceled.`, "AbortError"));
4475
4475
  }
4476
4476
  };
4477
4477
  }
4478
- function Yi(e) {
4479
- return new Gi(e);
4480
- }
4481
- const Hi = Object.freeze(["user", "template", "plugin"]);
4482
4478
  function Ki(e) {
4479
+ return new Yi(e);
4480
+ }
4481
+ const Qi = Object.freeze(["user", "template", "plugin"]);
4482
+ function Xi(e) {
4483
4483
  return e.as === "highlight" ? "highlight" : e.channels.join(",");
4484
4484
  }
4485
- function Qi(e, t) {
4486
- return e.some((n) => !n.enabled || !Hi.includes(n.source.by) ? !1 : t.some((s) => {
4485
+ function Ji(e, t) {
4486
+ return e.some((n) => !n.enabled || !Qi.includes(n.source.by) ? !1 : t.some((s) => {
4487
4487
  const o = n.encode?.[s], r = n.set?.[s];
4488
4488
  return o !== void 0 || r !== void 0;
4489
4489
  }));
4490
4490
  }
4491
- function Xi(e) {
4491
+ function Zi(e) {
4492
4492
  const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
4493
4493
  let s = 0;
4494
4494
  const o = (i, a) => {
@@ -4505,14 +4505,14 @@ function Xi(e) {
4505
4505
  return;
4506
4506
  const c = a.list();
4507
4507
  for (const l of i)
4508
- Qi(c, l.suggestion.channels) || o(a, l);
4508
+ Ji(c, l.suggestion.channels) || o(a, l);
4509
4509
  };
4510
4510
  return {
4511
4511
  completed(i) {
4512
4512
  if (!(i.status !== "succeeded" || !i.style || t.has(i.id))) {
4513
4513
  t.add(i.id);
4514
- for (const a of As(i, i.style))
4515
- n.set(Ki(a), { runId: i.id, suggestion: a });
4514
+ for (const a of Cs(i, i.style))
4515
+ n.set(Xi(a), { runId: i.id, suggestion: a });
4516
4516
  s === 0 && r();
4517
4517
  }
4518
4518
  },
@@ -4530,8 +4530,8 @@ function Xi(e) {
4530
4530
  function Qe(e) {
4531
4531
  return typeof e == "number" && Number.isNaN(e);
4532
4532
  }
4533
- const Ji = [0, 1], Zi = 5;
4534
- function Yt(e) {
4533
+ const ea = [0, 1], ta = 5;
4534
+ function Wt(e) {
4535
4535
  if (typeof e == "number")
4536
4536
  return Number.isFinite(e) ? e : Number.NaN;
4537
4537
  if (typeof e == "string" && e.trim() !== "") {
@@ -4540,32 +4540,32 @@ function Yt(e) {
4540
4540
  }
4541
4541
  return Number.NaN;
4542
4542
  }
4543
- function ea(e) {
4543
+ function na(e) {
4544
4544
  return typeof e == "string" ? e : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" && Number.isFinite(e) ? String(e) : null;
4545
4545
  }
4546
4546
  function Be(e, t, n) {
4547
4547
  return Math.max(t, Math.min(n, e));
4548
4548
  }
4549
- function _s(e, t) {
4549
+ function Is(e, t) {
4550
4550
  if (Number.isNaN(e))
4551
4551
  return Number.NaN;
4552
- const n = t.reverse === !0 ? 1 - e : e, [s, o] = t.range ?? Ji;
4552
+ const n = t.reverse === !0 ? 1 - e : e, [s, o] = t.range ?? ea;
4553
4553
  return s + n * (o - s);
4554
4554
  }
4555
- function ta(e, t, n, s) {
4555
+ function sa(e, t, n, s) {
4556
4556
  return t === n ? 0 : s !== void 0 && Number.isFinite(s) && s !== t && s !== n ? (n > t ? e <= s : e >= s) ? Be(0.5 * (e - t) / (s - t), 0, 0.5) : Be(0.5 + 0.5 * (e - s) / (n - s), 0.5, 1) : Be((e - t) / (n - t), 0, 1);
4557
4557
  }
4558
- function na(e) {
4558
+ function oa(e) {
4559
4559
  const { exponent: t } = e;
4560
4560
  return t === void 0 || !Number.isFinite(t) ? 1 : t;
4561
4561
  }
4562
- function Is(e, t) {
4562
+ function Ts(e, t) {
4563
4563
  return Math.sign(e) * Math.abs(e) ** t;
4564
4564
  }
4565
- const sa = (e) => e, oa = (e) => e > 0 ? Math.log10(e) : Number.NaN, ra = (e) => e > 0 ? -Math.log10(e) : Number.NaN, ia = (e) => Is(e, 0.5), aa = (e, t) => Is(e, na(t));
4565
+ const ra = (e) => e, ia = (e) => e > 0 ? Math.log10(e) : Number.NaN, aa = (e) => e > 0 ? -Math.log10(e) : Number.NaN, ca = (e) => Ts(e, 0.5), la = (e, t) => Ts(e, oa(t));
4566
4566
  function Ae(e) {
4567
4567
  return (t, n) => {
4568
- const s = Yt(t);
4568
+ const s = Wt(t);
4569
4569
  if (Number.isNaN(s))
4570
4570
  return Number.NaN;
4571
4571
  const o = e(s, n);
@@ -4575,21 +4575,21 @@ function Ae(e) {
4575
4575
  if (!Number.isFinite(r) || !Number.isFinite(i))
4576
4576
  return Number.NaN;
4577
4577
  const a = n.midpoint === void 0 ? void 0 : e(n.midpoint, n);
4578
- return _s(ta(o, r, i, a), n);
4578
+ return Is(sa(o, r, i, a), n);
4579
4579
  };
4580
4580
  }
4581
4581
  function nt(e, t) {
4582
4582
  if (e === "bins") {
4583
4583
  const { bins: n } = t;
4584
- return n === void 0 || !Number.isFinite(n) ? Zi : Math.max(1, Math.floor(n));
4584
+ return n === void 0 || !Number.isFinite(n) ? ta : Math.max(1, Math.floor(n));
4585
4585
  }
4586
4586
  return e === "quantile" ? (t.thresholds?.length ?? 0) + 1 : e === "ordinal" ? t.categories?.length ?? 0 : 0;
4587
4587
  }
4588
4588
  function Xe(e, t, n) {
4589
- return e < 0 || t < 1 ? Number.NaN : _s(t > 1 ? e / (t - 1) : 0, n);
4589
+ return e < 0 || t < 1 ? Number.NaN : Is(t > 1 ? e / (t - 1) : 0, n);
4590
4590
  }
4591
- const ca = (e, t) => {
4592
- const n = Yt(e), [s, o] = t.domain;
4591
+ const ua = (e, t) => {
4592
+ const n = Wt(e), [s, o] = t.domain;
4593
4593
  if (Number.isNaN(n) || !Number.isFinite(s) || !Number.isFinite(o))
4594
4594
  return Number.NaN;
4595
4595
  const r = nt("bins", t);
@@ -4597,8 +4597,8 @@ const ca = (e, t) => {
4597
4597
  return Xe(0, r, t);
4598
4598
  const i = Be((n - s) / (o - s), 0, 1);
4599
4599
  return Xe(Math.min(r - 1, Math.floor(i * r)), r, t);
4600
- }, la = (e, t) => {
4601
- const n = Yt(e);
4600
+ }, da = (e, t) => {
4601
+ const n = Wt(e);
4602
4602
  if (Number.isNaN(n))
4603
4603
  return Number.NaN;
4604
4604
  const s = t.thresholds ?? [], o = s.length + 1;
@@ -4609,11 +4609,11 @@ const ca = (e, t) => {
4609
4609
  r += 1;
4610
4610
  }
4611
4611
  return Xe(Math.min(r, o - 1), o, t);
4612
- }, ua = (e, t) => {
4613
- const n = t.categories ?? [], s = ea(e);
4612
+ }, ha = (e, t) => {
4613
+ const n = t.categories ?? [], s = na(e);
4614
4614
  return s === null ? Number.NaN : Xe(n.indexOf(s), n.length, t);
4615
- }, da = (e) => typeof e == "number" ? Number.isFinite(e) ? e : Number.NaN : typeof e == "string" ? e : typeof e == "boolean" ? e ? "true" : "false" : Number.NaN;
4616
- function ha(e, t) {
4615
+ }, fa = (e) => typeof e == "number" ? Number.isFinite(e) ? e : Number.NaN : typeof e == "string" ? e : typeof e == "boolean" ? e ? "true" : "false" : Number.NaN;
4616
+ function ma(e, t) {
4617
4617
  const n = [...e].filter((r) => Number.isFinite(r)).sort((r, i) => r - i), s = Math.floor(t);
4618
4618
  if (n.length === 0 || s < 2)
4619
4619
  return [];
@@ -4625,19 +4625,19 @@ function ha(e, t) {
4625
4625
  return o;
4626
4626
  }
4627
4627
  const St = {
4628
- linear: Ae(sa),
4629
- log: Ae(oa),
4630
- neglog10: Ae(ra),
4631
- sqrt: Ae(ia),
4632
- pow: Ae(aa),
4633
- bins: ca,
4634
- quantile: la,
4635
- ordinal: ua,
4636
- passthrough: da
4628
+ linear: Ae(ra),
4629
+ log: Ae(ia),
4630
+ neglog10: Ae(aa),
4631
+ sqrt: Ae(ca),
4632
+ pow: Ae(la),
4633
+ bins: ua,
4634
+ quantile: da,
4635
+ ordinal: ha,
4636
+ passthrough: fa
4637
4637
  };
4638
- function Ht() {
4638
+ function Yt() {
4639
4639
  const e = /* @__PURE__ */ new Map(), t = St;
4640
- for (const n of ds) {
4640
+ for (const n of hs) {
4641
4641
  const s = t[n.name];
4642
4642
  if (s === void 0)
4643
4643
  throw new _({
@@ -4681,18 +4681,18 @@ function Ht() {
4681
4681
  }
4682
4682
  };
4683
4683
  }
4684
- const At = "ylorbr", Ct = "okabe-ito", fa = "linear", ma = [0, 1];
4685
- function Ts(e) {
4684
+ const At = "ylorbr", Ct = "okabe-ito", ga = "linear", pa = [0, 1];
4685
+ function Ps(e) {
4686
4686
  return be(e ?? Ct)?.capacity ?? null;
4687
4687
  }
4688
4688
  function _t(e, t) {
4689
4689
  const { capacity: n } = e;
4690
4690
  return { fits: n === null || t <= n, capacity: n, distinct: t };
4691
4691
  }
4692
- function ga(e) {
4692
+ function ba(e) {
4693
4693
  const t = be(e);
4694
4694
  if (t === void 0) {
4695
- const n = Ut();
4695
+ const n = Ft();
4696
4696
  throw new _({
4697
4697
  code: "E_UNKNOWN_PALETTE",
4698
4698
  message: `There is no palette named "${e}".`,
@@ -4709,15 +4709,15 @@ function ga(e) {
4709
4709
  });
4710
4710
  return t;
4711
4711
  }
4712
- function pa(e, t, n) {
4712
+ function va(e, t, n) {
4713
4713
  if (e.describe(t)?.domainKind !== "categorical")
4714
4714
  return At;
4715
4715
  const s = be(Ct);
4716
- return n === 0 || s !== void 0 && _t(s, n).fits ? Ct : [...Co("categorical")].filter((r) => _t(r, n).fits).sort(
4716
+ return n === 0 || s !== void 0 && _t(s, n).fits ? Ct : [...Io("categorical")].filter((r) => _t(r, n).fits).sort(
4717
4717
  (r, i) => (r.capacity ?? Number.POSITIVE_INFINITY) - (i.capacity ?? Number.POSITIVE_INFINITY)
4718
4718
  )[0]?.id ?? At;
4719
4719
  }
4720
- function ba(e) {
4720
+ function ya(e) {
4721
4721
  if (e === void 0 || e === "skip")
4722
4722
  return;
4723
4723
  const t = me(e.value);
@@ -4730,10 +4730,10 @@ function ba(e) {
4730
4730
  });
4731
4731
  return t;
4732
4732
  }
4733
- function va(e) {
4733
+ function wa(e) {
4734
4734
  return Math.max(512, 512 * (e - 1));
4735
4735
  }
4736
- function ya(e) {
4736
+ function Oa(e) {
4737
4737
  return e.colors.map((t) => {
4738
4738
  const n = me(t);
4739
4739
  if (n === null)
@@ -4746,8 +4746,8 @@ function ya(e) {
4746
4746
  return n;
4747
4747
  });
4748
4748
  }
4749
- function wa(e, t) {
4750
- const { scale: n = fa, palette: s, missing: o, overflow: r, ...i } = e, a = t.require(n), c = { ...i, range: ma }, l = nt(n, c), h = ga(s ?? pa(t, n, r === "other" || r === "shape" ? 0 : l)), y = { ...c, palette: h }, P = h.kind === "categorical", F = P && l === 0 ? h.colors.length : l;
4749
+ function Ea(e, t) {
4750
+ const { scale: n = ga, palette: s, missing: o, overflow: r, ...i } = e, a = t.require(n), c = { ...i, range: pa }, l = nt(n, c), h = ba(s ?? va(t, n, r === "other" || r === "shape" ? 0 : l)), y = { ...c, palette: h }, P = h.kind === "categorical", F = P && l === 0 ? h.colors.length : l;
4751
4751
  if (l > 0 && (r === void 0 || r === "other")) {
4752
4752
  const A = _t(h, l);
4753
4753
  if (!A.fits)
@@ -4758,7 +4758,7 @@ function wa(e, t) {
4758
4758
  details: { palette: h.id, capacity: A.capacity, groups: l, scale: n }
4759
4759
  });
4760
4760
  }
4761
- const U = ba(o), w = ya(h), N = va(h.colors.length), d = new Array(N + 1).fill(void 0), { colors: p } = h, O = w.length - 1, T = be(At)?.colors ?? p, $ = (A, S) => me(tn(S > 1 ? A / (S - 1) : 0, T)) ?? U;
4761
+ const U = ya(o), w = Oa(h), N = wa(h.colors.length), d = new Array(N + 1).fill(void 0), { colors: p } = h, O = w.length - 1, T = be(At)?.colors ?? p, $ = (A, S) => me(en(S > 1 ? A / (S - 1) : 0, T)) ?? U;
4762
4762
  return {
4763
4763
  palette: h,
4764
4764
  scale: n,
@@ -4777,19 +4777,19 @@ function wa(e, t) {
4777
4777
  const j = Math.max(0, Math.min(N, Math.round(S * N))), f = d[j];
4778
4778
  if (f !== void 0)
4779
4779
  return f;
4780
- const I = me(tn(j / N, p));
4780
+ const I = me(en(j / N, p));
4781
4781
  return I === null ? U : (d[j] = I, I);
4782
4782
  }
4783
4783
  };
4784
4784
  }
4785
- const Oa = 4, Ps = Object.freeze([
4785
+ const Na = 4, $s = Object.freeze([
4786
4786
  "icosphere",
4787
4787
  "box",
4788
4788
  "octahedron",
4789
4789
  "cylinder",
4790
4790
  "cone",
4791
4791
  "torus"
4792
- ]), Ea = Object.freeze({
4792
+ ]), Sa = Object.freeze({
4793
4793
  seen: 0,
4794
4794
  unreadable: 0,
4795
4795
  notPlottable: 0,
@@ -4800,7 +4800,7 @@ const Oa = 4, Ps = Object.freeze([
4800
4800
  function ne(e, t) {
4801
4801
  return new _({ code: "E_BAD_LAYER", message: e, source: "style", details: t });
4802
4802
  }
4803
- function $s(e) {
4803
+ function ks(e) {
4804
4804
  const t = et(e);
4805
4805
  if (t === void 0)
4806
4806
  throw new _({
@@ -4811,10 +4811,10 @@ function $s(e) {
4811
4811
  });
4812
4812
  return t;
4813
4813
  }
4814
- function Na(e) {
4814
+ function Aa(e) {
4815
4815
  return Object.hasOwn(St, e);
4816
4816
  }
4817
- function ks(e) {
4817
+ function Ms(e) {
4818
4818
  if (typeof e == "number")
4819
4819
  return Number.isFinite(e) ? e : Number.NaN;
4820
4820
  if (typeof e == "string" && e.trim() !== "") {
@@ -4826,25 +4826,25 @@ function ks(e) {
4826
4826
  function st(e) {
4827
4827
  return typeof e == "string" ? e : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" && Number.isFinite(e) ? String(e) : null;
4828
4828
  }
4829
- function Ms(e, t, n) {
4829
+ function Rs(e, t, n) {
4830
4830
  return Math.max(t, Math.min(n, e));
4831
4831
  }
4832
- function Rs(e) {
4832
+ function Ds(e) {
4833
4833
  return typeof e == "object" && e !== null && "r" in e && "g" in e && "b" in e;
4834
4834
  }
4835
- function Ds(e) {
4835
+ function xs(e) {
4836
4836
  const t = (n) => nt(e, { ...n });
4837
4837
  return {
4838
4838
  categories: t({ categories: ["a"] }) !== t({ categories: ["a", "b"] }),
4839
4839
  thresholds: t({ thresholds: [1] }) !== t({ thresholds: [1, 2] })
4840
4840
  };
4841
4841
  }
4842
- function Sa(e, t) {
4842
+ function Ca(e, t) {
4843
4843
  const n = [], s = /* @__PURE__ */ new Map();
4844
4844
  let o = 0, r = 0, i = 0;
4845
4845
  for (const a of e ?? []) {
4846
4846
  if (o++, t) {
4847
- const l = ks(a);
4847
+ const l = Ms(a);
4848
4848
  if (Number.isNaN(l)) {
4849
4849
  r++;
4850
4850
  continue;
@@ -4861,13 +4861,13 @@ function Sa(e, t) {
4861
4861
  }
4862
4862
  return n.sort((a, c) => a - c), { seen: o, unreadable: r, sorted: n, nonPositive: i, categoryCounts: s };
4863
4863
  }
4864
- function In(e, t) {
4864
+ function _n(e, t) {
4865
4865
  if (e.length === 0)
4866
4866
  return Number.NaN;
4867
- const n = (e.length - 1) * Ms(t, 0, 100) / 100, s = Math.floor(n), o = Math.min(s + 1, e.length - 1);
4867
+ const n = (e.length - 1) * Rs(t, 0, 100) / 100, s = Math.floor(n), o = Math.min(s + 1, e.length - 1);
4868
4868
  return e[s] + (e[o] - e[s]) * (n - s);
4869
4869
  }
4870
- function Aa(e) {
4870
+ function _a(e) {
4871
4871
  for (const t of e)
4872
4872
  if (t > 0)
4873
4873
  return t;
@@ -4877,7 +4877,7 @@ function It(e, t, n) {
4877
4877
  const s = { ...t, domain: n };
4878
4878
  return !Qe(e(n[0], s)) && !Qe(e(n[1], s));
4879
4879
  }
4880
- function Ca(e) {
4880
+ function Ia(e) {
4881
4881
  const [t, n] = e;
4882
4882
  if (!(Number.isFinite(t) && Number.isFinite(n)) || t < 0 || n > 100 || t >= n)
4883
4883
  throw ne(
@@ -4887,7 +4887,7 @@ function Ca(e) {
4887
4887
  }
4888
4888
  );
4889
4889
  }
4890
- function _a(e, t, n, s, o) {
4890
+ function Ta(e, t, n, s, o) {
4891
4891
  const { clamp: r, domain: i } = e, a = Array.isArray(i) ? [i[0], i[1]] : null;
4892
4892
  if (a !== null && r !== void 0)
4893
4893
  throw ne(
@@ -4903,21 +4903,21 @@ function _a(e, t, n, s, o) {
4903
4903
  departures: c ? [] : [`no value has a place between ${String(a[0])} and ${String(a[1])}`]
4904
4904
  };
4905
4905
  }
4906
- return Ia(r, t, n, s, o);
4906
+ return Pa(r, t, n, s, o);
4907
4907
  }
4908
- function Ia(e, t, n, s, o) {
4908
+ function Pa(e, t, n, s, o) {
4909
4909
  const { sorted: r } = t, i = [];
4910
4910
  if (r.length === 0)
4911
4911
  return { domain: [0, 1], notPlottable: 0, clamped: 0, departures: ["nothing measured"] };
4912
4912
  let a = r[0], c = r[r.length - 1], l = 0;
4913
- if (e !== void 0 && (Ca(e), a = In(r, e[0]), c = In(r, e[1]), l = r.filter((h) => h < a || h > c).length, i.push(`clamped at p${String(e[0])}/p${String(e[1])}`)), It(n, s, [a, c]))
4913
+ if (e !== void 0 && (Ia(e), a = _n(r, e[0]), c = _n(r, e[1]), l = r.filter((h) => h < a || h > c).length, i.push(`clamped at p${String(e[0])}/p${String(e[1])}`)), It(n, s, [a, c]))
4914
4914
  return { domain: [a, c], notPlottable: 0, clamped: l, departures: i };
4915
- const g = Aa(r);
4915
+ const g = _a(r);
4916
4916
  return g !== null && g <= c && It(n, s, [g, c]) ? (i.push(`${String(t.nonPositive)} not plottable on a ${o} scale`), { domain: [g, c], notPlottable: t.nonPositive, clamped: l, departures: i }) : (i.push(`no value is plottable on a ${o} scale`), { domain: [a, c], notPlottable: r.length, clamped: l, departures: i });
4917
4917
  }
4918
- function Ta(e, t, n) {
4918
+ function $a(e, t, n) {
4919
4919
  const s = [...e.categoryCounts.entries()].sort(
4920
- (a, c) => c[1] - a[1] || a[0].localeCompare(c[0])
4920
+ (a, c) => c[1] - a[1] || yo(a[0], c[0])
4921
4921
  );
4922
4922
  if (t === void 0 && s.length <= n)
4923
4923
  return { categories: s.map(([a]) => a), lumped: [], other: 0 };
@@ -4932,7 +4932,7 @@ function Ta(e, t, n) {
4932
4932
  }
4933
4933
  return { categories: o, lumped: r, other: i };
4934
4934
  }
4935
- function Pa(e) {
4935
+ function ka(e) {
4936
4936
  const t = e.values ?? [];
4937
4937
  return (n) => {
4938
4938
  if (typeof n == "string")
@@ -4941,17 +4941,17 @@ function Pa(e) {
4941
4941
  return s >= 0 && s < t.length ? t[s] : void 0;
4942
4942
  };
4943
4943
  }
4944
- function $a(e) {
4944
+ function Ma(e) {
4945
4945
  switch (e.accepts) {
4946
4946
  case "number": {
4947
4947
  const t = e.min ?? Number.NEGATIVE_INFINITY, n = e.max ?? Number.POSITIVE_INFINITY;
4948
4948
  return (s) => {
4949
- const o = typeof s == "number" ? s : ks(s);
4950
- return Number.isFinite(o) ? Ms(o, t, n) : void 0;
4949
+ const o = typeof s == "number" ? s : Ms(s);
4950
+ return Number.isFinite(o) ? Rs(o, t, n) : void 0;
4951
4951
  };
4952
4952
  }
4953
4953
  case "enum":
4954
- return Pa(e);
4954
+ return ka(e);
4955
4955
  case "text":
4956
4956
  return (t) => typeof t == "string" ? t : String(t);
4957
4957
  case "boolean":
@@ -4962,12 +4962,12 @@ function $a(e) {
4962
4962
  }
4963
4963
  }
4964
4964
  function Tt(e, t) {
4965
- const n = typeof e == "string" || Rs(e) ? me(e) : null;
4965
+ const n = typeof e == "string" || Ds(e) ? me(e) : null;
4966
4966
  if (n === null)
4967
4967
  throw ne(`${t} is not a colour.`, { value: e });
4968
4968
  return n;
4969
4969
  }
4970
- function xs(e) {
4970
+ function js(e) {
4971
4971
  return new _({
4972
4972
  code: "E_UNSUPPORTED",
4973
4973
  message: `${e.plainName} accepts no value: ${e.caveat ?? "the element draws nothing for it."}`,
@@ -4975,7 +4975,7 @@ function xs(e) {
4975
4975
  details: { channel: e.channel }
4976
4976
  });
4977
4977
  }
4978
- function Tn(e, t, n) {
4978
+ function In(e, t, n) {
4979
4979
  const { max: s, min: o, values: r } = e, i = r === void 0 ? `is drawn from ${o === void 0 ? "any" : String(o)} to ${s === void 0 ? "any" : String(s)}` : `takes one of ${r.join(", ")}`;
4980
4980
  return new _({
4981
4981
  code: "E_OPTION_RANGE",
@@ -4994,7 +4994,7 @@ function Je(e, t, n) {
4994
4994
  throw r("a number");
4995
4995
  const { max: i, min: a } = e;
4996
4996
  if (a !== void 0 && t < a || i !== void 0 && t > i)
4997
- throw Tn(e, t, n);
4997
+ throw In(e, t, n);
4998
4998
  return t;
4999
4999
  }
5000
5000
  case "text":
@@ -5009,17 +5009,17 @@ function Je(e, t, n) {
5009
5009
  }
5010
5010
  case "enum":
5011
5011
  if (typeof t != "string" || !(o ?? []).includes(t))
5012
- throw Tn(e, t, n);
5012
+ throw In(e, t, n);
5013
5013
  return t;
5014
5014
  case "labelStyle":
5015
- if (typeof t != "object" || Rs(t))
5015
+ if (typeof t != "object" || Ds(t))
5016
5016
  throw r('a label style, such as { sizePx: 14, weight: "bold" }');
5017
5017
  return t;
5018
5018
  default:
5019
- throw xs(e);
5019
+ throw js(e);
5020
5020
  }
5021
5021
  }
5022
- function ka(e, t) {
5022
+ function Ra(e, t) {
5023
5023
  const n = Je(e, t.value, `The value written to ${e.channel}`);
5024
5024
  return {
5025
5025
  channel: e.channel,
@@ -5030,40 +5030,40 @@ function ka(e, t) {
5030
5030
  categories: [],
5031
5031
  lumped: [],
5032
5032
  groups: 0,
5033
- counts: Ea,
5033
+ counts: Sa,
5034
5034
  departures: [],
5035
5035
  paint: () => n
5036
5036
  };
5037
5037
  }
5038
- function Ma(e) {
5038
+ function Da(e) {
5039
5039
  return e === "color" || e === "number" ? "linear" : "passthrough";
5040
5040
  }
5041
- function Ra(e, t, n) {
5041
+ function xa(e, t, n) {
5042
5042
  const { accepts: s, channel: o } = e;
5043
5043
  if (s === "nothing")
5044
- throw xs(e);
5044
+ throw js(e);
5045
5045
  if (s === "labelStyle")
5046
5046
  throw ne(
5047
5047
  `${o} carries a whole label style, which no scale produces, so it is written as a value rather than bound to a path.`,
5048
5048
  { channel: o }
5049
5049
  );
5050
- if ((s === "text" || s === "boolean") && n && Na(t))
5050
+ if ((s === "text" || s === "boolean") && n && Aa(t))
5051
5051
  throw ne(
5052
5052
  `The "${t}" scale answers a position, and a position is not a value ${o} carries. Read the value as it is with "passthrough", or name individual values with "map".`,
5053
5053
  { channel: o, scale: t }
5054
5054
  );
5055
5055
  }
5056
- function Da(e, t, n, s) {
5056
+ function ja(e, t, n, s) {
5057
5057
  if (s)
5058
5058
  return;
5059
- const o = Ds(t), r = [];
5059
+ const o = xs(t), r = [];
5060
5060
  if (n && (!Array.isArray(e.domain) || e.clamp !== void 0) && r.push("the extent its values span"), o.categories && r.push("the categories it numbers"), o.thresholds && r.push("the cut points it groups at"), r.length > 0)
5061
5061
  throw ne(
5062
5062
  `This binding is worked out from the values of "${e.by}" -- ${r.join(", ")} -- and none were supplied.`,
5063
5063
  { path: e.by, scale: t, needs: r }
5064
5064
  );
5065
5065
  }
5066
- function xa(e, t) {
5066
+ function za(e, t) {
5067
5067
  if (e === void 0 || e === "skip")
5068
5068
  return e;
5069
5069
  if (typeof e.value != "string")
@@ -5073,11 +5073,11 @@ function xa(e, t) {
5073
5073
  });
5074
5074
  return { value: e.value };
5075
5075
  }
5076
- function ja(e, t, n) {
5076
+ function La(e, t, n) {
5077
5077
  const s = /* @__PURE__ */ new Map(), { other: o } = e;
5078
5078
  if (t.length > 0) {
5079
5079
  const r = Tt(
5080
- o?.value ?? $o,
5080
+ o?.value ?? Mo,
5081
5081
  `The colour the "other" bucket paints on ${n.channel}`
5082
5082
  );
5083
5083
  for (const i of t)
@@ -5087,7 +5087,7 @@ function ja(e, t, n) {
5087
5087
  s.set(r, Tt(i, `The colour "${r}" is mapped to on ${n.channel}`));
5088
5088
  return s.size === 0 ? null : s;
5089
5089
  }
5090
- function za(e, t, n) {
5090
+ function Fa(e, t, n) {
5091
5091
  const { bins: s, categories: o, domain: r, exponent: i, midpoint: a, reverse: c, thresholds: l } = n.context, g = {
5092
5092
  bins: s,
5093
5093
  categories: o,
@@ -5098,9 +5098,9 @@ function za(e, t, n) {
5098
5098
  thresholds: l,
5099
5099
  scale: n.scale,
5100
5100
  palette: t.palette,
5101
- missing: xa(t.missing, e),
5101
+ missing: za(t.missing, e),
5102
5102
  overflow: t.overflow
5103
- }, h = wa(g, n.scales), y = ja(t, n.categories.lumped, e);
5103
+ }, h = Ea(g, n.scales), y = La(t, n.categories.lumped, e);
5104
5104
  return {
5105
5105
  palette: h.palette,
5106
5106
  groups: h.groups,
@@ -5110,7 +5110,7 @@ function za(e, t, n) {
5110
5110
  }
5111
5111
  };
5112
5112
  }
5113
- function La(e, t, n, s) {
5113
+ function Ua(e, t, n, s) {
5114
5114
  if (e.accepts !== "enum") {
5115
5115
  const { range: i } = t;
5116
5116
  return i === void 0 ? n.context : { ...n.context, range: [i[0], i[1]] };
@@ -5125,12 +5125,12 @@ function La(e, t, n, s) {
5125
5125
  });
5126
5126
  return { ...n.context, range: [0, Math.max(0, r - 1)] };
5127
5127
  }
5128
- function Fa(e, t) {
5128
+ function Va(e, t) {
5129
5129
  const { missing: n } = t;
5130
5130
  if (!(n === void 0 || n === "skip"))
5131
5131
  return Je(e, n.value, `What a missing value paints on ${e.channel}`);
5132
5132
  }
5133
- function Ua(e, t, n) {
5133
+ function Ba(e, t, n) {
5134
5134
  const s = /* @__PURE__ */ new Map(), { other: o } = e;
5135
5135
  if (o !== void 0) {
5136
5136
  const r = `The value the "other" bucket paints on ${n.channel}`, i = Je(n, o.value, r);
@@ -5143,10 +5143,10 @@ function Ua(e, t, n) {
5143
5143
  }
5144
5144
  return s.size === 0 ? null : s;
5145
5145
  }
5146
- function Va(e, t, n) {
5146
+ function qa(e, t, n) {
5147
5147
  if (t.overflow === "shape" && e.channel === "node.shape")
5148
- return Ba(t, n);
5149
- const s = $a(e), o = nt(n.scale, n.context), r = La(e, t, n, o), i = Fa(e, t), a = Ua(t, n.categories.lumped, e), { map: c } = n;
5148
+ return Ga(t, n);
5149
+ const s = Ma(e), o = nt(n.scale, n.context), r = Ua(e, t, n, o), i = Va(e, t), a = Ba(t, n.categories.lumped, e), { map: c } = n;
5150
5150
  return {
5151
5151
  palette: null,
5152
5152
  groups: o,
@@ -5161,9 +5161,9 @@ function Va(e, t, n) {
5161
5161
  }
5162
5162
  };
5163
5163
  }
5164
- function Ba(e, t) {
5165
- const n = Ts(e.palette) ?? Number.POSITIVE_INFINITY, s = new Map(
5166
- t.categories.categories.map((o, r) => [o, Ps[Math.floor(r / n)]])
5164
+ function Ga(e, t) {
5165
+ const n = Ps(e.palette) ?? Number.POSITIVE_INFINITY, s = new Map(
5166
+ t.categories.categories.map((o, r) => [o, $s[Math.floor(r / n)]])
5167
5167
  );
5168
5168
  return {
5169
5169
  palette: null,
@@ -5174,22 +5174,22 @@ function Ba(e, t) {
5174
5174
  }
5175
5175
  };
5176
5176
  }
5177
- function qa(e, t, n) {
5177
+ function Wa(e, t, n) {
5178
5178
  const { overflow: s } = t;
5179
5179
  if (s === "shape" && e.target === "edge")
5180
5180
  throw ne(
5181
5181
  `overflow "shape" draws the groups past the palette in other node shapes, and an edge has no shape, so ${e.channel} cannot use it. Use "other" or "extend".`,
5182
5182
  { channel: e.channel, overflow: s }
5183
5183
  );
5184
- const o = Ts(t.palette);
5185
- return n || o === null || s !== "other" && s !== "shape" ? Number.POSITIVE_INFINITY : s === "other" ? o : o * Ps.length;
5184
+ const o = Ps(t.palette);
5185
+ return n || o === null || s !== "other" && s !== "shape" ? Number.POSITIVE_INFINITY : s === "other" ? o : o * $s.length;
5186
5186
  }
5187
- function Ga(e) {
5187
+ function Ya(e) {
5188
5188
  const t = [];
5189
5189
  return e.unreadable > 0 && t.push(`${String(e.unreadable)} carry no value the scale can read`), e.other > 0 && t.push(`${String(e.other)} lumped into "other"`), e.unmeasured > 0 && t.push(`not measured (${String(e.unmeasured)})`), t;
5190
5190
  }
5191
- function Wa(e, t, n) {
5192
- const s = e.accepts === "color" ? za(e, t, n) : Va(e, t, n), o = {
5191
+ function Ha(e, t, n) {
5192
+ const s = e.accepts === "color" ? Fa(e, t, n) : qa(e, t, n), o = {
5193
5193
  seen: n.facts.seen,
5194
5194
  unreadable: n.facts.unreadable,
5195
5195
  notPlottable: n.settled.notPlottable,
@@ -5207,12 +5207,12 @@ function Wa(e, t, n) {
5207
5207
  lumped: n.categories.lumped,
5208
5208
  groups: s.groups,
5209
5209
  counts: o,
5210
- departures: Object.freeze([...n.settled.departures, ...Ga(o)]),
5210
+ departures: Object.freeze([...n.settled.departures, ...Ya(o)]),
5211
5211
  paint: s.paint
5212
5212
  };
5213
5213
  }
5214
- function Ya(e, t, n) {
5215
- const s = t.scale ?? Ma(e.accepts), o = n.scales.require(s), r = n.scales.describe(s);
5214
+ function Ka(e, t, n) {
5215
+ const s = t.scale ?? Da(e.accepts), o = n.scales.require(s), r = n.scales.describe(s);
5216
5216
  if (r === void 0)
5217
5217
  throw new _({
5218
5218
  code: "E_INTERNAL",
@@ -5221,20 +5221,20 @@ function Ya(e, t, n) {
5221
5221
  details: { scale: s }
5222
5222
  });
5223
5223
  const i = r.domainKind === "numeric";
5224
- if (Ra(e, s, i), Da(t, s, i, n.column !== void 0), i && t.other !== void 0)
5224
+ if (xa(e, s, i), ja(t, s, i, n.column !== void 0), i && t.other !== void 0)
5225
5225
  throw ne(
5226
5226
  `An "other" bucket lumps the rarest categories together, and the "${s}" scale reads numbers rather than categories.`,
5227
5227
  { scale: s, other: t.other }
5228
5228
  );
5229
- const a = Sa(n.column, i), c = Ta(a, t.other, qa(e, t, i)), l = {
5229
+ const a = Ca(n.column, i), c = $a(a, t.other, Wa(e, t, i)), l = {
5230
5230
  reverse: t.reverse,
5231
5231
  midpoint: t.midpoint,
5232
5232
  bins: t.bins,
5233
5233
  exponent: t.exponent,
5234
5234
  categories: c.categories,
5235
- thresholds: Ds(s).thresholds ? ha(a.sorted, t.bins ?? Oa) : void 0
5236
- }, g = i ? _a(t, a, o, l, s) : { domain: [0, 1], notPlottable: 0, clamped: 0, departures: [] };
5237
- return Wa(e, t, {
5235
+ thresholds: xs(s).thresholds ? ma(a.sorted, t.bins ?? Na) : void 0
5236
+ }, g = i ? Ta(t, a, o, l, s) : { domain: [0, 1], notPlottable: 0, clamped: 0, departures: [] };
5237
+ return Ha(e, t, {
5238
5238
  scale: s,
5239
5239
  map: o,
5240
5240
  scales: n.scales,
@@ -5246,32 +5246,32 @@ function Ya(e, t, n) {
5246
5246
  unmeasured: n.unmeasured ?? 0
5247
5247
  });
5248
5248
  }
5249
- function Ha(e) {
5250
- const t = $s(e.channel), { binding: n } = e;
5251
- return "value" in n ? ka(t, n) : Ya(t, n, e);
5249
+ function Qa(e) {
5250
+ const t = ks(e.channel), { binding: n } = e;
5251
+ return "value" in n ? Ra(t, n) : Ka(t, n, e);
5252
5252
  }
5253
- const Ka = {
5253
+ const Xa = {
5254
5254
  community: "ordinal",
5255
5255
  "layered-grouping": "ordinal",
5256
5256
  "category-table": "ordinal"
5257
5257
  };
5258
- function Qa(e, t, n, s) {
5258
+ function Ja(e, t, n, s) {
5259
5259
  if (s === "text" || s === "boolean")
5260
5260
  return "passthrough";
5261
- const o = n ? Ka[t] : void 0;
5261
+ const o = n ? Xa[t] : void 0;
5262
5262
  return o !== void 0 ? o : e.type === "string" || e.type === "boolean" ? "ordinal" : "linear";
5263
5263
  }
5264
5264
  function pe(e, t) {
5265
5265
  return new _({ code: "E_BAD_COMMAND", message: e, source: "style", details: t });
5266
5266
  }
5267
- function Xa(e) {
5267
+ function Za(e) {
5268
5268
  return typeof e == "string" ? e : "runId" in e ? e.runId : e.id;
5269
5269
  }
5270
- function Ja(e, t) {
5270
+ function ec(e, t) {
5271
5271
  const n = t.run(e.run);
5272
5272
  if (n !== void 0)
5273
5273
  return n;
5274
- const s = Xa(e.run), o = t.runIds();
5274
+ const s = Za(e.run), o = t.runIds();
5275
5275
  throw new _({
5276
5276
  code: "E_UNKNOWN_RUN",
5277
5277
  message: `There is no run called "${s}" in this session.`,
@@ -5279,7 +5279,7 @@ function Ja(e, t) {
5279
5279
  details: { run: s, available: o, candidates: tt(s, o) }
5280
5280
  });
5281
5281
  }
5282
- function Za(e, t) {
5282
+ function tc(e, t) {
5283
5283
  const { layer: n } = Me(e.shape);
5284
5284
  if (n === "none")
5285
5285
  throw pe(
@@ -5292,7 +5292,7 @@ function Za(e, t) {
5292
5292
  { run: e.id, shape: e.shape }
5293
5293
  );
5294
5294
  }
5295
- function ec(e, t, n) {
5295
+ function nc(e, t, n) {
5296
5296
  const { primaryField: s } = Me(t.shape), o = e.field ?? s;
5297
5297
  if (o == null)
5298
5298
  throw pe(`A "${t.shape}" result has no primary field, so the field to encode has to be named.`, {
@@ -5309,9 +5309,9 @@ function ec(e, t, n) {
5309
5309
  details: { run: t.id, field: o, available: i, candidates: tt(o, i) }
5310
5310
  });
5311
5311
  }
5312
- return tc(r, t, n), { field: r, primary: o === s };
5312
+ return sc(r, t, n), { field: r, primary: o === s };
5313
5313
  }
5314
- function tc(e, t, n) {
5314
+ function sc(e, t, n) {
5315
5315
  if (e.kind === "graph")
5316
5316
  throw pe(
5317
5317
  `"${e.name}" is one number for the whole graph, so there is nothing per element for ${n.channel} to read.`,
@@ -5329,16 +5329,16 @@ function tc(e, t, n) {
5329
5329
  channel: n.channel
5330
5330
  });
5331
5331
  }
5332
- function nc(e, t, n, s) {
5332
+ function oc(e, t, n, s) {
5333
5333
  const o = { by: t, scale: n };
5334
5334
  s.accepts === "color" && e.palette !== void 0 && (o.palette = e.palette), e.domain !== void 0 && (o.domain = e.domain), e.clamp !== void 0 && (o.clamp = e.clamp), e.range !== void 0 && (o.range = e.range), e.missing !== void 0 && (o.missing = e.missing), e.reverse !== void 0 && (o.reverse = e.reverse);
5335
- const r = sc(e, n, s);
5335
+ const r = rc(e, n, s);
5336
5336
  return r !== void 0 && (o.overflow = r), o;
5337
5337
  }
5338
- function sc(e, t, n) {
5339
- return n.accepts !== "color" ? void 0 : e.overflow !== void 0 ? e.overflow : _o(t)?.domainKind === "categorical" && e.palette === void 0 ? "other" : void 0;
5338
+ function rc(e, t, n) {
5339
+ return n.accepts !== "color" ? void 0 : e.overflow !== void 0 ? e.overflow : To(t)?.domainKind === "categorical" && e.palette === void 0 ? "other" : void 0;
5340
5340
  }
5341
- function oc(e, t, n) {
5341
+ function ic(e, t, n) {
5342
5342
  if (t.overflow !== "shape")
5343
5343
  return {};
5344
5344
  if (n.target === "edge")
@@ -5349,25 +5349,25 @@ function oc(e, t, n) {
5349
5349
  const s = { by: t.by, scale: t.scale, overflow: "shape" };
5350
5350
  return t.palette !== void 0 && (s.palette = t.palette), { "node.shape": s };
5351
5351
  }
5352
- function rc(e, t) {
5353
- const n = $s(e.channel), s = Ja(e, t), { primaryField: o } = Me(s.shape);
5354
- Za(s, (e.field ?? o) === o);
5355
- const { field: r, primary: i } = ec(e, s, n), a = Ft(s.id, r.name), c = e.scale ?? Qa(r, s.shape, i, n.accepts), l = nc(e, a, c, n);
5352
+ function ac(e, t) {
5353
+ const n = ks(e.channel), s = ec(e, t), { primaryField: o } = Me(s.shape);
5354
+ tc(s, (e.field ?? o) === o);
5355
+ const { field: r, primary: i } = nc(e, s, n), a = Lt(s.id, r.name), c = e.scale ?? Ja(r, s.shape, i, n.accepts), l = oc(e, a, c, n);
5356
5356
  return {
5357
5357
  name: e.name ?? `${s.label} - ${n.plainName}`,
5358
5358
  target: n.target,
5359
5359
  kind: "encoding",
5360
5360
  selector: { match: "has", path: a },
5361
- encode: { [e.channel]: l, ...oc(e, l, n) },
5361
+ encode: { [e.channel]: l, ...ic(e, l, n) },
5362
5362
  source: { by: "run", runId: s.id, algorithm: s.algorithm, params: s.params }
5363
5363
  };
5364
5364
  }
5365
- const ic = Object.freeze({
5365
+ const cc = Object.freeze({
5366
5366
  merged: Object.freeze({}),
5367
5367
  contributions: Object.freeze([]),
5368
5368
  channels: Object.freeze([])
5369
- }), Pn = Object.freeze([]);
5370
- function $n(e) {
5369
+ }), Tn = Object.freeze([]);
5370
+ function Pn(e) {
5371
5371
  const t = "node" in e ? "node" : "edge", n = "node" in e ? e.node : e.edge;
5372
5372
  return new _({
5373
5373
  code: "E_BAD_COMMAND",
@@ -5376,7 +5376,7 @@ function $n(e) {
5376
5376
  details: { kind: t, id: n }
5377
5377
  });
5378
5378
  }
5379
- function Pt(e, t, n) {
5379
+ function $n(e, t, n) {
5380
5380
  return new _({
5381
5381
  code: "E_BAD_COMMAND",
5382
5382
  message: e,
@@ -5385,33 +5385,33 @@ function Pt(e, t, n) {
5385
5385
  details: n
5386
5386
  });
5387
5387
  }
5388
- function js(e, t) {
5388
+ function zs(e, t) {
5389
5389
  if ("node" in e) {
5390
5390
  const s = t.nodeIndex(e.node);
5391
5391
  if (s === void 0)
5392
- throw $n(e);
5392
+ throw Pn(e);
5393
5393
  return { target: "node", index: s };
5394
5394
  }
5395
5395
  const n = t.edgeIndex(e.edge);
5396
5396
  if (n === void 0)
5397
- throw $n(e);
5397
+ throw Pn(e);
5398
5398
  return { target: "edge", index: n };
5399
5399
  }
5400
- function ac(e, t) {
5400
+ function lc(e, t) {
5401
5401
  const { layer: n, selector: s } = e;
5402
5402
  return !n.enabled || n.target !== t.target ? !1 : s.test === null || s.test(t.index);
5403
5403
  }
5404
- function cc(e, t) {
5404
+ function uc(e, t) {
5405
5405
  const { layer: n, mode: s, path: o } = e;
5406
5406
  if (n.locked)
5407
5407
  return `"${n.name}" belongs to the element, so it cannot be edited. Add a layer of your own above it instead.`;
5408
5408
  if (s === "encoded")
5409
5409
  return `"${n.name}" works ${t} out from "${String(o)}", so a fixed value written here would be replaced the next time the layer paints. Resolve the rule to a fixed value first.`;
5410
5410
  }
5411
- function lc(e, t) {
5412
- const n = js(e, t), s = ke(t.elements, n.target), o = {}, r = o, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = [];
5411
+ function dc(e, t) {
5412
+ const n = zs(e, t), s = ke(t.elements, n.target), o = {}, r = o, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = [];
5413
5413
  for (const h of t.stack()) {
5414
- if (!ac(h, n))
5414
+ if (!lc(h, n))
5415
5415
  continue;
5416
5416
  const { layer: y } = h;
5417
5417
  for (const P of t.encoding(y.id)) {
@@ -5425,7 +5425,7 @@ function lc(e, t) {
5425
5425
  }
5426
5426
  }
5427
5427
  if (c.length === 0)
5428
- return ic;
5428
+ return cc;
5429
5429
  const l = c.map(
5430
5430
  (h) => ({
5431
5431
  layerId: h.layer.id,
@@ -5438,7 +5438,7 @@ function lc(e, t) {
5438
5438
  const y = i.get(h);
5439
5439
  if (y === void 0)
5440
5440
  continue;
5441
- const P = cc(y, h);
5441
+ const P = uc(y, h);
5442
5442
  g.push({
5443
5443
  channel: h,
5444
5444
  layerId: y.layer.id,
@@ -5453,10 +5453,10 @@ function lc(e, t) {
5453
5453
  channels: Object.freeze(g)
5454
5454
  };
5455
5455
  }
5456
- function uc(e) {
5456
+ function hc(e) {
5457
5457
  const t = e.paths;
5458
5458
  if (t === void 0)
5459
- return Pn;
5459
+ return Tn;
5460
5460
  const n = [];
5461
5461
  for (const s of e.stack()) {
5462
5462
  const { layer: o, selector: r } = s, i = new Set(r.paths);
@@ -5471,9 +5471,9 @@ function uc(e) {
5471
5471
  needs: Object.freeze(a)
5472
5472
  });
5473
5473
  }
5474
- return n.length === 0 ? Pn : Object.freeze(n);
5474
+ return n.length === 0 ? Tn : Object.freeze(n);
5475
5475
  }
5476
- function dc(e) {
5476
+ function fc(e) {
5477
5477
  const [t] = e.categories;
5478
5478
  if (t !== void 0)
5479
5479
  return t;
@@ -5482,24 +5482,27 @@ function dc(e) {
5482
5482
  const [n, s] = e.domain;
5483
5483
  return n + (s - n) / 2;
5484
5484
  }
5485
- function hc(e) {
5485
+ function mc(e) {
5486
5486
  return typeof e == "object" && e !== null && "hex" in e && typeof e.hex == "string" ? e.hex : e;
5487
5487
  }
5488
- function fc(e, t, n) {
5489
- const s = js(t, n);
5488
+ function gc(e, t, n) {
5489
+ const s = zs(t, n);
5490
5490
  return ke(n.elements, s.target).value(s.index, e);
5491
5491
  }
5492
- function mc(e, t) {
5492
+ function pc(e, t) {
5493
5493
  const n = t.stack(), s = n.find((o) => o.layer.id === e);
5494
5494
  if (s === void 0)
5495
- throw Pt(`There is no style layer with the id "${e}".`, e, {
5496
- id: e,
5497
- known: n.map((o) => o.layer.id)
5495
+ throw new _({
5496
+ code: "E_UNKNOWN_LAYER",
5497
+ message: `There is no style layer with the id "${e}".`,
5498
+ source: "style",
5499
+ target: { kind: "layer", id: e },
5500
+ details: { id: e, known: n.map((o) => o.layer.id) }
5498
5501
  });
5499
5502
  return s.layer;
5500
5503
  }
5501
- function gc(e, t, n, s) {
5502
- const o = mc(e, n);
5504
+ function bc(e, t, n, s) {
5505
+ const o = pc(e, n);
5503
5506
  if (o.locked)
5504
5507
  throw new _({
5505
5508
  code: "E_PROTECTED",
@@ -5510,19 +5513,19 @@ function gc(e, t, n, s) {
5510
5513
  });
5511
5514
  const r = n.encoding(e).find((h) => h.channel === t && h.path !== null), i = r?.path;
5512
5515
  if (r === void 0 || i === null || i === void 0)
5513
- throw Pt(
5516
+ throw $n(
5514
5517
  `"${o.name}" does not work ${t} out from the data, so there is no rule to resolve.`,
5515
5518
  e,
5516
5519
  { id: e, channel: t }
5517
5520
  );
5518
- const a = s === void 0 ? dc(r) : fc(i, s, n), c = r.paint(a);
5521
+ const a = s === void 0 ? fc(r) : gc(i, s, n), c = r.paint(a);
5519
5522
  if (c === void 0)
5520
- throw Pt(
5523
+ throw $n(
5521
5524
  `"${o.name}" paints nothing for ${t} at the value it was asked about, so there is no fixed value to take.`,
5522
5525
  e,
5523
5526
  { id: e, channel: t, value: a }
5524
5527
  );
5525
- const l = hc(c), g = {};
5528
+ const l = mc(c), g = {};
5526
5529
  for (const [h, y] of Object.entries(o.encode ?? {}))
5527
5530
  h !== t && y !== void 0 && cs(h) && (g[h] = y);
5528
5531
  return {
@@ -5535,7 +5538,7 @@ function gc(e, t, n, s) {
5535
5538
  }
5536
5539
  };
5537
5540
  }
5538
- const kn = Object.freeze([]), mt = ["everything", "expression", "has", "ids", "top"], pc = "results.";
5541
+ const kn = Object.freeze([]), mt = ["everything", "expression", "has", "ids", "top"], vc = "results.";
5539
5542
  function oe(e, t) {
5540
5543
  return new _({ code: "E_BAD_SELECTOR", message: e, source: "style", details: t });
5541
5544
  }
@@ -5560,7 +5563,7 @@ function Rn(e, t) {
5560
5563
  value: e[n]
5561
5564
  });
5562
5565
  }
5563
- function bc(e) {
5566
+ function yc(e) {
5564
5567
  const t = e;
5565
5568
  if (typeof t == "string") {
5566
5569
  const s = t === "" ? 'The empty string matched every element, so write { match: "everything" } if that is what it meant.' : `Write { match: "expression", where: ${JSON.stringify(t)} }.`;
@@ -5593,7 +5596,7 @@ function bc(e) {
5593
5596
  Rn(e.nodes, "nodes"), Rn(e.edges, "edges");
5594
5597
  return;
5595
5598
  case "top":
5596
- if (typeof e.path != "string" || !e.path.startsWith(pc))
5599
+ if (typeof e.path != "string" || !e.path.startsWith(vc))
5597
5600
  throw oe(
5598
5601
  `A "top" selector ranks a run's field, so its path is "results.<run>.<field>", such as "results.degree.value".`,
5599
5602
  { path: e.path }
@@ -5605,17 +5608,17 @@ function bc(e) {
5605
5608
  throw oe(`"${String(n)}" is not a selector kind.`, { match: n, kinds: mt });
5606
5609
  }
5607
5610
  }
5608
- function vc(e, t, n) {
5609
- bc(e);
5611
+ function wc(e, t, n) {
5612
+ yc(e);
5610
5613
  const s = ke(n, t);
5611
5614
  switch (e.match) {
5612
5615
  case "everything":
5613
5616
  return { match: "everything", target: t, test: null, paths: kn };
5614
5617
  case "has":
5615
- return { match: "has", target: t, test: wo(s, e.path), paths: Object.freeze([e.path]) };
5618
+ return { match: "has", target: t, test: Eo(s, e.path), paths: Object.freeze([e.path]) };
5616
5619
  case "ids": {
5617
5620
  const o = t === "node" ? e.nodes : e.edges, r = new Set(o ?? []);
5618
- return { match: "ids", target: t, test: yo(s, r), paths: kn };
5621
+ return { match: "ids", target: t, test: Oo(s, r), paths: kn };
5619
5622
  }
5620
5623
  case "top": {
5621
5624
  const { topCut: o } = n, { path: r, n: i } = e;
@@ -5629,7 +5632,7 @@ function vc(e, t, n) {
5629
5632
  return {
5630
5633
  match: "top",
5631
5634
  target: t,
5632
- test: vo(s, r, () => o(r, t, i)),
5635
+ test: wo(s, r, () => o(r, t, i)),
5633
5636
  paths: Object.freeze([r])
5634
5637
  };
5635
5638
  }
@@ -5639,24 +5642,24 @@ function vc(e, t, n) {
5639
5642
  }
5640
5643
  }
5641
5644
  }
5642
- const yc = "layer", wc = "results.", Dn = Object.freeze(["other", "shape", "extend"]), Oc = Object.freeze({ by: "user" }), Ec = Object.freeze([]), Nc = Object.freeze([]);
5643
- function Sc(e, t) {
5644
- const n = e.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^[^a-z]+/, "").replace(/[-_]+$/, ""), s = n === "" ? yc : n;
5645
+ const Oc = "layer", Ec = "results.", Dn = Object.freeze(["other", "shape", "extend"]), Nc = Object.freeze({ by: "user" }), Sc = Object.freeze([]), Ac = Object.freeze([]);
5646
+ function Cc(e, t) {
5647
+ const n = e.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^[^a-z]+/, "").replace(/[-_]+$/, ""), s = n === "" ? Oc : n;
5645
5648
  let o = 1, r = `${s}_${String(o)}`;
5646
5649
  for (; t.has(r); )
5647
5650
  o++, r = `${s}_${String(o)}`;
5648
5651
  return r;
5649
5652
  }
5650
5653
  function _e(e) {
5651
- return e.source ?? Oc;
5654
+ return e.source ?? Nc;
5652
5655
  }
5653
5656
  function qe(e) {
5654
5657
  return e.by === "element";
5655
5658
  }
5656
- function Ac(e) {
5659
+ function _c(e) {
5657
5660
  return e.startsWith("node.") ? "node" : e.startsWith("edge.") ? "edge" : null;
5658
5661
  }
5659
- function Cc(e) {
5662
+ function Ic(e) {
5660
5663
  const t = /* @__PURE__ */ new Set();
5661
5664
  for (const n of Object.keys(e.set ?? {}))
5662
5665
  t.add(n);
@@ -5664,7 +5667,7 @@ function Cc(e) {
5664
5667
  t.add(n);
5665
5668
  return [...t];
5666
5669
  }
5667
- function _c(e) {
5670
+ function Tc(e) {
5668
5671
  if (typeof e == "string")
5669
5672
  return e;
5670
5673
  if (typeof e != "object" || e === null)
@@ -5675,11 +5678,11 @@ function _c(e) {
5675
5678
  function Q(e, t) {
5676
5679
  e.problems.push(t);
5677
5680
  }
5678
- function zs(e, t) {
5681
+ function Ls(e, t) {
5679
5682
  t !== "" && !e.paths.includes(t) && e.paths.push(t);
5680
5683
  }
5681
- function Ic(e, t) {
5682
- if (!zt(e))
5684
+ function Pc(e, t) {
5685
+ if (!jt(e))
5683
5686
  return {
5684
5687
  code: "E_BAD_LAYER",
5685
5688
  message: e instanceof Error ? e.message : String(e),
@@ -5693,22 +5696,22 @@ function Ic(e, t) {
5693
5696
  ...typeof n == "number" ? { position: n } : {}
5694
5697
  };
5695
5698
  }
5696
- function Ls(e, t, n) {
5699
+ function Fs(e, t, n) {
5697
5700
  switch (e.accepts) {
5698
5701
  case "color":
5699
- return me(_c(t)) === null ? {
5702
+ return me(Tc(t)) === null ? {
5700
5703
  code: "E_BAD_LAYER",
5701
5704
  message: `${e.plainName} takes a colour, such as "#ff9900" or "orange".`,
5702
5705
  path: n
5703
5706
  } : null;
5704
5707
  case "number":
5705
- return Tc(e, t, n);
5708
+ return $c(e, t, n);
5706
5709
  case "text":
5707
5710
  return typeof t == "string" ? null : { code: "E_BAD_LAYER", message: `${e.plainName} takes text.`, path: n };
5708
5711
  case "boolean":
5709
5712
  return typeof t == "boolean" ? null : { code: "E_BAD_LAYER", message: `${e.plainName} is on or off.`, path: n };
5710
5713
  case "enum":
5711
- return Pc(e, t, n);
5714
+ return kc(e, t, n);
5712
5715
  case "labelStyle":
5713
5716
  return typeof t == "object" && t !== null && !Array.isArray(t) ? null : {
5714
5717
  code: "E_BAD_LAYER",
@@ -5723,7 +5726,7 @@ function Ls(e, t, n) {
5723
5726
  };
5724
5727
  }
5725
5728
  }
5726
- function Tc(e, t, n) {
5729
+ function $c(e, t, n) {
5727
5730
  if (typeof t != "number" || !Number.isFinite(t))
5728
5731
  return { code: "E_BAD_LAYER", message: `${e.plainName} takes a number.`, path: n };
5729
5732
  const { min: s, max: o } = e, r = s !== void 0 && t < s, i = o !== void 0 && t > o;
@@ -5736,7 +5739,7 @@ function Tc(e, t, n) {
5736
5739
  path: n
5737
5740
  };
5738
5741
  }
5739
- function Pc(e, t, n) {
5742
+ function kc(e, t, n) {
5740
5743
  const s = e.values ?? [];
5741
5744
  return typeof t == "string" && s.includes(t) ? null : {
5742
5745
  code: "E_OPTION_RANGE",
@@ -5768,9 +5771,9 @@ function xn(e, t, n, s) {
5768
5771
  path: n
5769
5772
  }), null);
5770
5773
  }
5771
- function $c(e, t, n, s, o, r) {
5774
+ function Mc(e, t, n, s, o, r) {
5772
5775
  if (!("by" in t)) {
5773
- const i = Ls(e, t.value, `${n}.value`);
5776
+ const i = Fs(e, t.value, `${n}.value`);
5774
5777
  i !== null && Q(r, i);
5775
5778
  return;
5776
5779
  }
@@ -5782,7 +5785,7 @@ function $c(e, t, n, s, o, r) {
5782
5785
  });
5783
5786
  return;
5784
5787
  }
5785
- zs(r, t.by), t.scale !== void 0 && s.scales.get(t.scale) === void 0 && Q(r, {
5788
+ Ls(r, t.by), t.scale !== void 0 && s.scales.get(t.scale) === void 0 && Q(r, {
5786
5789
  code: "E_UNKNOWN_SCALE",
5787
5790
  message: `There is no scale called "${t.scale}".`,
5788
5791
  path: `${n}.scale`,
@@ -5791,7 +5794,7 @@ function $c(e, t, n, s, o, r) {
5791
5794
  code: "E_UNKNOWN_PALETTE",
5792
5795
  message: `There is no palette called "${t.palette}".`,
5793
5796
  path: `${n}.palette`,
5794
- candidates: Ut()
5797
+ candidates: Ft()
5795
5798
  }), t.overflow !== void 0 && !Dn.includes(t.overflow) ? Q(r, {
5796
5799
  code: "E_BAD_LAYER",
5797
5800
  message: `"${t.overflow}" is not an overflow policy.`,
@@ -5802,13 +5805,13 @@ function $c(e, t, n, s, o, r) {
5802
5805
  message: `overflow "shape" draws the groups past the palette in other node shapes, and an edge has no shape, so ${e.channel} cannot use it. Use "other" or "extend".`,
5803
5806
  path: `${n}.overflow`,
5804
5807
  candidates: ["other", "extend"]
5805
- }), o && t.by.startsWith(wc) && Q(r, {
5808
+ }), o && t.by.startsWith(Ec) && Q(r, {
5806
5809
  code: "E_UNSCOPED_RUN_ENCODING",
5807
5810
  message: `This layer paints every ${e.target} and encodes ${e.channel} from "${t.by}", which would paint elements the run never measured. Scope it to the elements that carry the result with { match: "has", path: "${t.by}" }.`,
5808
5811
  path: "selector"
5809
5812
  });
5810
5813
  }
5811
- function kc(e, t, n) {
5814
+ function Rc(e, t, n) {
5812
5815
  if (e.target === "node" || e.target === "edge")
5813
5816
  return e.target;
5814
5817
  if (e.target !== void 0)
@@ -5817,14 +5820,14 @@ function kc(e, t, n) {
5817
5820
  message: 'A layer paints "node" or "edge".',
5818
5821
  path: "target"
5819
5822
  }), null;
5820
- const s = new Set(t.map(Ac).filter((o) => o !== null));
5823
+ const s = new Set(t.map(_c).filter((o) => o !== null));
5821
5824
  return s.size === 1 ? [...s][0] ?? null : (s.size > 1 && Q(n, {
5822
5825
  code: "E_BAD_LAYER",
5823
5826
  message: "A layer paints nodes or edges, not both. Name the target and split the layer in two.",
5824
5827
  path: "target"
5825
5828
  }), null);
5826
5829
  }
5827
- function Mc(e, t, n) {
5830
+ function Dc(e, t, n) {
5828
5831
  (typeof e.name != "string" || e.name.trim() === "") && Q(n, {
5829
5832
  code: "E_BAD_LAYER",
5830
5833
  message: "A layer needs a name, which is what a layer list shows and what an id is built from.",
@@ -5846,35 +5849,35 @@ function Mc(e, t, n) {
5846
5849
  path: `encode.${s}`
5847
5850
  });
5848
5851
  }
5849
- function Rc(e, t, n, s) {
5852
+ function xc(e, t, n, s) {
5850
5853
  try {
5851
- const o = vc(e.selector, t ?? "node", n.elements);
5854
+ const o = wc(e.selector, t ?? "node", n.elements);
5852
5855
  for (const r of o.paths)
5853
- zs(s, r);
5856
+ Ls(s, r);
5854
5857
  return o;
5855
5858
  } catch (o) {
5856
- return Q(s, Ic(o, "selector")), null;
5859
+ return Q(s, Pc(o, "selector")), null;
5857
5860
  }
5858
5861
  }
5859
- function Dc(e, t, n, s, o) {
5862
+ function jc(e, t, n, s, o) {
5860
5863
  for (const [r, i] of Object.entries(e.set ?? {})) {
5861
5864
  const a = `set.${r}`, c = xn(r, t, a, o);
5862
5865
  if (c !== null && i !== void 0) {
5863
- const l = Ls(c, i, a);
5866
+ const l = Fs(c, i, a);
5864
5867
  l !== null && Q(o, l);
5865
5868
  }
5866
5869
  }
5867
5870
  for (const [r, i] of Object.entries(e.encode ?? {})) {
5868
5871
  const a = `encode.${r}`, c = xn(r, t, a, o);
5869
- c !== null && i !== void 0 && $c(c, i, a, s, n, o);
5872
+ c !== null && i !== void 0 && Mc(c, i, a, s, n, o);
5870
5873
  }
5871
5874
  }
5872
- function xc(e, t) {
5873
- const n = { problems: [], paths: [] }, s = Cc(e), o = kc(e, s, n);
5874
- Mc(e, s, n);
5875
- const r = typeof e.selector == "object" && e.selector !== null && e.selector.match === "everything", i = Rc(e, o, t, n);
5876
- Dc(e, o, r, t, n);
5877
- const a = t.paths, c = a === void 0 || o === null ? Ec : Object.freeze(n.paths.filter((l) => !a.answers(l, o)));
5875
+ function zc(e, t) {
5876
+ const n = { problems: [], paths: [] }, s = Ic(e), o = Rc(e, s, n);
5877
+ Dc(e, s, n);
5878
+ const r = typeof e.selector == "object" && e.selector !== null && e.selector.match === "everything", i = xc(e, o, t, n);
5879
+ jc(e, o, r, t, n);
5880
+ const a = t.paths, c = a === void 0 || o === null ? Sc : Object.freeze(n.paths.filter((l) => !a.answers(l, o)));
5878
5881
  return n.problems.length > 0 || i === null || o === null ? {
5879
5882
  result: Object.freeze({
5880
5883
  ok: !1,
@@ -5883,11 +5886,11 @@ function xc(e, t) {
5883
5886
  }),
5884
5887
  layer: null
5885
5888
  } : {
5886
- result: Object.freeze({ ok: !0, errors: Nc, unresolvedPaths: c }),
5887
- layer: jc(e, t.id, o, i)
5889
+ result: Object.freeze({ ok: !0, errors: Ac, unresolvedPaths: c }),
5890
+ layer: Lc(e, t.id, o, i)
5888
5891
  };
5889
5892
  }
5890
- function jc(e, t, n, s) {
5893
+ function Lc(e, t, n, s) {
5891
5894
  const o = _e(e), r = Object.freeze({
5892
5895
  id: t,
5893
5896
  name: e.name,
@@ -5918,34 +5921,34 @@ function jn(e) {
5918
5921
  ...e.userData === void 0 ? {} : { userData: e.userData }
5919
5922
  };
5920
5923
  }
5921
- const zn = 12, zc = 7, Lc = 256, Fc = 8, Uc = Object.freeze([]);
5924
+ const zn = 12, Fc = 7, Uc = 256, Vc = 8, Bc = Object.freeze([]);
5922
5925
  function Oe(e) {
5923
5926
  if (!Number.isFinite(e) || Number.isInteger(e) && Math.abs(e) < 1e7)
5924
5927
  return String(e);
5925
5928
  const t = Math.abs(e);
5926
5929
  return t >= 1e7 || t > 0 && t < 1e-3 ? e.toExponential(2) : String(Number(e.toPrecision(4)));
5927
5930
  }
5928
- function Vc(e) {
5931
+ function qc(e) {
5929
5932
  const t = e.split("."), o = (t[t.length - 1] ?? e).replace(/([a-z\d])([A-Z])/g, "$1 $2").split(/[\s_-]+/u).filter((r) => r !== "").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join(" ");
5930
5933
  return { plainName: o === "" ? e : o, technicalName: e };
5931
5934
  }
5932
- function Bc(e, t, n) {
5933
- return n.field?.(e, t) ?? Vc(e);
5935
+ function Gc(e, t, n) {
5936
+ return n.field?.(e, t) ?? qc(e);
5934
5937
  }
5935
- function Fs(e) {
5938
+ function Us(e) {
5936
5939
  return typeof e == "object" && e !== null && "hex" in e && typeof e.hex == "string";
5937
5940
  }
5938
5941
  function $e(e) {
5939
- return e === void 0 ? {} : Fs(e) ? { color: e.hex } : typeof e == "number" ? { size: e } : { paints: e };
5942
+ return e === void 0 ? {} : Us(e) ? { color: e.hex } : typeof e == "number" ? { size: e } : { paints: e };
5940
5943
  }
5941
- function qc(e) {
5942
- return e === void 0 ? null : Fs(e) ? e.hex : typeof e == "object" ? JSON.stringify(e) : String(e);
5944
+ function Wc(e) {
5945
+ return e === void 0 ? null : Us(e) ? e.hex : typeof e == "object" ? JSON.stringify(e) : String(e);
5943
5946
  }
5944
- function Gc(e, t) {
5945
- const [n, s] = t, o = s - n, r = Math.max(Lc, e.groups * Fc), i = [];
5947
+ function Yc(e, t) {
5948
+ const [n, s] = t, o = s - n, r = Math.max(Uc, e.groups * Vc), i = [];
5946
5949
  let a = null;
5947
5950
  for (let c = 0; c < r; c++) {
5948
- const l = o === 0 ? n : n + o * c / (r - 1), g = e.paint(l), h = qc(g);
5951
+ const l = o === 0 ? n : n + o * c / (r - 1), g = e.paint(l), h = Wc(g);
5949
5952
  if (h === null || g === void 0) {
5950
5953
  a = null;
5951
5954
  continue;
@@ -5959,48 +5962,52 @@ function Gc(e, t) {
5959
5962
  }
5960
5963
  return i;
5961
5964
  }
5962
- function Wc(e) {
5963
- const t = e.categories.map((o) => ({
5964
- label: o,
5965
- value: o,
5966
- ...$e(e.paint(o))
5967
- })), { lumped: n } = e, s = n.length > 0 ? e.paint(n[0]) : void 0;
5968
- return s !== void 0 && t.push({
5969
- label: `other: ${String(n.length)} ${n.length === 1 ? "group" : "groups"}`,
5970
- value: n,
5971
- ...$e(s)
5972
- }), t;
5965
+ function Hc(e) {
5966
+ const t = e?.split(".") ?? [];
5967
+ return t.length === 3 && t[0] === ds && t[2] === "group";
5968
+ }
5969
+ function Kc(e) {
5970
+ const t = Hc(e.path), n = e.categories.map((r, i) => ({
5971
+ label: t ? No(i + 1) : r,
5972
+ value: r,
5973
+ ...$e(e.paint(r))
5974
+ })), { lumped: s } = e, o = s.length > 0 ? e.paint(s[0]) : void 0;
5975
+ return o !== void 0 && n.push({
5976
+ label: `other: ${String(s.length)} ${s.length === 1 ? "group" : "groups"}`,
5977
+ value: s,
5978
+ ...$e(o)
5979
+ }), n;
5973
5980
  }
5974
- function Yc(e, t) {
5975
- return Gc(e, t).map((n) => ({
5981
+ function Qc(e, t) {
5982
+ return Yc(e, t).map((n) => ({
5976
5983
  label: n.from === n.to ? Oe(n.from) : `${Oe(n.from)} - ${Oe(n.to)}`,
5977
5984
  value: n.from,
5978
5985
  ...$e(n.painted)
5979
5986
  }));
5980
5987
  }
5981
- function Hc(e, t) {
5982
- const [n, s] = t, o = s - n, r = o === 0 ? 1 : zc, i = [];
5988
+ function Xc(e, t) {
5989
+ const [n, s] = t, o = s - n, r = o === 0 ? 1 : Fc, i = [];
5983
5990
  for (let a = 0; a < r; a++) {
5984
5991
  const c = r === 1 ? n : n + o * a / (r - 1);
5985
5992
  i.push({ label: Oe(c), value: c, ...$e(e.paint(c)) });
5986
5993
  }
5987
5994
  return i;
5988
5995
  }
5989
- function Kc(e, t) {
5996
+ function Jc(e, t) {
5990
5997
  const n = e.paint(void 0);
5991
5998
  return n === void 0 ? [] : [{ label: t.name, value: t.set?.[e.channel], ...$e(n) }];
5992
5999
  }
5993
- function Qc(e, t) {
5994
- return e.path === null ? Kc(e, t) : e.categories.length > 0 ? Wc(e) : e.domain === null ? [] : e.groups > 0 ? Yc(e, e.domain) : Hc(e, e.domain);
6000
+ function Zc(e, t) {
6001
+ return e.path === null ? Jc(e, t) : e.categories.length > 0 ? Kc(e) : e.domain === null ? [] : e.groups > 0 ? Qc(e, e.domain) : Xc(e, e.domain);
5995
6002
  }
5996
- function Xc(e, t) {
6003
+ function el(e, t) {
5997
6004
  return e.path === null ? t.kind === "highlight" ? "highlight" : "literal" : e.palette !== null ? e.palette.kind : e.categories.length > 0 ? "categorical" : "sequential";
5998
6005
  }
5999
- function Jc(e, t) {
6006
+ function tl(e, t) {
6000
6007
  const n = e.encode?.[t];
6001
6008
  return n !== void 0 && "by" in n ? n : void 0;
6002
6009
  }
6003
- function Zc(e, t) {
6010
+ function nl(e, t) {
6004
6011
  if (e.domain === null)
6005
6012
  return;
6006
6013
  const [n, s] = e.domain, o = t?.midpoint, r = t?.clamp;
@@ -6011,7 +6018,7 @@ function Zc(e, t) {
6011
6018
  ...r === void 0 ? {} : { clamped: { from: `p${Oe(r[0])}`, to: `p${Oe(r[1])}` } }
6012
6019
  };
6013
6020
  }
6014
- function el(e, t, n, s) {
6021
+ function sl(e, t, n, s) {
6015
6022
  const o = e[t];
6016
6023
  for (let r = t + 1; r < e.length; r++) {
6017
6024
  const i = e[r], a = i.set?.[n] !== void 0 || i.encode?.[n] !== void 0;
@@ -6020,50 +6027,50 @@ function el(e, t, n, s) {
6020
6027
  }
6021
6028
  return null;
6022
6029
  }
6023
- function tl(e, t, n, s) {
6024
- const o = el(t, n, e.channel, s);
6030
+ function ol(e, t, n, s) {
6031
+ const o = sl(t, n, e.channel, s);
6025
6032
  return o === null ? e.departures : [...e.departures, `painted over by "${o}"`];
6026
6033
  }
6027
- function nl(e, t, n, s, o) {
6028
- const { channel: r } = t, i = Jc(e, r), a = Qc(t, e), c = Math.max(0, a.length - zn), { path: l, scale: g } = t, h = Zc(t, i);
6034
+ function rl(e, t, n, s, o) {
6035
+ const { channel: r } = t, i = tl(e, r), a = Zc(t, e), c = Math.max(0, a.length - zn), { path: l, scale: g } = t, h = nl(t, i);
6029
6036
  return {
6030
6037
  channel: r,
6031
6038
  layerId: e.id,
6032
6039
  ...e.source.by === "run" ? { runId: e.source.runId } : {},
6033
- kind: Xc(t, e),
6034
- ...l === null ? {} : { field: { ...Bc(l, e.target, o), path: l } },
6040
+ kind: el(t, e),
6041
+ ...l === null ? {} : { field: { ...Gc(l, e.target, o), path: l } },
6035
6042
  ...g === null ? {} : { scale: { kind: g, label: o.scales.describe(g)?.plainName ?? g } },
6036
6043
  ...h === void 0 ? {} : { domain: h },
6037
6044
  ...t.palette === null ? {} : { palette: { name: t.palette.id, reversed: i?.reverse === !0 } },
6038
6045
  swatches: Object.freeze(a.slice(0, zn)),
6039
6046
  ...c === 0 ? {} : { overflow: { hidden: c } },
6040
- departures: Object.freeze([...tl(t, n, s, o)])
6047
+ departures: Object.freeze([...ol(t, n, s, o)])
6041
6048
  };
6042
6049
  }
6043
- function sl(e) {
6050
+ function il(e) {
6044
6051
  const t = e.layers(), n = [];
6045
6052
  for (let s = 0; s < t.length; s++) {
6046
6053
  const o = t[s];
6047
6054
  if (!(!o.enabled || o.kind === "base"))
6048
6055
  for (const r of e.encoding(o.id))
6049
- n.push(nl(o, r, t, s, e));
6056
+ n.push(rl(o, r, t, s, e));
6050
6057
  }
6051
- return n.length === 0 ? Uc : Object.freeze(n);
6058
+ return n.length === 0 ? Bc : Object.freeze(n);
6052
6059
  }
6053
- const $t = "graph", ol = Object.freeze([]), rl = Object.freeze([]), gt = Object.freeze([]), il = Object.freeze([]), Ln = () => {
6060
+ const Pt = "graph", al = Object.freeze([]), cl = Object.freeze([]), gt = Object.freeze([]), ll = Object.freeze([]), Ln = () => {
6054
6061
  }, pt = {
6055
6062
  color: "#D55E00",
6056
- edgeWidth: eo.DEFAULT_LINE_WIDTH * 3
6057
- }, kt = 1, al = Object.freeze(["node", "edge"]), cl = Object.freeze({
6063
+ edgeWidth: to.DEFAULT_LINE_WIDTH * 3
6064
+ }, $t = 1, ul = Object.freeze(["node", "edge"]), dl = Object.freeze({
6058
6065
  direction: "as-loaded",
6059
6066
  exact: !0,
6060
6067
  method: "layer-stack",
6061
- notes: rl,
6068
+ notes: cl,
6062
6069
  precision: "f64",
6063
6070
  seed: null,
6064
6071
  weight: null
6065
6072
  });
6066
- function ll() {
6073
+ function hl() {
6067
6074
  return Object.freeze({
6068
6075
  digest: "",
6069
6076
  edgeCount: 0,
@@ -6071,12 +6078,12 @@ function ll() {
6071
6078
  nodeCount: 0,
6072
6079
  nodes: /* @__PURE__ */ new Set(),
6073
6080
  resolvedAt: (/* @__PURE__ */ new Date()).toISOString(),
6074
- spec: $t
6081
+ spec: Pt
6075
6082
  });
6076
6083
  }
6077
- function ul(e, t) {
6084
+ function fl(e, t) {
6078
6085
  return new _({
6079
- code: "E_BAD_COMMAND",
6086
+ code: "E_UNKNOWN_LAYER",
6080
6087
  message: `There is no style layer with the id "${e}".`,
6081
6088
  source: "style",
6082
6089
  target: { kind: "layer", id: e },
@@ -6101,19 +6108,19 @@ function ye(e, t) {
6101
6108
  details: { errors: t.errors, unresolvedPaths: t.unresolvedPaths }
6102
6109
  });
6103
6110
  }
6104
- function dl(e, t) {
6111
+ function ml(e, t) {
6105
6112
  return e.source !== void 0 || t === void 0 ? e : { ...e, source: { by: "template", templateId: t } };
6106
6113
  }
6107
- function hl(e) {
6114
+ function gl(e) {
6108
6115
  const { version: t } = e;
6109
- if (t !== kt)
6110
- throw Mt(
6111
- `This element reads style documents of version ${String(kt)}, and this one says version ${String(t)}.`,
6116
+ if (t !== $t)
6117
+ throw kt(
6118
+ `This element reads style documents of version ${String($t)}, and this one says version ${String(t)}.`,
6112
6119
  { version: t }
6113
6120
  );
6114
6121
  const n = (e.palettes ?? []).filter((s) => be(s.id) === void 0).map((s) => s.id);
6115
6122
  if (n.length > 0) {
6116
- const s = Ut();
6123
+ const s = Ft();
6117
6124
  throw new _({
6118
6125
  code: "E_UNKNOWN_PALETTE",
6119
6126
  message: `Nothing has registered the palette ${n.map((o) => `"${o}"`).join(", ")}. Register it with \`registerPalette\` before applying this document; applying it now would paint colours nobody chose.`,
@@ -6122,24 +6129,24 @@ function hl(e) {
6122
6129
  });
6123
6130
  }
6124
6131
  }
6125
- function fl(e) {
6132
+ function pl(e) {
6126
6133
  const t = /* @__PURE__ */ new Set();
6127
6134
  for (const s of e)
6128
6135
  for (const o of Object.values(s.encode ?? {}))
6129
6136
  o !== void 0 && "by" in o && o.palette !== void 0 && t.add(String(o.palette));
6130
6137
  const n = [];
6131
6138
  for (const s of t) {
6132
- if (hs.some((r) => r.id === s))
6139
+ if (fs.some((r) => r.id === s))
6133
6140
  continue;
6134
6141
  const o = be(s);
6135
6142
  o !== void 0 && n.push(o);
6136
6143
  }
6137
6144
  return n;
6138
6145
  }
6139
- function Mt(e, t) {
6146
+ function kt(e, t) {
6140
6147
  return new _({ code: "E_BAD_COMMAND", message: e, source: "style", details: t });
6141
6148
  }
6142
- function ml(e) {
6149
+ function bl(e) {
6143
6150
  return new _({
6144
6151
  code: "E_UNSUPPORTED",
6145
6152
  message: `This session cannot look a run up, so styles.${e}() has nothing to bind to. Add a layer of your own with styles.add() instead.`,
@@ -6147,14 +6154,14 @@ function ml(e) {
6147
6154
  details: { op: `styles.${e}`, reason: "no runs are reachable from this session" }
6148
6155
  });
6149
6156
  }
6150
- function gl(e) {
6157
+ function vl(e) {
6151
6158
  return typeof e == "string" ? e : "runId" in e ? e.runId : e.id;
6152
6159
  }
6153
- function pl(e, t) {
6160
+ function yl(e, t) {
6154
6161
  const n = t.run(e);
6155
6162
  if (n !== void 0)
6156
6163
  return n;
6157
- const s = gl(e), o = t.runIds();
6164
+ const s = vl(e), o = t.runIds();
6158
6165
  throw new _({
6159
6166
  code: "E_UNKNOWN_RUN",
6160
6167
  message: `There is no run called "${s}" in this session.`,
@@ -6162,16 +6169,16 @@ function pl(e, t) {
6162
6169
  details: { run: s, available: o, candidates: tt(s, o) }
6163
6170
  });
6164
6171
  }
6165
- function bl(e, t, n) {
6172
+ function wl(e, t, n) {
6166
6173
  if (e.kind !== "encoding")
6167
6174
  return !1;
6168
6175
  const s = e.encode?.[n];
6169
6176
  if (s === void 0 || !("by" in s))
6170
6177
  return !1;
6171
- const o = Ft(t);
6178
+ const o = Lt(t);
6172
6179
  return s.by === o || s.by.startsWith(`${o}.`);
6173
6180
  }
6174
- function vl(e, t) {
6181
+ function Ol(e, t) {
6175
6182
  if (e === void 0)
6176
6183
  return t === "node" ? { "node.color": pt.color } : { "edge.color": pt.color, "edge.width": pt.edgeWidth };
6177
6184
  const n = {};
@@ -6179,14 +6186,14 @@ function vl(e, t) {
6179
6186
  cs(s) && s.startsWith(`${t}.`) && o !== void 0 && (n[s] = o);
6180
6187
  return Object.keys(n).length === 0 ? null : n;
6181
6188
  }
6182
- function yl(e) {
6183
- const t = e.queue ?? Gt(), n = e.engine ?? He, s = e.scales ?? Ht();
6189
+ function El(e) {
6190
+ const t = e.queue ?? qt(), n = e.engine ?? He, s = e.scales ?? Yt();
6184
6191
  let o = Object.freeze([]), r = /* @__PURE__ */ new Map(), i = null, a = 0;
6185
6192
  const c = (f) => {
6186
6193
  o = Object.freeze([...f]), r = new Map(o.map((I) => [I.layer.id, I])), i = null;
6187
6194
  }, l = () => (i ??= Object.freeze(o.map((f) => f.layer)), i), g = (f) => {
6188
6195
  const I = r.get(f);
6189
- return I === void 0 || e.encoding === void 0 ? il : e.encoding(I);
6196
+ return I === void 0 || e.encoding === void 0 ? ll : e.encoding(I);
6190
6197
  }, h = {
6191
6198
  stack: () => o,
6192
6199
  encoding: g,
@@ -6220,17 +6227,17 @@ function yl(e) {
6220
6227
  scales: s,
6221
6228
  ...e.paths === void 0 ? {} : { paths: e.paths }
6222
6229
  };
6223
- return xc(f, C);
6230
+ return zc(f, C);
6224
6231
  }, F = () => {
6225
6232
  const f = new Set(r.keys());
6226
6233
  return (I) => {
6227
- const C = Sc(typeof I == "string" ? I : "", f);
6234
+ const C = Cc(typeof I == "string" ? I : "", f);
6228
6235
  return f.add(C), C;
6229
6236
  };
6230
6237
  }, U = (f) => F()(f), w = (f) => {
6231
6238
  const I = r.get(f);
6232
6239
  if (I === void 0)
6233
- throw ul(
6240
+ throw fl(
6234
6241
  f,
6235
6242
  o.map((C) => C.layer.id)
6236
6243
  );
@@ -6254,7 +6261,7 @@ function yl(e) {
6254
6261
  // Never stale: the stack is the session's own state, so an edit's answer cannot go on
6255
6262
  // describing a stack that has changed underneath it.
6256
6263
  stale: () => null,
6257
- resolveScope: () => e.resolveScope?.($t) ?? ll(),
6264
+ resolveScope: () => e.resolveScope?.(Pt) ?? hl(),
6258
6265
  enqueue: (I) => {
6259
6266
  const C = t.queueOperation("style-edit", I, { description: f });
6260
6267
  return {
@@ -6267,11 +6274,11 @@ function yl(e) {
6267
6274
  a++;
6268
6275
  const k = Object.freeze({ edit: a, verb: f }), V = [b.signal, e.disposed].filter((M) => M !== void 0), u = V.length > 1 ? AbortSignal.any(V) : V[0], m = {
6269
6276
  algorithm: `styles.${f}`,
6270
- caveats: cl,
6277
+ caveats: dl,
6271
6278
  engine: n,
6272
6279
  exact: null,
6273
- fields: ol,
6274
- id: Ge({ algorithm: `styles.${f}`, exact: null, params: k, sample: null, scope: $t, seed: null }),
6280
+ fields: al,
6281
+ id: Ge({ algorithm: `styles.${f}`, exact: null, params: k, sample: null, scope: Pt, seed: null }),
6275
6282
  params: k,
6276
6283
  sample: null,
6277
6284
  seed: null,
@@ -6314,7 +6321,7 @@ function yl(e) {
6314
6321
  }, $ = (f) => {
6315
6322
  const { runs: I } = e;
6316
6323
  if (I === void 0)
6317
- throw ml(f);
6324
+ throw bl(f);
6318
6325
  return I;
6319
6326
  }, A = (f, I, C) => {
6320
6327
  const v = P(f, C);
@@ -6447,7 +6454,7 @@ function yl(e) {
6447
6454
  },
6448
6455
  encode(f, I = {}) {
6449
6456
  return O("encode", "add", `Encode ${f.channel}`, () => {
6450
- const C = rc(f, $("encode")), v = _e(C), b = v.by === "run" ? o.find((E) => bl(E.layer, v.runId, f.channel)) : void 0;
6457
+ const C = ac(f, $("encode")), v = _e(C), b = v.by === "run" ? o.find((E) => wl(E.layer, v.runId, f.channel)) : void 0;
6451
6458
  if (b === void 0)
6452
6459
  return A(C, o.length, U(C.name));
6453
6460
  const { id: k } = b.layer, V = P(C, k);
@@ -6467,9 +6474,9 @@ function yl(e) {
6467
6474
  },
6468
6475
  highlight(f, I = {}) {
6469
6476
  return O("highlight", "add", "Highlight a result", () => {
6470
- const C = pl(f.run, $("highlight"));
6471
- if (!Oo(C.shape))
6472
- throw Mt(
6477
+ const C = yl(f.run, $("highlight"));
6478
+ if (!So(C.shape))
6479
+ throw kt(
6473
6480
  `A "${C.shape}" result measures every element rather than choosing some, so it is painted with encode() rather than highlighted.`,
6474
6481
  { run: C.id, shape: C.shape }
6475
6482
  );
@@ -6489,16 +6496,16 @@ function yl(e) {
6489
6496
  });
6490
6497
  }
6491
6498
  const k = /* @__PURE__ */ new Map();
6492
- for (const D of al) {
6493
- const q = b.some((K) => K.kind === D) ? vl(f.set, D) : null;
6499
+ for (const D of ul) {
6500
+ const q = b.some((K) => K.kind === D) ? Ol(f.set, D) : null;
6494
6501
  q !== null && k.set(D, q);
6495
6502
  }
6496
6503
  if (k.size === 0)
6497
- throw Mt(
6504
+ throw kt(
6498
6505
  `The style names no channel that paints the ${b.map((D) => D.kind).join(" or ")} the run "${C.id}" chose, so the highlight would paint nothing.`,
6499
6506
  { run: C.id, field: v, set: f.set }
6500
6507
  );
6501
- const V = Ft(C.id, v), u = f.name ?? C.label, m = F(), E = [], M = /* @__PURE__ */ new Set();
6508
+ const V = Lt(C.id, v), u = f.name ?? C.label, m = F(), E = [], M = /* @__PURE__ */ new Set();
6502
6509
  for (const [D, q] of k) {
6503
6510
  const K = {
6504
6511
  name: k.size > 1 ? `${u} (${D}s)` : u,
@@ -6508,7 +6515,7 @@ function yl(e) {
6508
6515
  // and did not choose, so a presence test would paint the whole
6509
6516
  // neighbourhood of a route in the colour of the route. The value is what
6510
6517
  // says "chosen", so the value is what is asked about.
6511
- selector: { match: "expression", where: `${Eo(V)} == \`true\`` },
6518
+ selector: { match: "expression", where: `${Ao(V)} == \`true\`` },
6512
6519
  set: q,
6513
6520
  source: { by: "run", runId: C.id, algorithm: C.algorithm, params: C.params }
6514
6521
  }, H = P(K, m(K.name));
@@ -6534,16 +6541,16 @@ function yl(e) {
6534
6541
  },
6535
6542
  resolveToStatic(f, I, C, v = {}) {
6536
6543
  return O("resolve", "update", `Fix ${I} on layer ${f}`, () => {
6537
- const b = gc(f, I, h, C);
6544
+ const b = bc(f, I, h, C);
6538
6545
  return S(f, b.patch);
6539
6546
  }, v);
6540
6547
  },
6541
6548
  applyTemplate(f, I = {}) {
6542
6549
  return O("template", "add", "Apply a style document", () => {
6543
- hl(f);
6550
+ gl(f);
6544
6551
  const C = F(), v = [], b = /* @__PURE__ */ new Set();
6545
6552
  for (const m of f.layers) {
6546
- const E = dl(m, I.templateId);
6553
+ const E = ml(m, I.templateId);
6547
6554
  if (qe(_e(E)))
6548
6555
  throw new _({
6549
6556
  code: "E_PROTECTED",
@@ -6558,7 +6565,7 @@ function yl(e) {
6558
6565
  b.add(R);
6559
6566
  v.push({ spec: E, compiled: M.layer });
6560
6567
  }
6561
- const k = uc({
6568
+ const k = hc({
6562
6569
  ...h,
6563
6570
  stack: () => v.map((m) => m.compiled)
6564
6571
  }), V = new Set(k.map((m) => m.layerId)), u = v.map((m) => {
@@ -6585,18 +6592,18 @@ function yl(e) {
6585
6592
  }, I);
6586
6593
  },
6587
6594
  legend() {
6588
- return sl(y);
6595
+ return il(y);
6589
6596
  },
6590
6597
  settled() {
6591
6598
  return e.queue?.settled() ?? Promise.resolve();
6592
6599
  },
6593
6600
  explain(f) {
6594
- return lc(f, h);
6601
+ return dc(f, h);
6595
6602
  },
6596
6603
  toDocument() {
6597
- const f = o.filter((C) => !C.layer.locked).map((C) => jn(C.layer)), I = fl(f);
6604
+ const f = o.filter((C) => !C.layer.locked).map((C) => jn(C.layer)), I = pl(f);
6598
6605
  return Object.freeze({
6599
- version: kt,
6606
+ version: $t,
6600
6607
  layers: Object.freeze(f),
6601
6608
  // Written only when there is something to write, so a look that uses nothing but
6602
6609
  // the element's own palettes saves byte for byte what it saved before.
@@ -6605,7 +6612,7 @@ function yl(e) {
6605
6612
  }
6606
6613
  };
6607
6614
  }
6608
- const wl = Object.freeze({
6615
+ const Nl = Object.freeze({
6609
6616
  // Geometry and material: a different value is a different source mesh.
6610
6617
  "node.size": "mesh",
6611
6618
  "node.shape": "mesh",
@@ -6674,22 +6681,22 @@ const wl = Object.freeze({
6674
6681
  });
6675
6682
  function Fn(e) {
6676
6683
  return Object.freeze(
6677
- Ie(e).map((t) => t.channel).filter((t) => wl[t] === "mesh")
6684
+ Ie(e).map((t) => t.channel).filter((t) => Nl[t] === "mesh")
6678
6685
  );
6679
6686
  }
6680
- const Ol = Object.freeze({
6687
+ const Sl = Object.freeze({
6681
6688
  node: Fn("node"),
6682
6689
  edge: Fn("edge")
6683
6690
  });
6684
6691
  function bt(e) {
6685
- return Ol[e];
6692
+ return Sl[e];
6686
6693
  }
6687
- const Un = 2166136261, El = 16777619, Nl = 0, Sl = 1, Al = 2, Vn = 3, Bn = 2 ** 24, qn = 16, Us = new ArrayBuffer(8), Cl = new Float64Array(Us), Gn = new Int32Array(Us);
6688
- function _l(e) {
6694
+ const Un = 2166136261, Al = 16777619, Cl = 0, _l = 1, Il = 2, Vn = 3, Bn = 2 ** 24, qn = 16, Vs = new ArrayBuffer(8), Tl = new Float64Array(Vs), Gn = new Int32Array(Vs);
6695
+ function Pl(e) {
6689
6696
  let t = e ^ e >>> 16;
6690
6697
  return t = Math.imul(t, 2246822507), t ^= t >>> 13, t | 0;
6691
6698
  }
6692
- function Il() {
6699
+ function $l() {
6693
6700
  let e = new Int32Array(qn), t = 0, n = Un;
6694
6701
  const s = /* @__PURE__ */ new Map();
6695
6702
  let o = new Int32Array(qn * 8), r = 0, i = 0;
@@ -6703,7 +6710,7 @@ function Il() {
6703
6710
  const S = new Int32Array(e.length * 2);
6704
6711
  S.set(e), e = S;
6705
6712
  }
6706
- e[t] = A, t++, n = Math.imul(n ^ A, El);
6713
+ e[t] = A, t++, n = Math.imul(n ^ A, Al);
6707
6714
  }, p = () => {
6708
6715
  t = 0, n = Un;
6709
6716
  }, O = (A) => {
@@ -6750,20 +6757,20 @@ function Il() {
6750
6757
  p();
6751
6758
  },
6752
6759
  pushAbsent() {
6753
- d(Nl);
6760
+ d(Cl);
6754
6761
  },
6755
6762
  pushNumber(A) {
6756
- Cl[0] = Number.isNaN(A) ? Number.NaN : A + 0, d(Vn), d(Gn[0]), d(Gn[1]);
6763
+ Tl[0] = Number.isNaN(A) ? Number.NaN : A + 0, d(Vn), d(Gn[0]), d(Gn[1]);
6757
6764
  },
6758
6765
  pushFlag(A) {
6759
- d(A ? Al : Sl);
6766
+ d(A ? Il : _l);
6760
6767
  },
6761
6768
  pushText(A) {
6762
6769
  let S = N.get(A);
6763
6770
  S === void 0 && (S = N.size + Vn + 1, N.set(A, S)), d(S);
6764
6771
  },
6765
6772
  end(A) {
6766
- const S = _l(n), j = s.get(S);
6773
+ const S = Pl(n), j = s.get(S);
6767
6774
  if (j !== void 0) {
6768
6775
  for (const v of j)
6769
6776
  if (O(v))
@@ -6789,16 +6796,16 @@ function Il() {
6789
6796
  }
6790
6797
  };
6791
6798
  }
6792
- const Wn = Object.freeze({}), Le = 4096, Tl = Object.freeze([]), Yn = 8, Ce = 1024, Vs = 0, Pl = 1, Bs = 2, $l = 2147483646;
6793
- function kl(e) {
6799
+ const Wn = Object.freeze({}), Le = 4096, kl = Object.freeze([]), Yn = 8, Ce = 1024, Bs = 0, Ml = 1, qs = 2, Rl = 2147483646;
6800
+ function Dl(e) {
6794
6801
  const t = et(e)?.accepts;
6795
6802
  return t === "number" ? "number" : t === "labelStyle" ? "merge" : t === "boolean" ? "flag" : "ref";
6796
6803
  }
6797
- function Ml(e, t) {
6798
- const n = kl(e);
6804
+ function xl(e, t) {
6805
+ const n = Dl(e);
6799
6806
  return n === "number" ? { channel: e, kind: n, values: new Float64Array(t).fill(Number.NaN) } : n === "flag" ? { channel: e, kind: n, values: new Uint8Array(t) } : { channel: e, kind: n, values: new Array(t) };
6800
6807
  }
6801
- function Rl(e, t) {
6808
+ function jl(e, t) {
6802
6809
  if (e.kind === "number") {
6803
6810
  const n = new Float64Array(t).fill(Number.NaN);
6804
6811
  n.set(e.values), e.values = n;
@@ -6811,24 +6818,24 @@ function Rl(e, t) {
6811
6818
  }
6812
6819
  e.values.length = t;
6813
6820
  }
6814
- function Rt(e, t) {
6821
+ function Mt(e, t) {
6815
6822
  if (e.kind === "number") {
6816
6823
  const n = e.values[t];
6817
6824
  return Number.isNaN(n) ? void 0 : n;
6818
6825
  }
6819
6826
  if (e.kind === "flag") {
6820
6827
  const n = e.values[t];
6821
- return n === Vs ? void 0 : n === Bs;
6828
+ return n === Bs ? void 0 : n === qs;
6822
6829
  }
6823
6830
  return e.values[t];
6824
6831
  }
6825
- function Dl(e, t, n) {
6832
+ function zl(e, t, n) {
6826
6833
  if (e.kind === "number") {
6827
6834
  e.values[t] = typeof n == "number" ? n : Number.NaN;
6828
6835
  return;
6829
6836
  }
6830
6837
  if (e.kind === "flag") {
6831
- e.values[t] = n === !0 ? Bs : Pl;
6838
+ e.values[t] = n === !0 ? qs : Ml;
6832
6839
  return;
6833
6840
  }
6834
6841
  const s = e.values[t];
@@ -6841,23 +6848,23 @@ function Dl(e, t, n) {
6841
6848
  }
6842
6849
  e.values[t] = n;
6843
6850
  }
6844
- function xl(e, t) {
6851
+ function Ll(e, t) {
6845
6852
  if (e.kind === "number") {
6846
6853
  e.values[t] = Number.NaN;
6847
6854
  return;
6848
6855
  }
6849
6856
  if (e.kind === "flag") {
6850
- e.values[t] = Vs;
6857
+ e.values[t] = Bs;
6851
6858
  return;
6852
6859
  }
6853
6860
  e.values[t] = void 0;
6854
6861
  }
6855
- function jl(e, t, n) {
6862
+ function Fl(e, t, n) {
6856
6863
  if (t === null) {
6857
6864
  e.pushAbsent();
6858
6865
  return;
6859
6866
  }
6860
- const s = Rt(t, n);
6867
+ const s = Mt(t, n);
6861
6868
  if (typeof s == "number") {
6862
6869
  e.pushNumber(s);
6863
6870
  return;
@@ -6870,14 +6877,14 @@ function jl(e, t, n) {
6870
6877
  e.pushText(s);
6871
6878
  return;
6872
6879
  }
6873
- const o = uo(s);
6880
+ const o = ho(s);
6874
6881
  if (o === null) {
6875
6882
  e.pushAbsent();
6876
6883
  return;
6877
6884
  }
6878
6885
  e.pushNumber(o.r), e.pushNumber(o.g), e.pushNumber(o.b), e.pushNumber(o.a);
6879
6886
  }
6880
- function zl(e) {
6887
+ function Ul(e) {
6881
6888
  const { edits: t, stack: n, fromIndex: s } = e;
6882
6889
  if (t.length === 0)
6883
6890
  return !1;
@@ -6886,8 +6893,8 @@ function zl(e) {
6886
6893
  return !1;
6887
6894
  return s === n.length - t.length;
6888
6895
  }
6889
- function Ll(e) {
6890
- const t = e.scales ?? Ht();
6896
+ function Vl(e) {
6897
+ const t = e.scales ?? Yt();
6891
6898
  let n = /* @__PURE__ */ new WeakMap();
6892
6899
  const s = /* @__PURE__ */ new WeakMap();
6893
6900
  let o = /* @__PURE__ */ new WeakMap(), r = [], i = Promise.resolve(), a = 0;
@@ -6895,7 +6902,7 @@ function Ll(e) {
6895
6902
  for (const u of c)
6896
6903
  u();
6897
6904
  }, g = (u) => {
6898
- const m = Il(), E = bt(u).length;
6905
+ const m = $l(), E = bt(u).length;
6899
6906
  m.begin();
6900
6907
  for (let M = 0; M < E; M++)
6901
6908
  m.pushAbsent();
@@ -6932,15 +6939,15 @@ function Ll(e) {
6932
6939
  const z = new Uint8Array(E);
6933
6940
  z.set(u.painted);
6934
6941
  for (const x of u.columns.values())
6935
- Rl(x, E);
6942
+ jl(x, E);
6936
6943
  u.capacity = E, u.meshKeys = M, u.stamps = R, u.painted = z, u.dirty = new Uint32Array(E);
6937
6944
  }, P = (u, m) => {
6938
6945
  const E = u.columns.get(m);
6939
6946
  if (E !== void 0)
6940
6947
  return E;
6941
- const M = Ml(m, u.capacity);
6948
+ const M = xl(m, u.capacity);
6942
6949
  return u.columns.set(m, M), M;
6943
- }, F = (u, m) => zt(m) ? { layerId: u, code: m.code, message: m.message } : {
6950
+ }, F = (u, m) => jt(m) ? { layerId: u, code: m.code, message: m.message } : {
6944
6951
  layerId: u,
6945
6952
  code: "E_INTERNAL",
6946
6953
  message: m instanceof Error ? m.message : String(m)
@@ -6970,7 +6977,7 @@ function Ll(e) {
6970
6977
  M.push({
6971
6978
  column: P(E, q),
6972
6979
  path: L,
6973
- binding: Ha({
6980
+ binding: Qa({
6974
6981
  channel: q,
6975
6982
  binding: W,
6976
6983
  scales: t,
@@ -7000,7 +7007,7 @@ function Ll(e) {
7000
7007
  const E = m.paths[0];
7001
7008
  return E === void 0 ? null : e.measured?.(E, m.target) ?? null;
7002
7009
  }, p = (u) => {
7003
- u.dirtyCount = 0, u.generation >= $l && (u.stamps = new Int32Array(u.capacity), u.generation = 0), u.generation++;
7010
+ u.dirtyCount = 0, u.generation >= Rl && (u.stamps = new Int32Array(u.capacity), u.generation = 0), u.generation++;
7004
7011
  }, O = (u, m) => {
7005
7012
  u.stamps[m] !== u.generation && (u.stamps[m] = u.generation, u.dirty[u.dirtyCount] = m, u.dirtyCount++);
7006
7013
  }, T = (u) => {
@@ -7030,7 +7037,7 @@ function Ll(e) {
7030
7037
  }, S = (u) => {
7031
7038
  for (const m of u.columns.values())
7032
7039
  for (let E = 0; E < u.dirtyCount; E++)
7033
- xl(m, u.dirty[E]);
7040
+ Ll(m, u.dirty[E]);
7034
7041
  }, j = async (u, m) => {
7035
7042
  if (performance.now() < m)
7036
7043
  return m;
@@ -7048,8 +7055,8 @@ function Ll(e) {
7048
7055
  if (!(L !== null && (ve >= u.count || u.stamps[ve] !== u.generation)) && !(z !== null && !z(ve))) {
7049
7056
  K[ve] = 1;
7050
7057
  for (let rt = 0; rt < D.length; rt++) {
7051
- const De = D[rt], Qs = De.path === null ? void 0 : q.value(ve, De.path), Jt = De.binding.paint(Qs);
7052
- Jt !== void 0 && Dl(De.column, ve, Jt);
7058
+ const De = D[rt], Xs = De.path === null ? void 0 : q.value(ve, De.path), Xt = De.binding.paint(Xs);
7059
+ Xt !== void 0 && zl(De.column, ve, Xt);
7053
7060
  }
7054
7061
  }
7055
7062
  }
@@ -7063,7 +7070,7 @@ function Ll(e) {
7063
7070
  const W = () => {
7064
7071
  const q = {}, K = q;
7065
7072
  for (let H = 0; H < R.length; H++) {
7066
- const Z = R[H], X = Z === null ? void 0 : Rt(Z, L);
7073
+ const Z = R[H], X = Z === null ? void 0 : Mt(Z, L);
7067
7074
  X !== void 0 && (K[M[H]] = X);
7068
7075
  }
7069
7076
  return q;
@@ -7072,7 +7079,7 @@ function Ll(e) {
7072
7079
  const Z = u.dirty[H];
7073
7080
  z.begin();
7074
7081
  for (let ae = 0; ae < R.length; ae++)
7075
- jl(z, R[ae], Z);
7082
+ Fl(z, R[ae], Z);
7076
7083
  L = Z;
7077
7084
  const X = z.end(W), Se = u.meshKeys[Z];
7078
7085
  X !== Se && (X !== 0 && z.retain(X), Se !== 0 && z.release(Se), u.meshKeys[Z] = X);
@@ -7134,7 +7141,7 @@ function Ll(e) {
7134
7141
  for (const E of u.edits)
7135
7142
  E.previous !== null && (T(E.previous), $(E.previous)), E.next !== null && T(E.next);
7136
7143
  },
7137
- zl(u) ? u.fromIndex : null
7144
+ Ul(u) ? u.fromIndex : null
7138
7145
  )
7139
7146
  ),
7140
7147
  repaintAll(u, m) {
@@ -7165,7 +7172,7 @@ function Ll(e) {
7165
7172
  return Wn;
7166
7173
  const M = {}, R = M;
7167
7174
  for (const [z, x] of E.columns) {
7168
- const L = Rt(x, m);
7175
+ const L = Mt(x, m);
7169
7176
  L !== void 0 && (R[z] = L);
7170
7177
  }
7171
7178
  return M;
@@ -7189,7 +7196,7 @@ function Ll(e) {
7189
7196
  },
7190
7197
  encoding(u) {
7191
7198
  const m = s.get(u);
7192
- return m === void 0 || m.channels.length === 0 ? Tl : m.channels.map((E) => E.binding);
7199
+ return m === void 0 || m.channels.length === 0 ? kl : m.channels.map((E) => E.binding);
7193
7200
  },
7194
7201
  invalidate() {
7195
7202
  n = /* @__PURE__ */ new WeakMap(), h.node.painted.fill(0), h.edge.painted.fill(0);
@@ -7200,14 +7207,14 @@ function Ll(e) {
7200
7207
  };
7201
7208
  }
7202
7209
  const Hn = "data.";
7203
- function qs(e, t, n) {
7210
+ function Gs(e, t, n) {
7204
7211
  if (n === "source")
7205
7212
  return e.ids.idOf(e.edgeSource(t));
7206
7213
  if (n === "target")
7207
7214
  return e.ids.idOf(e.edgeTarget(t));
7208
7215
  }
7209
- const vt = `${No}.`, Kn = Object.freeze({ kind: "none", key: "", runId: "", field: "" });
7210
- function Fl(e) {
7216
+ const vt = `${ds}.`, Kn = Object.freeze({ kind: "none", key: "", runId: "", field: "" });
7217
+ function Bl(e) {
7211
7218
  if (e.startsWith(vt)) {
7212
7219
  const n = e.indexOf(".", vt.length), s = n === -1 ? "" : e.slice(vt.length, n), o = n === -1 ? "" : e.slice(n + 1);
7213
7220
  return s === "" || o === "" || o.includes(".") ? Kn : { kind: "result", key: "", runId: s, field: o };
@@ -7215,8 +7222,8 @@ function Fl(e) {
7215
7222
  const t = e.startsWith(Hn) ? e.slice(Hn.length) : e;
7216
7223
  return t === "" ? Kn : { kind: "attribute", key: t, runId: "", field: "" };
7217
7224
  }
7218
- const Ul = new Uint32Array(0);
7219
- function Vl(e) {
7225
+ const ql = new Uint32Array(0);
7226
+ function Gl(e) {
7220
7227
  const t = Ee(e);
7221
7228
  return {
7222
7229
  graph: e,
@@ -7230,39 +7237,39 @@ function Vl(e) {
7230
7237
  edgeMeasured: /* @__PURE__ */ new Map()
7231
7238
  };
7232
7239
  }
7233
- function Bl(e) {
7240
+ function Wl(e) {
7234
7241
  if (e === null)
7235
7242
  return null;
7236
7243
  const t = e.meta.default;
7237
7244
  return { column: e, defaultPresent: t != null };
7238
7245
  }
7239
- function ql(e, t) {
7246
+ function Yl(e, t) {
7240
7247
  if (!(t < 0 || t >= e.column.length))
7241
7248
  return e.column.value(t);
7242
7249
  }
7243
- function Gl(e, t) {
7250
+ function Hl(e, t) {
7244
7251
  return e.column.isSet(t) ? !0 : e.defaultPresent && t >= 0 && t < e.column.length;
7245
7252
  }
7246
7253
  function Fe(e) {
7247
7254
  return e != null;
7248
7255
  }
7249
- function Wl(e) {
7256
+ function Kl(e) {
7250
7257
  const { snapshot: t, records: n } = e, s = e.results, o = /* @__PURE__ */ new Map();
7251
7258
  let r = null;
7252
7259
  const i = () => {
7253
7260
  const w = t();
7254
- return (r === null || r.graph !== w) && (r = Vl(w)), r;
7261
+ return (r === null || r.graph !== w) && (r = Gl(w)), r;
7255
7262
  }, a = (w) => {
7256
7263
  const N = o.get(w);
7257
7264
  if (N !== void 0)
7258
7265
  return N;
7259
- const d = Fl(w);
7266
+ const d = Bl(w);
7260
7267
  return o.set(w, d), d;
7261
7268
  }, c = (w, N, d) => {
7262
7269
  const p = N === "node" ? w.nodeColumns : w.edgeColumns, O = p.get(d);
7263
7270
  if (O !== void 0)
7264
7271
  return O;
7265
- const T = N === "node" ? w.graph.nodes : w.graph.edges, $ = Bl(T.get(d));
7272
+ const T = N === "node" ? w.graph.nodes : w.graph.edges, $ = Wl(T.get(d));
7266
7273
  return p.set(d, $), $;
7267
7274
  }, l = (w, N) => {
7268
7275
  w.edgeIds ??= new Array(w.edgeCount);
@@ -7275,10 +7282,10 @@ function Wl(e) {
7275
7282
  const O = s?.(p);
7276
7283
  if (O !== void 0)
7277
7284
  return N === "node" ? d >= 0 && d < w.nodeCount ? O.node(w.graph.ids.idOf(d)) : void 0 : d >= 0 && d < w.edgeCount ? O.edge(l(w, d)) : void 0;
7278
- }, h = (w, N, d, p) => N === "edge" ? d < 0 || d >= w.edgeCount ? void 0 : y(w, N, d, p) ?? qs(w.graph, d, p) : y(w, N, d, p), y = (w, N, d, p) => {
7285
+ }, h = (w, N, d, p) => N === "edge" ? d < 0 || d >= w.edgeCount ? void 0 : y(w, N, d, p) ?? Gs(w.graph, d, p) : y(w, N, d, p), y = (w, N, d, p) => {
7279
7286
  const O = c(w, N, p);
7280
7287
  if (O !== null)
7281
- return ql(O, d);
7288
+ return Yl(O, d);
7282
7289
  if (n !== void 0) {
7283
7290
  if (N === "edge")
7284
7291
  return n.edgeAttributes(d)?.[p];
@@ -7301,10 +7308,10 @@ function Wl(e) {
7301
7308
  if (w === "edge" && (p.key === "source" || p.key === "target"))
7302
7309
  return Fe(h(O, w, N, p.key));
7303
7310
  const T = c(O, w, p.key);
7304
- return T !== null ? Gl(T, N) : Fe(h(O, w, N, p.key));
7311
+ return T !== null ? Hl(T, N) : Fe(h(O, w, N, p.key));
7305
7312
  }, U = (w, N, d, p) => {
7306
7313
  if (p === void 0)
7307
- return Ul;
7314
+ return ql;
7308
7315
  const O = N === "node" ? w.nodeCount : w.edgeCount, T = N === "node" ? (S) => p.node(w.graph.ids.idOf(S)) : (S) => p.edge(l(w, S)), $ = new Uint32Array(O);
7309
7316
  let A = 0;
7310
7317
  for (let S = 0; S < O; S++)
@@ -7364,7 +7371,7 @@ function ue(e, t) {
7364
7371
  function de(e, t) {
7365
7372
  return new _({ code: "E_OPTION_RANGE", message: e, source: "data", details: t });
7366
7373
  }
7367
- function Dt(e, t) {
7374
+ function Rt(e, t) {
7368
7375
  if (typeof e != "string" || e.trim() === "")
7369
7376
  throw ue(`A "${t}" filter needs an attribute path, such as "data.type".`, { kind: t, attribute: e });
7370
7377
  }
@@ -7382,7 +7389,7 @@ function Jn(e, t, n) {
7382
7389
  max: t
7383
7390
  });
7384
7391
  }
7385
- function Yl(e, t) {
7392
+ function Ql(e, t) {
7386
7393
  if (typeof e != "string" || e.trim() === "")
7387
7394
  throw new _({
7388
7395
  code: "E_BAD_QUERY",
@@ -7391,20 +7398,20 @@ function Yl(e, t) {
7391
7398
  details: { kind: t, where: e }
7392
7399
  });
7393
7400
  }
7394
- function xt(e) {
7401
+ function Dt(e) {
7395
7402
  if (typeof e != "object" || e === null || typeof e.kind != "string")
7396
7403
  throw ue(`A filter is an object with a "kind" of ${Qn.join(", ")}.`, { filter: e });
7397
7404
  const { kind: t } = e;
7398
7405
  switch (e.kind) {
7399
7406
  case "expression":
7400
7407
  case "edges":
7401
- Yl(e.where, e.kind);
7408
+ Ql(e.where, e.kind);
7402
7409
  return;
7403
7410
  case "range":
7404
- Dt(e.attribute, e.kind), Jn(e.min, e.max, e.kind);
7411
+ Rt(e.attribute, e.kind), Jn(e.min, e.max, e.kind);
7405
7412
  return;
7406
7413
  case "categories":
7407
- if (Dt(e.attribute, e.kind), !Array.isArray(e.values))
7414
+ if (Rt(e.attribute, e.kind), !Array.isArray(e.values))
7408
7415
  throw ue('A "categories" filter needs a list of values.', { values: e.values });
7409
7416
  return;
7410
7417
  case "degree":
@@ -7432,10 +7439,10 @@ function xt(e) {
7432
7439
  if (!Array.isArray(e.of))
7433
7440
  throw ue(`An "${e.kind}" filter needs a list of filters.`, { of: e.of });
7434
7441
  for (const n of e.of)
7435
- xt(n);
7442
+ Dt(n);
7436
7443
  return;
7437
7444
  case "not":
7438
- xt(e.of);
7445
+ Dt(e.of);
7439
7446
  return;
7440
7447
  default:
7441
7448
  throw ue(`"${t}" is not a filter kind.`, { kind: t, kinds: Qn });
@@ -7454,10 +7461,10 @@ function Pe(e) {
7454
7461
  }
7455
7462
  return null;
7456
7463
  }
7457
- function Hl(e) {
7464
+ function Xl(e) {
7458
7465
  if (typeof e != "object" || e === null)
7459
7466
  throw ue("A time window is an object with an attribute, a from and a to.", { window: e });
7460
- Dt(e.attribute, "window");
7467
+ Rt(e.attribute, "window");
7461
7468
  const t = Pe(e.from), n = Pe(e.to);
7462
7469
  for (const [s, o, r] of [
7463
7470
  ["from", e.from, t],
@@ -7479,29 +7486,29 @@ function Hl(e) {
7479
7486
  { step: e.step }
7480
7487
  );
7481
7488
  }
7482
- function Gs(e, t) {
7483
- e !== null && xt(e), t !== null && Hl(t);
7489
+ function Ws(e, t) {
7490
+ e !== null && Dt(e), t !== null && Xl(t);
7484
7491
  }
7485
- const Kl = { node: null, edge: null };
7486
- function Kt(e, t) {
7492
+ const Jl = { node: null, edge: null };
7493
+ function Ht(e, t) {
7487
7494
  const n = e.marks.get(t);
7488
7495
  if (n !== void 0)
7489
7496
  return n;
7490
7497
  const s = { seen: !1 };
7491
7498
  return e.marks.set(t, s), s;
7492
7499
  }
7493
- function Qt(e, t, n, s) {
7500
+ function Kt(e, t, n, s) {
7494
7501
  const o = e(t, n);
7495
7502
  if (o != null)
7496
7503
  return s.seen = !0, o;
7497
7504
  }
7498
- function Xt(e, t) {
7505
+ function Qt(e, t) {
7499
7506
  const { values: n } = e.sources;
7500
7507
  if (n === void 0)
7501
7508
  throw ot(t, "a source of attribute values");
7502
7509
  return n;
7503
7510
  }
7504
- function Ql(e, t) {
7511
+ function Zl(e, t) {
7505
7512
  const { match: n, unresolvedPathsOf: s } = e.sources;
7506
7513
  if (n === void 0)
7507
7514
  throw ot("expression", "a query engine");
@@ -7514,7 +7521,7 @@ function Ql(e, t) {
7514
7521
  }
7515
7522
  return (r) => o[r] === 1;
7516
7523
  }
7517
- function Xl(e, t) {
7524
+ function eu(e, t) {
7518
7525
  const { matchEdges: n, unresolvedPathsOf: s } = e.sources;
7519
7526
  if (n === void 0)
7520
7527
  throw ot("edges", "a query engine for edges");
@@ -7527,28 +7534,28 @@ function Xl(e, t) {
7527
7534
  }
7528
7535
  return (i) => r[i] === 1;
7529
7536
  }
7530
- function Jl(e, t, n, s) {
7531
- const o = Xt(e, "range"), r = Kt(e, t), i = n ?? Number.NEGATIVE_INFINITY, a = s ?? Number.POSITIVE_INFINITY;
7537
+ function tu(e, t, n, s) {
7538
+ const o = Qt(e, "range"), r = Ht(e, t), i = n ?? Number.NEGATIVE_INFINITY, a = s ?? Number.POSITIVE_INFINITY;
7532
7539
  return (c) => {
7533
- const l = Qt((g, h) => o.nodeValue(g, h), c, t, r);
7540
+ const l = Kt((g, h) => o.nodeValue(g, h), c, t, r);
7534
7541
  return typeof l == "number" && Number.isFinite(l) && l >= i && l <= a;
7535
7542
  };
7536
7543
  }
7537
- function Zl(e, t, n) {
7538
- const s = Xt(e, "categories"), o = Kt(e, t), r = new Set(n);
7544
+ function nu(e, t, n) {
7545
+ const s = Qt(e, "categories"), o = Ht(e, t), r = new Set(n);
7539
7546
  return (i) => {
7540
- const a = Qt((c, l) => s.nodeValue(c, l), i, t, o);
7547
+ const a = Kt((c, l) => s.nodeValue(c, l), i, t, o);
7541
7548
  return typeof a == "string" ? r.has(a) : typeof a == "number" || typeof a == "boolean" ? r.has(String(a)) : !1;
7542
7549
  };
7543
7550
  }
7544
- function eu(e, t, n, s) {
7551
+ function su(e, t, n, s) {
7545
7552
  const { graph: o } = e;
7546
7553
  let r;
7547
7554
  s === "in" ? r = o.inDegree() : s === "out" ? r = o.outDegree() : r = o.degree();
7548
7555
  const i = t ?? Number.NEGATIVE_INFINITY, a = n ?? Number.POSITIVE_INFINITY;
7549
7556
  return (c) => r[c] >= i && r[c] <= a;
7550
7557
  }
7551
- function tu(e, t) {
7558
+ function ou(e, t) {
7552
7559
  const { components: n } = e.sources;
7553
7560
  if (n === void 0)
7554
7561
  throw ot("component", "the connected components");
@@ -7560,7 +7567,7 @@ function tu(e, t) {
7560
7567
  });
7561
7568
  return (o) => s.labels[o] === t;
7562
7569
  }
7563
- function nu(e, t, n) {
7570
+ function ru(e, t, n) {
7564
7571
  const { graph: s } = e, o = new Uint8Array(s.nodeCount);
7565
7572
  let r = [];
7566
7573
  for (const a of t) {
@@ -7594,25 +7601,25 @@ function Ze(e, t) {
7594
7601
  return o;
7595
7602
  };
7596
7603
  }
7597
- function jt(e, t) {
7604
+ function xt(e, t) {
7598
7605
  switch (e.kind) {
7599
7606
  case "expression":
7600
- return { node: Ql(t, e.where), edge: null };
7607
+ return { node: Zl(t, e.where), edge: null };
7601
7608
  case "range":
7602
- return { node: Jl(t, e.attribute, e.min, e.max), edge: null };
7609
+ return { node: tu(t, e.attribute, e.min, e.max), edge: null };
7603
7610
  case "categories":
7604
- return { node: Zl(t, e.attribute, e.values), edge: null };
7611
+ return { node: nu(t, e.attribute, e.values), edge: null };
7605
7612
  case "degree":
7606
- return { node: eu(t, e.min, e.max, e.direction), edge: null };
7613
+ return { node: su(t, e.min, e.max, e.direction), edge: null };
7607
7614
  case "component":
7608
- return { node: tu(t, e.id), edge: null };
7615
+ return { node: ou(t, e.id), edge: null };
7609
7616
  case "neighborhood":
7610
- return { node: nu(t, e.seeds, e.depth), edge: null };
7617
+ return { node: ru(t, e.seeds, e.depth), edge: null };
7611
7618
  case "edges":
7612
- return { node: null, edge: Xl(t, e.where) };
7619
+ return { node: null, edge: eu(t, e.where) };
7613
7620
  case "all":
7614
7621
  case "any": {
7615
- const n = e.of.map((s) => jt(s, t));
7622
+ const n = e.of.map((s) => xt(s, t));
7616
7623
  return {
7617
7624
  node: Ze(
7618
7625
  n.map((s) => s.node),
@@ -7625,7 +7632,7 @@ function jt(e, t) {
7625
7632
  };
7626
7633
  }
7627
7634
  default: {
7628
- const { node: n, edge: s } = jt(e.of, t);
7635
+ const { node: n, edge: s } = xt(e.of, t);
7629
7636
  return {
7630
7637
  node: n === null ? null : (o) => !n(o),
7631
7638
  edge: s === null ? null : (o) => !s(o)
@@ -7633,9 +7640,9 @@ function jt(e, t) {
7633
7640
  }
7634
7641
  }
7635
7642
  }
7636
- function su(e, t) {
7637
- const n = Xt(t, "window"), s = Kt(t, e.attribute), o = Pe(e.from) ?? Number.NEGATIVE_INFINITY, r = Pe(e.to) ?? Number.POSITIVE_INFINITY, i = (a) => (c) => {
7638
- const l = Pe(Qt(a, c, e.attribute, s));
7643
+ function iu(e, t) {
7644
+ const n = Qt(t, "window"), s = Ht(t, e.attribute), o = Pe(e.from) ?? Number.NEGATIVE_INFINITY, r = Pe(e.to) ?? Number.POSITIVE_INFINITY, i = (a) => (c) => {
7645
+ const l = Pe(Kt(a, c, e.attribute, s));
7639
7646
  return l === null || l >= o && l < r;
7640
7647
  };
7641
7648
  return {
@@ -7644,15 +7651,15 @@ function su(e, t) {
7644
7651
  };
7645
7652
  }
7646
7653
  function Zn(e, t, n, s) {
7647
- Gs(t, n);
7654
+ Ws(t, n);
7648
7655
  const o = {
7649
7656
  graph: e,
7650
7657
  sources: s,
7651
7658
  marks: /* @__PURE__ */ new Map(),
7652
7659
  unresolvedQueries: /* @__PURE__ */ new Set()
7653
7660
  }, r = [];
7654
- t !== null && r.push(jt(t, o)), n !== null && r.push(su(n, o));
7655
- const i = r.length === 0 ? Kl : {
7661
+ t !== null && r.push(xt(t, o)), n !== null && r.push(iu(n, o));
7662
+ const i = r.length === 0 ? Jl : {
7656
7663
  node: Ze(
7657
7664
  r.map((a) => a.node),
7658
7665
  "all"
@@ -7674,20 +7681,20 @@ function Zn(e, t, n, s) {
7674
7681
  };
7675
7682
  }
7676
7683
  const Ue = 4096, es = 8;
7677
- function Ws(e, t, n) {
7684
+ function Ys(e, t, n) {
7678
7685
  const s = e.compiled.node;
7679
7686
  for (let o = t; o < n; o++)
7680
7687
  (s === null || s(o)) && e.nodes.add(o);
7681
7688
  }
7682
- function Ys(e, t, n) {
7689
+ function Hs(e, t, n) {
7683
7690
  const s = e.compiled.edge, o = e.graph.edgeList();
7684
7691
  for (let r = t; r < n; r++)
7685
7692
  !e.nodes.has(o.src[r]) || !e.nodes.has(o.dst[r]) || (s === null || s(r)) && e.edges.add(r);
7686
7693
  }
7687
- function ou(e) {
7688
- Ws(e, 0, e.graph.nodeCount), Ys(e, 0, e.graph.edgeCount);
7694
+ function au(e) {
7695
+ Ys(e, 0, e.graph.nodeCount), Hs(e, 0, e.graph.edgeCount);
7689
7696
  }
7690
- async function ru(e, t, n) {
7697
+ async function cu(e, t, n) {
7691
7698
  const { nodeCount: s } = e.graph, { edgeCount: o } = e.graph, r = s + o;
7692
7699
  let i = performance.now() + es;
7693
7700
  const a = async (c) => {
@@ -7703,15 +7710,15 @@ async function ru(e, t, n) {
7703
7710
  throw t.reason;
7704
7711
  for (let c = 0; c < s; c += Ue) {
7705
7712
  const l = Math.min(c + Ue, s);
7706
- Ws(e, c, l), await a(l);
7713
+ Ys(e, c, l), await a(l);
7707
7714
  }
7708
7715
  for (let c = 0; c < o; c += Ue) {
7709
7716
  const l = Math.min(c + Ue, o);
7710
- Ys(e, c, l), await a(s + l);
7717
+ Hs(e, c, l), await a(s + l);
7711
7718
  }
7712
7719
  n(r, r);
7713
7720
  }
7714
- const yt = "visibility.set", ts = "graph", ns = Object.freeze([]), iu = Object.freeze([]), au = Object.freeze([]);
7721
+ const yt = "visibility.set", ts = "graph", ns = Object.freeze([]), lu = Object.freeze([]), uu = Object.freeze([]);
7715
7722
  function ss(e) {
7716
7723
  const t = new Set(e);
7717
7724
  for (const n of ["add", "delete", "clear"])
@@ -7730,28 +7737,28 @@ function ss(e) {
7730
7737
  });
7731
7738
  return Object.freeze(t);
7732
7739
  }
7733
- function cu(e, t) {
7740
+ function du(e, t) {
7734
7741
  return e !== null && t !== null ? `Filter (${e.kind}) and time window` : e !== null ? `Filter (${e.kind})` : t === null ? "Show everything" : "Time window";
7735
7742
  }
7736
- function lu(e, t) {
7743
+ function hu(e, t) {
7737
7744
  return Object.freeze({
7738
7745
  direction: "as-loaded",
7739
7746
  exact: !0,
7740
7747
  filterScope: e !== null,
7741
7748
  method: "mask",
7742
- notes: au,
7749
+ notes: uu,
7743
7750
  precision: "f64",
7744
7751
  seed: null,
7745
7752
  weight: null,
7746
7753
  windowScope: t !== null
7747
7754
  });
7748
7755
  }
7749
- function uu(e) {
7750
- const t = e.queue ?? Gt(), n = e.engine ?? He;
7756
+ function fu(e) {
7757
+ const t = e.queue ?? qt(), n = e.engine ?? He;
7751
7758
  let s = null, o = null, r = null, i = null, a = !1, c = ns, l = null;
7752
7759
  const g = () => {
7753
7760
  const b = e.snapshot();
7754
- return (s === null || s.graph !== b) && (s = { graph: b, nodeSpace: Bt(b), edgeSpace: Ee(b) }), s;
7761
+ return (s === null || s.graph !== b) && (s = { graph: b, nodeSpace: Vt(b), edgeSpace: Ee(b) }), s;
7755
7762
  }, h = new te(() => g().nodeSpace, 1), y = new te(() => g().edgeSpace, 1);
7756
7763
  let P = null, F = null, U = null, w = null, N = null, d = "", p = null, O = null;
7757
7764
  const T = (b) => {
@@ -7760,7 +7767,7 @@ function uu(e) {
7760
7767
  return;
7761
7768
  }
7762
7769
  const k = Zn(b, r, i, e);
7763
- ou({ compiled: k, edges: y, graph: b, nodes: h }), c = k.unresolvedPaths();
7770
+ au({ compiled: k, edges: y, graph: b, nodes: h }), c = k.unresolvedPaths();
7764
7771
  }, $ = () => {
7765
7772
  const b = g();
7766
7773
  return o !== b.graph && (o = b.graph, T(b.graph)), b;
@@ -7785,7 +7792,7 @@ function uu(e) {
7785
7792
  for (let m = 0; m < k.graph.edgeCount; m++)
7786
7793
  u.push(k.edgeSpace.idOf(m));
7787
7794
  return O = k.graph, p = Object.freeze({
7788
- digest: ps(V, u),
7795
+ digest: bs(V, u),
7789
7796
  edgeCount: u.length,
7790
7797
  edges: new Set(u),
7791
7798
  nodeCount: V.length,
@@ -7828,7 +7835,7 @@ function uu(e) {
7828
7835
  };
7829
7836
  }
7830
7837
  }), v = (b, k, V, u) => {
7831
- if (Gs(b, k), V.dryRun === !0)
7838
+ if (Ws(b, k), V.dryRun === !0)
7832
7839
  throw new _({
7833
7840
  code: "E_UNSUPPORTED",
7834
7841
  message: 'A visibility pass cannot be a dry run. Ask what a filter would leave showing with plan({ op: "visibility.set", filter }), which performs nothing.',
@@ -7836,12 +7843,12 @@ function uu(e) {
7836
7843
  details: { op: yt }
7837
7844
  });
7838
7845
  l?.cancel("A newer visibility instruction replaced this one.");
7839
- const m = cu(b, k), E = Object.freeze({ filter: b, window: k }), M = {
7846
+ const m = du(b, k), E = Object.freeze({ filter: b, window: k }), M = {
7840
7847
  algorithm: yt,
7841
- caveats: lu(b, k),
7848
+ caveats: hu(b, k),
7842
7849
  engine: n,
7843
7850
  exact: null,
7844
- fields: iu,
7851
+ fields: lu,
7845
7852
  id: Ge({
7846
7853
  algorithm: yt,
7847
7854
  exact: null,
@@ -7867,7 +7874,7 @@ function uu(e) {
7867
7874
  () => L.edgeSpace,
7868
7875
  Math.max(1, L.graph.edgeCount)
7869
7876
  );
7870
- D.grow(L.graph.nodeCount), q.grow(L.graph.edgeCount), await ru(
7877
+ D.grow(L.graph.nodeCount), q.grow(L.graph.edgeCount), await cu(
7871
7878
  { compiled: W, edges: q, graph: L.graph, nodes: D },
7872
7879
  z.signal,
7873
7880
  (H, Z) => {
@@ -7936,10 +7943,10 @@ function uu(e) {
7936
7943
  }
7937
7944
  };
7938
7945
  }
7939
- function du() {
7940
- return jo.parse({});
7946
+ function mu() {
7947
+ return Lo.parse({});
7941
7948
  }
7942
- const hu = /* @__PURE__ */ new Set(["active", "idle"]), fu = Object.freeze({
7949
+ const gu = /* @__PURE__ */ new Set(["active", "idle"]), pu = Object.freeze({
7943
7950
  exact: !0,
7944
7951
  seed: null,
7945
7952
  direction: "as-loaded",
@@ -7947,12 +7954,12 @@ const hu = /* @__PURE__ */ new Set(["active", "idle"]), fu = Object.freeze({
7947
7954
  precision: "f64",
7948
7955
  method: "exact",
7949
7956
  notes: Object.freeze([])
7950
- }), mu = Object.freeze({
7957
+ }), bu = Object.freeze({
7951
7958
  ready: !1,
7952
7959
  counts: Object.freeze({ nodes: 0, edges: 0, visibleNodes: 0, visibleEdges: 0 }),
7953
7960
  directed: !1
7954
7961
  }), os = "data.";
7955
- function gu(e) {
7962
+ function vu(e) {
7956
7963
  return Promise.reject(
7957
7964
  new _({
7958
7965
  code: "E_UNSUPPORTED",
@@ -7963,7 +7970,7 @@ function gu(e) {
7963
7970
  })
7964
7971
  );
7965
7972
  }
7966
- class pu {
7973
+ class yu {
7967
7974
  /**
7968
7975
  * Assemble the session from parts the factory has already decided the ownership of.
7969
7976
  * @param parts - the store, the data surface, the configuration and the accelerator, each
@@ -8028,7 +8035,7 @@ class pu {
8028
8035
  */
8029
8036
  get status() {
8030
8037
  if (this.disposed)
8031
- return mu;
8038
+ return bu;
8032
8039
  const t = this.store.getSnapshot(), n = this.visibility.summary;
8033
8040
  return Object.freeze({
8034
8041
  ready: !0,
@@ -8115,7 +8122,7 @@ class pu {
8115
8122
  * @returns The estimate.
8116
8123
  */
8117
8124
  estimate(t) {
8118
- return qt(this.planning, t);
8125
+ return Bt(this.planning, t);
8119
8126
  }
8120
8127
  /**
8121
8128
  * What one command would do, what it would cost, and whether it would be allowed.
@@ -8128,7 +8135,7 @@ class pu {
8128
8135
  * @returns The plan.
8129
8136
  */
8130
8137
  plan(t) {
8131
- return Promise.resolve(Si(this.planning, t));
8138
+ return Promise.resolve(Ci(this.planning, t));
8132
8139
  }
8133
8140
  /**
8134
8141
  * Watch the session.
@@ -8155,16 +8162,16 @@ class pu {
8155
8162
  this.disposed || (this.disposed = !0, this.unwatchController(), this.sessionRuns.dispose(), this.stopStyleEdits(), this.watchers.clear(), this.sessionData.dispose(), this.ownedAcceleration?.dispose(), this.ownedStore?.dispose());
8156
8163
  }
8157
8164
  }
8158
- function bu(e) {
8165
+ function wu(e) {
8159
8166
  if (typeof e == "function")
8160
8167
  return e;
8161
- const t = e ?? du();
8168
+ const t = e ?? mu();
8162
8169
  return () => t;
8163
8170
  }
8164
- function vu(e, t, n) {
8171
+ function Ou(e, t, n) {
8165
8172
  if (e !== void 0)
8166
8173
  return { store: e, owned: null };
8167
- const s = new Yo({
8174
+ const s = new Ko({
8168
8175
  directed: t().directed,
8169
8176
  // A thunk, not a value: the element mutates `data.knownFields` in place at run time, and a
8170
8177
  // scale captured here would be the one known field that ignored the change.
@@ -8184,22 +8191,22 @@ function vu(e, t, n) {
8184
8191
  });
8185
8192
  return { store: s, owned: s };
8186
8193
  }
8187
- function yu(e, t, n) {
8194
+ function Eu(e, t, n) {
8188
8195
  if (e !== void 0)
8189
8196
  return { controller: e, owned: null };
8190
- const s = new Bo(n === void 0 ? { policy: t } : { policy: t, minNodes: n });
8197
+ const s = new Go(n === void 0 ? { policy: t } : { policy: t, minNodes: n });
8191
8198
  return { controller: s, owned: s };
8192
8199
  }
8193
- function wu(e, t) {
8200
+ function Nu(e, t) {
8194
8201
  const n = (s) => s.startsWith(os) ? s.slice(os.length) : s;
8195
8202
  return {
8196
8203
  nodeValue: (s, o) => e.nodeAttributes(s, t().ids.idOf(s))?.[n(o)],
8197
8204
  // An edge's endpoints are read from the snapshot when the record holds nothing under the
8198
8205
  // key, as a style selector reads them: the importer removes the keys they arrived under.
8199
- edgeValue: (s, o) => e.edgeAttributes(s)?.[n(o)] ?? qs(t(), s, n(o))
8206
+ edgeValue: (s, o) => e.edgeAttributes(s)?.[n(o)] ?? Gs(t(), s, n(o))
8200
8207
  };
8201
8208
  }
8202
- function Ou(e) {
8209
+ function Su(e) {
8203
8210
  let t = null, n = { labels: new Int32Array(0), count: 0 };
8204
8211
  return () => {
8205
8212
  const s = e.snapshot();
@@ -8212,7 +8219,7 @@ function Ou(e) {
8212
8219
  return n;
8213
8220
  };
8214
8221
  }
8215
- function Eu(e, t) {
8222
+ function Au(e, t) {
8216
8223
  let n = e;
8217
8224
  for (const s of t.split(".")) {
8218
8225
  if (typeof n != "object" || n === null)
@@ -8226,12 +8233,12 @@ function rs(e, t) {
8226
8233
  for (const s of Ie(t)) {
8227
8234
  if (s.accepts === "nothing")
8228
8235
  continue;
8229
- const o = Eu(e, s.stylePath);
8236
+ const o = Au(e, s.stylePath);
8230
8237
  (typeof o == "string" || typeof o == "number" || typeof o == "boolean") && (n[s.channel] = o);
8231
8238
  }
8232
8239
  return n;
8233
8240
  }
8234
- function Nu() {
8241
+ function Cu() {
8235
8242
  return [
8236
8243
  {
8237
8244
  name: "Node defaults",
@@ -8239,7 +8246,7 @@ function Nu() {
8239
8246
  source: { by: "element", reason: "default" },
8240
8247
  target: "node",
8241
8248
  selector: { match: "everything" },
8242
- set: rs(to, "node")
8249
+ set: rs(no, "node")
8243
8250
  },
8244
8251
  {
8245
8252
  name: "Edge defaults",
@@ -8247,7 +8254,7 @@ function Nu() {
8247
8254
  source: { by: "element", reason: "default" },
8248
8255
  target: "edge",
8249
8256
  selector: { match: "everything" },
8250
- set: rs(no, "edge")
8257
+ set: rs(so, "edge")
8251
8258
  }
8252
8259
  ];
8253
8260
  }
@@ -8263,13 +8270,13 @@ function is(e, t, n) {
8263
8270
  s.includes(o) || s.push(o);
8264
8271
  return s;
8265
8272
  }
8266
- function Su(e, t) {
8273
+ function _u(e, t) {
8267
8274
  return {
8268
8275
  answers: (n, s) => is(e, t, s).includes(n),
8269
8276
  candidates: (n, s) => is(e, t, s)
8270
8277
  };
8271
8278
  }
8272
- function Au(e, t) {
8279
+ function Iu(e, t) {
8273
8280
  return (n, s) => {
8274
8281
  for (const o of e.attributes())
8275
8282
  if (o.path === n && o.kind === s)
@@ -8280,22 +8287,22 @@ function Au(e, t) {
8280
8287
  return { plainName: r.plainName, technicalName: r.technicalName };
8281
8288
  };
8282
8289
  }
8283
- function Cu(e) {
8290
+ function Tu(e) {
8284
8291
  return typeof e == "string" ? e : "runId" in e ? e.runId : e.id;
8285
8292
  }
8286
- function _u(e) {
8293
+ function Pu(e) {
8287
8294
  return {
8288
- run: (t) => e.get(Cu(t)),
8295
+ run: (t) => e.get(Tu(t)),
8289
8296
  runIds: () => e.list().map((t) => t.id)
8290
8297
  };
8291
8298
  }
8292
- function Iu(e) {
8299
+ function $u(e) {
8293
8300
  return (t) => {
8294
8301
  const n = e().ids.indexOf(t);
8295
8302
  return n === G ? void 0 : n;
8296
8303
  };
8297
8304
  }
8298
- function Tu(e) {
8305
+ function ku(e) {
8299
8306
  let t = null, n = null;
8300
8307
  return (s) => {
8301
8308
  const o = e();
@@ -8304,7 +8311,7 @@ function Tu(e) {
8304
8311
  return r === G ? void 0 : r;
8305
8312
  };
8306
8313
  }
8307
- function Pu(e, t) {
8314
+ function Mu(e, t) {
8308
8315
  let n = null, s = null;
8309
8316
  const o = () => {
8310
8317
  const r = t();
@@ -8338,30 +8345,30 @@ function Pu(e, t) {
8338
8345
  }
8339
8346
  };
8340
8347
  }
8341
- function ed(e = {}) {
8342
- return Hs(e);
8348
+ function sd(e = {}) {
8349
+ return Ks(e);
8343
8350
  }
8344
- function td(e = {}) {
8345
- return Hs(e);
8351
+ function od(e = {}) {
8352
+ return Ks(e);
8346
8353
  }
8347
- function Hs(e) {
8348
- const t = bu(e.config?.data), n = e.acceleration?.policy ?? e.config?.acceleration?.policy ?? ls, s = e.acceleration?.minNodes ?? e.config?.acceleration?.minNodes, o = /* @__PURE__ */ new Map();
8354
+ function Ks(e) {
8355
+ const t = wu(e.config?.data), n = e.acceleration?.policy ?? e.config?.acceleration?.policy ?? ls, s = e.acceleration?.minNodes ?? e.config?.acceleration?.minNodes, o = /* @__PURE__ */ new Map();
8349
8356
  let r = null, i = null, a = null, c = null;
8350
- const l = vu(e.store, t, {
8357
+ const l = Ou(e.store, t, {
8351
8358
  nodes: (v, b) => r?.remapNodes(v, b),
8352
8359
  edges: (v, b) => r?.remapEdges(v, b)
8353
- }), g = yu(e.acceleration, n, s), h = new Ni(l.store, e.records ?? null, t), y = e.runs ?? {}, P = () => l.store.getSnapshot(), F = Ou(h), U = y.queue ?? Gt(), w = gr({
8360
+ }), g = Eu(e.acceleration, n, s), h = new Ai(l.store, e.records ?? null, t), y = e.runs ?? {}, P = () => l.store.getSnapshot(), F = Su(h), U = y.queue ?? qt(), w = br({
8354
8361
  snapshot: P,
8355
8362
  components: F,
8356
8363
  // Read through a call rather than captured: both of these are built below, and the
8357
8364
  // resolver only reaches them when somebody resolves a scope that names them.
8358
- selection: { nodes: () => $u(r).nodeMembers() },
8365
+ selection: { nodes: () => Ru(r).nodeMembers() },
8359
8366
  visibility: {
8360
8367
  nodes: () => N.masks.nodes(),
8361
8368
  edges: () => N.masks.edges()
8362
8369
  },
8363
8370
  match: (v) => Ve(c).nodes(v)
8364
- }), N = uu({
8371
+ }), N = fu({
8365
8372
  snapshot: P,
8366
8373
  components: F,
8367
8374
  queue: U,
@@ -8370,15 +8377,15 @@ function Hs(e) {
8370
8377
  matchEdges: (v) => Ve(c).edges(v),
8371
8378
  unresolvedPathsOf: (v) => Ve(c).unresolvedPathsOf(v),
8372
8379
  ...y.engine === void 0 ? {} : { engine: y.engine },
8373
- ...e.records === void 0 ? {} : { values: wu(e.records, P) },
8380
+ ...e.records === void 0 ? {} : { values: Nu(e.records, P) },
8374
8381
  onChange: (v) => {
8375
8382
  we(o, "visibility:changed", v);
8376
8383
  }
8377
- }), d = y.defaultScope ?? "visible", p = Yi({
8384
+ }), d = y.defaultScope ?? "visible", p = Ki({
8378
8385
  queue: U,
8379
8386
  catalog: We,
8380
8387
  resolveScope: (v) => w.resolveNow(v),
8381
- execute: y.execute ?? gu,
8388
+ execute: y.execute ?? vu,
8382
8389
  engine: y.engine ?? He,
8383
8390
  defaultScope: d,
8384
8391
  ...y.defaultCaveats === void 0 ? {} : { defaultCaveats: y.defaultCaveats },
@@ -8387,7 +8394,7 @@ function Hs(e) {
8387
8394
  // for what a shape suggests. It is handed in here rather than called at each door because
8388
8395
  // the console, the panel, an agent's tool call and a bare `runs.start()` all end at this
8389
8396
  // one API, and a decision made at the doors is a decision made more than once.
8390
- styling: Xi({
8397
+ styling: Zi({
8391
8398
  styles: () => a ?? void 0,
8392
8399
  // WHERE A REFUSAL GOES WHEN NOBODY IS AWAITING IT. The element paints a run's
8393
8400
  // suggestion on the run's own completion, fire-and-forget, because a consumer must
@@ -8399,7 +8406,7 @@ function Hs(e) {
8399
8406
  onProblem: (v, b) => {
8400
8407
  we(o, "style:problem", {
8401
8408
  runId: v,
8402
- error: zt(b) ? b : new _({
8409
+ error: jt(b) ? b : new _({
8403
8410
  code: "E_INTERNAL",
8404
8411
  message: `Applying the styling suggested by run "${v}" failed.`,
8405
8412
  source: "style",
@@ -8433,22 +8440,22 @@ function Hs(e) {
8433
8440
  onChange: (v) => {
8434
8441
  v.phase === "end" && i?.(), we(o, "run:changed", v);
8435
8442
  }
8436
- }), O = So({
8437
- entry: (v) => ku(p, v),
8438
- entries: () => p.list().map((v) => Ks(v))
8439
- }), T = Wl({
8443
+ }), O = Co({
8444
+ entry: (v) => Du(p, v),
8445
+ entries: () => p.list().map((v) => Qs(v))
8446
+ }), T = Kl({
8440
8447
  snapshot: P,
8441
8448
  results: (v) => p.get(v)?.result,
8442
8449
  ...e.records === void 0 ? {} : { records: e.records }
8443
- }), $ = Su(h, p);
8444
- c = Ai({
8450
+ }), $ = _u(h, p);
8451
+ c = _i({
8445
8452
  snapshot: P,
8446
8453
  elements: T,
8447
8454
  answers: (v, b) => $.answers(v, b),
8448
8455
  searchPaths: () => h.attributes().filter((v) => v.kind === "node").map((v) => v.path)
8449
8456
  });
8450
8457
  const A = c;
8451
- r = xr({
8458
+ r = zr({
8452
8459
  snapshot: P,
8453
8460
  scope: w,
8454
8461
  results: O,
@@ -8459,8 +8466,8 @@ function Hs(e) {
8459
8466
  we(o, "selection:changed", v);
8460
8467
  }
8461
8468
  });
8462
- const S = Ht(), j = Pu(
8463
- Ll({
8469
+ const S = Yt(), j = Mu(
8470
+ Vl({
8464
8471
  nodeCount: () => P().nodeCount,
8465
8472
  edgeCount: () => P().edgeCount,
8466
8473
  elements: T,
@@ -8472,15 +8479,15 @@ function Hs(e) {
8472
8479
  P
8473
8480
  );
8474
8481
  i = j.invalidate;
8475
- const f = new AbortController(), I = yl({
8482
+ const f = new AbortController(), I = El({
8476
8483
  elements: T,
8477
- base: Nu(),
8484
+ base: Cu(),
8478
8485
  paths: $,
8479
8486
  scales: S,
8480
- runs: _u(p),
8481
- nodeIndex: Iu(P),
8482
- edgeIndex: Tu(P),
8483
- field: Au(h, p),
8487
+ runs: Pu(p),
8488
+ nodeIndex: $u(P),
8489
+ edgeIndex: ku(P),
8490
+ field: Iu(h, p),
8484
8491
  repaint: j.repaint,
8485
8492
  // What `styles.legend()` and `styles.explain()` read: the bindings the last pass actually
8486
8493
  // painted from. Without it both verbs fall back to "nothing is prepared" and report an
@@ -8497,23 +8504,23 @@ function Hs(e) {
8497
8504
  disposed: f.signal
8498
8505
  });
8499
8506
  a = I;
8500
- const C = Mu(
8507
+ const C = xu(
8501
8508
  y,
8502
8509
  h,
8503
8510
  (v) => w.resolveNow(v),
8504
8511
  d,
8505
8512
  g.controller
8506
8513
  );
8507
- return new pu({
8514
+ return new yu({
8508
8515
  store: l.store,
8509
8516
  ownedStore: l.owned,
8510
8517
  data: h,
8511
8518
  // THE SAME COST MODEL THE BUTTON ASKS. A metric listing quotes the number a run of that
8512
8519
  // metric would be estimated at, so it is produced by the estimate rather than by a second
8513
8520
  // model beside it: one source, consulted twice, cannot disagree with itself.
8514
- catalog: Gr({
8521
+ catalog: Yr({
8515
8522
  algorithms: () => We.algorithms(),
8516
- estimate: (v) => qt(C, { algorithm: v }),
8523
+ estimate: (v) => Bt(C, { algorithm: v }),
8517
8524
  runs: () => p.list()
8518
8525
  }),
8519
8526
  readData: t,
@@ -8533,7 +8540,7 @@ function Hs(e) {
8533
8540
  watchers: o
8534
8541
  });
8535
8542
  }
8536
- function $u(e) {
8543
+ function Ru(e) {
8537
8544
  if (e === null)
8538
8545
  throw new _({
8539
8546
  code: "E_UNSUPPORTED",
@@ -8560,7 +8567,7 @@ function we(e, t, n) {
8560
8567
  } catch {
8561
8568
  }
8562
8569
  }
8563
- function Ks(e) {
8570
+ function Qs(e) {
8564
8571
  return {
8565
8572
  id: e.id,
8566
8573
  label: e.label,
@@ -8568,48 +8575,48 @@ function Ks(e) {
8568
8575
  ...e.result === void 0 ? {} : { result: e.result }
8569
8576
  };
8570
8577
  }
8571
- function ku(e, t) {
8578
+ function Du(e, t) {
8572
8579
  const n = e.get(t);
8573
- return n === void 0 ? void 0 : Ks(n);
8580
+ return n === void 0 ? void 0 : Qs(n);
8574
8581
  }
8575
- function Mu(e, t, n, s, o) {
8576
- const r = e.defaultCaveats ?? fu;
8582
+ function xu(e, t, n, s, o) {
8583
+ const r = e.defaultCaveats ?? pu;
8577
8584
  return {
8578
8585
  algorithms: () => We.algorithms(),
8579
8586
  statistics: () => t.statistics(),
8580
8587
  resolveScope: n,
8581
8588
  defaultScope: s,
8582
- limits: e.limits ?? Es,
8589
+ limits: e.limits ?? Ns,
8583
8590
  defaultCaveats: r,
8584
8591
  // "idle" counts: an accelerator IS attached and the node count is merely below the
8585
8592
  // threshold at which the element bothers to use it, so an algorithm that needs one can run.
8586
- acceleratorAvailable: () => hu.has(o.capabilities.acceleration.state),
8593
+ acceleratorAvailable: () => gu.has(o.capabilities.acceleration.state),
8587
8594
  ...e.calibration === void 0 ? {} : { calibration: e.calibration },
8588
8595
  ...e.measurements === void 0 ? {} : { measurements: e.measurements }
8589
8596
  };
8590
8597
  }
8591
8598
  export {
8592
- Bo as A,
8593
- Ju as D,
8594
- Yo as G,
8595
- Xu as Q,
8599
+ Go as A,
8600
+ td as D,
8601
+ Ko as G,
8602
+ ed as Q,
8596
8603
  wt as R,
8597
8604
  dt as S,
8598
- Qo as T,
8599
- Es as a,
8600
- ti as b,
8601
- ir as c,
8602
- ws as d,
8603
- Qu as e,
8604
- Ko as f,
8605
- ed as g,
8606
- Hu as h,
8607
- Zu as i,
8608
- Ku as j,
8605
+ Jo as T,
8606
+ Ns as a,
8607
+ si as b,
8608
+ cr as c,
8609
+ Os as d,
8610
+ Zu as e,
8611
+ Xo as f,
8612
+ sd as g,
8613
+ Xu as h,
8614
+ nd as i,
8615
+ Ju as j,
8609
8616
  Ot as k,
8610
- jo as l,
8611
- qo as m,
8612
- td as n,
8613
- Mo as o,
8614
- Yu as p
8617
+ Lo as l,
8618
+ Wo as m,
8619
+ od as n,
8620
+ Do as o,
8621
+ Qu as p
8615
8622
  };