@orbcharts/core 4.0.0-beta.0 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +200 -200
  2. package/dist/orbcharts-core.es.js +669 -663
  3. package/dist/orbcharts-core.umd.js +3 -3
  4. package/package.json +1 -1
  5. package/src/OrbCharts.ts +34 -34
  6. package/src/chart/createChart.ts +1030 -1013
  7. package/src/chart/createGraphData.ts +391 -391
  8. package/src/chart/createGridData.ts +247 -247
  9. package/src/chart/createMultivariateData.ts +181 -181
  10. package/src/chart/createSeriesData.ts +297 -297
  11. package/src/chart/createTreeData.ts +344 -344
  12. package/src/chart/defaults.ts +119 -119
  13. package/src/defineCanvasLayer.ts +23 -23
  14. package/src/defineCanvasPlugin.ts +38 -38
  15. package/src/defineSVGLayer.ts +23 -23
  16. package/src/defineSVGPlugin.ts +38 -38
  17. package/src/index.ts +8 -8
  18. package/src/layer/createLayer.ts +137 -137
  19. package/src/plugin/createPlugin.ts +487 -487
  20. package/src/test/createGraphData.test.ts +103 -103
  21. package/src/test/createTreeData.test.ts +97 -97
  22. package/src/test/simple-graph-test.js +51 -51
  23. package/src/test/simple-tree-test.js +58 -58
  24. package/src/types/Chart.ts +62 -62
  25. package/src/types/ChartContext.ts +41 -41
  26. package/src/types/Common.ts +4 -4
  27. package/src/types/Encoding.ts +42 -42
  28. package/src/types/Event.ts +25 -25
  29. package/src/types/Layers.ts +92 -92
  30. package/src/types/ModelData.ts +94 -94
  31. package/src/types/Plugin.ts +101 -101
  32. package/src/types/RawData.ts +67 -67
  33. package/src/types/RenderData.ts +15 -15
  34. package/src/types/Theme.ts +20 -20
  35. package/src/types/Validator.ts +35 -35
  36. package/src/types/index.ts +12 -12
  37. package/src/utils/aggregateUtils.ts +99 -99
  38. package/src/utils/colorUtils.ts +63 -63
  39. package/src/utils/commonUtils.ts +56 -56
  40. package/src/utils/dom-lifecycle.ts +164 -164
  41. package/src/utils/dom.ts +54 -54
  42. package/src/utils/errorMessage.ts +40 -40
  43. package/src/utils/index.ts +7 -7
  44. package/src/utils/observables.ts +16 -16
  45. package/src/utils/orbchartsUtils.ts +8 -8
  46. package/src/utils/validator.ts +137 -127
