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

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