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

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 (47) hide show
  1. package/LICENSE +200 -200
  2. package/dist/orbcharts-core.es.js +876 -865
  3. package/dist/orbcharts-core.umd.js +3 -3
  4. package/dist/src/types/Plugin.d.ts +1 -1
  5. package/package.json +1 -1
  6. package/src/OrbCharts.ts +34 -34
  7. package/src/chart/createChart.ts +1013 -996
  8. package/src/chart/createGraphData.ts +391 -391
  9. package/src/chart/createGridData.ts +247 -247
  10. package/src/chart/createMultivariateData.ts +181 -181
  11. package/src/chart/createSeriesData.ts +297 -297
  12. package/src/chart/createTreeData.ts +344 -344
  13. package/src/chart/defaults.ts +119 -119
  14. package/src/defineCanvasLayer.ts +23 -23
  15. package/src/defineCanvasPlugin.ts +38 -38
  16. package/src/defineSVGLayer.ts +23 -23
  17. package/src/defineSVGPlugin.ts +38 -38
  18. package/src/index.ts +8 -8
  19. package/src/layer/createLayer.ts +137 -137
  20. package/src/plugin/createPlugin.ts +487 -469
  21. package/src/test/createGraphData.test.ts +103 -103
  22. package/src/test/createTreeData.test.ts +97 -97
  23. package/src/test/simple-graph-test.js +51 -51
  24. package/src/test/simple-tree-test.js +58 -58
  25. package/src/types/Chart.ts +62 -62
  26. package/src/types/ChartContext.ts +41 -41
  27. package/src/types/Common.ts +4 -4
  28. package/src/types/Encoding.ts +42 -42
  29. package/src/types/Event.ts +25 -25
  30. package/src/types/Layers.ts +92 -92
  31. package/src/types/ModelData.ts +94 -94
  32. package/src/types/Plugin.ts +101 -98
  33. package/src/types/RawData.ts +67 -67
  34. package/src/types/RenderData.ts +15 -15
  35. package/src/types/Theme.ts +20 -20
  36. package/src/types/Validator.ts +35 -35
  37. package/src/types/index.ts +12 -12
  38. package/src/utils/aggregateUtils.ts +99 -99
  39. package/src/utils/colorUtils.ts +63 -63
  40. package/src/utils/commonUtils.ts +56 -56
  41. package/src/utils/dom-lifecycle.ts +164 -164
  42. package/src/utils/dom.ts +54 -54
  43. package/src/utils/errorMessage.ts +40 -40
  44. package/src/utils/index.ts +7 -7
  45. package/src/utils/observables.ts +16 -16
  46. package/src/utils/orbchartsUtils.ts +8 -8
  47. package/src/utils/validator.ts +127 -127
@@ -5,7 +5,7 @@ var Se = function(t, e) {
5
5
  for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (r[o] = n[o]);
6
6
  }, Se(t, e);
7
7
  };
8
- function W(t, e) {
8
+ function Y(t, e) {
9
9
  if (typeof e != "function" && e !== null)
10
10
  throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
11
11
  Se(t, e);
@@ -21,22 +21,22 @@ function gt(t, e, r, n) {
21
21
  });
22
22
  }
