@eclipse-scout/chart 25.1.3 → 25.1.12

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.
@@ -1,3 +1,3 @@
1
- import*as R from"@eclipse-scout/core";import*as ve from"chart.js";import"chart.js/auto";import*as We from"chartjs-plugin-datalabels";var E={};E.n=l=>{var e=l&&l.__esModule?()=>l.default:()=>l;return E.d(e,{a:e}),e},E.d=(l,e)=>{for(var t in e)E.o(e,t)&&!E.o(l,t)&&Object.defineProperty(l,t,{enumerable:!0,get:e[t]})},E.o=(l,e)=>Object.prototype.hasOwnProperty.call(l,e),E.r=l=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})};var L={};E.r(L),E.d(L,{AbstractChartRenderer:()=>pe,AbstractSvgChartRenderer:()=>M,Chart:()=>d,ChartAdapter:()=>Me,ChartColorMode:()=>se,ChartField:()=>He,ChartFieldAdapter:()=>Ne,ChartFieldTile:()=>Fe,ChartFieldTileAdapter:()=>Ve,ChartJsRenderer:()=>J,ChartLayout:()=>Ae,ChartTableControl:()=>oe,ChartTableControlAdapter:()=>je,ChartTableControlLayout:()=>Ee,ChartTableUserFilter:()=>Q,FulfillmentChartRenderer:()=>Be,SalesfunnelChartRenderer:()=>Se,SpeedoChartRenderer:()=>k,VennAsync3Calculator:()=>Oe,VennChartRenderer:()=>De,VennCircle:()=>Z,VennCircleHelper:()=>Pe,chartJsDateAdapter:()=>ke,default:()=>Ge});var ce={};E.r(ce),E.d(ce,{AbstractChartRenderer:()=>pe,AbstractSvgChartRenderer:()=>M,Chart:()=>d,ChartAdapter:()=>Me,ChartColorMode:()=>se,ChartField:()=>He,ChartFieldAdapter:()=>Ne,ChartFieldTile:()=>Fe,ChartFieldTileAdapter:()=>Ve,ChartJsRenderer:()=>J,ChartLayout:()=>Ae,ChartTableControl:()=>oe,ChartTableControlAdapter:()=>je,ChartTableControlLayout:()=>Ee,ChartTableUserFilter:()=>Q,FulfillmentChartRenderer:()=>Be,SalesfunnelChartRenderer:()=>Se,SpeedoChartRenderer:()=>k,VennAsync3Calculator:()=>Oe,VennChartRenderer:()=>De,VennCircle:()=>Z,VennCircleHelper:()=>Pe,chartJsDateAdapter:()=>ke,default:()=>Ge});var ze=l=>{var e={};return E.d(e,l),e},lr=l=>()=>l;const o=ze({AbstractLayout:()=>R.AbstractLayout,DateColumn:()=>R.DateColumn,DateFormat:()=>R.DateFormat,FormField:()=>R.FormField,FormFieldAdapter:()=>R.FormFieldAdapter,FormFieldTile:()=>R.FormFieldTile,FormFieldTileAdapter:()=>R.FormFieldTileAdapter,HtmlComponent:()=>R.HtmlComponent,Icon:()=>R.Icon,ModelAdapter:()=>R.ModelAdapter,NumberColumn:()=>R.NumberColumn,ObjectFactory:()=>R.ObjectFactory,Point:()=>R.Point,PropertyEventEmitter:()=>R.PropertyEventEmitter,RoundingMode:()=>R.RoundingMode,TableControl:()=>R.TableControl,TableControlAdapter:()=>R.TableControlAdapter,TableMatrix:()=>R.TableMatrix,TableUserFilter:()=>R.TableUserFilter,Tile:()=>R.Tile,Tooltip:()=>R.Tooltip,Widget:()=>R.Widget,aria:()=>R.aria,arrays:()=>R.arrays,colorSchemes:()=>R.colorSchemes,dates:()=>R.dates,graphics:()=>R.graphics,icons:()=>R.icons,numbers:()=>R.numbers,objects:()=>R.objects,scout:()=>R.scout,scrollbars:()=>R.scrollbars,strings:()=>R.strings,styles:()=>R.styles,tooltips:()=>R.tooltips}),Xe=require("jquery");var g=E.n(Xe);function N(l,e,t){return(e=Ye(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Ye(l){var e=Je(l,"string");return typeof e=="symbol"?e:e+""}function Je(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class d extends o.Widget{constructor(){super(),N(this,"data",void 0),N(this,"config",void 0),N(this,"checkedItems",void 0),N(this,"chartRenderer",void 0),N(this,"_updatedOnce",void 0),N(this,"_updateChartTimeoutId",void 0),N(this,"_updateChartOpts",void 0),N(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 Ae(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(r=>delete r.requestAnimation),t.push({requestAnimation:!1})),t.forEach(r=>this.updateChart(g().extend(!0,{},r,{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=g().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:se.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=g().extend(!0,{},t,e),e.options.colorScheme=o.colorSchemes.ensureColorScheme(e.options.colorScheme),o.objects.equalsRecursive(this.config,e))return;let r=g().extend(!0,{},this.config);e.data?r.data=e.data:delete r.data;let a=(i,s,n)=>{if(!(!i||!s||!n)){if(!i.options||!i.options[n]){s.options&&delete s.options[n],s.options&&o.objects.isEmpty(s.options.scales)&&!(i.options&&i.options.scales)&&delete s.options.scales,o.objects.isEmpty(s.options)&&!i.options&&delete s.options;return}s.options[n]=i.options[n]}};if(a(e,r,"xLabelMap"),a(e,r,"yLabelMap"),o.objects.equalsRecursive(r,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 r=e.filter(a=>t[a.datasetIndex]&&a.dataIndex<t[a.datasetIndex]);return r.length<e.length?r: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),i=>{this.removing||i||(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 Be(this);case d.Type.SPEEDO:return new k(this);case d.Type.SALESFUNNEL:return new Se(this);case d.Type.VENN:return new De(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 J(this)}return null}_updateChartRenderer(){this.chartRenderer&&this.chartRenderer.remove(),this.setProperty("chartRenderer",this._resolveChartRenderer())}handleValueClick(e,t){if(this.config.options.checkable){let r=[...this.checkedItems],a=r.filter(i=>i.datasetIndex===e.datasetIndex&&i.dataIndex===e.dataIndex)[0];a?o.arrays.remove(r,a):r.push(e),this.setCheckedItems(r)}this.trigger("valueClick",{data:e,originalEvent:t})}}N(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"}),N(d,"Position",{TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center"}),N(d,"DEFAULT_ANIMATION_DURATION",600),N(d,"DEFAULT_DEBOUNCE_TIMEOUT",100);var se;(function(l){l.AUTO="auto",l.DATASET="dataset",l.DATA="data"})(se||(se={}));class Me extends o.ModelAdapter{_onWidgetValueClick(e){this._send("valueClick",e.data)}_onWidgetEvent(e){e.type==="valueClick"?this._onWidgetValueClick(e):super._onWidgetEvent(e)}}function qe(l,e,t){return(e=Ke(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Ke(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 r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Ae extends o.AbstractLayout{constructor(e){super(),qe(this,"chart",void 0),this.chart=e}layout(e){var t;let r={requestAnimation:!0,debounce:d.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:!0};if((!this.chart.session.ready||this.chart._updatedOnce)&&(r.requestAnimation=!1),this.chart.session.ready||(r.debounce=!1),(t=this.chart.findParent(o.Tile))!==null&&t!==void 0&&t.$container.hasClass("dragged")&&(r.debounce=!1),this.chart.chartRenderer instanceof J){var a;(a=this.chart.chartRenderer.chartJs)===null||a===void 0||a.resize()}this.chart.updateChart(r)}}function he(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 r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class pe extends o.PropertyEventEmitter{constructor(e){super(),he(this,"chart",void 0),he(this,"session",void 0),he(this,"rendering",void 0),he(this,"rendered",void 0),he(this,"animationDuration",void 0),he(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,r=0;for(t=0;t<e.chartValueGroups.length;t++){let a=e.chartValueGroups[t];if(!a.values)return!1;if(t===0)r=a.values.length;else if(a.values.length!==r)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!==r)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 r=this.chart.config.options.animation.duration;this.setAnimationDuration(e&&r),this.animationDuration&&this.rendered?this._removeAnimated(t):this._remove(t),this.setAnimationDuration(r)}_remove(e){this.rendered=!1,e&&e()}_removeAnimated(e){this._remove(e)}shouldAnimateRemoveOnUpdate(e){return e.requestAnimation}}function F(l,e,t){return(e=tt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function tt(l){var e=rt(l,"string");return typeof e=="symbol"?e:e+""}function rt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class M extends pe{constructor(e){super(e),F(this,"chartBox",void 0),F(this,"clipId",void 0),F(this,"maskId",void 0),F(this,"suppressLegendBox",void 0),F(this,"height",void 0),F(this,"width",void 0),F(this,"chartAnimationStopping",void 0),F(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(M.FONT_SIZE_BIG):this._useFontSizeMiddle()?this.$svg.addClass(M.FONT_SIZE_MIDDLE):this._useFontSizeSmall()?this.$svg.addClass(M.FONT_SIZE_SMALL):this._useFontSizeSmallest()&&this.$svg.addClass(M.FONT_SIZE_SMALLEST),this.$svg.isAttached()&&this._renderInternal()}linkChartWithFieldLabel(e){if(!e)return;let t=e.parents(".chart-field");if(t.length>0){let r=t.eq(0).children("label");r.length>0&&o.aria.linkElementWithLabel(e,r.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 r=this.$svg.appendSVG("text",t).attr("x",0).attr("y",0).attr("visibility","hidden").text(e),a;try{a=r[0].getBBox()}catch{return{height:0,width:0}}return r.remove(),a}_renderLine(e,t,r,a,i){let s=this.$svg.appendSVG("line",i).attr("x1",e).attr("y1",t).attr("x2",r).attr("y2",a);return this.animationDuration&&s.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),s}_renderLineLabel(e,t,r,a,i){let s=this.$svg.appendSVG("text",a||"line-label").attr("x",e).attr("y",t).text(r);if(i){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(r);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(r,a){try{e.bind(this)(r,a)}catch(i){throw g()(this).stop(!0,!1),i}},duration:t||d.DEFAULT_ANIMATION_DURATION,complete:function(){g()(this).removeAttr("tabindex")}}}_addClipping(e){let t=this.$svg.appendSVG("clipPath");t[0].id=this.clipId;let r=this.$svg.appendSVG("mask");r.appendSVG("rect").attr("x",0).attr("y",0).attr("width","100%").attr("height","100%").attr("fill","white"),r[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),r.appendSVG("use").attrXLINK("href","#"+this.id)})}_renderWireLegend(e,t,r,a){if(!this.chart.config.options.plugins.tooltip.enabled)return{detachFunc:()=>{},attachFunc:()=>{},removeFunc:()=>{}};let i={},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,y=0;if(c.h===-1?y=c.x2-2*s:y=this.width-c.x2-2*s,Array.isArray(e))for(let _=0;_<e.length;_++){let x=e.length-_-1,v=c.y2+c.v*s-h*x-s*x,T=this._renderLineLabel(c.x2+s,v,o.strings.truncateText(e[_],y,this._measureText.bind(this)),"",a);T.addClass(r),m=Math.max(m,T[0].getComputedTextLength()),_===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,y,this._measureText.bind(this)),"",a),f.addClass(r),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(_=>{_.attr("x",c.x2-s-m),_.css("text-anchor","left")})):(f.attr("x",c.x2+s),f.css("text-anchor","right"),f.data("lines")&&f.data("lines").forEach(_=>{_.attr("x",c.x2+s),_.css("text-anchor","right")})),c.v===1)f.data("lines")&&f.data("lines").forEach((_,x)=>{_.attr("y",c.x2-s-m);let v=1+x;_.attr("y",c.y2+c.v*s+h*v+s*(v+1))}),f.attr("dy","0.7em");else if(f.data("lines")){let _=f.data("lines").length;f.attr("y",c.y2+c.v*s-h*_-s*_),f.data("lines").forEach((x,v)=>{_=f.data("lines").length-1-v,x.attr("y",c.y2+c.v*s-h*_-s*_)})}f.add(f.data("lines")).each((_,x)=>{let v=g()(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 b=[];c.x1>0&&c.y1>0&&(b.push(this._renderLine(c.x1,c.y1,c.x2,c.y2,"label-line")),b.push(this._renderLine(c.x2,c.y2,c.x2+c.h*(m+2*s),c.y2,"label-line"))),f.data("wires",b);let C=this.$svg;return i.detachFunc=()=>{f.data("wires").forEach(_=>{_.detach()}),f.data("lines")&&f.data("lines").forEach(_=>{_.data("$background")&&C.append(_.data("$background")),_.detach()}),f.data("$background")&&f.data("$background").remove(),f.detach()},i.attachFunc=()=>{C.append(f),f.data("$background")&&C.append(f.data("$background")),C.append(f.data("wires")),f.data("lines")&&f.data("lines").forEach(_=>{C.append(_),_.data("$background")&&C.append(_.data("$background"))})},i.removeFunc=()=>{f.data("wires").forEach(_=>{_.remove()}),f.data("lines")&&f.data("lines").forEach(_=>{_.data("$background")&&_.data("$background").remove(),_().remove()}),f.data("$background")&&f.data("$background").remove(),f.remove()},i.$field=f,i}}F(M,"FONT_SIZE_SMALLEST","smallestFont"),F(M,"FONT_SIZE_SMALL","smallFont"),F(M,"FONT_SIZE_MIDDLE","middleFont"),F(M,"FONT_SIZE_BIG","bigFont");const ke={getAdapter(l){return{formats:()=>at(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,r)=>{let a=new Date(e);switch(r){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,r)=>{switch(r){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,r)=>{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,r).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 r=new Date(e);switch(t){case"second":return r.setMilliseconds(999);case"minute":return r.setSeconds(59,999);case"hour":return r.setMinutes(59,59,999);case"day":return r.setHours(23,59,59,999);case"week":{r.setHours(23,59,59,999);let a=o.dates.firstDayOfWeek(r,0);return a.setDate(a.getDate()+7)}case"month":return r.setHours(23,59,59,999),r.setDate(Ie(r.getMonth(),r.getFullYear()));case"quarter":{r.setHours(23,59,59,999);let a=r.getMonth()%4+2;return r.setMonth(a,Ie(a,r.getFullYear()))}case"year":return r.setHours(23,59,59,999),r.setMonth(11,31);default:return e}}}}};function at(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 Ie(l,e){return l in[3,5,8,10]?30:l===1?o.dates.isLeapYear(e)?29:28:31}var it=l=>{var e={};return E.d(e,l),e},hr=l=>()=>l;const B=it({CategoryScale:()=>ve.CategoryScale,Chart:()=>ve.Chart,_adapters:()=>ve._adapters});var st=l=>{var e={};return E.d(e,l),e},dr=l=>()=>l;const ur=st({});var nt=l=>{var e={};return E.d(e,l),e},cr=l=>()=>l;const Re=nt({default:()=>We.default});function A(l,e,t){return(e=ot(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function ot(l){var e=lt(l,"string");return typeof e=="symbol"?e:e+""}function lt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}B.Chart.register(Re.default),g().extend(!0,B.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}}}}),g().extend(!0,B.Chart.overrides,{line:{elements:{point:{borderWidth:2}}},scatter:{elements:{point:{radius:3}}},bubble:{layout:{autoPadding:!1}}});let we=!1;const ht=(1+Math.sqrt(5))/2;class J extends pe{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 i,s=0;for(i=0;i<t.chartValueGroups.length;i++){let n=t.chartValueGroups[i];n.values||(e=!1),i===0?s=n.values.length:n.values.length!==s&&(e=!1)}for(i=0;i<t.axes.length;i++)t.axes[i].length!==s&&(e=!1)}if(e)return!0;let r=!0,a=this.chart&&this.chart.config;if((!a||!a.data||!a.data.datasets||a.data.datasets.length===0)&&(r=!1),r&&o.scout.isOneOf(a.type,d.Type.POLAR_AREA,d.Type.RADAR)){let i,s=0;for(i=0;i<a.data.datasets.length;i++){let n=a.data.datasets[i];n.data||(r=!1),i===0?s=n.data.length:n.data.length!==s&&(r=!1)}}return r}_render(){this.$canvas||(this.$canvas=this.chart.$container.appendElement("<canvas>"),o.aria.hidden(this.$canvas,!0)),this.firstOpaqueBackgroundColor=o.styles.getFirstOpaqueBackgroundColor(this.$canvas),we||(B.Chart.defaults.font.family=this.$canvas.css("font-family"),B._adapters._date.override(ke.getAdapter(this.chart.session)),we=!0);let e=g().extend(!0,{},this.chart.config);this._adjustConfig(e),this._renderChart(e)}_renderChart(e){this.chartJs&&this.chartJs.destroy(),e=g().extend(!0,{},e,{options:{animation:{}}},e),e.options.animation.duration=this.animationDuration,this.chartJs=new B.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=g().extend(!0,{},this.chart.config);this._adjustConfig(e);let t=this.chartJs.config.data,r=e.data,a=(h,p,c,f)=>{if(!h||!p||!c)return;if(!p[c]){let b=h[c];(b||f)&&(p[c]=b);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 b=0;b<Math.min(h[c].length,p[c].length);b++)p[c][b]=h[c][b];let m=p[c].length,y=h[c].length;m>y?p[c].splice(y,m-y):m<y&&p[c].push(...h[c].splice(m))},i=(h,p)=>o.arrays.find(h,c=>c.datasetId===p),s=(h,p)=>o.arrays.findIndex(h,c=>c.datasetId===p);if(t&&r){a(r,t,"labels"),t.datasets||(t.datasets=[]),r.datasets||(r.datasets=[]),r.datasets.every(h=>o.objects.isNullOrUndefined(h.datasetId))&&(r.datasets.forEach((h,p)=>{h.datasetId=""+p}),t.datasets.forEach((h,p)=>{h.datasetId=""+p})),t.datasets.forEach(h=>{let p=i(r.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(r.datasets,p)===-1)&&t.datasets.splice(h,1)}t.datasets.sort((h,p)=>s(r.datasets,h.datasetId)-s(r.datasets,p.datasetId)),r.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=r;a(e.options,this.chartJs.config.options,"xLabelMap",!0),a(e.options,this.chartJs.config.options,"yLabelMap",!0),g().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&&(g().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,i,s)=>{if(Array.isArray(a)&&Array.isArray(i)){let n=0;return o.arrays.ensure(s).filter(u=>!isNaN(u)&&u<Math.min(a.length,i.length)).forEach(u=>{a[u]!==i[u]&&(a[u]=i[u],n++)}),n}return 0},r=0;return e.data.datasets.forEach((a,i)=>{let s=this.chart.checkedItems.filter(u=>u.datasetIndex===i).map(u=>u.dataIndex),n=o.arrays.init(a.data.length,null).map((u,h)=>h);o.arrays.removeAll(n,s),r=r+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<r}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=g().extend(!0,{},e.options,{indexAxis:"y"}))}_computeDatasets(e,t){let r=[],a=[],i=(n,u)=>{g().isEmptyObject(u)||(t.options[n]=u)};(e.axes[0]||[]).forEach(n=>r.push(n.label));let s=this._isHorizontalBar(t);i(s?"yLabelMap":"xLabelMap",this._computeLabelMap(e.axes[0])),i(s?"xLabelMap":"yLabelMap",this._computeLabelMap(e.axes[1])),e.chartValueGroups.forEach(n=>a.push({type:n.type,label:n.groupName,data:g().extend(!0,[],n.values)})),t.data={labels:r,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((r,a)=>{t[a]=r.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 r=t?"hoverBorderWidth":"borderWidth",a=t?"hoverBorderWidthBackup":"borderWidthBackup",i=t?"hoverBackgroundColor":"backgroundColor",s=t?"hoverBorderColor":"borderColor";if(e[a]&&(e[r]=e[a],delete e[a]),!e[r]||o.objects.isFunction(e[r]))return;let n=Array.isArray(e[r]),u=Array.isArray(e[i]),h=Array.isArray(e[s]);if(!(n||u||h)&&e[i]===e[s]){e[a]=e[r],e[r]=0;return}let c=(e.data||[]).length;n?e[r].length<c&&e[r].push(...o.arrays.init(c-e[r].length,e[r][0])):e[r]=o.arrays.init(c,e[r]);let f=e[r],m=f.length,y=o.arrays.init(m,null);for(let b=0;b<m;b++){let C=u?e[i][b]:e[i],_=h?e[s][b]:e[s];y[b]=f[b],C===_&&(f[b]=0)}o.arrays.equals(f,y)||(e[a]=y)}_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 i=a.data.slice(0,t);i[t-1]=a.data.slice(t-1,a.data.length).reduce((s,n)=>s+n,0),a.data=i});let r=e.data.labels.slice(0,t);r[t-1]=this.chart.session.text("ui.OtherValues"),e.data.labels=r,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(r=>{isNaN(r.r)||(r.z=Math.pow(r.r,2)),r.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(r=>o.numbers.isInteger(r.x)&&o.numbers.isInteger(r.y))):this.onlyIntegers=e.data.datasets.every(t=>t.data.every(r=>o.numbers.isInteger(r))))}_adjustLegend(e){!e||!e.type||!e.options||(e.options=g().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=g().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],r=t.chart,a=r.config,i=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(i.data[t.dataIndex].x,null,null);p&&s.push(this._createTooltipAttribute(h.x,o.strings.encode(p),!0));let c=u.ticks.callback(i.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=r.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,r=e.options.scales.y.title.text;return t=this._resolveAxisLabel(t,J.ARROW_LEFT_RIGHT),r=this._resolveAxisLabel(r,"&nbsp;"+J.ARROW_UP_DOWN+"&nbsp;"),{x:t,y:r}}_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,r,a){if(!e||!e.length)return"";let i=e[0],s=i.chart,n=s.config,u=!1,h=!1,p="";if(e.forEach(c=>{let{label:f,labelValue:m,labelColor:y}=this._getItemDetails(c,t,r,a);if(o.scout.isOneOf(n.type,d.Type.SCATTER)){let{x:b,y:C}=m;u||(u=o.objects.isString(b)),h||(h=o.objects.isString(C)),p+=this._createTooltipScatterAttribute(f,b,C,!1,y)}else p+=this._createTooltipAttribute(f,m,!1,y)}),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,r,a){let i,s,n;return o.objects.isFunction(t)&&(i=t(e),i=o.objects.isString(i)?i:""),o.objects.isFunction(r)&&(s=r(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:i,labelValue:s,labelColor:n}}_generateTooltipLabel(e){return o.strings.encode(e.dataset.label)}_generateTooltipLabelValue(e){let t=e.chart.config,r=e.dataset;return t.type===d.Type.BUBBLE?o.strings.encode(this._formatLabel(r.data[e.dataIndex].z)):t.type===d.Type.SCATTER?{x:o.strings.encode(this._formatXLabel(r.data[e.dataIndex].x)),y:o.strings.encode(this._formatYLabel(r.data[e.dataIndex].y))}:o.strings.encode(this._formatLabel(r.data[e.dataIndex]))}_generateTooltipLabelColor(e){let t=e.chart.config,r=e.dataset,a,i,s,n;o.scout.isOneOf(r.type||t.type,d.Type.LINE,d.Type.BAR,d.Type.BAR_HORIZONTAL,d.Type.RADAR,d.Type.BUBBLE,d.Type.SCATTER)&&(s=r.borderColor,a=Array.isArray(r.legendColor)?r.legendColor[e.dataIndex]:r.legendColor,n=e.datasetIndex),o.scout.isOneOf(t.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(a=Array.isArray(r.legendColor)?r.legendColor[e.dataIndex]:r.legendColor,i=Array.isArray(r.backgroundColor)?r.backgroundColor[e.dataIndex]:r.backgroundColor,i=this._adjustColorOpacity(i,1),n=e.dataIndex),o.objects.isFunction(a)&&(a=a.call(e.chart,n));let u=a||i||s;if(!u||o.objects.isFunction(u)){let h;B.Chart.overrides[t.type]&&B.Chart.overrides[t.type].plugins&&B.Chart.overrides[t.type].plugins.tooltip&&B.Chart.overrides[t.type].plugins.tooltip.callbacks&&(h=B.Chart.overrides[t.type].plugins.tooltip.callbacks.labelColor),u=(h||B.Chart.defaults.plugins.tooltip.callbacks.labelColor).call(e.chart,e).backgroundColor}return{backgroundColor:u}}_createTooltipAttribute(e,t,r,a){return'<div class="'+(r?"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,r,a,i){return'<tr class="'+(a?"attribute title":"attribute")+'"><td class="color-cell">'+(i?'<div class="color" style="background-color:'+i+'"></div>':"")+'</td><td class="label">'+e+"</td>"+(t?'<td class="value">'+t+"</td>":"")+(r?'<td class="value">'+r+"</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,r=t.dataPoints;if(r.length<1)return;let a=r[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(r)).join("")),o.objects.isFunction(h)&&(m+=o.arrays.ensure(h(r,p,c,f)).join(""));let y=this._computeTooltipPositionAndOffset(a),b=new o.Point(t.caretX+y.offsetX,t.caretY+y.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:y.tooltipPosition,tooltipDirection:y.tooltipDirection,originProducer:v=>{const T=o.graphics.offsetBounds(v);return T.height=y.height,T},offsetProducer:v=>b}),this._tooltip.render(),this._tooltip.$container.css("pointer-events","none");let C=!1,_=(s.titleFont||{}).family;_&&(this._tooltip.$container.css("--chart-tooltip-font-family",_),C=!0);let x=0;this._tooltip.$container.find("label").each((v,T)=>{x=Math.max(x,o.graphics.prefSize(g()(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",r="right",a=0,i=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?r=(m.x[0]+m.x[1])/2<0?"left":"right":r=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 y=n.getDatasetMeta(u).data[h].getProps(["startAngle","endAngle"]),b=y.startAngle,C=y.endAngle,_=(b+C)/2;t=0<=_&&_<Math.PI?"bottom":"top",r=-Math.PI/2<=_&&_<Math.PI/2?"right":"left"}else if(p.type===d.Type.RADAR){let b=n.getDatasetMeta(u).data[h].getProps(["angle"]).angle;t=0<=b&&b<Math.PI?"bottom":"top",r=-Math.PI/2<=b&&b<Math.PI/2?"right":"left"}else if(o.scout.isOneOf(p.type,d.Type.BUBBLE,d.Type.SCATTER)){let y=n.getDatasetMeta(u).data[h],b=n.chartArea,C=b.left+b.width/2;r=y.x<C?"left":"right"}if(this._isHorizontalBar(p)){let y=n.getDatasetMeta(u).data[h].getProps(["height","width"]);s=y.height;let b=y.width,C=b/(ht+1);i=-s/2,a=r==="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 b=n.getDatasetMeta(u).data[h].options,C=b.hoverRadius+b.hoverBorderWidth;p.type===d.Type.BUBBLE&&(C+=m.r),s=2*C,i=-C}else if(o.scout.isOneOf(p.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)){let y=n.getDatasetMeta(u).data[h].getProps(["startAngle","endAngle","innerRadius","outerRadius"]),b=y.startAngle,C=y.endAngle,_=(b+C)/2,x=y.innerRadius,v=y.outerRadius,T=(v-x)/2;a=T*Math.cos(_),i=T*Math.sin(_)}return{tooltipPosition:t,tooltipDirection:r,offsetX:a,offsetY:i,height:s}}_adjustGrid(e){e&&(e.options=g().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=g().extend(!0,{},{scales:{r:{}}},e.options));let t=e.options,r=t?t.scales:{};r&&r.r&&(r.r=g().extend(!0,{},{minSpaceBetweenTicks:35,beginAtZero:!0,angleLines:{display:!1},ticks:{callback:this._labelFormatter},pointLabels:{callback:this._labelFormatter,font:{size:B.Chart.defaults.font.size}}},r.r))}_adjustScalesXY(e){!e||!e.type||!e.options||(o.scout.isOneOf(e.type,d.Type.BAR,d.Type.LINE,d.Type.BUBBLE)?e.options=g().extend(!0,{},{scales:{x:{minSpaceBetweenTicks:150},y:{minSpaceBetweenTicks:35}}},e.options):o.scout.isOneOf(e.type,d.Type.SCATTER)&&(e.options=g().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,r=e.options.scales;this._isHorizontalBar(e)||o.scout.isOneOf(t,d.Type.BUBBLE,d.Type.SCATTER)?r.x=g().extend(!0,{},{beginAtZero:this._isHorizontalBar(e),offset:t===d.Type.BUBBLE,grid:{drawTicks:!1},border:{display:!1},ticks:{padding:5}},r.x):r.x=g().extend(!0,{},{offset:!0,grid:{display:!1},border:{display:!1}},r.x),(this._isHorizontalBar(e)||o.scout.isOneOf(t,d.Type.BUBBLE,d.Type.SCATTER)||e.options.reformatLabels)&&(r.x=g().extend(!0,{},{ticks:{callback:this._xLabelFormatter}},r.x)),r.x.afterCalculateLabelRotation=this._xAxisFitter}_adjustYAxis(e){if(!e||!e.type||!e.options||!e.options.scales||!e.options.scales.y)return;let t=e.type,r=e.options.scales;this._isHorizontalBar(e)?r.y=g().extend(!0,{},{grid:{display:!1},border:{display:!1}},r.y):r.y=g().extend(!0,{},{beginAtZero:!o.scout.isOneOf(t,d.Type.BUBBLE,d.Type.SCATTER),grid:{drawTicks:!1},border:{display:!1},ticks:{padding:5}},r.y),(!this._isHorizontalBar(e)||e.options.reformatLabels)&&(r.y=g().extend(!0,{},{ticks:{callback:this._yLabelFormatter}},r.y)),r.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=g().extend(!0,{},{formatter:this._radialChartDatalabelsFormatter},t.datalabels),t.datalabels.display=this._radialChartDatalabelsDisplayHandler,this._updatingDatalabels=!1;let r=e.options.animation||{},a=r.onProgress,i=r.onComplete,s=u=>{if(this._updatingDatalabels)return;this._updatingDatalabels=!0;let h=u.chart,p=h.getSortedVisibleDatasetMetas(),c=[...h.getActiveElements()],f=[];p.forEach((m,y)=>{m.data.forEach((b,C)=>{let _=o.arrays.findIndex(c,x=>x.datasetIndex===y&&x.index===C);_>0?c.splice(_,1):f.push({datasetIndex:y,index:C,element:b})})}),h["$"+Re.default.id]._actives=f,Re.default.afterEvent(h,null,null),this._updatingDatalabels=!1},n=(u,h)=>{s(u),h&&h(u)};e.options.animation=g().extend(!0,{},e.options.animation,{onProgress:u=>n(u,a),onComplete:u=>n(u,i)})}else o.scout.isOneOf(e.type,d.Type.BAR,d.Type.LINE,d.Type.POLAR_AREA,d.Type.RADAR,d.Type.BUBBLE)?(t.datalabels=g().extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:3},t.datalabels),t.datalabels.display="auto"):o.scout.isOneOf(e.type,d.Type.SCATTER)&&(t.datalabels=g().extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:3,anchor:"end",align:"top",offset:3},t.datalabels),t.datalabels.display="auto");if(e.options.reformatLabels){let r=a=>(i,s)=>{let n=a.call(s.chart,i,s);return this._formatLabel(n)};e.data&&e.data.datasets.forEach(i=>{i.datalabels&&i.datalabels.formatter&&(i.datalabels.formatter=r(i.datalabels.formatter))}),t.datalabels.formatter&&(t.datalabels.formatter=r(t.datalabels.formatter))}t.datalabels=g().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(r){return e.call(t,r,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 B.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,r){return t?t[e]:isNaN(e)||typeof e=="string"?""+e:r?r(e,this._formatNumberLabel.bind(this)):this._formatNumberLabel(e)}_formatNumberLabel(e){if(isNaN(e))return""+e;let t=Math.abs(e),r="";if(t>=1e6){t=t/1e6,r=" "+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 i=0;i<a.length&&t>=1e3;i++)t=t/1e3,r=" "+a[i]}return this.session.locale.decimalFormat.format(Math.sign(e)*t)+r}_fitXAxis(e){if(!e||e.labelRotation===0)return;let t=this.maxXAxesTicksHeight,r=B.Chart.defaults.font,a=B.Chart.defaults.scale.ticks,i=a.font||{},s,n;if(this.chartJs){let f=this.chartJs.chartArea,m=Math.abs(f.top-f.bottom);t=Math.min(t,m/3)}e.options&&e.options.ticks&&(n=e.options.ticks.maxRotation,s=(e.options.ticks.font||{}).size),n=n||a.maxRotation,s=s||i.size||r.size,isNaN(e.labelRotation)&&(e.labelRotation=n),e.height=isNaN(e.height)?t:Math.min(e.height,t);let u=e.labelRotation,h=(t-s*Math.sin((90-u)/180*Math.PI))/Math.sin(u/180*Math.PI);if(((e._labelSizes||{}).widest||{}).width>h){let f=e.ctx.measureText.bind(e.ctx);e.ticks.forEach(m=>{m.label=o.strings.truncateText(m.label,h,f)}),e._labelSizes=void 0}}_fitYAxis(e){if(!e)return;let t=0,r=0;if(e.options&&e.options.ticks&&(t=e.options.ticks.padding||0),e.options&&e.options.grid&&(r=e.options.grid.tickLength||0),((e._labelSizes||{}).widest||{}).width>e.maxWidth-t){let s=e.maxWidth-t-r,n=e.ctx.measureText.bind(e.ctx);e.ticks.forEach(u=>{u.label=o.strings.truncateText(u.label,s,n)})}}_displayDatalabelsOnRadialChart(e){let t=e.chart.getDatasetMeta(e.datasetIndex).data[e.dataIndex].getProps(["startAngle","endAngle","innerRadius","outerRadius"]),r=(t.outerRadius+t.innerRadius)/2,a=Math.min(t.endAngle-t.startAngle,Math.PI)/2,i=Math.abs(Math.sin(a))*r,s=i*2,n=t.outerRadius-t.innerRadius;return Math.min(s,n)>this.minRadialChartDatalabelSpace}_formatDatalabelsOnRadialChart(e,t){let r=this._computeSumOfVisibleElements(t),a=t.dataset,i=0,s=[];for(let n=0;n<t.dataIndex+1;n++){let u=a.data[n]/r*100-i,h=Math.round(u);i=h-u,s.push(h+"%")}return s[t.dataIndex]}_computeSumOfVisibleElements(e){let t=e.dataset,r=e.chart,a=0;for(let i=0;i<t.data.length;i++)r.getDataVisibility(i)&&(a+=t.data[i]);return a}_formatDatalabels(e,t){let r=t.chart.config;return r.type===d.Type.BUBBLE?this._formatLabel(e.z):r.type===d.Type.SCATTER?o.strings.join(" / ",this._formatXLabel(e.x),this._formatYLabel(e.y)):this._formatLabel(e)}_getBackgroundColorOfDataset(e){return e.dataset.backgroundColor}_adjustColors(e){this._adjustColorSchemeCssClass(e),this._adjustDatasetColors(e),this._adjustLegendColors(e),this._adjustScalesRColors(e),this._adjustScalesXYColors(e),this._adjustPluginColors(e)}_adjustColorSchemeCssClass(e){!e||!e.options||(this.colorSchemeCssClass=o.colorSchemes.getCssClasses(e.options.colorScheme).join(" "))}_adjustDatasetColors(e){if(!e||!e.data||!e.type)return;let t=e.data,r=e.type,a=e.options&&e.options.autoColor,i=e.options&&e.options.checkable,s=e.options&&e.options.colorMode,n=a&&(s===se.DATASET?!1:s===se.DATA?!0:o.scout.isOneOf(r,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)),u={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]};u=g().extend(!0,u,this._computeDatasetColors(e,n)),t.datasets.forEach((h,p)=>{const c=v=>{let T=v[p];return n&&!Array.isArray(T)&&(T=v),T};let f=c(u.backgroundColors),m=c(u.borderColors),y=c(u.hoverBackgroundColors),b=c(u.hoverBorderColors),C=c(u.legendColors),_=c(u.pointHoverColors),x=(v,T)=>{typeof h[v]!="function"&&T&&T.length&&(h[v]=Array.isArray(T)?[...T]:T)};if(x("backgroundColor",f),x("borderColor",m),x("hoverBackgroundColor",y),x("hoverBorderColor",b),x("legendColor",C),(o.scout.isOneOf(r,d.Type.LINE,d.Type.RADAR)||r===d.Type.BAR&&h.type===d.Type.LINE)&&(x("pointHoverBackgroundColor",_),x("pointBorderColor",this.firstOpaqueBackgroundColor),x("pointHoverBorderColor",this.firstOpaqueBackgroundColor)),i){const v=h.data.length,T=I=>Array.isArray(I)?I:o.arrays.init(v,I);if(o.scout.isOneOf(r,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA,d.Type.BUBBLE,d.Type.SCATTER)||r===d.Type.BAR&&(h.type||d.Type.BAR)===d.Type.BAR){let I=T(f),W=T(y),z=T(c(u.checkedBackgroundColors)),U=T(c(u.checkedHoverBackgroundColors));x("uncheckedBackgroundColor",I),x("uncheckedHoverBackgroundColor",W),x("checkedBackgroundColor",z),x("checkedHoverBackgroundColor",U),x("backgroundColor",h.uncheckedBackgroundColor),x("hoverBackgroundColor",h.uncheckedHoverBackgroundColor)}else if(o.scout.isOneOf(r,d.Type.LINE,d.Type.RADAR)||r===d.Type.BAR&&h.type===d.Type.LINE){let I=T(_),W=T(_),z=T(m),U=T(b||m);x("uncheckedPointBackgroundColor",I),x("uncheckedPointHoverBackgroundColor",W),x("checkedPointBackgroundColor",z),x("checkedPointHoverBackgroundColor",U),x("pointBackgroundColor",h.uncheckedPointBackgroundColor),x("pointHoverBackgroundColor",h.uncheckedPointHoverBackgroundColor);let j=o.arrays.init(v,((e.options.elements||{}).point||{}).radius||B.Chart.defaults.elements.point.radius),w=o.arrays.init(v,(((e.options.elements||{}).point||{}).hoverRadius||B.Chart.defaults.elements.point.hoverRadius)-1);x("uncheckedPointRadius",j),x("checkedPointRadius",w),x("pointRadius",h.uncheckedPointRadius)}}this._adjustDatasetBorderWidths(h)}),i&&this._checkItems(e)}_computeDatasetColors(e,t){if(!e||!e.data||!e.type)return{};let r=e.data,a=e.type,i={};if(e.options&&e.options.autoColor)i=this._computeDatasetColorsAutoColor(e,t);else if(i=this._computeDatasetColorsChartValueGroups(e,t),o.scout.isOneOf(a,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)){let s=this._computeBorderColor(a,0);i.borderColors=o.arrays.init(r.datasets.length,s),i.hoverBorderColors=i.borderColors}return i}_computeDatasetColorsAutoColor(e,t){if(!e||!e.data||!e.type||!e.options||!e.options.autoColor)return{};let r=e.data,a=e.type,i=e.options&&e.options.checkable,s=e.options&&e.options.transparent,n={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]},u=[];return t?u=o.arrays.init(r.datasets.length&&r.datasets[0].data.length||0,a):r.datasets.forEach(h=>u.push(h.type||a)),u.forEach((h,p)=>{n.backgroundColors.push(this._computeBackgroundColor(h,p,i||s)),n.borderColors.push(this._computeBorderColor(h,p)),n.hoverBackgroundColors.push(this._computeHoverBackgroundColor(h,p,i||s)),n.hoverBorderColors.push(this._computeHoverBorderColor(h,p)),n.checkedBackgroundColors.push(this._computeCheckedBackgroundColor(h,p,i)),n.checkedHoverBackgroundColors.push(this._computeCheckedHoverBackgroundColor(h,p,i)),n.legendColors.push(this._computeLegendColor(h,p)),n.pointHoverColors.push(this._computePointHoverColor(h,p))}),n}_computeBackgroundColor(e,t,r){return o.styles.get([this.colorSchemeCssClass,e+"-chart"+(r?" checkable":""),"elements","color"+t%this.numSupportedColors],"fill").fill}_computeBorderColor(e,t){let r;return o.scout.isOneOf(e,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(r={stroke:this.firstOpaqueBackgroundColor}),o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","stroke-color"+t%this.numSupportedColors],"stroke",r).stroke}_computeHoverBackgroundColor(e,t,r){return o.styles.get([this.colorSchemeCssClass,e+"-chart"+(r?" checkable":""),"elements","color"+t%this.numSupportedColors+" hover"],"fill").fill}_computeHoverBorderColor(e,t){let r;return o.scout.isOneOf(e,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(r={stroke:this.firstOpaqueBackgroundColor}),o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","stroke-color"+t%this.numSupportedColors+" hover"],"stroke",r).stroke}_computeCheckedBackgroundColor(e,t,r){return o.styles.get([this.colorSchemeCssClass,e+"-chart"+(r?" checkable":""),"elements","color"+t%this.numSupportedColors+" checked"],"fill").fill}_computeCheckedHoverBackgroundColor(e,t,r){return o.styles.get([this.colorSchemeCssClass,e+"-chart"+(r?" checkable":""),"elements","color"+t%this.numSupportedColors+" hover checked"],"fill").fill}_computeLegendColor(e,t){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","color"+t%this.numSupportedColors+" legend"],"fill").fill}_computePointHoverColor(e,t){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","color"+t%this.numSupportedColors+" point hover"],"fill").fill}_computeDatasetColorsChartValueGroups(e,t){if(!e||!e.type||!this.chart.data)return{};let r=e.type,a=e.options&&e.options.checkable,i=e.options&&e.options.transparent,s={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]};return this.chart.data.chartValueGroups.forEach(n=>{let u=1,h=1,p=.1,c=.1,f=.2,m=.35,y=1,b=0,C=1,_=.1;o.scout.isOneOf(r,d.Type.PIE,d.Type.DOUGHNUT)?(f=.7,m=.85,b=.1,_=0):r===d.Type.POLAR_AREA?(u=.7,h=.85,f=.7,m=.85,b=.1,_=0):o.scout.isOneOf(n.type||r,d.Type.LINE,d.Type.RADAR)?(u=.2,h=.35,p=0,c=0,y=.2,C=.35,_=0):o.scout.isOneOf(r,d.Type.BUBBLE,d.Type.SCATTER)&&(u=.2,h=.35,p=0);const x=[],v=[],T=[],I=[],W=[],z=[],U=[],j=[];let w=o.arrays.ensure(n.colorHexValue);const ee=o.arrays.length(n.values);w.length&&w.length<ee&&(w=o.arrays.init(ee,null).map((H,le)=>w[le%w.length])),w.forEach(H=>{const le=o.styles.hexToRgb(H),G=(de,ue)=>this._adjustColorOpacity(o.styles.darkerColor(le,ue),de);x.push(G(a||i?f:u,0)),v.push(G(1,0)),T.push(G(a||i?m:h,a||i?0:p)),I.push(G(1,c)),W.push(G(y,b)),z.push(G(C,_)),U.push(G(1,0)),j.push(G(1,0))}),s.backgroundColors.push(x),s.borderColors.push(v),s.hoverBackgroundColors.push(T),s.hoverBorderColors.push(I),s.checkedBackgroundColors.push(W),s.checkedHoverBackgroundColors.push(z),s.legendColors.push(U),s.pointHoverColors.push(j)}),s.datalabelColor=this._computeDatalabelColor(r),s}_adjustColorOpacity(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return!e||typeof e=="function"?e:e.indexOf("rgb")===0?this._adjustRgbColorOpacity(e,t):e.indexOf("#")===0?this._adjustHexColorOpacity(e,t):e}_adjustRgbColorOpacity(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;if(!e||e.indexOf("rgb")!==0)return e;let r=o.styles.rgb(e);return r.alpha=t,"rgba("+r.red+", "+r.green+", "+r.blue+", "+r.alpha+")"}_adjustHexColorOpacity(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return!e||e.indexOf("#")!==0||!(e.length===4||e.length===5||e.length===7||e.length===9)?e:this._adjustRgbColorOpacity(o.styles.hexToRgb(e),t)}_adjustLegendColors(e){!e||!e.type||!e.options||(e.options=g().extend(!0,{},e.options,{plugins:{legend:{labels:{color:this._computeLabelColor(e.type)}}}}))}_computeLabelColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","label"],"fill").fill}_generateLegendLabels(e){let t=e.config,r;B.Chart.overrides[t.type]&&B.Chart.overrides[t.type].plugins&&B.Chart.overrides[t.type].plugins.legend&&B.Chart.overrides[t.type].plugins.legend.labels&&(r=B.Chart.overrides[t.type].plugins.legend.labels.generateLabels);let i=(r||B.Chart.defaults.plugins.legend.labels.generateLabels).call(e,e);if(this.removing)return i;let s=t.data,n=e.ctx.measureText.bind(e.ctx),u=e.legend,h=u.getProps(["width","maxWidth"]),p=((u||{}).options||{}).labels||{},c=p.boxWidth||0,f=p.padding||0,m;return o.scout.isOneOf(t.options.plugins.legend.position,d.Position.LEFT,d.Position.RIGHT)?((h.maxWidth||u.width)&&(m=Math.max((h.maxWidth||u.width)-c-2*f,0)),m=Math.min(250,m||0,this.$canvas.cssWidth()/3)):m=Math.min(250,this.$canvas.cssWidth()*2/3),i.forEach((y,b)=>{y.text=o.strings.truncateText(y.text,m,n);let C=s.datasets[b],_,x,v;C&&o.scout.isOneOf(C.type||t.type,d.Type.LINE,d.Type.BAR,d.Type.RADAR,d.Type.BUBBLE,d.Type.SCATTER)?(_=o.arrays.ensure(C.legendColor)[0],x=this._adjustColorOpacity(o.arrays.ensure(C.borderColor)[0],1)):s.datasets.length&&o.scout.isOneOf(t.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(C=s.datasets[0],_=Array.isArray(C.legendColor)?C.legendColor[b]:C.legendColor,v=Array.isArray(C.backgroundColor)?C.backgroundColor[b]:C.backgroundColor,v=this._adjustColorOpacity(v,1)),o.objects.isFunction(_)&&(_=_.call(e,b));let T=_||v||x;o.objects.isFunction(T)||(y.fillStyle=T,y.strokeStyle=T)}),i}_adjustScalesRColors(e){if(!e||!e.type||!e.options||!e.options.scales||!e.options.scales.r)return;let t=this._computeLabelColor(e.type),r=this._computeLabelBackdropColor(e.type),a=this._computeGridColor(e.type),i=this._computeScaleTicksColor(e.type);e.options.scales.r.ticks=g().extend(!0,{},e.options.scales.r.ticks,{color:i,backdropColor:r}),e.options.scales.r.pointLabels=g().extend(!0,{},e.options.scales.r.pointLabels,{color:t}),e.options.scales.r.grid=g().extend(!0,{},e.options.scales.r.grid,{color:a})}_computeLabelBackdropColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","label-backdrop"],"fill",{fill:this.firstOpaqueBackgroundColor}).fill}_computeGridColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","grid"],"fill").fill}_computeScaleTicksColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","scale-ticks"],"fill").fill}_adjustScalesXYColors(e){if(!e||!e.type||!e.options||!e.options.scales)return;let t=[];if(e.options.scales.x&&t.push(e.options.scales.x),e.options.scales.y&&t.push(e.options.scales.y),!t.length)return;let r=this._computeLabelColor(e.type),a=this._computeGridColor(e.type),i=this._computeAxisLabelColor(e.type);t.forEach(s=>{s.grid=g().extend(!0,{},s.grid,{color:a}),s.ticks=g().extend(!0,{},s.ticks,{color:r}),s.title=g().extend(!0,{},s.title,{color:i})})}_computeAxisLabelColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","axis-label"],"fill").fill}_adjustPluginColors(e){!e||!e.type||!e.options||!e.options.plugins||this._adjustPluginsDatalabelColors(e)}_adjustPluginsDatalabelColors(e){!e||!e.type||!e.options||!e.options.plugins||!e.options.plugins.datalabels||(e.options.plugins.datalabels=g().extend(!0,{},e.options.plugins.datalabels,{color:this._computeDatalabelColor(e.type)}))}_computeDatalabelColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","datalabel"],"fill").fill}_adjustClickHandler(e){if(!e||!e.options||(e.options.clickable?(e.options.onClick=this._clickHandler,e.options.onHover=this._pointerHoverHandler):e.options.onHover=this._hoverHandler,!e.options.plugins||!e.options.plugins.legend))return;let t=e.options.plugins.legend;t.clickable?(t.onClick=this._legendClickHandler,t.onHover=this._legendPointerHoverHandler,t.onLeave=this._legendPointerLeaveHandler):(t.onClick=r=>r.native.stopPropagation(),t.onHover=this._legendHoverHandler,t.onLeave=this._legendLeaveHandler)}_onClick(e,t){if(!t.length)return;let r=this._selectRelevantItem(t);if(this._isMaxSegmentsExceeded(this.chartJs.config,r.index))return;let a=r.index,i=r.datasetIndex,s={datasetIndex:i,dataIndex:a};if(o.scout.isOneOf(this.chartJs.config.type,d.Type.BUBBLE,d.Type.SCATTER)){let n=this.chartJs.config.data.datasets[i].data[a];s.xIndex=n.x,s.yIndex=n.y}else s.xIndex=a;this.chart.handleValueClick(s,e.native)}_selectRelevantItem(e){let t=this.chartJs.config.data.datasets,r=e[0];return this.chartJs.config.type===d.Type.BUBBLE&&e.forEach(a=>{t[a.datasetIndex].data[a.index].z<=t[r.datasetIndex].data[r.index].z&&(r=a)}),r}_onHover(e,t){if(!this.chartJs.config||!this.chartJs.config.type)return;let r=this.chartJs.config,a=r.type;if(!o.scout.isOneOf(a,d.Type.LINE,d.Type.BAR,d.Type.RADAR))return;let i=!1;this.resetDatasetAfterHover&&(this._restoreBackgroundColor(),this.resetDatasetAfterHover=!1,i=!0),t.forEach(s=>{let n=r.data.datasets[s.datasetIndex];o.scout.isOneOf(n.type||a,d.Type.LINE,d.Type.RADAR)&&(this._setHoverBackgroundColor(n),this.resetDatasetAfterHover=!0,i=!0)}),i&&this.refresh()}_onHoverPointer(e,t){this._onHover(e,t),!(!this.rendered||this.removing)&&(t.length&&!this._isMaxSegmentsExceeded(this.chartJs.config,t[0].index)?this.$canvas.css("cursor","pointer"):this.$canvas.css("cursor","default"))}_onLegendClick(e,t,r){if(!this.chartJs.config||!this.chartJs.config.type)return;let a=this.chartJs.config.type,i;B.Chart.overrides[a]&&B.Chart.overrides[a].plugins&&B.Chart.overrides[a].plugins.legend&&(i=B.Chart.overrides[a].plugins.legend.onClick),(i||B.Chart.defaults.plugins.legend.onClick).call(this.chartJs,e,t,r),this._onLegendLeave(e,t,r),this._onLegendHoverPointer(e,t,r),this._adjustSize(this.chartJs.config,this.chartJs.chartArea,{isDatasetVisible:n=>this.chartJs.getDatasetMeta(n).visible}),this.refresh()}_onLegendHover(e,t,r){let a=t.datasetIndex,i=this.chartJs.config,s=i.type;if(o.scout.isOneOf(s,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(a=t.index),this.legendHoverDatasets.indexOf(a)>-1)return;let n=i.data.datasets[a];((n?n.type:null)||s)===d.Type.LINE&&(this._setHoverBackgroundColor(n),this.refresh()),this._updateHoverStyle(a,!0),this.chartJs.render(),this.legendHoverDatasets.push(a)}_onLegendHoverPointer(e,t,r){this._onLegendHover(e,t,r),!(!this.rendered||this.removing)&&this.$canvas.css("cursor","pointer")}_onLegendLeave(e,t,r){let a=t.datasetIndex,i=this.chartJs.config,s=i.type;if(o.scout.isOneOf(s,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(a=t.index),this.legendHoverDatasets.indexOf(a)<0)return;let n=i.data.datasets[a];((n?n.type:null)||s)===d.Type.LINE&&(this._restoreBackgroundColor(n),this.refresh()),this._updateHoverStyle(a,!1),this.chartJs.render(),this.legendHoverDatasets.splice(this.legendHoverDatasets.indexOf(a),1)}_setHoverBackgroundColor(e){e&&(e.backgroundColorBackup=e.backgroundColor,e.backgroundColor=e.hoverBackgroundColor,this._adjustDatasetBorderWidths(e))}_restoreBackgroundColor(e){e?(e.backgroundColor=e.backgroundColorBackup||e.backgroundColor,delete e.backgroundColorBackup,this._adjustDatasetBorderWidths(e)):this.chartJs.config.data.datasets.forEach(t=>this._restoreBackgroundColor(t))}_onLegendLeavePointer(e,t,r){this._onLegendLeave(e,t,r),!(!this.rendered||this.removing)&&this.$canvas.css("cursor","default")}_updateHoverStyle(e,t){let r=this.chartJs.config,a=r.type,i,s=[],n=r.data.datasets,u=n?n[e]:null,h=u?u.type:null;o.scout.isOneOf(a,d.Type.LINE,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA,d.Type.SCATTER)||h===d.Type.LINE?i="point":i="dataset",o.scout.isOneOf(a,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)?this.chartJs.getSortedVisibleDatasetMetas().forEach((p,c)=>s.push({element:p.data[e],datasetIndex:c,index:e})):this.chartJs.getDatasetMeta(e).data.forEach((p,c)=>s.push({element:p,datasetIndex:e,index:c})),s&&s.length&&this.chartJs.updateHoverStyle(s,i,t)}_adjustResizeHandler(e){!e||!e.options||e.options.handleResize&&(e.options.onResize=this._resizeHandler)}_onResize(e,t){e.update(),this._adjustSize(e.config,e.chartArea,{isDatasetVisible:r=>e.getDatasetMeta(r).visible})}_adjustSize(e,t,r){this._adjustBubbleSizes(e,t,r),this._adjustGridMaxMin(e,t,r)}_adjustBubbleSizes(e,t,r){if(e.type!==d.Type.BUBBLE)return;let a=e.data.datasets;a.forEach(f=>f.data.forEach(m=>{isNaN(m.z)||(m.r=Math.sqrt(m.z))}));let i=this._computeMaxMinValue(e,a,{...r,identifier:"r",exact:!0}),s=i.maxValue,n=i.minValue,u=1,h=0,p=(e.options||{}).bubble?e.options.bubble.sizeOfLargestBubble:0,c=(e.options||{}).bubble?e.options.bubble.minBubbleSize:0;if(p){let f=Math.abs(t.right-t.left),m=Math.abs(t.top-t.bottom);p=Math.min(p,Math.floor(Math.min(f,m)/6)),s===0?h=p:c&&p>c&&n/s<c/p?(u=(p-c)/(s-n),h=c-u*n):u=p/s}else c&&c>n&&(n===0?h=c:u=c/n);a.forEach(f=>f.data.forEach(m=>{o.objects.isNullOrUndefined(m.r)||(m.r=m.r*u+h)}))}_computeMaxMinValue(e,t,r){if(!t)return;const{identifier:a,exact:i,boundRange:s,padding:n,space:u}=r||{},h=(r==null?void 0:r.isDatasetVisible)||(b=>!0);let p,c;if(e.type===d.Type.SCATTER&&a==="r")p=0,c=0;else{const b=[];let C=!1;o.scout.isOneOf(e.type,d.Type.LINE,d.Type.BAR)?C=!!e.options.scales.y.stacked:e.type===d.Type.BAR_HORIZONTAL&&(C=!!e.options.scales.x.stacked);const _=x=>a?x[a]:x;for(let x=0;x<t.length;x++)if(!(!o.scout.isOneOf(e.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&!h(x)))for(let v=0;v<t[x].data.length;v++){const T=_(t[x].data[v]);if(C){b[v]||(b[v]=0),b[v]+=T;continue}isNaN(p)?p=T:p=Math.max(T,p),isNaN(c)?c=T:c=Math.min(T,c)}C&&(p=Math.max(o.arrays.max(b),0),c=Math.min(o.arrays.min(b),0))}isNaN(p)&&(p=0),isNaN(c)&&(c=0);let f=0,m=p,y=c;if(i||(s&&Math.sign(c)===Math.sign(p)&&(f=Math.floor(c)),m=this._calculateBoundary(p-f,Math.ceil,Math.floor),y=this._calculateBoundary(c-f,Math.floor,Math.ceil)),n&&u&&u>2*n){let b=(p-c)/(u-2*n),C=b*n;m=Math.max(m,p-f+C),y=Math.min(y,c-f-C)}return i?{maxValue:m,minValue:y}:{maxValue:m+f,minValue:y+f}}_calculateBoundary(e,t,r){let a=t,i=!1;return e<0&&(i=!0,e=e*-1,a=r),e=this._calculateBoundaryPositive(e,a),i&&(e=e*-1),e}_calculateBoundaryPositive(e,t){if(!(e>0)||!t)return e;let r=Math.floor(Math.log(e)/Math.LN10);return r<0?e=t(e*Math.pow(10,Math.abs(r))/5)*5/Math.pow(10,Math.abs(r)):e=t(e/(5*Math.pow(10,r-1)))*5*Math.pow(10,r-1),e}_adjustGridMaxMin(e,t,r){if(!e||!e.type||!e.options||!e.options.adjustGridMaxMin||!e.options.scales||!t)return;let a=e.type;if(!o.scout.isOneOf(a,d.Type.BAR,d.Type.LINE,d.Type.POLAR_AREA,d.Type.RADAR,d.Type.BUBBLE,d.Type.SCATTER))return;let i=e.options.scales,s=i.x,n=i.y,u=i.r,h=s?s.minSpaceBetweenTicks:1,p=n?n.minSpaceBetweenTicks:1;u&&(h=u.minSpaceBetweenTicks,p=u.minSpaceBetweenTicks);let c=Math.abs(t.right-t.left),f=Math.abs(t.top-t.bottom),m=Math.max(Math.floor(c/h)+1,3),y=Math.max(Math.floor(f/p)+1,3),b=this._computeYBoundaries(e,{...r,space:f}),C=b.yBoundary,_=b.yBoundaryDiffType;if(u){this._adjustAxisMaxMin(u,Math.ceil(Math.min(m,y)/2),C);return}if(_?(this._adjustAxisMaxMin(n,y,C),this._adjustAxisMaxMin(i.yDiffType,y,_)):this._isHorizontalBar(e)?this._adjustAxisMaxMin(s,m,C):this._adjustAxisMaxMin(n,y,C),!o.scout.isOneOf(a,d.Type.BUBBLE,d.Type.SCATTER))return;let x=this._computeXBoundaryPointElement(e,{...r,space:c});this._adjustAxisMaxMin(s,m,x)}_computeBoundaryPointElement(e,t){const{identifier:r,space:a}=t;if(!e||!e.type||!o.scout.isOneOf(e.type,d.Type.BUBBLE,d.Type.SCATTER)||!e.data||!e.options||!e.options.scales||!(r==="x"||r==="y")||!a)return;let i=e.data.datasets,s=e.options.scales[r],n=s&&s.offset,u=e.options[r+"LabelMap"],h,p=this._computeMaxMinValue(e,i,{...t,identifier:"r",exact:!0,space:null}).maxValue,c=p;return e.options.elements&&e.options.elements.point&&e.options.elements.point.hoverRadius&&(c=c+e.options.elements.point.hoverRadius),n?h=this._computeMaxMinValue(e,i,{...t,exact:!!u,boundRange:!0,space:null}):h=this._computeMaxMinValue(e,i,{...t,exact:!!u,boundRange:!0,padding:c}),u&&(h.maxValue=Math.ceil(h.maxValue),h.minValue=Math.floor(h.minValue)),h}_computeXBoundaryPointElement(e,t){return this._computeBoundaryPointElement(e,{...t,identifier:"x"})}_computeYBoundaryPointElement(e,t){return this._computeBoundaryPointElement(e,{...t,identifier:"y"})}_computeYBoundaries(e,t){if(!e||!e.type)return{};let r=e.type,a,i;if(o.scout.isOneOf(r,d.Type.BUBBLE,d.Type.SCATTER))a=this._computeYBoundaryPointElement(e,t);else{let s=[],n=[];if(e.data&&e.data.datasets&&e.data.datasets.forEach(u=>{u.type&&u.type!==r?n.push(u):s.push(u)}),a=this._computeMaxMinValue(e,s,{...t,space:null}),s.length&&n.length){i=this._computeMaxMinValue(e,n,{...t,space:null});let u=a.maxValue-a.minValue,h=i.maxValue-i.minValue;u&&h&&(u/h>10||h/u>10)&&this._adjustYAxisDiffType(e,s,n)}}return{yBoundary:a,yBoundaryDiffType:i}}_adjustYAxisDiffType(e,t,r){if(!e||!e.type||!t||!t.length||!r||!r.length||!e.options||!e.options.scales||!e.options.scales.y||e.options.scales.yDiffType)return;let a=e.type,i=e.options,s=i.scales,n=s.y,u=g().extend(!0,{},n);s.yDiffType=u,e.data&&e.data.datasets&&e.data.datasets.length&&e.data.datasets[0].type&&e.data.datasets[0].type!==a?(u.position=d.Position.LEFT,n.position=d.Position.RIGHT,n.grid.drawOnChartArea=!1):(n.position=d.Position.LEFT,u.position=d.Position.RIGHT,u.grid.drawOnChartArea=!1),n.border.display=!0,n.grid.drawTicks=!0,u.border.display=!0,u.grid.drawTicks=!0;let h=t[0].type||a,p=r[0].type||a,c=this.chart.session.text("ui."+h),f=this.chart.session.text("ui."+p),m=i.scaleLabelByTypeMap?i.scaleLabelByTypeMap[h]:null,y=i.scaleLabelByTypeMap?i.scaleLabelByTypeMap[p]:null;n.title.display=!0,n.title.text=m?m+" ("+c+")":c,u.title.display=!0,u.title.text=y?y+" ("+f+")":f,t.forEach(b=>{b.yAxisID="y"}),r.forEach(b=>{b.yAxisID="yDiffType"})}_adjustAxisMaxMin(e,t,r){if(!e)return;let a=1;e.ticks=g().extend(!0,{},e.ticks,{maxTicksLimit:t}),r&&(e.suggestedMax=r.maxValue,e.suggestedMin=r.minValue,a=(r.maxValue-r.minValue)/(t-1)),e.ticks.stepSize=this.onlyIntegers&&a<1?1:void 0}_remove(e){this.rendered&&!this.removing&&(this.removing=!0,this.chartJs.destroy(),this.chartJs=null,this.$canvas.remove(),this.$canvas=null),super._remove(e),this.removing=!1}}A(J,"ARROW_LEFT_RIGHT","↔"),A(J,"ARROW_UP_DOWN","↕");function fe(l,e,t){return(e=dt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function dt(l){var e=ut(l,"string");return typeof e=="symbol"?e:e+""}function ut(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Be extends M{constructor(e){super(e),fe(this,"animationTriggered",void 0),fe(this,"segmentSelectorForAnimation",void 0),fe(this,"r",void 0),fe(this,"fullR",void 0),this.animationTriggered=!1,this.segmentSelectorForAnimation=".fulfillment-chart",this.suppressLegendBox=!0;let t={options:{fulfillment:{startValue:void 0}}};e.config=g().extend(!0,{},t,e.config)}_validate(){let e=this.chart.data.chartValueGroups;return!(e.length!==2||e[0].values.length!==1||e[1].values.length!==1)}_renderInternal(){let e=this.chart.data,t=e.chartValueGroups[0].values[0],r=e.chartValueGroups[1].values[0];this.fullR=Math.min(this.chartBox.height,this.chartBox.width)/2-2,this._renderInnerCircle(),this._renderPercentage(t,r)}_renderPercentage(e,t){let r="fulfillment-chart",a=o.arrays.ensure(this.chart.data.chartValueGroups[0].colorHexValue)[0],i=this.chart.data.chartValueGroups[0].cssClass;this.chart.config.options.autoColor?r+=" auto-color":i&&(r+=" "+i);let s=o.scout.nvl(this.chart.config.options.fulfillment.startValue,0),n=0,u=0;t&&(n=Math.min(e/t,.999999),u=Math.min(s/t,.999999)),this.r=this.fullR;let h=this,p=function(C,_){let x=g()(this),v=x.data("animation-start"),T=x.data("animation-end");x.attr("d",h.pathSegment(v*_.pos,u+(T-u)*_.pos))},c=this.$svg.appendSVG("path",r).data("animation-start",0).data("animation-end",n),f=this.fullR/8*6.7;this._renderCirclePath("fulfillment-chart-inner-circle-transparent","InnerCircle3",f).css("fill",this.firstOpaqueBackgroundColor);let y=t?Math.round(e/t*100):0,b=this.$svg.appendSVG("text","fulfillment-chart-label ").attr("x",this.chartBox.mX()).attr("y",this.chartBox.mY()).css("font-size",this.fullR/2+"px").attr("dy","0.3em").attrXLINK("href","#InnerCircle").text(y+"%");this.chart.config.options.clickable&&c.on("click",this._createClickObject(null,null),C=>this.chart.handleValueClick(C.data)),!this.chart.config.options.autoColor&&!i&&c.attr("fill",a),this.animationDuration?(c.attr("d",this.pathSegment(0,u)).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(p,this.animationDuration)),b.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)):c.attr("d",this.pathSegment(0,n)),o.aria.description(this.$svg,this.session.text("ui.FulfillmentChartAriaDescription",y))}pathSegment(e,t){let r=e*2*Math.PI,a=t*2*Math.PI,i="";return i+="M"+(this.chartBox.mX()+this.r*Math.sin(r))+","+(this.chartBox.mY()-this.r*Math.cos(r)),i+="A"+this.r+", "+this.r,i+=t-e<.5?" 0 0,1 ":" 0 1,1 ",i+=this.chartBox.mX()+this.r*Math.sin(a)+","+(this.chartBox.mY()-this.r*Math.cos(a)),i+="L"+this.chartBox.mX()+","+this.chartBox.mY()+"Z",i}_renderCirclePath(e,t,r){let a=this.chart.data.chartValueGroups[0].cssClass,i=o.arrays.ensure(this.chart.data.chartValueGroups[1].colorHexValue)[0];this.chart.config.options.autoColor?e+=" auto-color":a&&(e+=" "+a);let s=r*2,n=this.$svg.appendSVG("path",e).attr("id",t).attr("d","M "+this.chartBox.mX()+" "+this.chartBox.mY()+" m 0, "+-r+" a "+r+","+r+" 0 1, 1 0,"+s+" a "+r+","+r+" 0 1, 1 0,"+-s);return!this.chart.config.options.autoColor&&!a&&n.attr("fill",i).attr("stroke",i),n}_renderInnerCircle(){let e=this.fullR/8*7.5,t=this.fullR/8*7.2;this._renderCirclePath("fulfillment-chart-inner-circle","InnerCircle",e),this._renderCirclePath("fulfillment-chart-inner-circle-transparent","InnerCircle2",t).css("fill",this.firstOpaqueBackgroundColor)}shouldAnimateRemoveOnUpdate(e){let t=o.objects.optProperty(this.chart,"config","options","fulfillment","startValue");return o.objects.isNullOrUndefined(t)?super.shouldAnimateRemoveOnUpdate(e):!1}_removeAnimated(e){if(this.animationTriggered)return;let t=this,r=function(a,i){let s=g()(this),n=s.data("animation-start"),u=s.data("animation-end");s.attr("d",t.pathSegment(n*(1-i.pos),u*(1-i.pos)))};this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r)).promise().done(()=>{this._remove(e),this.animationTriggered=!1})}}var Le;function O(l,e,t){return(e=ct(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function ct(l){var e=pt(l,"string");return typeof e=="symbol"?e:e+""}function pt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class k extends M{constructor(e){super(e),O(this,"segmentSelectorForAnimation",void 0),O(this,"r",void 0),O(this,"scaleWeight",void 0),O(this,"my",void 0),O(this,"parts",void 0),O(this,"numSegmentsPerPart",void 0),O(this,"segmentWidth",void 0),O(this,"widthOfSegmentWithGap",void 0),O(this,"animationTriggered",void 0),O(this,"$filledParts",void 0),O(this,"$pointer",void 0),this.segmentSelectorForAnimation=".pointer",this.suppressLegendBox=!0;let t={options:{speedo:{greenAreaPosition:void 0}}};e.config=$.extend(!0,{},t,e.config)}_validate(){let e=this.chart.data,t=this.chart.config;return!(!e||!t||e.axes.length>0||e.chartValueGroups.length!==1||e.chartValueGroups[0].values.length!==3||t.options.speedo.greenAreaPosition===void 0)}_renderInternal(){let e=this.chart.data,t=e.chartValueGroups[0].values[0],r=e.chartValueGroups[0].values[2],a=e.chartValueGroups[0].values[1];this.r=Math.min(this.chartBox.height,this.chartBox.width/2)*.7,this.scaleWeight=this.r*.27,this.my=this.chartBox.yOffset+this.chartBox.height-(this.chartBox.height-this.r*1.12)/2,this.parts=this.chart.config.options.speedo.greenAreaPosition===k.Position.CENTER?k.NUM_PARTS_GREEN_CENTER:k.NUM_PARTS_GREEN_EDGE,this.numSegmentsPerPart=this.parts===k.NUM_PARTS_GREEN_CENTER?5:8,this.$filledParts=[];let i=this.parts*this.numSegmentsPerPart,s=i-1;this.segmentWidth=(k.ARC_RANGE-s*k.SEGMENT_GAP)/i,this.widthOfSegmentWithGap=this.segmentWidth+k.SEGMENT_GAP;let n=this._getValuePercentage(a,t,r),u=this._getSegmentToPointAt(n,i),h=this._getPercentageValueOfSegment(u%this.numSegmentsPerPart,this._getPartForValue(n));for(let p=0;p<this.parts;p++)this._renderCirclePart(p);this._renderPointer(h),this._renderLegend(t,a,r,e.chartValueGroups[0].groupName),this.$svg.addClass("speedo-chart-svg"),this.chart.config.options.clickable&&this.$svg.on("click",this._createClickObject(null,null),p=>this.chart.handleValueClick(p.data))}_getValuePercentage(e,t,r){return this._limitValue((e-t)/(r-t),1)}_getSegmentToPointAt(e,t){return this._limitValue(Math.floor(e*t),t-1)}_limitValue(e,t){return e=Math.max(e,0),e=Math.min(e,t),e}_getPercentageValueOfSegment(e,t){let r=this._calcSegmentPos(e,t),a=r.from-k.ARC_MIN+(r.to-r.from)/2;return this._limitValue(a/k.ARC_RANGE,1)}_renderPointer(e){if(this.$pointer=this.$svg.appendSVG("path","pointer").attr("d",this._pathPointer(0)).attr("data-end",e).attr("stroke-width",this.scaleWeight/6+"px").attr("fill","none"),this.animationDuration){let t=this,r=function(a,i){let s=this.getAttribute("data-end")*i.pos;t._updatePointer(s),t._updatePartsFill(s)};this.$pointer.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r,this.animationDuration))}else this._updatePointer(e),this._updatePartsFill(e)}_renderSegment(e,t,r){return this.$svg.appendSVG("path","speedo-chart-arc "+r).attr("id","ArcAxisWide"+this.chart.id).attr("fill","none").attr("stroke-width",this.scaleWeight+"px").attr("d",this._pathSegment(e,t))}_renderCirclePart(e){let t=this._getColorForPart(e);for(let r=0;r<this.numSegmentsPerPart;r++){let a=this._calcSegmentPos(r,e);this._renderSegment(a.from,a.to,t)}this.$filledParts.push(this._renderSegment(k.ARC_MIN,k.ARC_MIN,t))}_renderLegend(e,t,r,a){let i=this.scaleWeight*.8,s=5,n=this.my+s,u=n+i*.8,h={x1:null,x2:this.chartBox.mX()-s,y1:null,y2:n,v:-1,h:1},p=e?this._formatValue(e):0,c=t?this._formatValue(t):"0",f=r?this._formatValue(r):0;if(this.chart.config.options.plugins.tooltip.enabled){let m=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()-this.r).attr("y",u).text(p).attr("style","font-size: "+i+"px; text-anchor: middle"),y=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()+this.r).attr("y",u).text(f).attr("style","font-size: "+i+"px; text-anchor: middle"),b=(function(){this.$svg.append(m),this.$svg.append(y)}).bind(this),C=()=>{m.detach(),y.detach()};C(),this.$svg.on("mouseenter",b).on("mouseleave",C)}this.chart.config.options.plugins.legend.display&&this._renderLineLabel(h.x2+s,h.y2+h.v*s,c,"",!1).addClass("speedo-chart-label").attr("style","font-size: "+this.scaleWeight*1.55+"px;"),o.aria.description(this.$svg,this.session.text("ui.SpeedoChartAriaDescription",c,p,f))}_getPartForValue(e){let t=Math.floor(e*this.parts);return this._limitValue(t,this.parts-1)}_formatValue(e){if(e<k.TEN_THOUSAND)return this.session.locale.decimalFormat.format(e);if(e<k.ONE_MILLION)return Math.floor(e/k.ONE_THOUSAND)+"k";let t=e/k.ONE_MILLION;return t=o.numbers.round(t,o.RoundingMode.HALF_UP,2),this.session.locale.decimalFormat.format(t)+"M"}_updatePointer(e){this.$pointer.attr("d",this._pathPointer(e)).removeClass("red yellow light-green dark-green").addClass(this._getColorForPart(this._getPartForValue(e)))}_updatePartsFill(e){let t,r;for(let a=0;a<this.$filledParts.length;a++)t=this._calcSegmentPos(0,a).from,(a+1)/this.parts<e?r=this._calcSegmentPos(this.numSegmentsPerPart-1,a).to:a/this.parts>e?(t=k.ARC_MIN,r=k.ARC_MIN):r=k.ARC_RANGE*e-k.ARC_MAX,this.$filledParts[a].attr("d",this._pathSegment(t,r))}_calcSegmentPos(e,t){let r={from:0,to:0},a=e+t*this.numSegmentsPerPart;return r.from=a*this.widthOfSegmentWithGap-k.ARC_MAX,r.to=r.from+this.segmentWidth,r}_getColorForPart(e){switch(this.chart.config.options.speedo.greenAreaPosition){case k.Position.LEFT:if(e===0)return"dark-green";if(e===1)return"light-green";if(e===2)return"yellow";if(e===3)return"red";break;case k.Position.RIGHT:if(e===0)return"red";if(e===1)return"yellow";if(e===2)return"light-green";if(e===3)return"dark-green";break;case k.Position.CENTER:if(e===0)return"red";if(e===1)return"yellow";if(e===2)return"light-green";if(e===3)return"dark-green";if(e===4)return"light-green";if(e===5)return"yellow";if(e===6)return"red";break;default:break}}_pathSegment(e,t){let r=e*2*Math.PI,a=t*2*Math.PI,i="";return i+="M "+(this.chartBox.mX()+this.r*Math.sin(r))+" "+(this.my-this.r*Math.cos(r))+" ",i+="A "+this.r+" "+this.r+" ",i+="0 "+(t-e<.5?"0":"1")+" 1 ",i+=this.chartBox.mX()+this.r*Math.sin(a)+" "+(this.my-this.r*Math.cos(a)),i}_pathPointer(e){let r=(k.ARC_RANGE*e-k.ARC_MAX)*2*Math.PI,a=this.r-1.4*this.scaleWeight,i=this.r+1.37*this.scaleWeight,s="";return s+="M "+(this.chartBox.mX()+i*Math.sin(r))+" "+(this.my-i*Math.cos(r))+" ",s+="L "+(this.chartBox.mX()+a*Math.sin(r))+" "+(this.my-a*Math.cos(r))+" ",s+="Z",s}_removeAnimated(e){if(this.animationTriggered)return;let t=this,r=function(a,i){let s=this.getAttribute("data-end")*(1-i.pos);t._updatePointer(s),t._updatePartsFill(s)};this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r)).promise().done(()=>{this._remove(e),this.animationTriggered=!1})}}Le=k,O(k,"Position",{LEFT:"left",CENTER:"center",RIGHT:"right"}),O(k,"NUM_PARTS_GREEN_CENTER",7),O(k,"NUM_PARTS_GREEN_EDGE",4),O(k,"ONE_THOUSAND",1e3),O(k,"TEN_THOUSAND",1e4),O(k,"ONE_MILLION",1e6),O(k,"ARC_MIN",-.25),O(k,"ARC_MAX",.25),O(k,"ARC_RANGE",Le.ARC_MAX-Le.ARC_MIN),O(k,"SEGMENT_GAP",.0103);function V(l,e,t){return(e=ft(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function ft(l){var e=mt(l,"string");return typeof e=="symbol"?e:e+""}function mt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Se extends M{constructor(e){super(e),V(this,"segmentSelectorForAnimation",void 0),V(this,"widthThresholdMedium",void 0),V(this,"widthThresholdSmall",void 0),V(this,"barDeltaPercentage",void 0),V(this,"lastBarAdditionalPercentage",void 0),V(this,"lastBarMinWidthPercentage",void 0),V(this,"paddingBetweenLabel",void 0),V(this,"dataAnalyzeResult",void 0),V(this,"barHeight",void 0),V(this,"barAreaWidth",void 0),V(this,"centerX",void 0),V(this,"animationTriggered",void 0),this.segmentSelectorForAnimation=".salesfunnel-chart-bar",this.widthThresholdMedium=400,this.widthThresholdSmall=200,this.barDeltaPercentage=.95,this.lastBarAdditionalPercentage=.7,this.lastBarMinWidthPercentage=.4,this.suppressLegendBox=!0;let t={options:{salesfunnel:{normalized:void 0,calcConversionRate:void 0}}};e.config=g().extend(!0,{},t,e.config)}_validate(){let e=this.chart.data,t=this.chart.config;return!(!e||!t||e.axes.length!==e.chartValueGroups.length||e.chartValueGroups.length===0||e.chartValueGroups[0].values.length===0||t.options.salesfunnel.normalized===void 0||t.options.salesfunnel.calcConversionRate===void 0)}_renderInternal(){let e=this.chart.data,t=e.chartValueGroups.length,r=this._dynamicConversionRateWidth();this.paddingBetweenLabel=20,this.dataAnalyzeResult=this._analyzeData(e.chartValueGroups),this.barHeight=this.chartBox.height/t,this.barAreaWidth=this.chartBox.width-this.dataAnalyzeResult.maxLengthFirstValueRow-this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount-this.dataAnalyzeResult.maxLengthSecondValueRow-r,this.centerX=this.barAreaWidth/2,this.chart.config.options.salesfunnel.normalized?this._renderBarsNormalized(e.chartValueGroups):this._renderBarsAccordingToValues(e.chartValueGroups),this._addClipping("salesfunnel-chart-bar")}_renderBarsNormalized(e){let t=e.length,r=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*(this.dataAnalyzeResult.labelCount+1),a=this.barAreaWidth*(1-this.barDeltaPercentage),s=this.barAreaWidth*this.lastBarMinWidthPercentage/this.lastBarAdditionalPercentage;a=Math.min(a,(this.barAreaWidth-s)/(t-1));for(let n=0;n<t;n++){let u=this.barAreaWidth-n*a,h=e[n].groupName,p=this.barAreaWidth-(n+1)*a,c=n*this.barHeight,f={xStart:this.centerX,yStart:c,rect:!0,width:u,widthBottom:p,cssClass:"salesfunnel-chart-bar",fill:o.arrays.ensure(e[n].colorHexValue)[0],label:e[n].groupName,clickObject:this._createClickObject(null,n)};this.chart.config.options.autoColor?f.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[n].cssClass&&(f.cssClass+=" "+this.chart.data.chartValueGroups[n].cssClass),n===t-1&&(f.width=f.width*this.lastBarAdditionalPercentage,f.widthBottom=f.widthBottom*this.lastBarAdditionalPercentage),this._renderPolygon(f),this._renderLabel(e[n].values[0],!1,n),this._renderBarLabel(h,n,f.widthBottom);let m=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;e[n].values.length>1&&(this._renderLabel(e[n].values[1],!0,n),m+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),n>0&&(this._renderLabelSeparatorLine(c,m),this.chart.config.options.salesfunnel.calcConversionRate&&this._renderConversionRate(n,r,this._calcConversionRate(e[n-1].values[0],e[n].values[0])))}}_renderLabel(e,t,r){if(e===null)return;let a=r*this.barHeight+this.barHeight/2,i=this.dataAnalyzeResult.maxLengthFirstValueRow+(t?this.dataAnalyzeResult.maxLengthSecondValueRow:0),s=t?2:1,n=this.barAreaWidth+i+s*this.paddingBetweenLabel,u=this._dynamicCssClass("salesfunnel-label"),h=this.$svg.appendSVG("text",u).attr("x",n).attr("y",a).text(this.session.locale.decimalFormat.format(e));if(this.animationDuration&&h.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),this.chart.config.options.plugins.tooltip.enabled&&this.chart.data.axes.length>0){let p=this.chart.data.axes[r][t?1:0].label,c=this._measureText(""+e,u);this._renderWireLabels(p,h,n-c.width/2,a-c.height)}}_renderWireLabels(e,t,r,a){let i={x1:r,x2:r-10,y1:a,y2:a-10,v:-1,h:-1},s=(p,c)=>(i.y2-c<0&&(i.v=1,i.y1=i.y1+c*1.5,i.y2=i.y1+10),i);i.autoPosition=!0,i.posFunc=s;let n=this._renderWireLegend(e,i,"line-chart-wire-label",!0),u=n.attachFunc.bind(n),h=n.detachFunc.bind(n);n.detachFunc(),t.on("mouseenter",u).on("mouseleave",h)}_renderBarLabel(e,t,r){let a=t*this.barHeight+this.barHeight/2,i=this.centerX,s=this._dynamicCssClass("salesfunnel-bar-label");this._renderLineLabel(i,a,e,s,!0)}_renderConversionRate(e,t,r){if(r===void 0)return;let a=e*this.barHeight,i=this._dynamicCssClass("salesfunnel-conversionrate-label"),s=this.$svg.appendSVG("text",i).attr("x",t).attr("y",a).text("↓ "+r+"%");this.animationDuration&&s.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_renderPolygon(e){let t=this,r=this._calcPolygonPoints(!0,this.animationDuration?0:1,e.xStart,e.yStart,e.width,e.widthBottom,this.barHeight-1),a=this.$svg.appendSVG("polygon",e.cssClass,"",e.id).attr("points",r).data("xStart",e.xStart).data("yStart",e.yStart).data("widthBar",e.width).data("widthBottom",e.widthBottom).data("heightBar",this.barHeight);!this.chart.config.options.autoColor&&e.fill&&a.attr("fill",e.fill),a.css("stroke",this.firstOpaqueBackgroundColor);let i=function(s,n){let u=g()(this),h=u.data("xStart"),p=u.data("yStart"),c=u.data("widthBar"),f=u.data("heightBar"),m=u.data("widthBottom");u.attr("points",t._calcPolygonPoints(!0,n.pos,h,p,c,m,f))};return this.animationDuration&&a.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(i,this.animationDuration)),this.chart.config.options.clickable&&a.on("click",e.clickObject,s=>this.chart.handleValueClick(s.data)),e.fill&&a.attr("fill",e.fill),a}_calcPolygonPoints(e,t,r,a,i,s,n){let u=0,h=0;return e?(u=i/2*t,h=s/2*t):(u=i/2-i/2*t,h=s/2-s/2*t),o.strings.join(" ",r-u+","+a,r+u+","+a,r+h+","+(a+n),r-h+","+(a+n))}_renderBarsAccordingToValues(e){let t=this.dataAnalyzeResult.maxValue?this.barAreaWidth*.8/this.dataAnalyzeResult.maxValue:0,r=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount+2*this.paddingBetweenLabel,a=e.length;for(let i=0;i<a;i++){let s=e[i].values[0]*t+this.barAreaWidth*.2,n=e[i].groupName,u=i*this.barHeight,h={xStart:this.centerX,yStart:u,rect:!0,width:s,widthBottom:s,cssClass:"salesfunnel-chart-bar",fill:o.arrays.ensure(e[i].colorHexValue)[0],label:e[i].groupName,clickObject:this._createClickObject(null,i)};this.chart.config.options.autoColor?h.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[i].cssClass&&(h.cssClass+=" "+this.chart.data.chartValueGroups[i].cssClass),this._renderPolygon(h),this._renderLabel(e[i].values[0],!1,i),this._renderBarLabel(n,i,h.widthBottom);let p=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;e[i].values.length>1&&(this._renderLabel(e[i].values[1],!0,i),p+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),i>0&&(this._renderLabelSeparatorLine(u,p),this.chart.config.options.salesfunnel.calcConversionRate&&this._renderConversionRate(i,r,this._calcConversionRate(e[i-1].values[0],e[i].values[0])))}}_renderLabelSeparatorLine(e,t){let r=this.$svg.appendSVG("line","label-separator").attr("x1",this.barAreaWidth+this.paddingBetweenLabel).attr("y1",e).attr("x2",this.barAreaWidth+t).attr("y2",e);this.animationDuration&&r.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_calcConversionRate(e,t){if(!(o.objects.isNullOrUndefined(e)||o.objects.isNullOrUndefined(t)||e===0))return Math.round(t/e*100)}_analyzeData(e){let t={labelCount:0,maxValue:null,maxLengthFirstValueRow:0,maxLengthSecondValueRow:0},r=this._dynamicCssClass("salesfunnel-label");for(let a=0;a<e.length;a++){let i=e[a];t.labelCount=Math.max(t.labelCount,i.values.length),i.values.length>0&&i.values[0]&&(t.maxValue===null?t.maxValue=i.values[0]:t.maxValue=Math.max(t.maxValue,i.values[0]),t.maxLengthFirstValueRow=Math.max(t.maxLengthFirstValueRow,this._measureText(this.session.locale.decimalFormat.format(i.values[0]),r).width)),i.values.length>1&&i.values[1]&&(t.maxLengthSecondValueRow=Math.max(t.maxLengthSecondValueRow,this._measureText(this.session.locale.decimalFormat.format(i.values[1]),r).width))}return t}_removeAnimated(e){if(this.animationTriggered)return;this.animationTriggered=!0;let t=this,r=function(a,i){let s=g()(this),n=s.data("xStart"),u=s.data("yStart"),h=s.data("widthBar"),p=s.data("heightBar"),c=s.data("widthBottom");s.attr("points",t._calcPolygonPoints(!1,i.pos,n,u,h,c,p))};this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r)).promise().done(()=>{this._remove(e),this.animationTriggered=!1})}_dynamicCssClass(e){let t="";return this.chartBox.width<=this.widthThresholdSmall?t="small":this.chartBox.width<=this.widthThresholdMedium&&(t="medium"),o.strings.join(" ",e,t)}_dynamicConversionRateWidth(){return this.chart.config.options.salesfunnel.calcConversionRate?this.chartBox.width<=this.widthThresholdSmall?60:this.chartBox.width<=this.widthThresholdMedium?80:100:0}}function P(l,e,t){return(e=bt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function bt(l){var e=yt(l,"string");return typeof e=="symbol"?e:e+""}function yt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Oe{constructor(e,t,r,a,i,s,n,u,h,p,c,f,m,y){P(this,"helper",void 0),P(this,"venn1",void 0),P(this,"venn2",void 0),P(this,"venn3",void 0),P(this,"u",void 0),P(this,"v",void 0),P(this,"w",void 0),P(this,"uv",void 0),P(this,"uw",void 0),P(this,"vw",void 0),P(this,"uvw",void 0),P(this,"maxD",void 0),P(this,"dStep",void 0),P(this,"rStep",void 0),P(this,"alphaStep",void 0),P(this,"alphaBest",void 0),P(this,"dBest",void 0),P(this,"rBest",void 0),P(this,"errorBest",void 0),P(this,"callback",void 0),P(this,"cancelled",void 0),i===0&&u===0&&h===0&&c===0&&(i=1),s===0&&u===0&&p===0&&c===0&&(s=1),n===0&&h===0&&p===0&&c===0&&(n=1),this.helper=e,this.venn1=t,this.venn2=r,this.venn3=a,this.u=i,this.v=s,this.w=n,this.uv=u,this.uw=h,this.vw=p,this.uvw=c,this.maxD=this.venn1.r+2*this.venn2.r+2*this.venn1.r+this.helper.distR,this.dStep=this.maxD/30,this.rStep=a.r/4,this.alphaStep=Math.PI/30,this.alphaBest=0,this.dBest=0,this.rBest=0,this.errorBest=0,this.callback=null,this.cancelled=!1}start(e){this.callback=e,setTimeout(this._next.bind(this,0))}cancel(){this.cancelled=!0}_end(){this.venn3.x=this.venn1.x+this.dBest*Math.cos(this.alphaBest),this.venn3.y=this.venn1.y-this.dBest*Math.sin(this.alphaBest),this.venn3.r=this.rBest,this.callback()}_next(e){this.cancelled||this._iteration(e),!this.cancelled&&(e+=this.alphaStep,e<Math.PI?setTimeout(this._next.bind(this,e)):this._end())}_iteration(e){let t=this.maxD,r=this.dStep,a=this.helper.minR,i=this.rStep,s=this.helper.total,n=this.venn1.x,u=this.venn1.y,h=this.venn1.r,p=this.venn2.x,c=this.venn2.y,f=this.venn2.r,m=this.venn3.r,y=this.u,b=this.v,C=this.w,_=this.uv,x=this.uw,v=this.vw,T=this.uvw,I=this.alphaBest,W=this.dBest,z=this.rBest,U=this.errorBest;for(let j=0;j<t;j+=r){let w=n+j*Math.cos(e),ee=u-j*Math.sin(e);for(let H=Math.max(a,m*.75);H<=m*1.25;H+=i){let le=Math.min(n-h,p-f,w-H),G=Math.max(n+h,p+f,w+H),de=Math.min(u-h,c-f,ee-H),ue=Math.max(u+h,c+f,ee+H),$e=(G-le)/100,Ue=(ue-de)/100,be=0,ye=0,_e=0,ge=0,Ce=0,xe=0,Te=0;for(let q=le;q<G;q+=$e)for(let K=de;K<ue;K+=Ue){let re=(q-n)*(q-n)+(K-u)*(K-u)<h*h,ae=(q-p)*(q-p)+(K-c)*(K-c)<f*f,ie=(q-w)*(q-w)+(K-ee)*(K-ee)<H*H;re&&ae&&ie?Te++:re&&ae&&!ie?ge++:re&&!ae&&!ie?be++:!re&&ae&&!ie?ye++:re&&!ae&&ie?Ce++:!re&&ae&&ie?xe++:!re&&!ae&&ie&&_e++}let te=be+ye+_e+ge+Ce+xe+Te,X=j/t;X+=this._error(T,s,Te,te),X+=this._error(_,s,ge,te),X+=this._error(x,s,Ce,te),X+=this._error(v,s,xe,te),X+=this._error(y,s,be,te),X+=this._error(b,s,ye,te),X+=this._error(C,s,_e,te),(e===0||X<U)&&(I=e,W=j,z=H,U=X)}}this.alphaBest=I,this.dBest=W,this.rBest=z,this.errorBest=U}_error(e,t,r,a){return e===0&&r!==0||e!==0&&r===0?1e3:Math.abs(e/t-r/a)*100}}function me(l,e,t){return(e=_t(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function _t(l){var e=gt(l,"string");return typeof e=="symbol"?e:e+""}function gt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Pe{constructor(e,t,r,a){me(this,"distR",void 0),me(this,"maxR",void 0),me(this,"minR",void 0),me(this,"total",void 0),this.distR=e,this.maxR=t,this.minR=r,this.total=a}findBalance2(e,t){let r=(e.r*e.x+t.r*t.x)/(e.r+t.r),a=(e.r*e.y+t.r*t.y)/(e.r+t.r);e.x=e.x-r,t.x=t.x-r,e.y=e.y-a,t.y=t.y-a}findBalance3(e,t,r){let a=(e.r*e.x+t.r*t.x+r.r*r.x)/(e.r+t.r+r.r),i=(e.r*e.y+t.r*t.y+r.r*r.y)/(e.r+t.r+r.r);e.x=e.x-a,t.x=t.x-a,r.x=r.x-a,e.y=e.y-i,t.y=t.y-i,r.y=r.y-i}calcR(e,t){return e===-1?this.maxR*t:Math.max(this.minR,Math.sqrt(e/this.total)*this.maxR*t)}calcD(e,t,r,a,i,s){let n;if(i===0)n=e.r+t.r+this.distR*2;else if(r===0&&a===0)n=0;else if(r===0)n=Math.max(0,t.r-e.r-this.distR),n<1.5*this.distR&&s&&(n=1.5*this.distR,e.r=t.r-n);else if(a===0)n=Math.max(0,e.r-t.r-this.distR),n<1.5*this.distR&&s&&(n=1.5*this.distR,t.r=e.r-n);else{let u=Math.min(e.r,t.r),h=Math.max(e.r,t.r);n=2*(Math.min(r,a)/(Math.min(r,a)+i))*u-u+h,n=Math.max(3*this.distR,n),n=Math.min(u+h-3*this.distR,n),n=Math.max(h-u+3*this.distR,n)}return n}}function D(l,e,t){return(e=Ct(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Ct(l){var e=xt(l,"string");return typeof e=="symbol"?e:e+""}function xt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class De extends M{constructor(e){super(e),D(this,"animationTriggered",void 0),D(this,"data",void 0),D(this,"centerX",void 0),D(this,"centerY",void 0),D(this,"numberOfCircles",void 0),D(this,"readyToDraw",void 0),D(this,"wasCircle",void 0),D(this,"vennCircleHelper",void 0),D(this,"async3Calculator",void 0),D(this,"vennNumber1",void 0),D(this,"vennReal1",void 0),D(this,"vennNumber2",void 0),D(this,"vennReal2",void 0),D(this,"vennNumber3",void 0),D(this,"vennReal3",void 0),D(this,"$v1",void 0),D(this,"$v2",void 0),D(this,"$v3",void 0),this.animationTriggered=!1,this.suppressLegendBox=!0;let t={options:{venn:{numberOfCircles:void 0}}};e.config=g().extend(!0,{},t,e.config)}_validate(){let e=this.chart.data;return!(!e||e.axes.length!==0||e.chartValueGroups.length===0||e.chartValueGroups[0].values.length===0)}_renderInternal(){if(this.centerX=this.width/2,this.centerY=this.height/2,this.centerX===0||this.centerY===0)return;this.data=this.chart.data.chartValueGroups,this.numberOfCircles=this.chart.config.options.venn.numberOfCircles;let e=10,t=Math.min(this.centerX,this.centerY),r=t/15,a=this.data.reduce((n,u)=>n+u.values[0],1);this.vennCircleHelper=new Pe(e,t,r,a),this.numberOfCircles>0&&(this.$v1=this._createCircle(0,o.arrays.ensure(this.data[0].colorHexValue)[0],this.data[0].cssClass),this.vennNumber1=new Z(this.$v1),this.vennReal1=new Z(this.$v1)),this.numberOfCircles>1&&(this.$v2=this._createCircle(1,o.arrays.ensure(this.data[1].colorHexValue)[0],this.data[1].cssClass),this.vennNumber2=new Z(this.$v2),this.vennReal2=new Z(this.$v2)),this.numberOfCircles>2&&(this.$v3=this._createCircle(2,o.arrays.ensure(this.data[2].colorHexValue)[0],this.data[2].cssClass),this.vennNumber3=new Z(this.$v3),this.vennReal3=new Z(this.$v3));const i=this.animationDuration;let s=(function(){if(this.readyToDraw=!0,!this.$svg.isAttached())return;this.readyToDraw=!1;const n=this.animationDuration;this.setAnimationDuration(i),this._draw(!0,!0),this.setAnimationDuration(n)}).bind(this);this.readyToDraw=!1,this.numberOfCircles===1?(this._calc1(this.vennNumber1),this._calc1(this.vennReal1),s()):this.numberOfCircles===2?(this._calc2(this.vennNumber1,this.vennNumber2,!1),this._calc2(this.vennReal1,this.vennReal2,!0),s()):this.numberOfCircles===3&&this._calc3(this.vennNumber1,this.vennNumber2,this.vennNumber3,!1,()=>{(this.rendering||this.rendered)&&this._calc3(this.vennReal1,this.vennReal2,this.vennReal3,!0,s)})}remove(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=arguments.length>1?arguments[1]:void 0;this._cancelAsync3Calculator(),super.remove(e,t)}_calc1(e){let t=this.data[0].values[0];t>0?e.r=this.vennCircleHelper.calcR(t,.8):e.r=this.vennCircleHelper.calcR(t,0),e.x=0,e.y=0,e.setLegend(this.data[0].groupName,1,-1),e.addLabel(t,e.x,e.y)}_calc2(e,t,r){let a=this.data[0].values[0],i=this.data[1].values[0],s=this.data[2].values[0],n;r?(e.r=this.vennCircleHelper.calcR(a+s,.8),t.r=this.vennCircleHelper.calcR(i+s,.8),n=this.vennCircleHelper.calcD(e,t,a,i,s,!0),e.x=0,t.x=n):(e.r=t.r=this.vennCircleHelper.calcR(-1,.7),e.x=-e.r*.6,t.x=t.r*.6),e.y=0,t.y=0,this.vennCircleHelper.findBalance2(e,t),e.setLegend(this.data[0].groupName,-1,-1),t.setLegend(this.data[1].groupName,1,-1),r?s===0?(e.addLabel(a,e.x,e.y),t.addLabel(i,t.x,t.y)):a===0&&i===0?e.addLabel(s,e.x,e.y):a===0?(t.addLabel(s,e.x,e.y),t.addLabel(i,t.x-(n-t.r-e.r)/2,t.y),e.legendR=t.r-n):i===0?(e.addLabel(s,t.x,t.y),e.addLabel(a,e.x+(n-t.r-e.r)/2,e.y),t.legendR=e.r-n):(e.addLabel(a,e.x+(n-t.r-e.r)/2,e.y),e.addLabel(i,t.x-(n-t.r-e.r)/2,t.y),t.addLabel(s,e.x+e.r+(n-t.r-e.r)/2,e.y)):(e.addLabel(a,-e.r*.9,0),e.addLabel(i,e.r*.9,0),t.addLabel(s,0,0))}_calc3(e,t,r,a,i){let s=this.data[0].values[0],n=this.data[1].values[0],u=this.data[2].values[0],h=this.data[3].values[0],p=this.data[4].values[0],c=this.data[5].values[0],f=this.data[6].values[0],m,y,b;a?(e.r=this.vennCircleHelper.calcR(s+h+p+f,.55),t.r=this.vennCircleHelper.calcR(n+h+c+f,.55),r.r=this.vennCircleHelper.calcR(u+p+c+f,.55),m=this.vennCircleHelper.calcD(e,t,s+p,n+c,h+f,!0),y=this.vennCircleHelper.calcD(e,r,s+h,u+c,h+f,!1),b=this.vennCircleHelper.calcD(t,r,n+h,u+p,h+f,!1),e.x=0,t.x=m,r.x=y,e.y=0,t.y=0,r.y=0,this._cancelAsync3Calculator(),this.async3Calculator=new Oe(this.vennCircleHelper,e,t,r,s,n,u,h,p,c,f,m,y,b),this.async3Calculator.start(()=>{this.async3Calculator=null,this.vennCircleHelper.findBalance3(e,t,r),e.setLegend(this.data[0].groupName,-1,1),t.setLegend(this.data[1].groupName,1,1),r.setLegend(this.data[2].groupName,1,-1),i()})):(e.r=t.r=r.r=this.vennCircleHelper.calcR(-1,.55),e.x=-e.r*.73,t.x=t.r*.73,r.x=0,e.y=e.r*.58,t.y=t.r*.58,r.y=-r.r*.58,e.setLegend(this.data[0].groupName,-1,1),t.setLegend(this.data[1].groupName,1,1),r.setLegend(this.data[2].groupName,1,-1),e.addLabel(s,-e.r,e.r*.76),t.addLabel(n,e.r,e.r*.76),r.addLabel(u,0,-e.r*.82),e.addLabel(h,0,e.r*.76),e.addLabel(p,-e.r*.49,-e.r*.05),t.addLabel(c,e.r*.49,-e.r*.05),e.addLabel(f,0,e.r*.22),i())}_cancelAsync3Calculator(){this.async3Calculator&&(this.async3Calculator.cancel(),this.async3Calculator=null)}_draw(e,t){if(!this.rendered&&!this.rendering||this.animationTriggered)return;this.animationTriggered=!0;let r=this;this.$svg.children(".venn-legend, .venn-label, .venn-axis-white, .label-line").stop().animateSVG("opacity",1,0,null,!0).promise().done(function(){this.remove(),r.animationTriggered=!1});let a=[];this.numberOfCircles>0&&a.push(t?this.vennReal1:this.vennNumber1),this.numberOfCircles>1&&a.push(t?this.vennReal2:this.vennNumber2),this.numberOfCircles>2&&a.push(t?this.vennReal3:this.vennNumber3);for(let i=0;i<a.length;i++){let s=a[i];this._updateVenn(s,e);for(let n=0;n<s.labels.length;n++){let u=s.labels[n];this._drawLabel(u.text,u.x,u.y,e)}}}_createCircle(e,t,r){let a=this.$svg.appendSVG("circle","venn-circle").attr("cx",this.centerX).attr("cy",this.centerY).attr("r",0).on("mouseenter",{showReal:!1},this._show.bind(this)).on("mouseleave",{showReal:!0},this._show.bind(this));return this.chart.config.options.autoColor?a.addClass("auto-color color0"):r?a.addClass(r):a.attr("fill",t),this.chart.config.options.clickable&&a.on("click",this._createClickObject(null,e),i=>this.chart.handleValueClick(i.data)),a}_updateVenn(e,t){e.$circle.animateSVG("cx",this.centerX+e.x,t?this.animationDuration:0,null,!0).animateSVG("cy",this.centerY+e.y,t?this.animationDuration:0,null,!0).animateSVG("r",e.r,t?this.animationDuration:0,null,!0);let r=this.vennCircleHelper.minR,a=this.centerX+e.x+e.legendH*Math.sin(Math.PI/5)*e.r,i=this.centerY+e.y+e.legendV*Math.cos(Math.PI/5)*e.r,s=this.centerX+e.x+e.legendH*Math.sin(Math.PI/5)*(e.legendR+r*1.5),n=this.centerY+e.y+e.legendV*Math.cos(Math.PI/5)*(e.legendR+r*1.5),u={x1:a,x2:s,y1:i,y2:n,v:e.legendV,h:e.legendH};this._renderWireLegend(e.legend,u,"venn-legend")}_drawLabel(e,t,r,a){let i=this.$svg.appendSVG("text","venn-label").attr("x",this.centerX+t).attr("y",this.centerY+r).text(e);a&&this.animationDuration&&i.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_show(e){if(this.numberOfCircles===1)return;let t=e.type==="mouseenter"?e.target:e.relatedTarget,r=t&&g()(t).hasClass("venn-circle");this.wasCircle&&r||(this.wasCircle=r,this._draw(!0,e.data.showReal))}}function Y(l,e,t){return(e=Tt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Tt(l){var e=vt(l,"string");return typeof e=="symbol"?e:e+""}function vt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Z{constructor(e){Y(this,"labels",void 0),Y(this,"$circle",void 0),Y(this,"x",void 0),Y(this,"y",void 0),Y(this,"r",void 0),Y(this,"legend",void 0),Y(this,"legendR",void 0),Y(this,"legendH",void 0),Y(this,"legendV",void 0),this.$circle=e,this.labels=[]}setLegend(e,t,r,a){this.legend=e,this.legendH=t,this.legendV=r,this.legendR=a||this.r}addLabel(e,t,r){this.labels.push({text:e,x:t,y:r})}}function At(l,e,t){return(e=kt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function kt(l){var e=Rt(l,"string");return typeof e=="symbol"?e:e+""}function Rt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class He extends o.FormField{constructor(){super(),At(this,"chart",void 0),this._addWidgetProperties(["chart"]),this.chart=null}_render(){this.addContainer(this.$parent,"chart-field"),this.addLabel(),this.addMandatoryIndicator(),this.addStatus(),this._renderChart()}_renderChart(){this.chart&&(this.chart.render(),this.addField(this.chart.$container))}_removeChart(){this.chart.remove(),this._removeField()}_linkWithLabel(e){}}class Ne extends o.FormFieldAdapter{}function Bt(l,e,t){return(e=Lt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Lt(l){var e=St(l,"string");return typeof e=="symbol"?e:e+""}function St(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Fe extends o.FormFieldTile{constructor(){super(),Bt(this,"_chartConfigChangeHandler",void 0),this._chartConfigChangeHandler=this._onChartConfigChange.bind(this)}_setColorScheme(e){super._setColorScheme(e),this._updateChartColorScheme()}_updateChartColorScheme(){let e=$.extend(!0,{},this.tileWidget.chart.config,{options:{colorScheme:this.colorScheme}});this.tileWidget.chart.setConfig(e)}_onChartConfigChange(e){this._updateChartColorScheme()}_setTileWidget(e){this.tileWidget&&this.tileWidget.chart.off("propertyChange:config",this._chartConfigChangeHandler),super._setTileWidget(e),this._updateChartColorScheme(),this.tileWidget.chart.on("propertyChange:config",this._chartConfigChangeHandler)}}class Ve extends o.FormFieldTileAdapter{}function S(l,e,t){return(e=Ot(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Ot(l){var e=Pt(l,"string");return typeof e=="symbol"?e:e+""}function Pt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class oe extends o.TableControl{constructor(){super(),S(this,"chartAggregation",void 0),S(this,"chartGroup1",void 0),S(this,"chartGroup2",void 0),S(this,"chartType",void 0),S(this,"oldChartType",void 0),S(this,"chart",void 0),S(this,"chartColorScheme",void 0),S(this,"xAxis",void 0),S(this,"yAxis",void 0),S(this,"dateGroup",void 0),S(this,"$chartSelect",void 0),S(this,"$axisSelectContainer",void 0),S(this,"$xAxisSelect",void 0),S(this,"$yAxisSelect",void 0),S(this,"$dataSelect",void 0),S(this,"_chartTypeMap",void 0),S(this,"_aggregationMap",void 0),S(this,"_chartGroup1Map",void 0),S(this,"_chartGroup2Map",void 0),S(this,"_tableUpdatedHandler",void 0),S(this,"_tableColumnStructureChangedHandler",void 0),S(this,"_chartValueClickedHandler",void 0),S(this,"_filterResetListener",void 0),S(this,"_tableUpdatedTimeOutId",void 0),this.iconId=o.icons.CHART,this.tooltipText="${textKey:ui.Chart}",this.chartAggregation={modifier:o.TableMatrix.NumberGroup.COUNT},this.chartType=d.Type.BAR,this.oldChartType=null,this.chart=null,this.chartColorScheme="chart-table-control",this.$chartSelect=null,this.$xAxisSelect=null,this.$yAxisSelect=null,this.$dataSelect=null,this.xAxis=null,this.yAxis=null,this.dateGroup=null,this._tableUpdatedHandler=this._onTableUpdated.bind(this),this._tableColumnStructureChangedHandler=this._onTableColumnStructureChanged.bind(this),this._chartValueClickedHandler=this._onChartValueClick.bind(this)}_init(e){super._init(e),this.table.on("columnStructureChanged",this._tableColumnStructureChangedHandler),this.chart=o.scout.create(d,{parent:this})}_destroy(){this.table.off("columnStructureChanged",this._tableColumnStructureChangedHandler),super._destroy()}_computeEnabled(e,t){return!this._hasColumns()&&!this.selected?!1:super._computeEnabled(e,t)}_renderChart(){this.chart&&(this.chart.render(this.$contentContainer),this.chart.$container.addClass(this.denseClass))}_createLayout(){return new Ee(this)}_renderChartType(){this._selectChartType(),this.$yAxisSelect.toggleClass("hide",this.chartType!==d.Type.BUBBLE),this.$yAxisSelect.toggleClass("animated",o.scout.isOneOf(d.Type.BUBBLE,this.chartType,this.oldChartType)&&!!this.oldChartType),this.$yAxisSelect.data("scroll-shadow").setVisible(!1),this.$yAxisSelect.oneAnimationEnd(()=>{o.scrollbars.update(this.$yAxisSelect),this.$yAxisSelect.data("scroll-shadow").setVisible(!0),this.$yAxisSelect.removeClass("animated")}),this.contentRendered&&this.chart.$container.animateAVCSD("opacity",0,()=>{this.chart.$container.css("opacity",1),this._drawChart()})}_selectChartType(){o.objects.values(this._chartTypeMap).forEach(e=>{e.removeClass("selected")}),this._chartTypeMap[this.chartType].addClass("selected")}_renderChartGroup1(){this._renderChartGroup(1)}_renderChartGroup2(){this._renderChartGroup(2)}_renderChartGroup(e){if(!this._hasColumns())return;let t="chartGroup"+e,r="_"+t+"Map",a=this[t];if(a){let i=this[r][a.id];if(i.siblings(".select-axis").animateAVCSD("height",30),i.selectOne("selected"),a.modifier>0){let s=a.modifier^oe.DATE_GROUP_FLAG;i.animateAVCSD("height",42),i.children(".select-axis-group").text(this.dateGroup[s][1])}this.contentRendered&&this._drawChart()}}_renderChartAggregation(){let e=this._aggregationMap[this.chartAggregation.id||"all"];e&&(e.selectOne(),e.removeClass("data-sum").removeClass("data-avg"),e.addClass(this._getAggregationCssClass()),this.contentRendered&&this._drawChart())}_getAggregationCssClass(){switch(this.chartAggregation.modifier){case o.TableMatrix.NumberGroup.COUNT:return"data-count";case o.TableMatrix.NumberGroup.SUM:return"data-sum";case o.TableMatrix.NumberGroup.AVG:return"data-avg";default:return null}}_renderChartSelect(e,t,r){let a=o.scout.create(o.Icon,{parent:this,iconDesc:r,cssClass:e});a.render(this.$chartSelect),this.$contentContainer.one("remove",()=>a.destroy());let i=a.$container;i.toggleClass("disabled",!this.enabledComputed||!this._hasColumns()).data("chartType",t),this.enabledComputed&&this._hasColumns()&&i.on("click",this._onClickChartType.bind(this)),this._chartTypeMap[t]=i}_renderChartSelectContainer(){this.$chartSelect=this.$contentContainer.appendDiv("chart-select"),this._chartTypeMap={};let e=this._getSupportedChartTypes();o.scout.isOneOf(d.Type.BAR,e)&&this._renderChartSelect("chart-bar",d.Type.BAR,o.icons.DIAGRAM_BARS_VERTICAL),o.scout.isOneOf(d.Type.BAR_HORIZONTAL,e)&&this._renderChartSelect("chart-stacked",d.Type.BAR_HORIZONTAL,o.icons.DIAGRAM_BARS_HORIZONTAL),o.scout.isOneOf(d.Type.LINE,e)&&this._renderChartSelect("chart-line",d.Type.LINE,o.icons.DIAGRAM_LINE),o.scout.isOneOf(d.Type.PIE,e)&&this._renderChartSelect("chart-pie",d.Type.PIE,o.icons.DIAGRAM_PIE),o.scout.isOneOf(d.Type.BUBBLE,e)&&this._renderChartSelect("chart-bubble",d.Type.BUBBLE,o.icons.DIAGRAM_SCATTER)}_getSupportedChartTypes(){return[d.Type.BAR,d.Type.BAR_HORIZONTAL,d.Type.LINE,d.Type.PIE,d.Type.BUBBLE]}_onClickChartType(e){let t=g()(e.currentTarget),r=t.data("chartType");this.setChartType(r)}_onClickChartGroup(e){let t=g()(e.currentTarget),r=t.parent().data("groupId"),a=t.data("column"),i=t.data("modifier");if(!t.isEnabled())return;let s=t.isSelected()?this._nextDateModifier(i):i;t.data("modifier",s);let n={id:a?a.id:null,modifier:s};this._setChartGroup(r,n)}_onClickAggregation(e){let t=g()(e.currentTarget),r=t.data("modifier"),a=t.isSelected()?this._nextModifier(r):r;t.data("modifier",a);let i=t.data("column"),s={id:i?i.id:null,modifier:a};this._setChartAggregation(s)}_nextDateModifier(e){switch(e){case o.TableMatrix.DateGroup.DATE:return o.TableMatrix.DateGroup.MONTH;case o.TableMatrix.DateGroup.MONTH:return o.TableMatrix.DateGroup.WEEKDAY;case o.TableMatrix.DateGroup.WEEKDAY:return o.TableMatrix.DateGroup.YEAR;case o.TableMatrix.DateGroup.YEAR:return o.TableMatrix.DateGroup.DATE;default:return e}}_nextModifier(e){switch(e){case o.TableMatrix.NumberGroup.SUM:return o.TableMatrix.NumberGroup.AVG;case o.TableMatrix.NumberGroup.AVG:return o.TableMatrix.NumberGroup.SUM;default:return e}}_setChartAggregation(e){e!==this.chartAggregation&&(this._setProperty("chartAggregation",e),this.contentRendered&&this._renderChartAggregation())}_setChartGroup1(e){this._setChartGroup(1,e)}_setChartGroup2(e){this._setChartGroup(2,e)}_setChartGroup(e,t){let r="chartGroup"+e;this._changeProperty(r,t)}_changeProperty(e,t){t!==this[e]&&(this._setProperty(e,t),this.contentRendered&&this["_render"+e.charAt(0).toUpperCase()+e.slice(1)]())}setChartType(e){this.oldChartType=this.chartType,this.setProperty("chartType",e)}_hasColumns(){return this._columns().length>0}_columns(){return new o.TableMatrix(this.table,this.session).columns()}_axisCount(e,t){let r;for(let a=0;a<e.length;a++)if(r=e[a][0],r===t)return e[a][1];return 0}_plainAxisText(e,t){return e.headerHtmlEnabled?o.strings.plainText(t).replace(/\n/g," "):t}_renderContent(e){this.$contentContainer=e.appendDiv("chart-container"),this._installScrollbars(),this._renderChartSelectContainer(),this.dateGroup=[[o.TableMatrix.DateGroup.YEAR,this.session.text("ui.groupedByYear")],[o.TableMatrix.DateGroup.MONTH,this.session.text("ui.groupedByMonth")],[o.TableMatrix.DateGroup.WEEKDAY,this.session.text("ui.groupedByWeekday")],[o.TableMatrix.DateGroup.DATE,this.session.text("ui.groupedByDate")]],this._filterResetListener=this.table.on("filterReset",r=>{this.chart&&this.chart.setCheckedItems([])}),this._addListeners(),this._renderAxisSelectorsContainer();let t=this._renderAxisSelectors();this._renderChart(),this._initializeSelection(t),this._renderChartParts(),this._drawChart()}_addListeners(){this.table.on("rowsInserted",this._tableUpdatedHandler),this.table.on("rowsDeleted",this._tableUpdatedHandler),this.table.on("allRowsDeleted",this._tableUpdatedHandler),this.chart.on("valueClick",this._chartValueClickedHandler)}_renderAxisSelectorsContainer(){this.$axisSelectContainer=this.$contentContainer.appendDiv("axis-select-container")}_renderAxisSelectors(){this.$xAxisSelect=this.$axisSelectContainer.appendDiv("xaxis-select").data("groupId",1),o.scrollbars.install(this.$xAxisSelect,{parent:this,session:this.session,axis:"y"}),this.$yAxisSelect=this.$axisSelectContainer.appendDiv("yaxis-select").data("groupId",2),o.scrollbars.install(this.$yAxisSelect,{parent:this,session:this.session,axis:"y"}),this._chartGroup1Map={},this._chartGroup2Map={};let e=new o.TableMatrix(this.table,this.session),t=e.columnCount(!1);t.sort((n,u)=>Math.abs(n[1]-8)-Math.abs(u[1]-8));let r,a,i=0,s=e.columns(!1);for(let n=0;n<s.length;n++){let u,h,p,c=s[n];c instanceof o.DateColumn?a=!0:(r=this._axisCount(t,c),a=r<=oe.MAX_AXIS_COUNT),u=this._axisContentForColumn(c),h=this.$contentContainer.makeDiv("select-axis",this._plainAxisText(c,u.text)).data("column",c).setEnabled(a),a||(this.chartGroup1&&this.chartGroup1.id===c.id&&(this.chartGroup1=null,this.chartGroup2=null),this.chartGroup2&&this.chartGroup2.id===c.id&&(this.chartGroup2=null)),u.icon&&h.addClass(u.icon.appendCssClass("font-icon")),c instanceof o.DateColumn&&h.data("modifier",o.TableMatrix.DateGroup.YEAR).appendDiv("select-axis-group",this.dateGroup[0][1]),a?(h.on("click",this._onClickChartGroup.bind(this)),o.tooltips.installForEllipsis(h,{parent:this})):o.tooltips.install(h,{parent:this,text:this.session.text("ui.TooMuchData")}),i++,p=h.clone(!0),this._chartGroup1Map[c.id]=h,this._chartGroup2Map[c.id]=p,this.$xAxisSelect.append(h),this.$yAxisSelect.append(p)}if(this._aggregationMap={},this._hasColumns()){this.$dataSelect=this.$axisSelectContainer.appendDiv("data-select"),o.scrollbars.install(this.$dataSelect,{parent:this,session:this.session,axis:"y"});let n=this.session.text("ui.Count");this._aggregationMap.all=this.$dataSelect.appendDiv("select-data data-count",n).data("column",null).data("modifier",o.TableMatrix.NumberGroup.COUNT);for(let u=0;u<s.length;u++){let h=s[u],p=u+1;if(h instanceof o.NumberColumn){let c;o.strings.hasText(h.text)?c=this._plainAxisText(h,h.text):o.strings.hasText(h.headerTooltipText)?c=h.headerTooltipText:c="["+p+"]",this._aggregationMap[h.id]=this.$dataSelect.appendDiv("select-data data-sum",c).data("column",h).data("modifier",o.TableMatrix.NumberGroup.SUM)}}g()(".select-data",this.$contentContainer).on("click",this._onClickAggregation.bind(this))}return t}_initializeSelection(e){let t;this.chartType||this.setChartType(d.Type.BAR),(!this.chartAggregation||!this._aggregationMap[this.chartAggregation.id])&&this._setChartAggregation({id:null,modifier:o.TableMatrix.NumberGroup.COUNT}),(!this.chartGroup1||!this.chartGroup1.id||!this._chartGroup1Map[this.chartGroup1.id])&&(t=this.$xAxisSelect.children(":not(.disabled)"),this._setDefaultSelectionForGroup(1,e,t,0)),(!this.chartGroup2||!this.chartGroup2.id||!this._chartGroup2Map[this.chartGroup2.id])&&(t=this.$yAxisSelect.children(":not(.disabled)"),this._setDefaultSelectionForGroup(2,e,t,1))}_setDefaultSelectionForGroup(e,t,r,a){let i=this._getDefaultSelectedColumn(t,r,a);i&&this._setChartGroup(e,this._getDefaultChartGroup(i))}_getDefaultSelectedColumn(e,t,r){let a=0,i,s;for(let n=0;n<e.length&&a<=r;n++)i=e[n][0],this._existsInAxisColumns(t,i)&&(s=i,a++);return s}_existsInAxisColumns(e,t){for(let r=0;r<e.length;r++)if(e.eq(r).data("column")===t)return!0;return!1}_getDefaultChartGroup(e){let t;return e instanceof o.DateColumn&&(t=256),{id:e.id,modifier:t}}_renderChartParts(){this._renderChartType(),this._renderChartAggregation(),this._renderChartGroup1(),this._renderChartGroup2()}_drawChart(){if(!this._hasColumns()){this._hideChart();return}let e=this._calculateValues();if(e&&e.length)this.chart.setVisible(!0);else{this._hideChart();return}let t={type:this.chartType,options:{handleResize:!0,colorScheme:this.chartColorScheme,maxSegments:5,plugins:{legend:{display:!1}}}},r=[];t.data=this._computeData(r,e),this._adjustFont(t,r),this._adjustConfig(t),this.chart.setConfig(t);let a=this._computeCheckedItems(t.data.datasets[0].deterministicKeys);this.chart.setCheckedItems(a)}_hideChart(){this.chart.setConfig({type:this.chartType}),this.chart.setVisible(!1)}_getDatasetLabel(){let e=this._aggregationMap[this.chartAggregation.id||"all"];return(e?e.text():null)||this.session.text("ui.Value")}_calculateValues(){let e=new o.TableMatrix(this.table,this.session),t=this.chartAggregation.id?this._aggregationMap[this.chartAggregation.id].data("column"):-1;if(e.addData(t,this.chartAggregation.modifier),this.chartGroup1){let r=this._chartGroup1Map[this.chartGroup1.id].data("column");this.xAxis=e.addAxis(r,this.chartGroup1.modifier)}if(this.chartType===d.Type.BUBBLE&&this.chartGroup2){let r=this._chartGroup2Map[this.chartGroup2.id].data("column");this.yAxis=e.addAxis(r,this.chartGroup2.modifier)}else this.yAxis=null;if(!(e.isEmpty()||!e.isMatrixValid()))return e.calculate()}_getXAxis(){return this.xAxis}_getYAxis(){return this.yAxis}_computeData(e,t){let r={datasets:[{label:this._getDatasetLabel()}]};if(!t)return r;e=e||[];let a=[];if(this.chartType===d.Type.BUBBLE)a=this._computeBubbleData(e,t);else{let n=this._getXAxis();for(let u=0;u<n.length;u++){let h,p=n[u];n.column instanceof o.NumberColumn?h=o.objects.isNullOrUndefined(p)?n.format(p):p:h=this._handleIconLabel(n.format(p),n,e),a.push({value:t.getValue([p])[0],label:h,deterministicKey:n.keyToDeterministicKey(p)})}}let i=r.datasets[0],s=[];return i.data=[],i.deterministicKeys=[],a.forEach(n=>{i.data.push(n.value),i.deterministicKeys.push(n.deterministicKey),o.objects.isNullOrUndefined(n.label)||s.push(n.label)}),s.length&&(r.labels=s),r}_computeBubbleData(e,t){if(!t)return[];e=e||[];let r=this._getXAxis(),a=this._getYAxis(),i=[];for(let s=0;s<r.length;s++){let n=r[s],u=n;this._handleIconLabel(r.format(n),r,e),!(r.column instanceof o.NumberColumn)&&u===null&&(u=r.max),r.column instanceof o.DateColumn&&(u=u-r.min);for(let h=0;h<a.length;h++){let p=a[h],c=p,f=t.getValue([n,p]);this._handleIconLabel(a.format(p),a,e),f&&f.length&&(!(a.column instanceof o.NumberColumn)&&c===null&&(c=a.max),a.column instanceof o.DateColumn&&(c=c-a.min),i.push({value:{x:u,y:c,z:f[0]},deterministicKey:[r.keyToDeterministicKey(n),a.keyToDeterministicKey(p)]}))}}return i}_handleIconLabel(e,t,r){if(t&&t.isIcon){let a=o.icons.parseIconId(e);if(a&&a.isFontIcon())return r.push(...a.appendCssClass("font-icon").split(" ")),a.iconCharacter}return e}_adjustFont(e,t){if(!(!e||!t)&&(t=t.filter((r,a,i)=>i.indexOf(r)===a),t.length)){let r=o.styles.get(t,"font-family").fontFamily;this.chartType!==d.Type.PIE&&(e.options=g().extend(!0,{},e.options,{scales:{x:{ticks:{font:{family:r}}},y:{ticks:{font:{family:r}}}}})),e.options=g().extend(!0,{},e.options,{plugins:{tooltip:{titleFont:{family:r}}}}),e.options=g().extend(!0,{},e.options,{plugins:{datalabels:{font:{family:r}}}})}}_adjustLabels(e){if(!e)return;let t=this._getXAxis(),r=this._getYAxis();this.chartType===d.Type.BUBBLE?(t.column instanceof o.NumberColumn||(e.options=g().extend(!0,{},e.options,{scales:{x:{ticks:{callback:a=>this._formatLabel(a,t)}}}})),r.column instanceof o.NumberColumn||(e.options=g().extend(!0,{},e.options,{scales:{y:{ticks:{callback:a=>this._formatLabel(a,r)}}}}))):t.column instanceof o.NumberColumn&&(e.options=g().extend(!0,{},e.options,{reformatLabels:!0}))}_formatLabel(e,t){if(!t)return""+e;if(t.column instanceof o.DateColumn&&(e=e+t.min,e!==parseInt(""+e)||t.length<2&&(e<t.min||e>t.max)))return null;if(t.indexOf(null)!==-1){if(e===t.max)e=null;else if(e>t.max)return null}let r=t.format(e);if(t.isIcon){let a=o.icons.parseIconId(r);a&&a.isFontIcon()&&(r=a.iconCharacter)}return r}_adjustConfig(e){e&&(this._adjustLabels(e),this._adjustClickable(e),this.chartType===d.Type.BUBBLE?this._adjustBubble(e):this.chartType===d.Type.PIE?this._adjustPie(e):this._adjustScales(e))}_adjustClickable(e){e&&this._isChartClickable()&&(e.options=g().extend(!0,{},e.options,{clickable:!0,checkable:!0,otherSegmentClickable:!0}))}_isChartClickable(){return!0}_adjustBubble(e){!e||this.chartType!==d.Type.BUBBLE||(e.options.bubble=g().extend(!0,{},e.options.bubble,{sizeOfLargestBubble:25,minBubbleSize:5}))}_adjustPie(e){if(!e||this.chartType!==d.Type.PIE)return;e.data.datasets[0].datalabels={labels:{index:{display:"auto",color:o.styles.get([this.chartColorScheme,this.chartType+"-chart","elements","label"],"fill").fill,formatter:(r,a)=>a.chart.data.labels[a.dataIndex],anchor:"end",align:"end",clamp:!0,offset:10,padding:4},labels:{}}},e.options=g().extend(!0,{},e.options,{plugins:{datalabels:{display:!0}}});let t=this.chart.$container.cssMarginTop()-this.chart.$container.cssMarginBottom();e.options=g().extend(!0,{},e.options,{layout:{padding:{top:30+(Math.sign(t)<0?Math.abs(t):0),bottom:30+(Math.sign(t)>0?t:0)}}})}_adjustScales(e){e&&(e.options=g().extend(!0,{},e.options,{scales:{x:{beginAtZero:!0},y:{beginAtZero:!0}}}))}_computeCheckedItems(e){if(!e)return[];let t=this._getXAxis(),r=this._getYAxis(),a=this.table.getFilter(Q.TYPE),i=[],s=[];a&&(a.xAxis||{}).column===(t||{}).column&&(a.yAxis||{}).column===(r||{}).column&&(i=a.filters),e.forEach((h,p)=>{i.filter(c=>Array.isArray(c.deterministicKey)&&Array.isArray(h)?o.arrays.equals(c.deterministicKey,h):c.deterministicKey===h).length&&s.push(p)});let n=0;if(this.chartType===d.Type.PIE){let h=this.chart.config.options.maxSegments,p=o.arrays.init(e.length-h,null).map((c,f)=>f+h);o.arrays.containsAll(s,p)||o.arrays.remove(s,h-1),o.arrays.removeAll(s,p),n=1}let u=[];return s.length&&s.forEach(h=>{u.push({datasetIndex:n,dataIndex:h})}),u}_onChartValueClick(){let e=[];if(this.chart&&this.chart.config.data){let t=this.chart.config.options.maxSegments,r=this.chart.config.data.datasets[0],a=s=>({deterministicKey:r.deterministicKeys[s]});this.chartType===d.Type.PIE&&(a=s=>(s=parseInt(""+s),t&&t===s+1?o.arrays.init(r.deterministicKeys.length-s,null).map((n,u)=>({deterministicKey:r.deterministicKeys[u+s]})):{deterministicKey:r.deterministicKeys[s]})),this.chart.checkedItems.filter(s=>s.datasetIndex===0).map(s=>s.dataIndex).forEach(s=>{o.arrays.pushAll(e,a(s))})}if(e.length){let t=o.scout.create(Q,{session:this.session,table:this.table,text:this.tooltipText,xAxis:this._getXAxis(),yAxis:this._getYAxis(),filters:e});this.table.addFilter(t)}else this.table.removeFilterByKey(Q.TYPE)}_axisContentForColumn(e){let t=e.text;if(o.strings.hasText(t))return{text:t};if(e.headerIconId){let r=o.icons.parseIconId(e.headerIconId);if(r.isFontIcon())return{text:r.iconCharacter,icon:r}}return e.headerTooltipText?{text:e.headerTooltipText}:{text:"["+(this._columns().indexOf(e)+1)+"]"}}_removeContent(){this._removeScrollbars(),this.$contentContainer.remove(),this.chart.remove(),this.table.events.removeListener(this._filterResetListener),this._removeListeners(),this.oldChartType=null,this.recomputeEnabled()}_removeScrollbars(){this.$xAxisSelect.each((e,t)=>{o.tooltips.uninstall(g()(t))}),o.scrollbars.uninstall(this.$xAxisSelect,this.session),this.$yAxisSelect.each((e,t)=>{o.tooltips.uninstall(g()(t))}),o.scrollbars.uninstall(this.$yAxisSelect,this.session),o.scrollbars.uninstall(this.$dataSelect,this.session),this._uninstallScrollbars()}_removeListeners(){this.table.off("rowsInserted",this._tableUpdatedHandler),this.table.off("rowsDeleted",this._tableUpdatedHandler),this.table.off("allRowsDeleted",this._tableUpdatedHandler),this.chart.off("valueClick",this._chartValueClickedHandler)}_onTableUpdated(e){this._tableUpdatedTimeOutId||(this._tableUpdatedTimeOutId=setTimeout(()=>{this._tableUpdatedTimeOutId=null,this.rendered&&(this._setChartGroup1(null),this._setChartGroup2(null),this.removeContent(),this.renderContent())}))}_onTableColumnStructureChanged(){this.recomputeEnabled(),this.contentRendered&&this.selected&&this._onTableUpdated()}}S(oe,"DATE_GROUP_FLAG",256),S(oe,"MAX_AXIS_COUNT",100);function ne(l,e,t){return(e=Dt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Dt(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 r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Q extends o.TableUserFilter{constructor(){super(),ne(this,"text",void 0),ne(this,"xAxis",void 0),ne(this,"yAxis",void 0),ne(this,"filters",void 0),ne(this,"columnIdX",void 0),ne(this,"columnIdY",void 0),this.filterType=Q.TYPE,this.text=null,this.xAxis=null,this.yAxis=null,this.filters=[],this.columnIdX=null,this.columnIdY=null}createLabel(){return this.text}createFilterAddedEventData(){let e=super.createFilterAddedEventData();return e.text=this.text,e.filters=this.filters,e.columnIdX=this.xAxis&&this.xAxis.column?this.xAxis.column.id:null,e.columnIdY=this.yAxis&&this.yAxis.column?this.yAxis.column.id:null,e}calculate(){let e=new o.TableMatrix(this.table,this.session),t=this.table.columnById(this.columnIdX),r=t.createFilter().axisGroup();if(this.xAxis=e.addAxis(t,r),this.columnIdY){let a=this.table.columnById(this.columnIdY),i=a.createFilter().axisGroup();this.yAxis=e.addAxis(a,i)}e.calculate()}accept(e){this.xAxis||this.calculate();let t=this.xAxis.column.cellValueOrTextForCalculation(e),r=this.xAxis.normDeterministic(t);if(!this.yAxis)return this.filters.filter(i=>i.deterministicKey===r).length>0;t=this.yAxis.column.cellValueOrTextForCalculation(e);let a=this.yAxis.normDeterministic(t);return this.filters.filter(i=>o.arrays.equals(i.deterministicKey,[r,a])).length>0}}ne(Q,"TYPE","CHART");class je extends o.TableControlAdapter{constructor(){super(),this._addRemoteProperties(["chartType","chartAggregation","chartGroup1","chartGroup2"])}}function Mt(l,e,t){return(e=It(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function It(l){var e=wt(l,"string");return typeof e=="symbol"?e:e+""}function wt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Ee extends o.AbstractLayout{constructor(e){super(),Mt(this,"control",void 0),this.control=e}layout(e){this.control.contentRendered&&(o.scrollbars.update(this.control.$contentContainer),o.scrollbars.update(this.control.$xAxisSelect),o.scrollbars.update(this.control.$yAxisSelect),o.scrollbars.update(this.control.$dataSelect))}}const Ge=ce;o.ObjectFactory.get().registerNamespace("scout",ce);var Ht=L.AbstractChartRenderer,Nt=L.AbstractSvgChartRenderer,Ft=L.Chart,Vt=L.ChartAdapter,jt=L.ChartColorMode,Gt=L.ChartField,$t=L.ChartFieldAdapter,Ut=L.ChartFieldTile,Wt=L.ChartFieldTileAdapter,zt=L.ChartJsRenderer,Xt=L.ChartLayout,Yt=L.ChartTableControl,Jt=L.ChartTableControlAdapter,qt=L.ChartTableControlLayout,Kt=L.ChartTableUserFilter,Zt=L.FulfillmentChartRenderer,Qt=L.SalesfunnelChartRenderer,er=L.SpeedoChartRenderer,tr=L.VennAsync3Calculator,rr=L.VennChartRenderer,ar=L.VennCircle,ir=L.VennCircleHelper,sr=L.chartJsDateAdapter,nr=L.default;export{Ht as AbstractChartRenderer,Nt as AbstractSvgChartRenderer,Ft as Chart,Vt as ChartAdapter,jt as ChartColorMode,Gt as ChartField,$t as ChartFieldAdapter,Ut as ChartFieldTile,Wt as ChartFieldTileAdapter,zt as ChartJsRenderer,Xt as ChartLayout,Yt as ChartTableControl,Jt as ChartTableControlAdapter,qt as ChartTableControlLayout,Kt as ChartTableUserFilter,Zt as FulfillmentChartRenderer,Qt as SalesfunnelChartRenderer,er as SpeedoChartRenderer,tr as VennAsync3Calculator,rr as VennChartRenderer,ar as VennCircle,ir as VennCircleHelper,sr as chartJsDateAdapter,nr as default};
1
+ import*as R from"@eclipse-scout/core";import*as ve from"chart.js";import"chart.js/auto";import*as We from"chartjs-plugin-datalabels";var E={};E.n=l=>{var e=l&&l.__esModule?()=>l.default:()=>l;return E.d(e,{a:e}),e},E.d=(l,e)=>{for(var t in e)E.o(e,t)&&!E.o(l,t)&&Object.defineProperty(l,t,{enumerable:!0,get:e[t]})},E.o=(l,e)=>Object.prototype.hasOwnProperty.call(l,e),E.r=l=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(l,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(l,"__esModule",{value:!0})};var L={};E.r(L),E.d(L,{AbstractChartRenderer:()=>pe,AbstractSvgChartRenderer:()=>M,Chart:()=>d,ChartAdapter:()=>Me,ChartColorMode:()=>se,ChartField:()=>He,ChartFieldAdapter:()=>Ne,ChartFieldTile:()=>Fe,ChartFieldTileAdapter:()=>Ve,ChartJsRenderer:()=>J,ChartLayout:()=>Ae,ChartTableControl:()=>oe,ChartTableControlAdapter:()=>je,ChartTableControlLayout:()=>Ee,ChartTableUserFilter:()=>Q,FulfillmentChartRenderer:()=>Be,SalesfunnelChartRenderer:()=>Se,SpeedoChartRenderer:()=>k,VennAsync3Calculator:()=>Oe,VennChartRenderer:()=>De,VennCircle:()=>Z,VennCircleHelper:()=>Pe,chartJsDateAdapter:()=>ke,default:()=>Ge});var ce={};E.r(ce),E.d(ce,{AbstractChartRenderer:()=>pe,AbstractSvgChartRenderer:()=>M,Chart:()=>d,ChartAdapter:()=>Me,ChartColorMode:()=>se,ChartField:()=>He,ChartFieldAdapter:()=>Ne,ChartFieldTile:()=>Fe,ChartFieldTileAdapter:()=>Ve,ChartJsRenderer:()=>J,ChartLayout:()=>Ae,ChartTableControl:()=>oe,ChartTableControlAdapter:()=>je,ChartTableControlLayout:()=>Ee,ChartTableUserFilter:()=>Q,FulfillmentChartRenderer:()=>Be,SalesfunnelChartRenderer:()=>Se,SpeedoChartRenderer:()=>k,VennAsync3Calculator:()=>Oe,VennChartRenderer:()=>De,VennCircle:()=>Z,VennCircleHelper:()=>Pe,chartJsDateAdapter:()=>ke,default:()=>Ge});var ze=l=>{var e={};return E.d(e,l),e},lr=l=>()=>l;const o=ze({AbstractLayout:()=>R.AbstractLayout,DateColumn:()=>R.DateColumn,DateFormat:()=>R.DateFormat,FormField:()=>R.FormField,FormFieldAdapter:()=>R.FormFieldAdapter,FormFieldTile:()=>R.FormFieldTile,FormFieldTileAdapter:()=>R.FormFieldTileAdapter,HtmlComponent:()=>R.HtmlComponent,Icon:()=>R.Icon,ModelAdapter:()=>R.ModelAdapter,NumberColumn:()=>R.NumberColumn,ObjectFactory:()=>R.ObjectFactory,Point:()=>R.Point,PropertyEventEmitter:()=>R.PropertyEventEmitter,RoundingMode:()=>R.RoundingMode,TableControl:()=>R.TableControl,TableControlAdapter:()=>R.TableControlAdapter,TableMatrix:()=>R.TableMatrix,TableUserFilter:()=>R.TableUserFilter,Tile:()=>R.Tile,Tooltip:()=>R.Tooltip,Widget:()=>R.Widget,aria:()=>R.aria,arrays:()=>R.arrays,colorSchemes:()=>R.colorSchemes,dates:()=>R.dates,graphics:()=>R.graphics,icons:()=>R.icons,numbers:()=>R.numbers,objects:()=>R.objects,scout:()=>R.scout,scrollbars:()=>R.scrollbars,strings:()=>R.strings,styles:()=>R.styles,tooltips:()=>R.tooltips}),Xe=require("jquery");var g=E.n(Xe);function N(l,e,t){return(e=Ye(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Ye(l){var e=Je(l,"string");return typeof e=="symbol"?e:e+""}function Je(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class d extends o.Widget{constructor(){super(),N(this,"data",void 0),N(this,"config",void 0),N(this,"checkedItems",void 0),N(this,"chartRenderer",void 0),N(this,"_updatedOnce",void 0),N(this,"_updateChartTimeoutId",void 0),N(this,"_updateChartOpts",void 0),N(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 Ae(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(r=>delete r.requestAnimation),t.push({requestAnimation:!1})),t.forEach(r=>this.updateChart(g().extend(!0,{},r,{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=g().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:se.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=g().extend(!0,{},t,e),e.options.colorScheme=o.colorSchemes.ensureColorScheme(e.options.colorScheme),o.objects.equalsRecursive(this.config,e))return;let r=g().extend(!0,{},this.config);e.data?r.data=e.data:delete r.data;let a=(i,s,n)=>{if(!(!i||!s||!n)){if(!i.options||!i.options[n]){s.options&&delete s.options[n],s.options&&o.objects.isEmpty(s.options.scales)&&!(i.options&&i.options.scales)&&delete s.options.scales,o.objects.isEmpty(s.options)&&!i.options&&delete s.options;return}s.options[n]=i.options[n]}};if(a(e,r,"xLabelMap"),a(e,r,"yLabelMap"),o.objects.equalsRecursive(r,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 r=e.filter(a=>t[a.datasetIndex]&&a.dataIndex<t[a.datasetIndex]);return r.length<e.length?r: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),i=>{this.removing||i||(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 Be(this);case d.Type.SPEEDO:return new k(this);case d.Type.SALESFUNNEL:return new Se(this);case d.Type.VENN:return new De(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 J(this)}return null}_updateChartRenderer(){this.chartRenderer&&this.chartRenderer.remove(),this.setProperty("chartRenderer",this._resolveChartRenderer())}handleValueClick(e,t){if(this.config.options.checkable){let r=[...this.checkedItems],a=r.filter(i=>i.datasetIndex===e.datasetIndex&&i.dataIndex===e.dataIndex)[0];a?o.arrays.remove(r,a):r.push(e),this.setCheckedItems(r)}this.trigger("valueClick",{data:e,originalEvent:t})}}N(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"}),N(d,"Position",{TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center"}),N(d,"DEFAULT_ANIMATION_DURATION",600),N(d,"DEFAULT_DEBOUNCE_TIMEOUT",100);var se;(function(l){l.AUTO="auto",l.DATASET="dataset",l.DATA="data"})(se||(se={}));class Me extends o.ModelAdapter{_onWidgetValueClick(e){this._send("valueClick",e.data)}_onWidgetEvent(e){e.type==="valueClick"?this._onWidgetValueClick(e):super._onWidgetEvent(e)}}function qe(l,e,t){return(e=Ke(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Ke(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 r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Ae extends o.AbstractLayout{constructor(e){super(),qe(this,"chart",void 0),this.chart=e}layout(e){var t;let r={requestAnimation:!0,debounce:d.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:!0};if((!this.chart.session.ready||this.chart._updatedOnce)&&(r.requestAnimation=!1),this.chart.session.ready||(r.debounce=!1),(t=this.chart.findParent(o.Tile))!==null&&t!==void 0&&t.$container.hasClass("dragged")&&(r.debounce=!1),this.chart.chartRenderer instanceof J){var a;(a=this.chart.chartRenderer.chartJs)===null||a===void 0||a.resize()}this.chart.updateChart(r)}}function he(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 r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class pe extends o.PropertyEventEmitter{constructor(e){super(),he(this,"chart",void 0),he(this,"session",void 0),he(this,"rendering",void 0),he(this,"rendered",void 0),he(this,"animationDuration",void 0),he(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,r=0;for(t=0;t<e.chartValueGroups.length;t++){let a=e.chartValueGroups[t];if(!a.values)return!1;if(t===0)r=a.values.length;else if(a.values.length!==r)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!==r)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 r=this.chart.config.options.animation.duration;this.setAnimationDuration(e&&r),this.animationDuration&&this.rendered?this._removeAnimated(t):this._remove(t),this.setAnimationDuration(r)}_remove(e){this.rendered=!1,e&&e()}_removeAnimated(e){this._remove(e)}shouldAnimateRemoveOnUpdate(e){return e.requestAnimation}}function F(l,e,t){return(e=tt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function tt(l){var e=rt(l,"string");return typeof e=="symbol"?e:e+""}function rt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class M extends pe{constructor(e){super(e),F(this,"chartBox",void 0),F(this,"clipId",void 0),F(this,"maskId",void 0),F(this,"suppressLegendBox",void 0),F(this,"height",void 0),F(this,"width",void 0),F(this,"chartAnimationStopping",void 0),F(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(M.FONT_SIZE_BIG):this._useFontSizeMiddle()?this.$svg.addClass(M.FONT_SIZE_MIDDLE):this._useFontSizeSmall()?this.$svg.addClass(M.FONT_SIZE_SMALL):this._useFontSizeSmallest()&&this.$svg.addClass(M.FONT_SIZE_SMALLEST),this.$svg.isAttached()&&this._renderInternal()}linkChartWithFieldLabel(e){if(!e)return;let t=e.parents(".chart-field");if(t.length>0){let r=t.eq(0).children("label");r.length>0&&o.aria.linkElementWithLabel(e,r.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 r=this.$svg.appendSVG("text",t).attr("x",0).attr("y",0).attr("visibility","hidden").text(e),a;try{a=r[0].getBBox()}catch{return{height:0,width:0}}return r.remove(),a}_renderLine(e,t,r,a,i){let s=this.$svg.appendSVG("line",i).attr("x1",e).attr("y1",t).attr("x2",r).attr("y2",a);return this.animationDuration&&s.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),s}_renderLineLabel(e,t,r,a,i){let s=this.$svg.appendSVG("text",a||"line-label").attr("x",e).attr("y",t).text(r);if(i){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(r);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(r,a){try{e.bind(this)(r,a)}catch(i){throw g()(this).stop(!0,!1),i}},duration:t||d.DEFAULT_ANIMATION_DURATION,complete:function(){g()(this).removeAttr("tabindex")}}}_addClipping(e){let t=this.$svg.appendSVG("clipPath");t[0].id=this.clipId;let r=this.$svg.appendSVG("mask");r.appendSVG("rect").attr("x",0).attr("y",0).attr("width","100%").attr("height","100%").attr("fill","white"),r[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),r.appendSVG("use").attrXLINK("href","#"+this.id)})}_renderWireLegend(e,t,r,a){if(!this.chart.config.options.plugins.tooltip.enabled)return{detachFunc:()=>{},attachFunc:()=>{},removeFunc:()=>{}};let i={},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,y=0;if(c.h===-1?y=c.x2-2*s:y=this.width-c.x2-2*s,Array.isArray(e))for(let _=0;_<e.length;_++){let x=e.length-_-1,v=c.y2+c.v*s-h*x-s*x,T=this._renderLineLabel(c.x2+s,v,o.strings.truncateText(e[_],y,this._measureText.bind(this)),"",a);T.addClass(r),m=Math.max(m,T[0].getComputedTextLength()),_===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,y,this._measureText.bind(this)),"",a),f.addClass(r),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(_=>{_.attr("x",c.x2-s-m),_.css("text-anchor","left")})):(f.attr("x",c.x2+s),f.css("text-anchor","right"),f.data("lines")&&f.data("lines").forEach(_=>{_.attr("x",c.x2+s),_.css("text-anchor","right")})),c.v===1)f.data("lines")&&f.data("lines").forEach((_,x)=>{_.attr("y",c.x2-s-m);let v=1+x;_.attr("y",c.y2+c.v*s+h*v+s*(v+1))}),f.attr("dy","0.7em");else if(f.data("lines")){let _=f.data("lines").length;f.attr("y",c.y2+c.v*s-h*_-s*_),f.data("lines").forEach((x,v)=>{_=f.data("lines").length-1-v,x.attr("y",c.y2+c.v*s-h*_-s*_)})}f.add(f.data("lines")).each((_,x)=>{let v=g()(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 b=[];c.x1>0&&c.y1>0&&(b.push(this._renderLine(c.x1,c.y1,c.x2,c.y2,"label-line")),b.push(this._renderLine(c.x2,c.y2,c.x2+c.h*(m+2*s),c.y2,"label-line"))),f.data("wires",b);let C=this.$svg;return i.detachFunc=()=>{f.data("wires").forEach(_=>{_.detach()}),f.data("lines")&&f.data("lines").forEach(_=>{_.data("$background")&&C.append(_.data("$background")),_.detach()}),f.data("$background")&&f.data("$background").remove(),f.detach()},i.attachFunc=()=>{C.append(f),f.data("$background")&&C.append(f.data("$background")),C.append(f.data("wires")),f.data("lines")&&f.data("lines").forEach(_=>{C.append(_),_.data("$background")&&C.append(_.data("$background"))})},i.removeFunc=()=>{f.data("wires").forEach(_=>{_.remove()}),f.data("lines")&&f.data("lines").forEach(_=>{_.data("$background")&&_.data("$background").remove(),_().remove()}),f.data("$background")&&f.data("$background").remove(),f.remove()},i.$field=f,i}}F(M,"FONT_SIZE_SMALLEST","smallestFont"),F(M,"FONT_SIZE_SMALL","smallFont"),F(M,"FONT_SIZE_MIDDLE","middleFont"),F(M,"FONT_SIZE_BIG","bigFont");const ke={getAdapter(l){return{formats:()=>at(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,r)=>{let a=new Date(e);switch(r){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,r)=>{switch(r){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,r)=>{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,r).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 r=new Date(e);switch(t){case"second":return r.setMilliseconds(999);case"minute":return r.setSeconds(59,999);case"hour":return r.setMinutes(59,59,999);case"day":return r.setHours(23,59,59,999);case"week":{r.setHours(23,59,59,999);let a=o.dates.firstDayOfWeek(r,0);return a.setDate(a.getDate()+7)}case"month":return r.setHours(23,59,59,999),r.setDate(Ie(r.getMonth(),r.getFullYear()));case"quarter":{r.setHours(23,59,59,999);let a=r.getMonth()%4+2;return r.setMonth(a,Ie(a,r.getFullYear()))}case"year":return r.setHours(23,59,59,999),r.setMonth(11,31);default:return e}}}}};function at(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 Ie(l,e){return l in[3,5,8,10]?30:l===1?o.dates.isLeapYear(e)?29:28:31}var it=l=>{var e={};return E.d(e,l),e},hr=l=>()=>l;const B=it({CategoryScale:()=>ve.CategoryScale,Chart:()=>ve.Chart,_adapters:()=>ve._adapters});var st=l=>{var e={};return E.d(e,l),e},dr=l=>()=>l;const ur=st({});var nt=l=>{var e={};return E.d(e,l),e},cr=l=>()=>l;const Re=nt({default:()=>We.default});function A(l,e,t){return(e=ot(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function ot(l){var e=lt(l,"string");return typeof e=="symbol"?e:e+""}function lt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}B.Chart.register(Re.default),g().extend(!0,B.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}}}}),g().extend(!0,B.Chart.overrides,{line:{elements:{point:{borderWidth:2}}},scatter:{elements:{point:{radius:3}}},bubble:{layout:{autoPadding:!1}}});let we=!1;const ht=(1+Math.sqrt(5))/2;class J extends pe{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 i,s=0;for(i=0;i<t.chartValueGroups.length;i++){let n=t.chartValueGroups[i];n.values||(e=!1),i===0?s=n.values.length:n.values.length!==s&&(e=!1)}for(i=0;i<t.axes.length;i++)t.axes[i].length!==s&&(e=!1)}if(e)return!0;let r=!0,a=this.chart&&this.chart.config;if((!a||!a.data||!a.data.datasets||a.data.datasets.length===0)&&(r=!1),r&&o.scout.isOneOf(a.type,d.Type.POLAR_AREA,d.Type.RADAR)){let i,s=0;for(i=0;i<a.data.datasets.length;i++){let n=a.data.datasets[i];n.data||(r=!1),i===0?s=n.data.length:n.data.length!==s&&(r=!1)}}return r}_render(){this.$canvas||(this.$canvas=this.chart.$container.appendElement("<canvas>"),o.aria.hidden(this.$canvas,!0)),this.firstOpaqueBackgroundColor=o.styles.getFirstOpaqueBackgroundColor(this.$canvas),we||(B.Chart.defaults.font.family=this.$canvas.css("font-family"),B._adapters._date.override(ke.getAdapter(this.chart.session)),we=!0);let e=g().extend(!0,{},this.chart.config);this._adjustConfig(e),this._renderChart(e)}_renderChart(e){this.chartJs&&this.chartJs.destroy(),e=g().extend(!0,{},e,{options:{animation:{}}},e),e.options.animation.duration=this.animationDuration,this.chartJs=new B.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=g().extend(!0,{},this.chart.config);this._adjustConfig(e);let t=this.chartJs.config.data,r=e.data,a=(h,p,c,f)=>{if(!h||!p||!c)return;if(!p[c]){let b=h[c];(b||f)&&(p[c]=b);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 b=0;b<Math.min(h[c].length,p[c].length);b++)p[c][b]=h[c][b];let m=p[c].length,y=h[c].length;m>y?p[c].splice(y,m-y):m<y&&p[c].push(...h[c].splice(m))},i=(h,p)=>o.arrays.find(h,c=>c.datasetId===p),s=(h,p)=>o.arrays.findIndex(h,c=>c.datasetId===p);if(t&&r){a(r,t,"labels"),t.datasets||(t.datasets=[]),r.datasets||(r.datasets=[]),r.datasets.every(h=>o.objects.isNullOrUndefined(h.datasetId))&&(r.datasets.forEach((h,p)=>{h.datasetId=""+p}),t.datasets.forEach((h,p)=>{h.datasetId=""+p})),t.datasets.forEach(h=>{let p=i(r.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(r.datasets,p)===-1)&&t.datasets.splice(h,1)}t.datasets.sort((h,p)=>s(r.datasets,h.datasetId)-s(r.datasets,p.datasetId)),r.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=r;a(e.options,this.chartJs.config.options,"xLabelMap",!0),a(e.options,this.chartJs.config.options,"yLabelMap",!0),g().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&&(g().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,i,s)=>{if(Array.isArray(a)&&Array.isArray(i)){let n=0;return o.arrays.ensure(s).filter(u=>!isNaN(u)&&u<Math.min(a.length,i.length)).forEach(u=>{a[u]!==i[u]&&(a[u]=i[u],n++)}),n}return 0},r=0;return e.data.datasets.forEach((a,i)=>{let s=this.chart.checkedItems.filter(u=>u.datasetIndex===i).map(u=>u.dataIndex),n=o.arrays.init(a.data.length,null).map((u,h)=>h);o.arrays.removeAll(n,s),r=r+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<r}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=g().extend(!0,{},e.options,{indexAxis:"y"}))}_computeDatasets(e,t){let r=[],a=[],i=(n,u)=>{g().isEmptyObject(u)||(t.options[n]=u)};(e.axes[0]||[]).forEach(n=>r.push(n.label));let s=this._isHorizontalBar(t);i(s?"yLabelMap":"xLabelMap",this._computeLabelMap(e.axes[0])),i(s?"xLabelMap":"yLabelMap",this._computeLabelMap(e.axes[1])),e.chartValueGroups.forEach(n=>a.push({type:n.type,label:n.groupName,data:g().extend(!0,[],n.values)})),t.data={labels:r,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((r,a)=>{t[a]=r.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 r=t?"hoverBorderWidth":"borderWidth",a=t?"hoverBorderWidthBackup":"borderWidthBackup",i=t?"hoverBackgroundColor":"backgroundColor",s=t?"hoverBorderColor":"borderColor";if(e[a]&&(e[r]=e[a],delete e[a]),!e[r]||o.objects.isFunction(e[r]))return;let n=Array.isArray(e[r]),u=Array.isArray(e[i]),h=Array.isArray(e[s]);if(!(n||u||h)&&e[i]===e[s]){e[a]=e[r],e[r]=0;return}let c=(e.data||[]).length;n?e[r].length<c&&e[r].push(...o.arrays.init(c-e[r].length,e[r][0])):e[r]=o.arrays.init(c,e[r]);let f=e[r],m=f.length,y=o.arrays.init(m,null);for(let b=0;b<m;b++){let C=u?e[i][b]:e[i],_=h?e[s][b]:e[s];y[b]=f[b],C===_&&(f[b]=0)}o.arrays.equals(f,y)||(e[a]=y)}_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 i=a.data.slice(0,t);i[t-1]=a.data.slice(t-1,a.data.length).reduce((s,n)=>s+n,0),a.data=i});let r=e.data.labels.slice(0,t);r[t-1]=this.chart.session.text("ui.OtherValues"),e.data.labels=r,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(r=>{isNaN(r.r)||(r.z=Math.pow(r.r,2)),r.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(r=>o.numbers.isInteger(r.x)&&o.numbers.isInteger(r.y))):this.onlyIntegers=e.data.datasets.every(t=>t.data.every(r=>o.numbers.isInteger(r))))}_adjustLegend(e){!e||!e.type||!e.options||(e.options=g().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=g().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],r=t.chart,a=r.config,i=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(i.data[t.dataIndex].x,null,null);p&&s.push(this._createTooltipAttribute(h.x,o.strings.encode(p),!0));let c=u.ticks.callback(i.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=r.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,r=e.options.scales.y.title.text;return t=this._resolveAxisLabel(t,J.ARROW_LEFT_RIGHT),r=this._resolveAxisLabel(r,"&nbsp;"+J.ARROW_UP_DOWN+"&nbsp;"),{x:t,y:r}}_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,r,a){if(!e||!e.length)return"";let i=e[0],s=i.chart,n=s.config,u=!1,h=!1,p="";if(e.forEach(c=>{let{label:f,labelValue:m,labelColor:y}=this._getItemDetails(c,t,r,a);if(o.scout.isOneOf(n.type,d.Type.SCATTER)){let{x:b,y:C}=m;u||(u=o.objects.isString(b)),h||(h=o.objects.isString(C)),p+=this._createTooltipScatterAttribute(f,b,C,!1,y)}else p+=this._createTooltipAttribute(f,m,!1,y)}),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,r,a){let i,s,n;return o.objects.isFunction(t)&&(i=t(e),i=o.objects.isString(i)?i:""),o.objects.isFunction(r)&&(s=r(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:i,labelValue:s,labelColor:n}}_generateTooltipLabel(e){return o.strings.encode(e.dataset.label)}_generateTooltipLabelValue(e){let t=e.chart.config,r=e.dataset;return t.type===d.Type.BUBBLE?o.strings.encode(this._formatLabel(r.data[e.dataIndex].z)):t.type===d.Type.SCATTER?{x:o.strings.encode(this._formatXLabel(r.data[e.dataIndex].x)),y:o.strings.encode(this._formatYLabel(r.data[e.dataIndex].y))}:o.strings.encode(this._formatLabel(r.data[e.dataIndex]))}_generateTooltipLabelColor(e){let t=e.chart.config,r=e.dataset,a,i,s,n;o.scout.isOneOf(r.type||t.type,d.Type.LINE,d.Type.BAR,d.Type.BAR_HORIZONTAL,d.Type.RADAR,d.Type.BUBBLE,d.Type.SCATTER)&&(s=r.borderColor,a=Array.isArray(r.legendColor)?r.legendColor[e.dataIndex]:r.legendColor,n=e.datasetIndex),o.scout.isOneOf(t.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(a=Array.isArray(r.legendColor)?r.legendColor[e.dataIndex]:r.legendColor,i=Array.isArray(r.backgroundColor)?r.backgroundColor[e.dataIndex]:r.backgroundColor,i=this._adjustColorOpacity(i,1),n=e.dataIndex),o.objects.isFunction(a)&&(a=a.call(e.chart,n));let u=a||i||s;if(!u||o.objects.isFunction(u)){let h;B.Chart.overrides[t.type]&&B.Chart.overrides[t.type].plugins&&B.Chart.overrides[t.type].plugins.tooltip&&B.Chart.overrides[t.type].plugins.tooltip.callbacks&&(h=B.Chart.overrides[t.type].plugins.tooltip.callbacks.labelColor),u=(h||B.Chart.defaults.plugins.tooltip.callbacks.labelColor).call(e.chart,e).backgroundColor}return{backgroundColor:u}}_createTooltipAttribute(e,t,r,a){return'<div class="'+(r?"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,r,a,i){return'<tr class="'+(a?"attribute title":"attribute")+'"><td class="color-cell">'+(i?'<div class="color" style="background-color:'+i+'"></div>':"")+'</td><td class="label">'+e+"</td>"+(t?'<td class="value">'+t+"</td>":"")+(r?'<td class="value">'+r+"</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,r=t.dataPoints;if(r.length<1)return;let a=r[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(r)).join("")),o.objects.isFunction(h)&&(m+=o.arrays.ensure(h(r,p,c,f)).join(""));let y=this._computeTooltipPositionAndOffset(a),b=new o.Point(t.caretX+y.offsetX,t.caretY+y.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:y.tooltipPosition,tooltipDirection:y.tooltipDirection,originProducer:v=>{const T=o.graphics.offsetBounds(v);return T.height=y.height,T},offsetProducer:v=>b}),this._tooltip.render(),this._tooltip.$container.css("pointer-events","none");let C=!1,_=(s.titleFont||{}).family;_&&(this._tooltip.$container.css("--chart-tooltip-font-family",_),C=!0);let x=0;this._tooltip.$container.find("label").each((v,T)=>{x=Math.max(x,o.graphics.prefSize(g()(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",r="right",a=0,i=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?r=(m.x[0]+m.x[1])/2<0?"left":"right":r=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 y=n.getDatasetMeta(u).data[h].getProps(["startAngle","endAngle"]),b=y.startAngle,C=y.endAngle,_=(b+C)/2;t=0<=_&&_<Math.PI?"bottom":"top",r=-Math.PI/2<=_&&_<Math.PI/2?"right":"left"}else if(p.type===d.Type.RADAR){let b=n.getDatasetMeta(u).data[h].getProps(["angle"]).angle;t=0<=b&&b<Math.PI?"bottom":"top",r=-Math.PI/2<=b&&b<Math.PI/2?"right":"left"}else if(o.scout.isOneOf(p.type,d.Type.BUBBLE,d.Type.SCATTER)){let y=n.getDatasetMeta(u).data[h],b=n.chartArea,C=b.left+b.width/2;r=y.x<C?"left":"right"}if(this._isHorizontalBar(p)){let y=n.getDatasetMeta(u).data[h].getProps(["height","width"]);s=y.height;let b=y.width,C=b/(ht+1);i=-s/2,a=r==="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 b=n.getDatasetMeta(u).data[h].options,C=b.hoverRadius+b.hoverBorderWidth;p.type===d.Type.BUBBLE&&(C+=m.r),s=2*C,i=-C}else if(o.scout.isOneOf(p.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)){let y=n.getDatasetMeta(u).data[h].getProps(["startAngle","endAngle","innerRadius","outerRadius"]),b=y.startAngle,C=y.endAngle,_=(b+C)/2,x=y.innerRadius,v=y.outerRadius,T=(v-x)/2;a=T*Math.cos(_),i=T*Math.sin(_)}return{tooltipPosition:t,tooltipDirection:r,offsetX:a,offsetY:i,height:s}}_adjustGrid(e){e&&(e.options=g().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=g().extend(!0,{},{scales:{r:{}}},e.options));let t=e.options,r=t?t.scales:{};r&&r.r&&(r.r=g().extend(!0,{},{minSpaceBetweenTicks:35,beginAtZero:!0,angleLines:{display:!1},ticks:{callback:this._labelFormatter},pointLabels:{callback:this._labelFormatter,font:{size:B.Chart.defaults.font.size}}},r.r))}_adjustScalesXY(e){!e||!e.type||!e.options||(o.scout.isOneOf(e.type,d.Type.BAR,d.Type.LINE,d.Type.BUBBLE)?e.options=g().extend(!0,{},{scales:{x:{minSpaceBetweenTicks:150},y:{minSpaceBetweenTicks:35}}},e.options):o.scout.isOneOf(e.type,d.Type.SCATTER)&&(e.options=g().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,r=e.options.scales;this._isHorizontalBar(e)||o.scout.isOneOf(t,d.Type.BUBBLE,d.Type.SCATTER)?r.x=g().extend(!0,{},{beginAtZero:this._isHorizontalBar(e),offset:t===d.Type.BUBBLE,grid:{drawTicks:!1},border:{display:!1},ticks:{padding:5}},r.x):r.x=g().extend(!0,{},{offset:!0,grid:{display:!1},border:{display:!1}},r.x),(this._isHorizontalBar(e)||o.scout.isOneOf(t,d.Type.BUBBLE,d.Type.SCATTER)||e.options.reformatLabels)&&(r.x=g().extend(!0,{},{ticks:{callback:this._xLabelFormatter}},r.x)),r.x.afterCalculateLabelRotation=this._xAxisFitter}_adjustYAxis(e){if(!e||!e.type||!e.options||!e.options.scales||!e.options.scales.y)return;let t=e.type,r=e.options.scales;this._isHorizontalBar(e)?r.y=g().extend(!0,{},{grid:{display:!1},border:{display:!1}},r.y):r.y=g().extend(!0,{},{beginAtZero:!o.scout.isOneOf(t,d.Type.BUBBLE,d.Type.SCATTER),grid:{drawTicks:!1},border:{display:!1},ticks:{padding:5}},r.y),(!this._isHorizontalBar(e)||e.options.reformatLabels)&&(r.y=g().extend(!0,{},{ticks:{callback:this._yLabelFormatter}},r.y)),r.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=g().extend(!0,{},{formatter:this._radialChartDatalabelsFormatter},t.datalabels),t.datalabels.display=this._radialChartDatalabelsDisplayHandler,this._updatingDatalabels=!1;let r=e.options.animation||{},a=r.onProgress,i=r.onComplete,s=u=>{if(this._updatingDatalabels)return;this._updatingDatalabels=!0;let h=u.chart,p=h.getSortedVisibleDatasetMetas(),c=[...h.getActiveElements()],f=[];p.forEach((m,y)=>{m.data.forEach((b,C)=>{let _=o.arrays.findIndex(c,x=>x.datasetIndex===y&&x.index===C);_>0?c.splice(_,1):f.push({datasetIndex:y,index:C,element:b})})}),h["$"+Re.default.id]._actives=f,Re.default.afterEvent(h,null,null),this._updatingDatalabels=!1},n=(u,h)=>{s(u),h&&h(u)};e.options.animation=g().extend(!0,{},e.options.animation,{onProgress:u=>n(u,a),onComplete:u=>n(u,i)})}else o.scout.isOneOf(e.type,d.Type.BAR,d.Type.LINE,d.Type.POLAR_AREA,d.Type.RADAR,d.Type.BUBBLE)?(t.datalabels=g().extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:3},t.datalabels),t.datalabels.display="auto"):o.scout.isOneOf(e.type,d.Type.SCATTER)&&(t.datalabels=g().extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:3,anchor:"end",align:"top",offset:3},t.datalabels),t.datalabels.display="auto");if(e.options.reformatLabels){let r=a=>(i,s)=>{let n=a.call(s.chart,i,s);return this._formatLabel(n)};e.data&&e.data.datasets.forEach(i=>{i.datalabels&&i.datalabels.formatter&&(i.datalabels.formatter=r(i.datalabels.formatter))}),t.datalabels.formatter&&(t.datalabels.formatter=r(t.datalabels.formatter))}t.datalabels=g().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(r){return e.call(t,r,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 B.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,r){return t?t[e]:isNaN(e)||typeof e=="string"?""+e:r?r(e,this._formatNumberLabel.bind(this)):this._formatNumberLabel(e)}_formatNumberLabel(e){if(isNaN(e))return""+e;let t=Math.abs(e),r="";if(t>=1e6){t=t/1e6,r=" "+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 i=0;i<a.length&&t>=1e3;i++)t=t/1e3,r=" "+a[i]}return this.session.locale.decimalFormat.format(Math.sign(e)*t)+r}_fitXAxis(e){if(!e||e.labelRotation===0)return;let t=this.maxXAxesTicksHeight,r=B.Chart.defaults.font,a=B.Chart.defaults.scale.ticks,i=a.font||{},s,n;if(this.chartJs){let f=this.chartJs.chartArea,m=Math.abs(f.top-f.bottom);t=Math.min(t,m/3)}e.options&&e.options.ticks&&(n=e.options.ticks.maxRotation,s=(e.options.ticks.font||{}).size),n=n||a.maxRotation,s=s||i.size||r.size,isNaN(e.labelRotation)&&(e.labelRotation=n),e.height=isNaN(e.height)?t:Math.min(e.height,t);let u=e.labelRotation,h=(t-s*Math.sin((90-u)/180*Math.PI))/Math.sin(u/180*Math.PI);if(((e._labelSizes||{}).widest||{}).width>h){let f=e.ctx.measureText.bind(e.ctx);e.ticks.forEach(m=>{m.label=o.strings.truncateText(m.label,h,f)}),e._labelSizes=void 0}}_fitYAxis(e){if(!e)return;let t=0,r=0;if(e.options&&e.options.ticks&&(t=e.options.ticks.padding||0),e.options&&e.options.grid&&(r=e.options.grid.tickLength||0),((e._labelSizes||{}).widest||{}).width>e.maxWidth-t){let s=e.maxWidth-t-r,n=e.ctx.measureText.bind(e.ctx);e.ticks.forEach(u=>{u.label=o.strings.truncateText(u.label,s,n)})}}_displayDatalabelsOnRadialChart(e){let t=e.chart.getDatasetMeta(e.datasetIndex).data[e.dataIndex].getProps(["startAngle","endAngle","innerRadius","outerRadius"]),r=(t.outerRadius+t.innerRadius)/2,a=Math.min(t.endAngle-t.startAngle,Math.PI)/2,i=Math.abs(Math.sin(a))*r,s=i*2,n=t.outerRadius-t.innerRadius;return Math.min(s,n)>this.minRadialChartDatalabelSpace}_formatDatalabelsOnRadialChart(e,t){let r=this._computeSumOfVisibleElements(t),a=t.dataset,i=0,s=[];for(let n=0;n<t.dataIndex+1;n++){let u=a.data[n]/r*100-i,h=Math.round(u);i=h-u,s.push(h+"%")}return s[t.dataIndex]}_computeSumOfVisibleElements(e){let t=e.dataset,r=e.chart,a=0;for(let i=0;i<t.data.length;i++)r.getDataVisibility(i)&&(a+=t.data[i]);return a}_formatDatalabels(e,t){let r=t.chart.config;return r.type===d.Type.BUBBLE?this._formatLabel(e.z):r.type===d.Type.SCATTER?o.strings.join(" / ",this._formatXLabel(e.x),this._formatYLabel(e.y)):this._formatLabel(e)}_getBackgroundColorOfDataset(e){return e.dataset.backgroundColor}_adjustColors(e){this._adjustColorSchemeCssClass(e),this._adjustDatasetColors(e),this._adjustLegendColors(e),this._adjustScalesRColors(e),this._adjustScalesXYColors(e),this._adjustPluginColors(e)}_adjustColorSchemeCssClass(e){!e||!e.options||(this.colorSchemeCssClass=o.colorSchemes.getCssClasses(e.options.colorScheme).join(" "))}_adjustDatasetColors(e){if(!e||!e.data||!e.type)return;let t=e.data,r=e.type,a=e.options&&e.options.autoColor,i=e.options&&e.options.checkable,s=e.options&&e.options.colorMode,n=a&&(s===se.DATASET?!1:s===se.DATA?!0:o.scout.isOneOf(r,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)),u={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]};u=g().extend(!0,u,this._computeDatasetColors(e,n)),t.datasets.forEach((h,p)=>{const c=v=>{let T=v[p];return n&&!Array.isArray(T)&&(T=v),T};let f=c(u.backgroundColors),m=c(u.borderColors),y=c(u.hoverBackgroundColors),b=c(u.hoverBorderColors),C=c(u.legendColors),_=c(u.pointHoverColors),x=(v,T)=>{typeof h[v]!="function"&&T&&T.length&&(h[v]=Array.isArray(T)?[...T]:T)};if(x("backgroundColor",f),x("borderColor",m),x("hoverBackgroundColor",y),x("hoverBorderColor",b),x("legendColor",C),(o.scout.isOneOf(r,d.Type.LINE,d.Type.RADAR)||r===d.Type.BAR&&h.type===d.Type.LINE)&&(x("pointHoverBackgroundColor",_),x("pointBorderColor",this.firstOpaqueBackgroundColor),x("pointHoverBorderColor",this.firstOpaqueBackgroundColor)),i){const v=h.data.length,T=I=>Array.isArray(I)?I:o.arrays.init(v,I);if(o.scout.isOneOf(r,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA,d.Type.BUBBLE,d.Type.SCATTER)||r===d.Type.BAR&&(h.type||d.Type.BAR)===d.Type.BAR){let I=T(f),W=T(y),z=T(c(u.checkedBackgroundColors)),U=T(c(u.checkedHoverBackgroundColors));x("uncheckedBackgroundColor",I),x("uncheckedHoverBackgroundColor",W),x("checkedBackgroundColor",z),x("checkedHoverBackgroundColor",U),x("backgroundColor",h.uncheckedBackgroundColor),x("hoverBackgroundColor",h.uncheckedHoverBackgroundColor)}else if(o.scout.isOneOf(r,d.Type.LINE,d.Type.RADAR)||r===d.Type.BAR&&h.type===d.Type.LINE){let I=T(_),W=T(_),z=T(m),U=T(b||m);x("uncheckedPointBackgroundColor",I),x("uncheckedPointHoverBackgroundColor",W),x("checkedPointBackgroundColor",z),x("checkedPointHoverBackgroundColor",U),x("pointBackgroundColor",h.uncheckedPointBackgroundColor),x("pointHoverBackgroundColor",h.uncheckedPointHoverBackgroundColor);let j=o.arrays.init(v,((e.options.elements||{}).point||{}).radius||B.Chart.defaults.elements.point.radius),w=o.arrays.init(v,(((e.options.elements||{}).point||{}).hoverRadius||B.Chart.defaults.elements.point.hoverRadius)-1);x("uncheckedPointRadius",j),x("checkedPointRadius",w),x("pointRadius",h.uncheckedPointRadius)}}this._adjustDatasetBorderWidths(h)}),i&&this._checkItems(e)}_computeDatasetColors(e,t){if(!e||!e.data||!e.type)return{};let r=e.data,a=e.type,i={};if(e.options&&e.options.autoColor)i=this._computeDatasetColorsAutoColor(e,t);else if(i=this._computeDatasetColorsChartValueGroups(e,t),o.scout.isOneOf(a,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)){let s=this._computeBorderColor(a,0);i.borderColors=o.arrays.init(r.datasets.length,s),i.hoverBorderColors=i.borderColors}return i}_computeDatasetColorsAutoColor(e,t){if(!e||!e.data||!e.type||!e.options||!e.options.autoColor)return{};let r=e.data,a=e.type,i=e.options&&e.options.checkable,s=e.options&&e.options.transparent,n={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]},u=[];return t?u=o.arrays.init(r.datasets.length&&r.datasets[0].data.length||0,a):r.datasets.forEach(h=>u.push(h.type||a)),u.forEach((h,p)=>{n.backgroundColors.push(this._computeBackgroundColor(h,p,i||s)),n.borderColors.push(this._computeBorderColor(h,p)),n.hoverBackgroundColors.push(this._computeHoverBackgroundColor(h,p,i||s)),n.hoverBorderColors.push(this._computeHoverBorderColor(h,p)),n.checkedBackgroundColors.push(this._computeCheckedBackgroundColor(h,p,i)),n.checkedHoverBackgroundColors.push(this._computeCheckedHoverBackgroundColor(h,p,i)),n.legendColors.push(this._computeLegendColor(h,p)),n.pointHoverColors.push(this._computePointHoverColor(h,p))}),n}_computeBackgroundColor(e,t,r){return o.styles.get([this.colorSchemeCssClass,e+"-chart"+(r?" checkable":""),"elements","color"+t%this.numSupportedColors],"fill").fill}_computeBorderColor(e,t){let r;return o.scout.isOneOf(e,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(r={stroke:this.firstOpaqueBackgroundColor}),o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","stroke-color"+t%this.numSupportedColors],"stroke",r).stroke}_computeHoverBackgroundColor(e,t,r){return o.styles.get([this.colorSchemeCssClass,e+"-chart"+(r?" checkable":""),"elements","color"+t%this.numSupportedColors+" hover"],"fill").fill}_computeHoverBorderColor(e,t){let r;return o.scout.isOneOf(e,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(r={stroke:this.firstOpaqueBackgroundColor}),o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","stroke-color"+t%this.numSupportedColors+" hover"],"stroke",r).stroke}_computeCheckedBackgroundColor(e,t,r){return o.styles.get([this.colorSchemeCssClass,e+"-chart"+(r?" checkable":""),"elements","color"+t%this.numSupportedColors+" checked"],"fill").fill}_computeCheckedHoverBackgroundColor(e,t,r){return o.styles.get([this.colorSchemeCssClass,e+"-chart"+(r?" checkable":""),"elements","color"+t%this.numSupportedColors+" hover checked"],"fill").fill}_computeLegendColor(e,t){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","color"+t%this.numSupportedColors+" legend"],"fill").fill}_computePointHoverColor(e,t){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","color"+t%this.numSupportedColors+" point hover"],"fill").fill}_computeDatasetColorsChartValueGroups(e,t){if(!e||!e.type||!this.chart.data)return{};let r=e.type,a=e.options&&e.options.checkable,i=e.options&&e.options.transparent,s={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]};return this.chart.data.chartValueGroups.forEach(n=>{let u=1,h=1,p=.1,c=.1,f=.2,m=.35,y=1,b=0,C=1,_=.1;o.scout.isOneOf(r,d.Type.PIE,d.Type.DOUGHNUT)?(f=.7,m=.85,b=.1,_=0):r===d.Type.POLAR_AREA?(u=.7,h=.85,f=.7,m=.85,b=.1,_=0):o.scout.isOneOf(n.type||r,d.Type.LINE,d.Type.RADAR)?(u=.2,h=.35,p=0,c=0,y=.2,C=.35,_=0):o.scout.isOneOf(r,d.Type.BUBBLE,d.Type.SCATTER)&&(u=.2,h=.35,p=0);const x=[],v=[],T=[],I=[],W=[],z=[],U=[],j=[];let w=o.arrays.ensure(n.colorHexValue);const ee=o.arrays.length(n.values);w.length&&w.length<ee&&(w=o.arrays.init(ee,null).map((H,le)=>w[le%w.length])),w.forEach(H=>{const le=o.styles.hexToRgb(H),G=(de,ue)=>this._adjustColorOpacity(o.styles.darkerColor(le,ue),de);x.push(G(a||i?f:u,0)),v.push(G(1,0)),T.push(G(a||i?m:h,a||i?0:p)),I.push(G(1,c)),W.push(G(y,b)),z.push(G(C,_)),U.push(G(1,0)),j.push(G(1,0))}),s.backgroundColors.push(x),s.borderColors.push(v),s.hoverBackgroundColors.push(T),s.hoverBorderColors.push(I),s.checkedBackgroundColors.push(W),s.checkedHoverBackgroundColors.push(z),s.legendColors.push(U),s.pointHoverColors.push(j)}),s.datalabelColor=this._computeDatalabelColor(r),s}_adjustColorOpacity(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return!e||typeof e=="function"?e:e.indexOf("rgb")===0?this._adjustRgbColorOpacity(e,t):e.indexOf("#")===0?this._adjustHexColorOpacity(e,t):e}_adjustRgbColorOpacity(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;if(!e||e.indexOf("rgb")!==0)return e;let r=o.styles.rgb(e);return r.alpha=t,"rgba("+r.red+", "+r.green+", "+r.blue+", "+r.alpha+")"}_adjustHexColorOpacity(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return!e||e.indexOf("#")!==0||!(e.length===4||e.length===5||e.length===7||e.length===9)?e:this._adjustRgbColorOpacity(o.styles.hexToRgb(e),t)}_adjustLegendColors(e){!e||!e.type||!e.options||(e.options=g().extend(!0,{},e.options,{plugins:{legend:{labels:{color:this._computeLabelColor(e.type)}}}}))}_computeLabelColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","label"],"fill").fill}_generateLegendLabels(e){let t=e.config,r;B.Chart.overrides[t.type]&&B.Chart.overrides[t.type].plugins&&B.Chart.overrides[t.type].plugins.legend&&B.Chart.overrides[t.type].plugins.legend.labels&&(r=B.Chart.overrides[t.type].plugins.legend.labels.generateLabels);let i=(r||B.Chart.defaults.plugins.legend.labels.generateLabels).call(e,e);if(this.removing)return i;let s=t.data,n=e.ctx.measureText.bind(e.ctx),u=e.legend,h=u.getProps(["width","maxWidth"]),p=((u||{}).options||{}).labels||{},c=p.boxWidth||0,f=p.padding||0,m;return o.scout.isOneOf(t.options.plugins.legend.position,d.Position.LEFT,d.Position.RIGHT)?((h.maxWidth||u.width)&&(m=Math.max((h.maxWidth||u.width)-c-2*f,0)),m=Math.min(250,m||0,this.$canvas.cssWidth()/3)):m=Math.min(250,this.$canvas.cssWidth()*2/3),i.forEach((y,b)=>{y.text=o.strings.truncateText(y.text,m,n);let C=s.datasets[b],_,x,v;C&&o.scout.isOneOf(C.type||t.type,d.Type.LINE,d.Type.BAR,d.Type.RADAR,d.Type.BUBBLE,d.Type.SCATTER)?(_=o.arrays.ensure(C.legendColor)[0],x=this._adjustColorOpacity(o.arrays.ensure(C.borderColor)[0],1)):s.datasets.length&&o.scout.isOneOf(t.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(C=s.datasets[0],_=Array.isArray(C.legendColor)?C.legendColor[b]:C.legendColor,v=Array.isArray(C.backgroundColor)?C.backgroundColor[b]:C.backgroundColor,v=this._adjustColorOpacity(v,1)),o.objects.isFunction(_)&&(_=_.call(e,b));let T=_||v||x;o.objects.isFunction(T)||(y.fillStyle=T,y.strokeStyle=T)}),i}_adjustScalesRColors(e){if(!e||!e.type||!e.options||!e.options.scales||!e.options.scales.r)return;let t=this._computeLabelColor(e.type),r=this._computeLabelBackdropColor(e.type),a=this._computeGridColor(e.type),i=this._computeScaleTicksColor(e.type);e.options.scales.r.ticks=g().extend(!0,{},e.options.scales.r.ticks,{color:i,backdropColor:r}),e.options.scales.r.pointLabels=g().extend(!0,{},e.options.scales.r.pointLabels,{color:t}),e.options.scales.r.grid=g().extend(!0,{},e.options.scales.r.grid,{color:a})}_computeLabelBackdropColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","label-backdrop"],"fill",{fill:this.firstOpaqueBackgroundColor}).fill}_computeGridColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","grid"],"fill").fill}_computeScaleTicksColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","scale-ticks"],"fill").fill}_adjustScalesXYColors(e){if(!e||!e.type||!e.options||!e.options.scales)return;let t=[];if(e.options.scales.x&&t.push(e.options.scales.x),e.options.scales.y&&t.push(e.options.scales.y),!t.length)return;let r=this._computeLabelColor(e.type),a=this._computeGridColor(e.type),i=this._computeAxisLabelColor(e.type);t.forEach(s=>{s.grid=g().extend(!0,{},s.grid,{color:a}),s.ticks=g().extend(!0,{},s.ticks,{color:r}),s.title=g().extend(!0,{},s.title,{color:i})})}_computeAxisLabelColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","axis-label"],"fill").fill}_adjustPluginColors(e){!e||!e.type||!e.options||!e.options.plugins||this._adjustPluginsDatalabelColors(e)}_adjustPluginsDatalabelColors(e){!e||!e.type||!e.options||!e.options.plugins||!e.options.plugins.datalabels||(e.options.plugins.datalabels=g().extend(!0,{},e.options.plugins.datalabels,{color:this._computeDatalabelColor(e.type)}))}_computeDatalabelColor(e){return o.styles.get([this.colorSchemeCssClass,e+"-chart","elements","datalabel"],"fill").fill}_adjustClickHandler(e){if(!e||!e.options||(e.options.clickable?(e.options.onClick=this._clickHandler,e.options.onHover=this._pointerHoverHandler):e.options.onHover=this._hoverHandler,!e.options.plugins||!e.options.plugins.legend))return;let t=e.options.plugins.legend;t.clickable?(t.onClick=this._legendClickHandler,t.onHover=this._legendPointerHoverHandler,t.onLeave=this._legendPointerLeaveHandler):(t.onClick=r=>r.native.stopPropagation(),t.onHover=this._legendHoverHandler,t.onLeave=this._legendLeaveHandler)}_onClick(e,t){if(!t.length)return;let r=this._selectRelevantItem(t);if(this._isMaxSegmentsExceeded(this.chartJs.config,r.index))return;let a=r.index,i=r.datasetIndex,s={datasetIndex:i,dataIndex:a};if(o.scout.isOneOf(this.chartJs.config.type,d.Type.BUBBLE,d.Type.SCATTER)){let n=this.chartJs.config.data.datasets[i].data[a];s.xIndex=n.x,s.yIndex=n.y}else s.xIndex=a;this.chart.handleValueClick(s,e.native)}_selectRelevantItem(e){let t=this.chartJs.config.data.datasets,r=e[0];return this.chartJs.config.type===d.Type.BUBBLE&&e.forEach(a=>{t[a.datasetIndex].data[a.index].z<=t[r.datasetIndex].data[r.index].z&&(r=a)}),r}_onHover(e,t){if(!this.chartJs.config||!this.chartJs.config.type)return;let r=this.chartJs.config,a=r.type;if(!o.scout.isOneOf(a,d.Type.LINE,d.Type.BAR,d.Type.RADAR))return;let i=!1;this.resetDatasetAfterHover&&(this._restoreBackgroundColor(),this.resetDatasetAfterHover=!1,i=!0),t.forEach(s=>{let n=r.data.datasets[s.datasetIndex];o.scout.isOneOf(n.type||a,d.Type.LINE,d.Type.RADAR)&&(this._setHoverBackgroundColor(n),this.resetDatasetAfterHover=!0,i=!0)}),i&&this.refresh()}_onHoverPointer(e,t){this._onHover(e,t),!(!this.rendered||this.removing)&&(t.length&&!this._isMaxSegmentsExceeded(this.chartJs.config,t[0].index)?this.$canvas.css("cursor","pointer"):this.$canvas.css("cursor","default"))}_onLegendClick(e,t,r){if(!this.chartJs.config||!this.chartJs.config.type)return;let a=this.chartJs.config.type,i;B.Chart.overrides[a]&&B.Chart.overrides[a].plugins&&B.Chart.overrides[a].plugins.legend&&(i=B.Chart.overrides[a].plugins.legend.onClick),(i||B.Chart.defaults.plugins.legend.onClick).call(this.chartJs,e,t,r),this._onLegendLeave(e,t,r),this._onLegendHoverPointer(e,t,r),this._adjustSize(this.chartJs.config,this.chartJs.chartArea,{isDatasetVisible:n=>this.chartJs.getDatasetMeta(n).visible}),this.refresh()}_onLegendHover(e,t,r){let a=t.datasetIndex,i=this.chartJs.config,s=i.type;if(o.scout.isOneOf(s,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(a=t.index),this.legendHoverDatasets.indexOf(a)>-1)return;let n=i.data.datasets[a];((n?n.type:null)||s)===d.Type.LINE&&(this._setHoverBackgroundColor(n),this.refresh()),this._updateHoverStyle(a,!0),this.chartJs.render(),this.legendHoverDatasets.push(a)}_onLegendHoverPointer(e,t,r){this._onLegendHover(e,t,r),!(!this.rendered||this.removing)&&this.$canvas.css("cursor","pointer")}_onLegendLeave(e,t,r){let a=t.datasetIndex,i=this.chartJs.config,s=i.type;if(o.scout.isOneOf(s,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&(a=t.index),this.legendHoverDatasets.indexOf(a)<0)return;let n=i.data.datasets[a];((n?n.type:null)||s)===d.Type.LINE&&(this._restoreBackgroundColor(n),this.refresh()),this._updateHoverStyle(a,!1),this.chartJs.render(),this.legendHoverDatasets.splice(this.legendHoverDatasets.indexOf(a),1)}_setHoverBackgroundColor(e){e&&(e.backgroundColorBackup=e.backgroundColor,e.backgroundColor=e.hoverBackgroundColor,this._adjustDatasetBorderWidths(e))}_restoreBackgroundColor(e){e?(e.backgroundColor=e.backgroundColorBackup||e.backgroundColor,delete e.backgroundColorBackup,this._adjustDatasetBorderWidths(e)):this.chartJs.config.data.datasets.forEach(t=>this._restoreBackgroundColor(t))}_onLegendLeavePointer(e,t,r){this._onLegendLeave(e,t,r),!(!this.rendered||this.removing)&&this.$canvas.css("cursor","default")}_updateHoverStyle(e,t){let r=this.chartJs.config,a=r.type,i,s=[],n=r.data.datasets,u=n?n[e]:null,h=u?u.type:null;o.scout.isOneOf(a,d.Type.LINE,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA,d.Type.SCATTER)||h===d.Type.LINE?i="point":i="dataset",o.scout.isOneOf(a,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)?this.chartJs.getSortedVisibleDatasetMetas().forEach((p,c)=>s.push({element:p.data[e],datasetIndex:c,index:e})):this.chartJs.getDatasetMeta(e).data.forEach((p,c)=>s.push({element:p,datasetIndex:e,index:c})),s&&s.length&&this.chartJs.updateHoverStyle(s,i,t)}_adjustResizeHandler(e){!e||!e.options||e.options.handleResize&&(e.options.onResize=this._resizeHandler)}_onResize(e,t){e.update(),this._adjustSize(e.config,e.chartArea,{isDatasetVisible:r=>e.getDatasetMeta(r).visible})}_adjustSize(e,t,r){this._adjustBubbleSizes(e,t,r),this._adjustGridMaxMin(e,t,r)}_adjustBubbleSizes(e,t,r){if(e.type!==d.Type.BUBBLE)return;let a=e.data.datasets;a.forEach(f=>f.data.forEach(m=>{isNaN(m.z)||(m.r=Math.sqrt(m.z))}));let i=this._computeMaxMinValue(e,a,{...r,identifier:"r",exact:!0}),s=i.maxValue,n=i.minValue,u=1,h=0,p=(e.options||{}).bubble?e.options.bubble.sizeOfLargestBubble:0,c=(e.options||{}).bubble?e.options.bubble.minBubbleSize:0;if(p){let f=Math.abs(t.right-t.left),m=Math.abs(t.top-t.bottom);p=Math.min(p,Math.floor(Math.min(f,m)/6)),s===0?h=p:c&&p>c&&n/s<c/p?(u=(p-c)/(s-n),h=c-u*n):u=p/s}else c&&c>n&&(n===0?h=c:u=c/n);a.forEach(f=>f.data.forEach(m=>{o.objects.isNullOrUndefined(m.r)||(m.r=m.r*u+h)}))}_computeMaxMinValue(e,t,r){if(!t)return;const{identifier:a,exact:i,boundRange:s,padding:n,space:u}=r||{},h=(r==null?void 0:r.isDatasetVisible)||(b=>!0);let p,c;if(e.type===d.Type.SCATTER&&a==="r")p=0,c=0;else{const b=[];let C=!1;o.scout.isOneOf(e.type,d.Type.LINE,d.Type.BAR)?C=!!e.options.scales.y.stacked:e.type===d.Type.BAR_HORIZONTAL&&(C=!!e.options.scales.x.stacked);const _=x=>a?x[a]:x;for(let x=0;x<t.length;x++)if(!(!o.scout.isOneOf(e.type,d.Type.PIE,d.Type.DOUGHNUT,d.Type.POLAR_AREA)&&!h(x)))for(let v=0;v<t[x].data.length;v++){const T=_(t[x].data[v]);if(C){b[v]||(b[v]=0),b[v]+=T;continue}isNaN(p)?p=T:p=Math.max(T,p),isNaN(c)?c=T:c=Math.min(T,c)}C&&(p=Math.max(o.arrays.max(b),0),c=Math.min(o.arrays.min(b),0))}isNaN(p)&&(p=0),isNaN(c)&&(c=0);let f=0,m=p,y=c;if(i||(s&&Math.sign(c)===Math.sign(p)&&(f=Math.floor(c)),m=this._calculateBoundary(p-f,Math.ceil,Math.floor),y=this._calculateBoundary(c-f,Math.floor,Math.ceil)),n&&u&&u>2*n){let b=(p-c)/(u-2*n),C=b*n;m=Math.max(m,p-f+C),y=Math.min(y,c-f-C)}return i?{maxValue:m,minValue:y}:{maxValue:m+f,minValue:y+f}}_calculateBoundary(e,t,r){let a=t,i=!1;return e<0&&(i=!0,e=e*-1,a=r),e=this._calculateBoundaryPositive(e,a),i&&(e=e*-1),e}_calculateBoundaryPositive(e,t){if(!(e>0)||!t)return e;let r=Math.floor(Math.log(e)/Math.LN10);return r<0?e=t(e*Math.pow(10,Math.abs(r))/5)*5/Math.pow(10,Math.abs(r)):e=t(e/(5*Math.pow(10,r-1)))*5*Math.pow(10,r-1),e}_adjustGridMaxMin(e,t,r){if(!e||!e.type||!e.options||!e.options.adjustGridMaxMin||!e.options.scales||!t)return;let a=e.type;if(!o.scout.isOneOf(a,d.Type.BAR,d.Type.LINE,d.Type.POLAR_AREA,d.Type.RADAR,d.Type.BUBBLE,d.Type.SCATTER))return;let i=e.options.scales,s=i.x,n=i.y,u=i.r,h=s?s.minSpaceBetweenTicks:1,p=n?n.minSpaceBetweenTicks:1;u&&(h=u.minSpaceBetweenTicks,p=u.minSpaceBetweenTicks);let c=Math.abs(t.right-t.left),f=Math.abs(t.top-t.bottom),m=Math.max(Math.floor(c/h)+1,3),y=Math.max(Math.floor(f/p)+1,3),b=this._computeYBoundaries(e,{...r,space:f}),C=b.yBoundary,_=b.yBoundaryDiffType;if(u){this._adjustAxisMaxMin(u,Math.ceil(Math.min(m,y)/2),C);return}if(_?(this._adjustAxisMaxMin(n,y,C),this._adjustAxisMaxMin(i.yDiffType,y,_)):this._isHorizontalBar(e)?this._adjustAxisMaxMin(s,m,C):this._adjustAxisMaxMin(n,y,C),!o.scout.isOneOf(a,d.Type.BUBBLE,d.Type.SCATTER))return;let x=this._computeXBoundaryPointElement(e,{...r,space:c});this._adjustAxisMaxMin(s,m,x)}_computeBoundaryPointElement(e,t){const{identifier:r,space:a}=t;if(!e||!e.type||!o.scout.isOneOf(e.type,d.Type.BUBBLE,d.Type.SCATTER)||!e.data||!e.options||!e.options.scales||!(r==="x"||r==="y")||!a)return;let i=e.data.datasets,s=e.options.scales[r],n=s&&s.offset,u=e.options[r+"LabelMap"],h,p=this._computeMaxMinValue(e,i,{...t,identifier:"r",exact:!0,space:null}).maxValue,c=p;return e.options.elements&&e.options.elements.point&&e.options.elements.point.hoverRadius&&(c=c+e.options.elements.point.hoverRadius),n?h=this._computeMaxMinValue(e,i,{...t,exact:!!u,boundRange:!0,space:null}):h=this._computeMaxMinValue(e,i,{...t,exact:!!u,boundRange:!0,padding:c}),u&&(h.maxValue=Math.ceil(h.maxValue),h.minValue=Math.floor(h.minValue)),h}_computeXBoundaryPointElement(e,t){return this._computeBoundaryPointElement(e,{...t,identifier:"x"})}_computeYBoundaryPointElement(e,t){return this._computeBoundaryPointElement(e,{...t,identifier:"y"})}_computeYBoundaries(e,t){if(!e||!e.type)return{};let r=e.type,a,i;if(o.scout.isOneOf(r,d.Type.BUBBLE,d.Type.SCATTER))a=this._computeYBoundaryPointElement(e,t);else{let s=[],n=[];if(e.data&&e.data.datasets&&e.data.datasets.forEach(u=>{u.type&&u.type!==r?n.push(u):s.push(u)}),a=this._computeMaxMinValue(e,s,{...t,space:null}),a.maxValue===0&&a.minValue===0&&(a.maxValue=5),s.length&&n.length){i=this._computeMaxMinValue(e,n,{...t,space:null});let u=a.maxValue-a.minValue,h=i.maxValue-i.minValue;u&&h&&(u/h>10||h/u>10)&&this._adjustYAxisDiffType(e,s,n)}}return{yBoundary:a,yBoundaryDiffType:i}}_adjustYAxisDiffType(e,t,r){if(!e||!e.type||!t||!t.length||!r||!r.length||!e.options||!e.options.scales||!e.options.scales.y||e.options.scales.yDiffType)return;let a=e.type,i=e.options,s=i.scales,n=s.y,u=g().extend(!0,{},n);s.yDiffType=u,e.data&&e.data.datasets&&e.data.datasets.length&&e.data.datasets[0].type&&e.data.datasets[0].type!==a?(u.position=d.Position.LEFT,n.position=d.Position.RIGHT,n.grid.drawOnChartArea=!1):(n.position=d.Position.LEFT,u.position=d.Position.RIGHT,u.grid.drawOnChartArea=!1),n.border.display=!0,n.grid.drawTicks=!0,u.border.display=!0,u.grid.drawTicks=!0;let h=t[0].type||a,p=r[0].type||a,c=this.chart.session.text("ui."+h),f=this.chart.session.text("ui."+p),m=i.scaleLabelByTypeMap?i.scaleLabelByTypeMap[h]:null,y=i.scaleLabelByTypeMap?i.scaleLabelByTypeMap[p]:null;n.title.display=!0,n.title.text=m?m+" ("+c+")":c,u.title.display=!0,u.title.text=y?y+" ("+f+")":f,t.forEach(b=>{b.yAxisID="y"}),r.forEach(b=>{b.yAxisID="yDiffType"})}_adjustAxisMaxMin(e,t,r){if(!e)return;let a=1;e.ticks=g().extend(!0,{},e.ticks,{maxTicksLimit:t}),r&&(e.suggestedMax=r.maxValue,e.suggestedMin=r.minValue,a=(r.maxValue-r.minValue)/(t-1)),e.ticks.stepSize=this.onlyIntegers&&a<1?1:void 0}_remove(e){this.rendered&&!this.removing&&(this.removing=!0,this.chartJs.destroy(),this.chartJs=null,this.$canvas.remove(),this.$canvas=null),super._remove(e),this.removing=!1}}A(J,"ARROW_LEFT_RIGHT","↔"),A(J,"ARROW_UP_DOWN","↕");function fe(l,e,t){return(e=dt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function dt(l){var e=ut(l,"string");return typeof e=="symbol"?e:e+""}function ut(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Be extends M{constructor(e){super(e),fe(this,"animationTriggered",void 0),fe(this,"segmentSelectorForAnimation",void 0),fe(this,"r",void 0),fe(this,"fullR",void 0),this.animationTriggered=!1,this.segmentSelectorForAnimation=".fulfillment-chart",this.suppressLegendBox=!0;let t={options:{fulfillment:{startValue:void 0}}};e.config=g().extend(!0,{},t,e.config)}_validate(){let e=this.chart.data.chartValueGroups;return!(e.length!==2||e[0].values.length!==1||e[1].values.length!==1)}_renderInternal(){let e=this.chart.data,t=e.chartValueGroups[0].values[0],r=e.chartValueGroups[1].values[0];this.fullR=Math.min(this.chartBox.height,this.chartBox.width)/2-2,this._renderInnerCircle(),this._renderPercentage(t,r)}_renderPercentage(e,t){let r="fulfillment-chart",a=o.arrays.ensure(this.chart.data.chartValueGroups[0].colorHexValue)[0],i=this.chart.data.chartValueGroups[0].cssClass;this.chart.config.options.autoColor?r+=" auto-color":i&&(r+=" "+i);let s=o.scout.nvl(this.chart.config.options.fulfillment.startValue,0),n=0,u=0;t&&(n=Math.min(e/t,.999999),u=Math.min(s/t,.999999)),this.r=this.fullR;let h=this,p=function(C,_){let x=g()(this),v=x.data("animation-start"),T=x.data("animation-end");x.attr("d",h.pathSegment(v*_.pos,u+(T-u)*_.pos))},c=this.$svg.appendSVG("path",r).data("animation-start",0).data("animation-end",n),f=this.fullR/8*6.7;this._renderCirclePath("fulfillment-chart-inner-circle-transparent","InnerCircle3",f).css("fill",this.firstOpaqueBackgroundColor);let y=t?Math.round(e/t*100):0,b=this.$svg.appendSVG("text","fulfillment-chart-label ").attr("x",this.chartBox.mX()).attr("y",this.chartBox.mY()).css("font-size",this.fullR/2+"px").attr("dy","0.3em").attrXLINK("href","#InnerCircle").text(y+"%");this.chart.config.options.clickable&&c.on("click",this._createClickObject(null,null),C=>this.chart.handleValueClick(C.data)),!this.chart.config.options.autoColor&&!i&&c.attr("fill",a),this.animationDuration?(c.attr("d",this.pathSegment(0,u)).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(p,this.animationDuration)),b.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)):c.attr("d",this.pathSegment(0,n)),o.aria.description(this.$svg,this.session.text("ui.FulfillmentChartAriaDescription",y))}pathSegment(e,t){let r=e*2*Math.PI,a=t*2*Math.PI,i="";return i+="M"+(this.chartBox.mX()+this.r*Math.sin(r))+","+(this.chartBox.mY()-this.r*Math.cos(r)),i+="A"+this.r+", "+this.r,i+=t-e<.5?" 0 0,1 ":" 0 1,1 ",i+=this.chartBox.mX()+this.r*Math.sin(a)+","+(this.chartBox.mY()-this.r*Math.cos(a)),i+="L"+this.chartBox.mX()+","+this.chartBox.mY()+"Z",i}_renderCirclePath(e,t,r){let a=this.chart.data.chartValueGroups[0].cssClass,i=o.arrays.ensure(this.chart.data.chartValueGroups[1].colorHexValue)[0];this.chart.config.options.autoColor?e+=" auto-color":a&&(e+=" "+a);let s=r*2,n=this.$svg.appendSVG("path",e).attr("id",t).attr("d","M "+this.chartBox.mX()+" "+this.chartBox.mY()+" m 0, "+-r+" a "+r+","+r+" 0 1, 1 0,"+s+" a "+r+","+r+" 0 1, 1 0,"+-s);return!this.chart.config.options.autoColor&&!a&&n.attr("fill",i).attr("stroke",i),n}_renderInnerCircle(){let e=this.fullR/8*7.5,t=this.fullR/8*7.2;this._renderCirclePath("fulfillment-chart-inner-circle","InnerCircle",e),this._renderCirclePath("fulfillment-chart-inner-circle-transparent","InnerCircle2",t).css("fill",this.firstOpaqueBackgroundColor)}shouldAnimateRemoveOnUpdate(e){let t=o.objects.optProperty(this.chart,"config","options","fulfillment","startValue");return o.objects.isNullOrUndefined(t)?super.shouldAnimateRemoveOnUpdate(e):!1}_removeAnimated(e){if(this.animationTriggered)return;let t=this,r=function(a,i){let s=g()(this),n=s.data("animation-start"),u=s.data("animation-end");s.attr("d",t.pathSegment(n*(1-i.pos),u*(1-i.pos)))};this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r)).promise().done(()=>{this._remove(e),this.animationTriggered=!1})}}var Le;function O(l,e,t){return(e=ct(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function ct(l){var e=pt(l,"string");return typeof e=="symbol"?e:e+""}function pt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class k extends M{constructor(e){super(e),O(this,"segmentSelectorForAnimation",void 0),O(this,"r",void 0),O(this,"scaleWeight",void 0),O(this,"my",void 0),O(this,"parts",void 0),O(this,"numSegmentsPerPart",void 0),O(this,"segmentWidth",void 0),O(this,"widthOfSegmentWithGap",void 0),O(this,"animationTriggered",void 0),O(this,"$filledParts",void 0),O(this,"$pointer",void 0),this.segmentSelectorForAnimation=".pointer",this.suppressLegendBox=!0;let t={options:{speedo:{greenAreaPosition:void 0}}};e.config=$.extend(!0,{},t,e.config)}_validate(){let e=this.chart.data,t=this.chart.config;return!(!e||!t||e.axes.length>0||e.chartValueGroups.length!==1||e.chartValueGroups[0].values.length!==3||t.options.speedo.greenAreaPosition===void 0)}_renderInternal(){let e=this.chart.data,t=e.chartValueGroups[0].values[0],r=e.chartValueGroups[0].values[2],a=e.chartValueGroups[0].values[1];this.r=Math.min(this.chartBox.height,this.chartBox.width/2)*.7,this.scaleWeight=this.r*.27,this.my=this.chartBox.yOffset+this.chartBox.height-(this.chartBox.height-this.r*1.12)/2,this.parts=this.chart.config.options.speedo.greenAreaPosition===k.Position.CENTER?k.NUM_PARTS_GREEN_CENTER:k.NUM_PARTS_GREEN_EDGE,this.numSegmentsPerPart=this.parts===k.NUM_PARTS_GREEN_CENTER?5:8,this.$filledParts=[];let i=this.parts*this.numSegmentsPerPart,s=i-1;this.segmentWidth=(k.ARC_RANGE-s*k.SEGMENT_GAP)/i,this.widthOfSegmentWithGap=this.segmentWidth+k.SEGMENT_GAP;let n=this._getValuePercentage(a,t,r),u=this._getSegmentToPointAt(n,i),h=this._getPercentageValueOfSegment(u%this.numSegmentsPerPart,this._getPartForValue(n));for(let p=0;p<this.parts;p++)this._renderCirclePart(p);this._renderPointer(h),this._renderLegend(t,a,r,e.chartValueGroups[0].groupName),this.$svg.addClass("speedo-chart-svg"),this.chart.config.options.clickable&&this.$svg.on("click",this._createClickObject(null,null),p=>this.chart.handleValueClick(p.data))}_getValuePercentage(e,t,r){return this._limitValue((e-t)/(r-t),1)}_getSegmentToPointAt(e,t){return this._limitValue(Math.floor(e*t),t-1)}_limitValue(e,t){return e=Math.max(e,0),e=Math.min(e,t),e}_getPercentageValueOfSegment(e,t){let r=this._calcSegmentPos(e,t),a=r.from-k.ARC_MIN+(r.to-r.from)/2;return this._limitValue(a/k.ARC_RANGE,1)}_renderPointer(e){if(this.$pointer=this.$svg.appendSVG("path","pointer").attr("d",this._pathPointer(0)).attr("data-end",e).attr("stroke-width",this.scaleWeight/6+"px").attr("fill","none"),this.animationDuration){let t=this,r=function(a,i){let s=this.getAttribute("data-end")*i.pos;t._updatePointer(s),t._updatePartsFill(s)};this.$pointer.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r,this.animationDuration))}else this._updatePointer(e),this._updatePartsFill(e)}_renderSegment(e,t,r){return this.$svg.appendSVG("path","speedo-chart-arc "+r).attr("id","ArcAxisWide"+this.chart.id).attr("fill","none").attr("stroke-width",this.scaleWeight+"px").attr("d",this._pathSegment(e,t))}_renderCirclePart(e){let t=this._getColorForPart(e);for(let r=0;r<this.numSegmentsPerPart;r++){let a=this._calcSegmentPos(r,e);this._renderSegment(a.from,a.to,t)}this.$filledParts.push(this._renderSegment(k.ARC_MIN,k.ARC_MIN,t))}_renderLegend(e,t,r,a){let i=this.scaleWeight*.8,s=5,n=this.my+s,u=n+i*.8,h={x1:null,x2:this.chartBox.mX()-s,y1:null,y2:n,v:-1,h:1},p=e?this._formatValue(e):0,c=t?this._formatValue(t):"0",f=r?this._formatValue(r):0;if(this.chart.config.options.plugins.tooltip.enabled){let m=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()-this.r).attr("y",u).text(p).attr("style","font-size: "+i+"px; text-anchor: middle"),y=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()+this.r).attr("y",u).text(f).attr("style","font-size: "+i+"px; text-anchor: middle"),b=(function(){this.$svg.append(m),this.$svg.append(y)}).bind(this),C=()=>{m.detach(),y.detach()};C(),this.$svg.on("mouseenter",b).on("mouseleave",C)}this.chart.config.options.plugins.legend.display&&this._renderLineLabel(h.x2+s,h.y2+h.v*s,c,"",!1).addClass("speedo-chart-label").attr("style","font-size: "+this.scaleWeight*1.55+"px;"),o.aria.description(this.$svg,this.session.text("ui.SpeedoChartAriaDescription",c,p,f))}_getPartForValue(e){let t=Math.floor(e*this.parts);return this._limitValue(t,this.parts-1)}_formatValue(e){if(e<k.TEN_THOUSAND)return this.session.locale.decimalFormat.format(e);if(e<k.ONE_MILLION)return Math.floor(e/k.ONE_THOUSAND)+"k";let t=e/k.ONE_MILLION;return t=o.numbers.round(t,o.RoundingMode.HALF_UP,2),this.session.locale.decimalFormat.format(t)+"M"}_updatePointer(e){this.$pointer.attr("d",this._pathPointer(e)).removeClass("red yellow light-green dark-green").addClass(this._getColorForPart(this._getPartForValue(e)))}_updatePartsFill(e){let t,r;for(let a=0;a<this.$filledParts.length;a++)t=this._calcSegmentPos(0,a).from,(a+1)/this.parts<e?r=this._calcSegmentPos(this.numSegmentsPerPart-1,a).to:a/this.parts>e?(t=k.ARC_MIN,r=k.ARC_MIN):r=k.ARC_RANGE*e-k.ARC_MAX,this.$filledParts[a].attr("d",this._pathSegment(t,r))}_calcSegmentPos(e,t){let r={from:0,to:0},a=e+t*this.numSegmentsPerPart;return r.from=a*this.widthOfSegmentWithGap-k.ARC_MAX,r.to=r.from+this.segmentWidth,r}_getColorForPart(e){switch(this.chart.config.options.speedo.greenAreaPosition){case k.Position.LEFT:if(e===0)return"dark-green";if(e===1)return"light-green";if(e===2)return"yellow";if(e===3)return"red";break;case k.Position.RIGHT:if(e===0)return"red";if(e===1)return"yellow";if(e===2)return"light-green";if(e===3)return"dark-green";break;case k.Position.CENTER:if(e===0)return"red";if(e===1)return"yellow";if(e===2)return"light-green";if(e===3)return"dark-green";if(e===4)return"light-green";if(e===5)return"yellow";if(e===6)return"red";break;default:break}}_pathSegment(e,t){let r=e*2*Math.PI,a=t*2*Math.PI,i="";return i+="M "+(this.chartBox.mX()+this.r*Math.sin(r))+" "+(this.my-this.r*Math.cos(r))+" ",i+="A "+this.r+" "+this.r+" ",i+="0 "+(t-e<.5?"0":"1")+" 1 ",i+=this.chartBox.mX()+this.r*Math.sin(a)+" "+(this.my-this.r*Math.cos(a)),i}_pathPointer(e){let r=(k.ARC_RANGE*e-k.ARC_MAX)*2*Math.PI,a=this.r-1.4*this.scaleWeight,i=this.r+1.37*this.scaleWeight,s="";return s+="M "+(this.chartBox.mX()+i*Math.sin(r))+" "+(this.my-i*Math.cos(r))+" ",s+="L "+(this.chartBox.mX()+a*Math.sin(r))+" "+(this.my-a*Math.cos(r))+" ",s+="Z",s}_removeAnimated(e){if(this.animationTriggered)return;let t=this,r=function(a,i){let s=this.getAttribute("data-end")*(1-i.pos);t._updatePointer(s),t._updatePartsFill(s)};this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r)).promise().done(()=>{this._remove(e),this.animationTriggered=!1})}}Le=k,O(k,"Position",{LEFT:"left",CENTER:"center",RIGHT:"right"}),O(k,"NUM_PARTS_GREEN_CENTER",7),O(k,"NUM_PARTS_GREEN_EDGE",4),O(k,"ONE_THOUSAND",1e3),O(k,"TEN_THOUSAND",1e4),O(k,"ONE_MILLION",1e6),O(k,"ARC_MIN",-.25),O(k,"ARC_MAX",.25),O(k,"ARC_RANGE",Le.ARC_MAX-Le.ARC_MIN),O(k,"SEGMENT_GAP",.0103);function V(l,e,t){return(e=ft(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function ft(l){var e=mt(l,"string");return typeof e=="symbol"?e:e+""}function mt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Se extends M{constructor(e){super(e),V(this,"segmentSelectorForAnimation",void 0),V(this,"widthThresholdMedium",void 0),V(this,"widthThresholdSmall",void 0),V(this,"barDeltaPercentage",void 0),V(this,"lastBarAdditionalPercentage",void 0),V(this,"lastBarMinWidthPercentage",void 0),V(this,"paddingBetweenLabel",void 0),V(this,"dataAnalyzeResult",void 0),V(this,"barHeight",void 0),V(this,"barAreaWidth",void 0),V(this,"centerX",void 0),V(this,"animationTriggered",void 0),this.segmentSelectorForAnimation=".salesfunnel-chart-bar",this.widthThresholdMedium=400,this.widthThresholdSmall=200,this.barDeltaPercentage=.95,this.lastBarAdditionalPercentage=.7,this.lastBarMinWidthPercentage=.4,this.suppressLegendBox=!0;let t={options:{salesfunnel:{normalized:void 0,calcConversionRate:void 0}}};e.config=g().extend(!0,{},t,e.config)}_validate(){let e=this.chart.data,t=this.chart.config;return!(!e||!t||e.axes.length!==e.chartValueGroups.length||e.chartValueGroups.length===0||e.chartValueGroups[0].values.length===0||t.options.salesfunnel.normalized===void 0||t.options.salesfunnel.calcConversionRate===void 0)}_renderInternal(){let e=this.chart.data,t=e.chartValueGroups.length,r=this._dynamicConversionRateWidth();this.paddingBetweenLabel=20,this.dataAnalyzeResult=this._analyzeData(e.chartValueGroups),this.barHeight=this.chartBox.height/t,this.barAreaWidth=this.chartBox.width-this.dataAnalyzeResult.maxLengthFirstValueRow-this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount-this.dataAnalyzeResult.maxLengthSecondValueRow-r,this.centerX=this.barAreaWidth/2,this.chart.config.options.salesfunnel.normalized?this._renderBarsNormalized(e.chartValueGroups):this._renderBarsAccordingToValues(e.chartValueGroups),this._addClipping("salesfunnel-chart-bar")}_renderBarsNormalized(e){let t=e.length,r=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*(this.dataAnalyzeResult.labelCount+1),a=this.barAreaWidth*(1-this.barDeltaPercentage),s=this.barAreaWidth*this.lastBarMinWidthPercentage/this.lastBarAdditionalPercentage;a=Math.min(a,(this.barAreaWidth-s)/(t-1));for(let n=0;n<t;n++){let u=this.barAreaWidth-n*a,h=e[n].groupName,p=this.barAreaWidth-(n+1)*a,c=n*this.barHeight,f={xStart:this.centerX,yStart:c,rect:!0,width:u,widthBottom:p,cssClass:"salesfunnel-chart-bar",fill:o.arrays.ensure(e[n].colorHexValue)[0],label:e[n].groupName,clickObject:this._createClickObject(null,n)};this.chart.config.options.autoColor?f.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[n].cssClass&&(f.cssClass+=" "+this.chart.data.chartValueGroups[n].cssClass),n===t-1&&(f.width=f.width*this.lastBarAdditionalPercentage,f.widthBottom=f.widthBottom*this.lastBarAdditionalPercentage),this._renderPolygon(f),this._renderLabel(e[n].values[0],!1,n),this._renderBarLabel(h,n,f.widthBottom);let m=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;e[n].values.length>1&&(this._renderLabel(e[n].values[1],!0,n),m+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),n>0&&(this._renderLabelSeparatorLine(c,m),this.chart.config.options.salesfunnel.calcConversionRate&&this._renderConversionRate(n,r,this._calcConversionRate(e[n-1].values[0],e[n].values[0])))}}_renderLabel(e,t,r){if(e===null)return;let a=r*this.barHeight+this.barHeight/2,i=this.dataAnalyzeResult.maxLengthFirstValueRow+(t?this.dataAnalyzeResult.maxLengthSecondValueRow:0),s=t?2:1,n=this.barAreaWidth+i+s*this.paddingBetweenLabel,u=this._dynamicCssClass("salesfunnel-label"),h=this.$svg.appendSVG("text",u).attr("x",n).attr("y",a).text(this.session.locale.decimalFormat.format(e));if(this.animationDuration&&h.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),this.chart.config.options.plugins.tooltip.enabled&&this.chart.data.axes.length>0){let p=this.chart.data.axes[r][t?1:0].label,c=this._measureText(""+e,u);this._renderWireLabels(p,h,n-c.width/2,a-c.height)}}_renderWireLabels(e,t,r,a){let i={x1:r,x2:r-10,y1:a,y2:a-10,v:-1,h:-1},s=(p,c)=>(i.y2-c<0&&(i.v=1,i.y1=i.y1+c*1.5,i.y2=i.y1+10),i);i.autoPosition=!0,i.posFunc=s;let n=this._renderWireLegend(e,i,"line-chart-wire-label",!0),u=n.attachFunc.bind(n),h=n.detachFunc.bind(n);n.detachFunc(),t.on("mouseenter",u).on("mouseleave",h)}_renderBarLabel(e,t,r){let a=t*this.barHeight+this.barHeight/2,i=this.centerX,s=this._dynamicCssClass("salesfunnel-bar-label");this._renderLineLabel(i,a,e,s,!0)}_renderConversionRate(e,t,r){if(r===void 0)return;let a=e*this.barHeight,i=this._dynamicCssClass("salesfunnel-conversionrate-label"),s=this.$svg.appendSVG("text",i).attr("x",t).attr("y",a).text("↓ "+r+"%");this.animationDuration&&s.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_renderPolygon(e){let t=this,r=this._calcPolygonPoints(!0,this.animationDuration?0:1,e.xStart,e.yStart,e.width,e.widthBottom,this.barHeight-1),a=this.$svg.appendSVG("polygon",e.cssClass,"",e.id).attr("points",r).data("xStart",e.xStart).data("yStart",e.yStart).data("widthBar",e.width).data("widthBottom",e.widthBottom).data("heightBar",this.barHeight);!this.chart.config.options.autoColor&&e.fill&&a.attr("fill",e.fill),a.css("stroke",this.firstOpaqueBackgroundColor);let i=function(s,n){let u=g()(this),h=u.data("xStart"),p=u.data("yStart"),c=u.data("widthBar"),f=u.data("heightBar"),m=u.data("widthBottom");u.attr("points",t._calcPolygonPoints(!0,n.pos,h,p,c,m,f))};return this.animationDuration&&a.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(i,this.animationDuration)),this.chart.config.options.clickable&&a.on("click",e.clickObject,s=>this.chart.handleValueClick(s.data)),e.fill&&a.attr("fill",e.fill),a}_calcPolygonPoints(e,t,r,a,i,s,n){let u=0,h=0;return e?(u=i/2*t,h=s/2*t):(u=i/2-i/2*t,h=s/2-s/2*t),o.strings.join(" ",r-u+","+a,r+u+","+a,r+h+","+(a+n),r-h+","+(a+n))}_renderBarsAccordingToValues(e){let t=this.dataAnalyzeResult.maxValue?this.barAreaWidth*.8/this.dataAnalyzeResult.maxValue:0,r=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount+2*this.paddingBetweenLabel,a=e.length;for(let i=0;i<a;i++){let s=e[i].values[0]*t+this.barAreaWidth*.2,n=e[i].groupName,u=i*this.barHeight,h={xStart:this.centerX,yStart:u,rect:!0,width:s,widthBottom:s,cssClass:"salesfunnel-chart-bar",fill:o.arrays.ensure(e[i].colorHexValue)[0],label:e[i].groupName,clickObject:this._createClickObject(null,i)};this.chart.config.options.autoColor?h.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[i].cssClass&&(h.cssClass+=" "+this.chart.data.chartValueGroups[i].cssClass),this._renderPolygon(h),this._renderLabel(e[i].values[0],!1,i),this._renderBarLabel(n,i,h.widthBottom);let p=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;e[i].values.length>1&&(this._renderLabel(e[i].values[1],!0,i),p+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),i>0&&(this._renderLabelSeparatorLine(u,p),this.chart.config.options.salesfunnel.calcConversionRate&&this._renderConversionRate(i,r,this._calcConversionRate(e[i-1].values[0],e[i].values[0])))}}_renderLabelSeparatorLine(e,t){let r=this.$svg.appendSVG("line","label-separator").attr("x1",this.barAreaWidth+this.paddingBetweenLabel).attr("y1",e).attr("x2",this.barAreaWidth+t).attr("y2",e);this.animationDuration&&r.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_calcConversionRate(e,t){if(!(o.objects.isNullOrUndefined(e)||o.objects.isNullOrUndefined(t)||e===0))return Math.round(t/e*100)}_analyzeData(e){let t={labelCount:0,maxValue:null,maxLengthFirstValueRow:0,maxLengthSecondValueRow:0},r=this._dynamicCssClass("salesfunnel-label");for(let a=0;a<e.length;a++){let i=e[a];t.labelCount=Math.max(t.labelCount,i.values.length),i.values.length>0&&i.values[0]&&(t.maxValue===null?t.maxValue=i.values[0]:t.maxValue=Math.max(t.maxValue,i.values[0]),t.maxLengthFirstValueRow=Math.max(t.maxLengthFirstValueRow,this._measureText(this.session.locale.decimalFormat.format(i.values[0]),r).width)),i.values.length>1&&i.values[1]&&(t.maxLengthSecondValueRow=Math.max(t.maxLengthSecondValueRow,this._measureText(this.session.locale.decimalFormat.format(i.values[1]),r).width))}return t}_removeAnimated(e){if(this.animationTriggered)return;this.animationTriggered=!0;let t=this,r=function(a,i){let s=g()(this),n=s.data("xStart"),u=s.data("yStart"),h=s.data("widthBar"),p=s.data("heightBar"),c=s.data("widthBottom");s.attr("points",t._calcPolygonPoints(!1,i.pos,n,u,h,c,p))};this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r)).promise().done(()=>{this._remove(e),this.animationTriggered=!1})}_dynamicCssClass(e){let t="";return this.chartBox.width<=this.widthThresholdSmall?t="small":this.chartBox.width<=this.widthThresholdMedium&&(t="medium"),o.strings.join(" ",e,t)}_dynamicConversionRateWidth(){return this.chart.config.options.salesfunnel.calcConversionRate?this.chartBox.width<=this.widthThresholdSmall?60:this.chartBox.width<=this.widthThresholdMedium?80:100:0}}function P(l,e,t){return(e=bt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function bt(l){var e=yt(l,"string");return typeof e=="symbol"?e:e+""}function yt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Oe{constructor(e,t,r,a,i,s,n,u,h,p,c,f,m,y){P(this,"helper",void 0),P(this,"venn1",void 0),P(this,"venn2",void 0),P(this,"venn3",void 0),P(this,"u",void 0),P(this,"v",void 0),P(this,"w",void 0),P(this,"uv",void 0),P(this,"uw",void 0),P(this,"vw",void 0),P(this,"uvw",void 0),P(this,"maxD",void 0),P(this,"dStep",void 0),P(this,"rStep",void 0),P(this,"alphaStep",void 0),P(this,"alphaBest",void 0),P(this,"dBest",void 0),P(this,"rBest",void 0),P(this,"errorBest",void 0),P(this,"callback",void 0),P(this,"cancelled",void 0),i===0&&u===0&&h===0&&c===0&&(i=1),s===0&&u===0&&p===0&&c===0&&(s=1),n===0&&h===0&&p===0&&c===0&&(n=1),this.helper=e,this.venn1=t,this.venn2=r,this.venn3=a,this.u=i,this.v=s,this.w=n,this.uv=u,this.uw=h,this.vw=p,this.uvw=c,this.maxD=this.venn1.r+2*this.venn2.r+2*this.venn1.r+this.helper.distR,this.dStep=this.maxD/30,this.rStep=a.r/4,this.alphaStep=Math.PI/30,this.alphaBest=0,this.dBest=0,this.rBest=0,this.errorBest=0,this.callback=null,this.cancelled=!1}start(e){this.callback=e,setTimeout(this._next.bind(this,0))}cancel(){this.cancelled=!0}_end(){this.venn3.x=this.venn1.x+this.dBest*Math.cos(this.alphaBest),this.venn3.y=this.venn1.y-this.dBest*Math.sin(this.alphaBest),this.venn3.r=this.rBest,this.callback()}_next(e){this.cancelled||this._iteration(e),!this.cancelled&&(e+=this.alphaStep,e<Math.PI?setTimeout(this._next.bind(this,e)):this._end())}_iteration(e){let t=this.maxD,r=this.dStep,a=this.helper.minR,i=this.rStep,s=this.helper.total,n=this.venn1.x,u=this.venn1.y,h=this.venn1.r,p=this.venn2.x,c=this.venn2.y,f=this.venn2.r,m=this.venn3.r,y=this.u,b=this.v,C=this.w,_=this.uv,x=this.uw,v=this.vw,T=this.uvw,I=this.alphaBest,W=this.dBest,z=this.rBest,U=this.errorBest;for(let j=0;j<t;j+=r){let w=n+j*Math.cos(e),ee=u-j*Math.sin(e);for(let H=Math.max(a,m*.75);H<=m*1.25;H+=i){let le=Math.min(n-h,p-f,w-H),G=Math.max(n+h,p+f,w+H),de=Math.min(u-h,c-f,ee-H),ue=Math.max(u+h,c+f,ee+H),$e=(G-le)/100,Ue=(ue-de)/100,be=0,ye=0,_e=0,ge=0,Ce=0,xe=0,Te=0;for(let q=le;q<G;q+=$e)for(let K=de;K<ue;K+=Ue){let re=(q-n)*(q-n)+(K-u)*(K-u)<h*h,ae=(q-p)*(q-p)+(K-c)*(K-c)<f*f,ie=(q-w)*(q-w)+(K-ee)*(K-ee)<H*H;re&&ae&&ie?Te++:re&&ae&&!ie?ge++:re&&!ae&&!ie?be++:!re&&ae&&!ie?ye++:re&&!ae&&ie?Ce++:!re&&ae&&ie?xe++:!re&&!ae&&ie&&_e++}let te=be+ye+_e+ge+Ce+xe+Te,X=j/t;X+=this._error(T,s,Te,te),X+=this._error(_,s,ge,te),X+=this._error(x,s,Ce,te),X+=this._error(v,s,xe,te),X+=this._error(y,s,be,te),X+=this._error(b,s,ye,te),X+=this._error(C,s,_e,te),(e===0||X<U)&&(I=e,W=j,z=H,U=X)}}this.alphaBest=I,this.dBest=W,this.rBest=z,this.errorBest=U}_error(e,t,r,a){return e===0&&r!==0||e!==0&&r===0?1e3:Math.abs(e/t-r/a)*100}}function me(l,e,t){return(e=_t(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function _t(l){var e=gt(l,"string");return typeof e=="symbol"?e:e+""}function gt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Pe{constructor(e,t,r,a){me(this,"distR",void 0),me(this,"maxR",void 0),me(this,"minR",void 0),me(this,"total",void 0),this.distR=e,this.maxR=t,this.minR=r,this.total=a}findBalance2(e,t){let r=(e.r*e.x+t.r*t.x)/(e.r+t.r),a=(e.r*e.y+t.r*t.y)/(e.r+t.r);e.x=e.x-r,t.x=t.x-r,e.y=e.y-a,t.y=t.y-a}findBalance3(e,t,r){let a=(e.r*e.x+t.r*t.x+r.r*r.x)/(e.r+t.r+r.r),i=(e.r*e.y+t.r*t.y+r.r*r.y)/(e.r+t.r+r.r);e.x=e.x-a,t.x=t.x-a,r.x=r.x-a,e.y=e.y-i,t.y=t.y-i,r.y=r.y-i}calcR(e,t){return e===-1?this.maxR*t:Math.max(this.minR,Math.sqrt(e/this.total)*this.maxR*t)}calcD(e,t,r,a,i,s){let n;if(i===0)n=e.r+t.r+this.distR*2;else if(r===0&&a===0)n=0;else if(r===0)n=Math.max(0,t.r-e.r-this.distR),n<1.5*this.distR&&s&&(n=1.5*this.distR,e.r=t.r-n);else if(a===0)n=Math.max(0,e.r-t.r-this.distR),n<1.5*this.distR&&s&&(n=1.5*this.distR,t.r=e.r-n);else{let u=Math.min(e.r,t.r),h=Math.max(e.r,t.r);n=2*(Math.min(r,a)/(Math.min(r,a)+i))*u-u+h,n=Math.max(3*this.distR,n),n=Math.min(u+h-3*this.distR,n),n=Math.max(h-u+3*this.distR,n)}return n}}function D(l,e,t){return(e=Ct(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Ct(l){var e=xt(l,"string");return typeof e=="symbol"?e:e+""}function xt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class De extends M{constructor(e){super(e),D(this,"animationTriggered",void 0),D(this,"data",void 0),D(this,"centerX",void 0),D(this,"centerY",void 0),D(this,"numberOfCircles",void 0),D(this,"readyToDraw",void 0),D(this,"wasCircle",void 0),D(this,"vennCircleHelper",void 0),D(this,"async3Calculator",void 0),D(this,"vennNumber1",void 0),D(this,"vennReal1",void 0),D(this,"vennNumber2",void 0),D(this,"vennReal2",void 0),D(this,"vennNumber3",void 0),D(this,"vennReal3",void 0),D(this,"$v1",void 0),D(this,"$v2",void 0),D(this,"$v3",void 0),this.animationTriggered=!1,this.suppressLegendBox=!0;let t={options:{venn:{numberOfCircles:void 0}}};e.config=g().extend(!0,{},t,e.config)}_validate(){let e=this.chart.data;return!(!e||e.axes.length!==0||e.chartValueGroups.length===0||e.chartValueGroups[0].values.length===0)}_renderInternal(){if(this.centerX=this.width/2,this.centerY=this.height/2,this.centerX===0||this.centerY===0)return;this.data=this.chart.data.chartValueGroups,this.numberOfCircles=this.chart.config.options.venn.numberOfCircles;let e=10,t=Math.min(this.centerX,this.centerY),r=t/15,a=this.data.reduce((n,u)=>n+u.values[0],1);this.vennCircleHelper=new Pe(e,t,r,a),this.numberOfCircles>0&&(this.$v1=this._createCircle(0,o.arrays.ensure(this.data[0].colorHexValue)[0],this.data[0].cssClass),this.vennNumber1=new Z(this.$v1),this.vennReal1=new Z(this.$v1)),this.numberOfCircles>1&&(this.$v2=this._createCircle(1,o.arrays.ensure(this.data[1].colorHexValue)[0],this.data[1].cssClass),this.vennNumber2=new Z(this.$v2),this.vennReal2=new Z(this.$v2)),this.numberOfCircles>2&&(this.$v3=this._createCircle(2,o.arrays.ensure(this.data[2].colorHexValue)[0],this.data[2].cssClass),this.vennNumber3=new Z(this.$v3),this.vennReal3=new Z(this.$v3));const i=this.animationDuration;let s=(function(){if(this.readyToDraw=!0,!this.$svg.isAttached())return;this.readyToDraw=!1;const n=this.animationDuration;this.setAnimationDuration(i),this._draw(!0,!0),this.setAnimationDuration(n)}).bind(this);this.readyToDraw=!1,this.numberOfCircles===1?(this._calc1(this.vennNumber1),this._calc1(this.vennReal1),s()):this.numberOfCircles===2?(this._calc2(this.vennNumber1,this.vennNumber2,!1),this._calc2(this.vennReal1,this.vennReal2,!0),s()):this.numberOfCircles===3&&this._calc3(this.vennNumber1,this.vennNumber2,this.vennNumber3,!1,()=>{(this.rendering||this.rendered)&&this._calc3(this.vennReal1,this.vennReal2,this.vennReal3,!0,s)})}remove(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=arguments.length>1?arguments[1]:void 0;this._cancelAsync3Calculator(),super.remove(e,t)}_calc1(e){let t=this.data[0].values[0];t>0?e.r=this.vennCircleHelper.calcR(t,.8):e.r=this.vennCircleHelper.calcR(t,0),e.x=0,e.y=0,e.setLegend(this.data[0].groupName,1,-1),e.addLabel(t,e.x,e.y)}_calc2(e,t,r){let a=this.data[0].values[0],i=this.data[1].values[0],s=this.data[2].values[0],n;r?(e.r=this.vennCircleHelper.calcR(a+s,.8),t.r=this.vennCircleHelper.calcR(i+s,.8),n=this.vennCircleHelper.calcD(e,t,a,i,s,!0),e.x=0,t.x=n):(e.r=t.r=this.vennCircleHelper.calcR(-1,.7),e.x=-e.r*.6,t.x=t.r*.6),e.y=0,t.y=0,this.vennCircleHelper.findBalance2(e,t),e.setLegend(this.data[0].groupName,-1,-1),t.setLegend(this.data[1].groupName,1,-1),r?s===0?(e.addLabel(a,e.x,e.y),t.addLabel(i,t.x,t.y)):a===0&&i===0?e.addLabel(s,e.x,e.y):a===0?(t.addLabel(s,e.x,e.y),t.addLabel(i,t.x-(n-t.r-e.r)/2,t.y),e.legendR=t.r-n):i===0?(e.addLabel(s,t.x,t.y),e.addLabel(a,e.x+(n-t.r-e.r)/2,e.y),t.legendR=e.r-n):(e.addLabel(a,e.x+(n-t.r-e.r)/2,e.y),e.addLabel(i,t.x-(n-t.r-e.r)/2,t.y),t.addLabel(s,e.x+e.r+(n-t.r-e.r)/2,e.y)):(e.addLabel(a,-e.r*.9,0),e.addLabel(i,e.r*.9,0),t.addLabel(s,0,0))}_calc3(e,t,r,a,i){let s=this.data[0].values[0],n=this.data[1].values[0],u=this.data[2].values[0],h=this.data[3].values[0],p=this.data[4].values[0],c=this.data[5].values[0],f=this.data[6].values[0],m,y,b;a?(e.r=this.vennCircleHelper.calcR(s+h+p+f,.55),t.r=this.vennCircleHelper.calcR(n+h+c+f,.55),r.r=this.vennCircleHelper.calcR(u+p+c+f,.55),m=this.vennCircleHelper.calcD(e,t,s+p,n+c,h+f,!0),y=this.vennCircleHelper.calcD(e,r,s+h,u+c,h+f,!1),b=this.vennCircleHelper.calcD(t,r,n+h,u+p,h+f,!1),e.x=0,t.x=m,r.x=y,e.y=0,t.y=0,r.y=0,this._cancelAsync3Calculator(),this.async3Calculator=new Oe(this.vennCircleHelper,e,t,r,s,n,u,h,p,c,f,m,y,b),this.async3Calculator.start(()=>{this.async3Calculator=null,this.vennCircleHelper.findBalance3(e,t,r),e.setLegend(this.data[0].groupName,-1,1),t.setLegend(this.data[1].groupName,1,1),r.setLegend(this.data[2].groupName,1,-1),i()})):(e.r=t.r=r.r=this.vennCircleHelper.calcR(-1,.55),e.x=-e.r*.73,t.x=t.r*.73,r.x=0,e.y=e.r*.58,t.y=t.r*.58,r.y=-r.r*.58,e.setLegend(this.data[0].groupName,-1,1),t.setLegend(this.data[1].groupName,1,1),r.setLegend(this.data[2].groupName,1,-1),e.addLabel(s,-e.r,e.r*.76),t.addLabel(n,e.r,e.r*.76),r.addLabel(u,0,-e.r*.82),e.addLabel(h,0,e.r*.76),e.addLabel(p,-e.r*.49,-e.r*.05),t.addLabel(c,e.r*.49,-e.r*.05),e.addLabel(f,0,e.r*.22),i())}_cancelAsync3Calculator(){this.async3Calculator&&(this.async3Calculator.cancel(),this.async3Calculator=null)}_draw(e,t){if(!this.rendered&&!this.rendering||this.animationTriggered)return;this.animationTriggered=!0;let r=this;this.$svg.children(".venn-legend, .venn-label, .venn-axis-white, .label-line").stop().animateSVG("opacity",1,0,null,!0).promise().done(function(){this.remove(),r.animationTriggered=!1});let a=[];this.numberOfCircles>0&&a.push(t?this.vennReal1:this.vennNumber1),this.numberOfCircles>1&&a.push(t?this.vennReal2:this.vennNumber2),this.numberOfCircles>2&&a.push(t?this.vennReal3:this.vennNumber3);for(let i=0;i<a.length;i++){let s=a[i];this._updateVenn(s,e);for(let n=0;n<s.labels.length;n++){let u=s.labels[n];this._drawLabel(u.text,u.x,u.y,e)}}}_createCircle(e,t,r){let a=this.$svg.appendSVG("circle","venn-circle").attr("cx",this.centerX).attr("cy",this.centerY).attr("r",0).on("mouseenter",{showReal:!1},this._show.bind(this)).on("mouseleave",{showReal:!0},this._show.bind(this));return this.chart.config.options.autoColor?a.addClass("auto-color color0"):r?a.addClass(r):a.attr("fill",t),this.chart.config.options.clickable&&a.on("click",this._createClickObject(null,e),i=>this.chart.handleValueClick(i.data)),a}_updateVenn(e,t){e.$circle.animateSVG("cx",this.centerX+e.x,t?this.animationDuration:0,null,!0).animateSVG("cy",this.centerY+e.y,t?this.animationDuration:0,null,!0).animateSVG("r",e.r,t?this.animationDuration:0,null,!0);let r=this.vennCircleHelper.minR,a=this.centerX+e.x+e.legendH*Math.sin(Math.PI/5)*e.r,i=this.centerY+e.y+e.legendV*Math.cos(Math.PI/5)*e.r,s=this.centerX+e.x+e.legendH*Math.sin(Math.PI/5)*(e.legendR+r*1.5),n=this.centerY+e.y+e.legendV*Math.cos(Math.PI/5)*(e.legendR+r*1.5),u={x1:a,x2:s,y1:i,y2:n,v:e.legendV,h:e.legendH};this._renderWireLegend(e.legend,u,"venn-legend")}_drawLabel(e,t,r,a){let i=this.$svg.appendSVG("text","venn-label").attr("x",this.centerX+t).attr("y",this.centerY+r).text(e);a&&this.animationDuration&&i.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_show(e){if(this.numberOfCircles===1)return;let t=e.type==="mouseenter"?e.target:e.relatedTarget,r=t&&g()(t).hasClass("venn-circle");this.wasCircle&&r||(this.wasCircle=r,this._draw(!0,e.data.showReal))}}function Y(l,e,t){return(e=Tt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Tt(l){var e=vt(l,"string");return typeof e=="symbol"?e:e+""}function vt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Z{constructor(e){Y(this,"labels",void 0),Y(this,"$circle",void 0),Y(this,"x",void 0),Y(this,"y",void 0),Y(this,"r",void 0),Y(this,"legend",void 0),Y(this,"legendR",void 0),Y(this,"legendH",void 0),Y(this,"legendV",void 0),this.$circle=e,this.labels=[]}setLegend(e,t,r,a){this.legend=e,this.legendH=t,this.legendV=r,this.legendR=a||this.r}addLabel(e,t,r){this.labels.push({text:e,x:t,y:r})}}function At(l,e,t){return(e=kt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function kt(l){var e=Rt(l,"string");return typeof e=="symbol"?e:e+""}function Rt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class He extends o.FormField{constructor(){super(),At(this,"chart",void 0),this._addWidgetProperties(["chart"]),this.chart=null}_render(){this.addContainer(this.$parent,"chart-field"),this.addLabel(),this.addMandatoryIndicator(),this.addStatus(),this._renderChart()}_renderChart(){this.chart&&(this.chart.render(),this.addField(this.chart.$container))}_removeChart(){this.chart.remove(),this._removeField()}_linkWithLabel(e){}}class Ne extends o.FormFieldAdapter{}function Bt(l,e,t){return(e=Lt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Lt(l){var e=St(l,"string");return typeof e=="symbol"?e:e+""}function St(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Fe extends o.FormFieldTile{constructor(){super(),Bt(this,"_chartConfigChangeHandler",void 0),this._chartConfigChangeHandler=this._onChartConfigChange.bind(this)}_setColorScheme(e){super._setColorScheme(e),this._updateChartColorScheme()}_updateChartColorScheme(){let e=$.extend(!0,{},this.tileWidget.chart.config,{options:{colorScheme:this.colorScheme}});this.tileWidget.chart.setConfig(e)}_onChartConfigChange(e){this._updateChartColorScheme()}_setTileWidget(e){this.tileWidget&&this.tileWidget.chart.off("propertyChange:config",this._chartConfigChangeHandler),super._setTileWidget(e),this._updateChartColorScheme(),this.tileWidget.chart.on("propertyChange:config",this._chartConfigChangeHandler)}}class Ve extends o.FormFieldTileAdapter{}function S(l,e,t){return(e=Ot(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Ot(l){var e=Pt(l,"string");return typeof e=="symbol"?e:e+""}function Pt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class oe extends o.TableControl{constructor(){super(),S(this,"chartAggregation",void 0),S(this,"chartGroup1",void 0),S(this,"chartGroup2",void 0),S(this,"chartType",void 0),S(this,"oldChartType",void 0),S(this,"chart",void 0),S(this,"chartColorScheme",void 0),S(this,"xAxis",void 0),S(this,"yAxis",void 0),S(this,"dateGroup",void 0),S(this,"$chartSelect",void 0),S(this,"$axisSelectContainer",void 0),S(this,"$xAxisSelect",void 0),S(this,"$yAxisSelect",void 0),S(this,"$dataSelect",void 0),S(this,"_chartTypeMap",void 0),S(this,"_aggregationMap",void 0),S(this,"_chartGroup1Map",void 0),S(this,"_chartGroup2Map",void 0),S(this,"_tableUpdatedHandler",void 0),S(this,"_tableColumnStructureChangedHandler",void 0),S(this,"_chartValueClickedHandler",void 0),S(this,"_filterResetListener",void 0),S(this,"_tableUpdatedTimeOutId",void 0),this.iconId=o.icons.CHART,this.tooltipText="${textKey:ui.Chart}",this.chartAggregation={modifier:o.TableMatrix.NumberGroup.COUNT},this.chartType=d.Type.BAR,this.oldChartType=null,this.chart=null,this.chartColorScheme="chart-table-control",this.$chartSelect=null,this.$xAxisSelect=null,this.$yAxisSelect=null,this.$dataSelect=null,this.xAxis=null,this.yAxis=null,this.dateGroup=null,this._tableUpdatedHandler=this._onTableUpdated.bind(this),this._tableColumnStructureChangedHandler=this._onTableColumnStructureChanged.bind(this),this._chartValueClickedHandler=this._onChartValueClick.bind(this)}_init(e){super._init(e),this.table.on("columnStructureChanged",this._tableColumnStructureChangedHandler),this.chart=o.scout.create(d,{parent:this})}_destroy(){this.table.off("columnStructureChanged",this._tableColumnStructureChangedHandler),super._destroy()}_computeEnabled(e,t){return!this._hasColumns()&&!this.selected?!1:super._computeEnabled(e,t)}_renderChart(){this.chart&&(this.chart.render(this.$contentContainer),this.chart.$container.addClass(this.denseClass))}_createLayout(){return new Ee(this)}_renderChartType(){this._selectChartType(),this.$yAxisSelect.toggleClass("hide",this.chartType!==d.Type.BUBBLE),this.$yAxisSelect.toggleClass("animated",o.scout.isOneOf(d.Type.BUBBLE,this.chartType,this.oldChartType)&&!!this.oldChartType),this.$yAxisSelect.data("scroll-shadow").setVisible(!1),this.$yAxisSelect.oneAnimationEnd(()=>{o.scrollbars.update(this.$yAxisSelect),this.$yAxisSelect.data("scroll-shadow").setVisible(!0),this.$yAxisSelect.removeClass("animated")}),this.contentRendered&&this.chart.$container.animateAVCSD("opacity",0,()=>{this.chart.$container.css("opacity",1),this._drawChart()})}_selectChartType(){o.objects.values(this._chartTypeMap).forEach(e=>{e.removeClass("selected")}),this._chartTypeMap[this.chartType].addClass("selected")}_renderChartGroup1(){this._renderChartGroup(1)}_renderChartGroup2(){this._renderChartGroup(2)}_renderChartGroup(e){if(!this._hasColumns())return;let t="chartGroup"+e,r="_"+t+"Map",a=this[t];if(a){let i=this[r][a.id];if(i.siblings(".select-axis").animateAVCSD("height",30),i.selectOne("selected"),a.modifier>0){let s=a.modifier^oe.DATE_GROUP_FLAG;i.animateAVCSD("height",42),i.children(".select-axis-group").text(this.dateGroup[s][1])}this.contentRendered&&this._drawChart()}}_renderChartAggregation(){let e=this._aggregationMap[this.chartAggregation.id||"all"];e&&(e.selectOne(),e.removeClass("data-sum").removeClass("data-avg"),e.addClass(this._getAggregationCssClass()),this.contentRendered&&this._drawChart())}_getAggregationCssClass(){switch(this.chartAggregation.modifier){case o.TableMatrix.NumberGroup.COUNT:return"data-count";case o.TableMatrix.NumberGroup.SUM:return"data-sum";case o.TableMatrix.NumberGroup.AVG:return"data-avg";default:return null}}_renderChartSelect(e,t,r){let a=o.scout.create(o.Icon,{parent:this,iconDesc:r,cssClass:e});a.render(this.$chartSelect),this.$contentContainer.one("remove",()=>a.destroy());let i=a.$container;i.toggleClass("disabled",!this.enabledComputed||!this._hasColumns()).data("chartType",t),this.enabledComputed&&this._hasColumns()&&i.on("click",this._onClickChartType.bind(this)),this._chartTypeMap[t]=i}_renderChartSelectContainer(){this.$chartSelect=this.$contentContainer.appendDiv("chart-select"),this._chartTypeMap={};let e=this._getSupportedChartTypes();o.scout.isOneOf(d.Type.BAR,e)&&this._renderChartSelect("chart-bar",d.Type.BAR,o.icons.DIAGRAM_BARS_VERTICAL),o.scout.isOneOf(d.Type.BAR_HORIZONTAL,e)&&this._renderChartSelect("chart-stacked",d.Type.BAR_HORIZONTAL,o.icons.DIAGRAM_BARS_HORIZONTAL),o.scout.isOneOf(d.Type.LINE,e)&&this._renderChartSelect("chart-line",d.Type.LINE,o.icons.DIAGRAM_LINE),o.scout.isOneOf(d.Type.PIE,e)&&this._renderChartSelect("chart-pie",d.Type.PIE,o.icons.DIAGRAM_PIE),o.scout.isOneOf(d.Type.BUBBLE,e)&&this._renderChartSelect("chart-bubble",d.Type.BUBBLE,o.icons.DIAGRAM_SCATTER)}_getSupportedChartTypes(){return[d.Type.BAR,d.Type.BAR_HORIZONTAL,d.Type.LINE,d.Type.PIE,d.Type.BUBBLE]}_onClickChartType(e){let t=g()(e.currentTarget),r=t.data("chartType");this.setChartType(r)}_onClickChartGroup(e){let t=g()(e.currentTarget),r=t.parent().data("groupId"),a=t.data("column"),i=t.data("modifier");if(!t.isEnabled())return;let s=t.isSelected()?this._nextDateModifier(i):i;t.data("modifier",s);let n={id:a?a.id:null,modifier:s};this._setChartGroup(r,n)}_onClickAggregation(e){let t=g()(e.currentTarget),r=t.data("modifier"),a=t.isSelected()?this._nextModifier(r):r;t.data("modifier",a);let i=t.data("column"),s={id:i?i.id:null,modifier:a};this._setChartAggregation(s)}_nextDateModifier(e){switch(e){case o.TableMatrix.DateGroup.DATE:return o.TableMatrix.DateGroup.MONTH;case o.TableMatrix.DateGroup.MONTH:return o.TableMatrix.DateGroup.WEEKDAY;case o.TableMatrix.DateGroup.WEEKDAY:return o.TableMatrix.DateGroup.YEAR;case o.TableMatrix.DateGroup.YEAR:return o.TableMatrix.DateGroup.DATE;default:return e}}_nextModifier(e){switch(e){case o.TableMatrix.NumberGroup.SUM:return o.TableMatrix.NumberGroup.AVG;case o.TableMatrix.NumberGroup.AVG:return o.TableMatrix.NumberGroup.SUM;default:return e}}_setChartAggregation(e){e!==this.chartAggregation&&(this._setProperty("chartAggregation",e),this.contentRendered&&this._renderChartAggregation())}_setChartGroup1(e){this._setChartGroup(1,e)}_setChartGroup2(e){this._setChartGroup(2,e)}_setChartGroup(e,t){let r="chartGroup"+e;this._changeProperty(r,t)}_changeProperty(e,t){t!==this[e]&&(this._setProperty(e,t),this.contentRendered&&this["_render"+e.charAt(0).toUpperCase()+e.slice(1)]())}setChartType(e){this.oldChartType=this.chartType,this.setProperty("chartType",e)}_hasColumns(){return this._columns().length>0}_columns(){return new o.TableMatrix(this.table,this.session).columns()}_axisCount(e,t){let r;for(let a=0;a<e.length;a++)if(r=e[a][0],r===t)return e[a][1];return 0}_plainAxisText(e,t){return e.headerHtmlEnabled?o.strings.plainText(t).replace(/\n/g," "):t}_renderContent(e){this.$contentContainer=e.appendDiv("chart-container"),this._installScrollbars(),this._renderChartSelectContainer(),this.dateGroup=[[o.TableMatrix.DateGroup.YEAR,this.session.text("ui.groupedByYear")],[o.TableMatrix.DateGroup.MONTH,this.session.text("ui.groupedByMonth")],[o.TableMatrix.DateGroup.WEEKDAY,this.session.text("ui.groupedByWeekday")],[o.TableMatrix.DateGroup.DATE,this.session.text("ui.groupedByDate")]],this._filterResetListener=this.table.on("filterReset",r=>{this.chart&&this.chart.setCheckedItems([])}),this._addListeners(),this._renderAxisSelectorsContainer();let t=this._renderAxisSelectors();this._renderChart(),this._initializeSelection(t),this._renderChartParts(),this._drawChart()}_addListeners(){this.table.on("rowsInserted",this._tableUpdatedHandler),this.table.on("rowsDeleted",this._tableUpdatedHandler),this.table.on("allRowsDeleted",this._tableUpdatedHandler),this.chart.on("valueClick",this._chartValueClickedHandler)}_renderAxisSelectorsContainer(){this.$axisSelectContainer=this.$contentContainer.appendDiv("axis-select-container")}_renderAxisSelectors(){this.$xAxisSelect=this.$axisSelectContainer.appendDiv("xaxis-select").data("groupId",1),o.scrollbars.install(this.$xAxisSelect,{parent:this,session:this.session,axis:"y"}),this.$yAxisSelect=this.$axisSelectContainer.appendDiv("yaxis-select").data("groupId",2),o.scrollbars.install(this.$yAxisSelect,{parent:this,session:this.session,axis:"y"}),this._chartGroup1Map={},this._chartGroup2Map={};let e=new o.TableMatrix(this.table,this.session),t=e.columnCount(!1);t.sort((n,u)=>Math.abs(n[1]-8)-Math.abs(u[1]-8));let r,a,i=0,s=e.columns(!1);for(let n=0;n<s.length;n++){let u,h,p,c=s[n];c instanceof o.DateColumn?a=!0:(r=this._axisCount(t,c),a=r<=oe.MAX_AXIS_COUNT),u=this._axisContentForColumn(c),h=this.$contentContainer.makeDiv("select-axis",this._plainAxisText(c,u.text)).data("column",c).setEnabled(a),a||(this.chartGroup1&&this.chartGroup1.id===c.id&&(this.chartGroup1=null,this.chartGroup2=null),this.chartGroup2&&this.chartGroup2.id===c.id&&(this.chartGroup2=null)),u.icon&&h.addClass(u.icon.appendCssClass("font-icon")),c instanceof o.DateColumn&&h.data("modifier",o.TableMatrix.DateGroup.YEAR).appendDiv("select-axis-group",this.dateGroup[0][1]),a?(h.on("click",this._onClickChartGroup.bind(this)),o.tooltips.installForEllipsis(h,{parent:this})):o.tooltips.install(h,{parent:this,text:this.session.text("ui.TooMuchData")}),i++,p=h.clone(!0),this._chartGroup1Map[c.id]=h,this._chartGroup2Map[c.id]=p,this.$xAxisSelect.append(h),this.$yAxisSelect.append(p)}if(this._aggregationMap={},this._hasColumns()){this.$dataSelect=this.$axisSelectContainer.appendDiv("data-select"),o.scrollbars.install(this.$dataSelect,{parent:this,session:this.session,axis:"y"});let n=this.session.text("ui.Count");this._aggregationMap.all=this.$dataSelect.appendDiv("select-data data-count",n).data("column",null).data("modifier",o.TableMatrix.NumberGroup.COUNT);for(let u=0;u<s.length;u++){let h=s[u],p=u+1;if(h instanceof o.NumberColumn){let c;o.strings.hasText(h.text)?c=this._plainAxisText(h,h.text):o.strings.hasText(h.headerTooltipText)?c=h.headerTooltipText:c="["+p+"]",this._aggregationMap[h.id]=this.$dataSelect.appendDiv("select-data data-sum",c).data("column",h).data("modifier",o.TableMatrix.NumberGroup.SUM)}}g()(".select-data",this.$contentContainer).on("click",this._onClickAggregation.bind(this))}return t}_initializeSelection(e){let t;this.chartType||this.setChartType(d.Type.BAR),(!this.chartAggregation||!this._aggregationMap[this.chartAggregation.id])&&this._setChartAggregation({id:null,modifier:o.TableMatrix.NumberGroup.COUNT}),(!this.chartGroup1||!this.chartGroup1.id||!this._chartGroup1Map[this.chartGroup1.id])&&(t=this.$xAxisSelect.children(":not(.disabled)"),this._setDefaultSelectionForGroup(1,e,t,0)),(!this.chartGroup2||!this.chartGroup2.id||!this._chartGroup2Map[this.chartGroup2.id])&&(t=this.$yAxisSelect.children(":not(.disabled)"),this._setDefaultSelectionForGroup(2,e,t,1))}_setDefaultSelectionForGroup(e,t,r,a){let i=this._getDefaultSelectedColumn(t,r,a);i&&this._setChartGroup(e,this._getDefaultChartGroup(i))}_getDefaultSelectedColumn(e,t,r){let a=0,i,s;for(let n=0;n<e.length&&a<=r;n++)i=e[n][0],this._existsInAxisColumns(t,i)&&(s=i,a++);return s}_existsInAxisColumns(e,t){for(let r=0;r<e.length;r++)if(e.eq(r).data("column")===t)return!0;return!1}_getDefaultChartGroup(e){let t;return e instanceof o.DateColumn&&(t=256),{id:e.id,modifier:t}}_renderChartParts(){this._renderChartType(),this._renderChartAggregation(),this._renderChartGroup1(),this._renderChartGroup2()}_drawChart(){if(!this._hasColumns()){this._hideChart();return}let e=this._calculateValues();if(e&&e.length)this.chart.setVisible(!0);else{this._hideChart();return}let t={type:this.chartType,options:{handleResize:!0,colorScheme:this.chartColorScheme,maxSegments:5,plugins:{legend:{display:!1}}}},r=[];t.data=this._computeData(r,e),this._adjustFont(t,r),this._adjustConfig(t),this.chart.setConfig(t);let a=this._computeCheckedItems(t.data.datasets[0].deterministicKeys);this.chart.setCheckedItems(a)}_hideChart(){this.chart.setConfig({type:this.chartType}),this.chart.setVisible(!1)}_getDatasetLabel(){let e=this._aggregationMap[this.chartAggregation.id||"all"];return(e?e.text():null)||this.session.text("ui.Value")}_calculateValues(){let e=new o.TableMatrix(this.table,this.session),t=this.chartAggregation.id?this._aggregationMap[this.chartAggregation.id].data("column"):-1;if(e.addData(t,this.chartAggregation.modifier),this.chartGroup1){let r=this._chartGroup1Map[this.chartGroup1.id].data("column");this.xAxis=e.addAxis(r,this.chartGroup1.modifier)}if(this.chartType===d.Type.BUBBLE&&this.chartGroup2){let r=this._chartGroup2Map[this.chartGroup2.id].data("column");this.yAxis=e.addAxis(r,this.chartGroup2.modifier)}else this.yAxis=null;if(!(e.isEmpty()||!e.isMatrixValid()))return e.calculate()}_getXAxis(){return this.xAxis}_getYAxis(){return this.yAxis}_computeData(e,t){let r={datasets:[{label:this._getDatasetLabel()}]};if(!t)return r;e=e||[];let a=[];if(this.chartType===d.Type.BUBBLE)a=this._computeBubbleData(e,t);else{let n=this._getXAxis();for(let u=0;u<n.length;u++){let h,p=n[u];n.column instanceof o.NumberColumn?h=o.objects.isNullOrUndefined(p)?n.format(p):p:h=this._handleIconLabel(n.format(p),n,e),a.push({value:t.getValue([p])[0],label:h,deterministicKey:n.keyToDeterministicKey(p)})}}let i=r.datasets[0],s=[];return i.data=[],i.deterministicKeys=[],a.forEach(n=>{i.data.push(n.value),i.deterministicKeys.push(n.deterministicKey),o.objects.isNullOrUndefined(n.label)||s.push(n.label)}),s.length&&(r.labels=s),r}_computeBubbleData(e,t){if(!t)return[];e=e||[];let r=this._getXAxis(),a=this._getYAxis(),i=[];for(let s=0;s<r.length;s++){let n=r[s],u=n;this._handleIconLabel(r.format(n),r,e),!(r.column instanceof o.NumberColumn)&&u===null&&(u=r.max),r.column instanceof o.DateColumn&&(u=u-r.min);for(let h=0;h<a.length;h++){let p=a[h],c=p,f=t.getValue([n,p]);this._handleIconLabel(a.format(p),a,e),f&&f.length&&(!(a.column instanceof o.NumberColumn)&&c===null&&(c=a.max),a.column instanceof o.DateColumn&&(c=c-a.min),i.push({value:{x:u,y:c,z:f[0]},deterministicKey:[r.keyToDeterministicKey(n),a.keyToDeterministicKey(p)]}))}}return i}_handleIconLabel(e,t,r){if(t&&t.isIcon){let a=o.icons.parseIconId(e);if(a&&a.isFontIcon())return r.push(...a.appendCssClass("font-icon").split(" ")),a.iconCharacter}return e}_adjustFont(e,t){if(!(!e||!t)&&(t=t.filter((r,a,i)=>i.indexOf(r)===a),t.length)){let r=o.styles.get(t,"font-family").fontFamily;this.chartType!==d.Type.PIE&&(e.options=g().extend(!0,{},e.options,{scales:{x:{ticks:{font:{family:r}}},y:{ticks:{font:{family:r}}}}})),e.options=g().extend(!0,{},e.options,{plugins:{tooltip:{titleFont:{family:r}}}}),e.options=g().extend(!0,{},e.options,{plugins:{datalabels:{font:{family:r}}}})}}_adjustLabels(e){if(!e)return;let t=this._getXAxis(),r=this._getYAxis();this.chartType===d.Type.BUBBLE?(t.column instanceof o.NumberColumn||(e.options=g().extend(!0,{},e.options,{scales:{x:{ticks:{callback:a=>this._formatLabel(a,t)}}}})),r.column instanceof o.NumberColumn||(e.options=g().extend(!0,{},e.options,{scales:{y:{ticks:{callback:a=>this._formatLabel(a,r)}}}}))):t.column instanceof o.NumberColumn&&(e.options=g().extend(!0,{},e.options,{reformatLabels:!0}))}_formatLabel(e,t){if(!t)return""+e;if(t.column instanceof o.DateColumn&&(e=e+t.min,e!==parseInt(""+e)||t.length<2&&(e<t.min||e>t.max)))return null;if(t.indexOf(null)!==-1){if(e===t.max)e=null;else if(e>t.max)return null}let r=t.format(e);if(t.isIcon){let a=o.icons.parseIconId(r);a&&a.isFontIcon()&&(r=a.iconCharacter)}return r}_adjustConfig(e){e&&(this._adjustLabels(e),this._adjustClickable(e),this.chartType===d.Type.BUBBLE?this._adjustBubble(e):this.chartType===d.Type.PIE?this._adjustPie(e):this._adjustScales(e))}_adjustClickable(e){e&&this._isChartClickable()&&(e.options=g().extend(!0,{},e.options,{clickable:!0,checkable:!0,otherSegmentClickable:!0}))}_isChartClickable(){return!0}_adjustBubble(e){!e||this.chartType!==d.Type.BUBBLE||(e.options.bubble=g().extend(!0,{},e.options.bubble,{sizeOfLargestBubble:25,minBubbleSize:5}))}_adjustPie(e){if(!e||this.chartType!==d.Type.PIE)return;e.data.datasets[0].datalabels={labels:{index:{display:"auto",color:o.styles.get([this.chartColorScheme,this.chartType+"-chart","elements","label"],"fill").fill,formatter:(r,a)=>a.chart.data.labels[a.dataIndex],anchor:"end",align:"end",clamp:!0,offset:10,padding:4},labels:{}}},e.options=g().extend(!0,{},e.options,{plugins:{datalabels:{display:!0}}});let t=this.chart.$container.cssMarginTop()-this.chart.$container.cssMarginBottom();e.options=g().extend(!0,{},e.options,{layout:{padding:{top:30+(Math.sign(t)<0?Math.abs(t):0),bottom:30+(Math.sign(t)>0?t:0)}}})}_adjustScales(e){e&&(e.options=g().extend(!0,{},e.options,{scales:{x:{beginAtZero:!0},y:{beginAtZero:!0}}}))}_computeCheckedItems(e){if(!e)return[];let t=this._getXAxis(),r=this._getYAxis(),a=this.table.getFilter(Q.TYPE),i=[],s=[];a&&(a.xAxis||{}).column===(t||{}).column&&(a.yAxis||{}).column===(r||{}).column&&(i=a.filters),e.forEach((h,p)=>{i.filter(c=>Array.isArray(c.deterministicKey)&&Array.isArray(h)?o.arrays.equals(c.deterministicKey,h):c.deterministicKey===h).length&&s.push(p)});let n=0;if(this.chartType===d.Type.PIE){let h=this.chart.config.options.maxSegments,p=o.arrays.init(e.length-h,null).map((c,f)=>f+h);o.arrays.containsAll(s,p)||o.arrays.remove(s,h-1),o.arrays.removeAll(s,p),n=1}let u=[];return s.length&&s.forEach(h=>{u.push({datasetIndex:n,dataIndex:h})}),u}_onChartValueClick(){let e=[];if(this.chart&&this.chart.config.data){let t=this.chart.config.options.maxSegments,r=this.chart.config.data.datasets[0],a=s=>({deterministicKey:r.deterministicKeys[s]});this.chartType===d.Type.PIE&&(a=s=>(s=parseInt(""+s),t&&t===s+1?o.arrays.init(r.deterministicKeys.length-s,null).map((n,u)=>({deterministicKey:r.deterministicKeys[u+s]})):{deterministicKey:r.deterministicKeys[s]})),this.chart.checkedItems.filter(s=>s.datasetIndex===0).map(s=>s.dataIndex).forEach(s=>{o.arrays.pushAll(e,a(s))})}if(e.length){let t=o.scout.create(Q,{session:this.session,table:this.table,text:this.tooltipText,xAxis:this._getXAxis(),yAxis:this._getYAxis(),filters:e});this.table.addFilter(t)}else this.table.removeFilterByKey(Q.TYPE)}_axisContentForColumn(e){let t=e.text;if(o.strings.hasText(t))return{text:t};if(e.headerIconId){let r=o.icons.parseIconId(e.headerIconId);if(r.isFontIcon())return{text:r.iconCharacter,icon:r}}return e.headerTooltipText?{text:e.headerTooltipText}:{text:"["+(this._columns().indexOf(e)+1)+"]"}}_removeContent(){this._removeScrollbars(),this.$contentContainer.remove(),this.chart.remove(),this.table.events.removeListener(this._filterResetListener),this._removeListeners(),this.oldChartType=null,this.recomputeEnabled()}_removeScrollbars(){this.$xAxisSelect.each((e,t)=>{o.tooltips.uninstall(g()(t))}),o.scrollbars.uninstall(this.$xAxisSelect,this.session),this.$yAxisSelect.each((e,t)=>{o.tooltips.uninstall(g()(t))}),o.scrollbars.uninstall(this.$yAxisSelect,this.session),o.scrollbars.uninstall(this.$dataSelect,this.session),this._uninstallScrollbars()}_removeListeners(){this.table.off("rowsInserted",this._tableUpdatedHandler),this.table.off("rowsDeleted",this._tableUpdatedHandler),this.table.off("allRowsDeleted",this._tableUpdatedHandler),this.chart.off("valueClick",this._chartValueClickedHandler)}_onTableUpdated(e){this._tableUpdatedTimeOutId||(this._tableUpdatedTimeOutId=setTimeout(()=>{this._tableUpdatedTimeOutId=null,this.rendered&&(this._setChartGroup1(null),this._setChartGroup2(null),this.removeContent(),this.renderContent())}))}_onTableColumnStructureChanged(){this.recomputeEnabled(),this.contentRendered&&this.selected&&this._onTableUpdated()}}S(oe,"DATE_GROUP_FLAG",256),S(oe,"MAX_AXIS_COUNT",100);function ne(l,e,t){return(e=Dt(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function Dt(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 r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Q extends o.TableUserFilter{constructor(){super(),ne(this,"text",void 0),ne(this,"xAxis",void 0),ne(this,"yAxis",void 0),ne(this,"filters",void 0),ne(this,"columnIdX",void 0),ne(this,"columnIdY",void 0),this.filterType=Q.TYPE,this.text=null,this.xAxis=null,this.yAxis=null,this.filters=[],this.columnIdX=null,this.columnIdY=null}createLabel(){return this.text}createFilterAddedEventData(){let e=super.createFilterAddedEventData();return e.text=this.text,e.filters=this.filters,e.columnIdX=this.xAxis&&this.xAxis.column?this.xAxis.column.id:null,e.columnIdY=this.yAxis&&this.yAxis.column?this.yAxis.column.id:null,e}calculate(){let e=new o.TableMatrix(this.table,this.session),t=this.table.columnById(this.columnIdX),r=t.createFilter().axisGroup();if(this.xAxis=e.addAxis(t,r),this.columnIdY){let a=this.table.columnById(this.columnIdY),i=a.createFilter().axisGroup();this.yAxis=e.addAxis(a,i)}e.calculate()}accept(e){this.xAxis||this.calculate();let t=this.xAxis.column.cellValueOrTextForCalculation(e),r=this.xAxis.normDeterministic(t);if(!this.yAxis)return this.filters.filter(i=>i.deterministicKey===r).length>0;t=this.yAxis.column.cellValueOrTextForCalculation(e);let a=this.yAxis.normDeterministic(t);return this.filters.filter(i=>o.arrays.equals(i.deterministicKey,[r,a])).length>0}}ne(Q,"TYPE","CHART");class je extends o.TableControlAdapter{constructor(){super(),this._addRemoteProperties(["chartType","chartAggregation","chartGroup1","chartGroup2"])}}function Mt(l,e,t){return(e=It(e))in l?Object.defineProperty(l,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):l[e]=t,l}function It(l){var e=wt(l,"string");return typeof e=="symbol"?e:e+""}function wt(l,e){if(typeof l!="object"||!l)return l;var t=l[Symbol.toPrimitive];if(t!==void 0){var r=t.call(l,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(l)}class Ee extends o.AbstractLayout{constructor(e){super(),Mt(this,"control",void 0),this.control=e}layout(e){this.control.contentRendered&&(o.scrollbars.update(this.control.$contentContainer),o.scrollbars.update(this.control.$xAxisSelect),o.scrollbars.update(this.control.$yAxisSelect),o.scrollbars.update(this.control.$dataSelect))}}const Ge=ce;o.ObjectFactory.get().registerNamespace("scout",ce);var Ht=L.AbstractChartRenderer,Nt=L.AbstractSvgChartRenderer,Ft=L.Chart,Vt=L.ChartAdapter,jt=L.ChartColorMode,Gt=L.ChartField,$t=L.ChartFieldAdapter,Ut=L.ChartFieldTile,Wt=L.ChartFieldTileAdapter,zt=L.ChartJsRenderer,Xt=L.ChartLayout,Yt=L.ChartTableControl,Jt=L.ChartTableControlAdapter,qt=L.ChartTableControlLayout,Kt=L.ChartTableUserFilter,Zt=L.FulfillmentChartRenderer,Qt=L.SalesfunnelChartRenderer,er=L.SpeedoChartRenderer,tr=L.VennAsync3Calculator,rr=L.VennChartRenderer,ar=L.VennCircle,ir=L.VennCircleHelper,sr=L.chartJsDateAdapter,nr=L.default;export{Ht as AbstractChartRenderer,Nt as AbstractSvgChartRenderer,Ft as Chart,Vt as ChartAdapter,jt as ChartColorMode,Gt as ChartField,$t as ChartFieldAdapter,Ut as ChartFieldTile,Wt as ChartFieldTileAdapter,zt as ChartJsRenderer,Xt as ChartLayout,Yt as ChartTableControl,Jt as ChartTableControlAdapter,qt as ChartTableControlLayout,Kt as ChartTableUserFilter,Zt as FulfillmentChartRenderer,Qt as SalesfunnelChartRenderer,er as SpeedoChartRenderer,tr as VennAsync3Calculator,rr as VennChartRenderer,ar as VennCircle,ir as VennCircleHelper,sr as chartJsDateAdapter,nr as default};
2
2
 
3
- //# sourceMappingURL=eclipse-scout-chart.esm-68ec6b6400b08664057c.min.js.map
3
+ //# sourceMappingURL=eclipse-scout-chart.esm-d01856792fe1a3c69851.min.js.map