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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +200 -200
  2. package/dist/orbcharts-core.es.js +876 -865
  3. package/dist/orbcharts-core.umd.js +3 -3
  4. package/dist/src/types/Plugin.d.ts +1 -1
  5. package/package.json +1 -1
  6. package/src/OrbCharts.ts +34 -34
  7. package/src/chart/createChart.ts +1013 -996
  8. package/src/chart/createGraphData.ts +391 -391
  9. package/src/chart/createGridData.ts +247 -247
  10. package/src/chart/createMultivariateData.ts +181 -181
  11. package/src/chart/createSeriesData.ts +297 -297
  12. package/src/chart/createTreeData.ts +344 -344
  13. package/src/chart/defaults.ts +119 -119
  14. package/src/defineCanvasLayer.ts +23 -23
  15. package/src/defineCanvasPlugin.ts +38 -38
  16. package/src/defineSVGLayer.ts +23 -23
  17. package/src/defineSVGPlugin.ts +38 -38
  18. package/src/index.ts +8 -8
  19. package/src/layer/createLayer.ts +137 -137
  20. package/src/plugin/createPlugin.ts +487 -469
  21. package/src/test/createGraphData.test.ts +103 -103
  22. package/src/test/createTreeData.test.ts +97 -97
  23. package/src/test/simple-graph-test.js +51 -51
  24. package/src/test/simple-tree-test.js +58 -58
  25. package/src/types/Chart.ts +62 -62
  26. package/src/types/ChartContext.ts +41 -41
  27. package/src/types/Common.ts +4 -4
  28. package/src/types/Encoding.ts +42 -42
  29. package/src/types/Event.ts +25 -25
  30. package/src/types/Layers.ts +92 -92
  31. package/src/types/ModelData.ts +94 -94
  32. package/src/types/Plugin.ts +101 -98
  33. package/src/types/RawData.ts +67 -67
  34. package/src/types/RenderData.ts +15 -15
  35. package/src/types/Theme.ts +20 -20
  36. package/src/types/Validator.ts +35 -35
  37. package/src/types/index.ts +12 -12
  38. package/src/utils/aggregateUtils.ts +99 -99
  39. package/src/utils/colorUtils.ts +63 -63
  40. package/src/utils/commonUtils.ts +56 -56
  41. package/src/utils/dom-lifecycle.ts +164 -164
  42. package/src/utils/dom.ts +54 -54
  43. package/src/utils/errorMessage.ts +40 -40
  44. package/src/utils/index.ts +7 -7
  45. package/src/utils/observables.ts +16 -16
  46. package/src/utils/orbchartsUtils.ts +8 -8
  47. package/src/utils/validator.ts +127 -127
