@eclipse-scout/chart 11.0.36 → 11.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eclipse-scout-chart-4f219da36ee28808d3bf.min.js +2 -0
- package/dist/eclipse-scout-chart-4f219da36ee28808d3bf.min.js.map +1 -0
- package/dist/eclipse-scout-chart-theme.css.map +1 -1
- package/dist/eclipse-scout-chart.js +25 -17
- package/dist/eclipse-scout-chart.js.map +1 -1
- package/dist/file-list +2 -2
- package/package.json +3 -3
- package/src/chart/ChartJsRenderer.js +4 -6
- package/src/chart/ChartLayout.js +2 -1
- package/src/table/controls/ChartTableControl.js +9 -0
- package/dist/eclipse-scout-chart-0818a7899c3d98d9189d.min.js +0 -2
- package/dist/eclipse-scout-chart-0818a7899c3d98d9189d.min.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=6)}([function(t,e){t.exports=scout},function(t,e){t.exports=Chart},function(t,e){t.exports=jQuery},function(t,e){t.exports=ChartDataLabels},,,function(t,e,r){"use strict";r.r(e),r.d(e,"Chart",(function(){return v})),r.d(e,"ChartAdapter",(function(){return A})),r.d(e,"ChartLayout",(function(){return E})),r.d(e,"AbstractChartRenderer",(function(){return M})),r.d(e,"AbstractSvgChartRenderer",(function(){return J})),r.d(e,"ChartJsRenderer",(function(){return pt})),r.d(e,"FulfillmentChartRenderer",(function(){return kt})),r.d(e,"SpeedoChartRenderer",(function(){return wt})),r.d(e,"SalesfunnelChartRenderer",(function(){return Gt})),r.d(e,"VennAsync3Calculator",(function(){return Ht})),r.d(e,"VennCircleHelper",(function(){return $t})),r.d(e,"VennChartRenderer",(function(){return qt})),r.d(e,"VennCircle",(function(){return Qt})),r.d(e,"ChartField",(function(){return le})),r.d(e,"ChartFieldAdapter",(function(){return pe})),r.d(e,"ChartFieldTile",(function(){return Te})),r.d(e,"ChartFieldTileAdapter",(function(){return Le})),r.d(e,"ChartTableControl",(function(){return Fe})),r.d(e,"ChartTableUserFilter",(function(){return er})),r.d(e,"ChartTableControlAdapter",(function(){return sr})),r.d(e,"ChartTableControlLayout",(function(){return pr}));var n={};r.r(n),r.d(n,"Chart",(function(){return v})),r.d(n,"ChartAdapter",(function(){return A})),r.d(n,"ChartLayout",(function(){return E})),r.d(n,"AbstractChartRenderer",(function(){return M})),r.d(n,"AbstractSvgChartRenderer",(function(){return J})),r.d(n,"ChartJsRenderer",(function(){return pt})),r.d(n,"FulfillmentChartRenderer",(function(){return kt})),r.d(n,"SpeedoChartRenderer",(function(){return wt})),r.d(n,"SalesfunnelChartRenderer",(function(){return Gt})),r.d(n,"VennAsync3Calculator",(function(){return Ht})),r.d(n,"VennCircleHelper",(function(){return $t})),r.d(n,"VennChartRenderer",(function(){return qt})),r.d(n,"VennCircle",(function(){return Qt})),r.d(n,"ChartField",(function(){return le})),r.d(n,"ChartFieldAdapter",(function(){return pe})),r.d(n,"ChartFieldTile",(function(){return Te})),r.d(n,"ChartFieldTileAdapter",(function(){return Le})),r.d(n,"ChartTableControl",(function(){return Fe})),r.d(n,"ChartTableUserFilter",(function(){return er})),r.d(n,"ChartTableControlAdapter",(function(){return sr})),r.d(n,"ChartTableControlLayout",(function(){return pr})),r.d(n,"default",(function(){return vr}));var a=r(0);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return s(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},c.apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function d(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=p(t);if(e){var a=p(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return f(this,r)}}function f(t,e){if(e&&("object"===i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function y(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var v=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}(s,t);var e,r,n,i=d(s);function s(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(t=i.call(this)).$container=null,t.chartRenderer=null,t.data=null,t.config=null,t.checkedItems=[],t._updateChartTimeoutId=null,t._updateChartOpts=null,t.updatedOnce=!1,t}return e=s,(r=[{key:"_init",value:function(t){c(p(s.prototype),"_init",this).call(this,t),this.setConfig(this.config)}},{key:"_render",value:function(){this.$container=this.$parent.appendDiv("chart"),this.htmlComp=a.HtmlComponent.install(this.$container,this.session),this.htmlComp.setLayout(new E(this))}},{key:"_renderProperties",value:function(){c(p(s.prototype),"_renderProperties",this).call(this),this._renderClickable(),this._renderCheckable(),this._renderChartType(),this._renderColorScheme(),this.updateChart({requestAnimation:!0,debounce:s.DEFAULT_DEBOUNCE_TIMEOUT})}},{key:"_remove",value:function(){this.chartRenderer&&this.chartRenderer.remove(!1),this.$container.remove(),this.$container=null}},{key:"setData",value:function(t){this.setProperty("data",t),this.setCheckedItems(this.checkedItems)}},{key:"_renderData",value:function(){this.updateChart({requestAnimation:!0,debounce:s.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:!0})}},{key:"setConfig",value:function(t){var e={type:s.Type.PIE,options:{autoColor:!0,colorScheme:a.colorSchemes.ColorSchemeId.DEFAULT,transparent:!1,maxSegments:5,adjustGridMaxMin:!0,clickable:!1,checkable:!1,animation:{duration:s.DEFAULT_ANIMATION_DURATION},tooltips:{enabled:!0},legend:{display:!0,clickable:!1,position:s.Position.RIGHT},plugins:{datalabels:{display:!1}}}};if((t=$.extend(!0,{},e,t)).options.colorScheme=a.colorSchemes.ensureColorScheme(t.options.colorScheme),!a.objects.equalsRecursive(this.config,t)){var r=$.extend(!0,{},this.config);if(r.data=t.data,a.objects.equalsRecursive(r,t))return this._setProperty("config",t),this.rendered&&this._renderConfig(!0),void this.setCheckedItems(this.checkedItems);this.rendered&&this.config&&this.config.type&&this.$container.removeClass(this.config.type+"-chart"),this.setProperty("config",t),this.setCheckedItems(this.checkedItems),this._updateChartRenderer()}}},{key:"_renderConfig",value:function(t){this._renderClickable(),this._renderCheckable(),this._renderChartType(),this._renderColorScheme(),this.updateChart({requestAnimation:!0,debounce:s.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:t})}},{key:"setCheckedItems",value:function(t){this.setProperty("checkedItems",a.arrays.ensure(this._filterCheckedItems(t)))}},{key:"_filterCheckedItems",value:function(t){if(!Array.isArray(t))return t;var e=[];this.data&&this.data.chartValueGroups?this.data.chartValueGroups.forEach((function(t){return e.push(t.values.length)})):this.config&&this.config.data&&this.config.data.datasets.forEach((function(t){return e.push(t.data.length)}));var r=t.filter((function(t){return e[t.datasetIndex]&&t.dataIndex<e[t.datasetIndex]}));return r.length<t.length?r:t}},{key:"_renderCheckedItems",value:function(){this.chartRenderer&&this.chartRenderer.renderCheckedItems()}},{key:"_renderEnabled",value:function(){this.updateChart()}},{key:"_renderClickable",value:function(){this.$container.toggleClass("clickable",this.config.options.clickable)}},{key:"_renderCheckable",value:function(){this.$container.toggleClass("checkable",this.config.options.checkable)}},{key:"_renderChartType",value:function(){this.$container.addClass(this.config.type+"-chart")}},{key:"_renderColorScheme",value:function(){a.colorSchemes.toggleColorSchemeClasses(this.$container,this.config.options.colorScheme)}},{key:"updateChart",value:function(t){t=t||{},this._updateChartTimeoutId&&(clearTimeout(this._updateChartTimeoutId),this._updateChartOpts&&(t.requestAnimation=t.requestAnimation||this._updateChartOpts.requestAnimation),this._updateChartTimeoutId=null,this._updateChartOpts=null);var e=function(){var e=this;this._updateChartTimeoutId=null,this._updateChartOpts=null,t.onlyUpdateData&&this.chartRenderer&&this.chartRenderer.isDataUpdatable()?this.chartRenderer.updateData(t.requestAnimation):this.chartRenderer&&this.chartRenderer.remove(this.chartRenderer.shouldAnimateRemoveOnUpdate(t),(function(r){e.removing||r||(e.chartRenderer.render(t.requestAnimation),e.trigger("chartRender"))})),this.updatedOnce=!0}.bind(this);!0===t.debounce||"number"==typeof t.debounce?(this._updateChartOpts=t,"number"==typeof t.debounce?this._updateChartTimeoutId=setTimeout(e,t.debounce):this._updateChartTimeoutId=setTimeout(e)):e()}},{key:"_resolveChartRenderer",value:function(){switch(this.config.type){case s.Type.FULFILLMENT:return new kt(this);case s.Type.SPEEDO:return new wt(this);case s.Type.SALESFUNNEL:return new Gt(this);case s.Type.VENN:return new qt(this);case s.Type.BAR:case s.Type.BAR_HORIZONTAL:case s.Type.LINE:case s.Type.COMBO_BAR_LINE:case s.Type.PIE:case s.Type.DOUGHNUT:case s.Type.POLAR_AREA:case s.Type.RADAR:case s.Type.BUBBLE:return new pt(this)}return null}},{key:"_updateChartRenderer",value:function(){this.chartRenderer&&this.chartRenderer.remove(),this.setProperty("chartRenderer",this._resolveChartRenderer())}},{key:"_onValueClick",value:function(t){if(this.config.options.checkable){var e=o(this.checkedItems),r=t.data,n=e.filter((function(t){return t.datasetIndex===r.datasetIndex&&t.dataIndex===r.dataIndex}))[0];n?a.arrays.remove(e,n):e.push(r),this.setCheckedItems(e)}this.trigger("valueClick",t)}}])&&l(e.prototype,r),n&&l(e,n),s}(a.Widget);function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}function g(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function m(){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=_(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},m.apply(this,arguments)}function _(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=T(t)););return t}function C(t,e){return C=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},C(t,e)}function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=T(t);if(e){var a=T(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return k(this,r)}}function k(t,e){if(e&&("object"===b(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function T(t){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},T(t)}y(v,"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"}),y(v,"Position",{TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center"}),y(v,"DEFAULT_ANIMATION_DURATION",600),y(v,"DEFAULT_DEBOUNCE_TIMEOUT",100);var A=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&C(t,e)}(i,t);var e,r,n,a=x(i);function i(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),a.call(this)}return e=i,(r=[{key:"_onWidgetValueClick",value:function(t){this._send("valueClick",t.data)}},{key:"_onWidgetEvent",value:function(t){"valueClick"===t.type?this._onWidgetValueClick(t):m(T(i.prototype),"_onWidgetEvent",this).call(this,t)}}])&&g(e.prototype,r),n&&g(e,n),i}(a.ModelAdapter);function O(t){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(t)}function R(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function S(t,e){return S=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},S(t,e)}function B(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=w(t);if(e){var a=w(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return L(this,r)}}function L(t,e){if(e&&("object"===O(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function w(t){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},w(t)}var E=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&S(t,e)}(i,t);var e,r,n,a=B(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=a.call(this)).chart=t,e}return e=i,(r=[{key:"layout",value:function(t){var e={requestAnimation:!0,debounce:v.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:!0};this.chart.session.ready&&!this.chart.updatedOnce||(e.requestAnimation=!1),this.chart.session.ready||(e.debounce=!1),this.chart.updateChart(e)}}])&&R(e.prototype,r),n&&R(e,n),i}(a.AbstractLayout);function P(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var M=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.chart=e,this.session=e.session,this.rendering=!1,this.rendered=!1,this.animationDuration=0,this.firstOpaqueBackgroundColor=""}var e,r,n;return e=t,(r=[{key:"validate",value:function(){return!!this._validateChartData()&&this._validate()}},{key:"_validateChartData",value:function(){var t=this.chart&&this.chart.data;if(!t||!t.chartValueGroups||0===t.chartValueGroups.length)return!1;var e,r=0;for(e=0;e<t.chartValueGroups.length;e++){var n=t.chartValueGroups[e];if(!n.values)return!1;if(0===e)r=n.values.length;else if(n.values.length!==r)return!1;if(!this.chart.config.options.autoColor&&!n.colorHexValue&&!n.cssClass)return!1}for(e=0;e<t.axes.length;e++)if(t.axes[e].length!==r)return!1;return!0}},{key:"_validate",value:function(){return!0}},{key:"render",value:function(t){this.animationDuration=t?this.chart.config.options.animation.duration:0,this.validate()&&this.chart.rendered&&(this.rendering=!0,this._render(),this.rendering=!1,this.rendered=!0)}},{key:"_render",value:function(){}},{key:"checkCompletlyRendered",value:function(){!this.rendered&&this.chart.data&&this.render()}},{key:"renderCheckedItems",value:function(){this.rendered&&this._renderCheckedItems()}},{key:"_renderCheckedItems",value:function(){}},{key:"updateData",value:function(t){this.rendered?(this.animationDuration=t?this.chart.config.options.animation.duration:0,this.validate()&&this.isDataUpdatable()&&this._updateData()):this.render(t)}},{key:"_updateData",value:function(){}},{key:"isDataUpdatable",value:function(){return!1}},{key:"remove",value:function(t,e){this.animationDuration=t&&this.chart.config.options.animation.duration,this.animationDuration&&this.rendered?this._removeAnimated(e):this._remove(e)}},{key:"_remove",value:function(t){this.rendered=!1,t&&t()}},{key:"_removeAnimated",value:function(t){this._remove(t)}},{key:"shouldAnimateRemoveOnUpdate",value:function(t){return t.requestAnimation}}])&&P(e.prototype,r),n&&P(e,n),t}(),I=r(2),j=r.n(I);function D(t){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(t)}function G(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function N(){return N="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=H(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},N.apply(this,arguments)}function H(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=W(t)););return t}function V(t,e){return V=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},V(t,e)}function F(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=W(t);if(e){var a=W(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return U(this,r)}}function U(t,e){if(e&&("object"===D(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function W(t){return W=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},W(t)}function z(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var J=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&V(t,e)}(o,t);var e,r,n,i=F(o);function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).chartBox={},e.labelBox={},e.clipId="Clip-"+a.ObjectFactory.get().createUniqueId(),e.maskId="Mask-"+a.ObjectFactory.get().createUniqueId(),e.suppressLegendBox=!1,e}return e=o,(r=[{key:"_render",value:function(){this.$svg||(this.$svg=this.chart.$container.appendSVG("svg","chart-svg")),this.firstOpaqueBackgroundColor=a.styles.getFirstOpaqueBackgroundColor(this.$svg),this.svgHeight=this.$svg.height(),this.svgWidth=this.$svg.width(),this.height=this.svgHeight,this.width=this.svgWidth,this._initChartBox(),this._useFontSizeBig()?this.$svg.addClass(o.FONT_SIZE_BIG):this._useFontSizeMiddle()?this.$svg.addClass(o.FONT_SIZE_MIDDLE):this._useFontSizeSmall()?this.$svg.addClass(o.FONT_SIZE_SMALL):this._useFontSizeSmallest()&&this.$svg.addClass(o.FONT_SIZE_SMALLEST),this.$svg.isAttached()&&this._renderInternal()}},{key:"_renderInternal",value:function(){}},{key:"_useFontSizeBig",value:function(){return!1}},{key:"_useFontSizeMiddle",value:function(){return!1}},{key:"_useFontSizeSmall",value:function(){return!1}},{key:"_useFontSizeSmallest",value:function(){return!1}},{key:"remove",value:function(t,e){this.rendered&&!this.chartAnimationStopping&&(this.chartAnimationStopping=!0,this.$svg.children().stop(!0,!1),this.chartAnimationStopping=!1),N(W(o.prototype),"remove",this).call(this,t,e)}},{key:"_remove",value:function(t){this.rendered&&(this.$svg.children().stop(!0,!1),this.rendered&&(this.$svg.remove(),this.$svg=null)),this.rendered=!1,t&&t(this.chartAnimationStopping)}},{key:"_createClickObject",value:function(t,e){return{xIndex:t,dataIndex:t,datasetIndex:e}}},{key:"_measureText",value:function(t,e){var r,n=this.$svg.appendSVG("text",e).attr("x",0).attr("y",0).attr("visibility","hidden").text(t);try{r=n[0].getBBox()}catch(t){return{height:0,width:0}}return n.remove(),r}},{key:"_renderLine",value:function(t,e,r,n,a){var i=this.$svg.appendSVG("line",a).attr("x1",t).attr("y1",e).attr("x2",r).attr("y2",n);return this.animationDuration&&i.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),i}},{key:"_renderLineLabel",value:function(t,e,r,n,a){var i=this.$svg.appendSVG("text",n||"line-label").attr("x",t).attr("y",e).text(r);if(a){i.attr("mask","url(#"+this.maskId+")");var o=this.$svg.appendSVG("text",n?n+" background":"line-label-background").attr("x",t).attr("y",e).attr("clip-path","url(#"+this.clipId+")").text(r);i.data("$background",o),this.animationDuration&&o.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}return this.animationDuration&&i.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),i}},{key:"_initChartBox",value:function(){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}}}},{key:"_createAnimationObjectWithTabIndexRemoval",value:function(t,e){return{step:function(e,r){try{t.bind(this)(e,r)}catch(t){throw j()(this).stop(!0,!1),t}},duration:e||v.DEFAULT_ANIMATION_DURATION,complete:function(){j()(this).removeAttr("tabindex")}}}},{key:"_addClipping",value:function(t){var e=this.$svg.appendSVG("clipPath");e[0].id=this.clipId;var 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("."+t).each((function(t){this.id="ClipMask-"+a.ObjectFactory.get().createUniqueId(),e.appendSVG("use").attrXLINK("href","#"+this.id),r.appendSVG("use").attrXLINK("href","#"+this.id)}))}},{key:"_renderWireLegend",value:function(t,e,r,n){var i,o={detachFunc:function(){},attachFunc:function(){},removeFunc:function(){}};if(!this.chart.config.options.tooltips.enabled)return o;n&&this.$svg.appendSVG("rect","wire-legend-background-box").attr("opacity","1");var s,l=e,c=0,u=0;if(u=-1===l.h?l.x2-10:this.width-l.x2-10,Array.isArray(t))for(var h=0;h<t.length;h++){var d=t.length-h-1,f=l.y2+5*l.v-17*d-5*d,p=this._renderLineLabel(l.x2+5,f,a.strings.truncateText(t[h],u,this._measureText.bind(this)),"",n);p.addClass(r),c=Math.max(c,p[0].getComputedTextLength()),0===h?s=p:s.data("lines")?s.data("lines").push(p):s.data("lines",[p])}else(s=this._renderLineLabel(l.x2+5,l.y2+5*l.v,a.strings.truncateText(t,u,this._measureText.bind(this)),"",n)).addClass(r),c=s[0].getComputedTextLength();if(i=c+10,e.autoPosition&&(l=e.posFunc.call(this,i,17),s.attr("x",l.x2+5),s.attr("y",l.y2+5*l.v)),-1===l.h?(s.attr("x",l.x2-5-c),s.css("text-anchor","left"),s.data("lines")&&s.data("lines").forEach((function(t){t.attr("x",l.x2-5-c),t.css("text-anchor","left")}))):(s.attr("x",l.x2+5),s.css("text-anchor","right"),s.data("lines")&&s.data("lines").forEach((function(t){t.attr("x",l.x2+5),t.css("text-anchor","right")}))),1===l.v)s.data("lines")&&s.data("lines").forEach((function(t,e){t.attr("y",l.x2-5-c);var r=1+e;t.attr("y",l.y2+5*l.v+17*r+5*(r+1))})),s.attr("dy","0.7em");else if(s.data("lines")){var y=s.data("lines").length;s.attr("y",l.y2+5*l.v-17*y-5*y),s.data("lines").forEach((function(t,e){y=s.data("lines").length-1-e,t.attr("y",l.y2+5*l.v-17*y-5*y)}))}s.add(s.data("lines")).each((function(t,e){var r=j()(e),n=r.data("$background");n&&(n.attr("x",r.attr("x")),n.attr("y",r.attr("y")),n.css("text-anchor",r.css("text-anchor")),n.attr("dy",r.attr("dy")))}));var v=[];l.x1>0&&l.y1>0&&(v.push(this._renderLine(l.x1,l.y1,l.x2,l.y2,"label-line")),v.push(this._renderLine(l.x2,l.y2,l.x2+l.h*(c+10),l.y2,"label-line"))),s.data("wires",v);var b=this.$svg;return o.detachFunc=function(){s.data("wires").forEach((function(t){t.detach()})),s.data("lines")&&s.data("lines").forEach((function(t){t.data("$background")&&b.append(t.data("$background")),t.detach()})),s.data("$background")&&s.data("$background").remove(),s.detach()},o.attachFunc=function(){b.append(s),s.data("$background")&&b.append(s.data("$background")),b.append(s.data("wires")),s.data("lines")&&s.data("lines").forEach((function(t){b.append(t),t.data("$background")&&b.append(t.data("$background"))}))},o.removeFunc=function(){s.data("wires").forEach((function(t){t.remove()})),s.data("lines")&&s.data("lines").forEach((function(t){t.data("$background")&&t.data("$background").remove(),t().remove()})),s.data("$background")&&s.data("$background").remove(),s.remove()},o.$field=s,o}}])&&G(e.prototype,r),n&&G(e,n),o}(M);z(J,"FONT_SIZE_SMALLEST","smallestFont"),z(J,"FONT_SIZE_SMALL","smallFont"),z(J,"FONT_SIZE_MIDDLE","middleFont"),z(J,"FONT_SIZE_BIG","bigFont");var X=r(1),Y=r.n(X);r(3);function Z(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}Y.a.defaults.global.plugins.tooltipDelay={showTooltipDelay:700,resetTooltipDelay:200};var q="tooltipDelay",K=function(t,e,r){var n,a,i,o,s,l=t.$plugins.descriptors,c=l.length;for(n=0;n<c;++n)if((i=(a=l[n]).plugin).id!==q&&"function"==typeof(s=i[e])&&((o=[t].concat(r||[])).push(a.options),!1===s.apply(i,o)))return!1;return!0},Q=function(t,e){if(t.ctx){var r=t.tooltip;!1!==K(t,"beforeTooltipDraw",[e])&&(r.draw(),K(t,"afterTooltipDraw",[e]))}},tt=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=q,this._chartTooltipVisible=!1,this._chartTooltipShowTimeoutIds=[],this._chartTooltipHideTimeoutIds=[]}var e,r,n;return e=t,(r=[{key:"beforeTooltipDraw",value:function(t,e,r){var n=this,a=t.tooltip,i=r.showTooltipDelay,o=r.resetTooltipDelay;return(a._active||[]).length?this._chartTooltipVisible?(this._chartTooltipHideTimeoutIds.forEach((function(t){return clearTimeout(t)})),this._chartTooltipHideTimeoutIds=[],Q(t,e)):this._chartTooltipShowTimeoutIds.push(setTimeout((function(){n._chartTooltipShowTimeoutIds=[],n._chartTooltipVisible=!0,Q(t,e)}),i)):this._chartTooltipVisible?(this._chartTooltipHideTimeoutIds.push(setTimeout((function(){n._chartTooltipHideTimeoutIds=[],n._chartTooltipVisible=!1}),o)),Q(t,e)):(this._chartTooltipShowTimeoutIds.forEach((function(t){return clearTimeout(t)})),this._chartTooltipShowTimeoutIds=[]),!1}}])&&Z(e.prototype,r),n&&Z(e,n),t}();function et(t){return et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et(t)}function rt(t){return function(t){if(Array.isArray(t))return nt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return nt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nt(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function at(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function it(){return it="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=ot(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},it.apply(this,arguments)}function ot(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=ht(t)););return t}function st(t,e){return st=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},st(t,e)}function lt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=ht(t);if(e){var a=ht(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return ct(this,r)}}function ct(t,e){if(e&&("object"===et(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ut(t)}function ut(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ht(t){return ht=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ht(t)}function dt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}a.App.addListener("init",(function(){a.Device.get().supportsOnlyTouch()||Y.a.plugins.register(new tt)})),Y.a.defaults.global.maintainAspectRatio=!1,Y.a.defaults.global.legend.labels.usePointStyle=!0,Y.a.defaults.global.legend.labels.boxWidth=7,Y.a.defaults.global.elements.line.tension=0,Y.a.defaults.global.elements.line.fill=!1,Y.a.defaults.global.elements.line.borderWidth=2,Y.a.defaults.global.elements.point.radius=0,Y.a.defaults.global.elements.point.hitRadius=10,Y.a.defaults.global.elements.point.hoverRadius=5,Y.a.defaults.global.elements.point.hoverBorderWidth=2,Y.a.defaults.global.elements.arc.borderWidth=1,Y.a.defaults.global.elements.rectangle.borderWidth=1,Y.a.defaults.global.elements.rectangle.borderSkipped="",Y.a.defaults.horizontalBar.elements.rectangle.borderSkipped="",Y.a.defaults.global.tooltips.borderWidth=1,Y.a.defaults.global.tooltips.cornerRadius=4,Y.a.defaults.global.tooltips.xPadding=8,Y.a.defaults.global.tooltips.yPadding=8,Y.a.defaults.global.tooltips.titleSpacing=4,Y.a.defaults.global.tooltips.titleMarginBottom=8,Y.a.defaults.global.tooltips.bodySpacing=4;var ft=!1,pt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&st(t,e)}(o,t);var e,r,n,i=lt(o);function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).chartJs=null,e.onlyIntegers=!0,e.minSpaceBetweenYTicks=35,e.minSpaceBetweenXTicks=150,e.maxXAxesTicksHeigth=75,e.numSupportedColors=6,e.colorSchemeCssClass="",e.minRadialChartDatalabelSpace=25,e._tooltipTitle=e._formatTooltipTitle.bind(ut(e)),e._tooltipLabel=e._formatTooltipLabel.bind(ut(e)),e._tooltipLabelColor=e._computeTooltipLabelColor.bind(ut(e)),e._labelFormatter=e._formatLabel.bind(ut(e)),e._xLabelFormatter=e._formatXLabel.bind(ut(e)),e._yLabelFormatter=e._formatYLabel.bind(ut(e)),e._xAxisFitter=e._fitXAxis.bind(ut(e)),e._yAxisFitter=e._fitYAxis.bind(ut(e)),e._radialChartDatalabelsDisplayHandler=e._displayDatalabelsOnRadialChart.bind(ut(e)),e._radialChartDatalabelsFormatter=e._formatDatalabelsOnRadialChart.bind(ut(e)),e._datalabelsFormatter=e._formatDatalabels.bind(ut(e)),e._datalabelBackgroundColorHandler=e._getBackgroundColorOfDataset.bind(ut(e)),e._legendLabelGenerator=e._generateLegendLabels.bind(ut(e)),e.resetDatasetAfterHover=!1,e._clickHandler=e._onClick.bind(ut(e)),e._hoverHandler=e._onHover.bind(ut(e)),e._pointerHoverHandler=e._onHoverPointer.bind(ut(e)),e.legendHoverDatasets=[],e._legendClickHandler=e._onLegendClick.bind(ut(e)),e._legendHoverHandler=e._onLegendHover.bind(ut(e)),e._legendPointerHoverHandler=e._onLegendHoverPointer.bind(ut(e)),e._legendLeaveHandler=e._onLegendLeave.bind(ut(e)),e._legendPointerLeaveHandler=e._onLegendLeavePointer.bind(ut(e)),e._resizeHandler=e._onResize.bind(ut(e)),e}return e=o,r=[{key:"_validateChartData",value:function(){var t=!0,e=this.chart&&this.chart.data;if(e&&e.chartValueGroups&&0!==e.chartValueGroups.length&&e.axes||(t=!1),t&&scout.isOneOf(this.chart.config.type,v.Type.POLAR_AREA,v.Type.RADAR)){var r,n=0;for(r=0;r<e.chartValueGroups.length;r++){var a=e.chartValueGroups[r];a.values||(t=!1),0===r?n=a.values.length:a.values.length!==n&&(t=!1)}for(r=0;r<e.axes.length;r++)e.axes[r].length!==n&&(t=!1)}if(t)return!0;var i=!0,o=this.chart&&this.chart.config;if(o&&o.data&&o.data.datasets&&0!==o.data.datasets.length||(i=!1),i&&scout.isOneOf(this.chart.config.type,v.Type.POLAR_AREA,v.Type.RADAR)){var s,l=0;for(s=0;s<o.data.datasets.length;s++){var c=o.data.datasets[s];c.data||(i=!1),0===s?l=c.data.length:c.data.length!==l&&(i=!1)}}return i}},{key:"_render",value:function(){this.$canvas||(this.$canvas=this.chart.$container.appendElement("<canvas>")),this.firstOpaqueBackgroundColor=a.styles.getFirstOpaqueBackgroundColor(this.$canvas),ft||(Y.a.defaults.global.defaultFontFamily=this.$canvas.css("font-family"),ft=!0);var t=$.extend(!0,{},this.chart.config);this._adjustConfig(t),this._renderChart(t,!0)}},{key:"_renderChart",value:function(t,e){this.chartJs&&this.chartJs.destroy(),(t=$.extend(!0,{},t,{options:{animation:{}}},t)).options.animation.duration=e?this.animationDuration:0,this.chartJs=new Y.a(this.$canvas[0].getContext("2d"),t),this._adjustSize(this.chartJs.config,this.chartJs.chartArea),this.chartJs.update()}},{key:"_updateData",value:function(){var t=this;if(this.chartJs){var e=$.extend(!0,{},this.chart.config);this._adjustConfig(e);var r=[],n=[],i=this.chartJs.config.data,o=e.data;if(i&&o){var s=function(t,e,r,n){if(t&&e&&r)if(e[r]){if(!t[r])return n?void(e[r]=void 0):Array.isArray(e[r])?void e[r].splice(0):void(e[r]=void 0);if(Array.isArray(t[r])&&Array.isArray(e[r])){for(var a=0;a<Math.min(t[r].length,e[r].length);a++)e[r][a]=t[r][a];var i=e[r].length,o=t[r].length;if(i>o)e[r].splice(o);else if(i<o){var s;(s=e[r]).push.apply(s,rt(t[r].splice(i)))}}else e[r]=t[r]}else e[r]=t[r]};if(s(o,i,"labels"),i.datasets||(i.datasets=[]),o.datasets||(o.datasets=[]),scout.isOneOf(e.type,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA)&&i.datasets.length){var l=this.chartJs.getDatasetMeta(0);l&&l.data&&Array.isArray(l.data)&&l.data.forEach((function(t,e){t.hidden&&r.push(e)}))}for(var c=0;c<Math.min(o.datasets.length,i.datasets.length);c++){var u=i.datasets[c],h=o.datasets[c];u.label=h.label,u.type=h.type,s(h,u,"data"),s(h,u,"backgroundColor",!0),s(h,u,"borderColor",!0),s(h,u,"hoverBackgroundColor",!0),s(h,u,"hoverBorderColor",!0),s(h,u,"legendColor",!0),s(h,u,"pointHoverBackgroundColor",!0)}var d=i.datasets.length,f=o.datasets.length;if(d>f)i.datasets.splice(f);else if(d<f){var p;(p=i.datasets).push.apply(p,rt(o.datasets.splice(d))),n=a.arrays.init(f-d).map((function(t,e){return d+e}))}}else this.chartJs.config.data=o;$.extend(!0,this.chartJs.config,{options:{animation:{duration:this.animationDuration}}}),this.chartJs.update(),r.length&&n.length&&n.forEach((function(e){var n=t.chartJs.getDatasetMeta(e);n&&n.data&&Array.isArray(n.data)&&r.filter((function(t){return n.data.length>t})).forEach((function(t){n.data[t].hidden=!0}))})),this._adjustSize(this.chartJs.config,this.chartJs.chartArea),this.chartJs.update()}}},{key:"isDataUpdatable",value:function(){return!0}},{key:"_updateChart",value:function(t){var e=this.chartJs.config;this._adjustColors(e),this._renderChart(e,t)}},{key:"_renderCheckedItems",value:function(){this.chartJs&&this._checkItems(this.chartJs.config)&&this.chartJs.update()}},{key:"_checkItems",value:function(t){var e=this;if(!t||!t.data)return!1;var r=function(t,e,r){if(Array.isArray(t)&&Array.isArray(e)){var n=0;return a.arrays.ensure(r).filter((function(r){return!isNaN(r)&&r<Math.min(t.length,e.length)})).forEach((function(r){t[r]!==e[r]&&(t[r]=e[r],n++)})),n}return 0},n=0;return t.data.datasets.forEach((function(t,i){var o=e.chart.checkedItems.filter((function(t){return t.datasetIndex===i})).map((function(t){return t.dataIndex})),s=a.arrays.init(t.data.length).map((function(t,e){return e}));a.arrays.removeAll(s,o),n=n+r(t.backgroundColor,t.checkedBackgroundColor,o)+r(t.hoverBackgroundColor,t.checkedHoverBackgroundColor,o)+r(t.pointBackgroundColor,t.checkedPointBackgroundColor,o)+r(t.pointHoverBackgroundColor,t.checkedPointHoverBackgroundColor,o)+r(t.pointRadius,t.checkedPointRadius,o)+r(t.backgroundColor,t.uncheckedBackgroundColor,s)+r(t.hoverBackgroundColor,t.uncheckedHoverBackgroundColor,s)+r(t.pointBackgroundColor,t.uncheckedPointBackgroundColor,s)+r(t.pointHoverBackgroundColor,t.uncheckedPointHoverBackgroundColor,s)+r(t.pointRadius,t.uncheckedPointRadius,s)})),0<n}},{key:"_adjustConfig",value:function(t){t&&t.type&&(this._adjustType(t),this.chart.data&&this._computeDatasets(this.chart.data,t),this._adjustData(t),this._adjustTooltip(t),this._adjustGrid(t),this._adjustPlugins(t),this._adjustColors(t),this._adjustClickHandler(t),this._adjustResizeHandler(t))}},{key:"_adjustType",value:function(t){if(t.type===v.Type.COMBO_BAR_LINE){t.type=v.Type.BAR;var e=((t.options||{}).scales||{}).scaleLabelByTypeMap;e&&(e[v.Type.BAR]=e[v.Type.COMBO_BAR_LINE])}}},{key:"_computeDatasets",value:function(t,e){var r=[],n=[],a=function(t,r){$.isEmptyObject(r)||(e.options=$.extend(!0,{},{scales:{}},e.options),e.options.scales[t]=r)};(t.axes[0]||[]).forEach((function(t){return r.push(t.label)})),a(e.type===v.Type.BAR_HORIZONTAL?"yLabelMap":"xLabelMap",this._computeLabelMap(t.axes[0])),a(e.type===v.Type.BAR_HORIZONTAL?"xLabelMap":"yLabelMap",this._computeLabelMap(t.axes[1])),t.chartValueGroups.forEach((function(t){return n.push({type:t.type,label:t.groupName,data:$.extend(!0,[],t.values)})})),e.data={labels:r,datasets:n}}},{key:"_computeLabelMap",value:function(t){var e={};return(t||[]).forEach((function(t,r){e[r]=t.label})),e}},{key:"_adjustData",value:function(t){t&&t.data&&t.type&&(this._adjustBarBorderWidth(t),this._adjustMaxSegments(t),this._adjustBubbleRadii(t),this._adjustOnlyIntegers(t))}},{key:"_adjustBarBorderWidth",value:function(t){t&&t.data&&t.type&&scout.isOneOf(t.type,v.Type.BAR,v.Type.BAR_HORIZONTAL)&&t.data.datasets.forEach((function(t){(t.type||v.Type.BAR)===v.Type.BAR&&(t.hoverBorderWidth=t.hoverBorderWidth||2)}))}},{key:"_adjustMaxSegments",value:function(t){if(t&&t.data&&t.type&&scout.isOneOf(t.type,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA,v.Type.RADAR)){var e=t.options.maxSegments;if(e&&t.data.datasets.length&&e<t.data.datasets[0].data.length){t.data.datasets.forEach((function(t){var r=t.data.slice(0,e);r[e-1]=t.data.slice(e-1,t.data.length).reduce((function(t,e){return t+e}),0),t.data=r}));var r=t.data.labels.slice(0,e);r[e-1]=this.chart.session.text("ui.OtherValues"),t.data.labels=r,t.data.maxSegmentsExceeded=!0}}}},{key:"_isMaxSegmentsExceeded",value:function(t,e){return!!scout.isOneOf(t.type,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA,v.Type.RADAR)&&!t.options.otherSegmentClickable&&!(!t.data.maxSegmentsExceeded||!t.options.maxSegments)&&t.options.maxSegments-1<=e}},{key:"_adjustBubbleRadii",value:function(t){t&&t.data&&t.type&&t.type===v.Type.BUBBLE&&t.data.datasets.forEach((function(t){return t.data.forEach((function(t){isNaN(t.r)?isNaN(t.z)||(t.r=Math.sqrt(t.z)):t.z=Math.pow(t.r,2)}))}))}},{key:"_adjustOnlyIntegers",value:function(t){this.onlyIntegers=!0,t&&t.data&&t.type&&(t.type===v.Type.BUBBLE?this.onlyIntegers=t.data.datasets.every((function(t){return t.data.every((function(t){return a.numbers.isInteger(t.x)&&a.numbers.isInteger(t.y)}))})):this.onlyIntegers=t.data.datasets.every((function(t){return t.data.every((function(t){return a.numbers.isInteger(t)}))})))}},{key:"_adjustTooltip",value:function(t){t&&(t.options=$.extend(!0,{},{hover:{mode:"nearest"},tooltips:{mode:"nearest",callbacks:{title:this._tooltipTitle,label:this._tooltipLabel,labelColor:this._tooltipLabelColor}}},t.options))}},{key:"_formatTooltipTitle",value:function(t,e){var r,n=this.chartJs.config,i=this.chartJs.ctx,s=t[0],l=Y.a.defaults.global,c={},u=l.tooltips;if(Y.a.defaults[n.type]&&(c=$.extend(!0,{},c,Y.a.defaults[n.type].tooltips)),scout.isOneOf(n.type,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA,v.Type.LINE,v.Type.BAR,v.Type.BAR_HORIZONTAL,v.Type.RADAR)){var h=e.labels[s.index];r=n.options.reformatLabels?this._formatLabel(h):h}else if(n.type===v.Type.BUBBLE){var d=n.options.scales.xAxes[0],f=n.options.scales.yAxes[0],p=d.scaleLabel.labelString,y=f.scaleLabel.labelString;p=p?p+":":o.ARROW_LEFT_RIGHT,y=y?y+":":" "+o.ARROW_UP_DOWN+" ",r=[];var b=d.ticks.callback(s.xLabel);b&&r.push(p+" "+b);var g=f.ticks.callback(s.yLabel);g&&r.push(y+" "+g)}else{var m;c.callbacks&&(m=c.callbacks.title),r=(m||u.callbacks.title).call(this.chartJs,t,e)}var _=this.$canvas.cssWidth()-2*n.options.tooltips.xPadding,C=i.measureText.bind(i),x=i.font,k=n.options.tooltips.titleFontStyle||c.titleFontStyle||u.titleFontStyle||l.defaultFontStyle,T=n.options.tooltips.titleFontSize||c.titleFontSize||u.titleFontSize||l.defaultFontSize,A=n.options.tooltips.titleFontFamily||c.titleFontFamily||u.titleFontFamily||l.defaultFontFamily,O=[];return i.font=k+" "+T+"px "+A,a.arrays.ensure(r).forEach((function(t){return O.push(a.strings.truncateText(t,_,C))})),i.font=x,O}},{key:"_formatTooltipLabel",value:function(t,e){var r,n,i=this.chartJs.config,o=this.chartJs.ctx,s=e?e.datasets:null,l=s?s[t.datasetIndex]:null,c=Y.a.defaults.global,u={},h=c.tooltips;if(Y.a.defaults[i.type]&&(u=$.extend(!0,{},u,Y.a.defaults[i.type].tooltips)),scout.isOneOf(i.type,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA,v.Type.LINE,v.Type.BAR,v.Type.BAR_HORIZONTAL,v.Type.RADAR))r=l.label,n=this._formatLabel(l.data[t.index]);else if(i.type===v.Type.BUBBLE)r=l.label,n=this._formatLabel(l.data[t.index].z);else{var d;u.callbacks&&(d=u.callbacks.label),r=(d||h.callbacks.label).call(this.chartJs,t,e)}r=" "+r,n=n?" "+n:"";var f=i.options.tooltips.displayColors?i.options.tooltips.bodyFontSize||u.bodyFontSize||h.bodyFontSize||c.defaultFontSize:0,p=this.$canvas.cssWidth()-2*i.options.tooltips.xPadding-f,y=o.measureText.bind(o),b=r+(n?":"+n:"");return y(b).width>p?y(n).width>p/2?a.strings.truncateText(n,p,y):a.strings.truncateText(r,p-y(n?":"+n:"").width,y)+(n?":"+n:""):b}},{key:"_computeTooltipLabelColor",value:function(t,e){var r,n,a=e.config,i=a.options?a.options.tooltips:null,o=i?i.backgroundColor:null,s=e.data?e.data.datasets:null,l=s?s[t.datasetIndex]:null;if(scout.isOneOf(l.type||a.type,v.Type.LINE,v.Type.BAR,v.Type.BAR_HORIZONTAL,v.Type.RADAR,v.Type.BUBBLE)&&(r=l.legendColor||l.borderColor),scout.isOneOf(a.type,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA)){var c=Array.isArray(l.legendColor)?l.legendColor[t.index]:l.legendColor,u=Array.isArray(l.backgroundColor)?l.backgroundColor[t.index]:l.backgroundColor;r=c||this._adjustColorOpacity(u,1)}return r&&"function"!=typeof r||(Y.a.defaults[a.type]&&Y.a.defaults[a.type].callbacks&&(n=Y.a.defaults[a.type].callbacks.labelColor),r=(n||Y.a.defaults.global.tooltips.callbacks.labelColor).call(e,t,e).backgroundColor),{borderColor:o,backgroundColor:r}}},{key:"_adjustGrid",value:function(t){t&&(t.options=$.extend(!0,{},t.options),this._adjustScale(t),this._adjustScales(t))}},{key:"_adjustScale",value:function(t){if(t&&t.type&&t.options){scout.isOneOf(t.type,v.Type.POLAR_AREA,v.Type.RADAR)&&(t.options=$.extend(!0,{},{scale:{}},t.options));var e=t.options;e.scale&&(e.scale=$.extend(!0,{},{angleLines:{display:!1},gridLines:{borderDash:[2,4]},ticks:{beginAtZero:!0,callback:this._labelFormatter},pointLabels:{fontSize:Y.a.defaults.global.defaultFontSize}},e.scale))}}},{key:"_adjustScales",value:function(t){t&&t.type&&t.options&&(scout.isOneOf(t.type,v.Type.BAR,v.Type.BAR_HORIZONTAL,v.Type.LINE,v.Type.BUBBLE)&&(t.options=$.extend(!0,{},{scales:{xAxes:[{}],yAxes:[{}]}},t.options)),this._adjustXAxes(t),this._adjustYAxes(t))}},{key:"_adjustXAxes",value:function(t){if(t&&t.type&&t.options&&t.options.scales&&t.options.scales.xAxes)for(var e=t.type,r=t.options.scales.xAxes,n=0;n<r.length;n++)scout.isOneOf(e,v.Type.BAR_HORIZONTAL,v.Type.BUBBLE)?r[n]=$.extend(!0,{},{offset:e===v.Type.BUBBLE,gridLines:{drawBorder:!1,drawTicks:!1,zeroLineBorderDash:[2,4],borderDash:[2,4]},ticks:{padding:5,beginAtZero:e===v.Type.BAR_HORIZONTAL}},r[n]):r[n]=$.extend(!0,{},{offset:!0,gridLines:{display:!1}},r[n]),(scout.isOneOf(e,v.Type.BAR_HORIZONTAL,v.Type.BUBBLE)||t.options.reformatLabels)&&(r[n]=$.extend(!0,{},{ticks:{callback:this._xLabelFormatter}},r[n])),r[n].afterCalculateTickRotation=this._xAxisFitter}},{key:"_adjustYAxes",value:function(t){if(t&&t.type&&t.options&&t.options.scales&&t.options.scales.yAxes)for(var e=t.type,r=t.options.scales.yAxes,n=0;n<r.length;n++)e===v.Type.BAR_HORIZONTAL?r[n]=$.extend(!0,{},{gridLines:{display:!1}},r[n]):r[n]=$.extend(!0,{},{gridLines:{drawBorder:!1,drawTicks:!1,zeroLineBorderDash:[2,4],borderDash:[2,4]},ticks:{padding:5,beginAtZero:e!==v.Type.BUBBLE}},r[n]),(e!==v.Type.BAR_HORIZONTAL||t.options.reformatLabels)&&(r[n]=$.extend(!0,{},{ticks:{callback:this._yLabelFormatter}},r[n])),r[n].afterFit=this._yAxisFitter}},{key:"_adjustPlugins",value:function(t){this._adjustPluginsDatalabels(t)}},{key:"_adjustPluginsDatalabels",value:function(t){var e=this;if(t&&t.type&&t.options&&t.options.plugins&&t.options.plugins.datalabels&&t.options.plugins.datalabels.display){var r=t.options.plugins;if(scout.isOneOf(t.type,v.Type.PIE,v.Type.DOUGHNUT)?(r.datalabels=$.extend(!0,{},{formatter:this._radialChartDatalabelsFormatter},r.datalabels),r.datalabels.display=this._radialChartDatalabelsDisplayHandler):scout.isOneOf(t.type,v.Type.BAR,v.Type.BAR_HORIZONTAL,v.Type.LINE,v.Type.POLAR_AREA,v.Type.RADAR,v.Type.BUBBLE)&&(r.datalabels=$.extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:4},r.datalabels),r.datalabels.display="auto"),t.options.reformatLabels){var n=function(t){return function(r,n){var a=t.call(n.chart,r,n);return e._formatLabel(a)}};t.data&&t.data.datasets.forEach((function(t){t.datalabels&&t.datalabels.formatter&&(t.datalabels.formatter=n(t.datalabels.formatter))})),r.datalabels.formatter&&(r.datalabels.formatter=n(r.datalabels.formatter))}r.datalabels=$.extend(!0,{},{formatter:this._datalabelsFormatter},r.datalabels)}}},{key:"_formatLabel",value:function(t){return this._formatLabelMap(t,null,this._getNumberFormatter())}},{key:"_getNumberFormatter",value:function(){if(this.chartJs&&this.chartJs.config&&this.chartJs.config.options)return this.chartJs.config.options.numberFormatter}},{key:"_formatXLabel",value:function(t){return this._formatLabelMap(t,this._getXLabelMap(),this._getNumberFormatter())}},{key:"_formatYLabel",value:function(t){return this._formatLabelMap(t,this._getYLabelMap(),this._getNumberFormatter())}},{key:"_getXLabelMap",value:function(){return this._getLabelMap("xLabelMap")}},{key:"_getYLabelMap",value:function(){return this._getLabelMap("yLabelMap")}},{key:"_getLabelMap",value:function(t){if(this.chartJs&&this.chartJs.config&&this.chartJs.config.options&&this.chartJs.config.options.scales)return this.chartJs.config.options.scales[t]}},{key:"_formatLabelMap",value:function(t,e,r){return e?e[t]:isNaN(t)?t:r?r(t,this._formatNumberLabel.bind(this)):this._formatNumberLabel(t)}},{key:"_formatNumberLabel",value:function(t){if(isNaN(t))return t;var e=Math.abs(t),r="";if(e>=1e6){e/=1e6,r=" "+this.chart.session.text("ui.Mio");for(var n=[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")],a=0;a<n.length&&e>=1e6;a++)e/=1e3,r=" "+n[a]}return this.session.locale.decimalFormat.format(Math.sign(t)*e)+r}},{key:"_fitXAxis",value:function(t){if(t&&0!==t.labelRotation){var e,r,n=this.maxXAxesTicksHeigth,i=Y.a.defaults.global,o=Y.a.defaults.scale.ticks;if(this.chartJs){var s=this.chartJs.chartArea,l=Math.abs(s.top-s.bottom);n=Math.min(n,l/3)}t.options&&t.options.ticks&&(r=t.options.ticks.maxRotation,e=t.options.ticks.fontSize),r=r||o.maxRotation,e=e||o.fontSize||i.defaultFontSize,isNaN(t.labelRotation)&&(t.labelRotation=r),t.height=isNaN(t.height)?n:Math.min(t.height,n);var c=t.labelRotation,u=(n-e*Math.sin((90-c)/180*Math.PI))/Math.sin(c/180*Math.PI);if(t.longestLabelWidth>u){var h=t.ctx.measureText.bind(t.ctx);t._ticks.forEach((function(t){t.label=a.strings.truncateText(t.label,u,h)})),t._labelSizes=null}}}},{key:"_fitYAxis",value:function(t){if(t){var e=0,r=0;if(t.options&&t.options.ticks&&(e=t.options.ticks.padding||0),t.options&&t.options.gridLines&&(r=t.options.gridLines.tickMarkLength||0),t.longestLabelWidth>t.maxWidth-e){var n=t.maxWidth-e-r,i=t.ctx.measureText.bind(t.ctx);t._ticks.forEach((function(t){t.label=a.strings.truncateText(t.label,n,i)}))}}}},{key:"_displayDatalabelsOnRadialChart",value:function(t){var e=t.chart.getDatasetMeta(t.datasetIndex).data[t.dataIndex]._model,r=(e.outerRadius+e.innerRadius)/2,n=Math.min(e.endAngle-e.startAngle,Math.PI)/2,a=Math.abs(Math.sin(n))*r*2,i=e.outerRadius-e.innerRadius;return Math.min(a,i)>this.minRadialChartDatalabelSpace}},{key:"_formatDatalabelsOnRadialChart",value:function(t,e){for(var r=this._computeSumOfVisibleElements(e),n=e.dataset,a=0,i=[],o=0;o<e.dataIndex+1;o++){var s=n.data[o]/r*100-a,l=Math.round(s);a=l-s,i.push(l+"%")}return i[e.dataIndex]}},{key:"_computeSumOfVisibleElements",value:function(t){for(var e=t.dataset,r=t.chart.getDatasetMeta(t.datasetIndex),n=0,a=0;a<e.data.length;a++)r.data[a]&&!r.data[a].hidden&&(n+=e.data[a]);return n}},{key:"_formatDatalabels",value:function(t,e){return e.chart.config.type===v.Type.BUBBLE?this._formatLabel(t.z):this._formatLabel(t)}},{key:"_getBackgroundColorOfDataset",value:function(t){return t.dataset.backgroundColor}},{key:"_adjustColors",value:function(t){this._adjustColorSchemeCssClass(t),this._adjustDatasetColors(t),this._adjustLegendColors(t),this._adjustTooltipColors(t),this._adjustScaleColors(t),this._adjustScalesColors(t),this._adjustPluginColors(t)}},{key:"_adjustColorSchemeCssClass",value:function(t){t&&t.options&&(this.colorSchemeCssClass=a.colorSchemes.getCssClasses(t.options.colorScheme).join(" "))}},{key:"_adjustDatasetColors",value:function(t){if(t&&t.data&&t.type){var e=t.data,r=t.type,n=t.options&&t.options.autoColor,i=t.options&&t.options.checkable,o=n&&scout.isOneOf(r,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA),s={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColor:this._computePointHoverColor(r)};s=$.extend(!0,s,this._computeDatasetColors(t,o)),e.datasets.forEach((function(e,n){var l=o?s.backgroundColors:s.backgroundColors[n],c=o?s.borderColors:s.borderColors[n],u=o?s.hoverBackgroundColors:s.hoverBackgroundColors[n],h=o?s.hoverBorderColors:s.hoverBorderColors[n],d=o?s.legendColors:s.legendColors[n],f=s.pointHoverColor,p=function(t,r){r&&r.length&&(e[t]=Array.isArray(r)?rt(r):r)};if(p("backgroundColor",l),p("borderColor",c),p("hoverBackgroundColor",u),p("hoverBorderColor",h),p("legendColor",d),p("pointHoverBackgroundColor",f),i){var y=e.data.length;if(scout.isOneOf(r,v.Type.PIE,v.Type.BAR_HORIZONTAL,v.Type.DOUGHNUT,v.Type.POLAR_AREA,v.Type.BUBBLE)||r===v.Type.BAR&&(e.type||v.Type.BAR)===v.Type.BAR){var b=o?s.backgroundColors:a.arrays.init(y,s.backgroundColors[n]),g=o?s.hoverBackgroundColors:a.arrays.init(y,s.hoverBackgroundColors[n]),m=o?s.checkedBackgroundColors:a.arrays.init(y,s.checkedBackgroundColors[n]),_=o?s.checkedHoverBackgroundColors:a.arrays.init(y,s.checkedHoverBackgroundColors[n]);p("uncheckedBackgroundColor",b),p("uncheckedHoverBackgroundColor",g),p("checkedBackgroundColor",m),p("checkedHoverBackgroundColor",_),p("backgroundColor",e.uncheckedBackgroundColor),p("hoverBackgroundColor",e.uncheckedHoverBackgroundColor)}else if(scout.isOneOf(r,v.Type.LINE,v.Type.RADAR)||r===v.Type.BAR&&e.type===v.Type.LINE){var C=a.arrays.init(y,f),x=a.arrays.init(y,f),k=a.arrays.init(y,c),T=a.arrays.init(y,h||c);p("uncheckedPointBackgroundColor",C),p("uncheckedPointHoverBackgroundColor",x),p("checkedPointBackgroundColor",k),p("checkedPointHoverBackgroundColor",T),p("pointBackgroundColor",e.uncheckedPointBackgroundColor),p("pointHoverBackgroundColor",e.uncheckedPointHoverBackgroundColor);var A=a.arrays.init(y,((t.options.elements||{}).point||{}).radius||Y.a.defaults.global.elements.point.radius),O=a.arrays.init(y,((t.options.elements||{}).point||{}).hoverRadius||Y.a.defaults.global.elements.point.hoverRadius);p("uncheckedPointRadius",A),p("checkedPointRadius",O),p("pointRadius",e.uncheckedPointRadius)}}})),i&&this._checkItems(t)}}},{key:"_computePointHoverColor",value:function(t){return a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","point hover"],"fill").fill}},{key:"_computeDatasetColors",value:function(t,e){if(!t||!t.data||!t.type)return{};var r=t.data,n=t.type,i={};if(t.options&&t.options.autoColor)i=this._computeDatasetColorsAutoColor(t,e);else if(i=this._computeDatasetColorsChartValueGroups(t,e),scout.isOneOf(n,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA)){var o=this._computeBorderColor(n,0);i.borderColors=a.arrays.init(r.datasets.length,o),i.hoverBorderColors=i.borderColors}return i}},{key:"_computeDatasetColorsAutoColor",value:function(t,e){var r=this;if(!(t&&t.data&&t.type&&t.options&&t.options.autoColor))return{};var n=t.data,i=t.type,o=t.options&&t.options.checkable,s=t.options&&t.options.transparent,l={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[]},c=[];return e?c=a.arrays.init(n.datasets.length&&n.datasets[0].data.length||0,i):n.datasets.forEach((function(t){return c.push(t.type||i)})),c.forEach((function(t,e){l.backgroundColors.push(r._computeBackgroundColor(t,e,o||s)),l.borderColors.push(r._computeBorderColor(t,e)),l.hoverBackgroundColors.push(r._computeHoverBackgroundColor(t,e,o||s)),l.hoverBorderColors.push(r._computeHoverBorderColor(t,e)),l.checkedBackgroundColors.push(r._computeCheckedBackgroundColor(t,e,o)),l.checkedHoverBackgroundColors.push(r._computeCheckedHoverBackgroundColor(t,e,o)),l.legendColors.push(r._computeLegendColor(t,e))})),l}},{key:"_computeBackgroundColor",value:function(t,e,r){return a.styles.get([this.colorSchemeCssClass,t+"-chart"+(r?" checkable":""),"elements","color"+e%this.numSupportedColors],"fill").fill}},{key:"_computeBorderColor",value:function(t,e){var r;return scout.isOneOf(t,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA)&&(r={stroke:this.firstOpaqueBackgroundColor}),a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","stroke-color"+e%this.numSupportedColors],"stroke",r).stroke}},{key:"_computeHoverBackgroundColor",value:function(t,e,r){return a.styles.get([this.colorSchemeCssClass,t+"-chart"+(r?" checkable":""),"elements","color"+e%this.numSupportedColors+" hover"],"fill").fill}},{key:"_computeHoverBorderColor",value:function(t,e){var r;return scout.isOneOf(t,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA)&&(r={stroke:this.firstOpaqueBackgroundColor}),a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","stroke-color"+e%this.numSupportedColors+" hover"],"stroke",r).stroke}},{key:"_computeCheckedBackgroundColor",value:function(t,e,r){return a.styles.get([this.colorSchemeCssClass,t+"-chart"+(r?" checkable":""),"elements","color"+e%this.numSupportedColors+" checked"],"fill").fill}},{key:"_computeCheckedHoverBackgroundColor",value:function(t,e,r){return a.styles.get([this.colorSchemeCssClass,t+"-chart"+(r?" checkable":""),"elements","color"+e%this.numSupportedColors+" hover checked"],"fill").fill}},{key:"_computeLegendColor",value:function(t,e){return a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","color"+e%this.numSupportedColors+" legend"],"fill").fill}},{key:"_computeDatasetColorsChartValueGroups",value:function(t,e){var r=this;if(!t||!t.type||!this.chart.data)return{};var n=t.type,i=t.options&&t.options.checkable,o=t.options&&t.options.transparent,s={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[]};return this.chart.data.chartValueGroups.forEach((function(t){var e=a.styles.hexToRgb(t.colorHexValue),l=function(t,n){return r._adjustColorOpacity(a.styles.darkerColor(e,n),t)},c=1,u=1,h=.1,d=.1,f=.2,p=.35,y=1,b=0,g=1,m=.1;scout.isOneOf(n,v.Type.PIE,v.Type.DOUGHNUT)?(f=.7,p=.85,b=.1,m=0):n===v.Type.POLAR_AREA?(c=.7,u=.85,f=.7,p=.85,b=.1,m=0):scout.isOneOf(t.type||n,v.Type.LINE,v.Type.RADAR)?(c=.2,u=.35,h=0,d=0,y=.2,g=.35,m=0):n===v.Type.BUBBLE&&(c=.2,u=.35,h=0),s.backgroundColors.push(l(i||o?f:c,0)),s.borderColors.push(l(1,0)),s.hoverBackgroundColors.push(l(i||o?p:u,i||o?0:h)),s.hoverBorderColors.push(l(1,d)),s.checkedBackgroundColors.push(l(y,b)),s.checkedHoverBackgroundColors.push(l(g,m)),s.legendColors.push(l(1,0))})),s.datalabelColor=this._computeDatalabelColor(n),s}},{key:"_adjustColorOpacity",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t&&"function"!=typeof t?0===t.indexOf("rgb")?this._adjustRgbColorOpacity(t,e):0===t.indexOf("#")?this._adjustHexColorOpacity(t,e):t:t}},{key:"_adjustRgbColorOpacity",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!t||0!==t.indexOf("rgb"))return t;var r=a.styles.rgb(t);return r.alpha=e,"rgba("+r.red+", "+r.green+", "+r.blue+", "+r.alpha+")"}},{key:"_adjustHexColorOpacity",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return!t||0!==t.indexOf("#")||4!==t.length&&5!==t.length&&7!==t.length&&9!==t.length?t:this._adjustRgbColorOpacity(a.styles.hexToRgb(t),e)}},{key:"_adjustLegendColors",value:function(t){t&&t.type&&t.options&&(t.options=$.extend(!0,{},t.options,{legend:{labels:{fontColor:this._computeLabelColor(t.type),generateLabels:this._legendLabelGenerator}}}))}},{key:"_computeLabelColor",value:function(t){return a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","label"],"fill").fill}},{key:"_generateLegendLabels",value:function(t){var e,r,n=this,i=t.config,o=i.data,s=t.ctx.measureText.bind(t.ctx);e=scout.isOneOf(i.options.legend.position,v.Position.LEFT,v.Position.RIGHT)?Math.min(250,this.$canvas.cssWidth()/3):Math.min(250,2*this.$canvas.cssWidth()/3),Y.a.defaults[i.type]&&Y.a.defaults[i.type].legend&&Y.a.defaults[i.type].legend.labels&&(r=Y.a.defaults[i.type].legend.labels.generateLabels);var l=(r||Y.a.defaults.global.legend.labels.generateLabels).call(t,t);return l.forEach((function(t,r){t.text=a.strings.truncateText(t.text,e,s);var l,c=o.datasets[r];if(c&&scout.isOneOf(c.type||i.type,v.Type.LINE,v.Type.BAR,v.Type.BAR_HORIZONTAL,v.Type.RADAR,v.Type.BUBBLE))l=c.legendColor||n._adjustColorOpacity(c.borderColor,1);else if(o.datasets.length&&scout.isOneOf(i.type,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA)){c=o.datasets[0];var u=Array.isArray(c.legendColor)?c.legendColor[r]:c.legendColor,h=Array.isArray(c.backgroundColor)?c.backgroundColor[r]:c.backgroundColor;l=u||n._adjustColorOpacity(h,1)}"function"!=typeof l&&(t.fillStyle=l,t.strokeStyle=l)})),l}},{key:"_adjustTooltipColors",value:function(t){if(t&&t.type&&t.options){var e=this._computeTooltipBackgroundColor(t.type),r=this._computeTooltipBorderColor(t.type);t.options=$.extend(!0,{},t.options,{tooltips:{backgroundColor:e,borderColor:r,multiKeyBackground:e}})}}},{key:"_computeTooltipBackgroundColor",value:function(t){return a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","tooltip-background"],"fill").fill}},{key:"_computeTooltipBorderColor",value:function(t){return a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","tooltip-border"],"fill").fill}},{key:"_adjustScaleColors",value:function(t){if(t&&t.type&&t.options&&t.options.scale){var e=this._computeLabelColor(t.type),r=this._computeLabelBackdropColor(t.type),n=this._computeGridColor(t.type);t.options.scale.ticks=$.extend(!0,{},t.options.scale.ticks,{fontColor:n,backdropColor:r}),t.options.scale.pointLabels=$.extend(!0,{},t.options.scale.pointLabels,{fontColor:e}),t.options.scale.gridLines=$.extend(!0,{},t.options.scale.gridLines,{color:n})}}},{key:"_computeLabelBackdropColor",value:function(t){return a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","label-backdrop"],"fill",{fill:this.firstOpaqueBackgroundColor}).fill}},{key:"_computeGridColor",value:function(t){return a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","grid"],"fill").fill}},{key:"_adjustScalesColors",value:function(t){if(t&&t.type&&t.options&&t.options.scales){var e=t.options.scales.xAxes||[],r=t.options.scales.yAxes||[],n=[].concat(rt(e),rt(r));if(n.length){var a=this._computeLabelColor(t.type),i=this._computeGridColor(t.type),o=this._computeAxisLabelColor(t.type);n.forEach((function(t){t.gridLines=$.extend(!0,{},t.gridLines,{zeroLineColor:i,color:i}),t.ticks=$.extend(!0,{},t.ticks,{fontColor:a}),t.scaleLabel=$.extend(!0,{},t.scaleLabel,{fontColor:o})}))}}}},{key:"_computeAxisLabelColor",value:function(t){return a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","axis-label"],"fill").fill}},{key:"_adjustPluginColors",value:function(t){t&&t.type&&t.options&&t.options.plugins&&this._adjustPluginsDatalabelColors(t)}},{key:"_adjustPluginsDatalabelColors",value:function(t){t&&t.type&&t.options&&t.options.plugins&&t.options.plugins.datalabels&&(t.options.plugins.datalabels=$.extend(!0,{},t.options.plugins.datalabels,{color:this._computeDatalabelColor(t.type)}))}},{key:"_computeDatalabelColor",value:function(t){return a.styles.get([this.colorSchemeCssClass,t+"-chart","elements","datalabel"],"fill").fill}},{key:"_adjustClickHandler",value:function(t){t&&t.options&&(t.options.clickable?(t.options.onClick=this._clickHandler,t.options.onHover=this._pointerHoverHandler):t.options.onHover=this._hoverHandler,t.options.legend&&(t.options.legend.clickable?(t.options.legend.onClick=this._legendClickHandler,t.options.legend.onHover=this._legendPointerHoverHandler,t.options.legend.onLeave=this._legendPointerLeaveHandler):(t.options.legend.onClick=function(t){return t.stopPropagation()},t.options.legend.onHover=this._legendHoverHandler,t.options.legend.onLeave=this._legendLeaveHandler)))}},{key:"_onClick",value:function(t,e){if(e.length&&!this._isMaxSegmentsExceeded(this.chartJs.config,e[0]._index)){var r=e[0]._index,n=e[0]._datasetIndex,i={datasetIndex:n,dataIndex:r};if(this.chartJs.config.type===v.Type.BUBBLE){var o=this.chartJs.config.data.datasets[n].data[r];i.xIndex=o.x,i.yIndex=o.y}else i.xIndex=r;var s=new a.Event;s.data=i,s.originalEvent=t,this.chart._onValueClick(s)}}},{key:"_onHover",value:function(t,e){var r=this;if(this.chartJs.config&&this.chartJs.config.type){var n=this.chartJs.config,a=n.type;if(scout.isOneOf(a,v.Type.LINE,v.Type.BAR,v.Type.RADAR)){var i=!1;this.resetDatasetAfterHover&&(this._adjustColors(n),this.resetDatasetAfterHover=!1,i=!0),e.forEach((function(t){var e=n.data.datasets[t._datasetIndex];scout.isOneOf(e.type||a,v.Type.LINE,v.Type.RADAR)&&(e.backgroundColor=e.hoverBackgroundColor,r.resetDatasetAfterHover=!0,i=!0)})),i&&this.chartJs.update()}}}},{key:"_onHoverPointer",value:function(t,e){this._onHover(t,e),e.length&&!this._isMaxSegmentsExceeded(this.chartJs.config,e[0]._index)?this.$canvas.css("cursor","pointer"):this.$canvas.css("cursor","default")}},{key:"_onLegendClick",value:function(t,e){if(this.chartJs.config&&this.chartJs.config.type){var r,n=this.chartJs.config.type;Y.a.defaults[n]&&Y.a.defaults[n].legend&&(r=Y.a.defaults[n].legend.onClick),(r||Y.a.defaults.global.legend.onClick).call(this.chartJs,t,e),this._onLegendLeave(t,e),this._onLegendHoverPointer(t,e,!0)}}},{key:"_onLegendHover",value:function(t,e,r){var n=e.datasetIndex,a=this.chartJs.config,i=a.type;if(scout.isOneOf(i,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA)&&(n=e.index),!(this.legendHoverDatasets.indexOf(n)>-1)){var o=a.data.datasets[n];((o?o.type:null)||i)===v.Type.LINE&&(o.backgroundColor=o.hoverBackgroundColor,this.chartJs.update()),this._updateHoverStyle(n,!0),r?this.chartJs.render():this.chartJs.render({duration:0}),this.legendHoverDatasets.push(n)}}},{key:"_onLegendHoverPointer",value:function(t,e,r){this._onLegendHover(t,e,r),this.$canvas.css("cursor","pointer")}},{key:"_onLegendLeave",value:function(t,e){var r=e.datasetIndex,n=this.chartJs.config,a=n.type;if(scout.isOneOf(a,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA)&&(r=e.index),!(this.legendHoverDatasets.indexOf(r)<0)){var i=n.data.datasets[r];((i?i.type:null)||a)===v.Type.LINE&&(this._adjustColors(n),this.chartJs.update()),this._updateHoverStyle(r,!1),this.chartJs.render(),this.legendHoverDatasets.splice(this.legendHoverDatasets.indexOf(r),1)}}},{key:"_onLegendLeavePointer",value:function(t,e){this._onLegendLeave(t,e),this.$canvas.css("cursor","default")}},{key:"_updateHoverStyle",value:function(t,e){var r=this.chartJs.config,n=r.type,a=r.data.datasets,i=a?a[t]:null;if(((i?i.type:null)||n)===v.Type.LINE)this.chartJs.updateHoverStyle(this.chartJs.getDatasetMeta(t).data,"point",e);else if(scout.isOneOf(n,v.Type.PIE,v.Type.DOUGHNUT,v.Type.POLAR_AREA)){for(var o=[],s=0;s<a.length;s++)o.push(this.chartJs.getDatasetMeta(s).data[t]);this.chartJs.updateHoverStyle(o,"point",e)}else{var l=this.chartJs.getDatasetMeta(t).data;l&&l.length&&this.chartJs.updateHoverStyle(this.chartJs.getDatasetMeta(t).data,"dataset",e)}}},{key:"_adjustResizeHandler",value:function(t){t&&t.options&&t.options.handleResize&&(t.options.onResize=this._resizeHandler)}},{key:"_onResize",value:function(t,e){t.update(),this._adjustSize(t.config,t.chartArea)}},{key:"_adjustSize",value:function(t,e){this._adjustBubbleSizes(t,e),this._adjustGridMaxMin(t,e)}},{key:"_adjustBubbleSizes",value:function(t,e){if(t.type===v.Type.BUBBLE){var r=t.data.datasets;r.forEach((function(t){return t.data.forEach((function(t){isNaN(t.z)||(t.r=Math.sqrt(t.z))}))}));var n=this._computeMaxMinValue(r,"r",!0),i=n.maxValue,o=n.minValue,s=1,l=0,c=t.bubble?t.bubble.sizeOfLargestBubble:0,u=t.bubble?t.bubble.minBubbleSize:0;if(c){var h=Math.abs(e.right-e.left),d=Math.abs(e.top-e.bottom);c=Math.min(c,Math.floor(Math.min(h,d)/6)),0===i?l=c:u&&c>u&&o/i<u/c?l=u-(s=(c-u)/(i-o))*o:s=c/i}else u&&u>o&&(0===o?l=u:s=u/o);r.forEach((function(t){return t.data.forEach((function(t){a.objects.isNullOrUndefined(t.r)||(t.r=t.r*s+l)}))}))}}},{key:"_computeMaxMinValue",value:function(t,e,r,n,a,i){if(t){for(var o,s,l=0;l<t.length;l++)for(var c=0;c<t[l].data.length;c++){var u=void 0;u=e?t[l].data[c][e]:t[l].data[c],o=isNaN(o)?u:Math.max(u,o),s=isNaN(s)?u:Math.min(u,s)}isNaN(o)&&(o=0),isNaN(s)&&(s=0);var h=0,d=o,f=s;if(r||(n&&Math.sign(s)===Math.sign(o)&&(h=Math.floor(s)),d=this._calculateBoundary(o-h,Math.ceil,Math.floor),f=this._calculateBoundary(s-h,Math.floor,Math.ceil)),a&&i&&i>2*a){var p=(o-s)/(i-2*a)*a;d=Math.max(d,o-h+p),f=Math.min(f,s-h-p)}return r?{maxValue:d,minValue:f}:{maxValue:d+h,minValue:f+h}}}},{key:"_calculateBoundary",value:function(t,e,r){var n=e,a=!1;return t<0&&(a=!0,t*=-1,n=r),t=this._calculateBoundaryPositive(t,n),a&&(t*=-1),t}},{key:"_calculateBoundaryPositive",value:function(t,e){if(!(t>0&&e))return t;var r=Math.floor(Math.log(t)/Math.LN10);return t=r<0?5*e(t*Math.pow(10,Math.abs(r))/5)/Math.pow(10,Math.abs(r)):5*e(t/(5*Math.pow(10,r-1)))*Math.pow(10,r-1)}},{key:"_adjustGridMaxMin",value:function(t,e){if(t&&t.type&&t.options&&t.options.adjustGridMaxMin&&(t.options.scale||t.options.scales)&&e){var r=t.type;if(scout.isOneOf(r,v.Type.BAR,v.Type.BAR_HORIZONTAL,v.Type.LINE,v.Type.POLAR_AREA,v.Type.RADAR,v.Type.BUBBLE)){var n=Math.abs(e.right-e.left),i=Math.abs(e.top-e.bottom),o=Math.max(Math.floor(n/this.minSpaceBetweenXTicks),3),s=Math.max(Math.floor(i/this.minSpaceBetweenYTicks),3),l=this._computeYBoundaries(t,i),c=l.yBoundary,u=l.yBoundaryDiffType;if(t.options.scale)this._adjustScaleMaxMin(t.options.scale,s,c);else{var h=t.options.scales.xAxes,d=t.options.scales.yAxes;if(u?(this._adjustAxes(a.arrays.ensure(d[0]),s,c),this._adjustAxes(a.arrays.ensure(d[1]),s,u)):r===v.Type.BAR_HORIZONTAL?this._adjustAxes(h,o,c):this._adjustAxes(d,s,c),r===v.Type.BUBBLE){var f=this._computeXBoundaryBubble(t,n);this._adjustAxes(h,o,f)}}}}}},{key:"_computeBoundaryBubble",value:function(t,e,r){if(t&&t.type&&t.type===v.Type.BUBBLE&&t.data&&t.options&&t.options.scales&&("x"===e||"y"===e)&&r){var n,a=t.data.datasets,i=t.options.scales[e+"Axes"],o=i&&i.length?i[0]:null,s=o&&o.offset,l=t.options.scales[e+"LabelMap"],c=this._computeMaxMinValue(a,"r",!0).maxValue;return t.options.elements&&t.options.elements.point&&t.options.elements.point.hoverRadius&&(c+=t.options.elements.point.hoverRadius),n=s?this._computeMaxMinValue(a,e,l,!0):this._computeMaxMinValue(a,e,l,!0,c,r),l&&(n.maxValue=Math.ceil(n.maxValue),n.minValue=Math.floor(n.minValue)),n}}},{key:"_computeXBoundaryBubble",value:function(t,e){return this._computeBoundaryBubble(t,"x",e)}},{key:"_computeYBoundaryBubble",value:function(t,e){return this._computeBoundaryBubble(t,"y",e)}},{key:"_computeYBoundaries",value:function(t,e){if(!t||!t.type)return{};var r,n,a=t.type;if(a===v.Type.BUBBLE)r=this._computeYBoundaryBubble(t,e);else{var i=[],o=[];if(t.data&&t.data.datasets&&t.data.datasets.forEach((function(t){t.type&&t.type!==a?o.push(t):i.push(t)})),r=this._computeMaxMinValue(i),i.length&&o.length){n=this._computeMaxMinValue(o);var s=r.maxValue-r.minValue,l=n.maxValue-n.minValue;s&&l&&(s/l>10||l/s>10)&&this._adjustYAxisDiffType(t,i,o)}}return{yBoundary:r,yBoundaryDiffType:n}}},{key:"_adjustYAxisDiffType",value:function(t,e,r){if(t&&t.type&&e&&e.length&&r&&r.length&&t.options&&t.options.scales&&t.options.scales.yAxes&&1===t.options.scales.yAxes.length){var n=t.type,a=t.options.scales,i=a.yAxes[0],o=$.extend(!0,{},i);a.yAxes.push(o),i.id="yAxis",o.id="yAxisDiffType",t.data&&t.data.datasets&&t.data.datasets.length&&t.data.datasets[0].type&&t.data.datasets[0].type!==n?(o.position=v.Position.LEFT,i.position=v.Position.RIGHT,i.gridLines.drawOnChartArea=!1):(i.position=v.Position.LEFT,o.position=v.Position.RIGHT,o.gridLines.drawOnChartArea=!1),i.gridLines.drawBorder=!0,i.gridLines.drawTicks=!0,o.gridLines.drawBorder=!0,o.gridLines.drawTicks=!0;var s=e[0].type||n,l=r[0].type||n,c=this.chart.session.text("ui."+s),u=this.chart.session.text("ui."+l),h=a.scaleLabelByTypeMap?a.scaleLabelByTypeMap[s]:null,d=a.scaleLabelByTypeMap?a.scaleLabelByTypeMap[l]:null;i.scaleLabel.display=!0,i.scaleLabel.labelString=h?h+" ("+c+")":c,o.scaleLabel.display=!0,o.scaleLabel.labelString=d?d+" ("+u+")":u,e.forEach((function(t){t.yAxisID="yAxis"})),r.forEach((function(t){t.yAxisID="yAxisDiffType"}))}}},{key:"_adjustScaleMaxMin",value:function(t,e,r){t.ticks=$.extend(!0,{},t.ticks,{maxTicksLimit:Math.ceil(e/2),stepSize:this.onlyIntegers?1:void 0}),r&&(t.ticks.suggestedMax=r.maxValue,t.ticks.suggestedMin=r.minValue)}},{key:"_adjustAxes",value:function(t,e,r){if(t&&Array.isArray(t)&&t.length)for(var n=0;n<t.length;n++)t[n].ticks=$.extend(!0,{},t[n].ticks,{maxTicksLimit:e,stepSize:this.onlyIntegers?1:void 0}),r&&(t[n].ticks.suggestedMax=r.maxValue,t[n].ticks.suggestedMin=r.minValue)}},{key:"_remove",value:function(t){this.rendered&&(this.$canvas.remove(),this.$canvas=null,this.chartJs.destroy(),this.chartJs=null),it(ht(o.prototype),"_remove",this).call(this,t)}}],r&&at(e.prototype,r),n&&at(e,n),o}(M);function yt(t){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(t)}function vt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function bt(){return bt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=gt(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},bt.apply(this,arguments)}function gt(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=xt(t)););return t}function mt(t,e){return mt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},mt(t,e)}function _t(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=xt(t);if(e){var a=xt(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return Ct(this,r)}}function Ct(t,e){if(e&&("object"===yt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function xt(t){return xt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},xt(t)}dt(pt,"ARROW_LEFT_RIGHT","↔"),dt(pt,"ARROW_UP_DOWN","↕");var kt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&mt(t,e)}(o,t);var e,r,n,i=_t(o);function o(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).animationTriggered=!1,e.r,e.segmentSelectorForAnimation=".fulfillment-chart",e.suppressLegendBox=!0;var r={fulfillment:{startValue:void 0}};return t.config=j.a.extend(!0,{},r,t.config),e}return e=o,(r=[{key:"_validate",value:function(){var t=this.chart.data.chartValueGroups;return 2===t.length&&1===t[0].values.length&&1===t[1].values.length}},{key:"_renderInternal",value:function(){var t=this.chart.data,e=t.chartValueGroups[0].values[0],r=t.chartValueGroups[1].values[0];this.fullR=Math.min(this.chartBox.height,this.chartBox.width)/2-2,this._renderInnerCircle(),this._renderPercentage(e,r)}},{key:"_renderPercentage",value:function(t,e){var r="fulfillment-chart",n=this.chart.data.chartValueGroups[0].colorHexValue,i=this.chart.data.chartValueGroups[0].cssClass;this.chart.config.options.autoColor?r+=" auto-color":i&&(r+=" "+i);var o=a.scout.nvl(this.chart.config.fulfillment.startValue,0),s=0,l=0;e&&(s=Math.min(t/e,.999999),l=Math.min(o/e,.999999)),this.r=this.fullR;var c=this,u=this.$svg.appendSVG("path",r).data("animation-start",0).data("animation-end",s),h=this.fullR/8*6.7;this._renderCirclePath("fulfillment-chart-inner-circle-transparent","InnerCircle3",h).css("fill",this.firstOpaqueBackgroundColor);var d=e?Math.round(t/e*100):0,f=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(d+"%");this.chart.config.options.clickable&&u.on("click",this._createClickObject(null,null),this.chart._onValueClick.bind(this.chart)),this.chart.config.options.autoColor||i||u.attr("fill",n),this.animationDuration?(u.attr("d",this.pathSegment(0,l)).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval((function(t,e){var r=j()(this),n=r.data("animation-start"),a=r.data("animation-end");r.attr("d",c.pathSegment(n*e.pos,l+(a-l)*e.pos))}),this.animationDuration)),f.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)):u.attr("d",this.pathSegment(0,s))}},{key:"pathSegment",value:function(t,e){var r=2*t*Math.PI,n=2*e*Math.PI,a="";return a+="M"+(this.chartBox.mX()+this.r*Math.sin(r))+","+(this.chartBox.mY()-this.r*Math.cos(r)),a+="A"+this.r+", "+this.r,a+=e-t<.5?" 0 0,1 ":" 0 1,1 ",a+=this.chartBox.mX()+this.r*Math.sin(n)+","+(this.chartBox.mY()-this.r*Math.cos(n)),a+="L"+this.chartBox.mX()+","+this.chartBox.mY()+"Z"}},{key:"_renderCirclePath",value:function(t,e,r){var n=this.chart.data.chartValueGroups[0].cssClass,a=this.chart.data.chartValueGroups[1].colorHexValue;this.chart.config.options.autoColor?t+=" auto-color":n&&(t+=" "+n);var i=2*r,o=this.$svg.appendSVG("path",t).attr("id",e).attr("d","M "+this.chartBox.mX()+" "+this.chartBox.mY()+" m 0, "+-r+" a "+r+","+r+" 0 1, 1 0,"+i+" a "+r+","+r+" 0 1, 1 0,"+-i);return this.chart.config.options.autoColor||n||o.attr("fill",a).attr("stroke",a),o}},{key:"_renderInnerCircle",value:function(){var t=this.fullR/8*7.5,e=this.fullR/8*7.2;this._renderCirclePath("fulfillment-chart-inner-circle","InnerCircle",t),this._renderCirclePath("fulfillment-chart-inner-circle-transparent","InnerCircle2",e).css("fill",this.firstOpaqueBackgroundColor)}},{key:"shouldAnimateRemoveOnUpdate",value:function(t){var e=a.objects.optProperty(this.chart,"config","fulfillment","startValue");return!!a.objects.isNullOrUndefined(e)&&bt(xt(o.prototype),"shouldAnimateRemoveOnUpdate",this).call(this,t)}},{key:"_removeAnimated",value:function(t){var e=this;if(!this.animationTriggered){var r=this;this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval((function(t,e){var n=j()(this),a=n.data("animation-start"),i=n.data("animation-end");n.attr("d",r.pathSegment(a*(1-e.pos),i*(1-e.pos)))}))).promise().done((function(){e._remove(t),e.animationTriggered=!1}))}}}])&&vt(e.prototype,r),n&&vt(e,n),o}(J);function Tt(t){return Tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tt(t)}function At(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ot(t,e){return Ot=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ot(t,e)}function Rt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Bt(t);if(e){var a=Bt(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return St(this,r)}}function St(t,e){if(e&&("object"===Tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Bt(t){return Bt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Bt(t)}function Lt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var wt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ot(t,e)}(o,t);var e,r,n,i=Rt(o);function o(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).segmentSelectorForAnimation=".pointer",e.suppressLegendBox=!0;var r={speedo:{greenAreaPosition:void 0}};return t.config=$.extend(!0,{},r,t.config),e}return e=o,(r=[{key:"_validate",value:function(){var t=this.chart.data,e=this.chart.config;return!(!t||!e||t.axes.length>0||1!==t.chartValueGroups.length||3!==t.chartValueGroups[0].values.length||void 0===e.speedo.greenAreaPosition)}},{key:"_renderInternal",value:function(){var t=this.chart.data,e=t.chartValueGroups[0].values[0],r=t.chartValueGroups[0].values[2],n=t.chartValueGroups[0].values[1];this.r=.7*Math.min(this.chartBox.height,this.chartBox.width/2),this.scaleWeight=.27*this.r,this.my=this.chartBox.yOffset+this.chartBox.height-(this.chartBox.height-1.12*this.r)/2,this.parts=this.chart.config.speedo.greenAreaPosition===o.Position.CENTER?o.NUM_PARTS_GREEN_CENTER:o.NUM_PARTS_GREEN_EDGE,this.numSegmentsPerPart=this.parts===o.NUM_PARTS_GREEN_CENTER?5:8,this.$filledParts=[];var a=this.parts*this.numSegmentsPerPart,i=a-1;this.segmentWidth=(o.ARC_RANGE-i*o.SEGMENT_GAP)/a,this.widthOfSegmentWithGap=this.segmentWidth+o.SEGMENT_GAP;for(var s=this._limitValue((n-e)/(r-e),1),l=Math.round(s*i),c=this._getPercentageValueOfSegment(l%this.numSegmentsPerPart,this._getPartForValue(s)),u=0;u<this.parts;u++)this._renderCirclePart(u);this._renderPointer(c),this._renderLegend(e,n,r,t.chartValueGroups[0].groupName),this.$svg.addClass("speedo-chart-svg"),this.chart.config.options.clickable&&this.$svg.on("click",this._createClickObject(null,null),this.chart._onValueClick.bind(this.chart))}},{key:"_limitValue",value:function(t,e){return t=Math.max(t,0),t=Math.min(t,e)}},{key:"_getPercentageValueOfSegment",value:function(t,e){var r=this._calcSegmentPos(t,e),n=r.from-o.ARC_MIN+(r.to-r.from)/2;return this._limitValue(n/o.ARC_RANGE,1)}},{key:"_renderPointer",value:function(t){if(this.$pointer=this.$svg.appendSVG("path","pointer").attr("d",this._pathPointer(0)).attr("data-end",t).attr("stroke-width",this.scaleWeight/6+"px").attr("fill","none"),this.animationDuration){var e=this;this.$pointer.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval((function(t,r){var n=this.getAttribute("data-end")*r.pos;e._updatePointer(n),e._updatePartsFill(n)}),this.animationDuration))}else this._updatePointer(t),this._updatePartsFill(t)}},{key:"_renderSegment",value:function(t,e,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(t,e))}},{key:"_renderCirclePart",value:function(t){for(var e=this._getColorForPart(t),r=0;r<this.numSegmentsPerPart;r++){var n=this._calcSegmentPos(r,t);this._renderSegment(n.from,n.to,e)}this.$filledParts.push(this._renderSegment(o.ARC_MIN,o.ARC_MIN,e))}},{key:"_renderLegend",value:function(t,e,r,n){var a=.8*this.scaleWeight,i=this.my+5,o=i+.8*a,s=this.chartBox.mX()-5,l=i,c=-1,u=t?this._formatValue(t):0,h=e?this._formatValue(e):0,d=r?this._formatValue(r):0;if(this.chart.config.options.tooltips.enabled){var f=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()-this.r).attr("y",o).text(u).attr("style","font-size: "+a+"px; text-anchor: middle"),p=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()+this.r).attr("y",o).text(d).attr("style","font-size: "+a+"px; text-anchor: middle"),y=function(){this.$svg.append(f),this.$svg.append(p)}.bind(this),v=function(){f.detach(),p.detach()};v(),this.$svg.mouseenter(y).mouseleave(v)}this.chart.config.options.legend.display&&this._renderLineLabel(s+5,l+5*c,h,"",!1).addClass("speedo-chart-label").attr("style","font-size: "+1.55*this.scaleWeight+"px;")}},{key:"_getPartForValue",value:function(t){var e=Math.floor(t*this.parts);return this._limitValue(e,this.parts-1)}},{key:"_formatValue",value:function(t){if(t<o.TEN_THOUSAND)return this.session.locale.decimalFormat.format(t);if(t<o.ONE_MILLION)return Math.floor(t/o.ONE_THOUSAND)+"k";var e=t/o.ONE_MILLION;return e=a.numbers.round(e,a.RoundingMode.HALF_UP,2),this.session.locale.decimalFormat.format(e)+"M"}},{key:"_updatePointer",value:function(t){this.$pointer.attr("d",this._pathPointer(t)).removeClass("red yellow light-green dark-green").addClass(this._getColorForPart(this._getPartForValue(t)))}},{key:"_updatePartsFill",value:function(t){for(var e,r,n=0;n<this.$filledParts.length;n++)e=this._calcSegmentPos(0,n,this.segmentWidth).from,(n+1)/this.parts<t?r=this._calcSegmentPos(this.numSegmentsPerPart-1,n,this.segmentWidth).to:n/this.parts>t?(e=o.ARC_MIN,r=o.ARC_MIN):r=o.ARC_RANGE*t-o.ARC_MAX,this.$filledParts[n].attr("d",this._pathSegment(e,r))}},{key:"_calcSegmentPos",value:function(t,e){var r={from:0,to:0},n=t+e*this.numSegmentsPerPart;return r.from=n*this.widthOfSegmentWithGap-o.ARC_MAX,r.to=r.from+this.segmentWidth,r}},{key:"_getColorForPart",value:function(t){switch(this.chart.config.speedo.greenAreaPosition){case o.Position.LEFT:if(0===t)return"dark-green";if(1===t)return"light-green";if(2===t)return"yellow";if(3===t)return"red";break;case o.Position.RIGHT:if(0===t)return"red";if(1===t)return"yellow";if(2===t)return"light-green";if(3===t)return"dark-green";break;case o.Position.CENTER:if(0===t)return"red";if(1===t)return"yellow";if(2===t)return"light-green";if(3===t)return"dark-green";if(4===t)return"light-green";if(5===t)return"yellow";if(6===t)return"red"}}},{key:"_pathSegment",value:function(t,e){var r=2*t*Math.PI,n=2*e*Math.PI,a="";return a+="M "+(this.chartBox.mX()+this.r*Math.sin(r))+" "+(this.my-this.r*Math.cos(r))+" ",a+="A "+this.r+" "+this.r+" ",a+="0 "+(e-t<.5?"0":"1")+" 1 ",a+=this.chartBox.mX()+this.r*Math.sin(n)+" "+(this.my-this.r*Math.cos(n))}},{key:"_pathPointer",value:function(t){var e=2*(o.ARC_RANGE*t-o.ARC_MAX)*Math.PI,r=this.r-1.4*this.scaleWeight,n=this.r+1.37*this.scaleWeight,a="";return a+="M "+(this.chartBox.mX()+n*Math.sin(e))+" "+(this.my-n*Math.cos(e))+" ",a+="L "+(this.chartBox.mX()+r*Math.sin(e))+" "+(this.my-r*Math.cos(e))+" ",a+="Z"}},{key:"_removeAnimated",value:function(t){var e=this;if(!this.animationTriggered){var r=this;this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval((function(t,e){var n=this.getAttribute("data-end")*(1-e.pos);r._updatePointer(n),r._updatePartsFill(n)}))).promise().done((function(){e._remove(t),e.animationTriggered=!1}))}}}])&&At(e.prototype,r),n&&At(e,n),o}(J);function Et(t){return Et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Et(t)}function Pt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Mt(t,e){return Mt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Mt(t,e)}function It(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Dt(t);if(e){var a=Dt(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return jt(this,r)}}function jt(t,e){if(e&&("object"===Et(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Dt(t){return Dt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Dt(t)}Lt(wt,"Position",{LEFT:"left",CENTER:"center",RIGHT:"right"}),Lt(wt,"NUM_PARTS_GREEN_CENTER",7),Lt(wt,"NUM_PARTS_GREEN_EDGE",4),Lt(wt,"ONE_THOUSAND",1e3),Lt(wt,"TEN_THOUSAND",1e4),Lt(wt,"ONE_MILLION",1e6),Lt(wt,"ARC_MIN",-.25),Lt(wt,"ARC_MAX",.25),Lt(wt,"ARC_RANGE",wt.ARC_MAX-wt.ARC_MIN),Lt(wt,"SEGMENT_GAP",.0103);var Gt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Mt(t,e)}(o,t);var e,r,n,i=It(o);function o(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).segmentSelectorForAnimation=".salesfunnel-chart-bar",e.widthThresholdMedium=400,e.widthThresholdSmall=200,e.barDeltaPercentage=.95,e.lastBarAdditionalPercentage=.7,e.lastBarMinWidthPercentage=.4,e.suppressLegendBox=!0;var r={salesfunnel:{normalized:void 0,calcConversionRate:void 0}};return t.config=j.a.extend(!0,{},r,t.config),e}return e=o,(r=[{key:"_validate",value:function(){var t=this.chart.data,e=this.chart.config;return!(!t||!e||t.axes.length!==t.chartValueGroups.length||0===t.chartValueGroups.length||0===t.chartValueGroups[0].values.length||void 0===e.salesfunnel.normalized||void 0===e.salesfunnel.calcConversionRate)}},{key:"_renderInternal",value:function(){var t=this.chart.data,e=t.chartValueGroups.length;this.conversionRateWidth=this._dynamicConversionRateWidth(),this.dataAnalyzeResult=this._analyzeData(t.chartValueGroups),this.paddingBetweenLabel=20,this.barHeight=this.chartBox.height/e,this.barAreaHeight=this.barHeight*e,this.barAreaWidth=this.chartBox.width-this.dataAnalyzeResult.maxLengthFirstValueRow-this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount-this.dataAnalyzeResult.maxLengthSecondValueRow-this.conversionRateWidth,this.centerX=this.barAreaWidth/2,this.chart.config.salesfunnel.normalized?this._renderBarsNormalized(t.chartValueGroups):this._renderBarsAccordingToValues(t.chartValueGroups),this._addClipping("salesfunnel-chart-bar")}},{key:"_renderBarsNormalized",value:function(t){var e=t.length,r=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*(this.dataAnalyzeResult.labelCount+1),n=this.barAreaWidth*(1-this.barDeltaPercentage),a=this.barAreaWidth*this.lastBarMinWidthPercentage/this.lastBarAdditionalPercentage;n=Math.min(n,(this.barAreaWidth-a)/(e-1));for(var i=0;i<e;i++){var o=this.barAreaWidth-i*n,s=t[i].groupName,l=this.barAreaWidth-(i+1)*n,c=i*this.barHeight,u={xStart:this.centerX,yStart:c,rect:!0,width:o,widthBottom:l,cssClass:"salesfunnel-chart-bar",fill:t[i].colorHexValue,label:t[i].groupName,clickObject:this._createClickObject(null,i)};this.chart.config.options.autoColor?u.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[i].cssClass&&(u.cssClass+=" "+this.chart.data.chartValueGroups[i].cssClass),i===e-1&&(u.width=u.width*this.lastBarAdditionalPercentage,u.widthBottom=u.widthBottom*this.lastBarAdditionalPercentage),this._renderPolygon(u),this._renderLabel(t[i].values[0],!1,i),this._renderBarLabel(s,i,u.widthBottom);var h=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;t[i].values.length>1&&(this._renderLabel(t[i].values[1],!0,i),h+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),i>0&&(this._renderLabelSeparatorLine(c,h),this.chart.config.salesfunnel.calcConversionRate&&this._renderConversionRate(i,r,this._calcConversionRate(t[i-1].values[0],t[i].values[0])))}}},{key:"_renderLabel",value:function(t,e,r){if(null!==t){var n=r*this.barHeight+this.barHeight/2,a=this.dataAnalyzeResult.maxLengthFirstValueRow+(e?this.dataAnalyzeResult.maxLengthSecondValueRow:0),i=e?2:1,o=this.barAreaWidth+a+i*this.paddingBetweenLabel,s=this._dynamicCssClass("salesfunnel-label"),l=this.$svg.appendSVG("text",s).attr("x",o).attr("y",n).text(this.session.locale.decimalFormat.format(t));if(this.animationDuration&&l.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),this.chart.config.options.tooltips.enabled&&this.chart.data.axes.length>0){var c=this.chart.data.axes[r][e?1:0].label,u=this._measureText(t,s);this._renderWireLabels(c,l,o-u.width/2,n-u.height)}}}},{key:"_renderWireLabels",value:function(t,e,r,n){var a={x1:r,x2:r-10,y1:n,y2:n-10,v:-1,h:-1,autoPosition:!0,posFunc:function(t,e){return a.y2-e<0&&(a.v=1,a.y1=a.y1+1.5*e,a.y2=a.y1+10),a}},i=this._renderWireLegend(t,a,"line-chart-wire-label","wire-label-line-white",!1),o=i.attachFunc.bind(i),s=i.detachFunc.bind(i);i.detachFunc(),e.mouseenter(o).mouseleave(s)}},{key:"_renderBarLabel",value:function(t,e,r){var n=e*this.barHeight+this.barHeight/2,a=this.centerX,i=this._dynamicCssClass("salesfunnel-bar-label");this._renderLineLabel(a,n,t,i,!0)}},{key:"_renderConversionRate",value:function(t,e,r){if(void 0!==r){var n=t*this.barHeight,a=this._dynamicCssClass("salesfunnel-conversionrate-label"),i=this.$svg.appendSVG("text",a).attr("x",e).attr("y",n).text("↓ "+r+"%");this.animationDuration&&i.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}}},{key:"_renderPolygon",value:function(t){var e=this,r=this._calcPolygonPoints(!0,this.animationDuration?0:1,t.xStart,t.yStart,t.width,t.widthBottom,this.barHeight-1),n=this.$svg.appendSVG("polygon",t.cssClass,"",t.id).attr("points",r).attr("opacity",t.opacity).data("xStart",t.xStart).data("yStart",t.yStart).data("widthBar",t.width).data("widthBottom",t.widthBottom).data("heightBar",this.barHeight);return!this.chart.config.options.autoColor&&t.fill&&n.attr("fill",t.fill),n.css("stroke",this.firstOpaqueBackgroundColor),this.animationDuration&&n.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval((function(t,r){var n=j()(this),a=n.data("xStart"),i=n.data("yStart"),o=n.data("widthBar"),s=n.data("heightBar"),l=n.data("widthBottom");n.attr("points",e._calcPolygonPoints(!0,r.pos,a,i,o,l,s))}),this.animationDuration)),this.chart.config.options.clickable&&n.on("click",t.clickObject,this.chart._onValueClick.bind(this.chart)),t.fill&&n.attr("fill",t.fill),n}},{key:"_calcPolygonPoints",value:function(t,e,r,n,a,i,o){var s=0,l=0;t?(s=a/2*e,l=i/2*e):(s=a/2-a/2*e,l=i/2-i/2*e);var c=n+o;return r-s+","+n+" "+(r+s)+","+n+" "+(r+l)+","+c+" "+(r-l)+","+c+" "}},{key:"_renderBarsAccordingToValues",value:function(t){for(var e=this.dataAnalyzeResult.maxValue?.8*this.barAreaWidth/this.dataAnalyzeResult.maxValue:0,r=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount+2*this.paddingBetweenLabel,n=t.length,a=0;a<n;a++){var i=t[a].values[0]*e+.2*this.barAreaWidth,o=t[a].groupName,s=a*this.barHeight,l={xStart:this.centerX,yStart:s,rect:!0,width:i,widthBottom:i,cssClass:"salesfunnel-chart-bar",fill:t[a].colorHexValue,label:t[a].groupName,clickObject:this._createClickObject(null,a)};this.chart.config.options.autoColor?l.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[a].cssClass&&(l.cssClass+=" "+this.chart.data.chartValueGroups[a].cssClass),this._renderPolygon(l),this._renderLabel(t[a].values[0],!1,a),this._renderBarLabel(o,a,l.widthBottom);var c=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;t[a].values.length>1&&(this._renderLabel(t[a].values[1],!0,a),c+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),a>0&&(this._renderLabelSeparatorLine(s,c),this.chart.config.salesfunnel.calcConversionRate&&this._renderConversionRate(a,r,this._calcConversionRate(t[a-1].values[0],t[a].values[0])))}}},{key:"_renderLabelSeparatorLine",value:function(t,e){var r=this.$svg.appendSVG("line","label-separator").attr("x1",this.barAreaWidth+this.paddingBetweenLabel).attr("y1",t).attr("x2",this.barAreaWidth+e).attr("y2",t);this.animationDuration&&r.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}},{key:"_calcConversionRate",value:function(t,e){var r=0;return 0===t?r=void 0:e!==t&&(r=Math.round(e/t*100)),r}},{key:"_analyzeData",value:function(t){for(var e={labelCount:0,maxValue:null,maxLengthFirstValueRow:0,maxLengthSecondValueRow:0},r=this._dynamicCssClass("salesfunnel-label"),n=0;n<t.length;n++){var a=t[n];e.labelCount=Math.max(e.labelCount,a.values.length),a.values.length>0&&a.values[0]&&(null===e.maxValue?e.maxValue=a.values[0]:e.maxValue=Math.max(e.maxValue,a.values[0]),e.maxLengthFirstValueRow=Math.max(e.maxLengthFirstValueRow,this._measureText(this.session.locale.decimalFormat.format(a.values[0]),r).width)),a.values.length>1&&a.values[1]&&(e.maxLengthSecondValueRow=Math.max(e.maxLengthSecondValueRow,this._measureText(this.session.locale.decimalFormat.format(a.values[1]),r).width))}return e}},{key:"_removeAnimated",value:function(t){var e=this;if(!this.animationTriggered){this.animationTriggered=!0;var r=this;this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval((function(t,e){var n=j()(this),a=n.data("xStart"),i=n.data("yStart"),o=n.data("widthBar"),s=n.data("heightBar"),l=n.data("widthBottom");n.attr("points",r._calcPolygonPoints(!1,e.pos,a,i,o,l,s))}))).promise().done((function(){e._remove(t),e.animationTriggered=!1}))}}},{key:"_dynamicCssClass",value:function(t){var e="";return this.chartBox.width<=this.widthThresholdSmall?e="small":this.chartBox.width<=this.widthThresholdMedium&&(e="medium"),a.strings.join(" ",t,e)}},{key:"_dynamicConversionRateWidth",value:function(){return this.chart.config.salesfunnel.calcConversionRate?this.chartBox.width<=this.widthThresholdSmall?60:this.chartBox.width<=this.widthThresholdMedium?80:100:0}}])&&Pt(e.prototype,r),n&&Pt(e,n),o}(J);function Nt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Ht=function(){function t(e,r,n,a,i,o,s,l,c,u,h,d,f,p){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),0===i&&0===l&&0===c&&0===h&&(i=1),0===o&&0===l&&0===u&&0===h&&(o=1),0===s&&0===c&&0===u&&0===h&&(s=1),this.helper=e,this.venn1=r,this.venn2=n,this.venn3=a,this.u=i,this.v=o,this.w=s,this.uv=l,this.uw=c,this.vw=u,this.uvw=h,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}var e,r,n;return e=t,(r=[{key:"start",value:function(t){this.callback=t,setTimeout(this._next.bind(this,0))}},{key:"cancel",value:function(){this.cancelled=!0}},{key:"_end",value:function(){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()}},{key:"_next",value:function(t){this.cancelled||this._iteration(t),this.cancelled||((t+=this.alphaStep)<Math.PI?setTimeout(this._next.bind(this,t)):this._end())}},{key:"_iteration",value:function(t){var e=this.maxD,r=this.dStep,n=this.helper.minR,i=this.rStep,o=this.helper.total,s=this.venn1.x,l=this.venn1.y,c=this.venn1.r,u=this.venn2.x,h=this.venn2.y,d=this.venn2.r,f=this.venn3.r,p=this.u,y=this.v,v=this.w,b=this.uv,g=this.uw,m=this.vw,_=this.uvw,C=this.alphaBest,x=this.dBest,k=this.rBest,T=this.errorBest,A=1;a.Device.get().isInternetExplorer()&&(A=5);for(var O=0;O<e;O+=r)for(var R=s+O*Math.cos(t),S=l-O*Math.sin(t),B=Math.max(n,.75*f);B<=1.25*f;B+=i){for(var L=Math.min(s-c,u-d,R-B),w=Math.max(s+c,u+d,R+B),E=Math.min(l-c,h-d,S-B),P=Math.max(l+c,h+d,S+B),M=(w-L)/100*A,I=(P-E)/100*A,j=0,D=0,G=0,N=0,H=0,V=0,$=0,F=L;F<w;F+=M)for(var U=E;U<P;U+=I){var W=(F-s)*(F-s)+(U-l)*(U-l)<c*c,z=(F-u)*(F-u)+(U-h)*(U-h)<d*d,J=(F-R)*(F-R)+(U-S)*(U-S)<B*B;W&&z&&J?$++:W&&z&&!J?N++:!W||z||J?W||!z||J?W&&!z&&J?H++:!W&&z&&J?V++:W||z||!J||G++:D++:j++}var X=j+D+G+N+H+V+$,Y=O/e;Y+=this._error(_,o,$,X),Y+=this._error(b,o,N,X),Y+=this._error(g,o,H,X),Y+=this._error(m,o,V,X),Y+=this._error(p,o,j,X),Y+=this._error(y,o,D,X),Y+=this._error(v,o,G,X),(0===t||Y<T)&&(C=t,x=O,k=B,T=Y)}this.alphaBest=C,this.dBest=x,this.rBest=k,this.errorBest=T}},{key:"_error",value:function(t,e,r,n){return 0===t&&0!==r||0!==t&&0===r?1e3:100*Math.abs(t/e-r/n)}}])&&Nt(e.prototype,r),n&&Nt(e,n),t}();function Vt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var $t=function(){function t(e,r,n,a){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.distR=e,this.maxR=r,this.minR=n,this.total=a}var e,r,n;return e=t,(r=[{key:"findBalance2",value:function(t,e){var r=(t.r*t.x+e.r*e.x)/(t.r+e.r),n=(t.r*t.y+e.r*e.y)/(t.r+e.r);t.x=t.x-r,e.x=e.x-r,t.y=t.y-n,e.y=e.y-n}},{key:"findBalance3",value:function(t,e,r){var n=(t.r*t.x+e.r*e.x+r.r*r.x)/(t.r+e.r+r.r),a=(t.r*t.y+e.r*e.y+r.r*r.y)/(t.r+e.r+r.r);t.x=t.x-n,e.x=e.x-n,r.x=r.x-n,t.y=t.y-a,e.y=e.y-a,r.y=r.y-a}},{key:"calcR",value:function(t,e){return-1===t?this.maxR*e:Math.max(this.minR,Math.sqrt(t/this.total)*this.maxR*e)}},{key:"calcD",value:function(t,e,r,n,a,i){var o;if(0===a)o=t.r+e.r+2*this.distR;else if(0===r&&0===n)o=0;else if(0===r)(o=Math.max(0,e.r-t.r-this.distR))<1.5*this.distR&&i&&(o=1.5*this.distR,t.r=e.r-o);else if(0===n)(o=Math.max(0,t.r-e.r-this.distR))<1.5*this.distR&&i&&(o=1.5*this.distR,e.r=t.r-o);else{var s=Math.min(t.r,e.r),l=Math.max(t.r,e.r);o=Math.min(r,n)/(Math.min(r,n)+a)*2*s-s+l,o=Math.max(3*this.distR,o),o=Math.min(s+l-3*this.distR,o),o=Math.max(l-s+3*this.distR,o)}return o}}])&&Vt(e.prototype,r),n&&Vt(e,n),t}();function Ft(t){return Ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ft(t)}function Ut(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wt(){return Wt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=zt(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},Wt.apply(this,arguments)}function zt(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Zt(t)););return t}function Jt(t,e){return Jt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Jt(t,e)}function Xt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Zt(t);if(e){var a=Zt(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return Yt(this,r)}}function Yt(t,e){if(e&&("object"===Ft(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Zt(t){return Zt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Zt(t)}var qt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Jt(t,e)}(i,t);var e,r,n,a=Xt(i);function i(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=a.call(this,t)).animationTriggered=!1,e.suppressLegendBox=!0;var r={venn:{numberOfCircles:void 0}};return t.config=j.a.extend(!0,{},r,t.config),e}return e=i,(r=[{key:"_validate",value:function(){var t=this.chart.data;return!(!t||0!==t.axes.length||0===t.chartValueGroups.length||0===t.chartValueGroups[0].values.length)}},{key:"_renderInternal",value:function(){var t=this;if(this.centerX=this.width/2,this.centerY=this.height/2,0===this.centerX||0===this.centerY)return!1;this.setLoading(!0),this.data=this.chart.data.chartValueGroups,this.numberOfCircles=this.chart.config.venn.numberOfCircles;var e=Math.min(this.centerX,this.centerY),r=e/15,n=this.data.reduce((function(t,e){return t+parseFloat(e.values[0])}),1);this.vennCircleHelper=new $t(10,e,r,n),this.numberOfCircles>0&&(this.$v1=this._createCircle(0,this.data[0].colorHexValue,this.data[0].cssClass),this.vennNumber1=new Qt(this.$v1),this.vennReal1=new Qt(this.$v1)),this.numberOfCircles>1&&(this.$v2=this._createCircle(1,this.data[1].colorHexValue,this.data[1].cssClass),this.vennNumber2=new Qt(this.$v2),this.vennReal2=new Qt(this.$v2)),this.numberOfCircles>2&&(this.$v3=this._createCircle(2,this.data[2].colorHexValue,this.data[2].cssClass),this.vennNumber3=new Qt(this.$v3),this.vennReal3=new Qt(this.$v3));var a=function(){this.readyToDraw=!0,this.setLoading(!1),this.$svg.isAttached()&&(this.readyToDraw=!1,this._draw(!0,!0))}.bind(this);this.readyToDraw=!1,1===this.numberOfCircles?(this._calc1(this.vennNumber1),this._calc1(this.vennReal1),a()):2===this.numberOfCircles?(this._calc2(this.vennNumber1,this.vennNumber2,!1),this._calc2(this.vennReal1,this.vennReal2,!0),a()):3===this.numberOfCircles&&this._calc3(this.vennNumber1,this.vennNumber2,this.vennNumber3,!1,(function(){(t.rendering||t.rendered)&&t._calc3(t.vennReal1,t.vennReal2,t.vennReal3,!0,a)}))}},{key:"checkCompletlyRendered",value:function(){this.readyToDraw?this._draw(!1,!0):Wt(Zt(i.prototype),"checkCompletlyRendered",this).call(this)}},{key:"remove",value:function(t,e){this._cancelAsync3Calculator(),this.setLoading(!1),Wt(Zt(i.prototype),"remove",this).call(this,t,e)}},{key:"setLoading",value:function(t){t&&!this.$loadingIndicator&&this.chart&&this.chart.rendered?this.$loadingIndicator=this.chart.$container.appendDiv("venn-chart-loading-indicator"):!t&&this.$loadingIndicator&&(this.$loadingIndicator.remove(),this.$loadingIndicator=null)}},{key:"_calc1",value:function(t){var e=this.data[0].values[0];t.r=e>0?this.vennCircleHelper.calcR(e,.8):this.vennCircleHelper.calcR(e,0),t.x=0,t.y=0,t.setLegend(this.data[0].groupName,1,-1),t.addLabel(e,t.x,t.y)}},{key:"_calc2",value:function(t,e,r){var n,a=this.data[0].values[0],i=this.data[1].values[0],o=this.data[2].values[0];r?(t.r=this.vennCircleHelper.calcR(a+o,.8),e.r=this.vennCircleHelper.calcR(i+o,.8),n=this.vennCircleHelper.calcD(t,e,a,i,o,!0),t.x=0,e.x=n):(t.r=e.r=this.vennCircleHelper.calcR(-1,.7),t.x=.6*-t.r,e.x=.6*e.r),t.y=0,e.y=0,this.vennCircleHelper.findBalance2(t,e),t.setLegend(this.data[0].groupName,-1,-1),e.setLegend(this.data[1].groupName,1,-1),r?0===o?(t.addLabel(a,t.x,t.y),e.addLabel(i,e.x,e.y)):0===a&&0===i?t.addLabel(o,t.x,t.y):0===a?(e.addLabel(o,t.x,t.y),e.addLabel(i,e.x-(n-e.r-t.r)/2,e.y),t.legendR=e.r-n):0===i?(t.addLabel(o,e.x,e.y),t.addLabel(a,t.x+(n-e.r-t.r)/2,t.y),e.legendR=t.r-n):(t.addLabel(a,t.x+(n-e.r-t.r)/2,t.y),t.addLabel(i,e.x-(n-e.r-t.r)/2,e.y),e.addLabel(o,t.x+t.r+(n-e.r-t.r)/2,t.y)):(t.addLabel(a,.9*-t.r,0),t.addLabel(i,.9*t.r,0),e.addLabel(o,0,0))}},{key:"_calc3",value:function(t,e,r,n,a){var i,o,s,l=this,c=this.data[0].values[0],u=this.data[1].values[0],h=this.data[2].values[0],d=this.data[3].values[0],f=this.data[4].values[0],p=this.data[5].values[0],y=this.data[6].values[0];n?(t.r=this.vennCircleHelper.calcR(c+d+f+y,.55),e.r=this.vennCircleHelper.calcR(u+d+p+y,.55),r.r=this.vennCircleHelper.calcR(h+f+p+y,.55),i=this.vennCircleHelper.calcD(t,e,c+f,u+p,d+y,!0),o=this.vennCircleHelper.calcD(t,r,c+d,h+p,d+y,!1),s=this.vennCircleHelper.calcD(e,r,u+d,h+f,d+y,!1),t.x=0,e.x=i,r.x=o,t.y=0,e.y=0,r.y=0,this._cancelAsync3Calculator(),this.async3Calculator=new Ht(this.vennCircleHelper,t,e,r,c,u,h,d,f,p,y,i,o,s),this.async3Calculator.start((function(){l.async3Calculator=null,l.vennCircleHelper.findBalance3(t,e,r),t.setLegend(l.data[0].groupName,-1,1),e.setLegend(l.data[1].groupName,1,1),r.setLegend(l.data[2].groupName,1,-1),a()}))):(t.r=e.r=r.r=this.vennCircleHelper.calcR(-1,.55),t.x=.73*-t.r,e.x=.73*e.r,r.x=0,t.y=.58*t.r,e.y=.58*e.r,r.y=.58*-r.r,t.setLegend(this.data[0].groupName,-1,1),e.setLegend(this.data[1].groupName,1,1),r.setLegend(this.data[2].groupName,1,-1),t.addLabel(c,-t.r,.76*t.r),e.addLabel(u,t.r,.76*t.r),r.addLabel(h,0,.82*-t.r),t.addLabel(d,0,.76*t.r),t.addLabel(f,.49*-t.r,.05*-t.r),e.addLabel(p,.49*t.r,.05*-t.r),t.addLabel(y,0,.22*t.r),a())}},{key:"_cancelAsync3Calculator",value:function(){this.async3Calculator&&(this.async3Calculator.cancel(),this.async3Calculator=null)}},{key:"_draw",value:function(t,e){if((this.rendered||this.rendering)&&!this.animationTriggered){this.animationTriggered=!0;var 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}));var n=[];this.numberOfCircles>0&&n.push(e?this.vennReal1:this.vennNumber1),this.numberOfCircles>1&&n.push(e?this.vennReal2:this.vennNumber2),this.numberOfCircles>2&&n.push(e?this.vennReal3:this.vennNumber3);for(var a=0;a<n.length;a++){var i=n[a];this._updateVenn(i,t);for(var o=0;o<i.labels.length;o++){var s=i.labels[o];this._drawLabel(s.text,s.x,s.y,t)}}}}},{key:"_createCircle",value:function(t,e,r){var n=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?n.addClass("auto-color color0"):r?n.addClass(r):n.attr("fill",e),this.chart.config.options.clickable&&n.on("click",this._createClickObject(null,t),this.chart._onValueClick.bind(this.chart)),n}},{key:"_updateVenn",value:function(t,e){t.$circle.animateSVG("cx",this.centerX+t.x,e?this.animationDuration:0,null,!0).animateSVG("cy",this.centerY+t.y,e?this.animationDuration:0,null,!0).animateSVG("r",t.r,e?this.animationDuration:0,null,!0);var r=this.vennCircleHelper.minR,n=this.centerX+t.x+t.legendH*Math.sin(Math.PI/5)*t.r,a=this.centerY+t.y+t.legendV*Math.cos(Math.PI/5)*t.r,i={x1:n,x2:this.centerX+t.x+t.legendH*Math.sin(Math.PI/5)*(t.legendR+1.5*r),y1:a,y2:this.centerY+t.y+t.legendV*Math.cos(Math.PI/5)*(t.legendR+1.5*r),v:t.legendV,h:t.legendH};this._renderWireLegend(t.legend,i,"venn-legend")}},{key:"_drawLabel",value:function(t,e,r,n){var a=this.$svg.appendSVG("text","venn-label").attr("x",this.centerX+e).attr("y",this.centerY+r).text(t);n&&this.animationDuration&&a.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}},{key:"_show",value:function(t){if(1!==this.numberOfCircles){var e="mouseenter"===t.type?t.target:t.relatedTarget,r=e&&j()(e).hasClass("venn-circle");if(this.wasCircle&&r)return!1;this.wasCircle=r,this._draw(!0,t.data.showReal)}}}])&&Ut(e.prototype,r),n&&Ut(e,n),i}(J);function Kt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Qt=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$circle=e,this.x,this.y,this.r,this.legend,this.legendR,this.legendH,this.legendV,this.labels=[]}var e,r,n;return e=t,(r=[{key:"setLegend",value:function(t,e,r,n){this.legend=t,this.legendH=e,this.legendV=r,this.legendR=n||this.r}},{key:"addLabel",value:function(t,e,r){this.labels.push({text:t,x:e,y:r})}}])&&Kt(e.prototype,r),n&&Kt(e,n),t}();function te(t){return te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},te(t)}function ee(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function re(){return re="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=ne(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},re.apply(this,arguments)}function ne(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=se(t)););return t}function ae(t,e){return ae=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ae(t,e)}function ie(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=se(t);if(e){var a=se(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return oe(this,r)}}function oe(t,e){if(e&&("object"===te(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function se(t){return se=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},se(t)}var le=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ae(t,e)}(i,t);var e,r,n,a=ie(i);function i(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(t=a.call(this))._addWidgetProperties(["chart"]),t}return e=i,(r=[{key:"_render",value:function(){this.addContainer(this.$parent,"chart-field"),this.addLabel(),this.addMandatoryIndicator(),this.addStatus(),this._renderChart()}},{key:"_renderChart",value:function(){this.chart&&(this.chart.render(),this.addField(this.chart.$container))}},{key:"_removeChart",value:function(){this.chart.remove(),this._removeField()}},{key:"_renderOnAttach",value:function(){re(se(i.prototype),"_renderOnAttach",this).call(this),this.chart&&this.chart.chartRenderer&&this.chart.chartRenderer.checkCompletlyRendered()}}])&&ee(e.prototype,r),n&&ee(e,n),i}(a.FormField);function ce(t){return ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(t)}function ue(t,e){return ue=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ue(t,e)}function he(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=fe(t);if(e){var a=fe(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return de(this,r)}}function de(t,e){if(e&&("object"===ce(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function fe(t){return fe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},fe(t)}var pe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ue(t,e)}(r,t);var e=he(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e.call(this)}return r}(a.FormFieldAdapter);function ye(t){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(t)}function ve(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function be(){return be="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=ge(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},be.apply(this,arguments)}function ge(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=ke(t)););return t}function me(t,e){return me=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},me(t,e)}function _e(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=ke(t);if(e){var a=ke(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return Ce(this,r)}}function Ce(t,e){if(e&&("object"===ye(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return xe(t)}function xe(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ke(t){return ke=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ke(t)}var Te=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&me(t,e)}(i,t);var e,r,n,a=_e(i);function i(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(t=a.call(this))._chartConfigChangeHandler=t._onChartConfigChange.bind(xe(t)),t}return e=i,(r=[{key:"_renderColorScheme",value:function(){be(ke(i.prototype),"_renderColorScheme",this).call(this),this._updateChartColorScheme()}},{key:"_updateChartColorScheme",value:function(){var t=$.extend(!0,{},this.tileWidget.chart.config,{options:{colorScheme:this.colorScheme}});this.tileWidget.chart.setConfig(t)}},{key:"_onChartConfigChange",value:function(t){this._updateChartColorScheme()}},{key:"_setTileWidget",value:function(t){this.tileWidget&&this.tileWidget.chart.off("propertyChange:config",this._chartConfigChangeHandler),be(ke(i.prototype),"_setTileWidget",this).call(this,t),this.tileWidget.chart.on("propertyChange:config",this._chartConfigChangeHandler)}}])&&ve(e.prototype,r),n&&ve(e,n),i}(a.FormFieldTile);function Ae(t){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae(t)}function Oe(t,e){return Oe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Oe(t,e)}function Re(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Be(t);if(e){var a=Be(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return Se(this,r)}}function Se(t,e){if(e&&("object"===Ae(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Be(t){return Be=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Be(t)}var Le=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Oe(t,e)}(r,t);var e=Re(r);function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),e.call(this)}return r}(a.FormFieldTileAdapter);function we(t){return we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},we(t)}function Ee(t){return function(t){if(Array.isArray(t))return Pe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Pe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pe(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Me(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ie(){return Ie="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=je(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},Ie.apply(this,arguments)}function je(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ve(t)););return t}function De(t,e){return De=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},De(t,e)}function Ge(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Ve(t);if(e){var a=Ve(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return Ne(this,r)}}function Ne(t,e){if(e&&("object"===we(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return He(t)}function He(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ve(t){return Ve=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ve(t)}function $e(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Fe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&De(t,e)}(o,t);var e,r,n,i=Ge(o);function o(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this)).tooltipText="${textKey:ui.Chart}",t.chartAggregation={modifier:a.TableMatrix.NumberGroup.COUNT},t.chartType=v.Type.BAR,t.oldChartType=null,t.chartColorScheme="chart-table-control",t.$chartSelect=null,t.$xAxisSelect=null,t.$yAxisSelect=null,t.$dataSelect=null,t.xAxis=null,t.yAxis=null,t.dateGroup=null,t._tableUpdatedHandler=t._onTableUpdated.bind(He(t)),t._tableColumnStructureChangedHandler=t._onTableColumnStructureChanged.bind(He(t)),t._chartValueClickedHandler=t._onChartValueClick.bind(He(t)),t}return e=o,(r=[{key:"_init",value:function(t){Ie(Ve(o.prototype),"_init",this).call(this,t),this.table.on("columnStructureChanged",this._tableColumnStructureChangedHandler),this.chart=a.scout.create("Chart",{parent:this})}},{key:"_destroy",value:function(){this.table.off("columnStructureChanged",this._tableColumnStructureChangedHandler),Ie(Ve(o.prototype),"_destroy",this).call(this)}},{key:"_computeEnabled",value:function(t,e){return!(!this._hasColumns()&&!this.selected)&&Ie(Ve(o.prototype),"_computeEnabled",this).call(this,t,e)}},{key:"_renderChart",value:function(){this.chart&&(this.chart.render(this.$contentContainer),this.chart.$container.addClass(this.denseClass))}},{key:"_createLayout",value:function(){return new pr(this)}},{key:"_renderChartType",value:function(){var t=this;this._selectChartType(),this.oldChartType?(this.$yAxisSelect.animateAVCSD("width",this.chartType===v.Type.BUBBLE?175:0),this.$yAxisSelect.animateAVCSD("margin-right",this.chartType===v.Type.BUBBLE?15:0)):(this.$yAxisSelect.css("width",this.chartType===v.Type.BUBBLE?175:0),this.$yAxisSelect.css("margin-right",this.chartType===v.Type.BUBBLE?15:0)),this.contentRendered&&this.chart.$container.animateAVCSD("opacity",0,(function(){t.chart.$container.css("opacity",1),t._drawChart()}))}},{key:"_selectChartType",value:function(){a.objects.values(this._chartTypeMap).forEach((function(t){t.removeClass("selected")})),this._chartTypeMap[this.chartType].addClass("selected")}},{key:"_renderChartGroup1",value:function(){this._renderChartGroup(1)}},{key:"_renderChartGroup2",value:function(){this._renderChartGroup(2)}},{key:"_renderChartGroup",value:function(t){if(this._hasColumns()){var e="chartGroup"+t,r="_"+e+"Map",n=this[e];if(n){var a=this[r][n.id];if(a.siblings().animateAVCSD("height",30),a.selectOne("selected"),n.modifier>0){var i=n.modifier^o.DATE_GROUP_FLAG;a.animateAVCSD("height",42),a.children(".select-axis-group").text(this.dateGroup[i][1])}this.contentRendered&&this._drawChart()}}}},{key:"_renderChartAggregation",value:function(){var t=this._aggregationMap[this.chartAggregation.id||"all"];t&&(t.selectOne("selected"),t.removeClass("data-sum").removeClass("data-avg"),t.addClass(this._getAggregationCssClass()),this.contentRendered&&this._drawChart())}},{key:"_getAggregationCssClass",value:function(){switch(this.chartAggregation.modifier){case a.TableMatrix.NumberGroup.COUNT:return"data-count";case a.TableMatrix.NumberGroup.SUM:return"data-sum";case a.TableMatrix.NumberGroup.AVG:return"data-avg";default:return null}}},{key:"_renderChartSelect",value:function(t,e,r){var n=this.$chartSelect.appendSVG("svg",t+" select-chart").toggleClass("disabled",!this.enabledComputed||!this._hasColumns()).data("chartType",e);this.enabledComputed&&this._hasColumns()&&n.on("click",this._onClickChartType.bind(this)),this._chartTypeMap[e]=n,r(n)}},{key:"_renderChartSelectContainer",value:function(){this.$chartSelect=this.$contentContainer.appendDiv("chart-select"),this._chartTypeMap={};var t=this._getSupportedChartTypes();a.scout.isOneOf(v.Type.BAR,t)&&this._renderChartSelect("chart-bar",v.Type.BAR,(function(t){for(var e=[2,4,3,3.5,5],r=0;r<e.length;r++)t.appendSVG("rect","select-fill").attr("x",13*r).attr("y",50-9*e[r]).attr("width",11).attr("height",9*e[r])})),a.scout.isOneOf(v.Type.BAR_HORIZONTAL,t)&&this._renderChartSelect("chart-stacked",v.Type.BAR_HORIZONTAL,(function(t){for(var e=[2,4,3.5,4.5],r=0;r<e.length;r++)t.appendSVG("rect","select-fill").attr("x",0).attr("y",16+9*r).attr("width",14*e[r]).attr("height",7)})),a.scout.isOneOf(v.Type.LINE,t)&&this._renderChartSelect("chart-line",v.Type.LINE,(function(t){for(var e=[0,1.7,1,2,1.5,2.5],r=[],n=0;n<e.length;n++)r.push(2+12*n+","+(45-11*e[n]));t.appendSVG("path","select-fill-line").attr("d","M"+r.join("L"))})),a.scout.isOneOf(v.Type.PIE,t)&&this._renderChartSelect("chart-pie",v.Type.PIE,function(t){for(var e=[[0,.1],[.1,.25],[.25,1]],r=0;r<e.length;r++)t.appendSVG("path","select-fill-pie").attr("d",this._pathSegment(37,30,24,e[r][0],e[r][1]))}.bind(this)),a.scout.isOneOf(v.Type.BUBBLE,t)&&this._renderChartSelect("chart-bubble",v.Type.BUBBLE,(function(t){t.appendSVG("line","select-fill-line").attr("x1",3).attr("y1",53).attr("x2",63).attr("y2",53),t.appendSVG("line","select-fill-line").attr("x1",8).attr("y1",12).attr("x2",8).attr("y2",58),t.appendSVG("circle","select-fill").attr("cx",22).attr("cy",40).attr("r",5),t.appendSVG("circle","select-fill").attr("cx",50).attr("cy",26).attr("r",11)}))}},{key:"_getSupportedChartTypes",value:function(){return[v.Type.BAR,v.Type.BAR_HORIZONTAL,v.Type.LINE,v.Type.PIE,v.Type.BUBBLE]}},{key:"_onClickChartType",value:function(t){var e=j()(t.currentTarget).data("chartType");this.setChartType(e)}},{key:"_onClickChartGroup",value:function(t){var e=j()(t.currentTarget),r=e.parent().data("groupId"),n=e.data("column"),a=e.data("modifier");if(e.isEnabled()){var i=e.isSelected()?this._nextDateModifier(a):a;e.data("modifier",i);var o={id:n?n.id:null,modifier:i};this._setChartGroup(r,o)}}},{key:"_onClickAggregation",value:function(t){var e=j()(t.currentTarget),r=e.data("modifier"),n=e.isSelected()?this._nextModifier(r):r;e.data("modifier",n);var a=e.data("column"),i={id:a?a.id:null,modifier:n};this._setChartAggregation(i)}},{key:"_nextDateModifier",value:function(t){switch(t){case a.TableMatrix.DateGroup.DATE:return a.TableMatrix.DateGroup.MONTH;case a.TableMatrix.DateGroup.MONTH:return a.TableMatrix.DateGroup.WEEKDAY;case a.TableMatrix.DateGroup.WEEKDAY:return a.TableMatrix.DateGroup.YEAR;case a.TableMatrix.DateGroup.YEAR:return a.TableMatrix.DateGroup.DATE;default:return t}}},{key:"_nextModifier",value:function(t){switch(t){case a.TableMatrix.NumberGroup.SUM:return a.TableMatrix.NumberGroup.AVG;case a.TableMatrix.NumberGroup.AVG:return a.TableMatrix.NumberGroup.SUM;default:return t}}},{key:"_setChartAggregation",value:function(t){t!==this.chartAggregation&&(this._setProperty("chartAggregation",t),this.contentRendered&&this._renderChartAggregation())}},{key:"_setChartGroup1",value:function(t){this._setChartGroup(1,t)}},{key:"_setChartGroup2",value:function(t){this._setChartGroup(2,t)}},{key:"_setChartGroup",value:function(t,e){var r="chartGroup"+t;this._changeProperty(r,e)}},{key:"_changeProperty",value:function(t,e){e!==this[t]&&(this._setProperty(t,e),this.contentRendered&&this["_render"+t.charAt(0).toUpperCase()+t.slice(1)]())}},{key:"setChartType",value:function(t){this.oldChartType=this.chartType,this.setProperty("chartType",t)}},{key:"_hasColumns",value:function(){return 0!==this.table.columns.length}},{key:"_axisCount",value:function(t,e){var r;for(r=0;r<t.length;r++)if(t[r][0]===e)return t[r][1];return 0}},{key:"_plainAxisText",value:function(t,e){return t.headerHtmlEnabled?a.strings.plainText(e).replace(/\n/g," "):e}},{key:"_renderContent",value:function(t){var e=this;this.$contentContainer=t.appendDiv("chart-container"),this._installScrollbars(),this._renderChartSelectContainer(),this.dateGroup=[[a.TableMatrix.DateGroup.YEAR,this.session.text("ui.groupedByYear")],[a.TableMatrix.DateGroup.MONTH,this.session.text("ui.groupedByMonth")],[a.TableMatrix.DateGroup.WEEKDAY,this.session.text("ui.groupedByWeekday")],[a.TableMatrix.DateGroup.DATE,this.session.text("ui.groupedByDate")]],this._filterResetListener=this.table.on("filterReset",(function(t){e.chart&&e.chart.setCheckedItems([])})),this._addListeners(),j()(".select-chart",this.$contentContainer).appendSVG("rect","select-events").attr("width",65).attr("height",60).attr("fill","none").attr("pointer-events","all");var r=this._renderAxisSelectors();this._renderChart(),this._initializeSelection(r),this._renderChartParts(),this._drawChart()}},{key:"_addListeners",value:function(){this.table.on("rowsInserted",this._tableUpdatedHandler),this.table.on("rowsDeleted",this._tableUpdatedHandler),this.table.on("allRowsDeleted",this._tableUpdatedHandler),this.chart.on("valueClick",this._chartValueClickedHandler)}},{key:"_renderAxisSelectors",value:function(){this.$xAxisSelect=this.$contentContainer.appendDiv("xaxis-select").data("groupId",1),this.$yAxisSelect=this.$contentContainer.appendDiv("yaxis-select").data("groupId",2),this._chartGroup1Map={},this._chartGroup2Map={};var t=new a.TableMatrix(this.table,this.session),e=t.columnCount(!1);e.sort((function(t,e){return Math.abs(t[1]-8)-Math.abs(e[1]-8)}));for(var r,n=0,i=t.columns(!1),s=0;s<i.length;s++){var l,c=void 0,u=void 0,h=i[s];r=h instanceof a.DateColumn||this._axisCount(e,h)<=o.MAX_AXIS_COUNT,c=this._axisContentForColumn(h),u=this.$contentContainer.makeDiv("select-axis",this._plainAxisText(h,c.text)).data("column",h).setEnabled(r),r||(this.chartGroup1&&this.chartGroup1.id===h.id&&(this.chartGroup1=null,this.chartGroup2=null),this.chartGroup2&&this.chartGroup2.id===h.id&&(this.chartGroup2=null)),c.icon&&u.addClass(c.icon.appendCssClass("font-icon")),h instanceof a.DateColumn&&u.data("modifier",a.TableMatrix.DateGroup.YEAR).appendDiv("select-axis-group",this.dateGroup[0][1]),r?(u.on("click",this._onClickChartGroup.bind(this)),a.tooltips.installForEllipsis(u,{parent:this})):a.tooltips.install(u,{parent:this,text:this.session.text("ui.TooMuchData")}),n++,l=u.clone(!0),this._chartGroup1Map[h.id]=u,this._chartGroup2Map[h.id]=l,this.$xAxisSelect.append(u),this.$yAxisSelect.append(l)}if(n<2){var d=this.$contentContainer.find(".chart-bubble.select-chart");d&&d.remove()}if(this._aggregationMap={},this._hasColumns()){this.$dataSelect=this.$contentContainer.appendDiv("data-select");var f=this.session.text("ui.Count");this._aggregationMap.all=this.$dataSelect.appendDiv("select-data data-count",f).data("column",null).data("modifier",a.TableMatrix.NumberGroup.COUNT);for(var p=0;p<i.length;p++){var y=i[p],v=p+1;if(y instanceof a.NumberColumn){var b=void 0;b=a.strings.hasText(y.text)?this._plainAxisText(y,y.text):a.strings.hasText(y.headerTooltipText)?y.headerTooltipText:"["+v+"]",this._aggregationMap[y.id]=this.$dataSelect.appendDiv("select-data data-sum",b).data("column",y).data("modifier",a.TableMatrix.NumberGroup.SUM)}}j()(".select-data",this.$contentContainer).on("click",this._onClickAggregation.bind(this))}return e}},{key:"_initializeSelection",value:function(t){var e;this.chartType||this.setChartType(v.Type.BAR),this.chartAggregation&&this._aggregationMap[this.chartAggregation.id]||this._setChartAggregation({id:null,modifier:a.TableMatrix.NumberGroup.COUNT}),this.chartGroup1&&this.chartGroup1.id&&this._chartGroup1Map[this.chartGroup1.id]||(e=this.$xAxisSelect.children(":not(.disabled)"),this._setDefaultSelectionForGroup(1,t,e,0)),this.chartGroup2&&this.chartGroup2.id&&this._chartGroup2Map[this.chartGroup2.id]||(e=this.$yAxisSelect.children(":not(.disabled)"),this._setDefaultSelectionForGroup(2,t,e,1))}},{key:"_setDefaultSelectionForGroup",value:function(t,e,r,n){var a=this._getDefaultSelectedColumn(e,r,n);a&&this._setChartGroup(t,this._getDefaultChartGroup(a))}},{key:"_getDefaultSelectedColumn",value:function(t,e,r){for(var n,a,i=0,o=0;o<t.length&&i<=r;o++)n=t[o][0],this._existsInAxisColumns(e,n)&&(a=n,i++);return a}},{key:"_existsInAxisColumns",value:function(t,e){for(var r=0;r<t.length;r++)if(t.eq(r).data("column")===e)return!0;return!1}},{key:"_getDefaultChartGroup",value:function(t){var e;return t instanceof a.DateColumn&&(e=256),{id:t.id,modifier:e}}},{key:"_renderChartParts",value:function(){this._renderChartType(),this._renderChartAggregation(),this._renderChartGroup1(),this._renderChartGroup2()}},{key:"_drawChart",value:function(){if(this._hasColumns()){var t=this._calculateValues();if(t.length){this.chart.setVisible(!0);var e={type:this.chartType,options:{handleResize:!0,colorScheme:this.chartColorScheme,maxSegments:5,legend:{display:!1}}},r=[];e.data=this._computeData(r,t),this._adjustFont(e,r),this._adjustConfig(e),this.chart.setConfig(e);var n=this._computeCheckedItems(e.data.datasets[0].deterministicKeys);this.chart.setCheckedItems(n)}else this._hideChart()}else this._hideChart()}},{key:"_hideChart",value:function(){this.chart.setConfig({type:this.chartType}),this.chart.setVisible(!1)}},{key:"_getDatasetLabel",value:function(){var t=this._aggregationMap[this.chartAggregation.id||"all"];return(t?t.text():null)||this.session.text("ui.Value")}},{key:"_calculateValues",value:function(){var t=new a.TableMatrix(this.table,this.session),e=this.chartAggregation.id?this._aggregationMap[this.chartAggregation.id].data("column"):-1;if(t.addData(e,this.chartAggregation.modifier),this.chartGroup1){var r=this._chartGroup1Map[this.chartGroup1.id].data("column");this.xAxis=t.addAxis(r,this.chartGroup1.modifier)}if(this.chartType===v.Type.BUBBLE&&this.chartGroup2){var n=this._chartGroup2Map[this.chartGroup2.id].data("column");this.yAxis=t.addAxis(n,this.chartGroup2.modifier)}else this.yAxis=null;return!(t.isEmpty()||!t.isMatrixValid())&&t.calculate()}},{key:"_getXAxis",value:function(){return this.xAxis}},{key:"_getYAxis",value:function(){return this.yAxis}},{key:"_computeData",value:function(t,e){var r={datasets:[{label:this._getDatasetLabel()}]};if(!e)return r;t=t||[];var n=[];if(this.chartType===v.Type.BUBBLE)n=this._computeBubbleData(t,e);else for(var i=this._getXAxis(),o=0;o<i.length;o++){var s=void 0,l=i[o];s=i.column instanceof a.NumberColumn?l:this._handleIconLabel(i.format(l),i,t),n.push({value:e.getValue([l])[0],label:s,deterministicKey:i.keyToDeterministicKey(l)})}var c=r.datasets[0],u=[];return c.data=[],c.deterministicKeys=[],n.forEach((function(t){c.data.push(t.value),c.deterministicKeys.push(t.deterministicKey),a.objects.isNullOrUndefined(t.label)||u.push(t.label)})),u.length&&(r.labels=u),this.chartType===v.Type.PIE&&(r.datasets[1]=j.a.extend(!0,{},c)),r}},{key:"_computeBubbleData",value:function(t,e){if(!e)return[];t=t||[];for(var r=this._getXAxis(),n=this._getYAxis(),i=[],o=0;o<r.length;o++){var s=r[o],l=s;this._handleIconLabel(r.format(s),r,t),r.column instanceof a.NumberColumn||null!==l||(l=r.max),r.column instanceof a.DateColumn&&(l-=r.min);for(var c=0;c<n.length;c++){var u=n[c],h=u,d=e.getValue([s,u]);this._handleIconLabel(n.format(u),n,t),d&&d.length&&(n.column instanceof a.NumberColumn||null!==h||(h=n.max),n.column instanceof a.DateColumn&&(h-=n.min),i.push({value:{x:l,y:h,z:d[0]},deterministicKey:[r.keyToDeterministicKey(s),n.keyToDeterministicKey(u)]}))}}return i}},{key:"_handleIconLabel",value:function(t,e,r){if(e&&e.textIsIcon){var n=a.icons.parseIconId(t);if(n&&n.isFontIcon())return r.push.apply(r,Ee(n.appendCssClass("font-icon").split(" "))),n.iconCharacter}return t}},{key:"_adjustFont",value:function(t,e){if(t&&e&&(e=e.filter((function(t,e,r){return r.indexOf(t)===e}))).length){var r=a.styles.get(e,"font-family").fontFamily;this.chartType!==v.Type.PIE&&(t.options=j.a.extend(!0,{},t.options,{scales:{xAxes:[{ticks:{fontFamily:r}}],yAxes:[{ticks:{fontFamily:r}}]}})),t.options=j.a.extend(!0,{},t.options,{tooltips:{titleFontFamily:r}}),t.options=j.a.extend(!0,{},t.options,{plugins:{datalabels:{font:{family:r}}}})}}},{key:"_adjustLabels",value:function(t){var e=this;if(t){var r=this._getXAxis(),n=this._getYAxis();this.chartType===v.Type.BUBBLE?(r.column instanceof a.NumberColumn||(t.options=j.a.extend(!0,{},t.options,{scales:{xAxes:[{ticks:{callback:function(t){return e._formatLabel(t,r)}}}]}})),n.column instanceof a.NumberColumn||(t.options=j.a.extend(!0,{},t.options,{scales:{yAxes:[{ticks:{callback:function(t){return e._formatLabel(t,n)}}}]}}))):r.column instanceof a.NumberColumn&&(t.options=j.a.extend(!0,{},t.options,{reformatLabels:!0}))}}},{key:"_formatLabel",value:function(t,e){if(e){if(e.column instanceof a.DateColumn&&((t+=e.min)!==parseInt(t)||e.length<2&&(t<e.min||t>e.max)))return null;if(-1!==e.indexOf(null))if(t===e.max)t=null;else if(t>e.max)return null;if(t=e.format(t),e.textIsIcon){var r=a.icons.parseIconId(t);r&&r.isFontIcon()&&(t=r.iconCharacter)}}return t}},{key:"_adjustConfig",value:function(t){t&&(this._adjustLabels(t),this._adjustClickable(t),this.chartType===v.Type.BUBBLE?this._adjustBubble(t):this.chartType===v.Type.PIE?this._adjustPie(t):this._adjustScales(t))}},{key:"_adjustClickable",value:function(t){t&&this._isChartClickable()&&(t.options=j.a.extend(!0,{},t.options,{clickable:!0,checkable:!0,otherSegmentClickable:!0}))}},{key:"_isChartClickable",value:function(){return!0}},{key:"_adjustBubble",value:function(t){t&&this.chartType===v.Type.BUBBLE&&(t.bubble=j.a.extend(!0,{},t.bubble,{sizeOfLargestBubble:25,minBubbleSize:5}))}},{key:"_adjustPie",value:function(t){if(t&&this.chartType===v.Type.PIE){t.data.datasets[0].weight=0,t.data.datasets[0].datalabels={display:"auto",color:a.styles.get([this.chartColorScheme,this.chartType+"-chart","elements","label"],"fill").fill,formatter:function(t,e){return e.chart.data.labels[e.dataIndex]},anchor:"end",align:"end",clamp:!0,offset:10,padding:4},t.options=j.a.extend(!0,{},t.options,{plugins:{datalabels:{display:!0}}});var e=this.chart.$container.cssMarginTop()-this.chart.$container.cssMarginBottom();t.options=j.a.extend(!0,{},t.options,{layout:{padding:{top:30+(Math.sign(e)<0?Math.abs(e):0),bottom:30+(Math.sign(e)>0?e:0)}}})}}},{key:"_adjustScales",value:function(t){t&&(t.options=j.a.extend(!0,{},t.options,{scales:{xAxes:[{ticks:{beginAtZero:!0}}],yAxes:[{ticks:{beginAtZero:!0}}]}}))}},{key:"_computeCheckedItems",value:function(t){if(!t)return[];var e=this._getXAxis(),r=this._getYAxis(),n=this.table.getFilter(er.TYPE),i=[],o=[];n&&(n.xAxis||{}).column===(e||{}).column&&(n.yAxis||{}).column===(r||{}).column&&(i=n.filters),t.forEach((function(t,e){i.filter((function(e){return Array.isArray(e.deterministicKey)&&Array.isArray(t)?a.arrays.equals(e.deterministicKey,t):e.deterministicKey===t})).length&&o.push(e)}));var s=0;if(this.chartType===v.Type.PIE){var l=this.chart.config.options.maxSegments,c=a.arrays.init(t.length-l).map((function(t,e){return e+l}));a.arrays.containsAll(o,c)||a.arrays.remove(o,l-1),a.arrays.removeAll(o,c),s=1}var u=[];return o.length&&o.forEach((function(t){u.push({datasetIndex:s,dataIndex:t})})),u}},{key:"_onChartValueClick",value:function(){var t=[];if(this.chart&&this.chart.config.data){var e=this.chart.config.options.maxSegments,r=this.chartType===v.Type.PIE?1:0,n=this.chart.config.data.datasets[r],i=function(t){return{deterministicKey:n.deterministicKeys[t]}};this.chartType===v.Type.PIE&&(i=function(t){return t=parseInt(t),e&&e===t+1?a.arrays.init(n.deterministicKeys.length-t).map((function(e,r){return{deterministicKey:n.deterministicKeys[r+t]}})):{deterministicKey:n.deterministicKeys[t]}}),this.chart.checkedItems.filter((function(t){return t.datasetIndex===r})).map((function(t){return t.dataIndex})).forEach((function(e){a.arrays.pushAll(t,i(e))}))}if(t.length){var o=a.scout.create("ChartTableUserFilter",{session:this.session,table:this.table,text:this.tooltipText,xAxis:this._getXAxis(),yAxis:this._getYAxis(),filters:t});this.table.addFilter(o)}else this.table.removeFilterByKey(er.TYPE);this.table.filter()}},{key:"_axisContentForColumn",value:function(t){var e,r=t.text;return a.strings.hasText(r)?{text:r}:t.headerIconId&&(e=a.icons.parseIconId(t.headerIconId)).isFontIcon()?{text:e.iconCharacter,icon:e}:t.headerTooltipText?{text:t.headerTooltipText}:{text:"["+(this.table.visibleColumns().indexOf(t)+1)+"]"}}},{key:"_removeContent",value:function(){this._removeScrollbars(),this.$contentContainer.remove(),this.chart.remove(),this.table.events.removeListener(this._filterResetListener),this._removeListeners(),this.oldChartType=null,this.recomputeEnabled()}},{key:"_removeScrollbars",value:function(){this.$xAxisSelect.each((function(t,e){a.tooltips.uninstall(j()(e))})),this.$yAxisSelect.each((function(t,e){a.tooltips.uninstall(j()(e))})),this._uninstallScrollbars()}},{key:"_removeListeners",value:function(){this.table.off("rowsInserted",this._tableUpdatedHandler),this.table.off("rowsDeleted",this._tableUpdatedHandler),this.table.off("allRowsDeleted",this._tableUpdatedHandler),this.chart.off("valueClick",this._chartValueClickedHandler)}},{key:"_pathSegment",value:function(t,e,r,n,a){var i=2*n*Math.PI,o=2*a*Math.PI,s="";return s+="M"+(t+r*Math.sin(i))+","+(e-r*Math.cos(i)),s+="A"+r+", "+r,s+=a-n<.5?" 0 0,1 ":" 0 1,1 ",s+=t+r*Math.sin(o)+","+(e-r*Math.cos(o)),s+="L"+t+","+e+"Z"}},{key:"_onTableUpdated",value:function(t){var e=this;this._tableUpdatedTimeOutId||(this._tableUpdatedTimeOutId=setTimeout((function(){e._tableUpdatedTimeOutId=null,e.rendered&&(e._setChartGroup1(null),e._setChartGroup2(null),e.removeContent(),e.renderContent())})))}},{key:"_onTableColumnStructureChanged",value:function(){this.recomputeEnabled(),this.contentRendered&&this.selected&&this._onTableUpdated()}}])&&Me(e.prototype,r),n&&Me(e,n),o}(a.TableControl);function Ue(t){return Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ue(t)}function We(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ze(){return ze="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=Je(t,e);if(n){var a=Object.getOwnPropertyDescriptor(n,e);return a.get?a.get.call(arguments.length<3?t:r):a.value}},ze.apply(this,arguments)}function Je(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=qe(t)););return t}function Xe(t,e){return Xe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Xe(t,e)}function Ye(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=qe(t);if(e){var a=qe(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return Ze(this,r)}}function Ze(t,e){if(e&&("object"===Ue(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function qe(t){return qe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},qe(t)}$e(Fe,"DATE_GROUP_FLAG",256),$e(Fe,"MAX_AXIS_COUNT",100);var Ke,Qe,tr,er=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Xe(t,e)}(o,t);var e,r,n,i=Ye(o);function o(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(t=i.call(this)).filterType=o.TYPE,t.text=null,t.xAxis=null,t.yAxis=null,t.filters=[],t.columnIdX=null,t.columnIdY=null,t}return e=o,(r=[{key:"createLabel",value:function(){return this.text}},{key:"createFilterAddedEventData",value:function(){var t=ze(qe(o.prototype),"createFilterAddedEventData",this).call(this);return t.text=this.text,t.filters=this.filters,t.columnIdX=this.xAxis&&this.xAxis.column?this.xAxis.column.id:null,t.columnIdY=this.yAxis&&this.yAxis.column?this.yAxis.column.id:null,t}},{key:"calculate",value:function(){var t=new a.TableMatrix(this.table,this.session),e=this.table.columnById(this.columnIdX),r=e.createFilter().axisGroup();if(this.xAxis=t.addAxis(e,r),this.columnIdY){var n=this.table.columnById(this.columnIdY),i=n.createFilter().axisGroup();this.yAxis=t.addAxis(n,i)}t.calculate()}},{key:"accept",value:function(t){this.xAxis||this.calculate();var e=this.xAxis.column.cellValueOrTextForCalculation(t),r=this.xAxis.normDeterministic(e);if(!this.yAxis)return this.filters.filter((function(t){return t.deterministicKey===r})).length;e=this.yAxis.column.cellValueOrTextForCalculation(t);var n=this.yAxis.normDeterministic(e);return this.filters.filter((function(t){return a.arrays.equals(t.deterministicKey,[r,n])})).length}}])&&We(e.prototype,r),n&&We(e,n),o}(a.TableUserFilter);function rr(t){return rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rr(t)}function nr(t,e){return nr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},nr(t,e)}function ar(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=or(t);if(e){var a=or(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return ir(this,r)}}function ir(t,e){if(e&&("object"===rr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function or(t){return or=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},or(t)}tr="CHART",(Qe="TYPE")in(Ke=er)?Object.defineProperty(Ke,Qe,{value:tr,enumerable:!0,configurable:!0,writable:!0}):Ke[Qe]=tr;var sr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&nr(t,e)}(r,t);var e=ar(r);function r(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),(t=e.call(this))._addRemoteProperties(["chartType","chartAggregation","chartGroup1","chartGroup2"]),t}return r}(a.TableControlAdapter);function lr(t){return lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lr(t)}function cr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ur(t,e){return ur=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ur(t,e)}function hr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=fr(t);if(e){var a=fr(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return dr(this,r)}}function dr(t,e){if(e&&("object"===lr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function fr(t){return fr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},fr(t)}var pr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ur(t,e)}(o,t);var e,r,n,i=hr(o);function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this)).control=t,e}return e=o,(r=[{key:"layout",value:function(t){this.control.contentRendered&&a.scrollbars.update(this.control.$contentContainer)}}])&&cr(e.prototype,r),n&&cr(e,n),o}(a.AbstractLayout);function yr(){return yr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},yr.apply(this,arguments)}var vr=e.default=n;window.scout=yr(window.scout||{},n)}]);
|
|
2
|
+
//# sourceMappingURL=eclipse-scout-chart-4f219da36ee28808d3bf.min.js.map
|