@graphysdk/viz-engine 0.0.1-plugins.4 → 0.0.1-plugins.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { isValid as U, isBefore as Da, parse as Be, differenceInDays as Ra, isWithinInterval as Pa, addDays as $r } from "date-fns";
2
- import { table as _e, desc as Na, op as Gr } from "arquero";
1
+ import { isValid as U, isBefore as Da, parse as Be, differenceInDays as Ra, isWithinInterval as Na, addDays as $r } from "date-fns";
2
+ import { table as _e, desc as Pa, op as Gr } from "arquero";
3
3
  import { isEqual as Oa, isInteger as Ba, merge as Ae } from "lodash-es";
4
4
  import { utcYear as $a, utcMonth as Ga, utcMonday as Ua, utcDay as Wa, utcHour as Ya } from "d3-time";
5
5
  import { differenceInDays as Ha } from "date-fns/differenceInDays";
@@ -8,7 +8,7 @@ import Yr from "lodash-es/merge";
8
8
  import { regressionLoess as qa, regressionPoly as Qa, regressionPow as Za, regressionQuad as Ja, regressionLog as es, regressionExp as ts, regressionLinear as ns } from "d3-regression";
9
9
  import rs from "humanize-duration";
10
10
  import { Delaunay as os } from "d3-delaunay";
11
- typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.vizEngine = "0.0.1-plugins.4");
11
+ typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.vizEngine = "0.0.1-plugins.6");
12
12
  const Hr = (e) => e.length > 0;
13
13
  function h(e) {
14
14
  return e != null;
@@ -24,7 +24,7 @@ function We(e, t) {
24
24
  t
25
25
  );
26
26
  }
