@graphysdk/viz-engine 1.9.0-beta.1789369549494 → 1.9.0-beta.1789377729015

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,56 +1,56 @@
1
- import { differenceInDays as qe, isBefore as Qe, isValid as b, isWithinInterval as Je, parse as R } from "date-fns";
1
+ import { differenceInDays as qe, isBefore as Qe, isValid as b, isWithinInterval as Je, parse as C } from "date-fns";
2
2
  import { isEqual as Ze, isInteger as et } from "lodash-es";
3
- var qr = (e) => e.length > 0;
3
+ var Xr = (e) => e.length > 0;
4
4
  function ve(e) {
5
5
  return e != null;
6
6
  }
7
- function Qr(e) {
7
+ function qr(e) {
8
8
  if (e === null || typeof e != "object") return !1;
9
9
  const t = Object.getPrototypeOf(e);
10
10
  return t === Object.prototype || t === null;
11
11
  }
12
- var J = (e) => e instanceof Date && b(e), Jr = (e) => J(e) || e === null, Zr = (e) => typeof e == "string", tt = (e) => typeof e == "number" && !Number.isNaN(e) && Number.isFinite(e), ea = (e) => tt(e) || e === null, Ae = "\0graphy\0_", m = (e) => `${Ae}${e}`, Ee = { x: m("constantX") }, ta = {
13
- bar: m("barSeriesLabel"),
14
- line: m("lineSeriesLabel")
12
+ var J = (e) => e instanceof Date && b(e), Qr = (e) => J(e) || e === null, Jr = (e) => typeof e == "string", tt = (e) => typeof e == "number" && !Number.isNaN(e) && Number.isFinite(e), Zr = (e) => tt(e) || e === null, Ae = "\0graphy\0_", y = (e) => `${Ae}${e}`, Ee = { x: y("constantX") }, ea = {
13
+ bar: y("barSeriesLabel"),
14
+ line: y("lineSeriesLabel")
15
15
  }, Me = {
16
- count: m("count"),
17
- mean: m("mean"),
18
- sum: m("sum")
19
- }, rt = { group: m("group") }, at = {
20
- x: m("x"),
21
- y: m("y"),
22
- xMin: m("xMin"),
23
- xMax: m("xMax"),
24
- yMin: m("yMin"),
25
- yMax: m("yMax"),
26
- yRaw: m("yRaw")
27
- }, nt = { role: m("stackRole") }, st = {
28
- color: m("color"),
29
- size: m("size"),
30
- alpha: m("alpha"),
31
- strokeWidth: m("strokeWidth"),
32
- lineType: m("lineType")
33
- }, ot = {
34
- y: m("ruleY"),
35
- x: m("ruleX")
36
- }, ra = {
16
+ count: y("count"),
17
+ mean: y("mean"),
18
+ sum: y("sum")
19
+ }, rt = { group: y("group") }, at = {
20
+ x: y("x"),
21
+ y: y("y"),
22
+ xMin: y("xMin"),
23
+ xMax: y("xMax"),
24
+ yMin: y("yMin"),
25
+ yMax: y("yMax"),
26
+ yRaw: y("yRaw")
27
+ }, nt = { role: y("stackRole") }, ot = {
28
+ color: y("color"),
29
+ size: y("size"),
30
+ alpha: y("alpha"),
31
+ strokeWidth: y("strokeWidth"),
32
+ lineType: y("lineType")
33
+ }, st = {
34
+ y: y("ruleY"),
35
+ x: y("ruleX")
36
+ }, ta = {
37
37
  ...Ee,
38
38
  ...Me,
39
39
  ...rt,
40
40
  ...at,
41
41
  ...nt,
42
- ...st,
43
- ...ot
44
- }, it = new Set(Object.values(Me)), aa = (e) => m(`scaled_${e}`), na = (e) => e.startsWith(Ae), sa = (e) => it.has(e);
42
+ ...ot,
43
+ ...st
44
+ }, it = new Set(Object.values(Me)), ra = (e) => y(`scaled_${e}`), aa = (e) => e.startsWith(Ae), na = (e) => it.has(e);
45
45
  function oa(e) {
46
46
  const { numeric: t, categorical: r, temporal: a } = e.groupVariableNamesByType();
47
47
  return a[0] ?? r[0] ?? t[0] ?? "";
48
48
  }
49
- function ia(e, t) {
49
+ function sa(e, t) {
50
50
  const { categorical: r, temporal: a } = e.groupVariableNamesByType(), n = [...r, ...a];
51
51
  return t === "" || n.includes(t) ? n : [t, ...n];
52
52
  }
53
- function la(e) {
53
+ function ia(e) {
54
54
  const t = Te(e.x);
55
55
  return t === null || t === Ee.x ? "" : t;
56
56
  }
@@ -61,7 +61,7 @@ function lt(e) {
61
61
  if (!(!ve(e) || typeof e == "string") && "value" in e)
62
62
  return e.value;
63
63
  }
64
- function ca(e, t) {
64
+ function la(e, t) {
65
65
  return [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])].every((r) => ne(e[r]) === ne(t[r]));
66
66
  }
67
67
  function ne(e) {
@@ -85,13 +85,13 @@ var re = "en-GB", we = class extends Error {
85
85
  code: e.code ?? "INTERNAL_INVARIANT"
86
86
  }), this.kind = "internal";
87
87
  }
88
- }, _e = (e) => e.type === "lookup", ct = (e) => e.type === "text", j = (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", dt = (e) => e.type === "decimal" || e.type === "integer" || e.type === "percentage" || e.type === "duration" || e.type === "currency", da = (e) => e.type === "currency", ua = (e) => e.type === "month" || e.type === "day_month" || e.type === "weekly_date_range", De = (e) => {
89
- if (_e(e)) return De(e.fallback);
88
+ }, _e = (e) => e.type === "lookup", ct = (e) => e.type === "text", j = (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", dt = (e) => e.type === "decimal" || e.type === "integer" || e.type === "percentage" || e.type === "duration" || e.type === "currency", ca = (e) => e.type === "currency", da = (e) => e.type === "month" || e.type === "day_month" || e.type === "weekly_date_range", Le = (e) => {
89
+ if (_e(e)) return Le(e.fallback);
90
90
  if (j(e)) return "temporal";
91
91
  if (dt(e)) return "numeric";
92
92
  if (ct(e)) return "categorical";
93
93
  throw new E({ message: `No data type found for value format: ${e.type}` });
94
- }, fa = (e) => _e(e) ? e.fallback : e, ut = class {
94
+ }, ua = (e) => _e(e) ? e.fallback : e, ut = class {
95
95
  constructor() {
96
96
  this.currentYear = (/* @__PURE__ */ new Date()).getUTCFullYear(), this.previousDate = null, this.previousYear = null;
97
97
  }
@@ -110,7 +110,7 @@ var re = "en-GB", we = class extends Error {
110
110
  "m",
111
111
  "b",
112
112
  "t"
113
- ], gt = new RegExp(`^-?(\\d{1,3}(,\\d{3})*|\\d+)\\.?\\d*(${ae.join("|")})?$`, "i"), yt = /^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?%?$/, O = (e) => e === null || e instanceof Date || Array.isArray(e) || typeof e == "boolean" ? !1 : typeof e == "string" ? gt.test(e) && !Number.isNaN(Number(e.replace(new RegExp(`[,${ae.join("")}]`, "gi"), ""))) : !Number.isNaN(Number(e)), Fe = (e) => O(e) ? !0 : typeof e == "string" ? yt.test(e) : !1, mt = /^\d{4}-\d{2}-\d{2}(T|\s)\d{1,2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|\+00:00)?$/, ht = /^\s*(19\d{2}|2[01]\d{2})\s*$/, pt = [
113
+ ], gt = new RegExp(`^-?(\\d{1,3}(,\\d{3})*|\\d+)\\.?\\d*(${ae.join("|")})?$`, "i"), mt = /^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?%?$/, O = (e) => e === null || e instanceof Date || Array.isArray(e) || typeof e == "boolean" ? !1 : typeof e == "string" ? gt.test(e) && !Number.isNaN(Number(e.replace(new RegExp(`[,${ae.join("")}]`, "gi"), ""))) : !Number.isNaN(Number(e)), ke = (e) => O(e) ? !0 : typeof e == "string" ? mt.test(e) : !1, yt = /^\d{4}-\d{2}-\d{2}(T|\s)\d{1,2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|\+00:00)?$/, ht = /^\s*(19\d{2}|2[01]\d{2})\s*$/, pt = [
114
114
  [/\bJan\b/i, "January"],
115
115
  [/\bFeb\b/i, "February"],
116
116
  [/\bMar\b/i, "March"],
@@ -127,12 +127,12 @@ var re = "en-GB", we = class extends Error {
127
127
  "en-GB": "DMY",
128
128
  "pt-PT": "DMY",
129
129
  ar: "DMY"
130
- }, ke = [
130
+ }, De = [
131
131
  "/",
132
132
  "-",
133
133
  ".",
134
134
  " "
135
- ], se = [
135
+ ], oe = [
136
136
  [
137
137
  "d",
138
138
  "M",
@@ -203,7 +203,7 @@ var re = "en-GB", we = class extends Error {
203
203
  "MMMM",
204
204
  "yyyy"
205
205
  ]
206
- ], oe = [
206
+ ], se = [
207
207
  [
208
208
  "M",
209
209
  "d",
@@ -310,7 +310,7 @@ var re = "en-GB", we = class extends Error {
310
310
  "MMMM",
311
311
  "do"
312
312
  ]
313
- ], Le = [
313
+ ], Fe = [
314
314
  ["d", "MMMM"],
315
315
  ["dd", "MMMM"],
316
316
  ["do", "MMMM"],
@@ -334,70 +334,70 @@ var re = "en-GB", we = class extends Error {
334
334
  dateFormat: "yyyy-MM",
335
335
  type: "month_year"
336
336
  }
337
- ], Se = 1900, Oe = 2199, At = 3, Et = 6, Mt = 5, Tt = 1, wt = 28, _t = /\s*[–—]\s*|\s-\s/, Dt = (e) => typeof e == "number" ? Number.isNaN(e) ? !1 : e >= Se && e <= Oe : typeof e == "string" ? ht.test(e) : !1, Ne = (e, t) => {
337
+ ], Se = 1900, Oe = 2199, At = 3, Et = 6, Mt = 5, Tt = 1, wt = 28, _t = /\s*[–—]\s*|\s-\s/, Lt = (e) => typeof e == "number" ? Number.isNaN(e) ? !1 : e >= Se && e <= Oe : typeof e == "string" ? ht.test(e) : !1, Ne = (e, t) => {
338
338
  const r = V(e);
339
- return !t && O(r) ? St(r) : typeof r == "string" ? t ? b(R(r, t, /* @__PURE__ */ new Date())) : !!Ce(r) || $(r) && b(new Date(r)) : b(r);
339
+ return !t && O(r) ? St(r) : typeof r == "string" ? t ? b(C(r, t, /* @__PURE__ */ new Date())) : !!Re(r) || $(r) && b(new Date(r)) : b(r);
340
340
  }, V = (e) => {
341
341
  if (typeof e != "string") return e;
342
342
  let t = e;
343
343
  for (const [r, a] of pt) t = t.replace(r, a);
344
344
  return t;
345
- }, Ce = (e, t = re) => {
345
+ }, Re = (e, t = re) => {
346
346
  const r = V(e);
347
- return $(r) ? { type: "datetime" } : Re(t).find((a) => !j(a) || a.type === "month" && r.length < At ? !1 : a.dateFormat && b(R(r, a.dateFormat, /* @__PURE__ */ new Date())));
348
- }, $ = (e) => mt.test(e.trim()), Ft = (e) => {
347
+ return $(r) ? { type: "datetime" } : Ce(t).find((a) => !j(a) || a.type === "month" && r.length < At ? !1 : a.dateFormat && b(C(r, a.dateFormat, /* @__PURE__ */ new Date())));
348
+ }, $ = (e) => yt.test(e.trim()), kt = (e) => {
349
349
  if (e instanceof Date) return b(e) ? e : null;
350
350
  if (typeof e != "string" || !$(e)) return null;
351
351
  const t = new Date(e.trim());
352
352
  return b(t) ? t : null;
353
- }, kt = (e, t = re) => {
353
+ }, Dt = (e, t = re) => {
354
354
  const [r, a] = e.split(_t);
355
355
  if (!r || !a) return;
356
- const n = V(r).trim(), s = V(a).trim();
357
- return Lt(t).find((o) => {
358
- if (!j(o) || !o.dateFormat) return !1;
359
- const i = R(n, o.dateFormat, /* @__PURE__ */ new Date()), d = R(s, o.dateFormat, /* @__PURE__ */ new Date());
356
+ const n = V(r).trim(), o = V(a).trim();
357
+ return Ft(t).find((s) => {
358
+ if (!j(s) || !s.dateFormat) return !1;
359
+ const i = C(n, s.dateFormat, /* @__PURE__ */ new Date()), d = C(o, s.dateFormat, /* @__PURE__ */ new Date());
360
360
  if (!b(i) || !b(d)) return !1;
361
- const f = new ut(), y = f.incrementYearIfNeeded(i), p = f.incrementYearIfNeeded(d), g = qe(p, y);
362
- return Je(new Date(y.getFullYear(), Tt, wt), {
363
- start: y,
361
+ const f = new ut(), m = f.incrementYearIfNeeded(i), p = f.incrementYearIfNeeded(d), g = qe(p, m);
362
+ return Je(new Date(m.getFullYear(), Tt, wt), {
363
+ start: m,
364
364
  end: p
365
365
  }) && g === Mt ? !0 : g === Et;
366
366
  });
367
- }, Re = (e) => {
367
+ }, Ce = (e) => {
368
368
  const t = {
369
369
  date: Ie(e),
370
370
  year: [["yyyy"]],
371
- day_month: Le,
371
+ day_month: Fe,
372
372
  month_year: [["MMMM", "yyyy"], ["yyyy", "MMMM"]],
373
373
  month: [["MMMM"]],
374
374
  quarter: [["QQQ", "yyyy"], ["yyyy", "QQQ"]]
375
375
  };
376
- return [...vt, ...Object.entries(t).flatMap(([r, a]) => a.flatMap((n) => ke.map((s) => ({
377
- dateFormat: n.join(s),
376
+ return [...vt, ...Object.entries(t).flatMap(([r, a]) => a.flatMap((n) => De.map((o) => ({
377
+ dateFormat: n.join(o),
378
378
  type: r
379
379
  }))))];
380
380
  }, Ie = (e) => bt[e] === "MDY" ? [
381
- ...oe,
382
381
  ...se,
382
+ ...oe,
383
383
  ...ie
384
384
  ] : [
385
- ...se,
386
385
  ...oe,
386
+ ...se,
387
387
  ...ie
388
- ], Lt = (e) => {
388
+ ], Ft = (e) => {
389
389
  const t = {
390
- weekly_date_range: Le,
390
+ weekly_date_range: Fe,
391
391
  weekly_date_range_with_year: Ie(e)
392
392
  };
393
- return Object.entries(t).flatMap(([r, a]) => a.flatMap((n) => ke.map((s) => ({
394
- dateFormat: n.join(s),
393
+ return Object.entries(t).flatMap(([r, a]) => a.flatMap((n) => De.map((o) => ({
394
+ dateFormat: n.join(o),
395
395
  type: r
396
396
  }))));
397
397
  }, St = (e) => {
398
398
  const t = Number(e);
399
399
  if (!et(t)) return !1;
400
- const r = new Date(t), a = /* @__PURE__ */ new Date(t * 1e3), n = (s) => b(s) && s.getFullYear() >= Se && s.getFullYear() <= Oe;
400
+ const r = new Date(t), a = /* @__PURE__ */ new Date(t * 1e3), n = (o) => b(o) && o.getFullYear() >= Se && o.getFullYear() <= Oe;
401
401
  return n(r) || n(a);
402
402
  }, xe = {
403
403
  $: "usd",
@@ -452,7 +452,7 @@ var re = "en-GB", we = class extends Error {
452
452
  }, Pe = (e) => Object.keys(xe).sort((t, r) => r.length - t.length).find((t) => e.includes(t)), je = (e) => {
453
453
  const t = Object.entries(e);
454
454
  return !t.length || !t.some(([, r]) => !I(r));
455
- }, I = (e) => typeof e == "string" && e.trim() === "" || e === void 0 || e === null || e === "-", Nt = /\s*[–—]\s*|\s-\s/, ze = (e, t, r) => {
455
+ }, I = (e) => typeof e == "string" && e.trim() === "" || e === void 0 || e === null || e === "-", Nt = /\s*[–—]\s*|\s-\s/, We = (e, t, r) => {
456
456
  if (I(e)) return null;
457
457
  switch (t.type) {
458
458
  case "decimal":
@@ -460,9 +460,9 @@ var re = "en-GB", we = class extends Error {
460
460
  case "duration":
461
461
  return Ue(e);
462
462
  case "percentage":
463
- return Ct(e);
464
- case "currency":
465
463
  return Rt(e);
464
+ case "currency":
465
+ return Ct(e);
466
466
  case "datetime":
467
467
  case "date":
468
468
  case "year":
@@ -471,7 +471,7 @@ var re = "en-GB", we = class extends Error {
471
471
  case "day_month":
472
472
  case "quarter":
473
473
  case "time":
474
- return We(e, t.dateFormat, r);
474
+ return ze(e, t.dateFormat, r);
475
475
  case "weekly_date_range":
476
476
  case "weekly_date_range_with_year":
477
477
  return It(e, t.dateFormat, r);
@@ -482,22 +482,22 @@ var re = "en-GB", we = class extends Error {
482
482
  default:
483
483
  throw new E({ message: `Unhandled value format: ${t.type}` });
484
484
  }
485
- }, We = (e, t, r) => {
485
+ }, ze = (e, t, r) => {
486
486
  if (e instanceof Date) return b(e) ? e : null;
487
487
  const a = V(String(e).trim());
488
488
  if (a.length === 0) return null;
489
489
  const n = /* @__PURE__ */ new Date();
490
490
  if (t) {
491
- const o = R(a, t, n);
492
- return b(o) ? H(o) : null;
491
+ const s = C(a, t, n);
492
+ return b(s) ? H(s) : null;
493
493
  }
494
- for (const o of Re(r)) {
495
- if (!j(o) || !o.dateFormat) continue;
496
- const i = R(a, o.dateFormat, n);
494
+ for (const s of Ce(r)) {
495
+ if (!j(s) || !s.dateFormat) continue;
496
+ const i = C(a, s.dateFormat, n);
497
497
  if (b(i)) return H(i);
498
498
  }
499
- const s = new Date(a);
500
- return Ne(s) ? $(a) ? s : H(s) : null;
499
+ const o = new Date(a);
500
+ return Ne(o) ? $(a) ? o : H(o) : null;
501
501
  }, Ue = (e) => {
502
502
  if (typeof e == "number") return Number.isNaN(e) ? null : e;
503
503
  if (typeof e != "string") return null;
@@ -509,28 +509,28 @@ var re = "en-GB", we = class extends Error {
509
509
  break;
510
510
  }
511
511
  return Number(t.split(",").join("")) * r;
512
- }, Ct = (e) => {
512
+ }, Rt = (e) => {
513
513
  if (typeof e == "number") return Number.isNaN(e) ? null : e;
514
514
  if (typeof e != "string") return null;
515
515
  const t = e.trim();
516
- if (!Fe(t)) return null;
516
+ if (!ke(t)) return null;
517
517
  const r = Number(t.replace(/%/g, "").replace(/,/g, "")) / 100;
518
518
  return Number.isNaN(r) ? null : r;
519
- }, Rt = (e) => {
519
+ }, Ct = (e) => {
520
520
  if (typeof e == "number") return Number.isNaN(e) ? null : e;
521
521
  if (typeof e != "string") return null;
522
522
  const t = e.trim();
523
523
  return Be(t) ? Ue(Ve(t)) : null;
524
524
  }, It = (e, t, r) => {
525
- const a = String(e).trim().split(Nt), [n, s] = [a[0]?.trim(), a[1]?.trim()];
526
- return !n || !s ? null : We(n, t, r);
525
+ const a = String(e).trim().split(Nt), [n, o] = [a[0]?.trim(), a[1]?.trim()];
526
+ return !n || !o ? null : ze(n, t, r);
527
527
  }, xt = (e) => String(e).trim(), H = (e) => new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds())), Bt = (e, t, r) => {
528
- const a = ze(e, t, r);
529
- return a !== null || !j(t) ? a : Ft(e);
530
- }, C = process.env.NODE_ENV !== "production";
531
- var G = !0, ga = (e) => {
528
+ const a = We(e, t, r);
529
+ return a !== null || !j(t) ? a : kt(e);
530
+ }, R = process.env.NODE_ENV !== "production";
531
+ var G = !0, fa = (e) => {
532
532
  G = e;
533
- }, ya = () => G, ma = () => {
533
+ }, ga = () => G, ma = () => {
534
534
  let e = null;
535
535
  const t = {
536
536
  hits: 0,
@@ -538,15 +538,15 @@ var G = !0, ga = (e) => {
538
538
  };
539
539
  return Object.assign((a, n) => {
540
540
  if (!G)
541
- return C && (t.misses += 1), n();
541
+ return R && (t.misses += 1), n();
542
542
  if (e && Ye(e.args, a))
543
- return C && (t.hits += 1), e.out;
544
- C && (t.misses += 1);
545
- const s = n();
543
+ return R && (t.hits += 1), e.out;
544
+ R && (t.misses += 1);
545
+ const o = n();
546
546
  return e = {
547
547
  args: a,
548
- out: s
549
- }, s;
548
+ out: o
549
+ }, o;
550
550
  }, {
551
551
  stats: t,
552
552
  reset: () => {
@@ -558,26 +558,26 @@ var G = !0, ga = (e) => {
558
558
  hits: 0,
559
559
  misses: 0
560
560
  };
561
- return Object.assign((a, n, s) => {
561
+ return Object.assign((a, n, o) => {
562
562
  if (!G)
563
- return C && (t.misses += 1), s();
564
- const o = e.get(a);
565
- if (o) for (let d = 0; d < o.length; d += 1) {
566
- const f = o[d];
563
+ return R && (t.misses += 1), o();
564
+ const s = e.get(a);
565
+ if (s) for (let d = 0; d < s.length; d += 1) {
566
+ const f = s[d];
567
567
  if (f && Ye(f.args, n))
568
- return C && (t.hits += 1), d > 0 && (o.splice(d, 1), o.unshift(f)), f.out;
568
+ return R && (t.hits += 1), d > 0 && (s.splice(d, 1), s.unshift(f)), f.out;
569
569
  }
570
- C && (t.misses += 1);
571
- const i = s();
572
- return o ? (o.unshift({
570
+ R && (t.misses += 1);
571
+ const i = o();
572
+ return s ? (s.unshift({
573
573
  args: n,
574
574
  out: i
575
- }), o.length > 16 && (o.length = 16)) : e.set(a, [{
575
+ }), s.length > 16 && (s.length = 16)) : e.set(a, [{
576
576
  args: n,
577
577
  out: i
578
578
  }]), i;
579
579
  }, { stats: t });
580
- }, ha = (...e) => e.reduce((t, r) => ({
580
+ }, ya = (...e) => e.reduce((t, r) => ({
581
581
  hits: t.hits + r.hits,
582
582
  misses: t.misses + r.misses
583
583
  }), {
@@ -600,7 +600,7 @@ var G = !0, ga = (e) => {
600
600
  key(e) {
601
601
  return this.singletonKey;
602
602
  }
603
- }, Z = (e) => (Array.isArray(e) ? e : [e]).map((t) => t instanceof Date ? t.toISOString() : String(t ?? "<null>")).join("\0"), pa = (e, t) => e === t ? !0 : J(e) && J(t) ? e.getTime() === t.getTime() : !1, jt = /* @__PURE__ */ new Set([
603
+ }, Z = (e) => (Array.isArray(e) ? e : [e]).map((t) => t instanceof Date ? t.toISOString() : String(t ?? "<null>")).join("\0"), ha = (e, t) => e === t ? !0 : J(e) && J(t) ? e.getTime() === t.getTime() : !1, jt = /* @__PURE__ */ new Set([
604
604
  "count",
605
605
  "sum",
606
606
  "mean",
@@ -613,32 +613,32 @@ function Ge(e, t, r) {
613
613
  const a = r?.length ?? t.length;
614
614
  if (e === "count") return a;
615
615
  if (e === "median" || e === "mode") {
616
- const o = [];
616
+ const s = [];
617
617
  for (let i = 0; i < a; i++) {
618
618
  const d = K(t, r, i);
619
- X(d) && o.push(d);
619
+ X(d) && s.push(d);
620
620
  }
621
- return o.length === 0 ? null : e === "median" ? Ut(o) : Yt(o);
621
+ return s.length === 0 ? null : e === "median" ? Ut(s) : Yt(s);
622
622
  }
623
623
  if (e === "sum" || e === "mean") {
624
- let o = 0, i = 0;
624
+ let s = 0, i = 0;
625
625
  for (let d = 0; d < a; d++) {
626
626
  const f = K(t, r, d);
627
- X(f) && (o++, i += Number(f));
627
+ X(f) && (s++, i += Number(f));
628
628
  }
629
- return o === 0 ? null : e === "sum" ? i : i / o;
629
+ return s === 0 ? null : e === "sum" ? i : i / s;
630
630
  }
631
631
  const n = e === "min" ? -1 : 1;
632
- let s = null;
633
- for (let o = 0; o < a; o++) {
634
- const i = K(t, r, o);
635
- X(i) && (s === null || zt(i, s) === n) && (s = i);
632
+ let o = null;
633
+ for (let s = 0; s < a; s++) {
634
+ const i = K(t, r, s);
635
+ X(i) && (o === null || Wt(i, o) === n) && (o = i);
636
636
  }
637
- return s;
637
+ return o;
638
638
  }
639
- var K = (e, t, r) => e[t?.[r] ?? r] ?? null, X = (e) => e !== null && !(typeof e == "number" && Number.isNaN(e)), zt = (e, t) => e === null || t === null ? 0 : e < t ? -1 : e > t ? 1 : 0, Wt = (e) => e instanceof Date ? e.getTime() : e ?? null;
639
+ var K = (e, t, r) => e[t?.[r] ?? r] ?? null, X = (e) => e !== null && !(typeof e == "number" && Number.isNaN(e)), Wt = (e, t) => e === null || t === null ? 0 : e < t ? -1 : e > t ? 1 : 0, zt = (e) => e instanceof Date ? e.getTime() : e ?? null;
640
640
  function Ut(e) {
641
- const t = e.map(Number).sort((s, o) => s - o);
641
+ const t = e.map(Number).sort((o, s) => o - s);
642
642
  if (t.length === 1) return t[0] ?? 0;
643
643
  const r = (t.length - 1) / 2, a = Math.floor(r), n = t[a] ?? 0;
644
644
  return n + ((t[a + 1] ?? n) - n) * (r - a);
@@ -646,17 +646,17 @@ function Ut(e) {
646
646
  function Yt(e) {
647
647
  const t = /* @__PURE__ */ new Map();
648
648
  for (const n of e) {
649
- const s = Wt(n), o = t.get(s);
650
- o === void 0 ? t.set(s, {
649
+ const o = zt(n), s = t.get(o);
650
+ s === void 0 ? t.set(o, {
651
651
  value: n,
652
652
  count: 1
653
- }) : o.count++;
653
+ }) : s.count++;
654
654
  }
655
655
  let r = null, a = 0;
656
- for (const { value: n, count: s } of t.values()) s > a && (a = s, r = n);
656
+ for (const { value: n, count: o } of t.values()) o > a && (a = o, r = n);
657
657
  return r;
658
658
  }
659
- var $t = (e) => e == null || typeof e == "number" && Number.isNaN(e), Gt = (e) => e instanceof Date ? e.getTime() : e ?? null, ee = class L {
659
+ var $t = (e) => e == null || typeof e == "number" && Number.isNaN(e), Gt = (e) => e instanceof Date ? e.getTime() : e ?? null, ee = class F {
660
660
  constructor(t, r, a, n = null) {
661
661
  this.rowShape = null, this.names = t, this.columns = r, this.rowCount = a, this.source = n;
662
662
  }
@@ -665,7 +665,7 @@ var $t = (e) => e == null || typeof e == "number" && Number.isNaN(e), Gt = (e) =
665
665
  }
666
666
  static from(t) {
667
667
  const r = Object.entries(t);
668
- return new L(r.map(([a]) => a), new Map(r), r[0]?.[1].length ?? 0);
668
+ return new F(r.map(([a]) => a), new Map(r), r[0]?.[1].length ?? 0);
669
669
  }
670
670
  columnNames() {
671
671
  return [...this.names];
@@ -679,31 +679,31 @@ var $t = (e) => e == null || typeof e == "number" && Number.isNaN(e), Gt = (e) =
679
679
  if (this.source === null || !this.names.includes(t)) return;
680
680
  const a = this.source.table.values(t);
681
681
  if (a === void 0) return;
682
- const { indices: n } = this.source, s = new Array(n.length);
683
- for (let o = 0; o < n.length; o++) s[o] = a[n[o] ?? 0] ?? null;
684
- return this.columns.set(t, s), this.columns.size === this.names.length && (this.source = null), s;
682
+ const { indices: n } = this.source, o = new Array(n.length);
683
+ for (let s = 0; s < n.length; s++) o[s] = a[n[s] ?? 0] ?? null;
684
+ return this.columns.set(t, o), this.columns.size === this.names.length && (this.source = null), o;
685
685
  }
686
686
  assign(t, r) {
687
687
  const a = this.gathered(), n = new Map(a.columns);
688
688
  n.set(t, r);
689
- const s = a.names.includes(t) ? [...a.names] : [...a.names, t];
690
- return new L(s, n, a.names.length === 0 ? r.length : a.rowCount);
689
+ const o = a.names.includes(t) ? [...a.names] : [...a.names, t];
690
+ return new F(o, n, a.names.length === 0 ? r.length : a.rowCount);
691
691
  }
692
692
  select(t) {
693
693
  const r = t.filter((n) => this.names.includes(n)), a = /* @__PURE__ */ new Map();
694
694
  for (const n of r) {
695
- const s = this.columns.get(n);
696
- s !== void 0 && a.set(n, s);
695
+ const o = this.columns.get(n);
696
+ o !== void 0 && a.set(n, o);
697
697
  }
698
- return new L(r, a, this.rowCount, this.source);
698
+ return new F(r, a, this.rowCount, this.source);
699
699
  }
700
700
  rename(t, r) {
701
701
  const a = this.gathered(), n = /* @__PURE__ */ new Map();
702
- for (const s of a.names) {
703
- const o = a.columns.get(s);
704
- o !== void 0 && n.set(s === t ? r : s, o);
702
+ for (const o of a.names) {
703
+ const s = a.columns.get(o);
704
+ s !== void 0 && n.set(o === t ? r : o, s);
705
705
  }
706
- return new L(a.names.map((s) => s === t ? r : s), n, a.rowCount);
706
+ return new F(a.names.map((o) => o === t ? r : o), n, a.rowCount);
707
707
  }
708
708
  take(t) {
709
709
  const r = this.source === null ? {
@@ -713,63 +713,63 @@ var $t = (e) => e == null || typeof e == "number" && Number.isNaN(e), Gt = (e) =
713
713
  table: this.source.table,
714
714
  indices: t.map((a) => this.source?.indices[a] ?? 0)
715
715
  };
716
- return new L(this.names, /* @__PURE__ */ new Map(), t.length, r);
716
+ return new F(this.names, /* @__PURE__ */ new Map(), t.length, r);
717
717
  }
718
718
  sortedIndices(t, r) {
719
719
  const a = this.values(t);
720
720
  if (a === void 0) return Array.from({ length: this.rowCount }, (i, d) => d);
721
- const n = [], s = [];
722
- for (let i = 0; i < this.rowCount; i++) ($t(a[i]) ? n : s).push(i);
723
- const o = r === "asc" ? 1 : -1;
724
- return s.sort((i, d) => {
725
- const f = a[i], y = a[d];
726
- return f < y ? -o : f > y ? o : 0;
727
- }), n.length === 0 ? s : r === "asc" ? [...n, ...s] : [...s, ...n];
721
+ const n = [], o = [];
722
+ for (let i = 0; i < this.rowCount; i++) ($t(a[i]) ? n : o).push(i);
723
+ const s = r === "asc" ? 1 : -1;
724
+ return o.sort((i, d) => {
725
+ const f = a[i], m = a[d];
726
+ return f < m ? -s : f > m ? s : 0;
727
+ }), n.length === 0 ? o : r === "asc" ? [...n, ...o] : [...o, ...n];
728
728
  }
729
729
  partition(t) {
730
- const r = t.map((s) => this.values(s)).filter((s) => s !== void 0), a = r.length === 1 ? r[0] : void 0, n = /* @__PURE__ */ new Map();
730
+ const r = t.map((o) => this.values(o)).filter((o) => o !== void 0), a = r.length === 1 ? r[0] : void 0, n = /* @__PURE__ */ new Map();
731
731
  if (a !== void 0) {
732
- for (let s = 0; s < this.rowCount; s++) {
733
- const o = Gt(a[s]), i = n.get(o);
734
- i === void 0 ? n.set(o, {
735
- key: Z(a[s] ?? null),
736
- indices: [s]
737
- }) : i.indices.push(s);
732
+ for (let o = 0; o < this.rowCount; o++) {
733
+ const s = Gt(a[o]), i = n.get(s);
734
+ i === void 0 ? n.set(s, {
735
+ key: Z(a[o] ?? null),
736
+ indices: [o]
737
+ }) : i.indices.push(o);
738
738
  }
739
739
  return [...n.values()];
740
740
  }
741
- for (let s = 0; s < this.rowCount; s++) {
742
- const o = Z(r.map((d) => d[s])), i = n.get(o);
743
- i === void 0 ? n.set(o, {
744
- key: o,
745
- indices: [s]
746
- }) : i.indices.push(s);
741
+ for (let o = 0; o < this.rowCount; o++) {
742
+ const s = Z(r.map((d) => d[o])), i = n.get(s);
743
+ i === void 0 ? n.set(s, {
744
+ key: s,
745
+ indices: [o]
746
+ }) : i.indices.push(o);
747
747
  }
748
748
  return [...n.values()];
749
749
  }
750
750
  fold(t, r, a) {
751
- const n = this.names.filter((g) => !t.includes(g)), s = this.rowCount * t.length, o = n.map((g) => ({
751
+ const n = this.names.filter((g) => !t.includes(g)), o = this.rowCount * t.length, s = n.map((g) => ({
752
752
  name: g,
753
753
  source: this.values(g) ?? [],
754
- repeated: new Array(s)
755
- })), i = t.map((g) => this.values(g) ?? []), d = new Array(s), f = new Array(s);
756
- let y = 0;
757
- for (let g = 0; g < this.rowCount; g++) for (let T = 0; T < t.length; T++, y++) {
758
- for (const N of o) N.repeated[y] = N.source[g] ?? null;
759
- d[y] = t[T] ?? "", f[y] = i[T]?.[g] ?? null;
754
+ repeated: new Array(o)
755
+ })), i = t.map((g) => this.values(g) ?? []), d = new Array(o), f = new Array(o);
756
+ let m = 0;
757
+ for (let g = 0; g < this.rowCount; g++) for (let T = 0; T < t.length; T++, m++) {
758
+ for (const N of s) N.repeated[m] = N.source[g] ?? null;
759
+ d[m] = t[T] ?? "", f[m] = i[T]?.[g] ?? null;
760
760
  }
761
761
  const p = /* @__PURE__ */ new Map();
762
- for (const { name: g, repeated: T } of o) p.set(g, T);
763
- return p.set(r, d), p.set(a, f), new L([
762
+ for (const { name: g, repeated: T } of s) p.set(g, T);
763
+ return p.set(r, d), p.set(a, f), new F([
764
764
  ...n,
765
765
  r,
766
766
  a
767
- ], p, s);
767
+ ], p, o);
768
768
  }
769
769
  objectAt(t) {
770
- const { names: r, arrays: a, template: n } = this.rowShape ?? this.resolveRowShape(), s = { ...n };
771
- for (let o = 0; o < r.length; o++) s[r[o] ?? ""] = a[o]?.[t] ?? null;
772
- return s;
770
+ const { names: r, arrays: a, template: n } = this.rowShape ?? this.resolveRowShape(), o = { ...n };
771
+ for (let s = 0; s < r.length; s++) o[r[s] ?? ""] = a[s]?.[t] ?? null;
772
+ return o;
773
773
  }
774
774
  *[Symbol.iterator]() {
775
775
  for (let t = 0; t < this.rowCount; t++) yield this.objectAt(t);
@@ -786,7 +786,7 @@ var $t = (e) => e == null || typeof e == "number" && Number.isNaN(e), Gt = (e) =
786
786
  gathered() {
787
787
  if (this.source === null) return this;
788
788
  for (const t of this.names) this.values(t);
789
- return new L(this.names, new Map(this.columns), this.rowCount);
789
+ return new F(this.names, new Map(this.columns), this.rowCount);
790
790
  }
791
791
  };
792
792
  var Ht = "value", B = {
@@ -825,42 +825,42 @@ var Ht = "value", B = {
825
825
  }
826
826
  addVariable(t, r, a, n) {
827
827
  if (this.table.columnCount > 0 && a.length !== this.size()) throw new E({ message: `Variable '${t}' has ${a.length} values, expected ${this.size()}` });
828
- const s = {
828
+ const o = {
829
829
  ...this.variableMetadata,
830
830
  [t]: {
831
831
  type: r,
832
832
  valueFormat: this.resolveAddedVariableFormat(t, r, n)
833
833
  }
834
- }, o = this.normalizeRawValues(r, a), i = this.table.assign(t, o);
835
- return A.fromTrusted(i, s);
834
+ }, s = this.normalizeRawValues(r, a), i = this.table.assign(t, s);
835
+ return A.fromTrusted(i, o);
836
836
  }
837
837
  addConstantVariable(t, r, a, n) {
838
- const s = {
838
+ const o = {
839
839
  ...this.variableMetadata,
840
840
  [t]: {
841
841
  type: r,
842
842
  valueFormat: this.resolveAddedVariableFormat(t, r, n),
843
843
  constant: { value: a }
844
844
  }
845
- }, [o = null] = this.normalizeRawValues(r, [a]), i = this.table.assign(t, new Array(this.size()).fill(o));
846
- return A.fromTrusted(i, s);
845
+ }, [s = null] = this.normalizeRawValues(r, [a]), i = this.table.assign(t, new Array(this.size()).fill(s));
846
+ return A.fromTrusted(i, o);
847
847
  }
848
848
  getConstant(t) {
849
849
  return this.variableMetadata[t]?.constant;
850
850
  }
851
851
  deriveVariable(t, r, a, n) {
852
- const s = Array.from({ length: this.size() }, (o, i) => a(this.table.objectAt(i)));
853
- return this.addVariable(t, r, s, n);
852
+ const o = Array.from({ length: this.size() }, (s, i) => a(this.table.objectAt(i)));
853
+ return this.addVariable(t, r, o, n);
854
854
  }
855
- deriveVariableFrom(t, r, a, n, s) {
856
- const o = this.hasVariable(t) ? this.getValues(t).map(n) : Array.from({ length: this.size() }, () => n(null));
857
- return this.addVariable(r, a, o, s);
855
+ deriveVariableFrom(t, r, a, n, o) {
856
+ const s = this.hasVariable(t) ? this.getValues(t).map(n) : Array.from({ length: this.size() }, () => n(null));
857
+ return this.addVariable(r, a, s, o);
858
858
  }
859
859
  renameVariable(t, r) {
860
860
  const a = this.variableMetadata[t];
861
861
  if (!a) throw new E({ message: `Variable ${t} not defined` });
862
- const n = this.table.rename(t, r), { [t]: s, ...o } = this.variableMetadata, i = {
863
- ...o,
862
+ const n = this.table.rename(t, r), { [t]: o, ...s } = this.variableMetadata, i = {
863
+ ...s,
864
864
  [r]: a
865
865
  };
866
866
  return A.fromTrusted(n, i);
@@ -900,9 +900,9 @@ var Ht = "value", B = {
900
900
  }
901
901
  filter(t, r, a) {
902
902
  if (this.hasVariable(t) && this.getType(t) === "temporal") return this.filterByTimestamp(t, r, a);
903
- const n = le[r], s = this.table.values(t) ?? [], o = [];
904
- for (let i = 0; i < s.length; i++) n(s[i] ?? null, a) && o.push(i);
905
- return A.fromTrusted(this.table.take(o), this.variableMetadata);
903
+ const n = le[r], o = this.table.values(t) ?? [], s = [];
904
+ for (let i = 0; i < o.length; i++) n(o[i] ?? null, a) && s.push(i);
905
+ return A.fromTrusted(this.table.take(s), this.variableMetadata);
906
906
  }
907
907
  filterByMask(t) {
908
908
  if (t.length !== this.size()) throw new E({ message: `Row mask length ${t.length} does not match dataset size ${this.size()}` });
@@ -942,18 +942,18 @@ var Ht = "value", B = {
942
942
  return new Kt(t, this.table, this.variableMetadata);
943
943
  }
944
944
  rollup(t) {
945
- const r = ee.from(Object.fromEntries(Object.entries(t).map(([n, { variableName: s, aggregation: o }]) => [n, [Ge(o, Ke(this.table, s, o))]]))), a = {};
946
- for (const [n, { variableName: s, aggregation: o }] of Object.entries(t)) {
947
- const i = this.variableMetadata[s], d = i?.type ?? "numeric", f = i?.valueFormat ?? B[d];
945
+ const r = ee.from(Object.fromEntries(Object.entries(t).map(([n, { variableName: o, aggregation: s }]) => [n, [Ge(s, Ke(this.table, o, s))]]))), a = {};
946
+ for (const [n, { variableName: o, aggregation: s }] of Object.entries(t)) {
947
+ const i = this.variableMetadata[o], d = i?.type ?? "numeric", f = i?.valueFormat ?? B[d];
948
948
  a[n] = {
949
- type: $e(o, d),
950
- valueFormat: He(o, f)
949
+ type: $e(s, d),
950
+ valueFormat: He(s, f)
951
951
  };
952
952
  }
953
953
  return A.fromTrusted(r, a);
954
954
  }
955
955
  reshapeFromWideToLong({ keep: t, reshape: r, keyName: a = "key", valueName: n = Ht } = {}) {
956
- const { numeric: s, categorical: o, temporal: i } = this.groupVariableNamesByType(), d = t ?? [...o, ...i], f = r ?? s.filter((g) => !d.includes(g));
956
+ const { numeric: o, categorical: s, temporal: i } = this.groupVariableNamesByType(), d = t ?? [...s, ...i], f = r ?? o.filter((g) => !d.includes(g));
957
957
  if (d.includes(a) || d.includes(n)) throw new Y({
958
958
  code: "INVALID_DATA_SHAPE",
959
959
  message: `The variables to keep includes the variables '${a}' or '${n}' to create the key and value variables`
@@ -982,7 +982,7 @@ var Ht = "value", B = {
982
982
  code: "INVALID_DATA_SHAPE",
983
983
  message: "Only numeric variables can be reshaped"
984
984
  });
985
- const y = this.table.select([...d, ...f]).fold(f, a, n), p = {};
985
+ const m = this.table.select([...d, ...f]).fold(f, a, n), p = {};
986
986
  for (const g of d) {
987
987
  const T = this.variableMetadata[g];
988
988
  T && (p[g] = T);
@@ -993,7 +993,7 @@ var Ht = "value", B = {
993
993
  }, p[n] = {
994
994
  type: "numeric",
995
995
  valueFormat: Xt(this.variableMetadata, f, a)
996
- }, A.fromTrusted(y, p);
996
+ }, A.fromTrusted(m, p);
997
997
  }
998
998
  print() {
999
999
  console.table(this.variableMetadata), console.table([...this.table]);
@@ -1002,8 +1002,8 @@ var Ht = "value", B = {
1002
1002
  return this.table[Symbol.iterator]();
1003
1003
  }
1004
1004
  filterByTimestamp(t, r, a) {
1005
- const n = le[r], s = Bt(a, this.getValueFormat(t), re), o = ce(s ?? a), i = this.getValues(t, { type: "temporal" }), d = [];
1006
- for (let f = 0; f < i.length; f++) n(ce(i[f] ?? null), o) && d.push(f);
1005
+ const n = le[r], o = Bt(a, this.getValueFormat(t), re), s = ce(o ?? a), i = this.getValues(t, { type: "temporal" }), d = [];
1006
+ for (let f = 0; f < i.length; f++) n(ce(i[f] ?? null), s) && d.push(f);
1007
1007
  return A.fromTrusted(this.table.take(d), this.variableMetadata);
1008
1008
  }
1009
1009
  resolveAddedVariableFormat(t, r, a) {
@@ -1013,10 +1013,10 @@ var Ht = "value", B = {
1013
1013
  }
1014
1014
  parseVariableMap(t) {
1015
1015
  const r = {}, a = {};
1016
- for (const [n, { type: s, values: o, valueFormat: i }] of Object.entries(t))
1017
- r[n] = o, a[n] = {
1018
- type: s,
1019
- valueFormat: i ?? B[s]
1016
+ for (const [n, { type: o, values: s, valueFormat: i }] of Object.entries(t))
1017
+ r[n] = s, a[n] = {
1018
+ type: o,
1019
+ valueFormat: i ?? B[o]
1020
1020
  };
1021
1021
  return {
1022
1022
  table: ee.from(r),
@@ -1039,12 +1039,12 @@ var Ht = "value", B = {
1039
1039
  return t.filter((r) => r !== null);
1040
1040
  }
1041
1041
  getDistinctValues(t, r) {
1042
- const a = t === "temporal", n = /* @__PURE__ */ new Set(), s = [];
1043
- for (const o of r) {
1044
- const i = a && o instanceof Date ? o.getTime() : o;
1045
- n.has(i) || (n.add(i), s.push(o));
1042
+ const a = t === "temporal", n = /* @__PURE__ */ new Set(), o = [];
1043
+ for (const s of r) {
1044
+ const i = a && s instanceof Date ? s.getTime() : s;
1045
+ n.has(i) || (n.add(i), o.push(s));
1046
1046
  }
1047
- return s;
1047
+ return o;
1048
1048
  }
1049
1049
  }, Kt = class {
1050
1050
  constructor(e, t, r) {
@@ -1058,45 +1058,45 @@ var Ht = "value", B = {
1058
1058
  rollup(e) {
1059
1059
  const t = this.table.partition(this.groupedBy), r = {};
1060
1060
  for (const n of this.groupedBy) {
1061
- const s = this.table.values(n) ?? [];
1062
- r[n] = t.map(({ indices: o }) => s[o[0] ?? 0] ?? null);
1061
+ const o = this.table.values(n) ?? [];
1062
+ r[n] = t.map(({ indices: s }) => o[s[0] ?? 0] ?? null);
1063
1063
  }
1064
1064
  const a = Object.fromEntries(this.groupedBy.map((n) => {
1065
- const s = this.variableMetadata[n], o = s?.type ?? "categorical";
1065
+ const o = this.variableMetadata[n], s = o?.type ?? "categorical";
1066
1066
  return [n, {
1067
- type: o,
1068
- valueFormat: s?.valueFormat ?? B[o]
1067
+ type: s,
1068
+ valueFormat: o?.valueFormat ?? B[s]
1069
1069
  }];
1070
1070
  }));
1071
- for (const [n, { variableName: s, aggregation: o }] of Object.entries(e)) {
1072
- const i = Ke(this.table, s, o);
1073
- r[n] = t.map(({ indices: p }) => Ge(o, i, p));
1074
- const d = this.variableMetadata[s], f = d?.type ?? "numeric", y = d?.valueFormat ?? B[f];
1071
+ for (const [n, { variableName: o, aggregation: s }] of Object.entries(e)) {
1072
+ const i = Ke(this.table, o, s);
1073
+ r[n] = t.map(({ indices: p }) => Ge(s, i, p));
1074
+ const d = this.variableMetadata[o], f = d?.type ?? "numeric", m = d?.valueFormat ?? B[f];
1075
1075
  a[n] = {
1076
- type: $e(o, f),
1077
- valueFormat: He(o, y)
1076
+ type: $e(s, f),
1077
+ valueFormat: He(s, m)
1078
1078
  };
1079
1079
  }
1080
1080
  return te.fromTrusted(ee.from(r), a);
1081
1081
  }
1082
1082
  };
1083
1083
  function Xt(e, t, r) {
1084
- const a = t.map((i) => e[i]?.valueFormat ?? { type: "decimal" }), [n, ...s] = a;
1084
+ const a = t.map((i) => e[i]?.valueFormat ?? { type: "decimal" }), [n, ...o] = a;
1085
1085
  if (!n) return { type: "decimal" };
1086
1086
  for (const i of a) if (i.type === "lookup") throw new Y({
1087
1087
  code: "INVALID_DATA_SHAPE",
1088
1088
  message: "Cannot reshape: a source column has a lookup format and lookups cannot nest"
1089
1089
  });
1090
- if (s.every((i) => Ze(i, n)) || n.type === "lookup") return n;
1091
- const o = {};
1090
+ if (o.every((i) => Ze(i, n)) || n.type === "lookup") return n;
1091
+ const s = {};
1092
1092
  for (const [i, d] of t.entries()) {
1093
- const f = Z([d]), y = a[i];
1094
- y && y.type !== "lookup" && (o[f] = y);
1093
+ const f = Z([d]), m = a[i];
1094
+ m && m.type !== "lookup" && (s[f] = m);
1095
1095
  }
1096
1096
  return {
1097
1097
  type: "lookup",
1098
1098
  byVariable: r,
1099
- cases: o,
1099
+ cases: s,
1100
1100
  fallback: n
1101
1101
  };
1102
1102
  }
@@ -1132,10 +1132,10 @@ var qt = class {
1132
1132
  }, Qt = (e, t) => {
1133
1133
  const r = typeof e == "string" ? e.trim() : e;
1134
1134
  if (O(r)) return { type: "decimal" };
1135
- const a = typeof r == "string" && Ce(r, t);
1135
+ const a = typeof r == "string" && Re(r, t);
1136
1136
  if (a) return a;
1137
- const n = typeof r == "string" && kt(r, t);
1138
- return n || (Ne(e) ? { type: "date" } : Fe(e) ? { type: "percentage" } : Be(e) && typeof e == "string" ? {
1137
+ const n = typeof r == "string" && Dt(r, t);
1138
+ return n || (Ne(e) ? { type: "date" } : ke(e) ? { type: "percentage" } : Be(e) && typeof e == "string" ? {
1139
1139
  type: "currency",
1140
1140
  iso: Ot(e)
1141
1141
  } : { type: "text" });
@@ -1143,16 +1143,16 @@ var qt = class {
1143
1143
  type: "year",
1144
1144
  dateFormat: "yyyy"
1145
1145
  }, Zt = { type: "text" }, er = (e) => {
1146
- const t = e._metadata?.parsingLocale ?? "en-GB", r = {}, a = ar(e), n = tr(e), s = a.size > 0;
1147
- for (const [o, i] of e.columns.entries()) {
1146
+ const t = e._metadata?.parsingLocale ?? "en-GB", r = {}, a = ar(e), n = tr(e), o = a.size > 0;
1147
+ for (const [s, i] of e.columns.entries()) {
1148
1148
  if (i._metadata?.isHidden) continue;
1149
1149
  const d = a.get(i.key);
1150
- if (I(d) && s) continue;
1151
- const f = I(d) ? Zt : o === n ? Jt : Qt(d, t), y = De(f);
1152
- r[i.key] = rr(i.key, e.rows, f, y, t);
1150
+ if (I(d) && o) continue;
1151
+ const f = I(d) ? Zt : s === n ? Jt : Qt(d, t), m = Le(f);
1152
+ r[i.key] = rr(i.key, e.rows, f, m, t);
1153
1153
  }
1154
1154
  return new te(r);
1155
- }, ba = class extends Pt {
1155
+ }, pa = class extends Pt {
1156
1156
  dependencies(e) {
1157
1157
  return [e];
1158
1158
  }
@@ -1163,18 +1163,18 @@ var qt = class {
1163
1163
  const t = nr(e.rows, 5);
1164
1164
  return e.columns.findIndex((r) => {
1165
1165
  const a = t.map((n) => n[r.key]).filter((n) => !I(n));
1166
- return a.length >= 2 && a.every(Dt);
1166
+ return a.length >= 2 && a.every(Lt);
1167
1167
  });
1168
1168
  }, rr = (e, t, r, a, n) => ({
1169
1169
  type: a,
1170
- values: t.reduce((s, o) => (je(o) || s.push(ze(o[e], r, n)), s), []),
1170
+ values: t.reduce((o, s) => (je(s) || o.push(We(s[e], r, n)), o), []),
1171
1171
  valueFormat: r
1172
1172
  }), ar = (e) => {
1173
1173
  const t = /* @__PURE__ */ new Map(), r = new Set(e.columns.map((a) => a.key));
1174
1174
  for (const a of e.rows) {
1175
1175
  for (const n of r) {
1176
- const s = a[n];
1177
- I(s) || (t.set(n, s), r.delete(n));
1176
+ const o = a[n];
1177
+ I(o) || (t.set(n, o), r.delete(n));
1178
1178
  }
1179
1179
  if (r.size === 0) break;
1180
1180
  }
@@ -1184,21 +1184,21 @@ var qt = class {
1184
1184
  for (const a of e)
1185
1185
  if (je(a) || r.push(a), r.length === t) return r;
1186
1186
  return r;
1187
- }, va = [
1187
+ }, ba = [
1188
1188
  "observation",
1189
1189
  "category",
1190
1190
  "aggregate"
1191
- ], Aa = ["inside", "outside"], Ea = [
1191
+ ], va = ["inside", "outside"], Aa = [
1192
1192
  "top",
1193
1193
  "right",
1194
1194
  "bottom",
1195
1195
  "left"
1196
- ], Ma = [
1196
+ ], Ea = [
1197
1197
  "heading",
1198
1198
  "label",
1199
1199
  "value",
1200
1200
  "primaryRow"
1201
- ], Ta = ["link"], wa = ["h1", "h2"], _a = [
1201
+ ], Ma = ["link"], Ta = ["h1", "h2"], wa = [
1202
1202
  "number",
1203
1203
  "numberCenter",
1204
1204
  "caption",
@@ -1208,7 +1208,7 @@ var qt = class {
1208
1208
  "trendUp",
1209
1209
  "trendDown",
1210
1210
  "trendFlat"
1211
- ], Da = ["swatch"], Fa = ["popover"], ka = [
1211
+ ], _a = ["swatch"], La = ["popover"], ka = [
1212
1212
  "shape",
1213
1213
  "arrow",
1214
1214
  "differenceArrow",
@@ -1216,12 +1216,12 @@ var qt = class {
1216
1216
  "image",
1217
1217
  "pinnedNumber",
1218
1218
  "comment"
1219
- ], La = {
1219
+ ], Da = {
1220
1220
  differenceArrow: ["label"],
1221
1221
  pinnedNumber: ["label"],
1222
1222
  comment: ["label"]
1223
- }, Sa = ["dimmed", "hovered"], Oa = (e) => typeof e == "object" && e !== null && typeof e.light == "string" && typeof e.dark == "string", Na = (e) => typeof e == "object" && e !== null && typeof e.token == "string";
1224
- function Ca(e) {
1223
+ }, Fa = ["dimmed", "hovered"], Sa = (e) => typeof e == "object" && e !== null && typeof e.light == "string" && typeof e.dark == "string", Oa = (e) => typeof e == "object" && e !== null && typeof e.token == "string";
1224
+ function Na(e) {
1225
1225
  return {
1226
1226
  type: "styles",
1227
1227
  ...e
@@ -1239,12 +1239,12 @@ var S = (e) => {
1239
1239
  ...e?.id === void 0 ? {} : { id: e.id },
1240
1240
  ...Object.keys(t).length === 0 ? {} : { when: t }
1241
1241
  };
1242
- }, F = (e) => e?.layer === void 0 ? {} : { layer: e.layer }, l = (e) => e?.id === void 0 ? {} : { id: e.id }, w = (e) => e?.annotation === void 0 ? {} : { annotation: e.annotation }, c = {
1242
+ }, k = (e) => e?.layer === void 0 ? {} : { layer: e.layer }, l = (e) => e?.id === void 0 ? {} : { id: e.id }, w = (e) => e?.annotation === void 0 ? {} : { annotation: e.annotation }, c = {
1243
1243
  geom: Object.assign((e, t) => ({
1244
1244
  ...S(t),
1245
1245
  select: {
1246
1246
  target: "geom",
1247
- ...F(t)
1247
+ ...k(t)
1248
1248
  },
1249
1249
  declarations: e
1250
1250
  }), {
@@ -1253,7 +1253,7 @@ var S = (e) => {
1253
1253
  select: {
1254
1254
  target: "geom",
1255
1255
  kind: "bar",
1256
- ...F(t)
1256
+ ...k(t)
1257
1257
  },
1258
1258
  declarations: e
1259
1259
  }),
@@ -1262,7 +1262,7 @@ var S = (e) => {
1262
1262
  select: {
1263
1263
  target: "geom",
1264
1264
  kind: "line",
1265
- ...F(t)
1265
+ ...k(t)
1266
1266
  },
1267
1267
  declarations: e
1268
1268
  }),
@@ -1271,7 +1271,7 @@ var S = (e) => {
1271
1271
  select: {
1272
1272
  target: "geom",
1273
1273
  kind: "area",
1274
- ...F(t)
1274
+ ...k(t)
1275
1275
  },
1276
1276
  declarations: e
1277
1277
  }),
@@ -1280,7 +1280,7 @@ var S = (e) => {
1280
1280
  select: {
1281
1281
  target: "geom",
1282
1282
  kind: "point",
1283
- ...F(t)
1283
+ ...k(t)
1284
1284
  },
1285
1285
  declarations: e
1286
1286
  }),
@@ -1289,14 +1289,14 @@ var S = (e) => {
1289
1289
  select: {
1290
1290
  target: "geom",
1291
1291
  kind: "rule",
1292
- ...F(t)
1292
+ ...k(t)
1293
1293
  },
1294
1294
  declarations: e
1295
1295
  }), { label: (e, t) => ({
1296
1296
  ...l(t),
1297
1297
  select: {
1298
1298
  target: "ruleLabel",
1299
- ...F(t)
1299
+ ...k(t)
1300
1300
  },
1301
1301
  declarations: e
1302
1302
  }) }),
@@ -1305,7 +1305,7 @@ var S = (e) => {
1305
1305
  select: {
1306
1306
  target: "geom",
1307
1307
  kind: "tile",
1308
- ...F(t)
1308
+ ...k(t)
1309
1309
  },
1310
1310
  declarations: e
1311
1311
  })
@@ -1412,6 +1412,38 @@ var S = (e) => {
1412
1412
  axis: "y"
1413
1413
  },
1414
1414
  declarations: e
1415
+ }),
1416
+ top: (e, t) => ({
1417
+ ...l(t),
1418
+ select: {
1419
+ target: "axisLabel",
1420
+ edge: "top"
1421
+ },
1422
+ declarations: e
1423
+ }),
1424
+ right: (e, t) => ({
1425
+ ...l(t),
1426
+ select: {
1427
+ target: "axisLabel",
1428
+ edge: "right"
1429
+ },
1430
+ declarations: e
1431
+ }),
1432
+ bottom: (e, t) => ({
1433
+ ...l(t),
1434
+ select: {
1435
+ target: "axisLabel",
1436
+ edge: "bottom"
1437
+ },
1438
+ declarations: e
1439
+ }),
1440
+ left: (e, t) => ({
1441
+ ...l(t),
1442
+ select: {
1443
+ target: "axisLabel",
1444
+ edge: "left"
1445
+ },
1446
+ declarations: e
1415
1447
  })
1416
1448
  }),
1417
1449
  tickLabel: Object.assign((e, t) => ({
@@ -1434,6 +1466,38 @@ var S = (e) => {
1434
1466
  axis: "y"
1435
1467
  },
1436
1468
  declarations: e
1469
+ }),
1470
+ top: (e, t) => ({
1471
+ ...l(t),
1472
+ select: {
1473
+ target: "tickLabel",
1474
+ edge: "top"
1475
+ },
1476
+ declarations: e
1477
+ }),
1478
+ right: (e, t) => ({
1479
+ ...l(t),
1480
+ select: {
1481
+ target: "tickLabel",
1482
+ edge: "right"
1483
+ },
1484
+ declarations: e
1485
+ }),
1486
+ bottom: (e, t) => ({
1487
+ ...l(t),
1488
+ select: {
1489
+ target: "tickLabel",
1490
+ edge: "bottom"
1491
+ },
1492
+ declarations: e
1493
+ }),
1494
+ left: (e, t) => ({
1495
+ ...l(t),
1496
+ select: {
1497
+ target: "tickLabel",
1498
+ edge: "left"
1499
+ },
1500
+ declarations: e
1437
1501
  })
1438
1502
  }),
1439
1503
  dataLabel: Object.assign((e, t) => ({
@@ -1548,6 +1612,16 @@ var S = (e) => {
1548
1612
  },
1549
1613
  declarations: e
1550
1614
  }) }),
1615
+ header: (e, t) => ({
1616
+ ...l(t),
1617
+ select: { target: "header" },
1618
+ declarations: e
1619
+ }),
1620
+ footer: (e, t) => ({
1621
+ ...l(t),
1622
+ select: { target: "footer" },
1623
+ declarations: e
1624
+ }),
1551
1625
  hoverGuide: (e, t) => ({
1552
1626
  ...l(t),
1553
1627
  select: { target: "hoverGuide" },
@@ -1674,14 +1748,48 @@ var S = (e) => {
1674
1748
  ...l(t),
1675
1749
  select: { target: "legend" },
1676
1750
  declarations: e
1677
- }), { popover: (e, t) => ({
1678
- ...l(t),
1679
- select: {
1680
- target: "legend",
1681
- part: "popover"
1682
- },
1683
- declarations: e
1684
- }) }),
1751
+ }), {
1752
+ popover: (e, t) => ({
1753
+ ...l(t),
1754
+ select: {
1755
+ target: "legend",
1756
+ part: "popover"
1757
+ },
1758
+ declarations: e
1759
+ }),
1760
+ top: (e, t) => ({
1761
+ ...l(t),
1762
+ select: {
1763
+ target: "legend",
1764
+ edge: "top"
1765
+ },
1766
+ declarations: e
1767
+ }),
1768
+ right: (e, t) => ({
1769
+ ...l(t),
1770
+ select: {
1771
+ target: "legend",
1772
+ edge: "right"
1773
+ },
1774
+ declarations: e
1775
+ }),
1776
+ bottom: (e, t) => ({
1777
+ ...l(t),
1778
+ select: {
1779
+ target: "legend",
1780
+ edge: "bottom"
1781
+ },
1782
+ declarations: e
1783
+ }),
1784
+ left: (e, t) => ({
1785
+ ...l(t),
1786
+ select: {
1787
+ target: "legend",
1788
+ edge: "left"
1789
+ },
1790
+ declarations: e
1791
+ })
1792
+ }),
1685
1793
  legendItem: Object.assign((e, t) => ({
1686
1794
  ...l(t),
1687
1795
  select: { target: "legendItem" },
@@ -1798,10 +1906,10 @@ var S = (e) => {
1798
1906
  declarations: e
1799
1907
  }) })
1800
1908
  })
1801
- }, sr = "#B84737", or = 0.4, Ra = "sm", Ia = 2, xa = 8, Ba = 12, de = Object.freeze({
1909
+ }, or = "#B84737", sr = 0.4, Ra = "sm", Ca = 2, Ia = 8, xa = 12, de = Object.freeze({
1802
1910
  light: "#F5F1E9",
1803
1911
  dark: "#1F1E1C"
1804
- }), ir = "#ffffff", Va = 1, Pa = 24, ja = {
1912
+ }), ir = "#ffffff", Ba = 1, Va = 24, Pa = {
1805
1913
  top: 24,
1806
1914
  right: 24,
1807
1915
  bottom: 24,
@@ -1861,7 +1969,7 @@ var S = (e) => {
1861
1969
  light: "rgba(58, 56, 51, 0.15)",
1862
1970
  dark: "rgba(237, 231, 218, 0.15)"
1863
1971
  }),
1864
- geom: sr,
1972
+ geom: or,
1865
1973
  geomBorder: Object.freeze({
1866
1974
  light: "rgba(58, 56, 51, 0.55)",
1867
1975
  dark: "rgba(237, 231, 218, 0.55)"
@@ -1922,7 +2030,7 @@ var S = (e) => {
1922
2030
  color: u("gridLine"),
1923
2031
  strokeWidth: 1,
1924
2032
  lineType: "dashed"
1925
- }, ye = {
2033
+ }, me = {
1926
2034
  color: u("textPrimary"),
1927
2035
  size: 8,
1928
2036
  borderColor: u("tooltipBackground"),
@@ -1933,7 +2041,7 @@ var S = (e) => {
1933
2041
  blur: 1.5,
1934
2042
  color: "rgba(14, 14, 52, 0.18)"
1935
2043
  }
1936
- }, me = {
2044
+ }, ye = {
1937
2045
  fontSize: 12,
1938
2046
  fontWeight: 500,
1939
2047
  lineHeight: 1.3,
@@ -1984,7 +2092,7 @@ var S = (e) => {
1984
2092
  borderRadius: 8,
1985
2093
  borderWidth: 0
1986
2094
  }),
1987
- c.geom({ alpha: or }, { state: "dimmed" }),
2095
+ c.geom({ alpha: sr }, { state: "dimmed" }),
1988
2096
  c.geom.point({ borderColor: u("hoverAffordance") }, { state: "hovered" }),
1989
2097
  c.geom.bar({ borderColor: u("hoverAffordance") }, { state: "hovered" }),
1990
2098
  c.geom.tile({
@@ -2027,15 +2135,23 @@ var S = (e) => {
2027
2135
  ...h.sourceLink,
2028
2136
  textColor: u("textSecondary")
2029
2137
  }),
2138
+ c.header({ margin: { bottom: 10 } }),
2030
2139
  c.axisLabel({
2031
2140
  ...h.label,
2032
2141
  textColor: u("textPrimary")
2033
2142
  }),
2143
+ c.axisLabel.top({ margin: { bottom: 8 } }),
2144
+ c.axisLabel.bottom({ margin: {
2145
+ top: 4,
2146
+ bottom: 16
2147
+ } }),
2034
2148
  c.tickLabel({
2035
2149
  ...h.label,
2036
2150
  textColor: u("textSecondary"),
2037
2151
  offset: cr
2038
2152
  }),
2153
+ c.tickLabel.left({ offset: 14 }),
2154
+ c.tickLabel.right({ offset: 14 }),
2039
2155
  c.geom.rule.label({ ...h.label }),
2040
2156
  c.dataLabel({
2041
2157
  ...h.label,
@@ -2076,7 +2192,10 @@ var S = (e) => {
2076
2192
  textColor: u("textSecondary")
2077
2193
  }),
2078
2194
  c.tooltip.primaryRow({ background: u("tooltipPrimaryRow") }),
2079
- c.headline({ gap: dr }),
2195
+ c.headline({
2196
+ gap: dr,
2197
+ margin: { bottom: 4 }
2198
+ }),
2080
2199
  c.headlineItem.number({
2081
2200
  fontSize: 26,
2082
2201
  fontWeight: 700,
@@ -2111,6 +2230,14 @@ var S = (e) => {
2111
2230
  color: "rgba(0, 0, 0, 0.18)"
2112
2231
  }
2113
2232
  }),
2233
+ c.legend.top({ margin: { bottom: 8 } }),
2234
+ c.legend.bottom({ margin: {
2235
+ top: 16,
2236
+ bottom: 10
2237
+ } }),
2238
+ c.legend.left({ margin: { right: 10 } }),
2239
+ c.legend.right({ margin: { left: 10 } }),
2240
+ c.footer({ margin: { top: 16 } }),
2114
2241
  c.legendItem({
2115
2242
  ...h.label,
2116
2243
  textColor: u("textSecondary"),
@@ -2171,17 +2298,17 @@ var S = (e) => {
2171
2298
  alpha: 1,
2172
2299
  borderRadius: 0
2173
2300
  }),
2174
- c.annotation.pinnedNumber(ye),
2175
- c.annotation.pinnedNumber.label(me),
2176
- c.annotation.comment(ye),
2177
- c.annotation.comment.label(me)
2301
+ c.annotation.pinnedNumber(me),
2302
+ c.annotation.pinnedNumber.label(ye),
2303
+ c.annotation.comment(me),
2304
+ c.annotation.comment.label(ye)
2178
2305
  ];
2179
2306
  for (const e of Xe) {
2180
2307
  Object.freeze(e.select);
2181
2308
  for (const t of Object.values(e.declarations)) typeof t == "object" && Object.freeze(t);
2182
2309
  Object.freeze(e.declarations), e.when !== void 0 && Object.freeze(e.when), Object.freeze(e);
2183
2310
  }
2184
- var za = Object.freeze({
2311
+ var ja = Object.freeze({
2185
2312
  tokens: Object.freeze(fr),
2186
2313
  defaults: Object.freeze(Xe),
2187
2314
  overrides: Object.freeze([])
@@ -2197,7 +2324,7 @@ var za = Object.freeze({
2197
2324
  };
2198
2325
  return e.groupBy(...r.groupby).rollup(a);
2199
2326
  }
2200
- }, yr = class {
2327
+ }, mr = class {
2201
2328
  constructor() {
2202
2329
  this.transformType = "constant";
2203
2330
  }
@@ -2209,7 +2336,7 @@ var za = Object.freeze({
2209
2336
  const { options: t } = e;
2210
2337
  return [t.variableName];
2211
2338
  }
2212
- }, mr = class {
2339
+ }, yr = class {
2213
2340
  constructor() {
2214
2341
  this.transformType = "filter";
2215
2342
  }
@@ -2244,8 +2371,8 @@ var za = Object.freeze({
2244
2371
  }
2245
2372
  }, br = [
2246
2373
  new gr(),
2247
- new yr(),
2248
2374
  new mr(),
2375
+ new yr(),
2249
2376
  new hr(),
2250
2377
  new pr()
2251
2378
  ], Wa = class extends qt {
@@ -2253,7 +2380,7 @@ var za = Object.freeze({
2253
2380
  super("transform");
2254
2381
  for (const e of br) this.register(e.transformType, e);
2255
2382
  }
2256
- }, Ua = [
2383
+ }, za = [
2257
2384
  "brick",
2258
2385
  "grey",
2259
2386
  "red",
@@ -2264,7 +2391,7 @@ var za = Object.freeze({
2264
2391
  "blue",
2265
2392
  "purple",
2266
2393
  "pink"
2267
- ], Ya = [
2394
+ ], Ua = [
2268
2395
  "cyan",
2269
2396
  "pink",
2270
2397
  "purple",
@@ -2282,7 +2409,7 @@ var za = Object.freeze({
2282
2409
  "#E2BF6B",
2283
2410
  "#95CBA6",
2284
2411
  "#AABCE5"
2285
- ], Ar = "brick", D = {
2412
+ ], Ar = "brick", L = {
2286
2413
  red: "#E83562",
2287
2414
  orange: "#F38650",
2288
2415
  yellow: "#FBBC30",
@@ -2294,16 +2421,16 @@ var za = Object.freeze({
2294
2421
  plum: "#C82184",
2295
2422
  pink: "#FC8497"
2296
2423
  }, Er = [
2297
- D.purple,
2298
- D.pink,
2299
- D.yellow,
2300
- D.blue,
2301
- D.red,
2302
- D.cyan,
2303
- D.orange,
2304
- D.plum,
2305
- D.green,
2306
- D.dark_purple
2424
+ L.purple,
2425
+ L.pink,
2426
+ L.yellow,
2427
+ L.blue,
2428
+ L.red,
2429
+ L.cyan,
2430
+ L.orange,
2431
+ L.plum,
2432
+ L.green,
2433
+ L.dark_purple
2307
2434
  ], _ = {
2308
2435
  green: "#B2DDC9",
2309
2436
  cyan: "#A2D5E2",
@@ -2425,7 +2552,7 @@ var za = Object.freeze({
2425
2552
  pink200: "#FED0F3",
2426
2553
  pink100: "#FFE8F9",
2427
2554
  pink50: "#FFF4FC"
2428
- }, $a = [P.brick100, P.brick900], Tr = [
2555
+ }, Ya = [P.brick100, P.brick900], Tr = [
2429
2556
  P.grey200,
2430
2557
  _.green,
2431
2558
  _.red,
@@ -2538,7 +2665,7 @@ var za = Object.freeze({
2538
2665
  yellow: "#FBFF00",
2539
2666
  green: "#06FF00",
2540
2667
  blue: "#0079FF"
2541
- }, z = [
2668
+ }, W = [
2542
2669
  M.cyan,
2543
2670
  M.pink,
2544
2671
  M.purple,
@@ -2552,17 +2679,17 @@ var za = Object.freeze({
2552
2679
  M.green,
2553
2680
  M.red,
2554
2681
  M.cyan
2555
- ], W = {
2682
+ ], z = {
2556
2683
  start: "#84D1FC",
2557
2684
  positive: "#84FC89",
2558
2685
  negative: "#FC8497",
2559
2686
  total: "#84D1FC"
2560
2687
  }, _r = [
2561
- W.start,
2562
- W.positive,
2563
- W.negative,
2564
- W.total
2565
- ], Ga = {
2688
+ z.start,
2689
+ z.positive,
2690
+ z.negative,
2691
+ z.total
2692
+ ], $a = {
2566
2693
  transform: "linear",
2567
2694
  reverse: !1,
2568
2695
  nice: !0,
@@ -2574,16 +2701,16 @@ var za = Object.freeze({
2574
2701
  interpolate: "lab",
2575
2702
  domainMid: null,
2576
2703
  symmetric: !1
2577
- }, Ha = {
2704
+ }, Ga = {
2578
2705
  size: [4, 20],
2579
2706
  alpha: [0.1, 1],
2580
2707
  strokeWidth: [1, 4]
2581
- }, Ka = {
2708
+ }, Ha = {
2582
2709
  domainMin: null,
2583
2710
  domainMax: null,
2584
2711
  nice: !1,
2585
2712
  reverse: !1
2586
- }, Xa = {
2713
+ }, Ka = {
2587
2714
  range: null,
2588
2715
  domain: null,
2589
2716
  padding: 0.1,
@@ -2592,11 +2719,11 @@ var za = Object.freeze({
2592
2719
  function be(e, t = "light", r) {
2593
2720
  return ((r !== void 0 ? he[t][r] : void 0) ?? he[t].default).map((a) => P[`${e}${a}`]);
2594
2721
  }
2595
- function Dr(e) {
2596
- const t = z.indexOf(M[e]);
2597
- return t <= 0 ? z : [...z.slice(t), ...z.slice(0, t)];
2722
+ function Lr(e) {
2723
+ const t = W.indexOf(M[e]);
2724
+ return t <= 0 ? W : [...W.slice(t), ...W.slice(0, t)];
2598
2725
  }
2599
- function qa(e, t = {}) {
2726
+ function Xa(e, t = {}) {
2600
2727
  switch (e.type) {
2601
2728
  case "default":
2602
2729
  return t.hasTouchingGeoms ? be(Ar, t.colorScheme ?? "light", t.groupCount) : vr;
@@ -2605,51 +2732,51 @@ function qa(e, t = {}) {
2605
2732
  case "pastel":
2606
2733
  return e.variant === "waterfall" ? Tr : Mr;
2607
2734
  case "neon":
2608
- return e.variant === "waterfall" ? wr : Dr(e.base);
2735
+ return e.variant === "waterfall" ? wr : Lr(e.base);
2609
2736
  case "mono":
2610
2737
  return be(e.base, e.variant ?? "light", t.groupCount);
2611
2738
  case "custom":
2612
2739
  return e.colors;
2613
2740
  }
2614
2741
  }
2615
- function Qa(e, t) {
2742
+ function qa(e, t) {
2616
2743
  if (!t) return e;
2617
2744
  const r = [...e];
2618
2745
  for (const [a, n] of Object.entries(t)) {
2619
- const s = Number(a);
2620
- if (!Number.isInteger(s) || s < 1) continue;
2621
- const o = s - 1;
2622
- o < r.length && (r[o] = n);
2746
+ const o = Number(a);
2747
+ if (!Number.isInteger(o) || o < 1) continue;
2748
+ const s = o - 1;
2749
+ s < r.length && (r[s] = n);
2623
2750
  }
2624
2751
  return r;
2625
2752
  }
2626
- function Ja(e, t, r, a) {
2753
+ function Qa(e, t, r, a) {
2627
2754
  if (!t) return;
2628
- const n = r?.type === "custom" ? a[r.id] : void 0, s = {};
2629
- for (const [o, i] of Object.entries(t)) {
2630
- const d = Number(o);
2755
+ const n = r?.type === "custom" ? a[r.id] : void 0, o = {};
2756
+ for (const [s, i] of Object.entries(t)) {
2757
+ const d = Number(s);
2631
2758
  if (!(!Number.isInteger(d) || d < 1)) {
2632
2759
  if (i.hex !== void 0) {
2633
- s[d] = i.hex;
2760
+ o[d] = i.hex;
2634
2761
  continue;
2635
2762
  }
2636
2763
  if (i.id !== void 0) {
2637
- const f = n?.find((y) => y.id === i.id)?.hex;
2638
- f !== void 0 ? s[d] = f : e.diagnostics.addWarning({
2764
+ const f = n?.find((m) => m.id === i.id)?.hex;
2765
+ f !== void 0 ? o[d] = f : e.diagnostics.addWarning({
2639
2766
  code: "PALETTE_NOT_FOUND",
2640
2767
  message: `Palette override at slot ${d} with id '${i.id}' did not resolve against the active palette — falling back to palette color.`,
2641
2768
  context: {
2642
2769
  requested: i.id,
2643
- available: n?.map((y) => y.id) ?? []
2770
+ available: n?.map((m) => m.id) ?? []
2644
2771
  },
2645
2772
  suggestion: "Define the override id in the active custom palette, or use a hex value instead."
2646
2773
  });
2647
2774
  }
2648
2775
  }
2649
2776
  }
2650
- return Object.keys(s).length > 0 ? s : void 0;
2777
+ return Object.keys(o).length > 0 ? o : void 0;
2651
2778
  }
2652
- function Za(e, t, r) {
2779
+ function Ja(e, t, r) {
2653
2780
  if (!t) return pe.palette;
2654
2781
  if (t.type === "custom") {
2655
2782
  const a = r[t.id];
@@ -2663,7 +2790,7 @@ function Za(e, t, r) {
2663
2790
  },
2664
2791
  suggestion: "Register the palette in customPalettes, or reference an existing palette id."
2665
2792
  }), pe.palette;
2666
- const n = a.map((s) => s.hex);
2793
+ const n = a.map((o) => o.hex);
2667
2794
  return {
2668
2795
  type: "custom",
2669
2796
  id: t.id,
@@ -2704,7 +2831,7 @@ function q(e, t = {}) {
2704
2831
  clamp: t.clamp
2705
2832
  };
2706
2833
  }
2707
- function k(e, t = {}) {
2834
+ function D(e, t = {}) {
2708
2835
  return {
2709
2836
  type: "scale",
2710
2837
  scaledAesthetic: e,
@@ -2730,7 +2857,7 @@ function Q(e, t) {
2730
2857
  options: t
2731
2858
  };
2732
2859
  }
2733
- function Fr(e, t = {}) {
2860
+ function kr(e, t = {}) {
2734
2861
  return {
2735
2862
  type: "scale",
2736
2863
  scaledAesthetic: e,
@@ -2739,24 +2866,24 @@ function Fr(e, t = {}) {
2739
2866
  overrides: t.overrides
2740
2867
  };
2741
2868
  }
2742
- var en = { labelCrossPosition: 0.5 }, tn = {
2869
+ var Za = { labelCrossPosition: 0.5 }, en = {
2743
2870
  kind: "rectangle",
2744
2871
  zOrder: "foreground"
2745
- }, rn = {
2872
+ }, tn = {
2746
2873
  zOrder: "foreground",
2747
2874
  fit: "contain"
2748
- }, an = {
2875
+ }, rn = {
2749
2876
  x: 8,
2750
2877
  y: 8,
2751
2878
  unit: "px"
2752
- }, nn = { align: "center" }, sn = {
2879
+ }, an = { align: "center" }, nn = {
2753
2880
  startArrowheadStyle: "none",
2754
2881
  endArrowheadStyle: "line-arrow"
2755
2882
  }, on = {
2756
2883
  thin: 2,
2757
2884
  medium: 4,
2758
2885
  thick: 8
2759
- }, ln = 0.5, cn = {
2886
+ }, sn = 0.5, ln = {
2760
2887
  borderWidth: 2,
2761
2888
  shadow: {
2762
2889
  offsetX: 0,
@@ -2764,7 +2891,7 @@ var en = { labelCrossPosition: 0.5 }, tn = {
2764
2891
  blur: 1.15,
2765
2892
  color: "rgba(0, 0, 0, 0.16)"
2766
2893
  }
2767
- }, dn = {
2894
+ }, cn = {
2768
2895
  small: {
2769
2896
  arrow: { strokeWidth: 2 },
2770
2897
  label: {
@@ -2795,7 +2922,7 @@ var en = { labelCrossPosition: 0.5 }, tn = {
2795
2922
  borderWidth: 2
2796
2923
  }
2797
2924
  }
2798
- }, kr = [
2925
+ }, Dr = [
2799
2926
  "none",
2800
2927
  "xs",
2801
2928
  "sm",
@@ -2803,14 +2930,14 @@ var en = { labelCrossPosition: 0.5 }, tn = {
2803
2930
  "lg",
2804
2931
  "xl",
2805
2932
  "full"
2806
- ], un = {
2807
- point: Lr,
2933
+ ], dn = {
2934
+ point: Fr,
2808
2935
  line: Sr,
2809
2936
  area: Or,
2810
2937
  bar: Nr,
2811
- rule: Cr,
2812
- tile: Rr
2813
- }, fn = (e) => typeof e == "string" && kr.includes(e);
2938
+ rule: Rr,
2939
+ tile: Cr
2940
+ }, un = (e) => typeof e == "string" && Dr.includes(e);
2814
2941
  function x(e, t) {
2815
2942
  return {
2816
2943
  type: "layer",
@@ -2826,7 +2953,7 @@ function x(e, t) {
2826
2953
  dataLabels: t.dataLabels
2827
2954
  };
2828
2955
  }
2829
- function Lr(e = {}) {
2956
+ function Fr(e = {}) {
2830
2957
  return x("point", e);
2831
2958
  }
2832
2959
  function Sr(e = {}) {
@@ -2838,10 +2965,10 @@ function Or(e = {}) {
2838
2965
  function Nr(e = {}) {
2839
2966
  return x("bar", e);
2840
2967
  }
2841
- function Cr(e = {}) {
2968
+ function Rr(e = {}) {
2842
2969
  return x("rule", e);
2843
2970
  }
2844
- function Rr(e = {}) {
2971
+ function Cr(e = {}) {
2845
2972
  return x("tile", e);
2846
2973
  }
2847
2974
  var Ir = [
@@ -2852,7 +2979,7 @@ var Ir = [
2852
2979
  "grouped-bars": "dodge",
2853
2980
  "stacked-bars": "stack",
2854
2981
  lines: null
2855
- }, gn = (e) => e === "identity" ? "grouped-bars" : Ir.find((t) => xr[t] === e) ?? null, yn = {
2982
+ }, fn = (e) => e === "identity" ? "grouped-bars" : Ir.find((t) => xr[t] === e) ?? null, gn = {
2856
2983
  cartesian: (e = {}) => ({
2857
2984
  type: "coord",
2858
2985
  coordType: "cartesian",
@@ -2871,7 +2998,7 @@ var Ir = [
2871
2998
  }, mn = {
2872
2999
  x: Object.assign((e) => Q("x", e), {
2873
3000
  continuous: (e) => v("x", e),
2874
- discrete: (e) => k("x", e),
3001
+ discrete: (e) => D("x", e),
2875
3002
  datetime: (e) => q("x", e),
2876
3003
  log: (e) => v("x", {
2877
3004
  ...e,
@@ -2884,7 +3011,7 @@ var Ir = [
2884
3011
  }),
2885
3012
  y: Object.assign((e) => Q("y", e), {
2886
3013
  continuous: (e) => v("y", e),
2887
- discrete: (e) => k("y", e),
3014
+ discrete: (e) => D("y", e),
2888
3015
  datetime: (e) => q("y", e),
2889
3016
  log: (e) => v("y", {
2890
3017
  ...e,
@@ -2897,7 +3024,7 @@ var Ir = [
2897
3024
  }),
2898
3025
  ySecondary: Object.assign((e) => Q("ySecondary", e), {
2899
3026
  continuous: (e) => v("ySecondary", e),
2900
- discrete: (e) => k("ySecondary", e),
3027
+ discrete: (e) => D("ySecondary", e),
2901
3028
  datetime: (e) => q("ySecondary", e),
2902
3029
  log: (e) => v("ySecondary", {
2903
3030
  ...e,
@@ -2910,34 +3037,34 @@ var Ir = [
2910
3037
  }),
2911
3038
  color: {
2912
3039
  continuous: (e) => v("color", e),
2913
- discrete: (e) => k("color", e),
2914
- palette: (e) => Fr("color", e)
3040
+ discrete: (e) => D("color", e),
3041
+ palette: (e) => kr("color", e)
2915
3042
  },
2916
3043
  size: {
2917
3044
  continuous: (e) => v("size", e),
2918
- discrete: (e) => k("size", e),
3045
+ discrete: (e) => D("size", e),
2919
3046
  identity: (e) => U("size", e)
2920
3047
  },
2921
3048
  alpha: {
2922
3049
  continuous: (e) => v("alpha", e),
2923
- discrete: (e) => k("alpha", e),
3050
+ discrete: (e) => D("alpha", e),
2924
3051
  identity: (e) => U("alpha", e)
2925
3052
  },
2926
3053
  strokeWidth: {
2927
3054
  continuous: (e) => v("strokeWidth", e),
2928
- discrete: (e) => k("strokeWidth", e),
3055
+ discrete: (e) => D("strokeWidth", e),
2929
3056
  identity: (e) => U("strokeWidth", e)
2930
3057
  },
2931
3058
  lineType: {
2932
- discrete: (e) => k("lineType", e),
3059
+ discrete: (e) => D("lineType", e),
2933
3060
  identity: (e) => U("lineType", e)
2934
3061
  }
2935
- }, hn = {
3062
+ }, yn = {
2936
3063
  identity: Vr,
2937
3064
  count: Pr,
2938
3065
  smooth: Br,
2939
3066
  mean: jr,
2940
- sum: zr
3067
+ sum: Wr
2941
3068
  };
2942
3069
  function Br(e) {
2943
3070
  return {
@@ -2956,17 +3083,17 @@ function Pr() {
2956
3083
  function jr() {
2957
3084
  return { type: "mean" };
2958
3085
  }
2959
- function zr() {
3086
+ function Wr() {
2960
3087
  return { type: "sum" };
2961
3088
  }
2962
- var pn = {
2963
- reshape: Wr,
3089
+ var hn = {
3090
+ reshape: zr,
2964
3091
  filter: Ur,
2965
3092
  sort: Yr,
2966
3093
  aggregate: $r,
2967
3094
  constant: Gr
2968
3095
  };
2969
- function Wr(e = {}) {
3096
+ function zr(e = {}) {
2970
3097
  return {
2971
3098
  type: "transform",
2972
3099
  transformType: "reshape",
@@ -3001,154 +3128,138 @@ function Gr(e) {
3001
3128
  options: e
3002
3129
  };
3003
3130
  }
3004
- function Hr(e) {
3005
- const t = e.layout?.gaps;
3006
- if (t === void 0) return e;
3007
- const r = {};
3008
- for (const a of Object.keys(t)) {
3009
- const n = t[a];
3010
- n !== void 0 && (r[a] = typeof n == "number" ? { after: n } : n);
3011
- }
3012
- return {
3013
- ...e,
3014
- layout: {
3015
- ...e.layout,
3016
- gaps: r
3017
- }
3018
- };
3019
- }
3020
- function bn(e) {
3131
+ function pn(e) {
3021
3132
  return {
3022
3133
  type: "config",
3023
- config: Hr(e)
3134
+ config: e
3024
3135
  };
3025
3136
  }
3026
3137
  export {
3027
- xa as $,
3028
- la as $t,
3029
- Za as A,
3030
- ha as At,
3031
- Ua as B,
3138
+ Ia as $,
3139
+ ia as $t,
3140
+ Ja as A,
3141
+ ya as At,
3142
+ za as B,
3032
3143
  _e as Bt,
3033
- Fr as C,
3034
- pa as Ct,
3144
+ kr as C,
3145
+ ha as Ct,
3035
3146
  q as D,
3036
3147
  ma as Dt,
3037
- k as E,
3148
+ D as E,
3038
3149
  Vt as Et,
3039
- Xa as F,
3150
+ Ka as F,
3040
3151
  ft as Ft,
3041
- or as G,
3152
+ sr as G,
3042
3153
  Y as Gt,
3043
3154
  Wa as H,
3044
3155
  j as Ht,
3045
- Ha as I,
3156
+ Ga as I,
3046
3157
  ut as It,
3047
- Va as J,
3048
- ca as Jt,
3049
- sr as K,
3158
+ Ba as J,
3159
+ la as Jt,
3160
+ or as K,
3050
3161
  we as Kt,
3051
3162
  vr as L,
3052
3163
  ct as Lt,
3053
- qa as M,
3164
+ Xa as M,
3054
3165
  Bt as Mt,
3055
- Ga as N,
3056
- ze as Nt,
3166
+ $a as N,
3167
+ We as Nt,
3057
3168
  v as O,
3058
- ya as Ot,
3059
- Ka as P,
3060
- Ft as Pt,
3169
+ ga as Ot,
3170
+ Ha as P,
3171
+ kt as Pt,
3061
3172
  ir as Q,
3062
- ia as Qt,
3173
+ sa as Qt,
3063
3174
  Ar as R,
3064
- da as Rt,
3065
- ln as S,
3175
+ ca as Rt,
3176
+ sn as S,
3066
3177
  te as St,
3067
3178
  U as T,
3068
3179
  Pt as Tt,
3069
- za as U,
3070
- fa as Ut,
3071
- Ya as V,
3180
+ ja as U,
3181
+ ua as Ut,
3182
+ Ua as V,
3072
3183
  dt as Vt,
3073
3184
  Ra as W,
3074
3185
  E as Wt,
3075
- ja as X,
3186
+ Pa as X,
3076
3187
  Te as Xt,
3077
- Pa as Y,
3188
+ Va as Y,
3078
3189
  lt as Yt,
3079
- Ba as Z,
3190
+ xa as Z,
3080
3191
  oa as Zt,
3081
- dn as _,
3192
+ cn as _,
3082
3193
  ve as _n,
3083
3194
  u as _t,
3084
- yn as a,
3195
+ gn as a,
3085
3196
  nt as an,
3086
- wa as at,
3087
- tn as b,
3197
+ Ta as at,
3198
+ en as b,
3088
3199
  qt as bt,
3089
- gn as c,
3090
- na as cn,
3091
- Fa as ct,
3092
- un as d,
3093
- aa as dn,
3094
- Sa as dt,
3200
+ fn as c,
3201
+ aa as cn,
3202
+ La as ct,
3203
+ dn as d,
3204
+ ra as dn,
3205
+ Fa as dt,
3095
3206
  Ee as en,
3096
- Ia as et,
3097
- fn as f,
3098
- ea as fn,
3099
- Ma as ft,
3100
- en as g,
3101
- Jr as gn,
3102
- Ca as gt,
3207
+ Ca as et,
3208
+ un as f,
3209
+ Zr as fn,
3210
+ Ea as ft,
3211
+ Za as g,
3212
+ Qr as gn,
3213
+ Na as gt,
3103
3214
  on as h,
3104
3215
  J as hn,
3105
3216
  c as ht,
3106
3217
  mn as i,
3107
- ot as in,
3108
- va as it,
3109
- Ja as j,
3110
- C as jt,
3111
- Qa as k,
3112
- ga as kt,
3113
- kr as l,
3114
- sa as ln,
3115
- Ea as lt,
3116
- cn as m,
3218
+ st as in,
3219
+ ba as it,
3220
+ Qa as j,
3221
+ R as jt,
3222
+ qa as k,
3223
+ fa as kt,
3224
+ Dr as l,
3225
+ na as ln,
3226
+ Aa as lt,
3227
+ ln as m,
3117
3228
  tt as mn,
3118
- Na as mt,
3119
- pn as n,
3120
- ta as nn,
3229
+ Oa as mt,
3230
+ hn as n,
3231
+ ea as nn,
3121
3232
  ka as nt,
3122
3233
  xr as o,
3123
3234
  Me as on,
3124
- _a as ot,
3125
- sn as p,
3126
- Zr as pn,
3127
- Oa as pt,
3235
+ wa as ot,
3236
+ nn as p,
3237
+ Jr as pn,
3238
+ Sa as pt,
3128
3239
  de as q,
3129
3240
  re as qt,
3130
- hn as r,
3241
+ yn as r,
3131
3242
  at as rn,
3132
- Aa as rt,
3243
+ va as rt,
3133
3244
  Ir as s,
3134
- st as sn,
3135
- Da as st,
3136
- bn as t,
3245
+ ot as sn,
3246
+ _a as st,
3247
+ pn as t,
3137
3248
  rt as tn,
3138
- La as tt,
3249
+ Da as tt,
3139
3250
  x as u,
3140
- m as un,
3141
- Ta as ut,
3142
- rn as v,
3143
- qr as vn,
3144
- ba as vt,
3251
+ y as un,
3252
+ Ma as ut,
3253
+ tn as v,
3254
+ Xr as vn,
3255
+ pa as vt,
3145
3256
  Q as w,
3146
3257
  Z as wt,
3147
- nn as x,
3258
+ an as x,
3148
3259
  Ht as xt,
3149
- an as y,
3150
- Qr as yn,
3260
+ rn as y,
3261
+ qr as yn,
3151
3262
  er as yt,
3152
- $a as z,
3153
- ua as zt
3263
+ Ya as z,
3264
+ da as zt
3154
3265
  };