UNPKG

@eclipse-scout/chart

Version:
1 lines 134 kB
(()=>{"use strict";var D={};D.n=l=>{var e=l&&l.__esModule?()=>l.default:()=>l;return D.d(e,{a:e}),e},D.d=(l,e)=>{for(var t in e)D.o(e,t)&&!D.o(l,t)&&Object.defineProperty(l,t,{enumerable:!0,get:e[t]})},D.o=(l,e)=>Object.prototype.hasOwnProperty.call(l,e),D.r=l=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})};var Pe={};D.r(Pe),D.d(Pe,{AbstractChartRenderer:()=>he,AbstractSvgChartRenderer:()=>P,Chart:()=>d,ChartAdapter:()=>De,ChartColorMode:()=>Z,ChartField:()=>Ie,ChartFieldAdapter:()=>we,ChartFieldTile:()=>He,ChartFieldTileAdapter:()=>Ne,ChartJsRenderer:()=>F,ChartLayout:()=>fe,ChartTableControl:()=>Q,ChartTableControlAdapter:()=>Ge,ChartTableControlLayout:()=>ve,ChartTableUserFilter:()=>J,FulfillmentChartRenderer:()=>ge,SalesfunnelChartRenderer:()=>_e,SpeedoChartRenderer:()=>B,VennAsync3Calculator:()=>Ce,VennChartRenderer:()=>Te,VennCircle:()=>Y,VennCircleHelper:()=>xe,chartJsDateAdapter:()=>me,default:()=>Ve});var le={};D.r(le),D.d(le,{AbstractChartRenderer:()=>he,AbstractSvgChartRenderer:()=>P,Chart:()=>d,ChartAdapter:()=>De,ChartColorMode:()=>Z,ChartField:()=>Ie,ChartFieldAdapter:()=>we,ChartFieldTile:()=>He,ChartFieldTileAdapter:()=>Ne,ChartJsRenderer:()=>F,ChartLayout:()=>fe,ChartTableControl:()=>Q,ChartTableControlAdapter:()=>Ge,ChartTableControlLayout:()=>ve,ChartTableUserFilter:()=>J,FulfillmentChartRenderer:()=>ge,SalesfunnelChartRenderer:()=>_e,SpeedoChartRenderer:()=>B,VennAsync3Calculator:()=>Ce,VennChartRenderer:()=>Te,VennCircle:()=>Y,VennCircleHelper:()=>xe,chartJsDateAdapter:()=>me,default:()=>Ve});const o=scout,je=jQuery;var _=D.n(je);function I(l,e,t){return(e=Fe(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Fe(l){var e=$e(l,"string");return typeof e=="symbol"?e:e+""}function $e(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var i=t.call(l,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class d extends o.Widget{constructor(){super(),I(this,"data",void 0),I(this,"config",void 0),I(this,"checkedItems",void 0),I(this,"chartRenderer",void 0),I(this,"_updatedOnce",void 0),I(this,"_updateChartTimeoutId",void 0),I(this,"_updateChartOpts",void 0),I(this,"_updateChartOptsWhileNotAttached",void 0),this.$container=null,this.data=null,this.config=null,this.checkedItems=[],this.chartRenderer=null,this._updateChartTimeoutId=null,this._updateChartOpts=null,this._updateChartOptsWhileNotAttached=[],this._updatedOnce=!1}_init(e){super._init(e),this.setConfig(this.config),this._setData(this.data)}_render(){this.$container=this.$parent.appendDiv("chart"),o.aria.role(this.$container,"none"),this.htmlComp=o.HtmlComponent.install(this.$container,this.session),this.htmlComp.setLayout(new fe(this))}_renderProperties(){super._renderProperties(),this._renderClickable(),this._renderCheckable(),this._renderChartType(),this._renderColorScheme(),this.updateChart({requestAnimation:!0,debounce:d.DEFAULT_DEBOUNCE_TIMEOUT})}_renderOnAttach(){var e;super._renderOnAttach();const t=this._updateChartOptsWhileNotAttached.splice(0);(e=this.chartRenderer)!==null&&e!==void 0&&e.isDetachSupported()||(this._updateChartRenderer(),t.forEach(i=>delete i.requestAnimation),t.push({requestAnimation:!1})),t.forEach(i=>this.updateChart(_().extend(!0,{},i,{debounce:!0})))}_remove(){this.chartRenderer&&this.chartRenderer.remove(!1),this.$container.remove(),this.$container=null}setData(e){this.setProperty("data",e),this.setCheckedItems(this.checkedItems)}_setData(e){e&&(e=_().extend({axes:[]},e)),this._setProperty("data",e)}_renderData(){this.updateChart({requestAnimation:!0,debounce:d.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:!0})}setConfig(e){let t={type:d.Type.PIE,options:{autoColor:!0,colorMode:Z.AUTO,colorScheme:o.colorSchemes.ColorSchemeId.DEFAULT,transparent:!1,maxSegments:5,adjustGridMaxMin:!0,clickable:!1,checkable:!1,animation:{duration:d.DEFAULT_ANIMATION_DURATION},plugins:{datalabels:{display:!1},tooltip:{enabled:!0},legend:{display:!0,clickable:!1,position:d.Position.RIGHT,pointsVisible:!0}}}};if(e=_().extend(!0,{},t,e),e.options.colorScheme=o.colorSchemes.ensureColorScheme(e.options.colorScheme),o.objects.equalsRecursive(this.config,e))return;let i=_().extend(!0,{},this.config);e.data?i.data=e.data:delete i.data;let a=(r,s,n)=>{if(!(!r||!s||!n)){if(!r.options||!r.options[n]){s.options&&delete s.options[n],s.options&&o.objects.isEmpty(s.options.scales)&&!(r.options&&r.options.scales)&&delete s.options.scales,o.objects.isEmpty(s.options)&&!r.options&&delete s.options;return}s.options[n]=r.options[n]}};if(a(e,i,"xLabelMap"),a(e,i,"yLabelMap"),o.objects.equalsRecursive(i,e)){this._setProperty("config",e),this.rendered&&this._renderConfig(!0),this.setCheckedItems(this.checkedItems);return}this.rendered&&this.config&&this.config.type&&this.$container.removeClass(this.config.type+"-chart"),this.setProperty("config",e),this.setCheckedItems(this.checkedItems),this._updateChartRenderer()}_renderConfig(e){this._renderClickable(),this._renderCheckable(),this._renderChartType(),this._renderColorScheme(),this.updateChart({requestAnimation:!0,debounce:d.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:e})}setCheckedItems(e){this.setProperty("checkedItems",o.arrays.ensure(this._filterCheckedItems(e)))}_filterCheckedItems(e){if(!Array.isArray(e))return e;let t=[];this.data&&this.data.chartValueGroups?this.data.chartValueGroups.forEach(a=>t.push(a.values.length)):this.config&&this.config.data&&this.config.data.datasets.forEach(a=>t.push(a.data.length));let i=e.filter(a=>t[a.datasetIndex]&&a.dataIndex<t[a.datasetIndex]);return i.length<e.length?i:e}_renderCheckedItems(){this.chartRenderer&&this.chartRenderer.renderCheckedItems()}_renderEnabled(){this.updateChart()}_renderClickable(){this.$container.toggleClass("clickable",this.config.options.clickable)}_renderCheckable(){this.$container.toggleClass("checkable",this.config.options.checkable)}_renderChartType(){this.$container.addClass(this.config.type+"-chart")}_renderColorScheme(){o.colorSchemes.toggleColorSchemeClasses(this.$container,this.config.options.colorScheme)}updateChart(e){e=e||{},e.onlyUpdateData=e.onlyUpdateData&&this.chartRenderer&&this.chartRenderer.isDataUpdatable(),e.enforceRerender=!e.onlyUpdateData&&!e.onlyRefresh,this._updateChartTimeoutId&&(clearTimeout(this._updateChartTimeoutId),this._updateChartOpts&&(e.requestAnimation=e.requestAnimation||this._updateChartOpts.requestAnimation,e.onlyUpdateData=e.onlyUpdateData||this._updateChartOpts.onlyUpdateData,e.onlyRefresh=e.onlyRefresh||this._updateChartOpts.onlyRefresh,e.enforceRerender=e.enforceRerender||this._updateChartOpts.enforceRerender),this._updateChartTimeoutId=null,this._updateChartOpts=null);let t=a.bind(this);e.debounce===!0||typeof e.debounce=="number"?(this._updateChartOpts=e,typeof e.debounce=="number"?this._updateChartTimeoutId=setTimeout(t,e.debounce):this._updateChartTimeoutId=setTimeout(t)):t();function a(){if(this._updateChartTimeoutId=null,this._updateChartOpts=null,!this.$container||!this.$container.isAttached()){this._updateChartOptsWhileNotAttached.push(e);return}this._updatedOnce=!0,this.chartRenderer&&(e.enforceRerender?this.chartRenderer.remove(this.chartRenderer.shouldAnimateRemoveOnUpdate(e),r=>{this.removing||r||(this.chartRenderer.render(e.requestAnimation),this.trigger("chartRender"))}):e.onlyUpdateData?this.chartRenderer.updateData(e.requestAnimation):e.onlyRefresh&&this.chartRenderer.refresh())}}_resolveChartRenderer(){switch(this.config.type){case d.Type.FULFILLMENT:return new ge(this);case d.Type.SPEEDO:return new B(this);case d.Type.SALESFUNNEL:return new _e(this);case d.Type.VENN:return new Te(this);case d.Type.BAR:case d.Type.BAR_HORIZONTAL:case d.Type.LINE:case d.Type.COMBO_BAR_LINE:case d.Type.PIE:case d.Type.DOUGHNUT:case d.Type.POLAR_AREA:case d.Type.RADAR:case d.Type.BUBBLE:case d.Type.SCATTER:return new F(this)}return null}_updateChartRenderer(){this.chartRenderer&&this.chartRenderer.remove(),this.setProperty("chartRenderer",this._resolveChartRenderer())}handleValueClick(e,t){if(this.config.options.checkable){let i=[...this.checkedItems],a=i.filter(r=>r.datasetIndex===e.datasetIndex&&r.dataIndex===e.dataIndex)[0];a?o.arrays.remove(i,a):i.push(e),this.setCheckedItems(i)}this.trigger("valueClick",{data:e,originalEvent:t})}}I(d,"Type",{PIE:"pie",LINE:"line",BAR:"bar",BAR_HORIZONTAL:"horizontalBar",COMBO_BAR_LINE:"comboBarLine",FULFILLMENT:"fulfillment",SPEEDO:"speedo",SALESFUNNEL:"salesfunnel",VENN:"venn",DOUGHNUT:"doughnut",POLAR_AREA:"polarArea",RADAR:"radar",BUBBLE:"bubble",SCATTER:"scatter"}),I(d,"Position",{TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center"}),I(d,"DEFAULT_ANIMATION_DURATION",600),I(d,"DEFAULT_DEBOUNCE_TIMEOUT",100);var Z;(function(l){l.AUTO="auto",l.DATASET="dataset",l.DATA="data"})(Z||(Z={}));class De extends o.ModelAdapter{_onWidgetValueClick(e){this._send("valueClick",e.data)}_onWidgetEvent(e){e.type==="valueClick"?this._onWidgetValueClick(e):super._onWidgetEvent(e)}}function Ue(l,e,t){return(e=We(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function We(l){var e=ze(l,"string");return typeof e=="symbol"?e:e+""}function ze(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var i=t.call(l,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class fe extends o.AbstractLayout{constructor(e){super(),Ue(this,"chart",void 0),this.chart=e}layout(e){var t;let i={requestAnimation:!0,debounce:d.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:!0};if((!this.chart.session.ready||this.chart._updatedOnce)&&(i.requestAnimation=!1),this.chart.session.ready||(i.debounce=!1),(t=this.chart.findParent(o.Tile))!==null&&t!==void 0&&t.$container.hasClass("dragged")&&(i.debounce=!1),this.chart.chartRenderer instanceof F){var a;(a=this.chart.chartRenderer.chartJs)===null||a===void 0||a.resize()}this.chart.updateChart(i)}}function ne(l,e,t){return(e=Xe(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Xe(l){var e=Ye(l,"string");return typeof e=="symbol"?e:e+""}function Ye(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var i=t.call(l,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class he extends o.PropertyEventEmitter{constructor(e){super(),ne(this,"chart",void 0),ne(this,"session",void 0),ne(this,"rendering",void 0),ne(this,"rendered",void 0),ne(this,"animationDuration",void 0),ne(this,"firstOpaqueBackgroundColor",void 0),this.chart=e,this.session=e.session,this.rendering=!1,this.rendered=!1,this.animationDuration=0,this.firstOpaqueBackgroundColor=""}validate(){return this._validateChartData()?this._validate():!1}_validateChartData(){let e=this.chart&&this.chart.data;if(!e||!e.chartValueGroups||e.chartValueGroups.length===0)return!1;let t,i=0;for(t=0;t<e.chartValueGroups.length;t++){let a=e.chartValueGroups[t];if(!a.values)return!1;if(t===0)i=a.values.length;else if(a.values.length!==i)return!1;if(!this.chart.config.options.autoColor&&!o.arrays.ensure(a.colorHexValue).length&&!a.cssClass)return!1}for(t=0;t<e.axes.length;t++)if(e.axes[t].length!==i)return!1;return!0}_validate(){return!0}render(e){if(!this.validate()||!this.chart.rendered)return;const t=this.chart.config.options.animation.duration;this.setAnimationDuration(e?t:0),this.rendering=!0,this._render(),this.rendering=!1,this.rendered=!0,this.setAnimationDuration(t)}_render(){}renderCheckedItems(){this.rendered&&this._renderCheckedItems()}_renderCheckedItems(){}updateData(e){if(!this.rendered){this.render(e);return}if(!this.validate()||!this.isDataUpdatable())return;const t=this.chart.config.options.animation.duration;this.setAnimationDuration(e?t:0),this._updateData(),this.setAnimationDuration(t)}_updateData(){}isDataUpdatable(){return!1}isDetachSupported(){return!0}refresh(){this.rendered&&this.remove(!1),this.render(!1)}setAnimationDuration(e){this.setProperty("animationDuration",e)&&this.rendered&&this._renderAnimationDuration()}_setAnimationDuration(e){this._setProperty("animationDuration",e)}_renderAnimationDuration(){}remove(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=arguments.length>1?arguments[1]:void 0;const i=this.chart.config.options.animation.duration;this.setAnimationDuration(e&&i),this.animationDuration&&this.rendered?this._removeAnimated(t):this._remove(t),this.setAnimationDuration(i)}_remove(e){this.rendered=!1,e&&e()}_removeAnimated(e){this._remove(e)}shouldAnimateRemoveOnUpdate(e){return e.requestAnimation}}function w(l,e,t){return(e=Je(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Je(l){var e=qe(l,"string");return typeof e=="symbol"?e:e+""}function qe(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var i=t.call(l,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class P extends he{constructor(e){super(e),w(this,"chartBox",void 0),w(this,"clipId",void 0),w(this,"maskId",void 0),w(this,"suppressLegendBox",void 0),w(this,"height",void 0),w(this,"width",void 0),w(this,"chartAnimationStopping",void 0),w(this,"$svg",void 0),this.chartBox=null,this.clipId="Clip-"+o.ObjectFactory.get().createUniqueId(),this.maskId="Mask-"+o.ObjectFactory.get().createUniqueId(),this.suppressLegendBox=!1}_render(){this.$svg||(this.$svg=this.chart.$container.appendSVG("svg","chart-svg"),o.aria.role(this.$svg,"img"),this.linkChartWithFieldLabel(this.$svg)),this.firstOpaqueBackgroundColor=o.styles.getFirstOpaqueBackgroundColor(this.$svg),this.height=this.$svg.height(),this.width=this.$svg.width(),this._initChartBox(),this._useFontSizeBig()?this.$svg.addClass(P.FONT_SIZE_BIG):this._useFontSizeMiddle()?this.$svg.addClass(P.FONT_SIZE_MIDDLE):this._useFontSizeSmall()?this.$svg.addClass(P.FONT_SIZE_SMALL):this._useFontSizeSmallest()&&this.$svg.addClass(P.FONT_SIZE_SMALLEST),this.$svg.isAttached()&&this._renderInternal()}linkChartWithFieldLabel(e){if(!e)return;let t=e.parents(".chart-field");if(t.length>0){let i=t.eq(0).children("label");i.length>0&&o.aria.linkElementWithLabel(e,i.eq(0))}}_renderInternal(){}_useFontSizeBig(){return!1}_useFontSizeMiddle(){return!1}_useFontSizeSmall(){return!1}_useFontSizeSmallest(){return!1}remove(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=arguments.length>1?arguments[1]:void 0;this.rendered&&!this.chartAnimationStopping&&(this.chartAnimationStopping=!0,this.$svg.children().stop(!0,!1),this.chartAnimationStopping=!1),super.remove(e,t)}_remove(e){this.rendered&&(this.$svg.children().stop(!0,!1),this.rendered&&(this.$svg.remove(),this.$svg=null)),this.rendered=!1,e&&e(this.chartAnimationStopping)}_createClickObject(e,t){return{xIndex:e,dataIndex:e,datasetIndex:t}}_measureText(e,t){let i=this.$svg.appendSVG("text",t).attr("x",0).attr("y",0).attr("visibility","hidden").text(e),a;try{a=i[0].getBBox()}catch{return{height:0,width:0}}return i.remove(),a}_renderLine(e,t,i,a,r){let s=this.$svg.appendSVG("line",r).attr("x1",e).attr("y1",t).attr("x2",i).attr("y2",a);return this.animationDuration&&s.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),s}_renderLineLabel(e,t,i,a,r){let s=this.$svg.appendSVG("text",a||"line-label").attr("x",e).attr("y",t).text(i);if(r){s.attr("mask","url(#"+this.maskId+")");let n=this.$svg.appendSVG("text",a?a+" background":"line-label-background").attr("x",e).attr("y",t).attr("clip-path","url(#"+this.clipId+")").text(i);s.data("$background",n),this.animationDuration&&n.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}return this.animationDuration&&s.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),s}_initChartBox(){this.chartBox={width:this.width,height:this.height,xOffset:0,yOffset:0,mX:function(){return this.xOffset+this.width/2},mY:function(){return this.yOffset+this.height/2}}}_createAnimationObjectWithTabIndexRemoval(e,t){return{step:function(i,a){try{e.bind(this)(i,a)}catch(r){throw _()(this).stop(!0,!1),r}},duration:t||d.DEFAULT_ANIMATION_DURATION,complete:function(){_()(this).removeAttr("tabindex")}}}_addClipping(e){let t=this.$svg.appendSVG("clipPath");t[0].id=this.clipId;let i=this.$svg.appendSVG("mask");i.appendSVG("rect").attr("x",0).attr("y",0).attr("width","100%").attr("height","100%").attr("fill","white"),i[0].id=this.maskId,this.chart.$container.find("."+e).each(function(a){this.id="ClipMask-"+o.ObjectFactory.get().createUniqueId(),t.appendSVG("use").attrXLINK("href","#"+this.id),i.appendSVG("use").attrXLINK("href","#"+this.id)})}_renderWireLegend(e,t,i,a){if(!this.chart.config.options.plugins.tooltip.enabled)return{detachFunc:()=>{},attachFunc:()=>{},removeFunc:()=>{}};let r={},s=5,n,u=0,h=17,p=h;a&&(n=this.$svg.appendSVG("rect","wire-legend-background-box").attr("opacity","1"));let c=t,f,m=0,g=0;if(c.h===-1?g=c.x2-2*s:g=this.width-c.x2-2*s,Array.isArray(e))for(let b=0;b<e.length;b++){let x=e.length-b-1,v=c.y2+c.v*s-h*x-s*x,T=this._renderLineLabel(c.x2+s,v,o.strings.truncateText(e[b],g,this._measureText.bind(this)),"",a);T.addClass(i),m=Math.max(m,T[0].getComputedTextLength()),b===0?f=T:f.data("lines")?f.data("lines").push(T):f.data("lines",[T])}else f=this._renderLineLabel(c.x2+s,c.y2+c.v*s,o.strings.truncateText(e,g,this._measureText.bind(this)),"",a),f.addClass(i),m=f[0].getComputedTextLength();if(u=m+2*s,t.autoPosition&&(c=t.posFunc.call(this,u,p),f.attr("x",c.x2+s),f.attr("y",c.y2+c.v*s)),c.h===-1?(f.attr("x",c.x2-s-m),f.css("text-anchor","left"),f.data("lines")&&f.data("lines").forEach(b=>{b.attr("x",c.x2-s-m),b.css("text-anchor","left")})):(f.attr("x",c.x2+s),f.css("text-anchor","right"),f.data("lines")&&f.data("lines").forEach(b=>{b.attr("x",c.x2+s),b.css("text-anchor","right")})),c.v===1)f.data("lines")&&f.data("lines").forEach((b,x)=>{b.attr("y",c.x2-s-m);let v=1+x;b.attr("y",c.y2+c.v*s+h*v+s*(v+1))}),f.attr("dy","0.7em");else if(f.data("lines")){let b=f.data("lines").length;f.attr("y",c.y2+c.v*s-h*b-s*b),f.data("lines").forEach((x,v)=>{b=f.data("lines").length-1-v,x.attr("y",c.y2+c.v*s-h*b-s*b)})}f.add(f.data("lines")).each((b,x)=>{let v=_()(x),T=v.data("$background");T&&(T.attr("x",v.attr("x")),T.attr("y",v.attr("y")),T.css("text-anchor",v.css("text-anchor")),T.attr("dy",v.attr("dy")))});let y=[];c.x1>0&&c.y1>0&&(y.push(this._renderLine(c.x1,c.y1,c.x2,c.y2,"label-line")),y.push(this._renderLine(c.x2,c.y2,c.x2+c.h*(m+2*s),c.y2,"label-line"))),f.data("wires",y);let C=this.$svg;return r.detachFunc=()=>{f.data("wires").forEach(b=>{b.detach()}),f.data("lines")&&f.data("lines").forEach(b=>{b.data("$background")&&C.append(b.data("$background")),b.detach()}),f.data("$background")&&f.data("$background").remove(),f.detach()},r.attachFunc=()=>{C.append(f),f.data("$background")&&C.append(f.data("$background")),C.append(f.data("wires")),f.data("lines")&&f.data("lines").forEach(b=>{C.append(b),b.data("$background")&&C.append(b.data("$background"))})},r.removeFunc=()=>{f.data("wires").forEach(b=>{b.remove()}),f.data("lines")&&f.data("lines").forEach(b=>{b.data("$background")&&b.data("$background").remove(),b().remove()}),f.data("$background")&&f.data("$background").remove(),f.remove()},r.$field=f,r}}w(P,"FONT_SIZE_SMALLEST","smallestFont"),w(P,"FONT_SIZE_SMALL","smallFont"),w(P,"FONT_SIZE_MIDDLE","middleFont"),w(P,"FONT_SIZE_BIG","bigFont");const me={getAdapter(l){return{formats:()=>Ke(l.locale),parse:(e,t)=>o.objects.isNullOrUndefined(e)?null:e instanceof Date?e.getTime():o.objects.isString(e)?o.objects.isString(t)&&o.strings.hasText(t)?(e=new o.DateFormat(l.locale,t).parse(e),e instanceof Date?e.getTime():null):(e=o.dates.parseJsonDate(e),e instanceof Date?e.getTime():null):null,format:(e,t)=>{if(t==="quarter")throw new Error('The time unit "quarter" is not supported for formatting.');return o.dates.format(new Date(e),l.locale,t)},add:(e,t,i)=>{let a=new Date(e);switch(i){case"millisecond":return o.dates.shiftTime(a,0,0,0,t).getTime();case"second":return o.dates.shiftTime(a,0,0,t,0).getTime();case"minute":return o.dates.shiftTime(a,0,t,0,0).getTime();case"hour":return o.dates.shiftTime(a,t,0,0,0).getTime();case"day":return o.dates.shift(a,0,0,t).getTime();case"week":return o.dates.shift(a,0,0,t*7).getTime();case"month":return o.dates.shift(a,0,t,0).getTime();case"quarter":return o.dates.shift(a,0,t*3,0).getTime();case"year":return o.dates.shift(a,t,0,0).getTime();default:return e}},diff:(e,t,i)=>{switch(i){case"millisecond":return e-t;case"second":return(e-t)/1e3;case"minute":return(e-t)/1e3/60;case"hour":return(e-t)/1e3/60/60;case"day":return o.dates.compareDays(new Date(e),new Date(t));case"week":return o.dates.compareDays(new Date(e),new Date(t))/7;case"month":return o.dates.compareMonths(new Date(e),new Date(t));case"quarter":return o.dates.compareMonths(new Date(e),new Date(t))/3;case"year":return new Date(e).getFullYear()-new Date(t).getFullYear();default:return 0}},startOf:(e,t,i)=>{let a=new Date(e);switch(t){case"second":return a.setMilliseconds(0);case"minute":return a.setSeconds(0,0);case"hour":return a.setMinutes(0,0,0);case"day":return a.setHours(0,0,0,0);case"week":return o.dates.firstDayOfWeek(a,0).getTime();case"isoWeek":return o.dates.firstDayOfWeek(a,i).getTime();case"month":return o.dates.trunc(a).setDate(0);case"quarter":return o.dates.trunc(a).setMonth(a.getMonth()%4,1);case"year":return o.dates.trunc(a).setMonth(0,1);default:return e}},endOf:(e,t)=>{let i=new Date(e);switch(t){case"second":return i.setMilliseconds(999);case"minute":return i.setSeconds(59,999);case"hour":return i.setMinutes(59,59,999);case"day":return i.setHours(23,59,59,999);case"week":{i.setHours(23,59,59,999);let a=o.dates.firstDayOfWeek(i,0);return a.setDate(a.getDate()+7)}case"month":return i.setHours(23,59,59,999),i.setDate(Me(i.getMonth(),i.getFullYear()));case"quarter":{i.setHours(23,59,59,999);let a=i.getMonth()%4+2;return i.setMonth(a,Me(a,i.getFullYear()))}case"year":return i.setHours(23,59,59,999),i.setMonth(11,31);default:return e}}}}};function Ke(l){return{datetime:l.dateFormatPatternDefault+" "+l.timeFormatPatternDefault,millisecond:"HH:mm:ss.SSS",second:"HH:mm:ss",minute:l.timeFormatPatternDefault,hour:l.timeFormatPatternDefault,day:l.dateFormatPatternDefault,week:"ww",month:"MMM yyyy",quarter:"qqq - yyyy",year:"yyyy"}}function Me(l,e){return l in[3,5,8,10]?30:l===1?o.dates.isLeapYear(e)?29:28:31}const k=Chart,Ze=ChartDataLabels;var ye=D.n(Ze);function A(l,e,t){return(e=Qe(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Qe(l){var e=et(l,"string");return typeof e=="symbol"?e:e+""}function et(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var i=t.call(l,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}k.Chart.register(ye()),_().extend(!0,k.Chart.defaults,{maintainAspectRatio:!1,elements:{line:{borderWidth:2},point:{radius:0,hitRadius:10,hoverRadius:7,hoverBorderWidth:2},arc:{borderWidth:1},bar:{borderWidth:1,borderSkipped:""}},plugins:{legend:{labels:{usePointStyle:!0,boxHeight:7}}}}),_().extend(!0,k.Chart.overrides,{line:{elements:{point:{borderWidth:2}}},scatter:{elements:{point:{radius:3}}},bubble:{layout:{autoPadding:!1}}});let Ee=!1;const tt=(1+Math.sqrt(5))/2;class F extends he{constructor(e){super(e),A(this,"chartJs",void 0),A(this,"onlyIntegers",void 0),A(this,"maxXAxesTicksHeight",void 0),A(this,"numSupportedColors",void 0),A(this,"colorSchemeCssClass",void 0),A(this,"minRadialChartDatalabelSpace",void 0),A(this,"resetDatasetAfterHover",void 0),A(this,"legendHoverDatasets",void 0),A(this,"removing",void 0),A(this,"$canvas",void 0),A(this,"_labelFormatter",void 0),A(this,"_xLabelFormatter",void 0),A(this,"_yLabelFormatter",void 0),A(this,"_xAxisFitter",void 0),A(this,"_yAxisFitter",void 0),A(this,"_radialChartDatalabelsDisplayHandler",void 0),A(this,"_radialChartDatalabelsFormatter",void 0),A(this,"_datalabelsFormatter",void 0),A(this,"_datalabelBackgroundColorHandler",void 0),A(this,"_legendLabelGenerator",void 0),A(this,"_clickHandler",void 0),A(this,"_hoverHandler",void 0),A(this,"_pointerHoverHandler",void 0),A(this,"_legendClickHandler",void 0),A(this,"_legendHoverHandler",void 0),A(this,"_legendPointerHoverHandler",void 0),A(this,"_legendLeaveHandler",void 0),A(this,"_legendPointerLeaveHandler",void 0),A(this,"_resizeHandler",void 0),A(this,"_tooltipTitleGenerator",void 0),A(this,"_tooltipItemsGenerator",void 0),A(this,"_tooltipLabelGenerator",void 0),A(this,"_tooltipLabelValueGenerator",void 0),A(this,"_tooltipLabelColorGenerator",void 0),A(this,"_tooltipRenderer",void 0),A(this,"_tooltip",void 0),A(this,"_tooltipTimeoutId",void 0),A(this,"_updatingDatalabels",void 0),this.chartJs=null,this.onlyIntegers=!0,this.maxXAxesTicksHeight=75,this.numSupportedColors=6,this.colorSchemeCssClass="",this.minRadialChartDatalabelSpace=25,this._labelFormatter=this._createLabelFormatter(this._formatLabel),this._xLabelFormatter=this._createLabelFormatter(this._formatXLabel),this._yLabelFormatter=this._createLabelFormatter(this._formatYLabel),this._xAxisFitter=this._fitXAxis.bind(this),this._yAxisFitter=this._fitYAxis.bind(this),this._radialChartDatalabelsDisplayHandler=this._displayDatalabelsOnRadialChart.bind(this),this._radialChartDatalabelsFormatter=this._formatDatalabelsOnRadialChart.bind(this),this._datalabelsFormatter=this._formatDatalabels.bind(this),this._datalabelBackgroundColorHandler=this._getBackgroundColorOfDataset.bind(this),this._legendLabelGenerator=this._generateLegendLabels.bind(this),this.resetDatasetAfterHover=!1,this._clickHandler=this._onClick.bind(this),this._hoverHandler=this._onHover.bind(this),this._pointerHoverHandler=this._onHoverPointer.bind(this),this.legendHoverDatasets=[],this._legendClickHandler=this._onLegendClick.bind(this),this._legendHoverHandler=this._onLegendHover.bind(this),this._legendPointerHoverHandler=this._onLegendHoverPointer.bind(this),this._legendLeaveHandler=this._onLegendLeave.bind(this),this._legendPointerLeaveHandler=this._onLegendLeavePointer.bind(this),this._resizeHandler=this._onResize.bind(this),this._tooltipTitleGenerator=this._generateTooltipTitle.bind(this),this._tooltipItemsGenerator=this._generateTooltipItems.bind(this),this._tooltipLabelGenerator=this._generateTooltipLabel.bind(this),this._tooltipLabelValueGenerator=this._generateTooltipLabelValue.bind(this),this._tooltipLabelColorGenerator=this._generateTooltipLabelColor.bind(this),this._tooltipRenderer=this._renderTooltip.bind(this),this._tooltip=null,this._tooltipTimeoutId=null}_validateChartData(){let e=!0,t=this.chart&&this.chart.data;if((!t||!t.chartValueGroups||t.chartValueGroups.length===0||!t.axes)&&(e=!1),e&&o.scout.isOneOf(this.chart.config.type,d.Type.POLAR_AREA,d.Type.RADAR)){let r,s=0;for(r=0;r<t.chartValueGroups.length;r++){let n=t.chartValueGroups[r];n.values||(e=!1),r===0?s=n.values.length:n.values.length!==s&&(e=!1)}for(r=0;r<t.axes.length;r++)t.axes[r].length!==s&&(e=!1)}if(e)return!0;let i=!0,a=this.chart&&this.chart.config;if((!a||!a.data||!a.data.datasets||a.data.datasets.length===0)&&(i=!1),i&&o.scout.isOneOf(a.type,d.Type.POLAR_AREA,d.Type.RADAR)){let r,s=0;for(r=0;r<a.data.datasets.length;r++){let n=a.data.datasets[r];n.data||(i=!1),r===0?s=n.data.length:n.data.length!==s&&(i=!1)}}return i}_render(){this.$canvas||(this.$canvas=this.chart.$container.appendElement("<canvas>"),o.aria.hidden(this.$canvas,!0)),this.firstOpaqueBackgroundColor=o.styles.getFirstOpaqueBackgroundColor(this.$canvas),Ee||(k.Chart.defaults.font.family=this.$canvas.css("font-family"),k._adapters._date.override(me.getAdapter(this.chart.session)),Ee=!0);let e=_().extend(!0,{},this.chart.config);this._adjustConfig(e),this._renderChart(e)}_renderChart(e){this.chartJs&&this.chartJs.destroy(),e=_().extend(!0,{},e,{options:{animation:{}}},e),e.options.animation.duration=this.animationDuration,this.chartJs=new k.Chart(this.$canvas[0].getContext("2d"),e),this._adjustSize(this.chartJs.config,this.chartJs.chartArea,{isDatasetVisible:t=>this.chartJs.getDatasetMeta(t).visible}),this.refresh()}_updateData(){if(!this.chartJs)return;let e=_().extend(!0,{},this.chart.config);this._adjustConfig(e);let t=this.chartJs.config.data,i=e.data,a=(h,p,c,f)=>{if(!h||!p||!c)return;if(!p[c]){let y=h[c];(y||f)&&(p[c]=y);return}if(!h[c]){if(f){p[c]=void 0;return}if(Array.isArray(p[c])){p[c].splice(0,p[c].length);return}p[c]=void 0;return}if(!Array.isArray(h[c])||!Array.isArray(p[c])){p[c]=h[c];return}for(let y=0;y<Math.min(h[c].length,p[c].length);y++)p[c][y]=h[c][y];let m=p[c].length,g=h[c].length;m>g?p[c].splice(g,m-g):m<g&&p[c].push(...h[c].splice(m))},r=(h,p)=>o.arrays.find(h,c=>c.datasetId===p),s=(h,p)=>o.arrays.findIndex(h,c=>c.datasetId===p);if(t&&i){a(i,t,"labels"),t.datasets||(t.datasets=[]),i.datasets||(i.datasets=[]),i.datasets.every(h=>o.objects.isNullOrUndefined(h.datasetId))&&(i.datasets.forEach((h,p)=>{h.datasetId=""+p}),t.datasets.forEach((h,p)=>{h.datasetId=""+p})),t.datasets.forEach(h=>{let p=r(i.datasets,h.datasetId);p&&(h.label=p.label,h.type=p.type,a(p,h,"data"),a(p,h,"backgroundColor",!0),a(p,h,"borderColor",!0),a(p,h,"hoverBackgroundColor",!0),a(p,h,"hoverBorderColor",!0),a(p,h,"legendColor",!0),a(p,h,"pointBackgroundColor",!0),a(p,h,"pointHoverBackgroundColor",!0),a(p,h,"pointBorderColor",!0),a(p,h,"pointHoverBorderColor",!0),a(p,h,"uncheckedBackgroundColor",!0),a(p,h,"uncheckedHoverBackgroundColor",!0),a(p,h,"checkedBackgroundColor",!0),a(p,h,"checkedHoverBackgroundColor",!0),a(p,h,"uncheckedPointBackgroundColor",!0),a(p,h,"uncheckedPointHoverBackgroundColor",!0),a(p,h,"checkedPointBackgroundColor",!0),a(p,h,"checkedPointHoverBackgroundColor",!0),a(p,h,"lineTension",!0),a(p,h,"pointRadius",!0),a(p,h,"uncheckedPointRadius",!0),a(p,h,"checkedPointRadius",!0),this._adjustDatasetBorderWidths(h))});for(let h=t.datasets.length-1;h>=0;h--){let p=t.datasets[h].datasetId;(o.objects.isNullOrUndefined(p)||s(i.datasets,p)===-1)&&t.datasets.splice(h,1)}t.datasets.sort((h,p)=>s(i.datasets,h.datasetId)-s(i.datasets,p.datasetId)),i.datasets.forEach((h,p)=>{let c=t.datasets[p];c&&c.datasetId&&h.datasetId===c.datasetId||t.datasets.splice(p,0,h)})}else this.chartJs.config.data=i;a(e.options,this.chartJs.config.options,"xLabelMap",!0),a(e.options,this.chartJs.config.options,"yLabelMap",!0),_().extend(!0,this.chartJs.config,{options:{animation:{duration:this.animationDuration}}});let n=this.chartJs.config.options.scales||{};[n.x||{},n.y||{},n.yDiffType||{},n.r||{}].forEach(h=>{(h.ticks||{}).stepSize=void 0}),this.refresh(),this._adjustSize(this.chartJs.config,this.chartJs.chartArea,{isDatasetVisible:h=>this.chartJs.getDatasetMeta(h).visible}),this.refresh()}isDataUpdatable(){return!0}isDetachSupported(){return!1}refresh(){this.chartJs?this.chartJs.update():super.refresh()}_renderAnimationDuration(){this.chartJs&&(_().extend(!0,this.chartJs.config,{options:{animation:{duration:this.animationDuration}}}),this.refresh())}_renderCheckedItems(){this.chartJs&&this._checkItems(this.chartJs.config)&&this.refresh()}_checkItems(e){if(!e||!e.data)return!1;let t=(a,r,s)=>{if(Array.isArray(a)&&Array.isArray(r)){let n=0;return o.arrays.ensure(s).filter(u=>!isNaN(u)&&u<Math.min(a.length,r.length)).forEach(u=>{a[u]!==r[u]&&(a[u]=r[u],n++)}),n}return 0},i=0;return e.data.datasets.forEach((a,r)=>{let s=this.chart.checkedItems.filter(u=>u.datasetIndex===r).map(u=>u.dataIndex),n=o.arrays.init(a.data.length,null).map((u,h)=>h);o.arrays.removeAll(n,s),i=i+t(a.backgroundColor,a.checkedBackgroundColor,s)+t(a.hoverBackgroundColor,a.checkedHoverBackgroundColor,s)+t(a.pointBackgroundColor,a.checkedPointBackgroundColor,s)+t(a.pointHoverBackgroundColor,a.checkedPointHoverBackgroundColor,s)+t(a.pointRadius,a.checkedPointRadius,s)+t(a.backgroundColor,a.uncheckedBackgroundColor,n)+t(a.hoverBackgroundColor,a.uncheckedHoverBackgroundColor,n)+t(a.pointBackgroundColor,a.uncheckedPointBackgroundColor,n)+t(a.pointHoverBackgroundColor,a.uncheckedPointHoverBackgroundColor,n)+t(a.pointRadius,a.uncheckedPointRadius,n),this._adjustDatasetBorderWidths(a)}),0<i}stopAnimations(){this.chartJs&&this.chartJs.stop()}_adjustConfig(e){!e||!e.type||(this._adjustType(e),this.chart.data&&this._computeDatasets(this.chart.data,e),this._adjustData(e),this._adjustLegend(e),this._adjustTooltip(e),this._adjustGrid(e),this._adjustPlugins(e),this._adjustColors(e),this._adjustClickHandler(e),this._adjustResizeHandler(e))}_adjustType(e){if(e.type===d.Type.COMBO_BAR_LINE){e.type=d.Type.BAR;let t=(e.options||{}).scaleLabelByTypeMap;t&&(t[d.Type.BAR]=t[d.Type.COMBO_BAR_LINE])}else this._isHorizontalBar(e)&&(e.type=d.Type.BAR,e.options=_().extend(!0,{},e.options,{indexAxis:"y"}))}_computeDatasets(e,t){let i=[],a=[],r=(n,u)=>{_().isEmptyObject(u)||(t.options[n]=u)};(e.axes[0]||[]).forEach(n=>i.push(n.label));let s=this._isHorizontalBar(t);r(s?"yLabelMap":"xLabelMap",this._computeLabelMap(e.axes[0])),r(s?"xLabelMap":"yLabelMap",this._computeLabelMap(e.axes[1])),e.chartValueGroups.forEach(n=>a.push({type:n.type,label:n.groupName,data:_().extend(!0,[],n.values)})),t.data={labels:i,datasets:a}}_isHorizontalBar(e){return e&&(e.type===d.Type.BAR_HORIZONTAL||e.type===d.Type.BAR&&e.options&&e.options.indexAxis==="y")}_computeLabelMap(e){let t={};return(e||[]).forEach((i,a)=>{t[a]=i.label}),t}_adjustData(e){!e||!e.data||!e.type||(this._adjustBarBorderWidth(e),this._adjustMaxSegments(e),this._adjustBubbleRadii(e),this._adjustOnlyIntegers(e))}_adjustBarBorderWidth(e){!e||!e.data||!e.type||!o.scout.isOneOf(e.type,d.Type.BAR)||e.data.datasets.forEach(t=>{(t.type||d.Type.BAR)===d.Type.BAR&&(t.borderWidth=t.borderWidth||1,t.hoverBorderWidth=t.hoverBorderWidth||2,this._adjustDatasetBorderWidths(t))})}_adjustDatasetBorderWidths(e){this._adjustDatasetBorderWidth(e),this._adjustDatasetBorderWidth(e,!0)}_adjustDatasetBorderWidth(e,t){if(!e)return;let i=t?"hoverBorderWidth":"borderWidth",a=t?"hoverBorderWidthBackup":"borderWidthBackup",r=t?"hoverBackgroundColor":"backgroundColor",s=t?"hoverBorderColor":"borderColor";if(e[a]&&(e[i]=e[a],delete e[a]),!e[i]||o.objects.isFunction(e[i]))return;let n=Array.isArray(e[i]),u=Array.isArray(e[r]),h=Array.isArray(e[s]);if(!(n||u||h)&&e[r]===e[s]){e[a]=e[i],e[i]=0;return}let c=(e.data||[]).length;n?e[i].length<c&&e[i].push(...o.arrays.init(c-e[i].length,e[i][0])):e[i]=o.arrays.init(c,e[i]);let f=e[i],m=f.length,g=o.arrays.init(m,null);for(let y=0;y<m;y++){let C=u?e[r][y]:e[r],b=h?e[s][y]:e[s];g[y]=f[y],C===b&&(f[y]=0)}o.arrays.equals(f,g)||(e[a]=g)}_adjustMaxSegments(e){if(!e||!e.data||!e.type||!o.scout.isOneOf(e.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA,d.Type.RADAR))return;let t=e.options.maxSegments;if(!(t&&e.data.datasets.length&&t<e.data.datasets[0].data.length))return;e.data.datasets.forEach(a=>{let r=a.data.slice(0,t);r[t-1]=a.data.slice(t-1,a.data.length).reduce((s,n)=>s+n,0),a.data=r});let i=e.data.labels.slice(0,t);i[t-1]=this.chart.session.text("ui.OtherValues"),e.data.labels=i,e.data.maxSegmentsExceeded=!0}_isMaxSegmentsExceeded(e,t){return!o.scout.isOneOf(e.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA,d.Type.RADAR)||e.options.otherSegmentClickable||!e.data.maxSegmentsExceeded||!e.options.maxSegments?!1:e.options.maxSegments-1<=t}_adjustBubbleRadii(e){!e||!e.data||!e.type||e.type!==d.Type.BUBBLE||e.data.datasets.forEach(t=>t.data.forEach(i=>{isNaN(i.r)||(i.z=Math.pow(i.r,2)),i.r=1}))}_adjustOnlyIntegers(e){this.onlyIntegers=!0,!(!e||!e.data||!e.type)&&(o.scout.isOneOf(e.type,d.Type.BUBBLE,d.Type.SCATTER)?this.onlyIntegers=e.data.datasets.every(t=>t.data.every(i=>o.numbers.isInteger(i.x)&&o.numbers.isInteger(i.y))):this.onlyIntegers=e.data.datasets.every(t=>t.data.every(i=>o.numbers.isInteger(i))))}_adjustLegend(e){!e||!e.type||!e.options||(e.options=_().extend(!0,{},e.options,{plugins:{legend:{labels:{generateLabels:this._legendLabelGenerator}}}}),e.options.plugins.legend.pointsVisible||(e.options.plugins.legend.labels.boxWidth=0))}_adjustTooltip(e){if(!e)return;e.options=_().extend(!0,{},{plugins:{tooltip:{callbacks:{title:this._tooltipTitleGenerator,items:this._tooltipItemsGenerator,label:this._tooltipLabelGenerator,labelValue:this._tooltipLabelValueGenerator,labelColor:this._tooltipLabelColorGenerator}}}},e.options);let t=e.options.plugins.tooltip;t.enabled&&(t.enabled=!1,t.external=this._tooltipRenderer)}_generateTooltipTitle(e){if(!e||!e.length)return"";let t=e[0],i=t.chart,a=i.config,r=t.dataset,s=[];if(o.scout.isOneOf(a.type,d.Type.BUBBLE)){let n=a.options.scales.x,u=a.options.scales.y,h=this._getAxisLabels(a),p=n.ticks.callback(r.data[t.dataIndex].x,null,null);p&&s.push(this._createTooltipAttribute(h.x,o.strings.encode(p),!0));let c=u.ticks.callback(r.data[t.dataIndex].y,null,null);c&&s.push(this._createTooltipAttribute(h.y,o.strings.encode(c),!0))}else if(!o.scout.isOneOf(a.type,d.Type.SCATTER)){let n=i.data.labels[t.dataIndex];s.push(this._createTooltipAttribute(a.options.reformatLabels?this._formatLabel(n):n,"",!0))}return s}_getAxisLabels(e){let t=e.options.scales.x.title.text,i=e.options.scales.y.title.text;return t=this._resolveAxisLabel(t,F.ARROW_LEFT_RIGHT),i=this._resolveAxisLabel(i,"&nbsp;"+F.ARROW_UP_DOWN+"&nbsp;"),{x:t,y:i}}_resolveAxisLabel(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return o.objects.isFunction(e)&&(e=e(),e=o.objects.isString(e)?e:""),e?o.strings.encode(e):t}_generateTooltipItems(e,t,i,a){if(!e||!e.length)return"";let r=e[0],s=r.chart,n=s.config,u=!1,h=!1,p="";if(e.forEach(c=>{let{label:f,labelValue:m,labelColor:g}=this._getItemDetails(c,t,i,a);if(o.scout.isOneOf(n.type,d.Type.SCATTER)){let{x:y,y:C}=m;u||(u=o.objects.isString(y)),h||(h=o.objects.isString(C)),p+=this._createTooltipScatterAttribute(f,y,C,!1,g)}else p+=this._createTooltipAttribute(f,m,!1,g)}),o.scout.isOneOf(n.type,d.Type.SCATTER)){let c="<table><tbody>",f=this._getAxisLabels(n);c+=this._createTooltipScatterAttribute("",u?f.x:"",h?f.y:"",!0),p=o.strings.box(c,p,"</tbody></table>")}return p}_getItemDetails(e,t,i,a){let r,s,n;return o.objects.isFunction(t)&&(r=t(e),r=o.objects.isString(r)?r:""),o.objects.isFunction(i)&&(s=i(e),s=o.objects.isString(s)||o.objects.isObject(s)?s:""),o.objects.isFunction(a)&&(n=a(e),n=o.objects.isObject(n)&&n.backgroundColor||""),{label:r,labelValue:s,labelColor:n}}_generateTooltipLabel(e){return o.strings.encode(e.dataset.label)}_generateTooltipLabelValue(e){let t=e.chart.config,i=e.dataset;return t.type===d.Type.BUBBLE?o.strings.encode(this._formatLabel(i.data[e.dataIndex].z)):t.type===d.Type.SCATTER?{x:o.strings.encode(this._formatXLabel(i.data[e.dataIndex].x)),y:o.strings.encode(this._formatYLabel(i.data[e.dataIndex].y))}:o.strings.encode(this._formatLabel(i.data[e.dataIndex]))}_generateTooltipLabelColor(e){let t=e.chart.config,i=e.dataset,a,r,s,n;o.scout.isOneOf(i.type||t.type,d.Type.LINE,d.Type.BAR,d.Type.BAR_HORIZONTAL,d.Type.RADAR,d.Type.BUBBLE,d.Type.SCATTER)&&(s=i.borderColor,a=Array.isArray(i.legendColor)?i.legendColor[e.dataIndex]:i.legendColor,n=e.datasetIndex),o.scout.isOneOf(t.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(a=Array.isArray(i.legendColor)?i.legendColor[e.dataIndex]:i.legendColor,r=Array.isArray(i.backgroundColor)?i.backgroundColor[e.dataIndex]:i.backgroundColor,r=this._adjustColorOpacity(r,1),n=e.dataIndex),o.objects.isFunction(a)&&(a=a.call(e.chart,n));let u=a||r||s;if(!u||o.objects.isFunction(u)){let h;k.Chart.overrides[t.type]&&k.Chart.overrides[t.type].plugins&&k.Chart.overrides[t.type].plugins.tooltip&&k.Chart.overrides[t.type].plugins.tooltip.callbacks&&(h=k.Chart.overrides[t.type].plugins.tooltip.callbacks.labelColor),u=(h||k.Chart.defaults.plugins.tooltip.callbacks.labelColor).call(e.chart,e).backgroundColor}return{backgroundColor:u}}_createTooltipAttribute(e,t,i,a){return'<div class="'+(i?"attribute title":"attribute")+'">'+(a?'<div class="color" style="background-color:'+a+'"></div>':"")+(e?"<label>"+e+"</label>":"")+(t?'<div class="value">'+t+"</div>":"")+"</div>"}_createTooltipScatterAttribute(e,t,i,a,r){return'<tr class="'+(a?"attribute title":"attribute")+'"><td class="color-cell">'+(r?'<div class="color" style="background-color:'+r+'"></div>':"")+'</td><td class="label">'+e+"</td>"+(t?'<td class="value">'+t+"</td>":"")+(i?'<td class="value">'+i+"</td>":"")+"</tr>"}_renderTooltip(e){if(e.tooltip.opacity===0||e.tooltip.dataPoints.length<1){this._tooltipTimeoutId&&(clearTimeout(this._tooltipTimeoutId),this._tooltipTimeoutId=void 0),this._tooltip&&(this._tooltip.destroy(),this._tooltip=null);return}!!this._tooltip?this._renderTooltipLater(e):(clearTimeout(this._tooltipTimeoutId),this._tooltipTimeoutId=setTimeout(()=>this._renderTooltipLater(e),o.tooltips.DEFAULT_TOOLTIP_DELAY))}_renderTooltipLater(e){if(!this.rendered||this.removing)return;let t=e.tooltip,i=t.dataPoints;if(i.length<1)return;let a=i[0];if(!a.chart.getDatasetMeta(a.datasetIndex).data[a.dataIndex])return;this._tooltip&&(this._tooltip.destroy(),this._tooltip=null);let s=t.options||{},n=s.callbacks||{},u=n.title,h=n.items,p=n.label,c=n.labelValue,f=n.labelColor,m="";o.objects.isFunction(u)&&(m+=o.arrays.ensure(u(i)).join("")),o.objects.isFunction(h)&&(m+=o.arrays.ensure(h(i,p,c,f)).join(""));let g=this._computeTooltipPositionAndOffset(a),y=new o.Point(t.caretX+g.offsetX,t.caretY+g.offsetY);this._tooltip=o.scout.create({objectType:o.Tooltip,parent:this.chart,$anchor:this.$canvas,text:m,htmlEnabled:!0,cssClass:o.strings.join(" ","chart-tooltip",s.cssClass),tooltipPosition:g.tooltipPosition,tooltipDirection:g.tooltipDirection,originProducer:v=>{const T=o.graphics.offsetBounds(v);return T.height=g.height,T},offsetProducer:v=>y}),this._tooltip.render(),this._tooltip.$container.css("pointer-events","none");let C=!1,b=(s.titleFont||{}).family;b&&(this._tooltip.$container.css("--chart-tooltip-font-family",b),C=!0);let x=0;this._tooltip.$container.find("label").each((v,T)=>{x=Math.max(x,o.graphics.prefSize(_()(T)).width)}),x>0&&(this._tooltip.$container.css("--chart-tooltip-label-width",Math.min(x,120)+"px"),C=!0),C&&this._tooltip.position()}_computeTooltipPositionAndOffset(e){let t="top",i="right",a=0,r=0,s=0,n=e.chart,u=e.datasetIndex,h=e.dataIndex,p=n.config,c=p.data.datasets,f=c[u],m=f.data[h];if(this._isHorizontalBar(p))o.objects.isObject(m)&&o.objects.isArray(m.x)&&m.x.length===2?i=(m.x[0]+m.x[1])/2<0?"left":"right":i=m<0?"left":"right";else if((f.type||p.type)===d.Type.BAR)t=m<0?"bottom":"top";else if(o.scout.isOneOf(p.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)){let g=n.getDatasetMeta(u).data[h].getProps(["startAngle","endAngle"]),y=g.startAngle,C=g.endAngle,b=(y+C)/2;t=0<=b&&b<Math.PI?"bottom":"top",i=-Math.PI/2<=b&&b<Math.PI/2?"right":"left"}else if(p.type===d.Type.RADAR){let y=n.getDatasetMeta(u).data[h].getProps(["angle"]).angle;t=0<=y&&y<Math.PI?"bottom":"top",i=-Math.PI/2<=y&&y<Math.PI/2?"right":"left"}else if(o.scout.isOneOf(p.type,d.Type.BUBBLE,d.Type.SCATTER)){let g=n.getDatasetMeta(u).data[h],y=n.chartArea,C=y.left+y.width/2;i=g.x<C?"left":"right"}if(this._isHorizontalBar(p)){let g=n.getDatasetMeta(u).data[h].getProps(["height","width"]);s=g.height;let y=g.width,C=y/(tt+1);r=-s/2,a=i==="left"?C:-C}else if(o.scout.isOneOf(p.type,d.Type.LINE,d.Type.BUBBLE,d.Type.SCATTER,d.Type.RADAR)||f.type===d.Type.LINE){let y=n.getDatasetMeta(u).data[h].options,C=y.hoverRadius+y.hoverBorderWidth;p.type===d.Type.BUBBLE&&(C+=m.r),s=2*C,r=-C}else if(o.scout.isOneOf(p.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)){let g=n.getDatasetMeta(u).data[h].getProps(["startAngle","endAngle","innerRadius","outerRadius"]),y=g.startAngle,C=g.endAngle,b=(y+C)/2,x=g.innerRadius,v=g.outerRadius,T=(v-x)/2;a=T*Math.cos(b),r=T*Math.sin(b)}return{tooltipPosition:t,tooltipDirection:i,offsetX:a,offsetY:r,height:s}}_adjustGrid(e){e&&(e.options=_().extend(!0,{},e.options),this._adjustScalesR(e),this._adjustScalesXY(e))}_adjustScalesR(e){if(!e||!e.type||!e.options)return;o.scout.isOneOf(e.type,d.Type.POLAR_AREA,d.Type.RADAR)&&(e.options=_().extend(!0,{},{scales:{r:{}}},e.options));let t=e.options,i=t?t.scales:{};i&&i.r&&(i.r=_().extend(!0,{},{minSpaceBetweenTicks:35,beginAtZero:!0,angleLines:{display:!1},ticks:{callback:this._labelFormatter},pointLabels:{callback:this._labelFormatter,font:{size:k.Chart.defaults.font.size}}},i.r))}_adjustScalesXY(e){!e||!e.type||!e.options||(o.scout.isOneOf(e.type,d.Type.BAR,d.Type.LINE,d.Type.BUBBLE)?e.options=_().extend(!0,{},{scales:{x:{minSpaceBetweenTicks:150},y:{minSpaceBetweenTicks:35}}},e.options):o.scout.isOneOf(e.type,d.Type.SCATTER)&&(e.options=_().extend(!0,{},{scales:{x:{minSpaceBetweenTicks:35,ticks:{padding:10}},y:{minSpaceBetweenTicks:35,ticks:{padding:10}}}},e.options)),this._adjustXAxis(e),this._adjustYAxis(e))}_adjustXAxis(e){if(!e||!e.type||!e.options||!e.options.scales||!e.options.scales.x)return;let t=e.type,i=e.options.scales;this._isHorizontalBar(e)||o.scout.isOneOf(t,d.Type.BUBBLE,d.Type.SCATTER)?i.x=_().extend(!0,{},{beginAtZero:this._isHorizontalBar(e),offset:t===d.Type.BUBBLE,grid:{drawTicks:!1},border:{display:!1},ticks:{padding:5}},i.x):i.x=_().extend(!0,{},{offset:!0,grid:{display:!1},border:{display:!1}},i.x),(this._isHorizontalBar(e)||o.scout.isOneOf(t,d.Type.BUBBLE,d.Type.SCATTER)||e.options.reformatLabels)&&(i.x=_().extend(!0,{},{ticks:{callback:this._xLabelFormatter}},i.x)),i.x.afterCalculateLabelRotation=this._xAxisFitter}_adjustYAxis(e){if(!e||!e.type||!e.options||!e.options.scales||!e.options.scales.y)return;let t=e.type,i=e.options.scales;this._isHorizontalBar(e)?i.y=_().extend(!0,{},{grid:{display:!1},border:{display:!1}},i.y):i.y=_().extend(!0,{},{beginAtZero:!o.scout.isOneOf(t,d.Type.BUBBLE,d.Type.SCATTER),grid:{drawTicks:!1},border:{display:!1},ticks:{padding:5}},i.y),(!this._isHorizontalBar(e)||e.options.reformatLabels)&&(i.y=_().extend(!0,{},{ticks:{callback:this._yLabelFormatter}},i.y)),i.y.afterFit=this._yAxisFitter}_adjustPlugins(e){this._adjustPluginsDatalabels(e)}_adjustPluginsDatalabels(e){if(!e||!e.type||!e.options||!e.options.plugins||!e.options.plugins.datalabels||!e.options.plugins.datalabels.display)return;let t=e.options.plugins;if(o.scout.isOneOf(e.type,d.Type.PIE,d.Type.DOUGHNUT)){t.datalabels=_().extend(!0,{},{formatter:this._radialChartDatalabelsFormatter},t.datalabels),t.datalabels.display=this._radialChartDatalabelsDisplayHandler,this._updatingDatalabels=!1;let i=e.options.animation||{},a=i.onProgress,r=i.onComplete,s=u=>{if(this._updatingDatalabels)return;this._updatingDatalabels=!0;let h=u.chart,p=h.getSortedVisibleDatasetMetas(),c=[...h.getActiveElements()],f=[];p.forEach((m,g)=>{m.data.forEach((y,C)=>{let b=o.arrays.findIndex(c,x=>x.datasetIndex===g&&x.index===C);b>0?c.splice(b,1):f.push({datasetIndex:g,index:C,element:y})})}),h["$"+ye().id]._actives=f,ye().afterEvent(h,null,null),this._updatingDatalabels=!1},n=(u,h)=>{s(u),h&&h(u)};e.options.animation=_().extend(!0,{},e.options.animation,{onProgress:u=>n(u,a),onComplete:u=>n(u,r)})}else o.scout.isOneOf(e.type,d.Type.BAR,d.Type.LINE,d.Type.POLAR_AREA,d.Type.RADAR,d.Type.BUBBLE)?(t.datalabels=_().extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:3},t.datalabels),t.datalabels.display="auto"):o.scout.isOneOf(e.type,d.Type.SCATTER)&&(t.datalabels=_().extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:3,anchor:"end",align:"top",offset:3},t.datalabels),t.datalabels.display="auto");if(e.options.reformatLabels){let i=a=>(r,s)=>{let n=a.call(s.chart,r,s);return this._formatLabel(n)};e.data&&e.data.datasets.forEach(r=>{r.datalabels&&r.datalabels.formatter&&(r.datalabels.formatter=i(r.datalabels.formatter))}),t.datalabels.formatter&&(t.datalabels.formatter=i(t.datalabels.formatter))}t.datalabels=_().extend(!0,{},{formatter:this._datalabelsFormatter},t.datalabels)}_getNumberFormatter(){var e;return(e=this.chartJs)===null||e===void 0||(e=e.config)===null||e===void 0||(e=e.options)===null||e===void 0?void 0:e.numberFormatter}_createLabelFormatter(e){const t=this;return function(i){return e.call(t,i,this)}}_formatLabel(e,t){return e=this._formatCategory(e,t),this._formatLabelMap(e,null,this._getNumberFormatter())}_formatXLabel(e,t){return e=this._formatCategory(e,t),this._formatLabelMap(e,this._getXLabelMap(),this._getNumberFormatter())}_formatYLabel(e,t){return e=this._formatCategory(e,t),this._formatLabelMap(e,this._getYLabelMap(),this._getNumberFormatter())}_formatCategory(e,t){return t instanceof k.CategoryScale&&o.numbers.isNumber(e)?t.getLabelForValue(e):e}_getXLabelMap(){return this._getLabelMap("xLabelMap")}_getYLabelMap(){return this._getLabelMap("yLabelMap")}_getLabelMap(e){if(this.chartJs&&this.chartJs.config&&this.chartJs.config.options)return this.chartJs.config.options[e]}_formatLabelMap(e,t,i){return t?t[e]:isNaN(e)||typeof e=="string"?""+e:i?i(e,this._formatNumberLabel.bind(this)):this._formatNumberLabel(e)}_formatNumberLabel(e){if(isNaN(e))return""+e;let t=Math.abs(e),i="";if(t>=1e6){t=t/1e6,i=" "+this.chart.session.text("ui.Mio");let a=[this.chart.session.text("ui.Mrd"),this.chart.session.text("ui.Bio"),this.chart.session.text("ui.Brd"),this.chart.session.text("ui.Tri"),this.chart.session.text("ui.Trd")];for(let r=0;r<a.length&&t>=1e3;r++)t=t/1e3,i=" "+a[r]}return this.session.locale.decimalFormat.format(Math.sign(e)*t)+i}_fitXAxis(e){if(!e||e.labelRotation===0)return;let t=this.maxXAxesTicksHeight,i=k.Chart.defaults.font,a=k.Chart.defaults.scale.ticks,r=a.font||{},s,n;if(this.chartJs){let f=this.chartJs.chartArea,m=Math.abs(f.top-f.bottom);t=Math.min