@graphysdk/viz-engine 1.9.0-beta.1790332457486 → 1.9.0-beta.1790336418293

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.
@@ -1,12 +1,12 @@
1
1
  import { differenceInDays as _r, isBefore as Rr, isValid as _, isWithinInterval as Cr, parse as se } from "date-fns";
2
2
  import { isEqual as Dr, isInteger as Ir, merge as Fr } from "lodash-es";
3
- var We = (e) => e instanceof Date && _(e), Js = (e) => We(e) || e === null, Qs = (e) => typeof e == "string", L = (e) => typeof e == "number" && !Number.isNaN(e) && Number.isFinite(e), Zs = (e) => L(e) || e === null, Y = Math.PI * 2, ei = 8, Nr = 1e-9, Pr = [
3
+ var We = (e) => e instanceof Date && _(e), Js = (e) => We(e) || e === null, Qs = (e) => typeof e == "string", L = (e) => typeof e == "number" && !Number.isNaN(e) && Number.isFinite(e), Zs = (e) => L(e) || e === null, Y = Math.PI * 2, ei = 8, Pr = 1e-9, Or = [
4
4
  0,
5
5
  Math.PI / 2,
6
6
  Math.PI,
7
7
  Y * 3 / 4
8
- ], Or = (e, t) => Math.abs(t - e) >= Y - Nr, ie = (e) => (e % Y + Y) % Y, Br = (e, t, r) => {
9
- if (Or(t, r)) return !0;
8
+ ], Nr = (e, t) => Math.abs(t - e) >= Y - Pr, ie = (e) => (e % Y + Y) % Y, Br = (e, t, r) => {
9
+ if (Nr(t, r)) return !0;
10
10
  const a = ie(r - t);
11
11
  return ie(e - t) <= a;
12
12
  }, ti = (e, t) => {
@@ -30,7 +30,7 @@ var We = (e) => e instanceof Date && _(e), Js = (e) => We(e) || e === null, Qs =
30
30
  $(e, a),
31
31
  $(t, r),
32
32
  $(t, a)
33
- ], s = Math.max(r, a), i = Pr.filter((l) => Br(l, e, t)).map((l) => $(l, s)), o = [...n, ...i];
33
+ ], s = Math.max(r, a), i = Or.filter((l) => Br(l, e, t)).map((l) => $(l, s)), o = [...n, ...i];
34
34
  return {
35
35
  xMin: Math.min(...o.map((l) => l.x)),
36
36
  xMax: Math.max(...o.map((l) => l.x)),
@@ -49,10 +49,10 @@ var We = (e) => e instanceof Date && _(e), Js = (e) => We(e) || e === null, Qs =
49
49
  }, ni = (e, t) => {
50
50
  const { x: r, y: a } = Yr(e, t);
51
51
  return Ur(r, a);
52
- }, Ft = "\0graphy\0_", m = (e) => `${Ft}${e}`, Nt = { x: m("constantX") }, si = {
52
+ }, Ft = "\0graphy\0_", m = (e) => `${Ft}${e}`, Pt = { x: m("constantX") }, si = {
53
53
  bar: m("barSeriesLabel"),
54
54
  line: m("lineSeriesLabel")
55
- }, Pt = {
55
+ }, Ot = {
56
56
  count: m("count"),
57
57
  mean: m("mean"),
58
58
  sum: m("sum")
@@ -64,7 +64,7 @@ var We = (e) => e instanceof Date && _(e), Js = (e) => We(e) || e === null, Qs =
64
64
  yMin: m("yMin"),
65
65
  yMax: m("yMax"),
66
66
  yRaw: m("yRaw")
67
- }, Ot = { role: m("stackRole") }, le = {
67
+ }, Nt = { role: m("stackRole") }, le = {
68
68
  color: m("color"),
69
69
  size: m("size"),
70
70
  alpha: m("alpha"),
@@ -74,14 +74,14 @@ var We = (e) => e instanceof Date && _(e), Js = (e) => We(e) || e === null, Qs =
74
74
  y: m("ruleY"),
75
75
  x: m("ruleX")
76
76
  }, ii = {
77
- ...Nt,
78
77
  ...Pt,
78
+ ...Ot,
79
79
  ...Ue,
80
80
  ...b,
81
- ...Ot,
81
+ ...Nt,
82
82
  ...le,
83
83
  ...de
84
- }, zr = new Set(Object.values(Pt)), Gr = (e) => m(`scaled_${e}`), oi = (e) => e.startsWith(Ft), jr = (e) => zr.has(e);
84
+ }, zr = new Set(Object.values(Ot)), Gr = (e) => m(`scaled_${e}`), oi = (e) => e.startsWith(Ft), jr = (e) => zr.has(e);
85
85
  function X(e) {
86
86
  return e[b.x];
87
87
  }
@@ -190,22 +190,22 @@ function fi(e, t) {
190
190
  }
191
191
  function pi(e) {
192
192
  const t = F(e.x);
193
- return t === null || t === Nt.x ? "" : t;
193
+ return t === null || t === Pt.x ? "" : t;
194
194
  }
195
195
  function F(e) {
196
196
  return he(e) ? typeof e == "string" ? e : "variable" in e ? e.variable : null : null;
197
197
  }
198
- function ke(e) {
198
+ function Le(e) {
199
199
  if (!(!he(e) || typeof e == "string") && "value" in e)
200
200
  return e.value;
201
201
  }
202
- function gi(e, t) {
202
+ function yi(e, t) {
203
203
  return [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].every((r) => at(e[r]) === at(t[r]));
204
204
  }
205
205
  function at(e) {
206
206
  const t = F(e);
207
207
  if (t !== null) return `variable:${t}`;
208
- const r = ke(e);
208
+ const r = Le(e);
209
209
  return r === void 0 ? "" : r === null ? "value:null" : r instanceof Date ? `value:date:${r.getTime()}` : `value:${typeof r}:${r}`;
210
210
  }
211
211
  var Xr = [
@@ -248,7 +248,7 @@ var Xr = [
248
248
  dashed: [1.5, 3],
249
249
  dotted: [0, 2]
250
250
  }
251
- }, yi = (e) => qr.includes(e);
251
+ }, gi = (e) => qr.includes(e);
252
252
  function pe(e) {
253
253
  return e === "stack" || e === "fill";
254
254
  }
@@ -256,7 +256,7 @@ var He = "en-GB", Vt = class extends Error {
256
256
  constructor(e) {
257
257
  super(e.message, e.cause !== void 0 ? { cause: e.cause } : void 0), this.name = new.target.name, this.code = e.code, this.context = e.context, this.suggestion = e.suggestion;
258
258
  }
259
- }, Le = class extends Vt {
259
+ }, ye = class extends Vt {
260
260
  constructor(e) {
261
261
  super(e), this.kind = "user-input";
262
262
  }
@@ -267,9 +267,9 @@ var He = "en-GB", Vt = class extends Error {
267
267
  code: e.code ?? "INTERNAL_INVARIANT"
268
268
  }), this.kind = "internal";
269
269
  }
