@orbcharts/core 4.0.0-pre-alpha.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/orbcharts-core.es.js +1662 -1589
- package/dist/orbcharts-core.umd.js +6 -6
- package/dist/src/test/simple-graph-test.d.ts +1 -2
- package/dist/src/types/Encoding.d.ts +4 -1
- package/dist/src/types/Plugin.d.ts +1 -1
- package/dist/src/utils/colorUtils.d.ts +1 -1
- package/dist/src/utils/encodingUtils.d.ts +11 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/chart/createChart.ts +47 -4
- package/src/chart/createGraphData.ts +20 -19
- package/src/chart/createGridData.ts +12 -11
- package/src/chart/createMultivariateData.ts +10 -9
- package/src/chart/createSeriesData.ts +15 -14
- package/src/chart/createTreeData.ts +18 -17
- package/src/chart/defaults.ts +47 -24
- package/src/plugin/createPlugin.ts +33 -15
- package/src/test/createGraphData.test.ts +1 -1
- package/src/test/createTreeData.test.ts +1 -1
- package/src/test/simple-graph-test.js +1 -1
- package/src/types/Encoding.ts +4 -1
- package/src/types/Plugin.ts +4 -1
- package/src/utils/colorUtils.ts +1 -1
- package/src/utils/encodingUtils.ts +18 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/validator.ts +10 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`+r.map(function(n,
|
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=r}});function be(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var pe=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,o,s;if(!this.closed){this.closed=!0;var u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var a=ie(u),l=a.next();!l.done;l=a.next()){var i=l.value;i.remove(this)}}catch(y){e={error:y}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else u.remove(this);var h=this.initialTeardown;if(V(h))try{h()}catch(y){s=y instanceof Ae?y.errors:[y]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var w=ie(b),m=w.next();!m.done;m=w.next()){var v=m.value;try{Fe(v)}catch(y){s=s??[],y instanceof Ae?s=le(le([],ue(s)),ue(y.errors)):s.push(y)}}}catch(y){n={error:y}}finally{try{m&&!m.done&&(o=w.return)&&o.call(w)}finally{if(n)throw n.error}}}if(s)throw new Ae(s)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Fe(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&be(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&be(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Le=pe.EMPTY;function Re(t){return t instanceof pe||t&&"closed"in t&&V(t.remove)&&V(t.add)&&V(t.unsubscribe)}function Fe(t){V(t)?t():t.unsubscribe()}var Lt={Promise:void 0},Rt={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,le([t,e],ue(r)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Ke(t){Rt.setTimeout(function(){throw t})}function _e(){}function we(t){t()}var Ce=function(t){W(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Re(r)&&r.add(n)):n.destination=Dt,n}return e.create=function(r,n,o){return new me(r,n,o)},e.prototype.next=function(r){this.isStopped||this._next(r)},e.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(pe),Ft=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){Ee(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Ee(n)}else Ee(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Ee(r)}},t}(),me=function(t){W(e,t);function e(r,n,o){var s=t.call(this)||this,u;return V(r)||!r?u={next:r??void 0,error:n??void 0,complete:o??void 0}:u=r,s.destination=new Ft(u),s}return e}(Ce);function Ee(t){Ke(t)}function Kt(t){throw t}var Dt={closed:!0,next:_e,error:Kt,complete:_e},Oe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function ve(t){return t}function Nt(t){return t.length===0?ve:t.length===1?t[0]:function(r){return t.reduce(function(n,o){return o(n)},r)}}var F=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var o=this,s=Ut(e)?e:new me(e,r,n);return we(function(){var u=o,a=u.operator,l=u.source;s.add(a?a.call(s,l):l?o._subscribe(s):o._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=De(r),new r(function(o,s){var u=new me({next:function(a){try{e(a)}catch(l){s(l),u.unsubscribe()}},error:s,complete:o});n.subscribe(u)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[Oe]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Nt(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=De(e),new e(function(n,o){var s;r.subscribe(function(u){return s=u},function(u){return o(u)},function(){return n(s)})})},t.create=function(e){return new t(e)},t}();function De(t){var e;return(e=t??Lt.Promise)!==null&&e!==void 0?e:Promise}function Gt(t){return t&&V(t.next)&&V(t.error)&&V(t.complete)}function Ut(t){return t&&t instanceof Ce||Gt(t)&&Re(t)}function zt(t){return V(t==null?void 0:t.lift)}function D(t){return function(e){if(zt(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function N(t,e,r,n,o){return new qt(t,e,r,n,o)}var qt=function(t){W(e,t);function e(r,n,o,s,u,a){var l=t.call(this,r)||this;return l.onFinalize=u,l.shouldUnsubscribe=a,l._next=n?function(i){try{n(i)}catch(h){r.error(h)}}:t.prototype._next,l._error=s?function(i){try{s(i)}catch(h){r.error(h)}finally{this.unsubscribe()}}:t.prototype._error,l._complete=o?function(){try{o()}catch(i){r.error(i)}finally{this.unsubscribe()}}:t.prototype._complete,l}return e.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},e}(Ce),Wt=Se(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),se=function(t){W(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new Ne(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Wt},e.prototype.next=function(r){var n=this;we(function(){var o,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var u=ie(n.currentObservers),a=u.next();!a.done;a=u.next()){var l=a.value;l.next(r)}}catch(i){o={error:i}}finally{try{a&&!a.done&&(s=u.return)&&s.call(u)}finally{if(o)throw o.error}}}})},e.prototype.error=function(r){var n=this;we(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var o=n.observers;o.length;)o.shift().error(r)}})},e.prototype.complete=function(){var r=this;we(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,o=this,s=o.hasError,u=o.isStopped,a=o.observers;return s||u?Le:(this.currentObservers=null,a.push(r),new pe(function(){n.currentObservers=null,be(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,s=n.thrownError,u=n.isStopped;o?r.error(s):u&&r.complete()},e.prototype.asObservable=function(){var r=new F;return r.source=this,r},e.create=function(r,n){return new Ne(r,n)},e}(F),Ne=function(t){W(e,t);function e(r,n){var o=t.call(this)||this;return o.destination=r,o.source=n,o}return e.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},e.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Le},e}(se),G=function(t){W(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,o=r.thrownError,s=r._value;if(n)throw o;return this._throwIfClosed(),s},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e}(se),$e={now:function(){return($e.delegate||Date).now()},delegate:void 0},Yt=function(t){W(e,t);function e(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=$e);var s=t.call(this)||this;return s._bufferSize=r,s._windowTime=n,s._timestampProvider=o,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=n===1/0,s._bufferSize=Math.max(1,r),s._windowTime=Math.max(1,n),s}return e.prototype.next=function(r){var n=this,o=n.isStopped,s=n._buffer,u=n._infiniteTimeWindow,a=n._timestampProvider,l=n._windowTime;o||(s.push(r),!u&&s.push(a.now()+l)),this._trimBuffer(),t.prototype.next.call(this,r)},e.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,s=o._infiniteTimeWindow,u=o._buffer,a=u.slice(),l=0;l<a.length&&!r.closed;l+=s?1:2)r.next(a[l]);return this._checkFinalizedStatuses(r),n},e.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,o=r._timestampProvider,s=r._buffer,u=r._infiniteTimeWindow,a=(u?1:2)*n;if(n<1/0&&a<s.length&&s.splice(0,s.length-a),!u){for(var l=o.now(),i=0,h=1;h<s.length&&s[h]<=l;h+=2)i=h;i&&s.splice(0,i+1)}},e}(se),Zt=function(t){W(e,t);function e(r,n){return t.call(this)||this}return e.prototype.schedule=function(r,n){return this},e}(pe),Ge={setInterval:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,le([t,e],ue(r)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Jt=function(t){W(e,t);function e(r,n){var o=t.call(this,r,n)||this;return o.scheduler=r,o.work=n,o.pending=!1,o}return e.prototype.schedule=function(r,n){var o;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var s=this.id,u=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(u,s,n)),this.pending=!0,this.delay=n,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(u,this.id,n),this},e.prototype.requestAsyncId=function(r,n,o){return o===void 0&&(o=0),Ge.setInterval(r.flush.bind(r,this),o)},e.prototype.recycleAsyncId=function(r,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&Ge.clearInterval(n)},e.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(r,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(r,n){var o=!1,s;try{this.work(r)}catch(u){o=!0,s=u||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,o=r.scheduler,s=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,be(s,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Zt),Ue=function(){function t(e,r){r===void 0&&(r=t.now),this.schedulerActionCtor=e,this.now=r}return t.prototype.schedule=function(e,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,e).schedule(n,r)},t.now=$e.now,t}(),Ht=function(t){W(e,t);function e(r,n){n===void 0&&(n=Ue.now);var o=t.call(this,r,n)||this;return o.actions=[],o._active=!1,o}return e.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var o;this._active=!0;do if(o=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,o){for(;r=n.shift();)r.unsubscribe();throw o}},e}(Ue),Qt=new Ht(Jt),fe=new F(function(t){return t.complete()});function Xt(t){return t&&V(t.schedule)}function ze(t){return t[t.length-1]}function er(t){return V(ze(t))?t.pop():void 0}function qe(t){return Xt(ze(t))?t.pop():void 0}var We=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Ye(t){return V(t==null?void 0:t.then)}function Ze(t){return V(t[Oe])}function Je(t){return Symbol.asyncIterator&&V(t==null?void 0:t[Symbol.asyncIterator])}function He(t){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.")}function tr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Qe=tr();function Xe(t){return V(t==null?void 0:t[Qe])}function et(t){return kt(this,arguments,function(){var r,n,o,s;return Ve(this,function(u){switch(u.label){case 0:r=t.getReader(),u.label=1;case 1:u.trys.push([1,,9,10]),u.label=2;case 2:return[4,ce(r.read())];case 3:return n=u.sent(),o=n.value,s=n.done,s?[4,ce(void 0)]:[3,5];case 4:return[2,u.sent()];case 5:return[4,ce(o)];case 6:return[4,u.sent()];case 7:return u.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function tt(t){return V(t==null?void 0:t.getReader)}function X(t){if(t instanceof F)return t;if(t!=null){if(Ze(t))return rr(t);if(We(t))return nr(t);if(Ye(t))return or(t);if(Je(t))return rt(t);if(Xe(t))return sr(t);if(tt(t))return ar(t)}throw He(t)}function rr(t){return new F(function(e){var r=t[Oe]();if(V(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function nr(t){return new F(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function or(t){return new F(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,Ke)})}function sr(t){return new F(function(e){var r,n;try{for(var o=ie(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(e.next(u),e.closed)return}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()})}function rt(t){return new F(function(e){ir(t,e).catch(function(r){return e.error(r)})})}function ar(t){return rt(et(t))}function ir(t,e){var r,n,o,s;return jt(this,void 0,void 0,function(){var u,a;return Ve(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),r=Vt(t),l.label=1;case 1:return[4,r.next()];case 2:if(n=l.sent(),!!n.done)return[3,4];if(u=n.value,e.next(u),e.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),o={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function te(t,e,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var s=e.schedule(function(){r(),o?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(s),!o)return s}function nt(t,e){return e===void 0&&(e=0),D(function(r,n){r.subscribe(N(n,function(o){return te(n,t,function(){return n.next(o)},e)},function(){return te(n,t,function(){return n.complete()},e)},function(o){return te(n,t,function(){return n.error(o)},e)}))})}function ot(t,e){return e===void 0&&(e=0),D(function(r,n){n.add(t.schedule(function(){return r.subscribe(n)},e))})}function ur(t,e){return X(t).pipe(ot(e),nt(e))}function lr(t,e){return X(t).pipe(ot(e),nt(e))}function cr(t,e){return new F(function(r){var n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function fr(t,e){return new F(function(r){var n;return te(r,e,function(){n=t[Qe](),te(r,e,function(){var o,s,u;try{o=n.next(),s=o.value,u=o.done}catch(a){r.error(a);return}u?r.complete():r.next(s)},0,!0)}),function(){return V(n==null?void 0:n.return)&&n.return()}})}function st(t,e){if(!t)throw new Error("Iterable cannot be null");return new F(function(r){te(r,e,function(){var n=t[Symbol.asyncIterator]();te(r,e,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}function hr(t,e){return st(et(t),e)}function yr(t,e){if(t!=null){if(Ze(t))return ur(t,e);if(We(t))return cr(t,e);if(Ye(t))return lr(t,e);if(Je(t))return st(t,e);if(Xe(t))return fr(t,e);if(tt(t))return hr(t,e)}throw He(t)}function Te(t,e){return e?yr(t,e):X(t)}function dr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=qe(t);return Te(t,r)}var at=Se(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function q(t,e){return D(function(r,n){var o=0;r.subscribe(N(n,function(s){n.next(t.call(e,s,o++))}))})}var pr=Array.isArray;function mr(t,e){return pr(e)?t.apply(void 0,le([],ue(e))):t(e)}function vr(t){return q(function(e){return mr(t,e)})}var gr=Array.isArray,br=Object.getPrototypeOf,wr=Object.prototype,Er=Object.keys;function xr(t){if(t.length===1){var e=t[0];if(gr(e))return{args:e,keys:null};if(Sr(e)){var r=Er(e);return{args:r.map(function(n){return e[n]}),keys:r}}}return{args:t,keys:null}}function Sr(t){return t&&typeof t=="object"&&br(t)===wr}function Ar(t,e){return t.reduce(function(r,n,o){return r[n]=e[o],r},{})}function ee(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=qe(t),n=er(t),o=xr(t),s=o.args,u=o.keys;if(s.length===0)return Te([],r);var a=new F(_r(s,r,u?function(l){return Ar(u,l)}:ve));return n?a.pipe(vr(n)):a}function _r(t,e,r){return r===void 0&&(r=ve),function(n){it(e,function(){for(var o=t.length,s=new Array(o),u=o,a=o,l=function(h){it(e,function(){var b=Te(t[h],e),w=!1;b.subscribe(N(n,function(m){s[h]=m,w||(w=!0,a--),a||n.next(r(s.slice()))},function(){--u||n.complete()}))},n)},i=0;i<o;i++)l(i)},n)}}function it(t,e,r){t?te(r,t,e):e()}function Cr(t){return new F(function(e){X(t()).subscribe(e)})}function Or(t,e,r){return Cr(function(){return t()?e:r})}function ge(t,e){return D(function(r,n){var o=0;r.subscribe(N(n,function(s){return t.call(e,s,o++)&&n.next(s)}))})}function he(t){return D(function(e,r){var n=null,o=!1,s;n=e.subscribe(N(r,void 0,void 0,function(u){s=X(t(u,he(t)(e))),n?(n.unsubscribe(),n=null,s.subscribe(r)):o=!0})),o&&(n.unsubscribe(),n=null,s.subscribe(r))})}function Y(t,e){return e===void 0&&(e=Qt),D(function(r,n){var o=null,s=null,u=null,a=function(){if(o){o.unsubscribe(),o=null;var i=s;s=null,n.next(i)}};function l(){var i=u+t,h=e.now();if(h<i){o=this.schedule(void 0,i-h),n.add(o);return}a()}r.subscribe(N(n,function(i){s=i,u=e.now(),o||(o=e.schedule(l,t),n.add(o))},function(){a(),n.complete()},void 0,function(){s=o=null}))})}function $r(t){return D(function(e,r){var n=!1;e.subscribe(N(r,function(o){n=!0,r.next(o)},function(){n||r.next(t),r.complete()}))})}function Tr(t){return t<=0?function(){return fe}:D(function(e,r){var n=0;e.subscribe(N(r,function(o){++n<=t&&(r.next(o),t<=n&&r.complete())}))})}function Ir(t,e){return e===void 0&&(e=ve),t=t??Br,D(function(r,n){var o,s=!0;r.subscribe(N(n,function(u){var a=e(u);(s||!t(o,a))&&(s=!1,o=a,n.next(u))}))})}function Br(t,e){return t===e}function Pr(t){return t===void 0&&(t=Mr),D(function(e,r){var n=!1;e.subscribe(N(r,function(o){n=!0,r.next(o)},function(){return n?r.complete():r.error(t())}))})}function Mr(){return new at}function jr(t,e){var r=arguments.length>=2;return function(n){return n.pipe(ve,Tr(1),r?$r(e):Pr(function(){return new at}))}}function ut(t){t===void 0&&(t={});var e=t.connector,r=e===void 0?function(){return new se}: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;return function(i){var h,b,w,m=0,v=!1,y=!1,p=function(){b==null||b.unsubscribe(),b=void 0},E=function(){p(),h=w=void 0,v=y=!1},d=function(){var _=h;E(),_==null||_.unsubscribe()};return D(function(_,O){m++,!y&&!v&&p();var S=w=w??r();O.add(function(){m--,m===0&&!y&&!v&&(b=Ie(d,l))}),S.subscribe(O),!h&&m>0&&(h=new me({next:function(x){return S.next(x)},error:function(x){y=!0,p(),b=Ie(E,o,x),S.error(x)},complete:function(){v=!0,p(),b=Ie(E,u),S.complete()}}),X(_).subscribe(h))})(i)}}function Ie(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(e===!0){t();return}if(e!==!1){var o=new me({next:function(){o.unsubscribe(),t()}});return X(e.apply(void 0,le([],ue(r)))).subscribe(o)}}function re(t,e,r){var n,o=!1;return n=t,ut({connector:function(){return new Yt(n,e,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:o})}function kr(t,e){return D(function(r,n){var o=null,s=0,u=!1,a=function(){return u&&!o&&n.complete()};r.subscribe(N(n,function(l){o==null||o.unsubscribe();var i=0,h=s++;X(t(l,h)).subscribe(o=N(n,function(b){return n.next(e?e(l,b,h,i++):b)},function(){o=null,a()}))},function(){u=!0,a()}))})}function Vr(t){return D(function(e,r){X(t).subscribe(N(r,function(){return r.complete()},_e)),!r.closed&&e.subscribe(r)})}function lt(t){const e=t.filter(r=>r!==null&&!isNaN(r));return e.length===0?null:e.reduce((r,n)=>r+n,0)}function ct(t){const e=t.filter(n=>n!==null&&!isNaN(n));return e.length===0?null:e.reduce((n,o)=>n+o,0)/e.length}function ft(t){const e=t.filter(o=>o!==null&&!isNaN(o));if(e.length===0)return null;const r=[...e].sort((o,s)=>o-s),n=Math.floor(r.length/2);return r.length%2===0?(r[n-1]+r[n])/2:r[n]}function ht(t){const e=t.filter(r=>r!==null&&!isNaN(r));return e.length===0?null:Math.min(...e)}function yt(t){const e=t.filter(r=>r!==null&&!isNaN(r));return e.length===0?null:Math.max(...e)}function dt(t){return t.filter(e=>e!==null&&!isNaN(e)).length}function pt(t){const e=t.filter(r=>r!==null&&!isNaN(r));return e.length>0?e[0]:null}function ye(t,e){switch(e){case"sum":return lt(t);case"mean":return ct(t);case"median":return ft(t);case"min":return ht(t);case"max":return yt(t);case"count":return dt(t);case"none":return pt(t);default:throw new Error(`Unknown aggregate type: ${e}`)}}function mt(t,e){let r;e.colorScheme==="auto"?r="light":r=e.colorScheme;const n=e.colors[r].data,o=t%n.length;return n[o]}function K(t,e,r){let n;switch(t){case"index":n=e.index??0;break;case"series":n=e.seriesIndex??0;break;case"category":n=e.categoryIndex??0;break;case"dataset":n=e.datasetIndex??0;break;default:n=0}return mt(n,r)}function Z(t){return Object.prototype.toString.call(t)==="[object Object]"}function vt(t){return Object.prototype.toString.call(t)==="[object Function]"}function Be(t){return!!(t&&t.nodeType)}function J(t,e){if(Z(e)===!1||Z(t)===!1)return Object.assign({},t);const r=(n,o)=>{const s=Object.assign({},n);for(let u of Object.keys(o)){if(!(u in n))continue;let a;Z(o[u])&&Z(n[u])?(a=r(n[u],o[u]),s[u]=a):s[u]=o[u]}return s};return r(t,e)}function Lr(t=0){try{let e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e.join(".")}catch(e){console.error(e)}}function gt(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),e.setAttribute("xmls","http://www.w3.org/2000/svg"),e.setAttribute("version","1.1"),e.style.position="absolute",t&&e.classList.add(t),e}function Rr(t){const e=document.createElement("canvas");return e.style.position="absolute",t&&e.classList.add(t),e}function bt(t){const e=document.createElementNS("http://www.w3.org/2000/svg","g");return t&&e.classList.add(t),e}function Pe(t){const e=document.createElement("canvas");return t&&e.classList.add(t),e}function Fr(t){const e=document.createElement("div");return t&&e.classList.add(t),e}function wt(t){if(Be(t))for(;t.firstChild;)t.removeChild(t.firstChild)}function Me(t){return`[OrbCharts ${t}]:`}function U(t){return`${Me("error")} ${t.message}`}function de({from:t,systemMessage:e}){return`unexpected error from '${t}':
|
|
4
|
-
${e}`}function
|
|
1
|
+
(function(M,ae){typeof exports=="object"&&typeof module<"u"?ae(exports):typeof define=="function"&&define.amd?define(["exports"],ae):(M=typeof globalThis<"u"?globalThis:M||self,ae(M.orbchartsCore={}))})(this,function(M){"use strict";var ae=function(t,e){return ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},ae(t,e)};function Z(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ae(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function kt(t,e,r,n){function s(o){return o instanceof r?o:new r(function(u){u(o)})}return new(r||(r=Promise))(function(o,u){function a(f){try{i(n.next(f))}catch(w){u(w)}}function c(f){try{i(n.throw(f))}catch(w){u(w)}}function i(f){f.done?o(f.value):s(f.value).then(a,c)}i((n=n.apply(t,e||[])).next())})}function Ve(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,u=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return u.next=a(0),u.throw=a(1),u.return=a(2),typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(i){return function(f){return c([i,f])}}function c(i){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,i[0]&&(r=0)),r;)try{if(n=1,s&&(o=i[0]&2?s.return:i[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,i[1])).done)return o;switch(s=0,o&&(i=[i[0]&2,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,s=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){r.label=i[1];break}if(i[0]===6&&r.label<o[1]){r.label=o[1],o=i;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(i);break}o[2]&&r.ops.pop(),r.trys.pop();continue}i=e.call(t,r)}catch(f){i=[6,f],s=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function ue(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ce(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,o=[],u;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(a){u={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(u)throw u.error}}return o}function le(t,e,r){if(r||arguments.length===2)for(var n=0,s=e.length,o;n<s;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))}function fe(t){return this instanceof fe?(this.v=t,this):new fe(t)}function Lt(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",u),s[Symbol.asyncIterator]=function(){return this},s;function u(y){return function(S){return Promise.resolve(S).then(y,w)}}function a(y,S){n[y]&&(s[y]=function(v){return new Promise(function(d,b){o.push([y,v,d,b])>1||c(y,v)})},S&&(s[y]=S(s[y])))}function c(y,S){try{i(n[y](S))}catch(v){x(o[0][3],v)}}function i(y){y.value instanceof fe?Promise.resolve(y.value.v).then(f,w):x(o[0][2],y)}function f(y){c("next",y)}function w(y){c("throw",y)}function x(y,S){y(S),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Vt(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof ue=="function"?ue(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(u){return new Promise(function(a,c){u=t[o](u),s(a,c,u.done,u.value)})}}function s(o,u,a,c){Promise.resolve(c).then(function(i){o({value:i,done:a})},u)}}typeof SuppressedError=="function"&&SuppressedError;function K(t){return typeof t=="function"}function xe(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var _e=xe(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
2
|
+
`+r.map(function(n,s){return s+1+") "+n.toString()}).join(`
|
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=r}});function we(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var ve=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,s,o;if(!this.closed){this.closed=!0;var u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var a=ue(u),c=a.next();!c.done;c=a.next()){var i=c.value;i.remove(this)}}catch(v){e={error:v}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else u.remove(this);var f=this.initialTeardown;if(K(f))try{f()}catch(v){o=v instanceof _e?v.errors:[v]}var w=this._finalizers;if(w){this._finalizers=null;try{for(var x=ue(w),y=x.next();!y.done;y=x.next()){var S=y.value;try{Fe(S)}catch(v){o=o??[],v instanceof _e?o=le(le([],ce(o)),ce(v.errors)):o.push(v)}}}catch(v){n={error:v}}finally{try{y&&!y.done&&(s=x.return)&&s.call(x)}finally{if(n)throw n.error}}}if(o)throw new _e(o)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Fe(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&we(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&we(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Ke=ve.EMPTY;function Re(t){return t instanceof ve||t&&"closed"in t&&K(t.remove)&&K(t.add)&&K(t.unsubscribe)}function Fe(t){K(t)?t():t.unsubscribe()}var Kt={Promise:void 0},Rt={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,le([t,e],ce(r)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function De(t){Rt.setTimeout(function(){throw t})}function Ce(){}function Ee(t){t()}var Te=function(t){Z(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Re(r)&&r.add(n)):n.destination=Nt,n}return e.create=function(r,n,s){return new me(r,n,s)},e.prototype.next=function(r){this.isStopped||this._next(r)},e.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(ve),Ft=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){Ae(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){Ae(n)}else Ae(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){Ae(r)}},t}(),me=function(t){Z(e,t);function e(r,n,s){var o=t.call(this)||this,u;return K(r)||!r?u={next:r??void 0,error:n??void 0,complete:s??void 0}:u=r,o.destination=new Ft(u),o}return e}(Te);function Ae(t){De(t)}function Dt(t){throw t}var Nt={closed:!0,next:Ce,error:Dt,complete:Ce},Oe=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function ge(t){return t}function Gt(t){return t.length===0?ge:t.length===1?t[0]:function(r){return t.reduce(function(n,s){return s(n)},r)}}var F=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var s=this,o=zt(e)?e:new me(e,r,n);return Ee(function(){var u=s,a=u.operator,c=u.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=Ne(r),new r(function(s,o){var u=new me({next:function(a){try{e(a)}catch(c){o(c),u.unsubscribe()}},error:o,complete:s});n.subscribe(u)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[Oe]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Gt(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=Ne(e),new e(function(n,s){var o;r.subscribe(function(u){return o=u},function(u){return s(u)},function(){return n(o)})})},t.create=function(e){return new t(e)},t}();function Ne(t){var e;return(e=t??Kt.Promise)!==null&&e!==void 0?e:Promise}function Ut(t){return t&&K(t.next)&&K(t.error)&&K(t.complete)}function zt(t){return t&&t instanceof Te||Ut(t)&&Re(t)}function qt(t){return K(t==null?void 0:t.lift)}function G(t){return function(e){if(qt(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function U(t,e,r,n,s){return new Wt(t,e,r,n,s)}var Wt=function(t){Z(e,t);function e(r,n,s,o,u,a){var c=t.call(this,r)||this;return c.onFinalize=u,c.shouldUnsubscribe=a,c._next=n?function(i){try{n(i)}catch(f){r.error(f)}}:t.prototype._next,c._error=o?function(i){try{o(i)}catch(f){r.error(f)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=s?function(){try{s()}catch(i){r.error(i)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},e}(Te),Yt=xe(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ie=function(t){Z(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new Ge(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Yt},e.prototype.next=function(r){var n=this;Ee(function(){var s,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var u=ue(n.currentObservers),a=u.next();!a.done;a=u.next()){var c=a.value;c.next(r)}}catch(i){s={error:i}}finally{try{a&&!a.done&&(o=u.return)&&o.call(u)}finally{if(s)throw s.error}}}})},e.prototype.error=function(r){var n=this;Ee(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var s=n.observers;s.length;)s.shift().error(r)}})},e.prototype.complete=function(){var r=this;Ee(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,s=this,o=s.hasError,u=s.isStopped,a=s.observers;return o||u?Ke:(this.currentObservers=null,a.push(r),new ve(function(){n.currentObservers=null,we(a,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,s=n.hasError,o=n.thrownError,u=n.isStopped;s?r.error(o):u&&r.complete()},e.prototype.asObservable=function(){var r=new F;return r.source=this,r},e.create=function(r,n){return new Ge(r,n)},e}(F),Ge=function(t){Z(e,t);function e(r,n){var s=t.call(this)||this;return s.destination=r,s.source=n,s}return e.prototype.next=function(r){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.next)===null||s===void 0||s.call(n,r)},e.prototype.error=function(r){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.error)===null||s===void 0||s.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,s;return(s=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&s!==void 0?s:Ke},e}(ie),z=function(t){Z(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,s=r.thrownError,o=r._value;if(n)throw s;return this._throwIfClosed(),o},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e}(ie),$e={now:function(){return($e.delegate||Date).now()},delegate:void 0},Zt=function(t){Z(e,t);function e(r,n,s){r===void 0&&(r=1/0),n===void 0&&(n=1/0),s===void 0&&(s=$e);var o=t.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=s,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return e.prototype.next=function(r){var n=this,s=n.isStopped,o=n._buffer,u=n._infiniteTimeWindow,a=n._timestampProvider,c=n._windowTime;s||(o.push(r),!u&&o.push(a.now()+c)),this._trimBuffer(),t.prototype.next.call(this,r)},e.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),s=this,o=s._infiniteTimeWindow,u=s._buffer,a=u.slice(),c=0;c<a.length&&!r.closed;c+=o?1:2)r.next(a[c]);return this._checkFinalizedStatuses(r),n},e.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,s=r._timestampProvider,o=r._buffer,u=r._infiniteTimeWindow,a=(u?1:2)*n;if(n<1/0&&a<o.length&&o.splice(0,o.length-a),!u){for(var c=s.now(),i=0,f=1;f<o.length&&o[f]<=c;f+=2)i=f;i&&o.splice(0,i+1)}},e}(ie),Jt=function(t){Z(e,t);function e(r,n){return t.call(this)||this}return e.prototype.schedule=function(r,n){return this},e}(ve),Ue={setInterval:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,le([t,e],ce(r)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},Ht=function(t){Z(e,t);function e(r,n){var s=t.call(this,r,n)||this;return s.scheduler=r,s.work=n,s.pending=!1,s}return e.prototype.schedule=function(r,n){var s;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var o=this.id,u=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(u,o,n)),this.pending=!0,this.delay=n,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(u,this.id,n),this},e.prototype.requestAsyncId=function(r,n,s){return s===void 0&&(s=0),Ue.setInterval(r.flush.bind(r,this),s)},e.prototype.recycleAsyncId=function(r,n,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return n;n!=null&&Ue.clearInterval(n)},e.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(r,n);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(r,n){var s=!1,o;try{this.work(r)}catch(u){s=!0,o=u||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),o},e.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,s=r.scheduler,o=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,we(o,this),n!=null&&(this.id=this.recycleAsyncId(s,n,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(Jt),ze=function(){function t(e,r){r===void 0&&(r=t.now),this.schedulerActionCtor=e,this.now=r}return t.prototype.schedule=function(e,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,e).schedule(n,r)},t.now=$e.now,t}(),Qt=function(t){Z(e,t);function e(r,n){n===void 0&&(n=ze.now);var s=t.call(this,r,n)||this;return s.actions=[],s._active=!1,s}return e.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var s;this._active=!0;do if(s=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,s){for(;r=n.shift();)r.unsubscribe();throw s}},e}(ze),Xt=new Qt(Ht),he=new F(function(t){return t.complete()});function er(t){return t&&K(t.schedule)}function qe(t){return t[t.length-1]}function tr(t){return K(qe(t))?t.pop():void 0}function We(t){return er(qe(t))?t.pop():void 0}var Ye=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Ze(t){return K(t==null?void 0:t.then)}function Je(t){return K(t[Oe])}function He(t){return Symbol.asyncIterator&&K(t==null?void 0:t[Symbol.asyncIterator])}function Qe(t){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.")}function rr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Xe=rr();function et(t){return K(t==null?void 0:t[Xe])}function tt(t){return Lt(this,arguments,function(){var r,n,s,o;return Ve(this,function(u){switch(u.label){case 0:r=t.getReader(),u.label=1;case 1:u.trys.push([1,,9,10]),u.label=2;case 2:return[4,fe(r.read())];case 3:return n=u.sent(),s=n.value,o=n.done,o?[4,fe(void 0)]:[3,5];case 4:return[2,u.sent()];case 5:return[4,fe(s)];case 6:return[4,u.sent()];case 7:return u.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function rt(t){return K(t==null?void 0:t.getReader)}function ee(t){if(t instanceof F)return t;if(t!=null){if(Je(t))return nr(t);if(Ye(t))return sr(t);if(Ze(t))return or(t);if(He(t))return nt(t);if(et(t))return ar(t);if(rt(t))return ir(t)}throw Qe(t)}function nr(t){return new F(function(e){var r=t[Oe]();if(K(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function sr(t){return new F(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function or(t){return new F(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,De)})}function ar(t){return new F(function(e){var r,n;try{for(var s=ue(t),o=s.next();!o.done;o=s.next()){var u=o.value;if(e.next(u),e.closed)return}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}e.complete()})}function nt(t){return new F(function(e){ur(t,e).catch(function(r){return e.error(r)})})}function ir(t){return nt(tt(t))}function ur(t,e){var r,n,s,o;return kt(this,void 0,void 0,function(){var u,a;return Ve(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Vt(t),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(u=n.value,e.next(u),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),s={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function ne(t,e,r,n,s){n===void 0&&(n=0),s===void 0&&(s=!1);var o=e.schedule(function(){r(),s?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!s)return o}function st(t,e){return e===void 0&&(e=0),G(function(r,n){r.subscribe(U(n,function(s){return ne(n,t,function(){return n.next(s)},e)},function(){return ne(n,t,function(){return n.complete()},e)},function(s){return ne(n,t,function(){return n.error(s)},e)}))})}function ot(t,e){return e===void 0&&(e=0),G(function(r,n){n.add(t.schedule(function(){return r.subscribe(n)},e))})}function cr(t,e){return ee(t).pipe(ot(e),st(e))}function lr(t,e){return ee(t).pipe(ot(e),st(e))}function fr(t,e){return new F(function(r){var n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function hr(t,e){return new F(function(r){var n;return ne(r,e,function(){n=t[Xe](),ne(r,e,function(){var s,o,u;try{s=n.next(),o=s.value,u=s.done}catch(a){r.error(a);return}u?r.complete():r.next(o)},0,!0)}),function(){return K(n==null?void 0:n.return)&&n.return()}})}function at(t,e){if(!t)throw new Error("Iterable cannot be null");return new F(function(r){ne(r,e,function(){var n=t[Symbol.asyncIterator]();ne(r,e,function(){n.next().then(function(s){s.done?r.complete():r.next(s.value)})},0,!0)})})}function yr(t,e){return at(tt(t),e)}function pr(t,e){if(t!=null){if(Je(t))return cr(t,e);if(Ye(t))return fr(t,e);if(Ze(t))return lr(t,e);if(He(t))return at(t,e);if(et(t))return hr(t,e);if(rt(t))return yr(t,e)}throw Qe(t)}function Ie(t,e){return e?pr(t,e):ee(t)}function dr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=We(t);return Ie(t,r)}var it=xe(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function W(t,e){return G(function(r,n){var s=0;r.subscribe(U(n,function(o){n.next(t.call(e,o,s++))}))})}var vr=Array.isArray;function mr(t,e){return vr(e)?t.apply(void 0,le([],ce(e))):t(e)}function gr(t){return W(function(e){return mr(t,e)})}var br=Array.isArray,wr=Object.getPrototypeOf,Er=Object.prototype,Ar=Object.keys;function Sr(t){if(t.length===1){var e=t[0];if(br(e))return{args:e,keys:null};if(xr(e)){var r=Ar(e);return{args:r.map(function(n){return e[n]}),keys:r}}}return{args:t,keys:null}}function xr(t){return t&&typeof t=="object"&&wr(t)===Er}function _r(t,e){return t.reduce(function(r,n,s){return r[n]=e[s],r},{})}function te(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=We(t),n=tr(t),s=Sr(t),o=s.args,u=s.keys;if(o.length===0)return Ie([],r);var a=new F(Cr(o,r,u?function(c){return _r(u,c)}:ge));return n?a.pipe(gr(n)):a}function Cr(t,e,r){return r===void 0&&(r=ge),function(n){ut(e,function(){for(var s=t.length,o=new Array(s),u=s,a=s,c=function(f){ut(e,function(){var w=Ie(t[f],e),x=!1;w.subscribe(U(n,function(y){o[f]=y,x||(x=!0,a--),a||n.next(r(o.slice()))},function(){--u||n.complete()}))},n)},i=0;i<s;i++)c(i)},n)}}function ut(t,e,r){t?ne(r,t,e):e()}function Tr(t){return new F(function(e){ee(t()).subscribe(e)})}function Or(t,e,r){return Tr(function(){return t()?e:r})}function be(t,e){return G(function(r,n){var s=0;r.subscribe(U(n,function(o){return t.call(e,o,s++)&&n.next(o)}))})}function ye(t){return G(function(e,r){var n=null,s=!1,o;n=e.subscribe(U(r,void 0,void 0,function(u){o=ee(t(u,ye(t)(e))),n?(n.unsubscribe(),n=null,o.subscribe(r)):s=!0})),s&&(n.unsubscribe(),n=null,o.subscribe(r))})}function J(t,e){return e===void 0&&(e=Xt),G(function(r,n){var s=null,o=null,u=null,a=function(){if(s){s.unsubscribe(),s=null;var i=o;o=null,n.next(i)}};function c(){var i=u+t,f=e.now();if(f<i){s=this.schedule(void 0,i-f),n.add(s);return}a()}r.subscribe(U(n,function(i){o=i,u=e.now(),s||(s=e.schedule(c,t),n.add(s))},function(){a(),n.complete()},void 0,function(){o=s=null}))})}function $r(t){return G(function(e,r){var n=!1;e.subscribe(U(r,function(s){n=!0,r.next(s)},function(){n||r.next(t),r.complete()}))})}function Ir(t){return t<=0?function(){return he}:G(function(e,r){var n=0;e.subscribe(U(r,function(s){++n<=t&&(r.next(s),t<=n&&r.complete())}))})}function Br(t,e){return e===void 0&&(e=ge),t=t??Pr,G(function(r,n){var s,o=!0;r.subscribe(U(n,function(u){var a=e(u);(o||!t(s,a))&&(o=!1,s=a,n.next(u))}))})}function Pr(t,e){return t===e}function Mr(t){return t===void 0&&(t=jr),G(function(e,r){var n=!1;e.subscribe(U(r,function(s){n=!0,r.next(s)},function(){return n?r.complete():r.error(t())}))})}function jr(){return new it}function kr(t,e){var r=arguments.length>=2;return function(n){return n.pipe(ge,Ir(1),r?$r(e):Mr(function(){return new it}))}}function ct(t){t===void 0&&(t={});var e=t.connector,r=e===void 0?function(){return new ie}:e,n=t.resetOnError,s=n===void 0?!0:n,o=t.resetOnComplete,u=o===void 0?!0:o,a=t.resetOnRefCountZero,c=a===void 0?!0:a;return function(i){var f,w,x,y=0,S=!1,v=!1,d=function(){w==null||w.unsubscribe(),w=void 0},b=function(){d(),f=x=void 0,S=v=!1},O=function(){var $=f;b(),$==null||$.unsubscribe()};return G(function($,h){y++,!v&&!S&&d();var p=x=x??r();h.add(function(){y--,y===0&&!v&&!S&&(w=Be(O,c))}),p.subscribe(h),!f&&y>0&&(f=new me({next:function(E){return p.next(E)},error:function(E){v=!0,d(),w=Be(b,s,E),p.error(E)},complete:function(){S=!0,d(),w=Be(b,u),p.complete()}}),ee($).subscribe(f))})(i)}}function Be(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(e===!0){t();return}if(e!==!1){var s=new me({next:function(){s.unsubscribe(),t()}});return ee(e.apply(void 0,le([],ce(r)))).subscribe(s)}}function se(t,e,r){var n,s=!1;return n=t,ct({connector:function(){return new Zt(n,e,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:s})}function Lr(t,e){return G(function(r,n){var s=null,o=0,u=!1,a=function(){return u&&!s&&n.complete()};r.subscribe(U(n,function(c){s==null||s.unsubscribe();var i=0,f=o++;ee(t(c,f)).subscribe(s=U(n,function(w){return n.next(e?e(c,w,f,i++):w)},function(){s=null,a()}))},function(){u=!0,a()}))})}function Vr(t){return G(function(e,r){ee(t).subscribe(U(r,function(){return r.complete()},Ce)),!r.closed&&e.subscribe(r)})}function lt(t){const e=t.filter(r=>r!==null&&!isNaN(r));return e.length===0?null:e.reduce((r,n)=>r+n,0)}function ft(t){const e=t.filter(n=>n!==null&&!isNaN(n));return e.length===0?null:e.reduce((n,s)=>n+s,0)/e.length}function ht(t){const e=t.filter(s=>s!==null&&!isNaN(s));if(e.length===0)return null;const r=[...e].sort((s,o)=>s-o),n=Math.floor(r.length/2);return r.length%2===0?(r[n-1]+r[n])/2:r[n]}function yt(t){const e=t.filter(r=>r!==null&&!isNaN(r));return e.length===0?null:Math.min(...e)}function pt(t){const e=t.filter(r=>r!==null&&!isNaN(r));return e.length===0?null:Math.max(...e)}function dt(t){return t.filter(e=>e!==null&&!isNaN(e)).length}function vt(t){const e=t.filter(r=>r!==null&&!isNaN(r));return e.length>0?e[0]:null}function pe(t,e){switch(e){case"sum":return lt(t);case"mean":return ft(t);case"median":return ht(t);case"min":return yt(t);case"max":return pt(t);case"count":return dt(t);case"none":return vt(t);default:throw new Error(`Unknown aggregate type: ${e}`)}}function mt(t,e){let r;e.colorScheme==="auto"?r="light":r=e.colorScheme;const n=e.colors[r].data,s=t%n.length;return n[s]}function D(t,e,r){let n;switch(t){case"index":n=e.index??0;break;case"series":n=e.seriesIndex??0;break;case"category":n=e.categoryIndex??0;break;case"dataset":n=e.datasetIndex??0;break;default:n=0}return mt(n,r)}function H(t){return Object.prototype.toString.call(t)==="[object Object]"}function gt(t){return Object.prototype.toString.call(t)==="[object Function]"}function Pe(t){return!!(t&&t.nodeType)}function Y(t,e){if(H(e)===!1||H(t)===!1)return Object.assign({},t);const r=(n,s)=>{const o=Object.assign({},n);for(let u of Object.keys(s)){if(!(u in n))continue;let a;H(s[u])&&H(n[u])?(a=r(n[u],s[u]),o[u]=a):o[u]=s[u]}return o};return r(t,e)}function Kr(t=0){try{let e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e.join(".")}catch(e){console.error(e)}}function bt(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),e.setAttribute("xmls","http://www.w3.org/2000/svg"),e.setAttribute("version","1.1"),e.style.position="absolute",t&&e.classList.add(t),e}function Rr(t){const e=document.createElement("canvas");return e.style.position="absolute",t&&e.classList.add(t),e}function wt(t){const e=document.createElementNS("http://www.w3.org/2000/svg","g");return t&&e.classList.add(t),e}function Me(t){const e=document.createElement("canvas");return t&&e.classList.add(t),e}function Fr(t){const e=document.createElement("div");return t&&e.classList.add(t),e}function Et(t){if(Pe(t))for(;t.firstChild;)t.removeChild(t.firstChild)}function T(t,e,r=""){return e.ignore?"":t[e.from]||r}function je(t){return`[OrbCharts ${t}]:`}function q(t){return`${je("error")} ${t.message}`}function de({from:t,systemMessage:e}){return`unexpected error from '${t}':
|
|
4
|
+
${e}`}function Q({columnName:t,expectToBe:e,from:r}){return`Invalid value: '${t}' must be '${e}'
|
|
5
5
|
|
|
6
|
-
----> find in '${r}'`}function
|
|
6
|
+
----> find in '${r}'`}function X({columnName:t,expectToBe:e,from:r}){return`${je("warning")} Value is not correct: '${t}' suppose to be '${e}', it may cause unexpected errors.'
|
|
7
7
|
|
|
8
|
-
----> find in '${r}'`}function Et(t){return new F(e=>{const r=new ResizeObserver(n=>{const o=n[0];o&&o.contentRect&&e.next(o.contentRect)});return r.observe(t),function(){r.unobserve(t)}})}function xt(t){return`orbcharts-${t}`}function St(t,e){return`${xt(t)}-${e}`}function Kr(t,e){const r={string:s=>typeof s=="string",number:s=>typeof s=="number",boolean:s=>typeof s=="boolean",object:s=>Z(s),"object[]":s=>Array.isArray(s)&&s.every(u=>Z(u)),"string[]":s=>Array.isArray(s)&&s.every(u=>typeof u=="string"),"number[]":s=>Array.isArray(s)&&s.every(u=>typeof u=="number"),Function:s=>vt(s),null:s=>s===null,undefined:s=>s===void 0},n={ColorType:s=>s==="none"||s==="data"||s==="primary"||s==="secondary"||s==="dataContrast"||s==="background"};return Object.keys(t).find(s=>{if(e[s]){const u=e[s],a=t[s];if(u.toBeTypes){if(u.toBeTypes.some(h=>r[h](a))===!1)return!0}else if(u.toBe){const{toBe:l,test:i}=u;if(i(a)===!1)return!0}else if(u.toBeOption){const l=u.toBeOption;if(n[l](a)===!1)return!0}}return!1})}function R(t,e){const r=Kr(t,e);if(r){const n=e[r],o=n.toBeTypes?n.toBeTypes.join(" | "):n.toBe?n.toBe:n.toBeOption?n.toBeOption:"";return{status:"error",columnName:r,expectToBe:o}}else return{status:"success",columnName:"",expectToBe:""}}const At={width:"auto",height:"auto",resizeDebounce:50},_t={dataset:{from:"dataset",sort:"original"},series:{from:"series",sort:"original"},category:{from:"category",sort:"original"},value:{from:"value",sort:"original",aggregate:"none"},multivariate:[{from:"x",name:"x"},{from:"y",name:"y"},{from:"z",name:"z"}],color:{from:"series"}},Ct={colorScheme:"light",colors:{light:{data:["#0088FF","#FF3232","#38BEA8","#6F3BD5","#314285","#42C724","#D52580","#F4721B","#D117EA","#7E7D7D"],primary:"#000000",secondary:"#e0e0e0",dataContrast:["#ffffff","#000000"],background:"#FFFFFF"},dark:{data:["#4BABFF","#FF6C6C","#7DD3C4","#8E6BC9","#5366AC","#86DC72","#FF72BB","#F9B052","#EF76FF","#C4C4C4"],primary:"#FFFFFF",secondary:"#e0e0e0",dataContrast:["#ffffff","#000000"],background:"#000000"}},fontSize:"0.875rem"},Dr=(t,e,r)=>{const n=new Map,o=Array.isArray(t[0]);o?t.forEach((a,l)=>{a.forEach(i=>{const h=i[e.dataset.from]||`dataset-${l}`;n.has(h)||n.set(h,[]),n.get(h).push(i)})}):t.forEach(a=>{const l=a[e.dataset.from]||"default";n.has(l)||n.set(l,[]),n.get(l).push(a)});let s=Array.from(n.keys());if(Array.isArray(e.dataset.sort))s=e.dataset.sort.filter(a=>n.has(a)).concat(s.filter(a=>!e.dataset.sort.includes(a)));else if(e.dataset.sort==="original"){const a=[];o?t.forEach((l,i)=>{l.forEach(h=>{const b=h[e.dataset.from]||`dataset-${i}`;a.includes(b)||a.push(b)})}):t.forEach(l=>{const i=l[e.dataset.from]||"default";a.includes(i)||a.push(i)}),s=a}else e.dataset.sort==="alphabetical"&&s.sort((a,l)=>a.localeCompare(l,void 0,{numeric:!0}));const u=[];return s.forEach((a,l)=>{const i=n.get(a),h=new Map;i.forEach(y=>{const p=y[e.series.from]||"default";h.has(p)||h.set(p,[]),h.get(p).push(y)});let b=Array.from(h.keys());if(Array.isArray(e.series.sort))b=e.series.sort.filter(y=>h.has(y)).concat(b.filter(y=>!e.series.sort.includes(y)));else if(e.series.sort==="original"){const y=[];i.forEach(p=>{const E=p[e.series.from]||"default";y.includes(E)||y.push(E)}),b=y}else e.series.sort==="alphabetical"&&b.sort((y,p)=>y.localeCompare(p,void 0,{numeric:!0}));const w=[];if(e.category.sort==="original")i.forEach(y=>{const p=y[e.category.from]||"default";w.includes(p)||w.push(p)});else if(e.category.sort==="alphabetical"){const y=new Set;i.forEach(p=>{y.add(p[e.category.from]||"default")}),w.push(...Array.from(y).sort((p,E)=>p.localeCompare(E,void 0,{numeric:!0})))}else if(Array.isArray(e.category.sort)){const y=[];i.forEach(E=>{const d=E[e.category.from]||"default";y.includes(d)||y.push(d)});const p=e.category.sort;w.push(...p.filter(E=>y.includes(E)),...y.filter(E=>!p.includes(E)))}const m=new Map;w.forEach((y,p)=>{m.set(y,p)});const v=[];b.forEach((y,p)=>{const E=h.get(y),d=new Map;E.forEach(S=>{const x=S[e.category.from]||"default";d.has(x)||d.set(x,[]),d.get(x).push(S)});const _=w.filter(S=>d.has(S)),O=[];e.category.sort==="original"&&e.value.aggregate==="none"?(E.forEach((S,x)=>{const P=S[e.category.from]||"default",I=m.get(P),c=S[e.value.from];O.push({id:S.id||`${a}-${y}-${P}-${x}`,index:I,modelType:"series",name:S.name||"",data:S.data,value:typeof c=="number"?c:null,color:K(e.color.from,{index:I,seriesIndex:p,categoryIndex:I,datasetIndex:l},r),series:y,seriesIndex:p,category:P,categoryIndex:I})}),e.value.sort==="asc"?O.sort((S,x)=>S.value===null&&x.value===null?0:S.value===null?1:x.value===null?-1:S.value-x.value):e.value.sort==="desc"&&O.sort((S,x)=>S.value===null&&x.value===null?0:S.value===null?1:x.value===null?-1:x.value-S.value)):_.forEach(S=>{const x=m.get(S),P=d.get(S);if(e.value.aggregate==="none"){let I=P.map((c,f)=>{const g=c[e.value.from];return{id:c.id||`${a}-${y}-${S}-${f}`,index:x,modelType:"series",name:c.name||"",data:c.data,value:typeof g=="number"?g:null,color:K(e.color.from,{index:x,seriesIndex:p,categoryIndex:x,datasetIndex:l},r),series:y,seriesIndex:p,category:S,categoryIndex:x}});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),O.push(...I)}else{const I=P.map(A=>{if(e.value.aggregate==="count")return 1;const C=A[e.value.from];return typeof C=="number"?C:null}),c=ye(I,e.value.aggregate),f=P[0],g={id:f.id||`${a}-${y}-${S}-aggregated`,index:x,modelType:"series",name:f.name||S,data:f.data,value:c,color:K(e.color.from,{index:x,seriesIndex:p,categoryIndex:x,datasetIndex:l},r),series:y,seriesIndex:p,category:S,categoryIndex:x};O.push(g)}}),v.push(O)}),u.push(v)}),u},Nr=(t,e,r)=>{const n=new Map,o=Array.isArray(t[0]);o?t.forEach((a,l)=>{a.forEach(i=>{const h=i[e.dataset.from]||`dataset-${l}`;n.has(h)||n.set(h,[]),n.get(h).push(i)})}):t.forEach(a=>{const l=a[e.dataset.from]||"default";n.has(l)||n.set(l,[]),n.get(l).push(a)});let s=Array.from(n.keys());if(Array.isArray(e.dataset.sort))s=e.dataset.sort.filter(a=>n.has(a)).concat(s.filter(a=>!e.dataset.sort.includes(a)));else if(e.dataset.sort==="original"){const a=[];o?t.forEach((l,i)=>{l.forEach(h=>{const b=h[e.dataset.from]||`dataset-${i}`;a.includes(b)||a.push(b)})}):t.forEach(l=>{const i=l[e.dataset.from]||"default";a.includes(i)||a.push(i)}),s=a}else e.dataset.sort==="alphabetical"&&s.sort((a,l)=>a.localeCompare(l,void 0,{numeric:!0}));const u=[];return s.forEach((a,l)=>{const i=n.get(a),h=new Map;i.forEach(p=>{const E=p[e.series.from]||"default";h.has(E)||h.set(E,[]),h.get(E).push(p)});let b=Array.from(h.keys());if(Array.isArray(e.series.sort))b=e.series.sort.filter(p=>h.has(p)).concat(b.filter(p=>!e.series.sort.includes(p)));else if(e.series.sort==="original"){const p=[];i.forEach(E=>{const d=E[e.series.from]||"default";p.includes(d)||p.push(d)}),b=p}else e.series.sort==="alphabetical"&&b.sort((p,E)=>p.localeCompare(E,void 0,{numeric:!0}));const w=[];i.forEach(p=>{const E=p[e.category.from]||"default";w.includes(E)||w.push(E)});const m=new Set(w);let v=Array.from(m);Array.isArray(e.category.sort)?v=e.category.sort.filter(p=>m.has(p)).concat(v.filter(p=>!e.category.sort.includes(p))):e.category.sort==="original"?v=w:e.category.sort==="alphabetical"&&v.sort((p,E)=>p.localeCompare(E,void 0,{numeric:!0}));const y=[];b.forEach((p,E)=>{const d=h.get(p),_=new Map;d.forEach(S=>{const x=S[e.category.from]||"default";_.has(x)||_.set(x,[]),_.get(x).push(S)});const O=[];v.forEach((S,x)=>{const P=_.get(S);if(!P)O.push({id:`${a}-${p}-${S}-null`,index:x,modelType:"grid",name:S,data:void 0,value:null,color:K(e.color.from,{index:x,seriesIndex:E,categoryIndex:x,datasetIndex:l},r),series:p,seriesIndex:E,category:S,categoryIndex:x});else if(e.value.aggregate==="none"){let I=P.map((c,f)=>{const g=c[e.value.from];return{id:c.id||`${a}-${p}-${S}-${f}`,index:x,modelType:"grid",name:c.name||"",data:c.data,value:typeof g=="number"?g:null,color:K(e.color.from,{index:x,seriesIndex:E,categoryIndex:x,datasetIndex:l},r),series:p,seriesIndex:E,category:S,categoryIndex:x}});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),O.push(...I)}else{const I=P.map(A=>{if(e.value.aggregate==="count")return 1;const C=A[e.value.from];return typeof C=="number"?C:null}),c=ye(I,e.value.aggregate),f=P[0],g={id:f.id||`${a}-${p}-${S}-aggregated`,index:x,modelType:"grid",name:f.name||S,data:f.data,value:c,color:K(e.color.from,{index:x,seriesIndex:E,categoryIndex:x,datasetIndex:l},r),series:p,seriesIndex:E,category:S,categoryIndex:x};O.push(g)}}),y.push(O)}),u.push(y)}),u},Gr=(t,e,r)=>{const n=new Map,o=Array.isArray(t[0]);o?t.forEach((a,l)=>{a.forEach(i=>{const h=i[e.dataset.from]||`dataset-${l}`;n.has(h)||n.set(h,[]),n.get(h).push(i)})}):t.forEach(a=>{const l=a[e.dataset.from]||"default";n.has(l)||n.set(l,[]),n.get(l).push(a)});let s=Array.from(n.keys());if(Array.isArray(e.dataset.sort))s=e.dataset.sort.filter(a=>n.has(a)).concat(s.filter(a=>!e.dataset.sort.includes(a)));else if(e.dataset.sort==="original"){const a=[];o?t.forEach((l,i)=>{l.forEach(h=>{const b=h[e.dataset.from]||`dataset-${i}`;a.includes(b)||a.push(b)})}):t.forEach(l=>{const i=l[e.dataset.from]||"default";a.includes(i)||a.push(i)}),s=a}else e.dataset.sort==="alphabetical"&&s.sort((a,l)=>a.localeCompare(l,void 0,{numeric:!0}));const u=[];return s.forEach((a,l)=>{const i=n.get(a),h=new Map;i.forEach(m=>{const v=m[e.series.from]||"default";h.has(v)||h.set(v,[]),h.get(v).push(m)});let b=Array.from(h.keys());if(Array.isArray(e.series.sort))b=e.series.sort.filter(m=>h.has(m)).concat(b.filter(m=>!e.series.sort.includes(m)));else if(e.series.sort==="original"){const m=[];i.forEach(v=>{const y=v[e.series.from]||"default";m.includes(y)||m.push(y)}),b=m}else e.series.sort==="alphabetical"&&b.sort((m,v)=>m.localeCompare(v,void 0,{numeric:!0}));const w=[];b.forEach((m,v)=>{const y=h.get(m),p=new Map;y.forEach(_=>{const O=_[e.category.from]||"default";p.has(O)||p.set(O,[]),p.get(O).push(_)});let E=Array.from(p.keys());if(Array.isArray(e.category.sort))E=e.category.sort.filter(_=>p.has(_)).concat(E.filter(_=>!e.category.sort.includes(_)));else if(e.category.sort==="original"){const _=[];y.forEach(O=>{const S=O[e.category.from]||"default";_.includes(S)||_.push(S)}),E=_}else e.category.sort==="alphabetical"&&E.sort((_,O)=>_.localeCompare(O,void 0,{numeric:!0}));const d=[];E.forEach((_,O)=>{p.get(_).forEach((x,P)=>{const I=e.multivariate.map((f,g)=>({index:g,name:f.name,value:(()=>{const A=x[f.from];return typeof A=="number"?A:null})()})),c={id:x.id||`${a}-${m}-${_}-${P}`,index:P,modelType:"multivariate",name:x.name||"",data:x.data,value:null,color:K(e.color.from,{index:P,seriesIndex:v,categoryIndex:O,datasetIndex:l},r),multivariate:I,series:m,seriesIndex:v,category:_,categoryIndex:O};d.push(c)})}),w.push(d)}),u.push(w)}),u},Ur=(t,e,r)=>{const n=Array.isArray(t[0]),o=[],s=[];n?t.forEach(i=>{i.forEach(h=>{h.source&&h.target?s.push(h):o.push(h)})}):t.forEach(i=>{i.source&&i.target?s.push(i):o.push(i)});const u=new Map;n?t.forEach((i,h)=>{i.forEach(b=>{if(!b.source||!b.target){const w=b[e.dataset.from]||`dataset-${h}`;u.has(w)||u.set(w,[]),u.get(w).push(b)}})}):o.forEach(i=>{const h=i[e.dataset.from]||"default";u.has(h)||u.set(h,[]),u.get(h).push(i)});let a=Array.from(u.keys());if(Array.isArray(e.dataset.sort))a=e.dataset.sort.filter(i=>u.has(i)).concat(a.filter(i=>!e.dataset.sort.includes(i)));else if(e.dataset.sort==="original"){const i=[];n?t.forEach((h,b)=>{h.forEach(w=>{if(!w.source||!w.target){const m=w[e.dataset.from]||`dataset-${b}`;i.includes(m)||i.push(m)}})}):o.forEach(h=>{const b=h[e.dataset.from]||"default";i.includes(b)||i.push(b)}),a=i}else e.dataset.sort==="alphabetical"&&a.sort((i,h)=>i.localeCompare(h,void 0,{numeric:!0}));const l=[];return a.forEach((i,h)=>{const b=u.get(i),w=[],m=new Map;b.forEach(c=>{const f=c[e.series.from]||"default";m.has(f)||m.set(f,[]),m.get(f).push(c)});let v=Array.from(m.keys());if(Array.isArray(e.series.sort))v=e.series.sort.filter(c=>m.has(c)).concat(v.filter(c=>!e.series.sort.includes(c)));else if(e.series.sort==="original"){const c=[];b.forEach(f=>{const g=f[e.series.from]||"default";c.includes(g)||c.push(g)}),v=c}else e.series.sort==="alphabetical"&&v.sort((c,f)=>c.localeCompare(f,void 0,{numeric:!0}));v.forEach((c,f)=>{const g=m.get(c),A=new Map;g.forEach($=>{const B=$[e.category.from]||"default";A.has(B)||A.set(B,[]),A.get(B).push($)});let C=Array.from(A.keys());if(Array.isArray(e.category.sort))C=e.category.sort.filter($=>A.has($)).concat(C.filter($=>!e.category.sort.includes($)));else if(e.category.sort==="original"){const $=[];g.forEach(B=>{const L=B[e.category.from]||"default";$.includes(L)||$.push(L)}),C=$}else e.category.sort==="alphabetical"&&C.sort(($,B)=>$.localeCompare(B,void 0,{numeric:!0}));C.forEach(($,B)=>{const L=A.get($);if(e.value.aggregate==="none"){let k=L.map((M,j)=>{const z=M[e.value.from];return{id:M.id||`${i}-${c}-${$}-${j}`,index:w.length+j,modelType:"graph",name:M.name||"",data:M.data,value:typeof z=="number"?z:null,color:K(e.color.from,{index:B,seriesIndex:f,categoryIndex:B,datasetIndex:h},r),series:c,seriesIndex:f,category:$,categoryIndex:B}});e.value.sort==="asc"?k.sort((M,j)=>M.value===null&&j.value===null?0:M.value===null?1:j.value===null?-1:M.value-j.value):e.value.sort==="desc"&&k.sort((M,j)=>M.value===null&&j.value===null?0:M.value===null?1:j.value===null?-1:j.value-M.value),w.push(...k)}else{const k=L.map(ae=>{if(e.value.aggregate==="count")return 1;const ne=ae[e.value.from];return typeof ne=="number"?ne:null}),M=ye(k,e.value.aggregate),j=L[0],z={id:j.id||`${i}-${c}-${$}-aggregated`,index:w.length,modelType:"graph",name:j.name||$,data:j.data,value:M,color:K(e.color.from,{index:B,seriesIndex:f,categoryIndex:B,datasetIndex:h},r),series:c,seriesIndex:f,category:$,categoryIndex:B};w.push(z)}})});const y=[],p=new Map;w.forEach(c=>{const f=o.find(g=>g.id===c.id||g.name===c.name);f!=null&&f.id&&p.set(f.id,c.index),f!=null&&f.name&&p.set(f.name,c.index)});const E=new Map,d=new Map;w.forEach(c=>{E.has(c.series)||E.set(c.series,c.seriesIndex),d.has(c.category)||d.set(c.category,c.categoryIndex)});let _=E.size,O=d.size;const S=c=>(E.has(c)||E.set(c,_++),E.get(c)),x=c=>(d.has(c)||d.set(c,O++),d.get(c)),P=s.filter(c=>(c[e.dataset.from]||"default")===i),I=new Map;P.forEach(c=>{const f=c.source,g=c.target,A=c[e.series.from]||"default",C=c[e.category.from]||"default",$=`${f}-${g}-${A}-${C}`;I.has($)||I.set($,[]),I.get($).push(c)}),Array.from(I.entries()).forEach(([c,f],g)=>{const A=f[0],C=A.source,$=A.target,B=p.get(C)??-1,L=p.get($)??-1;if(B>=0&&L>=0)if(e.value.aggregate==="none")f.forEach((k,M)=>{const j=k[e.value.from],z=k[e.series.from]||"default",ae=k[e.category.from]||"default",ne=S(z),xe=x(ae),ke={id:k.id||`edge-${g}-${M}`,index:y.length,modelType:"graph",name:k.name||"",data:k.data,value:typeof j=="number"?j:null,color:K(e.color.from,{index:y.length,seriesIndex:ne,categoryIndex:xe,datasetIndex:h},r),series:z,seriesIndex:ne,category:ae,categoryIndex:xe,source:C,sourceIndex:B,target:$,targetIndex:L};y.push(ke)});else{const k=f.map(ke=>{if(e.value.aggregate==="count")return 1;const Mt=ke[e.value.from];return typeof Mt=="number"?Mt:null}),M=ye(k,e.value.aggregate),j=A[e.series.from]||"default",z=A[e.category.from]||"default",ae=S(j),ne=x(z),xe={id:A.id||`edge-${g}-aggregated`,index:y.length,modelType:"graph",name:A.name||"",data:A.data,value:M,color:K(e.color.from,{index:y.length,seriesIndex:ae,categoryIndex:ne,datasetIndex:h},r),series:j,seriesIndex:ae,category:z,categoryIndex:ne,source:C,sourceIndex:B,target:$,targetIndex:L};y.push(xe)}}),l.push({nodes:w,edges:y})}),l},zr=(t,e,r)=>{const n=new Map,o=Array.isArray(t[0]);o?t.forEach((a,l)=>{a.forEach(i=>{const h=i[e.dataset.from]||`dataset-${l}`;n.has(h)||n.set(h,[]),n.get(h).push(i)})}):t.forEach(a=>{const l=a[e.dataset.from]||"default";n.has(l)||n.set(l,[]),n.get(l).push(a)});let s=Array.from(n.keys());if(Array.isArray(e.dataset.sort))s=e.dataset.sort.filter(a=>n.has(a)).concat(s.filter(a=>!e.dataset.sort.includes(a)));else if(e.dataset.sort==="original"){const a=[];o?t.forEach((l,i)=>{l.forEach(h=>{const b=h[e.dataset.from]||`dataset-${i}`;a.includes(b)||a.push(b)})}):t.forEach(l=>{const i=l[e.dataset.from]||"default";a.includes(i)||a.push(i)}),s=a}else e.dataset.sort==="alphabetical"&&s.sort((a,l)=>a.localeCompare(l,void 0,{numeric:!0}));const u=[];return s.forEach((a,l)=>{const i=n.get(a),h=new Map;i.forEach(c=>{const f=c[e.series.from]||"default";h.has(f)||h.set(f,[]),h.get(f).push(c)});let b=Array.from(h.keys());if(Array.isArray(e.series.sort))b=e.series.sort.filter(c=>h.has(c)).concat(b.filter(c=>!e.series.sort.includes(c)));else if(e.series.sort==="original"){const c=[];i.forEach(f=>{const g=f[e.series.from]||"default";c.includes(g)||c.push(g)}),b=c}else e.series.sort==="alphabetical"&&b.sort((c,f)=>c.localeCompare(f,void 0,{numeric:!0}));const w=new Map;i.forEach(c=>{const f=c[e.category.from]||"default";w.has(f)||w.set(f,[]),w.get(f).push(c)});let m=Array.from(w.keys());if(Array.isArray(e.category.sort))m=e.category.sort.filter(c=>w.has(c)).concat(m.filter(c=>!e.category.sort.includes(c)));else if(e.category.sort==="original"){const c=[];i.forEach(f=>{const g=f[e.category.from]||"default";c.includes(g)||c.push(g)}),m=c}else e.category.sort==="alphabetical"&&m.sort((c,f)=>c.localeCompare(f,void 0,{numeric:!0}));const v=new Map;i.forEach(c=>{const f=c.id||"unknown";v.has(f)||v.set(f,[]),v.get(f).push(c)});let y=0;const p=b[0]||"default",E=b.indexOf(p),d=new Map;Array.from(v.entries()).forEach(([c,f])=>{const g=f[0],A=g[e.series.from]||"default",C=b.indexOf(A),$=g[e.category.from]||"default",B=m.indexOf($);if(e.value.aggregate==="none"){const L=g[e.value.from],k={id:c,index:y++,modelType:"tree",name:g.name||c,data:g.data,value:typeof L=="number"?L:null,color:K(e.color.from,{index:y-1,seriesIndex:C,categoryIndex:B,datasetIndex:l},r),parent:g.parent||null,parentIndex:null,depth:0,seq:0,children:[],series:A,seriesIndex:C,category:$,categoryIndex:B};d.set(c,k)}else{const L=f.map(j=>{if(e.value.aggregate==="count")return 1;const z=j[e.value.from];return typeof z=="number"?z:null}),k=ye(L,e.value.aggregate),M={id:c,index:y++,modelType:"tree",name:g.name||c,data:g.data,value:k,color:K(e.color.from,{index:y-1,seriesIndex:C,categoryIndex:B,datasetIndex:l},r),parent:g.parent||null,parentIndex:null,depth:0,seq:0,children:[],series:A,seriesIndex:C,category:$,categoryIndex:B};d.set(c,M)}});const _=Array.from(d.values()),O=new Map;_.forEach(c=>{O.set(c.id,c.index)}),_.forEach(c=>{c.parent&&O.has(c.parent)&&(c.parentIndex=O.get(c.parent))});const S=[],x=new Map;_.forEach(c=>{c.parent===null?S.push(c):(x.has(c.parent)||x.set(c.parent,[]),x.get(c.parent).push(c))});function P(c,f){c.depth=f;const g=x.get(c.id)||[];return e.value.sort==="asc"?g.sort((A,C)=>A.value===null&&C.value===null?0:A.value===null?1:C.value===null?-1:A.value-C.value):e.value.sort==="desc"&&g.sort((A,C)=>A.value===null&&C.value===null?0:A.value===null?1:C.value===null?-1:C.value-A.value),g.forEach((A,C)=>{A.seq=C}),c.children=g.map(A=>P(A,f+1)),c}const I=S.map(c=>P(c,0));if(I.length===0)u.push({id:`empty-${a}`,index:y++,modelType:"tree",name:"Empty Tree",data:{},value:null,color:K(e.color.from,{index:y-1,seriesIndex:E<0?0:E,categoryIndex:0,datasetIndex:l},r),parent:null,parentIndex:null,depth:0,seq:0,children:[],series:p,seriesIndex:E<0?0:E,category:"default",categoryIndex:0});else if(I.length===1)u.push(I[0]);else{const c={id:`virtual-root-${a}`,index:y++,modelType:"tree",name:`Virtual Root (${a})`,data:{},value:null,color:K(e.color.from,{index:y-1,seriesIndex:E<0?0:E,categoryIndex:0,datasetIndex:l},r),parent:null,parentIndex:null,depth:0,seq:0,children:I.map((f,g)=>{const A=(C,$)=>(C.depth=$,$===1&&(C.seq=g),C.children=C.children.map(B=>A(B,$+1)),C);return A(f,1)}),series:p,seriesIndex:E<0?0:E,category:"default",categoryIndex:0};u.push(c)}}),u};function qr(t,e,r){const n=e.map(a=>r[a]).filter(a=>a&&a.parentNode===t);if(n.length===0)return;let o=!0,s=null;for(const a of n){if(s&&s.nextElementSibling!==a){o=!1;break}s=a}if(o)return;const u=document.createDocumentFragment();e.forEach(a=>{const l=r[a];l&&l.parentNode===t&&u.appendChild(l)}),t.appendChild(u)}function Ot(t,e,r,n,o){Object.keys(r).filter(i=>!e.includes(i)).forEach(i=>{const h=r[i];h&&h.parentNode===t&&t.removeChild(h),delete r[i]});const a=e.filter(i=>!r[i]);a.forEach(i=>{const h=n(i);r[i]=h,t.appendChild(h)}),e.filter(i=>r[i]&&!a.includes(i)).forEach(i=>{r[i]}),e.length>0&&qr(t,e,r)}function Wr(t){return R({element:t},{element:{toBe:"Dom",test:r=>Be(r)}})}function Yr(t){return R(t,{width:{toBe:'"auto" | number',test:r=>r==="auto"||typeof r=="number"},height:{toBe:'"auto" | number',test:r=>r==="auto"||typeof r=="number"},resizeDebounce:{toBe:"number",test:r=>typeof r=="number"}})}function $t(t){const e=R(t,{colorScheme:{toBe:'"dark" | "light" | "auto"',test:r=>r==="dark"||r==="light"||r==="auto"},colors:{toBeTypes:["object"],test:r=>r.light&&r.dark},fontSize:{toBeTypes:["string"]}});if(t.colors){const r=R(t.colors,{light:{toBeTypes:["object"],test:n=>n.data&&n.primary&&n.secondary&&n.dataContrast&&n.background},dark:{toBeTypes:["object"],test:n=>n.data&&n.primary&&n.secondary&&n.dataContrast&&n.background}});if(r.status==="error")return r;if(t.colors.light){const n=R(t.colors.light,{data:{toBeTypes:["string[]"]},primary:{toBeTypes:["string"]},secondary:{toBeTypes:["string"]},dataContrast:{toBeTypes:["string[]"]},background:{toBeTypes:["string"]}});if(n.status==="error")return n}if(t.colors.dark){const n=R(t.colors.dark,{data:{toBeTypes:["string[]"]},primary:{toBeTypes:["string"]},secondary:{toBeTypes:["string"]},dataContrast:{toBeTypes:["string[]"]},background:{toBeTypes:["string"]}});if(n.status==="error")return n}}return e}function Tt(t){const e=R(t,{dataset:{toBeTypes:["object"]},series:{toBeTypes:["object"]},category:{toBeTypes:["object"]},value:{toBeTypes:["object"]},multivariate:{toBeTypes:["object"]},color:{toBeTypes:["object"]}});if(t.dataset){const r=R(t.dataset,{from:{toBeTypes:["string"]},sort:{toBe:'"original" | "alphabetical" | string[]',test:n=>n==="original"||n==="alphabetical"||Array.isArray(n)&&n.every(o=>typeof o=="string")}});if(r.status==="error")return r}if(t.series){const r=R(t.series,{from:{toBeTypes:["string"]},sort:{toBe:'"original" | "alphabetical" | string[]',test:n=>n==="original"||n==="alphabetical"||Array.isArray(n)&&n.every(o=>typeof o=="string")}});if(r.status==="error")return r}if(t.category){const r=R(t.category,{from:{toBeTypes:["string"]},sort:{toBe:'"original" | "alphabetical" | string[]',test:n=>n==="original"||n==="alphabetical"||Array.isArray(n)&&n.every(o=>typeof o=="string")}});if(r.status==="error")return r}if(t.value){const r=R(t.value,{from:{toBeTypes:["string"]},sort:{toBe:'"original" | "asc" | "desc"',test:n=>n==="original"||n==="asc"||n==="desc"},aggregate:{toBe:'"sum" | "mean" | "median" | "min" | "max" | "count" | "none"',test:n=>["sum","mean","median","min","max","count","none"].includes(n)}});if(r.status==="error")return r}if(t.multivariate){const r=R({multivariate:t.multivariate},{multivariate:{toBe:"EncodingMultivariateItem[]",test:n=>Array.isArray(n)&&n.every(o=>typeof o.from=="string"&&typeof o.label=="string")}});if(r.status==="error")return r}if(t.color){const r=R(t.color,{from:{toBe:'"index" | "series" | "category" | "dataset"',test:n=>["index","series","category","dataset"].includes(n)}});if(r.status==="error")return r}return e}function It(t){return R({data:t},{data:{toBe:"RawDataColumn[] | RawDataColumn[][]",test:r=>Array.isArray(r)&&r.every(n=>Array.isArray(n)||Z(n))}})}function je(t){return R({plugins:t},{plugins:{toBe:"PluginEntity[]",test:r=>Array.isArray(r)&&r.every(n=>Z(n)&&typeof n._name=="string"&&typeof n._injectContext=="function")}})}function Zr(t){if(!t)return{status:"success",columnName:"",expectToBe:""};const e=R(t,{size:{toBeTypes:["object"]},theme:{toBeTypes:["object"]},data:{toBe:"RawDataColumn[] | RawDataColumn[][]",test:r=>Array.isArray(r)},encoding:{toBeTypes:["object"]},plugins:{toBe:"PluginEntity[]",test:r=>Array.isArray(r)&&r.every(n=>Z(n)&&typeof n._name=="string"&&typeof n._injectContext=="function")}});if(e.status==="error")return e;if(t.size){const r=Yr(t.size);if(r.status==="error")return r}if(t.theme){const r=$t(t.theme);if(r.status==="error")return r}if(t.encoding){const r=Tt(t.encoding);if(r.status==="error")return r}if(t.data){const r=It(t.data);if(r.status==="error")return r}if(t.plugins){const r=je(t.plugins);if(r.status==="error")return r}return e}function Jr({svgElement$:t,canvasElement$:e,pluginsInstance$:r}){let n=[],o=[];const s=(l,i,h)=>{const b=r.getValue().reduce((v,y,p)=>(v[y._getId()]=p,v),{}),w=h.map(v=>({...v,pluginSeq:b[v.pluginId]}));return(l==="svg"?n:o).filter(v=>v.pluginId!==i).map(v=>({...v,pluginSeq:b[v.pluginId]})).concat(w).sort((v,y)=>v.layerIndex-y.layerIndex||v.pluginSeq-y.pluginSeq)},u={},a={};return(l,i,h)=>{const b=l==="svg"?t.getValue():e.getValue();if(!b)return{};const w=l==="svg"?u:a,m=s(l,i,h),v=m.map(p=>St(p.pluginId,p.layerName));return l==="svg"?(Ot(b,v,w,p=>bt(p)),n=m):(Ot(b,v,w,p=>Pe(p)),o=m),Object.entries(w).reduce((p,[E,d])=>{const[_,O,S]=E.split("-");return O===i&&(p[S]=d),p},{})}}const Hr=(t,e)=>{try{const{status:v,columnName:y,expectToBe:p}=Zr(e);if(v==="error")throw new Error(H({columnName:y,expectToBe:p,from:"Chart.constructor"}));if(v==="warning")console.warn(Q({columnName:y,expectToBe:p,from:"Chart.constructor"}));else{const{status:E,columnName:d,expectToBe:_}=Wr(t);if(E==="error")throw new Error(H({columnName:d,expectToBe:_,from:"Chart.constructor"}));E==="warning"&&console.warn(Q({columnName:d,expectToBe:_,from:"Chart.constructor"}))}}catch(v){throw new Error(v)}const r=new se,n=new G((e==null?void 0:e.data)||[]),o=e&&e.encoding?J(_t,e.encoding):_t,s=new G(o),u=e&&e.theme?J(Ct,e.theme):Ct,a=new G(u),l=new G((e==null?void 0:e.plugins)||[]),i=e&&e.size?J(At,e.size):At,h=new G(i),b=new G(null),w=new G(null),m=(()=>{const v=h.pipe(kr(f=>Or(()=>f.width==="auto"||f.height==="auto",Et(t).pipe(q(g=>({width:f.width==="auto"?g.width:f.width,height:f.height==="auto"?g.height<=0?g.width:g.height:f.height})),Y(f.resizeDebounce),Ir((g,A)=>JSON.stringify(g)===JSON.stringify(A))),dr({width:f.width,height:f.height}))),Vr(r),re(1)),y=s.asObservable().pipe(re(1)),p=ee([n,s,a]).pipe(Y(0),q(([f,g,A])=>{try{return Dr(f,g,A)}catch(C){throw new Error(de({from:"Chart.seriesData$",systemMessage:C}))}}),he(f=>(console.error(U(f)),fe)),re(1)),E=ee([n,s,a]).pipe(Y(0),q(([f,g,A])=>{try{return Nr(f,g,A)}catch(C){throw new Error(de({from:"Chart.gridData$",systemMessage:C}))}}),he(f=>(console.error(U(f)),fe)),re(1)),d=ee([n,s,a]).pipe(Y(0),q(([f,g,A])=>{try{return Gr(f,g,A)}catch(C){throw new Error(de({from:"Chart.multivariateData$",systemMessage:C}))}}),he(f=>(console.error(U(f)),fe)),re(1)),_=ee([n,s,a]).pipe(Y(0),q(([f,g,A])=>{try{return Ur(f,g,A)}catch(C){throw new Error(de({from:"Chart.graphData$",systemMessage:C}))}}),he(f=>(console.error(U(f)),fe)),re(1)),O=ee([n,s,a]).pipe(Y(0),q(([f,g,A])=>{try{return zr(f,g,A)}catch(C){throw new Error(de({from:"Chart.treeData$",systemMessage:C}))}}),he(f=>(console.error(U(f)),fe)),re(1)),S=new G([]);l.subscribe(f=>{const g={},A=f.map($=>{var L;let B=$._getId();if(g[B]){const k=((L=g[B].split("[")[1])==null?void 0:L.split("]")[0])||"0",M=parseInt(k)+1;B=`${B.split("[")[0]}[${M}]`}return g[B]=$._getId(),B});f.forEach(($,B)=>$._setId(A[B]));const C=f.map($=>({id:$._getId(),name:$._name,elementType:$._elementType,shownLayers:$.getShownLayerNames()}));S.next(C)});const x=a.asObservable().pipe(re(1)),P=new se,I=P.asObservable().pipe(ut());return{root:t,svg:null,canvas:null,size$:v,encoding$:y,seriesData$:p,gridData$:E,multivariateData$:d,graphData$:_,treeData$:O,plugins$:S,theme$:x,event$:I,eventTrigger$:P,_updateLayerElements:Jr({svgElement$:b,canvasElement$:w,pluginsInstance$:l})}})();return l.subscribe(v=>{let y=!1,p=!1;v.forEach(E=>{E._elementType==="svg"?y=!0:E._elementType==="canvas"&&(p=!0)}),y&&!m.svg?(m.svg=gt("orbcharts-root-svg"),m.root.appendChild(m.svg),b.next(m.svg)):!y&&m.svg&&(m.svg.remove(),m.svg=null,b.next(null)),p&&!m.canvas?(m.canvas=Pe("orbcharts-root-canvas"),m.root.appendChild(m.canvas),w.next(m.canvas)):!p&&m.canvas&&(m.canvas.remove(),m.canvas=null,w.next(null)),v.forEach(E=>{E._injectContext(m)})}),ee({size:m.size$,svg:b}).pipe(Y(0),ge(({svg:v})=>!!v)).subscribe(({size:v,svg:y})=>{y&&(y.setAttribute("width",v.width.toString()),y.setAttribute("height",v.height.toString()))}),ee({size:m.size$,canvas:w}).pipe(Y(0),ge(({canvas:v})=>!!v)).subscribe(({size:v,canvas:y})=>{y&&(y.width=v.width,y.height=v.height)}),(()=>{function v(f){h.next(f)}function y(f){try{const{status:g,columnName:A,expectToBe:C}=It(f);if(g==="error")throw new Error(H({columnName:A,expectToBe:C,from:"Chart.setData"}));g==="warning"&&console.warn(Q({columnName:A,expectToBe:C,from:"Chart.setData"}))}catch(g){console.error(U(g))}n.next(f)}function p(f){try{const{status:A,columnName:C,expectToBe:$}=Tt(f);if(A==="error")throw new Error(H({columnName:C,expectToBe:$,from:"Chart.updateEncoding"}));A==="warning"&&console.warn(Q({columnName:C,expectToBe:$,from:"Chart.updateEncoding"}))}catch(A){console.error(U(A))}const g=J(s.getValue(),f);s.next(g)}function E(f){s.next(f)}function d(){return s.getValue()}function _(f){try{const{status:g,columnName:A,expectToBe:C}=je(f);if(g==="error")throw new Error(H({columnName:A,expectToBe:C,from:"Chart.setPlugins"}));g==="warning"&&console.warn(Q({columnName:A,expectToBe:C,from:"Chart.setPlugins"}))}catch(g){console.error(U(g))}l.next(f)}function O(f){try{const{status:g,columnName:A,expectToBe:C}=je([f]);if(g==="error")throw new Error(H({columnName:A,expectToBe:C,from:"Chart.addPlugin"}));g==="warning"&&console.warn(Q({columnName:A,expectToBe:C,from:"Chart.addPlugin"}))}catch(g){console.error(U(g))}l.next([...l.getValue(),f])}function S(f){l.next(l.getValue().filter(g=>g._getId()!==f))}function x(f){try{const{status:A,columnName:C,expectToBe:$}=$t(f);if(A==="error")throw new Error(H({columnName:C,expectToBe:$,from:"Chart.updateTheme"}));A==="warning"&&console.warn(Q({columnName:C,expectToBe:$,from:"Chart.updateTheme"}))}catch(A){console.error(U(A))}const g=J(a.getValue(),f);a.next(g)}function P(f){a.next(f)}function I(){return a.getValue()}function c(){r.next(void 0),wt(t)}return{resize:v,setData:y,updateEncoding:p,forceReplaceEncoding:E,getEncoding:d,setPlugins:_,addPlugin:O,removePlugin:S,updateTheme:x,forceReplaceTheme:P,getTheme:I,destroy:c,context:m}})()};class Qr{constructor(e,r){return Hr(e,r)}}const Bt=(t,e,r)=>{let n=e.name,o=()=>{};const s=new G(null),u=s.pipe(ge(d=>d!==null)),a={...e.layers.reduce((d,_)=>(d[_._name]=_,d),{})},l=()=>new Set(e.layers.map(d=>d._name)),i=d=>{if(d){const _=l();return Object.keys(d).filter(S=>_.has(S))}return[]},h=e.layers.reduce((d,_)=>(_._initShow&&d.push(_._name),d),[]),b=i(r),w=new G(new Set(b.length>0?b:h)),m=w.pipe(q(d=>Array.from(d).map(O=>{var S;return[O,((S=e.layers.find(x=>x._name===O))==null?void 0:S._layerIndex)??-1]}).filter(([,O])=>O!==-1).sort((O,S)=>O[1]-S[1]).map(([O])=>O))),v=new G(r??{}),y=new se,p=new F(d=>{v.subscribe(_=>{try{const{status:S,columnName:x,expectToBe:P}=e.validator(_);if(S==="error")throw new Error(H({columnName:x,expectToBe:P,from:`${e.name}.params$`}));S==="warning"&&console.warn(Q({columnName:x,expectToBe:P,from:`${e.name}.params$`}))}catch(S){console.error(U(S))}const O=J(e.defaultParams,_??{});d.next(O)}),y.subscribe(_=>{d.next(_)})}),E=u.pipe(q(d=>({context:d,pluginParams$:p})),jr());return ee({pluginSetupProps:E,ShownLayerNameSet:w,shownLayerNamesSeq:m}).pipe(Y(0)).subscribe(({pluginSetupProps:d,ShownLayerNameSet:_,shownLayerNamesSeq:O})=>{const S=d.context._updateLayerElements(t,n,O.map(x=>({pluginId:n,pluginName:e.name,layerName:x,layerIndex:a[x]._layerIndex})));e.setup&&(o=e.setup(d)),e.layers.forEach(x=>{var P,I;if(_.has(x._name)){const c=t==="svg"?{svgG:S[x._name],context:d.context,pluginParams$:p,initLayerParams:((P=v.getValue())==null?void 0:P[x._name])||{}}:{canvas:S[x._name],context:d.context,pluginParams$:p,initLayerParams:((I=v.getValue())==null?void 0:I[x._name])||{}};x._enable(c)}else x._disable()})}),{_name:e.name,_elementType:t,_getId:()=>n,_setId:d=>{n=d},_injectContext:d=>{s.next(Object.assign({},d))},show:d=>{d=Array.isArray(d)?d:[d],w.next(new Set([...Array.from(w.getValue()),...d]))},showOnly:d=>{d=Array.isArray(d)?d:[d],w.next(new Set([...d]))},showAll:()=>{w.next(l())},hide:d=>{d=Array.isArray(d)?d:[d],w.next(new Set([...Array.from(w.getValue()).filter(_=>!d.includes(_))]))},hideAll:()=>{w.next(new Set)},toggle:d=>{d=Array.isArray(d)?d:[d],Array.from(w.getValue()).forEach(_=>{d.includes(_)?d.splice(d.indexOf(_),1):d.push(_)}),w.next(new Set(d))},getShownLayerNames:()=>Array.from(w.getValue()),updateParams:d=>{v.next(d),Object.keys(d).forEach(_=>{const O=a[_];O&&O._updateParams(d[_])})},forceReplaceParams:d=>{y.next(d),Object.keys(d).forEach(_=>{const O=a[_];O&&O._forceReplaceParams(d[_])})},getParams:()=>e.layers.reduce((d,_)=>(d[_._name]=_._getParams(),d),{}),destroy:()=>{o(),s.complete(),w.complete(),e.layers.forEach(d=>{d._destroy()})}}},Xr=t=>class{constructor(r){return Bt("svg",t,r)}},Pt=(t,e)=>{const r=new G(Object.assign({},e.defaultParams));let n=()=>{};const o=new G(null),s=o.pipe(ge(u=>u!==null));return ee({layerParams:r,enabledProps:s}).pipe(Y(0)).subscribe(({layerParams:u,enabledProps:a})=>{n(),n=t==="svg"?e.setup({svgG:a.svgG,context:a.context,pluginParams$:a.pluginParams$,layerParams$:r.pipe(q(l=>J(l,a.initLayerParams??{})))}):e.setup({canvas:a.canvas,context:a.context,pluginParams$:a.pluginParams$,layerParams$:r.pipe(q(l=>J(l,a.initLayerParams??{})))})}),o.pipe(ge(u=>u===null)).subscribe(()=>{n()}),{_name:e.name,_defaultParams:e.defaultParams,_layerIndex:e.layerIndex,_initShow:e.initShow,_enable:u=>{o.next(u)},_disable:()=>{o.next(null)},_updateParams:u=>{try{const{status:l,columnName:i,expectToBe:h}=e.validator(u);if(l==="error")throw new Error(H({columnName:i,expectToBe:h,from:`${e.name}.params$`}));l==="warning"&&console.warn(Q({columnName:i,expectToBe:h,from:`${e.name}.params$`}))}catch(l){console.error(U(l))}const a=J(r.getValue(),u);r.next(a)},_forceReplaceParams:u=>{r.next(u)},_getParams:()=>r.getValue(),_destroy:()=>{o.next(null),o.complete(),r.complete()}}},en=t=>class{constructor(){return Pt("svg",t)}},tn=t=>class{constructor(r){return Bt("canvas",t,r)}},rn=t=>class{constructor(){return Pt("canvas",t)}};T.OrbCharts=Qr,T.aggregate=ye,T.count=dt,T.createCanvas=Pe,T.createCanvasElement=Rr,T.createDiv=Fr,T.createLayerClassName=St,T.createMessagePrefix=Me,T.createOrbChartsErrorMessage=U,T.createPluginClassName=xt,T.createSVG=gt,T.createSVGGroup=bt,T.createUnexpectedErrorMessage=de,T.createValidatorErrorMessage=H,T.createValidatorWarningMessage=Q,T.deepOverwrite=J,T.defineCanvasLayer=rn,T.defineCanvasPlugin=tn,T.defineSVGLayer=en,T.defineSVGPlugin=Xr,T.formatCommaNumber=Lr,T.getColorByFrom=K,T.getColorByIndex=mt,T.isDom=Be,T.isFunction=vt,T.isPlainObject=Z,T.max=yt,T.mean=ct,T.median=ft,T.min=ht,T.none=pt,T.removeElementChildren=wt,T.resizeObservable=Et,T.sum=lt,T.validateObject=R,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
8
|
+
----> find in '${r}'`}function At(t){return new F(e=>{const r=new ResizeObserver(n=>{const s=n[0];s&&s.contentRect&&e.next(s.contentRect)});return r.observe(t),function(){r.unobserve(t)}})}function St(t){return`orbcharts-${t}`}function xt(t,e){return`${St(t)}-${e}`}function Dr(t,e){const r={string:o=>typeof o=="string",number:o=>typeof o=="number",boolean:o=>typeof o=="boolean",object:o=>H(o),"object[]":o=>Array.isArray(o)&&o.every(u=>H(u)),"string[]":o=>Array.isArray(o)&&o.every(u=>typeof u=="string"),"number[]":o=>Array.isArray(o)&&o.every(u=>typeof u=="number"),Function:o=>gt(o),null:o=>o===null,undefined:o=>o===void 0},n={ColorType:o=>o==="none"||o==="data"||o==="primary"||o==="secondary"||o==="dataContrast"||o==="background"};return Object.keys(t).find(o=>{if(e[o]){const u=e[o],a=t[o];if(a===void 0)return!1;if(u.toBeTypes){if(u.toBeTypes.some(f=>r[f](a))===!1)return!0}else if(u.toBe){const{toBe:c,test:i}=u;if(i(a)===!1)return!0}else if(u.toBeOption){const c=u.toBeOption;if(n[c](a)===!1)return!0}}return!1})}function R(t,e){const r=Dr(t,e);if(r){const n=e[r],s=n.toBeTypes?n.toBeTypes.join(" | "):n.toBe?n.toBe:n.toBeOption?n.toBeOption:"";return{status:"error",columnName:r,expectToBe:s}}else return{status:"success",columnName:"",expectToBe:""}}const _t={width:"auto",height:"auto",resizeDebounce:50},Ct={dataset:{from:"dataset",sort:"original",ignore:!1},series:{from:"series",sort:"original",ignore:!1},category:{from:"category",sort:"original",ignore:!1},value:{from:"value",sort:"original",aggregate:"none"},multivariate:[{from:"x",name:"x"},{from:"y",name:"y"},{from:"z",name:"z"}],color:{by:"series"}},Tt={colorScheme:"light",colors:{light:{data:["#4E79A7","#F28E2B","#E15759","#76B7B2","#59A14F","#EDC948","#B07AA1","#FF9DA7","#9C755F","#BAB0AC"],primary:"#000000",secondary:"#e0e0e0",dataContrast:["#ffffff","#000000"],background:"#FFFFFF"},dark:{data:["#7EA6E0","#FFB86B","#FF7A7A","#6ED0CC","#7ED97A","#FFE06E","#D4A5D8","#FFB3BA","#C89F7A","#D3D3D3"],primary:"#FFFFFF",secondary:"#e0e0e0",dataContrast:["#ffffff","#000000"],background:"#000000"}},fontSize:"0.875rem"},Nr=(t,e,r)=>{const n=new Map,s=Array.isArray(t[0]);s?t.forEach((a,c)=>{a.forEach(i=>{const f=T(i,e.dataset,`dataset-${c}`);n.has(f)||n.set(f,[]),n.get(f).push(i)})}):t.forEach(a=>{const c=T(a,e.dataset,"");n.has(c)||n.set(c,[]),n.get(c).push(a)});let o=Array.from(n.keys());if(Array.isArray(e.dataset.sort))o=e.dataset.sort.filter(a=>n.has(a)).concat(o.filter(a=>!e.dataset.sort.includes(a)));else if(e.dataset.sort==="original"){const a=[];s?t.forEach((c,i)=>{c.forEach(f=>{const w=T(f,e.dataset,`dataset-${i}`);a.includes(w)||a.push(w)})}):t.forEach(c=>{const i=T(c,e.dataset,"");a.includes(i)||a.push(i)}),o=a}else e.dataset.sort==="alphabetical"&&o.sort((a,c)=>a.localeCompare(c,void 0,{numeric:!0}));const u=[];return o.forEach((a,c)=>{const i=n.get(a),f=new Map;i.forEach(v=>{const d=T(v,e.series,"");f.has(d)||f.set(d,[]),f.get(d).push(v)});let w=Array.from(f.keys());if(Array.isArray(e.series.sort))w=e.series.sort.filter(v=>f.has(v)).concat(w.filter(v=>!e.series.sort.includes(v)));else if(e.series.sort==="original"){const v=[];i.forEach(d=>{const b=T(d,e.series,"");v.includes(b)||v.push(b)}),w=v}else e.series.sort==="alphabetical"&&w.sort((v,d)=>v.localeCompare(d,void 0,{numeric:!0}));const x=[];if(e.category.sort==="original")i.forEach(v=>{const d=T(v,e.category,"");x.includes(d)||x.push(d)});else if(e.category.sort==="alphabetical"){const v=new Set;i.forEach(d=>{v.add(T(d,e.category,""))}),x.push(...Array.from(v).sort((d,b)=>d.localeCompare(b,void 0,{numeric:!0})))}else if(Array.isArray(e.category.sort)){const v=[];i.forEach(b=>{const O=T(b,e.category,"");v.includes(O)||v.push(O)});const d=e.category.sort;x.push(...d.filter(b=>v.includes(b)),...v.filter(b=>!d.includes(b)))}const y=new Map;x.forEach((v,d)=>{y.set(v,d)});const S=[];w.forEach((v,d)=>{const b=f.get(v),O=new Map;b.forEach(p=>{const E=T(p,e.category,"");O.has(E)||O.set(E,[]),O.get(E).push(p)});const $=x.filter(p=>O.has(p)),h=[];e.category.sort==="original"&&e.value.aggregate==="none"?(b.forEach((p,E)=>{const j=T(p,e.category,""),I=y.get(j),l=p[e.value.from];h.push({id:p.id||`${a}-${v}-${j}-${E}`,index:I,modelType:"series",name:p.name||"",data:p.data,value:typeof l=="number"?l:null,color:D(e.color.by,{index:I,seriesIndex:d,categoryIndex:I,datasetIndex:c},r),series:v,seriesIndex:d,category:j,categoryIndex:I})}),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)):$.forEach(p=>{const E=y.get(p),j=O.get(p);if(e.value.aggregate==="none"){let I=j.map((l,m)=>{const C=l[e.value.from];return{id:l.id||`${a}-${v}-${p}-${m}`,index:E,modelType:"series",name:l.name||"",data:l.data,value:typeof C=="number"?C:null,color:D(e.color.by,{index:E,seriesIndex:d,categoryIndex:E,datasetIndex:c},r),series:v,seriesIndex:d,category:p,categoryIndex:E}});e.value.sort==="asc"?I.sort((l,m)=>l.value===null&&m.value===null?0:l.value===null?1:m.value===null?-1:l.value-m.value):e.value.sort==="desc"&&I.sort((l,m)=>l.value===null&&m.value===null?0:l.value===null?1:m.value===null?-1:m.value-l.value),h.push(...I)}else{const I=j.map(B=>{if(e.value.aggregate==="count")return 1;const g=B[e.value.from];return typeof g=="number"?g:null}),l=pe(I,e.value.aggregate),m=j[0],C={id:m.id||`${a}-${v}-${p}-aggregated`,index:E,modelType:"series",name:m.name||p,data:m.data,value:l,color:D(e.color.by,{index:E,seriesIndex:d,categoryIndex:E,datasetIndex:c},r),series:v,seriesIndex:d,category:p,categoryIndex:E};h.push(C)}}),S.push(h)}),u.push(S)}),u},Gr=(t,e,r)=>{const n=new Map,s=Array.isArray(t[0]);s?t.forEach((a,c)=>{a.forEach(i=>{const f=T(i,e.dataset,`dataset-${c}`);n.has(f)||n.set(f,[]),n.get(f).push(i)})}):t.forEach(a=>{const c=T(a,e.dataset,"");n.has(c)||n.set(c,[]),n.get(c).push(a)});let o=Array.from(n.keys());if(Array.isArray(e.dataset.sort))o=e.dataset.sort.filter(a=>n.has(a)).concat(o.filter(a=>!e.dataset.sort.includes(a)));else if(e.dataset.sort==="original"){const a=[];s?t.forEach((c,i)=>{c.forEach(f=>{const w=T(f,e.dataset,`dataset-${i}`);a.includes(w)||a.push(w)})}):t.forEach(c=>{const i=T(c,e.dataset,"");a.includes(i)||a.push(i)}),o=a}else e.dataset.sort==="alphabetical"&&o.sort((a,c)=>a.localeCompare(c,void 0,{numeric:!0}));const u=[];return o.forEach((a,c)=>{const i=n.get(a),f=new Map;i.forEach(d=>{const b=T(d,e.series,"");f.has(b)||f.set(b,[]),f.get(b).push(d)});let w=Array.from(f.keys());if(Array.isArray(e.series.sort))w=e.series.sort.filter(d=>f.has(d)).concat(w.filter(d=>!e.series.sort.includes(d)));else if(e.series.sort==="original"){const d=[];i.forEach(b=>{const O=T(b,e.series,"");d.includes(O)||d.push(O)}),w=d}else e.series.sort==="alphabetical"&&w.sort((d,b)=>d.localeCompare(b,void 0,{numeric:!0}));const x=[];i.forEach(d=>{const b=T(d,e.category,"");x.includes(b)||x.push(b)});const y=new Set(x);let S=Array.from(y);Array.isArray(e.category.sort)?S=e.category.sort.filter(d=>y.has(d)).concat(S.filter(d=>!e.category.sort.includes(d))):e.category.sort==="original"?S=x:e.category.sort==="alphabetical"&&S.sort((d,b)=>d.localeCompare(b,void 0,{numeric:!0}));const v=[];w.forEach((d,b)=>{const O=f.get(d),$=new Map;O.forEach(p=>{const E=T(p,e.category,"");$.has(E)||$.set(E,[]),$.get(E).push(p)});const h=[];S.forEach((p,E)=>{const j=$.get(p);if(!j)h.push({id:`${a}-${d}-${p}-null`,index:E,modelType:"grid",name:p,data:void 0,value:null,color:D(e.color.by,{index:E,seriesIndex:b,categoryIndex:E,datasetIndex:c},r),series:d,seriesIndex:b,category:p,categoryIndex:E});else if(e.value.aggregate==="none"){let I=j.map((l,m)=>{const C=l[e.value.from];return{id:l.id||`${a}-${d}-${p}-${m}`,index:E,modelType:"grid",name:l.name||"",data:l.data,value:typeof C=="number"?C:null,color:D(e.color.by,{index:E,seriesIndex:b,categoryIndex:E,datasetIndex:c},r),series:d,seriesIndex:b,category:p,categoryIndex:E}});e.value.sort==="asc"?I.sort((l,m)=>l.value===null&&m.value===null?0:l.value===null?1:m.value===null?-1:l.value-m.value):e.value.sort==="desc"&&I.sort((l,m)=>l.value===null&&m.value===null?0:l.value===null?1:m.value===null?-1:m.value-l.value),h.push(...I)}else{const I=j.map(B=>{if(e.value.aggregate==="count")return 1;const g=B[e.value.from];return typeof g=="number"?g:null}),l=pe(I,e.value.aggregate),m=j[0],C={id:m.id||`${a}-${d}-${p}-aggregated`,index:E,modelType:"grid",name:m.name||p,data:m.data,value:l,color:D(e.color.by,{index:E,seriesIndex:b,categoryIndex:E,datasetIndex:c},r),series:d,seriesIndex:b,category:p,categoryIndex:E};h.push(C)}}),v.push(h)}),u.push(v)}),u},Ur=(t,e,r)=>{const n=new Map,s=Array.isArray(t[0]);s?t.forEach((a,c)=>{a.forEach(i=>{const f=T(i,e.dataset,`dataset-${c}`);n.has(f)||n.set(f,[]),n.get(f).push(i)})}):t.forEach(a=>{const c=T(a,e.dataset,"");n.has(c)||n.set(c,[]),n.get(c).push(a)});let o=Array.from(n.keys());if(Array.isArray(e.dataset.sort))o=e.dataset.sort.filter(a=>n.has(a)).concat(o.filter(a=>!e.dataset.sort.includes(a)));else if(e.dataset.sort==="original"){const a=[];s?t.forEach((c,i)=>{c.forEach(f=>{const w=T(f,e.dataset,`dataset-${i}`);a.includes(w)||a.push(w)})}):t.forEach(c=>{const i=T(c,e.dataset,"");a.includes(i)||a.push(i)}),o=a}else e.dataset.sort==="alphabetical"&&o.sort((a,c)=>a.localeCompare(c,void 0,{numeric:!0}));const u=[];return o.forEach((a,c)=>{const i=n.get(a),f=new Map;i.forEach(y=>{const S=T(y,e.series,"");f.has(S)||f.set(S,[]),f.get(S).push(y)});let w=Array.from(f.keys());if(Array.isArray(e.series.sort))w=e.series.sort.filter(y=>f.has(y)).concat(w.filter(y=>!e.series.sort.includes(y)));else if(e.series.sort==="original"){const y=[];i.forEach(S=>{const v=T(S,e.series,"");y.includes(v)||y.push(v)}),w=y}else e.series.sort==="alphabetical"&&w.sort((y,S)=>y.localeCompare(S,void 0,{numeric:!0}));const x=[];w.forEach((y,S)=>{const v=f.get(y),d=new Map;v.forEach($=>{const h=T($,e.category,"");d.has(h)||d.set(h,[]),d.get(h).push($)});let b=Array.from(d.keys());if(Array.isArray(e.category.sort))b=e.category.sort.filter($=>d.has($)).concat(b.filter($=>!e.category.sort.includes($)));else if(e.category.sort==="original"){const $=[];v.forEach(h=>{const p=T(h,e.category,"");$.includes(p)||$.push(p)}),b=$}else e.category.sort==="alphabetical"&&b.sort(($,h)=>$.localeCompare(h,void 0,{numeric:!0}));const O=[];b.forEach(($,h)=>{d.get($).forEach((E,j)=>{const I=e.multivariate.map((m,C)=>({index:C,name:m.name,value:(()=>{const B=E[m.from];return typeof B=="number"?B:null})()})),l={id:E.id||`${a}-${y}-${$}-${j}`,index:j,modelType:"multivariate",name:E.name||"",data:E.data,value:null,color:D(e.color.by,{index:j,seriesIndex:S,categoryIndex:h,datasetIndex:c},r),multivariate:I,series:y,seriesIndex:S,category:$,categoryIndex:h};O.push(l)})}),x.push(O)}),u.push(x)}),u},zr=(t,e,r)=>{const n=Array.isArray(t[0]),s=[],o=[];n?t.forEach(i=>{i.forEach(f=>{f.source&&f.target?o.push(f):s.push(f)})}):t.forEach(i=>{i.source&&i.target?o.push(i):s.push(i)});const u=new Map;n?t.forEach((i,f)=>{i.forEach(w=>{if(!w.source||!w.target){const x=T(w,e.dataset,`dataset-${f}`);u.has(x)||u.set(x,[]),u.get(x).push(w)}})}):s.forEach(i=>{const f=T(i,e.dataset,"");u.has(f)||u.set(f,[]),u.get(f).push(i)});let a=Array.from(u.keys());if(Array.isArray(e.dataset.sort))a=e.dataset.sort.filter(i=>u.has(i)).concat(a.filter(i=>!e.dataset.sort.includes(i)));else if(e.dataset.sort==="original"){const i=[];n?t.forEach((f,w)=>{f.forEach(x=>{if(!x.source||!x.target){const y=T(x,e.dataset,`dataset-${w}`);i.includes(y)||i.push(y)}})}):s.forEach(f=>{const w=T(f,e.dataset,"");i.includes(w)||i.push(w)}),a=i}else e.dataset.sort==="alphabetical"&&a.sort((i,f)=>i.localeCompare(f,void 0,{numeric:!0}));const c=[];return a.forEach((i,f)=>{const w=u.get(i),x=[],y=new Map;w.forEach(l=>{const m=T(l,e.series,"");y.has(m)||y.set(m,[]),y.get(m).push(l)});let S=Array.from(y.keys());if(Array.isArray(e.series.sort))S=e.series.sort.filter(l=>y.has(l)).concat(S.filter(l=>!e.series.sort.includes(l)));else if(e.series.sort==="original"){const l=[];w.forEach(m=>{const C=T(m,e.series,"");l.includes(C)||l.push(C)}),S=l}else e.series.sort==="alphabetical"&&S.sort((l,m)=>l.localeCompare(m,void 0,{numeric:!0}));S.forEach((l,m)=>{const C=y.get(l),B=new Map;C.forEach(A=>{const _=T(A,e.category,"");B.has(_)||B.set(_,[]),B.get(_).push(A)});let g=Array.from(B.keys());if(Array.isArray(e.category.sort))g=e.category.sort.filter(A=>B.has(A)).concat(g.filter(A=>!e.category.sort.includes(A)));else if(e.category.sort==="original"){const A=[];C.forEach(_=>{const P=T(_,e.category,"");A.includes(P)||A.push(P)}),g=A}else e.category.sort==="alphabetical"&&g.sort((A,_)=>A.localeCompare(_,void 0,{numeric:!0}));g.forEach((A,_)=>{const P=B.get(A);if(e.value.aggregate==="none"){let k=P.map((L,V)=>{const N=L[e.value.from];return{id:L.id||`${i}-${l}-${A}-${V}`,index:x.length+V,modelType:"graph",name:L.name||"",data:L.data,value:typeof N=="number"?N:null,color:D(e.color.by,{index:_,seriesIndex:m,categoryIndex:_,datasetIndex:f},r),series:l,seriesIndex:m,category:A,categoryIndex:_}});e.value.sort==="asc"?k.sort((L,V)=>L.value===null&&V.value===null?0:L.value===null?1:V.value===null?-1:L.value-V.value):e.value.sort==="desc"&&k.sort((L,V)=>L.value===null&&V.value===null?0:L.value===null?1:V.value===null?-1:V.value-L.value),x.push(...k)}else{const k=P.map(re=>{if(e.value.aggregate==="count")return 1;const oe=re[e.value.from];return typeof oe=="number"?oe:null}),L=pe(k,e.value.aggregate),V=P[0],N={id:V.id||`${i}-${l}-${A}-aggregated`,index:x.length,modelType:"graph",name:V.name||A,data:V.data,value:L,color:D(e.color.by,{index:_,seriesIndex:m,categoryIndex:_,datasetIndex:f},r),series:l,seriesIndex:m,category:A,categoryIndex:_};x.push(N)}})});const v=[],d=new Map;x.forEach(l=>{const m=s.find(C=>C.id===l.id||C.name===l.name);m!=null&&m.id&&d.set(m.id,l.index),m!=null&&m.name&&d.set(m.name,l.index)});const b=new Map,O=new Map;x.forEach(l=>{b.has(l.series)||b.set(l.series,l.seriesIndex),O.has(l.category)||O.set(l.category,l.categoryIndex)});let $=b.size,h=O.size;const p=l=>(b.has(l)||b.set(l,$++),b.get(l)),E=l=>(O.has(l)||O.set(l,h++),O.get(l)),j=o.filter(l=>T(l,e.dataset,"")===i),I=new Map;j.forEach(l=>{const m=l.source,C=l.target,B=T(l,e.series,""),g=T(l,e.category,""),A=`${m}-${C}-${B}-${g}`;I.has(A)||I.set(A,[]),I.get(A).push(l)}),Array.from(I.entries()).forEach(([l,m],C)=>{const B=m[0],g=B.source,A=B.target,_=d.get(g)??-1,P=d.get(A)??-1;if(_>=0&&P>=0)if(e.value.aggregate==="none")m.forEach((k,L)=>{const V=k[e.value.from],N=T(k,e.series,""),re=T(k,e.category,""),oe=p(N),Se=E(re),Le={id:k.id||`edge-${C}-${L}`,index:v.length,modelType:"graph",name:k.name||"",data:k.data,value:typeof V=="number"?V:null,color:D(e.color.by,{index:v.length,seriesIndex:oe,categoryIndex:Se,datasetIndex:f},r),series:N,seriesIndex:oe,category:re,categoryIndex:Se,source:g,sourceIndex:_,target:A,targetIndex:P};v.push(Le)});else{const k=m.map(Le=>{if(e.value.aggregate==="count")return 1;const jt=Le[e.value.from];return typeof jt=="number"?jt:null}),L=pe(k,e.value.aggregate),V=T(B,e.series,""),N=T(B,e.category,""),re=p(V),oe=E(N),Se={id:B.id||`edge-${C}-aggregated`,index:v.length,modelType:"graph",name:B.name||"",data:B.data,value:L,color:D(e.color.by,{index:v.length,seriesIndex:re,categoryIndex:oe,datasetIndex:f},r),series:V,seriesIndex:re,category:N,categoryIndex:oe,source:g,sourceIndex:_,target:A,targetIndex:P};v.push(Se)}}),c.push({nodes:x,edges:v})}),c},qr=(t,e,r)=>{const n=new Map,s=Array.isArray(t[0]);s?t.forEach((a,c)=>{a.forEach(i=>{const f=T(i,e.dataset,`dataset-${c}`);n.has(f)||n.set(f,[]),n.get(f).push(i)})}):t.forEach(a=>{const c=T(a,e.dataset,"");n.has(c)||n.set(c,[]),n.get(c).push(a)});let o=Array.from(n.keys());if(Array.isArray(e.dataset.sort))o=e.dataset.sort.filter(a=>n.has(a)).concat(o.filter(a=>!e.dataset.sort.includes(a)));else if(e.dataset.sort==="original"){const a=[];s?t.forEach((c,i)=>{c.forEach(f=>{const w=T(f,e.dataset,`dataset-${i}`);a.includes(w)||a.push(w)})}):t.forEach(c=>{const i=T(c,e.dataset,"");a.includes(i)||a.push(i)}),o=a}else e.dataset.sort==="alphabetical"&&o.sort((a,c)=>a.localeCompare(c,void 0,{numeric:!0}));const u=[];return o.forEach((a,c)=>{const i=n.get(a),f=new Map;i.forEach(l=>{const m=T(l,e.series,"");f.has(m)||f.set(m,[]),f.get(m).push(l)});let w=Array.from(f.keys());if(Array.isArray(e.series.sort))w=e.series.sort.filter(l=>f.has(l)).concat(w.filter(l=>!e.series.sort.includes(l)));else if(e.series.sort==="original"){const l=[];i.forEach(m=>{const C=T(m,e.series,"");l.includes(C)||l.push(C)}),w=l}else e.series.sort==="alphabetical"&&w.sort((l,m)=>l.localeCompare(m,void 0,{numeric:!0}));const x=new Map;i.forEach(l=>{const m=T(l,e.category,"");x.has(m)||x.set(m,[]),x.get(m).push(l)});let y=Array.from(x.keys());if(Array.isArray(e.category.sort))y=e.category.sort.filter(l=>x.has(l)).concat(y.filter(l=>!e.category.sort.includes(l)));else if(e.category.sort==="original"){const l=[];i.forEach(m=>{const C=T(m,e.category,"");l.includes(C)||l.push(C)}),y=l}else e.category.sort==="alphabetical"&&y.sort((l,m)=>l.localeCompare(m,void 0,{numeric:!0}));const S=new Map;i.forEach(l=>{const m=l.id||"unknown";S.has(m)||S.set(m,[]),S.get(m).push(l)});let v=0;const d=w[0]||"",b=w.indexOf(d),O=new Map;Array.from(S.entries()).forEach(([l,m])=>{const C=m[0],B=T(C,e.series,""),g=w.indexOf(B),A=T(C,e.category,""),_=y.indexOf(A);if(e.value.aggregate==="none"){const P=C[e.value.from],k={id:l,index:v++,modelType:"tree",name:C.name||l,data:C.data,value:typeof P=="number"?P:null,color:D(e.color.by,{index:v-1,seriesIndex:g,categoryIndex:_,datasetIndex:c},r),parent:C.parent||null,parentIndex:null,depth:0,seq:0,children:[],series:B,seriesIndex:g,category:A,categoryIndex:_};O.set(l,k)}else{const P=m.map(V=>{if(e.value.aggregate==="count")return 1;const N=V[e.value.from];return typeof N=="number"?N:null}),k=pe(P,e.value.aggregate),L={id:l,index:v++,modelType:"tree",name:C.name||l,data:C.data,value:k,color:D(e.color.by,{index:v-1,seriesIndex:g,categoryIndex:_,datasetIndex:c},r),parent:C.parent||null,parentIndex:null,depth:0,seq:0,children:[],series:B,seriesIndex:g,category:A,categoryIndex:_};O.set(l,L)}});const $=Array.from(O.values()),h=new Map;$.forEach(l=>{h.set(l.id,l.index)}),$.forEach(l=>{l.parent&&h.has(l.parent)&&(l.parentIndex=h.get(l.parent))});const p=[],E=new Map;$.forEach(l=>{l.parent===null?p.push(l):(E.has(l.parent)||E.set(l.parent,[]),E.get(l.parent).push(l))});function j(l,m){l.depth=m;const C=E.get(l.id)||[];return e.value.sort==="asc"?C.sort((B,g)=>B.value===null&&g.value===null?0:B.value===null?1:g.value===null?-1:B.value-g.value):e.value.sort==="desc"&&C.sort((B,g)=>B.value===null&&g.value===null?0:B.value===null?1:g.value===null?-1:g.value-B.value),C.forEach((B,g)=>{B.seq=g}),l.children=C.map(B=>j(B,m+1)),l}const I=p.map(l=>j(l,0));if(I.length===0)u.push({id:`empty-${a}`,index:v++,modelType:"tree",name:"Empty Tree",data:{},value:null,color:D(e.color.by,{index:v-1,seriesIndex:b<0?0:b,categoryIndex:0,datasetIndex:c},r),parent:null,parentIndex:null,depth:0,seq:0,children:[],series:d,seriesIndex:b<0?0:b,category:"",categoryIndex:0});else if(I.length===1)u.push(I[0]);else{const l={id:`virtual-root-${a}`,index:v++,modelType:"tree",name:`Virtual Root (${a})`,data:{},value:null,color:D(e.color.by,{index:v-1,seriesIndex:b<0?0:b,categoryIndex:0,datasetIndex:c},r),parent:null,parentIndex:null,depth:0,seq:0,children:I.map((m,C)=>{const B=(g,A)=>(g.depth=A,A===1&&(g.seq=C),g.children=g.children.map(_=>B(_,A+1)),g);return B(m,1)}),series:d,seriesIndex:b<0?0:b,category:"",categoryIndex:0};u.push(l)}}),u};function Wr(t,e,r){const n=e.map(a=>r[a]).filter(a=>a&&a.parentNode===t);if(n.length===0)return;let s=!0,o=null;for(const a of n){if(o&&o.nextElementSibling!==a){s=!1;break}o=a}if(s)return;const u=document.createDocumentFragment();e.forEach(a=>{const c=r[a];c&&c.parentNode===t&&u.appendChild(c)}),t.appendChild(u)}function Ot(t,e,r,n,s){Object.keys(r).filter(i=>!e.includes(i)).forEach(i=>{const f=r[i];f&&f.parentNode===t&&t.removeChild(f),delete r[i]});const a=e.filter(i=>!r[i]);a.forEach(i=>{const f=n(i);r[i]=f,t.appendChild(f)}),e.filter(i=>r[i]&&!a.includes(i)).forEach(i=>{r[i]}),e.length>0&&Wr(t,e,r)}function Yr(t){return R({element:t},{element:{toBe:"Dom",test:r=>Pe(r)}})}function Zr(t){return R(t,{width:{toBe:'"auto" | number',test:r=>r==="auto"||typeof r=="number"},height:{toBe:'"auto" | number',test:r=>r==="auto"||typeof r=="number"},resizeDebounce:{toBe:"number",test:r=>typeof r=="number"}})}function $t(t){const e=R(t,{colorScheme:{toBe:'"dark" | "light" | "auto"',test:r=>r==="dark"||r==="light"||r==="auto"},colors:{toBeTypes:["object"],test:r=>r.light&&r.dark},fontSize:{toBeTypes:["string"]}});if(t.colors){const r=R(t.colors,{light:{toBeTypes:["object"],test:n=>n.data&&n.primary&&n.secondary&&n.dataContrast&&n.background},dark:{toBeTypes:["object"],test:n=>n.data&&n.primary&&n.secondary&&n.dataContrast&&n.background}});if(r.status==="error")return r;if(t.colors.light){const n=R(t.colors.light,{data:{toBeTypes:["string[]"]},primary:{toBeTypes:["string"]},secondary:{toBeTypes:["string"]},dataContrast:{toBeTypes:["string[]"]},background:{toBeTypes:["string"]}});if(n.status==="error")return n}if(t.colors.dark){const n=R(t.colors.dark,{data:{toBeTypes:["string[]"]},primary:{toBeTypes:["string"]},secondary:{toBeTypes:["string"]},dataContrast:{toBeTypes:["string[]"]},background:{toBeTypes:["string"]}});if(n.status==="error")return n}}return e}function It(t){const e=R(t,{dataset:{toBeTypes:["object"]},series:{toBeTypes:["object"]},category:{toBeTypes:["object"]},value:{toBeTypes:["object"]},multivariate:{toBeTypes:["object"]},color:{toBeTypes:["object"]}});if(t.dataset){const r=R(t.dataset,{from:{toBeTypes:["string"]},sort:{toBe:'"original" | "alphabetical" | string[]',test:n=>n==="original"||n==="alphabetical"||Array.isArray(n)&&n.every(s=>typeof s=="string")},ignore:{toBeTypes:["boolean"]}});if(r.status==="error")return r}if(t.series){const r=R(t.series,{from:{toBeTypes:["string"]},sort:{toBe:'"original" | "alphabetical" | string[]',test:n=>n==="original"||n==="alphabetical"||Array.isArray(n)&&n.every(s=>typeof s=="string")},ignore:{toBeTypes:["boolean"]}});if(r.status==="error")return r}if(t.category){const r=R(t.category,{from:{toBeTypes:["string"]},sort:{toBe:'"original" | "alphabetical" | string[]',test:n=>n==="original"||n==="alphabetical"||Array.isArray(n)&&n.every(s=>typeof s=="string")},ignore:{toBeTypes:["boolean"]}});if(r.status==="error")return r}if(t.value){const r=R(t.value,{from:{toBeTypes:["string"]},sort:{toBe:'"original" | "asc" | "desc"',test:n=>n==="original"||n==="asc"||n==="desc"},aggregate:{toBe:'"sum" | "mean" | "median" | "min" | "max" | "count" | "none"',test:n=>["sum","mean","median","min","max","count","none"].includes(n)}});if(r.status==="error")return r}if(t.multivariate){const r=R({multivariate:t.multivariate},{multivariate:{toBe:"EncodingMultivariateItem[]",test:n=>Array.isArray(n)&&n.every(s=>typeof s.from=="string"&&typeof s.label=="string")}});if(r.status==="error")return r}if(t.color){const r=R(t.color,{by:{toBe:'"index" | "series" | "category" | "dataset"',test:n=>["index","series","category","dataset"].includes(n)}});if(r.status==="error")return r}return e}function Bt(t){return R({data:t},{data:{toBe:"RawDataColumn[] | RawDataColumn[][]",test:r=>Array.isArray(r)&&r.every(n=>Array.isArray(n)||H(n))}})}function ke(t){return R({plugins:t},{plugins:{toBe:"PluginEntity[]",test:r=>Array.isArray(r)&&r.every(n=>H(n)&&typeof n._name=="string"&&typeof n._injectContext=="function")}})}function Jr(t){if(!t)return{status:"success",columnName:"",expectToBe:""};const e=R(t,{size:{toBeTypes:["object"]},theme:{toBeTypes:["object"]},data:{toBe:"RawDataColumn[] | RawDataColumn[][]",test:r=>Array.isArray(r)},encoding:{toBeTypes:["object"]},plugins:{toBe:"PluginEntity[]",test:r=>Array.isArray(r)&&r.every(n=>H(n)&&typeof n._name=="string"&&typeof n._injectContext=="function")}});if(e.status==="error")return e;if(t.size){const r=Zr(t.size);if(r.status==="error")return r}if(t.theme){const r=$t(t.theme);if(r.status==="error")return r}if(t.encoding){const r=It(t.encoding);if(r.status==="error")return r}if(t.data){const r=Bt(t.data);if(r.status==="error")return r}if(t.plugins){const r=ke(t.plugins);if(r.status==="error")return r}return e}function Hr({svgElement$:t,canvasElement$:e,pluginsInstance$:r}){let n=[],s=[];const o=(c,i,f)=>{const w=r.getValue().reduce((S,v,d)=>(S[v._getId()]=d,S),{}),x=f.map(S=>({...S,pluginSeq:w[S.pluginId]}));return(c==="svg"?n:s).filter(S=>S.pluginId!==i).map(S=>({...S,pluginSeq:w[S.pluginId]})).concat(x).sort((S,v)=>S.layerIndex-v.layerIndex||S.pluginSeq-v.pluginSeq)},u={},a={};return(c,i,f)=>{const w=c==="svg"?t.getValue():e.getValue();if(!w)return{};const x=c==="svg"?u:a,y=o(c,i,f),S=y.map(d=>xt(d.pluginId,d.layerName));return c==="svg"?(Ot(w,S,x,d=>wt(d)),n=y):(Ot(w,S,x,d=>Me(d)),s=y),Object.entries(x).reduce((d,[b,O])=>{const[$,h,p]=b.split("-");return h===i&&(d[p]=O),d},{})}}const Qr=(t,e)=>{try{const{status:b,columnName:O,expectToBe:$}=Jr(e);if(b==="error")throw new Error(Q({columnName:O,expectToBe:$,from:"Chart.constructor"}));if(b==="warning")console.warn(X({columnName:O,expectToBe:$,from:"Chart.constructor"}));else{const{status:h,columnName:p,expectToBe:E}=Yr(t);if(h==="error")throw new Error(Q({columnName:p,expectToBe:E,from:"Chart.constructor"}));h==="warning"&&console.warn(X({columnName:p,expectToBe:E,from:"Chart.constructor"}))}}catch(b){throw new Error(b)}const r=new ie,n=new z((e==null?void 0:e.data)||[]),s=e&&e.encoding?Y(Ct,e.encoding):Ct,o=new z(s),u=e&&e.theme?Y(Tt,e.theme):Tt,a=new z(u),c=new z((e==null?void 0:e.plugins)||[]),i=e&&e.size?Y(_t,e.size):_t,f=new z(i),w=new z(null),x=new z(null),y=(()=>{const b=f.pipe(Lr(g=>Or(()=>g.width==="auto"||g.height==="auto",At(t).pipe(W(A=>({width:g.width==="auto"?A.width:g.width,height:g.height==="auto"?A.height<=0?A.width:A.height:g.height})),J(g.resizeDebounce),Br((A,_)=>JSON.stringify(A)===JSON.stringify(_))),dr({width:g.width,height:g.height}))),Vr(r),se(1)),O=o.asObservable().pipe(se(1)),$=te([n,o,a]).pipe(J(0),W(([g,A,_])=>{try{return Nr(g,A,_)}catch(P){throw new Error(de({from:"Chart.seriesData$",systemMessage:P}))}}),ye(g=>(console.error(q(g)),he)),se(1)),h=te([n,o,a]).pipe(J(0),W(([g,A,_])=>{try{return Gr(g,A,_)}catch(P){throw new Error(de({from:"Chart.gridData$",systemMessage:P}))}}),ye(g=>(console.error(q(g)),he)),se(1)),p=te([n,o,a]).pipe(J(0),W(([g,A,_])=>{try{return Ur(g,A,_)}catch(P){throw new Error(de({from:"Chart.multivariateData$",systemMessage:P}))}}),ye(g=>(console.error(q(g)),he)),se(1)),E=te([n,o,a]).pipe(J(0),W(([g,A,_])=>{try{return zr(g,A,_)}catch(P){throw new Error(de({from:"Chart.graphData$",systemMessage:P}))}}),ye(g=>(console.error(q(g)),he)),se(1)),j=te([n,o,a]).pipe(J(0),W(([g,A,_])=>{try{return qr(g,A,_)}catch(P){throw new Error(de({from:"Chart.treeData$",systemMessage:P}))}}),ye(g=>(console.error(q(g)),he)),se(1)),I=new z([]);c.subscribe(g=>{const A={},_=g.map(k=>{var V;let L=k._getId();if(A[L]){const N=((V=A[L].split("[")[1])==null?void 0:V.split("]")[0])||"0",re=parseInt(N)+1;L=`${L.split("[")[0]}[${re}]`}return A[L]=k._getId(),L});g.forEach((k,L)=>k._setId(_[L]));const P=g.map(k=>({id:k._getId(),name:k._name,elementType:k._elementType,shownLayers:k.getShownLayerNames()}));I.next(P)});const l=a.asObservable().pipe(se(1)),m=new ie,C=m.asObservable().pipe(ct());return{root:t,svg:null,canvas:null,size$:b,encoding$:O,seriesData$:$,gridData$:h,multivariateData$:p,graphData$:E,treeData$:j,plugins$:I,theme$:l,event$:C,eventTrigger$:m,_updateLayerElements:Hr({svgElement$:w,canvasElement$:x,pluginsInstance$:c})}})();let S=null;const v=()=>(S||(S=document.createElement("div"),S.classList.add("orbcharts-container"),S.style.position="relative",t.appendChild(S)),S);let d=[];return c.subscribe(b=>{d.filter(p=>!b.includes(p)).forEach(p=>{y._updateLayerElements(p._elementType,p._getId(),[]),p.destroy()}),d=b;let $=!1,h=!1;b.forEach(p=>{p._elementType==="svg"?$=!0:p._elementType==="canvas"&&(h=!0)}),$&&!y.svg?(y.svg=bt("orbcharts-root-svg"),v().appendChild(y.svg),w.next(y.svg)):!$&&y.svg&&(y.svg.remove(),y.svg=null,w.next(null)),h&&!y.canvas?(y.canvas=Me("orbcharts-root-canvas"),v().appendChild(y.canvas),x.next(y.canvas)):!h&&y.canvas&&(y.canvas.remove(),y.canvas=null,x.next(null)),b.forEach(p=>{p._injectContext(y)})}),te({size:y.size$,svg:w}).pipe(J(0),be(({svg:b})=>!!b)).subscribe(({size:b,svg:O})=>{O&&(O.setAttribute("width",b.width.toString()),O.setAttribute("height",b.height.toString()))}),te({size:y.size$,canvas:x}).pipe(J(0),be(({canvas:b})=>!!b)).subscribe(({size:b,canvas:O})=>{O&&(O.width=b.width,O.height=b.height)}),(()=>{function b(g){f.next(g)}function O(g){try{const{status:A,columnName:_,expectToBe:P}=Bt(g);if(A==="error")throw new Error(Q({columnName:_,expectToBe:P,from:"Chart.setData"}));A==="warning"&&console.warn(X({columnName:_,expectToBe:P,from:"Chart.setData"}))}catch(A){console.error(q(A))}n.next(g)}function $(g){try{const{status:_,columnName:P,expectToBe:k}=It(g);if(_==="error")throw new Error(Q({columnName:P,expectToBe:k,from:"Chart.updateEncoding"}));_==="warning"&&console.warn(X({columnName:P,expectToBe:k,from:"Chart.updateEncoding"}))}catch(_){console.error(q(_))}const A=Y(o.getValue(),g);o.next(A)}function h(g){o.next(g)}function p(){return o.getValue()}function E(g){try{const{status:A,columnName:_,expectToBe:P}=ke(g);if(A==="error")throw new Error(Q({columnName:_,expectToBe:P,from:"Chart.setPlugins"}));A==="warning"&&console.warn(X({columnName:_,expectToBe:P,from:"Chart.setPlugins"}))}catch(A){console.error(q(A))}c.next(g)}function j(g){try{const{status:A,columnName:_,expectToBe:P}=ke([g]);if(A==="error")throw new Error(Q({columnName:_,expectToBe:P,from:"Chart.addPlugin"}));A==="warning"&&console.warn(X({columnName:_,expectToBe:P,from:"Chart.addPlugin"}))}catch(A){console.error(q(A))}c.next([...c.getValue(),g])}function I(g){c.next(c.getValue().filter(A=>A._getId()!==g))}function l(g){try{const{status:_,columnName:P,expectToBe:k}=$t(g);if(_==="error")throw new Error(Q({columnName:P,expectToBe:k,from:"Chart.updateTheme"}));_==="warning"&&console.warn(X({columnName:P,expectToBe:k,from:"Chart.updateTheme"}))}catch(_){console.error(q(_))}const A=Y(a.getValue(),g);a.next(A)}function m(g){a.next(g)}function C(){return a.getValue()}function B(){r.next(void 0),Et(t),S=null}return{resize:b,setData:O,updateEncoding:$,forceReplaceEncoding:h,getEncoding:p,setPlugins:E,addPlugin:j,removePlugin:I,updateTheme:l,forceReplaceTheme:m,getTheme:C,destroy:B,context:y}})()};class Xr{constructor(e,r){return Qr(e,r)}}const Pt=(t,e,r)=>{let n=e.name,s=()=>{};const o=new z(null),u=o.pipe(be(h=>h!==null)),a=e.layers.map(h=>new h),c={...a.reduce((h,p)=>(h[p._name]=p,h),{})},i=()=>new Set(a.map(h=>h._name)),f=h=>{if(h){const p=i();return Object.keys(h).filter(j=>p.has(j))}return[]},w=a.reduce((h,p)=>(p._initShow&&h.push(p._name),h),[]),x=f(r),y=new z(new Set(x.length>0?x:w)),S=y.pipe(W(h=>Array.from(h).map(E=>{var j;return[E,((j=a.find(I=>I._name===E))==null?void 0:j._layerIndex)??-1]}).filter(([,E])=>E!==-1).sort((E,j)=>E[1]-j[1]).map(([E])=>E)));let v=Y(e.defaultParams??{},r??{});const d=new z(r??{}),b=new ie,O=new F(h=>{d.subscribe(p=>{try{const{status:E,columnName:j,expectToBe:I}=e.validator(p);if(E==="error")throw new Error(Q({columnName:j,expectToBe:I,from:`${e.name}.params$`}));E==="warning"&&console.warn(X({columnName:j,expectToBe:I,from:`${e.name}.params$`}))}catch(E){console.error(q(E))}h.next(v)}),b.subscribe(p=>{h.next(p)})}),$=u.pipe(W(h=>({context:h,pluginParams$:O})),kr());return te({pluginSetupProps:$,ShownLayerNameSet:y,shownLayerNamesSeq:S}).pipe(J(0)).subscribe(({pluginSetupProps:h,ShownLayerNameSet:p,shownLayerNamesSeq:E})=>{const j=h.context._updateLayerElements(t,n,E.map(I=>({pluginId:n,pluginName:e.name,layerName:I,layerIndex:c[I]._layerIndex})));e.setup&&(s=e.setup(h)),a.forEach(I=>{var l,m;if(p.has(I._name)){const C=t==="svg"?{svgG:j[I._name],context:h.context,pluginParams$:O,initLayerParams:((l=d.getValue())==null?void 0:l[I._name])||{}}:{canvas:j[I._name],context:h.context,pluginParams$:O,initLayerParams:((m=d.getValue())==null?void 0:m[I._name])||{}};I._enable(C)}else I._disable()})}),{_name:e.name,_elementType:t,_getId:()=>n,_setId:h=>{n=h},_injectContext:h=>{o.next(Object.assign({},h))},show:h=>{h=Array.isArray(h)?h:[h],y.next(new Set([...Array.from(y.getValue()),...h]))},showOnly:h=>{h=Array.isArray(h)?h:[h],y.next(new Set([...h]))},showAll:()=>{y.next(i())},hide:h=>{h=Array.isArray(h)?h:[h],y.next(new Set([...Array.from(y.getValue()).filter(p=>!h.includes(p))]))},hideAll:()=>{y.next(new Set)},toggle:h=>{h=Array.isArray(h)?h:[h],Array.from(y.getValue()).forEach(p=>{h.includes(p)?h.splice(h.indexOf(p),1):h.push(p)}),y.next(new Set(h))},getShownLayerNames:()=>Array.from(y.getValue()),updateParams:h=>{v=Y(v,h),d.next(h),Object.keys(h).forEach(p=>{const E=c[p];E&&E._updateParams(h[p])})},forceReplaceParams:h=>{v=h,b.next(h),Object.keys(h).forEach(p=>{const E=c[p];E&&E._forceReplaceParams(h[p])})},getParams:()=>{const h=Object.assign({},v);return a.forEach(p=>{h[p._name]=p._getParams()}),h},destroy:()=>{s(),o.complete(),y.complete(),a.forEach(h=>{h._destroy()})}}},en=t=>class{constructor(r){return Pt("svg",t,r)}},Mt=(t,e)=>{const r=new z(Object.assign({},e.defaultParams));let n=()=>{};const s=new z(null),o=s.pipe(be(u=>u!==null));return te({layerParams:r,enabledProps:o}).pipe(J(0)).subscribe(({layerParams:u,enabledProps:a})=>{n(),n=t==="svg"?e.setup({svgG:a.svgG,context:a.context,pluginParams$:a.pluginParams$,layerParams$:r.pipe(W(c=>Y(c,a.initLayerParams??{})))}):e.setup({canvas:a.canvas,context:a.context,pluginParams$:a.pluginParams$,layerParams$:r.pipe(W(c=>Y(c,a.initLayerParams??{})))})}),s.pipe(be(u=>u===null)).subscribe(()=>{n()}),{_name:e.name,_defaultParams:e.defaultParams,_layerIndex:e.layerIndex,_initShow:e.initShow,_enable:u=>{s.next(u)},_disable:()=>{s.next(null)},_updateParams:u=>{try{const{status:c,columnName:i,expectToBe:f}=e.validator(u);if(c==="error")throw new Error(Q({columnName:i,expectToBe:f,from:`${e.name}.params$`}));c==="warning"&&console.warn(X({columnName:i,expectToBe:f,from:`${e.name}.params$`}))}catch(c){console.error(q(c))}const a=Y(r.getValue(),u);r.next(a)},_forceReplaceParams:u=>{r.next(u)},_getParams:()=>r.getValue(),_destroy:()=>{s.next(null),s.complete(),r.complete()}}},tn=t=>class{constructor(){return Mt("svg",t)}},rn=t=>class{constructor(r){return Pt("canvas",t,r)}},nn=t=>class{constructor(){return Mt("canvas",t)}};M.OrbCharts=Xr,M.aggregate=pe,M.count=dt,M.createCanvas=Me,M.createCanvasElement=Rr,M.createDiv=Fr,M.createLayerClassName=xt,M.createMessagePrefix=je,M.createOrbChartsErrorMessage=q,M.createPluginClassName=St,M.createSVG=bt,M.createSVGGroup=wt,M.createUnexpectedErrorMessage=de,M.createValidatorErrorMessage=Q,M.createValidatorWarningMessage=X,M.deepOverwrite=Y,M.defineCanvasLayer=nn,M.defineCanvasPlugin=rn,M.defineSVGLayer=tn,M.defineSVGPlugin=en,M.formatCommaNumber=Kr,M.getColorByFrom=D,M.getColorByIndex=mt,M.isDom=Pe,M.isFunction=gt,M.isPlainObject=H,M.max=pt,M.mean=ft,M.median=ht,M.min=yt,M.none=vt,M.removeElementChildren=Et,M.resizeObservable=At,M.resolveGroupKey=T,M.sum=lt,M.validateObject=R,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
export interface EncodingDataset {
|
|
2
2
|
from: string;
|
|
3
3
|
sort: 'original' | 'alphabetical' | string[];
|
|
4
|
+
ignore?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export interface EncodingSeries {
|
|
6
7
|
from: string;
|
|
7
8
|
sort: 'original' | 'alphabetical' | string[];
|
|
9
|
+
ignore?: boolean;
|
|
8
10
|
}
|
|
9
11
|
export interface EncodingCategory {
|
|
10
12
|
from: string;
|
|
11
13
|
sort: 'original' | 'alphabetical' | string[];
|
|
14
|
+
ignore?: boolean;
|
|
12
15
|
}
|
|
13
16
|
export interface EncodingValue {
|
|
14
17
|
from: string;
|
|
@@ -21,7 +24,7 @@ export interface EncodingMultivariateItem {
|
|
|
21
24
|
}
|
|
22
25
|
export type EncodingMultivariate = EncodingMultivariateItem[];
|
|
23
26
|
export interface EncodingColor {
|
|
24
|
-
|
|
27
|
+
by: 'index' | 'series' | 'category' | 'dataset';
|
|
25
28
|
}
|
|
26
29
|
export interface Encoding {
|
|
27
30
|
dataset: EncodingDataset;
|
|
@@ -16,7 +16,7 @@ export interface DefinePluginConfig<ExtendContext extends ExtendableContext, Plu
|
|
|
16
16
|
name: string;
|
|
17
17
|
defaultParams?: PluginParams;
|
|
18
18
|
validator?: (params: DeepPartial<AllLayerParams | PluginParams>) => ValidatorResult;
|
|
19
|
-
layers?: LayerEntity<ExtendContext, PluginParams, AllLayerParams[keyof AllLayerParams]>[];
|
|
19
|
+
layers?: (new () => LayerEntity<ExtendContext, PluginParams, AllLayerParams[keyof AllLayerParams]>)[];
|
|
20
20
|
setup?: (props: PluginSetupProps<ExtendContext, PluginParams>) => () => void;
|
|
21
21
|
}
|
|
22
22
|
export interface PluginEntity<ElementType extends 'svg' | 'canvas', PluginParams extends Record<string, any>, AllLayerParams extends Record<string, any>> {
|
|
@@ -8,7 +8,7 @@ import { Theme } from '../types';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function getColorByIndex(index: number, theme: Theme): string;
|
|
10
10
|
/**
|
|
11
|
-
* 根據不同的 encoding.color.
|
|
11
|
+
* 根據不同的 encoding.color.by 計算顏色
|
|
12
12
|
* @param colorFrom 顏色來源類型
|
|
13
13
|
* @param options 包含所有可能索引的選項物件
|
|
14
14
|
* @param theme 主題設定
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RawDataColumn } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 解析單筆資料在某個 Encoding 維度(dataset / series / category)上的分組 key。
|
|
5
|
+
* 若該維度設定 ignore: true,所有資料一律回傳空字串,等於忽略此維度、全部視為同一組。
|
|
6
|
+
* fallback 預設為空字串,避免內部佔位值外洩成使用者看得到的顯示文字(例如 name)。
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveGroupKey(datum: RawDataColumn, dim: {
|
|
9
|
+
from: string;
|
|
10
|
+
ignore?: boolean;
|
|
11
|
+
}, fallback?: string): string;
|
package/package.json
CHANGED
package/src/chart/createChart.ts
CHANGED
|
@@ -203,6 +203,9 @@ function encodingOptionsValidator (encodingConfig: DeepPartial<Encoding>): Valid
|
|
|
203
203
|
sort: {
|
|
204
204
|
toBe: '"original" | "alphabetical" | string[]',
|
|
205
205
|
test: (value: any) => value === 'original' || value === 'alphabetical' || (Array.isArray(value) && value.every((v) => typeof v === 'string'))
|
|
206
|
+
},
|
|
207
|
+
ignore: {
|
|
208
|
+
toBeTypes: ['boolean']
|
|
206
209
|
}
|
|
207
210
|
})
|
|
208
211
|
if (datasetResult.status === 'error') {
|
|
@@ -217,6 +220,9 @@ function encodingOptionsValidator (encodingConfig: DeepPartial<Encoding>): Valid
|
|
|
217
220
|
sort: {
|
|
218
221
|
toBe: '"original" | "alphabetical" | string[]',
|
|
219
222
|
test: (value: any) => value === 'original' || value === 'alphabetical' || (Array.isArray(value) && value.every((v) => typeof v === 'string'))
|
|
223
|
+
},
|
|
224
|
+
ignore: {
|
|
225
|
+
toBeTypes: ['boolean']
|
|
220
226
|
}
|
|
221
227
|
})
|
|
222
228
|
if (seriesResult.status === 'error') {
|
|
@@ -231,6 +237,9 @@ function encodingOptionsValidator (encodingConfig: DeepPartial<Encoding>): Valid
|
|
|
231
237
|
sort: {
|
|
232
238
|
toBe: '"original" | "alphabetical" | string[]',
|
|
233
239
|
test: (value: any) => value === 'original' || value === 'alphabetical' || (Array.isArray(value) && value.every((v) => typeof v === 'string'))
|
|
240
|
+
},
|
|
241
|
+
ignore: {
|
|
242
|
+
toBeTypes: ['boolean']
|
|
234
243
|
}
|
|
235
244
|
})
|
|
236
245
|
if (categoryResult.status === 'error') {
|
|
@@ -269,7 +278,7 @@ function encodingOptionsValidator (encodingConfig: DeepPartial<Encoding>): Valid
|
|
|
269
278
|
}
|
|
270
279
|
if (encodingConfig.color) {
|
|
271
280
|
const colorResult = validateObject(encodingConfig.color, {
|
|
272
|
-
|
|
281
|
+
by: {
|
|
273
282
|
toBe: '"index" | "series" | "category" | "dataset"',
|
|
274
283
|
test: (value: any) => ['index', 'series', 'category', 'dataset'].includes(value)
|
|
275
284
|
}
|
|
@@ -741,8 +750,41 @@ export const createChart: CreateChart = (element, options) => {
|
|
|
741
750
|
return _context
|
|
742
751
|
})()
|
|
743
752
|
|
|
753
|
+
// OrbCharts 自有的 container(root 的直接子元素,由 OrbCharts 建立及擁有):
|
|
754
|
+
// svg/canvas 為 position:absolute,需要一個 positioned ancestor 作為錨點,
|
|
755
|
+
// 但 root 是使用者傳入的元素、不應修改它的樣式——
|
|
756
|
+
// 因此在 root 底下建立 position:relative 的 container 來掛載 svg/canvas。
|
|
757
|
+
// (container 本身高度為 0、不影響 root 的尺寸量測;destroy 時隨 root 清空一併移除)
|
|
758
|
+
let orbContainer: HTMLDivElement | null = null
|
|
759
|
+
const getOrbContainer = (): HTMLDivElement => {
|
|
760
|
+
if (!orbContainer) {
|
|
761
|
+
orbContainer = document.createElement('div')
|
|
762
|
+
orbContainer.classList.add('orbcharts-container')
|
|
763
|
+
orbContainer.style.position = 'relative'
|
|
764
|
+
element.appendChild(orbContainer)
|
|
765
|
+
}
|
|
766
|
+
return orbContainer
|
|
767
|
+
}
|
|
768
|
+
|
|
744
769
|
// inject context into plugins
|
|
770
|
+
let previousPlugins: PluginEntity<any, unknown, unknown>[] = []
|
|
745
771
|
pluginsInstance$.subscribe(plugins => {
|
|
772
|
+
// -- 清理被移除的 plugin --
|
|
773
|
+
// setPlugins()/removePlugin() 換掉的舊 plugin,若沒有新 plugin 用相同
|
|
774
|
+
// pluginId 重新呼叫 _updateLayerElements(例如從 GridPlot 換成
|
|
775
|
+
// PartitionPlot 這種不同種類的切換),它的 layer 登記會一直留在
|
|
776
|
+
// svgLayerInfo/canvasLayerInfo 裡、DOM 元素永遠不會被移除(同種類切換
|
|
777
|
+
// 之所以看起來正常,只是因為新 plugin 用同一個 pluginId 重新登記,
|
|
778
|
+
// 把舊登記蓋掉的副作用,並不是真的有清理機制)。這裡明確對每個「上一輪
|
|
779
|
+
// 有、這一輪沒有」的 plugin 呼叫一次空的 _updateLayerElements 把它的
|
|
780
|
+
// 登記清掉,並呼叫 destroy() 釋放其內部資源。
|
|
781
|
+
const removedPlugins = previousPlugins.filter(prevPlugin => !plugins.includes(prevPlugin))
|
|
782
|
+
removedPlugins.forEach(removedPlugin => {
|
|
783
|
+
context._updateLayerElements(removedPlugin._elementType, removedPlugin._getId(), [])
|
|
784
|
+
removedPlugin.destroy()
|
|
785
|
+
})
|
|
786
|
+
previousPlugins = plugins
|
|
787
|
+
|
|
746
788
|
// -- 建立頂層 svg 和 canvas --
|
|
747
789
|
let hasSVGPlugin = false
|
|
748
790
|
let hasCanvasPlugin = false
|
|
@@ -755,7 +797,7 @@ export const createChart: CreateChart = (element, options) => {
|
|
|
755
797
|
})
|
|
756
798
|
if (hasSVGPlugin && !context.svg) {
|
|
757
799
|
context.svg = createSVG('orbcharts-root-svg')
|
|
758
|
-
|
|
800
|
+
getOrbContainer().appendChild(context.svg)
|
|
759
801
|
svgElement$.next(context.svg)
|
|
760
802
|
} else if (!hasSVGPlugin && context.svg) {
|
|
761
803
|
context.svg.remove()
|
|
@@ -764,7 +806,7 @@ export const createChart: CreateChart = (element, options) => {
|
|
|
764
806
|
}
|
|
765
807
|
if (hasCanvasPlugin && !context.canvas) {
|
|
766
808
|
context.canvas = createCanvas('orbcharts-root-canvas')
|
|
767
|
-
|
|
809
|
+
getOrbContainer().appendChild(context.canvas)
|
|
768
810
|
canvasElement$.next(context.canvas)
|
|
769
811
|
} else if (!hasCanvasPlugin && context.canvas) {
|
|
770
812
|
context.canvas.remove()
|
|
@@ -972,8 +1014,9 @@ export const createChart: CreateChart = (element, options) => {
|
|
|
972
1014
|
// context.svgSelection.remove()
|
|
973
1015
|
// context.canvasSelection.remove()
|
|
974
1016
|
destroy$.next(undefined)
|
|
975
|
-
// 清空 element
|
|
1017
|
+
// 清空 element 底下所有元素(含 OrbCharts 自有的 container)
|
|
976
1018
|
removeElementChildren(element)
|
|
1019
|
+
orbContainer = null
|
|
977
1020
|
}
|
|
978
1021
|
|
|
979
1022
|
return {
|