23
23
  return new (r || (r = Promise))(function(s, u) {
24
- function a(h) {
24
+ function a(f) {
25
25
  try {
26
- i(n.next(h));
26
+ i(n.next(f));
27
27
  } catch (b) {
28
28
  u(b);
29
29
  }
30
30
  }
31
- function l(h) {
31
+ function l(f) {
32
32
  try {
33
- i(n.throw(h));
33
+ i(n.throw(f));
34
34
  } catch (b) {
35
35
  u(b);
36
36
  }
37
37
  }
38
- function i(h) {
39
- h.done ? s(h.value) : o(h.value).then(a, l);
38
+ function i(f) {
39
+ f.done ? s(f.value) : o(f.value).then(a, l);
40
40
  }
41
41
  i((n = n.apply(t, e || [])).next());
42
42
  });
@@ -50,8 +50,8 @@ function Ue(t, e) {
50
50
  return this;
51
51
  }), u;
52
52
  function a(i) {
53
- return function(h) {
54
- return l([i, h]);
53
+ return function(f) {
54
+ return l([i, f]);
55
55
  };
56
56
  }
57
57
  function l(i) {
@@ -92,8 +92,8 @@ function Ue(t, e) {
92
92
  continue;
93
93
  }
94
94
  i = e.call(t, r);
95
- } catch (h) {
96
- i = [6, h], o = 0;
95
+ } catch (f) {
96
+ i = [6, f], o = 0;
97
97
  } finally {
98
98
  n = s = 0;
99
99
  }
@@ -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(m) {
146
- return function(v) {
147
- return Promise.resolve(v).then(m, b);
145
+ function u(p) {
146
+ return function(A) {
147
+ return Promise.resolve(A).then(p, b);
148
148
  };
149
149
  }
150
- function a(m, v) {
151
- n[m] && (o[m] = function(y) {
152
- return new Promise(function(d, E) {
153
- s.push([m, y, d, E]) > 1 || l(m, y);
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);
154
154
  });
155
- }, v && (o[m] = v(o[m])));
155
+ }, A && (o[p] = A(o[p])));
156
156
  }
157
- function l(m, v) {
157
+ function l(p, A) {
158
158
  try {
159
- i(n[m](v));
160
- } catch (y) {
161
- w(s[0][3], y);
159
+ i(n[p](A));
160
+ } catch (m) {
161
+ _(s[0][3], m);
162
162
  }
163
163
  }
164
- function i(m) {
165
- m.value instanceof ie ? Promise.resolve(m.value.v).then(h, b) : w(s[0][2], m);
164
+ function i(p) {
165
+ p.value instanceof ie ? Promise.resolve(p.value.v).then(f, b) : _(s[0][2], p);
166
166
  }
167
- function h(m) {
168
- l("next", m);
167
+ function f(p) {
168
+ l("next", p);
169
169
  }
170
- function b(m) {
171
- l("throw", m);
170
+ function b(p) {
171
+ l("throw", p);
172
172
  }
173
- function w(m, v) {
174
- m(v), s.shift(), s.length && l(s[0][0], s[0][1]);
173
+ function _(p, A) {
174
+ p(A), s.shift(), s.length && l(s[0][0], s[0][1]);
175
175
  }
176
176
  }
177
177
  function wt(t) {
@@ -193,7 +193,7 @@ function wt(t) {
193
193
  }, u);
194
194
  }
195
195
  }
196
- function j(t) {
196
+ function L(t) {
197
197
  return typeof t == "function";
198
198
  }
199
199
  function Te(t) {
@@ -233,8 +233,8 @@ var de = function() {
233
233
  var i = l.value;
234
234
  i.remove(this);
235
235
  }
236
- } catch (y) {
237
- e = { error: y };
236
+ } catch (m) {
237
+ e = { error: m };
238
238
  } finally {
239
239
  try {
240
240
  l && !l.done && (r = a.return) && r.call(a);
@@ -244,30 +244,30 @@ var de = function() {
244
244
  }
245
245
  else
246
246
  u.remove(this);
247
- var h = this.initialTeardown;
248
- if (j(h))
247
+ var f = this.initialTeardown;
248
+ if (L(f))
249
249
  try {
250
- h();
251
- } catch (y) {
252
- s = y instanceof xe ? y.errors : [y];
250
+ f();
251
+ } catch (m) {
252
+ s = m instanceof xe ? m.errors : [m];
253
253
  }
254
254
  var b = this._finalizers;
255
255
  if (b) {
256
256
  this._finalizers = null;
257
257
  try {
258
- for (var w = ue(b), m = w.next(); !m.done; m = w.next()) {
259
- var v = m.value;
258
+ for (var _ = ue(b), p = _.next(); !p.done; p = _.next()) {
259
+ var A = p.value;
260
260
  try {
261
- ke(v);
262
- } catch (y) {
263
- s = s ?? [], y instanceof xe ? s = ce(ce([], le(s)), le(y.errors)) : s.push(y);
261
+ je(A);
262
+ } catch (m) {
263
+ s = s ?? [], m instanceof xe ? s = ce(ce([], le(s)), le(m.errors)) : s.push(m);
264
264
  }
265
265
  }
266
- } catch (y) {
267
- n = { error: y };
266
+ } catch (m) {
267
+ n = { error: m };
268
268
  } finally {
269
269
  try {
270
- m && !m.done && (o = w.return) && o.call(w);
270
+ p && !p.done && (o = _.return) && o.call(_);
271
271
  } finally {
272
272
  if (n) throw n.error;
273
273
  }
@@ -280,7 +280,7 @@ var de = function() {
280
280
  var r;
281
281
  if (e && e !== this)
282
282
  if (this.closed)
283
- ke(e);
283
+ je(e);
284
284
  else {
285
285
  if (e instanceof t) {
286
286
  if (e.closed || e._hasParent(this))
@@ -307,10 +307,10 @@ var de = function() {
307
307
  }(), t;
308
308
  }(), ze = de.EMPTY;
309
309
  function qe(t) {
310
- return t instanceof de || t && "closed" in t && j(t.remove) && j(t.add) && j(t.unsubscribe);
310
+ return t instanceof de || t && "closed" in t && L(t.remove) && L(t.add) && L(t.unsubscribe);
311
311
  }
312
- function ke(t) {
313
- j(t) ? t() : t.unsubscribe();
312
+ function je(t) {
313
+ L(t) ? t() : t.unsubscribe();
314
314
  }
315
315
  var Et = {
316
316
  Promise: void 0
@@ -336,7 +336,7 @@ function be(t) {
336
336
  t();
337
337
  }
338
338
  var Oe = function(t) {
339
- W(e, t);
339
+ Y(e, t);
340
340
  function e(r) {
341
341
  var n = t.call(this) || this;
342
342
  return n.isStopped = !1, r ? (n.destination = r, qe(r) && r.add(n)) : n.destination = _t, n;
@@ -398,10 +398,10 @@ var Oe = function(t) {
398
398
  }
399
399
  }, t;
400
400
  }(), he = function(t) {
401
- W(e, t);
401
+ Y(e, t);
402
402
  function e(r, n, o) {
403
403
  var s = t.call(this) || this, u;
404
- return j(r) || !r ? u = {
404
+ return L(r) || !r ? u = {
405
405
  next: r ?? void 0,
406
406
  error: n ?? void 0,
407
407
  complete: o ?? void 0
@@ -454,7 +454,7 @@ var R = function() {
454
454
  }
455
455
  }, t.prototype.forEach = function(e, r) {
456
456
  var n = this;
457
- return r = Me(r), new r(function(o, s) {
457
+ return r = ke(r), new r(function(o, s) {
458
458
  var u = new he({
459
459
  next: function(a) {
460
460
  try {
@@ -479,7 +479,7 @@ var R = function() {
479
479
  return $t(e)(this);
480
480
  }, t.prototype.toPromise = function(e) {
481
481
  var r = this;
482
- return e = Me(e), new e(function(n, o) {
482
+ return e = ke(e), new e(function(n, o) {
483
483
  var s;
484
484
  r.subscribe(function(u) {
485
485
  return s = u;
@@ -493,18 +493,18 @@ var R = function() {
493
493
  return new t(e);
494
494
  }, t;
495
495
  }();
496
- function Me(t) {
496
+ function ke(t) {
497
497
  var e;
498
498
  return (e = t ?? Et.Promise) !== null && e !== void 0 ? e : Promise;
499
499
  }
500
500
  function Tt(t) {
501
- return t && j(t.next) && j(t.error) && j(t.complete);
501
+ return t && L(t.next) && L(t.error) && L(t.complete);
502
502
  }
503
503
  function Ot(t) {
504
504
  return t && t instanceof Oe || Tt(t) && qe(t);
505
505
  }
506
506
  function It(t) {
507
- return j(t == null ? void 0 : t.lift);
507
+ return L(t == null ? void 0 : t.lift);
508
508
  }
509
509
  function U(t) {
510
510
  return function(e) {
@@ -523,20 +523,20 @@ function N(t, e, r, n, o) {
523
523
  return new Ct(t, e, r, n, o);
524
524
  }
525
525
  var Ct = function(t) {
526
- W(e, t);
526
+ Y(e, t);
527
527
  function e(r, n, o, s, u, a) {
528
528
  var l = t.call(this, r) || this;
529
529
  return l.onFinalize = u, l.shouldUnsubscribe = a, l._next = n ? function(i) {
530
530
  try {
531
531
  n(i);
532
- } catch (h) {
533
- r.error(h);
532
+ } catch (f) {
533
+ r.error(f);
534
534
  }
535
535
  } : t.prototype._next, l._error = s ? function(i) {
536
536
  try {
537
537
  s(i);
538
- } catch (h) {
539
- r.error(h);
538
+ } catch (f) {
539
+ r.error(f);
540
540
  } finally {
541
541
  this.unsubscribe();
542
542
  }
@@ -562,13 +562,13 @@ var Ct = function(t) {
562
562
  t(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
563
563
  };
564
564
  }), oe = function(t) {
565
- W(e, t);
565
+ Y(e, t);
566
566
  function e() {
567
567
  var r = t.call(this) || this;
568
568
  return r.closed = !1, r.currentObservers = null, r.observers = [], r.isStopped = !1, r.hasError = !1, r.thrownError = null, r;
569
569
  }
570
570
  return e.prototype.lift = function(r) {
571
- var n = new je(this, this);
571
+ var n = new Me(this, this);
572
572
  return n.operator = r, n;
573
573
  }, e.prototype._throwIfClosed = function() {
574
574
  if (this.closed)
@@ -638,10 +638,10 @@ var Ct = function(t) {
638
638
  var r = new R();
639
639
  return r.source = this, r;
640
640
  }, e.create = function(r, n) {
641
- return new je(r, n);
641
+ return new Me(r, n);
642
642
  }, e;
643
- }(R), je = function(t) {
644
- W(e, t);
643
+ }(R), Me = function(t) {
644
+ Y(e, t);
645
645
  function e(r, n) {
646
646
  var o = t.call(this) || this;
647
647
  return o.destination = r, o.source = n, o;
@@ -660,7 +660,7 @@ var Ct = function(t) {
660
660
  return (o = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(r)) !== null && o !== void 0 ? o : ze;
661
661
  }, e;
662
662
  }(oe), D = function(t) {
663
- W(e, t);
663
+ Y(e, t);
664
664
  function e(r) {
665
665
  var n = t.call(this) || this;
666
666
  return n._value = r, n;
@@ -688,7 +688,7 @@ var Ct = function(t) {
688
688
  },
689
689
  delegate: void 0
690
690
  }, Pt = function(t) {
691
- W(e, t);
691
+ Y(e, t);
692
692
  function e(r, n, o) {
693
693
  r === void 0 && (r = 1 / 0), n === void 0 && (n = 1 / 0), o === void 0 && (o = Ce);
694
694
  var s = t.call(this) || this;
@@ -705,13 +705,13 @@ var Ct = function(t) {
705
705
  }, e.prototype._trimBuffer = function() {
706
706
  var r = this, n = r._bufferSize, o = r._timestampProvider, s = r._buffer, u = r._infiniteTimeWindow, a = (u ? 1 : 2) * n;
707
707
  if (n < 1 / 0 && a < s.length && s.splice(0, s.length - a), !u) {
708
- for (var l = o.now(), i = 0, h = 1; h < s.length && s[h] <= l; h += 2)
709
- i = h;
708
+ for (var l = o.now(), i = 0, f = 1; f < s.length && s[f] <= l; f += 2)
709
+ i = f;
710
710
  i && s.splice(0, i + 1);
711
711
  }
712
712
  }, e;
713
- }(oe), kt = function(t) {
714
- W(e, t);
713
+ }(oe), jt = function(t) {
714
+ Y(e, t);
715
715
  function e(r, n) {
716
716
  return t.call(this) || this;
717
717
  }
@@ -728,8 +728,8 @@ var Ct = function(t) {
728
728
  return clearInterval(t);
729
729
  },
730
730
  delegate: void 0
731
- }, Mt = function(t) {
732
- W(e, t);
731
+ }, kt = function(t) {
732
+ Y(e, t);
733
733
  function e(r, n) {
734
734
  var o = t.call(this, r, n) || this;
735
735
  return o.scheduler = r, o.work = n, o.pending = !1, o;
@@ -770,15 +770,15 @@ var Ct = function(t) {
770
770
  this.work = this.state = this.scheduler = null, this.pending = !1, we(s, this), n != null && (this.id = this.recycleAsyncId(o, n, null)), this.delay = null, t.prototype.unsubscribe.call(this);
771
771
  }
772
772
  }, e;
773
- }(kt), Ve = function() {
773
+ }(jt), Ve = function() {
774
774
  function t(e, r) {
775
775
  r === void 0 && (r = t.now), this.schedulerActionCtor = e, this.now = r;
776
776
  }
777
777
  return t.prototype.schedule = function(e, r, n) {
778
778
  return r === void 0 && (r = 0), new this.schedulerActionCtor(this, e).schedule(n, r);
779
779
  }, t.now = Ce.now, t;
780
- }(), jt = function(t) {
781
- W(e, t);
780
+ }(), Mt = function(t) {
781
+ Y(e, t);
782
782
  function e(r, n) {
783
783
  n === void 0 && (n = Ve.now);
784
784
  var o = t.call(this, r, n) || this;
@@ -802,17 +802,17 @@ var Ct = function(t) {
802
802
  throw o;
803
803
  }
804
804
  }, e;
805
- }(Ve), Lt = new jt(Mt), se = new R(function(t) {
805
+ }(Ve), Lt = new Mt(kt), se = new R(function(t) {
806
806
  return t.complete();
807
807
  });
808
808
  function Vt(t) {
809
- return t && j(t.schedule);
809
+ return t && L(t.schedule);
810
810
  }
811
811
  function We(t) {
812
812
  return t[t.length - 1];
813
813
  }
814
814
  function Rt(t) {
815
- return j(We(t)) ? t.pop() : void 0;
815
+ return L(We(t)) ? t.pop() : void 0;
816
816
  }
817
817
  function Ye(t) {
818
818
  return Vt(We(t)) ? t.pop() : void 0;
@@ -821,13 +821,13 @@ var Ze = function(t) {
821
821
  return t && typeof t.length == "number" && typeof t != "function";
822
822
  };
823
823
  function Je(t) {
824
- return j(t == null ? void 0 : t.then);
824
+ return L(t == null ? void 0 : t.then);
825
825
  }
826
826
  function He(t) {
827
- return j(t[Ie]);
827
+ return L(t[Ie]);
828
828
  }
829
829
  function Qe(t) {
830
- return Symbol.asyncIterator && j(t == null ? void 0 : t[Symbol.asyncIterator]);
830
+ return Symbol.asyncIterator && L(t == null ? void 0 : t[Symbol.asyncIterator]);
831
831
  }
832
832
  function Xe(t) {
833
833
  return new TypeError("You provided " + (t !== null && typeof t == "object" ? "an invalid object" : "'" + t + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
@@ -837,7 +837,7 @@ function Kt() {
837
837
  }
838
838
  var et = Kt();
839
839
  function tt(t) {
840
- return j(t == null ? void 0 : t[et]);
840
+ return L(t == null ? void 0 : t[et]);
841
841
  }
842
842
  function rt(t) {
843
843
  return bt(this, arguments, function() {
@@ -871,7 +871,7 @@ function rt(t) {
871
871
  });
872
872
  }
873
873
  function nt(t) {
874
- return j(t == null ? void 0 : t.getReader);
874
+ return L(t == null ? void 0 : t.getReader);
875
875
  }
876
876
  function X(t) {
877
877
  if (t instanceof R)
@@ -895,7 +895,7 @@ function X(t) {
895
895
  function Ft(t) {
896
896
  return new R(function(e) {
897
897
  var r = t[Ie]();
898
- if (j(r.subscribe))
898
+ if (L(r.subscribe))
899
899
  return r.subscribe(e);
900
900
  throw new TypeError("Provided object does not correctly implement Symbol.observable");
901
901
  });
@@ -1046,7 +1046,7 @@ function Zt(t, e) {
1046
1046
  u ? r.complete() : r.next(s);
1047
1047
  }, 0, !0);
1048
1048
  }), function() {
1049
- return j(n == null ? void 0 : n.return) && n.return();
1049
+ return L(n == null ? void 0 : n.return) && n.return();
1050
1050
  };
1051
1051
  });
1052
1052
  }
@@ -1141,7 +1141,7 @@ function ur(t, e) {
1141
1141
  return r[n] = e[o], r;
1142
1142
  }, {});
1143
1143
  }
1144
- function Y() {
1144
+ function Z() {
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;
@@ -1155,11 +1155,11 @@ function Y() {
1155
1155
  function lr(t, e, r) {
1156
1156
  return r === void 0 && (r = me), function(n) {
1157
1157
  Re(e, function() {
1158
- for (var o = t.length, s = new Array(o), u = o, a = o, l = function(h) {
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[h], e), w = !1;
1161
- b.subscribe(N(n, function(m) {
1162
- s[h] = m, w || (w = !0, a--), a || n.next(r(s.slice()));
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()));
1163
1163
  }, function() {
1164
1164
  --u || n.complete();
1165
1165
  }));
@@ -1208,9 +1208,9 @@ function G(t, e) {
1208
1208
  }
1209
1209
  };
1210
1210
  function l() {
1211
- var i = u + t, h = e.now();
1212
- if (h < i) {
1213
- o = this.schedule(void 0, i - h), n.add(o);
1211
+ var i = u + t, f = e.now();
1212
+ if (f < i) {
1213
+ o = this.schedule(void 0, i - f), n.add(o);
1214
1214
  return;
1215
1215
  }
1216
1216
  a();
@@ -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 h, b, w, m = 0, v = !1, y = !1, d = function() {
1286
+ var f, b, _, p = 0, A = !1, m = !1, h = function() {
1287
1287
  b == null || b.unsubscribe(), b = void 0;
1288
- }, E = function() {
1289
- d(), h = w = void 0, v = y = !1;
1290
- }, p = function() {
1291
- var _ = h;
1292
- E(), _ == null || _.unsubscribe();
1288
+ }, w = function() {
1289
+ h(), f = _ = void 0, A = m = !1;
1290
+ }, C = function() {
1291
+ var O = f;
1292
+ w(), O == null || O.unsubscribe();
1293
1293
  };
1294
- return U(function(_, T) {
1295
- m++, !y && !v && d();
1296
- var A = w = w ?? r();
1297
- T.add(function() {
1298
- m--, m === 0 && !y && !v && (b = Ae(p, l));
1299
- }), A.subscribe(T), !h && m > 0 && (h = new he({
1300
- next: function(x) {
1301
- return A.next(x);
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({
1300
+ next: function(E) {
1301
+ return g.next(E);
1302
1302
  },
1303
- error: function(x) {
1304
- y = !0, d(), b = Ae(E, o, x), A.error(x);
1303
+ error: function(E) {
1304
+ m = !0, h(), b = Ae(w, o, E), g.error(E);
1305
1305
  },
1306
1306
  complete: function() {
1307
- v = !0, d(), b = Ae(E, u), A.complete();
1307
+ A = !0, h(), b = Ae(w, u), g.complete();
1308
1308
  }
1309
- }), X(_).subscribe(h));
1309
+ }), X(O).subscribe(f));
1310
1310
  })(i);
1311
1311
  };
1312
1312
  }
@@ -1344,9 +1344,9 @@ function br(t, e) {
1344
1344
  };
1345
1345
  r.subscribe(N(n, function(l) {
1346
1346
  o == null || o.unsubscribe();
1347
- var i = 0, h = s++;
1348
- X(t(l, h)).subscribe(o = N(n, function(b) {
1349
- return n.next(e ? e(l, b, h, i++) : b);
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);
1350
1350
  }, function() {
1351
1351
  o = null, a();
1352
1352
  }));
@@ -1417,7 +1417,7 @@ function Or(t, e) {
1417
1417
  const n = e.colors[r].data, o = t % n.length;
1418
1418
  return n[o];
1419
1419
  }
1420
- function K(t, e, r) {
1420
+ function F(t, e, r) {
1421
1421
  let n;
1422
1422
  switch (t) {
1423
1423
  case "index":
@@ -1446,7 +1446,7 @@ function Ir(t) {
1446
1446
  function ct(t) {
1447
1447
  return !!(t && t.nodeType);
1448
1448
  }
1449
- function H(t, e) {
1449
+ function W(t, e) {
1450
1450
  if (Q(e) === !1 || Q(t) === !1)
1451
1451
  return Object.assign({}, t);
1452
1452
  const r = (n, o) => {
@@ -1504,17 +1504,17 @@ function fe({ from: t, systemMessage: e }) {
1504
1504
  return `unexpected error from '${t}':
1505
1505
  ${e}`;
1506
1506
  }
1507
- function Z({ columnName: t, expectToBe: e, from: r }) {
1507
+ function J({ 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 J({ columnName: t, expectToBe: e, from: r }) {
1512
+ function H({ 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}'`;
1516
1516
  }
1517
- function kr(t) {
1517
+ function jr(t) {
1518
1518
  return new R((e) => {
1519
1519
  const r = new ResizeObserver((n) => {
1520
1520
  const o = n[0];
@@ -1525,11 +1525,11 @@ function kr(t) {
1525
1525
  };
1526
1526
  });
1527
1527
  }
1528
- function Mr(t) {
1528
+ function kr(t) {
1529
1529
  return `orbcharts-${t}`;
1530
1530
  }
1531
- function jr(t, e) {
1532
- return `${Mr(t)}-${e}`;
1531
+ function Mr(t, e) {
1532
+ return `${kr(t)}-${e}`;
1533
1533
  }
1534
1534
  function Lr(t, e) {
1535
1535
  const r = {
@@ -1551,7 +1551,7 @@ function Lr(t, e) {
1551
1551
  if (e[s]) {
1552
1552
  const u = e[s], a = t[s];
1553
1553
  if (u.toBeTypes) {
1554
- if (u.toBeTypes.some((h) => r[h](a)) === !1)
1554
+ if (u.toBeTypes.some((f) => r[f](a)) === !1)
1555
1555
  return !0;
1556
1556
  } else if (u.toBe) {
1557
1557
  const { toBe: l, test: i } = u;
@@ -1720,8 +1720,8 @@ const Ke = {
1720
1720
  const n = /* @__PURE__ */ new Map(), o = Array.isArray(t[0]);
1721
1721
  o ? t.forEach((a, l) => {
1722
1722
  a.forEach((i) => {
1723
- const h = i[e.dataset.from] || `dataset-${l}`;
1724
- n.has(h) || n.set(h, []), n.get(h).push(i);
1723
+ const f = i[e.dataset.from] || `dataset-${l}`;
1724
+ n.has(f) || n.set(f, []), n.get(f).push(i);
1725
1725
  });
1726
1726
  }) : t.forEach((a) => {
1727
1727
  const l = a[e.dataset.from] || "default";
@@ -1733,8 +1733,8 @@ const Ke = {
1733
1733
  else if (e.dataset.sort === "original") {
1734
1734
  const a = [];
1735
1735
  o ? t.forEach((l, i) => {
1736
- l.forEach((h) => {
1737
- const b = h[e.dataset.from] || `dataset-${i}`;
1736
+ l.forEach((f) => {
1737
+ const b = f[e.dataset.from] || `dataset-${i}`;
1738
1738
  a.includes(b) || a.push(b);
1739
1739
  });
1740
1740
  }) : t.forEach((l) => {
@@ -1744,139 +1744,139 @@ const Ke = {
1744
1744
  } else e.dataset.sort === "alphabetical" && s.sort((a, l) => a.localeCompare(l, void 0, { numeric: !0 }));
1745
1745
  const u = [];
1746
1746
  return s.forEach((a, l) => {
1747
- const i = n.get(a), h = /* @__PURE__ */ new Map();
1748
- i.forEach((y) => {
1749
- const d = y[e.series.from] || "default";
1750
- h.has(d) || h.set(d, []), h.get(d).push(y);
1747
+ const i = n.get(a), f = /* @__PURE__ */ new Map();
1748
+ i.forEach((m) => {
1749
+ const h = m[e.series.from] || "default";
1750
+ f.has(h) || f.set(h, []), f.get(h).push(m);
1751
1751
  });
1752
- let b = Array.from(h.keys());
1752
+ let b = Array.from(f.keys());
1753
1753
  if (Array.isArray(e.series.sort))
1754
- b = e.series.sort.filter((y) => h.has(y)).concat(b.filter((y) => !e.series.sort.includes(y)));
1754
+ b = e.series.sort.filter((m) => f.has(m)).concat(b.filter((m) => !e.series.sort.includes(m)));
1755
1755
  else if (e.series.sort === "original") {
1756
- const y = [];
1757
- i.forEach((d) => {
1758
- const E = d[e.series.from] || "default";
1759
- y.includes(E) || y.push(E);
1760
- }), b = y;
1761
- } else e.series.sort === "alphabetical" && b.sort((y, d) => y.localeCompare(d, void 0, { numeric: !0 }));
1762
- const w = [];
1756
+ 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 _ = [];
1763
1763
  if (e.category.sort === "original")
1764
- i.forEach((y) => {
1765
- const d = y[e.category.from] || "default";
1766
- w.includes(d) || w.push(d);
1764
+ i.forEach((m) => {
1765
+ const h = m[e.category.from] || "default";
1766
+ _.includes(h) || _.push(h);
1767
1767
  });
1768
1768
  else if (e.category.sort === "alphabetical") {
1769
- const y = /* @__PURE__ */ new Set();
1770
- i.forEach((d) => {
1771
- y.add(d[e.category.from] || "default");
1772
- }), w.push(...Array.from(y).sort((d, E) => d.localeCompare(E, void 0, { numeric: !0 })));
1769
+ 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 })));
1773
1773
  } else if (Array.isArray(e.category.sort)) {
1774
- const y = [];
1775
- i.forEach((E) => {
1776
- const p = E[e.category.from] || "default";
1777
- y.includes(p) || y.push(p);
1774
+ const m = [];
1775
+ i.forEach((w) => {
1776
+ const C = w[e.category.from] || "default";
1777
+ m.includes(C) || m.push(C);
1778
1778
  });
1779
- const d = e.category.sort;
1780
- w.push(
1781
- ...d.filter((E) => y.includes(E)),
1782
- ...y.filter((E) => !d.includes(E))
1779
+ const h = e.category.sort;
1780
+ _.push(
1781
+ ...h.filter((w) => m.includes(w)),
1782
+ ...m.filter((w) => !h.includes(w))
1783
1783
  );
1784
1784
  }
1785
- const m = /* @__PURE__ */ new Map();
1786
- w.forEach((y, d) => {
1787
- m.set(y, d);
1785
+ const p = /* @__PURE__ */ new Map();
1786
+ _.forEach((m, h) => {
1787
+ p.set(m, h);
1788
1788
  });
1789
- const v = [];
1790
- b.forEach((y, d) => {
1791
- const E = h.get(y), p = /* @__PURE__ */ new Map();
1792
- E.forEach((A) => {
1793
- const x = A[e.category.from] || "default";
1794
- p.has(x) || p.set(x, []), p.get(x).push(A);
1789
+ 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);
1795
1795
  });
1796
- const _ = w.filter((A) => p.has(A)), T = [];
1797
- e.category.sort === "original" && e.value.aggregate === "none" ? (E.forEach((A, x) => {
1798
- const B = A[e.category.from] || "default", I = m.get(B), c = A[e.value.from];
1799
- T.push({
1800
- id: A.id || `${a}-${y}-${B}-${x}`,
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}`,
1801
1801
  index: I,
1802
1802
  // Series 模式下 index 對應 categoryIndex
1803
1803
  modelType: "series",
1804
- name: A.name || "",
1805
- data: A.data,
1804
+ name: g.name || "",
1805
+ data: g.data,
1806
1806
  value: typeof c == "number" ? c : null,
1807
- color: K(e.color.from, {
1807
+ color: F(e.color.from, {
1808
1808
  index: I,
1809
- seriesIndex: d,
1809
+ seriesIndex: h,
1810
1810
  categoryIndex: I,
1811
1811
  datasetIndex: l
1812
1812
  }, r),
1813
- series: y,
1814
- seriesIndex: d,
1813
+ series: m,
1814
+ seriesIndex: h,
1815
1815
  category: B,
1816
1816
  categoryIndex: I
1817
1817
  });
1818
- }), e.value.sort === "asc" ? T.sort((A, x) => A.value === null && x.value === null ? 0 : A.value === null ? 1 : x.value === null ? -1 : A.value - x.value) : e.value.sort === "desc" && T.sort((A, x) => A.value === null && x.value === null ? 0 : A.value === null ? 1 : x.value === null ? -1 : x.value - A.value)) : _.forEach((A) => {
1819
- const x = m.get(A), B = p.get(A);
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
1820
  if (e.value.aggregate === "none") {
1821
- let I = B.map((c, f) => {
1822
- const g = c[e.value.from];
1821
+ let I = B.map((c, v) => {
1822
+ const $ = c[e.value.from];
1823
1823
  return {
1824
- id: c.id || `${a}-${y}-${A}-${f}`,
1825
- index: x,
1824
+ id: c.id || `${a}-${m}-${g}-${v}`,
1825
+ index: E,
1826
1826
  // Series 模式下 index 對應 categoryIndex
1827
1827
  modelType: "series",
1828
1828
  name: c.name || "",
1829
1829
  data: c.data,
1830
- value: typeof g == "number" ? g : null,
1831
- color: K(e.color.from, {
1832
- index: x,
1833
- seriesIndex: d,
1834
- categoryIndex: x,
1830
+ value: typeof $ == "number" ? $ : null,
1831
+ color: F(e.color.from, {
1832
+ index: E,
1833
+ seriesIndex: h,
1834
+ categoryIndex: E,
1835
1835
  datasetIndex: l
1836
1836
  }, r),
1837
- series: y,
1838
- seriesIndex: d,
1839
- category: A,
1840
- categoryIndex: x
1837
+ series: m,
1838
+ seriesIndex: h,
1839
+ category: g,
1840
+ categoryIndex: E
1841
1841
  };
1842
1842
  });
1843
- e.value.sort === "asc" ? I.sort((c, f) => c.value === null && f.value === null ? 0 : c.value === null ? 1 : f.value === null ? -1 : c.value - f.value) : e.value.sort === "desc" && I.sort((c, f) => c.value === null && f.value === null ? 0 : c.value === null ? 1 : f.value === null ? -1 : f.value - c.value), T.push(...I);
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);
1844
1844
  } else {
1845
- const I = B.map((S) => {
1845
+ const I = B.map((d) => {
1846
1846
  if (e.value.aggregate === "count")
1847
1847
  return 1;
1848
- const $ = S[e.value.from];
1849
- return typeof $ == "number" ? $ : null;
1850
- }), c = pe(I, e.value.aggregate), f = B[0], g = {
1851
- id: f.id || `${a}-${y}-${A}-aggregated`,
1852
- index: x,
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`,
1852
+ index: E,
1853
1853
  // Series 模式下 index 對應 categoryIndex
1854
1854
  modelType: "series",
1855
- name: f.name || A,
1856
- data: f.data,
1855
+ name: v.name || g,
1856
+ data: v.data,
1857
1857
  value: c,
1858
- color: K(e.color.from, {
1859
- index: x,
1860
- seriesIndex: d,
1861
- categoryIndex: x,
1858
+ color: F(e.color.from, {
1859
+ index: E,
1860
+ seriesIndex: h,
1861
+ categoryIndex: E,
1862
1862
  datasetIndex: l
1863
1863
  }, r),
1864
- series: y,
1865
- seriesIndex: d,
1866
- category: A,
1867
- categoryIndex: x
1864
+ series: m,
1865
+ seriesIndex: h,
1866
+ category: g,
1867
+ categoryIndex: E
1868
1868
  };
1869
- T.push(g);
1869
+ y.push($);
1870
1870
  }
1871
- }), v.push(T);
1872
- }), u.push(v);
1871
+ }), A.push(y);
1872
+ }), u.push(A);
1873
1873
  }), u;
1874
1874
  }, Rr = (t, e, r) => {
1875
1875
  const n = /* @__PURE__ */ new Map(), o = Array.isArray(t[0]);
1876
1876
  o ? t.forEach((a, l) => {
1877
1877
  a.forEach((i) => {
1878
- const h = i[e.dataset.from] || `dataset-${l}`;
1879
- n.has(h) || n.set(h, []), n.get(h).push(i);
1878
+ const f = i[e.dataset.from] || `dataset-${l}`;
1879
+ n.has(f) || n.set(f, []), n.get(f).push(i);
1880
1880
  });
1881
1881
  }) : t.forEach((a) => {
1882
1882
  const l = a[e.dataset.from] || "default";
@@ -1888,8 +1888,8 @@ const Ke = {
1888
1888
  else if (e.dataset.sort === "original") {
1889
1889
  const a = [];
1890
1890
  o ? t.forEach((l, i) => {
1891
- l.forEach((h) => {
1892
- const b = h[e.dataset.from] || `dataset-${i}`;
1891
+ l.forEach((f) => {
1892
+ const b = f[e.dataset.from] || `dataset-${i}`;
1893
1893
  a.includes(b) || a.push(b);
1894
1894
  });
1895
1895
  }) : t.forEach((l) => {
@@ -1899,118 +1899,118 @@ const Ke = {
1899
1899
  } else e.dataset.sort === "alphabetical" && s.sort((a, l) => a.localeCompare(l, void 0, { numeric: !0 }));
1900
1900
  const u = [];
1901
1901
  return s.forEach((a, l) => {
1902
- const i = n.get(a), h = /* @__PURE__ */ new Map();
1903
- i.forEach((d) => {
1904
- const E = d[e.series.from] || "default";
1905
- h.has(E) || h.set(E, []), h.get(E).push(d);
1902
+ 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);
1906
1906
  });
1907
- let b = Array.from(h.keys());
1907
+ let b = Array.from(f.keys());
1908
1908
  if (Array.isArray(e.series.sort))
1909
- b = e.series.sort.filter((d) => h.has(d)).concat(b.filter((d) => !e.series.sort.includes(d)));
1909
+ b = e.series.sort.filter((h) => f.has(h)).concat(b.filter((h) => !e.series.sort.includes(h)));
1910
1910
  else if (e.series.sort === "original") {
1911
- const d = [];
1912
- i.forEach((E) => {
1913
- const p = E[e.series.from] || "default";
1914
- d.includes(p) || d.push(p);
1915
- }), b = d;
1916
- } else e.series.sort === "alphabetical" && b.sort((d, E) => d.localeCompare(E, void 0, { numeric: !0 }));
1917
- const w = [];
1918
- i.forEach((d) => {
1919
- const E = d[e.category.from] || "default";
1920
- w.includes(E) || w.push(E);
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);
1921
1921
  });
1922
- const m = new Set(w);
1923
- let v = Array.from(m);
1924
- Array.isArray(e.category.sort) ? v = e.category.sort.filter((d) => m.has(d)).concat(v.filter((d) => !e.category.sort.includes(d))) : e.category.sort === "original" ? v = w : e.category.sort === "alphabetical" && v.sort((d, E) => d.localeCompare(E, void 0, { numeric: !0 }));
1925
- const y = [];
1926
- b.forEach((d, E) => {
1927
- const p = h.get(d), _ = /* @__PURE__ */ new Map();
1928
- p.forEach((A) => {
1929
- const x = A[e.category.from] || "default";
1930
- _.has(x) || _.set(x, []), _.get(x).push(A);
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 }));
1925
+ 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);
1931
1931
  });
1932
- const T = [];
1933
- v.forEach((A, x) => {
1934
- const B = _.get(A);
1932
+ const y = [];
1933
+ A.forEach((g, E) => {
1934
+ const B = O.get(g);
1935
1935
  if (!B)
1936
- T.push({
1937
- id: `${a}-${d}-${A}-null`,
1938
- index: x,
1936
+ y.push({
1937
+ id: `${a}-${h}-${g}-null`,
1938
+ index: E,
1939
1939
  modelType: "grid",
1940
- name: A,
1940
+ name: g,
1941
1941
  data: void 0,
1942
1942
  value: null,
1943
- color: K(e.color.from, {
1944
- index: x,
1945
- seriesIndex: E,
1946
- categoryIndex: x,
1943
+ color: F(e.color.from, {
1944
+ index: E,
1945
+ seriesIndex: w,
1946
+ categoryIndex: E,
1947
1947
  datasetIndex: l
1948
1948
  }, r),
1949
- series: d,
1950
- seriesIndex: E,
1951
- category: A,
1952
- categoryIndex: x
1949
+ series: h,
1950
+ seriesIndex: w,
1951
+ category: g,
1952
+ categoryIndex: E
1953
1953
  });
1954
1954
  else if (e.value.aggregate === "none") {
1955
- let I = B.map((c, f) => {
1956
- const g = c[e.value.from];
1955
+ let I = B.map((c, v) => {
1956
+ const $ = c[e.value.from];
1957
1957
  return {
1958
- id: c.id || `${a}-${d}-${A}-${f}`,
1959
- index: x,
1958
+ id: c.id || `${a}-${h}-${g}-${v}`,
1959
+ index: E,
1960
1960
  // Grid 模式下 index 對應 categoryIndex
1961
1961
  modelType: "grid",
1962
1962
  name: c.name || "",
1963
1963
  data: c.data,
1964
- value: typeof g == "number" ? g : null,
1965
- color: K(e.color.from, {
1966
- index: x,
1967
- seriesIndex: E,
1968
- categoryIndex: x,
1964
+ value: typeof $ == "number" ? $ : null,
1965
+ color: F(e.color.from, {
1966
+ index: E,
1967
+ seriesIndex: w,
1968
+ categoryIndex: E,
1969
1969
  datasetIndex: l
1970
1970
  }, r),
1971
- series: d,
1972
- seriesIndex: E,
1973
- category: A,
1974
- categoryIndex: x
1971
+ series: h,
1972
+ seriesIndex: w,
1973
+ category: g,
1974
+ categoryIndex: E
1975
1975
  };
1976
1976
  });
1977
- e.value.sort === "asc" ? I.sort((c, f) => c.value === null && f.value === null ? 0 : c.value === null ? 1 : f.value === null ? -1 : c.value - f.value) : e.value.sort === "desc" && I.sort((c, f) => c.value === null && f.value === null ? 0 : c.value === null ? 1 : f.value === null ? -1 : f.value - c.value), T.push(...I);
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);
1978
1978
  } else {
1979
- const I = B.map((S) => {
1979
+ const I = B.map((d) => {
1980
1980
  if (e.value.aggregate === "count")
1981
1981
  return 1;
1982
- const $ = S[e.value.from];
1983
- return typeof $ == "number" ? $ : null;
1984
- }), c = pe(I, e.value.aggregate), f = B[0], g = {
1985
- id: f.id || `${a}-${d}-${A}-aggregated`,
1986
- index: x,
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`,
1986
+ index: E,
1987
1987
  // Grid 模式下 index 對應 categoryIndex
1988
1988
  modelType: "grid",
1989
- name: f.name || A,
1990
- data: f.data,
1989
+ name: v.name || g,
1990
+ data: v.data,
1991
1991
  value: c,
1992
- color: K(e.color.from, {
1993
- index: x,
1994
- seriesIndex: E,
1995
- categoryIndex: x,
1992
+ color: F(e.color.from, {
1993
+ index: E,
1994
+ seriesIndex: w,
1995
+ categoryIndex: E,
1996
1996
  datasetIndex: l
1997
1997
  }, r),
1998
- series: d,
1999
- seriesIndex: E,
2000
- category: A,
2001
- categoryIndex: x
1998
+ series: h,
1999
+ seriesIndex: w,
2000
+ category: g,
2001
+ categoryIndex: E
2002
2002
  };
2003
- T.push(g);
2003
+ y.push($);
2004
2004
  }
2005
- }), y.push(T);
2006
- }), u.push(y);
2005
+ }), m.push(y);
2006
+ }), u.push(m);
2007
2007
  }), u;
2008
2008
  }, Kr = (t, e, r) => {
2009
2009
  const n = /* @__PURE__ */ new Map(), o = Array.isArray(t[0]);
2010
2010
  o ? t.forEach((a, l) => {
2011
2011
  a.forEach((i) => {
2012
- const h = i[e.dataset.from] || `dataset-${l}`;
2013
- n.has(h) || n.set(h, []), n.get(h).push(i);
2012
+ const f = i[e.dataset.from] || `dataset-${l}`;
2013
+ n.has(f) || n.set(f, []), n.get(f).push(i);
2014
2014
  });
2015
2015
  }) : t.forEach((a) => {
2016
2016
  const l = a[e.dataset.from] || "default";
@@ -2022,8 +2022,8 @@ const Ke = {
2022
2022
  else if (e.dataset.sort === "original") {
2023
2023
  const a = [];
2024
2024
  o ? t.forEach((l, i) => {
2025
- l.forEach((h) => {
2026
- const b = h[e.dataset.from] || `dataset-${i}`;
2025
+ l.forEach((f) => {
2026
+ const b = f[e.dataset.from] || `dataset-${i}`;
2027
2027
  a.includes(b) || a.push(b);
2028
2028
  });
2029
2029
  }) : t.forEach((l) => {
@@ -2033,280 +2033,280 @@ const Ke = {
2033
2033
  } else e.dataset.sort === "alphabetical" && s.sort((a, l) => a.localeCompare(l, void 0, { numeric: !0 }));
2034
2034
  const u = [];
2035
2035
  return s.forEach((a, l) => {
2036
- const i = n.get(a), h = /* @__PURE__ */ new Map();
2037
- i.forEach((m) => {
2038
- const v = m[e.series.from] || "default";
2039
- h.has(v) || h.set(v, []), h.get(v).push(m);
2036
+ 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);
2040
2040
  });
2041
- let b = Array.from(h.keys());
2041
+ let b = Array.from(f.keys());
2042
2042
  if (Array.isArray(e.series.sort))
2043
- b = e.series.sort.filter((m) => h.has(m)).concat(b.filter((m) => !e.series.sort.includes(m)));
2043
+ b = e.series.sort.filter((p) => f.has(p)).concat(b.filter((p) => !e.series.sort.includes(p)));
2044
2044
  else if (e.series.sort === "original") {
2045
- const m = [];
2046
- i.forEach((v) => {
2047
- const y = v[e.series.from] || "default";
2048
- m.includes(y) || m.push(y);
2049
- }), b = m;
2050
- } else e.series.sort === "alphabetical" && b.sort((m, v) => m.localeCompare(v, void 0, { numeric: !0 }));
2051
- const w = [];
2052
- b.forEach((m, v) => {
2053
- const y = h.get(m), d = /* @__PURE__ */ new Map();
2054
- y.forEach((_) => {
2055
- const T = _[e.category.from] || "default";
2056
- d.has(T) || d.set(T, []), d.get(T).push(_);
2045
+ const p = [];
2046
+ i.forEach((A) => {
2047
+ 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();
2054
+ m.forEach((O) => {
2055
+ const y = O[e.category.from] || "default";
2056
+ h.has(y) || h.set(y, []), h.get(y).push(O);
2057
2057
  });
2058
- let E = Array.from(d.keys());
2058
+ let w = Array.from(h.keys());
2059
2059
  if (Array.isArray(e.category.sort))
2060
- E = e.category.sort.filter((_) => d.has(_)).concat(E.filter((_) => !e.category.sort.includes(_)));
2060
+ w = e.category.sort.filter((O) => h.has(O)).concat(w.filter((O) => !e.category.sort.includes(O)));
2061
2061
  else if (e.category.sort === "original") {
2062
- const _ = [];
2063
- y.forEach((T) => {
2064
- const A = T[e.category.from] || "default";
2065
- _.includes(A) || _.push(A);
2066
- }), E = _;
2067
- } else e.category.sort === "alphabetical" && E.sort((_, T) => _.localeCompare(T, void 0, { numeric: !0 }));
2068
- const p = [];
2069
- E.forEach((_, T) => {
2070
- d.get(_).forEach((x, B) => {
2071
- const I = e.multivariate.map((f, g) => ({
2072
- index: g,
2073
- name: f.name,
2062
+ 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) => {
2071
+ const I = e.multivariate.map((v, $) => ({
2072
+ index: $,
2073
+ name: v.name,
2074
2074
  value: (() => {
2075
- const S = x[f.from];
2076
- return typeof S == "number" ? S : null;
2075
+ const d = E[v.from];
2076
+ return typeof d == "number" ? d : null;
2077
2077
  })()
2078
2078
  })), c = {
2079
- id: x.id || `${a}-${m}-${_}-${B}`,
2079
+ id: E.id || `${a}-${p}-${O}-${B}`,
2080
2080
  index: B,
2081
2081
  modelType: "multivariate",
2082
- name: x.name || "",
2083
- data: x.data,
2082
+ name: E.name || "",
2083
+ data: E.data,
2084
2084
  value: null,
2085
2085
  // MultivariateData 的主要值在 values 陣列中,這裡設為 null
2086
- color: K(e.color.from, {
2086
+ color: F(e.color.from, {
2087
2087
  index: B,
2088
- seriesIndex: v,
2089
- categoryIndex: T,
2088
+ seriesIndex: A,
2089
+ categoryIndex: y,
2090
2090
  datasetIndex: l
2091
2091
  }, r),
2092
2092
  multivariate: I,
2093
- series: m,
2094
- seriesIndex: v,
2095
- category: _,
2096
- categoryIndex: T
2093
+ series: p,
2094
+ seriesIndex: A,
2095
+ category: O,
2096
+ categoryIndex: y
2097
2097
  };
2098
- p.push(c);
2098
+ C.push(c);
2099
2099
  });
2100
- }), w.push(p);
2101
- }), u.push(w);
2100
+ }), _.push(C);
2101
+ }), u.push(_);
2102
2102
  }), u;
2103
2103
  }, Fr = (t, e, r) => {
2104
2104
  const n = Array.isArray(t[0]), o = [], s = [];
2105
2105
  n ? t.forEach((i) => {
2106
- i.forEach((h) => {
2107
- h.source && h.target ? s.push(h) : o.push(h);
2106
+ i.forEach((f) => {
2107
+ f.source && f.target ? s.push(f) : o.push(f);
2108
2108
  });
2109
2109
  }) : t.forEach((i) => {
2110
2110
  i.source && i.target ? s.push(i) : o.push(i);
2111
2111
  });
2112
2112
  const u = /* @__PURE__ */ new Map();
2113
- n ? t.forEach((i, h) => {
2113
+ n ? t.forEach((i, f) => {
2114
2114
  i.forEach((b) => {
2115
2115
  if (!b.source || !b.target) {
2116
- const w = b[e.dataset.from] || `dataset-${h}`;
2117
- u.has(w) || u.set(w, []), u.get(w).push(b);
2116
+ const _ = b[e.dataset.from] || `dataset-${f}`;
2117
+ u.has(_) || u.set(_, []), u.get(_).push(b);
2118
2118
  }
2119
2119
  });
2120
2120
  }) : o.forEach((i) => {
2121
- const h = i[e.dataset.from] || "default";
2122
- u.has(h) || u.set(h, []), u.get(h).push(i);
2121
+ const f = i[e.dataset.from] || "default";
2122
+ u.has(f) || u.set(f, []), u.get(f).push(i);
2123
2123
  });
2124
2124
  let a = Array.from(u.keys());
2125
2125
  if (Array.isArray(e.dataset.sort))
2126
2126
  a = e.dataset.sort.filter((i) => u.has(i)).concat(a.filter((i) => !e.dataset.sort.includes(i)));
2127
2127
  else if (e.dataset.sort === "original") {
2128
2128
  const i = [];
2129
- n ? t.forEach((h, b) => {
2130
- h.forEach((w) => {
2131
- if (!w.source || !w.target) {
2132
- const m = w[e.dataset.from] || `dataset-${b}`;
2133
- i.includes(m) || i.push(m);
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);
2134
2134
  }
2135
2135
  });
2136
- }) : o.forEach((h) => {
2137
- const b = h[e.dataset.from] || "default";
2136
+ }) : o.forEach((f) => {
2137
+ const b = f[e.dataset.from] || "default";
2138
2138
  i.includes(b) || i.push(b);
2139
2139
  }), a = i;
2140
- } else e.dataset.sort === "alphabetical" && a.sort((i, h) => i.localeCompare(h, void 0, { numeric: !0 }));
2140
+ } else e.dataset.sort === "alphabetical" && a.sort((i, f) => i.localeCompare(f, void 0, { numeric: !0 }));
2141
2141
  const l = [];
2142
- return a.forEach((i, h) => {
2143
- const b = u.get(i), w = [], m = /* @__PURE__ */ new Map();
2142
+ return a.forEach((i, f) => {
2143
+ const b = u.get(i), _ = [], p = /* @__PURE__ */ new Map();
2144
2144
  b.forEach((c) => {
2145
- const f = c[e.series.from] || "default";
2146
- m.has(f) || m.set(f, []), m.get(f).push(c);
2145
+ const v = c[e.series.from] || "default";
2146
+ p.has(v) || p.set(v, []), p.get(v).push(c);
2147
2147
  });
2148
- let v = Array.from(m.keys());
2148
+ let A = Array.from(p.keys());
2149
2149
  if (Array.isArray(e.series.sort))
2150
- v = e.series.sort.filter((c) => m.has(c)).concat(v.filter((c) => !e.series.sort.includes(c)));
2150
+ A = e.series.sort.filter((c) => p.has(c)).concat(A.filter((c) => !e.series.sort.includes(c)));
2151
2151
  else if (e.series.sort === "original") {
2152
2152
  const c = [];
2153
- b.forEach((f) => {
2154
- const g = f[e.series.from] || "default";
2155
- c.includes(g) || c.push(g);
2156
- }), v = c;
2157
- } else e.series.sort === "alphabetical" && v.sort((c, f) => c.localeCompare(f, void 0, { numeric: !0 }));
2158
- v.forEach((c, f) => {
2159
- const g = m.get(c), S = /* @__PURE__ */ new Map();
2160
- g.forEach((O) => {
2161
- const C = O[e.category.from] || "default";
2162
- S.has(C) || S.set(C, []), S.get(C).push(O);
2153
+ b.forEach((v) => {
2154
+ const $ = v[e.series.from] || "default";
2155
+ c.includes($) || c.push($);
2156
+ }), A = c;
2157
+ } else e.series.sort === "alphabetical" && A.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
2158
+ 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);
2163
2163
  });
2164
- let $ = Array.from(S.keys());
2164
+ let x = Array.from(d.keys());
2165
2165
  if (Array.isArray(e.category.sort))
2166
- $ = e.category.sort.filter((O) => S.has(O)).concat($.filter((O) => !e.category.sort.includes(O)));
2166
+ x = e.category.sort.filter((S) => d.has(S)).concat(x.filter((S) => !e.category.sort.includes(S)));
2167
2167
  else if (e.category.sort === "original") {
2168
- const O = [];
2169
- g.forEach((C) => {
2170
- const L = C[e.category.from] || "default";
2171
- O.includes(L) || O.push(L);
2172
- }), $ = O;
2173
- } else e.category.sort === "alphabetical" && $.sort((O, C) => O.localeCompare(C, void 0, { numeric: !0 }));
2174
- $.forEach((O, C) => {
2175
- const L = S.get(O);
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);
2176
2176
  if (e.value.aggregate === "none") {
2177
- let M = L.map((P, k) => {
2178
- const F = P[e.value.from];
2177
+ let j = P.map((M, k) => {
2178
+ const K = M[e.value.from];
2179
2179
  return {
2180
- id: P.id || `${i}-${c}-${O}-${k}`,
2181
- index: w.length + k,
2180
+ id: M.id || `${i}-${c}-${S}-${k}`,
2181
+ index: _.length + k,
2182
2182
  // 在所有 nodes 中的索引
2183
2183
  modelType: "graph",
2184
- name: P.name || "",
2185
- data: P.data,
2186
- value: typeof F == "number" ? F : null,
2187
- color: K(e.color.from, {
2188
- index: C,
2189
- seriesIndex: f,
2190
- categoryIndex: C,
2191
- datasetIndex: h
2184
+ name: M.name || "",
2185
+ data: M.data,
2186
+ value: typeof K == "number" ? K : null,
2187
+ color: F(e.color.from, {
2188
+ index: T,
2189
+ seriesIndex: v,
2190
+ categoryIndex: T,
2191
+ datasetIndex: f
2192
2192
  }, r),
2193
2193
  series: c,
2194
- seriesIndex: f,
2195
- category: O,
2196
- categoryIndex: C
2194
+ seriesIndex: v,
2195
+ category: S,
2196
+ categoryIndex: T
2197
2197
  };
2198
2198
  });
2199
- e.value.sort === "asc" ? M.sort((P, k) => P.value === null && k.value === null ? 0 : P.value === null ? 1 : k.value === null ? -1 : P.value - k.value) : e.value.sort === "desc" && M.sort((P, k) => P.value === null && k.value === null ? 0 : P.value === null ? 1 : k.value === null ? -1 : k.value - P.value), w.push(...M);
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);
2200
2200
  } else {
2201
- const M = L.map((ne) => {
2201
+ const j = P.map((ne) => {
2202
2202
  if (e.value.aggregate === "count")
2203
2203
  return 1;
2204
2204
  const ee = ne[e.value.from];
2205
2205
  return typeof ee == "number" ? ee : null;
2206
- }), P = pe(M, e.value.aggregate), k = L[0], F = {
2207
- id: k.id || `${i}-${c}-${O}-aggregated`,
2208
- index: w.length,
2206
+ }), M = pe(j, e.value.aggregate), k = P[0], K = {
2207
+ id: k.id || `${i}-${c}-${S}-aggregated`,
2208
+ index: _.length,
2209
2209
  // 在所有 nodes 中的索引
2210
2210
  modelType: "graph",
2211
- name: k.name || O,
2211
+ name: k.name || S,
2212
2212
  data: k.data,
2213
- value: P,
2214
- color: K(e.color.from, {
2215
- index: C,
2216
- seriesIndex: f,
2217
- categoryIndex: C,
2218
- datasetIndex: h
2213
+ value: M,
2214
+ color: F(e.color.from, {
2215
+ index: T,
2216
+ seriesIndex: v,
2217
+ categoryIndex: T,
2218
+ datasetIndex: f
2219
2219
  }, r),
2220
2220
  series: c,
2221
- seriesIndex: f,
2222
- category: O,
2223
- categoryIndex: C
2221
+ seriesIndex: v,
2222
+ category: S,
2223
+ categoryIndex: T
2224
2224
  };
2225
- w.push(F);
2225
+ _.push(K);
2226
2226
  }
2227
2227
  });
2228
2228
  });
2229
- const y = [], d = /* @__PURE__ */ new Map();
2230
- w.forEach((c) => {
2231
- const f = o.find((g) => g.id === c.id || g.name === c.name);
2232
- f != null && f.id && d.set(f.id, c.index), f != null && f.name && d.set(f.name, c.index);
2229
+ const m = [], h = /* @__PURE__ */ new Map();
2230
+ _.forEach((c) => {
2231
+ 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);
2233
2233
  });
2234
- const E = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
2235
- w.forEach((c) => {
2236
- E.has(c.series) || E.set(c.series, c.seriesIndex), p.has(c.category) || p.set(c.category, c.categoryIndex);
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);
2237
2237
  });
2238
- let _ = E.size, T = p.size;
2239
- const A = (c) => (E.has(c) || E.set(c, _++), E.get(c)), x = (c) => (p.has(c) || p.set(c, T++), p.get(c)), B = s.filter((c) => (c[e.dataset.from] || "default") === i), I = /* @__PURE__ */ new Map();
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
2240
  B.forEach((c) => {
2241
- const f = c.source, g = c.target, S = c[e.series.from] || "default", $ = c[e.category.from] || "default", O = `${f}-${g}-${S}-${$}`;
2242
- I.has(O) || I.set(O, []), I.get(O).push(c);
2243
- }), Array.from(I.entries()).forEach(([c, f], g) => {
2244
- const S = f[0], $ = S.source, O = S.target, C = d.get($) ?? -1, L = d.get(O) ?? -1;
2245
- if (C >= 0 && L >= 0)
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);
2243
+ }), 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
2246
  if (e.value.aggregate === "none")
2247
- f.forEach((M, P) => {
2248
- const k = M[e.value.from], F = M[e.series.from] || "default", ne = M[e.category.from] || "default", ee = A(F), ve = x(ne), Ee = {
2249
- id: M.id || `edge-${g}-${P}`,
2250
- index: y.length,
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}`,
2250
+ index: m.length,
2251
2251
  modelType: "graph",
2252
- name: M.name || "",
2253
- data: M.data,
2252
+ name: j.name || "",
2253
+ data: j.data,
2254
2254
  value: typeof k == "number" ? k : null,
2255
- color: K(e.color.from, {
2256
- index: y.length,
2255
+ color: F(e.color.from, {
2256
+ index: m.length,
2257
2257
  seriesIndex: ee,
2258
2258
  categoryIndex: ve,
2259
- datasetIndex: h
2259
+ datasetIndex: f
2260
2260
  }, r),
2261
- series: F,
2261
+ series: K,
2262
2262
  seriesIndex: ee,
2263
2263
  category: ne,
2264
2264
  categoryIndex: ve,
2265
- source: $,
2266
- sourceIndex: C,
2267
- target: O,
2268
- targetIndex: L
2265
+ source: x,
2266
+ sourceIndex: T,
2267
+ target: S,
2268
+ targetIndex: P
2269
2269
  };
2270
- y.push(Ee);
2270
+ m.push(Ee);
2271
2271
  });
2272
2272
  else {
2273
- const M = f.map((Ee) => {
2273
+ const j = v.map((Ee) => {
2274
2274
  if (e.value.aggregate === "count")
2275
2275
  return 1;
2276
2276
  const Pe = Ee[e.value.from];
2277
2277
  return typeof Pe == "number" ? Pe : null;
2278
- }), P = pe(M, e.value.aggregate), k = S[e.series.from] || "default", F = S[e.category.from] || "default", ne = A(k), ee = x(F), ve = {
2279
- id: S.id || `edge-${g}-aggregated`,
2280
- index: y.length,
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
+ index: m.length,
2281
2281
  modelType: "graph",
2282
- name: S.name || "",
2283
- data: S.data,
2284
- value: P,
2285
- color: K(e.color.from, {
2286
- index: y.length,
2282
+ name: d.name || "",
2283
+ data: d.data,
2284
+ value: M,
2285
+ color: F(e.color.from, {
2286
+ index: m.length,
2287
2287
  seriesIndex: ne,
2288
2288
  categoryIndex: ee,
2289
- datasetIndex: h
2289
+ datasetIndex: f
2290
2290
  }, r),
2291
2291
  series: k,
2292
2292
  seriesIndex: ne,
2293
- category: F,
2293
+ category: K,
2294
2294
  categoryIndex: ee,
2295
- source: $,
2296
- sourceIndex: C,
2297
- target: O,
2298
- targetIndex: L
2295
+ source: x,
2296
+ sourceIndex: T,
2297
+ target: S,
2298
+ targetIndex: P
2299
2299
  };
2300
- y.push(ve);
2300
+ m.push(ve);
2301
2301
  }
2302
- }), l.push({ nodes: w, edges: y });
2302
+ }), l.push({ nodes: _, edges: m });
2303
2303
  }), l;
2304
2304
  }, Dr = (t, e, r) => {
2305
2305
  const n = /* @__PURE__ */ new Map(), o = Array.isArray(t[0]);
2306
2306
  o ? t.forEach((a, l) => {
2307
2307
  a.forEach((i) => {
2308
- const h = i[e.dataset.from] || `dataset-${l}`;
2309
- n.has(h) || n.set(h, []), n.get(h).push(i);
2308
+ const f = i[e.dataset.from] || `dataset-${l}`;
2309
+ n.has(f) || n.set(f, []), n.get(f).push(i);
2310
2310
  });
2311
2311
  }) : t.forEach((a) => {
2312
2312
  const l = a[e.dataset.from] || "default";
@@ -2318,8 +2318,8 @@ const Ke = {
2318
2318
  else if (e.dataset.sort === "original") {
2319
2319
  const a = [];
2320
2320
  o ? t.forEach((l, i) => {
2321
- l.forEach((h) => {
2322
- const b = h[e.dataset.from] || `dataset-${i}`;
2321
+ l.forEach((f) => {
2322
+ const b = f[e.dataset.from] || `dataset-${i}`;
2323
2323
  a.includes(b) || a.push(b);
2324
2324
  });
2325
2325
  }) : t.forEach((l) => {
@@ -2329,60 +2329,60 @@ const Ke = {
2329
2329
  } else e.dataset.sort === "alphabetical" && s.sort((a, l) => a.localeCompare(l, void 0, { numeric: !0 }));
2330
2330
  const u = [];
2331
2331
  return s.forEach((a, l) => {
2332
- const i = n.get(a), h = /* @__PURE__ */ new Map();
2332
+ const i = n.get(a), f = /* @__PURE__ */ new Map();
2333
2333
  i.forEach((c) => {
2334
- const f = c[e.series.from] || "default";
2335
- h.has(f) || h.set(f, []), h.get(f).push(c);
2334
+ const v = c[e.series.from] || "default";
2335
+ f.has(v) || f.set(v, []), f.get(v).push(c);
2336
2336
  });
2337
- let b = Array.from(h.keys());
2337
+ let b = Array.from(f.keys());
2338
2338
  if (Array.isArray(e.series.sort))
2339
- b = e.series.sort.filter((c) => h.has(c)).concat(b.filter((c) => !e.series.sort.includes(c)));
2339
+ b = e.series.sort.filter((c) => f.has(c)).concat(b.filter((c) => !e.series.sort.includes(c)));
2340
2340
  else if (e.series.sort === "original") {
2341
2341
  const c = [];
2342
- i.forEach((f) => {
2343
- const g = f[e.series.from] || "default";
2344
- c.includes(g) || c.push(g);
2342
+ i.forEach((v) => {
2343
+ const $ = v[e.series.from] || "default";
2344
+ c.includes($) || c.push($);
2345
2345
  }), b = c;
2346
- } else e.series.sort === "alphabetical" && b.sort((c, f) => c.localeCompare(f, void 0, { numeric: !0 }));
2347
- const w = /* @__PURE__ */ new Map();
2346
+ } else e.series.sort === "alphabetical" && b.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
2347
+ const _ = /* @__PURE__ */ new Map();
2348
2348
  i.forEach((c) => {
2349
- const f = c[e.category.from] || "default";
2350
- w.has(f) || w.set(f, []), w.get(f).push(c);
2349
+ const v = c[e.category.from] || "default";
2350
+ _.has(v) || _.set(v, []), _.get(v).push(c);
2351
2351
  });
2352
- let m = Array.from(w.keys());
2352
+ let p = Array.from(_.keys());
2353
2353
  if (Array.isArray(e.category.sort))
2354
- m = e.category.sort.filter((c) => w.has(c)).concat(m.filter((c) => !e.category.sort.includes(c)));
2354
+ p = e.category.sort.filter((c) => _.has(c)).concat(p.filter((c) => !e.category.sort.includes(c)));
2355
2355
  else if (e.category.sort === "original") {
2356
2356
  const c = [];
2357
- i.forEach((f) => {
2358
- const g = f[e.category.from] || "default";
2359
- c.includes(g) || c.push(g);
2360
- }), m = c;
2361
- } else e.category.sort === "alphabetical" && m.sort((c, f) => c.localeCompare(f, void 0, { numeric: !0 }));
2362
- const v = /* @__PURE__ */ new Map();
2357
+ i.forEach((v) => {
2358
+ const $ = v[e.category.from] || "default";
2359
+ 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
+ const A = /* @__PURE__ */ new Map();
2363
2363
  i.forEach((c) => {
2364
- const f = c.id || "unknown";
2365
- v.has(f) || v.set(f, []), v.get(f).push(c);
2364
+ const v = c.id || "unknown";
2365
+ A.has(v) || A.set(v, []), A.get(v).push(c);
2366
2366
  });
2367
- let y = 0;
2368
- const d = b[0] || "default", E = b.indexOf(d), p = /* @__PURE__ */ new Map();
2369
- Array.from(v.entries()).forEach(([c, f]) => {
2370
- const g = f[0], S = g[e.series.from] || "default", $ = b.indexOf(S), O = g[e.category.from] || "default", C = m.indexOf(O);
2367
+ let m = 0;
2368
+ const h = b[0] || "default", w = b.indexOf(h), C = /* @__PURE__ */ new Map();
2369
+ 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);
2371
2371
  if (e.value.aggregate === "none") {
2372
- const L = g[e.value.from], M = {
2372
+ const P = $[e.value.from], j = {
2373
2373
  id: c,
2374
- index: y++,
2374
+ index: m++,
2375
2375
  modelType: "tree",
2376
- name: g.name || c,
2377
- data: g.data,
2378
- value: typeof L == "number" ? L : null,
2379
- color: K(e.color.from, {
2380
- index: y - 1,
2381
- seriesIndex: $,
2382
- categoryIndex: C,
2376
+ name: $.name || c,
2377
+ data: $.data,
2378
+ value: typeof P == "number" ? P : null,
2379
+ color: F(e.color.from, {
2380
+ index: m - 1,
2381
+ seriesIndex: x,
2382
+ categoryIndex: T,
2383
2383
  datasetIndex: l
2384
2384
  }, r),
2385
- parent: g.parent || null,
2385
+ parent: $.parent || null,
2386
2386
  parentIndex: null,
2387
2387
  // 稍後設定
2388
2388
  depth: 0,
@@ -2390,32 +2390,32 @@ const Ke = {
2390
2390
  seq: 0,
2391
2391
  // 稍後計算
2392
2392
  children: [],
2393
- series: S,
2394
- seriesIndex: $,
2395
- category: O,
2396
- categoryIndex: C
2393
+ series: d,
2394
+ seriesIndex: x,
2395
+ category: S,
2396
+ categoryIndex: T
2397
2397
  };
2398
- p.set(c, M);
2398
+ C.set(c, j);
2399
2399
  } else {
2400
- const L = f.map((k) => {
2400
+ const P = v.map((k) => {
2401
2401
  if (e.value.aggregate === "count")
2402
2402
  return 1;
2403
- const F = k[e.value.from];
2404
- return typeof F == "number" ? F : null;
2405
- }), M = pe(L, e.value.aggregate), P = {
2403
+ const K = k[e.value.from];
2404
+ return typeof K == "number" ? K : null;
2405
+ }), j = pe(P, e.value.aggregate), M = {
2406
2406
  id: c,
2407
- index: y++,
2407
+ index: m++,
2408
2408
  modelType: "tree",
2409
- name: g.name || c,
2410
- data: g.data,
2411
- value: M,
2412
- color: K(e.color.from, {
2413
- index: y - 1,
2414
- seriesIndex: $,
2415
- categoryIndex: C,
2409
+ name: $.name || c,
2410
+ data: $.data,
2411
+ value: j,
2412
+ color: F(e.color.from, {
2413
+ index: m - 1,
2414
+ seriesIndex: x,
2415
+ categoryIndex: T,
2416
2416
  datasetIndex: l
2417
2417
  }, r),
2418
- parent: g.parent || null,
2418
+ parent: $.parent || null,
2419
2419
  parentIndex: null,
2420
2420
  // 稍後設定
2421
2421
  depth: 0,
@@ -2423,43 +2423,43 @@ const Ke = {
2423
2423
  seq: 0,
2424
2424
  // 稍後計算
2425
2425
  children: [],
2426
- series: S,
2427
- seriesIndex: $,
2428
- category: O,
2429
- categoryIndex: C
2426
+ series: d,
2427
+ seriesIndex: x,
2428
+ category: S,
2429
+ categoryIndex: T
2430
2430
  };
2431
- p.set(c, P);
2431
+ C.set(c, M);
2432
2432
  }
2433
2433
  });
2434
- const _ = Array.from(p.values()), T = /* @__PURE__ */ new Map();
2435
- _.forEach((c) => {
2436
- T.set(c.id, c.index);
2437
- }), _.forEach((c) => {
2438
- c.parent && T.has(c.parent) && (c.parentIndex = T.get(c.parent));
2434
+ const O = Array.from(C.values()), y = /* @__PURE__ */ new Map();
2435
+ O.forEach((c) => {
2436
+ y.set(c.id, c.index);
2437
+ }), O.forEach((c) => {
2438
+ c.parent && y.has(c.parent) && (c.parentIndex = y.get(c.parent));
2439
2439
  });
2440
- const A = [], x = /* @__PURE__ */ new Map();
2441
- _.forEach((c) => {
2442
- c.parent === null ? A.push(c) : (x.has(c.parent) || x.set(c.parent, []), x.get(c.parent).push(c));
2440
+ const g = [], E = /* @__PURE__ */ new Map();
2441
+ O.forEach((c) => {
2442
+ c.parent === null ? g.push(c) : (E.has(c.parent) || E.set(c.parent, []), E.get(c.parent).push(c));
2443
2443
  });
2444
- function B(c, f) {
2445
- c.depth = f;
2446
- const g = x.get(c.id) || [];
2447
- return e.value.sort === "asc" ? g.sort((S, $) => S.value === null && $.value === null ? 0 : S.value === null ? 1 : $.value === null ? -1 : S.value - $.value) : e.value.sort === "desc" && g.sort((S, $) => S.value === null && $.value === null ? 0 : S.value === null ? 1 : $.value === null ? -1 : $.value - S.value), g.forEach((S, $) => {
2448
- S.seq = $;
2449
- }), c.children = g.map((S) => B(S, f + 1)), c;
2444
+ function B(c, v) {
2445
+ c.depth = v;
2446
+ 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;
2450
2450
  }
2451
- const I = A.map((c) => B(c, 0));
2451
+ const I = g.map((c) => B(c, 0));
2452
2452
  if (I.length === 0)
2453
2453
  u.push({
2454
2454
  id: `empty-${a}`,
2455
- index: y++,
2455
+ index: m++,
2456
2456
  modelType: "tree",
2457
2457
  name: "Empty Tree",
2458
2458
  data: {},
2459
2459
  value: null,
2460
- color: K(e.color.from, {
2461
- index: y - 1,
2462
- seriesIndex: E < 0 ? 0 : E,
2460
+ color: F(e.color.from, {
2461
+ index: m - 1,
2462
+ seriesIndex: w < 0 ? 0 : w,
2463
2463
  categoryIndex: 0,
2464
2464
  datasetIndex: l
2465
2465
  }, r),
@@ -2468,8 +2468,8 @@ const Ke = {
2468
2468
  depth: 0,
2469
2469
  seq: 0,
2470
2470
  children: [],
2471
- series: d,
2472
- seriesIndex: E < 0 ? 0 : E,
2471
+ series: h,
2472
+ seriesIndex: w < 0 ? 0 : w,
2473
2473
  category: "default",
2474
2474
  categoryIndex: 0
2475
2475
  });
@@ -2478,14 +2478,14 @@ const Ke = {
2478
2478
  else {
2479
2479
  const c = {
2480
2480
  id: `virtual-root-${a}`,
2481
- index: y++,
2481
+ index: m++,
2482
2482
  modelType: "tree",
2483
2483
  name: `Virtual Root (${a})`,
2484
2484
  data: {},
2485
2485
  value: null,
2486
- color: K(e.color.from, {
2487
- index: y - 1,
2488
- seriesIndex: E < 0 ? 0 : E,
2486
+ color: F(e.color.from, {
2487
+ index: m - 1,
2488
+ seriesIndex: w < 0 ? 0 : w,
2489
2489
  categoryIndex: 0,
2490
2490
  datasetIndex: l
2491
2491
  }, r),
@@ -2493,12 +2493,12 @@ const Ke = {
2493
2493
  parentIndex: null,
2494
2494
  depth: 0,
2495
2495
  seq: 0,
2496
- children: I.map((f, g) => {
2497
- const S = ($, O) => ($.depth = O, O === 1 && ($.seq = g), $.children = $.children.map((C) => S(C, O + 1)), $);
2498
- return S(f, 1);
2496
+ 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
2499
  }),
2500
- series: d,
2501
- seriesIndex: E < 0 ? 0 : E,
2500
+ series: h,
2501
+ seriesIndex: w < 0 ? 0 : w,
2502
2502
  category: "default",
2503
2503
  categoryIndex: 0
2504
2504
  };
@@ -2526,13 +2526,13 @@ function Nr(t, e, r) {
2526
2526
  }
2527
2527
  function Ne(t, e, r, n, o) {
2528
2528
  Object.keys(r).filter((i) => !e.includes(i)).forEach((i) => {
2529
- const h = r[i];
2530
- h && h.parentNode === t && t.removeChild(h), delete r[i];
2529
+ const f = r[i];
2530
+ f && f.parentNode === t && t.removeChild(f), delete r[i];
2531
2531
  });
2532
2532
  const a = e.filter((i) => !r[i]);
2533
2533
  a.forEach((i) => {
2534
- const h = n(i);
2535
- r[i] = h, t.appendChild(h);
2534
+ const f = n(i);
2535
+ r[i] = f, t.appendChild(f);
2536
2536
  }), e.filter((i) => r[i] && !a.includes(i)).forEach((i) => {
2537
2537
  r[i];
2538
2538
  }), e.length > 0 && Nr(t, e, r);
@@ -2803,386 +2803,388 @@ function qr(t) {
2803
2803
  }
2804
2804
  function Gr({ svgElement$: t, canvasElement$: e, pluginsInstance$: r }) {
2805
2805
  let n = [], o = [];
2806
- const s = (l, i, h) => {
2807
- const b = r.getValue().reduce((v, y, d) => (v[y._getId()] = d, v), {}), w = h.map((v) => ({
2808
- ...v,
2809
- pluginSeq: b[v.pluginId]
2806
+ const s = (l, i, f) => {
2807
+ const b = r.getValue().reduce((A, m, h) => (A[m._getId()] = h, A), {}), _ = f.map((A) => ({
2808
+ ...A,
2809
+ pluginSeq: b[A.pluginId]
2810
2810
  }));
2811
- return (l === "svg" ? n : o).filter((v) => v.pluginId !== i).map((v) => ({
2812
- ...v,
2813
- pluginSeq: b[v.pluginId]
2814
- })).concat(w).sort((v, y) => v.layerIndex - y.layerIndex || v.pluginSeq - y.pluginSeq);
2811
+ return (l === "svg" ? n : o).filter((A) => A.pluginId !== i).map((A) => ({
2812
+ ...A,
2813
+ pluginSeq: b[A.pluginId]
2814
+ })).concat(_).sort((A, m) => A.layerIndex - m.layerIndex || A.pluginSeq - m.pluginSeq);
2815
2815
  }, u = {}, a = {};
2816
- return (l, i, h) => {
2816
+ return (l, i, f) => {
2817
2817
  const b = l === "svg" ? t.getValue() : e.getValue();
2818
2818
  if (!b)
2819
2819
  return {};
2820
- const w = l === "svg" ? u : a, m = s(l, i, h), v = m.map((d) => jr(d.pluginId, d.layerName));
2820
+ const _ = l === "svg" ? u : a, p = s(l, i, f), A = p.map((h) => Mr(h.pluginId, h.layerName));
2821
2821
  return l === "svg" ? (Ne(
2822
2822
  b,
2823
- v,
2824
- w,
2825
- (d) => Br(d)
2826
- ), n = m) : (Ne(
2823
+ A,
2824
+ _,
2825
+ (h) => Br(h)
2826
+ ), n = p) : (Ne(
2827
2827
  b,
2828
- v,
2829
- w,
2830
- (d) => ft(d)
2831
- ), o = m), Object.entries(w).reduce((d, [E, p]) => {
2832
- const [_, T, A] = E.split("-");
2833
- return T === i && (d[A] = p), d;
2828
+ 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;
2834
2834
  }, {});
2835
2835
  };
2836
2836
  }
2837
2837
  const Wr = (t, e) => {
2838
2838
  try {
2839
- const { status: v, columnName: y, expectToBe: d } = qr(e);
2840
- if (v === "error")
2841
- throw new Error(Z({
2842
- columnName: y,
2843
- expectToBe: d,
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,
2844
2844
  from: "Chart.constructor"
2845
2845
  }));
2846
- if (v === "warning")
2847
- console.warn(J({
2848
- columnName: y,
2849
- expectToBe: d,
2846
+ if (h === "warning")
2847
+ console.warn(H({
2848
+ columnName: w,
2849
+ expectToBe: C,
2850
2850
  from: "Chart.constructor"
2851
2851
  }));
2852
2852
  else {
2853
- const { status: E, columnName: p, expectToBe: _ } = Ur(t);
2854
- if (E === "error")
2855
- throw new Error(Z({
2856
- columnName: p,
2857
- expectToBe: _,
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,
2858
2858
  from: "Chart.constructor"
2859
2859
  }));
2860
- E === "warning" && console.warn(J({
2861
- columnName: p,
2862
- expectToBe: _,
2860
+ O === "warning" && console.warn(H({
2861
+ columnName: y,
2862
+ expectToBe: g,
2863
2863
  from: "Chart.constructor"
2864
2864
  }));
2865
2865
  }
2866
- } catch (v) {
2867
- throw new Error(v);
2866
+ } catch (h) {
2867
+ throw new Error(h);
2868
2868
  }
2869
- const r = new oe(), n = new D((e == null ? void 0 : e.data) || []), o = e && e.encoding ? H(Fe, e.encoding) : Fe, s = new D(o), u = e && e.theme ? H(De, e.theme) : De, a = new D(u), l = new D((e == null ? void 0 : e.plugins) || []), i = e && e.size ? H(Ke, e.size) : Ke, h = new D(i), b = new D(null), w = new D(null), m = (() => {
2870
- const v = h.pipe(
2871
- br((f) => fr(
2872
- () => f.width === "auto" || f.height === "auto",
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",
2873
2873
  // 有 'auto' 的話就監聽element的尺寸
2874
- kr(t).pipe(
2875
- q((g) => ({
2876
- width: f.width === "auto" ? g.width : f.width,
2877
- height: f.height === "auto" ? g.height <= 0 ? g.width : g.height : f.height
2874
+ jr(t).pipe(
2875
+ 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
2878
  })),
2879
- G(f.resizeDebounce),
2880
- pr((g, S) => JSON.stringify(g) === JSON.stringify(S))
2879
+ G(d.resizeDebounce),
2880
+ pr((x, S) => JSON.stringify(x) === JSON.stringify(S))
2881
2881
  ),
2882
2882
  Qt({
2883
- width: f.width,
2884
- height: f.height
2883
+ width: d.width,
2884
+ height: d.height
2885
2885
  })
2886
2886
  )),
2887
2887
  wr(r),
2888
2888
  te(1)
2889
- ), y = s.asObservable().pipe(
2889
+ ), w = s.asObservable().pipe(
2890
2890
  te(1)
2891
- ), d = Y([
2891
+ ), C = Z([
2892
2892
  n,
2893
2893
  s,
2894
2894
  a
2895
2895
  ]).pipe(
2896
2896
  G(0),
2897
- q(([f, g, S]) => {
2897
+ q(([d, x, S]) => {
2898
2898
  try {
2899
- return Vr(f, g, S);
2900
- } catch ($) {
2899
+ return Vr(d, x, S);
2900
+ } catch (T) {
2901
2901
  throw new Error(fe({
2902
2902
  from: "Chart.seriesData$",
2903
- systemMessage: $
2903
+ systemMessage: T
2904
2904
  }));
2905
2905
  }
2906
2906
  }),
2907
- ae((f) => (console.error(z(f)), se)),
2907
+ ae((d) => (console.error(z(d)), se)),
2908
2908
  te(1)
2909
- ), E = Y([
2909
+ ), O = Z([
2910
2910
  n,
2911
2911
  s,
2912
2912
  a
2913
2913
  ]).pipe(
2914
2914
  G(0),
2915
- q(([f, g, S]) => {
2915
+ q(([d, x, S]) => {
2916
2916
  try {
2917
- return Rr(f, g, S);
2918
- } catch ($) {
2917
+ return Rr(d, x, S);
2918
+ } catch (T) {
2919
2919
  throw new Error(fe({
2920
2920
  from: "Chart.gridData$",
2921
- systemMessage: $
2921
+ systemMessage: T
2922
2922
  }));
2923
2923
  }
2924
2924
  }),
2925
- ae((f) => (console.error(z(f)), se)),
2925
+ ae((d) => (console.error(z(d)), se)),
2926
2926
  te(1)
2927
- ), p = Y([
2927
+ ), y = Z([
2928
2928
  n,
2929
2929
  s,
2930
2930
  a
2931
2931
  ]).pipe(
2932
2932
  G(0),
2933
- q(([f, g, S]) => {
2933
+ q(([d, x, S]) => {
2934
2934
  try {
2935
- return Kr(f, g, S);
2936
- } catch ($) {
2935
+ return Kr(d, x, S);
2936
+ } catch (T) {
2937
2937
  throw new Error(fe({
2938
2938
  from: "Chart.multivariateData$",
2939
- systemMessage: $
2939
+ systemMessage: T
2940
2940
  }));
2941
2941
  }
2942
2942
  }),
2943
- ae((f) => (console.error(z(f)), se)),
2943
+ ae((d) => (console.error(z(d)), se)),
2944
2944
  te(1)
2945
- ), _ = Y([
2945
+ ), g = Z([
2946
2946
  n,
2947
2947
  s,
2948
2948
  a
2949
2949
  ]).pipe(
2950
2950
  G(0),
2951
- q(([f, g, S]) => {
2951
+ q(([d, x, S]) => {
2952
2952
  try {
2953
- return Fr(f, g, S);
2954
- } catch ($) {
2953
+ return Fr(d, x, S);
2954
+ } catch (T) {
2955
2955
  throw new Error(fe({
2956
2956
  from: "Chart.graphData$",
2957
- systemMessage: $
2957
+ systemMessage: T
2958
2958
  }));
2959
2959
  }
2960
2960
  }),
2961
- ae((f) => (console.error(z(f)), se)),
2961
+ ae((d) => (console.error(z(d)), se)),
2962
2962
  te(1)
2963
- ), T = Y([
2963
+ ), E = Z([
2964
2964
  n,
2965
2965
  s,
2966
2966
  a
2967
2967
  ]).pipe(
2968
2968
  G(0),
2969
- q(([f, g, S]) => {
2969
+ q(([d, x, S]) => {
2970
2970
  try {
2971
- return Dr(f, g, S);
2972
- } catch ($) {
2971
+ return Dr(d, x, S);
2972
+ } catch (T) {
2973
2973
  throw new Error(fe({
2974
2974
  from: "Chart.treeData$",
2975
- systemMessage: $
2975
+ systemMessage: T
2976
2976
  }));
2977
2977
  }
2978
2978
  }),
2979
- ae((f) => (console.error(z(f)), se)),
2979
+ ae((d) => (console.error(z(d)), se)),
2980
2980
  te(1)
2981
- ), A = new D([]);
2982
- l.subscribe((f) => {
2983
- const g = {}, S = f.map((O) => {
2984
- var L;
2985
- let C = O._getId();
2986
- if (g[C]) {
2987
- const M = ((L = g[C].split("[")[1]) == null ? void 0 : L.split("]")[0]) || "0", P = parseInt(M) + 1;
2988
- C = `${C.split("[")[0]}[${P}]`;
2981
+ ), B = new D([]);
2982
+ l.subscribe((d) => {
2983
+ const x = {}, S = d.map((P) => {
2984
+ 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}]`;
2989
2989
  }
2990
- return g[C] = O._getId(), C;
2990
+ return x[j] = P._getId(), j;
2991
2991
  });
2992
- f.forEach((O, C) => O._setId(S[C]));
2993
- const $ = f.map((O) => ({
2994
- id: O._getId(),
2995
- name: O._name,
2996
- elementType: O._elementType,
2997
- shownLayers: O.getShownLayerNames()
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()
2998
2998
  }));
2999
- A.next($);
2999
+ B.next(T);
3000
3000
  });
3001
- const x = a.asObservable().pipe(
3001
+ const I = a.asObservable().pipe(
3002
3002
  te(1)
3003
- ), B = new oe(), I = B.asObservable().pipe(
3003
+ ), c = new oe(), v = c.asObservable().pipe(
3004
3004
  lt()
3005
3005
  );
3006
3006
  return {
3007
3007
  root: t,
3008
3008
  svg: null,
3009
3009
  canvas: null,
3010
- size$: v,
3011
- encoding$: y,
3012
- seriesData$: d,
3013
- gridData$: E,
3014
- multivariateData$: p,
3015
- graphData$: _,
3016
- treeData$: T,
3017
- plugins$: A,
3018
- theme$: x,
3019
- event$: I,
3020
- eventTrigger$: B,
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,
3021
3021
  _updateLayerElements: Gr({
3022
3022
  svgElement$: b,
3023
- canvasElement$: w,
3023
+ canvasElement$: _,
3024
3024
  pluginsInstance$: l
3025
3025
  })
3026
3026
  };
3027
3027
  })();
3028
- return l.subscribe((v) => {
3029
- let y = !1, d = !1;
3030
- v.forEach((E) => {
3031
- E._elementType === "svg" ? y = !0 : E._elementType === "canvas" && (d = !0);
3032
- }), y && !m.svg ? (m.svg = Cr("orbcharts-root-svg"), m.root.appendChild(m.svg), b.next(m.svg)) : !y && m.svg && (m.svg.remove(), m.svg = null, b.next(null)), d && !m.canvas ? (m.canvas = ft("orbcharts-root-canvas"), m.root.appendChild(m.canvas), w.next(m.canvas)) : !d && m.canvas && (m.canvas.remove(), m.canvas = null, w.next(null)), v.forEach((E) => {
3033
- E._injectContext(m);
3028
+ let A = null;
3029
+ 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);
3034
3036
  });
3035
- }), Y({
3036
- size: m.size$,
3037
+ }), Z({
3038
+ size: p.size$,
3037
3039
  svg: b
3038
3040
  }).pipe(
3039
3041
  G(0),
3040
- ye(({ svg: v }) => !!v)
3041
- ).subscribe(({ size: v, svg: y }) => {
3042
- y && (y.setAttribute("width", v.width.toString()), y.setAttribute("height", v.height.toString()));
3043
- }), Y({
3044
- size: m.size$,
3045
- canvas: w
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: _
3046
3048
  }).pipe(
3047
3049
  G(0),
3048
- ye(({ canvas: v }) => !!v)
3049
- ).subscribe(({ size: v, canvas: y }) => {
3050
- y && (y.width = v.width, y.height = v.height);
3050
+ ye(({ canvas: h }) => !!h)
3051
+ ).subscribe(({ size: h, canvas: w }) => {
3052
+ w && (w.width = h.width, w.height = h.height);
3051
3053
  }), /* @__PURE__ */ (() => {
3052
- function v(f) {
3053
- h.next(f);
3054
+ function h(d) {
3055
+ f.next(d);
3054
3056
  }
3055
- function y(f) {
3057
+ function w(d) {
3056
3058
  try {
3057
- const { status: g, columnName: S, expectToBe: $ } = dt(f);
3058
- if (g === "error")
3059
- throw new Error(Z({
3059
+ const { status: x, columnName: S, expectToBe: T } = dt(d);
3060
+ if (x === "error")
3061
+ throw new Error(J({
3060
3062
  columnName: S,
3061
- expectToBe: $,
3063
+ expectToBe: T,
3062
3064
  from: "Chart.setData"
3063
3065
  }));
3064
- g === "warning" && console.warn(J({
3066
+ x === "warning" && console.warn(H({
3065
3067
  columnName: S,
3066
- expectToBe: $,
3068
+ expectToBe: T,
3067
3069
  from: "Chart.setData"
3068
3070
  }));
3069
- } catch (g) {
3070
- console.error(z(g));
3071
+ } catch (x) {
3072
+ console.error(z(x));
3071
3073
  }
3072
- n.next(f);
3074
+ n.next(d);
3073
3075
  }
3074
- function d(f) {
3076
+ function C(d) {
3075
3077
  try {
3076
- const { status: S, columnName: $, expectToBe: O } = pt(f);
3078
+ const { status: S, columnName: T, expectToBe: P } = pt(d);
3077
3079
  if (S === "error")
3078
- throw new Error(Z({
3079
- columnName: $,
3080
- expectToBe: O,
3080
+ throw new Error(J({
3081
+ columnName: T,
3082
+ expectToBe: P,
3081
3083
  from: "Chart.updateEncoding"
3082
3084
  }));
3083
- S === "warning" && console.warn(J({
3084
- columnName: $,
3085
- expectToBe: O,
3085
+ S === "warning" && console.warn(H({
3086
+ columnName: T,
3087
+ expectToBe: P,
3086
3088
  from: "Chart.updateEncoding"
3087
3089
  }));
3088
3090
  } catch (S) {
3089
3091
  console.error(z(S));
3090
3092
  }
3091
- const g = H(s.getValue(), f);
3092
- s.next(g);
3093
+ const x = W(s.getValue(), d);
3094
+ s.next(x);
3093
3095
  }
3094
- function E(f) {
3095
- s.next(f);
3096
+ function O(d) {
3097
+ s.next(d);
3096
3098
  }
3097
- function p() {
3099
+ function y() {
3098
3100
  return s.getValue();
3099
3101
  }
3100
- function _(f) {
3102
+ function g(d) {
3101
3103
  try {
3102
- const { status: g, columnName: S, expectToBe: $ } = $e(f);
3103
- if (g === "error")
3104
- throw new Error(Z({
3104
+ const { status: x, columnName: S, expectToBe: T } = $e(d);
3105
+ if (x === "error")
3106
+ throw new Error(J({
3105
3107
  columnName: S,
3106
- expectToBe: $,
3108
+ expectToBe: T,
3107
3109
  from: "Chart.setPlugins"
3108
3110
  }));
3109
- g === "warning" && console.warn(J({
3111
+ x === "warning" && console.warn(H({
3110
3112
  columnName: S,
3111
- expectToBe: $,
3113
+ expectToBe: T,
3112
3114
  from: "Chart.setPlugins"
3113
3115
  }));
3114
- } catch (g) {
3115
- console.error(z(g));
3116
+ } catch (x) {
3117
+ console.error(z(x));
3116
3118
  }
3117
- l.next(f);
3119
+ l.next(d);
3118
3120
  }
3119
- function T(f) {
3121
+ function E(d) {
3120
3122
  try {
3121
- const { status: g, columnName: S, expectToBe: $ } = $e([f]);
3122
- if (g === "error")
3123
- throw new Error(Z({
3123
+ const { status: x, columnName: S, expectToBe: T } = $e([d]);
3124
+ if (x === "error")
3125
+ throw new Error(J({
3124
3126
  columnName: S,
3125
- expectToBe: $,
3127
+ expectToBe: T,
3126
3128
  from: "Chart.addPlugin"
3127
3129
  }));
3128
- g === "warning" && console.warn(J({
3130
+ x === "warning" && console.warn(H({
3129
3131
  columnName: S,
3130
- expectToBe: $,
3132
+ expectToBe: T,
3131
3133
  from: "Chart.addPlugin"
3132
3134
  }));
3133
- } catch (g) {
3134
- console.error(z(g));
3135
+ } catch (x) {
3136
+ console.error(z(x));
3135
3137
  }
3136
- l.next([...l.getValue(), f]);
3138
+ l.next([...l.getValue(), d]);
3137
3139
  }
3138
- function A(f) {
3139
- l.next(l.getValue().filter((g) => g._getId() !== f));
3140
+ function B(d) {
3141
+ l.next(l.getValue().filter((x) => x._getId() !== d));
3140
3142
  }
3141
- function x(f) {
3143
+ function I(d) {
3142
3144
  try {
3143
- const { status: S, columnName: $, expectToBe: O } = yt(f);
3145
+ const { status: S, columnName: T, expectToBe: P } = yt(d);
3144
3146
  if (S === "error")
3145
- throw new Error(Z({
3146
- columnName: $,
3147
- expectToBe: O,
3147
+ throw new Error(J({
3148
+ columnName: T,
3149
+ expectToBe: P,
3148
3150
  from: "Chart.updateTheme"
3149
3151
  }));
3150
- S === "warning" && console.warn(J({
3151
- columnName: $,
3152
- expectToBe: O,
3152
+ S === "warning" && console.warn(H({
3153
+ columnName: T,
3154
+ expectToBe: P,
3153
3155
  from: "Chart.updateTheme"
3154
3156
  }));
3155
3157
  } catch (S) {
3156
3158
  console.error(z(S));
3157
3159
  }
3158
- const g = H(a.getValue(), f);
3159
- a.next(g);
3160
+ const x = W(a.getValue(), d);
3161
+ a.next(x);
3160
3162
  }
3161
- function B(f) {
3162
- a.next(f);
3163
+ function c(d) {
3164
+ a.next(d);
3163
3165
  }
3164
- function I() {
3166
+ function v() {
3165
3167
  return a.getValue();
3166
3168
  }
3167
- function c() {
3168
- r.next(void 0), Pr(t);
3169
+ function $() {
3170
+ r.next(void 0), Pr(t), A = null;
3169
3171
  }
3170
3172
  return {
3171
- resize: v,
3172
- setData: y,
3173
+ resize: h,
3174
+ setData: w,
3173
3175
  // setEncoding,
3174
- updateEncoding: d,
3175
- forceReplaceEncoding: E,
3176
- getEncoding: p,
3177
- setPlugins: _,
3178
- addPlugin: T,
3179
- removePlugin: A,
3176
+ updateEncoding: C,
3177
+ forceReplaceEncoding: O,
3178
+ getEncoding: y,
3179
+ setPlugins: g,
3180
+ addPlugin: E,
3181
+ removePlugin: B,
3180
3182
  // setTheme,
3181
- updateTheme: x,
3182
- forceReplaceTheme: B,
3183
- getTheme: I,
3184
- destroy: c,
3185
- context: m
3183
+ updateTheme: I,
3184
+ forceReplaceTheme: c,
3185
+ getTheme: v,
3186
+ destroy: $,
3187
+ context: p
3186
3188
  };
3187
3189
  })();
3188
3190
  };
@@ -3195,100 +3197,104 @@ const mt = (t, e, r) => {
3195
3197
  let n = e.name, o = () => {
3196
3198
  };
3197
3199
  const s = new D(null), u = s.pipe(
3198
- ye((p) => p !== null)
3199
- ), a = {
3200
+ ye((y) => y !== null)
3201
+ ), a = e.layers.map((y) => new y()), l = {
3200
3202
  // 將陣列轉成字典
3201
- ...e.layers.reduce((p, _) => (p[_._name] = _, p), {})
3202
- }, l = () => new Set(e.layers.map((p) => p._name)), i = (p) => {
3203
- if (p) {
3204
- const _ = l();
3205
- return Object.keys(p).filter((A) => _.has(A));
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));
3206
3208
  }
3207
3209
  return [];
3208
- }, h = e.layers.reduce((p, _) => (_._initShow && p.push(_._name), p), []), b = i(r), w = new D(
3209
- new Set(b.length > 0 ? b : h)
3210
- ), m = w.pipe(
3211
- q((p) => Array.from(p).map((T) => {
3212
- var A;
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;
3213
3215
  return [
3214
- T,
3215
- ((A = e.layers.find((x) => x._name === T)) == null ? void 0 : A._layerIndex) ?? -1
3216
+ E,
3217
+ ((B = a.find((I) => I._name === E)) == null ? void 0 : B._layerIndex) ?? -1
3216
3218
  ];
3217
- }).filter(([, T]) => T !== -1).sort((T, A) => T[1] - A[1]).map(([T]) => T))
3218
- ), v = new D(
3219
+ }).filter(([, E]) => E !== -1).sort((E, B) => E[1] - B[1]).map(([E]) => E))
3220
+ );
3221
+ let m = W(
3222
+ e.defaultParams ?? {},
3219
3223
  r ?? {}
3220
- ), y = new oe(), d = new R((p) => {
3221
- v.subscribe((_) => {
3224
+ );
3225
+ const h = new D(
3226
+ r ?? {}
3227
+ ), w = new oe(), C = new R((y) => {
3228
+ h.subscribe((g) => {
3222
3229
  try {
3223
- const { status: A, columnName: x, expectToBe: B } = e.validator(_);
3224
- if (A === "error")
3225
- throw new Error(Z({
3226
- columnName: x,
3227
- expectToBe: B,
3230
+ const { status: E, columnName: B, expectToBe: I } = e.validator(g);
3231
+ if (E === "error")
3232
+ throw new Error(J({
3233
+ columnName: B,
3234
+ expectToBe: I,
3228
3235
  from: `${e.name}.params$`
3229
3236
  }));
3230
- A === "warning" && console.warn(J({
3231
- columnName: x,
3232
- expectToBe: B,
3237
+ E === "warning" && console.warn(H({
3238
+ columnName: B,
3239
+ expectToBe: I,
3233
3240
  from: `${e.name}.params$`
3234
3241
  }));
3235
- } catch (A) {
3236
- console.error(z(A));
3242
+ } catch (E) {
3243
+ console.error(z(E));
3237
3244
  }
3238
- const T = H(e.defaultParams, _ ?? {});
3239
- p.next(T);
3240
- }), y.subscribe((_) => {
3241
- p.next(_);
3245
+ y.next(m);
3246
+ }), w.subscribe((g) => {
3247
+ y.next(g);
3242
3248
  });
3243
- }), E = u.pipe(
3244
- q((p) => ({
3245
- context: p,
3249
+ }), O = u.pipe(
3250
+ q((y) => ({
3251
+ context: y,
3246
3252
  // 初始化時 context 有可能被 in place 擴展
3247
- pluginParams$: d
3253
+ pluginParams$: C
3248
3254
  })),
3249
3255
  gr()
3250
3256
  // 只做初始化
3251
3257
  );
3252
- return Y({
3253
- pluginSetupProps: E,
3254
- ShownLayerNameSet: w,
3255
- shownLayerNamesSeq: m
3258
+ return Z({
3259
+ pluginSetupProps: O,
3260
+ ShownLayerNameSet: p,
3261
+ shownLayerNamesSeq: A
3256
3262
  }).pipe(
3257
3263
  G(0)
3258
- ).subscribe(({ pluginSetupProps: p, ShownLayerNameSet: _, shownLayerNamesSeq: T }) => {
3259
- const A = p.context._updateLayerElements(
3264
+ ).subscribe(({ pluginSetupProps: y, ShownLayerNameSet: g, shownLayerNamesSeq: E }) => {
3265
+ const B = y.context._updateLayerElements(
3260
3266
  t,
3261
3267
  n,
3262
- T.map((x) => ({
3268
+ E.map((I) => ({
3263
3269
  pluginId: n,
3264
3270
  pluginName: e.name,
3265
- layerName: x,
3266
- layerIndex: a[x]._layerIndex
3271
+ layerName: I,
3272
+ layerIndex: l[I]._layerIndex
3267
3273
  }))
3268
3274
  );
3269
- e.setup && (o = e.setup(p)), e.layers.forEach((x) => {
3270
- var B, I;
3271
- if (_.has(x._name)) {
3272
- const c = t === "svg" ? {
3275
+ e.setup && (o = e.setup(y)), a.forEach((I) => {
3276
+ var c, v;
3277
+ if (g.has(I._name)) {
3278
+ const $ = t === "svg" ? {
3273
3279
  // svgG: (pluginSetupProps as PluginSetupProps<'svg', ExtendContext, PluginParams>).svgG.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
3274
- svgG: A[x._name],
3280
+ svgG: B[I._name],
3275
3281
  // canvas: context.root.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
3276
3282
  // context: Object.assign({}, context) as ChartContext<ExtendContext>,
3277
- context: p.context,
3278
- pluginParams$: d,
3279
- initLayerParams: ((B = v.getValue()) == null ? void 0 : B[x._name]) || {}
3283
+ context: y.context,
3284
+ pluginParams$: C,
3285
+ initLayerParams: ((c = h.getValue()) == null ? void 0 : c[I._name]) || {}
3280
3286
  } : {
3281
3287
  // svgG: context.root.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
3282
3288
  // canvas: (pluginSetupProps as PluginSetupProps<'canvas', ExtendContext, PluginParams>).canvas.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
3283
- canvas: A[x._name],
3289
+ canvas: B[I._name],
3284
3290
  // context: Object.assign({}, context) as ChartContext<ExtendContext>,
3285
- context: p.context,
3286
- pluginParams$: d,
3287
- initLayerParams: ((I = v.getValue()) == null ? void 0 : I[x._name]) || {}
3291
+ context: y.context,
3292
+ pluginParams$: C,
3293
+ initLayerParams: ((v = h.getValue()) == null ? void 0 : v[I._name]) || {}
3288
3294
  };
3289
- x._enable(c);
3295
+ I._enable($);
3290
3296
  } else
3291
- x._disable();
3297
+ I._disable();
3292
3298
  });
3293
3299
  }), {
3294
3300
  // name: `${config.name}-${Math.random().toString(36).substr(2, 9)}`,
@@ -3302,51 +3308,56 @@ const mt = (t, e, r) => {
3302
3308
  // contextExtension,
3303
3309
  // layer visibility controls
3304
3310
  _getId: () => n,
3305
- _setId: (p) => {
3306
- n = p;
3311
+ _setId: (y) => {
3312
+ n = y;
3307
3313
  },
3308
3314
  // 由 chart 注入 context
3309
- _injectContext: (p) => {
3310
- s.next(Object.assign({}, p));
3315
+ _injectContext: (y) => {
3316
+ s.next(Object.assign({}, y));
3311
3317
  },
3312
- show: (p) => {
3313
- p = Array.isArray(p) ? p : [p], w.next(/* @__PURE__ */ new Set([...Array.from(w.getValue()), ...p]));
3318
+ show: (y) => {
3319
+ y = Array.isArray(y) ? y : [y], p.next(/* @__PURE__ */ new Set([...Array.from(p.getValue()), ...y]));
3314
3320
  },
3315
- showOnly: (p) => {
3316
- p = Array.isArray(p) ? p : [p], w.next(/* @__PURE__ */ new Set([...p]));
3321
+ showOnly: (y) => {
3322
+ y = Array.isArray(y) ? y : [y], p.next(/* @__PURE__ */ new Set([...y]));
3317
3323
  },
3318
3324
  showAll: () => {
3319
- w.next(l());
3325
+ p.next(i());
3320
3326
  },
3321
- hide: (p) => {
3322
- p = Array.isArray(p) ? p : [p], w.next(/* @__PURE__ */ new Set([...Array.from(w.getValue()).filter((_) => !p.includes(_))]));
3327
+ hide: (y) => {
3328
+ y = Array.isArray(y) ? y : [y], p.next(/* @__PURE__ */ new Set([...Array.from(p.getValue()).filter((g) => !y.includes(g))]));
3323
3329
  },
3324
3330
  hideAll: () => {
3325
- w.next(/* @__PURE__ */ new Set());
3331
+ p.next(/* @__PURE__ */ new Set());
3326
3332
  },
3327
- toggle: (p) => {
3328
- p = Array.isArray(p) ? p : [p], Array.from(w.getValue()).forEach((_) => {
3329
- p.includes(_) ? p.splice(p.indexOf(_), 1) : p.push(_);
3330
- }), w.next(new Set(p));
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));
3331
3337
  },
3332
- getShownLayerNames: () => Array.from(w.getValue()),
3338
+ getShownLayerNames: () => Array.from(p.getValue()),
3333
3339
  // layer params
3334
3340
  // setLayers: (partial: DeepPartial<PluginParams>) => {
3335
3341
  // params = { ...params, ...partial }
3336
3342
  // },
3337
- updateParams: (p) => {
3338
- v.next(p), Object.keys(p).forEach((_) => {
3339
- const T = a[_];
3340
- T && T._updateParams(p[_]);
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]);
3341
3347
  });
3342
3348
  },
3343
- forceReplaceParams: (p) => {
3344
- y.next(p), Object.keys(p).forEach((_) => {
3345
- const T = a[_];
3346
- T && T._forceReplaceParams(p[_]);
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]);
3347
3353
  });
3348
3354
  },
3349
- getParams: () => e.layers.reduce((p, _) => (p[_._name] = _._getParams(), p), {}),
3355
+ getParams: () => {
3356
+ const y = Object.assign({}, m);
3357
+ return a.forEach((g) => {
3358
+ y[g._name] = g._getParams();
3359
+ }), y;
3360
+ },
3350
3361
  // layer: <LayerName extends keyof PluginParams>(name: LayerName) => ({
3351
3362
  // // set: (partial: DeepPartial<PluginParams[LayerName]>) => {
3352
3363
  // // if (params[name]) {
@@ -3372,8 +3383,8 @@ const mt = (t, e, r) => {
3372
3383
  // }
3373
3384
  // }),
3374
3385
  destroy: () => {
3375
- o(), s.complete(), w.complete(), e.layers.forEach((p) => {
3376
- p._destroy();
3386
+ o(), s.complete(), p.complete(), a.forEach((y) => {
3387
+ y._destroy();
3377
3388
  });
3378
3389
  }
3379
3390
  // // outputs
@@ -3392,7 +3403,7 @@ const mt = (t, e, r) => {
3392
3403
  const o = new D(null), s = o.pipe(
3393
3404
  ye((u) => u !== null)
3394
3405
  );
3395
- return Y({
3406
+ return Z({
3396
3407
  layerParams: r,
3397
3408
  enabledProps: s
3398
3409
  }).pipe(
@@ -3405,7 +3416,7 @@ const mt = (t, e, r) => {
3405
3416
  context: a.context,
3406
3417
  pluginParams$: a.pluginParams$,
3407
3418
  layerParams$: r.pipe(
3408
- q((l) => H(l, a.initLayerParams ?? {}))
3419
+ q((l) => W(l, a.initLayerParams ?? {}))
3409
3420
  )
3410
3421
  }) : e.setup({
3411
3422
  // svgG: enabledProps.svgG,
@@ -3414,7 +3425,7 @@ const mt = (t, e, r) => {
3414
3425
  context: a.context,
3415
3426
  pluginParams$: a.pluginParams$,
3416
3427
  layerParams$: r.pipe(
3417
- q((l) => H(l, a.initLayerParams ?? {}))
3428
+ q((l) => W(l, a.initLayerParams ?? {}))
3418
3429
  )
3419
3430
  });
3420
3431
  }), o.pipe(ye((u) => u === null)).subscribe(() => {
@@ -3435,22 +3446,22 @@ const mt = (t, e, r) => {
3435
3446
  // },
3436
3447
  _updateParams: (u) => {
3437
3448
  try {
3438
- const { status: l, columnName: i, expectToBe: h } = e.validator(u);
3449
+ const { status: l, columnName: i, expectToBe: f } = e.validator(u);
3439
3450
  if (l === "error")
3440
- throw new Error(Z({
3451
+ throw new Error(J({
3441
3452
  columnName: i,
3442
- expectToBe: h,
3453
+ expectToBe: f,
3443
3454
  from: `${e.name}.params$`
3444
3455
  }));
3445
- l === "warning" && console.warn(J({
3456
+ l === "warning" && console.warn(H({
3446
3457
  columnName: i,
3447
- expectToBe: h,
3458
+ expectToBe: f,
3448
3459
  from: `${e.name}.params$`
3449
3460
  }));
3450
3461
  } catch (l) {
3451
3462
  console.error(z(l));
3452
3463
  }
3453
- const a = H(r.getValue(), u);
3464
+ const a = W(r.getValue(), u);
3454
3465
  r.next(a);
3455
3466
  },
3456
3467
  _forceReplaceParams: (u) => {
@@ -3486,22 +3497,22 @@ export {
3486
3497
  ft as createCanvas,
3487
3498
  Zr as createCanvasElement,
3488
3499
  Jr as createDiv,
3489
- jr as createLayerClassName,
3500
+ Mr as createLayerClassName,
3490
3501
  ht as createMessagePrefix,
3491
3502
  z as createOrbChartsErrorMessage,
3492
- Mr as createPluginClassName,
3503
+ kr as createPluginClassName,
3493
3504
  Cr as createSVG,
3494
3505
  Br as createSVGGroup,
3495
3506
  fe as createUnexpectedErrorMessage,
3496
- Z as createValidatorErrorMessage,
3497
- J as createValidatorWarningMessage,
3498
- H as deepOverwrite,
3507
+ J as createValidatorErrorMessage,
3508
+ H as createValidatorWarningMessage,
3509
+ W as deepOverwrite,
3499
3510
  on as defineCanvasLayer,
3500
3511
  rn as defineCanvasPlugin,
3501
3512
  en as defineSVGLayer,
3502
3513
  Qr as defineSVGPlugin,
3503
3514
  Yr as formatCommaNumber,
3504
- K as getColorByFrom,
3515
+ F as getColorByFrom,
3505
3516
  Or as getColorByIndex,
3506
3517
  ct as isDom,
3507
3518
  Ir as isFunction,
@@ -3512,7 +3523,7 @@ export {
3512
3523
  Sr as min,
3513
3524
  Tr as none,
3514
3525
  Pr as removeElementChildren,
3515
- kr as resizeObservable,
3526
+ jr as resizeObservable,
3516
3527
  Er as sum,
3517
3528
  V as validateObject
3518
3529
  };