270
- }, Wt = (e) => e.type === "lookup", Jr = (e) => e.type === "text", be = (e) => e.type === "date" || e.type === "datetime" || e.type === "year" || e.type === "month_year" || e.type === "month" || e.type === "day_month" || e.type === "weekly_date_range" || e.type === "weekly_date_range_with_year" || e.type === "quarter" || e.type === "time", Qr = (e) => e.type === "decimal" || e.type === "integer" || e.type === "percentage" || e.type === "duration" || e.type === "currency", mi = (e) => e.type === "currency", bi = (e) => e.type === "month" || e.type === "day_month" || e.type === "weekly_date_range", Ut = (e) => {
270
+ }, Wt = (e) => e.type === "lookup", Jr = (e) => e.type === "text", ve = (e) => e.type === "date" || e.type === "datetime" || e.type === "year" || e.type === "month_year" || e.type === "month" || e.type === "day_month" || e.type === "weekly_date_range" || e.type === "weekly_date_range_with_year" || e.type === "quarter" || e.type === "time", Qr = (e) => e.type === "decimal" || e.type === "integer" || e.type === "percentage" || e.type === "duration" || e.type === "currency", mi = (e) => e.type === "currency", bi = (e) => e.type === "month" || e.type === "day_month" || e.type === "weekly_date_range", Ut = (e) => {
271
271
  if (Wt(e)) return Ut(e.fallback);
272
- if (be(e)) return "temporal";
272
+ if (ve(e)) return "temporal";
273
273
  if (Qr(e)) return "numeric";
274
274
  if (Jr(e)) return "categorical";
275
275
  throw new R({ message: `No data type found for value format: ${e.type}` });
@@ -292,7 +292,7 @@ var He = "en-GB", Vt = class extends Error {
292
292
  "m",
293
293
  "b",
294
294
  "t"
295
- ], ta = new RegExp(`^-?(\\d{1,3}(,\\d{3})*|\\d+)\\.?\\d*(${$e.join("|")})?$`, "i"), ra = /^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?%?$/, Q = (e) => e === null || e instanceof Date || Array.isArray(e) || typeof e == "boolean" ? !1 : typeof e == "string" ? ta.test(e) && !Number.isNaN(Number(e.replace(new RegExp(`[,${$e.join("")}]`, "gi"), ""))) : !Number.isNaN(Number(e)), Yt = (e) => Q(e) ? !0 : typeof e == "string" ? ra.test(e) : !1, aa = /^\d{4}-\d{2}-\d{2}(T|\s)\d{1,2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|\+00:00)?$/, na = /^\s*(1[89]\d{2}|2[01]\d{2})\s*$/, sa = [
295
+ ], ta = new RegExp(`^-?(\\d{1,3}(,\\d{3})*|\\d+)\\.?\\d*(${$e.join("|")})?$`, "i"), ra = /^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?%?$/, Q = (e) => e === null || e instanceof Date || Array.isArray(e) || typeof e == "boolean" ? !1 : typeof e == "string" ? ta.test(e) && !Number.isNaN(Number(e.replace(new RegExp(`[,${$e.join("")}]`, "gi"), ""))) : Number.isFinite(Number(e)), Yt = (e) => Q(e) ? !0 : typeof e == "string" ? ra.test(e) : !1, aa = /^\d{4}-\d{2}-\d{2}(T|\s)\d{1,2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|\+00:00)?$/, na = /^\s*(1[89]\d{2}|2[01]\d{2})\s*$/, sa = [
296
296
  [/\bJan\b/i, "January"],
297
297
  [/\bFeb\b/i, "February"],
298
298
  [/\bMar\b/i, "March"],
@@ -526,25 +526,25 @@ var He = "en-GB", Vt = class extends Error {
526
526
  return t;
527
527
  }, Kt = (e, t = He) => {
528
528
  const r = ge(e);
529
- return _e(r) ? { type: "datetime" } : Xt(t).find((a) => !be(a) || a.type === "month" && r.length < la ? !1 : a.dateFormat && _(se(r, a.dateFormat, /* @__PURE__ */ new Date())));
530
- }, _e = (e) => aa.test(e.trim()), ga = (e) => {
529
+ return _e(r) ? { type: "datetime" } : Xt(t).find((a) => !ve(a) || a.type === "month" && r.length < la ? !1 : a.dateFormat && _(se(r, a.dateFormat, /* @__PURE__ */ new Date())));
530
+ }, _e = (e) => aa.test(e.trim()), ya = (e) => {
531
531
  if (e instanceof Date) return _(e) ? e : null;
532
532
  if (typeof e != "string" || !_e(e)) return null;
533
533
  const t = new Date(e.trim());
534
534
  return _(t) ? t : null;
535
- }, ya = (e, t = He) => {
535
+ }, ga = (e, t = He) => {
536
536
  const [r, a] = e.split(fa);
537
537
  if (!r || !a) return;
538
538
  const n = ge(r).trim(), s = ge(a).trim();
539
539
  return ma(t).find((i) => {
540
- if (!be(i) || !i.dateFormat) return !1;
540
+ if (!ve(i) || !i.dateFormat) return !1;
541
541
  const o = se(n, i.dateFormat, /* @__PURE__ */ new Date()), l = se(s, i.dateFormat, /* @__PURE__ */ new Date());
542
542
  if (!_(o) || !_(l)) return !1;
543
- const c = new Zr(), d = c.incrementYearIfNeeded(o), f = c.incrementYearIfNeeded(l), u = _r(f, d);
544
- return Cr(new Date(d.getFullYear(), da, ha), {
545
- start: d,
543
+ const c = new Zr(), u = c.incrementYearIfNeeded(o), f = c.incrementYearIfNeeded(l), d = _r(f, u);
544
+ return Cr(new Date(u.getFullYear(), da, ha), {
545
+ start: u,
546
546
  end: f
547
- }) && u === ua ? !0 : u === ca;
547
+ }) && d === ua ? !0 : d === ca;
548
548
  });
549
549
  }, Xt = (e) => {
550
550
  const t = {
@@ -674,14 +674,14 @@ var He = "en-GB", Vt = class extends Error {
674
674
  return _(i) ? De(i) : null;
675
675
  }
676
676
  for (const i of Xt(r)) {
677
- if (!be(i) || !i.dateFormat) continue;
677
+ if (!ve(i) || !i.dateFormat) continue;
678
678
  const o = se(a, i.dateFormat, n);
679
679
  if (_(o)) return De(o);
680
680
  }
681
681
  const s = new Date(a);
682
682
  return $t(s) ? _e(a) ? s : De(s) : null;
683
683
  }, nr = (e) => {
684
- if (typeof e == "number") return Number.isNaN(e) ? null : e;
684
+ if (typeof e == "number") return Number.isFinite(e) ? e : null;
685
685
  if (typeof e != "string") return null;
686
686
  let t = e.trim();
687
687
  if (!Q(t)) return null;
@@ -692,14 +692,14 @@ var He = "en-GB", Vt = class extends Error {
692
692
  }
693
693
  return Number(t.split(",").join("")) * r;
694
694
  }, Ea = (e) => {
695
- if (typeof e == "number") return Number.isNaN(e) ? null : e;
695
+ if (typeof e == "number") return Number.isFinite(e) ? e : null;
696
696
  if (typeof e != "string") return null;
697
697
  const t = e.trim();
698
698
  if (!Yt(t)) return null;
699
699
  const r = Number(t.replace(/%/g, "").replace(/,/g, "")) / 100;
700
700
  return Number.isNaN(r) ? null : r;
701
701
  }, xa = (e) => {
702
- if (typeof e == "number") return Number.isNaN(e) ? null : e;
702
+ if (typeof e == "number") return Number.isFinite(e) ? e : null;
703
703
  if (typeof e != "string") return null;
704
704
  const t = e.trim();
705
705
  return Qt(t) ? nr(Zt(t)) : null;
@@ -709,7 +709,7 @@ var He = "en-GB", Vt = class extends Error {
709
709
  }, Ta = (e) => String(e).trim(), De = (e) => new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds())), wa = (e, t, r) => {
710
710
  if (t.type === "text" && typeof e == "string") return e;
711
711
  const a = rr(e, t, r);
712
- return a !== null || !be(t) ? a : ga(e);
712
+ return a !== null || !ve(t) ? a : ya(e);
713
713
  }, ae = process.env.NODE_ENV !== "production";
714
714
  var Re = !0, Ai = (e) => {
715
715
  Re = e;
@@ -792,32 +792,40 @@ var Re = !0, Ai = (e) => {
792
792
  function ir(e, t) {
793
793
  return La.has(e) ? "numeric" : t;
794
794
  }
795
- function or(e, t, r) {
796
- const a = r?.length ?? t.length;
797
- if (e === "count") return a;
795
+ function or(e, t, r, a) {
796
+ if (a !== void 0 && a.type !== "numeric" && (e === "sum" || e === "mean" || e === "median")) throw new ye({
797
+ code: "INCOMPATIBLE_TYPE",
798
+ message: `'${e}' requires a numeric variable (got '${a.type}' for '${a.variableName}')`,
799
+ context: {
800
+ variableName: a.variableName,
801
+ variableType: a.type
802
+ }
803
+ });
804
+ const n = r?.length ?? t.length;
805
+ if (e === "count") return n;
798
806
  if (e === "median" || e === "mode") {
799
- const i = [];
800
- for (let o = 0; o < a; o++) {
801
- const l = Ie(t, r, o);
802
- Fe(l) && i.push(l);
807
+ const o = [];
808
+ for (let l = 0; l < n; l++) {
809
+ const c = Ie(t, r, l);
810
+ Fe(c) && o.push(c);
803
811
  }
804
- return i.length === 0 ? null : e === "median" ? Ca(i) : Da(i);
812
+ return o.length === 0 ? null : e === "median" ? Ca(o) : Da(o);
805
813
  }
806
814
  if (e === "sum" || e === "mean") {
807
- let i = 0, o = 0;
808
- for (let l = 0; l < a; l++) {
809
- const c = Ie(t, r, l);
810
- Fe(c) && (i++, o += Number(c));
815
+ let o = 0, l = 0;
816
+ for (let c = 0; c < n; c++) {
817
+ const u = Ie(t, r, c);
818
+ Fe(u) && (o++, l += Number(u));
811
819
  }
812
- return i === 0 ? null : e === "sum" ? o : o / i;
820
+ return o === 0 ? null : e === "sum" ? l : l / o;
813
821
  }
814
- const n = e === "min" ? -1 : 1;
815
- let s = null;
816
- for (let i = 0; i < a; i++) {
817
- const o = Ie(t, r, i);
818
- Fe(o) && (s === null || _a(o, s) === n) && (s = o);
822
+ const s = e === "min" ? -1 : 1;
823
+ let i = null;
824
+ for (let o = 0; o < n; o++) {
825
+ const l = Ie(t, r, o);
826
+ Fe(l) && (i === null || _a(l, i) === s) && (i = l);
819
827
  }
820
- return s;
828
+ return i;
821
829
  }
822
830
  var Ie = (e, t, r) => e[t?.[r] ?? r] ?? null, Fe = (e) => e !== null && !(typeof e == "number" && Number.isNaN(e)), _a = (e, t) => e === null || t === null ? 0 : e < t ? -1 : e > t ? 1 : 0, Ra = (e) => e instanceof Date ? e.getTime() : e ?? null;
823
831
  function Ca(e) {
@@ -905,8 +913,8 @@ var Ia = (e) => e == null || typeof e == "number" && Number.isNaN(e), Fa = (e) =
905
913
  for (let o = 0; o < this.rowCount; o++) (Ia(a[o]) ? n : s).push(o);
906
914
  const i = r === "asc" ? 1 : -1;
907
915
  return s.sort((o, l) => {
908
- const c = a[o], d = a[l];
909
- return c < d ? -i : c > d ? i : 0;
916
+ const c = a[o], u = a[l];
917
+ return c < u ? -i : c > u ? i : 0;
910
918
  }), n.length === 0 ? s : r === "asc" ? [...n, ...s] : [...s, ...n];
911
919
  }
912
920
  partition(t) {
@@ -931,18 +939,18 @@ var Ia = (e) => e == null || typeof e == "number" && Number.isNaN(e), Fa = (e) =
931
939
  return [...n.values()];
932
940
  }
933
941
  fold(t, r, a) {
934
- const n = this.names.filter((u) => !t.includes(u)), s = this.rowCount * t.length, i = n.map((u) => ({
935
- name: u,
936
- source: this.values(u) ?? [],
942
+ const n = this.names.filter((d) => !t.includes(d)), s = this.rowCount * t.length, i = n.map((d) => ({
943
+ name: d,
944
+ source: this.values(d) ?? [],
937
945
  repeated: new Array(s)
938
- })), o = t.map((u) => this.values(u) ?? []), l = new Array(s), c = new Array(s);
939
- let d = 0;
940
- for (let u = 0; u < this.rowCount; u++) for (let p = 0; p < t.length; p++, d++) {
941
- for (const y of i) y.repeated[d] = y.source[u] ?? null;
942
- l[d] = t[p] ?? "", c[d] = o[p]?.[u] ?? null;
946
+ })), o = t.map((d) => this.values(d) ?? []), l = new Array(s), c = new Array(s);
947
+ let u = 0;
948
+ for (let d = 0; d < this.rowCount; d++) for (let p = 0; p < t.length; p++, u++) {
949
+ for (const g of i) g.repeated[u] = g.source[d] ?? null;
950
+ l[u] = t[p] ?? "", c[u] = o[p]?.[d] ?? null;
943
951
  }
944
952
  const f = /* @__PURE__ */ new Map();
945
- for (const { name: u, repeated: p } of i) f.set(u, p);
953
+ for (const { name: d, repeated: p } of i) f.set(d, p);
946
954
  return f.set(r, l), f.set(a, c), new U([
947
955
  ...n,
948
956
  r,
@@ -972,7 +980,7 @@ var Ia = (e) => e == null || typeof e == "number" && Number.isNaN(e), Fa = (e) =
972
980
  return new U(this.names, new Map(this.columns), this.rowCount);
973
981
  }
974
982
  };
975
- var Na = "value", fe = {
983
+ var Pa = "value", fe = {
976
984
  numeric: { type: "decimal" },
977
985
  categorical: { type: "text" },
978
986
  temporal: { type: "datetime" }
@@ -1125,10 +1133,13 @@ var Na = "value", fe = {
1125
1133
  return null;
1126
1134
  }
1127
1135
  groupBy(...t) {
1128
- return new Pa(t, this.table, this.variableMetadata);
1136
+ return new Oa(t, this.table, this.variableMetadata);
1129
1137
  }
1130
1138
  rollup(t) {
1131
- const r = ze.from(Object.fromEntries(Object.entries(t).map(([n, { variableName: s, aggregation: i }]) => [n, [or(i, cr(this.table, s, i))]]))), a = {};
1139
+ const r = ze.from(Object.fromEntries(Object.entries(t).map(([n, { variableName: s, aggregation: i }]) => [n, [or(i, cr(this.table, s, i), void 0, {
1140
+ type: this.variableMetadata[s]?.type ?? "numeric",
1141
+ variableName: s
1142
+ })]]))), a = {};
1132
1143
  for (const [n, { variableName: s, aggregation: i }] of Object.entries(t)) {
1133
1144
  const o = this.variableMetadata[s], l = o?.type ?? "numeric", c = o?.valueFormat ?? fe[l];
1134
1145
  a[n] = {
@@ -1138,48 +1149,48 @@ var Na = "value", fe = {
1138
1149
  }
1139
1150
  return k.fromTrusted(r, a);
1140
1151
  }
1141
- reshapeFromWideToLong({ keep: t, reshape: r, keyName: a = "key", valueName: n = Na } = {}) {
1142
- const { numeric: s, categorical: i, temporal: o } = this.groupVariableNamesByType(), l = t ?? [...i, ...o], c = r ?? s.filter((u) => !l.includes(u));
1143
- if (l.includes(a) || l.includes(n)) throw new Le({
1152
+ reshapeFromWideToLong({ keep: t, reshape: r, keyName: a = "key", valueName: n = Pa } = {}) {
1153
+ const { numeric: s, categorical: i, temporal: o } = this.groupVariableNamesByType(), l = t ?? [...i, ...o], c = r ?? s.filter((d) => !l.includes(d));
1154
+ if (l.includes(a) || l.includes(n)) throw new ye({
1144
1155
  code: "INVALID_DATA_SHAPE",
1145
1156
  message: `The variables to keep includes the variables '${a}' or '${n}' to create the key and value variables`
1146
1157
  });
1147
1158
  if (c.length === 0) {
1148
- const u = {};
1159
+ const d = {};
1149
1160
  for (const p of l) {
1150
- const y = this.variableMetadata[p];
1151
- y && (u[p] = {
1152
- type: y.type,
1161
+ const g = this.variableMetadata[p];
1162
+ g && (d[p] = {
1163
+ type: g.type,
1153
1164
  values: [],
1154
- valueFormat: y.valueFormat
1165
+ valueFormat: g.valueFormat
1155
1166
  });
1156
1167
  }
1157
- return u[a] = {
1168
+ return d[a] = {
1158
1169
  type: "categorical",
1159
1170
  values: [],
1160
1171
  valueFormat: { type: "text" }
1161
- }, u[n] = {
1172
+ }, d[n] = {
1162
1173
  type: "numeric",
1163
1174
  values: [],
1164
1175
  valueFormat: { type: "decimal" }
1165
- }, new k(u);
1176
+ }, new k(d);
1166
1177
  }
1167
- if (c.filter((u) => this.variableMetadata[u]?.type !== "numeric").length > 0) throw new Le({
1178
+ if (c.filter((d) => this.variableMetadata[d]?.type !== "numeric").length > 0) throw new ye({
1168
1179
  code: "INVALID_DATA_SHAPE",
1169
1180
  message: "Only numeric variables can be reshaped"
1170
1181
  });
1171
- const d = this.table.select([...l, ...c]).fold(c, a, n), f = {};
1172
- for (const u of l) {
1173
- const p = this.variableMetadata[u];
1174
- p && (f[u] = p);
1182
+ const u = this.table.select([...l, ...c]).fold(c, a, n), f = {};
1183
+ for (const d of l) {
1184
+ const p = this.variableMetadata[d];
1185
+ p && (f[d] = p);
1175
1186
  }
1176
1187
  return f[a] = {
1177
1188
  type: "categorical",
1178
1189
  valueFormat: { type: "text" }
1179
1190
  }, f[n] = {
1180
1191
  type: "numeric",
1181
- valueFormat: Oa(this.variableMetadata, c, a)
1182
- }, k.fromTrusted(d, f);
1192
+ valueFormat: Na(this.variableMetadata, c, a)
1193
+ }, k.fromTrusted(u, f);
1183
1194
  }
1184
1195
  print() {
1185
1196
  console.table(this.variableMetadata), console.table([...this.table]);
@@ -1212,7 +1223,7 @@ var Na = "value", fe = {
1212
1223
  normalizeRawValues(t, r) {
1213
1224
  switch (t) {
1214
1225
  case "numeric":
1215
- return r.map((a) => typeof a != "number" || Number.isNaN(a) ? null : a);
1226
+ return r.map((a) => typeof a != "number" || !Number.isFinite(a) ? null : a);
1216
1227
  case "categorical":
1217
1228
  return r.map((a) => typeof a != "string" ? null : a);
1218
1229
  case "temporal":
@@ -1232,7 +1243,7 @@ var Na = "value", fe = {
1232
1243
  }
1233
1244
  return s;
1234
1245
  }
1235
- }, Pa = class {
1246
+ }, Oa = class {
1236
1247
  constructor(e, t, r) {
1237
1248
  this.groupedBy = e, this.table = t, this.variableMetadata = r;
1238
1249
  }
@@ -1255,29 +1266,32 @@ var Na = "value", fe = {
1255
1266
  }];
1256
1267
  }));
1257
1268
  for (const [n, { variableName: s, aggregation: i }] of Object.entries(e)) {
1258
- const o = cr(this.table, s, i);
1259
- r[n] = t.map(({ indices: f }) => or(i, o, f));
1260
- const l = this.variableMetadata[s], c = l?.type ?? "numeric", d = l?.valueFormat ?? fe[c];
1269
+ const o = cr(this.table, s, i), l = this.variableMetadata[s], c = l?.type ?? "numeric";
1270
+ r[n] = t.map(({ indices: f }) => or(i, o, f, {
1271
+ type: c,
1272
+ variableName: s
1273
+ }));
1274
+ const u = l?.valueFormat ?? fe[c];
1261
1275
  a[n] = {
1262
1276
  type: ir(i, c),
1263
- valueFormat: lr(i, d)
1277
+ valueFormat: lr(i, u)
1264
1278
  };
1265
1279
  }
1266
1280
  return ne.fromTrusted(ze.from(r), a);
1267
1281
  }
1268
1282
  };
1269
- function Oa(e, t, r) {
1283
+ function Na(e, t, r) {
1270
1284
  const a = t.map((o) => e[o]?.valueFormat ?? { type: "decimal" }), [n, ...s] = a;
1271
1285
  if (!n) return { type: "decimal" };
1272
- for (const o of a) if (o.type === "lookup") throw new Le({
1286
+ for (const o of a) if (o.type === "lookup") throw new ye({
1273
1287
  code: "INVALID_DATA_SHAPE",
1274
1288
  message: "Cannot reshape: a source column has a lookup format and lookups cannot nest"
1275
1289
  });
1276
1290
  if (s.every((o) => Dr(o, n)) || n.type === "lookup") return n;
1277
1291
  const i = {};
1278
1292
  for (const [o, l] of t.entries()) {
1279
- const c = Ye([l]), d = a[o];
1280
- d && d.type !== "lookup" && (i[c] = d);
1293
+ const c = Ye([l]), u = a[o];
1294
+ u && u.type !== "lookup" && (i[c] = u);
1281
1295
  }
1282
1296
  return {
1283
1297
  type: "lookup",
@@ -1296,7 +1310,7 @@ var ur = class {
1296
1310
  get(e) {
1297
1311
  if (!this.items.has(e)) {
1298
1312
  const t = [...this.items.keys()].map((r) => `'${r}'`).join(", ");
1299
- throw new Le({
1313
+ throw new ye({
1300
1314
  code: "UNKNOWN_REGISTERED_TYPE",
1301
1315
  message: `Unknown ${this.label}: '${e}' (available: ${t})`,
1302
1316
  context: {
@@ -1320,7 +1334,7 @@ var ur = class {
1320
1334
  if (Q(r)) return { type: "decimal" };
1321
1335
  const a = typeof r == "string" && Kt(r, t);
1322
1336
  if (a) return a;
1323
- const n = typeof r == "string" && ya(r, t);
1337
+ const n = typeof r == "string" && ga(r, t);
1324
1338
  return n || ($t(e) ? { type: "date" } : Yt(e) ? { type: "percentage" } : Qt(e) && typeof e == "string" ? {
1325
1339
  type: "currency",
1326
1340
  iso: va(e)
@@ -1334,8 +1348,8 @@ var ur = class {
1334
1348
  if (o._metadata?.isHidden) continue;
1335
1349
  const l = a.get(o.key);
1336
1350
  if (oe(l) && s) continue;
1337
- const c = o.valueFormat ?? (oe(l) ? Wa : i === n ? Va : Ba(l, t)), d = Ut(c);
1338
- r[o.key] = za(o.key, e.rows, c, d, t);
1351
+ const c = o.valueFormat ?? (oe(l) ? Wa : i === n ? Va : Ba(l, t)), u = Ut(c);
1352
+ r[o.key] = za(o.key, e.rows, c, u, t);
1339
1353
  }
1340
1354
  return new ne(r);
1341
1355
  }, wi = class extends ka {
@@ -1462,7 +1476,7 @@ var nn = [
1462
1476
  "diagonal",
1463
1477
  "dots",
1464
1478
  "crosshatch"
1465
- ], sn = ["tile", "stretch"], pr = (e) => typeof e == "object" && e !== null && "gradient" in e, gr = (e) => typeof e == "object" && e !== null && "pattern" in e, on = (e) => typeof e == "object" && e !== null && "image" in e, Xe = (e) => typeof e != "object" ? e : pr(e) ? e.stops[0]?.color ?? "transparent" : gr(e) ? e.color : e.fallback, Ci = (e) => typeof e == "string" ? e : JSON.stringify(e), ln = [
1479
+ ], sn = ["tile", "stretch"], pr = (e) => typeof e == "object" && e !== null && "gradient" in e, yr = (e) => typeof e == "object" && e !== null && "pattern" in e, on = (e) => typeof e == "object" && e !== null && "image" in e, Xe = (e) => typeof e != "object" ? e : pr(e) ? e.stops[0]?.color ?? "transparent" : yr(e) ? e.color : e.fallback, Ci = (e) => typeof e == "string" ? e : JSON.stringify(e), ln = [
1466
1480
  "topLeft",
1467
1481
  "topRight",
1468
1482
  "bottomRight",
@@ -1495,7 +1509,7 @@ var nn = [
1495
1509
  "overlay",
1496
1510
  "darken",
1497
1511
  "lighten"
1498
- ], gn = [
1512
+ ], yn = [
1499
1513
  "circle",
1500
1514
  "square",
1501
1515
  "diamond",
@@ -1541,12 +1555,12 @@ var nn = [
1541
1555
  "margin",
1542
1556
  "shadow",
1543
1557
  "blendMode"
1544
- ], ct = 1, ut = 1e3, dt = "'none' or a shadow object { offsetX, offsetY, blur, color }", ht = "a non-negative number of pixels, or an object of those per edge", yn = "a non-empty color string, a { light, dark } pair, or a token(...) reference", mn = [
1558
+ ], ct = 1, ut = 1e3, dt = "'none' or a shadow object { offsetX, offsetY, blur, color }", ht = "a non-negative number of pixels, or an object of those per edge", gn = "a non-empty color string, a { light, dark } pair, or a token(...) reference", mn = [
1545
1559
  "top",
1546
1560
  "right",
1547
1561
  "bottom",
1548
1562
  "left"
1549
- ], Me = "a color, a { gradient, stops } object, a { pattern, color } object, or an { image, fallback } object", ft = "a number of pixels, or { topLeft, topRight, bottomRight, bottomLeft } in pixels", Ce = (e) => typeof e == "object" && e !== null && typeof e.light == "string" && typeof e.dark == "string", yr = (e) => typeof e == "object" && e !== null && typeof e.token == "string", bn = (e) => typeof e == "string" ? e.trim().length > 0 : Ce(e) && e.light.trim().length > 0 && e.dark.trim().length > 0;
1563
+ ], Te = "a color, a { gradient, stops } object, a { pattern, color } object, or an { image, fallback } object", ft = "a number of pixels, or { topLeft, topRight, bottomRight, bottomLeft } in pixels", Ce = (e) => typeof e == "object" && e !== null && typeof e.light == "string" && typeof e.dark == "string", gr = (e) => typeof e == "object" && e !== null && typeof e.token == "string", bn = (e) => typeof e == "string" ? e.trim().length > 0 : Ce(e) && e.light.trim().length > 0 && e.dark.trim().length > 0;
1550
1564
  function h(e) {
1551
1565
  return { token: e };
1552
1566
  }
@@ -1560,7 +1574,7 @@ var pt = (e, t) => {
1560
1574
  }
1561
1575
  const r = Object.entries(e).map(([a, n]) => [a, pt(n, t)]);
1562
1576
  return r.every(([a, n]) => n === e[a]) ? e : Object.fromEntries(r);
1563
- }, x = (e) => typeof e == "number" && Number.isFinite(e), g = (e, t) => ({
1577
+ }, x = (e) => typeof e == "number" && Number.isFinite(e), y = (e, t) => ({
1564
1578
  status: "rejected",
1565
1579
  expected: e,
1566
1580
  actual: t
@@ -1569,14 +1583,14 @@ var pt = (e, t) => {
1569
1583
  return (r) => e.includes(r) ? {
1570
1584
  status: "accepted",
1571
1585
  value: r
1572
- } : g(t, r);
1586
+ } : y(t, r);
1573
1587
  }, K = (e, t) => {
1574
1588
  if (typeof e == "string")
1575
1589
  return e.trim().length > 0 ? {
1576
1590
  status: "accepted",
1577
1591
  value: e
1578
- } : g("a non-empty color string", e);
1579
- if (yr(e)) {
1592
+ } : y("a non-empty color string", e);
1593
+ if (gr(e)) {
1580
1594
  const r = t[e.token];
1581
1595
  return r === void 0 ? {
1582
1596
  status: "unknownToken",
@@ -1595,17 +1609,17 @@ var pt = (e, t) => {
1595
1609
  light: e.light,
1596
1610
  dark: e.dark
1597
1611
  }
1598
- } : g(yn, e);
1612
+ } : y(gn, e);
1599
1613
  }, vn = (e, t) => {
1600
- if (typeof e != "object" || e === null || Ce(e) || yr(e)) return K(e, t);
1614
+ if (typeof e != "object" || e === null || Ce(e) || gr(e)) return K(e, t);
1601
1615
  const r = e;
1602
1616
  if (pr(r)) {
1603
1617
  const a = r.gradient;
1604
- if (a !== "linear" && a !== "radial") return g(Me, e);
1605
- if (!Array.isArray(r.stops) || r.stops.length < 2) return g("a gradient with at least two stops", e);
1618
+ if (a !== "linear" && a !== "radial") return y(Te, e);
1619
+ if (!Array.isArray(r.stops) || r.stops.length < 2) return y("a gradient with at least two stops", e);
1606
1620
  const n = [];
1607
1621
  for (const s of r.stops) {
1608
- if (!x(s.offset) || s.offset < 0 || s.offset > 1) return g("a gradient stop offset in [0, 1]", e);
1622
+ if (!x(s.offset) || s.offset < 0 || s.offset > 1) return y("a gradient stop offset in [0, 1]", e);
1609
1623
  const i = K(s.color, t);
1610
1624
  if (i.status !== "accepted") return i;
1611
1625
  n.push({
@@ -1619,7 +1633,7 @@ var pt = (e, t) => {
1619
1633
  gradient: "radial",
1620
1634
  stops: n
1621
1635
  }
1622
- } : r.angle !== void 0 && !x(r.angle) ? g("a gradient angle in degrees", e) : {
1636
+ } : r.angle !== void 0 && !x(r.angle) ? y("a gradient angle in degrees", e) : {
1623
1637
  status: "accepted",
1624
1638
  value: {
1625
1639
  gradient: "linear",
@@ -1628,8 +1642,8 @@ var pt = (e, t) => {
1628
1642
  }
1629
1643
  };
1630
1644
  }
1631
- if (gr(r)) {
1632
- if (!nn.includes(r.pattern)) return g(Me, e);
1645
+ if (yr(r)) {
1646
+ if (!nn.includes(r.pattern)) return y(Te, e);
1633
1647
  const a = K(r.color, t);
1634
1648
  if (a.status !== "accepted") return a;
1635
1649
  const n = {
@@ -1642,7 +1656,7 @@ var pt = (e, t) => {
1642
1656
  n.background = s.value;
1643
1657
  }
1644
1658
  if (r.size !== void 0) {
1645
- if (!x(r.size) || r.size <= 0) return g("a pattern size in pixels", e);
1659
+ if (!x(r.size) || r.size <= 0) return y("a pattern size in pixels", e);
1646
1660
  n.size = r.size;
1647
1661
  }
1648
1662
  return {
@@ -1651,10 +1665,10 @@ var pt = (e, t) => {
1651
1665
  };
1652
1666
  }
1653
1667
  if (on(r)) {
1654
- if (typeof r.image != "string" || !r.image.startsWith("data:image/")) return g("an image as a data:image URI", e);
1655
- if (r.fit !== void 0 && !sn.includes(r.fit)) return g(Me, e);
1656
- if (r.alpha !== void 0 && (!x(r.alpha) || r.alpha < 0 || r.alpha > 1)) return g("an image alpha in [0, 1]", e);
1657
- if (r.size !== void 0 && (!x(r.size) || r.size <= 0)) return g("an image size in pixels", e);
1668
+ if (typeof r.image != "string" || !r.image.startsWith("data:image/")) return y("an image as a data:image URI", e);
1669
+ if (r.fit !== void 0 && !sn.includes(r.fit)) return y(Te, e);
1670
+ if (r.alpha !== void 0 && (!x(r.alpha) || r.alpha < 0 || r.alpha > 1)) return y("an image alpha in [0, 1]", e);
1671
+ if (r.size !== void 0 && (!x(r.size) || r.size <= 0)) return y("an image size in pixels", e);
1658
1672
  const a = K(r.fallback, t);
1659
1673
  return a.status !== "accepted" ? a : {
1660
1674
  status: "accepted",
@@ -1667,8 +1681,8 @@ var pt = (e, t) => {
1667
1681
  }
1668
1682
  };
1669
1683
  }
1670
- return g(Me, e);
1671
- }, gt = (e) => {
1684
+ return y(Te, e);
1685
+ }, yt = (e) => {
1672
1686
  if (x(e) && e >= 0) return {
1673
1687
  status: "accepted",
1674
1688
  value: {
@@ -1678,12 +1692,12 @@ var pt = (e, t) => {
1678
1692
  left: e
1679
1693
  }
1680
1694
  };
1681
- if (typeof e != "object" || e === null) return g(ht, e);
1695
+ if (typeof e != "object" || e === null) return y(ht, e);
1682
1696
  const t = e, r = {};
1683
1697
  for (const a of mn) {
1684
1698
  const n = t[a];
1685
1699
  if (n !== void 0) {
1686
- if (!x(n) || n < 0) return g(ht, e);
1700
+ if (!x(n) || n < 0) return y(ht, e);
1687
1701
  r[a] = n;
1688
1702
  }
1689
1703
  }
@@ -1696,11 +1710,11 @@ var pt = (e, t) => {
1696
1710
  status: "accepted",
1697
1711
  value: e
1698
1712
  };
1699
- if (typeof e != "object" || e === null) return g(ft, e);
1713
+ if (typeof e != "object" || e === null) return y(ft, e);
1700
1714
  const t = e, r = {};
1701
1715
  for (const a of ln) {
1702
1716
  const n = t[a];
1703
- if (!x(n) || n < 0) return g(ft, e);
1717
+ if (!x(n) || n < 0) return y(ft, e);
1704
1718
  r[a] = n;
1705
1719
  }
1706
1720
  return {
@@ -1713,39 +1727,39 @@ var pt = (e, t) => {
1713
1727
  unitInterval: (e) => x(e) && e >= 0 && e <= 1 ? {
1714
1728
  status: "accepted",
1715
1729
  value: e
1716
- } : g("a number in [0, 1]", e),
1730
+ } : y("a number in [0, 1]", e),
1717
1731
  pixels: (e) => x(e) && e >= 0 ? {
1718
1732
  status: "accepted",
1719
1733
  value: e
1720
- } : g("a non-negative number of pixels", e),
1734
+ } : y("a non-negative number of pixels", e),
1721
1735
  barRadius: (e) => Ja(e) || x(e) && e >= 0 ? {
1722
1736
  status: "accepted",
1723
1737
  value: e
1724
- } : g(`a number of pixels or one of ${fr.map((t) => `'${t}'`).join(", ")}`, e),
1738
+ } : y(`a number of pixels or one of ${fr.map((t) => `'${t}'`).join(", ")}`, e),
1725
1739
  dashArray: (e) => Array.isArray(e) && e.every((t) => x(t) && t >= 0) ? {
1726
1740
  status: "accepted",
1727
1741
  value: [...e]
1728
- } : g("an array of non-negative dash and gap lengths, in stroke widths", e),
1742
+ } : y("an array of non-negative dash and gap lengths, in stroke widths", e),
1729
1743
  fontFamily: (e) => typeof e == "string" && e.trim().length > 0 ? {
1730
1744
  status: "accepted",
1731
1745
  value: e
1732
- } : g("a non-empty CSS font-family list", e),
1746
+ } : y("a non-empty CSS font-family list", e),
1733
1747
  fontWeight: (e) => x(e) && e >= ct && e <= ut ? {
1734
1748
  status: "accepted",
1735
1749
  value: e
1736
- } : g(`a number in [${ct}, ${ut}]`, e),
1750
+ } : y(`a number in [${ct}, ${ut}]`, e),
1737
1751
  multiplier: (e) => x(e) && e >= 0 ? {
1738
1752
  status: "accepted",
1739
1753
  value: e
1740
- } : g("a non-negative multiple, 1 being unchanged", e),
1754
+ } : y("a non-negative multiple, 1 being unchanged", e),
1741
1755
  shadow: (e, t) => {
1742
1756
  if (e === "none") return {
1743
1757
  status: "accepted",
1744
1758
  value: e
1745
1759
  };
1746
- if (typeof e != "object" || e === null) return g(dt, e);
1760
+ if (typeof e != "object" || e === null) return y(dt, e);
1747
1761
  const r = e;
1748
- if (!x(r.offsetX) || !x(r.offsetY) || !x(r.blur) || r.blur < 0) return g(dt, e);
1762
+ if (!x(r.offsetX) || !x(r.offsetY) || !x(r.blur) || r.blur < 0) return y(dt, e);
1749
1763
  const a = K(r.color, t);
1750
1764
  return a.status !== "accepted" ? a : {
1751
1765
  status: "accepted",
@@ -1757,19 +1771,19 @@ var pt = (e, t) => {
1757
1771
  }
1758
1772
  };
1759
1773
  },
1760
- padding: gt,
1761
- margin: gt,
1774
+ padding: yt,
1775
+ margin: yt,
1762
1776
  blendMode: H(pn),
1763
1777
  signedPixels: (e) => x(e) ? {
1764
1778
  status: "accepted",
1765
1779
  value: e
1766
- } : g("a number of pixels, negative allowed", e),
1780
+ } : y("a number of pixels, negative allowed", e),
1767
1781
  fontStyle: H(cn),
1768
1782
  textTransform: H(un),
1769
1783
  textDecoration: H(dn),
1770
1784
  lineCap: H(hn),
1771
1785
  lineJoin: H(fn),
1772
- pointSymbol: H(gn),
1786
+ pointSymbol: H(yn),
1773
1787
  boxRadius: An
1774
1788
  }, En = [
1775
1789
  "kind",
@@ -1778,7 +1792,7 @@ var pt = (e, t) => {
1778
1792
  "role",
1779
1793
  "position",
1780
1794
  "part"
1781
- ], Ni = "#B84737", xn = 0.4, Pi = "sm", Oi = 2, Bi = 8, Vi = 12, Wi = Object.freeze({
1795
+ ], Pi = "#B84737", xn = 0.4, Oi = "sm", Ni = 2, Bi = 8, Vi = 12, Wi = Object.freeze({
1782
1796
  light: "#F5F1E9",
1783
1797
  dark: "#1F1E1C"
1784
1798
  }), Ui = "#ffffff", Yi = 1, zi = 24, Gi = {
@@ -1882,10 +1896,10 @@ var pt = (e, t) => {
1882
1896
  fontWeight: 400,
1883
1897
  lineHeight: 1.3
1884
1898
  }
1885
- }, Ne = {
1899
+ }, Pe = {
1886
1900
  stroke: h("gridLine"),
1887
1901
  strokeWidth: 1
1888
- }, yt = {
1902
+ }, gt = {
1889
1903
  fill: h("tooltipBackground"),
1890
1904
  stroke: h("tooltipBorder"),
1891
1905
  strokeWidth: 1,
@@ -1926,7 +1940,7 @@ var pt = (e, t) => {
1926
1940
  blur: 6,
1927
1941
  color: "rgba(0, 0, 0, 0.12)"
1928
1942
  }
1929
- }, Pe = {
1943
+ }, Oe = {
1930
1944
  ...B,
1931
1945
  length: "pixels"
1932
1946
  }, ee = {
@@ -1939,7 +1953,7 @@ var pt = (e, t) => {
1939
1953
  }, re = {
1940
1954
  gap: "pixels",
1941
1955
  margin: "margin"
1942
- }, Oe = {
1956
+ }, Ne = {
1943
1957
  stroke: "color",
1944
1958
  strokeWidth: "pixels",
1945
1959
  offset: "pixels",
@@ -2049,7 +2063,7 @@ var ji = (e = Object.values(qe)) => {
2049
2063
  cornerRadius: "pixels"
2050
2064
  },
2051
2065
  rest: {
2052
- ...Ne,
2066
+ ...Pe,
2053
2067
  dashArray: W.panelBorder.dashed,
2054
2068
  cornerRadius: 6
2055
2069
  },
@@ -2095,7 +2109,7 @@ var ji = (e = Object.values(qe)) => {
2095
2109
  },
2096
2110
  vocabulary: B,
2097
2111
  rest: {
2098
- ...Ne,
2112
+ ...Pe,
2099
2113
  dashArray: W.gridLine.dashed,
2100
2114
  strokeWidth: 0
2101
2115
  }
@@ -2107,7 +2121,7 @@ var ji = (e = Object.values(qe)) => {
2107
2121
  },
2108
2122
  vocabulary: B,
2109
2123
  rest: {
2110
- ...Ne,
2124
+ ...Pe,
2111
2125
  dashArray: W.gridLine.dashed
2112
2126
  }
2113
2127
  }
@@ -2115,7 +2129,7 @@ var ji = (e = Object.values(qe)) => {
2115
2129
  },
2116
2130
  tickLine: {
2117
2131
  select: { target: "tickLine" },
2118
- vocabulary: Pe,
2132
+ vocabulary: Oe,
2119
2133
  rest: {
2120
2134
  strokeWidth: 0,
2121
2135
  length: 0
@@ -2126,14 +2140,14 @@ var ji = (e = Object.values(qe)) => {
2126
2140
  target: "tickLine",
2127
2141
  axis: "x"
2128
2142
  },
2129
- vocabulary: Pe
2143
+ vocabulary: Oe
2130
2144
  },
2131
2145
  y: {
2132
2146
  select: {
2133
2147
  target: "tickLine",
2134
2148
  axis: "y"
2135
2149
  },
2136
- vocabulary: Pe
2150
+ vocabulary: Oe
2137
2151
  }
2138
2152
  }
2139
2153
  },
@@ -2348,7 +2362,7 @@ var ji = (e = Object.values(qe)) => {
2348
2362
  },
2349
2363
  editOutline: {
2350
2364
  select: { target: "editOutline" },
2351
- vocabulary: Oe,
2365
+ vocabulary: Ne,
2352
2366
  rest: {
2353
2367
  strokeWidth: 2,
2354
2368
  offset: 2,
@@ -2361,7 +2375,7 @@ var ji = (e = Object.values(qe)) => {
2361
2375
  target: "editOutline",
2362
2376
  part: "hover"
2363
2377
  },
2364
- vocabulary: Oe,
2378
+ vocabulary: Ne,
2365
2379
  rest: { stroke: h("editOutlineHover") }
2366
2380
  },
2367
2381
  selected: {
@@ -2369,7 +2383,7 @@ var ji = (e = Object.values(qe)) => {
2369
2383
  target: "editOutline",
2370
2384
  part: "selected"
2371
2385
  },
2372
- vocabulary: Oe,
2386
+ vocabulary: Ne,
2373
2387
  rest: { stroke: h("editOutlineSelected") }
2374
2388
  }
2375
2389
  }
@@ -2377,7 +2391,7 @@ var ji = (e = Object.values(qe)) => {
2377
2391
  tooltip: {
2378
2392
  select: { target: "tooltip" },
2379
2393
  vocabulary: vt,
2380
- rest: yt,
2394
+ rest: gt,
2381
2395
  children: {
2382
2396
  heading: {
2383
2397
  select: {
@@ -2531,7 +2545,7 @@ var ji = (e = Object.values(qe)) => {
2531
2545
  part: "popover"
2532
2546
  },
2533
2547
  vocabulary: vt,
2534
- rest: yt
2548
+ rest: gt
2535
2549
  },
2536
2550
  top: {
2537
2551
  select: {
@@ -2872,25 +2886,25 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
2872
2886
  x: r,
2873
2887
  y: a
2874
2888
  };
2875
- }, Mt = 0.5, ve = (e) => ({
2889
+ }, Mt = 0.5, Ae = (e) => ({
2876
2890
  x: 0,
2877
2891
  y: 0,
2878
2892
  width: e.width,
2879
2893
  height: e.height
2880
- }), Ze = (e) => e === "panel-end" ? "end" : e === "panel-start" ? "start" : e, Ae = ({ box: e, panel: t, orientation: r, placement: a, justify: n, align: s, offset: i, alignOffset: o, labelWidth: l, labelHeight: c }) => {
2881
- const d = n === "panel-start" || n === "panel-end", f = (r.valueAxis === "x" ? e.height : e.width) === 0, u = {
2894
+ }), Ze = (e) => e === "panel-end" ? "end" : e === "panel-start" ? "start" : e, Ee = ({ box: e, panel: t, orientation: r, placement: a, justify: n, align: s, offset: i, alignOffset: o, labelWidth: l, labelHeight: c }) => {
2895
+ const u = n === "panel-start" || n === "panel-end", f = (r.valueAxis === "x" ? e.height : e.width) === 0, d = {
2882
2896
  anchor: In(n, r.valueDirectionSign),
2883
- placement: d ? "inside" : a,
2897
+ placement: u ? "inside" : a,
2884
2898
  offset: i
2885
2899
  }, p = {
2886
2900
  anchor: Fn(s),
2887
2901
  placement: f ? a : "inside",
2888
2902
  offset: f ? o ?? i : 0
2889
- }, y = d ? t : e, v = r.valueAxis === "x" ? y : e, S = r.valueAxis === "y" ? y : e, D = r.valueAxis === "x" ? u : p, O = r.valueAxis === "x" ? p : u, T = wt(D, {
2903
+ }, g = u ? t : e, v = r.valueAxis === "x" ? g : e, S = r.valueAxis === "y" ? g : e, D = r.valueAxis === "x" ? d : p, N = r.valueAxis === "x" ? p : d, T = wt(D, {
2890
2904
  min: v.x,
2891
2905
  max: v.x + v.width,
2892
2906
  halfExtent: l / 2
2893
- }), I = wt(O, {
2907
+ }), I = wt(N, {
2894
2908
  min: S.y,
2895
2909
  max: S.y + S.height,
2896
2910
  halfExtent: c / 2
@@ -2909,7 +2923,7 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
2909
2923
  if (t === "inside" && a === n) return a;
2910
2924
  const i = r + s;
2911
2925
  return e === "min" ? t === "inside" ? a + i : a - i : t === "inside" ? n - i : n + i;
2912
- }, Nn = (e) => {
2926
+ }, Pn = (e) => {
2913
2927
  const t = [];
2914
2928
  if (!e.layer.dataLabels.showDataLabels) return {
2915
2929
  labels: t,
@@ -2921,9 +2935,9 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
2921
2935
  if (s === null || i === null || !Ke(s, i)) continue;
2922
2936
  const o = e.formatLabel(n);
2923
2937
  if (o === "") continue;
2924
- const { width: l, height: c } = e.measureDataLabel("observation", "outside", o), { box: d, orientation: f } = On(i, G(n), s, e.panelRect.width, e.panelRect.height), u = Ae({
2925
- box: d,
2926
- panel: ve(e.panelRect),
2938
+ const { width: l, height: c } = e.measureDataLabel("observation", "outside", o), { box: u, orientation: f } = Nn(i, G(n), s, e.panelRect.width, e.panelRect.height), d = Ee({
2939
+ box: u,
2940
+ panel: Ae(e.panelRect),
2927
2941
  orientation: f,
2928
2942
  ...a,
2929
2943
  offset: r,
@@ -2932,8 +2946,8 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
2932
2946
  });
2933
2947
  t.push({
2934
2948
  layerId: e.layer.id,
2935
- x: u.x,
2936
- y: u.y,
2949
+ x: d.x,
2950
+ y: d.y,
2937
2951
  text: o,
2938
2952
  width: l,
2939
2953
  height: c,
@@ -2946,7 +2960,7 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
2946
2960
  labels: t,
2947
2961
  droppedCount: 0
2948
2962
  };
2949
- }, Pn = (e) => e.position === "fill" ? "fill" : pe(e.position) ? "stack" : "none", On = (e, t, r, a, n) => {
2963
+ }, On = (e) => e.position === "fill" ? "fill" : pe(e.position) ? "stack" : "none", Nn = (e, t, r, a, n) => {
2950
2964
  const s = t ?? e, i = 1 - Math.max(e, s);
2951
2965
  return {
2952
2966
  box: {
@@ -3036,7 +3050,7 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3036
3050
  ], this.summaries = { perGroupHeadline: !0 }, this.dataLabels = {
3037
3051
  cartesian: { offset: 8 },
3038
3052
  flip: { offset: 8 }
3039
- }, this.dataLabelCoordTypes = ["cartesian", "flip"], this.resolvePercentageValueStrategy = Pn, this.isComposite = !0, this.legend = {
3053
+ }, this.dataLabelCoordTypes = ["cartesian", "flip"], this.resolvePercentageValueStrategy = On, this.isComposite = !0, this.legend = {
3040
3054
  suppressWhenSingleItem: !0,
3041
3055
  sidePlacement: "whenCrowded",
3042
3056
  directLabelSupport: {
@@ -3045,7 +3059,7 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3045
3059
  identity: !0,
3046
3060
  fill: !0
3047
3061
  }
3048
- }, this.highlightStrategy = "overlay-anchor", this.spatialKind = "filled-buckets", this.resolveAnchorPosition = Qe, this.getDataLabelPlacements = (t) => Nn(t);
3062
+ }, this.highlightStrategy = "overlay-anchor", this.spatialKind = "filled-buckets", this.resolveAnchorPosition = Qe, this.getDataLabelPlacements = (t) => Pn(t);
3049
3063
  }
3050
3064
  resolveParams(e) {
3051
3065
  const t = super.resolveParams(e);
@@ -3061,7 +3075,7 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3061
3075
  };
3062
3076
  }
3063
3077
  }, Wn = 0.7, qi = 0.1, Un = 0.03, Yn = 0.05, zn = (e) => {
3064
- const t = e[Ot.role];
3078
+ const t = e[Nt.role];
3065
3079
  return t ?? "solo";
3066
3080
  }, et = (e, t, r) => {
3067
3081
  const a = {}, n = (s) => {
@@ -3081,7 +3095,7 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3081
3095
  return n("outside");
3082
3096
  }
3083
3097
  };
3084
- }, Te = 6, Gn = 0.5, jn = (e) => {
3098
+ }, we = 6, Gn = 0.5, jn = (e) => {
3085
3099
  const t = [];
3086
3100
  let r = 0;
3087
3101
  const a = pe(e.layer.position), n = e.coordSystem.mainAxis === "y";
@@ -3106,7 +3120,7 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3106
3120
  panelWidth: e.panelRect.width,
3107
3121
  panelHeight: e.panelRect.height,
3108
3122
  offset: e.layer.dataLabels.offset
3109
- }) : Qn(e.layer.dataLabels, e.coordSystem.mainAxis, a, o, ve(e.panelRect));
3123
+ }) : Qn(e.layer.dataLabels, e.coordSystem.mainAxis, a, o, Ae(e.panelRect));
3110
3124
  if (l === null) {
3111
3125
  r += 1;
3112
3126
  continue;
@@ -3144,19 +3158,19 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3144
3158
  }, Hn = (e) => e.position === "fill" ? "fill" : pe(e.position) ? "stack" : "absoluteGrandTotal", $n = ({ layer: e, mainAxis: t, panelRect: r, measureDataLabel: a, styleReaders: n, formatLabel: s, isFlipped: i }) => {
3145
3159
  const o = [];
3146
3160
  let l = !1;
3147
- const c = e.dataLabels.position === "auto", d = F(e.mapping.y);
3161
+ const c = e.dataLabels.position === "auto", u = F(e.mapping.y);
3148
3162
  for (const f of e.data) {
3149
- const u = xr(t, f);
3150
- if (u === null) continue;
3163
+ const d = xr(t, f);
3164
+ if (d === null) continue;
3151
3165
  const p = s(f);
3152
3166
  if (p === "") continue;
3153
- const y = et(a, "observation", p), v = tt(u, r);
3154
- c && y.inside.width > v.width && (l = !0);
3155
- const S = d === null ? null : f[d], D = L(S) && S < 0;
3167
+ const g = et(a, "observation", p), v = tt(d, r);
3168
+ c && g.inside.width > v.width && (l = !0);
3169
+ const S = u === null ? null : f[u], D = L(S) && S < 0;
3156
3170
  o.push({
3157
3171
  isNegative: D,
3158
3172
  text: p,
3159
- boxes: y,
3173
+ boxes: g,
3160
3174
  bounds: v,
3161
3175
  backdropColor: Xe(n.get("fill", f))
3162
3176
  });
@@ -3219,7 +3233,7 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3219
3233
  valueDirectionSign: t ? -1 : 1
3220
3234
  }, Jn = (e) => e === "panel-start" || e === "panel-end", Qn = (e, t, r, a, n) => {
3221
3235
  if (e.position === "auto") return null;
3222
- const s = r && e.position === "outside" ? "inside" : e.position, i = a.boxes[s], o = Ae({
3236
+ const s = r && e.position === "outside" ? "inside" : e.position, i = a.boxes[s], o = Ee({
3223
3237
  box: a.bounds,
3224
3238
  panel: n,
3225
3239
  orientation: Mr(t, a.isNegative),
@@ -3246,23 +3260,23 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3246
3260
  position: o.position
3247
3261
  };
3248
3262
  }, Zn = (e, t) => {
3249
- const r = [], { categoryPosition: a, categoryJustify: n, categoryAlign: s, categoryOffset: i } = e.layer.dataLabels, o = t && a === "outside" ? "inside" : a, l = e.coordSystem.mainAxis, c = ve(e.panelRect), d = F(e.layer.mapping.y);
3263
+ const r = [], { categoryPosition: a, categoryJustify: n, categoryAlign: s, categoryOffset: i } = e.layer.dataLabels, o = t && a === "outside" ? "inside" : a, l = e.coordSystem.mainAxis, c = Ae(e.panelRect), u = F(e.layer.mapping.y);
3250
3264
  for (const f of e.layer.data) {
3251
- const u = xr(l, f);
3252
- if (u === null) continue;
3265
+ const d = xr(l, f);
3266
+ if (d === null) continue;
3253
3267
  const p = e.formatCategory(f);
3254
3268
  if (p === null || p === "") continue;
3255
- const y = et(e.measureDataLabel, "category", p), v = y[o], S = tt(u, e.panelRect), D = d === null ? null : f[d], O = L(D) && D < 0, T = Ae({
3269
+ const g = et(e.measureDataLabel, "category", p), v = g[o], S = tt(d, e.panelRect), D = u === null ? null : f[u], N = L(D) && D < 0, T = Ee({
3256
3270
  box: S,
3257
3271
  panel: c,
3258
- orientation: Mr(l, O),
3272
+ orientation: Mr(l, N),
3259
3273
  placement: o,
3260
3274
  justify: n,
3261
3275
  align: s,
3262
3276
  offset: i,
3263
3277
  labelWidth: v.width,
3264
3278
  labelHeight: v.height
3265
- }), I = y[T.position];
3279
+ }), I = g[T.position];
3266
3280
  r.push({
3267
3281
  layerId: e.layer.id,
3268
3282
  x: T.x,
@@ -3312,8 +3326,8 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3312
3326
  };
3313
3327
  }
3314
3328
  }, rs = ({ edge: e, bounds: t, boxes: r, isRotated: a, panelWidth: n, panelHeight: s, offset: i }) => {
3315
- const o = e === "top" || e === "bottom", l = t.x + t.width / 2, c = t.y + t.height / 2, d = o ? t.height : t.width, f = o ? t.width : t.height, { edgeCoord: u, outwardSign: p, panelExtent: y } = ts(e, t, n, s), v = je(r.inside.width, r.inside.height, a), S = o ? v.height : v.width, D = o ? v.width : v.height, O = S + i < d, T = D <= f;
3316
- if (o ? O : O && T) {
3329
+ const o = e === "top" || e === "bottom", l = t.x + t.width / 2, c = t.y + t.height / 2, u = o ? t.height : t.width, f = o ? t.width : t.height, { edgeCoord: d, outwardSign: p, panelExtent: g } = ts(e, t, n, s), v = je(r.inside.width, r.inside.height, a), S = o ? v.height : v.width, D = o ? v.width : v.height, N = S + i < u, T = D <= f;
3330
+ if (o ? N : N && T) {
3317
3331
  if (o && !T) return null;
3318
3332
  if (a) return {
3319
3333
  x: l,
@@ -3321,21 +3335,21 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3321
3335
  isRotated: !0,
3322
3336
  position: "inside"
3323
3337
  };
3324
- const Ee = u - p * (S / 2 + i);
3338
+ const xe = d - p * (S / 2 + i);
3325
3339
  return {
3326
3340
  ...o ? {
3327
3341
  x: l,
3328
- y: Ee
3342
+ y: xe
3329
3343
  } : {
3330
- x: Ee,
3344
+ x: xe,
3331
3345
  y: c
3332
3346
  },
3333
3347
  isRotated: !1,
3334
3348
  position: "inside"
3335
3349
  };
3336
3350
  }
3337
- const I = je(r.outside.width, r.outside.height, a), E = (o ? I.height : I.width) / 2, M = u + p * (E + i);
3338
- return M - E < 0 || M + E > y ? null : {
3351
+ const I = je(r.outside.width, r.outside.height, a), E = (o ? I.height : I.width) / 2, M = d + p * (E + i);
3352
+ return M - E < 0 || M + E > g ? null : {
3339
3353
  ...o ? {
3340
3354
  x: l,
3341
3355
  y: M
@@ -3351,15 +3365,15 @@ var Rn = (e) => e.observation?.aesthetics ?? qe.geom.aesthetics, Cn = (e) => e.o
3351
3365
  if (i === void 0 || i.length === 0) return s;
3352
3366
  const o = t === "y";
3353
3367
  for (const l of i) {
3354
- const c = tt(Kn(t, l), r), d = n(l.total), { width: f, height: u } = a("aggregate", "outside", d), p = l.anchor.direction === "positive";
3355
- let y, v;
3356
- o ? (y = p ? c.x + c.width + Te + f / 2 : c.x - Te - f / 2, v = c.y + c.height / 2) : (y = c.x + c.width / 2, v = p ? c.y - Te - u / 2 : c.y + c.height + Te + u / 2), s.push({
3368
+ const c = tt(Kn(t, l), r), u = n(l.total), { width: f, height: d } = a("aggregate", "outside", u), p = l.anchor.direction === "positive";
3369
+ let g, v;
3370
+ o ? (g = p ? c.x + c.width + we + f / 2 : c.x - we - f / 2, v = c.y + c.height / 2) : (g = c.x + c.width / 2, v = p ? c.y - we - d / 2 : c.y + c.height + we + d / 2), s.push({
3357
3371
  layerId: e.id,
3358
- x: y,
3372
+ x: g,
3359
3373
  y: v,
3360
- text: d,
3374
+ text: u,
3361
3375
  width: f,
3362
- height: u,
3376
+ height: d,
3363
3377
  isRotated: !1,
3364
3378
  role: "aggregate",
3365
3379
  position: "outside"
@@ -3385,18 +3399,18 @@ var is = " · ", Be = 2, os = (e) => {
3385
3399
  labels: t,
3386
3400
  droppedCount: 0
3387
3401
  };
3388
- const { position: r, justify: a, align: n, offset: s, showCategoryLabels: i } = e.layer.dataLabels, o = e.coordSystem.bandAxis === "y" ? "inside" : "outside", l = e.panelRect.width / 2, c = e.panelRect.height / 2, d = Math.min(e.panelRect.width, e.panelRect.height) / 2, f = e.styleReaders;
3389
- for (const u of e.layer.data) {
3390
- const { startAngle: p, endAngle: y } = ns(u), { innerRadius: v, outerRadius: S } = ss(u);
3391
- if (p === null || y === null || S === null) continue;
3392
- const D = e.formatLabel(u);
3402
+ const { position: r, justify: a, align: n, offset: s, showCategoryLabels: i } = e.layer.dataLabels, o = e.coordSystem.bandAxis === "y" ? "inside" : "outside", l = e.panelRect.width / 2, c = e.panelRect.height / 2, u = Math.min(e.panelRect.width, e.panelRect.height) / 2, f = e.styleReaders;
3403
+ for (const d of e.layer.data) {
3404
+ const { startAngle: p, endAngle: g } = ns(d), { innerRadius: v, outerRadius: S } = ss(d);
3405
+ if (p === null || g === null || S === null) continue;
3406
+ const D = e.formatLabel(d);
3393
3407
  if (D === "") continue;
3394
- const O = i ? e.formatCategory(u) : null, T = O === null ? D : `${O}${is}${D}`, I = {
3408
+ const N = i ? e.formatCategory(d) : null, T = N === null ? D : `${N}${is}${D}`, I = {
3395
3409
  startAngle: p,
3396
- endAngle: y,
3397
- midAngle: (p + y) / 2,
3398
- innerRadiusPx: (v ?? 0) * d,
3399
- outerRadiusPx: S * d
3410
+ endAngle: g,
3411
+ midAngle: (p + g) / 2,
3412
+ innerRadiusPx: (v ?? 0) * u,
3413
+ outerRadiusPx: S * u
3400
3414
  };
3401
3415
  let E, M;
3402
3416
  if (r === "auto") {
@@ -3411,9 +3425,9 @@ var is = " · ", Be = 2, os = (e) => {
3411
3425
  labelWidth: M.width,
3412
3426
  labelHeight: M.height
3413
3427
  });
3414
- const xe = l + Math.sin(E.labelAngle) * E.labelRadius, Lr = c - Math.cos(E.labelAngle) * E.labelRadius;
3428
+ const Me = l + Math.sin(E.labelAngle) * E.labelRadius, Lr = c - Math.cos(E.labelAngle) * E.labelRadius;
3415
3429
  if (E.position === "outside" && !us({
3416
- x: xe,
3430
+ x: Me,
3417
3431
  y: Lr,
3418
3432
  labelWidth: M.width,
3419
3433
  labelHeight: M.height,
@@ -3432,21 +3446,21 @@ var is = " · ", Be = 2, os = (e) => {
3432
3446
  });
3433
3447
  }
3434
3448
  } else {
3435
- const ue = et(e.measureDataLabel, "observation", T), xe = ue[r];
3449
+ const ue = et(e.measureDataLabel, "observation", T), Me = ue[r];
3436
3450
  E = ds({
3437
3451
  wedge: I,
3438
3452
  placement: r,
3439
3453
  justify: Ze(a),
3440
3454
  align: n,
3441
3455
  offset: s,
3442
- labelWidth: xe.width,
3443
- labelHeight: xe.height
3456
+ labelWidth: Me.width,
3457
+ labelHeight: Me.height
3444
3458
  }), M = ue[E.position];
3445
3459
  }
3446
- const Ee = l + Math.sin(E.labelAngle) * E.labelRadius, kr = c - Math.cos(E.labelAngle) * E.labelRadius;
3460
+ const xe = l + Math.sin(E.labelAngle) * E.labelRadius, kr = c - Math.cos(E.labelAngle) * E.labelRadius;
3447
3461
  t.push({
3448
3462
  layerId: e.layer.id,
3449
- x: Ee,
3463
+ x: xe,
3450
3464
  y: kr,
3451
3465
  text: T,
3452
3466
  width: M.width,
@@ -3454,31 +3468,31 @@ var is = " · ", Be = 2, os = (e) => {
3454
3468
  isRotated: !1,
3455
3469
  role: "observation",
3456
3470
  position: E.position,
3457
- ...E.position === "inside" ? { backdropColor: Xe(f.get("fill", u)) } : {}
3471
+ ...E.position === "inside" ? { backdropColor: Xe(f.get("fill", d)) } : {}
3458
3472
  });
3459
3473
  }
3460
3474
  return {
3461
3475
  labels: t,
3462
3476
  droppedCount: 0
3463
3477
  };
3464
- }, ls = () => "absoluteGrandTotal", ye = (e, t, r, a) => {
3478
+ }, ls = () => "absoluteGrandTotal", me = (e, t, r, a) => {
3465
3479
  const n = Math.abs(e === "radial" ? Math.sin(t) : Math.cos(t)), s = Math.abs(e === "radial" ? Math.cos(t) : Math.sin(t));
3466
3480
  return n * (r / 2) + s * (a / 2);
3467
3481
  }, cs = ({ wedge: e, labelRadius: t, labelAngle: r, labelWidth: a, labelHeight: n }) => {
3468
- const s = ye("radial", r, a, n);
3482
+ const s = me("radial", r, a, n);
3469
3483
  if (!(t - s >= e.innerRadiusPx - Be && t + s <= e.outerRadiusPx + Be) || t <= 0) return !1;
3470
- const i = Math.abs(e.endAngle - e.startAngle) / 2, o = ye("tangential", r, a, n) / t, l = Be / t;
3484
+ const i = Math.abs(e.endAngle - e.startAngle) / 2, o = me("tangential", r, a, n) / t, l = Be / t;
3471
3485
  return Math.abs(r - e.midAngle) + o <= i + l;
3472
3486
  }, us = ({ x: e, y: t, labelWidth: r, labelHeight: a, panelRect: n }) => e - r / 2 >= 0 && e + r / 2 <= n.width && t - a / 2 >= 0 && t + a / 2 <= n.height, St = ({ wedge: e, position: t, offset: r, labelWidth: a, labelHeight: n }) => t === "inside" ? {
3473
3487
  labelRadius: (e.innerRadiusPx + e.outerRadiusPx) / 2,
3474
3488
  labelAngle: e.midAngle,
3475
3489
  position: "inside"
3476
3490
  } : {
3477
- labelRadius: e.outerRadiusPx + r + ye("radial", e.midAngle, a, n),
3491
+ labelRadius: e.outerRadiusPx + r + me("radial", e.midAngle, a, n),
3478
3492
  labelAngle: e.midAngle,
3479
3493
  position: "outside"
3480
3494
  }, ds = ({ wedge: e, placement: t, justify: r, align: a, offset: n, labelWidth: s, labelHeight: i }) => {
3481
- const o = a === "start" ? e.startAngle : a === "end" ? e.endAngle : e.midAngle, l = n + ye("radial", o, s, i);
3495
+ const o = a === "start" ? e.startAngle : a === "end" ? e.endAngle : e.midAngle, l = n + me("radial", o, s, i);
3482
3496
  let c;
3483
3497
  if (r === "center") c = (e.innerRadiusPx + e.outerRadiusPx) / 2;
3484
3498
  else if (r === "end") c = t === "inside" ? e.outerRadiusPx - l : e.outerRadiusPx + l;
@@ -3487,18 +3501,18 @@ var is = " · ", Be = 2, os = (e) => {
3487
3501
  const f = e.innerRadiusPx - l;
3488
3502
  c = f >= 0 ? f : e.innerRadiusPx + l;
3489
3503
  }
3490
- let d = o;
3504
+ let u = o;
3491
3505
  if (a !== "center" && c > 0) {
3492
- const f = ye("tangential", o, s, i) / c;
3493
- d = o + (a === "start" ? 1 : -1) * f;
3506
+ const f = me("tangential", o, s, i) / c;
3507
+ u = o + (a === "start" ? 1 : -1) * f;
3494
3508
  }
3495
3509
  return {
3496
3510
  labelRadius: c,
3497
- labelAngle: d,
3511
+ labelAngle: u,
3498
3512
  position: cs({
3499
3513
  wedge: e,
3500
3514
  labelRadius: c,
3501
- labelAngle: d,
3515
+ labelAngle: u,
3502
3516
  labelWidth: s,
3503
3517
  labelHeight: i
3504
3518
  }) ? "inside" : "outside"
@@ -3586,23 +3600,23 @@ var is = " · ", Be = 2, os = (e) => {
3586
3600
  purpose: n
3587
3601
  };
3588
3602
  if (r.mainAxis === "x") {
3589
- const f = q(t), u = J(t), p = Lt({
3603
+ const f = q(t), d = J(t), p = Lt({
3590
3604
  lowerBound: G(t),
3591
3605
  upperBound: j(t) ?? z(t),
3592
3606
  options: o
3593
3607
  });
3594
- return f === null || u === null || p === null ? null : {
3595
- x: (f + u) / 2,
3608
+ return f === null || d === null || p === null ? null : {
3609
+ x: (f + d) / 2,
3596
3610
  y: p
3597
3611
  };
3598
3612
  }
3599
- const l = G(t), c = j(t), d = Lt({
3613
+ const l = G(t), c = j(t), u = Lt({
3600
3614
  lowerBound: q(t),
3601
3615
  upperBound: J(t) ?? X(t),
3602
3616
  options: o
3603
3617
  });
3604
- return l === null || c === null || d === null ? null : {
3605
- x: d,
3618
+ return l === null || c === null || u === null ? null : {
3619
+ x: u,
3606
3620
  y: (l + c) / 2
3607
3621
  };
3608
3622
  }, this.getDataLabelPlacements = (t) => t.coordSystem.type === "polar" ? os(t) : jn(t), this.resolvePercentageValueStrategy = (t, r) => r === "polar" ? ls() : Hn(t);
@@ -3652,26 +3666,26 @@ var is = " · ", Be = 2, os = (e) => {
3652
3666
  if (a.purpose === "value" || a.isSolo) return n;
3653
3667
  const s = a.isNegative ? r : t;
3654
3668
  return s === null ? null : (s + n) / 2;
3655
- }, gs = (e) => {
3669
+ }, ys = (e) => {
3656
3670
  const t = [];
3657
3671
  if (!e.layer.dataLabels.showDataLabels) return {
3658
3672
  labels: t,
3659
3673
  droppedCount: 0
3660
3674
  };
3661
- const { offset: r } = e.layer.dataLabels, a = ys(e.layer);
3675
+ const { offset: r } = e.layer.dataLabels, a = gs(e.layer);
3662
3676
  for (const n of e.layer.data) {
3663
3677
  const s = X(n), i = z(n);
3664
3678
  if (s === null || i === null || !Ke(s, i)) continue;
3665
3679
  const o = e.formatLabel(n);
3666
3680
  if (o === "") continue;
3667
- const { width: l, height: c } = e.measureDataLabel("observation", "outside", o), d = Ae({
3681
+ const { width: l, height: c } = e.measureDataLabel("observation", "outside", o), u = Ee({
3668
3682
  box: {
3669
3683
  x: s * e.panelRect.width,
3670
3684
  y: (1 - i) * e.panelRect.height,
3671
3685
  width: 0,
3672
3686
  height: 0
3673
3687
  },
3674
- panel: ve(e.panelRect),
3688
+ panel: Ae(e.panelRect),
3675
3689
  orientation: {
3676
3690
  valueAxis: "y",
3677
3691
  valueDirectionSign: -1
@@ -3683,21 +3697,21 @@ var is = " · ", Be = 2, os = (e) => {
3683
3697
  });
3684
3698
  t.push({
3685
3699
  layerId: e.layer.id,
3686
- x: d.x,
3687
- y: d.y,
3700
+ x: u.x,
3701
+ y: u.y,
3688
3702
  text: o,
3689
3703
  width: l,
3690
3704
  height: c,
3691
3705
  isRotated: !1,
3692
3706
  role: "observation",
3693
- position: d.position
3707
+ position: u.position
3694
3708
  });
3695
3709
  }
3696
3710
  return {
3697
3711
  labels: t,
3698
3712
  droppedCount: 0
3699
3713
  };
3700
- }, ys = (e) => {
3714
+ }, gs = (e) => {
3701
3715
  const { position: t, justify: r, align: a } = e.dataLabels;
3702
3716
  return t === "auto" ? {
3703
3717
  placement: "outside",
@@ -3772,7 +3786,7 @@ var is = " · ", Be = 2, os = (e) => {
3772
3786
  identity: !0,
3773
3787
  fill: !0
3774
3788
  }
3775
- }, this.highlightStrategy = "overlay-anchor", this.spatialKind = "buckets", this.resolveAnchorPosition = Qe, this.getDataLabelPlacements = (t) => gs(t);
3789
+ }, this.highlightStrategy = "overlay-anchor", this.spatialKind = "buckets", this.resolveAnchorPosition = Qe, this.getDataLabelPlacements = (t) => ys(t);
3776
3790
  }
3777
3791
  compile(e) {
3778
3792
  return {
@@ -3792,22 +3806,22 @@ var is = " · ", Be = 2, os = (e) => {
3792
3806
  if (o === null || l === null || !Ke(o, l)) continue;
3793
3807
  const c = e.formatLabel(i);
3794
3808
  if (c === "") continue;
3795
- const { width: d, height: f } = e.measureDataLabel("observation", "outside", c), u = s.get("size", i) / 2, p = Ae({
3809
+ const { width: u, height: f } = e.measureDataLabel("observation", "outside", c), d = s.get("size", i) / 2, p = Ee({
3796
3810
  box: {
3797
3811
  x: o * e.panelRect.width,
3798
3812
  y: (1 - l) * e.panelRect.height,
3799
3813
  width: 0,
3800
3814
  height: 0
3801
3815
  },
3802
- panel: ve(e.panelRect),
3816
+ panel: Ae(e.panelRect),
3803
3817
  orientation: {
3804
3818
  valueAxis: "y",
3805
3819
  valueDirectionSign: -1
3806
3820
  },
3807
3821
  ...a,
3808
- offset: n ? r : r + u,
3809
- alignOffset: r + u,
3810
- labelWidth: d,
3822
+ offset: n ? r : r + d,
3823
+ alignOffset: r + d,
3824
+ labelWidth: u,
3811
3825
  labelHeight: f
3812
3826
  });
3813
3827
  t.push({
@@ -3815,7 +3829,7 @@ var is = " · ", Be = 2, os = (e) => {
3815
3829
  x: p.x,
3816
3830
  y: p.y,
3817
3831
  text: c,
3818
- width: d,
3832
+ width: u,
3819
3833
  height: f,
3820
3834
  isRotated: !1,
3821
3835
  role: "observation",
@@ -3944,7 +3958,7 @@ var is = " · ", Be = 2, os = (e) => {
3944
3958
  valueKind: "value",
3945
3959
  aes: "x"
3946
3960
  }], this.highlightStrategy = null, this.spatialKind = "noop", this.validateMapping = ({ mapping: t, computedVariables: r }) => {
3947
- const a = r.has("x") || L(ke(t.x)), n = r.has("y") || L(ke(t.y));
3961
+ const a = r.has("x") || L(Le(t.x)), n = r.has("y") || L(Le(t.y));
3948
3962
  return a && n ? [{
3949
3963
  code: "INVALID_RULE_MAPPING",
3950
3964
  message: "rule geom requires exactly one of 'x' or 'y', both were provided"
@@ -3987,7 +4001,7 @@ var is = " · ", Be = 2, os = (e) => {
3987
4001
  };
3988
4002
  }
3989
4003
  }, _t = (e, t) => {
3990
- const r = ke(e);
4004
+ const r = Le(e);
3991
4005
  if (L(r)) return {
3992
4006
  value: r,
3993
4007
  sourceFormat: void 0
@@ -4198,7 +4212,7 @@ var Ms = (e) => {
4198
4212
  const { options: r } = t;
4199
4213
  return e.filter(r.variableName, r.operator, r.value);
4200
4214
  }
4201
- }, Ns = class {
4215
+ }, Ps = class {
4202
4216
  constructor() {
4203
4217
  this.transformType = "reshape";
4204
4218
  }
@@ -4215,7 +4229,7 @@ var Ms = (e) => {
4215
4229
  const { options: t } = e;
4216
4230
  return [t.keyName ?? "key"];
4217
4231
  }
4218
- }, Ps = class {
4232
+ }, Os = class {
4219
4233
  constructor() {
4220
4234
  this.transformType = "sort";
4221
4235
  }
@@ -4223,16 +4237,16 @@ var Ms = (e) => {
4223
4237
  const { options: r } = t;
4224
4238
  return e.orderBy(r.variableName, r.direction ?? "asc");
4225
4239
  }
4226
- }, Os = [
4240
+ }, Ns = [
4227
4241
  new Ds(),
4228
4242
  new Is(),
4229
4243
  new Fs(),
4230
- new Ns(),
4231
- new Ps()
4244
+ new Ps(),
4245
+ new Os()
4232
4246
  ], ro = class extends ur {
4233
4247
  constructor() {
4234
4248
  super("transform");
4235
- for (const e of Os) this.register(e.transformType, e);
4249
+ for (const e of Ns) this.register(e.transformType, e);
4236
4250
  }
4237
4251
  };
4238
4252
  function Bs(e) {
@@ -4334,7 +4348,7 @@ var Tr = (e) => e instanceof Z, wr = (e) => e instanceof Cs, Sr = (e) => "transf
4334
4348
  "#E2BF6B",
4335
4349
  "#95CBA6",
4336
4350
  "#AABCE5"
4337
- ], Ys = "brick", P = {
4351
+ ], Ys = "brick", O = {
4338
4352
  red: "#E83562",
4339
4353
  orange: "#F38650",
4340
4354
  yellow: "#FBBC30",
@@ -4346,17 +4360,17 @@ var Tr = (e) => e instanceof Z, wr = (e) => e instanceof Cs, Sr = (e) => "transf
4346
4360
  plum: "#C82184",
4347
4361
  pink: "#FC8497"
4348
4362
  }, zs = [
4349
- P.purple,
4350
- P.pink,
4351
- P.yellow,
4352
- P.blue,
4353
- P.red,
4354
- P.cyan,
4355
- P.orange,
4356
- P.plum,
4357
- P.green,
4358
- P.dark_purple
4359
- ], N = {
4363
+ O.purple,
4364
+ O.pink,
4365
+ O.yellow,
4366
+ O.blue,
4367
+ O.red,
4368
+ O.cyan,
4369
+ O.orange,
4370
+ O.plum,
4371
+ O.green,
4372
+ O.dark_purple
4373
+ ], P = {
4360
4374
  green: "#B2DDC9",
4361
4375
  cyan: "#A2D5E2",
4362
4376
  blue: "#AAC4FF",
@@ -4367,16 +4381,16 @@ var Tr = (e) => e instanceof Z, wr = (e) => e instanceof Cs, Sr = (e) => "transf
4367
4381
  orange: "#FFDEB4",
4368
4382
  yellow: "#FDF7C3"
4369
4383
  }, Gs = [
4370
- N.green,
4371
- N.purple,
4372
- N.red,
4373
- N.cyan,
4374
- N.pink,
4375
- N.blue,
4376
- N.orange,
4377
- N.plum,
4378
- N.yellow
4379
- ], me = {
4384
+ P.green,
4385
+ P.purple,
4386
+ P.red,
4387
+ P.cyan,
4388
+ P.pink,
4389
+ P.blue,
4390
+ P.orange,
4391
+ P.plum,
4392
+ P.yellow
4393
+ ], be = {
4380
4394
  brick900: "#6E0500",
4381
4395
  brick800: "#881D11",
4382
4396
  brick700: "#A03522",
@@ -4477,11 +4491,11 @@ var Tr = (e) => e instanceof Z, wr = (e) => e instanceof Cs, Sr = (e) => "transf
4477
4491
  pink200: "#FED0F3",
4478
4492
  pink100: "#FFE8F9",
4479
4493
  pink50: "#FFF4FC"
4480
- }, io = [me.brick100, me.brick900], js = [
4481
- me.gray200,
4482
- N.green,
4483
- N.red,
4484
- me.gray200
4494
+ }, io = [be.brick100, be.brick900], js = [
4495
+ be.gray200,
4496
+ P.green,
4497
+ P.red,
4498
+ be.gray200
4485
4499
  ], Ct = {
4486
4500
  dark: {
4487
4501
  1: [500],
@@ -4590,7 +4604,7 @@ var Tr = (e) => e instanceof Z, wr = (e) => e instanceof Cs, Sr = (e) => "transf
4590
4604
  yellow: "#FBFF00",
4591
4605
  green: "#06FF00",
4592
4606
  blue: "#0079FF"
4593
- }, we = [
4607
+ }, Se = [
4594
4608
  C.cyan,
4595
4609
  C.pink,
4596
4610
  C.purple,
@@ -4604,16 +4618,16 @@ var Tr = (e) => e instanceof Z, wr = (e) => e instanceof Cs, Sr = (e) => "transf
4604
4618
  C.green,
4605
4619
  C.red,
4606
4620
  C.cyan
4607
- ], Se = {
4621
+ ], ke = {
4608
4622
  start: "#84D1FC",
4609
4623
  positive: "#84FC89",
4610
4624
  negative: "#FC8497",
4611
4625
  total: "#84D1FC"
4612
4626
  }, $s = [
4613
- Se.start,
4614
- Se.positive,
4615
- Se.negative,
4616
- Se.total
4627
+ ke.start,
4628
+ ke.positive,
4629
+ ke.negative,
4630
+ ke.total
4617
4631
  ], oo = {
4618
4632
  transform: "linear",
4619
4633
  reverse: !1,
@@ -4641,11 +4655,11 @@ var Tr = (e) => e instanceof Z, wr = (e) => e instanceof Cs, Sr = (e) => "transf
4641
4655
  reverse: !1
4642
4656
  }, Dt = { palette: { type: "default" } };
4643
4657
  function It(e, t = "light", r) {
4644
- return ((r !== void 0 ? Ct[t][r] : void 0) ?? Ct[t].default).map((a) => me[`${e}${a}`]);
4658
+ return ((r !== void 0 ? Ct[t][r] : void 0) ?? Ct[t].default).map((a) => be[`${e}${a}`]);
4645
4659
  }
4646
4660
  function Ks(e) {
4647
- const t = we.indexOf(C[e]);
4648
- return t <= 0 ? we : [...we.slice(t), ...we.slice(0, t)];
4661
+ const t = Se.indexOf(C[e]);
4662
+ return t <= 0 ? Se : [...Se.slice(t), ...Se.slice(0, t)];
4649
4663
  }
4650
4664
  function ho(e, t = {}) {
4651
4665
  switch (e.type) {
@@ -4685,13 +4699,13 @@ function po(e, t, r, a) {
4685
4699
  continue;
4686
4700
  }
4687
4701
  if (o.id !== void 0) {
4688
- const c = n?.find((d) => d.id === o.id)?.hex;
4702
+ const c = n?.find((u) => u.id === o.id)?.hex;
4689
4703
  c !== void 0 ? s[l] = c : e.diagnostics.addWarning({
4690
4704
  code: "PALETTE_NOT_FOUND",
4691
4705
  message: `Palette override at slot ${l} with id '${o.id}' did not resolve against the active palette — falling back to palette color.`,
4692
4706
  context: {
4693
4707
  requested: o.id,
4694
- available: n?.map((d) => d.id) ?? []
4708
+ available: n?.map((u) => u.id) ?? []
4695
4709
  },
4696
4710
  suggestion: "Define the override id in the active custom palette, or use a hex value instead."
4697
4711
  });
@@ -4700,7 +4714,7 @@ function po(e, t, r, a) {
4700
4714
  }
4701
4715
  return Object.keys(s).length > 0 ? s : void 0;
4702
4716
  }
4703
- function go(e, t, r) {
4717
+ function yo(e, t, r) {
4704
4718
  if (!t) return Dt.palette;
4705
4719
  if (t.type === "custom") {
4706
4720
  const a = r[t.id];
@@ -4723,7 +4737,7 @@ function go(e, t, r) {
4723
4737
  }
4724
4738
  return t;
4725
4739
  }
4726
- function yo(e, t = {}) {
4740
+ function go(e, t = {}) {
4727
4741
  const r = t;
4728
4742
  return {
4729
4743
  type: "scale",
@@ -4913,11 +4927,11 @@ var xo = { labelCrossPosition: 0.5 }, Mo = {
4913
4927
  }
4914
4928
  };
4915
4929
  export {
4916
- ve as $,
4930
+ Ae as $,
4917
4931
  Ue as $n,
4918
4932
  ur as $t,
4919
4933
  no as A,
4920
- yi as An,
4934
+ gi as An,
4921
4935
  nn as At,
4922
4936
  Ms as B,
4923
4937
  di as Bn,
@@ -4954,19 +4968,19 @@ export {
4954
4968
  F as Ln,
4955
4969
  ce as Lt,
4956
4970
  ao as M,
4957
- gi as Mn,
4971
+ yi as Mn,
4958
4972
  on as Mt,
4959
4973
  Bs as N,
4960
4974
  hi as Nn,
4961
- gr as Nt,
4975
+ yr as Nt,
4962
4976
  Ys as O,
4963
4977
  qr as On,
4964
4978
  h as Ot,
4965
4979
  ro as P,
4966
- ke as Pn,
4980
+ Le as Pn,
4967
4981
  Ci as Pt,
4968
4982
  Wn as Q,
4969
- Nt as Qn,
4983
+ Pt as Qn,
4970
4984
  Ua as Qt,
4971
4985
  Ts as R,
4972
4986
  he as Rn,
@@ -4978,7 +4992,7 @@ export {
4978
4992
  uo as T,
4979
4993
  Vt as Tn,
4980
4994
  Js as Tr,
4981
- yr as Tt,
4995
+ gr as Tt,
4982
4996
  xs as U,
4983
4997
  Kr as Un,
4984
4998
  Ha as Ut,
@@ -5004,8 +5018,8 @@ export {
5004
5018
  Lo as a,
5005
5019
  ka as an,
5006
5020
  oi as ar,
5007
- Pi as at,
5008
- go as b,
5021
+ Oi as at,
5022
+ yo as b,
5009
5023
  Qr as bn,
5010
5024
  ti as br,
5011
5025
  ji as bt,
@@ -5017,9 +5031,9 @@ export {
5017
5031
  ae as dn,
5018
5032
  ni as dr,
5019
5033
  zi as dt,
5020
- Na as en,
5034
+ Pa as en,
5021
5035
  si as er,
5022
- Ae as et,
5036
+ Ee as et,
5023
5037
  _o as f,
5024
5038
  wa as fn,
5025
5039
  Br as fr,
@@ -5031,7 +5045,7 @@ export {
5031
5045
  vo as h,
5032
5046
  Zr as hn,
5033
5047
  ie as hr,
5034
- Oi as ht,
5048
+ Ni as ht,
5035
5049
  Ro as i,
5036
5050
  Ye as in,
5037
5051
  le as ir,
@@ -5052,27 +5066,27 @@ export {
5052
5066
  Bi as mt,
5053
5067
  Io as n,
5054
5068
  Ke as nn,
5055
- Ot as nr,
5069
+ Nt as nr,
5056
5070
  Xi as nt,
5057
5071
  xo as o,
5058
5072
  Sa as on,
5059
5073
  m as or,
5060
5074
  xn as ot,
5061
5075
  Eo as p,
5062
- ga as pn,
5063
- Or as pr,
5076
+ ya as pn,
5077
+ Nr as pr,
5064
5078
  Ui as pt,
5065
5079
  kt as q,
5066
5080
  q as qn,
5067
5081
  ki as qt,
5068
5082
  ko as r,
5069
5083
  Ti as rn,
5070
- Pt as rr,
5084
+ Ot as rr,
5071
5085
  Ki as rt,
5072
5086
  Co as s,
5073
5087
  xi as sn,
5074
5088
  Gr as sr,
5075
- Ni as st,
5089
+ Pi as st,
5076
5090
  Do as t,
5077
5091
  ne as tn,
5078
5092
  b as tr,
@@ -5081,16 +5095,16 @@ export {
5081
5095
  Mi as un,
5082
5096
  Yr as ur,
5083
5097
  Gi as ut,
5084
- yo as v,
5098
+ go as v,
5085
5099
  bi as vn,
5086
5100
  ai as vr,
5087
5101
  $i as vt,
5088
5102
  co as w,
5089
- Le as wn,
5103
+ ye as wn,
5090
5104
  We as wr,
5091
5105
  Ce as wt,
5092
5106
  po as x,
5093
- be as xn,
5107
+ ve as xn,
5094
5108
  Zs as xr,
5095
5109
  Fi as xt,
5096
5110
  fo as y,