@@ -24,15 +24,15 @@ function gt(t, e, r, n) {
24
24
  function a(f) {
25
25
  try {
26
26
  i(n.next(f));
27
- } catch (b) {
28
- u(b);
27
+ } catch (w) {
28
+ u(w);
29
29
  }
30
30
  }
31
31
  function l(f) {
32
32
  try {
33
33
  i(n.throw(f));
34
- } catch (b) {
35
- u(b);
34
+ } catch (w) {
35
+ u(w);
36
36
  }
37
37
  }
38
38
  function i(f) {
@@ -142,36 +142,36 @@ function bt(t, e, r) {
142
142
  return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", u), o[Symbol.asyncIterator] = function() {
143
143
  return this;
144
144
  }, o;
145
- function u(p) {
145
+ function u(y) {
146
146
  return function(A) {
147
- return Promise.resolve(A).then(p, b);
147
+ return Promise.resolve(A).then(y, w);
148
148
  };
149
149
  }
150
- function a(p, A) {
151
- n[p] && (o[p] = function(m) {
152
- return new Promise(function(h, w) {
153
- s.push([p, m, h, w]) > 1 || l(p, m);
150
+ function a(y, A) {
151
+ n[y] && (o[y] = function(m) {
152
+ return new Promise(function(d, b) {
153
+ s.push([y, m, d, b]) > 1 || l(y, m);
154
154
  });
155
- }, A && (o[p] = A(o[p])));
155
+ }, A && (o[y] = A(o[y])));
156
156
  }
157
- function l(p, A) {
157
+ function l(y, A) {
158
158
  try {
159
- i(n[p](A));
159
+ i(n[y](A));
160
160
  } catch (m) {
161
- _(s[0][3], m);
161
+ S(s[0][3], m);
162
162
  }
163
163
  }
164
- function i(p) {
165
- p.value instanceof ie ? Promise.resolve(p.value.v).then(f, b) : _(s[0][2], p);
164
+ function i(y) {
165
+ y.value instanceof ie ? Promise.resolve(y.value.v).then(f, w) : S(s[0][2], y);
166
166
  }
167
- function f(p) {
168
- l("next", p);
167
+ function f(y) {
168
+ l("next", y);
169
169
  }
170
- function b(p) {
171
- l("throw", p);
170
+ function w(y) {
171
+ l("throw", y);
172
172
  }
173
- function _(p, A) {
174
- p(A), s.shift(), s.length && l(s[0][0], s[0][1]);
173
+ function S(y, A) {
174
+ y(A), s.shift(), s.length && l(s[0][0], s[0][1]);
175
175
  }
176
176
  }
177
177
  function wt(t) {
@@ -251,12 +251,12 @@ var de = function() {
251
251
  } catch (m) {
252
252
  s = m instanceof xe ? m.errors : [m];
253
253
  }
254
- var b = this._finalizers;
255
- if (b) {
254
+ var w = this._finalizers;
255
+ if (w) {
256
256
  this._finalizers = null;
257
257
  try {
258
- for (var _ = ue(b), p = _.next(); !p.done; p = _.next()) {
259
- var A = p.value;
258
+ for (var S = ue(w), y = S.next(); !y.done; y = S.next()) {
259
+ var A = y.value;
260
260
  try {
261
261
  je(A);
262
262
  } catch (m) {
@@ -267,7 +267,7 @@ var de = function() {
267
267
  n = { error: m };
268
268
  } finally {
269
269
  try {
270
- p && !p.done && (o = _.return) && o.call(_);
270
+ y && !y.done && (o = S.return) && o.call(S);
271
271
  } finally {
272
272
  if (n) throw n.error;
273
273
  }
@@ -873,7 +873,7 @@ function rt(t) {
873
873
  function nt(t) {
874
874
  return L(t == null ? void 0 : t.getReader);
875
875
  }
876
- function X(t) {
876
+ function ee(t) {
877
877
  if (t instanceof R)
878
878
  return t;
879
879
  if (t != null) {
@@ -985,7 +985,7 @@ function qt(t, e) {
985
985
  });
986
986
  });
987
987
  }
988
- function re(t, e, r, n, o) {
988
+ function ne(t, e, r, n, o) {
989
989
  n === void 0 && (n = 0), o === void 0 && (o = !1);
990
990
  var s = e.schedule(function() {
991
991
  r(), o ? t.add(this.schedule(null, n)) : this.unsubscribe();
@@ -996,15 +996,15 @@ function re(t, e, r, n, o) {
996
996
  function st(t, e) {
997
997
  return e === void 0 && (e = 0), U(function(r, n) {
998
998
  r.subscribe(N(n, function(o) {
999
- return re(n, t, function() {
999
+ return ne(n, t, function() {
1000
1000
  return n.next(o);
1001
1001
  }, e);
1002
1002
  }, function() {
1003
- return re(n, t, function() {
1003
+ return ne(n, t, function() {
1004
1004
  return n.complete();
1005
1005
  }, e);
1006
1006
  }, function(o) {
1007
- return re(n, t, function() {
1007
+ return ne(n, t, function() {
1008
1008
  return n.error(o);
1009
1009
  }, e);
1010
1010
  }));
@@ -1018,10 +1018,10 @@ function at(t, e) {
1018
1018
  });
1019
1019
  }
1020
1020
  function Gt(t, e) {
1021
- return X(t).pipe(at(e), st(e));
1021
+ return ee(t).pipe(at(e), st(e));
1022
1022
  }
1023
1023
  function Wt(t, e) {
1024
- return X(t).pipe(at(e), st(e));
1024
+ return ee(t).pipe(at(e), st(e));
1025
1025
  }
1026
1026
  function Yt(t, e) {
1027
1027
  return new R(function(r) {
@@ -1034,8 +1034,8 @@ function Yt(t, e) {
1034
1034
  function Zt(t, e) {
1035
1035
  return new R(function(r) {
1036
1036
  var n;
1037
- return re(r, e, function() {
1038
- n = t[et](), re(r, e, function() {
1037
+ return ne(r, e, function() {
1038
+ n = t[et](), ne(r, e, function() {
1039
1039
  var o, s, u;
1040
1040
  try {
1041
1041
  o = n.next(), s = o.value, u = o.done;
@@ -1054,9 +1054,9 @@ function it(t, e) {
1054
1054
  if (!t)
1055
1055
  throw new Error("Iterable cannot be null");
1056
1056
  return new R(function(r) {
1057
- re(r, e, function() {
1057
+ ne(r, e, function() {
1058
1058
  var n = t[Symbol.asyncIterator]();
1059
- re(r, e, function() {
1059
+ ne(r, e, function() {
1060
1060
  n.next().then(function(o) {
1061
1061
  o.done ? r.complete() : r.next(o.value);
1062
1062
  });
@@ -1085,7 +1085,7 @@ function Ht(t, e) {
1085
1085
  throw Xe(t);
1086
1086
  }
1087
1087
  function Be(t, e) {
1088
- return e ? Ht(t, e) : X(t);
1088
+ return e ? Ht(t, e) : ee(t);
1089
1089
  }
1090
1090
  function Qt() {
1091
1091
  for (var t = [], e = 0; e < arguments.length; e++)
@@ -1141,7 +1141,7 @@ function ur(t, e) {
1141
1141
  return r[n] = e[o], r;
1142
1142
  }, {});
1143
1143
  }
1144
- function Z() {
1144
+ function J() {
1145
1145
  for (var t = [], e = 0; e < arguments.length; e++)
1146
1146
  t[e] = arguments[e];
1147
1147
  var r = Ye(t), n = Rt(t), o = ar(t), s = o.args, u = o.keys;
@@ -1157,9 +1157,9 @@ function lr(t, e, r) {
1157
1157
  Re(e, function() {
1158
1158
  for (var o = t.length, s = new Array(o), u = o, a = o, l = function(f) {
1159
1159
  Re(e, function() {
1160
- var b = Be(t[f], e), _ = !1;
1161
- b.subscribe(N(n, function(p) {
1162
- s[f] = p, _ || (_ = !0, a--), a || n.next(r(s.slice()));
1160
+ var w = Be(t[f], e), S = !1;
1161
+ w.subscribe(N(n, function(y) {
1162
+ s[f] = y, S || (S = !0, a--), a || n.next(r(s.slice()));
1163
1163
  }, function() {
1164
1164
  --u || n.complete();
1165
1165
  }));
@@ -1170,11 +1170,11 @@ function lr(t, e, r) {
1170
1170
  };
1171
1171
  }
1172
1172
  function Re(t, e, r) {
1173
- t ? re(r, t, e) : e();
1173
+ t ? ne(r, t, e) : e();
1174
1174
  }
1175
1175
  function cr(t) {
1176
1176
  return new R(function(e) {
1177
- X(t()).subscribe(e);
1177
+ ee(t()).subscribe(e);
1178
1178
  });
1179
1179
  }
1180
1180
  function fr(t, e, r) {
@@ -1194,7 +1194,7 @@ function ae(t) {
1194
1194
  return U(function(e, r) {
1195
1195
  var n = null, o = !1, s;
1196
1196
  n = e.subscribe(N(r, void 0, void 0, function(u) {
1197
- s = X(t(u, ae(t)(e))), n ? (n.unsubscribe(), n = null, s.subscribe(r)) : o = !0;
1197
+ s = ee(t(u, ae(t)(e))), n ? (n.unsubscribe(), n = null, s.subscribe(r)) : o = !0;
1198
1198
  })), o && (n.unsubscribe(), n = null, s.subscribe(r));
1199
1199
  });
1200
1200
  }
@@ -1283,30 +1283,30 @@ function lt(t) {
1283
1283
  return new oe();
1284
1284
  } : e, n = t.resetOnError, o = n === void 0 ? !0 : n, s = t.resetOnComplete, u = s === void 0 ? !0 : s, a = t.resetOnRefCountZero, l = a === void 0 ? !0 : a;
1285
1285
  return function(i) {
1286
- var f, b, _, p = 0, A = !1, m = !1, h = function() {
1287
- b == null || b.unsubscribe(), b = void 0;
1288
- }, w = function() {
1289
- h(), f = _ = void 0, A = m = !1;
1290
- }, C = function() {
1286
+ var f, w, S, y = 0, A = !1, m = !1, d = function() {
1287
+ w == null || w.unsubscribe(), w = void 0;
1288
+ }, b = function() {
1289
+ d(), f = S = void 0, A = m = !1;
1290
+ }, T = function() {
1291
1291
  var O = f;
1292
- w(), O == null || O.unsubscribe();
1292
+ b(), O == null || O.unsubscribe();
1293
1293
  };
1294
- return U(function(O, y) {
1295
- p++, !m && !A && h();
1296
- var g = _ = _ ?? r();
1297
- y.add(function() {
1298
- p--, p === 0 && !m && !A && (b = Ae(C, l));
1299
- }), g.subscribe(y), !f && p > 0 && (f = new he({
1294
+ return U(function(O, h) {
1295
+ y++, !m && !A && d();
1296
+ var p = S = S ?? r();
1297
+ h.add(function() {
1298
+ y--, y === 0 && !m && !A && (w = Ae(T, l));
1299
+ }), p.subscribe(h), !f && y > 0 && (f = new he({
1300
1300
  next: function(E) {
1301
- return g.next(E);
1301
+ return p.next(E);
1302
1302
  },
1303
1303
  error: function(E) {
1304
- m = !0, h(), b = Ae(w, o, E), g.error(E);
1304
+ m = !0, d(), w = Ae(b, o, E), p.error(E);
1305
1305
  },
1306
1306
  complete: function() {
1307
- A = !0, h(), b = Ae(w, u), g.complete();
1307
+ A = !0, d(), w = Ae(b, u), p.complete();
1308
1308
  }
1309
- }), X(O).subscribe(f));
1309
+ }), ee(O).subscribe(f));
1310
1310
  })(i);
1311
1311
  };
1312
1312
  }
@@ -1323,10 +1323,10 @@ function Ae(t, e) {
1323
1323
  o.unsubscribe(), t();
1324
1324
  }
1325
1325
  });
1326
- return X(e.apply(void 0, ce([], le(r)))).subscribe(o);
1326
+ return ee(e.apply(void 0, ce([], le(r)))).subscribe(o);
1327
1327
  }
1328
1328
  }
1329
- function te(t, e, r) {
1329
+ function re(t, e, r) {
1330
1330
  var n, o = !1;
1331
1331
  return n = t, lt({
1332
1332
  connector: function() {
@@ -1345,8 +1345,8 @@ function br(t, e) {
1345
1345
  r.subscribe(N(n, function(l) {
1346
1346
  o == null || o.unsubscribe();
1347
1347
  var i = 0, f = s++;
1348
- X(t(l, f)).subscribe(o = N(n, function(b) {
1349
- return n.next(e ? e(l, b, f, i++) : b);
1348
+ ee(t(l, f)).subscribe(o = N(n, function(w) {
1349
+ return n.next(e ? e(l, w, f, i++) : w);
1350
1350
  }, function() {
1351
1351
  o = null, a();
1352
1352
  }));
@@ -1357,7 +1357,7 @@ function br(t, e) {
1357
1357
  }
1358
1358
  function wr(t) {
1359
1359
  return U(function(e, r) {
1360
- X(t).subscribe(N(r, function() {
1360
+ ee(t).subscribe(N(r, function() {
1361
1361
  return r.complete();
1362
1362
  }, _e)), !r.closed && e.subscribe(r);
1363
1363
  });
@@ -1437,7 +1437,7 @@ function F(t, e, r) {
1437
1437
  }
1438
1438
  return Or(n, r);
1439
1439
  }
1440
- function Q(t) {
1440
+ function X(t) {
1441
1441
  return Object.prototype.toString.call(t) === "[object Object]";
1442
1442
  }
1443
1443
  function Ir(t) {
@@ -1447,7 +1447,7 @@ function ct(t) {
1447
1447
  return !!(t && t.nodeType);
1448
1448
  }
1449
1449
  function W(t, e) {
1450
- if (Q(e) === !1 || Q(t) === !1)
1450
+ if (X(e) === !1 || X(t) === !1)
1451
1451
  return Object.assign({}, t);
1452
1452
  const r = (n, o) => {
1453
1453
  const s = Object.assign({}, n);
@@ -1455,7 +1455,7 @@ function W(t, e) {
1455
1455
  if (!(u in n))
1456
1456
  continue;
1457
1457
  let a;
1458
- Q(o[u]) && Q(n[u]) ? (a = r(n[u], o[u]), s[u] = a) : s[u] = o[u];
1458
+ X(o[u]) && X(n[u]) ? (a = r(n[u], o[u]), s[u] = a) : s[u] = o[u];
1459
1459
  }
1460
1460
  return s;
1461
1461
  };
@@ -1504,12 +1504,12 @@ function fe({ from: t, systemMessage: e }) {
1504
1504
  return `unexpected error from '${t}':
1505
1505
  ${e}`;
1506
1506
  }
1507
- function J({ columnName: t, expectToBe: e, from: r }) {
1507
+ function H({ columnName: t, expectToBe: e, from: r }) {
1508
1508
  return `Invalid value: '${t}' must be '${e}'
1509
1509
 
1510
1510
  ----> find in '${r}'`;
1511
1511
  }
1512
- function H({ columnName: t, expectToBe: e, from: r }) {
1512
+ function Q({ columnName: t, expectToBe: e, from: r }) {
1513
1513
  return `${ht("warning")} Value is not correct: '${t}' suppose to be '${e}', it may cause unexpected errors.'
1514
1514
 
1515
1515
  ----> find in '${r}'`;
@@ -1536,9 +1536,9 @@ function Lr(t, e) {
1536
1536
  string: (s) => typeof s == "string",
1537
1537
  number: (s) => typeof s == "number",
1538
1538
  boolean: (s) => typeof s == "boolean",
1539
- object: (s) => Q(s),
1539
+ object: (s) => X(s),
1540
1540
  // 嚴格判斷是否為純物件
1541
- "object[]": (s) => Array.isArray(s) && s.every((u) => Q(u)),
1541
+ "object[]": (s) => Array.isArray(s) && s.every((u) => X(u)),
1542
1542
  "string[]": (s) => Array.isArray(s) && s.every((u) => typeof u == "string"),
1543
1543
  "number[]": (s) => Array.isArray(s) && s.every((u) => typeof u == "number"),
1544
1544
  Function: (s) => Ir(s),
@@ -1550,6 +1550,8 @@ function Lr(t, e) {
1550
1550
  return Object.keys(t).find((s) => {
1551
1551
  if (e[s]) {
1552
1552
  const u = e[s], a = t[s];
1553
+ if (a === void 0)
1554
+ return !1;
1553
1555
  if (u.toBeTypes) {
1554
1556
  if (u.toBeTypes.some((f) => r[f](a)) === !1)
1555
1557
  return !0;
@@ -1734,8 +1736,8 @@ const Ke = {
1734
1736
  const a = [];
1735
1737
  o ? t.forEach((l, i) => {
1736
1738
  l.forEach((f) => {
1737
- const b = f[e.dataset.from] || `dataset-${i}`;
1738
- a.includes(b) || a.push(b);
1739
+ const w = f[e.dataset.from] || `dataset-${i}`;
1740
+ a.includes(w) || a.push(w);
1739
1741
  });
1740
1742
  }) : t.forEach((l) => {
1741
1743
  const i = l[e.dataset.from] || "default";
@@ -1746,82 +1748,82 @@ const Ke = {
1746
1748
  return s.forEach((a, l) => {
1747
1749
  const i = n.get(a), f = /* @__PURE__ */ new Map();
1748
1750
  i.forEach((m) => {
1749
- const h = m[e.series.from] || "default";
1750
- f.has(h) || f.set(h, []), f.get(h).push(m);
1751
+ const d = m[e.series.from] || "default";
1752
+ f.has(d) || f.set(d, []), f.get(d).push(m);
1751
1753
  });
1752
- let b = Array.from(f.keys());
1754
+ let w = Array.from(f.keys());
1753
1755
  if (Array.isArray(e.series.sort))
1754
- b = e.series.sort.filter((m) => f.has(m)).concat(b.filter((m) => !e.series.sort.includes(m)));
1756
+ w = e.series.sort.filter((m) => f.has(m)).concat(w.filter((m) => !e.series.sort.includes(m)));
1755
1757
  else if (e.series.sort === "original") {
1756
1758
  const m = [];
1757
- i.forEach((h) => {
1758
- const w = h[e.series.from] || "default";
1759
- m.includes(w) || m.push(w);
1760
- }), b = m;
1761
- } else e.series.sort === "alphabetical" && b.sort((m, h) => m.localeCompare(h, void 0, { numeric: !0 }));
1762
- const _ = [];
1759
+ i.forEach((d) => {
1760
+ const b = d[e.series.from] || "default";
1761
+ m.includes(b) || m.push(b);
1762
+ }), w = m;
1763
+ } else e.series.sort === "alphabetical" && w.sort((m, d) => m.localeCompare(d, void 0, { numeric: !0 }));
1764
+ const S = [];
1763
1765
  if (e.category.sort === "original")
1764
1766
  i.forEach((m) => {
1765
- const h = m[e.category.from] || "default";
1766
- _.includes(h) || _.push(h);
1767
+ const d = m[e.category.from] || "default";
1768
+ S.includes(d) || S.push(d);
1767
1769
  });
1768
1770
  else if (e.category.sort === "alphabetical") {
1769
1771
  const m = /* @__PURE__ */ new Set();
1770
- i.forEach((h) => {
1771
- m.add(h[e.category.from] || "default");
1772
- }), _.push(...Array.from(m).sort((h, w) => h.localeCompare(w, void 0, { numeric: !0 })));
1772
+ i.forEach((d) => {
1773
+ m.add(d[e.category.from] || "default");
1774
+ }), S.push(...Array.from(m).sort((d, b) => d.localeCompare(b, void 0, { numeric: !0 })));
1773
1775
  } else if (Array.isArray(e.category.sort)) {
1774
1776
  const m = [];
1775
- i.forEach((w) => {
1776
- const C = w[e.category.from] || "default";
1777
- m.includes(C) || m.push(C);
1777
+ i.forEach((b) => {
1778
+ const T = b[e.category.from] || "default";
1779
+ m.includes(T) || m.push(T);
1778
1780
  });
1779
- const h = e.category.sort;
1780
- _.push(
1781
- ...h.filter((w) => m.includes(w)),
1782
- ...m.filter((w) => !h.includes(w))
1781
+ const d = e.category.sort;
1782
+ S.push(
1783
+ ...d.filter((b) => m.includes(b)),
1784
+ ...m.filter((b) => !d.includes(b))
1783
1785
  );
1784
1786
  }
1785
- const p = /* @__PURE__ */ new Map();
1786
- _.forEach((m, h) => {
1787
- p.set(m, h);
1787
+ const y = /* @__PURE__ */ new Map();
1788
+ S.forEach((m, d) => {
1789
+ y.set(m, d);
1788
1790
  });
1789
1791
  const A = [];
1790
- b.forEach((m, h) => {
1791
- const w = f.get(m), C = /* @__PURE__ */ new Map();
1792
- w.forEach((g) => {
1793
- const E = g[e.category.from] || "default";
1794
- C.has(E) || C.set(E, []), C.get(E).push(g);
1792
+ w.forEach((m, d) => {
1793
+ const b = f.get(m), T = /* @__PURE__ */ new Map();
1794
+ b.forEach((p) => {
1795
+ const E = p[e.category.from] || "default";
1796
+ T.has(E) || T.set(E, []), T.get(E).push(p);
1795
1797
  });
1796
- const O = _.filter((g) => C.has(g)), y = [];
1797
- e.category.sort === "original" && e.value.aggregate === "none" ? (w.forEach((g, E) => {
1798
- const B = g[e.category.from] || "default", I = p.get(B), c = g[e.value.from];
1799
- y.push({
1800
- id: g.id || `${a}-${m}-${B}-${E}`,
1798
+ const O = S.filter((p) => T.has(p)), h = [];
1799
+ e.category.sort === "original" && e.value.aggregate === "none" ? (b.forEach((p, E) => {
1800
+ const P = p[e.category.from] || "default", I = y.get(P), c = p[e.value.from];
1801
+ h.push({
1802
+ id: p.id || `${a}-${m}-${P}-${E}`,
1801
1803
  index: I,
1802
1804
  // Series 模式下 index 對應 categoryIndex
1803
1805
  modelType: "series",
1804
- name: g.name || "",
1805
- data: g.data,
1806
+ name: p.name || "",
1807
+ data: p.data,
1806
1808
  value: typeof c == "number" ? c : null,
1807
1809
  color: F(e.color.from, {
1808
1810
  index: I,
1809
- seriesIndex: h,
1811
+ seriesIndex: d,
1810
1812
  categoryIndex: I,
1811
1813
  datasetIndex: l
1812
1814
  }, r),
1813
1815
  series: m,
1814
- seriesIndex: h,
1815
- category: B,
1816
+ seriesIndex: d,
1817
+ category: P,
1816
1818
  categoryIndex: I
1817
1819
  });
1818
- }), e.value.sort === "asc" ? y.sort((g, E) => g.value === null && E.value === null ? 0 : g.value === null ? 1 : E.value === null ? -1 : g.value - E.value) : e.value.sort === "desc" && y.sort((g, E) => g.value === null && E.value === null ? 0 : g.value === null ? 1 : E.value === null ? -1 : E.value - g.value)) : O.forEach((g) => {
1819
- const E = p.get(g), B = C.get(g);
1820
+ }), e.value.sort === "asc" ? h.sort((p, E) => p.value === null && E.value === null ? 0 : p.value === null ? 1 : E.value === null ? -1 : p.value - E.value) : e.value.sort === "desc" && h.sort((p, E) => p.value === null && E.value === null ? 0 : p.value === null ? 1 : E.value === null ? -1 : E.value - p.value)) : O.forEach((p) => {
1821
+ const E = y.get(p), P = T.get(p);
1820
1822
  if (e.value.aggregate === "none") {
1821
- let I = B.map((c, v) => {
1823
+ let I = P.map((c, v) => {
1822
1824
  const $ = c[e.value.from];
1823
1825
  return {
1824
- id: c.id || `${a}-${m}-${g}-${v}`,
1826
+ id: c.id || `${a}-${m}-${p}-${v}`,
1825
1827
  index: E,
1826
1828
  // Series 模式下 index 對應 categoryIndex
1827
1829
  modelType: "series",
@@ -1830,45 +1832,45 @@ const Ke = {
1830
1832
  value: typeof $ == "number" ? $ : null,
1831
1833
  color: F(e.color.from, {
1832
1834
  index: E,
1833
- seriesIndex: h,
1835
+ seriesIndex: d,
1834
1836
  categoryIndex: E,
1835
1837
  datasetIndex: l
1836
1838
  }, r),
1837
1839
  series: m,
1838
- seriesIndex: h,
1839
- category: g,
1840
+ seriesIndex: d,
1841
+ category: p,
1840
1842
  categoryIndex: E
1841
1843
  };
1842
1844
  });
1843
- e.value.sort === "asc" ? I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : c.value - v.value) : e.value.sort === "desc" && I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : v.value - c.value), y.push(...I);
1845
+ e.value.sort === "asc" ? I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : c.value - v.value) : e.value.sort === "desc" && I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : v.value - c.value), h.push(...I);
1844
1846
  } else {
1845
- const I = B.map((d) => {
1847
+ const I = P.map((C) => {
1846
1848
  if (e.value.aggregate === "count")
1847
1849
  return 1;
1848
- const x = d[e.value.from];
1849
- return typeof x == "number" ? x : null;
1850
- }), c = pe(I, e.value.aggregate), v = B[0], $ = {
1851
- id: v.id || `${a}-${m}-${g}-aggregated`,
1850
+ const g = C[e.value.from];
1851
+ return typeof g == "number" ? g : null;
1852
+ }), c = pe(I, e.value.aggregate), v = P[0], $ = {
1853
+ id: v.id || `${a}-${m}-${p}-aggregated`,
1852
1854
  index: E,
1853
1855
  // Series 模式下 index 對應 categoryIndex
1854
1856
  modelType: "series",
1855
- name: v.name || g,
1857
+ name: v.name || p,
1856
1858
  data: v.data,
1857
1859
  value: c,
1858
1860
  color: F(e.color.from, {
1859
1861
  index: E,
1860
- seriesIndex: h,
1862
+ seriesIndex: d,
1861
1863
  categoryIndex: E,
1862
1864
  datasetIndex: l
1863
1865
  }, r),
1864
1866
  series: m,
1865
- seriesIndex: h,
1866
- category: g,
1867
+ seriesIndex: d,
1868
+ category: p,
1867
1869
  categoryIndex: E
1868
1870
  };
1869
- y.push($);
1871
+ h.push($);
1870
1872
  }
1871
- }), A.push(y);
1873
+ }), A.push(h);
1872
1874
  }), u.push(A);
1873
1875
  }), u;
1874
1876
  }, Rr = (t, e, r) => {
@@ -1889,8 +1891,8 @@ const Ke = {
1889
1891
  const a = [];
1890
1892
  o ? t.forEach((l, i) => {
1891
1893
  l.forEach((f) => {
1892
- const b = f[e.dataset.from] || `dataset-${i}`;
1893
- a.includes(b) || a.push(b);
1894
+ const w = f[e.dataset.from] || `dataset-${i}`;
1895
+ a.includes(w) || a.push(w);
1894
1896
  });
1895
1897
  }) : t.forEach((l) => {
1896
1898
  const i = l[e.dataset.from] || "default";
@@ -1900,62 +1902,62 @@ const Ke = {
1900
1902
  const u = [];
1901
1903
  return s.forEach((a, l) => {
1902
1904
  const i = n.get(a), f = /* @__PURE__ */ new Map();
1903
- i.forEach((h) => {
1904
- const w = h[e.series.from] || "default";
1905
- f.has(w) || f.set(w, []), f.get(w).push(h);
1905
+ i.forEach((d) => {
1906
+ const b = d[e.series.from] || "default";
1907
+ f.has(b) || f.set(b, []), f.get(b).push(d);
1906
1908
  });
1907
- let b = Array.from(f.keys());
1909
+ let w = Array.from(f.keys());
1908
1910
  if (Array.isArray(e.series.sort))
1909
- b = e.series.sort.filter((h) => f.has(h)).concat(b.filter((h) => !e.series.sort.includes(h)));
1911
+ w = e.series.sort.filter((d) => f.has(d)).concat(w.filter((d) => !e.series.sort.includes(d)));
1910
1912
  else if (e.series.sort === "original") {
1911
- const h = [];
1912
- i.forEach((w) => {
1913
- const C = w[e.series.from] || "default";
1914
- h.includes(C) || h.push(C);
1915
- }), b = h;
1916
- } else e.series.sort === "alphabetical" && b.sort((h, w) => h.localeCompare(w, void 0, { numeric: !0 }));
1917
- const _ = [];
1918
- i.forEach((h) => {
1919
- const w = h[e.category.from] || "default";
1920
- _.includes(w) || _.push(w);
1913
+ const d = [];
1914
+ i.forEach((b) => {
1915
+ const T = b[e.series.from] || "default";
1916
+ d.includes(T) || d.push(T);
1917
+ }), w = d;
1918
+ } else e.series.sort === "alphabetical" && w.sort((d, b) => d.localeCompare(b, void 0, { numeric: !0 }));
1919
+ const S = [];
1920
+ i.forEach((d) => {
1921
+ const b = d[e.category.from] || "default";
1922
+ S.includes(b) || S.push(b);
1921
1923
  });
1922
- const p = new Set(_);
1923
- let A = Array.from(p);
1924
- Array.isArray(e.category.sort) ? A = e.category.sort.filter((h) => p.has(h)).concat(A.filter((h) => !e.category.sort.includes(h))) : e.category.sort === "original" ? A = _ : e.category.sort === "alphabetical" && A.sort((h, w) => h.localeCompare(w, void 0, { numeric: !0 }));
1924
+ const y = new Set(S);
1925
+ let A = Array.from(y);
1926
+ Array.isArray(e.category.sort) ? A = e.category.sort.filter((d) => y.has(d)).concat(A.filter((d) => !e.category.sort.includes(d))) : e.category.sort === "original" ? A = S : e.category.sort === "alphabetical" && A.sort((d, b) => d.localeCompare(b, void 0, { numeric: !0 }));
1925
1927
  const m = [];
1926
- b.forEach((h, w) => {
1927
- const C = f.get(h), O = /* @__PURE__ */ new Map();
1928
- C.forEach((g) => {
1929
- const E = g[e.category.from] || "default";
1930
- O.has(E) || O.set(E, []), O.get(E).push(g);
1928
+ w.forEach((d, b) => {
1929
+ const T = f.get(d), O = /* @__PURE__ */ new Map();
1930
+ T.forEach((p) => {
1931
+ const E = p[e.category.from] || "default";
1932
+ O.has(E) || O.set(E, []), O.get(E).push(p);
1931
1933
  });
1932
- const y = [];
1933
- A.forEach((g, E) => {
1934
- const B = O.get(g);
1935
- if (!B)
1936
- y.push({
1937
- id: `${a}-${h}-${g}-null`,
1934
+ const h = [];
1935
+ A.forEach((p, E) => {
1936
+ const P = O.get(p);
1937
+ if (!P)
1938
+ h.push({
1939
+ id: `${a}-${d}-${p}-null`,
1938
1940
  index: E,
1939
1941
  modelType: "grid",
1940
- name: g,
1942
+ name: p,
1941
1943
  data: void 0,
1942
1944
  value: null,
1943
1945
  color: F(e.color.from, {
1944
1946
  index: E,
1945
- seriesIndex: w,
1947
+ seriesIndex: b,
1946
1948
  categoryIndex: E,
1947
1949
  datasetIndex: l
1948
1950
  }, r),
1949
- series: h,
1950
- seriesIndex: w,
1951
- category: g,
1951
+ series: d,
1952
+ seriesIndex: b,
1953
+ category: p,
1952
1954
  categoryIndex: E
1953
1955
  });
1954
1956
  else if (e.value.aggregate === "none") {
1955
- let I = B.map((c, v) => {
1957
+ let I = P.map((c, v) => {
1956
1958
  const $ = c[e.value.from];
1957
1959
  return {
1958
- id: c.id || `${a}-${h}-${g}-${v}`,
1960
+ id: c.id || `${a}-${d}-${p}-${v}`,
1959
1961
  index: E,
1960
1962
  // Grid 模式下 index 對應 categoryIndex
1961
1963
  modelType: "grid",
@@ -1964,45 +1966,45 @@ const Ke = {
1964
1966
  value: typeof $ == "number" ? $ : null,
1965
1967
  color: F(e.color.from, {
1966
1968
  index: E,
1967
- seriesIndex: w,
1969
+ seriesIndex: b,
1968
1970
  categoryIndex: E,
1969
1971
  datasetIndex: l
1970
1972
  }, r),
1971
- series: h,
1972
- seriesIndex: w,
1973
- category: g,
1973
+ series: d,
1974
+ seriesIndex: b,
1975
+ category: p,
1974
1976
  categoryIndex: E
1975
1977
  };
1976
1978
  });
1977
- e.value.sort === "asc" ? I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : c.value - v.value) : e.value.sort === "desc" && I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : v.value - c.value), y.push(...I);
1979
+ e.value.sort === "asc" ? I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : c.value - v.value) : e.value.sort === "desc" && I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : v.value - c.value), h.push(...I);
1978
1980
  } else {
1979
- const I = B.map((d) => {
1981
+ const I = P.map((C) => {
1980
1982
  if (e.value.aggregate === "count")
1981
1983
  return 1;
1982
- const x = d[e.value.from];
1983
- return typeof x == "number" ? x : null;
1984
- }), c = pe(I, e.value.aggregate), v = B[0], $ = {
1985
- id: v.id || `${a}-${h}-${g}-aggregated`,
1984
+ const g = C[e.value.from];
1985
+ return typeof g == "number" ? g : null;
1986
+ }), c = pe(I, e.value.aggregate), v = P[0], $ = {
1987
+ id: v.id || `${a}-${d}-${p}-aggregated`,
1986
1988
  index: E,
1987
1989
  // Grid 模式下 index 對應 categoryIndex
1988
1990
  modelType: "grid",
1989
- name: v.name || g,
1991
+ name: v.name || p,
1990
1992
  data: v.data,
1991
1993
  value: c,
1992
1994
  color: F(e.color.from, {
1993
1995
  index: E,
1994
- seriesIndex: w,
1996
+ seriesIndex: b,
1995
1997
  categoryIndex: E,
1996
1998
  datasetIndex: l
1997
1999
  }, r),
1998
- series: h,
1999
- seriesIndex: w,
2000
- category: g,
2000
+ series: d,
2001
+ seriesIndex: b,
2002
+ category: p,
2001
2003
  categoryIndex: E
2002
2004
  };
2003
- y.push($);
2005
+ h.push($);
2004
2006
  }
2005
- }), m.push(y);
2007
+ }), m.push(h);
2006
2008
  }), u.push(m);
2007
2009
  }), u;
2008
2010
  }, Kr = (t, e, r) => {
@@ -2023,8 +2025,8 @@ const Ke = {
2023
2025
  const a = [];
2024
2026
  o ? t.forEach((l, i) => {
2025
2027
  l.forEach((f) => {
2026
- const b = f[e.dataset.from] || `dataset-${i}`;
2027
- a.includes(b) || a.push(b);
2028
+ const w = f[e.dataset.from] || `dataset-${i}`;
2029
+ a.includes(w) || a.push(w);
2028
2030
  });
2029
2031
  }) : t.forEach((l) => {
2030
2032
  const i = l[e.dataset.from] || "default";
@@ -2034,71 +2036,71 @@ const Ke = {
2034
2036
  const u = [];
2035
2037
  return s.forEach((a, l) => {
2036
2038
  const i = n.get(a), f = /* @__PURE__ */ new Map();
2037
- i.forEach((p) => {
2038
- const A = p[e.series.from] || "default";
2039
- f.has(A) || f.set(A, []), f.get(A).push(p);
2039
+ i.forEach((y) => {
2040
+ const A = y[e.series.from] || "default";
2041
+ f.has(A) || f.set(A, []), f.get(A).push(y);
2040
2042
  });
2041
- let b = Array.from(f.keys());
2043
+ let w = Array.from(f.keys());
2042
2044
  if (Array.isArray(e.series.sort))
2043
- b = e.series.sort.filter((p) => f.has(p)).concat(b.filter((p) => !e.series.sort.includes(p)));
2045
+ w = e.series.sort.filter((y) => f.has(y)).concat(w.filter((y) => !e.series.sort.includes(y)));
2044
2046
  else if (e.series.sort === "original") {
2045
- const p = [];
2047
+ const y = [];
2046
2048
  i.forEach((A) => {
2047
2049
  const m = A[e.series.from] || "default";
2048
- p.includes(m) || p.push(m);
2049
- }), b = p;
2050
- } else e.series.sort === "alphabetical" && b.sort((p, A) => p.localeCompare(A, void 0, { numeric: !0 }));
2051
- const _ = [];
2052
- b.forEach((p, A) => {
2053
- const m = f.get(p), h = /* @__PURE__ */ new Map();
2050
+ y.includes(m) || y.push(m);
2051
+ }), w = y;
2052
+ } else e.series.sort === "alphabetical" && w.sort((y, A) => y.localeCompare(A, void 0, { numeric: !0 }));
2053
+ const S = [];
2054
+ w.forEach((y, A) => {
2055
+ const m = f.get(y), d = /* @__PURE__ */ new Map();
2054
2056
  m.forEach((O) => {
2055
- const y = O[e.category.from] || "default";
2056
- h.has(y) || h.set(y, []), h.get(y).push(O);
2057
+ const h = O[e.category.from] || "default";
2058
+ d.has(h) || d.set(h, []), d.get(h).push(O);
2057
2059
  });
2058
- let w = Array.from(h.keys());
2060
+ let b = Array.from(d.keys());
2059
2061
  if (Array.isArray(e.category.sort))
2060
- w = e.category.sort.filter((O) => h.has(O)).concat(w.filter((O) => !e.category.sort.includes(O)));
2062
+ b = e.category.sort.filter((O) => d.has(O)).concat(b.filter((O) => !e.category.sort.includes(O)));
2061
2063
  else if (e.category.sort === "original") {
2062
2064
  const O = [];
2063
- m.forEach((y) => {
2064
- const g = y[e.category.from] || "default";
2065
- O.includes(g) || O.push(g);
2066
- }), w = O;
2067
- } else e.category.sort === "alphabetical" && w.sort((O, y) => O.localeCompare(y, void 0, { numeric: !0 }));
2068
- const C = [];
2069
- w.forEach((O, y) => {
2070
- h.get(O).forEach((E, B) => {
2065
+ m.forEach((h) => {
2066
+ const p = h[e.category.from] || "default";
2067
+ O.includes(p) || O.push(p);
2068
+ }), b = O;
2069
+ } else e.category.sort === "alphabetical" && b.sort((O, h) => O.localeCompare(h, void 0, { numeric: !0 }));
2070
+ const T = [];
2071
+ b.forEach((O, h) => {
2072
+ d.get(O).forEach((E, P) => {
2071
2073
  const I = e.multivariate.map((v, $) => ({
2072
2074
  index: $,
2073
2075
  name: v.name,
2074
2076
  value: (() => {
2075
- const d = E[v.from];
2076
- return typeof d == "number" ? d : null;
2077
+ const C = E[v.from];
2078
+ return typeof C == "number" ? C : null;
2077
2079
  })()
2078
2080
  })), c = {
2079
- id: E.id || `${a}-${p}-${O}-${B}`,
2080
- index: B,
2081
+ id: E.id || `${a}-${y}-${O}-${P}`,
2082
+ index: P,
2081
2083
  modelType: "multivariate",
2082
2084
  name: E.name || "",
2083
2085
  data: E.data,
2084
2086
  value: null,
2085
2087
  // MultivariateData 的主要值在 values 陣列中,這裡設為 null
2086
2088
  color: F(e.color.from, {
2087
- index: B,
2089
+ index: P,
2088
2090
  seriesIndex: A,
2089
- categoryIndex: y,
2091
+ categoryIndex: h,
2090
2092
  datasetIndex: l
2091
2093
  }, r),
2092
2094
  multivariate: I,
2093
- series: p,
2095
+ series: y,
2094
2096
  seriesIndex: A,
2095
2097
  category: O,
2096
- categoryIndex: y
2098
+ categoryIndex: h
2097
2099
  };
2098
- C.push(c);
2100
+ T.push(c);
2099
2101
  });
2100
- }), _.push(C);
2101
- }), u.push(_);
2102
+ }), S.push(T);
2103
+ }), u.push(S);
2102
2104
  }), u;
2103
2105
  }, Fr = (t, e, r) => {
2104
2106
  const n = Array.isArray(t[0]), o = [], s = [];
@@ -2111,10 +2113,10 @@ const Ke = {
2111
2113
  });
2112
2114
  const u = /* @__PURE__ */ new Map();
2113
2115
  n ? t.forEach((i, f) => {
2114
- i.forEach((b) => {
2115
- if (!b.source || !b.target) {
2116
- const _ = b[e.dataset.from] || `dataset-${f}`;
2117
- u.has(_) || u.set(_, []), u.get(_).push(b);
2116
+ i.forEach((w) => {
2117
+ if (!w.source || !w.target) {
2118
+ const S = w[e.dataset.from] || `dataset-${f}`;
2119
+ u.has(S) || u.set(S, []), u.get(S).push(w);
2118
2120
  }
2119
2121
  });
2120
2122
  }) : o.forEach((i) => {
@@ -2126,146 +2128,146 @@ const Ke = {
2126
2128
  a = e.dataset.sort.filter((i) => u.has(i)).concat(a.filter((i) => !e.dataset.sort.includes(i)));
2127
2129
  else if (e.dataset.sort === "original") {
2128
2130
  const i = [];
2129
- n ? t.forEach((f, b) => {
2130
- f.forEach((_) => {
2131
- if (!_.source || !_.target) {
2132
- const p = _[e.dataset.from] || `dataset-${b}`;
2133
- i.includes(p) || i.push(p);
2131
+ n ? t.forEach((f, w) => {
2132
+ f.forEach((S) => {
2133
+ if (!S.source || !S.target) {
2134
+ const y = S[e.dataset.from] || `dataset-${w}`;
2135
+ i.includes(y) || i.push(y);
2134
2136
  }
2135
2137
  });
2136
2138
  }) : o.forEach((f) => {
2137
- const b = f[e.dataset.from] || "default";
2138
- i.includes(b) || i.push(b);
2139
+ const w = f[e.dataset.from] || "default";
2140
+ i.includes(w) || i.push(w);
2139
2141
  }), a = i;
2140
2142
  } else e.dataset.sort === "alphabetical" && a.sort((i, f) => i.localeCompare(f, void 0, { numeric: !0 }));
2141
2143
  const l = [];
2142
2144
  return a.forEach((i, f) => {
2143
- const b = u.get(i), _ = [], p = /* @__PURE__ */ new Map();
2144
- b.forEach((c) => {
2145
+ const w = u.get(i), S = [], y = /* @__PURE__ */ new Map();
2146
+ w.forEach((c) => {
2145
2147
  const v = c[e.series.from] || "default";
2146
- p.has(v) || p.set(v, []), p.get(v).push(c);
2148
+ y.has(v) || y.set(v, []), y.get(v).push(c);
2147
2149
  });
2148
- let A = Array.from(p.keys());
2150
+ let A = Array.from(y.keys());
2149
2151
  if (Array.isArray(e.series.sort))
2150
- A = e.series.sort.filter((c) => p.has(c)).concat(A.filter((c) => !e.series.sort.includes(c)));
2152
+ A = e.series.sort.filter((c) => y.has(c)).concat(A.filter((c) => !e.series.sort.includes(c)));
2151
2153
  else if (e.series.sort === "original") {
2152
2154
  const c = [];
2153
- b.forEach((v) => {
2155
+ w.forEach((v) => {
2154
2156
  const $ = v[e.series.from] || "default";
2155
2157
  c.includes($) || c.push($);
2156
2158
  }), A = c;
2157
2159
  } else e.series.sort === "alphabetical" && A.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
2158
2160
  A.forEach((c, v) => {
2159
- const $ = p.get(c), d = /* @__PURE__ */ new Map();
2160
- $.forEach((S) => {
2161
- const T = S[e.category.from] || "default";
2162
- d.has(T) || d.set(T, []), d.get(T).push(S);
2161
+ const $ = y.get(c), C = /* @__PURE__ */ new Map();
2162
+ $.forEach((x) => {
2163
+ const _ = x[e.category.from] || "default";
2164
+ C.has(_) || C.set(_, []), C.get(_).push(x);
2163
2165
  });
2164
- let x = Array.from(d.keys());
2166
+ let g = Array.from(C.keys());
2165
2167
  if (Array.isArray(e.category.sort))
2166
- x = e.category.sort.filter((S) => d.has(S)).concat(x.filter((S) => !e.category.sort.includes(S)));
2168
+ g = e.category.sort.filter((x) => C.has(x)).concat(g.filter((x) => !e.category.sort.includes(x)));
2167
2169
  else if (e.category.sort === "original") {
2168
- const S = [];
2169
- $.forEach((T) => {
2170
- const P = T[e.category.from] || "default";
2171
- S.includes(P) || S.push(P);
2172
- }), x = S;
2173
- } else e.category.sort === "alphabetical" && x.sort((S, T) => S.localeCompare(T, void 0, { numeric: !0 }));
2174
- x.forEach((S, T) => {
2175
- const P = d.get(S);
2170
+ const x = [];
2171
+ $.forEach((_) => {
2172
+ const B = _[e.category.from] || "default";
2173
+ x.includes(B) || x.push(B);
2174
+ }), g = x;
2175
+ } else e.category.sort === "alphabetical" && g.sort((x, _) => x.localeCompare(_, void 0, { numeric: !0 }));
2176
+ g.forEach((x, _) => {
2177
+ const B = C.get(x);
2176
2178
  if (e.value.aggregate === "none") {
2177
- let j = P.map((M, k) => {
2178
- const K = M[e.value.from];
2179
+ let j = B.map((k, M) => {
2180
+ const K = k[e.value.from];
2179
2181
  return {
2180
- id: M.id || `${i}-${c}-${S}-${k}`,
2181
- index: _.length + k,
2182
+ id: k.id || `${i}-${c}-${x}-${M}`,
2183
+ index: S.length + M,
2182
2184
  // 在所有 nodes 中的索引
2183
2185
  modelType: "graph",
2184
- name: M.name || "",
2185
- data: M.data,
2186
+ name: k.name || "",
2187
+ data: k.data,
2186
2188
  value: typeof K == "number" ? K : null,
2187
2189
  color: F(e.color.from, {
2188
- index: T,
2190
+ index: _,
2189
2191
  seriesIndex: v,
2190
- categoryIndex: T,
2192
+ categoryIndex: _,
2191
2193
  datasetIndex: f
2192
2194
  }, r),
2193
2195
  series: c,
2194
2196
  seriesIndex: v,
2195
- category: S,
2196
- categoryIndex: T
2197
+ category: x,
2198
+ categoryIndex: _
2197
2199
  };
2198
2200
  });
2199
- e.value.sort === "asc" ? j.sort((M, k) => M.value === null && k.value === null ? 0 : M.value === null ? 1 : k.value === null ? -1 : M.value - k.value) : e.value.sort === "desc" && j.sort((M, k) => M.value === null && k.value === null ? 0 : M.value === null ? 1 : k.value === null ? -1 : k.value - M.value), _.push(...j);
2201
+ e.value.sort === "asc" ? j.sort((k, M) => k.value === null && M.value === null ? 0 : k.value === null ? 1 : M.value === null ? -1 : k.value - M.value) : e.value.sort === "desc" && j.sort((k, M) => k.value === null && M.value === null ? 0 : k.value === null ? 1 : M.value === null ? -1 : M.value - k.value), S.push(...j);
2200
2202
  } else {
2201
- const j = P.map((ne) => {
2203
+ const j = B.map((Z) => {
2202
2204
  if (e.value.aggregate === "count")
2203
2205
  return 1;
2204
- const ee = ne[e.value.from];
2205
- return typeof ee == "number" ? ee : null;
2206
- }), M = pe(j, e.value.aggregate), k = P[0], K = {
2207
- id: k.id || `${i}-${c}-${S}-aggregated`,
2208
- index: _.length,
2206
+ const te = Z[e.value.from];
2207
+ return typeof te == "number" ? te : null;
2208
+ }), k = pe(j, e.value.aggregate), M = B[0], K = {
2209
+ id: M.id || `${i}-${c}-${x}-aggregated`,
2210
+ index: S.length,
2209
2211
  // 在所有 nodes 中的索引
2210
2212
  modelType: "graph",
2211
- name: k.name || S,
2212
- data: k.data,
2213
- value: M,
2213
+ name: M.name || x,
2214
+ data: M.data,
2215
+ value: k,
2214
2216
  color: F(e.color.from, {
2215
- index: T,
2217
+ index: _,
2216
2218
  seriesIndex: v,
2217
- categoryIndex: T,
2219
+ categoryIndex: _,
2218
2220
  datasetIndex: f
2219
2221
  }, r),
2220
2222
  series: c,
2221
2223
  seriesIndex: v,
2222
- category: S,
2223
- categoryIndex: T
2224
+ category: x,
2225
+ categoryIndex: _
2224
2226
  };
2225
- _.push(K);
2227
+ S.push(K);
2226
2228
  }
2227
2229
  });
2228
2230
  });
2229
- const m = [], h = /* @__PURE__ */ new Map();
2230
- _.forEach((c) => {
2231
+ const m = [], d = /* @__PURE__ */ new Map();
2232
+ S.forEach((c) => {
2231
2233
  const v = o.find(($) => $.id === c.id || $.name === c.name);
2232
- v != null && v.id && h.set(v.id, c.index), v != null && v.name && h.set(v.name, c.index);
2234
+ v != null && v.id && d.set(v.id, c.index), v != null && v.name && d.set(v.name, c.index);
2233
2235
  });
2234
- const w = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
2235
- _.forEach((c) => {
2236
- w.has(c.series) || w.set(c.series, c.seriesIndex), C.has(c.category) || C.set(c.category, c.categoryIndex);
2236
+ const b = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map();
2237
+ S.forEach((c) => {
2238
+ b.has(c.series) || b.set(c.series, c.seriesIndex), T.has(c.category) || T.set(c.category, c.categoryIndex);
2237
2239
  });
2238
- let O = w.size, y = C.size;
2239
- const g = (c) => (w.has(c) || w.set(c, O++), w.get(c)), E = (c) => (C.has(c) || C.set(c, y++), C.get(c)), B = s.filter((c) => (c[e.dataset.from] || "default") === i), I = /* @__PURE__ */ new Map();
2240
- B.forEach((c) => {
2241
- const v = c.source, $ = c.target, d = c[e.series.from] || "default", x = c[e.category.from] || "default", S = `${v}-${$}-${d}-${x}`;
2242
- I.has(S) || I.set(S, []), I.get(S).push(c);
2240
+ let O = b.size, h = T.size;
2241
+ const p = (c) => (b.has(c) || b.set(c, O++), b.get(c)), E = (c) => (T.has(c) || T.set(c, h++), T.get(c)), P = s.filter((c) => (c[e.dataset.from] || "default") === i), I = /* @__PURE__ */ new Map();
2242
+ P.forEach((c) => {
2243
+ const v = c.source, $ = c.target, C = c[e.series.from] || "default", g = c[e.category.from] || "default", x = `${v}-${$}-${C}-${g}`;
2244
+ I.has(x) || I.set(x, []), I.get(x).push(c);
2243
2245
  }), Array.from(I.entries()).forEach(([c, v], $) => {
2244
- const d = v[0], x = d.source, S = d.target, T = h.get(x) ?? -1, P = h.get(S) ?? -1;
2245
- if (T >= 0 && P >= 0)
2246
+ const C = v[0], g = C.source, x = C.target, _ = d.get(g) ?? -1, B = d.get(x) ?? -1;
2247
+ if (_ >= 0 && B >= 0)
2246
2248
  if (e.value.aggregate === "none")
2247
- v.forEach((j, M) => {
2248
- const k = j[e.value.from], K = j[e.series.from] || "default", ne = j[e.category.from] || "default", ee = g(K), ve = E(ne), Ee = {
2249
- id: j.id || `edge-${$}-${M}`,
2249
+ v.forEach((j, k) => {
2250
+ const M = j[e.value.from], K = j[e.series.from] || "default", Z = j[e.category.from] || "default", te = p(K), ve = E(Z), Ee = {
2251
+ id: j.id || `edge-${$}-${k}`,
2250
2252
  index: m.length,
2251
2253
  modelType: "graph",
2252
2254
  name: j.name || "",
2253
2255
  data: j.data,
2254
- value: typeof k == "number" ? k : null,
2256
+ value: typeof M == "number" ? M : null,
2255
2257
  color: F(e.color.from, {
2256
2258
  index: m.length,
2257
- seriesIndex: ee,
2259
+ seriesIndex: te,
2258
2260
  categoryIndex: ve,
2259
2261
  datasetIndex: f
2260
2262
  }, r),
2261
2263
  series: K,
2262
- seriesIndex: ee,
2263
- category: ne,
2264
+ seriesIndex: te,
2265
+ category: Z,
2264
2266
  categoryIndex: ve,
2265
- source: x,
2266
- sourceIndex: T,
2267
- target: S,
2268
- targetIndex: P
2267
+ source: g,
2268
+ sourceIndex: _,
2269
+ target: x,
2270
+ targetIndex: B
2269
2271
  };
2270
2272
  m.push(Ee);
2271
2273
  });
@@ -2275,31 +2277,31 @@ const Ke = {
2275
2277
  return 1;
2276
2278
  const Pe = Ee[e.value.from];
2277
2279
  return typeof Pe == "number" ? Pe : null;
2278
- }), M = pe(j, e.value.aggregate), k = d[e.series.from] || "default", K = d[e.category.from] || "default", ne = g(k), ee = E(K), ve = {
2279
- id: d.id || `edge-${$}-aggregated`,
2280
+ }), k = pe(j, e.value.aggregate), M = C[e.series.from] || "default", K = C[e.category.from] || "default", Z = p(M), te = E(K), ve = {
2281
+ id: C.id || `edge-${$}-aggregated`,
2280
2282
  index: m.length,
2281
2283
  modelType: "graph",
2282
- name: d.name || "",
2283
- data: d.data,
2284
- value: M,
2284
+ name: C.name || "",
2285
+ data: C.data,
2286
+ value: k,
2285
2287
  color: F(e.color.from, {
2286
2288
  index: m.length,
2287
- seriesIndex: ne,
2288
- categoryIndex: ee,
2289
+ seriesIndex: Z,
2290
+ categoryIndex: te,
2289
2291
  datasetIndex: f
2290
2292
  }, r),
2291
- series: k,
2292
- seriesIndex: ne,
2293
+ series: M,
2294
+ seriesIndex: Z,
2293
2295
  category: K,
2294
- categoryIndex: ee,
2295
- source: x,
2296
- sourceIndex: T,
2297
- target: S,
2298
- targetIndex: P
2296
+ categoryIndex: te,
2297
+ source: g,
2298
+ sourceIndex: _,
2299
+ target: x,
2300
+ targetIndex: B
2299
2301
  };
2300
2302
  m.push(ve);
2301
2303
  }
2302
- }), l.push({ nodes: _, edges: m });
2304
+ }), l.push({ nodes: S, edges: m });
2303
2305
  }), l;
2304
2306
  }, Dr = (t, e, r) => {
2305
2307
  const n = /* @__PURE__ */ new Map(), o = Array.isArray(t[0]);
@@ -2319,8 +2321,8 @@ const Ke = {
2319
2321
  const a = [];
2320
2322
  o ? t.forEach((l, i) => {
2321
2323
  l.forEach((f) => {
2322
- const b = f[e.dataset.from] || `dataset-${i}`;
2323
- a.includes(b) || a.push(b);
2324
+ const w = f[e.dataset.from] || `dataset-${i}`;
2325
+ a.includes(w) || a.push(w);
2324
2326
  });
2325
2327
  }) : t.forEach((l) => {
2326
2328
  const i = l[e.dataset.from] || "default";
@@ -2334,52 +2336,52 @@ const Ke = {
2334
2336
  const v = c[e.series.from] || "default";
2335
2337
  f.has(v) || f.set(v, []), f.get(v).push(c);
2336
2338
  });
2337
- let b = Array.from(f.keys());
2339
+ let w = Array.from(f.keys());
2338
2340
  if (Array.isArray(e.series.sort))
2339
- b = e.series.sort.filter((c) => f.has(c)).concat(b.filter((c) => !e.series.sort.includes(c)));
2341
+ w = e.series.sort.filter((c) => f.has(c)).concat(w.filter((c) => !e.series.sort.includes(c)));
2340
2342
  else if (e.series.sort === "original") {
2341
2343
  const c = [];
2342
2344
  i.forEach((v) => {
2343
2345
  const $ = v[e.series.from] || "default";
2344
2346
  c.includes($) || c.push($);
2345
- }), b = c;
2346
- } else e.series.sort === "alphabetical" && b.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
2347
- const _ = /* @__PURE__ */ new Map();
2347
+ }), w = c;
2348
+ } else e.series.sort === "alphabetical" && w.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
2349
+ const S = /* @__PURE__ */ new Map();
2348
2350
  i.forEach((c) => {
2349
2351
  const v = c[e.category.from] || "default";
2350
- _.has(v) || _.set(v, []), _.get(v).push(c);
2352
+ S.has(v) || S.set(v, []), S.get(v).push(c);
2351
2353
  });
2352
- let p = Array.from(_.keys());
2354
+ let y = Array.from(S.keys());
2353
2355
  if (Array.isArray(e.category.sort))
2354
- p = e.category.sort.filter((c) => _.has(c)).concat(p.filter((c) => !e.category.sort.includes(c)));
2356
+ y = e.category.sort.filter((c) => S.has(c)).concat(y.filter((c) => !e.category.sort.includes(c)));
2355
2357
  else if (e.category.sort === "original") {
2356
2358
  const c = [];
2357
2359
  i.forEach((v) => {
2358
2360
  const $ = v[e.category.from] || "default";
2359
2361
  c.includes($) || c.push($);
2360
- }), p = c;
2361
- } else e.category.sort === "alphabetical" && p.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
2362
+ }), y = c;
2363
+ } else e.category.sort === "alphabetical" && y.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
2362
2364
  const A = /* @__PURE__ */ new Map();
2363
2365
  i.forEach((c) => {
2364
2366
  const v = c.id || "unknown";
2365
2367
  A.has(v) || A.set(v, []), A.get(v).push(c);
2366
2368
  });
2367
2369
  let m = 0;
2368
- const h = b[0] || "default", w = b.indexOf(h), C = /* @__PURE__ */ new Map();
2370
+ const d = w[0] || "default", b = w.indexOf(d), T = /* @__PURE__ */ new Map();
2369
2371
  Array.from(A.entries()).forEach(([c, v]) => {
2370
- const $ = v[0], d = $[e.series.from] || "default", x = b.indexOf(d), S = $[e.category.from] || "default", T = p.indexOf(S);
2372
+ const $ = v[0], C = $[e.series.from] || "default", g = w.indexOf(C), x = $[e.category.from] || "default", _ = y.indexOf(x);
2371
2373
  if (e.value.aggregate === "none") {
2372
- const P = $[e.value.from], j = {
2374
+ const B = $[e.value.from], j = {
2373
2375
  id: c,
2374
2376
  index: m++,
2375
2377
  modelType: "tree",
2376
2378
  name: $.name || c,
2377
2379
  data: $.data,
2378
- value: typeof P == "number" ? P : null,
2380
+ value: typeof B == "number" ? B : null,
2379
2381
  color: F(e.color.from, {
2380
2382
  index: m - 1,
2381
- seriesIndex: x,
2382
- categoryIndex: T,
2383
+ seriesIndex: g,
2384
+ categoryIndex: _,
2383
2385
  datasetIndex: l
2384
2386
  }, r),
2385
2387
  parent: $.parent || null,
@@ -2390,19 +2392,19 @@ const Ke = {
2390
2392
  seq: 0,
2391
2393
  // 稍後計算
2392
2394
  children: [],
2393
- series: d,
2394
- seriesIndex: x,
2395
- category: S,
2396
- categoryIndex: T
2395
+ series: C,
2396
+ seriesIndex: g,
2397
+ category: x,
2398
+ categoryIndex: _
2397
2399
  };
2398
- C.set(c, j);
2400
+ T.set(c, j);
2399
2401
  } else {
2400
- const P = v.map((k) => {
2402
+ const B = v.map((M) => {
2401
2403
  if (e.value.aggregate === "count")
2402
2404
  return 1;
2403
- const K = k[e.value.from];
2405
+ const K = M[e.value.from];
2404
2406
  return typeof K == "number" ? K : null;
2405
- }), j = pe(P, e.value.aggregate), M = {
2407
+ }), j = pe(B, e.value.aggregate), k = {
2406
2408
  id: c,
2407
2409
  index: m++,
2408
2410
  modelType: "tree",
@@ -2411,8 +2413,8 @@ const Ke = {
2411
2413
  value: j,
2412
2414
  color: F(e.color.from, {
2413
2415
  index: m - 1,
2414
- seriesIndex: x,
2415
- categoryIndex: T,
2416
+ seriesIndex: g,
2417
+ categoryIndex: _,
2416
2418
  datasetIndex: l
2417
2419
  }, r),
2418
2420
  parent: $.parent || null,
@@ -2423,32 +2425,32 @@ const Ke = {
2423
2425
  seq: 0,
2424
2426
  // 稍後計算
2425
2427
  children: [],
2426
- series: d,
2427
- seriesIndex: x,
2428
- category: S,
2429
- categoryIndex: T
2428
+ series: C,
2429
+ seriesIndex: g,
2430
+ category: x,
2431
+ categoryIndex: _
2430
2432
  };
2431
- C.set(c, M);
2433
+ T.set(c, k);
2432
2434
  }
2433
2435
  });
2434
- const O = Array.from(C.values()), y = /* @__PURE__ */ new Map();
2436
+ const O = Array.from(T.values()), h = /* @__PURE__ */ new Map();
2435
2437
  O.forEach((c) => {
2436
- y.set(c.id, c.index);
2438
+ h.set(c.id, c.index);
2437
2439
  }), O.forEach((c) => {
2438
- c.parent && y.has(c.parent) && (c.parentIndex = y.get(c.parent));
2440
+ c.parent && h.has(c.parent) && (c.parentIndex = h.get(c.parent));
2439
2441
  });
2440
- const g = [], E = /* @__PURE__ */ new Map();
2442
+ const p = [], E = /* @__PURE__ */ new Map();
2441
2443
  O.forEach((c) => {
2442
- c.parent === null ? g.push(c) : (E.has(c.parent) || E.set(c.parent, []), E.get(c.parent).push(c));
2444
+ c.parent === null ? p.push(c) : (E.has(c.parent) || E.set(c.parent, []), E.get(c.parent).push(c));
2443
2445
  });
2444
- function B(c, v) {
2446
+ function P(c, v) {
2445
2447
  c.depth = v;
2446
2448
  const $ = E.get(c.id) || [];
2447
- return e.value.sort === "asc" ? $.sort((d, x) => d.value === null && x.value === null ? 0 : d.value === null ? 1 : x.value === null ? -1 : d.value - x.value) : e.value.sort === "desc" && $.sort((d, x) => d.value === null && x.value === null ? 0 : d.value === null ? 1 : x.value === null ? -1 : x.value - d.value), $.forEach((d, x) => {
2448
- d.seq = x;
2449
- }), c.children = $.map((d) => B(d, v + 1)), c;
2449
+ return e.value.sort === "asc" ? $.sort((C, g) => C.value === null && g.value === null ? 0 : C.value === null ? 1 : g.value === null ? -1 : C.value - g.value) : e.value.sort === "desc" && $.sort((C, g) => C.value === null && g.value === null ? 0 : C.value === null ? 1 : g.value === null ? -1 : g.value - C.value), $.forEach((C, g) => {
2450
+ C.seq = g;
2451
+ }), c.children = $.map((C) => P(C, v + 1)), c;
2450
2452
  }
2451
- const I = g.map((c) => B(c, 0));
2453
+ const I = p.map((c) => P(c, 0));
2452
2454
  if (I.length === 0)
2453
2455
  u.push({
2454
2456
  id: `empty-${a}`,
@@ -2459,7 +2461,7 @@ const Ke = {
2459
2461
  value: null,
2460
2462
  color: F(e.color.from, {
2461
2463
  index: m - 1,
2462
- seriesIndex: w < 0 ? 0 : w,
2464
+ seriesIndex: b < 0 ? 0 : b,
2463
2465
  categoryIndex: 0,
2464
2466
  datasetIndex: l
2465
2467
  }, r),
@@ -2468,8 +2470,8 @@ const Ke = {
2468
2470
  depth: 0,
2469
2471
  seq: 0,
2470
2472
  children: [],
2471
- series: h,
2472
- seriesIndex: w < 0 ? 0 : w,
2473
+ series: d,
2474
+ seriesIndex: b < 0 ? 0 : b,
2473
2475
  category: "default",
2474
2476
  categoryIndex: 0
2475
2477
  });
@@ -2485,7 +2487,7 @@ const Ke = {
2485
2487
  value: null,
2486
2488
  color: F(e.color.from, {
2487
2489
  index: m - 1,
2488
- seriesIndex: w < 0 ? 0 : w,
2490
+ seriesIndex: b < 0 ? 0 : b,
2489
2491
  categoryIndex: 0,
2490
2492
  datasetIndex: l
2491
2493
  }, r),
@@ -2494,11 +2496,11 @@ const Ke = {
2494
2496
  depth: 0,
2495
2497
  seq: 0,
2496
2498
  children: I.map((v, $) => {
2497
- const d = (x, S) => (x.depth = S, S === 1 && (x.seq = $), x.children = x.children.map((T) => d(T, S + 1)), x);
2498
- return d(v, 1);
2499
+ const C = (g, x) => (g.depth = x, x === 1 && (g.seq = $), g.children = g.children.map((_) => C(_, x + 1)), g);
2500
+ return C(v, 1);
2499
2501
  }),
2500
- series: h,
2501
- seriesIndex: w < 0 ? 0 : w,
2502
+ series: d,
2503
+ seriesIndex: b < 0 ? 0 : b,
2502
2504
  category: "default",
2503
2505
  categoryIndex: 0
2504
2506
  };
@@ -2737,7 +2739,7 @@ function dt(t) {
2737
2739
  data: {
2738
2740
  toBe: "RawDataColumn[] | RawDataColumn[][]",
2739
2741
  // 畢免資料量過大檢查不完,不深度檢查
2740
- test: (r) => Array.isArray(r) && r.every((n) => Array.isArray(n) || Q(n))
2742
+ test: (r) => Array.isArray(r) && r.every((n) => Array.isArray(n) || X(n))
2741
2743
  }
2742
2744
  });
2743
2745
  }
@@ -2745,7 +2747,7 @@ function $e(t) {
2745
2747
  return V({ plugins: t }, {
2746
2748
  plugins: {
2747
2749
  toBe: "PluginEntity[]",
2748
- test: (r) => Array.isArray(r) && r.every((n) => Q(n) && typeof n._name == "string" && typeof n._injectContext == "function")
2750
+ test: (r) => Array.isArray(r) && r.every((n) => X(n) && typeof n._name == "string" && typeof n._injectContext == "function")
2749
2751
  }
2750
2752
  });
2751
2753
  }
@@ -2769,7 +2771,7 @@ function qr(t) {
2769
2771
  },
2770
2772
  plugins: {
2771
2773
  toBe: "PluginEntity[]",
2772
- test: (r) => Array.isArray(r) && r.every((n) => Q(n) && typeof n._name == "string" && typeof n._injectContext == "function")
2774
+ test: (r) => Array.isArray(r) && r.every((n) => X(n) && typeof n._name == "string" && typeof n._injectContext == "function")
2773
2775
  }
2774
2776
  });
2775
2777
  if (e.status === "error")
@@ -2804,387 +2806,391 @@ function qr(t) {
2804
2806
  function Gr({ svgElement$: t, canvasElement$: e, pluginsInstance$: r }) {
2805
2807
  let n = [], o = [];
2806
2808
  const s = (l, i, f) => {
2807
- const b = r.getValue().reduce((A, m, h) => (A[m._getId()] = h, A), {}), _ = f.map((A) => ({
2809
+ const w = r.getValue().reduce((A, m, d) => (A[m._getId()] = d, A), {}), S = f.map((A) => ({
2808
2810
  ...A,
2809
- pluginSeq: b[A.pluginId]
2811
+ pluginSeq: w[A.pluginId]
2810
2812
  }));
2811
2813
  return (l === "svg" ? n : o).filter((A) => A.pluginId !== i).map((A) => ({
2812
2814
  ...A,
2813
- pluginSeq: b[A.pluginId]
2814
- })).concat(_).sort((A, m) => A.layerIndex - m.layerIndex || A.pluginSeq - m.pluginSeq);
2815
+ pluginSeq: w[A.pluginId]
2816
+ })).concat(S).sort((A, m) => A.layerIndex - m.layerIndex || A.pluginSeq - m.pluginSeq);
2815
2817
  }, u = {}, a = {};
2816
2818
  return (l, i, f) => {
2817
- const b = l === "svg" ? t.getValue() : e.getValue();
2818
- if (!b)
2819
+ const w = l === "svg" ? t.getValue() : e.getValue();
2820
+ if (!w)
2819
2821
  return {};
2820
- const _ = l === "svg" ? u : a, p = s(l, i, f), A = p.map((h) => Mr(h.pluginId, h.layerName));
2822
+ const S = l === "svg" ? u : a, y = s(l, i, f), A = y.map((d) => Mr(d.pluginId, d.layerName));
2821
2823
  return l === "svg" ? (Ne(
2822
- b,
2824
+ w,
2823
2825
  A,
2824
- _,
2825
- (h) => Br(h)
2826
- ), n = p) : (Ne(
2827
- b,
2826
+ S,
2827
+ (d) => Br(d)
2828
+ ), n = y) : (Ne(
2829
+ w,
2828
2830
  A,
2829
- _,
2830
- (h) => ft(h)
2831
- ), o = p), Object.entries(_).reduce((h, [w, C]) => {
2832
- const [O, y, g] = w.split("-");
2833
- return y === i && (h[g] = C), h;
2831
+ S,
2832
+ (d) => ft(d)
2833
+ ), o = y), Object.entries(S).reduce((d, [b, T]) => {
2834
+ const [O, h, p] = b.split("-");
2835
+ return h === i && (d[p] = T), d;
2834
2836
  }, {});
2835
2837
  };
2836
2838
  }
2837
2839
  const Wr = (t, e) => {
2838
2840
  try {
2839
- const { status: h, columnName: w, expectToBe: C } = qr(e);
2840
- if (h === "error")
2841
- throw new Error(J({
2842
- columnName: w,
2843
- expectToBe: C,
2841
+ const { status: b, columnName: T, expectToBe: O } = qr(e);
2842
+ if (b === "error")
2843
+ throw new Error(H({
2844
+ columnName: T,
2845
+ expectToBe: O,
2844
2846
  from: "Chart.constructor"
2845
2847
  }));
2846
- if (h === "warning")
2847
- console.warn(H({
2848
- columnName: w,
2849
- expectToBe: C,
2848
+ if (b === "warning")
2849
+ console.warn(Q({
2850
+ columnName: T,
2851
+ expectToBe: O,
2850
2852
  from: "Chart.constructor"
2851
2853
  }));
2852
2854
  else {
2853
- const { status: O, columnName: y, expectToBe: g } = Ur(t);
2854
- if (O === "error")
2855
- throw new Error(J({
2856
- columnName: y,
2857
- expectToBe: g,
2855
+ const { status: h, columnName: p, expectToBe: E } = Ur(t);
2856
+ if (h === "error")
2857
+ throw new Error(H({
2858
+ columnName: p,
2859
+ expectToBe: E,
2858
2860
  from: "Chart.constructor"
2859
2861
  }));
2860
- O === "warning" && console.warn(H({
2861
- columnName: y,
2862
- expectToBe: g,
2862
+ h === "warning" && console.warn(Q({
2863
+ columnName: p,
2864
+ expectToBe: E,
2863
2865
  from: "Chart.constructor"
2864
2866
  }));
2865
2867
  }
2866
- } catch (h) {
2867
- throw new Error(h);
2868
+ } catch (b) {
2869
+ throw new Error(b);
2868
2870
  }
2869
- const r = new oe(), n = new D((e == null ? void 0 : e.data) || []), o = e && e.encoding ? W(Fe, e.encoding) : Fe, s = new D(o), u = e && e.theme ? W(De, e.theme) : De, a = new D(u), l = new D((e == null ? void 0 : e.plugins) || []), i = e && e.size ? W(Ke, e.size) : Ke, f = new D(i), b = new D(null), _ = new D(null), p = (() => {
2870
- const h = f.pipe(
2871
- br((d) => fr(
2872
- () => d.width === "auto" || d.height === "auto",
2871
+ const r = new oe(), n = new D((e == null ? void 0 : e.data) || []), o = e && e.encoding ? W(Fe, e.encoding) : Fe, s = new D(o), u = e && e.theme ? W(De, e.theme) : De, a = new D(u), l = new D((e == null ? void 0 : e.plugins) || []), i = e && e.size ? W(Ke, e.size) : Ke, f = new D(i), w = new D(null), S = new D(null), y = (() => {
2872
+ const b = f.pipe(
2873
+ br((g) => fr(
2874
+ () => g.width === "auto" || g.height === "auto",
2873
2875
  // 有 'auto' 的話就監聽element的尺寸
2874
2876
  jr(t).pipe(
2875
2877
  q((x) => ({
2876
- width: d.width === "auto" ? x.width : d.width,
2877
- height: d.height === "auto" ? x.height <= 0 ? x.width : x.height : d.height
2878
+ width: g.width === "auto" ? x.width : g.width,
2879
+ height: g.height === "auto" ? x.height <= 0 ? x.width : x.height : g.height
2878
2880
  })),
2879
- G(d.resizeDebounce),
2880
- pr((x, S) => JSON.stringify(x) === JSON.stringify(S))
2881
+ G(g.resizeDebounce),
2882
+ pr((x, _) => JSON.stringify(x) === JSON.stringify(_))
2881
2883
  ),
2882
2884
  Qt({
2883
- width: d.width,
2884
- height: d.height
2885
+ width: g.width,
2886
+ height: g.height
2885
2887
  })
2886
2888
  )),
2887
2889
  wr(r),
2888
- te(1)
2889
- ), w = s.asObservable().pipe(
2890
- te(1)
2891
- ), C = Z([
2890
+ re(1)
2891
+ ), T = s.asObservable().pipe(
2892
+ re(1)
2893
+ ), O = J([
2892
2894
  n,
2893
2895
  s,
2894
2896
  a
2895
2897
  ]).pipe(
2896
2898
  G(0),
2897
- q(([d, x, S]) => {
2899
+ q(([g, x, _]) => {
2898
2900
  try {
2899
- return Vr(d, x, S);
2900
- } catch (T) {
2901
+ return Vr(g, x, _);
2902
+ } catch (B) {
2901
2903
  throw new Error(fe({
2902
2904
  from: "Chart.seriesData$",
2903
- systemMessage: T
2905
+ systemMessage: B
2904
2906
  }));
2905
2907
  }
2906
2908
  }),
2907
- ae((d) => (console.error(z(d)), se)),
2908
- te(1)
2909
- ), O = Z([
2909
+ ae((g) => (console.error(z(g)), se)),
2910
+ re(1)
2911
+ ), h = J([
2910
2912
  n,
2911
2913
  s,
2912
2914
  a
2913
2915
  ]).pipe(
2914
2916
  G(0),
2915
- q(([d, x, S]) => {
2917
+ q(([g, x, _]) => {
2916
2918
  try {
2917
- return Rr(d, x, S);
2918
- } catch (T) {
2919
+ return Rr(g, x, _);
2920
+ } catch (B) {
2919
2921
  throw new Error(fe({
2920
2922
  from: "Chart.gridData$",
2921
- systemMessage: T
2923
+ systemMessage: B
2922
2924
  }));
2923
2925
  }
2924
2926
  }),
2925
- ae((d) => (console.error(z(d)), se)),
2926
- te(1)
2927
- ), y = Z([
2927
+ ae((g) => (console.error(z(g)), se)),
2928
+ re(1)
2929
+ ), p = J([
2928
2930
  n,
2929
2931
  s,
2930
2932
  a
2931
2933
  ]).pipe(
2932
2934
  G(0),
2933
- q(([d, x, S]) => {
2935
+ q(([g, x, _]) => {
2934
2936
  try {
2935
- return Kr(d, x, S);
2936
- } catch (T) {
2937
+ return Kr(g, x, _);
2938
+ } catch (B) {
2937
2939
  throw new Error(fe({
2938
2940
  from: "Chart.multivariateData$",
2939
- systemMessage: T
2941
+ systemMessage: B
2940
2942
  }));
2941
2943
  }
2942
2944
  }),
2943
- ae((d) => (console.error(z(d)), se)),
2944
- te(1)
2945
- ), g = Z([
2945
+ ae((g) => (console.error(z(g)), se)),
2946
+ re(1)
2947
+ ), E = J([
2946
2948
  n,
2947
2949
  s,
2948
2950
  a
2949
2951
  ]).pipe(
2950
2952
  G(0),
2951
- q(([d, x, S]) => {
2953
+ q(([g, x, _]) => {
2952
2954
  try {
2953
- return Fr(d, x, S);
2954
- } catch (T) {
2955
+ return Fr(g, x, _);
2956
+ } catch (B) {
2955
2957
  throw new Error(fe({
2956
2958
  from: "Chart.graphData$",
2957
- systemMessage: T
2959
+ systemMessage: B
2958
2960
  }));
2959
2961
  }
2960
2962
  }),
2961
- ae((d) => (console.error(z(d)), se)),
2962
- te(1)
2963
- ), E = Z([
2963
+ ae((g) => (console.error(z(g)), se)),
2964
+ re(1)
2965
+ ), P = J([
2964
2966
  n,
2965
2967
  s,
2966
2968
  a
2967
2969
  ]).pipe(
2968
2970
  G(0),
2969
- q(([d, x, S]) => {
2971
+ q(([g, x, _]) => {
2970
2972
  try {
2971
- return Dr(d, x, S);
2972
- } catch (T) {
2973
+ return Dr(g, x, _);
2974
+ } catch (B) {
2973
2975
  throw new Error(fe({
2974
2976
  from: "Chart.treeData$",
2975
- systemMessage: T
2977
+ systemMessage: B
2976
2978
  }));
2977
2979
  }
2978
2980
  }),
2979
- ae((d) => (console.error(z(d)), se)),
2980
- te(1)
2981
- ), B = new D([]);
2982
- l.subscribe((d) => {
2983
- const x = {}, S = d.map((P) => {
2981
+ ae((g) => (console.error(z(g)), se)),
2982
+ re(1)
2983
+ ), I = new D([]);
2984
+ l.subscribe((g) => {
2985
+ const x = {}, _ = g.map((j) => {
2984
2986
  var M;
2985
- let j = P._getId();
2986
- if (x[j]) {
2987
- const k = ((M = x[j].split("[")[1]) == null ? void 0 : M.split("]")[0]) || "0", K = parseInt(k) + 1;
2988
- j = `${j.split("[")[0]}[${K}]`;
2987
+ let k = j._getId();
2988
+ if (x[k]) {
2989
+ const K = ((M = x[k].split("[")[1]) == null ? void 0 : M.split("]")[0]) || "0", Z = parseInt(K) + 1;
2990
+ k = `${k.split("[")[0]}[${Z}]`;
2989
2991
  }
2990
- return x[j] = P._getId(), j;
2992
+ return x[k] = j._getId(), k;
2991
2993
  });
2992
- d.forEach((P, j) => P._setId(S[j]));
2993
- const T = d.map((P) => ({
2994
- id: P._getId(),
2995
- name: P._name,
2996
- elementType: P._elementType,
2997
- shownLayers: P.getShownLayerNames()
2994
+ g.forEach((j, k) => j._setId(_[k]));
2995
+ const B = g.map((j) => ({
2996
+ id: j._getId(),
2997
+ name: j._name,
2998
+ elementType: j._elementType,
2999
+ shownLayers: j.getShownLayerNames()
2998
3000
  }));
2999
- B.next(T);
3001
+ I.next(B);
3000
3002
  });
3001
- const I = a.asObservable().pipe(
3002
- te(1)
3003
- ), c = new oe(), v = c.asObservable().pipe(
3003
+ const c = a.asObservable().pipe(
3004
+ re(1)
3005
+ ), v = new oe(), $ = v.asObservable().pipe(
3004
3006
  lt()
3005
3007
  );
3006
3008
  return {
3007
3009
  root: t,
3008
3010
  svg: null,
3009
3011
  canvas: null,
3010
- size$: h,
3011
- encoding$: w,
3012
- seriesData$: C,
3013
- gridData$: O,
3014
- multivariateData$: y,
3015
- graphData$: g,
3016
- treeData$: E,
3017
- plugins$: B,
3018
- theme$: I,
3019
- event$: v,
3020
- eventTrigger$: c,
3012
+ size$: b,
3013
+ encoding$: T,
3014
+ seriesData$: O,
3015
+ gridData$: h,
3016
+ multivariateData$: p,
3017
+ graphData$: E,
3018
+ treeData$: P,
3019
+ plugins$: I,
3020
+ theme$: c,
3021
+ event$: $,
3022
+ eventTrigger$: v,
3021
3023
  _updateLayerElements: Gr({
3022
- svgElement$: b,
3023
- canvasElement$: _,
3024
+ svgElement$: w,
3025
+ canvasElement$: S,
3024
3026
  pluginsInstance$: l
3025
3027
  })
3026
3028
  };
3027
3029
  })();
3028
3030
  let A = null;
3029
3031
  const m = () => (A || (A = document.createElement("div"), A.classList.add("orbcharts-container"), A.style.position = "relative", t.appendChild(A)), A);
3030
- return l.subscribe((h) => {
3031
- let w = !1, C = !1;
3032
- h.forEach((O) => {
3033
- O._elementType === "svg" ? w = !0 : O._elementType === "canvas" && (C = !0);
3034
- }), w && !p.svg ? (p.svg = Cr("orbcharts-root-svg"), m().appendChild(p.svg), b.next(p.svg)) : !w && p.svg && (p.svg.remove(), p.svg = null, b.next(null)), C && !p.canvas ? (p.canvas = ft("orbcharts-root-canvas"), m().appendChild(p.canvas), _.next(p.canvas)) : !C && p.canvas && (p.canvas.remove(), p.canvas = null, _.next(null)), h.forEach((O) => {
3035
- O._injectContext(p);
3032
+ let d = [];
3033
+ return l.subscribe((b) => {
3034
+ d.filter((p) => !b.includes(p)).forEach((p) => {
3035
+ y._updateLayerElements(p._elementType, p._getId(), []), p.destroy();
3036
+ }), d = b;
3037
+ let O = !1, h = !1;
3038
+ b.forEach((p) => {
3039
+ p._elementType === "svg" ? O = !0 : p._elementType === "canvas" && (h = !0);
3040
+ }), O && !y.svg ? (y.svg = Cr("orbcharts-root-svg"), m().appendChild(y.svg), w.next(y.svg)) : !O && y.svg && (y.svg.remove(), y.svg = null, w.next(null)), h && !y.canvas ? (y.canvas = ft("orbcharts-root-canvas"), m().appendChild(y.canvas), S.next(y.canvas)) : !h && y.canvas && (y.canvas.remove(), y.canvas = null, S.next(null)), b.forEach((p) => {
3041
+ p._injectContext(y);
3036
3042
  });
3037
- }), Z({
3038
- size: p.size$,
3039
- svg: b
3043
+ }), J({
3044
+ size: y.size$,
3045
+ svg: w
3040
3046
  }).pipe(
3041
3047
  G(0),
3042
- ye(({ svg: h }) => !!h)
3043
- ).subscribe(({ size: h, svg: w }) => {
3044
- w && (w.setAttribute("width", h.width.toString()), w.setAttribute("height", h.height.toString()));
3045
- }), Z({
3046
- size: p.size$,
3047
- canvas: _
3048
+ ye(({ svg: b }) => !!b)
3049
+ ).subscribe(({ size: b, svg: T }) => {
3050
+ T && (T.setAttribute("width", b.width.toString()), T.setAttribute("height", b.height.toString()));
3051
+ }), J({
3052
+ size: y.size$,
3053
+ canvas: S
3048
3054
  }).pipe(
3049
3055
  G(0),
3050
- ye(({ canvas: h }) => !!h)
3051
- ).subscribe(({ size: h, canvas: w }) => {
3052
- w && (w.width = h.width, w.height = h.height);
3056
+ ye(({ canvas: b }) => !!b)
3057
+ ).subscribe(({ size: b, canvas: T }) => {
3058
+ T && (T.width = b.width, T.height = b.height);
3053
3059
  }), /* @__PURE__ */ (() => {
3054
- function h(d) {
3055
- f.next(d);
3060
+ function b(g) {
3061
+ f.next(g);
3056
3062
  }
3057
- function w(d) {
3063
+ function T(g) {
3058
3064
  try {
3059
- const { status: x, columnName: S, expectToBe: T } = dt(d);
3065
+ const { status: x, columnName: _, expectToBe: B } = dt(g);
3060
3066
  if (x === "error")
3061
- throw new Error(J({
3062
- columnName: S,
3063
- expectToBe: T,
3067
+ throw new Error(H({
3068
+ columnName: _,
3069
+ expectToBe: B,
3064
3070
  from: "Chart.setData"
3065
3071
  }));
3066
- x === "warning" && console.warn(H({
3067
- columnName: S,
3068
- expectToBe: T,
3072
+ x === "warning" && console.warn(Q({
3073
+ columnName: _,
3074
+ expectToBe: B,
3069
3075
  from: "Chart.setData"
3070
3076
  }));
3071
3077
  } catch (x) {
3072
3078
  console.error(z(x));
3073
3079
  }
3074
- n.next(d);
3080
+ n.next(g);
3075
3081
  }
3076
- function C(d) {
3082
+ function O(g) {
3077
3083
  try {
3078
- const { status: S, columnName: T, expectToBe: P } = pt(d);
3079
- if (S === "error")
3080
- throw new Error(J({
3081
- columnName: T,
3082
- expectToBe: P,
3084
+ const { status: _, columnName: B, expectToBe: j } = pt(g);
3085
+ if (_ === "error")
3086
+ throw new Error(H({
3087
+ columnName: B,
3088
+ expectToBe: j,
3083
3089
  from: "Chart.updateEncoding"
3084
3090
  }));
3085
- S === "warning" && console.warn(H({
3086
- columnName: T,
3087
- expectToBe: P,
3091
+ _ === "warning" && console.warn(Q({
3092
+ columnName: B,
3093
+ expectToBe: j,
3088
3094
  from: "Chart.updateEncoding"
3089
3095
  }));
3090
- } catch (S) {
3091
- console.error(z(S));
3096
+ } catch (_) {
3097
+ console.error(z(_));
3092
3098
  }
3093
- const x = W(s.getValue(), d);
3099
+ const x = W(s.getValue(), g);
3094
3100
  s.next(x);
3095
3101
  }
3096
- function O(d) {
3097
- s.next(d);
3102
+ function h(g) {
3103
+ s.next(g);
3098
3104
  }
3099
- function y() {
3105
+ function p() {
3100
3106
  return s.getValue();
3101
3107
  }
3102
- function g(d) {
3108
+ function E(g) {
3103
3109
  try {
3104
- const { status: x, columnName: S, expectToBe: T } = $e(d);
3110
+ const { status: x, columnName: _, expectToBe: B } = $e(g);
3105
3111
  if (x === "error")
3106
- throw new Error(J({
3107
- columnName: S,
3108
- expectToBe: T,
3112
+ throw new Error(H({
3113
+ columnName: _,
3114
+ expectToBe: B,
3109
3115
  from: "Chart.setPlugins"
3110
3116
  }));
3111
- x === "warning" && console.warn(H({
3112
- columnName: S,
3113
- expectToBe: T,
3117
+ x === "warning" && console.warn(Q({
3118
+ columnName: _,
3119
+ expectToBe: B,
3114
3120
  from: "Chart.setPlugins"
3115
3121
  }));
3116
3122
  } catch (x) {
3117
3123
  console.error(z(x));
3118
3124
  }
3119
- l.next(d);
3125
+ l.next(g);
3120
3126
  }
3121
- function E(d) {
3127
+ function P(g) {
3122
3128
  try {
3123
- const { status: x, columnName: S, expectToBe: T } = $e([d]);
3129
+ const { status: x, columnName: _, expectToBe: B } = $e([g]);
3124
3130
  if (x === "error")
3125
- throw new Error(J({
3126
- columnName: S,
3127
- expectToBe: T,
3131
+ throw new Error(H({
3132
+ columnName: _,
3133
+ expectToBe: B,
3128
3134
  from: "Chart.addPlugin"
3129
3135
  }));
3130
- x === "warning" && console.warn(H({
3131
- columnName: S,
3132
- expectToBe: T,
3136
+ x === "warning" && console.warn(Q({
3137
+ columnName: _,
3138
+ expectToBe: B,
3133
3139
  from: "Chart.addPlugin"
3134
3140
  }));
3135
3141
  } catch (x) {
3136
3142
  console.error(z(x));
3137
3143
  }
3138
- l.next([...l.getValue(), d]);
3144
+ l.next([...l.getValue(), g]);
3139
3145
  }
3140
- function B(d) {
3141
- l.next(l.getValue().filter((x) => x._getId() !== d));
3146
+ function I(g) {
3147
+ l.next(l.getValue().filter((x) => x._getId() !== g));
3142
3148
  }
3143
- function I(d) {
3149
+ function c(g) {
3144
3150
  try {
3145
- const { status: S, columnName: T, expectToBe: P } = yt(d);
3146
- if (S === "error")
3147
- throw new Error(J({
3148
- columnName: T,
3149
- expectToBe: P,
3151
+ const { status: _, columnName: B, expectToBe: j } = yt(g);
3152
+ if (_ === "error")
3153
+ throw new Error(H({
3154
+ columnName: B,
3155
+ expectToBe: j,
3150
3156
  from: "Chart.updateTheme"
3151
3157
  }));
3152
- S === "warning" && console.warn(H({
3153
- columnName: T,
3154
- expectToBe: P,
3158
+ _ === "warning" && console.warn(Q({
3159
+ columnName: B,
3160
+ expectToBe: j,
3155
3161
  from: "Chart.updateTheme"
3156
3162
  }));
3157
- } catch (S) {
3158
- console.error(z(S));
3163
+ } catch (_) {
3164
+ console.error(z(_));
3159
3165
  }
3160
- const x = W(a.getValue(), d);
3166
+ const x = W(a.getValue(), g);
3161
3167
  a.next(x);
3162
3168
  }
3163
- function c(d) {
3164
- a.next(d);
3169
+ function v(g) {
3170
+ a.next(g);
3165
3171
  }
3166
- function v() {
3172
+ function $() {
3167
3173
  return a.getValue();
3168
3174
  }
3169
- function $() {
3175
+ function C() {
3170
3176
  r.next(void 0), Pr(t), A = null;
3171
3177
  }
3172
3178
  return {
3173
- resize: h,
3174
- setData: w,
3179
+ resize: b,
3180
+ setData: T,
3175
3181
  // setEncoding,
3176
- updateEncoding: C,
3177
- forceReplaceEncoding: O,
3178
- getEncoding: y,
3179
- setPlugins: g,
3180
- addPlugin: E,
3181
- removePlugin: B,
3182
+ updateEncoding: O,
3183
+ forceReplaceEncoding: h,
3184
+ getEncoding: p,
3185
+ setPlugins: E,
3186
+ addPlugin: P,
3187
+ removePlugin: I,
3182
3188
  // setTheme,
3183
- updateTheme: I,
3184
- forceReplaceTheme: c,
3185
- getTheme: v,
3186
- destroy: $,
3187
- context: p
3189
+ updateTheme: c,
3190
+ forceReplaceTheme: v,
3191
+ getTheme: $,
3192
+ destroy: C,
3193
+ context: y
3188
3194
  };
3189
3195
  })();
3190
3196
  };
@@ -3197,72 +3203,72 @@ const mt = (t, e, r) => {
3197
3203
  let n = e.name, o = () => {
3198
3204
  };
3199
3205
  const s = new D(null), u = s.pipe(
3200
- ye((y) => y !== null)
3201
- ), a = e.layers.map((y) => new y()), l = {
3206
+ ye((h) => h !== null)
3207
+ ), a = e.layers.map((h) => new h()), l = {
3202
3208
  // 將陣列轉成字典
3203
- ...a.reduce((y, g) => (y[g._name] = g, y), {})
3204
- }, i = () => new Set(a.map((y) => y._name)), f = (y) => {
3205
- if (y) {
3206
- const g = i();
3207
- return Object.keys(y).filter((B) => g.has(B));
3209
+ ...a.reduce((h, p) => (h[p._name] = p, h), {})
3210
+ }, i = () => new Set(a.map((h) => h._name)), f = (h) => {
3211
+ if (h) {
3212
+ const p = i();
3213
+ return Object.keys(h).filter((P) => p.has(P));
3208
3214
  }
3209
3215
  return [];
3210
- }, b = a.reduce((y, g) => (g._initShow && y.push(g._name), y), []), _ = f(r), p = new D(
3211
- new Set(_.length > 0 ? _ : b)
3212
- ), A = p.pipe(
3213
- q((y) => Array.from(y).map((E) => {
3214
- var B;
3216
+ }, w = a.reduce((h, p) => (p._initShow && h.push(p._name), h), []), S = f(r), y = new D(
3217
+ new Set(S.length > 0 ? S : w)
3218
+ ), A = y.pipe(
3219
+ q((h) => Array.from(h).map((E) => {
3220
+ var P;
3215
3221
  return [
3216
3222
  E,
3217
- ((B = a.find((I) => I._name === E)) == null ? void 0 : B._layerIndex) ?? -1
3223
+ ((P = a.find((I) => I._name === E)) == null ? void 0 : P._layerIndex) ?? -1
3218
3224
  ];
3219
- }).filter(([, E]) => E !== -1).sort((E, B) => E[1] - B[1]).map(([E]) => E))
3225
+ }).filter(([, E]) => E !== -1).sort((E, P) => E[1] - P[1]).map(([E]) => E))
3220
3226
  );
3221
3227
  let m = W(
3222
3228
  e.defaultParams ?? {},
3223
3229
  r ?? {}
3224
3230
  );
3225
- const h = new D(
3231
+ const d = new D(
3226
3232
  r ?? {}
3227
- ), w = new oe(), C = new R((y) => {
3228
- h.subscribe((g) => {
3233
+ ), b = new oe(), T = new R((h) => {
3234
+ d.subscribe((p) => {
3229
3235
  try {
3230
- const { status: E, columnName: B, expectToBe: I } = e.validator(g);
3236
+ const { status: E, columnName: P, expectToBe: I } = e.validator(p);
3231
3237
  if (E === "error")
3232
- throw new Error(J({
3233
- columnName: B,
3238
+ throw new Error(H({
3239
+ columnName: P,
3234
3240
  expectToBe: I,
3235
3241
  from: `${e.name}.params$`
3236
3242
  }));
3237
- E === "warning" && console.warn(H({
3238
- columnName: B,
3243
+ E === "warning" && console.warn(Q({
3244
+ columnName: P,
3239
3245
  expectToBe: I,
3240
3246
  from: `${e.name}.params$`
3241
3247
  }));
3242
3248
  } catch (E) {
3243
3249
  console.error(z(E));
3244
3250
  }
3245
- y.next(m);
3246
- }), w.subscribe((g) => {
3247
- y.next(g);
3251
+ h.next(m);
3252
+ }), b.subscribe((p) => {
3253
+ h.next(p);
3248
3254
  });
3249
3255
  }), O = u.pipe(
3250
- q((y) => ({
3251
- context: y,
3256
+ q((h) => ({
3257
+ context: h,
3252
3258
  // 初始化時 context 有可能被 in place 擴展
3253
- pluginParams$: C
3259
+ pluginParams$: T
3254
3260
  })),
3255
3261
  gr()
3256
3262
  // 只做初始化
3257
3263
  );
3258
- return Z({
3264
+ return J({
3259
3265
  pluginSetupProps: O,
3260
- ShownLayerNameSet: p,
3266
+ ShownLayerNameSet: y,
3261
3267
  shownLayerNamesSeq: A
3262
3268
  }).pipe(
3263
3269
  G(0)
3264
- ).subscribe(({ pluginSetupProps: y, ShownLayerNameSet: g, shownLayerNamesSeq: E }) => {
3265
- const B = y.context._updateLayerElements(
3270
+ ).subscribe(({ pluginSetupProps: h, ShownLayerNameSet: p, shownLayerNamesSeq: E }) => {
3271
+ const P = h.context._updateLayerElements(
3266
3272
  t,
3267
3273
  n,
3268
3274
  E.map((I) => ({
@@ -3272,25 +3278,25 @@ const mt = (t, e, r) => {
3272
3278
  layerIndex: l[I]._layerIndex
3273
3279
  }))
3274
3280
  );
3275
- e.setup && (o = e.setup(y)), a.forEach((I) => {
3281
+ e.setup && (o = e.setup(h)), a.forEach((I) => {
3276
3282
  var c, v;
3277
- if (g.has(I._name)) {
3283
+ if (p.has(I._name)) {
3278
3284
  const $ = t === "svg" ? {
3279
3285
  // svgG: (pluginSetupProps as PluginSetupProps<'svg', ExtendContext, PluginParams>).svgG.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
3280
- svgG: B[I._name],
3286
+ svgG: P[I._name],
3281
3287
  // canvas: context.root.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
3282
3288
  // context: Object.assign({}, context) as ChartContext<ExtendContext>,
3283
- context: y.context,
3284
- pluginParams$: C,
3285
- initLayerParams: ((c = h.getValue()) == null ? void 0 : c[I._name]) || {}
3289
+ context: h.context,
3290
+ pluginParams$: T,
3291
+ initLayerParams: ((c = d.getValue()) == null ? void 0 : c[I._name]) || {}
3286
3292
  } : {
3287
3293
  // svgG: context.root.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
3288
3294
  // canvas: (pluginSetupProps as PluginSetupProps<'canvas', ExtendContext, PluginParams>).canvas.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
3289
- canvas: B[I._name],
3295
+ canvas: P[I._name],
3290
3296
  // context: Object.assign({}, context) as ChartContext<ExtendContext>,
3291
- context: y.context,
3292
- pluginParams$: C,
3293
- initLayerParams: ((v = h.getValue()) == null ? void 0 : v[I._name]) || {}
3297
+ context: h.context,
3298
+ pluginParams$: T,
3299
+ initLayerParams: ((v = d.getValue()) == null ? void 0 : v[I._name]) || {}
3294
3300
  };
3295
3301
  I._enable($);
3296
3302
  } else
@@ -3308,55 +3314,55 @@ const mt = (t, e, r) => {
3308
3314
  // contextExtension,
3309
3315
  // layer visibility controls
3310
3316
  _getId: () => n,
3311
- _setId: (y) => {
3312
- n = y;
3317
+ _setId: (h) => {
3318
+ n = h;
3313
3319
  },
3314
3320
  // 由 chart 注入 context
3315
- _injectContext: (y) => {
3316
- s.next(Object.assign({}, y));
3321
+ _injectContext: (h) => {
3322
+ s.next(Object.assign({}, h));
3317
3323
  },
3318
- show: (y) => {
3319
- y = Array.isArray(y) ? y : [y], p.next(/* @__PURE__ */ new Set([...Array.from(p.getValue()), ...y]));
3324
+ show: (h) => {
3325
+ h = Array.isArray(h) ? h : [h], y.next(/* @__PURE__ */ new Set([...Array.from(y.getValue()), ...h]));
3320
3326
  },
3321
- showOnly: (y) => {
3322
- y = Array.isArray(y) ? y : [y], p.next(/* @__PURE__ */ new Set([...y]));
3327
+ showOnly: (h) => {
3328
+ h = Array.isArray(h) ? h : [h], y.next(/* @__PURE__ */ new Set([...h]));
3323
3329
  },
3324
3330
  showAll: () => {
3325
- p.next(i());
3331
+ y.next(i());
3326
3332
  },
3327
- hide: (y) => {
3328
- y = Array.isArray(y) ? y : [y], p.next(/* @__PURE__ */ new Set([...Array.from(p.getValue()).filter((g) => !y.includes(g))]));
3333
+ hide: (h) => {
3334
+ h = Array.isArray(h) ? h : [h], y.next(/* @__PURE__ */ new Set([...Array.from(y.getValue()).filter((p) => !h.includes(p))]));
3329
3335
  },
3330
3336
  hideAll: () => {
3331
- p.next(/* @__PURE__ */ new Set());
3337
+ y.next(/* @__PURE__ */ new Set());
3332
3338
  },
3333
- toggle: (y) => {
3334
- y = Array.isArray(y) ? y : [y], Array.from(p.getValue()).forEach((g) => {
3335
- y.includes(g) ? y.splice(y.indexOf(g), 1) : y.push(g);
3336
- }), p.next(new Set(y));
3339
+ toggle: (h) => {
3340
+ h = Array.isArray(h) ? h : [h], Array.from(y.getValue()).forEach((p) => {
3341
+ h.includes(p) ? h.splice(h.indexOf(p), 1) : h.push(p);
3342
+ }), y.next(new Set(h));
3337
3343
  },
3338
- getShownLayerNames: () => Array.from(p.getValue()),
3344
+ getShownLayerNames: () => Array.from(y.getValue()),
3339
3345
  // layer params
3340
3346
  // setLayers: (partial: DeepPartial<PluginParams>) => {
3341
3347
  // params = { ...params, ...partial }
3342
3348
  // },
3343
- updateParams: (y) => {
3344
- m = W(m, y), h.next(y), Object.keys(y).forEach((g) => {
3345
- const E = l[g];
3346
- E && E._updateParams(y[g]);
3349
+ updateParams: (h) => {
3350
+ m = W(m, h), d.next(h), Object.keys(h).forEach((p) => {
3351
+ const E = l[p];
3352
+ E && E._updateParams(h[p]);
3347
3353
  });
3348
3354
  },
3349
- forceReplaceParams: (y) => {
3350
- m = y, w.next(y), Object.keys(y).forEach((g) => {
3351
- const E = l[g];
3352
- E && E._forceReplaceParams(y[g]);
3355
+ forceReplaceParams: (h) => {
3356
+ m = h, b.next(h), Object.keys(h).forEach((p) => {
3357
+ const E = l[p];
3358
+ E && E._forceReplaceParams(h[p]);
3353
3359
  });
3354
3360
  },
3355
3361
  getParams: () => {
3356
- const y = Object.assign({}, m);
3357
- return a.forEach((g) => {
3358
- y[g._name] = g._getParams();
3359
- }), y;
3362
+ const h = Object.assign({}, m);
3363
+ return a.forEach((p) => {
3364
+ h[p._name] = p._getParams();
3365
+ }), h;
3360
3366
  },
3361
3367
  // layer: <LayerName extends keyof PluginParams>(name: LayerName) => ({
3362
3368
  // // set: (partial: DeepPartial<PluginParams[LayerName]>) => {
@@ -3383,8 +3389,8 @@ const mt = (t, e, r) => {
3383
3389
  // }
3384
3390
  // }),
3385
3391
  destroy: () => {
3386
- o(), s.complete(), p.complete(), a.forEach((y) => {
3387
- y._destroy();
3392
+ o(), s.complete(), y.complete(), a.forEach((h) => {
3393
+ h._destroy();
3388
3394
  });
3389
3395
  }
3390
3396
  // // outputs
@@ -3403,7 +3409,7 @@ const mt = (t, e, r) => {
3403
3409
  const o = new D(null), s = o.pipe(
3404
3410
  ye((u) => u !== null)
3405
3411
  );
3406
- return Z({
3412
+ return J({
3407
3413
  layerParams: r,
3408
3414
  enabledProps: s
3409
3415
  }).pipe(
@@ -3448,12 +3454,12 @@ const mt = (t, e, r) => {
3448
3454
  try {
3449
3455
  const { status: l, columnName: i, expectToBe: f } = e.validator(u);
3450
3456
  if (l === "error")
3451
- throw new Error(J({
3457
+ throw new Error(H({
3452
3458
  columnName: i,
3453
3459
  expectToBe: f,
3454
3460
  from: `${e.name}.params$`
3455
3461
  }));
3456
- l === "warning" && console.warn(H({
3462
+ l === "warning" && console.warn(Q({
3457
3463
  columnName: i,
3458
3464
  expectToBe: f,
3459
3465
  from: `${e.name}.params$`
@@ -3504,8 +3510,8 @@ export {
3504
3510
  Cr as createSVG,
3505
3511
  Br as createSVGGroup,
3506
3512
  fe as createUnexpectedErrorMessage,
3507
- J as createValidatorErrorMessage,
3508
- H as createValidatorWarningMessage,
3513
+ H as createValidatorErrorMessage,
3514
+ Q as createValidatorWarningMessage,
3509
3515
  W as deepOverwrite,
3510
3516
  on as defineCanvasLayer,
3511
3517
  rn as defineCanvasPlugin,
@@ -3516,7 +3522,7 @@ export {
3516
3522
  Or as getColorByIndex,
3517
3523
  ct as isDom,
3518
3524
  Ir as isFunction,
3519
- Q as isPlainObject,
3525
+ X as isPlainObject,
3520
3526
  _r as max,
3521
3527
  xr as mean,
3522
3528
  Ar as median,