@@ -1,8 +1,8 @@
1
- (function(T,oe){typeof exports=="object"&&typeof module<"u"?oe(exports):typeof define=="function"&&define.amd?define(["exports"],oe):(T=typeof globalThis<"u"?globalThis:T||self,oe(T["orbcharts-core"]={}))})(this,function(T){"use strict";var oe=function(t,e){return oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},oe(t,e)};function W(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");oe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function jt(t,e,r,n){function o(s){return s instanceof r?s:new r(function(u){u(s)})}return new(r||(r=Promise))(function(s,u){function a(h){try{i(n.next(h))}catch(b){u(b)}}function l(h){try{i(n.throw(h))}catch(b){u(b)}}function i(h){h.done?s(h.value):o(h.value).then(a,l)}i((n=n.apply(t,e||[])).next())})}function Ve(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,s,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(h){return l([i,h])}}function l(i){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,i[0]&&(r=0)),r;)try{if(n=1,o&&(s=i[0]&2?o.return:i[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,i[1])).done)return s;switch(o=0,s&&(i=[i[0]&2,s.value]),i[0]){case 0:case 1:s=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,o=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){r.label=i[1];break}if(i[0]===6&&r.label<s[1]){r.label=s[1],s=i;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(i);break}s[2]&&r.ops.pop(),r.trys.pop();continue}i=e.call(t,r)}catch(h){i=[6,h],o=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function ie(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 ue(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,s=[],u;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(a){u={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(u)throw u.error}}return s}function le(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,s;n<o;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function ce(t){return this instanceof ce?(this.v=t,this):new ce(t)}function kt(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",u),o[Symbol.asyncIterator]=function(){return this},o;function u(m){return function(v){return Promise.resolve(v).then(m,b)}}function a(m,v){n[m]&&(o[m]=function(y){return new Promise(function(p,E){s.push([m,y,p,E])>1||l(m,y)})},v&&(o[m]=v(o[m])))}function l(m,v){try{i(n[m](v))}catch(y){w(s[0][3],y)}}function i(m){m.value instanceof ce?Promise.resolve(m.value.v).then(h,b):w(s[0][2],m)}function h(m){l("next",m)}function b(m){l("throw",m)}function w(m,v){m(v),s.shift(),s.length&&l(s[0][0],s[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 ie=="function"?ie(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(u){return new Promise(function(a,l){u=t[s](u),o(a,l,u.done,u.value)})}}function o(s,u,a,l){Promise.resolve(l).then(function(i){s({value:i,done:a})},u)}}typeof SuppressedError=="function"&&SuppressedError;function V(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 Se=xe(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
1
+ (function(B,oe){typeof exports=="object"&&typeof module<"u"?oe(exports):typeof define=="function"&&define.amd?define(["exports"],oe):(B=typeof globalThis<"u"?globalThis:B||self,oe(B.orbchartsCore={}))})(this,function(B){"use strict";var oe=function(t,e){return oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},oe(t,e)};function Y(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");oe(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function jt(t,e,r,n){function o(s){return s instanceof r?s:new r(function(u){u(s)})}return new(r||(r=Promise))(function(s,u){function a(f){try{i(n.next(f))}catch(b){u(b)}}function l(f){try{i(n.throw(f))}catch(b){u(b)}}function i(f){f.done?s(f.value):o(f.value).then(a,l)}i((n=n.apply(t,e||[])).next())})}function Ve(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,s,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 l([i,f])}}function l(i){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,i[0]&&(r=0)),r;)try{if(n=1,o&&(s=i[0]&2?o.return:i[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,i[1])).done)return s;switch(o=0,s&&(i=[i[0]&2,s.value]),i[0]){case 0:case 1:s=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,o=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){r.label=i[1];break}if(i[0]===6&&r.label<s[1]){r.label=s[1],s=i;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(i);break}s[2]&&r.ops.pop(),r.trys.pop();continue}i=e.call(t,r)}catch(f){i=[6,f],o=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function ie(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 ue(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,s=[],u;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(a){u={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(u)throw u.error}}return s}function le(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,s;n<o;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function ce(t){return this instanceof ce?(this.v=t,this):new ce(t)}function kt(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",u),o[Symbol.asyncIterator]=function(){return this},o;function u(d){return function(x){return Promise.resolve(x).then(d,b)}}function a(d,x){n[d]&&(o[d]=function(m){return new Promise(function(h,w){s.push([d,m,h,w])>1||l(d,m)})},x&&(o[d]=x(o[d])))}function l(d,x){try{i(n[d](x))}catch(m){_(s[0][3],m)}}function i(d){d.value instanceof ce?Promise.resolve(d.value.v).then(f,b):_(s[0][2],d)}function f(d){l("next",d)}function b(d){l("throw",d)}function _(d,x){d(x),s.shift(),s.length&&l(s[0][0],s[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 ie=="function"?ie(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(u){return new Promise(function(a,l){u=t[s](u),o(a,l,u.done,u.value)})}}function o(s,u,a,l){Promise.resolve(l).then(function(i){s({value:i,done:a})},u)}}typeof SuppressedError=="function"&&SuppressedError;function L(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 Se=xe(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
2
2
  `+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
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 Se?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{Ke(v)}catch(y){s=s??[],y instanceof Se?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 Se(s)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Ke(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 Ke(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 Fe(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),Kt=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 Kt(u),s}return e}(Ce);function Ee(t){Fe(t)}function Ft(t){throw t}var Dt={closed:!0,next:_e,error:Ft,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 K=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=xe(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 K;return r.source=this,r},e.create=function(r,n){return new Ne(r,n)},e}(K),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 K(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 K)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 K(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 K(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function or(t){return new K(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,Fe)})}function sr(t){return new K(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 K(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 K(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 K(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 K(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=xe(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 Ar(t){if(t.length===1){var e=t[0];if(gr(e))return{args:e,keys:null};if(xr(e)){var r=Er(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"&&br(t)===wr}function Sr(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=Ar(t),s=o.args,u=o.keys;if(s.length===0)return Te([],r);var a=new K(_r(s,r,u?function(l){return Sr(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 K(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 x=w=w??r();O.add(function(){m--,m===0&&!y&&!v&&(b=Ie(d,l))}),x.subscribe(O),!h&&m>0&&(h=new me({next:function(A){return x.next(A)},error:function(A){y=!0,p(),b=Ie(E,o,A),x.error(A)},complete:function(){v=!0,p(),b=Ie(E,u),x.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 F(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 Kr(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}':
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(m){e={error:m}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}else u.remove(this);var f=this.initialTeardown;if(L(f))try{f()}catch(m){s=m instanceof Se?m.errors:[m]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var _=ie(b),d=_.next();!d.done;d=_.next()){var x=d.value;try{Ke(x)}catch(m){s=s??[],m instanceof Se?s=le(le([],ue(s)),ue(m.errors)):s.push(m)}}}catch(m){n={error:m}}finally{try{d&&!d.done&&(o=_.return)&&o.call(_)}finally{if(n)throw n.error}}}if(s)throw new Se(s)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)Ke(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&&L(t.remove)&&L(t.add)&&L(t.unsubscribe)}function Ke(t){L(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 Fe(t){Rt.setTimeout(function(){throw t})}function _e(){}function we(t){t()}var Ce=function(t){Y(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),Kt=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){Y(e,t);function e(r,n,o){var s=t.call(this)||this,u;return L(r)||!r?u={next:r??void 0,error:n??void 0,complete:o??void 0}:u=r,s.destination=new Kt(u),s}return e}(Ce);function Ee(t){Fe(t)}function Ft(t){throw t}var Dt={closed:!0,next:_e,error:Ft,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 K=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&&L(t.next)&&L(t.error)&&L(t.complete)}function Ut(t){return t&&t instanceof Ce||Gt(t)&&Re(t)}function zt(t){return L(t==null?void 0:t.lift)}function N(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 G(t,e,r,n,o){return new qt(t,e,r,n,o)}var qt=function(t){Y(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(f){r.error(f)}}:t.prototype._next,l._error=s?function(i){try{s(i)}catch(f){r.error(f)}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=xe(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),se=function(t){Y(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 K;return r.source=this,r},e.create=function(r,n){return new Ne(r,n)},e}(K),Ne=function(t){Y(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),U=function(t){Y(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){Y(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,f=1;f<s.length&&s[f]<=l;f+=2)i=f;i&&s.splice(0,i+1)}},e}(se),Zt=function(t){Y(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){Y(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){Y(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 K(function(t){return t.complete()});function Xt(t){return t&&L(t.schedule)}function ze(t){return t[t.length-1]}function er(t){return L(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 L(t==null?void 0:t.then)}function Ze(t){return L(t[Oe])}function Je(t){return Symbol.asyncIterator&&L(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 L(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 L(t==null?void 0:t.getReader)}function X(t){if(t instanceof K)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 K(function(e){var r=t[Oe]();if(L(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function nr(t){return new K(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function or(t){return new K(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,Fe)})}function sr(t){return new K(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 K(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),N(function(r,n){r.subscribe(G(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),N(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 K(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 K(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 L(n==null?void 0:n.return)&&n.return()}})}function st(t,e){if(!t)throw new Error("Iterable cannot be null");return new K(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=xe(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function q(t,e){return N(function(r,n){var o=0;r.subscribe(G(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 Ar(t){if(t.length===1){var e=t[0];if(gr(e))return{args:e,keys:null};if(xr(e)){var r=Er(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"&&br(t)===wr}function Sr(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=Ar(t),s=o.args,u=o.keys;if(s.length===0)return Te([],r);var a=new K(_r(s,r,u?function(l){return Sr(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(f){it(e,function(){var b=Te(t[f],e),_=!1;b.subscribe(G(n,function(d){s[f]=d,_||(_=!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 K(function(e){X(t()).subscribe(e)})}function Or(t,e,r){return Cr(function(){return t()?e:r})}function ge(t,e){return N(function(r,n){var o=0;r.subscribe(G(n,function(s){return t.call(e,s,o++)&&n.next(s)}))})}function he(t){return N(function(e,r){var n=null,o=!1,s;n=e.subscribe(G(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 Z(t,e){return e===void 0&&(e=Qt),N(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,f=e.now();if(f<i){o=this.schedule(void 0,i-f),n.add(o);return}a()}r.subscribe(G(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 N(function(e,r){var n=!1;e.subscribe(G(r,function(o){n=!0,r.next(o)},function(){n||r.next(t),r.complete()}))})}function Tr(t){return t<=0?function(){return fe}:N(function(e,r){var n=0;e.subscribe(G(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,N(function(r,n){var o,s=!0;r.subscribe(G(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),N(function(e,r){var n=!1;e.subscribe(G(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 f,b,_,d=0,x=!1,m=!1,h=function(){b==null||b.unsubscribe(),b=void 0},w=function(){h(),f=_=void 0,x=m=!1},I=function(){var $=f;w(),$==null||$.unsubscribe()};return N(function($,y){d++,!m&&!x&&h();var g=_=_??r();y.add(function(){d--,d===0&&!m&&!x&&(b=Ie(I,l))}),g.subscribe(y),!f&&d>0&&(f=new me({next:function(E){return g.next(E)},error:function(E){m=!0,h(),b=Ie(w,o,E),g.error(E)},complete:function(){x=!0,h(),b=Ie(w,u),g.complete()}}),X($).subscribe(f))})(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 N(function(r,n){var o=null,s=0,u=!1,a=function(){return u&&!o&&n.complete()};r.subscribe(G(n,function(l){o==null||o.unsubscribe();var i=0,f=s++;X(t(l,f)).subscribe(o=G(n,function(b){return n.next(e?e(l,b,f,i++):b)},function(){o=null,a()}))},function(){u=!0,a()}))})}function Vr(t){return N(function(e,r){X(t).subscribe(G(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 F(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 J(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 W(t,e){if(J(e)===!1||J(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;J(o[u])&&J(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 Kr(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 z(t){return`${Me("error")} ${t.message}`}function de({from:t,systemMessage:e}){return`unexpected error from '${t}':
4
4
  ${e}`}function H({columnName:t,expectToBe:e,from:r}){return`Invalid value: '${t}' must be '${e}'
5
5
 
6
6
  ----> find in '${r}'`}function Q({columnName:t,expectToBe:e,from:r}){return`${Me("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 K(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 At(t){return`orbcharts-${t}`}function xt(t,e){return`${At(t)}-${e}`}function Fr(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=Fr(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 St={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:["#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"},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(x=>{const A=x[e.category.from]||"default";d.has(A)||d.set(A,[]),d.get(A).push(x)});const _=w.filter(x=>d.has(x)),O=[];e.category.sort==="original"&&e.value.aggregate==="none"?(E.forEach((x,A)=>{const P=x[e.category.from]||"default",I=m.get(P),c=x[e.value.from];O.push({id:x.id||`${a}-${y}-${P}-${A}`,index:I,modelType:"series",name:x.name||"",data:x.data,value:typeof c=="number"?c:null,color:F(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((x,A)=>x.value===null&&A.value===null?0:x.value===null?1:A.value===null?-1:x.value-A.value):e.value.sort==="desc"&&O.sort((x,A)=>x.value===null&&A.value===null?0:x.value===null?1:A.value===null?-1:A.value-x.value)):_.forEach(x=>{const A=m.get(x),P=d.get(x);if(e.value.aggregate==="none"){let I=P.map((c,f)=>{const g=c[e.value.from];return{id:c.id||`${a}-${y}-${x}-${f}`,index:A,modelType:"series",name:c.name||"",data:c.data,value:typeof g=="number"?g:null,color:F(e.color.from,{index:A,seriesIndex:p,categoryIndex:A,datasetIndex:l},r),series:y,seriesIndex:p,category:x,categoryIndex:A}});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(S=>{if(e.value.aggregate==="count")return 1;const C=S[e.value.from];return typeof C=="number"?C:null}),c=ye(I,e.value.aggregate),f=P[0],g={id:f.id||`${a}-${y}-${x}-aggregated`,index:A,modelType:"series",name:f.name||x,data:f.data,value:c,color:F(e.color.from,{index:A,seriesIndex:p,categoryIndex:A,datasetIndex:l},r),series:y,seriesIndex:p,category:x,categoryIndex:A};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(x=>{const A=x[e.category.from]||"default";_.has(A)||_.set(A,[]),_.get(A).push(x)});const O=[];v.forEach((x,A)=>{const P=_.get(x);if(!P)O.push({id:`${a}-${p}-${x}-null`,index:A,modelType:"grid",name:x,data:void 0,value:null,color:F(e.color.from,{index:A,seriesIndex:E,categoryIndex:A,datasetIndex:l},r),series:p,seriesIndex:E,category:x,categoryIndex:A});else if(e.value.aggregate==="none"){let I=P.map((c,f)=>{const g=c[e.value.from];return{id:c.id||`${a}-${p}-${x}-${f}`,index:A,modelType:"grid",name:c.name||"",data:c.data,value:typeof g=="number"?g:null,color:F(e.color.from,{index:A,seriesIndex:E,categoryIndex:A,datasetIndex:l},r),series:p,seriesIndex:E,category:x,categoryIndex:A}});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(S=>{if(e.value.aggregate==="count")return 1;const C=S[e.value.from];return typeof C=="number"?C:null}),c=ye(I,e.value.aggregate),f=P[0],g={id:f.id||`${a}-${p}-${x}-aggregated`,index:A,modelType:"grid",name:f.name||x,data:f.data,value:c,color:F(e.color.from,{index:A,seriesIndex:E,categoryIndex:A,datasetIndex:l},r),series:p,seriesIndex:E,category:x,categoryIndex:A};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 x=O[e.category.from]||"default";_.includes(x)||_.push(x)}),E=_}else e.category.sort==="alphabetical"&&E.sort((_,O)=>_.localeCompare(O,void 0,{numeric:!0}));const d=[];E.forEach((_,O)=>{p.get(_).forEach((A,P)=>{const I=e.multivariate.map((f,g)=>({index:g,name:f.name,value:(()=>{const S=A[f.from];return typeof S=="number"?S:null})()})),c={id:A.id||`${a}-${m}-${_}-${P}`,index:P,modelType:"multivariate",name:A.name||"",data:A.data,value:null,color:F(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),S=new Map;g.forEach($=>{const B=$[e.category.from]||"default";S.has(B)||S.set(B,[]),S.get(B).push($)});let C=Array.from(S.keys());if(Array.isArray(e.category.sort))C=e.category.sort.filter($=>S.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=S.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:F(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:F(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 x=c=>(E.has(c)||E.set(c,_++),E.get(c)),A=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,S=c[e.series.from]||"default",C=c[e.category.from]||"default",$=`${f}-${g}-${S}-${C}`;I.has($)||I.set($,[]),I.get($).push(c)}),Array.from(I.entries()).forEach(([c,f],g)=>{const S=f[0],C=S.source,$=S.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=x(z),Ae=A(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:F(e.color.from,{index:y.length,seriesIndex:ne,categoryIndex:Ae,datasetIndex:h},r),series:z,seriesIndex:ne,category:ae,categoryIndex:Ae,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=S[e.series.from]||"default",z=S[e.category.from]||"default",ae=x(j),ne=A(z),Ae={id:S.id||`edge-${g}-aggregated`,index:y.length,modelType:"graph",name:S.name||"",data:S.data,value:M,color:F(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(Ae)}}),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],S=g[e.series.from]||"default",C=b.indexOf(S),$=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:F(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:S,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:F(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:S,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 x=[],A=new Map;_.forEach(c=>{c.parent===null?x.push(c):(A.has(c.parent)||A.set(c.parent,[]),A.get(c.parent).push(c))});function P(c,f){c.depth=f;const g=A.get(c.id)||[];return e.value.sort==="asc"?g.sort((S,C)=>S.value===null&&C.value===null?0:S.value===null?1:C.value===null?-1:S.value-C.value):e.value.sort==="desc"&&g.sort((S,C)=>S.value===null&&C.value===null?0:S.value===null?1:C.value===null?-1:C.value-S.value),g.forEach((S,C)=>{S.seq=C}),c.children=g.map(S=>P(S,f+1)),c}const I=x.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:F(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:F(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 S=(C,$)=>(C.depth=$,$===1&&(C.seq=g),C.children=C.children.map(B=>S(B,$+1)),C);return S(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=>xt(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,x]=E.split("-");return O===i&&(p[x]=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(St,e.size):St,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,S)=>JSON.stringify(g)===JSON.stringify(S))),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,S])=>{try{return Dr(f,g,S)}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,S])=>{try{return Nr(f,g,S)}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,S])=>{try{return Gr(f,g,S)}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,S])=>{try{return Ur(f,g,S)}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,S])=>{try{return zr(f,g,S)}catch(C){throw new Error(de({from:"Chart.treeData$",systemMessage:C}))}}),he(f=>(console.error(U(f)),fe)),re(1)),x=new G([]);l.subscribe(f=>{const g={},S=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(S[B]));const C=f.map($=>({id:$._getId(),name:$._name,elementType:$._elementType,shownLayers:$.getShownLayerNames()}));x.next(C)});const A=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$:x,theme$:A,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:S,expectToBe:C}=It(f);if(g==="error")throw new Error(H({columnName:S,expectToBe:C,from:"Chart.setData"}));g==="warning"&&console.warn(Q({columnName:S,expectToBe:C,from:"Chart.setData"}))}catch(g){console.error(U(g))}n.next(f)}function p(f){try{const{status:S,columnName:C,expectToBe:$}=Tt(f);if(S==="error")throw new Error(H({columnName:C,expectToBe:$,from:"Chart.updateEncoding"}));S==="warning"&&console.warn(Q({columnName:C,expectToBe:$,from:"Chart.updateEncoding"}))}catch(S){console.error(U(S))}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:S,expectToBe:C}=je(f);if(g==="error")throw new Error(H({columnName:S,expectToBe:C,from:"Chart.setPlugins"}));g==="warning"&&console.warn(Q({columnName:S,expectToBe:C,from:"Chart.setPlugins"}))}catch(g){console.error(U(g))}l.next(f)}function O(f){try{const{status:g,columnName:S,expectToBe:C}=je([f]);if(g==="error")throw new Error(H({columnName:S,expectToBe:C,from:"Chart.addPlugin"}));g==="warning"&&console.warn(Q({columnName:S,expectToBe:C,from:"Chart.addPlugin"}))}catch(g){console.error(U(g))}l.next([...l.getValue(),f])}function x(f){l.next(l.getValue().filter(g=>g._getId()!==f))}function A(f){try{const{status:S,columnName:C,expectToBe:$}=$t(f);if(S==="error")throw new Error(H({columnName:C,expectToBe:$,from:"Chart.updateTheme"}));S==="warning"&&console.warn(Q({columnName:C,expectToBe:$,from:"Chart.updateTheme"}))}catch(S){console.error(U(S))}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:x,updateTheme:A,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(x=>_.has(x))}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 x;return[O,((x=e.layers.find(A=>A._name===O))==null?void 0:x._layerIndex)??-1]}).filter(([,O])=>O!==-1).sort((O,x)=>O[1]-x[1]).map(([O])=>O))),v=new G(r??{}),y=new se,p=new K(d=>{v.subscribe(_=>{try{const{status:x,columnName:A,expectToBe:P}=e.validator(_);if(x==="error")throw new Error(H({columnName:A,expectToBe:P,from:`${e.name}.params$`}));x==="warning"&&console.warn(Q({columnName:A,expectToBe:P,from:`${e.name}.params$`}))}catch(x){console.error(U(x))}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 x=d.context._updateLayerElements(t,n,O.map(A=>({pluginId:n,pluginName:e.name,layerName:A,layerIndex:a[A]._layerIndex})));e.setup&&(o=e.setup(d)),e.layers.forEach(A=>{var P,I;if(_.has(A._name)){const c=t==="svg"?{svgG:x[A._name],context:d.context,pluginParams$:p,initLayerParams:((P=v.getValue())==null?void 0:P[A._name])||{}}:{canvas:x[A._name],context:d.context,pluginParams$:p,initLayerParams:((I=v.getValue())==null?void 0:I[A._name])||{}};A._enable(c)}else A._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=Kr,T.createLayerClassName=xt,T.createMessagePrefix=Me,T.createOrbChartsErrorMessage=U,T.createPluginClassName=At,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=F,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 Et(t){return new K(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 At(t){return`orbcharts-${t}`}function xt(t,e){return`${At(t)}-${e}`}function Fr(t,e){const r={string:s=>typeof s=="string",number:s=>typeof s=="number",boolean:s=>typeof s=="boolean",object:s=>J(s),"object[]":s=>Array.isArray(s)&&s.every(u=>J(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(f=>r[f](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=Fr(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 St={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:["#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"},Dr=(t,e,r)=>{const n=new Map,o=Array.isArray(t[0]);o?t.forEach((a,l)=>{a.forEach(i=>{const f=i[e.dataset.from]||`dataset-${l}`;n.has(f)||n.set(f,[]),n.get(f).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(f=>{const b=f[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),f=new Map;i.forEach(m=>{const h=m[e.series.from]||"default";f.has(h)||f.set(h,[]),f.get(h).push(m)});let b=Array.from(f.keys());if(Array.isArray(e.series.sort))b=e.series.sort.filter(m=>f.has(m)).concat(b.filter(m=>!e.series.sort.includes(m)));else if(e.series.sort==="original"){const m=[];i.forEach(h=>{const w=h[e.series.from]||"default";m.includes(w)||m.push(w)}),b=m}else e.series.sort==="alphabetical"&&b.sort((m,h)=>m.localeCompare(h,void 0,{numeric:!0}));const _=[];if(e.category.sort==="original")i.forEach(m=>{const h=m[e.category.from]||"default";_.includes(h)||_.push(h)});else if(e.category.sort==="alphabetical"){const m=new Set;i.forEach(h=>{m.add(h[e.category.from]||"default")}),_.push(...Array.from(m).sort((h,w)=>h.localeCompare(w,void 0,{numeric:!0})))}else if(Array.isArray(e.category.sort)){const m=[];i.forEach(w=>{const I=w[e.category.from]||"default";m.includes(I)||m.push(I)});const h=e.category.sort;_.push(...h.filter(w=>m.includes(w)),...m.filter(w=>!h.includes(w)))}const d=new Map;_.forEach((m,h)=>{d.set(m,h)});const x=[];b.forEach((m,h)=>{const w=f.get(m),I=new Map;w.forEach(g=>{const E=g[e.category.from]||"default";I.has(E)||I.set(E,[]),I.get(E).push(g)});const $=_.filter(g=>I.has(g)),y=[];e.category.sort==="original"&&e.value.aggregate==="none"?(w.forEach((g,E)=>{const P=g[e.category.from]||"default",T=d.get(P),c=g[e.value.from];y.push({id:g.id||`${a}-${m}-${P}-${E}`,index:T,modelType:"series",name:g.name||"",data:g.data,value:typeof c=="number"?c:null,color:F(e.color.from,{index:T,seriesIndex:h,categoryIndex:T,datasetIndex:l},r),series:m,seriesIndex:h,category:P,categoryIndex:T})}),e.value.sort==="asc"?y.sort((g,E)=>g.value===null&&E.value===null?0:g.value===null?1:E.value===null?-1:g.value-E.value):e.value.sort==="desc"&&y.sort((g,E)=>g.value===null&&E.value===null?0:g.value===null?1:E.value===null?-1:E.value-g.value)):$.forEach(g=>{const E=d.get(g),P=I.get(g);if(e.value.aggregate==="none"){let T=P.map((c,v)=>{const C=c[e.value.from];return{id:c.id||`${a}-${m}-${g}-${v}`,index:E,modelType:"series",name:c.name||"",data:c.data,value:typeof C=="number"?C:null,color:F(e.color.from,{index:E,seriesIndex:h,categoryIndex:E,datasetIndex:l},r),series:m,seriesIndex:h,category:g,categoryIndex:E}});e.value.sort==="asc"?T.sort((c,v)=>c.value===null&&v.value===null?0:c.value===null?1:v.value===null?-1:c.value-v.value):e.value.sort==="desc"&&T.sort((c,v)=>c.value===null&&v.value===null?0:c.value===null?1:v.value===null?-1:v.value-c.value),y.push(...T)}else{const T=P.map(p=>{if(e.value.aggregate==="count")return 1;const A=p[e.value.from];return typeof A=="number"?A:null}),c=ye(T,e.value.aggregate),v=P[0],C={id:v.id||`${a}-${m}-${g}-aggregated`,index:E,modelType:"series",name:v.name||g,data:v.data,value:c,color:F(e.color.from,{index:E,seriesIndex:h,categoryIndex:E,datasetIndex:l},r),series:m,seriesIndex:h,category:g,categoryIndex:E};y.push(C)}}),x.push(y)}),u.push(x)}),u},Nr=(t,e,r)=>{const n=new Map,o=Array.isArray(t[0]);o?t.forEach((a,l)=>{a.forEach(i=>{const f=i[e.dataset.from]||`dataset-${l}`;n.has(f)||n.set(f,[]),n.get(f).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(f=>{const b=f[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),f=new Map;i.forEach(h=>{const w=h[e.series.from]||"default";f.has(w)||f.set(w,[]),f.get(w).push(h)});let b=Array.from(f.keys());if(Array.isArray(e.series.sort))b=e.series.sort.filter(h=>f.has(h)).concat(b.filter(h=>!e.series.sort.includes(h)));else if(e.series.sort==="original"){const h=[];i.forEach(w=>{const I=w[e.series.from]||"default";h.includes(I)||h.push(I)}),b=h}else e.series.sort==="alphabetical"&&b.sort((h,w)=>h.localeCompare(w,void 0,{numeric:!0}));const _=[];i.forEach(h=>{const w=h[e.category.from]||"default";_.includes(w)||_.push(w)});const d=new Set(_);let x=Array.from(d);Array.isArray(e.category.sort)?x=e.category.sort.filter(h=>d.has(h)).concat(x.filter(h=>!e.category.sort.includes(h))):e.category.sort==="original"?x=_:e.category.sort==="alphabetical"&&x.sort((h,w)=>h.localeCompare(w,void 0,{numeric:!0}));const m=[];b.forEach((h,w)=>{const I=f.get(h),$=new Map;I.forEach(g=>{const E=g[e.category.from]||"default";$.has(E)||$.set(E,[]),$.get(E).push(g)});const y=[];x.forEach((g,E)=>{const P=$.get(g);if(!P)y.push({id:`${a}-${h}-${g}-null`,index:E,modelType:"grid",name:g,data:void 0,value:null,color:F(e.color.from,{index:E,seriesIndex:w,categoryIndex:E,datasetIndex:l},r),series:h,seriesIndex:w,category:g,categoryIndex:E});else if(e.value.aggregate==="none"){let T=P.map((c,v)=>{const C=c[e.value.from];return{id:c.id||`${a}-${h}-${g}-${v}`,index:E,modelType:"grid",name:c.name||"",data:c.data,value:typeof C=="number"?C:null,color:F(e.color.from,{index:E,seriesIndex:w,categoryIndex:E,datasetIndex:l},r),series:h,seriesIndex:w,category:g,categoryIndex:E}});e.value.sort==="asc"?T.sort((c,v)=>c.value===null&&v.value===null?0:c.value===null?1:v.value===null?-1:c.value-v.value):e.value.sort==="desc"&&T.sort((c,v)=>c.value===null&&v.value===null?0:c.value===null?1:v.value===null?-1:v.value-c.value),y.push(...T)}else{const T=P.map(p=>{if(e.value.aggregate==="count")return 1;const A=p[e.value.from];return typeof A=="number"?A:null}),c=ye(T,e.value.aggregate),v=P[0],C={id:v.id||`${a}-${h}-${g}-aggregated`,index:E,modelType:"grid",name:v.name||g,data:v.data,value:c,color:F(e.color.from,{index:E,seriesIndex:w,categoryIndex:E,datasetIndex:l},r),series:h,seriesIndex:w,category:g,categoryIndex:E};y.push(C)}}),m.push(y)}),u.push(m)}),u},Gr=(t,e,r)=>{const n=new Map,o=Array.isArray(t[0]);o?t.forEach((a,l)=>{a.forEach(i=>{const f=i[e.dataset.from]||`dataset-${l}`;n.has(f)||n.set(f,[]),n.get(f).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(f=>{const b=f[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),f=new Map;i.forEach(d=>{const x=d[e.series.from]||"default";f.has(x)||f.set(x,[]),f.get(x).push(d)});let b=Array.from(f.keys());if(Array.isArray(e.series.sort))b=e.series.sort.filter(d=>f.has(d)).concat(b.filter(d=>!e.series.sort.includes(d)));else if(e.series.sort==="original"){const d=[];i.forEach(x=>{const m=x[e.series.from]||"default";d.includes(m)||d.push(m)}),b=d}else e.series.sort==="alphabetical"&&b.sort((d,x)=>d.localeCompare(x,void 0,{numeric:!0}));const _=[];b.forEach((d,x)=>{const m=f.get(d),h=new Map;m.forEach($=>{const y=$[e.category.from]||"default";h.has(y)||h.set(y,[]),h.get(y).push($)});let w=Array.from(h.keys());if(Array.isArray(e.category.sort))w=e.category.sort.filter($=>h.has($)).concat(w.filter($=>!e.category.sort.includes($)));else if(e.category.sort==="original"){const $=[];m.forEach(y=>{const g=y[e.category.from]||"default";$.includes(g)||$.push(g)}),w=$}else e.category.sort==="alphabetical"&&w.sort(($,y)=>$.localeCompare(y,void 0,{numeric:!0}));const I=[];w.forEach(($,y)=>{h.get($).forEach((E,P)=>{const T=e.multivariate.map((v,C)=>({index:C,name:v.name,value:(()=>{const p=E[v.from];return typeof p=="number"?p:null})()})),c={id:E.id||`${a}-${d}-${$}-${P}`,index:P,modelType:"multivariate",name:E.name||"",data:E.data,value:null,color:F(e.color.from,{index:P,seriesIndex:x,categoryIndex:y,datasetIndex:l},r),multivariate:T,series:d,seriesIndex:x,category:$,categoryIndex:y};I.push(c)})}),_.push(I)}),u.push(_)}),u},Ur=(t,e,r)=>{const n=Array.isArray(t[0]),o=[],s=[];n?t.forEach(i=>{i.forEach(f=>{f.source&&f.target?s.push(f):o.push(f)})}):t.forEach(i=>{i.source&&i.target?s.push(i):o.push(i)});const u=new Map;n?t.forEach((i,f)=>{i.forEach(b=>{if(!b.source||!b.target){const _=b[e.dataset.from]||`dataset-${f}`;u.has(_)||u.set(_,[]),u.get(_).push(b)}})}):o.forEach(i=>{const f=i[e.dataset.from]||"default";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,b)=>{f.forEach(_=>{if(!_.source||!_.target){const d=_[e.dataset.from]||`dataset-${b}`;i.includes(d)||i.push(d)}})}):o.forEach(f=>{const b=f[e.dataset.from]||"default";i.includes(b)||i.push(b)}),a=i}else e.dataset.sort==="alphabetical"&&a.sort((i,f)=>i.localeCompare(f,void 0,{numeric:!0}));const l=[];return a.forEach((i,f)=>{const b=u.get(i),_=[],d=new Map;b.forEach(c=>{const v=c[e.series.from]||"default";d.has(v)||d.set(v,[]),d.get(v).push(c)});let x=Array.from(d.keys());if(Array.isArray(e.series.sort))x=e.series.sort.filter(c=>d.has(c)).concat(x.filter(c=>!e.series.sort.includes(c)));else if(e.series.sort==="original"){const c=[];b.forEach(v=>{const C=v[e.series.from]||"default";c.includes(C)||c.push(C)}),x=c}else e.series.sort==="alphabetical"&&x.sort((c,v)=>c.localeCompare(v,void 0,{numeric:!0}));x.forEach((c,v)=>{const C=d.get(c),p=new Map;C.forEach(S=>{const O=S[e.category.from]||"default";p.has(O)||p.set(O,[]),p.get(O).push(S)});let A=Array.from(p.keys());if(Array.isArray(e.category.sort))A=e.category.sort.filter(S=>p.has(S)).concat(A.filter(S=>!e.category.sort.includes(S)));else if(e.category.sort==="original"){const S=[];C.forEach(O=>{const M=O[e.category.from]||"default";S.includes(M)||S.push(M)}),A=S}else e.category.sort==="alphabetical"&&A.sort((S,O)=>S.localeCompare(O,void 0,{numeric:!0}));A.forEach((S,O)=>{const M=p.get(S);if(e.value.aggregate==="none"){let j=M.map((V,k)=>{const D=V[e.value.from];return{id:V.id||`${i}-${c}-${S}-${k}`,index:_.length+k,modelType:"graph",name:V.name||"",data:V.data,value:typeof D=="number"?D:null,color:F(e.color.from,{index:O,seriesIndex:v,categoryIndex:O,datasetIndex:f},r),series:c,seriesIndex:v,category:S,categoryIndex:O}});e.value.sort==="asc"?j.sort((V,k)=>V.value===null&&k.value===null?0:V.value===null?1:k.value===null?-1:V.value-k.value):e.value.sort==="desc"&&j.sort((V,k)=>V.value===null&&k.value===null?0:V.value===null?1:k.value===null?-1:k.value-V.value),_.push(...j)}else{const j=M.map(ae=>{if(e.value.aggregate==="count")return 1;const ne=ae[e.value.from];return typeof ne=="number"?ne:null}),V=ye(j,e.value.aggregate),k=M[0],D={id:k.id||`${i}-${c}-${S}-aggregated`,index:_.length,modelType:"graph",name:k.name||S,data:k.data,value:V,color:F(e.color.from,{index:O,seriesIndex:v,categoryIndex:O,datasetIndex:f},r),series:c,seriesIndex:v,category:S,categoryIndex:O};_.push(D)}})});const m=[],h=new Map;_.forEach(c=>{const v=o.find(C=>C.id===c.id||C.name===c.name);v!=null&&v.id&&h.set(v.id,c.index),v!=null&&v.name&&h.set(v.name,c.index)});const w=new Map,I=new Map;_.forEach(c=>{w.has(c.series)||w.set(c.series,c.seriesIndex),I.has(c.category)||I.set(c.category,c.categoryIndex)});let $=w.size,y=I.size;const g=c=>(w.has(c)||w.set(c,$++),w.get(c)),E=c=>(I.has(c)||I.set(c,y++),I.get(c)),P=s.filter(c=>(c[e.dataset.from]||"default")===i),T=new Map;P.forEach(c=>{const v=c.source,C=c.target,p=c[e.series.from]||"default",A=c[e.category.from]||"default",S=`${v}-${C}-${p}-${A}`;T.has(S)||T.set(S,[]),T.get(S).push(c)}),Array.from(T.entries()).forEach(([c,v],C)=>{const p=v[0],A=p.source,S=p.target,O=h.get(A)??-1,M=h.get(S)??-1;if(O>=0&&M>=0)if(e.value.aggregate==="none")v.forEach((j,V)=>{const k=j[e.value.from],D=j[e.series.from]||"default",ae=j[e.category.from]||"default",ne=g(D),Ae=E(ae),ke={id:j.id||`edge-${C}-${V}`,index:m.length,modelType:"graph",name:j.name||"",data:j.data,value:typeof k=="number"?k:null,color:F(e.color.from,{index:m.length,seriesIndex:ne,categoryIndex:Ae,datasetIndex:f},r),series:D,seriesIndex:ne,category:ae,categoryIndex:Ae,source:A,sourceIndex:O,target:S,targetIndex:M};m.push(ke)});else{const j=v.map(ke=>{if(e.value.aggregate==="count")return 1;const Mt=ke[e.value.from];return typeof Mt=="number"?Mt:null}),V=ye(j,e.value.aggregate),k=p[e.series.from]||"default",D=p[e.category.from]||"default",ae=g(k),ne=E(D),Ae={id:p.id||`edge-${C}-aggregated`,index:m.length,modelType:"graph",name:p.name||"",data:p.data,value:V,color:F(e.color.from,{index:m.length,seriesIndex:ae,categoryIndex:ne,datasetIndex:f},r),series:k,seriesIndex:ae,category:D,categoryIndex:ne,source:A,sourceIndex:O,target:S,targetIndex:M};m.push(Ae)}}),l.push({nodes:_,edges:m})}),l},zr=(t,e,r)=>{const n=new Map,o=Array.isArray(t[0]);o?t.forEach((a,l)=>{a.forEach(i=>{const f=i[e.dataset.from]||`dataset-${l}`;n.has(f)||n.set(f,[]),n.get(f).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(f=>{const b=f[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),f=new Map;i.forEach(c=>{const v=c[e.series.from]||"default";f.has(v)||f.set(v,[]),f.get(v).push(c)});let b=Array.from(f.keys());if(Array.isArray(e.series.sort))b=e.series.sort.filter(c=>f.has(c)).concat(b.filter(c=>!e.series.sort.includes(c)));else if(e.series.sort==="original"){const c=[];i.forEach(v=>{const C=v[e.series.from]||"default";c.includes(C)||c.push(C)}),b=c}else e.series.sort==="alphabetical"&&b.sort((c,v)=>c.localeCompare(v,void 0,{numeric:!0}));const _=new Map;i.forEach(c=>{const v=c[e.category.from]||"default";_.has(v)||_.set(v,[]),_.get(v).push(c)});let d=Array.from(_.keys());if(Array.isArray(e.category.sort))d=e.category.sort.filter(c=>_.has(c)).concat(d.filter(c=>!e.category.sort.includes(c)));else if(e.category.sort==="original"){const c=[];i.forEach(v=>{const C=v[e.category.from]||"default";c.includes(C)||c.push(C)}),d=c}else e.category.sort==="alphabetical"&&d.sort((c,v)=>c.localeCompare(v,void 0,{numeric:!0}));const x=new Map;i.forEach(c=>{const v=c.id||"unknown";x.has(v)||x.set(v,[]),x.get(v).push(c)});let m=0;const h=b[0]||"default",w=b.indexOf(h),I=new Map;Array.from(x.entries()).forEach(([c,v])=>{const C=v[0],p=C[e.series.from]||"default",A=b.indexOf(p),S=C[e.category.from]||"default",O=d.indexOf(S);if(e.value.aggregate==="none"){const M=C[e.value.from],j={id:c,index:m++,modelType:"tree",name:C.name||c,data:C.data,value:typeof M=="number"?M:null,color:F(e.color.from,{index:m-1,seriesIndex:A,categoryIndex:O,datasetIndex:l},r),parent:C.parent||null,parentIndex:null,depth:0,seq:0,children:[],series:p,seriesIndex:A,category:S,categoryIndex:O};I.set(c,j)}else{const M=v.map(k=>{if(e.value.aggregate==="count")return 1;const D=k[e.value.from];return typeof D=="number"?D:null}),j=ye(M,e.value.aggregate),V={id:c,index:m++,modelType:"tree",name:C.name||c,data:C.data,value:j,color:F(e.color.from,{index:m-1,seriesIndex:A,categoryIndex:O,datasetIndex:l},r),parent:C.parent||null,parentIndex:null,depth:0,seq:0,children:[],series:p,seriesIndex:A,category:S,categoryIndex:O};I.set(c,V)}});const $=Array.from(I.values()),y=new Map;$.forEach(c=>{y.set(c.id,c.index)}),$.forEach(c=>{c.parent&&y.has(c.parent)&&(c.parentIndex=y.get(c.parent))});const g=[],E=new Map;$.forEach(c=>{c.parent===null?g.push(c):(E.has(c.parent)||E.set(c.parent,[]),E.get(c.parent).push(c))});function P(c,v){c.depth=v;const C=E.get(c.id)||[];return e.value.sort==="asc"?C.sort((p,A)=>p.value===null&&A.value===null?0:p.value===null?1:A.value===null?-1:p.value-A.value):e.value.sort==="desc"&&C.sort((p,A)=>p.value===null&&A.value===null?0:p.value===null?1:A.value===null?-1:A.value-p.value),C.forEach((p,A)=>{p.seq=A}),c.children=C.map(p=>P(p,v+1)),c}const T=g.map(c=>P(c,0));if(T.length===0)u.push({id:`empty-${a}`,index:m++,modelType:"tree",name:"Empty Tree",data:{},value:null,color:F(e.color.from,{index:m-1,seriesIndex:w<0?0:w,categoryIndex:0,datasetIndex:l},r),parent:null,parentIndex:null,depth:0,seq:0,children:[],series:h,seriesIndex:w<0?0:w,category:"default",categoryIndex:0});else if(T.length===1)u.push(T[0]);else{const c={id:`virtual-root-${a}`,index:m++,modelType:"tree",name:`Virtual Root (${a})`,data:{},value:null,color:F(e.color.from,{index:m-1,seriesIndex:w<0?0:w,categoryIndex:0,datasetIndex:l},r),parent:null,parentIndex:null,depth:0,seq:0,children:T.map((v,C)=>{const p=(A,S)=>(A.depth=S,S===1&&(A.seq=C),A.children=A.children.map(O=>p(O,S+1)),A);return p(v,1)}),series:h,seriesIndex:w<0?0:w,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 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&&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)||J(n))}})}function je(t){return R({plugins:t},{plugins:{toBe:"PluginEntity[]",test:r=>Array.isArray(r)&&r.every(n=>J(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=>J(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,f)=>{const b=r.getValue().reduce((x,m,h)=>(x[m._getId()]=h,x),{}),_=f.map(x=>({...x,pluginSeq:b[x.pluginId]}));return(l==="svg"?n:o).filter(x=>x.pluginId!==i).map(x=>({...x,pluginSeq:b[x.pluginId]})).concat(_).sort((x,m)=>x.layerIndex-m.layerIndex||x.pluginSeq-m.pluginSeq)},u={},a={};return(l,i,f)=>{const b=l==="svg"?t.getValue():e.getValue();if(!b)return{};const _=l==="svg"?u:a,d=s(l,i,f),x=d.map(h=>xt(h.pluginId,h.layerName));return l==="svg"?(Ot(b,x,_,h=>bt(h)),n=d):(Ot(b,x,_,h=>Pe(h)),o=d),Object.entries(_).reduce((h,[w,I])=>{const[$,y,g]=w.split("-");return y===i&&(h[g]=I),h},{})}}const Hr=(t,e)=>{try{const{status:h,columnName:w,expectToBe:I}=Zr(e);if(h==="error")throw new Error(H({columnName:w,expectToBe:I,from:"Chart.constructor"}));if(h==="warning")console.warn(Q({columnName:w,expectToBe:I,from:"Chart.constructor"}));else{const{status:$,columnName:y,expectToBe:g}=Wr(t);if($==="error")throw new Error(H({columnName:y,expectToBe:g,from:"Chart.constructor"}));$==="warning"&&console.warn(Q({columnName:y,expectToBe:g,from:"Chart.constructor"}))}}catch(h){throw new Error(h)}const r=new se,n=new U((e==null?void 0:e.data)||[]),o=e&&e.encoding?W(_t,e.encoding):_t,s=new U(o),u=e&&e.theme?W(Ct,e.theme):Ct,a=new U(u),l=new U((e==null?void 0:e.plugins)||[]),i=e&&e.size?W(St,e.size):St,f=new U(i),b=new U(null),_=new U(null),d=(()=>{const h=f.pipe(kr(p=>Or(()=>p.width==="auto"||p.height==="auto",Et(t).pipe(q(A=>({width:p.width==="auto"?A.width:p.width,height:p.height==="auto"?A.height<=0?A.width:A.height:p.height})),Z(p.resizeDebounce),Ir((A,S)=>JSON.stringify(A)===JSON.stringify(S))),dr({width:p.width,height:p.height}))),Vr(r),re(1)),w=s.asObservable().pipe(re(1)),I=ee([n,s,a]).pipe(Z(0),q(([p,A,S])=>{try{return Dr(p,A,S)}catch(O){throw new Error(de({from:"Chart.seriesData$",systemMessage:O}))}}),he(p=>(console.error(z(p)),fe)),re(1)),$=ee([n,s,a]).pipe(Z(0),q(([p,A,S])=>{try{return Nr(p,A,S)}catch(O){throw new Error(de({from:"Chart.gridData$",systemMessage:O}))}}),he(p=>(console.error(z(p)),fe)),re(1)),y=ee([n,s,a]).pipe(Z(0),q(([p,A,S])=>{try{return Gr(p,A,S)}catch(O){throw new Error(de({from:"Chart.multivariateData$",systemMessage:O}))}}),he(p=>(console.error(z(p)),fe)),re(1)),g=ee([n,s,a]).pipe(Z(0),q(([p,A,S])=>{try{return Ur(p,A,S)}catch(O){throw new Error(de({from:"Chart.graphData$",systemMessage:O}))}}),he(p=>(console.error(z(p)),fe)),re(1)),E=ee([n,s,a]).pipe(Z(0),q(([p,A,S])=>{try{return zr(p,A,S)}catch(O){throw new Error(de({from:"Chart.treeData$",systemMessage:O}))}}),he(p=>(console.error(z(p)),fe)),re(1)),P=new U([]);l.subscribe(p=>{const A={},S=p.map(M=>{var V;let j=M._getId();if(A[j]){const k=((V=A[j].split("[")[1])==null?void 0:V.split("]")[0])||"0",D=parseInt(k)+1;j=`${j.split("[")[0]}[${D}]`}return A[j]=M._getId(),j});p.forEach((M,j)=>M._setId(S[j]));const O=p.map(M=>({id:M._getId(),name:M._name,elementType:M._elementType,shownLayers:M.getShownLayerNames()}));P.next(O)});const T=a.asObservable().pipe(re(1)),c=new se,v=c.asObservable().pipe(ut());return{root:t,svg:null,canvas:null,size$:h,encoding$:w,seriesData$:I,gridData$:$,multivariateData$:y,graphData$:g,treeData$:E,plugins$:P,theme$:T,event$:v,eventTrigger$:c,_updateLayerElements:Jr({svgElement$:b,canvasElement$:_,pluginsInstance$:l})}})();let x=null;const m=()=>(x||(x=document.createElement("div"),x.classList.add("orbcharts-container"),x.style.position="relative",t.appendChild(x)),x);return l.subscribe(h=>{let w=!1,I=!1;h.forEach($=>{$._elementType==="svg"?w=!0:$._elementType==="canvas"&&(I=!0)}),w&&!d.svg?(d.svg=gt("orbcharts-root-svg"),m().appendChild(d.svg),b.next(d.svg)):!w&&d.svg&&(d.svg.remove(),d.svg=null,b.next(null)),I&&!d.canvas?(d.canvas=Pe("orbcharts-root-canvas"),m().appendChild(d.canvas),_.next(d.canvas)):!I&&d.canvas&&(d.canvas.remove(),d.canvas=null,_.next(null)),h.forEach($=>{$._injectContext(d)})}),ee({size:d.size$,svg:b}).pipe(Z(0),ge(({svg:h})=>!!h)).subscribe(({size:h,svg:w})=>{w&&(w.setAttribute("width",h.width.toString()),w.setAttribute("height",h.height.toString()))}),ee({size:d.size$,canvas:_}).pipe(Z(0),ge(({canvas:h})=>!!h)).subscribe(({size:h,canvas:w})=>{w&&(w.width=h.width,w.height=h.height)}),(()=>{function h(p){f.next(p)}function w(p){try{const{status:A,columnName:S,expectToBe:O}=It(p);if(A==="error")throw new Error(H({columnName:S,expectToBe:O,from:"Chart.setData"}));A==="warning"&&console.warn(Q({columnName:S,expectToBe:O,from:"Chart.setData"}))}catch(A){console.error(z(A))}n.next(p)}function I(p){try{const{status:S,columnName:O,expectToBe:M}=Tt(p);if(S==="error")throw new Error(H({columnName:O,expectToBe:M,from:"Chart.updateEncoding"}));S==="warning"&&console.warn(Q({columnName:O,expectToBe:M,from:"Chart.updateEncoding"}))}catch(S){console.error(z(S))}const A=W(s.getValue(),p);s.next(A)}function $(p){s.next(p)}function y(){return s.getValue()}function g(p){try{const{status:A,columnName:S,expectToBe:O}=je(p);if(A==="error")throw new Error(H({columnName:S,expectToBe:O,from:"Chart.setPlugins"}));A==="warning"&&console.warn(Q({columnName:S,expectToBe:O,from:"Chart.setPlugins"}))}catch(A){console.error(z(A))}l.next(p)}function E(p){try{const{status:A,columnName:S,expectToBe:O}=je([p]);if(A==="error")throw new Error(H({columnName:S,expectToBe:O,from:"Chart.addPlugin"}));A==="warning"&&console.warn(Q({columnName:S,expectToBe:O,from:"Chart.addPlugin"}))}catch(A){console.error(z(A))}l.next([...l.getValue(),p])}function P(p){l.next(l.getValue().filter(A=>A._getId()!==p))}function T(p){try{const{status:S,columnName:O,expectToBe:M}=$t(p);if(S==="error")throw new Error(H({columnName:O,expectToBe:M,from:"Chart.updateTheme"}));S==="warning"&&console.warn(Q({columnName:O,expectToBe:M,from:"Chart.updateTheme"}))}catch(S){console.error(z(S))}const A=W(a.getValue(),p);a.next(A)}function c(p){a.next(p)}function v(){return a.getValue()}function C(){r.next(void 0),wt(t),x=null}return{resize:h,setData:w,updateEncoding:I,forceReplaceEncoding:$,getEncoding:y,setPlugins:g,addPlugin:E,removePlugin:P,updateTheme:T,forceReplaceTheme:c,getTheme:v,destroy:C,context:d}})()};class Qr{constructor(e,r){return Hr(e,r)}}const Bt=(t,e,r)=>{let n=e.name,o=()=>{};const s=new U(null),u=s.pipe(ge(y=>y!==null)),a=e.layers.map(y=>new y),l={...a.reduce((y,g)=>(y[g._name]=g,y),{})},i=()=>new Set(a.map(y=>y._name)),f=y=>{if(y){const g=i();return Object.keys(y).filter(P=>g.has(P))}return[]},b=a.reduce((y,g)=>(g._initShow&&y.push(g._name),y),[]),_=f(r),d=new U(new Set(_.length>0?_:b)),x=d.pipe(q(y=>Array.from(y).map(E=>{var P;return[E,((P=a.find(T=>T._name===E))==null?void 0:P._layerIndex)??-1]}).filter(([,E])=>E!==-1).sort((E,P)=>E[1]-P[1]).map(([E])=>E)));let m=W(e.defaultParams??{},r??{});const h=new U(r??{}),w=new se,I=new K(y=>{h.subscribe(g=>{try{const{status:E,columnName:P,expectToBe:T}=e.validator(g);if(E==="error")throw new Error(H({columnName:P,expectToBe:T,from:`${e.name}.params$`}));E==="warning"&&console.warn(Q({columnName:P,expectToBe:T,from:`${e.name}.params$`}))}catch(E){console.error(z(E))}y.next(m)}),w.subscribe(g=>{y.next(g)})}),$=u.pipe(q(y=>({context:y,pluginParams$:I})),jr());return ee({pluginSetupProps:$,ShownLayerNameSet:d,shownLayerNamesSeq:x}).pipe(Z(0)).subscribe(({pluginSetupProps:y,ShownLayerNameSet:g,shownLayerNamesSeq:E})=>{const P=y.context._updateLayerElements(t,n,E.map(T=>({pluginId:n,pluginName:e.name,layerName:T,layerIndex:l[T]._layerIndex})));e.setup&&(o=e.setup(y)),a.forEach(T=>{var c,v;if(g.has(T._name)){const C=t==="svg"?{svgG:P[T._name],context:y.context,pluginParams$:I,initLayerParams:((c=h.getValue())==null?void 0:c[T._name])||{}}:{canvas:P[T._name],context:y.context,pluginParams$:I,initLayerParams:((v=h.getValue())==null?void 0:v[T._name])||{}};T._enable(C)}else T._disable()})}),{_name:e.name,_elementType:t,_getId:()=>n,_setId:y=>{n=y},_injectContext:y=>{s.next(Object.assign({},y))},show:y=>{y=Array.isArray(y)?y:[y],d.next(new Set([...Array.from(d.getValue()),...y]))},showOnly:y=>{y=Array.isArray(y)?y:[y],d.next(new Set([...y]))},showAll:()=>{d.next(i())},hide:y=>{y=Array.isArray(y)?y:[y],d.next(new Set([...Array.from(d.getValue()).filter(g=>!y.includes(g))]))},hideAll:()=>{d.next(new Set)},toggle:y=>{y=Array.isArray(y)?y:[y],Array.from(d.getValue()).forEach(g=>{y.includes(g)?y.splice(y.indexOf(g),1):y.push(g)}),d.next(new Set(y))},getShownLayerNames:()=>Array.from(d.getValue()),updateParams:y=>{m=W(m,y),h.next(y),Object.keys(y).forEach(g=>{const E=l[g];E&&E._updateParams(y[g])})},forceReplaceParams:y=>{m=y,w.next(y),Object.keys(y).forEach(g=>{const E=l[g];E&&E._forceReplaceParams(y[g])})},getParams:()=>{const y=Object.assign({},m);return a.forEach(g=>{y[g._name]=g._getParams()}),y},destroy:()=>{o(),s.complete(),d.complete(),a.forEach(y=>{y._destroy()})}}},Xr=t=>class{constructor(r){return Bt("svg",t,r)}},Pt=(t,e)=>{const r=new U(Object.assign({},e.defaultParams));let n=()=>{};const o=new U(null),s=o.pipe(ge(u=>u!==null));return ee({layerParams:r,enabledProps:s}).pipe(Z(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=>W(l,a.initLayerParams??{})))}):e.setup({canvas:a.canvas,context:a.context,pluginParams$:a.pluginParams$,layerParams$:r.pipe(q(l=>W(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:f}=e.validator(u);if(l==="error")throw new Error(H({columnName:i,expectToBe:f,from:`${e.name}.params$`}));l==="warning"&&console.warn(Q({columnName:i,expectToBe:f,from:`${e.name}.params$`}))}catch(l){console.error(z(l))}const a=W(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)}};B.OrbCharts=Qr,B.aggregate=ye,B.count=dt,B.createCanvas=Pe,B.createCanvasElement=Rr,B.createDiv=Kr,B.createLayerClassName=xt,B.createMessagePrefix=Me,B.createOrbChartsErrorMessage=z,B.createPluginClassName=At,B.createSVG=gt,B.createSVGGroup=bt,B.createUnexpectedErrorMessage=de,B.createValidatorErrorMessage=H,B.createValidatorWarningMessage=Q,B.deepOverwrite=W,B.defineCanvasLayer=rn,B.defineCanvasPlugin=tn,B.defineSVGLayer=en,B.defineSVGPlugin=Xr,B.formatCommaNumber=Lr,B.getColorByFrom=F,B.getColorByIndex=mt,B.isDom=Be,B.isFunction=vt,B.isPlainObject=J,B.max=yt,B.mean=ct,B.median=ft,B.min=ht,B.none=pt,B.removeElementChildren=wt,B.resizeObservable=Et,B.sum=lt,B.validateObject=R,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
@@ -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>> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbcharts/core",
3
- "version": "4.0.0-alpha.0",
3
+ "version": "4.0.0-beta.0",
4
4
  "description": "Core codes for OrbCharts",
5
5
  "author": "Blue Planet Inc.",
6
6
  "license": "Apache-2.0",
package/src/OrbCharts.ts CHANGED
@@ -1,35 +1,35 @@
1
- import type {
2
- DeepPartial,
3
- Size,
4
- ChartEntity,
5
- ChartContext,
6
- PartialChartOptions,
7
- Encoding,
8
- PluginEntity,
9
- RawData,
10
- Theme,
11
- SizeConfig
12
- } from './types'
13
- import { createChart } from './chart/createChart'
14
-
15
- export class OrbCharts implements ChartEntity {
16
- resize: (sizeConfig: SizeConfig) => void
17
- setData: (data: RawData) => void
18
- // setEncoding: (partial: DeepPartial<Encoding>) => void
19
- updateEncoding: (patch: DeepPartial<Encoding>) => void
20
- forceReplaceEncoding: (full: Encoding) => void
21
- getEncoding: () => Readonly<Encoding>
22
- setPlugins: (plugins: PluginEntity<any, any, any>[]) => void
23
- addPlugin: (plugin: PluginEntity<any, any, any>) => void
24
- removePlugin: (id: string) => void
25
- // setTheme: (theme: Theme) => void
26
- updateTheme: (patch: DeepPartial<Theme>) => void
27
- forceReplaceTheme: (full: Theme) => void
28
- getTheme: () => Readonly<Theme>
29
- destroy: () => void;
30
- context: ChartContext<unknown>
31
-
32
- constructor(element: HTMLElement | Element, options?: PartialChartOptions) {
33
- return createChart(element, options)
34
- }
1
+ import type {
2
+ DeepPartial,
3
+ Size,
4
+ ChartEntity,
5
+ ChartContext,
6
+ PartialChartOptions,
7
+ Encoding,
8
+ PluginEntity,
9
+ RawData,
10
+ Theme,
11
+ SizeConfig
12
+ } from './types'
13
+ import { createChart } from './chart/createChart'
14
+
15
+ export class OrbCharts implements ChartEntity {
16
+ resize: (sizeConfig: SizeConfig) => void
17
+ setData: (data: RawData) => void
18
+ // setEncoding: (partial: DeepPartial<Encoding>) => void
19
+ updateEncoding: (patch: DeepPartial<Encoding>) => void
20
+ forceReplaceEncoding: (full: Encoding) => void
21
+ getEncoding: () => Readonly<Encoding>
22
+ setPlugins: (plugins: PluginEntity<any, any, any>[]) => void
23
+ addPlugin: (plugin: PluginEntity<any, any, any>) => void
24
+ removePlugin: (id: string) => void
25
+ // setTheme: (theme: Theme) => void
26
+ updateTheme: (patch: DeepPartial<Theme>) => void
27
+ forceReplaceTheme: (full: Theme) => void
28
+ getTheme: () => Readonly<Theme>
29
+ destroy: () => void;
30
+ context: ChartContext<unknown>
31
+
32
+ constructor(element: HTMLElement | Element, options?: PartialChartOptions) {
33
+ return createChart(element, options)
34
+ }
35
35
  }