27
- function kt(e, t) {
27
+ function Vt(e, t) {
28
28
  for (const n of Object.keys(t)) {
29
29
  const r = t[n];
30
30
  if (r !== void 0 && r !== e[n])
@@ -55,9 +55,9 @@ function xt(e) {
55
55
  };
56
56
  }
57
57
  let St = !0;
58
- const Ay = (e) => {
58
+ const My = (e) => {
59
59
  St = e;
60
- }, Ty = () => St, as = () => {
60
+ }, ky = () => St, as = () => {
61
61
  let e = null;
62
62
  const t = { hits: 0, misses: 0 };
63
63
  return Object.assign((r, o) => {
@@ -116,7 +116,7 @@ class re {
116
116
  return this.singletonKey;
117
117
  }
118
118
  }
119
- function My(e) {
119
+ function Ly(e) {
120
120
  return { type: "mapping", mapping: e };
121
121
  }
122
122
  function jr(e, t) {
@@ -194,17 +194,17 @@ const is = new Set(Object.values($e)), cs = (e) => e.startsWith(qr), ls = (e) =>
194
194
  }, $n = (e, t) => {
195
195
  const n = e[t];
196
196
  return n !== void 0 && n.kind === "position" ? n : null;
197
- }, P = (e) => e instanceof Date && U(e), ps = (e) => P(e) || e === null, He = (e) => typeof e == "string", k = (e) => typeof e == "number" && !Number.isNaN(e) && Number.isFinite(e);
197
+ }, N = (e) => e instanceof Date && U(e), ps = (e) => N(e) || e === null, He = (e) => typeof e == "string", V = (e) => typeof e == "number" && !Number.isNaN(e) && Number.isFinite(e);
198
198
  function Zr(e) {
199
199
  return e[de.color];
200
200
  }
201
- function Ly(e) {
201
+ function Vy(e) {
202
202
  return e[de.alpha];
203
203
  }
204
204
  function fs(e) {
205
205
  return e[de.size];
206
206
  }
207
- function Vy(e) {
207
+ function Ey(e) {
208
208
  return e[de.strokeWidth];
209
209
  }
210
210
  function hs(e) {
@@ -221,7 +221,7 @@ const jt = (e, t, n, r) => {
221
221
  const c = r.resolveAnchorPosition(o.geom, i, n);
222
222
  if (c === null) continue;
223
223
  const l = s !== null ? i[s] ?? null : null;
224
- if (k(l))
224
+ if (V(l))
225
225
  return { ...c, measurementValue: l, color: Zr(i) };
226
226
  }
227
227
  }
@@ -341,7 +341,7 @@ class Ms extends re {
341
341
  };
342
342
  }
343
343
  }
344
- class Ls extends re {
344
+ class ks extends re {
345
345
  dependencies(t) {
346
346
  return [t.data, t.mapping];
347
347
  }
@@ -352,12 +352,12 @@ class Ls extends re {
352
352
  const a = te(r[o]);
353
353
  if (a === void 0) continue;
354
354
  const s = A(`const_${o}`);
355
- n = n.addConstantVariable(s, Vs(a), a), r = { ...r, [o]: s };
355
+ n = n.addConstantVariable(s, Ls(a), a), r = { ...r, [o]: s };
356
356
  }
357
357
  return { data: n, mapping: r };
358
358
  }
359
359
  }
360
- const Vs = (e) => typeof e == "number" ? "numeric" : e instanceof Date ? "temporal" : "categorical";
360
+ const Ls = (e) => typeof e == "number" ? "numeric" : e instanceof Date ? "temporal" : "categorical";
361
361
  class Te {
362
362
  constructor() {
363
363
  this.perLayerMemo = zr(), this.listMemo = as();
@@ -372,7 +372,7 @@ class Te {
372
372
  return this.listMemo(r, () => r);
373
373
  }
374
374
  }
375
- class ks extends re {
375
+ class Vs extends re {
376
376
  constructor(t) {
377
377
  super(), this.registry = t;
378
378
  }
@@ -399,7 +399,7 @@ class Es extends Te {
399
399
  }
400
400
  class Is {
401
401
  constructor(t) {
402
- this.setupStage = new ks(t), this.transformStage = new Es(t);
402
+ this.setupStage = new Vs(t), this.transformStage = new Es(t);
403
403
  }
404
404
  get setupStats() {
405
405
  return this.setupStage.stats;
@@ -511,11 +511,11 @@ class Ds {
511
511
  transform(t) {
512
512
  return t.layers.map((n) => {
513
513
  const r = this.geomRegistry.get(n.geom), o = Jr(r.positionChannels);
514
- return Ns(n, o);
514
+ return Ps(n, o);
515
515
  });
516
516
  }
517
517
  }
518
- const Wn = A("flipSwap"), Rs = (e, t) => Ps(t) ? e.map((n) => n.scaledAesthetic !== "x" || n.scaleType !== "continuous" && n.scaleType !== "datetime" && n.scaleType !== "discrete" ? n : { ...n, reverse: !n.reverse }) : e, Ps = (e) => {
518
+ const Wn = A("flipSwap"), Rs = (e, t) => Ns(t) ? e.map((n) => n.scaledAesthetic !== "x" || n.scaleType !== "continuous" && n.scaleType !== "datetime" && n.scaleType !== "discrete" ? n : { ...n, reverse: !n.reverse }) : e, Ns = (e) => {
519
519
  for (const t of e) {
520
520
  const n = v(t.mapping.x);
521
521
  if (!n || !t.data.hasVariable(n)) continue;
@@ -523,7 +523,7 @@ const Wn = A("flipSwap"), Rs = (e, t) => Ps(t) ? e.map((n) => n.scaledAesthetic
523
523
  if (r === "categorical" || r === "temporal") return !0;
524
524
  }
525
525
  return !1;
526
- }, Ns = (e, t) => {
526
+ }, Ps = (e, t) => {
527
527
  let n = e.data;
528
528
  for (const [r, o] of t) {
529
529
  const a = n.hasVariable(r), s = n.hasVariable(o);
@@ -597,7 +597,7 @@ const Ys = /* @__PURE__ */ new Set(["count", "sum", "mean", "median"]);
597
597
  function eo(e, t) {
598
598
  return Ys.has(e) ? "numeric" : t;
599
599
  }
600
- const L = (e) => (Array.isArray(e) ? e : [e]).map((n) => n instanceof Date ? n.toISOString() : String(n ?? "<null>")).join("\0"), Hs = "key", Ks = "value", Hn = "\0__rowMaskIndex", Pe = {
600
+ const k = (e) => (Array.isArray(e) ? e : [e]).map((n) => n instanceof Date ? n.toISOString() : String(n ?? "<null>")).join("\0"), Hs = "key", Ks = "value", Hn = "\0__rowMaskIndex", Ne = {
601
601
  numeric: { type: "decimal" },
602
602
  categorical: { type: "text" },
603
603
  temporal: { type: "datetime" }
@@ -769,7 +769,7 @@ class M {
769
769
  * Orders the dataset by a variable, in ascending (default) or descending order.
770
770
  */
771
771
  orderBy(t, n = "asc") {
772
- const r = this.table.orderby(n === "asc" ? t : Na(t));
772
+ const r = this.table.orderby(n === "asc" ? t : Pa(t));
773
773
  return M.fromTrusted(r, this.variableMetadata);
774
774
  }
775
775
  /**
@@ -814,7 +814,7 @@ class M {
814
814
  )
815
815
  ), r = {};
816
816
  for (const [o, { variableName: a, aggregation: s }] of Object.entries(t)) {
817
- const i = this.variableMetadata[a], c = i?.type ?? "numeric", l = i?.valueFormat ?? Pe[c], u = eo(s, c);
817
+ const i = this.variableMetadata[a], c = i?.type ?? "numeric", l = i?.valueFormat ?? Ne[c], u = eo(s, c);
818
818
  r[o] = { type: u, valueFormat: to(s, l) };
819
819
  }
820
820
  return M.fromTrusted(n, r);
@@ -904,7 +904,7 @@ class M {
904
904
  resolveAddedVariableFormat(t, n, r) {
905
905
  if (r !== void 0) return r;
906
906
  const o = this.variableMetadata[t];
907
- return o ? o.valueFormat : Pe[n];
907
+ return o ? o.valueFormat : Ne[n];
908
908
  }
909
909
  /**
910
910
  * Parses the variable map into a table and variable metadata.
@@ -912,7 +912,7 @@ class M {
912
912
  parseVariableMap(t) {
913
913
  const n = {}, r = {};
914
914
  for (const [a, { type: s, values: i, valueFormat: c }] of Object.entries(t))
915
- n[a] = i, r[a] = { type: s, valueFormat: c ?? Pe[s] };
915
+ n[a] = i, r[a] = { type: s, valueFormat: c ?? Ne[s] };
916
916
  return { table: _e(n), variableMetadata: r };
917
917
  }
918
918
  /**
@@ -985,12 +985,12 @@ class Xs {
985
985
  )
986
986
  ), r = Object.fromEntries(
987
987
  this.groupedBy.map((o) => {
988
- const a = this.variableMetadata[o], s = a?.type ?? "categorical", i = a?.valueFormat ?? Pe[s];
988
+ const a = this.variableMetadata[o], s = a?.type ?? "categorical", i = a?.valueFormat ?? Ne[s];
989
989
  return [o, { type: s, valueFormat: i }];
990
990
  })
991
991
  );
992
992
  for (const [o, { variableName: a, aggregation: s }] of Object.entries(t)) {
993
- const i = this.variableMetadata[a], c = i?.type ?? "numeric", l = i?.valueFormat ?? Pe[c], u = eo(s, c);
993
+ const i = this.variableMetadata[a], c = i?.type ?? "numeric", l = i?.valueFormat ?? Ne[c], u = eo(s, c);
994
994
  r[o] = { type: u, valueFormat: to(s, l) };
995
995
  }
996
996
  return M.fromTrusted(n, r);
@@ -999,7 +999,7 @@ class Xs {
999
999
  * Computes the group key based on the first value of the grouped variable. If multiple variables are grouped, returns a composite key.
1000
1000
  */
1001
1001
  getStableKey(t, n) {
1002
- return L(t.map((r) => r.get(n)));
1002
+ return k(t.map((r) => r.get(n)));
1003
1003
  }
1004
1004
  }
1005
1005
  function js(e, t, n) {
@@ -1011,7 +1011,7 @@ function js(e, t, n) {
1011
1011
  if (a.every((c) => Oa(c, o)) || o.type === "lookup") return o;
1012
1012
  const i = {};
1013
1013
  for (const [c, l] of t.entries()) {
1014
- const u = L([l]), d = r[c];
1014
+ const u = k([l]), d = r[c];
1015
1015
  d && d.type !== "lookup" && (i[u] = d);
1016
1016
  }
1017
1017
  return {
@@ -1048,7 +1048,7 @@ const ro = (e) => {
1048
1048
  if (Qs(e)) return "categorical";
1049
1049
  const t = e;
1050
1050
  throw new Error(`No data type found for value format: ${t.type}`);
1051
- }, Ne = {
1051
+ }, Pe = {
1052
1052
  k: 1e3,
1053
1053
  m: 1e6,
1054
1054
  b: 1e9,
@@ -1187,7 +1187,7 @@ const ro = (e) => {
1187
1187
  const i = Be(o, s.dateFormat, /* @__PURE__ */ new Date()), c = Be(a, s.dateFormat, /* @__PURE__ */ new Date());
1188
1188
  if (!U(i) || !U(c)) return !1;
1189
1189
  const l = new no(), u = l.incrementYearIfNeeded(i), d = l.incrementYearIfNeeded(c), m = Ra(d, u);
1190
- return Pa(new Date(u.getFullYear(), ci, li), {
1190
+ return Na(new Date(u.getFullYear(), ci, li), {
1191
1191
  start: u,
1192
1192
  end: d
1193
1193
  }) && m === ii ? !0 : m === si;
@@ -1350,7 +1350,7 @@ const ro = (e) => {
1350
1350
  let n = 1;
1351
1351
  for (const r of rn)
1352
1352
  if (new RegExp(`${r}$`, "i").test(t)) {
1353
- n = Ne[r], t = t.slice(0, -1);
1353
+ n = Pe[r], t = t.slice(0, -1);
1354
1354
  break;
1355
1355
  }
1356
1356
  return Number(t.split(",").join("")) * n;
@@ -1387,31 +1387,31 @@ class Ti extends re {
1387
1387
  return [t];
1388
1388
  }
1389
1389
  run(t) {
1390
- const n = t._metadata?.parsingLocale ?? nn, r = {}, o = Vi(t), a = Mi(t);
1390
+ const n = t._metadata?.parsingLocale ?? nn, r = {}, o = Li(t), a = Mi(t);
1391
1391
  for (const [s, i] of t.columns.entries()) {
1392
1392
  if (i._metadata?.isHidden) continue;
1393
1393
  const c = o.get(i.key);
1394
1394
  if (Ke(c)) continue;
1395
1395
  const l = s === a ? Ai : yi(c, n), u = io(l);
1396
- r[i.key] = Li(i.key, t.rows, l, u, n);
1396
+ r[i.key] = ki(i.key, t.rows, l, u, n);
1397
1397
  }
1398
1398
  return new M(r);
1399
1399
  }
1400
1400
  }
1401
1401
  const Mi = (e) => {
1402
- const t = ki(e.rows, 5);
1402
+ const t = Vi(e.rows, 5);
1403
1403
  return e.columns.findIndex((n) => {
1404
1404
  const r = t.map((o) => o[n.key]).filter((o) => !Ke(o));
1405
1405
  return r.length >= 2 && r.every(di);
1406
1406
  });
1407
- }, Li = (e, t, n, r, o) => {
1407
+ }, ki = (e, t, n, r, o) => {
1408
1408
  const a = new no(), s = t.reduce((i, c) => {
1409
1409
  if (ro(c)) return i;
1410
1410
  const l = bi(c[e], n, o);
1411
- return so(n) && P(l) ? i.push(a.incrementYearIfNeeded(l)) : i.push(l), i;
1411
+ return so(n) && N(l) ? i.push(a.incrementYearIfNeeded(l)) : i.push(l), i;
1412
1412
  }, []);
1413
1413
  return { type: r, values: s, valueFormat: n };
1414
- }, Vi = (e) => {
1414
+ }, Li = (e) => {
1415
1415
  const t = /* @__PURE__ */ new Map(), n = new Set(e.columns.map((r) => r.key));
1416
1416
  for (const r of e.rows) {
1417
1417
  for (const o of n) {
@@ -1422,7 +1422,7 @@ const Mi = (e) => {
1422
1422
  break;
1423
1423
  }
1424
1424
  return t;
1425
- }, ki = (e, t) => {
1425
+ }, Vi = (e, t) => {
1426
1426
  const n = [];
1427
1427
  for (const r of e)
1428
1428
  if (ro(r) || n.push(r), n.length === t)
@@ -1629,7 +1629,7 @@ class Ri extends Xe {
1629
1629
  return { data: t, mapping: {} };
1630
1630
  }
1631
1631
  }
1632
- class Pi extends Xe {
1632
+ class Ni extends Xe {
1633
1633
  constructor() {
1634
1634
  super(...arguments), this.type = "rule", this.positionChannels = [
1635
1635
  { axis: "x", role: "point", valueKind: "value" },
@@ -1652,7 +1652,7 @@ class Pi extends Xe {
1652
1652
  * time, e.g. `stat.mean()` on `y`) — it draws a single reference line on one axis.
1653
1653
  */
1654
1654
  validateMapping({ layerId: t, mapping: n, computedVariables: r }) {
1655
- const o = r.has("x") || k(te(n.x)), a = r.has("y") || k(te(n.y));
1655
+ const o = r.has("x") || V(te(n.x)), a = r.has("y") || V(te(n.y));
1656
1656
  return o && a ? [
1657
1657
  {
1658
1658
  code: "INVALID_RULE_MAPPING",
@@ -1670,15 +1670,15 @@ class Pi extends Xe {
1670
1670
  }
1671
1671
  const jn = (e, t) => {
1672
1672
  const n = te(e);
1673
- if (k(n)) return { value: n, sourceFormat: void 0 };
1673
+ if (V(n)) return { value: n, sourceFormat: void 0 };
1674
1674
  const r = v(e);
1675
1675
  if (r === null || !ls(r) || !t.hasVariable(r)) return null;
1676
1676
  const [o] = t.getValues(r);
1677
- return k(o) ? { value: o, sourceFormat: t.getValueFormat(r) } : null;
1677
+ return V(o) ? { value: o, sourceFormat: t.getValueFormat(r) } : null;
1678
1678
  };
1679
- class Ni extends Me {
1679
+ class Pi extends Me {
1680
1680
  constructor(t) {
1681
- super("geom"), this.register("bar", new _i()), this.register("point", new Ri()), this.register("line", new Di()), this.register("area", new Ii()), this.register("rule", new Pi());
1681
+ super("geom"), this.register("bar", new _i()), this.register("point", new Ri()), this.register("line", new Di()), this.register("area", new Ii()), this.register("rule", new Ni());
1682
1682
  for (const n of t?.geoms ?? [])
1683
1683
  this.register(n.type, n);
1684
1684
  }
@@ -1706,7 +1706,7 @@ class Oi {
1706
1706
  return { data: t.addConstantVariable(D.group, "categorical", null) };
1707
1707
  const o = t.size(), a = r.map((i) => t.getValues(i)), s = new Array(o);
1708
1708
  for (let i = 0; i < o; i++)
1709
- s[i] = L(a.map((c) => c[i]));
1709
+ s[i] = k(a.map((c) => c[i]));
1710
1710
  return { data: t.addVariable(D.group, "categorical", s) };
1711
1711
  }
1712
1712
  }
@@ -1888,7 +1888,7 @@ const Ct = (e) => {
1888
1888
  default:
1889
1889
  return null;
1890
1890
  }
1891
- }, Lo = {
1891
+ }, ko = {
1892
1892
  left: "right",
1893
1893
  right: "left",
1894
1894
  top: "bottom",
@@ -1898,7 +1898,7 @@ function nc(e, t) {
1898
1898
  const { scales: n, config: r, layers: o, coordSystem: a, variableLabels: s, geomCompiler: i } = e;
1899
1899
  if (a.type === "polar" && a.axisMapping.x.geometry !== "circular") return [];
1900
1900
  const c = oc(o, a.type, r, i), l = new Set(t.map((m) => m.position)), u = sc(
1901
- Vo(r.axes.y.position, a.axisMapping.y.position),
1901
+ Lo(r.axes.y.position, a.axisMapping.y.position),
1902
1902
  l
1903
1903
  ), d = [];
1904
1904
  for (const m of To) {
@@ -1956,7 +1956,7 @@ function ac(e, t, n, r) {
1956
1956
  case "x":
1957
1957
  return {
1958
1958
  axisConfig: t.axes[e],
1959
- position: Vo(t.axes[e].position, n[e].position)
1959
+ position: Lo(t.axes[e].position, n[e].position)
1960
1960
  };
1961
1961
  case "y":
1962
1962
  return {
@@ -1964,7 +1964,7 @@ function ac(e, t, n, r) {
1964
1964
  position: r
1965
1965
  };
1966
1966
  case "ySecondary": {
1967
- const o = Lo[r], a = Ae(
1967
+ const o = ko[r], a = Ae(
1968
1968
  {
1969
1969
  isVisible: t.axes.y.isVisible,
1970
1970
  label: null,
@@ -1981,11 +1981,11 @@ function ac(e, t, n, r) {
1981
1981
  }
1982
1982
  }
1983
1983
  }
1984
- function Vo(e, t) {
1984
+ function Lo(e, t) {
1985
1985
  return Qn.has(e) === Qn.has(t) ? e : t;
1986
1986
  }
1987
1987
  function sc(e, t) {
1988
- return t.has(e) ? Lo[e] : e;
1988
+ return t.has(e) ? ko[e] : e;
1989
1989
  }
1990
1990
  function ic(e, t, n) {
1991
1991
  const { gridVisible: r } = n === "x" ? t.x : t.y;
@@ -1995,7 +1995,7 @@ const cc = (e, t) => {
1995
1995
  if (e.spec.scaleType === "continuous") {
1996
1996
  const r = /* @__PURE__ */ new Set(), o = [];
1997
1997
  for (let a = 1; a <= ec; a++) {
1998
- const s = e.generateTicks({ count: a }), i = L(s);
1998
+ const s = e.generateTicks({ count: a }), i = k(s);
1999
1999
  r.has(i) || (r.add(i), o.push({ ticks: s.map((c) => ht(e, c)) }));
2000
2000
  }
2001
2001
  return o;
@@ -2003,11 +2003,11 @@ const cc = (e, t) => {
2003
2003
  return e.spec.scaleType === "datetime" ? lc(e, t) : [{ ticks: e.generateTicks().map((r) => ht(e, r)) }];
2004
2004
  }, lc = (e, t) => {
2005
2005
  const [n, r] = e.domain;
2006
- if (!P(n) || !P(r))
2006
+ if (!N(n) || !N(r))
2007
2007
  return [{ ticks: e.generateTicks().map((c) => ht(e, c)) }];
2008
2008
  const o = /* @__PURE__ */ new Set(), a = [], s = (i, c) => {
2009
2009
  if (i.length === 0) return;
2010
- const l = L(i);
2010
+ const l = k(i);
2011
2011
  o.has(l) || (o.add(l), a.push({
2012
2012
  ticks: i.map((u) => ht(e, u)),
2013
2013
  valueFormat: c
@@ -2020,7 +2020,7 @@ const cc = (e, t) => {
2020
2020
  function Ue(e, t) {
2021
2021
  return t.type === "polar" && e === "square" ? "slice" : e;
2022
2022
  }
2023
- function ko({
2023
+ function Vo({
2024
2024
  scale: e,
2025
2025
  aesthetics: t,
2026
2026
  layers: n,
@@ -2057,11 +2057,11 @@ function Eo({
2057
2057
  const i = v(a.mapping[s]);
2058
2058
  if (!(i === null || !a.data.hasVariable(i)))
2059
2059
  for (const c of a.data.getValues(i, { distinct: !0 })) {
2060
- const l = L(c);
2060
+ const l = k(c);
2061
2061
  r.has(l) || r.set(l, { layer: a, layerIndex: o });
2062
2062
  }
2063
2063
  }
2064
- return (o) => r.get(L(o));
2064
+ return (o) => r.get(k(o));
2065
2065
  }
2066
2066
  const un = (e) => {
2067
2067
  if (e.kind === "identity") return !1;
@@ -2080,7 +2080,7 @@ function dc({ scales: e, layers: t, coordSystem: n, valueLabels: r }) {
2080
2080
  isMergedWithAnotherAesthetic: mc(e, t, a)
2081
2081
  })) return [];
2082
2082
  const i = o.spec.scaleType, c = t.findIndex((u) => h(u.mapping.color));
2083
- return ko({ scale: o, aesthetics: ["color"], layers: t, coordSystem: n }).map(({ value: u, swatchShape: d, owner: m }) => {
2083
+ return Vo({ scale: o, aesthetics: ["color"], layers: t, coordSystem: n }).map(({ value: u, swatchShape: d, owner: m }) => {
2084
2084
  const p = m?.layerIndex ?? c, f = t[p], y = f ? v(f.mapping.color) : null;
2085
2085
  return {
2086
2086
  value: u,
@@ -2138,8 +2138,8 @@ function fc(e, t, n, r) {
2138
2138
  }
2139
2139
  function Jn(e, t, n) {
2140
2140
  if (n === null || t === null) return [...e];
2141
- const r = L(n);
2142
- return e.filter((o, a) => L(t[a] ?? null) === r);
2141
+ const r = k(n);
2142
+ return e.filter((o, a) => k(t[a] ?? null) === r);
2143
2143
  }
2144
2144
  const hc = (e, t) => {
2145
2145
  switch (t) {
@@ -2241,14 +2241,14 @@ function Ac(e, t) {
2241
2241
  function Tc(e, t) {
2242
2242
  return t === null || !["numeric", "temporal"].includes(e.getType(t)) ? e : e.orderBy(t);
2243
2243
  }
2244
- const Mc = ["point", "line", "area", "bar", "rule"], Lc = new Set(Mc);
2245
- function Vc(e) {
2246
- return Lc.has(e);
2244
+ const Mc = ["point", "line", "area", "bar", "rule"], kc = new Set(Mc);
2245
+ function Lc(e) {
2246
+ return kc.has(e);
2247
2247
  }
2248
2248
  function X(e) {
2249
2249
  return e === "stack" || e === "fill";
2250
2250
  }
2251
- const kc = 3;
2251
+ const Vc = 3;
2252
2252
  function Ec({
2253
2253
  scales: e,
2254
2254
  config: t,
@@ -2259,7 +2259,7 @@ function Ec({
2259
2259
  geomCompiler: s
2260
2260
  }) {
2261
2261
  if (t.legend.position === "none") return [];
2262
- const i = new Map(a.map((b) => [L(b.value), b])), c = Fc({ scales: e, layers: n, geomCompiler: s }), l = Nc(c), u = le(n, "x"), d = l.map((b) => {
2262
+ const i = new Map(a.map((b) => [k(b.value), b])), c = Fc({ scales: e, layers: n, geomCompiler: s }), l = Pc(c), u = le(n, "x"), d = l.map((b) => {
2263
2263
  if (Rc(b, u, n)) return null;
2264
2264
  const S = Bc({ group: b, variableLabels: o, layers: n, coordSystem: r, colorGroupsByValue: i });
2265
2265
  return S.items.length === 0 ? null : { group: b, built: S };
@@ -2315,15 +2315,15 @@ function Rc(e, t, n) {
2315
2315
  return r.scaleAestheticKey !== "color" ? !1 : Io({
2316
2316
  colorVariableName: r.variableName,
2317
2317
  xVariableName: t,
2318
- mapsColorAcrossMultipleLayers: Pc(r.scaleAestheticKey, n),
2318
+ mapsColorAcrossMultipleLayers: Nc(r.scaleAestheticKey, n),
2319
2319
  isMergedWithAnotherAesthetic: e.length > 1
2320
2320
  });
2321
2321
  }
2322
- function Pc(e, t) {
2322
+ function Nc(e, t) {
2323
2323
  const n = z(e);
2324
2324
  return t.filter((r) => h(r.mapping[n])).length > 1;
2325
2325
  }
2326
- function Nc(e) {
2326
+ function Pc(e) {
2327
2327
  const t = /* @__PURE__ */ new Map();
2328
2328
  for (const n of e) {
2329
2329
  const r = Xc(n), o = t.get(r);
@@ -2349,7 +2349,7 @@ function Bc({
2349
2349
  coordSystem: r,
2350
2350
  colorGroupsByValue: o
2351
2351
  }) {
2352
- const a = e[0], s = e.map((u) => z(u.scaleAestheticKey)), i = ko({ scale: a.scale, aesthetics: s, layers: n, coordSystem: r }), c = ln(a.variableName, t), l = ue({
2352
+ const a = e[0], s = e.map((u) => z(u.scaleAestheticKey)), i = Vo({ scale: a.scale, aesthetics: s, layers: n, coordSystem: r }), c = ln(a.variableName, t), l = ue({
2353
2353
  layers: n,
2354
2354
  scaleType: a.scale.spec.scaleType,
2355
2355
  variableName: a.variableName
@@ -2375,11 +2375,11 @@ function $c(e, t, n, r, o) {
2375
2375
  };
2376
2376
  }
2377
2377
  function Gc(e, t, n) {
2378
- return e[0].scaleAestheticKey !== "color" ? null : n.get(L(t.value))?.label ?? null;
2378
+ return e[0].scaleAestheticKey !== "color" ? null : n.get(k(t.value))?.label ?? null;
2379
2379
  }
2380
2380
  function Uc(e, t, n, r, o) {
2381
2381
  if (t[0].scaleAestheticKey === "color")
2382
- return o.get(L(e.value))?.valueFormat ?? r;
2382
+ return o.get(k(e.value))?.valueFormat ?? r;
2383
2383
  const a = e.owner?.layer, s = Wc(a, n);
2384
2384
  return a === void 0 || s === null ? r : ue({
2385
2385
  layers: [a],
@@ -2405,7 +2405,7 @@ function Yc(e, t, n) {
2405
2405
  function Hc(e, t, n, r) {
2406
2406
  if (e !== "auto") return e;
2407
2407
  if (r.type === "polar") return "top";
2408
- const o = it(n, ["line", "area"]), a = it(n, ["bar"]), s = it(n, ["bar"], (c) => X(c.position)), i = t >= kc;
2408
+ const o = it(n, ["line", "area"]), a = it(n, ["bar"]), s = it(n, ["bar"], (c) => X(c.position)), i = t >= Vc;
2409
2409
  return o && a ? "top" : o ? i ? "right" : "top" : s ? Co(r) ? "top" : i ? "right" : "top" : "top";
2410
2410
  }
2411
2411
  function Kc(e, t) {
@@ -2431,7 +2431,7 @@ function it(e, t, n) {
2431
2431
  return e.some((r) => t.includes(r.geom) && (n?.(r) ?? !0));
2432
2432
  }
2433
2433
  function Xc(e) {
2434
- const t = e.scale.domain.map(L);
2434
+ const t = e.scale.domain.map(k);
2435
2435
  return JSON.stringify([e.variableName, e.guideType, ...t]);
2436
2436
  }
2437
2437
  function jc(e, t) {
@@ -2494,9 +2494,9 @@ class Qc extends re {
2494
2494
  };
2495
2495
  }
2496
2496
  }
2497
- const Zc = (e, t) => e?.kind !== "perGroup" || t.some((r) => r.display === "direct") ? t : [], dn = (e) => e[Qr.key], Jc = (e) => L([Ye(e)]), mn = (e, t) => {
2497
+ const Zc = (e, t) => e?.kind !== "perGroup" || t.some((r) => r.display === "direct") ? t : [], dn = (e) => e[Qr.key], Jc = (e) => k([Ye(e)]), mn = (e, t) => {
2498
2498
  const n = t !== null ? e[t] ?? null : null;
2499
- return L([n]);
2499
+ return k([n]);
2500
2500
  }, j = (e, t) => {
2501
2501
  const n = te(t);
2502
2502
  if (n !== void 0) return () => n;
@@ -2506,16 +2506,16 @@ const Zc = (e, t) => e?.kind !== "perGroup" || t.some((r) => r.display === "dire
2506
2506
  if (a === void 0) return null;
2507
2507
  switch (e.getType(r)) {
2508
2508
  case "numeric":
2509
- return k(a) ? a : null;
2509
+ return V(a) ? a : null;
2510
2510
  case "categorical":
2511
2511
  return He(a) ? a : null;
2512
2512
  case "temporal":
2513
- return P(a) ? a : null;
2513
+ return N(a) ? a : null;
2514
2514
  default:
2515
2515
  return null;
2516
2516
  }
2517
2517
  } : () => null;
2518
- }, Fo = (e, t) => j(e, t.x), el = (e, t) => j(e, t.y), ky = (e, t) => j(e, t.label), tl = (e, t) => j(e, t.color), Ey = (e, t) => j(e, t.size), Iy = (e, t) => j(e, t.alpha), Cy = (e, t) => j(e, t.group), Fy = (e, t) => j(e, t.strokeWidth), tr = { variable: g.yRaw };
2518
+ }, Fo = (e, t) => j(e, t.x), el = (e, t) => j(e, t.y), Iy = (e, t) => j(e, t.label), tl = (e, t) => j(e, t.color), Cy = (e, t) => j(e, t.size), Fy = (e, t) => j(e, t.alpha), _y = (e, t) => j(e, t.group), Dy = (e, t) => j(e, t.strokeWidth), tr = { variable: g.yRaw };
2519
2519
  function Mt(e, t) {
2520
2520
  return X(e) ? tr : t.y ?? tr;
2521
2521
  }
@@ -2617,14 +2617,14 @@ function ol(e) {
2617
2617
  }
2618
2618
  function fe(e, t) {
2619
2619
  if (e === null || t === null) return "incomparable";
2620
- if (P(e) && P(t)) {
2620
+ if (N(e) && N(t)) {
2621
2621
  const n = e.getTime(), r = t.getTime();
2622
2622
  return n < r ? "less" : n > r ? "greater" : "equal";
2623
2623
  }
2624
- return k(e) && k(t) ? e < t ? "less" : e > t ? "greater" : "equal" : "incomparable";
2624
+ return V(e) && V(t) ? e < t ? "less" : e > t ? "greater" : "equal" : "incomparable";
2625
2625
  }
2626
2626
  function rr(e, t) {
2627
- return e === t ? !0 : P(e) && P(t) ? e.getTime() === t.getTime() : !1;
2627
+ return e === t ? !0 : N(e) && N(t) ? e.getTime() === t.getTime() : !1;
2628
2628
  }
2629
2629
  function ee(e, t, n) {
2630
2630
  return t !== "temporal" || !He(e) ? e : an(e, void 0, n);
@@ -2688,21 +2688,21 @@ function il({
2688
2688
  }
2689
2689
  if (y.size === 0 && b.size === 0 && !S)
2690
2690
  return Do();
2691
- const w = new Uint8Array(u), V = [];
2691
+ const w = new Uint8Array(u), L = [];
2692
2692
  let E = 0;
2693
2693
  for (let T = 0; T < u; T++) {
2694
- const q = d?.[T], ae = m?.[T], Qe = q !== void 0 && y.has(q), Ze = ae !== void 0 && b.has(ae), Nn = f[T] === 1;
2694
+ const q = d?.[T], ae = m?.[T], Qe = q !== void 0 && y.has(q), Ze = ae !== void 0 && b.has(ae), Pn = f[T] === 1;
2695
2695
  if (r === "observation-rerender")
2696
- (Qe || Nn || Ze) && (w[T] = 1, E++);
2696
+ (Qe || Pn || Ze) && (w[T] = 1, E++);
2697
2697
  else if (Qe)
2698
2698
  w[T] = 1, E++;
2699
- else if (Nn || Ze) {
2699
+ else if (Pn || Ze) {
2700
2700
  const On = p?.[T];
2701
- On !== void 0 && V.push({ observation: On, observationIndex: T });
2701
+ On !== void 0 && L.push({ observation: On, observationIndex: T });
2702
2702
  }
2703
2703
  }
2704
2704
  const W = E > 0 ? { ...e, data: e.data.filterByMask(w) } : null;
2705
- return { isDimmed: (r === "observation-rerender" || y.size > 0) && W !== null, matchedLayer: W, overlayCandidates: V };
2705
+ return { isDimmed: (r === "observation-rerender" || y.size > 0) && W !== null, matchedLayer: W, overlayCandidates: L };
2706
2706
  }
2707
2707
  function cl(e, t) {
2708
2708
  const n = v(e.mapping.y), r = _o(e);
@@ -2793,7 +2793,7 @@ function hl(e) {
2793
2793
  }
2794
2794
  return !0;
2795
2795
  }
2796
- const yl = (e) => e.kind === "index" ? (t, n) => String(n) : (t) => L(e.variables.map((n) => t[n])), gl = (e, t) => {
2796
+ const yl = (e) => e.kind === "index" ? (t, n) => String(n) : (t) => k(e.variables.map((n) => t[n])), gl = (e, t) => {
2797
2797
  if (e === "index")
2798
2798
  return { kind: "index" };
2799
2799
  const n = v(t.x);
@@ -2869,7 +2869,7 @@ class vl extends Te {
2869
2869
  function ar(e) {
2870
2870
  return e.scales.some((t) => t.scaledAesthetic === "x" && t.scaleType === "discrete");
2871
2871
  }
2872
- class Po extends Error {
2872
+ class No extends Error {
2873
2873
  constructor(t) {
2874
2874
  const n = t.map((r) => `- ${r.message}`).join(`
2875
2875
  `);
@@ -2898,7 +2898,7 @@ class xl {
2898
2898
  );
2899
2899
  }
2900
2900
  if (n.length > 0)
2901
- throw new Po(n);
2901
+ throw new No(n);
2902
2902
  }
2903
2903
  }
2904
2904
  class Sl {
@@ -2984,7 +2984,7 @@ class Sl {
2984
2984
  }
2985
2985
  const sr = A("__ungrouped__"), wl = (e, t) => t === null ? !0 : e.some(
2986
2986
  (n) => n.axis === t.axis && n.role === t.role && n.valueKind === t.valueKind
2987
- ), No = (e, t, n = "y") => {
2987
+ ), Po = (e, t, n = "y") => {
2988
2988
  const r = n === "y" ? "x" : "y", o = v(t[n]), a = v(t[r]);
2989
2989
  if (!o || !a)
2990
2990
  return null;
@@ -3010,7 +3010,7 @@ class Al {
3010
3010
  return wl(n, a) ? o.adjust(r) : { data: r.data, mapping: {} };
3011
3011
  }
3012
3012
  }
3013
- class Lt {
3013
+ class kt {
3014
3014
  /**
3015
3015
  * The single position channel this adjuster reads to compute the adjustment, expressed in the
3016
3016
  * geom-agnostic channel vocabulary. A geom is adjuster-compatible only when its manifest declares
@@ -3021,7 +3021,7 @@ class Lt {
3021
3021
  return null;
3022
3022
  }
3023
3023
  }
3024
- class Tl extends Lt {
3024
+ class Tl extends kt {
3025
3025
  constructor() {
3026
3026
  super(...arguments), this.type = "dodge";
3027
3027
  }
@@ -3049,7 +3049,7 @@ class Tl extends Lt {
3049
3049
  return { data: t.addVariable(g.xMin, "numeric", d).addVariable(g.xMax, "numeric", m), mapping: {} };
3050
3050
  }
3051
3051
  }
3052
- class Ml extends Lt {
3052
+ class Ml extends kt {
3053
3053
  constructor() {
3054
3054
  super(...arguments), this.type = "fill";
3055
3055
  }
@@ -3057,7 +3057,7 @@ class Ml extends Lt {
3057
3057
  return { axis: t, role: "point", valueKind: "value" };
3058
3058
  }
3059
3059
  adjust({ data: t, mapping: n, axis: r = "y" }) {
3060
- const o = No(t, n, r);
3060
+ const o = Po(t, n, r);
3061
3061
  if (o === null)
3062
3062
  return { data: t, mapping: {} };
3063
3063
  const { values: a, observationIndexByPartitionAndGroup: s, uniqueGroupKeys: i, observationCount: c } = o, l = [...a], u = new Array(c).fill(0);
@@ -3079,12 +3079,12 @@ class Ml extends Lt {
3079
3079
  u[x] = null, l[x] = null;
3080
3080
  continue;
3081
3081
  }
3082
- const V = w >= 0 ? p : f;
3083
- if (V === 0) {
3082
+ const L = w >= 0 ? p : f;
3083
+ if (L === 0) {
3084
3084
  u[x] = 0, l[x] = 0;
3085
3085
  continue;
3086
3086
  }
3087
- const E = w / V;
3087
+ const E = w / L;
3088
3088
  w >= 0 ? (u[x] = y, l[x] = y += E) : (l[x] = b, u[x] = b += E);
3089
3089
  }
3090
3090
  }
@@ -3092,7 +3092,7 @@ class Ml extends Lt {
3092
3092
  return r === "y" && (d = d.addVariable(g.yRaw, "numeric", a)), { data: d, mapping: {} };
3093
3093
  }
3094
3094
  }
3095
- class Ll extends Lt {
3095
+ class kl extends kt {
3096
3096
  constructor() {
3097
3097
  super(...arguments), this.type = "identity";
3098
3098
  }
@@ -3103,7 +3103,7 @@ class Ll extends Lt {
3103
3103
  };
3104
3104
  }
3105
3105
  }
3106
- class Vl extends Lt {
3106
+ class Ll extends kt {
3107
3107
  constructor() {
3108
3108
  super(...arguments), this.type = "stack";
3109
3109
  }
@@ -3111,7 +3111,7 @@ class Vl extends Lt {
3111
3111
  return { axis: t, role: "point", valueKind: "value" };
3112
3112
  }
3113
3113
  adjust({ data: t, mapping: n, axis: r = "y" }) {
3114
- const o = No(t, n, r);
3114
+ const o = Po(t, n, r);
3115
3115
  if (o === null)
3116
3116
  return { data: t, mapping: {} };
3117
3117
  const { values: a, observationIndexByPartitionAndGroup: s, uniqueGroupKeys: i, observationCount: c } = o, l = [...a], u = new Array(c).fill(0);
@@ -3136,9 +3136,9 @@ class Vl extends Lt {
3136
3136
  return m !== null && (d = d.addVariable(m, "numeric", l)), { data: d, mapping: {} };
3137
3137
  }
3138
3138
  }
3139
- class kl extends Me {
3139
+ class Vl extends Me {
3140
3140
  constructor() {
3141
- super("position"), this.register("identity", new Ll()), this.register("stack", new Vl()), this.register("fill", new Ml()), this.register("dodge", new Tl());
3141
+ super("position"), this.register("identity", new kl()), this.register("stack", new Ll()), this.register("fill", new Ml()), this.register("dodge", new Tl());
3142
3142
  }
3143
3143
  }
3144
3144
  function El(e) {
@@ -3204,11 +3204,11 @@ function Rl(e, t, n, r, o) {
3204
3204
  }
3205
3205
  return t.addVariable(r, "numeric", d).addVariable(o, "numeric", m);
3206
3206
  }
3207
- function Pl(e, t) {
3207
+ function Nl(e, t) {
3208
3208
  const n = e[t];
3209
3209
  return n?.kind === "position" ? n : null;
3210
3210
  }
3211
- class Nl extends Te {
3211
+ class Pl extends Te {
3212
3212
  constructor(t) {
3213
3213
  super(), this.geomRegistry = t;
3214
3214
  }
@@ -3221,7 +3221,7 @@ class Nl extends Te {
3221
3221
  data: t.data,
3222
3222
  mapping: t.mapping,
3223
3223
  yScaleType: t.yScaleType,
3224
- getPositionScale: (a) => Pl(n.scales, a)
3224
+ getPositionScale: (a) => Nl(n.scales, a)
3225
3225
  });
3226
3226
  return { ...t, data: o };
3227
3227
  }
@@ -3270,7 +3270,7 @@ class Ol extends re {
3270
3270
  }
3271
3271
  }
3272
3272
  if (n.length > 0)
3273
- throw new Po(n);
3273
+ throw new No(n);
3274
3274
  }
3275
3275
  /**
3276
3276
  * Walk all layers' mappings and collect data values per scale aesthetic key.
@@ -3431,7 +3431,7 @@ class Gl extends qe {
3431
3431
  });
3432
3432
  }
3433
3433
  }
3434
- const Ul = (e) => e.length === 2 && P(e[0]) && P(e[1]), he = {
3434
+ const Ul = (e) => e.length === 2 && N(e[0]) && N(e[1]), he = {
3435
3435
  transform: "linear",
3436
3436
  reverse: !1,
3437
3437
  nice: !0,
@@ -3689,7 +3689,7 @@ const Kl = ["grey", "red", "orange", "yellow", "green", "cyan", "blue", "purple"
3689
3689
  7: [900, 800, 700, 600, 500, 400, 300],
3690
3690
  default: [900, 800, 700, 600, 500, 400, 300, 200]
3691
3691
  }
3692
- }, N = {
3692
+ }, P = {
3693
3693
  cyan: "#22D3EE",
3694
3694
  pink: "#F377EF",
3695
3695
  purple: "#6528F7",
@@ -3699,19 +3699,19 @@ const Kl = ["grey", "red", "orange", "yellow", "green", "cyan", "blue", "purple"
3699
3699
  green: "#06FF00",
3700
3700
  blue: "#0079FF"
3701
3701
  }, tt = [
3702
- N.cyan,
3703
- N.pink,
3704
- N.purple,
3705
- N.red,
3706
- N.orange,
3707
- N.yellow,
3708
- N.green,
3709
- N.blue
3702
+ P.cyan,
3703
+ P.pink,
3704
+ P.purple,
3705
+ P.red,
3706
+ P.orange,
3707
+ P.yellow,
3708
+ P.green,
3709
+ P.blue
3710
3710
  ], Ql = [
3711
- N.cyan,
3712
- N.green,
3713
- N.red,
3714
- N.cyan
3711
+ P.cyan,
3712
+ P.green,
3713
+ P.red,
3714
+ P.cyan
3715
3715
  ], nt = {
3716
3716
  start: "#84D1FC",
3717
3717
  positive: "#84FC89",
@@ -3727,7 +3727,7 @@ function Jl(e, t = "light", n) {
3727
3727
  return ((n !== void 0 ? cr[t][n] : void 0) ?? cr[t].default).map((o) => qt[`${e}${o}`]);
3728
3728
  }
3729
3729
  function eu(e) {
3730
- const t = tt.indexOf(N[e]);
3730
+ const t = tt.indexOf(P[e]);
3731
3731
  return t <= 0 ? tt : [...tt.slice(t), ...tt.slice(0, t)];
3732
3732
  }
3733
3733
  function tu(e, t) {
@@ -3941,7 +3941,7 @@ const lr = "#%_ENCODED_%#", $o = (e) => {
3941
3941
  break;
3942
3942
  }
3943
3943
  case "arrow": {
3944
- a.push(Lu(d));
3944
+ a.push(ku(d));
3945
3945
  break;
3946
3946
  }
3947
3947
  case "highlight":
@@ -4004,7 +4004,7 @@ const lr = "#%_ENCODED_%#", $o = (e) => {
4004
4004
  }, Mu = (e, t, n) => {
4005
4005
  const r = yt({ dataset: n, input: e, anchorVariable: t });
4006
4006
  return r === null ? null : e.caption === null || e.caption === void 0 ? { kind: "pinnedNumber", value: { id: e.id, anchor: r } } : { kind: "comment", value: { id: e.id, anchor: r, content: e.caption } };
4007
- }, Lu = (e) => ({
4007
+ }, ku = (e) => ({
4008
4008
  id: e.id,
4009
4009
  start: { x: e.startX, y: e.startY },
4010
4010
  end: { x: e.endX, y: e.endY },
@@ -4020,9 +4020,9 @@ const lr = "#%_ENCODED_%#", $o = (e) => {
4020
4020
  anchorVariable: n
4021
4021
  }) => {
4022
4022
  if (!h(t) || !h(t.columnKey)) return null;
4023
- const r = Vu(t, n, e);
4023
+ const r = Lu(t, n, e);
4024
4024
  return r === null ? null : { anchorValue: r, groupValue: $o(t.columnKey) };
4025
- }, Vu = (e, t, n) => e.rowValue !== void 0 ? e.rowValue : t === null || !h(e.rowIndex) || !n.hasVariable(t) ? null : n.getValues(t)[e.rowIndex] ?? null, ku = [
4025
+ }, Lu = (e, t, n) => e.rowValue !== void 0 ? e.rowValue : t === null || !h(e.rowIndex) || !n.hasVariable(t) ? null : n.getValues(t)[e.rowIndex] ?? null, Vu = [
4026
4026
  "lilac",
4027
4027
  "neon_pink",
4028
4028
  "blackberry",
@@ -4054,7 +4054,7 @@ function _u(e) {
4054
4054
  }).config;
4055
4055
  }
4056
4056
  function Du(e, t) {
4057
- const n = Nu(e?.border), r = e?.hasRoundedCorners === !1 ? 0 : void 0, o = Ru(e, t), a = {};
4057
+ const n = Pu(e?.border), r = e?.hasRoundedCorners === !1 ? 0 : void 0, o = Ru(e, t), a = {};
4058
4058
  return e?.textScale !== void 0 && (a.textScale = e.textScale), n !== void 0 && (a.border = n), r !== void 0 && (a.cornerRadius = r), o !== void 0 && (a.background = o), e?.highlightStyle !== void 0 && (a.highlightStyle = e.highlightStyle === "grey" ? "desaturate" : "dim"), Object.keys(a).length > 0 ? a : void 0;
4059
4059
  }
4060
4060
  function Ru(e, t) {
@@ -4064,15 +4064,15 @@ function Ru(e, t) {
4064
4064
  if (typeof n == "string")
4065
4065
  return { type: "solid", color: n };
4066
4066
  }
4067
- const Pu = (e) => ku.includes(e);
4068
- function Nu(e) {
4067
+ const Nu = (e) => Vu.includes(e);
4068
+ function Pu(e) {
4069
4069
  if (!e?.style) return;
4070
4070
  if (e.style === "none") return { type: "none" };
4071
4071
  const t = e.width ?? 0;
4072
4072
  if (e.style === "grey")
4073
4073
  return { type: "solid", color: Iu, width: t };
4074
4074
  if (e.style === "preset")
4075
- return e.color === void 0 || !Pu(e.color) ? void 0 : { type: "preset", preset: e.color, width: t };
4075
+ return e.color === void 0 || !Nu(e.color) ? void 0 : { type: "preset", preset: e.color, width: t };
4076
4076
  if (e.color !== void 0)
4077
4077
  return e.style === "custom" ? { type: "solid", color: e.color, width: t } : { type: e.style, color: e.color, width: t };
4078
4078
  }
@@ -4131,10 +4131,11 @@ function Yu(e) {
4131
4131
  }
4132
4132
  const O = {
4133
4133
  /**
4134
- * Standard cartesian (x-y) coordinate system. This is the default if no coord is specified.
4134
+ * Standard cartesian (x→horizontal, y→vertical) coordinate system. This is the default
4135
+ * when no coord is piped onto the spec; declare it explicitly only to set axis limits.
4135
4136
  *
4136
4137
  * @example coord.cartesian() // auto-scaled axes
4137
- * @example coord.cartesian({ yLimits: [0, 100] }) // fixed y-axis
4138
+ * @example coord.cartesian({ yLimits: [0, 100] }) // fixed y-axis range
4138
4139
  */
4139
4140
  cartesian: (e = {}) => ({
4140
4141
  type: "coord",
@@ -4142,10 +4143,11 @@ const O = {
4142
4143
  params: e
4143
4144
  }),
4144
4145
  /**
4145
- * Flipped cartesian coordinates — swaps x and y axes.
4146
- * Useful for horizontal bar charts or when category labels are long.
4146
+ * Flipped cartesian coordinates — swaps the x and y axes so the x aesthetic runs
4147
+ * vertically and y runs horizontally. The idiom for horizontal bar charts and for
4148
+ * long category labels. The mapping stays the same; only the on-screen orientation flips.
4147
4149
  *
4148
- * @example coord.flip() // horizontal bars
4150
+ * @example coord.flip() // horizontal bars from a vertical-bar spec
4149
4151
  */
4150
4152
  flip: (e = {}) => ({
4151
4153
  type: "coord",
@@ -4153,11 +4155,18 @@ const O = {
4153
4155
  params: e
4154
4156
  }),
4155
4157
  /**
4156
- * Polar coordinate system — maps data to angle (theta) and radius.
4157
- * Used for pie charts, donut charts, and radar/radial visualizations.
4158
+ * Polar coordinate system — wraps the scaled positions around a centre, mapping one
4159
+ * aesthetic to the angle (theta) and the other to the radius (scaled into
4160
+ * `[innerRadius, 1]`). `theta` defaults to `'x'`.
4161
+ *
4162
+ * - Pie / donut: `geom.bar({ position: 'fill' })` with `theta: 'y'` (stacked value → angle);
4163
+ * set `innerRadius > 0` for a donut.
4164
+ * - Radar / spider: `geom.line` or `geom.point` with `theta: 'x'` over a discrete x axis
4165
+ * (one evenly-spaced spoke per category).
4158
4166
  *
4159
- * @example coord.polar() // pie chart
4160
- * @example coord.polar({ innerRadius: 0.5 }) // donut chart
4167
+ * @example coord.polar({ theta: 'y' }) // pie: stacked value → angle
4168
+ * @example coord.polar({ theta: 'y', innerRadius: 0.5, startAngle: 90 }) // donut rotated 90°
4169
+ * @example coord.polar({ theta: 'x' }) // radar: category → spoke angle
4161
4170
  */
4162
4171
  polar: (e = {}) => ({
4163
4172
  type: "coord",
@@ -4203,7 +4212,7 @@ const O = {
4203
4212
  lineType: "dashed",
4204
4213
  labelPosition: "start"
4205
4214
  }
4206
- }, Le = "primary";
4215
+ }, ke = "primary";
4207
4216
  function Ku(e, t) {
4208
4217
  const n = { ...Hu };
4209
4218
  return e === "bar" && t === "polar" && (n.format = "percentage"), n;
@@ -4652,9 +4661,9 @@ function id(e, t, n) {
4652
4661
  id: e
4653
4662
  };
4654
4663
  if (e?.startsWith("preset:pastel"))
4655
- return { type: "pastel", variant: Pt(t) };
4664
+ return { type: "pastel", variant: Nt(t) };
4656
4665
  if (e?.startsWith("preset:graphy"))
4657
- return { type: "graphy", variant: Pt(t) };
4666
+ return { type: "graphy", variant: Nt(t) };
4658
4667
  const i = "preset:mono:";
4659
4668
  if (e?.startsWith(i)) {
4660
4669
  const l = e.slice(i.length);
@@ -4663,13 +4672,13 @@ function id(e, t, n) {
4663
4672
  const c = "preset:neon:";
4664
4673
  if (e?.startsWith(c)) {
4665
4674
  const l = e.slice(c.length);
4666
- if (ld(l)) return { type: "neon", base: l, variant: Pt(t) };
4675
+ if (ld(l)) return { type: "neon", base: l, variant: Nt(t) };
4667
4676
  }
4668
4677
  return {
4669
4678
  type: "default"
4670
4679
  };
4671
4680
  }
4672
- function Pt(e) {
4681
+ function Nt(e) {
4673
4682
  if (e === "waterfall")
4674
4683
  return "waterfall";
4675
4684
  }
@@ -4828,7 +4837,7 @@ function vd(e) {
4828
4837
  const t = {};
4829
4838
  return e.showDataLabels !== void 0 && (t.showDataLabels = e.showDataLabels), e.dataLabelFormat !== void 0 && (t.format = e.dataLabelFormat), e.showStackTotals !== void 0 && (t.showStackTotals = e.showStackTotals), e.showCategoryLabels !== void 0 && (t.showCategoryLabels = e.showCategoryLabels), Object.keys(t).length === 0 ? void 0 : t;
4830
4839
  }
4831
- const Nt = {
4840
+ const Pt = {
4832
4841
  color: null,
4833
4842
  size: "small",
4834
4843
  labelCrossPosition: 0.5
@@ -4851,12 +4860,12 @@ const Nt = {
4851
4860
  hasStickerStyle: !1
4852
4861
  }, xd = (e, t) => ({
4853
4862
  differenceArrows: (e?.differenceArrows ?? []).map((n) => Td(n, t)),
4854
- shapes: (e?.shapes ?? []).map(kd),
4863
+ shapes: (e?.shapes ?? []).map(Vd),
4855
4864
  freeformArrows: (e?.freeformArrows ?? []).map(Ed),
4856
4865
  textAnnotations: (e?.textAnnotations ?? []).map(Ad),
4857
4866
  stickers: (e?.stickers ?? []).map((n) => Md(n, t)),
4858
- pinnedNumbers: (e?.pinnedNumbers ?? []).map((n) => Ld(n, t)),
4859
- comments: (e?.comments ?? []).map((n) => Vd(n, t)),
4867
+ pinnedNumbers: (e?.pinnedNumbers ?? []).map((n) => kd(n, t)),
4868
+ comments: (e?.comments ?? []).map((n) => Ld(n, t)),
4860
4869
  custom: (e?.custom ?? []).map((n) => Sd(n, t))
4861
4870
  }), Sd = (e, t) => ({
4862
4871
  id: e.id ?? crypto.randomUUID(),
@@ -4877,9 +4886,9 @@ const Nt = {
4877
4886
  start: we(e.start, t),
4878
4887
  end: we(e.end, t),
4879
4888
  label: e.label,
4880
- color: e.color ?? Nt.color,
4881
- size: e.size ?? Nt.size,
4882
- labelCrossPosition: e.labelCrossPosition ?? Nt.labelCrossPosition
4889
+ color: e.color ?? Pt.color,
4890
+ size: e.size ?? Pt.size,
4891
+ labelCrossPosition: e.labelCrossPosition ?? Pt.labelCrossPosition
4883
4892
  }), we = (e, t) => {
4884
4893
  if (e.layerIndex === void 0)
4885
4894
  return { anchorValue: e.anchorValue, groupValue: e.groupValue };
@@ -4893,14 +4902,14 @@ const Nt = {
4893
4902
  id: e.id ?? crypto.randomUUID(),
4894
4903
  anchor: we(e.anchor, t),
4895
4904
  sticker: e.sticker
4896
- }), Ld = (e, t) => ({
4905
+ }), kd = (e, t) => ({
4897
4906
  id: e.id ?? crypto.randomUUID(),
4898
4907
  anchor: we(e.anchor, t)
4899
- }), Vd = (e, t) => ({
4908
+ }), Ld = (e, t) => ({
4900
4909
  id: e.id ?? crypto.randomUUID(),
4901
4910
  anchor: we(e.anchor, t),
4902
4911
  content: e.content
4903
- }), kd = (e) => ({
4912
+ }), Vd = (e) => ({
4904
4913
  id: e.id ?? crypto.randomUUID(),
4905
4914
  kind: e.kind ?? ye.kind,
4906
4915
  zOrder: e.zOrder ?? ye.zOrder,
@@ -5020,16 +5029,16 @@ function Dd(e, t) {
5020
5029
  };
5021
5030
  });
5022
5031
  }
5023
- const Rd = "linear", Pd = 3, Nd = 0.3;
5024
- function Ve(e, t) {
5032
+ const Rd = "linear", Nd = 3, Pd = 0.3;
5033
+ function Le(e, t) {
5025
5034
  const n = e ?? t, r = typeof n == "string" ? n : n.type;
5026
5035
  if (r === "smooth") {
5027
5036
  const o = typeof n == "string" ? void 0 : n;
5028
5037
  return {
5029
5038
  type: "smooth",
5030
5039
  method: o?.method ?? Rd,
5031
- order: o?.order ?? Pd,
5032
- bandwidth: o?.bandwidth ?? Nd
5040
+ order: o?.order ?? Nd,
5041
+ bandwidth: o?.bandwidth ?? Pd
5033
5042
  };
5034
5043
  }
5035
5044
  return { type: r };
@@ -5054,7 +5063,7 @@ function Bd(e, t, n) {
5054
5063
  const r = n.map((o) => Od(e, t, o));
5055
5064
  return Xd(r);
5056
5065
  }
5057
- const $d = (e, t, n) => n.label !== void 0 ? n.label : jd(e, t, n), Gd = (e) => Vc(e.geom);
5066
+ const $d = (e, t, n) => n.label !== void 0 ? n.label : jd(e, t, n), Gd = (e) => Lc(e.geom);
5058
5067
  function Ud(e, t, n) {
5059
5068
  const r = n.position ?? "identity";
5060
5069
  return {
@@ -5062,16 +5071,16 @@ function Ud(e, t, n) {
5062
5071
  type: n.type,
5063
5072
  geom: n.geom,
5064
5073
  mapping: n.mapping ?? {},
5065
- stat: Ve(n.stat, "identity"),
5074
+ stat: Le(n.stat, "identity"),
5066
5075
  position: r,
5067
- yScaleType: n.yScaleType ?? Le,
5076
+ yScaleType: n.yScaleType ?? ke,
5068
5077
  params: n.params ?? {},
5069
5078
  transforms: n.transforms ?? [],
5070
5079
  interactive: n.interactive ?? !0,
5071
- dataLabels: ke(e, n, r, t)
5080
+ dataLabels: Ve(e, n, r, t)
5072
5081
  };
5073
5082
  }
5074
- const ke = (e, t, n, r) => {
5083
+ const Ve = (e, t, n, r) => {
5075
5084
  const o = { ...e, ...t.mapping }, a = $d(t.geom, n, o);
5076
5085
  return {
5077
5086
  ...Ku(t.geom, r),
@@ -5086,13 +5095,13 @@ function Wd(e, t, n) {
5086
5095
  type: n.type,
5087
5096
  geom: n.geom,
5088
5097
  mapping: n.mapping ?? {},
5089
- stat: Ve(n.stat, ut.stat.type),
5098
+ stat: Le(n.stat, ut.stat.type),
5090
5099
  position: r,
5091
- yScaleType: n.yScaleType ?? Le,
5100
+ yScaleType: n.yScaleType ?? ke,
5092
5101
  params: Ae({}, ut.params, n.params),
5093
5102
  transforms: n.transforms ?? [],
5094
5103
  interactive: n.interactive ?? !0,
5095
- dataLabels: ke(e, n, r, t)
5104
+ dataLabels: Ve(e, n, r, t)
5096
5105
  };
5097
5106
  }
5098
5107
  function Yd(e, t, n) {
@@ -5102,13 +5111,13 @@ function Yd(e, t, n) {
5102
5111
  type: n.type,
5103
5112
  geom: n.geom,
5104
5113
  mapping: n.mapping ?? {},
5105
- stat: Ve(n.stat, Ft.stat.type),
5114
+ stat: Le(n.stat, Ft.stat.type),
5106
5115
  position: r,
5107
- yScaleType: n.yScaleType ?? Le,
5116
+ yScaleType: n.yScaleType ?? ke,
5108
5117
  params: Ae({}, Ft.params, n.params),
5109
5118
  transforms: n.transforms ?? [],
5110
5119
  interactive: n.interactive ?? !0,
5111
- dataLabels: ke(e, n, r, t)
5120
+ dataLabels: Ve(e, n, r, t)
5112
5121
  };
5113
5122
  }
5114
5123
  function Hd(e, t, n) {
@@ -5120,13 +5129,13 @@ function Hd(e, t, n) {
5120
5129
  type: n.type,
5121
5130
  geom: n.geom,
5122
5131
  mapping: n.mapping ?? {},
5123
- stat: Ve(n.stat, _t.stat.type),
5132
+ stat: Le(n.stat, _t.stat.type),
5124
5133
  position: o,
5125
- yScaleType: n.yScaleType ?? Le,
5134
+ yScaleType: n.yScaleType ?? ke,
5126
5135
  params: r,
5127
5136
  transforms: n.transforms ?? [],
5128
5137
  interactive: n.interactive ?? !0,
5129
- dataLabels: ke(e, n, o, t)
5138
+ dataLabels: Ve(e, n, o, t)
5130
5139
  };
5131
5140
  }
5132
5141
  function Kd(e, t, n) {
@@ -5136,13 +5145,13 @@ function Kd(e, t, n) {
5136
5145
  type: n.type,
5137
5146
  geom: n.geom,
5138
5147
  mapping: n.mapping ?? {},
5139
- stat: Ve(n.stat, Dt.stat.type),
5148
+ stat: Le(n.stat, Dt.stat.type),
5140
5149
  position: r,
5141
- yScaleType: n.yScaleType ?? Le,
5150
+ yScaleType: n.yScaleType ?? ke,
5142
5151
  params: { ...Dt.params, ...n.params },
5143
5152
  transforms: n.transforms ?? [],
5144
5153
  interactive: n.interactive ?? !0,
5145
- dataLabels: ke(e, n, r, t)
5154
+ dataLabels: Ve(e, n, r, t)
5146
5155
  };
5147
5156
  }
5148
5157
  function zd(e, t, n) {
@@ -5152,13 +5161,13 @@ function zd(e, t, n) {
5152
5161
  type: n.type,
5153
5162
  geom: n.geom,
5154
5163
  mapping: n.mapping ?? {},
5155
- stat: Ve(n.stat, Ie.stat.type),
5164
+ stat: Le(n.stat, Ie.stat.type),
5156
5165
  position: n.position ?? Ie.position,
5157
- yScaleType: n.yScaleType ?? Le,
5166
+ yScaleType: n.yScaleType ?? ke,
5158
5167
  params: Ae({}, Ie.params, n.params),
5159
5168
  transforms: n.transforms ?? [],
5160
5169
  interactive: n.interactive ?? Ie.interactive,
5161
- dataLabels: ke(e, n, r, t)
5170
+ dataLabels: Ve(e, n, r, t)
5162
5171
  };
5163
5172
  }
5164
5173
  const Xd = (e) => {
@@ -5168,7 +5177,7 @@ const Xd = (e) => {
5168
5177
  return t.size === 0 ? e : e.map((n) => {
5169
5178
  if (n.geom !== "rule" || !t.has(n.yScaleType)) return n;
5170
5179
  const r = te(n.mapping.y);
5171
- if (!k(r)) return n;
5180
+ if (!V(r)) return n;
5172
5181
  const o = Math.min(1, Math.max(0, r));
5173
5182
  return { ...n, mapping: { ...n.mapping, y: { value: o } } };
5174
5183
  });
@@ -5363,12 +5372,12 @@ class im {
5363
5372
  });
5364
5373
  }
5365
5374
  }
5366
- class Vt {
5375
+ class Lt {
5367
5376
  compute(t) {
5368
5377
  return t.data.size() === 0 ? { data: t.data, mapping: {} } : this.computeStat(t);
5369
5378
  }
5370
5379
  }
5371
- class cm extends Vt {
5380
+ class cm extends Lt {
5372
5381
  constructor() {
5373
5382
  super(...arguments), this.type = "count", this.computedVariables = /* @__PURE__ */ new Set(["y"]);
5374
5383
  }
@@ -5385,7 +5394,7 @@ class cm extends Vt {
5385
5394
  };
5386
5395
  }
5387
5396
  }
5388
- class lm extends Vt {
5397
+ class lm extends Lt {
5389
5398
  constructor() {
5390
5399
  super(...arguments), this.type = "identity", this.computedVariables = /* @__PURE__ */ new Set();
5391
5400
  }
@@ -5393,7 +5402,7 @@ class lm extends Vt {
5393
5402
  return { data: t, mapping: {} };
5394
5403
  }
5395
5404
  }
5396
- class um extends Vt {
5405
+ class um extends Lt {
5397
5406
  constructor() {
5398
5407
  super(...arguments), this.type = "mean", this.computedVariables = /* @__PURE__ */ new Set(["y"]);
5399
5408
  }
@@ -5408,7 +5417,7 @@ class um extends Vt {
5408
5417
  }
5409
5418
  }
5410
5419
  const dm = 2, Xo = 1440 * 60 * 1e3;
5411
- class mm extends Vt {
5420
+ class mm extends Lt {
5412
5421
  constructor() {
5413
5422
  super(...arguments), this.type = "smooth", this.computedVariables = /* @__PURE__ */ new Set();
5414
5423
  }
@@ -5468,7 +5477,7 @@ const vr = ({
5468
5477
  }, fm = (e) => {
5469
5478
  let t = null;
5470
5479
  for (const n of e) {
5471
- if (!P(n)) continue;
5480
+ if (!N(n)) continue;
5472
5481
  const r = n.getTime();
5473
5482
  (t === null || r < t) && (t = r);
5474
5483
  }
@@ -5481,9 +5490,9 @@ const vr = ({
5481
5490
  }) => {
5482
5491
  switch (t) {
5483
5492
  case "numeric":
5484
- return !k(e) || !Number.isFinite(e) ? null : e;
5493
+ return !V(e) || !Number.isFinite(e) ? null : e;
5485
5494
  case "temporal": {
5486
- if (!P(e)) return null;
5495
+ if (!N(e)) return null;
5487
5496
  const o = e.getTime();
5488
5497
  return r === null ? o : (o - r) / Xo + 1;
5489
5498
  }
@@ -5600,7 +5609,7 @@ const wm = ({ layer: e }) => {
5600
5609
  let n = 0, r = 0;
5601
5610
  for (const o of e.data) {
5602
5611
  const a = o[t];
5603
- k(a) && (n += a, r += Math.abs(a));
5612
+ V(a) && (n += a, r += Math.abs(a));
5604
5613
  }
5605
5614
  return { grandTotal: n, absoluteGrandTotal: r };
5606
5615
  }, Am = ({ layer: e }) => {
@@ -5679,7 +5688,7 @@ class Mm extends re {
5679
5688
  return t.transforms.reduce((n, r) => this.registry.get(r.transformType).apply(n, r), t.data);
5680
5689
  }
5681
5690
  }
5682
- class Lm {
5691
+ class km {
5683
5692
  constructor() {
5684
5693
  this.transformType = "aggregate";
5685
5694
  }
@@ -5693,7 +5702,7 @@ class Lm {
5693
5702
  return t.groupBy(...r.groupby).rollup(o);
5694
5703
  }
5695
5704
  }
5696
- class Vm {
5705
+ class Lm {
5697
5706
  constructor() {
5698
5707
  this.transformType = "constant";
5699
5708
  }
@@ -5702,7 +5711,7 @@ class Vm {
5702
5711
  return t.addConstantVariable(r.variableName, r.type, r.value);
5703
5712
  }
5704
5713
  }
5705
- class km {
5714
+ class Vm {
5706
5715
  constructor() {
5707
5716
  this.transformType = "filter";
5708
5717
  }
@@ -5736,7 +5745,7 @@ class Im {
5736
5745
  }
5737
5746
  class Cm extends Me {
5738
5747
  constructor() {
5739
- super("transform"), this.register("aggregate", new Lm()), this.register("constant", new Vm()), this.register("filter", new km()), this.register("reshape", new Em()), this.register("sort", new Im());
5748
+ super("transform"), this.register("aggregate", new km()), this.register("constant", new Lm()), this.register("filter", new Vm()), this.register("reshape", new Em()), this.register("sort", new Im());
5740
5749
  }
5741
5750
  }
5742
5751
  const xr = {
@@ -5780,7 +5789,7 @@ const Dm = (e, t, n) => {
5780
5789
  return () => r;
5781
5790
  }
5782
5791
  return (r) => h(r[t]) ? n.map(r[t]) : null;
5783
- }, _y = [
5792
+ }, Ry = [
5784
5793
  "data",
5785
5794
  "transform",
5786
5795
  "constantMapping",
@@ -5829,7 +5838,7 @@ class Rm {
5829
5838
  */
5830
5839
  recompile({ spec: t, data: n }) {
5831
5840
  return this.trackCompile(() => n === void 0 ? this.runPipeline({ spec: t }) : (this.lastData = n, this.runPipeline({
5832
- spec: kt(t, { data: this.dataCompiler.compile(n) })
5841
+ spec: Vt(t, { data: this.dataCompiler.compile(n) })
5833
5842
  })));
5834
5843
  }
5835
5844
  /**
@@ -5865,12 +5874,12 @@ class Rm {
5865
5874
  }
5866
5875
  runPipeline({ spec: t }) {
5867
5876
  return xt({ spec: t }).pipe(({ spec: r }) => ({
5868
- spec: kt(r, {
5877
+ spec: Vt(r, {
5869
5878
  data: this.transformCompiler.compile({ data: r.data, transforms: r.transforms })
5870
5879
  })
5871
5880
  })).pipe(({ spec: r }) => {
5872
5881
  const o = this.constantMappingCompiler.compile({ data: r.data, mapping: r.mapping });
5873
- return { spec: kt(r, { data: o.data, mapping: o.mapping }) };
5882
+ return { spec: Vt(r, { data: o.data, mapping: o.mapping }) };
5874
5883
  }).pipe(({ spec: r }) => {
5875
5884
  const o = {
5876
5885
  data: r.data,
@@ -5916,24 +5925,24 @@ class Rm {
5916
5925
  })).result();
5917
5926
  }
5918
5927
  }
5919
- const Dy = (e) => {
5920
- const t = new Ni({ geoms: e?.geoms }), n = new Ei(t), r = new Sm(), o = new ou(), a = new Mm(new Cm());
5928
+ const Ny = (e) => {
5929
+ const t = new Pi({ geoms: e?.geoms }), n = new Ei(t), r = new Sm(), o = new ou(), a = new Mm(new Cm());
5921
5930
  return new Rm(
5922
5931
  new Ti(),
5923
5932
  new sm(),
5924
5933
  a,
5925
- new Ls(),
5934
+ new ks(),
5926
5935
  new xl(a, new Sl(t, r)),
5927
5936
  new vl(
5928
5937
  a,
5929
5938
  new im(r),
5930
5939
  new Oi(),
5931
5940
  n,
5932
- new Al(new kl())
5941
+ new Al(new Vl())
5933
5942
  ),
5934
5943
  new Ol(o),
5935
5944
  new Is(new Ws(t)),
5936
- new Nl(t),
5945
+ new Pl(t),
5937
5946
  new Fm(n),
5938
5947
  new Qc(n),
5939
5948
  new Tm(n),
@@ -5942,18 +5951,18 @@ const Dy = (e) => {
5942
5951
  new ys(n)
5943
5952
  );
5944
5953
  };
5945
- function Ry(e, t) {
5954
+ function Py(e, t) {
5946
5955
  return e.geom === t;
5947
5956
  }
5948
5957
  const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
5949
- if (!P(t))
5958
+ if (!N(t))
5950
5959
  return gn;
5951
5960
  try {
5952
5961
  return e(t);
5953
5962
  } catch {
5954
5963
  return Qo;
5955
5964
  }
5956
- }, oe = (e) => (t) => k(t) ? e(t) : gn, bn = (e) => (t) => He(t) ? t : gn, Pm = 2, Nm = 3, Om = 2, Bm = 0, $m = 1, Gm = 2, Um = rs.humanizer({
5965
+ }, oe = (e) => (t) => V(t) ? e(t) : gn, bn = (e) => (t) => He(t) ? t : gn, Nm = 2, Pm = 3, Om = 2, Bm = 0, $m = 1, Gm = 2, Um = rs.humanizer({
5957
5966
  language: "en",
5958
5967
  spacer: "",
5959
5968
  delimiter: " ",
@@ -5975,7 +5984,7 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
5975
5984
  numberFormat: n,
5976
5985
  intlOptions: r
5977
5986
  }) => oe((o) => {
5978
- const a = typeof n.decimals == "number" ? n.decimals : Pm, s = wn(o, a), { base: i, suffix: c } = Sn(o, n.abbreviation), l = {
5987
+ const a = typeof n.decimals == "number" ? n.decimals : Nm, s = wn(o, a), { base: i, suffix: c } = Sn(o, n.abbreviation), l = {
5979
5988
  ...s,
5980
5989
  ...ao(e) ? { style: "currency", currencyDisplay: "narrowSymbol", currency: e.iso } : {},
5981
5990
  ...r
@@ -6006,19 +6015,19 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6006
6015
  return Sn(e, n);
6007
6016
  }
6008
6017
  default:
6009
- return { base: e / Ne[t], suffix: t };
6018
+ return { base: e / Pe[t], suffix: t };
6010
6019
  }
6011
6020
  }, wn = (e, t) => {
6012
6021
  if (typeof t == "number")
6013
6022
  return { minimumFractionDigits: t, maximumFractionDigits: t };
6014
- const n = Math.ceil(Math.log10(Math.abs(e))), r = n >= Nm ? Bm : n === Om ? $m : Gm;
6023
+ const n = Math.ceil(Math.log10(Math.abs(e))), r = n >= Pm ? Bm : n === Om ? $m : Gm;
6015
6024
  return {
6016
6025
  minimumFractionDigits: t === "auto" ? 0 : r,
6017
6026
  maximumFractionDigits: r
6018
6027
  };
6019
6028
  }, Wm = (e) => {
6020
6029
  const t = Math.abs(e);
6021
- return t >= Ne.b ? "b" : t >= Ne.m ? "m" : t >= Ne.k ? "k" : "none";
6030
+ return t >= Pe.b ? "b" : t >= Pe.m ? "m" : t >= Pe.k ? "k" : "none";
6022
6031
  }, Ym = ({ locale: e, intlOptions: t }) => _(
6023
6032
  (n) => Intl.DateTimeFormat(e, { dateStyle: "medium", ...R, ...t }).format(n)
6024
6033
  ), Hm = ({ locale: e, intlOptions: t }) => _((n) => {
@@ -6079,36 +6088,36 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6079
6088
  intlOptions: r
6080
6089
  }) => oe((o) => {
6081
6090
  const s = {
6082
- ...Vn(o, n),
6091
+ ...Ln(o, n),
6083
6092
  notation: "compact",
6084
6093
  ...ao(e) ? { style: "currency", currencyDisplay: "narrowSymbol", currency: e.iso } : {},
6085
6094
  ...r
6086
6095
  };
6087
- return Ln(o, t, s);
6096
+ return kn(o, t, s);
6088
6097
  }), Zm = ({
6089
6098
  locale: e,
6090
6099
  tickValues: t,
6091
6100
  intlOptions: n
6092
6101
  }) => oe((r) => {
6093
- const a = { ...Vn(r, t), notation: "compact", ...n };
6094
- return Ln(r, e, a);
6102
+ const a = { ...Ln(r, t), notation: "compact", ...n };
6103
+ return kn(r, e, a);
6095
6104
  }), Jm = ({
6096
6105
  locale: e,
6097
6106
  tickValues: t,
6098
6107
  intlOptions: n
6099
6108
  }) => oe((r) => {
6100
6109
  const a = {
6101
- ...Vn(r, t),
6110
+ ...Ln(r, t),
6102
6111
  notation: "compact",
6103
6112
  ...n,
6104
6113
  style: "percent"
6105
6114
  };
6106
- return Ln(r, e, a);
6107
- }), Ln = (e, t, n) => Intl.NumberFormat(t, n).formatToParts(e).map((o) => o.type === "compact" ? o.value.toLowerCase() : o.value).join(""), sa = (e) => Math.abs(e) > Sr ? sa(e / Sr) : Number.isInteger(e), ep = (e) => {
6115
+ return kn(r, e, a);
6116
+ }), kn = (e, t, n) => Intl.NumberFormat(t, n).formatToParts(e).map((o) => o.type === "compact" ? o.value.toLowerCase() : o.value).join(""), sa = (e) => Math.abs(e) > Sr ? sa(e / Sr) : Number.isInteger(e), ep = (e) => {
6108
6117
  if (e.length < 2) return !1;
6109
6118
  const [t, n] = e;
6110
6119
  return typeof t != "number" || typeof n != "number" ? !1 : Math.abs(n - t) < Xm;
6111
- }, Vn = (e, t) => sa(e) ? { minimumFractionDigits: 0, maximumFractionDigits: 0 } : ep(t) ? { minimumFractionDigits: 0, maximumFractionDigits: jm } : { minimumFractionDigits: 0, maximumFractionDigits: qm }, tp = ({
6120
+ }, Ln = (e, t) => sa(e) ? { minimumFractionDigits: 0, maximumFractionDigits: 0 } : ep(t) ? { minimumFractionDigits: 0, maximumFractionDigits: jm } : { minimumFractionDigits: 0, maximumFractionDigits: qm }, tp = ({
6112
6121
  locale: e,
6113
6122
  intlOptions: t
6114
6123
  }) => _(
@@ -6138,7 +6147,7 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6138
6147
  intlOptions: t
6139
6148
  }) => _(
6140
6149
  (n) => Intl.DateTimeFormat(e, { timeStyle: "short", ...R, ...t }).format(n)
6141
- ), kn = (e) => {
6150
+ ), Vn = (e) => {
6142
6151
  const { valueFormat: t } = e;
6143
6152
  switch (t.type) {
6144
6153
  case "currency":
@@ -6170,7 +6179,7 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6170
6179
  case "year":
6171
6180
  return Mn(e);
6172
6181
  case "lookup":
6173
- return kn({ ...e, valueFormat: t.fallback });
6182
+ return Vn({ ...e, valueFormat: t.fallback });
6174
6183
  default: {
6175
6184
  const n = t;
6176
6185
  throw new Error(`Unhandled value format: ${n.type}`);
@@ -6322,7 +6331,7 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6322
6331
  return (o, a) => {
6323
6332
  if (a === void 0 || a[r] === void 0)
6324
6333
  return t(o);
6325
- const s = L(a[r]), i = n[s];
6334
+ const s = k(a[r]), i = n[s];
6326
6335
  return i !== void 0 ? i(o, a) : t(o);
6327
6336
  };
6328
6337
  }, F = (e) => {
@@ -6409,7 +6418,7 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6409
6418
  }, vp = (e) => {
6410
6419
  const t = Tr(e.rows, e.height), n = Tr(e.cols, e.width), r = Mr(t), o = Mr(n), a = /* @__PURE__ */ new Map();
6411
6420
  for (const s of e.placements) {
6412
- const i = s.rowSpan ?? 1, c = s.colSpan ?? 1, l = o[s.col] ?? 0, u = r[s.row] ?? 0, d = Lr(n, s.col, c), m = Lr(t, s.row, i);
6421
+ const i = s.rowSpan ?? 1, c = s.colSpan ?? 1, l = o[s.col] ?? 0, u = r[s.row] ?? 0, d = kr(n, s.col, c), m = kr(t, s.row, i);
6413
6422
  a.set(s.name, { x: l, y: u, width: Math.max(0, d), height: Math.max(0, m) });
6414
6423
  }
6415
6424
  return a;
@@ -6459,7 +6468,7 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6459
6468
  for (let r = 0; r < e.length; r++)
6460
6469
  t[r] = n, n += e[r] ?? 0;
6461
6470
  return t;
6462
- }, Lr = (e, t, n) => {
6471
+ }, kr = (e, t, n) => {
6463
6472
  let r = 0;
6464
6473
  const o = Math.min(t + n, e.length);
6465
6474
  for (let a = t; a < o; a++)
@@ -6517,8 +6526,8 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6517
6526
  },
6518
6527
  { name: "panel", row: "panel", col: "panel" },
6519
6528
  ...Mp(n.axes),
6520
- ...Lp(n.axesLabels, n.axes),
6521
- ...Vp(n.legends)
6529
+ ...kp(n.axesLabels, n.axes),
6530
+ ...Lp(n.legends)
6522
6531
  ],
6523
6532
  containerSize: e,
6524
6533
  padding: Ap
@@ -6526,13 +6535,13 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6526
6535
  }, Mp = (e) => {
6527
6536
  const t = [];
6528
6537
  return e.top > 0 && t.push({ name: "topAxis", row: "topAxis", col: "panel" }), e.bottom > 0 && t.push({ name: "bottomAxis", row: "bottomAxis", col: "panel" }), e.left > 0 && t.push({ name: "leftAxis", row: "panel", col: "leftAxis" }), e.right > 0 && t.push({ name: "rightAxis", row: "panel", col: "rightAxis" }), t;
6529
- }, Lp = (e, t) => {
6538
+ }, kp = (e, t) => {
6530
6539
  const n = [];
6531
6540
  return e.top > 0 || t.top > 0 ? (e.top > 0 && n.push({ name: "topAxisLabel", row: "topAxisLabel", col: "panel" }), e.left > 0 && n.push({ name: "leftAxisLabel", row: "topAxis", col: "leftAxis" }), e.right > 0 && n.push({ name: "rightAxisLabel", row: "topAxis", col: "rightAxis" })) : (e.left > 0 && n.push({ name: "leftAxisLabel", row: "topAxisLabel", col: "leftAxis" }), e.right > 0 && n.push({ name: "rightAxisLabel", row: "topAxisLabel", col: "rightAxis" })), e.bottom > 0 && n.push({ name: "bottomAxisLabel", row: "bottomAxisLabel", col: "panel" }), n;
6532
- }, Vp = (e) => {
6541
+ }, Lp = (e) => {
6533
6542
  const t = [];
6534
6543
  return e.top > 0 && t.push({ name: "topLegend", row: "topLegend", col: "leftAxis", colEnd: "rightAxis" }), e.bottom > 0 && t.push({ name: "bottomLegend", row: "bottomLegend", col: "leftAxis", colEnd: "rightAxis" }), e.left > 0 && t.push({ name: "leftLegend", row: "panel", col: "leftLegend" }), e.right > 0 && t.push({ name: "rightLegend", row: "panel", col: "rightLegend" }), t;
6535
- }, kp = ({
6544
+ }, Vp = ({
6536
6545
  annotations: e,
6537
6546
  mainAxis: t,
6538
6547
  panelRect: n,
@@ -6546,23 +6555,23 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6546
6555
  let u = 0, d = 0;
6547
6556
  for (const m of e.differenceArrows) {
6548
6557
  const { start: p, end: f, size: y, label: b } = m;
6549
- if (!Vr(p.x, p.y) || !Vr(f.x, f.y)) continue;
6558
+ if (!Lr(p.x, p.y) || !Lr(f.x, f.y)) continue;
6550
6559
  const S = ca(y, r), x = S.offsetFromHigherObservation + S.arrowheadSize + S.arrowEndGap, w = la({
6551
6560
  locale: o,
6552
6561
  kind: b,
6553
6562
  startValue: p.measurementValue,
6554
6563
  endValue: f.measurementValue
6555
- }), V = a(w, y);
6564
+ }), L = a(w, y);
6556
6565
  if (i) {
6557
- const E = Math.max(p.x, f.x), W = x + V.width / 2 + S.labelPaddingX;
6558
- d = Math.max(d, kr(W, E, l));
6566
+ const E = Math.max(p.x, f.x), W = x + L.width / 2 + S.labelPaddingX;
6567
+ d = Math.max(d, Vr(W, E, l));
6559
6568
  } else {
6560
6569
  const E = Math.max(p.y, f.y), W = x + S.labelLineHeight / 2 + S.labelPaddingY;
6561
- u = Math.max(u, kr(W, E, c));
6570
+ u = Math.max(u, Vr(W, E, c));
6562
6571
  }
6563
6572
  }
6564
6573
  return { top: Math.ceil(u), right: Math.ceil(d), bottom: 0, left: 0 };
6565
- }, Vr = (e, t) => e >= 0 && e <= 1 && t >= 0 && t <= 1, kr = (e, t, n) => {
6574
+ }, Lr = (e, t) => e >= 0 && e <= 1 && t >= 0 && t <= 1, Vr = (e, t, n) => {
6566
6575
  if (t <= 0) return 0;
6567
6576
  const r = (e - (1 - t) * n) / t;
6568
6577
  return Math.max(0, r);
@@ -6611,7 +6620,7 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6611
6620
  if (da(e)) return 0;
6612
6621
  const r = ma(e, t.width, n);
6613
6622
  return n.measureHeadline(e.formatted, r).height;
6614
- }, Py = ({
6623
+ }, Oy = ({
6615
6624
  headline: e,
6616
6625
  layout: t,
6617
6626
  containerSize: n,
@@ -6638,7 +6647,7 @@ const gn = "–", Qo = "n/a", R = { timeZone: "UTC" }, _ = (e) => (t) => {
6638
6647
  const n = Math.min(e.width, e.height) / 2, r = t * n * Math.SQRT2, o = e.x + e.width / 2, a = e.y + e.height / 2;
6639
6648
  return { x: o - r / 2, y: a - r / 2, width: r, height: r };
6640
6649
  }, ma = (e, t, n) => Ip({ size: e.size, availableWidth: t, measureStripWidth: pa(e, n) }), pa = (e, t) => (n) => t.measureHeadline(e.formatted, n).width, Fe = { x: 0, y: 0, width: 0, height: 0 }, Rp = "0000";
6641
- class Ny {
6650
+ class By {
6642
6651
  constructor(t) {
6643
6652
  this.measurer = t;
6644
6653
  }
@@ -6653,7 +6662,7 @@ class Ny {
6653
6662
  headline: t.headline,
6654
6663
  locale: t.formattingLocale ?? t.parsingLocale
6655
6664
  }).pipe(({ axes: r, numberFormat: o, locale: a }) => {
6656
- const s = r.filter((i) => i.geometry !== "linear").map((i) => Np(i, Cr(i, a, o)));
6665
+ const s = r.filter((i) => i.geometry !== "linear").map((i) => Pp(i, Cr(i, a, o)));
6657
6666
  return {
6658
6667
  cartesianAxes: r.filter((i) => i.geometry === "linear"),
6659
6668
  formattedPolarAxes: s,
@@ -6771,7 +6780,7 @@ class Ny {
6771
6780
  */
6772
6781
  measureAnnotationOverflow(t, n, r, o) {
6773
6782
  if (!t.annotations || t.annotations.differenceArrows.length === 0 || t.coordSystem?.type !== "cartesian") return o;
6774
- const a = kp({
6783
+ const a = Vp({
6775
6784
  annotations: t.annotations,
6776
6785
  mainAxis: t.coordSystem.mainAxis,
6777
6786
  panelRect: n,
@@ -6861,15 +6870,15 @@ class Ny {
6861
6870
  return t === void 0 ? 0 : _p({ headline: t, containerSize: n, measurer: this.measurer });
6862
6871
  }
6863
6872
  }
6864
- const Er = 5, ot = 8, Ir = (e) => e === "left" || e === "right", Pp = (e) => {
6873
+ const Er = 5, ot = 8, Ir = (e) => e === "left" || e === "right", Np = (e) => {
6865
6874
  const [t, ...n] = e.tickCandidates;
6866
6875
  if (t)
6867
6876
  return e.geometry === "circular" ? t : n.reduce(
6868
6877
  (r, o) => Math.abs(o.ticks.length - Er) < Math.abs(r.ticks.length - Er) ? o : r,
6869
6878
  t
6870
6879
  );
6871
- }, Np = (e, t) => {
6872
- const { tickCandidates: n, ...r } = e, o = Pp(e);
6880
+ }, Pp = (e, t) => {
6881
+ const { tickCandidates: n, ...r } = e, o = Np(e);
6873
6882
  if (!o) return { ...r, ticks: [], labelRotation: 0, labelMaxWidthPx: null };
6874
6883
  const a = t(o), s = o.ticks.map((i) => ({ ...i, formattedLabel: a(i.value) }));
6875
6884
  return { ...r, ticks: s, labelRotation: 0, labelMaxWidthPx: null };
@@ -6892,7 +6901,7 @@ const Er = 5, ot = 8, Ir = (e) => e === "left" || e === "right", Pp = (e) => {
6892
6901
  return (a) => {
6893
6902
  const s = o.get(a);
6894
6903
  if (s) return s;
6895
- const i = kn({
6904
+ const i = Vn({
6896
6905
  valueFormat: a.valueFormat ?? e.valueFormat,
6897
6906
  locale: t,
6898
6907
  numberFormat: n,
@@ -6901,7 +6910,7 @@ const Er = 5, ot = 8, Ir = (e) => e === "left" || e === "right", Pp = (e) => {
6901
6910
  return o.set(a, i), i;
6902
6911
  };
6903
6912
  };
6904
- function Oy(e, t, n, r) {
6913
+ function $y(e, t, n, r) {
6905
6914
  const o = /* @__PURE__ */ new Map();
6906
6915
  if (!n || n.kind !== "visual" || n.domain.length <= 1) return o;
6907
6916
  const a = new Map(t.map((s) => [s.id, s.swatchShape]));
@@ -6946,7 +6955,7 @@ function $p(e, t) {
6946
6955
  cross: In(e, t)
6947
6956
  };
6948
6957
  }
6949
- function By(e) {
6958
+ function Gy(e) {
6950
6959
  return e.type === "cartesian";
6951
6960
  }
6952
6961
  const Cn = 12, Gp = 4, Up = (e) => {
@@ -7046,7 +7055,7 @@ const Cn = 12, Gp = 4, Up = (e) => {
7046
7055
  if (m === "") continue;
7047
7056
  const { width: p, height: f } = r("dataLabel", m), y = fa(d, n);
7048
7057
  p > y.width && (c = !0);
7049
- const b = l === null ? null : u[l], S = k(b) && b < 0;
7058
+ const b = l === null ? null : u[l], S = V(b) && b < 0;
7050
7059
  i.push({ key: s(u), isNegative: S, text: m, labelWidth: p, labelHeight: f, bounds: y });
7051
7060
  }
7052
7061
  return { entries: i, shouldRotate: !a && c };
@@ -7113,9 +7122,9 @@ const Cn = 12, Gp = 4, Up = (e) => {
7113
7122
  if (d + zt < p) {
7114
7123
  if (m > f) return null;
7115
7124
  if (o) return { x: c, y: l, isRotated: !0, position: "inside" };
7116
- const V = b - S * (y + zt);
7125
+ const L = b - S * (y + zt);
7117
7126
  return {
7118
- ...i ? { x: c, y: V } : { x: V, y: l },
7127
+ ...i ? { x: c, y: L } : { x: L, y: l },
7119
7128
  isRotated: !1,
7120
7129
  position: "inside"
7121
7130
  };
@@ -7230,8 +7239,8 @@ const cf = " · ", lf = (e) => typeof e == "string" ? e : e instanceof Date ? e.
7230
7239
  if (i === null || c === null || l === null) continue;
7231
7240
  const u = e.formatLabel(s);
7232
7241
  if (u === "") continue;
7233
- const d = n === null ? null : n(s), m = d === null ? u : `${lf(d)}${cf}${u}`, { width: p, height: f } = e.measureDataLabel("dataLabel", m), y = (i + c) / 2, b = Math.abs(Math.sin(y)) * (p / 2) + Math.abs(Math.cos(y)) * (f / 2), S = l * a + Gp + b, x = r + Math.sin(y) * S, w = o - Math.cos(y) * S, V = p / 2, E = f / 2;
7234
- x - V < 0 || x + V > e.panelRect.width || w - E < 0 || w + E > e.panelRect.height || t.push({
7242
+ const d = n === null ? null : n(s), m = d === null ? u : `${lf(d)}${cf}${u}`, { width: p, height: f } = e.measureDataLabel("dataLabel", m), y = (i + c) / 2, b = Math.abs(Math.sin(y)) * (p / 2) + Math.abs(Math.cos(y)) * (f / 2), S = l * a + Gp + b, x = r + Math.sin(y) * S, w = o - Math.cos(y) * S, L = p / 2, E = f / 2;
7243
+ x - L < 0 || x + L > e.panelRect.width || w - E < 0 || w + E > e.panelRect.height || t.push({
7235
7244
  layerId: e.layer.id,
7236
7245
  key: e.getObservationKey(s),
7237
7246
  x,
@@ -7319,11 +7328,11 @@ const hf = ({
7319
7328
  const t = _o(e);
7320
7329
  return (n) => {
7321
7330
  const r = Se(n), o = J(n);
7322
- if (!k(r) || !k(o)) return null;
7331
+ if (!V(r) || !V(o)) return null;
7323
7332
  const a = Math.abs(o - r);
7324
7333
  if (a === 0) return null;
7325
7334
  const s = t(n);
7326
- return k(s) ? s / a : null;
7335
+ return V(s) ? s / a : null;
7327
7336
  };
7328
7337
  }, xf = ({
7329
7338
  layer: e,
@@ -7341,7 +7350,7 @@ const hf = ({
7341
7350
  return (d) => {
7342
7351
  const m = s(d);
7343
7352
  if (m === null) return "";
7344
- if (!u || !k(m)) return c(m, d);
7353
+ if (!u || !V(m)) return c(m, d);
7345
7354
  const p = i(d);
7346
7355
  return p === null || p === 0 ? c(m, d) : l(m / p);
7347
7356
  };
@@ -7386,7 +7395,7 @@ const hf = ({
7386
7395
  line: { cartesian: nf },
7387
7396
  point: { cartesian: of },
7388
7397
  area: { cartesian: Wp }
7389
- }, $y = ({
7398
+ }, Uy = ({
7390
7399
  layers: e,
7391
7400
  coordSystem: t,
7392
7401
  axes: n,
@@ -7417,7 +7426,7 @@ const hf = ({
7417
7426
  }, Mf = (e, t, n, r) => {
7418
7427
  const o = r.offsetFromHigherObservation + r.arrowheadSize + r.arrowEndGap;
7419
7428
  return e ? Math.max(t.x, n.x) + o : Math.min(t.y, n.y) - o;
7420
- }, Lf = (e, t, n, { arrowStartGap: r, arrowEndGap: o, curveRadius: a }) => {
7429
+ }, kf = (e, t, n, { arrowStartGap: r, arrowEndGap: o, curveRadius: a }) => {
7421
7430
  const s = { x: e.x, y: e.y - r }, i = { x: e.x, y: n }, c = { x: t.x, y: n }, l = { x: t.x, y: t.y - o }, u = t.x > e.x ? 1 : -1;
7422
7431
  return `
7423
7432
  M ${s.x} ${s.y}
@@ -7427,7 +7436,7 @@ const hf = ({
7427
7436
  Q ${c.x} ${c.y} ${c.x} ${c.y + a}
7428
7437
  L ${l.x} ${l.y}
7429
7438
  `;
7430
- }, Vf = (e, t, n, { arrowStartGap: r, arrowEndGap: o, curveRadius: a }) => {
7439
+ }, Lf = (e, t, n, { arrowStartGap: r, arrowEndGap: o, curveRadius: a }) => {
7431
7440
  const s = { x: e.x + r, y: e.y }, i = { x: n, y: e.y }, c = { x: n, y: t.y }, l = { x: t.x + o, y: t.y }, u = t.y > e.y ? 1 : -1;
7432
7441
  return `
7433
7442
  M ${s.x} ${s.y}
@@ -7437,7 +7446,7 @@ const hf = ({
7437
7446
  Q ${c.x} ${c.y} ${c.x - a} ${c.y}
7438
7447
  L ${l.x} ${l.y}
7439
7448
  `;
7440
- }, kf = (e, t, { arrowEndGap: n, arrowheadSize: r }) => e ? `
7449
+ }, Vf = (e, t, { arrowEndGap: n, arrowheadSize: r }) => e ? `
7441
7450
  M ${t.x + n + r} ${t.y - r}
7442
7451
  L ${t.x + n} ${t.y}
7443
7452
  L ${t.x + n + r} ${t.y + r}
@@ -7451,7 +7460,7 @@ const hf = ({
7451
7460
  return { x: r, y: i + a * o };
7452
7461
  }
7453
7462
  return { x: Math.min(t.x, n.x) + a * o, y: r };
7454
- }, If = (e, t, n) => Math.abs(e ? t.y - n.y : t.x - n.x), Gy = ({
7463
+ }, If = (e, t, n) => Math.abs(e ? t.y - n.y : t.x - n.x), Wy = ({
7455
7464
  arrow: e,
7456
7465
  mainAxis: t,
7457
7466
  panelWidth: n,
@@ -7459,12 +7468,12 @@ const hf = ({
7459
7468
  textScale: o,
7460
7469
  locale: a
7461
7470
  }) => {
7462
- const s = t === "y", i = { x: e.start.x * n, y: (1 - e.start.y) * r }, c = { x: e.end.x * n, y: (1 - e.end.y) * r }, l = ca(e.size, o), u = Mf(s, i, c, l), d = (s ? Vf : Lf)(
7471
+ const s = t === "y", i = { x: e.start.x * n, y: (1 - e.start.y) * r }, c = { x: e.end.x * n, y: (1 - e.end.y) * r }, l = ca(e.size, o), u = Mf(s, i, c, l), d = (s ? Lf : kf)(
7463
7472
  i,
7464
7473
  c,
7465
7474
  u,
7466
7475
  l
7467
- ), m = kf(s, c, l), p = If(s, i, c), f = Ef(
7476
+ ), m = Vf(s, c, l), p = If(s, i, c), f = Ef(
7468
7477
  s,
7469
7478
  i,
7470
7479
  c,
@@ -7491,7 +7500,7 @@ const hf = ({
7491
7500
  labelStrokeWidth: l.labelStrokeWidth,
7492
7501
  labelFontWeight: l.labelFontWeight
7493
7502
  };
7494
- }, Cf = 100, Uy = ({
7503
+ }, Cf = 100, Yy = ({
7495
7504
  items: e,
7496
7505
  containerHeight: t,
7497
7506
  labelHeight: n
@@ -7517,7 +7526,7 @@ const hf = ({
7517
7526
  break;
7518
7527
  }
7519
7528
  return { placements: r.filter((l) => l.y >= 0 && l.y <= t).map((l) => ({ y: l.y, anchorY: l.anchorY, payload: l.payload })), hasOverlap: a };
7520
- }, Wy = ({
7529
+ }, Hy = ({
7521
7530
  headline: e,
7522
7531
  show: t,
7523
7532
  numberFormat: n,
@@ -7528,9 +7537,9 @@ const hf = ({
7528
7537
  const a = o ?? r;
7529
7538
  return e.kind === "grandTotal" ? Ff(e, a, n) : _f(e, t, a, n);
7530
7539
  }, Ff = (e, t, n) => ({ kind: "grandTotal", value: F({ valueFormat: e.valueFormat, locale: t, numberFormat: n })(e.value) }), _f = (e, t, n, r) => {
7531
- const o = F({ valueFormat: { type: "percentage" }, locale: n, numberFormat: r }), a = Nf(t, e.items.length > 1);
7540
+ const o = F({ valueFormat: { type: "percentage" }, locale: n, numberFormat: r }), a = Pf(t, e.items.length > 1);
7532
7541
  return { kind: "perGroup", items: e.items.map((i) => {
7533
- const c = F({ valueFormat: i.valueFormat, locale: n, numberFormat: r }), l = F({ valueFormat: i.groupLabelFormat, locale: n, numberFormat: r }), u = kn({
7542
+ const c = F({ valueFormat: i.valueFormat, locale: n, numberFormat: r }), l = F({ valueFormat: i.groupLabelFormat, locale: n, numberFormat: r }), u = Vn({
7534
7543
  valueFormat: i.mainValueFormat,
7535
7544
  locale: n,
7536
7545
  numberFormat: r,
@@ -7540,7 +7549,7 @@ const hf = ({
7540
7549
  swatch: i.swatch,
7541
7550
  label: `${a}${d}`,
7542
7551
  value: i.aggregate === null ? null : c(i.aggregate),
7543
- observationLabel: Pf(i.observationLabel, u),
7552
+ observationLabel: Nf(i.observationLabel, u),
7544
7553
  comparison: Df(i.comparison, u, o)
7545
7554
  };
7546
7555
  }) };
@@ -7548,7 +7557,7 @@ const hf = ({
7548
7557
  direction: Rf(e.variation),
7549
7558
  percentage: n(Math.abs(e.variation)),
7550
7559
  reference: `from ${t(e.against)}`
7551
- }, Rf = (e) => e > 0 ? "up" : e < 0 ? "down" : "flat", Pf = (e, t) => e === null ? null : e.kind === "point" ? t(e.value) : `${t(e.from)} – ${t(e.to)}`, Nf = (e, t) => {
7560
+ }, Rf = (e) => e > 0 ? "up" : e < 0 ? "down" : "flat", Nf = (e, t) => e === null ? null : e.kind === "point" ? t(e.value) : `${t(e.from)} – ${t(e.to)}`, Pf = (e, t) => {
7552
7561
  switch (e) {
7553
7562
  case "total":
7554
7563
  return "Total ";
@@ -7557,7 +7566,7 @@ const hf = ({
7557
7566
  default:
7558
7567
  return "";
7559
7568
  }
7560
- }, Yy = ({
7569
+ }, Ky = ({
7561
7570
  legends: e,
7562
7571
  numberFormat: t,
7563
7572
  parsingLocale: n,
@@ -7575,10 +7584,10 @@ const hf = ({
7575
7584
  function Fn(e, t) {
7576
7585
  return e.axes.find((n) => n.scaleAestheticKey === t) ?? null;
7577
7586
  }
7578
- function Hy(e, t) {
7587
+ function zy(e, t) {
7579
7588
  return e.legends.find((n) => n.aesthetics.includes(t)) ?? null;
7580
7589
  }
7581
- const Ky = ({ guides: e, numberFormat: t, layer: n, locale: r }) => {
7590
+ const Xy = ({ guides: e, numberFormat: t, layer: n, locale: r }) => {
7582
7591
  const o = n.data.getFirst();
7583
7592
  if (!o) return null;
7584
7593
  const a = n.mapping.y !== void 0, i = (a ? el : Fo)(n.data, n.mapping)(o);
@@ -7599,7 +7608,7 @@ const Ky = ({ guides: e, numberFormat: t, layer: n, locale: r }) => {
7599
7608
  if (n <= 0) return "";
7600
7609
  const { startX: r, startY: o, endX: a, endY: s } = t, i = e === "start" ? r : a, c = e === "start" ? o : s, l = e === "start" ? Math.atan2(o - s, r - a) : Math.atan2(s - o, a - r), u = i - n * Math.cos(l - st), d = c - n * Math.sin(l - st), m = i - n * Math.cos(l + st), p = c - n * Math.sin(l + st);
7601
7610
  return `M ${i} ${c} L ${u} ${d} M ${i} ${c} L ${m} ${p}`;
7602
- }, Yf = (e, t) => e === "solid" ? null : `${t * en} ${t * en * 2}`, Hf = (e, t) => t ? e * en : 0, Kf = 64, zy = ({
7611
+ }, Yf = (e, t) => e === "solid" ? null : `${t * en} ${t * en * 2}`, Hf = (e, t) => t ? e * en : 0, Kf = 64, jy = ({
7603
7612
  arrow: e,
7604
7613
  panelWidth: t,
7605
7614
  panelHeight: n
@@ -7870,7 +7879,7 @@ function lh(e, t) {
7870
7879
  b += 1;
7871
7880
  continue;
7872
7881
  }
7873
- const V = f?.[b] ?? null, E = c ? w : x;
7882
+ const L = f?.[b] ?? null, E = c ? w : x;
7874
7883
  if (d) {
7875
7884
  const W = m?.[b], Ee = p?.[b];
7876
7885
  if (!h(W) || !h(Ee)) {
@@ -7887,14 +7896,14 @@ function lh(e, t) {
7887
7896
  y: q,
7888
7897
  stackMin: W,
7889
7898
  stackMax: Ee,
7890
- groupKey: V,
7899
+ groupKey: L,
7891
7900
  observation: S
7892
7901
  }
7893
7902
  });
7894
7903
  } else
7895
7904
  y.push({
7896
7905
  main: E,
7897
- entry: { isStacked: d, pointIndex: b, x, y: w, groupKey: V, observation: S }
7906
+ entry: { isStacked: d, pointIndex: b, x, y: w, groupKey: L, observation: S }
7898
7907
  });
7899
7908
  b += 1;
7900
7909
  }
@@ -8000,10 +8009,10 @@ function gh(e, t) {
8000
8009
  p++;
8001
8010
  continue;
8002
8011
  }
8003
- const w = c ? (S + x) / 2 : (y + b) / 2, V = u?.[p] ?? w;
8012
+ const w = c ? (S + x) / 2 : (y + b) / 2, L = u?.[p] ?? w;
8004
8013
  m.push({
8005
8014
  mainMid: w,
8006
- bandCenter: V,
8015
+ bandCenter: L,
8007
8016
  entry: {
8008
8017
  pointIndex: p,
8009
8018
  xMin: y,
@@ -8029,14 +8038,14 @@ function bh(e) {
8029
8038
  byKey: t
8030
8039
  };
8031
8040
  }
8032
- function Pr(e, t, n) {
8041
+ function Nr(e, t, n) {
8033
8042
  switch (e.spatialMap.kind) {
8034
8043
  case "points":
8035
8044
  return dh(e, n);
8036
8045
  case "buckets":
8037
- return ch(e, Nr(t));
8046
+ return ch(e, Pr(t));
8038
8047
  case "rects":
8039
- return yh(e, Nr(t));
8048
+ return yh(e, Pr(t));
8040
8049
  case "arcs":
8041
8050
  return ah(e);
8042
8051
  case "polar-points":
@@ -8051,7 +8060,7 @@ function Pr(e, t, n) {
8051
8060
  }
8052
8061
  }
8053
8062
  }
8054
- function Nr(e) {
8063
+ function Pr(e) {
8055
8064
  if (e.type !== "cartesian")
8056
8065
  throw new Error("buildLayerIndex: a bucket or rect hit-test requires a cartesian coord system");
8057
8066
  return e.mainAxis;
@@ -8143,11 +8152,11 @@ function Mh(e, t, n) {
8143
8152
  distance: Dn(i.x - t.x, i.y - t.y, n)
8144
8153
  };
8145
8154
  }
8146
- function Lh(e, t, n) {
8155
+ function kh(e, t, n) {
8147
8156
  if (e.columns.length === 0) return null;
8148
8157
  const r = bt(e.mainAxis, t), o = jf(e, r), a = o?.rects ?? [];
8149
8158
  if (!o || !Hr(a)) return null;
8150
- const s = X(e.position) ? Vh(a, t, e.mainAxis) : kh(a, t, n);
8159
+ const s = X(e.position) ? Lh(a, t, e.mainAxis) : Vh(a, t, n);
8151
8160
  return {
8152
8161
  hit: {
8153
8162
  layerId: e.layerId,
@@ -8164,17 +8173,17 @@ function Lh(e, t, n) {
8164
8173
  distance: xa(s, t, n)
8165
8174
  };
8166
8175
  }
8167
- function Vh(e, t, n) {
8176
+ function Lh(e, t, n) {
8168
8177
  const r = In(n, t);
8169
- return Pn(e, (a) => Ih(a, n, r), { shortCircuitOnZero: !0 });
8178
+ return Nn(e, (a) => Ih(a, n, r), { shortCircuitOnZero: !0 });
8170
8179
  }
8171
- function kh(e, t, n) {
8172
- return Pn(e, (o) => xa(o, t, n));
8180
+ function Vh(e, t, n) {
8181
+ return Nn(e, (o) => xa(o, t, n));
8173
8182
  }
8174
8183
  function Eh(e, t, n) {
8175
- return Pn(e, (o) => Math.abs(In(n, o) - t));
8184
+ return Nn(e, (o) => Math.abs(In(n, o) - t));
8176
8185
  }
8177
- function Pn(e, t, { shortCircuitOnZero: n = !1 } = {}) {
8186
+ function Nn(e, t, { shortCircuitOnZero: n = !1 } = {}) {
8178
8187
  let r = e[0], o = t(r);
8179
8188
  if (n && o === 0) return r;
8180
8189
  for (let a = 1; a < e.length; a += 1) {
@@ -8245,7 +8254,7 @@ function Rh({ layer: e, cursor: t, aspectRatio: n, warmStarts: r }) {
8245
8254
  return o ? { kind: "buckets", match: o } : null;
8246
8255
  }
8247
8256
  case "rects": {
8248
- const o = Lh(e, t, n);
8257
+ const o = kh(e, t, n);
8249
8258
  return o ? { kind: "rects", match: o } : null;
8250
8259
  }
8251
8260
  case "points": {
@@ -8256,10 +8265,10 @@ function Rh({ layer: e, cursor: t, aspectRatio: n, warmStarts: r }) {
8256
8265
  return null;
8257
8266
  }
8258
8267
  }
8259
- const be = { primary: null, group: [], related: /* @__PURE__ */ new Map() }, Ph = 1;
8260
- class Xy {
8268
+ const be = { primary: null, group: [], related: /* @__PURE__ */ new Map() }, Nh = 1;
8269
+ class qy {
8261
8270
  constructor({ layers: t, coordSystem: n }) {
8262
- this.layerIndexes = [], this.layerRefs = [], this.aspectRatio = Ph, this.warmStarts = /* @__PURE__ */ new Map(), this.cachedState = be, this.cachedKey = null, this.nonInteractiveLayerIds = /* @__PURE__ */ new Set(), this.hitTesters = /* @__PURE__ */ new Map(), this.layerIndexes = t.map((r) => Pr(r, n, this.aspectRatio)), this.layerRefs = t.map((r) => Or(r, n)), this.nonInteractiveLayerIds = Br(t);
8271
+ this.layerIndexes = [], this.layerRefs = [], this.aspectRatio = Nh, this.warmStarts = /* @__PURE__ */ new Map(), this.cachedState = be, this.cachedKey = null, this.nonInteractiveLayerIds = /* @__PURE__ */ new Set(), this.hitTesters = /* @__PURE__ */ new Map(), this.layerIndexes = t.map((r) => Nr(r, n, this.aspectRatio)), this.layerRefs = t.map((r) => Or(r, n)), this.nonInteractiveLayerIds = Br(t);
8263
8272
  }
8264
8273
  /**
8265
8274
  * Diff-aware re-index. Layers whose `data`, `geom`, `position` or the graph's coord-system
@@ -8280,11 +8289,11 @@ class Xy {
8280
8289
  const o = [], a = [];
8281
8290
  for (const s of t) {
8282
8291
  const i = r.get(s.id), c = Or(s, n);
8283
- if (i !== void 0 && Nh(i.ref, c)) {
8292
+ if (i !== void 0 && Ph(i.ref, c)) {
8284
8293
  o.push(i.index), a.push(i.ref);
8285
8294
  continue;
8286
8295
  }
8287
- this.warmStarts.delete(s.id), o.push(Pr(s, n, this.aspectRatio)), a.push(c);
8296
+ this.warmStarts.delete(s.id), o.push(Nr(s, n, this.aspectRatio)), a.push(c);
8288
8297
  }
8289
8298
  for (const s of this.warmStarts.keys())
8290
8299
  t.some((i) => i.id === s) || this.warmStarts.delete(s);
@@ -8369,7 +8378,7 @@ function Br(e) {
8369
8378
  n.interactive || t.add(n.id);
8370
8379
  return t;
8371
8380
  }
8372
- function Nh(e, t) {
8381
+ function Ph(e, t) {
8373
8382
  return e.data === t.data && e.geom === t.geom && e.position === t.position && e.coord === t.coord;
8374
8383
  }
8375
8384
  const Oh = ({
@@ -8442,7 +8451,7 @@ const Oh = ({
8442
8451
  throw new Error(`Unhandled value format: ${n.type}`);
8443
8452
  }
8444
8453
  }
8445
- }, $h = { type: "decimal" }, jy = ({
8454
+ }, $h = { type: "decimal" }, Qy = ({
8446
8455
  layers: e,
8447
8456
  coordSystem: t,
8448
8457
  scales: n,
@@ -8544,9 +8553,9 @@ function Hh(e, t, n, r) {
8544
8553
  if (n === null || t.mapping.color === void 0) return e;
8545
8554
  const o = /* @__PURE__ */ new Map();
8546
8555
  return n.domain.forEach((a, s) => {
8547
- o.set(L(a), s);
8556
+ o.set(k(a), s);
8548
8557
  }), e.map((a, s) => {
8549
- const i = r(a.observation), c = i === null ? null : L(i), l = c === null ? Number.POSITIVE_INFINITY : o.get(c) ?? Number.POSITIVE_INFINITY;
8558
+ const i = r(a.observation), c = i === null ? null : k(i), l = c === null ? Number.POSITIVE_INFINITY : o.get(c) ?? Number.POSITIVE_INFINITY;
8550
8559
  return { hit: a, originalIndex: s, rank: l };
8551
8560
  }).sort(
8552
8561
  (a, s) => a.rank === s.rank ? a.originalIndex - s.originalIndex : a.rank - s.rank
@@ -8555,7 +8564,7 @@ function Hh(e, t, n, r) {
8555
8564
  function Kh({ guides: e, locale: t, numberFormat: n }) {
8556
8565
  const r = new Map(
8557
8566
  e.colorGroups.map((a) => [
8558
- L(a.value),
8567
+ k(a.value),
8559
8568
  {
8560
8569
  label: a.label,
8561
8570
  format: vt({ valueFormat: a.valueFormat, locale: t, numberFormat: n })
@@ -8563,7 +8572,7 @@ function Kh({ guides: e, locale: t, numberFormat: n }) {
8563
8572
  ])
8564
8573
  ), o = vt({ valueFormat: { type: "text" }, locale: t, numberFormat: n });
8565
8574
  return (a) => {
8566
- const s = r.get(L(a));
8575
+ const s = r.get(k(a));
8567
8576
  return s === void 0 ? o(a) : s.label ?? s.format(a);
8568
8577
  };
8569
8578
  }
@@ -8577,7 +8586,36 @@ function Xh(e) {
8577
8586
  function jh(e, t) {
8578
8587
  return e(t.observation).encodings.find((r) => r.aesthetic === "y")?.value ?? null;
8579
8588
  }
8580
- const qy = {
8589
+ const qh = {
8590
+ /** A labelled delta between two data observations — the only built-in kind that snaps to data. */
8591
+ differenceArrow(e) {
8592
+ return { type: "annotation", kind: "differenceArrow", annotation: e };
8593
+ },
8594
+ /** A shaded box positioned in panel fractions (`[0,1]`); does not snap to a data value. */
8595
+ shape(e) {
8596
+ return { type: "annotation", kind: "shape", annotation: e };
8597
+ },
8598
+ /** A free-standing arrow with endpoints in panel fractions (`[0,1]`); does not snap to a data value. */
8599
+ freeformArrow(e) {
8600
+ return { type: "annotation", kind: "freeformArrow", annotation: e };
8601
+ },
8602
+ /** A free-standing rich-text label positioned in panel fractions (`[0,1]`); does not snap to a data value. */
8603
+ text(e) {
8604
+ return { type: "annotation", kind: "text", annotation: e };
8605
+ },
8606
+ /** Editor-only: compiles but has NO painter in `@graphysdk/react-renderer`. */
8607
+ sticker(e) {
8608
+ return { type: "annotation", kind: "sticker", annotation: e };
8609
+ },
8610
+ /** Editor-only: compiles but has NO painter in `@graphysdk/react-renderer`. */
8611
+ pinnedNumber(e) {
8612
+ return { type: "annotation", kind: "pinnedNumber", annotation: e };
8613
+ },
8614
+ /** Editor-only: compiles but has NO painter in `@graphysdk/react-renderer`. */
8615
+ comment(e) {
8616
+ return { type: "annotation", kind: "comment", annotation: e };
8617
+ }
8618
+ }, Zy = {
8581
8619
  lilac: "linear-gradient(94deg, #C9C0F7 -2.94%, #F6E6FD 92.51%)",
8582
8620
  neon_pink: "linear-gradient(93deg, #E04A95 2.61%, #FD7F92 97.51%)",
8583
8621
  blackberry: "linear-gradient(132deg, #9F9FED 2.98%, #B9E6FF 97.65%)",
@@ -8591,10 +8629,10 @@ const qy = {
8591
8629
  cool: "linear-gradient(93.55deg, #3F8EEB -6.07%, #58C8D8 113.6%)",
8592
8630
  fresh: "linear-gradient(114.37deg, #A4A4EE 4.32%, #58C8D8 87.71%)"
8593
8631
  };
8594
- function qh(...e) {
8632
+ function Qh(...e) {
8595
8633
  let t = {}, n;
8596
8634
  const [r, ...o] = e;
8597
- h(r) && !Qh(r) ? (t = r, n = o) : n = e;
8635
+ h(r) && !Zh(r) ? (t = r, n = o) : n = e;
8598
8636
  const a = {
8599
8637
  mapping: t,
8600
8638
  layers: [],
@@ -8605,10 +8643,10 @@ function qh(...e) {
8605
8643
  };
8606
8644
  return n.reduce((s, i) => Sa(s, i), a);
8607
8645
  }
8608
- function Qy(e, ...t) {
8646
+ function Jy(e, ...t) {
8609
8647
  return t.reduce((n, r) => Sa(n, r), e);
8610
8648
  }
8611
- function Qh(e) {
8649
+ function Zh(e) {
8612
8650
  return typeof e == "object" && e !== null && "type" in e;
8613
8651
  }
8614
8652
  function Sa(e, t) {
@@ -8628,20 +8666,48 @@ function Sa(e, t) {
8628
8666
  case "highlight":
8629
8667
  return { ...e, highlights: [...e.highlights, t] };
8630
8668
  case "annotation":
8631
- return {
8632
- ...e,
8633
- annotations: {
8634
- ...e.annotations,
8635
- custom: [...e.annotations?.custom ?? [], t.annotation]
8636
- }
8637
- };
8669
+ return Jh(e, t);
8638
8670
  default: {
8639
8671
  const n = t;
8640
8672
  throw new Error(`Unknown spec item type: ${n.type}`);
8641
8673
  }
8642
8674
  }
8643
8675
  }
8644
- function Zy(e) {
8676
+ function Jh(e, t) {
8677
+ const n = { ...e.annotations };
8678
+ switch (t.kind) {
8679
+ case "differenceArrow":
8680
+ n.differenceArrows = [...n.differenceArrows ?? [], t.annotation];
8681
+ break;
8682
+ case "shape":
8683
+ n.shapes = [...n.shapes ?? [], t.annotation];
8684
+ break;
8685
+ case "freeformArrow":
8686
+ n.freeformArrows = [...n.freeformArrows ?? [], t.annotation];
8687
+ break;
8688
+ case "text":
8689
+ n.textAnnotations = [...n.textAnnotations ?? [], t.annotation];
8690
+ break;
8691
+ case "sticker":
8692
+ n.stickers = [...n.stickers ?? [], t.annotation];
8693
+ break;
8694
+ case "pinnedNumber":
8695
+ n.pinnedNumbers = [...n.pinnedNumbers ?? [], t.annotation];
8696
+ break;
8697
+ case "comment":
8698
+ n.comments = [...n.comments ?? [], t.annotation];
8699
+ break;
8700
+ case "custom":
8701
+ n.custom = [...n.custom ?? [], t.annotation];
8702
+ break;
8703
+ default: {
8704
+ const r = t;
8705
+ throw new Error(`Unknown annotation kind: ${r.kind}`);
8706
+ }
8707
+ }
8708
+ return { ...e, annotations: n };
8709
+ }
8710
+ function eg(e) {
8645
8711
  const t = {};
8646
8712
  for (const r of e.geoms ?? []) {
8647
8713
  const o = r;
@@ -8661,8 +8727,9 @@ function Zy(e) {
8661
8727
  const n = {};
8662
8728
  for (const r of e.annotations ?? []) {
8663
8729
  const o = r;
8664
- n[o.type] = (a) => (Zh(o, a.coordinates), {
8730
+ n[o.type] = (a) => (ey(o, a.coordinates), {
8665
8731
  type: "annotation",
8732
+ kind: "custom",
8666
8733
  annotation: {
8667
8734
  id: a.id,
8668
8735
  type: o.type,
@@ -8674,11 +8741,11 @@ function Zy(e) {
8674
8741
  }
8675
8742
  return {
8676
8743
  geom: { ...C, ...t },
8677
- annotation: n,
8678
- createSpec: qh
8744
+ annotation: { ...qh, ...n },
8745
+ createSpec: Qh
8679
8746
  };
8680
8747
  }
8681
- function Zh(e, t) {
8748
+ function ey(e, t) {
8682
8749
  const n = e.coordinates;
8683
8750
  if (n !== void 0) {
8684
8751
  if (n.min !== void 0 && t.length < n.min)
@@ -8689,7 +8756,7 @@ function Zh(e, t) {
8689
8756
  throw new Error(`Annotation '${e.type}' accepts at most ${n.max} coordinate(s), got ${t.length}.`);
8690
8757
  }
8691
8758
  }
8692
- function Jy(e, t = {}) {
8759
+ function tg(e, t = {}) {
8693
8760
  return {
8694
8761
  type: "highlight",
8695
8762
  id: t.id,
@@ -8698,18 +8765,18 @@ function Jy(e, t = {}) {
8698
8765
  layerIndex: t.layerIndex
8699
8766
  };
8700
8767
  }
8701
- function eg(e) {
8768
+ function ng(e) {
8702
8769
  return {
8703
8770
  mapping: e.mapping,
8704
8771
  layers: e.layers,
8705
- scales: e.scales.map(ey),
8772
+ scales: e.scales.map(ny),
8706
8773
  transforms: e.transforms,
8707
- highlights: e.highlights.map((t) => Jh(t, e.layers)),
8774
+ highlights: e.highlights.map((t) => ty(t, e.layers)),
8708
8775
  coords: e.coords,
8709
8776
  config: e.config
8710
8777
  };
8711
8778
  }
8712
- function Jh(e, t) {
8779
+ function ty(e, t) {
8713
8780
  const n = e.layerId ? t.findIndex((r) => r.id === e.layerId) : -1;
8714
8781
  return {
8715
8782
  type: "highlight",
@@ -8719,19 +8786,19 @@ function Jh(e, t) {
8719
8786
  layerIndex: n >= 0 ? n : void 0
8720
8787
  };
8721
8788
  }
8722
- function ey(e) {
8723
- return e.scaleType === "palette" ? ty(e) : e;
8789
+ function ny(e) {
8790
+ return e.scaleType === "palette" ? ry(e) : e;
8724
8791
  }
8725
- function ty(e) {
8792
+ function ry(e) {
8726
8793
  return {
8727
8794
  ...e,
8728
- palette: ny(e.palette)
8795
+ palette: oy(e.palette)
8729
8796
  };
8730
8797
  }
8731
- function ny(e) {
8798
+ function oy(e) {
8732
8799
  return e.type === "custom" ? { type: "custom", id: e.id } : e;
8733
8800
  }
8734
- class tg {
8801
+ class rg {
8735
8802
  constructor(t = {}) {
8736
8803
  this.undoStack = [], this.redoStack = [], this.listeners = /* @__PURE__ */ new Set(), this.isEmitting = !1, this.cachedSnapshot = null, this.maxHistorySize = t.maxHistorySize ?? 100;
8737
8804
  }
@@ -8890,7 +8957,7 @@ class Ma {
8890
8957
  return { spec: r, revert: o };
8891
8958
  }
8892
8959
  }
8893
- class La {
8960
+ class ka {
8894
8961
  constructor(t, n = {}) {
8895
8962
  this.type = "set-headline-show", this.params = t, this.metadata = me({
8896
8963
  ...n,
@@ -8900,11 +8967,11 @@ class La {
8900
8967
  apply(t) {
8901
8968
  const n = t.config.headline.show, r = We(t, {
8902
8969
  config: { headline: { show: this.params.show } }
8903
- }), o = new La({ show: n }, this.metadata);
8970
+ }), o = new ka({ show: n }, this.metadata);
8904
8971
  return { spec: r, revert: o };
8905
8972
  }
8906
8973
  }
8907
- class Va {
8974
+ class La {
8908
8975
  constructor(t, n = {}) {
8909
8976
  this.type = "set-line-width", this.params = t, this.metadata = me({
8910
8977
  ...n,
@@ -8918,30 +8985,30 @@ class Va {
8918
8985
  const r = n.params.lineWidth, o = Zd(t, n.id, {
8919
8986
  ...n,
8920
8987
  params: { ...n.params, lineWidth: this.params.lineWidth }
8921
- }), a = new Va({ layerId: n.id, lineWidth: r }, this.metadata);
8988
+ }), a = new La({ layerId: n.id, lineWidth: r }, this.metadata);
8922
8989
  return { spec: o, revert: a };
8923
8990
  }
8924
8991
  }
8925
- function ry(e, t) {
8992
+ function ay(e, t) {
8926
8993
  return e.scales.find((n) => n.scaledAesthetic === t);
8927
8994
  }
8928
- function oy(e, t, n) {
8995
+ function sy(e, t, n) {
8929
8996
  const r = e.scales.map((o) => o.scaledAesthetic === t ? n : o);
8930
8997
  return { ...e, scales: r };
8931
8998
  }
8932
- function ay(e) {
8999
+ function iy(e) {
8933
9000
  const t = e.replace(/([A-Z])/g, " $1").toLowerCase();
8934
9001
  return t.charAt(0).toUpperCase() + t.slice(1);
8935
9002
  }
8936
- class ka {
9003
+ class Va {
8937
9004
  constructor(t, n = {}) {
8938
9005
  this.type = "set-scale-domain", this.params = t, this.metadata = me({
8939
9006
  ...n,
8940
- description: `Set ${ay(t.scaledAesthetic)} scale domain`
9007
+ description: `Set ${iy(t.scaledAesthetic)} scale domain`
8941
9008
  });
8942
9009
  }
8943
9010
  apply(t) {
8944
- const n = ry(t, this.params.scaledAesthetic);
9011
+ const n = ay(t, this.params.scaledAesthetic);
8945
9012
  if (!n || n.scaleType !== "continuous" && n.scaleType !== "datetime")
8946
9013
  return null;
8947
9014
  const r = {
@@ -8951,9 +9018,9 @@ class ka {
8951
9018
  ...n,
8952
9019
  ...this.params.domainMin !== void 0 && { domainMin: this.params.domainMin },
8953
9020
  ...this.params.domainMax !== void 0 && { domainMax: this.params.domainMax }
8954
- }, a = oy(t, this.params.scaledAesthetic, o), s = { scaledAesthetic: this.params.scaledAesthetic };
9021
+ }, a = sy(t, this.params.scaledAesthetic, o), s = { scaledAesthetic: this.params.scaledAesthetic };
8955
9022
  this.params.domainMin !== void 0 && (s.domainMin = r.min), this.params.domainMax !== void 0 && (s.domainMax = r.max);
8956
- const i = new ka(s, this.metadata);
9023
+ const i = new Va(s, this.metadata);
8957
9024
  return { spec: a, revert: i };
8958
9025
  }
8959
9026
  }
@@ -8975,11 +9042,11 @@ const Ea = 500, Ia = "normal", Ca = {
8975
9042
  heavy: 900,
8976
9043
  extraBlack: 950,
8977
9044
  ultraBlack: 950
8978
- }, ng = (e) => {
9045
+ }, og = (e) => {
8979
9046
  const t = e.style ?? Ia, n = e.weight ?? Ea, r = e.family.includes(",") ? e.family : `'${e.family}'`;
8980
9047
  return `${t} ${n} ${e.size}px ${r}`;
8981
- }, rg = (e) => typeof e == "string" ? e : Fa(e), Fa = (e) => e.text !== void 0 ? e.text : e.content ? e.content.map(Fa).join("") : "", _a = (e) => typeof e != "string" ? e ?? Ea : Ca[e], sy = "\0";
8982
- class og {
9048
+ }, ag = (e) => typeof e == "string" ? e : Fa(e), Fa = (e) => e.text !== void 0 ? e.text : e.content ? e.content.map(Fa).join("") : "", _a = (e) => typeof e != "string" ? e ?? Ea : Ca[e], cy = "\0";
9049
+ class sg {
8983
9050
  constructor(t) {
8984
9051
  this.inner = t, this.cache = /* @__PURE__ */ new Map();
8985
9052
  }
@@ -8991,10 +9058,10 @@ class og {
8991
9058
  return this.cache.set(r, a), a;
8992
9059
  }
8993
9060
  getCacheKey(t, n) {
8994
- return [n.family, n.size, _a(n.weight), n.style ?? Ia, t].join(sy);
9061
+ return [n.family, n.size, _a(n.weight), n.style ?? Ia, t].join(cy);
8995
9062
  }
8996
9063
  }
8997
- const iy = {
9064
+ const ly = {
8998
9065
  " ": 0.25,
8999
9066
  "!": 0.27,
9000
9067
  '"': 0.36,
@@ -9090,14 +9157,14 @@ const iy = {
9090
9157
  "|": 0.26,
9091
9158
  "}": 0.33,
9092
9159
  "~": 0.56
9093
- }, cy = 0.55, ly = 1.05, uy = 0.84, dy = 0.21;
9094
- class ag {
9160
+ }, uy = 0.55, dy = 1.05, my = 0.84, py = 0.21;
9161
+ class ig {
9095
9162
  measureText(t, n) {
9096
9163
  let r = 0;
9097
9164
  for (const i of t)
9098
- r += (iy[i] ?? cy) * n.size;
9099
- _a(n.weight) >= Ca.semiBold && (r *= ly);
9100
- const a = uy * n.size, s = dy * n.size;
9165
+ r += (ly[i] ?? uy) * n.size;
9166
+ _a(n.weight) >= Ca.semiBold && (r *= dy);
9167
+ const a = my * n.size, s = py * n.size;
9101
9168
  return {
9102
9169
  width: r,
9103
9170
  height: a + s,
@@ -9106,15 +9173,15 @@ class ag {
9106
9173
  };
9107
9174
  }
9108
9175
  }
9109
- function sg(e, t, n) {
9176
+ function cg(e, t, n) {
9110
9177
  const r = e[t];
9111
9178
  return typeof r == "number" ? r : n ?? null;
9112
9179
  }
9113
- function ig(e, t, n) {
9180
+ function lg(e, t, n) {
9114
9181
  const r = e[t];
9115
9182
  return typeof r == "string" ? r : n ?? null;
9116
9183
  }
9117
- class my {
9184
+ class fy {
9118
9185
  constructor() {
9119
9186
  this.columnTypes = /* @__PURE__ */ new Map(), this.kindColumns = /* @__PURE__ */ new Map(), this.rows = [];
9120
9187
  }
@@ -9162,27 +9229,27 @@ class my {
9162
9229
  return new M(r);
9163
9230
  }
9164
9231
  }
9165
- function cg() {
9166
- return new my();
9232
+ function ug() {
9233
+ return new fy();
9167
9234
  }
9168
- function lg(e) {
9235
+ function dg(e) {
9169
9236
  return {
9170
9237
  type: e.type,
9171
9238
  defaultParams: e.defaultParams ?? {},
9172
9239
  coordinates: e.coordinates
9173
9240
  };
9174
9241
  }
9175
- function ug(e, t, n, r, o) {
9242
+ function mg(e, t, n, r, o) {
9176
9243
  const a = n - t;
9177
9244
  return a === 0 ? r : r + (e - t) / a * (o - r);
9178
9245
  }
9179
9246
  export {
9180
- ku as BORDER_PRESETS,
9181
- qy as BORDER_PRESET_GRADIENTS,
9182
- Lc as BUILTIN_GEOM_NAMES,
9183
- _y as COMPILER_STAGE_KEYS,
9184
- og as CachedTextMeasurer,
9185
- tg as CommandStackManager,
9247
+ Vu as BORDER_PRESETS,
9248
+ Zy as BORDER_PRESET_GRADIENTS,
9249
+ kc as BUILTIN_GEOM_NAMES,
9250
+ Ry as COMPILER_STAGE_KEYS,
9251
+ sg as CachedTextMeasurer,
9252
+ rg as CommandStackManager,
9186
9253
  Rm as Compiler,
9187
9254
  Oo as DEFAULT_COLOR_PALETTE,
9188
9255
  Ia as DEFAULT_FONT_STYLE,
@@ -9192,10 +9259,10 @@ export {
9192
9259
  Mc as GEOM_NAMES,
9193
9260
  D as GROUP_VARIABLES,
9194
9261
  Xe as Geom,
9195
- ag as HeuristicTextMeasurer,
9196
- Xy as HoverEngine,
9262
+ ig as HeuristicTextMeasurer,
9263
+ qy as HoverEngine,
9197
9264
  Ap as LAYOUT_PADDING,
9198
- Ny as LayoutCompiler,
9265
+ By as LayoutCompiler,
9199
9266
  Kl as MONO_BASES,
9200
9267
  zl as NEON_BASES,
9201
9268
  g as POSITION_VARIABLES,
@@ -9204,49 +9271,50 @@ export {
9204
9271
  Aa as SetContentCaptionCommand,
9205
9272
  Ta as SetContentSubtitleCommand,
9206
9273
  Ma as SetContentTitleCommand,
9207
- La as SetHeadlineShowCommand,
9208
- Va as SetLineWidthCommand,
9209
- ka as SetScaleDomainCommand,
9274
+ ka as SetHeadlineShowCommand,
9275
+ La as SetLineWidthCommand,
9276
+ Va as SetScaleDomainCommand,
9210
9277
  sm as SpecResolver,
9211
9278
  de as VISUAL_VARIABLES,
9212
- Oy as buildAverageLineSymbols,
9213
- $y as buildDataLabelsContent,
9214
- ng as buildFontString,
9279
+ qh as annotation,
9280
+ $y as buildAverageLineSymbols,
9281
+ Uy as buildDataLabelsContent,
9282
+ og as buildFontString,
9215
9283
  ff as buildLayerYValueFormatter,
9216
- jy as buildTooltipContent,
9217
- Gy as computeDifferenceArrow,
9218
- Uy as computeDirectLabelsLayout,
9219
- zy as computeFreeformArrow,
9284
+ Qy as buildTooltipContent,
9285
+ Wy as computeDifferenceArrow,
9286
+ Yy as computeDirectLabelsLayout,
9287
+ jy as computeFreeformArrow,
9220
9288
  Eu as config,
9221
- eg as convertSpecToInput,
9289
+ ng as convertSpecToInput,
9222
9290
  O as coord,
9223
- Iy as createAlphaValueReader,
9291
+ Fy as createAlphaValueReader,
9224
9292
  tl as createColorValueReader,
9225
- Dy as createCompiler,
9293
+ Ny as createCompiler,
9226
9294
  al as createEmptyHighlight,
9227
- Zy as createGraphyBuilder,
9228
- Cy as createGroupValueReader,
9229
- ky as createLabelValueReader,
9230
- cg as createMarkTable,
9295
+ eg as createGraphyBuilder,
9296
+ _y as createGroupValueReader,
9297
+ Iy as createLabelValueReader,
9298
+ ug as createMarkTable,
9231
9299
  j as createRawValueReader,
9232
9300
  _o as createSegmentYReader,
9233
- Ey as createSizeValueReader,
9234
- qh as createSpec,
9235
- Fy as createStrokeWidthValueReader,
9301
+ Cy as createSizeValueReader,
9302
+ Qh as createSpec,
9303
+ Dy as createStrokeWidthValueReader,
9236
9304
  F as createValueFormatter,
9237
9305
  Fo as createXValueReader,
9238
9306
  el as createYValueReader,
9239
- lg as defineAnnotation,
9307
+ dg as defineAnnotation,
9240
9308
  te as extractConstantValue,
9241
- rg as extractPlainText,
9309
+ ag as extractPlainText,
9242
9310
  v as extractVariableName,
9243
9311
  Fn as findAxisGuide,
9244
- Hy as findLegendForAesthetic,
9245
- Wy as formatHeadline,
9246
- Yy as formatLegends,
9247
- Ky as formatRuleValue,
9312
+ zy as findLegendForAesthetic,
9313
+ Hy as formatHeadline,
9314
+ Ky as formatLegends,
9315
+ Xy as formatRuleValue,
9248
9316
  C as geom,
9249
- Ly as getAlpha,
9317
+ Vy as getAlpha,
9250
9318
  af as getAngleExtent,
9251
9319
  Zr as getColor,
9252
9320
  In as getCrossAxisCoordinate,
@@ -9257,7 +9325,7 @@ export {
9257
9325
  bt as getMainAxisCoordinate,
9258
9326
  sf as getRadiusExtent,
9259
9327
  fs as getSize,
9260
- Vy as getStrokeWidth,
9328
+ Ey as getStrokeWidth,
9261
9329
  je as getX,
9262
9330
  Oe as getXMax,
9263
9331
  ft as getXMin,
@@ -9265,26 +9333,26 @@ export {
9265
9333
  J as getYMax,
9266
9334
  Se as getYMin,
9267
9335
  Fi as getYRaw,
9268
- Jy as highlight,
9269
- ug as interpolateInScaledInterval,
9270
- Vc as isBuiltinGeomName,
9271
- By as isCartesian,
9272
- Ty as isCompilerCachingEnabled,
9336
+ tg as highlight,
9337
+ mg as interpolateInScaledInterval,
9338
+ Lc as isBuiltinGeomName,
9339
+ Gy as isCartesian,
9340
+ ky as isCompilerCachingEnabled,
9273
9341
  h as isDefined,
9274
9342
  au as isGraphConfig,
9275
- Ry as isLayerOf,
9343
+ Py as isLayerOf,
9276
9344
  X as isStackedPosition,
9277
- My as mapping,
9278
- Qy as pipe,
9345
+ Ly as mapping,
9346
+ Jy as pipe,
9279
9347
  A as prefixInternalVariable,
9280
9348
  jr as readAesthetic,
9281
- sg as readNumber,
9282
- ig as readString,
9283
- Py as resolveHeadlinePlacement,
9349
+ cg as readNumber,
9350
+ lg as readString,
9351
+ Oy as resolveHeadlinePlacement,
9284
9352
  Mt as resolveSegmentYSource,
9285
9353
  Tt as resolveYScaleAesthetic,
9286
9354
  xe as scale,
9287
- Ay as setCompilerCachingEnabled,
9355
+ My as setCompilerCachingEnabled,
9288
9356
  sn as sortByXIfContinuous,
9289
9357
  Bo as stat,
9290
9358
  ve as transform,